diff --git "a/src/backend/gradio_shinymodel3d/templates/component/index.js" "b/src/backend/gradio_shinymodel3d/templates/component/index.js"
new file mode 100644--- /dev/null
+++ "b/src/backend/gradio_shinymodel3d/templates/component/index.js"
@@ -0,0 +1,77862 @@
+var ah = new Intl.Collator(0, { numeric: 1 }).compare;
+function Tm(M, F, V) {
+ return M = M.split("."), F = F.split("."), ah(M[0], F[0]) || ah(M[1], F[1]) || (F[2] = F.slice(2).join("."), V = /[.-]/.test(M[2] = M.slice(2).join(".")), V == /[.-]/.test(F[2]) ? ah(M[2], F[2]) : V ? -1 : 1);
+}
+function Nr(M, F, V) {
+ return F.startsWith("http://") || F.startsWith("https://") ? V ? M : F : M + F;
+}
+function sh(M) {
+ if (M.startsWith("http")) {
+ const { protocol: F, host: V } = new URL(M);
+ return V.endsWith("hf.space") ? {
+ ws_protocol: "wss",
+ host: V,
+ http_protocol: F
+ } : {
+ ws_protocol: F === "https:" ? "wss" : "ws",
+ http_protocol: F,
+ host: V
+ };
+ } else if (M.startsWith("file:"))
+ return {
+ ws_protocol: "ws",
+ http_protocol: "http:",
+ host: "lite.local"
+ // Special fake hostname only used for this case. This matches the hostname allowed in `is_self_host()` in `js/wasm/network/host.ts`.
+ };
+ return {
+ ws_protocol: "wss",
+ http_protocol: "https:",
+ host: M
+ };
+}
+const qg = /^[^\/]*\/[^\/]*$/, WT = /.*hf\.space\/{0,1}$/;
+async function XT(M, F) {
+ const V = {};
+ F && (V.Authorization = `Bearer ${F}`);
+ const _ = M.trim();
+ if (qg.test(_))
+ try {
+ const l = await fetch(
+ `https://huggingface.co/api/spaces/${_}/host`,
+ { headers: V }
+ );
+ if (l.status !== 200)
+ throw new Error("Space metadata could not be loaded.");
+ const D = (await l.json()).host;
+ return {
+ space_id: M,
+ ...sh(D)
+ };
+ } catch (l) {
+ throw new Error("Space metadata could not be loaded." + l.message);
+ }
+ if (WT.test(_)) {
+ const { ws_protocol: l, http_protocol: D, host: f } = sh(_);
+ return {
+ space_id: f.replace(".hf.space", ""),
+ ws_protocol: l,
+ http_protocol: D,
+ host: f
+ };
+ }
+ return {
+ space_id: !1,
+ ...sh(_)
+ };
+}
+function YT(M) {
+ let F = {};
+ return M.forEach(({ api_name: V }, _) => {
+ V && (F[V] = _);
+ }), F;
+}
+const KT = /^(?=[^]*\b[dD]iscussions{0,1}\b)(?=[^]*\b[dD]isabled\b)[^]*$/;
+async function Sm(M) {
+ try {
+ const V = (await fetch(
+ `https://huggingface.co/api/spaces/${M}/discussions`,
+ {
+ method: "HEAD"
+ }
+ )).headers.get("x-error-message");
+ return !(V && KT.test(V));
+ } catch {
+ return !1;
+ }
+}
+function ao(M, F, V) {
+ if (M == null)
+ return null;
+ if (Array.isArray(M)) {
+ const _ = [];
+ for (const l of M)
+ l == null ? _.push(null) : _.push(ao(l, F, V));
+ return _;
+ }
+ return M.is_stream ? V == null ? new ta({
+ ...M,
+ url: F + "/stream/" + M.path
+ }) : new ta({
+ ...M,
+ url: "/proxy=" + V + "stream/" + M.path
+ }) : new ta({
+ ...M,
+ url: qT(M.path, F, V)
+ });
+}
+function QT(M) {
+ try {
+ const F = new URL(M);
+ return F.protocol === "http:" || F.protocol === "https:";
+ } catch {
+ return !1;
+ }
+}
+function qT(M, F, V) {
+ return M == null ? V ? `/proxy=${V}file=` : `${F}/file=` : QT(M) ? M : V ? `/proxy=${V}file=${M}` : `${F}/file=${M}`;
+}
+async function ZT(M, F, V = tS) {
+ let _ = (Array.isArray(M) ? M : [M]).map(
+ (l) => l.blob
+ );
+ return await Promise.all(
+ await V(F, _).then(
+ async (l) => {
+ if (l.error)
+ throw new Error(l.error);
+ return l.files ? l.files.map((D, f) => {
+ const P = new ta({ ...M[f], path: D });
+ return ao(P, F, null);
+ }) : [];
+ }
+ )
+ );
+}
+async function JT(M, F) {
+ return M.map(
+ (V, _) => new ta({
+ path: V.name,
+ orig_name: V.name,
+ blob: V,
+ size: V.size,
+ mime_type: V.type,
+ is_stream: F
+ })
+ );
+}
+class ta {
+ constructor({
+ path: F,
+ url: V,
+ orig_name: _,
+ size: l,
+ blob: D,
+ is_stream: f,
+ mime_type: P,
+ alt_text: c
+ }) {
+ this.path = F, this.url = V, this.orig_name = _, this.size = l, this.blob = V ? void 0 : D, this.is_stream = f, this.mime_type = P, this.alt_text = c;
+ }
+}
+const $T = "This application is too busy. Keep trying!", Ka = "Connection errored out.";
+let Zg;
+function eS(M, F) {
+ return { post_data: V, upload_files: _, client: l, handle_blob: D };
+ async function V(f, P, c) {
+ const C = { "Content-Type": "application/json" };
+ c && (C.Authorization = `Bearer ${c}`);
+ try {
+ var x = await M(f, {
+ method: "POST",
+ body: JSON.stringify(P),
+ headers: C
+ });
+ } catch {
+ return [{ error: Ka }, 500];
+ }
+ return [await x.json(), x.status];
+ }
+ async function _(f, P, c) {
+ const C = {};
+ c && (C.Authorization = `Bearer ${c}`);
+ const x = 1e3, R = [];
+ for (let u = 0; u < P.length; u += x) {
+ const E = P.slice(u, u + x), A = new FormData();
+ E.forEach((v) => {
+ A.append("files", v);
+ });
+ try {
+ var g = await M(`${f}/upload`, {
+ method: "POST",
+ body: A,
+ headers: C
+ });
+ } catch {
+ return { error: Ka };
+ }
+ const y = await g.json();
+ R.push(...y);
+ }
+ return { files: R };
+ }
+ async function l(f, P = { normalise_files: !0 }) {
+ return new Promise(async (c) => {
+ const { status_callback: C, hf_token: x, normalise_files: R } = P, g = {
+ predict: j,
+ submit: W,
+ view_api: oe,
+ component_server: Y
+ }, u = R ?? !0;
+ if ((typeof window > "u" || !("WebSocket" in window)) && !global.Websocket) {
+ const te = await import("./wrapper-98f94c21-f7f71f53.js");
+ Zg = (await import("./__vite-browser-external-2447137e.js")).Blob, global.WebSocket = te.WebSocket;
+ }
+ const { ws_protocol: E, http_protocol: A, host: y, space_id: v } = await XT(f, x), h = Math.random().toString(36).substring(2), d = {};
+ let b, T = {}, N = !1;
+ x && v && (N = await iS(v, x));
+ async function U(te) {
+ if (b = te, T = YT((te == null ? void 0 : te.dependencies) || []), b.auth_required)
+ return {
+ config: b,
+ ...g
+ };
+ try {
+ B = await oe(b);
+ } catch (_e) {
+ console.error(`Could not get api details: ${_e.message}`);
+ }
+ return {
+ config: b,
+ ...g
+ };
+ }
+ let B;
+ async function L(te) {
+ if (C && C(te), te.status === "running")
+ try {
+ b = await xm(
+ M,
+ `${A}//${y}`,
+ x
+ );
+ const _e = await U(b);
+ c(_e);
+ } catch (_e) {
+ console.error(_e), C && C({
+ status: "error",
+ message: "Could not load this space.",
+ load_status: "error",
+ detail: "NOT_FOUND"
+ });
+ }
+ }
+ try {
+ b = await xm(
+ M,
+ `${A}//${y}`,
+ x
+ );
+ const te = await U(b);
+ c(te);
+ } catch (te) {
+ console.error(te), v ? Dh(
+ v,
+ qg.test(v) ? "space_name" : "subdomain",
+ L
+ ) : C && C({
+ status: "error",
+ message: "Could not load this space.",
+ load_status: "error",
+ detail: "NOT_FOUND"
+ });
+ }
+ function j(te, _e, de) {
+ let ae = !1, ie = !1, Z;
+ if (typeof te == "number")
+ Z = b.dependencies[te];
+ else {
+ const ee = te.replace(/^\//, "");
+ Z = b.dependencies[T[ee]];
+ }
+ if (Z.types.continuous)
+ throw new Error(
+ "Cannot call predict on this function as it may run forever. Use submit instead"
+ );
+ return new Promise((ee, w) => {
+ const z = W(te, _e, de);
+ let q;
+ z.on("data", (le) => {
+ ie && (z.destroy(), ee(le)), ae = !0, q = le;
+ }).on("status", (le) => {
+ le.stage === "error" && w(le), le.stage === "complete" && (ie = !0, ae && (z.destroy(), ee(q)));
+ });
+ });
+ }
+ function W(te, _e, de) {
+ let ae, ie;
+ if (typeof te == "number")
+ ae = te, ie = B.unnamed_endpoints[ae];
+ else {
+ const ye = te.replace(/^\//, "");
+ ae = T[ye], ie = B.named_endpoints[te.trim()];
+ }
+ if (typeof ae != "number")
+ throw new Error(
+ "There is no endpoint matching that name of fn_index matching that number."
+ );
+ let Z, ee, w = b.protocol ?? "sse";
+ const z = typeof te == "number" ? "/predict" : te;
+ let q, le = null, ce = !1;
+ const J = {};
+ let H = "";
+ typeof window < "u" && (H = new URLSearchParams(window.location.search).toString()), D(
+ `${A}//${Nr(y, b.path, !0)}`,
+ _e,
+ ie,
+ x
+ ).then((ye) => {
+ if (q = { data: ye || [], event_data: de, fn_index: ae }, rS(ae, b))
+ X({
+ type: "status",
+ endpoint: z,
+ stage: "pending",
+ queue: !1,
+ fn_index: ae,
+ time: /* @__PURE__ */ new Date()
+ }), V(
+ `${A}//${Nr(y, b.path, !0)}/run${z.startsWith("/") ? z : `/${z}`}${H ? "?" + H : ""}`,
+ {
+ ...q,
+ session_hash: h
+ },
+ x
+ ).then(([ge, Te]) => {
+ const Re = u ? ch(
+ ge.data,
+ ie,
+ b.root,
+ b.root_url
+ ) : ge.data;
+ Te == 200 ? (X({
+ type: "data",
+ endpoint: z,
+ fn_index: ae,
+ data: Re,
+ time: /* @__PURE__ */ new Date()
+ }), X({
+ type: "status",
+ endpoint: z,
+ fn_index: ae,
+ stage: "complete",
+ eta: ge.average_duration,
+ queue: !1,
+ time: /* @__PURE__ */ new Date()
+ })) : X({
+ type: "status",
+ stage: "error",
+ endpoint: z,
+ fn_index: ae,
+ message: ge.error,
+ queue: !1,
+ time: /* @__PURE__ */ new Date()
+ });
+ }).catch((ge) => {
+ X({
+ type: "status",
+ stage: "error",
+ message: ge.message,
+ endpoint: z,
+ fn_index: ae,
+ queue: !1,
+ time: /* @__PURE__ */ new Date()
+ });
+ });
+ else if (w == "ws") {
+ X({
+ type: "status",
+ stage: "pending",
+ queue: !0,
+ endpoint: z,
+ fn_index: ae,
+ time: /* @__PURE__ */ new Date()
+ });
+ let ge = new URL(`${E}://${Nr(
+ y,
+ b.path,
+ !0
+ )}
+ /queue/join${H ? "?" + H : ""}`);
+ N && ge.searchParams.set("__sign", N), Z = F(ge), Z.onclose = (Te) => {
+ Te.wasClean || X({
+ type: "status",
+ stage: "error",
+ broken: !0,
+ message: Ka,
+ queue: !0,
+ endpoint: z,
+ fn_index: ae,
+ time: /* @__PURE__ */ new Date()
+ });
+ }, Z.onmessage = function(Te) {
+ const Re = JSON.parse(Te.data), { type: Se, status: Ne, data: ze } = Rm(
+ Re,
+ d[ae]
+ );
+ if (Se === "update" && Ne && !ce)
+ X({
+ type: "status",
+ endpoint: z,
+ fn_index: ae,
+ time: /* @__PURE__ */ new Date(),
+ ...Ne
+ }), Ne.stage === "error" && Z.close();
+ else if (Se === "hash") {
+ Z.send(JSON.stringify({ fn_index: ae, session_hash: h }));
+ return;
+ } else
+ Se === "data" ? Z.send(JSON.stringify({ ...q, session_hash: h })) : Se === "complete" ? ce = Ne : Se === "log" ? X({
+ type: "log",
+ log: ze.log,
+ level: ze.level,
+ endpoint: z,
+ fn_index: ae
+ }) : Se === "generating" && X({
+ type: "status",
+ time: /* @__PURE__ */ new Date(),
+ ...Ne,
+ stage: Ne == null ? void 0 : Ne.stage,
+ queue: !0,
+ endpoint: z,
+ fn_index: ae
+ });
+ ze && (X({
+ type: "data",
+ time: /* @__PURE__ */ new Date(),
+ data: u ? ch(
+ ze.data,
+ ie,
+ b.root,
+ b.root_url
+ ) : ze.data,
+ endpoint: z,
+ fn_index: ae
+ }), ce && (X({
+ type: "status",
+ time: /* @__PURE__ */ new Date(),
+ ...ce,
+ stage: Ne == null ? void 0 : Ne.stage,
+ queue: !0,
+ endpoint: z,
+ fn_index: ae
+ }), Z.close()));
+ }, Tm(b.version || "2.0.0", "3.6") < 0 && addEventListener(
+ "open",
+ () => Z.send(JSON.stringify({ hash: h }))
+ );
+ } else {
+ X({
+ type: "status",
+ stage: "pending",
+ queue: !0,
+ endpoint: z,
+ fn_index: ae,
+ time: /* @__PURE__ */ new Date()
+ });
+ var be = new URLSearchParams({
+ fn_index: ae.toString(),
+ session_hash: h
+ }).toString();
+ let ge = new URL(
+ `${A}//${Nr(
+ y,
+ b.path,
+ !0
+ )}/queue/join?${H ? H + "&" : ""}${be}`
+ );
+ ee = new EventSource(ge), ee.onmessage = async function(Te) {
+ const Re = JSON.parse(Te.data), { type: Se, status: Ne, data: ze } = Rm(
+ Re,
+ d[ae]
+ );
+ if (Se === "update" && Ne && !ce)
+ X({
+ type: "status",
+ endpoint: z,
+ fn_index: ae,
+ time: /* @__PURE__ */ new Date(),
+ ...Ne
+ }), Ne.stage === "error" && ee.close();
+ else if (Se === "data") {
+ le = Re.event_id;
+ let [Ye, He] = await V(
+ `${A}//${Nr(
+ y,
+ b.path,
+ !0
+ )}/queue/data`,
+ {
+ ...q,
+ session_hash: h,
+ event_id: le
+ },
+ x
+ );
+ He !== 200 && (X({
+ type: "status",
+ stage: "error",
+ message: Ka,
+ queue: !0,
+ endpoint: z,
+ fn_index: ae,
+ time: /* @__PURE__ */ new Date()
+ }), ee.close());
+ } else
+ Se === "complete" ? ce = Ne : Se === "log" ? X({
+ type: "log",
+ log: ze.log,
+ level: ze.level,
+ endpoint: z,
+ fn_index: ae
+ }) : Se === "generating" && X({
+ type: "status",
+ time: /* @__PURE__ */ new Date(),
+ ...Ne,
+ stage: Ne == null ? void 0 : Ne.stage,
+ queue: !0,
+ endpoint: z,
+ fn_index: ae
+ });
+ ze && (X({
+ type: "data",
+ time: /* @__PURE__ */ new Date(),
+ data: u ? ch(
+ ze.data,
+ ie,
+ b.root,
+ b.root_url
+ ) : ze.data,
+ endpoint: z,
+ fn_index: ae
+ }), ce && (X({
+ type: "status",
+ time: /* @__PURE__ */ new Date(),
+ ...ce,
+ stage: Ne == null ? void 0 : Ne.stage,
+ queue: !0,
+ endpoint: z,
+ fn_index: ae
+ }), ee.close()));
+ };
+ }
+ });
+ function X(ye) {
+ const ge = J[ye.type] || [];
+ ge == null || ge.forEach((Te) => Te(ye));
+ }
+ function ne(ye, be) {
+ const ge = J, Te = ge[ye] || [];
+ return ge[ye] = Te, Te == null || Te.push(be), { on: ne, off: Q, cancel: $, destroy: me };
+ }
+ function Q(ye, be) {
+ const ge = J;
+ let Te = ge[ye] || [];
+ return Te = Te == null ? void 0 : Te.filter((Re) => Re !== be), ge[ye] = Te, { on: ne, off: Q, cancel: $, destroy: me };
+ }
+ async function $() {
+ const ye = {
+ stage: "complete",
+ queue: !1,
+ time: /* @__PURE__ */ new Date()
+ };
+ ce = ye, X({
+ ...ye,
+ type: "status",
+ endpoint: z,
+ fn_index: ae
+ });
+ let be = {};
+ w === "ws" ? (Z && Z.readyState === 0 ? Z.addEventListener("open", () => {
+ Z.close();
+ }) : Z.close(), be = { fn_index: ae, session_hash: h }) : (ee.close(), be = { event_id: le });
+ try {
+ await M(
+ `${A}//${Nr(
+ y,
+ b.path,
+ !0
+ )}/reset`,
+ {
+ headers: { "Content-Type": "application/json" },
+ method: "POST",
+ body: JSON.stringify(be)
+ }
+ );
+ } catch {
+ console.warn(
+ "The `/reset` endpoint could not be called. Subsequent endpoint results may be unreliable."
+ );
+ }
+ }
+ function me() {
+ for (const ye in J)
+ J[ye].forEach((be) => {
+ Q(ye, be);
+ });
+ }
+ return {
+ on: ne,
+ off: Q,
+ cancel: $,
+ destroy: me
+ };
+ }
+ async function Y(te, _e, de) {
+ var ae;
+ const ie = { "Content-Type": "application/json" };
+ x && (ie.Authorization = `Bearer ${x}`);
+ let Z, ee = b.components.find(
+ (q) => q.id === te
+ );
+ (ae = ee == null ? void 0 : ee.props) != null && ae.root_url ? Z = ee.props.root_url : Z = `${A}//${Nr(
+ y,
+ b.path,
+ !0
+ )}/`;
+ const w = await M(
+ `${Z}component_server/`,
+ {
+ method: "POST",
+ body: JSON.stringify({
+ data: de,
+ component_id: te,
+ fn_name: _e,
+ session_hash: h
+ }),
+ headers: ie
+ }
+ );
+ if (!w.ok)
+ throw new Error(
+ "Could not connect to component server: " + w.statusText
+ );
+ return await w.json();
+ }
+ async function oe(te) {
+ if (B)
+ return B;
+ const _e = { "Content-Type": "application/json" };
+ x && (_e.Authorization = `Bearer ${x}`);
+ let de;
+ if (Tm(te.version || "2.0.0", "3.30") < 0 ? de = await M(
+ "https://gradio-space-api-fetcher-v2.hf.space/api",
+ {
+ method: "POST",
+ body: JSON.stringify({
+ serialize: !1,
+ config: JSON.stringify(te)
+ }),
+ headers: _e
+ }
+ ) : de = await M(`${te.root}/info`, {
+ headers: _e
+ }), !de.ok)
+ throw new Error(Ka);
+ let ae = await de.json();
+ return "api" in ae && (ae = ae.api), ae.named_endpoints["/predict"] && !ae.unnamed_endpoints[0] && (ae.unnamed_endpoints[0] = ae.named_endpoints["/predict"]), nS(ae, te, T);
+ }
+ });
+ }
+ async function D(f, P, c, C) {
+ const x = await Ih(
+ P,
+ void 0,
+ [],
+ !0,
+ c
+ );
+ return Promise.all(
+ x.map(async ({ path: R, blob: g, type: u }) => {
+ if (g) {
+ const E = (await _(f, [g], C)).files[0];
+ return { path: R, file_url: E, type: u, name: g == null ? void 0 : g.name };
+ }
+ return { path: R, type: u };
+ })
+ ).then((R) => (R.forEach(({ path: g, file_url: u, type: E, name: A }) => {
+ if (E === "Gallery")
+ Cm(P, u, g);
+ else if (u) {
+ const y = new ta({ path: u, orig_name: A });
+ Cm(P, y, g);
+ }
+ }), P));
+ }
+}
+const { post_data: jO, upload_files: tS, client: HO, handle_blob: WO } = eS(
+ fetch,
+ (...M) => new WebSocket(...M)
+);
+function ch(M, F, V, _) {
+ return M.map((l, D) => {
+ var f, P, c, C;
+ return ((P = (f = F == null ? void 0 : F.returns) == null ? void 0 : f[D]) == null ? void 0 : P.component) === "File" ? ao(l, V, _) : ((C = (c = F == null ? void 0 : F.returns) == null ? void 0 : c[D]) == null ? void 0 : C.component) === "Gallery" ? l.map((x) => Array.isArray(x) ? [ao(x[0], V, _), x[1]] : [ao(x, V, _), null]) : typeof l == "object" && l.path ? ao(l, V, _) : l;
+ });
+}
+function Am(M, F, V, _) {
+ switch (M.type) {
+ case "string":
+ return "string";
+ case "boolean":
+ return "boolean";
+ case "number":
+ return "number";
+ }
+ if (V === "JSONSerializable" || V === "StringSerializable")
+ return "any";
+ if (V === "ListStringSerializable")
+ return "string[]";
+ if (F === "Image")
+ return _ === "parameter" ? "Blob | File | Buffer" : "string";
+ if (V === "FileSerializable")
+ return (M == null ? void 0 : M.type) === "array" ? _ === "parameter" ? "(Blob | File | Buffer)[]" : "{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}[]" : _ === "parameter" ? "Blob | File | Buffer" : "{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}";
+ if (V === "GallerySerializable")
+ return _ === "parameter" ? "[(Blob | File | Buffer), (string | null)][]" : "[{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}, (string | null))][]";
+}
+function Pm(M, F) {
+ return F === "GallerySerializable" ? "array of [file, label] tuples" : F === "ListStringSerializable" ? "array of strings" : F === "FileSerializable" ? "array of files or single file" : M.description;
+}
+function nS(M, F, V) {
+ const _ = {
+ named_endpoints: {},
+ unnamed_endpoints: {}
+ };
+ for (const l in M) {
+ const D = M[l];
+ for (const f in D) {
+ const P = F.dependencies[f] ? f : V[f.replace("/", "")], c = D[f];
+ _[l][f] = {}, _[l][f].parameters = {}, _[l][f].returns = {}, _[l][f].type = F.dependencies[P].types, _[l][f].parameters = c.parameters.map(
+ ({ label: C, component: x, type: R, serializer: g }) => ({
+ label: C,
+ component: x,
+ type: Am(R, x, g, "parameter"),
+ description: Pm(R, g)
+ })
+ ), _[l][f].returns = c.returns.map(
+ ({ label: C, component: x, type: R, serializer: g }) => ({
+ label: C,
+ component: x,
+ type: Am(R, x, g, "return"),
+ description: Pm(R, g)
+ })
+ );
+ }
+ }
+ return _;
+}
+async function iS(M, F) {
+ try {
+ return (await (await fetch(`https://huggingface.co/api/spaces/${M}/jwt`, {
+ headers: {
+ Authorization: `Bearer ${F}`
+ }
+ })).json()).token || !1;
+ } catch (V) {
+ return console.error(V), !1;
+ }
+}
+function Cm(M, F, V) {
+ for (; V.length > 1; )
+ M = M[V.shift()];
+ M[V.shift()] = F;
+}
+async function Ih(M, F = void 0, V = [], _ = !1, l = void 0) {
+ if (Array.isArray(M)) {
+ let D = [];
+ return await Promise.all(
+ M.map(async (f, P) => {
+ var c;
+ let C = V.slice();
+ C.push(P);
+ const x = await Ih(
+ M[P],
+ _ ? ((c = l == null ? void 0 : l.parameters[P]) == null ? void 0 : c.component) || void 0 : F,
+ C,
+ !1,
+ l
+ );
+ D = D.concat(x);
+ })
+ ), D;
+ } else {
+ if (globalThis.Buffer && M instanceof globalThis.Buffer)
+ return [
+ {
+ path: V,
+ blob: F === "Image" ? !1 : new Zg([M]),
+ type: F
+ }
+ ];
+ if (typeof M == "object") {
+ let D = [];
+ for (let f in M)
+ if (M.hasOwnProperty(f)) {
+ let P = V.slice();
+ P.push(f), D = D.concat(
+ await Ih(
+ M[f],
+ void 0,
+ P,
+ !1,
+ l
+ )
+ );
+ }
+ return D;
+ }
+ }
+ return [];
+}
+function rS(M, F) {
+ var V, _, l, D;
+ return !(((_ = (V = F == null ? void 0 : F.dependencies) == null ? void 0 : V[M]) == null ? void 0 : _.queue) === null ? F.enable_queue : (D = (l = F == null ? void 0 : F.dependencies) == null ? void 0 : l[M]) != null && D.queue) || !1;
+}
+async function xm(M, F, V) {
+ const _ = {};
+ if (V && (_.Authorization = `Bearer ${V}`), typeof window < "u" && window.gradio_config && location.origin !== "http://localhost:9876" && !window.gradio_config.dev_mode) {
+ const l = window.gradio_config.root, D = window.gradio_config;
+ return D.root = Nr(F, D.root, !1), { ...D, path: l };
+ } else if (F) {
+ let l = await M(`${F}/config`, {
+ headers: _
+ });
+ if (l.status === 200) {
+ const D = await l.json();
+ return D.path = D.path ?? "", D.root = F, D;
+ }
+ throw new Error("Could not get config.");
+ }
+ throw new Error("No config or app endpoint found");
+}
+async function Dh(M, F, V) {
+ let _ = F === "subdomain" ? `https://huggingface.co/api/spaces/by-subdomain/${M}` : `https://huggingface.co/api/spaces/${M}`, l, D;
+ try {
+ if (l = await fetch(_), D = l.status, D !== 200)
+ throw new Error();
+ l = await l.json();
+ } catch {
+ V({
+ status: "error",
+ load_status: "error",
+ message: "Could not get space status",
+ detail: "NOT_FOUND"
+ });
+ return;
+ }
+ if (!l || D !== 200)
+ return;
+ const {
+ runtime: { stage: f },
+ id: P
+ } = l;
+ switch (f) {
+ case "STOPPED":
+ case "SLEEPING":
+ V({
+ status: "sleeping",
+ load_status: "pending",
+ message: "Space is asleep. Waking it up...",
+ detail: f
+ }), setTimeout(() => {
+ Dh(M, F, V);
+ }, 1e3);
+ break;
+ case "PAUSED":
+ V({
+ status: "paused",
+ load_status: "error",
+ message: "This space has been paused by the author. If you would like to try this demo, consider duplicating the space.",
+ detail: f,
+ discussions_enabled: await Sm(P)
+ });
+ break;
+ case "RUNNING":
+ case "RUNNING_BUILDING":
+ V({
+ status: "running",
+ load_status: "complete",
+ message: "",
+ detail: f
+ });
+ break;
+ case "BUILDING":
+ V({
+ status: "building",
+ load_status: "pending",
+ message: "Space is building...",
+ detail: f
+ }), setTimeout(() => {
+ Dh(M, F, V);
+ }, 1e3);
+ break;
+ default:
+ V({
+ status: "space_error",
+ load_status: "error",
+ message: "This space is experiencing an issue.",
+ detail: f,
+ discussions_enabled: await Sm(P)
+ });
+ break;
+ }
+}
+function Rm(M, F) {
+ switch (M.msg) {
+ case "send_data":
+ return { type: "data" };
+ case "send_hash":
+ return { type: "hash" };
+ case "queue_full":
+ return {
+ type: "update",
+ status: {
+ queue: !0,
+ message: $T,
+ stage: "error",
+ code: M.code,
+ success: M.success
+ }
+ };
+ case "estimation":
+ return {
+ type: "update",
+ status: {
+ queue: !0,
+ stage: F || "pending",
+ code: M.code,
+ size: M.queue_size,
+ position: M.rank,
+ eta: M.rank_eta,
+ success: M.success
+ }
+ };
+ case "progress":
+ return {
+ type: "update",
+ status: {
+ queue: !0,
+ stage: "pending",
+ code: M.code,
+ progress_data: M.progress_data,
+ success: M.success
+ }
+ };
+ case "log":
+ return { type: "log", data: M };
+ case "process_generating":
+ return {
+ type: "generating",
+ status: {
+ queue: !0,
+ message: M.success ? null : M.output.error,
+ stage: M.success ? "generating" : "error",
+ code: M.code,
+ progress_data: M.progress_data,
+ eta: M.average_duration
+ },
+ data: M.success ? M.output : null
+ };
+ case "process_completed":
+ return "error" in M.output ? {
+ type: "update",
+ status: {
+ queue: !0,
+ message: M.output.error,
+ stage: "error",
+ code: M.code,
+ success: M.success
+ }
+ } : {
+ type: "complete",
+ status: {
+ queue: !0,
+ message: M.success ? void 0 : M.output.error,
+ stage: M.success ? "complete" : "error",
+ code: M.code,
+ progress_data: M.progress_data,
+ eta: M.output.average_duration
+ },
+ data: M.success ? M.output : null
+ };
+ case "process_starts":
+ return {
+ type: "update",
+ status: {
+ queue: !0,
+ stage: "pending",
+ code: M.code,
+ size: M.rank,
+ position: 0,
+ success: M.success
+ }
+ };
+ }
+ return { type: "none", status: { stage: "error", queue: !0 } };
+}
+const {
+ SvelteComponent: oS,
+ assign: aS,
+ create_slot: sS,
+ detach: cS,
+ element: lS,
+ get_all_dirty_from_scope: uS,
+ get_slot_changes: hS,
+ get_spread_update: dS,
+ init: fS,
+ insert: pS,
+ safe_not_equal: _S,
+ set_dynamic_element_data: Om,
+ set_style: si,
+ toggle_class: Mr,
+ transition_in: Jg,
+ transition_out: $g,
+ update_slot_base: mS
+} = window.__gradio__svelte__internal;
+function gS(M) {
+ let F, V, _;
+ const l = (
+ /*#slots*/
+ M[17].default
+ ), D = sS(
+ l,
+ M,
+ /*$$scope*/
+ M[16],
+ null
+ );
+ let f = [
+ { "data-testid": (
+ /*test_id*/
+ M[7]
+ ) },
+ { id: (
+ /*elem_id*/
+ M[2]
+ ) },
+ {
+ class: V = "block " + /*elem_classes*/
+ M[3].join(" ") + " svelte-1t38q2d"
+ }
+ ], P = {};
+ for (let c = 0; c < f.length; c += 1)
+ P = aS(P, f[c]);
+ return {
+ c() {
+ F = lS(
+ /*tag*/
+ M[14]
+ ), D && D.c(), Om(
+ /*tag*/
+ M[14]
+ )(F, P), Mr(
+ F,
+ "hidden",
+ /*visible*/
+ M[10] === !1
+ ), Mr(
+ F,
+ "padded",
+ /*padding*/
+ M[6]
+ ), Mr(
+ F,
+ "border_focus",
+ /*border_mode*/
+ M[5] === "focus"
+ ), Mr(F, "hide-container", !/*explicit_call*/
+ M[8] && !/*container*/
+ M[9]), si(F, "height", typeof /*height*/
+ M[0] == "number" ? (
+ /*height*/
+ M[0] + "px"
+ ) : void 0), si(F, "width", typeof /*width*/
+ M[1] == "number" ? `calc(min(${/*width*/
+ M[1]}px, 100%))` : void 0), si(
+ F,
+ "border-style",
+ /*variant*/
+ M[4]
+ ), si(
+ F,
+ "overflow",
+ /*allow_overflow*/
+ M[11] ? "visible" : "hidden"
+ ), si(
+ F,
+ "flex-grow",
+ /*scale*/
+ M[12]
+ ), si(F, "min-width", `calc(min(${/*min_width*/
+ M[13]}px, 100%))`), si(F, "border-width", "var(--block-border-width)");
+ },
+ m(c, C) {
+ pS(c, F, C), D && D.m(F, null), _ = !0;
+ },
+ p(c, C) {
+ D && D.p && (!_ || C & /*$$scope*/
+ 65536) && mS(
+ D,
+ l,
+ c,
+ /*$$scope*/
+ c[16],
+ _ ? hS(
+ l,
+ /*$$scope*/
+ c[16],
+ C,
+ null
+ ) : uS(
+ /*$$scope*/
+ c[16]
+ ),
+ null
+ ), Om(
+ /*tag*/
+ c[14]
+ )(F, P = dS(f, [
+ (!_ || C & /*test_id*/
+ 128) && { "data-testid": (
+ /*test_id*/
+ c[7]
+ ) },
+ (!_ || C & /*elem_id*/
+ 4) && { id: (
+ /*elem_id*/
+ c[2]
+ ) },
+ (!_ || C & /*elem_classes*/
+ 8 && V !== (V = "block " + /*elem_classes*/
+ c[3].join(" ") + " svelte-1t38q2d")) && { class: V }
+ ])), Mr(
+ F,
+ "hidden",
+ /*visible*/
+ c[10] === !1
+ ), Mr(
+ F,
+ "padded",
+ /*padding*/
+ c[6]
+ ), Mr(
+ F,
+ "border_focus",
+ /*border_mode*/
+ c[5] === "focus"
+ ), Mr(F, "hide-container", !/*explicit_call*/
+ c[8] && !/*container*/
+ c[9]), C & /*height*/
+ 1 && si(F, "height", typeof /*height*/
+ c[0] == "number" ? (
+ /*height*/
+ c[0] + "px"
+ ) : void 0), C & /*width*/
+ 2 && si(F, "width", typeof /*width*/
+ c[1] == "number" ? `calc(min(${/*width*/
+ c[1]}px, 100%))` : void 0), C & /*variant*/
+ 16 && si(
+ F,
+ "border-style",
+ /*variant*/
+ c[4]
+ ), C & /*allow_overflow*/
+ 2048 && si(
+ F,
+ "overflow",
+ /*allow_overflow*/
+ c[11] ? "visible" : "hidden"
+ ), C & /*scale*/
+ 4096 && si(
+ F,
+ "flex-grow",
+ /*scale*/
+ c[12]
+ ), C & /*min_width*/
+ 8192 && si(F, "min-width", `calc(min(${/*min_width*/
+ c[13]}px, 100%))`);
+ },
+ i(c) {
+ _ || (Jg(D, c), _ = !0);
+ },
+ o(c) {
+ $g(D, c), _ = !1;
+ },
+ d(c) {
+ c && cS(F), D && D.d(c);
+ }
+ };
+}
+function vS(M) {
+ let F, V = (
+ /*tag*/
+ M[14] && gS(M)
+ );
+ return {
+ c() {
+ V && V.c();
+ },
+ m(_, l) {
+ V && V.m(_, l), F = !0;
+ },
+ p(_, [l]) {
+ /*tag*/
+ _[14] && V.p(_, l);
+ },
+ i(_) {
+ F || (Jg(V, _), F = !0);
+ },
+ o(_) {
+ $g(V, _), F = !1;
+ },
+ d(_) {
+ V && V.d(_);
+ }
+ };
+}
+function bS(M, F, V) {
+ let { $$slots: _ = {}, $$scope: l } = F, { height: D = void 0 } = F, { width: f = void 0 } = F, { elem_id: P = "" } = F, { elem_classes: c = [] } = F, { variant: C = "solid" } = F, { border_mode: x = "base" } = F, { padding: R = !0 } = F, { type: g = "normal" } = F, { test_id: u = void 0 } = F, { explicit_call: E = !1 } = F, { container: A = !0 } = F, { visible: y = !0 } = F, { allow_overflow: v = !0 } = F, { scale: h = null } = F, { min_width: d = 0 } = F, b = g === "fieldset" ? "fieldset" : "div";
+ return M.$$set = (T) => {
+ "height" in T && V(0, D = T.height), "width" in T && V(1, f = T.width), "elem_id" in T && V(2, P = T.elem_id), "elem_classes" in T && V(3, c = T.elem_classes), "variant" in T && V(4, C = T.variant), "border_mode" in T && V(5, x = T.border_mode), "padding" in T && V(6, R = T.padding), "type" in T && V(15, g = T.type), "test_id" in T && V(7, u = T.test_id), "explicit_call" in T && V(8, E = T.explicit_call), "container" in T && V(9, A = T.container), "visible" in T && V(10, y = T.visible), "allow_overflow" in T && V(11, v = T.allow_overflow), "scale" in T && V(12, h = T.scale), "min_width" in T && V(13, d = T.min_width), "$$scope" in T && V(16, l = T.$$scope);
+ }, [
+ D,
+ f,
+ P,
+ c,
+ C,
+ x,
+ R,
+ u,
+ E,
+ A,
+ y,
+ v,
+ h,
+ d,
+ b,
+ g,
+ l,
+ _
+ ];
+}
+class ev extends oS {
+ constructor(F) {
+ super(), fS(this, F, bS, vS, _S, {
+ height: 0,
+ width: 1,
+ elem_id: 2,
+ elem_classes: 3,
+ variant: 4,
+ border_mode: 5,
+ padding: 6,
+ type: 15,
+ test_id: 7,
+ explicit_call: 8,
+ container: 9,
+ visible: 10,
+ allow_overflow: 11,
+ scale: 12,
+ min_width: 13
+ });
+ }
+}
+const {
+ SvelteComponent: yS,
+ append: lh,
+ attr: Ec,
+ create_component: ES,
+ destroy_component: TS,
+ detach: SS,
+ element: Mm,
+ init: AS,
+ insert: PS,
+ mount_component: CS,
+ safe_not_equal: xS,
+ set_data: RS,
+ space: OS,
+ text: MS,
+ toggle_class: Ir,
+ transition_in: IS,
+ transition_out: DS
+} = window.__gradio__svelte__internal;
+function LS(M) {
+ let F, V, _, l, D, f;
+ return _ = new /*Icon*/
+ M[1]({}), {
+ c() {
+ F = Mm("label"), V = Mm("span"), ES(_.$$.fragment), l = OS(), D = MS(
+ /*label*/
+ M[0]
+ ), Ec(V, "class", "svelte-9gxdi0"), Ec(F, "for", ""), Ec(F, "data-testid", "block-label"), Ec(F, "class", "svelte-9gxdi0"), Ir(F, "hide", !/*show_label*/
+ M[2]), Ir(F, "sr-only", !/*show_label*/
+ M[2]), Ir(
+ F,
+ "float",
+ /*float*/
+ M[4]
+ ), Ir(
+ F,
+ "hide-label",
+ /*disable*/
+ M[3]
+ );
+ },
+ m(P, c) {
+ PS(P, F, c), lh(F, V), CS(_, V, null), lh(F, l), lh(F, D), f = !0;
+ },
+ p(P, [c]) {
+ (!f || c & /*label*/
+ 1) && RS(
+ D,
+ /*label*/
+ P[0]
+ ), (!f || c & /*show_label*/
+ 4) && Ir(F, "hide", !/*show_label*/
+ P[2]), (!f || c & /*show_label*/
+ 4) && Ir(F, "sr-only", !/*show_label*/
+ P[2]), (!f || c & /*float*/
+ 16) && Ir(
+ F,
+ "float",
+ /*float*/
+ P[4]
+ ), (!f || c & /*disable*/
+ 8) && Ir(
+ F,
+ "hide-label",
+ /*disable*/
+ P[3]
+ );
+ },
+ i(P) {
+ f || (IS(_.$$.fragment, P), f = !0);
+ },
+ o(P) {
+ DS(_.$$.fragment, P), f = !1;
+ },
+ d(P) {
+ P && SS(F), TS(_);
+ }
+ };
+}
+function wS(M, F, V) {
+ let { label: _ = null } = F, { Icon: l } = F, { show_label: D = !0 } = F, { disable: f = !1 } = F, { float: P = !0 } = F;
+ return M.$$set = (c) => {
+ "label" in c && V(0, _ = c.label), "Icon" in c && V(1, l = c.Icon), "show_label" in c && V(2, D = c.show_label), "disable" in c && V(3, f = c.disable), "float" in c && V(4, P = c.float);
+ }, [_, l, D, f, P];
+}
+class $h extends yS {
+ constructor(F) {
+ super(), AS(this, F, wS, LS, xS, {
+ label: 0,
+ Icon: 1,
+ show_label: 2,
+ disable: 3,
+ float: 4
+ });
+ }
+}
+const {
+ SvelteComponent: NS,
+ append: Lh,
+ attr: ro,
+ bubble: FS,
+ create_component: BS,
+ destroy_component: US,
+ detach: tv,
+ element: wh,
+ init: VS,
+ insert: nv,
+ listen: kS,
+ mount_component: GS,
+ safe_not_equal: zS,
+ set_data: jS,
+ space: HS,
+ text: WS,
+ toggle_class: Dr,
+ transition_in: XS,
+ transition_out: YS
+} = window.__gradio__svelte__internal;
+function Im(M) {
+ let F, V;
+ return {
+ c() {
+ F = wh("span"), V = WS(
+ /*label*/
+ M[1]
+ ), ro(F, "class", "svelte-xtz2g8");
+ },
+ m(_, l) {
+ nv(_, F, l), Lh(F, V);
+ },
+ p(_, l) {
+ l & /*label*/
+ 2 && jS(
+ V,
+ /*label*/
+ _[1]
+ );
+ },
+ d(_) {
+ _ && tv(F);
+ }
+ };
+}
+function KS(M) {
+ let F, V, _, l, D, f, P, c = (
+ /*show_label*/
+ M[2] && Im(M)
+ );
+ return l = new /*Icon*/
+ M[0]({}), {
+ c() {
+ F = wh("button"), c && c.c(), V = HS(), _ = wh("div"), BS(l.$$.fragment), ro(_, "class", "svelte-xtz2g8"), Dr(
+ _,
+ "small",
+ /*size*/
+ M[4] === "small"
+ ), Dr(
+ _,
+ "large",
+ /*size*/
+ M[4] === "large"
+ ), ro(
+ F,
+ "aria-label",
+ /*label*/
+ M[1]
+ ), ro(
+ F,
+ "title",
+ /*label*/
+ M[1]
+ ), ro(F, "class", "svelte-xtz2g8"), Dr(
+ F,
+ "pending",
+ /*pending*/
+ M[3]
+ ), Dr(
+ F,
+ "padded",
+ /*padded*/
+ M[5]
+ );
+ },
+ m(C, x) {
+ nv(C, F, x), c && c.m(F, null), Lh(F, V), Lh(F, _), GS(l, _, null), D = !0, f || (P = kS(
+ F,
+ "click",
+ /*click_handler*/
+ M[6]
+ ), f = !0);
+ },
+ p(C, [x]) {
+ /*show_label*/
+ C[2] ? c ? c.p(C, x) : (c = Im(C), c.c(), c.m(F, V)) : c && (c.d(1), c = null), (!D || x & /*size*/
+ 16) && Dr(
+ _,
+ "small",
+ /*size*/
+ C[4] === "small"
+ ), (!D || x & /*size*/
+ 16) && Dr(
+ _,
+ "large",
+ /*size*/
+ C[4] === "large"
+ ), (!D || x & /*label*/
+ 2) && ro(
+ F,
+ "aria-label",
+ /*label*/
+ C[1]
+ ), (!D || x & /*label*/
+ 2) && ro(
+ F,
+ "title",
+ /*label*/
+ C[1]
+ ), (!D || x & /*pending*/
+ 8) && Dr(
+ F,
+ "pending",
+ /*pending*/
+ C[3]
+ ), (!D || x & /*padded*/
+ 32) && Dr(
+ F,
+ "padded",
+ /*padded*/
+ C[5]
+ );
+ },
+ i(C) {
+ D || (XS(l.$$.fragment, C), D = !0);
+ },
+ o(C) {
+ YS(l.$$.fragment, C), D = !1;
+ },
+ d(C) {
+ C && tv(F), c && c.d(), US(l), f = !1, P();
+ }
+ };
+}
+function QS(M, F, V) {
+ let { Icon: _ } = F, { label: l = "" } = F, { show_label: D = !1 } = F, { pending: f = !1 } = F, { size: P = "small" } = F, { padded: c = !0 } = F;
+ function C(x) {
+ FS.call(this, M, x);
+ }
+ return M.$$set = (x) => {
+ "Icon" in x && V(0, _ = x.Icon), "label" in x && V(1, l = x.label), "show_label" in x && V(2, D = x.show_label), "pending" in x && V(3, f = x.pending), "size" in x && V(4, P = x.size), "padded" in x && V(5, c = x.padded);
+ }, [_, l, D, f, P, c, C];
+}
+class so extends NS {
+ constructor(F) {
+ super(), VS(this, F, QS, KS, zS, {
+ Icon: 0,
+ label: 1,
+ show_label: 2,
+ pending: 3,
+ size: 4,
+ padded: 5
+ });
+ }
+}
+const {
+ SvelteComponent: qS,
+ append: ZS,
+ attr: uh,
+ binding_callbacks: JS,
+ create_slot: $S,
+ detach: eA,
+ element: Dm,
+ get_all_dirty_from_scope: tA,
+ get_slot_changes: nA,
+ init: iA,
+ insert: rA,
+ safe_not_equal: oA,
+ toggle_class: Lr,
+ transition_in: aA,
+ transition_out: sA,
+ update_slot_base: cA
+} = window.__gradio__svelte__internal;
+function lA(M) {
+ let F, V, _;
+ const l = (
+ /*#slots*/
+ M[5].default
+ ), D = $S(
+ l,
+ M,
+ /*$$scope*/
+ M[4],
+ null
+ );
+ return {
+ c() {
+ F = Dm("div"), V = Dm("div"), D && D.c(), uh(V, "class", "icon svelte-3w3rth"), uh(F, "class", "empty svelte-3w3rth"), uh(F, "aria-label", "Empty value"), Lr(
+ F,
+ "small",
+ /*size*/
+ M[0] === "small"
+ ), Lr(
+ F,
+ "large",
+ /*size*/
+ M[0] === "large"
+ ), Lr(
+ F,
+ "unpadded_box",
+ /*unpadded_box*/
+ M[1]
+ ), Lr(
+ F,
+ "small_parent",
+ /*parent_height*/
+ M[3]
+ );
+ },
+ m(f, P) {
+ rA(f, F, P), ZS(F, V), D && D.m(V, null), M[6](F), _ = !0;
+ },
+ p(f, [P]) {
+ D && D.p && (!_ || P & /*$$scope*/
+ 16) && cA(
+ D,
+ l,
+ f,
+ /*$$scope*/
+ f[4],
+ _ ? nA(
+ l,
+ /*$$scope*/
+ f[4],
+ P,
+ null
+ ) : tA(
+ /*$$scope*/
+ f[4]
+ ),
+ null
+ ), (!_ || P & /*size*/
+ 1) && Lr(
+ F,
+ "small",
+ /*size*/
+ f[0] === "small"
+ ), (!_ || P & /*size*/
+ 1) && Lr(
+ F,
+ "large",
+ /*size*/
+ f[0] === "large"
+ ), (!_ || P & /*unpadded_box*/
+ 2) && Lr(
+ F,
+ "unpadded_box",
+ /*unpadded_box*/
+ f[1]
+ ), (!_ || P & /*parent_height*/
+ 8) && Lr(
+ F,
+ "small_parent",
+ /*parent_height*/
+ f[3]
+ );
+ },
+ i(f) {
+ _ || (aA(D, f), _ = !0);
+ },
+ o(f) {
+ sA(D, f), _ = !1;
+ },
+ d(f) {
+ f && eA(F), D && D.d(f), M[6](null);
+ }
+ };
+}
+function uA(M) {
+ let F, V = M[0], _ = 1;
+ for (; _ < M.length; ) {
+ const l = M[_], D = M[_ + 1];
+ if (_ += 2, (l === "optionalAccess" || l === "optionalCall") && V == null)
+ return;
+ l === "access" || l === "optionalAccess" ? (F = V, V = D(V)) : (l === "call" || l === "optionalCall") && (V = D((...f) => V.call(F, ...f)), F = void 0);
+ }
+ return V;
+}
+function hA(M, F, V) {
+ let _, { $$slots: l = {}, $$scope: D } = F, { size: f = "small" } = F, { unpadded_box: P = !1 } = F, c;
+ function C(R) {
+ if (!R)
+ return !1;
+ const { height: g } = R.getBoundingClientRect(), { height: u } = uA([
+ R,
+ "access",
+ (E) => E.parentElement,
+ "optionalAccess",
+ (E) => E.getBoundingClientRect,
+ "call",
+ (E) => E()
+ ]) || { height: g };
+ return g > u + 2;
+ }
+ function x(R) {
+ JS[R ? "unshift" : "push"](() => {
+ c = R, V(2, c);
+ });
+ }
+ return M.$$set = (R) => {
+ "size" in R && V(0, f = R.size), "unpadded_box" in R && V(1, P = R.unpadded_box), "$$scope" in R && V(4, D = R.$$scope);
+ }, M.$$.update = () => {
+ M.$$.dirty & /*el*/
+ 4 && V(3, _ = C(c));
+ }, [f, P, c, _, D, l, x];
+}
+class dA extends qS {
+ constructor(F) {
+ super(), iA(this, F, hA, lA, oA, { size: 0, unpadded_box: 1 });
+ }
+}
+const {
+ SvelteComponent: fA,
+ append: hh,
+ attr: Di,
+ detach: pA,
+ init: _A,
+ insert: mA,
+ noop: dh,
+ safe_not_equal: gA,
+ set_style: Hi,
+ svg_element: Tc
+} = window.__gradio__svelte__internal;
+function vA(M) {
+ let F, V, _, l;
+ return {
+ c() {
+ F = Tc("svg"), V = Tc("g"), _ = Tc("path"), l = Tc("path"), Di(_, "d", "M18,6L6.087,17.913"), Hi(_, "fill", "none"), Hi(_, "fill-rule", "nonzero"), Hi(_, "stroke-width", "2px"), Di(V, "transform", "matrix(1.14096,-0.140958,-0.140958,1.14096,-0.0559523,0.0559523)"), Di(l, "d", "M4.364,4.364L19.636,19.636"), Hi(l, "fill", "none"), Hi(l, "fill-rule", "nonzero"), Hi(l, "stroke-width", "2px"), Di(F, "width", "100%"), Di(F, "height", "100%"), Di(F, "viewBox", "0 0 24 24"), Di(F, "version", "1.1"), Di(F, "xmlns", "http://www.w3.org/2000/svg"), Di(F, "xmlns:xlink", "http://www.w3.org/1999/xlink"), Di(F, "xml:space", "preserve"), Di(F, "stroke", "currentColor"), Hi(F, "fill-rule", "evenodd"), Hi(F, "clip-rule", "evenodd"), Hi(F, "stroke-linecap", "round"), Hi(F, "stroke-linejoin", "round");
+ },
+ m(D, f) {
+ mA(D, F, f), hh(F, V), hh(V, _), hh(F, l);
+ },
+ p: dh,
+ i: dh,
+ o: dh,
+ d(D) {
+ D && pA(F);
+ }
+ };
+}
+class bA extends fA {
+ constructor(F) {
+ super(), _A(this, F, null, vA, gA, {});
+ }
+}
+const {
+ SvelteComponent: yA,
+ append: EA,
+ attr: Zo,
+ detach: TA,
+ init: SA,
+ insert: AA,
+ noop: fh,
+ safe_not_equal: PA,
+ svg_element: Lm
+} = window.__gradio__svelte__internal;
+function CA(M) {
+ let F, V;
+ return {
+ c() {
+ F = Lm("svg"), V = Lm("path"), Zo(V, "fill", "currentColor"), Zo(V, "d", "M26 24v4H6v-4H4v4a2 2 0 0 0 2 2h20a2 2 0 0 0 2-2v-4zm0-10l-1.41-1.41L17 20.17V2h-2v18.17l-7.59-7.58L6 14l10 10l10-10z"), Zo(F, "xmlns", "http://www.w3.org/2000/svg"), Zo(F, "width", "100%"), Zo(F, "height", "100%"), Zo(F, "viewBox", "0 0 32 32");
+ },
+ m(_, l) {
+ AA(_, F, l), EA(F, V);
+ },
+ p: fh,
+ i: fh,
+ o: fh,
+ d(_) {
+ _ && TA(F);
+ }
+ };
+}
+class xA extends yA {
+ constructor(F) {
+ super(), SA(this, F, null, CA, PA, {});
+ }
+}
+const {
+ SvelteComponent: RA,
+ append: OA,
+ attr: Li,
+ detach: MA,
+ init: IA,
+ insert: DA,
+ noop: ph,
+ safe_not_equal: LA,
+ svg_element: wm
+} = window.__gradio__svelte__internal;
+function wA(M) {
+ let F, V;
+ return {
+ c() {
+ F = wm("svg"), V = wm("path"), Li(V, "d", "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"), Li(F, "xmlns", "http://www.w3.org/2000/svg"), Li(F, "width", "100%"), Li(F, "height", "100%"), Li(F, "viewBox", "0 0 24 24"), Li(F, "fill", "none"), Li(F, "stroke", "currentColor"), Li(F, "stroke-width", "1.5"), Li(F, "stroke-linecap", "round"), Li(F, "stroke-linejoin", "round"), Li(F, "class", "feather feather-edit-2");
+ },
+ m(_, l) {
+ DA(_, F, l), OA(F, V);
+ },
+ p: ph,
+ i: ph,
+ o: ph,
+ d(_) {
+ _ && MA(F);
+ }
+ };
+}
+class NA extends RA {
+ constructor(F) {
+ super(), IA(this, F, null, wA, LA, {});
+ }
+}
+const {
+ SvelteComponent: FA,
+ append: Nm,
+ attr: _i,
+ detach: BA,
+ init: UA,
+ insert: VA,
+ noop: _h,
+ safe_not_equal: kA,
+ svg_element: mh
+} = window.__gradio__svelte__internal;
+function GA(M) {
+ let F, V, _;
+ return {
+ c() {
+ F = mh("svg"), V = mh("path"), _ = mh("polyline"), _i(V, "d", "M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"), _i(_, "points", "13 2 13 9 20 9"), _i(F, "xmlns", "http://www.w3.org/2000/svg"), _i(F, "width", "100%"), _i(F, "height", "100%"), _i(F, "viewBox", "0 0 24 24"), _i(F, "fill", "none"), _i(F, "stroke", "currentColor"), _i(F, "stroke-width", "1.5"), _i(F, "stroke-linecap", "round"), _i(F, "stroke-linejoin", "round"), _i(F, "class", "feather feather-file");
+ },
+ m(l, D) {
+ VA(l, F, D), Nm(F, V), Nm(F, _);
+ },
+ p: _h,
+ i: _h,
+ o: _h,
+ d(l) {
+ l && BA(F);
+ }
+ };
+}
+let Vc = class extends FA {
+ constructor(F) {
+ super(), UA(this, F, null, GA, kA, {});
+ }
+};
+const {
+ SvelteComponent: zA,
+ append: Fm,
+ attr: mi,
+ detach: jA,
+ init: HA,
+ insert: WA,
+ noop: gh,
+ safe_not_equal: XA,
+ svg_element: vh
+} = window.__gradio__svelte__internal;
+function YA(M) {
+ let F, V, _;
+ return {
+ c() {
+ F = vh("svg"), V = vh("polyline"), _ = vh("path"), mi(V, "points", "1 4 1 10 7 10"), mi(_, "d", "M3.51 15a9 9 0 1 0 2.13-9.36L1 10"), mi(F, "xmlns", "http://www.w3.org/2000/svg"), mi(F, "width", "100%"), mi(F, "height", "100%"), mi(F, "viewBox", "0 0 24 24"), mi(F, "fill", "none"), mi(F, "stroke", "currentColor"), mi(F, "stroke-width", "2"), mi(F, "stroke-linecap", "round"), mi(F, "stroke-linejoin", "round"), mi(F, "class", "feather feather-rotate-ccw");
+ },
+ m(l, D) {
+ WA(l, F, D), Fm(F, V), Fm(F, _);
+ },
+ p: gh,
+ i: gh,
+ o: gh,
+ d(l) {
+ l && jA(F);
+ }
+ };
+}
+class iv extends zA {
+ constructor(F) {
+ super(), HA(this, F, null, YA, XA, {});
+ }
+}
+const {
+ SvelteComponent: KA,
+ append: bh,
+ attr: Fn,
+ detach: QA,
+ init: qA,
+ insert: ZA,
+ noop: yh,
+ safe_not_equal: JA,
+ svg_element: Sc
+} = window.__gradio__svelte__internal;
+function $A(M) {
+ let F, V, _, l;
+ return {
+ c() {
+ F = Sc("svg"), V = Sc("path"), _ = Sc("polyline"), l = Sc("line"), Fn(V, "d", "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"), Fn(_, "points", "17 8 12 3 7 8"), Fn(l, "x1", "12"), Fn(l, "y1", "3"), Fn(l, "x2", "12"), Fn(l, "y2", "15"), Fn(F, "xmlns", "http://www.w3.org/2000/svg"), Fn(F, "width", "90%"), Fn(F, "height", "90%"), Fn(F, "viewBox", "0 0 24 24"), Fn(F, "fill", "none"), Fn(F, "stroke", "currentColor"), Fn(F, "stroke-width", "2"), Fn(F, "stroke-linecap", "round"), Fn(F, "stroke-linejoin", "round"), Fn(F, "class", "feather feather-upload");
+ },
+ m(D, f) {
+ ZA(D, F, f), bh(F, V), bh(F, _), bh(F, l);
+ },
+ p: yh,
+ i: yh,
+ o: yh,
+ d(D) {
+ D && QA(F);
+ }
+ };
+}
+let eP = class extends KA {
+ constructor(F) {
+ super(), qA(this, F, null, $A, JA, {});
+ }
+};
+const tP = [
+ { color: "red", primary: 600, secondary: 100 },
+ { color: "green", primary: 600, secondary: 100 },
+ { color: "blue", primary: 600, secondary: 100 },
+ { color: "yellow", primary: 500, secondary: 100 },
+ { color: "purple", primary: 600, secondary: 100 },
+ { color: "teal", primary: 600, secondary: 100 },
+ { color: "orange", primary: 600, secondary: 100 },
+ { color: "cyan", primary: 600, secondary: 100 },
+ { color: "lime", primary: 500, secondary: 100 },
+ { color: "pink", primary: 600, secondary: 100 }
+], Bm = {
+ inherit: "inherit",
+ current: "currentColor",
+ transparent: "transparent",
+ black: "#000",
+ white: "#fff",
+ slate: {
+ 50: "#f8fafc",
+ 100: "#f1f5f9",
+ 200: "#e2e8f0",
+ 300: "#cbd5e1",
+ 400: "#94a3b8",
+ 500: "#64748b",
+ 600: "#475569",
+ 700: "#334155",
+ 800: "#1e293b",
+ 900: "#0f172a",
+ 950: "#020617"
+ },
+ gray: {
+ 50: "#f9fafb",
+ 100: "#f3f4f6",
+ 200: "#e5e7eb",
+ 300: "#d1d5db",
+ 400: "#9ca3af",
+ 500: "#6b7280",
+ 600: "#4b5563",
+ 700: "#374151",
+ 800: "#1f2937",
+ 900: "#111827",
+ 950: "#030712"
+ },
+ zinc: {
+ 50: "#fafafa",
+ 100: "#f4f4f5",
+ 200: "#e4e4e7",
+ 300: "#d4d4d8",
+ 400: "#a1a1aa",
+ 500: "#71717a",
+ 600: "#52525b",
+ 700: "#3f3f46",
+ 800: "#27272a",
+ 900: "#18181b",
+ 950: "#09090b"
+ },
+ neutral: {
+ 50: "#fafafa",
+ 100: "#f5f5f5",
+ 200: "#e5e5e5",
+ 300: "#d4d4d4",
+ 400: "#a3a3a3",
+ 500: "#737373",
+ 600: "#525252",
+ 700: "#404040",
+ 800: "#262626",
+ 900: "#171717",
+ 950: "#0a0a0a"
+ },
+ stone: {
+ 50: "#fafaf9",
+ 100: "#f5f5f4",
+ 200: "#e7e5e4",
+ 300: "#d6d3d1",
+ 400: "#a8a29e",
+ 500: "#78716c",
+ 600: "#57534e",
+ 700: "#44403c",
+ 800: "#292524",
+ 900: "#1c1917",
+ 950: "#0c0a09"
+ },
+ red: {
+ 50: "#fef2f2",
+ 100: "#fee2e2",
+ 200: "#fecaca",
+ 300: "#fca5a5",
+ 400: "#f87171",
+ 500: "#ef4444",
+ 600: "#dc2626",
+ 700: "#b91c1c",
+ 800: "#991b1b",
+ 900: "#7f1d1d",
+ 950: "#450a0a"
+ },
+ orange: {
+ 50: "#fff7ed",
+ 100: "#ffedd5",
+ 200: "#fed7aa",
+ 300: "#fdba74",
+ 400: "#fb923c",
+ 500: "#f97316",
+ 600: "#ea580c",
+ 700: "#c2410c",
+ 800: "#9a3412",
+ 900: "#7c2d12",
+ 950: "#431407"
+ },
+ amber: {
+ 50: "#fffbeb",
+ 100: "#fef3c7",
+ 200: "#fde68a",
+ 300: "#fcd34d",
+ 400: "#fbbf24",
+ 500: "#f59e0b",
+ 600: "#d97706",
+ 700: "#b45309",
+ 800: "#92400e",
+ 900: "#78350f",
+ 950: "#451a03"
+ },
+ yellow: {
+ 50: "#fefce8",
+ 100: "#fef9c3",
+ 200: "#fef08a",
+ 300: "#fde047",
+ 400: "#facc15",
+ 500: "#eab308",
+ 600: "#ca8a04",
+ 700: "#a16207",
+ 800: "#854d0e",
+ 900: "#713f12",
+ 950: "#422006"
+ },
+ lime: {
+ 50: "#f7fee7",
+ 100: "#ecfccb",
+ 200: "#d9f99d",
+ 300: "#bef264",
+ 400: "#a3e635",
+ 500: "#84cc16",
+ 600: "#65a30d",
+ 700: "#4d7c0f",
+ 800: "#3f6212",
+ 900: "#365314",
+ 950: "#1a2e05"
+ },
+ green: {
+ 50: "#f0fdf4",
+ 100: "#dcfce7",
+ 200: "#bbf7d0",
+ 300: "#86efac",
+ 400: "#4ade80",
+ 500: "#22c55e",
+ 600: "#16a34a",
+ 700: "#15803d",
+ 800: "#166534",
+ 900: "#14532d",
+ 950: "#052e16"
+ },
+ emerald: {
+ 50: "#ecfdf5",
+ 100: "#d1fae5",
+ 200: "#a7f3d0",
+ 300: "#6ee7b7",
+ 400: "#34d399",
+ 500: "#10b981",
+ 600: "#059669",
+ 700: "#047857",
+ 800: "#065f46",
+ 900: "#064e3b",
+ 950: "#022c22"
+ },
+ teal: {
+ 50: "#f0fdfa",
+ 100: "#ccfbf1",
+ 200: "#99f6e4",
+ 300: "#5eead4",
+ 400: "#2dd4bf",
+ 500: "#14b8a6",
+ 600: "#0d9488",
+ 700: "#0f766e",
+ 800: "#115e59",
+ 900: "#134e4a",
+ 950: "#042f2e"
+ },
+ cyan: {
+ 50: "#ecfeff",
+ 100: "#cffafe",
+ 200: "#a5f3fc",
+ 300: "#67e8f9",
+ 400: "#22d3ee",
+ 500: "#06b6d4",
+ 600: "#0891b2",
+ 700: "#0e7490",
+ 800: "#155e75",
+ 900: "#164e63",
+ 950: "#083344"
+ },
+ sky: {
+ 50: "#f0f9ff",
+ 100: "#e0f2fe",
+ 200: "#bae6fd",
+ 300: "#7dd3fc",
+ 400: "#38bdf8",
+ 500: "#0ea5e9",
+ 600: "#0284c7",
+ 700: "#0369a1",
+ 800: "#075985",
+ 900: "#0c4a6e",
+ 950: "#082f49"
+ },
+ blue: {
+ 50: "#eff6ff",
+ 100: "#dbeafe",
+ 200: "#bfdbfe",
+ 300: "#93c5fd",
+ 400: "#60a5fa",
+ 500: "#3b82f6",
+ 600: "#2563eb",
+ 700: "#1d4ed8",
+ 800: "#1e40af",
+ 900: "#1e3a8a",
+ 950: "#172554"
+ },
+ indigo: {
+ 50: "#eef2ff",
+ 100: "#e0e7ff",
+ 200: "#c7d2fe",
+ 300: "#a5b4fc",
+ 400: "#818cf8",
+ 500: "#6366f1",
+ 600: "#4f46e5",
+ 700: "#4338ca",
+ 800: "#3730a3",
+ 900: "#312e81",
+ 950: "#1e1b4b"
+ },
+ violet: {
+ 50: "#f5f3ff",
+ 100: "#ede9fe",
+ 200: "#ddd6fe",
+ 300: "#c4b5fd",
+ 400: "#a78bfa",
+ 500: "#8b5cf6",
+ 600: "#7c3aed",
+ 700: "#6d28d9",
+ 800: "#5b21b6",
+ 900: "#4c1d95",
+ 950: "#2e1065"
+ },
+ purple: {
+ 50: "#faf5ff",
+ 100: "#f3e8ff",
+ 200: "#e9d5ff",
+ 300: "#d8b4fe",
+ 400: "#c084fc",
+ 500: "#a855f7",
+ 600: "#9333ea",
+ 700: "#7e22ce",
+ 800: "#6b21a8",
+ 900: "#581c87",
+ 950: "#3b0764"
+ },
+ fuchsia: {
+ 50: "#fdf4ff",
+ 100: "#fae8ff",
+ 200: "#f5d0fe",
+ 300: "#f0abfc",
+ 400: "#e879f9",
+ 500: "#d946ef",
+ 600: "#c026d3",
+ 700: "#a21caf",
+ 800: "#86198f",
+ 900: "#701a75",
+ 950: "#4a044e"
+ },
+ pink: {
+ 50: "#fdf2f8",
+ 100: "#fce7f3",
+ 200: "#fbcfe8",
+ 300: "#f9a8d4",
+ 400: "#f472b6",
+ 500: "#ec4899",
+ 600: "#db2777",
+ 700: "#be185d",
+ 800: "#9d174d",
+ 900: "#831843",
+ 950: "#500724"
+ },
+ rose: {
+ 50: "#fff1f2",
+ 100: "#ffe4e6",
+ 200: "#fecdd3",
+ 300: "#fda4af",
+ 400: "#fb7185",
+ 500: "#f43f5e",
+ 600: "#e11d48",
+ 700: "#be123c",
+ 800: "#9f1239",
+ 900: "#881337",
+ 950: "#4c0519"
+ }
+};
+tP.reduce(
+ (M, { color: F, primary: V, secondary: _ }) => ({
+ ...M,
+ [F]: {
+ primary: Bm[F][V],
+ secondary: Bm[F][_]
+ }
+ }),
+ {}
+);
+const {
+ SvelteComponent: nP,
+ append: co,
+ attr: Nh,
+ create_component: iP,
+ destroy_component: rP,
+ detach: Oc,
+ element: Fh,
+ init: oP,
+ insert: Mc,
+ mount_component: aP,
+ safe_not_equal: sP,
+ set_data: Bh,
+ space: Uh,
+ text: es,
+ toggle_class: Um,
+ transition_in: cP,
+ transition_out: lP
+} = window.__gradio__svelte__internal;
+function Vm(M) {
+ let F, V, _ = (
+ /*i18n*/
+ M[1]("common.or") + ""
+ ), l, D, f, P = (
+ /*message*/
+ (M[2] || /*i18n*/
+ M[1]("upload_text.click_to_upload")) + ""
+ ), c;
+ return {
+ c() {
+ F = Fh("span"), V = es("- "), l = es(_), D = es(" -"), f = Uh(), c = es(P), Nh(F, "class", "or svelte-kzcjhc");
+ },
+ m(C, x) {
+ Mc(C, F, x), co(F, V), co(F, l), co(F, D), Mc(C, f, x), Mc(C, c, x);
+ },
+ p(C, x) {
+ x & /*i18n*/
+ 2 && _ !== (_ = /*i18n*/
+ C[1]("common.or") + "") && Bh(l, _), x & /*message, i18n*/
+ 6 && P !== (P = /*message*/
+ (C[2] || /*i18n*/
+ C[1]("upload_text.click_to_upload")) + "") && Bh(c, P);
+ },
+ d(C) {
+ C && (Oc(F), Oc(f), Oc(c));
+ }
+ };
+}
+function uP(M) {
+ let F, V, _, l, D = (
+ /*i18n*/
+ M[1](
+ /*defs*/
+ M[5][
+ /*type*/
+ M[0]
+ ] || /*defs*/
+ M[5].file
+ ) + ""
+ ), f, P, c;
+ _ = new eP({});
+ let C = (
+ /*mode*/
+ M[3] !== "short" && Vm(M)
+ );
+ return {
+ c() {
+ F = Fh("div"), V = Fh("span"), iP(_.$$.fragment), l = Uh(), f = es(D), P = Uh(), C && C.c(), Nh(V, "class", "icon-wrap svelte-kzcjhc"), Um(
+ V,
+ "hovered",
+ /*hovered*/
+ M[4]
+ ), Nh(F, "class", "wrap svelte-kzcjhc");
+ },
+ m(x, R) {
+ Mc(x, F, R), co(F, V), aP(_, V, null), co(F, l), co(F, f), co(F, P), C && C.m(F, null), c = !0;
+ },
+ p(x, [R]) {
+ (!c || R & /*hovered*/
+ 16) && Um(
+ V,
+ "hovered",
+ /*hovered*/
+ x[4]
+ ), (!c || R & /*i18n, type*/
+ 3) && D !== (D = /*i18n*/
+ x[1](
+ /*defs*/
+ x[5][
+ /*type*/
+ x[0]
+ ] || /*defs*/
+ x[5].file
+ ) + "") && Bh(f, D), /*mode*/
+ x[3] !== "short" ? C ? C.p(x, R) : (C = Vm(x), C.c(), C.m(F, null)) : C && (C.d(1), C = null);
+ },
+ i(x) {
+ c || (cP(_.$$.fragment, x), c = !0);
+ },
+ o(x) {
+ lP(_.$$.fragment, x), c = !1;
+ },
+ d(x) {
+ x && Oc(F), rP(_), C && C.d();
+ }
+ };
+}
+function hP(M, F, V) {
+ let { type: _ = "file" } = F, { i18n: l } = F, { message: D = void 0 } = F, { mode: f = "full" } = F, { hovered: P = !1 } = F;
+ const c = {
+ image: "upload_text.drop_image",
+ video: "upload_text.drop_video",
+ audio: "upload_text.drop_audio",
+ file: "upload_text.drop_file",
+ csv: "upload_text.drop_csv"
+ };
+ return M.$$set = (C) => {
+ "type" in C && V(0, _ = C.type), "i18n" in C && V(1, l = C.i18n), "message" in C && V(2, D = C.message), "mode" in C && V(3, f = C.mode), "hovered" in C && V(4, P = C.hovered);
+ }, [_, l, D, f, P, c];
+}
+class dP extends nP {
+ constructor(F) {
+ super(), oP(this, F, hP, uP, sP, {
+ type: 0,
+ i18n: 1,
+ message: 2,
+ mode: 3,
+ hovered: 4
+ });
+ }
+}
+var na = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
+function ed(M) {
+ return M && M.__esModule && Object.prototype.hasOwnProperty.call(M, "default") ? M.default : M;
+}
+var rv = { exports: {} };
+(function(M, F) {
+ (function(V, _) {
+ M.exports = _();
+ })(typeof self < "u" ? self : na, function() {
+ return function(V) {
+ var _ = {};
+ function l(D) {
+ if (_[D])
+ return _[D].exports;
+ var f = _[D] = { i: D, l: !1, exports: {} };
+ return V[D].call(f.exports, f, f.exports, l), f.l = !0, f.exports;
+ }
+ return l.m = V, l.c = _, l.d = function(D, f, P) {
+ l.o(D, f) || Object.defineProperty(D, f, { enumerable: !0, get: P });
+ }, l.r = function(D) {
+ typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(D, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(D, "__esModule", { value: !0 });
+ }, l.t = function(D, f) {
+ if (1 & f && (D = l(D)), 8 & f || 4 & f && typeof D == "object" && D && D.__esModule)
+ return D;
+ var P = /* @__PURE__ */ Object.create(null);
+ if (l.r(P), Object.defineProperty(P, "default", { enumerable: !0, value: D }), 2 & f && typeof D != "string")
+ for (var c in D)
+ l.d(P, c, (function(C) {
+ return D[C];
+ }).bind(null, c));
+ return P;
+ }, l.n = function(D) {
+ var f = D && D.__esModule ? function() {
+ return D.default;
+ } : function() {
+ return D;
+ };
+ return l.d(f, "a", f), f;
+ }, l.o = function(D, f) {
+ return Object.prototype.hasOwnProperty.call(D, f);
+ }, l.p = "", l(l.s = 169);
+ }([function(V, _, l) {
+ l.d(_, "d", function() {
+ return x;
+ }), l.d(_, "e", function() {
+ return R;
+ }), l.d(_, "f", function() {
+ return g;
+ }), l.d(_, "b", function() {
+ return u;
+ }), l.d(_, "a", function() {
+ return E;
+ }), l.d(_, "c", function() {
+ return y;
+ });
+ var D = l(14), f = l(28), P = l(44), c = l(11), C = l(74), x = function() {
+ function v(h, d) {
+ h === void 0 && (h = 0), d === void 0 && (d = 0), this.x = h, this.y = d;
+ }
+ return v.prototype.toString = function() {
+ return "{X: " + this.x + " Y: " + this.y + "}";
+ }, v.prototype.getClassName = function() {
+ return "Vector2";
+ }, v.prototype.getHashCode = function() {
+ var h = 0 | this.x;
+ return h = 397 * h ^ (0 | this.y);
+ }, v.prototype.toArray = function(h, d) {
+ return d === void 0 && (d = 0), h[d] = this.x, h[d + 1] = this.y, this;
+ }, v.prototype.fromArray = function(h, d) {
+ return d === void 0 && (d = 0), v.FromArrayToRef(h, d, this), this;
+ }, v.prototype.asArray = function() {
+ var h = new Array();
+ return this.toArray(h, 0), h;
+ }, v.prototype.copyFrom = function(h) {
+ return this.x = h.x, this.y = h.y, this;
+ }, v.prototype.copyFromFloats = function(h, d) {
+ return this.x = h, this.y = d, this;
+ }, v.prototype.set = function(h, d) {
+ return this.copyFromFloats(h, d);
+ }, v.prototype.add = function(h) {
+ return new v(this.x + h.x, this.y + h.y);
+ }, v.prototype.addToRef = function(h, d) {
+ return d.x = this.x + h.x, d.y = this.y + h.y, this;
+ }, v.prototype.addInPlace = function(h) {
+ return this.x += h.x, this.y += h.y, this;
+ }, v.prototype.addVector3 = function(h) {
+ return new v(this.x + h.x, this.y + h.y);
+ }, v.prototype.subtract = function(h) {
+ return new v(this.x - h.x, this.y - h.y);
+ }, v.prototype.subtractToRef = function(h, d) {
+ return d.x = this.x - h.x, d.y = this.y - h.y, this;
+ }, v.prototype.subtractInPlace = function(h) {
+ return this.x -= h.x, this.y -= h.y, this;
+ }, v.prototype.multiplyInPlace = function(h) {
+ return this.x *= h.x, this.y *= h.y, this;
+ }, v.prototype.multiply = function(h) {
+ return new v(this.x * h.x, this.y * h.y);
+ }, v.prototype.multiplyToRef = function(h, d) {
+ return d.x = this.x * h.x, d.y = this.y * h.y, this;
+ }, v.prototype.multiplyByFloats = function(h, d) {
+ return new v(this.x * h, this.y * d);
+ }, v.prototype.divide = function(h) {
+ return new v(this.x / h.x, this.y / h.y);
+ }, v.prototype.divideToRef = function(h, d) {
+ return d.x = this.x / h.x, d.y = this.y / h.y, this;
+ }, v.prototype.divideInPlace = function(h) {
+ return this.divideToRef(h, this);
+ }, v.prototype.negate = function() {
+ return new v(-this.x, -this.y);
+ }, v.prototype.negateInPlace = function() {
+ return this.x *= -1, this.y *= -1, this;
+ }, v.prototype.negateToRef = function(h) {
+ return h.copyFromFloats(-1 * this.x, -1 * this.y);
+ }, v.prototype.scaleInPlace = function(h) {
+ return this.x *= h, this.y *= h, this;
+ }, v.prototype.scale = function(h) {
+ var d = new v(0, 0);
+ return this.scaleToRef(h, d), d;
+ }, v.prototype.scaleToRef = function(h, d) {
+ return d.x = this.x * h, d.y = this.y * h, this;
+ }, v.prototype.scaleAndAddToRef = function(h, d) {
+ return d.x += this.x * h, d.y += this.y * h, this;
+ }, v.prototype.equals = function(h) {
+ return h && this.x === h.x && this.y === h.y;
+ }, v.prototype.equalsWithEpsilon = function(h, d) {
+ return d === void 0 && (d = f.a), h && D.a.WithinEpsilon(this.x, h.x, d) && D.a.WithinEpsilon(this.y, h.y, d);
+ }, v.prototype.floor = function() {
+ return new v(Math.floor(this.x), Math.floor(this.y));
+ }, v.prototype.fract = function() {
+ return new v(this.x - Math.floor(this.x), this.y - Math.floor(this.y));
+ }, v.prototype.length = function() {
+ return Math.sqrt(this.x * this.x + this.y * this.y);
+ }, v.prototype.lengthSquared = function() {
+ return this.x * this.x + this.y * this.y;
+ }, v.prototype.normalize = function() {
+ var h = this.length();
+ return h === 0 || (this.x /= h, this.y /= h), this;
+ }, v.prototype.clone = function() {
+ return new v(this.x, this.y);
+ }, v.Zero = function() {
+ return new v(0, 0);
+ }, v.One = function() {
+ return new v(1, 1);
+ }, v.FromArray = function(h, d) {
+ return d === void 0 && (d = 0), new v(h[d], h[d + 1]);
+ }, v.FromArrayToRef = function(h, d, b) {
+ b.x = h[d], b.y = h[d + 1];
+ }, v.CatmullRom = function(h, d, b, T, N) {
+ var U = N * N, B = N * U;
+ return new v(0.5 * (2 * d.x + (-h.x + b.x) * N + (2 * h.x - 5 * d.x + 4 * b.x - T.x) * U + (-h.x + 3 * d.x - 3 * b.x + T.x) * B), 0.5 * (2 * d.y + (-h.y + b.y) * N + (2 * h.y - 5 * d.y + 4 * b.y - T.y) * U + (-h.y + 3 * d.y - 3 * b.y + T.y) * B));
+ }, v.Clamp = function(h, d, b) {
+ var T = h.x;
+ T = (T = T > b.x ? b.x : T) < d.x ? d.x : T;
+ var N = h.y;
+ return new v(T, N = (N = N > b.y ? b.y : N) < d.y ? d.y : N);
+ }, v.Hermite = function(h, d, b, T, N) {
+ var U = N * N, B = N * U, L = 2 * B - 3 * U + 1, j = -2 * B + 3 * U, W = B - 2 * U + N, Y = B - U;
+ return new v(h.x * L + b.x * j + d.x * W + T.x * Y, h.y * L + b.y * j + d.y * W + T.y * Y);
+ }, v.Lerp = function(h, d, b) {
+ return new v(h.x + (d.x - h.x) * b, h.y + (d.y - h.y) * b);
+ }, v.Dot = function(h, d) {
+ return h.x * d.x + h.y * d.y;
+ }, v.Normalize = function(h) {
+ var d = h.clone();
+ return d.normalize(), d;
+ }, v.Minimize = function(h, d) {
+ return new v(h.x < d.x ? h.x : d.x, h.y < d.y ? h.y : d.y);
+ }, v.Maximize = function(h, d) {
+ return new v(h.x > d.x ? h.x : d.x, h.y > d.y ? h.y : d.y);
+ }, v.Transform = function(h, d) {
+ var b = v.Zero();
+ return v.TransformToRef(h, d, b), b;
+ }, v.TransformToRef = function(h, d, b) {
+ var T = d.m, N = h.x * T[0] + h.y * T[4] + T[12], U = h.x * T[1] + h.y * T[5] + T[13];
+ b.x = N, b.y = U;
+ }, v.PointInTriangle = function(h, d, b, T) {
+ var N = 0.5 * (-b.y * T.x + d.y * (-b.x + T.x) + d.x * (b.y - T.y) + b.x * T.y), U = N < 0 ? -1 : 1, B = (d.y * T.x - d.x * T.y + (T.y - d.y) * h.x + (d.x - T.x) * h.y) * U, L = (d.x * b.y - d.y * b.x + (d.y - b.y) * h.x + (b.x - d.x) * h.y) * U;
+ return B > 0 && L > 0 && B + L < 2 * N * U;
+ }, v.Distance = function(h, d) {
+ return Math.sqrt(v.DistanceSquared(h, d));
+ }, v.DistanceSquared = function(h, d) {
+ var b = h.x - d.x, T = h.y - d.y;
+ return b * b + T * T;
+ }, v.Center = function(h, d) {
+ var b = h.add(d);
+ return b.scaleInPlace(0.5), b;
+ }, v.DistanceOfPointFromSegment = function(h, d, b) {
+ var T = v.DistanceSquared(d, b);
+ if (T === 0)
+ return v.Distance(h, d);
+ var N = b.subtract(d), U = Math.max(0, Math.min(1, v.Dot(h.subtract(d), N) / T)), B = d.add(N.multiplyByFloats(U, U));
+ return v.Distance(h, B);
+ }, v;
+ }(), R = function() {
+ function v(h, d, b) {
+ h === void 0 && (h = 0), d === void 0 && (d = 0), b === void 0 && (b = 0), this._isDirty = !0, this._x = h, this._y = d, this._z = b;
+ }
+ return Object.defineProperty(v.prototype, "x", { get: function() {
+ return this._x;
+ }, set: function(h) {
+ this._x = h, this._isDirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(v.prototype, "y", { get: function() {
+ return this._y;
+ }, set: function(h) {
+ this._y = h, this._isDirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(v.prototype, "z", { get: function() {
+ return this._z;
+ }, set: function(h) {
+ this._z = h, this._isDirty = !0;
+ }, enumerable: !1, configurable: !0 }), v.prototype.toString = function() {
+ return "{X: " + this._x + " Y:" + this._y + " Z:" + this._z + "}";
+ }, v.prototype.getClassName = function() {
+ return "Vector3";
+ }, v.prototype.getHashCode = function() {
+ var h = 0 | this._x;
+ return h = 397 * (h = 397 * h ^ (0 | this._y)) ^ (0 | this._z);
+ }, v.prototype.asArray = function() {
+ var h = [];
+ return this.toArray(h, 0), h;
+ }, v.prototype.toArray = function(h, d) {
+ return d === void 0 && (d = 0), h[d] = this._x, h[d + 1] = this._y, h[d + 2] = this._z, this;
+ }, v.prototype.fromArray = function(h, d) {
+ return d === void 0 && (d = 0), v.FromArrayToRef(h, d, this), this;
+ }, v.prototype.toQuaternion = function() {
+ return u.RotationYawPitchRoll(this._y, this._x, this._z);
+ }, v.prototype.addInPlace = function(h) {
+ return this.addInPlaceFromFloats(h._x, h._y, h._z);
+ }, v.prototype.addInPlaceFromFloats = function(h, d, b) {
+ return this.x += h, this.y += d, this.z += b, this;
+ }, v.prototype.add = function(h) {
+ return new v(this._x + h._x, this._y + h._y, this._z + h._z);
+ }, v.prototype.addToRef = function(h, d) {
+ return d.copyFromFloats(this._x + h._x, this._y + h._y, this._z + h._z);
+ }, v.prototype.subtractInPlace = function(h) {
+ return this.x -= h._x, this.y -= h._y, this.z -= h._z, this;
+ }, v.prototype.subtract = function(h) {
+ return new v(this._x - h._x, this._y - h._y, this._z - h._z);
+ }, v.prototype.subtractToRef = function(h, d) {
+ return this.subtractFromFloatsToRef(h._x, h._y, h._z, d);
+ }, v.prototype.subtractFromFloats = function(h, d, b) {
+ return new v(this._x - h, this._y - d, this._z - b);
+ }, v.prototype.subtractFromFloatsToRef = function(h, d, b, T) {
+ return T.copyFromFloats(this._x - h, this._y - d, this._z - b);
+ }, v.prototype.negate = function() {
+ return new v(-this._x, -this._y, -this._z);
+ }, v.prototype.negateInPlace = function() {
+ return this.x *= -1, this.y *= -1, this.z *= -1, this;
+ }, v.prototype.negateToRef = function(h) {
+ return h.copyFromFloats(-1 * this._x, -1 * this._y, -1 * this._z);
+ }, v.prototype.scaleInPlace = function(h) {
+ return this.x *= h, this.y *= h, this.z *= h, this;
+ }, v.prototype.scale = function(h) {
+ return new v(this._x * h, this._y * h, this._z * h);
+ }, v.prototype.scaleToRef = function(h, d) {
+ return d.copyFromFloats(this._x * h, this._y * h, this._z * h);
+ }, v.prototype.scaleAndAddToRef = function(h, d) {
+ return d.addInPlaceFromFloats(this._x * h, this._y * h, this._z * h);
+ }, v.prototype.projectOnPlane = function(h, d) {
+ var b = v.Zero();
+ return this.projectOnPlaneToRef(h, d, b), b;
+ }, v.prototype.projectOnPlaneToRef = function(h, d, b) {
+ var T = h.normal, N = h.d, U = A.Vector3[0];
+ this.subtractToRef(d, U), U.normalize();
+ var B = v.Dot(U, T), L = -(v.Dot(d, T) + N) / B, j = U.scaleInPlace(L);
+ d.addToRef(j, b);
+ }, v.prototype.equals = function(h) {
+ return h && this._x === h._x && this._y === h._y && this._z === h._z;
+ }, v.prototype.equalsWithEpsilon = function(h, d) {
+ return d === void 0 && (d = f.a), h && D.a.WithinEpsilon(this._x, h._x, d) && D.a.WithinEpsilon(this._y, h._y, d) && D.a.WithinEpsilon(this._z, h._z, d);
+ }, v.prototype.equalsToFloats = function(h, d, b) {
+ return this._x === h && this._y === d && this._z === b;
+ }, v.prototype.multiplyInPlace = function(h) {
+ return this.x *= h._x, this.y *= h._y, this.z *= h._z, this;
+ }, v.prototype.multiply = function(h) {
+ return this.multiplyByFloats(h._x, h._y, h._z);
+ }, v.prototype.multiplyToRef = function(h, d) {
+ return d.copyFromFloats(this._x * h._x, this._y * h._y, this._z * h._z);
+ }, v.prototype.multiplyByFloats = function(h, d, b) {
+ return new v(this._x * h, this._y * d, this._z * b);
+ }, v.prototype.divide = function(h) {
+ return new v(this._x / h._x, this._y / h._y, this._z / h._z);
+ }, v.prototype.divideToRef = function(h, d) {
+ return d.copyFromFloats(this._x / h._x, this._y / h._y, this._z / h._z);
+ }, v.prototype.divideInPlace = function(h) {
+ return this.divideToRef(h, this);
+ }, v.prototype.minimizeInPlace = function(h) {
+ return this.minimizeInPlaceFromFloats(h._x, h._y, h._z);
+ }, v.prototype.maximizeInPlace = function(h) {
+ return this.maximizeInPlaceFromFloats(h._x, h._y, h._z);
+ }, v.prototype.minimizeInPlaceFromFloats = function(h, d, b) {
+ return h < this._x && (this.x = h), d < this._y && (this.y = d), b < this._z && (this.z = b), this;
+ }, v.prototype.maximizeInPlaceFromFloats = function(h, d, b) {
+ return h > this._x && (this.x = h), d > this._y && (this.y = d), b > this._z && (this.z = b), this;
+ }, v.prototype.isNonUniformWithinEpsilon = function(h) {
+ var d = Math.abs(this._x), b = Math.abs(this._y);
+ if (!D.a.WithinEpsilon(d, b, h))
+ return !0;
+ var T = Math.abs(this._z);
+ return !D.a.WithinEpsilon(d, T, h) || !D.a.WithinEpsilon(b, T, h);
+ }, Object.defineProperty(v.prototype, "isNonUniform", { get: function() {
+ var h = Math.abs(this._x);
+ return h !== Math.abs(this._y) || h !== Math.abs(this._z);
+ }, enumerable: !1, configurable: !0 }), v.prototype.floor = function() {
+ return new v(Math.floor(this._x), Math.floor(this._y), Math.floor(this._z));
+ }, v.prototype.fract = function() {
+ return new v(this._x - Math.floor(this._x), this._y - Math.floor(this._y), this._z - Math.floor(this._z));
+ }, v.prototype.length = function() {
+ return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z);
+ }, v.prototype.lengthSquared = function() {
+ return this._x * this._x + this._y * this._y + this._z * this._z;
+ }, v.prototype.normalize = function() {
+ return this.normalizeFromLength(this.length());
+ }, v.prototype.reorderInPlace = function(h) {
+ var d = this;
+ return (h = h.toLowerCase()) === "xyz" || (A.Vector3[0].copyFrom(this), ["x", "y", "z"].forEach(function(b, T) {
+ d[b] = A.Vector3[0][h[T]];
+ })), this;
+ }, v.prototype.rotateByQuaternionToRef = function(h, d) {
+ return h.toRotationMatrix(A.Matrix[0]), v.TransformCoordinatesToRef(this, A.Matrix[0], d), d;
+ }, v.prototype.rotateByQuaternionAroundPointToRef = function(h, d, b) {
+ return this.subtractToRef(d, A.Vector3[0]), A.Vector3[0].rotateByQuaternionToRef(h, A.Vector3[0]), d.addToRef(A.Vector3[0], b), b;
+ }, v.prototype.cross = function(h) {
+ return v.Cross(this, h);
+ }, v.prototype.normalizeFromLength = function(h) {
+ return h === 0 || h === 1 ? this : this.scaleInPlace(1 / h);
+ }, v.prototype.normalizeToNew = function() {
+ var h = new v(0, 0, 0);
+ return this.normalizeToRef(h), h;
+ }, v.prototype.normalizeToRef = function(h) {
+ var d = this.length();
+ return d === 0 || d === 1 ? h.copyFromFloats(this._x, this._y, this._z) : this.scaleToRef(1 / d, h);
+ }, v.prototype.clone = function() {
+ return new v(this._x, this._y, this._z);
+ }, v.prototype.copyFrom = function(h) {
+ return this.copyFromFloats(h._x, h._y, h._z);
+ }, v.prototype.copyFromFloats = function(h, d, b) {
+ return this.x = h, this.y = d, this.z = b, this;
+ }, v.prototype.set = function(h, d, b) {
+ return this.copyFromFloats(h, d, b);
+ }, v.prototype.setAll = function(h) {
+ return this.x = this.y = this.z = h, this;
+ }, v.GetClipFactor = function(h, d, b, T) {
+ var N = v.Dot(h, b) - T;
+ return N / (N - (v.Dot(d, b) - T));
+ }, v.GetAngleBetweenVectors = function(h, d, b) {
+ var T = h.normalizeToRef(A.Vector3[1]), N = d.normalizeToRef(A.Vector3[2]), U = v.Dot(T, N), B = A.Vector3[3];
+ return v.CrossToRef(T, N, B), v.Dot(B, b) > 0 ? Math.acos(U) : -Math.acos(U);
+ }, v.FromArray = function(h, d) {
+ return d === void 0 && (d = 0), new v(h[d], h[d + 1], h[d + 2]);
+ }, v.FromFloatArray = function(h, d) {
+ return v.FromArray(h, d);
+ }, v.FromArrayToRef = function(h, d, b) {
+ b.x = h[d], b.y = h[d + 1], b.z = h[d + 2];
+ }, v.FromFloatArrayToRef = function(h, d, b) {
+ return v.FromArrayToRef(h, d, b);
+ }, v.FromFloatsToRef = function(h, d, b, T) {
+ T.copyFromFloats(h, d, b);
+ }, v.Zero = function() {
+ return new v(0, 0, 0);
+ }, v.One = function() {
+ return new v(1, 1, 1);
+ }, v.Up = function() {
+ return new v(0, 1, 0);
+ }, Object.defineProperty(v, "UpReadOnly", { get: function() {
+ return v._UpReadOnly;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(v, "ZeroReadOnly", { get: function() {
+ return v._ZeroReadOnly;
+ }, enumerable: !1, configurable: !0 }), v.Down = function() {
+ return new v(0, -1, 0);
+ }, v.Forward = function(h) {
+ return h === void 0 && (h = !1), new v(0, 0, h ? -1 : 1);
+ }, v.Backward = function(h) {
+ return h === void 0 && (h = !1), new v(0, 0, h ? 1 : -1);
+ }, v.Right = function() {
+ return new v(1, 0, 0);
+ }, v.Left = function() {
+ return new v(-1, 0, 0);
+ }, v.TransformCoordinates = function(h, d) {
+ var b = v.Zero();
+ return v.TransformCoordinatesToRef(h, d, b), b;
+ }, v.TransformCoordinatesToRef = function(h, d, b) {
+ v.TransformCoordinatesFromFloatsToRef(h._x, h._y, h._z, d, b);
+ }, v.TransformCoordinatesFromFloatsToRef = function(h, d, b, T, N) {
+ var U = T.m, B = h * U[0] + d * U[4] + b * U[8] + U[12], L = h * U[1] + d * U[5] + b * U[9] + U[13], j = h * U[2] + d * U[6] + b * U[10] + U[14], W = 1 / (h * U[3] + d * U[7] + b * U[11] + U[15]);
+ N.x = B * W, N.y = L * W, N.z = j * W;
+ }, v.TransformNormal = function(h, d) {
+ var b = v.Zero();
+ return v.TransformNormalToRef(h, d, b), b;
+ }, v.TransformNormalToRef = function(h, d, b) {
+ this.TransformNormalFromFloatsToRef(h._x, h._y, h._z, d, b);
+ }, v.TransformNormalFromFloatsToRef = function(h, d, b, T, N) {
+ var U = T.m;
+ N.x = h * U[0] + d * U[4] + b * U[8], N.y = h * U[1] + d * U[5] + b * U[9], N.z = h * U[2] + d * U[6] + b * U[10];
+ }, v.CatmullRom = function(h, d, b, T, N) {
+ var U = N * N, B = N * U;
+ return new v(0.5 * (2 * d._x + (-h._x + b._x) * N + (2 * h._x - 5 * d._x + 4 * b._x - T._x) * U + (-h._x + 3 * d._x - 3 * b._x + T._x) * B), 0.5 * (2 * d._y + (-h._y + b._y) * N + (2 * h._y - 5 * d._y + 4 * b._y - T._y) * U + (-h._y + 3 * d._y - 3 * b._y + T._y) * B), 0.5 * (2 * d._z + (-h._z + b._z) * N + (2 * h._z - 5 * d._z + 4 * b._z - T._z) * U + (-h._z + 3 * d._z - 3 * b._z + T._z) * B));
+ }, v.Clamp = function(h, d, b) {
+ var T = new v();
+ return v.ClampToRef(h, d, b, T), T;
+ }, v.ClampToRef = function(h, d, b, T) {
+ var N = h._x;
+ N = (N = N > b._x ? b._x : N) < d._x ? d._x : N;
+ var U = h._y;
+ U = (U = U > b._y ? b._y : U) < d._y ? d._y : U;
+ var B = h._z;
+ B = (B = B > b._z ? b._z : B) < d._z ? d._z : B, T.copyFromFloats(N, U, B);
+ }, v.CheckExtends = function(h, d, b) {
+ d.minimizeInPlace(h), b.maximizeInPlace(h);
+ }, v.Hermite = function(h, d, b, T, N) {
+ var U = N * N, B = N * U, L = 2 * B - 3 * U + 1, j = -2 * B + 3 * U, W = B - 2 * U + N, Y = B - U;
+ return new v(h._x * L + b._x * j + d._x * W + T._x * Y, h._y * L + b._y * j + d._y * W + T._y * Y, h._z * L + b._z * j + d._z * W + T._z * Y);
+ }, v.Lerp = function(h, d, b) {
+ var T = new v(0, 0, 0);
+ return v.LerpToRef(h, d, b, T), T;
+ }, v.LerpToRef = function(h, d, b, T) {
+ T.x = h._x + (d._x - h._x) * b, T.y = h._y + (d._y - h._y) * b, T.z = h._z + (d._z - h._z) * b;
+ }, v.Dot = function(h, d) {
+ return h._x * d._x + h._y * d._y + h._z * d._z;
+ }, v.Cross = function(h, d) {
+ var b = v.Zero();
+ return v.CrossToRef(h, d, b), b;
+ }, v.CrossToRef = function(h, d, b) {
+ var T = h._y * d._z - h._z * d._y, N = h._z * d._x - h._x * d._z, U = h._x * d._y - h._y * d._x;
+ b.copyFromFloats(T, N, U);
+ }, v.Normalize = function(h) {
+ var d = v.Zero();
+ return v.NormalizeToRef(h, d), d;
+ }, v.NormalizeToRef = function(h, d) {
+ h.normalizeToRef(d);
+ }, v.Project = function(h, d, b, T) {
+ var N = new v();
+ return v.ProjectToRef(h, d, b, T, N), N;
+ }, v.ProjectToRef = function(h, d, b, T, N) {
+ var U = T.width, B = T.height, L = T.x, j = T.y, W = A.Matrix[1];
+ E.FromValuesToRef(U / 2, 0, 0, 0, 0, -B / 2, 0, 0, 0, 0, 0.5, 0, L + U / 2, B / 2 + j, 0.5, 1, W);
+ var Y = A.Matrix[0];
+ return d.multiplyToRef(b, Y), Y.multiplyToRef(W, Y), v.TransformCoordinatesToRef(h, Y, N), N;
+ }, v._UnprojectFromInvertedMatrixToRef = function(h, d, b) {
+ v.TransformCoordinatesToRef(h, d, b);
+ var T = d.m, N = h._x * T[3] + h._y * T[7] + h._z * T[11] + T[15];
+ D.a.WithinEpsilon(N, 1) && b.scaleInPlace(1 / N);
+ }, v.UnprojectFromTransform = function(h, d, b, T, N) {
+ var U = A.Matrix[0];
+ T.multiplyToRef(N, U), U.invert(), h.x = h._x / d * 2 - 1, h.y = -(h._y / b * 2 - 1);
+ var B = new v();
+ return v._UnprojectFromInvertedMatrixToRef(h, U, B), B;
+ }, v.Unproject = function(h, d, b, T, N, U) {
+ var B = v.Zero();
+ return v.UnprojectToRef(h, d, b, T, N, U, B), B;
+ }, v.UnprojectToRef = function(h, d, b, T, N, U, B) {
+ v.UnprojectFloatsToRef(h._x, h._y, h._z, d, b, T, N, U, B);
+ }, v.UnprojectFloatsToRef = function(h, d, b, T, N, U, B, L, j) {
+ var W = A.Matrix[0];
+ U.multiplyToRef(B, W), W.multiplyToRef(L, W), W.invert();
+ var Y = A.Vector3[0];
+ Y.x = h / T * 2 - 1, Y.y = -(d / N * 2 - 1), Y.z = 2 * b - 1, v._UnprojectFromInvertedMatrixToRef(Y, W, j);
+ }, v.Minimize = function(h, d) {
+ var b = h.clone();
+ return b.minimizeInPlace(d), b;
+ }, v.Maximize = function(h, d) {
+ var b = h.clone();
+ return b.maximizeInPlace(d), b;
+ }, v.Distance = function(h, d) {
+ return Math.sqrt(v.DistanceSquared(h, d));
+ }, v.DistanceSquared = function(h, d) {
+ var b = h._x - d._x, T = h._y - d._y, N = h._z - d._z;
+ return b * b + T * T + N * N;
+ }, v.Center = function(h, d) {
+ var b = h.add(d);
+ return b.scaleInPlace(0.5), b;
+ }, v.RotationFromAxis = function(h, d, b) {
+ var T = v.Zero();
+ return v.RotationFromAxisToRef(h, d, b, T), T;
+ }, v.RotationFromAxisToRef = function(h, d, b, T) {
+ var N = A.Quaternion[0];
+ u.RotationQuaternionFromAxisToRef(h, d, b, N), N.toEulerAnglesToRef(T);
+ }, v._UpReadOnly = v.Up(), v._ZeroReadOnly = v.Zero(), v;
+ }(), g = function() {
+ function v(h, d, b, T) {
+ this.x = h, this.y = d, this.z = b, this.w = T;
+ }
+ return v.prototype.toString = function() {
+ return "{X: " + this.x + " Y:" + this.y + " Z:" + this.z + " W:" + this.w + "}";
+ }, v.prototype.getClassName = function() {
+ return "Vector4";
+ }, v.prototype.getHashCode = function() {
+ var h = 0 | this.x;
+ return h = 397 * (h = 397 * (h = 397 * h ^ (0 | this.y)) ^ (0 | this.z)) ^ (0 | this.w);
+ }, v.prototype.asArray = function() {
+ var h = new Array();
+ return this.toArray(h, 0), h;
+ }, v.prototype.toArray = function(h, d) {
+ return d === void 0 && (d = 0), h[d] = this.x, h[d + 1] = this.y, h[d + 2] = this.z, h[d + 3] = this.w, this;
+ }, v.prototype.fromArray = function(h, d) {
+ return d === void 0 && (d = 0), v.FromArrayToRef(h, d, this), this;
+ }, v.prototype.addInPlace = function(h) {
+ return this.x += h.x, this.y += h.y, this.z += h.z, this.w += h.w, this;
+ }, v.prototype.add = function(h) {
+ return new v(this.x + h.x, this.y + h.y, this.z + h.z, this.w + h.w);
+ }, v.prototype.addToRef = function(h, d) {
+ return d.x = this.x + h.x, d.y = this.y + h.y, d.z = this.z + h.z, d.w = this.w + h.w, this;
+ }, v.prototype.subtractInPlace = function(h) {
+ return this.x -= h.x, this.y -= h.y, this.z -= h.z, this.w -= h.w, this;
+ }, v.prototype.subtract = function(h) {
+ return new v(this.x - h.x, this.y - h.y, this.z - h.z, this.w - h.w);
+ }, v.prototype.subtractToRef = function(h, d) {
+ return d.x = this.x - h.x, d.y = this.y - h.y, d.z = this.z - h.z, d.w = this.w - h.w, this;
+ }, v.prototype.subtractFromFloats = function(h, d, b, T) {
+ return new v(this.x - h, this.y - d, this.z - b, this.w - T);
+ }, v.prototype.subtractFromFloatsToRef = function(h, d, b, T, N) {
+ return N.x = this.x - h, N.y = this.y - d, N.z = this.z - b, N.w = this.w - T, this;
+ }, v.prototype.negate = function() {
+ return new v(-this.x, -this.y, -this.z, -this.w);
+ }, v.prototype.negateInPlace = function() {
+ return this.x *= -1, this.y *= -1, this.z *= -1, this.w *= -1, this;
+ }, v.prototype.negateToRef = function(h) {
+ return h.copyFromFloats(-1 * this.x, -1 * this.y, -1 * this.z, -1 * this.w);
+ }, v.prototype.scaleInPlace = function(h) {
+ return this.x *= h, this.y *= h, this.z *= h, this.w *= h, this;
+ }, v.prototype.scale = function(h) {
+ return new v(this.x * h, this.y * h, this.z * h, this.w * h);
+ }, v.prototype.scaleToRef = function(h, d) {
+ return d.x = this.x * h, d.y = this.y * h, d.z = this.z * h, d.w = this.w * h, this;
+ }, v.prototype.scaleAndAddToRef = function(h, d) {
+ return d.x += this.x * h, d.y += this.y * h, d.z += this.z * h, d.w += this.w * h, this;
+ }, v.prototype.equals = function(h) {
+ return h && this.x === h.x && this.y === h.y && this.z === h.z && this.w === h.w;
+ }, v.prototype.equalsWithEpsilon = function(h, d) {
+ return d === void 0 && (d = f.a), h && D.a.WithinEpsilon(this.x, h.x, d) && D.a.WithinEpsilon(this.y, h.y, d) && D.a.WithinEpsilon(this.z, h.z, d) && D.a.WithinEpsilon(this.w, h.w, d);
+ }, v.prototype.equalsToFloats = function(h, d, b, T) {
+ return this.x === h && this.y === d && this.z === b && this.w === T;
+ }, v.prototype.multiplyInPlace = function(h) {
+ return this.x *= h.x, this.y *= h.y, this.z *= h.z, this.w *= h.w, this;
+ }, v.prototype.multiply = function(h) {
+ return new v(this.x * h.x, this.y * h.y, this.z * h.z, this.w * h.w);
+ }, v.prototype.multiplyToRef = function(h, d) {
+ return d.x = this.x * h.x, d.y = this.y * h.y, d.z = this.z * h.z, d.w = this.w * h.w, this;
+ }, v.prototype.multiplyByFloats = function(h, d, b, T) {
+ return new v(this.x * h, this.y * d, this.z * b, this.w * T);
+ }, v.prototype.divide = function(h) {
+ return new v(this.x / h.x, this.y / h.y, this.z / h.z, this.w / h.w);
+ }, v.prototype.divideToRef = function(h, d) {
+ return d.x = this.x / h.x, d.y = this.y / h.y, d.z = this.z / h.z, d.w = this.w / h.w, this;
+ }, v.prototype.divideInPlace = function(h) {
+ return this.divideToRef(h, this);
+ }, v.prototype.minimizeInPlace = function(h) {
+ return h.x < this.x && (this.x = h.x), h.y < this.y && (this.y = h.y), h.z < this.z && (this.z = h.z), h.w < this.w && (this.w = h.w), this;
+ }, v.prototype.maximizeInPlace = function(h) {
+ return h.x > this.x && (this.x = h.x), h.y > this.y && (this.y = h.y), h.z > this.z && (this.z = h.z), h.w > this.w && (this.w = h.w), this;
+ }, v.prototype.floor = function() {
+ return new v(Math.floor(this.x), Math.floor(this.y), Math.floor(this.z), Math.floor(this.w));
+ }, v.prototype.fract = function() {
+ return new v(this.x - Math.floor(this.x), this.y - Math.floor(this.y), this.z - Math.floor(this.z), this.w - Math.floor(this.w));
+ }, v.prototype.length = function() {
+ return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);
+ }, v.prototype.lengthSquared = function() {
+ return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;
+ }, v.prototype.normalize = function() {
+ var h = this.length();
+ return h === 0 ? this : this.scaleInPlace(1 / h);
+ }, v.prototype.toVector3 = function() {
+ return new R(this.x, this.y, this.z);
+ }, v.prototype.clone = function() {
+ return new v(this.x, this.y, this.z, this.w);
+ }, v.prototype.copyFrom = function(h) {
+ return this.x = h.x, this.y = h.y, this.z = h.z, this.w = h.w, this;
+ }, v.prototype.copyFromFloats = function(h, d, b, T) {
+ return this.x = h, this.y = d, this.z = b, this.w = T, this;
+ }, v.prototype.set = function(h, d, b, T) {
+ return this.copyFromFloats(h, d, b, T);
+ }, v.prototype.setAll = function(h) {
+ return this.x = this.y = this.z = this.w = h, this;
+ }, v.FromArray = function(h, d) {
+ return d || (d = 0), new v(h[d], h[d + 1], h[d + 2], h[d + 3]);
+ }, v.FromArrayToRef = function(h, d, b) {
+ b.x = h[d], b.y = h[d + 1], b.z = h[d + 2], b.w = h[d + 3];
+ }, v.FromFloatArrayToRef = function(h, d, b) {
+ v.FromArrayToRef(h, d, b);
+ }, v.FromFloatsToRef = function(h, d, b, T, N) {
+ N.x = h, N.y = d, N.z = b, N.w = T;
+ }, v.Zero = function() {
+ return new v(0, 0, 0, 0);
+ }, v.One = function() {
+ return new v(1, 1, 1, 1);
+ }, v.Normalize = function(h) {
+ var d = v.Zero();
+ return v.NormalizeToRef(h, d), d;
+ }, v.NormalizeToRef = function(h, d) {
+ d.copyFrom(h), d.normalize();
+ }, v.Minimize = function(h, d) {
+ var b = h.clone();
+ return b.minimizeInPlace(d), b;
+ }, v.Maximize = function(h, d) {
+ var b = h.clone();
+ return b.maximizeInPlace(d), b;
+ }, v.Distance = function(h, d) {
+ return Math.sqrt(v.DistanceSquared(h, d));
+ }, v.DistanceSquared = function(h, d) {
+ var b = h.x - d.x, T = h.y - d.y, N = h.z - d.z, U = h.w - d.w;
+ return b * b + T * T + N * N + U * U;
+ }, v.Center = function(h, d) {
+ var b = h.add(d);
+ return b.scaleInPlace(0.5), b;
+ }, v.TransformNormal = function(h, d) {
+ var b = v.Zero();
+ return v.TransformNormalToRef(h, d, b), b;
+ }, v.TransformNormalToRef = function(h, d, b) {
+ var T = d.m, N = h.x * T[0] + h.y * T[4] + h.z * T[8], U = h.x * T[1] + h.y * T[5] + h.z * T[9], B = h.x * T[2] + h.y * T[6] + h.z * T[10];
+ b.x = N, b.y = U, b.z = B, b.w = h.w;
+ }, v.TransformNormalFromFloatsToRef = function(h, d, b, T, N, U) {
+ var B = N.m;
+ U.x = h * B[0] + d * B[4] + b * B[8], U.y = h * B[1] + d * B[5] + b * B[9], U.z = h * B[2] + d * B[6] + b * B[10], U.w = T;
+ }, v.FromVector3 = function(h, d) {
+ return d === void 0 && (d = 0), new v(h._x, h._y, h._z, d);
+ }, v;
+ }(), u = function() {
+ function v(h, d, b, T) {
+ h === void 0 && (h = 0), d === void 0 && (d = 0), b === void 0 && (b = 0), T === void 0 && (T = 1), this._isDirty = !0, this._x = h, this._y = d, this._z = b, this._w = T;
+ }
+ return Object.defineProperty(v.prototype, "x", { get: function() {
+ return this._x;
+ }, set: function(h) {
+ this._x = h, this._isDirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(v.prototype, "y", { get: function() {
+ return this._y;
+ }, set: function(h) {
+ this._y = h, this._isDirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(v.prototype, "z", { get: function() {
+ return this._z;
+ }, set: function(h) {
+ this._z = h, this._isDirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(v.prototype, "w", { get: function() {
+ return this._w;
+ }, set: function(h) {
+ this._w = h, this._isDirty = !0;
+ }, enumerable: !1, configurable: !0 }), v.prototype.toString = function() {
+ return "{X: " + this._x + " Y:" + this._y + " Z:" + this._z + " W:" + this._w + "}";
+ }, v.prototype.getClassName = function() {
+ return "Quaternion";
+ }, v.prototype.getHashCode = function() {
+ var h = 0 | this._x;
+ return h = 397 * (h = 397 * (h = 397 * h ^ (0 | this._y)) ^ (0 | this._z)) ^ (0 | this._w);
+ }, v.prototype.asArray = function() {
+ return [this._x, this._y, this._z, this._w];
+ }, v.prototype.equals = function(h) {
+ return h && this._x === h._x && this._y === h._y && this._z === h._z && this._w === h._w;
+ }, v.prototype.equalsWithEpsilon = function(h, d) {
+ return d === void 0 && (d = f.a), h && D.a.WithinEpsilon(this._x, h._x, d) && D.a.WithinEpsilon(this._y, h._y, d) && D.a.WithinEpsilon(this._z, h._z, d) && D.a.WithinEpsilon(this._w, h._w, d);
+ }, v.prototype.clone = function() {
+ return new v(this._x, this._y, this._z, this._w);
+ }, v.prototype.copyFrom = function(h) {
+ return this.x = h._x, this.y = h._y, this.z = h._z, this.w = h._w, this;
+ }, v.prototype.copyFromFloats = function(h, d, b, T) {
+ return this.x = h, this.y = d, this.z = b, this.w = T, this;
+ }, v.prototype.set = function(h, d, b, T) {
+ return this.copyFromFloats(h, d, b, T);
+ }, v.prototype.add = function(h) {
+ return new v(this._x + h._x, this._y + h._y, this._z + h._z, this._w + h._w);
+ }, v.prototype.addInPlace = function(h) {
+ return this._x += h._x, this._y += h._y, this._z += h._z, this._w += h._w, this;
+ }, v.prototype.subtract = function(h) {
+ return new v(this._x - h._x, this._y - h._y, this._z - h._z, this._w - h._w);
+ }, v.prototype.scale = function(h) {
+ return new v(this._x * h, this._y * h, this._z * h, this._w * h);
+ }, v.prototype.scaleToRef = function(h, d) {
+ return d.x = this._x * h, d.y = this._y * h, d.z = this._z * h, d.w = this._w * h, this;
+ }, v.prototype.scaleInPlace = function(h) {
+ return this.x *= h, this.y *= h, this.z *= h, this.w *= h, this;
+ }, v.prototype.scaleAndAddToRef = function(h, d) {
+ return d.x += this._x * h, d.y += this._y * h, d.z += this._z * h, d.w += this._w * h, this;
+ }, v.prototype.multiply = function(h) {
+ var d = new v(0, 0, 0, 1);
+ return this.multiplyToRef(h, d), d;
+ }, v.prototype.multiplyToRef = function(h, d) {
+ var b = this._x * h._w + this._y * h._z - this._z * h._y + this._w * h._x, T = -this._x * h._z + this._y * h._w + this._z * h._x + this._w * h._y, N = this._x * h._y - this._y * h._x + this._z * h._w + this._w * h._z, U = -this._x * h._x - this._y * h._y - this._z * h._z + this._w * h._w;
+ return d.copyFromFloats(b, T, N, U), this;
+ }, v.prototype.multiplyInPlace = function(h) {
+ return this.multiplyToRef(h, this), this;
+ }, v.prototype.conjugateToRef = function(h) {
+ return h.copyFromFloats(-this._x, -this._y, -this._z, this._w), this;
+ }, v.prototype.conjugateInPlace = function() {
+ return this.x *= -1, this.y *= -1, this.z *= -1, this;
+ }, v.prototype.conjugate = function() {
+ return new v(-this._x, -this._y, -this._z, this._w);
+ }, v.prototype.length = function() {
+ return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w);
+ }, v.prototype.normalize = function() {
+ var h = this.length();
+ if (h === 0)
+ return this;
+ var d = 1 / h;
+ return this.x *= d, this.y *= d, this.z *= d, this.w *= d, this;
+ }, v.prototype.toEulerAngles = function(h) {
+ var d = R.Zero();
+ return this.toEulerAnglesToRef(d), d;
+ }, v.prototype.toEulerAnglesToRef = function(h) {
+ var d = this._z, b = this._x, T = this._y, N = this._w, U = N * N, B = d * d, L = b * b, j = T * T, W = T * d - b * N;
+ return W < -0.4999999 ? (h.y = 2 * Math.atan2(T, N), h.x = Math.PI / 2, h.z = 0) : W > 0.4999999 ? (h.y = 2 * Math.atan2(T, N), h.x = -Math.PI / 2, h.z = 0) : (h.z = Math.atan2(2 * (b * T + d * N), -B - L + j + U), h.x = Math.asin(-2 * (d * T - b * N)), h.y = Math.atan2(2 * (d * b + T * N), B - L - j + U)), this;
+ }, v.prototype.toRotationMatrix = function(h) {
+ return E.FromQuaternionToRef(this, h), this;
+ }, v.prototype.fromRotationMatrix = function(h) {
+ return v.FromRotationMatrixToRef(h, this), this;
+ }, v.FromRotationMatrix = function(h) {
+ var d = new v();
+ return v.FromRotationMatrixToRef(h, d), d;
+ }, v.FromRotationMatrixToRef = function(h, d) {
+ var b, T = h.m, N = T[0], U = T[4], B = T[8], L = T[1], j = T[5], W = T[9], Y = T[2], oe = T[6], te = T[10], _e = N + j + te;
+ _e > 0 ? (b = 0.5 / Math.sqrt(_e + 1), d.w = 0.25 / b, d.x = (oe - W) * b, d.y = (B - Y) * b, d.z = (L - U) * b) : N > j && N > te ? (b = 2 * Math.sqrt(1 + N - j - te), d.w = (oe - W) / b, d.x = 0.25 * b, d.y = (U + L) / b, d.z = (B + Y) / b) : j > te ? (b = 2 * Math.sqrt(1 + j - N - te), d.w = (B - Y) / b, d.x = (U + L) / b, d.y = 0.25 * b, d.z = (W + oe) / b) : (b = 2 * Math.sqrt(1 + te - N - j), d.w = (L - U) / b, d.x = (B + Y) / b, d.y = (W + oe) / b, d.z = 0.25 * b);
+ }, v.Dot = function(h, d) {
+ return h._x * d._x + h._y * d._y + h._z * d._z + h._w * d._w;
+ }, v.AreClose = function(h, d) {
+ return v.Dot(h, d) >= 0;
+ }, v.Zero = function() {
+ return new v(0, 0, 0, 0);
+ }, v.Inverse = function(h) {
+ return new v(-h._x, -h._y, -h._z, h._w);
+ }, v.InverseToRef = function(h, d) {
+ return d.set(-h._x, -h._y, -h._z, h._w), d;
+ }, v.Identity = function() {
+ return new v(0, 0, 0, 1);
+ }, v.IsIdentity = function(h) {
+ return h && h._x === 0 && h._y === 0 && h._z === 0 && h._w === 1;
+ }, v.RotationAxis = function(h, d) {
+ return v.RotationAxisToRef(h, d, new v());
+ }, v.RotationAxisToRef = function(h, d, b) {
+ var T = Math.sin(d / 2);
+ return h.normalize(), b.w = Math.cos(d / 2), b.x = h._x * T, b.y = h._y * T, b.z = h._z * T, b;
+ }, v.FromArray = function(h, d) {
+ return d || (d = 0), new v(h[d], h[d + 1], h[d + 2], h[d + 3]);
+ }, v.FromArrayToRef = function(h, d, b) {
+ b.x = h[d], b.y = h[d + 1], b.z = h[d + 2], b.w = h[d + 3];
+ }, v.FromEulerAngles = function(h, d, b) {
+ var T = new v();
+ return v.RotationYawPitchRollToRef(d, h, b, T), T;
+ }, v.FromEulerAnglesToRef = function(h, d, b, T) {
+ return v.RotationYawPitchRollToRef(d, h, b, T), T;
+ }, v.FromEulerVector = function(h) {
+ var d = new v();
+ return v.RotationYawPitchRollToRef(h._y, h._x, h._z, d), d;
+ }, v.FromEulerVectorToRef = function(h, d) {
+ return v.RotationYawPitchRollToRef(h._y, h._x, h._z, d), d;
+ }, v.RotationYawPitchRoll = function(h, d, b) {
+ var T = new v();
+ return v.RotationYawPitchRollToRef(h, d, b, T), T;
+ }, v.RotationYawPitchRollToRef = function(h, d, b, T) {
+ var N = 0.5 * b, U = 0.5 * d, B = 0.5 * h, L = Math.sin(N), j = Math.cos(N), W = Math.sin(U), Y = Math.cos(U), oe = Math.sin(B), te = Math.cos(B);
+ T.x = te * W * j + oe * Y * L, T.y = oe * Y * j - te * W * L, T.z = te * Y * L - oe * W * j, T.w = te * Y * j + oe * W * L;
+ }, v.RotationAlphaBetaGamma = function(h, d, b) {
+ var T = new v();
+ return v.RotationAlphaBetaGammaToRef(h, d, b, T), T;
+ }, v.RotationAlphaBetaGammaToRef = function(h, d, b, T) {
+ var N = 0.5 * (b + h), U = 0.5 * (b - h), B = 0.5 * d;
+ T.x = Math.cos(U) * Math.sin(B), T.y = Math.sin(U) * Math.sin(B), T.z = Math.sin(N) * Math.cos(B), T.w = Math.cos(N) * Math.cos(B);
+ }, v.RotationQuaternionFromAxis = function(h, d, b) {
+ var T = new v(0, 0, 0, 0);
+ return v.RotationQuaternionFromAxisToRef(h, d, b, T), T;
+ }, v.RotationQuaternionFromAxisToRef = function(h, d, b, T) {
+ var N = A.Matrix[0];
+ E.FromXYZAxesToRef(h.normalize(), d.normalize(), b.normalize(), N), v.FromRotationMatrixToRef(N, T);
+ }, v.Slerp = function(h, d, b) {
+ var T = v.Identity();
+ return v.SlerpToRef(h, d, b, T), T;
+ }, v.SlerpToRef = function(h, d, b, T) {
+ var N, U, B = h._x * d._x + h._y * d._y + h._z * d._z + h._w * d._w, L = !1;
+ if (B < 0 && (L = !0, B = -B), B > 0.999999)
+ U = 1 - b, N = L ? -b : b;
+ else {
+ var j = Math.acos(B), W = 1 / Math.sin(j);
+ U = Math.sin((1 - b) * j) * W, N = L ? -Math.sin(b * j) * W : Math.sin(b * j) * W;
+ }
+ T.x = U * h._x + N * d._x, T.y = U * h._y + N * d._y, T.z = U * h._z + N * d._z, T.w = U * h._w + N * d._w;
+ }, v.Hermite = function(h, d, b, T, N) {
+ var U = N * N, B = N * U, L = 2 * B - 3 * U + 1, j = -2 * B + 3 * U, W = B - 2 * U + N, Y = B - U;
+ return new v(h._x * L + b._x * j + d._x * W + T._x * Y, h._y * L + b._y * j + d._y * W + T._y * Y, h._z * L + b._z * j + d._z * W + T._z * Y, h._w * L + b._w * j + d._w * W + T._w * Y);
+ }, v;
+ }(), E = function() {
+ function v() {
+ this._isIdentity = !1, this._isIdentityDirty = !0, this._isIdentity3x2 = !0, this._isIdentity3x2Dirty = !0, this.updateFlag = -1, C.a.MatrixTrackPrecisionChange && C.a.MatrixTrackedMatrices.push(this), this._m = new C.a.MatrixCurrentType(16), this._updateIdentityStatus(!1);
+ }
+ return Object.defineProperty(v, "Use64Bits", { get: function() {
+ return C.a.MatrixUse64Bits;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(v.prototype, "m", { get: function() {
+ return this._m;
+ }, enumerable: !1, configurable: !0 }), v.prototype._markAsUpdated = function() {
+ this.updateFlag = v._updateFlagSeed++, this._isIdentity = !1, this._isIdentity3x2 = !1, this._isIdentityDirty = !0, this._isIdentity3x2Dirty = !0;
+ }, v.prototype._updateIdentityStatus = function(h, d, b, T) {
+ d === void 0 && (d = !1), b === void 0 && (b = !1), T === void 0 && (T = !0), this.updateFlag = v._updateFlagSeed++, this._isIdentity = h, this._isIdentity3x2 = h || b, this._isIdentityDirty = !this._isIdentity && d, this._isIdentity3x2Dirty = !this._isIdentity3x2 && T;
+ }, v.prototype.isIdentity = function() {
+ if (this._isIdentityDirty) {
+ this._isIdentityDirty = !1;
+ var h = this._m;
+ this._isIdentity = h[0] === 1 && h[1] === 0 && h[2] === 0 && h[3] === 0 && h[4] === 0 && h[5] === 1 && h[6] === 0 && h[7] === 0 && h[8] === 0 && h[9] === 0 && h[10] === 1 && h[11] === 0 && h[12] === 0 && h[13] === 0 && h[14] === 0 && h[15] === 1;
+ }
+ return this._isIdentity;
+ }, v.prototype.isIdentityAs3x2 = function() {
+ return this._isIdentity3x2Dirty && (this._isIdentity3x2Dirty = !1, this._m[0] !== 1 || this._m[5] !== 1 || this._m[15] !== 1 || this._m[1] !== 0 || this._m[2] !== 0 || this._m[3] !== 0 || this._m[4] !== 0 || this._m[6] !== 0 || this._m[7] !== 0 || this._m[8] !== 0 || this._m[9] !== 0 || this._m[10] !== 0 || this._m[11] !== 0 || this._m[12] !== 0 || this._m[13] !== 0 || this._m[14] !== 0 ? this._isIdentity3x2 = !1 : this._isIdentity3x2 = !0), this._isIdentity3x2;
+ }, v.prototype.determinant = function() {
+ if (this._isIdentity === !0)
+ return 1;
+ var h = this._m, d = h[0], b = h[1], T = h[2], N = h[3], U = h[4], B = h[5], L = h[6], j = h[7], W = h[8], Y = h[9], oe = h[10], te = h[11], _e = h[12], de = h[13], ae = h[14], ie = h[15], Z = oe * ie - ae * te, ee = Y * ie - de * te, w = Y * ae - de * oe, z = W * ie - _e * te, q = W * ae - oe * _e, le = W * de - _e * Y;
+ return d * +(B * Z - L * ee + j * w) + b * -(U * Z - L * z + j * q) + T * +(U * ee - B * z + j * le) + N * -(U * w - B * q + L * le);
+ }, v.prototype.toArray = function() {
+ return this._m;
+ }, v.prototype.asArray = function() {
+ return this._m;
+ }, v.prototype.invert = function() {
+ return this.invertToRef(this), this;
+ }, v.prototype.reset = function() {
+ return v.FromValuesToRef(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this), this._updateIdentityStatus(!1), this;
+ }, v.prototype.add = function(h) {
+ var d = new v();
+ return this.addToRef(h, d), d;
+ }, v.prototype.addToRef = function(h, d) {
+ for (var b = this._m, T = d._m, N = h.m, U = 0; U < 16; U++)
+ T[U] = b[U] + N[U];
+ return d._markAsUpdated(), this;
+ }, v.prototype.addToSelf = function(h) {
+ for (var d = this._m, b = h.m, T = 0; T < 16; T++)
+ d[T] += b[T];
+ return this._markAsUpdated(), this;
+ }, v.prototype.invertToRef = function(h) {
+ if (this._isIdentity === !0)
+ return v.IdentityToRef(h), this;
+ var d = this._m, b = d[0], T = d[1], N = d[2], U = d[3], B = d[4], L = d[5], j = d[6], W = d[7], Y = d[8], oe = d[9], te = d[10], _e = d[11], de = d[12], ae = d[13], ie = d[14], Z = d[15], ee = te * Z - ie * _e, w = oe * Z - ae * _e, z = oe * ie - ae * te, q = Y * Z - de * _e, le = Y * ie - te * de, ce = Y * ae - de * oe, J = +(L * ee - j * w + W * z), H = -(B * ee - j * q + W * le), X = +(B * w - L * q + W * ce), ne = -(B * z - L * le + j * ce), Q = b * J + T * H + N * X + U * ne;
+ if (Q === 0)
+ return h.copyFrom(this), this;
+ var $ = 1 / Q, me = j * Z - ie * W, ye = L * Z - ae * W, be = L * ie - ae * j, ge = B * Z - de * W, Te = B * ie - de * j, Re = B * ae - de * L, Se = j * _e - te * W, Ne = L * _e - oe * W, ze = L * te - oe * j, Ye = B * _e - Y * W, He = B * te - Y * j, Xe = B * oe - Y * L, Ze = -(T * ee - N * w + U * z), je = +(b * ee - N * q + U * le), it = -(b * w - T * q + U * ce), et = +(b * z - T * le + N * ce), lt = +(T * me - N * ye + U * be), ct = -(b * me - N * ge + U * Te), mt = +(b * ye - T * ge + U * Re), St = -(b * be - T * Te + N * Re), Ut = -(T * Se - N * Ne + U * ze), wt = +(b * Se - N * Ye + U * He), Pt = -(b * Ne - T * Ye + U * Xe), Mt = +(b * ze - T * He + N * Xe);
+ return v.FromValuesToRef(J * $, Ze * $, lt * $, Ut * $, H * $, je * $, ct * $, wt * $, X * $, it * $, mt * $, Pt * $, ne * $, et * $, St * $, Mt * $, h), this;
+ }, v.prototype.addAtIndex = function(h, d) {
+ return this._m[h] += d, this._markAsUpdated(), this;
+ }, v.prototype.multiplyAtIndex = function(h, d) {
+ return this._m[h] *= d, this._markAsUpdated(), this;
+ }, v.prototype.setTranslationFromFloats = function(h, d, b) {
+ return this._m[12] = h, this._m[13] = d, this._m[14] = b, this._markAsUpdated(), this;
+ }, v.prototype.addTranslationFromFloats = function(h, d, b) {
+ return this._m[12] += h, this._m[13] += d, this._m[14] += b, this._markAsUpdated(), this;
+ }, v.prototype.setTranslation = function(h) {
+ return this.setTranslationFromFloats(h._x, h._y, h._z);
+ }, v.prototype.getTranslation = function() {
+ return new R(this._m[12], this._m[13], this._m[14]);
+ }, v.prototype.getTranslationToRef = function(h) {
+ return h.x = this._m[12], h.y = this._m[13], h.z = this._m[14], this;
+ }, v.prototype.removeRotationAndScaling = function() {
+ var h = this.m;
+ return v.FromValuesToRef(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, h[12], h[13], h[14], h[15], this), this._updateIdentityStatus(h[12] === 0 && h[13] === 0 && h[14] === 0 && h[15] === 1), this;
+ }, v.prototype.multiply = function(h) {
+ var d = new v();
+ return this.multiplyToRef(h, d), d;
+ }, v.prototype.copyFrom = function(h) {
+ h.copyToArray(this._m);
+ var d = h;
+ return this._updateIdentityStatus(d._isIdentity, d._isIdentityDirty, d._isIdentity3x2, d._isIdentity3x2Dirty), this;
+ }, v.prototype.copyToArray = function(h, d) {
+ d === void 0 && (d = 0);
+ var b = this._m;
+ return h[d] = b[0], h[d + 1] = b[1], h[d + 2] = b[2], h[d + 3] = b[3], h[d + 4] = b[4], h[d + 5] = b[5], h[d + 6] = b[6], h[d + 7] = b[7], h[d + 8] = b[8], h[d + 9] = b[9], h[d + 10] = b[10], h[d + 11] = b[11], h[d + 12] = b[12], h[d + 13] = b[13], h[d + 14] = b[14], h[d + 15] = b[15], this;
+ }, v.prototype.multiplyToRef = function(h, d) {
+ return this._isIdentity ? (d.copyFrom(h), this) : h._isIdentity ? (d.copyFrom(this), this) : (this.multiplyToArray(h, d._m, 0), d._markAsUpdated(), this);
+ }, v.prototype.multiplyToArray = function(h, d, b) {
+ var T = this._m, N = h.m, U = T[0], B = T[1], L = T[2], j = T[3], W = T[4], Y = T[5], oe = T[6], te = T[7], _e = T[8], de = T[9], ae = T[10], ie = T[11], Z = T[12], ee = T[13], w = T[14], z = T[15], q = N[0], le = N[1], ce = N[2], J = N[3], H = N[4], X = N[5], ne = N[6], Q = N[7], $ = N[8], me = N[9], ye = N[10], be = N[11], ge = N[12], Te = N[13], Re = N[14], Se = N[15];
+ return d[b] = U * q + B * H + L * $ + j * ge, d[b + 1] = U * le + B * X + L * me + j * Te, d[b + 2] = U * ce + B * ne + L * ye + j * Re, d[b + 3] = U * J + B * Q + L * be + j * Se, d[b + 4] = W * q + Y * H + oe * $ + te * ge, d[b + 5] = W * le + Y * X + oe * me + te * Te, d[b + 6] = W * ce + Y * ne + oe * ye + te * Re, d[b + 7] = W * J + Y * Q + oe * be + te * Se, d[b + 8] = _e * q + de * H + ae * $ + ie * ge, d[b + 9] = _e * le + de * X + ae * me + ie * Te, d[b + 10] = _e * ce + de * ne + ae * ye + ie * Re, d[b + 11] = _e * J + de * Q + ae * be + ie * Se, d[b + 12] = Z * q + ee * H + w * $ + z * ge, d[b + 13] = Z * le + ee * X + w * me + z * Te, d[b + 14] = Z * ce + ee * ne + w * ye + z * Re, d[b + 15] = Z * J + ee * Q + w * be + z * Se, this;
+ }, v.prototype.equals = function(h) {
+ var d = h;
+ if (!d)
+ return !1;
+ if ((this._isIdentity || d._isIdentity) && !this._isIdentityDirty && !d._isIdentityDirty)
+ return this._isIdentity && d._isIdentity;
+ var b = this.m, T = d.m;
+ return b[0] === T[0] && b[1] === T[1] && b[2] === T[2] && b[3] === T[3] && b[4] === T[4] && b[5] === T[5] && b[6] === T[6] && b[7] === T[7] && b[8] === T[8] && b[9] === T[9] && b[10] === T[10] && b[11] === T[11] && b[12] === T[12] && b[13] === T[13] && b[14] === T[14] && b[15] === T[15];
+ }, v.prototype.clone = function() {
+ var h = new v();
+ return h.copyFrom(this), h;
+ }, v.prototype.getClassName = function() {
+ return "Matrix";
+ }, v.prototype.getHashCode = function() {
+ for (var h = 0 | this._m[0], d = 1; d < 16; d++)
+ h = 397 * h ^ (0 | this._m[d]);
+ return h;
+ }, v.prototype.decompose = function(h, d, b) {
+ if (this._isIdentity)
+ return b && b.setAll(0), h && h.setAll(1), d && d.copyFromFloats(0, 0, 0, 1), !0;
+ var T = this._m;
+ if (b && b.copyFromFloats(T[12], T[13], T[14]), (h = h || A.Vector3[0]).x = Math.sqrt(T[0] * T[0] + T[1] * T[1] + T[2] * T[2]), h.y = Math.sqrt(T[4] * T[4] + T[5] * T[5] + T[6] * T[6]), h.z = Math.sqrt(T[8] * T[8] + T[9] * T[9] + T[10] * T[10]), this.determinant() <= 0 && (h.y *= -1), h._x === 0 || h._y === 0 || h._z === 0)
+ return d && d.copyFromFloats(0, 0, 0, 1), !1;
+ if (d) {
+ var N = 1 / h._x, U = 1 / h._y, B = 1 / h._z;
+ v.FromValuesToRef(T[0] * N, T[1] * N, T[2] * N, 0, T[4] * U, T[5] * U, T[6] * U, 0, T[8] * B, T[9] * B, T[10] * B, 0, 0, 0, 0, 1, A.Matrix[0]), u.FromRotationMatrixToRef(A.Matrix[0], d);
+ }
+ return !0;
+ }, v.prototype.getRow = function(h) {
+ if (h < 0 || h > 3)
+ return null;
+ var d = 4 * h;
+ return new g(this._m[d + 0], this._m[d + 1], this._m[d + 2], this._m[d + 3]);
+ }, v.prototype.setRow = function(h, d) {
+ return this.setRowFromFloats(h, d.x, d.y, d.z, d.w);
+ }, v.prototype.transpose = function() {
+ return v.Transpose(this);
+ }, v.prototype.transposeToRef = function(h) {
+ return v.TransposeToRef(this, h), this;
+ }, v.prototype.setRowFromFloats = function(h, d, b, T, N) {
+ if (h < 0 || h > 3)
+ return this;
+ var U = 4 * h;
+ return this._m[U + 0] = d, this._m[U + 1] = b, this._m[U + 2] = T, this._m[U + 3] = N, this._markAsUpdated(), this;
+ }, v.prototype.scale = function(h) {
+ var d = new v();
+ return this.scaleToRef(h, d), d;
+ }, v.prototype.scaleToRef = function(h, d) {
+ for (var b = 0; b < 16; b++)
+ d._m[b] = this._m[b] * h;
+ return d._markAsUpdated(), this;
+ }, v.prototype.scaleAndAddToRef = function(h, d) {
+ for (var b = 0; b < 16; b++)
+ d._m[b] += this._m[b] * h;
+ return d._markAsUpdated(), this;
+ }, v.prototype.toNormalMatrix = function(h) {
+ var d = A.Matrix[0];
+ this.invertToRef(d), d.transposeToRef(h);
+ var b = h._m;
+ v.FromValuesToRef(b[0], b[1], b[2], 0, b[4], b[5], b[6], 0, b[8], b[9], b[10], 0, 0, 0, 0, 1, h);
+ }, v.prototype.getRotationMatrix = function() {
+ var h = new v();
+ return this.getRotationMatrixToRef(h), h;
+ }, v.prototype.getRotationMatrixToRef = function(h) {
+ var d = A.Vector3[0];
+ if (!this.decompose(d))
+ return v.IdentityToRef(h), this;
+ var b = this._m, T = 1 / d._x, N = 1 / d._y, U = 1 / d._z;
+ return v.FromValuesToRef(b[0] * T, b[1] * T, b[2] * T, 0, b[4] * N, b[5] * N, b[6] * N, 0, b[8] * U, b[9] * U, b[10] * U, 0, 0, 0, 0, 1, h), this;
+ }, v.prototype.toggleModelMatrixHandInPlace = function() {
+ var h = this._m;
+ h[2] *= -1, h[6] *= -1, h[8] *= -1, h[9] *= -1, h[14] *= -1, this._markAsUpdated();
+ }, v.prototype.toggleProjectionMatrixHandInPlace = function() {
+ var h = this._m;
+ h[8] *= -1, h[9] *= -1, h[10] *= -1, h[11] *= -1, this._markAsUpdated();
+ }, v.FromArray = function(h, d) {
+ d === void 0 && (d = 0);
+ var b = new v();
+ return v.FromArrayToRef(h, d, b), b;
+ }, v.FromArrayToRef = function(h, d, b) {
+ for (var T = 0; T < 16; T++)
+ b._m[T] = h[T + d];
+ b._markAsUpdated();
+ }, v.FromFloat32ArrayToRefScaled = function(h, d, b, T) {
+ for (var N = 0; N < 16; N++)
+ T._m[N] = h[N + d] * b;
+ T._markAsUpdated();
+ }, Object.defineProperty(v, "IdentityReadOnly", { get: function() {
+ return v._identityReadOnly;
+ }, enumerable: !1, configurable: !0 }), v.FromValuesToRef = function(h, d, b, T, N, U, B, L, j, W, Y, oe, te, _e, de, ae, ie) {
+ var Z = ie._m;
+ Z[0] = h, Z[1] = d, Z[2] = b, Z[3] = T, Z[4] = N, Z[5] = U, Z[6] = B, Z[7] = L, Z[8] = j, Z[9] = W, Z[10] = Y, Z[11] = oe, Z[12] = te, Z[13] = _e, Z[14] = de, Z[15] = ae, ie._markAsUpdated();
+ }, v.FromValues = function(h, d, b, T, N, U, B, L, j, W, Y, oe, te, _e, de, ae) {
+ var ie = new v(), Z = ie._m;
+ return Z[0] = h, Z[1] = d, Z[2] = b, Z[3] = T, Z[4] = N, Z[5] = U, Z[6] = B, Z[7] = L, Z[8] = j, Z[9] = W, Z[10] = Y, Z[11] = oe, Z[12] = te, Z[13] = _e, Z[14] = de, Z[15] = ae, ie._markAsUpdated(), ie;
+ }, v.Compose = function(h, d, b) {
+ var T = new v();
+ return v.ComposeToRef(h, d, b, T), T;
+ }, v.ComposeToRef = function(h, d, b, T) {
+ var N = T._m, U = d._x, B = d._y, L = d._z, j = d._w, W = U + U, Y = B + B, oe = L + L, te = U * W, _e = U * Y, de = U * oe, ae = B * Y, ie = B * oe, Z = L * oe, ee = j * W, w = j * Y, z = j * oe, q = h._x, le = h._y, ce = h._z;
+ N[0] = (1 - (ae + Z)) * q, N[1] = (_e + z) * q, N[2] = (de - w) * q, N[3] = 0, N[4] = (_e - z) * le, N[5] = (1 - (te + Z)) * le, N[6] = (ie + ee) * le, N[7] = 0, N[8] = (de + w) * ce, N[9] = (ie - ee) * ce, N[10] = (1 - (te + ae)) * ce, N[11] = 0, N[12] = b._x, N[13] = b._y, N[14] = b._z, N[15] = 1, T._markAsUpdated();
+ }, v.Identity = function() {
+ var h = v.FromValues(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
+ return h._updateIdentityStatus(!0), h;
+ }, v.IdentityToRef = function(h) {
+ v.FromValuesToRef(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, h), h._updateIdentityStatus(!0);
+ }, v.Zero = function() {
+ var h = v.FromValues(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+ return h._updateIdentityStatus(!1), h;
+ }, v.RotationX = function(h) {
+ var d = new v();
+ return v.RotationXToRef(h, d), d;
+ }, v.Invert = function(h) {
+ var d = new v();
+ return h.invertToRef(d), d;
+ }, v.RotationXToRef = function(h, d) {
+ var b = Math.sin(h), T = Math.cos(h);
+ v.FromValuesToRef(1, 0, 0, 0, 0, T, b, 0, 0, -b, T, 0, 0, 0, 0, 1, d), d._updateIdentityStatus(T === 1 && b === 0);
+ }, v.RotationY = function(h) {
+ var d = new v();
+ return v.RotationYToRef(h, d), d;
+ }, v.RotationYToRef = function(h, d) {
+ var b = Math.sin(h), T = Math.cos(h);
+ v.FromValuesToRef(T, 0, -b, 0, 0, 1, 0, 0, b, 0, T, 0, 0, 0, 0, 1, d), d._updateIdentityStatus(T === 1 && b === 0);
+ }, v.RotationZ = function(h) {
+ var d = new v();
+ return v.RotationZToRef(h, d), d;
+ }, v.RotationZToRef = function(h, d) {
+ var b = Math.sin(h), T = Math.cos(h);
+ v.FromValuesToRef(T, b, 0, 0, -b, T, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, d), d._updateIdentityStatus(T === 1 && b === 0);
+ }, v.RotationAxis = function(h, d) {
+ var b = new v();
+ return v.RotationAxisToRef(h, d, b), b;
+ }, v.RotationAxisToRef = function(h, d, b) {
+ var T = Math.sin(-d), N = Math.cos(-d), U = 1 - N;
+ h.normalize();
+ var B = b._m;
+ B[0] = h._x * h._x * U + N, B[1] = h._x * h._y * U - h._z * T, B[2] = h._x * h._z * U + h._y * T, B[3] = 0, B[4] = h._y * h._x * U + h._z * T, B[5] = h._y * h._y * U + N, B[6] = h._y * h._z * U - h._x * T, B[7] = 0, B[8] = h._z * h._x * U - h._y * T, B[9] = h._z * h._y * U + h._x * T, B[10] = h._z * h._z * U + N, B[11] = 0, B[12] = 0, B[13] = 0, B[14] = 0, B[15] = 1, b._markAsUpdated();
+ }, v.RotationAlignToRef = function(h, d, b) {
+ var T = R.Cross(d, h), N = R.Dot(d, h), U = 1 / (1 + N), B = b._m;
+ B[0] = T._x * T._x * U + N, B[1] = T._y * T._x * U - T._z, B[2] = T._z * T._x * U + T._y, B[3] = 0, B[4] = T._x * T._y * U + T._z, B[5] = T._y * T._y * U + N, B[6] = T._z * T._y * U - T._x, B[7] = 0, B[8] = T._x * T._z * U - T._y, B[9] = T._y * T._z * U + T._x, B[10] = T._z * T._z * U + N, B[11] = 0, B[12] = 0, B[13] = 0, B[14] = 0, B[15] = 1, b._markAsUpdated();
+ }, v.RotationYawPitchRoll = function(h, d, b) {
+ var T = new v();
+ return v.RotationYawPitchRollToRef(h, d, b, T), T;
+ }, v.RotationYawPitchRollToRef = function(h, d, b, T) {
+ u.RotationYawPitchRollToRef(h, d, b, A.Quaternion[0]), A.Quaternion[0].toRotationMatrix(T);
+ }, v.Scaling = function(h, d, b) {
+ var T = new v();
+ return v.ScalingToRef(h, d, b, T), T;
+ }, v.ScalingToRef = function(h, d, b, T) {
+ v.FromValuesToRef(h, 0, 0, 0, 0, d, 0, 0, 0, 0, b, 0, 0, 0, 0, 1, T), T._updateIdentityStatus(h === 1 && d === 1 && b === 1);
+ }, v.Translation = function(h, d, b) {
+ var T = new v();
+ return v.TranslationToRef(h, d, b, T), T;
+ }, v.TranslationToRef = function(h, d, b, T) {
+ v.FromValuesToRef(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, h, d, b, 1, T), T._updateIdentityStatus(h === 0 && d === 0 && b === 0);
+ }, v.Lerp = function(h, d, b) {
+ var T = new v();
+ return v.LerpToRef(h, d, b, T), T;
+ }, v.LerpToRef = function(h, d, b, T) {
+ for (var N = T._m, U = h.m, B = d.m, L = 0; L < 16; L++)
+ N[L] = U[L] * (1 - b) + B[L] * b;
+ T._markAsUpdated();
+ }, v.DecomposeLerp = function(h, d, b) {
+ var T = new v();
+ return v.DecomposeLerpToRef(h, d, b, T), T;
+ }, v.DecomposeLerpToRef = function(h, d, b, T) {
+ var N = A.Vector3[0], U = A.Quaternion[0], B = A.Vector3[1];
+ h.decompose(N, U, B);
+ var L = A.Vector3[2], j = A.Quaternion[1], W = A.Vector3[3];
+ d.decompose(L, j, W);
+ var Y = A.Vector3[4];
+ R.LerpToRef(N, L, b, Y);
+ var oe = A.Quaternion[2];
+ u.SlerpToRef(U, j, b, oe);
+ var te = A.Vector3[5];
+ R.LerpToRef(B, W, b, te), v.ComposeToRef(Y, oe, te, T);
+ }, v.LookAtLH = function(h, d, b) {
+ var T = new v();
+ return v.LookAtLHToRef(h, d, b, T), T;
+ }, v.LookAtLHToRef = function(h, d, b, T) {
+ var N = A.Vector3[0], U = A.Vector3[1], B = A.Vector3[2];
+ d.subtractToRef(h, B), B.normalize(), R.CrossToRef(b, B, N);
+ var L = N.lengthSquared();
+ L === 0 ? N.x = 1 : N.normalizeFromLength(Math.sqrt(L)), R.CrossToRef(B, N, U), U.normalize();
+ var j = -R.Dot(N, h), W = -R.Dot(U, h), Y = -R.Dot(B, h);
+ v.FromValuesToRef(N._x, U._x, B._x, 0, N._y, U._y, B._y, 0, N._z, U._z, B._z, 0, j, W, Y, 1, T);
+ }, v.LookAtRH = function(h, d, b) {
+ var T = new v();
+ return v.LookAtRHToRef(h, d, b, T), T;
+ }, v.LookAtRHToRef = function(h, d, b, T) {
+ var N = A.Vector3[0], U = A.Vector3[1], B = A.Vector3[2];
+ h.subtractToRef(d, B), B.normalize(), R.CrossToRef(b, B, N);
+ var L = N.lengthSquared();
+ L === 0 ? N.x = 1 : N.normalizeFromLength(Math.sqrt(L)), R.CrossToRef(B, N, U), U.normalize();
+ var j = -R.Dot(N, h), W = -R.Dot(U, h), Y = -R.Dot(B, h);
+ v.FromValuesToRef(N._x, U._x, B._x, 0, N._y, U._y, B._y, 0, N._z, U._z, B._z, 0, j, W, Y, 1, T);
+ }, v.OrthoLH = function(h, d, b, T) {
+ var N = new v();
+ return v.OrthoLHToRef(h, d, b, T, N), N;
+ }, v.OrthoLHToRef = function(h, d, b, T, N) {
+ var U = 2 / h, B = 2 / d, L = 2 / (T - b), j = -(T + b) / (T - b);
+ v.FromValuesToRef(U, 0, 0, 0, 0, B, 0, 0, 0, 0, L, 0, 0, 0, j, 1, N), N._updateIdentityStatus(U === 1 && B === 1 && L === 1 && j === 0);
+ }, v.OrthoOffCenterLH = function(h, d, b, T, N, U) {
+ var B = new v();
+ return v.OrthoOffCenterLHToRef(h, d, b, T, N, U, B), B;
+ }, v.OrthoOffCenterLHToRef = function(h, d, b, T, N, U, B) {
+ var L = 2 / (d - h), j = 2 / (T - b), W = 2 / (U - N), Y = -(U + N) / (U - N), oe = (h + d) / (h - d), te = (T + b) / (b - T);
+ v.FromValuesToRef(L, 0, 0, 0, 0, j, 0, 0, 0, 0, W, 0, oe, te, Y, 1, B), B._markAsUpdated();
+ }, v.OrthoOffCenterRH = function(h, d, b, T, N, U) {
+ var B = new v();
+ return v.OrthoOffCenterRHToRef(h, d, b, T, N, U, B), B;
+ }, v.OrthoOffCenterRHToRef = function(h, d, b, T, N, U, B) {
+ v.OrthoOffCenterLHToRef(h, d, b, T, N, U, B), B._m[10] *= -1;
+ }, v.PerspectiveLH = function(h, d, b, T) {
+ var N = new v(), U = 2 * b / h, B = 2 * b / d, L = (T + b) / (T - b), j = -2 * T * b / (T - b);
+ return v.FromValuesToRef(U, 0, 0, 0, 0, B, 0, 0, 0, 0, L, 1, 0, 0, j, 0, N), N._updateIdentityStatus(!1), N;
+ }, v.PerspectiveFovLH = function(h, d, b, T) {
+ var N = new v();
+ return v.PerspectiveFovLHToRef(h, d, b, T, N), N;
+ }, v.PerspectiveFovLHToRef = function(h, d, b, T, N, U) {
+ U === void 0 && (U = !0);
+ var B = b, L = T, j = 1 / Math.tan(0.5 * h), W = U ? j / d : j, Y = U ? j : j * d, oe = (L + B) / (L - B), te = -2 * L * B / (L - B);
+ v.FromValuesToRef(W, 0, 0, 0, 0, Y, 0, 0, 0, 0, oe, 1, 0, 0, te, 0, N), N._updateIdentityStatus(!1);
+ }, v.PerspectiveFovReverseLHToRef = function(h, d, b, T, N, U) {
+ U === void 0 && (U = !0);
+ var B = 1 / Math.tan(0.5 * h), L = U ? B / d : B, j = U ? B : B * d;
+ v.FromValuesToRef(L, 0, 0, 0, 0, j, 0, 0, 0, 0, -b, 1, 0, 0, 1, 0, N), N._updateIdentityStatus(!1);
+ }, v.PerspectiveFovRH = function(h, d, b, T) {
+ var N = new v();
+ return v.PerspectiveFovRHToRef(h, d, b, T, N), N;
+ }, v.PerspectiveFovRHToRef = function(h, d, b, T, N, U) {
+ U === void 0 && (U = !0);
+ var B = b, L = T, j = 1 / Math.tan(0.5 * h), W = U ? j / d : j, Y = U ? j : j * d, oe = -(L + B) / (L - B), te = -2 * L * B / (L - B);
+ v.FromValuesToRef(W, 0, 0, 0, 0, Y, 0, 0, 0, 0, oe, -1, 0, 0, te, 0, N), N._updateIdentityStatus(!1);
+ }, v.PerspectiveFovReverseRHToRef = function(h, d, b, T, N, U) {
+ U === void 0 && (U = !0);
+ var B = 1 / Math.tan(0.5 * h), L = U ? B / d : B, j = U ? B : B * d;
+ v.FromValuesToRef(L, 0, 0, 0, 0, j, 0, 0, 0, 0, -b, -1, 0, 0, -1, 0, N), N._updateIdentityStatus(!1);
+ }, v.PerspectiveFovWebVRToRef = function(h, d, b, T, N) {
+ N === void 0 && (N = !1);
+ var U = N ? -1 : 1, B = Math.tan(h.upDegrees * Math.PI / 180), L = Math.tan(h.downDegrees * Math.PI / 180), j = Math.tan(h.leftDegrees * Math.PI / 180), W = Math.tan(h.rightDegrees * Math.PI / 180), Y = 2 / (j + W), oe = 2 / (B + L), te = T._m;
+ te[0] = Y, te[1] = te[2] = te[3] = te[4] = 0, te[5] = oe, te[6] = te[7] = 0, te[8] = (j - W) * Y * 0.5, te[9] = -(B - L) * oe * 0.5, te[10] = -b / (d - b), te[11] = 1 * U, te[12] = te[13] = te[15] = 0, te[14] = -2 * b * d / (b - d), T._markAsUpdated();
+ }, v.GetFinalMatrix = function(h, d, b, T, N, U) {
+ var B = h.width, L = h.height, j = h.x, W = h.y, Y = v.FromValues(B / 2, 0, 0, 0, 0, -L / 2, 0, 0, 0, 0, U - N, 0, j + B / 2, L / 2 + W, N, 1), oe = A.Matrix[0];
+ return d.multiplyToRef(b, oe), oe.multiplyToRef(T, oe), oe.multiply(Y);
+ }, v.GetAsMatrix2x2 = function(h) {
+ var d = h.m, b = [d[0], d[1], d[4], d[5]];
+ return C.a.MatrixUse64Bits ? b : new Float32Array(b);
+ }, v.GetAsMatrix3x3 = function(h) {
+ var d = h.m, b = [d[0], d[1], d[2], d[4], d[5], d[6], d[8], d[9], d[10]];
+ return C.a.MatrixUse64Bits ? b : new Float32Array(b);
+ }, v.Transpose = function(h) {
+ var d = new v();
+ return v.TransposeToRef(h, d), d;
+ }, v.TransposeToRef = function(h, d) {
+ var b = d._m, T = h.m;
+ b[0] = T[0], b[1] = T[4], b[2] = T[8], b[3] = T[12], b[4] = T[1], b[5] = T[5], b[6] = T[9], b[7] = T[13], b[8] = T[2], b[9] = T[6], b[10] = T[10], b[11] = T[14], b[12] = T[3], b[13] = T[7], b[14] = T[11], b[15] = T[15], d._updateIdentityStatus(h._isIdentity, h._isIdentityDirty);
+ }, v.Reflection = function(h) {
+ var d = new v();
+ return v.ReflectionToRef(h, d), d;
+ }, v.ReflectionToRef = function(h, d) {
+ h.normalize();
+ var b = h.normal.x, T = h.normal.y, N = h.normal.z, U = -2 * b, B = -2 * T, L = -2 * N;
+ v.FromValuesToRef(U * b + 1, B * b, L * b, 0, U * T, B * T + 1, L * T, 0, U * N, B * N, L * N + 1, 0, U * h.d, B * h.d, L * h.d, 1, d);
+ }, v.FromXYZAxesToRef = function(h, d, b, T) {
+ v.FromValuesToRef(h._x, h._y, h._z, 0, d._x, d._y, d._z, 0, b._x, b._y, b._z, 0, 0, 0, 0, 1, T);
+ }, v.FromQuaternionToRef = function(h, d) {
+ var b = h._x * h._x, T = h._y * h._y, N = h._z * h._z, U = h._x * h._y, B = h._z * h._w, L = h._z * h._x, j = h._y * h._w, W = h._y * h._z, Y = h._x * h._w;
+ d._m[0] = 1 - 2 * (T + N), d._m[1] = 2 * (U + B), d._m[2] = 2 * (L - j), d._m[3] = 0, d._m[4] = 2 * (U - B), d._m[5] = 1 - 2 * (N + b), d._m[6] = 2 * (W + Y), d._m[7] = 0, d._m[8] = 2 * (L + j), d._m[9] = 2 * (W - Y), d._m[10] = 1 - 2 * (T + b), d._m[11] = 0, d._m[12] = 0, d._m[13] = 0, d._m[14] = 0, d._m[15] = 1, d._markAsUpdated();
+ }, v._updateFlagSeed = 0, v._identityReadOnly = v.Identity(), v;
+ }(), A = function() {
+ function v() {
+ }
+ return v.Vector3 = P.a.BuildArray(6, R.Zero), v.Matrix = P.a.BuildArray(2, E.Identity), v.Quaternion = P.a.BuildArray(3, u.Zero), v;
+ }(), y = function() {
+ function v() {
+ }
+ return v.Vector2 = P.a.BuildArray(3, x.Zero), v.Vector3 = P.a.BuildArray(13, R.Zero), v.Vector4 = P.a.BuildArray(3, g.Zero), v.Quaternion = P.a.BuildArray(2, u.Zero), v.Matrix = P.a.BuildArray(8, E.Identity), v;
+ }();
+ c.a.RegisteredTypes["BABYLON.Vector2"] = x, c.a.RegisteredTypes["BABYLON.Vector3"] = R, c.a.RegisteredTypes["BABYLON.Vector4"] = g, c.a.RegisteredTypes["BABYLON.Matrix"] = E;
+ }, function(V, _, l) {
+ l.d(_, "d", function() {
+ return f;
+ }), l.d(_, "a", function() {
+ return P;
+ }), l.d(_, "c", function() {
+ return c;
+ }), l.d(_, "b", function() {
+ return C;
+ }), l.d(_, "e", function() {
+ return x;
+ }), l.d(_, "f", function() {
+ return R;
+ });
+ /*! *****************************************************************************
+ Copyright (c) Microsoft Corporation.
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ PERFORMANCE OF THIS SOFTWARE.
+ ***************************************************************************** */
+ var D = function(g, u) {
+ return (D = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(E, A) {
+ E.__proto__ = A;
+ } || function(E, A) {
+ for (var y in A)
+ Object.prototype.hasOwnProperty.call(A, y) && (E[y] = A[y]);
+ })(g, u);
+ };
+ function f(g, u) {
+ if (typeof u != "function" && u !== null)
+ throw new TypeError("Class extends value " + String(u) + " is not a constructor or null");
+ function E() {
+ this.constructor = g;
+ }
+ D(g, u), g.prototype = u === null ? Object.create(u) : (E.prototype = u.prototype, new E());
+ }
+ var P = function() {
+ return (P = Object.assign || function(g) {
+ for (var u, E = 1, A = arguments.length; E < A; E++)
+ for (var y in u = arguments[E])
+ Object.prototype.hasOwnProperty.call(u, y) && (g[y] = u[y]);
+ return g;
+ }).apply(this, arguments);
+ };
+ function c(g, u, E, A) {
+ var y, v = arguments.length, h = v < 3 ? u : A === null ? A = Object.getOwnPropertyDescriptor(u, E) : A;
+ if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
+ h = Reflect.decorate(g, u, E, A);
+ else
+ for (var d = g.length - 1; d >= 0; d--)
+ (y = g[d]) && (h = (v < 3 ? y(h) : v > 3 ? y(u, E, h) : y(u, E)) || h);
+ return v > 3 && h && Object.defineProperty(u, E, h), h;
+ }
+ function C(g, u, E, A) {
+ return new (E || (E = Promise))(function(y, v) {
+ function h(T) {
+ try {
+ b(A.next(T));
+ } catch (N) {
+ v(N);
+ }
+ }
+ function d(T) {
+ try {
+ b(A.throw(T));
+ } catch (N) {
+ v(N);
+ }
+ }
+ function b(T) {
+ var N;
+ T.done ? y(T.value) : (N = T.value, N instanceof E ? N : new E(function(U) {
+ U(N);
+ })).then(h, d);
+ }
+ b((A = A.apply(g, u || [])).next());
+ });
+ }
+ function x(g, u) {
+ var E, A, y, v, h = { label: 0, sent: function() {
+ if (1 & y[0])
+ throw y[1];
+ return y[1];
+ }, trys: [], ops: [] };
+ return v = { next: d(0), throw: d(1), return: d(2) }, typeof Symbol == "function" && (v[Symbol.iterator] = function() {
+ return this;
+ }), v;
+ function d(b) {
+ return function(T) {
+ return function(N) {
+ if (E)
+ throw new TypeError("Generator is already executing.");
+ for (; h; )
+ try {
+ if (E = 1, A && (y = 2 & N[0] ? A.return : N[0] ? A.throw || ((y = A.return) && y.call(A), 0) : A.next) && !(y = y.call(A, N[1])).done)
+ return y;
+ switch (A = 0, y && (N = [2 & N[0], y.value]), N[0]) {
+ case 0:
+ case 1:
+ y = N;
+ break;
+ case 4:
+ return h.label++, { value: N[1], done: !1 };
+ case 5:
+ h.label++, A = N[1], N = [0];
+ continue;
+ case 7:
+ N = h.ops.pop(), h.trys.pop();
+ continue;
+ default:
+ if (y = h.trys, !((y = y.length > 0 && y[y.length - 1]) || N[0] !== 6 && N[0] !== 2)) {
+ h = 0;
+ continue;
+ }
+ if (N[0] === 3 && (!y || N[1] > y[0] && N[1] < y[3])) {
+ h.label = N[1];
+ break;
+ }
+ if (N[0] === 6 && h.label < y[1]) {
+ h.label = y[1], y = N;
+ break;
+ }
+ if (y && h.label < y[2]) {
+ h.label = y[2], h.ops.push(N);
+ break;
+ }
+ y[2] && h.ops.pop(), h.trys.pop();
+ continue;
+ }
+ N = u.call(g, h);
+ } catch (U) {
+ N = [6, U], A = 0;
+ } finally {
+ E = y = 0;
+ }
+ if (5 & N[0])
+ throw N[1];
+ return { value: N[0] ? N[1] : void 0, done: !0 };
+ }([b, T]);
+ };
+ }
+ }
+ function R() {
+ for (var g = 0, u = 0, E = arguments.length; u < E; u++)
+ g += arguments[u].length;
+ var A = Array(g), y = 0;
+ for (u = 0; u < E; u++)
+ for (var v = arguments[u], h = 0, d = v.length; h < d; h++, y++)
+ A[y] = v[h];
+ return A;
+ }
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ function f() {
+ }
+ return f.ALPHA_DISABLE = 0, f.ALPHA_ADD = 1, f.ALPHA_COMBINE = 2, f.ALPHA_SUBTRACT = 3, f.ALPHA_MULTIPLY = 4, f.ALPHA_MAXIMIZED = 5, f.ALPHA_ONEONE = 6, f.ALPHA_PREMULTIPLIED = 7, f.ALPHA_PREMULTIPLIED_PORTERDUFF = 8, f.ALPHA_INTERPOLATE = 9, f.ALPHA_SCREENMODE = 10, f.ALPHA_ONEONE_ONEONE = 11, f.ALPHA_ALPHATOCOLOR = 12, f.ALPHA_REVERSEONEMINUS = 13, f.ALPHA_SRC_DSTONEMINUSSRCALPHA = 14, f.ALPHA_ONEONE_ONEZERO = 15, f.ALPHA_EXCLUSION = 16, f.ALPHA_EQUATION_ADD = 0, f.ALPHA_EQUATION_SUBSTRACT = 1, f.ALPHA_EQUATION_REVERSE_SUBTRACT = 2, f.ALPHA_EQUATION_MAX = 3, f.ALPHA_EQUATION_MIN = 4, f.ALPHA_EQUATION_DARKEN = 5, f.DELAYLOADSTATE_NONE = 0, f.DELAYLOADSTATE_LOADED = 1, f.DELAYLOADSTATE_LOADING = 2, f.DELAYLOADSTATE_NOTLOADED = 4, f.NEVER = 512, f.ALWAYS = 519, f.LESS = 513, f.EQUAL = 514, f.LEQUAL = 515, f.GREATER = 516, f.GEQUAL = 518, f.NOTEQUAL = 517, f.KEEP = 7680, f.REPLACE = 7681, f.INCR = 7682, f.DECR = 7683, f.INVERT = 5386, f.INCR_WRAP = 34055, f.DECR_WRAP = 34056, f.TEXTURE_CLAMP_ADDRESSMODE = 0, f.TEXTURE_WRAP_ADDRESSMODE = 1, f.TEXTURE_MIRROR_ADDRESSMODE = 2, f.TEXTUREFORMAT_ALPHA = 0, f.TEXTUREFORMAT_LUMINANCE = 1, f.TEXTUREFORMAT_LUMINANCE_ALPHA = 2, f.TEXTUREFORMAT_RGB = 4, f.TEXTUREFORMAT_RGBA = 5, f.TEXTUREFORMAT_RED = 6, f.TEXTUREFORMAT_R = 6, f.TEXTUREFORMAT_RG = 7, f.TEXTUREFORMAT_RED_INTEGER = 8, f.TEXTUREFORMAT_R_INTEGER = 8, f.TEXTUREFORMAT_RG_INTEGER = 9, f.TEXTUREFORMAT_RGB_INTEGER = 10, f.TEXTUREFORMAT_RGBA_INTEGER = 11, f.TEXTURETYPE_UNSIGNED_BYTE = 0, f.TEXTURETYPE_UNSIGNED_INT = 0, f.TEXTURETYPE_FLOAT = 1, f.TEXTURETYPE_HALF_FLOAT = 2, f.TEXTURETYPE_BYTE = 3, f.TEXTURETYPE_SHORT = 4, f.TEXTURETYPE_UNSIGNED_SHORT = 5, f.TEXTURETYPE_INT = 6, f.TEXTURETYPE_UNSIGNED_INTEGER = 7, f.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 = 8, f.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 = 9, f.TEXTURETYPE_UNSIGNED_SHORT_5_6_5 = 10, f.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV = 11, f.TEXTURETYPE_UNSIGNED_INT_24_8 = 12, f.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV = 13, f.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV = 14, f.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV = 15, f.TEXTURE_NEAREST_SAMPLINGMODE = 1, f.TEXTURE_NEAREST_NEAREST = 1, f.TEXTURE_BILINEAR_SAMPLINGMODE = 2, f.TEXTURE_LINEAR_LINEAR = 2, f.TEXTURE_TRILINEAR_SAMPLINGMODE = 3, f.TEXTURE_LINEAR_LINEAR_MIPLINEAR = 3, f.TEXTURE_NEAREST_NEAREST_MIPNEAREST = 4, f.TEXTURE_NEAREST_LINEAR_MIPNEAREST = 5, f.TEXTURE_NEAREST_LINEAR_MIPLINEAR = 6, f.TEXTURE_NEAREST_LINEAR = 7, f.TEXTURE_NEAREST_NEAREST_MIPLINEAR = 8, f.TEXTURE_LINEAR_NEAREST_MIPNEAREST = 9, f.TEXTURE_LINEAR_NEAREST_MIPLINEAR = 10, f.TEXTURE_LINEAR_LINEAR_MIPNEAREST = 11, f.TEXTURE_LINEAR_NEAREST = 12, f.TEXTURE_EXPLICIT_MODE = 0, f.TEXTURE_SPHERICAL_MODE = 1, f.TEXTURE_PLANAR_MODE = 2, f.TEXTURE_CUBIC_MODE = 3, f.TEXTURE_PROJECTION_MODE = 4, f.TEXTURE_SKYBOX_MODE = 5, f.TEXTURE_INVCUBIC_MODE = 6, f.TEXTURE_EQUIRECTANGULAR_MODE = 7, f.TEXTURE_FIXED_EQUIRECTANGULAR_MODE = 8, f.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE = 9, f.TEXTURE_FILTERING_QUALITY_OFFLINE = 4096, f.TEXTURE_FILTERING_QUALITY_HIGH = 64, f.TEXTURE_FILTERING_QUALITY_MEDIUM = 16, f.TEXTURE_FILTERING_QUALITY_LOW = 8, f.SCALEMODE_FLOOR = 1, f.SCALEMODE_NEAREST = 2, f.SCALEMODE_CEILING = 3, f.MATERIAL_TextureDirtyFlag = 1, f.MATERIAL_LightDirtyFlag = 2, f.MATERIAL_FresnelDirtyFlag = 4, f.MATERIAL_AttributesDirtyFlag = 8, f.MATERIAL_MiscDirtyFlag = 16, f.MATERIAL_PrePassDirtyFlag = 32, f.MATERIAL_AllDirtyFlag = 63, f.MATERIAL_TriangleFillMode = 0, f.MATERIAL_WireFrameFillMode = 1, f.MATERIAL_PointFillMode = 2, f.MATERIAL_PointListDrawMode = 3, f.MATERIAL_LineListDrawMode = 4, f.MATERIAL_LineLoopDrawMode = 5, f.MATERIAL_LineStripDrawMode = 6, f.MATERIAL_TriangleStripDrawMode = 7, f.MATERIAL_TriangleFanDrawMode = 8, f.MATERIAL_ClockWiseSideOrientation = 0, f.MATERIAL_CounterClockWiseSideOrientation = 1, f.ACTION_NothingTrigger = 0, f.ACTION_OnPickTrigger = 1, f.ACTION_OnLeftPickTrigger = 2, f.ACTION_OnRightPickTrigger = 3, f.ACTION_OnCenterPickTrigger = 4, f.ACTION_OnPickDownTrigger = 5, f.ACTION_OnDoublePickTrigger = 6, f.ACTION_OnPickUpTrigger = 7, f.ACTION_OnPickOutTrigger = 16, f.ACTION_OnLongPressTrigger = 8, f.ACTION_OnPointerOverTrigger = 9, f.ACTION_OnPointerOutTrigger = 10, f.ACTION_OnEveryFrameTrigger = 11, f.ACTION_OnIntersectionEnterTrigger = 12, f.ACTION_OnIntersectionExitTrigger = 13, f.ACTION_OnKeyDownTrigger = 14, f.ACTION_OnKeyUpTrigger = 15, f.PARTICLES_BILLBOARDMODE_Y = 2, f.PARTICLES_BILLBOARDMODE_ALL = 7, f.PARTICLES_BILLBOARDMODE_STRETCHED = 8, f.MESHES_CULLINGSTRATEGY_STANDARD = 0, f.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY = 1, f.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION = 2, f.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY = 3, f.SCENELOADER_NO_LOGGING = 0, f.SCENELOADER_MINIMAL_LOGGING = 1, f.SCENELOADER_SUMMARY_LOGGING = 2, f.SCENELOADER_DETAILED_LOGGING = 3, f.PREPASS_IRRADIANCE_TEXTURE_TYPE = 0, f.PREPASS_POSITION_TEXTURE_TYPE = 1, f.PREPASS_VELOCITY_TEXTURE_TYPE = 2, f.PREPASS_REFLECTIVITY_TEXTURE_TYPE = 3, f.PREPASS_COLOR_TEXTURE_TYPE = 4, f.PREPASS_DEPTHNORMAL_TEXTURE_TYPE = 5, f.PREPASS_ALBEDO_TEXTURE_TYPE = 6, f;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "b", function() {
+ return E;
+ }), l.d(_, "c", function() {
+ return A;
+ }), l.d(_, "m", function() {
+ return y;
+ }), l.d(_, "e", function() {
+ return v;
+ }), l.d(_, "h", function() {
+ return h;
+ }), l.d(_, "n", function() {
+ return d;
+ }), l.d(_, "o", function() {
+ return b;
+ }), l.d(_, "k", function() {
+ return T;
+ }), l.d(_, "g", function() {
+ return N;
+ }), l.d(_, "f", function() {
+ return U;
+ }), l.d(_, "i", function() {
+ return B;
+ }), l.d(_, "l", function() {
+ return L;
+ }), l.d(_, "j", function() {
+ return j;
+ }), l.d(_, "d", function() {
+ return W;
+ }), l.d(_, "a", function() {
+ return Y;
+ });
+ var D = l(37), f = l(0), P = l(21), c = l(9), C = {}, x = {}, R = function(oe, te, _e) {
+ var de = oe();
+ D.a && D.a.AddTagsTo(de, te.tags);
+ var ae = g(de);
+ for (var ie in ae) {
+ var Z = ae[ie], ee = te[ie], w = Z.type;
+ if (ee != null && ie !== "uniqueId")
+ switch (w) {
+ case 0:
+ case 6:
+ case 11:
+ de[ie] = ee;
+ break;
+ case 1:
+ de[ie] = _e || ee.isRenderTarget ? ee : ee.clone();
+ break;
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 7:
+ case 10:
+ case 12:
+ de[ie] = _e ? ee : ee.clone();
+ }
+ }
+ return de;
+ };
+ function g(oe) {
+ var te = oe.getClassName();
+ if (x[te])
+ return x[te];
+ x[te] = {};
+ for (var _e = x[te], de = oe, ae = te; ae; ) {
+ var ie = C[ae];
+ for (var Z in ie)
+ _e[Z] = ie[Z];
+ var ee = void 0, w = !1;
+ do {
+ if (!(ee = Object.getPrototypeOf(de)).getClassName) {
+ w = !0;
+ break;
+ }
+ if (ee.getClassName() !== ae)
+ break;
+ de = ee;
+ } while (ee);
+ if (w)
+ break;
+ ae = ee.getClassName(), de = ee;
+ }
+ return _e;
+ }
+ function u(oe, te) {
+ return function(_e, de) {
+ var ae = function(ie) {
+ var Z = ie.getClassName();
+ return C[Z] || (C[Z] = {}), C[Z];
+ }(_e);
+ ae[de] || (ae[de] = { type: oe, sourceName: te });
+ };
+ }
+ function E(oe, te) {
+ return te === void 0 && (te = null), function(_e, de) {
+ return de === void 0 && (de = null), function(ae, ie) {
+ var Z = de || "_" + ie;
+ Object.defineProperty(ae, ie, { get: function() {
+ return this[Z];
+ }, set: function(ee) {
+ this[Z] !== ee && (this[Z] = ee, ae[_e].apply(this));
+ }, enumerable: !0, configurable: !0 });
+ };
+ }(oe, te);
+ }
+ function A(oe) {
+ return u(0, oe);
+ }
+ function y(oe) {
+ return u(1, oe);
+ }
+ function v(oe) {
+ return u(2, oe);
+ }
+ function h(oe) {
+ return u(3, oe);
+ }
+ function d(oe) {
+ return u(4, oe);
+ }
+ function b(oe) {
+ return u(5, oe);
+ }
+ function T(oe) {
+ return u(6, oe);
+ }
+ function N(oe) {
+ return u(7, oe);
+ }
+ function U(oe) {
+ return u(8, oe);
+ }
+ function B(oe) {
+ return u(9, oe);
+ }
+ function L(oe) {
+ return u(10, oe);
+ }
+ function j(oe) {
+ return u(12, oe);
+ }
+ function W(oe) {
+ return u(11, oe);
+ }
+ var Y = function() {
+ function oe() {
+ }
+ return oe.AppendSerializedAnimations = function(te, _e) {
+ if (te.animations) {
+ _e.animations = [];
+ for (var de = 0; de < te.animations.length; de++) {
+ var ae = te.animations[de];
+ _e.animations.push(ae.serialize());
+ }
+ }
+ }, oe.Serialize = function(te, _e) {
+ _e || (_e = {}), D.a && (_e.tags = D.a.GetTags(te));
+ var de = g(te);
+ for (var ae in de) {
+ var ie = de[ae], Z = ie.sourceName || ae, ee = ie.type, w = te[ae];
+ if (w != null && ae !== "uniqueId")
+ switch (ee) {
+ case 0:
+ _e[Z] = w;
+ break;
+ case 1:
+ _e[Z] = w.serialize();
+ break;
+ case 2:
+ _e[Z] = w.asArray();
+ break;
+ case 3:
+ _e[Z] = w.serialize();
+ break;
+ case 4:
+ case 5:
+ _e[Z] = w.asArray();
+ break;
+ case 6:
+ _e[Z] = w.id;
+ break;
+ case 7:
+ _e[Z] = w.serialize();
+ break;
+ case 8:
+ _e[Z] = w.asArray();
+ break;
+ case 9:
+ _e[Z] = w.serialize();
+ break;
+ case 10:
+ _e[Z] = w.asArray();
+ break;
+ case 11:
+ _e[Z] = w.id;
+ case 12:
+ _e[Z] = w.asArray();
+ }
+ }
+ return _e;
+ }, oe.Parse = function(te, _e, de, ae) {
+ ae === void 0 && (ae = null);
+ var ie = te();
+ ae || (ae = ""), D.a && D.a.AddTagsTo(ie, _e.tags);
+ var Z = g(ie);
+ for (var ee in Z) {
+ var w = Z[ee], z = _e[w.sourceName || ee], q = w.type;
+ if (z != null && ee !== "uniqueId") {
+ var le = ie;
+ switch (q) {
+ case 0:
+ le[ee] = z;
+ break;
+ case 1:
+ de && (le[ee] = oe._TextureParser(z, de, ae));
+ break;
+ case 2:
+ le[ee] = c.a.FromArray(z);
+ break;
+ case 3:
+ le[ee] = oe._FresnelParametersParser(z);
+ break;
+ case 4:
+ le[ee] = f.d.FromArray(z);
+ break;
+ case 5:
+ le[ee] = f.e.FromArray(z);
+ break;
+ case 6:
+ de && (le[ee] = de.getLastMeshByID(z));
+ break;
+ case 7:
+ le[ee] = oe._ColorCurvesParser(z);
+ break;
+ case 8:
+ le[ee] = c.b.FromArray(z);
+ break;
+ case 9:
+ le[ee] = oe._ImageProcessingConfigurationParser(z);
+ break;
+ case 10:
+ le[ee] = f.b.FromArray(z);
+ break;
+ case 11:
+ de && (le[ee] = de.getCameraByID(z));
+ case 12:
+ le[ee] = f.a.FromArray(z);
+ }
+ }
+ }
+ return ie;
+ }, oe.Clone = function(te, _e) {
+ return R(te, _e, !1);
+ }, oe.Instanciate = function(te, _e) {
+ return R(te, _e, !0);
+ }, oe._ImageProcessingConfigurationParser = function(te) {
+ throw P.a.WarnImport("ImageProcessingConfiguration");
+ }, oe._FresnelParametersParser = function(te) {
+ throw P.a.WarnImport("FresnelParameters");
+ }, oe._ColorCurvesParser = function(te) {
+ throw P.a.WarnImport("ColorCurves");
+ }, oe._TextureParser = function(te, _e, de) {
+ throw P.a.WarnImport("Texture");
+ }, oe;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ }), l.d(_, "b", function() {
+ return f;
+ });
+ var D = function() {
+ function P(c, C, x, R, g, u, E, A) {
+ R === void 0 && (R = 0), g === void 0 && (g = !1), u === void 0 && (u = !1), E === void 0 && (E = !1), this._isAlreadyOwned = !1, c.getScene ? this._engine = c.getScene().getEngine() : this._engine = c, this._updatable = x, this._instanced = u, this._divisor = A || 1, this._data = C, this.byteStride = E ? R : R * Float32Array.BYTES_PER_ELEMENT, g || this.create();
+ }
+ return P.prototype.createVertexBuffer = function(c, C, x, R, g, u, E) {
+ u === void 0 && (u = !1);
+ var A = u ? C : C * Float32Array.BYTES_PER_ELEMENT, y = R ? u ? R : R * Float32Array.BYTES_PER_ELEMENT : this.byteStride;
+ return new f(this._engine, this, c, this._updatable, !0, y, g === void 0 ? this._instanced : g, A, x, void 0, void 0, !0, this._divisor || E);
+ }, P.prototype.isUpdatable = function() {
+ return this._updatable;
+ }, P.prototype.getData = function() {
+ return this._data;
+ }, P.prototype.getBuffer = function() {
+ return this._buffer;
+ }, P.prototype.getStrideSize = function() {
+ return this.byteStride / Float32Array.BYTES_PER_ELEMENT;
+ }, P.prototype.create = function(c) {
+ c === void 0 && (c = null), !c && this._buffer || (c = c || this._data) && (this._buffer ? this._updatable && (this._engine.updateDynamicVertexBuffer(this._buffer, c), this._data = c) : this._updatable ? (this._buffer = this._engine.createDynamicVertexBuffer(c), this._data = c) : this._buffer = this._engine.createVertexBuffer(c));
+ }, P.prototype._rebuild = function() {
+ this._buffer = null, this.create(this._data);
+ }, P.prototype.update = function(c) {
+ this.create(c);
+ }, P.prototype.updateDirectly = function(c, C, x, R) {
+ R === void 0 && (R = !1), this._buffer && this._updatable && (this._engine.updateDynamicVertexBuffer(this._buffer, c, R ? C : C * Float32Array.BYTES_PER_ELEMENT, x ? x * this.byteStride : void 0), this._data = null);
+ }, P.prototype._increaseReferences = function() {
+ this._buffer && (this._isAlreadyOwned ? this._buffer.references++ : this._isAlreadyOwned = !0);
+ }, P.prototype.dispose = function() {
+ this._buffer && this._engine._releaseBuffer(this._buffer) && (this._buffer = null);
+ }, P;
+ }(), f = function() {
+ function P(c, C, x, R, g, u, E, A, y, v, h, d, b, T) {
+ if (h === void 0 && (h = !1), d === void 0 && (d = !1), b === void 0 && (b = 1), T === void 0 && (T = !1), C instanceof D ? (this._buffer = C, this._ownsBuffer = T, T && this._buffer._increaseReferences()) : (this._buffer = new D(c, C, R, u, g, E, d), this._ownsBuffer = !0), this._kind = x, v == null) {
+ var N = this.getData();
+ this.type = P.FLOAT, N instanceof Int8Array ? this.type = P.BYTE : N instanceof Uint8Array ? this.type = P.UNSIGNED_BYTE : N instanceof Int16Array ? this.type = P.SHORT : N instanceof Uint16Array ? this.type = P.UNSIGNED_SHORT : N instanceof Int32Array ? this.type = P.INT : N instanceof Uint32Array && (this.type = P.UNSIGNED_INT);
+ } else
+ this.type = v;
+ var U = P.GetTypeByteLength(this.type);
+ d ? (this._size = y || (u ? u / U : P.DeduceStride(x)), this.byteStride = u || this._buffer.byteStride || this._size * U, this.byteOffset = A || 0) : (this._size = y || u || P.DeduceStride(x), this.byteStride = u ? u * U : this._buffer.byteStride || this._size * U, this.byteOffset = (A || 0) * U), this.normalized = h, this._instanced = E !== void 0 && E, this._instanceDivisor = E ? b : 0;
+ }
+ return Object.defineProperty(P.prototype, "instanceDivisor", { get: function() {
+ return this._instanceDivisor;
+ }, set: function(c) {
+ this._instanceDivisor = c, this._instanced = c != 0;
+ }, enumerable: !1, configurable: !0 }), P.prototype._rebuild = function() {
+ this._buffer && this._buffer._rebuild();
+ }, P.prototype.getKind = function() {
+ return this._kind;
+ }, P.prototype.isUpdatable = function() {
+ return this._buffer.isUpdatable();
+ }, P.prototype.getData = function() {
+ return this._buffer.getData();
+ }, P.prototype.getBuffer = function() {
+ return this._buffer.getBuffer();
+ }, P.prototype.getStrideSize = function() {
+ return this.byteStride / P.GetTypeByteLength(this.type);
+ }, P.prototype.getOffset = function() {
+ return this.byteOffset / P.GetTypeByteLength(this.type);
+ }, P.prototype.getSize = function() {
+ return this._size;
+ }, P.prototype.getIsInstanced = function() {
+ return this._instanced;
+ }, P.prototype.getInstanceDivisor = function() {
+ return this._instanceDivisor;
+ }, P.prototype.create = function(c) {
+ this._buffer.create(c);
+ }, P.prototype.update = function(c) {
+ this._buffer.update(c);
+ }, P.prototype.updateDirectly = function(c, C, x) {
+ x === void 0 && (x = !1), this._buffer.updateDirectly(c, C, void 0, x);
+ }, P.prototype.dispose = function() {
+ this._ownsBuffer && this._buffer.dispose();
+ }, P.prototype.forEach = function(c, C) {
+ P.ForEach(this._buffer.getData(), this.byteOffset, this.byteStride, this._size, this.type, c, this.normalized, C);
+ }, P.DeduceStride = function(c) {
+ switch (c) {
+ case P.UVKind:
+ case P.UV2Kind:
+ case P.UV3Kind:
+ case P.UV4Kind:
+ case P.UV5Kind:
+ case P.UV6Kind:
+ return 2;
+ case P.NormalKind:
+ case P.PositionKind:
+ return 3;
+ case P.ColorKind:
+ case P.MatricesIndicesKind:
+ case P.MatricesIndicesExtraKind:
+ case P.MatricesWeightsKind:
+ case P.MatricesWeightsExtraKind:
+ case P.TangentKind:
+ return 4;
+ default:
+ throw new Error("Invalid kind '" + c + "'");
+ }
+ }, P.GetTypeByteLength = function(c) {
+ switch (c) {
+ case P.BYTE:
+ case P.UNSIGNED_BYTE:
+ return 1;
+ case P.SHORT:
+ case P.UNSIGNED_SHORT:
+ return 2;
+ case P.INT:
+ case P.UNSIGNED_INT:
+ case P.FLOAT:
+ return 4;
+ default:
+ throw new Error("Invalid type '" + c + "'");
+ }
+ }, P.ForEach = function(c, C, x, R, g, u, E, A) {
+ if (c instanceof Array)
+ for (var y = C / 4, v = x / 4, h = 0; h < u; h += R) {
+ for (var d = 0; d < R; d++)
+ A(c[y + d], h + d);
+ y += v;
+ }
+ else {
+ var b = c instanceof ArrayBuffer ? new DataView(c) : new DataView(c.buffer, c.byteOffset, c.byteLength), T = P.GetTypeByteLength(g);
+ for (h = 0; h < u; h += R) {
+ var N = C;
+ for (d = 0; d < R; d++)
+ A(P._GetFloatValue(b, g, N, E), h + d), N += T;
+ C += x;
+ }
+ }
+ }, P._GetFloatValue = function(c, C, x, R) {
+ switch (C) {
+ case P.BYTE:
+ var g = c.getInt8(x);
+ return R && (g = Math.max(g / 127, -1)), g;
+ case P.UNSIGNED_BYTE:
+ return g = c.getUint8(x), R && (g /= 255), g;
+ case P.SHORT:
+ return g = c.getInt16(x, !0), R && (g = Math.max(g / 32767, -1)), g;
+ case P.UNSIGNED_SHORT:
+ return g = c.getUint16(x, !0), R && (g /= 65535), g;
+ case P.INT:
+ return c.getInt32(x, !0);
+ case P.UNSIGNED_INT:
+ return c.getUint32(x, !0);
+ case P.FLOAT:
+ return c.getFloat32(x, !0);
+ default:
+ throw new Error("Invalid component type " + C);
+ }
+ }, P.BYTE = 5120, P.UNSIGNED_BYTE = 5121, P.SHORT = 5122, P.UNSIGNED_SHORT = 5123, P.INT = 5124, P.UNSIGNED_INT = 5125, P.FLOAT = 5126, P.PositionKind = "position", P.NormalKind = "normal", P.TangentKind = "tangent", P.UVKind = "uv", P.UV2Kind = "uv2", P.UV3Kind = "uv3", P.UV4Kind = "uv4", P.UV5Kind = "uv5", P.UV6Kind = "uv6", P.ColorKind = "color", P.MatricesIndicesKind = "matricesIndices", P.MatricesWeightsKind = "matricesWeights", P.MatricesIndicesExtraKind = "matricesIndicesExtra", P.MatricesWeightsExtraKind = "matricesWeightsExtra", P;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return x;
+ });
+ var D = l(6), f = l(2), P = l(38), c = l(8), C = l(128), x = function() {
+ function R(g, u, E, A, y, v, h, d, b, T) {
+ var N, U = this;
+ A === void 0 && (A = null), v === void 0 && (v = null), h === void 0 && (h = null), d === void 0 && (d = null), b === void 0 && (b = null), this.name = null, this.defines = "", this.onCompiled = null, this.onError = null, this.onBind = null, this.uniqueId = 0, this.onCompileObservable = new D.c(), this.onErrorObservable = new D.c(), this._onBindObservable = null, this._wasPreviouslyReady = !1, this._bonesComputationForcedToCPU = !1, this._multiTarget = !1, this._uniformBuffersNames = {}, this._samplers = {}, this._isReady = !1, this._compilationError = "", this._allFallbacksProcessed = !1, this._uniforms = {}, this._key = "", this._fallbacks = null, this._vertexSourceCode = "", this._fragmentSourceCode = "", this._vertexSourceCodeOverride = "", this._fragmentSourceCodeOverride = "", this._transformFeedbackVaryings = null, this._rawVertexSourceCode = "", this._rawFragmentSourceCode = "", this._pipelineContext = null, this._valueCache = {}, this.name = g;
+ var B, L, j = null;
+ if (u.attributes) {
+ var W = u;
+ if (this._engine = E, this._attributesNames = W.attributes, this._uniformsNames = W.uniformsNames.concat(W.samplers), this._samplerList = W.samplers.slice(), this.defines = W.defines, this.onError = W.onError, this.onCompiled = W.onCompiled, this._fallbacks = W.fallbacks, this._indexParameters = W.indexParameters, this._transformFeedbackVaryings = W.transformFeedbackVaryings || null, this._multiTarget = !!W.multiTarget, W.uniformBuffersNames) {
+ this._uniformBuffersNamesList = W.uniformBuffersNames.slice();
+ for (var Y = 0; Y < W.uniformBuffersNames.length; Y++)
+ this._uniformBuffersNames[W.uniformBuffersNames[Y]] = Y;
+ }
+ j = (N = W.processFinalCode) !== null && N !== void 0 ? N : null;
+ } else
+ this._engine = y, this.defines = v ?? "", this._uniformsNames = E.concat(A), this._samplerList = A ? A.slice() : [], this._attributesNames = u, this._uniformBuffersNamesList = [], this.onError = b, this.onCompiled = d, this._indexParameters = T, this._fallbacks = h;
+ this._attributeLocationByName = {}, this.uniqueId = R._uniqueIdSeed++;
+ var oe = P.a.IsWindowObjectExist() ? this._engine.getHostDocument() : null;
+ g.vertexSource ? B = "source:" + g.vertexSource : g.vertexElement ? (B = oe ? oe.getElementById(g.vertexElement) : null) || (B = g.vertexElement) : B = g.vertex || g, g.fragmentSource ? L = "source:" + g.fragmentSource : g.fragmentElement ? (L = oe ? oe.getElementById(g.fragmentElement) : null) || (L = g.fragmentElement) : L = g.fragment || g;
+ var te = { defines: this.defines.split(`
+`), indexParameters: this._indexParameters, isFragment: !1, shouldUseHighPrecisionShader: this._engine._shouldUseHighPrecisionShader, processor: this._engine._shaderProcessor, supportsUniformBuffers: this._engine.supportsUniformBuffers, shadersRepository: R.ShadersRepository, includesShadersStore: R.IncludesShadersStore, version: (100 * this._engine.webGLVersion).toString(), platformName: this._engine.webGLVersion >= 2 ? "WEBGL2" : "WEBGL1" };
+ this._loadShader(B, "Vertex", "", function(_e) {
+ U._rawVertexSourceCode = _e, U._loadShader(L, "Fragment", "Pixel", function(de) {
+ U._rawFragmentSourceCode = de, C.a.Process(_e, te, function(ae) {
+ j && (ae = j("vertex", ae)), te.isFragment = !0, C.a.Process(de, te, function(ie) {
+ j && (ie = j("fragment", ie)), U._useFinalCode(ae, ie, g);
+ }, U._engine);
+ }, U._engine);
+ });
+ });
+ }
+ return Object.defineProperty(R.prototype, "onBindObservable", { get: function() {
+ return this._onBindObservable || (this._onBindObservable = new D.c()), this._onBindObservable;
+ }, enumerable: !1, configurable: !0 }), R.prototype._useFinalCode = function(g, u, E) {
+ if (E) {
+ var A = E.vertexElement || E.vertex || E.spectorName || E, y = E.fragmentElement || E.fragment || E.spectorName || E;
+ this._vertexSourceCode = "#define SHADER_NAME vertex:" + A + `
+` + g, this._fragmentSourceCode = "#define SHADER_NAME fragment:" + y + `
+` + u;
+ } else
+ this._vertexSourceCode = g, this._fragmentSourceCode = u;
+ this._prepareEffect();
+ }, Object.defineProperty(R.prototype, "key", { get: function() {
+ return this._key;
+ }, enumerable: !1, configurable: !0 }), R.prototype.isReady = function() {
+ try {
+ return this._isReadyInternal();
+ } catch {
+ return !1;
+ }
+ }, R.prototype._isReadyInternal = function() {
+ return !!this._isReady || !!this._pipelineContext && this._pipelineContext.isReady;
+ }, R.prototype.getEngine = function() {
+ return this._engine;
+ }, R.prototype.getPipelineContext = function() {
+ return this._pipelineContext;
+ }, R.prototype.getAttributesNames = function() {
+ return this._attributesNames;
+ }, R.prototype.getAttributeLocation = function(g) {
+ return this._attributes[g];
+ }, R.prototype.getAttributeLocationByName = function(g) {
+ return this._attributeLocationByName[g];
+ }, R.prototype.getAttributesCount = function() {
+ return this._attributes.length;
+ }, R.prototype.getUniformIndex = function(g) {
+ return this._uniformsNames.indexOf(g);
+ }, R.prototype.getUniform = function(g) {
+ return this._uniforms[g];
+ }, R.prototype.getSamplers = function() {
+ return this._samplerList;
+ }, R.prototype.getUniformNames = function() {
+ return this._uniformsNames;
+ }, R.prototype.getUniformBuffersNames = function() {
+ return this._uniformBuffersNamesList;
+ }, R.prototype.getIndexParameters = function() {
+ return this._indexParameters;
+ }, R.prototype.getCompilationError = function() {
+ return this._compilationError;
+ }, R.prototype.allFallbacksProcessed = function() {
+ return this._allFallbacksProcessed;
+ }, R.prototype.executeWhenCompiled = function(g) {
+ var u = this;
+ this.isReady() ? g(this) : (this.onCompileObservable.add(function(E) {
+ g(E);
+ }), this._pipelineContext && !this._pipelineContext.isAsync || setTimeout(function() {
+ u._checkIsReady(null);
+ }, 16));
+ }, R.prototype._checkIsReady = function(g) {
+ var u = this;
+ try {
+ if (this._isReadyInternal())
+ return;
+ } catch (E) {
+ return void this._processCompilationErrors(E, g);
+ }
+ setTimeout(function() {
+ u._checkIsReady(g);
+ }, 16);
+ }, R.prototype._loadShader = function(g, u, E, A) {
+ var y;
+ if (typeof HTMLElement < "u" && g instanceof HTMLElement)
+ return void A(P.a.GetDOMTextContent(g));
+ g.substr(0, 7) !== "source:" ? g.substr(0, 7) !== "base64:" ? R.ShadersStore[g + u + "Shader"] ? A(R.ShadersStore[g + u + "Shader"]) : E && R.ShadersStore[g + E + "Shader"] ? A(R.ShadersStore[g + E + "Shader"]) : (y = g[0] === "." || g[0] === "/" || g.indexOf("http") > -1 ? g : R.ShadersRepository + g, this._engine._loadFile(y + "." + u.toLowerCase() + ".fx", A)) : A(window.atob(g.substr(7))) : A(g.substr(7));
+ }, Object.defineProperty(R.prototype, "vertexSourceCode", { get: function() {
+ return this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride ? this._vertexSourceCodeOverride : this._vertexSourceCode;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(R.prototype, "fragmentSourceCode", { get: function() {
+ return this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride ? this._fragmentSourceCodeOverride : this._fragmentSourceCode;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(R.prototype, "rawVertexSourceCode", { get: function() {
+ return this._rawVertexSourceCode;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(R.prototype, "rawFragmentSourceCode", { get: function() {
+ return this._rawFragmentSourceCode;
+ }, enumerable: !1, configurable: !0 }), R.prototype._rebuildProgram = function(g, u, E, A) {
+ var y = this;
+ this._isReady = !1, this._vertexSourceCodeOverride = g, this._fragmentSourceCodeOverride = u, this.onError = function(v, h) {
+ A && A(h);
+ }, this.onCompiled = function() {
+ var v = y.getEngine().scenes;
+ if (v)
+ for (var h = 0; h < v.length; h++)
+ v[h].markAllMaterialsAsDirty(f.a.MATERIAL_AllDirtyFlag);
+ y._pipelineContext._handlesSpectorRebuildCallback(E);
+ }, this._fallbacks = null, this._prepareEffect();
+ }, R.prototype._prepareEffect = function() {
+ var g = this, u = this._attributesNames, E = this.defines;
+ this._valueCache = {};
+ var A = this._pipelineContext;
+ try {
+ var y = this._engine;
+ this._pipelineContext = y.createPipelineContext();
+ var v = this._rebuildProgram.bind(this);
+ this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride ? y._preparePipelineContext(this._pipelineContext, this._vertexSourceCodeOverride, this._fragmentSourceCodeOverride, !0, v, null, this._transformFeedbackVaryings) : y._preparePipelineContext(this._pipelineContext, this._vertexSourceCode, this._fragmentSourceCode, !1, v, E, this._transformFeedbackVaryings), y._executeWhenRenderingStateIsCompiled(this._pipelineContext, function() {
+ if (y.supportsUniformBuffers)
+ for (var h in g._uniformBuffersNames)
+ g.bindUniformBlock(h, g._uniformBuffersNames[h]);
+ var d;
+ if (y.getUniforms(g._pipelineContext, g._uniformsNames).forEach(function(N, U) {
+ g._uniforms[g._uniformsNames[U]] = N;
+ }), g._attributes = y.getAttributes(g._pipelineContext, u), u)
+ for (var b = 0; b < u.length; b++) {
+ var T = u[b];
+ g._attributeLocationByName[T] = g._attributes[b];
+ }
+ for (d = 0; d < g._samplerList.length; d++)
+ g.getUniform(g._samplerList[d]) == null && (g._samplerList.splice(d, 1), d--);
+ g._samplerList.forEach(function(N, U) {
+ g._samplers[N] = U;
+ }), y.bindSamplers(g), g._compilationError = "", g._isReady = !0, g.onCompiled && g.onCompiled(g), g.onCompileObservable.notifyObservers(g), g.onCompileObservable.clear(), g._fallbacks && g._fallbacks.unBindMesh(), A && g.getEngine()._deletePipelineContext(A);
+ }), this._pipelineContext.isAsync && this._checkIsReady(A);
+ } catch (h) {
+ this._processCompilationErrors(h, A);
+ }
+ }, R.prototype._getShaderCodeAndErrorLine = function(g, u, E) {
+ var A = E ? /FRAGMENT SHADER ERROR: 0:(\d+?):/ : /VERTEX SHADER ERROR: 0:(\d+?):/, y = null;
+ if (u && g) {
+ var v = u.match(A);
+ if (v && v.length === 2) {
+ var h = parseInt(v[1]), d = g.split(`
+`, -1);
+ d.length >= h && (y = "Offending line [" + h + "] in " + (E ? "fragment" : "vertex") + " code: " + d[h - 1]);
+ }
+ }
+ return [g, y];
+ }, R.prototype._processCompilationErrors = function(g, u) {
+ var E, A, y, v, h;
+ u === void 0 && (u = null), this._compilationError = g.message;
+ var d = this._attributesNames, b = this._fallbacks;
+ if (c.a.Error("Unable to compile effect:"), c.a.Error("Uniforms: " + this._uniformsNames.map(function(B) {
+ return " " + B;
+ })), c.a.Error("Attributes: " + d.map(function(B) {
+ return " " + B;
+ })), c.a.Error(`Defines:\r
+` + this.defines), R.LogShaderCodeOnCompilationError) {
+ var T = null, N = null, U = null;
+ !((y = this._pipelineContext) === null || y === void 0) && y._getVertexShaderCode() && (U = (E = this._getShaderCodeAndErrorLine(this._pipelineContext._getVertexShaderCode(), this._compilationError, !1))[0], T = E[1], U && (c.a.Error("Vertex code:"), c.a.Error(U))), !((v = this._pipelineContext) === null || v === void 0) && v._getFragmentShaderCode() && (U = (A = this._getShaderCodeAndErrorLine((h = this._pipelineContext) === null || h === void 0 ? void 0 : h._getFragmentShaderCode(), this._compilationError, !0))[0], N = A[1], U && (c.a.Error("Fragment code:"), c.a.Error(U))), T && c.a.Error(T), N && c.a.Error(N);
+ }
+ c.a.Error("Error: " + this._compilationError), u && (this._pipelineContext = u, this._isReady = !0, this.onError && this.onError(this, this._compilationError), this.onErrorObservable.notifyObservers(this)), b ? (this._pipelineContext = null, b.hasMoreFallbacks ? (this._allFallbacksProcessed = !1, c.a.Error("Trying next fallback."), this.defines = b.reduce(this.defines, this), this._prepareEffect()) : (this._allFallbacksProcessed = !0, this.onError && this.onError(this, this._compilationError), this.onErrorObservable.notifyObservers(this), this.onErrorObservable.clear(), this._fallbacks && this._fallbacks.unBindMesh())) : this._allFallbacksProcessed = !0;
+ }, Object.defineProperty(R.prototype, "isSupported", { get: function() {
+ return this._compilationError === "";
+ }, enumerable: !1, configurable: !0 }), R.prototype._bindTexture = function(g, u) {
+ this._engine._bindTexture(this._samplers[g], u);
+ }, R.prototype.setTexture = function(g, u) {
+ this._engine.setTexture(this._samplers[g], this._uniforms[g], u);
+ }, R.prototype.setDepthStencilTexture = function(g, u) {
+ this._engine.setDepthStencilTexture(this._samplers[g], this._uniforms[g], u);
+ }, R.prototype.setTextureArray = function(g, u) {
+ var E = g + "Ex";
+ if (this._samplerList.indexOf(E + "0") === -1) {
+ for (var A = this._samplerList.indexOf(g), y = 1; y < u.length; y++) {
+ var v = E + (y - 1).toString();
+ this._samplerList.splice(A + y, 0, v);
+ }
+ for (var h = 0, d = 0, b = this._samplerList; d < b.length; d++) {
+ var T = b[d];
+ this._samplers[T] = h, h += 1;
+ }
+ }
+ this._engine.setTextureArray(this._samplers[g], this._uniforms[g], u);
+ }, R.prototype.setTextureFromPostProcess = function(g, u) {
+ this._engine.setTextureFromPostProcess(this._samplers[g], u);
+ }, R.prototype.setTextureFromPostProcessOutput = function(g, u) {
+ this._engine.setTextureFromPostProcessOutput(this._samplers[g], u);
+ }, R.prototype._cacheMatrix = function(g, u) {
+ var E = this._valueCache[g], A = u.updateFlag;
+ return (E === void 0 || E !== A) && (this._valueCache[g] = A, !0);
+ }, R.prototype._cacheFloat2 = function(g, u, E) {
+ var A = this._valueCache[g];
+ if (!A || A.length !== 2)
+ return A = [u, E], this._valueCache[g] = A, !0;
+ var y = !1;
+ return A[0] !== u && (A[0] = u, y = !0), A[1] !== E && (A[1] = E, y = !0), y;
+ }, R.prototype._cacheFloat3 = function(g, u, E, A) {
+ var y = this._valueCache[g];
+ if (!y || y.length !== 3)
+ return y = [u, E, A], this._valueCache[g] = y, !0;
+ var v = !1;
+ return y[0] !== u && (y[0] = u, v = !0), y[1] !== E && (y[1] = E, v = !0), y[2] !== A && (y[2] = A, v = !0), v;
+ }, R.prototype._cacheFloat4 = function(g, u, E, A, y) {
+ var v = this._valueCache[g];
+ if (!v || v.length !== 4)
+ return v = [u, E, A, y], this._valueCache[g] = v, !0;
+ var h = !1;
+ return v[0] !== u && (v[0] = u, h = !0), v[1] !== E && (v[1] = E, h = !0), v[2] !== A && (v[2] = A, h = !0), v[3] !== y && (v[3] = y, h = !0), h;
+ }, R.prototype.bindUniformBuffer = function(g, u) {
+ var E = this._uniformBuffersNames[u];
+ E !== void 0 && R._baseCache[E] !== g && (R._baseCache[E] = g, this._engine.bindUniformBufferBase(g, E));
+ }, R.prototype.bindUniformBlock = function(g, u) {
+ this._engine.bindUniformBlock(this._pipelineContext, g, u);
+ }, R.prototype.setInt = function(g, u) {
+ var E = this._valueCache[g];
+ return E !== void 0 && E === u || this._engine.setInt(this._uniforms[g], u) && (this._valueCache[g] = u), this;
+ }, R.prototype.setIntArray = function(g, u) {
+ return this._valueCache[g] = null, this._engine.setIntArray(this._uniforms[g], u), this;
+ }, R.prototype.setIntArray2 = function(g, u) {
+ return this._valueCache[g] = null, this._engine.setIntArray2(this._uniforms[g], u), this;
+ }, R.prototype.setIntArray3 = function(g, u) {
+ return this._valueCache[g] = null, this._engine.setIntArray3(this._uniforms[g], u), this;
+ }, R.prototype.setIntArray4 = function(g, u) {
+ return this._valueCache[g] = null, this._engine.setIntArray4(this._uniforms[g], u), this;
+ }, R.prototype.setFloatArray = function(g, u) {
+ return this._valueCache[g] = null, this._engine.setArray(this._uniforms[g], u), this;
+ }, R.prototype.setFloatArray2 = function(g, u) {
+ return this._valueCache[g] = null, this._engine.setArray2(this._uniforms[g], u), this;
+ }, R.prototype.setFloatArray3 = function(g, u) {
+ return this._valueCache[g] = null, this._engine.setArray3(this._uniforms[g], u), this;
+ }, R.prototype.setFloatArray4 = function(g, u) {
+ return this._valueCache[g] = null, this._engine.setArray4(this._uniforms[g], u), this;
+ }, R.prototype.setArray = function(g, u) {
+ return this._valueCache[g] = null, this._engine.setArray(this._uniforms[g], u), this;
+ }, R.prototype.setArray2 = function(g, u) {
+ return this._valueCache[g] = null, this._engine.setArray2(this._uniforms[g], u), this;
+ }, R.prototype.setArray3 = function(g, u) {
+ return this._valueCache[g] = null, this._engine.setArray3(this._uniforms[g], u), this;
+ }, R.prototype.setArray4 = function(g, u) {
+ return this._valueCache[g] = null, this._engine.setArray4(this._uniforms[g], u), this;
+ }, R.prototype.setMatrices = function(g, u) {
+ return u ? (this._valueCache[g] = null, this._engine.setMatrices(this._uniforms[g], u), this) : this;
+ }, R.prototype.setMatrix = function(g, u) {
+ return this._cacheMatrix(g, u) && (this._engine.setMatrices(this._uniforms[g], u.toArray()) || (this._valueCache[g] = null)), this;
+ }, R.prototype.setMatrix3x3 = function(g, u) {
+ return this._valueCache[g] = null, this._engine.setMatrix3x3(this._uniforms[g], u), this;
+ }, R.prototype.setMatrix2x2 = function(g, u) {
+ return this._valueCache[g] = null, this._engine.setMatrix2x2(this._uniforms[g], u), this;
+ }, R.prototype.setFloat = function(g, u) {
+ var E = this._valueCache[g];
+ return E !== void 0 && E === u || this._engine.setFloat(this._uniforms[g], u) && (this._valueCache[g] = u), this;
+ }, R.prototype.setBool = function(g, u) {
+ var E = this._valueCache[g];
+ return E !== void 0 && E === u || this._engine.setInt(this._uniforms[g], u ? 1 : 0) && (this._valueCache[g] = u), this;
+ }, R.prototype.setVector2 = function(g, u) {
+ return this._cacheFloat2(g, u.x, u.y) && (this._engine.setFloat2(this._uniforms[g], u.x, u.y) || (this._valueCache[g] = null)), this;
+ }, R.prototype.setFloat2 = function(g, u, E) {
+ return this._cacheFloat2(g, u, E) && (this._engine.setFloat2(this._uniforms[g], u, E) || (this._valueCache[g] = null)), this;
+ }, R.prototype.setVector3 = function(g, u) {
+ return this._cacheFloat3(g, u.x, u.y, u.z) && (this._engine.setFloat3(this._uniforms[g], u.x, u.y, u.z) || (this._valueCache[g] = null)), this;
+ }, R.prototype.setFloat3 = function(g, u, E, A) {
+ return this._cacheFloat3(g, u, E, A) && (this._engine.setFloat3(this._uniforms[g], u, E, A) || (this._valueCache[g] = null)), this;
+ }, R.prototype.setVector4 = function(g, u) {
+ return this._cacheFloat4(g, u.x, u.y, u.z, u.w) && (this._engine.setFloat4(this._uniforms[g], u.x, u.y, u.z, u.w) || (this._valueCache[g] = null)), this;
+ }, R.prototype.setFloat4 = function(g, u, E, A, y) {
+ return this._cacheFloat4(g, u, E, A, y) && (this._engine.setFloat4(this._uniforms[g], u, E, A, y) || (this._valueCache[g] = null)), this;
+ }, R.prototype.setColor3 = function(g, u) {
+ return this._cacheFloat3(g, u.r, u.g, u.b) && (this._engine.setFloat3(this._uniforms[g], u.r, u.g, u.b) || (this._valueCache[g] = null)), this;
+ }, R.prototype.setColor4 = function(g, u, E) {
+ return this._cacheFloat4(g, u.r, u.g, u.b, E) && (this._engine.setFloat4(this._uniforms[g], u.r, u.g, u.b, E) || (this._valueCache[g] = null)), this;
+ }, R.prototype.setDirectColor4 = function(g, u) {
+ return this._cacheFloat4(g, u.r, u.g, u.b, u.a) && (this._engine.setFloat4(this._uniforms[g], u.r, u.g, u.b, u.a) || (this._valueCache[g] = null)), this;
+ }, R.prototype.dispose = function() {
+ this._engine._releaseEffect(this);
+ }, R.RegisterShader = function(g, u, E) {
+ u && (R.ShadersStore[g + "PixelShader"] = u), E && (R.ShadersStore[g + "VertexShader"] = E);
+ }, R.ResetCache = function() {
+ R._baseCache = {};
+ }, R.ShadersRepository = "src/Shaders/", R.LogShaderCodeOnCompilationError = !0, R._uniqueIdSeed = 0, R._baseCache = {}, R.ShadersStore = {}, R.IncludesShadersStore = {}, R;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ }), l.d(_, "d", function() {
+ return f;
+ }), l.d(_, "b", function() {
+ return P;
+ }), l.d(_, "c", function() {
+ return c;
+ });
+ var D = function() {
+ function C(x, R, g, u) {
+ R === void 0 && (R = !1), this.initalize(x, R, g, u);
+ }
+ return C.prototype.initalize = function(x, R, g, u) {
+ return R === void 0 && (R = !1), this.mask = x, this.skipNextObservers = R, this.target = g, this.currentTarget = u, this;
+ }, C;
+ }(), f = function(C, x, R) {
+ R === void 0 && (R = null), this.callback = C, this.mask = x, this.scope = R, this._willBeUnregistered = !1, this.unregisterOnNextCall = !1;
+ }, P = function() {
+ function C() {
+ }
+ return C.prototype.dispose = function() {
+ if (this._observers && this._observables)
+ for (var x = 0; x < this._observers.length; x++)
+ this._observables[x].remove(this._observers[x]);
+ this._observers = null, this._observables = null;
+ }, C.Watch = function(x, R, g, u) {
+ g === void 0 && (g = -1), u === void 0 && (u = null);
+ var E = new C();
+ E._observers = new Array(), E._observables = x;
+ for (var A = 0, y = x; A < y.length; A++) {
+ var v = y[A].add(R, g, !1, u);
+ v && E._observers.push(v);
+ }
+ return E;
+ }, C;
+ }(), c = function() {
+ function C(x) {
+ this._observers = new Array(), this._eventState = new D(0), x && (this._onObserverAdded = x);
+ }
+ return Object.defineProperty(C.prototype, "observers", { get: function() {
+ return this._observers;
+ }, enumerable: !1, configurable: !0 }), C.prototype.add = function(x, R, g, u, E) {
+ if (R === void 0 && (R = -1), g === void 0 && (g = !1), u === void 0 && (u = null), E === void 0 && (E = !1), !x)
+ return null;
+ var A = new f(x, R, u);
+ return A.unregisterOnNextCall = E, g ? this._observers.unshift(A) : this._observers.push(A), this._onObserverAdded && this._onObserverAdded(A), A;
+ }, C.prototype.addOnce = function(x) {
+ return this.add(x, void 0, void 0, void 0, !0);
+ }, C.prototype.remove = function(x) {
+ return !!x && this._observers.indexOf(x) !== -1 && (this._deferUnregister(x), !0);
+ }, C.prototype.removeCallback = function(x, R) {
+ for (var g = 0; g < this._observers.length; g++) {
+ var u = this._observers[g];
+ if (!u._willBeUnregistered && u.callback === x && (!R || R === u.scope))
+ return this._deferUnregister(u), !0;
+ }
+ return !1;
+ }, C.prototype._deferUnregister = function(x) {
+ var R = this;
+ x.unregisterOnNextCall = !1, x._willBeUnregistered = !0, setTimeout(function() {
+ R._remove(x);
+ }, 0);
+ }, C.prototype._remove = function(x) {
+ if (!x)
+ return !1;
+ var R = this._observers.indexOf(x);
+ return R !== -1 && (this._observers.splice(R, 1), !0);
+ }, C.prototype.makeObserverTopPriority = function(x) {
+ this._remove(x), this._observers.unshift(x);
+ }, C.prototype.makeObserverBottomPriority = function(x) {
+ this._remove(x), this._observers.push(x);
+ }, C.prototype.notifyObservers = function(x, R, g, u, E) {
+ if (R === void 0 && (R = -1), !this._observers.length)
+ return !0;
+ var A = this._eventState;
+ A.mask = R, A.target = g, A.currentTarget = u, A.skipNextObservers = !1, A.lastReturnValue = x, A.userInfo = E;
+ for (var y = 0, v = this._observers; y < v.length; y++) {
+ var h = v[y];
+ if (!h._willBeUnregistered && (h.mask & R && (h.scope ? A.lastReturnValue = h.callback.apply(h.scope, [x, A]) : A.lastReturnValue = h.callback(x, A), h.unregisterOnNextCall && this._deferUnregister(h)), A.skipNextObservers))
+ return !1;
+ }
+ return !0;
+ }, C.prototype.notifyObserversWithPromise = function(x, R, g, u, E) {
+ var A = this;
+ R === void 0 && (R = -1);
+ var y = Promise.resolve(x);
+ if (!this._observers.length)
+ return y;
+ var v = this._eventState;
+ return v.mask = R, v.target = g, v.currentTarget = u, v.skipNextObservers = !1, v.userInfo = E, this._observers.forEach(function(h) {
+ v.skipNextObservers || h._willBeUnregistered || h.mask & R && (y = h.scope ? y.then(function(d) {
+ return v.lastReturnValue = d, h.callback.apply(h.scope, [x, v]);
+ }) : y.then(function(d) {
+ return v.lastReturnValue = d, h.callback(x, v);
+ }), h.unregisterOnNextCall && A._deferUnregister(h));
+ }), y.then(function() {
+ return x;
+ });
+ }, C.prototype.notifyObserver = function(x, R, g) {
+ g === void 0 && (g = -1);
+ var u = this._eventState;
+ u.mask = g, u.skipNextObservers = !1, x.callback(R, u);
+ }, C.prototype.hasObservers = function() {
+ return this._observers.length > 0;
+ }, C.prototype.clear = function() {
+ this._observers = new Array(), this._onObserverAdded = null;
+ }, C.prototype.clone = function() {
+ var x = new C();
+ return x._observers = this._observers.slice(0), x;
+ }, C.prototype.hasSpecificMask = function(x) {
+ x === void 0 && (x = -1);
+ for (var R = 0, g = this._observers; R < g.length; R++) {
+ var u = g[R];
+ if (u.mask & x || u.mask === x)
+ return !0;
+ }
+ return !1;
+ }, C;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "b", function() {
+ return te;
+ }), l.d(_, "c", function() {
+ return de;
+ }), l.d(_, "a", function() {
+ return Z;
+ });
+ var D = l(1), f = l(6), P = l(12), c = l(41), C = l(37), x = l(0), R = l(9), g = l(29), u = l(4), E = l(16), A = l(71), y = l(31), v = l(61), h = l(43), d = l(25), b = l(68), T = l(69), N = l(2), U = l(3), B = l(8), L = l(11), j = l(21), W = l(17), Y = l(149), oe = l(70), te = function() {
+ }, _e = function() {
+ this.visibleInstances = {}, this.batchCache = new de(), this.instancesBufferSize = 2048;
+ }, de = function() {
+ this.mustReturn = !1, this.visibleInstances = new Array(), this.renderSelf = new Array(), this.hardwareInstancedRendering = new Array();
+ }, ae = function() {
+ this.instancesCount = 0, this.matrixBuffer = null, this.matrixBufferSize = 512, this.boundingVectors = [], this.worldMatrices = null;
+ }, ie = function() {
+ this._areNormalsFrozen = !1, this._source = null, this.meshMap = null, this._preActivateId = -1, this._LODLevels = new Array(), this._morphTargetManager = null;
+ }, Z = function(ee) {
+ function w(z, q, le, ce, J, H) {
+ q === void 0 && (q = null), le === void 0 && (le = null), ce === void 0 && (ce = null), H === void 0 && (H = !0);
+ var X = ee.call(this, z, q) || this;
+ if (X._internalMeshDataInfo = new ie(), X.delayLoadState = N.a.DELAYLOADSTATE_NONE, X.instances = new Array(), X._creationDataStorage = null, X._geometry = null, X._instanceDataStorage = new _e(), X._thinInstanceDataStorage = new ae(), X._effectiveMaterial = null, X._shouldGenerateFlatShading = !1, X._originalBuilderSideOrientation = w.DEFAULTSIDE, X.overrideMaterialSideOrientation = null, q = X.getScene(), ce) {
+ if (ce._geometry && ce._geometry.applyToMesh(X), c.a.DeepCopy(ce, X, ["name", "material", "skeleton", "instances", "parent", "uniqueId", "source", "metadata", "morphTargetManager", "hasInstances", "source", "worldMatrixInstancedBuffer", "hasLODLevels", "geometry", "isBlocked", "areNormalsFrozen", "facetNb", "isFacetDataEnabled", "lightSources", "useBones", "isAnInstance", "collider", "edgesRenderer", "forward", "up", "right", "absolutePosition", "absoluteScaling", "absoluteRotationQuaternion", "isWorldMatrixFrozen", "nonUniformScaling", "behaviors", "worldMatrixFromCache", "hasThinInstances", "cloneMeshMap"], ["_poseMatrix"]), X._internalMeshDataInfo._source = ce, q.useClonedMeshMap && (ce._internalMeshDataInfo.meshMap || (ce._internalMeshDataInfo.meshMap = {}), ce._internalMeshDataInfo.meshMap[X.uniqueId] = X), X._originalBuilderSideOrientation = ce._originalBuilderSideOrientation, X._creationDataStorage = ce._creationDataStorage, ce._ranges) {
+ var ne = ce._ranges;
+ for (var z in ne)
+ ne.hasOwnProperty(z) && ne[z] && X.createAnimationRange(z, ne[z].from, ne[z].to);
+ }
+ var Q;
+ if (ce.metadata && ce.metadata.clone ? X.metadata = ce.metadata.clone() : X.metadata = ce.metadata, C.a && C.a.HasTags(ce) && C.a.AddTagsTo(X, C.a.GetTags(ce, !0)), X.setEnabled(ce.isEnabled()), X.parent = ce.parent, X.setPivotMatrix(ce.getPivotMatrix()), X.id = z + "." + ce.id, X.material = ce.material, !J)
+ for (var $ = ce.getDescendants(!0), me = 0; me < $.length; me++) {
+ var ye = $[me];
+ ye.clone && ye.clone(z + "." + ye.name, X);
+ }
+ if (ce.morphTargetManager && (X.morphTargetManager = ce.morphTargetManager), q.getPhysicsEngine) {
+ var be = q.getPhysicsEngine();
+ if (H && be) {
+ var ge = be.getImpostorForPhysicsObject(ce);
+ ge && (X.physicsImpostor = ge.clone(X));
+ }
+ }
+ for (Q = 0; Q < q.particleSystems.length; Q++) {
+ var Te = q.particleSystems[Q];
+ Te.emitter === ce && Te.clone(Te.name, X);
+ }
+ X.refreshBoundingInfo(), X.computeWorldMatrix(!0);
+ }
+ return le !== null && (X.parent = le), X._instanceDataStorage.hardwareInstancedRendering = X.getEngine().getCaps().instancedArrays, X;
+ }
+ return Object(D.d)(w, ee), w._GetDefaultSideOrientation = function(z) {
+ return z || w.FRONTSIDE;
+ }, Object.defineProperty(w.prototype, "computeBonesUsingShaders", { get: function() {
+ return this._internalAbstractMeshDataInfo._computeBonesUsingShaders;
+ }, set: function(z) {
+ this._internalAbstractMeshDataInfo._computeBonesUsingShaders !== z && (z && this._internalMeshDataInfo._sourcePositions && (this.setVerticesData(u.b.PositionKind, this._internalMeshDataInfo._sourcePositions.slice(), !0), this._internalMeshDataInfo._sourceNormals && this.setVerticesData(u.b.NormalKind, this._internalMeshDataInfo._sourceNormals.slice(), !0)), this._internalAbstractMeshDataInfo._computeBonesUsingShaders = z, this._markSubMeshesAsAttributesDirty());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(w.prototype, "onBeforeRenderObservable", { get: function() {
+ return this._internalMeshDataInfo._onBeforeRenderObservable || (this._internalMeshDataInfo._onBeforeRenderObservable = new f.c()), this._internalMeshDataInfo._onBeforeRenderObservable;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(w.prototype, "onBeforeBindObservable", { get: function() {
+ return this._internalMeshDataInfo._onBeforeBindObservable || (this._internalMeshDataInfo._onBeforeBindObservable = new f.c()), this._internalMeshDataInfo._onBeforeBindObservable;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(w.prototype, "onAfterRenderObservable", { get: function() {
+ return this._internalMeshDataInfo._onAfterRenderObservable || (this._internalMeshDataInfo._onAfterRenderObservable = new f.c()), this._internalMeshDataInfo._onAfterRenderObservable;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(w.prototype, "onBeforeDrawObservable", { get: function() {
+ return this._internalMeshDataInfo._onBeforeDrawObservable || (this._internalMeshDataInfo._onBeforeDrawObservable = new f.c()), this._internalMeshDataInfo._onBeforeDrawObservable;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(w.prototype, "onBeforeDraw", { set: function(z) {
+ this._onBeforeDrawObserver && this.onBeforeDrawObservable.remove(this._onBeforeDrawObserver), this._onBeforeDrawObserver = this.onBeforeDrawObservable.add(z);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(w.prototype, "hasInstances", { get: function() {
+ return this.instances.length > 0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(w.prototype, "hasThinInstances", { get: function() {
+ var z;
+ return ((z = this._thinInstanceDataStorage.instancesCount) !== null && z !== void 0 ? z : 0) > 0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(w.prototype, "morphTargetManager", { get: function() {
+ return this._internalMeshDataInfo._morphTargetManager;
+ }, set: function(z) {
+ this._internalMeshDataInfo._morphTargetManager !== z && (this._internalMeshDataInfo._morphTargetManager = z, this._syncGeometryWithMorphTargetManager());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(w.prototype, "source", { get: function() {
+ return this._internalMeshDataInfo._source;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(w.prototype, "cloneMeshMap", { get: function() {
+ return this._internalMeshDataInfo.meshMap;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(w.prototype, "isUnIndexed", { get: function() {
+ return this._unIndexed;
+ }, set: function(z) {
+ this._unIndexed !== z && (this._unIndexed = z, this._markSubMeshesAsAttributesDirty());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(w.prototype, "worldMatrixInstancedBuffer", { get: function() {
+ return this._instanceDataStorage.instancesData;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(w.prototype, "manualUpdateOfWorldMatrixInstancedBuffer", { get: function() {
+ return this._instanceDataStorage.manualUpdate;
+ }, set: function(z) {
+ this._instanceDataStorage.manualUpdate = z;
+ }, enumerable: !1, configurable: !0 }), w.prototype.instantiateHierarchy = function(z, q, le) {
+ z === void 0 && (z = null);
+ var ce = !(this.getTotalVertices() > 0) || q && q.doNotInstantiate ? this.clone("Clone of " + (this.name || this.id), z || this.parent, !0) : this.createInstance("instance of " + (this.name || this.id));
+ ce && (ce.parent = z || this.parent, ce.position = this.position.clone(), ce.scaling = this.scaling.clone(), this.rotationQuaternion ? ce.rotationQuaternion = this.rotationQuaternion.clone() : ce.rotation = this.rotation.clone(), le && le(this, ce));
+ for (var J = 0, H = this.getChildTransformNodes(!0); J < H.length; J++)
+ H[J].instantiateHierarchy(ce, q, le);
+ return ce;
+ }, w.prototype.getClassName = function() {
+ return "Mesh";
+ }, Object.defineProperty(w.prototype, "_isMesh", { get: function() {
+ return !0;
+ }, enumerable: !1, configurable: !0 }), w.prototype.toString = function(z) {
+ var q = ee.prototype.toString.call(this, z);
+ if (q += ", n vertices: " + this.getTotalVertices(), q += ", parent: " + (this._waitingParentId ? this._waitingParentId : this.parent ? this.parent.name : "NONE"), this.animations)
+ for (var le = 0; le < this.animations.length; le++)
+ q += ", animation[0]: " + this.animations[le].toString(z);
+ if (z)
+ if (this._geometry) {
+ var ce = this.getIndices(), J = this.getVerticesData(u.b.PositionKind);
+ J && ce && (q += ", flat shading: " + (J.length / 3 === ce.length ? "YES" : "NO"));
+ } else
+ q += ", flat shading: UNKNOWN";
+ return q;
+ }, w.prototype._unBindEffect = function() {
+ ee.prototype._unBindEffect.call(this);
+ for (var z = 0, q = this.instances; z < q.length; z++)
+ q[z]._unBindEffect();
+ }, Object.defineProperty(w.prototype, "hasLODLevels", { get: function() {
+ return this._internalMeshDataInfo._LODLevels.length > 0;
+ }, enumerable: !1, configurable: !0 }), w.prototype.getLODLevels = function() {
+ return this._internalMeshDataInfo._LODLevels;
+ }, w.prototype._sortLODLevels = function() {
+ this._internalMeshDataInfo._LODLevels.sort(function(z, q) {
+ return z.distance < q.distance ? 1 : z.distance > q.distance ? -1 : 0;
+ });
+ }, w.prototype.addLODLevel = function(z, q) {
+ if (q && q._masterMesh)
+ return B.a.Warn("You cannot use a mesh as LOD level twice"), this;
+ var le = new Y.a(z, q);
+ return this._internalMeshDataInfo._LODLevels.push(le), q && (q._masterMesh = this), this._sortLODLevels(), this;
+ }, w.prototype.getLODLevelAtDistance = function(z) {
+ for (var q = this._internalMeshDataInfo, le = 0; le < q._LODLevels.length; le++) {
+ var ce = q._LODLevels[le];
+ if (ce.distance === z)
+ return ce.mesh;
+ }
+ return null;
+ }, w.prototype.removeLODLevel = function(z) {
+ for (var q = this._internalMeshDataInfo, le = 0; le < q._LODLevels.length; le++)
+ q._LODLevels[le].mesh === z && (q._LODLevels.splice(le, 1), z && (z._masterMesh = null));
+ return this._sortLODLevels(), this;
+ }, w.prototype.getLOD = function(z, q) {
+ var le, ce = this._internalMeshDataInfo;
+ if (!ce._LODLevels || ce._LODLevels.length === 0)
+ return this;
+ q ? le = q : le = this.getBoundingInfo().boundingSphere;
+ var J = le.centerWorld.subtract(z.globalPosition).length();
+ if (ce._LODLevels[ce._LODLevels.length - 1].distance > J)
+ return this.onLODLevelSelection && this.onLODLevelSelection(J, this, this), this;
+ for (var H = 0; H < ce._LODLevels.length; H++) {
+ var X = ce._LODLevels[H];
+ if (X.distance < J) {
+ if (X.mesh) {
+ if (X.mesh.delayLoadState === N.a.DELAYLOADSTATE_NOTLOADED)
+ return X.mesh._checkDelayState(), this;
+ if (X.mesh.delayLoadState === N.a.DELAYLOADSTATE_LOADING)
+ return this;
+ X.mesh._preActivate(), X.mesh._updateSubMeshesBoundingInfo(this.worldMatrixFromCache);
+ }
+ return this.onLODLevelSelection && this.onLODLevelSelection(J, this, X.mesh), X.mesh;
+ }
+ }
+ return this.onLODLevelSelection && this.onLODLevelSelection(J, this, this), this;
+ }, Object.defineProperty(w.prototype, "geometry", { get: function() {
+ return this._geometry;
+ }, enumerable: !1, configurable: !0 }), w.prototype.getTotalVertices = function() {
+ return this._geometry === null || this._geometry === void 0 ? 0 : this._geometry.getTotalVertices();
+ }, w.prototype.getVerticesData = function(z, q, le) {
+ return this._geometry ? this._geometry.getVerticesData(z, q, le) : null;
+ }, w.prototype.getVertexBuffer = function(z) {
+ return this._geometry ? this._geometry.getVertexBuffer(z) : null;
+ }, w.prototype.isVerticesDataPresent = function(z) {
+ return this._geometry ? this._geometry.isVerticesDataPresent(z) : !!this._delayInfo && this._delayInfo.indexOf(z) !== -1;
+ }, w.prototype.isVertexBufferUpdatable = function(z) {
+ return this._geometry ? this._geometry.isVertexBufferUpdatable(z) : !!this._delayInfo && this._delayInfo.indexOf(z) !== -1;
+ }, w.prototype.getVerticesDataKinds = function() {
+ if (!this._geometry) {
+ var z = new Array();
+ return this._delayInfo && this._delayInfo.forEach(function(q) {
+ z.push(q);
+ }), z;
+ }
+ return this._geometry.getVerticesDataKinds();
+ }, w.prototype.getTotalIndices = function() {
+ return this._geometry ? this._geometry.getTotalIndices() : 0;
+ }, w.prototype.getIndices = function(z, q) {
+ return this._geometry ? this._geometry.getIndices(z, q) : [];
+ }, Object.defineProperty(w.prototype, "isBlocked", { get: function() {
+ return this._masterMesh !== null && this._masterMesh !== void 0;
+ }, enumerable: !1, configurable: !0 }), w.prototype.isReady = function(z, q) {
+ var le, ce, J, H, X, ne;
+ if (z === void 0 && (z = !1), q === void 0 && (q = !1), this.delayLoadState === N.a.DELAYLOADSTATE_LOADING || !ee.prototype.isReady.call(this, z))
+ return !1;
+ if (!this.subMeshes || this.subMeshes.length === 0 || !z)
+ return !0;
+ var Q = this.getEngine(), $ = this.getScene(), me = q || Q.getCaps().instancedArrays && (this.instances.length > 0 || this.hasThinInstances);
+ this.computeWorldMatrix();
+ var ye = this.material || $.defaultMaterial;
+ if (ye) {
+ if (ye._storeEffectOnSubMeshes)
+ for (var be = 0, ge = this.subMeshes; be < ge.length; be++) {
+ var Te = (He = ge[be]).getMaterial();
+ if (Te) {
+ if (Te._storeEffectOnSubMeshes) {
+ if (!Te.isReadyForSubMesh(this, He, me))
+ return !1;
+ } else if (!Te.isReady(this, me))
+ return !1;
+ }
+ }
+ else if (!ye.isReady(this, me))
+ return !1;
+ }
+ for (var Re = 0, Se = this.lightSources; Re < Se.length; Re++) {
+ var Ne = Se[Re].getShadowGenerator();
+ if (Ne && (!(!((le = Ne.getShadowMap()) === null || le === void 0) && le.renderList) || !((ce = Ne.getShadowMap()) === null || ce === void 0) && ce.renderList && ((H = (J = Ne.getShadowMap()) === null || J === void 0 ? void 0 : J.renderList) === null || H === void 0 ? void 0 : H.indexOf(this)) !== -1))
+ for (var ze = 0, Ye = this.subMeshes; ze < Ye.length; ze++) {
+ var He = Ye[ze];
+ if (!Ne.isReady(He, me, (ne = (X = He.getMaterial()) === null || X === void 0 ? void 0 : X.needAlphaBlendingForMesh(this)) !== null && ne !== void 0 && ne))
+ return !1;
+ }
+ }
+ for (var Xe = 0, Ze = this._internalMeshDataInfo._LODLevels; Xe < Ze.length; Xe++) {
+ var je = Ze[Xe];
+ if (je.mesh && !je.mesh.isReady(me))
+ return !1;
+ }
+ return !0;
+ }, Object.defineProperty(w.prototype, "areNormalsFrozen", { get: function() {
+ return this._internalMeshDataInfo._areNormalsFrozen;
+ }, enumerable: !1, configurable: !0 }), w.prototype.freezeNormals = function() {
+ return this._internalMeshDataInfo._areNormalsFrozen = !0, this;
+ }, w.prototype.unfreezeNormals = function() {
+ return this._internalMeshDataInfo._areNormalsFrozen = !1, this;
+ }, Object.defineProperty(w.prototype, "overridenInstanceCount", { set: function(z) {
+ this._instanceDataStorage.overridenInstanceCount = z;
+ }, enumerable: !1, configurable: !0 }), w.prototype._preActivate = function() {
+ var z = this._internalMeshDataInfo, q = this.getScene().getRenderId();
+ return z._preActivateId === q || (z._preActivateId = q, this._instanceDataStorage.visibleInstances = null), this;
+ }, w.prototype._preActivateForIntermediateRendering = function(z) {
+ return this._instanceDataStorage.visibleInstances && (this._instanceDataStorage.visibleInstances.intermediateDefaultRenderId = z), this;
+ }, w.prototype._registerInstanceForRenderId = function(z, q) {
+ return this._instanceDataStorage.visibleInstances || (this._instanceDataStorage.visibleInstances = { defaultRenderId: q, selfDefaultRenderId: this._renderId }), this._instanceDataStorage.visibleInstances[q] || (this._instanceDataStorage.previousRenderId !== void 0 && this._instanceDataStorage.isFrozen && (this._instanceDataStorage.visibleInstances[this._instanceDataStorage.previousRenderId] = null), this._instanceDataStorage.previousRenderId = q, this._instanceDataStorage.visibleInstances[q] = new Array()), this._instanceDataStorage.visibleInstances[q].push(z), this;
+ }, w.prototype._afterComputeWorldMatrix = function() {
+ ee.prototype._afterComputeWorldMatrix.call(this), this.hasThinInstances && (this.doNotSyncBoundingInfo || this.thinInstanceRefreshBoundingInfo(!1));
+ }, w.prototype._postActivate = function() {
+ this.edgesShareWithInstances && this.edgesRenderer && this.edgesRenderer.isEnabled && this._renderingGroup && (this._renderingGroup._edgesRenderers.pushNoDuplicate(this.edgesRenderer), this.edgesRenderer.customInstances.push(this.getWorldMatrix()));
+ }, w.prototype.refreshBoundingInfo = function(z) {
+ if (z === void 0 && (z = !1), this._boundingInfo && this._boundingInfo.isLocked)
+ return this;
+ var q = this.geometry ? this.geometry.boundingBias : null;
+ return this._refreshBoundingInfo(this._getPositionData(z), q), this;
+ }, w.prototype._createGlobalSubMesh = function(z) {
+ var q = this.getTotalVertices();
+ if (!q || !this.getIndices())
+ return null;
+ if (this.subMeshes && this.subMeshes.length > 0) {
+ var le = this.getIndices();
+ if (!le)
+ return null;
+ var ce = le.length, J = !1;
+ if (z)
+ J = !0;
+ else
+ for (var H = 0, X = this.subMeshes; H < X.length; H++) {
+ var ne = X[H];
+ if (ne.indexStart + ne.indexCount > ce) {
+ J = !0;
+ break;
+ }
+ if (ne.verticesStart + ne.verticesCount > q) {
+ J = !0;
+ break;
+ }
+ }
+ if (!J)
+ return this.subMeshes[0];
+ }
+ return this.releaseSubMeshes(), new v.a(0, 0, q, 0, this.getTotalIndices(), this);
+ }, w.prototype.subdivide = function(z) {
+ if (!(z < 1)) {
+ for (var q = this.getTotalIndices(), le = q / z | 0, ce = 0; le % 3 != 0; )
+ le++;
+ this.releaseSubMeshes();
+ for (var J = 0; J < z && !(ce >= q); J++)
+ v.a.CreateFromIndices(0, ce, J === z - 1 ? q - ce : le, this), ce += le;
+ this.synchronizeInstances();
+ }
+ }, w.prototype.setVerticesData = function(z, q, le, ce) {
+ if (le === void 0 && (le = !1), this._geometry)
+ this._geometry.setVerticesData(z, q, le, ce);
+ else {
+ var J = new E.a();
+ J.set(q, z);
+ var H = this.getScene();
+ new A.a(A.a.RandomId(), H, J, le, this);
+ }
+ return this;
+ }, w.prototype.removeVerticesData = function(z) {
+ this._geometry && this._geometry.removeVerticesData(z);
+ }, w.prototype.markVerticesDataAsUpdatable = function(z, q) {
+ q === void 0 && (q = !0);
+ var le = this.getVertexBuffer(z);
+ le && le.isUpdatable() !== q && this.setVerticesData(z, this.getVerticesData(z), q);
+ }, w.prototype.setVerticesBuffer = function(z) {
+ return this._geometry || (this._geometry = A.a.CreateGeometryForMesh(this)), this._geometry.setVerticesBuffer(z), this;
+ }, w.prototype.updateVerticesData = function(z, q, le, ce) {
+ return this._geometry ? (ce ? (this.makeGeometryUnique(), this.updateVerticesData(z, q, le, !1)) : this._geometry.updateVerticesData(z, q, le), this) : this;
+ }, w.prototype.updateMeshPositions = function(z, q) {
+ q === void 0 && (q = !0);
+ var le = this.getVerticesData(u.b.PositionKind);
+ if (!le)
+ return this;
+ if (z(le), this.updateVerticesData(u.b.PositionKind, le, !1, !1), q) {
+ var ce = this.getIndices(), J = this.getVerticesData(u.b.NormalKind);
+ if (!J)
+ return this;
+ E.a.ComputeNormals(le, ce, J), this.updateVerticesData(u.b.NormalKind, J, !1, !1);
+ }
+ return this;
+ }, w.prototype.makeGeometryUnique = function() {
+ if (!this._geometry)
+ return this;
+ if (this._geometry.meshes.length === 1)
+ return this;
+ var z = this._geometry, q = this._geometry.copy(A.a.RandomId());
+ return z.releaseForMesh(this, !0), q.applyToMesh(this), this;
+ }, w.prototype.setIndices = function(z, q, le) {
+ if (q === void 0 && (q = null), le === void 0 && (le = !1), this._geometry)
+ this._geometry.setIndices(z, q, le);
+ else {
+ var ce = new E.a();
+ ce.indices = z;
+ var J = this.getScene();
+ new A.a(A.a.RandomId(), J, ce, le, this);
+ }
+ return this;
+ }, w.prototype.updateIndices = function(z, q, le) {
+ return le === void 0 && (le = !1), this._geometry ? (this._geometry.updateIndices(z, q, le), this) : this;
+ }, w.prototype.toLeftHanded = function() {
+ return this._geometry ? (this._geometry.toLeftHanded(), this) : this;
+ }, w.prototype._bind = function(z, q, le) {
+ if (!this._geometry)
+ return this;
+ var ce, J = this.getScene().getEngine();
+ if (this._unIndexed)
+ ce = null;
+ else
+ switch (le) {
+ case d.a.PointFillMode:
+ ce = null;
+ break;
+ case d.a.WireFrameFillMode:
+ ce = z._getLinesIndexBuffer(this.getIndices(), J);
+ break;
+ default:
+ case d.a.TriangleFillMode:
+ ce = this._geometry.getIndexBuffer();
+ }
+ return this._geometry._bind(q, ce), this;
+ }, w.prototype._draw = function(z, q, le) {
+ if (!this._geometry || !this._geometry.getVertexBuffers() || !this._unIndexed && !this._geometry.getIndexBuffer())
+ return this;
+ this._internalMeshDataInfo._onBeforeDrawObservable && this._internalMeshDataInfo._onBeforeDrawObservable.notifyObservers(this);
+ var ce = this.getScene().getEngine();
+ return this._unIndexed || q == d.a.PointFillMode ? ce.drawArraysType(q, z.verticesStart, z.verticesCount, le) : q == d.a.WireFrameFillMode ? ce.drawElementsType(q, 0, z._linesIndexCount, le) : ce.drawElementsType(q, z.indexStart, z.indexCount, le), this;
+ }, w.prototype.registerBeforeRender = function(z) {
+ return this.onBeforeRenderObservable.add(z), this;
+ }, w.prototype.unregisterBeforeRender = function(z) {
+ return this.onBeforeRenderObservable.removeCallback(z), this;
+ }, w.prototype.registerAfterRender = function(z) {
+ return this.onAfterRenderObservable.add(z), this;
+ }, w.prototype.unregisterAfterRender = function(z) {
+ return this.onAfterRenderObservable.removeCallback(z), this;
+ }, w.prototype._getInstancesRenderList = function(z, q) {
+ if (q === void 0 && (q = !1), this._instanceDataStorage.isFrozen && this._instanceDataStorage.previousBatch)
+ return this._instanceDataStorage.previousBatch;
+ var le = this.getScene(), ce = le._isInIntermediateRendering(), J = ce ? this._internalAbstractMeshDataInfo._onlyForInstancesIntermediate : this._internalAbstractMeshDataInfo._onlyForInstances, H = this._instanceDataStorage.batchCache;
+ if (H.mustReturn = !1, H.renderSelf[z] = q || !J && this.isEnabled() && this.isVisible, H.visibleInstances[z] = null, this._instanceDataStorage.visibleInstances && !q) {
+ var X = this._instanceDataStorage.visibleInstances, ne = le.getRenderId(), Q = ce ? X.intermediateDefaultRenderId : X.defaultRenderId;
+ H.visibleInstances[z] = X[ne], !H.visibleInstances[z] && Q && (H.visibleInstances[z] = X[Q]);
+ }
+ return H.hardwareInstancedRendering[z] = !q && this._instanceDataStorage.hardwareInstancedRendering && H.visibleInstances[z] !== null && H.visibleInstances[z] !== void 0, this._instanceDataStorage.previousBatch = H, H;
+ }, w.prototype._renderWithInstances = function(z, q, le, ce, J) {
+ var H = le.visibleInstances[z._id];
+ if (!H)
+ return this;
+ for (var X = this._instanceDataStorage, ne = X.instancesBufferSize, Q = X.instancesBuffer, $ = 16 * (H.length + 1) * 4; X.instancesBufferSize < $; )
+ X.instancesBufferSize *= 2;
+ X.instancesData && ne == X.instancesBufferSize || (X.instancesData = new Float32Array(X.instancesBufferSize / 4));
+ var me = 0, ye = 0, be = le.renderSelf[z._id], ge = !Q || ne !== X.instancesBufferSize;
+ if (this._instanceDataStorage.manualUpdate || X.isFrozen && !ge)
+ ye = (be ? 1 : 0) + H.length;
+ else {
+ var Te = this._effectiveMesh.getWorldMatrix();
+ if (be && (Te.copyToArray(X.instancesData, me), me += 16, ye++), H)
+ for (var Re = 0; Re < H.length; Re++)
+ H[Re].getWorldMatrix().copyToArray(X.instancesData, me), me += 16, ye++;
+ }
+ return ge ? (Q && Q.dispose(), Q = new u.a(J, X.instancesData, !0, 16, !1, !0), X.instancesBuffer = Q, this.setVerticesBuffer(Q.createVertexBuffer("world0", 0, 4)), this.setVerticesBuffer(Q.createVertexBuffer("world1", 4, 4)), this.setVerticesBuffer(Q.createVertexBuffer("world2", 8, 4)), this.setVerticesBuffer(Q.createVertexBuffer("world3", 12, 4))) : this._instanceDataStorage.isFrozen || Q.updateDirectly(X.instancesData, 0, ye), this._processInstancedBuffers(H, be), this.getScene()._activeIndices.addCount(z.indexCount * ye, !1), this._bind(z, ce, q), this._draw(z, q, ye), J.unbindInstanceAttributes(), this;
+ }, w.prototype._renderWithThinInstances = function(z, q, le, ce) {
+ var J, H, X = (H = (J = this._thinInstanceDataStorage) === null || J === void 0 ? void 0 : J.instancesCount) !== null && H !== void 0 ? H : 0;
+ this.getScene()._activeIndices.addCount(z.indexCount * X, !1), this._bind(z, le, q), this._draw(z, q, X), ce.unbindInstanceAttributes();
+ }, w.prototype._processInstancedBuffers = function(z, q) {
+ }, w.prototype._processRendering = function(z, q, le, ce, J, H, X, ne) {
+ var Q = this.getScene(), $ = Q.getEngine();
+ if (H && q.getRenderingMesh().hasThinInstances)
+ return this._renderWithThinInstances(q, ce, le, $), this;
+ if (H)
+ this._renderWithInstances(q, ce, J, le, $);
+ else {
+ var me = 0;
+ J.renderSelf[q._id] && (X && X(!1, z._effectiveMesh.getWorldMatrix(), ne), me++, this._draw(q, ce, this._instanceDataStorage.overridenInstanceCount));
+ var ye = J.visibleInstances[q._id];
+ if (ye) {
+ var be = ye.length;
+ me += be;
+ for (var ge = 0; ge < be; ge++) {
+ var Te = ye[ge].getWorldMatrix();
+ X && X(!0, Te, ne), this._draw(q, ce);
+ }
+ }
+ Q._activeIndices.addCount(q.indexCount * me, !1);
+ }
+ return this;
+ }, w.prototype._rebuild = function() {
+ this._instanceDataStorage.instancesBuffer && (this._instanceDataStorage.instancesBuffer.dispose(), this._instanceDataStorage.instancesBuffer = null), ee.prototype._rebuild.call(this);
+ }, w.prototype._freeze = function() {
+ if (this.subMeshes) {
+ for (var z = 0; z < this.subMeshes.length; z++)
+ this._getInstancesRenderList(z);
+ this._effectiveMaterial = null, this._instanceDataStorage.isFrozen = !0;
+ }
+ }, w.prototype._unFreeze = function() {
+ this._instanceDataStorage.isFrozen = !1, this._instanceDataStorage.previousBatch = null;
+ }, w.prototype.render = function(z, q, le) {
+ var ce = this.getScene();
+ if (this._internalAbstractMeshDataInfo._isActiveIntermediate ? this._internalAbstractMeshDataInfo._isActiveIntermediate = !1 : this._internalAbstractMeshDataInfo._isActive = !1, this._checkOcclusionQuery())
+ return this;
+ var J = this._getInstancesRenderList(z._id, !!le);
+ if (J.mustReturn)
+ return this;
+ if (!this._geometry || !this._geometry.getVertexBuffers() || !this._unIndexed && !this._geometry.getIndexBuffer())
+ return this;
+ this._internalMeshDataInfo._onBeforeRenderObservable && this._internalMeshDataInfo._onBeforeRenderObservable.notifyObservers(this);
+ var H, X = ce.getEngine(), ne = J.hardwareInstancedRendering[z._id] || z.getRenderingMesh().hasThinInstances, Q = this._instanceDataStorage, $ = z.getMaterial();
+ if (!$)
+ return this;
+ if (!Q.isFrozen || !this._effectiveMaterial || this._effectiveMaterial !== $) {
+ if ($._storeEffectOnSubMeshes) {
+ if (!$.isReadyForSubMesh(this, z, ne))
+ return this;
+ } else if (!$.isReady(this, ne))
+ return this;
+ this._effectiveMaterial = $;
+ }
+ q && X.setAlphaMode(this._effectiveMaterial.alphaMode), H = this._effectiveMaterial._storeEffectOnSubMeshes ? z.effect : this._effectiveMaterial.getEffect();
+ for (var me = 0, ye = ce._beforeRenderingMeshStage; me < ye.length; me++)
+ ye[me].action(this, z, J, H);
+ if (!H)
+ return this;
+ var be, ge = le || this._effectiveMesh;
+ if (Q.isFrozen || !this._effectiveMaterial.backFaceCulling && this.overrideMaterialSideOrientation === null)
+ be = Q.sideOrientation;
+ else {
+ var Te = ge._getWorldMatrixDeterminant();
+ (be = this.overrideMaterialSideOrientation) == null && (be = this._effectiveMaterial.sideOrientation), Te < 0 && (be = be === d.a.ClockWiseSideOrientation ? d.a.CounterClockWiseSideOrientation : d.a.ClockWiseSideOrientation), Q.sideOrientation = be;
+ }
+ var Re = this._effectiveMaterial._preBind(H, be);
+ this._effectiveMaterial.forceDepthWrite && X.setDepthWrite(!0);
+ var Se = ce.forcePointsCloud ? d.a.PointFillMode : ce.forceWireframe ? d.a.WireFrameFillMode : this._effectiveMaterial.fillMode;
+ this._internalMeshDataInfo._onBeforeBindObservable && this._internalMeshDataInfo._onBeforeBindObservable.notifyObservers(this), ne || this._bind(z, H, Se);
+ var Ne = ge.getWorldMatrix();
+ this._effectiveMaterial._storeEffectOnSubMeshes ? this._effectiveMaterial.bindForSubMesh(Ne, this, z) : this._effectiveMaterial.bind(Ne, this), !this._effectiveMaterial.backFaceCulling && this._effectiveMaterial.separateCullingPass && (X.setState(!0, this._effectiveMaterial.zOffset, !1, !Re), this._processRendering(this, z, H, Se, J, ne, this._onBeforeDraw, this._effectiveMaterial), X.setState(!0, this._effectiveMaterial.zOffset, !1, Re)), this._processRendering(this, z, H, Se, J, ne, this._onBeforeDraw, this._effectiveMaterial), this._effectiveMaterial.unbind();
+ for (var ze = 0, Ye = ce._afterRenderingMeshStage; ze < Ye.length; ze++)
+ Ye[ze].action(this, z, J, H);
+ return this._internalMeshDataInfo._onAfterRenderObservable && this._internalMeshDataInfo._onAfterRenderObservable.notifyObservers(this), this;
+ }, w.prototype._onBeforeDraw = function(z, q, le) {
+ z && le && le.bindOnlyWorldMatrix(q);
+ }, w.prototype.cleanMatrixWeights = function() {
+ this.isVerticesDataPresent(u.b.MatricesWeightsKind) && (this.isVerticesDataPresent(u.b.MatricesWeightsExtraKind) ? this.normalizeSkinWeightsAndExtra() : this.normalizeSkinFourWeights());
+ }, w.prototype.normalizeSkinFourWeights = function() {
+ for (var z = this.getVerticesData(u.b.MatricesWeightsKind), q = z.length, le = 0; le < q; le += 4) {
+ var ce = z[le] + z[le + 1] + z[le + 2] + z[le + 3];
+ if (ce === 0)
+ z[le] = 1;
+ else {
+ var J = 1 / ce;
+ z[le] *= J, z[le + 1] *= J, z[le + 2] *= J, z[le + 3] *= J;
+ }
+ }
+ this.setVerticesData(u.b.MatricesWeightsKind, z);
+ }, w.prototype.normalizeSkinWeightsAndExtra = function() {
+ for (var z = this.getVerticesData(u.b.MatricesWeightsExtraKind), q = this.getVerticesData(u.b.MatricesWeightsKind), le = q.length, ce = 0; ce < le; ce += 4) {
+ var J = q[ce] + q[ce + 1] + q[ce + 2] + q[ce + 3];
+ if ((J += z[ce] + z[ce + 1] + z[ce + 2] + z[ce + 3]) === 0)
+ q[ce] = 1;
+ else {
+ var H = 1 / J;
+ q[ce] *= H, q[ce + 1] *= H, q[ce + 2] *= H, q[ce + 3] *= H, z[ce] *= H, z[ce + 1] *= H, z[ce + 2] *= H, z[ce + 3] *= H;
+ }
+ }
+ this.setVerticesData(u.b.MatricesWeightsKind, q), this.setVerticesData(u.b.MatricesWeightsKind, z);
+ }, w.prototype.validateSkinning = function() {
+ var z = this.getVerticesData(u.b.MatricesWeightsExtraKind), q = this.getVerticesData(u.b.MatricesWeightsKind);
+ if (q === null || this.skeleton == null)
+ return { skinned: !1, valid: !0, report: "not skinned" };
+ for (var le = q.length, ce = 0, J = 0, H = 0, X = 0, ne = z === null ? 4 : 8, Q = new Array(), $ = 0; $ <= ne; $++)
+ Q[$] = 0;
+ for ($ = 0; $ < le; $ += 4) {
+ for (var me = q[$], ye = me, be = ye === 0 ? 0 : 1, ge = 1; ge < ne; ge++) {
+ var Te = ge < 4 ? q[$ + ge] : z[$ + ge - 4];
+ Te > me && ce++, Te !== 0 && be++, ye += Te, me = Te;
+ }
+ if (Q[be]++, be > H && (H = be), ye === 0)
+ J++;
+ else {
+ var Re = 1 / ye, Se = 0;
+ for (ge = 0; ge < ne; ge++)
+ Se += ge < 4 ? Math.abs(q[$ + ge] - q[$ + ge] * Re) : Math.abs(z[$ + ge - 4] - z[$ + ge - 4] * Re);
+ Se > 1e-3 && X++;
+ }
+ }
+ var Ne = this.skeleton.bones.length, ze = this.getVerticesData(u.b.MatricesIndicesKind), Ye = this.getVerticesData(u.b.MatricesIndicesExtraKind), He = 0;
+ for ($ = 0; $ < le; $ += 4)
+ for (ge = 0; ge < ne; ge++) {
+ var Xe = ge < 4 ? ze[$ + ge] : Ye[$ + ge - 4];
+ (Xe >= Ne || Xe < 0) && He++;
+ }
+ return { skinned: !0, valid: J === 0 && X === 0 && He === 0, report: "Number of Weights = " + le / 4 + `
+Maximum influences = ` + H + `
+Missing Weights = ` + J + `
+Not Sorted = ` + ce + `
+Not Normalized = ` + X + `
+WeightCounts = [` + Q + `]
+Number of bones = ` + Ne + `
+Bad Bone Indices = ` + He };
+ }, w.prototype._checkDelayState = function() {
+ var z = this.getScene();
+ return this._geometry ? this._geometry.load(z) : this.delayLoadState === N.a.DELAYLOADSTATE_NOTLOADED && (this.delayLoadState = N.a.DELAYLOADSTATE_LOADING, this._queueLoad(z)), this;
+ }, w.prototype._queueLoad = function(z) {
+ var q = this;
+ z._addPendingData(this);
+ var le = this.delayLoadingFile.indexOf(".babylonbinarymeshdata") !== -1;
+ return P.b.LoadFile(this.delayLoadingFile, function(ce) {
+ ce instanceof ArrayBuffer ? q._delayLoadingFunction(ce, q) : q._delayLoadingFunction(JSON.parse(ce), q), q.instances.forEach(function(J) {
+ J.refreshBoundingInfo(), J._syncSubMeshes();
+ }), q.delayLoadState = N.a.DELAYLOADSTATE_LOADED, z._removePendingData(q);
+ }, function() {
+ }, z.offlineProvider, le), this;
+ }, w.prototype.isInFrustum = function(z) {
+ return this.delayLoadState !== N.a.DELAYLOADSTATE_LOADING && !!ee.prototype.isInFrustum.call(this, z) && (this._checkDelayState(), !0);
+ }, w.prototype.setMaterialByID = function(z) {
+ var q, le = this.getScene().materials;
+ for (q = le.length - 1; q > -1; q--)
+ if (le[q].id === z)
+ return this.material = le[q], this;
+ var ce = this.getScene().multiMaterials;
+ for (q = ce.length - 1; q > -1; q--)
+ if (ce[q].id === z)
+ return this.material = ce[q], this;
+ return this;
+ }, w.prototype.getAnimatables = function() {
+ var z = new Array();
+ return this.material && z.push(this.material), this.skeleton && z.push(this.skeleton), z;
+ }, w.prototype.bakeTransformIntoVertices = function(z) {
+ if (!this.isVerticesDataPresent(u.b.PositionKind))
+ return this;
+ var q = this.subMeshes.splice(0);
+ this._resetPointsArrayCache();
+ var le, ce = this.getVerticesData(u.b.PositionKind), J = new Array();
+ for (le = 0; le < ce.length; le += 3)
+ x.e.TransformCoordinates(x.e.FromArray(ce, le), z).toArray(J, le);
+ if (this.setVerticesData(u.b.PositionKind, J, this.getVertexBuffer(u.b.PositionKind).isUpdatable()), this.isVerticesDataPresent(u.b.NormalKind)) {
+ for (ce = this.getVerticesData(u.b.NormalKind), J = [], le = 0; le < ce.length; le += 3)
+ x.e.TransformNormal(x.e.FromArray(ce, le), z).normalize().toArray(J, le);
+ this.setVerticesData(u.b.NormalKind, J, this.getVertexBuffer(u.b.NormalKind).isUpdatable());
+ }
+ return z.m[0] * z.m[5] * z.m[10] < 0 && this.flipFaces(), this.releaseSubMeshes(), this.subMeshes = q, this;
+ }, w.prototype.bakeCurrentTransformIntoVertices = function(z) {
+ return z === void 0 && (z = !0), this.bakeTransformIntoVertices(this.computeWorldMatrix(!0)), this.resetLocalMatrix(z), this;
+ }, Object.defineProperty(w.prototype, "_positions", { get: function() {
+ return this._geometry ? this._geometry._positions : null;
+ }, enumerable: !1, configurable: !0 }), w.prototype._resetPointsArrayCache = function() {
+ return this._geometry && this._geometry._resetPointsArrayCache(), this;
+ }, w.prototype._generatePointsArray = function() {
+ return !!this._geometry && this._geometry._generatePointsArray();
+ }, w.prototype.clone = function(z, q, le, ce) {
+ return z === void 0 && (z = ""), q === void 0 && (q = null), ce === void 0 && (ce = !0), new w(z, this.getScene(), q, this, le, ce);
+ }, w.prototype.dispose = function(z, q) {
+ q === void 0 && (q = !1), this.morphTargetManager = null, this._geometry && this._geometry.releaseForMesh(this, !0);
+ var le = this._internalMeshDataInfo;
+ if (le._onBeforeDrawObservable && le._onBeforeDrawObservable.clear(), le._onBeforeBindObservable && le._onBeforeBindObservable.clear(), le._onBeforeRenderObservable && le._onBeforeRenderObservable.clear(), le._onAfterRenderObservable && le._onAfterRenderObservable.clear(), this._scene.useClonedMeshMap) {
+ if (le.meshMap)
+ for (var ce in le.meshMap)
+ (X = le.meshMap[ce]) && (X._internalMeshDataInfo._source = null, le.meshMap[ce] = void 0);
+ le._source && le._source._internalMeshDataInfo.meshMap && (le._source._internalMeshDataInfo.meshMap[this.uniqueId] = void 0);
+ } else
+ for (var J = 0, H = this.getScene().meshes; J < H.length; J++) {
+ var X;
+ (X = H[J])._internalMeshDataInfo && X._internalMeshDataInfo._source && X._internalMeshDataInfo._source === this && (X._internalMeshDataInfo._source = null);
+ }
+ le._source = null, this._disposeInstanceSpecificData(), this._disposeThinInstanceSpecificData(), ee.prototype.dispose.call(this, z, q);
+ }, w.prototype._disposeInstanceSpecificData = function() {
+ }, w.prototype._disposeThinInstanceSpecificData = function() {
+ }, w.prototype.applyDisplacementMap = function(z, q, le, ce, J, H, X) {
+ var ne = this;
+ X === void 0 && (X = !1);
+ var Q = this.getScene();
+ return P.b.LoadImage(z, function($) {
+ var me = $.width, ye = $.height, be = oe.a.CreateCanvas(me, ye).getContext("2d");
+ be.drawImage($, 0, 0);
+ var ge = be.getImageData(0, 0, me, ye).data;
+ ne.applyDisplacementMapFromBuffer(ge, me, ye, q, le, J, H, X), ce && ce(ne);
+ }, function() {
+ }, Q.offlineProvider), this;
+ }, w.prototype.applyDisplacementMapFromBuffer = function(z, q, le, ce, J, H, X, ne) {
+ if (ne === void 0 && (ne = !1), !this.isVerticesDataPresent(u.b.PositionKind) || !this.isVerticesDataPresent(u.b.NormalKind) || !this.isVerticesDataPresent(u.b.UVKind))
+ return B.a.Warn("Cannot call applyDisplacementMap: Given mesh is not complete. Position, Normal or UV are missing"), this;
+ var Q = this.getVerticesData(u.b.PositionKind, !0, !0), $ = this.getVerticesData(u.b.NormalKind), me = this.getVerticesData(u.b.UVKind), ye = x.e.Zero(), be = x.e.Zero(), ge = x.d.Zero();
+ H = H || x.d.Zero(), X = X || new x.d(1, 1);
+ for (var Te = 0; Te < Q.length; Te += 3) {
+ x.e.FromArrayToRef(Q, Te, ye), x.e.FromArrayToRef($, Te, be), x.d.FromArrayToRef(me, Te / 3 * 2, ge);
+ var Re = 4 * ((Math.abs(ge.x * X.x + H.x % 1) * (q - 1) % q | 0) + (Math.abs(ge.y * X.y + H.y % 1) * (le - 1) % le | 0) * q), Se = 0.3 * (z[Re] / 255) + 0.59 * (z[Re + 1] / 255) + 0.11 * (z[Re + 2] / 255);
+ be.normalize(), be.scaleInPlace(ce + (J - ce) * Se), (ye = ye.add(be)).toArray(Q, Te);
+ }
+ return E.a.ComputeNormals(Q, this.getIndices(), $), ne ? (this.setVerticesData(u.b.PositionKind, Q), this.setVerticesData(u.b.NormalKind, $)) : (this.updateVerticesData(u.b.PositionKind, Q), this.updateVerticesData(u.b.NormalKind, $)), this;
+ }, w.prototype.convertToFlatShadedMesh = function() {
+ var z, q, le = this.getVerticesDataKinds(), ce = {}, J = {}, H = {}, X = !1;
+ for (z = 0; z < le.length; z++) {
+ q = le[z];
+ var ne = this.getVertexBuffer(q);
+ q !== u.b.NormalKind ? (ce[q] = ne, J[q] = ce[q].getData(), H[q] = []) : (X = ne.isUpdatable(), le.splice(z, 1), z--);
+ }
+ var Q, $ = this.subMeshes.slice(0), me = this.getIndices(), ye = this.getTotalIndices();
+ for (Q = 0; Q < ye; Q++) {
+ var be = me[Q];
+ for (z = 0; z < le.length; z++)
+ for (var ge = ce[q = le[z]].getStrideSize(), Te = 0; Te < ge; Te++)
+ H[q].push(J[q][be * ge + Te]);
+ }
+ var Re = [], Se = H[u.b.PositionKind];
+ for (Q = 0; Q < ye; Q += 3) {
+ me[Q] = Q, me[Q + 1] = Q + 1, me[Q + 2] = Q + 2;
+ for (var Ne = x.e.FromArray(Se, 3 * Q), ze = x.e.FromArray(Se, 3 * (Q + 1)), Ye = x.e.FromArray(Se, 3 * (Q + 2)), He = Ne.subtract(ze), Xe = Ye.subtract(ze), Ze = x.e.Normalize(x.e.Cross(He, Xe)), je = 0; je < 3; je++)
+ Re.push(Ze.x), Re.push(Ze.y), Re.push(Ze.z);
+ }
+ for (this.setIndices(me), this.setVerticesData(u.b.NormalKind, Re, X), z = 0; z < le.length; z++)
+ q = le[z], this.setVerticesData(q, H[q], ce[q].isUpdatable());
+ this.releaseSubMeshes();
+ for (var it = 0; it < $.length; it++) {
+ var et = $[it];
+ v.a.AddToMesh(et.materialIndex, et.indexStart, et.indexCount, et.indexStart, et.indexCount, this);
+ }
+ return this.synchronizeInstances(), this;
+ }, w.prototype.convertToUnIndexedMesh = function() {
+ var z, q, le = this.getVerticesDataKinds(), ce = {}, J = {}, H = {};
+ for (z = 0; z < le.length; z++) {
+ q = le[z];
+ var X = this.getVertexBuffer(q);
+ ce[q] = X, J[q] = ce[q].getData(), H[q] = [];
+ }
+ var ne, Q = this.subMeshes.slice(0), $ = this.getIndices(), me = this.getTotalIndices();
+ for (ne = 0; ne < me; ne++) {
+ var ye = $[ne];
+ for (z = 0; z < le.length; z++)
+ for (var be = ce[q = le[z]].getStrideSize(), ge = 0; ge < be; ge++)
+ H[q].push(J[q][ye * be + ge]);
+ }
+ for (ne = 0; ne < me; ne += 3)
+ $[ne] = ne, $[ne + 1] = ne + 1, $[ne + 2] = ne + 2;
+ for (this.setIndices($), z = 0; z < le.length; z++)
+ q = le[z], this.setVerticesData(q, H[q], ce[q].isUpdatable());
+ this.releaseSubMeshes();
+ for (var Te = 0; Te < Q.length; Te++) {
+ var Re = Q[Te];
+ v.a.AddToMesh(Re.materialIndex, Re.indexStart, Re.indexCount, Re.indexStart, Re.indexCount, this);
+ }
+ return this._unIndexed = !0, this.synchronizeInstances(), this;
+ }, w.prototype.flipFaces = function(z) {
+ z === void 0 && (z = !1);
+ var q, le, ce = E.a.ExtractFromMesh(this);
+ if (z && this.isVerticesDataPresent(u.b.NormalKind) && ce.normals)
+ for (q = 0; q < ce.normals.length; q++)
+ ce.normals[q] *= -1;
+ if (ce.indices)
+ for (q = 0; q < ce.indices.length; q += 3)
+ le = ce.indices[q + 1], ce.indices[q + 1] = ce.indices[q + 2], ce.indices[q + 2] = le;
+ return ce.applyToMesh(this, this.isVertexBufferUpdatable(u.b.PositionKind)), this;
+ }, w.prototype.increaseVertices = function(z) {
+ var q = E.a.ExtractFromMesh(this), le = q.uvs, ce = q.indices, J = q.positions, H = q.normals;
+ if (ce && J && H && le) {
+ for (var X, ne, Q = z + 1, $ = new Array(), me = 0; me < Q + 1; me++)
+ $[me] = new Array();
+ var ye, be = new x.e(0, 0, 0), ge = new x.e(0, 0, 0), Te = new x.d(0, 0), Re = new Array(), Se = new Array(), Ne = new Array(), ze = J.length, Ye = le.length;
+ for (me = 0; me < ce.length; me += 3) {
+ Se[0] = ce[me], Se[1] = ce[me + 1], Se[2] = ce[me + 2];
+ for (var He = 0; He < 3; He++)
+ if (X = Se[He], ne = Se[(He + 1) % 3], Ne[X] === void 0 && Ne[ne] === void 0 ? (Ne[X] = new Array(), Ne[ne] = new Array()) : (Ne[X] === void 0 && (Ne[X] = new Array()), Ne[ne] === void 0 && (Ne[ne] = new Array())), Ne[X][ne] === void 0 && Ne[ne][X] === void 0) {
+ Ne[X][ne] = [], be.x = (J[3 * ne] - J[3 * X]) / Q, be.y = (J[3 * ne + 1] - J[3 * X + 1]) / Q, be.z = (J[3 * ne + 2] - J[3 * X + 2]) / Q, ge.x = (H[3 * ne] - H[3 * X]) / Q, ge.y = (H[3 * ne + 1] - H[3 * X + 1]) / Q, ge.z = (H[3 * ne + 2] - H[3 * X + 2]) / Q, Te.x = (le[2 * ne] - le[2 * X]) / Q, Te.y = (le[2 * ne + 1] - le[2 * X + 1]) / Q, Ne[X][ne].push(X);
+ for (var Xe = 1; Xe < Q; Xe++)
+ Ne[X][ne].push(J.length / 3), J[ze] = J[3 * X] + Xe * be.x, H[ze++] = H[3 * X] + Xe * ge.x, J[ze] = J[3 * X + 1] + Xe * be.y, H[ze++] = H[3 * X + 1] + Xe * ge.y, J[ze] = J[3 * X + 2] + Xe * be.z, H[ze++] = H[3 * X + 2] + Xe * ge.z, le[Ye++] = le[2 * X] + Xe * Te.x, le[Ye++] = le[2 * X + 1] + Xe * Te.y;
+ Ne[X][ne].push(ne), Ne[ne][X] = new Array(), ye = Ne[X][ne].length;
+ for (var Ze = 0; Ze < ye; Ze++)
+ Ne[ne][X][Ze] = Ne[X][ne][ye - 1 - Ze];
+ }
+ for ($[0][0] = ce[me], $[1][0] = Ne[ce[me]][ce[me + 1]][1], $[1][1] = Ne[ce[me]][ce[me + 2]][1], Xe = 2; Xe < Q; Xe++)
+ for ($[Xe][0] = Ne[ce[me]][ce[me + 1]][Xe], $[Xe][Xe] = Ne[ce[me]][ce[me + 2]][Xe], be.x = (J[3 * $[Xe][Xe]] - J[3 * $[Xe][0]]) / Xe, be.y = (J[3 * $[Xe][Xe] + 1] - J[3 * $[Xe][0] + 1]) / Xe, be.z = (J[3 * $[Xe][Xe] + 2] - J[3 * $[Xe][0] + 2]) / Xe, ge.x = (H[3 * $[Xe][Xe]] - H[3 * $[Xe][0]]) / Xe, ge.y = (H[3 * $[Xe][Xe] + 1] - H[3 * $[Xe][0] + 1]) / Xe, ge.z = (H[3 * $[Xe][Xe] + 2] - H[3 * $[Xe][0] + 2]) / Xe, Te.x = (le[2 * $[Xe][Xe]] - le[2 * $[Xe][0]]) / Xe, Te.y = (le[2 * $[Xe][Xe] + 1] - le[2 * $[Xe][0] + 1]) / Xe, He = 1; He < Xe; He++)
+ $[Xe][He] = J.length / 3, J[ze] = J[3 * $[Xe][0]] + He * be.x, H[ze++] = H[3 * $[Xe][0]] + He * ge.x, J[ze] = J[3 * $[Xe][0] + 1] + He * be.y, H[ze++] = H[3 * $[Xe][0] + 1] + He * ge.y, J[ze] = J[3 * $[Xe][0] + 2] + He * be.z, H[ze++] = H[3 * $[Xe][0] + 2] + He * ge.z, le[Ye++] = le[2 * $[Xe][0]] + He * Te.x, le[Ye++] = le[2 * $[Xe][0] + 1] + He * Te.y;
+ for ($[Q] = Ne[ce[me + 1]][ce[me + 2]], Re.push($[0][0], $[1][0], $[1][1]), Xe = 1; Xe < Q; Xe++) {
+ for (He = 0; He < Xe; He++)
+ Re.push($[Xe][He], $[Xe + 1][He], $[Xe + 1][He + 1]), Re.push($[Xe][He], $[Xe + 1][He + 1], $[Xe][He + 1]);
+ Re.push($[Xe][He], $[Xe + 1][He], $[Xe + 1][He + 1]);
+ }
+ }
+ q.indices = Re, q.applyToMesh(this, this.isVertexBufferUpdatable(u.b.PositionKind));
+ } else
+ B.a.Warn("VertexData contains null entries");
+ }, w.prototype.forceSharedVertices = function() {
+ var z = E.a.ExtractFromMesh(this), q = z.uvs, le = z.indices, ce = z.positions, J = z.colors;
+ if (le === void 0 || ce === void 0 || le === null || ce === null)
+ B.a.Warn("VertexData contains empty entries");
+ else {
+ for (var H, X, ne = new Array(), Q = new Array(), $ = new Array(), me = new Array(), ye = new Array(), be = 0, ge = {}, Te = 0; Te < le.length; Te += 3) {
+ X = [le[Te], le[Te + 1], le[Te + 2]], ye = new Array();
+ for (var Re = 0; Re < 3; Re++) {
+ ye[Re] = "";
+ for (var Se = 0; Se < 3; Se++)
+ Math.abs(ce[3 * X[Re] + Se]) < 1e-8 && (ce[3 * X[Re] + Se] = 0), ye[Re] += ce[3 * X[Re] + Se] + "|";
+ }
+ if (ye[0] != ye[1] && ye[0] != ye[2] && ye[1] != ye[2])
+ for (Re = 0; Re < 3; Re++) {
+ if ((H = ge[ye[Re]]) === void 0) {
+ for (ge[ye[Re]] = be, H = be++, Se = 0; Se < 3; Se++)
+ ne.push(ce[3 * X[Re] + Se]);
+ if (J != null)
+ for (Se = 0; Se < 4; Se++)
+ me.push(J[4 * X[Re] + Se]);
+ if (q != null)
+ for (Se = 0; Se < 2; Se++)
+ $.push(q[2 * X[Re] + Se]);
+ }
+ Q.push(H);
+ }
+ }
+ var Ne = new Array();
+ E.a.ComputeNormals(ne, Q, Ne), z.positions = ne, z.indices = Q, z.normals = Ne, q != null && (z.uvs = $), J != null && (z.colors = me), z.applyToMesh(this, this.isVertexBufferUpdatable(u.b.PositionKind));
+ }
+ }, w._instancedMeshFactory = function(z, q) {
+ throw j.a.WarnImport("InstancedMesh");
+ }, w._PhysicsImpostorParser = function(z, q, le) {
+ throw j.a.WarnImport("PhysicsImpostor");
+ }, w.prototype.createInstance = function(z) {
+ var q = this.geometry;
+ if (q && q.meshes.length > 1)
+ for (var le = 0, ce = q.meshes.slice(0); le < ce.length; le++) {
+ var J = ce[le];
+ J !== this && J.makeGeometryUnique();
+ }
+ return w._instancedMeshFactory(z, this);
+ }, w.prototype.synchronizeInstances = function() {
+ this._geometry && this._geometry.meshes.length !== 1 && this.instances.length && this.makeGeometryUnique();
+ for (var z = 0; z < this.instances.length; z++)
+ this.instances[z]._syncSubMeshes();
+ return this;
+ }, w.prototype.optimizeIndices = function(z) {
+ var q = this, le = this.getIndices(), ce = this.getVerticesData(u.b.PositionKind);
+ if (!ce || !le)
+ return this;
+ for (var J = new Array(), H = 0; H < ce.length; H += 3)
+ J.push(x.e.FromArray(ce, H));
+ var X = new Array();
+ return P.a.SyncAsyncForLoop(J.length, 40, function(ne) {
+ for (var Q = J.length - 1 - ne, $ = J[Q], me = 0; me < Q; ++me) {
+ var ye = J[me];
+ if ($.equals(ye)) {
+ X[Q] = me;
+ break;
+ }
+ }
+ }, function() {
+ for (var ne = 0; ne < le.length; ++ne)
+ le[ne] = X[le[ne]] || le[ne];
+ var Q = q.subMeshes.slice(0);
+ q.setIndices(le), q.subMeshes = Q, z && z(q);
+ }), this;
+ }, w.prototype.serialize = function(z) {
+ z.name = this.name, z.id = this.id, z.uniqueId = this.uniqueId, z.type = this.getClassName(), C.a && C.a.HasTags(this) && (z.tags = C.a.GetTags(this)), z.position = this.position.asArray(), this.rotationQuaternion ? z.rotationQuaternion = this.rotationQuaternion.asArray() : this.rotation && (z.rotation = this.rotation.asArray()), z.scaling = this.scaling.asArray(), this._postMultiplyPivotMatrix ? z.pivotMatrix = this.getPivotMatrix().asArray() : z.localMatrix = this.getPivotMatrix().asArray(), z.isEnabled = this.isEnabled(!1), z.isVisible = this.isVisible, z.infiniteDistance = this.infiniteDistance, z.pickable = this.isPickable, z.receiveShadows = this.receiveShadows, z.billboardMode = this.billboardMode, z.visibility = this.visibility, z.checkCollisions = this.checkCollisions, z.isBlocker = this.isBlocker, z.overrideMaterialSideOrientation = this.overrideMaterialSideOrientation, this.parent && (z.parentId = this.parent.id), z.isUnIndexed = this.isUnIndexed;
+ var q = this._geometry;
+ if (q) {
+ var le = q.id;
+ z.geometryId = le, z.subMeshes = [];
+ for (var ce = 0; ce < this.subMeshes.length; ce++) {
+ var J = this.subMeshes[ce];
+ z.subMeshes.push({ materialIndex: J.materialIndex, verticesStart: J.verticesStart, verticesCount: J.verticesCount, indexStart: J.indexStart, indexCount: J.indexCount });
+ }
+ }
+ this.material ? this.material.doNotSerialize || (z.materialId = this.material.id) : this.material = null, this.morphTargetManager && (z.morphTargetManagerId = this.morphTargetManager.uniqueId), this.skeleton && (z.skeletonId = this.skeleton.id, z.numBoneInfluencers = this.numBoneInfluencers), this.getScene()._getComponent(W.a.NAME_PHYSICSENGINE) && (ne = this.getPhysicsImpostor()) && (z.physicsMass = ne.getParam("mass"), z.physicsFriction = ne.getParam("friction"), z.physicsRestitution = ne.getParam("mass"), z.physicsImpostor = ne.type), this.metadata && (z.metadata = this.metadata), z.instances = [];
+ for (var H = 0; H < this.instances.length; H++) {
+ var X = this.instances[H];
+ if (!X.doNotSerialize) {
+ var ne, Q = { name: X.name, id: X.id, isEnabled: X.isEnabled(!1), isVisible: X.isVisible, isPickable: X.isPickable, checkCollisions: X.checkCollisions, position: X.position.asArray(), scaling: X.scaling.asArray() };
+ X.parent && (Q.parentId = X.parent.id), X.rotationQuaternion ? Q.rotationQuaternion = X.rotationQuaternion.asArray() : X.rotation && (Q.rotation = X.rotation.asArray()), this.getScene()._getComponent(W.a.NAME_PHYSICSENGINE) && (ne = X.getPhysicsImpostor()) && (Q.physicsMass = ne.getParam("mass"), Q.physicsFriction = ne.getParam("friction"), Q.physicsRestitution = ne.getParam("mass"), Q.physicsImpostor = ne.type), X.metadata && (Q.metadata = X.metadata), z.instances.push(Q), U.a.AppendSerializedAnimations(X, Q), Q.ranges = X.serializeAnimationRanges();
+ }
+ }
+ if (this._thinInstanceDataStorage.instancesCount && this._thinInstanceDataStorage.matrixData && (z.thinInstances = { instancesCount: this._thinInstanceDataStorage.instancesCount, matrixData: P.b.SliceToArray(this._thinInstanceDataStorage.matrixData), matrixBufferSize: this._thinInstanceDataStorage.matrixBufferSize }, this._userThinInstanceBuffersStorage)) {
+ var $ = { data: {}, sizes: {}, strides: {} };
+ for (var me in this._userThinInstanceBuffersStorage.data)
+ $.data[me] = P.b.SliceToArray(this._userThinInstanceBuffersStorage.data[me]), $.sizes[me] = this._userThinInstanceBuffersStorage.sizes[me], $.strides[me] = this._userThinInstanceBuffersStorage.strides[me];
+ z.thinInstances.userThinInstance = $;
+ }
+ U.a.AppendSerializedAnimations(this, z), z.ranges = this.serializeAnimationRanges(), z.layerMask = this.layerMask, z.alphaIndex = this.alphaIndex, z.hasVertexAlpha = this.hasVertexAlpha, z.overlayAlpha = this.overlayAlpha, z.overlayColor = this.overlayColor.asArray(), z.renderOverlay = this.renderOverlay, z.applyFog = this.applyFog, this.actionManager && (z.actions = this.actionManager.serialize(this.name));
+ }, w.prototype._syncGeometryWithMorphTargetManager = function() {
+ if (this.geometry) {
+ this._markSubMeshesAsAttributesDirty();
+ var z = this._internalMeshDataInfo._morphTargetManager;
+ if (z && z.vertexCount) {
+ if (z.vertexCount !== this.getTotalVertices())
+ return B.a.Error("Mesh is incompatible with morph targets. Targets and mesh must all have the same vertices count."), void (this.morphTargetManager = null);
+ for (var q = 0; q < z.numInfluencers; q++) {
+ var le = z.getActiveTarget(q), ce = le.getPositions();
+ if (!ce)
+ return void B.a.Error("Invalid morph target. Target must have positions.");
+ this.geometry.setVerticesData(u.b.PositionKind + q, ce, !1, 3);
+ var J = le.getNormals();
+ J && this.geometry.setVerticesData(u.b.NormalKind + q, J, !1, 3);
+ var H = le.getTangents();
+ H && this.geometry.setVerticesData(u.b.TangentKind + q, H, !1, 3);
+ var X = le.getUVs();
+ X && this.geometry.setVerticesData(u.b.UVKind + "_" + q, X, !1, 2);
+ }
+ } else
+ for (q = 0; this.geometry.isVerticesDataPresent(u.b.PositionKind + q); )
+ this.geometry.removeVerticesData(u.b.PositionKind + q), this.geometry.isVerticesDataPresent(u.b.NormalKind + q) && this.geometry.removeVerticesData(u.b.NormalKind + q), this.geometry.isVerticesDataPresent(u.b.TangentKind + q) && this.geometry.removeVerticesData(u.b.TangentKind + q), this.geometry.isVerticesDataPresent(u.b.UVKind + q) && this.geometry.removeVerticesData(u.b.UVKind + "_" + q), q++;
+ }
+ }, w.Parse = function(z, q, le) {
+ var ce;
+ if ((ce = z.type && z.type === "GroundMesh" ? w._GroundMeshParser(z, q) : new w(z.name, q)).id = z.id, C.a && C.a.AddTagsTo(ce, z.tags), ce.position = x.e.FromArray(z.position), z.metadata !== void 0 && (ce.metadata = z.metadata), z.rotationQuaternion ? ce.rotationQuaternion = x.b.FromArray(z.rotationQuaternion) : z.rotation && (ce.rotation = x.e.FromArray(z.rotation)), ce.scaling = x.e.FromArray(z.scaling), z.localMatrix ? ce.setPreTransformMatrix(x.a.FromArray(z.localMatrix)) : z.pivotMatrix && ce.setPivotMatrix(x.a.FromArray(z.pivotMatrix)), ce.setEnabled(z.isEnabled), ce.isVisible = z.isVisible, ce.infiniteDistance = z.infiniteDistance, ce.showBoundingBox = z.showBoundingBox, ce.showSubMeshesBoundingBox = z.showSubMeshesBoundingBox, z.applyFog !== void 0 && (ce.applyFog = z.applyFog), z.pickable !== void 0 && (ce.isPickable = z.pickable), z.alphaIndex !== void 0 && (ce.alphaIndex = z.alphaIndex), ce.receiveShadows = z.receiveShadows, ce.billboardMode = z.billboardMode, z.visibility !== void 0 && (ce.visibility = z.visibility), ce.checkCollisions = z.checkCollisions, ce.overrideMaterialSideOrientation = z.overrideMaterialSideOrientation, z.isBlocker !== void 0 && (ce.isBlocker = z.isBlocker), ce._shouldGenerateFlatShading = z.useFlatShading, z.freezeWorldMatrix && (ce._waitingData.freezeWorldMatrix = z.freezeWorldMatrix), z.parentId && (ce._waitingParentId = z.parentId), z.actions !== void 0 && (ce._waitingData.actions = z.actions), z.overlayAlpha !== void 0 && (ce.overlayAlpha = z.overlayAlpha), z.overlayColor !== void 0 && (ce.overlayColor = R.a.FromArray(z.overlayColor)), z.renderOverlay !== void 0 && (ce.renderOverlay = z.renderOverlay), ce.isUnIndexed = !!z.isUnIndexed, ce.hasVertexAlpha = z.hasVertexAlpha, z.delayLoadingFile ? (ce.delayLoadState = N.a.DELAYLOADSTATE_NOTLOADED, ce.delayLoadingFile = le + z.delayLoadingFile, ce._boundingInfo = new h.a(x.e.FromArray(z.boundingBoxMinimum), x.e.FromArray(z.boundingBoxMaximum)), z._binaryInfo && (ce._binaryInfo = z._binaryInfo), ce._delayInfo = [], z.hasUVs && ce._delayInfo.push(u.b.UVKind), z.hasUVs2 && ce._delayInfo.push(u.b.UV2Kind), z.hasUVs3 && ce._delayInfo.push(u.b.UV3Kind), z.hasUVs4 && ce._delayInfo.push(u.b.UV4Kind), z.hasUVs5 && ce._delayInfo.push(u.b.UV5Kind), z.hasUVs6 && ce._delayInfo.push(u.b.UV6Kind), z.hasColors && ce._delayInfo.push(u.b.ColorKind), z.hasMatricesIndices && ce._delayInfo.push(u.b.MatricesIndicesKind), z.hasMatricesWeights && ce._delayInfo.push(u.b.MatricesWeightsKind), ce._delayLoadingFunction = A.a._ImportGeometry, T.a.ForceFullSceneLoadingForIncremental && ce._checkDelayState()) : A.a._ImportGeometry(z, ce), z.materialId ? ce.setMaterialByID(z.materialId) : ce.material = null, z.morphTargetManagerId > -1 && (ce.morphTargetManager = q.getMorphTargetManagerById(z.morphTargetManagerId)), z.skeletonId !== void 0 && z.skeletonId !== null && (ce.skeleton = q.getLastSkeletonByID(z.skeletonId), z.numBoneInfluencers && (ce.numBoneInfluencers = z.numBoneInfluencers)), z.animations) {
+ for (var J = 0; J < z.animations.length; J++) {
+ var H = z.animations[J];
+ ($ = L.a.GetClass("BABYLON.Animation")) && ce.animations.push($.Parse(H));
+ }
+ g.a.ParseAnimationRanges(ce, z, q);
+ }
+ if (z.autoAnimate && q.beginAnimation(ce, z.autoAnimateFrom, z.autoAnimateTo, z.autoAnimateLoop, z.autoAnimateSpeed || 1), z.layerMask && !isNaN(z.layerMask) ? ce.layerMask = Math.abs(parseInt(z.layerMask)) : ce.layerMask = 268435455, z.physicsImpostor && w._PhysicsImpostorParser(q, ce, z), z.lodMeshIds && (ce._waitingData.lods = { ids: z.lodMeshIds, distances: z.lodDistances ? z.lodDistances : null, coverages: z.lodCoverages ? z.lodCoverages : null }), z.instances)
+ for (var X = 0; X < z.instances.length; X++) {
+ var ne = z.instances[X], Q = ce.createInstance(ne.name);
+ if (ne.id && (Q.id = ne.id), C.a && (ne.tags ? C.a.AddTagsTo(Q, ne.tags) : C.a.AddTagsTo(Q, z.tags)), Q.position = x.e.FromArray(ne.position), ne.metadata !== void 0 && (Q.metadata = ne.metadata), ne.parentId && (Q._waitingParentId = ne.parentId), ne.isEnabled !== void 0 && ne.isEnabled !== null && Q.setEnabled(ne.isEnabled), ne.isVisible !== void 0 && ne.isVisible !== null && (Q.isVisible = ne.isVisible), ne.isPickable !== void 0 && ne.isPickable !== null && (Q.isPickable = ne.isPickable), ne.rotationQuaternion ? Q.rotationQuaternion = x.b.FromArray(ne.rotationQuaternion) : ne.rotation && (Q.rotation = x.e.FromArray(ne.rotation)), Q.scaling = x.e.FromArray(ne.scaling), ne.checkCollisions != null && ne.checkCollisions != null && (Q.checkCollisions = ne.checkCollisions), ne.pickable != null && ne.pickable != null && (Q.isPickable = ne.pickable), ne.showBoundingBox != null && ne.showBoundingBox != null && (Q.showBoundingBox = ne.showBoundingBox), ne.showSubMeshesBoundingBox != null && ne.showSubMeshesBoundingBox != null && (Q.showSubMeshesBoundingBox = ne.showSubMeshesBoundingBox), ne.alphaIndex != null && ne.showSubMeshesBoundingBox != null && (Q.alphaIndex = ne.alphaIndex), ne.physicsImpostor && w._PhysicsImpostorParser(q, Q, ne), ne.animations) {
+ for (J = 0; J < ne.animations.length; J++) {
+ var $;
+ H = ne.animations[J], ($ = L.a.GetClass("BABYLON.Animation")) && Q.animations.push($.Parse(H));
+ }
+ g.a.ParseAnimationRanges(Q, ne, q), ne.autoAnimate && q.beginAnimation(Q, ne.autoAnimateFrom, ne.autoAnimateTo, ne.autoAnimateLoop, ne.autoAnimateSpeed || 1);
+ }
+ }
+ if (z.thinInstances) {
+ var me = z.thinInstances;
+ if (me.matrixData ? (ce.thinInstanceSetBuffer("matrix", new Float32Array(me.matrixData), 16, !1), ce._thinInstanceDataStorage.matrixBufferSize = me.matrixBufferSize, ce._thinInstanceDataStorage.instancesCount = me.instancesCount) : ce._thinInstanceDataStorage.matrixBufferSize = me.matrixBufferSize, z.thinInstances.userThinInstance) {
+ var ye = z.thinInstances.userThinInstance;
+ for (var be in ye.data)
+ ce.thinInstanceSetBuffer(be, new Float32Array(ye.data[be]), ye.strides[be], !1), ce._userThinInstanceBuffersStorage.sizes[be] = ye.sizes[be];
+ }
+ }
+ return ce;
+ }, w.CreateRibbon = function(z, q, le, ce, J, H, X, ne, Q) {
+ throw j.a.WarnImport("MeshBuilder");
+ }, w.CreateDisc = function(z, q, le, ce, J, H) {
+ throw j.a.WarnImport("MeshBuilder");
+ }, w.CreateBox = function(z, q, le, ce, J) {
+ throw j.a.WarnImport("MeshBuilder");
+ }, w.CreateSphere = function(z, q, le, ce, J, H) {
+ throw j.a.WarnImport("MeshBuilder");
+ }, w.CreateHemisphere = function(z, q, le, ce) {
+ throw j.a.WarnImport("MeshBuilder");
+ }, w.CreateCylinder = function(z, q, le, ce, J, H, X, ne, Q) {
+ throw j.a.WarnImport("MeshBuilder");
+ }, w.CreateTorus = function(z, q, le, ce, J, H, X) {
+ throw j.a.WarnImport("MeshBuilder");
+ }, w.CreateTorusKnot = function(z, q, le, ce, J, H, X, ne, Q, $) {
+ throw j.a.WarnImport("MeshBuilder");
+ }, w.CreateLines = function(z, q, le, ce, J) {
+ throw j.a.WarnImport("MeshBuilder");
+ }, w.CreateDashedLines = function(z, q, le, ce, J, H, X, ne) {
+ throw j.a.WarnImport("MeshBuilder");
+ }, w.CreatePolygon = function(z, q, le, ce, J, H, X) {
+ throw X === void 0 && (X = earcut), j.a.WarnImport("MeshBuilder");
+ }, w.ExtrudePolygon = function(z, q, le, ce, J, H, X, ne) {
+ throw ne === void 0 && (ne = earcut), j.a.WarnImport("MeshBuilder");
+ }, w.ExtrudeShape = function(z, q, le, ce, J, H, X, ne, Q, $) {
+ throw j.a.WarnImport("MeshBuilder");
+ }, w.ExtrudeShapeCustom = function(z, q, le, ce, J, H, X, ne, Q, $, me, ye) {
+ throw j.a.WarnImport("MeshBuilder");
+ }, w.CreateLathe = function(z, q, le, ce, J, H, X) {
+ throw j.a.WarnImport("MeshBuilder");
+ }, w.CreatePlane = function(z, q, le, ce, J) {
+ throw j.a.WarnImport("MeshBuilder");
+ }, w.CreateGround = function(z, q, le, ce, J, H) {
+ throw j.a.WarnImport("MeshBuilder");
+ }, w.CreateTiledGround = function(z, q, le, ce, J, H, X, ne, Q) {
+ throw j.a.WarnImport("MeshBuilder");
+ }, w.CreateGroundFromHeightMap = function(z, q, le, ce, J, H, X, ne, Q, $, me) {
+ throw j.a.WarnImport("MeshBuilder");
+ }, w.CreateTube = function(z, q, le, ce, J, H, X, ne, Q, $) {
+ throw j.a.WarnImport("MeshBuilder");
+ }, w.CreatePolyhedron = function(z, q, le) {
+ throw j.a.WarnImport("MeshBuilder");
+ }, w.CreateIcoSphere = function(z, q, le) {
+ throw j.a.WarnImport("MeshBuilder");
+ }, w.CreateDecal = function(z, q, le, ce, J, H) {
+ throw j.a.WarnImport("MeshBuilder");
+ }, w.CreateCapsule = function(z, q, le) {
+ throw j.a.WarnImport("MeshBuilder");
+ }, w.prototype.setPositionsForCPUSkinning = function() {
+ var z = this._internalMeshDataInfo;
+ if (!z._sourcePositions) {
+ var q = this.getVerticesData(u.b.PositionKind);
+ if (!q)
+ return z._sourcePositions;
+ z._sourcePositions = new Float32Array(q), this.isVertexBufferUpdatable(u.b.PositionKind) || this.setVerticesData(u.b.PositionKind, q, !0);
+ }
+ return z._sourcePositions;
+ }, w.prototype.setNormalsForCPUSkinning = function() {
+ var z = this._internalMeshDataInfo;
+ if (!z._sourceNormals) {
+ var q = this.getVerticesData(u.b.NormalKind);
+ if (!q)
+ return z._sourceNormals;
+ z._sourceNormals = new Float32Array(q), this.isVertexBufferUpdatable(u.b.NormalKind) || this.setVerticesData(u.b.NormalKind, q, !0);
+ }
+ return z._sourceNormals;
+ }, w.prototype.applySkeleton = function(z) {
+ if (!this.geometry)
+ return this;
+ if (this.geometry._softwareSkinningFrameId == this.getScene().getFrameId())
+ return this;
+ if (this.geometry._softwareSkinningFrameId = this.getScene().getFrameId(), !this.isVerticesDataPresent(u.b.PositionKind))
+ return this;
+ if (!this.isVerticesDataPresent(u.b.MatricesIndicesKind))
+ return this;
+ if (!this.isVerticesDataPresent(u.b.MatricesWeightsKind))
+ return this;
+ var q = this.isVerticesDataPresent(u.b.NormalKind), le = this._internalMeshDataInfo;
+ if (!le._sourcePositions) {
+ var ce = this.subMeshes.slice();
+ this.setPositionsForCPUSkinning(), this.subMeshes = ce;
+ }
+ q && !le._sourceNormals && this.setNormalsForCPUSkinning();
+ var J = this.getVerticesData(u.b.PositionKind);
+ if (!J)
+ return this;
+ J instanceof Float32Array || (J = new Float32Array(J));
+ var H = this.getVerticesData(u.b.NormalKind);
+ if (q) {
+ if (!H)
+ return this;
+ H instanceof Float32Array || (H = new Float32Array(H));
+ }
+ var X = this.getVerticesData(u.b.MatricesIndicesKind), ne = this.getVerticesData(u.b.MatricesWeightsKind);
+ if (!ne || !X)
+ return this;
+ for (var Q, $ = this.numBoneInfluencers > 4, me = $ ? this.getVerticesData(u.b.MatricesIndicesExtraKind) : null, ye = $ ? this.getVerticesData(u.b.MatricesWeightsExtraKind) : null, be = z.getTransformMatrices(this), ge = x.e.Zero(), Te = new x.a(), Re = new x.a(), Se = 0, Ne = 0; Ne < J.length; Ne += 3, Se += 4) {
+ var ze;
+ for (Q = 0; Q < 4; Q++)
+ (ze = ne[Se + Q]) > 0 && (x.a.FromFloat32ArrayToRefScaled(be, Math.floor(16 * X[Se + Q]), ze, Re), Te.addToSelf(Re));
+ if ($)
+ for (Q = 0; Q < 4; Q++)
+ (ze = ye[Se + Q]) > 0 && (x.a.FromFloat32ArrayToRefScaled(be, Math.floor(16 * me[Se + Q]), ze, Re), Te.addToSelf(Re));
+ x.e.TransformCoordinatesFromFloatsToRef(le._sourcePositions[Ne], le._sourcePositions[Ne + 1], le._sourcePositions[Ne + 2], Te, ge), ge.toArray(J, Ne), q && (x.e.TransformNormalFromFloatsToRef(le._sourceNormals[Ne], le._sourceNormals[Ne + 1], le._sourceNormals[Ne + 2], Te, ge), ge.toArray(H, Ne)), Te.reset();
+ }
+ return this.updateVerticesData(u.b.PositionKind, J), q && this.updateVerticesData(u.b.NormalKind, H), this;
+ }, w.MinMax = function(z) {
+ var q = null, le = null;
+ return z.forEach(function(ce) {
+ var J = ce.getBoundingInfo().boundingBox;
+ q && le ? (q.minimizeInPlace(J.minimumWorld), le.maximizeInPlace(J.maximumWorld)) : (q = J.minimumWorld, le = J.maximumWorld);
+ }), q && le ? { min: q, max: le } : { min: x.e.Zero(), max: x.e.Zero() };
+ }, w.Center = function(z) {
+ var q = z instanceof Array ? w.MinMax(z) : z;
+ return x.e.Center(q.min, q.max);
+ }, w.MergeMeshes = function(z, q, le, ce, J, H) {
+ var X;
+ if (q === void 0 && (q = !0), !le) {
+ var ne = 0;
+ for (X = 0; X < z.length; X++)
+ if (z[X] && (ne += z[X].getTotalVertices()) >= 65536)
+ return B.a.Warn("Cannot merge meshes because resulting mesh will have more than 65536 vertices. Please use allow32BitsIndices = true to use 32 bits indices"), null;
+ }
+ if (H) {
+ var Q, $, me = null;
+ J = !1;
+ }
+ var ye, be = new Array(), ge = new Array(), Te = null, Re = new Array(), Se = null;
+ for (X = 0; X < z.length; X++)
+ if (z[X]) {
+ var Ne = z[X];
+ if (Ne.isAnInstance)
+ return B.a.Warn("Cannot merge instance meshes."), null;
+ var ze = Ne.computeWorldMatrix(!0);
+ if ((ye = E.a.ExtractFromMesh(Ne, !0, !0)).transform(ze), Te ? Te.merge(ye, le) : (Te = ye, Se = Ne), J && Re.push(Ne.getTotalIndices()), H)
+ if (Ne.material) {
+ var Ye = Ne.material;
+ if (Ye instanceof b.a) {
+ for ($ = 0; $ < Ye.subMaterials.length; $++)
+ be.indexOf(Ye.subMaterials[$]) < 0 && be.push(Ye.subMaterials[$]);
+ for (Q = 0; Q < Ne.subMeshes.length; Q++)
+ ge.push(be.indexOf(Ye.subMaterials[Ne.subMeshes[Q].materialIndex])), Re.push(Ne.subMeshes[Q].indexCount);
+ } else
+ for (be.indexOf(Ye) < 0 && be.push(Ye), Q = 0; Q < Ne.subMeshes.length; Q++)
+ ge.push(be.indexOf(Ye)), Re.push(Ne.subMeshes[Q].indexCount);
+ } else
+ for (Q = 0; Q < Ne.subMeshes.length; Q++)
+ ge.push(0), Re.push(Ne.subMeshes[Q].indexCount);
+ }
+ if (Se = Se, ce || (ce = new w(Se.name + "_merged", Se.getScene())), Te.applyToMesh(ce), ce.checkCollisions = Se.checkCollisions, ce.overrideMaterialSideOrientation = Se.overrideMaterialSideOrientation, q)
+ for (X = 0; X < z.length; X++)
+ z[X] && z[X].dispose();
+ if (J || H) {
+ ce.releaseSubMeshes(), X = 0;
+ for (var He = 0; X < Re.length; )
+ v.a.CreateFromIndices(0, He, Re[X], ce), He += Re[X], X++;
+ }
+ if (H) {
+ for ((me = new b.a(Se.name + "_merged", Se.getScene())).subMaterials = be, Q = 0; Q < ce.subMeshes.length; Q++)
+ ce.subMeshes[Q].materialIndex = ge[Q];
+ ce.material = me;
+ } else
+ ce.material = Se.material;
+ return ce;
+ }, w.prototype.addInstance = function(z) {
+ z._indexInSourceMeshInstanceArray = this.instances.length, this.instances.push(z);
+ }, w.prototype.removeInstance = function(z) {
+ var q = z._indexInSourceMeshInstanceArray;
+ if (q != -1) {
+ if (q !== this.instances.length - 1) {
+ var le = this.instances[this.instances.length - 1];
+ this.instances[q] = le, le._indexInSourceMeshInstanceArray = q;
+ }
+ z._indexInSourceMeshInstanceArray = -1, this.instances.pop();
+ }
+ }, w.FRONTSIDE = E.a.FRONTSIDE, w.BACKSIDE = E.a.BACKSIDE, w.DOUBLESIDE = E.a.DOUBLESIDE, w.DEFAULTSIDE = E.a.DEFAULTSIDE, w.NO_CAP = 0, w.CAP_START = 1, w.CAP_END = 2, w.CAP_ALL = 3, w.NO_FLIP = 0, w.FLIP_TILE = 1, w.ROTATE_TILE = 2, w.FLIP_ROW = 3, w.ROTATE_ROW = 4, w.FLIP_N_ROTATE_TILE = 5, w.FLIP_N_ROTATE_ROW = 6, w.CENTER = 0, w.LEFT = 1, w.RIGHT = 2, w.TOP = 3, w.BOTTOM = 4, w._GroundMeshParser = function(z, q) {
+ throw j.a.WarnImport("GroundMesh");
+ }, w;
+ }(y.a);
+ L.a.RegisteredTypes["BABYLON.Mesh"] = Z;
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ function f() {
+ }
+ return f._AddLogEntry = function(P) {
+ f._LogCache = P + f._LogCache, f.OnNewCacheEntry && f.OnNewCacheEntry(P);
+ }, f._FormatMessage = function(P) {
+ var c = function(x) {
+ return x < 10 ? "0" + x : "" + x;
+ }, C = /* @__PURE__ */ new Date();
+ return "[" + c(C.getHours()) + ":" + c(C.getMinutes()) + ":" + c(C.getSeconds()) + "]: " + P;
+ }, f._LogDisabled = function(P) {
+ }, f._LogEnabled = function(P) {
+ var c = f._FormatMessage(P);
+ console.log("BJS - " + c);
+ var C = "
" + c + "
";
+ f._AddLogEntry(C);
+ }, f._WarnDisabled = function(P) {
+ }, f._WarnEnabled = function(P) {
+ var c = f._FormatMessage(P);
+ console.warn("BJS - " + c);
+ var C = "" + c + "
";
+ f._AddLogEntry(C);
+ }, f._ErrorDisabled = function(P) {
+ }, f._ErrorEnabled = function(P) {
+ f.errorsCount++;
+ var c = f._FormatMessage(P);
+ console.error("BJS - " + c);
+ var C = "" + c + "
";
+ f._AddLogEntry(C);
+ }, Object.defineProperty(f, "LogCache", { get: function() {
+ return f._LogCache;
+ }, enumerable: !1, configurable: !0 }), f.ClearLogCache = function() {
+ f._LogCache = "", f.errorsCount = 0;
+ }, Object.defineProperty(f, "LogLevels", { set: function(P) {
+ (P & f.MessageLogLevel) === f.MessageLogLevel ? f.Log = f._LogEnabled : f.Log = f._LogDisabled, (P & f.WarningLogLevel) === f.WarningLogLevel ? f.Warn = f._WarnEnabled : f.Warn = f._WarnDisabled, (P & f.ErrorLogLevel) === f.ErrorLogLevel ? f.Error = f._ErrorEnabled : f.Error = f._ErrorDisabled;
+ }, enumerable: !1, configurable: !0 }), f.NoneLogLevel = 0, f.MessageLogLevel = 1, f.WarningLogLevel = 2, f.ErrorLogLevel = 4, f.AllLogLevel = 7, f._LogCache = "", f.errorsCount = 0, f.Log = f._LogEnabled, f.Warn = f._WarnEnabled, f.Error = f._ErrorEnabled, f;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return C;
+ }), l.d(_, "b", function() {
+ return x;
+ }), l.d(_, "c", function() {
+ return R;
+ });
+ var D = l(14), f = l(28), P = l(44), c = l(11), C = function() {
+ function g(u, E, A) {
+ u === void 0 && (u = 0), E === void 0 && (E = 0), A === void 0 && (A = 0), this.r = u, this.g = E, this.b = A;
+ }
+ return g.prototype.toString = function() {
+ return "{R: " + this.r + " G:" + this.g + " B:" + this.b + "}";
+ }, g.prototype.getClassName = function() {
+ return "Color3";
+ }, g.prototype.getHashCode = function() {
+ var u = 255 * this.r | 0;
+ return u = 397 * (u = 397 * u ^ (255 * this.g | 0)) ^ (255 * this.b | 0);
+ }, g.prototype.toArray = function(u, E) {
+ return E === void 0 && (E = 0), u[E] = this.r, u[E + 1] = this.g, u[E + 2] = this.b, this;
+ }, g.prototype.fromArray = function(u, E) {
+ return E === void 0 && (E = 0), g.FromArrayToRef(u, E, this), this;
+ }, g.prototype.toColor4 = function(u) {
+ return u === void 0 && (u = 1), new x(this.r, this.g, this.b, u);
+ }, g.prototype.asArray = function() {
+ var u = new Array();
+ return this.toArray(u, 0), u;
+ }, g.prototype.toLuminance = function() {
+ return 0.3 * this.r + 0.59 * this.g + 0.11 * this.b;
+ }, g.prototype.multiply = function(u) {
+ return new g(this.r * u.r, this.g * u.g, this.b * u.b);
+ }, g.prototype.multiplyToRef = function(u, E) {
+ return E.r = this.r * u.r, E.g = this.g * u.g, E.b = this.b * u.b, this;
+ }, g.prototype.equals = function(u) {
+ return u && this.r === u.r && this.g === u.g && this.b === u.b;
+ }, g.prototype.equalsFloats = function(u, E, A) {
+ return this.r === u && this.g === E && this.b === A;
+ }, g.prototype.scale = function(u) {
+ return new g(this.r * u, this.g * u, this.b * u);
+ }, g.prototype.scaleToRef = function(u, E) {
+ return E.r = this.r * u, E.g = this.g * u, E.b = this.b * u, this;
+ }, g.prototype.scaleAndAddToRef = function(u, E) {
+ return E.r += this.r * u, E.g += this.g * u, E.b += this.b * u, this;
+ }, g.prototype.clampToRef = function(u, E, A) {
+ return u === void 0 && (u = 0), E === void 0 && (E = 1), A.r = D.a.Clamp(this.r, u, E), A.g = D.a.Clamp(this.g, u, E), A.b = D.a.Clamp(this.b, u, E), this;
+ }, g.prototype.add = function(u) {
+ return new g(this.r + u.r, this.g + u.g, this.b + u.b);
+ }, g.prototype.addToRef = function(u, E) {
+ return E.r = this.r + u.r, E.g = this.g + u.g, E.b = this.b + u.b, this;
+ }, g.prototype.subtract = function(u) {
+ return new g(this.r - u.r, this.g - u.g, this.b - u.b);
+ }, g.prototype.subtractToRef = function(u, E) {
+ return E.r = this.r - u.r, E.g = this.g - u.g, E.b = this.b - u.b, this;
+ }, g.prototype.clone = function() {
+ return new g(this.r, this.g, this.b);
+ }, g.prototype.copyFrom = function(u) {
+ return this.r = u.r, this.g = u.g, this.b = u.b, this;
+ }, g.prototype.copyFromFloats = function(u, E, A) {
+ return this.r = u, this.g = E, this.b = A, this;
+ }, g.prototype.set = function(u, E, A) {
+ return this.copyFromFloats(u, E, A);
+ }, g.prototype.toHexString = function() {
+ var u = 255 * this.r | 0, E = 255 * this.g | 0, A = 255 * this.b | 0;
+ return "#" + D.a.ToHex(u) + D.a.ToHex(E) + D.a.ToHex(A);
+ }, g.prototype.toLinearSpace = function() {
+ var u = new g();
+ return this.toLinearSpaceToRef(u), u;
+ }, g.prototype.toHSV = function() {
+ var u = new g();
+ return this.toHSVToRef(u), u;
+ }, g.prototype.toHSVToRef = function(u) {
+ var E = this.r, A = this.g, y = this.b, v = Math.max(E, A, y), h = Math.min(E, A, y), d = 0, b = 0, T = v, N = v - h;
+ v !== 0 && (b = N / v), v != h && (v == E ? (d = (A - y) / N, A < y && (d += 6)) : v == A ? d = (y - E) / N + 2 : v == y && (d = (E - A) / N + 4), d *= 60), u.r = d, u.g = b, u.b = T;
+ }, g.prototype.toLinearSpaceToRef = function(u) {
+ return u.r = Math.pow(this.r, f.c), u.g = Math.pow(this.g, f.c), u.b = Math.pow(this.b, f.c), this;
+ }, g.prototype.toGammaSpace = function() {
+ var u = new g();
+ return this.toGammaSpaceToRef(u), u;
+ }, g.prototype.toGammaSpaceToRef = function(u) {
+ return u.r = Math.pow(this.r, f.b), u.g = Math.pow(this.g, f.b), u.b = Math.pow(this.b, f.b), this;
+ }, g.HSVtoRGBToRef = function(u, E, A, y) {
+ var v = A * E, h = u / 60, d = v * (1 - Math.abs(h % 2 - 1)), b = 0, T = 0, N = 0;
+ h >= 0 && h <= 1 ? (b = v, T = d) : h >= 1 && h <= 2 ? (b = d, T = v) : h >= 2 && h <= 3 ? (T = v, N = d) : h >= 3 && h <= 4 ? (T = d, N = v) : h >= 4 && h <= 5 ? (b = d, N = v) : h >= 5 && h <= 6 && (b = v, N = d);
+ var U = A - v;
+ y.set(b + U, T + U, N + U);
+ }, g.FromHexString = function(u) {
+ if (u.substring(0, 1) !== "#" || u.length !== 7)
+ return new g(0, 0, 0);
+ var E = parseInt(u.substring(1, 3), 16), A = parseInt(u.substring(3, 5), 16), y = parseInt(u.substring(5, 7), 16);
+ return g.FromInts(E, A, y);
+ }, g.FromArray = function(u, E) {
+ return E === void 0 && (E = 0), new g(u[E], u[E + 1], u[E + 2]);
+ }, g.FromArrayToRef = function(u, E, A) {
+ E === void 0 && (E = 0), A.r = u[E], A.g = u[E + 1], A.b = u[E + 2];
+ }, g.FromInts = function(u, E, A) {
+ return new g(u / 255, E / 255, A / 255);
+ }, g.Lerp = function(u, E, A) {
+ var y = new g(0, 0, 0);
+ return g.LerpToRef(u, E, A, y), y;
+ }, g.LerpToRef = function(u, E, A, y) {
+ y.r = u.r + (E.r - u.r) * A, y.g = u.g + (E.g - u.g) * A, y.b = u.b + (E.b - u.b) * A;
+ }, g.Red = function() {
+ return new g(1, 0, 0);
+ }, g.Green = function() {
+ return new g(0, 1, 0);
+ }, g.Blue = function() {
+ return new g(0, 0, 1);
+ }, g.Black = function() {
+ return new g(0, 0, 0);
+ }, Object.defineProperty(g, "BlackReadOnly", { get: function() {
+ return g._BlackReadOnly;
+ }, enumerable: !1, configurable: !0 }), g.White = function() {
+ return new g(1, 1, 1);
+ }, g.Purple = function() {
+ return new g(0.5, 0, 0.5);
+ }, g.Magenta = function() {
+ return new g(1, 0, 1);
+ }, g.Yellow = function() {
+ return new g(1, 1, 0);
+ }, g.Gray = function() {
+ return new g(0.5, 0.5, 0.5);
+ }, g.Teal = function() {
+ return new g(0, 1, 1);
+ }, g.Random = function() {
+ return new g(Math.random(), Math.random(), Math.random());
+ }, g._BlackReadOnly = g.Black(), g;
+ }(), x = function() {
+ function g(u, E, A, y) {
+ u === void 0 && (u = 0), E === void 0 && (E = 0), A === void 0 && (A = 0), y === void 0 && (y = 1), this.r = u, this.g = E, this.b = A, this.a = y;
+ }
+ return g.prototype.addInPlace = function(u) {
+ return this.r += u.r, this.g += u.g, this.b += u.b, this.a += u.a, this;
+ }, g.prototype.asArray = function() {
+ var u = new Array();
+ return this.toArray(u, 0), u;
+ }, g.prototype.toArray = function(u, E) {
+ return E === void 0 && (E = 0), u[E] = this.r, u[E + 1] = this.g, u[E + 2] = this.b, u[E + 3] = this.a, this;
+ }, g.prototype.fromArray = function(u, E) {
+ return E === void 0 && (E = 0), g.FromArrayToRef(u, E, this), this;
+ }, g.prototype.equals = function(u) {
+ return u && this.r === u.r && this.g === u.g && this.b === u.b && this.a === u.a;
+ }, g.prototype.add = function(u) {
+ return new g(this.r + u.r, this.g + u.g, this.b + u.b, this.a + u.a);
+ }, g.prototype.subtract = function(u) {
+ return new g(this.r - u.r, this.g - u.g, this.b - u.b, this.a - u.a);
+ }, g.prototype.subtractToRef = function(u, E) {
+ return E.r = this.r - u.r, E.g = this.g - u.g, E.b = this.b - u.b, E.a = this.a - u.a, this;
+ }, g.prototype.scale = function(u) {
+ return new g(this.r * u, this.g * u, this.b * u, this.a * u);
+ }, g.prototype.scaleToRef = function(u, E) {
+ return E.r = this.r * u, E.g = this.g * u, E.b = this.b * u, E.a = this.a * u, this;
+ }, g.prototype.scaleAndAddToRef = function(u, E) {
+ return E.r += this.r * u, E.g += this.g * u, E.b += this.b * u, E.a += this.a * u, this;
+ }, g.prototype.clampToRef = function(u, E, A) {
+ return u === void 0 && (u = 0), E === void 0 && (E = 1), A.r = D.a.Clamp(this.r, u, E), A.g = D.a.Clamp(this.g, u, E), A.b = D.a.Clamp(this.b, u, E), A.a = D.a.Clamp(this.a, u, E), this;
+ }, g.prototype.multiply = function(u) {
+ return new g(this.r * u.r, this.g * u.g, this.b * u.b, this.a * u.a);
+ }, g.prototype.multiplyToRef = function(u, E) {
+ return E.r = this.r * u.r, E.g = this.g * u.g, E.b = this.b * u.b, E.a = this.a * u.a, E;
+ }, g.prototype.toString = function() {
+ return "{R: " + this.r + " G:" + this.g + " B:" + this.b + " A:" + this.a + "}";
+ }, g.prototype.getClassName = function() {
+ return "Color4";
+ }, g.prototype.getHashCode = function() {
+ var u = 255 * this.r | 0;
+ return u = 397 * (u = 397 * (u = 397 * u ^ (255 * this.g | 0)) ^ (255 * this.b | 0)) ^ (255 * this.a | 0);
+ }, g.prototype.clone = function() {
+ return new g(this.r, this.g, this.b, this.a);
+ }, g.prototype.copyFrom = function(u) {
+ return this.r = u.r, this.g = u.g, this.b = u.b, this.a = u.a, this;
+ }, g.prototype.copyFromFloats = function(u, E, A, y) {
+ return this.r = u, this.g = E, this.b = A, this.a = y, this;
+ }, g.prototype.set = function(u, E, A, y) {
+ return this.copyFromFloats(u, E, A, y);
+ }, g.prototype.toHexString = function(u) {
+ u === void 0 && (u = !1);
+ var E = 255 * this.r | 0, A = 255 * this.g | 0, y = 255 * this.b | 0;
+ if (u)
+ return "#" + D.a.ToHex(E) + D.a.ToHex(A) + D.a.ToHex(y);
+ var v = 255 * this.a | 0;
+ return "#" + D.a.ToHex(E) + D.a.ToHex(A) + D.a.ToHex(y) + D.a.ToHex(v);
+ }, g.prototype.toLinearSpace = function() {
+ var u = new g();
+ return this.toLinearSpaceToRef(u), u;
+ }, g.prototype.toLinearSpaceToRef = function(u) {
+ return u.r = Math.pow(this.r, f.c), u.g = Math.pow(this.g, f.c), u.b = Math.pow(this.b, f.c), u.a = this.a, this;
+ }, g.prototype.toGammaSpace = function() {
+ var u = new g();
+ return this.toGammaSpaceToRef(u), u;
+ }, g.prototype.toGammaSpaceToRef = function(u) {
+ return u.r = Math.pow(this.r, f.b), u.g = Math.pow(this.g, f.b), u.b = Math.pow(this.b, f.b), u.a = this.a, this;
+ }, g.FromHexString = function(u) {
+ if (u.substring(0, 1) !== "#" || u.length !== 9)
+ return new g(0, 0, 0, 0);
+ var E = parseInt(u.substring(1, 3), 16), A = parseInt(u.substring(3, 5), 16), y = parseInt(u.substring(5, 7), 16), v = parseInt(u.substring(7, 9), 16);
+ return g.FromInts(E, A, y, v);
+ }, g.Lerp = function(u, E, A) {
+ var y = new g(0, 0, 0, 0);
+ return g.LerpToRef(u, E, A, y), y;
+ }, g.LerpToRef = function(u, E, A, y) {
+ y.r = u.r + (E.r - u.r) * A, y.g = u.g + (E.g - u.g) * A, y.b = u.b + (E.b - u.b) * A, y.a = u.a + (E.a - u.a) * A;
+ }, g.FromColor3 = function(u, E) {
+ return E === void 0 && (E = 1), new g(u.r, u.g, u.b, E);
+ }, g.FromArray = function(u, E) {
+ return E === void 0 && (E = 0), new g(u[E], u[E + 1], u[E + 2], u[E + 3]);
+ }, g.FromArrayToRef = function(u, E, A) {
+ E === void 0 && (E = 0), A.r = u[E], A.g = u[E + 1], A.b = u[E + 2], A.a = u[E + 3];
+ }, g.FromInts = function(u, E, A, y) {
+ return new g(u / 255, E / 255, A / 255, y / 255);
+ }, g.CheckColors4 = function(u, E) {
+ if (u.length === 3 * E) {
+ for (var A = [], y = 0; y < u.length; y += 3) {
+ var v = y / 3 * 4;
+ A[v] = u[y], A[v + 1] = u[y + 1], A[v + 2] = u[y + 2], A[v + 3] = 1;
+ }
+ return A;
+ }
+ return u;
+ }, g;
+ }(), R = function() {
+ function g() {
+ }
+ return g.Color3 = P.a.BuildArray(3, C.Black), g.Color4 = P.a.BuildArray(3, function() {
+ return new x(0, 0, 0, 0);
+ }), g;
+ }();
+ c.a.RegisteredTypes["BABYLON.Color3"] = C, c.a.RegisteredTypes["BABYLON.Color4"] = x;
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return h;
+ });
+ var D = l(1), f = l(3), P = l(6), c = l(0), C = l(52), x = l(2), R = l(11), g = l(21), u = l(104), E = l(122), A = l(64), y = l(34), v = l(150), h = function(d) {
+ function b(T, N, U, B, L, j, W, Y, oe, te, _e, de) {
+ U === void 0 && (U = !1), B === void 0 && (B = !0), L === void 0 && (L = b.TRILINEAR_SAMPLINGMODE), j === void 0 && (j = null), W === void 0 && (W = null), Y === void 0 && (Y = null), oe === void 0 && (oe = !1);
+ var ae = d.call(this, N) || this;
+ ae.url = null, ae.uOffset = 0, ae.vOffset = 0, ae.uScale = 1, ae.vScale = 1, ae.uAng = 0, ae.vAng = 0, ae.wAng = 0, ae.uRotationCenter = 0.5, ae.vRotationCenter = 0.5, ae.wRotationCenter = 0.5, ae.homogeneousRotationInUVTransform = !1, ae.inspectableCustomProperties = null, ae._noMipmap = !1, ae._invertY = !1, ae._rowGenerationMatrix = null, ae._cachedTextureMatrix = null, ae._projectionModeMatrix = null, ae._t0 = null, ae._t1 = null, ae._t2 = null, ae._cachedUOffset = -1, ae._cachedVOffset = -1, ae._cachedUScale = 0, ae._cachedVScale = 0, ae._cachedUAng = -1, ae._cachedVAng = -1, ae._cachedWAng = -1, ae._cachedProjectionMatrixId = -1, ae._cachedURotationCenter = -1, ae._cachedVRotationCenter = -1, ae._cachedWRotationCenter = -1, ae._cachedHomogeneousRotationInUVTransform = !1, ae._cachedCoordinatesMode = -1, ae._initialSamplingMode = b.BILINEAR_SAMPLINGMODE, ae._buffer = null, ae._deleteBuffer = !1, ae._format = null, ae._delayedOnLoad = null, ae._delayedOnError = null, ae.onLoadObservable = new P.c(), ae._isBlocking = !0, ae.name = T || "", ae.url = T, ae._noMipmap = U, ae._invertY = B, ae._initialSamplingMode = L, ae._buffer = Y, ae._deleteBuffer = oe, ae._mimeType = _e, ae._loaderOptions = de, te && (ae._format = te);
+ var ie = ae.getScene(), Z = ae._getEngine();
+ if (!Z)
+ return ae;
+ Z.onBeforeTextureInitObservable.notifyObservers(ae);
+ var ee = function() {
+ ae._texture && (ae._texture._invertVScale && (ae.vScale *= -1, ae.vOffset += 1), ae._texture._cachedWrapU !== null && (ae.wrapU = ae._texture._cachedWrapU, ae._texture._cachedWrapU = null), ae._texture._cachedWrapV !== null && (ae.wrapV = ae._texture._cachedWrapV, ae._texture._cachedWrapV = null), ae._texture._cachedWrapR !== null && (ae.wrapR = ae._texture._cachedWrapR, ae._texture._cachedWrapR = null)), ae.onLoadObservable.hasObservers() && ae.onLoadObservable.notifyObservers(ae), j && j(), !ae.isBlocking && ie && ie.resetCachedMaterial();
+ };
+ return ae.url ? (ae._texture = ae._getFromCache(ae.url, U, L, B), ae._texture ? ae._texture.isReady ? u.a.SetImmediate(function() {
+ return ee();
+ }) : ae._texture.onLoadedObservable.add(ee) : ie && ie.useDelayedTextureLoading ? (ae.delayLoadState = x.a.DELAYLOADSTATE_NOTLOADED, ae._delayedOnLoad = ee, ae._delayedOnError = W) : (ae._texture = Z.createTexture(ae.url, U, B, ie, L, ee, W, ae._buffer, void 0, ae._format, null, _e, de), oe && (ae._buffer = null)), ae) : (ae._delayedOnLoad = ee, ae._delayedOnError = W, ae);
+ }
+ return Object(D.d)(b, d), Object.defineProperty(b.prototype, "noMipmap", { get: function() {
+ return this._noMipmap;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(b.prototype, "mimeType", { get: function() {
+ return this._mimeType;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(b.prototype, "isBlocking", { get: function() {
+ return this._isBlocking;
+ }, set: function(T) {
+ this._isBlocking = T;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(b.prototype, "samplingMode", { get: function() {
+ return this._texture ? this._texture.samplingMode : this._initialSamplingMode;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(b.prototype, "invertY", { get: function() {
+ return this._invertY;
+ }, enumerable: !1, configurable: !0 }), b.prototype.updateURL = function(T, N, U) {
+ N === void 0 && (N = null), this.url && (this.releaseInternalTexture(), this.getScene().markAllMaterialsAsDirty(x.a.MATERIAL_TextureDirtyFlag)), this.name && !y.a.StartsWith(this.name, "data:") || (this.name = T), this.url = T, this._buffer = N, this.delayLoadState = x.a.DELAYLOADSTATE_NOTLOADED, U && (this._delayedOnLoad = U), this.delayLoad();
+ }, b.prototype.delayLoad = function() {
+ if (this.delayLoadState === x.a.DELAYLOADSTATE_NOTLOADED) {
+ var T = this.getScene();
+ T && (this.delayLoadState = x.a.DELAYLOADSTATE_LOADED, this._texture = this._getFromCache(this.url, this._noMipmap, this.samplingMode, this._invertY), this._texture ? this._delayedOnLoad && (this._texture.isReady ? u.a.SetImmediate(this._delayedOnLoad) : this._texture.onLoadedObservable.add(this._delayedOnLoad)) : (this._texture = T.getEngine().createTexture(this.url, this._noMipmap, this._invertY, T, this.samplingMode, this._delayedOnLoad, this._delayedOnError, this._buffer, null, this._format, null, this._mimeType, this._loaderOptions), this._deleteBuffer && (this._buffer = null)), this._delayedOnLoad = null, this._delayedOnError = null);
+ }
+ }, b.prototype._prepareRowForTextureGeneration = function(T, N, U, B) {
+ T *= this._cachedUScale, N *= this._cachedVScale, T -= this.uRotationCenter * this._cachedUScale, N -= this.vRotationCenter * this._cachedVScale, U -= this.wRotationCenter, c.e.TransformCoordinatesFromFloatsToRef(T, N, U, this._rowGenerationMatrix, B), B.x += this.uRotationCenter * this._cachedUScale + this._cachedUOffset, B.y += this.vRotationCenter * this._cachedVScale + this._cachedVOffset, B.z += this.wRotationCenter;
+ }, b.prototype.checkTransformsAreIdentical = function(T) {
+ return T !== null && this.uOffset === T.uOffset && this.vOffset === T.vOffset && this.uScale === T.uScale && this.vScale === T.vScale && this.uAng === T.uAng && this.vAng === T.vAng && this.wAng === T.wAng;
+ }, b.prototype.getTextureMatrix = function(T) {
+ var N = this;
+ if (T === void 0 && (T = 1), this.uOffset === this._cachedUOffset && this.vOffset === this._cachedVOffset && this.uScale * T === this._cachedUScale && this.vScale === this._cachedVScale && this.uAng === this._cachedUAng && this.vAng === this._cachedVAng && this.wAng === this._cachedWAng && this.uRotationCenter === this._cachedURotationCenter && this.vRotationCenter === this._cachedVRotationCenter && this.wRotationCenter === this._cachedWRotationCenter && this.homogeneousRotationInUVTransform === this._cachedHomogeneousRotationInUVTransform)
+ return this._cachedTextureMatrix;
+ this._cachedUOffset = this.uOffset, this._cachedVOffset = this.vOffset, this._cachedUScale = this.uScale * T, this._cachedVScale = this.vScale, this._cachedUAng = this.uAng, this._cachedVAng = this.vAng, this._cachedWAng = this.wAng, this._cachedURotationCenter = this.uRotationCenter, this._cachedVRotationCenter = this.vRotationCenter, this._cachedWRotationCenter = this.wRotationCenter, this._cachedHomogeneousRotationInUVTransform = this.homogeneousRotationInUVTransform, this._cachedTextureMatrix && this._rowGenerationMatrix || (this._cachedTextureMatrix = c.a.Zero(), this._rowGenerationMatrix = new c.a(), this._t0 = c.e.Zero(), this._t1 = c.e.Zero(), this._t2 = c.e.Zero()), c.a.RotationYawPitchRollToRef(this.vAng, this.uAng, this.wAng, this._rowGenerationMatrix), this.homogeneousRotationInUVTransform ? (c.a.TranslationToRef(-this._cachedURotationCenter, -this._cachedVRotationCenter, -this._cachedWRotationCenter, c.c.Matrix[0]), c.a.TranslationToRef(this._cachedURotationCenter, this._cachedVRotationCenter, this._cachedWRotationCenter, c.c.Matrix[1]), c.a.ScalingToRef(this._cachedUScale, this._cachedVScale, 0, c.c.Matrix[2]), c.a.TranslationToRef(this._cachedUOffset, this._cachedVOffset, 0, c.c.Matrix[3]), c.c.Matrix[0].multiplyToRef(this._rowGenerationMatrix, this._cachedTextureMatrix), this._cachedTextureMatrix.multiplyToRef(c.c.Matrix[1], this._cachedTextureMatrix), this._cachedTextureMatrix.multiplyToRef(c.c.Matrix[2], this._cachedTextureMatrix), this._cachedTextureMatrix.multiplyToRef(c.c.Matrix[3], this._cachedTextureMatrix), this._cachedTextureMatrix.setRowFromFloats(2, this._cachedTextureMatrix.m[12], this._cachedTextureMatrix.m[13], this._cachedTextureMatrix.m[14], 1)) : (this._prepareRowForTextureGeneration(0, 0, 0, this._t0), this._prepareRowForTextureGeneration(1, 0, 0, this._t1), this._prepareRowForTextureGeneration(0, 1, 0, this._t2), this._t1.subtractInPlace(this._t0), this._t2.subtractInPlace(this._t0), c.a.FromValuesToRef(this._t1.x, this._t1.y, this._t1.z, 0, this._t2.x, this._t2.y, this._t2.z, 0, this._t0.x, this._t0.y, this._t0.z, 0, 0, 0, 0, 1, this._cachedTextureMatrix));
+ var U = this.getScene();
+ return U ? (U.markAllMaterialsAsDirty(x.a.MATERIAL_TextureDirtyFlag, function(B) {
+ return B.hasTexture(N);
+ }), this._cachedTextureMatrix) : this._cachedTextureMatrix;
+ }, b.prototype.getReflectionTextureMatrix = function() {
+ var T = this, N = this.getScene();
+ if (!N)
+ return this._cachedTextureMatrix;
+ if (this.uOffset === this._cachedUOffset && this.vOffset === this._cachedVOffset && this.uScale === this._cachedUScale && this.vScale === this._cachedVScale && this.coordinatesMode === this._cachedCoordinatesMode) {
+ if (this.coordinatesMode !== b.PROJECTION_MODE)
+ return this._cachedTextureMatrix;
+ if (this._cachedProjectionMatrixId === N.getProjectionMatrix().updateFlag)
+ return this._cachedTextureMatrix;
+ }
+ switch (this._cachedTextureMatrix || (this._cachedTextureMatrix = c.a.Zero()), this._projectionModeMatrix || (this._projectionModeMatrix = c.a.Zero()), this._cachedUOffset = this.uOffset, this._cachedVOffset = this.vOffset, this._cachedUScale = this.uScale, this._cachedVScale = this.vScale, this._cachedCoordinatesMode = this.coordinatesMode, this.coordinatesMode) {
+ case b.PLANAR_MODE:
+ c.a.IdentityToRef(this._cachedTextureMatrix), this._cachedTextureMatrix[0] = this.uScale, this._cachedTextureMatrix[5] = this.vScale, this._cachedTextureMatrix[12] = this.uOffset, this._cachedTextureMatrix[13] = this.vOffset;
+ break;
+ case b.PROJECTION_MODE:
+ c.a.FromValuesToRef(0.5, 0, 0, 0, 0, -0.5, 0, 0, 0, 0, 0, 0, 0.5, 0.5, 1, 1, this._projectionModeMatrix);
+ var U = N.getProjectionMatrix();
+ this._cachedProjectionMatrixId = U.updateFlag, U.multiplyToRef(this._projectionModeMatrix, this._cachedTextureMatrix);
+ break;
+ default:
+ c.a.IdentityToRef(this._cachedTextureMatrix);
+ }
+ return N.markAllMaterialsAsDirty(x.a.MATERIAL_TextureDirtyFlag, function(B) {
+ return B.getActiveTextures().indexOf(T) !== -1;
+ }), this._cachedTextureMatrix;
+ }, b.prototype.clone = function() {
+ var T = this;
+ return f.a.Clone(function() {
+ return new b(T._texture ? T._texture.url : null, T.getScene(), T._noMipmap, T._invertY, T.samplingMode, void 0, void 0, T._texture ? T._texture._buffer : void 0);
+ }, this);
+ }, b.prototype.serialize = function() {
+ var T = this.name;
+ b.SerializeBuffers || y.a.StartsWith(this.name, "data:") && (this.name = ""), y.a.StartsWith(this.name, "data:") && this.url === this.name && (this.url = "");
+ var N = d.prototype.serialize.call(this);
+ return N ? ((b.SerializeBuffers || b.ForceSerializeBuffers) && (typeof this._buffer == "string" && this._buffer.substr(0, 5) === "data:" ? (N.base64String = this._buffer, N.name = N.name.replace("data:", "")) : this.url && y.a.StartsWith(this.url, "data:") && this._buffer instanceof Uint8Array ? N.base64String = "data:image/png;base64," + y.a.EncodeArrayBufferToBase64(this._buffer) : b.ForceSerializeBuffers && (N.base64String = v.a.GenerateBase64StringFromTexture(this))), N.invertY = this._invertY, N.samplingMode = this.samplingMode, this.name = T, N) : null;
+ }, b.prototype.getClassName = function() {
+ return "Texture";
+ }, b.prototype.dispose = function() {
+ d.prototype.dispose.call(this), this.onLoadObservable.clear(), this._delayedOnLoad = null, this._delayedOnError = null;
+ }, b.Parse = function(T, N, U) {
+ if (T.customType) {
+ var B = E.a.Instantiate(T.customType).Parse(T, N, U);
+ return T.samplingMode && B.updateSamplingMode && B._samplingMode && B._samplingMode !== T.samplingMode && B.updateSamplingMode(T.samplingMode), B;
+ }
+ if (T.isCube && !T.isRenderTarget)
+ return b._CubeTextureParser(T, N, U);
+ if (!T.name && !T.isRenderTarget)
+ return null;
+ var L = function() {
+ if (j && j._texture && (j._texture._cachedWrapU = null, j._texture._cachedWrapV = null, j._texture._cachedWrapR = null), T.samplingMode) {
+ var W = T.samplingMode;
+ j && j.samplingMode !== W && j.updateSamplingMode(W);
+ }
+ if (j && T.animations)
+ for (var Y = 0; Y < T.animations.length; Y++) {
+ var oe = T.animations[Y], te = R.a.GetClass("BABYLON.Animation");
+ te && j.animations.push(te.Parse(oe));
+ }
+ }, j = f.a.Parse(function() {
+ var W, Y = !0;
+ if (T.noMipmap && (Y = !1), T.mirrorPlane) {
+ var oe = b._CreateMirror(T.name, T.renderTargetSize, N, Y);
+ return oe._waitingRenderList = T.renderList, oe.mirrorPlane = A.a.FromArray(T.mirrorPlane), L(), oe;
+ }
+ if (T.isRenderTarget) {
+ var te = null;
+ if (T.isCube) {
+ if (N.reflectionProbes)
+ for (var _e = 0; _e < N.reflectionProbes.length; _e++) {
+ var de = N.reflectionProbes[_e];
+ if (de.name === T.name)
+ return de.cubeTexture;
+ }
+ } else
+ (te = b._CreateRenderTargetTexture(T.name, T.renderTargetSize, N, Y))._waitingRenderList = T.renderList;
+ return L(), te;
+ }
+ if (T.base64String)
+ W = b.CreateFromBase64String(T.base64String, T.name, N, !Y, T.invertY, void 0, L);
+ else {
+ var ae = void 0;
+ ae = T.name && T.name.indexOf("://") > 0 ? T.name : U + T.name, (y.a.StartsWith(T.url, "data:") || b.UseSerializedUrlIfAny && T.url) && (ae = T.url), W = new b(ae, N, !Y, T.invertY, void 0, L);
+ }
+ return W;
+ }, T, N);
+ return j;
+ }, b.CreateFromBase64String = function(T, N, U, B, L, j, W, Y, oe) {
+ return j === void 0 && (j = b.TRILINEAR_SAMPLINGMODE), W === void 0 && (W = null), Y === void 0 && (Y = null), oe === void 0 && (oe = x.a.TEXTUREFORMAT_RGBA), new b("data:" + N, U, B, L, j, W, Y, T, !1, oe);
+ }, b.LoadFromDataString = function(T, N, U, B, L, j, W, Y, oe, te) {
+ return B === void 0 && (B = !1), L === void 0 && (L = !1), j === void 0 && (j = !0), W === void 0 && (W = b.TRILINEAR_SAMPLINGMODE), Y === void 0 && (Y = null), oe === void 0 && (oe = null), te === void 0 && (te = x.a.TEXTUREFORMAT_RGBA), T.substr(0, 5) !== "data:" && (T = "data:" + T), new b(T, U, L, j, W, Y, oe, N, B, te);
+ }, b.SerializeBuffers = !0, b.ForceSerializeBuffers = !1, b._CubeTextureParser = function(T, N, U) {
+ throw g.a.WarnImport("CubeTexture");
+ }, b._CreateMirror = function(T, N, U, B) {
+ throw g.a.WarnImport("MirrorTexture");
+ }, b._CreateRenderTargetTexture = function(T, N, U, B) {
+ throw g.a.WarnImport("RenderTargetTexture");
+ }, b.NEAREST_SAMPLINGMODE = x.a.TEXTURE_NEAREST_SAMPLINGMODE, b.NEAREST_NEAREST_MIPLINEAR = x.a.TEXTURE_NEAREST_NEAREST_MIPLINEAR, b.BILINEAR_SAMPLINGMODE = x.a.TEXTURE_BILINEAR_SAMPLINGMODE, b.LINEAR_LINEAR_MIPNEAREST = x.a.TEXTURE_LINEAR_LINEAR_MIPNEAREST, b.TRILINEAR_SAMPLINGMODE = x.a.TEXTURE_TRILINEAR_SAMPLINGMODE, b.LINEAR_LINEAR_MIPLINEAR = x.a.TEXTURE_LINEAR_LINEAR_MIPLINEAR, b.NEAREST_NEAREST_MIPNEAREST = x.a.TEXTURE_NEAREST_NEAREST_MIPNEAREST, b.NEAREST_LINEAR_MIPNEAREST = x.a.TEXTURE_NEAREST_LINEAR_MIPNEAREST, b.NEAREST_LINEAR_MIPLINEAR = x.a.TEXTURE_NEAREST_LINEAR_MIPLINEAR, b.NEAREST_LINEAR = x.a.TEXTURE_NEAREST_LINEAR, b.NEAREST_NEAREST = x.a.TEXTURE_NEAREST_NEAREST, b.LINEAR_NEAREST_MIPNEAREST = x.a.TEXTURE_LINEAR_NEAREST_MIPNEAREST, b.LINEAR_NEAREST_MIPLINEAR = x.a.TEXTURE_LINEAR_NEAREST_MIPLINEAR, b.LINEAR_LINEAR = x.a.TEXTURE_LINEAR_LINEAR, b.LINEAR_NEAREST = x.a.TEXTURE_LINEAR_NEAREST, b.EXPLICIT_MODE = x.a.TEXTURE_EXPLICIT_MODE, b.SPHERICAL_MODE = x.a.TEXTURE_SPHERICAL_MODE, b.PLANAR_MODE = x.a.TEXTURE_PLANAR_MODE, b.CUBIC_MODE = x.a.TEXTURE_CUBIC_MODE, b.PROJECTION_MODE = x.a.TEXTURE_PROJECTION_MODE, b.SKYBOX_MODE = x.a.TEXTURE_SKYBOX_MODE, b.INVCUBIC_MODE = x.a.TEXTURE_INVCUBIC_MODE, b.EQUIRECTANGULAR_MODE = x.a.TEXTURE_EQUIRECTANGULAR_MODE, b.FIXED_EQUIRECTANGULAR_MODE = x.a.TEXTURE_FIXED_EQUIRECTANGULAR_MODE, b.FIXED_EQUIRECTANGULAR_MIRRORED_MODE = x.a.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE, b.CLAMP_ADDRESSMODE = x.a.TEXTURE_CLAMP_ADDRESSMODE, b.WRAP_ADDRESSMODE = x.a.TEXTURE_WRAP_ADDRESSMODE, b.MIRROR_ADDRESSMODE = x.a.TEXTURE_MIRROR_ADDRESSMODE, b.UseSerializedUrlIfAny = !1, Object(D.c)([Object(f.c)()], b.prototype, "url", void 0), Object(D.c)([Object(f.c)()], b.prototype, "uOffset", void 0), Object(D.c)([Object(f.c)()], b.prototype, "vOffset", void 0), Object(D.c)([Object(f.c)()], b.prototype, "uScale", void 0), Object(D.c)([Object(f.c)()], b.prototype, "vScale", void 0), Object(D.c)([Object(f.c)()], b.prototype, "uAng", void 0), Object(D.c)([Object(f.c)()], b.prototype, "vAng", void 0), Object(D.c)([Object(f.c)()], b.prototype, "wAng", void 0), Object(D.c)([Object(f.c)()], b.prototype, "uRotationCenter", void 0), Object(D.c)([Object(f.c)()], b.prototype, "vRotationCenter", void 0), Object(D.c)([Object(f.c)()], b.prototype, "wRotationCenter", void 0), Object(D.c)([Object(f.c)()], b.prototype, "homogeneousRotationInUVTransform", void 0), Object(D.c)([Object(f.c)()], b.prototype, "isBlocking", null), b;
+ }(C.a);
+ R.a.RegisteredTypes["BABYLON.Texture"] = h, f.a._TextureParser = h.Parse;
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ function f() {
+ }
+ return f.GetClass = function(P) {
+ return this.RegisteredTypes && this.RegisteredTypes[P] ? this.RegisteredTypes[P] : null;
+ }, f.RegisteredTypes = {}, f;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "b", function() {
+ return h;
+ }), l.d(_, "c", function() {
+ return d;
+ }), l.d(_, "a", function() {
+ return b;
+ });
+ var D = l(6), f = l(38), P = l(8), c = l(41), C = l(57), x = l(21), R = l(49), g = l(22), u = l(56), E = l(145), A = l(104), y = l(122), v = l(120), h = function() {
+ function T() {
+ }
+ return Object.defineProperty(T, "BaseUrl", { get: function() {
+ return u.a.BaseUrl;
+ }, set: function(N) {
+ u.a.BaseUrl = N;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(T, "DefaultRetryStrategy", { get: function() {
+ return u.a.DefaultRetryStrategy;
+ }, set: function(N) {
+ u.a.DefaultRetryStrategy = N;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(T, "CorsBehavior", { get: function() {
+ return u.a.CorsBehavior;
+ }, set: function(N) {
+ u.a.CorsBehavior = N;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(T, "UseFallbackTexture", { get: function() {
+ return g.a.UseFallbackTexture;
+ }, set: function(N) {
+ g.a.UseFallbackTexture = N;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(T, "RegisteredExternalClasses", { get: function() {
+ return y.a.RegisteredExternalClasses;
+ }, set: function(N) {
+ y.a.RegisteredExternalClasses = N;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(T, "fallbackTexture", { get: function() {
+ return g.a.FallbackTexture;
+ }, set: function(N) {
+ g.a.FallbackTexture = N;
+ }, enumerable: !1, configurable: !0 }), T.FetchToRef = function(N, U, B, L, j, W) {
+ var Y = 4 * ((Math.abs(N) * B % B | 0) + (Math.abs(U) * L % L | 0) * B);
+ W.r = j[Y] / 255, W.g = j[Y + 1] / 255, W.b = j[Y + 2] / 255, W.a = j[Y + 3] / 255;
+ }, T.Mix = function(N, U, B) {
+ return N * (1 - B) + U * B;
+ }, T.Instantiate = function(N) {
+ return y.a.Instantiate(N);
+ }, T.Slice = function(N, U, B) {
+ return N.slice ? N.slice(U, B) : Array.prototype.slice.call(N, U, B);
+ }, T.SliceToArray = function(N, U, B) {
+ return Array.isArray(N) ? N.slice(U, B) : Array.prototype.slice.call(N, U, B);
+ }, T.SetImmediate = function(N) {
+ A.a.SetImmediate(N);
+ }, T.IsExponentOfTwo = function(N) {
+ var U = 1;
+ do
+ U *= 2;
+ while (U < N);
+ return U === N;
+ }, T.FloatRound = function(N) {
+ return Math.fround ? Math.fround(N) : T._tmpFloatArray[0] = N;
+ }, T.GetFilename = function(N) {
+ var U = N.lastIndexOf("/");
+ return U < 0 ? N : N.substring(U + 1);
+ }, T.GetFolderPath = function(N, U) {
+ U === void 0 && (U = !1);
+ var B = N.lastIndexOf("/");
+ return B < 0 ? U ? N : "" : N.substring(0, B + 1);
+ }, T.ToDegrees = function(N) {
+ return 180 * N / Math.PI;
+ }, T.ToRadians = function(N) {
+ return N * Math.PI / 180;
+ }, T.MakeArray = function(N, U) {
+ return U === !0 || N !== void 0 && N != null ? Array.isArray(N) ? N : [N] : null;
+ }, T.GetPointerPrefix = function(N) {
+ var U = "pointer";
+ return f.a.IsWindowObjectExist() && !window.PointerEvent && f.a.IsNavigatorAvailable() && !navigator.pointerEnabled && (U = "mouse"), !N._badDesktopOS || N._badOS || document && "ontouchend" in document || (U = "mouse"), U;
+ }, T.SetCorsBehavior = function(N, U) {
+ u.a.SetCorsBehavior(N, U);
+ }, T.CleanUrl = function(N) {
+ return N = N.replace(/#/gm, "%23");
+ }, Object.defineProperty(T, "PreprocessUrl", { get: function() {
+ return u.a.PreprocessUrl;
+ }, set: function(N) {
+ u.a.PreprocessUrl = N;
+ }, enumerable: !1, configurable: !0 }), T.LoadImage = function(N, U, B, L, j) {
+ return u.a.LoadImage(N, U, B, L, j);
+ }, T.LoadFile = function(N, U, B, L, j, W) {
+ return u.a.LoadFile(N, U, B, L, j, W);
+ }, T.LoadFileAsync = function(N, U) {
+ return U === void 0 && (U = !0), new Promise(function(B, L) {
+ u.a.LoadFile(N, function(j) {
+ B(j);
+ }, void 0, void 0, U, function(j, W) {
+ L(W);
+ });
+ });
+ }, T.LoadScript = function(N, U, B, L) {
+ if (f.a.IsWindowObjectExist()) {
+ var j = document.getElementsByTagName("head")[0], W = document.createElement("script");
+ W.setAttribute("type", "text/javascript"), W.setAttribute("src", N), L && (W.id = L), W.onload = function() {
+ U && U();
+ }, W.onerror = function(Y) {
+ B && B("Unable to load script '" + N + "'", Y);
+ }, j.appendChild(W);
+ }
+ }, T.LoadScriptAsync = function(N, U) {
+ var B = this;
+ return new Promise(function(L, j) {
+ B.LoadScript(N, function() {
+ L();
+ }, function(W, Y) {
+ j(Y);
+ });
+ });
+ }, T.ReadFileAsDataURL = function(N, U, B) {
+ var L = new FileReader(), j = { onCompleteObservable: new D.c(), abort: function() {
+ return L.abort();
+ } };
+ return L.onloadend = function(W) {
+ j.onCompleteObservable.notifyObservers(j);
+ }, L.onload = function(W) {
+ U(W.target.result);
+ }, L.onprogress = B, L.readAsDataURL(N), j;
+ }, T.ReadFile = function(N, U, B, L, j) {
+ return u.a.ReadFile(N, U, B, L, j);
+ }, T.FileAsURL = function(N) {
+ var U = new Blob([N]);
+ return (window.URL || window.webkitURL).createObjectURL(U);
+ }, T.Format = function(N, U) {
+ return U === void 0 && (U = 2), N.toFixed(U);
+ }, T.DeepCopy = function(N, U, B, L) {
+ c.a.DeepCopy(N, U, B, L);
+ }, T.IsEmpty = function(N) {
+ for (var U in N)
+ if (N.hasOwnProperty(U))
+ return !1;
+ return !0;
+ }, T.RegisterTopRootEvents = function(N, U) {
+ for (var B = 0; B < U.length; B++) {
+ var L = U[B];
+ N.addEventListener(L.name, L.handler, !1);
+ try {
+ window.parent && window.parent.addEventListener(L.name, L.handler, !1);
+ } catch {
+ }
+ }
+ }, T.UnregisterTopRootEvents = function(N, U) {
+ for (var B = 0; B < U.length; B++) {
+ var L = U[B];
+ N.removeEventListener(L.name, L.handler);
+ try {
+ N.parent && N.parent.removeEventListener(L.name, L.handler);
+ } catch {
+ }
+ }
+ }, T.DumpFramebuffer = function(N, U, B, L, j, W) {
+ j === void 0 && (j = "image/png");
+ for (var Y = 4 * N, oe = U / 2, te = B.readPixels(0, 0, N, U), _e = 0; _e < oe; _e++)
+ for (var de = 0; de < Y; de++) {
+ var ae = de + _e * Y, ie = de + (U - _e - 1) * Y, Z = te[ae];
+ te[ae] = te[ie], te[ie] = Z;
+ }
+ T._ScreenshotCanvas || (T._ScreenshotCanvas = document.createElement("canvas")), T._ScreenshotCanvas.width = N, T._ScreenshotCanvas.height = U;
+ var ee = T._ScreenshotCanvas.getContext("2d");
+ if (ee) {
+ var w = ee.createImageData(N, U);
+ w.data.set(te), ee.putImageData(w, 0, 0), T.EncodeScreenshotCanvasData(L, j, W);
+ }
+ }, T.ToBlob = function(N, U, B) {
+ B === void 0 && (B = "image/png"), N.toBlob || (N.toBlob = function(L, j, W) {
+ var Y = this;
+ setTimeout(function() {
+ for (var oe = atob(Y.toDataURL(j, W).split(",")[1]), te = oe.length, _e = new Uint8Array(te), de = 0; de < te; de++)
+ _e[de] = oe.charCodeAt(de);
+ L(new Blob([_e]));
+ });
+ }), N.toBlob(function(L) {
+ U(L);
+ }, B);
+ }, T.EncodeScreenshotCanvasData = function(N, U, B) {
+ U === void 0 && (U = "image/png"), N ? N(T._ScreenshotCanvas.toDataURL(U)) : this.ToBlob(T._ScreenshotCanvas, function(L) {
+ if ("download" in document.createElement("a")) {
+ if (!B) {
+ var j = /* @__PURE__ */ new Date(), W = (j.getFullYear() + "-" + (j.getMonth() + 1)).slice(2) + "-" + j.getDate() + "_" + j.getHours() + "-" + ("0" + j.getMinutes()).slice(-2);
+ B = "screenshot_" + W + ".png";
+ }
+ T.Download(L, B);
+ } else {
+ var Y = URL.createObjectURL(L), oe = window.open("");
+ if (!oe)
+ return;
+ var te = oe.document.createElement("img");
+ te.onload = function() {
+ URL.revokeObjectURL(Y);
+ }, te.src = Y, oe.document.body.appendChild(te);
+ }
+ }, U);
+ }, T.Download = function(N, U) {
+ if (navigator && navigator.msSaveBlob)
+ navigator.msSaveBlob(N, U);
+ else {
+ var B = window.URL.createObjectURL(N), L = document.createElement("a");
+ document.body.appendChild(L), L.style.display = "none", L.href = B, L.download = U, L.addEventListener("click", function() {
+ L.parentElement && L.parentElement.removeChild(L);
+ }), L.click(), window.URL.revokeObjectURL(B);
+ }
+ }, T.BackCompatCameraNoPreventDefault = function(N) {
+ return typeof N[0] == "boolean" ? N[0] : typeof N[1] == "boolean" && N[1];
+ }, T.CreateScreenshot = function(N, U, B, L, j) {
+ throw x.a.WarnImport("ScreenshotTools");
+ }, T.CreateScreenshotAsync = function(N, U, B, L) {
+ throw x.a.WarnImport("ScreenshotTools");
+ }, T.CreateScreenshotUsingRenderTarget = function(N, U, B, L, j, W, Y, oe) {
+ throw x.a.WarnImport("ScreenshotTools");
+ }, T.CreateScreenshotUsingRenderTargetAsync = function(N, U, B, L, j, W, Y) {
+ throw x.a.WarnImport("ScreenshotTools");
+ }, T.RandomId = function() {
+ return v.a.RandomId();
+ }, T.IsBase64 = function(N) {
+ return !(N.length < 5) && N.substr(0, 5) === "data:";
+ }, T.DecodeBase64 = function(N) {
+ for (var U = atob(N.split(",")[1]), B = U.length, L = new Uint8Array(new ArrayBuffer(B)), j = 0; j < B; j++)
+ L[j] = U.charCodeAt(j);
+ return L.buffer;
+ }, T.GetAbsoluteUrl = function(N) {
+ var U = document.createElement("a");
+ return U.href = N, U.href;
+ }, Object.defineProperty(T, "errorsCount", { get: function() {
+ return P.a.errorsCount;
+ }, enumerable: !1, configurable: !0 }), T.Log = function(N) {
+ P.a.Log(N);
+ }, T.Warn = function(N) {
+ P.a.Warn(N);
+ }, T.Error = function(N) {
+ P.a.Error(N);
+ }, Object.defineProperty(T, "LogCache", { get: function() {
+ return P.a.LogCache;
+ }, enumerable: !1, configurable: !0 }), T.ClearLogCache = function() {
+ P.a.ClearLogCache();
+ }, Object.defineProperty(T, "LogLevels", { set: function(N) {
+ P.a.LogLevels = N;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(T, "PerformanceLogLevel", { set: function(N) {
+ return (N & T.PerformanceUserMarkLogLevel) === T.PerformanceUserMarkLogLevel ? (T.StartPerformanceCounter = T._StartUserMark, void (T.EndPerformanceCounter = T._EndUserMark)) : (N & T.PerformanceConsoleLogLevel) === T.PerformanceConsoleLogLevel ? (T.StartPerformanceCounter = T._StartPerformanceConsole, void (T.EndPerformanceCounter = T._EndPerformanceConsole)) : (T.StartPerformanceCounter = T._StartPerformanceCounterDisabled, void (T.EndPerformanceCounter = T._EndPerformanceCounterDisabled));
+ }, enumerable: !1, configurable: !0 }), T._StartPerformanceCounterDisabled = function(N, U) {
+ }, T._EndPerformanceCounterDisabled = function(N, U) {
+ }, T._StartUserMark = function(N, U) {
+ if (U === void 0 && (U = !0), !T._performance) {
+ if (!f.a.IsWindowObjectExist())
+ return;
+ T._performance = window.performance;
+ }
+ U && T._performance.mark && T._performance.mark(N + "-Begin");
+ }, T._EndUserMark = function(N, U) {
+ U === void 0 && (U = !0), U && T._performance.mark && (T._performance.mark(N + "-End"), T._performance.measure(N, N + "-Begin", N + "-End"));
+ }, T._StartPerformanceConsole = function(N, U) {
+ U === void 0 && (U = !0), U && (T._StartUserMark(N, U), console.time && console.time(N));
+ }, T._EndPerformanceConsole = function(N, U) {
+ U === void 0 && (U = !0), U && (T._EndUserMark(N, U), console.timeEnd(N));
+ }, Object.defineProperty(T, "Now", { get: function() {
+ return C.a.Now;
+ }, enumerable: !1, configurable: !0 }), T.GetClassName = function(N, U) {
+ U === void 0 && (U = !1);
+ var B = null;
+ return !U && N.getClassName ? B = N.getClassName() : (N instanceof Object && (B = (U ? N : Object.getPrototypeOf(N)).constructor.__bjsclassName__), B || (B = typeof N)), B;
+ }, T.First = function(N, U) {
+ for (var B = 0, L = N; B < L.length; B++) {
+ var j = L[B];
+ if (U(j))
+ return j;
+ }
+ return null;
+ }, T.getFullClassName = function(N, U) {
+ U === void 0 && (U = !1);
+ var B = null, L = null;
+ if (!U && N.getClassName)
+ B = N.getClassName();
+ else {
+ if (N instanceof Object) {
+ var j = U ? N : Object.getPrototypeOf(N);
+ B = j.constructor.__bjsclassName__, L = j.constructor.__bjsmoduleName__;
+ }
+ B || (B = typeof N);
+ }
+ return B ? (L != null ? L + "." : "") + B : null;
+ }, T.DelayAsync = function(N) {
+ return new Promise(function(U) {
+ setTimeout(function() {
+ U();
+ }, N);
+ });
+ }, T.IsSafari = function() {
+ return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
+ }, T.UseCustomRequestHeaders = !1, T.CustomRequestHeaders = R.a.CustomRequestHeaders, T._tmpFloatArray = new Float32Array(1), T.GetDOMTextContent = f.a.GetDOMTextContent, T.NoneLogLevel = P.a.NoneLogLevel, T.MessageLogLevel = P.a.MessageLogLevel, T.WarningLogLevel = P.a.WarningLogLevel, T.ErrorLogLevel = P.a.ErrorLogLevel, T.AllLogLevel = P.a.AllLogLevel, T.IsWindowObjectExist = f.a.IsWindowObjectExist, T.PerformanceNoneLogLevel = 0, T.PerformanceUserMarkLogLevel = 1, T.PerformanceConsoleLogLevel = 2, T.StartPerformanceCounter = T._StartPerformanceCounterDisabled, T.EndPerformanceCounter = T._EndPerformanceCounterDisabled, T;
+ }();
+ function d(T, N) {
+ return function(U) {
+ U.__bjsclassName__ = T, U.__bjsmoduleName__ = N ?? null;
+ };
+ }
+ var b = function() {
+ function T(N, U, B, L) {
+ L === void 0 && (L = 0), this.iterations = N, this.index = L - 1, this._done = !1, this._fn = U, this._successCallback = B;
+ }
+ return T.prototype.executeNext = function() {
+ this._done || (this.index + 1 < this.iterations ? (++this.index, this._fn(this)) : this.breakLoop());
+ }, T.prototype.breakLoop = function() {
+ this._done = !0, this._successCallback();
+ }, T.Run = function(N, U, B, L) {
+ L === void 0 && (L = 0);
+ var j = new T(N, U, B, L);
+ return j.executeNext(), j;
+ }, T.SyncAsyncForLoop = function(N, U, B, L, j, W) {
+ return W === void 0 && (W = 0), T.Run(Math.ceil(N / U), function(Y) {
+ j && j() ? Y.breakLoop() : setTimeout(function() {
+ for (var oe = 0; oe < U; ++oe) {
+ var te = Y.index * U + oe;
+ if (te >= N)
+ break;
+ if (B(te), j && j()) {
+ Y.breakLoop();
+ break;
+ }
+ }
+ Y.executeNext();
+ }, W);
+ }, L);
+ }, T;
+ }();
+ g.a.FallbackTexture = "data:image/jpg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QBmRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAAQAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQubmV0IDQuMC41AP/bAEMABAIDAwMCBAMDAwQEBAQFCQYFBQUFCwgIBgkNCw0NDQsMDA4QFBEODxMPDAwSGBITFRYXFxcOERkbGRYaFBYXFv/bAEMBBAQEBQUFCgYGChYPDA8WFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFv/AABEIAQABAAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/APH6KKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76P//Z", E.a.Apply();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return y;
+ });
+ var D = l(1), f = l(6), P = l(38), c = l(22), C = l(21), x = l(26), R = l(2), g = l(146), u = l(55), E = l(88), A = l(8), y = (l(123), l(129), l(124), function(v) {
+ function h(d, b, T, N) {
+ N === void 0 && (N = !1);
+ var U = v.call(this, d, b, T, N) || this;
+ if (U.enableOfflineSupport = !1, U.disableManifestCheck = !1, U.scenes = new Array(), U.onNewSceneAddedObservable = new f.c(), U.postProcesses = new Array(), U.isPointerLock = !1, U.onResizeObservable = new f.c(), U.onCanvasBlurObservable = new f.c(), U.onCanvasFocusObservable = new f.c(), U.onCanvasPointerOutObservable = new f.c(), U.onBeginFrameObservable = new f.c(), U.customAnimationFrameRequester = null, U.onEndFrameObservable = new f.c(), U.onBeforeShaderCompilationObservable = new f.c(), U.onAfterShaderCompilationObservable = new f.c(), U._deterministicLockstep = !1, U._lockstepMaxSteps = 4, U._timeStep = 1 / 60, U._fps = 60, U._deltaTime = 0, U._drawCalls = new u.a(), U.canvasTabIndex = 1, U.disablePerformanceMonitorInBackground = !1, U._performanceMonitor = new g.a(), h.Instances.push(U), !d)
+ return U;
+ if (T = U._creationOptions, d.getContext) {
+ var B = d;
+ if (U._onCanvasFocus = function() {
+ U.onCanvasFocusObservable.notifyObservers(U);
+ }, U._onCanvasBlur = function() {
+ U.onCanvasBlurObservable.notifyObservers(U);
+ }, B.addEventListener("focus", U._onCanvasFocus), B.addEventListener("blur", U._onCanvasBlur), U._onBlur = function() {
+ U.disablePerformanceMonitorInBackground && U._performanceMonitor.disable(), U._windowIsBackground = !0;
+ }, U._onFocus = function() {
+ U.disablePerformanceMonitorInBackground && U._performanceMonitor.enable(), U._windowIsBackground = !1;
+ }, U._onCanvasPointerOut = function(W) {
+ U.onCanvasPointerOutObservable.notifyObservers(W);
+ }, B.addEventListener("pointerout", U._onCanvasPointerOut), P.a.IsWindowObjectExist()) {
+ var L = U.getHostWindow();
+ L.addEventListener("blur", U._onBlur), L.addEventListener("focus", U._onFocus);
+ var j = document;
+ U._onFullscreenChange = function() {
+ j.fullscreen !== void 0 ? U.isFullscreen = j.fullscreen : j.mozFullScreen !== void 0 ? U.isFullscreen = j.mozFullScreen : j.webkitIsFullScreen !== void 0 ? U.isFullscreen = j.webkitIsFullScreen : j.msIsFullScreen !== void 0 && (U.isFullscreen = j.msIsFullScreen), U.isFullscreen && U._pointerLockRequested && B && h._RequestPointerlock(B);
+ }, document.addEventListener("fullscreenchange", U._onFullscreenChange, !1), document.addEventListener("mozfullscreenchange", U._onFullscreenChange, !1), document.addEventListener("webkitfullscreenchange", U._onFullscreenChange, !1), document.addEventListener("msfullscreenchange", U._onFullscreenChange, !1), U._onPointerLockChange = function() {
+ U.isPointerLock = j.mozPointerLockElement === B || j.webkitPointerLockElement === B || j.msPointerLockElement === B || j.pointerLockElement === B;
+ }, document.addEventListener("pointerlockchange", U._onPointerLockChange, !1), document.addEventListener("mspointerlockchange", U._onPointerLockChange, !1), document.addEventListener("mozpointerlockchange", U._onPointerLockChange, !1), document.addEventListener("webkitpointerlockchange", U._onPointerLockChange, !1), !h.audioEngine && T.audioEngine && h.AudioEngineFactory && (h.audioEngine = h.AudioEngineFactory(U.getRenderingCanvas()));
+ }
+ U._connectVREvents(), U.enableOfflineSupport = h.OfflineProviderFactory !== void 0, T.doNotHandleTouchAction || U._disableTouchAction(), U._deterministicLockstep = !!T.deterministicLockstep, U._lockstepMaxSteps = T.lockstepMaxSteps || 0, U._timeStep = T.timeStep || 1 / 60;
+ }
+ return U._prepareVRComponent(), T.autoEnableWebVR && U.initWebVR(), U;
+ }
+ return Object(D.d)(h, v), Object.defineProperty(h, "NpmPackage", { get: function() {
+ return x.a.NpmPackage;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(h, "Version", { get: function() {
+ return x.a.Version;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(h, "Instances", { get: function() {
+ return c.a.Instances;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(h, "LastCreatedEngine", { get: function() {
+ return c.a.LastCreatedEngine;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(h, "LastCreatedScene", { get: function() {
+ return c.a.LastCreatedScene;
+ }, enumerable: !1, configurable: !0 }), h.MarkAllMaterialsAsDirty = function(d, b) {
+ for (var T = 0; T < h.Instances.length; T++)
+ for (var N = h.Instances[T], U = 0; U < N.scenes.length; U++)
+ N.scenes[U].markAllMaterialsAsDirty(d, b);
+ }, h.DefaultLoadingScreenFactory = function(d) {
+ throw C.a.WarnImport("LoadingScreen");
+ }, Object.defineProperty(h.prototype, "_supportsHardwareTextureRescaling", { get: function() {
+ return !!h._RescalePostProcessFactory;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(h.prototype, "performanceMonitor", { get: function() {
+ return this._performanceMonitor;
+ }, enumerable: !1, configurable: !0 }), h.prototype.getInputElement = function() {
+ return this._renderingCanvas;
+ }, h.prototype.getAspectRatio = function(d, b) {
+ b === void 0 && (b = !1);
+ var T = d.viewport;
+ return this.getRenderWidth(b) * T.width / (this.getRenderHeight(b) * T.height);
+ }, h.prototype.getScreenAspectRatio = function() {
+ return this.getRenderWidth(!0) / this.getRenderHeight(!0);
+ }, h.prototype.getRenderingCanvasClientRect = function() {
+ return this._renderingCanvas ? this._renderingCanvas.getBoundingClientRect() : null;
+ }, h.prototype.getInputElementClientRect = function() {
+ return this._renderingCanvas ? this.getInputElement().getBoundingClientRect() : null;
+ }, h.prototype.isDeterministicLockStep = function() {
+ return this._deterministicLockstep;
+ }, h.prototype.getLockstepMaxSteps = function() {
+ return this._lockstepMaxSteps;
+ }, h.prototype.getTimeStep = function() {
+ return 1e3 * this._timeStep;
+ }, h.prototype.generateMipMapsForCubemap = function(d, b) {
+ if (b === void 0 && (b = !0), d.generateMipMaps) {
+ var T = this._gl;
+ this._bindTextureDirectly(T.TEXTURE_CUBE_MAP, d, !0), T.generateMipmap(T.TEXTURE_CUBE_MAP), b && this._bindTextureDirectly(T.TEXTURE_CUBE_MAP, null);
+ }
+ }, h.prototype.setState = function(d, b, T, N) {
+ b === void 0 && (b = 0), N === void 0 && (N = !1), (this._depthCullingState.cull !== d || T) && (this._depthCullingState.cull = d);
+ var U = this.cullBackFaces ? this._gl.BACK : this._gl.FRONT;
+ (this._depthCullingState.cullFace !== U || T) && (this._depthCullingState.cullFace = U), this.setZOffset(b);
+ var B = N ? this._gl.CW : this._gl.CCW;
+ (this._depthCullingState.frontFace !== B || T) && (this._depthCullingState.frontFace = B);
+ }, h.prototype.setZOffset = function(d) {
+ this._depthCullingState.zOffset = d;
+ }, h.prototype.getZOffset = function() {
+ return this._depthCullingState.zOffset;
+ }, h.prototype.setDepthBuffer = function(d) {
+ this._depthCullingState.depthTest = d;
+ }, h.prototype.getDepthWrite = function() {
+ return this._depthCullingState.depthMask;
+ }, h.prototype.setDepthWrite = function(d) {
+ this._depthCullingState.depthMask = d;
+ }, h.prototype.getStencilBuffer = function() {
+ return this._stencilState.stencilTest;
+ }, h.prototype.setStencilBuffer = function(d) {
+ this._stencilState.stencilTest = d;
+ }, h.prototype.getStencilMask = function() {
+ return this._stencilState.stencilMask;
+ }, h.prototype.setStencilMask = function(d) {
+ this._stencilState.stencilMask = d;
+ }, h.prototype.getStencilFunction = function() {
+ return this._stencilState.stencilFunc;
+ }, h.prototype.getStencilFunctionReference = function() {
+ return this._stencilState.stencilFuncRef;
+ }, h.prototype.getStencilFunctionMask = function() {
+ return this._stencilState.stencilFuncMask;
+ }, h.prototype.setStencilFunction = function(d) {
+ this._stencilState.stencilFunc = d;
+ }, h.prototype.setStencilFunctionReference = function(d) {
+ this._stencilState.stencilFuncRef = d;
+ }, h.prototype.setStencilFunctionMask = function(d) {
+ this._stencilState.stencilFuncMask = d;
+ }, h.prototype.getStencilOperationFail = function() {
+ return this._stencilState.stencilOpStencilFail;
+ }, h.prototype.getStencilOperationDepthFail = function() {
+ return this._stencilState.stencilOpDepthFail;
+ }, h.prototype.getStencilOperationPass = function() {
+ return this._stencilState.stencilOpStencilDepthPass;
+ }, h.prototype.setStencilOperationFail = function(d) {
+ this._stencilState.stencilOpStencilFail = d;
+ }, h.prototype.setStencilOperationDepthFail = function(d) {
+ this._stencilState.stencilOpDepthFail = d;
+ }, h.prototype.setStencilOperationPass = function(d) {
+ this._stencilState.stencilOpStencilDepthPass = d;
+ }, h.prototype.setDitheringState = function(d) {
+ d ? this._gl.enable(this._gl.DITHER) : this._gl.disable(this._gl.DITHER);
+ }, h.prototype.setRasterizerState = function(d) {
+ d ? this._gl.disable(this._gl.RASTERIZER_DISCARD) : this._gl.enable(this._gl.RASTERIZER_DISCARD);
+ }, h.prototype.getDepthFunction = function() {
+ return this._depthCullingState.depthFunc;
+ }, h.prototype.setDepthFunction = function(d) {
+ this._depthCullingState.depthFunc = d;
+ }, h.prototype.setDepthFunctionToGreater = function() {
+ this._depthCullingState.depthFunc = this._gl.GREATER;
+ }, h.prototype.setDepthFunctionToGreaterOrEqual = function() {
+ this._depthCullingState.depthFunc = this._gl.GEQUAL;
+ }, h.prototype.setDepthFunctionToLess = function() {
+ this._depthCullingState.depthFunc = this._gl.LESS;
+ }, h.prototype.setDepthFunctionToLessOrEqual = function() {
+ this._depthCullingState.depthFunc = this._gl.LEQUAL;
+ }, h.prototype.cacheStencilState = function() {
+ this._cachedStencilBuffer = this.getStencilBuffer(), this._cachedStencilFunction = this.getStencilFunction(), this._cachedStencilMask = this.getStencilMask(), this._cachedStencilOperationPass = this.getStencilOperationPass(), this._cachedStencilOperationFail = this.getStencilOperationFail(), this._cachedStencilOperationDepthFail = this.getStencilOperationDepthFail(), this._cachedStencilReference = this.getStencilFunctionReference();
+ }, h.prototype.restoreStencilState = function() {
+ this.setStencilFunction(this._cachedStencilFunction), this.setStencilMask(this._cachedStencilMask), this.setStencilBuffer(this._cachedStencilBuffer), this.setStencilOperationPass(this._cachedStencilOperationPass), this.setStencilOperationFail(this._cachedStencilOperationFail), this.setStencilOperationDepthFail(this._cachedStencilOperationDepthFail), this.setStencilFunctionReference(this._cachedStencilReference);
+ }, h.prototype.setDirectViewport = function(d, b, T, N) {
+ var U = this._cachedViewport;
+ return this._cachedViewport = null, this._viewport(d, b, T, N), U;
+ }, h.prototype.scissorClear = function(d, b, T, N, U) {
+ this.enableScissor(d, b, T, N), this.clear(U, !0, !0, !0), this.disableScissor();
+ }, h.prototype.enableScissor = function(d, b, T, N) {
+ var U = this._gl;
+ U.enable(U.SCISSOR_TEST), U.scissor(d, b, T, N);
+ }, h.prototype.disableScissor = function() {
+ var d = this._gl;
+ d.disable(d.SCISSOR_TEST);
+ }, h.prototype._reportDrawCall = function() {
+ this._drawCalls.addCount(1, !1);
+ }, h.prototype.initWebVR = function() {
+ throw C.a.WarnImport("WebVRCamera");
+ }, h.prototype._prepareVRComponent = function() {
+ }, h.prototype._connectVREvents = function(d, b) {
+ }, h.prototype._submitVRFrame = function() {
+ }, h.prototype.disableVR = function() {
+ }, h.prototype.isVRPresenting = function() {
+ return !1;
+ }, h.prototype._requestVRFrame = function() {
+ }, h.prototype._loadFileAsync = function(d, b, T) {
+ var N = this;
+ return new Promise(function(U, B) {
+ N._loadFile(d, function(L) {
+ U(L);
+ }, void 0, b, T, function(L, j) {
+ B(j);
+ });
+ });
+ }, h.prototype.getVertexShaderSource = function(d) {
+ var b = this._gl.getAttachedShaders(d);
+ return b ? this._gl.getShaderSource(b[0]) : null;
+ }, h.prototype.getFragmentShaderSource = function(d) {
+ var b = this._gl.getAttachedShaders(d);
+ return b ? this._gl.getShaderSource(b[1]) : null;
+ }, h.prototype.setDepthStencilTexture = function(d, b, T) {
+ d !== void 0 && (b && (this._boundUniforms[d] = b), T && T.depthStencilTexture ? this._setTexture(d, T, !1, !0) : this._setTexture(d, null));
+ }, h.prototype.setTextureFromPostProcess = function(d, b) {
+ this._bindTexture(d, b ? b._textures.data[b._currentRenderTextureInd] : null);
+ }, h.prototype.setTextureFromPostProcessOutput = function(d, b) {
+ this._bindTexture(d, b ? b._outputTexture : null);
+ }, h.prototype._rebuildBuffers = function() {
+ for (var d = 0, b = this.scenes; d < b.length; d++) {
+ var T = b[d];
+ T.resetCachedMaterial(), T._rebuildGeometries(), T._rebuildTextures();
+ }
+ v.prototype._rebuildBuffers.call(this);
+ }, h.prototype._renderFrame = function() {
+ for (var d = 0; d < this._activeRenderLoops.length; d++)
+ (0, this._activeRenderLoops[d])();
+ }, h.prototype._renderLoop = function() {
+ if (!this._contextWasLost) {
+ var d = !0;
+ !this.renderEvenInBackground && this._windowIsBackground && (d = !1), d && (this.beginFrame(), this._renderViews() || this._renderFrame(), this.endFrame());
+ }
+ this._activeRenderLoops.length > 0 ? this.customAnimationFrameRequester ? (this.customAnimationFrameRequester.requestID = this._queueNewFrame(this.customAnimationFrameRequester.renderFunction || this._boundRenderFunction, this.customAnimationFrameRequester), this._frameHandler = this.customAnimationFrameRequester.requestID) : this.isVRPresenting() ? this._requestVRFrame() : this._frameHandler = this._queueNewFrame(this._boundRenderFunction, this.getHostWindow()) : this._renderingQueueLaunched = !1;
+ }, h.prototype._renderViews = function() {
+ return !1;
+ }, h.prototype.switchFullscreen = function(d) {
+ this.isFullscreen ? this.exitFullscreen() : this.enterFullscreen(d);
+ }, h.prototype.enterFullscreen = function(d) {
+ this.isFullscreen || (this._pointerLockRequested = d, this._renderingCanvas && h._RequestFullscreen(this._renderingCanvas));
+ }, h.prototype.exitFullscreen = function() {
+ this.isFullscreen && h._ExitFullscreen();
+ }, h.prototype.enterPointerlock = function() {
+ this._renderingCanvas && h._RequestPointerlock(this._renderingCanvas);
+ }, h.prototype.exitPointerlock = function() {
+ h._ExitPointerlock();
+ }, h.prototype.beginFrame = function() {
+ this._measureFps(), this.onBeginFrameObservable.notifyObservers(this), v.prototype.beginFrame.call(this);
+ }, h.prototype.endFrame = function() {
+ v.prototype.endFrame.call(this), this._submitVRFrame(), this.onEndFrameObservable.notifyObservers(this);
+ }, h.prototype.resize = function() {
+ this.isVRPresenting() || v.prototype.resize.call(this);
+ }, h.prototype.setSize = function(d, b) {
+ if (!this._renderingCanvas || !v.prototype.setSize.call(this, d, b))
+ return !1;
+ if (this.scenes) {
+ for (var T = 0; T < this.scenes.length; T++)
+ for (var N = this.scenes[T], U = 0; U < N.cameras.length; U++)
+ N.cameras[U]._currentRenderId = 0;
+ this.onResizeObservable.hasObservers() && this.onResizeObservable.notifyObservers(this);
+ }
+ return !0;
+ }, h.prototype._deletePipelineContext = function(d) {
+ var b = d;
+ b && b.program && b.transformFeedback && (this.deleteTransformFeedback(b.transformFeedback), b.transformFeedback = null), v.prototype._deletePipelineContext.call(this, d);
+ }, h.prototype.createShaderProgram = function(d, b, T, N, U, B) {
+ B === void 0 && (B = null), U = U || this._gl, this.onBeforeShaderCompilationObservable.notifyObservers(this);
+ var L = v.prototype.createShaderProgram.call(this, d, b, T, N, U, B);
+ return this.onAfterShaderCompilationObservable.notifyObservers(this), L;
+ }, h.prototype._createShaderProgram = function(d, b, T, N, U) {
+ U === void 0 && (U = null);
+ var B = N.createProgram();
+ if (d.program = B, !B)
+ throw new Error("Unable to create program");
+ if (N.attachShader(B, b), N.attachShader(B, T), this.webGLVersion > 1 && U) {
+ var L = this.createTransformFeedback();
+ this.bindTransformFeedback(L), this.setTranformFeedbackVaryings(B, U), d.transformFeedback = L;
+ }
+ return N.linkProgram(B), this.webGLVersion > 1 && U && this.bindTransformFeedback(null), d.context = N, d.vertexShader = b, d.fragmentShader = T, d.isParallelCompiled || this._finalizePipelineContext(d), B;
+ }, h.prototype._releaseTexture = function(d) {
+ v.prototype._releaseTexture.call(this, d), this.scenes.forEach(function(b) {
+ b.postProcesses.forEach(function(T) {
+ T._outputTexture == d && (T._outputTexture = null);
+ }), b.cameras.forEach(function(T) {
+ T._postProcesses.forEach(function(N) {
+ N && N._outputTexture == d && (N._outputTexture = null);
+ });
+ });
+ });
+ }, h.prototype._rescaleTexture = function(d, b, T, N, U) {
+ var B = this;
+ this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.LINEAR), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.LINEAR), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE);
+ var L = this.createRenderTargetTexture({ width: b.width, height: b.height }, { generateMipMaps: !1, type: R.a.TEXTURETYPE_UNSIGNED_INT, samplingMode: R.a.TEXTURE_BILINEAR_SAMPLINGMODE, generateDepthBuffer: !1, generateStencilBuffer: !1 });
+ !this._rescalePostProcess && h._RescalePostProcessFactory && (this._rescalePostProcess = h._RescalePostProcessFactory(this)), this._rescalePostProcess.getEffect().executeWhenCompiled(function() {
+ B._rescalePostProcess.onApply = function(W) {
+ W._bindTexture("textureSampler", d);
+ };
+ var j = T;
+ j || (j = B.scenes[B.scenes.length - 1]), j.postProcessManager.directRender([B._rescalePostProcess], L, !0), B._bindTextureDirectly(B._gl.TEXTURE_2D, b, !0), B._gl.copyTexImage2D(B._gl.TEXTURE_2D, 0, N, 0, 0, b.width, b.height, 0), B.unBindFramebuffer(L), B._releaseTexture(L), U && U();
+ });
+ }, h.prototype.getFps = function() {
+ return this._fps;
+ }, h.prototype.getDeltaTime = function() {
+ return this._deltaTime;
+ }, h.prototype._measureFps = function() {
+ this._performanceMonitor.sampleFrame(), this._fps = this._performanceMonitor.averageFPS, this._deltaTime = this._performanceMonitor.instantaneousFrameTime || 0;
+ }, h.prototype._uploadImageToTexture = function(d, b, T, N) {
+ T === void 0 && (T = 0), N === void 0 && (N = 0);
+ var U = this._gl, B = this._getWebGLTextureType(d.type), L = this._getInternalFormat(d.format), j = this._getRGBABufferInternalSizedFormat(d.type, L), W = d.isCube ? U.TEXTURE_CUBE_MAP : U.TEXTURE_2D;
+ this._bindTextureDirectly(W, d, !0), this._unpackFlipY(d.invertY);
+ var Y = U.TEXTURE_2D;
+ d.isCube && (Y = U.TEXTURE_CUBE_MAP_POSITIVE_X + T), U.texImage2D(Y, N, j, L, B, b), this._bindTextureDirectly(W, null, !0);
+ }, h.prototype.updateRenderTargetTextureSampleCount = function(d, b) {
+ if (this.webGLVersion < 2 || !d)
+ return 1;
+ if (d.samples === b)
+ return b;
+ var T = this._gl;
+ if (b = Math.min(b, this.getCaps().maxMSAASamples), d._depthStencilBuffer && (T.deleteRenderbuffer(d._depthStencilBuffer), d._depthStencilBuffer = null), d._MSAAFramebuffer && (T.deleteFramebuffer(d._MSAAFramebuffer), d._MSAAFramebuffer = null), d._MSAARenderBuffer && (T.deleteRenderbuffer(d._MSAARenderBuffer), d._MSAARenderBuffer = null), b > 1 && T.renderbufferStorageMultisample) {
+ var N = T.createFramebuffer();
+ if (!N)
+ throw new Error("Unable to create multi sampled framebuffer");
+ d._MSAAFramebuffer = N, this._bindUnboundFramebuffer(d._MSAAFramebuffer);
+ var U = T.createRenderbuffer();
+ if (!U)
+ throw new Error("Unable to create multi sampled framebuffer");
+ T.bindRenderbuffer(T.RENDERBUFFER, U), T.renderbufferStorageMultisample(T.RENDERBUFFER, b, this._getRGBAMultiSampleBufferFormat(d.type), d.width, d.height), T.framebufferRenderbuffer(T.FRAMEBUFFER, T.COLOR_ATTACHMENT0, T.RENDERBUFFER, U), d._MSAARenderBuffer = U;
+ } else
+ this._bindUnboundFramebuffer(d._framebuffer);
+ return d.samples = b, d._depthStencilBuffer = this._setupFramebufferDepthAttachments(d._generateStencilBuffer, d._generateDepthBuffer, d.width, d.height, b), this._bindUnboundFramebuffer(null), b;
+ }, h.prototype.updateTextureComparisonFunction = function(d, b) {
+ if (this.webGLVersion !== 1) {
+ var T = this._gl;
+ d.isCube ? (this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, d, !0), b === 0 ? (T.texParameteri(T.TEXTURE_CUBE_MAP, T.TEXTURE_COMPARE_FUNC, R.a.LEQUAL), T.texParameteri(T.TEXTURE_CUBE_MAP, T.TEXTURE_COMPARE_MODE, T.NONE)) : (T.texParameteri(T.TEXTURE_CUBE_MAP, T.TEXTURE_COMPARE_FUNC, b), T.texParameteri(T.TEXTURE_CUBE_MAP, T.TEXTURE_COMPARE_MODE, T.COMPARE_REF_TO_TEXTURE)), this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null)) : (this._bindTextureDirectly(this._gl.TEXTURE_2D, d, !0), b === 0 ? (T.texParameteri(T.TEXTURE_2D, T.TEXTURE_COMPARE_FUNC, R.a.LEQUAL), T.texParameteri(T.TEXTURE_2D, T.TEXTURE_COMPARE_MODE, T.NONE)) : (T.texParameteri(T.TEXTURE_2D, T.TEXTURE_COMPARE_FUNC, b), T.texParameteri(T.TEXTURE_2D, T.TEXTURE_COMPARE_MODE, T.COMPARE_REF_TO_TEXTURE)), this._bindTextureDirectly(this._gl.TEXTURE_2D, null)), d._comparisonFunction = b;
+ } else
+ A.a.Error("WebGL 1 does not support texture comparison.");
+ }, h.prototype.createInstancesBuffer = function(d) {
+ var b = this._gl.createBuffer();
+ if (!b)
+ throw new Error("Unable to create instance buffer");
+ var T = new E.a(b);
+ return T.capacity = d, this.bindArrayBuffer(T), this._gl.bufferData(this._gl.ARRAY_BUFFER, d, this._gl.DYNAMIC_DRAW), T;
+ }, h.prototype.deleteInstancesBuffer = function(d) {
+ this._gl.deleteBuffer(d);
+ }, h.prototype._clientWaitAsync = function(d, b, T) {
+ b === void 0 && (b = 0), T === void 0 && (T = 10);
+ var N = this._gl;
+ return new Promise(function(U, B) {
+ var L = function() {
+ var j = N.clientWaitSync(d, b, 0);
+ j != N.WAIT_FAILED ? j != N.TIMEOUT_EXPIRED ? U() : setTimeout(L, T) : B();
+ };
+ L();
+ });
+ }, h.prototype._readPixelsAsync = function(d, b, T, N, U, B, L) {
+ if (this._webGLVersion < 2)
+ throw new Error("_readPixelsAsync only work on WebGL2+");
+ var j = this._gl, W = j.createBuffer();
+ j.bindBuffer(j.PIXEL_PACK_BUFFER, W), j.bufferData(j.PIXEL_PACK_BUFFER, L.byteLength, j.STREAM_READ), j.readPixels(d, b, T, N, U, B, 0), j.bindBuffer(j.PIXEL_PACK_BUFFER, null);
+ var Y = j.fenceSync(j.SYNC_GPU_COMMANDS_COMPLETE, 0);
+ return Y ? (j.flush(), this._clientWaitAsync(Y, 0, 10).then(function() {
+ return j.deleteSync(Y), j.bindBuffer(j.PIXEL_PACK_BUFFER, W), j.getBufferSubData(j.PIXEL_PACK_BUFFER, 0, L), j.bindBuffer(j.PIXEL_PACK_BUFFER, null), j.deleteBuffer(W), L;
+ })) : null;
+ }, h.prototype.dispose = function() {
+ for (this.hideLoadingUI(), this.onNewSceneAddedObservable.clear(); this.postProcesses.length; )
+ this.postProcesses[0].dispose();
+ for (this._rescalePostProcess && this._rescalePostProcess.dispose(); this.scenes.length; )
+ this.scenes[0].dispose();
+ h.Instances.length === 1 && h.audioEngine && h.audioEngine.dispose(), this.disableVR(), P.a.IsWindowObjectExist() && (window.removeEventListener("blur", this._onBlur), window.removeEventListener("focus", this._onFocus), this._renderingCanvas && (this._renderingCanvas.removeEventListener("focus", this._onCanvasFocus), this._renderingCanvas.removeEventListener("blur", this._onCanvasBlur), this._renderingCanvas.removeEventListener("pointerout", this._onCanvasPointerOut)), P.a.IsDocumentAvailable() && (document.removeEventListener("fullscreenchange", this._onFullscreenChange), document.removeEventListener("mozfullscreenchange", this._onFullscreenChange), document.removeEventListener("webkitfullscreenchange", this._onFullscreenChange), document.removeEventListener("msfullscreenchange", this._onFullscreenChange), document.removeEventListener("pointerlockchange", this._onPointerLockChange), document.removeEventListener("mspointerlockchange", this._onPointerLockChange), document.removeEventListener("mozpointerlockchange", this._onPointerLockChange), document.removeEventListener("webkitpointerlockchange", this._onPointerLockChange))), v.prototype.dispose.call(this);
+ var d = h.Instances.indexOf(this);
+ d >= 0 && h.Instances.splice(d, 1), this.onResizeObservable.clear(), this.onCanvasBlurObservable.clear(), this.onCanvasFocusObservable.clear(), this.onCanvasPointerOutObservable.clear(), this.onBeginFrameObservable.clear(), this.onEndFrameObservable.clear();
+ }, h.prototype._disableTouchAction = function() {
+ this._renderingCanvas && this._renderingCanvas.setAttribute && (this._renderingCanvas.setAttribute("touch-action", "none"), this._renderingCanvas.style.touchAction = "none", this._renderingCanvas.style.msTouchAction = "none");
+ }, h.prototype.displayLoadingUI = function() {
+ if (P.a.IsWindowObjectExist()) {
+ var d = this.loadingScreen;
+ d && d.displayLoadingUI();
+ }
+ }, h.prototype.hideLoadingUI = function() {
+ if (P.a.IsWindowObjectExist()) {
+ var d = this._loadingScreen;
+ d && d.hideLoadingUI();
+ }
+ }, Object.defineProperty(h.prototype, "loadingScreen", { get: function() {
+ return !this._loadingScreen && this._renderingCanvas && (this._loadingScreen = h.DefaultLoadingScreenFactory(this._renderingCanvas)), this._loadingScreen;
+ }, set: function(d) {
+ this._loadingScreen = d;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(h.prototype, "loadingUIText", { set: function(d) {
+ this.loadingScreen.loadingUIText = d;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(h.prototype, "loadingUIBackgroundColor", { set: function(d) {
+ this.loadingScreen.loadingUIBackgroundColor = d;
+ }, enumerable: !1, configurable: !0 }), h._RequestPointerlock = function(d) {
+ d.requestPointerLock = d.requestPointerLock || d.msRequestPointerLock || d.mozRequestPointerLock || d.webkitRequestPointerLock, d.requestPointerLock && d.requestPointerLock();
+ }, h._ExitPointerlock = function() {
+ var d = document;
+ document.exitPointerLock = document.exitPointerLock || d.msExitPointerLock || d.mozExitPointerLock || d.webkitExitPointerLock, document.exitPointerLock && document.exitPointerLock();
+ }, h._RequestFullscreen = function(d) {
+ var b = d.requestFullscreen || d.msRequestFullscreen || d.webkitRequestFullscreen || d.mozRequestFullScreen;
+ b && b.call(d);
+ }, h._ExitFullscreen = function() {
+ var d = document;
+ document.exitFullscreen ? document.exitFullscreen() : d.mozCancelFullScreen ? d.mozCancelFullScreen() : d.webkitCancelFullScreen ? d.webkitCancelFullScreen() : d.msCancelFullScreen && d.msCancelFullScreen();
+ }, h.ALPHA_DISABLE = R.a.ALPHA_DISABLE, h.ALPHA_ADD = R.a.ALPHA_ADD, h.ALPHA_COMBINE = R.a.ALPHA_COMBINE, h.ALPHA_SUBTRACT = R.a.ALPHA_SUBTRACT, h.ALPHA_MULTIPLY = R.a.ALPHA_MULTIPLY, h.ALPHA_MAXIMIZED = R.a.ALPHA_MAXIMIZED, h.ALPHA_ONEONE = R.a.ALPHA_ONEONE, h.ALPHA_PREMULTIPLIED = R.a.ALPHA_PREMULTIPLIED, h.ALPHA_PREMULTIPLIED_PORTERDUFF = R.a.ALPHA_PREMULTIPLIED_PORTERDUFF, h.ALPHA_INTERPOLATE = R.a.ALPHA_INTERPOLATE, h.ALPHA_SCREENMODE = R.a.ALPHA_SCREENMODE, h.DELAYLOADSTATE_NONE = R.a.DELAYLOADSTATE_NONE, h.DELAYLOADSTATE_LOADED = R.a.DELAYLOADSTATE_LOADED, h.DELAYLOADSTATE_LOADING = R.a.DELAYLOADSTATE_LOADING, h.DELAYLOADSTATE_NOTLOADED = R.a.DELAYLOADSTATE_NOTLOADED, h.NEVER = R.a.NEVER, h.ALWAYS = R.a.ALWAYS, h.LESS = R.a.LESS, h.EQUAL = R.a.EQUAL, h.LEQUAL = R.a.LEQUAL, h.GREATER = R.a.GREATER, h.GEQUAL = R.a.GEQUAL, h.NOTEQUAL = R.a.NOTEQUAL, h.KEEP = R.a.KEEP, h.REPLACE = R.a.REPLACE, h.INCR = R.a.INCR, h.DECR = R.a.DECR, h.INVERT = R.a.INVERT, h.INCR_WRAP = R.a.INCR_WRAP, h.DECR_WRAP = R.a.DECR_WRAP, h.TEXTURE_CLAMP_ADDRESSMODE = R.a.TEXTURE_CLAMP_ADDRESSMODE, h.TEXTURE_WRAP_ADDRESSMODE = R.a.TEXTURE_WRAP_ADDRESSMODE, h.TEXTURE_MIRROR_ADDRESSMODE = R.a.TEXTURE_MIRROR_ADDRESSMODE, h.TEXTUREFORMAT_ALPHA = R.a.TEXTUREFORMAT_ALPHA, h.TEXTUREFORMAT_LUMINANCE = R.a.TEXTUREFORMAT_LUMINANCE, h.TEXTUREFORMAT_LUMINANCE_ALPHA = R.a.TEXTUREFORMAT_LUMINANCE_ALPHA, h.TEXTUREFORMAT_RGB = R.a.TEXTUREFORMAT_RGB, h.TEXTUREFORMAT_RGBA = R.a.TEXTUREFORMAT_RGBA, h.TEXTUREFORMAT_RED = R.a.TEXTUREFORMAT_RED, h.TEXTUREFORMAT_R = R.a.TEXTUREFORMAT_R, h.TEXTUREFORMAT_RG = R.a.TEXTUREFORMAT_RG, h.TEXTUREFORMAT_RED_INTEGER = R.a.TEXTUREFORMAT_RED_INTEGER, h.TEXTUREFORMAT_R_INTEGER = R.a.TEXTUREFORMAT_R_INTEGER, h.TEXTUREFORMAT_RG_INTEGER = R.a.TEXTUREFORMAT_RG_INTEGER, h.TEXTUREFORMAT_RGB_INTEGER = R.a.TEXTUREFORMAT_RGB_INTEGER, h.TEXTUREFORMAT_RGBA_INTEGER = R.a.TEXTUREFORMAT_RGBA_INTEGER, h.TEXTURETYPE_UNSIGNED_BYTE = R.a.TEXTURETYPE_UNSIGNED_BYTE, h.TEXTURETYPE_UNSIGNED_INT = R.a.TEXTURETYPE_UNSIGNED_INT, h.TEXTURETYPE_FLOAT = R.a.TEXTURETYPE_FLOAT, h.TEXTURETYPE_HALF_FLOAT = R.a.TEXTURETYPE_HALF_FLOAT, h.TEXTURETYPE_BYTE = R.a.TEXTURETYPE_BYTE, h.TEXTURETYPE_SHORT = R.a.TEXTURETYPE_SHORT, h.TEXTURETYPE_UNSIGNED_SHORT = R.a.TEXTURETYPE_UNSIGNED_SHORT, h.TEXTURETYPE_INT = R.a.TEXTURETYPE_INT, h.TEXTURETYPE_UNSIGNED_INTEGER = R.a.TEXTURETYPE_UNSIGNED_INTEGER, h.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 = R.a.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4, h.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 = R.a.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1, h.TEXTURETYPE_UNSIGNED_SHORT_5_6_5 = R.a.TEXTURETYPE_UNSIGNED_SHORT_5_6_5, h.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV = R.a.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV, h.TEXTURETYPE_UNSIGNED_INT_24_8 = R.a.TEXTURETYPE_UNSIGNED_INT_24_8, h.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV = R.a.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV, h.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV = R.a.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV, h.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV = R.a.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV, h.TEXTURE_NEAREST_SAMPLINGMODE = R.a.TEXTURE_NEAREST_SAMPLINGMODE, h.TEXTURE_BILINEAR_SAMPLINGMODE = R.a.TEXTURE_BILINEAR_SAMPLINGMODE, h.TEXTURE_TRILINEAR_SAMPLINGMODE = R.a.TEXTURE_TRILINEAR_SAMPLINGMODE, h.TEXTURE_NEAREST_NEAREST_MIPLINEAR = R.a.TEXTURE_NEAREST_NEAREST_MIPLINEAR, h.TEXTURE_LINEAR_LINEAR_MIPNEAREST = R.a.TEXTURE_LINEAR_LINEAR_MIPNEAREST, h.TEXTURE_LINEAR_LINEAR_MIPLINEAR = R.a.TEXTURE_LINEAR_LINEAR_MIPLINEAR, h.TEXTURE_NEAREST_NEAREST_MIPNEAREST = R.a.TEXTURE_NEAREST_NEAREST_MIPNEAREST, h.TEXTURE_NEAREST_LINEAR_MIPNEAREST = R.a.TEXTURE_NEAREST_LINEAR_MIPNEAREST, h.TEXTURE_NEAREST_LINEAR_MIPLINEAR = R.a.TEXTURE_NEAREST_LINEAR_MIPLINEAR, h.TEXTURE_NEAREST_LINEAR = R.a.TEXTURE_NEAREST_LINEAR, h.TEXTURE_NEAREST_NEAREST = R.a.TEXTURE_NEAREST_NEAREST, h.TEXTURE_LINEAR_NEAREST_MIPNEAREST = R.a.TEXTURE_LINEAR_NEAREST_MIPNEAREST, h.TEXTURE_LINEAR_NEAREST_MIPLINEAR = R.a.TEXTURE_LINEAR_NEAREST_MIPLINEAR, h.TEXTURE_LINEAR_LINEAR = R.a.TEXTURE_LINEAR_LINEAR, h.TEXTURE_LINEAR_NEAREST = R.a.TEXTURE_LINEAR_NEAREST, h.TEXTURE_EXPLICIT_MODE = R.a.TEXTURE_EXPLICIT_MODE, h.TEXTURE_SPHERICAL_MODE = R.a.TEXTURE_SPHERICAL_MODE, h.TEXTURE_PLANAR_MODE = R.a.TEXTURE_PLANAR_MODE, h.TEXTURE_CUBIC_MODE = R.a.TEXTURE_CUBIC_MODE, h.TEXTURE_PROJECTION_MODE = R.a.TEXTURE_PROJECTION_MODE, h.TEXTURE_SKYBOX_MODE = R.a.TEXTURE_SKYBOX_MODE, h.TEXTURE_INVCUBIC_MODE = R.a.TEXTURE_INVCUBIC_MODE, h.TEXTURE_EQUIRECTANGULAR_MODE = R.a.TEXTURE_EQUIRECTANGULAR_MODE, h.TEXTURE_FIXED_EQUIRECTANGULAR_MODE = R.a.TEXTURE_FIXED_EQUIRECTANGULAR_MODE, h.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE = R.a.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE, h.SCALEMODE_FLOOR = R.a.SCALEMODE_FLOOR, h.SCALEMODE_NEAREST = R.a.SCALEMODE_NEAREST, h.SCALEMODE_CEILING = R.a.SCALEMODE_CEILING, h._RescalePostProcessFactory = null, h;
+ }(x.a));
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ function f() {
+ }
+ return f.WithinEpsilon = function(P, c, C) {
+ C === void 0 && (C = 1401298e-51);
+ var x = P - c;
+ return -C <= x && x <= C;
+ }, f.ToHex = function(P) {
+ var c = P.toString(16);
+ return P <= 15 ? ("0" + c).toUpperCase() : c.toUpperCase();
+ }, f.Sign = function(P) {
+ return (P = +P) == 0 || isNaN(P) ? P : P > 0 ? 1 : -1;
+ }, f.Clamp = function(P, c, C) {
+ return c === void 0 && (c = 0), C === void 0 && (C = 1), Math.min(C, Math.max(c, P));
+ }, f.Log2 = function(P) {
+ return Math.log(P) * Math.LOG2E;
+ }, f.Repeat = function(P, c) {
+ return P - Math.floor(P / c) * c;
+ }, f.Normalize = function(P, c, C) {
+ return (P - c) / (C - c);
+ }, f.Denormalize = function(P, c, C) {
+ return P * (C - c) + c;
+ }, f.DeltaAngle = function(P, c) {
+ var C = f.Repeat(c - P, 360);
+ return C > 180 && (C -= 360), C;
+ }, f.PingPong = function(P, c) {
+ var C = f.Repeat(P, 2 * c);
+ return c - Math.abs(C - c);
+ }, f.SmoothStep = function(P, c, C) {
+ var x = f.Clamp(C);
+ return c * (x = -2 * x * x * x + 3 * x * x) + P * (1 - x);
+ }, f.MoveTowards = function(P, c, C) {
+ return Math.abs(c - P) <= C ? c : P + f.Sign(c - P) * C;
+ }, f.MoveTowardsAngle = function(P, c, C) {
+ var x = f.DeltaAngle(P, c), R = 0;
+ return -C < x && x < C ? R = c : (c = P + x, R = f.MoveTowards(P, c, C)), R;
+ }, f.Lerp = function(P, c, C) {
+ return P + (c - P) * C;
+ }, f.LerpAngle = function(P, c, C) {
+ var x = f.Repeat(c - P, 360);
+ return x > 180 && (x -= 360), P + x * f.Clamp(C);
+ }, f.InverseLerp = function(P, c, C) {
+ return P != c ? f.Clamp((C - P) / (c - P)) : 0;
+ }, f.Hermite = function(P, c, C, x, R) {
+ var g = R * R, u = R * g;
+ return P * (2 * u - 3 * g + 1) + C * (-2 * u + 3 * g) + c * (u - 2 * g + R) + x * (u - g);
+ }, f.RandomRange = function(P, c) {
+ return P === c ? P : Math.random() * (c - P) + P;
+ }, f.RangeToPercent = function(P, c, C) {
+ return (P - c) / (C - c);
+ }, f.PercentToRange = function(P, c, C) {
+ return (C - c) * P + c;
+ }, f.NormalizeRadians = function(P) {
+ return P -= f.TwoPi * Math.floor((P + Math.PI) / f.TwoPi);
+ }, f.TwoPi = 2 * Math.PI, f;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return u;
+ });
+ var D = l(8), f = l(20), P = l(22), c = l(4), C = l(48), x = l(2), R = l(9), g = l(119), u = function() {
+ function E() {
+ }
+ return E.BindEyePosition = function(A, y, v) {
+ if (v === void 0 && (v = "vEyePosition"), y._forcedViewPosition)
+ A.setVector3(v, y._forcedViewPosition);
+ else {
+ var h = y.activeCamera.globalPosition;
+ h || (h = y.activeCamera.devicePosition), A.setVector3(v, y._mirroredCameraPosition ? y._mirroredCameraPosition : h);
+ }
+ }, E.PrepareDefinesForMergedUV = function(A, y, v) {
+ y._needUVs = !0, y[v] = !0, A.getTextureMatrix().isIdentityAs3x2() ? (y[v + "DIRECTUV"] = A.coordinatesIndex + 1, A.coordinatesIndex === 0 ? y.MAINUV1 = !0 : y.MAINUV2 = !0) : y[v + "DIRECTUV"] = 0;
+ }, E.BindTextureMatrix = function(A, y, v) {
+ var h = A.getTextureMatrix();
+ y.updateMatrix(v + "Matrix", h);
+ }, E.GetFogState = function(A, y) {
+ return y.fogEnabled && A.applyFog && y.fogMode !== f.a.FOGMODE_NONE;
+ }, E.PrepareDefinesForMisc = function(A, y, v, h, d, b, T) {
+ T._areMiscDirty && (T.LOGARITHMICDEPTH = v, T.POINTSIZE = h, T.FOG = d && this.GetFogState(A, y), T.NONUNIFORMSCALING = A.nonUniformScaling, T.ALPHATEST = b);
+ }, E.PrepareDefinesForFrameBoundValues = function(A, y, v, h, d, b) {
+ d === void 0 && (d = null), b === void 0 && (b = !1);
+ var T, N, U, B, L, j, W = !1;
+ T = d ?? (A.clipPlane !== void 0 && A.clipPlane !== null), N = d ?? (A.clipPlane2 !== void 0 && A.clipPlane2 !== null), U = d ?? (A.clipPlane3 !== void 0 && A.clipPlane3 !== null), B = d ?? (A.clipPlane4 !== void 0 && A.clipPlane4 !== null), L = d ?? (A.clipPlane5 !== void 0 && A.clipPlane5 !== null), j = d ?? (A.clipPlane6 !== void 0 && A.clipPlane6 !== null), v.CLIPPLANE !== T && (v.CLIPPLANE = T, W = !0), v.CLIPPLANE2 !== N && (v.CLIPPLANE2 = N, W = !0), v.CLIPPLANE3 !== U && (v.CLIPPLANE3 = U, W = !0), v.CLIPPLANE4 !== B && (v.CLIPPLANE4 = B, W = !0), v.CLIPPLANE5 !== L && (v.CLIPPLANE5 = L, W = !0), v.CLIPPLANE6 !== j && (v.CLIPPLANE6 = j, W = !0), v.DEPTHPREPASS !== !y.getColorWrite() && (v.DEPTHPREPASS = !v.DEPTHPREPASS, W = !0), v.INSTANCES !== h && (v.INSTANCES = h, W = !0), v.THIN_INSTANCES !== b && (v.THIN_INSTANCES = b, W = !0), W && v.markAsUnprocessed();
+ }, E.PrepareDefinesForBones = function(A, y) {
+ if (A.useBones && A.computeBonesUsingShaders && A.skeleton) {
+ y.NUM_BONE_INFLUENCERS = A.numBoneInfluencers;
+ var v = y.BONETEXTURE !== void 0;
+ if (A.skeleton.isUsingTextureForMatrices && v)
+ y.BONETEXTURE = !0;
+ else {
+ y.BonesPerMesh = A.skeleton.bones.length + 1, y.BONETEXTURE = !v && void 0;
+ var h = A.getScene().prePassRenderer;
+ if (h && h.enabled) {
+ var d = h.excludedSkinnedMesh.indexOf(A) === -1;
+ y.BONES_VELOCITY_ENABLED = d;
+ }
+ }
+ } else
+ y.NUM_BONE_INFLUENCERS = 0, y.BonesPerMesh = 0;
+ }, E.PrepareDefinesForMorphTargets = function(A, y) {
+ var v = A.morphTargetManager;
+ v ? (y.MORPHTARGETS_UV = v.supportsUVs && y.UV1, y.MORPHTARGETS_TANGENT = v.supportsTangents && y.TANGENT, y.MORPHTARGETS_NORMAL = v.supportsNormals && y.NORMAL, y.MORPHTARGETS = v.numInfluencers > 0, y.NUM_MORPH_INFLUENCERS = v.numInfluencers) : (y.MORPHTARGETS_UV = !1, y.MORPHTARGETS_TANGENT = !1, y.MORPHTARGETS_NORMAL = !1, y.MORPHTARGETS = !1, y.NUM_MORPH_INFLUENCERS = 0);
+ }, E.PrepareDefinesForAttributes = function(A, y, v, h, d, b) {
+ if (d === void 0 && (d = !1), b === void 0 && (b = !0), !y._areAttributesDirty && y._needNormals === y._normals && y._needUVs === y._uvs)
+ return !1;
+ if (y._normals = y._needNormals, y._uvs = y._needUVs, y.NORMAL = y._needNormals && A.isVerticesDataPresent(c.b.NormalKind), y._needNormals && A.isVerticesDataPresent(c.b.TangentKind) && (y.TANGENT = !0), y._needUVs ? (y.UV1 = A.isVerticesDataPresent(c.b.UVKind), y.UV2 = A.isVerticesDataPresent(c.b.UV2Kind)) : (y.UV1 = !1, y.UV2 = !1), v) {
+ var T = A.useVertexColors && A.isVerticesDataPresent(c.b.ColorKind);
+ y.VERTEXCOLOR = T, y.VERTEXALPHA = A.hasVertexAlpha && T && b;
+ }
+ return h && this.PrepareDefinesForBones(A, y), d && this.PrepareDefinesForMorphTargets(A, y), !0;
+ }, E.PrepareDefinesForMultiview = function(A, y) {
+ if (A.activeCamera) {
+ var v = y.MULTIVIEW;
+ y.MULTIVIEW = A.activeCamera.outputRenderTarget !== null && A.activeCamera.outputRenderTarget.getViewCount() > 1, y.MULTIVIEW != v && y.markAsUnprocessed();
+ }
+ }, E.PrepareDefinesForPrePass = function(A, y, v) {
+ var h = y.PREPASS;
+ if (y._arePrePassDirty) {
+ var d = [{ type: x.a.PREPASS_POSITION_TEXTURE_TYPE, define: "PREPASS_POSITION", index: "PREPASS_POSITION_INDEX" }, { type: x.a.PREPASS_VELOCITY_TEXTURE_TYPE, define: "PREPASS_VELOCITY", index: "PREPASS_VELOCITY_INDEX" }, { type: x.a.PREPASS_REFLECTIVITY_TEXTURE_TYPE, define: "PREPASS_REFLECTIVITY", index: "PREPASS_REFLECTIVITY_INDEX" }, { type: x.a.PREPASS_IRRADIANCE_TEXTURE_TYPE, define: "PREPASS_IRRADIANCE", index: "PREPASS_IRRADIANCE_INDEX" }, { type: x.a.PREPASS_ALBEDO_TEXTURE_TYPE, define: "PREPASS_ALBEDO", index: "PREPASS_ALBEDO_INDEX" }, { type: x.a.PREPASS_DEPTHNORMAL_TEXTURE_TYPE, define: "PREPASS_DEPTHNORMAL", index: "PREPASS_DEPTHNORMAL_INDEX" }];
+ if (A.prePassRenderer && A.prePassRenderer.enabled && v) {
+ y.PREPASS = !0, y.SCENE_MRT_COUNT = A.prePassRenderer.mrtCount;
+ for (var b = 0; b < d.length; b++) {
+ var T = A.prePassRenderer.getIndex(d[b].type);
+ T !== -1 ? (y[d[b].define] = !0, y[d[b].index] = T) : y[d[b].define] = !1;
+ }
+ } else
+ for (y.PREPASS = !1, b = 0; b < d.length; b++)
+ y[d[b].define] = !1;
+ y.PREPASS != h && (y.markAsUnprocessed(), y.markAsImageProcessingDirty());
+ }
+ }, E.PrepareDefinesForLight = function(A, y, v, h, d, b, T) {
+ switch (T.needNormals = !0, d["LIGHT" + h] === void 0 && (T.needRebuild = !0), d["LIGHT" + h] = !0, d["SPOTLIGHT" + h] = !1, d["HEMILIGHT" + h] = !1, d["POINTLIGHT" + h] = !1, d["DIRLIGHT" + h] = !1, v.prepareLightSpecificDefines(d, h), d["LIGHT_FALLOFF_PHYSICAL" + h] = !1, d["LIGHT_FALLOFF_GLTF" + h] = !1, d["LIGHT_FALLOFF_STANDARD" + h] = !1, v.falloffType) {
+ case C.a.FALLOFF_GLTF:
+ d["LIGHT_FALLOFF_GLTF" + h] = !0;
+ break;
+ case C.a.FALLOFF_PHYSICAL:
+ d["LIGHT_FALLOFF_PHYSICAL" + h] = !0;
+ break;
+ case C.a.FALLOFF_STANDARD:
+ d["LIGHT_FALLOFF_STANDARD" + h] = !0;
+ }
+ if (b && !v.specular.equalsFloats(0, 0, 0) && (T.specularEnabled = !0), d["SHADOW" + h] = !1, d["SHADOWCSM" + h] = !1, d["SHADOWCSMDEBUG" + h] = !1, d["SHADOWCSMNUM_CASCADES" + h] = !1, d["SHADOWCSMUSESHADOWMAXZ" + h] = !1, d["SHADOWCSMNOBLEND" + h] = !1, d["SHADOWCSM_RIGHTHANDED" + h] = !1, d["SHADOWPCF" + h] = !1, d["SHADOWPCSS" + h] = !1, d["SHADOWPOISSON" + h] = !1, d["SHADOWESM" + h] = !1, d["SHADOWCLOSEESM" + h] = !1, d["SHADOWCUBE" + h] = !1, d["SHADOWLOWQUALITY" + h] = !1, d["SHADOWMEDIUMQUALITY" + h] = !1, y && y.receiveShadows && A.shadowsEnabled && v.shadowEnabled) {
+ var N = v.getShadowGenerator();
+ if (N) {
+ var U = N.getShadowMap();
+ U && U.renderList && U.renderList.length > 0 && (T.shadowEnabled = !0, N.prepareDefines(d, h));
+ }
+ }
+ v.lightmapMode != C.a.LIGHTMAP_DEFAULT ? (T.lightmapMode = !0, d["LIGHTMAPEXCLUDED" + h] = !0, d["LIGHTMAPNOSPECULAR" + h] = v.lightmapMode == C.a.LIGHTMAP_SHADOWSONLY) : (d["LIGHTMAPEXCLUDED" + h] = !1, d["LIGHTMAPNOSPECULAR" + h] = !1);
+ }, E.PrepareDefinesForLights = function(A, y, v, h, d, b) {
+ if (d === void 0 && (d = 4), b === void 0 && (b = !1), !v._areLightsDirty)
+ return v._needNormals;
+ var T = 0, N = { needNormals: !1, needRebuild: !1, lightmapMode: !1, shadowEnabled: !1, specularEnabled: !1 };
+ if (A.lightsEnabled && !b)
+ for (var U = 0, B = y.lightSources; U < B.length; U++) {
+ var L = B[U];
+ if (this.PrepareDefinesForLight(A, y, L, T, v, h, N), ++T === d)
+ break;
+ }
+ v.SPECULARTERM = N.specularEnabled, v.SHADOWS = N.shadowEnabled;
+ for (var j = T; j < d; j++)
+ v["LIGHT" + j] !== void 0 && (v["LIGHT" + j] = !1, v["HEMILIGHT" + j] = !1, v["POINTLIGHT" + j] = !1, v["DIRLIGHT" + j] = !1, v["SPOTLIGHT" + j] = !1, v["SHADOW" + j] = !1, v["SHADOWCSM" + j] = !1, v["SHADOWCSMDEBUG" + j] = !1, v["SHADOWCSMNUM_CASCADES" + j] = !1, v["SHADOWCSMUSESHADOWMAXZ" + j] = !1, v["SHADOWCSMNOBLEND" + j] = !1, v["SHADOWCSM_RIGHTHANDED" + j] = !1, v["SHADOWPCF" + j] = !1, v["SHADOWPCSS" + j] = !1, v["SHADOWPOISSON" + j] = !1, v["SHADOWESM" + j] = !1, v["SHADOWCLOSEESM" + j] = !1, v["SHADOWCUBE" + j] = !1, v["SHADOWLOWQUALITY" + j] = !1, v["SHADOWMEDIUMQUALITY" + j] = !1);
+ var W = A.getEngine().getCaps();
+ return v.SHADOWFLOAT === void 0 && (N.needRebuild = !0), v.SHADOWFLOAT = N.shadowEnabled && (W.textureFloatRender && W.textureFloatLinearFiltering || W.textureHalfFloatRender && W.textureHalfFloatLinearFiltering), v.LIGHTMAPEXCLUDED = N.lightmapMode, N.needRebuild && v.rebuild(), N.needNormals;
+ }, E.PrepareUniformsAndSamplersForLight = function(A, y, v, h, d, b) {
+ d === void 0 && (d = null), b === void 0 && (b = !1), d && d.push("Light" + A), b || (y.push("vLightData" + A, "vLightDiffuse" + A, "vLightSpecular" + A, "vLightDirection" + A, "vLightFalloff" + A, "vLightGround" + A, "lightMatrix" + A, "shadowsInfo" + A, "depthValues" + A), v.push("shadowSampler" + A), v.push("depthSampler" + A), y.push("viewFrustumZ" + A, "cascadeBlendFactor" + A, "lightSizeUVCorrection" + A, "depthCorrection" + A, "penumbraDarkness" + A, "frustumLengths" + A), h && (v.push("projectionLightSampler" + A), y.push("textureProjectionMatrix" + A)));
+ }, E.PrepareUniformsAndSamplersList = function(A, y, v, h) {
+ var d;
+ h === void 0 && (h = 4);
+ var b = null;
+ if (A.uniformsNames) {
+ var T = A;
+ d = T.uniformsNames, b = T.uniformBuffersNames, y = T.samplers, v = T.defines, h = T.maxSimultaneousLights || 0;
+ } else
+ d = A, y || (y = []);
+ for (var N = 0; N < h && v["LIGHT" + N]; N++)
+ this.PrepareUniformsAndSamplersForLight(N, d, y, v["PROJECTEDLIGHTTEXTURE" + N], b);
+ v.NUM_MORPH_INFLUENCERS && d.push("morphTargetInfluences");
+ }, E.HandleFallbacksForShadows = function(A, y, v, h) {
+ v === void 0 && (v = 4), h === void 0 && (h = 0);
+ for (var d = 0, b = 0; b < v && A["LIGHT" + b]; b++)
+ b > 0 && (d = h + b, y.addFallback(d, "LIGHT" + b)), A.SHADOWS || (A["SHADOW" + b] && y.addFallback(h, "SHADOW" + b), A["SHADOWPCF" + b] && y.addFallback(h, "SHADOWPCF" + b), A["SHADOWPCSS" + b] && y.addFallback(h, "SHADOWPCSS" + b), A["SHADOWPOISSON" + b] && y.addFallback(h, "SHADOWPOISSON" + b), A["SHADOWESM" + b] && y.addFallback(h, "SHADOWESM" + b), A["SHADOWCLOSEESM" + b] && y.addFallback(h, "SHADOWCLOSEESM" + b));
+ return d++;
+ }, E.PrepareAttributesForMorphTargetsInfluencers = function(A, y, v) {
+ this._TmpMorphInfluencers.NUM_MORPH_INFLUENCERS = v, this.PrepareAttributesForMorphTargets(A, y, this._TmpMorphInfluencers);
+ }, E.PrepareAttributesForMorphTargets = function(A, y, v) {
+ var h = v.NUM_MORPH_INFLUENCERS;
+ if (h > 0 && P.a.LastCreatedEngine)
+ for (var d = P.a.LastCreatedEngine.getCaps().maxVertexAttribs, b = y.morphTargetManager, T = b && b.supportsNormals && v.NORMAL, N = b && b.supportsTangents && v.TANGENT, U = b && b.supportsUVs && v.UV1, B = 0; B < h; B++)
+ A.push(c.b.PositionKind + B), T && A.push(c.b.NormalKind + B), N && A.push(c.b.TangentKind + B), U && A.push(c.b.UVKind + "_" + B), A.length > d && D.a.Error("Cannot add more vertex attributes for mesh " + y.name);
+ }, E.PrepareAttributesForBones = function(A, y, v, h) {
+ v.NUM_BONE_INFLUENCERS > 0 && (h.addCPUSkinningFallback(0, y), A.push(c.b.MatricesIndicesKind), A.push(c.b.MatricesWeightsKind), v.NUM_BONE_INFLUENCERS > 4 && (A.push(c.b.MatricesIndicesExtraKind), A.push(c.b.MatricesWeightsExtraKind)));
+ }, E.PrepareAttributesForInstances = function(A, y) {
+ (y.INSTANCES || y.THIN_INSTANCES) && this.PushAttributesForInstances(A);
+ }, E.PushAttributesForInstances = function(A) {
+ A.push("world0"), A.push("world1"), A.push("world2"), A.push("world3");
+ }, E.BindLightProperties = function(A, y, v) {
+ A.transferToEffect(y, v + "");
+ }, E.BindLight = function(A, y, v, h, d, b) {
+ b === void 0 && (b = !1), A._bindLight(y, v, h, d, b);
+ }, E.BindLights = function(A, y, v, h, d, b) {
+ d === void 0 && (d = 4), b === void 0 && (b = !1);
+ for (var T = Math.min(y.lightSources.length, d), N = 0; N < T; N++) {
+ var U = y.lightSources[N];
+ this.BindLight(U, N, A, v, typeof h == "boolean" ? h : h.SPECULARTERM, b);
+ }
+ }, E.BindFogParameters = function(A, y, v, h) {
+ h === void 0 && (h = !1), A.fogEnabled && y.applyFog && A.fogMode !== f.a.FOGMODE_NONE && (v.setFloat4("vFogInfos", A.fogMode, A.fogStart, A.fogEnd, A.fogDensity), h ? (A.fogColor.toLinearSpaceToRef(this._tempFogColor), v.setColor3("vFogColor", this._tempFogColor)) : v.setColor3("vFogColor", A.fogColor));
+ }, E.BindBonesParameters = function(A, y, v) {
+ if (y && A && (A.computeBonesUsingShaders && y._bonesComputationForcedToCPU && (A.computeBonesUsingShaders = !1), A.useBones && A.computeBonesUsingShaders && A.skeleton)) {
+ var h = A.skeleton;
+ if (h.isUsingTextureForMatrices && y.getUniformIndex("boneTextureWidth") > -1) {
+ var d = h.getTransformMatrixTexture(A);
+ y.setTexture("boneSampler", d), y.setFloat("boneTextureWidth", 4 * (h.bones.length + 1));
+ } else {
+ var b = h.getTransformMatrices(A);
+ b && (y.setMatrices("mBones", b), v && A.getScene().prePassRenderer && A.getScene().prePassRenderer.getIndex(x.a.PREPASS_VELOCITY_TEXTURE_TYPE) && (v.previousBones[A.uniqueId] && y.setMatrices("mPreviousBones", v.previousBones[A.uniqueId]), E._CopyBonesTransformationMatrices(b, v.previousBones[A.uniqueId])));
+ }
+ }
+ }, E._CopyBonesTransformationMatrices = function(A, y) {
+ return y.set(A), y;
+ }, E.BindMorphTargetParameters = function(A, y) {
+ var v = A.morphTargetManager;
+ A && v && y.setFloatArray("morphTargetInfluences", v.influences);
+ }, E.BindLogDepth = function(A, y, v) {
+ A.LOGARITHMICDEPTH && y.setFloat("logarithmicDepthConstant", 2 / (Math.log(v.activeCamera.maxZ + 1) / Math.LN2));
+ }, E.BindClipPlane = function(A, y) {
+ g.a.BindClipPlane(A, y);
+ }, E._TmpMorphInfluencers = { NUM_MORPH_INFLUENCERS: 0 }, E._tempFogColor = R.a.Black(), E;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return x;
+ });
+ var D = l(0), f = l(4), P = l(21), c = l(9), C = l(8), x = function() {
+ function R() {
+ }
+ return R.prototype.set = function(g, u) {
+ switch (g.length || C.a.Warn("Setting vertex data kind '" + u + "' with an empty array"), u) {
+ case f.b.PositionKind:
+ this.positions = g;
+ break;
+ case f.b.NormalKind:
+ this.normals = g;
+ break;
+ case f.b.TangentKind:
+ this.tangents = g;
+ break;
+ case f.b.UVKind:
+ this.uvs = g;
+ break;
+ case f.b.UV2Kind:
+ this.uvs2 = g;
+ break;
+ case f.b.UV3Kind:
+ this.uvs3 = g;
+ break;
+ case f.b.UV4Kind:
+ this.uvs4 = g;
+ break;
+ case f.b.UV5Kind:
+ this.uvs5 = g;
+ break;
+ case f.b.UV6Kind:
+ this.uvs6 = g;
+ break;
+ case f.b.ColorKind:
+ this.colors = g;
+ break;
+ case f.b.MatricesIndicesKind:
+ this.matricesIndices = g;
+ break;
+ case f.b.MatricesWeightsKind:
+ this.matricesWeights = g;
+ break;
+ case f.b.MatricesIndicesExtraKind:
+ this.matricesIndicesExtra = g;
+ break;
+ case f.b.MatricesWeightsExtraKind:
+ this.matricesWeightsExtra = g;
+ }
+ }, R.prototype.applyToMesh = function(g, u) {
+ return this._applyTo(g, u), this;
+ }, R.prototype.applyToGeometry = function(g, u) {
+ return this._applyTo(g, u), this;
+ }, R.prototype.updateMesh = function(g) {
+ return this._update(g), this;
+ }, R.prototype.updateGeometry = function(g) {
+ return this._update(g), this;
+ }, R.prototype._applyTo = function(g, u) {
+ return u === void 0 && (u = !1), this.positions && g.setVerticesData(f.b.PositionKind, this.positions, u), this.normals && g.setVerticesData(f.b.NormalKind, this.normals, u), this.tangents && g.setVerticesData(f.b.TangentKind, this.tangents, u), this.uvs && g.setVerticesData(f.b.UVKind, this.uvs, u), this.uvs2 && g.setVerticesData(f.b.UV2Kind, this.uvs2, u), this.uvs3 && g.setVerticesData(f.b.UV3Kind, this.uvs3, u), this.uvs4 && g.setVerticesData(f.b.UV4Kind, this.uvs4, u), this.uvs5 && g.setVerticesData(f.b.UV5Kind, this.uvs5, u), this.uvs6 && g.setVerticesData(f.b.UV6Kind, this.uvs6, u), this.colors && g.setVerticesData(f.b.ColorKind, this.colors, u), this.matricesIndices && g.setVerticesData(f.b.MatricesIndicesKind, this.matricesIndices, u), this.matricesWeights && g.setVerticesData(f.b.MatricesWeightsKind, this.matricesWeights, u), this.matricesIndicesExtra && g.setVerticesData(f.b.MatricesIndicesExtraKind, this.matricesIndicesExtra, u), this.matricesWeightsExtra && g.setVerticesData(f.b.MatricesWeightsExtraKind, this.matricesWeightsExtra, u), this.indices ? g.setIndices(this.indices, null, u) : g.setIndices([], null), this;
+ }, R.prototype._update = function(g, u, E) {
+ return this.positions && g.updateVerticesData(f.b.PositionKind, this.positions, u, E), this.normals && g.updateVerticesData(f.b.NormalKind, this.normals, u, E), this.tangents && g.updateVerticesData(f.b.TangentKind, this.tangents, u, E), this.uvs && g.updateVerticesData(f.b.UVKind, this.uvs, u, E), this.uvs2 && g.updateVerticesData(f.b.UV2Kind, this.uvs2, u, E), this.uvs3 && g.updateVerticesData(f.b.UV3Kind, this.uvs3, u, E), this.uvs4 && g.updateVerticesData(f.b.UV4Kind, this.uvs4, u, E), this.uvs5 && g.updateVerticesData(f.b.UV5Kind, this.uvs5, u, E), this.uvs6 && g.updateVerticesData(f.b.UV6Kind, this.uvs6, u, E), this.colors && g.updateVerticesData(f.b.ColorKind, this.colors, u, E), this.matricesIndices && g.updateVerticesData(f.b.MatricesIndicesKind, this.matricesIndices, u, E), this.matricesWeights && g.updateVerticesData(f.b.MatricesWeightsKind, this.matricesWeights, u, E), this.matricesIndicesExtra && g.updateVerticesData(f.b.MatricesIndicesExtraKind, this.matricesIndicesExtra, u, E), this.matricesWeightsExtra && g.updateVerticesData(f.b.MatricesWeightsExtraKind, this.matricesWeightsExtra, u, E), this.indices && g.setIndices(this.indices, null), this;
+ }, R.prototype.transform = function(g) {
+ var u, E = g.determinant() < 0, A = D.e.Zero();
+ if (this.positions) {
+ var y = D.e.Zero();
+ for (u = 0; u < this.positions.length; u += 3)
+ D.e.FromArrayToRef(this.positions, u, y), D.e.TransformCoordinatesToRef(y, g, A), this.positions[u] = A.x, this.positions[u + 1] = A.y, this.positions[u + 2] = A.z;
+ }
+ if (this.normals) {
+ var v = D.e.Zero();
+ for (u = 0; u < this.normals.length; u += 3)
+ D.e.FromArrayToRef(this.normals, u, v), D.e.TransformNormalToRef(v, g, A), this.normals[u] = A.x, this.normals[u + 1] = A.y, this.normals[u + 2] = A.z;
+ }
+ if (this.tangents) {
+ var h = D.f.Zero(), d = D.f.Zero();
+ for (u = 0; u < this.tangents.length; u += 4)
+ D.f.FromArrayToRef(this.tangents, u, h), D.f.TransformNormalToRef(h, g, d), this.tangents[u] = d.x, this.tangents[u + 1] = d.y, this.tangents[u + 2] = d.z, this.tangents[u + 3] = d.w;
+ }
+ if (E && this.indices)
+ for (u = 0; u < this.indices.length; u += 3) {
+ var b = this.indices[u + 1];
+ this.indices[u + 1] = this.indices[u + 2], this.indices[u + 2] = b;
+ }
+ return this;
+ }, R.prototype.merge = function(g, u) {
+ if (u === void 0 && (u = !1), this._validate(), g._validate(), !this.normals != !g.normals || !this.tangents != !g.tangents || !this.uvs != !g.uvs || !this.uvs2 != !g.uvs2 || !this.uvs3 != !g.uvs3 || !this.uvs4 != !g.uvs4 || !this.uvs5 != !g.uvs5 || !this.uvs6 != !g.uvs6 || !this.colors != !g.colors || !this.matricesIndices != !g.matricesIndices || !this.matricesWeights != !g.matricesWeights || !this.matricesIndicesExtra != !g.matricesIndicesExtra || !this.matricesWeightsExtra != !g.matricesWeightsExtra)
+ throw new Error("Cannot merge vertex data that do not have the same set of attributes");
+ if (g.indices) {
+ this.indices || (this.indices = []);
+ var E = this.positions ? this.positions.length / 3 : 0;
+ if (this.indices.BYTES_PER_ELEMENT !== void 0) {
+ var A = this.indices.length + g.indices.length, y = u || this.indices instanceof Uint32Array ? new Uint32Array(A) : new Uint16Array(A);
+ y.set(this.indices);
+ for (var v = this.indices.length, h = 0; h < g.indices.length; h++)
+ y[v + h] = g.indices[h] + E;
+ this.indices = y;
+ } else
+ for (h = 0; h < g.indices.length; h++)
+ this.indices.push(g.indices[h] + E);
+ }
+ return this.positions = this._mergeElement(this.positions, g.positions), this.normals = this._mergeElement(this.normals, g.normals), this.tangents = this._mergeElement(this.tangents, g.tangents), this.uvs = this._mergeElement(this.uvs, g.uvs), this.uvs2 = this._mergeElement(this.uvs2, g.uvs2), this.uvs3 = this._mergeElement(this.uvs3, g.uvs3), this.uvs4 = this._mergeElement(this.uvs4, g.uvs4), this.uvs5 = this._mergeElement(this.uvs5, g.uvs5), this.uvs6 = this._mergeElement(this.uvs6, g.uvs6), this.colors = this._mergeElement(this.colors, g.colors), this.matricesIndices = this._mergeElement(this.matricesIndices, g.matricesIndices), this.matricesWeights = this._mergeElement(this.matricesWeights, g.matricesWeights), this.matricesIndicesExtra = this._mergeElement(this.matricesIndicesExtra, g.matricesIndicesExtra), this.matricesWeightsExtra = this._mergeElement(this.matricesWeightsExtra, g.matricesWeightsExtra), this;
+ }, R.prototype._mergeElement = function(g, u) {
+ if (!g)
+ return u;
+ if (!u)
+ return g;
+ var E = u.length + g.length, A = g instanceof Float32Array, y = u instanceof Float32Array;
+ if (A) {
+ var v = new Float32Array(E);
+ return v.set(g), v.set(u, g.length), v;
+ }
+ if (y) {
+ var h = g.slice(0), d = 0;
+ for (E = u.length; d < E; d++)
+ h.push(u[d]);
+ return h;
+ }
+ return g.concat(u);
+ }, R.prototype._validate = function() {
+ if (!this.positions)
+ throw new Error("Positions are required");
+ var g = function(A, y) {
+ var v = f.b.DeduceStride(A);
+ if (y.length % v != 0)
+ throw new Error("The " + A + "s array count must be a multiple of " + v);
+ return y.length / v;
+ }, u = g(f.b.PositionKind, this.positions), E = function(A, y) {
+ var v = g(A, y);
+ if (v !== u)
+ throw new Error("The " + A + "s element count (" + v + ") does not match the positions count (" + u + ")");
+ };
+ this.normals && E(f.b.NormalKind, this.normals), this.tangents && E(f.b.TangentKind, this.tangents), this.uvs && E(f.b.UVKind, this.uvs), this.uvs2 && E(f.b.UV2Kind, this.uvs2), this.uvs3 && E(f.b.UV3Kind, this.uvs3), this.uvs4 && E(f.b.UV4Kind, this.uvs4), this.uvs5 && E(f.b.UV5Kind, this.uvs5), this.uvs6 && E(f.b.UV6Kind, this.uvs6), this.colors && E(f.b.ColorKind, this.colors), this.matricesIndices && E(f.b.MatricesIndicesKind, this.matricesIndices), this.matricesWeights && E(f.b.MatricesWeightsKind, this.matricesWeights), this.matricesIndicesExtra && E(f.b.MatricesIndicesExtraKind, this.matricesIndicesExtra), this.matricesWeightsExtra && E(f.b.MatricesWeightsExtraKind, this.matricesWeightsExtra);
+ }, R.prototype.serialize = function() {
+ var g = this.serialize();
+ return this.positions && (g.positions = this.positions), this.normals && (g.normals = this.normals), this.tangents && (g.tangents = this.tangents), this.uvs && (g.uvs = this.uvs), this.uvs2 && (g.uvs2 = this.uvs2), this.uvs3 && (g.uvs3 = this.uvs3), this.uvs4 && (g.uvs4 = this.uvs4), this.uvs5 && (g.uvs5 = this.uvs5), this.uvs6 && (g.uvs6 = this.uvs6), this.colors && (g.colors = this.colors), this.matricesIndices && (g.matricesIndices = this.matricesIndices, g.matricesIndices._isExpanded = !0), this.matricesWeights && (g.matricesWeights = this.matricesWeights), this.matricesIndicesExtra && (g.matricesIndicesExtra = this.matricesIndicesExtra, g.matricesIndicesExtra._isExpanded = !0), this.matricesWeightsExtra && (g.matricesWeightsExtra = this.matricesWeightsExtra), g.indices = this.indices, g;
+ }, R.ExtractFromMesh = function(g, u, E) {
+ return R._ExtractFrom(g, u, E);
+ }, R.ExtractFromGeometry = function(g, u, E) {
+ return R._ExtractFrom(g, u, E);
+ }, R._ExtractFrom = function(g, u, E) {
+ var A = new R();
+ return g.isVerticesDataPresent(f.b.PositionKind) && (A.positions = g.getVerticesData(f.b.PositionKind, u, E)), g.isVerticesDataPresent(f.b.NormalKind) && (A.normals = g.getVerticesData(f.b.NormalKind, u, E)), g.isVerticesDataPresent(f.b.TangentKind) && (A.tangents = g.getVerticesData(f.b.TangentKind, u, E)), g.isVerticesDataPresent(f.b.UVKind) && (A.uvs = g.getVerticesData(f.b.UVKind, u, E)), g.isVerticesDataPresent(f.b.UV2Kind) && (A.uvs2 = g.getVerticesData(f.b.UV2Kind, u, E)), g.isVerticesDataPresent(f.b.UV3Kind) && (A.uvs3 = g.getVerticesData(f.b.UV3Kind, u, E)), g.isVerticesDataPresent(f.b.UV4Kind) && (A.uvs4 = g.getVerticesData(f.b.UV4Kind, u, E)), g.isVerticesDataPresent(f.b.UV5Kind) && (A.uvs5 = g.getVerticesData(f.b.UV5Kind, u, E)), g.isVerticesDataPresent(f.b.UV6Kind) && (A.uvs6 = g.getVerticesData(f.b.UV6Kind, u, E)), g.isVerticesDataPresent(f.b.ColorKind) && (A.colors = g.getVerticesData(f.b.ColorKind, u, E)), g.isVerticesDataPresent(f.b.MatricesIndicesKind) && (A.matricesIndices = g.getVerticesData(f.b.MatricesIndicesKind, u, E)), g.isVerticesDataPresent(f.b.MatricesWeightsKind) && (A.matricesWeights = g.getVerticesData(f.b.MatricesWeightsKind, u, E)), g.isVerticesDataPresent(f.b.MatricesIndicesExtraKind) && (A.matricesIndicesExtra = g.getVerticesData(f.b.MatricesIndicesExtraKind, u, E)), g.isVerticesDataPresent(f.b.MatricesWeightsExtraKind) && (A.matricesWeightsExtra = g.getVerticesData(f.b.MatricesWeightsExtraKind, u, E)), A.indices = g.getIndices(u, E), A;
+ }, R.CreateRibbon = function(g) {
+ throw P.a.WarnImport("ribbonBuilder");
+ }, R.CreateBox = function(g) {
+ throw P.a.WarnImport("boxBuilder");
+ }, R.CreateTiledBox = function(g) {
+ throw P.a.WarnImport("tiledBoxBuilder");
+ }, R.CreateTiledPlane = function(g) {
+ throw P.a.WarnImport("tiledPlaneBuilder");
+ }, R.CreateSphere = function(g) {
+ throw P.a.WarnImport("sphereBuilder");
+ }, R.CreateCylinder = function(g) {
+ throw P.a.WarnImport("cylinderBuilder");
+ }, R.CreateTorus = function(g) {
+ throw P.a.WarnImport("torusBuilder");
+ }, R.CreateLineSystem = function(g) {
+ throw P.a.WarnImport("linesBuilder");
+ }, R.CreateDashedLines = function(g) {
+ throw P.a.WarnImport("linesBuilder");
+ }, R.CreateGround = function(g) {
+ throw P.a.WarnImport("groundBuilder");
+ }, R.CreateTiledGround = function(g) {
+ throw P.a.WarnImport("groundBuilder");
+ }, R.CreateGroundFromHeightMap = function(g) {
+ throw P.a.WarnImport("groundBuilder");
+ }, R.CreatePlane = function(g) {
+ throw P.a.WarnImport("planeBuilder");
+ }, R.CreateDisc = function(g) {
+ throw P.a.WarnImport("discBuilder");
+ }, R.CreatePolygon = function(g, u, E, A, y, v, h) {
+ throw P.a.WarnImport("polygonBuilder");
+ }, R.CreateIcoSphere = function(g) {
+ throw P.a.WarnImport("icoSphereBuilder");
+ }, R.CreatePolyhedron = function(g) {
+ throw P.a.WarnImport("polyhedronBuilder");
+ }, R.CreateCapsule = function(g) {
+ throw g === void 0 && (g = { orientation: D.e.Up(), subdivisions: 2, tessellation: 16, height: 1, radius: 0.25, capSubdivisions: 6 }), P.a.WarnImport("capsuleBuilder");
+ }, R.CreateTorusKnot = function(g) {
+ throw P.a.WarnImport("torusKnotBuilder");
+ }, R.ComputeNormals = function(g, u, E, A) {
+ var y = 0, v = 0, h = 0, d = 0, b = 0, T = 0, N = 0, U = 0, B = 0, L = 0, j = 0, W = 0, Y = 0, oe = 0, te = 0, _e = 0, de = 0, ae = 0, ie = 0, Z = 0, ee = !1, w = !1, z = !1, q = !1, le = 1, ce = 0, J = null;
+ if (A && (ee = !!A.facetNormals, w = !!A.facetPositions, z = !!A.facetPartitioning, le = A.useRightHandedSystem === !0 ? -1 : 1, ce = A.ratio || 0, q = !!A.depthSort, J = A.distanceTo, q)) {
+ J === void 0 && (J = D.e.Zero());
+ var H = A.depthSortedFacets;
+ }
+ var X = 0, ne = 0, Q = 0, $ = 0;
+ if (z && A && A.bbSize) {
+ var me = 0, ye = 0, be = 0, ge = 0, Te = 0, Re = 0, Se = 0, Ne = 0, ze = 0, Ye = 0, He = 0, Xe = 0, Ze = 0, je = 0, it = 0, et = 0, lt = A.bbSize.x > A.bbSize.y ? A.bbSize.x : A.bbSize.y;
+ lt = lt > A.bbSize.z ? lt : A.bbSize.z, X = A.subDiv.X * ce / A.bbSize.x, ne = A.subDiv.Y * ce / A.bbSize.y, Q = A.subDiv.Z * ce / A.bbSize.z, $ = A.subDiv.max * A.subDiv.max, A.facetPartitioning.length = 0;
+ }
+ for (y = 0; y < g.length; y++)
+ E[y] = 0;
+ var ct = u.length / 3 | 0;
+ for (y = 0; y < ct; y++) {
+ if (Y = (W = 3 * u[3 * y]) + 1, oe = W + 2, _e = (te = 3 * u[3 * y + 1]) + 1, de = te + 2, ie = (ae = 3 * u[3 * y + 2]) + 1, Z = ae + 2, v = g[W] - g[te], h = g[Y] - g[_e], d = g[oe] - g[de], b = g[ae] - g[te], T = g[ie] - g[_e], U = le * (h * (N = g[Z] - g[de]) - d * T), B = le * (d * b - v * N), L = le * (v * T - h * b), U /= j = (j = Math.sqrt(U * U + B * B + L * L)) === 0 ? 1 : j, B /= j, L /= j, ee && A && (A.facetNormals[y].x = U, A.facetNormals[y].y = B, A.facetNormals[y].z = L), w && A && (A.facetPositions[y].x = (g[W] + g[te] + g[ae]) / 3, A.facetPositions[y].y = (g[Y] + g[_e] + g[ie]) / 3, A.facetPositions[y].z = (g[oe] + g[de] + g[Z]) / 3), z && A && (me = Math.floor((A.facetPositions[y].x - A.bInfo.minimum.x * ce) * X), ye = Math.floor((A.facetPositions[y].y - A.bInfo.minimum.y * ce) * ne), be = Math.floor((A.facetPositions[y].z - A.bInfo.minimum.z * ce) * Q), ge = Math.floor((g[W] - A.bInfo.minimum.x * ce) * X), Te = Math.floor((g[Y] - A.bInfo.minimum.y * ce) * ne), Re = Math.floor((g[oe] - A.bInfo.minimum.z * ce) * Q), Se = Math.floor((g[te] - A.bInfo.minimum.x * ce) * X), Ne = Math.floor((g[_e] - A.bInfo.minimum.y * ce) * ne), ze = Math.floor((g[de] - A.bInfo.minimum.z * ce) * Q), Ye = Math.floor((g[ae] - A.bInfo.minimum.x * ce) * X), He = Math.floor((g[ie] - A.bInfo.minimum.y * ce) * ne), Xe = Math.floor((g[Z] - A.bInfo.minimum.z * ce) * Q), je = ge + A.subDiv.max * Te + $ * Re, it = Se + A.subDiv.max * Ne + $ * ze, et = Ye + A.subDiv.max * He + $ * Xe, Ze = me + A.subDiv.max * ye + $ * be, A.facetPartitioning[Ze] = A.facetPartitioning[Ze] ? A.facetPartitioning[Ze] : new Array(), A.facetPartitioning[je] = A.facetPartitioning[je] ? A.facetPartitioning[je] : new Array(), A.facetPartitioning[it] = A.facetPartitioning[it] ? A.facetPartitioning[it] : new Array(), A.facetPartitioning[et] = A.facetPartitioning[et] ? A.facetPartitioning[et] : new Array(), A.facetPartitioning[je].push(y), it != je && A.facetPartitioning[it].push(y), et != it && et != je && A.facetPartitioning[et].push(y), Ze != je && Ze != it && Ze != et && A.facetPartitioning[Ze].push(y)), q && A && A.facetPositions) {
+ var mt = H[y];
+ mt.ind = 3 * y, mt.sqDistance = D.e.DistanceSquared(A.facetPositions[y], J);
+ }
+ E[W] += U, E[Y] += B, E[oe] += L, E[te] += U, E[_e] += B, E[de] += L, E[ae] += U, E[ie] += B, E[Z] += L;
+ }
+ for (y = 0; y < E.length / 3; y++)
+ U = E[3 * y], B = E[3 * y + 1], L = E[3 * y + 2], U /= j = (j = Math.sqrt(U * U + B * B + L * L)) === 0 ? 1 : j, B /= j, L /= j, E[3 * y] = U, E[3 * y + 1] = B, E[3 * y + 2] = L;
+ }, R._ComputeSides = function(g, u, E, A, y, v, h) {
+ var d, b, T = E.length, N = A.length;
+ switch (g = g || R.DEFAULTSIDE) {
+ case R.FRONTSIDE:
+ break;
+ case R.BACKSIDE:
+ var U;
+ for (d = 0; d < T; d += 3)
+ U = E[d], E[d] = E[d + 2], E[d + 2] = U;
+ for (b = 0; b < N; b++)
+ A[b] = -A[b];
+ break;
+ case R.DOUBLESIDE:
+ for (var B = u.length, L = B / 3, j = 0; j < B; j++)
+ u[B + j] = u[j];
+ for (d = 0; d < T; d += 3)
+ E[d + T] = E[d + 2] + L, E[d + 1 + T] = E[d + 1] + L, E[d + 2 + T] = E[d] + L;
+ for (b = 0; b < N; b++)
+ A[N + b] = -A[b];
+ var W = y.length, Y = 0;
+ for (Y = 0; Y < W; Y++)
+ y[Y + W] = y[Y];
+ for (v = v || new D.f(0, 0, 1, 1), h = h || new D.f(0, 0, 1, 1), Y = 0, d = 0; d < W / 2; d++)
+ y[Y] = v.x + (v.z - v.x) * y[Y], y[Y + 1] = v.y + (v.w - v.y) * y[Y + 1], y[Y + W] = h.x + (h.z - h.x) * y[Y + W], y[Y + W + 1] = h.y + (h.w - h.y) * y[Y + W + 1], Y += 2;
+ }
+ }, R.ImportVertexData = function(g, u) {
+ var E = new R(), A = g.positions;
+ A && E.set(A, f.b.PositionKind);
+ var y = g.normals;
+ y && E.set(y, f.b.NormalKind);
+ var v = g.tangents;
+ v && E.set(v, f.b.TangentKind);
+ var h = g.uvs;
+ h && E.set(h, f.b.UVKind);
+ var d = g.uv2s;
+ d && E.set(d, f.b.UV2Kind);
+ var b = g.uv3s;
+ b && E.set(b, f.b.UV3Kind);
+ var T = g.uv4s;
+ T && E.set(T, f.b.UV4Kind);
+ var N = g.uv5s;
+ N && E.set(N, f.b.UV5Kind);
+ var U = g.uv6s;
+ U && E.set(U, f.b.UV6Kind);
+ var B = g.colors;
+ B && E.set(c.b.CheckColors4(B, A.length / 3), f.b.ColorKind);
+ var L = g.matricesIndices;
+ L && E.set(L, f.b.MatricesIndicesKind);
+ var j = g.matricesWeights;
+ j && E.set(j, f.b.MatricesWeightsKind);
+ var W = g.indices;
+ W && (E.indices = W), u.setAllVerticesData(E, g.updatable);
+ }, R.FRONTSIDE = 0, R.BACKSIDE = 1, R.DOUBLESIDE = 2, R.DEFAULTSIDE = 0, R;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return f;
+ }), l.d(_, "b", function() {
+ return P;
+ });
+ var D = l(1), f = function() {
+ function c() {
+ }
+ return c.NAME_EFFECTLAYER = "EffectLayer", c.NAME_LAYER = "Layer", c.NAME_LENSFLARESYSTEM = "LensFlareSystem", c.NAME_BOUNDINGBOXRENDERER = "BoundingBoxRenderer", c.NAME_PARTICLESYSTEM = "ParticleSystem", c.NAME_GAMEPAD = "Gamepad", c.NAME_SIMPLIFICATIONQUEUE = "SimplificationQueue", c.NAME_GEOMETRYBUFFERRENDERER = "GeometryBufferRenderer", c.NAME_PREPASSRENDERER = "PrePassRenderer", c.NAME_DEPTHRENDERER = "DepthRenderer", c.NAME_POSTPROCESSRENDERPIPELINEMANAGER = "PostProcessRenderPipelineManager", c.NAME_SPRITE = "Sprite", c.NAME_SUBSURFACE = "SubSurface", c.NAME_OUTLINERENDERER = "Outline", c.NAME_PROCEDURALTEXTURE = "ProceduralTexture", c.NAME_SHADOWGENERATOR = "ShadowGenerator", c.NAME_OCTREE = "Octree", c.NAME_PHYSICSENGINE = "PhysicsEngine", c.NAME_AUDIO = "Audio", c.STEP_ISREADYFORMESH_EFFECTLAYER = 0, c.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER = 0, c.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER = 0, c.STEP_PREACTIVEMESH_BOUNDINGBOXRENDERER = 0, c.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER = 1, c.STEP_BEFORECAMERADRAW_EFFECTLAYER = 0, c.STEP_BEFORECAMERADRAW_LAYER = 1, c.STEP_BEFORECAMERADRAW_PREPASS = 2, c.STEP_BEFORERENDERTARGETDRAW_LAYER = 0, c.STEP_BEFORERENDERINGMESH_PREPASS = 0, c.STEP_BEFORERENDERINGMESH_OUTLINE = 1, c.STEP_AFTERRENDERINGMESH_PREPASS = 0, c.STEP_AFTERRENDERINGMESH_OUTLINE = 1, c.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW = 0, c.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER = 1, c.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE = 0, c.STEP_BEFORECAMERAUPDATE_GAMEPAD = 1, c.STEP_BEFORECLEAR_PROCEDURALTEXTURE = 0, c.STEP_AFTERRENDERTARGETDRAW_LAYER = 0, c.STEP_AFTERCAMERADRAW_EFFECTLAYER = 0, c.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM = 1, c.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW = 2, c.STEP_AFTERCAMERADRAW_LAYER = 3, c.STEP_AFTERCAMERADRAW_PREPASS = 4, c.STEP_AFTERRENDER_AUDIO = 0, c.STEP_GATHERRENDERTARGETS_DEPTHRENDERER = 0, c.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER = 1, c.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR = 2, c.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER = 3, c.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER = 0, c.STEP_BEFORECLEARSTAGE_PREPASS = 0, c.STEP_POINTERMOVE_SPRITE = 0, c.STEP_POINTERDOWN_SPRITE = 0, c.STEP_POINTERUP_SPRITE = 0, c;
+ }(), P = function(c) {
+ function C(x) {
+ return c.apply(this, x) || this;
+ }
+ return Object(D.d)(C, c), C.Create = function() {
+ return Object.create(C.prototype);
+ }, C.prototype.registerStep = function(x, R, g) {
+ var u = 0;
+ for (Number.MAX_VALUE; u < this.length && !(x < this[u].index); u++)
+ ;
+ this.splice(u, 0, { index: x, component: R, action: g.bind(R) });
+ }, C.prototype.clear = function() {
+ this.length = 0;
+ }, C;
+ }(Array);
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return P;
+ }), l.d(_, "c", function() {
+ return c;
+ }), l.d(_, "d", function() {
+ return C;
+ }), l.d(_, "b", function() {
+ return x;
+ });
+ var D = l(1), f = l(0), P = function() {
+ function R() {
+ }
+ return R.POINTERDOWN = 1, R.POINTERUP = 2, R.POINTERMOVE = 4, R.POINTERWHEEL = 8, R.POINTERPICK = 16, R.POINTERTAP = 32, R.POINTERDOUBLETAP = 64, R;
+ }(), c = function(R, g) {
+ this.type = R, this.event = g;
+ }, C = function(R) {
+ function g(u, E, A, y) {
+ var v = R.call(this, u, E) || this;
+ return v.ray = null, v.skipOnPointerObservable = !1, v.localPosition = new f.d(A, y), v;
+ }
+ return Object(D.d)(g, R), g;
+ }(c), x = function(R) {
+ function g(u, E, A) {
+ var y = R.call(this, u, E) || this;
+ return y.pickInfo = A, y;
+ }
+ return Object(D.d)(g, R), g;
+ }(c);
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return P;
+ });
+ var D = l(13), f = l(2), P = function() {
+ function c() {
+ }
+ return Object.defineProperty(c, "DiffuseTextureEnabled", { get: function() {
+ return this._DiffuseTextureEnabled;
+ }, set: function(C) {
+ this._DiffuseTextureEnabled !== C && (this._DiffuseTextureEnabled = C, D.a.MarkAllMaterialsAsDirty(f.a.MATERIAL_TextureDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(c, "DetailTextureEnabled", { get: function() {
+ return this._DetailTextureEnabled;
+ }, set: function(C) {
+ this._DetailTextureEnabled !== C && (this._DetailTextureEnabled = C, D.a.MarkAllMaterialsAsDirty(f.a.MATERIAL_TextureDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(c, "AmbientTextureEnabled", { get: function() {
+ return this._AmbientTextureEnabled;
+ }, set: function(C) {
+ this._AmbientTextureEnabled !== C && (this._AmbientTextureEnabled = C, D.a.MarkAllMaterialsAsDirty(f.a.MATERIAL_TextureDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(c, "OpacityTextureEnabled", { get: function() {
+ return this._OpacityTextureEnabled;
+ }, set: function(C) {
+ this._OpacityTextureEnabled !== C && (this._OpacityTextureEnabled = C, D.a.MarkAllMaterialsAsDirty(f.a.MATERIAL_TextureDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(c, "ReflectionTextureEnabled", { get: function() {
+ return this._ReflectionTextureEnabled;
+ }, set: function(C) {
+ this._ReflectionTextureEnabled !== C && (this._ReflectionTextureEnabled = C, D.a.MarkAllMaterialsAsDirty(f.a.MATERIAL_TextureDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(c, "EmissiveTextureEnabled", { get: function() {
+ return this._EmissiveTextureEnabled;
+ }, set: function(C) {
+ this._EmissiveTextureEnabled !== C && (this._EmissiveTextureEnabled = C, D.a.MarkAllMaterialsAsDirty(f.a.MATERIAL_TextureDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(c, "SpecularTextureEnabled", { get: function() {
+ return this._SpecularTextureEnabled;
+ }, set: function(C) {
+ this._SpecularTextureEnabled !== C && (this._SpecularTextureEnabled = C, D.a.MarkAllMaterialsAsDirty(f.a.MATERIAL_TextureDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(c, "BumpTextureEnabled", { get: function() {
+ return this._BumpTextureEnabled;
+ }, set: function(C) {
+ this._BumpTextureEnabled !== C && (this._BumpTextureEnabled = C, D.a.MarkAllMaterialsAsDirty(f.a.MATERIAL_TextureDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(c, "LightmapTextureEnabled", { get: function() {
+ return this._LightmapTextureEnabled;
+ }, set: function(C) {
+ this._LightmapTextureEnabled !== C && (this._LightmapTextureEnabled = C, D.a.MarkAllMaterialsAsDirty(f.a.MATERIAL_TextureDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(c, "RefractionTextureEnabled", { get: function() {
+ return this._RefractionTextureEnabled;
+ }, set: function(C) {
+ this._RefractionTextureEnabled !== C && (this._RefractionTextureEnabled = C, D.a.MarkAllMaterialsAsDirty(f.a.MATERIAL_TextureDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(c, "ColorGradingTextureEnabled", { get: function() {
+ return this._ColorGradingTextureEnabled;
+ }, set: function(C) {
+ this._ColorGradingTextureEnabled !== C && (this._ColorGradingTextureEnabled = C, D.a.MarkAllMaterialsAsDirty(f.a.MATERIAL_TextureDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(c, "FresnelEnabled", { get: function() {
+ return this._FresnelEnabled;
+ }, set: function(C) {
+ this._FresnelEnabled !== C && (this._FresnelEnabled = C, D.a.MarkAllMaterialsAsDirty(f.a.MATERIAL_FresnelDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(c, "ClearCoatTextureEnabled", { get: function() {
+ return this._ClearCoatTextureEnabled;
+ }, set: function(C) {
+ this._ClearCoatTextureEnabled !== C && (this._ClearCoatTextureEnabled = C, D.a.MarkAllMaterialsAsDirty(f.a.MATERIAL_TextureDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(c, "ClearCoatBumpTextureEnabled", { get: function() {
+ return this._ClearCoatBumpTextureEnabled;
+ }, set: function(C) {
+ this._ClearCoatBumpTextureEnabled !== C && (this._ClearCoatBumpTextureEnabled = C, D.a.MarkAllMaterialsAsDirty(f.a.MATERIAL_TextureDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(c, "ClearCoatTintTextureEnabled", { get: function() {
+ return this._ClearCoatTintTextureEnabled;
+ }, set: function(C) {
+ this._ClearCoatTintTextureEnabled !== C && (this._ClearCoatTintTextureEnabled = C, D.a.MarkAllMaterialsAsDirty(f.a.MATERIAL_TextureDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(c, "SheenTextureEnabled", { get: function() {
+ return this._SheenTextureEnabled;
+ }, set: function(C) {
+ this._SheenTextureEnabled !== C && (this._SheenTextureEnabled = C, D.a.MarkAllMaterialsAsDirty(f.a.MATERIAL_TextureDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(c, "AnisotropicTextureEnabled", { get: function() {
+ return this._AnisotropicTextureEnabled;
+ }, set: function(C) {
+ this._AnisotropicTextureEnabled !== C && (this._AnisotropicTextureEnabled = C, D.a.MarkAllMaterialsAsDirty(f.a.MATERIAL_TextureDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(c, "ThicknessTextureEnabled", { get: function() {
+ return this._ThicknessTextureEnabled;
+ }, set: function(C) {
+ this._ThicknessTextureEnabled !== C && (this._ThicknessTextureEnabled = C, D.a.MarkAllMaterialsAsDirty(f.a.MATERIAL_TextureDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), c._DiffuseTextureEnabled = !0, c._DetailTextureEnabled = !0, c._AmbientTextureEnabled = !0, c._OpacityTextureEnabled = !0, c._ReflectionTextureEnabled = !0, c._EmissiveTextureEnabled = !0, c._SpecularTextureEnabled = !0, c._BumpTextureEnabled = !0, c._LightmapTextureEnabled = !0, c._RefractionTextureEnabled = !0, c._ColorGradingTextureEnabled = !0, c._FresnelEnabled = !0, c._ClearCoatTextureEnabled = !0, c._ClearCoatBumpTextureEnabled = !0, c._ClearCoatTintTextureEnabled = !0, c._SheenTextureEnabled = !0, c._AnisotropicTextureEnabled = !0, c._ThicknessTextureEnabled = !0, c;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return le;
+ });
+ var D = l(1), f = l(12), P = l(57), c = l(6), C = l(33), x = l(112), R = l(37), g = l(0), u = l(46), E = l(31), A = l(24), y = l(35), v = l(42), h = l(85), d = l(48), b = l(54), T = l(47), N = l(95), U = l(96), B = l(17), L = l(2), j = l(38), W = l(8), Y = l(22), oe = l(21), te = l(18), _e = l(91), de = l(66), ae = function() {
+ function ce() {
+ this._singleClick = !1, this._doubleClick = !1, this._hasSwiped = !1, this._ignore = !1;
+ }
+ return Object.defineProperty(ce.prototype, "singleClick", { get: function() {
+ return this._singleClick;
+ }, set: function(J) {
+ this._singleClick = J;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ce.prototype, "doubleClick", { get: function() {
+ return this._doubleClick;
+ }, set: function(J) {
+ this._doubleClick = J;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ce.prototype, "hasSwiped", { get: function() {
+ return this._hasSwiped;
+ }, set: function(J) {
+ this._hasSwiped = J;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ce.prototype, "ignore", { get: function() {
+ return this._ignore;
+ }, set: function(J) {
+ this._ignore = J;
+ }, enumerable: !1, configurable: !0 }), ce;
+ }(), ie = function() {
+ function ce(J) {
+ this._alreadyAttached = !1, this._wheelEventName = "", this._meshPickProceed = !1, this._currentPickResult = null, this._previousPickResult = null, this._totalPointersPressed = 0, this._doubleClickOccured = !1, this._pointerX = 0, this._pointerY = 0, this._startingPointerPosition = new g.d(0, 0), this._previousStartingPointerPosition = new g.d(0, 0), this._startingPointerTime = 0, this._previousStartingPointerTime = 0, this._pointerCaptures = {}, this._meshUnderPointerId = [], this._keyboardIsAttached = !1, this._scene = J;
+ }
+ return Object.defineProperty(ce.prototype, "meshUnderPointer", { get: function() {
+ return this._pointerOverMesh;
+ }, enumerable: !1, configurable: !0 }), ce.prototype.getMeshUnderPointerByPointerId = function(J) {
+ return this._meshUnderPointerId[J];
+ }, Object.defineProperty(ce.prototype, "unTranslatedPointer", { get: function() {
+ return new g.d(this._unTranslatedPointerX, this._unTranslatedPointerY);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ce.prototype, "pointerX", { get: function() {
+ return this._pointerX;
+ }, set: function(J) {
+ this._pointerX = J;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ce.prototype, "pointerY", { get: function() {
+ return this._pointerY;
+ }, set: function(J) {
+ this._pointerY = J;
+ }, enumerable: !1, configurable: !0 }), ce.prototype._updatePointerPosition = function(J) {
+ var H = this._scene.getEngine().getInputElementClientRect();
+ H && (this._pointerX = J.clientX - H.left, this._pointerY = J.clientY - H.top, this._unTranslatedPointerX = this._pointerX, this._unTranslatedPointerY = this._pointerY);
+ }, ce.prototype._processPointerMove = function(J, H) {
+ var X = this._scene, ne = X.getEngine(), Q = ne.getInputElement();
+ if (Q) {
+ Q.tabIndex = ne.canvasTabIndex, X.doNotHandleCursors || (Q.style.cursor = X.defaultCursor);
+ var $ = !!(J && J.hit && J.pickedMesh);
+ $ ? (X.setPointerOverMesh(J.pickedMesh, H.pointerId), this._pointerOverMesh && this._pointerOverMesh.actionManager && this._pointerOverMesh.actionManager.hasPointerTriggers && (X.doNotHandleCursors || (this._pointerOverMesh.actionManager.hoverCursor ? Q.style.cursor = this._pointerOverMesh.actionManager.hoverCursor : Q.style.cursor = X.hoverCursor))) : X.setPointerOverMesh(null, H.pointerId);
+ for (var me = 0, ye = X._pointerMoveStage; me < ye.length; me++)
+ J = ye[me].action(this._unTranslatedPointerX, this._unTranslatedPointerY, J, $, Q);
+ if (J) {
+ var be = H.type === this._wheelEventName ? te.a.POINTERWHEEL : te.a.POINTERMOVE;
+ if (X.onPointerMove && X.onPointerMove(H, J, be), X.onPointerObservable.hasObservers()) {
+ var ge = new te.b(be, H, J);
+ this._setRayOnPointerInfo(ge), X.onPointerObservable.notifyObservers(ge, be);
+ }
+ }
+ }
+ }, ce.prototype._setRayOnPointerInfo = function(J) {
+ var H = this._scene;
+ J.pickInfo && !J.pickInfo._pickingUnavailable && (J.pickInfo.ray || (J.pickInfo.ray = H.createPickingRay(J.event.offsetX, J.event.offsetY, g.a.Identity(), H.activeCamera)));
+ }, ce.prototype._checkPrePointerObservable = function(J, H, X) {
+ var ne = this._scene, Q = new te.d(X, H, this._unTranslatedPointerX, this._unTranslatedPointerY);
+ return J && (Q.ray = J.ray), ne.onPrePointerObservable.notifyObservers(Q, X), !!Q.skipOnPointerObservable;
+ }, ce.prototype.simulatePointerMove = function(J, H) {
+ var X = new PointerEvent("pointermove", H);
+ this._checkPrePointerObservable(J, X, te.a.POINTERMOVE) || this._processPointerMove(J, X);
+ }, ce.prototype.simulatePointerDown = function(J, H) {
+ var X = new PointerEvent("pointerdown", H);
+ this._checkPrePointerObservable(J, X, te.a.POINTERDOWN) || this._processPointerDown(J, X);
+ }, ce.prototype._processPointerDown = function(J, H) {
+ var X = this, ne = this._scene;
+ if (J && J.hit && J.pickedMesh) {
+ this._pickedDownMesh = J.pickedMesh;
+ var Q = J.pickedMesh._getActionManagerForTrigger();
+ if (Q) {
+ if (Q.hasPickTriggers)
+ switch (Q.processTrigger(L.a.ACTION_OnPickDownTrigger, T.a.CreateNew(J.pickedMesh, H)), H.button) {
+ case 0:
+ Q.processTrigger(L.a.ACTION_OnLeftPickTrigger, T.a.CreateNew(J.pickedMesh, H));
+ break;
+ case 1:
+ Q.processTrigger(L.a.ACTION_OnCenterPickTrigger, T.a.CreateNew(J.pickedMesh, H));
+ break;
+ case 2:
+ Q.processTrigger(L.a.ACTION_OnRightPickTrigger, T.a.CreateNew(J.pickedMesh, H));
+ }
+ Q.hasSpecificTrigger(L.a.ACTION_OnLongPressTrigger) && window.setTimeout(function() {
+ var ge = ne.pick(X._unTranslatedPointerX, X._unTranslatedPointerY, function(Te) {
+ return Te.isPickable && Te.isVisible && Te.isReady() && Te.actionManager && Te.actionManager.hasSpecificTrigger(L.a.ACTION_OnLongPressTrigger) && Te == X._pickedDownMesh;
+ }, !1, ne.cameraToUseForPointers);
+ ge && ge.hit && ge.pickedMesh && Q && X._totalPointersPressed !== 0 && Date.now() - X._startingPointerTime > ce.LongPressDelay && !X._isPointerSwiping() && (X._startingPointerTime = 0, Q.processTrigger(L.a.ACTION_OnLongPressTrigger, T.a.CreateNew(ge.pickedMesh, H)));
+ }, ce.LongPressDelay);
+ }
+ } else
+ for (var $ = 0, me = ne._pointerDownStage; $ < me.length; $++)
+ J = me[$].action(this._unTranslatedPointerX, this._unTranslatedPointerY, J, H);
+ if (J) {
+ var ye = te.a.POINTERDOWN;
+ if (ne.onPointerDown && ne.onPointerDown(H, J, ye), ne.onPointerObservable.hasObservers()) {
+ var be = new te.b(ye, H, J);
+ this._setRayOnPointerInfo(be), ne.onPointerObservable.notifyObservers(be, ye);
+ }
+ }
+ }, ce.prototype._isPointerSwiping = function() {
+ return Math.abs(this._startingPointerPosition.x - this._pointerX) > ce.DragMovementThreshold || Math.abs(this._startingPointerPosition.y - this._pointerY) > ce.DragMovementThreshold;
+ }, ce.prototype.simulatePointerUp = function(J, H, X) {
+ var ne = new PointerEvent("pointerup", H), Q = new ae();
+ X ? Q.doubleClick = !0 : Q.singleClick = !0, this._checkPrePointerObservable(J, ne, te.a.POINTERUP) || this._processPointerUp(J, ne, Q);
+ }, ce.prototype._processPointerUp = function(J, H, X) {
+ var ne = this._scene;
+ if (J && J && J.pickedMesh) {
+ if (this._pickedUpMesh = J.pickedMesh, this._pickedDownMesh === this._pickedUpMesh && (ne.onPointerPick && ne.onPointerPick(H, J), X.singleClick && !X.ignore && ne.onPointerObservable.hasObservers())) {
+ var Q = te.a.POINTERPICK, $ = new te.b(Q, H, J);
+ this._setRayOnPointerInfo($), ne.onPointerObservable.notifyObservers($, Q);
+ }
+ var me = J.pickedMesh._getActionManagerForTrigger();
+ if (me && !X.ignore) {
+ me.processTrigger(L.a.ACTION_OnPickUpTrigger, T.a.CreateNew(J.pickedMesh, H)), !X.hasSwiped && X.singleClick && me.processTrigger(L.a.ACTION_OnPickTrigger, T.a.CreateNew(J.pickedMesh, H));
+ var ye = J.pickedMesh._getActionManagerForTrigger(L.a.ACTION_OnDoublePickTrigger);
+ X.doubleClick && ye && ye.processTrigger(L.a.ACTION_OnDoublePickTrigger, T.a.CreateNew(J.pickedMesh, H));
+ }
+ } else if (!X.ignore)
+ for (var be = 0, ge = ne._pointerUpStage; be < ge.length; be++)
+ J = ge[be].action(this._unTranslatedPointerX, this._unTranslatedPointerY, J, H);
+ if (this._pickedDownMesh && this._pickedDownMesh !== this._pickedUpMesh) {
+ var Te = this._pickedDownMesh._getActionManagerForTrigger(L.a.ACTION_OnPickOutTrigger);
+ Te && Te.processTrigger(L.a.ACTION_OnPickOutTrigger, T.a.CreateNew(this._pickedDownMesh, H));
+ }
+ var Re = 0;
+ ne.onPointerObservable.hasObservers() && (!X.ignore && !X.hasSwiped && (X.singleClick && ne.onPointerObservable.hasSpecificMask(te.a.POINTERTAP) ? Re = te.a.POINTERTAP : X.doubleClick && ne.onPointerObservable.hasSpecificMask(te.a.POINTERDOUBLETAP) && (Re = te.a.POINTERDOUBLETAP), Re) && ($ = new te.b(Re, H, J), this._setRayOnPointerInfo($), ne.onPointerObservable.notifyObservers($, Re)), X.ignore || (Re = te.a.POINTERUP, $ = new te.b(Re, H, J), this._setRayOnPointerInfo($), ne.onPointerObservable.notifyObservers($, Re))), ne.onPointerUp && !X.ignore && ne.onPointerUp(H, J, Re);
+ }, ce.prototype.isPointerCaptured = function(J) {
+ return J === void 0 && (J = 0), this._pointerCaptures[J];
+ }, ce.prototype.attachControl = function(J, H, X, ne) {
+ var Q = this;
+ J === void 0 && (J = !0), H === void 0 && (H = !0), X === void 0 && (X = !0), ne === void 0 && (ne = null);
+ var $ = this._scene;
+ if (ne || (ne = $.getEngine().getInputElement()), ne) {
+ this._alreadyAttached && this.detachControl(), this._alreadyAttachedTo = ne;
+ var me = $.getEngine();
+ this._initActionManager = function(Te, Re) {
+ if (!Q._meshPickProceed) {
+ var Se = $.pick(Q._unTranslatedPointerX, Q._unTranslatedPointerY, $.pointerDownPredicate, !1, $.cameraToUseForPointers);
+ Q._currentPickResult = Se, Se && (Te = Se.hit && Se.pickedMesh ? Se.pickedMesh._getActionManagerForTrigger() : null), Q._meshPickProceed = !0;
+ }
+ return Te;
+ }, this._delayedSimpleClick = function(Te, Re, Se) {
+ (Date.now() - Q._previousStartingPointerTime > ce.DoubleClickDelay && !Q._doubleClickOccured || Te !== Q._previousButtonPressed) && (Q._doubleClickOccured = !1, Re.singleClick = !0, Re.ignore = !1, Se(Re, Q._currentPickResult));
+ }, this._initClickEvent = function(Te, Re, Se, Ne) {
+ var ze = new ae();
+ Q._currentPickResult = null;
+ var Ye = null, He = Te.hasSpecificMask(te.a.POINTERPICK) || Re.hasSpecificMask(te.a.POINTERPICK) || Te.hasSpecificMask(te.a.POINTERTAP) || Re.hasSpecificMask(te.a.POINTERTAP) || Te.hasSpecificMask(te.a.POINTERDOUBLETAP) || Re.hasSpecificMask(te.a.POINTERDOUBLETAP);
+ !He && _e.a && (Ye = Q._initActionManager(Ye, ze)) && (He = Ye.hasPickTriggers);
+ var Xe = !1;
+ if (He) {
+ var Ze = Se.button;
+ if (ze.hasSwiped = Q._isPointerSwiping(), !ze.hasSwiped) {
+ var je = !ce.ExclusiveDoubleClickMode;
+ je || (je = !Te.hasSpecificMask(te.a.POINTERDOUBLETAP) && !Re.hasSpecificMask(te.a.POINTERDOUBLETAP)) && !_e.a.HasSpecificTrigger(L.a.ACTION_OnDoublePickTrigger) && (Ye = Q._initActionManager(Ye, ze)) && (je = !Ye.hasSpecificTrigger(L.a.ACTION_OnDoublePickTrigger)), je ? (Date.now() - Q._previousStartingPointerTime > ce.DoubleClickDelay || Ze !== Q._previousButtonPressed) && (ze.singleClick = !0, Ne(ze, Q._currentPickResult), Xe = !0) : (Q._previousDelayedSimpleClickTimeout = Q._delayedSimpleClickTimeout, Q._delayedSimpleClickTimeout = window.setTimeout(Q._delayedSimpleClick.bind(Q, Ze, ze, Ne), ce.DoubleClickDelay));
+ var it = Te.hasSpecificMask(te.a.POINTERDOUBLETAP) || Re.hasSpecificMask(te.a.POINTERDOUBLETAP);
+ !it && _e.a.HasSpecificTrigger(L.a.ACTION_OnDoublePickTrigger) && (Ye = Q._initActionManager(Ye, ze)) && (it = Ye.hasSpecificTrigger(L.a.ACTION_OnDoublePickTrigger)), it && (Ze === Q._previousButtonPressed && Date.now() - Q._previousStartingPointerTime < ce.DoubleClickDelay && !Q._doubleClickOccured ? (ze.hasSwiped || Q._isPointerSwiping() ? (Q._doubleClickOccured = !1, Q._previousStartingPointerTime = Q._startingPointerTime, Q._previousStartingPointerPosition.x = Q._startingPointerPosition.x, Q._previousStartingPointerPosition.y = Q._startingPointerPosition.y, Q._previousButtonPressed = Ze, ce.ExclusiveDoubleClickMode ? (Q._previousDelayedSimpleClickTimeout && clearTimeout(Q._previousDelayedSimpleClickTimeout), Q._previousDelayedSimpleClickTimeout = Q._delayedSimpleClickTimeout, Ne(ze, Q._previousPickResult)) : Ne(ze, Q._currentPickResult)) : (Q._previousStartingPointerTime = 0, Q._doubleClickOccured = !0, ze.doubleClick = !0, ze.ignore = !1, ce.ExclusiveDoubleClickMode && Q._previousDelayedSimpleClickTimeout && clearTimeout(Q._previousDelayedSimpleClickTimeout), Q._previousDelayedSimpleClickTimeout = Q._delayedSimpleClickTimeout, Ne(ze, Q._currentPickResult)), Xe = !0) : (Q._doubleClickOccured = !1, Q._previousStartingPointerTime = Q._startingPointerTime, Q._previousStartingPointerPosition.x = Q._startingPointerPosition.x, Q._previousStartingPointerPosition.y = Q._startingPointerPosition.y, Q._previousButtonPressed = Ze));
+ }
+ }
+ Xe || Ne(ze, Q._currentPickResult);
+ }, this._onPointerMove = function(Te) {
+ if (Te.pointerId === void 0 && (Te.pointerId = 0), Q._updatePointerPosition(Te), !Q._checkPrePointerObservable(null, Te, Te.type === Q._wheelEventName ? te.a.POINTERWHEEL : te.a.POINTERMOVE) && ($.cameraToUseForPointers || $.activeCamera)) {
+ $.pointerMovePredicate || ($.pointerMovePredicate = function(Se) {
+ return Se.isPickable && Se.isVisible && Se.isReady() && Se.isEnabled() && (Se.enablePointerMoveEvents || $.constantlyUpdateMeshUnderPointer || Se._getActionManagerForTrigger() != null) && (!$.cameraToUseForPointers || ($.cameraToUseForPointers.layerMask & Se.layerMask) != 0);
+ });
+ var Re = $.pick(Q._unTranslatedPointerX, Q._unTranslatedPointerY, $.pointerMovePredicate, !1, $.cameraToUseForPointers);
+ Q._processPointerMove(Re, Te);
+ }
+ }, this._onPointerDown = function(Te) {
+ if (Q._totalPointersPressed++, Q._pickedDownMesh = null, Q._meshPickProceed = !1, Te.pointerId === void 0 && (Te.pointerId = 0), Q._updatePointerPosition(Te), $.preventDefaultOnPointerDown && ne && (Te.preventDefault(), ne.focus()), Q._startingPointerPosition.x = Q._pointerX, Q._startingPointerPosition.y = Q._pointerY, Q._startingPointerTime = Date.now(), !Q._checkPrePointerObservable(null, Te, te.a.POINTERDOWN) && ($.cameraToUseForPointers || $.activeCamera)) {
+ Q._pointerCaptures[Te.pointerId] = !0, $.pointerDownPredicate || ($.pointerDownPredicate = function(Se) {
+ return Se.isPickable && Se.isVisible && Se.isReady() && Se.isEnabled() && (!$.cameraToUseForPointers || ($.cameraToUseForPointers.layerMask & Se.layerMask) != 0);
+ }), Q._pickedDownMesh = null;
+ var Re = $.pick(Q._unTranslatedPointerX, Q._unTranslatedPointerY, $.pointerDownPredicate, !1, $.cameraToUseForPointers);
+ Q._processPointerDown(Re, Te);
+ }
+ }, this._onPointerUp = function(Te) {
+ Q._totalPointersPressed !== 0 && (Q._totalPointersPressed--, Q._pickedUpMesh = null, Q._meshPickProceed = !1, Te.pointerId === void 0 && (Te.pointerId = 0), Q._updatePointerPosition(Te), $.preventDefaultOnPointerUp && ne && (Te.preventDefault(), ne.focus()), Q._initClickEvent($.onPrePointerObservable, $.onPointerObservable, Te, function(Re, Se) {
+ $.onPrePointerObservable.hasObservers() && !Re.ignore && (!Re.hasSwiped && (Re.singleClick && $.onPrePointerObservable.hasSpecificMask(te.a.POINTERTAP) && Q._checkPrePointerObservable(null, Te, te.a.POINTERTAP) || Re.doubleClick && $.onPrePointerObservable.hasSpecificMask(te.a.POINTERDOUBLETAP) && Q._checkPrePointerObservable(null, Te, te.a.POINTERDOUBLETAP)) || Q._checkPrePointerObservable(null, Te, te.a.POINTERUP)) || Q._pointerCaptures[Te.pointerId] && (Q._pointerCaptures[Te.pointerId] = !1, ($.cameraToUseForPointers || $.activeCamera) && ($.pointerUpPredicate || ($.pointerUpPredicate = function(Ne) {
+ return Ne.isPickable && Ne.isVisible && Ne.isReady() && Ne.isEnabled() && (!$.cameraToUseForPointers || ($.cameraToUseForPointers.layerMask & Ne.layerMask) != 0);
+ }), !Q._meshPickProceed && (_e.a && _e.a.HasTriggers || $.onPointerObservable.hasObservers()) && Q._initActionManager(null, Re), Se || (Se = Q._currentPickResult), Q._processPointerUp(Se, Te, Re), Q._previousPickResult = Q._currentPickResult));
+ }));
+ }, this._onKeyDown = function(Te) {
+ var Re = de.a.KEYDOWN;
+ if ($.onPreKeyboardObservable.hasObservers()) {
+ var Se = new de.c(Re, Te);
+ if ($.onPreKeyboardObservable.notifyObservers(Se, Re), Se.skipOnPointerObservable)
+ return;
+ }
+ $.onKeyboardObservable.hasObservers() && (Se = new de.b(Re, Te), $.onKeyboardObservable.notifyObservers(Se, Re)), $.actionManager && $.actionManager.processTrigger(L.a.ACTION_OnKeyDownTrigger, T.a.CreateNewFromScene($, Te));
+ }, this._onKeyUp = function(Te) {
+ var Re = de.a.KEYUP;
+ if ($.onPreKeyboardObservable.hasObservers()) {
+ var Se = new de.c(Re, Te);
+ if ($.onPreKeyboardObservable.notifyObservers(Se, Re), Se.skipOnPointerObservable)
+ return;
+ }
+ $.onKeyboardObservable.hasObservers() && (Se = new de.b(Re, Te), $.onKeyboardObservable.notifyObservers(Se, Re)), $.actionManager && $.actionManager.processTrigger(L.a.ACTION_OnKeyUpTrigger, T.a.CreateNewFromScene($, Te));
+ };
+ var ye = function() {
+ ne && !Q._keyboardIsAttached && (ne.addEventListener("keydown", Q._onKeyDown, !1), ne.addEventListener("keyup", Q._onKeyUp, !1), Q._keyboardIsAttached = !0);
+ };
+ this._onCanvasFocusObserver = me.onCanvasFocusObservable.add((document.activeElement === ne && ye(), ye)), this._onCanvasBlurObserver = me.onCanvasBlurObservable.add(function() {
+ ne && (ne.removeEventListener("keydown", Q._onKeyDown), ne.removeEventListener("keyup", Q._onKeyUp), Q._keyboardIsAttached = !1);
+ }), ye();
+ var be = f.b.GetPointerPrefix(me);
+ if (X && (ne.addEventListener(be + "move", this._onPointerMove, !1), this._wheelEventName = "onwheel" in document.createElement("div") ? "wheel" : document.onmousewheel !== void 0 ? "mousewheel" : "DOMMouseScroll", ne.addEventListener(this._wheelEventName, this._onPointerMove, !1)), H && ne.addEventListener(be + "down", this._onPointerDown, !1), J) {
+ var ge = $.getEngine().getHostWindow();
+ ge && ge.addEventListener(be + "up", this._onPointerUp, !1);
+ }
+ this._alreadyAttached = !0;
+ }
+ }, ce.prototype.detachControl = function() {
+ var J = this._scene.getEngine(), H = f.b.GetPointerPrefix(J);
+ this._alreadyAttachedTo && this._alreadyAttached && (this._alreadyAttachedTo.removeEventListener(H + "move", this._onPointerMove), this._alreadyAttachedTo.removeEventListener(this._wheelEventName, this._onPointerMove), this._alreadyAttachedTo.removeEventListener(H + "down", this._onPointerDown), window.removeEventListener(H + "up", this._onPointerUp), this._onCanvasBlurObserver && J.onCanvasBlurObservable.remove(this._onCanvasBlurObserver), this._onCanvasFocusObserver && J.onCanvasFocusObservable.remove(this._onCanvasFocusObserver), this._alreadyAttachedTo.removeEventListener("keydown", this._onKeyDown), this._alreadyAttachedTo.removeEventListener("keyup", this._onKeyUp), this._scene.doNotHandleCursors || (this._alreadyAttachedTo.style.cursor = this._scene.defaultCursor), this._alreadyAttached = !1);
+ }, ce.prototype.setPointerOverMesh = function(J, H) {
+ if (H === void 0 && (H = 0), H < 0 && (H = 0), this._meshUnderPointerId[H] !== J) {
+ var X, ne = this._meshUnderPointerId[H];
+ ne && (X = ne._getActionManagerForTrigger(L.a.ACTION_OnPointerOutTrigger)) && X.processTrigger(L.a.ACTION_OnPointerOutTrigger, T.a.CreateNew(ne, void 0, { pointerId: H })), this._meshUnderPointerId[H] = J, this._pointerOverMesh = J, (ne = this._meshUnderPointerId[H]) && (X = ne._getActionManagerForTrigger(L.a.ACTION_OnPointerOverTrigger)) && X.processTrigger(L.a.ACTION_OnPointerOverTrigger, T.a.CreateNew(ne, void 0, { pointerId: H }));
+ }
+ }, ce.prototype.getPointerOverMesh = function() {
+ return this._pointerOverMesh;
+ }, ce.DragMovementThreshold = 10, ce.LongPressDelay = 500, ce.DoubleClickDelay = 300, ce.ExclusiveDoubleClickMode = !1, ce;
+ }(), Z = l(55), ee = l(9), w = l(90), z = l(152), q = l(56), le = function(ce) {
+ function J(H, X) {
+ var ne = ce.call(this) || this;
+ ne._inputManager = new ie(ne), ne.cameraToUseForPointers = null, ne._isScene = !0, ne._blockEntityCollection = !1, ne.autoClear = !0, ne.autoClearDepthAndStencil = !0, ne.clearColor = new ee.b(0.2, 0.2, 0.3, 1), ne.ambientColor = new ee.a(0, 0, 0), ne._environmentIntensity = 1, ne._forceWireframe = !1, ne._skipFrustumClipping = !1, ne._forcePointsCloud = !1, ne.animationsEnabled = !0, ne._animationPropertiesOverride = null, ne.useConstantAnimationDeltaTime = !1, ne.constantlyUpdateMeshUnderPointer = !1, ne.hoverCursor = "pointer", ne.defaultCursor = "", ne.doNotHandleCursors = !1, ne.preventDefaultOnPointerDown = !0, ne.preventDefaultOnPointerUp = !0, ne.metadata = null, ne.reservedDataStore = null, ne.disableOfflineSupportExceptionRules = new Array(), ne.onDisposeObservable = new c.c(), ne._onDisposeObserver = null, ne.onBeforeRenderObservable = new c.c(), ne._onBeforeRenderObserver = null, ne.onAfterRenderObservable = new c.c(), ne.onAfterRenderCameraObservable = new c.c(), ne._onAfterRenderObserver = null, ne.onBeforeAnimationsObservable = new c.c(), ne.onAfterAnimationsObservable = new c.c(), ne.onBeforeDrawPhaseObservable = new c.c(), ne.onAfterDrawPhaseObservable = new c.c(), ne.onReadyObservable = new c.c(), ne.onBeforeCameraRenderObservable = new c.c(), ne._onBeforeCameraRenderObserver = null, ne.onAfterCameraRenderObservable = new c.c(), ne._onAfterCameraRenderObserver = null, ne.onBeforeActiveMeshesEvaluationObservable = new c.c(), ne.onAfterActiveMeshesEvaluationObservable = new c.c(), ne.onBeforeParticlesRenderingObservable = new c.c(), ne.onAfterParticlesRenderingObservable = new c.c(), ne.onDataLoadedObservable = new c.c(), ne.onNewCameraAddedObservable = new c.c(), ne.onCameraRemovedObservable = new c.c(), ne.onNewLightAddedObservable = new c.c(), ne.onLightRemovedObservable = new c.c(), ne.onNewGeometryAddedObservable = new c.c(), ne.onGeometryRemovedObservable = new c.c(), ne.onNewTransformNodeAddedObservable = new c.c(), ne.onTransformNodeRemovedObservable = new c.c(), ne.onNewMeshAddedObservable = new c.c(), ne.onMeshRemovedObservable = new c.c(), ne.onNewSkeletonAddedObservable = new c.c(), ne.onSkeletonRemovedObservable = new c.c(), ne.onNewMaterialAddedObservable = new c.c(), ne.onNewMultiMaterialAddedObservable = new c.c(), ne.onMaterialRemovedObservable = new c.c(), ne.onMultiMaterialRemovedObservable = new c.c(), ne.onNewTextureAddedObservable = new c.c(), ne.onTextureRemovedObservable = new c.c(), ne.onBeforeRenderTargetsRenderObservable = new c.c(), ne.onAfterRenderTargetsRenderObservable = new c.c(), ne.onBeforeStepObservable = new c.c(), ne.onAfterStepObservable = new c.c(), ne.onActiveCameraChanged = new c.c(), ne.onBeforeRenderingGroupObservable = new c.c(), ne.onAfterRenderingGroupObservable = new c.c(), ne.onMeshImportedObservable = new c.c(), ne.onAnimationFileImportedObservable = new c.c(), ne._registeredForLateAnimationBindings = new C.b(256), ne.onPrePointerObservable = new c.c(), ne.onPointerObservable = new c.c(), ne.onPreKeyboardObservable = new c.c(), ne.onKeyboardObservable = new c.c(), ne._useRightHandedSystem = !1, ne._timeAccumulator = 0, ne._currentStepId = 0, ne._currentInternalStep = 0, ne._fogEnabled = !0, ne._fogMode = J.FOGMODE_NONE, ne.fogColor = new ee.a(0.2, 0.2, 0.3), ne.fogDensity = 0.1, ne.fogStart = 0, ne.fogEnd = 1e3, ne.prePass = !1, ne._shadowsEnabled = !0, ne._lightsEnabled = !0, ne.activeCameras = new Array(), ne._texturesEnabled = !0, ne.physicsEnabled = !0, ne.particlesEnabled = !0, ne.spritesEnabled = !0, ne._skeletonsEnabled = !0, ne.lensFlaresEnabled = !0, ne.collisionsEnabled = !0, ne.gravity = new g.e(0, -9.807, 0), ne.postProcessesEnabled = !0, ne.renderTargetsEnabled = !0, ne.dumpNextRenderTargets = !1, ne.customRenderTargets = new Array(), ne.importedMeshesFiles = new Array(), ne.probesEnabled = !0, ne._meshesForIntersections = new C.b(256), ne.proceduralTexturesEnabled = !0, ne._totalVertices = new Z.a(), ne._activeIndices = new Z.a(), ne._activeParticles = new Z.a(), ne._activeBones = new Z.a(), ne._animationTime = 0, ne.animationTimeScale = 1, ne._renderId = 0, ne._frameId = 0, ne._executeWhenReadyTimeoutId = -1, ne._intermediateRendering = !1, ne._viewUpdateFlag = -1, ne._projectionUpdateFlag = -1, ne._toBeDisposed = new Array(256), ne._activeRequests = new Array(), ne._pendingData = new Array(), ne._isDisposed = !1, ne.dispatchAllSubMeshesOfActiveMeshes = !1, ne._activeMeshes = new C.a(256), ne._processedMaterials = new C.a(256), ne._renderTargets = new C.b(256), ne._activeParticleSystems = new C.a(256), ne._activeSkeletons = new C.b(32), ne._softwareSkinnedMeshes = new C.b(32), ne._activeAnimatables = new Array(), ne._transformMatrix = g.a.Zero(), ne.requireLightSorting = !1, ne._components = [], ne._serializableComponents = [], ne._transientComponents = [], ne._beforeCameraUpdateStage = B.b.Create(), ne._beforeClearStage = B.b.Create(), ne._gatherRenderTargetsStage = B.b.Create(), ne._gatherActiveCameraRenderTargetsStage = B.b.Create(), ne._isReadyForMeshStage = B.b.Create(), ne._beforeEvaluateActiveMeshStage = B.b.Create(), ne._evaluateSubMeshStage = B.b.Create(), ne._preActiveMeshStage = B.b.Create(), ne._cameraDrawRenderTargetStage = B.b.Create(), ne._beforeCameraDrawStage = B.b.Create(), ne._beforeRenderTargetDrawStage = B.b.Create(), ne._beforeRenderingGroupDrawStage = B.b.Create(), ne._beforeRenderingMeshStage = B.b.Create(), ne._afterRenderingMeshStage = B.b.Create(), ne._afterRenderingGroupDrawStage = B.b.Create(), ne._afterCameraDrawStage = B.b.Create(), ne._afterRenderTargetDrawStage = B.b.Create(), ne._afterRenderStage = B.b.Create(), ne._pointerMoveStage = B.b.Create(), ne._pointerDownStage = B.b.Create(), ne._pointerUpStage = B.b.Create(), ne.geometriesByUniqueId = null, ne._defaultMeshCandidates = { data: [], length: 0 }, ne._defaultSubMeshCandidates = { data: [], length: 0 }, ne._preventFreeActiveMeshesAndRenderingGroups = !1, ne._activeMeshesFrozen = !1, ne._skipEvaluateActiveMeshesCompletely = !1, ne._allowPostProcessClearColor = !0, ne.getDeterministicFrameTime = function() {
+ return ne._engine.getTimeStep();
+ }, ne._blockMaterialDirtyMechanism = !1;
+ var Q = Object(D.a)({ useGeometryUniqueIdsMap: !0, useMaterialMeshMap: !0, useClonedMeshMap: !0, virtual: !1 }, X);
+ return ne._engine = H || Y.a.LastCreatedEngine, Q.virtual || (Y.a._LastCreatedScene = ne, ne._engine.scenes.push(ne)), ne._uid = null, ne._renderingManager = new U.b(ne), N.a && (ne.postProcessManager = new N.a(ne)), j.a.IsWindowObjectExist() && ne.attachControl(), ne._createUbo(), v.a && (ne._imageProcessingConfiguration = new v.a()), ne.setDefaultCandidateProviders(), Q.useGeometryUniqueIdsMap && (ne.geometriesByUniqueId = {}), ne.useMaterialMeshMap = Q.useMaterialMeshMap, ne.useClonedMeshMap = Q.useClonedMeshMap, X && X.virtual || ne._engine.onNewSceneAddedObservable.notifyObservers(ne), ne;
+ }
+ return Object(D.d)(J, ce), J.DefaultMaterialFactory = function(H) {
+ throw oe.a.WarnImport("StandardMaterial");
+ }, J.CollisionCoordinatorFactory = function() {
+ throw oe.a.WarnImport("DefaultCollisionCoordinator");
+ }, Object.defineProperty(J.prototype, "environmentTexture", { get: function() {
+ return this._environmentTexture;
+ }, set: function(H) {
+ this._environmentTexture !== H && (this._environmentTexture = H, this.markAllMaterialsAsDirty(L.a.MATERIAL_TextureDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J.prototype, "environmentIntensity", { get: function() {
+ return this._environmentIntensity;
+ }, set: function(H) {
+ this._environmentIntensity !== H && (this._environmentIntensity = H, this.markAllMaterialsAsDirty(L.a.MATERIAL_TextureDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J.prototype, "imageProcessingConfiguration", { get: function() {
+ return this._imageProcessingConfiguration;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J.prototype, "forceWireframe", { get: function() {
+ return this._forceWireframe;
+ }, set: function(H) {
+ this._forceWireframe !== H && (this._forceWireframe = H, this.markAllMaterialsAsDirty(L.a.MATERIAL_MiscDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J.prototype, "skipFrustumClipping", { get: function() {
+ return this._skipFrustumClipping;
+ }, set: function(H) {
+ this._skipFrustumClipping !== H && (this._skipFrustumClipping = H);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J.prototype, "forcePointsCloud", { get: function() {
+ return this._forcePointsCloud;
+ }, set: function(H) {
+ this._forcePointsCloud !== H && (this._forcePointsCloud = H, this.markAllMaterialsAsDirty(L.a.MATERIAL_MiscDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J.prototype, "animationPropertiesOverride", { get: function() {
+ return this._animationPropertiesOverride;
+ }, set: function(H) {
+ this._animationPropertiesOverride = H;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J.prototype, "onDispose", { set: function(H) {
+ this._onDisposeObserver && this.onDisposeObservable.remove(this._onDisposeObserver), this._onDisposeObserver = this.onDisposeObservable.add(H);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J.prototype, "beforeRender", { set: function(H) {
+ this._onBeforeRenderObserver && this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver), H && (this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(H));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J.prototype, "afterRender", { set: function(H) {
+ this._onAfterRenderObserver && this.onAfterRenderObservable.remove(this._onAfterRenderObserver), H && (this._onAfterRenderObserver = this.onAfterRenderObservable.add(H));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J.prototype, "beforeCameraRender", { set: function(H) {
+ this._onBeforeCameraRenderObserver && this.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver), this._onBeforeCameraRenderObserver = this.onBeforeCameraRenderObservable.add(H);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J.prototype, "afterCameraRender", { set: function(H) {
+ this._onAfterCameraRenderObserver && this.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver), this._onAfterCameraRenderObserver = this.onAfterCameraRenderObservable.add(H);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J.prototype, "unTranslatedPointer", { get: function() {
+ return this._inputManager.unTranslatedPointer;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J, "DragMovementThreshold", { get: function() {
+ return ie.DragMovementThreshold;
+ }, set: function(H) {
+ ie.DragMovementThreshold = H;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J, "LongPressDelay", { get: function() {
+ return ie.LongPressDelay;
+ }, set: function(H) {
+ ie.LongPressDelay = H;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J, "DoubleClickDelay", { get: function() {
+ return ie.DoubleClickDelay;
+ }, set: function(H) {
+ ie.DoubleClickDelay = H;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J, "ExclusiveDoubleClickMode", { get: function() {
+ return ie.ExclusiveDoubleClickMode;
+ }, set: function(H) {
+ ie.ExclusiveDoubleClickMode = H;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J.prototype, "useRightHandedSystem", { get: function() {
+ return this._useRightHandedSystem;
+ }, set: function(H) {
+ this._useRightHandedSystem !== H && (this._useRightHandedSystem = H, this.markAllMaterialsAsDirty(L.a.MATERIAL_MiscDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), J.prototype.setStepId = function(H) {
+ this._currentStepId = H;
+ }, J.prototype.getStepId = function() {
+ return this._currentStepId;
+ }, J.prototype.getInternalStep = function() {
+ return this._currentInternalStep;
+ }, Object.defineProperty(J.prototype, "fogEnabled", { get: function() {
+ return this._fogEnabled;
+ }, set: function(H) {
+ this._fogEnabled !== H && (this._fogEnabled = H, this.markAllMaterialsAsDirty(L.a.MATERIAL_MiscDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J.prototype, "fogMode", { get: function() {
+ return this._fogMode;
+ }, set: function(H) {
+ this._fogMode !== H && (this._fogMode = H, this.markAllMaterialsAsDirty(L.a.MATERIAL_MiscDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J.prototype, "shadowsEnabled", { get: function() {
+ return this._shadowsEnabled;
+ }, set: function(H) {
+ this._shadowsEnabled !== H && (this._shadowsEnabled = H, this.markAllMaterialsAsDirty(L.a.MATERIAL_LightDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J.prototype, "lightsEnabled", { get: function() {
+ return this._lightsEnabled;
+ }, set: function(H) {
+ this._lightsEnabled !== H && (this._lightsEnabled = H, this.markAllMaterialsAsDirty(L.a.MATERIAL_LightDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J.prototype, "activeCamera", { get: function() {
+ return this._activeCamera;
+ }, set: function(H) {
+ H !== this._activeCamera && (this._activeCamera = H, this.onActiveCameraChanged.notifyObservers(this));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J.prototype, "defaultMaterial", { get: function() {
+ return this._defaultMaterial || (this._defaultMaterial = J.DefaultMaterialFactory(this)), this._defaultMaterial;
+ }, set: function(H) {
+ this._defaultMaterial = H;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J.prototype, "texturesEnabled", { get: function() {
+ return this._texturesEnabled;
+ }, set: function(H) {
+ this._texturesEnabled !== H && (this._texturesEnabled = H, this.markAllMaterialsAsDirty(L.a.MATERIAL_TextureDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J.prototype, "skeletonsEnabled", { get: function() {
+ return this._skeletonsEnabled;
+ }, set: function(H) {
+ this._skeletonsEnabled !== H && (this._skeletonsEnabled = H, this.markAllMaterialsAsDirty(L.a.MATERIAL_AttributesDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J.prototype, "collisionCoordinator", { get: function() {
+ return this._collisionCoordinator || (this._collisionCoordinator = J.CollisionCoordinatorFactory(), this._collisionCoordinator.init(this)), this._collisionCoordinator;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J.prototype, "frustumPlanes", { get: function() {
+ return this._frustumPlanes;
+ }, enumerable: !1, configurable: !0 }), J.prototype._registerTransientComponents = function() {
+ if (this._transientComponents.length > 0) {
+ for (var H = 0, X = this._transientComponents; H < X.length; H++)
+ X[H].register();
+ this._transientComponents = [];
+ }
+ }, J.prototype._addComponent = function(H) {
+ this._components.push(H), this._transientComponents.push(H);
+ var X = H;
+ X.addFromContainer && X.serialize && this._serializableComponents.push(X);
+ }, J.prototype._getComponent = function(H) {
+ for (var X = 0, ne = this._components; X < ne.length; X++) {
+ var Q = ne[X];
+ if (Q.name === H)
+ return Q;
+ }
+ return null;
+ }, J.prototype.getClassName = function() {
+ return "Scene";
+ }, J.prototype._getDefaultMeshCandidates = function() {
+ return this._defaultMeshCandidates.data = this.meshes, this._defaultMeshCandidates.length = this.meshes.length, this._defaultMeshCandidates;
+ }, J.prototype._getDefaultSubMeshCandidates = function(H) {
+ return this._defaultSubMeshCandidates.data = H.subMeshes, this._defaultSubMeshCandidates.length = H.subMeshes.length, this._defaultSubMeshCandidates;
+ }, J.prototype.setDefaultCandidateProviders = function() {
+ this.getActiveMeshCandidates = this._getDefaultMeshCandidates.bind(this), this.getActiveSubMeshCandidates = this._getDefaultSubMeshCandidates.bind(this), this.getIntersectingSubMeshCandidates = this._getDefaultSubMeshCandidates.bind(this), this.getCollidingSubMeshCandidates = this._getDefaultSubMeshCandidates.bind(this);
+ }, Object.defineProperty(J.prototype, "meshUnderPointer", { get: function() {
+ return this._inputManager.meshUnderPointer;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J.prototype, "pointerX", { get: function() {
+ return this._inputManager.pointerX;
+ }, set: function(H) {
+ this._inputManager.pointerX = H;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(J.prototype, "pointerY", { get: function() {
+ return this._inputManager.pointerY;
+ }, set: function(H) {
+ this._inputManager.pointerY = H;
+ }, enumerable: !1, configurable: !0 }), J.prototype.getCachedMaterial = function() {
+ return this._cachedMaterial;
+ }, J.prototype.getCachedEffect = function() {
+ return this._cachedEffect;
+ }, J.prototype.getCachedVisibility = function() {
+ return this._cachedVisibility;
+ }, J.prototype.isCachedMaterialInvalid = function(H, X, ne) {
+ return ne === void 0 && (ne = 1), this._cachedEffect !== X || this._cachedMaterial !== H || this._cachedVisibility !== ne;
+ }, J.prototype.getEngine = function() {
+ return this._engine;
+ }, J.prototype.getTotalVertices = function() {
+ return this._totalVertices.current;
+ }, Object.defineProperty(J.prototype, "totalVerticesPerfCounter", { get: function() {
+ return this._totalVertices;
+ }, enumerable: !1, configurable: !0 }), J.prototype.getActiveIndices = function() {
+ return this._activeIndices.current;
+ }, Object.defineProperty(J.prototype, "totalActiveIndicesPerfCounter", { get: function() {
+ return this._activeIndices;
+ }, enumerable: !1, configurable: !0 }), J.prototype.getActiveParticles = function() {
+ return this._activeParticles.current;
+ }, Object.defineProperty(J.prototype, "activeParticlesPerfCounter", { get: function() {
+ return this._activeParticles;
+ }, enumerable: !1, configurable: !0 }), J.prototype.getActiveBones = function() {
+ return this._activeBones.current;
+ }, Object.defineProperty(J.prototype, "activeBonesPerfCounter", { get: function() {
+ return this._activeBones;
+ }, enumerable: !1, configurable: !0 }), J.prototype.getActiveMeshes = function() {
+ return this._activeMeshes;
+ }, J.prototype.getAnimationRatio = function() {
+ return this._animationRatio !== void 0 ? this._animationRatio : 1;
+ }, J.prototype.getRenderId = function() {
+ return this._renderId;
+ }, J.prototype.getFrameId = function() {
+ return this._frameId;
+ }, J.prototype.incrementRenderId = function() {
+ this._renderId++;
+ }, J.prototype._createUbo = function() {
+ this._sceneUbo = new h.a(this._engine, void 0, !0), this._sceneUbo.addUniform("viewProjection", 16), this._sceneUbo.addUniform("view", 16);
+ }, J.prototype.simulatePointerMove = function(H, X) {
+ return this._inputManager.simulatePointerMove(H, X), this;
+ }, J.prototype.simulatePointerDown = function(H, X) {
+ return this._inputManager.simulatePointerDown(H, X), this;
+ }, J.prototype.simulatePointerUp = function(H, X, ne) {
+ return this._inputManager.simulatePointerUp(H, X, ne), this;
+ }, J.prototype.isPointerCaptured = function(H) {
+ return H === void 0 && (H = 0), this._inputManager.isPointerCaptured(H);
+ }, J.prototype.attachControl = function(H, X, ne) {
+ H === void 0 && (H = !0), X === void 0 && (X = !0), ne === void 0 && (ne = !0), this._inputManager.attachControl(H, X, ne);
+ }, J.prototype.detachControl = function() {
+ this._inputManager.detachControl();
+ }, J.prototype.isReady = function() {
+ if (this._isDisposed)
+ return !1;
+ var H, X = this.getEngine();
+ if (!X.areAllEffectsReady() || this._pendingData.length > 0)
+ return !1;
+ for (H = 0; H < this.meshes.length; H++) {
+ var ne = this.meshes[H];
+ if (ne.isEnabled() && ne.subMeshes && ne.subMeshes.length !== 0) {
+ if (!ne.isReady(!0))
+ return !1;
+ for (var Q = ne.hasThinInstances || ne.getClassName() === "InstancedMesh" || ne.getClassName() === "InstancedLinesMesh" || X.getCaps().instancedArrays && ne.instances.length > 0, $ = 0, me = this._isReadyForMeshStage; $ < me.length; $++)
+ if (!me[$].action(ne, Q))
+ return !1;
+ }
+ }
+ for (H = 0; H < this.geometries.length; H++)
+ if (this.geometries[H].delayLoadState === L.a.DELAYLOADSTATE_LOADING)
+ return !1;
+ if (this.activeCameras && this.activeCameras.length > 0) {
+ for (var ye = 0, be = this.activeCameras; ye < be.length; ye++)
+ if (!be[ye].isReady(!0))
+ return !1;
+ } else if (this.activeCamera && !this.activeCamera.isReady(!0))
+ return !1;
+ for (var ge = 0, Te = this.particleSystems; ge < Te.length; ge++)
+ if (!Te[ge].isReady())
+ return !1;
+ return !0;
+ }, J.prototype.resetCachedMaterial = function() {
+ this._cachedMaterial = null, this._cachedEffect = null, this._cachedVisibility = null;
+ }, J.prototype.registerBeforeRender = function(H) {
+ this.onBeforeRenderObservable.add(H);
+ }, J.prototype.unregisterBeforeRender = function(H) {
+ this.onBeforeRenderObservable.removeCallback(H);
+ }, J.prototype.registerAfterRender = function(H) {
+ this.onAfterRenderObservable.add(H);
+ }, J.prototype.unregisterAfterRender = function(H) {
+ this.onAfterRenderObservable.removeCallback(H);
+ }, J.prototype._executeOnceBeforeRender = function(H) {
+ var X = this, ne = function() {
+ H(), setTimeout(function() {
+ X.unregisterBeforeRender(ne);
+ });
+ };
+ this.registerBeforeRender(ne);
+ }, J.prototype.executeOnceBeforeRender = function(H, X) {
+ var ne = this;
+ X !== void 0 ? setTimeout(function() {
+ ne._executeOnceBeforeRender(H);
+ }, X) : this._executeOnceBeforeRender(H);
+ }, J.prototype._addPendingData = function(H) {
+ this._pendingData.push(H);
+ }, J.prototype._removePendingData = function(H) {
+ var X = this.isLoading, ne = this._pendingData.indexOf(H);
+ ne !== -1 && this._pendingData.splice(ne, 1), X && !this.isLoading && this.onDataLoadedObservable.notifyObservers(this);
+ }, J.prototype.getWaitingItemsCount = function() {
+ return this._pendingData.length;
+ }, Object.defineProperty(J.prototype, "isLoading", { get: function() {
+ return this._pendingData.length > 0;
+ }, enumerable: !1, configurable: !0 }), J.prototype.executeWhenReady = function(H) {
+ var X = this;
+ this.onReadyObservable.add(H), this._executeWhenReadyTimeoutId === -1 && (this._executeWhenReadyTimeoutId = setTimeout(function() {
+ X._checkIsReady();
+ }, 150));
+ }, J.prototype.whenReadyAsync = function() {
+ var H = this;
+ return new Promise(function(X) {
+ H.executeWhenReady(function() {
+ X();
+ });
+ });
+ }, J.prototype._checkIsReady = function() {
+ var H = this;
+ return this._registerTransientComponents(), this.isReady() ? (this.onReadyObservable.notifyObservers(this), this.onReadyObservable.clear(), void (this._executeWhenReadyTimeoutId = -1)) : this._isDisposed ? (this.onReadyObservable.clear(), void (this._executeWhenReadyTimeoutId = -1)) : void (this._executeWhenReadyTimeoutId = setTimeout(function() {
+ H._checkIsReady();
+ }, 150));
+ }, Object.defineProperty(J.prototype, "animatables", { get: function() {
+ return this._activeAnimatables;
+ }, enumerable: !1, configurable: !0 }), J.prototype.resetLastAnimationTimeFrame = function() {
+ this._animationTimeLast = P.a.Now;
+ }, J.prototype.getViewMatrix = function() {
+ return this._viewMatrix;
+ }, J.prototype.getProjectionMatrix = function() {
+ return this._projectionMatrix;
+ }, J.prototype.getTransformMatrix = function() {
+ return this._transformMatrix;
+ }, J.prototype.setTransformMatrix = function(H, X, ne, Q) {
+ this._viewUpdateFlag === H.updateFlag && this._projectionUpdateFlag === X.updateFlag || (this._viewUpdateFlag = H.updateFlag, this._projectionUpdateFlag = X.updateFlag, this._viewMatrix = H, this._projectionMatrix = X, this._viewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix), this._frustumPlanes ? w.a.GetPlanesToRef(this._transformMatrix, this._frustumPlanes) : this._frustumPlanes = w.a.GetPlanes(this._transformMatrix), this._multiviewSceneUbo && this._multiviewSceneUbo.useUbo ? this._updateMultiviewUbo(ne, Q) : this._sceneUbo.useUbo && (this._sceneUbo.updateMatrix("viewProjection", this._transformMatrix), this._sceneUbo.updateMatrix("view", this._viewMatrix), this._sceneUbo.update()));
+ }, J.prototype.getSceneUniformBuffer = function() {
+ return this._multiviewSceneUbo ? this._multiviewSceneUbo : this._sceneUbo;
+ }, J.prototype.getUniqueId = function() {
+ return z.a.UniqueId;
+ }, J.prototype.addMesh = function(H, X) {
+ var ne = this;
+ X === void 0 && (X = !1), this._blockEntityCollection || (this.meshes.push(H), H._resyncLightSources(), H.parent || H._addToSceneRootNodes(), this.onNewMeshAddedObservable.notifyObservers(H), X && H.getChildMeshes().forEach(function(Q) {
+ ne.addMesh(Q);
+ }));
+ }, J.prototype.removeMesh = function(H, X) {
+ var ne = this;
+ X === void 0 && (X = !1);
+ var Q = this.meshes.indexOf(H);
+ return Q !== -1 && (this.meshes[Q] = this.meshes[this.meshes.length - 1], this.meshes.pop(), H.parent || H._removeFromSceneRootNodes()), this.onMeshRemovedObservable.notifyObservers(H), X && H.getChildMeshes().forEach(function($) {
+ ne.removeMesh($);
+ }), Q;
+ }, J.prototype.addTransformNode = function(H) {
+ this._blockEntityCollection || (H._indexInSceneTransformNodesArray = this.transformNodes.length, this.transformNodes.push(H), H.parent || H._addToSceneRootNodes(), this.onNewTransformNodeAddedObservable.notifyObservers(H));
+ }, J.prototype.removeTransformNode = function(H) {
+ var X = H._indexInSceneTransformNodesArray;
+ if (X !== -1) {
+ if (X !== this.transformNodes.length - 1) {
+ var ne = this.transformNodes[this.transformNodes.length - 1];
+ this.transformNodes[X] = ne, ne._indexInSceneTransformNodesArray = X;
+ }
+ H._indexInSceneTransformNodesArray = -1, this.transformNodes.pop(), H.parent || H._removeFromSceneRootNodes();
+ }
+ return this.onTransformNodeRemovedObservable.notifyObservers(H), X;
+ }, J.prototype.removeSkeleton = function(H) {
+ var X = this.skeletons.indexOf(H);
+ return X !== -1 && (this.skeletons.splice(X, 1), this.onSkeletonRemovedObservable.notifyObservers(H)), X;
+ }, J.prototype.removeMorphTargetManager = function(H) {
+ var X = this.morphTargetManagers.indexOf(H);
+ return X !== -1 && this.morphTargetManagers.splice(X, 1), X;
+ }, J.prototype.removeLight = function(H) {
+ var X = this.lights.indexOf(H);
+ if (X !== -1) {
+ for (var ne = 0, Q = this.meshes; ne < Q.length; ne++)
+ Q[ne]._removeLightSource(H, !1);
+ this.lights.splice(X, 1), this.sortLightsByPriority(), H.parent || H._removeFromSceneRootNodes();
+ }
+ return this.onLightRemovedObservable.notifyObservers(H), X;
+ }, J.prototype.removeCamera = function(H) {
+ var X = this.cameras.indexOf(H);
+ if (X !== -1 && (this.cameras.splice(X, 1), H.parent || H._removeFromSceneRootNodes()), this.activeCameras) {
+ var ne = this.activeCameras.indexOf(H);
+ ne !== -1 && this.activeCameras.splice(ne, 1);
+ }
+ return this.activeCamera === H && (this.cameras.length > 0 ? this.activeCamera = this.cameras[0] : this.activeCamera = null), this.onCameraRemovedObservable.notifyObservers(H), X;
+ }, J.prototype.removeParticleSystem = function(H) {
+ var X = this.particleSystems.indexOf(H);
+ return X !== -1 && this.particleSystems.splice(X, 1), X;
+ }, J.prototype.removeAnimation = function(H) {
+ var X = this.animations.indexOf(H);
+ return X !== -1 && this.animations.splice(X, 1), X;
+ }, J.prototype.stopAnimation = function(H, X, ne) {
+ }, J.prototype.removeAnimationGroup = function(H) {
+ var X = this.animationGroups.indexOf(H);
+ return X !== -1 && this.animationGroups.splice(X, 1), X;
+ }, J.prototype.removeMultiMaterial = function(H) {
+ var X = this.multiMaterials.indexOf(H);
+ return X !== -1 && this.multiMaterials.splice(X, 1), this.onMultiMaterialRemovedObservable.notifyObservers(H), X;
+ }, J.prototype.removeMaterial = function(H) {
+ var X = H._indexInSceneMaterialArray;
+ if (X !== -1 && X < this.materials.length) {
+ if (X !== this.materials.length - 1) {
+ var ne = this.materials[this.materials.length - 1];
+ this.materials[X] = ne, ne._indexInSceneMaterialArray = X;
+ }
+ H._indexInSceneMaterialArray = -1, this.materials.pop();
+ }
+ return this.onMaterialRemovedObservable.notifyObservers(H), X;
+ }, J.prototype.removeActionManager = function(H) {
+ var X = this.actionManagers.indexOf(H);
+ return X !== -1 && this.actionManagers.splice(X, 1), X;
+ }, J.prototype.removeTexture = function(H) {
+ var X = this.textures.indexOf(H);
+ return X !== -1 && this.textures.splice(X, 1), this.onTextureRemovedObservable.notifyObservers(H), X;
+ }, J.prototype.addLight = function(H) {
+ if (!this._blockEntityCollection) {
+ this.lights.push(H), this.sortLightsByPriority(), H.parent || H._addToSceneRootNodes();
+ for (var X = 0, ne = this.meshes; X < ne.length; X++) {
+ var Q = ne[X];
+ Q.lightSources.indexOf(H) === -1 && (Q.lightSources.push(H), Q._resyncLightSources());
+ }
+ this.onNewLightAddedObservable.notifyObservers(H);
+ }
+ }, J.prototype.sortLightsByPriority = function() {
+ this.requireLightSorting && this.lights.sort(d.a.CompareLightsPriority);
+ }, J.prototype.addCamera = function(H) {
+ this._blockEntityCollection || (this.cameras.push(H), this.onNewCameraAddedObservable.notifyObservers(H), H.parent || H._addToSceneRootNodes());
+ }, J.prototype.addSkeleton = function(H) {
+ this._blockEntityCollection || (this.skeletons.push(H), this.onNewSkeletonAddedObservable.notifyObservers(H));
+ }, J.prototype.addParticleSystem = function(H) {
+ this._blockEntityCollection || this.particleSystems.push(H);
+ }, J.prototype.addAnimation = function(H) {
+ this._blockEntityCollection || this.animations.push(H);
+ }, J.prototype.addAnimationGroup = function(H) {
+ this._blockEntityCollection || this.animationGroups.push(H);
+ }, J.prototype.addMultiMaterial = function(H) {
+ this._blockEntityCollection || (this.multiMaterials.push(H), this.onNewMultiMaterialAddedObservable.notifyObservers(H));
+ }, J.prototype.addMaterial = function(H) {
+ this._blockEntityCollection || (H._indexInSceneMaterialArray = this.materials.length, this.materials.push(H), this.onNewMaterialAddedObservable.notifyObservers(H));
+ }, J.prototype.addMorphTargetManager = function(H) {
+ this._blockEntityCollection || this.morphTargetManagers.push(H);
+ }, J.prototype.addGeometry = function(H) {
+ this._blockEntityCollection || (this.geometriesByUniqueId && (this.geometriesByUniqueId[H.uniqueId] = this.geometries.length), this.geometries.push(H));
+ }, J.prototype.addActionManager = function(H) {
+ this.actionManagers.push(H);
+ }, J.prototype.addTexture = function(H) {
+ this._blockEntityCollection || (this.textures.push(H), this.onNewTextureAddedObservable.notifyObservers(H));
+ }, J.prototype.switchActiveCamera = function(H, X) {
+ X === void 0 && (X = !0), this._engine.getInputElement() && (this.activeCamera && this.activeCamera.detachControl(), this.activeCamera = H, X && H.attachControl());
+ }, J.prototype.setActiveCameraByID = function(H) {
+ var X = this.getCameraByID(H);
+ return X ? (this.activeCamera = X, X) : null;
+ }, J.prototype.setActiveCameraByName = function(H) {
+ var X = this.getCameraByName(H);
+ return X ? (this.activeCamera = X, X) : null;
+ }, J.prototype.getAnimationGroupByName = function(H) {
+ for (var X = 0; X < this.animationGroups.length; X++)
+ if (this.animationGroups[X].name === H)
+ return this.animationGroups[X];
+ return null;
+ }, J.prototype.getMaterialByUniqueID = function(H) {
+ for (var X = 0; X < this.materials.length; X++)
+ if (this.materials[X].uniqueId === H)
+ return this.materials[X];
+ return null;
+ }, J.prototype.getMaterialByID = function(H) {
+ for (var X = 0; X < this.materials.length; X++)
+ if (this.materials[X].id === H)
+ return this.materials[X];
+ return null;
+ }, J.prototype.getLastMaterialByID = function(H) {
+ for (var X = this.materials.length - 1; X >= 0; X--)
+ if (this.materials[X].id === H)
+ return this.materials[X];
+ return null;
+ }, J.prototype.getMaterialByName = function(H) {
+ for (var X = 0; X < this.materials.length; X++)
+ if (this.materials[X].name === H)
+ return this.materials[X];
+ return null;
+ }, J.prototype.getTextureByUniqueID = function(H) {
+ for (var X = 0; X < this.textures.length; X++)
+ if (this.textures[X].uniqueId === H)
+ return this.textures[X];
+ return null;
+ }, J.prototype.getCameraByID = function(H) {
+ for (var X = 0; X < this.cameras.length; X++)
+ if (this.cameras[X].id === H)
+ return this.cameras[X];
+ return null;
+ }, J.prototype.getCameraByUniqueID = function(H) {
+ for (var X = 0; X < this.cameras.length; X++)
+ if (this.cameras[X].uniqueId === H)
+ return this.cameras[X];
+ return null;
+ }, J.prototype.getCameraByName = function(H) {
+ for (var X = 0; X < this.cameras.length; X++)
+ if (this.cameras[X].name === H)
+ return this.cameras[X];
+ return null;
+ }, J.prototype.getBoneByID = function(H) {
+ for (var X = 0; X < this.skeletons.length; X++)
+ for (var ne = this.skeletons[X], Q = 0; Q < ne.bones.length; Q++)
+ if (ne.bones[Q].id === H)
+ return ne.bones[Q];
+ return null;
+ }, J.prototype.getBoneByName = function(H) {
+ for (var X = 0; X < this.skeletons.length; X++)
+ for (var ne = this.skeletons[X], Q = 0; Q < ne.bones.length; Q++)
+ if (ne.bones[Q].name === H)
+ return ne.bones[Q];
+ return null;
+ }, J.prototype.getLightByName = function(H) {
+ for (var X = 0; X < this.lights.length; X++)
+ if (this.lights[X].name === H)
+ return this.lights[X];
+ return null;
+ }, J.prototype.getLightByID = function(H) {
+ for (var X = 0; X < this.lights.length; X++)
+ if (this.lights[X].id === H)
+ return this.lights[X];
+ return null;
+ }, J.prototype.getLightByUniqueID = function(H) {
+ for (var X = 0; X < this.lights.length; X++)
+ if (this.lights[X].uniqueId === H)
+ return this.lights[X];
+ return null;
+ }, J.prototype.getParticleSystemByID = function(H) {
+ for (var X = 0; X < this.particleSystems.length; X++)
+ if (this.particleSystems[X].id === H)
+ return this.particleSystems[X];
+ return null;
+ }, J.prototype.getGeometryByID = function(H) {
+ for (var X = 0; X < this.geometries.length; X++)
+ if (this.geometries[X].id === H)
+ return this.geometries[X];
+ return null;
+ }, J.prototype._getGeometryByUniqueID = function(H) {
+ if (this.geometriesByUniqueId) {
+ var X = this.geometriesByUniqueId[H];
+ if (X !== void 0)
+ return this.geometries[X];
+ } else
+ for (var ne = 0; ne < this.geometries.length; ne++)
+ if (this.geometries[ne].uniqueId === H)
+ return this.geometries[ne];
+ return null;
+ }, J.prototype.pushGeometry = function(H, X) {
+ return !(!X && this._getGeometryByUniqueID(H.uniqueId)) && (this.addGeometry(H), this.onNewGeometryAddedObservable.notifyObservers(H), !0);
+ }, J.prototype.removeGeometry = function(H) {
+ var X;
+ if (this.geometriesByUniqueId) {
+ if ((X = this.geometriesByUniqueId[H.uniqueId]) === void 0)
+ return !1;
+ } else if ((X = this.geometries.indexOf(H)) < 0)
+ return !1;
+ if (X !== this.geometries.length - 1) {
+ var ne = this.geometries[this.geometries.length - 1];
+ ne && (this.geometries[X] = ne, this.geometriesByUniqueId && (this.geometriesByUniqueId[ne.uniqueId] = X, this.geometriesByUniqueId[H.uniqueId] = void 0));
+ }
+ return this.geometries.pop(), this.onGeometryRemovedObservable.notifyObservers(H), !0;
+ }, J.prototype.getGeometries = function() {
+ return this.geometries;
+ }, J.prototype.getMeshByID = function(H) {
+ for (var X = 0; X < this.meshes.length; X++)
+ if (this.meshes[X].id === H)
+ return this.meshes[X];
+ return null;
+ }, J.prototype.getMeshesByID = function(H) {
+ return this.meshes.filter(function(X) {
+ return X.id === H;
+ });
+ }, J.prototype.getTransformNodeByID = function(H) {
+ for (var X = 0; X < this.transformNodes.length; X++)
+ if (this.transformNodes[X].id === H)
+ return this.transformNodes[X];
+ return null;
+ }, J.prototype.getTransformNodeByUniqueID = function(H) {
+ for (var X = 0; X < this.transformNodes.length; X++)
+ if (this.transformNodes[X].uniqueId === H)
+ return this.transformNodes[X];
+ return null;
+ }, J.prototype.getTransformNodesByID = function(H) {
+ return this.transformNodes.filter(function(X) {
+ return X.id === H;
+ });
+ }, J.prototype.getMeshByUniqueID = function(H) {
+ for (var X = 0; X < this.meshes.length; X++)
+ if (this.meshes[X].uniqueId === H)
+ return this.meshes[X];
+ return null;
+ }, J.prototype.getLastMeshByID = function(H) {
+ for (var X = this.meshes.length - 1; X >= 0; X--)
+ if (this.meshes[X].id === H)
+ return this.meshes[X];
+ return null;
+ }, J.prototype.getLastEntryByID = function(H) {
+ var X;
+ for (X = this.meshes.length - 1; X >= 0; X--)
+ if (this.meshes[X].id === H)
+ return this.meshes[X];
+ for (X = this.transformNodes.length - 1; X >= 0; X--)
+ if (this.transformNodes[X].id === H)
+ return this.transformNodes[X];
+ for (X = this.cameras.length - 1; X >= 0; X--)
+ if (this.cameras[X].id === H)
+ return this.cameras[X];
+ for (X = this.lights.length - 1; X >= 0; X--)
+ if (this.lights[X].id === H)
+ return this.lights[X];
+ return null;
+ }, J.prototype.getNodeByID = function(H) {
+ var X = this.getMeshByID(H);
+ if (X)
+ return X;
+ var ne = this.getTransformNodeByID(H);
+ if (ne)
+ return ne;
+ var Q = this.getLightByID(H);
+ if (Q)
+ return Q;
+ var $ = this.getCameraByID(H);
+ if ($)
+ return $;
+ var me = this.getBoneByID(H);
+ return me || null;
+ }, J.prototype.getNodeByName = function(H) {
+ var X = this.getMeshByName(H);
+ if (X)
+ return X;
+ var ne = this.getTransformNodeByName(H);
+ if (ne)
+ return ne;
+ var Q = this.getLightByName(H);
+ if (Q)
+ return Q;
+ var $ = this.getCameraByName(H);
+ if ($)
+ return $;
+ var me = this.getBoneByName(H);
+ return me || null;
+ }, J.prototype.getMeshByName = function(H) {
+ for (var X = 0; X < this.meshes.length; X++)
+ if (this.meshes[X].name === H)
+ return this.meshes[X];
+ return null;
+ }, J.prototype.getTransformNodeByName = function(H) {
+ for (var X = 0; X < this.transformNodes.length; X++)
+ if (this.transformNodes[X].name === H)
+ return this.transformNodes[X];
+ return null;
+ }, J.prototype.getLastSkeletonByID = function(H) {
+ for (var X = this.skeletons.length - 1; X >= 0; X--)
+ if (this.skeletons[X].id === H)
+ return this.skeletons[X];
+ return null;
+ }, J.prototype.getSkeletonByUniqueId = function(H) {
+ for (var X = 0; X < this.skeletons.length; X++)
+ if (this.skeletons[X].uniqueId === H)
+ return this.skeletons[X];
+ return null;
+ }, J.prototype.getSkeletonById = function(H) {
+ for (var X = 0; X < this.skeletons.length; X++)
+ if (this.skeletons[X].id === H)
+ return this.skeletons[X];
+ return null;
+ }, J.prototype.getSkeletonByName = function(H) {
+ for (var X = 0; X < this.skeletons.length; X++)
+ if (this.skeletons[X].name === H)
+ return this.skeletons[X];
+ return null;
+ }, J.prototype.getMorphTargetManagerById = function(H) {
+ for (var X = 0; X < this.morphTargetManagers.length; X++)
+ if (this.morphTargetManagers[X].uniqueId === H)
+ return this.morphTargetManagers[X];
+ return null;
+ }, J.prototype.getMorphTargetById = function(H) {
+ for (var X = 0; X < this.morphTargetManagers.length; ++X)
+ for (var ne = this.morphTargetManagers[X], Q = 0; Q < ne.numTargets; ++Q) {
+ var $ = ne.getTarget(Q);
+ if ($.id === H)
+ return $;
+ }
+ return null;
+ }, J.prototype.getMorphTargetByName = function(H) {
+ for (var X = 0; X < this.morphTargetManagers.length; ++X)
+ for (var ne = this.morphTargetManagers[X], Q = 0; Q < ne.numTargets; ++Q) {
+ var $ = ne.getTarget(Q);
+ if ($.name === H)
+ return $;
+ }
+ return null;
+ }, J.prototype.getPostProcessByName = function(H) {
+ for (var X = 0; X < this.postProcesses.length; ++X) {
+ var ne = this.postProcesses[X];
+ if (ne.name === H)
+ return ne;
+ }
+ return null;
+ }, J.prototype.isActiveMesh = function(H) {
+ return this._activeMeshes.indexOf(H) !== -1;
+ }, Object.defineProperty(J.prototype, "uid", { get: function() {
+ return this._uid || (this._uid = f.b.RandomId()), this._uid;
+ }, enumerable: !1, configurable: !0 }), J.prototype.addExternalData = function(H, X) {
+ return this._externalData || (this._externalData = new x.a()), this._externalData.add(H, X);
+ }, J.prototype.getExternalData = function(H) {
+ return this._externalData ? this._externalData.get(H) : null;
+ }, J.prototype.getOrAddExternalDataWithFactory = function(H, X) {
+ return this._externalData || (this._externalData = new x.a()), this._externalData.getOrAddWithFactory(H, X);
+ }, J.prototype.removeExternalData = function(H) {
+ return this._externalData.remove(H);
+ }, J.prototype._evaluateSubMesh = function(H, X, ne) {
+ if (ne.hasInstances || ne.isAnInstance || this.dispatchAllSubMeshesOfActiveMeshes || this._skipFrustumClipping || X.alwaysSelectAsActiveMesh || X.subMeshes.length === 1 || H.isInFrustum(this._frustumPlanes)) {
+ for (var Q = 0, $ = this._evaluateSubMeshStage; Q < $.length; Q++)
+ $[Q].action(X, H);
+ var me = H.getMaterial();
+ me != null && (me.hasRenderTargetTextures && me.getRenderTargetTextures != null && this._processedMaterials.indexOf(me) === -1 && (this._processedMaterials.push(me), this._renderTargets.concatWithNoDuplicate(me.getRenderTargetTextures())), this._renderingManager.dispatch(H, X, me));
+ }
+ }, J.prototype.freeProcessedMaterials = function() {
+ this._processedMaterials.dispose();
+ }, Object.defineProperty(J.prototype, "blockfreeActiveMeshesAndRenderingGroups", { get: function() {
+ return this._preventFreeActiveMeshesAndRenderingGroups;
+ }, set: function(H) {
+ this._preventFreeActiveMeshesAndRenderingGroups !== H && (H && (this.freeActiveMeshes(), this.freeRenderingGroups()), this._preventFreeActiveMeshesAndRenderingGroups = H);
+ }, enumerable: !1, configurable: !0 }), J.prototype.freeActiveMeshes = function() {
+ if (!this.blockfreeActiveMeshesAndRenderingGroups && (this._activeMeshes.dispose(), this.activeCamera && this.activeCamera._activeMeshes && this.activeCamera._activeMeshes.dispose(), this.activeCameras))
+ for (var H = 0; H < this.activeCameras.length; H++) {
+ var X = this.activeCameras[H];
+ X && X._activeMeshes && X._activeMeshes.dispose();
+ }
+ }, J.prototype.freeRenderingGroups = function() {
+ if (!this.blockfreeActiveMeshesAndRenderingGroups && (this._renderingManager && this._renderingManager.freeRenderingGroups(), this.textures))
+ for (var H = 0; H < this.textures.length; H++) {
+ var X = this.textures[H];
+ X && X.renderList && X.freeRenderingGroups();
+ }
+ }, J.prototype._isInIntermediateRendering = function() {
+ return this._intermediateRendering;
+ }, J.prototype.freezeActiveMeshes = function(H, X, ne) {
+ var Q = this;
+ return H === void 0 && (H = !1), this.executeWhenReady(function() {
+ if (Q.activeCamera) {
+ Q._frustumPlanes || Q.setTransformMatrix(Q.activeCamera.getViewMatrix(), Q.activeCamera.getProjectionMatrix()), Q._evaluateActiveMeshes(), Q._activeMeshesFrozen = !0, Q._skipEvaluateActiveMeshesCompletely = H;
+ for (var $ = 0; $ < Q._activeMeshes.length; $++)
+ Q._activeMeshes.data[$]._freeze();
+ X && X();
+ } else
+ ne && ne("No active camera found");
+ }), this;
+ }, J.prototype.unfreezeActiveMeshes = function() {
+ for (var H = 0; H < this.meshes.length; H++) {
+ var X = this.meshes[H];
+ X._internalAbstractMeshDataInfo && (X._internalAbstractMeshDataInfo._isActive = !1);
+ }
+ for (H = 0; H < this._activeMeshes.length; H++)
+ this._activeMeshes.data[H]._unFreeze();
+ return this._activeMeshesFrozen = !1, this;
+ }, J.prototype._evaluateActiveMeshes = function() {
+ if (this._activeMeshesFrozen && this._activeMeshes.length) {
+ if (!this._skipEvaluateActiveMeshesCompletely)
+ for (var H = this._activeMeshes.length, X = 0; X < H; X++)
+ (be = this._activeMeshes.data[X]).computeWorldMatrix();
+ if (this._activeParticleSystems) {
+ var ne = this._activeParticleSystems.length;
+ for (X = 0; X < ne; X++)
+ this._activeParticleSystems.data[X].animate();
+ }
+ } else if (this.activeCamera) {
+ this.onBeforeActiveMeshesEvaluationObservable.notifyObservers(this), this.activeCamera._activeMeshes.reset(), this._activeMeshes.reset(), this._renderingManager.reset(), this._processedMaterials.reset(), this._activeParticleSystems.reset(), this._activeSkeletons.reset(), this._softwareSkinnedMeshes.reset();
+ for (var Q = 0, $ = this._beforeEvaluateActiveMeshStage; Q < $.length; Q++)
+ $[Q].action();
+ var me = this.getActiveMeshCandidates(), ye = me.length;
+ for (X = 0; X < ye; X++) {
+ var be;
+ if ((be = me.data[X])._internalAbstractMeshDataInfo._currentLODIsUpToDate = !1, !be.isBlocked && (this._totalVertices.addCount(be.getTotalVertices(), !1), be.isReady() && be.isEnabled() && be.scaling.lengthSquared() !== 0)) {
+ be.computeWorldMatrix(), be.actionManager && be.actionManager.hasSpecificTriggers2(L.a.ACTION_OnIntersectionEnterTrigger, L.a.ACTION_OnIntersectionExitTrigger) && this._meshesForIntersections.pushNoDuplicate(be);
+ var ge = this.customLODSelector ? this.customLODSelector(be, this.activeCamera) : be.getLOD(this.activeCamera);
+ if (be._internalAbstractMeshDataInfo._currentLOD = ge, be._internalAbstractMeshDataInfo._currentLODIsUpToDate = !0, ge != null && (ge !== be && ge.billboardMode !== u.a.BILLBOARDMODE_NONE && ge.computeWorldMatrix(), be._preActivate(), be.isVisible && be.visibility > 0 && (be.layerMask & this.activeCamera.layerMask) != 0 && (this._skipFrustumClipping || be.alwaysSelectAsActiveMesh || be.isInFrustum(this._frustumPlanes)))) {
+ this._activeMeshes.push(be), this.activeCamera._activeMeshes.push(be), ge !== be && ge._activate(this._renderId, !1);
+ for (var Te = 0, Re = this._preActiveMeshStage; Te < Re.length; Te++)
+ Re[Te].action(be);
+ be._activate(this._renderId, !1) && (be.isAnInstance ? be._internalAbstractMeshDataInfo._actAsRegularMesh && (ge = be) : ge._internalAbstractMeshDataInfo._onlyForInstances = !1, ge._internalAbstractMeshDataInfo._isActive = !0, this._activeMesh(be, ge)), be._postActivate();
+ }
+ }
+ }
+ if (this.onAfterActiveMeshesEvaluationObservable.notifyObservers(this), this.particlesEnabled) {
+ this.onBeforeParticlesRenderingObservable.notifyObservers(this);
+ for (var Se = 0; Se < this.particleSystems.length; Se++) {
+ var Ne = this.particleSystems[Se];
+ if (Ne.isStarted() && Ne.emitter) {
+ var ze = Ne.emitter;
+ ze.position && !ze.isEnabled() || (this._activeParticleSystems.push(Ne), Ne.animate(), this._renderingManager.dispatchParticles(Ne));
+ }
+ }
+ this.onAfterParticlesRenderingObservable.notifyObservers(this);
+ }
+ }
+ }, J.prototype._activeMesh = function(H, X) {
+ if (this._skeletonsEnabled && X.skeleton !== null && X.skeleton !== void 0 && (this._activeSkeletons.pushNoDuplicate(X.skeleton) && X.skeleton.prepare(), X.computeBonesUsingShaders || this._softwareSkinnedMeshes.pushNoDuplicate(X)), X != null && X.subMeshes !== void 0 && X.subMeshes !== null && X.subMeshes.length > 0)
+ for (var ne = this.getActiveSubMeshCandidates(X), Q = ne.length, $ = 0; $ < Q; $++) {
+ var me = ne.data[$];
+ this._evaluateSubMesh(me, X, H);
+ }
+ }, J.prototype.updateTransformMatrix = function(H) {
+ this.activeCamera && this.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix(H));
+ }, J.prototype._bindFrameBuffer = function() {
+ if (this.activeCamera && this.activeCamera._multiviewTexture)
+ this.activeCamera._multiviewTexture._bindFrameBuffer();
+ else if (this.activeCamera && this.activeCamera.outputRenderTarget)
+ if (this.getEngine().getCaps().multiview && this.activeCamera.outputRenderTarget && this.activeCamera.outputRenderTarget.getViewCount() > 1)
+ this.activeCamera.outputRenderTarget._bindFrameBuffer();
+ else {
+ var H = this.activeCamera.outputRenderTarget.getInternalTexture();
+ H ? this.getEngine().bindFramebuffer(H) : W.a.Error("Camera contains invalid customDefaultRenderTarget");
+ }
+ else
+ this.getEngine().restoreDefaultFramebuffer();
+ }, J.prototype._renderForCamera = function(H, X) {
+ if (!H || !H._skipRendering) {
+ var ne = this._engine;
+ if (this._activeCamera = H, !this.activeCamera)
+ throw new Error("Active camera not set");
+ ne.setViewport(this.activeCamera.viewport), this.resetCachedMaterial(), this._renderId++, this.getEngine().getCaps().multiview && H.outputRenderTarget && H.outputRenderTarget.getViewCount() > 1 ? this.setTransformMatrix(H._rigCameras[0].getViewMatrix(), H._rigCameras[0].getProjectionMatrix(), H._rigCameras[1].getViewMatrix(), H._rigCameras[1].getProjectionMatrix()) : this.updateTransformMatrix(), this.onBeforeCameraRenderObservable.notifyObservers(this.activeCamera), this._evaluateActiveMeshes();
+ for (var Q = 0; Q < this._softwareSkinnedMeshes.length; Q++) {
+ var $ = this._softwareSkinnedMeshes.data[Q];
+ $.applySkeleton($.skeleton);
+ }
+ this.onBeforeRenderTargetsRenderObservable.notifyObservers(this), H.customRenderTargets && H.customRenderTargets.length > 0 && this._renderTargets.concatWithNoDuplicate(H.customRenderTargets), X && X.customRenderTargets && X.customRenderTargets.length > 0 && this._renderTargets.concatWithNoDuplicate(X.customRenderTargets);
+ for (var me = 0, ye = this._gatherActiveCameraRenderTargetsStage; me < ye.length; me++)
+ ye[me].action(this._renderTargets);
+ var be = !1;
+ if (this.renderTargetsEnabled) {
+ if (this._intermediateRendering = !0, this._renderTargets.length > 0) {
+ f.b.StartPerformanceCounter("Render targets", this._renderTargets.length > 0);
+ for (var ge = 0; ge < this._renderTargets.length; ge++) {
+ var Te = this._renderTargets.data[ge];
+ if (Te._shouldRender()) {
+ this._renderId++;
+ var Re = Te.activeCamera && Te.activeCamera !== this.activeCamera;
+ Te.render(Re, this.dumpNextRenderTargets), be = !0;
+ }
+ }
+ f.b.EndPerformanceCounter("Render targets", this._renderTargets.length > 0), this._renderId++;
+ }
+ for (var Se = 0, Ne = this._cameraDrawRenderTargetStage; Se < Ne.length; Se++)
+ be = Ne[Se].action(this.activeCamera) || be;
+ this._intermediateRendering = !1, this.activeCamera && this.activeCamera.outputRenderTarget && (be = !0);
+ }
+ be && !this.prePass && this._bindFrameBuffer(), this.onAfterRenderTargetsRenderObservable.notifyObservers(this), !this.postProcessManager || H._multiviewTexture || this.prePass || this.postProcessManager._prepareFrame();
+ for (var ze = 0, Ye = this._beforeCameraDrawStage; ze < Ye.length; ze++)
+ Ye[ze].action(this.activeCamera);
+ this.onBeforeDrawPhaseObservable.notifyObservers(this), this._renderingManager.render(null, null, !0, !0), this.onAfterDrawPhaseObservable.notifyObservers(this);
+ for (var He = 0, Xe = this._afterCameraDrawStage; He < Xe.length; He++)
+ Xe[He].action(this.activeCamera);
+ if (this.postProcessManager && !H._multiviewTexture) {
+ var Ze = H.outputRenderTarget ? H.outputRenderTarget.getInternalTexture() : void 0;
+ this.postProcessManager._finalizeFrame(H.isIntermediate, Ze);
+ }
+ this._renderTargets.reset(), this.onAfterCameraRenderObservable.notifyObservers(this.activeCamera);
+ }
+ }, J.prototype._processSubCameras = function(H) {
+ if (H.cameraRigMode === A.a.RIG_MODE_NONE || H.outputRenderTarget && H.outputRenderTarget.getViewCount() > 1 && this.getEngine().getCaps().multiview)
+ return this._renderForCamera(H), void this.onAfterRenderCameraObservable.notifyObservers(H);
+ if (H._useMultiviewToSingleView)
+ this._renderMultiviewToSingleView(H);
+ else
+ for (var X = 0; X < H._rigCameras.length; X++)
+ this._renderForCamera(H._rigCameras[X], H);
+ this._activeCamera = H, this.setTransformMatrix(this._activeCamera.getViewMatrix(), this._activeCamera.getProjectionMatrix()), this.onAfterRenderCameraObservable.notifyObservers(H);
+ }, J.prototype._checkIntersections = function() {
+ for (var H = 0; H < this._meshesForIntersections.length; H++) {
+ var X = this._meshesForIntersections.data[H];
+ if (X.actionManager)
+ for (var ne = 0; X.actionManager && ne < X.actionManager.actions.length; ne++) {
+ var Q = X.actionManager.actions[ne];
+ if (Q.trigger === L.a.ACTION_OnIntersectionEnterTrigger || Q.trigger === L.a.ACTION_OnIntersectionExitTrigger) {
+ var $ = Q.getTriggerParameter(), me = $ instanceof E.a ? $ : $.mesh, ye = me.intersectsMesh(X, $.usePreciseIntersection), be = X._intersectionsInProgress.indexOf(me);
+ ye && be === -1 ? Q.trigger === L.a.ACTION_OnIntersectionEnterTrigger ? (Q._executeCurrent(T.a.CreateNew(X, void 0, me)), X._intersectionsInProgress.push(me)) : Q.trigger === L.a.ACTION_OnIntersectionExitTrigger && X._intersectionsInProgress.push(me) : !ye && be > -1 && (Q.trigger === L.a.ACTION_OnIntersectionExitTrigger && Q._executeCurrent(T.a.CreateNew(X, void 0, me)), X.actionManager.hasSpecificTrigger(L.a.ACTION_OnIntersectionExitTrigger, function(ge) {
+ var Te = ge instanceof E.a ? ge : ge.mesh;
+ return me === Te;
+ }) && Q.trigger !== L.a.ACTION_OnIntersectionExitTrigger || X._intersectionsInProgress.splice(be, 1));
+ }
+ }
+ }
+ }, J.prototype._advancePhysicsEngineStep = function(H) {
+ }, J.prototype._animate = function() {
+ }, J.prototype.animate = function() {
+ if (this._engine.isDeterministicLockStep()) {
+ var H = Math.max(J.MinDeltaTime, Math.min(this._engine.getDeltaTime(), J.MaxDeltaTime)) + this._timeAccumulator, X = this._engine.getTimeStep(), ne = 1e3 / X / 1e3, Q = 0, $ = this._engine.getLockstepMaxSteps(), me = Math.floor(H / X);
+ for (me = Math.min(me, $); H > 0 && Q < me; )
+ this.onBeforeStepObservable.notifyObservers(this), this._animationRatio = X * ne, this._animate(), this.onAfterAnimationsObservable.notifyObservers(this), this.physicsEnabled && this._advancePhysicsEngineStep(X), this.onAfterStepObservable.notifyObservers(this), this._currentStepId++, Q++, H -= X;
+ this._timeAccumulator = H < 0 ? 0 : H;
+ } else
+ H = this.useConstantAnimationDeltaTime ? 16 : Math.max(J.MinDeltaTime, Math.min(this._engine.getDeltaTime(), J.MaxDeltaTime)), this._animationRatio = 0.06 * H, this._animate(), this.onAfterAnimationsObservable.notifyObservers(this), this.physicsEnabled && this._advancePhysicsEngineStep(H);
+ }, J.prototype.render = function(H, X) {
+ if (H === void 0 && (H = !0), X === void 0 && (X = !1), !this.isDisposed) {
+ this.onReadyObservable.hasObservers() && this._executeWhenReadyTimeoutId === -1 && this._checkIsReady(), this._frameId++, this._registerTransientComponents(), this._activeParticles.fetchNewFrame(), this._totalVertices.fetchNewFrame(), this._activeIndices.fetchNewFrame(), this._activeBones.fetchNewFrame(), this._meshesForIntersections.reset(), this.resetCachedMaterial(), this.onBeforeAnimationsObservable.notifyObservers(this), this.actionManager && this.actionManager.processTrigger(L.a.ACTION_OnEveryFrameTrigger), X || this.animate();
+ for (var ne = 0, Q = this._beforeCameraUpdateStage; ne < Q.length; ne++)
+ Q[ne].action();
+ if (H) {
+ if (this.activeCameras && this.activeCameras.length > 0)
+ for (var $ = 0; $ < this.activeCameras.length; $++) {
+ var me = this.activeCameras[$];
+ if (me.update(), me.cameraRigMode !== A.a.RIG_MODE_NONE)
+ for (var ye = 0; ye < me._rigCameras.length; ye++)
+ me._rigCameras[ye].update();
+ }
+ else if (this.activeCamera && (this.activeCamera.update(), this.activeCamera.cameraRigMode !== A.a.RIG_MODE_NONE))
+ for (ye = 0; ye < this.activeCamera._rigCameras.length; ye++)
+ this.activeCamera._rigCameras[ye].update();
+ }
+ this.onBeforeRenderObservable.notifyObservers(this), this.onBeforeRenderTargetsRenderObservable.notifyObservers(this);
+ var be = this.getEngine(), ge = this.activeCamera;
+ if (this.renderTargetsEnabled) {
+ f.b.StartPerformanceCounter("Custom render targets", this.customRenderTargets.length > 0), this._intermediateRendering = !0;
+ for (var Te = 0; Te < this.customRenderTargets.length; Te++) {
+ var Re = this.customRenderTargets[Te];
+ if (Re._shouldRender()) {
+ if (this._renderId++, this.activeCamera = Re.activeCamera || this.activeCamera, !this.activeCamera)
+ throw new Error("Active camera not set");
+ be.setViewport(this.activeCamera.viewport), this.updateTransformMatrix(), Re.render(ge !== this.activeCamera, this.dumpNextRenderTargets);
+ }
+ }
+ f.b.EndPerformanceCounter("Custom render targets", this.customRenderTargets.length > 0), this._intermediateRendering = !1, this._renderId++;
+ }
+ this.activeCamera = ge, this._activeCamera && this._activeCamera.cameraRigMode !== A.a.RIG_MODE_CUSTOM && !this.prePass && this._bindFrameBuffer(), this.onAfterRenderTargetsRenderObservable.notifyObservers(this);
+ for (var Se = 0, Ne = this._beforeClearStage; Se < Ne.length; Se++)
+ Ne[Se].action();
+ !this.autoClearDepthAndStencil && !this.autoClear || this.prePass || this._engine.clear(this.clearColor, this.autoClear || this.forceWireframe || this.forcePointsCloud, this.autoClearDepthAndStencil, this.autoClearDepthAndStencil);
+ for (var ze = 0, Ye = this._gatherRenderTargetsStage; ze < Ye.length; ze++)
+ Ye[ze].action(this._renderTargets);
+ if (this.activeCameras && this.activeCameras.length > 0)
+ for ($ = 0; $ < this.activeCameras.length; $++)
+ $ > 0 && this._engine.clear(null, !1, !0, !0), this._processSubCameras(this.activeCameras[$]);
+ else {
+ if (!this.activeCamera)
+ throw new Error("No camera defined");
+ this._processSubCameras(this.activeCamera);
+ }
+ this._checkIntersections();
+ for (var He = 0, Xe = this._afterRenderStage; He < Xe.length; He++)
+ Xe[He].action();
+ if (this.afterRender && this.afterRender(), this.onAfterRenderObservable.notifyObservers(this), this._toBeDisposed.length) {
+ for (ye = 0; ye < this._toBeDisposed.length; ye++) {
+ var Ze = this._toBeDisposed[ye];
+ Ze && Ze.dispose();
+ }
+ this._toBeDisposed = [];
+ }
+ this.dumpNextRenderTargets && (this.dumpNextRenderTargets = !1), this._activeBones.addCount(0, !0), this._activeIndices.addCount(0, !0), this._activeParticles.addCount(0, !0);
+ }
+ }, J.prototype.freezeMaterials = function() {
+ for (var H = 0; H < this.materials.length; H++)
+ this.materials[H].freeze();
+ }, J.prototype.unfreezeMaterials = function() {
+ for (var H = 0; H < this.materials.length; H++)
+ this.materials[H].unfreeze();
+ }, J.prototype.dispose = function() {
+ this.beforeRender = null, this.afterRender = null, Y.a._LastCreatedScene === this && (Y.a._LastCreatedScene = null), this.skeletons = [], this.morphTargetManagers = [], this._transientComponents = [], this._isReadyForMeshStage.clear(), this._beforeEvaluateActiveMeshStage.clear(), this._evaluateSubMeshStage.clear(), this._preActiveMeshStage.clear(), this._cameraDrawRenderTargetStage.clear(), this._beforeCameraDrawStage.clear(), this._beforeRenderTargetDrawStage.clear(), this._beforeRenderingGroupDrawStage.clear(), this._beforeRenderingMeshStage.clear(), this._afterRenderingMeshStage.clear(), this._afterRenderingGroupDrawStage.clear(), this._afterCameraDrawStage.clear(), this._afterRenderTargetDrawStage.clear(), this._afterRenderStage.clear(), this._beforeCameraUpdateStage.clear(), this._beforeClearStage.clear(), this._gatherRenderTargetsStage.clear(), this._gatherActiveCameraRenderTargetsStage.clear(), this._pointerMoveStage.clear(), this._pointerDownStage.clear(), this._pointerUpStage.clear();
+ for (var H = 0, X = this._components; H < X.length; H++)
+ X[H].dispose();
+ this.importedMeshesFiles = new Array(), this.stopAllAnimations && this.stopAllAnimations(), this.resetCachedMaterial(), this.activeCamera && (this.activeCamera._activeMeshes.dispose(), this.activeCamera = null), this._activeMeshes.dispose(), this._renderingManager.dispose(), this._processedMaterials.dispose(), this._activeParticleSystems.dispose(), this._activeSkeletons.dispose(), this._softwareSkinnedMeshes.dispose(), this._renderTargets.dispose(), this._registeredForLateAnimationBindings.dispose(), this._meshesForIntersections.dispose(), this._toBeDisposed = [];
+ for (var ne = 0, Q = this._activeRequests; ne < Q.length; ne++)
+ Q[ne].abort();
+ var $;
+ if (this.onDisposeObservable.notifyObservers(this), this.onDisposeObservable.clear(), this.onBeforeRenderObservable.clear(), this.onAfterRenderObservable.clear(), this.onBeforeRenderTargetsRenderObservable.clear(), this.onAfterRenderTargetsRenderObservable.clear(), this.onAfterStepObservable.clear(), this.onBeforeStepObservable.clear(), this.onBeforeActiveMeshesEvaluationObservable.clear(), this.onAfterActiveMeshesEvaluationObservable.clear(), this.onBeforeParticlesRenderingObservable.clear(), this.onAfterParticlesRenderingObservable.clear(), this.onBeforeDrawPhaseObservable.clear(), this.onAfterDrawPhaseObservable.clear(), this.onBeforeAnimationsObservable.clear(), this.onAfterAnimationsObservable.clear(), this.onDataLoadedObservable.clear(), this.onBeforeRenderingGroupObservable.clear(), this.onAfterRenderingGroupObservable.clear(), this.onMeshImportedObservable.clear(), this.onBeforeCameraRenderObservable.clear(), this.onAfterCameraRenderObservable.clear(), this.onReadyObservable.clear(), this.onNewCameraAddedObservable.clear(), this.onCameraRemovedObservable.clear(), this.onNewLightAddedObservable.clear(), this.onLightRemovedObservable.clear(), this.onNewGeometryAddedObservable.clear(), this.onGeometryRemovedObservable.clear(), this.onNewTransformNodeAddedObservable.clear(), this.onTransformNodeRemovedObservable.clear(), this.onNewMeshAddedObservable.clear(), this.onMeshRemovedObservable.clear(), this.onNewSkeletonAddedObservable.clear(), this.onSkeletonRemovedObservable.clear(), this.onNewMaterialAddedObservable.clear(), this.onNewMultiMaterialAddedObservable.clear(), this.onMaterialRemovedObservable.clear(), this.onMultiMaterialRemovedObservable.clear(), this.onNewTextureAddedObservable.clear(), this.onTextureRemovedObservable.clear(), this.onPrePointerObservable.clear(), this.onPointerObservable.clear(), this.onPreKeyboardObservable.clear(), this.onKeyboardObservable.clear(), this.onActiveCameraChanged.clear(), this.detachControl(), this._engine.getInputElement())
+ for ($ = 0; $ < this.cameras.length; $++)
+ this.cameras[$].detachControl();
+ for (; this.animationGroups.length; )
+ this.animationGroups[0].dispose();
+ for (; this.lights.length; )
+ this.lights[0].dispose();
+ for (; this.meshes.length; )
+ this.meshes[0].dispose(!0);
+ for (; this.transformNodes.length; )
+ this.transformNodes[0].dispose(!0);
+ for (; this.cameras.length; )
+ this.cameras[0].dispose();
+ for (this._defaultMaterial && this._defaultMaterial.dispose(); this.multiMaterials.length; )
+ this.multiMaterials[0].dispose();
+ for (; this.materials.length; )
+ this.materials[0].dispose();
+ for (; this.particleSystems.length; )
+ this.particleSystems[0].dispose();
+ for (; this.postProcesses.length; )
+ this.postProcesses[0].dispose();
+ for (; this.textures.length; )
+ this.textures[0].dispose();
+ this._sceneUbo.dispose(), this._multiviewSceneUbo && this._multiviewSceneUbo.dispose(), this.postProcessManager.dispose(), ($ = this._engine.scenes.indexOf(this)) > -1 && this._engine.scenes.splice($, 1), this._engine.wipeCaches(!0), this._isDisposed = !0;
+ }, Object.defineProperty(J.prototype, "isDisposed", { get: function() {
+ return this._isDisposed;
+ }, enumerable: !1, configurable: !0 }), J.prototype.clearCachedVertexData = function() {
+ for (var H = 0; H < this.meshes.length; H++) {
+ var X = this.meshes[H].geometry;
+ if (X)
+ for (var ne in X._indices = [], X._vertexBuffers)
+ X._vertexBuffers.hasOwnProperty(ne) && (X._vertexBuffers[ne]._buffer._data = null);
+ }
+ }, J.prototype.cleanCachedTextureBuffer = function() {
+ for (var H = 0, X = this.textures; H < X.length; H++) {
+ var ne = X[H];
+ ne._buffer && (ne._buffer = null);
+ }
+ }, J.prototype.getWorldExtends = function(H) {
+ var X = new g.e(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), ne = new g.e(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
+ return H = H || function() {
+ return !0;
+ }, this.meshes.filter(H).forEach(function(Q) {
+ if (Q.computeWorldMatrix(!0), Q.subMeshes && Q.subMeshes.length !== 0 && !Q.infiniteDistance) {
+ var $ = Q.getBoundingInfo(), me = $.boundingBox.minimumWorld, ye = $.boundingBox.maximumWorld;
+ g.e.CheckExtends(me, X, ne), g.e.CheckExtends(ye, X, ne);
+ }
+ }), { min: X, max: ne };
+ }, J.prototype.createPickingRay = function(H, X, ne, Q, $) {
+ throw oe.a.WarnImport("Ray");
+ }, J.prototype.createPickingRayToRef = function(H, X, ne, Q, $, me) {
+ throw oe.a.WarnImport("Ray");
+ }, J.prototype.createPickingRayInCameraSpace = function(H, X, ne) {
+ throw oe.a.WarnImport("Ray");
+ }, J.prototype.createPickingRayInCameraSpaceToRef = function(H, X, ne, Q) {
+ throw oe.a.WarnImport("Ray");
+ }, J.prototype.pick = function(H, X, ne, Q, $, me) {
+ var ye = new b.a();
+ return ye._pickingUnavailable = !0, ye;
+ }, J.prototype.pickWithBoundingInfo = function(H, X, ne, Q, $) {
+ var me = new b.a();
+ return me._pickingUnavailable = !0, me;
+ }, J.prototype.pickWithRay = function(H, X, ne, Q) {
+ throw oe.a.WarnImport("Ray");
+ }, J.prototype.multiPick = function(H, X, ne, Q, $) {
+ throw oe.a.WarnImport("Ray");
+ }, J.prototype.multiPickWithRay = function(H, X, ne) {
+ throw oe.a.WarnImport("Ray");
+ }, J.prototype.setPointerOverMesh = function(H, X) {
+ this._inputManager.setPointerOverMesh(H, X);
+ }, J.prototype.getPointerOverMesh = function() {
+ return this._inputManager.getPointerOverMesh();
+ }, J.prototype._rebuildGeometries = function() {
+ for (var H = 0, X = this.geometries; H < X.length; H++)
+ X[H]._rebuild();
+ for (var ne = 0, Q = this.meshes; ne < Q.length; ne++)
+ Q[ne]._rebuild();
+ this.postProcessManager && this.postProcessManager._rebuild();
+ for (var $ = 0, me = this._components; $ < me.length; $++)
+ me[$].rebuild();
+ for (var ye = 0, be = this.particleSystems; ye < be.length; ye++)
+ be[ye].rebuild();
+ }, J.prototype._rebuildTextures = function() {
+ for (var H = 0, X = this.textures; H < X.length; H++)
+ X[H]._rebuild();
+ this.markAllMaterialsAsDirty(L.a.MATERIAL_TextureDirtyFlag);
+ }, J.prototype._getByTags = function(H, X, ne) {
+ if (X === void 0)
+ return H;
+ var Q = [];
+ for (var $ in ne = ne || function(ye) {
+ }, H) {
+ var me = H[$];
+ R.a && R.a.MatchesQuery(me, X) && (Q.push(me), ne(me));
+ }
+ return Q;
+ }, J.prototype.getMeshesByTags = function(H, X) {
+ return this._getByTags(this.meshes, H, X);
+ }, J.prototype.getCamerasByTags = function(H, X) {
+ return this._getByTags(this.cameras, H, X);
+ }, J.prototype.getLightsByTags = function(H, X) {
+ return this._getByTags(this.lights, H, X);
+ }, J.prototype.getMaterialByTags = function(H, X) {
+ return this._getByTags(this.materials, H, X).concat(this._getByTags(this.multiMaterials, H, X));
+ }, J.prototype.getTransformNodesByTags = function(H, X) {
+ return this._getByTags(this.transformNodes, H, X);
+ }, J.prototype.setRenderingOrder = function(H, X, ne, Q) {
+ X === void 0 && (X = null), ne === void 0 && (ne = null), Q === void 0 && (Q = null), this._renderingManager.setRenderingOrder(H, X, ne, Q);
+ }, J.prototype.setRenderingAutoClearDepthStencil = function(H, X, ne, Q) {
+ ne === void 0 && (ne = !0), Q === void 0 && (Q = !0), this._renderingManager.setRenderingAutoClearDepthStencil(H, X, ne, Q);
+ }, J.prototype.getAutoClearDepthStencilSetup = function(H) {
+ return this._renderingManager.getAutoClearDepthStencilSetup(H);
+ }, Object.defineProperty(J.prototype, "blockMaterialDirtyMechanism", { get: function() {
+ return this._blockMaterialDirtyMechanism;
+ }, set: function(H) {
+ this._blockMaterialDirtyMechanism !== H && (this._blockMaterialDirtyMechanism = H, H || this.markAllMaterialsAsDirty(L.a.MATERIAL_AllDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), J.prototype.markAllMaterialsAsDirty = function(H, X) {
+ if (!this._blockMaterialDirtyMechanism)
+ for (var ne = 0, Q = this.materials; ne < Q.length; ne++) {
+ var $ = Q[ne];
+ X && !X($) || $.markAsDirty(H);
+ }
+ }, J.prototype._loadFile = function(H, X, ne, Q, $, me) {
+ var ye = this, be = q.a.LoadFile(H, X, ne, Q ? this.offlineProvider : void 0, $, me);
+ return this._activeRequests.push(be), be.onCompleteObservable.add(function(ge) {
+ ye._activeRequests.splice(ye._activeRequests.indexOf(ge), 1);
+ }), be;
+ }, J.prototype._loadFileAsync = function(H, X, ne, Q) {
+ var $ = this;
+ return new Promise(function(me, ye) {
+ $._loadFile(H, function(be) {
+ me(be);
+ }, X, ne, Q, function(be, ge) {
+ ye(ge);
+ });
+ });
+ }, J.prototype._requestFile = function(H, X, ne, Q, $, me, ye) {
+ var be = this, ge = q.a.RequestFile(H, X, ne, Q ? this.offlineProvider : void 0, $, me, ye);
+ return this._activeRequests.push(ge), ge.onCompleteObservable.add(function(Te) {
+ be._activeRequests.splice(be._activeRequests.indexOf(Te), 1);
+ }), ge;
+ }, J.prototype._requestFileAsync = function(H, X, ne, Q, $) {
+ var me = this;
+ return new Promise(function(ye, be) {
+ me._requestFile(H, function(ge) {
+ ye(ge);
+ }, X, ne, Q, function(ge) {
+ be(ge);
+ }, $);
+ });
+ }, J.prototype._readFile = function(H, X, ne, Q, $) {
+ var me = this, ye = q.a.ReadFile(H, X, ne, Q, $);
+ return this._activeRequests.push(ye), ye.onCompleteObservable.add(function(be) {
+ me._activeRequests.splice(me._activeRequests.indexOf(be), 1);
+ }), ye;
+ }, J.prototype._readFileAsync = function(H, X, ne) {
+ var Q = this;
+ return new Promise(function($, me) {
+ Q._readFile(H, function(ye) {
+ $(ye);
+ }, X, ne, function(ye) {
+ me(ye);
+ });
+ });
+ }, J.FOGMODE_NONE = 0, J.FOGMODE_EXP = 1, J.FOGMODE_EXP2 = 2, J.FOGMODE_LINEAR = 3, J.MinDeltaTime = 1, J.MaxDeltaTime = 1e3, J;
+ }(y.a);
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ function f() {
+ }
+ return f.WarnImport = function(P) {
+ return P + " needs to be imported before as it contains a side-effect required by your code.";
+ }, f;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ function f() {
+ }
+ return Object.defineProperty(f, "LastCreatedEngine", { get: function() {
+ return this.Instances.length === 0 ? null : this.Instances[this.Instances.length - 1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(f, "LastCreatedScene", { get: function() {
+ return this._LastCreatedScene;
+ }, enumerable: !1, configurable: !0 }), f.Instances = new Array(), f._LastCreatedScene = null, f.UseFallbackTexture = !0, f.FallbackTexture = "", f;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "c", function() {
+ return D;
+ }), l.d(_, "a", function() {
+ return c;
+ }), l.d(_, "b", function() {
+ return P;
+ });
+ var D, f = l(0);
+ (function(C) {
+ C[C.LOCAL = 0] = "LOCAL", C[C.WORLD = 1] = "WORLD", C[C.BONE = 2] = "BONE";
+ })(D || (D = {}));
+ var P, c = function() {
+ function C() {
+ }
+ return C.X = new f.e(1, 0, 0), C.Y = new f.e(0, 1, 0), C.Z = new f.e(0, 0, 1), C;
+ }();
+ (function(C) {
+ C[C.X = 0] = "X", C[C.Y = 1] = "Y", C[C.Z = 2] = "Z";
+ })(P || (P = {}));
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return v;
+ });
+ var D = l(1), f = l(3), P = l(33), c = l(12), C = l(6), x = l(0), R = l(29), g = l(8), u = l(11), E = l(21), A = l(58), y = l(90), v = function(h) {
+ function d(b, T, N, U) {
+ U === void 0 && (U = !0);
+ var B = h.call(this, b, N) || this;
+ return B._position = x.e.Zero(), B._upVector = x.e.Up(), B.orthoLeft = null, B.orthoRight = null, B.orthoBottom = null, B.orthoTop = null, B.fov = 0.8, B.minZ = 1, B.maxZ = 1e4, B.inertia = 0.9, B.mode = d.PERSPECTIVE_CAMERA, B.isIntermediate = !1, B.viewport = new A.a(0, 0, 1, 1), B.layerMask = 268435455, B.fovMode = d.FOVMODE_VERTICAL_FIXED, B.cameraRigMode = d.RIG_MODE_NONE, B.customRenderTargets = new Array(), B.outputRenderTarget = null, B.onViewMatrixChangedObservable = new C.c(), B.onProjectionMatrixChangedObservable = new C.c(), B.onAfterCheckInputsObservable = new C.c(), B.onRestoreStateObservable = new C.c(), B.isRigCamera = !1, B._rigCameras = new Array(), B._webvrViewMatrix = x.a.Identity(), B._skipRendering = !1, B._projectionMatrix = new x.a(), B._postProcesses = new Array(), B._activeMeshes = new P.a(256), B._globalPosition = x.e.Zero(), B._computedViewMatrix = x.a.Identity(), B._doNotComputeProjectionMatrix = !1, B._transformMatrix = x.a.Zero(), B._refreshFrustumPlanes = !0, B._isCamera = !0, B._isLeftCamera = !1, B._isRightCamera = !1, B.getScene().addCamera(B), U && !B.getScene().activeCamera && (B.getScene().activeCamera = B), B.position = T, B;
+ }
+ return Object(D.d)(d, h), Object.defineProperty(d.prototype, "position", { get: function() {
+ return this._position;
+ }, set: function(b) {
+ this._position = b;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(d.prototype, "upVector", { get: function() {
+ return this._upVector;
+ }, set: function(b) {
+ this._upVector = b;
+ }, enumerable: !1, configurable: !0 }), d.prototype.storeState = function() {
+ return this._stateStored = !0, this._storedFov = this.fov, this;
+ }, d.prototype._restoreStateValues = function() {
+ return !!this._stateStored && (this.fov = this._storedFov, !0);
+ }, d.prototype.restoreState = function() {
+ return !!this._restoreStateValues() && (this.onRestoreStateObservable.notifyObservers(this), !0);
+ }, d.prototype.getClassName = function() {
+ return "Camera";
+ }, d.prototype.toString = function(b) {
+ var T = "Name: " + this.name;
+ if (T += ", type: " + this.getClassName(), this.animations)
+ for (var N = 0; N < this.animations.length; N++)
+ T += ", animation[0]: " + this.animations[N].toString(b);
+ return T;
+ }, Object.defineProperty(d.prototype, "globalPosition", { get: function() {
+ return this._globalPosition;
+ }, enumerable: !1, configurable: !0 }), d.prototype.getActiveMeshes = function() {
+ return this._activeMeshes;
+ }, d.prototype.isActiveMesh = function(b) {
+ return this._activeMeshes.indexOf(b) !== -1;
+ }, d.prototype.isReady = function(b) {
+ if (b === void 0 && (b = !1), b)
+ for (var T = 0, N = this._postProcesses; T < N.length; T++) {
+ var U = N[T];
+ if (U && !U.isReady())
+ return !1;
+ }
+ return h.prototype.isReady.call(this, b);
+ }, d.prototype._initCache = function() {
+ h.prototype._initCache.call(this), this._cache.position = new x.e(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), this._cache.upVector = new x.e(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), this._cache.mode = void 0, this._cache.minZ = void 0, this._cache.maxZ = void 0, this._cache.fov = void 0, this._cache.fovMode = void 0, this._cache.aspectRatio = void 0, this._cache.orthoLeft = void 0, this._cache.orthoRight = void 0, this._cache.orthoBottom = void 0, this._cache.orthoTop = void 0, this._cache.renderWidth = void 0, this._cache.renderHeight = void 0;
+ }, d.prototype._updateCache = function(b) {
+ b || h.prototype._updateCache.call(this), this._cache.position.copyFrom(this.position), this._cache.upVector.copyFrom(this.upVector);
+ }, d.prototype._isSynchronized = function() {
+ return this._isSynchronizedViewMatrix() && this._isSynchronizedProjectionMatrix();
+ }, d.prototype._isSynchronizedViewMatrix = function() {
+ return !!h.prototype._isSynchronized.call(this) && this._cache.position.equals(this.position) && this._cache.upVector.equals(this.upVector) && this.isSynchronizedWithParent();
+ }, d.prototype._isSynchronizedProjectionMatrix = function() {
+ var b = this._cache.mode === this.mode && this._cache.minZ === this.minZ && this._cache.maxZ === this.maxZ;
+ if (!b)
+ return !1;
+ var T = this.getEngine();
+ return b = this.mode === d.PERSPECTIVE_CAMERA ? this._cache.fov === this.fov && this._cache.fovMode === this.fovMode && this._cache.aspectRatio === T.getAspectRatio(this) : this._cache.orthoLeft === this.orthoLeft && this._cache.orthoRight === this.orthoRight && this._cache.orthoBottom === this.orthoBottom && this._cache.orthoTop === this.orthoTop && this._cache.renderWidth === T.getRenderWidth() && this._cache.renderHeight === T.getRenderHeight();
+ }, d.prototype.attachControl = function(b, T) {
+ }, d.prototype.detachControl = function(b) {
+ }, d.prototype.update = function() {
+ this._checkInputs(), this.cameraRigMode !== d.RIG_MODE_NONE && this._updateRigCameras();
+ }, d.prototype._checkInputs = function() {
+ this.onAfterCheckInputsObservable.notifyObservers(this);
+ }, Object.defineProperty(d.prototype, "rigCameras", { get: function() {
+ return this._rigCameras;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(d.prototype, "rigPostProcess", { get: function() {
+ return this._rigPostProcess;
+ }, enumerable: !1, configurable: !0 }), d.prototype._getFirstPostProcess = function() {
+ for (var b = 0; b < this._postProcesses.length; b++)
+ if (this._postProcesses[b] !== null)
+ return this._postProcesses[b];
+ return null;
+ }, d.prototype._cascadePostProcessesToRigCams = function() {
+ var b = this._getFirstPostProcess();
+ b && b.markTextureDirty();
+ for (var T = 0, N = this._rigCameras.length; T < N; T++) {
+ var U = this._rigCameras[T], B = U._rigPostProcess;
+ B ? (B.getEffectName() === "pass" && (U.isIntermediate = this._postProcesses.length === 0), U._postProcesses = this._postProcesses.slice(0).concat(B), B.markTextureDirty()) : U._postProcesses = this._postProcesses.slice(0);
+ }
+ }, d.prototype.attachPostProcess = function(b, T) {
+ return T === void 0 && (T = null), !b.isReusable() && this._postProcesses.indexOf(b) > -1 ? (g.a.Error("You're trying to reuse a post process not defined as reusable."), 0) : (T == null || T < 0 ? this._postProcesses.push(b) : this._postProcesses[T] === null ? this._postProcesses[T] = b : this._postProcesses.splice(T, 0, b), this._cascadePostProcessesToRigCams(), this._scene.prePassRenderer && this._scene.prePassRenderer.markAsDirty(), this._postProcesses.indexOf(b));
+ }, d.prototype.detachPostProcess = function(b) {
+ var T = this._postProcesses.indexOf(b);
+ T !== -1 && (this._postProcesses[T] = null), this._scene.prePassRenderer && this._scene.prePassRenderer.markAsDirty(), this._cascadePostProcessesToRigCams();
+ }, d.prototype.getWorldMatrix = function() {
+ return this._isSynchronizedViewMatrix() || this.getViewMatrix(), this._worldMatrix;
+ }, d.prototype._getViewMatrix = function() {
+ return x.a.Identity();
+ }, d.prototype.getViewMatrix = function(b) {
+ return !b && this._isSynchronizedViewMatrix() || (this.updateCache(), this._computedViewMatrix = this._getViewMatrix(), this._currentRenderId = this.getScene().getRenderId(), this._childUpdateId++, this._refreshFrustumPlanes = !0, this._cameraRigParams && this._cameraRigParams.vrPreViewMatrix && this._computedViewMatrix.multiplyToRef(this._cameraRigParams.vrPreViewMatrix, this._computedViewMatrix), this.parent && this.parent.onViewMatrixChangedObservable && this.parent.onViewMatrixChangedObservable.notifyObservers(this.parent), this.onViewMatrixChangedObservable.notifyObservers(this), this._computedViewMatrix.invertToRef(this._worldMatrix)), this._computedViewMatrix;
+ }, d.prototype.freezeProjectionMatrix = function(b) {
+ this._doNotComputeProjectionMatrix = !0, b !== void 0 && (this._projectionMatrix = b);
+ }, d.prototype.unfreezeProjectionMatrix = function() {
+ this._doNotComputeProjectionMatrix = !1;
+ }, d.prototype.getProjectionMatrix = function(b) {
+ var T, N, U, B, L, j, W, Y;
+ if (this._doNotComputeProjectionMatrix || !b && this._isSynchronizedProjectionMatrix())
+ return this._projectionMatrix;
+ this._cache.mode = this.mode, this._cache.minZ = this.minZ, this._cache.maxZ = this.maxZ, this._refreshFrustumPlanes = !0;
+ var oe = this.getEngine(), te = this.getScene();
+ if (this.mode === d.PERSPECTIVE_CAMERA) {
+ this._cache.fov = this.fov, this._cache.fovMode = this.fovMode, this._cache.aspectRatio = oe.getAspectRatio(this), this.minZ <= 0 && (this.minZ = 0.1);
+ var _e = oe.useReverseDepthBuffer;
+ (te.useRightHandedSystem ? _e ? x.a.PerspectiveFovReverseRHToRef : x.a.PerspectiveFovRHToRef : _e ? x.a.PerspectiveFovReverseLHToRef : x.a.PerspectiveFovLHToRef)(this.fov, oe.getAspectRatio(this), this.minZ, this.maxZ, this._projectionMatrix, this.fovMode === d.FOVMODE_VERTICAL_FIXED);
+ } else {
+ var de = oe.getRenderWidth() / 2, ae = oe.getRenderHeight() / 2;
+ te.useRightHandedSystem ? x.a.OrthoOffCenterRHToRef((T = this.orthoLeft) !== null && T !== void 0 ? T : -de, (N = this.orthoRight) !== null && N !== void 0 ? N : de, (U = this.orthoBottom) !== null && U !== void 0 ? U : -ae, (B = this.orthoTop) !== null && B !== void 0 ? B : ae, this.minZ, this.maxZ, this._projectionMatrix) : x.a.OrthoOffCenterLHToRef((L = this.orthoLeft) !== null && L !== void 0 ? L : -de, (j = this.orthoRight) !== null && j !== void 0 ? j : de, (W = this.orthoBottom) !== null && W !== void 0 ? W : -ae, (Y = this.orthoTop) !== null && Y !== void 0 ? Y : ae, this.minZ, this.maxZ, this._projectionMatrix), this._cache.orthoLeft = this.orthoLeft, this._cache.orthoRight = this.orthoRight, this._cache.orthoBottom = this.orthoBottom, this._cache.orthoTop = this.orthoTop, this._cache.renderWidth = oe.getRenderWidth(), this._cache.renderHeight = oe.getRenderHeight();
+ }
+ return this.onProjectionMatrixChangedObservable.notifyObservers(this), this._projectionMatrix;
+ }, d.prototype.getTransformationMatrix = function() {
+ return this._computedViewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix), this._transformMatrix;
+ }, d.prototype._updateFrustumPlanes = function() {
+ this._refreshFrustumPlanes && (this.getTransformationMatrix(), this._frustumPlanes ? y.a.GetPlanesToRef(this._transformMatrix, this._frustumPlanes) : this._frustumPlanes = y.a.GetPlanes(this._transformMatrix), this._refreshFrustumPlanes = !1);
+ }, d.prototype.isInFrustum = function(b, T) {
+ if (T === void 0 && (T = !1), this._updateFrustumPlanes(), T && this.rigCameras.length > 0) {
+ var N = !1;
+ return this.rigCameras.forEach(function(U) {
+ U._updateFrustumPlanes(), N = N || b.isInFrustum(U._frustumPlanes);
+ }), N;
+ }
+ return b.isInFrustum(this._frustumPlanes);
+ }, d.prototype.isCompletelyInFrustum = function(b) {
+ return this._updateFrustumPlanes(), b.isCompletelyInFrustum(this._frustumPlanes);
+ }, d.prototype.getForwardRay = function(b, T, N) {
+ throw E.a.WarnImport("Ray");
+ }, d.prototype.getForwardRayToRef = function(b, T, N, U) {
+ throw E.a.WarnImport("Ray");
+ }, d.prototype.dispose = function(b, T) {
+ for (T === void 0 && (T = !1), this.onViewMatrixChangedObservable.clear(), this.onProjectionMatrixChangedObservable.clear(), this.onAfterCheckInputsObservable.clear(), this.onRestoreStateObservable.clear(), this.inputs && this.inputs.clear(), this.getScene().stopAnimation(this), this.getScene().removeCamera(this); this._rigCameras.length > 0; ) {
+ var N = this._rigCameras.pop();
+ N && N.dispose();
+ }
+ if (this._rigPostProcess)
+ this._rigPostProcess.dispose(this), this._rigPostProcess = null, this._postProcesses = [];
+ else if (this.cameraRigMode !== d.RIG_MODE_NONE)
+ this._rigPostProcess = null, this._postProcesses = [];
+ else
+ for (var U = this._postProcesses.length; --U >= 0; ) {
+ var B = this._postProcesses[U];
+ B && B.dispose(this);
+ }
+ for (U = this.customRenderTargets.length; --U >= 0; )
+ this.customRenderTargets[U].dispose();
+ this.customRenderTargets = [], this._activeMeshes.dispose(), h.prototype.dispose.call(this, b, T);
+ }, Object.defineProperty(d.prototype, "isLeftCamera", { get: function() {
+ return this._isLeftCamera;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(d.prototype, "isRightCamera", { get: function() {
+ return this._isRightCamera;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(d.prototype, "leftCamera", { get: function() {
+ return this._rigCameras.length < 1 ? null : this._rigCameras[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(d.prototype, "rightCamera", { get: function() {
+ return this._rigCameras.length < 2 ? null : this._rigCameras[1];
+ }, enumerable: !1, configurable: !0 }), d.prototype.getLeftTarget = function() {
+ return this._rigCameras.length < 1 ? null : this._rigCameras[0].getTarget();
+ }, d.prototype.getRightTarget = function() {
+ return this._rigCameras.length < 2 ? null : this._rigCameras[1].getTarget();
+ }, d.prototype.setCameraRigMode = function(b, T) {
+ if (this.cameraRigMode !== b) {
+ for (; this._rigCameras.length > 0; ) {
+ var N = this._rigCameras.pop();
+ N && N.dispose();
+ }
+ if (this.cameraRigMode = b, this._cameraRigParams = {}, this._cameraRigParams.interaxialDistance = T.interaxialDistance || 0.0637, this._cameraRigParams.stereoHalfAngle = c.b.ToRadians(this._cameraRigParams.interaxialDistance / 0.0637), this.cameraRigMode !== d.RIG_MODE_NONE) {
+ var U = this.createRigCamera(this.name + "_L", 0);
+ U && (U._isLeftCamera = !0);
+ var B = this.createRigCamera(this.name + "_R", 1);
+ B && (B._isRightCamera = !0), U && B && (this._rigCameras.push(U), this._rigCameras.push(B));
+ }
+ switch (this.cameraRigMode) {
+ case d.RIG_MODE_STEREOSCOPIC_ANAGLYPH:
+ d._setStereoscopicAnaglyphRigMode(this);
+ break;
+ case d.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:
+ case d.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:
+ case d.RIG_MODE_STEREOSCOPIC_OVERUNDER:
+ case d.RIG_MODE_STEREOSCOPIC_INTERLACED:
+ d._setStereoscopicRigMode(this);
+ break;
+ case d.RIG_MODE_VR:
+ d._setVRRigMode(this, T);
+ break;
+ case d.RIG_MODE_WEBVR:
+ d._setWebVRRigMode(this, T);
+ }
+ this._cascadePostProcessesToRigCams(), this.update();
+ }
+ }, d._setStereoscopicRigMode = function(b) {
+ throw "Import Cameras/RigModes/stereoscopicRigMode before using stereoscopic rig mode";
+ }, d._setStereoscopicAnaglyphRigMode = function(b) {
+ throw "Import Cameras/RigModes/stereoscopicAnaglyphRigMode before using stereoscopic anaglyph rig mode";
+ }, d._setVRRigMode = function(b, T) {
+ throw "Import Cameras/RigModes/vrRigMode before using VR rig mode";
+ }, d._setWebVRRigMode = function(b, T) {
+ throw "Import Cameras/RigModes/WebVRRigMode before using Web VR rig mode";
+ }, d.prototype._getVRProjectionMatrix = function() {
+ return x.a.PerspectiveFovLHToRef(this._cameraRigParams.vrMetrics.aspectRatioFov, this._cameraRigParams.vrMetrics.aspectRatio, this.minZ, this.maxZ, this._cameraRigParams.vrWorkMatrix), this._cameraRigParams.vrWorkMatrix.multiplyToRef(this._cameraRigParams.vrHMatrix, this._projectionMatrix), this._projectionMatrix;
+ }, d.prototype._updateCameraRotationMatrix = function() {
+ }, d.prototype._updateWebVRCameraRotationMatrix = function() {
+ }, d.prototype._getWebVRProjectionMatrix = function() {
+ return x.a.Identity();
+ }, d.prototype._getWebVRViewMatrix = function() {
+ return x.a.Identity();
+ }, d.prototype.setCameraRigParameter = function(b, T) {
+ this._cameraRigParams || (this._cameraRigParams = {}), this._cameraRigParams[b] = T, b === "interaxialDistance" && (this._cameraRigParams.stereoHalfAngle = c.b.ToRadians(T / 0.0637));
+ }, d.prototype.createRigCamera = function(b, T) {
+ return null;
+ }, d.prototype._updateRigCameras = function() {
+ for (var b = 0; b < this._rigCameras.length; b++)
+ this._rigCameras[b].minZ = this.minZ, this._rigCameras[b].maxZ = this.maxZ, this._rigCameras[b].fov = this.fov, this._rigCameras[b].upVector.copyFrom(this.upVector);
+ this.cameraRigMode === d.RIG_MODE_STEREOSCOPIC_ANAGLYPH && (this._rigCameras[0].viewport = this._rigCameras[1].viewport = this.viewport);
+ }, d.prototype._setupInputs = function() {
+ }, d.prototype.serialize = function() {
+ var b = f.a.Serialize(this);
+ return b.type = this.getClassName(), this.parent && (b.parentId = this.parent.id), this.inputs && this.inputs.serialize(b), f.a.AppendSerializedAnimations(this, b), b.ranges = this.serializeAnimationRanges(), b;
+ }, d.prototype.clone = function(b) {
+ return f.a.Clone(d.GetConstructorFromName(this.getClassName(), b, this.getScene(), this.interaxialDistance, this.isStereoscopicSideBySide), this);
+ }, d.prototype.getDirection = function(b) {
+ var T = x.e.Zero();
+ return this.getDirectionToRef(b, T), T;
+ }, Object.defineProperty(d.prototype, "absoluteRotation", { get: function() {
+ var b = x.b.Zero();
+ return this.getWorldMatrix().decompose(void 0, b), b;
+ }, enumerable: !1, configurable: !0 }), d.prototype.getDirectionToRef = function(b, T) {
+ x.e.TransformNormalToRef(b, this.getWorldMatrix(), T);
+ }, d.GetConstructorFromName = function(b, T, N, U, B) {
+ U === void 0 && (U = 0), B === void 0 && (B = !0);
+ var L = R.a.Construct(b, T, N, { interaxial_distance: U, isStereoscopicSideBySide: B });
+ return L || function() {
+ return d._createDefaultParsedCamera(T, N);
+ };
+ }, d.prototype.computeWorldMatrix = function() {
+ return this.getWorldMatrix();
+ }, d.Parse = function(b, T) {
+ var N = b.type, U = d.GetConstructorFromName(N, b.name, T, b.interaxial_distance, b.isStereoscopicSideBySide), B = f.a.Parse(U, b, T);
+ if (b.parentId && (B._waitingParentId = b.parentId), B.inputs && (B.inputs.parse(b), B._setupInputs()), b.upVector && (B.upVector = x.e.FromArray(b.upVector)), B.setPosition && (B.position.copyFromFloats(0, 0, 0), B.setPosition(x.e.FromArray(b.position))), b.target && B.setTarget && B.setTarget(x.e.FromArray(b.target)), b.cameraRigMode) {
+ var L = b.interaxial_distance ? { interaxialDistance: b.interaxial_distance } : {};
+ B.setCameraRigMode(b.cameraRigMode, L);
+ }
+ if (b.animations) {
+ for (var j = 0; j < b.animations.length; j++) {
+ var W = b.animations[j], Y = u.a.GetClass("BABYLON.Animation");
+ Y && B.animations.push(Y.Parse(W));
+ }
+ R.a.ParseAnimationRanges(B, b, T);
+ }
+ return b.autoAnimate && T.beginAnimation(B, b.autoAnimateFrom, b.autoAnimateTo, b.autoAnimateLoop, b.autoAnimateSpeed || 1), B;
+ }, d._createDefaultParsedCamera = function(b, T) {
+ throw E.a.WarnImport("UniversalCamera");
+ }, d.PERSPECTIVE_CAMERA = 0, d.ORTHOGRAPHIC_CAMERA = 1, d.FOVMODE_VERTICAL_FIXED = 0, d.FOVMODE_HORIZONTAL_FIXED = 1, d.RIG_MODE_NONE = 0, d.RIG_MODE_STEREOSCOPIC_ANAGLYPH = 10, d.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL = 11, d.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED = 12, d.RIG_MODE_STEREOSCOPIC_OVERUNDER = 13, d.RIG_MODE_STEREOSCOPIC_INTERLACED = 14, d.RIG_MODE_VR = 20, d.RIG_MODE_WEBVR = 21, d.RIG_MODE_CUSTOM = 22, d.ForceAttachControlToAlwaysPreventDefault = !1, Object(D.c)([Object(f.o)("position")], d.prototype, "_position", void 0), Object(D.c)([Object(f.o)("upVector")], d.prototype, "_upVector", void 0), Object(D.c)([Object(f.c)()], d.prototype, "orthoLeft", void 0), Object(D.c)([Object(f.c)()], d.prototype, "orthoRight", void 0), Object(D.c)([Object(f.c)()], d.prototype, "orthoBottom", void 0), Object(D.c)([Object(f.c)()], d.prototype, "orthoTop", void 0), Object(D.c)([Object(f.c)()], d.prototype, "fov", void 0), Object(D.c)([Object(f.c)()], d.prototype, "minZ", void 0), Object(D.c)([Object(f.c)()], d.prototype, "maxZ", void 0), Object(D.c)([Object(f.c)()], d.prototype, "inertia", void 0), Object(D.c)([Object(f.c)()], d.prototype, "mode", void 0), Object(D.c)([Object(f.c)()], d.prototype, "layerMask", void 0), Object(D.c)([Object(f.c)()], d.prototype, "fovMode", void 0), Object(D.c)([Object(f.c)()], d.prototype, "cameraRigMode", void 0), Object(D.c)([Object(f.c)()], d.prototype, "interaxialDistance", void 0), Object(D.c)([Object(f.c)()], d.prototype, "isStereoscopicSideBySide", void 0), d;
+ }(R.a);
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return A;
+ });
+ var D = l(1), f = l(3), P = l(12), c = l(6), C = l(22), x = l(61), R = l(85), g = l(2), u = l(8), E = l(64), A = function() {
+ function y(v, h, d) {
+ this.shadowDepthWrapper = null, this.allowShaderHotSwapping = !0, this.metadata = null, this.reservedDataStore = null, this.checkReadyOnEveryCall = !1, this.checkReadyOnlyOnce = !1, this.state = "", this._alpha = 1, this._backFaceCulling = !0, this.onCompiled = null, this.onError = null, this.getRenderTargetTextures = null, this.doNotSerialize = !1, this._storeEffectOnSubMeshes = !1, this.animations = null, this.onDisposeObservable = new c.c(), this._onDisposeObserver = null, this._onUnBindObservable = null, this._onBindObserver = null, this._alphaMode = g.a.ALPHA_COMBINE, this._needDepthPrePass = !1, this.disableDepthWrite = !1, this.disableColorWrite = !1, this.forceDepthWrite = !1, this.depthFunction = 0, this.separateCullingPass = !1, this._fogEnabled = !0, this.pointSize = 1, this.zOffset = 0, this._effect = null, this._useUBO = !1, this._fillMode = y.TriangleFillMode, this._cachedDepthWriteState = !1, this._cachedColorWriteState = !1, this._cachedDepthFunctionState = 0, this._indexInSceneMaterialArray = -1, this.meshMap = null, this._forceAlphaTest = !1, this._transparencyMode = null, this.name = v;
+ var b = 1;
+ for (this._scene = h || C.a.LastCreatedScene, this.id = v || P.b.RandomId(); this._scene.getMaterialByID(this.id); )
+ this.id = v + " " + b++;
+ this.uniqueId = this._scene.getUniqueId(), this._scene.useRightHandedSystem ? this.sideOrientation = y.ClockWiseSideOrientation : this.sideOrientation = y.CounterClockWiseSideOrientation, this._uniformBuffer = new R.a(this._scene.getEngine()), this._useUBO = this.getScene().getEngine().supportsUniformBuffers, d || this._scene.addMaterial(this), this._scene.useMaterialMeshMap && (this.meshMap = {});
+ }
+ return Object.defineProperty(y.prototype, "canRenderToMRT", { get: function() {
+ return !1;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(y.prototype, "alpha", { get: function() {
+ return this._alpha;
+ }, set: function(v) {
+ this._alpha !== v && (this._alpha = v, this.markAsDirty(y.MiscDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(y.prototype, "backFaceCulling", { get: function() {
+ return this._backFaceCulling;
+ }, set: function(v) {
+ this._backFaceCulling !== v && (this._backFaceCulling = v, this.markAsDirty(y.TextureDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(y.prototype, "hasRenderTargetTextures", { get: function() {
+ return !1;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(y.prototype, "onDispose", { set: function(v) {
+ this._onDisposeObserver && this.onDisposeObservable.remove(this._onDisposeObserver), this._onDisposeObserver = this.onDisposeObservable.add(v);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(y.prototype, "onBindObservable", { get: function() {
+ return this._onBindObservable || (this._onBindObservable = new c.c()), this._onBindObservable;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(y.prototype, "onBind", { set: function(v) {
+ this._onBindObserver && this.onBindObservable.remove(this._onBindObserver), this._onBindObserver = this.onBindObservable.add(v);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(y.prototype, "onUnBindObservable", { get: function() {
+ return this._onUnBindObservable || (this._onUnBindObservable = new c.c()), this._onUnBindObservable;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(y.prototype, "onEffectCreatedObservable", { get: function() {
+ return this._onEffectCreatedObservable || (this._onEffectCreatedObservable = new c.c()), this._onEffectCreatedObservable;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(y.prototype, "alphaMode", { get: function() {
+ return this._alphaMode;
+ }, set: function(v) {
+ this._alphaMode !== v && (this._alphaMode = v, this.markAsDirty(y.TextureDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(y.prototype, "needDepthPrePass", { get: function() {
+ return this._needDepthPrePass;
+ }, set: function(v) {
+ this._needDepthPrePass !== v && (this._needDepthPrePass = v, this._needDepthPrePass && (this.checkReadyOnEveryCall = !0));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(y.prototype, "fogEnabled", { get: function() {
+ return this._fogEnabled;
+ }, set: function(v) {
+ this._fogEnabled !== v && (this._fogEnabled = v, this.markAsDirty(y.MiscDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(y.prototype, "wireframe", { get: function() {
+ switch (this._fillMode) {
+ case y.WireFrameFillMode:
+ case y.LineListDrawMode:
+ case y.LineLoopDrawMode:
+ case y.LineStripDrawMode:
+ return !0;
+ }
+ return this._scene.forceWireframe;
+ }, set: function(v) {
+ this.fillMode = v ? y.WireFrameFillMode : y.TriangleFillMode;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(y.prototype, "pointsCloud", { get: function() {
+ switch (this._fillMode) {
+ case y.PointFillMode:
+ case y.PointListDrawMode:
+ return !0;
+ }
+ return this._scene.forcePointsCloud;
+ }, set: function(v) {
+ this.fillMode = v ? y.PointFillMode : y.TriangleFillMode;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(y.prototype, "fillMode", { get: function() {
+ return this._fillMode;
+ }, set: function(v) {
+ this._fillMode !== v && (this._fillMode = v, this.markAsDirty(y.MiscDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), y.prototype.toString = function(v) {
+ return "Name: " + this.name;
+ }, y.prototype.getClassName = function() {
+ return "Material";
+ }, Object.defineProperty(y.prototype, "isFrozen", { get: function() {
+ return this.checkReadyOnlyOnce;
+ }, enumerable: !1, configurable: !0 }), y.prototype.freeze = function() {
+ this.markDirty(), this.checkReadyOnlyOnce = !0;
+ }, y.prototype.unfreeze = function() {
+ this.markDirty(), this.checkReadyOnlyOnce = !1;
+ }, y.prototype.isReady = function(v, h) {
+ return !0;
+ }, y.prototype.isReadyForSubMesh = function(v, h, d) {
+ return !1;
+ }, y.prototype.getEffect = function() {
+ return this._effect;
+ }, y.prototype.getScene = function() {
+ return this._scene;
+ }, Object.defineProperty(y.prototype, "transparencyMode", { get: function() {
+ return this._transparencyMode;
+ }, set: function(v) {
+ this._transparencyMode !== v && (this._transparencyMode = v, this._forceAlphaTest = v === y.MATERIAL_ALPHATESTANDBLEND, this._markAllSubMeshesAsTexturesAndMiscDirty());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(y.prototype, "_disableAlphaBlending", { get: function() {
+ return this._transparencyMode === y.MATERIAL_OPAQUE || this._transparencyMode === y.MATERIAL_ALPHATEST;
+ }, enumerable: !1, configurable: !0 }), y.prototype.needAlphaBlending = function() {
+ return !this._disableAlphaBlending && this.alpha < 1;
+ }, y.prototype.needAlphaBlendingForMesh = function(v) {
+ return !(this._disableAlphaBlending && v.visibility >= 1) && (this.needAlphaBlending() || v.visibility < 1 || v.hasVertexAlpha);
+ }, y.prototype.needAlphaTesting = function() {
+ return !!this._forceAlphaTest;
+ }, y.prototype._shouldTurnAlphaTestOn = function(v) {
+ return !this.needAlphaBlendingForMesh(v) && this.needAlphaTesting();
+ }, y.prototype.getAlphaTestTexture = function() {
+ return null;
+ }, y.prototype.markDirty = function() {
+ for (var v = 0, h = this.getScene().meshes; v < h.length; v++) {
+ var d = h[v];
+ if (d.subMeshes)
+ for (var b = 0, T = d.subMeshes; b < T.length; b++) {
+ var N = T[b];
+ N.getMaterial() === this && N.effect && (N.effect._wasPreviouslyReady = !1);
+ }
+ }
+ }, y.prototype._preBind = function(v, h) {
+ h === void 0 && (h = null);
+ var d = this._scene.getEngine(), b = (h ?? this.sideOrientation) === y.ClockWiseSideOrientation;
+ return d.enableEffect(v || this._effect), d.setState(this.backFaceCulling, this.zOffset, !1, b), b;
+ }, y.prototype.bind = function(v, h) {
+ }, y.prototype.bindForSubMesh = function(v, h, d) {
+ }, y.prototype.bindOnlyWorldMatrix = function(v) {
+ }, y.prototype.bindSceneUniformBuffer = function(v, h) {
+ h.bindToEffect(v, "Scene");
+ }, y.prototype.bindView = function(v) {
+ this._useUBO ? this.bindSceneUniformBuffer(v, this.getScene().getSceneUniformBuffer()) : v.setMatrix("view", this.getScene().getViewMatrix());
+ }, y.prototype.bindViewProjection = function(v) {
+ this._useUBO ? this.bindSceneUniformBuffer(v, this.getScene().getSceneUniformBuffer()) : v.setMatrix("viewProjection", this.getScene().getTransformMatrix());
+ }, y.prototype._afterBind = function(v) {
+ if (this._scene._cachedMaterial = this, this._scene._cachedVisibility = v ? v.visibility : 1, this._onBindObservable && v && this._onBindObservable.notifyObservers(v), this.disableDepthWrite) {
+ var h = this._scene.getEngine();
+ this._cachedDepthWriteState = h.getDepthWrite(), h.setDepthWrite(!1);
+ }
+ this.disableColorWrite && (h = this._scene.getEngine(), this._cachedColorWriteState = h.getColorWrite(), h.setColorWrite(!1)), this.depthFunction !== 0 && (h = this._scene.getEngine(), this._cachedDepthFunctionState = h.getDepthFunction() || 0, h.setDepthFunction(this.depthFunction));
+ }, y.prototype.unbind = function() {
+ this._onUnBindObservable && this._onUnBindObservable.notifyObservers(this), this.depthFunction !== 0 && this._scene.getEngine().setDepthFunction(this._cachedDepthFunctionState), this.disableDepthWrite && this._scene.getEngine().setDepthWrite(this._cachedDepthWriteState), this.disableColorWrite && this._scene.getEngine().setColorWrite(this._cachedColorWriteState);
+ }, y.prototype.getActiveTextures = function() {
+ return [];
+ }, y.prototype.hasTexture = function(v) {
+ return !1;
+ }, y.prototype.clone = function(v) {
+ return null;
+ }, y.prototype.getBindedMeshes = function() {
+ var v = this;
+ if (this.meshMap) {
+ var h = new Array();
+ for (var d in this.meshMap) {
+ var b = this.meshMap[d];
+ b && h.push(b);
+ }
+ return h;
+ }
+ return this._scene.meshes.filter(function(T) {
+ return T.material === v;
+ });
+ }, y.prototype.forceCompilation = function(v, h, d, b) {
+ var T = this, N = Object(D.a)({ clipPlane: !1, useInstances: !1 }, d), U = this.getScene(), B = this.allowShaderHotSwapping;
+ this.allowShaderHotSwapping = !1;
+ var L = function() {
+ if (T._scene && T._scene.getEngine()) {
+ var j = U.clipPlane;
+ if (N.clipPlane && (U.clipPlane = new E.a(0, 0, 0, 1)), T._storeEffectOnSubMeshes) {
+ var W = !0, Y = null;
+ if (v.subMeshes) {
+ var oe = new x.a(0, 0, 0, 0, 0, v, void 0, !1, !1);
+ oe._materialDefines && (oe._materialDefines._renderId = -1), T.isReadyForSubMesh(v, oe, N.useInstances) || (oe.effect && oe.effect.getCompilationError() && oe.effect.allFallbacksProcessed() ? Y = oe.effect.getCompilationError() : (W = !1, setTimeout(L, 16)));
+ }
+ W && (T.allowShaderHotSwapping = B, Y && b && b(Y), h && h(T));
+ } else
+ T.isReady() ? (T.allowShaderHotSwapping = B, h && h(T)) : setTimeout(L, 16);
+ N.clipPlane && (U.clipPlane = j);
+ }
+ };
+ L();
+ }, y.prototype.forceCompilationAsync = function(v, h) {
+ var d = this;
+ return new Promise(function(b, T) {
+ d.forceCompilation(v, function() {
+ b();
+ }, h, function(N) {
+ T(N);
+ });
+ });
+ }, y.prototype.markAsDirty = function(v) {
+ this.getScene().blockMaterialDirtyMechanism || (y._DirtyCallbackArray.length = 0, v & y.TextureDirtyFlag && y._DirtyCallbackArray.push(y._TextureDirtyCallBack), v & y.LightDirtyFlag && y._DirtyCallbackArray.push(y._LightsDirtyCallBack), v & y.FresnelDirtyFlag && y._DirtyCallbackArray.push(y._FresnelDirtyCallBack), v & y.AttributesDirtyFlag && y._DirtyCallbackArray.push(y._AttributeDirtyCallBack), v & y.MiscDirtyFlag && y._DirtyCallbackArray.push(y._MiscDirtyCallBack), v & y.PrePassDirtyFlag && y._DirtyCallbackArray.push(y._PrePassDirtyCallBack), y._DirtyCallbackArray.length && this._markAllSubMeshesAsDirty(y._RunDirtyCallBacks), this.getScene().resetCachedMaterial());
+ }, y.prototype._markAllSubMeshesAsDirty = function(v) {
+ if (!this.getScene().blockMaterialDirtyMechanism)
+ for (var h = 0, d = this.getScene().meshes; h < d.length; h++) {
+ var b = d[h];
+ if (b.subMeshes)
+ for (var T = 0, N = b.subMeshes; T < N.length; T++) {
+ var U = N[T];
+ U.getMaterial() === this && U._materialDefines && v(U._materialDefines);
+ }
+ }
+ }, y.prototype._markScenePrePassDirty = function() {
+ if (!this.getScene().blockMaterialDirtyMechanism) {
+ var v = this.getScene().enablePrePassRenderer();
+ v && v.markAsDirty();
+ }
+ }, y.prototype._markAllSubMeshesAsAllDirty = function() {
+ this._markAllSubMeshesAsDirty(y._AllDirtyCallBack);
+ }, y.prototype._markAllSubMeshesAsImageProcessingDirty = function() {
+ this._markAllSubMeshesAsDirty(y._ImageProcessingDirtyCallBack);
+ }, y.prototype._markAllSubMeshesAsTexturesDirty = function() {
+ this._markAllSubMeshesAsDirty(y._TextureDirtyCallBack);
+ }, y.prototype._markAllSubMeshesAsFresnelDirty = function() {
+ this._markAllSubMeshesAsDirty(y._FresnelDirtyCallBack);
+ }, y.prototype._markAllSubMeshesAsFresnelAndMiscDirty = function() {
+ this._markAllSubMeshesAsDirty(y._FresnelAndMiscDirtyCallBack);
+ }, y.prototype._markAllSubMeshesAsLightsDirty = function() {
+ this._markAllSubMeshesAsDirty(y._LightsDirtyCallBack);
+ }, y.prototype._markAllSubMeshesAsAttributesDirty = function() {
+ this._markAllSubMeshesAsDirty(y._AttributeDirtyCallBack);
+ }, y.prototype._markAllSubMeshesAsMiscDirty = function() {
+ this._markAllSubMeshesAsDirty(y._MiscDirtyCallBack);
+ }, y.prototype._markAllSubMeshesAsPrePassDirty = function() {
+ this._markAllSubMeshesAsDirty(y._MiscDirtyCallBack);
+ }, y.prototype._markAllSubMeshesAsTexturesAndMiscDirty = function() {
+ this._markAllSubMeshesAsDirty(y._TextureAndMiscDirtyCallBack);
+ }, y.prototype.setPrePassRenderer = function(v) {
+ return !1;
+ }, y.prototype.dispose = function(v, h, d) {
+ var b = this.getScene();
+ if (b.stopAnimation(this), b.freeProcessedMaterials(), b.removeMaterial(this), d !== !0)
+ if (this.meshMap)
+ for (var T in this.meshMap)
+ (B = this.meshMap[T]) && (B.material = null, this.releaseVertexArrayObject(B, v));
+ else
+ for (var N = 0, U = b.meshes; N < U.length; N++) {
+ var B;
+ (B = U[N]).material !== this || B.sourceMesh || (B.material = null, this.releaseVertexArrayObject(B, v));
+ }
+ this._uniformBuffer.dispose(), v && this._effect && (this._storeEffectOnSubMeshes || this._effect.dispose(), this._effect = null), this.onDisposeObservable.notifyObservers(this), this.onDisposeObservable.clear(), this._onBindObservable && this._onBindObservable.clear(), this._onUnBindObservable && this._onUnBindObservable.clear(), this._onEffectCreatedObservable && this._onEffectCreatedObservable.clear();
+ }, y.prototype.releaseVertexArrayObject = function(v, h) {
+ if (v.geometry) {
+ var d = v.geometry;
+ if (this._storeEffectOnSubMeshes)
+ for (var b = 0, T = v.subMeshes; b < T.length; b++) {
+ var N = T[b];
+ d._releaseVertexArrayObject(N._materialEffect), h && N._materialEffect && N._materialEffect.dispose();
+ }
+ else
+ d._releaseVertexArrayObject(this._effect);
+ }
+ }, y.prototype.serialize = function() {
+ return f.a.Serialize(this);
+ }, y.Parse = function(v, h, d) {
+ if (v.customType) {
+ if (v.customType === "BABYLON.PBRMaterial" && v.overloadedAlbedo && (v.customType = "BABYLON.LegacyPBRMaterial", !BABYLON.LegacyPBRMaterial))
+ return u.a.Error("Your scene is trying to load a legacy version of the PBRMaterial, please, include it from the materials library."), null;
+ } else
+ v.customType = "BABYLON.StandardMaterial";
+ return P.b.Instantiate(v.customType).Parse(v, h, d);
+ }, y.TriangleFillMode = g.a.MATERIAL_TriangleFillMode, y.WireFrameFillMode = g.a.MATERIAL_WireFrameFillMode, y.PointFillMode = g.a.MATERIAL_PointFillMode, y.PointListDrawMode = g.a.MATERIAL_PointListDrawMode, y.LineListDrawMode = g.a.MATERIAL_LineListDrawMode, y.LineLoopDrawMode = g.a.MATERIAL_LineLoopDrawMode, y.LineStripDrawMode = g.a.MATERIAL_LineStripDrawMode, y.TriangleStripDrawMode = g.a.MATERIAL_TriangleStripDrawMode, y.TriangleFanDrawMode = g.a.MATERIAL_TriangleFanDrawMode, y.ClockWiseSideOrientation = g.a.MATERIAL_ClockWiseSideOrientation, y.CounterClockWiseSideOrientation = g.a.MATERIAL_CounterClockWiseSideOrientation, y.TextureDirtyFlag = g.a.MATERIAL_TextureDirtyFlag, y.LightDirtyFlag = g.a.MATERIAL_LightDirtyFlag, y.FresnelDirtyFlag = g.a.MATERIAL_FresnelDirtyFlag, y.AttributesDirtyFlag = g.a.MATERIAL_AttributesDirtyFlag, y.MiscDirtyFlag = g.a.MATERIAL_MiscDirtyFlag, y.PrePassDirtyFlag = g.a.MATERIAL_PrePassDirtyFlag, y.AllDirtyFlag = g.a.MATERIAL_AllDirtyFlag, y.MATERIAL_OPAQUE = 0, y.MATERIAL_ALPHATEST = 1, y.MATERIAL_ALPHABLEND = 2, y.MATERIAL_ALPHATESTANDBLEND = 3, y.MATERIAL_NORMALBLENDMETHOD_WHITEOUT = 0, y.MATERIAL_NORMALBLENDMETHOD_RNM = 1, y._AllDirtyCallBack = function(v) {
+ return v.markAllAsDirty();
+ }, y._ImageProcessingDirtyCallBack = function(v) {
+ return v.markAsImageProcessingDirty();
+ }, y._TextureDirtyCallBack = function(v) {
+ return v.markAsTexturesDirty();
+ }, y._FresnelDirtyCallBack = function(v) {
+ return v.markAsFresnelDirty();
+ }, y._MiscDirtyCallBack = function(v) {
+ return v.markAsMiscDirty();
+ }, y._PrePassDirtyCallBack = function(v) {
+ return v.markAsPrePassDirty();
+ }, y._LightsDirtyCallBack = function(v) {
+ return v.markAsLightDirty();
+ }, y._AttributeDirtyCallBack = function(v) {
+ return v.markAsAttributesDirty();
+ }, y._FresnelAndMiscDirtyCallBack = function(v) {
+ y._FresnelDirtyCallBack(v), y._MiscDirtyCallBack(v);
+ }, y._TextureAndMiscDirtyCallBack = function(v) {
+ y._TextureDirtyCallBack(v), y._MiscDirtyCallBack(v);
+ }, y._DirtyCallbackArray = [], y._RunDirtyCallBacks = function(v) {
+ for (var h = 0, d = y._DirtyCallbackArray; h < d.length; h++)
+ (0, d[h])(v);
+ }, Object(D.c)([Object(f.c)()], y.prototype, "id", void 0), Object(D.c)([Object(f.c)()], y.prototype, "uniqueId", void 0), Object(D.c)([Object(f.c)()], y.prototype, "name", void 0), Object(D.c)([Object(f.c)()], y.prototype, "checkReadyOnEveryCall", void 0), Object(D.c)([Object(f.c)()], y.prototype, "checkReadyOnlyOnce", void 0), Object(D.c)([Object(f.c)()], y.prototype, "state", void 0), Object(D.c)([Object(f.c)("alpha")], y.prototype, "_alpha", void 0), Object(D.c)([Object(f.c)("backFaceCulling")], y.prototype, "_backFaceCulling", void 0), Object(D.c)([Object(f.c)()], y.prototype, "sideOrientation", void 0), Object(D.c)([Object(f.c)("alphaMode")], y.prototype, "_alphaMode", void 0), Object(D.c)([Object(f.c)()], y.prototype, "_needDepthPrePass", void 0), Object(D.c)([Object(f.c)()], y.prototype, "disableDepthWrite", void 0), Object(D.c)([Object(f.c)()], y.prototype, "disableColorWrite", void 0), Object(D.c)([Object(f.c)()], y.prototype, "forceDepthWrite", void 0), Object(D.c)([Object(f.c)()], y.prototype, "depthFunction", void 0), Object(D.c)([Object(f.c)()], y.prototype, "separateCullingPass", void 0), Object(D.c)([Object(f.c)("fogEnabled")], y.prototype, "_fogEnabled", void 0), Object(D.c)([Object(f.c)()], y.prototype, "pointSize", void 0), Object(D.c)([Object(f.c)()], y.prototype, "zOffset", void 0), Object(D.c)([Object(f.c)()], y.prototype, "pointsCloud", null), Object(D.c)([Object(f.c)()], y.prototype, "fillMode", null), Object(D.c)([Object(f.c)()], y.prototype, "transparencyMode", null), y;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return U;
+ });
+ var D = l(22), f = l(5), P = l(21), c = l(6), C = l(141), x = l(142), R = l(143), g = l(2), u = l(27), E = l(8), A = l(38), y = function() {
+ function B() {
+ }
+ return B.prototype.postProcessor = function(L, j, W, Y) {
+ return Y.getCaps().drawBuffersExtension || (L = L.replace(/#extension.+GL_EXT_draw_buffers.+(enable|require)/g, "")), L;
+ }, B;
+ }(), v = l(118), h = l(88), d = l(144), b = l(70), T = l(74), N = function() {
+ }, U = function() {
+ function B(L, j, W, Y) {
+ var oe = this;
+ Y === void 0 && (Y = !1), this.forcePOTTextures = !1, this.isFullscreen = !1, this.cullBackFaces = !0, this.renderEvenInBackground = !0, this.preventCacheWipeBetweenFrames = !1, this.validateShaderPrograms = !1, this.useReverseDepthBuffer = !1, this.disableUniformBuffers = !1, this._uniformBuffers = new Array(), this._webGLVersion = 1, this._windowIsBackground = !1, this._highPrecisionShadersAllowed = !0, this._badOS = !1, this._badDesktopOS = !1, this._renderingQueueLaunched = !1, this._activeRenderLoops = new Array(), this.onContextLostObservable = new c.c(), this.onContextRestoredObservable = new c.c(), this._contextWasLost = !1, this._doNotHandleContextLost = !1, this.disableVertexArrayObjects = !1, this._colorWrite = !0, this._colorWriteChanged = !0, this._depthCullingState = new C.a(), this._stencilState = new x.a(), this._alphaState = new R.a(), this._alphaMode = g.a.ALPHA_ADD, this._alphaEquation = g.a.ALPHA_DISABLE, this._internalTexturesCache = new Array(), this._activeChannel = 0, this._currentTextureChannel = -1, this._boundTexturesCache = {}, this._compiledEffects = {}, this._vertexAttribArraysEnabled = [], this._uintIndicesCurrentlySet = !1, this._currentBoundBuffer = new Array(), this._currentFramebuffer = null, this._dummyFramebuffer = null, this._currentBufferPointers = new Array(), this._currentInstanceLocations = new Array(), this._currentInstanceBuffers = new Array(), this._vaoRecordInProgress = !1, this._mustWipeVertexAttributes = !1, this._nextFreeTextureSlots = new Array(), this._maxSimultaneousTextures = 0, this._activeRequests = new Array(), this._transformTextureUrl = null, this.hostInformation = { isMobile: !1 }, this.premultipliedAlpha = !0, this.onBeforeTextureInitObservable = new c.c(), this._viewportCached = { x: 0, y: 0, z: 0, w: 0 }, this._unpackFlipYCached = null, this.enableUnpackFlipYCached = !0, this._getDepthStencilBuffer = function(Q, $, me, ye, be, ge) {
+ var Te = oe._gl, Re = Te.createRenderbuffer();
+ return Te.bindRenderbuffer(Te.RENDERBUFFER, Re), me > 1 && Te.renderbufferStorageMultisample ? Te.renderbufferStorageMultisample(Te.RENDERBUFFER, me, be, Q, $) : Te.renderbufferStorage(Te.RENDERBUFFER, ye, Q, $), Te.framebufferRenderbuffer(Te.FRAMEBUFFER, ge, Te.RENDERBUFFER, Re), Te.bindRenderbuffer(Te.RENDERBUFFER, null), Re;
+ }, this._boundUniforms = {};
+ var te = null;
+ if (L) {
+ if (W = W || {}, T.a.SetMatrixPrecision(!!W.useHighPrecisionMatrix), L.getContext) {
+ if (te = L, this._renderingCanvas = te, j != null && (W.antialias = j), W.deterministicLockstep === void 0 && (W.deterministicLockstep = !1), W.lockstepMaxSteps === void 0 && (W.lockstepMaxSteps = 4), W.timeStep === void 0 && (W.timeStep = 1 / 60), W.preserveDrawingBuffer === void 0 && (W.preserveDrawingBuffer = !1), W.audioEngine === void 0 && (W.audioEngine = !0), W.stencil === void 0 && (W.stencil = !0), W.premultipliedAlpha === !1 && (this.premultipliedAlpha = !1), W.xrCompatible === void 0 && (W.xrCompatible = !0), this._doNotHandleContextLost = !!W.doNotHandleContextLost, navigator && navigator.userAgent) {
+ var _e = navigator.userAgent;
+ this.hostInformation.isMobile = _e.indexOf("Mobile") !== -1;
+ for (var de = 0, ae = B.ExceptionList; de < ae.length; de++) {
+ var ie = ae[de], Z = ie.key, ee = ie.targets;
+ if (new RegExp(Z).test(_e)) {
+ if (ie.capture && ie.captureConstraint) {
+ var w = ie.capture, z = ie.captureConstraint, q = new RegExp(w).exec(_e);
+ if (q && q.length > 0 && parseInt(q[q.length - 1]) >= z)
+ continue;
+ }
+ for (var le = 0, ce = ee; le < ce.length; le++)
+ switch (ce[le]) {
+ case "uniformBuffer":
+ this.disableUniformBuffers = !0;
+ break;
+ case "vao":
+ this.disableVertexArrayObjects = !0;
+ }
+ }
+ }
+ }
+ if (this._doNotHandleContextLost || (this._onContextLost = function(Q) {
+ Q.preventDefault(), oe._contextWasLost = !0, E.a.Warn("WebGL context lost."), oe.onContextLostObservable.notifyObservers(oe);
+ }, this._onContextRestored = function() {
+ setTimeout(function() {
+ oe._initGLContext(), oe._rebuildEffects(), oe._rebuildInternalTextures(), oe._rebuildBuffers(), oe.wipeCaches(!0), E.a.Warn("WebGL context successfully restored."), oe.onContextRestoredObservable.notifyObservers(oe), oe._contextWasLost = !1;
+ }, 0);
+ }, te.addEventListener("webglcontextlost", this._onContextLost, !1), te.addEventListener("webglcontextrestored", this._onContextRestored, !1), W.powerPreference = "high-performance"), !W.disableWebGL2Support)
+ try {
+ this._gl = te.getContext("webgl2", W) || te.getContext("experimental-webgl2", W), this._gl && (this._webGLVersion = 2, this._gl.deleteQuery || (this._webGLVersion = 1));
+ } catch {
+ }
+ if (!this._gl) {
+ if (!te)
+ throw new Error("The provided canvas is null or undefined.");
+ try {
+ this._gl = te.getContext("webgl", W) || te.getContext("experimental-webgl", W);
+ } catch {
+ throw new Error("WebGL not supported");
+ }
+ }
+ if (!this._gl)
+ throw new Error("WebGL not supported");
+ } else {
+ this._gl = L, this._renderingCanvas = this._gl.canvas, this._gl.renderbufferStorageMultisample && (this._webGLVersion = 2);
+ var J = this._gl.getContextAttributes();
+ J && (W.stencil = J.stencil);
+ }
+ this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE), W.useHighPrecisionFloats !== void 0 && (this._highPrecisionShadersAllowed = W.useHighPrecisionFloats);
+ var H = A.a.IsWindowObjectExist() && window.devicePixelRatio || 1, X = W.limitDeviceRatio || H;
+ this._hardwareScalingLevel = Y ? 1 / Math.min(X, H) : 1, this.resize(), this._isStencilEnable = !!W.stencil, this._initGLContext();
+ for (var ne = 0; ne < this._caps.maxVertexAttribs; ne++)
+ this._currentBufferPointers[ne] = new N();
+ this.webGLVersion > 1 ? this._shaderProcessor = new v.a() : this._shaderProcessor = new y(), this._badOS = /iPad/i.test(navigator.userAgent) || /iPhone/i.test(navigator.userAgent), this._badDesktopOS = /^((?!chrome|android).)*safari/i.test(navigator.userAgent), this._creationOptions = W, console.log("Babylon.js v" + B.Version + " - " + this.description);
+ }
+ }
+ return Object.defineProperty(B, "NpmPackage", { get: function() {
+ return "babylonjs@4.2.2";
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(B, "Version", { get: function() {
+ return "4.2.2";
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(B.prototype, "description", { get: function() {
+ var L = "WebGL" + this.webGLVersion;
+ return this._caps.parallelShaderCompile && (L += " - Parallel shader compilation"), L;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(B, "ShadersRepository", { get: function() {
+ return f.a.ShadersRepository;
+ }, set: function(L) {
+ f.a.ShadersRepository = L;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(B.prototype, "supportsUniformBuffers", { get: function() {
+ return this.webGLVersion > 1 && !this.disableUniformBuffers;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(B.prototype, "_shouldUseHighPrecisionShader", { get: function() {
+ return !(!this._caps.highPrecisionShaderSupported || !this._highPrecisionShadersAllowed);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(B.prototype, "needPOTTextures", { get: function() {
+ return this._webGLVersion < 2 || this.forcePOTTextures;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(B.prototype, "doNotHandleContextLost", { get: function() {
+ return this._doNotHandleContextLost;
+ }, set: function(L) {
+ this._doNotHandleContextLost = L;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(B.prototype, "_supportsHardwareTextureRescaling", { get: function() {
+ return !1;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(B.prototype, "framebufferDimensionsObject", { set: function(L) {
+ this._framebufferDimensionsObject = L;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(B.prototype, "currentViewport", { get: function() {
+ return this._cachedViewport;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(B.prototype, "emptyTexture", { get: function() {
+ return this._emptyTexture || (this._emptyTexture = this.createRawTexture(new Uint8Array(4), 1, 1, g.a.TEXTUREFORMAT_RGBA, !1, !1, g.a.TEXTURE_NEAREST_SAMPLINGMODE)), this._emptyTexture;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(B.prototype, "emptyTexture3D", { get: function() {
+ return this._emptyTexture3D || (this._emptyTexture3D = this.createRawTexture3D(new Uint8Array(4), 1, 1, 1, g.a.TEXTUREFORMAT_RGBA, !1, !1, g.a.TEXTURE_NEAREST_SAMPLINGMODE)), this._emptyTexture3D;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(B.prototype, "emptyTexture2DArray", { get: function() {
+ return this._emptyTexture2DArray || (this._emptyTexture2DArray = this.createRawTexture2DArray(new Uint8Array(4), 1, 1, 1, g.a.TEXTUREFORMAT_RGBA, !1, !1, g.a.TEXTURE_NEAREST_SAMPLINGMODE)), this._emptyTexture2DArray;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(B.prototype, "emptyCubeTexture", { get: function() {
+ if (!this._emptyCubeTexture) {
+ var L = new Uint8Array(4), j = [L, L, L, L, L, L];
+ this._emptyCubeTexture = this.createRawCubeTexture(j, 1, g.a.TEXTUREFORMAT_RGBA, g.a.TEXTURETYPE_UNSIGNED_INT, !1, !1, g.a.TEXTURE_NEAREST_SAMPLINGMODE);
+ }
+ return this._emptyCubeTexture;
+ }, enumerable: !1, configurable: !0 }), B.prototype._rebuildInternalTextures = function() {
+ for (var L = 0, j = this._internalTexturesCache.slice(); L < j.length; L++)
+ j[L]._rebuild();
+ }, B.prototype._rebuildEffects = function() {
+ for (var L in this._compiledEffects)
+ this._compiledEffects[L]._prepareEffect();
+ f.a.ResetCache();
+ }, B.prototype.areAllEffectsReady = function() {
+ for (var L in this._compiledEffects)
+ if (!this._compiledEffects[L].isReady())
+ return !1;
+ return !0;
+ }, B.prototype._rebuildBuffers = function() {
+ for (var L = 0, j = this._uniformBuffers; L < j.length; L++)
+ j[L]._rebuild();
+ }, B.prototype._initGLContext = function() {
+ this._caps = { maxTexturesImageUnits: this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS), maxCombinedTexturesImageUnits: this._gl.getParameter(this._gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS), maxVertexTextureImageUnits: this._gl.getParameter(this._gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS), maxTextureSize: this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE), maxSamples: this._webGLVersion > 1 ? this._gl.getParameter(this._gl.MAX_SAMPLES) : 1, maxCubemapTextureSize: this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE), maxRenderTextureSize: this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE), maxVertexAttribs: this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS), maxVaryingVectors: this._gl.getParameter(this._gl.MAX_VARYING_VECTORS), maxFragmentUniformVectors: this._gl.getParameter(this._gl.MAX_FRAGMENT_UNIFORM_VECTORS), maxVertexUniformVectors: this._gl.getParameter(this._gl.MAX_VERTEX_UNIFORM_VECTORS), parallelShaderCompile: this._gl.getExtension("KHR_parallel_shader_compile"), standardDerivatives: this._webGLVersion > 1 || this._gl.getExtension("OES_standard_derivatives") !== null, maxAnisotropy: 1, astc: this._gl.getExtension("WEBGL_compressed_texture_astc") || this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_astc"), bptc: this._gl.getExtension("EXT_texture_compression_bptc") || this._gl.getExtension("WEBKIT_EXT_texture_compression_bptc"), s3tc: this._gl.getExtension("WEBGL_compressed_texture_s3tc") || this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"), pvrtc: this._gl.getExtension("WEBGL_compressed_texture_pvrtc") || this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"), etc1: this._gl.getExtension("WEBGL_compressed_texture_etc1") || this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc1"), etc2: this._gl.getExtension("WEBGL_compressed_texture_etc") || this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc") || this._gl.getExtension("WEBGL_compressed_texture_es3_0"), textureAnisotropicFilterExtension: this._gl.getExtension("EXT_texture_filter_anisotropic") || this._gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic") || this._gl.getExtension("MOZ_EXT_texture_filter_anisotropic"), uintIndices: this._webGLVersion > 1 || this._gl.getExtension("OES_element_index_uint") !== null, fragmentDepthSupported: this._webGLVersion > 1 || this._gl.getExtension("EXT_frag_depth") !== null, highPrecisionShaderSupported: !1, timerQuery: this._gl.getExtension("EXT_disjoint_timer_query_webgl2") || this._gl.getExtension("EXT_disjoint_timer_query"), canUseTimestampForTimerQuery: !1, drawBuffersExtension: !1, maxMSAASamples: 1, colorBufferFloat: this._webGLVersion > 1 && this._gl.getExtension("EXT_color_buffer_float"), textureFloat: !!(this._webGLVersion > 1 || this._gl.getExtension("OES_texture_float")), textureHalfFloat: !!(this._webGLVersion > 1 || this._gl.getExtension("OES_texture_half_float")), textureHalfFloatRender: !1, textureFloatLinearFiltering: !1, textureFloatRender: !1, textureHalfFloatLinearFiltering: !1, vertexArrayObject: !1, instancedArrays: !1, textureLOD: !!(this._webGLVersion > 1 || this._gl.getExtension("EXT_shader_texture_lod")), blendMinMax: !1, multiview: this._gl.getExtension("OVR_multiview2"), oculusMultiview: this._gl.getExtension("OCULUS_multiview"), depthTextureExtension: !1 }, this._glVersion = this._gl.getParameter(this._gl.VERSION);
+ var L = this._gl.getExtension("WEBGL_debug_renderer_info");
+ if (L != null && (this._glRenderer = this._gl.getParameter(L.UNMASKED_RENDERER_WEBGL), this._glVendor = this._gl.getParameter(L.UNMASKED_VENDOR_WEBGL)), this._glVendor || (this._glVendor = "Unknown vendor"), this._glRenderer || (this._glRenderer = "Unknown renderer"), this._gl.HALF_FLOAT_OES !== 36193 && (this._gl.HALF_FLOAT_OES = 36193), this._gl.RGBA16F !== 34842 && (this._gl.RGBA16F = 34842), this._gl.RGBA32F !== 34836 && (this._gl.RGBA32F = 34836), this._gl.DEPTH24_STENCIL8 !== 35056 && (this._gl.DEPTH24_STENCIL8 = 35056), this._caps.timerQuery && (this._webGLVersion === 1 && (this._gl.getQuery = this._caps.timerQuery.getQueryEXT.bind(this._caps.timerQuery)), this._caps.canUseTimestampForTimerQuery = this._gl.getQuery(this._caps.timerQuery.TIMESTAMP_EXT, this._caps.timerQuery.QUERY_COUNTER_BITS_EXT) > 0), this._caps.maxAnisotropy = this._caps.textureAnisotropicFilterExtension ? this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 0, this._caps.textureFloatLinearFiltering = !(!this._caps.textureFloat || !this._gl.getExtension("OES_texture_float_linear")), this._caps.textureFloatRender = !(!this._caps.textureFloat || !this._canRenderToFloatFramebuffer()), this._caps.textureHalfFloatLinearFiltering = !!(this._webGLVersion > 1 || this._caps.textureHalfFloat && this._gl.getExtension("OES_texture_half_float_linear")), this._webGLVersion > 1 && this._gl.HALF_FLOAT_OES !== 5131 && (this._gl.HALF_FLOAT_OES = 5131), this._caps.textureHalfFloatRender = this._caps.textureHalfFloat && this._canRenderToHalfFloatFramebuffer(), this._webGLVersion > 1)
+ this._caps.drawBuffersExtension = !0, this._caps.maxMSAASamples = this._gl.getParameter(this._gl.MAX_SAMPLES);
+ else {
+ var j = this._gl.getExtension("WEBGL_draw_buffers");
+ if (j !== null) {
+ this._caps.drawBuffersExtension = !0, this._gl.drawBuffers = j.drawBuffersWEBGL.bind(j), this._gl.DRAW_FRAMEBUFFER = this._gl.FRAMEBUFFER;
+ for (var W = 0; W < 16; W++)
+ this._gl["COLOR_ATTACHMENT" + W + "_WEBGL"] = j["COLOR_ATTACHMENT" + W + "_WEBGL"];
+ }
+ }
+ if (this._webGLVersion > 1)
+ this._caps.depthTextureExtension = !0;
+ else {
+ var Y = this._gl.getExtension("WEBGL_depth_texture");
+ Y != null && (this._caps.depthTextureExtension = !0, this._gl.UNSIGNED_INT_24_8 = Y.UNSIGNED_INT_24_8_WEBGL);
+ }
+ if (this.disableVertexArrayObjects)
+ this._caps.vertexArrayObject = !1;
+ else if (this._webGLVersion > 1)
+ this._caps.vertexArrayObject = !0;
+ else {
+ var oe = this._gl.getExtension("OES_vertex_array_object");
+ oe != null && (this._caps.vertexArrayObject = !0, this._gl.createVertexArray = oe.createVertexArrayOES.bind(oe), this._gl.bindVertexArray = oe.bindVertexArrayOES.bind(oe), this._gl.deleteVertexArray = oe.deleteVertexArrayOES.bind(oe));
+ }
+ if (this._webGLVersion > 1)
+ this._caps.instancedArrays = !0;
+ else {
+ var te = this._gl.getExtension("ANGLE_instanced_arrays");
+ te != null ? (this._caps.instancedArrays = !0, this._gl.drawArraysInstanced = te.drawArraysInstancedANGLE.bind(te), this._gl.drawElementsInstanced = te.drawElementsInstancedANGLE.bind(te), this._gl.vertexAttribDivisor = te.vertexAttribDivisorANGLE.bind(te)) : this._caps.instancedArrays = !1;
+ }
+ if (this._gl.getShaderPrecisionFormat) {
+ var _e = this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER, this._gl.HIGH_FLOAT), de = this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER, this._gl.HIGH_FLOAT);
+ _e && de && (this._caps.highPrecisionShaderSupported = _e.precision !== 0 && de.precision !== 0);
+ }
+ if (this._webGLVersion > 1)
+ this._caps.blendMinMax = !0;
+ else {
+ var ae = this._gl.getExtension("EXT_blend_minmax");
+ ae != null && (this._caps.blendMinMax = !0, this._gl.MAX = ae.MAX_EXT, this._gl.MIN = ae.MIN_EXT);
+ }
+ this._depthCullingState.depthTest = !0, this._depthCullingState.depthFunc = this._gl.LEQUAL, this._depthCullingState.depthMask = !0, this._maxSimultaneousTextures = this._caps.maxCombinedTexturesImageUnits;
+ for (var ie = 0; ie < this._maxSimultaneousTextures; ie++)
+ this._nextFreeTextureSlots.push(ie);
+ }, Object.defineProperty(B.prototype, "webGLVersion", { get: function() {
+ return this._webGLVersion;
+ }, enumerable: !1, configurable: !0 }), B.prototype.getClassName = function() {
+ return "ThinEngine";
+ }, Object.defineProperty(B.prototype, "isStencilEnable", { get: function() {
+ return this._isStencilEnable;
+ }, enumerable: !1, configurable: !0 }), B.prototype._prepareWorkingCanvas = function() {
+ if (!this._workingCanvas) {
+ this._workingCanvas = b.a.CreateCanvas(1, 1);
+ var L = this._workingCanvas.getContext("2d");
+ L && (this._workingContext = L);
+ }
+ }, B.prototype.resetTextureCache = function() {
+ for (var L in this._boundTexturesCache)
+ this._boundTexturesCache.hasOwnProperty(L) && (this._boundTexturesCache[L] = null);
+ this._currentTextureChannel = -1;
+ }, B.prototype.getGlInfo = function() {
+ return { vendor: this._glVendor, renderer: this._glRenderer, version: this._glVersion };
+ }, B.prototype.setHardwareScalingLevel = function(L) {
+ this._hardwareScalingLevel = L, this.resize();
+ }, B.prototype.getHardwareScalingLevel = function() {
+ return this._hardwareScalingLevel;
+ }, B.prototype.getLoadedTexturesCache = function() {
+ return this._internalTexturesCache;
+ }, B.prototype.getCaps = function() {
+ return this._caps;
+ }, B.prototype.stopRenderLoop = function(L) {
+ if (L) {
+ var j = this._activeRenderLoops.indexOf(L);
+ j >= 0 && this._activeRenderLoops.splice(j, 1);
+ } else
+ this._activeRenderLoops = [];
+ }, B.prototype._renderLoop = function() {
+ if (!this._contextWasLost) {
+ var L = !0;
+ if (!this.renderEvenInBackground && this._windowIsBackground && (L = !1), L) {
+ this.beginFrame();
+ for (var j = 0; j < this._activeRenderLoops.length; j++)
+ (0, this._activeRenderLoops[j])();
+ this.endFrame();
+ }
+ }
+ this._activeRenderLoops.length > 0 ? this._frameHandler = this._queueNewFrame(this._boundRenderFunction, this.getHostWindow()) : this._renderingQueueLaunched = !1;
+ }, B.prototype.getRenderingCanvas = function() {
+ return this._renderingCanvas;
+ }, B.prototype.getHostWindow = function() {
+ return A.a.IsWindowObjectExist() ? this._renderingCanvas && this._renderingCanvas.ownerDocument && this._renderingCanvas.ownerDocument.defaultView ? this._renderingCanvas.ownerDocument.defaultView : window : null;
+ }, B.prototype.getRenderWidth = function(L) {
+ return L === void 0 && (L = !1), !L && this._currentRenderTarget ? this._currentRenderTarget.width : this._framebufferDimensionsObject ? this._framebufferDimensionsObject.framebufferWidth : this._gl.drawingBufferWidth;
+ }, B.prototype.getRenderHeight = function(L) {
+ return L === void 0 && (L = !1), !L && this._currentRenderTarget ? this._currentRenderTarget.height : this._framebufferDimensionsObject ? this._framebufferDimensionsObject.framebufferHeight : this._gl.drawingBufferHeight;
+ }, B.prototype._queueNewFrame = function(L, j) {
+ return B.QueueNewFrame(L, j);
+ }, B.prototype.runRenderLoop = function(L) {
+ this._activeRenderLoops.indexOf(L) === -1 && (this._activeRenderLoops.push(L), this._renderingQueueLaunched || (this._renderingQueueLaunched = !0, this._boundRenderFunction = this._renderLoop.bind(this), this._frameHandler = this._queueNewFrame(this._boundRenderFunction, this.getHostWindow())));
+ }, B.prototype.clear = function(L, j, W, Y) {
+ Y === void 0 && (Y = !1), this.applyStates();
+ var oe = 0;
+ j && L && (this._gl.clearColor(L.r, L.g, L.b, L.a !== void 0 ? L.a : 1), oe |= this._gl.COLOR_BUFFER_BIT), W && (this.useReverseDepthBuffer ? (this._depthCullingState.depthFunc = this._gl.GREATER, this._gl.clearDepth(0)) : this._gl.clearDepth(1), oe |= this._gl.DEPTH_BUFFER_BIT), Y && (this._gl.clearStencil(0), oe |= this._gl.STENCIL_BUFFER_BIT), this._gl.clear(oe);
+ }, B.prototype._viewport = function(L, j, W, Y) {
+ L === this._viewportCached.x && j === this._viewportCached.y && W === this._viewportCached.z && Y === this._viewportCached.w || (this._viewportCached.x = L, this._viewportCached.y = j, this._viewportCached.z = W, this._viewportCached.w = Y, this._gl.viewport(L, j, W, Y));
+ }, B.prototype.setViewport = function(L, j, W) {
+ var Y = j || this.getRenderWidth(), oe = W || this.getRenderHeight(), te = L.x || 0, _e = L.y || 0;
+ this._cachedViewport = L, this._viewport(te * Y, _e * oe, Y * L.width, oe * L.height);
+ }, B.prototype.beginFrame = function() {
+ }, B.prototype.endFrame = function() {
+ this._badOS && this.flushFramebuffer();
+ }, B.prototype.resize = function() {
+ var L, j;
+ A.a.IsWindowObjectExist() ? (L = this._renderingCanvas ? this._renderingCanvas.clientWidth || this._renderingCanvas.width : window.innerWidth, j = this._renderingCanvas ? this._renderingCanvas.clientHeight || this._renderingCanvas.height : window.innerHeight) : (L = this._renderingCanvas ? this._renderingCanvas.width : 100, j = this._renderingCanvas ? this._renderingCanvas.height : 100), this.setSize(L / this._hardwareScalingLevel, j / this._hardwareScalingLevel);
+ }, B.prototype.setSize = function(L, j) {
+ return !!this._renderingCanvas && (L |= 0, j |= 0, (this._renderingCanvas.width !== L || this._renderingCanvas.height !== j) && (this._renderingCanvas.width = L, this._renderingCanvas.height = j, !0));
+ }, B.prototype.bindFramebuffer = function(L, j, W, Y, oe, te, _e) {
+ j === void 0 && (j = 0), te === void 0 && (te = 0), _e === void 0 && (_e = 0), this._currentRenderTarget && this.unBindFramebuffer(this._currentRenderTarget), this._currentRenderTarget = L, this._bindUnboundFramebuffer(L._MSAAFramebuffer ? L._MSAAFramebuffer : L._framebuffer);
+ var de = this._gl;
+ L.is2DArray ? de.framebufferTextureLayer(de.FRAMEBUFFER, de.COLOR_ATTACHMENT0, L._webGLTexture, te, _e) : L.isCube && de.framebufferTexture2D(de.FRAMEBUFFER, de.COLOR_ATTACHMENT0, de.TEXTURE_CUBE_MAP_POSITIVE_X + j, L._webGLTexture, te);
+ var ae = L._depthStencilTexture;
+ if (ae) {
+ var ie = ae._generateStencilBuffer ? de.DEPTH_STENCIL_ATTACHMENT : de.DEPTH_ATTACHMENT;
+ L.is2DArray ? de.framebufferTextureLayer(de.FRAMEBUFFER, ie, ae._webGLTexture, te, _e) : L.isCube ? de.framebufferTexture2D(de.FRAMEBUFFER, ie, de.TEXTURE_CUBE_MAP_POSITIVE_X + j, ae._webGLTexture, te) : de.framebufferTexture2D(de.FRAMEBUFFER, ie, de.TEXTURE_2D, ae._webGLTexture, te);
+ }
+ this._cachedViewport && !oe ? this.setViewport(this._cachedViewport, W, Y) : (W || (W = L.width, te && (W /= Math.pow(2, te))), Y || (Y = L.height, te && (Y /= Math.pow(2, te))), this._viewport(0, 0, W, Y)), this.wipeCaches();
+ }, B.prototype._bindUnboundFramebuffer = function(L) {
+ this._currentFramebuffer !== L && (this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, L), this._currentFramebuffer = L);
+ }, B.prototype.unBindFramebuffer = function(L, j, W) {
+ j === void 0 && (j = !1), this._currentRenderTarget = null;
+ var Y = this._gl;
+ if (L._MSAAFramebuffer) {
+ if (L._textureArray)
+ return void this.unBindMultiColorAttachmentFramebuffer(L._textureArray, j, W);
+ Y.bindFramebuffer(Y.READ_FRAMEBUFFER, L._MSAAFramebuffer), Y.bindFramebuffer(Y.DRAW_FRAMEBUFFER, L._framebuffer), Y.blitFramebuffer(0, 0, L.width, L.height, 0, 0, L.width, L.height, Y.COLOR_BUFFER_BIT, Y.NEAREST);
+ }
+ !L.generateMipMaps || j || L.isCube || (this._bindTextureDirectly(Y.TEXTURE_2D, L, !0), Y.generateMipmap(Y.TEXTURE_2D), this._bindTextureDirectly(Y.TEXTURE_2D, null)), W && (L._MSAAFramebuffer && this._bindUnboundFramebuffer(L._framebuffer), W()), this._bindUnboundFramebuffer(null);
+ }, B.prototype.flushFramebuffer = function() {
+ this._gl.flush();
+ }, B.prototype.restoreDefaultFramebuffer = function() {
+ this._currentRenderTarget ? this.unBindFramebuffer(this._currentRenderTarget) : this._bindUnboundFramebuffer(null), this._cachedViewport && this.setViewport(this._cachedViewport), this.wipeCaches();
+ }, B.prototype._resetVertexBufferBinding = function() {
+ this.bindArrayBuffer(null), this._cachedVertexBuffers = null;
+ }, B.prototype.createVertexBuffer = function(L) {
+ return this._createVertexBuffer(L, this._gl.STATIC_DRAW);
+ }, B.prototype._createVertexBuffer = function(L, j) {
+ var W = this._gl.createBuffer();
+ if (!W)
+ throw new Error("Unable to create vertex buffer");
+ var Y = new h.a(W);
+ return this.bindArrayBuffer(Y), L instanceof Array ? this._gl.bufferData(this._gl.ARRAY_BUFFER, new Float32Array(L), this._gl.STATIC_DRAW) : this._gl.bufferData(this._gl.ARRAY_BUFFER, L, this._gl.STATIC_DRAW), this._resetVertexBufferBinding(), Y.references = 1, Y;
+ }, B.prototype.createDynamicVertexBuffer = function(L) {
+ return this._createVertexBuffer(L, this._gl.DYNAMIC_DRAW);
+ }, B.prototype._resetIndexBufferBinding = function() {
+ this.bindIndexBuffer(null), this._cachedIndexBuffer = null;
+ }, B.prototype.createIndexBuffer = function(L, j) {
+ var W = this._gl.createBuffer(), Y = new h.a(W);
+ if (!W)
+ throw new Error("Unable to create index buffer");
+ this.bindIndexBuffer(Y);
+ var oe = this._normalizeIndexData(L);
+ return this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, oe, j ? this._gl.DYNAMIC_DRAW : this._gl.STATIC_DRAW), this._resetIndexBufferBinding(), Y.references = 1, Y.is32Bits = oe.BYTES_PER_ELEMENT === 4, Y;
+ }, B.prototype._normalizeIndexData = function(L) {
+ if (L instanceof Uint16Array)
+ return L;
+ if (this._caps.uintIndices) {
+ if (L instanceof Uint32Array)
+ return L;
+ for (var j = 0; j < L.length; j++)
+ if (L[j] >= 65535)
+ return new Uint32Array(L);
+ return new Uint16Array(L);
+ }
+ return new Uint16Array(L);
+ }, B.prototype.bindArrayBuffer = function(L) {
+ this._vaoRecordInProgress || this._unbindVertexArrayObject(), this.bindBuffer(L, this._gl.ARRAY_BUFFER);
+ }, B.prototype.bindUniformBlock = function(L, j, W) {
+ var Y = L.program, oe = this._gl.getUniformBlockIndex(Y, j);
+ this._gl.uniformBlockBinding(Y, oe, W);
+ }, B.prototype.bindIndexBuffer = function(L) {
+ this._vaoRecordInProgress || this._unbindVertexArrayObject(), this.bindBuffer(L, this._gl.ELEMENT_ARRAY_BUFFER);
+ }, B.prototype.bindBuffer = function(L, j) {
+ (this._vaoRecordInProgress || this._currentBoundBuffer[j] !== L) && (this._gl.bindBuffer(j, L ? L.underlyingResource : null), this._currentBoundBuffer[j] = L);
+ }, B.prototype.updateArrayBuffer = function(L) {
+ this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, L);
+ }, B.prototype._vertexAttribPointer = function(L, j, W, Y, oe, te, _e) {
+ var de = this._currentBufferPointers[j];
+ if (de) {
+ var ae = !1;
+ de.active ? (de.buffer !== L && (de.buffer = L, ae = !0), de.size !== W && (de.size = W, ae = !0), de.type !== Y && (de.type = Y, ae = !0), de.normalized !== oe && (de.normalized = oe, ae = !0), de.stride !== te && (de.stride = te, ae = !0), de.offset !== _e && (de.offset = _e, ae = !0)) : (ae = !0, de.active = !0, de.index = j, de.size = W, de.type = Y, de.normalized = oe, de.stride = te, de.offset = _e, de.buffer = L), (ae || this._vaoRecordInProgress) && (this.bindArrayBuffer(L), this._gl.vertexAttribPointer(j, W, Y, oe, te, _e));
+ }
+ }, B.prototype._bindIndexBufferWithCache = function(L) {
+ L != null && this._cachedIndexBuffer !== L && (this._cachedIndexBuffer = L, this.bindIndexBuffer(L), this._uintIndicesCurrentlySet = L.is32Bits);
+ }, B.prototype._bindVertexBuffersAttributes = function(L, j) {
+ var W = j.getAttributesNames();
+ this._vaoRecordInProgress || this._unbindVertexArrayObject(), this.unbindAllAttributes();
+ for (var Y = 0; Y < W.length; Y++) {
+ var oe = j.getAttributeLocation(Y);
+ if (oe >= 0) {
+ var te = L[W[Y]];
+ if (!te)
+ continue;
+ this._gl.enableVertexAttribArray(oe), this._vaoRecordInProgress || (this._vertexAttribArraysEnabled[oe] = !0);
+ var _e = te.getBuffer();
+ _e && (this._vertexAttribPointer(_e, oe, te.getSize(), te.type, te.normalized, te.byteStride, te.byteOffset), te.getIsInstanced() && (this._gl.vertexAttribDivisor(oe, te.getInstanceDivisor()), this._vaoRecordInProgress || (this._currentInstanceLocations.push(oe), this._currentInstanceBuffers.push(_e))));
+ }
+ }
+ }, B.prototype.recordVertexArrayObject = function(L, j, W) {
+ var Y = this._gl.createVertexArray();
+ return this._vaoRecordInProgress = !0, this._gl.bindVertexArray(Y), this._mustWipeVertexAttributes = !0, this._bindVertexBuffersAttributes(L, W), this.bindIndexBuffer(j), this._vaoRecordInProgress = !1, this._gl.bindVertexArray(null), Y;
+ }, B.prototype.bindVertexArrayObject = function(L, j) {
+ this._cachedVertexArrayObject !== L && (this._cachedVertexArrayObject = L, this._gl.bindVertexArray(L), this._cachedVertexBuffers = null, this._cachedIndexBuffer = null, this._uintIndicesCurrentlySet = j != null && j.is32Bits, this._mustWipeVertexAttributes = !0);
+ }, B.prototype.bindBuffersDirectly = function(L, j, W, Y, oe) {
+ if (this._cachedVertexBuffers !== L || this._cachedEffectForVertexBuffers !== oe) {
+ this._cachedVertexBuffers = L, this._cachedEffectForVertexBuffers = oe;
+ var te = oe.getAttributesCount();
+ this._unbindVertexArrayObject(), this.unbindAllAttributes();
+ for (var _e = 0, de = 0; de < te; de++)
+ if (de < W.length) {
+ var ae = oe.getAttributeLocation(de);
+ ae >= 0 && (this._gl.enableVertexAttribArray(ae), this._vertexAttribArraysEnabled[ae] = !0, this._vertexAttribPointer(L, ae, W[de], this._gl.FLOAT, !1, Y, _e)), _e += 4 * W[de];
+ }
+ }
+ this._bindIndexBufferWithCache(j);
+ }, B.prototype._unbindVertexArrayObject = function() {
+ this._cachedVertexArrayObject && (this._cachedVertexArrayObject = null, this._gl.bindVertexArray(null));
+ }, B.prototype.bindBuffers = function(L, j, W) {
+ this._cachedVertexBuffers === L && this._cachedEffectForVertexBuffers === W || (this._cachedVertexBuffers = L, this._cachedEffectForVertexBuffers = W, this._bindVertexBuffersAttributes(L, W)), this._bindIndexBufferWithCache(j);
+ }, B.prototype.unbindInstanceAttributes = function() {
+ for (var L, j = 0, W = this._currentInstanceLocations.length; j < W; j++) {
+ var Y = this._currentInstanceBuffers[j];
+ L != Y && Y.references && (L = Y, this.bindArrayBuffer(Y));
+ var oe = this._currentInstanceLocations[j];
+ this._gl.vertexAttribDivisor(oe, 0);
+ }
+ this._currentInstanceBuffers.length = 0, this._currentInstanceLocations.length = 0;
+ }, B.prototype.releaseVertexArrayObject = function(L) {
+ this._gl.deleteVertexArray(L);
+ }, B.prototype._releaseBuffer = function(L) {
+ return L.references--, L.references === 0 && (this._deleteBuffer(L), !0);
+ }, B.prototype._deleteBuffer = function(L) {
+ this._gl.deleteBuffer(L.underlyingResource);
+ }, B.prototype.updateAndBindInstancesBuffer = function(L, j, W) {
+ if (this.bindArrayBuffer(L), j && this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, j), W[0].index !== void 0)
+ this.bindInstancesBuffer(L, W, !0);
+ else
+ for (var Y = 0; Y < 4; Y++) {
+ var oe = W[Y];
+ this._vertexAttribArraysEnabled[oe] || (this._gl.enableVertexAttribArray(oe), this._vertexAttribArraysEnabled[oe] = !0), this._vertexAttribPointer(L, oe, 4, this._gl.FLOAT, !1, 64, 16 * Y), this._gl.vertexAttribDivisor(oe, 1), this._currentInstanceLocations.push(oe), this._currentInstanceBuffers.push(L);
+ }
+ }, B.prototype.bindInstancesBuffer = function(L, j, W) {
+ W === void 0 && (W = !0), this.bindArrayBuffer(L);
+ var Y = 0;
+ if (W)
+ for (var oe = 0; oe < j.length; oe++)
+ Y += 4 * (te = j[oe]).attributeSize;
+ for (oe = 0; oe < j.length; oe++) {
+ var te;
+ (te = j[oe]).index === void 0 && (te.index = this._currentEffect.getAttributeLocationByName(te.attributeName)), te.index < 0 || (this._vertexAttribArraysEnabled[te.index] || (this._gl.enableVertexAttribArray(te.index), this._vertexAttribArraysEnabled[te.index] = !0), this._vertexAttribPointer(L, te.index, te.attributeSize, te.attributeType || this._gl.FLOAT, te.normalized || !1, Y, te.offset), this._gl.vertexAttribDivisor(te.index, te.divisor === void 0 ? 1 : te.divisor), this._currentInstanceLocations.push(te.index), this._currentInstanceBuffers.push(L));
+ }
+ }, B.prototype.disableInstanceAttributeByName = function(L) {
+ if (this._currentEffect) {
+ var j = this._currentEffect.getAttributeLocationByName(L);
+ this.disableInstanceAttribute(j);
+ }
+ }, B.prototype.disableInstanceAttribute = function(L) {
+ for (var j, W = !1; (j = this._currentInstanceLocations.indexOf(L)) !== -1; )
+ this._currentInstanceLocations.splice(j, 1), this._currentInstanceBuffers.splice(j, 1), W = !0, j = this._currentInstanceLocations.indexOf(L);
+ W && (this._gl.vertexAttribDivisor(L, 0), this.disableAttributeByIndex(L));
+ }, B.prototype.disableAttributeByIndex = function(L) {
+ this._gl.disableVertexAttribArray(L), this._vertexAttribArraysEnabled[L] = !1, this._currentBufferPointers[L].active = !1;
+ }, B.prototype.draw = function(L, j, W, Y) {
+ this.drawElementsType(L ? g.a.MATERIAL_TriangleFillMode : g.a.MATERIAL_WireFrameFillMode, j, W, Y);
+ }, B.prototype.drawPointClouds = function(L, j, W) {
+ this.drawArraysType(g.a.MATERIAL_PointFillMode, L, j, W);
+ }, B.prototype.drawUnIndexed = function(L, j, W, Y) {
+ this.drawArraysType(L ? g.a.MATERIAL_TriangleFillMode : g.a.MATERIAL_WireFrameFillMode, j, W, Y);
+ }, B.prototype.drawElementsType = function(L, j, W, Y) {
+ this.applyStates(), this._reportDrawCall();
+ var oe = this._drawMode(L), te = this._uintIndicesCurrentlySet ? this._gl.UNSIGNED_INT : this._gl.UNSIGNED_SHORT, _e = this._uintIndicesCurrentlySet ? 4 : 2;
+ Y ? this._gl.drawElementsInstanced(oe, W, te, j * _e, Y) : this._gl.drawElements(oe, W, te, j * _e);
+ }, B.prototype.drawArraysType = function(L, j, W, Y) {
+ this.applyStates(), this._reportDrawCall();
+ var oe = this._drawMode(L);
+ Y ? this._gl.drawArraysInstanced(oe, j, W, Y) : this._gl.drawArrays(oe, j, W);
+ }, B.prototype._drawMode = function(L) {
+ switch (L) {
+ case g.a.MATERIAL_TriangleFillMode:
+ return this._gl.TRIANGLES;
+ case g.a.MATERIAL_PointFillMode:
+ return this._gl.POINTS;
+ case g.a.MATERIAL_WireFrameFillMode:
+ return this._gl.LINES;
+ case g.a.MATERIAL_PointListDrawMode:
+ return this._gl.POINTS;
+ case g.a.MATERIAL_LineListDrawMode:
+ return this._gl.LINES;
+ case g.a.MATERIAL_LineLoopDrawMode:
+ return this._gl.LINE_LOOP;
+ case g.a.MATERIAL_LineStripDrawMode:
+ return this._gl.LINE_STRIP;
+ case g.a.MATERIAL_TriangleStripDrawMode:
+ return this._gl.TRIANGLE_STRIP;
+ case g.a.MATERIAL_TriangleFanDrawMode:
+ return this._gl.TRIANGLE_FAN;
+ default:
+ return this._gl.TRIANGLES;
+ }
+ }, B.prototype._reportDrawCall = function() {
+ }, B.prototype._releaseEffect = function(L) {
+ this._compiledEffects[L._key] && (delete this._compiledEffects[L._key], this._deletePipelineContext(L.getPipelineContext()));
+ }, B.prototype._deletePipelineContext = function(L) {
+ var j = L;
+ j && j.program && (j.program.__SPECTOR_rebuildProgram = null, this._gl.deleteProgram(j.program));
+ }, B.prototype.createEffect = function(L, j, W, Y, oe, te, _e, de, ae) {
+ var ie = (L.vertexElement || L.vertex || L.vertexToken || L.vertexSource || L) + "+" + (L.fragmentElement || L.fragment || L.fragmentToken || L.fragmentSource || L) + "@" + (oe || j.defines);
+ if (this._compiledEffects[ie]) {
+ var Z = this._compiledEffects[ie];
+ return _e && Z.isReady() && _e(Z), Z;
+ }
+ var ee = new f.a(L, j, W, Y, this, oe, te, _e, de, ae);
+ return ee._key = ie, this._compiledEffects[ie] = ee, ee;
+ }, B._ConcatenateShader = function(L, j, W) {
+ return W === void 0 && (W = ""), W + (j ? j + `
+` : "") + L;
+ }, B.prototype._compileShader = function(L, j, W, Y) {
+ return this._compileRawShader(B._ConcatenateShader(L, W, Y), j);
+ }, B.prototype._compileRawShader = function(L, j) {
+ var W = this._gl, Y = W.createShader(j === "vertex" ? W.VERTEX_SHADER : W.FRAGMENT_SHADER);
+ if (!Y)
+ throw new Error("Something went wrong while compile the shader.");
+ return W.shaderSource(Y, L), W.compileShader(Y), Y;
+ }, B.prototype._getShaderSource = function(L) {
+ return this._gl.getShaderSource(L);
+ }, B.prototype.createRawShaderProgram = function(L, j, W, Y, oe) {
+ oe === void 0 && (oe = null), Y = Y || this._gl;
+ var te = this._compileRawShader(j, "vertex"), _e = this._compileRawShader(W, "fragment");
+ return this._createShaderProgram(L, te, _e, Y, oe);
+ }, B.prototype.createShaderProgram = function(L, j, W, Y, oe, te) {
+ te === void 0 && (te = null), oe = oe || this._gl;
+ var _e = this._webGLVersion > 1 ? `#version 300 es
+#define WEBGL2
+` : "", de = this._compileShader(j, "vertex", Y, _e), ae = this._compileShader(W, "fragment", Y, _e);
+ return this._createShaderProgram(L, de, ae, oe, te);
+ }, B.prototype.createPipelineContext = function() {
+ var L = new d.a();
+ return L.engine = this, this._caps.parallelShaderCompile && (L.isParallelCompiled = !0), L;
+ }, B.prototype._createShaderProgram = function(L, j, W, Y, oe) {
+ var te = Y.createProgram();
+ if (L.program = te, !te)
+ throw new Error("Unable to create program");
+ return Y.attachShader(te, j), Y.attachShader(te, W), Y.linkProgram(te), L.context = Y, L.vertexShader = j, L.fragmentShader = W, L.isParallelCompiled || this._finalizePipelineContext(L), te;
+ }, B.prototype._finalizePipelineContext = function(L) {
+ var j = L.context, W = L.vertexShader, Y = L.fragmentShader, oe = L.program;
+ if (!j.getProgramParameter(oe, j.LINK_STATUS)) {
+ var te, _e;
+ if (!this._gl.getShaderParameter(W, this._gl.COMPILE_STATUS) && (te = this._gl.getShaderInfoLog(W)))
+ throw L.vertexCompilationError = te, new Error("VERTEX SHADER " + te);
+ if (!this._gl.getShaderParameter(Y, this._gl.COMPILE_STATUS) && (te = this._gl.getShaderInfoLog(Y)))
+ throw L.fragmentCompilationError = te, new Error("FRAGMENT SHADER " + te);
+ if (_e = j.getProgramInfoLog(oe))
+ throw L.programLinkError = _e, new Error(_e);
+ }
+ if (this.validateShaderPrograms && (j.validateProgram(oe), !j.getProgramParameter(oe, j.VALIDATE_STATUS) && (_e = j.getProgramInfoLog(oe))))
+ throw L.programValidationError = _e, new Error(_e);
+ j.deleteShader(W), j.deleteShader(Y), L.vertexShader = void 0, L.fragmentShader = void 0, L.onCompiled && (L.onCompiled(), L.onCompiled = void 0);
+ }, B.prototype._preparePipelineContext = function(L, j, W, Y, oe, te, _e) {
+ var de = L;
+ de.program = Y ? this.createRawShaderProgram(de, j, W, void 0, _e) : this.createShaderProgram(de, j, W, te, void 0, _e), de.program.__SPECTOR_rebuildProgram = oe;
+ }, B.prototype._isRenderingStateCompiled = function(L) {
+ var j = L;
+ return !!this._gl.getProgramParameter(j.program, this._caps.parallelShaderCompile.COMPLETION_STATUS_KHR) && (this._finalizePipelineContext(j), !0);
+ }, B.prototype._executeWhenRenderingStateIsCompiled = function(L, j) {
+ var W = L;
+ if (W.isParallelCompiled) {
+ var Y = W.onCompiled;
+ W.onCompiled = Y ? function() {
+ Y(), j();
+ } : j;
+ } else
+ j();
+ }, B.prototype.getUniforms = function(L, j) {
+ for (var W = new Array(), Y = L, oe = 0; oe < j.length; oe++)
+ W.push(this._gl.getUniformLocation(Y.program, j[oe]));
+ return W;
+ }, B.prototype.getAttributes = function(L, j) {
+ for (var W = [], Y = L, oe = 0; oe < j.length; oe++)
+ try {
+ W.push(this._gl.getAttribLocation(Y.program, j[oe]));
+ } catch {
+ W.push(-1);
+ }
+ return W;
+ }, B.prototype.enableEffect = function(L) {
+ L && L !== this._currentEffect && (this.bindSamplers(L), this._currentEffect = L, L.onBind && L.onBind(L), L._onBindObservable && L._onBindObservable.notifyObservers(L));
+ }, B.prototype.setInt = function(L, j) {
+ return !!L && (this._gl.uniform1i(L, j), !0);
+ }, B.prototype.setIntArray = function(L, j) {
+ return !!L && (this._gl.uniform1iv(L, j), !0);
+ }, B.prototype.setIntArray2 = function(L, j) {
+ return !(!L || j.length % 2 != 0) && (this._gl.uniform2iv(L, j), !0);
+ }, B.prototype.setIntArray3 = function(L, j) {
+ return !(!L || j.length % 3 != 0) && (this._gl.uniform3iv(L, j), !0);
+ }, B.prototype.setIntArray4 = function(L, j) {
+ return !(!L || j.length % 4 != 0) && (this._gl.uniform4iv(L, j), !0);
+ }, B.prototype.setArray = function(L, j) {
+ return !!L && (this._gl.uniform1fv(L, j), !0);
+ }, B.prototype.setArray2 = function(L, j) {
+ return !(!L || j.length % 2 != 0) && (this._gl.uniform2fv(L, j), !0);
+ }, B.prototype.setArray3 = function(L, j) {
+ return !(!L || j.length % 3 != 0) && (this._gl.uniform3fv(L, j), !0);
+ }, B.prototype.setArray4 = function(L, j) {
+ return !(!L || j.length % 4 != 0) && (this._gl.uniform4fv(L, j), !0);
+ }, B.prototype.setMatrices = function(L, j) {
+ return !!L && (this._gl.uniformMatrix4fv(L, !1, j), !0);
+ }, B.prototype.setMatrix3x3 = function(L, j) {
+ return !!L && (this._gl.uniformMatrix3fv(L, !1, j), !0);
+ }, B.prototype.setMatrix2x2 = function(L, j) {
+ return !!L && (this._gl.uniformMatrix2fv(L, !1, j), !0);
+ }, B.prototype.setFloat = function(L, j) {
+ return !!L && (this._gl.uniform1f(L, j), !0);
+ }, B.prototype.setFloat2 = function(L, j, W) {
+ return !!L && (this._gl.uniform2f(L, j, W), !0);
+ }, B.prototype.setFloat3 = function(L, j, W, Y) {
+ return !!L && (this._gl.uniform3f(L, j, W, Y), !0);
+ }, B.prototype.setFloat4 = function(L, j, W, Y, oe) {
+ return !!L && (this._gl.uniform4f(L, j, W, Y, oe), !0);
+ }, B.prototype.applyStates = function() {
+ if (this._depthCullingState.apply(this._gl), this._stencilState.apply(this._gl), this._alphaState.apply(this._gl), this._colorWriteChanged) {
+ this._colorWriteChanged = !1;
+ var L = this._colorWrite;
+ this._gl.colorMask(L, L, L, L);
+ }
+ }, B.prototype.setColorWrite = function(L) {
+ L !== this._colorWrite && (this._colorWriteChanged = !0, this._colorWrite = L);
+ }, B.prototype.getColorWrite = function() {
+ return this._colorWrite;
+ }, Object.defineProperty(B.prototype, "depthCullingState", { get: function() {
+ return this._depthCullingState;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(B.prototype, "alphaState", { get: function() {
+ return this._alphaState;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(B.prototype, "stencilState", { get: function() {
+ return this._stencilState;
+ }, enumerable: !1, configurable: !0 }), B.prototype.clearInternalTexturesCache = function() {
+ this._internalTexturesCache = [];
+ }, B.prototype.wipeCaches = function(L) {
+ this.preventCacheWipeBetweenFrames && !L || (this._currentEffect = null, this._viewportCached.x = 0, this._viewportCached.y = 0, this._viewportCached.z = 0, this._viewportCached.w = 0, this._unbindVertexArrayObject(), L && (this._currentProgram = null, this.resetTextureCache(), this._stencilState.reset(), this._depthCullingState.reset(), this._depthCullingState.depthFunc = this._gl.LEQUAL, this._alphaState.reset(), this._alphaMode = g.a.ALPHA_ADD, this._alphaEquation = g.a.ALPHA_DISABLE, this._colorWrite = !0, this._colorWriteChanged = !0, this._unpackFlipYCached = null, this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE), this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0), this._mustWipeVertexAttributes = !0, this.unbindAllAttributes()), this._resetVertexBufferBinding(), this._cachedIndexBuffer = null, this._cachedEffectForVertexBuffers = null, this.bindIndexBuffer(null));
+ }, B.prototype._getSamplingParameters = function(L, j) {
+ var W = this._gl, Y = W.NEAREST, oe = W.NEAREST;
+ switch (L) {
+ case g.a.TEXTURE_LINEAR_LINEAR_MIPNEAREST:
+ Y = W.LINEAR, oe = j ? W.LINEAR_MIPMAP_NEAREST : W.LINEAR;
+ break;
+ case g.a.TEXTURE_LINEAR_LINEAR_MIPLINEAR:
+ Y = W.LINEAR, oe = j ? W.LINEAR_MIPMAP_LINEAR : W.LINEAR;
+ break;
+ case g.a.TEXTURE_NEAREST_NEAREST_MIPLINEAR:
+ Y = W.NEAREST, oe = j ? W.NEAREST_MIPMAP_LINEAR : W.NEAREST;
+ break;
+ case g.a.TEXTURE_NEAREST_NEAREST_MIPNEAREST:
+ Y = W.NEAREST, oe = j ? W.NEAREST_MIPMAP_NEAREST : W.NEAREST;
+ break;
+ case g.a.TEXTURE_NEAREST_LINEAR_MIPNEAREST:
+ Y = W.NEAREST, oe = j ? W.LINEAR_MIPMAP_NEAREST : W.LINEAR;
+ break;
+ case g.a.TEXTURE_NEAREST_LINEAR_MIPLINEAR:
+ Y = W.NEAREST, oe = j ? W.LINEAR_MIPMAP_LINEAR : W.LINEAR;
+ break;
+ case g.a.TEXTURE_NEAREST_LINEAR:
+ Y = W.NEAREST, oe = W.LINEAR;
+ break;
+ case g.a.TEXTURE_NEAREST_NEAREST:
+ Y = W.NEAREST, oe = W.NEAREST;
+ break;
+ case g.a.TEXTURE_LINEAR_NEAREST_MIPNEAREST:
+ Y = W.LINEAR, oe = j ? W.NEAREST_MIPMAP_NEAREST : W.NEAREST;
+ break;
+ case g.a.TEXTURE_LINEAR_NEAREST_MIPLINEAR:
+ Y = W.LINEAR, oe = j ? W.NEAREST_MIPMAP_LINEAR : W.NEAREST;
+ break;
+ case g.a.TEXTURE_LINEAR_LINEAR:
+ Y = W.LINEAR, oe = W.LINEAR;
+ break;
+ case g.a.TEXTURE_LINEAR_NEAREST:
+ Y = W.LINEAR, oe = W.NEAREST;
+ }
+ return { min: oe, mag: Y };
+ }, B.prototype._createTexture = function() {
+ var L = this._gl.createTexture();
+ if (!L)
+ throw new Error("Unable to create texture");
+ return L;
+ }, B.prototype.createTexture = function(L, j, W, Y, oe, te, _e, de, ae, ie, Z, ee, w) {
+ var z = this;
+ oe === void 0 && (oe = g.a.TEXTURE_TRILINEAR_SAMPLINGMODE), te === void 0 && (te = null), _e === void 0 && (_e = null), de === void 0 && (de = null), ae === void 0 && (ae = null), ie === void 0 && (ie = null), Z === void 0 && (Z = null);
+ var q = (L = L || "").substr(0, 5) === "data:", le = L.substr(0, 5) === "blob:", ce = q && L.indexOf(";base64,") !== -1, J = ae || new u.a(this, u.b.Url), H = L;
+ !this._transformTextureUrl || ce || ae || de || (L = this._transformTextureUrl(L)), H !== L && (J._originalUrl = H);
+ var X = L.lastIndexOf("."), ne = Z || (X > -1 ? L.substring(X).toLowerCase() : ""), Q = null;
+ ne.indexOf("?") > -1 && (ne = ne.split("?")[0]);
+ for (var $ = 0, me = B._TextureLoaders; $ < me.length; $++) {
+ var ye = me[$];
+ if (ye.canLoad(ne, ee)) {
+ Q = ye;
+ break;
+ }
+ }
+ Y && Y._addPendingData(J), J.url = L, J.generateMipMaps = !j, J.samplingMode = oe, J.invertY = W, this._doNotHandleContextLost || (J._buffer = de);
+ var be = null;
+ te && !ae && (be = J.onLoadedObservable.add(te)), ae || this._internalTexturesCache.push(J);
+ var ge = function(Se, Ne) {
+ Y && Y._removePendingData(J), L === H ? (be && J.onLoadedObservable.remove(be), D.a.UseFallbackTexture && z.createTexture(D.a.FallbackTexture, j, J.invertY, Y, oe, null, _e, de, J), _e && _e((Se || "Unknown error") + (D.a.UseFallbackTexture ? " - Fallback texture was used" : ""), Ne)) : (E.a.Warn("Failed to load " + L + ", falling back to " + H), z.createTexture(H, j, J.invertY, Y, oe, te, _e, de, J, ie, Z, ee, w));
+ };
+ if (Q) {
+ var Te = function(Se) {
+ Q.loadData(Se, J, function(Ne, ze, Ye, He, Xe, Ze) {
+ Ze ? ge("TextureLoader failed to load data") : z._prepareWebGLTexture(J, Y, Ne, ze, J.invertY, !Ye, He, function() {
+ return Xe(), !1;
+ }, oe);
+ }, w);
+ };
+ de ? de instanceof ArrayBuffer ? Te(new Uint8Array(de)) : ArrayBuffer.isView(de) ? Te(de) : _e && _e("Unable to load: only ArrayBuffer or ArrayBufferView is supported", null) : this._loadFile(L, function(Se) {
+ return Te(new Uint8Array(Se));
+ }, void 0, Y ? Y.offlineProvider : void 0, !0, function(Se, Ne) {
+ ge("Unable to load " + (Se && Se.responseURL, Ne));
+ });
+ } else {
+ var Re = function(Se) {
+ le && !z._doNotHandleContextLost && (J._buffer = Se), z._prepareWebGLTexture(J, Y, Se.width, Se.height, J.invertY, j, !1, function(Ne, ze, Ye) {
+ var He = z._gl, Xe = Se.width === Ne && Se.height === ze, Ze = ie ? z._getInternalFormat(ie) : ne === ".jpg" ? He.RGB : He.RGBA;
+ if (Xe)
+ return He.texImage2D(He.TEXTURE_2D, 0, Ze, Ze, He.UNSIGNED_BYTE, Se), !1;
+ var je = z._caps.maxTextureSize;
+ if (Se.width > je || Se.height > je || !z._supportsHardwareTextureRescaling)
+ return z._prepareWorkingCanvas(), !(!z._workingCanvas || !z._workingContext) && (z._workingCanvas.width = Ne, z._workingCanvas.height = ze, z._workingContext.drawImage(Se, 0, 0, Se.width, Se.height, 0, 0, Ne, ze), He.texImage2D(He.TEXTURE_2D, 0, Ze, Ze, He.UNSIGNED_BYTE, z._workingCanvas), J.width = Ne, J.height = ze, !1);
+ var it = new u.a(z, u.b.Temp);
+ return z._bindTextureDirectly(He.TEXTURE_2D, it, !0), He.texImage2D(He.TEXTURE_2D, 0, Ze, Ze, He.UNSIGNED_BYTE, Se), z._rescaleTexture(it, J, Y, Ze, function() {
+ z._releaseTexture(it), z._bindTextureDirectly(He.TEXTURE_2D, J, !0), Ye();
+ }), !0;
+ }, oe);
+ };
+ !q || ce ? de && (de.decoding || de.close) ? Re(de) : B._FileToolsLoadImage(L, Re, ge, Y ? Y.offlineProvider : null, ee) : typeof de == "string" || de instanceof ArrayBuffer || ArrayBuffer.isView(de) || de instanceof Blob ? B._FileToolsLoadImage(de, Re, ge, Y ? Y.offlineProvider : null, ee) : de && Re(de);
+ }
+ return J;
+ }, B._FileToolsLoadImage = function(L, j, W, Y, oe) {
+ throw P.a.WarnImport("FileTools");
+ }, B.prototype._rescaleTexture = function(L, j, W, Y, oe) {
+ }, B.prototype.createRawTexture = function(L, j, W, Y, oe, te, _e, de, ae) {
+ throw ae === void 0 && (ae = g.a.TEXTURETYPE_UNSIGNED_INT), P.a.WarnImport("Engine.RawTexture");
+ }, B.prototype.createRawCubeTexture = function(L, j, W, Y, oe, te, _e, de) {
+ throw P.a.WarnImport("Engine.RawTexture");
+ }, B.prototype.createRawTexture3D = function(L, j, W, Y, oe, te, _e, de, ae, ie) {
+ throw ie === void 0 && (ie = g.a.TEXTURETYPE_UNSIGNED_INT), P.a.WarnImport("Engine.RawTexture");
+ }, B.prototype.createRawTexture2DArray = function(L, j, W, Y, oe, te, _e, de, ae, ie) {
+ throw ie === void 0 && (ie = g.a.TEXTURETYPE_UNSIGNED_INT), P.a.WarnImport("Engine.RawTexture");
+ }, B.prototype._unpackFlipY = function(L) {
+ this._unpackFlipYCached !== L && (this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, L ? 1 : 0), this.enableUnpackFlipYCached && (this._unpackFlipYCached = L));
+ }, B.prototype._getUnpackAlignement = function() {
+ return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT);
+ }, B.prototype._getTextureTarget = function(L) {
+ return L.isCube ? this._gl.TEXTURE_CUBE_MAP : L.is3D ? this._gl.TEXTURE_3D : L.is2DArray || L.isMultiview ? this._gl.TEXTURE_2D_ARRAY : this._gl.TEXTURE_2D;
+ }, B.prototype.updateTextureSamplingMode = function(L, j, W) {
+ W === void 0 && (W = !1);
+ var Y = this._getTextureTarget(j), oe = this._getSamplingParameters(L, j.generateMipMaps || W);
+ this._setTextureParameterInteger(Y, this._gl.TEXTURE_MAG_FILTER, oe.mag, j), this._setTextureParameterInteger(Y, this._gl.TEXTURE_MIN_FILTER, oe.min), W && (j.generateMipMaps = !0, this._gl.generateMipmap(Y)), this._bindTextureDirectly(Y, null), j.samplingMode = L;
+ }, B.prototype.updateTextureWrappingMode = function(L, j, W, Y) {
+ W === void 0 && (W = null), Y === void 0 && (Y = null);
+ var oe = this._getTextureTarget(L);
+ j !== null && (this._setTextureParameterInteger(oe, this._gl.TEXTURE_WRAP_S, this._getTextureWrapMode(j), L), L._cachedWrapU = j), W !== null && (this._setTextureParameterInteger(oe, this._gl.TEXTURE_WRAP_T, this._getTextureWrapMode(W), L), L._cachedWrapV = W), (L.is2DArray || L.is3D) && Y !== null && (this._setTextureParameterInteger(oe, this._gl.TEXTURE_WRAP_R, this._getTextureWrapMode(Y), L), L._cachedWrapR = Y), this._bindTextureDirectly(oe, null);
+ }, B.prototype._setupDepthStencilTexture = function(L, j, W, Y, oe) {
+ var te = j.width || j, _e = j.height || j, de = j.layers || 0;
+ L.baseWidth = te, L.baseHeight = _e, L.width = te, L.height = _e, L.is2DArray = de > 0, L.depth = de, L.isReady = !0, L.samples = 1, L.generateMipMaps = !1, L._generateDepthBuffer = !0, L._generateStencilBuffer = W, L.samplingMode = Y ? g.a.TEXTURE_BILINEAR_SAMPLINGMODE : g.a.TEXTURE_NEAREST_SAMPLINGMODE, L.type = g.a.TEXTURETYPE_UNSIGNED_INT, L._comparisonFunction = oe;
+ var ae = this._gl, ie = this._getTextureTarget(L), Z = this._getSamplingParameters(L.samplingMode, !1);
+ ae.texParameteri(ie, ae.TEXTURE_MAG_FILTER, Z.mag), ae.texParameteri(ie, ae.TEXTURE_MIN_FILTER, Z.min), ae.texParameteri(ie, ae.TEXTURE_WRAP_S, ae.CLAMP_TO_EDGE), ae.texParameteri(ie, ae.TEXTURE_WRAP_T, ae.CLAMP_TO_EDGE), oe === 0 ? (ae.texParameteri(ie, ae.TEXTURE_COMPARE_FUNC, g.a.LEQUAL), ae.texParameteri(ie, ae.TEXTURE_COMPARE_MODE, ae.NONE)) : (ae.texParameteri(ie, ae.TEXTURE_COMPARE_FUNC, oe), ae.texParameteri(ie, ae.TEXTURE_COMPARE_MODE, ae.COMPARE_REF_TO_TEXTURE));
+ }, B.prototype._uploadCompressedDataToTextureDirectly = function(L, j, W, Y, oe, te, _e) {
+ te === void 0 && (te = 0), _e === void 0 && (_e = 0);
+ var de = this._gl, ae = de.TEXTURE_2D;
+ L.isCube && (ae = de.TEXTURE_CUBE_MAP_POSITIVE_X + te), this._gl.compressedTexImage2D(ae, _e, j, W, Y, 0, oe);
+ }, B.prototype._uploadDataToTextureDirectly = function(L, j, W, Y, oe, te) {
+ W === void 0 && (W = 0), Y === void 0 && (Y = 0), te === void 0 && (te = !1);
+ var _e = this._gl, de = this._getWebGLTextureType(L.type), ae = this._getInternalFormat(L.format), ie = oe === void 0 ? this._getRGBABufferInternalSizedFormat(L.type, L.format) : this._getInternalFormat(oe);
+ this._unpackFlipY(L.invertY);
+ var Z = _e.TEXTURE_2D;
+ L.isCube && (Z = _e.TEXTURE_CUBE_MAP_POSITIVE_X + W);
+ var ee = Math.round(Math.log(L.width) * Math.LOG2E), w = Math.round(Math.log(L.height) * Math.LOG2E), z = te ? L.width : Math.pow(2, Math.max(ee - Y, 0)), q = te ? L.height : Math.pow(2, Math.max(w - Y, 0));
+ _e.texImage2D(Z, Y, ie, z, q, 0, ae, de, j);
+ }, B.prototype.updateTextureData = function(L, j, W, Y, oe, te, _e, de) {
+ _e === void 0 && (_e = 0), de === void 0 && (de = 0);
+ var ae = this._gl, ie = this._getWebGLTextureType(L.type), Z = this._getInternalFormat(L.format);
+ this._unpackFlipY(L.invertY);
+ var ee = ae.TEXTURE_2D;
+ L.isCube && (ee = ae.TEXTURE_CUBE_MAP_POSITIVE_X + _e), ae.texSubImage2D(ee, de, W, Y, oe, te, Z, ie, j);
+ }, B.prototype._uploadArrayBufferViewToTexture = function(L, j, W, Y) {
+ W === void 0 && (W = 0), Y === void 0 && (Y = 0);
+ var oe = this._gl, te = L.isCube ? oe.TEXTURE_CUBE_MAP : oe.TEXTURE_2D;
+ this._bindTextureDirectly(te, L, !0), this._uploadDataToTextureDirectly(L, j, W, Y), this._bindTextureDirectly(te, null, !0);
+ }, B.prototype._prepareWebGLTextureContinuation = function(L, j, W, Y, oe) {
+ var te = this._gl;
+ if (te) {
+ var _e = this._getSamplingParameters(oe, !W);
+ te.texParameteri(te.TEXTURE_2D, te.TEXTURE_MAG_FILTER, _e.mag), te.texParameteri(te.TEXTURE_2D, te.TEXTURE_MIN_FILTER, _e.min), W || Y || te.generateMipmap(te.TEXTURE_2D), this._bindTextureDirectly(te.TEXTURE_2D, null), j && j._removePendingData(L), L.onLoadedObservable.notifyObservers(L), L.onLoadedObservable.clear();
+ }
+ }, B.prototype._prepareWebGLTexture = function(L, j, W, Y, oe, te, _e, de, ae) {
+ var ie = this;
+ ae === void 0 && (ae = g.a.TEXTURE_TRILINEAR_SAMPLINGMODE);
+ var Z = this.getCaps().maxTextureSize, ee = Math.min(Z, this.needPOTTextures ? B.GetExponentOfTwo(W, Z) : W), w = Math.min(Z, this.needPOTTextures ? B.GetExponentOfTwo(Y, Z) : Y), z = this._gl;
+ z && (L._webGLTexture ? (this._bindTextureDirectly(z.TEXTURE_2D, L, !0), this._unpackFlipY(oe === void 0 || !!oe), L.baseWidth = W, L.baseHeight = Y, L.width = ee, L.height = w, L.isReady = !0, de(ee, w, function() {
+ ie._prepareWebGLTextureContinuation(L, j, te, _e, ae);
+ }) || this._prepareWebGLTextureContinuation(L, j, te, _e, ae)) : j && j._removePendingData(L));
+ }, B.prototype._setupFramebufferDepthAttachments = function(L, j, W, Y, oe) {
+ oe === void 0 && (oe = 1);
+ var te = this._gl;
+ if (L && j)
+ return this._getDepthStencilBuffer(W, Y, oe, te.DEPTH_STENCIL, te.DEPTH24_STENCIL8, te.DEPTH_STENCIL_ATTACHMENT);
+ if (j) {
+ var _e = te.DEPTH_COMPONENT16;
+ return this._webGLVersion > 1 && (_e = te.DEPTH_COMPONENT32F), this._getDepthStencilBuffer(W, Y, oe, _e, _e, te.DEPTH_ATTACHMENT);
+ }
+ return L ? this._getDepthStencilBuffer(W, Y, oe, te.STENCIL_INDEX8, te.STENCIL_INDEX8, te.STENCIL_ATTACHMENT) : null;
+ }, B.prototype._releaseFramebufferObjects = function(L) {
+ var j = this._gl;
+ L._framebuffer && (j.deleteFramebuffer(L._framebuffer), L._framebuffer = null), L._depthStencilBuffer && (j.deleteRenderbuffer(L._depthStencilBuffer), L._depthStencilBuffer = null), L._MSAAFramebuffer && (j.deleteFramebuffer(L._MSAAFramebuffer), L._MSAAFramebuffer = null), L._MSAARenderBuffer && (j.deleteRenderbuffer(L._MSAARenderBuffer), L._MSAARenderBuffer = null);
+ }, B.prototype._releaseTexture = function(L) {
+ this._releaseFramebufferObjects(L), this._deleteTexture(L._webGLTexture), this.unbindAllTextures();
+ var j = this._internalTexturesCache.indexOf(L);
+ j !== -1 && this._internalTexturesCache.splice(j, 1), L._lodTextureHigh && L._lodTextureHigh.dispose(), L._lodTextureMid && L._lodTextureMid.dispose(), L._lodTextureLow && L._lodTextureLow.dispose(), L._irradianceTexture && L._irradianceTexture.dispose();
+ }, B.prototype._deleteTexture = function(L) {
+ this._gl.deleteTexture(L);
+ }, B.prototype._setProgram = function(L) {
+ this._currentProgram !== L && (this._gl.useProgram(L), this._currentProgram = L);
+ }, B.prototype.bindSamplers = function(L) {
+ var j = L.getPipelineContext();
+ this._setProgram(j.program);
+ for (var W = L.getSamplers(), Y = 0; Y < W.length; Y++) {
+ var oe = L.getUniform(W[Y]);
+ oe && (this._boundUniforms[Y] = oe);
+ }
+ this._currentEffect = null;
+ }, B.prototype._activateCurrentTexture = function() {
+ this._currentTextureChannel !== this._activeChannel && (this._gl.activeTexture(this._gl.TEXTURE0 + this._activeChannel), this._currentTextureChannel = this._activeChannel);
+ }, B.prototype._bindTextureDirectly = function(L, j, W, Y) {
+ W === void 0 && (W = !1), Y === void 0 && (Y = !1);
+ var oe = !1, te = j && j._associatedChannel > -1;
+ return W && te && (this._activeChannel = j._associatedChannel), this._boundTexturesCache[this._activeChannel] !== j || Y ? (this._activateCurrentTexture(), j && j.isMultiview ? this._gl.bindTexture(L, j ? j._colorTextureArray : null) : this._gl.bindTexture(L, j ? j._webGLTexture : null), this._boundTexturesCache[this._activeChannel] = j, j && (j._associatedChannel = this._activeChannel)) : W && (oe = !0, this._activateCurrentTexture()), te && !W && this._bindSamplerUniformToChannel(j._associatedChannel, this._activeChannel), oe;
+ }, B.prototype._bindTexture = function(L, j) {
+ if (L !== void 0) {
+ j && (j._associatedChannel = L), this._activeChannel = L;
+ var W = j ? this._getTextureTarget(j) : this._gl.TEXTURE_2D;
+ this._bindTextureDirectly(W, j);
+ }
+ }, B.prototype.unbindAllTextures = function() {
+ for (var L = 0; L < this._maxSimultaneousTextures; L++)
+ this._activeChannel = L, this._bindTextureDirectly(this._gl.TEXTURE_2D, null), this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null), this.webGLVersion > 1 && (this._bindTextureDirectly(this._gl.TEXTURE_3D, null), this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY, null));
+ }, B.prototype.setTexture = function(L, j, W) {
+ L !== void 0 && (j && (this._boundUniforms[L] = j), this._setTexture(L, W));
+ }, B.prototype._bindSamplerUniformToChannel = function(L, j) {
+ var W = this._boundUniforms[L];
+ W && W._currentState !== j && (this._gl.uniform1i(W, j), W._currentState = j);
+ }, B.prototype._getTextureWrapMode = function(L) {
+ switch (L) {
+ case g.a.TEXTURE_WRAP_ADDRESSMODE:
+ return this._gl.REPEAT;
+ case g.a.TEXTURE_CLAMP_ADDRESSMODE:
+ return this._gl.CLAMP_TO_EDGE;
+ case g.a.TEXTURE_MIRROR_ADDRESSMODE:
+ return this._gl.MIRRORED_REPEAT;
+ }
+ return this._gl.REPEAT;
+ }, B.prototype._setTexture = function(L, j, W, Y) {
+ if (W === void 0 && (W = !1), Y === void 0 && (Y = !1), !j)
+ return this._boundTexturesCache[L] != null && (this._activeChannel = L, this._bindTextureDirectly(this._gl.TEXTURE_2D, null), this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null), this.webGLVersion > 1 && (this._bindTextureDirectly(this._gl.TEXTURE_3D, null), this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY, null))), !1;
+ if (j.video)
+ this._activeChannel = L, j.update();
+ else if (j.delayLoadState === g.a.DELAYLOADSTATE_NOTLOADED)
+ return j.delayLoad(), !1;
+ var oe;
+ oe = Y ? j.depthStencilTexture : j.isReady() ? j.getInternalTexture() : j.isCube ? this.emptyCubeTexture : j.is3D ? this.emptyTexture3D : j.is2DArray ? this.emptyTexture2DArray : this.emptyTexture, !W && oe && (oe._associatedChannel = L);
+ var te = !0;
+ this._boundTexturesCache[L] === oe && (W || this._bindSamplerUniformToChannel(oe._associatedChannel, L), te = !1), this._activeChannel = L;
+ var _e = this._getTextureTarget(oe);
+ if (te && this._bindTextureDirectly(_e, oe, W), oe && !oe.isMultiview) {
+ if (oe.isCube && oe._cachedCoordinatesMode !== j.coordinatesMode) {
+ oe._cachedCoordinatesMode = j.coordinatesMode;
+ var de = j.coordinatesMode !== g.a.TEXTURE_CUBIC_MODE && j.coordinatesMode !== g.a.TEXTURE_SKYBOX_MODE ? g.a.TEXTURE_WRAP_ADDRESSMODE : g.a.TEXTURE_CLAMP_ADDRESSMODE;
+ j.wrapU = de, j.wrapV = de;
+ }
+ oe._cachedWrapU !== j.wrapU && (oe._cachedWrapU = j.wrapU, this._setTextureParameterInteger(_e, this._gl.TEXTURE_WRAP_S, this._getTextureWrapMode(j.wrapU), oe)), oe._cachedWrapV !== j.wrapV && (oe._cachedWrapV = j.wrapV, this._setTextureParameterInteger(_e, this._gl.TEXTURE_WRAP_T, this._getTextureWrapMode(j.wrapV), oe)), oe.is3D && oe._cachedWrapR !== j.wrapR && (oe._cachedWrapR = j.wrapR, this._setTextureParameterInteger(_e, this._gl.TEXTURE_WRAP_R, this._getTextureWrapMode(j.wrapR), oe)), this._setAnisotropicLevel(_e, oe, j.anisotropicFilteringLevel);
+ }
+ return !0;
+ }, B.prototype.setTextureArray = function(L, j, W) {
+ if (L !== void 0 && j) {
+ this._textureUnits && this._textureUnits.length === W.length || (this._textureUnits = new Int32Array(W.length));
+ for (var Y = 0; Y < W.length; Y++) {
+ var oe = W[Y].getInternalTexture();
+ oe ? (this._textureUnits[Y] = L + Y, oe._associatedChannel = L + Y) : this._textureUnits[Y] = -1;
+ }
+ this._gl.uniform1iv(j, this._textureUnits);
+ for (var te = 0; te < W.length; te++)
+ this._setTexture(this._textureUnits[te], W[te], !0);
+ }
+ }, B.prototype._setAnisotropicLevel = function(L, j, W) {
+ var Y = this._caps.textureAnisotropicFilterExtension;
+ j.samplingMode !== g.a.TEXTURE_LINEAR_LINEAR_MIPNEAREST && j.samplingMode !== g.a.TEXTURE_LINEAR_LINEAR_MIPLINEAR && j.samplingMode !== g.a.TEXTURE_LINEAR_LINEAR && (W = 1), Y && j._cachedAnisotropicFilteringLevel !== W && (this._setTextureParameterFloat(L, Y.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(W, this._caps.maxAnisotropy), j), j._cachedAnisotropicFilteringLevel = W);
+ }, B.prototype._setTextureParameterFloat = function(L, j, W, Y) {
+ this._bindTextureDirectly(L, Y, !0, !0), this._gl.texParameterf(L, j, W);
+ }, B.prototype._setTextureParameterInteger = function(L, j, W, Y) {
+ Y && this._bindTextureDirectly(L, Y, !0, !0), this._gl.texParameteri(L, j, W);
+ }, B.prototype.unbindAllAttributes = function() {
+ if (this._mustWipeVertexAttributes) {
+ this._mustWipeVertexAttributes = !1;
+ for (var L = 0; L < this._caps.maxVertexAttribs; L++)
+ this.disableAttributeByIndex(L);
+ } else {
+ L = 0;
+ for (var j = this._vertexAttribArraysEnabled.length; L < j; L++)
+ L >= this._caps.maxVertexAttribs || !this._vertexAttribArraysEnabled[L] || this.disableAttributeByIndex(L);
+ }
+ }, B.prototype.releaseEffects = function() {
+ for (var L in this._compiledEffects) {
+ var j = this._compiledEffects[L].getPipelineContext();
+ this._deletePipelineContext(j);
+ }
+ this._compiledEffects = {};
+ }, B.prototype.dispose = function() {
+ this.stopRenderLoop(), this.onBeforeTextureInitObservable && this.onBeforeTextureInitObservable.clear(), this._emptyTexture && (this._releaseTexture(this._emptyTexture), this._emptyTexture = null), this._emptyCubeTexture && (this._releaseTexture(this._emptyCubeTexture), this._emptyCubeTexture = null), this._dummyFramebuffer && this._gl.deleteFramebuffer(this._dummyFramebuffer), this.releaseEffects(), this.unbindAllAttributes(), this._boundUniforms = [], A.a.IsWindowObjectExist() && this._renderingCanvas && (this._doNotHandleContextLost || (this._renderingCanvas.removeEventListener("webglcontextlost", this._onContextLost), this._renderingCanvas.removeEventListener("webglcontextrestored", this._onContextRestored))), this._workingCanvas = null, this._workingContext = null, this._currentBufferPointers = [], this._renderingCanvas = null, this._currentProgram = null, this._boundRenderFunction = null, f.a.ResetCache();
+ for (var L = 0, j = this._activeRequests; L < j.length; L++)
+ j[L].abort();
+ }, B.prototype.attachContextLostEvent = function(L) {
+ this._renderingCanvas && this._renderingCanvas.addEventListener("webglcontextlost", L, !1);
+ }, B.prototype.attachContextRestoredEvent = function(L) {
+ this._renderingCanvas && this._renderingCanvas.addEventListener("webglcontextrestored", L, !1);
+ }, B.prototype.getError = function() {
+ return this._gl.getError();
+ }, B.prototype._canRenderToFloatFramebuffer = function() {
+ return this._webGLVersion > 1 ? this._caps.colorBufferFloat : this._canRenderToFramebuffer(g.a.TEXTURETYPE_FLOAT);
+ }, B.prototype._canRenderToHalfFloatFramebuffer = function() {
+ return this._webGLVersion > 1 ? this._caps.colorBufferFloat : this._canRenderToFramebuffer(g.a.TEXTURETYPE_HALF_FLOAT);
+ }, B.prototype._canRenderToFramebuffer = function(L) {
+ for (var j = this._gl; j.getError() !== j.NO_ERROR; )
+ ;
+ var W = !0, Y = j.createTexture();
+ j.bindTexture(j.TEXTURE_2D, Y), j.texImage2D(j.TEXTURE_2D, 0, this._getRGBABufferInternalSizedFormat(L), 1, 1, 0, j.RGBA, this._getWebGLTextureType(L), null), j.texParameteri(j.TEXTURE_2D, j.TEXTURE_MIN_FILTER, j.NEAREST), j.texParameteri(j.TEXTURE_2D, j.TEXTURE_MAG_FILTER, j.NEAREST);
+ var oe = j.createFramebuffer();
+ j.bindFramebuffer(j.FRAMEBUFFER, oe), j.framebufferTexture2D(j.FRAMEBUFFER, j.COLOR_ATTACHMENT0, j.TEXTURE_2D, Y, 0);
+ var te = j.checkFramebufferStatus(j.FRAMEBUFFER);
+ if ((W = (W = W && te === j.FRAMEBUFFER_COMPLETE) && j.getError() === j.NO_ERROR) && (j.clear(j.COLOR_BUFFER_BIT), W = W && j.getError() === j.NO_ERROR), W) {
+ j.bindFramebuffer(j.FRAMEBUFFER, null);
+ var _e = j.RGBA, de = j.UNSIGNED_BYTE, ae = new Uint8Array(4);
+ j.readPixels(0, 0, 1, 1, _e, de, ae), W = W && j.getError() === j.NO_ERROR;
+ }
+ for (j.deleteTexture(Y), j.deleteFramebuffer(oe), j.bindFramebuffer(j.FRAMEBUFFER, null); !W && j.getError() !== j.NO_ERROR; )
+ ;
+ return W;
+ }, B.prototype._getWebGLTextureType = function(L) {
+ if (this._webGLVersion === 1) {
+ switch (L) {
+ case g.a.TEXTURETYPE_FLOAT:
+ return this._gl.FLOAT;
+ case g.a.TEXTURETYPE_HALF_FLOAT:
+ return this._gl.HALF_FLOAT_OES;
+ case g.a.TEXTURETYPE_UNSIGNED_BYTE:
+ return this._gl.UNSIGNED_BYTE;
+ case g.a.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:
+ return this._gl.UNSIGNED_SHORT_4_4_4_4;
+ case g.a.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:
+ return this._gl.UNSIGNED_SHORT_5_5_5_1;
+ case g.a.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:
+ return this._gl.UNSIGNED_SHORT_5_6_5;
+ }
+ return this._gl.UNSIGNED_BYTE;
+ }
+ switch (L) {
+ case g.a.TEXTURETYPE_BYTE:
+ return this._gl.BYTE;
+ case g.a.TEXTURETYPE_UNSIGNED_BYTE:
+ return this._gl.UNSIGNED_BYTE;
+ case g.a.TEXTURETYPE_SHORT:
+ return this._gl.SHORT;
+ case g.a.TEXTURETYPE_UNSIGNED_SHORT:
+ return this._gl.UNSIGNED_SHORT;
+ case g.a.TEXTURETYPE_INT:
+ return this._gl.INT;
+ case g.a.TEXTURETYPE_UNSIGNED_INTEGER:
+ return this._gl.UNSIGNED_INT;
+ case g.a.TEXTURETYPE_FLOAT:
+ return this._gl.FLOAT;
+ case g.a.TEXTURETYPE_HALF_FLOAT:
+ return this._gl.HALF_FLOAT;
+ case g.a.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:
+ return this._gl.UNSIGNED_SHORT_4_4_4_4;
+ case g.a.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:
+ return this._gl.UNSIGNED_SHORT_5_5_5_1;
+ case g.a.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:
+ return this._gl.UNSIGNED_SHORT_5_6_5;
+ case g.a.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:
+ return this._gl.UNSIGNED_INT_2_10_10_10_REV;
+ case g.a.TEXTURETYPE_UNSIGNED_INT_24_8:
+ return this._gl.UNSIGNED_INT_24_8;
+ case g.a.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:
+ return this._gl.UNSIGNED_INT_10F_11F_11F_REV;
+ case g.a.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:
+ return this._gl.UNSIGNED_INT_5_9_9_9_REV;
+ case g.a.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV:
+ return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV;
+ }
+ return this._gl.UNSIGNED_BYTE;
+ }, B.prototype._getInternalFormat = function(L) {
+ var j = this._gl.RGBA;
+ switch (L) {
+ case g.a.TEXTUREFORMAT_ALPHA:
+ j = this._gl.ALPHA;
+ break;
+ case g.a.TEXTUREFORMAT_LUMINANCE:
+ j = this._gl.LUMINANCE;
+ break;
+ case g.a.TEXTUREFORMAT_LUMINANCE_ALPHA:
+ j = this._gl.LUMINANCE_ALPHA;
+ break;
+ case g.a.TEXTUREFORMAT_RED:
+ j = this._gl.RED;
+ break;
+ case g.a.TEXTUREFORMAT_RG:
+ j = this._gl.RG;
+ break;
+ case g.a.TEXTUREFORMAT_RGB:
+ j = this._gl.RGB;
+ break;
+ case g.a.TEXTUREFORMAT_RGBA:
+ j = this._gl.RGBA;
+ }
+ if (this._webGLVersion > 1)
+ switch (L) {
+ case g.a.TEXTUREFORMAT_RED_INTEGER:
+ j = this._gl.RED_INTEGER;
+ break;
+ case g.a.TEXTUREFORMAT_RG_INTEGER:
+ j = this._gl.RG_INTEGER;
+ break;
+ case g.a.TEXTUREFORMAT_RGB_INTEGER:
+ j = this._gl.RGB_INTEGER;
+ break;
+ case g.a.TEXTUREFORMAT_RGBA_INTEGER:
+ j = this._gl.RGBA_INTEGER;
+ }
+ return j;
+ }, B.prototype._getRGBABufferInternalSizedFormat = function(L, j) {
+ if (this._webGLVersion === 1) {
+ if (j !== void 0)
+ switch (j) {
+ case g.a.TEXTUREFORMAT_ALPHA:
+ return this._gl.ALPHA;
+ case g.a.TEXTUREFORMAT_LUMINANCE:
+ return this._gl.LUMINANCE;
+ case g.a.TEXTUREFORMAT_LUMINANCE_ALPHA:
+ return this._gl.LUMINANCE_ALPHA;
+ case g.a.TEXTUREFORMAT_RGB:
+ return this._gl.RGB;
+ }
+ return this._gl.RGBA;
+ }
+ switch (L) {
+ case g.a.TEXTURETYPE_BYTE:
+ switch (j) {
+ case g.a.TEXTUREFORMAT_RED:
+ return this._gl.R8_SNORM;
+ case g.a.TEXTUREFORMAT_RG:
+ return this._gl.RG8_SNORM;
+ case g.a.TEXTUREFORMAT_RGB:
+ return this._gl.RGB8_SNORM;
+ case g.a.TEXTUREFORMAT_RED_INTEGER:
+ return this._gl.R8I;
+ case g.a.TEXTUREFORMAT_RG_INTEGER:
+ return this._gl.RG8I;
+ case g.a.TEXTUREFORMAT_RGB_INTEGER:
+ return this._gl.RGB8I;
+ case g.a.TEXTUREFORMAT_RGBA_INTEGER:
+ return this._gl.RGBA8I;
+ default:
+ return this._gl.RGBA8_SNORM;
+ }
+ case g.a.TEXTURETYPE_UNSIGNED_BYTE:
+ switch (j) {
+ case g.a.TEXTUREFORMAT_RED:
+ return this._gl.R8;
+ case g.a.TEXTUREFORMAT_RG:
+ return this._gl.RG8;
+ case g.a.TEXTUREFORMAT_RGB:
+ return this._gl.RGB8;
+ case g.a.TEXTUREFORMAT_RGBA:
+ return this._gl.RGBA8;
+ case g.a.TEXTUREFORMAT_RED_INTEGER:
+ return this._gl.R8UI;
+ case g.a.TEXTUREFORMAT_RG_INTEGER:
+ return this._gl.RG8UI;
+ case g.a.TEXTUREFORMAT_RGB_INTEGER:
+ return this._gl.RGB8UI;
+ case g.a.TEXTUREFORMAT_RGBA_INTEGER:
+ return this._gl.RGBA8UI;
+ case g.a.TEXTUREFORMAT_ALPHA:
+ return this._gl.ALPHA;
+ case g.a.TEXTUREFORMAT_LUMINANCE:
+ return this._gl.LUMINANCE;
+ case g.a.TEXTUREFORMAT_LUMINANCE_ALPHA:
+ return this._gl.LUMINANCE_ALPHA;
+ default:
+ return this._gl.RGBA8;
+ }
+ case g.a.TEXTURETYPE_SHORT:
+ switch (j) {
+ case g.a.TEXTUREFORMAT_RED_INTEGER:
+ return this._gl.R16I;
+ case g.a.TEXTUREFORMAT_RG_INTEGER:
+ return this._gl.RG16I;
+ case g.a.TEXTUREFORMAT_RGB_INTEGER:
+ return this._gl.RGB16I;
+ case g.a.TEXTUREFORMAT_RGBA_INTEGER:
+ default:
+ return this._gl.RGBA16I;
+ }
+ case g.a.TEXTURETYPE_UNSIGNED_SHORT:
+ switch (j) {
+ case g.a.TEXTUREFORMAT_RED_INTEGER:
+ return this._gl.R16UI;
+ case g.a.TEXTUREFORMAT_RG_INTEGER:
+ return this._gl.RG16UI;
+ case g.a.TEXTUREFORMAT_RGB_INTEGER:
+ return this._gl.RGB16UI;
+ case g.a.TEXTUREFORMAT_RGBA_INTEGER:
+ default:
+ return this._gl.RGBA16UI;
+ }
+ case g.a.TEXTURETYPE_INT:
+ switch (j) {
+ case g.a.TEXTUREFORMAT_RED_INTEGER:
+ return this._gl.R32I;
+ case g.a.TEXTUREFORMAT_RG_INTEGER:
+ return this._gl.RG32I;
+ case g.a.TEXTUREFORMAT_RGB_INTEGER:
+ return this._gl.RGB32I;
+ case g.a.TEXTUREFORMAT_RGBA_INTEGER:
+ default:
+ return this._gl.RGBA32I;
+ }
+ case g.a.TEXTURETYPE_UNSIGNED_INTEGER:
+ switch (j) {
+ case g.a.TEXTUREFORMAT_RED_INTEGER:
+ return this._gl.R32UI;
+ case g.a.TEXTUREFORMAT_RG_INTEGER:
+ return this._gl.RG32UI;
+ case g.a.TEXTUREFORMAT_RGB_INTEGER:
+ return this._gl.RGB32UI;
+ case g.a.TEXTUREFORMAT_RGBA_INTEGER:
+ default:
+ return this._gl.RGBA32UI;
+ }
+ case g.a.TEXTURETYPE_FLOAT:
+ switch (j) {
+ case g.a.TEXTUREFORMAT_RED:
+ return this._gl.R32F;
+ case g.a.TEXTUREFORMAT_RG:
+ return this._gl.RG32F;
+ case g.a.TEXTUREFORMAT_RGB:
+ return this._gl.RGB32F;
+ case g.a.TEXTUREFORMAT_RGBA:
+ default:
+ return this._gl.RGBA32F;
+ }
+ case g.a.TEXTURETYPE_HALF_FLOAT:
+ switch (j) {
+ case g.a.TEXTUREFORMAT_RED:
+ return this._gl.R16F;
+ case g.a.TEXTUREFORMAT_RG:
+ return this._gl.RG16F;
+ case g.a.TEXTUREFORMAT_RGB:
+ return this._gl.RGB16F;
+ case g.a.TEXTUREFORMAT_RGBA:
+ default:
+ return this._gl.RGBA16F;
+ }
+ case g.a.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:
+ return this._gl.RGB565;
+ case g.a.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:
+ return this._gl.R11F_G11F_B10F;
+ case g.a.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:
+ return this._gl.RGB9_E5;
+ case g.a.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:
+ return this._gl.RGBA4;
+ case g.a.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:
+ return this._gl.RGB5_A1;
+ case g.a.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:
+ switch (j) {
+ case g.a.TEXTUREFORMAT_RGBA:
+ return this._gl.RGB10_A2;
+ case g.a.TEXTUREFORMAT_RGBA_INTEGER:
+ return this._gl.RGB10_A2UI;
+ default:
+ return this._gl.RGB10_A2;
+ }
+ }
+ return this._gl.RGBA8;
+ }, B.prototype._getRGBAMultiSampleBufferFormat = function(L) {
+ return L === g.a.TEXTURETYPE_FLOAT ? this._gl.RGBA32F : L === g.a.TEXTURETYPE_HALF_FLOAT ? this._gl.RGBA16F : this._gl.RGBA8;
+ }, B.prototype._loadFile = function(L, j, W, Y, oe, te) {
+ var _e = this, de = B._FileToolsLoadFile(L, j, W, Y, oe, te);
+ return this._activeRequests.push(de), de.onCompleteObservable.add(function(ae) {
+ _e._activeRequests.splice(_e._activeRequests.indexOf(ae), 1);
+ }), de;
+ }, B._FileToolsLoadFile = function(L, j, W, Y, oe, te) {
+ throw P.a.WarnImport("FileTools");
+ }, B.prototype.readPixels = function(L, j, W, Y, oe) {
+ oe === void 0 && (oe = !0);
+ var te = oe ? 4 : 3, _e = oe ? this._gl.RGBA : this._gl.RGB, de = new Uint8Array(Y * W * te);
+ return this._gl.readPixels(L, j, W, Y, _e, this._gl.UNSIGNED_BYTE, de), de;
+ }, Object.defineProperty(B, "IsSupported", { get: function() {
+ return this.isSupported();
+ }, enumerable: !1, configurable: !0 }), B.isSupported = function() {
+ if (this._HasMajorPerformanceCaveat !== null)
+ return !this._HasMajorPerformanceCaveat;
+ if (this._IsSupported === null)
+ try {
+ var L = b.a.CreateCanvas(1, 1), j = L.getContext("webgl") || L.getContext("experimental-webgl");
+ this._IsSupported = j != null && !!window.WebGLRenderingContext;
+ } catch {
+ this._IsSupported = !1;
+ }
+ return this._IsSupported;
+ }, Object.defineProperty(B, "HasMajorPerformanceCaveat", { get: function() {
+ if (this._HasMajorPerformanceCaveat === null)
+ try {
+ var L = b.a.CreateCanvas(1, 1), j = L.getContext("webgl", { failIfMajorPerformanceCaveat: !0 }) || L.getContext("experimental-webgl", { failIfMajorPerformanceCaveat: !0 });
+ this._HasMajorPerformanceCaveat = !j;
+ } catch {
+ this._HasMajorPerformanceCaveat = !1;
+ }
+ return this._HasMajorPerformanceCaveat;
+ }, enumerable: !1, configurable: !0 }), B.CeilingPOT = function(L) {
+ return L--, L |= L >> 1, L |= L >> 2, L |= L >> 4, L |= L >> 8, L |= L >> 16, ++L;
+ }, B.FloorPOT = function(L) {
+ return L |= L >> 1, L |= L >> 2, L |= L >> 4, L |= L >> 8, (L |= L >> 16) - (L >> 1);
+ }, B.NearestPOT = function(L) {
+ var j = B.CeilingPOT(L), W = B.FloorPOT(L);
+ return j - L > L - W ? W : j;
+ }, B.GetExponentOfTwo = function(L, j, W) {
+ var Y;
+ switch (W === void 0 && (W = g.a.SCALEMODE_NEAREST), W) {
+ case g.a.SCALEMODE_FLOOR:
+ Y = B.FloorPOT(L);
+ break;
+ case g.a.SCALEMODE_NEAREST:
+ Y = B.NearestPOT(L);
+ break;
+ case g.a.SCALEMODE_CEILING:
+ default:
+ Y = B.CeilingPOT(L);
+ }
+ return Math.min(Y, j);
+ }, B.QueueNewFrame = function(L, j) {
+ return A.a.IsWindowObjectExist() ? (j || (j = window), j.requestPostAnimationFrame ? j.requestPostAnimationFrame(L) : j.requestAnimationFrame ? j.requestAnimationFrame(L) : j.msRequestAnimationFrame ? j.msRequestAnimationFrame(L) : j.webkitRequestAnimationFrame ? j.webkitRequestAnimationFrame(L) : j.mozRequestAnimationFrame ? j.mozRequestAnimationFrame(L) : j.oRequestAnimationFrame ? j.oRequestAnimationFrame(L) : window.setTimeout(L, 16)) : typeof requestAnimationFrame < "u" ? requestAnimationFrame(L) : setTimeout(L, 16);
+ }, B.prototype.getHostDocument = function() {
+ return this._renderingCanvas && this._renderingCanvas.ownerDocument ? this._renderingCanvas.ownerDocument : document;
+ }, B.ExceptionList = [{ key: "Chrome/63.0", capture: "63\\.0\\.3239\\.(\\d+)", captureConstraint: 108, targets: ["uniformBuffer"] }, { key: "Firefox/58", capture: null, captureConstraint: null, targets: ["uniformBuffer"] }, { key: "Firefox/59", capture: null, captureConstraint: null, targets: ["uniformBuffer"] }, { key: "Chrome/72.+?Mobile", capture: null, captureConstraint: null, targets: ["vao"] }, { key: "Chrome/73.+?Mobile", capture: null, captureConstraint: null, targets: ["vao"] }, { key: "Chrome/74.+?Mobile", capture: null, captureConstraint: null, targets: ["vao"] }, { key: "Mac OS.+Chrome/71", capture: null, captureConstraint: null, targets: ["vao"] }, { key: "Mac OS.+Chrome/72", capture: null, captureConstraint: null, targets: ["vao"] }], B._TextureLoaders = [], B.CollisionsEpsilon = 1e-3, B._IsSupported = null, B._HasMajorPerformanceCaveat = null, B;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "b", function() {
+ return D;
+ }), l.d(_, "a", function() {
+ return x;
+ });
+ var D, f = l(6), P = l(102), c = l(2), C = l(21);
+ (function(R) {
+ R[R.Unknown = 0] = "Unknown", R[R.Url = 1] = "Url", R[R.Temp = 2] = "Temp", R[R.Raw = 3] = "Raw", R[R.Dynamic = 4] = "Dynamic", R[R.RenderTarget = 5] = "RenderTarget", R[R.MultiRenderTarget = 6] = "MultiRenderTarget", R[R.Cube = 7] = "Cube", R[R.CubeRaw = 8] = "CubeRaw", R[R.CubePrefiltered = 9] = "CubePrefiltered", R[R.Raw3D = 10] = "Raw3D", R[R.Raw2DArray = 11] = "Raw2DArray", R[R.Depth = 12] = "Depth", R[R.CubeRawRGBD = 13] = "CubeRawRGBD";
+ })(D || (D = {}));
+ var x = function() {
+ function R(g, u, E) {
+ E === void 0 && (E = !1), this.isReady = !1, this.isCube = !1, this.is3D = !1, this.is2DArray = !1, this.isMultiview = !1, this.url = "", this.samplingMode = -1, this.generateMipMaps = !1, this.samples = 0, this.type = -1, this.format = -1, this.onLoadedObservable = new f.c(), this.width = 0, this.height = 0, this.depth = 0, this.baseWidth = 0, this.baseHeight = 0, this.baseDepth = 0, this.invertY = !1, this._invertVScale = !1, this._associatedChannel = -1, this._source = D.Unknown, this._buffer = null, this._bufferView = null, this._bufferViewArray = null, this._bufferViewArrayArray = null, this._size = 0, this._extension = "", this._files = null, this._workingCanvas = null, this._workingContext = null, this._framebuffer = null, this._depthStencilBuffer = null, this._MSAAFramebuffer = null, this._MSAARenderBuffer = null, this._attachments = null, this._textureArray = null, this._cachedCoordinatesMode = null, this._cachedWrapU = null, this._cachedWrapV = null, this._cachedWrapR = null, this._cachedAnisotropicFilteringLevel = null, this._isDisabled = !1, this._compression = null, this._generateStencilBuffer = !1, this._generateDepthBuffer = !1, this._comparisonFunction = 0, this._sphericalPolynomial = null, this._lodGenerationScale = 0, this._lodGenerationOffset = 0, this._colorTextureArray = null, this._depthStencilTextureArray = null, this._lodTextureHigh = null, this._lodTextureMid = null, this._lodTextureLow = null, this._isRGBD = !1, this._linearSpecularLOD = !1, this._irradianceTexture = null, this._webGLTexture = null, this._references = 1, this._gammaSpace = null, this._engine = g, this._source = u, E || (this._webGLTexture = g._createTexture());
+ }
+ return R.prototype.getEngine = function() {
+ return this._engine;
+ }, Object.defineProperty(R.prototype, "source", { get: function() {
+ return this._source;
+ }, enumerable: !1, configurable: !0 }), R.prototype.incrementReferences = function() {
+ this._references++;
+ }, R.prototype.updateSize = function(g, u, E) {
+ E === void 0 && (E = 1), this.width = g, this.height = u, this.depth = E, this.baseWidth = g, this.baseHeight = u, this.baseDepth = E, this._size = g * u * E;
+ }, R.prototype._rebuild = function() {
+ var g, u, E = this;
+ switch (this.isReady = !1, this._cachedCoordinatesMode = null, this._cachedWrapU = null, this._cachedWrapV = null, this._cachedAnisotropicFilteringLevel = null, this.source) {
+ case D.Temp:
+ return;
+ case D.Url:
+ return void (u = this._engine.createTexture((g = this._originalUrl) !== null && g !== void 0 ? g : this.url, !this.generateMipMaps, this.invertY, null, this.samplingMode, function() {
+ u._swapAndDie(E), E.isReady = !0;
+ }, null, this._buffer, void 0, this.format));
+ case D.Raw:
+ return (u = this._engine.createRawTexture(this._bufferView, this.baseWidth, this.baseHeight, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression))._swapAndDie(this), void (this.isReady = !0);
+ case D.Raw3D:
+ return (u = this._engine.createRawTexture3D(this._bufferView, this.baseWidth, this.baseHeight, this.baseDepth, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression))._swapAndDie(this), void (this.isReady = !0);
+ case D.Raw2DArray:
+ return (u = this._engine.createRawTexture2DArray(this._bufferView, this.baseWidth, this.baseHeight, this.baseDepth, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression))._swapAndDie(this), void (this.isReady = !0);
+ case D.Dynamic:
+ return (u = this._engine.createDynamicTexture(this.baseWidth, this.baseHeight, this.generateMipMaps, this.samplingMode))._swapAndDie(this), void this._engine.updateDynamicTexture(this, this._engine.getRenderingCanvas(), this.invertY, void 0, void 0, !0);
+ case D.RenderTarget:
+ var A = new P.a();
+ if (A.generateDepthBuffer = this._generateDepthBuffer, A.generateMipMaps = this.generateMipMaps, A.generateStencilBuffer = this._generateStencilBuffer, A.samplingMode = this.samplingMode, A.type = this.type, this.isCube)
+ u = this._engine.createRenderTargetCubeTexture(this.width, A);
+ else {
+ var y = { width: this.width, height: this.height, layers: this.is2DArray ? this.depth : void 0 };
+ u = this._engine.createRenderTargetTexture(y, A);
+ }
+ return u._swapAndDie(this), void (this.isReady = !0);
+ case D.Depth:
+ var v = { bilinearFiltering: this.samplingMode !== c.a.TEXTURE_BILINEAR_SAMPLINGMODE, comparisonFunction: this._comparisonFunction, generateStencil: this._generateStencilBuffer, isCube: this.isCube }, h = { width: this.width, height: this.height, layers: this.is2DArray ? this.depth : void 0 };
+ return (u = this._engine.createDepthStencilTexture(h, v))._swapAndDie(this), void (this.isReady = !0);
+ case D.Cube:
+ return void (u = this._engine.createCubeTexture(this.url, null, this._files, !this.generateMipMaps, function() {
+ u._swapAndDie(E), E.isReady = !0;
+ }, null, this.format, this._extension));
+ case D.CubeRaw:
+ return (u = this._engine.createRawCubeTexture(this._bufferViewArray, this.width, this.format, this.type, this.generateMipMaps, this.invertY, this.samplingMode, this._compression))._swapAndDie(this), void (this.isReady = !0);
+ case D.CubeRawRGBD:
+ return u = this._engine.createRawCubeTexture(null, this.width, this.format, this.type, this.generateMipMaps, this.invertY, this.samplingMode, this._compression), void R._UpdateRGBDAsync(u, this._bufferViewArrayArray, this._sphericalPolynomial, this._lodGenerationScale, this._lodGenerationOffset).then(function() {
+ u._swapAndDie(E), E.isReady = !0;
+ });
+ case D.CubePrefiltered:
+ return void ((u = this._engine.createPrefilteredCubeTexture(this.url, null, this._lodGenerationScale, this._lodGenerationOffset, function(d) {
+ d && d._swapAndDie(E), E.isReady = !0;
+ }, null, this.format, this._extension))._sphericalPolynomial = this._sphericalPolynomial);
+ }
+ }, R.prototype._swapAndDie = function(g) {
+ g._webGLTexture = this._webGLTexture, g._isRGBD = this._isRGBD, this._framebuffer && (g._framebuffer = this._framebuffer), this._depthStencilBuffer && (g._depthStencilBuffer = this._depthStencilBuffer), g._depthStencilTexture = this._depthStencilTexture, this._lodTextureHigh && (g._lodTextureHigh && g._lodTextureHigh.dispose(), g._lodTextureHigh = this._lodTextureHigh), this._lodTextureMid && (g._lodTextureMid && g._lodTextureMid.dispose(), g._lodTextureMid = this._lodTextureMid), this._lodTextureLow && (g._lodTextureLow && g._lodTextureLow.dispose(), g._lodTextureLow = this._lodTextureLow), this._irradianceTexture && (g._irradianceTexture && g._irradianceTexture.dispose(), g._irradianceTexture = this._irradianceTexture);
+ var u, E = this._engine.getLoadedTexturesCache();
+ (u = E.indexOf(this)) !== -1 && E.splice(u, 1), (u = E.indexOf(g)) === -1 && E.push(g);
+ }, R.prototype.dispose = function() {
+ this._webGLTexture && (this._references--, this._references === 0 && (this._engine._releaseTexture(this), this._webGLTexture = null));
+ }, R._UpdateRGBDAsync = function(g, u, E, A, y) {
+ throw C.a.WarnImport("environmentTextureTools");
+ }, R;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "b", function() {
+ return D;
+ }), l.d(_, "c", function() {
+ return f;
+ }), l.d(_, "a", function() {
+ return P;
+ });
+ var D = 1 / 2.2, f = 2.2, P = 1e-3;
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return R;
+ });
+ var D = l(1), f = l(0), P = l(3), c = l(6), C = l(22), x = l(21), R = function() {
+ function g(u, E) {
+ E === void 0 && (E = null), this.state = "", this.metadata = null, this.reservedDataStore = null, this._doNotSerialize = !1, this._isDisposed = !1, this.animations = new Array(), this._ranges = {}, this.onReady = null, this._isEnabled = !0, this._isParentEnabled = !0, this._isReady = !0, this._currentRenderId = -1, this._parentUpdateId = -1, this._childUpdateId = -1, this._waitingParentId = null, this._cache = {}, this._parentNode = null, this._children = null, this._worldMatrix = f.a.Identity(), this._worldMatrixDeterminant = 0, this._worldMatrixDeterminantIsDirty = !0, this._sceneRootNodesIndex = -1, this._animationPropertiesOverride = null, this._isNode = !0, this.onDisposeObservable = new c.c(), this._onDisposeObserver = null, this._behaviors = new Array(), this.name = u, this.id = u, this._scene = E || C.a.LastCreatedScene, this.uniqueId = this._scene.getUniqueId(), this._initCache();
+ }
+ return g.AddNodeConstructor = function(u, E) {
+ this._NodeConstructors[u] = E;
+ }, g.Construct = function(u, E, A, y) {
+ var v = this._NodeConstructors[u];
+ return v ? v(E, A, y) : null;
+ }, Object.defineProperty(g.prototype, "doNotSerialize", { get: function() {
+ return !!this._doNotSerialize || !!this._parentNode && this._parentNode.doNotSerialize;
+ }, set: function(u) {
+ this._doNotSerialize = u;
+ }, enumerable: !1, configurable: !0 }), g.prototype.isDisposed = function() {
+ return this._isDisposed;
+ }, Object.defineProperty(g.prototype, "parent", { get: function() {
+ return this._parentNode;
+ }, set: function(u) {
+ if (this._parentNode !== u) {
+ var E = this._parentNode;
+ if (this._parentNode && this._parentNode._children !== void 0 && this._parentNode._children !== null) {
+ var A = this._parentNode._children.indexOf(this);
+ A !== -1 && this._parentNode._children.splice(A, 1), u || this._isDisposed || this._addToSceneRootNodes();
+ }
+ this._parentNode = u, this._parentNode && (this._parentNode._children !== void 0 && this._parentNode._children !== null || (this._parentNode._children = new Array()), this._parentNode._children.push(this), E || this._removeFromSceneRootNodes()), this._syncParentEnabledState();
+ }
+ }, enumerable: !1, configurable: !0 }), g.prototype._addToSceneRootNodes = function() {
+ this._sceneRootNodesIndex === -1 && (this._sceneRootNodesIndex = this._scene.rootNodes.length, this._scene.rootNodes.push(this));
+ }, g.prototype._removeFromSceneRootNodes = function() {
+ if (this._sceneRootNodesIndex !== -1) {
+ var u = this._scene.rootNodes, E = u.length - 1;
+ u[this._sceneRootNodesIndex] = u[E], u[this._sceneRootNodesIndex]._sceneRootNodesIndex = this._sceneRootNodesIndex, this._scene.rootNodes.pop(), this._sceneRootNodesIndex = -1;
+ }
+ }, Object.defineProperty(g.prototype, "animationPropertiesOverride", { get: function() {
+ return this._animationPropertiesOverride ? this._animationPropertiesOverride : this._scene.animationPropertiesOverride;
+ }, set: function(u) {
+ this._animationPropertiesOverride = u;
+ }, enumerable: !1, configurable: !0 }), g.prototype.getClassName = function() {
+ return "Node";
+ }, Object.defineProperty(g.prototype, "onDispose", { set: function(u) {
+ this._onDisposeObserver && this.onDisposeObservable.remove(this._onDisposeObserver), this._onDisposeObserver = this.onDisposeObservable.add(u);
+ }, enumerable: !1, configurable: !0 }), g.prototype.getScene = function() {
+ return this._scene;
+ }, g.prototype.getEngine = function() {
+ return this._scene.getEngine();
+ }, g.prototype.addBehavior = function(u, E) {
+ var A = this;
+ return E === void 0 && (E = !1), this._behaviors.indexOf(u) !== -1 || (u.init(), this._scene.isLoading && !E ? this._scene.onDataLoadedObservable.addOnce(function() {
+ u.attach(A);
+ }) : u.attach(this), this._behaviors.push(u)), this;
+ }, g.prototype.removeBehavior = function(u) {
+ var E = this._behaviors.indexOf(u);
+ return E === -1 || (this._behaviors[E].detach(), this._behaviors.splice(E, 1)), this;
+ }, Object.defineProperty(g.prototype, "behaviors", { get: function() {
+ return this._behaviors;
+ }, enumerable: !1, configurable: !0 }), g.prototype.getBehaviorByName = function(u) {
+ for (var E = 0, A = this._behaviors; E < A.length; E++) {
+ var y = A[E];
+ if (y.name === u)
+ return y;
+ }
+ return null;
+ }, g.prototype.getWorldMatrix = function() {
+ return this._currentRenderId !== this._scene.getRenderId() && this.computeWorldMatrix(), this._worldMatrix;
+ }, g.prototype._getWorldMatrixDeterminant = function() {
+ return this._worldMatrixDeterminantIsDirty && (this._worldMatrixDeterminantIsDirty = !1, this._worldMatrixDeterminant = this._worldMatrix.determinant()), this._worldMatrixDeterminant;
+ }, Object.defineProperty(g.prototype, "worldMatrixFromCache", { get: function() {
+ return this._worldMatrix;
+ }, enumerable: !1, configurable: !0 }), g.prototype._initCache = function() {
+ this._cache = {}, this._cache.parent = void 0;
+ }, g.prototype.updateCache = function(u) {
+ !u && this.isSynchronized() || (this._cache.parent = this.parent, this._updateCache());
+ }, g.prototype._getActionManagerForTrigger = function(u, E) {
+ return this.parent ? this.parent._getActionManagerForTrigger(u, !1) : null;
+ }, g.prototype._updateCache = function(u) {
+ }, g.prototype._isSynchronized = function() {
+ return !0;
+ }, g.prototype._markSyncedWithParent = function() {
+ this._parentNode && (this._parentUpdateId = this._parentNode._childUpdateId);
+ }, g.prototype.isSynchronizedWithParent = function() {
+ return !this._parentNode || this._parentUpdateId === this._parentNode._childUpdateId && this._parentNode.isSynchronized();
+ }, g.prototype.isSynchronized = function() {
+ return this._cache.parent != this._parentNode ? (this._cache.parent = this._parentNode, !1) : !(this._parentNode && !this.isSynchronizedWithParent()) && this._isSynchronized();
+ }, g.prototype.isReady = function(u) {
+ return this._isReady;
+ }, g.prototype.isEnabled = function(u) {
+ return u === void 0 && (u = !0), u === !1 ? this._isEnabled : !!this._isEnabled && this._isParentEnabled;
+ }, g.prototype._syncParentEnabledState = function() {
+ this._isParentEnabled = !this._parentNode || this._parentNode.isEnabled(), this._children && this._children.forEach(function(u) {
+ u._syncParentEnabledState();
+ });
+ }, g.prototype.setEnabled = function(u) {
+ this._isEnabled = u, this._syncParentEnabledState();
+ }, g.prototype.isDescendantOf = function(u) {
+ return !!this.parent && (this.parent === u || this.parent.isDescendantOf(u));
+ }, g.prototype._getDescendants = function(u, E, A) {
+ if (E === void 0 && (E = !1), this._children)
+ for (var y = 0; y < this._children.length; y++) {
+ var v = this._children[y];
+ A && !A(v) || u.push(v), E || v._getDescendants(u, !1, A);
+ }
+ }, g.prototype.getDescendants = function(u, E) {
+ var A = new Array();
+ return this._getDescendants(A, u, E), A;
+ }, g.prototype.getChildMeshes = function(u, E) {
+ var A = [];
+ return this._getDescendants(A, u, function(y) {
+ return (!E || E(y)) && y.cullingStrategy !== void 0;
+ }), A;
+ }, g.prototype.getChildren = function(u, E) {
+ return E === void 0 && (E = !0), this.getDescendants(E, u);
+ }, g.prototype._setReady = function(u) {
+ u !== this._isReady && (u ? (this.onReady && this.onReady(this), this._isReady = !0) : this._isReady = !1);
+ }, g.prototype.getAnimationByName = function(u) {
+ for (var E = 0; E < this.animations.length; E++) {
+ var A = this.animations[E];
+ if (A.name === u)
+ return A;
+ }
+ return null;
+ }, g.prototype.createAnimationRange = function(u, E, A) {
+ if (!this._ranges[u]) {
+ this._ranges[u] = g._AnimationRangeFactory(u, E, A);
+ for (var y = 0, v = this.animations.length; y < v; y++)
+ this.animations[y] && this.animations[y].createRange(u, E, A);
+ }
+ }, g.prototype.deleteAnimationRange = function(u, E) {
+ E === void 0 && (E = !0);
+ for (var A = 0, y = this.animations.length; A < y; A++)
+ this.animations[A] && this.animations[A].deleteRange(u, E);
+ this._ranges[u] = null;
+ }, g.prototype.getAnimationRange = function(u) {
+ return this._ranges[u] || null;
+ }, g.prototype.getAnimationRanges = function() {
+ var u, E = [];
+ for (u in this._ranges)
+ E.push(this._ranges[u]);
+ return E;
+ }, g.prototype.beginAnimation = function(u, E, A, y) {
+ var v = this.getAnimationRange(u);
+ return v ? this._scene.beginAnimation(this, v.from, v.to, E, A, y) : null;
+ }, g.prototype.serializeAnimationRanges = function() {
+ var u = [];
+ for (var E in this._ranges) {
+ var A = this._ranges[E];
+ if (A) {
+ var y = {};
+ y.name = E, y.from = A.from, y.to = A.to, u.push(y);
+ }
+ }
+ return u;
+ }, g.prototype.computeWorldMatrix = function(u) {
+ return this._worldMatrix || (this._worldMatrix = f.a.Identity()), this._worldMatrix;
+ }, g.prototype.dispose = function(u, E) {
+ if (E === void 0 && (E = !1), this._isDisposed = !0, !u)
+ for (var A = 0, y = this.getDescendants(!0); A < y.length; A++)
+ y[A].dispose(u, E);
+ this.parent ? this.parent = null : this._removeFromSceneRootNodes(), this.onDisposeObservable.notifyObservers(this), this.onDisposeObservable.clear();
+ for (var v = 0, h = this._behaviors; v < h.length; v++)
+ h[v].detach();
+ this._behaviors = [];
+ }, g.ParseAnimationRanges = function(u, E, A) {
+ if (E.ranges)
+ for (var y = 0; y < E.ranges.length; y++) {
+ var v = E.ranges[y];
+ u.createAnimationRange(v.name, v.from, v.to);
+ }
+ }, g.prototype.getHierarchyBoundingVectors = function(u, E) {
+ var A, y;
+ if (u === void 0 && (u = !0), E === void 0 && (E = null), this.getScene().incrementRenderId(), this.computeWorldMatrix(!0), this.getBoundingInfo && this.subMeshes) {
+ var v = this.getBoundingInfo();
+ A = v.boundingBox.minimumWorld.clone(), y = v.boundingBox.maximumWorld.clone();
+ } else
+ A = new f.e(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), y = new f.e(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
+ if (u)
+ for (var h = 0, d = this.getDescendants(!1); h < d.length; h++) {
+ var b = d[h];
+ if (b.computeWorldMatrix(!0), (!E || E(b)) && b.getBoundingInfo && b.getTotalVertices() !== 0) {
+ var T = b.getBoundingInfo().boundingBox, N = T.minimumWorld, U = T.maximumWorld;
+ f.e.CheckExtends(N, A, y), f.e.CheckExtends(U, A, y);
+ }
+ }
+ return { min: A, max: y };
+ }, g._AnimationRangeFactory = function(u, E, A) {
+ throw x.a.WarnImport("AnimationRange");
+ }, g._NodeConstructors = {}, Object(D.c)([Object(P.c)()], g.prototype, "name", void 0), Object(D.c)([Object(P.c)()], g.prototype, "id", void 0), Object(D.c)([Object(P.c)()], g.prototype, "uniqueId", void 0), Object(D.c)([Object(P.c)()], g.prototype, "state", void 0), Object(D.c)([Object(P.c)()], g.prototype, "metadata", void 0), g;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "b", function() {
+ return _e;
+ }), l.d(_, "a", function() {
+ return de;
+ });
+ var D = l(1), f = l(3), P = l(33), c = l(20), C = l(0), x = l(9), R = l(4), g = l(105), u = l(42), E = l(25), A = l(76), y = l(87), v = l(15), h = l(10), d = l(11), b = l(19), T = l(5), N = `uniform vec4 vDiffuseColor;
+#ifdef SPECULARTERM
+uniform vec4 vSpecularColor;
+#endif
+uniform vec3 vEmissiveColor;
+uniform float visibility;
+
+#ifdef DIFFUSE
+uniform vec2 vDiffuseInfos;
+#endif
+#ifdef AMBIENT
+uniform vec2 vAmbientInfos;
+#endif
+#ifdef OPACITY
+uniform vec2 vOpacityInfos;
+#endif
+#ifdef EMISSIVE
+uniform vec2 vEmissiveInfos;
+#endif
+#ifdef LIGHTMAP
+uniform vec2 vLightmapInfos;
+#endif
+#ifdef BUMP
+uniform vec3 vBumpInfos;
+uniform vec2 vTangentSpaceParams;
+#endif
+#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)
+uniform mat4 view;
+#endif
+#ifdef REFRACTION
+uniform vec4 vRefractionInfos;
+#ifndef REFRACTIONMAP_3D
+uniform mat4 refractionMatrix;
+#endif
+#ifdef REFRACTIONFRESNEL
+uniform vec4 refractionLeftColor;
+uniform vec4 refractionRightColor;
+#endif
+#endif
+#if defined(SPECULAR) && defined(SPECULARTERM)
+uniform vec2 vSpecularInfos;
+#endif
+#ifdef DIFFUSEFRESNEL
+uniform vec4 diffuseLeftColor;
+uniform vec4 diffuseRightColor;
+#endif
+#ifdef OPACITYFRESNEL
+uniform vec4 opacityParts;
+#endif
+#ifdef EMISSIVEFRESNEL
+uniform vec4 emissiveLeftColor;
+uniform vec4 emissiveRightColor;
+#endif
+
+#ifdef REFLECTION
+uniform vec2 vReflectionInfos;
+#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION) || defined(REFLECTIONMAP_EQUIRECTANGULAR) || defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_SKYBOX)
+uniform mat4 reflectionMatrix;
+#endif
+#ifndef REFLECTIONMAP_SKYBOX
+#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)
+uniform vec3 vReflectionPosition;
+uniform vec3 vReflectionSize;
+#endif
+#endif
+#ifdef REFLECTIONFRESNEL
+uniform vec4 reflectionLeftColor;
+uniform vec4 reflectionRightColor;
+#endif
+#endif`;
+ T.a.IncludesShadersStore.defaultFragmentDeclaration = N;
+ var U = `layout(std140,column_major) uniform;
+uniform Material
+{
+vec4 diffuseLeftColor;
+vec4 diffuseRightColor;
+vec4 opacityParts;
+vec4 reflectionLeftColor;
+vec4 reflectionRightColor;
+vec4 refractionLeftColor;
+vec4 refractionRightColor;
+vec4 emissiveLeftColor;
+vec4 emissiveRightColor;
+vec2 vDiffuseInfos;
+vec2 vAmbientInfos;
+vec2 vOpacityInfos;
+vec2 vReflectionInfos;
+vec3 vReflectionPosition;
+vec3 vReflectionSize;
+vec2 vEmissiveInfos;
+vec2 vLightmapInfos;
+vec2 vSpecularInfos;
+vec3 vBumpInfos;
+mat4 diffuseMatrix;
+mat4 ambientMatrix;
+mat4 opacityMatrix;
+mat4 reflectionMatrix;
+mat4 emissiveMatrix;
+mat4 lightmapMatrix;
+mat4 specularMatrix;
+mat4 bumpMatrix;
+vec2 vTangentSpaceParams;
+float pointSize;
+mat4 refractionMatrix;
+vec4 vRefractionInfos;
+vec4 vSpecularColor;
+vec3 vEmissiveColor;
+float visibility;
+vec4 vDiffuseColor;
+vec4 vDetailInfos;
+mat4 detailMatrix;
+};
+uniform Scene {
+mat4 viewProjection;
+#ifdef MULTIVIEW
+mat4 viewProjectionR;
+#endif
+mat4 view;
+};
+`;
+ T.a.IncludesShadersStore.defaultUboDeclaration = U, l(160), l(59), l(106), l(107), l(154), l(130), l(161), l(131), l(108), l(109), l(132), l(133), l(115), l(116), l(125), l(110), l(134), l(162), l(135), l(155), l(136);
+ var B = `#include<__decl__defaultFragment>
+#if defined(BUMP) || !defined(NORMAL)
+#extension GL_OES_standard_derivatives : enable
+#endif
+#include[SCENE_MRT_COUNT]
+#define CUSTOM_FRAGMENT_BEGIN
+#ifdef LOGARITHMICDEPTH
+#extension GL_EXT_frag_depth : enable
+#endif
+
+#define RECIPROCAL_PI2 0.15915494
+uniform vec3 vEyePosition;
+uniform vec3 vAmbientColor;
+
+varying vec3 vPositionW;
+#ifdef NORMAL
+varying vec3 vNormalW;
+#endif
+#ifdef VERTEXCOLOR
+varying vec4 vColor;
+#endif
+#ifdef MAINUV1
+varying vec2 vMainUV1;
+#endif
+#ifdef MAINUV2
+varying vec2 vMainUV2;
+#endif
+
+#include
+
+#include<__decl__lightFragment>[0..maxSimultaneousLights]
+#include
+#include
+
+#ifdef DIFFUSE
+#if DIFFUSEDIRECTUV == 1
+#define vDiffuseUV vMainUV1
+#elif DIFFUSEDIRECTUV == 2
+#define vDiffuseUV vMainUV2
+#else
+varying vec2 vDiffuseUV;
+#endif
+uniform sampler2D diffuseSampler;
+#endif
+#ifdef AMBIENT
+#if AMBIENTDIRECTUV == 1
+#define vAmbientUV vMainUV1
+#elif AMBIENTDIRECTUV == 2
+#define vAmbientUV vMainUV2
+#else
+varying vec2 vAmbientUV;
+#endif
+uniform sampler2D ambientSampler;
+#endif
+#ifdef OPACITY
+#if OPACITYDIRECTUV == 1
+#define vOpacityUV vMainUV1
+#elif OPACITYDIRECTUV == 2
+#define vOpacityUV vMainUV2
+#else
+varying vec2 vOpacityUV;
+#endif
+uniform sampler2D opacitySampler;
+#endif
+#ifdef EMISSIVE
+#if EMISSIVEDIRECTUV == 1
+#define vEmissiveUV vMainUV1
+#elif EMISSIVEDIRECTUV == 2
+#define vEmissiveUV vMainUV2
+#else
+varying vec2 vEmissiveUV;
+#endif
+uniform sampler2D emissiveSampler;
+#endif
+#ifdef LIGHTMAP
+#if LIGHTMAPDIRECTUV == 1
+#define vLightmapUV vMainUV1
+#elif LIGHTMAPDIRECTUV == 2
+#define vLightmapUV vMainUV2
+#else
+varying vec2 vLightmapUV;
+#endif
+uniform sampler2D lightmapSampler;
+#endif
+#ifdef REFRACTION
+#ifdef REFRACTIONMAP_3D
+uniform samplerCube refractionCubeSampler;
+#else
+uniform sampler2D refraction2DSampler;
+#endif
+#endif
+#if defined(SPECULAR) && defined(SPECULARTERM)
+#if SPECULARDIRECTUV == 1
+#define vSpecularUV vMainUV1
+#elif SPECULARDIRECTUV == 2
+#define vSpecularUV vMainUV2
+#else
+varying vec2 vSpecularUV;
+#endif
+uniform sampler2D specularSampler;
+#endif
+#ifdef ALPHATEST
+uniform float alphaCutOff;
+#endif
+
+#include
+
+#ifdef REFLECTION
+#ifdef REFLECTIONMAP_3D
+uniform samplerCube reflectionCubeSampler;
+#else
+uniform sampler2D reflection2DSampler;
+#endif
+#ifdef REFLECTIONMAP_SKYBOX
+varying vec3 vPositionUVW;
+#else
+#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
+varying vec3 vDirectionW;
+#endif
+#endif
+#include
+#endif
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#define CUSTOM_FRAGMENT_DEFINITIONS
+void main(void) {
+#define CUSTOM_FRAGMENT_MAIN_BEGIN
+#include
+vec3 viewDirectionW=normalize(vEyePosition-vPositionW);
+
+vec4 baseColor=vec4(1.,1.,1.,1.);
+vec3 diffuseColor=vDiffuseColor.rgb;
+
+float alpha=vDiffuseColor.a;
+
+#ifdef NORMAL
+vec3 normalW=normalize(vNormalW);
+#else
+vec3 normalW=normalize(-cross(dFdx(vPositionW),dFdy(vPositionW)));
+#endif
+#include
+#ifdef TWOSIDEDLIGHTING
+normalW=gl_FrontFacing ? normalW : -normalW;
+#endif
+#ifdef DIFFUSE
+baseColor=texture2D(diffuseSampler,vDiffuseUV+uvOffset);
+#if defined(ALPHATEST) && !defined(ALPHATEST_AFTERALLALPHACOMPUTATIONS)
+if (baseColor.a
+#ifdef VERTEXCOLOR
+baseColor.rgb*=vColor.rgb;
+#endif
+#ifdef DETAIL
+baseColor.rgb=baseColor.rgb*2.0*mix(0.5,detailColor.r,vDetailInfos.y);
+#endif
+#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE
+
+vec3 baseAmbientColor=vec3(1.,1.,1.);
+#ifdef AMBIENT
+baseAmbientColor=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;
+#endif
+#define CUSTOM_FRAGMENT_BEFORE_LIGHTS
+
+#ifdef SPECULARTERM
+float glossiness=vSpecularColor.a;
+vec3 specularColor=vSpecularColor.rgb;
+#ifdef SPECULAR
+vec4 specularMapColor=texture2D(specularSampler,vSpecularUV+uvOffset);
+specularColor=specularMapColor.rgb;
+#ifdef GLOSSINESS
+glossiness=glossiness*specularMapColor.a;
+#endif
+#endif
+#else
+float glossiness=0.;
+#endif
+
+vec3 diffuseBase=vec3(0.,0.,0.);
+lightingInfo info;
+#ifdef SPECULARTERM
+vec3 specularBase=vec3(0.,0.,0.);
+#endif
+float shadow=1.;
+#ifdef LIGHTMAP
+vec4 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset);
+#ifdef RGBDLIGHTMAP
+lightmapColor.rgb=fromRGBD(lightmapColor);
+#endif
+lightmapColor.rgb*=vLightmapInfos.y;
+#endif
+#include[0..maxSimultaneousLights]
+
+vec4 refractionColor=vec4(0.,0.,0.,1.);
+#ifdef REFRACTION
+vec3 refractionVector=normalize(refract(-viewDirectionW,normalW,vRefractionInfos.y));
+#ifdef REFRACTIONMAP_3D
+refractionVector.y=refractionVector.y*vRefractionInfos.w;
+if (dot(refractionVector,viewDirectionW)<1.0) {
+refractionColor=textureCube(refractionCubeSampler,refractionVector);
+}
+#else
+vec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));
+vec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;
+refractionCoords.y=1.0-refractionCoords.y;
+refractionColor=texture2D(refraction2DSampler,refractionCoords);
+#endif
+#ifdef RGBDREFRACTION
+refractionColor.rgb=fromRGBD(refractionColor);
+#endif
+#ifdef IS_REFRACTION_LINEAR
+refractionColor.rgb=toGammaSpace(refractionColor.rgb);
+#endif
+refractionColor.rgb*=vRefractionInfos.x;
+#endif
+
+vec4 reflectionColor=vec4(0.,0.,0.,1.);
+#ifdef REFLECTION
+vec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);
+#ifdef REFLECTIONMAP_3D
+#ifdef ROUGHNESS
+float bias=vReflectionInfos.y;
+#ifdef SPECULARTERM
+#ifdef SPECULAR
+#ifdef GLOSSINESS
+bias*=(1.0-specularMapColor.a);
+#endif
+#endif
+#endif
+reflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW,bias);
+#else
+reflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW);
+#endif
+#else
+vec2 coords=vReflectionUVW.xy;
+#ifdef REFLECTIONMAP_PROJECTION
+coords/=vReflectionUVW.z;
+#endif
+coords.y=1.0-coords.y;
+reflectionColor=texture2D(reflection2DSampler,coords);
+#endif
+#ifdef RGBDREFLECTION
+reflectionColor.rgb=fromRGBD(reflectionColor);
+#endif
+#ifdef IS_REFLECTION_LINEAR
+reflectionColor.rgb=toGammaSpace(reflectionColor.rgb);
+#endif
+reflectionColor.rgb*=vReflectionInfos.x;
+#ifdef REFLECTIONFRESNEL
+float reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a);
+#ifdef REFLECTIONFRESNELFROMSPECULAR
+#ifdef SPECULARTERM
+reflectionColor.rgb*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;
+#else
+reflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;
+#endif
+#else
+reflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;
+#endif
+#endif
+#endif
+#ifdef REFRACTIONFRESNEL
+float refractionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,refractionRightColor.a,refractionLeftColor.a);
+refractionColor.rgb*=refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*refractionRightColor.rgb;
+#endif
+#ifdef OPACITY
+vec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);
+#ifdef OPACITYRGB
+opacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);
+alpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;
+#else
+alpha*=opacityMap.a*vOpacityInfos.y;
+#endif
+#endif
+#ifdef VERTEXALPHA
+alpha*=vColor.a;
+#endif
+#ifdef OPACITYFRESNEL
+float opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);
+alpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;
+#endif
+#ifdef ALPHATEST
+#ifdef ALPHATEST_AFTERALLALPHACOMPUTATIONS
+if (alpha
+#include
+
+
+#ifdef IMAGEPROCESSINGPOSTPROCESS
+color.rgb=toLinearSpace(color.rgb);
+#else
+#ifdef IMAGEPROCESSING
+color.rgb=toLinearSpace(color.rgb);
+color=applyImageProcessing(color);
+#endif
+#endif
+color.a*=visibility;
+#ifdef PREMULTIPLYALPHA
+
+color.rgb*=color.a;
+#endif
+#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR
+#ifdef PREPASS
+gl_FragData[0]=color;
+#ifdef PREPASS_POSITION
+gl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,1.0);
+#endif
+#ifdef PREPASS_VELOCITY
+vec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;
+vec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;
+vec2 velocity=abs(a-b);
+velocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;
+gl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,1.0);
+#endif
+#ifdef PREPASS_IRRADIANCE
+gl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(0.0,0.0,0.0,1.0);
+#endif
+#ifdef PREPASS_DEPTHNORMAL
+gl_FragData[PREPASS_DEPTHNORMAL_INDEX]=vec4(vViewPos.z,(view*vec4(normalW,0.0)).rgb);
+#endif
+#ifdef PREPASS_ALBEDO
+gl_FragData[PREPASS_ALBEDO_INDEX]=vec4(0.0,0.0,0.0,1.0);
+#endif
+#ifdef PREPASS_REFLECTIVITY
+#if defined(SPECULAR)
+gl_FragData[PREPASS_REFLECTIVITY_INDEX]=specularMapColor;
+#else
+gl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(0.0,0.0,0.0,1.0);
+#endif
+#endif
+#endif
+#if !defined(PREPASS) || defined(WEBGL2)
+gl_FragColor=color;
+#endif
+}
+`;
+ T.a.ShadersStore.defaultPixelShader = B;
+ var L = `
+uniform mat4 viewProjection;
+uniform mat4 view;
+#ifdef DIFFUSE
+uniform mat4 diffuseMatrix;
+uniform vec2 vDiffuseInfos;
+#endif
+#ifdef AMBIENT
+uniform mat4 ambientMatrix;
+uniform vec2 vAmbientInfos;
+#endif
+#ifdef OPACITY
+uniform mat4 opacityMatrix;
+uniform vec2 vOpacityInfos;
+#endif
+#ifdef EMISSIVE
+uniform vec2 vEmissiveInfos;
+uniform mat4 emissiveMatrix;
+#endif
+#ifdef LIGHTMAP
+uniform vec2 vLightmapInfos;
+uniform mat4 lightmapMatrix;
+#endif
+#if defined(SPECULAR) && defined(SPECULARTERM)
+uniform vec2 vSpecularInfos;
+uniform mat4 specularMatrix;
+#endif
+#ifdef BUMP
+uniform vec3 vBumpInfos;
+uniform mat4 bumpMatrix;
+#endif
+#ifdef REFLECTION
+uniform mat4 reflectionMatrix;
+#endif
+#ifdef POINTSIZE
+uniform float pointSize;
+#endif
+`;
+ T.a.IncludesShadersStore.defaultVertexDeclaration = L, l(78), l(79), l(163), l(164), l(117), l(137), l(93), l(94), l(100), l(80), l(81), l(165), l(156), l(111), l(157), l(138), T.a.IncludesShadersStore.pointCloudVertex = `#ifdef POINTSIZE
+gl_PointSize=pointSize;
+#endif`, l(158);
+ var j = `#include<__decl__defaultVertex>
+
+#define CUSTOM_VERTEX_BEGIN
+attribute vec3 position;
+#ifdef NORMAL
+attribute vec3 normal;
+#endif
+#ifdef TANGENT
+attribute vec4 tangent;
+#endif
+#ifdef UV1
+attribute vec2 uv;
+#endif
+#ifdef UV2
+attribute vec2 uv2;
+#endif
+#ifdef VERTEXCOLOR
+attribute vec4 color;
+#endif
+#include
+#include
+
+#include
+#include
+#ifdef MAINUV1
+varying vec2 vMainUV1;
+#endif
+#ifdef MAINUV2
+varying vec2 vMainUV2;
+#endif
+#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0
+varying vec2 vDiffuseUV;
+#endif
+#if defined(DETAIL) && DETAILDIRECTUV == 0
+varying vec2 vDetailUV;
+#endif
+#if defined(AMBIENT) && AMBIENTDIRECTUV == 0
+varying vec2 vAmbientUV;
+#endif
+#if defined(OPACITY) && OPACITYDIRECTUV == 0
+varying vec2 vOpacityUV;
+#endif
+#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0
+varying vec2 vEmissiveUV;
+#endif
+#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0
+varying vec2 vLightmapUV;
+#endif
+#if defined(SPECULAR) && defined(SPECULARTERM) && SPECULARDIRECTUV == 0
+varying vec2 vSpecularUV;
+#endif
+#if defined(BUMP) && BUMPDIRECTUV == 0
+varying vec2 vBumpUV;
+#endif
+
+varying vec3 vPositionW;
+#ifdef NORMAL
+varying vec3 vNormalW;
+#endif
+#ifdef VERTEXCOLOR
+varying vec4 vColor;
+#endif
+#include
+#include
+#include
+#include<__decl__lightFragment>[0..maxSimultaneousLights]
+#include
+#include[0..maxSimultaneousMorphTargets]
+#ifdef REFLECTIONMAP_SKYBOX
+varying vec3 vPositionUVW;
+#endif
+#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
+varying vec3 vDirectionW;
+#endif
+#include
+#define CUSTOM_VERTEX_DEFINITIONS
+void main(void) {
+#define CUSTOM_VERTEX_MAIN_BEGIN
+vec3 positionUpdated=position;
+#ifdef NORMAL
+vec3 normalUpdated=normal;
+#endif
+#ifdef TANGENT
+vec4 tangentUpdated=tangent;
+#endif
+#ifdef UV1
+vec2 uvUpdated=uv;
+#endif
+#include[0..maxSimultaneousMorphTargets]
+#ifdef REFLECTIONMAP_SKYBOX
+vPositionUVW=positionUpdated;
+#endif
+#define CUSTOM_VERTEX_UPDATE_POSITION
+#define CUSTOM_VERTEX_UPDATE_NORMAL
+#include
+#if defined(PREPASS) && defined(PREPASS_VELOCITY) && !defined(BONES_VELOCITY_ENABLED)
+
+vCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);
+vPreviousPosition=previousViewProjection*previousWorld*vec4(positionUpdated,1.0);
+#endif
+#include
+vec4 worldPos=finalWorld*vec4(positionUpdated,1.0);
+#ifdef NORMAL
+mat3 normalWorld=mat3(finalWorld);
+#if defined(INSTANCES) && defined(THIN_INSTANCES)
+vNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));
+vNormalW=normalize(normalWorld*vNormalW);
+#else
+#ifdef NONUNIFORMSCALING
+normalWorld=transposeMat3(inverseMat3(normalWorld));
+#endif
+vNormalW=normalize(normalWorld*normalUpdated);
+#endif
+#endif
+#define CUSTOM_VERTEX_UPDATE_WORLDPOS
+#ifdef MULTIVIEW
+if (gl_ViewID_OVR == 0u) {
+gl_Position=viewProjection*worldPos;
+} else {
+gl_Position=viewProjectionR*worldPos;
+}
+#else
+gl_Position=viewProjection*worldPos;
+#endif
+vPositionW=vec3(worldPos);
+#include
+#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
+vDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));
+#endif
+
+#ifndef UV1
+vec2 uvUpdated=vec2(0.,0.);
+#endif
+#ifndef UV2
+vec2 uv2=vec2(0.,0.);
+#endif
+#ifdef MAINUV1
+vMainUV1=uvUpdated;
+#endif
+#ifdef MAINUV2
+vMainUV2=uv2;
+#endif
+#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0
+if (vDiffuseInfos.x == 0.)
+{
+vDiffuseUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#if defined(DETAIL) && DETAILDIRECTUV == 0
+if (vDetailInfos.x == 0.)
+{
+vDetailUV=vec2(detailMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vDetailUV=vec2(detailMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#if defined(AMBIENT) && AMBIENTDIRECTUV == 0
+if (vAmbientInfos.x == 0.)
+{
+vAmbientUV=vec2(ambientMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vAmbientUV=vec2(ambientMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#if defined(OPACITY) && OPACITYDIRECTUV == 0
+if (vOpacityInfos.x == 0.)
+{
+vOpacityUV=vec2(opacityMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0
+if (vEmissiveInfos.x == 0.)
+{
+vEmissiveUV=vec2(emissiveMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vEmissiveUV=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0
+if (vLightmapInfos.x == 0.)
+{
+vLightmapUV=vec2(lightmapMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vLightmapUV=vec2(lightmapMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#if defined(SPECULAR) && defined(SPECULARTERM) && SPECULARDIRECTUV == 0
+if (vSpecularInfos.x == 0.)
+{
+vSpecularUV=vec2(specularMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vSpecularUV=vec2(specularMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#if defined(BUMP) && BUMPDIRECTUV == 0
+if (vBumpInfos.x == 0.)
+{
+vBumpUV=vec2(bumpMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#include
+#include
+#include
+#include[0..maxSimultaneousLights]
+#ifdef VERTEXCOLOR
+
+vColor=color;
+#endif
+#include
+#include
+#define CUSTOM_VERTEX_MAIN_END
+}
+`;
+ T.a.ShadersStore.defaultVertexShader = j;
+ var W = l(2), Y = l(67), oe = l(92), te = { effect: null, subMesh: null }, _e = function(ae) {
+ function ie() {
+ var Z = ae.call(this) || this;
+ return Z.MAINUV1 = !1, Z.MAINUV2 = !1, Z.DIFFUSE = !1, Z.DIFFUSEDIRECTUV = 0, Z.DETAIL = !1, Z.DETAILDIRECTUV = 0, Z.DETAIL_NORMALBLENDMETHOD = 0, Z.AMBIENT = !1, Z.AMBIENTDIRECTUV = 0, Z.OPACITY = !1, Z.OPACITYDIRECTUV = 0, Z.OPACITYRGB = !1, Z.REFLECTION = !1, Z.EMISSIVE = !1, Z.EMISSIVEDIRECTUV = 0, Z.SPECULAR = !1, Z.SPECULARDIRECTUV = 0, Z.BUMP = !1, Z.BUMPDIRECTUV = 0, Z.PARALLAX = !1, Z.PARALLAXOCCLUSION = !1, Z.SPECULAROVERALPHA = !1, Z.CLIPPLANE = !1, Z.CLIPPLANE2 = !1, Z.CLIPPLANE3 = !1, Z.CLIPPLANE4 = !1, Z.CLIPPLANE5 = !1, Z.CLIPPLANE6 = !1, Z.ALPHATEST = !1, Z.DEPTHPREPASS = !1, Z.ALPHAFROMDIFFUSE = !1, Z.POINTSIZE = !1, Z.FOG = !1, Z.SPECULARTERM = !1, Z.DIFFUSEFRESNEL = !1, Z.OPACITYFRESNEL = !1, Z.REFLECTIONFRESNEL = !1, Z.REFRACTIONFRESNEL = !1, Z.EMISSIVEFRESNEL = !1, Z.FRESNEL = !1, Z.NORMAL = !1, Z.UV1 = !1, Z.UV2 = !1, Z.VERTEXCOLOR = !1, Z.VERTEXALPHA = !1, Z.NUM_BONE_INFLUENCERS = 0, Z.BonesPerMesh = 0, Z.BONETEXTURE = !1, Z.BONES_VELOCITY_ENABLED = !1, Z.INSTANCES = !1, Z.THIN_INSTANCES = !1, Z.GLOSSINESS = !1, Z.ROUGHNESS = !1, Z.EMISSIVEASILLUMINATION = !1, Z.LINKEMISSIVEWITHDIFFUSE = !1, Z.REFLECTIONFRESNELFROMSPECULAR = !1, Z.LIGHTMAP = !1, Z.LIGHTMAPDIRECTUV = 0, Z.OBJECTSPACE_NORMALMAP = !1, Z.USELIGHTMAPASSHADOWMAP = !1, Z.REFLECTIONMAP_3D = !1, Z.REFLECTIONMAP_SPHERICAL = !1, Z.REFLECTIONMAP_PLANAR = !1, Z.REFLECTIONMAP_CUBIC = !1, Z.USE_LOCAL_REFLECTIONMAP_CUBIC = !1, Z.REFLECTIONMAP_PROJECTION = !1, Z.REFLECTIONMAP_SKYBOX = !1, Z.REFLECTIONMAP_EXPLICIT = !1, Z.REFLECTIONMAP_EQUIRECTANGULAR = !1, Z.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = !1, Z.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = !1, Z.INVERTCUBICMAP = !1, Z.LOGARITHMICDEPTH = !1, Z.REFRACTION = !1, Z.REFRACTIONMAP_3D = !1, Z.REFLECTIONOVERALPHA = !1, Z.TWOSIDEDLIGHTING = !1, Z.SHADOWFLOAT = !1, Z.MORPHTARGETS = !1, Z.MORPHTARGETS_NORMAL = !1, Z.MORPHTARGETS_TANGENT = !1, Z.MORPHTARGETS_UV = !1, Z.NUM_MORPH_INFLUENCERS = 0, Z.NONUNIFORMSCALING = !1, Z.PREMULTIPLYALPHA = !1, Z.ALPHATEST_AFTERALLALPHACOMPUTATIONS = !1, Z.ALPHABLEND = !0, Z.PREPASS = !1, Z.PREPASS_IRRADIANCE = !1, Z.PREPASS_IRRADIANCE_INDEX = -1, Z.PREPASS_ALBEDO = !1, Z.PREPASS_ALBEDO_INDEX = -1, Z.PREPASS_DEPTHNORMAL = !1, Z.PREPASS_DEPTHNORMAL_INDEX = -1, Z.PREPASS_POSITION = !1, Z.PREPASS_POSITION_INDEX = -1, Z.PREPASS_VELOCITY = !1, Z.PREPASS_VELOCITY_INDEX = -1, Z.PREPASS_REFLECTIVITY = !1, Z.PREPASS_REFLECTIVITY_INDEX = -1, Z.SCENE_MRT_COUNT = 0, Z.RGBDLIGHTMAP = !1, Z.RGBDREFLECTION = !1, Z.RGBDREFRACTION = !1, Z.IMAGEPROCESSING = !1, Z.VIGNETTE = !1, Z.VIGNETTEBLENDMODEMULTIPLY = !1, Z.VIGNETTEBLENDMODEOPAQUE = !1, Z.TONEMAPPING = !1, Z.TONEMAPPING_ACES = !1, Z.CONTRAST = !1, Z.COLORCURVES = !1, Z.COLORGRADING = !1, Z.COLORGRADING3D = !1, Z.SAMPLER3DGREENDEPTH = !1, Z.SAMPLER3DBGRMAP = !1, Z.IMAGEPROCESSINGPOSTPROCESS = !1, Z.MULTIVIEW = !1, Z.IS_REFLECTION_LINEAR = !1, Z.IS_REFRACTION_LINEAR = !1, Z.EXPOSURE = !1, Z.rebuild(), Z;
+ }
+ return Object(D.d)(ie, ae), ie.prototype.setReflectionMode = function(Z) {
+ for (var ee = 0, w = ["REFLECTIONMAP_CUBIC", "REFLECTIONMAP_EXPLICIT", "REFLECTIONMAP_PLANAR", "REFLECTIONMAP_PROJECTION", "REFLECTIONMAP_PROJECTION", "REFLECTIONMAP_SKYBOX", "REFLECTIONMAP_SPHERICAL", "REFLECTIONMAP_EQUIRECTANGULAR", "REFLECTIONMAP_EQUIRECTANGULAR_FIXED", "REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED"]; ee < w.length; ee++) {
+ var z = w[ee];
+ this[z] = z === Z;
+ }
+ }, ie;
+ }(A.a), de = function(ae) {
+ function ie(Z, ee) {
+ var w = ae.call(this, Z, ee) || this;
+ return w._diffuseTexture = null, w._ambientTexture = null, w._opacityTexture = null, w._reflectionTexture = null, w._emissiveTexture = null, w._specularTexture = null, w._bumpTexture = null, w._lightmapTexture = null, w._refractionTexture = null, w.ambientColor = new x.a(0, 0, 0), w.diffuseColor = new x.a(1, 1, 1), w.specularColor = new x.a(1, 1, 1), w.emissiveColor = new x.a(0, 0, 0), w.specularPower = 64, w._useAlphaFromDiffuseTexture = !1, w._useEmissiveAsIllumination = !1, w._linkEmissiveWithDiffuse = !1, w._useSpecularOverAlpha = !1, w._useReflectionOverAlpha = !1, w._disableLighting = !1, w._useObjectSpaceNormalMap = !1, w._useParallax = !1, w._useParallaxOcclusion = !1, w.parallaxScaleBias = 0.05, w._roughness = 0, w.indexOfRefraction = 0.98, w.invertRefractionY = !0, w.alphaCutOff = 0.4, w._useLightmapAsShadowmap = !1, w._useReflectionFresnelFromSpecular = !1, w._useGlossinessFromSpecularMapAlpha = !1, w._maxSimultaneousLights = 4, w._invertNormalMapX = !1, w._invertNormalMapY = !1, w._twoSidedLighting = !1, w.detailMap = new oe.a(w._markAllSubMeshesAsTexturesDirty.bind(w)), w._renderTargets = new P.a(16), w._worldViewProjectionMatrix = C.a.Zero(), w._globalAmbientColor = new x.a(0, 0, 0), w._rebuildInParallel = !1, w._attachImageProcessingConfiguration(null), w.prePassConfiguration = new g.a(), w.getRenderTargetTextures = function() {
+ return w._renderTargets.reset(), ie.ReflectionTextureEnabled && w._reflectionTexture && w._reflectionTexture.isRenderTarget && w._renderTargets.push(w._reflectionTexture), ie.RefractionTextureEnabled && w._refractionTexture && w._refractionTexture.isRenderTarget && w._renderTargets.push(w._refractionTexture), w._renderTargets;
+ }, w;
+ }
+ return Object(D.d)(ie, ae), Object.defineProperty(ie.prototype, "imageProcessingConfiguration", { get: function() {
+ return this._imageProcessingConfiguration;
+ }, set: function(Z) {
+ this._attachImageProcessingConfiguration(Z), this._markAllSubMeshesAsTexturesDirty();
+ }, enumerable: !1, configurable: !0 }), ie.prototype._attachImageProcessingConfiguration = function(Z) {
+ var ee = this;
+ Z !== this._imageProcessingConfiguration && (this._imageProcessingConfiguration && this._imageProcessingObserver && this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver), this._imageProcessingConfiguration = Z || this.getScene().imageProcessingConfiguration, this._imageProcessingConfiguration && (this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(function() {
+ ee._markAllSubMeshesAsImageProcessingDirty();
+ })));
+ }, Object.defineProperty(ie.prototype, "cameraColorCurvesEnabled", { get: function() {
+ return this.imageProcessingConfiguration.colorCurvesEnabled;
+ }, set: function(Z) {
+ this.imageProcessingConfiguration.colorCurvesEnabled = Z;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ie.prototype, "cameraColorGradingEnabled", { get: function() {
+ return this.imageProcessingConfiguration.colorGradingEnabled;
+ }, set: function(Z) {
+ this.imageProcessingConfiguration.colorGradingEnabled = Z;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ie.prototype, "cameraToneMappingEnabled", { get: function() {
+ return this._imageProcessingConfiguration.toneMappingEnabled;
+ }, set: function(Z) {
+ this._imageProcessingConfiguration.toneMappingEnabled = Z;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ie.prototype, "cameraExposure", { get: function() {
+ return this._imageProcessingConfiguration.exposure;
+ }, set: function(Z) {
+ this._imageProcessingConfiguration.exposure = Z;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ie.prototype, "cameraContrast", { get: function() {
+ return this._imageProcessingConfiguration.contrast;
+ }, set: function(Z) {
+ this._imageProcessingConfiguration.contrast = Z;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ie.prototype, "cameraColorGradingTexture", { get: function() {
+ return this._imageProcessingConfiguration.colorGradingTexture;
+ }, set: function(Z) {
+ this._imageProcessingConfiguration.colorGradingTexture = Z;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ie.prototype, "cameraColorCurves", { get: function() {
+ return this._imageProcessingConfiguration.colorCurves;
+ }, set: function(Z) {
+ this._imageProcessingConfiguration.colorCurves = Z;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ie.prototype, "canRenderToMRT", { get: function() {
+ return !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ie.prototype, "hasRenderTargetTextures", { get: function() {
+ return !!(ie.ReflectionTextureEnabled && this._reflectionTexture && this._reflectionTexture.isRenderTarget) || !!(ie.RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget);
+ }, enumerable: !1, configurable: !0 }), ie.prototype.getClassName = function() {
+ return "StandardMaterial";
+ }, Object.defineProperty(ie.prototype, "useLogarithmicDepth", { get: function() {
+ return this._useLogarithmicDepth;
+ }, set: function(Z) {
+ this._useLogarithmicDepth = Z && this.getScene().getEngine().getCaps().fragmentDepthSupported, this._markAllSubMeshesAsMiscDirty();
+ }, enumerable: !1, configurable: !0 }), ie.prototype.needAlphaBlending = function() {
+ return !this._disableAlphaBlending && (this.alpha < 1 || this._opacityTexture != null || this._shouldUseAlphaFromDiffuseTexture() || this._opacityFresnelParameters && this._opacityFresnelParameters.isEnabled);
+ }, ie.prototype.needAlphaTesting = function() {
+ return !!this._forceAlphaTest || this._hasAlphaChannel() && (this._transparencyMode == null || this._transparencyMode === E.a.MATERIAL_ALPHATEST);
+ }, ie.prototype._shouldUseAlphaFromDiffuseTexture = function() {
+ return this._diffuseTexture != null && this._diffuseTexture.hasAlpha && this._useAlphaFromDiffuseTexture && this._transparencyMode !== E.a.MATERIAL_OPAQUE;
+ }, ie.prototype._hasAlphaChannel = function() {
+ return this._diffuseTexture != null && this._diffuseTexture.hasAlpha || this._opacityTexture != null;
+ }, ie.prototype.getAlphaTestTexture = function() {
+ return this._diffuseTexture;
+ }, ie.prototype.isReadyForSubMesh = function(Z, ee, w) {
+ if (w === void 0 && (w = !1), ee.effect && this.isFrozen && ee.effect._wasPreviouslyReady)
+ return !0;
+ ee._materialDefines || (ee._materialDefines = new _e());
+ var z = this.getScene(), q = ee._materialDefines;
+ if (this._isReadyForSubMesh(ee))
+ return !0;
+ var le = z.getEngine();
+ if (q._needNormals = v.a.PrepareDefinesForLights(z, Z, q, !0, this._maxSimultaneousLights, this._disableLighting), v.a.PrepareDefinesForMultiview(z, q), v.a.PrepareDefinesForPrePass(z, q, this.canRenderToMRT), q._areTexturesDirty) {
+ if (q._needUVs = !1, q.MAINUV1 = !1, q.MAINUV2 = !1, z.texturesEnabled) {
+ if (this._diffuseTexture && ie.DiffuseTextureEnabled) {
+ if (!this._diffuseTexture.isReadyOrNotBlocking())
+ return !1;
+ v.a.PrepareDefinesForMergedUV(this._diffuseTexture, q, "DIFFUSE");
+ } else
+ q.DIFFUSE = !1;
+ if (this._ambientTexture && ie.AmbientTextureEnabled) {
+ if (!this._ambientTexture.isReadyOrNotBlocking())
+ return !1;
+ v.a.PrepareDefinesForMergedUV(this._ambientTexture, q, "AMBIENT");
+ } else
+ q.AMBIENT = !1;
+ if (this._opacityTexture && ie.OpacityTextureEnabled) {
+ if (!this._opacityTexture.isReadyOrNotBlocking())
+ return !1;
+ v.a.PrepareDefinesForMergedUV(this._opacityTexture, q, "OPACITY"), q.OPACITYRGB = this._opacityTexture.getAlphaFromRGB;
+ } else
+ q.OPACITY = !1;
+ if (this._reflectionTexture && ie.ReflectionTextureEnabled) {
+ if (!this._reflectionTexture.isReadyOrNotBlocking())
+ return !1;
+ switch (q._needNormals = !0, q.REFLECTION = !0, q.ROUGHNESS = this._roughness > 0, q.REFLECTIONOVERALPHA = this._useReflectionOverAlpha, q.INVERTCUBICMAP = this._reflectionTexture.coordinatesMode === h.a.INVCUBIC_MODE, q.REFLECTIONMAP_3D = this._reflectionTexture.isCube, q.RGBDREFLECTION = this._reflectionTexture.isRGBD, this._reflectionTexture.coordinatesMode) {
+ case h.a.EXPLICIT_MODE:
+ q.setReflectionMode("REFLECTIONMAP_EXPLICIT");
+ break;
+ case h.a.PLANAR_MODE:
+ q.setReflectionMode("REFLECTIONMAP_PLANAR");
+ break;
+ case h.a.PROJECTION_MODE:
+ q.setReflectionMode("REFLECTIONMAP_PROJECTION");
+ break;
+ case h.a.SKYBOX_MODE:
+ q.setReflectionMode("REFLECTIONMAP_SKYBOX");
+ break;
+ case h.a.SPHERICAL_MODE:
+ q.setReflectionMode("REFLECTIONMAP_SPHERICAL");
+ break;
+ case h.a.EQUIRECTANGULAR_MODE:
+ q.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR");
+ break;
+ case h.a.FIXED_EQUIRECTANGULAR_MODE:
+ q.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR_FIXED");
+ break;
+ case h.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:
+ q.setReflectionMode("REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED");
+ break;
+ case h.a.CUBIC_MODE:
+ case h.a.INVCUBIC_MODE:
+ default:
+ q.setReflectionMode("REFLECTIONMAP_CUBIC");
+ }
+ q.USE_LOCAL_REFLECTIONMAP_CUBIC = !!this._reflectionTexture.boundingBoxSize;
+ } else
+ q.REFLECTION = !1;
+ if (this._emissiveTexture && ie.EmissiveTextureEnabled) {
+ if (!this._emissiveTexture.isReadyOrNotBlocking())
+ return !1;
+ v.a.PrepareDefinesForMergedUV(this._emissiveTexture, q, "EMISSIVE");
+ } else
+ q.EMISSIVE = !1;
+ if (this._lightmapTexture && ie.LightmapTextureEnabled) {
+ if (!this._lightmapTexture.isReadyOrNotBlocking())
+ return !1;
+ v.a.PrepareDefinesForMergedUV(this._lightmapTexture, q, "LIGHTMAP"), q.USELIGHTMAPASSHADOWMAP = this._useLightmapAsShadowmap, q.RGBDLIGHTMAP = this._lightmapTexture.isRGBD;
+ } else
+ q.LIGHTMAP = !1;
+ if (this._specularTexture && ie.SpecularTextureEnabled) {
+ if (!this._specularTexture.isReadyOrNotBlocking())
+ return !1;
+ v.a.PrepareDefinesForMergedUV(this._specularTexture, q, "SPECULAR"), q.GLOSSINESS = this._useGlossinessFromSpecularMapAlpha;
+ } else
+ q.SPECULAR = !1;
+ if (z.getEngine().getCaps().standardDerivatives && this._bumpTexture && ie.BumpTextureEnabled) {
+ if (!this._bumpTexture.isReady())
+ return !1;
+ v.a.PrepareDefinesForMergedUV(this._bumpTexture, q, "BUMP"), q.PARALLAX = this._useParallax, q.PARALLAXOCCLUSION = this._useParallaxOcclusion, q.OBJECTSPACE_NORMALMAP = this._useObjectSpaceNormalMap;
+ } else
+ q.BUMP = !1;
+ if (this._refractionTexture && ie.RefractionTextureEnabled) {
+ if (!this._refractionTexture.isReadyOrNotBlocking())
+ return !1;
+ q._needUVs = !0, q.REFRACTION = !0, q.REFRACTIONMAP_3D = this._refractionTexture.isCube, q.RGBDREFRACTION = this._refractionTexture.isRGBD;
+ } else
+ q.REFRACTION = !1;
+ q.TWOSIDEDLIGHTING = !this._backFaceCulling && this._twoSidedLighting;
+ } else
+ q.DIFFUSE = !1, q.AMBIENT = !1, q.OPACITY = !1, q.REFLECTION = !1, q.EMISSIVE = !1, q.LIGHTMAP = !1, q.BUMP = !1, q.REFRACTION = !1;
+ q.ALPHAFROMDIFFUSE = this._shouldUseAlphaFromDiffuseTexture(), q.EMISSIVEASILLUMINATION = this._useEmissiveAsIllumination, q.LINKEMISSIVEWITHDIFFUSE = this._linkEmissiveWithDiffuse, q.SPECULAROVERALPHA = this._useSpecularOverAlpha, q.PREMULTIPLYALPHA = this.alphaMode === W.a.ALPHA_PREMULTIPLIED || this.alphaMode === W.a.ALPHA_PREMULTIPLIED_PORTERDUFF, q.ALPHATEST_AFTERALLALPHACOMPUTATIONS = this.transparencyMode !== null, q.ALPHABLEND = this.transparencyMode === null || this.needAlphaBlendingForMesh(Z);
+ }
+ if (!this.detailMap.isReadyForSubMesh(q, z))
+ return !1;
+ if (q._areImageProcessingDirty && this._imageProcessingConfiguration) {
+ if (!this._imageProcessingConfiguration.isReady())
+ return !1;
+ this._imageProcessingConfiguration.prepareDefines(q), q.IS_REFLECTION_LINEAR = this.reflectionTexture != null && !this.reflectionTexture.gammaSpace, q.IS_REFRACTION_LINEAR = this.refractionTexture != null && !this.refractionTexture.gammaSpace;
+ }
+ if (q._areFresnelDirty && (ie.FresnelEnabled ? (this._diffuseFresnelParameters || this._opacityFresnelParameters || this._emissiveFresnelParameters || this._refractionFresnelParameters || this._reflectionFresnelParameters) && (q.DIFFUSEFRESNEL = this._diffuseFresnelParameters && this._diffuseFresnelParameters.isEnabled, q.OPACITYFRESNEL = this._opacityFresnelParameters && this._opacityFresnelParameters.isEnabled, q.REFLECTIONFRESNEL = this._reflectionFresnelParameters && this._reflectionFresnelParameters.isEnabled, q.REFLECTIONFRESNELFROMSPECULAR = this._useReflectionFresnelFromSpecular, q.REFRACTIONFRESNEL = this._refractionFresnelParameters && this._refractionFresnelParameters.isEnabled, q.EMISSIVEFRESNEL = this._emissiveFresnelParameters && this._emissiveFresnelParameters.isEnabled, q._needNormals = !0, q.FRESNEL = !0) : q.FRESNEL = !1), v.a.PrepareDefinesForMisc(Z, z, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(Z) || this._forceAlphaTest, q), v.a.PrepareDefinesForAttributes(Z, q, !0, !0, !0), v.a.PrepareDefinesForFrameBoundValues(z, le, q, w, null, ee.getRenderingMesh().hasThinInstances), this.detailMap.prepareDefines(q, z), q.isDirty) {
+ var ce = q._areLightsDisposed;
+ q.markAsProcessed();
+ var J = new Y.a();
+ q.REFLECTION && J.addFallback(0, "REFLECTION"), q.SPECULAR && J.addFallback(0, "SPECULAR"), q.BUMP && J.addFallback(0, "BUMP"), q.PARALLAX && J.addFallback(1, "PARALLAX"), q.PARALLAXOCCLUSION && J.addFallback(0, "PARALLAXOCCLUSION"), q.SPECULAROVERALPHA && J.addFallback(0, "SPECULAROVERALPHA"), q.FOG && J.addFallback(1, "FOG"), q.POINTSIZE && J.addFallback(0, "POINTSIZE"), q.LOGARITHMICDEPTH && J.addFallback(0, "LOGARITHMICDEPTH"), v.a.HandleFallbacksForShadows(q, J, this._maxSimultaneousLights), q.SPECULARTERM && J.addFallback(0, "SPECULARTERM"), q.DIFFUSEFRESNEL && J.addFallback(1, "DIFFUSEFRESNEL"), q.OPACITYFRESNEL && J.addFallback(2, "OPACITYFRESNEL"), q.REFLECTIONFRESNEL && J.addFallback(3, "REFLECTIONFRESNEL"), q.EMISSIVEFRESNEL && J.addFallback(4, "EMISSIVEFRESNEL"), q.FRESNEL && J.addFallback(4, "FRESNEL"), q.MULTIVIEW && J.addFallback(0, "MULTIVIEW");
+ var H = [R.b.PositionKind];
+ q.NORMAL && H.push(R.b.NormalKind), q.UV1 && H.push(R.b.UVKind), q.UV2 && H.push(R.b.UV2Kind), q.VERTEXCOLOR && H.push(R.b.ColorKind), v.a.PrepareAttributesForBones(H, Z, q, J), v.a.PrepareAttributesForInstances(H, q), v.a.PrepareAttributesForMorphTargets(H, Z, q);
+ var X = "default", ne = ["world", "view", "viewProjection", "vEyePosition", "vLightsType", "vAmbientColor", "vDiffuseColor", "vSpecularColor", "vEmissiveColor", "visibility", "vFogInfos", "vFogColor", "pointSize", "vDiffuseInfos", "vAmbientInfos", "vOpacityInfos", "vReflectionInfos", "vEmissiveInfos", "vSpecularInfos", "vBumpInfos", "vLightmapInfos", "vRefractionInfos", "mBones", "vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6", "diffuseMatrix", "ambientMatrix", "opacityMatrix", "reflectionMatrix", "emissiveMatrix", "specularMatrix", "bumpMatrix", "normalMatrix", "lightmapMatrix", "refractionMatrix", "diffuseLeftColor", "diffuseRightColor", "opacityParts", "reflectionLeftColor", "reflectionRightColor", "emissiveLeftColor", "emissiveRightColor", "refractionLeftColor", "refractionRightColor", "vReflectionPosition", "vReflectionSize", "logarithmicDepthConstant", "vTangentSpaceParams", "alphaCutOff", "boneTextureWidth"], Q = ["diffuseSampler", "ambientSampler", "opacitySampler", "reflectionCubeSampler", "reflection2DSampler", "emissiveSampler", "specularSampler", "bumpSampler", "lightmapSampler", "refractionCubeSampler", "refraction2DSampler", "boneSampler"], $ = ["Material", "Scene"];
+ oe.a.AddUniforms(ne), oe.a.AddSamplers(Q), g.a.AddUniforms(ne), g.a.AddSamplers(ne), u.a && (u.a.PrepareUniforms(ne, q), u.a.PrepareSamplers(Q, q)), v.a.PrepareUniformsAndSamplersList({ uniformsNames: ne, uniformBuffersNames: $, samplers: Q, defines: q, maxSimultaneousLights: this._maxSimultaneousLights });
+ var me = {};
+ this.customShaderNameResolve && (X = this.customShaderNameResolve(X, ne, $, Q, q, H, me));
+ var ye = q.toString(), be = ee.effect, ge = z.getEngine().createEffect(X, { attributes: H, uniformsNames: ne, uniformBuffersNames: $, samplers: Q, defines: ye, fallbacks: J, onCompiled: this.onCompiled, onError: this.onError, indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights, maxSimultaneousMorphTargets: q.NUM_MORPH_INFLUENCERS }, processFinalCode: me.processFinalCode, multiTarget: q.PREPASS }, le);
+ if (ge)
+ if (this._onEffectCreatedObservable && (te.effect = ge, te.subMesh = ee, this._onEffectCreatedObservable.notifyObservers(te)), this.allowShaderHotSwapping && be && !ge.isReady()) {
+ if (ge = be, this._rebuildInParallel = !0, q.markAsUnprocessed(), ce)
+ return q._areLightsDisposed = !0, !1;
+ } else
+ this._rebuildInParallel = !1, z.resetCachedMaterial(), ee.setEffect(ge, q), this.buildUniformLayout();
+ }
+ return !(!ee.effect || !ee.effect.isReady()) && (q._renderId = z.getRenderId(), ee.effect._wasPreviouslyReady = !0, !0);
+ }, ie.prototype.buildUniformLayout = function() {
+ var Z = this._uniformBuffer;
+ Z.addUniform("diffuseLeftColor", 4), Z.addUniform("diffuseRightColor", 4), Z.addUniform("opacityParts", 4), Z.addUniform("reflectionLeftColor", 4), Z.addUniform("reflectionRightColor", 4), Z.addUniform("refractionLeftColor", 4), Z.addUniform("refractionRightColor", 4), Z.addUniform("emissiveLeftColor", 4), Z.addUniform("emissiveRightColor", 4), Z.addUniform("vDiffuseInfos", 2), Z.addUniform("vAmbientInfos", 2), Z.addUniform("vOpacityInfos", 2), Z.addUniform("vReflectionInfos", 2), Z.addUniform("vReflectionPosition", 3), Z.addUniform("vReflectionSize", 3), Z.addUniform("vEmissiveInfos", 2), Z.addUniform("vLightmapInfos", 2), Z.addUniform("vSpecularInfos", 2), Z.addUniform("vBumpInfos", 3), Z.addUniform("diffuseMatrix", 16), Z.addUniform("ambientMatrix", 16), Z.addUniform("opacityMatrix", 16), Z.addUniform("reflectionMatrix", 16), Z.addUniform("emissiveMatrix", 16), Z.addUniform("lightmapMatrix", 16), Z.addUniform("specularMatrix", 16), Z.addUniform("bumpMatrix", 16), Z.addUniform("vTangentSpaceParams", 2), Z.addUniform("pointSize", 1), Z.addUniform("refractionMatrix", 16), Z.addUniform("vRefractionInfos", 4), Z.addUniform("vSpecularColor", 4), Z.addUniform("vEmissiveColor", 3), Z.addUniform("visibility", 1), Z.addUniform("vDiffuseColor", 4), oe.a.PrepareUniformBuffer(Z), Z.create();
+ }, ie.prototype.unbind = function() {
+ if (this._activeEffect) {
+ var Z = !1;
+ this._reflectionTexture && this._reflectionTexture.isRenderTarget && (this._activeEffect.setTexture("reflection2DSampler", null), Z = !0), this._refractionTexture && this._refractionTexture.isRenderTarget && (this._activeEffect.setTexture("refraction2DSampler", null), Z = !0), Z && this._markAllSubMeshesAsTexturesDirty();
+ }
+ ae.prototype.unbind.call(this);
+ }, ie.prototype.bindForSubMesh = function(Z, ee, w) {
+ var z = this.getScene(), q = w._materialDefines;
+ if (q) {
+ var le = w.effect;
+ if (le) {
+ this._activeEffect = le, q.INSTANCES && !q.THIN_INSTANCES || this.bindOnlyWorldMatrix(Z), this.prePassConfiguration.bindForSubMesh(this._activeEffect, z, ee, Z, this.isFrozen), q.OBJECTSPACE_NORMALMAP && (Z.toNormalMatrix(this._normalMatrix), this.bindOnlyNormalMatrix(this._normalMatrix));
+ var ce = this._mustRebind(z, le, ee.visibility);
+ v.a.BindBonesParameters(ee, le);
+ var J = this._uniformBuffer;
+ if (ce) {
+ if (J.bindToEffect(le, "Material"), this.bindViewProjection(le), !J.useUbo || !this.isFrozen || !J.isSync) {
+ if (ie.FresnelEnabled && q.FRESNEL && (this.diffuseFresnelParameters && this.diffuseFresnelParameters.isEnabled && (J.updateColor4("diffuseLeftColor", this.diffuseFresnelParameters.leftColor, this.diffuseFresnelParameters.power), J.updateColor4("diffuseRightColor", this.diffuseFresnelParameters.rightColor, this.diffuseFresnelParameters.bias)), this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled && J.updateColor4("opacityParts", new x.a(this.opacityFresnelParameters.leftColor.toLuminance(), this.opacityFresnelParameters.rightColor.toLuminance(), this.opacityFresnelParameters.bias), this.opacityFresnelParameters.power), this.reflectionFresnelParameters && this.reflectionFresnelParameters.isEnabled && (J.updateColor4("reflectionLeftColor", this.reflectionFresnelParameters.leftColor, this.reflectionFresnelParameters.power), J.updateColor4("reflectionRightColor", this.reflectionFresnelParameters.rightColor, this.reflectionFresnelParameters.bias)), this.refractionFresnelParameters && this.refractionFresnelParameters.isEnabled && (J.updateColor4("refractionLeftColor", this.refractionFresnelParameters.leftColor, this.refractionFresnelParameters.power), J.updateColor4("refractionRightColor", this.refractionFresnelParameters.rightColor, this.refractionFresnelParameters.bias)), this.emissiveFresnelParameters && this.emissiveFresnelParameters.isEnabled && (J.updateColor4("emissiveLeftColor", this.emissiveFresnelParameters.leftColor, this.emissiveFresnelParameters.power), J.updateColor4("emissiveRightColor", this.emissiveFresnelParameters.rightColor, this.emissiveFresnelParameters.bias))), z.texturesEnabled) {
+ if (this._diffuseTexture && ie.DiffuseTextureEnabled && (J.updateFloat2("vDiffuseInfos", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level), v.a.BindTextureMatrix(this._diffuseTexture, J, "diffuse")), this._ambientTexture && ie.AmbientTextureEnabled && (J.updateFloat2("vAmbientInfos", this._ambientTexture.coordinatesIndex, this._ambientTexture.level), v.a.BindTextureMatrix(this._ambientTexture, J, "ambient")), this._opacityTexture && ie.OpacityTextureEnabled && (J.updateFloat2("vOpacityInfos", this._opacityTexture.coordinatesIndex, this._opacityTexture.level), v.a.BindTextureMatrix(this._opacityTexture, J, "opacity")), this._hasAlphaChannel() && le.setFloat("alphaCutOff", this.alphaCutOff), this._reflectionTexture && ie.ReflectionTextureEnabled && (J.updateFloat2("vReflectionInfos", this._reflectionTexture.level, this.roughness), J.updateMatrix("reflectionMatrix", this._reflectionTexture.getReflectionTextureMatrix()), this._reflectionTexture.boundingBoxSize)) {
+ var H = this._reflectionTexture;
+ J.updateVector3("vReflectionPosition", H.boundingBoxPosition), J.updateVector3("vReflectionSize", H.boundingBoxSize);
+ }
+ if (this._emissiveTexture && ie.EmissiveTextureEnabled && (J.updateFloat2("vEmissiveInfos", this._emissiveTexture.coordinatesIndex, this._emissiveTexture.level), v.a.BindTextureMatrix(this._emissiveTexture, J, "emissive")), this._lightmapTexture && ie.LightmapTextureEnabled && (J.updateFloat2("vLightmapInfos", this._lightmapTexture.coordinatesIndex, this._lightmapTexture.level), v.a.BindTextureMatrix(this._lightmapTexture, J, "lightmap")), this._specularTexture && ie.SpecularTextureEnabled && (J.updateFloat2("vSpecularInfos", this._specularTexture.coordinatesIndex, this._specularTexture.level), v.a.BindTextureMatrix(this._specularTexture, J, "specular")), this._bumpTexture && z.getEngine().getCaps().standardDerivatives && ie.BumpTextureEnabled && (J.updateFloat3("vBumpInfos", this._bumpTexture.coordinatesIndex, 1 / this._bumpTexture.level, this.parallaxScaleBias), v.a.BindTextureMatrix(this._bumpTexture, J, "bump"), z._mirroredCameraPosition ? J.updateFloat2("vTangentSpaceParams", this._invertNormalMapX ? 1 : -1, this._invertNormalMapY ? 1 : -1) : J.updateFloat2("vTangentSpaceParams", this._invertNormalMapX ? -1 : 1, this._invertNormalMapY ? -1 : 1)), this._refractionTexture && ie.RefractionTextureEnabled) {
+ var X = 1;
+ this._refractionTexture.isCube || (J.updateMatrix("refractionMatrix", this._refractionTexture.getReflectionTextureMatrix()), this._refractionTexture.depth && (X = this._refractionTexture.depth)), J.updateFloat4("vRefractionInfos", this._refractionTexture.level, this.indexOfRefraction, X, this.invertRefractionY ? -1 : 1);
+ }
+ }
+ this.pointsCloud && J.updateFloat("pointSize", this.pointSize), q.SPECULARTERM && J.updateColor4("vSpecularColor", this.specularColor, this.specularPower), J.updateColor3("vEmissiveColor", ie.EmissiveTextureEnabled ? this.emissiveColor : x.a.BlackReadOnly), J.updateColor4("vDiffuseColor", this.diffuseColor, this.alpha);
+ }
+ J.updateFloat("visibility", ee.visibility), z.texturesEnabled && (this._diffuseTexture && ie.DiffuseTextureEnabled && le.setTexture("diffuseSampler", this._diffuseTexture), this._ambientTexture && ie.AmbientTextureEnabled && le.setTexture("ambientSampler", this._ambientTexture), this._opacityTexture && ie.OpacityTextureEnabled && le.setTexture("opacitySampler", this._opacityTexture), this._reflectionTexture && ie.ReflectionTextureEnabled && (this._reflectionTexture.isCube ? le.setTexture("reflectionCubeSampler", this._reflectionTexture) : le.setTexture("reflection2DSampler", this._reflectionTexture)), this._emissiveTexture && ie.EmissiveTextureEnabled && le.setTexture("emissiveSampler", this._emissiveTexture), this._lightmapTexture && ie.LightmapTextureEnabled && le.setTexture("lightmapSampler", this._lightmapTexture), this._specularTexture && ie.SpecularTextureEnabled && le.setTexture("specularSampler", this._specularTexture), this._bumpTexture && z.getEngine().getCaps().standardDerivatives && ie.BumpTextureEnabled && le.setTexture("bumpSampler", this._bumpTexture), this._refractionTexture && ie.RefractionTextureEnabled) && (X = 1, this._refractionTexture.isCube ? le.setTexture("refractionCubeSampler", this._refractionTexture) : le.setTexture("refraction2DSampler", this._refractionTexture)), this.detailMap.bindForSubMesh(J, z, this.isFrozen), v.a.BindClipPlane(le, z), z.ambientColor.multiplyToRef(this.ambientColor, this._globalAmbientColor), v.a.BindEyePosition(le, z), le.setColor3("vAmbientColor", this._globalAmbientColor);
+ }
+ !ce && this.isFrozen || (z.lightsEnabled && !this._disableLighting && v.a.BindLights(z, ee, le, q, this._maxSimultaneousLights, this._rebuildInParallel), (z.fogEnabled && ee.applyFog && z.fogMode !== c.a.FOGMODE_NONE || this._reflectionTexture || this._refractionTexture) && this.bindView(le), v.a.BindFogParameters(z, ee, le), q.NUM_MORPH_INFLUENCERS && v.a.BindMorphTargetParameters(ee, le), this.useLogarithmicDepth && v.a.BindLogDepth(q, le, z), this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess && this._imageProcessingConfiguration.bind(this._activeEffect)), J.update(), this._afterBind(ee, this._activeEffect);
+ }
+ }
+ }, ie.prototype.getAnimatables = function() {
+ var Z = [];
+ return this._diffuseTexture && this._diffuseTexture.animations && this._diffuseTexture.animations.length > 0 && Z.push(this._diffuseTexture), this._ambientTexture && this._ambientTexture.animations && this._ambientTexture.animations.length > 0 && Z.push(this._ambientTexture), this._opacityTexture && this._opacityTexture.animations && this._opacityTexture.animations.length > 0 && Z.push(this._opacityTexture), this._reflectionTexture && this._reflectionTexture.animations && this._reflectionTexture.animations.length > 0 && Z.push(this._reflectionTexture), this._emissiveTexture && this._emissiveTexture.animations && this._emissiveTexture.animations.length > 0 && Z.push(this._emissiveTexture), this._specularTexture && this._specularTexture.animations && this._specularTexture.animations.length > 0 && Z.push(this._specularTexture), this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0 && Z.push(this._bumpTexture), this._lightmapTexture && this._lightmapTexture.animations && this._lightmapTexture.animations.length > 0 && Z.push(this._lightmapTexture), this._refractionTexture && this._refractionTexture.animations && this._refractionTexture.animations.length > 0 && Z.push(this._refractionTexture), this.detailMap.getAnimatables(Z), Z;
+ }, ie.prototype.getActiveTextures = function() {
+ var Z = ae.prototype.getActiveTextures.call(this);
+ return this._diffuseTexture && Z.push(this._diffuseTexture), this._ambientTexture && Z.push(this._ambientTexture), this._opacityTexture && Z.push(this._opacityTexture), this._reflectionTexture && Z.push(this._reflectionTexture), this._emissiveTexture && Z.push(this._emissiveTexture), this._specularTexture && Z.push(this._specularTexture), this._bumpTexture && Z.push(this._bumpTexture), this._lightmapTexture && Z.push(this._lightmapTexture), this._refractionTexture && Z.push(this._refractionTexture), this.detailMap.getActiveTextures(Z), Z;
+ }, ie.prototype.hasTexture = function(Z) {
+ return !!ae.prototype.hasTexture.call(this, Z) || this._diffuseTexture === Z || this._ambientTexture === Z || this._opacityTexture === Z || this._reflectionTexture === Z || this._emissiveTexture === Z || this._specularTexture === Z || this._bumpTexture === Z || this._lightmapTexture === Z || this._refractionTexture === Z || this.detailMap.hasTexture(Z);
+ }, ie.prototype.dispose = function(Z, ee) {
+ var w, z, q, le, ce, J, H, X, ne;
+ ee && ((w = this._diffuseTexture) === null || w === void 0 || w.dispose(), (z = this._ambientTexture) === null || z === void 0 || z.dispose(), (q = this._opacityTexture) === null || q === void 0 || q.dispose(), (le = this._reflectionTexture) === null || le === void 0 || le.dispose(), (ce = this._emissiveTexture) === null || ce === void 0 || ce.dispose(), (J = this._specularTexture) === null || J === void 0 || J.dispose(), (H = this._bumpTexture) === null || H === void 0 || H.dispose(), (X = this._lightmapTexture) === null || X === void 0 || X.dispose(), (ne = this._refractionTexture) === null || ne === void 0 || ne.dispose()), this.detailMap.dispose(ee), this._imageProcessingConfiguration && this._imageProcessingObserver && this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver), ae.prototype.dispose.call(this, Z, ee);
+ }, ie.prototype.clone = function(Z) {
+ var ee = this, w = f.a.Clone(function() {
+ return new ie(Z, ee.getScene());
+ }, this);
+ return w.name = Z, w.id = Z, w;
+ }, ie.prototype.serialize = function() {
+ return f.a.Serialize(this);
+ }, ie.Parse = function(Z, ee, w) {
+ return f.a.Parse(function() {
+ return new ie(Z.name, ee);
+ }, Z, ee, w);
+ }, Object.defineProperty(ie, "DiffuseTextureEnabled", { get: function() {
+ return b.a.DiffuseTextureEnabled;
+ }, set: function(Z) {
+ b.a.DiffuseTextureEnabled = Z;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ie, "DetailTextureEnabled", { get: function() {
+ return b.a.DetailTextureEnabled;
+ }, set: function(Z) {
+ b.a.DetailTextureEnabled = Z;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ie, "AmbientTextureEnabled", { get: function() {
+ return b.a.AmbientTextureEnabled;
+ }, set: function(Z) {
+ b.a.AmbientTextureEnabled = Z;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ie, "OpacityTextureEnabled", { get: function() {
+ return b.a.OpacityTextureEnabled;
+ }, set: function(Z) {
+ b.a.OpacityTextureEnabled = Z;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ie, "ReflectionTextureEnabled", { get: function() {
+ return b.a.ReflectionTextureEnabled;
+ }, set: function(Z) {
+ b.a.ReflectionTextureEnabled = Z;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ie, "EmissiveTextureEnabled", { get: function() {
+ return b.a.EmissiveTextureEnabled;
+ }, set: function(Z) {
+ b.a.EmissiveTextureEnabled = Z;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ie, "SpecularTextureEnabled", { get: function() {
+ return b.a.SpecularTextureEnabled;
+ }, set: function(Z) {
+ b.a.SpecularTextureEnabled = Z;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ie, "BumpTextureEnabled", { get: function() {
+ return b.a.BumpTextureEnabled;
+ }, set: function(Z) {
+ b.a.BumpTextureEnabled = Z;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ie, "LightmapTextureEnabled", { get: function() {
+ return b.a.LightmapTextureEnabled;
+ }, set: function(Z) {
+ b.a.LightmapTextureEnabled = Z;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ie, "RefractionTextureEnabled", { get: function() {
+ return b.a.RefractionTextureEnabled;
+ }, set: function(Z) {
+ b.a.RefractionTextureEnabled = Z;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ie, "ColorGradingTextureEnabled", { get: function() {
+ return b.a.ColorGradingTextureEnabled;
+ }, set: function(Z) {
+ b.a.ColorGradingTextureEnabled = Z;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ie, "FresnelEnabled", { get: function() {
+ return b.a.FresnelEnabled;
+ }, set: function(Z) {
+ b.a.FresnelEnabled = Z;
+ }, enumerable: !1, configurable: !0 }), Object(D.c)([Object(f.m)("diffuseTexture")], ie.prototype, "_diffuseTexture", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsTexturesAndMiscDirty")], ie.prototype, "diffuseTexture", void 0), Object(D.c)([Object(f.m)("ambientTexture")], ie.prototype, "_ambientTexture", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsTexturesDirty")], ie.prototype, "ambientTexture", void 0), Object(D.c)([Object(f.m)("opacityTexture")], ie.prototype, "_opacityTexture", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsTexturesAndMiscDirty")], ie.prototype, "opacityTexture", void 0), Object(D.c)([Object(f.m)("reflectionTexture")], ie.prototype, "_reflectionTexture", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsTexturesDirty")], ie.prototype, "reflectionTexture", void 0), Object(D.c)([Object(f.m)("emissiveTexture")], ie.prototype, "_emissiveTexture", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsTexturesDirty")], ie.prototype, "emissiveTexture", void 0), Object(D.c)([Object(f.m)("specularTexture")], ie.prototype, "_specularTexture", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsTexturesDirty")], ie.prototype, "specularTexture", void 0), Object(D.c)([Object(f.m)("bumpTexture")], ie.prototype, "_bumpTexture", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsTexturesDirty")], ie.prototype, "bumpTexture", void 0), Object(D.c)([Object(f.m)("lightmapTexture")], ie.prototype, "_lightmapTexture", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsTexturesDirty")], ie.prototype, "lightmapTexture", void 0), Object(D.c)([Object(f.m)("refractionTexture")], ie.prototype, "_refractionTexture", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsTexturesDirty")], ie.prototype, "refractionTexture", void 0), Object(D.c)([Object(f.e)("ambient")], ie.prototype, "ambientColor", void 0), Object(D.c)([Object(f.e)("diffuse")], ie.prototype, "diffuseColor", void 0), Object(D.c)([Object(f.e)("specular")], ie.prototype, "specularColor", void 0), Object(D.c)([Object(f.e)("emissive")], ie.prototype, "emissiveColor", void 0), Object(D.c)([Object(f.c)()], ie.prototype, "specularPower", void 0), Object(D.c)([Object(f.c)("useAlphaFromDiffuseTexture")], ie.prototype, "_useAlphaFromDiffuseTexture", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsTexturesAndMiscDirty")], ie.prototype, "useAlphaFromDiffuseTexture", void 0), Object(D.c)([Object(f.c)("useEmissiveAsIllumination")], ie.prototype, "_useEmissiveAsIllumination", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsTexturesDirty")], ie.prototype, "useEmissiveAsIllumination", void 0), Object(D.c)([Object(f.c)("linkEmissiveWithDiffuse")], ie.prototype, "_linkEmissiveWithDiffuse", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsTexturesDirty")], ie.prototype, "linkEmissiveWithDiffuse", void 0), Object(D.c)([Object(f.c)("useSpecularOverAlpha")], ie.prototype, "_useSpecularOverAlpha", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsTexturesDirty")], ie.prototype, "useSpecularOverAlpha", void 0), Object(D.c)([Object(f.c)("useReflectionOverAlpha")], ie.prototype, "_useReflectionOverAlpha", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsTexturesDirty")], ie.prototype, "useReflectionOverAlpha", void 0), Object(D.c)([Object(f.c)("disableLighting")], ie.prototype, "_disableLighting", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsLightsDirty")], ie.prototype, "disableLighting", void 0), Object(D.c)([Object(f.c)("useObjectSpaceNormalMap")], ie.prototype, "_useObjectSpaceNormalMap", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsTexturesDirty")], ie.prototype, "useObjectSpaceNormalMap", void 0), Object(D.c)([Object(f.c)("useParallax")], ie.prototype, "_useParallax", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsTexturesDirty")], ie.prototype, "useParallax", void 0), Object(D.c)([Object(f.c)("useParallaxOcclusion")], ie.prototype, "_useParallaxOcclusion", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsTexturesDirty")], ie.prototype, "useParallaxOcclusion", void 0), Object(D.c)([Object(f.c)()], ie.prototype, "parallaxScaleBias", void 0), Object(D.c)([Object(f.c)("roughness")], ie.prototype, "_roughness", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsTexturesDirty")], ie.prototype, "roughness", void 0), Object(D.c)([Object(f.c)()], ie.prototype, "indexOfRefraction", void 0), Object(D.c)([Object(f.c)()], ie.prototype, "invertRefractionY", void 0), Object(D.c)([Object(f.c)()], ie.prototype, "alphaCutOff", void 0), Object(D.c)([Object(f.c)("useLightmapAsShadowmap")], ie.prototype, "_useLightmapAsShadowmap", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsTexturesDirty")], ie.prototype, "useLightmapAsShadowmap", void 0), Object(D.c)([Object(f.h)("diffuseFresnelParameters")], ie.prototype, "_diffuseFresnelParameters", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsFresnelDirty")], ie.prototype, "diffuseFresnelParameters", void 0), Object(D.c)([Object(f.h)("opacityFresnelParameters")], ie.prototype, "_opacityFresnelParameters", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsFresnelAndMiscDirty")], ie.prototype, "opacityFresnelParameters", void 0), Object(D.c)([Object(f.h)("reflectionFresnelParameters")], ie.prototype, "_reflectionFresnelParameters", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsFresnelDirty")], ie.prototype, "reflectionFresnelParameters", void 0), Object(D.c)([Object(f.h)("refractionFresnelParameters")], ie.prototype, "_refractionFresnelParameters", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsFresnelDirty")], ie.prototype, "refractionFresnelParameters", void 0), Object(D.c)([Object(f.h)("emissiveFresnelParameters")], ie.prototype, "_emissiveFresnelParameters", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsFresnelDirty")], ie.prototype, "emissiveFresnelParameters", void 0), Object(D.c)([Object(f.c)("useReflectionFresnelFromSpecular")], ie.prototype, "_useReflectionFresnelFromSpecular", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsFresnelDirty")], ie.prototype, "useReflectionFresnelFromSpecular", void 0), Object(D.c)([Object(f.c)("useGlossinessFromSpecularMapAlpha")], ie.prototype, "_useGlossinessFromSpecularMapAlpha", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsTexturesDirty")], ie.prototype, "useGlossinessFromSpecularMapAlpha", void 0), Object(D.c)([Object(f.c)("maxSimultaneousLights")], ie.prototype, "_maxSimultaneousLights", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsLightsDirty")], ie.prototype, "maxSimultaneousLights", void 0), Object(D.c)([Object(f.c)("invertNormalMapX")], ie.prototype, "_invertNormalMapX", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsTexturesDirty")], ie.prototype, "invertNormalMapX", void 0), Object(D.c)([Object(f.c)("invertNormalMapY")], ie.prototype, "_invertNormalMapY", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsTexturesDirty")], ie.prototype, "invertNormalMapY", void 0), Object(D.c)([Object(f.c)("twoSidedLighting")], ie.prototype, "_twoSidedLighting", void 0), Object(D.c)([Object(f.b)("_markAllSubMeshesAsTexturesDirty")], ie.prototype, "twoSidedLighting", void 0), Object(D.c)([Object(f.c)()], ie.prototype, "useLogarithmicDepth", null), ie;
+ }(y.a);
+ d.a.RegisteredTypes["BABYLON.StandardMaterial"] = de, c.a.DefaultMaterialFactory = function(ae) {
+ return new de("default material", ae);
+ };
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return L;
+ });
+ var D = l(1), f = l(12), P = l(6), c = l(0), C = l(13), x = l(4), R = l(16), g = l(46), u = l(54), E = l(43), A = l(2), y = l(147), v = l(21), h = l(101), d = l(9), b = l(28), T = l(23), N = l(11), U = function() {
+ this.facetNb = 0, this.partitioningSubdivisions = 10, this.partitioningBBoxRatio = 1.01, this.facetDataEnabled = !1, this.facetParameters = {}, this.bbSize = c.e.Zero(), this.subDiv = { max: 1, X: 1, Y: 1, Z: 1 }, this.facetDepthSort = !1, this.facetDepthSortEnabled = !1;
+ }, B = function() {
+ this._hasVertexAlpha = !1, this._useVertexColors = !0, this._numBoneInfluencers = 4, this._applyFog = !0, this._receiveShadows = !1, this._facetData = new U(), this._visibility = 1, this._skeleton = null, this._layerMask = 268435455, this._computeBonesUsingShaders = !0, this._isActive = !1, this._onlyForInstances = !1, this._isActiveIntermediate = !1, this._onlyForInstancesIntermediate = !1, this._actAsRegularMesh = !1, this._currentLOD = null, this._currentLODIsUpToDate = !1;
+ }, L = function(j) {
+ function W(Y, oe) {
+ oe === void 0 && (oe = null);
+ var te = j.call(this, Y, oe, !1) || this;
+ return te._internalAbstractMeshDataInfo = new B(), te.cullingStrategy = W.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY, te.onCollideObservable = new P.c(), te.onCollisionPositionChangeObservable = new P.c(), te.onMaterialChangedObservable = new P.c(), te.definedFacingForward = !0, te._occlusionQuery = null, te._renderingGroup = null, te.alphaIndex = Number.MAX_VALUE, te.isVisible = !0, te.isPickable = !0, te.showSubMeshesBoundingBox = !1, te.isBlocker = !1, te.enablePointerMoveEvents = !1, te._renderingGroupId = 0, te._material = null, te.outlineColor = d.a.Red(), te.outlineWidth = 0.02, te.overlayColor = d.a.Red(), te.overlayAlpha = 0.5, te.useOctreeForRenderingSelection = !0, te.useOctreeForPicking = !0, te.useOctreeForCollisions = !0, te.alwaysSelectAsActiveMesh = !1, te.doNotSyncBoundingInfo = !1, te.actionManager = null, te._meshCollisionData = new y.a(), te.ellipsoid = new c.e(0.5, 1, 0.5), te.ellipsoidOffset = new c.e(0, 0, 0), te.edgesWidth = 1, te.edgesColor = new d.b(1, 0, 0, 1), te._edgesRenderer = null, te._masterMesh = null, te._boundingInfo = null, te._renderId = 0, te._intersectionsInProgress = new Array(), te._unIndexed = !1, te._lightSources = new Array(), te._waitingData = { lods: null, actions: null, freezeWorldMatrix: null }, te._bonesTransformMatrices = null, te._transformMatrixTexture = null, te.onRebuildObservable = new P.c(), te._onCollisionPositionChange = function(_e, de, ae) {
+ ae === void 0 && (ae = null), de.subtractToRef(te._meshCollisionData._oldPositionForCollisions, te._meshCollisionData._diffPositionForCollisions), te._meshCollisionData._diffPositionForCollisions.length() > C.a.CollisionsEpsilon && te.position.addInPlace(te._meshCollisionData._diffPositionForCollisions), ae && te.onCollideObservable.notifyObservers(ae), te.onCollisionPositionChangeObservable.notifyObservers(te.position);
+ }, te.getScene().addMesh(te), te._resyncLightSources(), te;
+ }
+ return Object(D.d)(W, j), Object.defineProperty(W, "BILLBOARDMODE_NONE", { get: function() {
+ return g.a.BILLBOARDMODE_NONE;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W, "BILLBOARDMODE_X", { get: function() {
+ return g.a.BILLBOARDMODE_X;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W, "BILLBOARDMODE_Y", { get: function() {
+ return g.a.BILLBOARDMODE_Y;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W, "BILLBOARDMODE_Z", { get: function() {
+ return g.a.BILLBOARDMODE_Z;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W, "BILLBOARDMODE_ALL", { get: function() {
+ return g.a.BILLBOARDMODE_ALL;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W, "BILLBOARDMODE_USE_POSITION", { get: function() {
+ return g.a.BILLBOARDMODE_USE_POSITION;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "facetNb", { get: function() {
+ return this._internalAbstractMeshDataInfo._facetData.facetNb;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "partitioningSubdivisions", { get: function() {
+ return this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions;
+ }, set: function(Y) {
+ this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions = Y;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "partitioningBBoxRatio", { get: function() {
+ return this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio;
+ }, set: function(Y) {
+ this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio = Y;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "mustDepthSortFacets", { get: function() {
+ return this._internalAbstractMeshDataInfo._facetData.facetDepthSort;
+ }, set: function(Y) {
+ this._internalAbstractMeshDataInfo._facetData.facetDepthSort = Y;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "facetDepthSortFrom", { get: function() {
+ return this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom;
+ }, set: function(Y) {
+ this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom = Y;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "isFacetDataEnabled", { get: function() {
+ return this._internalAbstractMeshDataInfo._facetData.facetDataEnabled;
+ }, enumerable: !1, configurable: !0 }), W.prototype._updateNonUniformScalingState = function(Y) {
+ return !!j.prototype._updateNonUniformScalingState.call(this, Y) && (this._markSubMeshesAsMiscDirty(), !0);
+ }, Object.defineProperty(W.prototype, "onCollide", { set: function(Y) {
+ this._meshCollisionData._onCollideObserver && this.onCollideObservable.remove(this._meshCollisionData._onCollideObserver), this._meshCollisionData._onCollideObserver = this.onCollideObservable.add(Y);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "onCollisionPositionChange", { set: function(Y) {
+ this._meshCollisionData._onCollisionPositionChangeObserver && this.onCollisionPositionChangeObservable.remove(this._meshCollisionData._onCollisionPositionChangeObserver), this._meshCollisionData._onCollisionPositionChangeObserver = this.onCollisionPositionChangeObservable.add(Y);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "visibility", { get: function() {
+ return this._internalAbstractMeshDataInfo._visibility;
+ }, set: function(Y) {
+ this._internalAbstractMeshDataInfo._visibility !== Y && (this._internalAbstractMeshDataInfo._visibility = Y, this._markSubMeshesAsMiscDirty());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "renderingGroupId", { get: function() {
+ return this._renderingGroupId;
+ }, set: function(Y) {
+ this._renderingGroupId = Y;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "material", { get: function() {
+ return this._material;
+ }, set: function(Y) {
+ this._material !== Y && (this._material && this._material.meshMap && (this._material.meshMap[this.uniqueId] = void 0), this._material = Y, Y && Y.meshMap && (Y.meshMap[this.uniqueId] = this), this.onMaterialChangedObservable.hasObservers() && this.onMaterialChangedObservable.notifyObservers(this), this.subMeshes && this._unBindEffect());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "receiveShadows", { get: function() {
+ return this._internalAbstractMeshDataInfo._receiveShadows;
+ }, set: function(Y) {
+ this._internalAbstractMeshDataInfo._receiveShadows !== Y && (this._internalAbstractMeshDataInfo._receiveShadows = Y, this._markSubMeshesAsLightDirty());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "hasVertexAlpha", { get: function() {
+ return this._internalAbstractMeshDataInfo._hasVertexAlpha;
+ }, set: function(Y) {
+ this._internalAbstractMeshDataInfo._hasVertexAlpha !== Y && (this._internalAbstractMeshDataInfo._hasVertexAlpha = Y, this._markSubMeshesAsAttributesDirty(), this._markSubMeshesAsMiscDirty());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "useVertexColors", { get: function() {
+ return this._internalAbstractMeshDataInfo._useVertexColors;
+ }, set: function(Y) {
+ this._internalAbstractMeshDataInfo._useVertexColors !== Y && (this._internalAbstractMeshDataInfo._useVertexColors = Y, this._markSubMeshesAsAttributesDirty());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "computeBonesUsingShaders", { get: function() {
+ return this._internalAbstractMeshDataInfo._computeBonesUsingShaders;
+ }, set: function(Y) {
+ this._internalAbstractMeshDataInfo._computeBonesUsingShaders !== Y && (this._internalAbstractMeshDataInfo._computeBonesUsingShaders = Y, this._markSubMeshesAsAttributesDirty());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "numBoneInfluencers", { get: function() {
+ return this._internalAbstractMeshDataInfo._numBoneInfluencers;
+ }, set: function(Y) {
+ this._internalAbstractMeshDataInfo._numBoneInfluencers !== Y && (this._internalAbstractMeshDataInfo._numBoneInfluencers = Y, this._markSubMeshesAsAttributesDirty());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "applyFog", { get: function() {
+ return this._internalAbstractMeshDataInfo._applyFog;
+ }, set: function(Y) {
+ this._internalAbstractMeshDataInfo._applyFog !== Y && (this._internalAbstractMeshDataInfo._applyFog = Y, this._markSubMeshesAsMiscDirty());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "layerMask", { get: function() {
+ return this._internalAbstractMeshDataInfo._layerMask;
+ }, set: function(Y) {
+ Y !== this._internalAbstractMeshDataInfo._layerMask && (this._internalAbstractMeshDataInfo._layerMask = Y, this._resyncLightSources());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "collisionMask", { get: function() {
+ return this._meshCollisionData._collisionMask;
+ }, set: function(Y) {
+ this._meshCollisionData._collisionMask = isNaN(Y) ? -1 : Y;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "collisionResponse", { get: function() {
+ return this._meshCollisionData._collisionResponse;
+ }, set: function(Y) {
+ this._meshCollisionData._collisionResponse = Y;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "collisionGroup", { get: function() {
+ return this._meshCollisionData._collisionGroup;
+ }, set: function(Y) {
+ this._meshCollisionData._collisionGroup = isNaN(Y) ? -1 : Y;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "surroundingMeshes", { get: function() {
+ return this._meshCollisionData._surroundingMeshes;
+ }, set: function(Y) {
+ this._meshCollisionData._surroundingMeshes = Y;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "lightSources", { get: function() {
+ return this._lightSources;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "_positions", { get: function() {
+ return null;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "skeleton", { get: function() {
+ return this._internalAbstractMeshDataInfo._skeleton;
+ }, set: function(Y) {
+ var oe = this._internalAbstractMeshDataInfo._skeleton;
+ oe && oe.needInitialSkinMatrix && oe._unregisterMeshWithPoseMatrix(this), Y && Y.needInitialSkinMatrix && Y._registerMeshWithPoseMatrix(this), this._internalAbstractMeshDataInfo._skeleton = Y, this._internalAbstractMeshDataInfo._skeleton || (this._bonesTransformMatrices = null), this._markSubMeshesAsAttributesDirty();
+ }, enumerable: !1, configurable: !0 }), W.prototype.getClassName = function() {
+ return "AbstractMesh";
+ }, W.prototype.toString = function(Y) {
+ var oe = "Name: " + this.name + ", isInstance: " + (this.getClassName() !== "InstancedMesh" ? "YES" : "NO");
+ oe += ", # of submeshes: " + (this.subMeshes ? this.subMeshes.length : 0);
+ var te = this._internalAbstractMeshDataInfo._skeleton;
+ return te && (oe += ", skeleton: " + te.name), Y && (oe += ", billboard mode: " + ["NONE", "X", "Y", null, "Z", null, null, "ALL"][this.billboardMode], oe += ", freeze wrld mat: " + (this._isWorldMatrixFrozen || this._waitingData.freezeWorldMatrix ? "YES" : "NO")), oe;
+ }, W.prototype._getEffectiveParent = function() {
+ return this._masterMesh && this.billboardMode !== g.a.BILLBOARDMODE_NONE ? this._masterMesh : j.prototype._getEffectiveParent.call(this);
+ }, W.prototype._getActionManagerForTrigger = function(Y, oe) {
+ if (oe === void 0 && (oe = !0), this.actionManager && (oe || this.actionManager.isRecursive)) {
+ if (!Y)
+ return this.actionManager;
+ if (this.actionManager.hasSpecificTrigger(Y))
+ return this.actionManager;
+ }
+ return this.parent ? this.parent._getActionManagerForTrigger(Y, !1) : null;
+ }, W.prototype._rebuild = function() {
+ if (this.onRebuildObservable.notifyObservers(this), this._occlusionQuery && (this._occlusionQuery = null), this.subMeshes)
+ for (var Y = 0, oe = this.subMeshes; Y < oe.length; Y++)
+ oe[Y]._rebuild();
+ }, W.prototype._resyncLightSources = function() {
+ this._lightSources.length = 0;
+ for (var Y = 0, oe = this.getScene().lights; Y < oe.length; Y++) {
+ var te = oe[Y];
+ te.isEnabled() && te.canAffectMesh(this) && this._lightSources.push(te);
+ }
+ this._markSubMeshesAsLightDirty();
+ }, W.prototype._resyncLightSource = function(Y) {
+ var oe = Y.isEnabled() && Y.canAffectMesh(this), te = this._lightSources.indexOf(Y), _e = !1;
+ if (te === -1) {
+ if (!oe)
+ return;
+ this._lightSources.push(Y);
+ } else {
+ if (oe)
+ return;
+ _e = !0, this._lightSources.splice(te, 1);
+ }
+ this._markSubMeshesAsLightDirty(_e);
+ }, W.prototype._unBindEffect = function() {
+ for (var Y = 0, oe = this.subMeshes; Y < oe.length; Y++)
+ oe[Y].setEffect(null);
+ }, W.prototype._removeLightSource = function(Y, oe) {
+ var te = this._lightSources.indexOf(Y);
+ te !== -1 && (this._lightSources.splice(te, 1), this._markSubMeshesAsLightDirty(oe));
+ }, W.prototype._markSubMeshesAsDirty = function(Y) {
+ if (this.subMeshes)
+ for (var oe = 0, te = this.subMeshes; oe < te.length; oe++) {
+ var _e = te[oe];
+ _e._materialDefines && Y(_e._materialDefines);
+ }
+ }, W.prototype._markSubMeshesAsLightDirty = function(Y) {
+ Y === void 0 && (Y = !1), this._markSubMeshesAsDirty(function(oe) {
+ return oe.markAsLightDirty(Y);
+ });
+ }, W.prototype._markSubMeshesAsAttributesDirty = function() {
+ this._markSubMeshesAsDirty(function(Y) {
+ return Y.markAsAttributesDirty();
+ });
+ }, W.prototype._markSubMeshesAsMiscDirty = function() {
+ this._markSubMeshesAsDirty(function(Y) {
+ return Y.markAsMiscDirty();
+ });
+ }, Object.defineProperty(W.prototype, "scaling", { get: function() {
+ return this._scaling;
+ }, set: function(Y) {
+ this._scaling = Y;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "isBlocked", { get: function() {
+ return !1;
+ }, enumerable: !1, configurable: !0 }), W.prototype.getLOD = function(Y) {
+ return this;
+ }, W.prototype.getTotalVertices = function() {
+ return 0;
+ }, W.prototype.getTotalIndices = function() {
+ return 0;
+ }, W.prototype.getIndices = function() {
+ return null;
+ }, W.prototype.getVerticesData = function(Y) {
+ return null;
+ }, W.prototype.setVerticesData = function(Y, oe, te, _e) {
+ return this;
+ }, W.prototype.updateVerticesData = function(Y, oe, te, _e) {
+ return this;
+ }, W.prototype.setIndices = function(Y, oe) {
+ return this;
+ }, W.prototype.isVerticesDataPresent = function(Y) {
+ return !1;
+ }, W.prototype.getBoundingInfo = function() {
+ return this._masterMesh ? this._masterMesh.getBoundingInfo() : (this._boundingInfo || this._updateBoundingInfo(), this._boundingInfo);
+ }, W.prototype.normalizeToUnitCube = function(Y, oe, te) {
+ return Y === void 0 && (Y = !0), oe === void 0 && (oe = !1), j.prototype.normalizeToUnitCube.call(this, Y, oe, te);
+ }, W.prototype.setBoundingInfo = function(Y) {
+ return this._boundingInfo = Y, this;
+ }, Object.defineProperty(W.prototype, "useBones", { get: function() {
+ return this.skeleton && this.getScene().skeletonsEnabled && this.isVerticesDataPresent(x.b.MatricesIndicesKind) && this.isVerticesDataPresent(x.b.MatricesWeightsKind);
+ }, enumerable: !1, configurable: !0 }), W.prototype._preActivate = function() {
+ }, W.prototype._preActivateForIntermediateRendering = function(Y) {
+ }, W.prototype._activate = function(Y, oe) {
+ return this._renderId = Y, !0;
+ }, W.prototype._postActivate = function() {
+ }, W.prototype._freeze = function() {
+ }, W.prototype._unFreeze = function() {
+ }, W.prototype.getWorldMatrix = function() {
+ return this._masterMesh && this.billboardMode === g.a.BILLBOARDMODE_NONE ? this._masterMesh.getWorldMatrix() : j.prototype.getWorldMatrix.call(this);
+ }, W.prototype._getWorldMatrixDeterminant = function() {
+ return this._masterMesh ? this._masterMesh._getWorldMatrixDeterminant() : j.prototype._getWorldMatrixDeterminant.call(this);
+ }, Object.defineProperty(W.prototype, "isAnInstance", { get: function() {
+ return !1;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "hasInstances", { get: function() {
+ return !1;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "hasThinInstances", { get: function() {
+ return !1;
+ }, enumerable: !1, configurable: !0 }), W.prototype.movePOV = function(Y, oe, te) {
+ return this.position.addInPlace(this.calcMovePOV(Y, oe, te)), this;
+ }, W.prototype.calcMovePOV = function(Y, oe, te) {
+ var _e = new c.a();
+ (this.rotationQuaternion ? this.rotationQuaternion : c.b.RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z)).toRotationMatrix(_e);
+ var de = c.e.Zero(), ae = this.definedFacingForward ? -1 : 1;
+ return c.e.TransformCoordinatesFromFloatsToRef(Y * ae, oe, te * ae, _e, de), de;
+ }, W.prototype.rotatePOV = function(Y, oe, te) {
+ return this.rotation.addInPlace(this.calcRotatePOV(Y, oe, te)), this;
+ }, W.prototype.calcRotatePOV = function(Y, oe, te) {
+ var _e = this.definedFacingForward ? 1 : -1;
+ return new c.e(Y * _e, oe, te * _e);
+ }, W.prototype.refreshBoundingInfo = function(Y) {
+ return Y === void 0 && (Y = !1), this._boundingInfo && this._boundingInfo.isLocked || this._refreshBoundingInfo(this._getPositionData(Y), null), this;
+ }, W.prototype._refreshBoundingInfo = function(Y, oe) {
+ if (Y) {
+ var te = Object(h.a)(Y, 0, this.getTotalVertices(), oe);
+ this._boundingInfo ? this._boundingInfo.reConstruct(te.minimum, te.maximum) : this._boundingInfo = new E.a(te.minimum, te.maximum);
+ }
+ if (this.subMeshes)
+ for (var _e = 0; _e < this.subMeshes.length; _e++)
+ this.subMeshes[_e].refreshBoundingInfo(Y);
+ this._updateBoundingInfo();
+ }, W.prototype._getPositionData = function(Y) {
+ var oe = this.getVerticesData(x.b.PositionKind);
+ if (oe && Y && this.skeleton) {
+ oe = f.b.Slice(oe), this._generatePointsArray();
+ var te = this.getVerticesData(x.b.MatricesIndicesKind), _e = this.getVerticesData(x.b.MatricesWeightsKind);
+ if (_e && te) {
+ var de = this.numBoneInfluencers > 4, ae = de ? this.getVerticesData(x.b.MatricesIndicesExtraKind) : null, ie = de ? this.getVerticesData(x.b.MatricesWeightsExtraKind) : null;
+ this.skeleton.prepare();
+ for (var Z = this.skeleton.getTransformMatrices(this), ee = c.c.Vector3[0], w = c.c.Matrix[0], z = c.c.Matrix[1], q = 0, le = 0; le < oe.length; le += 3, q += 4) {
+ var ce, J;
+ for (w.reset(), ce = 0; ce < 4; ce++)
+ (J = _e[q + ce]) > 0 && (c.a.FromFloat32ArrayToRefScaled(Z, Math.floor(16 * te[q + ce]), J, z), w.addToSelf(z));
+ if (de)
+ for (ce = 0; ce < 4; ce++)
+ (J = ie[q + ce]) > 0 && (c.a.FromFloat32ArrayToRefScaled(Z, Math.floor(16 * ae[q + ce]), J, z), w.addToSelf(z));
+ c.e.TransformCoordinatesFromFloatsToRef(oe[le], oe[le + 1], oe[le + 2], w, ee), ee.toArray(oe, le), this._positions && this._positions[le / 3].copyFrom(ee);
+ }
+ }
+ }
+ return oe;
+ }, W.prototype._updateBoundingInfo = function() {
+ var Y = this._effectiveMesh;
+ return this._boundingInfo ? this._boundingInfo.update(Y.worldMatrixFromCache) : this._boundingInfo = new E.a(this.absolutePosition, this.absolutePosition, Y.worldMatrixFromCache), this._updateSubMeshesBoundingInfo(Y.worldMatrixFromCache), this;
+ }, W.prototype._updateSubMeshesBoundingInfo = function(Y) {
+ if (!this.subMeshes)
+ return this;
+ for (var oe = this.subMeshes.length, te = 0; te < oe; te++) {
+ var _e = this.subMeshes[te];
+ (oe > 1 || !_e.IsGlobal) && _e.updateBoundingInfo(Y);
+ }
+ return this;
+ }, W.prototype._afterComputeWorldMatrix = function() {
+ this.doNotSyncBoundingInfo || this._updateBoundingInfo();
+ }, Object.defineProperty(W.prototype, "_effectiveMesh", { get: function() {
+ return this.skeleton && this.skeleton.overrideMesh || this;
+ }, enumerable: !1, configurable: !0 }), W.prototype.isInFrustum = function(Y) {
+ return this._boundingInfo !== null && this._boundingInfo.isInFrustum(Y, this.cullingStrategy);
+ }, W.prototype.isCompletelyInFrustum = function(Y) {
+ return this._boundingInfo !== null && this._boundingInfo.isCompletelyInFrustum(Y);
+ }, W.prototype.intersectsMesh = function(Y, oe, te) {
+ if (oe === void 0 && (oe = !1), !this._boundingInfo || !Y._boundingInfo)
+ return !1;
+ if (this._boundingInfo.intersects(Y._boundingInfo, oe))
+ return !0;
+ if (te) {
+ for (var _e = 0, de = this.getChildMeshes(); _e < de.length; _e++)
+ if (de[_e].intersectsMesh(Y, oe, !0))
+ return !0;
+ }
+ return !1;
+ }, W.prototype.intersectsPoint = function(Y) {
+ return !!this._boundingInfo && this._boundingInfo.intersectsPoint(Y);
+ }, Object.defineProperty(W.prototype, "checkCollisions", { get: function() {
+ return this._meshCollisionData._checkCollisions;
+ }, set: function(Y) {
+ this._meshCollisionData._checkCollisions = Y;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(W.prototype, "collider", { get: function() {
+ return this._meshCollisionData._collider;
+ }, enumerable: !1, configurable: !0 }), W.prototype.moveWithCollisions = function(Y) {
+ this.getAbsolutePosition().addToRef(this.ellipsoidOffset, this._meshCollisionData._oldPositionForCollisions);
+ var oe = this.getScene().collisionCoordinator;
+ return this._meshCollisionData._collider || (this._meshCollisionData._collider = oe.createCollider()), this._meshCollisionData._collider._radius = this.ellipsoid, oe.getNewPosition(this._meshCollisionData._oldPositionForCollisions, Y, this._meshCollisionData._collider, 3, this, this._onCollisionPositionChange, this.uniqueId), this;
+ }, W.prototype._collideForSubMesh = function(Y, oe, te) {
+ if (this._generatePointsArray(), !this._positions)
+ return this;
+ if (!Y._lastColliderWorldVertices || !Y._lastColliderTransformMatrix.equals(oe)) {
+ Y._lastColliderTransformMatrix = oe.clone(), Y._lastColliderWorldVertices = [], Y._trianglePlanes = [];
+ for (var _e = Y.verticesStart, de = Y.verticesStart + Y.verticesCount, ae = _e; ae < de; ae++)
+ Y._lastColliderWorldVertices.push(c.e.TransformCoordinates(this._positions[ae], oe));
+ }
+ return te._collide(Y._trianglePlanes, Y._lastColliderWorldVertices, this.getIndices(), Y.indexStart, Y.indexStart + Y.indexCount, Y.verticesStart, !!Y.getMaterial(), this), this;
+ }, W.prototype._processCollisionsForSubMeshes = function(Y, oe) {
+ for (var te = this._scene.getCollidingSubMeshCandidates(this, Y), _e = te.length, de = 0; de < _e; de++) {
+ var ae = te.data[de];
+ _e > 1 && !ae._checkCollision(Y) || this._collideForSubMesh(ae, oe, Y);
+ }
+ return this;
+ }, W.prototype._checkCollision = function(Y) {
+ if (!this._boundingInfo || !this._boundingInfo._checkCollision(Y))
+ return this;
+ var oe = c.c.Matrix[0], te = c.c.Matrix[1];
+ return c.a.ScalingToRef(1 / Y._radius.x, 1 / Y._radius.y, 1 / Y._radius.z, oe), this.worldMatrixFromCache.multiplyToRef(oe, te), this._processCollisionsForSubMeshes(Y, te), this;
+ }, W.prototype._generatePointsArray = function() {
+ return !1;
+ }, W.prototype.intersects = function(Y, oe, te, _e, de, ae) {
+ var ie;
+ _e === void 0 && (_e = !1), ae === void 0 && (ae = !1);
+ var Z = new u.a(), ee = this.getClassName() === "InstancedLinesMesh" || this.getClassName() === "LinesMesh" ? this.intersectionThreshold : 0, w = this._boundingInfo;
+ if (!this.subMeshes || !w || !(ae || Y.intersectsSphere(w.boundingSphere, ee) && Y.intersectsBox(w.boundingBox, ee)))
+ return Z;
+ if (_e)
+ return Z.hit = !ae, Z.pickedMesh = ae ? null : this, Z.distance = ae ? 0 : c.e.Distance(Y.origin, w.boundingSphere.center), Z.subMeshId = 0, Z;
+ if (!this._generatePointsArray())
+ return Z;
+ for (var z = null, q = this._scene.getIntersectingSubMeshCandidates(this, Y), le = q.length, ce = !1, J = 0; J < le; J++) {
+ var H = (X = q.data[J]).getMaterial();
+ if (H && (!((ie = this.getIndices()) === null || ie === void 0) && ie.length) && (H.fillMode == A.a.MATERIAL_TriangleStripDrawMode || H.fillMode == A.a.MATERIAL_TriangleFillMode || H.fillMode == A.a.MATERIAL_WireFrameFillMode || H.fillMode == A.a.MATERIAL_PointFillMode)) {
+ ce = !0;
+ break;
+ }
+ }
+ if (!ce)
+ return Z.hit = !0, Z.pickedMesh = this, Z.distance = c.e.Distance(Y.origin, w.boundingSphere.center), Z.subMeshId = -1, Z;
+ for (J = 0; J < le; J++) {
+ var X = q.data[J];
+ if (!(le > 1) || X.canIntersects(Y)) {
+ var ne = X.intersects(Y, this._positions, this.getIndices(), oe, te);
+ if (ne && (oe || !z || ne.distance < z.distance) && ((z = ne).subMeshId = J, oe))
+ break;
+ }
+ }
+ if (z) {
+ var Q = de ?? (this.skeleton && this.skeleton.overrideMesh ? this.skeleton.overrideMesh.getWorldMatrix() : this.getWorldMatrix()), $ = c.c.Vector3[0], me = c.c.Vector3[1];
+ c.e.TransformCoordinatesToRef(Y.origin, Q, $), Y.direction.scaleToRef(z.distance, me);
+ var ye = c.e.TransformNormal(me, Q).addInPlace($);
+ return Z.hit = !0, Z.distance = c.e.Distance($, ye), Z.pickedPoint = ye, Z.pickedMesh = this, Z.bu = z.bu || 0, Z.bv = z.bv || 0, Z.subMeshFaceId = z.faceId, Z.faceId = z.faceId + q.data[z.subMeshId].indexStart / (this.getClassName().indexOf("LinesMesh") !== -1 ? 2 : 3), Z.subMeshId = z.subMeshId, Z;
+ }
+ return Z;
+ }, W.prototype.clone = function(Y, oe, te) {
+ return null;
+ }, W.prototype.releaseSubMeshes = function() {
+ if (this.subMeshes)
+ for (; this.subMeshes.length; )
+ this.subMeshes[0].dispose();
+ else
+ this.subMeshes = new Array();
+ return this;
+ }, W.prototype.dispose = function(Y, oe) {
+ var te, _e = this;
+ for (oe === void 0 && (oe = !1), this._scene.useMaterialMeshMap && this._material && this._material.meshMap && (this._material.meshMap[this.uniqueId] = void 0), this.getScene().freeActiveMeshes(), this.getScene().freeRenderingGroups(), this.actionManager !== void 0 && this.actionManager !== null && (this.actionManager.dispose(), this.actionManager = null), this._internalAbstractMeshDataInfo._skeleton = null, this._transformMatrixTexture && (this._transformMatrixTexture.dispose(), this._transformMatrixTexture = null), te = 0; te < this._intersectionsInProgress.length; te++) {
+ var de = this._intersectionsInProgress[te], ae = de._intersectionsInProgress.indexOf(this);
+ de._intersectionsInProgress.splice(ae, 1);
+ }
+ this._intersectionsInProgress = [], this.getScene().lights.forEach(function(Z) {
+ var ee = Z.includedOnlyMeshes.indexOf(_e);
+ ee !== -1 && Z.includedOnlyMeshes.splice(ee, 1), (ee = Z.excludedMeshes.indexOf(_e)) !== -1 && Z.excludedMeshes.splice(ee, 1);
+ var w = Z.getShadowGenerator();
+ if (w) {
+ var z = w.getShadowMap();
+ z && z.renderList && (ee = z.renderList.indexOf(_e)) !== -1 && z.renderList.splice(ee, 1);
+ }
+ }), this.getClassName() === "InstancedMesh" && this.getClassName() === "InstancedLinesMesh" || this.releaseSubMeshes();
+ var ie = this.getScene().getEngine();
+ if (this._occlusionQuery && (this.isOcclusionQueryInProgress = !1, ie.deleteQuery(this._occlusionQuery), this._occlusionQuery = null), ie.wipeCaches(), this.getScene().removeMesh(this), oe && this.material && (this.material.getClassName() === "MultiMaterial" ? this.material.dispose(!1, !0, !0) : this.material.dispose(!1, !0)), !Y)
+ for (te = 0; te < this.getScene().particleSystems.length; te++)
+ this.getScene().particleSystems[te].emitter === this && (this.getScene().particleSystems[te].dispose(), te--);
+ this._internalAbstractMeshDataInfo._facetData.facetDataEnabled && this.disableFacetData(), this.onAfterWorldMatrixUpdateObservable.clear(), this.onCollideObservable.clear(), this.onCollisionPositionChangeObservable.clear(), this.onRebuildObservable.clear(), j.prototype.dispose.call(this, Y, oe);
+ }, W.prototype.addChild = function(Y) {
+ return Y.setParent(this), this;
+ }, W.prototype.removeChild = function(Y) {
+ return Y.setParent(null), this;
+ }, W.prototype._initFacetData = function() {
+ var Y = this._internalAbstractMeshDataInfo._facetData;
+ Y.facetNormals || (Y.facetNormals = new Array()), Y.facetPositions || (Y.facetPositions = new Array()), Y.facetPartitioning || (Y.facetPartitioning = new Array()), Y.facetNb = this.getIndices().length / 3 | 0, Y.partitioningSubdivisions = Y.partitioningSubdivisions ? Y.partitioningSubdivisions : 10, Y.partitioningBBoxRatio = Y.partitioningBBoxRatio ? Y.partitioningBBoxRatio : 1.01;
+ for (var oe = 0; oe < Y.facetNb; oe++)
+ Y.facetNormals[oe] = c.e.Zero(), Y.facetPositions[oe] = c.e.Zero();
+ return Y.facetDataEnabled = !0, this;
+ }, W.prototype.updateFacetData = function() {
+ var Y = this._internalAbstractMeshDataInfo._facetData;
+ Y.facetDataEnabled || this._initFacetData();
+ var oe = this.getVerticesData(x.b.PositionKind), te = this.getIndices(), _e = this.getVerticesData(x.b.NormalKind), de = this.getBoundingInfo();
+ if (Y.facetDepthSort && !Y.facetDepthSortEnabled) {
+ if (Y.facetDepthSortEnabled = !0, te instanceof Uint16Array)
+ Y.depthSortedIndices = new Uint16Array(te);
+ else if (te instanceof Uint32Array)
+ Y.depthSortedIndices = new Uint32Array(te);
+ else {
+ for (var ae = !1, ie = 0; ie < te.length; ie++)
+ if (te[ie] > 65535) {
+ ae = !0;
+ break;
+ }
+ Y.depthSortedIndices = ae ? new Uint32Array(te) : new Uint16Array(te);
+ }
+ if (Y.facetDepthSortFunction = function(ce, J) {
+ return J.sqDistance - ce.sqDistance;
+ }, !Y.facetDepthSortFrom) {
+ var Z = this.getScene().activeCamera;
+ Y.facetDepthSortFrom = Z ? Z.position : c.e.Zero();
+ }
+ Y.depthSortedFacets = [];
+ for (var ee = 0; ee < Y.facetNb; ee++) {
+ var w = { ind: 3 * ee, sqDistance: 0 };
+ Y.depthSortedFacets.push(w);
+ }
+ Y.invertedMatrix = c.a.Identity(), Y.facetDepthSortOrigin = c.e.Zero();
+ }
+ Y.bbSize.x = de.maximum.x - de.minimum.x > b.a ? de.maximum.x - de.minimum.x : b.a, Y.bbSize.y = de.maximum.y - de.minimum.y > b.a ? de.maximum.y - de.minimum.y : b.a, Y.bbSize.z = de.maximum.z - de.minimum.z > b.a ? de.maximum.z - de.minimum.z : b.a;
+ var z = Y.bbSize.x > Y.bbSize.y ? Y.bbSize.x : Y.bbSize.y;
+ if (z = z > Y.bbSize.z ? z : Y.bbSize.z, Y.subDiv.max = Y.partitioningSubdivisions, Y.subDiv.X = Math.floor(Y.subDiv.max * Y.bbSize.x / z), Y.subDiv.Y = Math.floor(Y.subDiv.max * Y.bbSize.y / z), Y.subDiv.Z = Math.floor(Y.subDiv.max * Y.bbSize.z / z), Y.subDiv.X = Y.subDiv.X < 1 ? 1 : Y.subDiv.X, Y.subDiv.Y = Y.subDiv.Y < 1 ? 1 : Y.subDiv.Y, Y.subDiv.Z = Y.subDiv.Z < 1 ? 1 : Y.subDiv.Z, Y.facetParameters.facetNormals = this.getFacetLocalNormals(), Y.facetParameters.facetPositions = this.getFacetLocalPositions(), Y.facetParameters.facetPartitioning = this.getFacetLocalPartitioning(), Y.facetParameters.bInfo = de, Y.facetParameters.bbSize = Y.bbSize, Y.facetParameters.subDiv = Y.subDiv, Y.facetParameters.ratio = this.partitioningBBoxRatio, Y.facetParameters.depthSort = Y.facetDepthSort, Y.facetDepthSort && Y.facetDepthSortEnabled && (this.computeWorldMatrix(!0), this._worldMatrix.invertToRef(Y.invertedMatrix), c.e.TransformCoordinatesToRef(Y.facetDepthSortFrom, Y.invertedMatrix, Y.facetDepthSortOrigin), Y.facetParameters.distanceTo = Y.facetDepthSortOrigin), Y.facetParameters.depthSortedFacets = Y.depthSortedFacets, R.a.ComputeNormals(oe, te, _e, Y.facetParameters), Y.facetDepthSort && Y.facetDepthSortEnabled) {
+ Y.depthSortedFacets.sort(Y.facetDepthSortFunction);
+ var q = Y.depthSortedIndices.length / 3 | 0;
+ for (ee = 0; ee < q; ee++) {
+ var le = Y.depthSortedFacets[ee].ind;
+ Y.depthSortedIndices[3 * ee] = te[le], Y.depthSortedIndices[3 * ee + 1] = te[le + 1], Y.depthSortedIndices[3 * ee + 2] = te[le + 2];
+ }
+ this.updateIndices(Y.depthSortedIndices, void 0, !0);
+ }
+ return this;
+ }, W.prototype.getFacetLocalNormals = function() {
+ var Y = this._internalAbstractMeshDataInfo._facetData;
+ return Y.facetNormals || this.updateFacetData(), Y.facetNormals;
+ }, W.prototype.getFacetLocalPositions = function() {
+ var Y = this._internalAbstractMeshDataInfo._facetData;
+ return Y.facetPositions || this.updateFacetData(), Y.facetPositions;
+ }, W.prototype.getFacetLocalPartitioning = function() {
+ var Y = this._internalAbstractMeshDataInfo._facetData;
+ return Y.facetPartitioning || this.updateFacetData(), Y.facetPartitioning;
+ }, W.prototype.getFacetPosition = function(Y) {
+ var oe = c.e.Zero();
+ return this.getFacetPositionToRef(Y, oe), oe;
+ }, W.prototype.getFacetPositionToRef = function(Y, oe) {
+ var te = this.getFacetLocalPositions()[Y], _e = this.getWorldMatrix();
+ return c.e.TransformCoordinatesToRef(te, _e, oe), this;
+ }, W.prototype.getFacetNormal = function(Y) {
+ var oe = c.e.Zero();
+ return this.getFacetNormalToRef(Y, oe), oe;
+ }, W.prototype.getFacetNormalToRef = function(Y, oe) {
+ var te = this.getFacetLocalNormals()[Y];
+ return c.e.TransformNormalToRef(te, this.getWorldMatrix(), oe), this;
+ }, W.prototype.getFacetsAtLocalCoordinates = function(Y, oe, te) {
+ var _e = this.getBoundingInfo(), de = this._internalAbstractMeshDataInfo._facetData, ae = Math.floor((Y - _e.minimum.x * de.partitioningBBoxRatio) * de.subDiv.X * de.partitioningBBoxRatio / de.bbSize.x), ie = Math.floor((oe - _e.minimum.y * de.partitioningBBoxRatio) * de.subDiv.Y * de.partitioningBBoxRatio / de.bbSize.y), Z = Math.floor((te - _e.minimum.z * de.partitioningBBoxRatio) * de.subDiv.Z * de.partitioningBBoxRatio / de.bbSize.z);
+ return ae < 0 || ae > de.subDiv.max || ie < 0 || ie > de.subDiv.max || Z < 0 || Z > de.subDiv.max ? null : de.facetPartitioning[ae + de.subDiv.max * ie + de.subDiv.max * de.subDiv.max * Z];
+ }, W.prototype.getClosestFacetAtCoordinates = function(Y, oe, te, _e, de, ae) {
+ de === void 0 && (de = !1), ae === void 0 && (ae = !0);
+ var ie = this.getWorldMatrix(), Z = c.c.Matrix[5];
+ ie.invertToRef(Z);
+ var ee = c.c.Vector3[8];
+ c.e.TransformCoordinatesFromFloatsToRef(Y, oe, te, Z, ee);
+ var w = this.getClosestFacetAtLocalCoordinates(ee.x, ee.y, ee.z, _e, de, ae);
+ return _e && c.e.TransformCoordinatesFromFloatsToRef(_e.x, _e.y, _e.z, ie, _e), w;
+ }, W.prototype.getClosestFacetAtLocalCoordinates = function(Y, oe, te, _e, de, ae) {
+ de === void 0 && (de = !1), ae === void 0 && (ae = !0);
+ var ie = null, Z = 0, ee = 0, w = 0, z = 0, q = 0, le = 0, ce = 0, J = 0, H = this.getFacetLocalPositions(), X = this.getFacetLocalNormals(), ne = this.getFacetsAtLocalCoordinates(Y, oe, te);
+ if (!ne)
+ return null;
+ for (var Q, $, me, ye = Number.MAX_VALUE, be = ye, ge = 0; ge < ne.length; ge++)
+ $ = X[Q = ne[ge]], z = (Y - (me = H[Q]).x) * $.x + (oe - me.y) * $.y + (te - me.z) * $.z, (!de || de && ae && z >= 0 || de && !ae && z <= 0) && (z = $.x * me.x + $.y * me.y + $.z * me.z, q = -($.x * Y + $.y * oe + $.z * te - z) / ($.x * $.x + $.y * $.y + $.z * $.z), (be = (Z = (le = Y + $.x * q) - Y) * Z + (ee = (ce = oe + $.y * q) - oe) * ee + (w = (J = te + $.z * q) - te) * w) < ye && (ye = be, ie = Q, _e && (_e.x = le, _e.y = ce, _e.z = J)));
+ return ie;
+ }, W.prototype.getFacetDataParameters = function() {
+ return this._internalAbstractMeshDataInfo._facetData.facetParameters;
+ }, W.prototype.disableFacetData = function() {
+ var Y = this._internalAbstractMeshDataInfo._facetData;
+ return Y.facetDataEnabled && (Y.facetDataEnabled = !1, Y.facetPositions = new Array(), Y.facetNormals = new Array(), Y.facetPartitioning = new Array(), Y.facetParameters = null, Y.depthSortedIndices = new Uint32Array(0)), this;
+ }, W.prototype.updateIndices = function(Y, oe, te) {
+ return this;
+ }, W.prototype.createNormals = function(Y) {
+ var oe, te = this.getVerticesData(x.b.PositionKind), _e = this.getIndices();
+ return oe = this.isVerticesDataPresent(x.b.NormalKind) ? this.getVerticesData(x.b.NormalKind) : [], R.a.ComputeNormals(te, _e, oe, { useRightHandedSystem: this.getScene().useRightHandedSystem }), this.setVerticesData(x.b.NormalKind, oe, Y), this;
+ }, W.prototype.alignWithNormal = function(Y, oe) {
+ oe || (oe = T.a.Y);
+ var te = c.c.Vector3[0], _e = c.c.Vector3[1];
+ return c.e.CrossToRef(oe, Y, _e), c.e.CrossToRef(Y, _e, te), this.rotationQuaternion ? c.b.RotationQuaternionFromAxisToRef(te, Y, _e, this.rotationQuaternion) : c.e.RotationFromAxisToRef(te, Y, _e, this.rotation), this;
+ }, W.prototype._checkOcclusionQuery = function() {
+ return !1;
+ }, W.prototype.disableEdgesRendering = function() {
+ throw v.a.WarnImport("EdgesRenderer");
+ }, W.prototype.enableEdgesRendering = function(Y, oe, te) {
+ throw v.a.WarnImport("EdgesRenderer");
+ }, W.prototype.getConnectedParticleSystems = function() {
+ var Y = this;
+ return this._scene.particleSystems.filter(function(oe) {
+ return oe.emitter === Y;
+ });
+ }, W.OCCLUSION_TYPE_NONE = 0, W.OCCLUSION_TYPE_OPTIMISTIC = 1, W.OCCLUSION_TYPE_STRICT = 2, W.OCCLUSION_ALGORITHM_TYPE_ACCURATE = 0, W.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE = 1, W.CULLINGSTRATEGY_STANDARD = A.a.MESHES_CULLINGSTRATEGY_STANDARD, W.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY = A.a.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY, W.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION = A.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION, W.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY = A.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY, W;
+ }(g.a);
+ N.a.RegisteredTypes["BABYLON.AbstractMesh"] = L;
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return g;
+ });
+ var D = l(8), f = l(44), P = l(0), c = l(31), C = l(7), x = l(50), R = l(23);
+ C.a._PhysicsImpostorParser = function(u, E, A) {
+ return new g(E, A.physicsImpostor, { mass: A.physicsMass, friction: A.physicsFriction, restitution: A.physicsRestitution }, u);
+ };
+ var g = function() {
+ function u(E, A, y, v) {
+ var h = this;
+ y === void 0 && (y = { mass: 0 }), this.object = E, this.type = A, this._options = y, this._scene = v, this._pluginData = {}, this._bodyUpdateRequired = !1, this._onBeforePhysicsStepCallbacks = new Array(), this._onAfterPhysicsStepCallbacks = new Array(), this._onPhysicsCollideCallbacks = [], this._deltaPosition = P.e.Zero(), this._isDisposed = !1, this.soft = !1, this.segments = 0, this._tmpQuat = new P.b(), this._tmpQuat2 = new P.b(), this.beforeStep = function() {
+ h._physicsEngine && (h.object.translate(h._deltaPosition, -1), h._deltaRotationConjugated && h.object.rotationQuaternion && h.object.rotationQuaternion.multiplyToRef(h._deltaRotationConjugated, h.object.rotationQuaternion), h.object.computeWorldMatrix(!1), h.object.parent && h.object.rotationQuaternion ? (h.getParentsRotation(), h._tmpQuat.multiplyToRef(h.object.rotationQuaternion, h._tmpQuat)) : h._tmpQuat.copyFrom(h.object.rotationQuaternion || new P.b()), h._options.disableBidirectionalTransformation || h.object.rotationQuaternion && h._physicsEngine.getPhysicsPlugin().setPhysicsBodyTransformation(h, h.object.getAbsolutePosition(), h._tmpQuat), h._onBeforePhysicsStepCallbacks.forEach(function(d) {
+ d(h);
+ }));
+ }, this.afterStep = function() {
+ h._physicsEngine && (h._onAfterPhysicsStepCallbacks.forEach(function(d) {
+ d(h);
+ }), h._physicsEngine.getPhysicsPlugin().setTransformationFromPhysicsBody(h), h.object.parent && h.object.rotationQuaternion && (h.getParentsRotation(), h._tmpQuat.conjugateInPlace(), h._tmpQuat.multiplyToRef(h.object.rotationQuaternion, h.object.rotationQuaternion)), h.object.setAbsolutePosition(h.object.position), h._deltaRotation && h.object.rotationQuaternion && h.object.rotationQuaternion.multiplyToRef(h._deltaRotation, h.object.rotationQuaternion), h.object.translate(h._deltaPosition, 1));
+ }, this.onCollideEvent = null, this.onCollide = function(d) {
+ if ((h._onPhysicsCollideCallbacks.length || h.onCollideEvent) && h._physicsEngine) {
+ var b = h._physicsEngine.getImpostorWithPhysicsBody(d.body);
+ b && (h.onCollideEvent && h.onCollideEvent(h, b), h._onPhysicsCollideCallbacks.filter(function(T) {
+ return T.otherImpostors.indexOf(b) !== -1;
+ }).forEach(function(T) {
+ T.callback(h, b, d.point);
+ }));
+ }
+ }, this.object ? (this.object.parent && y.mass !== 0 && D.a.Warn("A physics impostor has been created for an object which has a parent. Babylon physics currently works in local space so unexpected issues may occur."), !this._scene && E.getScene && (this._scene = E.getScene()), this._scene && (this.type > 100 && (this.soft = !0), this._physicsEngine = this._scene.getPhysicsEngine(), this._physicsEngine ? (this.object.rotationQuaternion || (this.object.rotation ? this.object.rotationQuaternion = P.b.RotationYawPitchRoll(this.object.rotation.y, this.object.rotation.x, this.object.rotation.z) : this.object.rotationQuaternion = new P.b()), this._options.mass = y.mass === void 0 ? 0 : y.mass, this._options.friction = y.friction === void 0 ? 0.2 : y.friction, this._options.restitution = y.restitution === void 0 ? 0.2 : y.restitution, this.soft && (this._options.mass = this._options.mass > 0 ? this._options.mass : 1, this._options.pressure = y.pressure === void 0 ? 200 : y.pressure, this._options.stiffness = y.stiffness === void 0 ? 1 : y.stiffness, this._options.velocityIterations = y.velocityIterations === void 0 ? 20 : y.velocityIterations, this._options.positionIterations = y.positionIterations === void 0 ? 20 : y.positionIterations, this._options.fixedPoints = y.fixedPoints === void 0 ? 0 : y.fixedPoints, this._options.margin = y.margin === void 0 ? 0 : y.margin, this._options.damping = y.damping === void 0 ? 0 : y.damping, this._options.path = y.path === void 0 ? null : y.path, this._options.shape = y.shape === void 0 ? null : y.shape), this._joints = [], !this.object.parent || this._options.ignoreParent ? this._init() : this.object.parent.physicsImpostor && D.a.Warn("You must affect impostors to children before affecting impostor to parent.")) : D.a.Error("Physics not enabled. Please use scene.enablePhysics(...) before creating impostors."))) : D.a.Error("No object was provided. A physics object is obligatory");
+ }
+ return Object.defineProperty(u.prototype, "isDisposed", { get: function() {
+ return this._isDisposed;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(u.prototype, "mass", { get: function() {
+ return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyMass(this) : 0;
+ }, set: function(E) {
+ this.setMass(E);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(u.prototype, "friction", { get: function() {
+ return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyFriction(this) : 0;
+ }, set: function(E) {
+ this._physicsEngine && this._physicsEngine.getPhysicsPlugin().setBodyFriction(this, E);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(u.prototype, "restitution", { get: function() {
+ return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyRestitution(this) : 0;
+ }, set: function(E) {
+ this._physicsEngine && this._physicsEngine.getPhysicsPlugin().setBodyRestitution(this, E);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(u.prototype, "pressure", { get: function() {
+ if (!this._physicsEngine)
+ return 0;
+ var E = this._physicsEngine.getPhysicsPlugin();
+ return E.setBodyPressure ? E.getBodyPressure(this) : 0;
+ }, set: function(E) {
+ if (this._physicsEngine) {
+ var A = this._physicsEngine.getPhysicsPlugin();
+ A.setBodyPressure && A.setBodyPressure(this, E);
+ }
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(u.prototype, "stiffness", { get: function() {
+ if (!this._physicsEngine)
+ return 0;
+ var E = this._physicsEngine.getPhysicsPlugin();
+ return E.getBodyStiffness ? E.getBodyStiffness(this) : 0;
+ }, set: function(E) {
+ if (this._physicsEngine) {
+ var A = this._physicsEngine.getPhysicsPlugin();
+ A.setBodyStiffness && A.setBodyStiffness(this, E);
+ }
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(u.prototype, "velocityIterations", { get: function() {
+ if (!this._physicsEngine)
+ return 0;
+ var E = this._physicsEngine.getPhysicsPlugin();
+ return E.getBodyVelocityIterations ? E.getBodyVelocityIterations(this) : 0;
+ }, set: function(E) {
+ if (this._physicsEngine) {
+ var A = this._physicsEngine.getPhysicsPlugin();
+ A.setBodyVelocityIterations && A.setBodyVelocityIterations(this, E);
+ }
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(u.prototype, "positionIterations", { get: function() {
+ if (!this._physicsEngine)
+ return 0;
+ var E = this._physicsEngine.getPhysicsPlugin();
+ return E.getBodyPositionIterations ? E.getBodyPositionIterations(this) : 0;
+ }, set: function(E) {
+ if (this._physicsEngine) {
+ var A = this._physicsEngine.getPhysicsPlugin();
+ A.setBodyPositionIterations && A.setBodyPositionIterations(this, E);
+ }
+ }, enumerable: !1, configurable: !0 }), u.prototype._init = function() {
+ this._physicsEngine && (this._physicsEngine.removeImpostor(this), this.physicsBody = null, this._parent = this._parent || this._getPhysicsParent(), this._isDisposed || this.parent && !this._options.ignoreParent || this._physicsEngine.addImpostor(this));
+ }, u.prototype._getPhysicsParent = function() {
+ return this.object.parent instanceof c.a ? this.object.parent.physicsImpostor : null;
+ }, u.prototype.isBodyInitRequired = function() {
+ return this._bodyUpdateRequired || !this._physicsBody && !this._parent;
+ }, u.prototype.setScalingUpdated = function() {
+ this.forceUpdate();
+ }, u.prototype.forceUpdate = function() {
+ this._init(), this.parent && !this._options.ignoreParent && this.parent.forceUpdate();
+ }, Object.defineProperty(u.prototype, "physicsBody", { get: function() {
+ return this._parent && !this._options.ignoreParent ? this._parent.physicsBody : this._physicsBody;
+ }, set: function(E) {
+ this._physicsBody && this._physicsEngine && this._physicsEngine.getPhysicsPlugin().removePhysicsBody(this), this._physicsBody = E, this.resetUpdateFlags();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(u.prototype, "parent", { get: function() {
+ return !this._options.ignoreParent && this._parent ? this._parent : null;
+ }, set: function(E) {
+ this._parent = E;
+ }, enumerable: !1, configurable: !0 }), u.prototype.resetUpdateFlags = function() {
+ this._bodyUpdateRequired = !1;
+ }, u.prototype.getObjectExtendSize = function() {
+ if (this.object.getBoundingInfo) {
+ var E = this.object.rotationQuaternion, A = this.object.scaling.clone();
+ this.object.rotationQuaternion = u.IDENTITY_QUATERNION;
+ var y = this.object.computeWorldMatrix && this.object.computeWorldMatrix(!0);
+ y && y.decompose(A, void 0, void 0);
+ var v = this.object.getBoundingInfo().boundingBox.extendSize.scale(2).multiplyInPlace(A);
+ return this.object.rotationQuaternion = E, this.object.computeWorldMatrix && this.object.computeWorldMatrix(!0), v;
+ }
+ return u.DEFAULT_OBJECT_SIZE;
+ }, u.prototype.getObjectCenter = function() {
+ return this.object.getBoundingInfo ? this.object.getBoundingInfo().boundingBox.centerWorld : this.object.position;
+ }, u.prototype.getParam = function(E) {
+ return this._options[E];
+ }, u.prototype.setParam = function(E, A) {
+ this._options[E] = A, this._bodyUpdateRequired = !0;
+ }, u.prototype.setMass = function(E) {
+ this.getParam("mass") !== E && this.setParam("mass", E), this._physicsEngine && this._physicsEngine.getPhysicsPlugin().setBodyMass(this, E);
+ }, u.prototype.getLinearVelocity = function() {
+ return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getLinearVelocity(this) : P.e.Zero();
+ }, u.prototype.setLinearVelocity = function(E) {
+ this._physicsEngine && this._physicsEngine.getPhysicsPlugin().setLinearVelocity(this, E);
+ }, u.prototype.getAngularVelocity = function() {
+ return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getAngularVelocity(this) : P.e.Zero();
+ }, u.prototype.setAngularVelocity = function(E) {
+ this._physicsEngine && this._physicsEngine.getPhysicsPlugin().setAngularVelocity(this, E);
+ }, u.prototype.executeNativeFunction = function(E) {
+ this._physicsEngine && E(this._physicsEngine.getPhysicsPlugin().world, this.physicsBody);
+ }, u.prototype.registerBeforePhysicsStep = function(E) {
+ this._onBeforePhysicsStepCallbacks.push(E);
+ }, u.prototype.unregisterBeforePhysicsStep = function(E) {
+ var A = this._onBeforePhysicsStepCallbacks.indexOf(E);
+ A > -1 ? this._onBeforePhysicsStepCallbacks.splice(A, 1) : D.a.Warn("Function to remove was not found");
+ }, u.prototype.registerAfterPhysicsStep = function(E) {
+ this._onAfterPhysicsStepCallbacks.push(E);
+ }, u.prototype.unregisterAfterPhysicsStep = function(E) {
+ var A = this._onAfterPhysicsStepCallbacks.indexOf(E);
+ A > -1 ? this._onAfterPhysicsStepCallbacks.splice(A, 1) : D.a.Warn("Function to remove was not found");
+ }, u.prototype.registerOnPhysicsCollide = function(E, A) {
+ var y = E instanceof Array ? E : [E];
+ this._onPhysicsCollideCallbacks.push({ callback: A, otherImpostors: y });
+ }, u.prototype.unregisterOnPhysicsCollide = function(E, A) {
+ var y = E instanceof Array ? E : [E], v = -1;
+ this._onPhysicsCollideCallbacks.some(function(h, d) {
+ if (h.callback === A && h.otherImpostors.length === y.length) {
+ var b = h.otherImpostors.every(function(T) {
+ return y.indexOf(T) > -1;
+ });
+ return b && (v = d), b;
+ }
+ return !1;
+ }) ? this._onPhysicsCollideCallbacks.splice(v, 1) : D.a.Warn("Function to remove was not found");
+ }, u.prototype.getParentsRotation = function() {
+ var E = this.object.parent;
+ for (this._tmpQuat.copyFromFloats(0, 0, 0, 1); E; )
+ E.rotationQuaternion ? this._tmpQuat2.copyFrom(E.rotationQuaternion) : P.b.RotationYawPitchRollToRef(E.rotation.y, E.rotation.x, E.rotation.z, this._tmpQuat2), this._tmpQuat.multiplyToRef(this._tmpQuat2, this._tmpQuat), E = E.parent;
+ return this._tmpQuat;
+ }, u.prototype.applyForce = function(E, A) {
+ return this._physicsEngine && this._physicsEngine.getPhysicsPlugin().applyForce(this, E, A), this;
+ }, u.prototype.applyImpulse = function(E, A) {
+ return this._physicsEngine && this._physicsEngine.getPhysicsPlugin().applyImpulse(this, E, A), this;
+ }, u.prototype.createJoint = function(E, A, y) {
+ var v = new x.e(A, y);
+ return this.addJoint(E, v), this;
+ }, u.prototype.addJoint = function(E, A) {
+ return this._joints.push({ otherImpostor: E, joint: A }), this._physicsEngine && this._physicsEngine.addJoint(this, E, A), this;
+ }, u.prototype.addAnchor = function(E, A, y, v, h) {
+ if (!this._physicsEngine)
+ return this;
+ var d = this._physicsEngine.getPhysicsPlugin();
+ return d.appendAnchor ? (this._physicsEngine && d.appendAnchor(this, E, A, y, v, h), this) : this;
+ }, u.prototype.addHook = function(E, A, y, v) {
+ if (!this._physicsEngine)
+ return this;
+ var h = this._physicsEngine.getPhysicsPlugin();
+ return h.appendAnchor ? (this._physicsEngine && h.appendHook(this, E, A, y, v), this) : this;
+ }, u.prototype.sleep = function() {
+ return this._physicsEngine && this._physicsEngine.getPhysicsPlugin().sleepBody(this), this;
+ }, u.prototype.wakeUp = function() {
+ return this._physicsEngine && this._physicsEngine.getPhysicsPlugin().wakeUpBody(this), this;
+ }, u.prototype.clone = function(E) {
+ return E ? new u(E, this.type, this._options, this._scene) : null;
+ }, u.prototype.dispose = function() {
+ var E = this;
+ this._physicsEngine && (this._joints.forEach(function(A) {
+ E._physicsEngine && E._physicsEngine.removeJoint(E, A.otherImpostor, A.joint);
+ }), this._physicsEngine.removeImpostor(this), this.parent && this.parent.forceUpdate(), this._isDisposed = !0);
+ }, u.prototype.setDeltaPosition = function(E) {
+ this._deltaPosition.copyFrom(E);
+ }, u.prototype.setDeltaRotation = function(E) {
+ this._deltaRotation || (this._deltaRotation = new P.b()), this._deltaRotation.copyFrom(E), this._deltaRotationConjugated = this._deltaRotation.conjugate();
+ }, u.prototype.getBoxSizeToRef = function(E) {
+ return this._physicsEngine && this._physicsEngine.getPhysicsPlugin().getBoxSizeToRef(this, E), this;
+ }, u.prototype.getRadius = function() {
+ return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getRadius(this) : 0;
+ }, u.prototype.syncBoneWithImpostor = function(E, A, y, v, h) {
+ var d = u._tmpVecs[0], b = this.object;
+ if (b.rotationQuaternion)
+ if (h) {
+ var T = u._tmpQuat;
+ b.rotationQuaternion.multiplyToRef(h, T), E.setRotationQuaternion(T, R.c.WORLD, A);
+ } else
+ E.setRotationQuaternion(b.rotationQuaternion, R.c.WORLD, A);
+ d.x = 0, d.y = 0, d.z = 0, y && (d.x = y.x, d.y = y.y, d.z = y.z, E.getDirectionToRef(d, A, d), v == null && (v = y.length()), d.x *= v, d.y *= v, d.z *= v), E.getParent() ? (d.addInPlace(b.getAbsolutePosition()), E.setAbsolutePosition(d, A)) : (A.setAbsolutePosition(b.getAbsolutePosition()), A.position.x -= d.x, A.position.y -= d.y, A.position.z -= d.z);
+ }, u.prototype.syncImpostorWithBone = function(E, A, y, v, h, d) {
+ var b = this.object;
+ if (b.rotationQuaternion)
+ if (h) {
+ var T = u._tmpQuat;
+ E.getRotationQuaternionToRef(R.c.WORLD, A, T), T.multiplyToRef(h, b.rotationQuaternion);
+ } else
+ E.getRotationQuaternionToRef(R.c.WORLD, A, b.rotationQuaternion);
+ var N = u._tmpVecs[0], U = u._tmpVecs[1];
+ d || ((d = u._tmpVecs[2]).x = 0, d.y = 1, d.z = 0), E.getDirectionToRef(d, A, U), E.getAbsolutePositionToRef(A, N), v == null && y && (v = y.length()), v != null && (N.x += U.x * v, N.y += U.y * v, N.z += U.z * v), b.setAbsolutePosition(N);
+ }, u.DEFAULT_OBJECT_SIZE = new P.e(1, 1, 1), u.IDENTITY_QUATERNION = P.b.Identity(), u._tmpVecs = f.a.BuildArray(3, P.e.Zero), u._tmpQuat = P.b.Identity(), u.NoImpostor = 0, u.SphereImpostor = 1, u.BoxImpostor = 2, u.PlaneImpostor = 3, u.MeshImpostor = 4, u.CapsuleImpostor = 6, u.CylinderImpostor = 7, u.ParticleImpostor = 8, u.HeightmapImpostor = 9, u.ConvexHullImpostor = 10, u.CustomImpostor = 100, u.RopeImpostor = 101, u.ClothImpostor = 102, u.SoftbodyImpostor = 103, u;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return f;
+ }), l.d(_, "b", function() {
+ return P;
+ });
+ var D = l(1), f = function() {
+ function c(C) {
+ this.length = 0, this.data = new Array(C), this._id = c._GlobalId++;
+ }
+ return c.prototype.push = function(C) {
+ this.data[this.length++] = C, this.length > this.data.length && (this.data.length *= 2);
+ }, c.prototype.forEach = function(C) {
+ for (var x = 0; x < this.length; x++)
+ C(this.data[x]);
+ }, c.prototype.sort = function(C) {
+ this.data.sort(C);
+ }, c.prototype.reset = function() {
+ this.length = 0;
+ }, c.prototype.dispose = function() {
+ this.reset(), this.data && (this.data.length = 0, this.data = []);
+ }, c.prototype.concat = function(C) {
+ if (C.length !== 0) {
+ this.length + C.length > this.data.length && (this.data.length = 2 * (this.length + C.length));
+ for (var x = 0; x < C.length; x++)
+ this.data[this.length++] = (C.data || C)[x];
+ }
+ }, c.prototype.indexOf = function(C) {
+ var x = this.data.indexOf(C);
+ return x >= this.length ? -1 : x;
+ }, c.prototype.contains = function(C) {
+ return this.indexOf(C) !== -1;
+ }, c._GlobalId = 0, c;
+ }(), P = function(c) {
+ function C() {
+ var x = c !== null && c.apply(this, arguments) || this;
+ return x._duplicateId = 0, x;
+ }
+ return Object(D.d)(C, c), C.prototype.push = function(x) {
+ c.prototype.push.call(this, x), x.__smartArrayFlags || (x.__smartArrayFlags = {}), x.__smartArrayFlags[this._id] = this._duplicateId;
+ }, C.prototype.pushNoDuplicate = function(x) {
+ return (!x.__smartArrayFlags || x.__smartArrayFlags[this._id] !== this._duplicateId) && (this.push(x), !0);
+ }, C.prototype.reset = function() {
+ c.prototype.reset.call(this), this._duplicateId++;
+ }, C.prototype.concatWithNoDuplicate = function(x) {
+ if (x.length !== 0) {
+ this.length + x.length > this.data.length && (this.data.length = 2 * (this.length + x.length));
+ for (var R = 0; R < x.length; R++) {
+ var g = (x.data || x)[R];
+ this.pushNoDuplicate(g);
+ }
+ }
+ }, C;
+ }(f);
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ function f() {
+ }
+ return f.EndsWith = function(P, c) {
+ return P.indexOf(c, P.length - c.length) !== -1;
+ }, f.StartsWith = function(P, c) {
+ return !!P && P.indexOf(c) === 0;
+ }, f.Decode = function(P) {
+ if (typeof TextDecoder < "u")
+ return new TextDecoder().decode(P);
+ for (var c = "", C = 0; C < P.byteLength; C++)
+ c += String.fromCharCode(P[C]);
+ return c;
+ }, f.EncodeArrayBufferToBase64 = function(P) {
+ for (var c, C, x, R, g, u, E, A = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", y = "", v = 0, h = ArrayBuffer.isView(P) ? new Uint8Array(P.buffer, P.byteOffset, P.byteLength) : new Uint8Array(P); v < h.length; )
+ R = (c = h[v++]) >> 2, g = (3 & c) << 4 | (C = v < h.length ? h[v++] : Number.NaN) >> 4, u = (15 & C) << 2 | (x = v < h.length ? h[v++] : Number.NaN) >> 6, E = 63 & x, isNaN(C) ? u = E = 64 : isNaN(x) && (E = 64), y += A.charAt(R) + A.charAt(g) + A.charAt(u) + A.charAt(E);
+ return y;
+ }, f.PadNumber = function(P, c) {
+ for (var C = String(P); C.length < c; )
+ C = "0" + C;
+ return C;
+ }, f;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ function f() {
+ this.rootNodes = new Array(), this.cameras = new Array(), this.lights = new Array(), this.meshes = new Array(), this.skeletons = new Array(), this.particleSystems = new Array(), this.animations = [], this.animationGroups = new Array(), this.multiMaterials = new Array(), this.materials = new Array(), this.morphTargetManagers = new Array(), this.geometries = new Array(), this.transformNodes = new Array(), this.actionManagers = new Array(), this.textures = new Array(), this._environmentTexture = null, this.postProcesses = new Array();
+ }
+ return f.AddParser = function(P, c) {
+ this._BabylonFileParsers[P] = c;
+ }, f.GetParser = function(P) {
+ return this._BabylonFileParsers[P] ? this._BabylonFileParsers[P] : null;
+ }, f.AddIndividualParser = function(P, c) {
+ this._IndividualBabylonFileParsers[P] = c;
+ }, f.GetIndividualParser = function(P) {
+ return this._IndividualBabylonFileParsers[P] ? this._IndividualBabylonFileParsers[P] : null;
+ }, f.Parse = function(P, c, C, x) {
+ for (var R in this._BabylonFileParsers)
+ this._BabylonFileParsers.hasOwnProperty(R) && this._BabylonFileParsers[R](P, c, C, x);
+ }, Object.defineProperty(f.prototype, "environmentTexture", { get: function() {
+ return this._environmentTexture;
+ }, set: function(P) {
+ this._environmentTexture = P;
+ }, enumerable: !1, configurable: !0 }), f.prototype.getNodes = function() {
+ var P = new Array();
+ return P = (P = (P = (P = P.concat(this.meshes)).concat(this.lights)).concat(this.cameras)).concat(this.transformNodes), this.skeletons.forEach(function(c) {
+ return P = P.concat(c.bones);
+ }), P;
+ }, f._BabylonFileParsers = {}, f._IndividualBabylonFileParsers = {}, f;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return g;
+ });
+ var D = l(20), f = l(6), P = l(18), c = l(22), C = l(86), x = l(0), R = l(9), g = function() {
+ function u(E, A) {
+ var y = this;
+ A === void 0 && (A = !0), this.originalScene = E, this._pointerCaptures = {}, this._lastPointerEvents = {}, this._sharedGizmoLight = null, this._renderCamera = null, this.pickUtilitySceneFirst = !0, this.shouldRender = !0, this.onlyCheckPointerDownEvents = !0, this.processAllEvents = !1, this.onPointerOutObservable = new f.c(), this.utilityLayerScene = new D.a(E.getEngine(), { virtual: !0 }), this.utilityLayerScene.useRightHandedSystem = E.useRightHandedSystem, this.utilityLayerScene._allowPostProcessClearColor = !1, this.utilityLayerScene.detachControl(), A && (this._originalPointerObserver = E.onPrePointerObservable.add(function(v, h) {
+ if (y.utilityLayerScene.activeCamera && (y.processAllEvents || v.type === P.a.POINTERMOVE || v.type === P.a.POINTERUP || v.type === P.a.POINTERDOWN || v.type === P.a.POINTERDOUBLETAP)) {
+ y.utilityLayerScene.pointerX = E.pointerX, y.utilityLayerScene.pointerY = E.pointerY;
+ var d = v.event;
+ if (E.isPointerCaptured(d.pointerId))
+ y._pointerCaptures[d.pointerId] = !1;
+ else {
+ var b = v.ray ? y.utilityLayerScene.pickWithRay(v.ray) : y.utilityLayerScene.pick(E.pointerX, E.pointerY);
+ if (!v.ray && b && (v.ray = b.ray), y.utilityLayerScene.onPrePointerObservable.notifyObservers(v), y.onlyCheckPointerDownEvents && v.type != P.a.POINTERDOWN)
+ return v.skipOnPointerObservable || y.utilityLayerScene.onPointerObservable.notifyObservers(new P.b(v.type, v.event, b), v.type), void (v.type === P.a.POINTERUP && y._pointerCaptures[d.pointerId] && (y._pointerCaptures[d.pointerId] = !1));
+ if (y.utilityLayerScene.autoClearDepthAndStencil || y.pickUtilitySceneFirst)
+ b && b.hit && (v.skipOnPointerObservable || y.utilityLayerScene.onPointerObservable.notifyObservers(new P.b(v.type, v.event, b), v.type), v.skipOnPointerObservable = !0);
+ else {
+ var T = v.ray ? E.pickWithRay(v.ray) : E.pick(E.pointerX, E.pointerY), N = v.event;
+ T && b && (b.distance === 0 && T.pickedMesh ? y.mainSceneTrackerPredicate && y.mainSceneTrackerPredicate(T.pickedMesh) ? (y._notifyObservers(v, T, N), v.skipOnPointerObservable = !0) : v.type === P.a.POINTERDOWN ? y._pointerCaptures[N.pointerId] = !0 : y._lastPointerEvents[N.pointerId] && (y.onPointerOutObservable.notifyObservers(N.pointerId), delete y._lastPointerEvents[N.pointerId]) : !y._pointerCaptures[N.pointerId] && (b.distance < T.distance || T.distance === 0) ? (y._notifyObservers(v, b, N), v.skipOnPointerObservable || (v.skipOnPointerObservable = b.distance > 0)) : !y._pointerCaptures[N.pointerId] && b.distance > T.distance && (y.mainSceneTrackerPredicate && y.mainSceneTrackerPredicate(T.pickedMesh) ? (y._notifyObservers(v, T, N), v.skipOnPointerObservable = !0) : y._lastPointerEvents[N.pointerId] && (y.onPointerOutObservable.notifyObservers(N.pointerId), delete y._lastPointerEvents[N.pointerId])), v.type === P.a.POINTERUP && y._pointerCaptures[N.pointerId] && (y._pointerCaptures[N.pointerId] = !1));
+ }
+ }
+ }
+ }), this._originalPointerObserver && E.onPrePointerObservable.makeObserverTopPriority(this._originalPointerObserver)), this.utilityLayerScene.autoClear = !1, this._afterRenderObserver = this.originalScene.onAfterCameraRenderObservable.add(function(v) {
+ y.shouldRender && v == y.getRenderCamera() && y.render();
+ }), this._sceneDisposeObserver = this.originalScene.onDisposeObservable.add(function() {
+ y.dispose();
+ }), this._updateCamera();
+ }
+ return u.prototype.getRenderCamera = function(E) {
+ if (this._renderCamera)
+ return this._renderCamera;
+ var A = void 0;
+ return A = this.originalScene.activeCameras && this.originalScene.activeCameras.length > 1 ? this.originalScene.activeCameras[this.originalScene.activeCameras.length - 1] : this.originalScene.activeCamera, E && A && A.isRigCamera ? A.rigParent : A;
+ }, u.prototype.setRenderCamera = function(E) {
+ this._renderCamera = E;
+ }, u.prototype._getSharedGizmoLight = function() {
+ return this._sharedGizmoLight || (this._sharedGizmoLight = new C.a("shared gizmo light", new x.e(0, 1, 0), this.utilityLayerScene), this._sharedGizmoLight.intensity = 2, this._sharedGizmoLight.groundColor = R.a.Gray()), this._sharedGizmoLight;
+ }, Object.defineProperty(u, "DefaultUtilityLayer", { get: function() {
+ return u._DefaultUtilityLayer == null && (u._DefaultUtilityLayer = new u(c.a.LastCreatedScene), u._DefaultUtilityLayer.originalScene.onDisposeObservable.addOnce(function() {
+ u._DefaultUtilityLayer = null;
+ })), u._DefaultUtilityLayer;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(u, "DefaultKeepDepthUtilityLayer", { get: function() {
+ return u._DefaultKeepDepthUtilityLayer == null && (u._DefaultKeepDepthUtilityLayer = new u(c.a.LastCreatedScene), u._DefaultKeepDepthUtilityLayer.utilityLayerScene.autoClearDepthAndStencil = !1, u._DefaultKeepDepthUtilityLayer.originalScene.onDisposeObservable.addOnce(function() {
+ u._DefaultKeepDepthUtilityLayer = null;
+ })), u._DefaultKeepDepthUtilityLayer;
+ }, enumerable: !1, configurable: !0 }), u.prototype._notifyObservers = function(E, A, y) {
+ E.skipOnPointerObservable || (this.utilityLayerScene.onPointerObservable.notifyObservers(new P.b(E.type, E.event, A), E.type), this._lastPointerEvents[y.pointerId] = !0);
+ }, u.prototype.render = function() {
+ if (this._updateCamera(), this.utilityLayerScene.activeCamera) {
+ var E = this.utilityLayerScene.activeCamera.getScene(), A = this.utilityLayerScene.activeCamera;
+ A._scene = this.utilityLayerScene, A.leftCamera && (A.leftCamera._scene = this.utilityLayerScene), A.rightCamera && (A.rightCamera._scene = this.utilityLayerScene), this.utilityLayerScene.render(!1), A._scene = E, A.leftCamera && (A.leftCamera._scene = E), A.rightCamera && (A.rightCamera._scene = E);
+ }
+ }, u.prototype.dispose = function() {
+ this.onPointerOutObservable.clear(), this._afterRenderObserver && this.originalScene.onAfterCameraRenderObservable.remove(this._afterRenderObserver), this._sceneDisposeObserver && this.originalScene.onDisposeObservable.remove(this._sceneDisposeObserver), this._originalPointerObserver && this.originalScene.onPrePointerObservable.remove(this._originalPointerObserver), this.utilityLayerScene.dispose();
+ }, u.prototype._updateCamera = function() {
+ this.utilityLayerScene.cameraToUseForPointers = this.getRenderCamera(), this.utilityLayerScene.activeCamera = this.getRenderCamera();
+ }, u._DefaultUtilityLayer = null, u._DefaultKeepDepthUtilityLayer = null, u;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return f;
+ });
+ var D = l(139), f = function() {
+ function P() {
+ }
+ return P.EnableFor = function(c) {
+ c._tags = c._tags || {}, c.hasTags = function() {
+ return P.HasTags(c);
+ }, c.addTags = function(C) {
+ return P.AddTagsTo(c, C);
+ }, c.removeTags = function(C) {
+ return P.RemoveTagsFrom(c, C);
+ }, c.matchesTagsQuery = function(C) {
+ return P.MatchesQuery(c, C);
+ };
+ }, P.DisableFor = function(c) {
+ delete c._tags, delete c.hasTags, delete c.addTags, delete c.removeTags, delete c.matchesTagsQuery;
+ }, P.HasTags = function(c) {
+ if (!c._tags)
+ return !1;
+ var C = c._tags;
+ for (var x in C)
+ if (C.hasOwnProperty(x))
+ return !0;
+ return !1;
+ }, P.GetTags = function(c, C) {
+ if (C === void 0 && (C = !0), !c._tags)
+ return null;
+ if (C) {
+ var x = [];
+ for (var R in c._tags)
+ c._tags.hasOwnProperty(R) && c._tags[R] === !0 && x.push(R);
+ return x.join(" ");
+ }
+ return c._tags;
+ }, P.AddTagsTo = function(c, C) {
+ C && typeof C == "string" && C.split(" ").forEach(function(x, R, g) {
+ P._AddTagTo(c, x);
+ });
+ }, P._AddTagTo = function(c, C) {
+ (C = C.trim()) !== "" && C !== "true" && C !== "false" && (C.match(/[\s]/) || C.match(/^([!]|([|]|[&]){2})/) || (P.EnableFor(c), c._tags[C] = !0));
+ }, P.RemoveTagsFrom = function(c, C) {
+ if (P.HasTags(c)) {
+ var x = C.split(" ");
+ for (var R in x)
+ P._RemoveTagFrom(c, x[R]);
+ }
+ }, P._RemoveTagFrom = function(c, C) {
+ delete c._tags[C];
+ }, P.MatchesQuery = function(c, C) {
+ return C === void 0 || (C === "" ? P.HasTags(c) : D.a.Eval(C, function(x) {
+ return P.HasTags(c) && c._tags[x];
+ }));
+ }, P;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ function f() {
+ }
+ return f.IsWindowObjectExist = function() {
+ return typeof window < "u";
+ }, f.IsNavigatorAvailable = function() {
+ return typeof navigator < "u";
+ }, f.IsDocumentAvailable = function() {
+ return typeof document < "u";
+ }, f.GetDOMTextContent = function(P) {
+ for (var c = "", C = P.firstChild; C; )
+ C.nodeType === 3 && (c += C.textContent), C = C.nextSibling;
+ return c;
+ }, f;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return R;
+ });
+ var D = l(44), f = l(0), P = l(54), c = l(114), C = l(20), x = l(24), R = function() {
+ function g(u, E, A) {
+ A === void 0 && (A = Number.MAX_VALUE), this.origin = u, this.direction = E, this.length = A;
+ }
+ return g.prototype.intersectsBoxMinMax = function(u, E, A) {
+ A === void 0 && (A = 0);
+ var y, v, h, d, b = g._TmpVector3[0].copyFromFloats(u.x - A, u.y - A, u.z - A), T = g._TmpVector3[1].copyFromFloats(E.x + A, E.y + A, E.z + A), N = 0, U = Number.MAX_VALUE;
+ if (Math.abs(this.direction.x) < 1e-7) {
+ if (this.origin.x < b.x || this.origin.x > T.x)
+ return !1;
+ } else if (y = 1 / this.direction.x, v = (b.x - this.origin.x) * y, (h = (T.x - this.origin.x) * y) === -1 / 0 && (h = 1 / 0), v > h && (d = v, v = h, h = d), (N = Math.max(v, N)) > (U = Math.min(h, U)))
+ return !1;
+ if (Math.abs(this.direction.y) < 1e-7) {
+ if (this.origin.y < b.y || this.origin.y > T.y)
+ return !1;
+ } else if (y = 1 / this.direction.y, v = (b.y - this.origin.y) * y, (h = (T.y - this.origin.y) * y) === -1 / 0 && (h = 1 / 0), v > h && (d = v, v = h, h = d), (N = Math.max(v, N)) > (U = Math.min(h, U)))
+ return !1;
+ if (Math.abs(this.direction.z) < 1e-7) {
+ if (this.origin.z < b.z || this.origin.z > T.z)
+ return !1;
+ } else if (y = 1 / this.direction.z, v = (b.z - this.origin.z) * y, (h = (T.z - this.origin.z) * y) === -1 / 0 && (h = 1 / 0), v > h && (d = v, v = h, h = d), (N = Math.max(v, N)) > (U = Math.min(h, U)))
+ return !1;
+ return !0;
+ }, g.prototype.intersectsBox = function(u, E) {
+ return E === void 0 && (E = 0), this.intersectsBoxMinMax(u.minimum, u.maximum, E);
+ }, g.prototype.intersectsSphere = function(u, E) {
+ E === void 0 && (E = 0);
+ var A = u.center.x - this.origin.x, y = u.center.y - this.origin.y, v = u.center.z - this.origin.z, h = A * A + y * y + v * v, d = u.radius + E, b = d * d;
+ if (h <= b)
+ return !0;
+ var T = A * this.direction.x + y * this.direction.y + v * this.direction.z;
+ return !(T < 0) && h - T * T <= b;
+ }, g.prototype.intersectsTriangle = function(u, E, A) {
+ var y = g._TmpVector3[0], v = g._TmpVector3[1], h = g._TmpVector3[2], d = g._TmpVector3[3], b = g._TmpVector3[4];
+ E.subtractToRef(u, y), A.subtractToRef(u, v), f.e.CrossToRef(this.direction, v, h);
+ var T = f.e.Dot(y, h);
+ if (T === 0)
+ return null;
+ var N = 1 / T;
+ this.origin.subtractToRef(u, d);
+ var U = f.e.Dot(d, h) * N;
+ if (U < 0 || U > 1)
+ return null;
+ f.e.CrossToRef(d, y, b);
+ var B = f.e.Dot(this.direction, b) * N;
+ if (B < 0 || U + B > 1)
+ return null;
+ var L = f.e.Dot(v, b) * N;
+ return L > this.length ? null : new c.a(1 - U - B, U, L);
+ }, g.prototype.intersectsPlane = function(u) {
+ var E, A = f.e.Dot(u.normal, this.direction);
+ if (Math.abs(A) < 999999997475243e-21)
+ return null;
+ var y = f.e.Dot(u.normal, this.origin);
+ return (E = (-u.d - y) / A) < 0 ? E < -999999997475243e-21 ? null : 0 : E;
+ }, g.prototype.intersectsAxis = function(u, E) {
+ switch (E === void 0 && (E = 0), u) {
+ case "y":
+ return (A = (this.origin.y - E) / this.direction.y) > 0 ? null : new f.e(this.origin.x + this.direction.x * -A, E, this.origin.z + this.direction.z * -A);
+ case "x":
+ return (A = (this.origin.x - E) / this.direction.x) > 0 ? null : new f.e(E, this.origin.y + this.direction.y * -A, this.origin.z + this.direction.z * -A);
+ case "z":
+ var A;
+ return (A = (this.origin.z - E) / this.direction.z) > 0 ? null : new f.e(this.origin.x + this.direction.x * -A, this.origin.y + this.direction.y * -A, E);
+ default:
+ return null;
+ }
+ }, g.prototype.intersectsMesh = function(u, E) {
+ var A = f.c.Matrix[0];
+ return u.getWorldMatrix().invertToRef(A), this._tmpRay ? g.TransformToRef(this, A, this._tmpRay) : this._tmpRay = g.Transform(this, A), u.intersects(this._tmpRay, E);
+ }, g.prototype.intersectsMeshes = function(u, E, A) {
+ A ? A.length = 0 : A = [];
+ for (var y = 0; y < u.length; y++) {
+ var v = this.intersectsMesh(u[y], E);
+ v.hit && A.push(v);
+ }
+ return A.sort(this._comparePickingInfo), A;
+ }, g.prototype._comparePickingInfo = function(u, E) {
+ return u.distance < E.distance ? -1 : u.distance > E.distance ? 1 : 0;
+ }, g.prototype.intersectionSegment = function(u, E, A) {
+ var y = this.origin, v = f.c.Vector3[0], h = f.c.Vector3[1], d = f.c.Vector3[2], b = f.c.Vector3[3];
+ E.subtractToRef(u, v), this.direction.scaleToRef(g.rayl, d), y.addToRef(d, h), u.subtractToRef(y, b);
+ var T, N, U, B, L = f.e.Dot(v, v), j = f.e.Dot(v, d), W = f.e.Dot(d, d), Y = f.e.Dot(v, b), oe = f.e.Dot(d, b), te = L * W - j * j, _e = te, de = te;
+ te < g.smallnum ? (N = 0, _e = 1, B = oe, de = W) : (B = L * oe - j * Y, (N = j * oe - W * Y) < 0 ? (N = 0, B = oe, de = W) : N > _e && (N = _e, B = oe + j, de = W)), B < 0 ? (B = 0, -Y < 0 ? N = 0 : -Y > L ? N = _e : (N = -Y, _e = L)) : B > de && (B = de, -Y + j < 0 ? N = 0 : -Y + j > L ? N = _e : (N = -Y + j, _e = L)), T = Math.abs(N) < g.smallnum ? 0 : N / _e, U = Math.abs(B) < g.smallnum ? 0 : B / de;
+ var ae = f.c.Vector3[4];
+ d.scaleToRef(U, ae);
+ var ie = f.c.Vector3[5];
+ v.scaleToRef(T, ie), ie.addInPlace(b);
+ var Z = f.c.Vector3[6];
+ return ie.subtractToRef(ae, Z), U > 0 && U <= this.length && Z.lengthSquared() < A * A ? ie.length() : -1;
+ }, g.prototype.update = function(u, E, A, y, v, h, d) {
+ return this.unprojectRayToRef(u, E, A, y, v, h, d), this;
+ }, g.Zero = function() {
+ return new g(f.e.Zero(), f.e.Zero());
+ }, g.CreateNew = function(u, E, A, y, v, h, d) {
+ return g.Zero().update(u, E, A, y, v, h, d);
+ }, g.CreateNewFromTo = function(u, E, A) {
+ A === void 0 && (A = f.a.IdentityReadOnly);
+ var y = E.subtract(u), v = Math.sqrt(y.x * y.x + y.y * y.y + y.z * y.z);
+ return y.normalize(), g.Transform(new g(u, y, v), A);
+ }, g.Transform = function(u, E) {
+ var A = new g(new f.e(0, 0, 0), new f.e(0, 0, 0));
+ return g.TransformToRef(u, E, A), A;
+ }, g.TransformToRef = function(u, E, A) {
+ f.e.TransformCoordinatesToRef(u.origin, E, A.origin), f.e.TransformNormalToRef(u.direction, E, A.direction), A.length = u.length;
+ var y = A.direction, v = y.length();
+ if (v !== 0 && v !== 1) {
+ var h = 1 / v;
+ y.x *= h, y.y *= h, y.z *= h, A.length *= v;
+ }
+ }, g.prototype.unprojectRayToRef = function(u, E, A, y, v, h, d) {
+ var b = f.c.Matrix[0];
+ v.multiplyToRef(h, b), b.multiplyToRef(d, b), b.invert();
+ var T = f.c.Vector3[0];
+ T.x = u / A * 2 - 1, T.y = -(E / y * 2 - 1), T.z = -1;
+ var N = f.c.Vector3[1].copyFromFloats(T.x, T.y, 1), U = f.c.Vector3[2], B = f.c.Vector3[3];
+ f.e._UnprojectFromInvertedMatrixToRef(T, b, U), f.e._UnprojectFromInvertedMatrixToRef(N, b, B), this.origin.copyFrom(U), B.subtractToRef(U, this.direction), this.direction.normalize();
+ }, g._TmpVector3 = D.a.BuildArray(6, f.e.Zero), g.smallnum = 1e-8, g.rayl = 1e9, g;
+ }();
+ C.a.prototype.createPickingRay = function(g, u, E, A, y) {
+ y === void 0 && (y = !1);
+ var v = R.Zero();
+ return this.createPickingRayToRef(g, u, E, v, A, y), v;
+ }, C.a.prototype.createPickingRayToRef = function(g, u, E, A, y, v) {
+ v === void 0 && (v = !1);
+ var h = this.getEngine();
+ if (!y) {
+ if (!this.activeCamera)
+ return this;
+ y = this.activeCamera;
+ }
+ var d = y.viewport.toGlobal(h.getRenderWidth(), h.getRenderHeight());
+ return g = g / h.getHardwareScalingLevel() - d.x, u = u / h.getHardwareScalingLevel() - (h.getRenderHeight() - d.y - d.height), A.update(g, u, d.width, d.height, E || f.a.IdentityReadOnly, v ? f.a.IdentityReadOnly : y.getViewMatrix(), y.getProjectionMatrix()), this;
+ }, C.a.prototype.createPickingRayInCameraSpace = function(g, u, E) {
+ var A = R.Zero();
+ return this.createPickingRayInCameraSpaceToRef(g, u, A, E), A;
+ }, C.a.prototype.createPickingRayInCameraSpaceToRef = function(g, u, E, A) {
+ if (!P.a)
+ return this;
+ var y = this.getEngine();
+ if (!A) {
+ if (!this.activeCamera)
+ throw new Error("Active camera not set");
+ A = this.activeCamera;
+ }
+ var v = A.viewport.toGlobal(y.getRenderWidth(), y.getRenderHeight()), h = f.a.Identity();
+ return g = g / y.getHardwareScalingLevel() - v.x, u = u / y.getHardwareScalingLevel() - (y.getRenderHeight() - v.y - v.height), E.update(g, u, v.width, v.height, h, h, A.getProjectionMatrix()), this;
+ }, C.a.prototype._internalPickForMesh = function(g, u, E, A, y, v, h, d) {
+ var b = u(A), T = E.intersects(b, y, h, v, A, d);
+ return T && T.hit ? !y && g != null && T.distance >= g.distance ? null : T : null;
+ }, C.a.prototype._internalPick = function(g, u, E, A, y) {
+ if (!P.a)
+ return null;
+ for (var v = null, h = 0; h < this.meshes.length; h++) {
+ var d = this.meshes[h];
+ if (u) {
+ if (!u(d))
+ continue;
+ } else if (!d.isEnabled() || !d.isVisible || !d.isPickable)
+ continue;
+ var b, T = d.skeleton && d.skeleton.overrideMesh ? d.skeleton.overrideMesh.getWorldMatrix() : d.getWorldMatrix();
+ if (d.hasThinInstances && d.thinInstanceEnablePicking) {
+ if (b = this._internalPickForMesh(v, g, d, T, !0, !0, y)) {
+ if (A)
+ return v;
+ for (var N = f.c.Matrix[1], U = d.thinInstanceGetWorldMatrices(), B = 0; B < U.length; B++) {
+ U[B].multiplyToRef(T, N);
+ var L = this._internalPickForMesh(v, g, d, N, E, A, y, !0);
+ if (L && ((v = L).thinInstanceIndex = B, E))
+ return v;
+ }
+ }
+ } else if ((b = this._internalPickForMesh(v, g, d, T, E, A, y)) && (v = b, E))
+ return v;
+ }
+ return v || new P.a();
+ }, C.a.prototype._internalMultiPick = function(g, u, E) {
+ if (!P.a)
+ return null;
+ for (var A = new Array(), y = 0; y < this.meshes.length; y++) {
+ var v = this.meshes[y];
+ if (u) {
+ if (!u(v))
+ continue;
+ } else if (!v.isEnabled() || !v.isVisible || !v.isPickable)
+ continue;
+ var h, d = v.skeleton && v.skeleton.overrideMesh ? v.skeleton.overrideMesh.getWorldMatrix() : v.getWorldMatrix();
+ if (v.hasThinInstances && v.thinInstanceEnablePicking) {
+ if (h = this._internalPickForMesh(null, g, v, d, !0, !0, E))
+ for (var b = f.c.Matrix[1], T = v.thinInstanceGetWorldMatrices(), N = 0; N < T.length; N++) {
+ T[N].multiplyToRef(d, b);
+ var U = this._internalPickForMesh(null, g, v, b, !1, !1, E, !0);
+ U && (U.thinInstanceIndex = N, A.push(U));
+ }
+ } else
+ (h = this._internalPickForMesh(null, g, v, d, !1, !1, E)) && A.push(h);
+ }
+ return A;
+ }, C.a.prototype.pickWithBoundingInfo = function(g, u, E, A, y) {
+ var v = this;
+ if (!P.a)
+ return null;
+ var h = this._internalPick(function(d) {
+ return v._tempPickingRay || (v._tempPickingRay = R.Zero()), v.createPickingRayToRef(g, u, d, v._tempPickingRay, y || null), v._tempPickingRay;
+ }, E, A, !0);
+ return h && (h.ray = this.createPickingRay(g, u, f.a.Identity(), y || null)), h;
+ }, C.a.prototype.pick = function(g, u, E, A, y, v) {
+ var h = this;
+ if (!P.a)
+ return null;
+ var d = this._internalPick(function(b) {
+ return h._tempPickingRay || (h._tempPickingRay = R.Zero()), h.createPickingRayToRef(g, u, b, h._tempPickingRay, y || null), h._tempPickingRay;
+ }, E, A, !1, v);
+ return d && (d.ray = this.createPickingRay(g, u, f.a.Identity(), y || null)), d;
+ }, C.a.prototype.pickWithRay = function(g, u, E, A) {
+ var y = this, v = this._internalPick(function(h) {
+ return y._pickWithRayInverseMatrix || (y._pickWithRayInverseMatrix = f.a.Identity()), h.invertToRef(y._pickWithRayInverseMatrix), y._cachedRayForTransform || (y._cachedRayForTransform = R.Zero()), R.TransformToRef(g, y._pickWithRayInverseMatrix, y._cachedRayForTransform), y._cachedRayForTransform;
+ }, u, E, !1, A);
+ return v && (v.ray = g), v;
+ }, C.a.prototype.multiPick = function(g, u, E, A, y) {
+ var v = this;
+ return this._internalMultiPick(function(h) {
+ return v.createPickingRay(g, u, h, A || null);
+ }, E, y);
+ }, C.a.prototype.multiPickWithRay = function(g, u, E) {
+ var A = this;
+ return this._internalMultiPick(function(y) {
+ return A._pickWithRayInverseMatrix || (A._pickWithRayInverseMatrix = f.a.Identity()), y.invertToRef(A._pickWithRayInverseMatrix), A._cachedRayForTransform || (A._cachedRayForTransform = R.Zero()), R.TransformToRef(g, A._pickWithRayInverseMatrix, A._cachedRayForTransform), A._cachedRayForTransform;
+ }, u, E);
+ }, x.a.prototype.getForwardRay = function(g, u, E) {
+ return g === void 0 && (g = 100), this.getForwardRayToRef(new R(f.e.Zero(), f.e.Zero(), g), g, u, E);
+ }, x.a.prototype.getForwardRayToRef = function(g, u, E, A) {
+ return u === void 0 && (u = 100), E || (E = this.getWorldMatrix()), g.length = u, A ? g.origin.copyFrom(A) : g.origin.copyFrom(this.position), f.c.Vector3[2].set(0, 0, this._scene.useRightHandedSystem ? -1 : 1), f.e.TransformNormalToRef(f.c.Vector3[2], E, f.c.Vector3[3]), f.e.NormalizeToRef(f.c.Vector3[3], g.direction), g;
+ };
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return x;
+ });
+ var D = l(0), f = l(7), P = l(16), c = l(98), C = l(4);
+ P.a.CreateLineSystem = function(R) {
+ for (var g = [], u = [], E = R.lines, A = R.colors, y = [], v = 0, h = 0; h < E.length; h++)
+ for (var d = E[h], b = 0; b < d.length; b++) {
+ if (u.push(d[b].x, d[b].y, d[b].z), A) {
+ var T = A[h];
+ y.push(T[b].r, T[b].g, T[b].b, T[b].a);
+ }
+ b > 0 && (g.push(v - 1), g.push(v)), v++;
+ }
+ var N = new P.a();
+ return N.indices = g, N.positions = u, A && (N.colors = y), N;
+ }, P.a.CreateDashedLines = function(R) {
+ var g, u, E = R.dashSize || 3, A = R.gapSize || 1, y = R.dashNb || 200, v = R.points, h = new Array(), d = new Array(), b = D.e.Zero(), T = 0, N = 0, U = 0, B = 0, L = 0;
+ for (L = 0; L < v.length - 1; L++)
+ v[L + 1].subtractToRef(v[L], b), T += b.length();
+ for (u = E * (g = T / y) / (E + A), L = 0; L < v.length - 1; L++) {
+ v[L + 1].subtractToRef(v[L], b), N = Math.floor(b.length() / g), b.normalize();
+ for (var j = 0; j < N; j++)
+ U = g * j, h.push(v[L].x + U * b.x, v[L].y + U * b.y, v[L].z + U * b.z), h.push(v[L].x + (U + u) * b.x, v[L].y + (U + u) * b.y, v[L].z + (U + u) * b.z), d.push(B, B + 1), B += 2;
+ }
+ var W = new P.a();
+ return W.positions = h, W.indices = d, W;
+ }, f.a.CreateLines = function(R, g, u, E, A) {
+ u === void 0 && (u = null), E === void 0 && (E = !1), A === void 0 && (A = null);
+ var y = { points: g, updatable: E, instance: A };
+ return x.CreateLines(R, y, u);
+ }, f.a.CreateDashedLines = function(R, g, u, E, A, y, v, h) {
+ y === void 0 && (y = null);
+ var d = { points: g, dashSize: u, gapSize: E, dashNb: A, updatable: v, instance: h };
+ return x.CreateDashedLines(R, d, y);
+ };
+ var x = function() {
+ function R() {
+ }
+ return R.CreateLineSystem = function(g, u, E) {
+ var A = u.instance, y = u.lines, v = u.colors;
+ if (A) {
+ var h, d, b = A.getVerticesData(C.b.PositionKind);
+ v && (h = A.getVerticesData(C.b.ColorKind));
+ for (var T = 0, N = 0, U = 0; U < y.length; U++)
+ for (var B = y[U], L = 0; L < B.length; L++)
+ b[T] = B[L].x, b[T + 1] = B[L].y, b[T + 2] = B[L].z, v && h && (d = v[U], h[N] = d[L].r, h[N + 1] = d[L].g, h[N + 2] = d[L].b, h[N + 3] = d[L].a, N += 4), T += 3;
+ return A.updateVerticesData(C.b.PositionKind, b, !1, !1), v && h && A.updateVerticesData(C.b.ColorKind, h, !1, !1), A;
+ }
+ var j = !!v, W = new c.b(g, E, null, void 0, void 0, j, u.useVertexAlpha);
+ return P.a.CreateLineSystem(u).applyToMesh(W, u.updatable), W;
+ }, R.CreateLines = function(g, u, E) {
+ E === void 0 && (E = null);
+ var A = u.colors ? [u.colors] : null;
+ return R.CreateLineSystem(g, { lines: [u.points], updatable: u.updatable, instance: u.instance, colors: A, useVertexAlpha: u.useVertexAlpha }, E);
+ }, R.CreateDashedLines = function(g, u, E) {
+ E === void 0 && (E = null);
+ var A = u.points, y = u.instance, v = u.gapSize || 1, h = u.dashSize || 3;
+ if (y)
+ return y.updateMeshPositions(function(b) {
+ var T, N, U = D.e.Zero(), B = b.length / 6, L = 0, j = 0, W = 0, Y = 0, oe = 0, te = 0;
+ for (oe = 0; oe < A.length - 1; oe++)
+ A[oe + 1].subtractToRef(A[oe], U), L += U.length();
+ T = L / B;
+ var _e = y._creationDataStorage.dashSize;
+ for (N = _e * T / (_e + y._creationDataStorage.gapSize), oe = 0; oe < A.length - 1; oe++)
+ for (A[oe + 1].subtractToRef(A[oe], U), j = Math.floor(U.length() / T), U.normalize(), te = 0; te < j && Y < b.length; )
+ W = T * te, b[Y] = A[oe].x + W * U.x, b[Y + 1] = A[oe].y + W * U.y, b[Y + 2] = A[oe].z + W * U.z, b[Y + 3] = A[oe].x + (W + N) * U.x, b[Y + 4] = A[oe].y + (W + N) * U.y, b[Y + 5] = A[oe].z + (W + N) * U.z, Y += 6, te++;
+ for (; Y < b.length; )
+ b[Y] = A[oe].x, b[Y + 1] = A[oe].y, b[Y + 2] = A[oe].z, Y += 3;
+ }, !1), y;
+ var d = new c.b(g, E, null, void 0, void 0, void 0, u.useVertexAlpha);
+ return P.a.CreateDashedLines(u).applyToMesh(d, u.updatable), d._creationDataStorage = new f.b(), d._creationDataStorage.dashSize = h, d._creationDataStorage.gapSize = v, d;
+ }, R;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return c;
+ });
+ var D = l(34), f = l(8), P = function(C, x) {
+ return C ? C.getClassName && C.getClassName() === "Mesh" ? null : C.getClassName && C.getClassName() === "SubMesh" ? C.clone(x) : C.clone ? C.clone() : null : null;
+ }, c = function() {
+ function C() {
+ }
+ return C.DeepCopy = function(x, R, g, u) {
+ for (var E = 0, A = function(T) {
+ var N = [];
+ do
+ Object.getOwnPropertyNames(T).forEach(function(U) {
+ N.indexOf(U) === -1 && N.push(U);
+ });
+ while (T = Object.getPrototypeOf(T));
+ return N;
+ }(x); E < A.length; E++) {
+ var y = A[E];
+ if ((y[0] !== "_" || u && u.indexOf(y) !== -1) && !(D.a.EndsWith(y, "Observable") || g && g.indexOf(y) !== -1)) {
+ var v = x[y], h = typeof v;
+ if (h !== "function")
+ try {
+ if (h === "object")
+ if (v instanceof Array) {
+ if (R[y] = [], v.length > 0)
+ if (typeof v[0] == "object")
+ for (var d = 0; d < v.length; d++) {
+ var b = P(v[d], R);
+ R[y].indexOf(b) === -1 && R[y].push(b);
+ }
+ else
+ R[y] = v.slice(0);
+ } else
+ R[y] = P(v, R);
+ else
+ R[y] = v;
+ } catch (T) {
+ f.a.Warn(T.message);
+ }
+ }
+ }
+ }, C;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "b", function() {
+ return g;
+ }), l.d(_, "a", function() {
+ return u;
+ });
+ var D = l(1), f = l(3), P = l(6), c = l(12), C = l(9), x = l(76), R = l(121), g = function(E) {
+ function A() {
+ var y = E.call(this) || this;
+ return y.IMAGEPROCESSING = !1, y.VIGNETTE = !1, y.VIGNETTEBLENDMODEMULTIPLY = !1, y.VIGNETTEBLENDMODEOPAQUE = !1, y.TONEMAPPING = !1, y.TONEMAPPING_ACES = !1, y.CONTRAST = !1, y.COLORCURVES = !1, y.COLORGRADING = !1, y.COLORGRADING3D = !1, y.SAMPLER3DGREENDEPTH = !1, y.SAMPLER3DBGRMAP = !1, y.IMAGEPROCESSINGPOSTPROCESS = !1, y.EXPOSURE = !1, y.rebuild(), y;
+ }
+ return Object(D.d)(A, E), A;
+ }(x.a), u = function() {
+ function E() {
+ this.colorCurves = new R.a(), this._colorCurvesEnabled = !1, this._colorGradingEnabled = !1, this._colorGradingWithGreenDepth = !0, this._colorGradingBGR = !0, this._exposure = 1, this._toneMappingEnabled = !1, this._toneMappingType = E.TONEMAPPING_STANDARD, this._contrast = 1, this.vignetteStretch = 0, this.vignetteCentreX = 0, this.vignetteCentreY = 0, this.vignetteWeight = 1.5, this.vignetteColor = new C.b(0, 0, 0, 0), this.vignetteCameraFov = 0.5, this._vignetteBlendMode = E.VIGNETTEMODE_MULTIPLY, this._vignetteEnabled = !1, this._applyByPostProcess = !1, this._isEnabled = !0, this.onUpdateParameters = new P.c();
+ }
+ return Object.defineProperty(E.prototype, "colorCurvesEnabled", { get: function() {
+ return this._colorCurvesEnabled;
+ }, set: function(A) {
+ this._colorCurvesEnabled !== A && (this._colorCurvesEnabled = A, this._updateParameters());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "colorGradingTexture", { get: function() {
+ return this._colorGradingTexture;
+ }, set: function(A) {
+ this._colorGradingTexture !== A && (this._colorGradingTexture = A, this._updateParameters());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "colorGradingEnabled", { get: function() {
+ return this._colorGradingEnabled;
+ }, set: function(A) {
+ this._colorGradingEnabled !== A && (this._colorGradingEnabled = A, this._updateParameters());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "colorGradingWithGreenDepth", { get: function() {
+ return this._colorGradingWithGreenDepth;
+ }, set: function(A) {
+ this._colorGradingWithGreenDepth !== A && (this._colorGradingWithGreenDepth = A, this._updateParameters());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "colorGradingBGR", { get: function() {
+ return this._colorGradingBGR;
+ }, set: function(A) {
+ this._colorGradingBGR !== A && (this._colorGradingBGR = A, this._updateParameters());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "exposure", { get: function() {
+ return this._exposure;
+ }, set: function(A) {
+ this._exposure !== A && (this._exposure = A, this._updateParameters());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "toneMappingEnabled", { get: function() {
+ return this._toneMappingEnabled;
+ }, set: function(A) {
+ this._toneMappingEnabled !== A && (this._toneMappingEnabled = A, this._updateParameters());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "toneMappingType", { get: function() {
+ return this._toneMappingType;
+ }, set: function(A) {
+ this._toneMappingType !== A && (this._toneMappingType = A, this._updateParameters());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "contrast", { get: function() {
+ return this._contrast;
+ }, set: function(A) {
+ this._contrast !== A && (this._contrast = A, this._updateParameters());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "vignetteBlendMode", { get: function() {
+ return this._vignetteBlendMode;
+ }, set: function(A) {
+ this._vignetteBlendMode !== A && (this._vignetteBlendMode = A, this._updateParameters());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "vignetteEnabled", { get: function() {
+ return this._vignetteEnabled;
+ }, set: function(A) {
+ this._vignetteEnabled !== A && (this._vignetteEnabled = A, this._updateParameters());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "applyByPostProcess", { get: function() {
+ return this._applyByPostProcess;
+ }, set: function(A) {
+ this._applyByPostProcess !== A && (this._applyByPostProcess = A, this._updateParameters());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "isEnabled", { get: function() {
+ return this._isEnabled;
+ }, set: function(A) {
+ this._isEnabled !== A && (this._isEnabled = A, this._updateParameters());
+ }, enumerable: !1, configurable: !0 }), E.prototype._updateParameters = function() {
+ this.onUpdateParameters.notifyObservers(this);
+ }, E.prototype.getClassName = function() {
+ return "ImageProcessingConfiguration";
+ }, E.PrepareUniforms = function(A, y) {
+ y.EXPOSURE && A.push("exposureLinear"), y.CONTRAST && A.push("contrast"), y.COLORGRADING && A.push("colorTransformSettings"), y.VIGNETTE && (A.push("vInverseScreenSize"), A.push("vignetteSettings1"), A.push("vignetteSettings2")), y.COLORCURVES && R.a.PrepareUniforms(A);
+ }, E.PrepareSamplers = function(A, y) {
+ y.COLORGRADING && A.push("txColorTransform");
+ }, E.prototype.prepareDefines = function(A, y) {
+ if (y === void 0 && (y = !1), y !== this.applyByPostProcess || !this._isEnabled)
+ return A.VIGNETTE = !1, A.TONEMAPPING = !1, A.TONEMAPPING_ACES = !1, A.CONTRAST = !1, A.EXPOSURE = !1, A.COLORCURVES = !1, A.COLORGRADING = !1, A.COLORGRADING3D = !1, A.IMAGEPROCESSING = !1, void (A.IMAGEPROCESSINGPOSTPROCESS = this.applyByPostProcess && this._isEnabled);
+ switch (A.VIGNETTE = this.vignetteEnabled, A.VIGNETTEBLENDMODEMULTIPLY = this.vignetteBlendMode === E._VIGNETTEMODE_MULTIPLY, A.VIGNETTEBLENDMODEOPAQUE = !A.VIGNETTEBLENDMODEMULTIPLY, A.TONEMAPPING = this.toneMappingEnabled, this._toneMappingType) {
+ case E.TONEMAPPING_ACES:
+ A.TONEMAPPING_ACES = !0;
+ break;
+ default:
+ A.TONEMAPPING_ACES = !1;
+ }
+ A.CONTRAST = this.contrast !== 1, A.EXPOSURE = this.exposure !== 1, A.COLORCURVES = this.colorCurvesEnabled && !!this.colorCurves, A.COLORGRADING = this.colorGradingEnabled && !!this.colorGradingTexture, A.COLORGRADING ? A.COLORGRADING3D = this.colorGradingTexture.is3D : A.COLORGRADING3D = !1, A.SAMPLER3DGREENDEPTH = this.colorGradingWithGreenDepth, A.SAMPLER3DBGRMAP = this.colorGradingBGR, A.IMAGEPROCESSINGPOSTPROCESS = this.applyByPostProcess, A.IMAGEPROCESSING = A.VIGNETTE || A.TONEMAPPING || A.CONTRAST || A.EXPOSURE || A.COLORCURVES || A.COLORGRADING;
+ }, E.prototype.isReady = function() {
+ return !this.colorGradingEnabled || !this.colorGradingTexture || this.colorGradingTexture.isReady();
+ }, E.prototype.bind = function(A, y) {
+ if (this._colorCurvesEnabled && this.colorCurves && R.a.Bind(this.colorCurves, A), this._vignetteEnabled) {
+ var v = 1 / A.getEngine().getRenderWidth(), h = 1 / A.getEngine().getRenderHeight();
+ A.setFloat2("vInverseScreenSize", v, h);
+ var d = y ?? h / v, b = Math.tan(0.5 * this.vignetteCameraFov), T = b * d, N = Math.sqrt(T * b);
+ T = c.b.Mix(T, N, this.vignetteStretch), b = c.b.Mix(b, N, this.vignetteStretch), A.setFloat4("vignetteSettings1", T, b, -T * this.vignetteCentreX, -b * this.vignetteCentreY);
+ var U = -2 * this.vignetteWeight;
+ A.setFloat4("vignetteSettings2", this.vignetteColor.r, this.vignetteColor.g, this.vignetteColor.b, U);
+ }
+ if (A.setFloat("exposureLinear", this.exposure), A.setFloat("contrast", this.contrast), this.colorGradingTexture) {
+ A.setTexture("txColorTransform", this.colorGradingTexture);
+ var B = this.colorGradingTexture.getSize().height;
+ A.setFloat4("colorTransformSettings", (B - 1) / B, 0.5 / B, B, this.colorGradingTexture.level);
+ }
+ }, E.prototype.clone = function() {
+ return f.a.Clone(function() {
+ return new E();
+ }, this);
+ }, E.prototype.serialize = function() {
+ return f.a.Serialize(this);
+ }, E.Parse = function(A) {
+ return f.a.Parse(function() {
+ return new E();
+ }, A, null, null);
+ }, Object.defineProperty(E, "VIGNETTEMODE_MULTIPLY", { get: function() {
+ return this._VIGNETTEMODE_MULTIPLY;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E, "VIGNETTEMODE_OPAQUE", { get: function() {
+ return this._VIGNETTEMODE_OPAQUE;
+ }, enumerable: !1, configurable: !0 }), E.TONEMAPPING_STANDARD = 0, E.TONEMAPPING_ACES = 1, E._VIGNETTEMODE_MULTIPLY = 0, E._VIGNETTEMODE_OPAQUE = 1, Object(D.c)([Object(f.g)()], E.prototype, "colorCurves", void 0), Object(D.c)([Object(f.c)()], E.prototype, "_colorCurvesEnabled", void 0), Object(D.c)([Object(f.m)("colorGradingTexture")], E.prototype, "_colorGradingTexture", void 0), Object(D.c)([Object(f.c)()], E.prototype, "_colorGradingEnabled", void 0), Object(D.c)([Object(f.c)()], E.prototype, "_colorGradingWithGreenDepth", void 0), Object(D.c)([Object(f.c)()], E.prototype, "_colorGradingBGR", void 0), Object(D.c)([Object(f.c)()], E.prototype, "_exposure", void 0), Object(D.c)([Object(f.c)()], E.prototype, "_toneMappingEnabled", void 0), Object(D.c)([Object(f.c)()], E.prototype, "_toneMappingType", void 0), Object(D.c)([Object(f.c)()], E.prototype, "_contrast", void 0), Object(D.c)([Object(f.c)()], E.prototype, "vignetteStretch", void 0), Object(D.c)([Object(f.c)()], E.prototype, "vignetteCentreX", void 0), Object(D.c)([Object(f.c)()], E.prototype, "vignetteCentreY", void 0), Object(D.c)([Object(f.c)()], E.prototype, "vignetteWeight", void 0), Object(D.c)([Object(f.f)()], E.prototype, "vignetteColor", void 0), Object(D.c)([Object(f.c)()], E.prototype, "vignetteCameraFov", void 0), Object(D.c)([Object(f.c)()], E.prototype, "_vignetteBlendMode", void 0), Object(D.c)([Object(f.c)()], E.prototype, "_vignetteEnabled", void 0), Object(D.c)([Object(f.c)()], E.prototype, "_applyByPostProcess", void 0), Object(D.c)([Object(f.c)()], E.prototype, "_isEnabled", void 0), E;
+ }();
+ f.a._ImageProcessingConfigurationParser = u.Parse;
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return E;
+ });
+ var D = l(44), f = l(0), P = l(2), c = l(103), C = l(113), x = { min: 0, max: 0 }, R = { min: 0, max: 0 }, g = function(A, y, v) {
+ var h = f.e.Dot(y.centerWorld, A), d = Math.abs(f.e.Dot(y.directions[0], A)) * y.extendSize.x + Math.abs(f.e.Dot(y.directions[1], A)) * y.extendSize.y + Math.abs(f.e.Dot(y.directions[2], A)) * y.extendSize.z;
+ v.min = h - d, v.max = h + d;
+ }, u = function(A, y, v) {
+ return g(A, y, x), g(A, v, R), !(x.min > R.max || R.min > x.max);
+ }, E = function() {
+ function A(y, v, h) {
+ this._isLocked = !1, this.boundingBox = new c.a(y, v, h), this.boundingSphere = new C.a(y, v, h);
+ }
+ return A.prototype.reConstruct = function(y, v, h) {
+ this.boundingBox.reConstruct(y, v, h), this.boundingSphere.reConstruct(y, v, h);
+ }, Object.defineProperty(A.prototype, "minimum", { get: function() {
+ return this.boundingBox.minimum;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(A.prototype, "maximum", { get: function() {
+ return this.boundingBox.maximum;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(A.prototype, "isLocked", { get: function() {
+ return this._isLocked;
+ }, set: function(y) {
+ this._isLocked = y;
+ }, enumerable: !1, configurable: !0 }), A.prototype.update = function(y) {
+ this._isLocked || (this.boundingBox._update(y), this.boundingSphere._update(y));
+ }, A.prototype.centerOn = function(y, v) {
+ var h = A.TmpVector3[0].copyFrom(y).subtractInPlace(v), d = A.TmpVector3[1].copyFrom(y).addInPlace(v);
+ return this.boundingBox.reConstruct(h, d, this.boundingBox.getWorldMatrix()), this.boundingSphere.reConstruct(h, d, this.boundingBox.getWorldMatrix()), this;
+ }, A.prototype.scale = function(y) {
+ return this.boundingBox.scale(y), this.boundingSphere.scale(y), this;
+ }, A.prototype.isInFrustum = function(y, v) {
+ return v === void 0 && (v = P.a.MESHES_CULLINGSTRATEGY_STANDARD), !(v !== P.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION && v !== P.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY || !this.boundingSphere.isCenterInFrustum(y)) || !!this.boundingSphere.isInFrustum(y) && (!(v !== P.a.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY && v !== P.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY) || this.boundingBox.isInFrustum(y));
+ }, Object.defineProperty(A.prototype, "diagonalLength", { get: function() {
+ var y = this.boundingBox;
+ return y.maximumWorld.subtractToRef(y.minimumWorld, A.TmpVector3[0]).length();
+ }, enumerable: !1, configurable: !0 }), A.prototype.isCompletelyInFrustum = function(y) {
+ return this.boundingBox.isCompletelyInFrustum(y);
+ }, A.prototype._checkCollision = function(y) {
+ return y._canDoCollision(this.boundingSphere.centerWorld, this.boundingSphere.radiusWorld, this.boundingBox.minimumWorld, this.boundingBox.maximumWorld);
+ }, A.prototype.intersectsPoint = function(y) {
+ return !!this.boundingSphere.centerWorld && !!this.boundingSphere.intersectsPoint(y) && !!this.boundingBox.intersectsPoint(y);
+ }, A.prototype.intersects = function(y, v) {
+ if (!C.a.Intersects(this.boundingSphere, y.boundingSphere) || !c.a.Intersects(this.boundingBox, y.boundingBox))
+ return !1;
+ if (!v)
+ return !0;
+ var h = this.boundingBox, d = y.boundingBox;
+ return !!u(h.directions[0], h, d) && !!u(h.directions[1], h, d) && !!u(h.directions[2], h, d) && !!u(d.directions[0], h, d) && !!u(d.directions[1], h, d) && !!u(d.directions[2], h, d) && !!u(f.e.Cross(h.directions[0], d.directions[0]), h, d) && !!u(f.e.Cross(h.directions[0], d.directions[1]), h, d) && !!u(f.e.Cross(h.directions[0], d.directions[2]), h, d) && !!u(f.e.Cross(h.directions[1], d.directions[0]), h, d) && !!u(f.e.Cross(h.directions[1], d.directions[1]), h, d) && !!u(f.e.Cross(h.directions[1], d.directions[2]), h, d) && !!u(f.e.Cross(h.directions[2], d.directions[0]), h, d) && !!u(f.e.Cross(h.directions[2], d.directions[1]), h, d) && !!u(f.e.Cross(h.directions[2], d.directions[2]), h, d);
+ }, A.TmpVector3 = D.a.BuildArray(2, f.e.Zero), A;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ function f() {
+ }
+ return f.BuildArray = function(P, c) {
+ for (var C = [], x = 0; x < P; ++x)
+ C.push(c());
+ return C;
+ }, f;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return c;
+ });
+ var D = l(0), f = l(7), P = l(16);
+ P.a.CreateSphere = function(C) {
+ for (var x = C.segments || 32, R = C.diameterX || C.diameter || 1, g = C.diameterY || C.diameter || 1, u = C.diameterZ || C.diameter || 1, E = C.arc && (C.arc <= 0 || C.arc > 1) ? 1 : C.arc || 1, A = C.slice && C.slice <= 0 ? 1 : C.slice || 1, y = C.sideOrientation === 0 ? 0 : C.sideOrientation || P.a.DEFAULTSIDE, v = !!C.dedupTopBottomIndices, h = new D.e(R / 2, g / 2, u / 2), d = 2 + x, b = 2 * d, T = [], N = [], U = [], B = [], L = 0; L <= d; L++) {
+ for (var j = L / d, W = j * Math.PI * A, Y = 0; Y <= b; Y++) {
+ var oe = Y / b, te = oe * Math.PI * 2 * E, _e = D.a.RotationZ(-W), de = D.a.RotationY(te), ae = D.e.TransformCoordinates(D.e.Up(), _e), ie = D.e.TransformCoordinates(ae, de), Z = ie.multiply(h), ee = ie.divide(h).normalize();
+ N.push(Z.x, Z.y, Z.z), U.push(ee.x, ee.y, ee.z), B.push(oe, j);
+ }
+ if (L > 0)
+ for (var w = N.length / 3, z = w - 2 * (b + 1); z + b + 2 < w; z++)
+ v ? (L > 1 && (T.push(z), T.push(z + 1), T.push(z + b + 1)), (L < d || A < 1) && (T.push(z + b + 1), T.push(z + 1), T.push(z + b + 2))) : (T.push(z), T.push(z + 1), T.push(z + b + 1), T.push(z + b + 1), T.push(z + 1), T.push(z + b + 2));
+ }
+ P.a._ComputeSides(y, N, T, U, B, C.frontUVs, C.backUVs);
+ var q = new P.a();
+ return q.indices = T, q.positions = N, q.normals = U, q.uvs = B, q;
+ }, f.a.CreateSphere = function(C, x, R, g, u, E) {
+ var A = { segments: x, diameterX: R, diameterY: R, diameterZ: R, sideOrientation: E, updatable: u };
+ return c.CreateSphere(C, A, g);
+ };
+ var c = function() {
+ function C() {
+ }
+ return C.CreateSphere = function(x, R, g) {
+ g === void 0 && (g = null);
+ var u = new f.a(x, g);
+ return R.sideOrientation = f.a._GetDefaultSideOrientation(R.sideOrientation), u._originalBuilderSideOrientation = R.sideOrientation, P.a.CreateSphere(R).applyToMesh(u, R.updatable), u;
+ }, C;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return R;
+ });
+ var D = l(1), f = l(3), P = l(6), c = l(0), C = l(29), x = l(23), R = function(g) {
+ function u(E, A, y) {
+ A === void 0 && (A = null), y === void 0 && (y = !0);
+ var v = g.call(this, E, A) || this;
+ return v._forward = new c.e(0, 0, 1), v._forwardInverted = new c.e(0, 0, -1), v._up = new c.e(0, 1, 0), v._right = new c.e(1, 0, 0), v._rightInverted = new c.e(-1, 0, 0), v._position = c.e.Zero(), v._rotation = c.e.Zero(), v._rotationQuaternion = null, v._scaling = c.e.One(), v._isDirty = !1, v._transformToBoneReferal = null, v._isAbsoluteSynced = !1, v._billboardMode = u.BILLBOARDMODE_NONE, v._preserveParentRotationForBillboard = !1, v.scalingDeterminant = 1, v._infiniteDistance = !1, v.ignoreNonUniformScaling = !1, v.reIntegrateRotationIntoRotationQuaternion = !1, v._poseMatrix = null, v._localMatrix = c.a.Zero(), v._usePivotMatrix = !1, v._absolutePosition = c.e.Zero(), v._absoluteScaling = c.e.Zero(), v._absoluteRotationQuaternion = c.b.Identity(), v._pivotMatrix = c.a.Identity(), v._postMultiplyPivotMatrix = !1, v._isWorldMatrixFrozen = !1, v._indexInSceneTransformNodesArray = -1, v.onAfterWorldMatrixUpdateObservable = new P.c(), v._nonUniformScaling = !1, y && v.getScene().addTransformNode(v), v;
+ }
+ return Object(D.d)(u, g), Object.defineProperty(u.prototype, "billboardMode", { get: function() {
+ return this._billboardMode;
+ }, set: function(E) {
+ this._billboardMode !== E && (this._billboardMode = E);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(u.prototype, "preserveParentRotationForBillboard", { get: function() {
+ return this._preserveParentRotationForBillboard;
+ }, set: function(E) {
+ E !== this._preserveParentRotationForBillboard && (this._preserveParentRotationForBillboard = E);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(u.prototype, "infiniteDistance", { get: function() {
+ return this._infiniteDistance;
+ }, set: function(E) {
+ this._infiniteDistance !== E && (this._infiniteDistance = E);
+ }, enumerable: !1, configurable: !0 }), u.prototype.getClassName = function() {
+ return "TransformNode";
+ }, Object.defineProperty(u.prototype, "position", { get: function() {
+ return this._position;
+ }, set: function(E) {
+ this._position = E, this._isDirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(u.prototype, "rotation", { get: function() {
+ return this._rotation;
+ }, set: function(E) {
+ this._rotation = E, this._rotationQuaternion = null, this._isDirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(u.prototype, "scaling", { get: function() {
+ return this._scaling;
+ }, set: function(E) {
+ this._scaling = E, this._isDirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(u.prototype, "rotationQuaternion", { get: function() {
+ return this._rotationQuaternion;
+ }, set: function(E) {
+ this._rotationQuaternion = E, E && this._rotation.setAll(0), this._isDirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(u.prototype, "forward", { get: function() {
+ return c.e.Normalize(c.e.TransformNormal(this.getScene().useRightHandedSystem ? this._forwardInverted : this._forward, this.getWorldMatrix()));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(u.prototype, "up", { get: function() {
+ return c.e.Normalize(c.e.TransformNormal(this._up, this.getWorldMatrix()));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(u.prototype, "right", { get: function() {
+ return c.e.Normalize(c.e.TransformNormal(this.getScene().useRightHandedSystem ? this._rightInverted : this._right, this.getWorldMatrix()));
+ }, enumerable: !1, configurable: !0 }), u.prototype.updatePoseMatrix = function(E) {
+ return this._poseMatrix ? (this._poseMatrix.copyFrom(E), this) : (this._poseMatrix = E.clone(), this);
+ }, u.prototype.getPoseMatrix = function() {
+ return this._poseMatrix || (this._poseMatrix = c.a.Identity()), this._poseMatrix;
+ }, u.prototype._isSynchronized = function() {
+ var E = this._cache;
+ return this.billboardMode === E.billboardMode && this.billboardMode === u.BILLBOARDMODE_NONE && !E.pivotMatrixUpdated && !this.infiniteDistance && !this.position._isDirty && !this.scaling._isDirty && !(this._rotationQuaternion && this._rotationQuaternion._isDirty || this.rotation._isDirty);
+ }, u.prototype._initCache = function() {
+ g.prototype._initCache.call(this);
+ var E = this._cache;
+ E.localMatrixUpdated = !1, E.billboardMode = -1, E.infiniteDistance = !1;
+ }, u.prototype.markAsDirty = function(E) {
+ return this._currentRenderId = Number.MAX_VALUE, this._isDirty = !0, this;
+ }, Object.defineProperty(u.prototype, "absolutePosition", { get: function() {
+ return this._absolutePosition;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(u.prototype, "absoluteScaling", { get: function() {
+ return this._syncAbsoluteScalingAndRotation(), this._absoluteScaling;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(u.prototype, "absoluteRotationQuaternion", { get: function() {
+ return this._syncAbsoluteScalingAndRotation(), this._absoluteRotationQuaternion;
+ }, enumerable: !1, configurable: !0 }), u.prototype.setPreTransformMatrix = function(E) {
+ return this.setPivotMatrix(E, !1);
+ }, u.prototype.setPivotMatrix = function(E, A) {
+ return A === void 0 && (A = !0), this._pivotMatrix.copyFrom(E), this._usePivotMatrix = !this._pivotMatrix.isIdentity(), this._cache.pivotMatrixUpdated = !0, this._postMultiplyPivotMatrix = A, this._postMultiplyPivotMatrix && (this._pivotMatrixInverse ? this._pivotMatrix.invertToRef(this._pivotMatrixInverse) : this._pivotMatrixInverse = c.a.Invert(this._pivotMatrix)), this;
+ }, u.prototype.getPivotMatrix = function() {
+ return this._pivotMatrix;
+ }, u.prototype.instantiateHierarchy = function(E, A, y) {
+ E === void 0 && (E = null);
+ var v = this.clone("Clone of " + (this.name || this.id), E || this.parent, !0);
+ v && y && y(this, v);
+ for (var h = 0, d = this.getChildTransformNodes(!0); h < d.length; h++)
+ d[h].instantiateHierarchy(v, A, y);
+ return v;
+ }, u.prototype.freezeWorldMatrix = function(E) {
+ return E === void 0 && (E = null), E ? this._worldMatrix = E : (this._isWorldMatrixFrozen = !1, this.computeWorldMatrix(!0)), this._isDirty = !1, this._isWorldMatrixFrozen = !0, this;
+ }, u.prototype.unfreezeWorldMatrix = function() {
+ return this._isWorldMatrixFrozen = !1, this.computeWorldMatrix(!0), this;
+ }, Object.defineProperty(u.prototype, "isWorldMatrixFrozen", { get: function() {
+ return this._isWorldMatrixFrozen;
+ }, enumerable: !1, configurable: !0 }), u.prototype.getAbsolutePosition = function() {
+ return this.computeWorldMatrix(), this._absolutePosition;
+ }, u.prototype.setAbsolutePosition = function(E) {
+ if (!E)
+ return this;
+ var A, y, v;
+ if (E.x === void 0) {
+ if (arguments.length < 3)
+ return this;
+ A = arguments[0], y = arguments[1], v = arguments[2];
+ } else
+ A = E.x, y = E.y, v = E.z;
+ if (this.parent) {
+ var h = c.c.Matrix[0];
+ this.parent.getWorldMatrix().invertToRef(h), c.e.TransformCoordinatesFromFloatsToRef(A, y, v, h, this.position);
+ } else
+ this.position.x = A, this.position.y = y, this.position.z = v;
+ return this._absolutePosition.copyFrom(E), this;
+ }, u.prototype.setPositionWithLocalVector = function(E) {
+ return this.computeWorldMatrix(), this.position = c.e.TransformNormal(E, this._localMatrix), this;
+ }, u.prototype.getPositionExpressedInLocalSpace = function() {
+ this.computeWorldMatrix();
+ var E = c.c.Matrix[0];
+ return this._localMatrix.invertToRef(E), c.e.TransformNormal(this.position, E);
+ }, u.prototype.locallyTranslate = function(E) {
+ return this.computeWorldMatrix(!0), this.position = c.e.TransformCoordinates(E, this._localMatrix), this;
+ }, u.prototype.lookAt = function(E, A, y, v, h) {
+ A === void 0 && (A = 0), y === void 0 && (y = 0), v === void 0 && (v = 0), h === void 0 && (h = x.c.LOCAL);
+ var d = u._lookAtVectorCache, b = h === x.c.LOCAL ? this.position : this.getAbsolutePosition();
+ if (E.subtractToRef(b, d), this.setDirection(d, A, y, v), h === x.c.WORLD && this.parent)
+ if (this.rotationQuaternion) {
+ var T = c.c.Matrix[0];
+ this.rotationQuaternion.toRotationMatrix(T);
+ var N = c.c.Matrix[1];
+ this.parent.getWorldMatrix().getRotationMatrixToRef(N), N.invert(), T.multiplyToRef(N, T), this.rotationQuaternion.fromRotationMatrix(T);
+ } else {
+ var U = c.c.Quaternion[0];
+ c.b.FromEulerVectorToRef(this.rotation, U), T = c.c.Matrix[0], U.toRotationMatrix(T), N = c.c.Matrix[1], this.parent.getWorldMatrix().getRotationMatrixToRef(N), N.invert(), T.multiplyToRef(N, T), U.fromRotationMatrix(T), U.toEulerAnglesToRef(this.rotation);
+ }
+ return this;
+ }, u.prototype.getDirection = function(E) {
+ var A = c.e.Zero();
+ return this.getDirectionToRef(E, A), A;
+ }, u.prototype.getDirectionToRef = function(E, A) {
+ return c.e.TransformNormalToRef(E, this.getWorldMatrix(), A), this;
+ }, u.prototype.setDirection = function(E, A, y, v) {
+ A === void 0 && (A = 0), y === void 0 && (y = 0), v === void 0 && (v = 0);
+ var h = -Math.atan2(E.z, E.x) + Math.PI / 2, d = Math.sqrt(E.x * E.x + E.z * E.z), b = -Math.atan2(E.y, d);
+ return this.rotationQuaternion ? c.b.RotationYawPitchRollToRef(h + A, b + y, v, this.rotationQuaternion) : (this.rotation.x = b + y, this.rotation.y = h + A, this.rotation.z = v), this;
+ }, u.prototype.setPivotPoint = function(E, A) {
+ A === void 0 && (A = x.c.LOCAL), this.getScene().getRenderId() == 0 && this.computeWorldMatrix(!0);
+ var y = this.getWorldMatrix();
+ if (A == x.c.WORLD) {
+ var v = c.c.Matrix[0];
+ y.invertToRef(v), E = c.e.TransformCoordinates(E, v);
+ }
+ return this.setPivotMatrix(c.a.Translation(-E.x, -E.y, -E.z), !0);
+ }, u.prototype.getPivotPoint = function() {
+ var E = c.e.Zero();
+ return this.getPivotPointToRef(E), E;
+ }, u.prototype.getPivotPointToRef = function(E) {
+ return E.x = -this._pivotMatrix.m[12], E.y = -this._pivotMatrix.m[13], E.z = -this._pivotMatrix.m[14], this;
+ }, u.prototype.getAbsolutePivotPoint = function() {
+ var E = c.e.Zero();
+ return this.getAbsolutePivotPointToRef(E), E;
+ }, u.prototype.getAbsolutePivotPointToRef = function(E) {
+ return this.getPivotPointToRef(E), c.e.TransformCoordinatesToRef(E, this.getWorldMatrix(), E), this;
+ }, u.prototype.setParent = function(E) {
+ if (!E && !this.parent)
+ return this;
+ var A = c.c.Quaternion[0], y = c.c.Vector3[0], v = c.c.Vector3[1];
+ if (E) {
+ var h = c.c.Matrix[0], d = c.c.Matrix[1];
+ this.computeWorldMatrix(!0), E.computeWorldMatrix(!0), E.getWorldMatrix().invertToRef(d), this.getWorldMatrix().multiplyToRef(d, h), h.decompose(v, A, y);
+ } else
+ this.computeWorldMatrix(!0), this.getWorldMatrix().decompose(v, A, y);
+ return this.rotationQuaternion ? this.rotationQuaternion.copyFrom(A) : A.toEulerAnglesToRef(this.rotation), this.scaling.copyFrom(v), this.position.copyFrom(y), this.parent = E, this;
+ }, Object.defineProperty(u.prototype, "nonUniformScaling", { get: function() {
+ return this._nonUniformScaling;
+ }, enumerable: !1, configurable: !0 }), u.prototype._updateNonUniformScalingState = function(E) {
+ return this._nonUniformScaling !== E && (this._nonUniformScaling = E, !0);
+ }, u.prototype.attachToBone = function(E, A) {
+ return this._transformToBoneReferal = A, this.parent = E, E.getSkeleton().prepare(), E.getWorldMatrix().determinant() < 0 && (this.scalingDeterminant *= -1), this;
+ }, u.prototype.detachFromBone = function() {
+ return this.parent ? (this.parent.getWorldMatrix().determinant() < 0 && (this.scalingDeterminant *= -1), this._transformToBoneReferal = null, this.parent = null, this) : this;
+ }, u.prototype.rotate = function(E, A, y) {
+ var v;
+ if (E.normalize(), this.rotationQuaternion || (this.rotationQuaternion = this.rotation.toQuaternion(), this.rotation.setAll(0)), y && y !== x.c.LOCAL) {
+ if (this.parent) {
+ var h = c.c.Matrix[0];
+ this.parent.getWorldMatrix().invertToRef(h), E = c.e.TransformNormal(E, h);
+ }
+ (v = c.b.RotationAxisToRef(E, A, u._rotationAxisCache)).multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);
+ } else
+ v = c.b.RotationAxisToRef(E, A, u._rotationAxisCache), this.rotationQuaternion.multiplyToRef(v, this.rotationQuaternion);
+ return this;
+ }, u.prototype.rotateAround = function(E, A, y) {
+ A.normalize(), this.rotationQuaternion || (this.rotationQuaternion = c.b.RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z), this.rotation.setAll(0));
+ var v = c.c.Vector3[0], h = c.c.Vector3[1], d = c.c.Vector3[2], b = c.c.Quaternion[0], T = c.c.Matrix[0], N = c.c.Matrix[1], U = c.c.Matrix[2], B = c.c.Matrix[3];
+ return E.subtractToRef(this.position, v), c.a.TranslationToRef(v.x, v.y, v.z, T), c.a.TranslationToRef(-v.x, -v.y, -v.z, N), c.a.RotationAxisToRef(A, y, U), N.multiplyToRef(U, B), B.multiplyToRef(T, B), B.decompose(h, b, d), this.position.addInPlace(d), b.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion), this;
+ }, u.prototype.translate = function(E, A, y) {
+ var v = E.scale(A);
+ if (y && y !== x.c.LOCAL)
+ this.setAbsolutePosition(this.getAbsolutePosition().add(v));
+ else {
+ var h = this.getPositionExpressedInLocalSpace().add(v);
+ this.setPositionWithLocalVector(h);
+ }
+ return this;
+ }, u.prototype.addRotation = function(E, A, y) {
+ var v;
+ this.rotationQuaternion ? v = this.rotationQuaternion : (v = c.c.Quaternion[1], c.b.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, v));
+ var h = c.c.Quaternion[0];
+ return c.b.RotationYawPitchRollToRef(A, E, y, h), v.multiplyInPlace(h), this.rotationQuaternion || v.toEulerAnglesToRef(this.rotation), this;
+ }, u.prototype._getEffectiveParent = function() {
+ return this.parent;
+ }, u.prototype.computeWorldMatrix = function(E) {
+ if (this._isWorldMatrixFrozen && !this._isDirty)
+ return this._worldMatrix;
+ var A = this.getScene().getRenderId();
+ if (!this._isDirty && !E && this.isSynchronized())
+ return this._currentRenderId = A, this._worldMatrix;
+ var y = this.getScene().activeCamera, v = (this._billboardMode & u.BILLBOARDMODE_USE_POSITION) != 0, h = this._billboardMode !== u.BILLBOARDMODE_NONE && !this.preserveParentRotationForBillboard;
+ h && y && v && (this.lookAt(y.position), (this.billboardMode & u.BILLBOARDMODE_X) !== u.BILLBOARDMODE_X && (this.rotation.x = 0), (this.billboardMode & u.BILLBOARDMODE_Y) !== u.BILLBOARDMODE_Y && (this.rotation.y = 0), (this.billboardMode & u.BILLBOARDMODE_Z) !== u.BILLBOARDMODE_Z && (this.rotation.z = 0)), this._updateCache();
+ var d = this._cache;
+ d.pivotMatrixUpdated = !1, d.billboardMode = this.billboardMode, d.infiniteDistance = this.infiniteDistance, this._currentRenderId = A, this._childUpdateId++, this._isDirty = !1, this._position._isDirty = !1, this._rotation._isDirty = !1, this._scaling._isDirty = !1;
+ var b, T = this._getEffectiveParent(), N = u._TmpScaling, U = this._position;
+ if (this._infiniteDistance && !this.parent && y) {
+ var B = y.getWorldMatrix(), L = new c.e(B.m[12], B.m[13], B.m[14]);
+ (U = u._TmpTranslation).copyFromFloats(this._position.x + L.x, this._position.y + L.y, this._position.z + L.z);
+ }
+ if (N.copyFromFloats(this._scaling.x * this.scalingDeterminant, this._scaling.y * this.scalingDeterminant, this._scaling.z * this.scalingDeterminant), this._rotationQuaternion ? (this._rotationQuaternion._isDirty = !1, b = this._rotationQuaternion, this.reIntegrateRotationIntoRotationQuaternion && this.rotation.lengthSquared() && (this._rotationQuaternion.multiplyInPlace(c.b.RotationYawPitchRoll(this._rotation.y, this._rotation.x, this._rotation.z)), this._rotation.copyFromFloats(0, 0, 0))) : (b = u._TmpRotation, c.b.RotationYawPitchRollToRef(this._rotation.y, this._rotation.x, this._rotation.z, b)), this._usePivotMatrix) {
+ var j = c.c.Matrix[1];
+ c.a.ScalingToRef(N.x, N.y, N.z, j);
+ var W = c.c.Matrix[0];
+ b.toRotationMatrix(W), this._pivotMatrix.multiplyToRef(j, c.c.Matrix[4]), c.c.Matrix[4].multiplyToRef(W, this._localMatrix), this._postMultiplyPivotMatrix && this._localMatrix.multiplyToRef(this._pivotMatrixInverse, this._localMatrix), this._localMatrix.addTranslationFromFloats(U.x, U.y, U.z);
+ } else
+ c.a.ComposeToRef(N, b, U, this._localMatrix);
+ if (T && T.getWorldMatrix) {
+ if (E && T.computeWorldMatrix(), h) {
+ this._transformToBoneReferal ? T.getWorldMatrix().multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), c.c.Matrix[7]) : c.c.Matrix[7].copyFrom(T.getWorldMatrix());
+ var Y = c.c.Vector3[5], oe = c.c.Vector3[6];
+ c.c.Matrix[7].decompose(oe, void 0, Y), c.a.ScalingToRef(oe.x, oe.y, oe.z, c.c.Matrix[7]), c.c.Matrix[7].setTranslation(Y), this._localMatrix.multiplyToRef(c.c.Matrix[7], this._worldMatrix);
+ } else
+ this._transformToBoneReferal ? (this._localMatrix.multiplyToRef(T.getWorldMatrix(), c.c.Matrix[6]), c.c.Matrix[6].multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), this._worldMatrix)) : this._localMatrix.multiplyToRef(T.getWorldMatrix(), this._worldMatrix);
+ this._markSyncedWithParent();
+ } else
+ this._worldMatrix.copyFrom(this._localMatrix);
+ if (h && y && this.billboardMode && !v) {
+ var te = c.c.Vector3[0];
+ if (this._worldMatrix.getTranslationToRef(te), c.c.Matrix[1].copyFrom(y.getViewMatrix()), c.c.Matrix[1].setTranslationFromFloats(0, 0, 0), c.c.Matrix[1].invertToRef(c.c.Matrix[0]), (this.billboardMode & u.BILLBOARDMODE_ALL) !== u.BILLBOARDMODE_ALL) {
+ c.c.Matrix[0].decompose(void 0, c.c.Quaternion[0], void 0);
+ var _e = c.c.Vector3[1];
+ c.c.Quaternion[0].toEulerAnglesToRef(_e), (this.billboardMode & u.BILLBOARDMODE_X) !== u.BILLBOARDMODE_X && (_e.x = 0), (this.billboardMode & u.BILLBOARDMODE_Y) !== u.BILLBOARDMODE_Y && (_e.y = 0), (this.billboardMode & u.BILLBOARDMODE_Z) !== u.BILLBOARDMODE_Z && (_e.z = 0), c.a.RotationYawPitchRollToRef(_e.y, _e.x, _e.z, c.c.Matrix[0]);
+ }
+ this._worldMatrix.setTranslationFromFloats(0, 0, 0), this._worldMatrix.multiplyToRef(c.c.Matrix[0], this._worldMatrix), this._worldMatrix.setTranslation(c.c.Vector3[0]);
+ }
+ return this.ignoreNonUniformScaling ? this._updateNonUniformScalingState(!1) : this._scaling.isNonUniformWithinEpsilon(1e-6) ? this._updateNonUniformScalingState(!0) : T && T._nonUniformScaling ? this._updateNonUniformScalingState(T._nonUniformScaling) : this._updateNonUniformScalingState(!1), this._afterComputeWorldMatrix(), this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]), this._isAbsoluteSynced = !1, this.onAfterWorldMatrixUpdateObservable.notifyObservers(this), this._poseMatrix || (this._poseMatrix = c.a.Invert(this._worldMatrix)), this._worldMatrixDeterminantIsDirty = !0, this._worldMatrix;
+ }, u.prototype.resetLocalMatrix = function(E) {
+ if (E === void 0 && (E = !0), this.computeWorldMatrix(), E)
+ for (var A = this.getChildren(), y = 0; y < A.length; ++y) {
+ var v = A[y];
+ if (v) {
+ v.computeWorldMatrix();
+ var h = c.c.Matrix[0];
+ v._localMatrix.multiplyToRef(this._localMatrix, h);
+ var d = c.c.Quaternion[0];
+ h.decompose(v.scaling, d, v.position), v.rotationQuaternion ? v.rotationQuaternion = d : d.toEulerAnglesToRef(v.rotation);
+ }
+ }
+ this.scaling.copyFromFloats(1, 1, 1), this.position.copyFromFloats(0, 0, 0), this.rotation.copyFromFloats(0, 0, 0), this.rotationQuaternion && (this.rotationQuaternion = c.b.Identity()), this._worldMatrix = c.a.Identity();
+ }, u.prototype._afterComputeWorldMatrix = function() {
+ }, u.prototype.registerAfterWorldMatrixUpdate = function(E) {
+ return this.onAfterWorldMatrixUpdateObservable.add(E), this;
+ }, u.prototype.unregisterAfterWorldMatrixUpdate = function(E) {
+ return this.onAfterWorldMatrixUpdateObservable.removeCallback(E), this;
+ }, u.prototype.getPositionInCameraSpace = function(E) {
+ return E === void 0 && (E = null), E || (E = this.getScene().activeCamera), c.e.TransformCoordinates(this.getAbsolutePosition(), E.getViewMatrix());
+ }, u.prototype.getDistanceToCamera = function(E) {
+ return E === void 0 && (E = null), E || (E = this.getScene().activeCamera), this.getAbsolutePosition().subtract(E.globalPosition).length();
+ }, u.prototype.clone = function(E, A, y) {
+ var v = this, h = f.a.Clone(function() {
+ return new u(E, v.getScene());
+ }, this);
+ if (h.name = E, h.id = E, A && (h.parent = A), !y)
+ for (var d = this.getDescendants(!0), b = 0; b < d.length; b++) {
+ var T = d[b];
+ T.clone && T.clone(E + "." + T.name, h);
+ }
+ return h;
+ }, u.prototype.serialize = function(E) {
+ var A = f.a.Serialize(this, E);
+ return A.type = this.getClassName(), this.parent && (A.parentId = this.parent.id), A.localMatrix = this.getPivotMatrix().asArray(), A.isEnabled = this.isEnabled(), this.parent && (A.parentId = this.parent.id), A;
+ }, u.Parse = function(E, A, y) {
+ var v = f.a.Parse(function() {
+ return new u(E.name, A);
+ }, E, A, y);
+ return E.localMatrix ? v.setPreTransformMatrix(c.a.FromArray(E.localMatrix)) : E.pivotMatrix && v.setPivotMatrix(c.a.FromArray(E.pivotMatrix)), v.setEnabled(E.isEnabled), E.parentId && (v._waitingParentId = E.parentId), v;
+ }, u.prototype.getChildTransformNodes = function(E, A) {
+ var y = [];
+ return this._getDescendants(y, E, function(v) {
+ return (!A || A(v)) && v instanceof u;
+ }), y;
+ }, u.prototype.dispose = function(E, A) {
+ if (A === void 0 && (A = !1), this.getScene().stopAnimation(this), this.getScene().removeTransformNode(this), this.onAfterWorldMatrixUpdateObservable.clear(), E)
+ for (var y = 0, v = this.getChildTransformNodes(!0); y < v.length; y++) {
+ var h = v[y];
+ h.parent = null, h.computeWorldMatrix(!0);
+ }
+ g.prototype.dispose.call(this, E, A);
+ }, u.prototype.normalizeToUnitCube = function(E, A, y) {
+ E === void 0 && (E = !0), A === void 0 && (A = !1);
+ var v = null, h = null;
+ A && (this.rotationQuaternion ? (h = this.rotationQuaternion.clone(), this.rotationQuaternion.copyFromFloats(0, 0, 0, 1)) : this.rotation && (v = this.rotation.clone(), this.rotation.copyFromFloats(0, 0, 0)));
+ var d = this.getHierarchyBoundingVectors(E, y), b = d.max.subtract(d.min), T = Math.max(b.x, b.y, b.z);
+ if (T === 0)
+ return this;
+ var N = 1 / T;
+ return this.scaling.scaleInPlace(N), A && (this.rotationQuaternion && h ? this.rotationQuaternion.copyFrom(h) : this.rotation && v && this.rotation.copyFrom(v)), this;
+ }, u.prototype._syncAbsoluteScalingAndRotation = function() {
+ this._isAbsoluteSynced || (this._worldMatrix.decompose(this._absoluteScaling, this._absoluteRotationQuaternion), this._isAbsoluteSynced = !0);
+ }, u.BILLBOARDMODE_NONE = 0, u.BILLBOARDMODE_X = 1, u.BILLBOARDMODE_Y = 2, u.BILLBOARDMODE_Z = 4, u.BILLBOARDMODE_ALL = 7, u.BILLBOARDMODE_USE_POSITION = 128, u._TmpRotation = c.b.Zero(), u._TmpScaling = c.e.Zero(), u._TmpTranslation = c.e.Zero(), u._lookAtVectorCache = new c.e(0, 0, 0), u._rotationAxisCache = new c.b(), Object(D.c)([Object(f.o)("position")], u.prototype, "_position", void 0), Object(D.c)([Object(f.o)("rotation")], u.prototype, "_rotation", void 0), Object(D.c)([Object(f.l)("rotationQuaternion")], u.prototype, "_rotationQuaternion", void 0), Object(D.c)([Object(f.o)("scaling")], u.prototype, "_scaling", void 0), Object(D.c)([Object(f.c)("billboardMode")], u.prototype, "_billboardMode", void 0), Object(D.c)([Object(f.c)()], u.prototype, "scalingDeterminant", void 0), Object(D.c)([Object(f.c)("infiniteDistance")], u.prototype, "_infiniteDistance", void 0), Object(D.c)([Object(f.c)()], u.prototype, "ignoreNonUniformScaling", void 0), Object(D.c)([Object(f.c)()], u.prototype, "reIntegrateRotationIntoRotationQuaternion", void 0), u;
+ }(C.a);
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ function f(P, c, C, x, R, g) {
+ this.source = P, this.pointerX = c, this.pointerY = C, this.meshUnderPointer = x, this.sourceEvent = R, this.additionalData = g;
+ }
+ return f.CreateNew = function(P, c, C) {
+ var x = P.getScene();
+ return new f(P, x.pointerX, x.pointerY, x.meshUnderPointer || P, c, C);
+ }, f.CreateNewFromSprite = function(P, c, C, x) {
+ return new f(P, c.pointerX, c.pointerY, c.meshUnderPointer, C, x);
+ }, f.CreateNewFromScene = function(P, c) {
+ return new f(null, P.pointerX, P.pointerY, P.meshUnderPointer, c);
+ }, f.CreateNewFromPrimitive = function(P, c, C, x) {
+ return new f(P, c.x, c.y, null, C, x);
+ }, f;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return g;
+ });
+ var D = l(1), f = l(3), P = l(0), c = l(9), C = l(29), x = l(85), R = l(11), g = function(u) {
+ function E(A, y) {
+ var v = u.call(this, A, y) || this;
+ return v.diffuse = new c.a(1, 1, 1), v.specular = new c.a(1, 1, 1), v.falloffType = E.FALLOFF_DEFAULT, v.intensity = 1, v._range = Number.MAX_VALUE, v._inverseSquaredRange = 0, v._photometricScale = 1, v._intensityMode = E.INTENSITYMODE_AUTOMATIC, v._radius = 1e-5, v.renderPriority = 0, v._shadowEnabled = !0, v._excludeWithLayerMask = 0, v._includeOnlyWithLayerMask = 0, v._lightmapMode = 0, v._excludedMeshesIds = new Array(), v._includedOnlyMeshesIds = new Array(), v._isLight = !0, v.getScene().addLight(v), v._uniformBuffer = new x.a(v.getScene().getEngine()), v._buildUniformLayout(), v.includedOnlyMeshes = new Array(), v.excludedMeshes = new Array(), v._resyncMeshes(), v;
+ }
+ return Object(D.d)(E, u), Object.defineProperty(E.prototype, "range", { get: function() {
+ return this._range;
+ }, set: function(A) {
+ this._range = A, this._inverseSquaredRange = 1 / (this.range * this.range);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "intensityMode", { get: function() {
+ return this._intensityMode;
+ }, set: function(A) {
+ this._intensityMode = A, this._computePhotometricScale();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "radius", { get: function() {
+ return this._radius;
+ }, set: function(A) {
+ this._radius = A, this._computePhotometricScale();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "shadowEnabled", { get: function() {
+ return this._shadowEnabled;
+ }, set: function(A) {
+ this._shadowEnabled !== A && (this._shadowEnabled = A, this._markMeshesAsLightDirty());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "includedOnlyMeshes", { get: function() {
+ return this._includedOnlyMeshes;
+ }, set: function(A) {
+ this._includedOnlyMeshes = A, this._hookArrayForIncludedOnly(A);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "excludedMeshes", { get: function() {
+ return this._excludedMeshes;
+ }, set: function(A) {
+ this._excludedMeshes = A, this._hookArrayForExcluded(A);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "excludeWithLayerMask", { get: function() {
+ return this._excludeWithLayerMask;
+ }, set: function(A) {
+ this._excludeWithLayerMask = A, this._resyncMeshes();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "includeOnlyWithLayerMask", { get: function() {
+ return this._includeOnlyWithLayerMask;
+ }, set: function(A) {
+ this._includeOnlyWithLayerMask = A, this._resyncMeshes();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "lightmapMode", { get: function() {
+ return this._lightmapMode;
+ }, set: function(A) {
+ this._lightmapMode !== A && (this._lightmapMode = A, this._markMeshesAsLightDirty());
+ }, enumerable: !1, configurable: !0 }), E.prototype.transferTexturesToEffect = function(A, y) {
+ return this;
+ }, E.prototype._bindLight = function(A, y, v, h, d) {
+ d === void 0 && (d = !1);
+ var b = A.toString(), T = !1;
+ if (!d || !this._uniformBuffer._alreadyBound) {
+ if (this._uniformBuffer.bindToEffect(v, "Light" + b), this._renderId !== y.getRenderId() || !this._uniformBuffer.useUbo) {
+ this._renderId = y.getRenderId();
+ var N = this.getScaledIntensity();
+ this.transferToEffect(v, b), this.diffuse.scaleToRef(N, c.c.Color3[0]), this._uniformBuffer.updateColor4("vLightDiffuse", c.c.Color3[0], this.range, b), h && (this.specular.scaleToRef(N, c.c.Color3[1]), this._uniformBuffer.updateColor4("vLightSpecular", c.c.Color3[1], this.radius, b)), T = !0;
+ }
+ if (this.transferTexturesToEffect(v, b), y.shadowsEnabled && this.shadowEnabled) {
+ var U = this.getShadowGenerator();
+ U && (U.bindShadowLight(b, v), T = !0);
+ }
+ T && this._uniformBuffer.update();
+ }
+ }, E.prototype.getClassName = function() {
+ return "Light";
+ }, E.prototype.toString = function(A) {
+ var y = "Name: " + this.name;
+ if (y += ", type: " + ["Point", "Directional", "Spot", "Hemispheric"][this.getTypeID()], this.animations)
+ for (var v = 0; v < this.animations.length; v++)
+ y += ", animation[0]: " + this.animations[v].toString(A);
+ return y;
+ }, E.prototype._syncParentEnabledState = function() {
+ u.prototype._syncParentEnabledState.call(this), this.isDisposed() || this._resyncMeshes();
+ }, E.prototype.setEnabled = function(A) {
+ u.prototype.setEnabled.call(this, A), this._resyncMeshes();
+ }, E.prototype.getShadowGenerator = function() {
+ return this._shadowGenerator;
+ }, E.prototype.getAbsolutePosition = function() {
+ return P.e.Zero();
+ }, E.prototype.canAffectMesh = function(A) {
+ return !A || !(this.includedOnlyMeshes && this.includedOnlyMeshes.length > 0 && this.includedOnlyMeshes.indexOf(A) === -1) && !(this.excludedMeshes && this.excludedMeshes.length > 0 && this.excludedMeshes.indexOf(A) !== -1) && (this.includeOnlyWithLayerMask === 0 || (this.includeOnlyWithLayerMask & A.layerMask) != 0) && !(this.excludeWithLayerMask !== 0 && this.excludeWithLayerMask & A.layerMask);
+ }, E.CompareLightsPriority = function(A, y) {
+ return A.shadowEnabled !== y.shadowEnabled ? (y.shadowEnabled ? 1 : 0) - (A.shadowEnabled ? 1 : 0) : y.renderPriority - A.renderPriority;
+ }, E.prototype.dispose = function(A, y) {
+ y === void 0 && (y = !1), this._shadowGenerator && (this._shadowGenerator.dispose(), this._shadowGenerator = null), this.getScene().stopAnimation(this);
+ for (var v = 0, h = this.getScene().meshes; v < h.length; v++)
+ h[v]._removeLightSource(this, !0);
+ this._uniformBuffer.dispose(), this.getScene().removeLight(this), u.prototype.dispose.call(this, A, y);
+ }, E.prototype.getTypeID = function() {
+ return 0;
+ }, E.prototype.getScaledIntensity = function() {
+ return this._photometricScale * this.intensity;
+ }, E.prototype.clone = function(A, y) {
+ y === void 0 && (y = null);
+ var v = E.GetConstructorFromName(this.getTypeID(), A, this.getScene());
+ if (!v)
+ return null;
+ var h = f.a.Clone(v, this);
+ return y && (h.parent = y), h.setEnabled(this.isEnabled()), h;
+ }, E.prototype.serialize = function() {
+ var A = f.a.Serialize(this);
+ return A.type = this.getTypeID(), this.parent && (A.parentId = this.parent.id), this.excludedMeshes.length > 0 && (A.excludedMeshesIds = [], this.excludedMeshes.forEach(function(y) {
+ A.excludedMeshesIds.push(y.id);
+ })), this.includedOnlyMeshes.length > 0 && (A.includedOnlyMeshesIds = [], this.includedOnlyMeshes.forEach(function(y) {
+ A.includedOnlyMeshesIds.push(y.id);
+ })), f.a.AppendSerializedAnimations(this, A), A.ranges = this.serializeAnimationRanges(), A;
+ }, E.GetConstructorFromName = function(A, y, v) {
+ var h = C.a.Construct("Light_Type_" + A, y, v);
+ return h || null;
+ }, E.Parse = function(A, y) {
+ var v = E.GetConstructorFromName(A.type, A.name, y);
+ if (!v)
+ return null;
+ var h = f.a.Parse(v, A, y);
+ if (A.excludedMeshesIds && (h._excludedMeshesIds = A.excludedMeshesIds), A.includedOnlyMeshesIds && (h._includedOnlyMeshesIds = A.includedOnlyMeshesIds), A.parentId && (h._waitingParentId = A.parentId), A.falloffType !== void 0 && (h.falloffType = A.falloffType), A.lightmapMode !== void 0 && (h.lightmapMode = A.lightmapMode), A.animations) {
+ for (var d = 0; d < A.animations.length; d++) {
+ var b = A.animations[d], T = R.a.GetClass("BABYLON.Animation");
+ T && h.animations.push(T.Parse(b));
+ }
+ C.a.ParseAnimationRanges(h, A, y);
+ }
+ return A.autoAnimate && y.beginAnimation(h, A.autoAnimateFrom, A.autoAnimateTo, A.autoAnimateLoop, A.autoAnimateSpeed || 1), h;
+ }, E.prototype._hookArrayForExcluded = function(A) {
+ var y = this, v = A.push;
+ A.push = function() {
+ for (var T = [], N = 0; N < arguments.length; N++)
+ T[N] = arguments[N];
+ for (var U = v.apply(A, T), B = 0, L = T; B < L.length; B++) {
+ var j = L[B];
+ j._resyncLightSource(y);
+ }
+ return U;
+ };
+ var h = A.splice;
+ A.splice = function(T, N) {
+ for (var U = h.apply(A, [T, N]), B = 0, L = U; B < L.length; B++)
+ L[B]._resyncLightSource(y);
+ return U;
+ };
+ for (var d = 0, b = A; d < b.length; d++)
+ b[d]._resyncLightSource(this);
+ }, E.prototype._hookArrayForIncludedOnly = function(A) {
+ var y = this, v = A.push;
+ A.push = function() {
+ for (var d = [], b = 0; b < arguments.length; b++)
+ d[b] = arguments[b];
+ var T = v.apply(A, d);
+ return y._resyncMeshes(), T;
+ };
+ var h = A.splice;
+ A.splice = function(d, b) {
+ var T = h.apply(A, [d, b]);
+ return y._resyncMeshes(), T;
+ }, this._resyncMeshes();
+ }, E.prototype._resyncMeshes = function() {
+ for (var A = 0, y = this.getScene().meshes; A < y.length; A++)
+ y[A]._resyncLightSource(this);
+ }, E.prototype._markMeshesAsLightDirty = function() {
+ for (var A = 0, y = this.getScene().meshes; A < y.length; A++) {
+ var v = y[A];
+ v.lightSources.indexOf(this) !== -1 && v._markSubMeshesAsLightDirty();
+ }
+ }, E.prototype._computePhotometricScale = function() {
+ this._photometricScale = this._getPhotometricScale(), this.getScene().resetCachedMaterial();
+ }, E.prototype._getPhotometricScale = function() {
+ var A = 0, y = this.getTypeID(), v = this.intensityMode;
+ switch (v === E.INTENSITYMODE_AUTOMATIC && (v = y === E.LIGHTTYPEID_DIRECTIONALLIGHT ? E.INTENSITYMODE_ILLUMINANCE : E.INTENSITYMODE_LUMINOUSINTENSITY), y) {
+ case E.LIGHTTYPEID_POINTLIGHT:
+ case E.LIGHTTYPEID_SPOTLIGHT:
+ switch (v) {
+ case E.INTENSITYMODE_LUMINOUSPOWER:
+ A = 1 / (4 * Math.PI);
+ break;
+ case E.INTENSITYMODE_LUMINOUSINTENSITY:
+ A = 1;
+ break;
+ case E.INTENSITYMODE_LUMINANCE:
+ A = this.radius * this.radius;
+ }
+ break;
+ case E.LIGHTTYPEID_DIRECTIONALLIGHT:
+ switch (v) {
+ case E.INTENSITYMODE_ILLUMINANCE:
+ A = 1;
+ break;
+ case E.INTENSITYMODE_LUMINANCE:
+ var h = this.radius;
+ h = Math.max(h, 1e-3), A = 2 * Math.PI * (1 - Math.cos(h));
+ }
+ break;
+ case E.LIGHTTYPEID_HEMISPHERICLIGHT:
+ A = 1;
+ }
+ return A;
+ }, E.prototype._reorderLightsInScene = function() {
+ var A = this.getScene();
+ this._renderPriority != 0 && (A.requireLightSorting = !0), this.getScene().sortLightsByPriority();
+ }, E.FALLOFF_DEFAULT = 0, E.FALLOFF_PHYSICAL = 1, E.FALLOFF_GLTF = 2, E.FALLOFF_STANDARD = 3, E.LIGHTMAP_DEFAULT = 0, E.LIGHTMAP_SPECULAR = 1, E.LIGHTMAP_SHADOWSONLY = 2, E.INTENSITYMODE_AUTOMATIC = 0, E.INTENSITYMODE_LUMINOUSPOWER = 1, E.INTENSITYMODE_LUMINOUSINTENSITY = 2, E.INTENSITYMODE_ILLUMINANCE = 3, E.INTENSITYMODE_LUMINANCE = 4, E.LIGHTTYPEID_POINTLIGHT = 0, E.LIGHTTYPEID_DIRECTIONALLIGHT = 1, E.LIGHTTYPEID_SPOTLIGHT = 2, E.LIGHTTYPEID_HEMISPHERICLIGHT = 3, Object(D.c)([Object(f.e)()], E.prototype, "diffuse", void 0), Object(D.c)([Object(f.e)()], E.prototype, "specular", void 0), Object(D.c)([Object(f.c)()], E.prototype, "falloffType", void 0), Object(D.c)([Object(f.c)()], E.prototype, "intensity", void 0), Object(D.c)([Object(f.c)()], E.prototype, "range", null), Object(D.c)([Object(f.c)()], E.prototype, "intensityMode", null), Object(D.c)([Object(f.c)()], E.prototype, "radius", null), Object(D.c)([Object(f.c)()], E.prototype, "_renderPriority", void 0), Object(D.c)([Object(f.b)("_reorderLightsInScene")], E.prototype, "renderPriority", void 0), Object(D.c)([Object(f.c)("shadowEnabled")], E.prototype, "_shadowEnabled", void 0), Object(D.c)([Object(f.c)("excludeWithLayerMask")], E.prototype, "_excludeWithLayerMask", void 0), Object(D.c)([Object(f.c)("includeOnlyWithLayerMask")], E.prototype, "_includeOnlyWithLayerMask", void 0), Object(D.c)([Object(f.c)("lightmapMode")], E.prototype, "_lightmapMode", void 0), E;
+ }(C.a);
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ function f() {
+ this._xhr = typeof _native < "u" && _native.XMLHttpRequest ? new _native.XMLHttpRequest() : new XMLHttpRequest();
+ }
+ return f.prototype._injectCustomRequestHeaders = function() {
+ for (var P in f.CustomRequestHeaders) {
+ var c = f.CustomRequestHeaders[P];
+ c && this._xhr.setRequestHeader(P, c);
+ }
+ }, Object.defineProperty(f.prototype, "onprogress", { get: function() {
+ return this._xhr.onprogress;
+ }, set: function(P) {
+ this._xhr.onprogress = P;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(f.prototype, "readyState", { get: function() {
+ return this._xhr.readyState;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(f.prototype, "status", { get: function() {
+ return this._xhr.status;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(f.prototype, "statusText", { get: function() {
+ return this._xhr.statusText;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(f.prototype, "response", { get: function() {
+ return this._xhr.response;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(f.prototype, "responseURL", { get: function() {
+ return this._xhr.responseURL;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(f.prototype, "responseText", { get: function() {
+ return this._xhr.responseText;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(f.prototype, "responseType", { get: function() {
+ return this._xhr.responseType;
+ }, set: function(P) {
+ this._xhr.responseType = P;
+ }, enumerable: !1, configurable: !0 }), f.prototype.addEventListener = function(P, c, C) {
+ this._xhr.addEventListener(P, c, C);
+ }, f.prototype.removeEventListener = function(P, c, C) {
+ this._xhr.removeEventListener(P, c, C);
+ }, f.prototype.abort = function() {
+ this._xhr.abort();
+ }, f.prototype.send = function(P) {
+ f.CustomRequestHeaders && this._injectCustomRequestHeaders(), this._xhr.send(P);
+ }, f.prototype.open = function(P, c) {
+ for (var C = 0, x = f.CustomRequestModifiers; C < x.length; C++)
+ (0, x[C])(this._xhr, c);
+ return c = (c = c.replace("file:http:", "http:")).replace("file:https:", "https:"), this._xhr.open(P, c, !0);
+ }, f.prototype.setRequestHeader = function(P, c) {
+ this._xhr.setRequestHeader(P, c);
+ }, f.prototype.getResponseHeader = function(P) {
+ return this._xhr.getResponseHeader(P);
+ }, f.CustomRequestHeaders = {}, f.CustomRequestModifiers = new Array(), f;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "e", function() {
+ return f;
+ }), l.d(_, "a", function() {
+ return P;
+ }), l.d(_, "d", function() {
+ return c;
+ }), l.d(_, "c", function() {
+ return C;
+ }), l.d(_, "b", function() {
+ return x;
+ });
+ var D = l(1), f = function() {
+ function R(g, u) {
+ this.type = g, this.jointData = u, u.nativeParams = u.nativeParams || {};
+ }
+ return Object.defineProperty(R.prototype, "physicsJoint", { get: function() {
+ return this._physicsJoint;
+ }, set: function(g) {
+ this._physicsJoint, this._physicsJoint = g;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(R.prototype, "physicsPlugin", { set: function(g) {
+ this._physicsPlugin = g;
+ }, enumerable: !1, configurable: !0 }), R.prototype.executeNativeFunction = function(g) {
+ g(this._physicsPlugin.world, this._physicsJoint);
+ }, R.DistanceJoint = 0, R.HingeJoint = 1, R.BallAndSocketJoint = 2, R.WheelJoint = 3, R.SliderJoint = 4, R.PrismaticJoint = 5, R.UniversalJoint = 6, R.Hinge2Joint = R.WheelJoint, R.PointToPointJoint = 8, R.SpringJoint = 9, R.LockJoint = 10, R;
+ }(), P = function(R) {
+ function g(u) {
+ return R.call(this, f.DistanceJoint, u) || this;
+ }
+ return Object(D.d)(g, R), g.prototype.updateDistance = function(u, E) {
+ this._physicsPlugin.updateDistanceJoint(this, u, E);
+ }, g;
+ }(f), c = function(R) {
+ function g(u, E) {
+ return R.call(this, u, E) || this;
+ }
+ return Object(D.d)(g, R), g.prototype.setMotor = function(u, E) {
+ this._physicsPlugin.setMotor(this, u || 0, E);
+ }, g.prototype.setLimit = function(u, E) {
+ this._physicsPlugin.setLimit(this, u, E);
+ }, g;
+ }(f), C = function(R) {
+ function g(u) {
+ return R.call(this, f.HingeJoint, u) || this;
+ }
+ return Object(D.d)(g, R), g.prototype.setMotor = function(u, E) {
+ this._physicsPlugin.setMotor(this, u || 0, E);
+ }, g.prototype.setLimit = function(u, E) {
+ this._physicsPlugin.setLimit(this, u, E);
+ }, g;
+ }(c), x = function(R) {
+ function g(u) {
+ return R.call(this, f.Hinge2Joint, u) || this;
+ }
+ return Object(D.d)(g, R), g.prototype.setMotor = function(u, E, A) {
+ A === void 0 && (A = 0), this._physicsPlugin.setMotor(this, u || 0, E, A);
+ }, g.prototype.setLimit = function(u, E, A) {
+ A === void 0 && (A = 0), this._physicsPlugin.setLimit(this, u, E, A);
+ }, g;
+ }(c);
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return C;
+ });
+ var D = l(0), f = l(7), P = l(36), c = l(18), C = function() {
+ function x(R) {
+ var g = this;
+ R === void 0 && (R = P.a.DefaultUtilityLayer), this.gizmoLayer = R, this._attachedMesh = null, this._attachedNode = null, this._scaleRatio = 1, this._isHovered = !1, this._customMeshSet = !1, this._updateGizmoRotationToMatchAttachedMesh = !0, this.updateGizmoPositionToMatchAttachedMesh = !0, this.updateScale = !0, this._interactionsEnabled = !0, this._tempQuaternion = new D.b(0, 0, 0, 1), this._tempVector = new D.e(), this._tempVector2 = new D.e(), this._tempMatrix1 = new D.a(), this._tempMatrix2 = new D.a(), this._rightHandtoLeftHandMatrix = D.a.RotationY(Math.PI), this._rootMesh = new f.a("gizmoRootNode", R.utilityLayerScene), this._rootMesh.rotationQuaternion = D.b.Identity(), this._beforeRenderObserver = this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.add(function() {
+ g._update();
+ });
+ }
+ return Object.defineProperty(x.prototype, "scaleRatio", { get: function() {
+ return this._scaleRatio;
+ }, set: function(R) {
+ this._scaleRatio = R;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(x.prototype, "isHovered", { get: function() {
+ return this._isHovered;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(x.prototype, "attachedMesh", { get: function() {
+ return this._attachedMesh;
+ }, set: function(R) {
+ this._attachedMesh = R, R && (this._attachedNode = R), this._rootMesh.setEnabled(!!R), this._attachedNodeChanged(R);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(x.prototype, "attachedNode", { get: function() {
+ return this._attachedNode;
+ }, set: function(R) {
+ this._attachedNode = R, this._attachedMesh = null, this._rootMesh.setEnabled(!!R), this._attachedNodeChanged(R);
+ }, enumerable: !1, configurable: !0 }), x.prototype.setCustomMesh = function(R) {
+ if (R.getScene() != this.gizmoLayer.utilityLayerScene)
+ throw "When setting a custom mesh on a gizmo, the custom meshes scene must be the same as the gizmos (eg. gizmo.gizmoLayer.utilityLayerScene)";
+ this._rootMesh.getChildMeshes().forEach(function(g) {
+ g.dispose();
+ }), R.parent = this._rootMesh, this._customMeshSet = !0;
+ }, Object.defineProperty(x.prototype, "updateGizmoRotationToMatchAttachedMesh", { get: function() {
+ return this._updateGizmoRotationToMatchAttachedMesh;
+ }, set: function(R) {
+ this._updateGizmoRotationToMatchAttachedMesh = R;
+ }, enumerable: !1, configurable: !0 }), x.prototype._attachedNodeChanged = function(R) {
+ }, x.prototype._update = function() {
+ if (this.attachedNode) {
+ var R = this.attachedNode;
+ if (this.attachedMesh && (R = this.attachedMesh._effectiveMesh || this.attachedNode), this.updateGizmoPositionToMatchAttachedMesh) {
+ var g = R.getWorldMatrix().getRow(3), u = g ? g.toVector3() : new D.e(0, 0, 0);
+ this._rootMesh.position.copyFrom(u);
+ }
+ if (this.updateGizmoRotationToMatchAttachedMesh ? R.getWorldMatrix().decompose(void 0, this._rootMesh.rotationQuaternion) : this._rootMesh.rotationQuaternion.set(0, 0, 0, 1), this.updateScale) {
+ var E = this.gizmoLayer.utilityLayerScene.activeCamera, A = E.globalPosition;
+ E.devicePosition && (A = E.devicePosition), this._rootMesh.position.subtractToRef(A, this._tempVector);
+ var y = this._tempVector.length() * this.scaleRatio;
+ this._rootMesh.scaling.set(y, y, y), R._getWorldMatrixDeterminant() < 0 && (this._rootMesh.scaling.y *= -1);
+ } else
+ this._rootMesh.scaling.setAll(this.scaleRatio);
+ }
+ }, x.prototype._matrixChanged = function() {
+ if (this._attachedNode) {
+ if (this._attachedNode._isCamera) {
+ var R, g, u = this._attachedNode;
+ if (u.parent) {
+ var E = this._tempMatrix2;
+ u.parent._worldMatrix.invertToRef(E), this._attachedNode._worldMatrix.multiplyToRef(E, this._tempMatrix1), R = this._tempMatrix1;
+ } else
+ R = this._attachedNode._worldMatrix;
+ if (u.getScene().useRightHandedSystem ? (this._rightHandtoLeftHandMatrix.multiplyToRef(R, this._tempMatrix2), g = this._tempMatrix2) : g = R, g.decompose(this._tempVector2, this._tempQuaternion, this._tempVector), this._attachedNode.getClassName() === "FreeCamera" || this._attachedNode.getClassName() === "FlyCamera" || this._attachedNode.getClassName() === "ArcFollowCamera" || this._attachedNode.getClassName() === "TargetCamera" || this._attachedNode.getClassName() === "TouchCamera" || this._attachedNode.getClassName() === "UniversalCamera") {
+ var A = this._attachedNode;
+ A.rotation = this._tempQuaternion.toEulerAngles(), A.rotationQuaternion && A.rotationQuaternion.copyFrom(this._tempQuaternion);
+ }
+ u.position.copyFrom(this._tempVector);
+ } else if (this._attachedNode._isMesh || this._attachedNode.getClassName() === "AbstractMesh" || this._attachedNode.getClassName() === "TransformNode" || this._attachedNode.getClassName() === "InstancedMesh") {
+ var y = this._attachedNode;
+ if (y.parent) {
+ E = this._tempMatrix1;
+ var v = this._tempMatrix2;
+ y.parent.getWorldMatrix().invertToRef(E), this._attachedNode.getWorldMatrix().multiplyToRef(E, v), v.decompose(y.scaling, this._tempQuaternion, y.position);
+ } else
+ this._attachedNode._worldMatrix.decompose(y.scaling, this._tempQuaternion, y.position);
+ y.billboardMode || (y.rotationQuaternion ? y.rotationQuaternion.copyFrom(this._tempQuaternion) : y.rotation = this._tempQuaternion.toEulerAngles());
+ } else if (this._attachedNode.getClassName() === "Bone") {
+ var h = this._attachedNode, d = h.getParent();
+ if (d) {
+ var b = this._tempMatrix1, T = this._tempMatrix2;
+ d.getWorldMatrix().invertToRef(b), h.getWorldMatrix().multiplyToRef(b, T), h.getLocalMatrix().copyFrom(T);
+ } else
+ h.getLocalMatrix().copyFrom(h.getWorldMatrix());
+ h.markAsDirty();
+ }
+ }
+ }, x.GizmoAxisPointerObserver = function(R, g) {
+ var u = !1;
+ return R.utilityLayerScene.onPointerObservable.add(function(E) {
+ var A, y;
+ if (E.pickInfo) {
+ if (E.type === c.a.POINTERMOVE) {
+ if (u)
+ return;
+ g.forEach(function(v) {
+ var h, d;
+ if (v.colliderMeshes && v.gizmoMeshes) {
+ var b = ((h = v.colliderMeshes) === null || h === void 0 ? void 0 : h.indexOf((d = E == null ? void 0 : E.pickInfo) === null || d === void 0 ? void 0 : d.pickedMesh)) != -1 || v.active ? v.hoverMaterial : v.material;
+ v.gizmoMeshes.forEach(function(T) {
+ T.material = b, T.color && (T.color = b.diffuseColor);
+ });
+ }
+ });
+ }
+ E.type === c.a.POINTERDOWN && g.has((A = E.pickInfo.pickedMesh) === null || A === void 0 ? void 0 : A.parent) && (u = !0, g.get((y = E.pickInfo.pickedMesh) === null || y === void 0 ? void 0 : y.parent).active = !0, g.forEach(function(v) {
+ var h, d, b = ((h = v.colliderMeshes) === null || h === void 0 ? void 0 : h.indexOf((d = E == null ? void 0 : E.pickInfo) === null || d === void 0 ? void 0 : d.pickedMesh)) != -1 || v.active ? v.hoverMaterial : v.disableMaterial;
+ v.gizmoMeshes.forEach(function(T) {
+ T.material = b, T.color && (T.color = b.diffuseColor);
+ });
+ })), E.type === c.a.POINTERUP && g.forEach(function(v) {
+ v.active = !1, u = !1, v.gizmoMeshes.forEach(function(h) {
+ h.material = v.material, h.color && (h.color = v.material.diffuseColor);
+ });
+ });
+ }
+ });
+ }, x.prototype.dispose = function() {
+ this._rootMesh.dispose(), this._beforeRenderObserver && this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.remove(this._beforeRenderObserver);
+ }, x;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return u;
+ });
+ var D = l(1), f = l(3), P = l(6), c = l(0), C = l(22), x = l(2), R = l(120), g = (l(56), l(77)), u = function(E) {
+ function A(y) {
+ var v = E.call(this, null) || this;
+ return v.metadata = null, v.reservedDataStore = null, v._hasAlpha = !1, v.getAlphaFromRGB = !1, v.level = 1, v.coordinatesIndex = 0, v._coordinatesMode = x.a.TEXTURE_EXPLICIT_MODE, v.wrapR = x.a.TEXTURE_WRAP_ADDRESSMODE, v.anisotropicFilteringLevel = A.DEFAULT_ANISOTROPIC_FILTERING_LEVEL, v._isCube = !1, v._gammaSpace = !0, v.invertZ = !1, v.lodLevelInAlpha = !1, v.isRenderTarget = !1, v._prefiltered = !1, v.animations = new Array(), v.onDisposeObservable = new P.c(), v._onDisposeObserver = null, v._scene = null, v._texture = null, v._uid = null, y ? A._isScene(y) ? v._scene = y : v._engine = y : v._scene = C.a.LastCreatedScene, v._scene && (v.uniqueId = v._scene.getUniqueId(), v._scene.addTexture(v), v._engine = v._scene.getEngine()), v._uid = null, v;
+ }
+ return Object(D.d)(A, E), Object.defineProperty(A.prototype, "hasAlpha", { get: function() {
+ return this._hasAlpha;
+ }, set: function(y) {
+ this._hasAlpha !== y && (this._hasAlpha = y, this._scene && this._scene.markAllMaterialsAsDirty(x.a.MATERIAL_TextureDirtyFlag | x.a.MATERIAL_MiscDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(A.prototype, "coordinatesMode", { get: function() {
+ return this._coordinatesMode;
+ }, set: function(y) {
+ this._coordinatesMode !== y && (this._coordinatesMode = y, this._scene && this._scene.markAllMaterialsAsDirty(x.a.MATERIAL_TextureDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(A.prototype, "wrapU", { get: function() {
+ return this._wrapU;
+ }, set: function(y) {
+ this._wrapU = y;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(A.prototype, "wrapV", { get: function() {
+ return this._wrapV;
+ }, set: function(y) {
+ this._wrapV = y;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(A.prototype, "isCube", { get: function() {
+ return this._texture ? this._texture.isCube : this._isCube;
+ }, set: function(y) {
+ this._texture ? this._texture.isCube = y : this._isCube = y;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(A.prototype, "is3D", { get: function() {
+ return !!this._texture && this._texture.is3D;
+ }, set: function(y) {
+ this._texture && (this._texture.is3D = y);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(A.prototype, "is2DArray", { get: function() {
+ return !!this._texture && this._texture.is2DArray;
+ }, set: function(y) {
+ this._texture && (this._texture.is2DArray = y);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(A.prototype, "gammaSpace", { get: function() {
+ return this._texture ? (this._texture._gammaSpace === null && (this._texture._gammaSpace = this._gammaSpace), this._texture._gammaSpace) : this._gammaSpace;
+ }, set: function(y) {
+ if (this._texture) {
+ if (this._texture._gammaSpace === y)
+ return;
+ this._texture._gammaSpace = y;
+ } else {
+ if (this._gammaSpace === y)
+ return;
+ this._gammaSpace = y;
+ }
+ this._markAllSubMeshesAsTexturesDirty();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(A.prototype, "isRGBD", { get: function() {
+ return this._texture != null && this._texture._isRGBD;
+ }, set: function(y) {
+ this._texture && (this._texture._isRGBD = y);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(A.prototype, "noMipmap", { get: function() {
+ return !1;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(A.prototype, "lodGenerationOffset", { get: function() {
+ return this._texture ? this._texture._lodGenerationOffset : 0;
+ }, set: function(y) {
+ this._texture && (this._texture._lodGenerationOffset = y);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(A.prototype, "lodGenerationScale", { get: function() {
+ return this._texture ? this._texture._lodGenerationScale : 0;
+ }, set: function(y) {
+ this._texture && (this._texture._lodGenerationScale = y);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(A.prototype, "linearSpecularLOD", { get: function() {
+ return !!this._texture && this._texture._linearSpecularLOD;
+ }, set: function(y) {
+ this._texture && (this._texture._linearSpecularLOD = y);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(A.prototype, "irradianceTexture", { get: function() {
+ return this._texture ? this._texture._irradianceTexture : null;
+ }, set: function(y) {
+ this._texture && (this._texture._irradianceTexture = y);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(A.prototype, "uid", { get: function() {
+ return this._uid || (this._uid = R.a.RandomId()), this._uid;
+ }, enumerable: !1, configurable: !0 }), A.prototype.toString = function() {
+ return this.name;
+ }, A.prototype.getClassName = function() {
+ return "BaseTexture";
+ }, Object.defineProperty(A.prototype, "onDispose", { set: function(y) {
+ this._onDisposeObserver && this.onDisposeObservable.remove(this._onDisposeObserver), this._onDisposeObserver = this.onDisposeObservable.add(y);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(A.prototype, "isBlocking", { get: function() {
+ return !0;
+ }, enumerable: !1, configurable: !0 }), A.prototype.getScene = function() {
+ return this._scene;
+ }, A.prototype._getEngine = function() {
+ return this._engine;
+ }, A.prototype.checkTransformsAreIdentical = function(y) {
+ return y !== null;
+ }, A.prototype.getTextureMatrix = function() {
+ return c.a.IdentityReadOnly;
+ }, A.prototype.getReflectionTextureMatrix = function() {
+ return c.a.IdentityReadOnly;
+ }, A.prototype.isReadyOrNotBlocking = function() {
+ return !this.isBlocking || this.isReady();
+ }, A.prototype.scale = function(y) {
+ }, Object.defineProperty(A.prototype, "canRescale", { get: function() {
+ return !1;
+ }, enumerable: !1, configurable: !0 }), A.prototype._getFromCache = function(y, v, h, d) {
+ var b = this._getEngine();
+ if (!b)
+ return null;
+ for (var T = b.getLoadedTexturesCache(), N = 0; N < T.length; N++) {
+ var U = T[N];
+ if (!(d !== void 0 && d !== U.invertY || U.url !== y || U.generateMipMaps !== !v || h && h !== U.samplingMode))
+ return U.incrementReferences(), U;
+ }
+ return null;
+ }, A.prototype._rebuild = function() {
+ }, A.prototype.clone = function() {
+ return null;
+ }, Object.defineProperty(A.prototype, "textureType", { get: function() {
+ return this._texture && this._texture.type !== void 0 ? this._texture.type : x.a.TEXTURETYPE_UNSIGNED_INT;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(A.prototype, "textureFormat", { get: function() {
+ return this._texture && this._texture.format !== void 0 ? this._texture.format : x.a.TEXTUREFORMAT_RGBA;
+ }, enumerable: !1, configurable: !0 }), A.prototype._markAllSubMeshesAsTexturesDirty = function() {
+ var y = this.getScene();
+ y && y.markAllMaterialsAsDirty(x.a.MATERIAL_TextureDirtyFlag);
+ }, A.prototype.readPixels = function(y, v, h) {
+ if (y === void 0 && (y = 0), v === void 0 && (v = 0), h === void 0 && (h = null), !this._texture)
+ return null;
+ var d = this.getSize(), b = d.width, T = d.height, N = this._getEngine();
+ if (!N)
+ return null;
+ v != 0 && (b /= Math.pow(2, v), T /= Math.pow(2, v), b = Math.round(b), T = Math.round(T));
+ try {
+ return this._texture.isCube ? N._readTexturePixels(this._texture, b, T, y, v, h) : N._readTexturePixels(this._texture, b, T, -1, v, h);
+ } catch {
+ return null;
+ }
+ }, Object.defineProperty(A.prototype, "_lodTextureHigh", { get: function() {
+ return this._texture ? this._texture._lodTextureHigh : null;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(A.prototype, "_lodTextureMid", { get: function() {
+ return this._texture ? this._texture._lodTextureMid : null;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(A.prototype, "_lodTextureLow", { get: function() {
+ return this._texture ? this._texture._lodTextureLow : null;
+ }, enumerable: !1, configurable: !0 }), A.prototype.dispose = function() {
+ if (this._scene) {
+ this._scene.stopAnimation && this._scene.stopAnimation(this), this._scene._removePendingData(this);
+ var y = this._scene.textures.indexOf(this);
+ y >= 0 && this._scene.textures.splice(y, 1), this._scene.onTextureRemovedObservable.notifyObservers(this), this._scene = null;
+ }
+ this.onDisposeObservable.notifyObservers(this), this.onDisposeObservable.clear(), E.prototype.dispose.call(this);
+ }, A.prototype.serialize = function() {
+ if (!this.name)
+ return null;
+ var y = f.a.Serialize(this);
+ return f.a.AppendSerializedAnimations(this, y), y;
+ }, A.WhenAllReady = function(y, v) {
+ var h = y.length;
+ if (h !== 0)
+ for (var d = 0; d < y.length; d++) {
+ var b = y[d];
+ if (b.isReady())
+ --h == 0 && v();
+ else {
+ var T = b.onLoadObservable;
+ T && T.addOnce(function() {
+ --h == 0 && v();
+ });
+ }
+ }
+ else
+ v();
+ }, A._isScene = function(y) {
+ return y.getClassName() === "Scene";
+ }, A.DEFAULT_ANISOTROPIC_FILTERING_LEVEL = 4, Object(D.c)([Object(f.c)()], A.prototype, "uniqueId", void 0), Object(D.c)([Object(f.c)()], A.prototype, "name", void 0), Object(D.c)([Object(f.c)()], A.prototype, "metadata", void 0), Object(D.c)([Object(f.c)("hasAlpha")], A.prototype, "_hasAlpha", void 0), Object(D.c)([Object(f.c)()], A.prototype, "getAlphaFromRGB", void 0), Object(D.c)([Object(f.c)()], A.prototype, "level", void 0), Object(D.c)([Object(f.c)()], A.prototype, "coordinatesIndex", void 0), Object(D.c)([Object(f.c)("coordinatesMode")], A.prototype, "_coordinatesMode", void 0), Object(D.c)([Object(f.c)()], A.prototype, "wrapU", null), Object(D.c)([Object(f.c)()], A.prototype, "wrapV", null), Object(D.c)([Object(f.c)()], A.prototype, "wrapR", void 0), Object(D.c)([Object(f.c)()], A.prototype, "anisotropicFilteringLevel", void 0), Object(D.c)([Object(f.c)()], A.prototype, "isCube", null), Object(D.c)([Object(f.c)()], A.prototype, "is3D", null), Object(D.c)([Object(f.c)()], A.prototype, "is2DArray", null), Object(D.c)([Object(f.c)()], A.prototype, "gammaSpace", null), Object(D.c)([Object(f.c)()], A.prototype, "invertZ", void 0), Object(D.c)([Object(f.c)()], A.prototype, "lodLevelInAlpha", void 0), Object(D.c)([Object(f.c)()], A.prototype, "lodGenerationOffset", null), Object(D.c)([Object(f.c)()], A.prototype, "lodGenerationScale", null), Object(D.c)([Object(f.c)()], A.prototype, "linearSpecularLOD", null), Object(D.c)([Object(f.m)()], A.prototype, "irradianceTexture", null), Object(D.c)([Object(f.c)()], A.prototype, "isRenderTarget", void 0), A;
+ }(function() {
+ function E(A) {
+ this._wrapU = x.a.TEXTURE_WRAP_ADDRESSMODE, this._wrapV = x.a.TEXTURE_WRAP_ADDRESSMODE, this.wrapR = x.a.TEXTURE_WRAP_ADDRESSMODE, this.anisotropicFilteringLevel = 4, this.delayLoadState = x.a.DELAYLOADSTATE_NONE, this._texture = null, this._engine = null, this._cachedSize = g.a.Zero(), this._cachedBaseSize = g.a.Zero(), this._texture = A, this._texture && (this._engine = this._texture.getEngine());
+ }
+ return Object.defineProperty(E.prototype, "wrapU", { get: function() {
+ return this._wrapU;
+ }, set: function(A) {
+ this._wrapU = A;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "wrapV", { get: function() {
+ return this._wrapV;
+ }, set: function(A) {
+ this._wrapV = A;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "coordinatesMode", { get: function() {
+ return 0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "isCube", { get: function() {
+ return !!this._texture && this._texture.isCube;
+ }, set: function(A) {
+ this._texture && (this._texture.isCube = A);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "is3D", { get: function() {
+ return !!this._texture && this._texture.is3D;
+ }, set: function(A) {
+ this._texture && (this._texture.is3D = A);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(E.prototype, "is2DArray", { get: function() {
+ return !!this._texture && this._texture.is2DArray;
+ }, set: function(A) {
+ this._texture && (this._texture.is2DArray = A);
+ }, enumerable: !1, configurable: !0 }), E.prototype.getClassName = function() {
+ return "ThinTexture";
+ }, E.prototype.isReady = function() {
+ return this.delayLoadState === x.a.DELAYLOADSTATE_NOTLOADED ? (this.delayLoad(), !1) : !!this._texture && this._texture.isReady;
+ }, E.prototype.delayLoad = function() {
+ }, E.prototype.getInternalTexture = function() {
+ return this._texture;
+ }, E.prototype.getSize = function() {
+ if (this._texture) {
+ if (this._texture.width)
+ return this._cachedSize.width = this._texture.width, this._cachedSize.height = this._texture.height, this._cachedSize;
+ if (this._texture._size)
+ return this._cachedSize.width = this._texture._size, this._cachedSize.height = this._texture._size, this._cachedSize;
+ }
+ return this._cachedSize;
+ }, E.prototype.getBaseSize = function() {
+ return this.isReady() && this._texture ? this._texture._size ? (this._cachedBaseSize.width = this._texture._size, this._cachedBaseSize.height = this._texture._size, this._cachedBaseSize) : (this._cachedBaseSize.width = this._texture.baseWidth, this._cachedBaseSize.height = this._texture.baseHeight, this._cachedBaseSize) : (this._cachedBaseSize.width = 0, this._cachedBaseSize.height = 0, this._cachedBaseSize);
+ }, E.prototype.updateSamplingMode = function(A) {
+ this._texture && this._engine && this._engine.updateTextureSamplingMode(A, this._texture);
+ }, E.prototype.releaseInternalTexture = function() {
+ this._texture && (this._texture.dispose(), this._texture = null);
+ }, E.prototype.dispose = function() {
+ this._texture && (this.releaseInternalTexture(), this._engine = null);
+ }, E;
+ }());
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return R;
+ });
+ var D = l(0), f = l(9), P = l(7), c = l(16), C = l(20), x = l(23);
+ c.a.CreateCylinder = function(g) {
+ var u = g.height || 2, E = g.diameterTop === 0 ? 0 : g.diameterTop || g.diameter || 1, A = g.diameterBottom === 0 ? 0 : g.diameterBottom || g.diameter || 1;
+ E = E || 1e-5, A = A || 1e-5;
+ var y, v = g.tessellation || 24, h = g.subdivisions || 1, d = !!g.hasRings, b = !!g.enclose, T = g.cap === 0 ? 0 : g.cap || P.a.CAP_ALL, N = g.arc && (g.arc <= 0 || g.arc > 1) ? 1 : g.arc || 1, U = g.sideOrientation === 0 ? 0 : g.sideOrientation || c.a.DEFAULTSIDE, B = g.faceUV || new Array(3), L = g.faceColors, j = 2 + (1 + (N !== 1 && b ? 2 : 0)) * (d ? h : 1);
+ for (y = 0; y < j; y++)
+ L && L[y] === void 0 && (L[y] = new f.b(1, 1, 1, 1));
+ for (y = 0; y < j; y++)
+ B && B[y] === void 0 && (B[y] = new D.f(0, 0, 1, 1));
+ var W, Y, oe, te, _e, de, ae = new Array(), ie = new Array(), Z = new Array(), ee = new Array(), w = new Array(), z = 2 * Math.PI * N / v, q = (A - E) / 2 / u, le = D.e.Zero(), ce = D.e.Zero(), J = D.e.Zero(), H = D.e.Zero(), X = D.e.Zero(), ne = x.a.Y, Q = 1, $ = 1, me = 0, ye = 0;
+ for (te = 0; te <= h; te++)
+ for (oe = ((Y = te / h) * (E - A) + A) / 2, Q = d && te !== 0 && te !== h ? 2 : 1, de = 0; de < Q; de++) {
+ for (d && ($ += de), b && ($ += 2 * de), _e = 0; _e <= v; _e++)
+ W = _e * z, le.x = Math.cos(-W) * oe, le.y = -u / 2 + Y * u, le.z = Math.sin(-W) * oe, E === 0 && te === h ? (ce.x = Z[Z.length - 3 * (v + 1)], ce.y = Z[Z.length - 3 * (v + 1) + 1], ce.z = Z[Z.length - 3 * (v + 1) + 2]) : (ce.x = le.x, ce.z = le.z, ce.y = Math.sqrt(ce.x * ce.x + ce.z * ce.z) * q, ce.normalize()), _e === 0 && (J.copyFrom(le), H.copyFrom(ce)), ie.push(le.x, le.y, le.z), Z.push(ce.x, ce.y, ce.z), ye = d ? me !== $ ? B[$].y : B[$].w : B[$].y + (B[$].w - B[$].y) * Y, ee.push(B[$].x + (B[$].z - B[$].x) * _e / v, ye), L && w.push(L[$].r, L[$].g, L[$].b, L[$].a);
+ N !== 1 && b && (ie.push(le.x, le.y, le.z), ie.push(0, le.y, 0), ie.push(0, le.y, 0), ie.push(J.x, J.y, J.z), D.e.CrossToRef(ne, ce, X), X.normalize(), Z.push(X.x, X.y, X.z, X.x, X.y, X.z), D.e.CrossToRef(H, ne, X), X.normalize(), Z.push(X.x, X.y, X.z, X.x, X.y, X.z), ye = d ? me !== $ ? B[$ + 1].y : B[$ + 1].w : B[$ + 1].y + (B[$ + 1].w - B[$ + 1].y) * Y, ee.push(B[$ + 1].x, ye), ee.push(B[$ + 1].z, ye), ye = d ? me !== $ ? B[$ + 2].y : B[$ + 2].w : B[$ + 2].y + (B[$ + 2].w - B[$ + 2].y) * Y, ee.push(B[$ + 2].x, ye), ee.push(B[$ + 2].z, ye), L && (w.push(L[$ + 1].r, L[$ + 1].g, L[$ + 1].b, L[$ + 1].a), w.push(L[$ + 1].r, L[$ + 1].g, L[$ + 1].b, L[$ + 1].a), w.push(L[$ + 2].r, L[$ + 2].g, L[$ + 2].b, L[$ + 2].a), w.push(L[$ + 2].r, L[$ + 2].g, L[$ + 2].b, L[$ + 2].a))), me !== $ && (me = $);
+ }
+ var be = N !== 1 && b ? v + 4 : v;
+ for (te = 0, $ = 0; $ < h; $++) {
+ var ge = 0, Te = 0, Re = 0, Se = 0;
+ for (_e = 0; _e < v; _e++)
+ ge = te * (be + 1) + _e, Te = (te + 1) * (be + 1) + _e, Re = te * (be + 1) + (_e + 1), Se = (te + 1) * (be + 1) + (_e + 1), ae.push(ge, Te, Re), ae.push(Se, Re, Te);
+ N !== 1 && b && (ae.push(ge + 2, Te + 2, Re + 2), ae.push(Se + 2, Re + 2, Te + 2), ae.push(ge + 4, Te + 4, Re + 4), ae.push(Se + 4, Re + 4, Te + 4)), te = d ? te + 2 : te + 1;
+ }
+ var Ne = function(Ye) {
+ var He = Ye ? E / 2 : A / 2;
+ if (He !== 0) {
+ var Xe, Ze, je, it = Ye ? B[j - 1] : B[0], et = null;
+ L && (et = Ye ? L[j - 1] : L[0]);
+ var lt = ie.length / 3, ct = Ye ? u / 2 : -u / 2, mt = new D.e(0, ct, 0);
+ ie.push(mt.x, mt.y, mt.z), Z.push(0, Ye ? 1 : -1, 0), ee.push(it.x + 0.5 * (it.z - it.x), it.y + 0.5 * (it.w - it.y)), et && w.push(et.r, et.g, et.b, et.a);
+ var St = new D.d(0.5, 0.5);
+ for (je = 0; je <= v; je++) {
+ Xe = 2 * Math.PI * je * N / v;
+ var Ut = Math.cos(-Xe), wt = Math.sin(-Xe);
+ Ze = new D.e(Ut * He, ct, wt * He);
+ var Pt = new D.d(Ut * St.x + 0.5, wt * St.y + 0.5);
+ ie.push(Ze.x, Ze.y, Ze.z), Z.push(0, Ye ? 1 : -1, 0), ee.push(it.x + (it.z - it.x) * Pt.x, it.y + (it.w - it.y) * Pt.y), et && w.push(et.r, et.g, et.b, et.a);
+ }
+ for (je = 0; je < v; je++)
+ Ye ? (ae.push(lt), ae.push(lt + (je + 2)), ae.push(lt + (je + 1))) : (ae.push(lt), ae.push(lt + (je + 1)), ae.push(lt + (je + 2)));
+ }
+ };
+ T !== P.a.CAP_START && T !== P.a.CAP_ALL || Ne(!1), T !== P.a.CAP_END && T !== P.a.CAP_ALL || Ne(!0), c.a._ComputeSides(U, ie, ae, Z, ee, g.frontUVs, g.backUVs);
+ var ze = new c.a();
+ return ze.indices = ae, ze.positions = ie, ze.normals = Z, ze.uvs = ee, L && (ze.colors = w), ze;
+ }, P.a.CreateCylinder = function(g, u, E, A, y, v, h, d, b) {
+ h !== void 0 && h instanceof C.a || (h !== void 0 && (b = d || P.a.DEFAULTSIDE, d = h), h = v, v = 1);
+ var T = { height: u, diameterTop: E, diameterBottom: A, tessellation: y, subdivisions: v, sideOrientation: b, updatable: d };
+ return R.CreateCylinder(g, T, h);
+ };
+ var R = function() {
+ function g() {
+ }
+ return g.CreateCylinder = function(u, E, A) {
+ var y = new P.a(u, A);
+ return E.sideOrientation = P.a._GetDefaultSideOrientation(E.sideOrientation), y._originalBuilderSideOrientation = E.sideOrientation, c.a.CreateCylinder(E).applyToMesh(y, E.updatable), y;
+ }, g;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return P;
+ });
+ var D = l(0), f = l(4), P = function() {
+ function c() {
+ this._pickingUnavailable = !1, this.hit = !1, this.distance = 0, this.pickedPoint = null, this.pickedMesh = null, this.bu = 0, this.bv = 0, this.faceId = -1, this.subMeshFaceId = -1, this.subMeshId = 0, this.pickedSprite = null, this.thinInstanceIndex = -1, this.originMesh = null, this.ray = null;
+ }
+ return c.prototype.getNormal = function(C, x) {
+ if (C === void 0 && (C = !1), x === void 0 && (x = !0), !this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(f.b.NormalKind))
+ return null;
+ var R, g = this.pickedMesh.getIndices();
+ if (!g)
+ return null;
+ if (x) {
+ var u = this.pickedMesh.getVerticesData(f.b.NormalKind), E = D.e.FromArray(u, 3 * g[3 * this.faceId]), A = D.e.FromArray(u, 3 * g[3 * this.faceId + 1]), y = D.e.FromArray(u, 3 * g[3 * this.faceId + 2]);
+ E = E.scale(this.bu), A = A.scale(this.bv), y = y.scale(1 - this.bu - this.bv), R = new D.e(E.x + A.x + y.x, E.y + A.y + y.y, E.z + A.z + y.z);
+ } else {
+ var v = this.pickedMesh.getVerticesData(f.b.PositionKind), h = D.e.FromArray(v, 3 * g[3 * this.faceId]), d = D.e.FromArray(v, 3 * g[3 * this.faceId + 1]), b = D.e.FromArray(v, 3 * g[3 * this.faceId + 2]), T = h.subtract(d), N = b.subtract(d);
+ R = D.e.Cross(T, N);
+ }
+ if (C) {
+ var U = this.pickedMesh.getWorldMatrix();
+ this.pickedMesh.nonUniformScaling && (D.c.Matrix[0].copyFrom(U), (U = D.c.Matrix[0]).setTranslationFromFloats(0, 0, 0), U.invert(), U.transposeToRef(D.c.Matrix[1]), U = D.c.Matrix[1]), R = D.e.TransformNormal(R, U);
+ }
+ return R.normalize(), R;
+ }, c.prototype.getTextureCoordinates = function() {
+ if (!this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(f.b.UVKind))
+ return null;
+ var C = this.pickedMesh.getIndices();
+ if (!C)
+ return null;
+ var x = this.pickedMesh.getVerticesData(f.b.UVKind);
+ if (!x)
+ return null;
+ var R = D.d.FromArray(x, 2 * C[3 * this.faceId]), g = D.d.FromArray(x, 2 * C[3 * this.faceId + 1]), u = D.d.FromArray(x, 2 * C[3 * this.faceId + 2]);
+ return R = R.scale(this.bu), g = g.scale(this.bv), u = u.scale(1 - this.bu - this.bv), new D.d(R.x + g.x + u.x, R.y + g.y + u.y);
+ }, c;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return f;
+ });
+ var D = l(57), f = function() {
+ function P() {
+ this._startMonitoringTime = 0, this._min = 0, this._max = 0, this._average = 0, this._lastSecAverage = 0, this._current = 0, this._totalValueCount = 0, this._totalAccumulated = 0, this._lastSecAccumulated = 0, this._lastSecTime = 0, this._lastSecValueCount = 0;
+ }
+ return Object.defineProperty(P.prototype, "min", { get: function() {
+ return this._min;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(P.prototype, "max", { get: function() {
+ return this._max;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(P.prototype, "average", { get: function() {
+ return this._average;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(P.prototype, "lastSecAverage", { get: function() {
+ return this._lastSecAverage;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(P.prototype, "current", { get: function() {
+ return this._current;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(P.prototype, "total", { get: function() {
+ return this._totalAccumulated;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(P.prototype, "count", { get: function() {
+ return this._totalValueCount;
+ }, enumerable: !1, configurable: !0 }), P.prototype.fetchNewFrame = function() {
+ this._totalValueCount++, this._current = 0, this._lastSecValueCount++;
+ }, P.prototype.addCount = function(c, C) {
+ P.Enabled && (this._current += c, C && this._fetchResult());
+ }, P.prototype.beginMonitoring = function() {
+ P.Enabled && (this._startMonitoringTime = D.a.Now);
+ }, P.prototype.endMonitoring = function(c) {
+ if (c === void 0 && (c = !0), P.Enabled) {
+ c && this.fetchNewFrame();
+ var C = D.a.Now;
+ this._current = C - this._startMonitoringTime, c && this._fetchResult();
+ }
+ }, P.prototype._fetchResult = function() {
+ this._totalAccumulated += this._current, this._lastSecAccumulated += this._current, this._min = Math.min(this._min, this._current), this._max = Math.max(this._max, this._current), this._average = this._totalAccumulated / this._totalValueCount;
+ var c = D.a.Now;
+ c - this._lastSecTime > 1e3 && (this._lastSecAverage = this._lastSecAccumulated / this._lastSecValueCount, this._lastSecTime = c, this._lastSecAccumulated = 0, this._lastSecValueCount = 0);
+ }, P.Enabled = !0, P;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "b", function() {
+ return A;
+ }), l.d(_, "d", function() {
+ return y;
+ }), l.d(_, "c", function() {
+ return v;
+ }), l.d(_, "a", function() {
+ return h;
+ });
+ var D = l(1), f = l(49), P = l(38), c = l(6), C = l(83), x = l(140), R = function(d) {
+ function b() {
+ return d !== null && d.apply(this, arguments) || this;
+ }
+ return Object(D.d)(b, d), b._setPrototypeOf = Object.setPrototypeOf || function(T, N) {
+ return T.__proto__ = N, T;
+ }, b;
+ }(Error), g = l(34), u = l(26), E = l(128), A = function(d) {
+ function b(T, N) {
+ var U = d.call(this, T) || this;
+ return U.name = "LoadFileError", R._setPrototypeOf(U, b.prototype), N instanceof f.a ? U.request = N : U.file = N, U;
+ }
+ return Object(D.d)(b, d), b;
+ }(R), y = function(d) {
+ function b(T, N) {
+ var U = d.call(this, T) || this;
+ return U.request = N, U.name = "RequestFileError", R._setPrototypeOf(U, b.prototype), U;
+ }
+ return Object(D.d)(b, d), b;
+ }(R), v = function(d) {
+ function b(T, N) {
+ var U = d.call(this, T) || this;
+ return U.file = N, U.name = "ReadFileError", R._setPrototypeOf(U, b.prototype), U;
+ }
+ return Object(D.d)(b, d), b;
+ }(R), h = function() {
+ function d() {
+ }
+ return d._CleanUrl = function(b) {
+ return b = b.replace(/#/gm, "%23");
+ }, d.SetCorsBehavior = function(b, T) {
+ if ((!b || b.indexOf("data:") !== 0) && d.CorsBehavior)
+ if (typeof d.CorsBehavior == "string" || this.CorsBehavior instanceof String)
+ T.crossOrigin = d.CorsBehavior;
+ else {
+ var N = d.CorsBehavior(b);
+ N && (T.crossOrigin = N);
+ }
+ }, d.LoadImage = function(b, T, N, U, B) {
+ var L;
+ B === void 0 && (B = "");
+ var j = !1;
+ if (b instanceof ArrayBuffer || ArrayBuffer.isView(b) ? typeof Blob < "u" ? (L = URL.createObjectURL(new Blob([b], { type: B })), j = !0) : L = "data:" + B + ";base64," + g.a.EncodeArrayBufferToBase64(b) : b instanceof Blob ? (L = URL.createObjectURL(b), j = !0) : (L = d._CleanUrl(b), L = d.PreprocessUrl(b)), typeof Image > "u")
+ return d.LoadFile(L, function(ae) {
+ createImageBitmap(new Blob([ae], { type: B })).then(function(ie) {
+ T(ie), j && URL.revokeObjectURL(L);
+ }).catch(function(ie) {
+ N && N("Error while trying to load image: " + b, ie);
+ });
+ }, void 0, U || void 0, !0, function(ae, ie) {
+ N && N("Error while trying to load image: " + b, ie);
+ }), null;
+ var W = new Image();
+ d.SetCorsBehavior(L, W);
+ var Y = function() {
+ W.removeEventListener("load", Y), W.removeEventListener("error", oe), T(W), j && W.src && URL.revokeObjectURL(W.src);
+ }, oe = function(ae) {
+ if (W.removeEventListener("load", Y), W.removeEventListener("error", oe), N) {
+ var ie = b.toString();
+ N("Error while trying to load image: " + (ie.length < 32 ? ie : ie.slice(0, 32) + "..."), ae);
+ }
+ j && W.src && URL.revokeObjectURL(W.src);
+ };
+ W.addEventListener("load", Y), W.addEventListener("error", oe);
+ var te = function() {
+ W.src = L;
+ };
+ if (L.substr(0, 5) !== "data:" && U && U.enableTexturesOffline)
+ U.open(function() {
+ U && U.loadImage(L, W);
+ }, te);
+ else {
+ if (L.indexOf("file:") !== -1) {
+ var _e = decodeURIComponent(L.substring(5).toLowerCase());
+ if (C.a.FilesToLoad[_e]) {
+ try {
+ var de;
+ try {
+ de = URL.createObjectURL(C.a.FilesToLoad[_e]);
+ } catch {
+ de = URL.createObjectURL(C.a.FilesToLoad[_e]);
+ }
+ W.src = de, j = !0;
+ } catch {
+ W.src = "";
+ }
+ return W;
+ }
+ }
+ te();
+ }
+ return W;
+ }, d.ReadFile = function(b, T, N, U, B) {
+ var L = new FileReader(), j = { onCompleteObservable: new c.c(), abort: function() {
+ return L.abort();
+ } };
+ return L.onloadend = function(W) {
+ return j.onCompleteObservable.notifyObservers(j);
+ }, B && (L.onerror = function(W) {
+ B(new v("Unable to read " + b.name, b));
+ }), L.onload = function(W) {
+ T(W.target.result);
+ }, N && (L.onprogress = N), U ? L.readAsArrayBuffer(b) : L.readAsText(b), j;
+ }, d.LoadFile = function(b, T, N, U, B, L) {
+ if (b.indexOf("file:") !== -1) {
+ var j = decodeURIComponent(b.substring(5).toLowerCase());
+ j.indexOf("./") === 0 && (j = j.substring(2));
+ var W = C.a.FilesToLoad[j];
+ if (W)
+ return d.ReadFile(W, T, N, B, L ? function(Y) {
+ return L(void 0, new A(Y.message, Y.file));
+ } : void 0);
+ }
+ return d.RequestFile(b, function(Y, oe) {
+ T(Y, oe ? oe.responseURL : void 0);
+ }, N, U, B, L ? function(Y) {
+ L(Y.request, new A(Y.message, Y.request));
+ } : void 0);
+ }, d.RequestFile = function(b, T, N, U, B, L, j) {
+ b = d._CleanUrl(b), b = d.PreprocessUrl(b);
+ var W = d.BaseUrl + b, Y = !1, oe = { onCompleteObservable: new c.c(), abort: function() {
+ return Y = !0;
+ } }, te = function() {
+ var de = new f.a(), ae = null;
+ oe.abort = function() {
+ Y = !0, de.readyState !== (XMLHttpRequest.DONE || 4) && de.abort(), ae !== null && (clearTimeout(ae), ae = null);
+ };
+ var ie = function(Z) {
+ de.open("GET", W), j && j(de), B && (de.responseType = "arraybuffer"), N && de.addEventListener("progress", N);
+ var ee = function() {
+ de.removeEventListener("loadend", ee), oe.onCompleteObservable.notifyObservers(oe), oe.onCompleteObservable.clear();
+ };
+ de.addEventListener("loadend", ee);
+ var w = function() {
+ if (!Y && de.readyState === (XMLHttpRequest.DONE || 4)) {
+ if (de.removeEventListener("readystatechange", w), de.status >= 200 && de.status < 300 || de.status === 0 && (!P.a.IsWindowObjectExist() || d.IsFileURL()))
+ return void T(B ? de.response : de.responseText, de);
+ var z = d.DefaultRetryStrategy;
+ if (z) {
+ var q = z(W, de, Z);
+ if (q !== -1)
+ return de.removeEventListener("loadend", ee), de = new f.a(), void (ae = setTimeout(function() {
+ return ie(Z + 1);
+ }, q));
+ }
+ var le = new y("Error status: " + de.status + " " + de.statusText + " - Unable to load " + W, de);
+ L && L(le);
+ }
+ };
+ de.addEventListener("readystatechange", w), de.send();
+ };
+ ie(0);
+ };
+ if (U && U.enableSceneOffline) {
+ var _e = function(de) {
+ de && de.status > 400 ? L && L(de) : te();
+ };
+ U.open(function() {
+ U && U.loadFile(d.BaseUrl + b, function(de) {
+ Y || T(de), oe.onCompleteObservable.notifyObservers(oe);
+ }, N ? function(de) {
+ Y || N(de);
+ } : void 0, _e, B);
+ }, _e);
+ } else
+ te();
+ return oe;
+ }, d.IsFileURL = function() {
+ return typeof location < "u" && location.protocol === "file:";
+ }, d.DefaultRetryStrategy = x.a.ExponentialBackoff(), d.BaseUrl = "", d.CorsBehavior = "anonymous", d.PreprocessUrl = function(b) {
+ return b;
+ }, d;
+ }();
+ u.a._FileToolsLoadImage = h.LoadImage.bind(h), u.a._FileToolsLoadFile = h.LoadFile.bind(h), E.a._FileToolsLoadFile = h.LoadFile.bind(h);
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return f;
+ });
+ var D = l(38), f = function() {
+ function P() {
+ }
+ return Object.defineProperty(P, "Now", { get: function() {
+ return D.a.IsWindowObjectExist() && window.performance && window.performance.now ? window.performance.now() : Date.now();
+ }, enumerable: !1, configurable: !0 }), P;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ function f(P, c, C, x) {
+ this.x = P, this.y = c, this.width = C, this.height = x;
+ }
+ return f.prototype.toGlobal = function(P, c) {
+ return new f(this.x * P, this.y * c, this.width * P, this.height * c);
+ }, f.prototype.toGlobalToRef = function(P, c, C) {
+ return C.x = this.x * P, C.y = this.y * c, C.width = this.width * P, C.height = this.height * c, this;
+ }, f.prototype.clone = function() {
+ return new f(this.x, this.y, this.width, this.height);
+ }, f;
+ }();
+ }, function(V, _, l) {
+ var D = "helperFunctions", f = `const float PI=3.1415926535897932384626433832795;
+const float HALF_MIN=5.96046448e-08;
+const float LinearEncodePowerApprox=2.2;
+const float GammaEncodePowerApprox=1.0/LinearEncodePowerApprox;
+const vec3 LuminanceEncodeApprox=vec3(0.2126,0.7152,0.0722);
+const float Epsilon=0.0000001;
+#define saturate(x) clamp(x,0.0,1.0)
+#define absEps(x) abs(x)+Epsilon
+#define maxEps(x) max(x,Epsilon)
+#define saturateEps(x) clamp(x,Epsilon,1.0)
+mat3 transposeMat3(mat3 inMatrix) {
+vec3 i0=inMatrix[0];
+vec3 i1=inMatrix[1];
+vec3 i2=inMatrix[2];
+mat3 outMatrix=mat3(
+vec3(i0.x,i1.x,i2.x),
+vec3(i0.y,i1.y,i2.y),
+vec3(i0.z,i1.z,i2.z)
+);
+return outMatrix;
+}
+
+mat3 inverseMat3(mat3 inMatrix) {
+float a00=inMatrix[0][0],a01=inMatrix[0][1],a02=inMatrix[0][2];
+float a10=inMatrix[1][0],a11=inMatrix[1][1],a12=inMatrix[1][2];
+float a20=inMatrix[2][0],a21=inMatrix[2][1],a22=inMatrix[2][2];
+float b01=a22*a11-a12*a21;
+float b11=-a22*a10+a12*a20;
+float b21=a21*a10-a11*a20;
+float det=a00*b01+a01*b11+a02*b21;
+return mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11),
+b11,(a22*a00-a02*a20),(-a12*a00+a02*a10),
+b21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;
+}
+float toLinearSpace(float color)
+{
+return pow(color,LinearEncodePowerApprox);
+}
+vec3 toLinearSpace(vec3 color)
+{
+return pow(color,vec3(LinearEncodePowerApprox));
+}
+vec4 toLinearSpace(vec4 color)
+{
+return vec4(pow(color.rgb,vec3(LinearEncodePowerApprox)),color.a);
+}
+vec3 toGammaSpace(vec3 color)
+{
+return pow(color,vec3(GammaEncodePowerApprox));
+}
+vec4 toGammaSpace(vec4 color)
+{
+return vec4(pow(color.rgb,vec3(GammaEncodePowerApprox)),color.a);
+}
+float toGammaSpace(float color)
+{
+return pow(color,GammaEncodePowerApprox);
+}
+float square(float value)
+{
+return value*value;
+}
+float pow5(float value) {
+float sq=value*value;
+return sq*sq*value;
+}
+float getLuminance(vec3 color)
+{
+return clamp(dot(color,LuminanceEncodeApprox),0.,1.);
+}
+
+float getRand(vec2 seed) {
+return fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))*43758.5453);
+}
+float dither(vec2 seed,float varianceAmount) {
+float rand=getRand(seed);
+float dither=mix(-varianceAmount/255.0,varianceAmount/255.0,rand);
+return dither;
+}
+
+const float rgbdMaxRange=255.0;
+vec4 toRGBD(vec3 color) {
+float maxRGB=maxEps(max(color.r,max(color.g,color.b)));
+float D=max(rgbdMaxRange/maxRGB,1.);
+D=clamp(floor(D)/255.0,0.,1.);
+
+vec3 rgb=color.rgb*D;
+
+rgb=toGammaSpace(rgb);
+return vec4(rgb,D);
+}
+vec3 fromRGBD(vec4 rgbd) {
+
+rgbd.rgb=toLinearSpace(rgbd.rgb);
+
+return rgbd.rgb/rgbd.a;
+}
+`;
+ l(5).a.IncludesShadersStore[D] = f;
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return f;
+ });
+ var D = l(0), f = function() {
+ function P() {
+ }
+ return P._RemoveAndStorePivotPoint = function(c) {
+ c && P._PivotCached === 0 && (c.getPivotPointToRef(P._OldPivotPoint), P._PivotPostMultiplyPivotMatrix = c._postMultiplyPivotMatrix, P._OldPivotPoint.equalsToFloats(0, 0, 0) || (c.setPivotMatrix(D.a.IdentityReadOnly), P._OldPivotPoint.subtractToRef(c.getPivotPoint(), P._PivotTranslation), P._PivotTmpVector.copyFromFloats(1, 1, 1), P._PivotTmpVector.subtractInPlace(c.scaling), P._PivotTmpVector.multiplyInPlace(P._PivotTranslation), c.position.addInPlace(P._PivotTmpVector))), P._PivotCached++;
+ }, P._RestorePivotPoint = function(c) {
+ c && !P._OldPivotPoint.equalsToFloats(0, 0, 0) && P._PivotCached === 1 && (c.setPivotPoint(P._OldPivotPoint), c._postMultiplyPivotMatrix = P._PivotPostMultiplyPivotMatrix, P._PivotTmpVector.copyFromFloats(1, 1, 1), P._PivotTmpVector.subtractInPlace(c.scaling), P._PivotTmpVector.multiplyInPlace(P._PivotTranslation), c.position.subtractInPlace(P._PivotTmpVector)), this._PivotCached--;
+ }, P._PivotCached = 0, P._OldPivotPoint = new D.e(), P._PivotTranslation = new D.e(), P._PivotTmpVector = new D.e(), P._PivotPostMultiplyPivotMatrix = !1, P;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return x;
+ });
+ var D = l(4), f = l(114), P = l(43), c = l(2), C = l(101), x = function() {
+ function R(g, u, E, A, y, v, h, d, b) {
+ d === void 0 && (d = !0), b === void 0 && (b = !0), this.materialIndex = g, this.verticesStart = u, this.verticesCount = E, this.indexStart = A, this.indexCount = y, this._materialDefines = null, this._materialEffect = null, this._effectOverride = null, this._linesIndexCount = 0, this._linesIndexBuffer = null, this._lastColliderWorldVertices = null, this._lastColliderTransformMatrix = null, this._renderId = 0, this._alphaIndex = 0, this._distanceToCamera = 0, this._currentMaterial = null, this._mesh = v, this._renderingMesh = h || v, b && v.subMeshes.push(this), this._trianglePlanes = [], this._id = v.subMeshes.length - 1, d && (this.refreshBoundingInfo(), v.computeWorldMatrix(!0));
+ }
+ return Object.defineProperty(R.prototype, "materialDefines", { get: function() {
+ return this._materialDefines;
+ }, set: function(g) {
+ this._materialDefines = g;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(R.prototype, "effect", { get: function() {
+ var g;
+ return (g = this._effectOverride) !== null && g !== void 0 ? g : this._materialEffect;
+ }, enumerable: !1, configurable: !0 }), R.prototype.setEffect = function(g, u) {
+ u === void 0 && (u = null), this._materialEffect !== g ? (this._materialDefines = u, this._materialEffect = g) : g || (this._materialDefines = null);
+ }, R.AddToMesh = function(g, u, E, A, y, v, h, d) {
+ return d === void 0 && (d = !0), new R(g, u, E, A, y, v, h, d);
+ }, Object.defineProperty(R.prototype, "IsGlobal", { get: function() {
+ return this.verticesStart === 0 && this.verticesCount === this._mesh.getTotalVertices();
+ }, enumerable: !1, configurable: !0 }), R.prototype.getBoundingInfo = function() {
+ return this.IsGlobal ? this._mesh.getBoundingInfo() : this._boundingInfo;
+ }, R.prototype.setBoundingInfo = function(g) {
+ return this._boundingInfo = g, this;
+ }, R.prototype.getMesh = function() {
+ return this._mesh;
+ }, R.prototype.getRenderingMesh = function() {
+ return this._renderingMesh;
+ }, R.prototype.getReplacementMesh = function() {
+ return this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh ? this._mesh : null;
+ }, R.prototype.getEffectiveMesh = function() {
+ var g = this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh ? this._mesh : null;
+ return g || this._renderingMesh;
+ }, R.prototype.getMaterial = function() {
+ var g = this._renderingMesh.material;
+ if (g == null)
+ return this._mesh.getScene().defaultMaterial;
+ if (this._IsMultiMaterial(g)) {
+ var u = g.getSubMaterial(this.materialIndex);
+ return this._currentMaterial !== u && (this._currentMaterial = u, this._materialDefines = null), u;
+ }
+ return g;
+ }, R.prototype._IsMultiMaterial = function(g) {
+ return g.getSubMaterial !== void 0;
+ }, R.prototype.refreshBoundingInfo = function(g) {
+ if (g === void 0 && (g = null), this._lastColliderWorldVertices = null, this.IsGlobal || !this._renderingMesh || !this._renderingMesh.geometry)
+ return this;
+ if (g || (g = this._renderingMesh.getVerticesData(D.b.PositionKind)), !g)
+ return this._boundingInfo = this._mesh.getBoundingInfo(), this;
+ var u, E = this._renderingMesh.getIndices();
+ if (this.indexStart === 0 && this.indexCount === E.length) {
+ var A = this._renderingMesh.getBoundingInfo();
+ u = { minimum: A.minimum.clone(), maximum: A.maximum.clone() };
+ } else
+ u = Object(C.b)(g, E, this.indexStart, this.indexCount, this._renderingMesh.geometry.boundingBias);
+ return this._boundingInfo ? this._boundingInfo.reConstruct(u.minimum, u.maximum) : this._boundingInfo = new P.a(u.minimum, u.maximum), this;
+ }, R.prototype._checkCollision = function(g) {
+ return this.getBoundingInfo()._checkCollision(g);
+ }, R.prototype.updateBoundingInfo = function(g) {
+ var u = this.getBoundingInfo();
+ return u || (this.refreshBoundingInfo(), u = this.getBoundingInfo()), u && u.update(g), this;
+ }, R.prototype.isInFrustum = function(g) {
+ var u = this.getBoundingInfo();
+ return !!u && u.isInFrustum(g, this._mesh.cullingStrategy);
+ }, R.prototype.isCompletelyInFrustum = function(g) {
+ var u = this.getBoundingInfo();
+ return !!u && u.isCompletelyInFrustum(g);
+ }, R.prototype.render = function(g) {
+ return this._renderingMesh.render(this, g, this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh ? this._mesh : void 0), this;
+ }, R.prototype._getLinesIndexBuffer = function(g, u) {
+ if (!this._linesIndexBuffer) {
+ for (var E = [], A = this.indexStart; A < this.indexStart + this.indexCount; A += 3)
+ E.push(g[A], g[A + 1], g[A + 1], g[A + 2], g[A + 2], g[A]);
+ this._linesIndexBuffer = u.createIndexBuffer(E), this._linesIndexCount = E.length;
+ }
+ return this._linesIndexBuffer;
+ }, R.prototype.canIntersects = function(g) {
+ var u = this.getBoundingInfo();
+ return !!u && g.intersectsBox(u.boundingBox);
+ }, R.prototype.intersects = function(g, u, E, A, y) {
+ var v = this.getMaterial();
+ if (!v)
+ return null;
+ var h = 3, d = !1;
+ switch (v.fillMode) {
+ case c.a.MATERIAL_PointListDrawMode:
+ case c.a.MATERIAL_LineListDrawMode:
+ case c.a.MATERIAL_LineLoopDrawMode:
+ case c.a.MATERIAL_LineStripDrawMode:
+ case c.a.MATERIAL_TriangleFanDrawMode:
+ return null;
+ case c.a.MATERIAL_TriangleStripDrawMode:
+ h = 1, d = !0;
+ }
+ return this._mesh.getClassName() === "InstancedLinesMesh" || this._mesh.getClassName() === "LinesMesh" ? E.length ? this._intersectLines(g, u, E, this._mesh.intersectionThreshold, A) : this._intersectUnIndexedLines(g, u, E, this._mesh.intersectionThreshold, A) : !E.length && this._mesh._unIndexed ? this._intersectUnIndexedTriangles(g, u, E, A, y) : this._intersectTriangles(g, u, E, h, d, A, y);
+ }, R.prototype._intersectLines = function(g, u, E, A, y) {
+ for (var v = null, h = this.indexStart; h < this.indexStart + this.indexCount; h += 2) {
+ var d = u[E[h]], b = u[E[h + 1]], T = g.intersectionSegment(d, b, A);
+ if (!(T < 0) && (y || !v || T < v.distance) && ((v = new f.a(null, null, T)).faceId = h / 2, y))
+ break;
+ }
+ return v;
+ }, R.prototype._intersectUnIndexedLines = function(g, u, E, A, y) {
+ for (var v = null, h = this.verticesStart; h < this.verticesStart + this.verticesCount; h += 2) {
+ var d = u[h], b = u[h + 1], T = g.intersectionSegment(d, b, A);
+ if (!(T < 0) && (y || !v || T < v.distance) && ((v = new f.a(null, null, T)).faceId = h / 2, y))
+ break;
+ }
+ return v;
+ }, R.prototype._intersectTriangles = function(g, u, E, A, y, v, h) {
+ for (var d = null, b = -1, T = this.indexStart; T < this.indexStart + this.indexCount; T += A) {
+ b++;
+ var N = E[T], U = E[T + 1], B = E[T + 2];
+ if (y && B === 4294967295)
+ T += 2;
+ else {
+ var L = u[N], j = u[U], W = u[B];
+ if (!h || h(L, j, W, g)) {
+ var Y = g.intersectsTriangle(L, j, W);
+ if (Y) {
+ if (Y.distance < 0)
+ continue;
+ if ((v || !d || Y.distance < d.distance) && ((d = Y).faceId = b, v))
+ break;
+ }
+ }
+ }
+ }
+ return d;
+ }, R.prototype._intersectUnIndexedTriangles = function(g, u, E, A, y) {
+ for (var v = null, h = this.verticesStart; h < this.verticesStart + this.verticesCount; h += 3) {
+ var d = u[h], b = u[h + 1], T = u[h + 2];
+ if (!y || y(d, b, T, g)) {
+ var N = g.intersectsTriangle(d, b, T);
+ if (N) {
+ if (N.distance < 0)
+ continue;
+ if ((A || !v || N.distance < v.distance) && ((v = N).faceId = h / 3, A))
+ break;
+ }
+ }
+ }
+ return v;
+ }, R.prototype._rebuild = function() {
+ this._linesIndexBuffer && (this._linesIndexBuffer = null);
+ }, R.prototype.clone = function(g, u) {
+ var E = new R(this.materialIndex, this.verticesStart, this.verticesCount, this.indexStart, this.indexCount, g, u, !1);
+ if (!this.IsGlobal) {
+ var A = this.getBoundingInfo();
+ if (!A)
+ return E;
+ E._boundingInfo = new P.a(A.minimum, A.maximum);
+ }
+ return E;
+ }, R.prototype.dispose = function() {
+ this._linesIndexBuffer && (this._mesh.getScene().getEngine()._releaseBuffer(this._linesIndexBuffer), this._linesIndexBuffer = null);
+ var g = this._mesh.subMeshes.indexOf(this);
+ this._mesh.subMeshes.splice(g, 1);
+ }, R.prototype.getClassName = function() {
+ return "SubMesh";
+ }, R.CreateFromIndices = function(g, u, E, A, y) {
+ for (var v = Number.MAX_VALUE, h = -Number.MAX_VALUE, d = (y || A).getIndices(), b = u; b < u + E; b++) {
+ var T = d[b];
+ T < v && (v = T), T > h && (h = T);
+ }
+ return new R(g, v, h - v + 1, u, E, A, y);
+ }, R;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return x;
+ });
+ var D = l(1), f = l(8), P = l(10), c = l(2), C = (l(126), l(70)), x = function(R) {
+ function g(u, E, A, y, v, h, d) {
+ A === void 0 && (A = null), v === void 0 && (v = c.a.TEXTURE_TRILINEAR_SAMPLINGMODE), h === void 0 && (h = c.a.TEXTUREFORMAT_RGBA);
+ var b = R.call(this, null, A, !y, d, v, void 0, void 0, void 0, void 0, h) || this;
+ b.name = u, b.wrapU = P.a.CLAMP_ADDRESSMODE, b.wrapV = P.a.CLAMP_ADDRESSMODE, b._generateMipMaps = y;
+ var T = b._getEngine();
+ if (!T)
+ return b;
+ E.getContext ? (b._canvas = E, b._texture = T.createDynamicTexture(E.width, E.height, y, v)) : (b._canvas = C.a.CreateCanvas(1, 1), E.width || E.width === 0 ? b._texture = T.createDynamicTexture(E.width, E.height, y, v) : b._texture = T.createDynamicTexture(E, E, y, v));
+ var N = b.getSize();
+ return b._canvas.width = N.width, b._canvas.height = N.height, b._context = b._canvas.getContext("2d"), b;
+ }
+ return Object(D.d)(g, R), g.prototype.getClassName = function() {
+ return "DynamicTexture";
+ }, Object.defineProperty(g.prototype, "canRescale", { get: function() {
+ return !0;
+ }, enumerable: !1, configurable: !0 }), g.prototype._recreate = function(u) {
+ this._canvas.width = u.width, this._canvas.height = u.height, this.releaseInternalTexture(), this._texture = this._getEngine().createDynamicTexture(u.width, u.height, this._generateMipMaps, this.samplingMode);
+ }, g.prototype.scale = function(u) {
+ var E = this.getSize();
+ E.width *= u, E.height *= u, this._recreate(E);
+ }, g.prototype.scaleTo = function(u, E) {
+ var A = this.getSize();
+ A.width = u, A.height = E, this._recreate(A);
+ }, g.prototype.getContext = function() {
+ return this._context;
+ }, g.prototype.clear = function() {
+ var u = this.getSize();
+ this._context.fillRect(0, 0, u.width, u.height);
+ }, g.prototype.update = function(u, E) {
+ E === void 0 && (E = !1), this._getEngine().updateDynamicTexture(this._texture, this._canvas, u === void 0 || u, E, this._format || void 0);
+ }, g.prototype.drawText = function(u, E, A, y, v, h, d, b) {
+ b === void 0 && (b = !0);
+ var T = this.getSize();
+ if (h && (this._context.fillStyle = h, this._context.fillRect(0, 0, T.width, T.height)), this._context.font = y, E == null) {
+ var N = this._context.measureText(u);
+ E = (T.width - N.width) / 2;
+ }
+ if (A == null) {
+ var U = parseInt(y.replace(/\D/g, ""));
+ A = T.height / 2 + U / 3.65;
+ }
+ this._context.fillStyle = v || "", this._context.fillText(u, E, A), b && this.update(d);
+ }, g.prototype.clone = function() {
+ var u = this.getScene();
+ if (!u)
+ return this;
+ var E = this.getSize(), A = new g(this.name, E, u, this._generateMipMaps);
+ return A.hasAlpha = this.hasAlpha, A.level = this.level, A.wrapU = this.wrapU, A.wrapV = this.wrapV, A;
+ }, g.prototype.serialize = function() {
+ var u = this.getScene();
+ u && !u.isReady() && f.a.Warn("The scene must be ready before serializing the dynamic texture");
+ var E = R.prototype.serialize.call(this);
+ return this._IsCanvasElement(this._canvas) && (E.base64String = this._canvas.toDataURL()), E.invertY = this._invertY, E.samplingMode = this.samplingMode, E;
+ }, g.prototype._IsCanvasElement = function(u) {
+ return u.toDataURL !== void 0;
+ }, g.prototype._rebuild = function() {
+ this.update();
+ }, g;
+ }(P.a);
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return C;
+ });
+ var D = l(0), f = l(9), P = l(7), c = l(16);
+ c.a.CreateBox = function(x) {
+ var R, g = [0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11, 12, 13, 14, 12, 14, 15, 16, 17, 18, 16, 18, 19, 20, 21, 22, 20, 22, 23], u = [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0], E = [], A = x.width || x.size || 1, y = x.height || x.size || 1, v = x.depth || x.size || 1, h = x.wrap || !1, d = x.topBaseAt === void 0 ? 1 : x.topBaseAt, b = x.bottomBaseAt === void 0 ? 0 : x.bottomBaseAt, T = [2, 0, 3, 1][d = (d + 4) % 4], N = [2, 0, 1, 3][b = (b + 4) % 4], U = [1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1];
+ if (h) {
+ g = [2, 3, 0, 2, 0, 1, 4, 5, 6, 4, 6, 7, 9, 10, 11, 9, 11, 8, 12, 14, 15, 12, 13, 14], U = [-1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1];
+ for (var B = [[1, 1, 1], [-1, 1, 1], [-1, 1, -1], [1, 1, -1]], L = [[-1, -1, 1], [1, -1, 1], [1, -1, -1], [-1, -1, -1]], j = [17, 18, 19, 16], W = [22, 23, 20, 21]; T > 0; )
+ B.unshift(B.pop()), j.unshift(j.pop()), T--;
+ for (; N > 0; )
+ L.unshift(L.pop()), W.unshift(W.pop()), N--;
+ B = B.flat(), L = L.flat(), U = U.concat(B).concat(L), g.push(j[0], j[2], j[3], j[0], j[1], j[2]), g.push(W[0], W[2], W[3], W[0], W[1], W[2]);
+ }
+ var Y = [A / 2, y / 2, v / 2];
+ R = U.reduce(function(z, q, le) {
+ return z.concat(q * Y[le % 3]);
+ }, []);
+ for (var oe = x.sideOrientation === 0 ? 0 : x.sideOrientation || c.a.DEFAULTSIDE, te = x.faceUV || new Array(6), _e = x.faceColors, de = [], ae = 0; ae < 6; ae++)
+ te[ae] === void 0 && (te[ae] = new D.f(0, 0, 1, 1)), _e && _e[ae] === void 0 && (_e[ae] = new f.b(1, 1, 1, 1));
+ for (var ie = 0; ie < 6; ie++)
+ if (E.push(te[ie].z, te[ie].w), E.push(te[ie].x, te[ie].w), E.push(te[ie].x, te[ie].y), E.push(te[ie].z, te[ie].y), _e)
+ for (var Z = 0; Z < 4; Z++)
+ de.push(_e[ie].r, _e[ie].g, _e[ie].b, _e[ie].a);
+ c.a._ComputeSides(oe, R, g, u, E, x.frontUVs, x.backUVs);
+ var ee = new c.a();
+ if (ee.indices = g, ee.positions = R, ee.normals = u, ee.uvs = E, _e) {
+ var w = oe === c.a.DOUBLESIDE ? de.concat(de) : de;
+ ee.colors = w;
+ }
+ return ee;
+ }, P.a.CreateBox = function(x, R, g, u, E) {
+ g === void 0 && (g = null);
+ var A = { size: R, sideOrientation: E, updatable: u };
+ return C.CreateBox(x, A, g);
+ };
+ var C = function() {
+ function x() {
+ }
+ return x.CreateBox = function(R, g, u) {
+ u === void 0 && (u = null);
+ var E = new P.a(R, u);
+ return g.sideOrientation = P.a._GetDefaultSideOrientation(g.sideOrientation), E._originalBuilderSideOrientation = g.sideOrientation, c.a.CreateBox(g).applyToMesh(E, g.updatable), E;
+ }, x;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return f;
+ });
+ var D = l(0), f = function() {
+ function P(c, C, x, R) {
+ this.normal = new D.e(c, C, x), this.d = R;
+ }
+ return P.prototype.asArray = function() {
+ return [this.normal.x, this.normal.y, this.normal.z, this.d];
+ }, P.prototype.clone = function() {
+ return new P(this.normal.x, this.normal.y, this.normal.z, this.d);
+ }, P.prototype.getClassName = function() {
+ return "Plane";
+ }, P.prototype.getHashCode = function() {
+ var c = this.normal.getHashCode();
+ return c = 397 * c ^ (0 | this.d);
+ }, P.prototype.normalize = function() {
+ var c = Math.sqrt(this.normal.x * this.normal.x + this.normal.y * this.normal.y + this.normal.z * this.normal.z), C = 0;
+ return c !== 0 && (C = 1 / c), this.normal.x *= C, this.normal.y *= C, this.normal.z *= C, this.d *= C, this;
+ }, P.prototype.transform = function(c) {
+ var C = P._TmpMatrix;
+ c.invertToRef(C);
+ var x = C.m, R = this.normal.x, g = this.normal.y, u = this.normal.z, E = this.d;
+ return new P(R * x[0] + g * x[1] + u * x[2] + E * x[3], R * x[4] + g * x[5] + u * x[6] + E * x[7], R * x[8] + g * x[9] + u * x[10] + E * x[11], R * x[12] + g * x[13] + u * x[14] + E * x[15]);
+ }, P.prototype.dotCoordinate = function(c) {
+ return this.normal.x * c.x + this.normal.y * c.y + this.normal.z * c.z + this.d;
+ }, P.prototype.copyFromPoints = function(c, C, x) {
+ var R, g = C.x - c.x, u = C.y - c.y, E = C.z - c.z, A = x.x - c.x, y = x.y - c.y, v = x.z - c.z, h = u * v - E * y, d = E * A - g * v, b = g * y - u * A, T = Math.sqrt(h * h + d * d + b * b);
+ return R = T !== 0 ? 1 / T : 0, this.normal.x = h * R, this.normal.y = d * R, this.normal.z = b * R, this.d = -(this.normal.x * c.x + this.normal.y * c.y + this.normal.z * c.z), this;
+ }, P.prototype.isFrontFacingTo = function(c, C) {
+ return D.e.Dot(this.normal, c) <= C;
+ }, P.prototype.signedDistanceTo = function(c) {
+ return D.e.Dot(c, this.normal) + this.d;
+ }, P.FromArray = function(c) {
+ return new P(c[0], c[1], c[2], c[3]);
+ }, P.FromPoints = function(c, C, x) {
+ var R = new P(0, 0, 0, 0);
+ return R.copyFromPoints(c, C, x), R;
+ }, P.FromPositionAndNormal = function(c, C) {
+ var x = new P(0, 0, 0, 0);
+ return C.normalize(), x.normal = C, x.d = -(C.x * c.x + C.y * c.y + C.z * c.z), x;
+ }, P.SignedDistanceToPlaneFromPositionAndNormal = function(c, C, x) {
+ var R = -(C.x * c.x + C.y * c.y + C.z * c.z);
+ return D.e.Dot(x, C) + R;
+ }, P._TmpMatrix = D.a.Identity(), P;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return g;
+ });
+ var D = l(7), f = l(20), P = l(6), c = l(0), C = l(18), x = l(39), R = l(60), g = (l(84), function() {
+ function u(E) {
+ this._useAlternatePickedPointAboveMaxDragAngleDragSpeed = -1.1, this.maxDragAngle = 0, this._useAlternatePickedPointAboveMaxDragAngle = !1, this.currentDraggingPointerID = -1, this.dragging = !1, this.dragDeltaRatio = 0.2, this.updateDragPlane = !0, this._debugMode = !1, this._moving = !1, this.onDragObservable = new P.c(), this.onDragStartObservable = new P.c(), this.onDragEndObservable = new P.c(), this.moveAttached = !0, this.enabled = !0, this.startAndReleaseDragOnPointerEvents = !0, this.detachCameraControls = !0, this.useObjectOrientationForDragging = !0, this.validateDrag = function(y) {
+ return !0;
+ }, this._tmpVector = new c.e(0, 0, 0), this._alternatePickedPoint = new c.e(0, 0, 0), this._worldDragAxis = new c.e(0, 0, 0), this._targetPosition = new c.e(0, 0, 0), this._attachedToElement = !1, this._startDragRay = new x.a(new c.e(), new c.e()), this._lastPointerRay = {}, this._dragDelta = new c.e(), this._pointA = new c.e(0, 0, 0), this._pointC = new c.e(0, 0, 0), this._localAxis = new c.e(0, 0, 0), this._lookAt = new c.e(0, 0, 0), this._options = E || {};
+ var A = 0;
+ if (this._options.dragAxis && A++, this._options.dragPlaneNormal && A++, A > 1)
+ throw "Multiple drag modes specified in dragBehavior options. Only one expected";
+ }
+ return Object.defineProperty(u.prototype, "options", { get: function() {
+ return this._options;
+ }, set: function(E) {
+ this._options = E;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(u.prototype, "name", { get: function() {
+ return "PointerDrag";
+ }, enumerable: !1, configurable: !0 }), u.prototype.init = function() {
+ }, u.prototype.attach = function(E, A) {
+ var y = this;
+ this._scene = E.getScene(), this.attachedNode = E, u._planeScene || (this._debugMode ? u._planeScene = this._scene : (u._planeScene = new f.a(this._scene.getEngine(), { virtual: !0 }), u._planeScene.detachControl(), this._scene.onDisposeObservable.addOnce(function() {
+ u._planeScene.dispose(), u._planeScene = null;
+ }))), this._dragPlane = D.a.CreatePlane("pointerDragPlane", this._debugMode ? 1 : 1e4, u._planeScene, !1, D.a.DOUBLESIDE), this.lastDragPosition = new c.e(0, 0, 0);
+ var v = A || function(h) {
+ return y.attachedNode == h || h.isDescendantOf(y.attachedNode);
+ };
+ this._pointerObserver = this._scene.onPointerObservable.add(function(h, d) {
+ if (y.enabled) {
+ if (h.type == C.a.POINTERDOWN)
+ y.startAndReleaseDragOnPointerEvents && !y.dragging && h.pickInfo && h.pickInfo.hit && h.pickInfo.pickedMesh && h.pickInfo.pickedPoint && h.pickInfo.ray && v(h.pickInfo.pickedMesh) && y._startDrag(h.event.pointerId, h.pickInfo.ray, h.pickInfo.pickedPoint);
+ else if (h.type == C.a.POINTERUP)
+ y.startAndReleaseDragOnPointerEvents && y.currentDraggingPointerID == h.event.pointerId && y.releaseDrag();
+ else if (h.type == C.a.POINTERMOVE) {
+ var b = h.event.pointerId;
+ if (y.currentDraggingPointerID === u._AnyMouseID && b !== u._AnyMouseID) {
+ var T = h.event;
+ (T.pointerType === "mouse" || !y._scene.getEngine().hostInformation.isMobile && T instanceof MouseEvent) && (y._lastPointerRay[y.currentDraggingPointerID] && (y._lastPointerRay[b] = y._lastPointerRay[y.currentDraggingPointerID], delete y._lastPointerRay[y.currentDraggingPointerID]), y.currentDraggingPointerID = b);
+ }
+ y._lastPointerRay[b] || (y._lastPointerRay[b] = new x.a(new c.e(), new c.e())), h.pickInfo && h.pickInfo.ray && (y._lastPointerRay[b].origin.copyFrom(h.pickInfo.ray.origin), y._lastPointerRay[b].direction.copyFrom(h.pickInfo.ray.direction), y.currentDraggingPointerID == b && y.dragging && y._moveDrag(h.pickInfo.ray));
+ }
+ }
+ }), this._beforeRenderObserver = this._scene.onBeforeRenderObservable.add(function() {
+ y._moving && y.moveAttached && (R.a._RemoveAndStorePivotPoint(y.attachedNode), y._targetPosition.subtractToRef(y.attachedNode.absolutePosition, y._tmpVector), y._tmpVector.scaleInPlace(y.dragDeltaRatio), y.attachedNode.getAbsolutePosition().addToRef(y._tmpVector, y._tmpVector), y.validateDrag(y._tmpVector) && y.attachedNode.setAbsolutePosition(y._tmpVector), R.a._RestorePivotPoint(y.attachedNode));
+ });
+ }, u.prototype.releaseDrag = function() {
+ if (this.dragging && (this.dragging = !1, this.onDragEndObservable.notifyObservers({ dragPlanePoint: this.lastDragPosition, pointerId: this.currentDraggingPointerID })), this.currentDraggingPointerID = -1, this._moving = !1, this.detachCameraControls && this._attachedToElement && this._scene.activeCamera && !this._scene.activeCamera.leftCamera) {
+ if (this._scene.activeCamera.getClassName() === "ArcRotateCamera") {
+ var E = this._scene.activeCamera;
+ E.attachControl(!E.inputs || E.inputs.noPreventDefault, E._useCtrlForPanning, E._panningMouseButton);
+ } else
+ this._scene.activeCamera.attachControl(!this._scene.activeCamera.inputs || this._scene.activeCamera.inputs.noPreventDefault);
+ this._attachedToElement = !1;
+ }
+ }, u.prototype.startDrag = function(E, A, y) {
+ E === void 0 && (E = u._AnyMouseID), this._startDrag(E, A, y);
+ var v = this._lastPointerRay[E];
+ E === u._AnyMouseID && (v = this._lastPointerRay[Object.keys(this._lastPointerRay)[0]]), v && this._moveDrag(v);
+ }, u.prototype._startDrag = function(E, A, y) {
+ if (this._scene.activeCamera && !this.dragging && this.attachedNode) {
+ R.a._RemoveAndStorePivotPoint(this.attachedNode), A ? (this._startDragRay.direction.copyFrom(A.direction), this._startDragRay.origin.copyFrom(A.origin)) : (this._startDragRay.origin.copyFrom(this._scene.activeCamera.position), this.attachedNode.getWorldMatrix().getTranslationToRef(this._tmpVector), this._tmpVector.subtractToRef(this._scene.activeCamera.position, this._startDragRay.direction)), this._updateDragPlanePosition(this._startDragRay, y || this._tmpVector);
+ var v = this._pickWithRayOnDragPlane(this._startDragRay);
+ v && (this.dragging = !0, this.currentDraggingPointerID = E, this.lastDragPosition.copyFrom(v), this.onDragStartObservable.notifyObservers({ dragPlanePoint: v, pointerId: this.currentDraggingPointerID }), this._targetPosition.copyFrom(this.attachedNode.absolutePosition), this.detachCameraControls && this._scene.activeCamera && this._scene.activeCamera.inputs && !this._scene.activeCamera.leftCamera && (this._scene.activeCamera.inputs.attachedToElement ? (this._scene.activeCamera.detachControl(), this._attachedToElement = !0) : this._attachedToElement = !1)), R.a._RestorePivotPoint(this.attachedNode);
+ }
+ }, u.prototype._moveDrag = function(E) {
+ this._moving = !0;
+ var A = this._pickWithRayOnDragPlane(E);
+ if (A) {
+ this.updateDragPlane && this._updateDragPlanePosition(E, A);
+ var y = 0;
+ this._options.dragAxis ? (this.useObjectOrientationForDragging ? c.e.TransformCoordinatesToRef(this._options.dragAxis, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._worldDragAxis) : this._worldDragAxis.copyFrom(this._options.dragAxis), A.subtractToRef(this.lastDragPosition, this._tmpVector), y = c.e.Dot(this._tmpVector, this._worldDragAxis), this._worldDragAxis.scaleToRef(y, this._dragDelta)) : (y = this._dragDelta.length(), A.subtractToRef(this.lastDragPosition, this._dragDelta)), this._targetPosition.addInPlace(this._dragDelta), this.onDragObservable.notifyObservers({ dragDistance: y, delta: this._dragDelta, dragPlanePoint: A, dragPlaneNormal: this._dragPlane.forward, pointerId: this.currentDraggingPointerID }), this.lastDragPosition.copyFrom(A);
+ }
+ }, u.prototype._pickWithRayOnDragPlane = function(E) {
+ var A = this;
+ if (!E)
+ return null;
+ var y = Math.acos(c.e.Dot(this._dragPlane.forward, E.direction));
+ if (y > Math.PI / 2 && (y = Math.PI - y), this.maxDragAngle > 0 && y > this.maxDragAngle) {
+ if (this._useAlternatePickedPointAboveMaxDragAngle) {
+ this._tmpVector.copyFrom(E.direction), this.attachedNode.absolutePosition.subtractToRef(E.origin, this._alternatePickedPoint), this._alternatePickedPoint.normalize(), this._alternatePickedPoint.scaleInPlace(this._useAlternatePickedPointAboveMaxDragAngleDragSpeed * c.e.Dot(this._alternatePickedPoint, this._tmpVector)), this._tmpVector.addInPlace(this._alternatePickedPoint);
+ var v = c.e.Dot(this._dragPlane.forward, this._tmpVector);
+ return this._dragPlane.forward.scaleToRef(-v, this._alternatePickedPoint), this._alternatePickedPoint.addInPlace(this._tmpVector), this._alternatePickedPoint.addInPlace(this.attachedNode.absolutePosition), this._alternatePickedPoint;
+ }
+ return null;
+ }
+ var h = u._planeScene.pickWithRay(E, function(d) {
+ return d == A._dragPlane;
+ });
+ return h && h.hit && h.pickedMesh && h.pickedPoint ? h.pickedPoint : null;
+ }, u.prototype._updateDragPlanePosition = function(E, A) {
+ this._pointA.copyFrom(A), this._options.dragAxis ? (this.useObjectOrientationForDragging ? c.e.TransformCoordinatesToRef(this._options.dragAxis, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._localAxis) : this._localAxis.copyFrom(this._options.dragAxis), E.origin.subtractToRef(this._pointA, this._pointC), this._pointC.normalize(), Math.abs(c.e.Dot(this._localAxis, this._pointC)) > 0.999 ? Math.abs(c.e.Dot(c.e.UpReadOnly, this._pointC)) > 0.999 ? this._lookAt.copyFrom(c.e.Right()) : this._lookAt.copyFrom(c.e.UpReadOnly) : (c.e.CrossToRef(this._localAxis, this._pointC, this._lookAt), c.e.CrossToRef(this._localAxis, this._lookAt, this._lookAt), this._lookAt.normalize()), this._dragPlane.position.copyFrom(this._pointA), this._pointA.addToRef(this._lookAt, this._lookAt), this._dragPlane.lookAt(this._lookAt)) : this._options.dragPlaneNormal ? (this.useObjectOrientationForDragging ? c.e.TransformCoordinatesToRef(this._options.dragPlaneNormal, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._localAxis) : this._localAxis.copyFrom(this._options.dragPlaneNormal), this._dragPlane.position.copyFrom(this._pointA), this._pointA.addToRef(this._localAxis, this._lookAt), this._dragPlane.lookAt(this._lookAt)) : (this._dragPlane.position.copyFrom(this._pointA), this._dragPlane.lookAt(E.origin)), this._dragPlane.position.copyFrom(this.attachedNode.absolutePosition), this._dragPlane.computeWorldMatrix(!0);
+ }, u.prototype.detach = function() {
+ this._pointerObserver && this._scene.onPointerObservable.remove(this._pointerObserver), this._beforeRenderObserver && this._scene.onBeforeRenderObservable.remove(this._beforeRenderObserver), this.releaseDrag();
+ }, u._AnyMouseID = -2, u;
+ }());
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return f;
+ }), l.d(_, "b", function() {
+ return P;
+ }), l.d(_, "c", function() {
+ return c;
+ });
+ var D = l(1), f = function() {
+ function C() {
+ }
+ return C.KEYDOWN = 1, C.KEYUP = 2, C;
+ }(), P = function(C, x) {
+ this.type = C, this.event = x;
+ }, c = function(C) {
+ function x(R, g) {
+ var u = C.call(this, R, g) || this;
+ return u.type = R, u.event = g, u.skipOnPointerObservable = !1, u;
+ }
+ return Object(D.d)(x, C), x;
+ }(P);
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ function f() {
+ this._defines = {}, this._currentRank = 32, this._maxRank = -1, this._mesh = null;
+ }
+ return f.prototype.unBindMesh = function() {
+ this._mesh = null;
+ }, f.prototype.addFallback = function(P, c) {
+ this._defines[P] || (P < this._currentRank && (this._currentRank = P), P > this._maxRank && (this._maxRank = P), this._defines[P] = new Array()), this._defines[P].push(c);
+ }, f.prototype.addCPUSkinningFallback = function(P, c) {
+ this._mesh = c, P < this._currentRank && (this._currentRank = P), P > this._maxRank && (this._maxRank = P);
+ }, Object.defineProperty(f.prototype, "hasMoreFallbacks", { get: function() {
+ return this._currentRank <= this._maxRank;
+ }, enumerable: !1, configurable: !0 }), f.prototype.reduce = function(P, c) {
+ if (this._mesh && this._mesh.computeBonesUsingShaders && this._mesh.numBoneInfluencers > 0) {
+ this._mesh.computeBonesUsingShaders = !1, P = P.replace("#define NUM_BONE_INFLUENCERS " + this._mesh.numBoneInfluencers, "#define NUM_BONE_INFLUENCERS 0"), c._bonesComputationForcedToCPU = !0;
+ for (var C = this._mesh.getScene(), x = 0; x < C.meshes.length; x++) {
+ var R = C.meshes[x];
+ if (R.material) {
+ if (R.computeBonesUsingShaders && R.numBoneInfluencers !== 0) {
+ if (R.material.getEffect() === c)
+ R.computeBonesUsingShaders = !1;
+ else if (R.subMeshes) {
+ for (var g = 0, u = R.subMeshes; g < u.length; g++)
+ if (u[g].effect === c) {
+ R.computeBonesUsingShaders = !1;
+ break;
+ }
+ }
+ }
+ } else
+ !this._mesh.material && R.computeBonesUsingShaders && R.numBoneInfluencers > 0 && (R.computeBonesUsingShaders = !1);
+ }
+ } else {
+ var E = this._defines[this._currentRank];
+ if (E)
+ for (x = 0; x < E.length; x++)
+ P = P.replace("#define " + E[x], "");
+ this._currentRank++;
+ }
+ return P;
+ }, f;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return C;
+ });
+ var D = l(1), f = l(25), P = l(37), c = l(11), C = function(x) {
+ function R(g, u) {
+ var E = x.call(this, g, u, !0) || this;
+ return u.multiMaterials.push(E), E.subMaterials = new Array(), E._storeEffectOnSubMeshes = !0, E;
+ }
+ return Object(D.d)(R, x), Object.defineProperty(R.prototype, "subMaterials", { get: function() {
+ return this._subMaterials;
+ }, set: function(g) {
+ this._subMaterials = g, this._hookArray(g);
+ }, enumerable: !1, configurable: !0 }), R.prototype.getChildren = function() {
+ return this.subMaterials;
+ }, R.prototype._hookArray = function(g) {
+ var u = this, E = g.push;
+ g.push = function() {
+ for (var y = [], v = 0; v < arguments.length; v++)
+ y[v] = arguments[v];
+ var h = E.apply(g, y);
+ return u._markAllSubMeshesAsTexturesDirty(), h;
+ };
+ var A = g.splice;
+ g.splice = function(y, v) {
+ var h = A.apply(g, [y, v]);
+ return u._markAllSubMeshesAsTexturesDirty(), h;
+ };
+ }, R.prototype.getSubMaterial = function(g) {
+ return g < 0 || g >= this.subMaterials.length ? this.getScene().defaultMaterial : this.subMaterials[g];
+ }, R.prototype.getActiveTextures = function() {
+ var g;
+ return (g = x.prototype.getActiveTextures.call(this)).concat.apply(g, this.subMaterials.map(function(u) {
+ return u ? u.getActiveTextures() : [];
+ }));
+ }, R.prototype.hasTexture = function(g) {
+ var u;
+ if (x.prototype.hasTexture.call(this, g))
+ return !0;
+ for (var E = 0; E < this.subMaterials.length; E++)
+ if (!((u = this.subMaterials[E]) === null || u === void 0) && u.hasTexture(g))
+ return !0;
+ return !1;
+ }, R.prototype.getClassName = function() {
+ return "MultiMaterial";
+ }, R.prototype.isReadyForSubMesh = function(g, u, E) {
+ for (var A = 0; A < this.subMaterials.length; A++) {
+ var y = this.subMaterials[A];
+ if (y) {
+ if (y._storeEffectOnSubMeshes) {
+ if (!y.isReadyForSubMesh(g, u, E))
+ return !1;
+ continue;
+ }
+ if (!y.isReady(g))
+ return !1;
+ }
+ }
+ return !0;
+ }, R.prototype.clone = function(g, u) {
+ for (var E = new R(g, this.getScene()), A = 0; A < this.subMaterials.length; A++) {
+ var y = null, v = this.subMaterials[A];
+ y = u && v ? v.clone(g + "-" + v.name) : this.subMaterials[A], E.subMaterials.push(y);
+ }
+ return E;
+ }, R.prototype.serialize = function() {
+ var g = {};
+ g.name = this.name, g.id = this.id, P.a && (g.tags = P.a.GetTags(this)), g.materials = [];
+ for (var u = 0; u < this.subMaterials.length; u++) {
+ var E = this.subMaterials[u];
+ E ? g.materials.push(E.id) : g.materials.push(null);
+ }
+ return g;
+ }, R.prototype.dispose = function(g, u, E) {
+ var A = this.getScene();
+ if (A) {
+ if (E)
+ for (var y = 0; y < this.subMaterials.length; y++) {
+ var v = this.subMaterials[y];
+ v && v.dispose(g, u);
+ }
+ (y = A.multiMaterials.indexOf(this)) >= 0 && A.multiMaterials.splice(y, 1), x.prototype.dispose.call(this, g, u);
+ }
+ }, R.ParseMultiMaterial = function(g, u) {
+ var E = new R(g.name, u);
+ E.id = g.id, P.a && P.a.AddTagsTo(E, g.tags);
+ for (var A = 0; A < g.materials.length; A++) {
+ var y = g.materials[A];
+ y ? E.subMaterials.push(u.getLastMaterialByID(y)) : E.subMaterials.push(null);
+ }
+ return E;
+ }, R;
+ }(f.a);
+ c.a.RegisteredTypes["BABYLON.MultiMaterial"] = C;
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return f;
+ });
+ var D = l(2), f = function() {
+ function P() {
+ }
+ return Object.defineProperty(P, "ForceFullSceneLoadingForIncremental", { get: function() {
+ return P._ForceFullSceneLoadingForIncremental;
+ }, set: function(c) {
+ P._ForceFullSceneLoadingForIncremental = c;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(P, "ShowLoadingScreen", { get: function() {
+ return P._ShowLoadingScreen;
+ }, set: function(c) {
+ P._ShowLoadingScreen = c;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(P, "loggingLevel", { get: function() {
+ return P._loggingLevel;
+ }, set: function(c) {
+ P._loggingLevel = c;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(P, "CleanBoneMatrixWeights", { get: function() {
+ return P._CleanBoneMatrixWeights;
+ }, set: function(c) {
+ P._CleanBoneMatrixWeights = c;
+ }, enumerable: !1, configurable: !0 }), P._ForceFullSceneLoadingForIncremental = !1, P._ShowLoadingScreen = !0, P._CleanBoneMatrixWeights = !1, P._loggingLevel = D.a.SCENELOADER_NO_LOGGING, P;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ function f() {
+ }
+ return f.CreateCanvas = function(P, c) {
+ if (typeof document > "u")
+ return new OffscreenCanvas(P, c);
+ var C = document.createElement("canvas");
+ return C.width = P, C.height = c, C;
+ }, f;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return y;
+ });
+ var D = l(0), f = l(9), P = l(16), c = l(4), C = l(61), x = l(69), R = l(43), g = l(2), u = l(12), E = l(37), A = l(101), y = function() {
+ function v(h, d, b, T, N) {
+ T === void 0 && (T = !1), N === void 0 && (N = null), this.delayLoadState = g.a.DELAYLOADSTATE_NONE, this._totalVertices = 0, this._isDisposed = !1, this._indexBufferIsUpdatable = !1, this._positionsCache = [], this.useBoundingInfoFromGeometry = !1, this.id = h, this.uniqueId = d.getUniqueId(), this._engine = d.getEngine(), this._meshes = [], this._scene = d, this._vertexBuffers = {}, this._indices = [], this._updatable = T, b ? this.setAllVerticesData(b, T) : (this._totalVertices = 0, this._indices = []), this._engine.getCaps().vertexArrayObject && (this._vertexArrayObjects = {}), N && (this.applyToMesh(N), N.computeWorldMatrix(!0));
+ }
+ return Object.defineProperty(v.prototype, "boundingBias", { get: function() {
+ return this._boundingBias;
+ }, set: function(h) {
+ this._boundingBias ? this._boundingBias.copyFrom(h) : this._boundingBias = h.clone(), this._updateBoundingInfo(!0, null);
+ }, enumerable: !1, configurable: !0 }), v.CreateGeometryForMesh = function(h) {
+ var d = new v(v.RandomId(), h.getScene());
+ return d.applyToMesh(h), d;
+ }, Object.defineProperty(v.prototype, "meshes", { get: function() {
+ return this._meshes;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(v.prototype, "extend", { get: function() {
+ return this._extend;
+ }, enumerable: !1, configurable: !0 }), v.prototype.getScene = function() {
+ return this._scene;
+ }, v.prototype.getEngine = function() {
+ return this._engine;
+ }, v.prototype.isReady = function() {
+ return this.delayLoadState === g.a.DELAYLOADSTATE_LOADED || this.delayLoadState === g.a.DELAYLOADSTATE_NONE;
+ }, Object.defineProperty(v.prototype, "doNotSerialize", { get: function() {
+ for (var h = 0; h < this._meshes.length; h++)
+ if (!this._meshes[h].doNotSerialize)
+ return !1;
+ return !0;
+ }, enumerable: !1, configurable: !0 }), v.prototype._rebuild = function() {
+ for (var h in this._vertexArrayObjects && (this._vertexArrayObjects = {}), this._meshes.length !== 0 && this._indices && (this._indexBuffer = this._engine.createIndexBuffer(this._indices)), this._vertexBuffers)
+ this._vertexBuffers[h]._rebuild();
+ }, v.prototype.setAllVerticesData = function(h, d) {
+ h.applyToGeometry(this, d), this.notifyUpdate();
+ }, v.prototype.setVerticesData = function(h, d, b, T) {
+ b === void 0 && (b = !1), b && Array.isArray(d) && (d = new Float32Array(d));
+ var N = new c.b(this._engine, d, h, b, this._meshes.length === 0, T);
+ this.setVerticesBuffer(N);
+ }, v.prototype.removeVerticesData = function(h) {
+ this._vertexBuffers[h] && (this._vertexBuffers[h].dispose(), delete this._vertexBuffers[h]);
+ }, v.prototype.setVerticesBuffer = function(h, d) {
+ d === void 0 && (d = null);
+ var b = h.getKind();
+ if (this._vertexBuffers[b] && this._vertexBuffers[b].dispose(), this._vertexBuffers[b] = h, b === c.b.PositionKind) {
+ var T = h.getData();
+ d != null ? this._totalVertices = d : T != null && (this._totalVertices = T.length / (h.byteStride / 4)), this._updateExtend(T), this._resetPointsArrayCache();
+ for (var N = this._meshes, U = N.length, B = 0; B < U; B++) {
+ var L = N[B];
+ L._boundingInfo = new R.a(this._extend.minimum, this._extend.maximum), L._createGlobalSubMesh(!1), L.computeWorldMatrix(!0);
+ }
+ }
+ this.notifyUpdate(b), this._vertexArrayObjects && (this._disposeVertexArrayObjects(), this._vertexArrayObjects = {});
+ }, v.prototype.updateVerticesDataDirectly = function(h, d, b, T) {
+ T === void 0 && (T = !1);
+ var N = this.getVertexBuffer(h);
+ N && (N.updateDirectly(d, b, T), this.notifyUpdate(h));
+ }, v.prototype.updateVerticesData = function(h, d, b) {
+ b === void 0 && (b = !1);
+ var T = this.getVertexBuffer(h);
+ T && (T.update(d), h === c.b.PositionKind && this._updateBoundingInfo(b, d), this.notifyUpdate(h));
+ }, v.prototype._updateBoundingInfo = function(h, d) {
+ if (h && this._updateExtend(d), this._resetPointsArrayCache(), h)
+ for (var b = 0, T = this._meshes; b < T.length; b++) {
+ var N = T[b];
+ N._boundingInfo ? N._boundingInfo.reConstruct(this._extend.minimum, this._extend.maximum) : N._boundingInfo = new R.a(this._extend.minimum, this._extend.maximum);
+ for (var U = 0, B = N.subMeshes; U < B.length; U++)
+ B[U].refreshBoundingInfo();
+ }
+ }, v.prototype._bind = function(h, d) {
+ if (h) {
+ d === void 0 && (d = this._indexBuffer);
+ var b = this.getVertexBuffers();
+ b && (d == this._indexBuffer && this._vertexArrayObjects ? (this._vertexArrayObjects[h.key] || (this._vertexArrayObjects[h.key] = this._engine.recordVertexArrayObject(b, d, h)), this._engine.bindVertexArrayObject(this._vertexArrayObjects[h.key], d)) : this._engine.bindBuffers(b, d, h));
+ }
+ }, v.prototype.getTotalVertices = function() {
+ return this.isReady() ? this._totalVertices : 0;
+ }, v.prototype.getVerticesData = function(h, d, b) {
+ var T = this.getVertexBuffer(h);
+ if (!T)
+ return null;
+ var N = T.getData();
+ if (!N)
+ return null;
+ var U = T.getSize() * c.b.GetTypeByteLength(T.type), B = this._totalVertices * T.getSize();
+ if (T.type !== c.b.FLOAT || T.byteStride !== U) {
+ var L = [];
+ return T.forEach(B, function(te) {
+ return L.push(te);
+ }), L;
+ }
+ if (!(N instanceof Array || N instanceof Float32Array) || T.byteOffset !== 0 || N.length !== B) {
+ if (N instanceof Array) {
+ var j = T.byteOffset / 4;
+ return u.b.Slice(N, j, j + B);
+ }
+ if (N instanceof ArrayBuffer)
+ return new Float32Array(N, T.byteOffset, B);
+ if (j = N.byteOffset + T.byteOffset, b || d && this._meshes.length !== 1) {
+ var W = new Float32Array(B), Y = new Float32Array(N.buffer, j, B);
+ return W.set(Y), W;
+ }
+ var oe = j % 4;
+ return oe && (j = Math.max(0, j - oe)), new Float32Array(N.buffer, j, B);
+ }
+ return b || d && this._meshes.length !== 1 ? u.b.Slice(N) : N;
+ }, v.prototype.isVertexBufferUpdatable = function(h) {
+ var d = this._vertexBuffers[h];
+ return !!d && d.isUpdatable();
+ }, v.prototype.getVertexBuffer = function(h) {
+ return this.isReady() ? this._vertexBuffers[h] : null;
+ }, v.prototype.getVertexBuffers = function() {
+ return this.isReady() ? this._vertexBuffers : null;
+ }, v.prototype.isVerticesDataPresent = function(h) {
+ return this._vertexBuffers ? this._vertexBuffers[h] !== void 0 : !!this._delayInfo && this._delayInfo.indexOf(h) !== -1;
+ }, v.prototype.getVerticesDataKinds = function() {
+ var h, d = [];
+ if (!this._vertexBuffers && this._delayInfo)
+ for (h in this._delayInfo)
+ d.push(h);
+ else
+ for (h in this._vertexBuffers)
+ d.push(h);
+ return d;
+ }, v.prototype.updateIndices = function(h, d, b) {
+ if (b === void 0 && (b = !1), this._indexBuffer)
+ if (this._indexBufferIsUpdatable) {
+ var T = h.length !== this._indices.length;
+ if (b || (this._indices = h.slice()), this._engine.updateDynamicIndexBuffer(this._indexBuffer, h, d), T)
+ for (var N = 0, U = this._meshes; N < U.length; N++)
+ U[N]._createGlobalSubMesh(!0);
+ } else
+ this.setIndices(h, null, !0);
+ }, v.prototype.setIndices = function(h, d, b) {
+ d === void 0 && (d = null), b === void 0 && (b = !1), this._indexBuffer && this._engine._releaseBuffer(this._indexBuffer), this._disposeVertexArrayObjects(), this._indices = h, this._indexBufferIsUpdatable = b, this._meshes.length !== 0 && this._indices && (this._indexBuffer = this._engine.createIndexBuffer(this._indices, b)), d != null && (this._totalVertices = d);
+ for (var T = 0, N = this._meshes; T < N.length; T++)
+ N[T]._createGlobalSubMesh(!0);
+ this.notifyUpdate();
+ }, v.prototype.getTotalIndices = function() {
+ return this.isReady() ? this._indices.length : 0;
+ }, v.prototype.getIndices = function(h, d) {
+ if (!this.isReady())
+ return null;
+ var b = this._indices;
+ if (d || h && this._meshes.length !== 1) {
+ for (var T = b.length, N = [], U = 0; U < T; U++)
+ N.push(b[U]);
+ return N;
+ }
+ return b;
+ }, v.prototype.getIndexBuffer = function() {
+ return this.isReady() ? this._indexBuffer : null;
+ }, v.prototype._releaseVertexArrayObject = function(h) {
+ h === void 0 && (h = null), h && this._vertexArrayObjects && this._vertexArrayObjects[h.key] && (this._engine.releaseVertexArrayObject(this._vertexArrayObjects[h.key]), delete this._vertexArrayObjects[h.key]);
+ }, v.prototype.releaseForMesh = function(h, d) {
+ var b = this._meshes, T = b.indexOf(h);
+ T !== -1 && (b.splice(T, 1), h._geometry = null, b.length === 0 && d && this.dispose());
+ }, v.prototype.applyToMesh = function(h) {
+ if (h._geometry !== this) {
+ var d = h._geometry;
+ d && d.releaseForMesh(h);
+ var b = this._meshes;
+ h._geometry = this, this._scene.pushGeometry(this), b.push(h), this.isReady() ? this._applyToMesh(h) : h._boundingInfo = this._boundingInfo;
+ }
+ }, v.prototype._updateExtend = function(h) {
+ h === void 0 && (h = null), this.useBoundingInfoFromGeometry && this._boundingInfo ? this._extend = { minimum: this._boundingInfo.minimum.clone(), maximum: this._boundingInfo.maximum.clone() } : (h || (h = this.getVerticesData(c.b.PositionKind)), this._extend = Object(A.a)(h, 0, this._totalVertices, this.boundingBias, 3));
+ }, v.prototype._applyToMesh = function(h) {
+ var d = this._meshes.length;
+ for (var b in this._vertexBuffers) {
+ d === 1 && this._vertexBuffers[b].create();
+ var T = this._vertexBuffers[b].getBuffer();
+ T && (T.references = d), b === c.b.PositionKind && (this._extend || this._updateExtend(), h._boundingInfo = new R.a(this._extend.minimum, this._extend.maximum), h._createGlobalSubMesh(!1), h._updateBoundingInfo());
+ }
+ d === 1 && this._indices && this._indices.length > 0 && (this._indexBuffer = this._engine.createIndexBuffer(this._indices)), this._indexBuffer && (this._indexBuffer.references = d), h._syncGeometryWithMorphTargetManager(), h.synchronizeInstances();
+ }, v.prototype.notifyUpdate = function(h) {
+ this.onGeometryUpdated && this.onGeometryUpdated(this, h);
+ for (var d = 0, b = this._meshes; d < b.length; d++)
+ b[d]._markSubMeshesAsAttributesDirty();
+ }, v.prototype.load = function(h, d) {
+ this.delayLoadState !== g.a.DELAYLOADSTATE_LOADING && (this.isReady() ? d && d() : (this.delayLoadState = g.a.DELAYLOADSTATE_LOADING, this._queueLoad(h, d)));
+ }, v.prototype._queueLoad = function(h, d) {
+ var b = this;
+ this.delayLoadingFile && (h._addPendingData(this), h._loadFile(this.delayLoadingFile, function(T) {
+ if (b._delayLoadingFunction) {
+ b._delayLoadingFunction(JSON.parse(T), b), b.delayLoadState = g.a.DELAYLOADSTATE_LOADED, b._delayInfo = [], h._removePendingData(b);
+ for (var N = b._meshes, U = N.length, B = 0; B < U; B++)
+ b._applyToMesh(N[B]);
+ d && d();
+ }
+ }, void 0, !0));
+ }, v.prototype.toLeftHanded = function() {
+ var h = this.getIndices(!1);
+ if (h != null && h.length > 0) {
+ for (var d = 0; d < h.length; d += 3) {
+ var b = h[d + 0];
+ h[d + 0] = h[d + 2], h[d + 2] = b;
+ }
+ this.setIndices(h);
+ }
+ var T = this.getVerticesData(c.b.PositionKind, !1);
+ if (T != null && T.length > 0) {
+ for (d = 0; d < T.length; d += 3)
+ T[d + 2] = -T[d + 2];
+ this.setVerticesData(c.b.PositionKind, T, !1);
+ }
+ var N = this.getVerticesData(c.b.NormalKind, !1);
+ if (N != null && N.length > 0) {
+ for (d = 0; d < N.length; d += 3)
+ N[d + 2] = -N[d + 2];
+ this.setVerticesData(c.b.NormalKind, N, !1);
+ }
+ }, v.prototype._resetPointsArrayCache = function() {
+ this._positions = null;
+ }, v.prototype._generatePointsArray = function() {
+ if (this._positions)
+ return !0;
+ var h = this.getVerticesData(c.b.PositionKind);
+ if (!h || h.length === 0)
+ return !1;
+ for (var d = 3 * this._positionsCache.length, b = this._positionsCache.length; d < h.length; d += 3, ++b)
+ this._positionsCache[b] = D.e.FromArray(h, d);
+ for (d = 0, b = 0; d < h.length; d += 3, ++b)
+ this._positionsCache[b].set(h[0 + d], h[1 + d], h[2 + d]);
+ return this._positionsCache.length = h.length / 3, this._positions = this._positionsCache, !0;
+ }, v.prototype.isDisposed = function() {
+ return this._isDisposed;
+ }, v.prototype._disposeVertexArrayObjects = function() {
+ if (this._vertexArrayObjects) {
+ for (var h in this._vertexArrayObjects)
+ this._engine.releaseVertexArrayObject(this._vertexArrayObjects[h]);
+ this._vertexArrayObjects = {};
+ }
+ }, v.prototype.dispose = function() {
+ var h, d = this._meshes, b = d.length;
+ for (h = 0; h < b; h++)
+ this.releaseForMesh(d[h]);
+ for (var T in this._meshes = [], this._disposeVertexArrayObjects(), this._vertexBuffers)
+ this._vertexBuffers[T].dispose();
+ this._vertexBuffers = {}, this._totalVertices = 0, this._indexBuffer && this._engine._releaseBuffer(this._indexBuffer), this._indexBuffer = null, this._indices = [], this.delayLoadState = g.a.DELAYLOADSTATE_NONE, this.delayLoadingFile = null, this._delayLoadingFunction = null, this._delayInfo = [], this._boundingInfo = null, this._scene.removeGeometry(this), this._isDisposed = !0;
+ }, v.prototype.copy = function(h) {
+ var d = new P.a();
+ d.indices = [];
+ var b = this.getIndices();
+ if (b)
+ for (var T = 0; T < b.length; T++)
+ d.indices.push(b[T]);
+ var N, U = !1, B = !1;
+ for (N in this._vertexBuffers) {
+ var L = this.getVerticesData(N);
+ if (L && (L instanceof Float32Array ? d.set(new Float32Array(L), N) : d.set(L.slice(0), N), !B)) {
+ var j = this.getVertexBuffer(N);
+ j && (B = !(U = j.isUpdatable()));
+ }
+ }
+ var W = new v(h, this._scene, d, U);
+ for (N in W.delayLoadState = this.delayLoadState, W.delayLoadingFile = this.delayLoadingFile, W._delayLoadingFunction = this._delayLoadingFunction, this._delayInfo)
+ W._delayInfo = W._delayInfo || [], W._delayInfo.push(N);
+ return W._boundingInfo = new R.a(this._extend.minimum, this._extend.maximum), W;
+ }, v.prototype.serialize = function() {
+ var h = {};
+ return h.id = this.id, h.updatable = this._updatable, E.a && E.a.HasTags(this) && (h.tags = E.a.GetTags(this)), h;
+ }, v.prototype.toNumberArray = function(h) {
+ return Array.isArray(h) ? h : Array.prototype.slice.call(h);
+ }, v.prototype.serializeVerticeData = function() {
+ var h = this.serialize();
+ return this.isVerticesDataPresent(c.b.PositionKind) && (h.positions = this.toNumberArray(this.getVerticesData(c.b.PositionKind)), this.isVertexBufferUpdatable(c.b.PositionKind) && (h.positions._updatable = !0)), this.isVerticesDataPresent(c.b.NormalKind) && (h.normals = this.toNumberArray(this.getVerticesData(c.b.NormalKind)), this.isVertexBufferUpdatable(c.b.NormalKind) && (h.normals._updatable = !0)), this.isVerticesDataPresent(c.b.TangentKind) && (h.tangets = this.toNumberArray(this.getVerticesData(c.b.TangentKind)), this.isVertexBufferUpdatable(c.b.TangentKind) && (h.tangets._updatable = !0)), this.isVerticesDataPresent(c.b.UVKind) && (h.uvs = this.toNumberArray(this.getVerticesData(c.b.UVKind)), this.isVertexBufferUpdatable(c.b.UVKind) && (h.uvs._updatable = !0)), this.isVerticesDataPresent(c.b.UV2Kind) && (h.uv2s = this.toNumberArray(this.getVerticesData(c.b.UV2Kind)), this.isVertexBufferUpdatable(c.b.UV2Kind) && (h.uv2s._updatable = !0)), this.isVerticesDataPresent(c.b.UV3Kind) && (h.uv3s = this.toNumberArray(this.getVerticesData(c.b.UV3Kind)), this.isVertexBufferUpdatable(c.b.UV3Kind) && (h.uv3s._updatable = !0)), this.isVerticesDataPresent(c.b.UV4Kind) && (h.uv4s = this.toNumberArray(this.getVerticesData(c.b.UV4Kind)), this.isVertexBufferUpdatable(c.b.UV4Kind) && (h.uv4s._updatable = !0)), this.isVerticesDataPresent(c.b.UV5Kind) && (h.uv5s = this.toNumberArray(this.getVerticesData(c.b.UV5Kind)), this.isVertexBufferUpdatable(c.b.UV5Kind) && (h.uv5s._updatable = !0)), this.isVerticesDataPresent(c.b.UV6Kind) && (h.uv6s = this.toNumberArray(this.getVerticesData(c.b.UV6Kind)), this.isVertexBufferUpdatable(c.b.UV6Kind) && (h.uv6s._updatable = !0)), this.isVerticesDataPresent(c.b.ColorKind) && (h.colors = this.toNumberArray(this.getVerticesData(c.b.ColorKind)), this.isVertexBufferUpdatable(c.b.ColorKind) && (h.colors._updatable = !0)), this.isVerticesDataPresent(c.b.MatricesIndicesKind) && (h.matricesIndices = this.toNumberArray(this.getVerticesData(c.b.MatricesIndicesKind)), h.matricesIndices._isExpanded = !0, this.isVertexBufferUpdatable(c.b.MatricesIndicesKind) && (h.matricesIndices._updatable = !0)), this.isVerticesDataPresent(c.b.MatricesWeightsKind) && (h.matricesWeights = this.toNumberArray(this.getVerticesData(c.b.MatricesWeightsKind)), this.isVertexBufferUpdatable(c.b.MatricesWeightsKind) && (h.matricesWeights._updatable = !0)), h.indices = this.toNumberArray(this.getIndices()), h;
+ }, v.ExtractFromMesh = function(h, d) {
+ var b = h._geometry;
+ return b ? b.copy(d) : null;
+ }, v.RandomId = function() {
+ return u.b.RandomId();
+ }, v._ImportGeometry = function(h, d) {
+ var b = d.getScene(), T = h.geometryId;
+ if (T) {
+ var N = b.getGeometryByID(T);
+ N && N.applyToMesh(d);
+ } else if (h instanceof ArrayBuffer) {
+ var U = d._binaryInfo;
+ if (U.positionsAttrDesc && U.positionsAttrDesc.count > 0) {
+ var B = new Float32Array(h, U.positionsAttrDesc.offset, U.positionsAttrDesc.count);
+ d.setVerticesData(c.b.PositionKind, B, !1);
+ }
+ if (U.normalsAttrDesc && U.normalsAttrDesc.count > 0) {
+ var L = new Float32Array(h, U.normalsAttrDesc.offset, U.normalsAttrDesc.count);
+ d.setVerticesData(c.b.NormalKind, L, !1);
+ }
+ if (U.tangetsAttrDesc && U.tangetsAttrDesc.count > 0) {
+ var j = new Float32Array(h, U.tangetsAttrDesc.offset, U.tangetsAttrDesc.count);
+ d.setVerticesData(c.b.TangentKind, j, !1);
+ }
+ if (U.uvsAttrDesc && U.uvsAttrDesc.count > 0) {
+ var W = new Float32Array(h, U.uvsAttrDesc.offset, U.uvsAttrDesc.count);
+ d.setVerticesData(c.b.UVKind, W, !1);
+ }
+ if (U.uvs2AttrDesc && U.uvs2AttrDesc.count > 0) {
+ var Y = new Float32Array(h, U.uvs2AttrDesc.offset, U.uvs2AttrDesc.count);
+ d.setVerticesData(c.b.UV2Kind, Y, !1);
+ }
+ if (U.uvs3AttrDesc && U.uvs3AttrDesc.count > 0) {
+ var oe = new Float32Array(h, U.uvs3AttrDesc.offset, U.uvs3AttrDesc.count);
+ d.setVerticesData(c.b.UV3Kind, oe, !1);
+ }
+ if (U.uvs4AttrDesc && U.uvs4AttrDesc.count > 0) {
+ var te = new Float32Array(h, U.uvs4AttrDesc.offset, U.uvs4AttrDesc.count);
+ d.setVerticesData(c.b.UV4Kind, te, !1);
+ }
+ if (U.uvs5AttrDesc && U.uvs5AttrDesc.count > 0) {
+ var _e = new Float32Array(h, U.uvs5AttrDesc.offset, U.uvs5AttrDesc.count);
+ d.setVerticesData(c.b.UV5Kind, _e, !1);
+ }
+ if (U.uvs6AttrDesc && U.uvs6AttrDesc.count > 0) {
+ var de = new Float32Array(h, U.uvs6AttrDesc.offset, U.uvs6AttrDesc.count);
+ d.setVerticesData(c.b.UV6Kind, de, !1);
+ }
+ if (U.colorsAttrDesc && U.colorsAttrDesc.count > 0) {
+ var ae = new Float32Array(h, U.colorsAttrDesc.offset, U.colorsAttrDesc.count);
+ d.setVerticesData(c.b.ColorKind, ae, !1, U.colorsAttrDesc.stride);
+ }
+ if (U.matricesIndicesAttrDesc && U.matricesIndicesAttrDesc.count > 0) {
+ for (var ie = new Int32Array(h, U.matricesIndicesAttrDesc.offset, U.matricesIndicesAttrDesc.count), Z = [], ee = 0; ee < ie.length; ee++) {
+ var w = ie[ee];
+ Z.push(255 & w), Z.push((65280 & w) >> 8), Z.push((16711680 & w) >> 16), Z.push(w >> 24 & 255);
+ }
+ d.setVerticesData(c.b.MatricesIndicesKind, Z, !1);
+ }
+ if (U.matricesIndicesExtraAttrDesc && U.matricesIndicesExtraAttrDesc.count > 0) {
+ for (ie = new Int32Array(h, U.matricesIndicesExtraAttrDesc.offset, U.matricesIndicesExtraAttrDesc.count), Z = [], ee = 0; ee < ie.length; ee++)
+ w = ie[ee], Z.push(255 & w), Z.push((65280 & w) >> 8), Z.push((16711680 & w) >> 16), Z.push(w >> 24 & 255);
+ d.setVerticesData(c.b.MatricesIndicesExtraKind, Z, !1);
+ }
+ if (U.matricesWeightsAttrDesc && U.matricesWeightsAttrDesc.count > 0) {
+ var z = new Float32Array(h, U.matricesWeightsAttrDesc.offset, U.matricesWeightsAttrDesc.count);
+ d.setVerticesData(c.b.MatricesWeightsKind, z, !1);
+ }
+ if (U.indicesAttrDesc && U.indicesAttrDesc.count > 0) {
+ var q = new Int32Array(h, U.indicesAttrDesc.offset, U.indicesAttrDesc.count);
+ d.setIndices(q, null);
+ }
+ if (U.subMeshesAttrDesc && U.subMeshesAttrDesc.count > 0) {
+ var le = new Int32Array(h, U.subMeshesAttrDesc.offset, 5 * U.subMeshesAttrDesc.count);
+ for (d.subMeshes = [], ee = 0; ee < U.subMeshesAttrDesc.count; ee++) {
+ var ce = le[5 * ee + 0], J = le[5 * ee + 1], H = le[5 * ee + 2], X = le[5 * ee + 3], ne = le[5 * ee + 4];
+ C.a.AddToMesh(ce, J, H, X, ne, d);
+ }
+ }
+ } else if (h.positions && h.normals && h.indices) {
+ if (d.setVerticesData(c.b.PositionKind, h.positions, h.positions._updatable), d.setVerticesData(c.b.NormalKind, h.normals, h.normals._updatable), h.tangents && d.setVerticesData(c.b.TangentKind, h.tangents, h.tangents._updatable), h.uvs && d.setVerticesData(c.b.UVKind, h.uvs, h.uvs._updatable), h.uvs2 && d.setVerticesData(c.b.UV2Kind, h.uvs2, h.uvs2._updatable), h.uvs3 && d.setVerticesData(c.b.UV3Kind, h.uvs3, h.uvs3._updatable), h.uvs4 && d.setVerticesData(c.b.UV4Kind, h.uvs4, h.uvs4._updatable), h.uvs5 && d.setVerticesData(c.b.UV5Kind, h.uvs5, h.uvs5._updatable), h.uvs6 && d.setVerticesData(c.b.UV6Kind, h.uvs6, h.uvs6._updatable), h.colors && d.setVerticesData(c.b.ColorKind, f.b.CheckColors4(h.colors, h.positions.length / 3), h.colors._updatable), h.matricesIndices)
+ if (h.matricesIndices._isExpanded)
+ delete h.matricesIndices._isExpanded, d.setVerticesData(c.b.MatricesIndicesKind, h.matricesIndices, h.matricesIndices._updatable);
+ else {
+ for (Z = [], ee = 0; ee < h.matricesIndices.length; ee++) {
+ var Q = h.matricesIndices[ee];
+ Z.push(255 & Q), Z.push((65280 & Q) >> 8), Z.push((16711680 & Q) >> 16), Z.push(Q >> 24 & 255);
+ }
+ d.setVerticesData(c.b.MatricesIndicesKind, Z, h.matricesIndices._updatable);
+ }
+ if (h.matricesIndicesExtra)
+ if (h.matricesIndicesExtra._isExpanded)
+ delete h.matricesIndices._isExpanded, d.setVerticesData(c.b.MatricesIndicesExtraKind, h.matricesIndicesExtra, h.matricesIndicesExtra._updatable);
+ else {
+ for (Z = [], ee = 0; ee < h.matricesIndicesExtra.length; ee++)
+ Q = h.matricesIndicesExtra[ee], Z.push(255 & Q), Z.push((65280 & Q) >> 8), Z.push((16711680 & Q) >> 16), Z.push(Q >> 24 & 255);
+ d.setVerticesData(c.b.MatricesIndicesExtraKind, Z, h.matricesIndicesExtra._updatable);
+ }
+ h.matricesWeights && (v._CleanMatricesWeights(h, d), d.setVerticesData(c.b.MatricesWeightsKind, h.matricesWeights, h.matricesWeights._updatable)), h.matricesWeightsExtra && d.setVerticesData(c.b.MatricesWeightsExtraKind, h.matricesWeightsExtra, h.matricesWeights._updatable), d.setIndices(h.indices, null);
+ }
+ if (h.subMeshes) {
+ d.subMeshes = [];
+ for (var $ = 0; $ < h.subMeshes.length; $++) {
+ var me = h.subMeshes[$];
+ C.a.AddToMesh(me.materialIndex, me.verticesStart, me.verticesCount, me.indexStart, me.indexCount, d);
+ }
+ }
+ d._shouldGenerateFlatShading && (d.convertToFlatShadedMesh(), d._shouldGenerateFlatShading = !1), d.computeWorldMatrix(!0), b.onMeshImportedObservable.notifyObservers(d);
+ }, v._CleanMatricesWeights = function(h, d) {
+ if (x.a.CleanBoneMatrixWeights) {
+ var b = 0;
+ if (h.skeletonId > -1) {
+ var T = d.getScene().getLastSkeletonByID(h.skeletonId);
+ if (T) {
+ b = T.bones.length;
+ for (var N = d.getVerticesData(c.b.MatricesIndicesKind), U = d.getVerticesData(c.b.MatricesIndicesExtraKind), B = h.matricesWeights, L = h.matricesWeightsExtra, j = h.numBoneInfluencer, W = B.length, Y = 0; Y < W; Y += 4) {
+ for (var oe = 0, te = -1, _e = 0; _e < 4; _e++)
+ oe += de = B[Y + _e], de < 1e-3 && te < 0 && (te = _e);
+ if (L)
+ for (_e = 0; _e < 4; _e++) {
+ var de;
+ oe += de = L[Y + _e], de < 1e-3 && te < 0 && (te = _e + 4);
+ }
+ if ((te < 0 || te > j - 1) && (te = j - 1), oe > 1e-3) {
+ var ae = 1 / oe;
+ for (_e = 0; _e < 4; _e++)
+ B[Y + _e] *= ae;
+ if (L)
+ for (_e = 0; _e < 4; _e++)
+ L[Y + _e] *= ae;
+ } else
+ te >= 4 ? (L[Y + te - 4] = 1 - oe, U[Y + te - 4] = b) : (B[Y + te] = 1 - oe, N[Y + te] = b);
+ }
+ d.setVerticesData(c.b.MatricesIndicesKind, N), h.matricesWeightsExtra && d.setVerticesData(c.b.MatricesIndicesExtraKind, U);
+ }
+ }
+ }
+ }, v.Parse = function(h, d, b) {
+ if (d.getGeometryByID(h.id))
+ return null;
+ var T = new v(h.id, d, void 0, h.updatable);
+ return E.a && E.a.AddTagsTo(T, h.tags), h.delayLoadingFile ? (T.delayLoadState = g.a.DELAYLOADSTATE_NOTLOADED, T.delayLoadingFile = b + h.delayLoadingFile, T._boundingInfo = new R.a(D.e.FromArray(h.boundingBoxMinimum), D.e.FromArray(h.boundingBoxMaximum)), T._delayInfo = [], h.hasUVs && T._delayInfo.push(c.b.UVKind), h.hasUVs2 && T._delayInfo.push(c.b.UV2Kind), h.hasUVs3 && T._delayInfo.push(c.b.UV3Kind), h.hasUVs4 && T._delayInfo.push(c.b.UV4Kind), h.hasUVs5 && T._delayInfo.push(c.b.UV5Kind), h.hasUVs6 && T._delayInfo.push(c.b.UV6Kind), h.hasColors && T._delayInfo.push(c.b.ColorKind), h.hasMatricesIndices && T._delayInfo.push(c.b.MatricesIndicesKind), h.hasMatricesWeights && T._delayInfo.push(c.b.MatricesWeightsKind), T._delayLoadingFunction = P.a.ImportVertexData) : P.a.ImportVertexData(h, T), d.pushGeometry(T, !0), T;
+ }, v;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "e", function() {
+ return D;
+ }), l.d(_, "c", function() {
+ return C;
+ }), l.d(_, "a", function() {
+ return x;
+ }), l.d(_, "b", function() {
+ return R;
+ }), l.d(_, "f", function() {
+ return g;
+ }), l.d(_, "g", function() {
+ return u;
+ }), l.d(_, "d", function() {
+ return E;
+ });
+ var D, f = l(14), P = l(0), c = l(28);
+ (function(A) {
+ A[A.CW = 0] = "CW", A[A.CCW = 1] = "CCW";
+ })(D || (D = {}));
+ var C = function() {
+ function A() {
+ }
+ return A.Interpolate = function(y, v, h, d, b) {
+ for (var T = 1 - 3 * d + 3 * v, N = 3 * d - 6 * v, U = 3 * v, B = y, L = 0; L < 5; L++) {
+ var j = B * B;
+ B -= (T * (j * B) + N * j + U * B - y) * (1 / (3 * T * j + 2 * N * B + U)), B = Math.min(1, Math.max(0, B));
+ }
+ return 3 * Math.pow(1 - B, 2) * B * h + 3 * (1 - B) * Math.pow(B, 2) * b + Math.pow(B, 3);
+ }, A;
+ }(), x = function() {
+ function A(y) {
+ this._radians = y, this._radians < 0 && (this._radians += 2 * Math.PI);
+ }
+ return A.prototype.degrees = function() {
+ return 180 * this._radians / Math.PI;
+ }, A.prototype.radians = function() {
+ return this._radians;
+ }, A.BetweenTwoPoints = function(y, v) {
+ var h = v.subtract(y);
+ return new A(Math.atan2(h.y, h.x));
+ }, A.FromRadians = function(y) {
+ return new A(y);
+ }, A.FromDegrees = function(y) {
+ return new A(y * Math.PI / 180);
+ }, A;
+ }(), R = function(A, y, v) {
+ this.startPoint = A, this.midPoint = y, this.endPoint = v;
+ var h = Math.pow(y.x, 2) + Math.pow(y.y, 2), d = (Math.pow(A.x, 2) + Math.pow(A.y, 2) - h) / 2, b = (h - Math.pow(v.x, 2) - Math.pow(v.y, 2)) / 2, T = (A.x - y.x) * (y.y - v.y) - (y.x - v.x) * (A.y - y.y);
+ this.centerPoint = new P.d((d * (y.y - v.y) - b * (A.y - y.y)) / T, ((A.x - y.x) * b - (y.x - v.x) * d) / T), this.radius = this.centerPoint.subtract(this.startPoint).length(), this.startAngle = x.BetweenTwoPoints(this.centerPoint, this.startPoint);
+ var N = this.startAngle.degrees(), U = x.BetweenTwoPoints(this.centerPoint, this.midPoint).degrees(), B = x.BetweenTwoPoints(this.centerPoint, this.endPoint).degrees();
+ U - N > 180 && (U -= 360), U - N < -180 && (U += 360), B - U > 180 && (B -= 360), B - U < -180 && (B += 360), this.orientation = U - N < 0 ? D.CW : D.CCW, this.angle = x.FromDegrees(this.orientation === D.CW ? N - B : B - N);
+ }, g = function() {
+ function A(y, v) {
+ this._points = new Array(), this._length = 0, this.closed = !1, this._points.push(new P.d(y, v));
+ }
+ return A.prototype.addLineTo = function(y, v) {
+ if (this.closed)
+ return this;
+ var h = new P.d(y, v), d = this._points[this._points.length - 1];
+ return this._points.push(h), this._length += h.subtract(d).length(), this;
+ }, A.prototype.addArcTo = function(y, v, h, d, b) {
+ if (b === void 0 && (b = 36), this.closed)
+ return this;
+ var T = this._points[this._points.length - 1], N = new P.d(y, v), U = new P.d(h, d), B = new R(T, N, U), L = B.angle.radians() / b;
+ B.orientation === D.CW && (L *= -1);
+ for (var j = B.startAngle.radians() + L, W = 0; W < b; W++) {
+ var Y = Math.cos(j) * B.radius + B.centerPoint.x, oe = Math.sin(j) * B.radius + B.centerPoint.y;
+ this.addLineTo(Y, oe), j += L;
+ }
+ return this;
+ }, A.prototype.close = function() {
+ return this.closed = !0, this;
+ }, A.prototype.length = function() {
+ var y = this._length;
+ if (this.closed) {
+ var v = this._points[this._points.length - 1];
+ y += this._points[0].subtract(v).length();
+ }
+ return y;
+ }, A.prototype.getPoints = function() {
+ return this._points;
+ }, A.prototype.getPointAtLengthPosition = function(y) {
+ if (y < 0 || y > 1)
+ return P.d.Zero();
+ for (var v = y * this.length(), h = 0, d = 0; d < this._points.length; d++) {
+ var b = (d + 1) % this._points.length, T = this._points[d], N = this._points[b].subtract(T), U = N.length() + h;
+ if (v >= h && v <= U) {
+ var B = N.normalize(), L = v - h;
+ return new P.d(T.x + B.x * L, T.y + B.y * L);
+ }
+ h = U;
+ }
+ return P.d.Zero();
+ }, A.StartingAt = function(y, v) {
+ return new A(y, v);
+ }, A;
+ }(), u = function() {
+ function A(y, v, h, d) {
+ v === void 0 && (v = null), d === void 0 && (d = !1), this.path = y, this._curve = new Array(), this._distances = new Array(), this._tangents = new Array(), this._normals = new Array(), this._binormals = new Array(), this._pointAtData = { id: 0, point: P.e.Zero(), previousPointArrayIndex: 0, position: 0, subPosition: 0, interpolateReady: !1, interpolationMatrix: P.a.Identity() };
+ for (var b = 0; b < y.length; b++)
+ this._curve[b] = y[b].clone();
+ this._raw = h || !1, this._alignTangentsWithPath = d, this._compute(v, d);
+ }
+ return A.prototype.getCurve = function() {
+ return this._curve;
+ }, A.prototype.getPoints = function() {
+ return this._curve;
+ }, A.prototype.length = function() {
+ return this._distances[this._distances.length - 1];
+ }, A.prototype.getTangents = function() {
+ return this._tangents;
+ }, A.prototype.getNormals = function() {
+ return this._normals;
+ }, A.prototype.getBinormals = function() {
+ return this._binormals;
+ }, A.prototype.getDistances = function() {
+ return this._distances;
+ }, A.prototype.getPointAt = function(y) {
+ return this._updatePointAtData(y).point;
+ }, A.prototype.getTangentAt = function(y, v) {
+ return v === void 0 && (v = !1), this._updatePointAtData(y, v), v ? P.e.TransformCoordinates(P.e.Forward(), this._pointAtData.interpolationMatrix) : this._tangents[this._pointAtData.previousPointArrayIndex];
+ }, A.prototype.getNormalAt = function(y, v) {
+ return v === void 0 && (v = !1), this._updatePointAtData(y, v), v ? P.e.TransformCoordinates(P.e.Right(), this._pointAtData.interpolationMatrix) : this._normals[this._pointAtData.previousPointArrayIndex];
+ }, A.prototype.getBinormalAt = function(y, v) {
+ return v === void 0 && (v = !1), this._updatePointAtData(y, v), v ? P.e.TransformCoordinates(P.e.UpReadOnly, this._pointAtData.interpolationMatrix) : this._binormals[this._pointAtData.previousPointArrayIndex];
+ }, A.prototype.getDistanceAt = function(y) {
+ return this.length() * y;
+ }, A.prototype.getPreviousPointIndexAt = function(y) {
+ return this._updatePointAtData(y), this._pointAtData.previousPointArrayIndex;
+ }, A.prototype.getSubPositionAt = function(y) {
+ return this._updatePointAtData(y), this._pointAtData.subPosition;
+ }, A.prototype.getClosestPositionTo = function(y) {
+ for (var v = Number.MAX_VALUE, h = 0, d = 0; d < this._curve.length - 1; d++) {
+ var b = this._curve[d + 0], T = this._curve[d + 1].subtract(b).normalize(), N = this._distances[d + 1] - this._distances[d + 0], U = Math.min(Math.max(P.e.Dot(T, y.subtract(b).normalize()), 0) * P.e.Distance(b, y) / N, 1), B = P.e.Distance(b.add(T.scale(U * N)), y);
+ B < v && (v = B, h = (this._distances[d + 0] + N * U) / this.length());
+ }
+ return h;
+ }, A.prototype.slice = function(y, v) {
+ if (y === void 0 && (y = 0), v === void 0 && (v = 1), y < 0 && (y = 1 - -1 * y % 1), v < 0 && (v = 1 - -1 * v % 1), y > v) {
+ var h = y;
+ y = v, v = h;
+ }
+ var d = this.getCurve(), b = this.getPointAt(y), T = this.getPreviousPointIndexAt(y), N = this.getPointAt(v), U = this.getPreviousPointIndexAt(v) + 1, B = [];
+ return y !== 0 && (T++, B.push(b)), B.push.apply(B, d.slice(T, U)), v === 1 && y !== 1 || B.push(N), new A(B, this.getNormalAt(y), this._raw, this._alignTangentsWithPath);
+ }, A.prototype.update = function(y, v, h) {
+ v === void 0 && (v = null), h === void 0 && (h = !1);
+ for (var d = 0; d < y.length; d++)
+ this._curve[d].x = y[d].x, this._curve[d].y = y[d].y, this._curve[d].z = y[d].z;
+ return this._compute(v, h), this;
+ }, A.prototype._compute = function(y, v) {
+ v === void 0 && (v = !1);
+ var h = this._curve.length;
+ if (!(h < 2)) {
+ this._tangents[0] = this._getFirstNonNullVector(0), this._raw || this._tangents[0].normalize(), this._tangents[h - 1] = this._curve[h - 1].subtract(this._curve[h - 2]), this._raw || this._tangents[h - 1].normalize();
+ var d, b, T, N, U, B = this._tangents[0], L = this._normalVector(B, y);
+ this._normals[0] = L, this._raw || this._normals[0].normalize(), this._binormals[0] = P.e.Cross(B, this._normals[0]), this._raw || this._binormals[0].normalize(), this._distances[0] = 0;
+ for (var j = 1; j < h; j++)
+ d = this._getLastNonNullVector(j), j < h - 1 && (b = this._getFirstNonNullVector(j), this._tangents[j] = v ? b : d.add(b), this._tangents[j].normalize()), this._distances[j] = this._distances[j - 1] + this._curve[j].subtract(this._curve[j - 1]).length(), T = this._tangents[j], U = this._binormals[j - 1], this._normals[j] = P.e.Cross(U, T), this._raw || (this._normals[j].length() === 0 ? (N = this._normals[j - 1], this._normals[j] = N.clone()) : this._normals[j].normalize()), this._binormals[j] = P.e.Cross(T, this._normals[j]), this._raw || this._binormals[j].normalize();
+ this._pointAtData.id = NaN;
+ }
+ }, A.prototype._getFirstNonNullVector = function(y) {
+ for (var v = 1, h = this._curve[y + v].subtract(this._curve[y]); h.length() === 0 && y + v + 1 < this._curve.length; )
+ v++, h = this._curve[y + v].subtract(this._curve[y]);
+ return h;
+ }, A.prototype._getLastNonNullVector = function(y) {
+ for (var v = 1, h = this._curve[y].subtract(this._curve[y - v]); h.length() === 0 && y > v + 1; )
+ v++, h = this._curve[y].subtract(this._curve[y - v]);
+ return h;
+ }, A.prototype._normalVector = function(y, v) {
+ var h, d, b = y.length();
+ return b === 0 && (b = 1), v == null ? (d = f.a.WithinEpsilon(Math.abs(y.y) / b, 1, c.a) ? f.a.WithinEpsilon(Math.abs(y.x) / b, 1, c.a) ? f.a.WithinEpsilon(Math.abs(y.z) / b, 1, c.a) ? P.e.Zero() : new P.e(0, 0, 1) : new P.e(1, 0, 0) : new P.e(0, -1, 0), h = P.e.Cross(y, d)) : (h = P.e.Cross(y, v), P.e.CrossToRef(h, y, h)), h.normalize(), h;
+ }, A.prototype._updatePointAtData = function(y, v) {
+ if (v === void 0 && (v = !1), this._pointAtData.id === y)
+ return this._pointAtData.interpolateReady || this._updateInterpolationMatrix(), this._pointAtData;
+ this._pointAtData.id = y;
+ var h = this.getPoints();
+ if (y <= 0)
+ return this._setPointAtData(0, 0, h[0], 0, v);
+ if (y >= 1)
+ return this._setPointAtData(1, 1, h[h.length - 1], h.length - 1, v);
+ for (var d, b = h[0], T = 0, N = y * this.length(), U = 1; U < h.length; U++) {
+ d = h[U];
+ var B = P.e.Distance(b, d);
+ if ((T += B) === N)
+ return this._setPointAtData(y, 1, d, U, v);
+ if (T > N) {
+ var L = (T - N) / B, j = b.subtract(d), W = d.add(j.scaleInPlace(L));
+ return this._setPointAtData(y, 1 - L, W, U - 1, v);
+ }
+ b = d;
+ }
+ return this._pointAtData;
+ }, A.prototype._setPointAtData = function(y, v, h, d, b) {
+ return this._pointAtData.point = h, this._pointAtData.position = y, this._pointAtData.subPosition = v, this._pointAtData.previousPointArrayIndex = d, this._pointAtData.interpolateReady = b, b && this._updateInterpolationMatrix(), this._pointAtData;
+ }, A.prototype._updateInterpolationMatrix = function() {
+ this._pointAtData.interpolationMatrix = P.a.Identity();
+ var y = this._pointAtData.previousPointArrayIndex;
+ if (y !== this._tangents.length - 1) {
+ var v = y + 1, h = this._tangents[y].clone(), d = this._normals[y].clone(), b = this._binormals[y].clone(), T = this._tangents[v].clone(), N = this._normals[v].clone(), U = this._binormals[v].clone(), B = P.b.RotationQuaternionFromAxis(d, b, h), L = P.b.RotationQuaternionFromAxis(N, U, T);
+ P.b.Slerp(B, L, this._pointAtData.subPosition).toRotationMatrix(this._pointAtData.interpolationMatrix);
+ }
+ }, A;
+ }(), E = function() {
+ function A(y) {
+ this._length = 0, this._points = y, this._length = this._computeLength(y);
+ }
+ return A.CreateQuadraticBezier = function(y, v, h, d) {
+ d = d > 2 ? d : 3;
+ for (var b = new Array(), T = function(U, B, L, j) {
+ return (1 - U) * (1 - U) * B + 2 * U * (1 - U) * L + U * U * j;
+ }, N = 0; N <= d; N++)
+ b.push(new P.e(T(N / d, y.x, v.x, h.x), T(N / d, y.y, v.y, h.y), T(N / d, y.z, v.z, h.z)));
+ return new A(b);
+ }, A.CreateCubicBezier = function(y, v, h, d, b) {
+ b = b > 3 ? b : 4;
+ for (var T = new Array(), N = function(B, L, j, W, Y) {
+ return (1 - B) * (1 - B) * (1 - B) * L + 3 * B * (1 - B) * (1 - B) * j + 3 * B * B * (1 - B) * W + B * B * B * Y;
+ }, U = 0; U <= b; U++)
+ T.push(new P.e(N(U / b, y.x, v.x, h.x, d.x), N(U / b, y.y, v.y, h.y, d.y), N(U / b, y.z, v.z, h.z, d.z)));
+ return new A(T);
+ }, A.CreateHermiteSpline = function(y, v, h, d, b) {
+ for (var T = new Array(), N = 1 / b, U = 0; U <= b; U++)
+ T.push(P.e.Hermite(y, v, h, d, U * N));
+ return new A(T);
+ }, A.CreateCatmullRomSpline = function(y, v, h) {
+ var d = new Array(), b = 1 / v, T = 0;
+ if (h) {
+ for (var N = y.length, U = 0; U < N; U++) {
+ T = 0;
+ for (var B = 0; B < v; B++)
+ d.push(P.e.CatmullRom(y[U % N], y[(U + 1) % N], y[(U + 2) % N], y[(U + 3) % N], T)), T += b;
+ }
+ d.push(d[0]);
+ } else {
+ var L = new Array();
+ for (L.push(y[0].clone()), Array.prototype.push.apply(L, y), L.push(y[y.length - 1].clone()), U = 0; U < L.length - 3; U++)
+ for (T = 0, B = 0; B < v; B++)
+ d.push(P.e.CatmullRom(L[U], L[U + 1], L[U + 2], L[U + 3], T)), T += b;
+ U--, d.push(P.e.CatmullRom(L[U], L[U + 1], L[U + 2], L[U + 3], T));
+ }
+ return new A(d);
+ }, A.prototype.getPoints = function() {
+ return this._points;
+ }, A.prototype.length = function() {
+ return this._length;
+ }, A.prototype.continue = function(y) {
+ for (var v = this._points[this._points.length - 1], h = this._points.slice(), d = y.getPoints(), b = 1; b < d.length; b++)
+ h.push(d[b].subtract(d[0]).add(v));
+ return new A(h);
+ }, A.prototype._computeLength = function(y) {
+ for (var v = 0, h = 1; h < y.length; h++)
+ v += y[h].subtract(y[h - 1]).length();
+ return v;
+ }, A;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return h;
+ });
+ var D = l(1), f = l(3), P = l(0), c = l(4), C = l(10), x = l(15), R = l(25), g = l(11), u = l(9), E = l(67), A = l(49), y = l(13), v = { effect: null, subMesh: null }, h = function(d) {
+ function b(T, N, U, B) {
+ B === void 0 && (B = {});
+ var L = d.call(this, T, N) || this;
+ return L._textures = {}, L._textureArrays = {}, L._floats = {}, L._ints = {}, L._floatsArrays = {}, L._colors3 = {}, L._colors3Arrays = {}, L._colors4 = {}, L._colors4Arrays = {}, L._vectors2 = {}, L._vectors3 = {}, L._vectors4 = {}, L._matrices = {}, L._matrixArrays = {}, L._matrices3x3 = {}, L._matrices2x2 = {}, L._vectors2Arrays = {}, L._vectors3Arrays = {}, L._vectors4Arrays = {}, L._cachedWorldViewMatrix = new P.a(), L._cachedWorldViewProjectionMatrix = new P.a(), L._multiview = !1, L._shaderPath = U, L._options = Object(D.a)({ needAlphaBlending: !1, needAlphaTesting: !1, attributes: ["position", "normal", "uv"], uniforms: ["worldViewProjection"], uniformBuffers: [], samplers: [], defines: [] }, B), L;
+ }
+ return Object(D.d)(b, d), Object.defineProperty(b.prototype, "shaderPath", { get: function() {
+ return this._shaderPath;
+ }, set: function(T) {
+ this._shaderPath = T;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(b.prototype, "options", { get: function() {
+ return this._options;
+ }, enumerable: !1, configurable: !0 }), b.prototype.getClassName = function() {
+ return "ShaderMaterial";
+ }, b.prototype.needAlphaBlending = function() {
+ return this.alpha < 1 || this._options.needAlphaBlending;
+ }, b.prototype.needAlphaTesting = function() {
+ return this._options.needAlphaTesting;
+ }, b.prototype._checkUniform = function(T) {
+ this._options.uniforms.indexOf(T) === -1 && this._options.uniforms.push(T);
+ }, b.prototype.setTexture = function(T, N) {
+ return this._options.samplers.indexOf(T) === -1 && this._options.samplers.push(T), this._textures[T] = N, this;
+ }, b.prototype.setTextureArray = function(T, N) {
+ return this._options.samplers.indexOf(T) === -1 && this._options.samplers.push(T), this._checkUniform(T), this._textureArrays[T] = N, this;
+ }, b.prototype.setFloat = function(T, N) {
+ return this._checkUniform(T), this._floats[T] = N, this;
+ }, b.prototype.setInt = function(T, N) {
+ return this._checkUniform(T), this._ints[T] = N, this;
+ }, b.prototype.setFloats = function(T, N) {
+ return this._checkUniform(T), this._floatsArrays[T] = N, this;
+ }, b.prototype.setColor3 = function(T, N) {
+ return this._checkUniform(T), this._colors3[T] = N, this;
+ }, b.prototype.setColor3Array = function(T, N) {
+ return this._checkUniform(T), this._colors3Arrays[T] = N.reduce(function(U, B) {
+ return B.toArray(U, U.length), U;
+ }, []), this;
+ }, b.prototype.setColor4 = function(T, N) {
+ return this._checkUniform(T), this._colors4[T] = N, this;
+ }, b.prototype.setColor4Array = function(T, N) {
+ return this._checkUniform(T), this._colors4Arrays[T] = N.reduce(function(U, B) {
+ return B.toArray(U, U.length), U;
+ }, []), this;
+ }, b.prototype.setVector2 = function(T, N) {
+ return this._checkUniform(T), this._vectors2[T] = N, this;
+ }, b.prototype.setVector3 = function(T, N) {
+ return this._checkUniform(T), this._vectors3[T] = N, this;
+ }, b.prototype.setVector4 = function(T, N) {
+ return this._checkUniform(T), this._vectors4[T] = N, this;
+ }, b.prototype.setMatrix = function(T, N) {
+ return this._checkUniform(T), this._matrices[T] = N, this;
+ }, b.prototype.setMatrices = function(T, N) {
+ this._checkUniform(T);
+ for (var U = new Float32Array(16 * N.length), B = 0; B < N.length; B++)
+ N[B].copyToArray(U, 16 * B);
+ return this._matrixArrays[T] = U, this;
+ }, b.prototype.setMatrix3x3 = function(T, N) {
+ return this._checkUniform(T), this._matrices3x3[T] = N, this;
+ }, b.prototype.setMatrix2x2 = function(T, N) {
+ return this._checkUniform(T), this._matrices2x2[T] = N, this;
+ }, b.prototype.setArray2 = function(T, N) {
+ return this._checkUniform(T), this._vectors2Arrays[T] = N, this;
+ }, b.prototype.setArray3 = function(T, N) {
+ return this._checkUniform(T), this._vectors3Arrays[T] = N, this;
+ }, b.prototype.setArray4 = function(T, N) {
+ return this._checkUniform(T), this._vectors4Arrays[T] = N, this;
+ }, b.prototype._checkCache = function(T, N) {
+ return !T || !this._effect || this._effect.defines.indexOf("#define INSTANCES") !== -1 === N;
+ }, b.prototype.isReadyForSubMesh = function(T, N, U) {
+ return this.isReady(T, U);
+ }, b.prototype.isReady = function(T, N) {
+ var U, B;
+ if (this._effect && this.isFrozen && this._effect._wasPreviouslyReady)
+ return !0;
+ var L = this.getScene(), j = L.getEngine();
+ if (!this.checkReadyOnEveryCall && this._renderId === L.getRenderId() && this._checkCache(T, N))
+ return !0;
+ var W = [], Y = [], oe = new E.a();
+ j.getCaps().multiview && L.activeCamera && L.activeCamera.outputRenderTarget && L.activeCamera.outputRenderTarget.getViewCount() > 1 && (this._multiview = !0, W.push("#define MULTIVIEW"), this._options.uniforms.indexOf("viewProjection") !== -1 && this._options.uniforms.push("viewProjectionR") === -1 && this._options.uniforms.push("viewProjectionR"));
+ for (var te = 0; te < this._options.defines.length; te++)
+ W.push(this._options.defines[te]);
+ for (te = 0; te < this._options.attributes.length; te++)
+ Y.push(this._options.attributes[te]);
+ T && T.isVerticesDataPresent(c.b.ColorKind) && (Y.push(c.b.ColorKind), W.push("#define VERTEXCOLOR")), N && (W.push("#define INSTANCES"), x.a.PushAttributesForInstances(Y), T != null && T.hasThinInstances && W.push("#define THIN_INSTANCES"));
+ var _e = 0;
+ if (T && T.useBones && T.computeBonesUsingShaders && T.skeleton) {
+ Y.push(c.b.MatricesIndicesKind), Y.push(c.b.MatricesWeightsKind), T.numBoneInfluencers > 4 && (Y.push(c.b.MatricesIndicesExtraKind), Y.push(c.b.MatricesWeightsExtraKind));
+ var de = T.skeleton;
+ _e = T.numBoneInfluencers, W.push("#define NUM_BONE_INFLUENCERS " + _e), oe.addCPUSkinningFallback(0, T), de.isUsingTextureForMatrices ? (W.push("#define BONETEXTURE"), this._options.uniforms.indexOf("boneTextureWidth") === -1 && this._options.uniforms.push("boneTextureWidth"), this._options.samplers.indexOf("boneSampler") === -1 && this._options.samplers.push("boneSampler")) : (W.push("#define BonesPerMesh " + (de.bones.length + 1)), this._options.uniforms.indexOf("mBones") === -1 && this._options.uniforms.push("mBones"));
+ } else
+ W.push("#define NUM_BONE_INFLUENCERS 0");
+ for (var ae in this._textures)
+ if (!this._textures[ae].isReady())
+ return !1;
+ T && this._shouldTurnAlphaTestOn(T) && W.push("#define ALPHATEST");
+ var ie = this._shaderPath, Z = this._options.uniforms, ee = this._options.uniformBuffers, w = this._options.samplers;
+ this.customShaderNameResolve && (Z = Z.slice(), ee = ee.slice(), w = w.slice(), ie = this.customShaderNameResolve(ie, Z, ee, w, W, Y));
+ var z = this._effect, q = W.join(`
+`);
+ return this._cachedDefines !== q && (this._cachedDefines = q, this._effect = j.createEffect(ie, { attributes: Y, uniformsNames: Z, uniformBuffersNames: ee, samplers: w, defines: q, fallbacks: oe, onCompiled: this.onCompiled, onError: this.onError, indexParameters: { maxSimultaneousMorphTargets: _e } }, j), this._onEffectCreatedObservable && (v.effect = this._effect, this._onEffectCreatedObservable.notifyObservers(v))), (B = !(!((U = this._effect) === null || U === void 0) && U.isReady())) !== null && B !== void 0 && !B && (z !== this._effect && L.resetCachedMaterial(), this._renderId = L.getRenderId(), this._effect._wasPreviouslyReady = !0, !0);
+ }, b.prototype.bindOnlyWorldMatrix = function(T, N) {
+ var U = this.getScene(), B = N ?? this._effect;
+ B && (this._options.uniforms.indexOf("world") !== -1 && B.setMatrix("world", T), this._options.uniforms.indexOf("worldView") !== -1 && (T.multiplyToRef(U.getViewMatrix(), this._cachedWorldViewMatrix), B.setMatrix("worldView", this._cachedWorldViewMatrix)), this._options.uniforms.indexOf("worldViewProjection") !== -1 && (T.multiplyToRef(U.getTransformMatrix(), this._cachedWorldViewProjectionMatrix), B.setMatrix("worldViewProjection", this._cachedWorldViewProjectionMatrix)));
+ }, b.prototype.bindForSubMesh = function(T, N, U) {
+ this.bind(T, N, U._effectOverride);
+ }, b.prototype.bind = function(T, N, U) {
+ this.bindOnlyWorldMatrix(T, U);
+ var B = U ?? this._effect;
+ if (B && this.getScene().getCachedMaterial() !== this) {
+ var L;
+ for (L in this._options.uniforms.indexOf("view") !== -1 && B.setMatrix("view", this.getScene().getViewMatrix()), this._options.uniforms.indexOf("projection") !== -1 && B.setMatrix("projection", this.getScene().getProjectionMatrix()), this._options.uniforms.indexOf("viewProjection") !== -1 && (B.setMatrix("viewProjection", this.getScene().getTransformMatrix()), this._multiview && B.setMatrix("viewProjectionR", this.getScene()._transformMatrixR)), this.getScene().activeCamera && this._options.uniforms.indexOf("cameraPosition") !== -1 && B.setVector3("cameraPosition", this.getScene().activeCamera.globalPosition), x.a.BindBonesParameters(N, B), this._textures)
+ B.setTexture(L, this._textures[L]);
+ for (L in this._textureArrays)
+ B.setTextureArray(L, this._textureArrays[L]);
+ for (L in this._ints)
+ B.setInt(L, this._ints[L]);
+ for (L in this._floats)
+ B.setFloat(L, this._floats[L]);
+ for (L in this._floatsArrays)
+ B.setArray(L, this._floatsArrays[L]);
+ for (L in this._colors3)
+ B.setColor3(L, this._colors3[L]);
+ for (L in this._colors3Arrays)
+ B.setArray3(L, this._colors3Arrays[L]);
+ for (L in this._colors4) {
+ var j = this._colors4[L];
+ B.setFloat4(L, j.r, j.g, j.b, j.a);
+ }
+ for (L in this._colors4Arrays)
+ B.setArray4(L, this._colors4Arrays[L]);
+ for (L in this._vectors2)
+ B.setVector2(L, this._vectors2[L]);
+ for (L in this._vectors3)
+ B.setVector3(L, this._vectors3[L]);
+ for (L in this._vectors4)
+ B.setVector4(L, this._vectors4[L]);
+ for (L in this._matrices)
+ B.setMatrix(L, this._matrices[L]);
+ for (L in this._matrixArrays)
+ B.setMatrices(L, this._matrixArrays[L]);
+ for (L in this._matrices3x3)
+ B.setMatrix3x3(L, this._matrices3x3[L]);
+ for (L in this._matrices2x2)
+ B.setMatrix2x2(L, this._matrices2x2[L]);
+ for (L in this._vectors2Arrays)
+ B.setArray2(L, this._vectors2Arrays[L]);
+ for (L in this._vectors3Arrays)
+ B.setArray3(L, this._vectors3Arrays[L]);
+ for (L in this._vectors4Arrays)
+ B.setArray4(L, this._vectors4Arrays[L]);
+ }
+ var W = this._effect;
+ this._effect = B, this._afterBind(N), this._effect = W;
+ }, b.prototype._afterBind = function(T) {
+ d.prototype._afterBind.call(this, T), this.getScene()._cachedEffect = this._effect;
+ }, b.prototype.getActiveTextures = function() {
+ var T = d.prototype.getActiveTextures.call(this);
+ for (var N in this._textures)
+ T.push(this._textures[N]);
+ for (var N in this._textureArrays)
+ for (var U = this._textureArrays[N], B = 0; B < U.length; B++)
+ T.push(U[B]);
+ return T;
+ }, b.prototype.hasTexture = function(T) {
+ if (d.prototype.hasTexture.call(this, T))
+ return !0;
+ for (var N in this._textures)
+ if (this._textures[N] === T)
+ return !0;
+ for (var N in this._textureArrays)
+ for (var U = this._textureArrays[N], B = 0; B < U.length; B++)
+ if (U[B] === T)
+ return !0;
+ return !1;
+ }, b.prototype.clone = function(T) {
+ var N = this, U = f.a.Clone(function() {
+ return new b(T, N.getScene(), N._shaderPath, N._options);
+ }, this);
+ for (var B in U.name = T, U.id = T, typeof U._shaderPath == "object" && (U._shaderPath = Object(D.a)({}, U._shaderPath)), this._options = Object(D.a)({}, this._options), Object.keys(this._options).forEach(function(L) {
+ var j = N._options[L];
+ Array.isArray(j) && (N._options[L] = j.slice(0));
+ }), this._textures)
+ U.setTexture(B, this._textures[B]);
+ for (var B in this._floats)
+ U.setFloat(B, this._floats[B]);
+ for (var B in this._floatsArrays)
+ U.setFloats(B, this._floatsArrays[B]);
+ for (var B in this._colors3)
+ U.setColor3(B, this._colors3[B]);
+ for (var B in this._colors4)
+ U.setColor4(B, this._colors4[B]);
+ for (var B in this._vectors2)
+ U.setVector2(B, this._vectors2[B]);
+ for (var B in this._vectors3)
+ U.setVector3(B, this._vectors3[B]);
+ for (var B in this._vectors4)
+ U.setVector4(B, this._vectors4[B]);
+ for (var B in this._matrices)
+ U.setMatrix(B, this._matrices[B]);
+ for (var B in this._matrices3x3)
+ U.setMatrix3x3(B, this._matrices3x3[B]);
+ for (var B in this._matrices2x2)
+ U.setMatrix2x2(B, this._matrices2x2[B]);
+ return U;
+ }, b.prototype.dispose = function(T, N, U) {
+ if (N) {
+ var B;
+ for (B in this._textures)
+ this._textures[B].dispose();
+ for (B in this._textureArrays)
+ for (var L = this._textureArrays[B], j = 0; j < L.length; j++)
+ L[j].dispose();
+ }
+ this._textures = {}, d.prototype.dispose.call(this, T, N, U);
+ }, b.prototype.serialize = function() {
+ var T, N = f.a.Serialize(this);
+ for (T in N.customType = "BABYLON.ShaderMaterial", N.options = this._options, N.shaderPath = this._shaderPath, N.textures = {}, this._textures)
+ N.textures[T] = this._textures[T].serialize();
+ for (T in N.textureArrays = {}, this._textureArrays) {
+ N.textureArrays[T] = [];
+ for (var U = this._textureArrays[T], B = 0; B < U.length; B++)
+ N.textureArrays[T].push(U[B].serialize());
+ }
+ for (T in N.floats = {}, this._floats)
+ N.floats[T] = this._floats[T];
+ for (T in N.FloatArrays = {}, this._floatsArrays)
+ N.FloatArrays[T] = this._floatsArrays[T];
+ for (T in N.colors3 = {}, this._colors3)
+ N.colors3[T] = this._colors3[T].asArray();
+ for (T in N.colors3Arrays = {}, this._colors3Arrays)
+ N.colors3Arrays[T] = this._colors3Arrays[T];
+ for (T in N.colors4 = {}, this._colors4)
+ N.colors4[T] = this._colors4[T].asArray();
+ for (T in N.colors4Arrays = {}, this._colors4Arrays)
+ N.colors4Arrays[T] = this._colors4Arrays[T];
+ for (T in N.vectors2 = {}, this._vectors2)
+ N.vectors2[T] = this._vectors2[T].asArray();
+ for (T in N.vectors3 = {}, this._vectors3)
+ N.vectors3[T] = this._vectors3[T].asArray();
+ for (T in N.vectors4 = {}, this._vectors4)
+ N.vectors4[T] = this._vectors4[T].asArray();
+ for (T in N.matrices = {}, this._matrices)
+ N.matrices[T] = this._matrices[T].asArray();
+ for (T in N.matrixArray = {}, this._matrixArrays)
+ N.matrixArray[T] = this._matrixArrays[T];
+ for (T in N.matrices3x3 = {}, this._matrices3x3)
+ N.matrices3x3[T] = this._matrices3x3[T];
+ for (T in N.matrices2x2 = {}, this._matrices2x2)
+ N.matrices2x2[T] = this._matrices2x2[T];
+ for (T in N.vectors2Arrays = {}, this._vectors2Arrays)
+ N.vectors2Arrays[T] = this._vectors2Arrays[T];
+ for (T in N.vectors3Arrays = {}, this._vectors3Arrays)
+ N.vectors3Arrays[T] = this._vectors3Arrays[T];
+ for (T in N.vectors4Arrays = {}, this._vectors4Arrays)
+ N.vectors4Arrays[T] = this._vectors4Arrays[T];
+ return N;
+ }, b.Parse = function(T, N, U) {
+ var B, L = f.a.Parse(function() {
+ return new b(T.name, N, T.shaderPath, T.options);
+ }, T, N, U);
+ for (B in T.textures)
+ L.setTexture(B, C.a.Parse(T.textures[B], N, U));
+ for (B in T.textureArrays) {
+ for (var j = T.textureArrays[B], W = new Array(), Y = 0; Y < j.length; Y++)
+ W.push(C.a.Parse(j[Y], N, U));
+ L.setTextureArray(B, W);
+ }
+ for (B in T.floats)
+ L.setFloat(B, T.floats[B]);
+ for (B in T.floatsArrays)
+ L.setFloats(B, T.floatsArrays[B]);
+ for (B in T.colors3)
+ L.setColor3(B, u.a.FromArray(T.colors3[B]));
+ for (B in T.colors3Arrays) {
+ var oe = T.colors3Arrays[B].reduce(function(te, _e, de) {
+ return de % 3 == 0 ? te.push([_e]) : te[te.length - 1].push(_e), te;
+ }, []).map(function(te) {
+ return u.a.FromArray(te);
+ });
+ L.setColor3Array(B, oe);
+ }
+ for (B in T.colors4)
+ L.setColor4(B, u.b.FromArray(T.colors4[B]));
+ for (B in T.colors4Arrays)
+ oe = T.colors4Arrays[B].reduce(function(te, _e, de) {
+ return de % 4 == 0 ? te.push([_e]) : te[te.length - 1].push(_e), te;
+ }, []).map(function(te) {
+ return u.b.FromArray(te);
+ }), L.setColor4Array(B, oe);
+ for (B in T.vectors2)
+ L.setVector2(B, P.d.FromArray(T.vectors2[B]));
+ for (B in T.vectors3)
+ L.setVector3(B, P.e.FromArray(T.vectors3[B]));
+ for (B in T.vectors4)
+ L.setVector4(B, P.f.FromArray(T.vectors4[B]));
+ for (B in T.matrices)
+ L.setMatrix(B, P.a.FromArray(T.matrices[B]));
+ for (B in T.matrixArray)
+ L._matrixArrays[B] = new Float32Array(T.matrixArray[B]);
+ for (B in T.matrices3x3)
+ L.setMatrix3x3(B, T.matrices3x3[B]);
+ for (B in T.matrices2x2)
+ L.setMatrix2x2(B, T.matrices2x2[B]);
+ for (B in T.vectors2Arrays)
+ L.setArray2(B, T.vectors2Arrays[B]);
+ for (B in T.vectors3Arrays)
+ L.setArray3(B, T.vectors3Arrays[B]);
+ for (B in T.vectors4Arrays)
+ L.setArray4(B, T.vectors4Arrays[B]);
+ return L;
+ }, b.ParseFromFileAsync = function(T, N, U, B) {
+ var L = this;
+ return B === void 0 && (B = ""), new Promise(function(j, W) {
+ var Y = new A.a();
+ Y.addEventListener("readystatechange", function() {
+ if (Y.readyState == 4)
+ if (Y.status == 200) {
+ var oe = JSON.parse(Y.responseText), te = L.Parse(oe, U || y.a.LastCreatedScene, B);
+ T && (te.name = T), j(te);
+ } else
+ W("Unable to load the ShaderMaterial");
+ }), Y.open("GET", N), Y.send();
+ });
+ }, b.CreateFromSnippetAsync = function(T, N, U) {
+ var B = this;
+ return U === void 0 && (U = ""), new Promise(function(L, j) {
+ var W = new A.a();
+ W.addEventListener("readystatechange", function() {
+ if (W.readyState == 4)
+ if (W.status == 200) {
+ var Y = JSON.parse(JSON.parse(W.responseText).jsonPayload), oe = JSON.parse(Y.shaderMaterial), te = B.Parse(oe, N || y.a.LastCreatedScene, U);
+ te.snippetId = T, L(te);
+ } else
+ j("Unable to load the snippet " + T);
+ }), W.open("GET", B.SnippetUrl + "/" + T.replace(/#/g, "/")), W.send();
+ });
+ }, b.SnippetUrl = "https://snippet.babylonjs.com", b;
+ }(R.a);
+ g.a.RegisteredTypes["BABYLON.ShaderMaterial"] = h;
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ function f() {
+ }
+ return f.SetMatrixPrecision = function(P) {
+ if (f.MatrixTrackPrecisionChange = !1, P && !f.MatrixUse64Bits && f.MatrixTrackedMatrices)
+ for (var c = 0; c < f.MatrixTrackedMatrices.length; ++c) {
+ var C = f.MatrixTrackedMatrices[c], x = C._m;
+ C._m = new Array(16);
+ for (var R = 0; R < 16; ++R)
+ C._m[R] = x[R];
+ }
+ f.MatrixUse64Bits = P, f.MatrixCurrentType = f.MatrixUse64Bits ? Array : Float32Array, f.MatrixTrackedMatrices = null;
+ }, f.MatrixUse64Bits = !1, f.MatrixTrackPrecisionChange = !0, f.MatrixCurrentType = Float32Array, f.MatrixTrackedMatrices = [], f;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return y;
+ });
+ var D = l(1), f = l(6), P = l(0), c = l(46), C = l(7), x = l(53), R = l(65), g = l(51), u = l(36), E = l(30), A = l(9), y = function(v) {
+ function h(d, b, T, N, U) {
+ var B;
+ b === void 0 && (b = A.a.Gray()), T === void 0 && (T = u.a.DefaultUtilityLayer), N === void 0 && (N = null), U === void 0 && (U = 1);
+ var L = v.call(this, T) || this;
+ L._pointerObserver = null, L.snapDistance = 0, L.onSnapObservable = new f.c(), L._isEnabled = !0, L._parent = null, L._dragging = !1, L._parent = N, L._coloredMaterial = new E.a("", T.utilityLayerScene), L._coloredMaterial.diffuseColor = b, L._coloredMaterial.specularColor = b.subtract(new A.a(0.1, 0.1, 0.1)), L._hoverMaterial = new E.a("", T.utilityLayerScene), L._hoverMaterial.diffuseColor = A.a.Yellow(), L._disableMaterial = new E.a("", T.utilityLayerScene), L._disableMaterial.diffuseColor = A.a.Gray(), L._disableMaterial.alpha = 0.4;
+ var j = h._CreateArrow(T.utilityLayerScene, L._coloredMaterial, U), W = h._CreateArrow(T.utilityLayerScene, L._coloredMaterial, U + 4, !0);
+ L._gizmoMesh = new C.a("", T.utilityLayerScene), L._gizmoMesh.addChild(j), L._gizmoMesh.addChild(W), L._gizmoMesh.lookAt(L._rootMesh.position.add(d)), L._gizmoMesh.scaling.scaleInPlace(1 / 3), L._gizmoMesh.parent = L._rootMesh;
+ var Y = 0, oe = new P.e(), te = { snapDistance: 0 };
+ L.dragBehavior = new R.a({ dragAxis: d }), L.dragBehavior.moveAttached = !1, L._rootMesh.addBehavior(L.dragBehavior), L.dragBehavior.onDragObservable.add(function(ae) {
+ if (L.attachedNode) {
+ if (L.snapDistance == 0)
+ L.attachedNode.position && L.attachedNode.position.addInPlaceFromFloats(ae.delta.x, ae.delta.y, ae.delta.z), L.attachedNode.getWorldMatrix().addTranslationFromFloats(ae.delta.x, ae.delta.y, ae.delta.z), L.attachedNode.updateCache();
+ else if (Y += ae.dragDistance, Math.abs(Y) > L.snapDistance) {
+ var ie = Math.floor(Math.abs(Y) / L.snapDistance);
+ Y %= L.snapDistance, ae.delta.normalizeToRef(oe), oe.scaleInPlace(L.snapDistance * ie), L.attachedNode.getWorldMatrix().addTranslationFromFloats(oe.x, oe.y, oe.z), L.attachedNode.updateCache(), te.snapDistance = L.snapDistance * ie, L.onSnapObservable.notifyObservers(te);
+ }
+ L._matrixChanged();
+ }
+ }), L.dragBehavior.onDragStartObservable.add(function() {
+ L._dragging = !0;
+ }), L.dragBehavior.onDragEndObservable.add(function() {
+ L._dragging = !1;
+ });
+ var _e = T._getSharedGizmoLight();
+ _e.includedOnlyMeshes = _e.includedOnlyMeshes.concat(L._rootMesh.getChildMeshes(!1));
+ var de = { gizmoMeshes: j.getChildMeshes(), colliderMeshes: W.getChildMeshes(), material: L._coloredMaterial, hoverMaterial: L._hoverMaterial, disableMaterial: L._disableMaterial, active: !1 };
+ return (B = L._parent) === null || B === void 0 || B.addToAxisCache(W, de), L._pointerObserver = T.utilityLayerScene.onPointerObservable.add(function(ae) {
+ var ie;
+ if (!L._customMeshSet && (L._isHovered = de.colliderMeshes.indexOf((ie = ae == null ? void 0 : ae.pickInfo) === null || ie === void 0 ? void 0 : ie.pickedMesh) != -1, !L._parent)) {
+ var Z = L._isHovered || L._dragging ? L._hoverMaterial : L._coloredMaterial;
+ de.gizmoMeshes.forEach(function(ee) {
+ ee.material = Z, ee.color && (ee.color = Z.diffuseColor);
+ });
+ }
+ }), L;
+ }
+ return Object(D.d)(h, v), h._CreateArrow = function(d, b, T, N) {
+ T === void 0 && (T = 1), N === void 0 && (N = !1);
+ var U = new c.a("arrow", d), B = x.a.CreateCylinder("cylinder", { diameterTop: 0, height: 0.075, diameterBottom: 0.0375 * (1 + (T - 1) / 4), tessellation: 96 }, d), L = x.a.CreateCylinder("cylinder", { diameterTop: 5e-3 * T, height: 0.275, diameterBottom: 5e-3 * T, tessellation: 96 }, d);
+ return B.parent = U, B.material = b, B.rotation.x = Math.PI / 2, B.position.z += 0.3, L.parent = U, L.material = b, L.position.z += 0.1375, L.rotation.x = Math.PI / 2, N && (L.visibility = 0, B.visibility = 0), U;
+ }, h._CreateArrowInstance = function(d, b) {
+ for (var T = new c.a("arrow", d), N = 0, U = b.getChildMeshes(); N < U.length; N++) {
+ var B = U[N];
+ B.createInstance(B.name).parent = T;
+ }
+ return T;
+ }, h.prototype._attachedNodeChanged = function(d) {
+ this.dragBehavior && (this.dragBehavior.enabled = !!d);
+ }, Object.defineProperty(h.prototype, "isEnabled", { get: function() {
+ return this._isEnabled;
+ }, set: function(d) {
+ this._isEnabled = d, d ? this._parent && (this.attachedMesh = this._parent.attachedMesh, this.attachedNode = this._parent.attachedNode) : (this.attachedMesh = null, this.attachedNode = null);
+ }, enumerable: !1, configurable: !0 }), h.prototype.dispose = function() {
+ this.onSnapObservable.clear(), this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver), this.dragBehavior.detach(), this._gizmoMesh && this._gizmoMesh.dispose(), [this._coloredMaterial, this._hoverMaterial, this._disableMaterial].forEach(function(d) {
+ d && d.dispose();
+ }), v.prototype.dispose.call(this);
+ }, h;
+ }(g.a);
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ function f() {
+ this._isDirty = !0, this._areLightsDirty = !0, this._areLightsDisposed = !1, this._areAttributesDirty = !0, this._areTexturesDirty = !0, this._areFresnelDirty = !0, this._areMiscDirty = !0, this._arePrePassDirty = !0, this._areImageProcessingDirty = !0, this._normals = !1, this._uvs = !1, this._needNormals = !1, this._needUVs = !1;
+ }
+ return Object.defineProperty(f.prototype, "isDirty", { get: function() {
+ return this._isDirty;
+ }, enumerable: !1, configurable: !0 }), f.prototype.markAsProcessed = function() {
+ this._isDirty = !1, this._areAttributesDirty = !1, this._areTexturesDirty = !1, this._areFresnelDirty = !1, this._areLightsDirty = !1, this._areLightsDisposed = !1, this._areMiscDirty = !1, this._arePrePassDirty = !1, this._areImageProcessingDirty = !1;
+ }, f.prototype.markAsUnprocessed = function() {
+ this._isDirty = !0;
+ }, f.prototype.markAllAsDirty = function() {
+ this._areTexturesDirty = !0, this._areAttributesDirty = !0, this._areLightsDirty = !0, this._areFresnelDirty = !0, this._areMiscDirty = !0, this._areImageProcessingDirty = !0, this._isDirty = !0;
+ }, f.prototype.markAsImageProcessingDirty = function() {
+ this._areImageProcessingDirty = !0, this._isDirty = !0;
+ }, f.prototype.markAsLightDirty = function(P) {
+ P === void 0 && (P = !1), this._areLightsDirty = !0, this._areLightsDisposed = this._areLightsDisposed || P, this._isDirty = !0;
+ }, f.prototype.markAsAttributesDirty = function() {
+ this._areAttributesDirty = !0, this._isDirty = !0;
+ }, f.prototype.markAsTexturesDirty = function() {
+ this._areTexturesDirty = !0, this._isDirty = !0;
+ }, f.prototype.markAsFresnelDirty = function() {
+ this._areFresnelDirty = !0, this._isDirty = !0;
+ }, f.prototype.markAsMiscDirty = function() {
+ this._areMiscDirty = !0, this._isDirty = !0;
+ }, f.prototype.markAsPrePassDirty = function() {
+ this._arePrePassDirty = !0, this._isDirty = !0;
+ }, f.prototype.rebuild = function() {
+ this._keys = [];
+ for (var P = 0, c = Object.keys(this); P < c.length; P++) {
+ var C = c[P];
+ C[0] !== "_" && this._keys.push(C);
+ }
+ }, f.prototype.isEqual = function(P) {
+ if (this._keys.length !== P._keys.length)
+ return !1;
+ for (var c = 0; c < this._keys.length; c++) {
+ var C = this._keys[c];
+ if (this[C] !== P[C])
+ return !1;
+ }
+ return !0;
+ }, f.prototype.cloneTo = function(P) {
+ this._keys.length !== P._keys.length && (P._keys = this._keys.slice(0));
+ for (var c = 0; c < this._keys.length; c++) {
+ var C = this._keys[c];
+ P[C] = this[C];
+ }
+ }, f.prototype.reset = function() {
+ for (var P = 0; P < this._keys.length; P++) {
+ var c = this._keys[P];
+ switch (typeof this[c]) {
+ case "number":
+ this[c] = 0;
+ break;
+ case "string":
+ this[c] = "";
+ break;
+ default:
+ this[c] = !1;
+ }
+ }
+ }, f.prototype.toString = function() {
+ for (var P = "", c = 0; c < this._keys.length; c++) {
+ var C = this._keys[c], x = this[C];
+ switch (typeof x) {
+ case "number":
+ case "string":
+ P += "#define " + C + " " + x + `
+`;
+ break;
+ default:
+ x && (P += "#define " + C + `
+`);
+ }
+ }
+ return P;
+ }, f;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ function f(P, c) {
+ this.width = P, this.height = c;
+ }
+ return f.prototype.toString = function() {
+ return "{W: " + this.width + ", H: " + this.height + "}";
+ }, f.prototype.getClassName = function() {
+ return "Size";
+ }, f.prototype.getHashCode = function() {
+ var P = 0 | this.width;
+ return P = 397 * P ^ (0 | this.height);
+ }, f.prototype.copyFrom = function(P) {
+ this.width = P.width, this.height = P.height;
+ }, f.prototype.copyFromFloats = function(P, c) {
+ return this.width = P, this.height = c, this;
+ }, f.prototype.set = function(P, c) {
+ return this.copyFromFloats(P, c);
+ }, f.prototype.multiplyByFloats = function(P, c) {
+ return new f(this.width * P, this.height * c);
+ }, f.prototype.clone = function() {
+ return new f(this.width, this.height);
+ }, f.prototype.equals = function(P) {
+ return !!P && this.width === P.width && this.height === P.height;
+ }, Object.defineProperty(f.prototype, "surface", { get: function() {
+ return this.width * this.height;
+ }, enumerable: !1, configurable: !0 }), f.Zero = function() {
+ return new f(0, 0);
+ }, f.prototype.add = function(P) {
+ return new f(this.width + P.width, this.height + P.height);
+ }, f.prototype.subtract = function(P) {
+ return new f(this.width - P.width, this.height - P.height);
+ }, f.Lerp = function(P, c, C) {
+ return new f(P.width + (c.width - P.width) * C, P.height + (c.height - P.height) * C);
+ }, f;
+ }();
+ }, function(V, _, l) {
+ var D = "bonesDeclaration", f = `#if NUM_BONE_INFLUENCERS>0
+#ifdef BONETEXTURE
+uniform sampler2D boneSampler;
+uniform float boneTextureWidth;
+#else
+uniform mat4 mBones[BonesPerMesh];
+#ifdef BONES_VELOCITY_ENABLED
+uniform mat4 mPreviousBones[BonesPerMesh];
+#endif
+#endif
+attribute vec4 matricesIndices;
+attribute vec4 matricesWeights;
+#if NUM_BONE_INFLUENCERS>4
+attribute vec4 matricesIndicesExtra;
+attribute vec4 matricesWeightsExtra;
+#endif
+#ifdef BONETEXTURE
+#define inline
+mat4 readMatrixFromRawSampler(sampler2D smp,float index)
+{
+float offset=index*4.0;
+float dx=1.0/boneTextureWidth;
+vec4 m0=texture2D(smp,vec2(dx*(offset+0.5),0.));
+vec4 m1=texture2D(smp,vec2(dx*(offset+1.5),0.));
+vec4 m2=texture2D(smp,vec2(dx*(offset+2.5),0.));
+vec4 m3=texture2D(smp,vec2(dx*(offset+3.5),0.));
+return mat4(m0,m1,m2,m3);
+}
+#endif
+#endif`;
+ l(5).a.IncludesShadersStore[D] = f;
+ }, function(V, _, l) {
+ var D = "instancesDeclaration", f = `#ifdef INSTANCES
+attribute vec4 world0;
+attribute vec4 world1;
+attribute vec4 world2;
+attribute vec4 world3;
+#ifdef THIN_INSTANCES
+uniform mat4 world;
+#endif
+#else
+uniform mat4 world;
+#endif`;
+ l(5).a.IncludesShadersStore[D] = f;
+ }, function(V, _, l) {
+ var D = "instancesVertex", f = `#ifdef INSTANCES
+mat4 finalWorld=mat4(world0,world1,world2,world3);
+#ifdef THIN_INSTANCES
+finalWorld=world*finalWorld;
+#endif
+#else
+mat4 finalWorld=world;
+#endif`;
+ l(5).a.IncludesShadersStore[D] = f;
+ }, function(V, _, l) {
+ var D = `#if NUM_BONE_INFLUENCERS>0
+mat4 influence;
+#ifdef BONETEXTURE
+influence=readMatrixFromRawSampler(boneSampler,matricesIndices[0])*matricesWeights[0];
+#if NUM_BONE_INFLUENCERS>1
+influence+=readMatrixFromRawSampler(boneSampler,matricesIndices[1])*matricesWeights[1];
+#endif
+#if NUM_BONE_INFLUENCERS>2
+influence+=readMatrixFromRawSampler(boneSampler,matricesIndices[2])*matricesWeights[2];
+#endif
+#if NUM_BONE_INFLUENCERS>3
+influence+=readMatrixFromRawSampler(boneSampler,matricesIndices[3])*matricesWeights[3];
+#endif
+#if NUM_BONE_INFLUENCERS>4
+influence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[0])*matricesWeightsExtra[0];
+#endif
+#if NUM_BONE_INFLUENCERS>5
+influence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[1])*matricesWeightsExtra[1];
+#endif
+#if NUM_BONE_INFLUENCERS>6
+influence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[2])*matricesWeightsExtra[2];
+#endif
+#if NUM_BONE_INFLUENCERS>7
+influence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[3])*matricesWeightsExtra[3];
+#endif
+#else
+influence=mBones[int(matricesIndices[0])]*matricesWeights[0];
+#if NUM_BONE_INFLUENCERS>1
+influence+=mBones[int(matricesIndices[1])]*matricesWeights[1];
+#endif
+#if NUM_BONE_INFLUENCERS>2
+influence+=mBones[int(matricesIndices[2])]*matricesWeights[2];
+#endif
+#if NUM_BONE_INFLUENCERS>3
+influence+=mBones[int(matricesIndices[3])]*matricesWeights[3];
+#endif
+#if NUM_BONE_INFLUENCERS>4
+influence+=mBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];
+#endif
+#if NUM_BONE_INFLUENCERS>5
+influence+=mBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];
+#endif
+#if NUM_BONE_INFLUENCERS>6
+influence+=mBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];
+#endif
+#if NUM_BONE_INFLUENCERS>7
+influence+=mBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];
+#endif
+#endif
+finalWorld=finalWorld*influence;
+#endif`;
+ l(5).a.IncludesShadersStore.bonesVertex = D;
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return x;
+ });
+ var D = l(0), f = l(7), P = l(4), c = l(16), C = l(43);
+ c.a.CreateRibbon = function(R) {
+ var g = R.pathArray, u = R.closeArray || !1, E = R.closePath || !1, A = R.invertUV || !1, y = Math.floor(g[0].length / 2), v = R.offset || y;
+ v = v > y ? y : Math.floor(v);
+ var h, d, b, T, N = R.sideOrientation === 0 ? 0 : R.sideOrientation || c.a.DEFAULTSIDE, U = R.uvs, B = R.colors, L = [], j = [], W = [], Y = [], oe = [], te = [], _e = [], de = [], ae = [], ie = [];
+ if (g.length < 2) {
+ var Z = [], ee = [];
+ for (b = 0; b < g[0].length - v; b++)
+ Z.push(g[0][b]), ee.push(g[0][b + v]);
+ g = [Z, ee];
+ }
+ var w, z, q, le, ce, J = 0, H = E ? 1 : 0;
+ for (h = g[0].length, d = 0; d < g.length; d++) {
+ for (_e[d] = 0, oe[d] = [0], h = h < (z = (w = g[d]).length) ? h : z, T = 0; T < z; )
+ L.push(w[T].x, w[T].y, w[T].z), T > 0 && (q = w[T].subtract(w[T - 1]).length() + _e[d], oe[d].push(q), _e[d] = q), T++;
+ E && (T--, L.push(w[0].x, w[0].y, w[0].z), q = w[T].subtract(w[0]).length() + _e[d], oe[d].push(q), _e[d] = q), ae[d] = z + H, ie[d] = J, J += z + H;
+ }
+ var X, ne, Q = null, $ = null;
+ for (b = 0; b < h + H; b++) {
+ for (de[b] = 0, te[b] = [0], d = 0; d < g.length - 1; d++)
+ le = g[d], ce = g[d + 1], b === h ? (Q = le[0], $ = ce[0]) : (Q = le[b], $ = ce[b]), q = $.subtract(Q).length() + de[b], te[b].push(q), de[b] = q;
+ u && $ && Q && (le = g[d], ce = g[0], b === h && ($ = ce[0]), q = $.subtract(Q).length() + de[b], de[b] = q);
+ }
+ if (U)
+ for (d = 0; d < U.length; d++)
+ Y.push(U[d].x, U[d].y);
+ else
+ for (d = 0; d < g.length; d++)
+ for (b = 0; b < h + H; b++)
+ X = _e[d] != 0 ? oe[d][b] / _e[d] : 0, ne = de[b] != 0 ? te[b][d] / de[b] : 0, A ? Y.push(ne, X) : Y.push(X, ne);
+ for (var me = 0, ye = ae[d = 0] - 1, be = ae[d + 1] - 1, ge = ye < be ? ye : be, Te = ie[1] - ie[0], Re = u ? ae.length : ae.length - 1; me <= ge && d < Re; )
+ j.push(me, me + Te, me + 1), j.push(me + Te + 1, me + 1, me + Te), (me += 1) === ge && (++d === ae.length - 1 ? (Te = ie[0] - ie[d], ye = ae[d] - 1, be = ae[0] - 1) : (Te = ie[d + 1] - ie[d], ye = ae[d] - 1, be = ae[d + 1] - 1), me = ie[d], ge = ye < be ? ye + me : be + me);
+ if (c.a.ComputeNormals(L, j, W), E) {
+ var Se = 0, Ne = 0;
+ for (d = 0; d < g.length; d++)
+ Se = 3 * ie[d], Ne = d + 1 < g.length ? 3 * (ie[d + 1] - 1) : W.length - 3, W[Se] = 0.5 * (W[Se] + W[Ne]), W[Se + 1] = 0.5 * (W[Se + 1] + W[Ne + 1]), W[Se + 2] = 0.5 * (W[Se + 2] + W[Ne + 2]), W[Ne] = W[Se], W[Ne + 1] = W[Se + 1], W[Ne + 2] = W[Se + 2];
+ }
+ c.a._ComputeSides(N, L, j, W, Y, R.frontUVs, R.backUVs);
+ var ze = null;
+ if (B) {
+ ze = new Float32Array(4 * B.length);
+ for (var Ye = 0; Ye < B.length; Ye++)
+ ze[4 * Ye] = B[Ye].r, ze[4 * Ye + 1] = B[Ye].g, ze[4 * Ye + 2] = B[Ye].b, ze[4 * Ye + 3] = B[Ye].a;
+ }
+ var He = new c.a(), Xe = new Float32Array(L), Ze = new Float32Array(W), je = new Float32Array(Y);
+ return He.indices = j, He.positions = Xe, He.normals = Ze, He.uvs = je, ze && He.set(ze, P.b.ColorKind), E && (He._idx = ie), He;
+ }, f.a.CreateRibbon = function(R, g, u, E, A, y, v, h, d) {
+ return u === void 0 && (u = !1), v === void 0 && (v = !1), x.CreateRibbon(R, { pathArray: g, closeArray: u, closePath: E, offset: A, updatable: v, sideOrientation: h, instance: d }, y);
+ };
+ var x = function() {
+ function R() {
+ }
+ return R.CreateRibbon = function(g, u, E) {
+ E === void 0 && (E = null);
+ var A = u.pathArray, y = u.closeArray, v = u.closePath, h = f.a._GetDefaultSideOrientation(u.sideOrientation), d = u.instance, b = u.updatable;
+ if (d) {
+ var T = D.c.Vector3[0].setAll(Number.MAX_VALUE), N = D.c.Vector3[1].setAll(-Number.MAX_VALUE), U = d.getVerticesData(P.b.PositionKind);
+ if (function(z) {
+ for (var q = A[0].length, le = d, ce = 0, J = le._originalBuilderSideOrientation === f.a.DOUBLESIDE ? 2 : 1, H = 1; H <= J; ++H)
+ for (var X = 0; X < A.length; ++X) {
+ var ne = A[X], Q = ne.length;
+ q = q < Q ? q : Q;
+ for (var $ = 0; $ < q; ++$) {
+ var me = ne[$];
+ z[ce] = me.x, z[ce + 1] = me.y, z[ce + 2] = me.z, T.minimizeInPlaceFromFloats(me.x, me.y, me.z), N.maximizeInPlaceFromFloats(me.x, me.y, me.z), ce += 3;
+ }
+ le._creationDataStorage && le._creationDataStorage.closePath && (me = ne[0], z[ce] = me.x, z[ce + 1] = me.y, z[ce + 2] = me.z, ce += 3);
+ }
+ }(U), d._boundingInfo ? d._boundingInfo.reConstruct(T, N, d._worldMatrix) : d._boundingInfo = new C.a(T, N, d._worldMatrix), d.updateVerticesData(P.b.PositionKind, U, !1, !1), u.colors) {
+ for (var B = d.getVerticesData(P.b.ColorKind), L = 0, j = 0; L < u.colors.length; L++, j += 4) {
+ var W = u.colors[L];
+ B[j] = W.r, B[j + 1] = W.g, B[j + 2] = W.b, B[j + 3] = W.a;
+ }
+ d.updateVerticesData(P.b.ColorKind, B, !1, !1);
+ }
+ if (u.uvs) {
+ for (var Y = d.getVerticesData(P.b.UVKind), oe = 0; oe < u.uvs.length; oe++)
+ Y[2 * oe] = u.uvs[oe].x, Y[2 * oe + 1] = u.uvs[oe].y;
+ d.updateVerticesData(P.b.UVKind, Y, !1, !1);
+ }
+ if (!d.areNormalsFrozen || d.isFacetDataEnabled) {
+ var te = d.getIndices(), _e = d.getVerticesData(P.b.NormalKind), de = d.isFacetDataEnabled ? d.getFacetDataParameters() : null;
+ if (c.a.ComputeNormals(U, te, _e, de), d._creationDataStorage && d._creationDataStorage.closePath)
+ for (var ae = 0, ie = 0, Z = 0; Z < A.length; Z++)
+ ae = 3 * d._creationDataStorage.idx[Z], ie = Z + 1 < A.length ? 3 * (d._creationDataStorage.idx[Z + 1] - 1) : _e.length - 3, _e[ae] = 0.5 * (_e[ae] + _e[ie]), _e[ae + 1] = 0.5 * (_e[ae + 1] + _e[ie + 1]), _e[ae + 2] = 0.5 * (_e[ae + 2] + _e[ie + 2]), _e[ie] = _e[ae], _e[ie + 1] = _e[ae + 1], _e[ie + 2] = _e[ae + 2];
+ d.areNormalsFrozen || d.updateVerticesData(P.b.NormalKind, _e, !1, !1);
+ }
+ return d;
+ }
+ var ee = new f.a(g, E);
+ ee._originalBuilderSideOrientation = h, ee._creationDataStorage = new f.b();
+ var w = c.a.CreateRibbon(u);
+ return v && (ee._creationDataStorage.idx = w._idx), ee._creationDataStorage.closePath = v, ee._creationDataStorage.closeArray = y, w.applyToMesh(ee, b), ee;
+ }, R;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ function f() {
+ }
+ return f.FilesToLoad = {}, f;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return P;
+ });
+ var D = l(7), f = l(16);
+ f.a.CreatePlane = function(c) {
+ var C = [], x = [], R = [], g = [], u = c.width || c.size || 1, E = c.height || c.size || 1, A = c.sideOrientation === 0 ? 0 : c.sideOrientation || f.a.DEFAULTSIDE, y = u / 2, v = E / 2;
+ x.push(-y, -v, 0), R.push(0, 0, -1), g.push(0, 0), x.push(y, -v, 0), R.push(0, 0, -1), g.push(1, 0), x.push(y, v, 0), R.push(0, 0, -1), g.push(1, 1), x.push(-y, v, 0), R.push(0, 0, -1), g.push(0, 1), C.push(0), C.push(1), C.push(2), C.push(0), C.push(2), C.push(3), f.a._ComputeSides(A, x, C, R, g, c.frontUVs, c.backUVs);
+ var h = new f.a();
+ return h.indices = C, h.positions = x, h.normals = R, h.uvs = g, h;
+ }, D.a.CreatePlane = function(c, C, x, R, g) {
+ var u = { size: C, width: C, height: C, sideOrientation: g, updatable: R };
+ return P.CreatePlane(c, u, x);
+ };
+ var P = function() {
+ function c() {
+ }
+ return c.CreatePlane = function(C, x, R) {
+ R === void 0 && (R = null);
+ var g = new D.a(C, R);
+ return x.sideOrientation = D.a._GetDefaultSideOrientation(x.sideOrientation), g._originalBuilderSideOrientation = x.sideOrientation, f.a.CreatePlane(x).applyToMesh(g, x.updatable), x.sourcePlane && (g.translate(x.sourcePlane.normal, -x.sourcePlane.d), g.setDirection(x.sourcePlane.normal.scale(-1))), g;
+ }, c;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return f;
+ });
+ var D = l(8), f = (l(153), function() {
+ function P(c, C, x) {
+ this._alreadyBound = !1, this._valueCache = {}, this._engine = c, this._noUBO = !c.supportsUniformBuffers, this._dynamic = x, this._data = C || [], this._uniformLocations = {}, this._uniformSizes = {}, this._uniformLocationPointer = 0, this._needSync = !1, this._noUBO ? (this.updateMatrix3x3 = this._updateMatrix3x3ForEffect, this.updateMatrix2x2 = this._updateMatrix2x2ForEffect, this.updateFloat = this._updateFloatForEffect, this.updateFloat2 = this._updateFloat2ForEffect, this.updateFloat3 = this._updateFloat3ForEffect, this.updateFloat4 = this._updateFloat4ForEffect, this.updateMatrix = this._updateMatrixForEffect, this.updateVector3 = this._updateVector3ForEffect, this.updateVector4 = this._updateVector4ForEffect, this.updateColor3 = this._updateColor3ForEffect, this.updateColor4 = this._updateColor4ForEffect) : (this._engine._uniformBuffers.push(this), this.updateMatrix3x3 = this._updateMatrix3x3ForUniform, this.updateMatrix2x2 = this._updateMatrix2x2ForUniform, this.updateFloat = this._updateFloatForUniform, this.updateFloat2 = this._updateFloat2ForUniform, this.updateFloat3 = this._updateFloat3ForUniform, this.updateFloat4 = this._updateFloat4ForUniform, this.updateMatrix = this._updateMatrixForUniform, this.updateVector3 = this._updateVector3ForUniform, this.updateVector4 = this._updateVector4ForUniform, this.updateColor3 = this._updateColor3ForUniform, this.updateColor4 = this._updateColor4ForUniform);
+ }
+ return Object.defineProperty(P.prototype, "useUbo", { get: function() {
+ return !this._noUBO;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(P.prototype, "isSync", { get: function() {
+ return !this._needSync;
+ }, enumerable: !1, configurable: !0 }), P.prototype.isDynamic = function() {
+ return this._dynamic !== void 0;
+ }, P.prototype.getData = function() {
+ return this._bufferData;
+ }, P.prototype.getBuffer = function() {
+ return this._buffer;
+ }, P.prototype._fillAlignment = function(c) {
+ var C;
+ if (C = c <= 2 ? c : 4, this._uniformLocationPointer % C != 0) {
+ var x = this._uniformLocationPointer;
+ this._uniformLocationPointer += C - this._uniformLocationPointer % C;
+ for (var R = this._uniformLocationPointer - x, g = 0; g < R; g++)
+ this._data.push(0);
+ }
+ }, P.prototype.addUniform = function(c, C) {
+ if (!this._noUBO && this._uniformLocations[c] === void 0) {
+ var x;
+ if (C instanceof Array)
+ C = (x = C).length;
+ else {
+ C = C, x = [];
+ for (var R = 0; R < C; R++)
+ x.push(0);
+ }
+ for (this._fillAlignment(C), this._uniformSizes[c] = C, this._uniformLocations[c] = this._uniformLocationPointer, this._uniformLocationPointer += C, R = 0; R < C; R++)
+ this._data.push(x[R]);
+ this._needSync = !0;
+ }
+ }, P.prototype.addMatrix = function(c, C) {
+ this.addUniform(c, Array.prototype.slice.call(C.toArray()));
+ }, P.prototype.addFloat2 = function(c, C, x) {
+ var R = [C, x];
+ this.addUniform(c, R);
+ }, P.prototype.addFloat3 = function(c, C, x, R) {
+ var g = [C, x, R];
+ this.addUniform(c, g);
+ }, P.prototype.addColor3 = function(c, C) {
+ var x = new Array();
+ C.toArray(x), this.addUniform(c, x);
+ }, P.prototype.addColor4 = function(c, C, x) {
+ var R = new Array();
+ C.toArray(R), R.push(x), this.addUniform(c, R);
+ }, P.prototype.addVector3 = function(c, C) {
+ var x = new Array();
+ C.toArray(x), this.addUniform(c, x);
+ }, P.prototype.addMatrix3x3 = function(c) {
+ this.addUniform(c, 12);
+ }, P.prototype.addMatrix2x2 = function(c) {
+ this.addUniform(c, 8);
+ }, P.prototype.create = function() {
+ this._noUBO || this._buffer || (this._fillAlignment(4), this._bufferData = new Float32Array(this._data), this._rebuild(), this._needSync = !0);
+ }, P.prototype._rebuild = function() {
+ !this._noUBO && this._bufferData && (this._dynamic ? this._buffer = this._engine.createDynamicUniformBuffer(this._bufferData) : this._buffer = this._engine.createUniformBuffer(this._bufferData));
+ }, P.prototype.update = function() {
+ this._buffer ? (this._dynamic || this._needSync) && (this._engine.updateUniformBuffer(this._buffer, this._bufferData), this._needSync = !1) : this.create();
+ }, P.prototype.updateUniform = function(c, C, x) {
+ var R = this._uniformLocations[c];
+ if (R === void 0) {
+ if (this._buffer)
+ return void D.a.Error("Cannot add an uniform after UBO has been created.");
+ this.addUniform(c, x), R = this._uniformLocations[c];
+ }
+ if (this._buffer || this.create(), this._dynamic)
+ for (u = 0; u < x; u++)
+ this._bufferData[R + u] = C[u];
+ else {
+ for (var g = !1, u = 0; u < x; u++)
+ x !== 16 && this._bufferData[R + u] === C[u] || (g = !0, this._bufferData[R + u] = C[u]);
+ this._needSync = this._needSync || g;
+ }
+ }, P.prototype._cacheMatrix = function(c, C) {
+ var x = this._valueCache[c], R = C.updateFlag;
+ return (x === void 0 || x !== R) && (this._valueCache[c] = R, !0);
+ }, P.prototype._updateMatrix3x3ForUniform = function(c, C) {
+ for (var x = 0; x < 3; x++)
+ P._tempBuffer[4 * x] = C[3 * x], P._tempBuffer[4 * x + 1] = C[3 * x + 1], P._tempBuffer[4 * x + 2] = C[3 * x + 2], P._tempBuffer[4 * x + 3] = 0;
+ this.updateUniform(c, P._tempBuffer, 12);
+ }, P.prototype._updateMatrix3x3ForEffect = function(c, C) {
+ this._currentEffect.setMatrix3x3(c, C);
+ }, P.prototype._updateMatrix2x2ForEffect = function(c, C) {
+ this._currentEffect.setMatrix2x2(c, C);
+ }, P.prototype._updateMatrix2x2ForUniform = function(c, C) {
+ for (var x = 0; x < 2; x++)
+ P._tempBuffer[4 * x] = C[2 * x], P._tempBuffer[4 * x + 1] = C[2 * x + 1], P._tempBuffer[4 * x + 2] = 0, P._tempBuffer[4 * x + 3] = 0;
+ this.updateUniform(c, P._tempBuffer, 8);
+ }, P.prototype._updateFloatForEffect = function(c, C) {
+ this._currentEffect.setFloat(c, C);
+ }, P.prototype._updateFloatForUniform = function(c, C) {
+ P._tempBuffer[0] = C, this.updateUniform(c, P._tempBuffer, 1);
+ }, P.prototype._updateFloat2ForEffect = function(c, C, x, R) {
+ R === void 0 && (R = ""), this._currentEffect.setFloat2(c + R, C, x);
+ }, P.prototype._updateFloat2ForUniform = function(c, C, x) {
+ P._tempBuffer[0] = C, P._tempBuffer[1] = x, this.updateUniform(c, P._tempBuffer, 2);
+ }, P.prototype._updateFloat3ForEffect = function(c, C, x, R, g) {
+ g === void 0 && (g = ""), this._currentEffect.setFloat3(c + g, C, x, R);
+ }, P.prototype._updateFloat3ForUniform = function(c, C, x, R) {
+ P._tempBuffer[0] = C, P._tempBuffer[1] = x, P._tempBuffer[2] = R, this.updateUniform(c, P._tempBuffer, 3);
+ }, P.prototype._updateFloat4ForEffect = function(c, C, x, R, g, u) {
+ u === void 0 && (u = ""), this._currentEffect.setFloat4(c + u, C, x, R, g);
+ }, P.prototype._updateFloat4ForUniform = function(c, C, x, R, g) {
+ P._tempBuffer[0] = C, P._tempBuffer[1] = x, P._tempBuffer[2] = R, P._tempBuffer[3] = g, this.updateUniform(c, P._tempBuffer, 4);
+ }, P.prototype._updateMatrixForEffect = function(c, C) {
+ this._currentEffect.setMatrix(c, C);
+ }, P.prototype._updateMatrixForUniform = function(c, C) {
+ this._cacheMatrix(c, C) && this.updateUniform(c, C.toArray(), 16);
+ }, P.prototype._updateVector3ForEffect = function(c, C) {
+ this._currentEffect.setVector3(c, C);
+ }, P.prototype._updateVector3ForUniform = function(c, C) {
+ C.toArray(P._tempBuffer), this.updateUniform(c, P._tempBuffer, 3);
+ }, P.prototype._updateVector4ForEffect = function(c, C) {
+ this._currentEffect.setVector4(c, C);
+ }, P.prototype._updateVector4ForUniform = function(c, C) {
+ C.toArray(P._tempBuffer), this.updateUniform(c, P._tempBuffer, 4);
+ }, P.prototype._updateColor3ForEffect = function(c, C, x) {
+ x === void 0 && (x = ""), this._currentEffect.setColor3(c + x, C);
+ }, P.prototype._updateColor3ForUniform = function(c, C) {
+ C.toArray(P._tempBuffer), this.updateUniform(c, P._tempBuffer, 3);
+ }, P.prototype._updateColor4ForEffect = function(c, C, x, R) {
+ R === void 0 && (R = ""), this._currentEffect.setColor4(c + R, C, x);
+ }, P.prototype._updateColor4ForUniform = function(c, C, x) {
+ C.toArray(P._tempBuffer), P._tempBuffer[3] = x, this.updateUniform(c, P._tempBuffer, 4);
+ }, P.prototype.setTexture = function(c, C) {
+ this._currentEffect.setTexture(c, C);
+ }, P.prototype.updateUniformDirectly = function(c, C) {
+ this.updateUniform(c, C, C.length), this.update();
+ }, P.prototype.bindToEffect = function(c, C) {
+ this._currentEffect = c, !this._noUBO && this._buffer && (this._alreadyBound = !0, c.bindUniformBuffer(this._buffer, C));
+ }, P.prototype.dispose = function() {
+ if (!this._noUBO) {
+ var c = this._engine._uniformBuffers, C = c.indexOf(this);
+ C !== -1 && (c[C] = c[c.length - 1], c.pop()), this._buffer && this._engine._releaseBuffer(this._buffer) && (this._buffer = null);
+ }
+ }, P._MAX_UNIFORM_SIZE = 256, P._tempBuffer = new Float32Array(P._MAX_UNIFORM_SIZE), P;
+ }());
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return R;
+ });
+ var D = l(1), f = l(3), P = l(0), c = l(9), C = l(29), x = l(48);
+ C.a.AddNodeConstructor("Light_Type_3", function(g, u) {
+ return function() {
+ return new R(g, P.e.Zero(), u);
+ };
+ });
+ var R = function(g) {
+ function u(E, A, y) {
+ var v = g.call(this, E, y) || this;
+ return v.groundColor = new c.a(0, 0, 0), v.direction = A || P.e.Up(), v;
+ }
+ return Object(D.d)(u, g), u.prototype._buildUniformLayout = function() {
+ this._uniformBuffer.addUniform("vLightData", 4), this._uniformBuffer.addUniform("vLightDiffuse", 4), this._uniformBuffer.addUniform("vLightSpecular", 4), this._uniformBuffer.addUniform("vLightGround", 3), this._uniformBuffer.addUniform("shadowsInfo", 3), this._uniformBuffer.addUniform("depthValues", 2), this._uniformBuffer.create();
+ }, u.prototype.getClassName = function() {
+ return "HemisphericLight";
+ }, u.prototype.setDirectionToTarget = function(E) {
+ return this.direction = P.e.Normalize(E.subtract(P.e.Zero())), this.direction;
+ }, u.prototype.getShadowGenerator = function() {
+ return null;
+ }, u.prototype.transferToEffect = function(E, A) {
+ var y = P.e.Normalize(this.direction);
+ return this._uniformBuffer.updateFloat4("vLightData", y.x, y.y, y.z, 0, A), this._uniformBuffer.updateColor3("vLightGround", this.groundColor.scale(this.intensity), A), this;
+ }, u.prototype.transferToNodeMaterialEffect = function(E, A) {
+ var y = P.e.Normalize(this.direction);
+ return E.setFloat3(A, y.x, y.y, y.z), this;
+ }, u.prototype.computeWorldMatrix = function() {
+ return this._worldMatrix || (this._worldMatrix = P.a.Identity()), this._worldMatrix;
+ }, u.prototype.getTypeID = function() {
+ return x.a.LIGHTTYPEID_HEMISPHERICLIGHT;
+ }, u.prototype.prepareLightSpecificDefines = function(E, A) {
+ E["HEMILIGHT" + A] = !0;
+ }, Object(D.c)([Object(f.e)()], u.prototype, "groundColor", void 0), Object(D.c)([Object(f.o)()], u.prototype, "direction", void 0), u;
+ }(x.a);
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return P;
+ });
+ var D = l(1), f = l(0), P = function(c) {
+ function C(x, R) {
+ var g = c.call(this, x, R) || this;
+ return g._normalMatrix = new f.a(), g._storeEffectOnSubMeshes = !0, g;
+ }
+ return Object(D.d)(C, c), C.prototype.getEffect = function() {
+ return this._activeEffect;
+ }, C.prototype.isReady = function(x, R) {
+ return !!x && (!x.subMeshes || x.subMeshes.length === 0 || this.isReadyForSubMesh(x, x.subMeshes[0], R));
+ }, C.prototype._isReadyForSubMesh = function(x) {
+ var R = x._materialDefines;
+ return !(this.checkReadyOnEveryCall || !x.effect || !R || R._renderId !== this.getScene().getRenderId());
+ }, C.prototype.bindOnlyWorldMatrix = function(x) {
+ this._activeEffect.setMatrix("world", x);
+ }, C.prototype.bindOnlyNormalMatrix = function(x) {
+ this._activeEffect.setMatrix("normalMatrix", x);
+ }, C.prototype.bind = function(x, R) {
+ R && this.bindForSubMesh(x, R, R.subMeshes[0]);
+ }, C.prototype._afterBind = function(x, R) {
+ R === void 0 && (R = null), c.prototype._afterBind.call(this, x), this.getScene()._cachedEffect = R;
+ }, C.prototype._mustRebind = function(x, R, g) {
+ return g === void 0 && (g = 1), x.isCachedMaterialInvalid(this, R, g);
+ }, C;
+ }(l(25).a);
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return f;
+ });
+ var D = l(1), f = function(P) {
+ function c(C) {
+ var x = P.call(this) || this;
+ return x._buffer = C, x;
+ }
+ return Object(D.d)(c, P), Object.defineProperty(c.prototype, "underlyingResource", { get: function() {
+ return this._buffer;
+ }, enumerable: !1, configurable: !0 }), c;
+ }(l(89).a);
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ function f() {
+ this.references = 0, this.capacity = 0, this.is32Bits = !1;
+ }
+ return Object.defineProperty(f.prototype, "underlyingResource", { get: function() {
+ return null;
+ }, enumerable: !1, configurable: !0 }), f;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return f;
+ });
+ var D = l(64), f = function() {
+ function P() {
+ }
+ return P.GetPlanes = function(c) {
+ for (var C = [], x = 0; x < 6; x++)
+ C.push(new D.a(0, 0, 0, 0));
+ return P.GetPlanesToRef(c, C), C;
+ }, P.GetNearPlaneToRef = function(c, C) {
+ var x = c.m;
+ C.normal.x = x[3] + x[2], C.normal.y = x[7] + x[6], C.normal.z = x[11] + x[10], C.d = x[15] + x[14], C.normalize();
+ }, P.GetFarPlaneToRef = function(c, C) {
+ var x = c.m;
+ C.normal.x = x[3] - x[2], C.normal.y = x[7] - x[6], C.normal.z = x[11] - x[10], C.d = x[15] - x[14], C.normalize();
+ }, P.GetLeftPlaneToRef = function(c, C) {
+ var x = c.m;
+ C.normal.x = x[3] + x[0], C.normal.y = x[7] + x[4], C.normal.z = x[11] + x[8], C.d = x[15] + x[12], C.normalize();
+ }, P.GetRightPlaneToRef = function(c, C) {
+ var x = c.m;
+ C.normal.x = x[3] - x[0], C.normal.y = x[7] - x[4], C.normal.z = x[11] - x[8], C.d = x[15] - x[12], C.normalize();
+ }, P.GetTopPlaneToRef = function(c, C) {
+ var x = c.m;
+ C.normal.x = x[3] - x[1], C.normal.y = x[7] - x[5], C.normal.z = x[11] - x[9], C.d = x[15] - x[13], C.normalize();
+ }, P.GetBottomPlaneToRef = function(c, C) {
+ var x = c.m;
+ C.normal.x = x[3] + x[1], C.normal.y = x[7] + x[5], C.normal.z = x[11] + x[9], C.d = x[15] + x[13], C.normalize();
+ }, P.GetPlanesToRef = function(c, C) {
+ P.GetNearPlaneToRef(c, C[0]), P.GetFarPlaneToRef(c, C[1]), P.GetLeftPlaneToRef(c, C[2]), P.GetRightPlaneToRef(c, C[3]), P.GetTopPlaneToRef(c, C[4]), P.GetBottomPlaneToRef(c, C[5]);
+ }, P;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return f;
+ });
+ var D = l(2), f = function() {
+ function P() {
+ this.hoverCursor = "", this.actions = new Array(), this.isRecursive = !1;
+ }
+ return Object.defineProperty(P, "HasTriggers", { get: function() {
+ for (var c in P.Triggers)
+ if (P.Triggers.hasOwnProperty(c))
+ return !0;
+ return !1;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(P, "HasPickTriggers", { get: function() {
+ for (var c in P.Triggers)
+ if (P.Triggers.hasOwnProperty(c)) {
+ var C = parseInt(c);
+ if (C >= D.a.ACTION_OnPickTrigger && C <= D.a.ACTION_OnPickUpTrigger)
+ return !0;
+ }
+ return !1;
+ }, enumerable: !1, configurable: !0 }), P.HasSpecificTrigger = function(c) {
+ for (var C in P.Triggers)
+ if (P.Triggers.hasOwnProperty(C) && parseInt(C) === c)
+ return !0;
+ return !1;
+ }, P.Triggers = {}, P;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return x;
+ });
+ var D = l(1), f = l(25), P = l(3), c = l(19), C = l(15), x = function() {
+ function R(g) {
+ this._texture = null, this.diffuseBlendLevel = 1, this.roughnessBlendLevel = 1, this.bumpLevel = 1, this._normalBlendMethod = f.a.MATERIAL_NORMALBLENDMETHOD_WHITEOUT, this._isEnabled = !1, this.isEnabled = !1, this._internalMarkAllSubMeshesAsTexturesDirty = g;
+ }
+ return R.prototype._markAllSubMeshesAsTexturesDirty = function() {
+ this._internalMarkAllSubMeshesAsTexturesDirty();
+ }, R.prototype.isReadyForSubMesh = function(g, u) {
+ var E = u.getEngine();
+ return !(g._areTexturesDirty && u.texturesEnabled && E.getCaps().standardDerivatives && this._texture && c.a.DetailTextureEnabled && !this._texture.isReady());
+ }, R.prototype.prepareDefines = function(g, u) {
+ if (this._isEnabled) {
+ g.DETAIL_NORMALBLENDMETHOD = this._normalBlendMethod;
+ var E = u.getEngine();
+ g._areTexturesDirty && (E.getCaps().standardDerivatives && this._texture && c.a.DetailTextureEnabled && this._isEnabled ? (C.a.PrepareDefinesForMergedUV(this._texture, g, "DETAIL"), g.DETAIL_NORMALBLENDMETHOD = this._normalBlendMethod) : g.DETAIL = !1);
+ } else
+ g.DETAIL = !1;
+ }, R.prototype.bindForSubMesh = function(g, u, E) {
+ this._isEnabled && (g.useUbo && E && g.isSync || this._texture && c.a.DetailTextureEnabled && (g.updateFloat4("vDetailInfos", this._texture.coordinatesIndex, this.diffuseBlendLevel, this.bumpLevel, this.roughnessBlendLevel), C.a.BindTextureMatrix(this._texture, g, "detail")), u.texturesEnabled && this._texture && c.a.DetailTextureEnabled && g.setTexture("detailSampler", this._texture));
+ }, R.prototype.hasTexture = function(g) {
+ return this._texture === g;
+ }, R.prototype.getActiveTextures = function(g) {
+ this._texture && g.push(this._texture);
+ }, R.prototype.getAnimatables = function(g) {
+ this._texture && this._texture.animations && this._texture.animations.length > 0 && g.push(this._texture);
+ }, R.prototype.dispose = function(g) {
+ var u;
+ g && ((u = this._texture) === null || u === void 0 || u.dispose());
+ }, R.prototype.getClassName = function() {
+ return "DetailMap";
+ }, R.AddUniforms = function(g) {
+ g.push("vDetailInfos");
+ }, R.AddSamplers = function(g) {
+ g.push("detailSampler");
+ }, R.PrepareUniformBuffer = function(g) {
+ g.addUniform("vDetailInfos", 4), g.addUniform("detailMatrix", 16);
+ }, R.prototype.copyTo = function(g) {
+ P.a.Clone(function() {
+ return g;
+ }, this);
+ }, R.prototype.serialize = function() {
+ return P.a.Serialize(this);
+ }, R.prototype.parse = function(g, u, E) {
+ var A = this;
+ P.a.Parse(function() {
+ return A;
+ }, g, u, E);
+ }, Object(D.c)([Object(P.m)("detailTexture"), Object(P.b)("_markAllSubMeshesAsTexturesDirty")], R.prototype, "texture", void 0), Object(D.c)([Object(P.c)()], R.prototype, "diffuseBlendLevel", void 0), Object(D.c)([Object(P.c)()], R.prototype, "roughnessBlendLevel", void 0), Object(D.c)([Object(P.c)()], R.prototype, "bumpLevel", void 0), Object(D.c)([Object(P.c)(), Object(P.b)("_markAllSubMeshesAsTexturesDirty")], R.prototype, "normalBlendMethod", void 0), Object(D.c)([Object(P.c)(), Object(P.b)("_markAllSubMeshesAsTexturesDirty")], R.prototype, "isEnabled", void 0), R;
+ }();
+ }, function(V, _, l) {
+ var D = "morphTargetsVertexGlobalDeclaration", f = `#ifdef MORPHTARGETS
+uniform float morphTargetInfluences[NUM_MORPH_INFLUENCERS];
+#endif`;
+ l(5).a.IncludesShadersStore[D] = f;
+ }, function(V, _, l) {
+ var D = "morphTargetsVertexDeclaration", f = `#ifdef MORPHTARGETS
+attribute vec3 position{X};
+#ifdef MORPHTARGETS_NORMAL
+attribute vec3 normal{X};
+#endif
+#ifdef MORPHTARGETS_TANGENT
+attribute vec3 tangent{X};
+#endif
+#ifdef MORPHTARGETS_UV
+attribute vec2 uv_{X};
+#endif
+#endif`;
+ l(5).a.IncludesShadersStore[D] = f;
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return c;
+ });
+ var D = l(25), f = l(4), P = l(2), c = function() {
+ function C(x) {
+ this._vertexBuffers = {}, this._scene = x;
+ }
+ return C.prototype._prepareBuffers = function() {
+ if (!this._vertexBuffers[f.b.PositionKind]) {
+ var x = [];
+ x.push(1, 1), x.push(-1, 1), x.push(-1, -1), x.push(1, -1), this._vertexBuffers[f.b.PositionKind] = new f.b(this._scene.getEngine(), x, f.b.PositionKind, !1, !1, 2), this._buildIndexBuffer();
+ }
+ }, C.prototype._buildIndexBuffer = function() {
+ var x = [];
+ x.push(0), x.push(1), x.push(2), x.push(0), x.push(2), x.push(3), this._indexBuffer = this._scene.getEngine().createIndexBuffer(x);
+ }, C.prototype._rebuild = function() {
+ var x = this._vertexBuffers[f.b.PositionKind];
+ x && (x._rebuild(), this._buildIndexBuffer());
+ }, C.prototype._prepareFrame = function(x, R) {
+ x === void 0 && (x = null), R === void 0 && (R = null);
+ var g = this._scene.activeCamera;
+ return !!g && !(!(R = R || g._postProcesses.filter(function(u) {
+ return u != null;
+ })) || R.length === 0 || !this._scene.postProcessesEnabled) && (R[0].activate(g, x, R != null), !0);
+ }, C.prototype.directRender = function(x, R, g, u, E, A) {
+ R === void 0 && (R = null), g === void 0 && (g = !1), u === void 0 && (u = 0), E === void 0 && (E = 0), A === void 0 && (A = !1);
+ for (var y = this._scene.getEngine(), v = 0; v < x.length; v++) {
+ v < x.length - 1 ? x[v + 1].activate(this._scene.activeCamera, R) : R ? y.bindFramebuffer(R, u, void 0, void 0, g, E) : A || y.restoreDefaultFramebuffer();
+ var h = x[v], d = h.apply();
+ d && (h.onBeforeRenderObservable.notifyObservers(d), this._prepareBuffers(), y.bindBuffers(this._vertexBuffers, this._indexBuffer, d), y.drawElementsType(D.a.TriangleFillMode, 0, 6), h.onAfterRenderObservable.notifyObservers(d));
+ }
+ y.setDepthBuffer(!0), y.setDepthWrite(!0);
+ }, C.prototype._finalizeFrame = function(x, R, g, u, E) {
+ E === void 0 && (E = !1);
+ var A = this._scene.activeCamera;
+ if (A && (u = u || A._postProcesses.filter(function(T) {
+ return T != null;
+ })).length !== 0 && this._scene.postProcessesEnabled) {
+ for (var y = this._scene.getEngine(), v = 0, h = u.length; v < h; v++) {
+ var d = u[v];
+ if (v < h - 1 ? d._outputTexture = u[v + 1].activate(A, R) : R ? (y.bindFramebuffer(R, g, void 0, void 0, E), d._outputTexture = R) : (y.restoreDefaultFramebuffer(), d._outputTexture = null), x)
+ break;
+ var b = d.apply();
+ b && (d.onBeforeRenderObservable.notifyObservers(b), this._prepareBuffers(), y.bindBuffers(this._vertexBuffers, this._indexBuffer, b), y.drawElementsType(D.a.TriangleFillMode, 0, 6), d.onAfterRenderObservable.notifyObservers(b));
+ }
+ y.setDepthBuffer(!0), y.setDepthWrite(!0), y.setAlphaMode(P.a.ALPHA_DISABLE);
+ }
+ }, C.prototype.dispose = function() {
+ var x = this._vertexBuffers[f.b.PositionKind];
+ x && (x.dispose(), this._vertexBuffers[f.b.PositionKind] = null), this._indexBuffer && (this._scene.getEngine()._releaseBuffer(this._indexBuffer), this._indexBuffer = null);
+ }, C;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return f;
+ }), l.d(_, "b", function() {
+ return P;
+ });
+ var D = l(148), f = function() {
+ }, P = function() {
+ function c(C) {
+ this._useSceneAutoClearSetup = !1, this._renderingGroups = new Array(), this._autoClearDepthStencil = {}, this._customOpaqueSortCompareFn = {}, this._customAlphaTestSortCompareFn = {}, this._customTransparentSortCompareFn = {}, this._renderingGroupInfo = new f(), this._scene = C;
+ for (var x = c.MIN_RENDERINGGROUPS; x < c.MAX_RENDERINGGROUPS; x++)
+ this._autoClearDepthStencil[x] = { autoClear: !0, depth: !0, stencil: !0 };
+ }
+ return c.prototype._clearDepthStencilBuffer = function(C, x) {
+ C === void 0 && (C = !0), x === void 0 && (x = !0), this._depthStencilBufferAlreadyCleaned || (this._scene.getEngine().clear(null, !1, C, x), this._depthStencilBufferAlreadyCleaned = !0);
+ }, c.prototype.render = function(C, x, R, g) {
+ var u = this._renderingGroupInfo;
+ if (u.scene = this._scene, u.camera = this._scene.activeCamera, this._scene.spriteManagers && g)
+ for (var E = 0; E < this._scene.spriteManagers.length; E++) {
+ var A = this._scene.spriteManagers[E];
+ this.dispatchSprites(A);
+ }
+ for (E = c.MIN_RENDERINGGROUPS; E < c.MAX_RENDERINGGROUPS; E++) {
+ this._depthStencilBufferAlreadyCleaned = E === c.MIN_RENDERINGGROUPS;
+ var y = this._renderingGroups[E];
+ if (y) {
+ var v = Math.pow(2, E);
+ if (u.renderingGroupId = E, this._scene.onBeforeRenderingGroupObservable.notifyObservers(u, v), c.AUTOCLEAR) {
+ var h = this._useSceneAutoClearSetup ? this._scene.getAutoClearDepthStencilSetup(E) : this._autoClearDepthStencil[E];
+ h && h.autoClear && this._clearDepthStencilBuffer(h.depth, h.stencil);
+ }
+ for (var d = 0, b = this._scene._beforeRenderingGroupDrawStage; d < b.length; d++)
+ b[d].action(E);
+ y.render(C, g, R, x);
+ for (var T = 0, N = this._scene._afterRenderingGroupDrawStage; T < N.length; T++)
+ N[T].action(E);
+ this._scene.onAfterRenderingGroupObservable.notifyObservers(u, v);
+ }
+ }
+ }, c.prototype.reset = function() {
+ for (var C = c.MIN_RENDERINGGROUPS; C < c.MAX_RENDERINGGROUPS; C++) {
+ var x = this._renderingGroups[C];
+ x && x.prepare();
+ }
+ }, c.prototype.dispose = function() {
+ this.freeRenderingGroups(), this._renderingGroups.length = 0, this._renderingGroupInfo = null;
+ }, c.prototype.freeRenderingGroups = function() {
+ for (var C = c.MIN_RENDERINGGROUPS; C < c.MAX_RENDERINGGROUPS; C++) {
+ var x = this._renderingGroups[C];
+ x && x.dispose();
+ }
+ }, c.prototype._prepareRenderingGroup = function(C) {
+ this._renderingGroups[C] === void 0 && (this._renderingGroups[C] = new D.a(C, this._scene, this._customOpaqueSortCompareFn[C], this._customAlphaTestSortCompareFn[C], this._customTransparentSortCompareFn[C]));
+ }, c.prototype.dispatchSprites = function(C) {
+ var x = C.renderingGroupId || 0;
+ this._prepareRenderingGroup(x), this._renderingGroups[x].dispatchSprites(C);
+ }, c.prototype.dispatchParticles = function(C) {
+ var x = C.renderingGroupId || 0;
+ this._prepareRenderingGroup(x), this._renderingGroups[x].dispatchParticles(C);
+ }, c.prototype.dispatch = function(C, x, R) {
+ x === void 0 && (x = C.getMesh());
+ var g = x.renderingGroupId || 0;
+ this._prepareRenderingGroup(g), this._renderingGroups[g].dispatch(C, x, R);
+ }, c.prototype.setRenderingOrder = function(C, x, R, g) {
+ if (x === void 0 && (x = null), R === void 0 && (R = null), g === void 0 && (g = null), this._customOpaqueSortCompareFn[C] = x, this._customAlphaTestSortCompareFn[C] = R, this._customTransparentSortCompareFn[C] = g, this._renderingGroups[C]) {
+ var u = this._renderingGroups[C];
+ u.opaqueSortCompareFn = this._customOpaqueSortCompareFn[C], u.alphaTestSortCompareFn = this._customAlphaTestSortCompareFn[C], u.transparentSortCompareFn = this._customTransparentSortCompareFn[C];
+ }
+ }, c.prototype.setRenderingAutoClearDepthStencil = function(C, x, R, g) {
+ R === void 0 && (R = !0), g === void 0 && (g = !0), this._autoClearDepthStencil[C] = { autoClear: x, depth: R, stencil: g };
+ }, c.prototype.getAutoClearDepthStencilSetup = function(C) {
+ return this._autoClearDepthStencil[C];
+ }, c.MAX_RENDERINGGROUPS = 4, c.MIN_RENDERINGGROUPS = 0, c.AUTOCLEAR = !0, c;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return C;
+ });
+ var D = l(0), f = l(7), P = l(82), c = l(72);
+ f.a.ExtrudeShape = function(x, R, g, u, E, A, y, v, h, d) {
+ y === void 0 && (y = null);
+ var b = { shape: R, path: g, scale: u, rotation: E, cap: A === 0 ? 0 : A || f.a.NO_CAP, sideOrientation: h, instance: d, updatable: v };
+ return C.ExtrudeShape(x, b, y);
+ }, f.a.ExtrudeShapeCustom = function(x, R, g, u, E, A, y, v, h, d, b, T) {
+ var N = { shape: R, path: g, scaleFunction: u, rotationFunction: E, ribbonCloseArray: A, ribbonClosePath: y, cap: v === 0 ? 0 : v || f.a.NO_CAP, sideOrientation: b, instance: T, updatable: d };
+ return C.ExtrudeShapeCustom(x, N, h);
+ };
+ var C = function() {
+ function x() {
+ }
+ return x.ExtrudeShape = function(R, g, u) {
+ u === void 0 && (u = null);
+ var E = g.path, A = g.shape, y = g.scale || 1, v = g.rotation || 0, h = g.cap === 0 ? 0 : g.cap || f.a.NO_CAP, d = g.updatable, b = f.a._GetDefaultSideOrientation(g.sideOrientation), T = g.instance || null, N = g.invertUV || !1;
+ return x._ExtrudeShapeGeneric(R, A, E, y, v, null, null, !1, !1, h, !1, u, !!d, b, T, N, g.frontUVs || null, g.backUVs || null);
+ }, x.ExtrudeShapeCustom = function(R, g, u) {
+ u === void 0 && (u = null);
+ var E = g.path, A = g.shape, y = g.scaleFunction || function() {
+ return 1;
+ }, v = g.rotationFunction || function() {
+ return 0;
+ }, h = g.ribbonCloseArray || !1, d = g.ribbonClosePath || !1, b = g.cap === 0 ? 0 : g.cap || f.a.NO_CAP, T = g.updatable, N = f.a._GetDefaultSideOrientation(g.sideOrientation), U = g.instance, B = g.invertUV || !1;
+ return x._ExtrudeShapeGeneric(R, A, E, null, null, y, v, h, d, b, !0, u, !!T, N, U || null, B, g.frontUVs || null, g.backUVs || null);
+ }, x._ExtrudeShapeGeneric = function(R, g, u, E, A, y, v, h, d, b, T, N, U, B, L, j, W, Y) {
+ var oe, te, _e = function(ie, Z, ee, w, z, q, le, ce, J, H) {
+ for (var X = ee.getTangents(), ne = ee.getNormals(), Q = ee.getBinormals(), $ = ee.getDistances(), me = 0, ye = H && ce ? ce : function() {
+ return q !== null ? q : 0;
+ }, be = H && le ? le : function() {
+ return z !== null ? z : 1;
+ }, ge = J === f.a.NO_CAP || J === f.a.CAP_END ? 0 : 2, Te = D.c.Matrix[0], Re = 0; Re < Z.length; Re++) {
+ for (var Se = new Array(), Ne = ye(Re, $[Re]), ze = be(Re, $[Re]), Ye = 0; Ye < ie.length; Ye++) {
+ D.a.RotationAxisToRef(X[Re], me, Te);
+ var He = X[Re].scale(ie[Ye].z).add(ne[Re].scale(ie[Ye].x)).add(Q[Re].scale(ie[Ye].y)), Xe = Se[Ye] ? Se[Ye] : D.e.Zero();
+ D.e.TransformCoordinatesToRef(He, Te, Xe), Xe.scaleInPlace(ze).addInPlace(Z[Re]), Se[Ye] = Xe;
+ }
+ w[ge] = Se, me += Ne, ge++;
+ }
+ var Ze = function(je) {
+ var it, et = Array(), lt = D.e.Zero();
+ for (it = 0; it < je.length; it++)
+ lt.addInPlace(je[it]);
+ for (lt.scaleInPlace(1 / je.length), it = 0; it < je.length; it++)
+ et.push(lt);
+ return et;
+ };
+ switch (J) {
+ case f.a.NO_CAP:
+ break;
+ case f.a.CAP_START:
+ w[0] = Ze(w[2]), w[1] = w[2];
+ break;
+ case f.a.CAP_END:
+ w[ge] = w[ge - 1], w[ge + 1] = Ze(w[ge - 1]);
+ break;
+ case f.a.CAP_ALL:
+ w[0] = Ze(w[2]), w[1] = w[2], w[ge] = w[ge - 1], w[ge + 1] = Ze(w[ge - 1]);
+ }
+ return w;
+ };
+ if (L) {
+ var de = L._creationDataStorage;
+ return oe = de.path3D.update(u), te = _e(g, u, de.path3D, de.pathArray, E, A, y, v, de.cap, T), L = f.a.CreateRibbon("", te, !1, !1, 0, N || void 0, !1, 0, L);
+ }
+ te = _e(g, u, oe = new c.g(u), new Array(), E, A, y, v, b = b < 0 || b > 3 ? 0 : b, T);
+ var ae = P.a.CreateRibbon(R, { pathArray: te, closeArray: h, closePath: d, updatable: U, sideOrientation: B, invertUV: j, frontUVs: W || void 0, backUVs: Y || void 0 }, N);
+ return ae._creationDataStorage.pathArray = te, ae._creationDataStorage.path3D = oe, ae._creationDataStorage.cap = b, ae;
+ }, x;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "b", function() {
+ return u;
+ }), l.d(_, "a", function() {
+ return E;
+ });
+ var D = l(1), f = l(9), P = l(4), c = l(7), C = l(151), x = l(25), R = l(73), g = l(15), u = (l(166), l(167), function(A) {
+ function y(v, h, d, b, T, N, U) {
+ h === void 0 && (h = null), d === void 0 && (d = null), b === void 0 && (b = null);
+ var B = A.call(this, v, h, d, b, T) || this;
+ B.useVertexColor = N, B.useVertexAlpha = U, B.color = new f.a(1, 1, 1), B.alpha = 1, b && (B.color = b.color.clone(), B.alpha = b.alpha, B.useVertexColor = b.useVertexColor, B.useVertexAlpha = b.useVertexAlpha), B.intersectionThreshold = 0.1;
+ var L = { attributes: [P.b.PositionKind, "world0", "world1", "world2", "world3"], uniforms: ["vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6", "world", "viewProjection"], needAlphaBlending: !0, defines: [] };
+ return U === !1 && (L.needAlphaBlending = !1), N ? (L.defines.push("#define VERTEXCOLOR"), L.attributes.push(P.b.ColorKind)) : (L.uniforms.push("color"), B.color4 = new f.b()), B._colorShader = new R.a("colorShader", B.getScene(), "color", L), B;
+ }
+ return Object(D.d)(y, A), y.prototype._addClipPlaneDefine = function(v) {
+ var h = "#define " + v;
+ this._colorShader.options.defines.indexOf(h) === -1 && this._colorShader.options.defines.push(h);
+ }, y.prototype._removeClipPlaneDefine = function(v) {
+ var h = "#define " + v, d = this._colorShader.options.defines.indexOf(h);
+ d !== -1 && this._colorShader.options.defines.splice(d, 1);
+ }, y.prototype.isReady = function() {
+ var v = this.getScene();
+ return v.clipPlane ? this._addClipPlaneDefine("CLIPPLANE") : this._removeClipPlaneDefine("CLIPPLANE"), v.clipPlane2 ? this._addClipPlaneDefine("CLIPPLANE2") : this._removeClipPlaneDefine("CLIPPLANE2"), v.clipPlane3 ? this._addClipPlaneDefine("CLIPPLANE3") : this._removeClipPlaneDefine("CLIPPLANE3"), v.clipPlane4 ? this._addClipPlaneDefine("CLIPPLANE4") : this._removeClipPlaneDefine("CLIPPLANE4"), v.clipPlane5 ? this._addClipPlaneDefine("CLIPPLANE5") : this._removeClipPlaneDefine("CLIPPLANE5"), v.clipPlane6 ? this._addClipPlaneDefine("CLIPPLANE6") : this._removeClipPlaneDefine("CLIPPLANE6"), !!this._colorShader.isReady(this) && A.prototype.isReady.call(this);
+ }, y.prototype.getClassName = function() {
+ return "LinesMesh";
+ }, Object.defineProperty(y.prototype, "material", { get: function() {
+ return this._colorShader;
+ }, set: function(v) {
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(y.prototype, "checkCollisions", { get: function() {
+ return !1;
+ }, enumerable: !1, configurable: !0 }), y.prototype._bind = function(v, h, d) {
+ if (!this._geometry)
+ return this;
+ var b = this._colorShader.getEffect(), T = this.isUnIndexed ? null : this._geometry.getIndexBuffer();
+ if (this._geometry._bind(b, T), !this.useVertexColor) {
+ var N = this.color, U = N.r, B = N.g, L = N.b;
+ this.color4.set(U, B, L, this.alpha), this._colorShader.setColor4("color", this.color4);
+ }
+ return g.a.BindClipPlane(b, this.getScene()), this;
+ }, y.prototype._draw = function(v, h, d) {
+ if (!this._geometry || !this._geometry.getVertexBuffers() || !this._unIndexed && !this._geometry.getIndexBuffer())
+ return this;
+ var b = this.getScene().getEngine();
+ return this._unIndexed ? b.drawArraysType(x.a.LineListDrawMode, v.verticesStart, v.verticesCount, d) : b.drawElementsType(x.a.LineListDrawMode, v.indexStart, v.indexCount, d), this;
+ }, y.prototype.dispose = function(v) {
+ this._colorShader.dispose(!1, !1, !0), A.prototype.dispose.call(this, v);
+ }, y.prototype.clone = function(v, h, d) {
+ return h === void 0 && (h = null), new y(v, this.getScene(), h, this, d);
+ }, y.prototype.createInstance = function(v) {
+ return new E(v, this);
+ }, y;
+ }(c.a)), E = function(A) {
+ function y(v, h) {
+ var d = A.call(this, v, h) || this;
+ return d.intersectionThreshold = h.intersectionThreshold, d;
+ }
+ return Object(D.d)(y, A), y.prototype.getClassName = function() {
+ return "InstancedLinesMesh";
+ }, y;
+ }(C.a);
+ }, function(V, _, l) {
+ l.r(_), l.d(_, "AxesViewer", function() {
+ return x;
+ }), l.d(_, "BoneAxesViewer", function() {
+ return u;
+ }), l.d(_, "DebugLayerTab", function() {
+ return D;
+ }), l.d(_, "DebugLayer", function() {
+ return h;
+ }), l.d(_, "PhysicsViewer", function() {
+ return j;
+ }), l.d(_, "RayHelper", function() {
+ return Y;
+ }), l.d(_, "SkeletonViewer", function() {
+ return Z;
+ });
+ var D, f = l(0), P = l(30), c = l(75), C = l(9), x = function() {
+ function ee(w, z, q, le, ce, J) {
+ if (z === void 0 && (z = 1), q === void 0 && (q = 2), this._scaleLinesFactor = 4, this._instanced = !1, this.scene = null, this.scaleLines = 1, this.scaleLines = z, !le) {
+ var H = new P.a("", w);
+ H.disableLighting = !0, H.emissiveColor = C.a.Red().scale(0.5), le = c.a._CreateArrow(w, H);
+ }
+ if (!ce) {
+ var X = new P.a("", w);
+ X.disableLighting = !0, X.emissiveColor = C.a.Green().scale(0.5), ce = c.a._CreateArrow(w, X);
+ }
+ if (!J) {
+ var ne = new P.a("", w);
+ ne.disableLighting = !0, ne.emissiveColor = C.a.Blue().scale(0.5), J = c.a._CreateArrow(w, ne);
+ }
+ this._xAxis = le, this._xAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor), this._yAxis = ce, this._yAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor), this._zAxis = J, this._zAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor), q != null && (ee._SetRenderingGroupId(this._xAxis, q), ee._SetRenderingGroupId(this._yAxis, q), ee._SetRenderingGroupId(this._zAxis, q)), this.scene = w, this.update(new f.e(), f.e.Right(), f.e.Up(), f.e.Forward());
+ }
+ return Object.defineProperty(ee.prototype, "xAxis", { get: function() {
+ return this._xAxis;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ee.prototype, "yAxis", { get: function() {
+ return this._yAxis;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ee.prototype, "zAxis", { get: function() {
+ return this._zAxis;
+ }, enumerable: !1, configurable: !0 }), ee.prototype.update = function(w, z, q, le) {
+ this._xAxis.position.copyFrom(w), this._xAxis.setDirection(z), this._xAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor), this._yAxis.position.copyFrom(w), this._yAxis.setDirection(q), this._yAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor), this._zAxis.position.copyFrom(w), this._zAxis.setDirection(le), this._zAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
+ }, ee.prototype.createInstance = function() {
+ var w = c.a._CreateArrowInstance(this.scene, this._xAxis), z = c.a._CreateArrowInstance(this.scene, this._yAxis), q = c.a._CreateArrowInstance(this.scene, this._zAxis), le = new ee(this.scene, this.scaleLines, null, w, z, q);
+ return le._instanced = !0, le;
+ }, ee.prototype.dispose = function() {
+ this._xAxis && this._xAxis.dispose(!1, !this._instanced), this._yAxis && this._yAxis.dispose(!1, !this._instanced), this._zAxis && this._zAxis.dispose(!1, !this._instanced), this.scene = null;
+ }, ee._SetRenderingGroupId = function(w, z) {
+ w.getChildMeshes().forEach(function(q) {
+ q.renderingGroupId = z;
+ });
+ }, ee;
+ }(), R = l(1), g = l(23), u = function(ee) {
+ function w(z, q, le, ce) {
+ ce === void 0 && (ce = 1);
+ var J = ee.call(this, z, ce) || this;
+ return J.pos = f.e.Zero(), J.xaxis = f.e.Zero(), J.yaxis = f.e.Zero(), J.zaxis = f.e.Zero(), J.mesh = le, J.bone = q, J;
+ }
+ return Object(R.d)(w, ee), w.prototype.update = function() {
+ if (this.mesh && this.bone) {
+ var z = this.bone;
+ z._markAsDirtyAndCompose(), z.getAbsolutePositionToRef(this.mesh, this.pos), z.getDirectionToRef(g.a.X, this.mesh, this.xaxis), z.getDirectionToRef(g.a.Y, this.mesh, this.yaxis), z.getDirectionToRef(g.a.Z, this.mesh, this.zaxis), ee.prototype.update.call(this, this.pos, this.xaxis, this.yaxis, this.zaxis);
+ }
+ }, w.prototype.dispose = function() {
+ this.mesh && (this.mesh = null, this.bone = null, ee.prototype.dispose.call(this));
+ }, w;
+ }(x), E = l(12), A = l(6), y = l(20), v = l(13);
+ Object.defineProperty(y.a.prototype, "debugLayer", { get: function() {
+ return this._debugLayer || (this._debugLayer = new h(this)), this._debugLayer;
+ }, enumerable: !0, configurable: !0 }), function(ee) {
+ ee[ee.Properties = 0] = "Properties", ee[ee.Debug = 1] = "Debug", ee[ee.Statistics = 2] = "Statistics", ee[ee.Tools = 3] = "Tools", ee[ee.Settings = 4] = "Settings";
+ }(D || (D = {}));
+ var h = function() {
+ function ee(w) {
+ var z = this;
+ this.BJSINSPECTOR = this._getGlobalInspector(), this._scene = w, this._scene.onDisposeObservable.add(function() {
+ z._scene._debugLayer && z._scene._debugLayer.hide();
+ });
+ }
+ return Object.defineProperty(ee.prototype, "onPropertyChangedObservable", { get: function() {
+ return this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector ? this.BJSINSPECTOR.Inspector.OnPropertyChangedObservable : (this._onPropertyChangedObservable || (this._onPropertyChangedObservable = new A.c()), this._onPropertyChangedObservable);
+ }, enumerable: !1, configurable: !0 }), ee.prototype._createInspector = function(w) {
+ if (!this.isVisible()) {
+ if (this._onPropertyChangedObservable) {
+ for (var z = 0, q = this._onPropertyChangedObservable.observers; z < q.length; z++) {
+ var le = q[z];
+ this.BJSINSPECTOR.Inspector.OnPropertyChangedObservable.add(le);
+ }
+ this._onPropertyChangedObservable.clear(), this._onPropertyChangedObservable = void 0;
+ }
+ var ce = Object(R.a)({ overlay: !1, showExplorer: !0, showInspector: !0, embedMode: !1, handleResize: !0, enablePopup: !0 }, w);
+ this.BJSINSPECTOR = this.BJSINSPECTOR || this._getGlobalInspector(), this.BJSINSPECTOR.Inspector.Show(this._scene, ce);
+ }
+ }, ee.prototype.select = function(w, z) {
+ this.BJSINSPECTOR && (z && (Object.prototype.toString.call(z) == "[object String]" ? this.BJSINSPECTOR.Inspector.MarkLineContainerTitleForHighlighting(z) : this.BJSINSPECTOR.Inspector.MarkMultipleLineContainerTitlesForHighlighting(z)), this.BJSINSPECTOR.Inspector.OnSelectionChangeObservable.notifyObservers(w));
+ }, ee.prototype._getGlobalInspector = function() {
+ return typeof INSPECTOR < "u" ? INSPECTOR : typeof BABYLON < "u" && BABYLON.Inspector !== void 0 ? BABYLON : void 0;
+ }, ee.prototype.isVisible = function() {
+ return this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector.IsVisible;
+ }, ee.prototype.hide = function() {
+ this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector.Hide();
+ }, ee.prototype.setAsActiveScene = function() {
+ this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector._SetNewScene(this._scene);
+ }, ee.prototype.show = function(w) {
+ var z = this;
+ return new Promise(function(q, le) {
+ if (z.BJSINSPECTOR === void 0) {
+ var ce = w && w.inspectorURL ? w.inspectorURL : ee.InspectorURL;
+ E.b.LoadScript(ce, function() {
+ z._createInspector(w), q(z);
+ });
+ } else
+ z._createInspector(w), q(z);
+ });
+ }, ee.InspectorURL = "https://unpkg.com/babylonjs-inspector@" + v.a.Version + "/babylon.inspector.bundle.js", ee;
+ }(), d = l(7), b = l(63), T = l(45), N = l(22), U = l(32), B = l(36), L = l(53), j = function() {
+ function ee(w) {
+ this._impostors = [], this._meshes = [], this._numMeshes = 0, this._debugMeshMeshes = new Array(), this._scene = w || N.a.LastCreatedScene;
+ var z = this._scene.getPhysicsEngine();
+ z && (this._physicsEnginePlugin = z.getPhysicsPlugin()), this._utilityLayer = new B.a(this._scene, !1), this._utilityLayer.pickUtilitySceneFirst = !1, this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil = !0;
+ }
+ return ee.prototype._updateDebugMeshes = function() {
+ for (var w = this._physicsEnginePlugin, z = 0; z < this._numMeshes; z++) {
+ var q = this._impostors[z];
+ if (q)
+ if (q.isDisposed)
+ this.hideImpostor(this._impostors[z--]);
+ else {
+ if (q.type === U.a.MeshImpostor)
+ continue;
+ var le = this._meshes[z];
+ le && w && w.syncMeshWithImpostor(le, q);
+ }
+ }
+ }, ee.prototype.showImpostor = function(w, z) {
+ if (!this._scene)
+ return null;
+ for (var q = 0; q < this._numMeshes; q++)
+ if (this._impostors[q] == w)
+ return null;
+ var le = this._getDebugMesh(w, z);
+ return le && (this._impostors[this._numMeshes] = w, this._meshes[this._numMeshes] = le, this._numMeshes === 0 && (this._renderFunction = this._updateDebugMeshes.bind(this), this._scene.registerBeforeRender(this._renderFunction)), this._numMeshes++), le;
+ }, ee.prototype.hideImpostor = function(w) {
+ if (w && this._scene && this._utilityLayer) {
+ for (var z = !1, q = this._utilityLayer.utilityLayerScene, le = 0; le < this._numMeshes; le++)
+ if (this._impostors[le] == w) {
+ var ce = this._meshes[le];
+ if (!ce)
+ continue;
+ q.removeMesh(ce), ce.dispose();
+ var J = this._debugMeshMeshes.indexOf(ce);
+ J > -1 && this._debugMeshMeshes.splice(J, 1), this._numMeshes--, this._numMeshes > 0 ? (this._meshes[le] = this._meshes[this._numMeshes], this._impostors[le] = this._impostors[this._numMeshes], this._meshes[this._numMeshes] = null, this._impostors[this._numMeshes] = null) : (this._meshes[0] = null, this._impostors[0] = null), z = !0;
+ break;
+ }
+ z && this._numMeshes === 0 && this._scene.unregisterBeforeRender(this._renderFunction);
+ }
+ }, ee.prototype._getDebugMaterial = function(w) {
+ return this._debugMaterial || (this._debugMaterial = new P.a("", w), this._debugMaterial.wireframe = !0, this._debugMaterial.emissiveColor = C.a.White(), this._debugMaterial.disableLighting = !0), this._debugMaterial;
+ }, ee.prototype._getDebugBoxMesh = function(w) {
+ return this._debugBoxMesh || (this._debugBoxMesh = b.a.CreateBox("physicsBodyBoxViewMesh", { size: 1 }, w), this._debugBoxMesh.rotationQuaternion = f.b.Identity(), this._debugBoxMesh.material = this._getDebugMaterial(w), this._debugBoxMesh.setEnabled(!1)), this._debugBoxMesh.createInstance("physicsBodyBoxViewInstance");
+ }, ee.prototype._getDebugSphereMesh = function(w) {
+ return this._debugSphereMesh || (this._debugSphereMesh = T.a.CreateSphere("physicsBodySphereViewMesh", { diameter: 1 }, w), this._debugSphereMesh.rotationQuaternion = f.b.Identity(), this._debugSphereMesh.material = this._getDebugMaterial(w), this._debugSphereMesh.setEnabled(!1)), this._debugSphereMesh.createInstance("physicsBodyBoxViewInstance");
+ }, ee.prototype._getDebugCylinderMesh = function(w) {
+ return this._debugCylinderMesh || (this._debugCylinderMesh = L.a.CreateCylinder("physicsBodyCylinderViewMesh", { diameterTop: 1, diameterBottom: 1, height: 1 }, w), this._debugCylinderMesh.rotationQuaternion = f.b.Identity(), this._debugCylinderMesh.material = this._getDebugMaterial(w), this._debugCylinderMesh.setEnabled(!1)), this._debugCylinderMesh.createInstance("physicsBodyBoxViewInstance");
+ }, ee.prototype._getDebugMeshMesh = function(w, z) {
+ var q = new d.a(w.name, z, null, w);
+ return q.position = f.e.Zero(), q.setParent(w), q.material = this._getDebugMaterial(z), this._debugMeshMeshes.push(q), q;
+ }, ee.prototype._getDebugMesh = function(w, z) {
+ var q = this;
+ if (!this._utilityLayer || z && z.parent && z.parent.physicsImpostor)
+ return null;
+ var le = null, ce = this._utilityLayer.utilityLayerScene;
+ switch (w.type) {
+ case U.a.BoxImpostor:
+ le = this._getDebugBoxMesh(ce), w.getBoxSizeToRef(le.scaling);
+ break;
+ case U.a.SphereImpostor:
+ le = this._getDebugSphereMesh(ce);
+ var J = w.getRadius();
+ le.scaling.x = 2 * J, le.scaling.y = 2 * J, le.scaling.z = 2 * J;
+ break;
+ case U.a.MeshImpostor:
+ z && (le = this._getDebugMeshMesh(z, ce));
+ break;
+ case U.a.NoImpostor:
+ z && z.getChildMeshes().filter(function(X) {
+ return X.physicsImpostor ? 1 : 0;
+ }).forEach(function(X) {
+ q._getDebugBoxMesh(ce).parent = X;
+ });
+ break;
+ case U.a.CylinderImpostor:
+ le = this._getDebugCylinderMesh(ce);
+ var H = w.object.getBoundingInfo();
+ le.scaling.x = H.boundingBox.maximum.x - H.boundingBox.minimum.x, le.scaling.y = H.boundingBox.maximum.y - H.boundingBox.minimum.y, le.scaling.z = H.boundingBox.maximum.z - H.boundingBox.minimum.z;
+ }
+ return le;
+ }, ee.prototype.dispose = function() {
+ for (var w = this._numMeshes, z = 0; z < w; z++)
+ this.hideImpostor(this._impostors[0]);
+ this._debugBoxMesh && this._debugBoxMesh.dispose(), this._debugSphereMesh && this._debugSphereMesh.dispose(), this._debugCylinderMesh && this._debugCylinderMesh.dispose(), this._debugMaterial && this._debugMaterial.dispose(), this._impostors.length = 0, this._scene = null, this._physicsEnginePlugin = null, this._utilityLayer && (this._utilityLayer.dispose(), this._utilityLayer = null);
+ }, ee;
+ }(), W = l(40), Y = function() {
+ function ee(w) {
+ this.ray = w;
+ }
+ return ee.CreateAndShow = function(w, z, q) {
+ var le = new ee(w);
+ return le.show(z, q), le;
+ }, ee.prototype.show = function(w, z) {
+ if (!this._renderFunction && this.ray) {
+ var q = this.ray;
+ this._renderFunction = this._render.bind(this), this._scene = w, this._renderPoints = [q.origin, q.origin.add(q.direction.scale(q.length))], this._renderLine = d.a.CreateLines("ray", this._renderPoints, w, !0), this._renderLine.isPickable = !1, this._renderFunction && this._scene.registerBeforeRender(this._renderFunction);
+ }
+ z && this._renderLine && this._renderLine.color.copyFrom(z);
+ }, ee.prototype.hide = function() {
+ this._renderFunction && this._scene && (this._scene.unregisterBeforeRender(this._renderFunction), this._scene = null, this._renderFunction = null, this._renderLine && (this._renderLine.dispose(), this._renderLine = null), this._renderPoints = []);
+ }, ee.prototype._render = function() {
+ var w = this.ray;
+ if (w) {
+ var z = this._renderPoints[1], q = Math.min(w.length, 1e6);
+ z.copyFrom(w.direction), z.scaleInPlace(q), z.addInPlace(w.origin), this._renderPoints[0].copyFrom(w.origin), d.a.CreateLines("ray", this._renderPoints, this._scene, !0, this._renderLine);
+ }
+ }, ee.prototype.attachToMesh = function(w, z, q, le) {
+ var ce = this;
+ this._attachedToMesh = w;
+ var J = this.ray;
+ J && (J.direction || (J.direction = f.e.Zero()), J.origin || (J.origin = f.e.Zero()), le && (J.length = le), q || (q = f.e.Zero()), z || (z = new f.e(0, 0, -1)), this._scene || (this._scene = w.getScene()), this._meshSpaceDirection ? (this._meshSpaceDirection.copyFrom(z), this._meshSpaceOrigin.copyFrom(q)) : (this._meshSpaceDirection = z.clone(), this._meshSpaceOrigin = q.clone()), this._onAfterRenderObserver || (this._onAfterRenderObserver = this._scene.onBeforeRenderObservable.add(function() {
+ return ce._updateToMesh();
+ }), this._onAfterStepObserver = this._scene.onAfterStepObservable.add(function() {
+ return ce._updateToMesh();
+ })), this._attachedToMesh.computeWorldMatrix(!0), this._updateToMesh());
+ }, ee.prototype.detachFromMesh = function() {
+ this._attachedToMesh && this._scene && (this._onAfterRenderObserver && (this._scene.onBeforeRenderObservable.remove(this._onAfterRenderObserver), this._scene.onAfterStepObservable.remove(this._onAfterStepObserver)), this._attachedToMesh = null, this._onAfterRenderObserver = null, this._onAfterStepObserver = null, this._scene = null);
+ }, ee.prototype._updateToMesh = function() {
+ var w = this.ray;
+ this._attachedToMesh && w && (this._attachedToMesh._isDisposed ? this.detachFromMesh() : (this._attachedToMesh.getDirectionToRef(this._meshSpaceDirection, w.direction), f.e.TransformCoordinatesToRef(this._meshSpaceOrigin, this._attachedToMesh.getWorldMatrix(), w.origin)));
+ }, ee.prototype.dispose = function() {
+ this.hide(), this.detachFromMesh(), this.ray = null;
+ }, ee;
+ }(), oe = l(25), te = l(73), _e = l(62), de = l(4), ae = l(5), ie = l(97), Z = function() {
+ function ee(w, z, q, le, ce, J) {
+ var H, X, ne, Q, $, me, ye, be, ge, Te, Re, Se, Ne, ze;
+ le === void 0 && (le = !0), ce === void 0 && (ce = 3), J === void 0 && (J = {}), this.skeleton = w, this.mesh = z, this.autoUpdateBonesMatrices = le, this.renderingGroupId = ce, this.options = J, this.color = C.a.White(), this._debugLines = new Array(), this._localAxes = null, this._isEnabled = !1, this._obs = null, this._scene = q, this._ready = !1, J.pauseAnimations = (H = J.pauseAnimations) === null || H === void 0 || H, J.returnToRest = (X = J.returnToRest) !== null && X !== void 0 && X, J.displayMode = (ne = J.displayMode) !== null && ne !== void 0 ? ne : ee.DISPLAY_LINES, J.displayOptions = (Q = J.displayOptions) !== null && Q !== void 0 ? Q : {}, J.displayOptions.midStep = ($ = J.displayOptions.midStep) !== null && $ !== void 0 ? $ : 0.235, J.displayOptions.midStepFactor = (me = J.displayOptions.midStepFactor) !== null && me !== void 0 ? me : 0.155, J.displayOptions.sphereBaseSize = (ye = J.displayOptions.sphereBaseSize) !== null && ye !== void 0 ? ye : 0.15, J.displayOptions.sphereScaleUnit = (be = J.displayOptions.sphereScaleUnit) !== null && be !== void 0 ? be : 2, J.displayOptions.sphereFactor = (ge = J.displayOptions.sphereFactor) !== null && ge !== void 0 ? ge : 0.865, J.displayOptions.spurFollowsChild = (Te = J.displayOptions.spurFollowsChild) !== null && Te !== void 0 && Te, J.displayOptions.showLocalAxes = (Re = J.displayOptions.showLocalAxes) !== null && Re !== void 0 && Re, J.displayOptions.localAxesSize = (Se = J.displayOptions.localAxesSize) !== null && Se !== void 0 ? Se : 0.075, J.computeBonesUsingShaders = (Ne = J.computeBonesUsingShaders) === null || Ne === void 0 || Ne, J.useAllBones = (ze = J.useAllBones) === null || ze === void 0 || ze;
+ var Ye = z.getVerticesData(de.b.MatricesIndicesKind), He = z.getVerticesData(de.b.MatricesWeightsKind);
+ if (this._boneIndices = /* @__PURE__ */ new Set(), !J.useAllBones && Ye && He)
+ for (var Xe = 0; Xe < Ye.length; ++Xe) {
+ var Ze = Ye[Xe];
+ He[Xe] !== 0 && this._boneIndices.add(Ze);
+ }
+ this._utilityLayer = new B.a(this._scene, !1), this._utilityLayer.pickUtilitySceneFirst = !1, this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil = !0;
+ var je = this.options.displayMode || 0;
+ je > ee.DISPLAY_SPHERE_AND_SPURS && (je = ee.DISPLAY_LINES), this.displayMode = je, this.update(), this._bindObs();
+ }
+ return ee.CreateBoneWeightShader = function(w, z) {
+ var q, le, ce, J, H, X, ne = w.skeleton, Q = (q = w.colorBase) !== null && q !== void 0 ? q : C.a.Black(), $ = (le = w.colorZero) !== null && le !== void 0 ? le : C.a.Blue(), me = (ce = w.colorQuarter) !== null && ce !== void 0 ? ce : C.a.Green(), ye = (J = w.colorHalf) !== null && J !== void 0 ? J : C.a.Yellow(), be = (H = w.colorFull) !== null && H !== void 0 ? H : C.a.Red(), ge = (X = w.targetBoneIndex) !== null && X !== void 0 ? X : 0;
+ ae.a.ShadersStore["boneWeights:" + ne.name + "VertexShader"] = `precision highp float;
+
+ attribute vec3 position;
+ attribute vec2 uv;
+
+ uniform mat4 view;
+ uniform mat4 projection;
+ uniform mat4 worldViewProjection;
+
+ #include
+ #if NUM_BONE_INFLUENCERS == 0
+ attribute vec4 matricesIndices;
+ attribute vec4 matricesWeights;
+ #endif
+
+ #include
+
+ varying vec3 vColor;
+
+ uniform vec3 colorBase;
+ uniform vec3 colorZero;
+ uniform vec3 colorQuarter;
+ uniform vec3 colorHalf;
+ uniform vec3 colorFull;
+
+ uniform float targetBoneIndex;
+
+ void main() {
+ vec3 positionUpdated = position;
+
+ #include
+ #include
+
+ vec4 worldPos = finalWorld * vec4(positionUpdated, 1.0);
+
+ vec3 color = colorBase;
+ float totalWeight = 0.;
+ if(matricesIndices[0] == targetBoneIndex && matricesWeights[0] > 0.){
+ totalWeight += matricesWeights[0];
+ }
+ if(matricesIndices[1] == targetBoneIndex && matricesWeights[1] > 0.){
+ totalWeight += matricesWeights[1];
+ }
+ if(matricesIndices[2] == targetBoneIndex && matricesWeights[2] > 0.){
+ totalWeight += matricesWeights[2];
+ }
+ if(matricesIndices[3] == targetBoneIndex && matricesWeights[3] > 0.){
+ totalWeight += matricesWeights[3];
+ }
+
+ color = mix(color, colorZero, smoothstep(0., 0.25, totalWeight));
+ color = mix(color, colorQuarter, smoothstep(0.25, 0.5, totalWeight));
+ color = mix(color, colorHalf, smoothstep(0.5, 0.75, totalWeight));
+ color = mix(color, colorFull, smoothstep(0.75, 1.0, totalWeight));
+ vColor = color;
+
+ gl_Position = projection * view * worldPos;
+ }`, ae.a.ShadersStore["boneWeights:" + ne.name + "FragmentShader"] = `
+ precision highp float;
+ varying vec3 vPosition;
+
+ varying vec3 vColor;
+
+ void main() {
+ vec4 color = vec4(vColor, 1.0);
+ gl_FragColor = color;
+ }
+ `;
+ var Te = new te.a("boneWeight:" + ne.name, z, { vertex: "boneWeights:" + ne.name, fragment: "boneWeights:" + ne.name }, { attributes: ["position", "normal", "matricesIndices", "matricesWeights"], uniforms: ["world", "worldView", "worldViewProjection", "view", "projection", "viewProjection", "colorBase", "colorZero", "colorQuarter", "colorHalf", "colorFull", "targetBoneIndex"] });
+ return Te.setColor3("colorBase", Q), Te.setColor3("colorZero", $), Te.setColor3("colorQuarter", me), Te.setColor3("colorHalf", ye), Te.setColor3("colorFull", be), Te.setFloat("targetBoneIndex", ge), Te.getClassName = function() {
+ return "BoneWeightShader";
+ }, Te.transparencyMode = oe.a.MATERIAL_OPAQUE, Te;
+ }, ee.CreateSkeletonMapShader = function(w, z) {
+ var q, le = w.skeleton, ce = (q = w.colorMap) !== null && q !== void 0 ? q : [{ color: new C.a(1, 0.38, 0.18), location: 0 }, { color: new C.a(0.59, 0.18, 1), location: 0.2 }, { color: new C.a(0.59, 1, 0.18), location: 0.4 }, { color: new C.a(1, 0.87, 0.17), location: 0.6 }, { color: new C.a(1, 0.17, 0.42), location: 0.8 }, { color: new C.a(0.17, 0.68, 1), location: 1 }], J = le.bones.length + 1, H = ee._CreateBoneMapColorBuffer(J, ce, z), X = new te.a("boneWeights:" + le.name, z, { vertexSource: `precision highp float;
+
+ attribute vec3 position;
+ attribute vec2 uv;
+
+ uniform mat4 view;
+ uniform mat4 projection;
+ uniform mat4 worldViewProjection;
+ uniform float colorMap[` + 4 * le.bones.length + `];
+
+ #include
+ #if NUM_BONE_INFLUENCERS == 0
+ attribute vec4 matricesIndices;
+ attribute vec4 matricesWeights;
+ #endif
+ #include
+
+ varying vec3 vColor;
+
+ void main() {
+ vec3 positionUpdated = position;
+
+ #include
+ #include
+
+ vec3 color = vec3(0.);
+ bool first = true;
+
+ for (int i = 0; i < 4; i++) {
+ int boneIdx = int(matricesIndices[i]);
+ float boneWgt = matricesWeights[i];
+
+ vec3 c = vec3(colorMap[boneIdx * 4 + 0], colorMap[boneIdx * 4 + 1], colorMap[boneIdx * 4 + 2]);
+
+ if (boneWgt > 0.) {
+ if (first) {
+ first = false;
+ color = c;
+ } else {
+ color = mix(color, c, boneWgt);
+ }
+ }
+ }
+
+ vColor = color;
+
+ vec4 worldPos = finalWorld * vec4(positionUpdated, 1.0);
+
+ gl_Position = projection * view * worldPos;
+ }`, fragmentSource: `
+ precision highp float;
+ varying vec3 vColor;
+
+ void main() {
+ vec4 color = vec4( vColor, 1.0 );
+ gl_FragColor = color;
+ }
+ ` }, { attributes: ["position", "normal", "matricesIndices", "matricesWeights"], uniforms: ["world", "worldView", "worldViewProjection", "view", "projection", "viewProjection", "colorMap"] });
+ return X.setFloats("colorMap", H), X.getClassName = function() {
+ return "SkeletonMapShader";
+ }, X.transparencyMode = oe.a.MATERIAL_OPAQUE, X;
+ }, ee._CreateBoneMapColorBuffer = function(w, z, q) {
+ var le = new _e.a("temp", { width: w, height: 1 }, q, !1), ce = le.getContext(), J = ce.createLinearGradient(0, 0, w, 0);
+ z.forEach(function(Q) {
+ J.addColorStop(Q.location, Q.color.toHexString());
+ }), ce.fillStyle = J, ce.fillRect(0, 0, w, 1), le.update();
+ for (var H = [], X = ce.getImageData(0, 0, w, 1).data, ne = 0; ne < X.length; ne++)
+ H.push(X[ne] * (1 / 255));
+ return le.dispose(), H;
+ }, Object.defineProperty(ee.prototype, "scene", { get: function() {
+ return this._scene;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ee.prototype, "utilityLayer", { get: function() {
+ return this._utilityLayer;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ee.prototype, "isReady", { get: function() {
+ return this._ready;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ee.prototype, "ready", { set: function(w) {
+ this._ready = w;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ee.prototype, "debugMesh", { get: function() {
+ return this._debugMesh;
+ }, set: function(w) {
+ this._debugMesh = w;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(ee.prototype, "displayMode", { get: function() {
+ return this.options.displayMode || ee.DISPLAY_LINES;
+ }, set: function(w) {
+ w > ee.DISPLAY_SPHERE_AND_SPURS && (w = ee.DISPLAY_LINES), this.options.displayMode = w;
+ }, enumerable: !1, configurable: !0 }), ee.prototype._bindObs = function() {
+ var w = this;
+ switch (this.displayMode) {
+ case ee.DISPLAY_LINES:
+ this._obs = this.scene.onBeforeRenderObservable.add(function() {
+ w._displayLinesUpdate();
+ });
+ }
+ }, ee.prototype.update = function() {
+ switch (this.displayMode) {
+ case ee.DISPLAY_LINES:
+ this._displayLinesUpdate();
+ break;
+ case ee.DISPLAY_SPHERES:
+ this._buildSpheresAndSpurs(!0);
+ break;
+ case ee.DISPLAY_SPHERE_AND_SPURS:
+ this._buildSpheresAndSpurs(!1);
+ }
+ this._buildLocalAxes();
+ }, Object.defineProperty(ee.prototype, "isEnabled", { get: function() {
+ return this._isEnabled;
+ }, set: function(w) {
+ this.isEnabled !== w && (this._isEnabled = w, this.debugMesh && this.debugMesh.setEnabled(w), w && !this._obs ? this._bindObs() : !w && this._obs && (this.scene.onBeforeRenderObservable.remove(this._obs), this._obs = null));
+ }, enumerable: !1, configurable: !0 }), ee.prototype._getBonePosition = function(w, z, q, le, ce, J) {
+ le === void 0 && (le = 0), ce === void 0 && (ce = 0), J === void 0 && (J = 0);
+ var H = f.c.Matrix[0], X = z.getParent();
+ if (H.copyFrom(z.getLocalMatrix()), le !== 0 || ce !== 0 || J !== 0) {
+ var ne = f.c.Matrix[1];
+ f.a.IdentityToRef(ne), ne.setTranslationFromFloats(le, ce, J), ne.multiplyToRef(H, H);
+ }
+ X && H.multiplyToRef(X.getAbsoluteTransform(), H), H.multiplyToRef(q, H), w.x = H.m[12], w.y = H.m[13], w.z = H.m[14];
+ }, ee.prototype._getLinesForBonesWithLength = function(w, z) {
+ for (var q = w.length, le = this.mesh._effectiveMesh.position, ce = 0, J = 0; J < q; J++) {
+ var H = w[J], X = this._debugLines[ce];
+ H._index !== -1 && (this._boneIndices.has(H.getIndex()) || this.options.useAllBones) && (X || (X = [f.e.Zero(), f.e.Zero()], this._debugLines[ce] = X), this._getBonePosition(X[0], H, z), this._getBonePosition(X[1], H, z, 0, H.length, 0), X[0].subtractInPlace(le), X[1].subtractInPlace(le), ce++);
+ }
+ }, ee.prototype._getLinesForBonesNoLength = function(w) {
+ for (var z = w.length, q = 0, le = this.mesh._effectiveMesh, ce = le.position, J = z - 1; J >= 0; J--) {
+ var H = w[J], X = H.getParent();
+ if (X && (this._boneIndices.has(H.getIndex()) || this.options.useAllBones)) {
+ var ne = this._debugLines[q];
+ ne || (ne = [f.e.Zero(), f.e.Zero()], this._debugLines[q] = ne), H.getAbsolutePositionToRef(le, ne[0]), X.getAbsolutePositionToRef(le, ne[1]), ne[0].subtractInPlace(ce), ne[1].subtractInPlace(ce), q++;
+ }
+ }
+ }, ee.prototype._revert = function(w) {
+ this.options.pauseAnimations && (this.scene.animationsEnabled = w, this.utilityLayer.utilityLayerScene.animationsEnabled = w);
+ }, ee.prototype._getAbsoluteBindPoseToRef = function(w, z) {
+ w !== null && w._index !== -1 ? (this._getAbsoluteBindPoseToRef(w.getParent(), z), w.getBindPose().multiplyToRef(z, z)) : z.copyFrom(f.a.Identity());
+ }, ee.prototype._buildSpheresAndSpurs = function(w) {
+ var z, q;
+ w === void 0 && (w = !0), this._debugMesh && (this._debugMesh.dispose(), this._debugMesh = null, this.ready = !1), this._ready = !1;
+ var le = (z = this.utilityLayer) === null || z === void 0 ? void 0 : z.utilityLayerScene, ce = this.skeleton.bones, J = [], H = [], X = this.scene.animationsEnabled;
+ try {
+ this.options.pauseAnimations && (this.scene.animationsEnabled = !1, le.animationsEnabled = !1), this.options.returnToRest && this.skeleton.returnToRest(), this.autoUpdateBonesMatrices && this.skeleton.computeAbsoluteTransforms();
+ for (var ne = Number.NEGATIVE_INFINITY, Q = this.options.displayOptions || {}, $ = function(Xe) {
+ var Ze = ce[Xe];
+ if (Ze._index === -1 || !me._boneIndices.has(Ze.getIndex()) && !me.options.useAllBones)
+ return "continue";
+ var je = new f.a();
+ me._getAbsoluteBindPoseToRef(Ze, je);
+ var it = new f.e();
+ je.decompose(void 0, void 0, it), Ze.children.forEach(function(wt, Pt) {
+ var Mt = new f.a();
+ wt.getBindPose().multiplyToRef(je, Mt);
+ var _n = new f.e();
+ Mt.decompose(void 0, void 0, _n);
+ var an = f.e.Distance(it, _n);
+ if (an > ne && (ne = an), !w) {
+ for (var hn = _n.clone().subtract(it.clone()), we = hn.length(), Bn = hn.normalize().scale(we), dn = Q.midStep || 0.165, Un = Q.midStepFactor || 0.215, ke = Bn.scale(dn), Vn = ie.a.ExtrudeShapeCustom("skeletonViewer", { shape: [new f.e(1, -1, 0), new f.e(1, 1, 0), new f.e(-1, 1, 0), new f.e(-1, -1, 0), new f.e(1, -1, 0)], path: [f.e.Zero(), ke, Bn], scaleFunction: function(ds) {
+ switch (ds) {
+ case 0:
+ case 2:
+ return 0;
+ case 1:
+ return we * Un;
+ }
+ return 0;
+ }, sideOrientation: d.a.DEFAULTSIDE, updatable: !1 }, le), po = Vn.getTotalVertices(), Ke = [], Nn = [], yi = 0; yi < po; yi++)
+ Ke.push(1, 0, 0, 0), Q.spurFollowsChild && yi > 9 ? Nn.push(wt.getIndex(), 0, 0, 0) : Nn.push(Ze.getIndex(), 0, 0, 0);
+ Vn.position = it.clone(), Vn.setVerticesData(de.b.MatricesWeightsKind, Ke, !1), Vn.setVerticesData(de.b.MatricesIndicesKind, Nn, !1), Vn.convertToFlatShadedMesh(), H.push(Vn);
+ }
+ });
+ for (var et = Q.sphereBaseSize || 0.2, lt = T.a.CreateSphere("skeletonViewer", { segments: 6, diameter: et, updatable: !0 }, le), ct = lt.getTotalVertices(), mt = [], St = [], Ut = 0; Ut < ct; Ut++)
+ mt.push(1, 0, 0, 0), St.push(Ze.getIndex(), 0, 0, 0);
+ lt.setVerticesData(de.b.MatricesWeightsKind, mt, !1), lt.setVerticesData(de.b.MatricesIndicesKind, St, !1), lt.position = it.clone(), J.push([lt, Ze]);
+ }, me = this, ye = 0; ye < ce.length; ye++)
+ $(ye);
+ var be = Q.sphereScaleUnit || 2, ge = Q.sphereFactor || 0.85, Te = [];
+ for (ye = 0; ye < J.length; ye++) {
+ for (var Re = J[ye], Se = Re[0], Ne = Re[1], ze = 1 / (be / ne), Ye = 0, He = Ne; He.getParent() && He.getParent().getIndex() !== -1; )
+ Ye++, He = He.getParent();
+ Se.scaling.scaleInPlace(ze * Math.pow(ge, Ye)), Te.push(Se);
+ }
+ this.debugMesh = d.a.MergeMeshes(Te.concat(H), !0, !0), this.debugMesh && (this.debugMesh.renderingGroupId = this.renderingGroupId, this.debugMesh.skeleton = this.skeleton, this.debugMesh.parent = this.mesh, this.debugMesh.computeBonesUsingShaders = (q = this.options.computeBonesUsingShaders) === null || q === void 0 || q, this.debugMesh.alwaysSelectAsActiveMesh = !0), this.utilityLayer._getSharedGizmoLight().intensity = 0.7, this._revert(X), this.ready = !0;
+ } catch (Xe) {
+ console.error(Xe), this._revert(X), this.dispose();
+ }
+ }, ee.prototype._buildLocalAxes = function() {
+ var w;
+ this._localAxes && this._localAxes.dispose(), this._localAxes = null;
+ var z = this.options.displayOptions || {};
+ if (z.showLocalAxes) {
+ var q = this._utilityLayer.utilityLayerScene, le = z.localAxesSize || 0.075, ce = [], J = [], H = new C.b(1, 0, 0, 1), X = new C.b(0, 1, 0, 1), ne = new C.b(0, 0, 1, 1), Q = [], $ = [];
+ for (var me in this.skeleton.bones) {
+ var ye = this.skeleton.bones[me];
+ if (ye._index !== -1 && (this._boneIndices.has(ye.getIndex()) || this.options.useAllBones)) {
+ var be = new f.a(), ge = new f.e();
+ this._getAbsoluteBindPoseToRef(ye, be), be.decompose(void 0, void 0, ge);
+ var Te = ye.getBindPose().getRotationMatrix(), Re = f.e.TransformCoordinates(new f.e(0 + le, 0, 0), Te), Se = f.e.TransformCoordinates(new f.e(0, 0 + le, 0), Te), Ne = f.e.TransformCoordinates(new f.e(0, 0, 0 + le), Te), ze = [[ge, ge.add(Re)], [ge, ge.add(Se)], [ge, ge.add(Ne)]], Ye = [[H, H], [X, X], [ne, ne]];
+ ce.push.apply(ce, ze), J.push.apply(J, Ye);
+ for (var He = 0; He < 6; He++)
+ Q.push(1, 0, 0, 0), $.push(ye.getIndex(), 0, 0, 0);
+ }
+ }
+ this._localAxes = W.a.CreateLineSystem("localAxes", { lines: ce, colors: J, updatable: !0 }, q), this._localAxes.setVerticesData(de.b.MatricesWeightsKind, Q, !1), this._localAxes.setVerticesData(de.b.MatricesIndicesKind, $, !1), this._localAxes.skeleton = this.skeleton, this._localAxes.renderingGroupId = this.renderingGroupId, this._localAxes.parent = this.mesh, this._localAxes.computeBonesUsingShaders = (w = this.options.computeBonesUsingShaders) === null || w === void 0 || w;
+ }
+ }, ee.prototype._displayLinesUpdate = function() {
+ if (this._utilityLayer) {
+ this.autoUpdateBonesMatrices && this.skeleton.computeAbsoluteTransforms();
+ var w = this.mesh._effectiveMesh;
+ this.skeleton.bones[0].length === void 0 ? this._getLinesForBonesNoLength(this.skeleton.bones) : this._getLinesForBonesWithLength(this.skeleton.bones, w.getWorldMatrix());
+ var z = this._utilityLayer.utilityLayerScene;
+ z && (this._debugMesh ? W.a.CreateLineSystem("", { lines: this._debugLines, updatable: !0, instance: this._debugMesh }, z) : (this._debugMesh = W.a.CreateLineSystem("", { lines: this._debugLines, updatable: !0, instance: null }, z), this._debugMesh.renderingGroupId = this.renderingGroupId), this._debugMesh.position.copyFrom(this.mesh.position), this._debugMesh.color = this.color);
+ }
+ }, ee.prototype.changeDisplayMode = function(w) {
+ var z = !!this.isEnabled;
+ this.displayMode !== w && (this.isEnabled = !1, this._debugMesh && (this._debugMesh.dispose(), this._debugMesh = null, this.ready = !1), this.displayMode = w, this.update(), this._bindObs(), this.isEnabled = z);
+ }, ee.prototype.changeDisplayOptions = function(w, z) {
+ var q = !!this.isEnabled;
+ this.options.displayOptions[w] = z, this.isEnabled = !1, this._debugMesh && (this._debugMesh.dispose(), this._debugMesh = null, this.ready = !1), this.update(), this._bindObs(), this.isEnabled = q;
+ }, ee.prototype.dispose = function() {
+ this.isEnabled = !1, this._debugMesh && (this._debugMesh.dispose(), this._debugMesh = null), this._utilityLayer && (this._utilityLayer.dispose(), this._utilityLayer = null), this.ready = !1;
+ }, ee.DISPLAY_LINES = 0, ee.DISPLAY_SPHERES = 1, ee.DISPLAY_SPHERE_AND_SPURS = 2, ee;
+ }();
+ }, function(V, _, l) {
+ var D = "morphTargetsVertex", f = `#ifdef MORPHTARGETS
+positionUpdated+=(position{X}-position)*morphTargetInfluences[{X}];
+#ifdef MORPHTARGETS_NORMAL
+normalUpdated+=(normal{X}-normal)*morphTargetInfluences[{X}];
+#endif
+#ifdef MORPHTARGETS_TANGENT
+tangentUpdated.xyz+=(tangent{X}-tangent.xyz)*morphTargetInfluences[{X}];
+#endif
+#ifdef MORPHTARGETS_UV
+uvUpdated+=(uv_{X}-uv)*morphTargetInfluences[{X}];
+#endif
+#endif`;
+ l(5).a.IncludesShadersStore[D] = f;
+ }, function(V, _, l) {
+ l.d(_, "b", function() {
+ return f;
+ }), l.d(_, "a", function() {
+ return P;
+ });
+ var D = l(0);
+ function f(c, C, x, R, g) {
+ g === void 0 && (g = null);
+ for (var u = new D.e(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), E = new D.e(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE), A = x; A < x + R; A++) {
+ var y = 3 * C[A], v = c[y], h = c[y + 1], d = c[y + 2];
+ u.minimizeInPlaceFromFloats(v, h, d), E.maximizeInPlaceFromFloats(v, h, d);
+ }
+ return g && (u.x -= u.x * g.x + g.y, u.y -= u.y * g.x + g.y, u.z -= u.z * g.x + g.y, E.x += E.x * g.x + g.y, E.y += E.y * g.x + g.y, E.z += E.z * g.x + g.y), { minimum: u, maximum: E };
+ }
+ function P(c, C, x, R, g) {
+ R === void 0 && (R = null);
+ var u = new D.e(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), E = new D.e(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
+ g || (g = 3);
+ for (var A = C, y = C * g; A < C + x; A++, y += g) {
+ var v = c[y], h = c[y + 1], d = c[y + 2];
+ u.minimizeInPlaceFromFloats(v, h, d), E.maximizeInPlaceFromFloats(v, h, d);
+ }
+ return R && (u.x -= u.x * R.x + R.y, u.y -= u.y * R.x + R.y, u.z -= u.z * R.x + R.y, E.x += E.x * R.x + R.y, E.y += E.y * R.x + R.y, E.z += E.z * R.x + R.y), { minimum: u, maximum: E };
+ }
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ };
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return c;
+ });
+ var D = l(44), f = l(0), P = l(28), c = function() {
+ function C(x, R, g) {
+ this.vectors = D.a.BuildArray(8, f.e.Zero), this.center = f.e.Zero(), this.centerWorld = f.e.Zero(), this.extendSize = f.e.Zero(), this.extendSizeWorld = f.e.Zero(), this.directions = D.a.BuildArray(3, f.e.Zero), this.vectorsWorld = D.a.BuildArray(8, f.e.Zero), this.minimumWorld = f.e.Zero(), this.maximumWorld = f.e.Zero(), this.minimum = f.e.Zero(), this.maximum = f.e.Zero(), this.reConstruct(x, R, g);
+ }
+ return C.prototype.reConstruct = function(x, R, g) {
+ var u = x.x, E = x.y, A = x.z, y = R.x, v = R.y, h = R.z, d = this.vectors;
+ this.minimum.copyFromFloats(u, E, A), this.maximum.copyFromFloats(y, v, h), d[0].copyFromFloats(u, E, A), d[1].copyFromFloats(y, v, h), d[2].copyFromFloats(y, E, A), d[3].copyFromFloats(u, v, A), d[4].copyFromFloats(u, E, h), d[5].copyFromFloats(y, v, A), d[6].copyFromFloats(u, v, h), d[7].copyFromFloats(y, E, h), R.addToRef(x, this.center).scaleInPlace(0.5), R.subtractToRef(x, this.extendSize).scaleInPlace(0.5), this._worldMatrix = g || f.a.IdentityReadOnly, this._update(this._worldMatrix);
+ }, C.prototype.scale = function(x) {
+ var R = C.TmpVector3, g = this.maximum.subtractToRef(this.minimum, R[0]), u = g.length();
+ g.normalizeFromLength(u);
+ var E = u * x, A = g.scaleInPlace(0.5 * E), y = this.center.subtractToRef(A, R[1]), v = this.center.addToRef(A, R[2]);
+ return this.reConstruct(y, v, this._worldMatrix), this;
+ }, C.prototype.getWorldMatrix = function() {
+ return this._worldMatrix;
+ }, C.prototype._update = function(x) {
+ var R = this.minimumWorld, g = this.maximumWorld, u = this.directions, E = this.vectorsWorld, A = this.vectors;
+ if (x.isIdentity()) {
+ for (R.copyFrom(this.minimum), g.copyFrom(this.maximum), y = 0; y < 8; ++y)
+ E[y].copyFrom(A[y]);
+ this.extendSizeWorld.copyFrom(this.extendSize), this.centerWorld.copyFrom(this.center);
+ } else {
+ R.setAll(Number.MAX_VALUE), g.setAll(-Number.MAX_VALUE);
+ for (var y = 0; y < 8; ++y) {
+ var v = E[y];
+ f.e.TransformCoordinatesToRef(A[y], x, v), R.minimizeInPlace(v), g.maximizeInPlace(v);
+ }
+ g.subtractToRef(R, this.extendSizeWorld).scaleInPlace(0.5), g.addToRef(R, this.centerWorld).scaleInPlace(0.5);
+ }
+ f.e.FromArrayToRef(x.m, 0, u[0]), f.e.FromArrayToRef(x.m, 4, u[1]), f.e.FromArrayToRef(x.m, 8, u[2]), this._worldMatrix = x;
+ }, C.prototype.isInFrustum = function(x) {
+ return C.IsInFrustum(this.vectorsWorld, x);
+ }, C.prototype.isCompletelyInFrustum = function(x) {
+ return C.IsCompletelyInFrustum(this.vectorsWorld, x);
+ }, C.prototype.intersectsPoint = function(x) {
+ var R = this.minimumWorld, g = this.maximumWorld, u = R.x, E = R.y, A = R.z, y = g.x, v = g.y, h = g.z, d = x.x, b = x.y, T = x.z, N = -P.a;
+ return !(y - d < N || N > d - u) && !(v - b < N || N > b - E) && !(h - T < N || N > T - A);
+ }, C.prototype.intersectsSphere = function(x) {
+ return C.IntersectsSphere(this.minimumWorld, this.maximumWorld, x.centerWorld, x.radiusWorld);
+ }, C.prototype.intersectsMinMax = function(x, R) {
+ var g = this.minimumWorld, u = this.maximumWorld, E = g.x, A = g.y, y = g.z, v = u.x, h = u.y, d = u.z, b = x.x, T = x.y, N = x.z, U = R.x, B = R.y, L = R.z;
+ return !(v < b || E > U) && !(h < T || A > B) && !(d < N || y > L);
+ }, C.Intersects = function(x, R) {
+ return x.intersectsMinMax(R.minimumWorld, R.maximumWorld);
+ }, C.IntersectsSphere = function(x, R, g, u) {
+ var E = C.TmpVector3[0];
+ return f.e.ClampToRef(g, x, R, E), f.e.DistanceSquared(g, E) <= u * u;
+ }, C.IsCompletelyInFrustum = function(x, R) {
+ for (var g = 0; g < 6; ++g)
+ for (var u = R[g], E = 0; E < 8; ++E)
+ if (u.dotCoordinate(x[E]) < 0)
+ return !1;
+ return !0;
+ }, C.IsInFrustum = function(x, R) {
+ for (var g = 0; g < 6; ++g) {
+ for (var u = !0, E = R[g], A = 0; A < 8; ++A)
+ if (E.dotCoordinate(x[A]) >= 0) {
+ u = !1;
+ break;
+ }
+ if (u)
+ return !1;
+ }
+ return !0;
+ }, C.TmpVector3 = D.a.BuildArray(3, f.e.Zero), C;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return f;
+ });
+ var D = l(38), f = function() {
+ function P() {
+ }
+ return P.SetImmediate = function(c) {
+ D.a.IsWindowObjectExist() && window.setImmediate ? window.setImmediate(c) : setTimeout(c, 1);
+ }, P;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return P;
+ });
+ var D = l(0), f = l(2), P = function() {
+ function c() {
+ this.previousWorldMatrices = {}, this.previousBones = {};
+ }
+ return c.AddUniforms = function(C) {
+ C.push("previousWorld", "previousViewProjection");
+ }, c.AddSamplers = function(C) {
+ }, c.prototype.bindForSubMesh = function(C, x, R, g, u) {
+ x.prePassRenderer && x.prePassRenderer.enabled && x.prePassRenderer.getIndex(f.a.PREPASS_VELOCITY_TEXTURE_TYPE) !== -1 && (this.previousWorldMatrices[R.uniqueId] || (this.previousWorldMatrices[R.uniqueId] = D.a.Identity()), this.previousViewProjection || (this.previousViewProjection = x.getTransformMatrix()), C.setMatrix("previousWorld", this.previousWorldMatrices[R.uniqueId]), C.setMatrix("previousViewProjection", this.previousViewProjection), this.previousWorldMatrices[R.uniqueId] = g.clone(), this.previousViewProjection = x.getTransformMatrix().clone());
+ }, c;
+ }();
+ }, function(V, _, l) {
+ var D = "lightFragmentDeclaration", f = `#ifdef LIGHT{X}
+uniform vec4 vLightData{X};
+uniform vec4 vLightDiffuse{X};
+#ifdef SPECULARTERM
+uniform vec4 vLightSpecular{X};
+#else
+vec4 vLightSpecular{X}=vec4(0.);
+#endif
+#ifdef SHADOW{X}
+#ifdef SHADOWCSM{X}
+uniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];
+uniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];
+uniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];
+uniform float cascadeBlendFactor{X};
+varying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];
+varying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];
+varying vec4 vPositionFromCamera{X};
+#if defined(SHADOWPCSS{X})
+uniform highp sampler2DArrayShadow shadowSampler{X};
+uniform highp sampler2DArray depthSampler{X};
+uniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];
+uniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];
+uniform float penumbraDarkness{X};
+#elif defined(SHADOWPCF{X})
+uniform highp sampler2DArrayShadow shadowSampler{X};
+#else
+uniform highp sampler2DArray shadowSampler{X};
+#endif
+#ifdef SHADOWCSMDEBUG{X}
+const vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]
+(
+vec3 ( 1.5,0.0,0.0 ),
+vec3 ( 0.0,1.5,0.0 ),
+vec3 ( 0.0,0.0,5.5 ),
+vec3 ( 1.5,0.0,5.5 ),
+vec3 ( 1.5,1.5,0.0 ),
+vec3 ( 1.0,1.0,1.0 ),
+vec3 ( 0.0,1.0,5.5 ),
+vec3 ( 0.5,3.5,0.75 )
+);
+vec3 shadowDebug{X};
+#endif
+#ifdef SHADOWCSMUSESHADOWMAXZ{X}
+int index{X}=-1;
+#else
+int index{X}=SHADOWCSMNUM_CASCADES{X}-1;
+#endif
+float diff{X}=0.;
+#elif defined(SHADOWCUBE{X})
+uniform samplerCube shadowSampler{X};
+#else
+varying vec4 vPositionFromLight{X};
+varying float vDepthMetric{X};
+#if defined(SHADOWPCSS{X})
+uniform highp sampler2DShadow shadowSampler{X};
+uniform highp sampler2D depthSampler{X};
+#elif defined(SHADOWPCF{X})
+uniform highp sampler2DShadow shadowSampler{X};
+#else
+uniform sampler2D shadowSampler{X};
+#endif
+uniform mat4 lightMatrix{X};
+#endif
+uniform vec4 shadowsInfo{X};
+uniform vec2 depthValues{X};
+#endif
+#ifdef SPOTLIGHT{X}
+uniform vec4 vLightDirection{X};
+uniform vec4 vLightFalloff{X};
+#elif defined(POINTLIGHT{X})
+uniform vec4 vLightFalloff{X};
+#elif defined(HEMILIGHT{X})
+uniform vec3 vLightGround{X};
+#endif
+#ifdef PROJECTEDLIGHTTEXTURE{X}
+uniform mat4 textureProjectionMatrix{X};
+uniform sampler2D projectionLightSampler{X};
+#endif
+#endif`;
+ l(5).a.IncludesShadersStore[D] = f;
+ }, function(V, _, l) {
+ var D = "lightUboDeclaration", f = `#ifdef LIGHT{X}
+uniform Light{X}
+{
+vec4 vLightData;
+vec4 vLightDiffuse;
+vec4 vLightSpecular;
+#ifdef SPOTLIGHT{X}
+vec4 vLightDirection;
+vec4 vLightFalloff;
+#elif defined(POINTLIGHT{X})
+vec4 vLightFalloff;
+#elif defined(HEMILIGHT{X})
+vec3 vLightGround;
+#endif
+vec4 shadowsInfo;
+vec2 depthValues;
+} light{X};
+#ifdef PROJECTEDLIGHTTEXTURE{X}
+uniform mat4 textureProjectionMatrix{X};
+uniform sampler2D projectionLightSampler{X};
+#endif
+#ifdef SHADOW{X}
+#ifdef SHADOWCSM{X}
+uniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];
+uniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];
+uniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];
+uniform float cascadeBlendFactor{X};
+varying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];
+varying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];
+varying vec4 vPositionFromCamera{X};
+#if defined(SHADOWPCSS{X})
+uniform highp sampler2DArrayShadow shadowSampler{X};
+uniform highp sampler2DArray depthSampler{X};
+uniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];
+uniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];
+uniform float penumbraDarkness{X};
+#elif defined(SHADOWPCF{X})
+uniform highp sampler2DArrayShadow shadowSampler{X};
+#else
+uniform highp sampler2DArray shadowSampler{X};
+#endif
+#ifdef SHADOWCSMDEBUG{X}
+const vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]
+(
+vec3 ( 1.5,0.0,0.0 ),
+vec3 ( 0.0,1.5,0.0 ),
+vec3 ( 0.0,0.0,5.5 ),
+vec3 ( 1.5,0.0,5.5 ),
+vec3 ( 1.5,1.5,0.0 ),
+vec3 ( 1.0,1.0,1.0 ),
+vec3 ( 0.0,1.0,5.5 ),
+vec3 ( 0.5,3.5,0.75 )
+);
+vec3 shadowDebug{X};
+#endif
+#ifdef SHADOWCSMUSESHADOWMAXZ{X}
+int index{X}=-1;
+#else
+int index{X}=SHADOWCSMNUM_CASCADES{X}-1;
+#endif
+float diff{X}=0.;
+#elif defined(SHADOWCUBE{X})
+uniform samplerCube shadowSampler{X};
+#else
+varying vec4 vPositionFromLight{X};
+varying float vDepthMetric{X};
+#if defined(SHADOWPCSS{X})
+uniform highp sampler2DShadow shadowSampler{X};
+uniform highp sampler2D depthSampler{X};
+#elif defined(SHADOWPCF{X})
+uniform highp sampler2DShadow shadowSampler{X};
+#else
+uniform sampler2D shadowSampler{X};
+#endif
+uniform mat4 lightMatrix{X};
+#endif
+#endif
+#endif`;
+ l(5).a.IncludesShadersStore[D] = f;
+ }, function(V, _, l) {
+ var D = "imageProcessingDeclaration", f = `#ifdef EXPOSURE
+uniform float exposureLinear;
+#endif
+#ifdef CONTRAST
+uniform float contrast;
+#endif
+#ifdef VIGNETTE
+uniform vec2 vInverseScreenSize;
+uniform vec4 vignetteSettings1;
+uniform vec4 vignetteSettings2;
+#endif
+#ifdef COLORCURVES
+uniform vec4 vCameraColorCurveNegative;
+uniform vec4 vCameraColorCurveNeutral;
+uniform vec4 vCameraColorCurvePositive;
+#endif
+#ifdef COLORGRADING
+#ifdef COLORGRADING3D
+uniform highp sampler3D txColorTransform;
+#else
+uniform sampler2D txColorTransform;
+#endif
+uniform vec4 colorTransformSettings;
+#endif`;
+ l(5).a.IncludesShadersStore[D] = f;
+ }, function(V, _, l) {
+ var D = "imageProcessingFunctions", f = `#if defined(COLORGRADING) && !defined(COLORGRADING3D)
+
+#define inline
+vec3 sampleTexture3D(sampler2D colorTransform,vec3 color,vec2 sampler3dSetting)
+{
+float sliceSize=2.0*sampler3dSetting.x;
+#ifdef SAMPLER3DGREENDEPTH
+float sliceContinuous=(color.g-sampler3dSetting.x)*sampler3dSetting.y;
+#else
+float sliceContinuous=(color.b-sampler3dSetting.x)*sampler3dSetting.y;
+#endif
+float sliceInteger=floor(sliceContinuous);
+
+
+float sliceFraction=sliceContinuous-sliceInteger;
+#ifdef SAMPLER3DGREENDEPTH
+vec2 sliceUV=color.rb;
+#else
+vec2 sliceUV=color.rg;
+#endif
+sliceUV.x*=sliceSize;
+sliceUV.x+=sliceInteger*sliceSize;
+sliceUV=saturate(sliceUV);
+vec4 slice0Color=texture2D(colorTransform,sliceUV);
+sliceUV.x+=sliceSize;
+sliceUV=saturate(sliceUV);
+vec4 slice1Color=texture2D(colorTransform,sliceUV);
+vec3 result=mix(slice0Color.rgb,slice1Color.rgb,sliceFraction);
+#ifdef SAMPLER3DBGRMAP
+color.rgb=result.rgb;
+#else
+color.rgb=result.bgr;
+#endif
+return color;
+}
+#endif
+#ifdef TONEMAPPING_ACES
+
+
+
+
+
+const mat3 ACESInputMat=mat3(
+vec3(0.59719,0.07600,0.02840),
+vec3(0.35458,0.90834,0.13383),
+vec3(0.04823,0.01566,0.83777)
+);
+
+const mat3 ACESOutputMat=mat3(
+vec3( 1.60475,-0.10208,-0.00327),
+vec3(-0.53108,1.10813,-0.07276),
+vec3(-0.07367,-0.00605,1.07602)
+);
+vec3 RRTAndODTFit(vec3 v)
+{
+vec3 a=v*(v+0.0245786)-0.000090537;
+vec3 b=v*(0.983729*v+0.4329510)+0.238081;
+return a/b;
+}
+vec3 ACESFitted(vec3 color)
+{
+color=ACESInputMat*color;
+
+color=RRTAndODTFit(color);
+color=ACESOutputMat*color;
+
+color=saturate(color);
+return color;
+}
+#endif
+vec4 applyImageProcessing(vec4 result) {
+#ifdef EXPOSURE
+result.rgb*=exposureLinear;
+#endif
+#ifdef VIGNETTE
+
+vec2 viewportXY=gl_FragCoord.xy*vInverseScreenSize;
+viewportXY=viewportXY*2.0-1.0;
+vec3 vignetteXY1=vec3(viewportXY*vignetteSettings1.xy+vignetteSettings1.zw,1.0);
+float vignetteTerm=dot(vignetteXY1,vignetteXY1);
+float vignette=pow(vignetteTerm,vignetteSettings2.w);
+
+vec3 vignetteColor=vignetteSettings2.rgb;
+#ifdef VIGNETTEBLENDMODEMULTIPLY
+vec3 vignetteColorMultiplier=mix(vignetteColor,vec3(1,1,1),vignette);
+result.rgb*=vignetteColorMultiplier;
+#endif
+#ifdef VIGNETTEBLENDMODEOPAQUE
+result.rgb=mix(vignetteColor,result.rgb,vignette);
+#endif
+#endif
+#ifdef TONEMAPPING
+#ifdef TONEMAPPING_ACES
+result.rgb=ACESFitted(result.rgb);
+#else
+const float tonemappingCalibration=1.590579;
+result.rgb=1.0-exp2(-tonemappingCalibration*result.rgb);
+#endif
+#endif
+
+result.rgb=toGammaSpace(result.rgb);
+result.rgb=saturate(result.rgb);
+#ifdef CONTRAST
+
+vec3 resultHighContrast=result.rgb*result.rgb*(3.0-2.0*result.rgb);
+if (contrast<1.0) {
+
+result.rgb=mix(vec3(0.5,0.5,0.5),result.rgb,contrast);
+} else {
+
+result.rgb=mix(result.rgb,resultHighContrast,contrast-1.0);
+}
+#endif
+
+#ifdef COLORGRADING
+vec3 colorTransformInput=result.rgb*colorTransformSettings.xxx+colorTransformSettings.yyy;
+#ifdef COLORGRADING3D
+vec3 colorTransformOutput=texture(txColorTransform,colorTransformInput).rgb;
+#else
+vec3 colorTransformOutput=sampleTexture3D(txColorTransform,colorTransformInput,colorTransformSettings.yz).rgb;
+#endif
+result.rgb=mix(result.rgb,colorTransformOutput,colorTransformSettings.www);
+#endif
+#ifdef COLORCURVES
+
+float luma=getLuminance(result.rgb);
+vec2 curveMix=clamp(vec2(luma*3.0-1.5,luma*-3.0+1.5),vec2(0.0),vec2(1.0));
+vec4 colorCurve=vCameraColorCurveNeutral+curveMix.x*vCameraColorCurvePositive-curveMix.y*vCameraColorCurveNegative;
+result.rgb*=colorCurve.rgb;
+result.rgb=mix(vec3(luma),result.rgb,colorCurve.a);
+#endif
+return result;
+}`;
+ l(5).a.IncludesShadersStore[D] = f;
+ }, function(V, _, l) {
+ var D = "clipPlaneFragment", f = `#ifdef CLIPPLANE
+if (fClipDistance>0.0)
+{
+discard;
+}
+#endif
+#ifdef CLIPPLANE2
+if (fClipDistance2>0.0)
+{
+discard;
+}
+#endif
+#ifdef CLIPPLANE3
+if (fClipDistance3>0.0)
+{
+discard;
+}
+#endif
+#ifdef CLIPPLANE4
+if (fClipDistance4>0.0)
+{
+discard;
+}
+#endif
+#ifdef CLIPPLANE5
+if (fClipDistance5>0.0)
+{
+discard;
+}
+#endif
+#ifdef CLIPPLANE6
+if (fClipDistance6>0.0)
+{
+discard;
+}
+#endif`;
+ l(5).a.IncludesShadersStore[D] = f;
+ }, function(V, _, l) {
+ var D = "clipPlaneVertex", f = `#ifdef CLIPPLANE
+fClipDistance=dot(worldPos,vClipPlane);
+#endif
+#ifdef CLIPPLANE2
+fClipDistance2=dot(worldPos,vClipPlane2);
+#endif
+#ifdef CLIPPLANE3
+fClipDistance3=dot(worldPos,vClipPlane3);
+#endif
+#ifdef CLIPPLANE4
+fClipDistance4=dot(worldPos,vClipPlane4);
+#endif
+#ifdef CLIPPLANE5
+fClipDistance5=dot(worldPos,vClipPlane5);
+#endif
+#ifdef CLIPPLANE6
+fClipDistance6=dot(worldPos,vClipPlane6);
+#endif`;
+ l(5).a.IncludesShadersStore[D] = f;
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ function f() {
+ this._count = 0, this._data = {};
+ }
+ return f.prototype.copyFrom = function(P) {
+ var c = this;
+ this.clear(), P.forEach(function(C, x) {
+ return c.add(C, x);
+ });
+ }, f.prototype.get = function(P) {
+ var c = this._data[P];
+ if (c !== void 0)
+ return c;
+ }, f.prototype.getOrAddWithFactory = function(P, c) {
+ var C = this.get(P);
+ return C !== void 0 || (C = c(P)) && this.add(P, C), C;
+ }, f.prototype.getOrAdd = function(P, c) {
+ var C = this.get(P);
+ return C !== void 0 ? C : (this.add(P, c), c);
+ }, f.prototype.contains = function(P) {
+ return this._data[P] !== void 0;
+ }, f.prototype.add = function(P, c) {
+ return this._data[P] === void 0 && (this._data[P] = c, ++this._count, !0);
+ }, f.prototype.set = function(P, c) {
+ return this._data[P] !== void 0 && (this._data[P] = c, !0);
+ }, f.prototype.getAndRemove = function(P) {
+ var c = this.get(P);
+ return c !== void 0 ? (delete this._data[P], --this._count, c) : null;
+ }, f.prototype.remove = function(P) {
+ return !!this.contains(P) && (delete this._data[P], --this._count, !0);
+ }, f.prototype.clear = function() {
+ this._data = {}, this._count = 0;
+ }, Object.defineProperty(f.prototype, "count", { get: function() {
+ return this._count;
+ }, enumerable: !1, configurable: !0 }), f.prototype.forEach = function(P) {
+ for (var c in this._data)
+ P(c, this._data[c]);
+ }, f.prototype.first = function(P) {
+ for (var c in this._data) {
+ var C = P(c, this._data[c]);
+ if (C)
+ return C;
+ }
+ return null;
+ }, f;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return P;
+ });
+ var D = l(44), f = l(0), P = function() {
+ function c(C, x, R) {
+ this.center = f.e.Zero(), this.centerWorld = f.e.Zero(), this.minimum = f.e.Zero(), this.maximum = f.e.Zero(), this.reConstruct(C, x, R);
+ }
+ return c.prototype.reConstruct = function(C, x, R) {
+ this.minimum.copyFrom(C), this.maximum.copyFrom(x);
+ var g = f.e.Distance(C, x);
+ x.addToRef(C, this.center).scaleInPlace(0.5), this.radius = 0.5 * g, this._update(R || f.a.IdentityReadOnly);
+ }, c.prototype.scale = function(C) {
+ var x = this.radius * C, R = c.TmpVector3, g = R[0].setAll(x), u = this.center.subtractToRef(g, R[1]), E = this.center.addToRef(g, R[2]);
+ return this.reConstruct(u, E, this._worldMatrix), this;
+ }, c.prototype.getWorldMatrix = function() {
+ return this._worldMatrix;
+ }, c.prototype._update = function(C) {
+ if (C.isIdentity())
+ this.centerWorld.copyFrom(this.center), this.radiusWorld = this.radius;
+ else {
+ f.e.TransformCoordinatesToRef(this.center, C, this.centerWorld);
+ var x = c.TmpVector3[0];
+ f.e.TransformNormalFromFloatsToRef(1, 1, 1, C, x), this.radiusWorld = Math.max(Math.abs(x.x), Math.abs(x.y), Math.abs(x.z)) * this.radius;
+ }
+ }, c.prototype.isInFrustum = function(C) {
+ for (var x = this.centerWorld, R = this.radiusWorld, g = 0; g < 6; g++)
+ if (C[g].dotCoordinate(x) <= -R)
+ return !1;
+ return !0;
+ }, c.prototype.isCenterInFrustum = function(C) {
+ for (var x = this.centerWorld, R = 0; R < 6; R++)
+ if (C[R].dotCoordinate(x) < 0)
+ return !1;
+ return !0;
+ }, c.prototype.intersectsPoint = function(C) {
+ var x = f.e.DistanceSquared(this.centerWorld, C);
+ return !(this.radiusWorld * this.radiusWorld < x);
+ }, c.Intersects = function(C, x) {
+ var R = f.e.DistanceSquared(C.centerWorld, x.centerWorld), g = C.radiusWorld + x.radiusWorld;
+ return !(g * g < R);
+ }, c.TmpVector3 = D.a.BuildArray(3, f.e.Zero), c;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function(f, P, c) {
+ this.bu = f, this.bv = P, this.distance = c, this.faceId = 0, this.subMeshId = 0;
+ };
+ }, function(V, _, l) {
+ var D = "clipPlaneFragmentDeclaration", f = `#ifdef CLIPPLANE
+varying float fClipDistance;
+#endif
+#ifdef CLIPPLANE2
+varying float fClipDistance2;
+#endif
+#ifdef CLIPPLANE3
+varying float fClipDistance3;
+#endif
+#ifdef CLIPPLANE4
+varying float fClipDistance4;
+#endif
+#ifdef CLIPPLANE5
+varying float fClipDistance5;
+#endif
+#ifdef CLIPPLANE6
+varying float fClipDistance6;
+#endif`;
+ l(5).a.IncludesShadersStore[D] = f;
+ }, function(V, _, l) {
+ var D = "logDepthDeclaration", f = `#ifdef LOGARITHMICDEPTH
+uniform float logarithmicDepthConstant;
+varying float vFragmentDepth;
+#endif`;
+ l(5).a.IncludesShadersStore[D] = f;
+ }, function(V, _, l) {
+ var D = "clipPlaneVertexDeclaration", f = `#ifdef CLIPPLANE
+uniform vec4 vClipPlane;
+varying float fClipDistance;
+#endif
+#ifdef CLIPPLANE2
+uniform vec4 vClipPlane2;
+varying float fClipDistance2;
+#endif
+#ifdef CLIPPLANE3
+uniform vec4 vClipPlane3;
+varying float fClipDistance3;
+#endif
+#ifdef CLIPPLANE4
+uniform vec4 vClipPlane4;
+varying float fClipDistance4;
+#endif
+#ifdef CLIPPLANE5
+uniform vec4 vClipPlane5;
+varying float fClipDistance5;
+#endif
+#ifdef CLIPPLANE6
+uniform vec4 vClipPlane6;
+varying float fClipDistance6;
+#endif`;
+ l(5).a.IncludesShadersStore[D] = f;
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ function f() {
+ }
+ return f.prototype.attributeProcessor = function(P) {
+ return P.replace("attribute", "in");
+ }, f.prototype.varyingProcessor = function(P, c) {
+ return P.replace("varying", c ? "in" : "out");
+ }, f.prototype.postProcessor = function(P, c, C) {
+ var x = P.search(/#extension.+GL_EXT_draw_buffers.+require/) !== -1;
+ if (P = (P = P.replace(/#extension.+(GL_OVR_multiview2|GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g, "")).replace(/texture2D\s*\(/g, "texture("), C)
+ P = (P = (P = (P = (P = (P = (P = P.replace(/texture2DLodEXT\s*\(/g, "textureLod(")).replace(/textureCubeLodEXT\s*\(/g, "textureLod(")).replace(/textureCube\s*\(/g, "texture(")).replace(/gl_FragDepthEXT/g, "gl_FragDepth")).replace(/gl_FragColor/g, "glFragColor")).replace(/gl_FragData/g, "glFragData")).replace(/void\s+?main\s*\(/g, (x ? "" : `out vec4 glFragColor;
+`) + "void main(");
+ else if (c.indexOf("#define MULTIVIEW") !== -1)
+ return `#extension GL_OVR_multiview2 : require
+layout (num_views = 2) in;
+` + P;
+ return P;
+ }, f;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ function f() {
+ }
+ return f.BindClipPlane = function(P, c) {
+ if (c.clipPlane) {
+ var C = c.clipPlane;
+ P.setFloat4("vClipPlane", C.normal.x, C.normal.y, C.normal.z, C.d);
+ }
+ c.clipPlane2 && (C = c.clipPlane2, P.setFloat4("vClipPlane2", C.normal.x, C.normal.y, C.normal.z, C.d)), c.clipPlane3 && (C = c.clipPlane3, P.setFloat4("vClipPlane3", C.normal.x, C.normal.y, C.normal.z, C.d)), c.clipPlane4 && (C = c.clipPlane4, P.setFloat4("vClipPlane4", C.normal.x, C.normal.y, C.normal.z, C.d)), c.clipPlane5 && (C = c.clipPlane5, P.setFloat4("vClipPlane5", C.normal.x, C.normal.y, C.normal.z, C.d)), c.clipPlane6 && (C = c.clipPlane6, P.setFloat4("vClipPlane6", C.normal.x, C.normal.y, C.normal.z, C.d));
+ }, f;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return D;
+ });
+ var D = function() {
+ function f() {
+ }
+ return f.RandomId = function() {
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(P) {
+ var c = 16 * Math.random() | 0;
+ return (P === "x" ? c : 3 & c | 8).toString(16);
+ });
+ }, f;
+ }();
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return c;
+ });
+ var D = l(1), f = l(3), P = l(9), c = function() {
+ function C() {
+ this._dirty = !0, this._tempColor = new P.b(0, 0, 0, 0), this._globalCurve = new P.b(0, 0, 0, 0), this._highlightsCurve = new P.b(0, 0, 0, 0), this._midtonesCurve = new P.b(0, 0, 0, 0), this._shadowsCurve = new P.b(0, 0, 0, 0), this._positiveCurve = new P.b(0, 0, 0, 0), this._negativeCurve = new P.b(0, 0, 0, 0), this._globalHue = 30, this._globalDensity = 0, this._globalSaturation = 0, this._globalExposure = 0, this._highlightsHue = 30, this._highlightsDensity = 0, this._highlightsSaturation = 0, this._highlightsExposure = 0, this._midtonesHue = 30, this._midtonesDensity = 0, this._midtonesSaturation = 0, this._midtonesExposure = 0, this._shadowsHue = 30, this._shadowsDensity = 0, this._shadowsSaturation = 0, this._shadowsExposure = 0;
+ }
+ return Object.defineProperty(C.prototype, "globalHue", { get: function() {
+ return this._globalHue;
+ }, set: function(x) {
+ this._globalHue = x, this._dirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(C.prototype, "globalDensity", { get: function() {
+ return this._globalDensity;
+ }, set: function(x) {
+ this._globalDensity = x, this._dirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(C.prototype, "globalSaturation", { get: function() {
+ return this._globalSaturation;
+ }, set: function(x) {
+ this._globalSaturation = x, this._dirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(C.prototype, "globalExposure", { get: function() {
+ return this._globalExposure;
+ }, set: function(x) {
+ this._globalExposure = x, this._dirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(C.prototype, "highlightsHue", { get: function() {
+ return this._highlightsHue;
+ }, set: function(x) {
+ this._highlightsHue = x, this._dirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(C.prototype, "highlightsDensity", { get: function() {
+ return this._highlightsDensity;
+ }, set: function(x) {
+ this._highlightsDensity = x, this._dirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(C.prototype, "highlightsSaturation", { get: function() {
+ return this._highlightsSaturation;
+ }, set: function(x) {
+ this._highlightsSaturation = x, this._dirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(C.prototype, "highlightsExposure", { get: function() {
+ return this._highlightsExposure;
+ }, set: function(x) {
+ this._highlightsExposure = x, this._dirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(C.prototype, "midtonesHue", { get: function() {
+ return this._midtonesHue;
+ }, set: function(x) {
+ this._midtonesHue = x, this._dirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(C.prototype, "midtonesDensity", { get: function() {
+ return this._midtonesDensity;
+ }, set: function(x) {
+ this._midtonesDensity = x, this._dirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(C.prototype, "midtonesSaturation", { get: function() {
+ return this._midtonesSaturation;
+ }, set: function(x) {
+ this._midtonesSaturation = x, this._dirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(C.prototype, "midtonesExposure", { get: function() {
+ return this._midtonesExposure;
+ }, set: function(x) {
+ this._midtonesExposure = x, this._dirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(C.prototype, "shadowsHue", { get: function() {
+ return this._shadowsHue;
+ }, set: function(x) {
+ this._shadowsHue = x, this._dirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(C.prototype, "shadowsDensity", { get: function() {
+ return this._shadowsDensity;
+ }, set: function(x) {
+ this._shadowsDensity = x, this._dirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(C.prototype, "shadowsSaturation", { get: function() {
+ return this._shadowsSaturation;
+ }, set: function(x) {
+ this._shadowsSaturation = x, this._dirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(C.prototype, "shadowsExposure", { get: function() {
+ return this._shadowsExposure;
+ }, set: function(x) {
+ this._shadowsExposure = x, this._dirty = !0;
+ }, enumerable: !1, configurable: !0 }), C.prototype.getClassName = function() {
+ return "ColorCurves";
+ }, C.Bind = function(x, R, g, u, E) {
+ g === void 0 && (g = "vCameraColorCurvePositive"), u === void 0 && (u = "vCameraColorCurveNeutral"), E === void 0 && (E = "vCameraColorCurveNegative"), x._dirty && (x._dirty = !1, x.getColorGradingDataToRef(x._globalHue, x._globalDensity, x._globalSaturation, x._globalExposure, x._globalCurve), x.getColorGradingDataToRef(x._highlightsHue, x._highlightsDensity, x._highlightsSaturation, x._highlightsExposure, x._tempColor), x._tempColor.multiplyToRef(x._globalCurve, x._highlightsCurve), x.getColorGradingDataToRef(x._midtonesHue, x._midtonesDensity, x._midtonesSaturation, x._midtonesExposure, x._tempColor), x._tempColor.multiplyToRef(x._globalCurve, x._midtonesCurve), x.getColorGradingDataToRef(x._shadowsHue, x._shadowsDensity, x._shadowsSaturation, x._shadowsExposure, x._tempColor), x._tempColor.multiplyToRef(x._globalCurve, x._shadowsCurve), x._highlightsCurve.subtractToRef(x._midtonesCurve, x._positiveCurve), x._midtonesCurve.subtractToRef(x._shadowsCurve, x._negativeCurve)), R && (R.setFloat4(g, x._positiveCurve.r, x._positiveCurve.g, x._positiveCurve.b, x._positiveCurve.a), R.setFloat4(u, x._midtonesCurve.r, x._midtonesCurve.g, x._midtonesCurve.b, x._midtonesCurve.a), R.setFloat4(E, x._negativeCurve.r, x._negativeCurve.g, x._negativeCurve.b, x._negativeCurve.a));
+ }, C.PrepareUniforms = function(x) {
+ x.push("vCameraColorCurveNeutral", "vCameraColorCurvePositive", "vCameraColorCurveNegative");
+ }, C.prototype.getColorGradingDataToRef = function(x, R, g, u, E) {
+ x != null && (x = C.clamp(x, 0, 360), R = C.clamp(R, -100, 100), g = C.clamp(g, -100, 100), u = C.clamp(u, -100, 100), R = C.applyColorGradingSliderNonlinear(R), R *= 0.5, u = C.applyColorGradingSliderNonlinear(u), R < 0 && (R *= -1, x = (x + 180) % 360), C.fromHSBToRef(x, R, 50 + 0.25 * u, E), E.scaleToRef(2, E), E.a = 1 + 0.01 * g);
+ }, C.applyColorGradingSliderNonlinear = function(x) {
+ x /= 100;
+ var R = Math.abs(x);
+ return R = Math.pow(R, 2), x < 0 && (R *= -1), R *= 100;
+ }, C.fromHSBToRef = function(x, R, g, u) {
+ var E = C.clamp(x, 0, 360), A = C.clamp(R / 100, 0, 1), y = C.clamp(g / 100, 0, 1);
+ if (A === 0)
+ u.r = y, u.g = y, u.b = y;
+ else {
+ E /= 60;
+ var v = Math.floor(E), h = E - v, d = y * (1 - A), b = y * (1 - A * h), T = y * (1 - A * (1 - h));
+ switch (v) {
+ case 0:
+ u.r = y, u.g = T, u.b = d;
+ break;
+ case 1:
+ u.r = b, u.g = y, u.b = d;
+ break;
+ case 2:
+ u.r = d, u.g = y, u.b = T;
+ break;
+ case 3:
+ u.r = d, u.g = b, u.b = y;
+ break;
+ case 4:
+ u.r = T, u.g = d, u.b = y;
+ break;
+ default:
+ u.r = y, u.g = d, u.b = b;
+ }
+ }
+ u.a = 1;
+ }, C.clamp = function(x, R, g) {
+ return Math.min(Math.max(x, R), g);
+ }, C.prototype.clone = function() {
+ return f.a.Clone(function() {
+ return new C();
+ }, this);
+ }, C.prototype.serialize = function() {
+ return f.a.Serialize(this);
+ }, C.Parse = function(x) {
+ return f.a.Parse(function() {
+ return new C();
+ }, x, null, null);
+ }, Object(D.c)([Object(f.c)()], C.prototype, "_globalHue", void 0), Object(D.c)([Object(f.c)()], C.prototype, "_globalDensity", void 0), Object(D.c)([Object(f.c)()], C.prototype, "_globalSaturation", void 0), Object(D.c)([Object(f.c)()], C.prototype, "_globalExposure", void 0), Object(D.c)([Object(f.c)()], C.prototype, "_highlightsHue", void 0), Object(D.c)([Object(f.c)()], C.prototype, "_highlightsDensity", void 0), Object(D.c)([Object(f.c)()], C.prototype, "_highlightsSaturation", void 0), Object(D.c)([Object(f.c)()], C.prototype, "_highlightsExposure", void 0), Object(D.c)([Object(f.c)()], C.prototype, "_midtonesHue", void 0), Object(D.c)([Object(f.c)()], C.prototype, "_midtonesDensity", void 0), Object(D.c)([Object(f.c)()], C.prototype, "_midtonesSaturation", void 0), Object(D.c)([Object(f.c)()], C.prototype, "_midtonesExposure", void 0), C;
+ }();
+ f.a._ColorCurvesParser = c.Parse;
+ }, function(V, _, l) {
+ l.d(_, "a", function() {
+ return P;
+ });
+ var D = l(8), f = l(11), P = function() {
+ function c() {
+ }
+ return c.Instantiate = function(C) {
+ if (this.RegisteredExternalClasses && this.RegisteredExternalClasses[C])
+ return this.RegisteredExternalClasses[C];
+ var x = f.a.GetClass(C);
+ if (x)
+ return x;
+ D.a.Warn(C + " not found, you may have missed an import.");
+ for (var R = C.split("."), g = window || this, u = 0, E = R.length; u < E; u++)
+ g = g[R[u]];
+ return typeof g != "function" ? null : g;
+ }, c.RegisteredExternalClasses = {}, c;
+ }();
+ }, function(V, _, l) {
+ var D = l(26), f = l(2);
+ D.a.prototype.setAlphaConstants = function(P, c, C, x) {
+ this._alphaState.setAlphaBlendConstants(P, c, C, x);
+ }, D.a.prototype.setAlphaMode = function(P, c) {
+ if (c === void 0 && (c = !1), this._alphaMode !== P) {
+ switch (P) {
+ case f.a.ALPHA_DISABLE:
+ this._alphaState.alphaBlend = !1;
+ break;
+ case f.a.ALPHA_PREMULTIPLIED:
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE), this._alphaState.alphaBlend = !0;
+ break;
+ case f.a.ALPHA_PREMULTIPLIED_PORTERDUFF:
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA), this._alphaState.alphaBlend = !0;
+ break;
+ case f.a.ALPHA_COMBINE:
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE), this._alphaState.alphaBlend = !0;
+ break;
+ case f.a.ALPHA_ONEONE:
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ZERO, this._gl.ONE), this._alphaState.alphaBlend = !0;
+ break;
+ case f.a.ALPHA_ADD:
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ONE), this._alphaState.alphaBlend = !0;
+ break;
+ case f.a.ALPHA_SUBTRACT:
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ZERO, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE), this._alphaState.alphaBlend = !0;
+ break;
+ case f.a.ALPHA_MULTIPLY:
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_COLOR, this._gl.ZERO, this._gl.ONE, this._gl.ONE), this._alphaState.alphaBlend = !0;
+ break;
+ case f.a.ALPHA_MAXIMIZED:
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE), this._alphaState.alphaBlend = !0;
+ break;
+ case f.a.ALPHA_INTERPOLATE:
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.CONSTANT_COLOR, this._gl.ONE_MINUS_CONSTANT_COLOR, this._gl.CONSTANT_ALPHA, this._gl.ONE_MINUS_CONSTANT_ALPHA), this._alphaState.alphaBlend = !0;
+ break;
+ case f.a.ALPHA_SCREENMODE:
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA), this._alphaState.alphaBlend = !0;
+ break;
+ case f.a.ALPHA_ONEONE_ONEONE:
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ONE, this._gl.ONE), this._alphaState.alphaBlend = !0;
+ break;
+ case f.a.ALPHA_ALPHATOCOLOR:
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ZERO), this._alphaState.alphaBlend = !0;
+ break;
+ case f.a.ALPHA_REVERSEONEMINUS:
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE_MINUS_DST_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA), this._alphaState.alphaBlend = !0;
+ break;
+ case f.a.ALPHA_SRC_DSTONEMINUSSRCALPHA:
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA), this._alphaState.alphaBlend = !0;
+ break;
+ case f.a.ALPHA_ONEONE_ONEZERO:
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ONE, this._gl.ZERO), this._alphaState.alphaBlend = !0;
+ break;
+ case f.a.ALPHA_EXCLUSION:
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ZERO, this._gl.ONE), this._alphaState.alphaBlend = !0;
+ }
+ c || (this.depthCullingState.depthMask = P === f.a.ALPHA_DISABLE), this._alphaMode = P;
+ }
+ }, D.a.prototype.getAlphaMode = function() {
+ return this._alphaMode;
+ }, D.a.prototype.setAlphaEquation = function(P) {
+ if (this._alphaEquation !== P) {
+ switch (P) {
+ case f.a.ALPHA_EQUATION_ADD:
+ this._alphaState.setAlphaEquationParameters(this._gl.FUNC_ADD, this._gl.FUNC_ADD);
+ break;
+ case f.a.ALPHA_EQUATION_SUBSTRACT:
+ this._alphaState.setAlphaEquationParameters(this._gl.FUNC_SUBTRACT, this._gl.FUNC_SUBTRACT);
+ break;
+ case f.a.ALPHA_EQUATION_REVERSE_SUBTRACT:
+ this._alphaState.setAlphaEquationParameters(this._gl.FUNC_REVERSE_SUBTRACT, this._gl.FUNC_REVERSE_SUBTRACT);
+ break;
+ case f.a.ALPHA_EQUATION_MAX:
+ this._alphaState.setAlphaEquationParameters(this._gl.MAX, this._gl.MAX);
+ break;
+ case f.a.ALPHA_EQUATION_MIN:
+ this._alphaState.setAlphaEquationParameters(this._gl.MIN, this._gl.MIN);
+ break;
+ case f.a.ALPHA_EQUATION_DARKEN:
+ this._alphaState.setAlphaEquationParameters(this._gl.MIN, this._gl.FUNC_ADD);
+ }
+ this._alphaEquation = P;
+ }
+ }, D.a.prototype.getAlphaEquation = function() {
+ return this._alphaEquation;
+ };
+ }, function(V, _, l) {
+ var D = l(26);
+ D.a.prototype.updateDynamicIndexBuffer = function(f, P, c) {
+ var C;
+ this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER] = null, this.bindIndexBuffer(f), C = P instanceof Uint16Array || P instanceof Uint32Array ? P : f.is32Bits ? new Uint32Array(P) : new Uint16Array(P), this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, C, this._gl.DYNAMIC_DRAW), this._resetIndexBufferBinding();
+ }, D.a.prototype.updateDynamicVertexBuffer = function(f, P, c, C) {
+ this.bindArrayBuffer(f), c === void 0 && (c = 0);
+ var x = P.length || P.byteLength;
+ C === void 0 || C >= x && c === 0 ? P instanceof Array ? this._gl.bufferSubData(this._gl.ARRAY_BUFFER, c, new Float32Array(P)) : this._gl.bufferSubData(this._gl.ARRAY_BUFFER, c, P) : P instanceof Array ? this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, new Float32Array(P).subarray(c, c + C)) : (P = P instanceof ArrayBuffer ? new Uint8Array(P, c, C) : new Uint8Array(P.buffer, P.byteOffset + c, C), this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, P)), this._resetVertexBufferBinding();
+ };
+ }, function(V, _, l) {
+ var D = "fogFragmentDeclaration", f = `#ifdef FOG
+#define FOGMODE_NONE 0.
+#define FOGMODE_EXP 1.
+#define FOGMODE_EXP2 2.
+#define FOGMODE_LINEAR 3.
+#define E 2.71828
+uniform vec4 vFogInfos;
+uniform vec3 vFogColor;
+varying vec3 vFogDistance;
+float CalcFogFactor()
+{
+float fogCoeff=1.0;
+float fogStart=vFogInfos.y;
+float fogEnd=vFogInfos.z;
+float fogDensity=vFogInfos.w;
+float fogDistance=length(vFogDistance);
+if (FOGMODE_LINEAR == vFogInfos.x)
+{
+fogCoeff=(fogEnd-fogDistance)/(fogEnd-fogStart);
+}
+else if (FOGMODE_EXP == vFogInfos.x)
+{
+fogCoeff=1.0/pow(E,fogDistance*fogDensity);
+}
+else if (FOGMODE_EXP2 == vFogInfos.x)
+{
+fogCoeff=1.0/pow(E,fogDistance*fogDistance*fogDensity*fogDensity);
+}
+return clamp(fogCoeff,0.0,1.0);
+}
+#endif`;
+ l(5).a.IncludesShadersStore[D] = f;
+ }, function(V, _, l) {
+ var D = l(26), f = l(27);
+ D.a.prototype.createDynamicTexture = function(P, c, C, x) {
+ var R = new f.a(this, f.b.Dynamic);
+ return R.baseWidth = P, R.baseHeight = c, C && (P = this.needPOTTextures ? D.a.GetExponentOfTwo(P, this._caps.maxTextureSize) : P, c = this.needPOTTextures ? D.a.GetExponentOfTwo(c, this._caps.maxTextureSize) : c), R.width = P, R.height = c, R.isReady = !1, R.generateMipMaps = C, R.samplingMode = x, this.updateTextureSamplingMode(x, R), this._internalTexturesCache.push(R), R;
+ }, D.a.prototype.updateDynamicTexture = function(P, c, C, x, R, g) {
+ if (x === void 0 && (x = !1), g === void 0 && (g = !1), P) {
+ var u = this._gl, E = u.TEXTURE_2D, A = this._bindTextureDirectly(E, P, !0, g);
+ this._unpackFlipY(C === void 0 ? P.invertY : C), x && u.pixelStorei(u.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1);
+ var y = this._getWebGLTextureType(P.type), v = this._getInternalFormat(R || P.format), h = this._getRGBABufferInternalSizedFormat(P.type, v);
+ u.texImage2D(E, 0, h, v, y, c), P.generateMipMaps && u.generateMipmap(E), A || this._bindTextureDirectly(E, null), x && u.pixelStorei(u.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0), P.isReady = !0;
+ }
+ };
+ }, function(V, _, l) {
+ l.r(_), l.d(_, "AbstractScene", function() {
+ return D.a;
+ }), l.d(_, "AbstractActionManager", function() {
+ return f.a;
+ }), l.d(_, "Action", function() {
+ return R;
+ }), l.d(_, "ActionEvent", function() {
+ return g.a;
+ }), l.d(_, "ActionManager", function() {
+ return de;
+ }), l.d(_, "Condition", function() {
+ return E;
+ }), l.d(_, "ValueCondition", function() {
+ return A;
+ }), l.d(_, "PredicateCondition", function() {
+ return y;
+ }), l.d(_, "StateCondition", function() {
+ return v;
+ }), l.d(_, "SwitchBooleanAction", function() {
+ return b;
+ }), l.d(_, "SetStateAction", function() {
+ return T;
+ }), l.d(_, "SetValueAction", function() {
+ return N;
+ }), l.d(_, "IncrementValueAction", function() {
+ return U;
+ }), l.d(_, "PlayAnimationAction", function() {
+ return B;
+ }), l.d(_, "StopAnimationAction", function() {
+ return L;
+ }), l.d(_, "DoNothingAction", function() {
+ return j;
+ }), l.d(_, "CombineAction", function() {
+ return W;
+ }), l.d(_, "ExecuteCodeAction", function() {
+ return Y;
+ }), l.d(_, "SetParentAction", function() {
+ return oe;
+ }), l.d(_, "PlaySoundAction", function() {
+ return ae;
+ }), l.d(_, "StopSoundAction", function() {
+ return ie;
+ }), l.d(_, "InterpolateValueAction", function() {
+ return X;
+ }), l.d(_, "Animatable", function() {
+ return ze;
+ }), l.d(_, "_IAnimationState", function() {
+ return J;
+ }), l.d(_, "Animation", function() {
+ return H;
+ }), l.d(_, "TargetedAnimation", function() {
+ return Ye;
+ }), l.d(_, "AnimationGroup", function() {
+ return He;
+ }), l.d(_, "AnimationPropertiesOverride", function() {
+ return Xe;
+ }), l.d(_, "EasingFunction", function() {
+ return je;
+ }), l.d(_, "CircleEase", function() {
+ return it;
+ }), l.d(_, "BackEase", function() {
+ return et;
+ }), l.d(_, "BounceEase", function() {
+ return lt;
+ }), l.d(_, "CubicEase", function() {
+ return ct;
+ }), l.d(_, "ElasticEase", function() {
+ return mt;
+ }), l.d(_, "ExponentialEase", function() {
+ return St;
+ }), l.d(_, "PowerEase", function() {
+ return Ut;
+ }), l.d(_, "QuadraticEase", function() {
+ return wt;
+ }), l.d(_, "QuarticEase", function() {
+ return Pt;
+ }), l.d(_, "QuinticEase", function() {
+ return Mt;
+ }), l.d(_, "SineEase", function() {
+ return _n;
+ }), l.d(_, "BezierCurveEase", function() {
+ return an;
+ }), l.d(_, "RuntimeAnimation", function() {
+ return be;
+ }), l.d(_, "AnimationEvent", function() {
+ return hn;
+ }), l.d(_, "AnimationKeyInterpolation", function() {
+ return Z;
+ }), l.d(_, "AnimationRange", function() {
+ return z;
+ }), l.d(_, "KeepAssets", function() {
+ return Bn;
+ }), l.d(_, "InstantiatedEntries", function() {
+ return dn;
+ }), l.d(_, "AssetContainer", function() {
+ return Un;
+ }), l.d(_, "Analyser", function() {
+ return Vn;
+ }), l.d(_, "AudioEngine", function() {
+ return po;
+ }), l.d(_, "AudioSceneComponent", function() {
+ return Ei;
+ }), l.d(_, "Sound", function() {
+ return yi;
+ }), l.d(_, "SoundTrack", function() {
+ return ds;
+ }), l.d(_, "WeightedSound", function() {
+ return Kv;
+ }), l.d(_, "AutoRotationBehavior", function() {
+ return dd;
+ }), l.d(_, "BouncingBehavior", function() {
+ return fd;
+ }), l.d(_, "FramingBehavior", function() {
+ return pd;
+ }), l.d(_, "AttachToBoxBehavior", function() {
+ return Qv;
+ }), l.d(_, "FadeInOutBehavior", function() {
+ return qv;
+ }), l.d(_, "MultiPointerScaleBehavior", function() {
+ return Zv;
+ }), l.d(_, "PointerDragBehavior", function() {
+ return Ji.a;
+ }), l.d(_, "SixDofDragBehavior", function() {
+ return _d;
+ }), l.d(_, "Bone", function() {
+ return Ne;
+ }), l.d(_, "BoneIKController", function() {
+ return Jv;
+ }), l.d(_, "BoneLookController", function() {
+ return $v;
+ }), l.d(_, "Skeleton", function() {
+ return fs;
+ }), l.d(_, "ArcRotateCameraGamepadInput", function() {
+ return Wc;
+ }), l.d(_, "ArcRotateCameraKeyboardMoveInput", function() {
+ return Xc;
+ }), l.d(_, "ArcRotateCameraMouseWheelInput", function() {
+ return Yc;
+ }), l.d(_, "ArcRotateCameraPointersInput", function() {
+ return Kc;
+ }), l.d(_, "ArcRotateCameraVRDeviceOrientationInput", function() {
+ return Qc;
+ }), l.d(_, "FlyCameraKeyboardInput", function() {
+ return qc;
+ }), l.d(_, "FlyCameraMouseInput", function() {
+ return Zc;
+ }), l.d(_, "FollowCameraKeyboardMoveInput", function() {
+ return Jc;
+ }), l.d(_, "FollowCameraMouseWheelInput", function() {
+ return $c;
+ }), l.d(_, "FollowCameraPointersInput", function() {
+ return el;
+ }), l.d(_, "FreeCameraDeviceOrientationInput", function() {
+ return ol;
+ }), l.d(_, "FreeCameraGamepadInput", function() {
+ return al;
+ }), l.d(_, "FreeCameraKeyboardMoveInput", function() {
+ return tl;
+ }), l.d(_, "FreeCameraMouseInput", function() {
+ return nl;
+ }), l.d(_, "FreeCameraMouseWheelInput", function() {
+ return il;
+ }), l.d(_, "FreeCameraTouchInput", function() {
+ return rl;
+ }), l.d(_, "FreeCameraVirtualJoystickInput", function() {
+ return cl;
+ }), l.d(_, "CameraInputTypes", function() {
+ return Tn;
+ }), l.d(_, "CameraInputsManager", function() {
+ return _a;
+ }), l.d(_, "Camera", function() {
+ return gt.a;
+ }), l.d(_, "TargetCamera", function() {
+ return fr;
+ }), l.d(_, "FreeCamera", function() {
+ return ci;
+ }), l.d(_, "FreeCameraInputsManager", function() {
+ return ma;
+ }), l.d(_, "TouchCamera", function() {
+ return ll;
+ }), l.d(_, "ArcRotateCamera", function() {
+ return Gr;
+ }), l.d(_, "ArcRotateCameraInputsManager", function() {
+ return ps;
+ }), l.d(_, "DeviceOrientationCamera", function() {
+ return _s;
+ }), l.d(_, "FlyCamera", function() {
+ return nb;
+ }), l.d(_, "FlyCameraInputsManager", function() {
+ return Td;
+ }), l.d(_, "FollowCamera", function() {
+ return Ad;
+ }), l.d(_, "ArcFollowCamera", function() {
+ return Pd;
+ }), l.d(_, "FollowCameraInputsManager", function() {
+ return Sd;
+ }), l.d(_, "GamepadCamera", function() {
+ return ms;
+ }), l.d(_, "AnaglyphArcRotateCamera", function() {
+ return Id;
+ }), l.d(_, "AnaglyphFreeCamera", function() {
+ return Dd;
+ }), l.d(_, "AnaglyphGamepadCamera", function() {
+ return Ld;
+ }), l.d(_, "AnaglyphUniversalCamera", function() {
+ return wd;
+ }), l.d(_, "StereoscopicArcRotateCamera", function() {
+ return Nd;
+ }), l.d(_, "StereoscopicFreeCamera", function() {
+ return Fd;
+ }), l.d(_, "StereoscopicGamepadCamera", function() {
+ return Bd;
+ }), l.d(_, "StereoscopicUniversalCamera", function() {
+ return Ud;
+ }), l.d(_, "UniversalCamera", function() {
+ return go;
+ }), l.d(_, "VirtualJoysticksCamera", function() {
+ return Vd;
+ }), l.d(_, "VRCameraMetrics", function() {
+ return vo;
+ }), l.d(_, "VRDeviceOrientationArcRotateCamera", function() {
+ return jd;
+ }), l.d(_, "VRDeviceOrientationFreeCamera", function() {
+ return gs;
+ }), l.d(_, "VRDeviceOrientationGamepadCamera", function() {
+ return Hd;
+ }), l.d(_, "OnAfterEnteringVRObservableEvent", function() {
+ return db;
+ }), l.d(_, "VRExperienceHelper", function() {
+ return Kd;
+ }), l.d(_, "WebVRFreeCamera", function() {
+ return bs;
+ }), l.d(_, "Collider", function() {
+ return Qd;
+ }), l.d(_, "DefaultCollisionCoordinator", function() {
+ return qd;
+ }), l.d(_, "PickingInfo", function() {
+ return Wr.a;
+ }), l.d(_, "IntersectionInfo", function() {
+ return fb.a;
+ }), l.d(_, "_MeshCollisionData", function() {
+ return pb.a;
+ }), l.d(_, "BoundingBox", function() {
+ return vl.a;
+ }), l.d(_, "BoundingInfo", function() {
+ return vr.a;
+ }), l.d(_, "BoundingSphere", function() {
+ return Zd.a;
+ }), l.d(_, "Octree", function() {
+ return va;
+ }), l.d(_, "OctreeBlock", function() {
+ return Jd;
+ }), l.d(_, "OctreeSceneComponent", function() {
+ return Sl;
+ }), l.d(_, "Ray", function() {
+ return An.a;
+ }), l.d(_, "AxesViewer", function() {
+ return Xr.AxesViewer;
+ }), l.d(_, "BoneAxesViewer", function() {
+ return Xr.BoneAxesViewer;
+ }), l.d(_, "DebugLayerTab", function() {
+ return Xr.DebugLayerTab;
+ }), l.d(_, "DebugLayer", function() {
+ return Xr.DebugLayer;
+ }), l.d(_, "PhysicsViewer", function() {
+ return Xr.PhysicsViewer;
+ }), l.d(_, "RayHelper", function() {
+ return Xr.RayHelper;
+ }), l.d(_, "SkeletonViewer", function() {
+ return Xr.SkeletonViewer;
+ }), l.d(_, "DeviceInputSystem", function() {
+ return $d;
+ }), l.d(_, "DeviceType", function() {
+ return nn;
+ }), l.d(_, "PointerInput", function() {
+ return bl;
+ }), l.d(_, "DualShockInput", function() {
+ return yl;
+ }), l.d(_, "XboxInput", function() {
+ return El;
+ }), l.d(_, "SwitchInput", function() {
+ return Tl;
+ }), l.d(_, "DeviceSource", function() {
+ return ef;
+ }), l.d(_, "DeviceSourceManager", function() {
+ return _b;
+ }), l.d(_, "Constants", function() {
+ return d.a;
+ }), l.d(_, "ThinEngine", function() {
+ return Gt.a;
+ }), l.d(_, "Engine", function() {
+ return ke.a;
+ }), l.d(_, "EngineStore", function() {
+ return te.a;
+ }), l.d(_, "NullEngineOptions", function() {
+ return tf.b;
+ }), l.d(_, "NullEngine", function() {
+ return tf.a;
+ }), l.d(_, "_OcclusionDataStorage", function() {
+ return rf;
+ }), l.d(_, "_forceTransformFeedbackToBundle", function() {
+ return mb;
+ }), l.d(_, "EngineView", function() {
+ return gb;
+ }), l.d(_, "WebGLPipelineContext", function() {
+ return bb.a;
+ }), l.d(_, "WebGL2ShaderProcessor", function() {
+ return of.a;
+ }), l.d(_, "NativeEngine", function() {
+ return Ab;
+ }), l.d(_, "ShaderCodeInliner", function() {
+ return Pl;
+ }), l.d(_, "PerformanceConfigurator", function() {
+ return Pb.a;
+ }), l.d(_, "KeyboardEventTypes", function() {
+ return kr.a;
+ }), l.d(_, "KeyboardInfo", function() {
+ return kr.b;
+ }), l.d(_, "KeyboardInfoPre", function() {
+ return kr.c;
+ }), l.d(_, "PointerEventTypes", function() {
+ return Et.a;
+ }), l.d(_, "PointerInfoBase", function() {
+ return Et.c;
+ }), l.d(_, "PointerInfoPre", function() {
+ return Et.d;
+ }), l.d(_, "PointerInfo", function() {
+ return Et.b;
+ }), l.d(_, "ClipboardEventTypes", function() {
+ return Ss;
+ }), l.d(_, "ClipboardInfo", function() {
+ return Cb;
+ }), l.d(_, "DaydreamController", function() {
+ return xl;
+ }), l.d(_, "GearVRController", function() {
+ return Rl;
+ }), l.d(_, "GenericController", function() {
+ return As;
+ }), l.d(_, "OculusTouchController", function() {
+ return Ol;
+ }), l.d(_, "PoseEnabledControllerType", function() {
+ return Si;
+ }), l.d(_, "PoseEnabledControllerHelper", function() {
+ return pr;
+ }), l.d(_, "PoseEnabledController", function() {
+ return mo;
+ }), l.d(_, "ViveController", function() {
+ return lf;
+ }), l.d(_, "WebVRController", function() {
+ return mr;
+ }), l.d(_, "WindowsMotionController", function() {
+ return Ps;
+ }), l.d(_, "XRWindowsMotionController", function() {
+ return Rb;
+ }), l.d(_, "StickValues", function() {
+ return eb;
+ }), l.d(_, "Gamepad", function() {
+ return Sn;
+ }), l.d(_, "GenericPad", function() {
+ return bd;
+ }), l.d(_, "GamepadManager", function() {
+ return Rd;
+ }), l.d(_, "GamepadSystemSceneComponent", function() {
+ return Od;
+ }), l.d(_, "Xbox360Button", function() {
+ return kn;
+ }), l.d(_, "Xbox360Dpad", function() {
+ return zr;
+ }), l.d(_, "Xbox360Pad", function() {
+ return Cd;
+ }), l.d(_, "DualShockButton", function() {
+ return ri;
+ }), l.d(_, "DualShockDpad", function() {
+ return jr;
+ }), l.d(_, "DualShockPad", function() {
+ return xd;
+ }), l.d(_, "AxisDragGizmo", function() {
+ return Cs.a;
+ }), l.d(_, "AxisScaleGizmo", function() {
+ return Ea;
+ }), l.d(_, "BoundingBoxGizmo", function() {
+ return uf;
+ }), l.d(_, "Gizmo", function() {
+ return Kn.a;
+ }), l.d(_, "GizmoManager", function() {
+ return Ob;
+ }), l.d(_, "PlaneRotationGizmo", function() {
+ return xs;
+ }), l.d(_, "PositionGizmo", function() {
+ return df;
+ }), l.d(_, "RotationGizmo", function() {
+ return hf;
+ }), l.d(_, "ScaleGizmo", function() {
+ return ff;
+ }), l.d(_, "LightGizmo", function() {
+ return Mb;
+ }), l.d(_, "CameraGizmo", function() {
+ return Db;
+ }), l.d(_, "PlaneDragGizmo", function() {
+ return Rs;
+ }), l.d(_, "EnvironmentHelper", function() {
+ return Nl;
+ }), l.d(_, "PhotoDome", function() {
+ return Hb;
+ }), l.d(_, "_forceSceneHelpersToBundle", function() {
+ return Ny;
+ }), l.d(_, "VideoDome", function() {
+ return Fy;
+ }), l.d(_, "EngineInstrumentation", function() {
+ return By;
+ }), l.d(_, "SceneInstrumentation", function() {
+ return Uy;
+ }), l.d(_, "_TimeToken", function() {
+ return nf;
+ }), l.d(_, "EffectLayer", function() {
+ return Oa;
+ }), l.d(_, "EffectLayerSceneComponent", function() {
+ return Mf;
+ }), l.d(_, "GlowLayer", function() {
+ return Bs;
+ }), l.d(_, "HighlightLayer", function() {
+ return jl;
+ }), l.d(_, "Layer", function() {
+ return Xy;
+ }), l.d(_, "LayerSceneComponent", function() {
+ return Df;
+ }), l.d(_, "LensFlare", function() {
+ return Lf;
+ }), l.d(_, "LensFlareSystem", function() {
+ return Hl;
+ }), l.d(_, "LensFlareSystemSceneComponent", function() {
+ return wf;
+ }), l.d(_, "Light", function() {
+ return or.a;
+ }), l.d(_, "ShadowLight", function() {
+ return Os;
+ }), l.d(_, "ShadowGenerator", function() {
+ return Zn;
+ }), l.d(_, "CascadedShadowGenerator", function() {
+ return Wl;
+ }), l.d(_, "ShadowGeneratorSceneComponent", function() {
+ return Gf;
+ }), l.d(_, "DirectionalLight", function() {
+ return Il;
+ }), l.d(_, "HemisphericLight", function() {
+ return vs.a;
+ }), l.d(_, "PointLight", function() {
+ return Xl;
+ }), l.d(_, "SpotLight", function() {
+ return Dl;
+ }), l.d(_, "DefaultLoadingScreen", function() {
+ return zf;
+ }), l.d(_, "_BabylonLoaderRegistered", function() {
+ return h0;
+ }), l.d(_, "BabylonFileLoaderConfiguration", function() {
+ return zs;
+ }), l.d(_, "SceneLoaderAnimationGroupLoadingMode", function() {
+ return ir;
+ }), l.d(_, "SceneLoader", function() {
+ return zt;
+ }), l.d(_, "SceneLoaderFlags", function() {
+ return rr.a;
+ }), l.d(_, "BackgroundMaterial", function() {
+ return Sa;
+ }), l.d(_, "ColorCurves", function() {
+ return f0.a;
+ }), l.d(_, "EffectFallbacks", function() {
+ return Po.a;
+ }), l.d(_, "Effect", function() {
+ return We.a;
+ }), l.d(_, "FresnelParameters", function() {
+ return ep;
+ }), l.d(_, "ImageProcessingConfigurationDefines", function() {
+ return In.b;
+ }), l.d(_, "ImageProcessingConfiguration", function() {
+ return In.a;
+ }), l.d(_, "Material", function() {
+ return Zt.a;
+ }), l.d(_, "MaterialDefines", function() {
+ return Is.a;
+ }), l.d(_, "ThinMaterialHelper", function() {
+ return tp.a;
+ }), l.d(_, "MaterialHelper", function() {
+ return tt.a;
+ }), l.d(_, "MultiMaterial", function() {
+ return Yr.a;
+ }), l.d(_, "PBRMaterialDefines", function() {
+ return Bl;
+ }), l.d(_, "PBRBaseMaterial", function() {
+ return Cn;
+ }), l.d(_, "PBRBaseSimpleMaterial", function() {
+ return Zl;
+ }), l.d(_, "PBRMaterial", function() {
+ return Ca;
+ }), l.d(_, "PBRMetallicRoughnessMaterial", function() {
+ return np;
+ }), l.d(_, "PBRSpecularGlossinessMaterial", function() {
+ return ip;
+ }), l.d(_, "PushMaterial", function() {
+ return Ds.a;
+ }), l.d(_, "ShaderMaterial", function() {
+ return js.a;
+ }), l.d(_, "StandardMaterialDefines", function() {
+ return kt.b;
+ }), l.d(_, "StandardMaterial", function() {
+ return kt.a;
+ }), l.d(_, "BaseTexture", function() {
+ return oi.a;
+ }), l.d(_, "ColorGradingTexture", function() {
+ return rp;
+ }), l.d(_, "CubeTexture", function() {
+ return Pi;
+ }), l.d(_, "DynamicTexture", function() {
+ return $i.a;
+ }), l.d(_, "EquiRectangularCubeTexture", function() {
+ return op;
+ }), l.d(_, "HDRFiltering", function() {
+ return Xf;
+ }), l.d(_, "HDRCubeTexture", function() {
+ return Vs;
+ }), l.d(_, "HtmlElementTexture", function() {
+ return p0;
+ }), l.d(_, "InternalTextureSource", function() {
+ return Rt.b;
+ }), l.d(_, "InternalTexture", function() {
+ return Rt.a;
+ }), l.d(_, "_DDSTextureLoader", function() {
+ return vf;
+ }), l.d(_, "_ENVTextureLoader", function() {
+ return bf;
+ }), l.d(_, "_KTXTextureLoader", function() {
+ return yf;
+ }), l.d(_, "_TGATextureLoader", function() {
+ return ap;
+ }), l.d(_, "_BasisTextureLoader", function() {
+ return sp;
+ }), l.d(_, "MirrorTexture", function() {
+ return wl;
+ }), l.d(_, "MultiRenderTarget", function() {
+ return Jl;
+ }), l.d(_, "TexturePacker", function() {
+ return g0;
+ }), l.d(_, "TexturePackerFrame", function() {
+ return $l;
+ }), l.d(_, "CustomProceduralTexture", function() {
+ return b0;
+ }), l.d(_, "NoiseProceduralTexture", function() {
+ return lp;
+ }), l.d(_, "ProceduralTexture", function() {
+ return Da;
+ }), l.d(_, "ProceduralTextureSceneComponent", function() {
+ return cp;
+ }), l.d(_, "RawCubeTexture", function() {
+ return E0;
+ }), l.d(_, "RawTexture", function() {
+ return Ti;
+ }), l.d(_, "RawTexture2DArray", function() {
+ return T0;
+ }), l.d(_, "RawTexture3D", function() {
+ return S0;
+ }), l.d(_, "RefractionTexture", function() {
+ return A0;
+ }), l.d(_, "RenderTargetTexture", function() {
+ return bn;
+ }), l.d(_, "Texture", function() {
+ return Ue.a;
+ }), l.d(_, "VideoTexture", function() {
+ return Of;
+ }), l.d(_, "UniformBuffer", function() {
+ return kd.a;
+ }), l.d(_, "MaterialFlags", function() {
+ return ht.a;
+ }), l.d(_, "NodeMaterialBlockTargets", function() {
+ return Me;
+ }), l.d(_, "NodeMaterialBlockConnectionPointTypes", function() {
+ return fe;
+ }), l.d(_, "NodeMaterialBlockConnectionPointMode", function() {
+ return On;
+ }), l.d(_, "NodeMaterialSystemValues", function() {
+ return bt;
+ }), l.d(_, "NodeMaterialModes", function() {
+ return zn;
+ }), l.d(_, "NodeMaterialConnectionPointCompatibilityStates", function() {
+ return Ri;
+ }), l.d(_, "NodeMaterialConnectionPointDirection", function() {
+ return Dn;
+ }), l.d(_, "NodeMaterialConnectionPoint", function() {
+ return Ws;
+ }), l.d(_, "NodeMaterialBlock", function() {
+ return pt;
+ }), l.d(_, "NodeMaterialDefines", function() {
+ return Fa;
+ }), l.d(_, "NodeMaterial", function() {
+ return qs;
+ }), l.d(_, "VertexOutputBlock", function() {
+ return La;
+ }), l.d(_, "BonesBlock", function() {
+ return pp;
+ }), l.d(_, "InstancesBlock", function() {
+ return _p;
+ }), l.d(_, "MorphTargetsBlock", function() {
+ return mp;
+ }), l.d(_, "LightInformationBlock", function() {
+ return gp;
+ }), l.d(_, "FragmentOutputBlock", function() {
+ return No;
+ }), l.d(_, "ImageProcessingBlock", function() {
+ return vp;
+ }), l.d(_, "PerturbNormalBlock", function() {
+ return bp;
+ }), l.d(_, "DiscardBlock", function() {
+ return yp;
+ }), l.d(_, "FrontFacingBlock", function() {
+ return Ep;
+ }), l.d(_, "DerivativeBlock", function() {
+ return Tp;
+ }), l.d(_, "FragCoordBlock", function() {
+ return Sp;
+ }), l.d(_, "ScreenSizeBlock", function() {
+ return Ap;
+ }), l.d(_, "FogBlock", function() {
+ return Pp;
+ }), l.d(_, "LightBlock", function() {
+ return Cp;
+ }), l.d(_, "TextureBlock", function() {
+ return xp;
+ }), l.d(_, "ReflectionTextureBlock", function() {
+ return Rp;
+ }), l.d(_, "CurrentScreenBlock", function() {
+ return tu;
+ }), l.d(_, "InputBlock", function() {
+ return At;
+ }), l.d(_, "AnimatedInputBlockTypes", function() {
+ return Tr;
+ }), l.d(_, "MultiplyBlock", function() {
+ return Ys;
+ }), l.d(_, "AddBlock", function() {
+ return Op;
+ }), l.d(_, "ScaleBlock", function() {
+ return Mp;
+ }), l.d(_, "ClampBlock", function() {
+ return Ip;
+ }), l.d(_, "CrossBlock", function() {
+ return Dp;
+ }), l.d(_, "DotBlock", function() {
+ return Lp;
+ }), l.d(_, "TransformBlock", function() {
+ return Xs;
+ }), l.d(_, "RemapBlock", function() {
+ return ou;
+ }), l.d(_, "NormalizeBlock", function() {
+ return wp;
+ }), l.d(_, "TrigonometryBlockOperations", function() {
+ return fn;
+ }), l.d(_, "TrigonometryBlock", function() {
+ return du;
+ }), l.d(_, "ColorMergerBlock", function() {
+ return Np;
+ }), l.d(_, "VectorMergerBlock", function() {
+ return wa;
+ }), l.d(_, "ColorSplitterBlock", function() {
+ return hu;
+ }), l.d(_, "VectorSplitterBlock", function() {
+ return Fp;
+ }), l.d(_, "LerpBlock", function() {
+ return Bp;
+ }), l.d(_, "DivideBlock", function() {
+ return Up;
+ }), l.d(_, "SubtractBlock", function() {
+ return Vp;
+ }), l.d(_, "StepBlock", function() {
+ return kp;
+ }), l.d(_, "OneMinusBlock", function() {
+ return _u;
+ }), l.d(_, "ViewDirectionBlock", function() {
+ return mu;
+ }), l.d(_, "FresnelBlock", function() {
+ return Gp;
+ }), l.d(_, "MaxBlock", function() {
+ return zp;
+ }), l.d(_, "MinBlock", function() {
+ return jp;
+ }), l.d(_, "DistanceBlock", function() {
+ return Hp;
+ }), l.d(_, "LengthBlock", function() {
+ return Wp;
+ }), l.d(_, "NegateBlock", function() {
+ return Xp;
+ }), l.d(_, "PowBlock", function() {
+ return Yp;
+ }), l.d(_, "RandomNumberBlock", function() {
+ return Kp;
+ }), l.d(_, "ArcTan2Block", function() {
+ return Qp;
+ }), l.d(_, "SmoothStepBlock", function() {
+ return qp;
+ }), l.d(_, "ReciprocalBlock", function() {
+ return Zp;
+ }), l.d(_, "ReplaceColorBlock", function() {
+ return Jp;
+ }), l.d(_, "PosterizeBlock", function() {
+ return $p;
+ }), l.d(_, "WaveBlockKind", function() {
+ return Kr;
+ }), l.d(_, "WaveBlock", function() {
+ return e_;
+ }), l.d(_, "GradientBlockColorStep", function() {
+ return Zs;
+ }), l.d(_, "GradientBlock", function() {
+ return t_;
+ }), l.d(_, "NLerpBlock", function() {
+ return n_;
+ }), l.d(_, "WorleyNoise3DBlock", function() {
+ return i_;
+ }), l.d(_, "SimplexPerlin3DBlock", function() {
+ return r_;
+ }), l.d(_, "NormalBlendBlock", function() {
+ return o_;
+ }), l.d(_, "Rotate2dBlock", function() {
+ return a_;
+ }), l.d(_, "ReflectBlock", function() {
+ return s_;
+ }), l.d(_, "RefractBlock", function() {
+ return c_;
+ }), l.d(_, "DesaturateBlock", function() {
+ return l_;
+ }), l.d(_, "PBRMetallicRoughnessBlock", function() {
+ return u_;
+ }), l.d(_, "SheenBlock", function() {
+ return gu;
+ }), l.d(_, "AnisotropyBlock", function() {
+ return vu;
+ }), l.d(_, "ReflectionBlock", function() {
+ return bu;
+ }), l.d(_, "ClearCoatBlock", function() {
+ return Js;
+ }), l.d(_, "RefractionBlock", function() {
+ return yu;
+ }), l.d(_, "SubSurfaceBlock", function() {
+ return $s;
+ }), l.d(_, "ParticleTextureBlock", function() {
+ return nu;
+ }), l.d(_, "ParticleRampGradientBlock", function() {
+ return iu;
+ }), l.d(_, "ParticleBlendMultiplyBlock", function() {
+ return ru;
+ }), l.d(_, "ModBlock", function() {
+ return h_;
+ }), l.d(_, "NodeMaterialOptimizer", function() {
+ return O0;
+ }), l.d(_, "PropertyTypeForEdition", function() {
+ return Ft;
+ }), l.d(_, "editableInPropertyPage", function() {
+ return jt;
+ }), l.d(_, "EffectRenderer", function() {
+ return Hf;
+ }), l.d(_, "EffectWrapper", function() {
+ return Wf;
+ }), l.d(_, "ShadowDepthWrapper", function() {
+ return D0;
+ }), l.d(_, "Scalar", function() {
+ return ee.a;
+ }), l.d(_, "extractMinAndMaxIndexed", function() {
+ return d_.b;
+ }), l.d(_, "extractMinAndMax", function() {
+ return d_.a;
+ }), l.d(_, "Space", function() {
+ return Se.c;
+ }), l.d(_, "Axis", function() {
+ return Se.a;
+ }), l.d(_, "Coordinate", function() {
+ return Se.b;
+ }), l.d(_, "Color3", function() {
+ return C.a;
+ }), l.d(_, "Color4", function() {
+ return C.b;
+ }), l.d(_, "TmpColors", function() {
+ return C.c;
+ }), l.d(_, "ToGammaSpace", function() {
+ return Xt.b;
+ }), l.d(_, "ToLinearSpace", function() {
+ return Xt.c;
+ }), l.d(_, "Epsilon", function() {
+ return Xt.a;
+ }), l.d(_, "Frustum", function() {
+ return zd.a;
+ }), l.d(_, "Orientation", function() {
+ return Ze.e;
+ }), l.d(_, "BezierCurve", function() {
+ return Ze.c;
+ }), l.d(_, "Angle", function() {
+ return Ze.a;
+ }), l.d(_, "Arc2", function() {
+ return Ze.b;
+ }), l.d(_, "Path2", function() {
+ return Ze.f;
+ }), l.d(_, "Path3D", function() {
+ return Ze.g;
+ }), l.d(_, "Curve3", function() {
+ return Ze.d;
+ }), l.d(_, "Plane", function() {
+ return yo.a;
+ }), l.d(_, "Size", function() {
+ return le.a;
+ }), l.d(_, "Vector2", function() {
+ return c.d;
+ }), l.d(_, "Vector3", function() {
+ return c.e;
+ }), l.d(_, "Vector4", function() {
+ return c.f;
+ }), l.d(_, "Quaternion", function() {
+ return c.b;
+ }), l.d(_, "Matrix", function() {
+ return c.a;
+ }), l.d(_, "TmpVectors", function() {
+ return c.c;
+ }), l.d(_, "PositionNormalVertex", function() {
+ return Ll;
+ }), l.d(_, "PositionNormalTextureVertex", function() {
+ return Ib;
+ }), l.d(_, "Viewport", function() {
+ return li.a;
+ }), l.d(_, "SphericalHarmonics", function() {
+ return Al;
+ }), l.d(_, "SphericalPolynomial", function() {
+ return ya;
+ }), l.d(_, "AbstractMesh", function() {
+ return Nt.a;
+ }), l.d(_, "Buffer", function() {
+ return De.a;
+ }), l.d(_, "VertexBuffer", function() {
+ return De.b;
+ }), l.d(_, "DracoCompression", function() {
+ return w0;
+ }), l.d(_, "CSG", function() {
+ return B0;
+ }), l.d(_, "Geometry", function() {
+ return Yl.a;
+ }), l.d(_, "GroundMesh", function() {
+ return Es;
+ }), l.d(_, "TrailMesh", function() {
+ return U0;
+ }), l.d(_, "InstancedMesh", function() {
+ return V0.a;
+ }), l.d(_, "LinesMesh", function() {
+ return Ua.b;
+ }), l.d(_, "InstancedLinesMesh", function() {
+ return Ua.a;
+ }), l.d(_, "_CreationDataStorage", function() {
+ return we.b;
+ }), l.d(_, "_InstancesBatch", function() {
+ return we.c;
+ }), l.d(_, "Mesh", function() {
+ return we.a;
+ }), l.d(_, "VertexData", function() {
+ return ft.a;
+ }), l.d(_, "MeshBuilder", function() {
+ return z0;
+ }), l.d(_, "SimplificationSettings", function() {
+ return j0;
+ }), l.d(_, "SimplificationQueue", function() {
+ return v_;
+ }), l.d(_, "SimplificationType", function() {
+ return Ga;
+ }), l.d(_, "QuadraticErrorSimplification", function() {
+ return y_;
+ }), l.d(_, "SimplicationQueueSceneComponent", function() {
+ return E_;
+ }), l.d(_, "Polygon", function() {
+ return G0;
+ }), l.d(_, "PolygonMeshBuilder", function() {
+ return m_;
+ }), l.d(_, "SubMesh", function() {
+ return Ba.a;
+ }), l.d(_, "MeshLODLevel", function() {
+ return Y0.a;
+ }), l.d(_, "TransformNode", function() {
+ return Ao.a;
+ }), l.d(_, "BoxBuilder", function() {
+ return So.a;
+ }), l.d(_, "TiledBoxBuilder", function() {
+ return __;
+ }), l.d(_, "DiscBuilder", function() {
+ return ec;
+ }), l.d(_, "RibbonBuilder", function() {
+ return Va.a;
+ }), l.d(_, "SphereBuilder", function() {
+ return Qn.a;
+ }), l.d(_, "HemisphereBuilder", function() {
+ return Ms;
+ }), l.d(_, "CylinderBuilder", function() {
+ return Vi.a;
+ }), l.d(_, "TorusBuilder", function() {
+ return bo;
+ }), l.d(_, "TorusKnotBuilder", function() {
+ return Su;
+ }), l.d(_, "LinesBuilder", function() {
+ return yn.a;
+ }), l.d(_, "PolygonBuilder", function() {
+ return ka;
+ }), l.d(_, "ShapeBuilder", function() {
+ return Gs.a;
+ }), l.d(_, "LatheBuilder", function() {
+ return Pu;
+ }), l.d(_, "PlaneBuilder", function() {
+ return Ml.a;
+ }), l.d(_, "TiledPlaneBuilder", function() {
+ return g_;
+ }), l.d(_, "GroundBuilder", function() {
+ return gr;
+ }), l.d(_, "TubeBuilder", function() {
+ return Cu;
+ }), l.d(_, "PolyhedronBuilder", function() {
+ return Ta;
+ }), l.d(_, "IcoSphereBuilder", function() {
+ return xu;
+ }), l.d(_, "DecalBuilder", function() {
+ return Ru;
+ }), l.d(_, "CapsuleBuilder", function() {
+ return Ou;
+ }), l.d(_, "DataBuffer", function() {
+ return af.a;
+ }), l.d(_, "WebGLDataBuffer", function() {
+ return K0.a;
+ }), l.d(_, "MorphTarget", function() {
+ return Yf;
+ }), l.d(_, "MorphTargetManager", function() {
+ return ks;
+ }), l.d(_, "RecastJSPlugin", function() {
+ return Q0;
+ }), l.d(_, "RecastJSCrowd", function() {
+ return T_;
+ }), l.d(_, "Node", function() {
+ return q.a;
+ }), l.d(_, "Database", function() {
+ return S_;
+ }), l.d(_, "BaseParticleSystem", function() {
+ return Na;
+ }), l.d(_, "BoxParticleEmitter", function() {
+ return Fo;
+ }), l.d(_, "ConeParticleEmitter", function() {
+ return au;
+ }), l.d(_, "CylinderParticleEmitter", function() {
+ return Ks;
+ }), l.d(_, "CylinderDirectedParticleEmitter", function() {
+ return su;
+ }), l.d(_, "HemisphericParticleEmitter", function() {
+ return cu;
+ }), l.d(_, "PointParticleEmitter", function() {
+ return lu;
+ }), l.d(_, "SphereParticleEmitter", function() {
+ return Qs;
+ }), l.d(_, "SphereDirectedParticleEmitter", function() {
+ return uu;
+ }), l.d(_, "CustomParticleEmitter", function() {
+ return Bo;
+ }), l.d(_, "MeshParticleEmitter", function() {
+ return dp;
+ }), l.d(_, "GPUParticleSystem", function() {
+ return Qr;
+ }), l.d(_, "Particle", function() {
+ return P_;
+ }), l.d(_, "ParticleHelper", function() {
+ return iE;
+ }), l.d(_, "ParticleSystem", function() {
+ return En;
+ }), l.d(_, "ParticleSystemSet", function() {
+ return tc;
+ }), l.d(_, "SolidParticle", function() {
+ return Du;
+ }), l.d(_, "ModelShape", function() {
+ return Lu;
+ }), l.d(_, "DepthSortedParticle", function() {
+ return C_;
+ }), l.d(_, "SolidParticleVertex", function() {
+ return x_;
+ }), l.d(_, "SolidParticleSystem", function() {
+ return rE;
+ }), l.d(_, "CloudPoint", function() {
+ return R_;
+ }), l.d(_, "PointsGroup", function() {
+ return nc;
+ }), l.d(_, "PointColor", function() {
+ return Ln;
+ }), l.d(_, "PointsCloudSystem", function() {
+ return oE;
+ }), l.d(_, "SubEmitterType", function() {
+ return Uo;
+ }), l.d(_, "SubEmitter", function() {
+ return za;
+ }), l.d(_, "PhysicsEngine", function() {
+ return Lo;
+ }), l.d(_, "PhysicsEngineSceneComponent", function() {
+ return O_;
+ }), l.d(_, "PhysicsHelper", function() {
+ return aE;
+ }), l.d(_, "PhysicsRadialExplosionEventOptions", function() {
+ return ko;
+ }), l.d(_, "PhysicsUpdraftEventOptions", function() {
+ return wu;
+ }), l.d(_, "PhysicsVortexEventOptions", function() {
+ return Nu;
+ }), l.d(_, "PhysicsRadialImpulseFalloff", function() {
+ return ja;
+ }), l.d(_, "PhysicsUpdraftMode", function() {
+ return Vo;
+ }), l.d(_, "PhysicsImpostor", function() {
+ return Ct.a;
+ }), l.d(_, "PhysicsJoint", function() {
+ return un.e;
+ }), l.d(_, "DistanceJoint", function() {
+ return un.a;
+ }), l.d(_, "MotorEnabledJoint", function() {
+ return un.d;
+ }), l.d(_, "HingeJoint", function() {
+ return un.c;
+ }), l.d(_, "Hinge2Joint", function() {
+ return un.b;
+ }), l.d(_, "CannonJSPlugin", function() {
+ return ql;
+ }), l.d(_, "AmmoJSPlugin", function() {
+ return Qf;
+ }), l.d(_, "OimoJSPlugin", function() {
+ return Kf;
+ }), l.d(_, "AnaglyphPostProcess", function() {
+ return hl;
+ }), l.d(_, "BlackAndWhitePostProcess", function() {
+ return I_;
+ }), l.d(_, "BloomEffect", function() {
+ return Uu;
+ }), l.d(_, "BloomMergePostProcess", function() {
+ return Bu;
+ }), l.d(_, "BlurPostProcess", function() {
+ return xn;
+ }), l.d(_, "ChromaticAberrationPostProcess", function() {
+ return Vu;
+ }), l.d(_, "CircleOfConfusionPostProcess", function() {
+ return ku;
+ }), l.d(_, "ColorCorrectionPostProcess", function() {
+ return D_;
+ }), l.d(_, "ConvolutionPostProcess", function() {
+ return L_;
+ }), l.d(_, "DepthOfFieldBlurPostProcess", function() {
+ return ic;
+ }), l.d(_, "DepthOfFieldEffectBlurLevel", function() {
+ return qr;
+ }), l.d(_, "DepthOfFieldEffect", function() {
+ return Gu;
+ }), l.d(_, "DepthOfFieldMergePostProcessOptions", function() {
+ return vE;
+ }), l.d(_, "DepthOfFieldMergePostProcess", function() {
+ return w_;
+ }), l.d(_, "DisplayPassPostProcess", function() {
+ return N_;
+ }), l.d(_, "ExtractHighlightsPostProcess", function() {
+ return Fu;
+ }), l.d(_, "FilterPostProcess", function() {
+ return F_;
+ }), l.d(_, "FxaaPostProcess", function() {
+ return Ha;
+ }), l.d(_, "GrainPostProcess", function() {
+ return zu;
+ }), l.d(_, "HighlightsPostProcess", function() {
+ return PE;
+ }), l.d(_, "ImageProcessingPostProcess", function() {
+ return ys;
+ }), l.d(_, "MotionBlurPostProcess", function() {
+ return ju;
+ }), l.d(_, "PassPostProcess", function() {
+ return _r;
+ }), l.d(_, "PassCubePostProcess", function() {
+ return ab;
+ }), l.d(_, "PostProcess", function() {
+ return _t;
+ }), l.d(_, "PostProcessManager", function() {
+ return fl.a;
+ }), l.d(_, "RefractionPostProcess", function() {
+ return U_;
+ }), l.d(_, "DefaultRenderingPipeline", function() {
+ return G_;
+ }), l.d(_, "LensRenderingPipeline", function() {
+ return wE;
+ }), l.d(_, "SSAO2RenderingPipeline", function() {
+ return z_;
+ }), l.d(_, "SSAORenderingPipeline", function() {
+ return VE;
+ }), l.d(_, "StandardRenderingPipeline", function() {
+ return j_;
+ }), l.d(_, "PostProcessRenderEffect", function() {
+ return Ot;
+ }), l.d(_, "PostProcessRenderPipeline", function() {
+ return Go;
+ }), l.d(_, "PostProcessRenderPipelineManager", function() {
+ return V_;
+ }), l.d(_, "PostProcessRenderPipelineManagerSceneComponent", function() {
+ return k_;
+ }), l.d(_, "SharpenPostProcess", function() {
+ return Hu;
+ }), l.d(_, "StereoscopicInterlacePostProcessI", function() {
+ return HE;
+ }), l.d(_, "StereoscopicInterlacePostProcess", function() {
+ return WE;
+ }), l.d(_, "TonemappingOperator", function() {
+ return Zr;
+ }), l.d(_, "TonemapPostProcess", function() {
+ return YE;
+ }), l.d(_, "VolumetricLightScatteringPostProcess", function() {
+ return H_;
+ }), l.d(_, "VRDistortionCorrectionPostProcess", function() {
+ return dl;
+ }), l.d(_, "VRMultiviewToSingleviewPostProcess", function() {
+ return pl;
+ }), l.d(_, "ScreenSpaceReflectionPostProcess", function() {
+ return Wu;
+ }), l.d(_, "ScreenSpaceCurvaturePostProcess", function() {
+ return W_;
+ }), l.d(_, "ReflectionProbe", function() {
+ return qf;
+ }), l.d(_, "BoundingBoxRenderer", function() {
+ return X_;
+ }), l.d(_, "DepthRenderer", function() {
+ return Us;
+ }), l.d(_, "DepthRendererSceneComponent", function() {
+ return Y_;
+ }), l.d(_, "EdgesRenderer", function() {
+ return Xu;
+ }), l.d(_, "LineEdgesRenderer", function() {
+ return K_;
+ }), l.d(_, "GeometryBufferRenderer", function() {
+ return Oi;
+ }), l.d(_, "GeometryBufferRendererSceneComponent", function() {
+ return B_;
+ }), l.d(_, "PrePassRenderer", function() {
+ return Yu;
+ }), l.d(_, "PrePassRendererSceneComponent", function() {
+ return Q_;
+ }), l.d(_, "SubSurfaceSceneComponent", function() {
+ return Z_;
+ }), l.d(_, "OutlineRenderer", function() {
+ return J_;
+ }), l.d(_, "RenderingGroup", function() {
+ return aT.a;
+ }), l.d(_, "RenderingGroupInfo", function() {
+ return ga.a;
+ }), l.d(_, "RenderingManager", function() {
+ return ga.b;
+ }), l.d(_, "UtilityLayerRenderer", function() {
+ return Gn.a;
+ }), l.d(_, "Scene", function() {
+ return ge.a;
+ }), l.d(_, "SceneComponentConstants", function() {
+ return st.a;
+ }), l.d(_, "Stage", function() {
+ return st.b;
+ }), l.d(_, "Sprite", function() {
+ return $_;
+ }), l.d(_, "SpriteManager", function() {
+ return tm;
+ }), l.d(_, "SpriteMap", function() {
+ return dT;
+ }), l.d(_, "SpritePackedManager", function() {
+ return fT;
+ }), l.d(_, "SpriteSceneComponent", function() {
+ return em;
+ }), l.d(_, "AlphaState", function() {
+ return pT.a;
+ }), l.d(_, "DepthCullingState", function() {
+ return _T.a;
+ }), l.d(_, "StencilState", function() {
+ return mT.a;
+ }), l.d(_, "AndOrNotEvaluator", function() {
+ return gT.a;
+ }), l.d(_, "AssetTaskState", function() {
+ return Gi;
+ }), l.d(_, "AbstractAssetTask", function() {
+ return zi;
+ }), l.d(_, "AssetsProgressEvent", function() {
+ return nm;
+ }), l.d(_, "ContainerAssetTask", function() {
+ return im;
+ }), l.d(_, "MeshAssetTask", function() {
+ return rm;
+ }), l.d(_, "TextFileAssetTask", function() {
+ return om;
+ }), l.d(_, "BinaryFileAssetTask", function() {
+ return am;
+ }), l.d(_, "ImageAssetTask", function() {
+ return sm;
+ }), l.d(_, "TextureAssetTask", function() {
+ return cm;
+ }), l.d(_, "CubeTextureAssetTask", function() {
+ return lm;
+ }), l.d(_, "HDRCubeTextureAssetTask", function() {
+ return um;
+ }), l.d(_, "EquiRectangularCubeTextureAssetTask", function() {
+ return hm;
+ }), l.d(_, "AssetsManager", function() {
+ return vT;
+ }), l.d(_, "BasisTranscodeConfiguration", function() {
+ return _0;
+ }), l.d(_, "BasisTools", function() {
+ return Ia;
+ }), l.d(_, "DDSTools", function() {
+ return yr;
+ }), l.d(_, "expandToProperty", function() {
+ return w.b;
+ }), l.d(_, "serialize", function() {
+ return w.c;
+ }), l.d(_, "serializeAsTexture", function() {
+ return w.m;
+ }), l.d(_, "serializeAsColor3", function() {
+ return w.e;
+ }), l.d(_, "serializeAsFresnelParameters", function() {
+ return w.h;
+ }), l.d(_, "serializeAsVector2", function() {
+ return w.n;
+ }), l.d(_, "serializeAsVector3", function() {
+ return w.o;
+ }), l.d(_, "serializeAsMeshReference", function() {
+ return w.k;
+ }), l.d(_, "serializeAsColorCurves", function() {
+ return w.g;
+ }), l.d(_, "serializeAsColor4", function() {
+ return w.f;
+ }), l.d(_, "serializeAsImageProcessingConfiguration", function() {
+ return w.i;
+ }), l.d(_, "serializeAsQuaternion", function() {
+ return w.l;
+ }), l.d(_, "serializeAsMatrix", function() {
+ return w.j;
+ }), l.d(_, "serializeAsCameraReference", function() {
+ return w.d;
+ }), l.d(_, "SerializationHelper", function() {
+ return w.a;
+ }), l.d(_, "Deferred", function() {
+ return bT;
+ }), l.d(_, "EnvironmentTextureTools", function() {
+ return nr;
+ }), l.d(_, "MeshExploder", function() {
+ return yT;
+ }), l.d(_, "FilesInput", function() {
+ return ET;
+ }), l.d(_, "CubeMapToSphericalPolynomialTools", function() {
+ return Ts;
+ }), l.d(_, "HDRTools", function() {
+ return jf;
+ }), l.d(_, "PanoramaToCubeMapTools", function() {
+ return Kl;
+ }), l.d(_, "KhronosTextureContainer", function() {
+ return Fs;
+ }), l.d(_, "EventState", function() {
+ return P.a;
+ }), l.d(_, "Observer", function() {
+ return P.d;
+ }), l.d(_, "MultiObserver", function() {
+ return P.b;
+ }), l.d(_, "Observable", function() {
+ return P.c;
+ }), l.d(_, "PerformanceMonitor", function() {
+ return dm.a;
+ }), l.d(_, "RollingAverage", function() {
+ return dm.b;
+ }), l.d(_, "PromisePolyfill", function() {
+ return TT.a;
+ }), l.d(_, "SceneOptimization", function() {
+ return ji;
+ }), l.d(_, "TextureOptimization", function() {
+ return rc;
+ }), l.d(_, "HardwareScalingOptimization", function() {
+ return Qu;
+ }), l.d(_, "ShadowsOptimization", function() {
+ return oc;
+ }), l.d(_, "PostProcessesOptimization", function() {
+ return ac;
+ }), l.d(_, "LensFlaresOptimization", function() {
+ return sc;
+ }), l.d(_, "CustomOptimization", function() {
+ return fm;
+ }), l.d(_, "ParticlesOptimization", function() {
+ return cc;
+ }), l.d(_, "RenderTargetsOptimization", function() {
+ return qu;
+ }), l.d(_, "MergeMeshesOptimization", function() {
+ return lc;
+ }), l.d(_, "SceneOptimizerOptions", function() {
+ return Zu;
+ }), l.d(_, "SceneOptimizer", function() {
+ return ST;
+ }), l.d(_, "SceneSerializer", function() {
+ return $u;
+ }), l.d(_, "SmartArray", function() {
+ return Ui.a;
+ }), l.d(_, "SmartArrayNoDuplicate", function() {
+ return Ui.b;
+ }), l.d(_, "StringDictionary", function() {
+ return Ed.a;
+ }), l.d(_, "Tags", function() {
+ return AT.a;
+ }), l.d(_, "TextureTools", function() {
+ return PT;
+ }), l.d(_, "TGATools", function() {
+ return Hs;
+ }), l.d(_, "Tools", function() {
+ return Ke.b;
+ }), l.d(_, "className", function() {
+ return Ke.c;
+ }), l.d(_, "AsyncLoop", function() {
+ return Ke.a;
+ }), l.d(_, "VideoRecorder", function() {
+ return CT;
+ }), l.d(_, "JoystickAxis", function() {
+ return mn;
+ }), l.d(_, "VirtualJoystick", function() {
+ return sl;
+ }), l.d(_, "WorkerPool", function() {
+ return Vl;
+ }), l.d(_, "Logger", function() {
+ return h.a;
+ }), l.d(_, "_TypeStore", function() {
+ return x.a;
+ }), l.d(_, "FilesInputStore", function() {
+ return Cl.a;
+ }), l.d(_, "DeepCopier", function() {
+ return _e.a;
+ }), l.d(_, "PivotTools", function() {
+ return ii.a;
+ }), l.d(_, "PrecisionDate", function() {
+ return Te.a;
+ }), l.d(_, "ScreenshotTools", function() {
+ return Wa;
+ }), l.d(_, "WebRequest", function() {
+ return ce.a;
+ }), l.d(_, "InspectableType", function() {
+ return Ku;
+ }), l.d(_, "BRDFTextureTools", function() {
+ return Ls;
+ }), l.d(_, "RGBDTextureTools", function() {
+ return pf;
+ }), l.d(_, "ColorGradient", function() {
+ return Mu;
+ }), l.d(_, "Color3Gradient", function() {
+ return A_;
+ }), l.d(_, "FactorGradient", function() {
+ return Iu;
+ }), l.d(_, "GradientHelper", function() {
+ return jn;
+ }), l.d(_, "PerfCounter", function() {
+ return ai.a;
+ }), l.d(_, "RetryStrategy", function() {
+ return xT.a;
+ }), l.d(_, "CanvasGenerator", function() {
+ return _l.a;
+ }), l.d(_, "LoadFileError", function() {
+ return ba.b;
+ }), l.d(_, "RequestFileError", function() {
+ return ba.d;
+ }), l.d(_, "ReadFileError", function() {
+ return ba.c;
+ }), l.d(_, "FileTools", function() {
+ return ba.a;
+ }), l.d(_, "StringTools", function() {
+ return ui.a;
+ }), l.d(_, "DataReader", function() {
+ return RT;
+ }), l.d(_, "MinMaxReducer", function() {
+ return Bf;
+ }), l.d(_, "DepthReducer", function() {
+ return Uf;
+ }), l.d(_, "DataStorage", function() {
+ return OT;
+ }), l.d(_, "SceneRecorder", function() {
+ return MT;
+ }), l.d(_, "KhronosTextureContainer2", function() {
+ return kl;
+ }), l.d(_, "Trajectory", function() {
+ return IT;
+ }), l.d(_, "TrajectoryClassifier", function() {
+ return DT;
+ }), l.d(_, "TimerState", function() {
+ return Er;
+ }), l.d(_, "setAndStartTimer", function() {
+ return zl;
+ }), l.d(_, "AdvancedTimer", function() {
+ return Ly;
+ }), l.d(_, "CopyTools", function() {
+ return LT.a;
+ }), l.d(_, "WebXRCamera", function() {
+ return Ef;
+ }), l.d(_, "WebXREnterExitUIButton", function() {
+ return Cf;
+ }), l.d(_, "WebXREnterExitUIOptions", function() {
+ return Dy;
+ }), l.d(_, "WebXREnterExitUI", function() {
+ return xf;
+ }), l.d(_, "WebXRExperienceHelper", function() {
+ return Tf;
+ }), l.d(_, "WebXRInput", function() {
+ return Pf;
+ }), l.d(_, "WebXRInputSource", function() {
+ return Af;
+ }), l.d(_, "WebXRManagedOutputCanvasOptions", function() {
+ return ml;
+ }), l.d(_, "WebXRManagedOutputCanvas", function() {
+ return Wd;
+ }), l.d(_, "WebXRState", function() {
+ return Pn;
+ }), l.d(_, "WebXRTrackingState", function() {
+ return Hr;
+ }), l.d(_, "WebXRSessionManager", function() {
+ return gl;
+ }), l.d(_, "WebXRDefaultExperienceOptions", function() {
+ return wy;
+ }), l.d(_, "WebXRDefaultExperience", function() {
+ return Rf;
+ }), l.d(_, "WebXRFeatureName", function() {
+ return Ci;
+ }), l.d(_, "WebXRFeaturesManager", function() {
+ return hi;
+ }), l.d(_, "WebXRAbstractFeature", function() {
+ return xi;
+ }), l.d(_, "WebXRHitTestLegacy", function() {
+ return hc;
+ }), l.d(_, "WebXRAnchorSystem", function() {
+ return dc;
+ }), l.d(_, "WebXRPlaneDetector", function() {
+ return fc;
+ }), l.d(_, "WebXRBackgroundRemover", function() {
+ return pc;
+ }), l.d(_, "WebXRMotionControllerTeleportation", function() {
+ return Ra;
+ }), l.d(_, "WebXRControllerPointerSelection", function() {
+ return xa;
+ }), l.d(_, "IWebXRControllerPhysicsOptions", function() {
+ return FT;
+ }), l.d(_, "WebXRControllerPhysics", function() {
+ return _c;
+ }), l.d(_, "WebXRHitTest", function() {
+ return mc;
+ }), l.d(_, "WebXRFeaturePointSystem", function() {
+ return gc;
+ }), l.d(_, "WebXRHand", function() {
+ return gm;
+ }), l.d(_, "WebXRHandTracking", function() {
+ return vc;
+ }), l.d(_, "WebXRAbstractMotionController", function() {
+ return Mo;
+ }), l.d(_, "WebXRControllerComponent", function() {
+ return Oo;
+ }), l.d(_, "WebXRGenericTriggerMotionController", function() {
+ return Gl;
+ }), l.d(_, "WebXRMicrosoftMixedRealityController", function() {
+ return vm;
+ }), l.d(_, "WebXRMotionControllerManager", function() {
+ return qn;
+ }), l.d(_, "WebXROculusTouchMotionController", function() {
+ return th;
+ }), l.d(_, "WebXRHTCViveMotionController", function() {
+ return bm;
+ }), l.d(_, "WebXRProfiledMotionController", function() {
+ return Sf;
+ });
+ var D = l(35), f = l(91), P = l(6), c = l(0), C = l(9), x = l(11), R = function() {
+ function r(t, e) {
+ this.triggerOptions = t, this.onBeforeExecuteObservable = new P.c(), t.parameter ? (this.trigger = t.trigger, this._triggerParameter = t.parameter) : t.trigger ? this.trigger = t.trigger : this.trigger = t, this._nextActiveAction = this, this._condition = e;
+ }
+ return r.prototype._prepare = function() {
+ }, r.prototype.getTriggerParameter = function() {
+ return this._triggerParameter;
+ }, r.prototype._executeCurrent = function(t) {
+ if (this._nextActiveAction._condition) {
+ var e = this._nextActiveAction._condition, n = this._actionManager.getScene().getRenderId();
+ if (e._evaluationId === n) {
+ if (!e._currentResult)
+ return;
+ } else {
+ if (e._evaluationId = n, !e.isValid())
+ return void (e._currentResult = !1);
+ e._currentResult = !0;
+ }
+ }
+ this.onBeforeExecuteObservable.notifyObservers(this), this._nextActiveAction.execute(t), this.skipToNextActiveAction();
+ }, r.prototype.execute = function(t) {
+ }, r.prototype.skipToNextActiveAction = function() {
+ this._nextActiveAction._child ? (this._nextActiveAction._child._actionManager || (this._nextActiveAction._child._actionManager = this._actionManager), this._nextActiveAction = this._nextActiveAction._child) : this._nextActiveAction = this;
+ }, r.prototype.then = function(t) {
+ return this._child = t, t._actionManager = this._actionManager, t._prepare(), t;
+ }, r.prototype._getProperty = function(t) {
+ return this._actionManager._getProperty(t);
+ }, r.prototype._getEffectiveTarget = function(t, e) {
+ return this._actionManager._getEffectiveTarget(t, e);
+ }, r.prototype.serialize = function(t) {
+ }, r.prototype._serialize = function(t, e) {
+ var n = { type: 1, children: [], name: t.name, properties: t.properties || [] };
+ if (this._child && this._child.serialize(n), this._condition) {
+ var i = this._condition.serialize();
+ return i.children.push(n), e && e.children.push(i), i;
+ }
+ return e && e.children.push(n), n;
+ }, r._SerializeValueAsString = function(t) {
+ return typeof t == "number" ? t.toString() : typeof t == "boolean" ? t ? "true" : "false" : t instanceof c.d ? t.x + ", " + t.y : t instanceof c.e ? t.x + ", " + t.y + ", " + t.z : t instanceof C.a ? t.r + ", " + t.g + ", " + t.b : t instanceof C.b ? t.r + ", " + t.g + ", " + t.b + ", " + t.a : t;
+ }, r._GetTargetProperty = function(t) {
+ return { name: "target", targetType: t._isMesh ? "MeshProperties" : t._isLight ? "LightProperties" : t._isCamera ? "CameraProperties" : "SceneProperties", value: t._isScene ? "Scene" : t.name };
+ }, r;
+ }();
+ x.a.RegisteredTypes["BABYLON.Action"] = R;
+ var g = l(47), u = l(1), E = function() {
+ function r(t) {
+ this._actionManager = t;
+ }
+ return r.prototype.isValid = function() {
+ return !0;
+ }, r.prototype._getProperty = function(t) {
+ return this._actionManager._getProperty(t);
+ }, r.prototype._getEffectiveTarget = function(t, e) {
+ return this._actionManager._getEffectiveTarget(t, e);
+ }, r.prototype.serialize = function() {
+ }, r.prototype._serialize = function(t) {
+ return { type: 2, children: [], name: t.name, properties: t.properties };
+ }, r;
+ }(), A = function(r) {
+ function t(e, n, i, o, a) {
+ a === void 0 && (a = t.IsEqual);
+ var s = r.call(this, e) || this;
+ return s.propertyPath = i, s.value = o, s.operator = a, s._target = n, s._effectiveTarget = s._getEffectiveTarget(n, s.propertyPath), s._property = s._getProperty(s.propertyPath), s;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t, "IsEqual", { get: function() {
+ return t._IsEqual;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t, "IsDifferent", { get: function() {
+ return t._IsDifferent;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t, "IsGreater", { get: function() {
+ return t._IsGreater;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t, "IsLesser", { get: function() {
+ return t._IsLesser;
+ }, enumerable: !1, configurable: !0 }), t.prototype.isValid = function() {
+ switch (this.operator) {
+ case t.IsGreater:
+ return this._effectiveTarget[this._property] > this.value;
+ case t.IsLesser:
+ return this._effectiveTarget[this._property] < this.value;
+ case t.IsEqual:
+ case t.IsDifferent:
+ var e;
+ return e = this.value.equals ? this.value.equals(this._effectiveTarget[this._property]) : this.value === this._effectiveTarget[this._property], this.operator === t.IsEqual ? e : !e;
+ }
+ return !1;
+ }, t.prototype.serialize = function() {
+ return this._serialize({ name: "ValueCondition", properties: [R._GetTargetProperty(this._target), { name: "propertyPath", value: this.propertyPath }, { name: "value", value: R._SerializeValueAsString(this.value) }, { name: "operator", value: t.GetOperatorName(this.operator) }] });
+ }, t.GetOperatorName = function(e) {
+ switch (e) {
+ case t._IsEqual:
+ return "IsEqual";
+ case t._IsDifferent:
+ return "IsDifferent";
+ case t._IsGreater:
+ return "IsGreater";
+ case t._IsLesser:
+ return "IsLesser";
+ default:
+ return "";
+ }
+ }, t._IsEqual = 0, t._IsDifferent = 1, t._IsGreater = 2, t._IsLesser = 3, t;
+ }(E), y = function(r) {
+ function t(e, n) {
+ var i = r.call(this, e) || this;
+ return i.predicate = n, i;
+ }
+ return Object(u.d)(t, r), t.prototype.isValid = function() {
+ return this.predicate();
+ }, t;
+ }(E), v = function(r) {
+ function t(e, n, i) {
+ var o = r.call(this, e) || this;
+ return o.value = i, o._target = n, o;
+ }
+ return Object(u.d)(t, r), t.prototype.isValid = function() {
+ return this._target.state === this.value;
+ }, t.prototype.serialize = function() {
+ return this._serialize({ name: "StateCondition", properties: [R._GetTargetProperty(this._target), { name: "value", value: this.value }] });
+ }, t;
+ }(E);
+ x.a.RegisteredTypes["BABYLON.ValueCondition"] = A, x.a.RegisteredTypes["BABYLON.PredicateCondition"] = y, x.a.RegisteredTypes["BABYLON.StateCondition"] = v;
+ var h = l(8), d = l(2), b = function(r) {
+ function t(e, n, i, o) {
+ var a = r.call(this, e, o) || this;
+ return a.propertyPath = i, a._target = a._effectiveTarget = n, a;
+ }
+ return Object(u.d)(t, r), t.prototype._prepare = function() {
+ this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath), this._property = this._getProperty(this.propertyPath);
+ }, t.prototype.execute = function() {
+ this._effectiveTarget[this._property] = !this._effectiveTarget[this._property];
+ }, t.prototype.serialize = function(e) {
+ return r.prototype._serialize.call(this, { name: "SwitchBooleanAction", properties: [R._GetTargetProperty(this._target), { name: "propertyPath", value: this.propertyPath }] }, e);
+ }, t;
+ }(R), T = function(r) {
+ function t(e, n, i, o) {
+ var a = r.call(this, e, o) || this;
+ return a.value = i, a._target = n, a;
+ }
+ return Object(u.d)(t, r), t.prototype.execute = function() {
+ this._target.state = this.value;
+ }, t.prototype.serialize = function(e) {
+ return r.prototype._serialize.call(this, { name: "SetStateAction", properties: [R._GetTargetProperty(this._target), { name: "value", value: this.value }] }, e);
+ }, t;
+ }(R), N = function(r) {
+ function t(e, n, i, o, a) {
+ var s = r.call(this, e, a) || this;
+ return s.propertyPath = i, s.value = o, s._target = s._effectiveTarget = n, s;
+ }
+ return Object(u.d)(t, r), t.prototype._prepare = function() {
+ this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath), this._property = this._getProperty(this.propertyPath);
+ }, t.prototype.execute = function() {
+ this._effectiveTarget[this._property] = this.value, this._target.markAsDirty && this._target.markAsDirty(this._property);
+ }, t.prototype.serialize = function(e) {
+ return r.prototype._serialize.call(this, { name: "SetValueAction", properties: [R._GetTargetProperty(this._target), { name: "propertyPath", value: this.propertyPath }, { name: "value", value: R._SerializeValueAsString(this.value) }] }, e);
+ }, t;
+ }(R), U = function(r) {
+ function t(e, n, i, o, a) {
+ var s = r.call(this, e, a) || this;
+ return s.propertyPath = i, s.value = o, s._target = s._effectiveTarget = n, s;
+ }
+ return Object(u.d)(t, r), t.prototype._prepare = function() {
+ this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath), this._property = this._getProperty(this.propertyPath), typeof this._effectiveTarget[this._property] != "number" && h.a.Warn("Warning: IncrementValueAction can only be used with number values");
+ }, t.prototype.execute = function() {
+ this._effectiveTarget[this._property] += this.value, this._target.markAsDirty && this._target.markAsDirty(this._property);
+ }, t.prototype.serialize = function(e) {
+ return r.prototype._serialize.call(this, { name: "IncrementValueAction", properties: [R._GetTargetProperty(this._target), { name: "propertyPath", value: this.propertyPath }, { name: "value", value: R._SerializeValueAsString(this.value) }] }, e);
+ }, t;
+ }(R), B = function(r) {
+ function t(e, n, i, o, a, s) {
+ var p = r.call(this, e, s) || this;
+ return p.from = i, p.to = o, p.loop = a, p._target = n, p;
+ }
+ return Object(u.d)(t, r), t.prototype._prepare = function() {
+ }, t.prototype.execute = function() {
+ this._actionManager.getScene().beginAnimation(this._target, this.from, this.to, this.loop);
+ }, t.prototype.serialize = function(e) {
+ return r.prototype._serialize.call(this, { name: "PlayAnimationAction", properties: [R._GetTargetProperty(this._target), { name: "from", value: String(this.from) }, { name: "to", value: String(this.to) }, { name: "loop", value: R._SerializeValueAsString(this.loop) || !1 }] }, e);
+ }, t;
+ }(R), L = function(r) {
+ function t(e, n, i) {
+ var o = r.call(this, e, i) || this;
+ return o._target = n, o;
+ }
+ return Object(u.d)(t, r), t.prototype._prepare = function() {
+ }, t.prototype.execute = function() {
+ this._actionManager.getScene().stopAnimation(this._target);
+ }, t.prototype.serialize = function(e) {
+ return r.prototype._serialize.call(this, { name: "StopAnimationAction", properties: [R._GetTargetProperty(this._target)] }, e);
+ }, t;
+ }(R), j = function(r) {
+ function t(e, n) {
+ return e === void 0 && (e = d.a.ACTION_NothingTrigger), r.call(this, e, n) || this;
+ }
+ return Object(u.d)(t, r), t.prototype.execute = function() {
+ }, t.prototype.serialize = function(e) {
+ return r.prototype._serialize.call(this, { name: "DoNothingAction", properties: [] }, e);
+ }, t;
+ }(R), W = function(r) {
+ function t(e, n, i) {
+ var o = r.call(this, e, i) || this;
+ return o.children = n, o;
+ }
+ return Object(u.d)(t, r), t.prototype._prepare = function() {
+ for (var e = 0; e < this.children.length; e++)
+ this.children[e]._actionManager = this._actionManager, this.children[e]._prepare();
+ }, t.prototype.execute = function(e) {
+ for (var n = 0; n < this.children.length; n++)
+ this.children[n].execute(e);
+ }, t.prototype.serialize = function(e) {
+ for (var n = r.prototype._serialize.call(this, { name: "CombineAction", properties: [], combine: [] }, e), i = 0; i < this.children.length; i++)
+ n.combine.push(this.children[i].serialize(null));
+ return n;
+ }, t;
+ }(R), Y = function(r) {
+ function t(e, n, i) {
+ var o = r.call(this, e, i) || this;
+ return o.func = n, o;
+ }
+ return Object(u.d)(t, r), t.prototype.execute = function(e) {
+ this.func(e);
+ }, t;
+ }(R), oe = function(r) {
+ function t(e, n, i, o) {
+ var a = r.call(this, e, o) || this;
+ return a._target = n, a._parent = i, a;
+ }
+ return Object(u.d)(t, r), t.prototype._prepare = function() {
+ }, t.prototype.execute = function() {
+ if (this._target.parent !== this._parent) {
+ var e = this._parent.getWorldMatrix().clone();
+ e.invert(), this._target.position = c.e.TransformCoordinates(this._target.position, e), this._target.parent = this._parent;
+ }
+ }, t.prototype.serialize = function(e) {
+ return r.prototype._serialize.call(this, { name: "SetParentAction", properties: [R._GetTargetProperty(this._target), R._GetTargetProperty(this._parent)] }, e);
+ }, t;
+ }(R);
+ x.a.RegisteredTypes["BABYLON.SetParentAction"] = oe, x.a.RegisteredTypes["BABYLON.ExecuteCodeAction"] = Y, x.a.RegisteredTypes["BABYLON.DoNothingAction"] = j, x.a.RegisteredTypes["BABYLON.StopAnimationAction"] = L, x.a.RegisteredTypes["BABYLON.PlayAnimationAction"] = B, x.a.RegisteredTypes["BABYLON.IncrementValueAction"] = U, x.a.RegisteredTypes["BABYLON.SetValueAction"] = N, x.a.RegisteredTypes["BABYLON.SetStateAction"] = T, x.a.RegisteredTypes["BABYLON.SetParentAction"] = oe;
+ var te = l(22), _e = l(41), de = function(r) {
+ function t(e) {
+ var n = r.call(this) || this;
+ return n._scene = e || te.a.LastCreatedScene, e.actionManagers.push(n), n;
+ }
+ return Object(u.d)(t, r), t.prototype.dispose = function() {
+ for (var e = this._scene.actionManagers.indexOf(this), n = 0; n < this.actions.length; n++) {
+ var i = this.actions[n];
+ t.Triggers[i.trigger]--, t.Triggers[i.trigger] === 0 && delete t.Triggers[i.trigger];
+ }
+ e > -1 && this._scene.actionManagers.splice(e, 1);
+ }, t.prototype.getScene = function() {
+ return this._scene;
+ }, t.prototype.hasSpecificTriggers = function(e) {
+ for (var n = 0; n < this.actions.length; n++) {
+ var i = this.actions[n];
+ if (e.indexOf(i.trigger) > -1)
+ return !0;
+ }
+ return !1;
+ }, t.prototype.hasSpecificTriggers2 = function(e, n) {
+ for (var i = 0; i < this.actions.length; i++) {
+ var o = this.actions[i];
+ if (e == o.trigger || n == o.trigger)
+ return !0;
+ }
+ return !1;
+ }, t.prototype.hasSpecificTrigger = function(e, n) {
+ for (var i = 0; i < this.actions.length; i++) {
+ var o = this.actions[i];
+ if (o.trigger === e && (!n || n(o.getTriggerParameter())))
+ return !0;
+ }
+ return !1;
+ }, Object.defineProperty(t.prototype, "hasPointerTriggers", { get: function() {
+ for (var e = 0; e < this.actions.length; e++) {
+ var n = this.actions[e];
+ if (n.trigger >= t.OnPickTrigger && n.trigger <= t.OnPointerOutTrigger)
+ return !0;
+ }
+ return !1;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "hasPickTriggers", { get: function() {
+ for (var e = 0; e < this.actions.length; e++) {
+ var n = this.actions[e];
+ if (n.trigger >= t.OnPickTrigger && n.trigger <= t.OnPickUpTrigger)
+ return !0;
+ }
+ return !1;
+ }, enumerable: !1, configurable: !0 }), t.prototype.registerAction = function(e) {
+ return e.trigger === t.OnEveryFrameTrigger && this.getScene().actionManager !== this ? (h.a.Warn("OnEveryFrameTrigger can only be used with scene.actionManager"), null) : (this.actions.push(e), t.Triggers[e.trigger] ? t.Triggers[e.trigger]++ : t.Triggers[e.trigger] = 1, e._actionManager = this, e._prepare(), e);
+ }, t.prototype.unregisterAction = function(e) {
+ var n = this.actions.indexOf(e);
+ return n !== -1 && (this.actions.splice(n, 1), t.Triggers[e.trigger] -= 1, t.Triggers[e.trigger] === 0 && delete t.Triggers[e.trigger], e._actionManager = null, !0);
+ }, t.prototype.processTrigger = function(e, n) {
+ for (var i = 0; i < this.actions.length; i++) {
+ var o = this.actions[i];
+ if (o.trigger === e) {
+ if (n && (e === t.OnKeyUpTrigger || e === t.OnKeyDownTrigger)) {
+ var a = o.getTriggerParameter();
+ if (a && a !== n.sourceEvent.keyCode) {
+ if (!a.toLowerCase)
+ continue;
+ var s = a.toLowerCase();
+ if (s !== n.sourceEvent.key) {
+ var p = n.sourceEvent.charCode ? n.sourceEvent.charCode : n.sourceEvent.keyCode;
+ if (String.fromCharCode(p).toLowerCase() !== s)
+ continue;
+ }
+ }
+ }
+ o._executeCurrent(n);
+ }
+ }
+ }, t.prototype._getEffectiveTarget = function(e, n) {
+ for (var i = n.split("."), o = 0; o < i.length - 1; o++)
+ e = e[i[o]];
+ return e;
+ }, t.prototype._getProperty = function(e) {
+ var n = e.split(".");
+ return n[n.length - 1];
+ }, t.prototype.serialize = function(e) {
+ for (var n = { children: new Array(), name: e, type: 3, properties: new Array() }, i = 0; i < this.actions.length; i++) {
+ var o = { type: 0, children: new Array(), name: t.GetTriggerName(this.actions[i].trigger), properties: new Array() }, a = this.actions[i].triggerOptions;
+ if (a && typeof a != "number")
+ if (a.parameter instanceof Node)
+ o.properties.push(R._GetTargetProperty(a.parameter));
+ else {
+ var s = {};
+ _e.a.DeepCopy(a.parameter, s, ["mesh"]), a.parameter && a.parameter.mesh && (s._meshId = a.parameter.mesh.id), o.properties.push({ name: "parameter", targetType: null, value: s });
+ }
+ this.actions[i].serialize(o), n.children.push(o);
+ }
+ return n;
+ }, t.Parse = function(e, n, i) {
+ var o = new t(i);
+ n === null ? i.actionManager = o : n.actionManager = o;
+ for (var a = function(k, K, re, se) {
+ if (se === null) {
+ var ue = parseFloat(K);
+ return K === "true" || K === "false" ? K === "true" : isNaN(ue) ? K : ue;
+ }
+ for (var he = se.split("."), pe = K.split(","), ve = 0; ve < he.length; ve++)
+ re = re[he[ve]];
+ if (typeof re == "boolean")
+ return pe[0] === "true";
+ if (typeof re == "string")
+ return pe[0];
+ var Ee = new Array();
+ for (ve = 0; ve < pe.length; ve++)
+ Ee.push(parseFloat(pe[ve]));
+ return re instanceof c.e ? c.e.FromArray(Ee) : re instanceof c.f ? c.f.FromArray(Ee) : re instanceof C.a ? C.a.FromArray(Ee) : re instanceof C.b ? C.b.FromArray(Ee) : parseFloat(pe[0]);
+ }, s = function(k, K, re, se, ue) {
+ if (ue === void 0 && (ue = null), !k.detached) {
+ var he = new Array(), pe = null, ve = null, Ee = k.combine && k.combine.length > 0;
+ if (k.type === 2 ? he.push(o) : he.push(K), Ee) {
+ for (var Ae = new Array(), Ie = 0; Ie < k.combine.length; Ie++)
+ s(k.combine[Ie], t.NothingTrigger, re, se, Ae);
+ he.push(Ae);
+ } else
+ for (var xe = 0; xe < k.properties.length; xe++) {
+ var Pe = k.properties[xe].value, Ce = k.properties[xe].name, Fe = k.properties[xe].targetType;
+ Ce === "target" ? Pe = pe = Fe !== null && Fe === "SceneProperties" ? i : i.getNodeByName(Pe) : Ce === "parent" ? Pe = i.getNodeByName(Pe) : Ce === "sound" ? i.getSoundByName && (Pe = i.getSoundByName(Pe)) : Ce !== "propertyPath" ? Pe = k.type === 2 && Ce === "operator" ? A[Pe] : a(0, Pe, pe, Ce === "value" ? ve : null) : ve = Pe, he.push(Pe);
+ }
+ if (ue === null ? he.push(re) : he.push(null), k.name === "InterpolateValueAction") {
+ var Oe = he[he.length - 2];
+ he[he.length - 1] = Oe, he[he.length - 2] = re;
+ }
+ var Be = function(Ve, Qe) {
+ var nt = x.a.GetClass("BABYLON." + Ve);
+ if (nt) {
+ var rt = Object.create(nt.prototype);
+ return rt.constructor.apply(rt, Qe), rt;
+ }
+ }(k.name, he);
+ if (Be instanceof E && re !== null) {
+ var Le = new j(K, re);
+ se ? se.then(Le) : o.registerAction(Le), se = Le;
+ }
+ for (ue === null ? Be instanceof E ? (re = Be, Be = se) : (re = null, se ? se.then(Be) : o.registerAction(Be)) : ue.push(Be), xe = 0; xe < k.children.length; xe++)
+ s(k.children[xe], K, re, Be, null);
+ }
+ }, p = 0; p < e.children.length; p++) {
+ var m, S = e.children[p];
+ if (S.properties.length > 0) {
+ var O = S.properties[0].value, I = S.properties[0].targetType === null ? O : i.getMeshByName(O);
+ I._meshId && (I.mesh = i.getMeshByID(I._meshId)), m = { trigger: t[S.name], parameter: I };
+ } else
+ m = t[S.name];
+ for (var G = 0; G < S.children.length; G++)
+ S.detached || s(S.children[G], m, null, null);
+ }
+ }, t.GetTriggerName = function(e) {
+ switch (e) {
+ case 0:
+ return "NothingTrigger";
+ case 1:
+ return "OnPickTrigger";
+ case 2:
+ return "OnLeftPickTrigger";
+ case 3:
+ return "OnRightPickTrigger";
+ case 4:
+ return "OnCenterPickTrigger";
+ case 5:
+ return "OnPickDownTrigger";
+ case 6:
+ return "OnPickUpTrigger";
+ case 7:
+ return "OnLongPressTrigger";
+ case 8:
+ return "OnPointerOverTrigger";
+ case 9:
+ return "OnPointerOutTrigger";
+ case 10:
+ return "OnEveryFrameTrigger";
+ case 11:
+ return "OnIntersectionEnterTrigger";
+ case 12:
+ return "OnIntersectionExitTrigger";
+ case 13:
+ return "OnKeyDownTrigger";
+ case 14:
+ return "OnKeyUpTrigger";
+ case 15:
+ return "OnPickOutTrigger";
+ default:
+ return "";
+ }
+ }, t.NothingTrigger = d.a.ACTION_NothingTrigger, t.OnPickTrigger = d.a.ACTION_OnPickTrigger, t.OnLeftPickTrigger = d.a.ACTION_OnLeftPickTrigger, t.OnRightPickTrigger = d.a.ACTION_OnRightPickTrigger, t.OnCenterPickTrigger = d.a.ACTION_OnCenterPickTrigger, t.OnPickDownTrigger = d.a.ACTION_OnPickDownTrigger, t.OnDoublePickTrigger = d.a.ACTION_OnDoublePickTrigger, t.OnPickUpTrigger = d.a.ACTION_OnPickUpTrigger, t.OnPickOutTrigger = d.a.ACTION_OnPickOutTrigger, t.OnLongPressTrigger = d.a.ACTION_OnLongPressTrigger, t.OnPointerOverTrigger = d.a.ACTION_OnPointerOverTrigger, t.OnPointerOutTrigger = d.a.ACTION_OnPointerOutTrigger, t.OnEveryFrameTrigger = d.a.ACTION_OnEveryFrameTrigger, t.OnIntersectionEnterTrigger = d.a.ACTION_OnIntersectionEnterTrigger, t.OnIntersectionExitTrigger = d.a.ACTION_OnIntersectionExitTrigger, t.OnKeyDownTrigger = d.a.ACTION_OnKeyDownTrigger, t.OnKeyUpTrigger = 15, t;
+ }(f.a), ae = function(r) {
+ function t(e, n, i) {
+ var o = r.call(this, e, i) || this;
+ return o._sound = n, o;
+ }
+ return Object(u.d)(t, r), t.prototype._prepare = function() {
+ }, t.prototype.execute = function() {
+ this._sound !== void 0 && this._sound.play();
+ }, t.prototype.serialize = function(e) {
+ return r.prototype._serialize.call(this, { name: "PlaySoundAction", properties: [{ name: "sound", value: this._sound.name }] }, e);
+ }, t;
+ }(R), ie = function(r) {
+ function t(e, n, i) {
+ var o = r.call(this, e, i) || this;
+ return o._sound = n, o;
+ }
+ return Object(u.d)(t, r), t.prototype._prepare = function() {
+ }, t.prototype.execute = function() {
+ this._sound !== void 0 && this._sound.stop();
+ }, t.prototype.serialize = function(e) {
+ return r.prototype._serialize.call(this, { name: "StopSoundAction", properties: [{ name: "sound", value: this._sound.name }] }, e);
+ }, t;
+ }(R);
+ x.a.RegisteredTypes["BABYLON.PlaySoundAction"] = ie, x.a.RegisteredTypes["BABYLON.StopSoundAction"] = ie;
+ var Z, ee = l(14), w = l(3);
+ (function(r) {
+ r[r.STEP = 1] = "STEP";
+ })(Z || (Z = {}));
+ var z = function() {
+ function r(t, e, n) {
+ this.name = t, this.from = e, this.to = n;
+ }
+ return r.prototype.clone = function() {
+ return new r(this.name, this.from, this.to);
+ }, r;
+ }(), q = l(29), le = l(77), ce = l(49), J = function() {
+ }, H = function() {
+ function r(t, e, n, i, o, a) {
+ this.name = t, this.targetProperty = e, this.framePerSecond = n, this.dataType = i, this.loopMode = o, this.enableBlending = a, this._runtimeAnimations = new Array(), this._events = new Array(), this.blendingSpeed = 0.01, this._ranges = {}, this.targetPropertyPath = e.split("."), this.dataType = i, this.loopMode = o === void 0 ? r.ANIMATIONLOOPMODE_CYCLE : o;
+ }
+ return r._PrepareAnimation = function(t, e, n, i, o, a, s, p) {
+ var m = void 0;
+ if (!isNaN(parseFloat(o)) && isFinite(o) ? m = r.ANIMATIONTYPE_FLOAT : o instanceof c.b ? m = r.ANIMATIONTYPE_QUATERNION : o instanceof c.e ? m = r.ANIMATIONTYPE_VECTOR3 : o instanceof c.d ? m = r.ANIMATIONTYPE_VECTOR2 : o instanceof C.a ? m = r.ANIMATIONTYPE_COLOR3 : o instanceof C.b ? m = r.ANIMATIONTYPE_COLOR4 : o instanceof le.a && (m = r.ANIMATIONTYPE_SIZE), m == null)
+ return null;
+ var S = new r(t, e, n, m, s), O = [{ frame: 0, value: o }, { frame: i, value: a }];
+ return S.setKeys(O), p !== void 0 && S.setEasingFunction(p), S;
+ }, r.CreateAnimation = function(t, e, n, i) {
+ var o = new r(t + "Animation", t, n, e, r.ANIMATIONLOOPMODE_CONSTANT);
+ return o.setEasingFunction(i), o;
+ }, r.CreateAndStartAnimation = function(t, e, n, i, o, a, s, p, m, S) {
+ var O = r._PrepareAnimation(t, n, i, o, a, s, p, m);
+ return O ? e.getScene().beginDirectAnimation(e, [O], 0, o, O.loopMode === 1, 1, S) : null;
+ }, r.CreateAndStartHierarchyAnimation = function(t, e, n, i, o, a, s, p, m, S, O) {
+ var I = r._PrepareAnimation(t, i, o, a, s, p, m, S);
+ return I ? e.getScene().beginDirectHierarchyAnimation(e, n, [I], 0, a, I.loopMode === 1, 1, O) : null;
+ }, r.CreateMergeAndStartAnimation = function(t, e, n, i, o, a, s, p, m, S) {
+ var O = r._PrepareAnimation(t, n, i, o, a, s, p, m);
+ return O ? (e.animations.push(O), e.getScene().beginAnimation(e, 0, o, O.loopMode === 1, 1, S)) : null;
+ }, r.MakeAnimationAdditive = function(t, e, n, i, o) {
+ e === void 0 && (e = 0), i === void 0 && (i = !1);
+ var a = t;
+ if (i && ((a = t.clone()).name = o || a.name), !a._keys.length)
+ return a;
+ e = e >= 0 ? e : 0;
+ var s = 0, p = a._keys[0], m = a._keys.length - 1, S = a._keys[m], O = { referenceValue: p.value, referencePosition: c.c.Vector3[0], referenceQuaternion: c.c.Quaternion[0], referenceScaling: c.c.Vector3[1], keyPosition: c.c.Vector3[2], keyQuaternion: c.c.Quaternion[1], keyScaling: c.c.Vector3[3] }, I = !1, G = p.frame, k = S.frame;
+ if (n) {
+ var K = a.getRange(n);
+ K && (G = K.from, k = K.to);
+ }
+ var re = p.frame === G, se = S.frame === k;
+ if (a._keys.length === 1) {
+ var ue = a._getKeyValue(a._keys[0]);
+ O.referenceValue = ue.clone ? ue.clone() : ue, I = !0;
+ } else
+ e <= p.frame ? (ue = a._getKeyValue(p.value), O.referenceValue = ue.clone ? ue.clone() : ue, I = !0) : e >= S.frame && (ue = a._getKeyValue(S.value), O.referenceValue = ue.clone ? ue.clone() : ue, I = !0);
+ for (var he = 0; !I || !re || !se && he < a._keys.length - 1; ) {
+ var pe = a._keys[he], ve = a._keys[he + 1];
+ if (!I && e >= pe.frame && e <= ve.frame) {
+ if (ue = void 0, e === pe.frame)
+ ue = a._getKeyValue(pe.value);
+ else if (e === ve.frame)
+ ue = a._getKeyValue(ve.value);
+ else {
+ var Ee = { key: he, repeatCount: 0, loopMode: this.ANIMATIONLOOPMODE_CONSTANT };
+ ue = a._interpolate(e, Ee);
+ }
+ O.referenceValue = ue.clone ? ue.clone() : ue, I = !0;
+ }
+ if (!re && G >= pe.frame && G <= ve.frame) {
+ if (G === pe.frame)
+ s = he;
+ else if (G === ve.frame)
+ s = he + 1;
+ else {
+ Ee = { key: he, repeatCount: 0, loopMode: this.ANIMATIONLOOPMODE_CONSTANT };
+ var Ae = { frame: G, value: (ue = a._interpolate(G, Ee)).clone ? ue.clone() : ue };
+ a._keys.splice(he + 1, 0, Ae), s = he + 1;
+ }
+ re = !0;
+ }
+ !se && k >= pe.frame && k <= ve.frame && (k === pe.frame ? m = he : k === ve.frame ? m = he + 1 : (Ee = { key: he, repeatCount: 0, loopMode: this.ANIMATIONLOOPMODE_CONSTANT }, Ae = { frame: k, value: (ue = a._interpolate(k, Ee)).clone ? ue.clone() : ue }, a._keys.splice(he + 1, 0, Ae), m = he + 1), se = !0), he++;
+ }
+ for (a.dataType === r.ANIMATIONTYPE_QUATERNION ? O.referenceValue.normalize().conjugateInPlace() : a.dataType === r.ANIMATIONTYPE_MATRIX && (O.referenceValue.decompose(O.referenceScaling, O.referenceQuaternion, O.referencePosition), O.referenceQuaternion.normalize().conjugateInPlace()), he = s; he <= m; he++)
+ if (Ae = a._keys[he], !he || a.dataType === r.ANIMATIONTYPE_FLOAT || Ae.value !== p.value)
+ switch (a.dataType) {
+ case r.ANIMATIONTYPE_MATRIX:
+ Ae.value.decompose(O.keyScaling, O.keyQuaternion, O.keyPosition), O.keyPosition.subtractInPlace(O.referencePosition), O.keyScaling.divideInPlace(O.referenceScaling), O.referenceQuaternion.multiplyToRef(O.keyQuaternion, O.keyQuaternion), c.a.ComposeToRef(O.keyScaling, O.keyQuaternion, O.keyPosition, Ae.value);
+ break;
+ case r.ANIMATIONTYPE_QUATERNION:
+ O.referenceValue.multiplyToRef(Ae.value, Ae.value);
+ break;
+ case r.ANIMATIONTYPE_VECTOR2:
+ case r.ANIMATIONTYPE_VECTOR3:
+ case r.ANIMATIONTYPE_COLOR3:
+ case r.ANIMATIONTYPE_COLOR4:
+ Ae.value.subtractToRef(O.referenceValue, Ae.value);
+ break;
+ case r.ANIMATIONTYPE_SIZE:
+ Ae.value.width -= O.referenceValue.width, Ae.value.height -= O.referenceValue.height;
+ break;
+ default:
+ Ae.value -= O.referenceValue;
+ }
+ return a;
+ }, r.TransitionTo = function(t, e, n, i, o, a, s, p) {
+ if (p === void 0 && (p = null), s <= 0)
+ return n[t] = e, p && p(), null;
+ var m = o * (s / 1e3);
+ a.setKeys([{ frame: 0, value: n[t].clone ? n[t].clone() : n[t] }, { frame: m, value: e }]), n.animations || (n.animations = []), n.animations.push(a);
+ var S = i.beginAnimation(n, 0, m, !1);
+ return S.onAnimationEnd = p, S;
+ }, Object.defineProperty(r.prototype, "runtimeAnimations", { get: function() {
+ return this._runtimeAnimations;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "hasRunningRuntimeAnimations", { get: function() {
+ for (var t = 0, e = this._runtimeAnimations; t < e.length; t++)
+ if (!e[t].isStopped)
+ return !0;
+ return !1;
+ }, enumerable: !1, configurable: !0 }), r.prototype.toString = function(t) {
+ var e = "Name: " + this.name + ", property: " + this.targetProperty;
+ if (e += ", datatype: " + ["Float", "Vector3", "Quaternion", "Matrix", "Color3", "Vector2"][this.dataType], e += ", nKeys: " + (this._keys ? this._keys.length : "none"), e += ", nRanges: " + (this._ranges ? Object.keys(this._ranges).length : "none"), t) {
+ e += ", Ranges: {";
+ var n = !0;
+ for (var i in this._ranges)
+ n && (e += ", ", n = !1), e += i;
+ e += "}";
+ }
+ return e;
+ }, r.prototype.addEvent = function(t) {
+ this._events.push(t), this._events.sort(function(e, n) {
+ return e.frame - n.frame;
+ });
+ }, r.prototype.removeEvents = function(t) {
+ for (var e = 0; e < this._events.length; e++)
+ this._events[e].frame === t && (this._events.splice(e, 1), e--);
+ }, r.prototype.getEvents = function() {
+ return this._events;
+ }, r.prototype.createRange = function(t, e, n) {
+ this._ranges[t] || (this._ranges[t] = new z(t, e, n));
+ }, r.prototype.deleteRange = function(t, e) {
+ e === void 0 && (e = !0);
+ var n = this._ranges[t];
+ if (n) {
+ if (e)
+ for (var i = n.from, o = n.to, a = this._keys.length - 1; a >= 0; a--)
+ this._keys[a].frame >= i && this._keys[a].frame <= o && this._keys.splice(a, 1);
+ this._ranges[t] = null;
+ }
+ }, r.prototype.getRange = function(t) {
+ return this._ranges[t];
+ }, r.prototype.getKeys = function() {
+ return this._keys;
+ }, r.prototype.getHighestFrame = function() {
+ for (var t = 0, e = 0, n = this._keys.length; e < n; e++)
+ t < this._keys[e].frame && (t = this._keys[e].frame);
+ return t;
+ }, r.prototype.getEasingFunction = function() {
+ return this._easingFunction;
+ }, r.prototype.setEasingFunction = function(t) {
+ this._easingFunction = t;
+ }, r.prototype.floatInterpolateFunction = function(t, e, n) {
+ return ee.a.Lerp(t, e, n);
+ }, r.prototype.floatInterpolateFunctionWithTangents = function(t, e, n, i, o) {
+ return ee.a.Hermite(t, e, n, i, o);
+ }, r.prototype.quaternionInterpolateFunction = function(t, e, n) {
+ return c.b.Slerp(t, e, n);
+ }, r.prototype.quaternionInterpolateFunctionWithTangents = function(t, e, n, i, o) {
+ return c.b.Hermite(t, e, n, i, o).normalize();
+ }, r.prototype.vector3InterpolateFunction = function(t, e, n) {
+ return c.e.Lerp(t, e, n);
+ }, r.prototype.vector3InterpolateFunctionWithTangents = function(t, e, n, i, o) {
+ return c.e.Hermite(t, e, n, i, o);
+ }, r.prototype.vector2InterpolateFunction = function(t, e, n) {
+ return c.d.Lerp(t, e, n);
+ }, r.prototype.vector2InterpolateFunctionWithTangents = function(t, e, n, i, o) {
+ return c.d.Hermite(t, e, n, i, o);
+ }, r.prototype.sizeInterpolateFunction = function(t, e, n) {
+ return le.a.Lerp(t, e, n);
+ }, r.prototype.color3InterpolateFunction = function(t, e, n) {
+ return C.a.Lerp(t, e, n);
+ }, r.prototype.color4InterpolateFunction = function(t, e, n) {
+ return C.b.Lerp(t, e, n);
+ }, r.prototype._getKeyValue = function(t) {
+ return typeof t == "function" ? t() : t;
+ }, r.prototype._interpolate = function(t, e) {
+ if (e.loopMode === r.ANIMATIONLOOPMODE_CONSTANT && e.repeatCount > 0)
+ return e.highLimitValue.clone ? e.highLimitValue.clone() : e.highLimitValue;
+ var n = this._keys;
+ if (n.length === 1)
+ return this._getKeyValue(n[0].value);
+ var i = e.key;
+ if (n[i].frame >= t)
+ for (; i - 1 >= 0 && n[i].frame >= t; )
+ i--;
+ for (var o = i; o < n.length; o++) {
+ var a = n[o + 1];
+ if (a.frame >= t) {
+ e.key = o;
+ var s = n[o], p = this._getKeyValue(s.value);
+ if (s.interpolation === Z.STEP)
+ return p;
+ var m = this._getKeyValue(a.value), S = s.outTangent !== void 0 && a.inTangent !== void 0, O = a.frame - s.frame, I = (t - s.frame) / O, G = this.getEasingFunction();
+ switch (G != null && (I = G.ease(I)), this.dataType) {
+ case r.ANIMATIONTYPE_FLOAT:
+ var k = S ? this.floatInterpolateFunctionWithTangents(p, s.outTangent * O, m, a.inTangent * O, I) : this.floatInterpolateFunction(p, m, I);
+ switch (e.loopMode) {
+ case r.ANIMATIONLOOPMODE_CYCLE:
+ case r.ANIMATIONLOOPMODE_CONSTANT:
+ return k;
+ case r.ANIMATIONLOOPMODE_RELATIVE:
+ return e.offsetValue * e.repeatCount + k;
+ }
+ break;
+ case r.ANIMATIONTYPE_QUATERNION:
+ var K = S ? this.quaternionInterpolateFunctionWithTangents(p, s.outTangent.scale(O), m, a.inTangent.scale(O), I) : this.quaternionInterpolateFunction(p, m, I);
+ switch (e.loopMode) {
+ case r.ANIMATIONLOOPMODE_CYCLE:
+ case r.ANIMATIONLOOPMODE_CONSTANT:
+ return K;
+ case r.ANIMATIONLOOPMODE_RELATIVE:
+ return K.addInPlace(e.offsetValue.scale(e.repeatCount));
+ }
+ return K;
+ case r.ANIMATIONTYPE_VECTOR3:
+ var re = S ? this.vector3InterpolateFunctionWithTangents(p, s.outTangent.scale(O), m, a.inTangent.scale(O), I) : this.vector3InterpolateFunction(p, m, I);
+ switch (e.loopMode) {
+ case r.ANIMATIONLOOPMODE_CYCLE:
+ case r.ANIMATIONLOOPMODE_CONSTANT:
+ return re;
+ case r.ANIMATIONLOOPMODE_RELATIVE:
+ return re.add(e.offsetValue.scale(e.repeatCount));
+ }
+ case r.ANIMATIONTYPE_VECTOR2:
+ var se = S ? this.vector2InterpolateFunctionWithTangents(p, s.outTangent.scale(O), m, a.inTangent.scale(O), I) : this.vector2InterpolateFunction(p, m, I);
+ switch (e.loopMode) {
+ case r.ANIMATIONLOOPMODE_CYCLE:
+ case r.ANIMATIONLOOPMODE_CONSTANT:
+ return se;
+ case r.ANIMATIONLOOPMODE_RELATIVE:
+ return se.add(e.offsetValue.scale(e.repeatCount));
+ }
+ case r.ANIMATIONTYPE_SIZE:
+ switch (e.loopMode) {
+ case r.ANIMATIONLOOPMODE_CYCLE:
+ case r.ANIMATIONLOOPMODE_CONSTANT:
+ return this.sizeInterpolateFunction(p, m, I);
+ case r.ANIMATIONLOOPMODE_RELATIVE:
+ return this.sizeInterpolateFunction(p, m, I).add(e.offsetValue.scale(e.repeatCount));
+ }
+ case r.ANIMATIONTYPE_COLOR3:
+ switch (e.loopMode) {
+ case r.ANIMATIONLOOPMODE_CYCLE:
+ case r.ANIMATIONLOOPMODE_CONSTANT:
+ return this.color3InterpolateFunction(p, m, I);
+ case r.ANIMATIONLOOPMODE_RELATIVE:
+ return this.color3InterpolateFunction(p, m, I).add(e.offsetValue.scale(e.repeatCount));
+ }
+ case r.ANIMATIONTYPE_COLOR4:
+ switch (e.loopMode) {
+ case r.ANIMATIONLOOPMODE_CYCLE:
+ case r.ANIMATIONLOOPMODE_CONSTANT:
+ return this.color4InterpolateFunction(p, m, I);
+ case r.ANIMATIONLOOPMODE_RELATIVE:
+ return this.color4InterpolateFunction(p, m, I).add(e.offsetValue.scale(e.repeatCount));
+ }
+ case r.ANIMATIONTYPE_MATRIX:
+ switch (e.loopMode) {
+ case r.ANIMATIONLOOPMODE_CYCLE:
+ case r.ANIMATIONLOOPMODE_CONSTANT:
+ if (r.AllowMatricesInterpolation)
+ return this.matrixInterpolateFunction(p, m, I, e.workValue);
+ case r.ANIMATIONLOOPMODE_RELATIVE:
+ return p;
+ }
+ }
+ break;
+ }
+ }
+ return this._getKeyValue(n[n.length - 1].value);
+ }, r.prototype.matrixInterpolateFunction = function(t, e, n, i) {
+ return r.AllowMatrixDecomposeForInterpolation ? i ? (c.a.DecomposeLerpToRef(t, e, n, i), i) : c.a.DecomposeLerp(t, e, n) : i ? (c.a.LerpToRef(t, e, n, i), i) : c.a.Lerp(t, e, n);
+ }, r.prototype.clone = function() {
+ var t = new r(this.name, this.targetPropertyPath.join("."), this.framePerSecond, this.dataType, this.loopMode);
+ if (t.enableBlending = this.enableBlending, t.blendingSpeed = this.blendingSpeed, this._keys && t.setKeys(this._keys), this._ranges)
+ for (var e in t._ranges = {}, this._ranges) {
+ var n = this._ranges[e];
+ n && (t._ranges[e] = n.clone());
+ }
+ return t;
+ }, r.prototype.setKeys = function(t) {
+ this._keys = t.slice(0);
+ }, r.prototype.serialize = function() {
+ var t = {};
+ t.name = this.name, t.property = this.targetProperty, t.framePerSecond = this.framePerSecond, t.dataType = this.dataType, t.loopBehavior = this.loopMode, t.enableBlending = this.enableBlending, t.blendingSpeed = this.blendingSpeed;
+ var e = this.dataType;
+ t.keys = [];
+ for (var n = this.getKeys(), i = 0; i < n.length; i++) {
+ var o = n[i], a = {};
+ switch (a.frame = o.frame, e) {
+ case r.ANIMATIONTYPE_FLOAT:
+ a.values = [o.value], o.inTangent !== void 0 && a.values.push(o.inTangent), o.outTangent !== void 0 && (o.inTangent === void 0 && a.values.push(void 0), a.values.push(o.outTangent));
+ break;
+ case r.ANIMATIONTYPE_QUATERNION:
+ case r.ANIMATIONTYPE_MATRIX:
+ case r.ANIMATIONTYPE_VECTOR3:
+ case r.ANIMATIONTYPE_COLOR3:
+ case r.ANIMATIONTYPE_COLOR4:
+ a.values = o.value.asArray(), o.inTangent != null && a.values.push(o.inTangent.asArray()), o.outTangent != null && (o.inTangent === void 0 && a.values.push(void 0), a.values.push(o.outTangent.asArray()));
+ }
+ t.keys.push(a);
+ }
+ for (var s in t.ranges = [], this._ranges) {
+ var p = this._ranges[s];
+ if (p) {
+ var m = {};
+ m.name = s, m.from = p.from, m.to = p.to, t.ranges.push(m);
+ }
+ }
+ return t;
+ }, r._UniversalLerp = function(t, e, n) {
+ var i = t.constructor;
+ return i.Lerp ? i.Lerp(t, e, n) : i.Slerp ? i.Slerp(t, e, n) : t.toFixed ? t * (1 - n) + n * e : e;
+ }, r.Parse = function(t) {
+ var e, n, i = new r(t.name, t.property, t.framePerSecond, t.dataType, t.loopBehavior), o = t.dataType, a = [];
+ for (t.enableBlending && (i.enableBlending = t.enableBlending), t.blendingSpeed && (i.blendingSpeed = t.blendingSpeed), n = 0; n < t.keys.length; n++) {
+ var s, p, m = t.keys[n];
+ switch (o) {
+ case r.ANIMATIONTYPE_FLOAT:
+ e = m.values[0], m.values.length >= 1 && (s = m.values[1]), m.values.length >= 2 && (p = m.values[2]);
+ break;
+ case r.ANIMATIONTYPE_QUATERNION:
+ if (e = c.b.FromArray(m.values), m.values.length >= 8) {
+ var S = c.b.FromArray(m.values.slice(4, 8));
+ S.equals(c.b.Zero()) || (s = S);
+ }
+ if (m.values.length >= 12) {
+ var O = c.b.FromArray(m.values.slice(8, 12));
+ O.equals(c.b.Zero()) || (p = O);
+ }
+ break;
+ case r.ANIMATIONTYPE_MATRIX:
+ e = c.a.FromArray(m.values);
+ break;
+ case r.ANIMATIONTYPE_COLOR3:
+ e = C.a.FromArray(m.values);
+ break;
+ case r.ANIMATIONTYPE_COLOR4:
+ e = C.b.FromArray(m.values);
+ break;
+ case r.ANIMATIONTYPE_VECTOR3:
+ default:
+ e = c.e.FromArray(m.values);
+ }
+ var I = {};
+ I.frame = m.frame, I.value = e, s != null && (I.inTangent = s), p != null && (I.outTangent = p), a.push(I);
+ }
+ if (i.setKeys(a), t.ranges)
+ for (n = 0; n < t.ranges.length; n++)
+ e = t.ranges[n], i.createRange(e.name, e.from, e.to);
+ return i;
+ }, r.AppendSerializedAnimations = function(t, e) {
+ w.a.AppendSerializedAnimations(t, e);
+ }, r.ParseFromFileAsync = function(t, e) {
+ var n = this;
+ return new Promise(function(i, o) {
+ var a = new ce.a();
+ a.addEventListener("readystatechange", function() {
+ if (a.readyState == 4)
+ if (a.status == 200) {
+ var s = JSON.parse(a.responseText);
+ if (s.length) {
+ for (var p = new Array(), m = 0, S = s; m < S.length; m++) {
+ var O = S[m];
+ p.push(n.Parse(O));
+ }
+ i(p);
+ } else
+ p = n.Parse(s), t && (p.name = t), i(p);
+ } else
+ o("Unable to load the animation");
+ }), a.open("GET", e), a.send();
+ });
+ }, r.CreateFromSnippetAsync = function(t) {
+ var e = this;
+ return new Promise(function(n, i) {
+ var o = new ce.a();
+ o.addEventListener("readystatechange", function() {
+ if (o.readyState == 4)
+ if (o.status == 200) {
+ var a = JSON.parse(JSON.parse(o.responseText).jsonPayload);
+ if (a.animations) {
+ for (var s = JSON.parse(a.animations), p = new Array(), m = 0, S = s; m < S.length; m++) {
+ var O = S[m];
+ p.push(e.Parse(O));
+ }
+ n(p);
+ } else
+ s = JSON.parse(a.animation), (p = e.Parse(s)).snippetId = t, n(p);
+ } else
+ i("Unable to load the snippet " + t);
+ }), o.open("GET", e.SnippetUrl + "/" + t.replace(/#/g, "/")), o.send();
+ });
+ }, r.AllowMatricesInterpolation = !1, r.AllowMatrixDecomposeForInterpolation = !0, r.SnippetUrl = "https://snippet.babylonjs.com", r.ANIMATIONTYPE_FLOAT = 0, r.ANIMATIONTYPE_VECTOR3 = 1, r.ANIMATIONTYPE_QUATERNION = 2, r.ANIMATIONTYPE_MATRIX = 3, r.ANIMATIONTYPE_COLOR3 = 4, r.ANIMATIONTYPE_COLOR4 = 7, r.ANIMATIONTYPE_VECTOR2 = 5, r.ANIMATIONTYPE_SIZE = 6, r.ANIMATIONLOOPMODE_RELATIVE = 0, r.ANIMATIONLOOPMODE_CYCLE = 1, r.ANIMATIONLOOPMODE_CONSTANT = 2, r;
+ }();
+ x.a.RegisteredTypes["BABYLON.Animation"] = H, q.a._AnimationRangeFactory = function(r, t, e) {
+ return new z(r, t, e);
+ };
+ var X = function(r) {
+ function t(e, n, i, o, a, s, p, m) {
+ a === void 0 && (a = 1e3);
+ var S = r.call(this, e, s) || this;
+ return S.duration = 1e3, S.onInterpolationDoneObservable = new P.c(), S.propertyPath = i, S.value = o, S.duration = a, S.stopOtherAnimations = p, S.onInterpolationDone = m, S._target = S._effectiveTarget = n, S;
+ }
+ return Object(u.d)(t, r), t.prototype._prepare = function() {
+ this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath), this._property = this._getProperty(this.propertyPath);
+ }, t.prototype.execute = function() {
+ var e, n = this, i = this._actionManager.getScene(), o = [{ frame: 0, value: this._effectiveTarget[this._property] }, { frame: 100, value: this.value }];
+ if (typeof this.value == "number")
+ e = H.ANIMATIONTYPE_FLOAT;
+ else if (this.value instanceof C.a)
+ e = H.ANIMATIONTYPE_COLOR3;
+ else if (this.value instanceof c.e)
+ e = H.ANIMATIONTYPE_VECTOR3;
+ else if (this.value instanceof c.a)
+ e = H.ANIMATIONTYPE_MATRIX;
+ else {
+ if (!(this.value instanceof c.b))
+ return void h.a.Warn("InterpolateValueAction: Unsupported type (" + typeof this.value + ")");
+ e = H.ANIMATIONTYPE_QUATERNION;
+ }
+ var a = new H("InterpolateValueAction", this._property, 1e3 / this.duration * 100, e, H.ANIMATIONLOOPMODE_CONSTANT);
+ a.setKeys(o), this.stopOtherAnimations && i.stopAnimation(this._effectiveTarget), i.beginDirectAnimation(this._effectiveTarget, [a], 0, 100, !1, 1, function() {
+ n.onInterpolationDoneObservable.notifyObservers(n), n.onInterpolationDone && n.onInterpolationDone();
+ });
+ }, t.prototype.serialize = function(e) {
+ return r.prototype._serialize.call(this, { name: "InterpolateValueAction", properties: [R._GetTargetProperty(this._target), { name: "propertyPath", value: this.propertyPath }, { name: "value", value: R._SerializeValueAsString(this.value) }, { name: "duration", value: R._SerializeValueAsString(this.duration) }, { name: "stopOtherAnimations", value: R._SerializeValueAsString(this.stopOtherAnimations) || !1 }] }, e);
+ }, t;
+ }(R);
+ x.a.RegisteredTypes["BABYLON.InterpolateValueAction"] = X;
+ var ne = Object.freeze(new c.b(0, 0, 0, 0)), Q = Object.freeze(c.e.Zero()), $ = Object.freeze(c.d.Zero()), me = Object.freeze(le.a.Zero()), ye = Object.freeze(C.a.Black()), be = function() {
+ function r(t, e, n, i) {
+ var o = this;
+ if (this._events = new Array(), this._currentFrame = 0, this._originalValue = new Array(), this._originalBlendValue = null, this._offsetsCache = {}, this._highLimitsCache = {}, this._stopped = !1, this._blendingFactor = 0, this._currentValue = null, this._currentActiveTarget = null, this._directTarget = null, this._targetPath = "", this._weight = 1, this._ratioOffset = 0, this._previousDelay = 0, this._previousRatio = 0, this._targetIsArray = !1, this._animation = e, this._target = t, this._scene = n, this._host = i, this._activeTargets = [], e._runtimeAnimations.push(this), this._animationState = { key: 0, repeatCount: 0, loopMode: this._getCorrectLoopMode() }, this._animation.dataType === H.ANIMATIONTYPE_MATRIX && (this._animationState.workValue = c.a.Zero()), this._keys = this._animation.getKeys(), this._minFrame = this._keys[0].frame, this._maxFrame = this._keys[this._keys.length - 1].frame, this._minValue = this._keys[0].value, this._maxValue = this._keys[this._keys.length - 1].value, this._minFrame !== 0) {
+ var a = { frame: 0, value: this._minValue };
+ this._keys.splice(0, 0, a);
+ }
+ if (this._target instanceof Array) {
+ for (var s = 0, p = 0, m = this._target; p < m.length; p++) {
+ var S = m[p];
+ this._preparePath(S, s), this._getOriginalValues(s), s++;
+ }
+ this._targetIsArray = !0;
+ } else
+ this._preparePath(this._target), this._getOriginalValues(), this._targetIsArray = !1, this._directTarget = this._activeTargets[0];
+ var O = e.getEvents();
+ O && O.length > 0 && O.forEach(function(I) {
+ o._events.push(I._clone());
+ }), this._enableBlending = t && t.animationPropertiesOverride ? t.animationPropertiesOverride.enableBlending : this._animation.enableBlending;
+ }
+ return Object.defineProperty(r.prototype, "currentFrame", { get: function() {
+ return this._currentFrame;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "weight", { get: function() {
+ return this._weight;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "currentValue", { get: function() {
+ return this._currentValue;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "targetPath", { get: function() {
+ return this._targetPath;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "target", { get: function() {
+ return this._currentActiveTarget;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "isAdditive", { get: function() {
+ return this._host && this._host.isAdditive;
+ }, enumerable: !1, configurable: !0 }), r.prototype._preparePath = function(t, e) {
+ e === void 0 && (e = 0);
+ var n = this._animation.targetPropertyPath;
+ if (n.length > 1) {
+ for (var i = t[n[0]], o = 1; o < n.length - 1; o++)
+ i = i[n[o]];
+ this._targetPath = n[n.length - 1], this._activeTargets[e] = i;
+ } else
+ this._targetPath = n[0], this._activeTargets[e] = t;
+ }, Object.defineProperty(r.prototype, "animation", { get: function() {
+ return this._animation;
+ }, enumerable: !1, configurable: !0 }), r.prototype.reset = function(t) {
+ if (t === void 0 && (t = !1), t)
+ if (this._target instanceof Array)
+ for (var e = 0, n = 0, i = this._target; n < i.length; n++) {
+ var o = i[n];
+ this._originalValue[e] !== void 0 && this._setValue(o, this._activeTargets[e], this._originalValue[e], -1, e), e++;
+ }
+ else
+ this._originalValue[0] !== void 0 && this._setValue(this._target, this._directTarget, this._originalValue[0], -1, 0);
+ for (this._offsetsCache = {}, this._highLimitsCache = {}, this._currentFrame = 0, this._blendingFactor = 0, e = 0; e < this._events.length; e++)
+ this._events[e].isDone = !1;
+ }, r.prototype.isStopped = function() {
+ return this._stopped;
+ }, r.prototype.dispose = function() {
+ var t = this._animation.runtimeAnimations.indexOf(this);
+ t > -1 && this._animation.runtimeAnimations.splice(t, 1);
+ }, r.prototype.setValue = function(t, e) {
+ if (this._targetIsArray)
+ for (var n = 0; n < this._target.length; n++) {
+ var i = this._target[n];
+ this._setValue(i, this._activeTargets[n], t, e, n);
+ }
+ else
+ this._setValue(this._target, this._directTarget, t, e, 0);
+ }, r.prototype._getOriginalValues = function(t) {
+ var e;
+ t === void 0 && (t = 0);
+ var n = this._activeTargets[t];
+ (e = n.getRestPose && this._targetPath === "_matrix" ? n.getRestPose() : n[this._targetPath]) && e.clone ? this._originalValue[t] = e.clone() : this._originalValue[t] = e;
+ }, r.prototype._setValue = function(t, e, n, i, o) {
+ if (this._currentActiveTarget = e, this._weight = i, this._enableBlending && this._blendingFactor <= 1) {
+ if (!this._originalBlendValue) {
+ var a = e[this._targetPath];
+ a.clone ? this._originalBlendValue = a.clone() : this._originalBlendValue = a;
+ }
+ this._originalBlendValue.m ? H.AllowMatrixDecomposeForInterpolation ? this._currentValue ? c.a.DecomposeLerpToRef(this._originalBlendValue, n, this._blendingFactor, this._currentValue) : this._currentValue = c.a.DecomposeLerp(this._originalBlendValue, n, this._blendingFactor) : this._currentValue ? c.a.LerpToRef(this._originalBlendValue, n, this._blendingFactor, this._currentValue) : this._currentValue = c.a.Lerp(this._originalBlendValue, n, this._blendingFactor) : this._currentValue = H._UniversalLerp(this._originalBlendValue, n, this._blendingFactor);
+ var s = t && t.animationPropertiesOverride ? t.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;
+ this._blendingFactor += s;
+ } else
+ this._currentValue = n;
+ i !== -1 ? this._scene._registerTargetForLateAnimationBinding(this, this._originalValue[o]) : e[this._targetPath] = this._currentValue, t.markAsDirty && t.markAsDirty(this._animation.targetProperty);
+ }, r.prototype._getCorrectLoopMode = function() {
+ return this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.loopMode : this._animation.loopMode;
+ }, r.prototype.goToFrame = function(t) {
+ var e = this._animation.getKeys();
+ t < e[0].frame ? t = e[0].frame : t > e[e.length - 1].frame && (t = e[e.length - 1].frame);
+ var n = this._events;
+ if (n.length)
+ for (var i = 0; i < n.length; i++)
+ n[i].onlyOnce || (n[i].isDone = n[i].frame < t);
+ this._currentFrame = t;
+ var o = this._animation._interpolate(t, this._animationState);
+ this.setValue(o, -1);
+ }, r.prototype._prepareForSpeedRatioChange = function(t) {
+ var e = this._previousDelay * (this._animation.framePerSecond * t) / 1e3;
+ this._ratioOffset = this._previousRatio - e;
+ }, r.prototype.animate = function(t, e, n, i, o, a) {
+ a === void 0 && (a = -1);
+ var s = this._animation, p = s.targetPropertyPath;
+ if (!p || p.length < 1)
+ return this._stopped = !0, !1;
+ var m = !0;
+ (e < this._minFrame || e > this._maxFrame) && (e = this._minFrame), (n < this._minFrame || n > this._maxFrame) && (n = this._maxFrame);
+ var S, O, I = n - e, G = t * (s.framePerSecond * o) / 1e3 + this._ratioOffset, k = 0;
+ if (this._previousDelay = t, this._previousRatio = G, !i && n >= e && G >= I)
+ m = !1, k = s._getKeyValue(this._maxValue);
+ else if (!i && e >= n && G <= I)
+ m = !1, k = s._getKeyValue(this._minValue);
+ else if (this._animationState.loopMode !== H.ANIMATIONLOOPMODE_CYCLE) {
+ var K = n.toString() + e.toString();
+ if (!this._offsetsCache[K]) {
+ this._animationState.repeatCount = 0, this._animationState.loopMode = H.ANIMATIONLOOPMODE_CYCLE;
+ var re = s._interpolate(e, this._animationState), se = s._interpolate(n, this._animationState);
+ switch (this._animationState.loopMode = this._getCorrectLoopMode(), s.dataType) {
+ case H.ANIMATIONTYPE_FLOAT:
+ this._offsetsCache[K] = se - re;
+ break;
+ case H.ANIMATIONTYPE_QUATERNION:
+ this._offsetsCache[K] = se.subtract(re);
+ break;
+ case H.ANIMATIONTYPE_VECTOR3:
+ this._offsetsCache[K] = se.subtract(re);
+ case H.ANIMATIONTYPE_VECTOR2:
+ this._offsetsCache[K] = se.subtract(re);
+ case H.ANIMATIONTYPE_SIZE:
+ this._offsetsCache[K] = se.subtract(re);
+ case H.ANIMATIONTYPE_COLOR3:
+ this._offsetsCache[K] = se.subtract(re);
+ }
+ this._highLimitsCache[K] = se;
+ }
+ k = this._highLimitsCache[K], S = this._offsetsCache[K];
+ }
+ if (S === void 0)
+ switch (s.dataType) {
+ case H.ANIMATIONTYPE_FLOAT:
+ S = 0;
+ break;
+ case H.ANIMATIONTYPE_QUATERNION:
+ S = ne;
+ break;
+ case H.ANIMATIONTYPE_VECTOR3:
+ S = Q;
+ break;
+ case H.ANIMATIONTYPE_VECTOR2:
+ S = $;
+ break;
+ case H.ANIMATIONTYPE_SIZE:
+ S = me;
+ break;
+ case H.ANIMATIONTYPE_COLOR3:
+ S = ye;
+ }
+ if (this._host && this._host.syncRoot) {
+ var ue = this._host.syncRoot;
+ O = e + (n - e) * ((ue.masterFrame - ue.fromFrame) / (ue.toFrame - ue.fromFrame));
+ } else
+ O = m && I !== 0 ? e + G % I : n;
+ var he = this._events;
+ if ((I > 0 && this.currentFrame > O || I < 0 && this.currentFrame < O) && (this._onLoop(), he.length))
+ for (var pe = 0; pe < he.length; pe++)
+ he[pe].onlyOnce || (he[pe].isDone = !1);
+ this._currentFrame = O, this._animationState.repeatCount = I === 0 ? 0 : G / I >> 0, this._animationState.highLimitValue = k, this._animationState.offsetValue = S;
+ var ve = s._interpolate(O, this._animationState);
+ if (this.setValue(ve, a), he.length) {
+ for (pe = 0; pe < he.length; pe++)
+ if (I > 0 && O >= he[pe].frame && he[pe].frame >= e || I < 0 && O <= he[pe].frame && he[pe].frame <= e) {
+ var Ee = he[pe];
+ Ee.isDone || (Ee.onlyOnce && (he.splice(pe, 1), pe--), Ee.isDone = !0, Ee.action(O));
+ }
+ }
+ return m || (this._stopped = !0), m;
+ }, r;
+ }(), ge = l(20), Te = l(57), Re = l(44), Se = l(23), Ne = function(r) {
+ function t(e, n, i, o, a, s, p) {
+ i === void 0 && (i = null), o === void 0 && (o = null), a === void 0 && (a = null), s === void 0 && (s = null), p === void 0 && (p = null);
+ var m = r.call(this, e, n.getScene()) || this;
+ return m.name = e, m.children = new Array(), m.animations = new Array(), m._index = null, m._absoluteTransform = new c.a(), m._invertedAbsoluteTransform = new c.a(), m._scalingDeterminant = 1, m._worldTransform = new c.a(), m._needToDecompose = !0, m._needToCompose = !1, m._linkedTransformNode = null, m._waitingTransformNodeId = null, m._skeleton = n, m._localMatrix = o ? o.clone() : c.a.Identity(), m._restPose = a || m._localMatrix.clone(), m._bindPose = m._localMatrix.clone(), m._baseMatrix = s || m._localMatrix.clone(), m._index = p, n.bones.push(m), m.setParent(i, !1), (s || o) && m._updateDifferenceMatrix(), m;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "_matrix", { get: function() {
+ return this._compose(), this._localMatrix;
+ }, set: function(e) {
+ this._localMatrix.copyFrom(e), this._needToDecompose = !0;
+ }, enumerable: !1, configurable: !0 }), t.prototype.getClassName = function() {
+ return "Bone";
+ }, t.prototype.getSkeleton = function() {
+ return this._skeleton;
+ }, t.prototype.getParent = function() {
+ return this._parent;
+ }, t.prototype.getChildren = function() {
+ return this.children;
+ }, t.prototype.getIndex = function() {
+ return this._index === null ? this.getSkeleton().bones.indexOf(this) : this._index;
+ }, t.prototype.setParent = function(e, n) {
+ if (n === void 0 && (n = !0), this._parent !== e) {
+ if (this._parent) {
+ var i = this._parent.children.indexOf(this);
+ i !== -1 && this._parent.children.splice(i, 1);
+ }
+ this._parent = e, this._parent && this._parent.children.push(this), n && this._updateDifferenceMatrix(), this.markAsDirty();
+ }
+ }, t.prototype.getLocalMatrix = function() {
+ return this._compose(), this._localMatrix;
+ }, t.prototype.getBaseMatrix = function() {
+ return this._baseMatrix;
+ }, t.prototype.getRestPose = function() {
+ return this._restPose;
+ }, t.prototype.setRestPose = function(e) {
+ this._restPose.copyFrom(e);
+ }, t.prototype.getBindPose = function() {
+ return this._bindPose;
+ }, t.prototype.setBindPose = function(e) {
+ this._bindPose.copyFrom(e);
+ }, t.prototype.getWorldMatrix = function() {
+ return this._worldTransform;
+ }, t.prototype.returnToRest = function() {
+ this._skeleton._numBonesWithLinkedTransformNode > 0 ? this.updateMatrix(this._restPose, !1, !1) : this.updateMatrix(this._restPose, !1, !0);
+ }, t.prototype.getInvertedAbsoluteTransform = function() {
+ return this._invertedAbsoluteTransform;
+ }, t.prototype.getAbsoluteTransform = function() {
+ return this._absoluteTransform;
+ }, t.prototype.linkTransformNode = function(e) {
+ this._linkedTransformNode && this._skeleton._numBonesWithLinkedTransformNode--, this._linkedTransformNode = e, this._linkedTransformNode && this._skeleton._numBonesWithLinkedTransformNode++;
+ }, t.prototype.getTransformNode = function() {
+ return this._linkedTransformNode;
+ }, Object.defineProperty(t.prototype, "position", { get: function() {
+ return this._decompose(), this._localPosition;
+ }, set: function(e) {
+ this._decompose(), this._localPosition.copyFrom(e), this._markAsDirtyAndCompose();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "rotation", { get: function() {
+ return this.getRotation();
+ }, set: function(e) {
+ this.setRotation(e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "rotationQuaternion", { get: function() {
+ return this._decompose(), this._localRotation;
+ }, set: function(e) {
+ this.setRotationQuaternion(e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "scaling", { get: function() {
+ return this.getScale();
+ }, set: function(e) {
+ this.setScale(e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "animationPropertiesOverride", { get: function() {
+ return this._skeleton.animationPropertiesOverride;
+ }, enumerable: !1, configurable: !0 }), t.prototype._decompose = function() {
+ this._needToDecompose && (this._needToDecompose = !1, this._localScaling || (this._localScaling = c.e.Zero(), this._localRotation = c.b.Zero(), this._localPosition = c.e.Zero()), this._localMatrix.decompose(this._localScaling, this._localRotation, this._localPosition));
+ }, t.prototype._compose = function() {
+ this._needToCompose && (this._localScaling ? (this._needToCompose = !1, c.a.ComposeToRef(this._localScaling, this._localRotation, this._localPosition, this._localMatrix)) : this._needToCompose = !1);
+ }, t.prototype.updateMatrix = function(e, n, i) {
+ n === void 0 && (n = !0), i === void 0 && (i = !0), this._baseMatrix.copyFrom(e), n && this._updateDifferenceMatrix(), i ? (this._needToCompose = !1, this._localMatrix.copyFrom(e), this._markAsDirtyAndDecompose()) : this.markAsDirty();
+ }, t.prototype._updateDifferenceMatrix = function(e, n) {
+ if (n === void 0 && (n = !0), e || (e = this._baseMatrix), this._parent ? e.multiplyToRef(this._parent._absoluteTransform, this._absoluteTransform) : this._absoluteTransform.copyFrom(e), this._absoluteTransform.invertToRef(this._invertedAbsoluteTransform), n)
+ for (var i = 0; i < this.children.length; i++)
+ this.children[i]._updateDifferenceMatrix();
+ this._scalingDeterminant = this._absoluteTransform.determinant() < 0 ? -1 : 1;
+ }, t.prototype.markAsDirty = function() {
+ this._currentRenderId++, this._childUpdateId++, this._skeleton._markAsDirty();
+ }, t.prototype._markAsDirtyAndCompose = function() {
+ this.markAsDirty(), this._needToCompose = !0;
+ }, t.prototype._markAsDirtyAndDecompose = function() {
+ this.markAsDirty(), this._needToDecompose = !0;
+ }, t.prototype.translate = function(e, n, i) {
+ n === void 0 && (n = Se.c.LOCAL);
+ var o = this.getLocalMatrix();
+ if (n == Se.c.LOCAL)
+ o.addAtIndex(12, e.x), o.addAtIndex(13, e.y), o.addAtIndex(14, e.z);
+ else {
+ var a = null;
+ i && (a = i.getWorldMatrix()), this._skeleton.computeAbsoluteTransforms();
+ var s = t._tmpMats[0], p = t._tmpVecs[0];
+ this._parent ? i && a ? (s.copyFrom(this._parent.getAbsoluteTransform()), s.multiplyToRef(a, s)) : s.copyFrom(this._parent.getAbsoluteTransform()) : c.a.IdentityToRef(s), s.setTranslationFromFloats(0, 0, 0), s.invert(), c.e.TransformCoordinatesToRef(e, s, p), o.addAtIndex(12, p.x), o.addAtIndex(13, p.y), o.addAtIndex(14, p.z);
+ }
+ this._markAsDirtyAndDecompose();
+ }, t.prototype.setPosition = function(e, n, i) {
+ n === void 0 && (n = Se.c.LOCAL);
+ var o = this.getLocalMatrix();
+ if (n == Se.c.LOCAL)
+ o.setTranslationFromFloats(e.x, e.y, e.z);
+ else {
+ var a = null;
+ i && (a = i.getWorldMatrix()), this._skeleton.computeAbsoluteTransforms();
+ var s = t._tmpMats[0], p = t._tmpVecs[0];
+ this._parent ? (i && a ? (s.copyFrom(this._parent.getAbsoluteTransform()), s.multiplyToRef(a, s)) : s.copyFrom(this._parent.getAbsoluteTransform()), s.invert()) : c.a.IdentityToRef(s), c.e.TransformCoordinatesToRef(e, s, p), o.setTranslationFromFloats(p.x, p.y, p.z);
+ }
+ this._markAsDirtyAndDecompose();
+ }, t.prototype.setAbsolutePosition = function(e, n) {
+ this.setPosition(e, Se.c.WORLD, n);
+ }, t.prototype.scale = function(e, n, i, o) {
+ o === void 0 && (o = !1);
+ var a = this.getLocalMatrix(), s = t._tmpMats[0];
+ c.a.ScalingToRef(e, n, i, s), s.multiplyToRef(a, a), s.invert();
+ for (var p = 0, m = this.children; p < m.length; p++) {
+ var S = (G = m[p]).getLocalMatrix();
+ S.multiplyToRef(s, S), S.multiplyAtIndex(12, e), S.multiplyAtIndex(13, n), S.multiplyAtIndex(14, i), G._markAsDirtyAndDecompose();
+ }
+ if (this._markAsDirtyAndDecompose(), o)
+ for (var O = 0, I = this.children; O < I.length; O++) {
+ var G;
+ (G = I[O]).scale(e, n, i, o);
+ }
+ }, t.prototype.setScale = function(e) {
+ this._decompose(), this._localScaling.copyFrom(e), this._markAsDirtyAndCompose();
+ }, t.prototype.getScale = function() {
+ return this._decompose(), this._localScaling;
+ }, t.prototype.getScaleToRef = function(e) {
+ this._decompose(), e.copyFrom(this._localScaling);
+ }, t.prototype.setYawPitchRoll = function(e, n, i, o, a) {
+ if (o === void 0 && (o = Se.c.LOCAL), o === Se.c.LOCAL) {
+ var s = t._tmpQuat;
+ return c.b.RotationYawPitchRollToRef(e, n, i, s), void this.setRotationQuaternion(s, o, a);
+ }
+ var p = t._tmpMats[0];
+ if (this._getNegativeRotationToRef(p, a)) {
+ var m = t._tmpMats[1];
+ c.a.RotationYawPitchRollToRef(e, n, i, m), p.multiplyToRef(m, m), this._rotateWithMatrix(m, o, a);
+ }
+ }, t.prototype.rotate = function(e, n, i, o) {
+ i === void 0 && (i = Se.c.LOCAL);
+ var a = t._tmpMats[0];
+ a.setTranslationFromFloats(0, 0, 0), c.a.RotationAxisToRef(e, n, a), this._rotateWithMatrix(a, i, o);
+ }, t.prototype.setAxisAngle = function(e, n, i, o) {
+ if (i === void 0 && (i = Se.c.LOCAL), i === Se.c.LOCAL) {
+ var a = t._tmpQuat;
+ return c.b.RotationAxisToRef(e, n, a), void this.setRotationQuaternion(a, i, o);
+ }
+ var s = t._tmpMats[0];
+ if (this._getNegativeRotationToRef(s, o)) {
+ var p = t._tmpMats[1];
+ c.a.RotationAxisToRef(e, n, p), s.multiplyToRef(p, p), this._rotateWithMatrix(p, i, o);
+ }
+ }, t.prototype.setRotation = function(e, n, i) {
+ n === void 0 && (n = Se.c.LOCAL), this.setYawPitchRoll(e.y, e.x, e.z, n, i);
+ }, t.prototype.setRotationQuaternion = function(e, n, i) {
+ if (n === void 0 && (n = Se.c.LOCAL), n === Se.c.LOCAL)
+ return this._decompose(), this._localRotation.copyFrom(e), void this._markAsDirtyAndCompose();
+ var o = t._tmpMats[0];
+ if (this._getNegativeRotationToRef(o, i)) {
+ var a = t._tmpMats[1];
+ c.a.FromQuaternionToRef(e, a), o.multiplyToRef(a, a), this._rotateWithMatrix(a, n, i);
+ }
+ }, t.prototype.setRotationMatrix = function(e, n, i) {
+ if (n === void 0 && (n = Se.c.LOCAL), n === Se.c.LOCAL) {
+ var o = t._tmpQuat;
+ return c.b.FromRotationMatrixToRef(e, o), void this.setRotationQuaternion(o, n, i);
+ }
+ var a = t._tmpMats[0];
+ if (this._getNegativeRotationToRef(a, i)) {
+ var s = t._tmpMats[1];
+ s.copyFrom(e), a.multiplyToRef(e, s), this._rotateWithMatrix(s, n, i);
+ }
+ }, t.prototype._rotateWithMatrix = function(e, n, i) {
+ n === void 0 && (n = Se.c.LOCAL);
+ var o = this.getLocalMatrix(), a = o.m[12], s = o.m[13], p = o.m[14], m = this.getParent(), S = t._tmpMats[3], O = t._tmpMats[4];
+ m && n == Se.c.WORLD ? (i ? (S.copyFrom(i.getWorldMatrix()), m.getAbsoluteTransform().multiplyToRef(S, S)) : S.copyFrom(m.getAbsoluteTransform()), O.copyFrom(S), O.invert(), o.multiplyToRef(S, o), o.multiplyToRef(e, o), o.multiplyToRef(O, o)) : n == Se.c.WORLD && i ? (S.copyFrom(i.getWorldMatrix()), O.copyFrom(S), O.invert(), o.multiplyToRef(S, o), o.multiplyToRef(e, o), o.multiplyToRef(O, o)) : o.multiplyToRef(e, o), o.setTranslationFromFloats(a, s, p), this.computeAbsoluteTransforms(), this._markAsDirtyAndDecompose();
+ }, t.prototype._getNegativeRotationToRef = function(e, n) {
+ var i = t._tmpMats[2];
+ return e.copyFrom(this.getAbsoluteTransform()), n && (e.multiplyToRef(n.getWorldMatrix(), e), c.a.ScalingToRef(n.scaling.x, n.scaling.y, n.scaling.z, i)), e.invert(), !isNaN(e.m[0]) && (i.multiplyAtIndex(0, this._scalingDeterminant), e.multiplyToRef(i, e), !0);
+ }, t.prototype.getPosition = function(e, n) {
+ e === void 0 && (e = Se.c.LOCAL), n === void 0 && (n = null);
+ var i = c.e.Zero();
+ return this.getPositionToRef(e, n, i), i;
+ }, t.prototype.getPositionToRef = function(e, n, i) {
+ if (e === void 0 && (e = Se.c.LOCAL), e == Se.c.LOCAL) {
+ var o = this.getLocalMatrix();
+ i.x = o.m[12], i.y = o.m[13], i.z = o.m[14];
+ } else {
+ var a = null;
+ n && (a = n.getWorldMatrix()), this._skeleton.computeAbsoluteTransforms();
+ var s = t._tmpMats[0];
+ n && a ? (s.copyFrom(this.getAbsoluteTransform()), s.multiplyToRef(a, s)) : s = this.getAbsoluteTransform(), i.x = s.m[12], i.y = s.m[13], i.z = s.m[14];
+ }
+ }, t.prototype.getAbsolutePosition = function(e) {
+ e === void 0 && (e = null);
+ var n = c.e.Zero();
+ return this.getPositionToRef(Se.c.WORLD, e, n), n;
+ }, t.prototype.getAbsolutePositionToRef = function(e, n) {
+ this.getPositionToRef(Se.c.WORLD, e, n);
+ }, t.prototype.computeAbsoluteTransforms = function() {
+ if (this._compose(), this._parent)
+ this._localMatrix.multiplyToRef(this._parent._absoluteTransform, this._absoluteTransform);
+ else {
+ this._absoluteTransform.copyFrom(this._localMatrix);
+ var e = this._skeleton.getPoseMatrix();
+ e && this._absoluteTransform.multiplyToRef(e, this._absoluteTransform);
+ }
+ for (var n = this.children, i = n.length, o = 0; o < i; o++)
+ n[o].computeAbsoluteTransforms();
+ }, t.prototype.getDirection = function(e, n) {
+ n === void 0 && (n = null);
+ var i = c.e.Zero();
+ return this.getDirectionToRef(e, n, i), i;
+ }, t.prototype.getDirectionToRef = function(e, n, i) {
+ n === void 0 && (n = null);
+ var o = null;
+ n && (o = n.getWorldMatrix()), this._skeleton.computeAbsoluteTransforms();
+ var a = t._tmpMats[0];
+ a.copyFrom(this.getAbsoluteTransform()), n && o && a.multiplyToRef(o, a), c.e.TransformNormalToRef(e, a, i), i.normalize();
+ }, t.prototype.getRotation = function(e, n) {
+ e === void 0 && (e = Se.c.LOCAL), n === void 0 && (n = null);
+ var i = c.e.Zero();
+ return this.getRotationToRef(e, n, i), i;
+ }, t.prototype.getRotationToRef = function(e, n, i) {
+ e === void 0 && (e = Se.c.LOCAL), n === void 0 && (n = null);
+ var o = t._tmpQuat;
+ this.getRotationQuaternionToRef(e, n, o), o.toEulerAnglesToRef(i);
+ }, t.prototype.getRotationQuaternion = function(e, n) {
+ e === void 0 && (e = Se.c.LOCAL), n === void 0 && (n = null);
+ var i = c.b.Identity();
+ return this.getRotationQuaternionToRef(e, n, i), i;
+ }, t.prototype.getRotationQuaternionToRef = function(e, n, i) {
+ if (e === void 0 && (e = Se.c.LOCAL), n === void 0 && (n = null), e == Se.c.LOCAL)
+ this._decompose(), i.copyFrom(this._localRotation);
+ else {
+ var o = t._tmpMats[0], a = this.getAbsoluteTransform();
+ n ? a.multiplyToRef(n.getWorldMatrix(), o) : o.copyFrom(a), o.multiplyAtIndex(0, this._scalingDeterminant), o.multiplyAtIndex(1, this._scalingDeterminant), o.multiplyAtIndex(2, this._scalingDeterminant), o.decompose(void 0, i, void 0);
+ }
+ }, t.prototype.getRotationMatrix = function(e, n) {
+ e === void 0 && (e = Se.c.LOCAL);
+ var i = c.a.Identity();
+ return this.getRotationMatrixToRef(e, n, i), i;
+ }, t.prototype.getRotationMatrixToRef = function(e, n, i) {
+ if (e === void 0 && (e = Se.c.LOCAL), e == Se.c.LOCAL)
+ this.getLocalMatrix().getRotationMatrixToRef(i);
+ else {
+ var o = t._tmpMats[0], a = this.getAbsoluteTransform();
+ n ? a.multiplyToRef(n.getWorldMatrix(), o) : o.copyFrom(a), o.multiplyAtIndex(0, this._scalingDeterminant), o.multiplyAtIndex(1, this._scalingDeterminant), o.multiplyAtIndex(2, this._scalingDeterminant), o.getRotationMatrixToRef(i);
+ }
+ }, t.prototype.getAbsolutePositionFromLocal = function(e, n) {
+ n === void 0 && (n = null);
+ var i = c.e.Zero();
+ return this.getAbsolutePositionFromLocalToRef(e, n, i), i;
+ }, t.prototype.getAbsolutePositionFromLocalToRef = function(e, n, i) {
+ n === void 0 && (n = null);
+ var o = null;
+ n && (o = n.getWorldMatrix()), this._skeleton.computeAbsoluteTransforms();
+ var a = t._tmpMats[0];
+ n && o ? (a.copyFrom(this.getAbsoluteTransform()), a.multiplyToRef(o, a)) : a = this.getAbsoluteTransform(), c.e.TransformCoordinatesToRef(e, a, i);
+ }, t.prototype.getLocalPositionFromAbsolute = function(e, n) {
+ n === void 0 && (n = null);
+ var i = c.e.Zero();
+ return this.getLocalPositionFromAbsoluteToRef(e, n, i), i;
+ }, t.prototype.getLocalPositionFromAbsoluteToRef = function(e, n, i) {
+ n === void 0 && (n = null);
+ var o = null;
+ n && (o = n.getWorldMatrix()), this._skeleton.computeAbsoluteTransforms();
+ var a = t._tmpMats[0];
+ a.copyFrom(this.getAbsoluteTransform()), n && o && a.multiplyToRef(o, a), a.invert(), c.e.TransformCoordinatesToRef(e, a, i);
+ }, t.prototype.setCurrentPoseAsRest = function() {
+ this.setRestPose(this.getLocalMatrix());
+ }, t._tmpVecs = Re.a.BuildArray(2, c.e.Zero), t._tmpQuat = c.b.Identity(), t._tmpMats = Re.a.BuildArray(5, c.a.Identity), t;
+ }(q.a), ze = function() {
+ function r(t, e, n, i, o, a, s, p, m, S) {
+ n === void 0 && (n = 0), i === void 0 && (i = 100), o === void 0 && (o = !1), a === void 0 && (a = 1), S === void 0 && (S = !1), this.target = e, this.fromFrame = n, this.toFrame = i, this.loopAnimation = o, this.onAnimationEnd = s, this.onAnimationLoop = m, this.isAdditive = S, this._localDelayOffset = null, this._pausedDelay = null, this._runtimeAnimations = new Array(), this._paused = !1, this._speedRatio = 1, this._weight = -1, this._syncRoot = null, this.disposeOnEnd = !0, this.animationStarted = !1, this.onAnimationEndObservable = new P.c(), this.onAnimationLoopObservable = new P.c(), this._scene = t, p && this.appendAnimations(e, p), this._speedRatio = a, t._activeAnimatables.push(this);
+ }
+ return Object.defineProperty(r.prototype, "syncRoot", { get: function() {
+ return this._syncRoot;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "masterFrame", { get: function() {
+ return this._runtimeAnimations.length === 0 ? 0 : this._runtimeAnimations[0].currentFrame;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "weight", { get: function() {
+ return this._weight;
+ }, set: function(t) {
+ this._weight = t !== -1 ? Math.min(Math.max(t, 0), 1) : -1;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "speedRatio", { get: function() {
+ return this._speedRatio;
+ }, set: function(t) {
+ for (var e = 0; e < this._runtimeAnimations.length; e++)
+ this._runtimeAnimations[e]._prepareForSpeedRatioChange(t);
+ this._speedRatio = t;
+ }, enumerable: !1, configurable: !0 }), r.prototype.syncWith = function(t) {
+ if (this._syncRoot = t, t) {
+ var e = this._scene._activeAnimatables.indexOf(this);
+ e > -1 && (this._scene._activeAnimatables.splice(e, 1), this._scene._activeAnimatables.push(this));
+ }
+ return this;
+ }, r.prototype.getAnimations = function() {
+ return this._runtimeAnimations;
+ }, r.prototype.appendAnimations = function(t, e) {
+ for (var n = this, i = 0; i < e.length; i++) {
+ var o = e[i], a = new be(t, o, this._scene, this);
+ a._onLoop = function() {
+ n.onAnimationLoopObservable.notifyObservers(n), n.onAnimationLoop && n.onAnimationLoop();
+ }, this._runtimeAnimations.push(a);
+ }
+ }, r.prototype.getAnimationByTargetProperty = function(t) {
+ for (var e = this._runtimeAnimations, n = 0; n < e.length; n++)
+ if (e[n].animation.targetProperty === t)
+ return e[n].animation;
+ return null;
+ }, r.prototype.getRuntimeAnimationByTargetProperty = function(t) {
+ for (var e = this._runtimeAnimations, n = 0; n < e.length; n++)
+ if (e[n].animation.targetProperty === t)
+ return e[n];
+ return null;
+ }, r.prototype.reset = function() {
+ for (var t = this._runtimeAnimations, e = 0; e < t.length; e++)
+ t[e].reset(!0);
+ this._localDelayOffset = null, this._pausedDelay = null;
+ }, r.prototype.enableBlending = function(t) {
+ for (var e = this._runtimeAnimations, n = 0; n < e.length; n++)
+ e[n].animation.enableBlending = !0, e[n].animation.blendingSpeed = t;
+ }, r.prototype.disableBlending = function() {
+ for (var t = this._runtimeAnimations, e = 0; e < t.length; e++)
+ t[e].animation.enableBlending = !1;
+ }, r.prototype.goToFrame = function(t) {
+ var e = this._runtimeAnimations;
+ if (e[0]) {
+ var n = e[0].animation.framePerSecond, i = e[0].currentFrame, o = this.speedRatio === 0 ? 0 : (t - i) / n * 1e3 / this.speedRatio;
+ this._localDelayOffset === null && (this._localDelayOffset = 0), this._localDelayOffset -= o;
+ }
+ for (var a = 0; a < e.length; a++)
+ e[a].goToFrame(t);
+ }, r.prototype.pause = function() {
+ this._paused || (this._paused = !0);
+ }, r.prototype.restart = function() {
+ this._paused = !1;
+ }, r.prototype._raiseOnAnimationEnd = function() {
+ this.onAnimationEnd && this.onAnimationEnd(), this.onAnimationEndObservable.notifyObservers(this);
+ }, r.prototype.stop = function(t, e) {
+ if (t || e) {
+ var n = this._scene._activeAnimatables.indexOf(this);
+ if (n > -1) {
+ for (var i = (a = this._runtimeAnimations).length - 1; i >= 0; i--) {
+ var o = a[i];
+ t && o.animation.name != t || e && !e(o.target) || (o.dispose(), a.splice(i, 1));
+ }
+ a.length == 0 && (this._scene._activeAnimatables.splice(n, 1), this._raiseOnAnimationEnd());
+ }
+ } else if ((i = this._scene._activeAnimatables.indexOf(this)) > -1) {
+ this._scene._activeAnimatables.splice(i, 1);
+ var a = this._runtimeAnimations;
+ for (i = 0; i < a.length; i++)
+ a[i].dispose();
+ this._raiseOnAnimationEnd();
+ }
+ }, r.prototype.waitAsync = function() {
+ var t = this;
+ return new Promise(function(e, n) {
+ t.onAnimationEndObservable.add(function() {
+ e(t);
+ }, void 0, void 0, t, !0);
+ });
+ }, r.prototype._animate = function(t) {
+ if (this._paused)
+ return this.animationStarted = !1, this._pausedDelay === null && (this._pausedDelay = t), !0;
+ if (this._localDelayOffset === null ? (this._localDelayOffset = t, this._pausedDelay = null) : this._pausedDelay !== null && (this._localDelayOffset += t - this._pausedDelay, this._pausedDelay = null), this._weight === 0)
+ return !0;
+ var e, n = !1, i = this._runtimeAnimations;
+ for (e = 0; e < i.length; e++) {
+ var o = i[e].animate(t - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this._speedRatio, this._weight);
+ n = n || o;
+ }
+ if (this.animationStarted = n, !n) {
+ if (this.disposeOnEnd)
+ for (e = this._scene._activeAnimatables.indexOf(this), this._scene._activeAnimatables.splice(e, 1), e = 0; e < i.length; e++)
+ i[e].dispose();
+ this._raiseOnAnimationEnd(), this.disposeOnEnd && (this.onAnimationEnd = null, this.onAnimationLoop = null, this.onAnimationLoopObservable.clear(), this.onAnimationEndObservable.clear());
+ }
+ return n;
+ }, r;
+ }();
+ ge.a.prototype._animate = function() {
+ if (this.animationsEnabled) {
+ var r = Te.a.Now;
+ if (!this._animationTimeLast) {
+ if (this._pendingData.length > 0)
+ return;
+ this._animationTimeLast = r;
+ }
+ this.deltaTime = this.useConstantAnimationDeltaTime ? 16 : (r - this._animationTimeLast) * this.animationTimeScale, this._animationTimeLast = r;
+ var t = this._activeAnimatables;
+ if (t.length !== 0) {
+ this._animationTime += this.deltaTime;
+ for (var e = this._animationTime, n = 0; n < t.length; n++) {
+ var i = t[n];
+ !i._animate(e) && i.disposeOnEnd && n--;
+ }
+ this._processLateAnimationBindings();
+ }
+ }
+ }, ge.a.prototype.beginWeightedAnimation = function(r, t, e, n, i, o, a, s, p, m, S) {
+ n === void 0 && (n = 1), o === void 0 && (o = 1), S === void 0 && (S = !1);
+ var O = this.beginAnimation(r, t, e, i, o, a, s, !1, p, m, S);
+ return O.weight = n, O;
+ }, ge.a.prototype.beginAnimation = function(r, t, e, n, i, o, a, s, p, m, S) {
+ i === void 0 && (i = 1), s === void 0 && (s = !0), S === void 0 && (S = !1), t > e && i > 0 && (i *= -1), s && this.stopAnimation(r, void 0, p), a || (a = new ze(this, r, t, e, n, i, o, void 0, m, S));
+ var O = !p || p(r);
+ if (r.animations && O && a.appendAnimations(r, r.animations), r.getAnimatables)
+ for (var I = r.getAnimatables(), G = 0; G < I.length; G++)
+ this.beginAnimation(I[G], t, e, n, i, o, a, s, p, m);
+ return a.reset(), a;
+ }, ge.a.prototype.beginHierarchyAnimation = function(r, t, e, n, i, o, a, s, p, m, S, O) {
+ o === void 0 && (o = 1), p === void 0 && (p = !0), O === void 0 && (O = !1);
+ var I = r.getDescendants(t), G = [];
+ G.push(this.beginAnimation(r, e, n, i, o, a, s, p, m, void 0, O));
+ for (var k = 0, K = I; k < K.length; k++) {
+ var re = K[k];
+ G.push(this.beginAnimation(re, e, n, i, o, a, s, p, m, void 0, O));
+ }
+ return G;
+ }, ge.a.prototype.beginDirectAnimation = function(r, t, e, n, i, o, a, s, p) {
+ return p === void 0 && (p = !1), o === void 0 && (o = 1), e > n && o > 0 && (o *= -1), new ze(this, r, e, n, i, o, a, t, s, p);
+ }, ge.a.prototype.beginDirectHierarchyAnimation = function(r, t, e, n, i, o, a, s, p, m) {
+ m === void 0 && (m = !1);
+ var S = r.getDescendants(t), O = [];
+ O.push(this.beginDirectAnimation(r, e, n, i, o, a, s, p, m));
+ for (var I = 0, G = S; I < G.length; I++) {
+ var k = G[I];
+ O.push(this.beginDirectAnimation(k, e, n, i, o, a, s, p, m));
+ }
+ return O;
+ }, ge.a.prototype.getAnimatableByTarget = function(r) {
+ for (var t = 0; t < this._activeAnimatables.length; t++)
+ if (this._activeAnimatables[t].target === r)
+ return this._activeAnimatables[t];
+ return null;
+ }, ge.a.prototype.getAllAnimatablesByTarget = function(r) {
+ for (var t = [], e = 0; e < this._activeAnimatables.length; e++)
+ this._activeAnimatables[e].target === r && t.push(this._activeAnimatables[e]);
+ return t;
+ }, ge.a.prototype.stopAnimation = function(r, t, e) {
+ for (var n = 0, i = this.getAllAnimatablesByTarget(r); n < i.length; n++)
+ i[n].stop(t, e);
+ }, ge.a.prototype.stopAllAnimations = function() {
+ if (this._activeAnimatables) {
+ for (var r = 0; r < this._activeAnimatables.length; r++)
+ this._activeAnimatables[r].stop();
+ this._activeAnimatables = [];
+ }
+ for (var t = 0, e = this.animationGroups; t < e.length; t++)
+ e[t].stop();
+ }, ge.a.prototype._registerTargetForLateAnimationBinding = function(r, t) {
+ var e = r.target;
+ this._registeredForLateAnimationBindings.pushNoDuplicate(e), e._lateAnimationHolders || (e._lateAnimationHolders = {}), e._lateAnimationHolders[r.targetPath] || (e._lateAnimationHolders[r.targetPath] = { totalWeight: 0, totalAdditiveWeight: 0, animations: [], additiveAnimations: [], originalValue: t }), r.isAdditive ? (e._lateAnimationHolders[r.targetPath].additiveAnimations.push(r), e._lateAnimationHolders[r.targetPath].totalAdditiveWeight += r.weight) : (e._lateAnimationHolders[r.targetPath].animations.push(r), e._lateAnimationHolders[r.targetPath].totalWeight += r.weight);
+ }, ge.a.prototype._processLateAnimationBindingsForMatrices = function(r) {
+ if (r.totalWeight === 0 && r.totalAdditiveWeight === 0)
+ return r.originalValue;
+ var t = 1, e = c.c.Vector3[0], n = c.c.Vector3[1], i = c.c.Quaternion[0], o = 0, a = r.animations[0], s = r.originalValue, p = 1, m = !1;
+ if (r.totalWeight < 1)
+ p = 1 - r.totalWeight, s.decompose(n, i, e);
+ else {
+ if (o = 1, t = r.totalWeight, (p = a.weight / t) == 1) {
+ if (!r.totalAdditiveWeight)
+ return a.currentValue;
+ m = !0;
+ }
+ a.currentValue.decompose(n, i, e);
+ }
+ if (!m) {
+ n.scaleInPlace(p), e.scaleInPlace(p), i.scaleInPlace(p);
+ for (var S = o; S < r.animations.length; S++)
+ if ((K = r.animations[S]).weight !== 0) {
+ p = K.weight / t;
+ var O = c.c.Vector3[2], I = c.c.Vector3[3], G = c.c.Quaternion[1];
+ K.currentValue.decompose(I, G, O), I.scaleAndAddToRef(p, n), G.scaleAndAddToRef(p, i), O.scaleAndAddToRef(p, e);
+ }
+ }
+ for (var k = 0; k < r.additiveAnimations.length; k++) {
+ var K;
+ (K = r.additiveAnimations[k]).weight !== 0 && (O = c.c.Vector3[2], I = c.c.Vector3[3], G = c.c.Quaternion[1], K.currentValue.decompose(I, G, O), I.multiplyToRef(n, I), c.e.LerpToRef(n, I, K.weight, n), i.multiplyToRef(G, G), c.b.SlerpToRef(i, G, K.weight, i), O.scaleAndAddToRef(K.weight, e));
+ }
+ var re = a ? a._animationState.workValue : c.c.Matrix[0].clone();
+ return c.a.ComposeToRef(n, i, e, re), re;
+ }, ge.a.prototype._processLateAnimationBindingsForQuaternions = function(r, t) {
+ if (r.totalWeight === 0 && r.totalAdditiveWeight === 0)
+ return t;
+ var e = r.animations[0], n = r.originalValue, i = t;
+ if (r.totalWeight === 0 && r.totalAdditiveWeight > 0)
+ i.copyFrom(n);
+ else if (r.animations.length === 1) {
+ if (c.b.SlerpToRef(n, e.currentValue, Math.min(1, r.totalWeight), i), r.totalAdditiveWeight === 0)
+ return i;
+ } else if (r.animations.length > 1) {
+ var o = 1, a = void 0, s = void 0;
+ if (r.totalWeight < 1) {
+ var p = 1 - r.totalWeight;
+ s = [], (a = []).push(n), s.push(p);
+ } else {
+ if (r.animations.length === 2 && (c.b.SlerpToRef(r.animations[0].currentValue, r.animations[1].currentValue, r.animations[1].weight / r.totalWeight, t), r.totalAdditiveWeight === 0))
+ return t;
+ a = [], s = [], o = r.totalWeight;
+ }
+ for (var m = 0; m < r.animations.length; m++) {
+ var S = r.animations[m];
+ a.push(S.currentValue), s.push(S.weight / o);
+ }
+ for (var O = 0, I = 0; I < a.length; )
+ I ? (O += s[I], c.b.SlerpToRef(i, a[I], s[I] / O, i), I++) : (c.b.SlerpToRef(a[I], a[I + 1], s[I + 1] / (s[I] + s[I + 1]), t), i = t, O = s[I] + s[I + 1], I += 2);
+ }
+ for (var G = 0; G < r.additiveAnimations.length; G++)
+ (S = r.additiveAnimations[G]).weight !== 0 && (i.multiplyToRef(S.currentValue, c.c.Quaternion[0]), c.b.SlerpToRef(i, c.c.Quaternion[0], S.weight, i));
+ return i;
+ }, ge.a.prototype._processLateAnimationBindings = function() {
+ if (this._registeredForLateAnimationBindings.length) {
+ for (var r = 0; r < this._registeredForLateAnimationBindings.length; r++) {
+ var t = this._registeredForLateAnimationBindings.data[r];
+ for (var e in t._lateAnimationHolders) {
+ var n = t._lateAnimationHolders[e], i = n.animations[0], o = n.originalValue, a = H.AllowMatrixDecomposeForInterpolation && o.m, s = t[e];
+ if (a)
+ s = this._processLateAnimationBindingsForMatrices(n);
+ else if (o.w !== void 0)
+ s = this._processLateAnimationBindingsForQuaternions(n, s || c.b.Identity());
+ else {
+ var p = 0, m = 1;
+ if (n.totalWeight < 1)
+ s = i && o.scale ? o.scale(1 - n.totalWeight) : i ? o * (1 - n.totalWeight) : o.clone ? o.clone() : o;
+ else if (i) {
+ m = n.totalWeight;
+ var S = i.weight / m;
+ s = S !== 1 ? i.currentValue.scale ? i.currentValue.scale(S) : i.currentValue * S : i.currentValue, p = 1;
+ }
+ for (var O = p; O < n.animations.length; O++)
+ (k = (G = n.animations[O]).weight / m) && (G.currentValue.scaleAndAddToRef ? G.currentValue.scaleAndAddToRef(k, s) : s += G.currentValue * k);
+ for (var I = 0; I < n.additiveAnimations.length; I++) {
+ var G, k;
+ (k = (G = n.additiveAnimations[I]).weight) && (G.currentValue.scaleAndAddToRef ? G.currentValue.scaleAndAddToRef(k, s) : s += G.currentValue * k);
+ }
+ }
+ t[e] = s;
+ }
+ t._lateAnimationHolders = {};
+ }
+ this._registeredForLateAnimationBindings.reset();
+ }
+ }, Ne.prototype.copyAnimationRange = function(r, t, e, n, i) {
+ n === void 0 && (n = !1), i === void 0 && (i = null), this.animations.length === 0 && (this.animations.push(new H(this.name, "_matrix", r.animations[0].framePerSecond, H.ANIMATIONTYPE_MATRIX, 0)), this.animations[0].setKeys([]));
+ var o = r.animations[0].getRange(t);
+ if (!o)
+ return !1;
+ for (var a, s, p, m = o.from, S = o.to, O = r.animations[0].getKeys(), I = r.length, G = r.getParent(), k = this.getParent(), K = n && G && I && this.length && I !== this.length, re = K && k && G ? k.length / G.length : 1, se = n && !k && i && (i.x !== 1 || i.y !== 1 || i.z !== 1), ue = this.animations[0].getKeys(), he = 0, pe = O.length; he < pe; he++)
+ (a = O[he]).frame >= m && a.frame <= S && (n ? (p = a.value.clone(), K ? (s = p.getTranslation(), p.setTranslation(s.scaleInPlace(re))) : se && i ? (s = p.getTranslation(), p.setTranslation(s.multiplyInPlace(i))) : p = a.value) : p = a.value, ue.push({ frame: a.frame + e, value: p }));
+ return this.animations[0].createRange(t, m + e, S + e), !0;
+ };
+ var Ye = function() {
+ function r() {
+ }
+ return r.prototype.getClassName = function() {
+ return "TargetedAnimation";
+ }, r.prototype.serialize = function() {
+ var t = {};
+ return t.animation = this.animation.serialize(), t.targetId = this.target.id, t;
+ }, r;
+ }(), He = function() {
+ function r(t, e) {
+ e === void 0 && (e = null), this.name = t, this._targetedAnimations = new Array(), this._animatables = new Array(), this._from = Number.MAX_VALUE, this._to = -Number.MAX_VALUE, this._speedRatio = 1, this._loopAnimation = !1, this._isAdditive = !1, this.onAnimationEndObservable = new P.c(), this.onAnimationLoopObservable = new P.c(), this.onAnimationGroupLoopObservable = new P.c(), this.onAnimationGroupEndObservable = new P.c(), this.onAnimationGroupPauseObservable = new P.c(), this.onAnimationGroupPlayObservable = new P.c(), this._scene = e || te.a.LastCreatedScene, this.uniqueId = this._scene.getUniqueId(), this._scene.addAnimationGroup(this);
+ }
+ return Object.defineProperty(r.prototype, "from", { get: function() {
+ return this._from;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "to", { get: function() {
+ return this._to;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "isStarted", { get: function() {
+ return this._isStarted;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "isPlaying", { get: function() {
+ return this._isStarted && !this._isPaused;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "speedRatio", { get: function() {
+ return this._speedRatio;
+ }, set: function(t) {
+ if (this._speedRatio !== t) {
+ this._speedRatio = t;
+ for (var e = 0; e < this._animatables.length; e++)
+ this._animatables[e].speedRatio = this._speedRatio;
+ }
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "loopAnimation", { get: function() {
+ return this._loopAnimation;
+ }, set: function(t) {
+ if (this._loopAnimation !== t) {
+ this._loopAnimation = t;
+ for (var e = 0; e < this._animatables.length; e++)
+ this._animatables[e].loopAnimation = this._loopAnimation;
+ }
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "isAdditive", { get: function() {
+ return this._isAdditive;
+ }, set: function(t) {
+ if (this._isAdditive !== t) {
+ this._isAdditive = t;
+ for (var e = 0; e < this._animatables.length; e++)
+ this._animatables[e].isAdditive = this._isAdditive;
+ }
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "targetedAnimations", { get: function() {
+ return this._targetedAnimations;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "animatables", { get: function() {
+ return this._animatables;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "children", { get: function() {
+ return this._targetedAnimations;
+ }, enumerable: !1, configurable: !0 }), r.prototype.addTargetedAnimation = function(t, e) {
+ var n = new Ye();
+ n.animation = t, n.target = e;
+ var i = t.getKeys();
+ return this._from > i[0].frame && (this._from = i[0].frame), this._to < i[i.length - 1].frame && (this._to = i[i.length - 1].frame), this._targetedAnimations.push(n), n;
+ }, r.prototype.normalize = function(t, e) {
+ t === void 0 && (t = null), e === void 0 && (e = null), t == null && (t = this._from), e == null && (e = this._to);
+ for (var n = 0; n < this._targetedAnimations.length; n++) {
+ var i = this._targetedAnimations[n].animation.getKeys(), o = i[0], a = i[i.length - 1];
+ if (o.frame > t) {
+ var s = { frame: t, value: o.value, inTangent: o.inTangent, outTangent: o.outTangent, interpolation: o.interpolation };
+ i.splice(0, 0, s);
+ }
+ a.frame < e && (s = { frame: e, value: a.value, inTangent: a.inTangent, outTangent: a.outTangent, interpolation: a.interpolation }, i.push(s));
+ }
+ return this._from = t, this._to = e, this;
+ }, r.prototype._processLoop = function(t, e, n) {
+ var i = this;
+ t.onAnimationLoop = function() {
+ i.onAnimationLoopObservable.notifyObservers(e), i._animationLoopFlags[n] || (i._animationLoopFlags[n] = !0, i._animationLoopCount++, i._animationLoopCount === i._targetedAnimations.length && (i.onAnimationGroupLoopObservable.notifyObservers(i), i._animationLoopCount = 0, i._animationLoopFlags = []));
+ };
+ }, r.prototype.start = function(t, e, n, i, o) {
+ var a = this;
+ if (t === void 0 && (t = !1), e === void 0 && (e = 1), this._isStarted || this._targetedAnimations.length === 0)
+ return this;
+ this._loopAnimation = t, this._animationLoopCount = 0, this._animationLoopFlags = [];
+ for (var s = function() {
+ var O = p._targetedAnimations[m], I = p._scene.beginDirectAnimation(O.target, [O.animation], n !== void 0 ? n : p._from, i !== void 0 ? i : p._to, t, e, void 0, void 0, o !== void 0 ? o : p._isAdditive);
+ I.onAnimationEnd = function() {
+ a.onAnimationEndObservable.notifyObservers(O), a._checkAnimationGroupEnded(I);
+ }, p._processLoop(I, O, m), p._animatables.push(I);
+ }, p = this, m = 0; m < this._targetedAnimations.length; m++)
+ s();
+ if (this._speedRatio = e, n !== void 0 && i !== void 0)
+ if (n < i && this._speedRatio < 0) {
+ var S = i;
+ i = n, n = S;
+ } else
+ n > i && this._speedRatio > 0 && (this._speedRatio = -e);
+ return this._isStarted = !0, this._isPaused = !1, this.onAnimationGroupPlayObservable.notifyObservers(this), this;
+ }, r.prototype.pause = function() {
+ if (!this._isStarted)
+ return this;
+ this._isPaused = !0;
+ for (var t = 0; t < this._animatables.length; t++)
+ this._animatables[t].pause();
+ return this.onAnimationGroupPauseObservable.notifyObservers(this), this;
+ }, r.prototype.play = function(t) {
+ return this.isStarted && this._animatables.length === this._targetedAnimations.length ? (t !== void 0 && (this.loopAnimation = t), this.restart()) : (this.stop(), this.start(t, this._speedRatio)), this._isPaused = !1, this;
+ }, r.prototype.reset = function() {
+ if (!this._isStarted)
+ return this.play(), this.goToFrame(0), this.stop(), this;
+ for (var t = 0; t < this._animatables.length; t++)
+ this._animatables[t].reset();
+ return this;
+ }, r.prototype.restart = function() {
+ if (!this._isStarted)
+ return this;
+ for (var t = 0; t < this._animatables.length; t++)
+ this._animatables[t].restart();
+ return this.onAnimationGroupPlayObservable.notifyObservers(this), this;
+ }, r.prototype.stop = function() {
+ if (!this._isStarted)
+ return this;
+ for (var t = this._animatables.slice(), e = 0; e < t.length; e++)
+ t[e].stop();
+ return this._isStarted = !1, this;
+ }, r.prototype.setWeightForAllAnimatables = function(t) {
+ for (var e = 0; e < this._animatables.length; e++)
+ this._animatables[e].weight = t;
+ return this;
+ }, r.prototype.syncAllAnimationsWith = function(t) {
+ for (var e = 0; e < this._animatables.length; e++)
+ this._animatables[e].syncWith(t);
+ return this;
+ }, r.prototype.goToFrame = function(t) {
+ if (!this._isStarted)
+ return this;
+ for (var e = 0; e < this._animatables.length; e++)
+ this._animatables[e].goToFrame(t);
+ return this;
+ }, r.prototype.dispose = function() {
+ this._targetedAnimations = [], this._animatables = [];
+ var t = this._scene.animationGroups.indexOf(this);
+ t > -1 && this._scene.animationGroups.splice(t, 1), this.onAnimationEndObservable.clear(), this.onAnimationGroupEndObservable.clear(), this.onAnimationGroupPauseObservable.clear(), this.onAnimationGroupPlayObservable.clear(), this.onAnimationLoopObservable.clear(), this.onAnimationGroupLoopObservable.clear();
+ }, r.prototype._checkAnimationGroupEnded = function(t) {
+ var e = this._animatables.indexOf(t);
+ e > -1 && this._animatables.splice(e, 1), this._animatables.length === 0 && (this._isStarted = !1, this.onAnimationGroupEndObservable.notifyObservers(this));
+ }, r.prototype.clone = function(t, e) {
+ for (var n = new r(t || this.name, this._scene), i = 0, o = this._targetedAnimations; i < o.length; i++) {
+ var a = o[i];
+ n.addTargetedAnimation(a.animation.clone(), e ? e(a.target) : a.target);
+ }
+ return n;
+ }, r.prototype.serialize = function() {
+ var t = {};
+ t.name = this.name, t.from = this.from, t.to = this.to, t.targetedAnimations = [];
+ for (var e = 0; e < this.targetedAnimations.length; e++) {
+ var n = this.targetedAnimations[e];
+ t.targetedAnimations[e] = n.serialize();
+ }
+ return t;
+ }, r.Parse = function(t, e) {
+ for (var n = new r(t.name, e), i = 0; i < t.targetedAnimations.length; i++) {
+ var o = t.targetedAnimations[i], a = H.Parse(o.animation), s = o.targetId;
+ if (o.animation.property === "influence") {
+ var p = e.getMorphTargetById(s);
+ p && n.addTargetedAnimation(a, p);
+ } else {
+ var m = e.getNodeByID(s);
+ m != null && n.addTargetedAnimation(a, m);
+ }
+ }
+ return t.from !== null && t.to !== null && n.normalize(t.from, t.to), n;
+ }, r.MakeAnimationAdditive = function(t, e, n, i, o) {
+ e === void 0 && (e = 0), i === void 0 && (i = !1);
+ var a = t;
+ i && (a = t.clone(o || a.name));
+ for (var s = a.targetedAnimations, p = 0; p < s.length; p++) {
+ var m = s[p];
+ H.MakeAnimationAdditive(m.animation, e, n);
+ }
+ return a.isAdditive = !0, a;
+ }, r.prototype.getClassName = function() {
+ return "AnimationGroup";
+ }, r.prototype.toString = function(t) {
+ var e = "Name: " + this.name;
+ return e += ", type: " + this.getClassName(), t && (e += ", from: " + this._from, e += ", to: " + this._to, e += ", isStarted: " + this._isStarted, e += ", speedRatio: " + this._speedRatio, e += ", targetedAnimations length: " + this._targetedAnimations.length, e += ", animatables length: " + this._animatables), e;
+ }, r;
+ }(), Xe = function() {
+ this.enableBlending = !1, this.blendingSpeed = 0.01, this.loopMode = H.ANIMATIONLOOPMODE_CYCLE;
+ }, Ze = l(72), je = function() {
+ function r() {
+ this._easingMode = r.EASINGMODE_EASEIN;
+ }
+ return r.prototype.setEasingMode = function(t) {
+ var e = Math.min(Math.max(t, 0), 2);
+ this._easingMode = e;
+ }, r.prototype.getEasingMode = function() {
+ return this._easingMode;
+ }, r.prototype.easeInCore = function(t) {
+ throw new Error("You must implement this method");
+ }, r.prototype.ease = function(t) {
+ switch (this._easingMode) {
+ case r.EASINGMODE_EASEIN:
+ return this.easeInCore(t);
+ case r.EASINGMODE_EASEOUT:
+ return 1 - this.easeInCore(1 - t);
+ }
+ return t >= 0.5 ? 0.5 * (1 - this.easeInCore(2 * (1 - t))) + 0.5 : 0.5 * this.easeInCore(2 * t);
+ }, r.EASINGMODE_EASEIN = 0, r.EASINGMODE_EASEOUT = 1, r.EASINGMODE_EASEINOUT = 2, r;
+ }(), it = function(r) {
+ function t() {
+ return r !== null && r.apply(this, arguments) || this;
+ }
+ return Object(u.d)(t, r), t.prototype.easeInCore = function(e) {
+ return e = Math.max(0, Math.min(1, e)), 1 - Math.sqrt(1 - e * e);
+ }, t;
+ }(je), et = function(r) {
+ function t(e) {
+ e === void 0 && (e = 1);
+ var n = r.call(this) || this;
+ return n.amplitude = e, n;
+ }
+ return Object(u.d)(t, r), t.prototype.easeInCore = function(e) {
+ var n = Math.max(0, this.amplitude);
+ return Math.pow(e, 3) - e * n * Math.sin(3.141592653589793 * e);
+ }, t;
+ }(je), lt = function(r) {
+ function t(e, n) {
+ e === void 0 && (e = 3), n === void 0 && (n = 2);
+ var i = r.call(this) || this;
+ return i.bounces = e, i.bounciness = n, i;
+ }
+ return Object(u.d)(t, r), t.prototype.easeInCore = function(e) {
+ var n = Math.max(0, this.bounces), i = this.bounciness;
+ i <= 1 && (i = 1.001);
+ var o = Math.pow(i, n), a = 1 - i, s = (1 - o) / a + 0.5 * o, p = e * s, m = Math.log(-p * (1 - i) + 1) / Math.log(i), S = Math.floor(m), O = S + 1, I = (1 - Math.pow(i, S)) / (a * s), G = 0.5 * (I + (1 - Math.pow(i, O)) / (a * s)), k = e - G, K = G - I;
+ return -Math.pow(1 / i, n - S) / (K * K) * (k - K) * (k + K);
+ }, t;
+ }(je), ct = function(r) {
+ function t() {
+ return r !== null && r.apply(this, arguments) || this;
+ }
+ return Object(u.d)(t, r), t.prototype.easeInCore = function(e) {
+ return e * e * e;
+ }, t;
+ }(je), mt = function(r) {
+ function t(e, n) {
+ e === void 0 && (e = 3), n === void 0 && (n = 3);
+ var i = r.call(this) || this;
+ return i.oscillations = e, i.springiness = n, i;
+ }
+ return Object(u.d)(t, r), t.prototype.easeInCore = function(e) {
+ var n = Math.max(0, this.oscillations), i = Math.max(0, this.springiness);
+ return (i == 0 ? e : (Math.exp(i * e) - 1) / (Math.exp(i) - 1)) * Math.sin((6.283185307179586 * n + 1.5707963267948966) * e);
+ }, t;
+ }(je), St = function(r) {
+ function t(e) {
+ e === void 0 && (e = 2);
+ var n = r.call(this) || this;
+ return n.exponent = e, n;
+ }
+ return Object(u.d)(t, r), t.prototype.easeInCore = function(e) {
+ return this.exponent <= 0 ? e : (Math.exp(this.exponent * e) - 1) / (Math.exp(this.exponent) - 1);
+ }, t;
+ }(je), Ut = function(r) {
+ function t(e) {
+ e === void 0 && (e = 2);
+ var n = r.call(this) || this;
+ return n.power = e, n;
+ }
+ return Object(u.d)(t, r), t.prototype.easeInCore = function(e) {
+ var n = Math.max(0, this.power);
+ return Math.pow(e, n);
+ }, t;
+ }(je), wt = function(r) {
+ function t() {
+ return r !== null && r.apply(this, arguments) || this;
+ }
+ return Object(u.d)(t, r), t.prototype.easeInCore = function(e) {
+ return e * e;
+ }, t;
+ }(je), Pt = function(r) {
+ function t() {
+ return r !== null && r.apply(this, arguments) || this;
+ }
+ return Object(u.d)(t, r), t.prototype.easeInCore = function(e) {
+ return e * e * e * e;
+ }, t;
+ }(je), Mt = function(r) {
+ function t() {
+ return r !== null && r.apply(this, arguments) || this;
+ }
+ return Object(u.d)(t, r), t.prototype.easeInCore = function(e) {
+ return e * e * e * e * e;
+ }, t;
+ }(je), _n = function(r) {
+ function t() {
+ return r !== null && r.apply(this, arguments) || this;
+ }
+ return Object(u.d)(t, r), t.prototype.easeInCore = function(e) {
+ return 1 - Math.sin(1.5707963267948966 * (1 - e));
+ }, t;
+ }(je), an = function(r) {
+ function t(e, n, i, o) {
+ e === void 0 && (e = 0), n === void 0 && (n = 0), i === void 0 && (i = 1), o === void 0 && (o = 1);
+ var a = r.call(this) || this;
+ return a.x1 = e, a.y1 = n, a.x2 = i, a.y2 = o, a;
+ }
+ return Object(u.d)(t, r), t.prototype.easeInCore = function(e) {
+ return Ze.c.Interpolate(e, this.x1, this.y1, this.x2, this.y2);
+ }, t;
+ }(je), hn = function() {
+ function r(t, e, n) {
+ this.frame = t, this.action = e, this.onlyOnce = n, this.isDone = !1;
+ }
+ return r.prototype._clone = function() {
+ return new r(this.frame, this.action, this.onlyOnce);
+ }, r;
+ }(), we = l(7), Bn = function(r) {
+ function t() {
+ return r !== null && r.apply(this, arguments) || this;
+ }
+ return Object(u.d)(t, r), t;
+ }(D.a), dn = function() {
+ this.rootNodes = [], this.skeletons = [], this.animationGroups = [];
+ }, Un = function(r) {
+ function t(e) {
+ var n = r.call(this) || this;
+ return n._wasAddedToScene = !1, n.scene = e, n.sounds = [], n.effectLayers = [], n.layers = [], n.lensFlareSystems = [], n.proceduralTextures = [], n.reflectionProbes = [], e.onDisposeObservable.add(function() {
+ n._wasAddedToScene || n.dispose();
+ }), n;
+ }
+ return Object(u.d)(t, r), t.prototype.instantiateModelsToScene = function(e, n) {
+ var i = this;
+ n === void 0 && (n = !1);
+ var o = {}, a = {}, s = new dn(), p = [], m = [], S = { doNotInstantiate: !0 }, O = function(I, G) {
+ if (o[I.uniqueId] = G.uniqueId, a[G.uniqueId] = G, e && (G.name = e(I.name)), G instanceof we.a) {
+ var k = G;
+ if (k.morphTargetManager) {
+ var K = I.morphTargetManager;
+ k.morphTargetManager = K.clone();
+ for (var re = 0; re < K.numTargets; re++) {
+ var se = K.getTarget(re), ue = k.morphTargetManager.getTarget(re);
+ o[se.uniqueId] = ue.uniqueId, a[ue.uniqueId] = ue;
+ }
+ }
+ }
+ };
+ return this.transformNodes.forEach(function(I) {
+ if (!I.parent) {
+ var G = I.instantiateHierarchy(null, S, function(k, K) {
+ O(k, K);
+ });
+ G && s.rootNodes.push(G);
+ }
+ }), this.meshes.forEach(function(I) {
+ if (!I.parent) {
+ var G = I.instantiateHierarchy(null, S, function(k, K) {
+ if (O(k, K), K.material) {
+ var re = K;
+ if (re.material)
+ if (n) {
+ var se = k.material;
+ if (m.indexOf(se) === -1) {
+ var ue = se.clone(e ? e(se.name) : "Clone of " + se.name);
+ if (m.push(se), o[se.uniqueId] = ue.uniqueId, a[ue.uniqueId] = ue, se.getClassName() === "MultiMaterial") {
+ for (var he = se, pe = 0, ve = he.subMaterials; pe < ve.length; pe++) {
+ var Ee = ve[pe];
+ Ee && (ue = Ee.clone(e ? e(Ee.name) : "Clone of " + Ee.name), m.push(Ee), o[Ee.uniqueId] = ue.uniqueId, a[ue.uniqueId] = ue);
+ }
+ he.subMaterials = he.subMaterials.map(function(Ae) {
+ return Ae && a[o[Ae.uniqueId]];
+ });
+ }
+ }
+ re.material = a[o[se.uniqueId]];
+ } else
+ re.material.getClassName() === "MultiMaterial" ? i.scene.multiMaterials.indexOf(re.material) === -1 && i.scene.addMultiMaterial(re.material) : i.scene.materials.indexOf(re.material) === -1 && i.scene.addMaterial(re.material);
+ }
+ });
+ G && s.rootNodes.push(G);
+ }
+ }), this.skeletons.forEach(function(I) {
+ var G = I.clone(e ? e(I.name) : "Clone of " + I.name);
+ I.overrideMesh && (G.overrideMesh = a[o[I.overrideMesh.uniqueId]]);
+ for (var k = 0, K = i.meshes; k < K.length; k++) {
+ var re = K[k];
+ if (re.skeleton === I && !re.isAnInstance) {
+ if (a[o[re.uniqueId]].skeleton = G, p.indexOf(G) !== -1)
+ continue;
+ p.push(G);
+ for (var se = 0, ue = G.bones; se < ue.length; se++) {
+ var he = ue[se];
+ he._linkedTransformNode && (he._linkedTransformNode = a[o[he._linkedTransformNode.uniqueId]]);
+ }
+ }
+ }
+ s.skeletons.push(G);
+ }), this.animationGroups.forEach(function(I) {
+ var G = I.clone(I.name, function(k) {
+ return a[o[k.uniqueId]] || k;
+ });
+ s.animationGroups.push(G);
+ }), s;
+ }, t.prototype.addAllToScene = function() {
+ var e = this;
+ this._wasAddedToScene = !0, this.cameras.forEach(function(o) {
+ e.scene.addCamera(o);
+ }), this.lights.forEach(function(o) {
+ e.scene.addLight(o);
+ }), this.meshes.forEach(function(o) {
+ e.scene.addMesh(o);
+ }), this.skeletons.forEach(function(o) {
+ e.scene.addSkeleton(o);
+ }), this.animations.forEach(function(o) {
+ e.scene.addAnimation(o);
+ }), this.animationGroups.forEach(function(o) {
+ e.scene.addAnimationGroup(o);
+ }), this.multiMaterials.forEach(function(o) {
+ e.scene.addMultiMaterial(o);
+ }), this.materials.forEach(function(o) {
+ e.scene.addMaterial(o);
+ }), this.morphTargetManagers.forEach(function(o) {
+ e.scene.addMorphTargetManager(o);
+ }), this.geometries.forEach(function(o) {
+ e.scene.addGeometry(o);
+ }), this.transformNodes.forEach(function(o) {
+ e.scene.addTransformNode(o);
+ }), this.actionManagers.forEach(function(o) {
+ e.scene.addActionManager(o);
+ }), this.textures.forEach(function(o) {
+ e.scene.addTexture(o);
+ }), this.reflectionProbes.forEach(function(o) {
+ e.scene.addReflectionProbe(o);
+ }), this.environmentTexture && (this.scene.environmentTexture = this.environmentTexture);
+ for (var n = 0, i = this.scene._serializableComponents; n < i.length; n++)
+ i[n].addFromContainer(this);
+ }, t.prototype.removeAllFromScene = function() {
+ var e = this;
+ this._wasAddedToScene = !1, this.cameras.forEach(function(o) {
+ e.scene.removeCamera(o);
+ }), this.lights.forEach(function(o) {
+ e.scene.removeLight(o);
+ }), this.meshes.forEach(function(o) {
+ e.scene.removeMesh(o);
+ }), this.skeletons.forEach(function(o) {
+ e.scene.removeSkeleton(o);
+ }), this.animations.forEach(function(o) {
+ e.scene.removeAnimation(o);
+ }), this.animationGroups.forEach(function(o) {
+ e.scene.removeAnimationGroup(o);
+ }), this.multiMaterials.forEach(function(o) {
+ e.scene.removeMultiMaterial(o);
+ }), this.materials.forEach(function(o) {
+ e.scene.removeMaterial(o);
+ }), this.morphTargetManagers.forEach(function(o) {
+ e.scene.removeMorphTargetManager(o);
+ }), this.geometries.forEach(function(o) {
+ e.scene.removeGeometry(o);
+ }), this.transformNodes.forEach(function(o) {
+ e.scene.removeTransformNode(o);
+ }), this.actionManagers.forEach(function(o) {
+ e.scene.removeActionManager(o);
+ }), this.textures.forEach(function(o) {
+ e.scene.removeTexture(o);
+ }), this.reflectionProbes.forEach(function(o) {
+ e.scene.removeReflectionProbe(o);
+ }), this.environmentTexture === this.scene.environmentTexture && (this.scene.environmentTexture = null);
+ for (var n = 0, i = this.scene._serializableComponents; n < i.length; n++)
+ i[n].removeFromContainer(this);
+ }, t.prototype.dispose = function() {
+ this.cameras.forEach(function(i) {
+ i.dispose();
+ }), this.cameras = [], this.lights.forEach(function(i) {
+ i.dispose();
+ }), this.lights = [], this.meshes.forEach(function(i) {
+ i.dispose();
+ }), this.meshes = [], this.skeletons.forEach(function(i) {
+ i.dispose();
+ }), this.skeletons = [], this.animationGroups.forEach(function(i) {
+ i.dispose();
+ }), this.animationGroups = [], this.multiMaterials.forEach(function(i) {
+ i.dispose();
+ }), this.multiMaterials = [], this.materials.forEach(function(i) {
+ i.dispose();
+ }), this.materials = [], this.geometries.forEach(function(i) {
+ i.dispose();
+ }), this.geometries = [], this.transformNodes.forEach(function(i) {
+ i.dispose();
+ }), this.transformNodes = [], this.actionManagers.forEach(function(i) {
+ i.dispose();
+ }), this.actionManagers = [], this.textures.forEach(function(i) {
+ i.dispose();
+ }), this.textures = [], this.reflectionProbes.forEach(function(i) {
+ i.dispose();
+ }), this.reflectionProbes = [], this.environmentTexture && (this.environmentTexture.dispose(), this.environmentTexture = null);
+ for (var e = 0, n = this.scene._serializableComponents; e < n.length; e++)
+ n[e].removeFromContainer(this, !0);
+ }, t.prototype._moveAssets = function(e, n, i) {
+ if (e)
+ for (var o = 0, a = e; o < a.length; o++) {
+ var s = a[o], p = !0;
+ if (i) {
+ for (var m = 0, S = i; m < S.length; m++)
+ if (s === S[m]) {
+ p = !1;
+ break;
+ }
+ }
+ p && n.push(s);
+ }
+ }, t.prototype.moveAllFromScene = function(e) {
+ for (var n in this._wasAddedToScene = !1, e === void 0 && (e = new Bn()), this)
+ this.hasOwnProperty(n) && (this[n] = this[n] || (n === "environmentTexture" ? null : []), this._moveAssets(this.scene[n], this[n], e[n]));
+ this.environmentTexture = this.scene.environmentTexture, this.removeAllFromScene();
+ }, t.prototype.createRootMesh = function() {
+ var e = new we.a("assetContainerRootMesh", this.scene);
+ return this.meshes.forEach(function(n) {
+ n.parent || e.addChild(n);
+ }), this.meshes.unshift(e), e;
+ }, t.prototype.mergeAnimationsTo = function(e, n, i) {
+ if (e === void 0 && (e = te.a.LastCreatedScene), i === void 0 && (i = null), !e)
+ return h.a.Error("No scene available to merge animations to"), [];
+ var o = i || function(s) {
+ var p = null, m = s.animations.length ? s.animations[0].targetProperty : "", S = s.name.split(".").join("").split("_primitive")[0];
+ switch (m) {
+ case "position":
+ case "rotationQuaternion":
+ p = e.getTransformNodeByName(s.name) || e.getTransformNodeByName(S);
+ break;
+ case "influence":
+ p = e.getMorphTargetByName(s.name) || e.getMorphTargetByName(S);
+ break;
+ default:
+ p = e.getNodeByName(s.name) || e.getNodeByName(S);
+ }
+ return p;
+ };
+ this.getNodes().forEach(function(s) {
+ var p = o(s);
+ if (p !== null) {
+ for (var m = function(I) {
+ for (var G = 0, k = p.animations.filter(function(se) {
+ return se.targetProperty === I.targetProperty;
+ }); G < k.length; G++) {
+ var K = k[G], re = p.animations.indexOf(K, 0);
+ re > -1 && p.animations.splice(re, 1);
+ }
+ }, S = 0, O = s.animations; S < O.length; S++)
+ m(O[S]);
+ p.animations = p.animations.concat(s.animations);
+ }
+ });
+ var a = new Array();
+ return this.animationGroups.slice().forEach(function(s) {
+ a.push(s.clone(s.name, o)), s.animatables.forEach(function(p) {
+ p.stop();
+ });
+ }), n.forEach(function(s) {
+ var p = o(s.target);
+ p && (e.beginAnimation(p, s.fromFrame, s.toFrame, s.loopAnimation, s.speedRatio, s.onAnimationEnd ? s.onAnimationEnd : void 0, void 0, !0, void 0, s.onAnimationLoop ? s.onAnimationLoop : void 0), e.stopAnimation(s.target));
+ }), a;
+ }, t;
+ }(D.a), ke = l(13), Vn = function() {
+ function r(t) {
+ this.SMOOTHING = 0.75, this.FFT_SIZE = 512, this.BARGRAPHAMPLITUDE = 256, this.DEBUGCANVASPOS = { x: 20, y: 20 }, this.DEBUGCANVASSIZE = { width: 320, height: 200 }, this._scene = t, this._audioEngine = ke.a.audioEngine, this._audioEngine.canUseWebAudio && this._audioEngine.audioContext && (this._webAudioAnalyser = this._audioEngine.audioContext.createAnalyser(), this._webAudioAnalyser.minDecibels = -140, this._webAudioAnalyser.maxDecibels = 0, this._byteFreqs = new Uint8Array(this._webAudioAnalyser.frequencyBinCount), this._byteTime = new Uint8Array(this._webAudioAnalyser.frequencyBinCount), this._floatFreqs = new Float32Array(this._webAudioAnalyser.frequencyBinCount));
+ }
+ return r.prototype.getFrequencyBinCount = function() {
+ return this._audioEngine.canUseWebAudio ? this._webAudioAnalyser.frequencyBinCount : 0;
+ }, r.prototype.getByteFrequencyData = function() {
+ return this._audioEngine.canUseWebAudio && (this._webAudioAnalyser.smoothingTimeConstant = this.SMOOTHING, this._webAudioAnalyser.fftSize = this.FFT_SIZE, this._webAudioAnalyser.getByteFrequencyData(this._byteFreqs)), this._byteFreqs;
+ }, r.prototype.getByteTimeDomainData = function() {
+ return this._audioEngine.canUseWebAudio && (this._webAudioAnalyser.smoothingTimeConstant = this.SMOOTHING, this._webAudioAnalyser.fftSize = this.FFT_SIZE, this._webAudioAnalyser.getByteTimeDomainData(this._byteTime)), this._byteTime;
+ }, r.prototype.getFloatFrequencyData = function() {
+ return this._audioEngine.canUseWebAudio && (this._webAudioAnalyser.smoothingTimeConstant = this.SMOOTHING, this._webAudioAnalyser.fftSize = this.FFT_SIZE, this._webAudioAnalyser.getFloatFrequencyData(this._floatFreqs)), this._floatFreqs;
+ }, r.prototype.drawDebugCanvas = function() {
+ var t = this;
+ if (this._audioEngine.canUseWebAudio && (this._debugCanvas || (this._debugCanvas = document.createElement("canvas"), this._debugCanvas.width = this.DEBUGCANVASSIZE.width, this._debugCanvas.height = this.DEBUGCANVASSIZE.height, this._debugCanvas.style.position = "absolute", this._debugCanvas.style.top = this.DEBUGCANVASPOS.y + "px", this._debugCanvas.style.left = this.DEBUGCANVASPOS.x + "px", this._debugCanvasContext = this._debugCanvas.getContext("2d"), document.body.appendChild(this._debugCanvas), this._registerFunc = function() {
+ t.drawDebugCanvas();
+ }, this._scene.registerBeforeRender(this._registerFunc)), this._registerFunc && this._debugCanvasContext)) {
+ var e = this.getByteFrequencyData();
+ this._debugCanvasContext.fillStyle = "rgb(0, 0, 0)", this._debugCanvasContext.fillRect(0, 0, this.DEBUGCANVASSIZE.width, this.DEBUGCANVASSIZE.height);
+ for (var n = 0; n < this.getFrequencyBinCount(); n++) {
+ var i = e[n] / this.BARGRAPHAMPLITUDE, o = this.DEBUGCANVASSIZE.height * i, a = this.DEBUGCANVASSIZE.height - o - 1, s = this.DEBUGCANVASSIZE.width / this.getFrequencyBinCount(), p = n / this.getFrequencyBinCount() * 360;
+ this._debugCanvasContext.fillStyle = "hsl(" + p + ", 100%, 50%)", this._debugCanvasContext.fillRect(n * s, a, s, o);
+ }
+ }
+ }, r.prototype.stopDebugCanvas = function() {
+ this._debugCanvas && (this._registerFunc && (this._scene.unregisterBeforeRender(this._registerFunc), this._registerFunc = null), document.body.removeChild(this._debugCanvas), this._debugCanvas = null, this._debugCanvasContext = null);
+ }, r.prototype.connectAudioNodes = function(t, e) {
+ this._audioEngine.canUseWebAudio && (t.connect(this._webAudioAnalyser), this._webAudioAnalyser.connect(e));
+ }, r.prototype.dispose = function() {
+ this._audioEngine.canUseWebAudio && this._webAudioAnalyser.disconnect();
+ }, r;
+ }();
+ ke.a.AudioEngineFactory = function(r) {
+ return new po(r);
+ };
+ var po = function() {
+ function r(t) {
+ var e = this;
+ t === void 0 && (t = null), this._audioContext = null, this._audioContextInitialized = !1, this._muteButton = null, this.canUseWebAudio = !1, this.WarnedWebAudioUnsupported = !1, this.isMP3supported = !1, this.isOGGsupported = !1, this.unlocked = !0, this.useCustomUnlockedButton = !1, this.onAudioUnlockedObservable = new P.c(), this.onAudioLockedObservable = new P.c(), this._tryToRun = !1, this._onResize = function() {
+ e._moveButtonToTopLeft();
+ }, window.AudioContext === void 0 && window.webkitAudioContext === void 0 || (window.AudioContext = window.AudioContext || window.webkitAudioContext, this.canUseWebAudio = !0);
+ var n = document.createElement("audio");
+ this._hostElement = t;
+ try {
+ n && n.canPlayType && (n.canPlayType('audio/mpeg; codecs="mp3"').replace(/^no$/, "") || n.canPlayType("audio/mp3").replace(/^no$/, "")) && (this.isMP3supported = !0);
+ } catch {
+ }
+ try {
+ n && n.canPlayType && n.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, "") && (this.isOGGsupported = !0);
+ } catch {
+ }
+ }
+ return Object.defineProperty(r.prototype, "audioContext", { get: function() {
+ return this._audioContextInitialized ? this.unlocked || this._muteButton || this._displayMuteButton() : this._initializeAudioContext(), this._audioContext;
+ }, enumerable: !1, configurable: !0 }), r.prototype.lock = function() {
+ this._triggerSuspendedState();
+ }, r.prototype.unlock = function() {
+ this._triggerRunningState();
+ }, r.prototype._resumeAudioContext = function() {
+ var t;
+ return this._audioContext.resume !== void 0 && (t = this._audioContext.resume()), t || Promise.resolve();
+ }, r.prototype._initializeAudioContext = function() {
+ try {
+ this.canUseWebAudio && (this._audioContext = new AudioContext(), this.masterGain = this._audioContext.createGain(), this.masterGain.gain.value = 1, this.masterGain.connect(this._audioContext.destination), this._audioContextInitialized = !0, this._audioContext.state === "running" && this._triggerRunningState());
+ } catch (t) {
+ this.canUseWebAudio = !1, h.a.Error("Web Audio: " + t.message);
+ }
+ }, r.prototype._triggerRunningState = function() {
+ var t = this;
+ this._tryToRun || (this._tryToRun = !0, this._resumeAudioContext().then(function() {
+ t._tryToRun = !1, t._muteButton && t._hideMuteButton(), t.unlocked = !0, t.onAudioUnlockedObservable.notifyObservers(t);
+ }).catch(function() {
+ t._tryToRun = !1, t.unlocked = !1;
+ }));
+ }, r.prototype._triggerSuspendedState = function() {
+ this.unlocked = !1, this.onAudioLockedObservable.notifyObservers(this), this._displayMuteButton();
+ }, r.prototype._displayMuteButton = function() {
+ var t = this;
+ if (!this.useCustomUnlockedButton && !this._muteButton) {
+ this._muteButton = document.createElement("BUTTON"), this._muteButton.className = "babylonUnmuteIcon", this._muteButton.id = "babylonUnmuteIconBtn", this._muteButton.title = "Unmute";
+ var e = ".babylonUnmuteIcon { position: absolute; left: 20px; top: 20px; height: 40px; width: 60px; background-color: rgba(51,51,51,0.7); background-image: url(" + (window.SVGSVGElement ? "data:image/svg+xml;charset=UTF-8,%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2239%22%20height%3D%2232%22%20viewBox%3D%220%200%2039%2032%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22M9.625%2018.938l-0.031%200.016h-4.953q-0.016%200-0.031-0.016v-12.453q0-0.016%200.031-0.016h4.953q0.031%200%200.031%200.016v12.453zM12.125%207.688l8.719-8.703v27.453l-8.719-8.719-0.016-0.047v-9.938zM23.359%207.875l1.406-1.406%204.219%204.203%204.203-4.203%201.422%201.406-4.219%204.219%204.219%204.203-1.484%201.359-4.141-4.156-4.219%204.219-1.406-1.422%204.219-4.203z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E" : "https://cdn.babylonjs.com/Assets/audio.png") + "); background-size: 80%; background-repeat:no-repeat; background-position: center; background-position-y: 4px; border: none; outline: none; transition: transform 0.125s ease-out; cursor: pointer; z-index: 9999; } .babylonUnmuteIcon:hover { transform: scale(1.05) } .babylonUnmuteIcon:active { background-color: rgba(51,51,51,1) }", n = document.createElement("style");
+ n.appendChild(document.createTextNode(e)), document.getElementsByTagName("head")[0].appendChild(n), document.body.appendChild(this._muteButton), this._moveButtonToTopLeft(), this._muteButton.addEventListener("touchend", function() {
+ t._triggerRunningState();
+ }, !0), this._muteButton.addEventListener("click", function() {
+ t._triggerRunningState();
+ }, !0), window.addEventListener("resize", this._onResize);
+ }
+ }, r.prototype._moveButtonToTopLeft = function() {
+ this._hostElement && this._muteButton && (this._muteButton.style.top = this._hostElement.offsetTop + 20 + "px", this._muteButton.style.left = this._hostElement.offsetLeft + 20 + "px");
+ }, r.prototype._hideMuteButton = function() {
+ this._muteButton && (document.body.removeChild(this._muteButton), this._muteButton = null);
+ }, r.prototype.dispose = function() {
+ this.canUseWebAudio && this._audioContextInitialized && (this._connectedAnalyser && this._audioContext && (this._connectedAnalyser.stopDebugCanvas(), this._connectedAnalyser.dispose(), this.masterGain.disconnect(), this.masterGain.connect(this._audioContext.destination), this._connectedAnalyser = null), this.masterGain.gain.value = 1), this.WarnedWebAudioUnsupported = !1, this._hideMuteButton(), window.removeEventListener("resize", this._onResize), this.onAudioUnlockedObservable.clear(), this.onAudioLockedObservable.clear();
+ }, r.prototype.getGlobalVolume = function() {
+ return this.canUseWebAudio && this._audioContextInitialized ? this.masterGain.gain.value : -1;
+ }, r.prototype.setGlobalVolume = function(t) {
+ this.canUseWebAudio && this._audioContextInitialized && (this.masterGain.gain.value = t);
+ }, r.prototype.connectToAnalyser = function(t) {
+ this._connectedAnalyser && this._connectedAnalyser.stopDebugCanvas(), this.canUseWebAudio && this._audioContextInitialized && this._audioContext && (this._connectedAnalyser = t, this.masterGain.disconnect(), this._connectedAnalyser.connectAudioNodes(this.masterGain, this._audioContext.destination));
+ }, r;
+ }(), Ke = l(12), Nn = l(21), yi = function() {
+ function r(t, e, n, i, o) {
+ var a, s, p, m, S = this;
+ if (i === void 0 && (i = null), this.autoplay = !1, this.loop = !1, this.useCustomAttenuation = !1, this.isPlaying = !1, this.isPaused = !1, this.spatialSound = !1, this.refDistance = 1, this.rolloffFactor = 1, this.maxDistance = 100, this.distanceModel = "linear", this.metadata = null, this.onEndedObservable = new P.c(), this._panningModel = "equalpower", this._playbackRate = 1, this._streaming = !1, this._startTime = 0, this._startOffset = 0, this._position = c.e.Zero(), this._positionInEmitterSpace = !1, this._localDirection = new c.e(1, 0, 0), this._volume = 1, this._isReadyToPlay = !1, this._isDirectional = !1, this._coneInnerAngle = 360, this._coneOuterAngle = 360, this._coneOuterGain = 0, this._isOutputConnected = !1, this._urlType = "Unknown", this.name = t, this._scene = n, r._SceneComponentInitialization(n), this._readyToPlayCallback = i, this._customAttenuationFunction = function(re, se, ue, he, pe) {
+ return se < ue ? re * (1 - se / ue) : 0;
+ }, o && (this.autoplay = o.autoplay || !1, this.loop = o.loop || !1, o.volume !== void 0 && (this._volume = o.volume), this.spatialSound = (a = o.spatialSound) !== null && a !== void 0 && a, this.maxDistance = (s = o.maxDistance) !== null && s !== void 0 ? s : 100, this.useCustomAttenuation = (p = o.useCustomAttenuation) !== null && p !== void 0 && p, this.rolloffFactor = o.rolloffFactor || 1, this.refDistance = o.refDistance || 1, this.distanceModel = o.distanceModel || "linear", this._playbackRate = o.playbackRate || 1, this._streaming = (m = o.streaming) !== null && m !== void 0 && m, this._length = o.length, this._offset = o.offset), ke.a.audioEngine.canUseWebAudio && ke.a.audioEngine.audioContext) {
+ this._soundGain = ke.a.audioEngine.audioContext.createGain(), this._soundGain.gain.value = this._volume, this._inputAudioNode = this._soundGain, this._outputAudioNode = this._soundGain, this.spatialSound && this._createSpatialParameters(), this._scene.mainSoundTrack.addSound(this);
+ var O = !0;
+ if (e)
+ try {
+ typeof e == "string" ? this._urlType = "String" : e instanceof ArrayBuffer ? this._urlType = "ArrayBuffer" : e instanceof MediaStream ? this._urlType = "MediaStream" : Array.isArray(e) && (this._urlType = "Array");
+ var I = [], G = !1;
+ switch (this._urlType) {
+ case "MediaStream":
+ this._streaming = !0, this._isReadyToPlay = !0, this._streamingSource = ke.a.audioEngine.audioContext.createMediaStreamSource(e), this.autoplay && this.play(0, this._offset, this._length), this._readyToPlayCallback && this._readyToPlayCallback();
+ break;
+ case "ArrayBuffer":
+ e.byteLength > 0 && (G = !0, this._soundLoaded(e));
+ break;
+ case "String":
+ I.push(e);
+ case "Array":
+ I.length === 0 && (I = e);
+ for (var k = 0; k < I.length; k++) {
+ var K = I[k];
+ if (G = o && o.skipCodecCheck || K.indexOf(".mp3", K.length - 4) !== -1 && ke.a.audioEngine.isMP3supported || K.indexOf(".ogg", K.length - 4) !== -1 && ke.a.audioEngine.isOGGsupported || K.indexOf(".wav", K.length - 4) !== -1 || K.indexOf(".m4a", K.length - 4) !== -1 || K.indexOf("blob:") !== -1) {
+ this._streaming ? (this._htmlAudioElement = new Audio(K), this._htmlAudioElement.controls = !1, this._htmlAudioElement.loop = this.loop, Ke.b.SetCorsBehavior(K, this._htmlAudioElement), this._htmlAudioElement.preload = "auto", this._htmlAudioElement.addEventListener("canplaythrough", function() {
+ S._isReadyToPlay = !0, S.autoplay && S.play(0, S._offset, S._length), S._readyToPlayCallback && S._readyToPlayCallback();
+ }), document.body.appendChild(this._htmlAudioElement), this._htmlAudioElement.load()) : this._scene._loadFile(K, function(re) {
+ S._soundLoaded(re);
+ }, void 0, !0, !0, function(re) {
+ re && h.a.Error("XHR " + re.status + " error on: " + K + "."), h.a.Error("Sound creation aborted."), S._scene.mainSoundTrack.removeSound(S);
+ });
+ break;
+ }
+ }
+ break;
+ default:
+ O = !1;
+ }
+ O ? G || (this._isReadyToPlay = !0, this._readyToPlayCallback && window.setTimeout(function() {
+ S._readyToPlayCallback && S._readyToPlayCallback();
+ }, 1e3)) : h.a.Error("Parameter must be a URL to the sound, an Array of URLs (.mp3 & .ogg) or an ArrayBuffer of the sound.");
+ } catch {
+ h.a.Error("Unexpected error. Sound creation aborted."), this._scene.mainSoundTrack.removeSound(this);
+ }
+ } else
+ this._scene.mainSoundTrack.addSound(this), ke.a.audioEngine.WarnedWebAudioUnsupported || (h.a.Error("Web Audio is not supported by your browser."), ke.a.audioEngine.WarnedWebAudioUnsupported = !0), this._readyToPlayCallback && window.setTimeout(function() {
+ S._readyToPlayCallback && S._readyToPlayCallback();
+ }, 1e3);
+ }
+ return Object.defineProperty(r.prototype, "currentTime", { get: function() {
+ if (this._htmlAudioElement)
+ return this._htmlAudioElement.currentTime;
+ var t = this._startOffset;
+ return this.isPlaying && ke.a.audioEngine.audioContext && (t += ke.a.audioEngine.audioContext.currentTime - this._startTime), t;
+ }, enumerable: !1, configurable: !0 }), r.prototype.dispose = function() {
+ ke.a.audioEngine.canUseWebAudio && (this.isPlaying && this.stop(), this._isReadyToPlay = !1, this.soundTrackId === -1 ? this._scene.mainSoundTrack.removeSound(this) : this._scene.soundTracks && this._scene.soundTracks[this.soundTrackId].removeSound(this), this._soundGain && (this._soundGain.disconnect(), this._soundGain = null), this._soundPanner && (this._soundPanner.disconnect(), this._soundPanner = null), this._soundSource && (this._soundSource.disconnect(), this._soundSource = null), this._audioBuffer = null, this._htmlAudioElement && (this._htmlAudioElement.pause(), this._htmlAudioElement.src = "", document.body.removeChild(this._htmlAudioElement)), this._streamingSource && this._streamingSource.disconnect(), this._connectedTransformNode && this._registerFunc && (this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc), this._connectedTransformNode = null));
+ }, r.prototype.isReady = function() {
+ return this._isReadyToPlay;
+ }, r.prototype._soundLoaded = function(t) {
+ var e = this;
+ ke.a.audioEngine.audioContext && ke.a.audioEngine.audioContext.decodeAudioData(t, function(n) {
+ e._audioBuffer = n, e._isReadyToPlay = !0, e.autoplay && e.play(0, e._offset, e._length), e._readyToPlayCallback && e._readyToPlayCallback();
+ }, function(n) {
+ h.a.Error("Error while decoding audio data for: " + e.name + " / Error: " + n);
+ });
+ }, r.prototype.setAudioBuffer = function(t) {
+ ke.a.audioEngine.canUseWebAudio && (this._audioBuffer = t, this._isReadyToPlay = !0);
+ }, r.prototype.updateOptions = function(t) {
+ var e, n, i, o, a, s, p, m, S;
+ t && (this.loop = (e = t.loop) !== null && e !== void 0 ? e : this.loop, this.maxDistance = (n = t.maxDistance) !== null && n !== void 0 ? n : this.maxDistance, this.useCustomAttenuation = (i = t.useCustomAttenuation) !== null && i !== void 0 ? i : this.useCustomAttenuation, this.rolloffFactor = (o = t.rolloffFactor) !== null && o !== void 0 ? o : this.rolloffFactor, this.refDistance = (a = t.refDistance) !== null && a !== void 0 ? a : this.refDistance, this.distanceModel = (s = t.distanceModel) !== null && s !== void 0 ? s : this.distanceModel, this._playbackRate = (p = t.playbackRate) !== null && p !== void 0 ? p : this._playbackRate, this._length = (m = t.length) !== null && m !== void 0 ? m : void 0, this._offset = (S = t.offset) !== null && S !== void 0 ? S : void 0, this._updateSpatialParameters(), this.isPlaying && (this._streaming && this._htmlAudioElement ? (this._htmlAudioElement.playbackRate = this._playbackRate, this._htmlAudioElement.loop !== this.loop && (this._htmlAudioElement.loop = this.loop)) : this._soundSource && (this._soundSource.playbackRate.value = this._playbackRate, this._soundSource.loop !== this.loop && (this._soundSource.loop = this.loop), this._offset !== void 0 && this._soundSource.loopStart !== this._offset && (this._soundSource.loopStart = this._offset), this._length !== void 0 && this._length !== this._soundSource.loopEnd && (this._soundSource.loopEnd = (0 | this._offset) + this._length))));
+ }, r.prototype._createSpatialParameters = function() {
+ ke.a.audioEngine.canUseWebAudio && ke.a.audioEngine.audioContext && (this._scene.headphone && (this._panningModel = "HRTF"), this._soundPanner = ke.a.audioEngine.audioContext.createPanner(), this._soundPanner && this._outputAudioNode && (this._updateSpatialParameters(), this._soundPanner.connect(this._outputAudioNode), this._inputAudioNode = this._soundPanner));
+ }, r.prototype._updateSpatialParameters = function() {
+ this.spatialSound && this._soundPanner && (this.useCustomAttenuation ? (this._soundPanner.distanceModel = "linear", this._soundPanner.maxDistance = Number.MAX_VALUE, this._soundPanner.refDistance = 1, this._soundPanner.rolloffFactor = 1, this._soundPanner.panningModel = this._panningModel) : (this._soundPanner.distanceModel = this.distanceModel, this._soundPanner.maxDistance = this.maxDistance, this._soundPanner.refDistance = this.refDistance, this._soundPanner.rolloffFactor = this.rolloffFactor, this._soundPanner.panningModel = this._panningModel));
+ }, r.prototype.switchPanningModelToHRTF = function() {
+ this._panningModel = "HRTF", this._switchPanningModel();
+ }, r.prototype.switchPanningModelToEqualPower = function() {
+ this._panningModel = "equalpower", this._switchPanningModel();
+ }, r.prototype._switchPanningModel = function() {
+ ke.a.audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner && (this._soundPanner.panningModel = this._panningModel);
+ }, r.prototype.connectToSoundTrackAudioNode = function(t) {
+ ke.a.audioEngine.canUseWebAudio && this._outputAudioNode && (this._isOutputConnected && this._outputAudioNode.disconnect(), this._outputAudioNode.connect(t), this._isOutputConnected = !0);
+ }, r.prototype.setDirectionalCone = function(t, e, n) {
+ e < t ? h.a.Error("setDirectionalCone(): outer angle of the cone must be superior or equal to the inner angle.") : (this._coneInnerAngle = t, this._coneOuterAngle = e, this._coneOuterGain = n, this._isDirectional = !0, this.isPlaying && this.loop && (this.stop(), this.play(0, this._offset, this._length)));
+ }, Object.defineProperty(r.prototype, "directionalConeInnerAngle", { get: function() {
+ return this._coneInnerAngle;
+ }, set: function(t) {
+ if (t != this._coneInnerAngle) {
+ if (this._coneOuterAngle < t)
+ return void h.a.Error("directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle.");
+ this._coneInnerAngle = t, ke.a.audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner && (this._soundPanner.coneInnerAngle = this._coneInnerAngle);
+ }
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "directionalConeOuterAngle", { get: function() {
+ return this._coneOuterAngle;
+ }, set: function(t) {
+ if (t != this._coneOuterAngle) {
+ if (t < this._coneInnerAngle)
+ return void h.a.Error("directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle.");
+ this._coneOuterAngle = t, ke.a.audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner && (this._soundPanner.coneOuterAngle = this._coneOuterAngle);
+ }
+ }, enumerable: !1, configurable: !0 }), r.prototype.setPosition = function(t) {
+ this._position = t, ke.a.audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner && !isNaN(this._position.x) && !isNaN(this._position.y) && !isNaN(this._position.z) && this._soundPanner.setPosition(this._position.x, this._position.y, this._position.z);
+ }, r.prototype.setLocalDirectionToMesh = function(t) {
+ this._localDirection = t, ke.a.audioEngine.canUseWebAudio && this._connectedTransformNode && this.isPlaying && this._updateDirection();
+ }, r.prototype._updateDirection = function() {
+ if (this._connectedTransformNode && this._soundPanner) {
+ var t = this._connectedTransformNode.getWorldMatrix(), e = c.e.TransformNormal(this._localDirection, t);
+ e.normalize(), this._soundPanner.setOrientation(e.x, e.y, e.z);
+ }
+ }, r.prototype.updateDistanceFromListener = function() {
+ if (ke.a.audioEngine.canUseWebAudio && this._connectedTransformNode && this.useCustomAttenuation && this._soundGain && this._scene.activeCamera) {
+ var t = this._connectedTransformNode.getDistanceToCamera(this._scene.activeCamera);
+ this._soundGain.gain.value = this._customAttenuationFunction(this._volume, t, this.maxDistance, this.refDistance, this.rolloffFactor);
+ }
+ }, r.prototype.setAttenuationFunction = function(t) {
+ this._customAttenuationFunction = t;
+ }, r.prototype.play = function(t, e, n) {
+ var i = this;
+ if (this._isReadyToPlay && this._scene.audioEnabled && ke.a.audioEngine.audioContext)
+ try {
+ this._startOffset < 0 && (t = -this._startOffset, this._startOffset = 0);
+ var o = t ? ke.a.audioEngine.audioContext.currentTime + t : ke.a.audioEngine.audioContext.currentTime;
+ if (this._soundSource && this._streamingSource || this.spatialSound && this._soundPanner && (isNaN(this._position.x) || isNaN(this._position.y) || isNaN(this._position.z) || this._soundPanner.setPosition(this._position.x, this._position.y, this._position.z), this._isDirectional && (this._soundPanner.coneInnerAngle = this._coneInnerAngle, this._soundPanner.coneOuterAngle = this._coneOuterAngle, this._soundPanner.coneOuterGain = this._coneOuterGain, this._connectedTransformNode ? this._updateDirection() : this._soundPanner.setOrientation(this._localDirection.x, this._localDirection.y, this._localDirection.z))), this._streaming)
+ this._streamingSource || (this._streamingSource = ke.a.audioEngine.audioContext.createMediaElementSource(this._htmlAudioElement), this._htmlAudioElement.onended = function() {
+ i._onended();
+ }, this._htmlAudioElement.playbackRate = this._playbackRate), this._streamingSource.disconnect(), this._inputAudioNode && this._streamingSource.connect(this._inputAudioNode), this._htmlAudioElement && (a = function() {
+ if (ke.a.audioEngine.unlocked) {
+ var s = i._htmlAudioElement.play();
+ s !== void 0 && s.catch(function(p) {
+ ke.a.audioEngine.lock(), (i.loop || i.autoplay) && ke.a.audioEngine.onAudioUnlockedObservable.addOnce(function() {
+ a();
+ });
+ });
+ } else
+ (i.loop || i.autoplay) && ke.a.audioEngine.onAudioUnlockedObservable.addOnce(function() {
+ a();
+ });
+ })();
+ else {
+ var a = function() {
+ if (ke.a.audioEngine.audioContext) {
+ if (n = n || i._length, e = e || i._offset, i._soundSource) {
+ var s = i._soundSource;
+ s.onended = function() {
+ s.disconnect();
+ };
+ }
+ if (i._soundSource = ke.a.audioEngine.audioContext.createBufferSource(), i._soundSource && i._inputAudioNode) {
+ i._soundSource.buffer = i._audioBuffer, i._soundSource.connect(i._inputAudioNode), i._soundSource.loop = i.loop, e !== void 0 && (i._soundSource.loopStart = e), n !== void 0 && (i._soundSource.loopEnd = (0 | e) + n), i._soundSource.playbackRate.value = i._playbackRate, i._soundSource.onended = function() {
+ i._onended();
+ }, o = t ? ke.a.audioEngine.audioContext.currentTime + t : ke.a.audioEngine.audioContext.currentTime;
+ var p = i.isPaused ? i._startOffset % i._soundSource.buffer.duration : e || 0;
+ i._soundSource.start(o, p, i.loop ? void 0 : n);
+ }
+ }
+ };
+ ke.a.audioEngine.audioContext.state === "suspended" ? setTimeout(function() {
+ ke.a.audioEngine.audioContext.state === "suspended" ? (ke.a.audioEngine.lock(), (i.loop || i.autoplay) && ke.a.audioEngine.onAudioUnlockedObservable.addOnce(function() {
+ a();
+ })) : a();
+ }, 500) : a();
+ }
+ this._startTime = o, this.isPlaying = !0, this.isPaused = !1;
+ } catch (s) {
+ h.a.Error("Error while trying to play audio: " + this.name + ", " + s.message);
+ }
+ }, r.prototype._onended = function() {
+ this.isPlaying = !1, this._startOffset = 0, this.onended && this.onended(), this.onEndedObservable.notifyObservers(this);
+ }, r.prototype.stop = function(t) {
+ var e = this;
+ if (this.isPlaying) {
+ if (this._streaming)
+ this._htmlAudioElement ? (this._htmlAudioElement.pause(), this._htmlAudioElement.currentTime > 0 && (this._htmlAudioElement.currentTime = 0)) : this._streamingSource.disconnect(), this.isPlaying = !1;
+ else if (ke.a.audioEngine.audioContext && this._soundSource) {
+ var n = t ? ke.a.audioEngine.audioContext.currentTime + t : ke.a.audioEngine.audioContext.currentTime;
+ this._soundSource.stop(n), this._soundSource.onended = function() {
+ e.isPlaying = !1;
+ }, this.isPaused || (this._startOffset = 0);
+ }
+ }
+ }, r.prototype.pause = function() {
+ this.isPlaying && (this.isPaused = !0, this._streaming ? this._htmlAudioElement ? this._htmlAudioElement.pause() : this._streamingSource.disconnect() : ke.a.audioEngine.audioContext && (this.stop(0), this._startOffset += ke.a.audioEngine.audioContext.currentTime - this._startTime));
+ }, r.prototype.setVolume = function(t, e) {
+ ke.a.audioEngine.canUseWebAudio && this._soundGain && (e && ke.a.audioEngine.audioContext ? (this._soundGain.gain.cancelScheduledValues(ke.a.audioEngine.audioContext.currentTime), this._soundGain.gain.setValueAtTime(this._soundGain.gain.value, ke.a.audioEngine.audioContext.currentTime), this._soundGain.gain.linearRampToValueAtTime(t, ke.a.audioEngine.audioContext.currentTime + e)) : this._soundGain.gain.value = t), this._volume = t;
+ }, r.prototype.setPlaybackRate = function(t) {
+ this._playbackRate = t, this.isPlaying && (this._streaming && this._htmlAudioElement ? this._htmlAudioElement.playbackRate = this._playbackRate : this._soundSource && (this._soundSource.playbackRate.value = this._playbackRate));
+ }, r.prototype.getVolume = function() {
+ return this._volume;
+ }, r.prototype.attachToMesh = function(t) {
+ var e = this;
+ this._connectedTransformNode && this._registerFunc && (this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc), this._registerFunc = null), this._connectedTransformNode = t, this.spatialSound || (this.spatialSound = !0, this._createSpatialParameters(), this.isPlaying && this.loop && (this.stop(), this.play(0, this._offset, this._length))), this._onRegisterAfterWorldMatrixUpdate(this._connectedTransformNode), this._registerFunc = function(n) {
+ return e._onRegisterAfterWorldMatrixUpdate(n);
+ }, this._connectedTransformNode.registerAfterWorldMatrixUpdate(this._registerFunc);
+ }, r.prototype.detachFromMesh = function() {
+ this._connectedTransformNode && this._registerFunc && (this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc), this._registerFunc = null, this._connectedTransformNode = null);
+ }, r.prototype._onRegisterAfterWorldMatrixUpdate = function(t) {
+ if (this._positionInEmitterSpace)
+ t.worldMatrixFromCache.invertToRef(c.c.Matrix[0]), this.setPosition(c.c.Matrix[0].getTranslation());
+ else if (t.getBoundingInfo) {
+ var e = t.getBoundingInfo();
+ this.setPosition(e.boundingSphere.centerWorld);
+ } else
+ this.setPosition(t.absolutePosition);
+ ke.a.audioEngine.canUseWebAudio && this._isDirectional && this.isPlaying && this._updateDirection();
+ }, r.prototype.clone = function() {
+ var t = this;
+ if (this._streaming)
+ return null;
+ var e = function() {
+ t._isReadyToPlay ? (i._audioBuffer = t.getAudioBuffer(), i._isReadyToPlay = !0, i.autoplay && i.play(0, t._offset, t._length)) : window.setTimeout(e, 300);
+ }, n = { autoplay: this.autoplay, loop: this.loop, volume: this._volume, spatialSound: this.spatialSound, maxDistance: this.maxDistance, useCustomAttenuation: this.useCustomAttenuation, rolloffFactor: this.rolloffFactor, refDistance: this.refDistance, distanceModel: this.distanceModel }, i = new r(this.name + "_cloned", new ArrayBuffer(0), this._scene, null, n);
+ return this.useCustomAttenuation && i.setAttenuationFunction(this._customAttenuationFunction), i.setPosition(this._position), i.setPlaybackRate(this._playbackRate), e(), i;
+ }, r.prototype.getAudioBuffer = function() {
+ return this._audioBuffer;
+ }, r.prototype.getSoundSource = function() {
+ return this._soundSource;
+ }, r.prototype.getSoundGain = function() {
+ return this._soundGain;
+ }, r.prototype.serialize = function() {
+ var t = { name: this.name, url: this.name, autoplay: this.autoplay, loop: this.loop, volume: this._volume, spatialSound: this.spatialSound, maxDistance: this.maxDistance, rolloffFactor: this.rolloffFactor, refDistance: this.refDistance, distanceModel: this.distanceModel, playbackRate: this._playbackRate, panningModel: this._panningModel, soundTrackId: this.soundTrackId, metadata: this.metadata };
+ return this.spatialSound && (this._connectedTransformNode && (t.connectedMeshId = this._connectedTransformNode.id), t.position = this._position.asArray(), t.refDistance = this.refDistance, t.distanceModel = this.distanceModel, t.isDirectional = this._isDirectional, t.localDirectionToMesh = this._localDirection.asArray(), t.coneInnerAngle = this._coneInnerAngle, t.coneOuterAngle = this._coneOuterAngle, t.coneOuterGain = this._coneOuterGain), t;
+ }, r.Parse = function(t, e, n, i) {
+ var o, a = t.name;
+ o = t.url ? n + t.url : n + a;
+ var s, p = { autoplay: t.autoplay, loop: t.loop, volume: t.volume, spatialSound: t.spatialSound, maxDistance: t.maxDistance, rolloffFactor: t.rolloffFactor, refDistance: t.refDistance, distanceModel: t.distanceModel, playbackRate: t.playbackRate };
+ if (i) {
+ var m = function() {
+ i._isReadyToPlay ? (s._audioBuffer = i.getAudioBuffer(), s._isReadyToPlay = !0, s.autoplay && s.play(0, s._offset, s._length)) : window.setTimeout(m, 300);
+ };
+ s = new r(a, new ArrayBuffer(0), e, null, p), m();
+ } else
+ s = new r(a, o, e, function() {
+ e._removePendingData(s);
+ }, p), e._addPendingData(s);
+ if (t.position) {
+ var S = c.e.FromArray(t.position);
+ s.setPosition(S);
+ }
+ if (t.isDirectional && (s.setDirectionalCone(t.coneInnerAngle || 360, t.coneOuterAngle || 360, t.coneOuterGain || 0), t.localDirectionToMesh)) {
+ var O = c.e.FromArray(t.localDirectionToMesh);
+ s.setLocalDirectionToMesh(O);
+ }
+ if (t.connectedMeshId) {
+ var I = e.getMeshByID(t.connectedMeshId);
+ I && s.attachToMesh(I);
+ }
+ return t.metadata && (s.metadata = t.metadata), s;
+ }, r._SceneComponentInitialization = function(t) {
+ throw Nn.a.WarnImport("AudioSceneComponent");
+ }, r;
+ }(), ds = function() {
+ function r(t, e) {
+ e === void 0 && (e = {}), this.id = -1, this._isInitialized = !1, this._scene = t, this.soundCollection = new Array(), this._options = e, !this._options.mainTrack && this._scene.soundTracks && (this._scene.soundTracks.push(this), this.id = this._scene.soundTracks.length - 1);
+ }
+ return r.prototype._initializeSoundTrackAudioGraph = function() {
+ ke.a.audioEngine.canUseWebAudio && ke.a.audioEngine.audioContext && (this._outputAudioNode = ke.a.audioEngine.audioContext.createGain(), this._outputAudioNode.connect(ke.a.audioEngine.masterGain), this._options && this._options.volume && (this._outputAudioNode.gain.value = this._options.volume), this._isInitialized = !0);
+ }, r.prototype.dispose = function() {
+ if (ke.a.audioEngine && ke.a.audioEngine.canUseWebAudio) {
+ for (this._connectedAnalyser && this._connectedAnalyser.stopDebugCanvas(); this.soundCollection.length; )
+ this.soundCollection[0].dispose();
+ this._outputAudioNode && this._outputAudioNode.disconnect(), this._outputAudioNode = null;
+ }
+ }, r.prototype.addSound = function(t) {
+ this._isInitialized || this._initializeSoundTrackAudioGraph(), ke.a.audioEngine.canUseWebAudio && this._outputAudioNode && t.connectToSoundTrackAudioNode(this._outputAudioNode), t.soundTrackId && (t.soundTrackId === -1 ? this._scene.mainSoundTrack.removeSound(t) : this._scene.soundTracks && this._scene.soundTracks[t.soundTrackId].removeSound(t)), this.soundCollection.push(t), t.soundTrackId = this.id;
+ }, r.prototype.removeSound = function(t) {
+ var e = this.soundCollection.indexOf(t);
+ e !== -1 && this.soundCollection.splice(e, 1);
+ }, r.prototype.setVolume = function(t) {
+ ke.a.audioEngine.canUseWebAudio && this._outputAudioNode && (this._outputAudioNode.gain.value = t);
+ }, r.prototype.switchPanningModelToHRTF = function() {
+ if (ke.a.audioEngine.canUseWebAudio)
+ for (var t = 0; t < this.soundCollection.length; t++)
+ this.soundCollection[t].switchPanningModelToHRTF();
+ }, r.prototype.switchPanningModelToEqualPower = function() {
+ if (ke.a.audioEngine.canUseWebAudio)
+ for (var t = 0; t < this.soundCollection.length; t++)
+ this.soundCollection[t].switchPanningModelToEqualPower();
+ }, r.prototype.connectToAnalyser = function(t) {
+ this._connectedAnalyser && this._connectedAnalyser.stopDebugCanvas(), this._connectedAnalyser = t, ke.a.audioEngine.canUseWebAudio && this._outputAudioNode && (this._outputAudioNode.disconnect(), this._connectedAnalyser.connectAudioNodes(this._outputAudioNode, ke.a.audioEngine.masterGain));
+ }, r;
+ }(), st = l(17);
+ D.a.AddParser(st.a.NAME_AUDIO, function(r, t, e, n) {
+ var i, o = [];
+ if (e.sounds = e.sounds || [], r.sounds !== void 0 && r.sounds !== null)
+ for (var a = 0, s = r.sounds.length; a < s; a++) {
+ var p = r.sounds[a];
+ ke.a.audioEngine.canUseWebAudio ? (p.url || (p.url = p.name), o[p.url] ? e.sounds.push(yi.Parse(p, t, n, o[p.url])) : (i = yi.Parse(p, t, n), o[p.url] = i, e.sounds.push(i))) : e.sounds.push(new yi(p.name, null, t));
+ }
+ o = [];
+ }), Object.defineProperty(ge.a.prototype, "mainSoundTrack", { get: function() {
+ var r = this._getComponent(st.a.NAME_AUDIO);
+ return r || (r = new Ei(this), this._addComponent(r)), this._mainSoundTrack || (this._mainSoundTrack = new ds(this, { mainTrack: !0 })), this._mainSoundTrack;
+ }, enumerable: !0, configurable: !0 }), ge.a.prototype.getSoundByName = function(r) {
+ var t;
+ for (t = 0; t < this.mainSoundTrack.soundCollection.length; t++)
+ if (this.mainSoundTrack.soundCollection[t].name === r)
+ return this.mainSoundTrack.soundCollection[t];
+ if (this.soundTracks) {
+ for (var e = 0; e < this.soundTracks.length; e++)
+ for (t = 0; t < this.soundTracks[e].soundCollection.length; t++)
+ if (this.soundTracks[e].soundCollection[t].name === r)
+ return this.soundTracks[e].soundCollection[t];
+ }
+ return null;
+ }, Object.defineProperty(ge.a.prototype, "audioEnabled", { get: function() {
+ var r = this._getComponent(st.a.NAME_AUDIO);
+ return r || (r = new Ei(this), this._addComponent(r)), r.audioEnabled;
+ }, set: function(r) {
+ var t = this._getComponent(st.a.NAME_AUDIO);
+ t || (t = new Ei(this), this._addComponent(t)), r ? t.enableAudio() : t.disableAudio();
+ }, enumerable: !0, configurable: !0 }), Object.defineProperty(ge.a.prototype, "headphone", { get: function() {
+ var r = this._getComponent(st.a.NAME_AUDIO);
+ return r || (r = new Ei(this), this._addComponent(r)), r.headphone;
+ }, set: function(r) {
+ var t = this._getComponent(st.a.NAME_AUDIO);
+ t || (t = new Ei(this), this._addComponent(t)), r ? t.switchAudioModeForHeadphones() : t.switchAudioModeForNormalSpeakers();
+ }, enumerable: !0, configurable: !0 }), Object.defineProperty(ge.a.prototype, "audioListenerPositionProvider", { get: function() {
+ var r = this._getComponent(st.a.NAME_AUDIO);
+ return r || (r = new Ei(this), this._addComponent(r)), r.audioListenerPositionProvider;
+ }, set: function(r) {
+ var t = this._getComponent(st.a.NAME_AUDIO);
+ if (t || (t = new Ei(this), this._addComponent(t)), typeof r != "function")
+ throw new Error("The value passed to [Scene.audioListenerPositionProvider] must be a function that returns a Vector3");
+ t.audioListenerPositionProvider = r;
+ }, enumerable: !0, configurable: !0 }), Object.defineProperty(ge.a.prototype, "audioPositioningRefreshRate", { get: function() {
+ var r = this._getComponent(st.a.NAME_AUDIO);
+ return r || (r = new Ei(this), this._addComponent(r)), r.audioPositioningRefreshRate;
+ }, set: function(r) {
+ var t = this._getComponent(st.a.NAME_AUDIO);
+ t || (t = new Ei(this), this._addComponent(t)), t.audioPositioningRefreshRate = r;
+ }, enumerable: !0, configurable: !0 });
+ var Ei = function() {
+ function r(t) {
+ this.name = st.a.NAME_AUDIO, this._audioEnabled = !0, this._headphone = !1, this.audioPositioningRefreshRate = 500, this._audioListenerPositionProvider = null, this._cachedCameraDirection = new c.e(), this._cachedCameraPosition = new c.e(), this._lastCheck = 0, this.scene = t, t.soundTracks = new Array(), t.sounds = new Array();
+ }
+ return Object.defineProperty(r.prototype, "audioEnabled", { get: function() {
+ return this._audioEnabled;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "headphone", { get: function() {
+ return this._headphone;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "audioListenerPositionProvider", { get: function() {
+ return this._audioListenerPositionProvider;
+ }, set: function(t) {
+ this._audioListenerPositionProvider = t;
+ }, enumerable: !1, configurable: !0 }), r.prototype.register = function() {
+ this.scene._afterRenderStage.registerStep(st.a.STEP_AFTERRENDER_AUDIO, this, this._afterRender);
+ }, r.prototype.rebuild = function() {
+ }, r.prototype.serialize = function(t) {
+ if (t.sounds = [], this.scene.soundTracks)
+ for (var e = 0; e < this.scene.soundTracks.length; e++)
+ for (var n = this.scene.soundTracks[e], i = 0; i < n.soundCollection.length; i++)
+ t.sounds.push(n.soundCollection[i].serialize());
+ }, r.prototype.addFromContainer = function(t) {
+ var e = this;
+ t.sounds && t.sounds.forEach(function(n) {
+ n.play(), n.autoplay = !0, e.scene.mainSoundTrack.addSound(n);
+ });
+ }, r.prototype.removeFromContainer = function(t, e) {
+ var n = this;
+ e === void 0 && (e = !1), t.sounds && t.sounds.forEach(function(i) {
+ i.stop(), i.autoplay = !1, n.scene.mainSoundTrack.removeSound(i), e && i.dispose();
+ });
+ }, r.prototype.dispose = function() {
+ var t = this.scene;
+ if (t._mainSoundTrack && t.mainSoundTrack.dispose(), t.soundTracks)
+ for (var e = 0; e < t.soundTracks.length; e++)
+ t.soundTracks[e].dispose();
+ }, r.prototype.disableAudio = function() {
+ var t, e = this.scene;
+ for (this._audioEnabled = !1, ke.a.audioEngine && ke.a.audioEngine.audioContext && ke.a.audioEngine.audioContext.suspend(), t = 0; t < e.mainSoundTrack.soundCollection.length; t++)
+ e.mainSoundTrack.soundCollection[t].pause();
+ if (e.soundTracks)
+ for (t = 0; t < e.soundTracks.length; t++)
+ for (var n = 0; n < e.soundTracks[t].soundCollection.length; n++)
+ e.soundTracks[t].soundCollection[n].pause();
+ }, r.prototype.enableAudio = function() {
+ var t, e = this.scene;
+ for (this._audioEnabled = !0, ke.a.audioEngine && ke.a.audioEngine.audioContext && ke.a.audioEngine.audioContext.resume(), t = 0; t < e.mainSoundTrack.soundCollection.length; t++)
+ e.mainSoundTrack.soundCollection[t].isPaused && e.mainSoundTrack.soundCollection[t].play();
+ if (e.soundTracks)
+ for (t = 0; t < e.soundTracks.length; t++)
+ for (var n = 0; n < e.soundTracks[t].soundCollection.length; n++)
+ e.soundTracks[t].soundCollection[n].isPaused && e.soundTracks[t].soundCollection[n].play();
+ }, r.prototype.switchAudioModeForHeadphones = function() {
+ var t = this.scene;
+ if (this._headphone = !0, t.mainSoundTrack.switchPanningModelToHRTF(), t.soundTracks)
+ for (var e = 0; e < t.soundTracks.length; e++)
+ t.soundTracks[e].switchPanningModelToHRTF();
+ }, r.prototype.switchAudioModeForNormalSpeakers = function() {
+ var t = this.scene;
+ if (this._headphone = !1, t.mainSoundTrack.switchPanningModelToEqualPower(), t.soundTracks)
+ for (var e = 0; e < t.soundTracks.length; e++)
+ t.soundTracks[e].switchPanningModelToEqualPower();
+ }, r.prototype._afterRender = function() {
+ var t = Te.a.Now;
+ if (!(this._lastCheck && t - this._lastCheck < this.audioPositioningRefreshRate)) {
+ this._lastCheck = t;
+ var e = this.scene;
+ if (this._audioEnabled && e._mainSoundTrack && e.soundTracks && (e._mainSoundTrack.soundCollection.length !== 0 || e.soundTracks.length !== 1)) {
+ var n = ke.a.audioEngine;
+ if (n && n.audioContext) {
+ if (this._audioListenerPositionProvider) {
+ var i = this._audioListenerPositionProvider();
+ i.x = i.x || 0, i.y = i.y || 0, i.z = i.z || 0, n.audioContext.listener.setPosition(i.x, i.y, i.z);
+ } else {
+ var o;
+ if (o = e.activeCameras && e.activeCameras.length > 0 ? e.activeCameras[0] : e.activeCamera) {
+ this._cachedCameraPosition.equals(o.globalPosition) || (this._cachedCameraPosition.copyFrom(o.globalPosition), n.audioContext.listener.setPosition(o.globalPosition.x, o.globalPosition.y, o.globalPosition.z)), o.rigCameras && o.rigCameras.length > 0 && (o = o.rigCameras[0]);
+ var a = c.a.Invert(o.getViewMatrix()), s = c.e.TransformNormal(e.useRightHandedSystem ? r._CameraDirectionRH : r._CameraDirectionLH, a);
+ s.normalize(), isNaN(s.x) || isNaN(s.y) || isNaN(s.z) || this._cachedCameraDirection.equals(s) || (this._cachedCameraDirection.copyFrom(s), n.audioContext.listener.setOrientation(s.x, s.y, s.z, 0, 1, 0));
+ } else
+ n.audioContext.listener.setPosition(0, 0, 0);
+ }
+ var p;
+ for (p = 0; p < e.mainSoundTrack.soundCollection.length; p++) {
+ var m = e.mainSoundTrack.soundCollection[p];
+ m.useCustomAttenuation && m.updateDistanceFromListener();
+ }
+ if (e.soundTracks)
+ for (p = 0; p < e.soundTracks.length; p++)
+ for (var S = 0; S < e.soundTracks[p].soundCollection.length; S++)
+ (m = e.soundTracks[p].soundCollection[S]).useCustomAttenuation && m.updateDistanceFromListener();
+ }
+ }
+ }
+ }, r._CameraDirectionLH = new c.e(0, 0, -1), r._CameraDirectionRH = new c.e(0, 0, 1), r;
+ }();
+ yi._SceneComponentInitialization = function(r) {
+ var t = r._getComponent(st.a.NAME_AUDIO);
+ t || (t = new Ei(r), r._addComponent(t));
+ };
+ var Kv = function() {
+ function r(t, e, n) {
+ var i = this;
+ if (this.loop = !1, this._coneInnerAngle = 360, this._coneOuterAngle = 360, this._volume = 1, this.isPlaying = !1, this.isPaused = !1, this._sounds = [], this._weights = [], e.length !== n.length)
+ throw new Error("Sounds length does not equal weights length");
+ this.loop = t, this._weights = n;
+ for (var o = 0, a = 0, s = n; a < s.length; a++)
+ o += s[a];
+ for (var p = o > 0 ? 1 / o : 0, m = 0; m < this._weights.length; m++)
+ this._weights[m] *= p;
+ this._sounds = e;
+ for (var S = 0, O = this._sounds; S < O.length; S++)
+ O[S].onEndedObservable.add(function() {
+ i._onended();
+ });
+ }
+ return Object.defineProperty(r.prototype, "directionalConeInnerAngle", { get: function() {
+ return this._coneInnerAngle;
+ }, set: function(t) {
+ if (t !== this._coneInnerAngle) {
+ if (this._coneOuterAngle < t)
+ return void h.a.Error("directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle.");
+ this._coneInnerAngle = t;
+ for (var e = 0, n = this._sounds; e < n.length; e++)
+ n[e].directionalConeInnerAngle = t;
+ }
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "directionalConeOuterAngle", { get: function() {
+ return this._coneOuterAngle;
+ }, set: function(t) {
+ if (t !== this._coneOuterAngle) {
+ if (t < this._coneInnerAngle)
+ return void h.a.Error("directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle.");
+ this._coneOuterAngle = t;
+ for (var e = 0, n = this._sounds; e < n.length; e++)
+ n[e].directionalConeOuterAngle = t;
+ }
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "volume", { get: function() {
+ return this._volume;
+ }, set: function(t) {
+ if (t !== this._volume)
+ for (var e = 0, n = this._sounds; e < n.length; e++)
+ n[e].setVolume(t);
+ }, enumerable: !1, configurable: !0 }), r.prototype._onended = function() {
+ this._currentIndex !== void 0 && (this._sounds[this._currentIndex].autoplay = !1), this.loop && this.isPlaying ? this.play() : this.isPlaying = !1;
+ }, r.prototype.pause = function() {
+ this.isPaused = !0, this._currentIndex !== void 0 && this._sounds[this._currentIndex].pause();
+ }, r.prototype.stop = function() {
+ this.isPlaying = !1, this._currentIndex !== void 0 && this._sounds[this._currentIndex].stop();
+ }, r.prototype.play = function(t) {
+ if (!this.isPaused) {
+ this.stop();
+ for (var e = Math.random(), n = 0, i = 0; i < this._weights.length; i++)
+ if (e <= (n += this._weights[i])) {
+ this._currentIndex = i;
+ break;
+ }
+ }
+ var o = this._sounds[this._currentIndex];
+ o.isReady() ? o.play(0, this.isPaused ? void 0 : t) : o.autoplay = !0, this.isPlaying = !0, this.isPaused = !1;
+ }, r;
+ }(), Et = l(18), dd = function() {
+ function r() {
+ this._zoomStopsAnimation = !1, this._idleRotationSpeed = 0.05, this._idleRotationWaitTime = 2e3, this._idleRotationSpinupTime = 2e3, this._isPointerDown = !1, this._lastFrameTime = null, this._lastInteractionTime = -1 / 0, this._cameraRotationSpeed = 0, this._lastFrameRadius = 0;
+ }
+ return Object.defineProperty(r.prototype, "name", { get: function() {
+ return "AutoRotation";
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "zoomStopsAnimation", { get: function() {
+ return this._zoomStopsAnimation;
+ }, set: function(t) {
+ this._zoomStopsAnimation = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "idleRotationSpeed", { get: function() {
+ return this._idleRotationSpeed;
+ }, set: function(t) {
+ this._idleRotationSpeed = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "idleRotationWaitTime", { get: function() {
+ return this._idleRotationWaitTime;
+ }, set: function(t) {
+ this._idleRotationWaitTime = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "idleRotationSpinupTime", { get: function() {
+ return this._idleRotationSpinupTime;
+ }, set: function(t) {
+ this._idleRotationSpinupTime = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "rotationInProgress", { get: function() {
+ return Math.abs(this._cameraRotationSpeed) > 0;
+ }, enumerable: !1, configurable: !0 }), r.prototype.init = function() {
+ }, r.prototype.attach = function(t) {
+ var e = this;
+ this._attachedCamera = t;
+ var n = this._attachedCamera.getScene();
+ this._onPrePointerObservableObserver = n.onPrePointerObservable.add(function(i) {
+ i.type !== Et.a.POINTERDOWN ? i.type === Et.a.POINTERUP && (e._isPointerDown = !1) : e._isPointerDown = !0;
+ }), this._onAfterCheckInputsObserver = t.onAfterCheckInputsObservable.add(function() {
+ var i = Te.a.Now, o = 0;
+ e._lastFrameTime != null && (o = i - e._lastFrameTime), e._lastFrameTime = i, e._applyUserInteraction();
+ var a = i - e._lastInteractionTime - e._idleRotationWaitTime, s = Math.max(Math.min(a / e._idleRotationSpinupTime, 1), 0);
+ e._cameraRotationSpeed = e._idleRotationSpeed * s, e._attachedCamera && (e._attachedCamera.alpha -= e._cameraRotationSpeed * (o / 1e3));
+ });
+ }, r.prototype.detach = function() {
+ if (this._attachedCamera) {
+ var t = this._attachedCamera.getScene();
+ this._onPrePointerObservableObserver && t.onPrePointerObservable.remove(this._onPrePointerObservableObserver), this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver), this._attachedCamera = null;
+ }
+ }, r.prototype._userIsZooming = function() {
+ return !!this._attachedCamera && this._attachedCamera.inertialRadiusOffset !== 0;
+ }, r.prototype._shouldAnimationStopForInteraction = function() {
+ if (!this._attachedCamera)
+ return !1;
+ var t = !1;
+ return this._lastFrameRadius === this._attachedCamera.radius && this._attachedCamera.inertialRadiusOffset !== 0 && (t = !0), this._lastFrameRadius = this._attachedCamera.radius, this._zoomStopsAnimation ? t : this._userIsZooming();
+ }, r.prototype._applyUserInteraction = function() {
+ this._userIsMoving() && !this._shouldAnimationStopForInteraction() && (this._lastInteractionTime = Te.a.Now);
+ }, r.prototype._userIsMoving = function() {
+ return !!this._attachedCamera && (this._attachedCamera.inertialAlphaOffset !== 0 || this._attachedCamera.inertialBetaOffset !== 0 || this._attachedCamera.inertialRadiusOffset !== 0 || this._attachedCamera.inertialPanningX !== 0 || this._attachedCamera.inertialPanningY !== 0 || this._isPointerDown);
+ }, r;
+ }(), fd = function() {
+ function r() {
+ this.transitionDuration = 450, this.lowerRadiusTransitionRange = 2, this.upperRadiusTransitionRange = -2, this._autoTransitionRange = !1, this._radiusIsAnimating = !1, this._radiusBounceTransition = null, this._animatables = new Array();
+ }
+ return Object.defineProperty(r.prototype, "name", { get: function() {
+ return "Bouncing";
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "autoTransitionRange", { get: function() {
+ return this._autoTransitionRange;
+ }, set: function(t) {
+ var e = this;
+ if (this._autoTransitionRange !== t) {
+ this._autoTransitionRange = t;
+ var n = this._attachedCamera;
+ n && (t ? this._onMeshTargetChangedObserver = n.onMeshTargetChangedObservable.add(function(i) {
+ if (i) {
+ i.computeWorldMatrix(!0);
+ var o = i.getBoundingInfo().diagonalLength;
+ e.lowerRadiusTransitionRange = 0.05 * o, e.upperRadiusTransitionRange = 0.05 * o;
+ }
+ }) : this._onMeshTargetChangedObserver && n.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver));
+ }
+ }, enumerable: !1, configurable: !0 }), r.prototype.init = function() {
+ }, r.prototype.attach = function(t) {
+ var e = this;
+ this._attachedCamera = t, this._onAfterCheckInputsObserver = t.onAfterCheckInputsObservable.add(function() {
+ e._attachedCamera && (e._isRadiusAtLimit(e._attachedCamera.lowerRadiusLimit) && e._applyBoundRadiusAnimation(e.lowerRadiusTransitionRange), e._isRadiusAtLimit(e._attachedCamera.upperRadiusLimit) && e._applyBoundRadiusAnimation(e.upperRadiusTransitionRange));
+ });
+ }, r.prototype.detach = function() {
+ this._attachedCamera && (this._onAfterCheckInputsObserver && this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver), this._onMeshTargetChangedObserver && this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver), this._attachedCamera = null);
+ }, r.prototype._isRadiusAtLimit = function(t) {
+ return !!this._attachedCamera && this._attachedCamera.radius === t && !this._radiusIsAnimating;
+ }, r.prototype._applyBoundRadiusAnimation = function(t) {
+ var e = this;
+ if (this._attachedCamera) {
+ this._radiusBounceTransition || (r.EasingFunction.setEasingMode(r.EasingMode), this._radiusBounceTransition = H.CreateAnimation("radius", H.ANIMATIONTYPE_FLOAT, 60, r.EasingFunction)), this._cachedWheelPrecision = this._attachedCamera.wheelPrecision, this._attachedCamera.wheelPrecision = 1 / 0, this._attachedCamera.inertialRadiusOffset = 0, this.stopAllAnimations(), this._radiusIsAnimating = !0;
+ var n = H.TransitionTo("radius", this._attachedCamera.radius + t, this._attachedCamera, this._attachedCamera.getScene(), 60, this._radiusBounceTransition, this.transitionDuration, function() {
+ return e._clearAnimationLocks();
+ });
+ n && this._animatables.push(n);
+ }
+ }, r.prototype._clearAnimationLocks = function() {
+ this._radiusIsAnimating = !1, this._attachedCamera && (this._attachedCamera.wheelPrecision = this._cachedWheelPrecision);
+ }, r.prototype.stopAllAnimations = function() {
+ for (this._attachedCamera && (this._attachedCamera.animations = []); this._animatables.length; )
+ this._animatables[0].onAnimationEnd = null, this._animatables[0].stop(), this._animatables.shift();
+ }, r.EasingFunction = new et(0.3), r.EasingMode = je.EASINGMODE_EASEOUT, r;
+ }(), pd = function() {
+ function r() {
+ this._mode = r.FitFrustumSidesMode, this._radiusScale = 1, this._positionScale = 0.5, this._defaultElevation = 0.3, this._elevationReturnTime = 1500, this._elevationReturnWaitTime = 1e3, this._zoomStopsAnimation = !1, this._framingTime = 1500, this.autoCorrectCameraLimitsAndSensibility = !0, this._isPointerDown = !1, this._lastInteractionTime = -1 / 0, this._animatables = new Array(), this._betaIsAnimating = !1;
+ }
+ return Object.defineProperty(r.prototype, "name", { get: function() {
+ return "Framing";
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "mode", { get: function() {
+ return this._mode;
+ }, set: function(t) {
+ this._mode = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "radiusScale", { get: function() {
+ return this._radiusScale;
+ }, set: function(t) {
+ this._radiusScale = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "positionScale", { get: function() {
+ return this._positionScale;
+ }, set: function(t) {
+ this._positionScale = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "defaultElevation", { get: function() {
+ return this._defaultElevation;
+ }, set: function(t) {
+ this._defaultElevation = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "elevationReturnTime", { get: function() {
+ return this._elevationReturnTime;
+ }, set: function(t) {
+ this._elevationReturnTime = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "elevationReturnWaitTime", { get: function() {
+ return this._elevationReturnWaitTime;
+ }, set: function(t) {
+ this._elevationReturnWaitTime = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "zoomStopsAnimation", { get: function() {
+ return this._zoomStopsAnimation;
+ }, set: function(t) {
+ this._zoomStopsAnimation = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "framingTime", { get: function() {
+ return this._framingTime;
+ }, set: function(t) {
+ this._framingTime = t;
+ }, enumerable: !1, configurable: !0 }), r.prototype.init = function() {
+ }, r.prototype.attach = function(t) {
+ var e = this;
+ this._attachedCamera = t;
+ var n = this._attachedCamera.getScene();
+ r.EasingFunction.setEasingMode(r.EasingMode), this._onPrePointerObservableObserver = n.onPrePointerObservable.add(function(i) {
+ i.type !== Et.a.POINTERDOWN ? i.type === Et.a.POINTERUP && (e._isPointerDown = !1) : e._isPointerDown = !0;
+ }), this._onMeshTargetChangedObserver = t.onMeshTargetChangedObservable.add(function(i) {
+ i && e.zoomOnMesh(i);
+ }), this._onAfterCheckInputsObserver = t.onAfterCheckInputsObservable.add(function() {
+ e._applyUserInteraction(), e._maintainCameraAboveGround();
+ });
+ }, r.prototype.detach = function() {
+ if (this._attachedCamera) {
+ var t = this._attachedCamera.getScene();
+ this._onPrePointerObservableObserver && t.onPrePointerObservable.remove(this._onPrePointerObservableObserver), this._onAfterCheckInputsObserver && this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver), this._onMeshTargetChangedObserver && this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver), this._attachedCamera = null;
+ }
+ }, r.prototype.zoomOnMesh = function(t, e, n) {
+ e === void 0 && (e = !1), n === void 0 && (n = null), t.computeWorldMatrix(!0);
+ var i = t.getBoundingInfo().boundingBox;
+ this.zoomOnBoundingInfo(i.minimumWorld, i.maximumWorld, e, n);
+ }, r.prototype.zoomOnMeshHierarchy = function(t, e, n) {
+ e === void 0 && (e = !1), n === void 0 && (n = null), t.computeWorldMatrix(!0);
+ var i = t.getHierarchyBoundingVectors(!0);
+ this.zoomOnBoundingInfo(i.min, i.max, e, n);
+ }, r.prototype.zoomOnMeshesHierarchy = function(t, e, n) {
+ e === void 0 && (e = !1), n === void 0 && (n = null);
+ for (var i = new c.e(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), o = new c.e(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE), a = 0; a < t.length; a++) {
+ var s = t[a].getHierarchyBoundingVectors(!0);
+ c.e.CheckExtends(s.min, i, o), c.e.CheckExtends(s.max, i, o);
+ }
+ this.zoomOnBoundingInfo(i, o, e, n);
+ }, r.prototype.zoomOnBoundingInfo = function(t, e, n, i) {
+ var o, a = this;
+ if (n === void 0 && (n = !1), i === void 0 && (i = null), this._attachedCamera) {
+ var s = t.y, p = s + (e.y - s) * this._positionScale, m = e.subtract(t).scale(0.5);
+ if (n)
+ o = new c.e(0, p, 0);
+ else {
+ var S = t.add(m);
+ o = new c.e(S.x, p, S.z);
+ }
+ this._vectorTransition || (this._vectorTransition = H.CreateAnimation("target", H.ANIMATIONTYPE_VECTOR3, 60, r.EasingFunction)), this._betaIsAnimating = !0;
+ var O = H.TransitionTo("target", o, this._attachedCamera, this._attachedCamera.getScene(), 60, this._vectorTransition, this._framingTime);
+ O && this._animatables.push(O);
+ var I = 0;
+ if (this._mode === r.FitFrustumSidesMode) {
+ var G = this._calculateLowerRadiusFromModelBoundingSphere(t, e);
+ this.autoCorrectCameraLimitsAndSensibility && (this._attachedCamera.lowerRadiusLimit = m.length() + this._attachedCamera.minZ), I = G;
+ } else
+ this._mode === r.IgnoreBoundsSizeMode && (I = this._calculateLowerRadiusFromModelBoundingSphere(t, e), this.autoCorrectCameraLimitsAndSensibility && this._attachedCamera.lowerRadiusLimit === null && (this._attachedCamera.lowerRadiusLimit = this._attachedCamera.minZ));
+ if (this.autoCorrectCameraLimitsAndSensibility) {
+ var k = e.subtract(t).length();
+ this._attachedCamera.panningSensibility = 5e3 / k, this._attachedCamera.wheelPrecision = 100 / I;
+ }
+ this._radiusTransition || (this._radiusTransition = H.CreateAnimation("radius", H.ANIMATIONTYPE_FLOAT, 60, r.EasingFunction)), (O = H.TransitionTo("radius", I, this._attachedCamera, this._attachedCamera.getScene(), 60, this._radiusTransition, this._framingTime, function() {
+ a.stopAllAnimations(), i && i(), a._attachedCamera && a._attachedCamera.useInputToRestoreState && a._attachedCamera.storeState();
+ })) && this._animatables.push(O);
+ }
+ }, r.prototype._calculateLowerRadiusFromModelBoundingSphere = function(t, e) {
+ var n = e.subtract(t).length(), i = this._getFrustumSlope(), o = 0.5 * n * this._radiusScale, a = o * Math.sqrt(1 + 1 / (i.x * i.x)), s = o * Math.sqrt(1 + 1 / (i.y * i.y)), p = Math.max(a, s), m = this._attachedCamera;
+ return m ? (m.lowerRadiusLimit && this._mode === r.IgnoreBoundsSizeMode && (p = p < m.lowerRadiusLimit ? m.lowerRadiusLimit : p), m.upperRadiusLimit && (p = p > m.upperRadiusLimit ? m.upperRadiusLimit : p), p) : 0;
+ }, r.prototype._maintainCameraAboveGround = function() {
+ var t = this;
+ if (!(this._elevationReturnTime < 0)) {
+ var e = Te.a.Now - this._lastInteractionTime, n = 0.5 * Math.PI - this._defaultElevation, i = 0.5 * Math.PI;
+ if (this._attachedCamera && !this._betaIsAnimating && this._attachedCamera.beta > i && e >= this._elevationReturnWaitTime) {
+ this._betaIsAnimating = !0, this.stopAllAnimations(), this._betaTransition || (this._betaTransition = H.CreateAnimation("beta", H.ANIMATIONTYPE_FLOAT, 60, r.EasingFunction));
+ var o = H.TransitionTo("beta", n, this._attachedCamera, this._attachedCamera.getScene(), 60, this._betaTransition, this._elevationReturnTime, function() {
+ t._clearAnimationLocks(), t.stopAllAnimations();
+ });
+ o && this._animatables.push(o);
+ }
+ }
+ }, r.prototype._getFrustumSlope = function() {
+ var t = this._attachedCamera;
+ if (!t)
+ return c.d.Zero();
+ var e = t.getScene().getEngine().getAspectRatio(t), n = Math.tan(t.fov / 2), i = n * e;
+ return new c.d(i, n);
+ }, r.prototype._clearAnimationLocks = function() {
+ this._betaIsAnimating = !1;
+ }, r.prototype._applyUserInteraction = function() {
+ this.isUserIsMoving && (this._lastInteractionTime = Te.a.Now, this.stopAllAnimations(), this._clearAnimationLocks());
+ }, r.prototype.stopAllAnimations = function() {
+ for (this._attachedCamera && (this._attachedCamera.animations = []); this._animatables.length; )
+ this._animatables[0] && (this._animatables[0].onAnimationEnd = null, this._animatables[0].stop()), this._animatables.shift();
+ }, Object.defineProperty(r.prototype, "isUserIsMoving", { get: function() {
+ return !!this._attachedCamera && (this._attachedCamera.inertialAlphaOffset !== 0 || this._attachedCamera.inertialBetaOffset !== 0 || this._attachedCamera.inertialRadiusOffset !== 0 || this._attachedCamera.inertialPanningX !== 0 || this._attachedCamera.inertialPanningY !== 0 || this._isPointerDown);
+ }, enumerable: !1, configurable: !0 }), r.EasingFunction = new St(), r.EasingMode = je.EASINGMODE_EASEINOUT, r.IgnoreBoundsSizeMode = 0, r.FitFrustumSidesMode = 1, r;
+ }(), _o = function(r, t, e, n) {
+ t === void 0 && (t = new c.e()), e === void 0 && (e = 0), n === void 0 && (n = !1), this.direction = r, this.rotatedDirection = t, this.diff = e, this.ignore = n;
+ }, Qv = function() {
+ function r(t) {
+ this.ui = t, this.name = "AttachToBoxBehavior", this.distanceAwayFromFace = 0.15, this.distanceAwayFromBottomOfFace = 0.15, this._faceVectors = [new _o(c.e.Up()), new _o(c.e.Down()), new _o(c.e.Left()), new _o(c.e.Right()), new _o(c.e.Forward()), new _o(c.e.Forward().scaleInPlace(-1))], this._tmpMatrix = new c.a(), this._tmpVector = new c.e(), this._zeroVector = c.e.Zero(), this._lookAtTmpMatrix = new c.a();
+ }
+ return r.prototype.init = function() {
+ }, r.prototype._closestFace = function(t) {
+ var e = this;
+ return this._faceVectors.forEach(function(n) {
+ e._target.rotationQuaternion || (e._target.rotationQuaternion = c.b.RotationYawPitchRoll(e._target.rotation.y, e._target.rotation.x, e._target.rotation.z)), e._target.rotationQuaternion.toRotationMatrix(e._tmpMatrix), c.e.TransformCoordinatesToRef(n.direction, e._tmpMatrix, n.rotatedDirection), n.diff = c.e.GetAngleBetweenVectors(n.rotatedDirection, t, c.e.Cross(n.rotatedDirection, t));
+ }), this._faceVectors.reduce(function(n, i) {
+ return n.ignore ? i : i.ignore || n.diff < i.diff ? n : i;
+ }, this._faceVectors[0]);
+ }, r.prototype._lookAtToRef = function(t, e, n) {
+ e === void 0 && (e = new c.e(0, 1, 0)), c.a.LookAtLHToRef(this._zeroVector, t, e, this._lookAtTmpMatrix), this._lookAtTmpMatrix.invert(), c.b.FromRotationMatrixToRef(this._lookAtTmpMatrix, n);
+ }, r.prototype.attach = function(t) {
+ var e = this;
+ this._target = t, this._scene = this._target.getScene(), this._onRenderObserver = this._scene.onBeforeRenderObservable.add(function() {
+ if (e._scene.activeCamera) {
+ var n = e._scene.activeCamera.position;
+ e._scene.activeCamera.devicePosition && (n = e._scene.activeCamera.devicePosition);
+ var i = e._closestFace(n.subtract(t.position));
+ e._scene.activeCamera.leftCamera ? e._scene.activeCamera.leftCamera.computeWorldMatrix().getRotationMatrixToRef(e._tmpMatrix) : e._scene.activeCamera.computeWorldMatrix().getRotationMatrixToRef(e._tmpMatrix), c.e.TransformCoordinatesToRef(c.e.Up(), e._tmpMatrix, e._tmpVector), e._faceVectors.forEach(function(a) {
+ i.direction.x && a.direction.x && (a.ignore = !0), i.direction.y && a.direction.y && (a.ignore = !0), i.direction.z && a.direction.z && (a.ignore = !0);
+ });
+ var o = e._closestFace(e._tmpVector);
+ e._faceVectors.forEach(function(a) {
+ a.ignore = !1;
+ }), e.ui.position.copyFrom(t.position), i.direction.x && (i.rotatedDirection.scaleToRef(t.scaling.x / 2 + e.distanceAwayFromFace, e._tmpVector), e.ui.position.addInPlace(e._tmpVector)), i.direction.y && (i.rotatedDirection.scaleToRef(t.scaling.y / 2 + e.distanceAwayFromFace, e._tmpVector), e.ui.position.addInPlace(e._tmpVector)), i.direction.z && (i.rotatedDirection.scaleToRef(t.scaling.z / 2 + e.distanceAwayFromFace, e._tmpVector), e.ui.position.addInPlace(e._tmpVector)), e.ui.rotationQuaternion || (e.ui.rotationQuaternion = c.b.RotationYawPitchRoll(e.ui.rotation.y, e.ui.rotation.x, e.ui.rotation.z)), i.rotatedDirection.scaleToRef(-1, e._tmpVector), e._lookAtToRef(e._tmpVector, o.rotatedDirection, e.ui.rotationQuaternion), o.direction.x && e.ui.up.scaleToRef(e.distanceAwayFromBottomOfFace - t.scaling.x / 2, e._tmpVector), o.direction.y && e.ui.up.scaleToRef(e.distanceAwayFromBottomOfFace - t.scaling.y / 2, e._tmpVector), o.direction.z && e.ui.up.scaleToRef(e.distanceAwayFromBottomOfFace - t.scaling.z / 2, e._tmpVector), e.ui.position.addInPlace(e._tmpVector);
+ }
+ });
+ }, r.prototype.detach = function() {
+ this._scene.onBeforeRenderObservable.remove(this._onRenderObserver);
+ }, r;
+ }(), qv = function() {
+ function r() {
+ var t = this;
+ this.delay = 0, this.fadeInTime = 300, this._millisecondsPerFrame = 1e3 / 60, this._hovered = !1, this._hoverValue = 0, this._ownerNode = null, this._update = function() {
+ if (t._ownerNode) {
+ if (t._hoverValue += t._hovered ? t._millisecondsPerFrame : -t._millisecondsPerFrame, t._setAllVisibility(t._ownerNode, (t._hoverValue - t.delay) / t.fadeInTime), t._ownerNode.visibility > 1)
+ return t._setAllVisibility(t._ownerNode, 1), void (t._hoverValue = t.fadeInTime + t.delay);
+ if (t._ownerNode.visibility < 0 && (t._setAllVisibility(t._ownerNode, 0), t._hoverValue < 0))
+ return void (t._hoverValue = 0);
+ setTimeout(t._update, t._millisecondsPerFrame);
+ }
+ };
+ }
+ return Object.defineProperty(r.prototype, "name", { get: function() {
+ return "FadeInOut";
+ }, enumerable: !1, configurable: !0 }), r.prototype.init = function() {
+ }, r.prototype.attach = function(t) {
+ this._ownerNode = t, this._setAllVisibility(this._ownerNode, 0);
+ }, r.prototype.detach = function() {
+ this._ownerNode = null;
+ }, r.prototype.fadeIn = function(t) {
+ this._hovered = t, this._update();
+ }, r.prototype._setAllVisibility = function(t, e) {
+ var n = this;
+ t.visibility = e, t.getChildMeshes().forEach(function(i) {
+ n._setAllVisibility(i, e);
+ });
+ }, r;
+ }(), Ji = l(65), Zv = function() {
+ function r() {
+ this._startDistance = 0, this._initialScale = new c.e(0, 0, 0), this._targetScale = new c.e(0, 0, 0), this._sceneRenderObserver = null, this._dragBehaviorA = new Ji.a({}), this._dragBehaviorA.moveAttached = !1, this._dragBehaviorB = new Ji.a({}), this._dragBehaviorB.moveAttached = !1;
+ }
+ return Object.defineProperty(r.prototype, "name", { get: function() {
+ return "MultiPointerScale";
+ }, enumerable: !1, configurable: !0 }), r.prototype.init = function() {
+ }, r.prototype._getCurrentDistance = function() {
+ return this._dragBehaviorA.lastDragPosition.subtract(this._dragBehaviorB.lastDragPosition).length();
+ }, r.prototype.attach = function(t) {
+ var e = this;
+ this._ownerNode = t, this._dragBehaviorA.onDragStartObservable.add(function(n) {
+ e._dragBehaviorA.dragging && e._dragBehaviorB.dragging && (e._dragBehaviorA.currentDraggingPointerID == e._dragBehaviorB.currentDraggingPointerID ? e._dragBehaviorA.releaseDrag() : (e._initialScale.copyFrom(t.scaling), e._startDistance = e._getCurrentDistance()));
+ }), this._dragBehaviorB.onDragStartObservable.add(function(n) {
+ e._dragBehaviorA.dragging && e._dragBehaviorB.dragging && (e._dragBehaviorA.currentDraggingPointerID == e._dragBehaviorB.currentDraggingPointerID ? e._dragBehaviorB.releaseDrag() : (e._initialScale.copyFrom(t.scaling), e._startDistance = e._getCurrentDistance()));
+ }), [this._dragBehaviorA, this._dragBehaviorB].forEach(function(n) {
+ n.onDragObservable.add(function() {
+ if (e._dragBehaviorA.dragging && e._dragBehaviorB.dragging) {
+ var i = e._getCurrentDistance() / e._startDistance;
+ e._initialScale.scaleToRef(i, e._targetScale);
+ }
+ });
+ }), t.addBehavior(this._dragBehaviorA), t.addBehavior(this._dragBehaviorB), this._sceneRenderObserver = t.getScene().onBeforeRenderObservable.add(function() {
+ if (e._dragBehaviorA.dragging && e._dragBehaviorB.dragging) {
+ var n = e._targetScale.subtract(t.scaling).scaleInPlace(0.1);
+ n.length() > 0.01 && t.scaling.addInPlace(n);
+ }
+ });
+ }, r.prototype.detach = function() {
+ var t = this;
+ this._ownerNode.getScene().onBeforeRenderObservable.remove(this._sceneRenderObserver), [this._dragBehaviorA, this._dragBehaviorB].forEach(function(e) {
+ e.onDragStartObservable.clear(), e.onDragObservable.clear(), t._ownerNode.removeBehavior(e);
+ });
+ }, r;
+ }(), Nt = l(31), gt = l(24), ii = l(60), _d = function() {
+ function r() {
+ this._sceneRenderObserver = null, this._targetPosition = new c.e(0, 0, 0), this._moving = !1, this._startingOrientation = new c.b(), this._attachedToElement = !1, this.zDragFactor = 3, this.rotateDraggedObject = !0, this.dragging = !1, this.dragDeltaRatio = 0.2, this.currentDraggingPointerID = -1, this.detachCameraControls = !0, this.onDragStartObservable = new P.c(), this.onDragObservable = new P.c(), this.onDragEndObservable = new P.c();
+ }
+ return Object.defineProperty(r.prototype, "name", { get: function() {
+ return "SixDofDrag";
+ }, enumerable: !1, configurable: !0 }), r.prototype.init = function() {
+ }, Object.defineProperty(r.prototype, "_pointerCamera", { get: function() {
+ return this._scene.cameraToUseForPointers ? this._scene.cameraToUseForPointers : this._scene.activeCamera;
+ }, enumerable: !1, configurable: !0 }), r.prototype.attach = function(t) {
+ var e = this;
+ this._ownerNode = t, this._scene = this._ownerNode.getScene(), r._virtualScene || (r._virtualScene = new ge.a(this._scene.getEngine(), { virtual: !0 }), r._virtualScene.detachControl(), this._scene.getEngine().scenes.pop());
+ var n = null, i = new c.e(0, 0, 0);
+ this._virtualOriginMesh = new Nt.a("", r._virtualScene), this._virtualOriginMesh.rotationQuaternion = new c.b(), this._virtualDragMesh = new Nt.a("", r._virtualScene), this._virtualDragMesh.rotationQuaternion = new c.b(), this._pointerObserver = this._scene.onPointerObservable.add(function(a, s) {
+ if (a.type == Et.a.POINTERDOWN) {
+ if (!e.dragging && a.pickInfo && a.pickInfo.hit && a.pickInfo.pickedMesh && a.pickInfo.ray && (I = a.pickInfo.pickedMesh, e._ownerNode == I || I.isDescendantOf(e._ownerNode))) {
+ e._pointerCamera && e._pointerCamera.cameraRigMode == gt.a.RIG_MODE_NONE && a.pickInfo.ray.origin.copyFrom(e._pointerCamera.globalPosition), n = e._ownerNode, ii.a._RemoveAndStorePivotPoint(n), i.copyFrom(a.pickInfo.ray.origin), e._virtualOriginMesh.position.copyFrom(a.pickInfo.ray.origin), e._virtualOriginMesh.lookAt(a.pickInfo.ray.origin.add(a.pickInfo.ray.direction)), e._virtualOriginMesh.removeChild(e._virtualDragMesh), n.computeWorldMatrix(), e._virtualDragMesh.position.copyFrom(n.absolutePosition), n.rotationQuaternion || (n.rotationQuaternion = c.b.RotationYawPitchRoll(n.rotation.y, n.rotation.x, n.rotation.z));
+ var p = n.parent;
+ n.setParent(null), e._virtualDragMesh.rotationQuaternion.copyFrom(n.rotationQuaternion), n.setParent(p), e._virtualOriginMesh.addChild(e._virtualDragMesh), e._targetPosition.copyFrom(e._virtualDragMesh.absolutePosition), e.dragging = !0, e.currentDraggingPointerID = a.event.pointerId, e.detachCameraControls && e._pointerCamera && !e._pointerCamera.leftCamera && (e._pointerCamera.inputs.attachedToElement ? (e._pointerCamera.detachControl(), e._attachedToElement = !0) : e._attachedToElement = !1), ii.a._RestorePivotPoint(n), e.onDragStartObservable.notifyObservers({});
+ }
+ } else if (a.type == Et.a.POINTERUP || a.type == Et.a.POINTERDOUBLETAP)
+ e.currentDraggingPointerID == a.event.pointerId && (e.dragging = !1, e._moving = !1, e.currentDraggingPointerID = -1, n = null, e._virtualOriginMesh.removeChild(e._virtualDragMesh), e.detachCameraControls && e._attachedToElement && e._pointerCamera && !e._pointerCamera.leftCamera && (e._pointerCamera.attachControl(!0), e._attachedToElement = !1), e.onDragEndObservable.notifyObservers({}));
+ else if (a.type == Et.a.POINTERMOVE && e.currentDraggingPointerID == a.event.pointerId && e.dragging && a.pickInfo && a.pickInfo.ray && n) {
+ var m = e.zDragFactor;
+ e._pointerCamera && e._pointerCamera.cameraRigMode == gt.a.RIG_MODE_NONE && (a.pickInfo.ray.origin.copyFrom(e._pointerCamera.globalPosition), m = 0);
+ var S = a.pickInfo.ray.origin.subtract(i);
+ i.copyFrom(a.pickInfo.ray.origin);
+ var O = -c.e.Dot(S, a.pickInfo.ray.direction);
+ e._virtualOriginMesh.addChild(e._virtualDragMesh), e._virtualDragMesh.position.z -= e._virtualDragMesh.position.z < 1 ? O * e.zDragFactor : O * m * e._virtualDragMesh.position.z, e._virtualDragMesh.position.z < 0 && (e._virtualDragMesh.position.z = 0), e._virtualOriginMesh.position.copyFrom(a.pickInfo.ray.origin), e._virtualOriginMesh.lookAt(a.pickInfo.ray.origin.add(a.pickInfo.ray.direction)), e._virtualOriginMesh.removeChild(e._virtualDragMesh), e._targetPosition.copyFrom(e._virtualDragMesh.absolutePosition), n.parent && c.e.TransformCoordinatesToRef(e._targetPosition, c.a.Invert(n.parent.getWorldMatrix()), e._targetPosition), e._moving || e._startingOrientation.copyFrom(e._virtualDragMesh.rotationQuaternion), e._moving = !0;
+ }
+ var I;
+ });
+ var o = new c.b();
+ this._sceneRenderObserver = t.getScene().onBeforeRenderObservable.add(function() {
+ if (e.dragging && e._moving && n) {
+ if (ii.a._RemoveAndStorePivotPoint(n), n.position.addInPlace(e._targetPosition.subtract(n.position).scale(e.dragDeltaRatio)), e.rotateDraggedObject) {
+ o.copyFrom(e._startingOrientation), o.x = -o.x, o.y = -o.y, o.z = -o.z, e._virtualDragMesh.rotationQuaternion.multiplyToRef(o, o), c.b.RotationYawPitchRollToRef(o.toEulerAngles("xyz").y, 0, 0, o), o.multiplyToRef(e._startingOrientation, o);
+ var a = n.parent;
+ (!a || a.scaling && !a.scaling.isNonUniformWithinEpsilon(1e-3)) && (n.setParent(null), c.b.SlerpToRef(n.rotationQuaternion, o, e.dragDeltaRatio, n.rotationQuaternion), n.setParent(a));
+ }
+ ii.a._RestorePivotPoint(n), e.onDragObservable.notifyObservers();
+ }
+ });
+ }, r.prototype.detach = function() {
+ this._scene && (this.detachCameraControls && this._attachedToElement && this._pointerCamera && !this._pointerCamera.leftCamera && (this._pointerCamera.attachControl(!0), this._attachedToElement = !1), this._scene.onPointerObservable.remove(this._pointerObserver)), this._ownerNode && this._ownerNode.getScene().onBeforeRenderObservable.remove(this._sceneRenderObserver), this._virtualOriginMesh && this._virtualOriginMesh.dispose(), this._virtualDragMesh && this._virtualDragMesh.dispose(), this.onDragEndObservable.clear(), this.onDragObservable.clear(), this.onDragStartObservable.clear();
+ }, r;
+ }(), Jv = function() {
+ function r(t, e, n) {
+ if (this.targetPosition = c.e.Zero(), this.poleTargetPosition = c.e.Zero(), this.poleTargetLocalOffset = c.e.Zero(), this.poleAngle = 0, this.slerpAmount = 1, this._bone1Quat = c.b.Identity(), this._bone1Mat = c.a.Identity(), this._bone2Ang = Math.PI, this._maxAngle = Math.PI, this._rightHandedSystem = !1, this._bendAxis = c.e.Right(), this._slerping = !1, this._adjustRoll = 0, this._bone2 = e, this._bone1 = e.getParent(), this._bone1) {
+ this.mesh = t;
+ var i = e.getPosition();
+ if (e.getAbsoluteTransform().determinant() > 0 && (this._rightHandedSystem = !0, this._bendAxis.x = 0, this._bendAxis.y = 0, this._bendAxis.z = -1, i.x > i.y && i.x > i.z && (this._adjustRoll = 0.5 * Math.PI, this._bendAxis.z = 1)), this._bone1.length) {
+ var o = this._bone1.getScale(), a = this._bone2.getScale();
+ this._bone1Length = this._bone1.length * o.y * this.mesh.scaling.y, this._bone2Length = this._bone2.length * a.y * this.mesh.scaling.y;
+ } else if (this._bone1.children[0]) {
+ t.computeWorldMatrix(!0);
+ var s = this._bone2.children[0].getAbsolutePosition(t), p = this._bone2.getAbsolutePosition(t), m = this._bone1.getAbsolutePosition(t);
+ this._bone1Length = c.e.Distance(s, p), this._bone2Length = c.e.Distance(p, m);
+ }
+ this._bone1.getRotationMatrixToRef(Se.c.WORLD, t, this._bone1Mat), this.maxAngle = Math.PI, n && (n.targetMesh && (this.targetMesh = n.targetMesh, this.targetMesh.computeWorldMatrix(!0)), n.poleTargetMesh ? (this.poleTargetMesh = n.poleTargetMesh, this.poleTargetMesh.computeWorldMatrix(!0)) : n.poleTargetBone ? this.poleTargetBone = n.poleTargetBone : this._bone1.getParent() && (this.poleTargetBone = this._bone1.getParent()), n.poleTargetLocalOffset && this.poleTargetLocalOffset.copyFrom(n.poleTargetLocalOffset), n.poleAngle && (this.poleAngle = n.poleAngle), n.bendAxis && this._bendAxis.copyFrom(n.bendAxis), n.maxAngle && (this.maxAngle = n.maxAngle), n.slerpAmount && (this.slerpAmount = n.slerpAmount));
+ }
+ }
+ return Object.defineProperty(r.prototype, "maxAngle", { get: function() {
+ return this._maxAngle;
+ }, set: function(t) {
+ this._setMaxAngle(t);
+ }, enumerable: !1, configurable: !0 }), r.prototype._setMaxAngle = function(t) {
+ t < 0 && (t = 0), (t > Math.PI || t == null) && (t = Math.PI), this._maxAngle = t;
+ var e = this._bone1Length, n = this._bone2Length;
+ this._maxReach = Math.sqrt(e * e + n * n - 2 * e * n * Math.cos(t));
+ }, r.prototype.update = function() {
+ var t = this._bone1;
+ if (t) {
+ var e = this.targetPosition, n = this.poleTargetPosition, i = r._tmpMats[0], o = r._tmpMats[1];
+ this.targetMesh && e.copyFrom(this.targetMesh.getAbsolutePosition()), this.poleTargetBone ? this.poleTargetBone.getAbsolutePositionFromLocalToRef(this.poleTargetLocalOffset, this.mesh, n) : this.poleTargetMesh && c.e.TransformCoordinatesToRef(this.poleTargetLocalOffset, this.poleTargetMesh.getWorldMatrix(), n);
+ var a = r._tmpVecs[0], s = r._tmpVecs[1], p = r._tmpVecs[2], m = r._tmpVecs[3], S = r._tmpVecs[4], O = r._tmpQuat;
+ t.getAbsolutePositionToRef(this.mesh, a), n.subtractToRef(a, S), S.x == 0 && S.y == 0 && S.z == 0 ? S.y = 1 : S.normalize(), e.subtractToRef(a, m), m.normalize(), c.e.CrossToRef(m, S, s), s.normalize(), c.e.CrossToRef(m, s, p), p.normalize(), c.a.FromXYZAxesToRef(p, m, s, i);
+ var I = this._bone1Length, G = this._bone2Length, k = c.e.Distance(a, e);
+ this._maxReach > 0 && (k = Math.min(this._maxReach, k));
+ var K = (G * G + k * k - I * I) / (2 * G * k), re = (k * k + I * I - G * G) / (2 * k * I);
+ K > 1 && (K = 1), re > 1 && (re = 1), K < -1 && (K = -1), re < -1 && (re = -1);
+ var se = Math.acos(K), ue = Math.acos(re), he = -se - ue;
+ if (this._rightHandedSystem)
+ c.a.RotationYawPitchRollToRef(0, 0, this._adjustRoll, o), o.multiplyToRef(i, i), c.a.RotationAxisToRef(this._bendAxis, ue, o), o.multiplyToRef(i, i);
+ else {
+ var pe = r._tmpVecs[5];
+ pe.copyFrom(this._bendAxis), pe.x *= -1, c.a.RotationAxisToRef(pe, -ue, o), o.multiplyToRef(i, i);
+ }
+ this.poleAngle && (c.a.RotationAxisToRef(m, this.poleAngle, o), i.multiplyToRef(o, i)), this._bone1 && (this.slerpAmount < 1 ? (this._slerping || c.b.FromRotationMatrixToRef(this._bone1Mat, this._bone1Quat), c.b.FromRotationMatrixToRef(i, O), c.b.SlerpToRef(this._bone1Quat, O, this.slerpAmount, this._bone1Quat), he = this._bone2Ang * (1 - this.slerpAmount) + he * this.slerpAmount, this._bone1.setRotationQuaternion(this._bone1Quat, Se.c.WORLD, this.mesh), this._slerping = !0) : (this._bone1.setRotationMatrix(i, Se.c.WORLD, this.mesh), this._bone1Mat.copyFrom(i), this._slerping = !1)), this._bone2.setAxisAngle(this._bendAxis, he, Se.c.LOCAL), this._bone2Ang = he;
+ }
+ }, r._tmpVecs = [c.e.Zero(), c.e.Zero(), c.e.Zero(), c.e.Zero(), c.e.Zero(), c.e.Zero()], r._tmpQuat = c.b.Identity(), r._tmpMats = [c.a.Identity(), c.a.Identity()], r;
+ }(), $v = function() {
+ function r(t, e, n, i) {
+ if (this.upAxis = c.e.Up(), this.upAxisSpace = Se.c.LOCAL, this.adjustYaw = 0, this.adjustPitch = 0, this.adjustRoll = 0, this.slerpAmount = 1, this._boneQuat = c.b.Identity(), this._slerping = !1, this._firstFrameSkipped = !1, this._fowardAxis = c.e.Forward(), this.mesh = t, this.bone = e, this.target = n, i && (i.adjustYaw && (this.adjustYaw = i.adjustYaw), i.adjustPitch && (this.adjustPitch = i.adjustPitch), i.adjustRoll && (this.adjustRoll = i.adjustRoll), i.maxYaw != null ? this.maxYaw = i.maxYaw : this.maxYaw = Math.PI, i.minYaw != null ? this.minYaw = i.minYaw : this.minYaw = -Math.PI, i.maxPitch != null ? this.maxPitch = i.maxPitch : this.maxPitch = Math.PI, i.minPitch != null ? this.minPitch = i.minPitch : this.minPitch = -Math.PI, i.slerpAmount != null && (this.slerpAmount = i.slerpAmount), i.upAxis != null && (this.upAxis = i.upAxis), i.upAxisSpace != null && (this.upAxisSpace = i.upAxisSpace), i.yawAxis != null || i.pitchAxis != null)) {
+ var o = Se.a.Y, a = Se.a.X;
+ i.yawAxis != null && (o = i.yawAxis.clone()).normalize(), i.pitchAxis != null && (a = i.pitchAxis.clone()).normalize();
+ var s = c.e.Cross(a, o);
+ this._transformYawPitch = c.a.Identity(), c.a.FromXYZAxesToRef(a, o, s, this._transformYawPitch), this._transformYawPitchInv = this._transformYawPitch.clone(), this._transformYawPitch.invert();
+ }
+ e.getParent() || this.upAxisSpace != Se.c.BONE || (this.upAxisSpace = Se.c.LOCAL);
+ }
+ return Object.defineProperty(r.prototype, "minYaw", { get: function() {
+ return this._minYaw;
+ }, set: function(t) {
+ this._minYaw = t, this._minYawSin = Math.sin(t), this._minYawCos = Math.cos(t), this._maxYaw != null && (this._midYawConstraint = 0.5 * this._getAngleDiff(this._minYaw, this._maxYaw) + this._minYaw, this._yawRange = this._maxYaw - this._minYaw);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "maxYaw", { get: function() {
+ return this._maxYaw;
+ }, set: function(t) {
+ this._maxYaw = t, this._maxYawSin = Math.sin(t), this._maxYawCos = Math.cos(t), this._minYaw != null && (this._midYawConstraint = 0.5 * this._getAngleDiff(this._minYaw, this._maxYaw) + this._minYaw, this._yawRange = this._maxYaw - this._minYaw);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "minPitch", { get: function() {
+ return this._minPitch;
+ }, set: function(t) {
+ this._minPitch = t, this._minPitchTan = Math.tan(t);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "maxPitch", { get: function() {
+ return this._maxPitch;
+ }, set: function(t) {
+ this._maxPitch = t, this._maxPitchTan = Math.tan(t);
+ }, enumerable: !1, configurable: !0 }), r.prototype.update = function() {
+ if (this.slerpAmount < 1 && !this._firstFrameSkipped)
+ this._firstFrameSkipped = !0;
+ else {
+ var t = this.bone, e = r._tmpVecs[0];
+ t.getAbsolutePositionToRef(this.mesh, e);
+ var n = this.target, i = r._tmpMats[0], o = r._tmpMats[1], a = this.mesh, s = t.getParent(), p = r._tmpVecs[1];
+ p.copyFrom(this.upAxis), this.upAxisSpace == Se.c.BONE && s ? (this._transformYawPitch && c.e.TransformCoordinatesToRef(p, this._transformYawPitchInv, p), s.getDirectionToRef(p, this.mesh, p)) : this.upAxisSpace == Se.c.LOCAL && (a.getDirectionToRef(p, p), a.scaling.x == 1 && a.scaling.y == 1 && a.scaling.z == 1 || p.normalize());
+ var m = !1, S = !1;
+ if (this._maxYaw == Math.PI && this._minYaw == -Math.PI || (m = !0), this._maxPitch == Math.PI && this._minPitch == -Math.PI || (S = !0), m || S) {
+ var O = r._tmpMats[2], I = r._tmpMats[3];
+ if (this.upAxisSpace == Se.c.BONE && p.y == 1 && s)
+ s.getRotationMatrixToRef(Se.c.WORLD, this.mesh, O);
+ else if (this.upAxisSpace != Se.c.LOCAL || p.y != 1 || s) {
+ (k = r._tmpVecs[2]).copyFrom(this._fowardAxis), this._transformYawPitch && c.e.TransformCoordinatesToRef(k, this._transformYawPitchInv, k), s ? s.getDirectionToRef(k, this.mesh, k) : a.getDirectionToRef(k, k);
+ var G = c.e.Cross(p, k);
+ G.normalize();
+ var k = c.e.Cross(G, p);
+ c.a.FromXYZAxesToRef(G, p, k, O);
+ } else
+ O.copyFrom(a.getWorldMatrix());
+ O.invertToRef(I);
+ var K = null;
+ if (S) {
+ var re = r._tmpVecs[3];
+ n.subtractToRef(e, re), c.e.TransformCoordinatesToRef(re, I, re), K = Math.sqrt(re.x * re.x + re.z * re.z);
+ var se = Math.atan2(re.y, K), ue = se;
+ se > this._maxPitch ? (re.y = this._maxPitchTan * K, ue = this._maxPitch) : se < this._minPitch && (re.y = this._minPitchTan * K, ue = this._minPitch), se != ue && (c.e.TransformCoordinatesToRef(re, O, re), re.addInPlace(e), n = re);
+ }
+ if (m) {
+ re = r._tmpVecs[4], n.subtractToRef(e, re), c.e.TransformCoordinatesToRef(re, I, re);
+ var he = Math.atan2(re.x, re.z), pe = he;
+ if ((he > this._maxYaw || he < this._minYaw) && (K == null && (K = Math.sqrt(re.x * re.x + re.z * re.z)), this._yawRange > Math.PI ? this._isAngleBetween(he, this._maxYaw, this._midYawConstraint) ? (re.z = this._maxYawCos * K, re.x = this._maxYawSin * K, pe = this._maxYaw) : this._isAngleBetween(he, this._midYawConstraint, this._minYaw) && (re.z = this._minYawCos * K, re.x = this._minYawSin * K, pe = this._minYaw) : he > this._maxYaw ? (re.z = this._maxYawCos * K, re.x = this._maxYawSin * K, pe = this._maxYaw) : he < this._minYaw && (re.z = this._minYawCos * K, re.x = this._minYawSin * K, pe = this._minYaw)), this._slerping && this._yawRange > Math.PI) {
+ var ve = r._tmpVecs[8];
+ ve.copyFrom(Se.a.Z), this._transformYawPitch && c.e.TransformCoordinatesToRef(ve, this._transformYawPitchInv, ve);
+ var Ee = r._tmpMats[4];
+ this._boneQuat.toRotationMatrix(Ee), this.mesh.getWorldMatrix().multiplyToRef(Ee, Ee), c.e.TransformCoordinatesToRef(ve, Ee, ve), c.e.TransformCoordinatesToRef(ve, I, ve);
+ var Ae = Math.atan2(ve.x, ve.z);
+ if (this._getAngleBetween(Ae, he) > this._getAngleBetween(Ae, this._midYawConstraint)) {
+ K == null && (K = Math.sqrt(re.x * re.x + re.z * re.z));
+ var Ie = this._getAngleBetween(Ae, this._maxYaw);
+ this._getAngleBetween(Ae, this._minYaw) < Ie ? (pe = Ae + 0.75 * Math.PI, re.z = Math.cos(pe) * K, re.x = Math.sin(pe) * K) : (pe = Ae - 0.75 * Math.PI, re.z = Math.cos(pe) * K, re.x = Math.sin(pe) * K);
+ }
+ }
+ he != pe && (c.e.TransformCoordinatesToRef(re, O, re), re.addInPlace(e), n = re);
+ }
+ }
+ var xe = r._tmpVecs[5], Pe = r._tmpVecs[6], Ce = r._tmpVecs[7], Fe = r._tmpQuat;
+ n.subtractToRef(e, xe), xe.normalize(), c.e.CrossToRef(p, xe, Pe), Pe.normalize(), c.e.CrossToRef(xe, Pe, Ce), Ce.normalize(), c.a.FromXYZAxesToRef(Pe, Ce, xe, i), Pe.x === 0 && Pe.y === 0 && Pe.z === 0 || Ce.x === 0 && Ce.y === 0 && Ce.z === 0 || xe.x === 0 && xe.y === 0 && xe.z === 0 || ((this.adjustYaw || this.adjustPitch || this.adjustRoll) && (c.a.RotationYawPitchRollToRef(this.adjustYaw, this.adjustPitch, this.adjustRoll, o), o.multiplyToRef(i, i)), this.slerpAmount < 1 ? (this._slerping || this.bone.getRotationQuaternionToRef(Se.c.WORLD, this.mesh, this._boneQuat), this._transformYawPitch && this._transformYawPitch.multiplyToRef(i, i), c.b.FromRotationMatrixToRef(i, Fe), c.b.SlerpToRef(this._boneQuat, Fe, this.slerpAmount, this._boneQuat), this.bone.setRotationQuaternion(this._boneQuat, Se.c.WORLD, this.mesh), this._slerping = !0) : (this._transformYawPitch && this._transformYawPitch.multiplyToRef(i, i), this.bone.setRotationMatrix(i, Se.c.WORLD, this.mesh), this._slerping = !1));
+ }
+ }, r.prototype._getAngleDiff = function(t, e) {
+ var n = e - t;
+ return (n %= 2 * Math.PI) > Math.PI ? n -= 2 * Math.PI : n < -Math.PI && (n += 2 * Math.PI), n;
+ }, r.prototype._getAngleBetween = function(t, e) {
+ var n = 0;
+ return (n = (t = (t %= 2 * Math.PI) < 0 ? t + 2 * Math.PI : t) < (e = (e %= 2 * Math.PI) < 0 ? e + 2 * Math.PI : e) ? e - t : t - e) > Math.PI && (n = 2 * Math.PI - n), n;
+ }, r.prototype._isAngleBetween = function(t, e, n) {
+ if (t = (t %= 2 * Math.PI) < 0 ? t + 2 * Math.PI : t, (e = (e %= 2 * Math.PI) < 0 ? e + 2 * Math.PI : e) < (n = (n %= 2 * Math.PI) < 0 ? n + 2 * Math.PI : n)) {
+ if (t > e && t < n)
+ return !0;
+ } else if (t > n && t < e)
+ return !0;
+ return !1;
+ }, r._tmpVecs = Re.a.BuildArray(10, c.e.Zero), r._tmpQuat = c.b.Identity(), r._tmpMats = Re.a.BuildArray(5, c.a.Identity), r;
+ }(), Ue = l(10), Rt = l(27), Gt = l(26);
+ function md(r, t, e, n) {
+ var i;
+ i = n === d.a.TEXTURETYPE_FLOAT ? new Float32Array(t * e * 4) : new Uint32Array(t * e * 4);
+ for (var o = 0; o < t; o++)
+ for (var a = 0; a < e; a++) {
+ var s = 3 * (a * t + o), p = 4 * (a * t + o);
+ i[p + 0] = r[s + 0], i[p + 1] = r[s + 1], i[p + 2] = r[s + 2], i[p + 3] = 1;
+ }
+ return i;
+ }
+ function gd(r) {
+ return function(t, e, n, i, o, a, s, p, m, S) {
+ m === void 0 && (m = null), S === void 0 && (S = d.a.TEXTURETYPE_UNSIGNED_INT);
+ var O = r ? this._gl.TEXTURE_3D : this._gl.TEXTURE_2D_ARRAY, I = r ? Rt.b.Raw3D : Rt.b.Raw2DArray, G = new Rt.a(this, I);
+ G.baseWidth = e, G.baseHeight = n, G.baseDepth = i, G.width = e, G.height = n, G.depth = i, G.format = o, G.type = S, G.generateMipMaps = a, G.samplingMode = p, r ? G.is3D = !0 : G.is2DArray = !0, this._doNotHandleContextLost || (G._bufferView = t), r ? this.updateRawTexture3D(G, t, o, s, m, S) : this.updateRawTexture2DArray(G, t, o, s, m, S), this._bindTextureDirectly(O, G, !0);
+ var k = this._getSamplingParameters(p, a);
+ return this._gl.texParameteri(O, this._gl.TEXTURE_MAG_FILTER, k.mag), this._gl.texParameteri(O, this._gl.TEXTURE_MIN_FILTER, k.min), a && this._gl.generateMipmap(O), this._bindTextureDirectly(O, null), this._internalTexturesCache.push(G), G;
+ };
+ }
+ function vd(r) {
+ return function(t, e, n, i, o, a) {
+ o === void 0 && (o = null), a === void 0 && (a = d.a.TEXTURETYPE_UNSIGNED_INT);
+ var s = r ? this._gl.TEXTURE_3D : this._gl.TEXTURE_2D_ARRAY, p = this._getWebGLTextureType(a), m = this._getInternalFormat(n), S = this._getRGBABufferInternalSizedFormat(a, n);
+ this._bindTextureDirectly(s, t, !0), this._unpackFlipY(i === void 0 || !!i), this._doNotHandleContextLost || (t._bufferView = e, t.format = n, t.invertY = i, t._compression = o), t.width % 4 != 0 && this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1), o && e ? this._gl.compressedTexImage3D(s, 0, this.getCaps().s3tc[o], t.width, t.height, t.depth, 0, e) : this._gl.texImage3D(s, 0, S, t.width, t.height, t.depth, 0, m, p, e), t.generateMipMaps && this._gl.generateMipmap(s), this._bindTextureDirectly(s, null), t.isReady = !0;
+ };
+ }
+ Gt.a.prototype.updateRawTexture = function(r, t, e, n, i, o) {
+ if (i === void 0 && (i = null), o === void 0 && (o = d.a.TEXTURETYPE_UNSIGNED_INT), r) {
+ var a = this._getRGBABufferInternalSizedFormat(o, e), s = this._getInternalFormat(e), p = this._getWebGLTextureType(o);
+ this._bindTextureDirectly(this._gl.TEXTURE_2D, r, !0), this._unpackFlipY(n === void 0 || !!n), this._doNotHandleContextLost || (r._bufferView = t, r.format = e, r.type = o, r.invertY = n, r._compression = i), r.width % 4 != 0 && this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1), i && t ? this._gl.compressedTexImage2D(this._gl.TEXTURE_2D, 0, this.getCaps().s3tc[i], r.width, r.height, 0, t) : this._gl.texImage2D(this._gl.TEXTURE_2D, 0, a, r.width, r.height, 0, s, p, t), r.generateMipMaps && this._gl.generateMipmap(this._gl.TEXTURE_2D), this._bindTextureDirectly(this._gl.TEXTURE_2D, null), r.isReady = !0;
+ }
+ }, Gt.a.prototype.createRawTexture = function(r, t, e, n, i, o, a, s, p) {
+ s === void 0 && (s = null), p === void 0 && (p = d.a.TEXTURETYPE_UNSIGNED_INT);
+ var m = new Rt.a(this, Rt.b.Raw);
+ m.baseWidth = t, m.baseHeight = e, m.width = t, m.height = e, m.format = n, m.generateMipMaps = i, m.samplingMode = a, m.invertY = o, m._compression = s, m.type = p, this._doNotHandleContextLost || (m._bufferView = r), this.updateRawTexture(m, r, n, o, s, p), this._bindTextureDirectly(this._gl.TEXTURE_2D, m, !0);
+ var S = this._getSamplingParameters(a, i);
+ return this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, S.mag), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, S.min), i && this._gl.generateMipmap(this._gl.TEXTURE_2D), this._bindTextureDirectly(this._gl.TEXTURE_2D, null), this._internalTexturesCache.push(m), m;
+ }, Gt.a.prototype.createRawCubeTexture = function(r, t, e, n, i, o, a, s) {
+ s === void 0 && (s = null);
+ var p = this._gl, m = new Rt.a(this, Rt.b.CubeRaw);
+ m.isCube = !0, m.format = e, m.type = n, this._doNotHandleContextLost || (m._bufferViewArray = r);
+ var S = this._getWebGLTextureType(n), O = this._getInternalFormat(e);
+ O === p.RGB && (O = p.RGBA), S !== p.FLOAT || this._caps.textureFloatLinearFiltering ? S !== this._gl.HALF_FLOAT_OES || this._caps.textureHalfFloatLinearFiltering ? S !== p.FLOAT || this._caps.textureFloatRender ? S !== p.HALF_FLOAT || this._caps.colorBufferFloat || (i = !1, h.a.Warn("Render to half float textures is not supported. Mipmap generation forced to false.")) : (i = !1, h.a.Warn("Render to float textures is not supported. Mipmap generation forced to false.")) : (i = !1, a = d.a.TEXTURE_NEAREST_SAMPLINGMODE, h.a.Warn("Half float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.")) : (i = !1, a = d.a.TEXTURE_NEAREST_SAMPLINGMODE, h.a.Warn("Float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively."));
+ var I = t, G = I;
+ m.width = I, m.height = G, !this.needPOTTextures || Ke.b.IsExponentOfTwo(m.width) && Ke.b.IsExponentOfTwo(m.height) || (i = !1), r && this.updateRawCubeTexture(m, r, e, n, o, s), this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, m, !0), r && i && this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);
+ var k = this._getSamplingParameters(a, i);
+ return p.texParameteri(p.TEXTURE_CUBE_MAP, p.TEXTURE_MAG_FILTER, k.mag), p.texParameteri(p.TEXTURE_CUBE_MAP, p.TEXTURE_MIN_FILTER, k.min), p.texParameteri(p.TEXTURE_CUBE_MAP, p.TEXTURE_WRAP_S, p.CLAMP_TO_EDGE), p.texParameteri(p.TEXTURE_CUBE_MAP, p.TEXTURE_WRAP_T, p.CLAMP_TO_EDGE), this._bindTextureDirectly(p.TEXTURE_CUBE_MAP, null), m.generateMipMaps = i, m;
+ }, Gt.a.prototype.updateRawCubeTexture = function(r, t, e, n, i, o, a) {
+ o === void 0 && (o = null), a === void 0 && (a = 0), r._bufferViewArray = t, r.format = e, r.type = n, r.invertY = i, r._compression = o;
+ var s = this._gl, p = this._getWebGLTextureType(n), m = this._getInternalFormat(e), S = this._getRGBABufferInternalSizedFormat(n), O = !1;
+ m === s.RGB && (m = s.RGBA, O = !0), this._bindTextureDirectly(s.TEXTURE_CUBE_MAP, r, !0), this._unpackFlipY(i === void 0 || !!i), r.width % 4 != 0 && s.pixelStorei(s.UNPACK_ALIGNMENT, 1);
+ for (var I = 0; I < 6; I++) {
+ var G = t[I];
+ o ? s.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X + I, a, this.getCaps().s3tc[o], r.width, r.height, 0, G) : (O && (G = md(G, r.width, r.height, n)), s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X + I, a, S, r.width, r.height, 0, m, p, G));
+ }
+ (!this.needPOTTextures || Ke.b.IsExponentOfTwo(r.width) && Ke.b.IsExponentOfTwo(r.height)) && r.generateMipMaps && a === 0 && this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP), this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null), r.isReady = !0;
+ }, Gt.a.prototype.createRawCubeTextureFromUrl = function(r, t, e, n, i, o, a, s, p, m, S, O) {
+ var I = this;
+ p === void 0 && (p = null), m === void 0 && (m = null), S === void 0 && (S = d.a.TEXTURE_TRILINEAR_SAMPLINGMODE), O === void 0 && (O = !1);
+ var G = this._gl, k = this.createRawCubeTexture(null, e, n, i, !o, O, S, null);
+ return t == null || t._addPendingData(k), k.url = r, this._internalTexturesCache.push(k), this._loadFile(r, function(K) {
+ (function(re) {
+ var se = k.width, ue = a(re);
+ if (ue) {
+ if (s) {
+ var he = I._getWebGLTextureType(i), pe = I._getInternalFormat(n), ve = I._getRGBABufferInternalSizedFormat(i), Ee = !1;
+ pe === G.RGB && (pe = G.RGBA, Ee = !0), I._bindTextureDirectly(G.TEXTURE_CUBE_MAP, k, !0), I._unpackFlipY(!1);
+ for (var Ae = s(ue), Ie = 0; Ie < Ae.length; Ie++)
+ for (var xe = se >> Ie, Pe = 0; Pe < 6; Pe++) {
+ var Ce = Ae[Ie][Pe];
+ Ee && (Ce = md(Ce, xe, xe, i)), G.texImage2D(Pe, Ie, ve, xe, xe, 0, pe, he, Ce);
+ }
+ I._bindTextureDirectly(G.TEXTURE_CUBE_MAP, null);
+ } else
+ I.updateRawCubeTexture(k, ue, n, i, O);
+ k.isReady = !0, t == null || t._removePendingData(k), p && p();
+ }
+ })(K);
+ }, void 0, t == null ? void 0 : t.offlineProvider, !0, function(K, re) {
+ t == null || t._removePendingData(k), m && K && m(K.status + " " + K.statusText, re);
+ }), k;
+ }, Gt.a.prototype.createRawTexture2DArray = gd(!1), Gt.a.prototype.createRawTexture3D = gd(!0), Gt.a.prototype.updateRawTexture2DArray = vd(!1), Gt.a.prototype.updateRawTexture3D = vd(!0);
+ var Ti = function(r) {
+ function t(e, n, i, o, a, s, p, m, S) {
+ s === void 0 && (s = !0), p === void 0 && (p = !1), m === void 0 && (m = d.a.TEXTURE_TRILINEAR_SAMPLINGMODE), S === void 0 && (S = d.a.TEXTURETYPE_UNSIGNED_INT);
+ var O = r.call(this, null, a, !s, p) || this;
+ return O.format = o, O._engine && (O._texture = O._engine.createRawTexture(e, n, i, o, s, p, m, null, S), O.wrapU = Ue.a.CLAMP_ADDRESSMODE, O.wrapV = Ue.a.CLAMP_ADDRESSMODE), O;
+ }
+ return Object(u.d)(t, r), t.prototype.update = function(e) {
+ this._getEngine().updateRawTexture(this._texture, e, this._texture.format, this._texture.invertY, null, this._texture.type);
+ }, t.CreateLuminanceTexture = function(e, n, i, o, a, s, p) {
+ return a === void 0 && (a = !0), s === void 0 && (s = !1), p === void 0 && (p = d.a.TEXTURE_TRILINEAR_SAMPLINGMODE), new t(e, n, i, d.a.TEXTUREFORMAT_LUMINANCE, o, a, s, p);
+ }, t.CreateLuminanceAlphaTexture = function(e, n, i, o, a, s, p) {
+ return a === void 0 && (a = !0), s === void 0 && (s = !1), p === void 0 && (p = d.a.TEXTURE_TRILINEAR_SAMPLINGMODE), new t(e, n, i, d.a.TEXTUREFORMAT_LUMINANCE_ALPHA, o, a, s, p);
+ }, t.CreateAlphaTexture = function(e, n, i, o, a, s, p) {
+ return a === void 0 && (a = !0), s === void 0 && (s = !1), p === void 0 && (p = d.a.TEXTURE_TRILINEAR_SAMPLINGMODE), new t(e, n, i, d.a.TEXTUREFORMAT_ALPHA, o, a, s, p);
+ }, t.CreateRGBTexture = function(e, n, i, o, a, s, p, m) {
+ return a === void 0 && (a = !0), s === void 0 && (s = !1), p === void 0 && (p = d.a.TEXTURE_TRILINEAR_SAMPLINGMODE), m === void 0 && (m = d.a.TEXTURETYPE_UNSIGNED_INT), new t(e, n, i, d.a.TEXTUREFORMAT_RGB, o, a, s, p, m);
+ }, t.CreateRGBATexture = function(e, n, i, o, a, s, p, m) {
+ return a === void 0 && (a = !0), s === void 0 && (s = !1), p === void 0 && (p = d.a.TEXTURE_TRILINEAR_SAMPLINGMODE), m === void 0 && (m = d.a.TEXTURETYPE_UNSIGNED_INT), new t(e, n, i, d.a.TEXTUREFORMAT_RGBA, o, a, s, p, m);
+ }, t.CreateRTexture = function(e, n, i, o, a, s, p, m) {
+ return a === void 0 && (a = !0), s === void 0 && (s = !1), p === void 0 && (p = Ue.a.TRILINEAR_SAMPLINGMODE), m === void 0 && (m = d.a.TEXTURETYPE_FLOAT), new t(e, n, i, d.a.TEXTUREFORMAT_R, o, a, s, p, m);
+ }, t;
+ }(Ue.a), fs = function() {
+ function r(t, e, n) {
+ this.name = t, this.id = e, this.bones = new Array(), this.needInitialSkinMatrix = !1, this.overrideMesh = null, this._isDirty = !0, this._meshesWithPoseMatrix = new Array(), this._identity = c.a.Identity(), this._ranges = {}, this._lastAbsoluteTransformsUpdateId = -1, this._canUseTextureForBones = !1, this._uniqueId = 0, this._numBonesWithLinkedTransformNode = 0, this._hasWaitingData = null, this._waitingOverrideMeshId = null, this.doNotSerialize = !1, this._useTextureToStoreBoneMatrices = !0, this._animationPropertiesOverride = null, this.onBeforeComputeObservable = new P.c(), this.bones = [], this._scene = n || te.a.LastCreatedScene, this._uniqueId = this._scene.getUniqueId(), this._scene.addSkeleton(this), this._isDirty = !0;
+ var i = this._scene.getEngine().getCaps();
+ this._canUseTextureForBones = i.textureFloat && i.maxVertexTextureImageUnits > 0;
+ }
+ return Object.defineProperty(r.prototype, "useTextureToStoreBoneMatrices", { get: function() {
+ return this._useTextureToStoreBoneMatrices;
+ }, set: function(t) {
+ this._useTextureToStoreBoneMatrices = t, this._markAsDirty();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "animationPropertiesOverride", { get: function() {
+ return this._animationPropertiesOverride ? this._animationPropertiesOverride : this._scene.animationPropertiesOverride;
+ }, set: function(t) {
+ this._animationPropertiesOverride = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "isUsingTextureForMatrices", { get: function() {
+ return this.useTextureToStoreBoneMatrices && this._canUseTextureForBones;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "uniqueId", { get: function() {
+ return this._uniqueId;
+ }, enumerable: !1, configurable: !0 }), r.prototype.getClassName = function() {
+ return "Skeleton";
+ }, r.prototype.getChildren = function() {
+ return this.bones.filter(function(t) {
+ return !t.getParent();
+ });
+ }, r.prototype.getTransformMatrices = function(t) {
+ return this.needInitialSkinMatrix && t._bonesTransformMatrices ? t._bonesTransformMatrices : (this._transformMatrices || this.prepare(), this._transformMatrices);
+ }, r.prototype.getTransformMatrixTexture = function(t) {
+ return this.needInitialSkinMatrix && t._transformMatrixTexture ? t._transformMatrixTexture : this._transformMatrixTexture;
+ }, r.prototype.getScene = function() {
+ return this._scene;
+ }, r.prototype.toString = function(t) {
+ var e = "Name: " + this.name + ", nBones: " + this.bones.length;
+ if (e += ", nAnimationRanges: " + (this._ranges ? Object.keys(this._ranges).length : "none"), t) {
+ e += ", Ranges: {";
+ var n = !0;
+ for (var i in this._ranges)
+ n && (e += ", ", n = !1), e += i;
+ e += "}";
+ }
+ return e;
+ }, r.prototype.getBoneIndexByName = function(t) {
+ for (var e = 0, n = this.bones.length; e < n; e++)
+ if (this.bones[e].name === t)
+ return e;
+ return -1;
+ }, r.prototype.createAnimationRange = function(t, e, n) {
+ if (!this._ranges[t]) {
+ this._ranges[t] = new z(t, e, n);
+ for (var i = 0, o = this.bones.length; i < o; i++)
+ this.bones[i].animations[0] && this.bones[i].animations[0].createRange(t, e, n);
+ }
+ }, r.prototype.deleteAnimationRange = function(t, e) {
+ e === void 0 && (e = !0);
+ for (var n = 0, i = this.bones.length; n < i; n++)
+ this.bones[n].animations[0] && this.bones[n].animations[0].deleteRange(t, e);
+ this._ranges[t] = null;
+ }, r.prototype.getAnimationRange = function(t) {
+ return this._ranges[t] || null;
+ }, r.prototype.getAnimationRanges = function() {
+ var t, e = [];
+ for (t in this._ranges)
+ e.push(this._ranges[t]);
+ return e;
+ }, r.prototype.copyAnimationRange = function(t, e, n) {
+ if (n === void 0 && (n = !1), this._ranges[e] || !t.getAnimationRange(e))
+ return !1;
+ var i, o, a = !0, s = this._getHighestAnimationFrame() + 1, p = {}, m = t.bones;
+ for (o = 0, i = m.length; o < i; o++)
+ p[m[o].name] = m[o];
+ this.bones.length !== m.length && (h.a.Warn("copyAnimationRange: this rig has " + this.bones.length + " bones, while source as " + m.length), a = !1);
+ var S = n && this.dimensionsAtRest && t.dimensionsAtRest ? this.dimensionsAtRest.divide(t.dimensionsAtRest) : null;
+ for (o = 0, i = this.bones.length; o < i; o++) {
+ var O = this.bones[o].name, I = p[O];
+ I ? a = a && this.bones[o].copyAnimationRange(I, e, s, n, S) : (h.a.Warn("copyAnimationRange: not same rig, missing source bone " + O), a = !1);
+ }
+ var G = t.getAnimationRange(e);
+ return G && (this._ranges[e] = new z(e, G.from + s, G.to + s)), a;
+ }, r.prototype.returnToRest = function() {
+ for (var t = c.c.Vector3[0], e = c.c.Quaternion[0], n = c.c.Vector3[1], i = 0; i < this.bones.length; i++) {
+ var o = this.bones[i];
+ o._index !== -1 && (o.returnToRest(), o._linkedTransformNode && (o.getRestPose().decompose(t, e, n), o._linkedTransformNode.position = n.clone(), o._linkedTransformNode.rotationQuaternion = e.clone(), o._linkedTransformNode.scaling = t.clone()));
+ }
+ }, r.prototype._getHighestAnimationFrame = function() {
+ for (var t = 0, e = 0, n = this.bones.length; e < n; e++)
+ if (this.bones[e].animations[0]) {
+ var i = this.bones[e].animations[0].getHighestFrame();
+ t < i && (t = i);
+ }
+ return t;
+ }, r.prototype.beginAnimation = function(t, e, n, i) {
+ var o = this.getAnimationRange(t);
+ return o ? this._scene.beginAnimation(this, o.from, o.to, e, n, i) : null;
+ }, r.MakeAnimationAdditive = function(t, e, n) {
+ e === void 0 && (e = 0);
+ var i = t.getAnimationRange(n);
+ if (!i)
+ return null;
+ for (var o = t._scene.getAllAnimatablesByTarget(t), a = null, s = 0; s < o.length; s++) {
+ var p = o[s];
+ if (p.fromFrame === (i == null ? void 0 : i.from) && p.toFrame === (i == null ? void 0 : i.to)) {
+ a = p;
+ break;
+ }
+ }
+ var m = t.getAnimatables();
+ for (s = 0; s < m.length; s++) {
+ var S = m[s].animations;
+ if (S)
+ for (var O = 0; O < S.length; O++)
+ H.MakeAnimationAdditive(S[O], e, n);
+ }
+ return a && (a.isAdditive = !0), t;
+ }, r.prototype._markAsDirty = function() {
+ this._isDirty = !0;
+ }, r.prototype._registerMeshWithPoseMatrix = function(t) {
+ this._meshesWithPoseMatrix.push(t);
+ }, r.prototype._unregisterMeshWithPoseMatrix = function(t) {
+ var e = this._meshesWithPoseMatrix.indexOf(t);
+ e > -1 && this._meshesWithPoseMatrix.splice(e, 1);
+ }, r.prototype._computeTransformMatrices = function(t, e) {
+ this.onBeforeComputeObservable.notifyObservers(this);
+ for (var n = 0; n < this.bones.length; n++) {
+ var i = this.bones[n];
+ i._childUpdateId++;
+ var o = i.getParent();
+ if (o ? i.getLocalMatrix().multiplyToRef(o.getWorldMatrix(), i.getWorldMatrix()) : e ? i.getLocalMatrix().multiplyToRef(e, i.getWorldMatrix()) : i.getWorldMatrix().copyFrom(i.getLocalMatrix()), i._index !== -1) {
+ var a = i._index === null ? n : i._index;
+ i.getInvertedAbsoluteTransform().multiplyToArray(i.getWorldMatrix(), t, 16 * a);
+ }
+ }
+ this._identity.copyToArray(t, 16 * this.bones.length);
+ }, r.prototype.prepare = function() {
+ if (this._numBonesWithLinkedTransformNode > 0)
+ for (var t = 0, e = this.bones; t < e.length; t++) {
+ var n = e[t];
+ n._linkedTransformNode && (n._linkedTransformNode.computeWorldMatrix(), n._matrix = n._linkedTransformNode._localMatrix, n.markAsDirty());
+ }
+ if (this._isDirty) {
+ if (this.needInitialSkinMatrix)
+ for (var i = 0; i < this._meshesWithPoseMatrix.length; i++) {
+ var o = this._meshesWithPoseMatrix[i], a = o.getPoseMatrix();
+ if (o._bonesTransformMatrices && o._bonesTransformMatrices.length === 16 * (this.bones.length + 1) || (o._bonesTransformMatrices = new Float32Array(16 * (this.bones.length + 1))), this._synchronizedWithMesh !== o) {
+ this._synchronizedWithMesh = o;
+ for (var s = 0; s < this.bones.length; s++) {
+ var p = this.bones[s];
+ p.getParent() || (p.getBaseMatrix().multiplyToRef(a, c.c.Matrix[1]), p._updateDifferenceMatrix(c.c.Matrix[1]));
+ }
+ if (this.isUsingTextureForMatrices) {
+ var m = 4 * (this.bones.length + 1);
+ o._transformMatrixTexture && o._transformMatrixTexture.getSize().width === m || (o._transformMatrixTexture && o._transformMatrixTexture.dispose(), o._transformMatrixTexture = Ti.CreateRGBATexture(o._bonesTransformMatrices, 4 * (this.bones.length + 1), 1, this._scene, !1, !1, d.a.TEXTURE_NEAREST_SAMPLINGMODE, d.a.TEXTURETYPE_FLOAT));
+ }
+ }
+ this._computeTransformMatrices(o._bonesTransformMatrices, a), this.isUsingTextureForMatrices && o._transformMatrixTexture && o._transformMatrixTexture.update(o._bonesTransformMatrices);
+ }
+ else
+ this._transformMatrices && this._transformMatrices.length === 16 * (this.bones.length + 1) || (this._transformMatrices = new Float32Array(16 * (this.bones.length + 1)), this.isUsingTextureForMatrices && (this._transformMatrixTexture && this._transformMatrixTexture.dispose(), this._transformMatrixTexture = Ti.CreateRGBATexture(this._transformMatrices, 4 * (this.bones.length + 1), 1, this._scene, !1, !1, d.a.TEXTURE_NEAREST_SAMPLINGMODE, d.a.TEXTURETYPE_FLOAT))), this._computeTransformMatrices(this._transformMatrices, null), this.isUsingTextureForMatrices && this._transformMatrixTexture && this._transformMatrixTexture.update(this._transformMatrices);
+ this._isDirty = !1, this._scene._activeBones.addCount(this.bones.length, !1);
+ }
+ }, r.prototype.getAnimatables = function() {
+ if (!this._animatables || this._animatables.length !== this.bones.length) {
+ this._animatables = [];
+ for (var t = 0; t < this.bones.length; t++)
+ this._animatables.push(this.bones[t]);
+ }
+ return this._animatables;
+ }, r.prototype.clone = function(t, e) {
+ var n = new r(t, e || t, this._scene);
+ n.needInitialSkinMatrix = this.needInitialSkinMatrix, n.overrideMesh = this.overrideMesh;
+ for (var i = 0; i < this.bones.length; i++) {
+ var o = this.bones[i], a = null, s = o.getParent();
+ if (s) {
+ var p = this.bones.indexOf(s);
+ a = n.bones[p];
+ }
+ var m = new Ne(o.name, n, a, o.getBaseMatrix().clone(), o.getRestPose().clone());
+ m._index = o._index, o._linkedTransformNode && m.linkTransformNode(o._linkedTransformNode), _e.a.DeepCopy(o.animations, m.animations);
+ }
+ if (this._ranges)
+ for (var S in n._ranges = {}, this._ranges) {
+ var O = this._ranges[S];
+ O && (n._ranges[S] = O.clone());
+ }
+ return this._isDirty = !0, n;
+ }, r.prototype.enableBlending = function(t) {
+ t === void 0 && (t = 0.01), this.bones.forEach(function(e) {
+ e.animations.forEach(function(n) {
+ n.enableBlending = !0, n.blendingSpeed = t;
+ });
+ });
+ }, r.prototype.dispose = function() {
+ this._meshesWithPoseMatrix = [], this.getScene().stopAnimation(this), this.getScene().removeSkeleton(this), this._transformMatrixTexture && (this._transformMatrixTexture.dispose(), this._transformMatrixTexture = null);
+ }, r.prototype.serialize = function() {
+ var t, e, n = {};
+ n.name = this.name, n.id = this.id, this.dimensionsAtRest && (n.dimensionsAtRest = this.dimensionsAtRest.asArray()), n.bones = [], n.needInitialSkinMatrix = this.needInitialSkinMatrix, n.overrideMeshId = (t = this.overrideMesh) === null || t === void 0 ? void 0 : t.id;
+ for (var i = 0; i < this.bones.length; i++) {
+ var o = this.bones[i], a = o.getParent(), s = { parentBoneIndex: a ? this.bones.indexOf(a) : -1, index: o.getIndex(), name: o.name, matrix: o.getBaseMatrix().toArray(), rest: o.getRestPose().toArray(), linkedTransformNodeId: (e = o.getTransformNode()) === null || e === void 0 ? void 0 : e.id };
+ for (var p in n.bones.push(s), o.length && (s.length = o.length), o.metadata && (s.metadata = o.metadata), o.animations && o.animations.length > 0 && (s.animation = o.animations[0].serialize()), n.ranges = [], this._ranges) {
+ var m = this._ranges[p];
+ if (m) {
+ var S = {};
+ S.name = p, S.from = m.from, S.to = m.to, n.ranges.push(S);
+ }
+ }
+ }
+ return n;
+ }, r.Parse = function(t, e) {
+ var n, i = new r(t.name, t.id, e);
+ for (t.dimensionsAtRest && (i.dimensionsAtRest = c.e.FromArray(t.dimensionsAtRest)), i.needInitialSkinMatrix = t.needInitialSkinMatrix, t.overrideMeshId && (i._hasWaitingData = !0, i._waitingOverrideMeshId = t.overrideMeshId), n = 0; n < t.bones.length; n++) {
+ var o = t.bones[n], a = t.bones[n].index, s = null;
+ o.parentBoneIndex > -1 && (s = i.bones[o.parentBoneIndex]);
+ var p = o.rest ? c.a.FromArray(o.rest) : null, m = new Ne(o.name, i, s, c.a.FromArray(o.matrix), p, null, a);
+ o.id !== void 0 && o.id !== null && (m.id = o.id), o.length && (m.length = o.length), o.metadata && (m.metadata = o.metadata), o.animation && m.animations.push(H.Parse(o.animation)), o.linkedTransformNodeId !== void 0 && o.linkedTransformNodeId !== null && (i._hasWaitingData = !0, m._waitingTransformNodeId = o.linkedTransformNodeId);
+ }
+ if (t.ranges)
+ for (n = 0; n < t.ranges.length; n++) {
+ var S = t.ranges[n];
+ i.createAnimationRange(S.name, S.from, S.to);
+ }
+ return i;
+ }, r.prototype.computeAbsoluteTransforms = function(t) {
+ t === void 0 && (t = !1);
+ var e = this._scene.getRenderId();
+ (this._lastAbsoluteTransformsUpdateId != e || t) && (this.bones[0].computeAbsoluteTransforms(), this._lastAbsoluteTransformsUpdateId = e);
+ }, r.prototype.getPoseMatrix = function() {
+ var t = null;
+ return this._meshesWithPoseMatrix.length > 0 && (t = this._meshesWithPoseMatrix[0].getPoseMatrix()), t;
+ }, r.prototype.sortBones = function() {
+ for (var t = new Array(), e = new Array(this.bones.length), n = 0; n < this.bones.length; n++)
+ this._sortBones(n, t, e);
+ this.bones = t;
+ }, r.prototype._sortBones = function(t, e, n) {
+ if (!n[t]) {
+ n[t] = !0;
+ var i = this.bones[t];
+ i._index === void 0 && (i._index = t);
+ var o = i.getParent();
+ o && this._sortBones(this.bones.indexOf(o), e, n), e.push(i);
+ }
+ }, r.prototype.setCurrentPoseAsRest = function() {
+ this.bones.forEach(function(t) {
+ t.setCurrentPoseAsRest();
+ });
+ }, r;
+ }(), Tn = {}, _a = function() {
+ function r(t) {
+ this.attachedToElement = !1, this.attached = {}, this.camera = t, this.checkInputs = function() {
+ };
+ }
+ return r.prototype.add = function(t) {
+ var e = t.getSimpleName();
+ this.attached[e] ? h.a.Warn("camera input of type " + e + " already exists on camera") : (this.attached[e] = t, t.camera = this.camera, t.checkInputs && (this.checkInputs = this._addCheckInputs(t.checkInputs.bind(t))), this.attachedToElement && t.attachControl());
+ }, r.prototype.remove = function(t) {
+ for (var e in this.attached) {
+ var n = this.attached[e];
+ n === t && (n.detachControl(), n.camera = null, delete this.attached[e], this.rebuildInputCheck());
+ }
+ }, r.prototype.removeByType = function(t) {
+ for (var e in this.attached) {
+ var n = this.attached[e];
+ n.getClassName() === t && (n.detachControl(), n.camera = null, delete this.attached[e], this.rebuildInputCheck());
+ }
+ }, r.prototype._addCheckInputs = function(t) {
+ var e = this.checkInputs;
+ return function() {
+ e(), t();
+ };
+ }, r.prototype.attachInput = function(t) {
+ this.attachedToElement && t.attachControl(this.noPreventDefault);
+ }, r.prototype.attachElement = function(t) {
+ if (t === void 0 && (t = !1), !this.attachedToElement)
+ for (var e in t = !gt.a.ForceAttachControlToAlwaysPreventDefault && t, this.attachedToElement = !0, this.noPreventDefault = t, this.attached)
+ this.attached[e].attachControl(t);
+ }, r.prototype.detachElement = function(t) {
+ for (var e in t === void 0 && (t = !1), this.attached)
+ this.attached[e].detachControl(), t && (this.attached[e].camera = null);
+ this.attachedToElement = !1;
+ }, r.prototype.rebuildInputCheck = function() {
+ for (var t in this.checkInputs = function() {
+ }, this.attached) {
+ var e = this.attached[t];
+ e.checkInputs && (this.checkInputs = this._addCheckInputs(e.checkInputs.bind(e)));
+ }
+ }, r.prototype.clear = function() {
+ this.attachedToElement && this.detachElement(!0), this.attached = {}, this.attachedToElement = !1, this.checkInputs = function() {
+ };
+ }, r.prototype.serialize = function(t) {
+ var e = {};
+ for (var n in this.attached) {
+ var i = this.attached[n], o = w.a.Serialize(i);
+ e[i.getClassName()] = o;
+ }
+ t.inputsmgr = e;
+ }, r.prototype.parse = function(t) {
+ var e = t.inputsmgr;
+ if (e) {
+ for (var n in this.clear(), e)
+ if (a = Tn[n]) {
+ var i = e[n], o = w.a.Parse(function() {
+ return new a();
+ }, i, null);
+ this.add(o);
+ }
+ } else
+ for (var n in this.attached) {
+ var a;
+ (a = Tn[this.attached[n].getClassName()]) && (o = w.a.Parse(function() {
+ return new a();
+ }, t, null), this.remove(this.attached[n]), this.add(o));
+ }
+ }, r;
+ }(), eb = function(r, t) {
+ this.x = r, this.y = t;
+ }, Sn = function() {
+ function r(t, e, n, i, o, a, s) {
+ i === void 0 && (i = 0), o === void 0 && (o = 1), a === void 0 && (a = 2), s === void 0 && (s = 3), this.id = t, this.index = e, this.browserGamepad = n, this._leftStick = { x: 0, y: 0 }, this._rightStick = { x: 0, y: 0 }, this._isConnected = !0, this._invertLeftStickY = !1, this.type = r.GAMEPAD, this._leftStickAxisX = i, this._leftStickAxisY = o, this._rightStickAxisX = a, this._rightStickAxisY = s, this.browserGamepad.axes.length >= 2 && (this._leftStick = { x: this.browserGamepad.axes[this._leftStickAxisX], y: this.browserGamepad.axes[this._leftStickAxisY] }), this.browserGamepad.axes.length >= 4 && (this._rightStick = { x: this.browserGamepad.axes[this._rightStickAxisX], y: this.browserGamepad.axes[this._rightStickAxisY] });
+ }
+ return Object.defineProperty(r.prototype, "isConnected", { get: function() {
+ return this._isConnected;
+ }, enumerable: !1, configurable: !0 }), r.prototype.onleftstickchanged = function(t) {
+ this._onleftstickchanged = t;
+ }, r.prototype.onrightstickchanged = function(t) {
+ this._onrightstickchanged = t;
+ }, Object.defineProperty(r.prototype, "leftStick", { get: function() {
+ return this._leftStick;
+ }, set: function(t) {
+ !this._onleftstickchanged || this._leftStick.x === t.x && this._leftStick.y === t.y || this._onleftstickchanged(t), this._leftStick = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "rightStick", { get: function() {
+ return this._rightStick;
+ }, set: function(t) {
+ !this._onrightstickchanged || this._rightStick.x === t.x && this._rightStick.y === t.y || this._onrightstickchanged(t), this._rightStick = t;
+ }, enumerable: !1, configurable: !0 }), r.prototype.update = function() {
+ this._leftStick && (this.leftStick = { x: this.browserGamepad.axes[this._leftStickAxisX], y: this.browserGamepad.axes[this._leftStickAxisY] }, this._invertLeftStickY && (this.leftStick.y *= -1)), this._rightStick && (this.rightStick = { x: this.browserGamepad.axes[this._rightStickAxisX], y: this.browserGamepad.axes[this._rightStickAxisY] });
+ }, r.prototype.dispose = function() {
+ }, r.GAMEPAD = 0, r.GENERIC = 1, r.XBOX = 2, r.POSE_ENABLED = 3, r.DUALSHOCK = 4, r;
+ }(), bd = function(r) {
+ function t(e, n, i) {
+ var o = r.call(this, e, n, i) || this;
+ return o.onButtonDownObservable = new P.c(), o.onButtonUpObservable = new P.c(), o.type = Sn.GENERIC, o._buttons = new Array(i.buttons.length), o;
+ }
+ return Object(u.d)(t, r), t.prototype.onbuttondown = function(e) {
+ this._onbuttondown = e;
+ }, t.prototype.onbuttonup = function(e) {
+ this._onbuttonup = e;
+ }, t.prototype._setButtonValue = function(e, n, i) {
+ return e !== n && (e === 1 && (this._onbuttondown && this._onbuttondown(i), this.onButtonDownObservable.notifyObservers(i)), e === 0 && (this._onbuttonup && this._onbuttonup(i), this.onButtonUpObservable.notifyObservers(i))), e;
+ }, t.prototype.update = function() {
+ r.prototype.update.call(this);
+ for (var e = 0; e < this._buttons.length; e++)
+ this._buttons[e] = this._setButtonValue(this.browserGamepad.buttons[e].value, this._buttons[e], e);
+ }, t.prototype.dispose = function() {
+ r.prototype.dispose.call(this), this.onButtonDownObservable.clear(), this.onButtonUpObservable.clear();
+ }, t;
+ }(Sn), Wc = function() {
+ function r() {
+ this.gamepadRotationSensibility = 80, this.gamepadMoveSensibility = 40, this._yAxisScale = 1;
+ }
+ return Object.defineProperty(r.prototype, "invertYAxis", { get: function() {
+ return this._yAxisScale !== 1;
+ }, set: function(t) {
+ this._yAxisScale = t ? -1 : 1;
+ }, enumerable: !1, configurable: !0 }), r.prototype.attachControl = function() {
+ var t = this, e = this.camera.getScene().gamepadManager;
+ this._onGamepadConnectedObserver = e.onGamepadConnectedObservable.add(function(n) {
+ n.type !== Sn.POSE_ENABLED && (t.gamepad && n.type !== Sn.XBOX || (t.gamepad = n));
+ }), this._onGamepadDisconnectedObserver = e.onGamepadDisconnectedObservable.add(function(n) {
+ t.gamepad === n && (t.gamepad = null);
+ }), this.gamepad = e.getGamepadByType(Sn.XBOX);
+ }, r.prototype.detachControl = function(t) {
+ this.camera.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver), this.camera.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver), this.gamepad = null;
+ }, r.prototype.checkInputs = function() {
+ if (this.gamepad) {
+ var t = this.camera, e = this.gamepad.rightStick;
+ if (e) {
+ if (e.x != 0) {
+ var n = e.x / this.gamepadRotationSensibility;
+ n != 0 && Math.abs(n) > 5e-3 && (t.inertialAlphaOffset += n);
+ }
+ if (e.y != 0) {
+ var i = e.y / this.gamepadRotationSensibility * this._yAxisScale;
+ i != 0 && Math.abs(i) > 5e-3 && (t.inertialBetaOffset += i);
+ }
+ }
+ var o = this.gamepad.leftStick;
+ if (o && o.y != 0) {
+ var a = o.y / this.gamepadMoveSensibility;
+ a != 0 && Math.abs(a) > 5e-3 && (this.camera.inertialRadiusOffset -= a);
+ }
+ }
+ }, r.prototype.getClassName = function() {
+ return "ArcRotateCameraGamepadInput";
+ }, r.prototype.getSimpleName = function() {
+ return "gamepad";
+ }, Object(u.c)([Object(w.c)()], r.prototype, "gamepadRotationSensibility", void 0), Object(u.c)([Object(w.c)()], r.prototype, "gamepadMoveSensibility", void 0), r;
+ }();
+ Tn.ArcRotateCameraGamepadInput = Wc;
+ var kr = l(66), Xc = function() {
+ function r() {
+ this.keysUp = [38], this.keysDown = [40], this.keysLeft = [37], this.keysRight = [39], this.keysReset = [220], this.panningSensibility = 50, this.zoomingSensibility = 25, this.useAltToZoom = !0, this.angularSpeed = 0.01, this._keys = new Array();
+ }
+ return r.prototype.attachControl = function(t) {
+ var e = this;
+ t = Ke.b.BackCompatCameraNoPreventDefault(arguments), this._onCanvasBlurObserver || (this._scene = this.camera.getScene(), this._engine = this._scene.getEngine(), this._onCanvasBlurObserver = this._engine.onCanvasBlurObservable.add(function() {
+ e._keys = [];
+ }), this._onKeyboardObserver = this._scene.onKeyboardObservable.add(function(n) {
+ var i, o = n.event;
+ o.metaKey || (n.type === kr.a.KEYDOWN ? (e._ctrlPressed = o.ctrlKey, e._altPressed = o.altKey, (e.keysUp.indexOf(o.keyCode) !== -1 || e.keysDown.indexOf(o.keyCode) !== -1 || e.keysLeft.indexOf(o.keyCode) !== -1 || e.keysRight.indexOf(o.keyCode) !== -1 || e.keysReset.indexOf(o.keyCode) !== -1) && ((i = e._keys.indexOf(o.keyCode)) === -1 && e._keys.push(o.keyCode), o.preventDefault && (t || o.preventDefault()))) : e.keysUp.indexOf(o.keyCode) === -1 && e.keysDown.indexOf(o.keyCode) === -1 && e.keysLeft.indexOf(o.keyCode) === -1 && e.keysRight.indexOf(o.keyCode) === -1 && e.keysReset.indexOf(o.keyCode) === -1 || ((i = e._keys.indexOf(o.keyCode)) >= 0 && e._keys.splice(i, 1), o.preventDefault && (t || o.preventDefault())));
+ }));
+ }, r.prototype.detachControl = function(t) {
+ this._scene && (this._onKeyboardObserver && this._scene.onKeyboardObservable.remove(this._onKeyboardObserver), this._onCanvasBlurObserver && this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver), this._onKeyboardObserver = null, this._onCanvasBlurObserver = null), this._keys = [];
+ }, r.prototype.checkInputs = function() {
+ if (this._onKeyboardObserver)
+ for (var t = this.camera, e = 0; e < this._keys.length; e++) {
+ var n = this._keys[e];
+ this.keysLeft.indexOf(n) !== -1 ? this._ctrlPressed && this.camera._useCtrlForPanning ? t.inertialPanningX -= 1 / this.panningSensibility : t.inertialAlphaOffset -= this.angularSpeed : this.keysUp.indexOf(n) !== -1 ? this._ctrlPressed && this.camera._useCtrlForPanning ? t.inertialPanningY += 1 / this.panningSensibility : this._altPressed && this.useAltToZoom ? t.inertialRadiusOffset += 1 / this.zoomingSensibility : t.inertialBetaOffset -= this.angularSpeed : this.keysRight.indexOf(n) !== -1 ? this._ctrlPressed && this.camera._useCtrlForPanning ? t.inertialPanningX += 1 / this.panningSensibility : t.inertialAlphaOffset += this.angularSpeed : this.keysDown.indexOf(n) !== -1 ? this._ctrlPressed && this.camera._useCtrlForPanning ? t.inertialPanningY -= 1 / this.panningSensibility : this._altPressed && this.useAltToZoom ? t.inertialRadiusOffset -= 1 / this.zoomingSensibility : t.inertialBetaOffset += this.angularSpeed : this.keysReset.indexOf(n) !== -1 && t.useInputToRestoreState && t.restoreState();
+ }
+ }, r.prototype.getClassName = function() {
+ return "ArcRotateCameraKeyboardMoveInput";
+ }, r.prototype.getSimpleName = function() {
+ return "keyboard";
+ }, Object(u.c)([Object(w.c)()], r.prototype, "keysUp", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysDown", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysLeft", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysRight", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysReset", void 0), Object(u.c)([Object(w.c)()], r.prototype, "panningSensibility", void 0), Object(u.c)([Object(w.c)()], r.prototype, "zoomingSensibility", void 0), Object(u.c)([Object(w.c)()], r.prototype, "useAltToZoom", void 0), Object(u.c)([Object(w.c)()], r.prototype, "angularSpeed", void 0), r;
+ }();
+ Tn.ArcRotateCameraKeyboardMoveInput = Xc;
+ var Yc = function() {
+ function r() {
+ this.wheelPrecision = 3, this.wheelDeltaPercentage = 0;
+ }
+ return r.prototype.computeDeltaFromMouseWheelLegacyEvent = function(t, e) {
+ var n = 0.01 * t * this.wheelDeltaPercentage * e;
+ return t > 0 ? n / (1 + this.wheelDeltaPercentage) : n * (1 + this.wheelDeltaPercentage);
+ }, r.prototype.attachControl = function(t) {
+ var e = this;
+ t = Ke.b.BackCompatCameraNoPreventDefault(arguments), this._wheel = function(n, i) {
+ if (n.type === Et.a.POINTERWHEEL) {
+ var o = n.event, a = 0, s = o, p = 0;
+ if (p = s.wheelDelta ? s.wheelDelta : 60 * -(o.deltaY || o.detail), e.wheelDeltaPercentage) {
+ if ((a = e.computeDeltaFromMouseWheelLegacyEvent(p, e.camera.radius)) > 0) {
+ for (var m = e.camera.radius, S = e.camera.inertialRadiusOffset + a, O = 0; O < 20 && Math.abs(S) > 1e-3; O++)
+ m -= S, S *= e.camera.inertia;
+ m = ee.a.Clamp(m, 0, Number.MAX_VALUE), a = e.computeDeltaFromMouseWheelLegacyEvent(p, m);
+ }
+ } else
+ a = p / (40 * e.wheelPrecision);
+ a && (e.camera.inertialRadiusOffset += a), o.preventDefault && (t || o.preventDefault());
+ }
+ }, this._observer = this.camera.getScene().onPointerObservable.add(this._wheel, Et.a.POINTERWHEEL);
+ }, r.prototype.detachControl = function(t) {
+ this._observer && (this.camera.getScene().onPointerObservable.remove(this._observer), this._observer = null, this._wheel = null);
+ }, r.prototype.getClassName = function() {
+ return "ArcRotateCameraMouseWheelInput";
+ }, r.prototype.getSimpleName = function() {
+ return "mousewheel";
+ }, Object(u.c)([Object(w.c)()], r.prototype, "wheelPrecision", void 0), Object(u.c)([Object(w.c)()], r.prototype, "wheelDeltaPercentage", void 0), r;
+ }();
+ Tn.ArcRotateCameraMouseWheelInput = Yc;
+ var yd = function() {
+ function r() {
+ this.buttons = [0, 1, 2];
+ }
+ return r.prototype.attachControl = function(t) {
+ var e = this;
+ t = Ke.b.BackCompatCameraNoPreventDefault(arguments);
+ var n = this.camera.getEngine(), i = n.getInputElement(), o = 0, a = null;
+ this.pointA = null, this.pointB = null, this._altKey = !1, this._ctrlKey = !1, this._metaKey = !1, this._shiftKey = !1, this._buttonsPressed = 0, this._pointerInput = function(p, m) {
+ var S = p.event, O = S.pointerType === "touch";
+ if (!n.isInVRExclusivePointerMode && (p.type === Et.a.POINTERMOVE || e.buttons.indexOf(S.button) !== -1)) {
+ var I = S.srcElement || S.target;
+ if (e._altKey = S.altKey, e._ctrlKey = S.ctrlKey, e._metaKey = S.metaKey, e._shiftKey = S.shiftKey, e._buttonsPressed = S.buttons, n.isPointerLock) {
+ var G = S.movementX || S.mozMovementX || S.webkitMovementX || S.msMovementX || 0, k = S.movementY || S.mozMovementY || S.webkitMovementY || S.msMovementY || 0;
+ e.onTouch(null, G, k), e.pointA = null, e.pointB = null;
+ } else if (p.type === Et.a.POINTERDOWN && I) {
+ try {
+ I.setPointerCapture(S.pointerId);
+ } catch {
+ }
+ e.pointA === null ? e.pointA = { x: S.clientX, y: S.clientY, pointerId: S.pointerId, type: S.pointerType } : e.pointB === null && (e.pointB = { x: S.clientX, y: S.clientY, pointerId: S.pointerId, type: S.pointerType }), e.onButtonDown(S), t || (S.preventDefault(), i && i.focus());
+ } else if (p.type === Et.a.POINTERDOUBLETAP)
+ e.onDoubleTap(S.pointerType);
+ else if (p.type === Et.a.POINTERUP && I) {
+ try {
+ I.releasePointerCapture(S.pointerId);
+ } catch {
+ }
+ O || (e.pointB = null), n._badOS ? e.pointA = e.pointB = null : e.pointB && e.pointA && e.pointA.pointerId == S.pointerId ? (e.pointA = e.pointB, e.pointB = null) : e.pointA && e.pointB && e.pointB.pointerId == S.pointerId ? e.pointB = null : e.pointA = e.pointB = null, (o !== 0 || a) && (e.onMultiTouch(e.pointA, e.pointB, o, 0, a, null), o = 0, a = null), e.onButtonUp(S), t || S.preventDefault();
+ } else if (p.type === Et.a.POINTERMOVE) {
+ if (t || S.preventDefault(), e.pointA && e.pointB === null)
+ G = S.clientX - e.pointA.x, k = S.clientY - e.pointA.y, e.onTouch(e.pointA, G, k), e.pointA.x = S.clientX, e.pointA.y = S.clientY;
+ else if (e.pointA && e.pointB) {
+ var K = e.pointA.pointerId === S.pointerId ? e.pointA : e.pointB;
+ K.x = S.clientX, K.y = S.clientY;
+ var re = e.pointA.x - e.pointB.x, se = e.pointA.y - e.pointB.y, ue = re * re + se * se, he = { x: (e.pointA.x + e.pointB.x) / 2, y: (e.pointA.y + e.pointB.y) / 2, pointerId: S.pointerId, type: p.type };
+ e.onMultiTouch(e.pointA, e.pointB, o, ue, a, he), a = he, o = ue;
+ }
+ }
+ }
+ }, this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, Et.a.POINTERDOWN | Et.a.POINTERUP | Et.a.POINTERMOVE), this._onLostFocus = function() {
+ e.pointA = e.pointB = null, o = 0, a = null, e.onLostFocus();
+ }, i && i.addEventListener("contextmenu", this.onContextMenu.bind(this), !1);
+ var s = this.camera.getScene().getEngine().getHostWindow();
+ s && Ke.b.RegisterTopRootEvents(s, [{ name: "blur", handler: this._onLostFocus }]);
+ }, r.prototype.detachControl = function(t) {
+ if (this._onLostFocus) {
+ var e = this.camera.getScene().getEngine().getHostWindow();
+ e && Ke.b.UnregisterTopRootEvents(e, [{ name: "blur", handler: this._onLostFocus }]);
+ }
+ if (this._observer) {
+ if (this.camera.getScene().onPointerObservable.remove(this._observer), this._observer = null, this.onContextMenu) {
+ var n = this.camera.getScene().getEngine().getInputElement();
+ n && n.removeEventListener("contextmenu", this.onContextMenu);
+ }
+ this._onLostFocus = null;
+ }
+ this._altKey = !1, this._ctrlKey = !1, this._metaKey = !1, this._shiftKey = !1, this._buttonsPressed = 0;
+ }, r.prototype.getClassName = function() {
+ return "BaseCameraPointersInput";
+ }, r.prototype.getSimpleName = function() {
+ return "pointers";
+ }, r.prototype.onDoubleTap = function(t) {
+ }, r.prototype.onTouch = function(t, e, n) {
+ }, r.prototype.onMultiTouch = function(t, e, n, i, o, a) {
+ }, r.prototype.onContextMenu = function(t) {
+ t.preventDefault();
+ }, r.prototype.onButtonDown = function(t) {
+ }, r.prototype.onButtonUp = function(t) {
+ }, r.prototype.onLostFocus = function() {
+ }, Object(u.c)([Object(w.c)()], r.prototype, "buttons", void 0), r;
+ }(), Kc = function(r) {
+ function t() {
+ var e = r !== null && r.apply(this, arguments) || this;
+ return e.buttons = [0, 1, 2], e.angularSensibilityX = 1e3, e.angularSensibilityY = 1e3, e.pinchPrecision = 12, e.pinchDeltaPercentage = 0, e.useNaturalPinchZoom = !1, e.panningSensibility = 1e3, e.multiTouchPanning = !0, e.multiTouchPanAndZoom = !0, e.pinchInwards = !0, e._isPanClick = !1, e._twoFingerActivityCount = 0, e._isPinching = !1, e;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "ArcRotateCameraPointersInput";
+ }, t.prototype.onTouch = function(e, n, i) {
+ this.panningSensibility !== 0 && (this._ctrlKey && this.camera._useCtrlForPanning || this._isPanClick) ? (this.camera.inertialPanningX += -n / this.panningSensibility, this.camera.inertialPanningY += i / this.panningSensibility) : (this.camera.inertialAlphaOffset -= n / this.angularSensibilityX, this.camera.inertialBetaOffset -= i / this.angularSensibilityY);
+ }, t.prototype.onDoubleTap = function(e) {
+ this.camera.useInputToRestoreState && this.camera.restoreState();
+ }, t.prototype.onMultiTouch = function(e, n, i, o, a, s) {
+ if (!(i === 0 && a === null || o === 0 && s === null)) {
+ var p = this.pinchInwards ? 1 : -1;
+ if (this.multiTouchPanAndZoom) {
+ if (this.useNaturalPinchZoom ? this.camera.radius = this.camera.radius * Math.sqrt(i) / Math.sqrt(o) : this.pinchDeltaPercentage ? this.camera.inertialRadiusOffset += 1e-3 * (o - i) * this.camera.radius * this.pinchDeltaPercentage : this.camera.inertialRadiusOffset += (o - i) / (this.pinchPrecision * p * (this.angularSensibilityX + this.angularSensibilityY) / 2), this.panningSensibility !== 0 && a && s) {
+ var m = s.x - a.x, S = s.y - a.y;
+ this.camera.inertialPanningX += -m / this.panningSensibility, this.camera.inertialPanningY += S / this.panningSensibility;
+ }
+ } else {
+ this._twoFingerActivityCount++;
+ var O = Math.sqrt(i), I = Math.sqrt(o);
+ this._isPinching || this._twoFingerActivityCount < 20 && Math.abs(I - O) > this.camera.pinchToPanMaxDistance ? (this.pinchDeltaPercentage ? this.camera.inertialRadiusOffset += 1e-3 * (o - i) * this.camera.radius * this.pinchDeltaPercentage : this.camera.inertialRadiusOffset += (o - i) / (this.pinchPrecision * p * (this.angularSensibilityX + this.angularSensibilityY) / 2), this._isPinching = !0) : this.panningSensibility !== 0 && this.multiTouchPanning && s && a && (m = s.x - a.x, S = s.y - a.y, this.camera.inertialPanningX += -m / this.panningSensibility, this.camera.inertialPanningY += S / this.panningSensibility);
+ }
+ }
+ }, t.prototype.onButtonDown = function(e) {
+ this._isPanClick = e.button === this.camera._panningMouseButton;
+ }, t.prototype.onButtonUp = function(e) {
+ this._twoFingerActivityCount = 0, this._isPinching = !1;
+ }, t.prototype.onLostFocus = function() {
+ this._isPanClick = !1, this._twoFingerActivityCount = 0, this._isPinching = !1;
+ }, Object(u.c)([Object(w.c)()], t.prototype, "buttons", void 0), Object(u.c)([Object(w.c)()], t.prototype, "angularSensibilityX", void 0), Object(u.c)([Object(w.c)()], t.prototype, "angularSensibilityY", void 0), Object(u.c)([Object(w.c)()], t.prototype, "pinchPrecision", void 0), Object(u.c)([Object(w.c)()], t.prototype, "pinchDeltaPercentage", void 0), Object(u.c)([Object(w.c)()], t.prototype, "useNaturalPinchZoom", void 0), Object(u.c)([Object(w.c)()], t.prototype, "panningSensibility", void 0), Object(u.c)([Object(w.c)()], t.prototype, "multiTouchPanning", void 0), Object(u.c)([Object(w.c)()], t.prototype, "multiTouchPanAndZoom", void 0), t;
+ }(yd);
+ Tn.ArcRotateCameraPointersInput = Kc;
+ var ps = function(r) {
+ function t(e) {
+ return r.call(this, e) || this;
+ }
+ return Object(u.d)(t, r), t.prototype.addMouseWheel = function() {
+ return this.add(new Yc()), this;
+ }, t.prototype.addPointers = function() {
+ return this.add(new Kc()), this;
+ }, t.prototype.addKeyboard = function() {
+ return this.add(new Xc()), this;
+ }, t;
+ }(_a);
+ ps.prototype.addVRDeviceOrientation = function() {
+ return this.add(new Qc()), this;
+ };
+ var Qc = function() {
+ function r() {
+ this.alphaCorrection = 1, this.gammaCorrection = 1, this._alpha = 0, this._gamma = 0, this._dirty = !1, this._deviceOrientationHandler = this._onOrientationEvent.bind(this);
+ }
+ return r.prototype.attachControl = function(t) {
+ var e = this;
+ t = Ke.b.BackCompatCameraNoPreventDefault(arguments), this.camera.attachControl(t);
+ var n = this.camera.getScene().getEngine().getHostWindow();
+ n && (typeof DeviceOrientationEvent < "u" && typeof DeviceOrientationEvent.requestPermission == "function" ? DeviceOrientationEvent.requestPermission().then(function(i) {
+ i === "granted" ? n.addEventListener("deviceorientation", e._deviceOrientationHandler) : Ke.b.Warn("Permission not granted.");
+ }).catch(function(i) {
+ Ke.b.Error(i);
+ }) : n.addEventListener("deviceorientation", this._deviceOrientationHandler));
+ }, r.prototype._onOrientationEvent = function(t) {
+ t.alpha !== null && (this._alpha = (0 | +t.alpha) * this.alphaCorrection), t.gamma !== null && (this._gamma = (0 | +t.gamma) * this.gammaCorrection), this._dirty = !0;
+ }, r.prototype.checkInputs = function() {
+ this._dirty && (this._dirty = !1, this._gamma < 0 && (this._gamma = 180 + this._gamma), this.camera.alpha = -this._alpha / 180 * Math.PI % Math.PI * 2, this.camera.beta = this._gamma / 180 * Math.PI);
+ }, r.prototype.detachControl = function(t) {
+ window.removeEventListener("deviceorientation", this._deviceOrientationHandler);
+ }, r.prototype.getClassName = function() {
+ return "ArcRotateCameraVRDeviceOrientationInput";
+ }, r.prototype.getSimpleName = function() {
+ return "VRDeviceOrientation";
+ }, r;
+ }();
+ Tn.ArcRotateCameraVRDeviceOrientationInput = Qc;
+ var qc = function() {
+ function r() {
+ this.keysForward = [87], this.keysBackward = [83], this.keysUp = [69], this.keysDown = [81], this.keysRight = [68], this.keysLeft = [65], this._keys = new Array();
+ }
+ return r.prototype.attachControl = function(t) {
+ var e = this;
+ t = Ke.b.BackCompatCameraNoPreventDefault(arguments), this._onCanvasBlurObserver || (this._scene = this.camera.getScene(), this._engine = this._scene.getEngine(), this._onCanvasBlurObserver = this._engine.onCanvasBlurObservable.add(function() {
+ e._keys = [];
+ }), this._onKeyboardObserver = this._scene.onKeyboardObservable.add(function(n) {
+ var i, o = n.event;
+ n.type === kr.a.KEYDOWN ? e.keysForward.indexOf(o.keyCode) === -1 && e.keysBackward.indexOf(o.keyCode) === -1 && e.keysUp.indexOf(o.keyCode) === -1 && e.keysDown.indexOf(o.keyCode) === -1 && e.keysLeft.indexOf(o.keyCode) === -1 && e.keysRight.indexOf(o.keyCode) === -1 || ((i = e._keys.indexOf(o.keyCode)) === -1 && e._keys.push(o.keyCode), t || o.preventDefault()) : e.keysForward.indexOf(o.keyCode) === -1 && e.keysBackward.indexOf(o.keyCode) === -1 && e.keysUp.indexOf(o.keyCode) === -1 && e.keysDown.indexOf(o.keyCode) === -1 && e.keysLeft.indexOf(o.keyCode) === -1 && e.keysRight.indexOf(o.keyCode) === -1 || ((i = e._keys.indexOf(o.keyCode)) >= 0 && e._keys.splice(i, 1), t || o.preventDefault());
+ }));
+ }, r.prototype.detachControl = function(t) {
+ this._scene && (this._onKeyboardObserver && this._scene.onKeyboardObservable.remove(this._onKeyboardObserver), this._onCanvasBlurObserver && this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver), this._onKeyboardObserver = null, this._onCanvasBlurObserver = null), this._keys = [];
+ }, r.prototype.getClassName = function() {
+ return "FlyCameraKeyboardInput";
+ }, r.prototype._onLostFocus = function(t) {
+ this._keys = [];
+ }, r.prototype.getSimpleName = function() {
+ return "keyboard";
+ }, r.prototype.checkInputs = function() {
+ if (this._onKeyboardObserver)
+ for (var t = this.camera, e = 0; e < this._keys.length; e++) {
+ var n = this._keys[e], i = t._computeLocalCameraSpeed();
+ this.keysForward.indexOf(n) !== -1 ? t._localDirection.copyFromFloats(0, 0, i) : this.keysBackward.indexOf(n) !== -1 ? t._localDirection.copyFromFloats(0, 0, -i) : this.keysUp.indexOf(n) !== -1 ? t._localDirection.copyFromFloats(0, i, 0) : this.keysDown.indexOf(n) !== -1 ? t._localDirection.copyFromFloats(0, -i, 0) : this.keysRight.indexOf(n) !== -1 ? t._localDirection.copyFromFloats(i, 0, 0) : this.keysLeft.indexOf(n) !== -1 && t._localDirection.copyFromFloats(-i, 0, 0), t.getScene().useRightHandedSystem && (t._localDirection.z *= -1), t.getViewMatrix().invertToRef(t._cameraTransformMatrix), c.e.TransformNormalToRef(t._localDirection, t._cameraTransformMatrix, t._transformedDirection), t.cameraDirection.addInPlace(t._transformedDirection);
+ }
+ }, Object(u.c)([Object(w.c)()], r.prototype, "keysForward", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysBackward", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysUp", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysDown", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysRight", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysLeft", void 0), r;
+ }();
+ Tn.FlyCameraKeyboardInput = qc;
+ var Zc = function() {
+ function r(t) {
+ this.buttons = [0, 1, 2], this.buttonsYaw = [-1, 0, 1], this.buttonsPitch = [-1, 0, 1], this.buttonsRoll = [2], this.activeButton = -1, this.angularSensibility = 1e3, this.previousPosition = null;
+ }
+ return r.prototype.attachControl = function(t) {
+ var e = this;
+ t = Ke.b.BackCompatCameraNoPreventDefault(arguments), this.noPreventDefault = t, this._observer = this.camera.getScene().onPointerObservable.add(function(n, i) {
+ e._pointerInput(n, i);
+ }, Et.a.POINTERDOWN | Et.a.POINTERUP | Et.a.POINTERMOVE), this._rollObserver = this.camera.getScene().onBeforeRenderObservable.add(function() {
+ e.camera.rollCorrect && e.camera.restoreRoll(e.camera.rollCorrect);
+ });
+ }, r.prototype.detachControl = function(t) {
+ this._observer && (this.camera.getScene().onPointerObservable.remove(this._observer), this.camera.getScene().onBeforeRenderObservable.remove(this._rollObserver), this._observer = null, this._rollObserver = null, this.previousPosition = null, this.noPreventDefault = void 0);
+ }, r.prototype.getClassName = function() {
+ return "FlyCameraMouseInput";
+ }, r.prototype.getSimpleName = function() {
+ return "mouse";
+ }, r.prototype._pointerInput = function(t, e) {
+ var n = t.event, i = this.camera.getEngine();
+ if (!i.isInVRExclusivePointerMode && (this.touchEnabled || n.pointerType !== "touch") && (t.type === Et.a.POINTERMOVE || this.buttons.indexOf(n.button) !== -1)) {
+ var o = n.srcElement || n.target;
+ if (t.type === Et.a.POINTERDOWN && o) {
+ try {
+ o.setPointerCapture(n.pointerId);
+ } catch {
+ }
+ this.previousPosition = { x: n.clientX, y: n.clientY }, this.activeButton = n.button, this.noPreventDefault || (n.preventDefault(), this.element.focus()), i.isPointerLock && this._onMouseMove(t.event);
+ } else if (t.type === Et.a.POINTERUP && o) {
+ try {
+ o.releasePointerCapture(n.pointerId);
+ } catch {
+ }
+ this.activeButton = -1, this.previousPosition = null, this.noPreventDefault || n.preventDefault();
+ } else if (t.type === Et.a.POINTERMOVE) {
+ if (!this.previousPosition)
+ return void (i.isPointerLock && this._onMouseMove(t.event));
+ var a = n.clientX - this.previousPosition.x, s = n.clientY - this.previousPosition.y;
+ this.rotateCamera(a, s), this.previousPosition = { x: n.clientX, y: n.clientY }, this.noPreventDefault || n.preventDefault();
+ }
+ }
+ }, r.prototype._onMouseMove = function(t) {
+ var e = this.camera.getEngine();
+ if (e.isPointerLock && !e.isInVRExclusivePointerMode) {
+ var n = t.movementX || t.mozMovementX || t.webkitMovementX || t.msMovementX || 0, i = t.movementY || t.mozMovementY || t.webkitMovementY || t.msMovementY || 0;
+ this.rotateCamera(n, i), this.previousPosition = null, this.noPreventDefault || t.preventDefault();
+ }
+ }, r.prototype.rotateCamera = function(t, e) {
+ var n = this, i = this.camera;
+ this.camera.getScene().useRightHandedSystem && (t *= -1), i.parent && i.parent._getWorldMatrixDeterminant() < 0 && (t *= -1);
+ var o, a = t / this.angularSensibility, s = e / this.angularSensibility, p = c.b.RotationYawPitchRoll(i.rotation.y, i.rotation.x, i.rotation.z);
+ if (this.buttonsPitch.some(function(O) {
+ return O === n.activeButton;
+ }) && (o = c.b.RotationAxis(Se.a.X, s), p.multiplyInPlace(o)), this.buttonsYaw.some(function(O) {
+ return O === n.activeButton;
+ })) {
+ o = c.b.RotationAxis(Se.a.Y, a), p.multiplyInPlace(o);
+ var m = i.bankedTurnLimit + i._trackRoll;
+ if (i.bankedTurn && -m < i.rotation.z && i.rotation.z < m) {
+ var S = i.bankedTurnMultiplier * -a;
+ o = c.b.RotationAxis(Se.a.Z, S), p.multiplyInPlace(o);
+ }
+ }
+ this.buttonsRoll.some(function(O) {
+ return O === n.activeButton;
+ }) && (o = c.b.RotationAxis(Se.a.Z, -a), i._trackRoll -= a, p.multiplyInPlace(o)), p.toEulerAnglesToRef(i.rotation);
+ }, Object(u.c)([Object(w.c)()], r.prototype, "buttons", void 0), Object(u.c)([Object(w.c)()], r.prototype, "angularSensibility", void 0), r;
+ }();
+ Tn.FlyCameraMouseInput = Zc;
+ var Jc = function() {
+ function r() {
+ this.keysHeightOffsetIncr = [38], this.keysHeightOffsetDecr = [40], this.keysHeightOffsetModifierAlt = !1, this.keysHeightOffsetModifierCtrl = !1, this.keysHeightOffsetModifierShift = !1, this.keysRotationOffsetIncr = [37], this.keysRotationOffsetDecr = [39], this.keysRotationOffsetModifierAlt = !1, this.keysRotationOffsetModifierCtrl = !1, this.keysRotationOffsetModifierShift = !1, this.keysRadiusIncr = [40], this.keysRadiusDecr = [38], this.keysRadiusModifierAlt = !0, this.keysRadiusModifierCtrl = !1, this.keysRadiusModifierShift = !1, this.heightSensibility = 1, this.rotationSensibility = 1, this.radiusSensibility = 1, this._keys = new Array();
+ }
+ return r.prototype.attachControl = function(t) {
+ var e = this;
+ t = Ke.b.BackCompatCameraNoPreventDefault(arguments), this._onCanvasBlurObserver || (this._scene = this.camera.getScene(), this._engine = this._scene.getEngine(), this._onCanvasBlurObserver = this._engine.onCanvasBlurObservable.add(function() {
+ e._keys = [];
+ }), this._onKeyboardObserver = this._scene.onKeyboardObservable.add(function(n) {
+ var i, o = n.event;
+ o.metaKey || (n.type === kr.a.KEYDOWN ? (e._ctrlPressed = o.ctrlKey, e._altPressed = o.altKey, e._shiftPressed = o.shiftKey, (e.keysHeightOffsetIncr.indexOf(o.keyCode) !== -1 || e.keysHeightOffsetDecr.indexOf(o.keyCode) !== -1 || e.keysRotationOffsetIncr.indexOf(o.keyCode) !== -1 || e.keysRotationOffsetDecr.indexOf(o.keyCode) !== -1 || e.keysRadiusIncr.indexOf(o.keyCode) !== -1 || e.keysRadiusDecr.indexOf(o.keyCode) !== -1) && ((i = e._keys.indexOf(o.keyCode)) === -1 && e._keys.push(o.keyCode), o.preventDefault && (t || o.preventDefault()))) : e.keysHeightOffsetIncr.indexOf(o.keyCode) === -1 && e.keysHeightOffsetDecr.indexOf(o.keyCode) === -1 && e.keysRotationOffsetIncr.indexOf(o.keyCode) === -1 && e.keysRotationOffsetDecr.indexOf(o.keyCode) === -1 && e.keysRadiusIncr.indexOf(o.keyCode) === -1 && e.keysRadiusDecr.indexOf(o.keyCode) === -1 || ((i = e._keys.indexOf(o.keyCode)) >= 0 && e._keys.splice(i, 1), o.preventDefault && (t || o.preventDefault())));
+ }));
+ }, r.prototype.detachControl = function(t) {
+ this._scene && (this._onKeyboardObserver && this._scene.onKeyboardObservable.remove(this._onKeyboardObserver), this._onCanvasBlurObserver && this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver), this._onKeyboardObserver = null, this._onCanvasBlurObserver = null), this._keys = [];
+ }, r.prototype.checkInputs = function() {
+ var t = this;
+ this._onKeyboardObserver && this._keys.forEach(function(e) {
+ t.keysHeightOffsetIncr.indexOf(e) !== -1 && t._modifierHeightOffset() ? t.camera.heightOffset += t.heightSensibility : t.keysHeightOffsetDecr.indexOf(e) !== -1 && t._modifierHeightOffset() ? t.camera.heightOffset -= t.heightSensibility : t.keysRotationOffsetIncr.indexOf(e) !== -1 && t._modifierRotationOffset() ? (t.camera.rotationOffset += t.rotationSensibility, t.camera.rotationOffset %= 360) : t.keysRotationOffsetDecr.indexOf(e) !== -1 && t._modifierRotationOffset() ? (t.camera.rotationOffset -= t.rotationSensibility, t.camera.rotationOffset %= 360) : t.keysRadiusIncr.indexOf(e) !== -1 && t._modifierRadius() ? t.camera.radius += t.radiusSensibility : t.keysRadiusDecr.indexOf(e) !== -1 && t._modifierRadius() && (t.camera.radius -= t.radiusSensibility);
+ });
+ }, r.prototype.getClassName = function() {
+ return "FollowCameraKeyboardMoveInput";
+ }, r.prototype.getSimpleName = function() {
+ return "keyboard";
+ }, r.prototype._modifierHeightOffset = function() {
+ return this.keysHeightOffsetModifierAlt === this._altPressed && this.keysHeightOffsetModifierCtrl === this._ctrlPressed && this.keysHeightOffsetModifierShift === this._shiftPressed;
+ }, r.prototype._modifierRotationOffset = function() {
+ return this.keysRotationOffsetModifierAlt === this._altPressed && this.keysRotationOffsetModifierCtrl === this._ctrlPressed && this.keysRotationOffsetModifierShift === this._shiftPressed;
+ }, r.prototype._modifierRadius = function() {
+ return this.keysRadiusModifierAlt === this._altPressed && this.keysRadiusModifierCtrl === this._ctrlPressed && this.keysRadiusModifierShift === this._shiftPressed;
+ }, Object(u.c)([Object(w.c)()], r.prototype, "keysHeightOffsetIncr", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysHeightOffsetDecr", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysHeightOffsetModifierAlt", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysHeightOffsetModifierCtrl", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysHeightOffsetModifierShift", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysRotationOffsetIncr", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysRotationOffsetDecr", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysRotationOffsetModifierAlt", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysRotationOffsetModifierCtrl", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysRotationOffsetModifierShift", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysRadiusIncr", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysRadiusDecr", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysRadiusModifierAlt", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysRadiusModifierCtrl", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysRadiusModifierShift", void 0), Object(u.c)([Object(w.c)()], r.prototype, "heightSensibility", void 0), Object(u.c)([Object(w.c)()], r.prototype, "rotationSensibility", void 0), Object(u.c)([Object(w.c)()], r.prototype, "radiusSensibility", void 0), r;
+ }();
+ Tn.FollowCameraKeyboardMoveInput = Jc;
+ var $c = function() {
+ function r() {
+ this.axisControlRadius = !0, this.axisControlHeight = !1, this.axisControlRotation = !1, this.wheelPrecision = 3, this.wheelDeltaPercentage = 0;
+ }
+ return r.prototype.attachControl = function(t) {
+ var e = this;
+ t = Ke.b.BackCompatCameraNoPreventDefault(arguments), this._wheel = function(n, i) {
+ if (n.type === Et.a.POINTERWHEEL) {
+ var o = n.event, a = 0, s = Math.max(-1, Math.min(1, o.deltaY || o.wheelDelta || -o.detail));
+ e.wheelDeltaPercentage ? (console.assert(e.axisControlRadius + e.axisControlHeight + e.axisControlRotation <= 1, "wheelDeltaPercentage only usable when mouse wheel controlls ONE axis. Currently enabled: axisControlRadius: " + e.axisControlRadius + ", axisControlHeightOffset: " + e.axisControlHeight + ", axisControlRotationOffset: " + e.axisControlRotation), e.axisControlRadius ? a = 0.01 * s * e.wheelDeltaPercentage * e.camera.radius : e.axisControlHeight ? a = 0.01 * s * e.wheelDeltaPercentage * e.camera.heightOffset : e.axisControlRotation && (a = 0.01 * s * e.wheelDeltaPercentage * e.camera.rotationOffset)) : a = s * e.wheelPrecision, a && (e.axisControlRadius ? e.camera.radius += a : e.axisControlHeight ? e.camera.heightOffset -= a : e.axisControlRotation && (e.camera.rotationOffset -= a)), o.preventDefault && (t || o.preventDefault());
+ }
+ }, this._observer = this.camera.getScene().onPointerObservable.add(this._wheel, Et.a.POINTERWHEEL);
+ }, r.prototype.detachControl = function(t) {
+ this._observer && (this.camera.getScene().onPointerObservable.remove(this._observer), this._observer = null, this._wheel = null);
+ }, r.prototype.getClassName = function() {
+ return "ArcRotateCameraMouseWheelInput";
+ }, r.prototype.getSimpleName = function() {
+ return "mousewheel";
+ }, Object(u.c)([Object(w.c)()], r.prototype, "axisControlRadius", void 0), Object(u.c)([Object(w.c)()], r.prototype, "axisControlHeight", void 0), Object(u.c)([Object(w.c)()], r.prototype, "axisControlRotation", void 0), Object(u.c)([Object(w.c)()], r.prototype, "wheelPrecision", void 0), Object(u.c)([Object(w.c)()], r.prototype, "wheelDeltaPercentage", void 0), r;
+ }();
+ Tn.FollowCameraMouseWheelInput = $c;
+ var el = function(r) {
+ function t() {
+ var e = r !== null && r.apply(this, arguments) || this;
+ return e.angularSensibilityX = 1, e.angularSensibilityY = 1, e.pinchPrecision = 1e4, e.pinchDeltaPercentage = 0, e.axisXControlRadius = !1, e.axisXControlHeight = !1, e.axisXControlRotation = !0, e.axisYControlRadius = !1, e.axisYControlHeight = !0, e.axisYControlRotation = !1, e.axisPinchControlRadius = !0, e.axisPinchControlHeight = !1, e.axisPinchControlRotation = !1, e.warningEnable = !0, e._warningCounter = 0, e;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "FollowCameraPointersInput";
+ }, t.prototype.onTouch = function(e, n, i) {
+ this._warning(), this.axisXControlRotation ? this.camera.rotationOffset += n / this.angularSensibilityX : this.axisYControlRotation && (this.camera.rotationOffset += i / this.angularSensibilityX), this.axisXControlHeight ? this.camera.heightOffset += n / this.angularSensibilityY : this.axisYControlHeight && (this.camera.heightOffset += i / this.angularSensibilityY), this.axisXControlRadius ? this.camera.radius -= n / this.angularSensibilityY : this.axisYControlRadius && (this.camera.radius -= i / this.angularSensibilityY);
+ }, t.prototype.onMultiTouch = function(e, n, i, o, a, s) {
+ if (!(i === 0 && a === null || o === 0 && s === null)) {
+ var p = (o - i) / (this.pinchPrecision * (this.angularSensibilityX + this.angularSensibilityY) / 2);
+ this.pinchDeltaPercentage ? (p *= 0.01 * this.pinchDeltaPercentage, this.axisPinchControlRotation && (this.camera.rotationOffset += p * this.camera.rotationOffset), this.axisPinchControlHeight && (this.camera.heightOffset += p * this.camera.heightOffset), this.axisPinchControlRadius && (this.camera.radius -= p * this.camera.radius)) : (this.axisPinchControlRotation && (this.camera.rotationOffset += p), this.axisPinchControlHeight && (this.camera.heightOffset += p), this.axisPinchControlRadius && (this.camera.radius -= p));
+ }
+ }, t.prototype._warning = function() {
+ if (this.warningEnable && this._warningCounter++ % 100 == 0) {
+ var e = "It probably only makes sense to control ONE camera property with each pointer axis. Set 'warningEnable = false' if you are sure. Currently enabled: ";
+ console.assert(this.axisXControlRotation + this.axisXControlHeight + this.axisXControlRadius <= 1, e + "axisXControlRotation: " + this.axisXControlRotation + ", axisXControlHeight: " + this.axisXControlHeight + ", axisXControlRadius: " + this.axisXControlRadius), console.assert(this.axisYControlRotation + this.axisYControlHeight + this.axisYControlRadius <= 1, e + "axisYControlRotation: " + this.axisYControlRotation + ", axisYControlHeight: " + this.axisYControlHeight + ", axisYControlRadius: " + this.axisYControlRadius), console.assert(this.axisPinchControlRotation + this.axisPinchControlHeight + this.axisPinchControlRadius <= 1, e + "axisPinchControlRotation: " + this.axisPinchControlRotation + ", axisPinchControlHeight: " + this.axisPinchControlHeight + ", axisPinchControlRadius: " + this.axisPinchControlRadius);
+ }
+ }, Object(u.c)([Object(w.c)()], t.prototype, "angularSensibilityX", void 0), Object(u.c)([Object(w.c)()], t.prototype, "angularSensibilityY", void 0), Object(u.c)([Object(w.c)()], t.prototype, "pinchPrecision", void 0), Object(u.c)([Object(w.c)()], t.prototype, "pinchDeltaPercentage", void 0), Object(u.c)([Object(w.c)()], t.prototype, "axisXControlRadius", void 0), Object(u.c)([Object(w.c)()], t.prototype, "axisXControlHeight", void 0), Object(u.c)([Object(w.c)()], t.prototype, "axisXControlRotation", void 0), Object(u.c)([Object(w.c)()], t.prototype, "axisYControlRadius", void 0), Object(u.c)([Object(w.c)()], t.prototype, "axisYControlHeight", void 0), Object(u.c)([Object(w.c)()], t.prototype, "axisYControlRotation", void 0), Object(u.c)([Object(w.c)()], t.prototype, "axisPinchControlRadius", void 0), Object(u.c)([Object(w.c)()], t.prototype, "axisPinchControlHeight", void 0), Object(u.c)([Object(w.c)()], t.prototype, "axisPinchControlRotation", void 0), t;
+ }(yd);
+ Tn.FollowCameraPointersInput = el;
+ var tl = function() {
+ function r() {
+ this.keysUp = [38], this.keysUpward = [33], this.keysDown = [40], this.keysDownward = [34], this.keysLeft = [37], this.keysRight = [39], this._keys = new Array();
+ }
+ return r.prototype.attachControl = function(t) {
+ var e = this;
+ t = Ke.b.BackCompatCameraNoPreventDefault(arguments), this._onCanvasBlurObserver || (this._scene = this.camera.getScene(), this._engine = this._scene.getEngine(), this._onCanvasBlurObserver = this._engine.onCanvasBlurObservable.add(function() {
+ e._keys = [];
+ }), this._onKeyboardObserver = this._scene.onKeyboardObservable.add(function(n) {
+ var i, o = n.event;
+ o.metaKey || (n.type === kr.a.KEYDOWN ? e.keysUp.indexOf(o.keyCode) === -1 && e.keysDown.indexOf(o.keyCode) === -1 && e.keysLeft.indexOf(o.keyCode) === -1 && e.keysRight.indexOf(o.keyCode) === -1 && e.keysUpward.indexOf(o.keyCode) === -1 && e.keysDownward.indexOf(o.keyCode) === -1 || ((i = e._keys.indexOf(o.keyCode)) === -1 && e._keys.push(o.keyCode), t || o.preventDefault()) : e.keysUp.indexOf(o.keyCode) === -1 && e.keysDown.indexOf(o.keyCode) === -1 && e.keysLeft.indexOf(o.keyCode) === -1 && e.keysRight.indexOf(o.keyCode) === -1 && e.keysUpward.indexOf(o.keyCode) === -1 && e.keysDownward.indexOf(o.keyCode) === -1 || ((i = e._keys.indexOf(o.keyCode)) >= 0 && e._keys.splice(i, 1), t || o.preventDefault()));
+ }));
+ }, r.prototype.detachControl = function(t) {
+ this._scene && (this._onKeyboardObserver && this._scene.onKeyboardObservable.remove(this._onKeyboardObserver), this._onCanvasBlurObserver && this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver), this._onKeyboardObserver = null, this._onCanvasBlurObserver = null), this._keys = [];
+ }, r.prototype.checkInputs = function() {
+ if (this._onKeyboardObserver)
+ for (var t = this.camera, e = 0; e < this._keys.length; e++) {
+ var n = this._keys[e], i = t._computeLocalCameraSpeed();
+ this.keysLeft.indexOf(n) !== -1 ? t._localDirection.copyFromFloats(-i, 0, 0) : this.keysUp.indexOf(n) !== -1 ? t._localDirection.copyFromFloats(0, 0, i) : this.keysRight.indexOf(n) !== -1 ? t._localDirection.copyFromFloats(i, 0, 0) : this.keysDown.indexOf(n) !== -1 ? t._localDirection.copyFromFloats(0, 0, -i) : this.keysUpward.indexOf(n) !== -1 ? t._localDirection.copyFromFloats(0, i, 0) : this.keysDownward.indexOf(n) !== -1 && t._localDirection.copyFromFloats(0, -i, 0), t.getScene().useRightHandedSystem && (t._localDirection.z *= -1), t.getViewMatrix().invertToRef(t._cameraTransformMatrix), c.e.TransformNormalToRef(t._localDirection, t._cameraTransformMatrix, t._transformedDirection), t.cameraDirection.addInPlace(t._transformedDirection);
+ }
+ }, r.prototype.getClassName = function() {
+ return "FreeCameraKeyboardMoveInput";
+ }, r.prototype._onLostFocus = function() {
+ this._keys = [];
+ }, r.prototype.getSimpleName = function() {
+ return "keyboard";
+ }, Object(u.c)([Object(w.c)()], r.prototype, "keysUp", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysUpward", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysDown", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysDownward", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysLeft", void 0), Object(u.c)([Object(w.c)()], r.prototype, "keysRight", void 0), r;
+ }();
+ Tn.FreeCameraKeyboardMoveInput = tl;
+ var nl = function() {
+ function r(t) {
+ t === void 0 && (t = !0), this.touchEnabled = t, this.buttons = [0, 1, 2], this.angularSensibility = 2e3, this.previousPosition = null, this.onPointerMovedObservable = new P.c(), this._allowCameraRotation = !0;
+ }
+ return r.prototype.attachControl = function(t) {
+ var e = this;
+ t = Ke.b.BackCompatCameraNoPreventDefault(arguments);
+ var n = this.camera.getEngine(), i = n.getInputElement();
+ this._pointerInput || (this._pointerInput = function(o) {
+ var a = o.event;
+ if (!n.isInVRExclusivePointerMode && (e.touchEnabled || a.pointerType !== "touch") && (o.type === Et.a.POINTERMOVE || e.buttons.indexOf(a.button) !== -1)) {
+ var s = a.srcElement || a.target;
+ if (o.type === Et.a.POINTERDOWN && s) {
+ try {
+ s.setPointerCapture(a.pointerId);
+ } catch {
+ }
+ e.previousPosition = { x: a.clientX, y: a.clientY }, t || (a.preventDefault(), i && i.focus()), n.isPointerLock && e._onMouseMove && e._onMouseMove(o.event);
+ } else if (o.type === Et.a.POINTERUP && s) {
+ try {
+ s.releasePointerCapture(a.pointerId);
+ } catch {
+ }
+ e.previousPosition = null, t || a.preventDefault();
+ } else if (o.type === Et.a.POINTERMOVE) {
+ if (!e.previousPosition)
+ return void (n.isPointerLock && e._onMouseMove && e._onMouseMove(o.event));
+ var p = a.clientX - e.previousPosition.x, m = a.clientY - e.previousPosition.y;
+ e.camera.getScene().useRightHandedSystem && (p *= -1), e.camera.parent && e.camera.parent._getWorldMatrixDeterminant() < 0 && (p *= -1), e._allowCameraRotation && (e.camera.cameraRotation.y += p / e.angularSensibility, e.camera.cameraRotation.x += m / e.angularSensibility), e.onPointerMovedObservable.notifyObservers({ offsetX: p, offsetY: m }), e.previousPosition = { x: a.clientX, y: a.clientY }, t || a.preventDefault();
+ }
+ }
+ }), this._onMouseMove = function(o) {
+ if (n.isPointerLock && !n.isInVRExclusivePointerMode) {
+ var a = o.movementX || o.mozMovementX || o.webkitMovementX || o.msMovementX || 0;
+ e.camera.getScene().useRightHandedSystem && (a *= -1), e.camera.parent && e.camera.parent._getWorldMatrixDeterminant() < 0 && (a *= -1), e.camera.cameraRotation.y += a / e.angularSensibility;
+ var s = o.movementY || o.mozMovementY || o.webkitMovementY || o.msMovementY || 0;
+ e.camera.cameraRotation.x += s / e.angularSensibility, e.previousPosition = null, t || o.preventDefault();
+ }
+ }, this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, Et.a.POINTERDOWN | Et.a.POINTERUP | Et.a.POINTERMOVE), i && i.addEventListener("contextmenu", this.onContextMenu.bind(this), !1);
+ }, r.prototype.onContextMenu = function(t) {
+ t.preventDefault();
+ }, r.prototype.detachControl = function(t) {
+ if (this._observer) {
+ if (this.camera.getScene().onPointerObservable.remove(this._observer), this.onContextMenu) {
+ var e = this.camera.getEngine().getInputElement();
+ e && e.removeEventListener("contextmenu", this.onContextMenu);
+ }
+ this.onPointerMovedObservable && this.onPointerMovedObservable.clear(), this._observer = null, this._onMouseMove = null, this.previousPosition = null;
+ }
+ }, r.prototype.getClassName = function() {
+ return "FreeCameraMouseInput";
+ }, r.prototype.getSimpleName = function() {
+ return "mouse";
+ }, Object(u.c)([Object(w.c)()], r.prototype, "buttons", void 0), Object(u.c)([Object(w.c)()], r.prototype, "angularSensibility", void 0), r;
+ }();
+ Tn.FreeCameraMouseInput = nl;
+ var Wt, tb = function() {
+ function r() {
+ this.wheelPrecisionX = 3, this.wheelPrecisionY = 3, this.wheelPrecisionZ = 3, this.onChangedObservable = new P.c(), this._wheelDeltaX = 0, this._wheelDeltaY = 0, this._wheelDeltaZ = 0, this._ffMultiplier = 12, this._normalize = 120;
+ }
+ return r.prototype.attachControl = function(t) {
+ var e = this;
+ t = Ke.b.BackCompatCameraNoPreventDefault(arguments), this._wheel = function(n) {
+ if (n.type === Et.a.POINTERWHEEL) {
+ var i = n.event, o = i.deltaMode === WheelEvent.DOM_DELTA_LINE ? e._ffMultiplier : 1;
+ i.deltaY !== void 0 ? (e._wheelDeltaX += e.wheelPrecisionX * o * i.deltaX / e._normalize, e._wheelDeltaY -= e.wheelPrecisionY * o * i.deltaY / e._normalize, e._wheelDeltaZ += e.wheelPrecisionZ * o * i.deltaZ / e._normalize) : i.wheelDeltaY !== void 0 ? (e._wheelDeltaX += e.wheelPrecisionX * o * i.wheelDeltaX / e._normalize, e._wheelDeltaY -= e.wheelPrecisionY * o * i.wheelDeltaY / e._normalize, e._wheelDeltaZ += e.wheelPrecisionZ * o * i.wheelDeltaZ / e._normalize) : i.wheelDelta && (e._wheelDeltaY -= e.wheelPrecisionY * i.wheelDelta / e._normalize), i.preventDefault && (t || i.preventDefault());
+ }
+ }, this._observer = this.camera.getScene().onPointerObservable.add(this._wheel, Et.a.POINTERWHEEL);
+ }, r.prototype.detachControl = function(t) {
+ this._observer && (this.camera.getScene().onPointerObservable.remove(this._observer), this._observer = null, this._wheel = null), this.onChangedObservable && this.onChangedObservable.clear();
+ }, r.prototype.checkInputs = function() {
+ this.onChangedObservable.notifyObservers({ wheelDeltaX: this._wheelDeltaX, wheelDeltaY: this._wheelDeltaY, wheelDeltaZ: this._wheelDeltaZ }), this._wheelDeltaX = 0, this._wheelDeltaY = 0, this._wheelDeltaZ = 0;
+ }, r.prototype.getClassName = function() {
+ return "BaseCameraMouseWheelInput";
+ }, r.prototype.getSimpleName = function() {
+ return "mousewheel";
+ }, Object(u.c)([Object(w.c)()], r.prototype, "wheelPrecisionX", void 0), Object(u.c)([Object(w.c)()], r.prototype, "wheelPrecisionY", void 0), Object(u.c)([Object(w.c)()], r.prototype, "wheelPrecisionZ", void 0), r;
+ }();
+ (function(r) {
+ r[r.MoveRelative = 0] = "MoveRelative", r[r.RotateRelative = 1] = "RotateRelative", r[r.MoveScene = 2] = "MoveScene";
+ })(Wt || (Wt = {}));
+ var il = function(r) {
+ function t() {
+ var e = r !== null && r.apply(this, arguments) || this;
+ return e._moveRelative = c.e.Zero(), e._rotateRelative = c.e.Zero(), e._moveScene = c.e.Zero(), e._wheelXAction = Wt.MoveRelative, e._wheelXActionCoordinate = Se.b.X, e._wheelYAction = Wt.MoveRelative, e._wheelYActionCoordinate = Se.b.Z, e._wheelZAction = null, e._wheelZActionCoordinate = null, e;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "FreeCameraMouseWheelInput";
+ }, Object.defineProperty(t.prototype, "wheelXMoveRelative", { get: function() {
+ return this._wheelXAction !== Wt.MoveRelative ? null : this._wheelXActionCoordinate;
+ }, set: function(e) {
+ e === null && this._wheelXAction !== Wt.MoveRelative || (this._wheelXAction = Wt.MoveRelative, this._wheelXActionCoordinate = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "wheelYMoveRelative", { get: function() {
+ return this._wheelYAction !== Wt.MoveRelative ? null : this._wheelYActionCoordinate;
+ }, set: function(e) {
+ e === null && this._wheelYAction !== Wt.MoveRelative || (this._wheelYAction = Wt.MoveRelative, this._wheelYActionCoordinate = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "wheelZMoveRelative", { get: function() {
+ return this._wheelZAction !== Wt.MoveRelative ? null : this._wheelZActionCoordinate;
+ }, set: function(e) {
+ e === null && this._wheelZAction !== Wt.MoveRelative || (this._wheelZAction = Wt.MoveRelative, this._wheelZActionCoordinate = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "wheelXRotateRelative", { get: function() {
+ return this._wheelXAction !== Wt.RotateRelative ? null : this._wheelXActionCoordinate;
+ }, set: function(e) {
+ e === null && this._wheelXAction !== Wt.RotateRelative || (this._wheelXAction = Wt.RotateRelative, this._wheelXActionCoordinate = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "wheelYRotateRelative", { get: function() {
+ return this._wheelYAction !== Wt.RotateRelative ? null : this._wheelYActionCoordinate;
+ }, set: function(e) {
+ e === null && this._wheelYAction !== Wt.RotateRelative || (this._wheelYAction = Wt.RotateRelative, this._wheelYActionCoordinate = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "wheelZRotateRelative", { get: function() {
+ return this._wheelZAction !== Wt.RotateRelative ? null : this._wheelZActionCoordinate;
+ }, set: function(e) {
+ e === null && this._wheelZAction !== Wt.RotateRelative || (this._wheelZAction = Wt.RotateRelative, this._wheelZActionCoordinate = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "wheelXMoveScene", { get: function() {
+ return this._wheelXAction !== Wt.MoveScene ? null : this._wheelXActionCoordinate;
+ }, set: function(e) {
+ e === null && this._wheelXAction !== Wt.MoveScene || (this._wheelXAction = Wt.MoveScene, this._wheelXActionCoordinate = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "wheelYMoveScene", { get: function() {
+ return this._wheelYAction !== Wt.MoveScene ? null : this._wheelYActionCoordinate;
+ }, set: function(e) {
+ e === null && this._wheelYAction !== Wt.MoveScene || (this._wheelYAction = Wt.MoveScene, this._wheelYActionCoordinate = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "wheelZMoveScene", { get: function() {
+ return this._wheelZAction !== Wt.MoveScene ? null : this._wheelZActionCoordinate;
+ }, set: function(e) {
+ e === null && this._wheelZAction !== Wt.MoveScene || (this._wheelZAction = Wt.MoveScene, this._wheelZActionCoordinate = e);
+ }, enumerable: !1, configurable: !0 }), t.prototype.checkInputs = function() {
+ if (this._wheelDeltaX !== 0 || this._wheelDeltaY !== 0 || this._wheelDeltaZ != 0) {
+ this._moveRelative.setAll(0), this._rotateRelative.setAll(0), this._moveScene.setAll(0), this._updateCamera(), this.camera.getScene().useRightHandedSystem && (this._moveRelative.z *= -1);
+ var e = c.a.Zero();
+ this.camera.getViewMatrix().invertToRef(e);
+ var n = c.e.Zero();
+ c.e.TransformNormalToRef(this._moveRelative, e, n), this.camera.cameraRotation.x += this._rotateRelative.x / 200, this.camera.cameraRotation.y += this._rotateRelative.y / 200, this.camera.cameraDirection.addInPlace(n), this.camera.cameraDirection.addInPlace(this._moveScene), r.prototype.checkInputs.call(this);
+ }
+ }, t.prototype._updateCamera = function() {
+ var e = this._moveRelative, n = this._rotateRelative, i = this._moveScene, o = function(a, s, p) {
+ if (a !== 0 && s !== null && p !== null) {
+ var m = null;
+ switch (s) {
+ case Wt.MoveRelative:
+ m = e;
+ break;
+ case Wt.RotateRelative:
+ m = n;
+ break;
+ case Wt.MoveScene:
+ m = i;
+ }
+ switch (p) {
+ case Se.b.X:
+ m.set(a, 0, 0);
+ break;
+ case Se.b.Y:
+ m.set(0, a, 0);
+ break;
+ case Se.b.Z:
+ m.set(0, 0, a);
+ }
+ }
+ };
+ o(this._wheelDeltaX, this._wheelXAction, this._wheelXActionCoordinate), o(this._wheelDeltaY, this._wheelYAction, this._wheelYActionCoordinate), o(this._wheelDeltaZ, this._wheelZAction, this._wheelZActionCoordinate);
+ }, Object(u.c)([Object(w.c)()], t.prototype, "wheelXMoveRelative", null), Object(u.c)([Object(w.c)()], t.prototype, "wheelYMoveRelative", null), Object(u.c)([Object(w.c)()], t.prototype, "wheelZMoveRelative", null), Object(u.c)([Object(w.c)()], t.prototype, "wheelXRotateRelative", null), Object(u.c)([Object(w.c)()], t.prototype, "wheelYRotateRelative", null), Object(u.c)([Object(w.c)()], t.prototype, "wheelZRotateRelative", null), Object(u.c)([Object(w.c)()], t.prototype, "wheelXMoveScene", null), Object(u.c)([Object(w.c)()], t.prototype, "wheelYMoveScene", null), Object(u.c)([Object(w.c)()], t.prototype, "wheelZMoveScene", null), t;
+ }(tb);
+ Tn.FreeCameraMouseWheelInput = il;
+ var rl = function() {
+ function r(t) {
+ t === void 0 && (t = !1), this.allowMouse = t, this.touchAngularSensibility = 2e5, this.touchMoveSensibility = 250, this._offsetX = null, this._offsetY = null, this._pointerPressed = new Array();
+ }
+ return r.prototype.attachControl = function(t) {
+ var e = this;
+ t = Ke.b.BackCompatCameraNoPreventDefault(arguments);
+ var n = null;
+ if (this._pointerInput === void 0 && (this._onLostFocus = function() {
+ e._offsetX = null, e._offsetY = null;
+ }, this._pointerInput = function(a) {
+ var s = a.event, p = !e.camera.getEngine().hostInformation.isMobile && s instanceof MouseEvent;
+ if (e.allowMouse || s.pointerType !== "mouse" && !p) {
+ if (a.type === Et.a.POINTERDOWN) {
+ if (t || s.preventDefault(), e._pointerPressed.push(s.pointerId), e._pointerPressed.length !== 1)
+ return;
+ n = { x: s.clientX, y: s.clientY };
+ } else if (a.type === Et.a.POINTERUP) {
+ if (t || s.preventDefault(), (m = e._pointerPressed.indexOf(s.pointerId)) === -1 || (e._pointerPressed.splice(m, 1), m != 0))
+ return;
+ n = null, e._offsetX = null, e._offsetY = null;
+ } else if (a.type === Et.a.POINTERMOVE) {
+ if (t || s.preventDefault(), !n)
+ return;
+ var m;
+ if ((m = e._pointerPressed.indexOf(s.pointerId)) != 0)
+ return;
+ e._offsetX = s.clientX - n.x, e._offsetY = -(s.clientY - n.y);
+ }
+ }
+ }), this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, Et.a.POINTERDOWN | Et.a.POINTERUP | Et.a.POINTERMOVE), this._onLostFocus) {
+ var i = this.camera.getEngine(), o = i.getInputElement();
+ o && o.addEventListener("blur", this._onLostFocus);
+ }
+ }, r.prototype.detachControl = function(t) {
+ if (this._pointerInput) {
+ if (this._observer && (this.camera.getScene().onPointerObservable.remove(this._observer), this._observer = null), this._onLostFocus) {
+ var e = this.camera.getEngine().getInputElement();
+ e && e.removeEventListener("blur", this._onLostFocus), this._onLostFocus = null;
+ }
+ this._pointerPressed = [], this._offsetX = null, this._offsetY = null;
+ }
+ }, r.prototype.checkInputs = function() {
+ if (this._offsetX !== null && this._offsetY !== null && (this._offsetX !== 0 || this._offsetY !== 0)) {
+ var t = this.camera;
+ if (t.cameraRotation.y = this._offsetX / this.touchAngularSensibility, this._pointerPressed.length > 1)
+ t.cameraRotation.x = -this._offsetY / this.touchAngularSensibility;
+ else {
+ var e = t._computeLocalCameraSpeed(), n = new c.e(0, 0, e * this._offsetY / this.touchMoveSensibility);
+ c.a.RotationYawPitchRollToRef(t.rotation.y, t.rotation.x, 0, t._cameraRotationMatrix), t.cameraDirection.addInPlace(c.e.TransformCoordinates(n, t._cameraRotationMatrix));
+ }
+ }
+ }, r.prototype.getClassName = function() {
+ return "FreeCameraTouchInput";
+ }, r.prototype.getSimpleName = function() {
+ return "touch";
+ }, Object(u.c)([Object(w.c)()], r.prototype, "touchAngularSensibility", void 0), Object(u.c)([Object(w.c)()], r.prototype, "touchMoveSensibility", void 0), r;
+ }();
+ Tn.FreeCameraTouchInput = rl;
+ var ma = function(r) {
+ function t(e) {
+ var n = r.call(this, e) || this;
+ return n._mouseInput = null, n._mouseWheelInput = null, n;
+ }
+ return Object(u.d)(t, r), t.prototype.addKeyboard = function() {
+ return this.add(new tl()), this;
+ }, t.prototype.addMouse = function(e) {
+ return e === void 0 && (e = !0), this._mouseInput || (this._mouseInput = new nl(e), this.add(this._mouseInput)), this;
+ }, t.prototype.removeMouse = function() {
+ return this._mouseInput && this.remove(this._mouseInput), this;
+ }, t.prototype.addMouseWheel = function() {
+ return this._mouseWheelInput || (this._mouseWheelInput = new il(), this.add(this._mouseWheelInput)), this;
+ }, t.prototype.removeMouseWheel = function() {
+ return this._mouseWheelInput && this.remove(this._mouseWheelInput), this;
+ }, t.prototype.addTouch = function() {
+ return this.add(new rl()), this;
+ }, t.prototype.clear = function() {
+ r.prototype.clear.call(this), this._mouseInput = null;
+ }, t;
+ }(_a);
+ ma.prototype.addDeviceOrientation = function() {
+ return this._deviceOrientationInput || (this._deviceOrientationInput = new ol(), this.add(this._deviceOrientationInput)), this;
+ };
+ var ol = function() {
+ function r() {
+ var t = this;
+ this._screenOrientationAngle = 0, this._screenQuaternion = new c.b(), this._alpha = 0, this._beta = 0, this._gamma = 0, this._onDeviceOrientationChangedObservable = new P.c(), this._orientationChanged = function() {
+ t._screenOrientationAngle = window.orientation !== void 0 ? +window.orientation : window.screen.orientation && window.screen.orientation.angle ? window.screen.orientation.angle : 0, t._screenOrientationAngle = -Ke.b.ToRadians(t._screenOrientationAngle / 2), t._screenQuaternion.copyFromFloats(0, Math.sin(t._screenOrientationAngle), 0, Math.cos(t._screenOrientationAngle));
+ }, this._deviceOrientation = function(e) {
+ t._alpha = e.alpha !== null ? e.alpha : 0, t._beta = e.beta !== null ? e.beta : 0, t._gamma = e.gamma !== null ? e.gamma : 0, e.alpha !== null && t._onDeviceOrientationChangedObservable.notifyObservers();
+ }, this._constantTranform = new c.b(-Math.sqrt(0.5), 0, 0, Math.sqrt(0.5)), this._orientationChanged();
+ }
+ return r.WaitForOrientationChangeAsync = function(t) {
+ return new Promise(function(e, n) {
+ var i = !1, o = function() {
+ window.removeEventListener("deviceorientation", o), i = !0, e();
+ };
+ t && setTimeout(function() {
+ i || (window.removeEventListener("deviceorientation", o), n("WaitForOrientationChangeAsync timed out"));
+ }, t), typeof DeviceOrientationEvent < "u" && typeof DeviceOrientationEvent.requestPermission == "function" ? DeviceOrientationEvent.requestPermission().then(function(a) {
+ a == "granted" ? window.addEventListener("deviceorientation", o) : Ke.b.Warn("Permission not granted.");
+ }).catch(function(a) {
+ Ke.b.Error(a);
+ }) : window.addEventListener("deviceorientation", o);
+ });
+ }, Object.defineProperty(r.prototype, "camera", { get: function() {
+ return this._camera;
+ }, set: function(t) {
+ var e = this;
+ this._camera = t, this._camera == null || this._camera.rotationQuaternion || (this._camera.rotationQuaternion = new c.b()), this._camera && this._camera.onDisposeObservable.add(function() {
+ e._onDeviceOrientationChangedObservable.clear();
+ });
+ }, enumerable: !1, configurable: !0 }), r.prototype.attachControl = function() {
+ var t = this, e = this.camera.getScene().getEngine().getHostWindow();
+ if (e) {
+ var n = function() {
+ e.addEventListener("orientationchange", t._orientationChanged), e.addEventListener("deviceorientation", t._deviceOrientation), t._orientationChanged();
+ };
+ typeof DeviceOrientationEvent < "u" && typeof DeviceOrientationEvent.requestPermission == "function" ? DeviceOrientationEvent.requestPermission().then(function(i) {
+ i === "granted" ? n() : Ke.b.Warn("Permission not granted.");
+ }).catch(function(i) {
+ Ke.b.Error(i);
+ }) : n();
+ }
+ }, r.prototype.detachControl = function(t) {
+ window.removeEventListener("orientationchange", this._orientationChanged), window.removeEventListener("deviceorientation", this._deviceOrientation), this._alpha = 0;
+ }, r.prototype.checkInputs = function() {
+ this._alpha && (c.b.RotationYawPitchRollToRef(Ke.b.ToRadians(this._alpha), Ke.b.ToRadians(this._beta), -Ke.b.ToRadians(this._gamma), this.camera.rotationQuaternion), this._camera.rotationQuaternion.multiplyInPlace(this._screenQuaternion), this._camera.rotationQuaternion.multiplyInPlace(this._constantTranform), this._camera.rotationQuaternion.z *= -1, this._camera.rotationQuaternion.w *= -1);
+ }, r.prototype.getClassName = function() {
+ return "FreeCameraDeviceOrientationInput";
+ }, r.prototype.getSimpleName = function() {
+ return "deviceOrientation";
+ }, r;
+ }();
+ Tn.FreeCameraDeviceOrientationInput = ol;
+ var al = function() {
+ function r() {
+ this.gamepadAngularSensibility = 200, this.gamepadMoveSensibility = 40, this._yAxisScale = 1, this._cameraTransform = c.a.Identity(), this._deltaTransform = c.e.Zero(), this._vector3 = c.e.Zero(), this._vector2 = c.d.Zero();
+ }
+ return Object.defineProperty(r.prototype, "invertYAxis", { get: function() {
+ return this._yAxisScale !== 1;
+ }, set: function(t) {
+ this._yAxisScale = t ? -1 : 1;
+ }, enumerable: !1, configurable: !0 }), r.prototype.attachControl = function() {
+ var t = this, e = this.camera.getScene().gamepadManager;
+ this._onGamepadConnectedObserver = e.onGamepadConnectedObservable.add(function(n) {
+ n.type !== Sn.POSE_ENABLED && (t.gamepad && n.type !== Sn.XBOX || (t.gamepad = n));
+ }), this._onGamepadDisconnectedObserver = e.onGamepadDisconnectedObservable.add(function(n) {
+ t.gamepad === n && (t.gamepad = null);
+ }), this.gamepad = e.getGamepadByType(Sn.XBOX), !this.gamepad && e.gamepads.length && (this.gamepad = e.gamepads[0]);
+ }, r.prototype.detachControl = function(t) {
+ this.camera.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver), this.camera.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver), this.gamepad = null;
+ }, r.prototype.checkInputs = function() {
+ if (this.gamepad && this.gamepad.leftStick) {
+ var t = this.camera, e = this.gamepad.leftStick, n = e.x / this.gamepadMoveSensibility, i = e.y / this.gamepadMoveSensibility;
+ e.x = Math.abs(n) > 5e-3 ? 0 + n : 0, e.y = Math.abs(i) > 5e-3 ? 0 + i : 0;
+ var o = this.gamepad.rightStick;
+ if (o) {
+ var a = o.x / this.gamepadAngularSensibility, s = o.y / this.gamepadAngularSensibility * this._yAxisScale;
+ o.x = Math.abs(a) > 1e-3 ? 0 + a : 0, o.y = Math.abs(s) > 1e-3 ? 0 + s : 0;
+ } else
+ o = { x: 0, y: 0 };
+ t.rotationQuaternion ? t.rotationQuaternion.toRotationMatrix(this._cameraTransform) : c.a.RotationYawPitchRollToRef(t.rotation.y, t.rotation.x, 0, this._cameraTransform);
+ var p = 50 * t._computeLocalCameraSpeed();
+ this._vector3.copyFromFloats(e.x * p, 0, -e.y * p), c.e.TransformCoordinatesToRef(this._vector3, this._cameraTransform, this._deltaTransform), t.cameraDirection.addInPlace(this._deltaTransform), this._vector2.copyFromFloats(o.y, o.x), t.cameraRotation.addInPlace(this._vector2);
+ }
+ }, r.prototype.getClassName = function() {
+ return "FreeCameraGamepadInput";
+ }, r.prototype.getSimpleName = function() {
+ return "gamepad";
+ }, Object(u.c)([Object(w.c)()], r.prototype, "gamepadAngularSensibility", void 0), Object(u.c)([Object(w.c)()], r.prototype, "gamepadMoveSensibility", void 0), r;
+ }();
+ Tn.FreeCameraGamepadInput = al;
+ var mn, Ed = l(112);
+ (function(r) {
+ r[r.X = 0] = "X", r[r.Y = 1] = "Y", r[r.Z = 2] = "Z";
+ })(mn || (mn = {}));
+ var sl = function() {
+ function r(t, e) {
+ var n = this, i = Object(u.a)(Object(u.a)({}, r._GetDefaultOptions()), e);
+ if (this._leftJoystick = !!t, r._globalJoystickIndex++, this._axisTargetedByLeftAndRight = mn.X, this._axisTargetedByUpAndDown = mn.Y, this.reverseLeftRight = !1, this.reverseUpDown = !1, this._touches = new Ed.a(), this.deltaPosition = c.e.Zero(), this._joystickSensibility = 25, this._inversedSensibility = 1 / (this._joystickSensibility / 1e3), this._onResize = function(a) {
+ r.vjCanvasWidth = window.innerWidth, r.vjCanvasHeight = window.innerHeight, r.Canvas && (r.Canvas.width = r.vjCanvasWidth, r.Canvas.height = r.vjCanvasHeight), r.halfWidth = r.vjCanvasWidth / 2;
+ }, !r.Canvas) {
+ window.addEventListener("resize", this._onResize, !1), r.Canvas = document.createElement("canvas"), r.vjCanvasWidth = window.innerWidth, r.vjCanvasHeight = window.innerHeight, r.Canvas.width = window.innerWidth, r.Canvas.height = window.innerHeight, r.Canvas.style.width = "100%", r.Canvas.style.height = "100%", r.Canvas.style.position = "absolute", r.Canvas.style.backgroundColor = "transparent", r.Canvas.style.top = "0px", r.Canvas.style.left = "0px", r.Canvas.style.zIndex = "5", r.Canvas.style.msTouchAction = "none", r.Canvas.style.touchAction = "none", r.Canvas.setAttribute("touch-action", "none");
+ var o = r.Canvas.getContext("2d");
+ if (!o)
+ throw new Error("Unable to create canvas for virtual joystick");
+ r.vjCanvasContext = o, r.vjCanvasContext.strokeStyle = "#ffffff", r.vjCanvasContext.lineWidth = 2, document.body.appendChild(r.Canvas);
+ }
+ r.halfWidth = r.Canvas.width / 2, this.pressed = !1, this.limitToContainer = i.limitToContainer, this._joystickColor = i.color, this.containerSize = i.containerSize, this.puckSize = i.puckSize, i.position && this.setPosition(i.position.x, i.position.y), i.puckImage && this.setPuckImage(i.puckImage), i.containerImage && this.setContainerImage(i.containerImage), i.alwaysVisible && r._alwaysVisibleSticks++, this.alwaysVisible = i.alwaysVisible, this._joystickPointerID = -1, this._joystickPointerPos = new c.d(0, 0), this._joystickPreviousPointerPos = new c.d(0, 0), this._joystickPointerStartPos = new c.d(0, 0), this._deltaJoystickVector = new c.d(0, 0), this._onPointerDownHandlerRef = function(a) {
+ n._onPointerDown(a);
+ }, this._onPointerMoveHandlerRef = function(a) {
+ n._onPointerMove(a);
+ }, this._onPointerUpHandlerRef = function(a) {
+ n._onPointerUp(a);
+ }, r.Canvas.addEventListener("pointerdown", this._onPointerDownHandlerRef, !1), r.Canvas.addEventListener("pointermove", this._onPointerMoveHandlerRef, !1), r.Canvas.addEventListener("pointerup", this._onPointerUpHandlerRef, !1), r.Canvas.addEventListener("pointerout", this._onPointerUpHandlerRef, !1), r.Canvas.addEventListener("contextmenu", function(a) {
+ a.preventDefault();
+ }, !1), requestAnimationFrame(function() {
+ n._drawVirtualJoystick();
+ });
+ }
+ return r._GetDefaultOptions = function() {
+ return { puckSize: 40, containerSize: 60, color: "cyan", puckImage: void 0, containerImage: void 0, position: void 0, alwaysVisible: !1, limitToContainer: !1 };
+ }, r.prototype.setJoystickSensibility = function(t) {
+ this._joystickSensibility = t, this._inversedSensibility = 1 / (this._joystickSensibility / 1e3);
+ }, r.prototype._onPointerDown = function(t) {
+ t.preventDefault(), (this._leftJoystick === !0 ? t.clientX < r.halfWidth : t.clientX > r.halfWidth) && this._joystickPointerID < 0 ? (this._joystickPointerID = t.pointerId, this._joystickPosition ? (this._joystickPointerStartPos = this._joystickPosition.clone(), this._joystickPointerPos = this._joystickPosition.clone(), this._joystickPreviousPointerPos = this._joystickPosition.clone(), this._onPointerMove(t)) : (this._joystickPointerStartPos.x = t.clientX, this._joystickPointerStartPos.y = t.clientY, this._joystickPointerPos = this._joystickPointerStartPos.clone(), this._joystickPreviousPointerPos = this._joystickPointerStartPos.clone()), this._deltaJoystickVector.x = 0, this._deltaJoystickVector.y = 0, this.pressed = !0, this._touches.add(t.pointerId.toString(), t)) : r._globalJoystickIndex < 2 && this._action && (this._action(), this._touches.add(t.pointerId.toString(), { x: t.clientX, y: t.clientY, prevX: t.clientX, prevY: t.clientY }));
+ }, r.prototype._onPointerMove = function(t) {
+ if (this._joystickPointerID == t.pointerId) {
+ if (this.limitToContainer) {
+ var e = new c.d(t.clientX - this._joystickPointerStartPos.x, t.clientY - this._joystickPointerStartPos.y), n = e.length();
+ n > this.containerSize && e.scaleInPlace(this.containerSize / n), this._joystickPointerPos.x = this._joystickPointerStartPos.x + e.x, this._joystickPointerPos.y = this._joystickPointerStartPos.y + e.y;
+ } else
+ this._joystickPointerPos.x = t.clientX, this._joystickPointerPos.y = t.clientY;
+ this._deltaJoystickVector = this._joystickPointerPos.clone(), this._deltaJoystickVector = this._deltaJoystickVector.subtract(this._joystickPointerStartPos), 0 < r._alwaysVisibleSticks && (this._leftJoystick ? this._joystickPointerPos.x = Math.min(r.halfWidth, this._joystickPointerPos.x) : this._joystickPointerPos.x = Math.max(r.halfWidth, this._joystickPointerPos.x));
+ var i = (this.reverseLeftRight ? -1 : 1) * this._deltaJoystickVector.x / this._inversedSensibility;
+ switch (this._axisTargetedByLeftAndRight) {
+ case mn.X:
+ this.deltaPosition.x = Math.min(1, Math.max(-1, i));
+ break;
+ case mn.Y:
+ this.deltaPosition.y = Math.min(1, Math.max(-1, i));
+ break;
+ case mn.Z:
+ this.deltaPosition.z = Math.min(1, Math.max(-1, i));
+ }
+ var o = (this.reverseUpDown ? 1 : -1) * this._deltaJoystickVector.y / this._inversedSensibility;
+ switch (this._axisTargetedByUpAndDown) {
+ case mn.X:
+ this.deltaPosition.x = Math.min(1, Math.max(-1, o));
+ break;
+ case mn.Y:
+ this.deltaPosition.y = Math.min(1, Math.max(-1, o));
+ break;
+ case mn.Z:
+ this.deltaPosition.z = Math.min(1, Math.max(-1, o));
+ }
+ } else {
+ var a = this._touches.get(t.pointerId.toString());
+ a && (a.x = t.clientX, a.y = t.clientY);
+ }
+ }, r.prototype._onPointerUp = function(t) {
+ if (this._joystickPointerID == t.pointerId)
+ this._clearPreviousDraw(), this._joystickPointerID = -1, this.pressed = !1;
+ else {
+ var e = this._touches.get(t.pointerId.toString());
+ e && r.vjCanvasContext.clearRect(e.prevX - 44, e.prevY - 44, 88, 88);
+ }
+ this._deltaJoystickVector.x = 0, this._deltaJoystickVector.y = 0, this._touches.remove(t.pointerId.toString());
+ }, r.prototype.setJoystickColor = function(t) {
+ this._joystickColor = t;
+ }, Object.defineProperty(r.prototype, "containerSize", { get: function() {
+ return this._joystickContainerSize;
+ }, set: function(t) {
+ this._joystickContainerSize = t, this._clearContainerSize = ~~(2.1 * this._joystickContainerSize), this._clearContainerSizeOffset = ~~(this._clearContainerSize / 2);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "puckSize", { get: function() {
+ return this._joystickPuckSize;
+ }, set: function(t) {
+ this._joystickPuckSize = t, this._clearPuckSize = ~~(2.1 * this._joystickPuckSize), this._clearPuckSizeOffset = ~~(this._clearPuckSize / 2);
+ }, enumerable: !1, configurable: !0 }), r.prototype.clearPosition = function() {
+ this.alwaysVisible = !1, this._joystickPosition = null;
+ }, Object.defineProperty(r.prototype, "alwaysVisible", { get: function() {
+ return this._alwaysVisible;
+ }, set: function(t) {
+ this._alwaysVisible !== t && (t && this._joystickPosition ? (r._alwaysVisibleSticks++, this._alwaysVisible = !0) : (r._alwaysVisibleSticks--, this._alwaysVisible = !1));
+ }, enumerable: !1, configurable: !0 }), r.prototype.setPosition = function(t, e) {
+ this._joystickPointerStartPos && this._clearPreviousDraw(), this._joystickPosition = new c.d(t, e);
+ }, r.prototype.setActionOnTouch = function(t) {
+ this._action = t;
+ }, r.prototype.setAxisForLeftRight = function(t) {
+ switch (t) {
+ case mn.X:
+ case mn.Y:
+ case mn.Z:
+ this._axisTargetedByLeftAndRight = t;
+ break;
+ default:
+ this._axisTargetedByLeftAndRight = mn.X;
+ }
+ }, r.prototype.setAxisForUpDown = function(t) {
+ switch (t) {
+ case mn.X:
+ case mn.Y:
+ case mn.Z:
+ this._axisTargetedByUpAndDown = t;
+ break;
+ default:
+ this._axisTargetedByUpAndDown = mn.Y;
+ }
+ }, r.prototype._clearPreviousDraw = function() {
+ var t = this._joystickPosition || this._joystickPointerStartPos;
+ r.vjCanvasContext.clearRect(t.x - this._clearContainerSizeOffset, t.y - this._clearContainerSizeOffset, this._clearContainerSize, this._clearContainerSize), r.vjCanvasContext.clearRect(this._joystickPreviousPointerPos.x - this._clearPuckSizeOffset, this._joystickPreviousPointerPos.y - this._clearPuckSizeOffset, this._clearPuckSize, this._clearPuckSize);
+ }, r.prototype.setContainerImage = function(t) {
+ var e = this, n = new Image();
+ n.src = t, n.onload = function() {
+ return e._containerImage = n;
+ };
+ }, r.prototype.setPuckImage = function(t) {
+ var e = this, n = new Image();
+ n.src = t, n.onload = function() {
+ return e._puckImage = n;
+ };
+ }, r.prototype._drawContainer = function() {
+ var t = this._joystickPosition || this._joystickPointerStartPos;
+ this._clearPreviousDraw(), this._containerImage ? r.vjCanvasContext.drawImage(this._containerImage, t.x - this.containerSize, t.y - this.containerSize, 2 * this.containerSize, 2 * this.containerSize) : (r.vjCanvasContext.beginPath(), r.vjCanvasContext.strokeStyle = this._joystickColor, r.vjCanvasContext.lineWidth = 2, r.vjCanvasContext.arc(t.x, t.y, this.containerSize, 0, 2 * Math.PI, !0), r.vjCanvasContext.stroke(), r.vjCanvasContext.closePath(), r.vjCanvasContext.beginPath(), r.vjCanvasContext.lineWidth = 6, r.vjCanvasContext.strokeStyle = this._joystickColor, r.vjCanvasContext.arc(t.x, t.y, this.puckSize, 0, 2 * Math.PI, !0), r.vjCanvasContext.stroke(), r.vjCanvasContext.closePath());
+ }, r.prototype._drawPuck = function() {
+ this._puckImage ? r.vjCanvasContext.drawImage(this._puckImage, this._joystickPointerPos.x - this.puckSize, this._joystickPointerPos.y - this.puckSize, 2 * this.puckSize, 2 * this.puckSize) : (r.vjCanvasContext.beginPath(), r.vjCanvasContext.strokeStyle = this._joystickColor, r.vjCanvasContext.lineWidth = 2, r.vjCanvasContext.arc(this._joystickPointerPos.x, this._joystickPointerPos.y, this.puckSize, 0, 2 * Math.PI, !0), r.vjCanvasContext.stroke(), r.vjCanvasContext.closePath());
+ }, r.prototype._drawVirtualJoystick = function() {
+ var t = this;
+ this.alwaysVisible && this._drawContainer(), this.pressed && this._touches.forEach(function(e, n) {
+ n.pointerId === t._joystickPointerID ? (t.alwaysVisible || t._drawContainer(), t._drawPuck(), t._joystickPreviousPointerPos = t._joystickPointerPos.clone()) : (r.vjCanvasContext.clearRect(n.prevX - 44, n.prevY - 44, 88, 88), r.vjCanvasContext.beginPath(), r.vjCanvasContext.fillStyle = "white", r.vjCanvasContext.beginPath(), r.vjCanvasContext.strokeStyle = "red", r.vjCanvasContext.lineWidth = 6, r.vjCanvasContext.arc(n.x, n.y, 40, 0, 2 * Math.PI, !0), r.vjCanvasContext.stroke(), r.vjCanvasContext.closePath(), n.prevX = n.x, n.prevY = n.y);
+ }), requestAnimationFrame(function() {
+ t._drawVirtualJoystick();
+ });
+ }, r.prototype.releaseCanvas = function() {
+ r.Canvas && (r.Canvas.removeEventListener("pointerdown", this._onPointerDownHandlerRef), r.Canvas.removeEventListener("pointermove", this._onPointerMoveHandlerRef), r.Canvas.removeEventListener("pointerup", this._onPointerUpHandlerRef), r.Canvas.removeEventListener("pointerout", this._onPointerUpHandlerRef), window.removeEventListener("resize", this._onResize), document.body.removeChild(r.Canvas), r.Canvas = null);
+ }, r._globalJoystickIndex = 0, r._alwaysVisibleSticks = 0, r;
+ }();
+ ma.prototype.addVirtualJoystick = function() {
+ return this.add(new cl()), this;
+ };
+ var cl = function() {
+ function r() {
+ }
+ return r.prototype.getLeftJoystick = function() {
+ return this._leftjoystick;
+ }, r.prototype.getRightJoystick = function() {
+ return this._rightjoystick;
+ }, r.prototype.checkInputs = function() {
+ if (this._leftjoystick) {
+ var t = this.camera, e = 50 * t._computeLocalCameraSpeed(), n = c.a.RotationYawPitchRoll(t.rotation.y, t.rotation.x, 0), i = c.e.TransformCoordinates(new c.e(this._leftjoystick.deltaPosition.x * e, this._leftjoystick.deltaPosition.y * e, this._leftjoystick.deltaPosition.z * e), n);
+ t.cameraDirection = t.cameraDirection.add(i), t.cameraRotation = t.cameraRotation.addVector3(this._rightjoystick.deltaPosition), this._leftjoystick.pressed || (this._leftjoystick.deltaPosition = this._leftjoystick.deltaPosition.scale(0.9)), this._rightjoystick.pressed || (this._rightjoystick.deltaPosition = this._rightjoystick.deltaPosition.scale(0.9));
+ }
+ }, r.prototype.attachControl = function() {
+ this._leftjoystick = new sl(!0), this._leftjoystick.setAxisForUpDown(mn.Z), this._leftjoystick.setAxisForLeftRight(mn.X), this._leftjoystick.setJoystickSensibility(0.15), this._rightjoystick = new sl(!1), this._rightjoystick.setAxisForUpDown(mn.X), this._rightjoystick.setAxisForLeftRight(mn.Y), this._rightjoystick.reverseUpDown = !0, this._rightjoystick.setJoystickSensibility(0.05), this._rightjoystick.setJoystickColor("yellow");
+ }, r.prototype.detachControl = function(t) {
+ this._leftjoystick.releaseCanvas(), this._rightjoystick.releaseCanvas();
+ }, r.prototype.getClassName = function() {
+ return "FreeCameraVirtualJoystickInput";
+ }, r.prototype.getSimpleName = function() {
+ return "virtualJoystick";
+ }, r;
+ }();
+ Tn.FreeCameraVirtualJoystickInput = cl;
+ var Xt = l(28), fr = function(r) {
+ function t(e, n, i, o) {
+ o === void 0 && (o = !0);
+ var a = r.call(this, e, n, i, o) || this;
+ return a._tmpUpVector = c.e.Zero(), a._tmpTargetVector = c.e.Zero(), a.cameraDirection = new c.e(0, 0, 0), a.cameraRotation = new c.d(0, 0), a.ignoreParentScaling = !1, a.updateUpVectorFromRotation = !1, a._tmpQuaternion = new c.b(), a.rotation = new c.e(0, 0, 0), a.speed = 2, a.noRotationConstraint = !1, a.invertRotation = !1, a.inverseRotationSpeed = 0.2, a.lockedTarget = null, a._currentTarget = c.e.Zero(), a._initialFocalDistance = 1, a._viewMatrix = c.a.Zero(), a._camMatrix = c.a.Zero(), a._cameraTransformMatrix = c.a.Zero(), a._cameraRotationMatrix = c.a.Zero(), a._referencePoint = new c.e(0, 0, 1), a._transformedReferencePoint = c.e.Zero(), a._defaultUp = c.e.Up(), a._cachedRotationZ = 0, a._cachedQuaternionRotationZ = 0, a;
+ }
+ return Object(u.d)(t, r), t.prototype.getFrontPosition = function(e) {
+ this.getWorldMatrix();
+ var n = this.getTarget().subtract(this.position);
+ return n.normalize(), n.scaleInPlace(e), this.globalPosition.add(n);
+ }, t.prototype._getLockedTargetPosition = function() {
+ return this.lockedTarget ? (this.lockedTarget.absolutePosition && this.lockedTarget.computeWorldMatrix(), this.lockedTarget.absolutePosition || this.lockedTarget) : null;
+ }, t.prototype.storeState = function() {
+ return this._storedPosition = this.position.clone(), this._storedRotation = this.rotation.clone(), this.rotationQuaternion && (this._storedRotationQuaternion = this.rotationQuaternion.clone()), r.prototype.storeState.call(this);
+ }, t.prototype._restoreStateValues = function() {
+ return !!r.prototype._restoreStateValues.call(this) && (this.position = this._storedPosition.clone(), this.rotation = this._storedRotation.clone(), this.rotationQuaternion && (this.rotationQuaternion = this._storedRotationQuaternion.clone()), this.cameraDirection.copyFromFloats(0, 0, 0), this.cameraRotation.copyFromFloats(0, 0), !0);
+ }, t.prototype._initCache = function() {
+ r.prototype._initCache.call(this), this._cache.lockedTarget = new c.e(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), this._cache.rotation = new c.e(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), this._cache.rotationQuaternion = new c.b(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
+ }, t.prototype._updateCache = function(e) {
+ e || r.prototype._updateCache.call(this);
+ var n = this._getLockedTargetPosition();
+ n ? this._cache.lockedTarget ? this._cache.lockedTarget.copyFrom(n) : this._cache.lockedTarget = n.clone() : this._cache.lockedTarget = null, this._cache.rotation.copyFrom(this.rotation), this.rotationQuaternion && this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion);
+ }, t.prototype._isSynchronizedViewMatrix = function() {
+ if (!r.prototype._isSynchronizedViewMatrix.call(this))
+ return !1;
+ var e = this._getLockedTargetPosition();
+ return (this._cache.lockedTarget ? this._cache.lockedTarget.equals(e) : !e) && (this.rotationQuaternion ? this.rotationQuaternion.equals(this._cache.rotationQuaternion) : this._cache.rotation.equals(this.rotation));
+ }, t.prototype._computeLocalCameraSpeed = function() {
+ var e = this.getEngine();
+ return this.speed * Math.sqrt(e.getDeltaTime() / (100 * e.getFps()));
+ }, t.prototype.setTarget = function(e) {
+ this.upVector.normalize(), this._initialFocalDistance = e.subtract(this.position).length(), this.position.z === e.z && (this.position.z += Xt.a), this._referencePoint.normalize().scaleInPlace(this._initialFocalDistance), c.a.LookAtLHToRef(this.position, e, this._defaultUp, this._camMatrix), this._camMatrix.invert(), this.rotation.x = Math.atan(this._camMatrix.m[6] / this._camMatrix.m[10]);
+ var n = e.subtract(this.position);
+ n.x >= 0 ? this.rotation.y = -Math.atan(n.z / n.x) + Math.PI / 2 : this.rotation.y = -Math.atan(n.z / n.x) - Math.PI / 2, this.rotation.z = 0, isNaN(this.rotation.x) && (this.rotation.x = 0), isNaN(this.rotation.y) && (this.rotation.y = 0), isNaN(this.rotation.z) && (this.rotation.z = 0), this.rotationQuaternion && c.b.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this.rotationQuaternion);
+ }, Object.defineProperty(t.prototype, "target", { get: function() {
+ return this.getTarget();
+ }, set: function(e) {
+ this.setTarget(e);
+ }, enumerable: !1, configurable: !0 }), t.prototype.getTarget = function() {
+ return this._currentTarget;
+ }, t.prototype._decideIfNeedsToMove = function() {
+ return Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0;
+ }, t.prototype._updatePosition = function() {
+ if (this.parent)
+ return this.parent.getWorldMatrix().invertToRef(c.c.Matrix[0]), c.e.TransformNormalToRef(this.cameraDirection, c.c.Matrix[0], c.c.Vector3[0]), void this.position.addInPlace(c.c.Vector3[0]);
+ this.position.addInPlace(this.cameraDirection);
+ }, t.prototype._checkInputs = function() {
+ var e = this.invertRotation ? -this.inverseRotationSpeed : 1, n = this._decideIfNeedsToMove(), i = Math.abs(this.cameraRotation.x) > 0 || Math.abs(this.cameraRotation.y) > 0;
+ n && this._updatePosition(), i && (this.rotationQuaternion && this.rotationQuaternion.toEulerAnglesToRef(this.rotation), this.rotation.x += this.cameraRotation.x * e, this.rotation.y += this.cameraRotation.y * e, !this.noRotationConstraint && (this.rotation.x > 1.570796 && (this.rotation.x = 1.570796), this.rotation.x < -1.570796 && (this.rotation.x = -1.570796)), this.rotationQuaternion && this.rotation.lengthSquared() && c.b.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this.rotationQuaternion)), n && (Math.abs(this.cameraDirection.x) < this.speed * Xt.a && (this.cameraDirection.x = 0), Math.abs(this.cameraDirection.y) < this.speed * Xt.a && (this.cameraDirection.y = 0), Math.abs(this.cameraDirection.z) < this.speed * Xt.a && (this.cameraDirection.z = 0), this.cameraDirection.scaleInPlace(this.inertia)), i && (Math.abs(this.cameraRotation.x) < this.speed * Xt.a && (this.cameraRotation.x = 0), Math.abs(this.cameraRotation.y) < this.speed * Xt.a && (this.cameraRotation.y = 0), this.cameraRotation.scaleInPlace(this.inertia)), r.prototype._checkInputs.call(this);
+ }, t.prototype._updateCameraRotationMatrix = function() {
+ this.rotationQuaternion ? this.rotationQuaternion.toRotationMatrix(this._cameraRotationMatrix) : c.a.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix);
+ }, t.prototype._rotateUpVectorWithCameraRotationMatrix = function() {
+ return c.e.TransformNormalToRef(this._defaultUp, this._cameraRotationMatrix, this.upVector), this;
+ }, t.prototype._getViewMatrix = function() {
+ return this.lockedTarget && this.setTarget(this._getLockedTargetPosition()), this._updateCameraRotationMatrix(), this.rotationQuaternion && this._cachedQuaternionRotationZ != this.rotationQuaternion.z ? (this._rotateUpVectorWithCameraRotationMatrix(), this._cachedQuaternionRotationZ = this.rotationQuaternion.z) : this._cachedRotationZ != this.rotation.z && (this._rotateUpVectorWithCameraRotationMatrix(), this._cachedRotationZ = this.rotation.z), c.e.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint), this.position.addToRef(this._transformedReferencePoint, this._currentTarget), this.updateUpVectorFromRotation && (this.rotationQuaternion ? Se.a.Y.rotateByQuaternionToRef(this.rotationQuaternion, this.upVector) : (c.b.FromEulerVectorToRef(this.rotation, this._tmpQuaternion), Se.a.Y.rotateByQuaternionToRef(this._tmpQuaternion, this.upVector))), this._computeViewMatrix(this.position, this._currentTarget, this.upVector), this._viewMatrix;
+ }, t.prototype._computeViewMatrix = function(e, n, i) {
+ if (this.ignoreParentScaling) {
+ if (this.parent) {
+ var o = this.parent.getWorldMatrix();
+ c.e.TransformCoordinatesToRef(e, o, this._globalPosition), c.e.TransformCoordinatesToRef(n, o, this._tmpTargetVector), c.e.TransformNormalToRef(i, o, this._tmpUpVector), this._markSyncedWithParent();
+ } else
+ this._globalPosition.copyFrom(e), this._tmpTargetVector.copyFrom(n), this._tmpUpVector.copyFrom(i);
+ this.getScene().useRightHandedSystem ? c.a.LookAtRHToRef(this._globalPosition, this._tmpTargetVector, this._tmpUpVector, this._viewMatrix) : c.a.LookAtLHToRef(this._globalPosition, this._tmpTargetVector, this._tmpUpVector, this._viewMatrix);
+ } else
+ this.getScene().useRightHandedSystem ? c.a.LookAtRHToRef(e, n, i, this._viewMatrix) : c.a.LookAtLHToRef(e, n, i, this._viewMatrix), this.parent ? (o = this.parent.getWorldMatrix(), this._viewMatrix.invert(), this._viewMatrix.multiplyToRef(o, this._viewMatrix), this._viewMatrix.getTranslationToRef(this._globalPosition), this._viewMatrix.invert(), this._markSyncedWithParent()) : this._globalPosition.copyFrom(e);
+ }, t.prototype.createRigCamera = function(e, n) {
+ if (this.cameraRigMode !== gt.a.RIG_MODE_NONE) {
+ var i = new t(e, this.position.clone(), this.getScene());
+ return i.isRigCamera = !0, i.rigParent = this, this.cameraRigMode !== gt.a.RIG_MODE_VR && this.cameraRigMode !== gt.a.RIG_MODE_WEBVR || (this.rotationQuaternion || (this.rotationQuaternion = new c.b()), i._cameraRigParams = {}, i.rotationQuaternion = new c.b()), i;
+ }
+ return null;
+ }, t.prototype._updateRigCameras = function() {
+ var e = this._rigCameras[0], n = this._rigCameras[1];
+ switch (this.computeWorldMatrix(), this.cameraRigMode) {
+ case gt.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH:
+ case gt.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:
+ case gt.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:
+ case gt.a.RIG_MODE_STEREOSCOPIC_OVERUNDER:
+ case gt.a.RIG_MODE_STEREOSCOPIC_INTERLACED:
+ var i = this.cameraRigMode === gt.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED ? 1 : -1, o = this.cameraRigMode === gt.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED ? -1 : 1;
+ this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle * i, e), this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle * o, n);
+ break;
+ case gt.a.RIG_MODE_VR:
+ e.rotationQuaternion ? (e.rotationQuaternion.copyFrom(this.rotationQuaternion), n.rotationQuaternion.copyFrom(this.rotationQuaternion)) : (e.rotation.copyFrom(this.rotation), n.rotation.copyFrom(this.rotation)), e.position.copyFrom(this.position), n.position.copyFrom(this.position);
+ }
+ r.prototype._updateRigCameras.call(this);
+ }, t.prototype._getRigCamPositionAndTarget = function(e, n) {
+ this.getTarget().subtractToRef(this.position, t._TargetFocalPoint), t._TargetFocalPoint.normalize().scaleInPlace(this._initialFocalDistance);
+ var i = t._TargetFocalPoint.addInPlace(this.position);
+ c.a.TranslationToRef(-i.x, -i.y, -i.z, t._TargetTransformMatrix), t._TargetTransformMatrix.multiplyToRef(c.a.RotationAxis(n.upVector, e), t._RigCamTransformMatrix), c.a.TranslationToRef(i.x, i.y, i.z, t._TargetTransformMatrix), t._RigCamTransformMatrix.multiplyToRef(t._TargetTransformMatrix, t._RigCamTransformMatrix), c.e.TransformCoordinatesToRef(this.position, t._RigCamTransformMatrix, n.position), n.setTarget(i);
+ }, t.prototype.getClassName = function() {
+ return "TargetCamera";
+ }, t._RigCamTransformMatrix = new c.a(), t._TargetTransformMatrix = new c.a(), t._TargetFocalPoint = new c.e(), Object(u.c)([Object(w.o)()], t.prototype, "rotation", void 0), Object(u.c)([Object(w.c)()], t.prototype, "speed", void 0), Object(u.c)([Object(w.k)("lockedTargetId")], t.prototype, "lockedTarget", void 0), t;
+ }(gt.a), ci = function(r) {
+ function t(e, n, i, o) {
+ o === void 0 && (o = !0);
+ var a = r.call(this, e, n, i, o) || this;
+ return a.ellipsoid = new c.e(0.5, 1, 0.5), a.ellipsoidOffset = new c.e(0, 0, 0), a.checkCollisions = !1, a.applyGravity = !1, a._needMoveForGravity = !1, a._oldPosition = c.e.Zero(), a._diffPosition = c.e.Zero(), a._newPosition = c.e.Zero(), a._collisionMask = -1, a._onCollisionPositionChange = function(s, p, m) {
+ m === void 0 && (m = null);
+ var S;
+ S = p, a._newPosition.copyFrom(S), a._newPosition.subtractToRef(a._oldPosition, a._diffPosition), a._diffPosition.length() > ke.a.CollisionsEpsilon && (a.position.addInPlace(a._diffPosition), a.onCollide && m && a.onCollide(m));
+ }, a.inputs = new ma(a), a.inputs.addKeyboard().addMouse(), a;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "angularSensibility", { get: function() {
+ var e = this.inputs.attached.mouse;
+ return e ? e.angularSensibility : 0;
+ }, set: function(e) {
+ var n = this.inputs.attached.mouse;
+ n && (n.angularSensibility = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "keysUp", { get: function() {
+ var e = this.inputs.attached.keyboard;
+ return e ? e.keysUp : [];
+ }, set: function(e) {
+ var n = this.inputs.attached.keyboard;
+ n && (n.keysUp = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "keysUpward", { get: function() {
+ var e = this.inputs.attached.keyboard;
+ return e ? e.keysUpward : [];
+ }, set: function(e) {
+ var n = this.inputs.attached.keyboard;
+ n && (n.keysUpward = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "keysDown", { get: function() {
+ var e = this.inputs.attached.keyboard;
+ return e ? e.keysDown : [];
+ }, set: function(e) {
+ var n = this.inputs.attached.keyboard;
+ n && (n.keysDown = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "keysDownward", { get: function() {
+ var e = this.inputs.attached.keyboard;
+ return e ? e.keysDownward : [];
+ }, set: function(e) {
+ var n = this.inputs.attached.keyboard;
+ n && (n.keysDownward = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "keysLeft", { get: function() {
+ var e = this.inputs.attached.keyboard;
+ return e ? e.keysLeft : [];
+ }, set: function(e) {
+ var n = this.inputs.attached.keyboard;
+ n && (n.keysLeft = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "keysRight", { get: function() {
+ var e = this.inputs.attached.keyboard;
+ return e ? e.keysRight : [];
+ }, set: function(e) {
+ var n = this.inputs.attached.keyboard;
+ n && (n.keysRight = e);
+ }, enumerable: !1, configurable: !0 }), t.prototype.attachControl = function(e, n) {
+ n = Ke.b.BackCompatCameraNoPreventDefault(arguments), this.inputs.attachElement(n);
+ }, t.prototype.detachControl = function(e) {
+ this.inputs.detachElement(), this.cameraDirection = new c.e(0, 0, 0), this.cameraRotation = new c.d(0, 0);
+ }, Object.defineProperty(t.prototype, "collisionMask", { get: function() {
+ return this._collisionMask;
+ }, set: function(e) {
+ this._collisionMask = isNaN(e) ? -1 : e;
+ }, enumerable: !1, configurable: !0 }), t.prototype._collideWithWorld = function(e) {
+ (this.parent ? c.e.TransformCoordinates(this.position, this.parent.getWorldMatrix()) : this.position).subtractFromFloatsToRef(0, this.ellipsoid.y, 0, this._oldPosition), this._oldPosition.addInPlace(this.ellipsoidOffset);
+ var n = this.getScene().collisionCoordinator;
+ this._collider || (this._collider = n.createCollider()), this._collider._radius = this.ellipsoid, this._collider.collisionMask = this._collisionMask;
+ var i = e;
+ this.applyGravity && (i = e.add(this.getScene().gravity)), n.getNewPosition(this._oldPosition, i, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId);
+ }, t.prototype._checkInputs = function() {
+ this._localDirection || (this._localDirection = c.e.Zero(), this._transformedDirection = c.e.Zero()), this.inputs.checkInputs(), r.prototype._checkInputs.call(this);
+ }, t.prototype._decideIfNeedsToMove = function() {
+ return this._needMoveForGravity || Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0;
+ }, t.prototype._updatePosition = function() {
+ this.checkCollisions && this.getScene().collisionsEnabled ? this._collideWithWorld(this.cameraDirection) : r.prototype._updatePosition.call(this);
+ }, t.prototype.dispose = function() {
+ this.inputs.clear(), r.prototype.dispose.call(this);
+ }, t.prototype.getClassName = function() {
+ return "FreeCamera";
+ }, Object(u.c)([Object(w.o)()], t.prototype, "ellipsoid", void 0), Object(u.c)([Object(w.o)()], t.prototype, "ellipsoidOffset", void 0), Object(u.c)([Object(w.c)()], t.prototype, "checkCollisions", void 0), Object(u.c)([Object(w.c)()], t.prototype, "applyGravity", void 0), t;
+ }(fr);
+ q.a.AddNodeConstructor("TouchCamera", function(r, t) {
+ return function() {
+ return new ll(r, c.e.Zero(), t);
+ };
+ });
+ var ll = function(r) {
+ function t(e, n, i) {
+ var o = r.call(this, e, n, i) || this;
+ return o.inputs.addTouch(), o._setupInputs(), o;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "touchAngularSensibility", { get: function() {
+ var e = this.inputs.attached.touch;
+ return e ? e.touchAngularSensibility : 0;
+ }, set: function(e) {
+ var n = this.inputs.attached.touch;
+ n && (n.touchAngularSensibility = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "touchMoveSensibility", { get: function() {
+ var e = this.inputs.attached.touch;
+ return e ? e.touchMoveSensibility : 0;
+ }, set: function(e) {
+ var n = this.inputs.attached.touch;
+ n && (n.touchMoveSensibility = e);
+ }, enumerable: !1, configurable: !0 }), t.prototype.getClassName = function() {
+ return "TouchCamera";
+ }, t.prototype._setupInputs = function() {
+ var e = this.inputs.attached.touch, n = this.inputs.attached.mouse;
+ n ? n.touchEnabled = !1 : e.allowMouse = !0;
+ }, t;
+ }(ci);
+ q.a.AddNodeConstructor("ArcRotateCamera", function(r, t) {
+ return function() {
+ return new Gr(r, 0, 0, 1, c.e.Zero(), t);
+ };
+ });
+ var Gr = function(r) {
+ function t(e, n, i, o, a, s, p) {
+ p === void 0 && (p = !0);
+ var m = r.call(this, e, c.e.Zero(), s, p) || this;
+ return m.inertialAlphaOffset = 0, m.inertialBetaOffset = 0, m.inertialRadiusOffset = 0, m.lowerAlphaLimit = null, m.upperAlphaLimit = null, m.lowerBetaLimit = 0.01, m.upperBetaLimit = Math.PI - 0.01, m.lowerRadiusLimit = null, m.upperRadiusLimit = null, m.inertialPanningX = 0, m.inertialPanningY = 0, m.pinchToPanMaxDistance = 20, m.panningDistanceLimit = null, m.panningOriginTarget = c.e.Zero(), m.panningInertia = 0.9, m.zoomOnFactor = 1, m.targetScreenOffset = c.d.Zero(), m.allowUpsideDown = !0, m.useInputToRestoreState = !0, m._viewMatrix = new c.a(), m.panningAxis = new c.e(1, 1, 0), m.onMeshTargetChangedObservable = new P.c(), m.checkCollisions = !1, m.collisionRadius = new c.e(0.5, 0.5, 0.5), m._previousPosition = c.e.Zero(), m._collisionVelocity = c.e.Zero(), m._newPosition = c.e.Zero(), m._computationVector = c.e.Zero(), m._onCollisionPositionChange = function(S, O, I) {
+ I === void 0 && (I = null), I ? (m.setPosition(O), m.onCollide && m.onCollide(I)) : m._previousPosition.copyFrom(m._position);
+ var G = Math.cos(m.alpha), k = Math.sin(m.alpha), K = Math.cos(m.beta), re = Math.sin(m.beta);
+ re === 0 && (re = 1e-4);
+ var se = m._getTargetPosition();
+ m._computationVector.copyFromFloats(m.radius * G * re, m.radius * K, m.radius * k * re), se.addToRef(m._computationVector, m._newPosition), m._position.copyFrom(m._newPosition);
+ var ue = m.upVector;
+ m.allowUpsideDown && m.beta < 0 && (ue = (ue = ue.clone()).negate()), m._computeViewMatrix(m._position, se, ue), m._viewMatrix.addAtIndex(12, m.targetScreenOffset.x), m._viewMatrix.addAtIndex(13, m.targetScreenOffset.y), m._collisionTriggered = !1;
+ }, m._target = c.e.Zero(), a && m.setTarget(a), m.alpha = n, m.beta = i, m.radius = o, m.getViewMatrix(), m.inputs = new ps(m), m.inputs.addKeyboard().addMouseWheel().addPointers(), m;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "target", { get: function() {
+ return this._target;
+ }, set: function(e) {
+ this.setTarget(e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "position", { get: function() {
+ return this._position;
+ }, set: function(e) {
+ this.setPosition(e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "upVector", { get: function() {
+ return this._upVector;
+ }, set: function(e) {
+ this._upToYMatrix || (this._YToUpMatrix = new c.a(), this._upToYMatrix = new c.a(), this._upVector = c.e.Zero()), e.normalize(), this._upVector.copyFrom(e), this.setMatUp();
+ }, enumerable: !1, configurable: !0 }), t.prototype.setMatUp = function() {
+ c.a.RotationAlignToRef(c.e.UpReadOnly, this._upVector, this._YToUpMatrix), c.a.RotationAlignToRef(this._upVector, c.e.UpReadOnly, this._upToYMatrix);
+ }, Object.defineProperty(t.prototype, "angularSensibilityX", { get: function() {
+ var e = this.inputs.attached.pointers;
+ return e ? e.angularSensibilityX : 0;
+ }, set: function(e) {
+ var n = this.inputs.attached.pointers;
+ n && (n.angularSensibilityX = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "angularSensibilityY", { get: function() {
+ var e = this.inputs.attached.pointers;
+ return e ? e.angularSensibilityY : 0;
+ }, set: function(e) {
+ var n = this.inputs.attached.pointers;
+ n && (n.angularSensibilityY = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "pinchPrecision", { get: function() {
+ var e = this.inputs.attached.pointers;
+ return e ? e.pinchPrecision : 0;
+ }, set: function(e) {
+ var n = this.inputs.attached.pointers;
+ n && (n.pinchPrecision = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "pinchDeltaPercentage", { get: function() {
+ var e = this.inputs.attached.pointers;
+ return e ? e.pinchDeltaPercentage : 0;
+ }, set: function(e) {
+ var n = this.inputs.attached.pointers;
+ n && (n.pinchDeltaPercentage = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "useNaturalPinchZoom", { get: function() {
+ var e = this.inputs.attached.pointers;
+ return !!e && e.useNaturalPinchZoom;
+ }, set: function(e) {
+ var n = this.inputs.attached.pointers;
+ n && (n.useNaturalPinchZoom = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "panningSensibility", { get: function() {
+ var e = this.inputs.attached.pointers;
+ return e ? e.panningSensibility : 0;
+ }, set: function(e) {
+ var n = this.inputs.attached.pointers;
+ n && (n.panningSensibility = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "keysUp", { get: function() {
+ var e = this.inputs.attached.keyboard;
+ return e ? e.keysUp : [];
+ }, set: function(e) {
+ var n = this.inputs.attached.keyboard;
+ n && (n.keysUp = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "keysDown", { get: function() {
+ var e = this.inputs.attached.keyboard;
+ return e ? e.keysDown : [];
+ }, set: function(e) {
+ var n = this.inputs.attached.keyboard;
+ n && (n.keysDown = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "keysLeft", { get: function() {
+ var e = this.inputs.attached.keyboard;
+ return e ? e.keysLeft : [];
+ }, set: function(e) {
+ var n = this.inputs.attached.keyboard;
+ n && (n.keysLeft = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "keysRight", { get: function() {
+ var e = this.inputs.attached.keyboard;
+ return e ? e.keysRight : [];
+ }, set: function(e) {
+ var n = this.inputs.attached.keyboard;
+ n && (n.keysRight = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "wheelPrecision", { get: function() {
+ var e = this.inputs.attached.mousewheel;
+ return e ? e.wheelPrecision : 0;
+ }, set: function(e) {
+ var n = this.inputs.attached.mousewheel;
+ n && (n.wheelPrecision = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "wheelDeltaPercentage", { get: function() {
+ var e = this.inputs.attached.mousewheel;
+ return e ? e.wheelDeltaPercentage : 0;
+ }, set: function(e) {
+ var n = this.inputs.attached.mousewheel;
+ n && (n.wheelDeltaPercentage = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "bouncingBehavior", { get: function() {
+ return this._bouncingBehavior;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "useBouncingBehavior", { get: function() {
+ return this._bouncingBehavior != null;
+ }, set: function(e) {
+ e !== this.useBouncingBehavior && (e ? (this._bouncingBehavior = new fd(), this.addBehavior(this._bouncingBehavior)) : this._bouncingBehavior && (this.removeBehavior(this._bouncingBehavior), this._bouncingBehavior = null));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "framingBehavior", { get: function() {
+ return this._framingBehavior;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "useFramingBehavior", { get: function() {
+ return this._framingBehavior != null;
+ }, set: function(e) {
+ e !== this.useFramingBehavior && (e ? (this._framingBehavior = new pd(), this.addBehavior(this._framingBehavior)) : this._framingBehavior && (this.removeBehavior(this._framingBehavior), this._framingBehavior = null));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "autoRotationBehavior", { get: function() {
+ return this._autoRotationBehavior;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "useAutoRotationBehavior", { get: function() {
+ return this._autoRotationBehavior != null;
+ }, set: function(e) {
+ e !== this.useAutoRotationBehavior && (e ? (this._autoRotationBehavior = new dd(), this.addBehavior(this._autoRotationBehavior)) : this._autoRotationBehavior && (this.removeBehavior(this._autoRotationBehavior), this._autoRotationBehavior = null));
+ }, enumerable: !1, configurable: !0 }), t.prototype._initCache = function() {
+ r.prototype._initCache.call(this), this._cache._target = new c.e(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), this._cache.alpha = void 0, this._cache.beta = void 0, this._cache.radius = void 0, this._cache.targetScreenOffset = c.d.Zero();
+ }, t.prototype._updateCache = function(e) {
+ e || r.prototype._updateCache.call(this), this._cache._target.copyFrom(this._getTargetPosition()), this._cache.alpha = this.alpha, this._cache.beta = this.beta, this._cache.radius = this.radius, this._cache.targetScreenOffset.copyFrom(this.targetScreenOffset);
+ }, t.prototype._getTargetPosition = function() {
+ if (this._targetHost && this._targetHost.getAbsolutePosition) {
+ var e = this._targetHost.absolutePosition;
+ this._targetBoundingCenter ? e.addToRef(this._targetBoundingCenter, this._target) : this._target.copyFrom(e);
+ }
+ var n = this._getLockedTargetPosition();
+ return n || this._target;
+ }, t.prototype.storeState = function() {
+ return this._storedAlpha = this.alpha, this._storedBeta = this.beta, this._storedRadius = this.radius, this._storedTarget = this._getTargetPosition().clone(), this._storedTargetScreenOffset = this.targetScreenOffset.clone(), r.prototype.storeState.call(this);
+ }, t.prototype._restoreStateValues = function() {
+ return !!r.prototype._restoreStateValues.call(this) && (this.setTarget(this._storedTarget.clone()), this.alpha = this._storedAlpha, this.beta = this._storedBeta, this.radius = this._storedRadius, this.targetScreenOffset = this._storedTargetScreenOffset.clone(), this.inertialAlphaOffset = 0, this.inertialBetaOffset = 0, this.inertialRadiusOffset = 0, this.inertialPanningX = 0, this.inertialPanningY = 0, !0);
+ }, t.prototype._isSynchronizedViewMatrix = function() {
+ return !!r.prototype._isSynchronizedViewMatrix.call(this) && this._cache._target.equals(this._getTargetPosition()) && this._cache.alpha === this.alpha && this._cache.beta === this.beta && this._cache.radius === this.radius && this._cache.targetScreenOffset.equals(this.targetScreenOffset);
+ }, t.prototype.attachControl = function(e, n, i, o) {
+ var a = this;
+ i === void 0 && (i = !0), o === void 0 && (o = 2), n = Ke.b.BackCompatCameraNoPreventDefault(arguments), this._useCtrlForPanning = i, this._panningMouseButton = o, typeof arguments[0] == "boolean" && (arguments.length > 1 && (this._useCtrlForPanning = arguments[1]), arguments.length > 2 && (this._panningMouseButton = arguments[2])), this.inputs.attachElement(n), this._reset = function() {
+ a.inertialAlphaOffset = 0, a.inertialBetaOffset = 0, a.inertialRadiusOffset = 0, a.inertialPanningX = 0, a.inertialPanningY = 0;
+ };
+ }, t.prototype.detachControl = function(e) {
+ this.inputs.detachElement(), this._reset && this._reset();
+ }, t.prototype._checkInputs = function() {
+ if (!this._collisionTriggered) {
+ if (this.inputs.checkInputs(), this.inertialAlphaOffset !== 0 || this.inertialBetaOffset !== 0 || this.inertialRadiusOffset !== 0) {
+ var e = this.inertialAlphaOffset;
+ this.beta <= 0 && (e *= -1), this.getScene().useRightHandedSystem && (e *= -1), this.parent && this.parent._getWorldMatrixDeterminant() < 0 && (e *= -1), this.alpha += e, this.beta += this.inertialBetaOffset, this.radius -= this.inertialRadiusOffset, this.inertialAlphaOffset *= this.inertia, this.inertialBetaOffset *= this.inertia, this.inertialRadiusOffset *= this.inertia, Math.abs(this.inertialAlphaOffset) < Xt.a && (this.inertialAlphaOffset = 0), Math.abs(this.inertialBetaOffset) < Xt.a && (this.inertialBetaOffset = 0), Math.abs(this.inertialRadiusOffset) < this.speed * Xt.a && (this.inertialRadiusOffset = 0);
+ }
+ (this.inertialPanningX !== 0 || this.inertialPanningY !== 0) && (this._localDirection || (this._localDirection = c.e.Zero(), this._transformedDirection = c.e.Zero()), this._localDirection.copyFromFloats(this.inertialPanningX, this.inertialPanningY, this.inertialPanningY), this._localDirection.multiplyInPlace(this.panningAxis), this._viewMatrix.invertToRef(this._cameraTransformMatrix), c.e.TransformNormalToRef(this._localDirection, this._cameraTransformMatrix, this._transformedDirection), this.panningAxis.y || (this._transformedDirection.y = 0), !this._targetHost && (this.panningDistanceLimit ? (this._transformedDirection.addInPlace(this._target), c.e.DistanceSquared(this._transformedDirection, this.panningOriginTarget) <= this.panningDistanceLimit * this.panningDistanceLimit && this._target.copyFrom(this._transformedDirection)) : this._target.addInPlace(this._transformedDirection)), this.inertialPanningX *= this.panningInertia, this.inertialPanningY *= this.panningInertia, Math.abs(this.inertialPanningX) < this.speed * Xt.a && (this.inertialPanningX = 0), Math.abs(this.inertialPanningY) < this.speed * Xt.a && (this.inertialPanningY = 0)), this._checkLimits(), r.prototype._checkInputs.call(this);
+ }
+ }, t.prototype._checkLimits = function() {
+ this.lowerBetaLimit === null || this.lowerBetaLimit === void 0 ? this.allowUpsideDown && this.beta > Math.PI && (this.beta = this.beta - 2 * Math.PI) : this.beta < this.lowerBetaLimit && (this.beta = this.lowerBetaLimit), this.upperBetaLimit === null || this.upperBetaLimit === void 0 ? this.allowUpsideDown && this.beta < -Math.PI && (this.beta = this.beta + 2 * Math.PI) : this.beta > this.upperBetaLimit && (this.beta = this.upperBetaLimit), this.lowerAlphaLimit !== null && this.alpha < this.lowerAlphaLimit && (this.alpha = this.lowerAlphaLimit), this.upperAlphaLimit !== null && this.alpha > this.upperAlphaLimit && (this.alpha = this.upperAlphaLimit), this.lowerRadiusLimit !== null && this.radius < this.lowerRadiusLimit && (this.radius = this.lowerRadiusLimit, this.inertialRadiusOffset = 0), this.upperRadiusLimit !== null && this.radius > this.upperRadiusLimit && (this.radius = this.upperRadiusLimit, this.inertialRadiusOffset = 0);
+ }, t.prototype.rebuildAnglesAndRadius = function() {
+ this._position.subtractToRef(this._getTargetPosition(), this._computationVector), this._upVector.x === 0 && this._upVector.y === 1 && this._upVector.z === 0 || c.e.TransformCoordinatesToRef(this._computationVector, this._upToYMatrix, this._computationVector), this.radius = this._computationVector.length(), this.radius === 0 && (this.radius = 1e-4);
+ var e = this.alpha;
+ this._computationVector.x === 0 && this._computationVector.z === 0 ? this.alpha = Math.PI / 2 : this.alpha = Math.acos(this._computationVector.x / Math.sqrt(Math.pow(this._computationVector.x, 2) + Math.pow(this._computationVector.z, 2))), this._computationVector.z < 0 && (this.alpha = 2 * Math.PI - this.alpha);
+ var n = Math.round((e - this.alpha) / (2 * Math.PI));
+ this.alpha += 2 * n * Math.PI, this.beta = Math.acos(this._computationVector.y / this.radius), this._checkLimits();
+ }, t.prototype.setPosition = function(e) {
+ this._position.equals(e) || (this._position.copyFrom(e), this.rebuildAnglesAndRadius());
+ }, t.prototype.setTarget = function(e, n, i) {
+ if (n === void 0 && (n = !1), i === void 0 && (i = !1), e.getBoundingInfo)
+ this._targetBoundingCenter = n ? e.getBoundingInfo().boundingBox.centerWorld.clone() : null, e.computeWorldMatrix(), this._targetHost = e, this._target = this._getTargetPosition(), this.onMeshTargetChangedObservable.notifyObservers(this._targetHost);
+ else {
+ var o = e, a = this._getTargetPosition();
+ if (a && !i && a.equals(o))
+ return;
+ this._targetHost = null, this._target = o, this._targetBoundingCenter = null, this.onMeshTargetChangedObservable.notifyObservers(null);
+ }
+ this.rebuildAnglesAndRadius();
+ }, t.prototype._getViewMatrix = function() {
+ var e = Math.cos(this.alpha), n = Math.sin(this.alpha), i = Math.cos(this.beta), o = Math.sin(this.beta);
+ o === 0 && (o = 1e-4), this.radius === 0 && (this.radius = 1e-4);
+ var a = this._getTargetPosition();
+ if (this._computationVector.copyFromFloats(this.radius * e * o, this.radius * i, this.radius * n * o), this._upVector.x === 0 && this._upVector.y === 1 && this._upVector.z === 0 || c.e.TransformCoordinatesToRef(this._computationVector, this._YToUpMatrix, this._computationVector), a.addToRef(this._computationVector, this._newPosition), this.getScene().collisionsEnabled && this.checkCollisions) {
+ var s = this.getScene().collisionCoordinator;
+ this._collider || (this._collider = s.createCollider()), this._collider._radius = this.collisionRadius, this._newPosition.subtractToRef(this._position, this._collisionVelocity), this._collisionTriggered = !0, s.getNewPosition(this._position, this._collisionVelocity, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId);
+ } else {
+ this._position.copyFrom(this._newPosition);
+ var p = this.upVector;
+ this.allowUpsideDown && o < 0 && (p = p.negate()), this._computeViewMatrix(this._position, a, p), this._viewMatrix.addAtIndex(12, this.targetScreenOffset.x), this._viewMatrix.addAtIndex(13, this.targetScreenOffset.y);
+ }
+ return this._currentTarget = a, this._viewMatrix;
+ }, t.prototype.zoomOn = function(e, n) {
+ n === void 0 && (n = !1), e = e || this.getScene().meshes;
+ var i = we.a.MinMax(e), o = c.e.Distance(i.min, i.max);
+ this.radius = o * this.zoomOnFactor, this.focusOn({ min: i.min, max: i.max, distance: o }, n);
+ }, t.prototype.focusOn = function(e, n) {
+ var i, o;
+ if (n === void 0 && (n = !1), e.min === void 0) {
+ var a = e || this.getScene().meshes;
+ i = we.a.MinMax(a), o = c.e.Distance(i.min, i.max);
+ } else
+ i = e, o = e.distance;
+ this._target = we.a.Center(i), n || (this.maxZ = 2 * o);
+ }, t.prototype.createRigCamera = function(e, n) {
+ var i = 0;
+ switch (this.cameraRigMode) {
+ case gt.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH:
+ case gt.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:
+ case gt.a.RIG_MODE_STEREOSCOPIC_OVERUNDER:
+ case gt.a.RIG_MODE_STEREOSCOPIC_INTERLACED:
+ case gt.a.RIG_MODE_VR:
+ i = this._cameraRigParams.stereoHalfAngle * (n === 0 ? 1 : -1);
+ break;
+ case gt.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:
+ i = this._cameraRigParams.stereoHalfAngle * (n === 0 ? -1 : 1);
+ }
+ var o = new t(e, this.alpha + i, this.beta, this.radius, this._target, this.getScene());
+ return o._cameraRigParams = {}, o.isRigCamera = !0, o.rigParent = this, o.upVector = this.upVector, o;
+ }, t.prototype._updateRigCameras = function() {
+ var e = this._rigCameras[0], n = this._rigCameras[1];
+ switch (e.beta = n.beta = this.beta, this.cameraRigMode) {
+ case gt.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH:
+ case gt.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:
+ case gt.a.RIG_MODE_STEREOSCOPIC_OVERUNDER:
+ case gt.a.RIG_MODE_STEREOSCOPIC_INTERLACED:
+ case gt.a.RIG_MODE_VR:
+ e.alpha = this.alpha - this._cameraRigParams.stereoHalfAngle, n.alpha = this.alpha + this._cameraRigParams.stereoHalfAngle;
+ break;
+ case gt.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:
+ e.alpha = this.alpha + this._cameraRigParams.stereoHalfAngle, n.alpha = this.alpha - this._cameraRigParams.stereoHalfAngle;
+ }
+ r.prototype._updateRigCameras.call(this);
+ }, t.prototype.dispose = function() {
+ this.inputs.clear(), r.prototype.dispose.call(this);
+ }, t.prototype.getClassName = function() {
+ return "ArcRotateCamera";
+ }, Object(u.c)([Object(w.c)()], t.prototype, "alpha", void 0), Object(u.c)([Object(w.c)()], t.prototype, "beta", void 0), Object(u.c)([Object(w.c)()], t.prototype, "radius", void 0), Object(u.c)([Object(w.o)("target")], t.prototype, "_target", void 0), Object(u.c)([Object(w.c)()], t.prototype, "inertialAlphaOffset", void 0), Object(u.c)([Object(w.c)()], t.prototype, "inertialBetaOffset", void 0), Object(u.c)([Object(w.c)()], t.prototype, "inertialRadiusOffset", void 0), Object(u.c)([Object(w.c)()], t.prototype, "lowerAlphaLimit", void 0), Object(u.c)([Object(w.c)()], t.prototype, "upperAlphaLimit", void 0), Object(u.c)([Object(w.c)()], t.prototype, "lowerBetaLimit", void 0), Object(u.c)([Object(w.c)()], t.prototype, "upperBetaLimit", void 0), Object(u.c)([Object(w.c)()], t.prototype, "lowerRadiusLimit", void 0), Object(u.c)([Object(w.c)()], t.prototype, "upperRadiusLimit", void 0), Object(u.c)([Object(w.c)()], t.prototype, "inertialPanningX", void 0), Object(u.c)([Object(w.c)()], t.prototype, "inertialPanningY", void 0), Object(u.c)([Object(w.c)()], t.prototype, "pinchToPanMaxDistance", void 0), Object(u.c)([Object(w.c)()], t.prototype, "panningDistanceLimit", void 0), Object(u.c)([Object(w.o)()], t.prototype, "panningOriginTarget", void 0), Object(u.c)([Object(w.c)()], t.prototype, "panningInertia", void 0), Object(u.c)([Object(w.c)()], t.prototype, "zoomOnFactor", void 0), Object(u.c)([Object(w.c)()], t.prototype, "targetScreenOffset", void 0), Object(u.c)([Object(w.c)()], t.prototype, "allowUpsideDown", void 0), Object(u.c)([Object(w.c)()], t.prototype, "useInputToRestoreState", void 0), t;
+ }(fr);
+ q.a.AddNodeConstructor("DeviceOrientationCamera", function(r, t) {
+ return function() {
+ return new _s(r, c.e.Zero(), t);
+ };
+ });
+ var _s = function(r) {
+ function t(e, n, i) {
+ var o = r.call(this, e, n, i) || this;
+ return o._tmpDragQuaternion = new c.b(), o._disablePointerInputWhenUsingDeviceOrientation = !0, o._dragFactor = 0, o._quaternionCache = new c.b(), o.inputs.addDeviceOrientation(), o.inputs._deviceOrientationInput && o.inputs._deviceOrientationInput._onDeviceOrientationChangedObservable.addOnce(function() {
+ o._disablePointerInputWhenUsingDeviceOrientation && o.inputs._mouseInput && (o.inputs._mouseInput._allowCameraRotation = !1, o.inputs._mouseInput.onPointerMovedObservable.add(function(a) {
+ o._dragFactor != 0 && (o._initialQuaternion || (o._initialQuaternion = new c.b()), c.b.FromEulerAnglesToRef(0, a.offsetX * o._dragFactor, 0, o._tmpDragQuaternion), o._initialQuaternion.multiplyToRef(o._tmpDragQuaternion, o._initialQuaternion));
+ }));
+ }), o;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "disablePointerInputWhenUsingDeviceOrientation", { get: function() {
+ return this._disablePointerInputWhenUsingDeviceOrientation;
+ }, set: function(e) {
+ this._disablePointerInputWhenUsingDeviceOrientation = e;
+ }, enumerable: !1, configurable: !0 }), t.prototype.enableHorizontalDragging = function(e) {
+ e === void 0 && (e = 1 / 300), this._dragFactor = e;
+ }, t.prototype.getClassName = function() {
+ return "DeviceOrientationCamera";
+ }, t.prototype._checkInputs = function() {
+ r.prototype._checkInputs.call(this), this._quaternionCache.copyFrom(this.rotationQuaternion), this._initialQuaternion && this._initialQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);
+ }, t.prototype.resetToCurrentRotation = function(e) {
+ var n = this;
+ e === void 0 && (e = Se.a.Y), this.rotationQuaternion && (this._initialQuaternion || (this._initialQuaternion = new c.b()), this._initialQuaternion.copyFrom(this._quaternionCache || this.rotationQuaternion), ["x", "y", "z"].forEach(function(i) {
+ e[i] ? n._initialQuaternion[i] *= -1 : n._initialQuaternion[i] = 0;
+ }), this._initialQuaternion.normalize(), this._initialQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion));
+ }, t;
+ }(ci), Td = function(r) {
+ function t(e) {
+ return r.call(this, e) || this;
+ }
+ return Object(u.d)(t, r), t.prototype.addKeyboard = function() {
+ return this.add(new qc()), this;
+ }, t.prototype.addMouse = function(e) {
+ return e === void 0 && (e = !0), this.add(new Zc(e)), this;
+ }, t;
+ }(_a), nb = function(r) {
+ function t(e, n, i, o) {
+ o === void 0 && (o = !0);
+ var a = r.call(this, e, n, i, o) || this;
+ return a.ellipsoid = new c.e(1, 1, 1), a.ellipsoidOffset = new c.e(0, 0, 0), a.checkCollisions = !1, a.applyGravity = !1, a.cameraDirection = c.e.Zero(), a._trackRoll = 0, a.rollCorrect = 100, a.bankedTurn = !1, a.bankedTurnLimit = Math.PI / 2, a.bankedTurnMultiplier = 1, a._needMoveForGravity = !1, a._oldPosition = c.e.Zero(), a._diffPosition = c.e.Zero(), a._newPosition = c.e.Zero(), a._collisionMask = -1, a._onCollisionPositionChange = function(s, p, m) {
+ m === void 0 && (m = null);
+ var S;
+ S = p, a._newPosition.copyFrom(S), a._newPosition.subtractToRef(a._oldPosition, a._diffPosition), a._diffPosition.length() > ke.a.CollisionsEpsilon && (a.position.addInPlace(a._diffPosition), a.onCollide && m && a.onCollide(m));
+ }, a.inputs = new Td(a), a.inputs.addKeyboard().addMouse(), a;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "angularSensibility", { get: function() {
+ var e = this.inputs.attached.mouse;
+ return e ? e.angularSensibility : 0;
+ }, set: function(e) {
+ var n = this.inputs.attached.mouse;
+ n && (n.angularSensibility = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "keysForward", { get: function() {
+ var e = this.inputs.attached.keyboard;
+ return e ? e.keysForward : [];
+ }, set: function(e) {
+ var n = this.inputs.attached.keyboard;
+ n && (n.keysForward = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "keysBackward", { get: function() {
+ var e = this.inputs.attached.keyboard;
+ return e ? e.keysBackward : [];
+ }, set: function(e) {
+ var n = this.inputs.attached.keyboard;
+ n && (n.keysBackward = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "keysUp", { get: function() {
+ var e = this.inputs.attached.keyboard;
+ return e ? e.keysUp : [];
+ }, set: function(e) {
+ var n = this.inputs.attached.keyboard;
+ n && (n.keysUp = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "keysDown", { get: function() {
+ var e = this.inputs.attached.keyboard;
+ return e ? e.keysDown : [];
+ }, set: function(e) {
+ var n = this.inputs.attached.keyboard;
+ n && (n.keysDown = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "keysLeft", { get: function() {
+ var e = this.inputs.attached.keyboard;
+ return e ? e.keysLeft : [];
+ }, set: function(e) {
+ var n = this.inputs.attached.keyboard;
+ n && (n.keysLeft = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "keysRight", { get: function() {
+ var e = this.inputs.attached.keyboard;
+ return e ? e.keysRight : [];
+ }, set: function(e) {
+ var n = this.inputs.attached.keyboard;
+ n && (n.keysRight = e);
+ }, enumerable: !1, configurable: !0 }), t.prototype.attachControl = function(e, n) {
+ n = Ke.b.BackCompatCameraNoPreventDefault(arguments), this.inputs.attachElement(n);
+ }, t.prototype.detachControl = function() {
+ this.inputs.detachElement(), this.cameraDirection = new c.e(0, 0, 0);
+ }, Object.defineProperty(t.prototype, "collisionMask", { get: function() {
+ return this._collisionMask;
+ }, set: function(e) {
+ this._collisionMask = isNaN(e) ? -1 : e;
+ }, enumerable: !1, configurable: !0 }), t.prototype._collideWithWorld = function(e) {
+ (this.parent ? c.e.TransformCoordinates(this.position, this.parent.getWorldMatrix()) : this.position).subtractFromFloatsToRef(0, this.ellipsoid.y, 0, this._oldPosition), this._oldPosition.addInPlace(this.ellipsoidOffset);
+ var n = this.getScene().collisionCoordinator;
+ this._collider || (this._collider = n.createCollider()), this._collider._radius = this.ellipsoid, this._collider.collisionMask = this._collisionMask;
+ var i = e;
+ this.applyGravity && (i = e.add(this.getScene().gravity)), n.getNewPosition(this._oldPosition, i, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId);
+ }, t.prototype._checkInputs = function() {
+ this._localDirection || (this._localDirection = c.e.Zero(), this._transformedDirection = c.e.Zero()), this.inputs.checkInputs(), r.prototype._checkInputs.call(this);
+ }, t.prototype._decideIfNeedsToMove = function() {
+ return this._needMoveForGravity || Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0;
+ }, t.prototype._updatePosition = function() {
+ this.checkCollisions && this.getScene().collisionsEnabled ? this._collideWithWorld(this.cameraDirection) : r.prototype._updatePosition.call(this);
+ }, t.prototype.restoreRoll = function(e) {
+ var n = this._trackRoll, i = n - this.rotation.z;
+ Math.abs(i) >= 1e-3 && (this.rotation.z += i / e, Math.abs(n - this.rotation.z) <= 1e-3 && (this.rotation.z = n));
+ }, t.prototype.dispose = function() {
+ this.inputs.clear(), r.prototype.dispose.call(this);
+ }, t.prototype.getClassName = function() {
+ return "FlyCamera";
+ }, Object(u.c)([Object(w.o)()], t.prototype, "ellipsoid", void 0), Object(u.c)([Object(w.o)()], t.prototype, "ellipsoidOffset", void 0), Object(u.c)([Object(w.c)()], t.prototype, "checkCollisions", void 0), Object(u.c)([Object(w.c)()], t.prototype, "applyGravity", void 0), t;
+ }(fr), Sd = function(r) {
+ function t(e) {
+ return r.call(this, e) || this;
+ }
+ return Object(u.d)(t, r), t.prototype.addKeyboard = function() {
+ return this.add(new Jc()), this;
+ }, t.prototype.addMouseWheel = function() {
+ return this.add(new $c()), this;
+ }, t.prototype.addPointers = function() {
+ return this.add(new el()), this;
+ }, t.prototype.addVRDeviceOrientation = function() {
+ return console.warn("DeviceOrientation support not yet implemented for FollowCamera."), this;
+ }, t;
+ }(_a);
+ q.a.AddNodeConstructor("FollowCamera", function(r, t) {
+ return function() {
+ return new Ad(r, c.e.Zero(), t);
+ };
+ }), q.a.AddNodeConstructor("ArcFollowCamera", function(r, t) {
+ return function() {
+ return new Pd(r, 0, 0, 1, null, t);
+ };
+ });
+ var Si, Ad = function(r) {
+ function t(e, n, i, o) {
+ o === void 0 && (o = null);
+ var a = r.call(this, e, n, i) || this;
+ return a.radius = 12, a.lowerRadiusLimit = null, a.upperRadiusLimit = null, a.rotationOffset = 0, a.lowerRotationOffsetLimit = null, a.upperRotationOffsetLimit = null, a.heightOffset = 4, a.lowerHeightOffsetLimit = null, a.upperHeightOffsetLimit = null, a.cameraAcceleration = 0.05, a.maxCameraSpeed = 20, a.lockedTarget = o, a.inputs = new Sd(a), a.inputs.addKeyboard().addMouseWheel().addPointers(), a;
+ }
+ return Object(u.d)(t, r), t.prototype._follow = function(e) {
+ if (e) {
+ var n;
+ if (e.rotationQuaternion) {
+ var i = new c.a();
+ e.rotationQuaternion.toRotationMatrix(i), n = Math.atan2(i.m[8], i.m[10]);
+ } else
+ n = e.rotation.y;
+ var o = Ke.b.ToRadians(this.rotationOffset) + n, a = e.getAbsolutePosition(), s = a.x + Math.sin(o) * this.radius, p = a.z + Math.cos(o) * this.radius, m = s - this.position.x, S = a.y + this.heightOffset - this.position.y, O = p - this.position.z, I = m * this.cameraAcceleration * 2, G = S * this.cameraAcceleration, k = O * this.cameraAcceleration * 2;
+ (I > this.maxCameraSpeed || I < -this.maxCameraSpeed) && (I = I < 1 ? -this.maxCameraSpeed : this.maxCameraSpeed), (G > this.maxCameraSpeed || G < -this.maxCameraSpeed) && (G = G < 1 ? -this.maxCameraSpeed : this.maxCameraSpeed), (k > this.maxCameraSpeed || k < -this.maxCameraSpeed) && (k = k < 1 ? -this.maxCameraSpeed : this.maxCameraSpeed), this.position = new c.e(this.position.x + I, this.position.y + G, this.position.z + k), this.setTarget(a);
+ }
+ }, t.prototype.attachControl = function(e, n) {
+ n = Ke.b.BackCompatCameraNoPreventDefault(arguments), this.inputs.attachElement(n), this._reset = function() {
+ };
+ }, t.prototype.detachControl = function(e) {
+ this.inputs.detachElement(), this._reset && this._reset();
+ }, t.prototype._checkInputs = function() {
+ this.inputs.checkInputs(), this._checkLimits(), r.prototype._checkInputs.call(this), this.lockedTarget && this._follow(this.lockedTarget);
+ }, t.prototype._checkLimits = function() {
+ this.lowerRadiusLimit !== null && this.radius < this.lowerRadiusLimit && (this.radius = this.lowerRadiusLimit), this.upperRadiusLimit !== null && this.radius > this.upperRadiusLimit && (this.radius = this.upperRadiusLimit), this.lowerHeightOffsetLimit !== null && this.heightOffset < this.lowerHeightOffsetLimit && (this.heightOffset = this.lowerHeightOffsetLimit), this.upperHeightOffsetLimit !== null && this.heightOffset > this.upperHeightOffsetLimit && (this.heightOffset = this.upperHeightOffsetLimit), this.lowerRotationOffsetLimit !== null && this.rotationOffset < this.lowerRotationOffsetLimit && (this.rotationOffset = this.lowerRotationOffsetLimit), this.upperRotationOffsetLimit !== null && this.rotationOffset > this.upperRotationOffsetLimit && (this.rotationOffset = this.upperRotationOffsetLimit);
+ }, t.prototype.getClassName = function() {
+ return "FollowCamera";
+ }, Object(u.c)([Object(w.c)()], t.prototype, "radius", void 0), Object(u.c)([Object(w.c)()], t.prototype, "lowerRadiusLimit", void 0), Object(u.c)([Object(w.c)()], t.prototype, "upperRadiusLimit", void 0), Object(u.c)([Object(w.c)()], t.prototype, "rotationOffset", void 0), Object(u.c)([Object(w.c)()], t.prototype, "lowerRotationOffsetLimit", void 0), Object(u.c)([Object(w.c)()], t.prototype, "upperRotationOffsetLimit", void 0), Object(u.c)([Object(w.c)()], t.prototype, "heightOffset", void 0), Object(u.c)([Object(w.c)()], t.prototype, "lowerHeightOffsetLimit", void 0), Object(u.c)([Object(w.c)()], t.prototype, "upperHeightOffsetLimit", void 0), Object(u.c)([Object(w.c)()], t.prototype, "cameraAcceleration", void 0), Object(u.c)([Object(w.c)()], t.prototype, "maxCameraSpeed", void 0), Object(u.c)([Object(w.k)("lockedTargetId")], t.prototype, "lockedTarget", void 0), t;
+ }(fr), Pd = function(r) {
+ function t(e, n, i, o, a, s) {
+ var p = r.call(this, e, c.e.Zero(), s) || this;
+ return p.alpha = n, p.beta = i, p.radius = o, p._cartesianCoordinates = c.e.Zero(), p._meshTarget = a, p._follow(), p;
+ }
+ return Object(u.d)(t, r), t.prototype._follow = function() {
+ if (this._meshTarget) {
+ this._cartesianCoordinates.x = this.radius * Math.cos(this.alpha) * Math.cos(this.beta), this._cartesianCoordinates.y = this.radius * Math.sin(this.beta), this._cartesianCoordinates.z = this.radius * Math.sin(this.alpha) * Math.cos(this.beta);
+ var e = this._meshTarget.getAbsolutePosition();
+ this.position = e.add(this._cartesianCoordinates), this.setTarget(e);
+ }
+ }, t.prototype._checkInputs = function() {
+ r.prototype._checkInputs.call(this), this._follow();
+ }, t.prototype.getClassName = function() {
+ return "ArcFollowCamera";
+ }, t;
+ }(fr), ul = l(38), An = l(39);
+ (function(r) {
+ r[r.VIVE = 0] = "VIVE", r[r.OCULUS = 1] = "OCULUS", r[r.WINDOWS = 2] = "WINDOWS", r[r.GEAR_VR = 3] = "GEAR_VR", r[r.DAYDREAM = 4] = "DAYDREAM", r[r.GENERIC = 5] = "GENERIC";
+ })(Si || (Si = {}));
+ var kn, zr, pr = function() {
+ function r() {
+ }
+ return r.InitiateController = function(t) {
+ for (var e = 0, n = this._ControllerFactories; e < n.length; e++) {
+ var i = n[e];
+ if (i.canCreate(t))
+ return i.create(t);
+ }
+ if (this._DefaultControllerFactory)
+ return this._DefaultControllerFactory(t);
+ throw "The type of gamepad you are trying to load needs to be imported first or is not supported.";
+ }, r._ControllerFactories = [], r._DefaultControllerFactory = null, r;
+ }(), mo = function(r) {
+ function t(e) {
+ var n = r.call(this, e.id, e.index, e) || this;
+ return n.isXR = !1, n._deviceRoomPosition = c.e.Zero(), n._deviceRoomRotationQuaternion = new c.b(), n.devicePosition = c.e.Zero(), n.deviceRotationQuaternion = new c.b(), n.deviceScaleFactor = 1, n._trackPosition = !0, n._maxRotationDistFromHeadset = Math.PI / 5, n._draggedRoomRotation = 0, n._leftHandSystemQuaternion = new c.b(), n._deviceToWorld = c.a.Identity(), n._pointingPoseNode = null, n._workingMatrix = c.a.Identity(), n._meshAttachedObservable = new P.c(), n.type = Sn.POSE_ENABLED, n.controllerType = Si.GENERIC, n.position = c.e.Zero(), n.rotationQuaternion = new c.b(), n._calculatedPosition = c.e.Zero(), n._calculatedRotation = new c.b(), c.b.RotationYawPitchRollToRef(Math.PI, 0, 0, n._leftHandSystemQuaternion), n;
+ }
+ return Object(u.d)(t, r), t.prototype._disableTrackPosition = function(e) {
+ this._trackPosition && (this._calculatedPosition.copyFrom(e), this._trackPosition = !1);
+ }, t.prototype.update = function() {
+ r.prototype.update.call(this), this._updatePoseAndMesh();
+ }, t.prototype._updatePoseAndMesh = function() {
+ if (!this.isXR) {
+ var e = this.browserGamepad.pose;
+ if (this.updateFromDevice(e), !this._trackPosition && te.a.LastCreatedScene && te.a.LastCreatedScene.activeCamera && te.a.LastCreatedScene.activeCamera.devicePosition && ((n = te.a.LastCreatedScene.activeCamera)._computeDevicePosition(), this._deviceToWorld.setTranslation(n.devicePosition), n.deviceRotationQuaternion)) {
+ var n;
+ (n = n)._deviceRoomRotationQuaternion.toEulerAnglesToRef(c.c.Vector3[0]);
+ var i = Math.atan2(Math.sin(c.c.Vector3[0].y - this._draggedRoomRotation), Math.cos(c.c.Vector3[0].y - this._draggedRoomRotation));
+ if (Math.abs(i) > this._maxRotationDistFromHeadset) {
+ var o = i - (i < 0 ? -this._maxRotationDistFromHeadset : this._maxRotationDistFromHeadset);
+ this._draggedRoomRotation += o;
+ var a = Math.sin(-o), s = Math.cos(-o);
+ this._calculatedPosition.x = this._calculatedPosition.x * s - this._calculatedPosition.z * a, this._calculatedPosition.z = this._calculatedPosition.x * a + this._calculatedPosition.z * s;
+ }
+ }
+ c.e.TransformCoordinatesToRef(this._calculatedPosition, this._deviceToWorld, this.devicePosition), this._deviceToWorld.getRotationMatrixToRef(this._workingMatrix), c.b.FromRotationMatrixToRef(this._workingMatrix, this.deviceRotationQuaternion), this.deviceRotationQuaternion.multiplyInPlace(this._calculatedRotation), this._mesh && (this._mesh.position.copyFrom(this.devicePosition), this._mesh.rotationQuaternion && this._mesh.rotationQuaternion.copyFrom(this.deviceRotationQuaternion));
+ }
+ }, t.prototype.updateFromDevice = function(e) {
+ if (!this.isXR && e) {
+ this.rawPose = e, e.position && (this._deviceRoomPosition.copyFromFloats(e.position[0], e.position[1], -e.position[2]), this._mesh && this._mesh.getScene().useRightHandedSystem && (this._deviceRoomPosition.z *= -1), this._trackPosition && this._deviceRoomPosition.scaleToRef(this.deviceScaleFactor, this._calculatedPosition), this._calculatedPosition.addInPlace(this.position));
+ var n = this.rawPose;
+ e.orientation && n.orientation && n.orientation.length === 4 && (this._deviceRoomRotationQuaternion.copyFromFloats(n.orientation[0], n.orientation[1], -n.orientation[2], -n.orientation[3]), this._mesh && (this._mesh.getScene().useRightHandedSystem ? (this._deviceRoomRotationQuaternion.z *= -1, this._deviceRoomRotationQuaternion.w *= -1) : this._deviceRoomRotationQuaternion.multiplyToRef(this._leftHandSystemQuaternion, this._deviceRoomRotationQuaternion)), this._deviceRoomRotationQuaternion.multiplyToRef(this.rotationQuaternion, this._calculatedRotation));
+ }
+ }, t.prototype.attachToMesh = function(e) {
+ if (this._mesh && (this._mesh.parent = null), this._mesh = e, this._poseControlledCamera && (this._mesh.parent = this._poseControlledCamera), this._mesh.rotationQuaternion || (this._mesh.rotationQuaternion = new c.b()), !this.isXR && (this._updatePoseAndMesh(), this._pointingPoseNode)) {
+ for (var n = [], i = this._pointingPoseNode; i.parent; )
+ n.push(i.parent), i = i.parent;
+ n.reverse().forEach(function(o) {
+ o.computeWorldMatrix(!0);
+ });
+ }
+ this._meshAttachedObservable.notifyObservers(e);
+ }, t.prototype.attachToPoseControlledCamera = function(e) {
+ this._poseControlledCamera = e, this._mesh && (this._mesh.parent = this._poseControlledCamera);
+ }, t.prototype.dispose = function() {
+ this._mesh && this._mesh.dispose(), this._mesh = null, r.prototype.dispose.call(this);
+ }, Object.defineProperty(t.prototype, "mesh", { get: function() {
+ return this._mesh;
+ }, enumerable: !1, configurable: !0 }), t.prototype.getForwardRay = function(e) {
+ if (e === void 0 && (e = 100), !this.mesh)
+ return new An.a(c.e.Zero(), new c.e(0, 0, 1), e);
+ var n = this._pointingPoseNode ? this._pointingPoseNode.getWorldMatrix() : this.mesh.getWorldMatrix(), i = n.getTranslation(), o = new c.e(0, 0, -1), a = c.e.TransformNormal(o, n), s = c.e.Normalize(a);
+ return new An.a(i, s, e);
+ }, t.POINTING_POSE = "POINTING_POSE", t;
+ }(Sn);
+ (function(r) {
+ r[r.A = 0] = "A", r[r.B = 1] = "B", r[r.X = 2] = "X", r[r.Y = 3] = "Y", r[r.LB = 4] = "LB", r[r.RB = 5] = "RB", r[r.Back = 8] = "Back", r[r.Start = 9] = "Start", r[r.LeftStick = 10] = "LeftStick", r[r.RightStick = 11] = "RightStick";
+ })(kn || (kn = {})), function(r) {
+ r[r.Up = 12] = "Up", r[r.Down = 13] = "Down", r[r.Left = 14] = "Left", r[r.Right = 15] = "Right";
+ }(zr || (zr = {}));
+ var ri, jr, Cd = function(r) {
+ function t(e, n, i, o) {
+ o === void 0 && (o = !1);
+ var a = r.call(this, e, n, i, 0, 1, 2, 3) || this;
+ return a._leftTrigger = 0, a._rightTrigger = 0, a.onButtonDownObservable = new P.c(), a.onButtonUpObservable = new P.c(), a.onPadDownObservable = new P.c(), a.onPadUpObservable = new P.c(), a._buttonA = 0, a._buttonB = 0, a._buttonX = 0, a._buttonY = 0, a._buttonBack = 0, a._buttonStart = 0, a._buttonLB = 0, a._buttonRB = 0, a._buttonLeftStick = 0, a._buttonRightStick = 0, a._dPadUp = 0, a._dPadDown = 0, a._dPadLeft = 0, a._dPadRight = 0, a._isXboxOnePad = !1, a.type = Sn.XBOX, a._isXboxOnePad = o, a;
+ }
+ return Object(u.d)(t, r), t.prototype.onlefttriggerchanged = function(e) {
+ this._onlefttriggerchanged = e;
+ }, t.prototype.onrighttriggerchanged = function(e) {
+ this._onrighttriggerchanged = e;
+ }, Object.defineProperty(t.prototype, "leftTrigger", { get: function() {
+ return this._leftTrigger;
+ }, set: function(e) {
+ this._onlefttriggerchanged && this._leftTrigger !== e && this._onlefttriggerchanged(e), this._leftTrigger = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "rightTrigger", { get: function() {
+ return this._rightTrigger;
+ }, set: function(e) {
+ this._onrighttriggerchanged && this._rightTrigger !== e && this._onrighttriggerchanged(e), this._rightTrigger = e;
+ }, enumerable: !1, configurable: !0 }), t.prototype.onbuttondown = function(e) {
+ this._onbuttondown = e;
+ }, t.prototype.onbuttonup = function(e) {
+ this._onbuttonup = e;
+ }, t.prototype.ondpaddown = function(e) {
+ this._ondpaddown = e;
+ }, t.prototype.ondpadup = function(e) {
+ this._ondpadup = e;
+ }, t.prototype._setButtonValue = function(e, n, i) {
+ return e !== n && (e === 1 && (this._onbuttondown && this._onbuttondown(i), this.onButtonDownObservable.notifyObservers(i)), e === 0 && (this._onbuttonup && this._onbuttonup(i), this.onButtonUpObservable.notifyObservers(i))), e;
+ }, t.prototype._setDPadValue = function(e, n, i) {
+ return e !== n && (e === 1 && (this._ondpaddown && this._ondpaddown(i), this.onPadDownObservable.notifyObservers(i)), e === 0 && (this._ondpadup && this._ondpadup(i), this.onPadUpObservable.notifyObservers(i))), e;
+ }, Object.defineProperty(t.prototype, "buttonA", { get: function() {
+ return this._buttonA;
+ }, set: function(e) {
+ this._buttonA = this._setButtonValue(e, this._buttonA, kn.A);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "buttonB", { get: function() {
+ return this._buttonB;
+ }, set: function(e) {
+ this._buttonB = this._setButtonValue(e, this._buttonB, kn.B);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "buttonX", { get: function() {
+ return this._buttonX;
+ }, set: function(e) {
+ this._buttonX = this._setButtonValue(e, this._buttonX, kn.X);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "buttonY", { get: function() {
+ return this._buttonY;
+ }, set: function(e) {
+ this._buttonY = this._setButtonValue(e, this._buttonY, kn.Y);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "buttonStart", { get: function() {
+ return this._buttonStart;
+ }, set: function(e) {
+ this._buttonStart = this._setButtonValue(e, this._buttonStart, kn.Start);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "buttonBack", { get: function() {
+ return this._buttonBack;
+ }, set: function(e) {
+ this._buttonBack = this._setButtonValue(e, this._buttonBack, kn.Back);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "buttonLB", { get: function() {
+ return this._buttonLB;
+ }, set: function(e) {
+ this._buttonLB = this._setButtonValue(e, this._buttonLB, kn.LB);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "buttonRB", { get: function() {
+ return this._buttonRB;
+ }, set: function(e) {
+ this._buttonRB = this._setButtonValue(e, this._buttonRB, kn.RB);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "buttonLeftStick", { get: function() {
+ return this._buttonLeftStick;
+ }, set: function(e) {
+ this._buttonLeftStick = this._setButtonValue(e, this._buttonLeftStick, kn.LeftStick);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "buttonRightStick", { get: function() {
+ return this._buttonRightStick;
+ }, set: function(e) {
+ this._buttonRightStick = this._setButtonValue(e, this._buttonRightStick, kn.RightStick);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "dPadUp", { get: function() {
+ return this._dPadUp;
+ }, set: function(e) {
+ this._dPadUp = this._setDPadValue(e, this._dPadUp, zr.Up);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "dPadDown", { get: function() {
+ return this._dPadDown;
+ }, set: function(e) {
+ this._dPadDown = this._setDPadValue(e, this._dPadDown, zr.Down);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "dPadLeft", { get: function() {
+ return this._dPadLeft;
+ }, set: function(e) {
+ this._dPadLeft = this._setDPadValue(e, this._dPadLeft, zr.Left);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "dPadRight", { get: function() {
+ return this._dPadRight;
+ }, set: function(e) {
+ this._dPadRight = this._setDPadValue(e, this._dPadRight, zr.Right);
+ }, enumerable: !1, configurable: !0 }), t.prototype.update = function() {
+ r.prototype.update.call(this), this._isXboxOnePad, this.buttonA = this.browserGamepad.buttons[0].value, this.buttonB = this.browserGamepad.buttons[1].value, this.buttonX = this.browserGamepad.buttons[2].value, this.buttonY = this.browserGamepad.buttons[3].value, this.buttonLB = this.browserGamepad.buttons[4].value, this.buttonRB = this.browserGamepad.buttons[5].value, this.leftTrigger = this.browserGamepad.buttons[6].value, this.rightTrigger = this.browserGamepad.buttons[7].value, this.buttonBack = this.browserGamepad.buttons[8].value, this.buttonStart = this.browserGamepad.buttons[9].value, this.buttonLeftStick = this.browserGamepad.buttons[10].value, this.buttonRightStick = this.browserGamepad.buttons[11].value, this.dPadUp = this.browserGamepad.buttons[12].value, this.dPadDown = this.browserGamepad.buttons[13].value, this.dPadLeft = this.browserGamepad.buttons[14].value, this.dPadRight = this.browserGamepad.buttons[15].value;
+ }, t.prototype.dispose = function() {
+ r.prototype.dispose.call(this), this.onButtonDownObservable.clear(), this.onButtonUpObservable.clear(), this.onPadDownObservable.clear(), this.onPadUpObservable.clear();
+ }, t;
+ }(Sn);
+ (function(r) {
+ r[r.Cross = 0] = "Cross", r[r.Circle = 1] = "Circle", r[r.Square = 2] = "Square", r[r.Triangle = 3] = "Triangle", r[r.L1 = 4] = "L1", r[r.R1 = 5] = "R1", r[r.Share = 8] = "Share", r[r.Options = 9] = "Options", r[r.LeftStick = 10] = "LeftStick", r[r.RightStick = 11] = "RightStick";
+ })(ri || (ri = {})), function(r) {
+ r[r.Up = 12] = "Up", r[r.Down = 13] = "Down", r[r.Left = 14] = "Left", r[r.Right = 15] = "Right";
+ }(jr || (jr = {}));
+ var xd = function(r) {
+ function t(e, n, i) {
+ var o = r.call(this, e.replace("STANDARD GAMEPAD", "SONY PLAYSTATION DUALSHOCK"), n, i, 0, 1, 2, 3) || this;
+ return o._leftTrigger = 0, o._rightTrigger = 0, o.onButtonDownObservable = new P.c(), o.onButtonUpObservable = new P.c(), o.onPadDownObservable = new P.c(), o.onPadUpObservable = new P.c(), o._buttonCross = 0, o._buttonCircle = 0, o._buttonSquare = 0, o._buttonTriangle = 0, o._buttonShare = 0, o._buttonOptions = 0, o._buttonL1 = 0, o._buttonR1 = 0, o._buttonLeftStick = 0, o._buttonRightStick = 0, o._dPadUp = 0, o._dPadDown = 0, o._dPadLeft = 0, o._dPadRight = 0, o.type = Sn.DUALSHOCK, o;
+ }
+ return Object(u.d)(t, r), t.prototype.onlefttriggerchanged = function(e) {
+ this._onlefttriggerchanged = e;
+ }, t.prototype.onrighttriggerchanged = function(e) {
+ this._onrighttriggerchanged = e;
+ }, Object.defineProperty(t.prototype, "leftTrigger", { get: function() {
+ return this._leftTrigger;
+ }, set: function(e) {
+ this._onlefttriggerchanged && this._leftTrigger !== e && this._onlefttriggerchanged(e), this._leftTrigger = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "rightTrigger", { get: function() {
+ return this._rightTrigger;
+ }, set: function(e) {
+ this._onrighttriggerchanged && this._rightTrigger !== e && this._onrighttriggerchanged(e), this._rightTrigger = e;
+ }, enumerable: !1, configurable: !0 }), t.prototype.onbuttondown = function(e) {
+ this._onbuttondown = e;
+ }, t.prototype.onbuttonup = function(e) {
+ this._onbuttonup = e;
+ }, t.prototype.ondpaddown = function(e) {
+ this._ondpaddown = e;
+ }, t.prototype.ondpadup = function(e) {
+ this._ondpadup = e;
+ }, t.prototype._setButtonValue = function(e, n, i) {
+ return e !== n && (e === 1 && (this._onbuttondown && this._onbuttondown(i), this.onButtonDownObservable.notifyObservers(i)), e === 0 && (this._onbuttonup && this._onbuttonup(i), this.onButtonUpObservable.notifyObservers(i))), e;
+ }, t.prototype._setDPadValue = function(e, n, i) {
+ return e !== n && (e === 1 && (this._ondpaddown && this._ondpaddown(i), this.onPadDownObservable.notifyObservers(i)), e === 0 && (this._ondpadup && this._ondpadup(i), this.onPadUpObservable.notifyObservers(i))), e;
+ }, Object.defineProperty(t.prototype, "buttonCross", { get: function() {
+ return this._buttonCross;
+ }, set: function(e) {
+ this._buttonCross = this._setButtonValue(e, this._buttonCross, ri.Cross);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "buttonCircle", { get: function() {
+ return this._buttonCircle;
+ }, set: function(e) {
+ this._buttonCircle = this._setButtonValue(e, this._buttonCircle, ri.Circle);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "buttonSquare", { get: function() {
+ return this._buttonSquare;
+ }, set: function(e) {
+ this._buttonSquare = this._setButtonValue(e, this._buttonSquare, ri.Square);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "buttonTriangle", { get: function() {
+ return this._buttonTriangle;
+ }, set: function(e) {
+ this._buttonTriangle = this._setButtonValue(e, this._buttonTriangle, ri.Triangle);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "buttonOptions", { get: function() {
+ return this._buttonOptions;
+ }, set: function(e) {
+ this._buttonOptions = this._setButtonValue(e, this._buttonOptions, ri.Options);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "buttonShare", { get: function() {
+ return this._buttonShare;
+ }, set: function(e) {
+ this._buttonShare = this._setButtonValue(e, this._buttonShare, ri.Share);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "buttonL1", { get: function() {
+ return this._buttonL1;
+ }, set: function(e) {
+ this._buttonL1 = this._setButtonValue(e, this._buttonL1, ri.L1);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "buttonR1", { get: function() {
+ return this._buttonR1;
+ }, set: function(e) {
+ this._buttonR1 = this._setButtonValue(e, this._buttonR1, ri.R1);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "buttonLeftStick", { get: function() {
+ return this._buttonLeftStick;
+ }, set: function(e) {
+ this._buttonLeftStick = this._setButtonValue(e, this._buttonLeftStick, ri.LeftStick);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "buttonRightStick", { get: function() {
+ return this._buttonRightStick;
+ }, set: function(e) {
+ this._buttonRightStick = this._setButtonValue(e, this._buttonRightStick, ri.RightStick);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "dPadUp", { get: function() {
+ return this._dPadUp;
+ }, set: function(e) {
+ this._dPadUp = this._setDPadValue(e, this._dPadUp, jr.Up);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "dPadDown", { get: function() {
+ return this._dPadDown;
+ }, set: function(e) {
+ this._dPadDown = this._setDPadValue(e, this._dPadDown, jr.Down);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "dPadLeft", { get: function() {
+ return this._dPadLeft;
+ }, set: function(e) {
+ this._dPadLeft = this._setDPadValue(e, this._dPadLeft, jr.Left);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "dPadRight", { get: function() {
+ return this._dPadRight;
+ }, set: function(e) {
+ this._dPadRight = this._setDPadValue(e, this._dPadRight, jr.Right);
+ }, enumerable: !1, configurable: !0 }), t.prototype.update = function() {
+ r.prototype.update.call(this), this.buttonCross = this.browserGamepad.buttons[0].value, this.buttonCircle = this.browserGamepad.buttons[1].value, this.buttonSquare = this.browserGamepad.buttons[2].value, this.buttonTriangle = this.browserGamepad.buttons[3].value, this.buttonL1 = this.browserGamepad.buttons[4].value, this.buttonR1 = this.browserGamepad.buttons[5].value, this.leftTrigger = this.browserGamepad.buttons[6].value, this.rightTrigger = this.browserGamepad.buttons[7].value, this.buttonShare = this.browserGamepad.buttons[8].value, this.buttonOptions = this.browserGamepad.buttons[9].value, this.buttonLeftStick = this.browserGamepad.buttons[10].value, this.buttonRightStick = this.browserGamepad.buttons[11].value, this.dPadUp = this.browserGamepad.buttons[12].value, this.dPadDown = this.browserGamepad.buttons[13].value, this.dPadLeft = this.browserGamepad.buttons[14].value, this.dPadRight = this.browserGamepad.buttons[15].value;
+ }, t.prototype.dispose = function() {
+ r.prototype.dispose.call(this), this.onButtonDownObservable.clear(), this.onButtonUpObservable.clear(), this.onPadDownObservable.clear(), this.onPadUpObservable.clear();
+ }, t;
+ }(Sn), Rd = function() {
+ function r(t) {
+ var e = this;
+ if (this._scene = t, this._babylonGamepads = [], this._oneGamepadConnected = !1, this._isMonitoring = !1, this.onGamepadDisconnectedObservable = new P.c(), ul.a.IsWindowObjectExist() ? (this._gamepadEventSupported = "GamepadEvent" in window, this._gamepadSupport = navigator.getGamepads || navigator.webkitGetGamepads || navigator.msGetGamepads || navigator.webkitGamepads) : this._gamepadEventSupported = !1, this.onGamepadConnectedObservable = new P.c(function(i) {
+ for (var o in e._babylonGamepads) {
+ var a = e._babylonGamepads[o];
+ a && a._isConnected && e.onGamepadConnectedObservable.notifyObserver(i, a);
+ }
+ }), this._onGamepadConnectedEvent = function(i) {
+ var o, a = i.gamepad;
+ a.index in e._babylonGamepads && e._babylonGamepads[a.index].isConnected || (e._babylonGamepads[a.index] ? ((o = e._babylonGamepads[a.index]).browserGamepad = a, o._isConnected = !0) : o = e._addNewGamepad(a), e.onGamepadConnectedObservable.notifyObservers(o), e._startMonitoringGamepads());
+ }, this._onGamepadDisconnectedEvent = function(i) {
+ var o = i.gamepad;
+ for (var a in e._babylonGamepads)
+ if (e._babylonGamepads[a].index === o.index) {
+ var s = e._babylonGamepads[a];
+ s._isConnected = !1, e.onGamepadDisconnectedObservable.notifyObservers(s), s.dispose && s.dispose();
+ break;
+ }
+ }, this._gamepadSupport)
+ if (this._updateGamepadObjects(), this._babylonGamepads.length && this._startMonitoringGamepads(), this._gamepadEventSupported) {
+ var n = this._scene ? this._scene.getEngine().getHostWindow() : window;
+ n && (n.addEventListener("gamepadconnected", this._onGamepadConnectedEvent, !1), n.addEventListener("gamepaddisconnected", this._onGamepadDisconnectedEvent, !1));
+ } else
+ this._startMonitoringGamepads();
+ }
+ return Object.defineProperty(r.prototype, "gamepads", { get: function() {
+ return this._babylonGamepads;
+ }, enumerable: !1, configurable: !0 }), r.prototype.getGamepadByType = function(t) {
+ t === void 0 && (t = Sn.XBOX);
+ for (var e = 0, n = this._babylonGamepads; e < n.length; e++) {
+ var i = n[e];
+ if (i && i.type === t)
+ return i;
+ }
+ return null;
+ }, r.prototype.dispose = function() {
+ this._gamepadEventSupported && (this._onGamepadConnectedEvent && window.removeEventListener("gamepadconnected", this._onGamepadConnectedEvent), this._onGamepadDisconnectedEvent && window.removeEventListener("gamepaddisconnected", this._onGamepadDisconnectedEvent), this._onGamepadConnectedEvent = null, this._onGamepadDisconnectedEvent = null), this._babylonGamepads.forEach(function(t) {
+ t.dispose();
+ }), this.onGamepadConnectedObservable.clear(), this.onGamepadDisconnectedObservable.clear(), this._oneGamepadConnected = !1, this._stopMonitoringGamepads(), this._babylonGamepads = [];
+ }, r.prototype._addNewGamepad = function(t) {
+ var e;
+ this._oneGamepadConnected || (this._oneGamepadConnected = !0);
+ var n = t.id.search("054c") !== -1, i = t.id.search("Xbox One") !== -1;
+ return e = i || t.id.search("Xbox 360") !== -1 || t.id.search("xinput") !== -1 ? new Cd(t.id, t.index, t, i) : n ? new xd(t.id, t.index, t) : t.pose ? pr.InitiateController(t) : new bd(t.id, t.index, t), this._babylonGamepads[e.index] = e, e;
+ }, r.prototype._startMonitoringGamepads = function() {
+ this._isMonitoring || (this._isMonitoring = !0, this._scene || this._checkGamepadsStatus());
+ }, r.prototype._stopMonitoringGamepads = function() {
+ this._isMonitoring = !1;
+ }, r.prototype._checkGamepadsStatus = function() {
+ var t = this;
+ for (var e in this._updateGamepadObjects(), this._babylonGamepads) {
+ var n = this._babylonGamepads[e];
+ n && n.isConnected && n.update();
+ }
+ this._isMonitoring && !this._scene && ke.a.QueueNewFrame(function() {
+ t._checkGamepadsStatus();
+ });
+ }, r.prototype._updateGamepadObjects = function() {
+ for (var t = navigator.getGamepads ? navigator.getGamepads() : navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : [], e = 0; e < t.length; e++) {
+ var n = t[e];
+ if (n)
+ if (this._babylonGamepads[n.index])
+ this._babylonGamepads[e].browserGamepad = n, this._babylonGamepads[e].isConnected || (this._babylonGamepads[e]._isConnected = !0, this.onGamepadConnectedObservable.notifyObservers(this._babylonGamepads[e]));
+ else {
+ var i = this._addNewGamepad(n);
+ this.onGamepadConnectedObservable.notifyObservers(i);
+ }
+ }
+ }, r;
+ }();
+ Object.defineProperty(ge.a.prototype, "gamepadManager", { get: function() {
+ if (!this._gamepadManager) {
+ this._gamepadManager = new Rd(this);
+ var r = this._getComponent(st.a.NAME_GAMEPAD);
+ r || (r = new Od(this), this._addComponent(r));
+ }
+ return this._gamepadManager;
+ }, enumerable: !0, configurable: !0 }), ma.prototype.addGamepad = function() {
+ return this.add(new al()), this;
+ }, ps.prototype.addGamepad = function() {
+ return this.add(new Wc()), this;
+ };
+ var Od = function() {
+ function r(t) {
+ this.name = st.a.NAME_GAMEPAD, this.scene = t;
+ }
+ return r.prototype.register = function() {
+ this.scene._beforeCameraUpdateStage.registerStep(st.a.STEP_BEFORECAMERAUPDATE_GAMEPAD, this, this._beforeCameraUpdate);
+ }, r.prototype.rebuild = function() {
+ }, r.prototype.dispose = function() {
+ var t = this.scene._gamepadManager;
+ t && (t.dispose(), this.scene._gamepadManager = null);
+ }, r.prototype._beforeCameraUpdate = function() {
+ var t = this.scene._gamepadManager;
+ t && t._isMonitoring && t._checkGamepadsStatus();
+ }, r;
+ }();
+ q.a.AddNodeConstructor("FreeCamera", function(r, t) {
+ return function() {
+ return new go(r, c.e.Zero(), t);
+ };
+ });
+ var go = function(r) {
+ function t(e, n, i) {
+ var o = r.call(this, e, n, i) || this;
+ return o.inputs.addGamepad(), o;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "gamepadAngularSensibility", { get: function() {
+ var e = this.inputs.attached.gamepad;
+ return e ? e.gamepadAngularSensibility : 0;
+ }, set: function(e) {
+ var n = this.inputs.attached.gamepad;
+ n && (n.gamepadAngularSensibility = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "gamepadMoveSensibility", { get: function() {
+ var e = this.inputs.attached.gamepad;
+ return e ? e.gamepadMoveSensibility : 0;
+ }, set: function(e) {
+ var n = this.inputs.attached.gamepad;
+ n && (n.gamepadMoveSensibility = e);
+ }, enumerable: !1, configurable: !0 }), t.prototype.getClassName = function() {
+ return "UniversalCamera";
+ }, t;
+ }(ll);
+ gt.a._createDefaultParsedCamera = function(r, t) {
+ return new go(r, c.e.Zero(), t);
+ }, q.a.AddNodeConstructor("GamepadCamera", function(r, t) {
+ return function() {
+ return new ms(r, c.e.Zero(), t);
+ };
+ });
+ var ms = function(r) {
+ function t(e, n, i) {
+ return r.call(this, e, n, i) || this;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "GamepadCamera";
+ }, t;
+ }(go), Ui = l(33), We = l(5), ib = `
+attribute vec2 position;
+uniform vec2 scale;
+
+varying vec2 vUV;
+const vec2 madd=vec2(0.5,0.5);
+void main(void) {
+vUV=(position*madd+madd)*scale;
+gl_Position=vec4(position,0.0,1.0);
+}`;
+ We.a.ShadersStore.postprocessVertexShader = ib;
+ var Md = l(102);
+ Gt.a.prototype.createRenderTargetTexture = function(r, t) {
+ var e = new Md.a();
+ t !== void 0 && typeof t == "object" ? (e.generateMipMaps = t.generateMipMaps, e.generateDepthBuffer = !!t.generateDepthBuffer, e.generateStencilBuffer = !!t.generateStencilBuffer, e.type = t.type === void 0 ? d.a.TEXTURETYPE_UNSIGNED_INT : t.type, e.samplingMode = t.samplingMode === void 0 ? d.a.TEXTURE_TRILINEAR_SAMPLINGMODE : t.samplingMode, e.format = t.format === void 0 ? d.a.TEXTUREFORMAT_RGBA : t.format) : (e.generateMipMaps = t, e.generateDepthBuffer = !0, e.generateStencilBuffer = !1, e.type = d.a.TEXTURETYPE_UNSIGNED_INT, e.samplingMode = d.a.TEXTURE_TRILINEAR_SAMPLINGMODE, e.format = d.a.TEXTUREFORMAT_RGBA), (e.type !== d.a.TEXTURETYPE_FLOAT || this._caps.textureFloatLinearFiltering) && (e.type !== d.a.TEXTURETYPE_HALF_FLOAT || this._caps.textureHalfFloatLinearFiltering) || (e.samplingMode = d.a.TEXTURE_NEAREST_SAMPLINGMODE), e.type !== d.a.TEXTURETYPE_FLOAT || this._caps.textureFloat || (e.type = d.a.TEXTURETYPE_UNSIGNED_INT, h.a.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type"));
+ var n = this._gl, i = new Rt.a(this, Rt.b.RenderTarget), o = r.width || r, a = r.height || r, s = r.layers || 0, p = this._getSamplingParameters(e.samplingMode, !!e.generateMipMaps), m = s !== 0 ? n.TEXTURE_2D_ARRAY : n.TEXTURE_2D, S = this._getRGBABufferInternalSizedFormat(e.type, e.format), O = this._getInternalFormat(e.format), I = this._getWebGLTextureType(e.type);
+ this._bindTextureDirectly(m, i), s !== 0 ? (i.is2DArray = !0, n.texImage3D(m, 0, S, o, a, s, 0, O, I, null)) : n.texImage2D(m, 0, S, o, a, 0, O, I, null), n.texParameteri(m, n.TEXTURE_MAG_FILTER, p.mag), n.texParameteri(m, n.TEXTURE_MIN_FILTER, p.min), n.texParameteri(m, n.TEXTURE_WRAP_S, n.CLAMP_TO_EDGE), n.texParameteri(m, n.TEXTURE_WRAP_T, n.CLAMP_TO_EDGE), e.generateMipMaps && this._gl.generateMipmap(m), this._bindTextureDirectly(m, null);
+ var G = this._currentFramebuffer, k = n.createFramebuffer();
+ return this._bindUnboundFramebuffer(k), i._depthStencilBuffer = this._setupFramebufferDepthAttachments(!!e.generateStencilBuffer, e.generateDepthBuffer, o, a), i.is2DArray || n.framebufferTexture2D(n.FRAMEBUFFER, n.COLOR_ATTACHMENT0, n.TEXTURE_2D, i._webGLTexture, 0), this._bindUnboundFramebuffer(G), i._framebuffer = k, i.baseWidth = o, i.baseHeight = a, i.width = o, i.height = a, i.depth = s, i.isReady = !0, i.samples = 1, i.generateMipMaps = !!e.generateMipMaps, i.samplingMode = e.samplingMode, i.type = e.type, i.format = e.format, i._generateDepthBuffer = e.generateDepthBuffer, i._generateStencilBuffer = !!e.generateStencilBuffer, this._internalTexturesCache.push(i), i;
+ }, Gt.a.prototype.createDepthStencilTexture = function(r, t) {
+ if (t.isCube) {
+ var e = r.width || r;
+ return this._createDepthStencilCubeTexture(e, t);
+ }
+ return this._createDepthStencilTexture(r, t);
+ }, Gt.a.prototype._createDepthStencilTexture = function(r, t) {
+ var e = this._gl, n = r.layers || 0, i = n !== 0 ? e.TEXTURE_2D_ARRAY : e.TEXTURE_2D, o = new Rt.a(this, Rt.b.Depth);
+ if (!this._caps.depthTextureExtension)
+ return h.a.Error("Depth texture is not supported by your browser or hardware."), o;
+ var a = Object(u.a)({ bilinearFiltering: !1, comparisonFunction: 0, generateStencil: !1 }, t);
+ this._bindTextureDirectly(i, o, !0), this._setupDepthStencilTexture(o, r, a.generateStencil, a.bilinearFiltering, a.comparisonFunction);
+ var s = a.generateStencil ? e.UNSIGNED_INT_24_8 : e.UNSIGNED_INT, p = a.generateStencil ? e.DEPTH_STENCIL : e.DEPTH_COMPONENT, m = p;
+ return this.webGLVersion > 1 && (m = a.generateStencil ? e.DEPTH24_STENCIL8 : e.DEPTH_COMPONENT24), o.is2DArray ? e.texImage3D(i, 0, m, o.width, o.height, n, 0, p, s, null) : e.texImage2D(i, 0, m, o.width, o.height, 0, p, s, null), this._bindTextureDirectly(i, null), o;
+ };
+ var _t = function() {
+ function r(t, e, n, i, o, a, s, p, m, S, O, I, G, k, K) {
+ s === void 0 && (s = d.a.TEXTURE_NEAREST_SAMPLINGMODE), S === void 0 && (S = null), O === void 0 && (O = d.a.TEXTURETYPE_UNSIGNED_INT), I === void 0 && (I = "postprocess"), k === void 0 && (k = !1), K === void 0 && (K = d.a.TEXTUREFORMAT_RGBA), this.width = -1, this.height = -1, this.nodeMaterialSource = null, this._outputTexture = null, this.autoClear = !0, this.alphaMode = d.a.ALPHA_DISABLE, this.animations = new Array(), this.enablePixelPerfectMode = !1, this.forceFullscreenViewport = !0, this.scaleMode = d.a.SCALEMODE_FLOOR, this.alwaysForcePOT = !1, this._samples = 1, this.adaptScaleToCurrentViewport = !1, this._reusable = !1, this._textures = new Ui.a(2), this._currentRenderTextureInd = 0, this._scaleRatio = new c.d(1, 1), this._texelSize = c.d.Zero(), this.onActivateObservable = new P.c(), this.onSizeChangedObservable = new P.c(), this.onApplyObservable = new P.c(), this.onBeforeRenderObservable = new P.c(), this.onAfterRenderObservable = new P.c(), this.name = t, a != null ? (this._camera = a, this._scene = a.getScene(), a.attachPostProcess(this), this._engine = this._scene.getEngine(), this._scene.postProcesses.push(this), this.uniqueId = this._scene.getUniqueId()) : p && (this._engine = p, this._engine.postProcesses.push(this)), this._options = o, this.renderTargetSamplingMode = s || d.a.TEXTURE_NEAREST_SAMPLINGMODE, this._reusable = m || !1, this._textureType = O, this._textureFormat = K, this._samplers = i || [], this._samplers.push("textureSampler"), this._fragmentUrl = e, this._vertexUrl = I, this._parameters = n || [], this._parameters.push("scale"), this._indexParameters = G, k || this.updateEffect(S);
+ }
+ return Object.defineProperty(r.prototype, "samples", { get: function() {
+ return this._samples;
+ }, set: function(t) {
+ var e = this;
+ this._samples = Math.min(t, this._engine.getCaps().maxMSAASamples), this._textures.forEach(function(n) {
+ n.samples !== e._samples && e._engine.updateRenderTargetTextureSampleCount(n, e._samples);
+ });
+ }, enumerable: !1, configurable: !0 }), r.prototype.getEffectName = function() {
+ return this._fragmentUrl;
+ }, Object.defineProperty(r.prototype, "onActivate", { set: function(t) {
+ this._onActivateObserver && this.onActivateObservable.remove(this._onActivateObserver), t && (this._onActivateObserver = this.onActivateObservable.add(t));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "onSizeChanged", { set: function(t) {
+ this._onSizeChangedObserver && this.onSizeChangedObservable.remove(this._onSizeChangedObserver), this._onSizeChangedObserver = this.onSizeChangedObservable.add(t);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "onApply", { set: function(t) {
+ this._onApplyObserver && this.onApplyObservable.remove(this._onApplyObserver), this._onApplyObserver = this.onApplyObservable.add(t);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "onBeforeRender", { set: function(t) {
+ this._onBeforeRenderObserver && this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver), this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(t);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "onAfterRender", { set: function(t) {
+ this._onAfterRenderObserver && this.onAfterRenderObservable.remove(this._onAfterRenderObserver), this._onAfterRenderObserver = this.onAfterRenderObservable.add(t);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "inputTexture", { get: function() {
+ return this._textures.data[this._currentRenderTextureInd];
+ }, set: function(t) {
+ this._forcedOutputTexture = t;
+ }, enumerable: !1, configurable: !0 }), r.prototype.restoreDefaultInputTexture = function() {
+ this._forcedOutputTexture = null;
+ }, r.prototype.getCamera = function() {
+ return this._camera;
+ }, Object.defineProperty(r.prototype, "texelSize", { get: function() {
+ return this._shareOutputWithPostProcess ? this._shareOutputWithPostProcess.texelSize : (this._forcedOutputTexture && this._texelSize.copyFromFloats(1 / this._forcedOutputTexture.width, 1 / this._forcedOutputTexture.height), this._texelSize);
+ }, enumerable: !1, configurable: !0 }), r.prototype.getClassName = function() {
+ return "PostProcess";
+ }, r.prototype.getEngine = function() {
+ return this._engine;
+ }, r.prototype.getEffect = function() {
+ return this._effect;
+ }, r.prototype.shareOutputWith = function(t) {
+ return this._disposeTextures(), this._shareOutputWithPostProcess = t, this;
+ }, r.prototype.useOwnOutput = function() {
+ this._textures.length == 0 && (this._textures = new Ui.a(2)), this._shareOutputWithPostProcess = null;
+ }, r.prototype.updateEffect = function(t, e, n, i, o, a, s, p) {
+ t === void 0 && (t = null), e === void 0 && (e = null), n === void 0 && (n = null), this._effect = this._engine.createEffect({ vertex: s ?? this._vertexUrl, fragment: p ?? this._fragmentUrl }, ["position"], e || this._parameters, n || this._samplers, t !== null ? t : "", void 0, o, a, i || this._indexParameters);
+ }, r.prototype.isReusable = function() {
+ return this._reusable;
+ }, r.prototype.markTextureDirty = function() {
+ this.width = -1;
+ }, r.prototype.activate = function(t, e, n) {
+ var i = this;
+ e === void 0 && (e = null);
+ var o = (t = t || this._camera).getScene(), a = o.getEngine(), s = a.getCaps().maxTextureSize, p = (e ? e.width : this._engine.getRenderWidth(!0)) * this._options | 0, m = (e ? e.height : this._engine.getRenderHeight(!0)) * this._options | 0, S = t.parent;
+ !S || S.leftCamera != t && S.rightCamera != t || (p /= 2);
+ var O, I = this._options.width || p, G = this._options.height || m, k = this.renderTargetSamplingMode !== d.a.TEXTURE_NEAREST_LINEAR && this.renderTargetSamplingMode !== d.a.TEXTURE_NEAREST_NEAREST && this.renderTargetSamplingMode !== d.a.TEXTURE_LINEAR_LINEAR;
+ if (!this._shareOutputWithPostProcess && !this._forcedOutputTexture) {
+ if (this.adaptScaleToCurrentViewport) {
+ var K = a.currentViewport;
+ K && (I *= K.width, G *= K.height);
+ }
+ if ((k || this.alwaysForcePOT) && (this._options.width || (I = a.needPOTTextures ? ke.a.GetExponentOfTwo(I, s, this.scaleMode) : I), this._options.height || (G = a.needPOTTextures ? ke.a.GetExponentOfTwo(G, s, this.scaleMode) : G)), this.width !== I || this.height !== G) {
+ if (this._textures.length > 0) {
+ for (var re = 0; re < this._textures.length; re++)
+ this._engine._releaseTexture(this._textures.data[re]);
+ this._textures.reset();
+ }
+ this.width = I, this.height = G;
+ var se = { width: this.width, height: this.height }, ue = { generateMipMaps: k, generateDepthBuffer: n || t._postProcesses.indexOf(this) === 0, generateStencilBuffer: (n || t._postProcesses.indexOf(this) === 0) && this._engine.isStencilEnable, samplingMode: this.renderTargetSamplingMode, type: this._textureType, format: this._textureFormat };
+ this._textures.push(this._engine.createRenderTargetTexture(se, ue)), this._reusable && this._textures.push(this._engine.createRenderTargetTexture(se, ue)), this._texelSize.copyFromFloats(1 / this.width, 1 / this.height), this.onSizeChangedObservable.notifyObservers(this);
+ }
+ this._textures.forEach(function(he) {
+ he.samples !== i.samples && i._engine.updateRenderTargetTextureSampleCount(he, i.samples);
+ });
+ }
+ return this._shareOutputWithPostProcess ? O = this._shareOutputWithPostProcess.inputTexture : this._forcedOutputTexture ? (O = this._forcedOutputTexture, this.width = this._forcedOutputTexture.width, this.height = this._forcedOutputTexture.height) : O = this.inputTexture, this.enablePixelPerfectMode ? (this._scaleRatio.copyFromFloats(p / I, m / G), this._engine.bindFramebuffer(O, 0, p, m, this.forceFullscreenViewport)) : (this._scaleRatio.copyFromFloats(1, 1), this._engine.bindFramebuffer(O, 0, void 0, void 0, this.forceFullscreenViewport)), this.onActivateObservable.notifyObservers(t), this.autoClear && this.alphaMode === d.a.ALPHA_DISABLE && this._engine.clear(this.clearColor ? this.clearColor : o.clearColor, o._allowPostProcessClearColor, !0, !0), this._reusable && (this._currentRenderTextureInd = (this._currentRenderTextureInd + 1) % 2), O;
+ }, Object.defineProperty(r.prototype, "isSupported", { get: function() {
+ return this._effect.isSupported;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "aspectRatio", { get: function() {
+ return this._shareOutputWithPostProcess ? this._shareOutputWithPostProcess.aspectRatio : this._forcedOutputTexture ? this._forcedOutputTexture.width / this._forcedOutputTexture.height : this.width / this.height;
+ }, enumerable: !1, configurable: !0 }), r.prototype.isReady = function() {
+ return this._effect && this._effect.isReady();
+ }, r.prototype.apply = function() {
+ return this._effect && this._effect.isReady() ? (this._engine.enableEffect(this._effect), this._engine.setState(!1), this._engine.setDepthBuffer(!1), this._engine.setDepthWrite(!1), this._engine.setAlphaMode(this.alphaMode), this.alphaConstants && this.getEngine().setAlphaConstants(this.alphaConstants.r, this.alphaConstants.g, this.alphaConstants.b, this.alphaConstants.a), t = this._shareOutputWithPostProcess ? this._shareOutputWithPostProcess.inputTexture : this._forcedOutputTexture ? this._forcedOutputTexture : this.inputTexture, this._effect._bindTexture("textureSampler", t), this._effect.setVector2("scale", this._scaleRatio), this.onApplyObservable.notifyObservers(this._effect), this._effect) : null;
+ var t;
+ }, r.prototype._disposeTextures = function() {
+ if (!this._shareOutputWithPostProcess && !this._forcedOutputTexture) {
+ if (this._textures.length > 0)
+ for (var t = 0; t < this._textures.length; t++)
+ this._engine._releaseTexture(this._textures.data[t]);
+ this._textures.dispose();
+ }
+ }, r.prototype.setPrePassRenderer = function(t) {
+ return !!this._prePassEffectConfiguration && (this._prePassEffectConfiguration = t.addEffectConfiguration(this._prePassEffectConfiguration), this._prePassEffectConfiguration.enabled = !0, !0);
+ }, r.prototype.dispose = function(t) {
+ var e;
+ if (t = t || this._camera, this._disposeTextures(), this._scene && (e = this._scene.postProcesses.indexOf(this)) !== -1 && this._scene.postProcesses.splice(e, 1), (e = this._engine.postProcesses.indexOf(this)) !== -1 && this._engine.postProcesses.splice(e, 1), t) {
+ if (t.detachPostProcess(this), (e = t._postProcesses.indexOf(this)) === 0 && t._postProcesses.length > 0) {
+ var n = this._camera._getFirstPostProcess();
+ n && n.markTextureDirty();
+ }
+ this.onActivateObservable.clear(), this.onAfterRenderObservable.clear(), this.onApplyObservable.clear(), this.onBeforeRenderObservable.clear(), this.onSizeChangedObservable.clear();
+ }
+ }, r.prototype.serialize = function() {
+ var t = w.a.Serialize(this);
+ return t.customType = "BABYLON." + this.getClassName(), t.cameraId = this.getCamera().id, t.reusable = this._reusable, t.options = this._options, t.textureType = this._textureType, t;
+ }, r.Parse = function(t, e, n) {
+ var i = x.a.GetClass(t.customType);
+ if (!i || !i._Parse)
+ return null;
+ var o = e.getCameraByID(t.cameraId);
+ return o ? i._Parse(t, o, e, n) : null;
+ }, Object(u.c)([Object(w.c)()], r.prototype, "uniqueId", void 0), Object(u.c)([Object(w.c)()], r.prototype, "name", void 0), Object(u.c)([Object(w.c)()], r.prototype, "width", void 0), Object(u.c)([Object(w.c)()], r.prototype, "height", void 0), Object(u.c)([Object(w.c)()], r.prototype, "renderTargetSamplingMode", void 0), Object(u.c)([Object(w.f)()], r.prototype, "clearColor", void 0), Object(u.c)([Object(w.c)()], r.prototype, "autoClear", void 0), Object(u.c)([Object(w.c)()], r.prototype, "alphaMode", void 0), Object(u.c)([Object(w.c)()], r.prototype, "alphaConstants", void 0), Object(u.c)([Object(w.c)()], r.prototype, "enablePixelPerfectMode", void 0), Object(u.c)([Object(w.c)()], r.prototype, "forceFullscreenViewport", void 0), Object(u.c)([Object(w.c)()], r.prototype, "scaleMode", void 0), Object(u.c)([Object(w.c)()], r.prototype, "alwaysForcePOT", void 0), Object(u.c)([Object(w.c)("samples")], r.prototype, "_samples", void 0), Object(u.c)([Object(w.c)()], r.prototype, "adaptScaleToCurrentViewport", void 0), r;
+ }();
+ x.a.RegisteredTypes["BABYLON.PostProcess"] = _t;
+ var rb = `
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+void main(void)
+{
+gl_FragColor=texture2D(textureSampler,vUV);
+}`;
+ We.a.ShadersStore.passPixelShader = rb;
+ var ob = `
+varying vec2 vUV;
+uniform samplerCube textureSampler;
+void main(void)
+{
+vec2 uv=vUV*2.0-1.0;
+#ifdef POSITIVEX
+gl_FragColor=textureCube(textureSampler,vec3(1.001,uv.y,uv.x));
+#endif
+#ifdef NEGATIVEX
+gl_FragColor=textureCube(textureSampler,vec3(-1.001,uv.y,uv.x));
+#endif
+#ifdef POSITIVEY
+gl_FragColor=textureCube(textureSampler,vec3(uv.y,1.001,uv.x));
+#endif
+#ifdef NEGATIVEY
+gl_FragColor=textureCube(textureSampler,vec3(uv.y,-1.001,uv.x));
+#endif
+#ifdef POSITIVEZ
+gl_FragColor=textureCube(textureSampler,vec3(uv,1.001));
+#endif
+#ifdef NEGATIVEZ
+gl_FragColor=textureCube(textureSampler,vec3(uv,-1.001));
+#endif
+}`;
+ We.a.ShadersStore.passCubePixelShader = ob;
+ var _r = function(r) {
+ function t(e, n, i, o, a, s, p, m) {
+ return i === void 0 && (i = null), p === void 0 && (p = d.a.TEXTURETYPE_UNSIGNED_INT), m === void 0 && (m = !1), r.call(this, e, "pass", null, null, n, i, o, a, s, void 0, p, void 0, null, m) || this;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "PassPostProcess";
+ }, t._Parse = function(e, n, i, o) {
+ return w.a.Parse(function() {
+ return new t(e.name, e.options, n, e.renderTargetSamplingMode, i.getEngine(), e.reusable);
+ }, e, i, o);
+ }, t;
+ }(_t);
+ x.a.RegisteredTypes["BABYLON.PassPostProcess"] = _r;
+ var ab = function(r) {
+ function t(e, n, i, o, a, s, p, m) {
+ i === void 0 && (i = null), p === void 0 && (p = d.a.TEXTURETYPE_UNSIGNED_INT), m === void 0 && (m = !1);
+ var S = r.call(this, e, "passCube", null, null, n, i, o, a, s, "#define POSITIVEX", p, void 0, null, m) || this;
+ return S._face = 0, S;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "face", { get: function() {
+ return this._face;
+ }, set: function(e) {
+ if (!(e < 0 || e > 5))
+ switch (this._face = e, this._face) {
+ case 0:
+ this.updateEffect("#define POSITIVEX");
+ break;
+ case 1:
+ this.updateEffect("#define NEGATIVEX");
+ break;
+ case 2:
+ this.updateEffect("#define POSITIVEY");
+ break;
+ case 3:
+ this.updateEffect("#define NEGATIVEY");
+ break;
+ case 4:
+ this.updateEffect("#define POSITIVEZ");
+ break;
+ case 5:
+ this.updateEffect("#define NEGATIVEZ");
+ }
+ }, enumerable: !1, configurable: !0 }), t.prototype.getClassName = function() {
+ return "PassCubePostProcess";
+ }, t._Parse = function(e, n, i, o) {
+ return w.a.Parse(function() {
+ return new t(e.name, e.options, n, e.renderTargetSamplingMode, i.getEngine(), e.reusable);
+ }, e, i, o);
+ }, t;
+ }(_t);
+ ke.a._RescalePostProcessFactory = function(r) {
+ return new _r("rescale", 1, null, d.a.TEXTURE_BILINEAR_SAMPLINGMODE, r, !1, d.a.TEXTURETYPE_UNSIGNED_INT);
+ };
+ var sb = `
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+uniform sampler2D leftSampler;
+void main(void)
+{
+vec4 leftFrag=texture2D(leftSampler,vUV);
+leftFrag=vec4(1.0,leftFrag.g,leftFrag.b,1.0);
+vec4 rightFrag=texture2D(textureSampler,vUV);
+rightFrag=vec4(rightFrag.r,1.0,1.0,1.0);
+gl_FragColor=vec4(rightFrag.rgb*leftFrag.rgb,1.0);
+}`;
+ We.a.ShadersStore.anaglyphPixelShader = sb;
+ var hl = function(r) {
+ function t(e, n, i, o, a, s) {
+ var p = r.call(this, e, "anaglyph", null, ["leftSampler"], n, i[1], o, a, s) || this;
+ return p._passedProcess = i[0]._rigPostProcess, p.onApplyObservable.add(function(m) {
+ m.setTextureFromPostProcess("leftSampler", p._passedProcess);
+ }), p;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "AnaglyphPostProcess";
+ }, t;
+ }(_t);
+ x.a.RegisteredTypes["BABYLON.AnaglyphPostProcess"] = hl, gt.a._setStereoscopicAnaglyphRigMode = function(r) {
+ r._rigCameras[0]._rigPostProcess = new _r(r.name + "_passthru", 1, r._rigCameras[0]), r._rigCameras[1]._rigPostProcess = new hl(r.name + "_anaglyph", 1, r._rigCameras);
+ }, q.a.AddNodeConstructor("AnaglyphArcRotateCamera", function(r, t, e) {
+ return function() {
+ return new Id(r, 0, 0, 1, c.e.Zero(), e.interaxial_distance, t);
+ };
+ });
+ var Id = function(r) {
+ function t(e, n, i, o, a, s, p) {
+ var m = r.call(this, e, n, i, o, a, p) || this;
+ return m.interaxialDistance = s, m.setCameraRigMode(gt.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH, { interaxialDistance: s }), m;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "AnaglyphArcRotateCamera";
+ }, t;
+ }(Gr);
+ q.a.AddNodeConstructor("AnaglyphFreeCamera", function(r, t, e) {
+ return function() {
+ return new Dd(r, c.e.Zero(), e.interaxial_distance, t);
+ };
+ });
+ var Dd = function(r) {
+ function t(e, n, i, o) {
+ var a = r.call(this, e, n, o) || this;
+ return a.interaxialDistance = i, a.setCameraRigMode(gt.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH, { interaxialDistance: i }), a;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "AnaglyphFreeCamera";
+ }, t;
+ }(ci);
+ q.a.AddNodeConstructor("AnaglyphGamepadCamera", function(r, t, e) {
+ return function() {
+ return new Ld(r, c.e.Zero(), e.interaxial_distance, t);
+ };
+ });
+ var Ld = function(r) {
+ function t(e, n, i, o) {
+ var a = r.call(this, e, n, o) || this;
+ return a.interaxialDistance = i, a.setCameraRigMode(gt.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH, { interaxialDistance: i }), a;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "AnaglyphGamepadCamera";
+ }, t;
+ }(ms);
+ q.a.AddNodeConstructor("AnaglyphUniversalCamera", function(r, t, e) {
+ return function() {
+ return new wd(r, c.e.Zero(), e.interaxial_distance, t);
+ };
+ });
+ var wd = function(r) {
+ function t(e, n, i, o) {
+ var a = r.call(this, e, n, o) || this;
+ return a.interaxialDistance = i, a.setCameraRigMode(gt.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH, { interaxialDistance: i }), a;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "AnaglyphUniversalCamera";
+ }, t;
+ }(go), li = l(58);
+ gt.a._setStereoscopicRigMode = function(r) {
+ var t = r.cameraRigMode === gt.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL || r.cameraRigMode === gt.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED, e = r.cameraRigMode === gt.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED;
+ r._rigCameras[e ? 1 : 0].viewport = new li.a(0, 0, t ? 0.5 : 1, t ? 1 : 0.5), r._rigCameras[e ? 0 : 1].viewport = new li.a(t ? 0.5 : 0, t ? 0 : 0.5, t ? 0.5 : 1, t ? 1 : 0.5);
+ }, q.a.AddNodeConstructor("StereoscopicArcRotateCamera", function(r, t, e) {
+ return function() {
+ return new Nd(r, 0, 0, 1, c.e.Zero(), e.interaxial_distance, e.isStereoscopicSideBySide, t);
+ };
+ });
+ var Nd = function(r) {
+ function t(e, n, i, o, a, s, p, m) {
+ var S = r.call(this, e, n, i, o, a, m) || this;
+ return S.interaxialDistance = s, S.isStereoscopicSideBySide = p, S.setCameraRigMode(p ? gt.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL : gt.a.RIG_MODE_STEREOSCOPIC_OVERUNDER, { interaxialDistance: s }), S;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "StereoscopicArcRotateCamera";
+ }, t;
+ }(Gr);
+ q.a.AddNodeConstructor("StereoscopicFreeCamera", function(r, t, e) {
+ return function() {
+ return new Fd(r, c.e.Zero(), e.interaxial_distance, e.isStereoscopicSideBySide, t);
+ };
+ });
+ var Fd = function(r) {
+ function t(e, n, i, o, a) {
+ var s = r.call(this, e, n, a) || this;
+ return s.interaxialDistance = i, s.isStereoscopicSideBySide = o, s.setCameraRigMode(o ? gt.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL : gt.a.RIG_MODE_STEREOSCOPIC_OVERUNDER, { interaxialDistance: i }), s;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "StereoscopicFreeCamera";
+ }, t;
+ }(ci);
+ q.a.AddNodeConstructor("StereoscopicGamepadCamera", function(r, t, e) {
+ return function() {
+ return new Bd(r, c.e.Zero(), e.interaxial_distance, e.isStereoscopicSideBySide, t);
+ };
+ });
+ var Bd = function(r) {
+ function t(e, n, i, o, a) {
+ var s = r.call(this, e, n, a) || this;
+ return s.interaxialDistance = i, s.isStereoscopicSideBySide = o, s.setCameraRigMode(o ? gt.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL : gt.a.RIG_MODE_STEREOSCOPIC_OVERUNDER, { interaxialDistance: i }), s;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "StereoscopicGamepadCamera";
+ }, t;
+ }(ms);
+ q.a.AddNodeConstructor("StereoscopicFreeCamera", function(r, t, e) {
+ return function() {
+ return new Ud(r, c.e.Zero(), e.interaxial_distance, e.isStereoscopicSideBySide, t);
+ };
+ });
+ var Ud = function(r) {
+ function t(e, n, i, o, a) {
+ var s = r.call(this, e, n, a) || this;
+ return s.interaxialDistance = i, s.isStereoscopicSideBySide = o, s.setCameraRigMode(o ? gt.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL : gt.a.RIG_MODE_STEREOSCOPIC_OVERUNDER, { interaxialDistance: i }), s;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "StereoscopicUniversalCamera";
+ }, t;
+ }(go);
+ q.a.AddNodeConstructor("VirtualJoysticksCamera", function(r, t) {
+ return function() {
+ return new Vd(r, c.e.Zero(), t);
+ };
+ });
+ var Vd = function(r) {
+ function t(e, n, i) {
+ var o = r.call(this, e, n, i) || this;
+ return o.inputs.addVirtualJoystick(), o;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "VirtualJoysticksCamera";
+ }, t;
+ }(ci), vo = function() {
+ function r() {
+ this.compensateDistortion = !0, this.multiviewEnabled = !1;
+ }
+ return Object.defineProperty(r.prototype, "aspectRatio", { get: function() {
+ return this.hResolution / (2 * this.vResolution);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "aspectRatioFov", { get: function() {
+ return 2 * Math.atan(this.postProcessScaleFactor * this.vScreenSize / (2 * this.eyeToScreenDistance));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "leftHMatrix", { get: function() {
+ var t = 4 * (this.hScreenSize / 4 - this.lensSeparationDistance / 2) / this.hScreenSize;
+ return c.a.Translation(t, 0, 0);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "rightHMatrix", { get: function() {
+ var t = 4 * (this.hScreenSize / 4 - this.lensSeparationDistance / 2) / this.hScreenSize;
+ return c.a.Translation(-t, 0, 0);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "leftPreViewMatrix", { get: function() {
+ return c.a.Translation(0.5 * this.interpupillaryDistance, 0, 0);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "rightPreViewMatrix", { get: function() {
+ return c.a.Translation(-0.5 * this.interpupillaryDistance, 0, 0);
+ }, enumerable: !1, configurable: !0 }), r.GetDefault = function() {
+ var t = new r();
+ return t.hResolution = 1280, t.vResolution = 800, t.hScreenSize = 0.149759993, t.vScreenSize = 0.0935999975, t.vScreenCenter = 0.0467999987, t.eyeToScreenDistance = 0.0410000011, t.lensSeparationDistance = 0.063500002, t.interpupillaryDistance = 0.064000003, t.distortionK = [1, 0.219999999, 0.239999995, 0], t.chromaAbCorrection = [0.995999992, -0.00400000019, 1.01400006, 0], t.postProcessScaleFactor = 1.714605507808412, t.lensCenterOffset = 0.151976421, t;
+ }, r;
+ }(), cb = `
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+uniform vec2 LensCenter;
+uniform vec2 Scale;
+uniform vec2 ScaleIn;
+uniform vec4 HmdWarpParam;
+vec2 HmdWarp(vec2 in01) {
+vec2 theta=(in01-LensCenter)*ScaleIn;
+float rSq=theta.x*theta.x+theta.y*theta.y;
+vec2 rvector=theta*(HmdWarpParam.x+HmdWarpParam.y*rSq+HmdWarpParam.z*rSq*rSq+HmdWarpParam.w*rSq*rSq*rSq);
+return LensCenter+Scale*rvector;
+}
+void main(void)
+{
+vec2 tc=HmdWarp(vUV);
+if (tc.x <0.0 || tc.x>1.0 || tc.y<0.0 || tc.y>1.0)
+gl_FragColor=vec4(0.0,0.0,0.0,0.0);
+else{
+gl_FragColor=texture2D(textureSampler,tc);
+}
+}`;
+ We.a.ShadersStore.vrDistortionCorrectionPixelShader = cb;
+ var dl = function(r) {
+ function t(e, n, i, o) {
+ var a = r.call(this, e, "vrDistortionCorrection", ["LensCenter", "Scale", "ScaleIn", "HmdWarpParam"], null, o.postProcessScaleFactor, n, Ue.a.BILINEAR_SAMPLINGMODE) || this;
+ return a._isRightEye = i, a._distortionFactors = o.distortionK, a._postProcessScaleFactor = o.postProcessScaleFactor, a._lensCenterOffset = o.lensCenterOffset, a.adaptScaleToCurrentViewport = !0, a.onSizeChangedObservable.add(function() {
+ a._scaleIn = new c.d(2, 2 / a.aspectRatio), a._scaleFactor = new c.d(1 / a._postProcessScaleFactor * 0.5, 1 / a._postProcessScaleFactor * 0.5 * a.aspectRatio), a._lensCenter = new c.d(a._isRightEye ? 0.5 - 0.5 * a._lensCenterOffset : 0.5 + 0.5 * a._lensCenterOffset, 0.5);
+ }), a.onApplyObservable.add(function(s) {
+ s.setFloat2("LensCenter", a._lensCenter.x, a._lensCenter.y), s.setFloat2("Scale", a._scaleFactor.x, a._scaleFactor.y), s.setFloat2("ScaleIn", a._scaleIn.x, a._scaleIn.y), s.setFloat4("HmdWarpParam", a._distortionFactors[0], a._distortionFactors[1], a._distortionFactors[2], a._distortionFactors[3]);
+ }), a;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "VRDistortionCorrectionPostProcess";
+ }, t;
+ }(_t), lb = `precision mediump sampler2DArray;
+varying vec2 vUV;
+uniform sampler2DArray multiviewSampler;
+uniform int imageIndex;
+void main(void)
+{
+gl_FragColor=texture(multiviewSampler,vec3(vUV,imageIndex));
+}`;
+ We.a.ShadersStore.vrMultiviewToSingleviewPixelShader = lb;
+ var kd = l(85), fl = l(95), ga = l(96);
+ Gt.a.prototype.createRenderTargetCubeTexture = function(r, t) {
+ var e = Object(u.a)({ generateMipMaps: !0, generateDepthBuffer: !0, generateStencilBuffer: !1, type: d.a.TEXTURETYPE_UNSIGNED_INT, samplingMode: d.a.TEXTURE_TRILINEAR_SAMPLINGMODE, format: d.a.TEXTUREFORMAT_RGBA }, t);
+ e.generateStencilBuffer = e.generateDepthBuffer && e.generateStencilBuffer, (e.type !== d.a.TEXTURETYPE_FLOAT || this._caps.textureFloatLinearFiltering) && (e.type !== d.a.TEXTURETYPE_HALF_FLOAT || this._caps.textureHalfFloatLinearFiltering) || (e.samplingMode = d.a.TEXTURE_NEAREST_SAMPLINGMODE);
+ var n = this._gl, i = new Rt.a(this, Rt.b.RenderTarget);
+ this._bindTextureDirectly(n.TEXTURE_CUBE_MAP, i, !0);
+ var o = this._getSamplingParameters(e.samplingMode, e.generateMipMaps);
+ e.type !== d.a.TEXTURETYPE_FLOAT || this._caps.textureFloat || (e.type = d.a.TEXTURETYPE_UNSIGNED_INT, h.a.Warn("Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type")), n.texParameteri(n.TEXTURE_CUBE_MAP, n.TEXTURE_MAG_FILTER, o.mag), n.texParameteri(n.TEXTURE_CUBE_MAP, n.TEXTURE_MIN_FILTER, o.min), n.texParameteri(n.TEXTURE_CUBE_MAP, n.TEXTURE_WRAP_S, n.CLAMP_TO_EDGE), n.texParameteri(n.TEXTURE_CUBE_MAP, n.TEXTURE_WRAP_T, n.CLAMP_TO_EDGE);
+ for (var a = 0; a < 6; a++)
+ n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X + a, 0, this._getRGBABufferInternalSizedFormat(e.type, e.format), r, r, 0, this._getInternalFormat(e.format), this._getWebGLTextureType(e.type), null);
+ var s = n.createFramebuffer();
+ return this._bindUnboundFramebuffer(s), i._depthStencilBuffer = this._setupFramebufferDepthAttachments(e.generateStencilBuffer, e.generateDepthBuffer, r, r), e.generateMipMaps && n.generateMipmap(n.TEXTURE_CUBE_MAP), this._bindTextureDirectly(n.TEXTURE_CUBE_MAP, null), this._bindUnboundFramebuffer(null), i._framebuffer = s, i.width = r, i.height = r, i.isReady = !0, i.isCube = !0, i.samples = 1, i.generateMipMaps = e.generateMipMaps, i.samplingMode = e.samplingMode, i.type = e.type, i.format = e.format, i._generateDepthBuffer = e.generateDepthBuffer, i._generateStencilBuffer = e.generateStencilBuffer, this._internalTexturesCache.push(i), i;
+ };
+ var bn = function(r) {
+ function t(e, n, i, o, a, s, p, m, S, O, I, G, k) {
+ a === void 0 && (a = !0), s === void 0 && (s = d.a.TEXTURETYPE_UNSIGNED_INT), p === void 0 && (p = !1), m === void 0 && (m = Ue.a.TRILINEAR_SAMPLINGMODE), S === void 0 && (S = !0), O === void 0 && (O = !1), I === void 0 && (I = !1), G === void 0 && (G = d.a.TEXTUREFORMAT_RGBA), k === void 0 && (k = !1);
+ var K = r.call(this, null, i, !o) || this;
+ return K.renderParticles = !0, K.renderSprites = !1, K.ignoreCameraViewport = !1, K.onBeforeBindObservable = new P.c(), K.onAfterUnbindObservable = new P.c(), K.onBeforeRenderObservable = new P.c(), K.onAfterRenderObservable = new P.c(), K.onClearObservable = new P.c(), K.onResizeObservable = new P.c(), K._currentRefreshId = -1, K._refreshRate = 1, K._samples = 1, K.boundingBoxPosition = c.e.Zero(), (i = K.getScene()) && (K._coordinatesMode = Ue.a.PROJECTION_MODE, K.renderList = new Array(), K.name = e, K.isRenderTarget = !0, K._initialSizeParameter = n, K._processSizeParameter(n), K._resizeObserver = K.getScene().getEngine().onResizeObservable.add(function() {
+ }), K._generateMipMaps = !!o, K._doNotChangeAspectRatio = a, K._renderingManager = new ga.b(i), K._renderingManager._useSceneAutoClearSetup = !0, I || (K._renderTargetOptions = { generateMipMaps: o, type: s, format: G, samplingMode: m, generateDepthBuffer: S, generateStencilBuffer: O }, m === Ue.a.NEAREST_SAMPLINGMODE && (K.wrapU = Ue.a.CLAMP_ADDRESSMODE, K.wrapV = Ue.a.CLAMP_ADDRESSMODE), k || (p ? (K._texture = i.getEngine().createRenderTargetCubeTexture(K.getRenderSize(), K._renderTargetOptions), K.coordinatesMode = Ue.a.INVCUBIC_MODE, K._textureMatrix = c.a.Identity()) : K._texture = i.getEngine().createRenderTargetTexture(K._size, K._renderTargetOptions)))), K;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "renderList", { get: function() {
+ return this._renderList;
+ }, set: function(e) {
+ this._renderList = e, this._renderList && this._hookArray(this._renderList);
+ }, enumerable: !1, configurable: !0 }), t.prototype._hookArray = function(e) {
+ var n = this, i = e.push;
+ e.push = function() {
+ for (var a = [], s = 0; s < arguments.length; s++)
+ a[s] = arguments[s];
+ var p = e.length === 0, m = i.apply(e, a);
+ return p && n.getScene() && n.getScene().meshes.forEach(function(S) {
+ S._markSubMeshesAsLightDirty();
+ }), m;
+ };
+ var o = e.splice;
+ e.splice = function(a, s) {
+ var p = o.apply(e, [a, s]);
+ return e.length === 0 && n.getScene().meshes.forEach(function(m) {
+ m._markSubMeshesAsLightDirty();
+ }), p;
+ };
+ }, Object.defineProperty(t.prototype, "onAfterUnbind", { set: function(e) {
+ this._onAfterUnbindObserver && this.onAfterUnbindObservable.remove(this._onAfterUnbindObserver), this._onAfterUnbindObserver = this.onAfterUnbindObservable.add(e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "onBeforeRender", { set: function(e) {
+ this._onBeforeRenderObserver && this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver), this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "onAfterRender", { set: function(e) {
+ this._onAfterRenderObserver && this.onAfterRenderObservable.remove(this._onAfterRenderObserver), this._onAfterRenderObserver = this.onAfterRenderObservable.add(e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "onClear", { set: function(e) {
+ this._onClearObserver && this.onClearObservable.remove(this._onClearObserver), this._onClearObserver = this.onClearObservable.add(e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "renderTargetOptions", { get: function() {
+ return this._renderTargetOptions;
+ }, enumerable: !1, configurable: !0 }), t.prototype._onRatioRescale = function() {
+ this._sizeRatio && this.resize(this._initialSizeParameter);
+ }, Object.defineProperty(t.prototype, "boundingBoxSize", { get: function() {
+ return this._boundingBoxSize;
+ }, set: function(e) {
+ if (!this._boundingBoxSize || !this._boundingBoxSize.equals(e)) {
+ this._boundingBoxSize = e;
+ var n = this.getScene();
+ n && n.markAllMaterialsAsDirty(d.a.MATERIAL_TextureDirtyFlag);
+ }
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "depthStencilTexture", { get: function() {
+ var e;
+ return ((e = this.getInternalTexture()) === null || e === void 0 ? void 0 : e._depthStencilTexture) || null;
+ }, enumerable: !1, configurable: !0 }), t.prototype.createDepthStencilTexture = function(e, n, i) {
+ e === void 0 && (e = 0), n === void 0 && (n = !0), i === void 0 && (i = !1);
+ var o = this.getInternalTexture();
+ if (this.getScene() && o) {
+ var a = this.getScene().getEngine();
+ o._depthStencilTexture = a.createDepthStencilTexture(this._size, { bilinearFiltering: n, comparisonFunction: e, generateStencil: i, isCube: this.isCube });
+ }
+ }, t.prototype._processSizeParameter = function(e) {
+ if (e.ratio) {
+ this._sizeRatio = e.ratio;
+ var n = this._getEngine();
+ this._size = { width: this._bestReflectionRenderTargetDimension(n.getRenderWidth(), this._sizeRatio), height: this._bestReflectionRenderTargetDimension(n.getRenderHeight(), this._sizeRatio) };
+ } else
+ this._size = e;
+ }, Object.defineProperty(t.prototype, "samples", { get: function() {
+ return this._samples;
+ }, set: function(e) {
+ if (this._samples !== e) {
+ var n = this.getScene();
+ n && (this._samples = n.getEngine().updateRenderTargetTextureSampleCount(this._texture, e));
+ }
+ }, enumerable: !1, configurable: !0 }), t.prototype.resetRefreshCounter = function() {
+ this._currentRefreshId = -1;
+ }, Object.defineProperty(t.prototype, "refreshRate", { get: function() {
+ return this._refreshRate;
+ }, set: function(e) {
+ this._refreshRate = e, this.resetRefreshCounter();
+ }, enumerable: !1, configurable: !0 }), t.prototype.addPostProcess = function(e) {
+ if (!this._postProcessManager) {
+ var n = this.getScene();
+ if (!n)
+ return;
+ this._postProcessManager = new fl.a(n), this._postProcesses = new Array();
+ }
+ this._postProcesses.push(e), this._postProcesses[0].autoClear = !1;
+ }, t.prototype.clearPostProcesses = function(e) {
+ if (e === void 0 && (e = !1), this._postProcesses) {
+ if (e)
+ for (var n = 0, i = this._postProcesses; n < i.length; n++)
+ i[n].dispose();
+ this._postProcesses = [];
+ }
+ }, t.prototype.removePostProcess = function(e) {
+ if (this._postProcesses) {
+ var n = this._postProcesses.indexOf(e);
+ n !== -1 && (this._postProcesses.splice(n, 1), this._postProcesses.length > 0 && (this._postProcesses[0].autoClear = !1));
+ }
+ }, t.prototype._shouldRender = function() {
+ return this._currentRefreshId === -1 || this.refreshRate === this._currentRefreshId ? (this._currentRefreshId = 1, !0) : (this._currentRefreshId++, !1);
+ }, t.prototype.getRenderSize = function() {
+ return this.getRenderWidth();
+ }, t.prototype.getRenderWidth = function() {
+ return this._size.width ? this._size.width : this._size;
+ }, t.prototype.getRenderHeight = function() {
+ return this._size.width ? this._size.height : this._size;
+ }, t.prototype.getRenderLayers = function() {
+ var e = this._size.layers;
+ return e || 0;
+ }, Object.defineProperty(t.prototype, "canRescale", { get: function() {
+ return !0;
+ }, enumerable: !1, configurable: !0 }), t.prototype.scale = function(e) {
+ var n = Math.max(1, this.getRenderSize() * e);
+ this.resize(n);
+ }, t.prototype.getReflectionTextureMatrix = function() {
+ return this.isCube ? this._textureMatrix : r.prototype.getReflectionTextureMatrix.call(this);
+ }, t.prototype.resize = function(e) {
+ var n = this.isCube;
+ this.releaseInternalTexture();
+ var i = this.getScene();
+ i && (this._processSizeParameter(e), this._texture = n ? i.getEngine().createRenderTargetCubeTexture(this.getRenderSize(), this._renderTargetOptions) : i.getEngine().createRenderTargetTexture(this._size, this._renderTargetOptions), this.onResizeObservable.hasObservers() && this.onResizeObservable.notifyObservers(this));
+ }, t.prototype.render = function(e, n) {
+ if (e === void 0 && (e = !1), n === void 0 && (n = !1), m = this.getScene()) {
+ var i, o = m.getEngine();
+ if (this.useCameraPostProcesses !== void 0 && (e = this.useCameraPostProcesses), this._waitingRenderList) {
+ this.renderList = [];
+ for (var a = 0; a < this._waitingRenderList.length; a++) {
+ var s = this._waitingRenderList[a], p = m.getMeshByID(s);
+ p && this.renderList.push(p);
+ }
+ this._waitingRenderList = void 0;
+ }
+ if (this.renderListPredicate) {
+ var m;
+ if (this.renderList ? this.renderList.length = 0 : this.renderList = [], !(m = this.getScene()))
+ return;
+ var S = m.meshes;
+ for (a = 0; a < S.length; a++) {
+ var O = S[a];
+ this.renderListPredicate(O) && this.renderList.push(O);
+ }
+ }
+ if (this.onBeforeBindObservable.notifyObservers(this), this.activeCamera ? (i = this.activeCamera, o.setViewport(this.activeCamera.viewport, this.getRenderWidth(), this.getRenderHeight()), this.activeCamera !== m.activeCamera && m.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix(!0))) : (i = m.activeCamera) && o.setViewport(i.viewport, this.getRenderWidth(), this.getRenderHeight()), this._defaultRenderListPrepared = !1, this.is2DArray)
+ for (var I = 0; I < this.getRenderLayers(); I++)
+ this.renderToTarget(0, e, n, I, i), m.incrementRenderId(), m.resetCachedMaterial();
+ else if (this.isCube)
+ for (var G = 0; G < 6; G++)
+ this.renderToTarget(G, e, n, void 0, i), m.incrementRenderId(), m.resetCachedMaterial();
+ else
+ this.renderToTarget(0, e, n, void 0, i);
+ this.onAfterUnbindObservable.notifyObservers(this), m.activeCamera && ((m.getEngine().scenes.length > 1 || this.activeCamera && this.activeCamera !== m.activeCamera) && m.setTransformMatrix(m.activeCamera.getViewMatrix(), m.activeCamera.getProjectionMatrix(!0)), o.setViewport(m.activeCamera.viewport)), m.resetCachedMaterial();
+ }
+ }, t.prototype._bestReflectionRenderTargetDimension = function(e, n) {
+ var i = e * n, o = ke.a.NearestPOT(i + 16384 / (128 + i));
+ return Math.min(ke.a.FloorPOT(e), o);
+ }, t.prototype._prepareRenderingManager = function(e, n, i, o) {
+ var a = this.getScene();
+ if (a) {
+ this._renderingManager.reset();
+ for (var s = a.getRenderId(), p = 0; p < n; p++) {
+ var m = e[p];
+ if (m && !m.isBlocked) {
+ if (this.customIsReadyFunction) {
+ if (!this.customIsReadyFunction(m, this.refreshRate)) {
+ this.resetRefreshCounter();
+ continue;
+ }
+ } else if (!m.isReady(this.refreshRate === 0)) {
+ this.resetRefreshCounter();
+ continue;
+ }
+ if (!m._internalAbstractMeshDataInfo._currentLODIsUpToDate && a.activeCamera && (m._internalAbstractMeshDataInfo._currentLOD = a.customLODSelector ? a.customLODSelector(m, a.activeCamera) : m.getLOD(a.activeCamera), m._internalAbstractMeshDataInfo._currentLODIsUpToDate = !0), !m._internalAbstractMeshDataInfo._currentLOD)
+ continue;
+ var S = m._internalAbstractMeshDataInfo._currentLOD;
+ S._preActivateForIntermediateRendering(s);
+ var O = void 0;
+ if (O = !(!o || !i) && (m.layerMask & i.layerMask) == 0, m.isEnabled() && m.isVisible && m.subMeshes && !O && (S !== m && S._activate(s, !0), m._activate(s, !0) && m.subMeshes.length)) {
+ m.isAnInstance ? m._internalAbstractMeshDataInfo._actAsRegularMesh && (S = m) : S._internalAbstractMeshDataInfo._onlyForInstancesIntermediate = !1, S._internalAbstractMeshDataInfo._isActiveIntermediate = !0;
+ for (var I = 0; I < S.subMeshes.length; I++) {
+ var G = S.subMeshes[I];
+ this._renderingManager.dispatch(G, S);
+ }
+ }
+ }
+ }
+ for (var k = 0; k < a.particleSystems.length; k++) {
+ var K = a.particleSystems[k], re = K.emitter;
+ K.isStarted() && re && re.position && re.isEnabled() && e.indexOf(re) >= 0 && this._renderingManager.dispatchParticles(K);
+ }
+ }
+ }, t.prototype._bindFrameBuffer = function(e, n) {
+ e === void 0 && (e = 0), n === void 0 && (n = 0);
+ var i = this.getScene();
+ if (i) {
+ var o = i.getEngine();
+ this._texture && o.bindFramebuffer(this._texture, this.isCube ? e : void 0, void 0, void 0, this.ignoreCameraViewport, 0, n);
+ }
+ }, t.prototype.unbindFrameBuffer = function(e, n) {
+ var i = this;
+ this._texture && e.unBindFramebuffer(this._texture, this.isCube, function() {
+ i.onAfterRenderObservable.notifyObservers(n);
+ });
+ }, t.prototype.renderToTarget = function(e, n, i, o, a) {
+ o === void 0 && (o = 0), a === void 0 && (a = null);
+ var s = this.getScene();
+ if (s) {
+ var p = s.getEngine();
+ if (this._texture) {
+ this._postProcessManager ? this._postProcessManager._prepareFrame(this._texture, this._postProcesses) : n && s.postProcessManager._prepareFrame(this._texture) || this._bindFrameBuffer(e, o), this.is2DArray ? this.onBeforeRenderObservable.notifyObservers(o) : this.onBeforeRenderObservable.notifyObservers(e);
+ var m = null, S = this.renderList ? this.renderList : s.getActiveMeshes().data, O = this.renderList ? this.renderList.length : s.getActiveMeshes().length;
+ this.getCustomRenderList && (m = this.getCustomRenderList(this.is2DArray ? o : e, S, O)), m ? this._prepareRenderingManager(m, m.length, a, !1) : (this._defaultRenderListPrepared || (this._prepareRenderingManager(S, O, a, !this.renderList), this._defaultRenderListPrepared = !0), m = S), this.onClearObservable.hasObservers() ? this.onClearObservable.notifyObservers(p) : p.clear(this.clearColor || s.clearColor, !0, !0, !0), this._doNotChangeAspectRatio || s.updateTransformMatrix(!0);
+ for (var I = 0, G = s._beforeRenderTargetDrawStage; I < G.length; I++)
+ G[I].action(this);
+ this._renderingManager.render(this.customRenderFunction, m, this.renderParticles, this.renderSprites);
+ for (var k = 0, K = s._afterRenderTargetDrawStage; k < K.length; k++)
+ K[k].action(this);
+ this._postProcessManager ? this._postProcessManager._finalizeFrame(!1, this._texture, e, this._postProcesses, this.ignoreCameraViewport) : n && s.postProcessManager._finalizeFrame(!1, this._texture, e), this._doNotChangeAspectRatio || s.updateTransformMatrix(!0), i && Ke.b.DumpFramebuffer(this.getRenderWidth(), this.getRenderHeight(), p), this.isCube && e !== 5 ? this.onAfterRenderObservable.notifyObservers(e) : (this.isCube && e === 5 && p.generateMipMapsForCubemap(this._texture), this.unbindFrameBuffer(p, e));
+ }
+ }
+ }, t.prototype.setRenderingOrder = function(e, n, i, o) {
+ n === void 0 && (n = null), i === void 0 && (i = null), o === void 0 && (o = null), this._renderingManager.setRenderingOrder(e, n, i, o);
+ }, t.prototype.setRenderingAutoClearDepthStencil = function(e, n) {
+ this._renderingManager.setRenderingAutoClearDepthStencil(e, n), this._renderingManager._useSceneAutoClearSetup = !1;
+ }, t.prototype.clone = function() {
+ var e = this.getSize(), n = new t(this.name, e, this.getScene(), this._renderTargetOptions.generateMipMaps, this._doNotChangeAspectRatio, this._renderTargetOptions.type, this.isCube, this._renderTargetOptions.samplingMode, this._renderTargetOptions.generateDepthBuffer, this._renderTargetOptions.generateStencilBuffer);
+ return n.hasAlpha = this.hasAlpha, n.level = this.level, n.coordinatesMode = this.coordinatesMode, this.renderList && (n.renderList = this.renderList.slice(0)), n;
+ }, t.prototype.serialize = function() {
+ if (!this.name)
+ return null;
+ var e = r.prototype.serialize.call(this);
+ if (e.renderTargetSize = this.getRenderSize(), e.renderList = [], this.renderList)
+ for (var n = 0; n < this.renderList.length; n++)
+ e.renderList.push(this.renderList[n].id);
+ return e;
+ }, t.prototype.disposeFramebufferObjects = function() {
+ var e = this.getInternalTexture(), n = this.getScene();
+ e && n && n.getEngine()._releaseFramebufferObjects(e);
+ }, t.prototype.dispose = function() {
+ this.onResizeObservable.clear(), this.onClearObservable.clear(), this.onAfterRenderObservable.clear(), this.onAfterUnbindObservable.clear(), this.onBeforeBindObservable.clear(), this.onBeforeRenderObservable.clear(), this._postProcessManager && (this._postProcessManager.dispose(), this._postProcessManager = null), this.clearPostProcesses(!0), this._resizeObserver && (this.getScene().getEngine().onResizeObservable.remove(this._resizeObserver), this._resizeObserver = null), this.renderList = null;
+ var e = this.getScene();
+ if (e) {
+ var n = e.customRenderTargets.indexOf(this);
+ n >= 0 && e.customRenderTargets.splice(n, 1);
+ for (var i = 0, o = e.cameras; i < o.length; i++) {
+ var a = o[i];
+ (n = a.customRenderTargets.indexOf(this)) >= 0 && a.customRenderTargets.splice(n, 1);
+ }
+ this.depthStencilTexture && this.getScene().getEngine()._releaseTexture(this.depthStencilTexture), r.prototype.dispose.call(this);
+ }
+ }, t.prototype._rebuild = function() {
+ this.refreshRate === t.REFRESHRATE_RENDER_ONCE && (this.refreshRate = t.REFRESHRATE_RENDER_ONCE), this._postProcessManager && this._postProcessManager._rebuild();
+ }, t.prototype.freeRenderingGroups = function() {
+ this._renderingManager && this._renderingManager.freeRenderingGroups();
+ }, t.prototype.getViewCount = function() {
+ return 1;
+ }, t.REFRESHRATE_RENDER_ONCE = 0, t.REFRESHRATE_RENDER_ONEVERYFRAME = 1, t.REFRESHRATE_RENDER_ONEVERYTWOFRAMES = 2, t;
+ }(Ue.a);
+ Ue.a._CreateRenderTargetTexture = function(r, t, e, n) {
+ return new bn(r, t, e, n);
+ };
+ var Gd = function(r) {
+ function t(e, n) {
+ n === void 0 && (n = 512);
+ var i = r.call(this, "multiview rtt", n, e, !1, !0, Rt.b.Unknown, !1, void 0, !1, !1, !0, void 0, !0) || this, o = e.getEngine().createMultiviewRenderTargetTexture(i.getRenderWidth(), i.getRenderHeight());
+ return o.isMultiview = !0, o.format = d.a.TEXTUREFORMAT_RGBA, i._texture = o, i.samples = i._getEngine().getCaps().maxSamples || i.samples, i;
+ }
+ return Object(u.d)(t, r), t.prototype._bindFrameBuffer = function(e) {
+ this._texture && this.getScene().getEngine().bindMultiviewFramebuffer(this._texture);
+ }, t.prototype.getViewCount = function() {
+ return 2;
+ }, t;
+ }(bn), zd = l(90);
+ ke.a.prototype.createMultiviewRenderTargetTexture = function(r, t) {
+ var e = this._gl;
+ if (!this.getCaps().multiview)
+ throw "Multiview is not supported";
+ var n = new Rt.a(this, Rt.b.Unknown, !0);
+ return n.width = r, n.height = t, n._framebuffer = e.createFramebuffer(), n._colorTextureArray = e.createTexture(), e.bindTexture(e.TEXTURE_2D_ARRAY, n._colorTextureArray), e.texStorage3D(e.TEXTURE_2D_ARRAY, 1, e.RGBA8, r, t, 2), n._depthStencilTextureArray = e.createTexture(), e.bindTexture(e.TEXTURE_2D_ARRAY, n._depthStencilTextureArray), e.texStorage3D(e.TEXTURE_2D_ARRAY, 1, e.DEPTH32F_STENCIL8, r, t, 2), n.isReady = !0, n;
+ }, ke.a.prototype.bindMultiviewFramebuffer = function(r) {
+ var t = this._gl, e = this.getCaps().oculusMultiview || this.getCaps().multiview;
+ if (this.bindFramebuffer(r, void 0, void 0, void 0, !0), t.bindFramebuffer(t.DRAW_FRAMEBUFFER, r._framebuffer), !r._colorTextureArray || !r._depthStencilTextureArray)
+ throw "Invalid multiview frame buffer";
+ this.getCaps().oculusMultiview ? (e.framebufferTextureMultisampleMultiviewOVR(t.DRAW_FRAMEBUFFER, t.COLOR_ATTACHMENT0, r._colorTextureArray, 0, r.samples, 0, 2), e.framebufferTextureMultisampleMultiviewOVR(t.DRAW_FRAMEBUFFER, t.DEPTH_STENCIL_ATTACHMENT, r._depthStencilTextureArray, 0, r.samples, 0, 2)) : (e.framebufferTextureMultiviewOVR(t.DRAW_FRAMEBUFFER, t.COLOR_ATTACHMENT0, r._colorTextureArray, 0, 0, 2), e.framebufferTextureMultiviewOVR(t.DRAW_FRAMEBUFFER, t.DEPTH_STENCIL_ATTACHMENT, r._depthStencilTextureArray, 0, 0, 2));
+ }, gt.a.prototype._useMultiviewToSingleView = !1, gt.a.prototype._multiviewTexture = null, gt.a.prototype._resizeOrCreateMultiviewTexture = function(r, t) {
+ this._multiviewTexture ? this._multiviewTexture.getRenderWidth() == r && this._multiviewTexture.getRenderHeight() == t || (this._multiviewTexture.dispose(), this._multiviewTexture = new Gd(this.getScene(), { width: r, height: t })) : this._multiviewTexture = new Gd(this.getScene(), { width: r, height: t });
+ }, ge.a.prototype._transformMatrixR = c.a.Zero(), ge.a.prototype._multiviewSceneUbo = null, ge.a.prototype._createMultiviewUbo = function() {
+ this._multiviewSceneUbo = new kd.a(this.getEngine(), void 0, !0), this._multiviewSceneUbo.addUniform("viewProjection", 16), this._multiviewSceneUbo.addUniform("viewProjectionR", 16), this._multiviewSceneUbo.addUniform("view", 16);
+ }, ge.a.prototype._updateMultiviewUbo = function(r, t) {
+ r && t && r.multiplyToRef(t, this._transformMatrixR), r && t && (r.multiplyToRef(t, c.c.Matrix[0]), zd.a.GetRightPlaneToRef(c.c.Matrix[0], this._frustumPlanes[3])), this._multiviewSceneUbo && (this._multiviewSceneUbo.updateMatrix("viewProjection", this.getTransformMatrix()), this._multiviewSceneUbo.updateMatrix("viewProjectionR", this._transformMatrixR), this._multiviewSceneUbo.updateMatrix("view", this._viewMatrix), this._multiviewSceneUbo.update());
+ }, ge.a.prototype._renderMultiviewToSingleView = function(r) {
+ r._resizeOrCreateMultiviewTexture(r._rigPostProcess && r._rigPostProcess && r._rigPostProcess.width > 0 ? r._rigPostProcess.width : this.getEngine().getRenderWidth(!0), r._rigPostProcess && r._rigPostProcess && r._rigPostProcess.height > 0 ? r._rigPostProcess.height : this.getEngine().getRenderHeight(!0)), this._multiviewSceneUbo || this._createMultiviewUbo(), r.outputRenderTarget = r._multiviewTexture, this._renderForCamera(r), r.outputRenderTarget = null;
+ for (var t = 0; t < r._rigCameras.length; t++) {
+ var e = this.getEngine();
+ this._activeCamera = r._rigCameras[t], e.setViewport(this._activeCamera.viewport), this.postProcessManager && (this.postProcessManager._prepareFrame(), this.postProcessManager._finalizeFrame(this._activeCamera.isIntermediate));
+ }
+ };
+ var pl = function(r) {
+ function t(e, n, i) {
+ var o = r.call(this, e, "vrMultiviewToSingleview", ["imageIndex"], ["multiviewSampler"], i, n, Ue.a.BILINEAR_SAMPLINGMODE) || this;
+ return o.onSizeChangedObservable.add(function() {
+ }), o.onApplyObservable.add(function(a) {
+ n._scene.activeCamera && n._scene.activeCamera.isLeftCamera ? a.setInt("imageIndex", 0) : a.setInt("imageIndex", 1), a.setTexture("multiviewSampler", n._multiviewTexture);
+ }), o;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "VRMultiviewToSingleviewPostProcess";
+ }, t;
+ }(_t);
+ gt.a._setVRRigMode = function(r, t) {
+ var e = t.vrCameraMetrics || vo.GetDefault();
+ r._rigCameras[0]._cameraRigParams.vrMetrics = e, r._rigCameras[0].viewport = new li.a(0, 0, 0.5, 1), r._rigCameras[0]._cameraRigParams.vrWorkMatrix = new c.a(), r._rigCameras[0]._cameraRigParams.vrHMatrix = e.leftHMatrix, r._rigCameras[0]._cameraRigParams.vrPreViewMatrix = e.leftPreViewMatrix, r._rigCameras[0].getProjectionMatrix = r._rigCameras[0]._getVRProjectionMatrix, r._rigCameras[1]._cameraRigParams.vrMetrics = e, r._rigCameras[1].viewport = new li.a(0.5, 0, 0.5, 1), r._rigCameras[1]._cameraRigParams.vrWorkMatrix = new c.a(), r._rigCameras[1]._cameraRigParams.vrHMatrix = e.rightHMatrix, r._rigCameras[1]._cameraRigParams.vrPreViewMatrix = e.rightPreViewMatrix, r._rigCameras[1].getProjectionMatrix = r._rigCameras[1]._getVRProjectionMatrix, e.multiviewEnabled && (r.getScene().getEngine().getCaps().multiview ? (r._useMultiviewToSingleView = !0, r._rigPostProcess = new pl("VRMultiviewToSingleview", r, e.postProcessScaleFactor)) : (h.a.Warn("Multiview is not supported, falling back to standard rendering"), e.multiviewEnabled = !1)), e.compensateDistortion && (r._rigCameras[0]._rigPostProcess = new dl("VR_Distort_Compensation_Left", r._rigCameras[0], !1, e), r._rigCameras[1]._rigPostProcess = new dl("VR_Distort_Compensation_Right", r._rigCameras[1], !0, e));
+ }, q.a.AddNodeConstructor("VRDeviceOrientationFreeCamera", function(r, t) {
+ return function() {
+ return new jd(r, 0, 0, 1, c.e.Zero(), t);
+ };
+ });
+ var jd = function(r) {
+ function t(e, n, i, o, a, s, p, m) {
+ p === void 0 && (p = !0), m === void 0 && (m = vo.GetDefault());
+ var S = r.call(this, e, n, i, o, a, s) || this;
+ return m.compensateDistortion = p, S.setCameraRigMode(gt.a.RIG_MODE_VR, { vrCameraMetrics: m }), S.inputs.addVRDeviceOrientation(), S;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "VRDeviceOrientationArcRotateCamera";
+ }, t;
+ }(Gr);
+ q.a.AddNodeConstructor("VRDeviceOrientationFreeCamera", function(r, t) {
+ return function() {
+ return new gs(r, c.e.Zero(), t);
+ };
+ });
+ var gs = function(r) {
+ function t(e, n, i, o, a) {
+ o === void 0 && (o = !0), a === void 0 && (a = vo.GetDefault());
+ var s = r.call(this, e, n, i) || this;
+ return a.compensateDistortion = o, s.setCameraRigMode(gt.a.RIG_MODE_VR, { vrCameraMetrics: a }), s;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "VRDeviceOrientationFreeCamera";
+ }, t;
+ }(_s);
+ q.a.AddNodeConstructor("VRDeviceOrientationGamepadCamera", function(r, t) {
+ return function() {
+ return new Hd(r, c.e.Zero(), t);
+ };
+ });
+ var Hd = function(r) {
+ function t(e, n, i, o, a) {
+ o === void 0 && (o = !0), a === void 0 && (a = vo.GetDefault());
+ var s = r.call(this, e, n, i, o, a) || this;
+ return s.inputs.addGamepad(), s;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "VRDeviceOrientationGamepadCamera";
+ }, t;
+ }(gs), vs = l(86);
+ gt.a._setWebVRRigMode = function(r, t) {
+ if (t.vrDisplay) {
+ var e = t.vrDisplay.getEyeParameters("left"), n = t.vrDisplay.getEyeParameters("right");
+ r._rigCameras[0].viewport = new li.a(0, 0, 0.5, 1), r._rigCameras[0].setCameraRigParameter("left", !0), r._rigCameras[0].setCameraRigParameter("specs", t.specs), r._rigCameras[0].setCameraRigParameter("eyeParameters", e), r._rigCameras[0].setCameraRigParameter("frameData", t.frameData), r._rigCameras[0].setCameraRigParameter("parentCamera", t.parentCamera), r._rigCameras[0]._cameraRigParams.vrWorkMatrix = new c.a(), r._rigCameras[0].getProjectionMatrix = r._getWebVRProjectionMatrix, r._rigCameras[0].parent = r, r._rigCameras[0]._getViewMatrix = r._getWebVRViewMatrix, r._rigCameras[1].viewport = new li.a(0.5, 0, 0.5, 1), r._rigCameras[1].setCameraRigParameter("eyeParameters", n), r._rigCameras[1].setCameraRigParameter("specs", t.specs), r._rigCameras[1].setCameraRigParameter("frameData", t.frameData), r._rigCameras[1].setCameraRigParameter("parentCamera", t.parentCamera), r._rigCameras[1]._cameraRigParams.vrWorkMatrix = new c.a(), r._rigCameras[1].getProjectionMatrix = r._getWebVRProjectionMatrix, r._rigCameras[1].parent = r, r._rigCameras[1]._getViewMatrix = r._getWebVRViewMatrix;
+ }
+ }, Object.defineProperty(ke.a.prototype, "isInVRExclusivePointerMode", { get: function() {
+ return this._vrExclusivePointerMode;
+ }, enumerable: !0, configurable: !0 }), ke.a.prototype._prepareVRComponent = function() {
+ this._vrSupported = !1, this._vrExclusivePointerMode = !1, this.onVRDisplayChangedObservable = new P.c(), this.onVRRequestPresentComplete = new P.c(), this.onVRRequestPresentStart = new P.c();
+ }, ke.a.prototype.isVRDevicePresent = function() {
+ return !!this._vrDisplay;
+ }, ke.a.prototype.getVRDevice = function() {
+ return this._vrDisplay;
+ }, ke.a.prototype.initWebVR = function() {
+ return this.initWebVRAsync(), this.onVRDisplayChangedObservable;
+ }, ke.a.prototype.initWebVRAsync = function() {
+ var r = this, t = function() {
+ var n = { vrDisplay: r._vrDisplay, vrSupported: r._vrSupported };
+ r.onVRDisplayChangedObservable.notifyObservers(n), r._webVRInitPromise = new Promise(function(i) {
+ i(n);
+ });
+ };
+ if (!this._onVrDisplayConnect) {
+ this._onVrDisplayConnect = function(n) {
+ r._vrDisplay = n.display, t();
+ }, this._onVrDisplayDisconnect = function() {
+ r._vrDisplay.cancelAnimationFrame(r._frameHandler), r._vrDisplay = void 0, r._frameHandler = ke.a.QueueNewFrame(r._boundRenderFunction), t();
+ }, this._onVrDisplayPresentChange = function() {
+ r._vrExclusivePointerMode = r._vrDisplay && r._vrDisplay.isPresenting;
+ };
+ var e = this.getHostWindow();
+ e && (e.addEventListener("vrdisplayconnect", this._onVrDisplayConnect), e.addEventListener("vrdisplaydisconnect", this._onVrDisplayDisconnect), e.addEventListener("vrdisplaypresentchange", this._onVrDisplayPresentChange));
+ }
+ return this._webVRInitPromise = this._webVRInitPromise || this._getVRDisplaysAsync(), this._webVRInitPromise.then(t), this._webVRInitPromise;
+ }, ke.a.prototype._getVRDisplaysAsync = function() {
+ var r = this;
+ return new Promise(function(t) {
+ navigator.getVRDisplays ? navigator.getVRDisplays().then(function(e) {
+ r._vrSupported = !0, r._vrDisplay = e[0], t({ vrDisplay: r._vrDisplay, vrSupported: r._vrSupported });
+ }) : (r._vrDisplay = void 0, r._vrSupported = !1, t({ vrDisplay: r._vrDisplay, vrSupported: r._vrSupported }));
+ });
+ }, ke.a.prototype.enableVR = function(r) {
+ var t = this;
+ if (this._vrDisplay && !this._vrDisplay.isPresenting) {
+ this.onVRRequestPresentStart.notifyObservers(this);
+ var e = { highRefreshRate: !!this.vrPresentationAttributes && this.vrPresentationAttributes.highRefreshRate, foveationLevel: this.vrPresentationAttributes ? this.vrPresentationAttributes.foveationLevel : 1, multiview: (this.getCaps().multiview || this.getCaps().oculusMultiview) && r.useMultiview };
+ this._vrDisplay.requestPresent([Object(u.a)({ source: this.getRenderingCanvas(), attributes: e }, e)]).then(function() {
+ t.onVRRequestPresentComplete.notifyObservers(!0), t._onVRFullScreenTriggered();
+ }).catch(function() {
+ t.onVRRequestPresentComplete.notifyObservers(!1);
+ });
+ }
+ }, ke.a.prototype._onVRFullScreenTriggered = function() {
+ if (this._vrDisplay && this._vrDisplay.isPresenting) {
+ this._oldSize = new le.a(this.getRenderWidth(), this.getRenderHeight()), this._oldHardwareScaleFactor = this.getHardwareScalingLevel();
+ var r = this._vrDisplay.getEyeParameters("left");
+ this.setHardwareScalingLevel(1), this.setSize(2 * r.renderWidth, r.renderHeight);
+ } else
+ this.setHardwareScalingLevel(this._oldHardwareScaleFactor), this.setSize(this._oldSize.width, this._oldSize.height);
+ }, ke.a.prototype.disableVR = function() {
+ var r = this;
+ this._vrDisplay && this._vrDisplay.isPresenting && this._vrDisplay.exitPresent().then(function() {
+ return r._onVRFullScreenTriggered();
+ }).catch(function() {
+ return r._onVRFullScreenTriggered();
+ }), ul.a.IsWindowObjectExist() && (window.removeEventListener("vrdisplaypointerrestricted", this._onVRDisplayPointerRestricted), window.removeEventListener("vrdisplaypointerunrestricted", this._onVRDisplayPointerUnrestricted), this._onVrDisplayConnect && (window.removeEventListener("vrdisplayconnect", this._onVrDisplayConnect), this._onVrDisplayDisconnect && window.removeEventListener("vrdisplaydisconnect", this._onVrDisplayDisconnect), this._onVrDisplayPresentChange && window.removeEventListener("vrdisplaypresentchange", this._onVrDisplayPresentChange), this._onVrDisplayConnect = null, this._onVrDisplayDisconnect = null));
+ }, ke.a.prototype._connectVREvents = function(r, t) {
+ var e = this;
+ if (this._onVRDisplayPointerRestricted = function() {
+ r && r.requestPointerLock();
+ }, this._onVRDisplayPointerUnrestricted = function() {
+ if (t)
+ t.exitPointerLock && t.exitPointerLock();
+ else {
+ var i = e.getHostWindow();
+ i.document && i.document.exitPointerLock && i.document.exitPointerLock();
+ }
+ }, ul.a.IsWindowObjectExist()) {
+ var n = this.getHostWindow();
+ n.addEventListener("vrdisplaypointerrestricted", this._onVRDisplayPointerRestricted, !1), n.addEventListener("vrdisplaypointerunrestricted", this._onVRDisplayPointerUnrestricted, !1);
+ }
+ }, ke.a.prototype._submitVRFrame = function() {
+ if (this._vrDisplay && this._vrDisplay.isPresenting)
+ try {
+ this._vrDisplay.submitFrame();
+ } catch (r) {
+ Ke.b.Warn("webVR submitFrame has had an unexpected failure: " + r);
+ }
+ }, ke.a.prototype.isVRPresenting = function() {
+ return this._vrDisplay && this._vrDisplay.isPresenting;
+ }, ke.a.prototype._requestVRFrame = function() {
+ this._frameHandler = ke.a.QueueNewFrame(this._boundRenderFunction, this._vrDisplay);
+ }, q.a.AddNodeConstructor("WebVRFreeCamera", function(r, t) {
+ return function() {
+ return new bs(r, c.e.Zero(), t);
+ };
+ }), q.a.AddNodeConstructor("WebVRGamepadCamera", function(r, t) {
+ return function() {
+ return new bs(r, c.e.Zero(), t);
+ };
+ });
+ var bs = function(r) {
+ function t(e, n, i, o) {
+ o === void 0 && (o = {});
+ var a = r.call(this, e, n, i) || this;
+ a.webVROptions = o, a._vrDevice = null, a.rawPose = null, a._specsVersion = "1.1", a._attached = !1, a._descendants = [], a._deviceRoomPosition = c.e.Zero(), a._deviceRoomRotationQuaternion = c.b.Identity(), a._standingMatrix = null, a.devicePosition = c.e.Zero(), a.deviceRotationQuaternion = c.b.Identity(), a.deviceScaleFactor = 1, a._deviceToWorld = c.a.Identity(), a._worldToDevice = c.a.Identity(), a.controllers = [], a.onControllersAttachedObservable = new P.c(), a.onControllerMeshLoadedObservable = new P.c(), a.onPoseUpdatedFromDeviceObservable = new P.c(), a._poseSet = !1, a.rigParenting = !0, a._defaultHeight = void 0, a._detachIfAttached = function() {
+ var p = a.getEngine().getVRDevice();
+ p && !p.isPresenting && a.detachControl();
+ }, a._workingVector = c.e.Zero(), a._oneVector = c.e.One(), a._workingMatrix = c.a.Identity(), a._tmpMatrix = new c.a(), a._cache.position = c.e.Zero(), o.defaultHeight && (a._defaultHeight = o.defaultHeight, a.position.y = a._defaultHeight), a.minZ = 0.1, arguments.length === 5 && (a.webVROptions = arguments[4]), a.webVROptions.trackPosition == null && (a.webVROptions.trackPosition = !0), a.webVROptions.controllerMeshes == null && (a.webVROptions.controllerMeshes = !0), a.webVROptions.defaultLightingOnControllers == null && (a.webVROptions.defaultLightingOnControllers = !0), a.rotationQuaternion = new c.b(), a.webVROptions && a.webVROptions.positionScale && (a.deviceScaleFactor = a.webVROptions.positionScale);
+ var s = a.getEngine();
+ return a._onVREnabled = function(p) {
+ p && a.initControllers();
+ }, s.onVRRequestPresentComplete.add(a._onVREnabled), s.initWebVR().add(function(p) {
+ p.vrDisplay && a._vrDevice !== p.vrDisplay && (a._vrDevice = p.vrDisplay, a.setCameraRigMode(gt.a.RIG_MODE_WEBVR, { parentCamera: a, vrDisplay: a._vrDevice, frameData: a._frameData, specs: a._specsVersion }), a._attached && a.getEngine().enableVR(a.webVROptions));
+ }), typeof VRFrameData < "u" && (a._frameData = new VRFrameData()), o.useMultiview && (a.getScene().getEngine().getCaps().multiview ? (a._useMultiviewToSingleView = !0, a._rigPostProcess = new pl("VRMultiviewToSingleview", a, 1)) : (h.a.Warn("Multiview is not supported, falling back to standard rendering"), a._useMultiviewToSingleView = !1)), i.onBeforeCameraRenderObservable.add(function(p) {
+ p.parent === a && a.rigParenting && (a._descendants = a.getDescendants(!0, function(m) {
+ var S = a.controllers.some(function(I) {
+ return I._mesh === m;
+ }), O = a._rigCameras.indexOf(m) !== -1;
+ return !S && !O;
+ }), a._descendants.forEach(function(m) {
+ m.parent = p;
+ }));
+ }), i.onAfterCameraRenderObservable.add(function(p) {
+ p.parent === a && a.rigParenting && a._descendants.forEach(function(m) {
+ m.parent = a;
+ });
+ }), a;
+ }
+ return Object(u.d)(t, r), t.prototype.deviceDistanceToRoomGround = function() {
+ return this._standingMatrix ? (this._standingMatrix.getTranslationToRef(this._workingVector), this._deviceRoomPosition.y + this._workingVector.y) : this._defaultHeight || 0;
+ }, t.prototype.useStandingMatrix = function(e) {
+ var n = this;
+ e === void 0 && (e = function(i) {
+ }), this.getEngine().initWebVRAsync().then(function(i) {
+ i.vrDisplay && i.vrDisplay.stageParameters && i.vrDisplay.stageParameters.sittingToStandingTransform && n.webVROptions.trackPosition ? (n._standingMatrix = new c.a(), c.a.FromFloat32ArrayToRefScaled(i.vrDisplay.stageParameters.sittingToStandingTransform, 0, 1, n._standingMatrix), n.getScene().useRightHandedSystem || n._standingMatrix && n._standingMatrix.toggleModelMatrixHandInPlace(), e(!0)) : e(!1);
+ });
+ }, t.prototype.useStandingMatrixAsync = function() {
+ var e = this;
+ return new Promise(function(n) {
+ e.useStandingMatrix(function(i) {
+ n(i);
+ });
+ });
+ }, t.prototype.dispose = function() {
+ this._detachIfAttached(), this.getEngine().onVRRequestPresentComplete.removeCallback(this._onVREnabled), this._updateCacheWhenTrackingDisabledObserver && this._scene.onBeforeRenderObservable.remove(this._updateCacheWhenTrackingDisabledObserver), r.prototype.dispose.call(this);
+ }, t.prototype.getControllerByName = function(e) {
+ for (var n = 0, i = this.controllers; n < i.length; n++) {
+ var o = i[n];
+ if (o.hand === e)
+ return o;
+ }
+ return null;
+ }, Object.defineProperty(t.prototype, "leftController", { get: function() {
+ return this._leftController || (this._leftController = this.getControllerByName("left")), this._leftController;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "rightController", { get: function() {
+ return this._rightController || (this._rightController = this.getControllerByName("right")), this._rightController;
+ }, enumerable: !1, configurable: !0 }), t.prototype.getForwardRay = function(e) {
+ return e === void 0 && (e = 100), this.leftCamera ? r.prototype.getForwardRay.call(this, e, this.leftCamera.getWorldMatrix(), this.leftCamera.globalPosition) : r.prototype.getForwardRay.call(this, e);
+ }, t.prototype._checkInputs = function() {
+ this._vrDevice && this._vrDevice.isPresenting && (this._vrDevice.getFrameData(this._frameData), this.updateFromDevice(this._frameData.pose)), r.prototype._checkInputs.call(this);
+ }, t.prototype.updateFromDevice = function(e) {
+ e && e.orientation && e.orientation.length === 4 && (this.rawPose = e, this._deviceRoomRotationQuaternion.copyFromFloats(e.orientation[0], e.orientation[1], -e.orientation[2], -e.orientation[3]), this.getScene().useRightHandedSystem && (this._deviceRoomRotationQuaternion.z *= -1, this._deviceRoomRotationQuaternion.w *= -1), this.webVROptions.trackPosition && this.rawPose.position && (this._deviceRoomPosition.copyFromFloats(this.rawPose.position[0], this.rawPose.position[1], -this.rawPose.position[2]), this.getScene().useRightHandedSystem && (this._deviceRoomPosition.z *= -1)), this._poseSet = !0);
+ }, t.prototype.attachControl = function(e) {
+ e = Ke.b.BackCompatCameraNoPreventDefault(arguments), r.prototype.attachControl.call(this, e), this._attached = !0, e = !gt.a.ForceAttachControlToAlwaysPreventDefault && e, this._vrDevice && this.getEngine().enableVR(this.webVROptions);
+ var n = this._scene.getEngine().getHostWindow();
+ n && n.addEventListener("vrdisplaypresentchange", this._detachIfAttached);
+ }, t.prototype.detachControl = function(e) {
+ this.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver), this.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver), r.prototype.detachControl.call(this), this._attached = !1, this.getEngine().disableVR(), window.removeEventListener("vrdisplaypresentchange", this._detachIfAttached);
+ }, t.prototype.getClassName = function() {
+ return "WebVRFreeCamera";
+ }, t.prototype.resetToCurrentRotation = function() {
+ this._vrDevice.resetPose();
+ }, t.prototype._updateRigCameras = function() {
+ var e = this._rigCameras[0], n = this._rigCameras[1];
+ e.rotationQuaternion.copyFrom(this._deviceRoomRotationQuaternion), n.rotationQuaternion.copyFrom(this._deviceRoomRotationQuaternion), e.position.copyFrom(this._deviceRoomPosition), n.position.copyFrom(this._deviceRoomPosition);
+ }, t.prototype._correctPositionIfNotTrackPosition = function(e, n) {
+ n === void 0 && (n = !1), this.rawPose && this.rawPose.position && !this.webVROptions.trackPosition && (c.a.TranslationToRef(this.rawPose.position[0], this.rawPose.position[1], -this.rawPose.position[2], this._tmpMatrix), n || this._tmpMatrix.invert(), this._tmpMatrix.multiplyToRef(e, e));
+ }, t.prototype._updateCache = function(e) {
+ var n = this;
+ this.rotationQuaternion.equals(this._cache.rotationQuaternion) && this.position.equals(this._cache.position) || (this.updateCacheCalled || (this.updateCacheCalled = !0, this.update()), this.rotationQuaternion.toRotationMatrix(this._workingMatrix), c.e.TransformCoordinatesToRef(this._deviceRoomPosition, this._workingMatrix, this._workingVector), this.devicePosition.subtractToRef(this._workingVector, this._workingVector), c.a.ComposeToRef(this._oneVector, this.rotationQuaternion, this._workingVector, this._deviceToWorld), this._deviceToWorld.getTranslationToRef(this._workingVector), this._workingVector.addInPlace(this.position), this._workingVector.subtractInPlace(this._cache.position), this._deviceToWorld.setTranslation(this._workingVector), this._deviceToWorld.invertToRef(this._worldToDevice), this.controllers.forEach(function(i) {
+ i._deviceToWorld.copyFrom(n._deviceToWorld), n._correctPositionIfNotTrackPosition(i._deviceToWorld), i.update();
+ })), e || r.prototype._updateCache.call(this), this.updateCacheCalled = !1;
+ }, t.prototype._computeDevicePosition = function() {
+ c.e.TransformCoordinatesToRef(this._deviceRoomPosition, this._deviceToWorld, this.devicePosition);
+ }, t.prototype.update = function() {
+ this._computeDevicePosition(), c.a.FromQuaternionToRef(this._deviceRoomRotationQuaternion, this._workingMatrix), this._workingMatrix.multiplyToRef(this._deviceToWorld, this._workingMatrix), c.b.FromRotationMatrixToRef(this._workingMatrix, this.deviceRotationQuaternion), this._poseSet && this.onPoseUpdatedFromDeviceObservable.notifyObservers(null), r.prototype.update.call(this);
+ }, t.prototype._getViewMatrix = function() {
+ return c.a.Identity();
+ }, t.prototype._getWebVRViewMatrix = function() {
+ var e = this._cameraRigParams.parentCamera;
+ e._updateCache();
+ var n = this._cameraRigParams.left ? this._cameraRigParams.frameData.leftViewMatrix : this._cameraRigParams.frameData.rightViewMatrix;
+ return c.a.FromArrayToRef(n, 0, this._webvrViewMatrix), this.getScene().useRightHandedSystem || this._webvrViewMatrix.toggleModelMatrixHandInPlace(), this._webvrViewMatrix.getRotationMatrixToRef(this._cameraRotationMatrix), c.e.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint), this.position.addToRef(this._transformedReferencePoint, this._currentTarget), e.deviceScaleFactor !== 1 && (this._webvrViewMatrix.invert(), e.deviceScaleFactor && (this._webvrViewMatrix.multiplyAtIndex(12, e.deviceScaleFactor), this._webvrViewMatrix.multiplyAtIndex(13, e.deviceScaleFactor), this._webvrViewMatrix.multiplyAtIndex(14, e.deviceScaleFactor)), this._webvrViewMatrix.invert()), e._correctPositionIfNotTrackPosition(this._webvrViewMatrix, !0), e._worldToDevice.multiplyToRef(this._webvrViewMatrix, this._webvrViewMatrix), this._workingMatrix = this._workingMatrix || c.a.Identity(), this._webvrViewMatrix.invertToRef(this._workingMatrix), this._workingMatrix.multiplyToRef(e.getWorldMatrix(), this._workingMatrix), this._workingMatrix.getTranslationToRef(this._globalPosition), this._markSyncedWithParent(), this._webvrViewMatrix;
+ }, t.prototype._getWebVRProjectionMatrix = function() {
+ var e = this.parent;
+ e._vrDevice.depthNear = e.minZ, e._vrDevice.depthFar = e.maxZ;
+ var n = this._cameraRigParams.left ? this._cameraRigParams.frameData.leftProjectionMatrix : this._cameraRigParams.frameData.rightProjectionMatrix;
+ return c.a.FromArrayToRef(n, 0, this._projectionMatrix), this.getScene().useRightHandedSystem || this._projectionMatrix.toggleProjectionMatrixHandInPlace(), this._projectionMatrix;
+ }, t.prototype.initControllers = function() {
+ var e = this;
+ this.controllers = [];
+ var n = this.getScene().gamepadManager;
+ this._onGamepadDisconnectedObserver = n.onGamepadDisconnectedObservable.add(function(i) {
+ if (i.type === Sn.POSE_ENABLED) {
+ var o = i;
+ o.defaultModel && o.defaultModel.setEnabled(!1), o.hand === "right" && (e._rightController = null), o.hand === "left" && (e._leftController = null);
+ var a = e.controllers.indexOf(o);
+ a !== -1 && e.controllers.splice(a, 1);
+ }
+ }), this._onGamepadConnectedObserver = n.onGamepadConnectedObservable.add(function(i) {
+ if (i.type === Sn.POSE_ENABLED) {
+ var o = i;
+ if (e.webVROptions.trackPosition || (o._disableTrackPosition(new c.e(o.hand == "left" ? -0.15 : 0.15, -0.5, 0.25)), e._updateCacheWhenTrackingDisabledObserver || (e._updateCacheWhenTrackingDisabledObserver = e._scene.onBeforeRenderObservable.add(function() {
+ e._updateCache();
+ }))), o.deviceScaleFactor = e.deviceScaleFactor, o._deviceToWorld.copyFrom(e._deviceToWorld), e._correctPositionIfNotTrackPosition(o._deviceToWorld), e.webVROptions.controllerMeshes && (o.defaultModel ? o.defaultModel.setEnabled(!0) : o.initControllerMesh(e.getScene(), function(p) {
+ if (p.scaling.scaleInPlace(e.deviceScaleFactor), e.onControllerMeshLoadedObservable.notifyObservers(o), e.webVROptions.defaultLightingOnControllers) {
+ e._lightOnControllers || (e._lightOnControllers = new vs.a("vrControllersLight", new c.e(0, 1, 0), e.getScene()));
+ var m = function(S, O) {
+ var I = S.getChildren();
+ I && I.length !== 0 && I.forEach(function(G) {
+ O.includedOnlyMeshes.push(G), m(G, O);
+ });
+ };
+ e._lightOnControllers.includedOnlyMeshes.push(p), m(p, e._lightOnControllers);
+ }
+ })), o.attachToPoseControlledCamera(e), e.controllers.indexOf(o) === -1) {
+ e.controllers.push(o);
+ for (var a = !1, s = 0; s < e.controllers.length; s++)
+ e.controllers[s].controllerType === Si.VIVE && (a ? e.controllers[s].hand = "right" : (a = !0, e.controllers[s].hand = "left"));
+ e.controllers.length >= 2 && e.onControllersAttachedObservable.notifyObservers(e.controllers);
+ }
+ }
+ });
+ }, t;
+ }(ci), mr = function(r) {
+ function t(e) {
+ var n = r.call(this, e) || this;
+ return n.onTriggerStateChangedObservable = new P.c(), n.onMainButtonStateChangedObservable = new P.c(), n.onSecondaryButtonStateChangedObservable = new P.c(), n.onPadStateChangedObservable = new P.c(), n.onPadValuesChangedObservable = new P.c(), n.pad = { x: 0, y: 0 }, n._changes = { pressChanged: !1, touchChanged: !1, valueChanged: !1, changed: !1 }, n._buttons = new Array(e.buttons.length), n.hand = e.hand, n;
+ }
+ return Object(u.d)(t, r), t.prototype.onButtonStateChange = function(e) {
+ this._onButtonStateChange = e;
+ }, Object.defineProperty(t.prototype, "defaultModel", { get: function() {
+ return this._defaultModel;
+ }, enumerable: !1, configurable: !0 }), t.prototype.update = function() {
+ r.prototype.update.call(this);
+ for (var e = 0; e < this._buttons.length; e++)
+ this._setButtonValue(this.browserGamepad.buttons[e], this._buttons[e], e);
+ this.leftStick.x === this.pad.x && this.leftStick.y === this.pad.y || (this.pad.x = this.leftStick.x, this.pad.y = this.leftStick.y, this.onPadValuesChangedObservable.notifyObservers(this.pad));
+ }, t.prototype._setButtonValue = function(e, n, i) {
+ e || (e = { pressed: !1, touched: !1, value: 0 }), n ? (this._checkChanges(e, n), this._changes.changed && (this._onButtonStateChange && this._onButtonStateChange(this.index, i, e), this._handleButtonChange(i, e, this._changes)), this._buttons[i].pressed = e.pressed, this._buttons[i].touched = e.touched, this._buttons[i].value = e.value < 1e-8 ? 0 : e.value) : this._buttons[i] = { pressed: e.pressed, touched: e.touched, value: e.value };
+ }, t.prototype._checkChanges = function(e, n) {
+ return this._changes.pressChanged = e.pressed !== n.pressed, this._changes.touchChanged = e.touched !== n.touched, this._changes.valueChanged = e.value !== n.value, this._changes.changed = this._changes.pressChanged || this._changes.touchChanged || this._changes.valueChanged, this._changes;
+ }, t.prototype.dispose = function() {
+ r.prototype.dispose.call(this), this._defaultModel = null, this.onTriggerStateChangedObservable.clear(), this.onMainButtonStateChangedObservable.clear(), this.onSecondaryButtonStateChangedObservable.clear(), this.onPadStateChangedObservable.clear(), this.onPadValuesChangedObservable.clear();
+ }, t;
+ }(mo), In = l(42), kt = l(30), $i = l(62), ub = (l(108), l(59), l(109), `
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+#include
+#include
+#include
+void main(void)
+{
+vec4 result=texture2D(textureSampler,vUV);
+#ifdef IMAGEPROCESSING
+#ifndef FROMLINEARSPACE
+
+result.rgb=toLinearSpace(result.rgb);
+#endif
+result=applyImageProcessing(result);
+#else
+
+#ifdef FROMLINEARSPACE
+result=applyImageProcessing(result);
+#endif
+#endif
+gl_FragColor=result;
+}`);
+ We.a.ShadersStore.imageProcessingPixelShader = ub;
+ var ys = function(r) {
+ function t(e, n, i, o, a, s, p, m) {
+ i === void 0 && (i = null), p === void 0 && (p = d.a.TEXTURETYPE_UNSIGNED_INT);
+ var S = r.call(this, e, "imageProcessing", [], [], n, i, o, a, s, null, p, "postprocess", null, !0) || this;
+ return S._fromLinearSpace = !0, S._defines = { IMAGEPROCESSING: !1, VIGNETTE: !1, VIGNETTEBLENDMODEMULTIPLY: !1, VIGNETTEBLENDMODEOPAQUE: !1, TONEMAPPING: !1, TONEMAPPING_ACES: !1, CONTRAST: !1, COLORCURVES: !1, COLORGRADING: !1, COLORGRADING3D: !1, FROMLINEARSPACE: !1, SAMPLER3DGREENDEPTH: !1, SAMPLER3DBGRMAP: !1, IMAGEPROCESSINGPOSTPROCESS: !1, EXPOSURE: !1 }, m ? (m.applyByPostProcess = !0, S._attachImageProcessingConfiguration(m, !0), S.fromLinearSpace = !1) : (S._attachImageProcessingConfiguration(null, !0), S.imageProcessingConfiguration.applyByPostProcess = !0), S.onApply = function(O) {
+ S.imageProcessingConfiguration.bind(O, S.aspectRatio);
+ }, S;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "imageProcessingConfiguration", { get: function() {
+ return this._imageProcessingConfiguration;
+ }, set: function(e) {
+ e.applyByPostProcess = !0, this._attachImageProcessingConfiguration(e);
+ }, enumerable: !1, configurable: !0 }), t.prototype._attachImageProcessingConfiguration = function(e, n) {
+ var i = this;
+ if (n === void 0 && (n = !1), e !== this._imageProcessingConfiguration) {
+ if (this._imageProcessingConfiguration && this._imageProcessingObserver && this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver), e)
+ this._imageProcessingConfiguration = e;
+ else {
+ var o = null, a = this.getEngine(), s = this.getCamera();
+ if (s)
+ o = s.getScene();
+ else if (a && a.scenes) {
+ var p = a.scenes;
+ o = p[p.length - 1];
+ } else
+ o = te.a.LastCreatedScene;
+ this._imageProcessingConfiguration = o ? o.imageProcessingConfiguration : new In.a();
+ }
+ this._imageProcessingConfiguration && (this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(function() {
+ i._updateParameters();
+ })), n || this._updateParameters();
+ }
+ }, Object.defineProperty(t.prototype, "isSupported", { get: function() {
+ var e = this.getEffect();
+ return !e || e.isSupported;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "colorCurves", { get: function() {
+ return this.imageProcessingConfiguration.colorCurves;
+ }, set: function(e) {
+ this.imageProcessingConfiguration.colorCurves = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "colorCurvesEnabled", { get: function() {
+ return this.imageProcessingConfiguration.colorCurvesEnabled;
+ }, set: function(e) {
+ this.imageProcessingConfiguration.colorCurvesEnabled = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "colorGradingTexture", { get: function() {
+ return this.imageProcessingConfiguration.colorGradingTexture;
+ }, set: function(e) {
+ this.imageProcessingConfiguration.colorGradingTexture = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "colorGradingEnabled", { get: function() {
+ return this.imageProcessingConfiguration.colorGradingEnabled;
+ }, set: function(e) {
+ this.imageProcessingConfiguration.colorGradingEnabled = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "exposure", { get: function() {
+ return this.imageProcessingConfiguration.exposure;
+ }, set: function(e) {
+ this.imageProcessingConfiguration.exposure = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "toneMappingEnabled", { get: function() {
+ return this._imageProcessingConfiguration.toneMappingEnabled;
+ }, set: function(e) {
+ this._imageProcessingConfiguration.toneMappingEnabled = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "toneMappingType", { get: function() {
+ return this._imageProcessingConfiguration.toneMappingType;
+ }, set: function(e) {
+ this._imageProcessingConfiguration.toneMappingType = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "contrast", { get: function() {
+ return this.imageProcessingConfiguration.contrast;
+ }, set: function(e) {
+ this.imageProcessingConfiguration.contrast = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "vignetteStretch", { get: function() {
+ return this.imageProcessingConfiguration.vignetteStretch;
+ }, set: function(e) {
+ this.imageProcessingConfiguration.vignetteStretch = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "vignetteCentreX", { get: function() {
+ return this.imageProcessingConfiguration.vignetteCentreX;
+ }, set: function(e) {
+ this.imageProcessingConfiguration.vignetteCentreX = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "vignetteCentreY", { get: function() {
+ return this.imageProcessingConfiguration.vignetteCentreY;
+ }, set: function(e) {
+ this.imageProcessingConfiguration.vignetteCentreY = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "vignetteWeight", { get: function() {
+ return this.imageProcessingConfiguration.vignetteWeight;
+ }, set: function(e) {
+ this.imageProcessingConfiguration.vignetteWeight = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "vignetteColor", { get: function() {
+ return this.imageProcessingConfiguration.vignetteColor;
+ }, set: function(e) {
+ this.imageProcessingConfiguration.vignetteColor = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "vignetteCameraFov", { get: function() {
+ return this.imageProcessingConfiguration.vignetteCameraFov;
+ }, set: function(e) {
+ this.imageProcessingConfiguration.vignetteCameraFov = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "vignetteBlendMode", { get: function() {
+ return this.imageProcessingConfiguration.vignetteBlendMode;
+ }, set: function(e) {
+ this.imageProcessingConfiguration.vignetteBlendMode = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "vignetteEnabled", { get: function() {
+ return this.imageProcessingConfiguration.vignetteEnabled;
+ }, set: function(e) {
+ this.imageProcessingConfiguration.vignetteEnabled = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "fromLinearSpace", { get: function() {
+ return this._fromLinearSpace;
+ }, set: function(e) {
+ this._fromLinearSpace !== e && (this._fromLinearSpace = e, this._updateParameters());
+ }, enumerable: !1, configurable: !0 }), t.prototype.getClassName = function() {
+ return "ImageProcessingPostProcess";
+ }, t.prototype._updateParameters = function() {
+ this._defines.FROMLINEARSPACE = this._fromLinearSpace, this.imageProcessingConfiguration.prepareDefines(this._defines, !0);
+ var e = "";
+ for (var n in this._defines)
+ this._defines[n] && (e += "#define " + n + `;\r
+`);
+ var i = ["textureSampler"], o = ["scale"];
+ In.a && (In.a.PrepareSamplers(i, this._defines), In.a.PrepareUniforms(o, this._defines)), this.updateEffect(e, o, i);
+ }, t.prototype.dispose = function(e) {
+ r.prototype.dispose.call(this, e), this._imageProcessingConfiguration && this._imageProcessingObserver && this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver), this._imageProcessingConfiguration && (this.imageProcessingConfiguration.applyByPostProcess = !1);
+ }, Object(u.c)([Object(w.c)()], t.prototype, "_fromLinearSpace", void 0), t;
+ }(_t), ft = l(16), De = l(4);
+ we.a._GroundMeshParser = function(r, t) {
+ return Es.Parse(r, t);
+ };
+ var Es = function(r) {
+ function t(e, n) {
+ var i = r.call(this, e, n) || this;
+ return i.generateOctree = !1, i;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "GroundMesh";
+ }, Object.defineProperty(t.prototype, "subdivisions", { get: function() {
+ return Math.min(this._subdivisionsX, this._subdivisionsY);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "subdivisionsX", { get: function() {
+ return this._subdivisionsX;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "subdivisionsY", { get: function() {
+ return this._subdivisionsY;
+ }, enumerable: !1, configurable: !0 }), t.prototype.optimize = function(e, n) {
+ n === void 0 && (n = 32), this._subdivisionsX = e, this._subdivisionsY = e, this.subdivide(e), this.createOrUpdateSubmeshesOctree && this.createOrUpdateSubmeshesOctree(n);
+ }, t.prototype.getHeightAtCoordinates = function(e, n) {
+ var i = this.getWorldMatrix(), o = c.c.Matrix[5];
+ i.invertToRef(o);
+ var a = c.c.Vector3[8];
+ if (c.e.TransformCoordinatesFromFloatsToRef(e, 0, n, o, a), e = a.x, n = a.z, e < this._minX || e > this._maxX || n < this._minZ || n > this._maxZ)
+ return this.position.y;
+ this._heightQuads && this._heightQuads.length != 0 || (this._initHeightQuads(), this._computeHeightQuads());
+ var s = this._getFacetAt(e, n), p = -(s.x * e + s.z * n + s.w) / s.y;
+ return c.e.TransformCoordinatesFromFloatsToRef(0, p, 0, i, a), a.y;
+ }, t.prototype.getNormalAtCoordinates = function(e, n) {
+ var i = new c.e(0, 1, 0);
+ return this.getNormalAtCoordinatesToRef(e, n, i), i;
+ }, t.prototype.getNormalAtCoordinatesToRef = function(e, n, i) {
+ var o = this.getWorldMatrix(), a = c.c.Matrix[5];
+ o.invertToRef(a);
+ var s = c.c.Vector3[8];
+ if (c.e.TransformCoordinatesFromFloatsToRef(e, 0, n, a, s), e = s.x, n = s.z, e < this._minX || e > this._maxX || n < this._minZ || n > this._maxZ)
+ return this;
+ this._heightQuads && this._heightQuads.length != 0 || (this._initHeightQuads(), this._computeHeightQuads());
+ var p = this._getFacetAt(e, n);
+ return c.e.TransformNormalFromFloatsToRef(p.x, p.y, p.z, o, i), this;
+ }, t.prototype.updateCoordinateHeights = function() {
+ return this._heightQuads && this._heightQuads.length != 0 || this._initHeightQuads(), this._computeHeightQuads(), this;
+ }, t.prototype._getFacetAt = function(e, n) {
+ var i = Math.floor((e + this._maxX) * this._subdivisionsX / this._width), o = Math.floor(-(n + this._maxZ) * this._subdivisionsY / this._height + this._subdivisionsY), a = this._heightQuads[o * this._subdivisionsX + i];
+ return n < a.slope.x * e + a.slope.y ? a.facet1 : a.facet2;
+ }, t.prototype._initHeightQuads = function() {
+ var e = this._subdivisionsX, n = this._subdivisionsY;
+ this._heightQuads = new Array();
+ for (var i = 0; i < n; i++)
+ for (var o = 0; o < e; o++) {
+ var a = { slope: c.d.Zero(), facet1: new c.f(0, 0, 0, 0), facet2: new c.f(0, 0, 0, 0) };
+ this._heightQuads[i * e + o] = a;
+ }
+ return this;
+ }, t.prototype._computeHeightQuads = function() {
+ var e = this.getVerticesData(De.b.PositionKind);
+ if (!e)
+ return this;
+ for (var n = c.c.Vector3[3], i = c.c.Vector3[2], o = c.c.Vector3[1], a = c.c.Vector3[0], s = c.c.Vector3[4], p = c.c.Vector3[5], m = c.c.Vector3[6], S = c.c.Vector3[7], O = c.c.Vector3[8], I = 0, G = 0, k = 0, K = 0, re = 0, se = 0, ue = 0, he = this._subdivisionsX, pe = this._subdivisionsY, ve = 0; ve < pe; ve++)
+ for (var Ee = 0; Ee < he; Ee++) {
+ I = 3 * Ee, G = ve * (he + 1) * 3, k = (ve + 1) * (he + 1) * 3, n.x = e[G + I], n.y = e[G + I + 1], n.z = e[G + I + 2], i.x = e[G + I + 3], i.y = e[G + I + 4], i.z = e[G + I + 5], o.x = e[k + I], o.y = e[k + I + 1], o.z = e[k + I + 2], a.x = e[k + I + 3], a.y = e[k + I + 4], a.z = e[k + I + 5], K = (a.z - n.z) / (a.x - n.x), re = n.z - K * n.x, i.subtractToRef(n, s), o.subtractToRef(n, p), a.subtractToRef(n, m), c.e.CrossToRef(m, p, S), c.e.CrossToRef(s, m, O), S.normalize(), O.normalize(), se = -(S.x * n.x + S.y * n.y + S.z * n.z), ue = -(O.x * i.x + O.y * i.y + O.z * i.z);
+ var Ae = this._heightQuads[ve * he + Ee];
+ Ae.slope.copyFromFloats(K, re), Ae.facet1.copyFromFloats(S.x, S.y, S.z, se), Ae.facet2.copyFromFloats(O.x, O.y, O.z, ue);
+ }
+ return this;
+ }, t.prototype.serialize = function(e) {
+ r.prototype.serialize.call(this, e), e.subdivisionsX = this._subdivisionsX, e.subdivisionsY = this._subdivisionsY, e.minX = this._minX, e.maxX = this._maxX, e.minZ = this._minZ, e.maxZ = this._maxZ, e.width = this._width, e.height = this._height;
+ }, t.Parse = function(e, n) {
+ var i = new t(e.name, n);
+ return i._subdivisionsX = e.subdivisionsX || 1, i._subdivisionsY = e.subdivisionsY || 1, i._minX = e.minX, i._maxX = e.maxX, i._minZ = e.minZ, i._maxZ = e.maxZ, i._width = e.width, i._height = e.height, i;
+ }, t;
+ }(we.a), _l = l(70);
+ ft.a.CreateGround = function(r) {
+ var t, e, n = [], i = [], o = [], a = [], s = r.width || 1, p = r.height || 1, m = r.subdivisionsX || r.subdivisions || 1, S = r.subdivisionsY || r.subdivisions || 1;
+ for (t = 0; t <= S; t++)
+ for (e = 0; e <= m; e++) {
+ var O = new c.e(e * s / m - s / 2, 0, (S - t) * p / S - p / 2), I = new c.e(0, 1, 0);
+ i.push(O.x, O.y, O.z), o.push(I.x, I.y, I.z), a.push(e / m, 1 - t / S);
+ }
+ for (t = 0; t < S; t++)
+ for (e = 0; e < m; e++)
+ n.push(e + 1 + (t + 1) * (m + 1)), n.push(e + 1 + t * (m + 1)), n.push(e + t * (m + 1)), n.push(e + (t + 1) * (m + 1)), n.push(e + 1 + (t + 1) * (m + 1)), n.push(e + t * (m + 1));
+ var G = new ft.a();
+ return G.indices = n, G.positions = i, G.normals = o, G.uvs = a, G;
+ }, ft.a.CreateTiledGround = function(r) {
+ var t, e, n, i, o = r.xmin !== void 0 && r.xmin !== null ? r.xmin : -1, a = r.zmin !== void 0 && r.zmin !== null ? r.zmin : -1, s = r.xmax !== void 0 && r.xmax !== null ? r.xmax : 1, p = r.zmax !== void 0 && r.zmax !== null ? r.zmax : 1, m = r.subdivisions || { w: 1, h: 1 }, S = r.precision || { w: 1, h: 1 }, O = new Array(), I = new Array(), G = new Array(), k = new Array();
+ m.h = m.h < 1 ? 1 : m.h, m.w = m.w < 1 ? 1 : m.w, S.w = S.w < 1 ? 1 : S.w, S.h = S.h < 1 ? 1 : S.h;
+ var K = (s - o) / m.w, re = (p - a) / m.h;
+ function se(he, pe, ve, Ee) {
+ var Ae = I.length / 3, Ie = S.w + 1;
+ for (t = 0; t < S.h; t++)
+ for (e = 0; e < S.w; e++) {
+ var xe = [Ae + e + t * Ie, Ae + (e + 1) + t * Ie, Ae + (e + 1) + (t + 1) * Ie, Ae + e + (t + 1) * Ie];
+ O.push(xe[1]), O.push(xe[2]), O.push(xe[3]), O.push(xe[0]), O.push(xe[1]), O.push(xe[3]);
+ }
+ var Pe = c.e.Zero(), Ce = new c.e(0, 1, 0);
+ for (t = 0; t <= S.h; t++)
+ for (Pe.z = t * (Ee - pe) / S.h + pe, e = 0; e <= S.w; e++)
+ Pe.x = e * (ve - he) / S.w + he, Pe.y = 0, I.push(Pe.x, Pe.y, Pe.z), G.push(Ce.x, Ce.y, Ce.z), k.push(e / S.w, t / S.h);
+ }
+ for (n = 0; n < m.h; n++)
+ for (i = 0; i < m.w; i++)
+ se(o + i * K, a + n * re, o + (i + 1) * K, a + (n + 1) * re);
+ var ue = new ft.a();
+ return ue.indices = O, ue.positions = I, ue.normals = G, ue.uvs = k, ue;
+ }, ft.a.CreateGroundFromHeightMap = function(r) {
+ var t, e, n = [], i = [], o = [], a = [], s = r.colorFilter || new C.a(0.3, 0.59, 0.11), p = r.alphaFilter || 0, m = !1;
+ if (r.minHeight > r.maxHeight) {
+ m = !0;
+ var S = r.maxHeight;
+ r.maxHeight = r.minHeight, r.minHeight = S;
+ }
+ for (t = 0; t <= r.subdivisions; t++)
+ for (e = 0; e <= r.subdivisions; e++) {
+ var O = new c.e(e * r.width / r.subdivisions - r.width / 2, 0, (r.subdivisions - t) * r.height / r.subdivisions - r.height / 2), I = 4 * (((O.x + r.width / 2) / r.width * (r.bufferWidth - 1) | 0) + ((1 - (O.z + r.height / 2) / r.height) * (r.bufferHeight - 1) | 0) * r.bufferWidth), G = r.buffer[I] / 255, k = r.buffer[I + 1] / 255, K = r.buffer[I + 2] / 255, re = r.buffer[I + 3] / 255;
+ m && (G = 1 - G, k = 1 - k, K = 1 - K);
+ var se = G * s.r + k * s.g + K * s.b;
+ O.y = re >= p ? r.minHeight + (r.maxHeight - r.minHeight) * se : r.minHeight - Xt.a, i.push(O.x, O.y, O.z), o.push(0, 0, 0), a.push(e / r.subdivisions, 1 - t / r.subdivisions);
+ }
+ for (t = 0; t < r.subdivisions; t++)
+ for (e = 0; e < r.subdivisions; e++) {
+ var ue = e + 1 + (t + 1) * (r.subdivisions + 1), he = e + 1 + t * (r.subdivisions + 1), pe = e + t * (r.subdivisions + 1), ve = e + (t + 1) * (r.subdivisions + 1), Ee = i[3 * ue + 1] >= r.minHeight, Ae = i[3 * he + 1] >= r.minHeight, Ie = i[3 * pe + 1] >= r.minHeight;
+ Ee && Ae && Ie && (n.push(ue), n.push(he), n.push(pe)), i[3 * ve + 1] >= r.minHeight && Ee && Ie && (n.push(ve), n.push(ue), n.push(pe));
+ }
+ ft.a.ComputeNormals(i, n, o);
+ var xe = new ft.a();
+ return xe.indices = n, xe.positions = i, xe.normals = o, xe.uvs = a, xe;
+ }, we.a.CreateGround = function(r, t, e, n, i, o) {
+ var a = { width: t, height: e, subdivisions: n, updatable: o };
+ return gr.CreateGround(r, a, i);
+ }, we.a.CreateTiledGround = function(r, t, e, n, i, o, a, s, p) {
+ var m = { xmin: t, zmin: e, xmax: n, zmax: i, subdivisions: o, precision: a, updatable: p };
+ return gr.CreateTiledGround(r, m, s);
+ }, we.a.CreateGroundFromHeightMap = function(r, t, e, n, i, o, a, s, p, m, S) {
+ var O = { width: e, height: n, subdivisions: i, minHeight: o, maxHeight: a, updatable: p, onReady: m, alphaFilter: S };
+ return gr.CreateGroundFromHeightMap(r, t, O, s);
+ };
+ var gr = function() {
+ function r() {
+ }
+ return r.CreateGround = function(t, e, n) {
+ var i = new Es(t, n);
+ return i._setReady(!1), i._subdivisionsX = e.subdivisionsX || e.subdivisions || 1, i._subdivisionsY = e.subdivisionsY || e.subdivisions || 1, i._width = e.width || 1, i._height = e.height || 1, i._maxX = i._width / 2, i._maxZ = i._height / 2, i._minX = -i._maxX, i._minZ = -i._maxZ, ft.a.CreateGround(e).applyToMesh(i, e.updatable), i._setReady(!0), i;
+ }, r.CreateTiledGround = function(t, e, n) {
+ n === void 0 && (n = null);
+ var i = new we.a(t, n);
+ return ft.a.CreateTiledGround(e).applyToMesh(i, e.updatable), i;
+ }, r.CreateGroundFromHeightMap = function(t, e, n, i) {
+ i === void 0 && (i = null);
+ var o = n.width || 10, a = n.height || 10, s = n.subdivisions || 1, p = n.minHeight || 0, m = n.maxHeight || 1, S = n.colorFilter || new C.a(0.3, 0.59, 0.11), O = n.alphaFilter || 0, I = n.updatable, G = n.onReady;
+ i = i || te.a.LastCreatedScene;
+ var k = new Es(t, i);
+ return k._subdivisionsX = s, k._subdivisionsY = s, k._width = o, k._height = a, k._maxX = k._width / 2, k._maxZ = k._height / 2, k._minX = -k._maxX, k._minZ = -k._maxZ, k._setReady(!1), Ke.b.LoadImage(e, function(K) {
+ var re = K.width, se = K.height, ue = _l.a.CreateCanvas(re, se).getContext("2d");
+ if (!ue)
+ throw new Error("Unable to get 2d context for CreateGroundFromHeightMap");
+ if (!i.isDisposed) {
+ ue.drawImage(K, 0, 0);
+ var he = ue.getImageData(0, 0, re, se).data;
+ ft.a.CreateGroundFromHeightMap({ width: o, height: a, subdivisions: s, minHeight: p, maxHeight: m, colorFilter: S, buffer: he, bufferWidth: re, bufferHeight: se, alphaFilter: O }).applyToMesh(k, I), G && G(k), k._setReady(!0);
+ }
+ }, function() {
+ }, i.offlineProvider), k;
+ }, r;
+ }();
+ ft.a.CreateTorus = function(r) {
+ for (var t = [], e = [], n = [], i = [], o = r.diameter || 1, a = r.thickness || 0.5, s = r.tessellation || 16, p = r.sideOrientation === 0 ? 0 : r.sideOrientation || ft.a.DEFAULTSIDE, m = s + 1, S = 0; S <= s; S++)
+ for (var O = S / s, I = S * Math.PI * 2 / s - Math.PI / 2, G = c.a.Translation(o / 2, 0, 0).multiply(c.a.RotationY(I)), k = 0; k <= s; k++) {
+ var K = 1 - k / s, re = k * Math.PI * 2 / s + Math.PI, se = Math.cos(re), ue = Math.sin(re), he = new c.e(se, ue, 0), pe = he.scale(a / 2), ve = new c.d(O, K);
+ pe = c.e.TransformCoordinates(pe, G), he = c.e.TransformNormal(he, G), e.push(pe.x, pe.y, pe.z), n.push(he.x, he.y, he.z), i.push(ve.x, ve.y);
+ var Ee = (S + 1) % m, Ae = (k + 1) % m;
+ t.push(S * m + k), t.push(S * m + Ae), t.push(Ee * m + k), t.push(S * m + Ae), t.push(Ee * m + Ae), t.push(Ee * m + k);
+ }
+ ft.a._ComputeSides(p, e, t, n, i, r.frontUVs, r.backUVs);
+ var Ie = new ft.a();
+ return Ie.indices = t, Ie.positions = e, Ie.normals = n, Ie.uvs = i, Ie;
+ }, we.a.CreateTorus = function(r, t, e, n, i, o, a) {
+ var s = { diameter: t, thickness: e, tessellation: n, sideOrientation: a, updatable: o };
+ return bo.CreateTorus(r, s, i);
+ };
+ var Pn, Hr, bo = function() {
+ function r() {
+ }
+ return r.CreateTorus = function(t, e, n) {
+ var i = new we.a(t, n);
+ return e.sideOrientation = we.a._GetDefaultSideOrientation(e.sideOrientation), i._originalBuilderSideOrientation = e.sideOrientation, ft.a.CreateTorus(e).applyToMesh(i, e.updatable), i;
+ }, r;
+ }(), Vi = l(53), ml = function() {
+ function r() {
+ }
+ return r.GetDefaults = function(t) {
+ var e = new r();
+ return e.canvasOptions = { antialias: !0, depth: !0, stencil: !t || t.isStencilEnable, alpha: !0, multiview: !1, framebufferScaleFactor: 1 }, e.newCanvasCssStyle = "position:absolute; bottom:0px;right:0px;z-index:10;width:90%;height:100%;background-color: #000000;", e;
+ }, r;
+ }(), Wd = function() {
+ function r(t, e) {
+ var n = this;
+ if (e === void 0 && (e = ml.GetDefaults()), this._options = e, this._canvas = null, this.xrLayer = null, this.onXRLayerInitObservable = new P.c(), this._engine = t.scene.getEngine(), e.canvasElement)
+ this._setManagedOutputCanvas(e.canvasElement);
+ else {
+ var i = document.createElement("canvas");
+ i.style.cssText = this._options.newCanvasCssStyle || "position:absolute; bottom:0px;right:0px;", this._setManagedOutputCanvas(i);
+ }
+ t.onXRSessionInit.add(function() {
+ n._addCanvas();
+ }), t.onXRSessionEnded.add(function() {
+ n._removeCanvas();
+ });
+ }
+ return r.prototype.dispose = function() {
+ this._removeCanvas(), this._setManagedOutputCanvas(null);
+ }, r.prototype.initializeXRLayerAsync = function(t) {
+ var e = this, n = function() {
+ var i = new XRWebGLLayer(t, e.canvasContext, e._options.canvasOptions);
+ return e.onXRLayerInitObservable.notifyObservers(i), i;
+ };
+ return this.canvasContext.makeXRCompatible ? this.canvasContext.makeXRCompatible().then(function() {
+ return e.xrLayer = n(), e.xrLayer;
+ }) : (this.xrLayer = n(), Promise.resolve(this.xrLayer));
+ }, r.prototype._addCanvas = function() {
+ var t = this;
+ this._canvas && this._canvas !== this._engine.getRenderingCanvas() && document.body.appendChild(this._canvas), this.xrLayer ? this._setCanvasSize(!0) : this.onXRLayerInitObservable.addOnce(function(e) {
+ t._setCanvasSize(!0, e);
+ });
+ }, r.prototype._removeCanvas = function() {
+ this._canvas && document.body.contains(this._canvas) && this._canvas !== this._engine.getRenderingCanvas() && document.body.removeChild(this._canvas), this._setCanvasSize(!1);
+ }, r.prototype._setCanvasSize = function(t, e) {
+ t === void 0 && (t = !0), e === void 0 && (e = this.xrLayer), this._canvas && (t ? e && (this._canvas !== this._engine.getRenderingCanvas() ? (this._canvas.style.width = e.framebufferWidth + "px", this._canvas.style.height = e.framebufferHeight + "px") : this._engine.setSize(e.framebufferWidth, e.framebufferHeight)) : this._originalCanvasSize && (this._canvas !== this._engine.getRenderingCanvas() ? (this._canvas.style.width = this._originalCanvasSize.width + "px", this._canvas.style.height = this._originalCanvasSize.height + "px") : this._engine.setSize(this._originalCanvasSize.width, this._originalCanvasSize.height)));
+ }, r.prototype._setManagedOutputCanvas = function(t) {
+ this._removeCanvas(), t ? (this._originalCanvasSize = { width: t.offsetWidth, height: t.offsetHeight }, this._canvas = t, this.canvasContext = this._canvas.getContext("webgl2"), this.canvasContext || (this.canvasContext = this._canvas.getContext("webgl"))) : (this._canvas = null, this.canvasContext = null);
+ }, r;
+ }(), gl = function() {
+ function r(t) {
+ this.scene = t, this._sessionEnded = !1, this.baseLayer = null, this.currentTimestamp = -1, this.defaultHeightCompensation = 1.7, this.onXRFrameObservable = new P.c(), this.onXRReferenceSpaceChanged = new P.c(), this.onXRSessionEnded = new P.c(), this.onXRSessionInit = new P.c();
+ }
+ return Object.defineProperty(r.prototype, "referenceSpace", { get: function() {
+ return this._referenceSpace;
+ }, set: function(t) {
+ this._referenceSpace = t, this.onXRReferenceSpaceChanged.notifyObservers(this._referenceSpace);
+ }, enumerable: !1, configurable: !0 }), r.prototype.dispose = function() {
+ this._sessionEnded || this.exitXRAsync(), this.onXRFrameObservable.clear(), this.onXRSessionEnded.clear(), this.onXRReferenceSpaceChanged.clear(), this.onXRSessionInit.clear();
+ }, r.prototype.exitXRAsync = function() {
+ return this.session && !this._sessionEnded ? (this._sessionEnded = !0, this.session.end().catch(function(t) {
+ h.a.Warn("Could not end XR session.");
+ })) : Promise.resolve();
+ }, r.prototype.getRenderTargetTextureForEye = function(t) {
+ return this._rttProvider.getRenderTargetForEye(t);
+ }, r.prototype.getWebXRRenderTarget = function(t) {
+ var e = this.scene.getEngine();
+ return this._xrNavigator.xr.native ? this._xrNavigator.xr.getWebXRRenderTarget(e) : ((t = t || ml.GetDefaults(e)).canvasElement = e.getRenderingCanvas() || void 0, new Wd(this, t));
+ }, r.prototype.initializeAsync = function() {
+ return this._xrNavigator = navigator, this._xrNavigator.xr ? Promise.resolve() : Promise.reject("WebXR not available");
+ }, r.prototype.initializeSessionAsync = function(t, e) {
+ var n = this;
+ return t === void 0 && (t = "immersive-vr"), e === void 0 && (e = {}), this._xrNavigator.xr.requestSession(t, e).then(function(i) {
+ return n.session = i, n.onXRSessionInit.notifyObservers(i), n._sessionEnded = !1, n.session.addEventListener("end", function() {
+ var o = n.scene.getEngine();
+ n._sessionEnded = !0, n._rttProvider = null, o.framebufferDimensionsObject = null, o.restoreDefaultFramebuffer(), o.customAnimationFrameRequester = null, n.onXRSessionEnded.notifyObservers(null), o._renderLoop();
+ }, { once: !0 }), n.session;
+ });
+ }, r.prototype.isSessionSupportedAsync = function(t) {
+ return r.IsSessionSupportedAsync(t);
+ }, r.prototype.resetReferenceSpace = function() {
+ this.referenceSpace = this.baseReferenceSpace;
+ }, r.prototype.runXRRenderLoop = function() {
+ var t = this, e = this.scene.getEngine();
+ if (e.customAnimationFrameRequester = { requestAnimationFrame: this.session.requestAnimationFrame.bind(this.session), renderFunction: function(i, o) {
+ t._sessionEnded || (t.currentFrame = o, t.currentTimestamp = i, o && (e.framebufferDimensionsObject = t.baseLayer, t.onXRFrameObservable.notifyObservers(o), e._renderLoop(), e.framebufferDimensionsObject = null));
+ } }, this._xrNavigator.xr.native)
+ this._rttProvider = this._xrNavigator.xr.getNativeRenderTargetProvider(this.session, this._createRenderTargetTexture.bind(this));
+ else {
+ var n = this._createRenderTargetTexture(this.baseLayer.framebufferWidth, this.baseLayer.framebufferHeight, this.baseLayer.framebuffer);
+ this._rttProvider = { getRenderTargetForEye: function() {
+ return n;
+ } }, e.framebufferDimensionsObject = this.baseLayer;
+ }
+ typeof window < "u" && window.cancelAnimationFrame && window.cancelAnimationFrame(e._frameHandler), e._renderLoop();
+ }, r.prototype.setReferenceSpaceTypeAsync = function(t) {
+ var e = this;
+ return t === void 0 && (t = "local-floor"), this.session.requestReferenceSpace(t).then(function(n) {
+ return n;
+ }, function(n) {
+ return h.a.Error("XR.requestReferenceSpace failed for the following reason: "), h.a.Error(n), h.a.Log('Defaulting to universally-supported "viewer" reference space type.'), e.session.requestReferenceSpace("viewer").then(function(i) {
+ var o = new XRRigidTransform({ x: 0, y: -e.defaultHeightCompensation, z: 0 });
+ return i.getOffsetReferenceSpace(o);
+ }, function(i) {
+ throw h.a.Error(i), 'XR initialization failed: required "viewer" reference space type not supported.';
+ });
+ }).then(function(n) {
+ return e.session.requestReferenceSpace("viewer").then(function(i) {
+ return e.viewerReferenceSpace = i, n;
+ });
+ }).then(function(n) {
+ return e.referenceSpace = e.baseReferenceSpace = n, e.referenceSpace;
+ });
+ }, r.prototype.updateRenderStateAsync = function(t) {
+ return t.baseLayer && (this.baseLayer = t.baseLayer), this.session.updateRenderState(t);
+ }, r.IsSessionSupportedAsync = function(t) {
+ if (!navigator.xr)
+ return Promise.resolve(!1);
+ var e = navigator.xr.isSessionSupported || navigator.xr.supportsSession;
+ return e ? e.call(navigator.xr, t).then(function(n) {
+ var i = n === void 0 || n;
+ return Promise.resolve(i);
+ }).catch(function(n) {
+ return h.a.Warn(n), Promise.resolve(!1);
+ }) : Promise.resolve(!1);
+ }, r.prototype._createRenderTargetTexture = function(t, e, n) {
+ n === void 0 && (n = null);
+ var i = new Rt.a(this.scene.getEngine(), Rt.b.Unknown, !0);
+ i.width = t, i.height = e, i._framebuffer = n;
+ var o = new bn("XR renderTargetTexture", { width: t, height: e }, this.scene, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, !0);
+ return o._texture = i, o;
+ }, r;
+ }();
+ (function(r) {
+ r[r.ENTERING_XR = 0] = "ENTERING_XR", r[r.EXITING_XR = 1] = "EXITING_XR", r[r.IN_XR = 2] = "IN_XR", r[r.NOT_IN_XR = 3] = "NOT_IN_XR";
+ })(Pn || (Pn = {})), function(r) {
+ r[r.NOT_TRACKING = 0] = "NOT_TRACKING", r[r.TRACKING_LOST = 1] = "TRACKING_LOST", r[r.TRACKING = 2] = "TRACKING";
+ }(Hr || (Hr = {}));
+ var Ai, Xd = function() {
+ function r(t, e) {
+ if (e === void 0 && (e = null), this.scene = t, this._pointerDownOnMeshAsked = !1, this._isActionableMesh = !1, this._teleportationRequestInitiated = !1, this._teleportationBackRequestInitiated = !1, this._rotationRightAsked = !1, this._rotationLeftAsked = !1, this._dpadPressed = !0, this._activePointer = !1, this._id = r._idCounter++, e)
+ this._gazeTracker = e.clone("gazeTracker");
+ else {
+ this._gazeTracker = we.a.CreateTorus("gazeTracker", 35e-4, 25e-4, 20, t, !1), this._gazeTracker.bakeCurrentTransformIntoVertices(), this._gazeTracker.isPickable = !1, this._gazeTracker.isVisible = !1;
+ var n = new kt.a("targetMat", t);
+ n.specularColor = C.a.Black(), n.emissiveColor = new C.a(0.7, 0.7, 0.7), n.backFaceCulling = !1, this._gazeTracker.material = n;
+ }
+ }
+ return r.prototype._getForwardRay = function(t) {
+ return new An.a(c.e.Zero(), new c.e(0, 0, t));
+ }, r.prototype._selectionPointerDown = function() {
+ this._pointerDownOnMeshAsked = !0, this._currentHit && this.scene.simulatePointerDown(this._currentHit, { pointerId: this._id });
+ }, r.prototype._selectionPointerUp = function() {
+ this._currentHit && this.scene.simulatePointerUp(this._currentHit, { pointerId: this._id }), this._pointerDownOnMeshAsked = !1;
+ }, r.prototype._activatePointer = function() {
+ this._activePointer = !0;
+ }, r.prototype._deactivatePointer = function() {
+ this._activePointer = !1;
+ }, r.prototype._updatePointerDistance = function(t) {
+ }, r.prototype.dispose = function() {
+ this._interactionsEnabled = !1, this._teleportationEnabled = !1, this._gazeTracker && this._gazeTracker.dispose();
+ }, r._idCounter = 0, r;
+ }(), hb = function(r) {
+ function t(e, n, i) {
+ var o = r.call(this, n, i) || this;
+ o.webVRController = e, o._laserPointer = we.a.CreateCylinder("laserPointer", 1, 4e-3, 2e-4, 20, 1, n, !1);
+ var a = new kt.a("laserPointerMat", n);
+ if (a.emissiveColor = new C.a(0.7, 0.7, 0.7), a.alpha = 0.6, o._laserPointer.material = a, o._laserPointer.rotation.x = Math.PI / 2, o._laserPointer.position.z = -0.5, o._laserPointer.isVisible = !1, o._laserPointer.isPickable = !1, !e.mesh) {
+ var s = new we.a("preloadControllerMesh", n), p = new we.a(mo.POINTING_POSE, n);
+ p.rotation.x = -0.7, s.addChild(p), e.attachToMesh(s);
+ }
+ return o._setLaserPointerParent(e.mesh), o._meshAttachedObserver = e._meshAttachedObservable.add(function(m) {
+ o._setLaserPointerParent(m);
+ }), o;
+ }
+ return Object(u.d)(t, r), t.prototype._getForwardRay = function(e) {
+ return this.webVRController.getForwardRay(e);
+ }, t.prototype._activatePointer = function() {
+ r.prototype._activatePointer.call(this), this._laserPointer.isVisible = !0;
+ }, t.prototype._deactivatePointer = function() {
+ r.prototype._deactivatePointer.call(this), this._laserPointer.isVisible = !1;
+ }, t.prototype._setLaserPointerColor = function(e) {
+ this._laserPointer.material.emissiveColor = e;
+ }, t.prototype._setLaserPointerLightingDisabled = function(e) {
+ this._laserPointer.material.disableLighting = e;
+ }, t.prototype._setLaserPointerParent = function(e) {
+ var n = function(s) {
+ s.isPickable = !1, s.getChildMeshes().forEach(function(p) {
+ n(p);
+ });
+ };
+ n(e);
+ var i = e.getChildren(void 0, !1), o = e;
+ this.webVRController._pointingPoseNode = null;
+ for (var a = 0; a < i.length; a++)
+ if (i[a].name && i[a].name.indexOf(mo.POINTING_POSE) >= 0) {
+ o = i[a], this.webVRController._pointingPoseNode = o;
+ break;
+ }
+ this._laserPointer.parent = o;
+ }, t.prototype._updatePointerDistance = function(e) {
+ e === void 0 && (e = 100), this._laserPointer.scaling.y = e, this._laserPointer.position.z = -e / 2;
+ }, t.prototype.dispose = function() {
+ r.prototype.dispose.call(this), this._laserPointer.dispose(), this._meshAttachedObserver && this.webVRController._meshAttachedObservable.remove(this._meshAttachedObserver);
+ }, t;
+ }(Xd), Yd = function(r) {
+ function t(e, n) {
+ var i = r.call(this, n) || this;
+ return i.getCamera = e, i;
+ }
+ return Object(u.d)(t, r), t.prototype._getForwardRay = function(e) {
+ var n = this.getCamera();
+ return n ? n.getForwardRay(e) : new An.a(c.e.Zero(), c.e.Forward());
+ }, t;
+ }(Xd), db = function() {
+ }, Kd = function() {
+ function r(t, e) {
+ var n = this;
+ if (e === void 0 && (e = {}), this.webVROptions = e, this._webVRsupported = !1, this._webVRready = !1, this._webVRrequesting = !1, this._webVRpresenting = !1, this._fullscreenVRpresenting = !1, this.enableGazeEvenWhenNoPointerLock = !1, this.exitVROnDoubleTap = !0, this.onEnteringVRObservable = new P.c(), this.onAfterEnteringVRObservable = new P.c(), this.onExitingVRObservable = new P.c(), this.onControllerMeshLoadedObservable = new P.c(), this._useCustomVRButton = !1, this._teleportationRequested = !1, this._teleportActive = !1, this._floorMeshesCollection = [], this._teleportationMode = r.TELEPORTATIONMODE_CONSTANTTIME, this._teleportationTime = 122, this._teleportationSpeed = 20, this._rotationAllowed = !0, this._teleportBackwardsVector = new c.e(0, -1, -1), this._isDefaultTeleportationTarget = !0, this._teleportationFillColor = "#444444", this._teleportationBorderColor = "#FFFFFF", this._rotationAngle = 0, this._haloCenter = new c.e(0, 0, 0), this._padSensibilityUp = 0.65, this._padSensibilityDown = 0.35, this._leftController = null, this._rightController = null, this._gazeColor = new C.a(0.7, 0.7, 0.7), this._laserColor = new C.a(0.7, 0.7, 0.7), this._pickedLaserColor = new C.a(0.2, 0.2, 1), this._pickedGazeColor = new C.a(0, 0, 1), this.onNewMeshSelected = new P.c(), this.onMeshSelectedWithController = new P.c(), this.onNewMeshPicked = new P.c(), this.onBeforeCameraTeleport = new P.c(), this.onAfterCameraTeleport = new P.c(), this.onSelectedMeshUnselected = new P.c(), this.teleportationEnabled = !0, this._teleportationInitialized = !1, this._interactionsEnabled = !1, this._interactionsRequested = !1, this._displayGaze = !0, this._displayLaserPointer = !0, this.updateGazeTrackerScale = !0, this.updateGazeTrackerColor = !0, this.updateControllerLaserColor = !0, this.requestPointerLockOnFullScreen = !0, this.xrTestDone = !1, this._onResize = function() {
+ n.moveButtonToBottomRight(), n._fullscreenVRpresenting && n._webVRready && n.exitVR();
+ }, this._onFullscreenChange = function() {
+ var o = document;
+ o.fullscreen !== void 0 ? n._fullscreenVRpresenting = document.fullscreen : o.mozFullScreen !== void 0 ? n._fullscreenVRpresenting = o.mozFullScreen : o.webkitIsFullScreen !== void 0 ? n._fullscreenVRpresenting = o.webkitIsFullScreen : o.msIsFullScreen !== void 0 ? n._fullscreenVRpresenting = o.msIsFullScreen : document.msFullscreenElement !== void 0 && (n._fullscreenVRpresenting = document.msFullscreenElement), !n._fullscreenVRpresenting && n._inputElement && (n.exitVR(), !n._useCustomVRButton && n._btnVR && (n._btnVR.style.top = n._inputElement.offsetTop + n._inputElement.offsetHeight - 70 + "px", n._btnVR.style.left = n._inputElement.offsetLeft + n._inputElement.offsetWidth - 100 + "px", n.updateButtonVisibility()));
+ }, this._cachedAngularSensibility = { angularSensibilityX: null, angularSensibilityY: null, angularSensibility: null }, this.beforeRender = function() {
+ n._leftController && n._leftController._activePointer && n._castRayAndSelectObject(n._leftController), n._rightController && n._rightController._activePointer && n._castRayAndSelectObject(n._rightController), n._noControllerIsActive && (n._scene.getEngine().isPointerLock || n.enableGazeEvenWhenNoPointerLock) ? n._castRayAndSelectObject(n._cameraGazer) : n._cameraGazer._gazeTracker.isVisible = !1;
+ }, this._onNewGamepadConnected = function(o) {
+ if (o.type !== Sn.POSE_ENABLED)
+ o.leftStick && o.onleftstickchanged(function(p) {
+ n._teleportationInitialized && n.teleportationEnabled && (!n._leftController && !n._rightController || n._leftController && !n._leftController._activePointer && n._rightController && !n._rightController._activePointer) && (n._checkTeleportWithRay(p, n._cameraGazer), n._checkTeleportBackwards(p, n._cameraGazer));
+ }), o.rightStick && o.onrightstickchanged(function(p) {
+ n._teleportationInitialized && n._checkRotate(p, n._cameraGazer);
+ }), o.type === Sn.XBOX && (o.onbuttondown(function(p) {
+ n._interactionsEnabled && p === kn.A && n._cameraGazer._selectionPointerDown();
+ }), o.onbuttonup(function(p) {
+ n._interactionsEnabled && p === kn.A && n._cameraGazer._selectionPointerUp();
+ }));
+ else {
+ var a = o, s = new hb(a, n._scene, n._cameraGazer._gazeTracker);
+ a.hand === "right" || n._leftController && n._leftController.webVRController != a ? n._rightController = s : n._leftController = s, n._tryEnableInteractionOnController(s);
+ }
+ }, this._tryEnableInteractionOnController = function(o) {
+ n._interactionsRequested && !o._interactionsEnabled && n._enableInteractionOnController(o), n._teleportationRequested && !o._teleportationEnabled && n._enableTeleportationOnController(o);
+ }, this._onNewGamepadDisconnected = function(o) {
+ o instanceof mr && (o.hand === "left" && n._leftController != null && (n._leftController.dispose(), n._leftController = null), o.hand === "right" && n._rightController != null && (n._rightController.dispose(), n._rightController = null));
+ }, this._workingVector = c.e.Zero(), this._workingQuaternion = c.b.Identity(), this._workingMatrix = c.a.Identity(), this._scene = t, this._inputElement = t.getEngine().getInputElement(), "getVRDisplays" in navigator || (e.useXR = !0), e.createFallbackVRDeviceOrientationFreeCamera === void 0 && (e.createFallbackVRDeviceOrientationFreeCamera = !0), e.createDeviceOrientationCamera === void 0 && (e.createDeviceOrientationCamera = !0), e.laserToggle === void 0 && (e.laserToggle = !0), e.defaultHeight === void 0 && (e.defaultHeight = 1.7), e.useCustomVRButton && (this._useCustomVRButton = !0, e.customVRButton && (this._btnVR = e.customVRButton)), e.rayLength && (this._rayLength = e.rayLength), this._defaultHeight = e.defaultHeight, e.positionScale && (this._rayLength *= e.positionScale, this._defaultHeight *= e.positionScale), this._hasEnteredVR = !1, this._scene.activeCamera ? this._position = this._scene.activeCamera.position.clone() : this._position = new c.e(0, this._defaultHeight, 0), e.createDeviceOrientationCamera || !this._scene.activeCamera) {
+ if (this._deviceOrientationCamera = new _s("deviceOrientationVRHelper", this._position.clone(), t), this._scene.activeCamera && (this._deviceOrientationCamera.minZ = this._scene.activeCamera.minZ, this._deviceOrientationCamera.maxZ = this._scene.activeCamera.maxZ, this._scene.activeCamera instanceof fr && this._scene.activeCamera.rotation)) {
+ var i = this._scene.activeCamera;
+ i.rotationQuaternion ? this._deviceOrientationCamera.rotationQuaternion.copyFrom(i.rotationQuaternion) : this._deviceOrientationCamera.rotationQuaternion.copyFrom(c.b.RotationYawPitchRoll(i.rotation.y, i.rotation.x, i.rotation.z)), this._deviceOrientationCamera.rotation = i.rotation.clone();
+ }
+ this._scene.activeCamera = this._deviceOrientationCamera, this._inputElement && this._scene.activeCamera.attachControl();
+ } else
+ this._existingCamera = this._scene.activeCamera;
+ this.webVROptions.useXR && navigator.xr ? gl.IsSessionSupportedAsync("immersive-vr").then(function(o) {
+ o ? (h.a.Log("Using WebXR. It is recommended to use the WebXRDefaultExperience directly"), t.createDefaultXRExperienceAsync({ floorMeshes: e.floorMeshes || [] }).then(function(a) {
+ n.xr = a, n.xrTestDone = !0, n._cameraGazer = new Yd(function() {
+ return n.xr.baseExperience.camera;
+ }, t), n.xr.baseExperience.onStateChangedObservable.add(function(s) {
+ switch (s) {
+ case Pn.ENTERING_XR:
+ n.onEnteringVRObservable.notifyObservers(n), n._interactionsEnabled || n.xr.pointerSelection.detach(), n.xr.pointerSelection.displayLaserPointer = n._displayLaserPointer;
+ break;
+ case Pn.EXITING_XR:
+ n.onExitingVRObservable.notifyObservers(n), n._scene.getEngine().resize();
+ break;
+ case Pn.IN_XR:
+ n._hasEnteredVR = !0;
+ break;
+ case Pn.NOT_IN_XR:
+ n._hasEnteredVR = !1;
+ }
+ });
+ })) : n.completeVRInit(t, e);
+ }) : this.completeVRInit(t, e);
+ }
+ return Object.defineProperty(r.prototype, "onEnteringVR", { get: function() {
+ return this.onEnteringVRObservable;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "onExitingVR", { get: function() {
+ return this.onExitingVRObservable;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "onControllerMeshLoaded", { get: function() {
+ return this.onControllerMeshLoadedObservable;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "teleportationTarget", { get: function() {
+ return this._teleportationTarget;
+ }, set: function(t) {
+ t && (t.name = "teleportationTarget", this._isDefaultTeleportationTarget = !1, this._teleportationTarget = t);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "gazeTrackerMesh", { get: function() {
+ return this._cameraGazer._gazeTracker;
+ }, set: function(t) {
+ t && (this._cameraGazer._gazeTracker && this._cameraGazer._gazeTracker.dispose(), this._leftController && this._leftController._gazeTracker && this._leftController._gazeTracker.dispose(), this._rightController && this._rightController._gazeTracker && this._rightController._gazeTracker.dispose(), this._cameraGazer._gazeTracker = t, this._cameraGazer._gazeTracker.bakeCurrentTransformIntoVertices(), this._cameraGazer._gazeTracker.isPickable = !1, this._cameraGazer._gazeTracker.isVisible = !1, this._cameraGazer._gazeTracker.name = "gazeTracker", this._leftController && (this._leftController._gazeTracker = this._cameraGazer._gazeTracker.clone("gazeTracker")), this._rightController && (this._rightController._gazeTracker = this._cameraGazer._gazeTracker.clone("gazeTracker")));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "leftControllerGazeTrackerMesh", { get: function() {
+ return this._leftController ? this._leftController._gazeTracker : null;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "rightControllerGazeTrackerMesh", { get: function() {
+ return this._rightController ? this._rightController._gazeTracker : null;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "displayGaze", { get: function() {
+ return this._displayGaze;
+ }, set: function(t) {
+ this._displayGaze = t, t || (this._cameraGazer._gazeTracker.isVisible = !1, this._leftController && (this._leftController._gazeTracker.isVisible = !1), this._rightController && (this._rightController._gazeTracker.isVisible = !1));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "displayLaserPointer", { get: function() {
+ return this._displayLaserPointer;
+ }, set: function(t) {
+ this._displayLaserPointer = t, t ? (this._rightController && this._rightController._activatePointer(), this._leftController && this._leftController._activatePointer()) : (this._rightController && (this._rightController._deactivatePointer(), this._rightController._gazeTracker.isVisible = !1), this._leftController && (this._leftController._deactivatePointer(), this._leftController._gazeTracker.isVisible = !1));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "deviceOrientationCamera", { get: function() {
+ return this._deviceOrientationCamera;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "currentVRCamera", { get: function() {
+ return this._webVRready ? this._webVRCamera : this._scene.activeCamera;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "webVRCamera", { get: function() {
+ return this._webVRCamera;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "vrDeviceOrientationCamera", { get: function() {
+ return this._vrDeviceOrientationCamera;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "vrButton", { get: function() {
+ return this._btnVR;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "_teleportationRequestInitiated", { get: function() {
+ return this._cameraGazer._teleportationRequestInitiated || this._leftController !== null && this._leftController._teleportationRequestInitiated || this._rightController !== null && this._rightController._teleportationRequestInitiated;
+ }, enumerable: !1, configurable: !0 }), r.prototype.completeVRInit = function(t, e) {
+ var n = this;
+ if (this.xrTestDone = !0, e.createFallbackVRDeviceOrientationFreeCamera && (e.useMultiview && (e.vrDeviceOrientationCameraMetrics || (e.vrDeviceOrientationCameraMetrics = vo.GetDefault()), e.vrDeviceOrientationCameraMetrics.multiviewEnabled = !0), this._vrDeviceOrientationCamera = new gs("VRDeviceOrientationVRHelper", this._position, this._scene, !0, e.vrDeviceOrientationCameraMetrics), this._vrDeviceOrientationCamera.angularSensibility = Number.MAX_VALUE), this._webVRCamera = new bs("WebVRHelper", this._position, this._scene, e), this._webVRCamera.useStandingMatrix(), this._cameraGazer = new Yd(function() {
+ return n.currentVRCamera;
+ }, t), !this._useCustomVRButton) {
+ this._btnVR = document.createElement("BUTTON"), this._btnVR.className = "babylonVRicon", this._btnVR.id = "babylonVRiconbtn", this._btnVR.title = "Click to switch to VR";
+ var i = ".babylonVRicon { position: absolute; right: 20px; height: 50px; width: 80px; background-color: rgba(51,51,51,0.7); background-image: url(" + (window.SVGSVGElement ? "data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%222048%22%20height%3D%221152%22%20viewBox%3D%220%200%202048%201152%22%20version%3D%221.1%22%3E%3Cpath%20transform%3D%22rotate%28180%201024%2C576.0000000000001%29%22%20d%3D%22m1109%2C896q17%2C0%2030%2C-12t13%2C-30t-12.5%2C-30.5t-30.5%2C-12.5l-170%2C0q-18%2C0%20-30.5%2C12.5t-12.5%2C30.5t13%2C30t30%2C12l170%2C0zm-85%2C256q59%2C0%20132.5%2C-1.5t154.5%2C-5.5t164.5%2C-11.5t163%2C-20t150%2C-30t124.5%2C-41.5q23%2C-11%2042%2C-24t38%2C-30q27%2C-25%2041%2C-61.5t14%2C-72.5l0%2C-257q0%2C-123%20-47%2C-232t-128%2C-190t-190%2C-128t-232%2C-47l-81%2C0q-37%2C0%20-68.5%2C14t-60.5%2C34.5t-55.5%2C45t-53%2C45t-53%2C34.5t-55.5%2C14t-55.5%2C-14t-53%2C-34.5t-53%2C-45t-55.5%2C-45t-60.5%2C-34.5t-68.5%2C-14l-81%2C0q-123%2C0%20-232%2C47t-190%2C128t-128%2C190t-47%2C232l0%2C257q0%2C68%2038%2C115t97%2C73q54%2C24%20124.5%2C41.5t150%2C30t163%2C20t164.5%2C11.5t154.5%2C5.5t132.5%2C1.5zm939%2C-298q0%2C39%20-24.5%2C67t-58.5%2C42q-54%2C23%20-122%2C39.5t-143.5%2C28t-155.5%2C19t-157%2C11t-148.5%2C5t-129.5%2C1.5q-59%2C0%20-130%2C-1.5t-148%2C-5t-157%2C-11t-155.5%2C-19t-143.5%2C-28t-122%2C-39.5q-34%2C-14%20-58.5%2C-42t-24.5%2C-67l0%2C-257q0%2C-106%2040.5%2C-199t110%2C-162.5t162.5%2C-109.5t199%2C-40l81%2C0q27%2C0%2052%2C14t50%2C34.5t51%2C44.5t55.5%2C44.5t63.5%2C34.5t74%2C14t74%2C-14t63.5%2C-34.5t55.5%2C-44.5t51%2C-44.5t50%2C-34.5t52%2C-14l14%2C0q37%2C0%2070%2C0.5t64.5%2C4.5t63.5%2C12t68%2C23q71%2C30%20128.5%2C78.5t98.5%2C110t63.5%2C133.5t22.5%2C149l0%2C257z%22%20fill%3D%22white%22%20/%3E%3C/svg%3E%0A" : "https://cdn.babylonjs.com/Assets/vrButton.png") + "); background-size: 80%; background-repeat:no-repeat; background-position: center; border: none; outline: none; transition: transform 0.125s ease-out } .babylonVRicon:hover { transform: scale(1.05) } .babylonVRicon:active {background-color: rgba(51,51,51,1) } .babylonVRicon:focus {background-color: rgba(51,51,51,1) }";
+ i += ".babylonVRicon.vrdisplaypresenting { display: none; }";
+ var o = document.createElement("style");
+ o.appendChild(document.createTextNode(i)), document.getElementsByTagName("head")[0].appendChild(o), this.moveButtonToBottomRight();
+ }
+ this._btnVR && this._btnVR.addEventListener("click", function() {
+ n.isInVRMode ? n._scene.getEngine().disableVR() : n.enterVR();
+ });
+ var a = this._scene.getEngine().getHostWindow();
+ a && (a.addEventListener("resize", this._onResize), document.addEventListener("fullscreenchange", this._onFullscreenChange, !1), document.addEventListener("mozfullscreenchange", this._onFullscreenChange, !1), document.addEventListener("webkitfullscreenchange", this._onFullscreenChange, !1), document.addEventListener("msfullscreenchange", this._onFullscreenChange, !1), document.onmsfullscreenchange = this._onFullscreenChange, e.createFallbackVRDeviceOrientationFreeCamera ? this.displayVRButton() : this._scene.getEngine().onVRDisplayChangedObservable.add(function(s) {
+ s.vrDisplay && n.displayVRButton();
+ }), this._onKeyDown = function(s) {
+ s.keyCode === 27 && n.isInVRMode && n.exitVR();
+ }, document.addEventListener("keydown", this._onKeyDown), this._scene.onPrePointerObservable.add(function() {
+ n._hasEnteredVR && n.exitVROnDoubleTap && (n.exitVR(), n._fullscreenVRpresenting && n._scene.getEngine().exitFullscreen());
+ }, Et.a.POINTERDOUBLETAP, !1), this._onVRDisplayChanged = function(s) {
+ return n.onVRDisplayChanged(s);
+ }, this._onVrDisplayPresentChange = function() {
+ return n.onVrDisplayPresentChange();
+ }, this._onVRRequestPresentStart = function() {
+ n._webVRrequesting = !0, n.updateButtonVisibility();
+ }, this._onVRRequestPresentComplete = function() {
+ n._webVRrequesting = !1, n.updateButtonVisibility();
+ }, t.getEngine().onVRDisplayChangedObservable.add(this._onVRDisplayChanged), t.getEngine().onVRRequestPresentStart.add(this._onVRRequestPresentStart), t.getEngine().onVRRequestPresentComplete.add(this._onVRRequestPresentComplete), a.addEventListener("vrdisplaypresentchange", this._onVrDisplayPresentChange), t.onDisposeObservable.add(function() {
+ n.dispose();
+ }), this._webVRCamera.onControllerMeshLoadedObservable.add(function(s) {
+ return n._onDefaultMeshLoaded(s);
+ }), this._scene.gamepadManager.onGamepadConnectedObservable.add(this._onNewGamepadConnected), this._scene.gamepadManager.onGamepadDisconnectedObservable.add(this._onNewGamepadDisconnected), this.updateButtonVisibility(), this._circleEase = new it(), this._circleEase.setEasingMode(je.EASINGMODE_EASEINOUT), this._teleportationEasing = this._circleEase, t.onPointerObservable.add(function(s) {
+ n._interactionsEnabled && t.activeCamera === n.vrDeviceOrientationCamera && s.event.pointerType === "mouse" && (s.type === Et.a.POINTERDOWN ? n._cameraGazer._selectionPointerDown() : s.type === Et.a.POINTERUP && n._cameraGazer._selectionPointerUp());
+ }), this.webVROptions.floorMeshes && this.enableTeleportation({ floorMeshes: this.webVROptions.floorMeshes }));
+ }, r.prototype._onDefaultMeshLoaded = function(t) {
+ this._leftController && this._leftController.webVRController == t && t.mesh && this._leftController._setLaserPointerParent(t.mesh), this._rightController && this._rightController.webVRController == t && t.mesh && this._rightController._setLaserPointerParent(t.mesh);
+ try {
+ this.onControllerMeshLoadedObservable.notifyObservers(t);
+ } catch (e) {
+ h.a.Warn("Error in your custom logic onControllerMeshLoaded: " + e);
+ }
+ }, Object.defineProperty(r.prototype, "isInVRMode", { get: function() {
+ return this.xr && this.webVROptions.useXR && this.xr.baseExperience.state === Pn.IN_XR || this._webVRpresenting || this._fullscreenVRpresenting;
+ }, enumerable: !1, configurable: !0 }), r.prototype.onVrDisplayPresentChange = function() {
+ var t = this._scene.getEngine().getVRDevice();
+ if (t) {
+ var e = this._webVRpresenting;
+ this._webVRpresenting = t.isPresenting, e && !this._webVRpresenting && this.exitVR();
+ } else
+ h.a.Warn("Detected VRDisplayPresentChange on an unknown VRDisplay. Did you can enterVR on the vrExperienceHelper?");
+ this.updateButtonVisibility();
+ }, r.prototype.onVRDisplayChanged = function(t) {
+ this._webVRsupported = t.vrSupported, this._webVRready = !!t.vrDisplay, this._webVRpresenting = t.vrDisplay && t.vrDisplay.isPresenting, this.updateButtonVisibility();
+ }, r.prototype.moveButtonToBottomRight = function() {
+ if (this._inputElement && !this._useCustomVRButton && this._btnVR) {
+ var t = this._inputElement.getBoundingClientRect();
+ this._btnVR.style.top = t.top + t.height - 70 + "px", this._btnVR.style.left = t.left + t.width - 100 + "px";
+ }
+ }, r.prototype.displayVRButton = function() {
+ this._useCustomVRButton || this._btnVRDisplayed || !this._btnVR || (document.body.appendChild(this._btnVR), this._btnVRDisplayed = !0);
+ }, r.prototype.updateButtonVisibility = function() {
+ this._btnVR && !this._useCustomVRButton && (this._btnVR.className = "babylonVRicon", this.isInVRMode ? this._btnVR.className += " vrdisplaypresenting" : (this._webVRready && (this._btnVR.className += " vrdisplayready"), this._webVRsupported && (this._btnVR.className += " vrdisplaysupported"), this._webVRrequesting && (this._btnVR.className += " vrdisplayrequesting")));
+ }, r.prototype.enterVR = function() {
+ var t = this;
+ if (this.xr)
+ this.xr.baseExperience.enterXRAsync("immersive-vr", "local-floor", this.xr.renderTarget);
+ else {
+ if (this.onEnteringVRObservable)
+ try {
+ this.onEnteringVRObservable.notifyObservers(this);
+ } catch (o) {
+ h.a.Warn("Error in your custom logic onEnteringVR: " + o);
+ }
+ if (this._scene.activeCamera) {
+ if (this._position = this._scene.activeCamera.position.clone(), this.vrDeviceOrientationCamera && (this.vrDeviceOrientationCamera.rotation = c.b.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles(), this.vrDeviceOrientationCamera.angularSensibility = 2e3), this.webVRCamera) {
+ var e = this.webVRCamera.deviceRotationQuaternion.toEulerAngles().y, n = c.b.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles().y - e, i = this.webVRCamera.rotationQuaternion.toEulerAngles().y;
+ this.webVRCamera.rotationQuaternion = c.b.FromEulerAngles(0, i + n, 0);
+ }
+ this._existingCamera = this._scene.activeCamera, this._existingCamera.angularSensibilityX && (this._cachedAngularSensibility.angularSensibilityX = this._existingCamera.angularSensibilityX, this._existingCamera.angularSensibilityX = Number.MAX_VALUE), this._existingCamera.angularSensibilityY && (this._cachedAngularSensibility.angularSensibilityY = this._existingCamera.angularSensibilityY, this._existingCamera.angularSensibilityY = Number.MAX_VALUE), this._existingCamera.angularSensibility && (this._cachedAngularSensibility.angularSensibility = this._existingCamera.angularSensibility, this._existingCamera.angularSensibility = Number.MAX_VALUE);
+ }
+ this._webVRrequesting || (this._webVRready ? this._webVRpresenting || (this._scene.getEngine().onVRRequestPresentComplete.addOnce(function(o) {
+ t.onAfterEnteringVRObservable.notifyObservers({ success: o });
+ }), this._webVRCamera.position = this._position, this._scene.activeCamera = this._webVRCamera) : this._vrDeviceOrientationCamera && (this._vrDeviceOrientationCamera.position = this._position, this._scene.activeCamera && (this._vrDeviceOrientationCamera.minZ = this._scene.activeCamera.minZ), this._scene.activeCamera = this._vrDeviceOrientationCamera, this._scene.getEngine().enterFullscreen(this.requestPointerLockOnFullScreen), this.updateButtonVisibility(), this._vrDeviceOrientationCamera.onViewMatrixChangedObservable.addOnce(function() {
+ t.onAfterEnteringVRObservable.notifyObservers({ success: !0 });
+ })), this._scene.activeCamera && this._inputElement && this._scene.activeCamera.attachControl(), this._interactionsEnabled && this._scene.registerBeforeRender(this.beforeRender), this._displayLaserPointer && [this._leftController, this._rightController].forEach(function(o) {
+ o && o._activatePointer();
+ }), this._hasEnteredVR = !0);
+ }
+ }, r.prototype.exitVR = function() {
+ if (this.xr)
+ this.xr.baseExperience.exitXRAsync();
+ else if (this._hasEnteredVR) {
+ if (this.onExitingVRObservable)
+ try {
+ this.onExitingVRObservable.notifyObservers(this);
+ } catch (e) {
+ h.a.Warn("Error in your custom logic onExitingVR: " + e);
+ }
+ this._webVRpresenting && this._scene.getEngine().disableVR(), this._scene.activeCamera && (this._position = this._scene.activeCamera.position.clone()), this.vrDeviceOrientationCamera && (this.vrDeviceOrientationCamera.angularSensibility = Number.MAX_VALUE), this._deviceOrientationCamera ? (this._deviceOrientationCamera.position = this._position, this._scene.activeCamera = this._deviceOrientationCamera, this._cachedAngularSensibility.angularSensibilityX && (this._deviceOrientationCamera.angularSensibilityX = this._cachedAngularSensibility.angularSensibilityX, this._cachedAngularSensibility.angularSensibilityX = null), this._cachedAngularSensibility.angularSensibilityY && (this._deviceOrientationCamera.angularSensibilityY = this._cachedAngularSensibility.angularSensibilityY, this._cachedAngularSensibility.angularSensibilityY = null), this._cachedAngularSensibility.angularSensibility && (this._deviceOrientationCamera.angularSensibility = this._cachedAngularSensibility.angularSensibility, this._cachedAngularSensibility.angularSensibility = null)) : this._existingCamera && (this._existingCamera.position = this._position, this._scene.activeCamera = this._existingCamera, this._inputElement && this._scene.activeCamera.attachControl(), this._cachedAngularSensibility.angularSensibilityX && (this._existingCamera.angularSensibilityX = this._cachedAngularSensibility.angularSensibilityX, this._cachedAngularSensibility.angularSensibilityX = null), this._cachedAngularSensibility.angularSensibilityY && (this._existingCamera.angularSensibilityY = this._cachedAngularSensibility.angularSensibilityY, this._cachedAngularSensibility.angularSensibilityY = null), this._cachedAngularSensibility.angularSensibility && (this._existingCamera.angularSensibility = this._cachedAngularSensibility.angularSensibility, this._cachedAngularSensibility.angularSensibility = null)), this.updateButtonVisibility(), this._interactionsEnabled && (this._scene.unregisterBeforeRender(this.beforeRender), this._cameraGazer._gazeTracker.isVisible = !1, this._leftController && (this._leftController._gazeTracker.isVisible = !1), this._rightController && (this._rightController._gazeTracker.isVisible = !1)), this._scene.getEngine().resize(), [this._leftController, this._rightController].forEach(function(e) {
+ e && e._deactivatePointer();
+ }), this._hasEnteredVR = !1;
+ var t = this._scene.getEngine();
+ t._onVrDisplayPresentChange && t._onVrDisplayPresentChange();
+ }
+ }, Object.defineProperty(r.prototype, "position", { get: function() {
+ return this._position;
+ }, set: function(t) {
+ this._position = t, this._scene.activeCamera && (this._scene.activeCamera.position = t);
+ }, enumerable: !1, configurable: !0 }), r.prototype.enableInteractions = function() {
+ var t = this;
+ if (!this._interactionsEnabled) {
+ if (this._interactionsRequested = !0, this.xr)
+ return void (this.xr.baseExperience.state === Pn.IN_XR && this.xr.pointerSelection.attach());
+ this._leftController && this._enableInteractionOnController(this._leftController), this._rightController && this._enableInteractionOnController(this._rightController), this.raySelectionPredicate = function(e) {
+ return e.isVisible && (e.isPickable || e.name === t._floorMeshName);
+ }, this.meshSelectionPredicate = function() {
+ return !0;
+ }, this._raySelectionPredicate = function(e) {
+ return !!(t._isTeleportationFloor(e) || e.name.indexOf("gazeTracker") === -1 && e.name.indexOf("teleportationTarget") === -1 && e.name.indexOf("torusTeleportation") === -1) && t.raySelectionPredicate(e);
+ }, this._interactionsEnabled = !0;
+ }
+ }, Object.defineProperty(r.prototype, "_noControllerIsActive", { get: function() {
+ return !(this._leftController && this._leftController._activePointer || this._rightController && this._rightController._activePointer);
+ }, enumerable: !1, configurable: !0 }), r.prototype._isTeleportationFloor = function(t) {
+ for (var e = 0; e < this._floorMeshesCollection.length; e++)
+ if (this._floorMeshesCollection[e].id === t.id)
+ return !0;
+ return !(!this._floorMeshName || t.name !== this._floorMeshName);
+ }, r.prototype.addFloorMesh = function(t) {
+ this._floorMeshesCollection && (this._floorMeshesCollection.indexOf(t) > -1 || this._floorMeshesCollection.push(t));
+ }, r.prototype.removeFloorMesh = function(t) {
+ if (this._floorMeshesCollection) {
+ var e = this._floorMeshesCollection.indexOf(t);
+ e !== -1 && this._floorMeshesCollection.splice(e, 1);
+ }
+ }, r.prototype.enableTeleportation = function(t) {
+ var e = this;
+ if (t === void 0 && (t = {}), !this._teleportationInitialized) {
+ if (this._teleportationRequested = !0, this.enableInteractions(), this.webVROptions.useXR && (t.floorMeshes || t.floorMeshName)) {
+ var n = t.floorMeshes || [];
+ if (!n.length) {
+ var i = this._scene.getMeshByName(t.floorMeshName);
+ i && n.push(i);
+ }
+ if (this.xr)
+ return n.forEach(function(s) {
+ e.xr.teleportation.addFloorMesh(s);
+ }), void (this.xr.teleportation.attached || this.xr.teleportation.attach());
+ if (!this.xrTestDone) {
+ var o = function() {
+ e.xrTestDone && (e._scene.unregisterBeforeRender(o), e.xr ? e.xr.teleportation.attached || e.xr.teleportation.attach() : e.enableTeleportation(t));
+ };
+ return void this._scene.registerBeforeRender(o);
+ }
+ }
+ t.floorMeshName && (this._floorMeshName = t.floorMeshName), t.floorMeshes && (this._floorMeshesCollection = t.floorMeshes), t.teleportationMode && (this._teleportationMode = t.teleportationMode), t.teleportationTime && t.teleportationTime > 0 && (this._teleportationTime = t.teleportationTime), t.teleportationSpeed && t.teleportationSpeed > 0 && (this._teleportationSpeed = t.teleportationSpeed), t.easingFunction !== void 0 && (this._teleportationEasing = t.easingFunction), this._leftController != null && this._enableTeleportationOnController(this._leftController), this._rightController != null && this._enableTeleportationOnController(this._rightController);
+ var a = new In.a();
+ a.vignetteColor = new C.b(0, 0, 0, 0), a.vignetteEnabled = !0, this._postProcessMove = new ys("postProcessMove", 1, this._webVRCamera, void 0, void 0, void 0, void 0, a), this._webVRCamera.detachPostProcess(this._postProcessMove), this._teleportationInitialized = !0, this._isDefaultTeleportationTarget && (this._createTeleportationCircles(), this._teleportationTarget.scaling.scaleInPlace(this._webVRCamera.deviceScaleFactor));
+ }
+ }, r.prototype._enableInteractionOnController = function(t) {
+ var e = this;
+ t.webVRController.mesh && (t._interactionsEnabled = !0, this.isInVRMode && this._displayLaserPointer && t._activatePointer(), this.webVROptions.laserToggle && t.webVRController.onMainButtonStateChangedObservable.add(function(n) {
+ e._displayLaserPointer && n.value === 1 && (t._activePointer ? t._deactivatePointer() : t._activatePointer(), e.displayGaze && (t._gazeTracker.isVisible = t._activePointer));
+ }), t.webVRController.onTriggerStateChangedObservable.add(function(n) {
+ var i = t;
+ e._noControllerIsActive && (i = e._cameraGazer), i._pointerDownOnMeshAsked ? n.value < e._padSensibilityDown && i._selectionPointerUp() : n.value > e._padSensibilityUp && i._selectionPointerDown();
+ }));
+ }, r.prototype._checkTeleportWithRay = function(t, e) {
+ this._teleportationRequestInitiated && !e._teleportationRequestInitiated || (e._teleportationRequestInitiated ? Math.sqrt(t.y * t.y + t.x * t.x) < this._padSensibilityDown && (this._teleportActive && this.teleportCamera(this._haloCenter), e._teleportationRequestInitiated = !1) : t.y < -this._padSensibilityUp && e._dpadPressed && (e._activatePointer(), e._teleportationRequestInitiated = !0));
+ }, r.prototype._checkRotate = function(t, e) {
+ e._teleportationRequestInitiated || (e._rotationLeftAsked ? t.x > -this._padSensibilityDown && (e._rotationLeftAsked = !1) : t.x < -this._padSensibilityUp && e._dpadPressed && (e._rotationLeftAsked = !0, this._rotationAllowed && this._rotateCamera(!1)), e._rotationRightAsked ? t.x < this._padSensibilityDown && (e._rotationRightAsked = !1) : t.x > this._padSensibilityUp && e._dpadPressed && (e._rotationRightAsked = !0, this._rotationAllowed && this._rotateCamera(!0)));
+ }, r.prototype._checkTeleportBackwards = function(t, e) {
+ if (!e._teleportationRequestInitiated)
+ if (t.y > this._padSensibilityUp && e._dpadPressed) {
+ if (!e._teleportationBackRequestInitiated) {
+ if (!this.currentVRCamera)
+ return;
+ var n = c.b.FromRotationMatrix(this.currentVRCamera.getWorldMatrix().getRotationMatrix()), i = this.currentVRCamera.position;
+ this.currentVRCamera.devicePosition && this.currentVRCamera.deviceRotationQuaternion && (n = this.currentVRCamera.deviceRotationQuaternion, i = this.currentVRCamera.devicePosition), n.toEulerAnglesToRef(this._workingVector), this._workingVector.z = 0, this._workingVector.x = 0, c.b.RotationYawPitchRollToRef(this._workingVector.y, this._workingVector.x, this._workingVector.z, this._workingQuaternion), this._workingQuaternion.toRotationMatrix(this._workingMatrix), c.e.TransformCoordinatesToRef(this._teleportBackwardsVector, this._workingMatrix, this._workingVector);
+ var o = new An.a(i, this._workingVector), a = this._scene.pickWithRay(o, this._raySelectionPredicate);
+ a && a.pickedPoint && a.pickedMesh && this._isTeleportationFloor(a.pickedMesh) && a.distance < 5 && this.teleportCamera(a.pickedPoint), e._teleportationBackRequestInitiated = !0;
+ }
+ } else
+ e._teleportationBackRequestInitiated = !1;
+ }, r.prototype._enableTeleportationOnController = function(t) {
+ var e = this;
+ t.webVRController.mesh && (t._interactionsEnabled || this._enableInteractionOnController(t), t._interactionsEnabled = !0, t._teleportationEnabled = !0, t.webVRController.controllerType === Si.VIVE && (t._dpadPressed = !1, t.webVRController.onPadStateChangedObservable.add(function(n) {
+ t._dpadPressed = n.pressed, t._dpadPressed || (t._rotationLeftAsked = !1, t._rotationRightAsked = !1, t._teleportationBackRequestInitiated = !1);
+ })), t.webVRController.onPadValuesChangedObservable.add(function(n) {
+ e.teleportationEnabled && (e._checkTeleportBackwards(n, t), e._checkTeleportWithRay(n, t)), e._checkRotate(n, t);
+ }));
+ }, r.prototype._createTeleportationCircles = function() {
+ this._teleportationTarget = we.a.CreateGround("teleportationTarget", 2, 2, 2, this._scene), this._teleportationTarget.isPickable = !1;
+ var t = new $i.a("DynamicTexture", 512, this._scene, !0);
+ t.hasAlpha = !0;
+ var e = t.getContext();
+ e.beginPath(), e.arc(256, 256, 200, 0, 2 * Math.PI, !1), e.fillStyle = this._teleportationFillColor, e.fill(), e.lineWidth = 10, e.strokeStyle = this._teleportationBorderColor, e.stroke(), e.closePath(), t.update();
+ var n = new kt.a("TextPlaneMaterial", this._scene);
+ n.diffuseTexture = t, this._teleportationTarget.material = n;
+ var i = we.a.CreateTorus("torusTeleportation", 0.75, 0.1, 25, this._scene, !1);
+ i.isPickable = !1, i.parent = this._teleportationTarget;
+ var o = new H("animationInnerCircle", "position.y", 30, H.ANIMATIONTYPE_FLOAT, H.ANIMATIONLOOPMODE_CYCLE), a = [];
+ a.push({ frame: 0, value: 0 }), a.push({ frame: 30, value: 0.4 }), a.push({ frame: 60, value: 0 }), o.setKeys(a);
+ var s = new _n();
+ s.setEasingMode(je.EASINGMODE_EASEINOUT), o.setEasingFunction(s), i.animations = [], i.animations.push(o), this._scene.beginAnimation(i, 0, 60, !0), this._hideTeleportationTarget();
+ }, r.prototype._displayTeleportationTarget = function() {
+ this._teleportActive = !0, this._teleportationInitialized && (this._teleportationTarget.isVisible = !0, this._isDefaultTeleportationTarget && (this._teleportationTarget.getChildren()[0].isVisible = !0));
+ }, r.prototype._hideTeleportationTarget = function() {
+ this._teleportActive = !1, this._teleportationInitialized && (this._teleportationTarget.isVisible = !1, this._isDefaultTeleportationTarget && (this._teleportationTarget.getChildren()[0].isVisible = !1));
+ }, r.prototype._rotateCamera = function(t) {
+ var e = this;
+ if (this.currentVRCamera instanceof ci) {
+ t ? this._rotationAngle++ : this._rotationAngle--, this.currentVRCamera.animations = [];
+ var n = c.b.FromRotationMatrix(c.a.RotationY(Math.PI / 4 * this._rotationAngle)), i = new H("animationRotation", "rotationQuaternion", 90, H.ANIMATIONTYPE_QUATERNION, H.ANIMATIONLOOPMODE_CONSTANT), o = [];
+ o.push({ frame: 0, value: this.currentVRCamera.rotationQuaternion }), o.push({ frame: 6, value: n }), i.setKeys(o), i.setEasingFunction(this._circleEase), this.currentVRCamera.animations.push(i), this._postProcessMove.animations = [];
+ var a = new H("animationPP", "vignetteWeight", 90, H.ANIMATIONTYPE_FLOAT, H.ANIMATIONLOOPMODE_CONSTANT), s = [];
+ s.push({ frame: 0, value: 0 }), s.push({ frame: 3, value: 4 }), s.push({ frame: 6, value: 0 }), a.setKeys(s), a.setEasingFunction(this._circleEase), this._postProcessMove.animations.push(a);
+ var p = new H("animationPP2", "vignetteStretch", 90, H.ANIMATIONTYPE_FLOAT, H.ANIMATIONLOOPMODE_CONSTANT), m = [];
+ m.push({ frame: 0, value: 0 }), m.push({ frame: 3, value: 10 }), m.push({ frame: 6, value: 0 }), p.setKeys(m), p.setEasingFunction(this._circleEase), this._postProcessMove.animations.push(p), this._postProcessMove.imageProcessingConfiguration.vignetteWeight = 0, this._postProcessMove.imageProcessingConfiguration.vignetteStretch = 0, this._postProcessMove.samples = 4, this._webVRCamera.attachPostProcess(this._postProcessMove), this._scene.beginAnimation(this._postProcessMove, 0, 6, !1, 1, function() {
+ e._webVRCamera.detachPostProcess(e._postProcessMove);
+ }), this._scene.beginAnimation(this.currentVRCamera, 0, 6, !1, 1);
+ }
+ }, r.prototype._moveTeleportationSelectorTo = function(t, e, n) {
+ if (t.pickedPoint) {
+ e._teleportationRequestInitiated && (this._displayTeleportationTarget(), this._haloCenter.copyFrom(t.pickedPoint), this._teleportationTarget.position.copyFrom(t.pickedPoint));
+ var i = this._convertNormalToDirectionOfRay(t.getNormal(!0, !1), n);
+ if (i) {
+ var o = c.e.Cross(Se.a.Y, i), a = c.e.Cross(i, o);
+ c.e.RotationFromAxisToRef(a, i, o, this._teleportationTarget.rotation);
+ }
+ this._teleportationTarget.position.y += 0.1;
+ }
+ }, r.prototype.teleportCamera = function(t) {
+ var e = this;
+ if (this.currentVRCamera instanceof ci) {
+ this.webVRCamera.leftCamera ? (this._workingVector.copyFrom(this.webVRCamera.leftCamera.globalPosition), this._workingVector.subtractInPlace(this.webVRCamera.position), t.subtractToRef(this._workingVector, this._workingVector)) : this._workingVector.copyFrom(t), this.isInVRMode ? this._workingVector.y += this.webVRCamera.deviceDistanceToRoomGround() * this._webVRCamera.deviceScaleFactor : this._workingVector.y += this._defaultHeight, this.onBeforeCameraTeleport.notifyObservers(this._workingVector);
+ var n, i;
+ if (this._teleportationMode == r.TELEPORTATIONMODE_CONSTANTSPEED) {
+ i = 90;
+ var o = c.e.Distance(this.currentVRCamera.position, this._workingVector);
+ n = this._teleportationSpeed / o;
+ } else
+ i = Math.round(90 * this._teleportationTime / 1e3), n = 1;
+ this.currentVRCamera.animations = [];
+ var a = new H("animationCameraTeleportation", "position", 90, H.ANIMATIONTYPE_VECTOR3, H.ANIMATIONLOOPMODE_CONSTANT), s = [{ frame: 0, value: this.currentVRCamera.position }, { frame: i, value: this._workingVector }];
+ a.setKeys(s), a.setEasingFunction(this._teleportationEasing), this.currentVRCamera.animations.push(a), this._postProcessMove.animations = [];
+ var p = Math.round(i / 2), m = new H("animationPP", "vignetteWeight", 90, H.ANIMATIONTYPE_FLOAT, H.ANIMATIONLOOPMODE_CONSTANT), S = [];
+ S.push({ frame: 0, value: 0 }), S.push({ frame: p, value: 8 }), S.push({ frame: i, value: 0 }), m.setKeys(S), this._postProcessMove.animations.push(m);
+ var O = new H("animationPP2", "vignetteStretch", 90, H.ANIMATIONTYPE_FLOAT, H.ANIMATIONLOOPMODE_CONSTANT), I = [];
+ I.push({ frame: 0, value: 0 }), I.push({ frame: p, value: 10 }), I.push({ frame: i, value: 0 }), O.setKeys(I), this._postProcessMove.animations.push(O), this._postProcessMove.imageProcessingConfiguration.vignetteWeight = 0, this._postProcessMove.imageProcessingConfiguration.vignetteStretch = 0, this._webVRCamera.attachPostProcess(this._postProcessMove), this._scene.beginAnimation(this._postProcessMove, 0, i, !1, n, function() {
+ e._webVRCamera.detachPostProcess(e._postProcessMove);
+ }), this._scene.beginAnimation(this.currentVRCamera, 0, i, !1, n, function() {
+ e.onAfterCameraTeleport.notifyObservers(e._workingVector);
+ }), this._hideTeleportationTarget();
+ }
+ }, r.prototype._convertNormalToDirectionOfRay = function(t, e) {
+ return t && Math.acos(c.e.Dot(t, e.direction)) < Math.PI / 2 && t.scaleInPlace(-1), t;
+ }, r.prototype._castRayAndSelectObject = function(t) {
+ if (this.currentVRCamera instanceof ci) {
+ var e = t._getForwardRay(this._rayLength), n = this._scene.pickWithRay(e, this._raySelectionPredicate);
+ if (n && (t._laserPointer && (n.originMesh = t._laserPointer.parent), this._scene.simulatePointerMove(n, { pointerId: t._id })), t._currentHit = n, n && n.pickedPoint) {
+ if (this._displayGaze) {
+ var i = 1;
+ t._gazeTracker.isVisible = !0, t._isActionableMesh && (i = 3), this.updateGazeTrackerScale && (t._gazeTracker.scaling.x = n.distance * i, t._gazeTracker.scaling.y = n.distance * i, t._gazeTracker.scaling.z = n.distance * i);
+ var o = this._convertNormalToDirectionOfRay(n.getNormal(), e);
+ if (o) {
+ var a = c.e.Cross(Se.a.Y, o), s = c.e.Cross(o, a);
+ c.e.RotationFromAxisToRef(s, o, a, t._gazeTracker.rotation);
+ }
+ t._gazeTracker.position.copyFrom(n.pickedPoint), t._gazeTracker.position.x < 0 ? t._gazeTracker.position.x += 2e-3 : t._gazeTracker.position.x -= 2e-3, t._gazeTracker.position.y < 0 ? t._gazeTracker.position.y += 2e-3 : t._gazeTracker.position.y -= 2e-3, t._gazeTracker.position.z < 0 ? t._gazeTracker.position.z += 2e-3 : t._gazeTracker.position.z -= 2e-3;
+ }
+ t._updatePointerDistance(n.distance);
+ } else
+ t._updatePointerDistance(), t._gazeTracker.isVisible = !1;
+ if (n && n.pickedMesh) {
+ if (this._teleportationInitialized && this._isTeleportationFloor(n.pickedMesh) && n.pickedPoint)
+ return t._currentMeshSelected && !this._isTeleportationFloor(t._currentMeshSelected) && this._notifySelectedMeshUnselected(t._currentMeshSelected), t._currentMeshSelected = null, void (t._teleportationRequestInitiated && this._moveTeleportationSelectorTo(n, t, e));
+ if (n.pickedMesh !== t._currentMeshSelected)
+ if (this.meshSelectionPredicate(n.pickedMesh)) {
+ this.onNewMeshPicked.notifyObservers(n), t._currentMeshSelected = n.pickedMesh, n.pickedMesh.isPickable && n.pickedMesh.actionManager ? (this.changeGazeColor(this._pickedGazeColor), this.changeLaserColor(this._pickedLaserColor), t._isActionableMesh = !0) : (this.changeGazeColor(this._gazeColor), this.changeLaserColor(this._laserColor), t._isActionableMesh = !1);
+ try {
+ this.onNewMeshSelected.notifyObservers(n.pickedMesh);
+ var p = t;
+ p.webVRController && this.onMeshSelectedWithController.notifyObservers({ mesh: n.pickedMesh, controller: p.webVRController });
+ } catch (m) {
+ h.a.Warn("Error while raising onNewMeshSelected or onMeshSelectedWithController: " + m);
+ }
+ } else
+ this._notifySelectedMeshUnselected(t._currentMeshSelected), t._currentMeshSelected = null, this.changeGazeColor(this._gazeColor), this.changeLaserColor(this._laserColor);
+ } else
+ this._notifySelectedMeshUnselected(t._currentMeshSelected), t._currentMeshSelected = null, this.changeGazeColor(this._gazeColor), this.changeLaserColor(this._laserColor);
+ }
+ }, r.prototype._notifySelectedMeshUnselected = function(t) {
+ t && this.onSelectedMeshUnselected.notifyObservers(t);
+ }, r.prototype.setLaserColor = function(t, e) {
+ e === void 0 && (e = this._pickedLaserColor), this._laserColor = t, this._pickedLaserColor = e;
+ }, r.prototype.setLaserLightingState = function(t) {
+ t === void 0 && (t = !0), this._leftController && this._leftController._setLaserPointerLightingDisabled(!t), this._rightController && this._rightController._setLaserPointerLightingDisabled(!t);
+ }, r.prototype.setGazeColor = function(t, e) {
+ e === void 0 && (e = this._pickedGazeColor), this._gazeColor = t, this._pickedGazeColor = e;
+ }, r.prototype.changeLaserColor = function(t) {
+ this.updateControllerLaserColor && (this._leftController && this._leftController._setLaserPointerColor(t), this._rightController && this._rightController._setLaserPointerColor(t));
+ }, r.prototype.changeGazeColor = function(t) {
+ this.updateGazeTrackerColor && this._cameraGazer._gazeTracker.material && (this._cameraGazer._gazeTracker.material.emissiveColor = t, this._leftController && (this._leftController._gazeTracker.material.emissiveColor = t), this._rightController && (this._rightController._gazeTracker.material.emissiveColor = t));
+ }, r.prototype.dispose = function() {
+ this.isInVRMode && this.exitVR(), this._postProcessMove && this._postProcessMove.dispose(), this._webVRCamera && this._webVRCamera.dispose(), this._vrDeviceOrientationCamera && this._vrDeviceOrientationCamera.dispose(), !this._useCustomVRButton && this._btnVR && this._btnVR.parentNode && document.body.removeChild(this._btnVR), this._deviceOrientationCamera && this._scene.activeCamera != this._deviceOrientationCamera && this._deviceOrientationCamera.dispose(), this._cameraGazer && this._cameraGazer.dispose(), this._leftController && this._leftController.dispose(), this._rightController && this._rightController.dispose(), this._teleportationTarget && this._teleportationTarget.dispose(), this.xr && this.xr.dispose(), this._floorMeshesCollection = [], document.removeEventListener("keydown", this._onKeyDown), window.removeEventListener("vrdisplaypresentchange", this._onVrDisplayPresentChange), window.removeEventListener("resize", this._onResize), document.removeEventListener("fullscreenchange", this._onFullscreenChange), document.removeEventListener("mozfullscreenchange", this._onFullscreenChange), document.removeEventListener("webkitfullscreenchange", this._onFullscreenChange), document.removeEventListener("msfullscreenchange", this._onFullscreenChange), document.onmsfullscreenchange = null, this._scene.getEngine().onVRDisplayChangedObservable.removeCallback(this._onVRDisplayChanged), this._scene.getEngine().onVRRequestPresentStart.removeCallback(this._onVRRequestPresentStart), this._scene.getEngine().onVRRequestPresentComplete.removeCallback(this._onVRRequestPresentComplete), window.removeEventListener("vrdisplaypresentchange", this._onVrDisplayPresentChange), this._scene.gamepadManager.onGamepadConnectedObservable.removeCallback(this._onNewGamepadConnected), this._scene.gamepadManager.onGamepadDisconnectedObservable.removeCallback(this._onNewGamepadDisconnected), this._scene.unregisterBeforeRender(this.beforeRender);
+ }, r.prototype.getClassName = function() {
+ return "VRExperienceHelper";
+ }, r.TELEPORTATIONMODE_CONSTANTTIME = 0, r.TELEPORTATIONMODE_CONSTANTSPEED = 1, r;
+ }(), yo = l(64), Eo = (Ai = { root: 0, found: !1 }, function(r, t, e, n) {
+ Ai.root = 0, Ai.found = !1;
+ var i = t * t - 4 * r * e;
+ if (i < 0)
+ return Ai;
+ var o = Math.sqrt(i), a = (-t - o) / (2 * r), s = (-t + o) / (2 * r);
+ if (a > s) {
+ var p = s;
+ s = a, a = p;
+ }
+ return a > 0 && a < n ? (Ai.root = a, Ai.found = !0, Ai) : (s > 0 && s < n && (Ai.root = s, Ai.found = !0), Ai);
+ }), Qd = function() {
+ function r() {
+ this._collisionPoint = c.e.Zero(), this._planeIntersectionPoint = c.e.Zero(), this._tempVector = c.e.Zero(), this._tempVector2 = c.e.Zero(), this._tempVector3 = c.e.Zero(), this._tempVector4 = c.e.Zero(), this._edge = c.e.Zero(), this._baseToVertex = c.e.Zero(), this._destinationPoint = c.e.Zero(), this._slidePlaneNormal = c.e.Zero(), this._displacementVector = c.e.Zero(), this._radius = c.e.One(), this._retry = 0, this._basePointWorld = c.e.Zero(), this._velocityWorld = c.e.Zero(), this._normalizedVelocity = c.e.Zero(), this._collisionMask = -1;
+ }
+ return Object.defineProperty(r.prototype, "collisionMask", { get: function() {
+ return this._collisionMask;
+ }, set: function(t) {
+ this._collisionMask = isNaN(t) ? -1 : t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "slidePlaneNormal", { get: function() {
+ return this._slidePlaneNormal;
+ }, enumerable: !1, configurable: !0 }), r.prototype._initialize = function(t, e, n) {
+ this._velocity = e, c.e.NormalizeToRef(e, this._normalizedVelocity), this._basePoint = t, t.multiplyToRef(this._radius, this._basePointWorld), e.multiplyToRef(this._radius, this._velocityWorld), this._velocityWorldLength = this._velocityWorld.length(), this._epsilon = n, this.collisionFound = !1;
+ }, r.prototype._checkPointInTriangle = function(t, e, n, i, o) {
+ e.subtractToRef(t, this._tempVector), n.subtractToRef(t, this._tempVector2), c.e.CrossToRef(this._tempVector, this._tempVector2, this._tempVector4);
+ var a = c.e.Dot(this._tempVector4, o);
+ return !(a < 0) && (i.subtractToRef(t, this._tempVector3), c.e.CrossToRef(this._tempVector2, this._tempVector3, this._tempVector4), !((a = c.e.Dot(this._tempVector4, o)) < 0) && (c.e.CrossToRef(this._tempVector3, this._tempVector, this._tempVector4), (a = c.e.Dot(this._tempVector4, o)) >= 0));
+ }, r.prototype._canDoCollision = function(t, e, n, i) {
+ var o = c.e.Distance(this._basePointWorld, t), a = Math.max(this._radius.x, this._radius.y, this._radius.z);
+ return !(o > this._velocityWorldLength + a + e) && !!function(s, p, m, S) {
+ return !(s.x > m.x + S) && !(m.x - S > p.x) && !(s.y > m.y + S) && !(m.y - S > p.y) && !(s.z > m.z + S) && !(m.z - S > p.z);
+ }(n, i, this._basePointWorld, this._velocityWorldLength + a);
+ }, r.prototype._testTriangle = function(t, e, n, i, o, a, s) {
+ var p, m = !1;
+ e || (e = []), e[t] || (e[t] = new yo.a(0, 0, 0, 0), e[t].copyFromPoints(n, i, o));
+ var S = e[t];
+ if (a || S.isFrontFacingTo(this._normalizedVelocity, 0)) {
+ var O = S.signedDistanceTo(this._basePoint), I = c.e.Dot(S.normal, this._velocity);
+ if (I == 0) {
+ if (Math.abs(O) >= 1)
+ return;
+ m = !0, p = 0;
+ } else {
+ var G = (1 - O) / I;
+ if ((p = (-1 - O) / I) > G) {
+ var k = G;
+ G = p, p = k;
+ }
+ if (p > 1 || G < 0)
+ return;
+ p < 0 && (p = 0), p > 1 && (p = 1);
+ }
+ this._collisionPoint.copyFromFloats(0, 0, 0);
+ var K = !1, re = 1;
+ if (m || (this._basePoint.subtractToRef(S.normal, this._planeIntersectionPoint), this._velocity.scaleToRef(p, this._tempVector), this._planeIntersectionPoint.addInPlace(this._tempVector), this._checkPointInTriangle(this._planeIntersectionPoint, n, i, o, S.normal) && (K = !0, re = p, this._collisionPoint.copyFrom(this._planeIntersectionPoint))), !K) {
+ var se = this._velocity.lengthSquared(), ue = se;
+ this._basePoint.subtractToRef(n, this._tempVector);
+ var he = 2 * c.e.Dot(this._velocity, this._tempVector), pe = this._tempVector.lengthSquared() - 1, ve = Eo(ue, he, pe, re);
+ ve.found && (re = ve.root, K = !0, this._collisionPoint.copyFrom(n)), this._basePoint.subtractToRef(i, this._tempVector), he = 2 * c.e.Dot(this._velocity, this._tempVector), pe = this._tempVector.lengthSquared() - 1, (ve = Eo(ue, he, pe, re)).found && (re = ve.root, K = !0, this._collisionPoint.copyFrom(i)), this._basePoint.subtractToRef(o, this._tempVector), he = 2 * c.e.Dot(this._velocity, this._tempVector), pe = this._tempVector.lengthSquared() - 1, (ve = Eo(ue, he, pe, re)).found && (re = ve.root, K = !0, this._collisionPoint.copyFrom(o)), i.subtractToRef(n, this._edge), n.subtractToRef(this._basePoint, this._baseToVertex);
+ var Ee = this._edge.lengthSquared(), Ae = c.e.Dot(this._edge, this._velocity), Ie = c.e.Dot(this._edge, this._baseToVertex);
+ if (ue = Ee * -se + Ae * Ae, he = Ee * (2 * c.e.Dot(this._velocity, this._baseToVertex)) - 2 * Ae * Ie, pe = Ee * (1 - this._baseToVertex.lengthSquared()) + Ie * Ie, (ve = Eo(ue, he, pe, re)).found) {
+ var xe = (Ae * ve.root - Ie) / Ee;
+ xe >= 0 && xe <= 1 && (re = ve.root, K = !0, this._edge.scaleInPlace(xe), n.addToRef(this._edge, this._collisionPoint));
+ }
+ o.subtractToRef(i, this._edge), i.subtractToRef(this._basePoint, this._baseToVertex), Ee = this._edge.lengthSquared(), Ae = c.e.Dot(this._edge, this._velocity), Ie = c.e.Dot(this._edge, this._baseToVertex), ue = Ee * -se + Ae * Ae, he = Ee * (2 * c.e.Dot(this._velocity, this._baseToVertex)) - 2 * Ae * Ie, pe = Ee * (1 - this._baseToVertex.lengthSquared()) + Ie * Ie, (ve = Eo(ue, he, pe, re)).found && (xe = (Ae * ve.root - Ie) / Ee) >= 0 && xe <= 1 && (re = ve.root, K = !0, this._edge.scaleInPlace(xe), i.addToRef(this._edge, this._collisionPoint)), n.subtractToRef(o, this._edge), o.subtractToRef(this._basePoint, this._baseToVertex), Ee = this._edge.lengthSquared(), Ae = c.e.Dot(this._edge, this._velocity), Ie = c.e.Dot(this._edge, this._baseToVertex), ue = Ee * -se + Ae * Ae, he = Ee * (2 * c.e.Dot(this._velocity, this._baseToVertex)) - 2 * Ae * Ie, pe = Ee * (1 - this._baseToVertex.lengthSquared()) + Ie * Ie, (ve = Eo(ue, he, pe, re)).found && (xe = (Ae * ve.root - Ie) / Ee) >= 0 && xe <= 1 && (re = ve.root, K = !0, this._edge.scaleInPlace(xe), o.addToRef(this._edge, this._collisionPoint));
+ }
+ if (K) {
+ var Pe = re * this._velocity.length();
+ (!this.collisionFound || Pe < this._nearestDistance) && (s.collisionResponse && (this.intersectionPoint ? this.intersectionPoint.copyFrom(this._collisionPoint) : this.intersectionPoint = this._collisionPoint.clone(), this._nearestDistance = Pe, this.collisionFound = !0), this.collidedMesh = s);
+ }
+ }
+ }, r.prototype._collide = function(t, e, n, i, o, a, s, p) {
+ if (n && n.length !== 0)
+ for (m = i; m < o; m += 3)
+ S = e[n[m] - a], O = e[n[m + 1] - a], I = e[n[m + 2] - a], this._testTriangle(m, t, I, O, S, s, p);
+ else
+ for (var m = 0; m < e.length; m += 3) {
+ var S = e[m], O = e[m + 1], I = e[m + 2];
+ this._testTriangle(m, t, I, O, S, s, p);
+ }
+ }, r.prototype._getResponse = function(t, e) {
+ t.addToRef(e, this._destinationPoint), e.scaleInPlace(this._nearestDistance / e.length()), this._basePoint.addToRef(e, t), t.subtractToRef(this.intersectionPoint, this._slidePlaneNormal), this._slidePlaneNormal.normalize(), this._slidePlaneNormal.scaleToRef(this._epsilon, this._displacementVector), t.addInPlace(this._displacementVector), this.intersectionPoint.addInPlace(this._displacementVector), this._slidePlaneNormal.scaleInPlace(yo.a.SignedDistanceToPlaneFromPositionAndNormal(this.intersectionPoint, this._slidePlaneNormal, this._destinationPoint)), this._destinationPoint.subtractInPlace(this._slidePlaneNormal), this._destinationPoint.subtractToRef(this.intersectionPoint, e);
+ }, r;
+ }(), qd = function() {
+ function r() {
+ this._scaledPosition = c.e.Zero(), this._scaledVelocity = c.e.Zero(), this._finalPosition = c.e.Zero();
+ }
+ return r.prototype.getNewPosition = function(t, e, n, i, o, a, s) {
+ t.divideToRef(n._radius, this._scaledPosition), e.divideToRef(n._radius, this._scaledVelocity), n.collidedMesh = null, n._retry = 0, n._initialVelocity = this._scaledVelocity, n._initialPosition = this._scaledPosition, this._collideWithWorld(this._scaledPosition, this._scaledVelocity, n, i, this._finalPosition, o), this._finalPosition.multiplyInPlace(n._radius), a(s, this._finalPosition, n.collidedMesh);
+ }, r.prototype.createCollider = function() {
+ return new Qd();
+ }, r.prototype.init = function(t) {
+ this._scene = t;
+ }, r.prototype._collideWithWorld = function(t, e, n, i, o, a) {
+ a === void 0 && (a = null);
+ var s = 10 * ke.a.CollisionsEpsilon;
+ if (n._retry >= i)
+ o.copyFrom(t);
+ else {
+ var p = a ? a.collisionMask : n.collisionMask;
+ n._initialize(t, e, s);
+ for (var m = a && a.surroundingMeshes || this._scene.meshes, S = 0; S < m.length; S++) {
+ var O = m[S];
+ O.isEnabled() && O.checkCollisions && O.subMeshes && O !== a && p & O.collisionGroup && O._checkCollision(n);
+ }
+ n.collisionFound ? (e.x === 0 && e.y === 0 && e.z === 0 || n._getResponse(t, e), e.length() <= s ? o.copyFrom(t) : (n._retry++, this._collideWithWorld(t, e, n, i, o, a))) : t.addToRef(e, o);
+ }
+ }, r;
+ }();
+ ge.a.CollisionCoordinatorFactory = function() {
+ return new qd();
+ };
+ var Wr = l(54), fb = l(114), pb = l(147), vl = l(103), vr = l(43), Zd = l(113), Jd = function() {
+ function r(t, e, n, i, o, a) {
+ this.entries = new Array(), this._boundingVectors = new Array(), this._capacity = n, this._depth = i, this._maxDepth = o, this._creationFunc = a, this._minPoint = t, this._maxPoint = e, this._boundingVectors.push(t.clone()), this._boundingVectors.push(e.clone()), this._boundingVectors.push(t.clone()), this._boundingVectors[2].x = e.x, this._boundingVectors.push(t.clone()), this._boundingVectors[3].y = e.y, this._boundingVectors.push(t.clone()), this._boundingVectors[4].z = e.z, this._boundingVectors.push(e.clone()), this._boundingVectors[5].z = t.z, this._boundingVectors.push(e.clone()), this._boundingVectors[6].x = t.x, this._boundingVectors.push(e.clone()), this._boundingVectors[7].y = t.y;
+ }
+ return Object.defineProperty(r.prototype, "capacity", { get: function() {
+ return this._capacity;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "minPoint", { get: function() {
+ return this._minPoint;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "maxPoint", { get: function() {
+ return this._maxPoint;
+ }, enumerable: !1, configurable: !0 }), r.prototype.addEntry = function(t) {
+ if (this.blocks)
+ for (var e = 0; e < this.blocks.length; e++)
+ this.blocks[e].addEntry(t);
+ else
+ this._creationFunc(t, this), this.entries.length > this.capacity && this._depth < this._maxDepth && this.createInnerBlocks();
+ }, r.prototype.removeEntry = function(t) {
+ if (this.blocks)
+ for (var e = 0; e < this.blocks.length; e++)
+ this.blocks[e].removeEntry(t);
+ else {
+ var n = this.entries.indexOf(t);
+ n > -1 && this.entries.splice(n, 1);
+ }
+ }, r.prototype.addEntries = function(t) {
+ for (var e = 0; e < t.length; e++) {
+ var n = t[e];
+ this.addEntry(n);
+ }
+ }, r.prototype.select = function(t, e, n) {
+ if (vl.a.IsInFrustum(this._boundingVectors, t)) {
+ if (this.blocks) {
+ for (var i = 0; i < this.blocks.length; i++)
+ this.blocks[i].select(t, e, n);
+ return;
+ }
+ n ? e.concat(this.entries) : e.concatWithNoDuplicate(this.entries);
+ }
+ }, r.prototype.intersects = function(t, e, n, i) {
+ if (vl.a.IntersectsSphere(this._minPoint, this._maxPoint, t, e)) {
+ if (this.blocks) {
+ for (var o = 0; o < this.blocks.length; o++)
+ this.blocks[o].intersects(t, e, n, i);
+ return;
+ }
+ i ? n.concat(this.entries) : n.concatWithNoDuplicate(this.entries);
+ }
+ }, r.prototype.intersectsRay = function(t, e) {
+ if (t.intersectsBoxMinMax(this._minPoint, this._maxPoint)) {
+ if (this.blocks) {
+ for (var n = 0; n < this.blocks.length; n++)
+ this.blocks[n].intersectsRay(t, e);
+ return;
+ }
+ e.concatWithNoDuplicate(this.entries);
+ }
+ }, r.prototype.createInnerBlocks = function() {
+ r._CreateBlocks(this._minPoint, this._maxPoint, this.entries, this._capacity, this._depth, this._maxDepth, this, this._creationFunc);
+ }, r._CreateBlocks = function(t, e, n, i, o, a, s, p) {
+ s.blocks = new Array();
+ for (var m = new c.e((e.x - t.x) / 2, (e.y - t.y) / 2, (e.z - t.z) / 2), S = 0; S < 2; S++)
+ for (var O = 0; O < 2; O++)
+ for (var I = 0; I < 2; I++) {
+ var G = new r(t.add(m.multiplyByFloats(S, O, I)), t.add(m.multiplyByFloats(S + 1, O + 1, I + 1)), i, o + 1, a, p);
+ G.addEntries(n), s.blocks.push(G);
+ }
+ }, r;
+ }(), va = function() {
+ function r(t, e, n) {
+ n === void 0 && (n = 2), this.maxDepth = n, this.dynamicContent = new Array(), this._maxBlockCapacity = e || 64, this._selectionContent = new Ui.b(1024), this._creationFunc = t;
+ }
+ return r.prototype.update = function(t, e, n) {
+ Jd._CreateBlocks(t, e, n, this._maxBlockCapacity, 0, this.maxDepth, this, this._creationFunc);
+ }, r.prototype.addMesh = function(t) {
+ for (var e = 0; e < this.blocks.length; e++)
+ this.blocks[e].addEntry(t);
+ }, r.prototype.removeMesh = function(t) {
+ for (var e = 0; e < this.blocks.length; e++)
+ this.blocks[e].removeEntry(t);
+ }, r.prototype.select = function(t, e) {
+ this._selectionContent.reset();
+ for (var n = 0; n < this.blocks.length; n++)
+ this.blocks[n].select(t, this._selectionContent, e);
+ return e ? this._selectionContent.concat(this.dynamicContent) : this._selectionContent.concatWithNoDuplicate(this.dynamicContent), this._selectionContent;
+ }, r.prototype.intersects = function(t, e, n) {
+ this._selectionContent.reset();
+ for (var i = 0; i < this.blocks.length; i++)
+ this.blocks[i].intersects(t, e, this._selectionContent, n);
+ return n ? this._selectionContent.concat(this.dynamicContent) : this._selectionContent.concatWithNoDuplicate(this.dynamicContent), this._selectionContent;
+ }, r.prototype.intersectsRay = function(t) {
+ this._selectionContent.reset();
+ for (var e = 0; e < this.blocks.length; e++)
+ this.blocks[e].intersectsRay(t, this._selectionContent);
+ return this._selectionContent.concatWithNoDuplicate(this.dynamicContent), this._selectionContent;
+ }, r.CreationFuncForMeshes = function(t, e) {
+ var n = t.getBoundingInfo();
+ !t.isBlocked && n.boundingBox.intersectsMinMax(e.minPoint, e.maxPoint) && e.entries.push(t);
+ }, r.CreationFuncForSubMeshes = function(t, e) {
+ t.getBoundingInfo().boundingBox.intersectsMinMax(e.minPoint, e.maxPoint) && e.entries.push(t);
+ }, r;
+ }();
+ ge.a.prototype.createOrUpdateSelectionOctree = function(r, t) {
+ r === void 0 && (r = 64), t === void 0 && (t = 2);
+ var e = this._getComponent(st.a.NAME_OCTREE);
+ e || (e = new Sl(this), this._addComponent(e)), this._selectionOctree || (this._selectionOctree = new va(va.CreationFuncForMeshes, r, t));
+ var n = this.getWorldExtends();
+ return this._selectionOctree.update(n.min, n.max, this.meshes), this._selectionOctree;
+ }, Object.defineProperty(ge.a.prototype, "selectionOctree", { get: function() {
+ return this._selectionOctree;
+ }, enumerable: !0, configurable: !0 }), Nt.a.prototype.createOrUpdateSubmeshesOctree = function(r, t) {
+ r === void 0 && (r = 64), t === void 0 && (t = 2);
+ var e = this.getScene(), n = e._getComponent(st.a.NAME_OCTREE);
+ n || (n = new Sl(e), e._addComponent(n)), this._submeshesOctree || (this._submeshesOctree = new va(va.CreationFuncForSubMeshes, r, t)), this.computeWorldMatrix(!0);
+ var i = this.getBoundingInfo().boundingBox;
+ return this._submeshesOctree.update(i.minimumWorld, i.maximumWorld, this.subMeshes), this._submeshesOctree;
+ };
+ var nn, bl, yl, El, Tl, Sl = function() {
+ function r(t) {
+ this.name = st.a.NAME_OCTREE, this.checksIsEnabled = !0, this._tempRay = new An.a(c.e.Zero(), new c.e(1, 1, 1)), this.scene = t, this.scene.getActiveMeshCandidates = this.getActiveMeshCandidates.bind(this), this.scene.getActiveSubMeshCandidates = this.getActiveSubMeshCandidates.bind(this), this.scene.getCollidingSubMeshCandidates = this.getCollidingSubMeshCandidates.bind(this), this.scene.getIntersectingSubMeshCandidates = this.getIntersectingSubMeshCandidates.bind(this);
+ }
+ return r.prototype.register = function() {
+ var t = this;
+ this.scene.onMeshRemovedObservable.add(function(e) {
+ var n = t.scene.selectionOctree;
+ if (n != null) {
+ var i = n.dynamicContent.indexOf(e);
+ i !== -1 && n.dynamicContent.splice(i, 1);
+ }
+ }), this.scene.onMeshImportedObservable.add(function(e) {
+ var n = t.scene.selectionOctree;
+ n != null && n.addMesh(e);
+ });
+ }, r.prototype.getActiveMeshCandidates = function() {
+ return this.scene._selectionOctree ? this.scene._selectionOctree.select(this.scene.frustumPlanes) : this.scene._getDefaultMeshCandidates();
+ }, r.prototype.getActiveSubMeshCandidates = function(t) {
+ return t._submeshesOctree && t.useOctreeForRenderingSelection ? t._submeshesOctree.select(this.scene.frustumPlanes) : this.scene._getDefaultSubMeshCandidates(t);
+ }, r.prototype.getIntersectingSubMeshCandidates = function(t, e) {
+ return t._submeshesOctree && t.useOctreeForPicking ? (An.a.TransformToRef(e, t.getWorldMatrix(), this._tempRay), t._submeshesOctree.intersectsRay(this._tempRay)) : this.scene._getDefaultSubMeshCandidates(t);
+ }, r.prototype.getCollidingSubMeshCandidates = function(t, e) {
+ if (t._submeshesOctree && t.useOctreeForCollisions) {
+ var n = e._velocityWorldLength + Math.max(e._radius.x, e._radius.y, e._radius.z);
+ return t._submeshesOctree.intersects(e._basePointWorld, n);
+ }
+ return this.scene._getDefaultSubMeshCandidates(t);
+ }, r.prototype.rebuild = function() {
+ }, r.prototype.dispose = function() {
+ }, r;
+ }(), Xr = l(99);
+ (function(r) {
+ r[r.Generic = 0] = "Generic", r[r.Keyboard = 1] = "Keyboard", r[r.Mouse = 2] = "Mouse", r[r.Touch = 3] = "Touch", r[r.DualShock = 4] = "DualShock", r[r.Xbox = 5] = "Xbox", r[r.Switch = 6] = "Switch";
+ })(nn || (nn = {})), function(r) {
+ r[r.Horizontal = 0] = "Horizontal", r[r.Vertical = 1] = "Vertical", r[r.LeftClick = 2] = "LeftClick", r[r.MiddleClick = 3] = "MiddleClick", r[r.RightClick = 4] = "RightClick", r[r.BrowserBack = 5] = "BrowserBack", r[r.BrowserForward = 6] = "BrowserForward";
+ }(bl || (bl = {})), function(r) {
+ r[r.Cross = 0] = "Cross", r[r.Circle = 1] = "Circle", r[r.Square = 2] = "Square", r[r.Triangle = 3] = "Triangle", r[r.L1 = 4] = "L1", r[r.R1 = 5] = "R1", r[r.L2 = 6] = "L2", r[r.R2 = 7] = "R2", r[r.Share = 8] = "Share", r[r.Options = 9] = "Options", r[r.L3 = 10] = "L3", r[r.R3 = 11] = "R3", r[r.DPadUp = 12] = "DPadUp", r[r.DPadDown = 13] = "DPadDown", r[r.DPadLeft = 14] = "DPadLeft", r[r.DPadRight = 15] = "DPadRight", r[r.Home = 16] = "Home", r[r.TouchPad = 17] = "TouchPad", r[r.LStickXAxis = 18] = "LStickXAxis", r[r.LStickYAxis = 19] = "LStickYAxis", r[r.RStickXAxis = 20] = "RStickXAxis", r[r.RStickYAxis = 21] = "RStickYAxis";
+ }(yl || (yl = {})), function(r) {
+ r[r.A = 0] = "A", r[r.B = 1] = "B", r[r.X = 2] = "X", r[r.Y = 3] = "Y", r[r.LB = 4] = "LB", r[r.RB = 5] = "RB", r[r.LT = 6] = "LT", r[r.RT = 7] = "RT", r[r.Back = 8] = "Back", r[r.Start = 9] = "Start", r[r.LS = 10] = "LS", r[r.RS = 11] = "RS", r[r.DPadUp = 12] = "DPadUp", r[r.DPadDown = 13] = "DPadDown", r[r.DPadLeft = 14] = "DPadLeft", r[r.DPadRight = 15] = "DPadRight", r[r.Home = 16] = "Home", r[r.LStickXAxis = 17] = "LStickXAxis", r[r.LStickYAxis = 18] = "LStickYAxis", r[r.RStickXAxis = 19] = "RStickXAxis", r[r.RStickYAxis = 20] = "RStickYAxis";
+ }(El || (El = {})), function(r) {
+ r[r.B = 0] = "B", r[r.A = 1] = "A", r[r.Y = 2] = "Y", r[r.X = 3] = "X", r[r.L = 4] = "L", r[r.R = 5] = "R", r[r.ZL = 6] = "ZL", r[r.ZR = 7] = "ZR", r[r.Minus = 8] = "Minus", r[r.Plus = 9] = "Plus", r[r.LS = 10] = "LS", r[r.RS = 11] = "RS", r[r.DPadUp = 12] = "DPadUp", r[r.DPadDown = 13] = "DPadDown", r[r.DPadLeft = 14] = "DPadLeft", r[r.DPadRight = 15] = "DPadRight", r[r.Home = 16] = "Home", r[r.Capture = 17] = "Capture", r[r.LStickXAxis = 18] = "LStickXAxis", r[r.LStickYAxis = 19] = "LStickYAxis", r[r.RStickXAxis = 20] = "RStickXAxis", r[r.RStickYAxis = 21] = "RStickYAxis";
+ }(Tl || (Tl = {}));
+ var $d = function() {
+ function r(t) {
+ this.onDeviceDisconnected = function() {
+ }, this._inputs = [], this._keyboardActive = !1, this._pointerActive = !1, this._keyboardDownEvent = function(n) {
+ }, this._keyboardUpEvent = function(n) {
+ }, this._pointerMoveEvent = function(n) {
+ }, this._pointerDownEvent = function(n) {
+ }, this._pointerUpEvent = function(n) {
+ }, this._gamepadConnectedEvent = function(n) {
+ }, this._gamepadDisconnectedEvent = function(n) {
+ }, this._onDeviceConnected = function() {
+ };
+ var e = t.getInputElement();
+ e && (this._elementToAttachTo = e, this._handleKeyActions(), this._handlePointerActions(), this._handleGamepadActions(), this._checkForConnectedDevices());
+ }
+ return Object.defineProperty(r.prototype, "onDeviceConnected", { get: function() {
+ return this._onDeviceConnected;
+ }, set: function(t) {
+ this._onDeviceConnected = t;
+ for (var e = 0; e < this._inputs.length; e++)
+ if (this._inputs[e])
+ for (var n = 0; n < this._inputs[e].length; n++)
+ this._inputs[e][n] && this._onDeviceConnected(e, n);
+ }, enumerable: !1, configurable: !0 }), r.Create = function(t) {
+ return typeof _native < "u" && _native.DeviceInputSystem ? new _native.DeviceInputSystem(t) : new r(t);
+ }, r.prototype.pollInput = function(t, e, n) {
+ var i = this._inputs[t][e];
+ if (!i)
+ throw "Unable to find device " + nn[t];
+ if (this._updateDevice(t, e, n), i[n] === void 0)
+ throw "Unable to find input " + n + " for device " + nn[t] + " in slot " + e;
+ return i[n];
+ }, r.prototype.dispose = function() {
+ this._keyboardActive && (window.removeEventListener("keydown", this._keyboardDownEvent), window.removeEventListener("keyup", this._keyboardUpEvent)), this._pointerActive && (this._elementToAttachTo.removeEventListener("pointermove", this._pointerMoveEvent), this._elementToAttachTo.removeEventListener("pointerdown", this._pointerDownEvent), this._elementToAttachTo.removeEventListener("pointerup", this._pointerUpEvent)), window.removeEventListener("gamepadconnected", this._gamepadConnectedEvent), window.removeEventListener("gamepaddisconnected", this._gamepadDisconnectedEvent);
+ }, r.prototype._checkForConnectedDevices = function() {
+ for (var t = 0, e = navigator.getGamepads(); t < e.length; t++) {
+ var n = e[t];
+ n && this._addGamePad(n);
+ }
+ matchMedia("(pointer:fine)").matches && this._addPointerDevice(nn.Mouse, 0, 0, 0);
+ }, r.prototype._addGamePad = function(t) {
+ var e = this._getGamepadDeviceType(t.id), n = t.index;
+ this._registerDevice(e, n, t.buttons.length + t.axes.length), this._gamepads = this._gamepads || new Array(t.index + 1), this._gamepads[n] = e;
+ }, r.prototype._addPointerDevice = function(t, e, n, i) {
+ this._pointerActive = !0, this._registerDevice(t, e, r._MAX_POINTER_INPUTS);
+ var o = this._inputs[t][e];
+ o[0] = n, o[1] = i;
+ }, r.prototype._registerDevice = function(t, e, n) {
+ if (this._inputs[t] || (this._inputs[t] = []), !this._inputs[t][e]) {
+ for (var i = new Array(n), o = 0; o < n; o++)
+ i[o] = 0;
+ this._inputs[t][e] = i, this.onDeviceConnected(t, e);
+ }
+ }, r.prototype._unregisterDevice = function(t, e) {
+ this._inputs[t][e] && (delete this._inputs[t][e], this.onDeviceDisconnected(t, e));
+ }, r.prototype._handleKeyActions = function() {
+ var t = this;
+ this._keyboardDownEvent = function(e) {
+ t._keyboardActive || (t._keyboardActive = !0, t._registerDevice(nn.Keyboard, 0, r._MAX_KEYCODES));
+ var n = t._inputs[nn.Keyboard][0];
+ n && (t.onInputChanged && t.onInputChanged(nn.Keyboard, 0, e.keyCode, n[e.keyCode], 1), n[e.keyCode] = 1);
+ }, this._keyboardUpEvent = function(e) {
+ var n = t._inputs[nn.Keyboard][0];
+ n && (t.onInputChanged && t.onInputChanged(nn.Keyboard, 0, e.keyCode, n[e.keyCode], 0), n[e.keyCode] = 0);
+ }, window.addEventListener("keydown", this._keyboardDownEvent), window.addEventListener("keyup", this._keyboardUpEvent);
+ }, r.prototype._handlePointerActions = function() {
+ var t = this;
+ this._pointerMoveEvent = function(e) {
+ var n = e.pointerType == "mouse" ? nn.Mouse : nn.Touch, i = e.pointerType == "mouse" ? 0 : e.pointerId;
+ t._inputs[n] || (t._inputs[n] = []), t._inputs[n][i] || t._addPointerDevice(n, i, e.clientX, e.clientY);
+ var o = t._inputs[n][i];
+ o && (t.onInputChanged && (t.onInputChanged(n, i, 0, o[0], e.clientX), t.onInputChanged(n, i, 1, o[1], e.clientY)), o[0] = e.clientX, o[1] = e.clientY);
+ }, this._pointerDownEvent = function(e) {
+ var n = e.pointerType == "mouse" ? nn.Mouse : nn.Touch, i = e.pointerType == "mouse" ? 0 : e.pointerId;
+ t._inputs[n] || (t._inputs[n] = []), t._inputs[n][i] || t._addPointerDevice(n, i, e.clientX, e.clientY);
+ var o = t._inputs[n][i];
+ o && (t.onInputChanged && (t.onInputChanged(n, i, 0, o[0], e.clientX), t.onInputChanged(n, i, 1, o[1], e.clientY), t.onInputChanged(n, i, e.button + 2, o[e.button + 2], 1)), o[0] = e.clientX, o[1] = e.clientY, o[e.button + 2] = 1);
+ }, this._pointerUpEvent = function(e) {
+ var n = e.pointerType == "mouse" ? nn.Mouse : nn.Touch, i = e.pointerType == "mouse" ? 0 : e.pointerId, o = t._inputs[n][i];
+ o && (t.onInputChanged && t.onInputChanged(n, i, e.button + 2, o[e.button + 2], 0), o[0] = e.clientX, o[1] = e.clientY, o[e.button + 2] = 0), e.pointerType != "mouse" && t._unregisterDevice(n, i);
+ }, this._elementToAttachTo.addEventListener("pointermove", this._pointerMoveEvent), this._elementToAttachTo.addEventListener("pointerdown", this._pointerDownEvent), this._elementToAttachTo.addEventListener("pointerup", this._pointerUpEvent);
+ }, r.prototype._handleGamepadActions = function() {
+ var t = this;
+ this._gamepadConnectedEvent = function(e) {
+ t._addGamePad(e.gamepad);
+ }, this._gamepadDisconnectedEvent = function(e) {
+ if (t._gamepads) {
+ var n = t._getGamepadDeviceType(e.gamepad.id), i = e.gamepad.index;
+ t._unregisterDevice(n, i), delete t._gamepads[i];
+ }
+ }, window.addEventListener("gamepadconnected", this._gamepadConnectedEvent), window.addEventListener("gamepaddisconnected", this._gamepadDisconnectedEvent);
+ }, r.prototype._updateDevice = function(t, e, n) {
+ var i = navigator.getGamepads()[e];
+ if (i && t == this._gamepads[e]) {
+ var o = this._inputs[t][e];
+ n >= i.buttons.length ? o[n] = i.axes[n - i.buttons.length].valueOf() : o[n] = i.buttons[n].value;
+ }
+ }, r.prototype._getGamepadDeviceType = function(t) {
+ return t.indexOf("054c") !== -1 ? nn.DualShock : t.indexOf("Xbox One") !== -1 || t.search("Xbox 360") !== -1 || t.search("xinput") !== -1 ? nn.Xbox : t.indexOf("057e") !== -1 ? nn.Switch : nn.Generic;
+ }, r._MAX_KEYCODES = 255, r._MAX_POINTER_INPUTS = 7, r;
+ }(), ef = function() {
+ function r(t, e, n) {
+ n === void 0 && (n = 0), this.deviceType = e, this.deviceSlot = n, this.onInputChangedObservable = new P.c(), this._deviceInputSystem = t;
+ }
+ return r.prototype.getInput = function(t) {
+ return this._deviceInputSystem.pollInput(this.deviceType, this.deviceSlot, t);
+ }, r;
+ }(), _b = function() {
+ function r(t) {
+ var e = this;
+ this.onDeviceConnectedObservable = new P.c(function(i) {
+ e.getDevices().forEach(function(o) {
+ e.onDeviceConnectedObservable.notifyObserver(i, o);
+ });
+ }), this.onDeviceDisconnectedObservable = new P.c();
+ var n = Object.keys(nn).length / 2;
+ this._devices = new Array(n), this._firstDevice = new Array(n), this._deviceInputSystem = $d.Create(t), this._deviceInputSystem.onDeviceConnected = function(i, o) {
+ e._addDevice(i, o), e.onDeviceConnectedObservable.notifyObservers(e.getDeviceSource(i, o));
+ }, this._deviceInputSystem.onDeviceDisconnected = function(i, o) {
+ var a = e.getDeviceSource(i, o);
+ e._removeDevice(i, o), e.onDeviceDisconnectedObservable.notifyObservers(a);
+ }, this._deviceInputSystem.onInputChanged || (this._deviceInputSystem.onInputChanged = function(i, o, a, s, p) {
+ var m;
+ (m = e.getDeviceSource(i, o)) === null || m === void 0 || m.onInputChangedObservable.notifyObservers({ inputIndex: a, previousState: s, currentState: p });
+ });
+ }
+ return r.prototype.getDeviceSource = function(t, e) {
+ if (e === void 0) {
+ if (this._firstDevice[t] === void 0)
+ return null;
+ e = this._firstDevice[t];
+ }
+ return this._devices[t] && this._devices[t][e] !== void 0 ? this._devices[t][e] : null;
+ }, r.prototype.getDeviceSources = function(t) {
+ return this._devices[t].filter(function(e) {
+ return !!e;
+ });
+ }, r.prototype.getDevices = function() {
+ var t = new Array();
+ return this._devices.forEach(function(e) {
+ t.push.apply(t, e);
+ }), t;
+ }, r.prototype.dispose = function() {
+ this.onDeviceConnectedObservable.clear(), this.onDeviceDisconnectedObservable.clear(), this._deviceInputSystem.dispose();
+ }, r.prototype._addDevice = function(t, e) {
+ this._devices[t] || (this._devices[t] = new Array()), this._devices[t][e] || (this._devices[t][e] = new ef(this._deviceInputSystem, t, e), this._updateFirstDevices(t));
+ }, r.prototype._removeDevice = function(t, e) {
+ delete this._devices[t][e], this._updateFirstDevices(t);
+ }, r.prototype._updateFirstDevices = function(t) {
+ switch (t) {
+ case nn.Keyboard:
+ case nn.Mouse:
+ this._firstDevice[t] = 0;
+ break;
+ case nn.Touch:
+ case nn.DualShock:
+ case nn.Xbox:
+ case nn.Switch:
+ case nn.Generic:
+ var e = this._devices[t];
+ delete this._firstDevice[t];
+ for (var n = 0; n < e.length; n++)
+ if (e[n]) {
+ this._firstDevice[t] = n;
+ break;
+ }
+ }
+ }, r;
+ }(), tf = l(168), nf = (l(123), function() {
+ this._timeElapsedQueryEnded = !1;
+ }), rf = function() {
+ this.occlusionInternalRetryCounter = 0, this.isOcclusionQueryInProgress = !1, this.isOccluded = !1, this.occlusionRetryCount = -1, this.occlusionType = Nt.a.OCCLUSION_TYPE_NONE, this.occlusionQueryAlgorithmType = Nt.a.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;
+ };
+ ke.a.prototype.createQuery = function() {
+ return this._gl.createQuery();
+ }, ke.a.prototype.deleteQuery = function(r) {
+ return this._gl.deleteQuery(r), this;
+ }, ke.a.prototype.isQueryResultAvailable = function(r) {
+ return this._gl.getQueryParameter(r, this._gl.QUERY_RESULT_AVAILABLE);
+ }, ke.a.prototype.getQueryResult = function(r) {
+ return this._gl.getQueryParameter(r, this._gl.QUERY_RESULT);
+ }, ke.a.prototype.beginOcclusionQuery = function(r, t) {
+ var e = this._getGlAlgorithmType(r);
+ return this._gl.beginQuery(e, t), this;
+ }, ke.a.prototype.endOcclusionQuery = function(r) {
+ var t = this._getGlAlgorithmType(r);
+ return this._gl.endQuery(t), this;
+ }, ke.a.prototype._createTimeQuery = function() {
+ var r = this.getCaps().timerQuery;
+ return r.createQueryEXT ? r.createQueryEXT() : this.createQuery();
+ }, ke.a.prototype._deleteTimeQuery = function(r) {
+ var t = this.getCaps().timerQuery;
+ t.deleteQueryEXT ? t.deleteQueryEXT(r) : this.deleteQuery(r);
+ }, ke.a.prototype._getTimeQueryResult = function(r) {
+ var t = this.getCaps().timerQuery;
+ return t.getQueryObjectEXT ? t.getQueryObjectEXT(r, t.QUERY_RESULT_EXT) : this.getQueryResult(r);
+ }, ke.a.prototype._getTimeQueryAvailability = function(r) {
+ var t = this.getCaps().timerQuery;
+ return t.getQueryObjectEXT ? t.getQueryObjectEXT(r, t.QUERY_RESULT_AVAILABLE_EXT) : this.isQueryResultAvailable(r);
+ }, ke.a.prototype.startTimeQuery = function() {
+ var r = this.getCaps(), t = r.timerQuery;
+ if (!t)
+ return null;
+ var e = new nf();
+ if (this._gl.getParameter(t.GPU_DISJOINT_EXT), r.canUseTimestampForTimerQuery)
+ e._startTimeQuery = this._createTimeQuery(), t.queryCounterEXT(e._startTimeQuery, t.TIMESTAMP_EXT);
+ else {
+ if (this._currentNonTimestampToken)
+ return this._currentNonTimestampToken;
+ e._timeElapsedQuery = this._createTimeQuery(), t.beginQueryEXT ? t.beginQueryEXT(t.TIME_ELAPSED_EXT, e._timeElapsedQuery) : this._gl.beginQuery(t.TIME_ELAPSED_EXT, e._timeElapsedQuery), this._currentNonTimestampToken = e;
+ }
+ return e;
+ }, ke.a.prototype.endTimeQuery = function(r) {
+ var t = this.getCaps(), e = t.timerQuery;
+ if (!e || !r)
+ return -1;
+ if (t.canUseTimestampForTimerQuery) {
+ if (!r._startTimeQuery)
+ return -1;
+ r._endTimeQuery || (r._endTimeQuery = this._createTimeQuery(), e.queryCounterEXT(r._endTimeQuery, e.TIMESTAMP_EXT));
+ } else if (!r._timeElapsedQueryEnded) {
+ if (!r._timeElapsedQuery)
+ return -1;
+ e.endQueryEXT ? e.endQueryEXT(e.TIME_ELAPSED_EXT) : this._gl.endQuery(e.TIME_ELAPSED_EXT), r._timeElapsedQueryEnded = !0;
+ }
+ var n = this._gl.getParameter(e.GPU_DISJOINT_EXT), i = !1;
+ if (r._endTimeQuery ? i = this._getTimeQueryAvailability(r._endTimeQuery) : r._timeElapsedQuery && (i = this._getTimeQueryAvailability(r._timeElapsedQuery)), i && !n) {
+ var o = 0;
+ if (t.canUseTimestampForTimerQuery) {
+ if (!r._startTimeQuery || !r._endTimeQuery)
+ return -1;
+ var a = this._getTimeQueryResult(r._startTimeQuery);
+ o = this._getTimeQueryResult(r._endTimeQuery) - a, this._deleteTimeQuery(r._startTimeQuery), this._deleteTimeQuery(r._endTimeQuery), r._startTimeQuery = null, r._endTimeQuery = null;
+ } else {
+ if (!r._timeElapsedQuery)
+ return -1;
+ o = this._getTimeQueryResult(r._timeElapsedQuery), this._deleteTimeQuery(r._timeElapsedQuery), r._timeElapsedQuery = null, r._timeElapsedQueryEnded = !1, this._currentNonTimestampToken = null;
+ }
+ return o;
+ }
+ return -1;
+ }, ke.a.prototype._getGlAlgorithmType = function(r) {
+ return r === Nt.a.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE ? this._gl.ANY_SAMPLES_PASSED_CONSERVATIVE : this._gl.ANY_SAMPLES_PASSED;
+ }, Object.defineProperty(Nt.a.prototype, "isOcclusionQueryInProgress", { get: function() {
+ return this._occlusionDataStorage.isOcclusionQueryInProgress;
+ }, set: function(r) {
+ this._occlusionDataStorage.isOcclusionQueryInProgress = r;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(Nt.a.prototype, "_occlusionDataStorage", { get: function() {
+ return this.__occlusionDataStorage || (this.__occlusionDataStorage = new rf()), this.__occlusionDataStorage;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(Nt.a.prototype, "isOccluded", { get: function() {
+ return this._occlusionDataStorage.isOccluded;
+ }, set: function(r) {
+ this._occlusionDataStorage.isOccluded = r;
+ }, enumerable: !0, configurable: !0 }), Object.defineProperty(Nt.a.prototype, "occlusionQueryAlgorithmType", { get: function() {
+ return this._occlusionDataStorage.occlusionQueryAlgorithmType;
+ }, set: function(r) {
+ this._occlusionDataStorage.occlusionQueryAlgorithmType = r;
+ }, enumerable: !0, configurable: !0 }), Object.defineProperty(Nt.a.prototype, "occlusionType", { get: function() {
+ return this._occlusionDataStorage.occlusionType;
+ }, set: function(r) {
+ this._occlusionDataStorage.occlusionType = r;
+ }, enumerable: !0, configurable: !0 }), Object.defineProperty(Nt.a.prototype, "occlusionRetryCount", { get: function() {
+ return this._occlusionDataStorage.occlusionRetryCount;
+ }, set: function(r) {
+ this._occlusionDataStorage.occlusionRetryCount = r;
+ }, enumerable: !0, configurable: !0 }), Nt.a.prototype._checkOcclusionQuery = function() {
+ var r = this._occlusionDataStorage;
+ if (r.occlusionType === Nt.a.OCCLUSION_TYPE_NONE)
+ return r.isOccluded = !1, !1;
+ var t = this.getEngine();
+ if (t.webGLVersion < 2 || !t.isQueryResultAvailable)
+ return r.isOccluded = !1, !1;
+ if (this.isOcclusionQueryInProgress && this._occlusionQuery)
+ if (t.isQueryResultAvailable(this._occlusionQuery)) {
+ var e = t.getQueryResult(this._occlusionQuery);
+ r.isOcclusionQueryInProgress = !1, r.occlusionInternalRetryCounter = 0, r.isOccluded = e !== 1;
+ } else {
+ if (r.occlusionInternalRetryCounter++, !(r.occlusionRetryCount !== -1 && r.occlusionInternalRetryCounter > r.occlusionRetryCount))
+ return !1;
+ r.isOcclusionQueryInProgress = !1, r.occlusionInternalRetryCounter = 0, r.isOccluded = r.occlusionType !== Nt.a.OCCLUSION_TYPE_OPTIMISTIC && r.isOccluded;
+ }
+ var n = this.getScene();
+ if (n.getBoundingBoxRenderer) {
+ var i = n.getBoundingBoxRenderer();
+ this._occlusionQuery || (this._occlusionQuery = t.createQuery()), t.beginOcclusionQuery(r.occlusionQueryAlgorithmType, this._occlusionQuery), i.renderOcclusionBoundingBox(this), t.endOcclusionQuery(r.occlusionQueryAlgorithmType), this._occlusionDataStorage.isOcclusionQueryInProgress = !0;
+ }
+ return r.isOccluded;
+ };
+ var mb = !0;
+ ke.a.prototype.createTransformFeedback = function() {
+ return this._gl.createTransformFeedback();
+ }, ke.a.prototype.deleteTransformFeedback = function(r) {
+ this._gl.deleteTransformFeedback(r);
+ }, ke.a.prototype.bindTransformFeedback = function(r) {
+ this._gl.bindTransformFeedback(this._gl.TRANSFORM_FEEDBACK, r);
+ }, ke.a.prototype.beginTransformFeedback = function(r) {
+ r === void 0 && (r = !0), this._gl.beginTransformFeedback(r ? this._gl.POINTS : this._gl.TRIANGLES);
+ }, ke.a.prototype.endTransformFeedback = function() {
+ this._gl.endTransformFeedback();
+ }, ke.a.prototype.setTranformFeedbackVaryings = function(r, t) {
+ this._gl.transformFeedbackVaryings(r, t, this._gl.INTERLEAVED_ATTRIBS);
+ }, ke.a.prototype.bindTransformFeedbackBuffer = function(r) {
+ this._gl.bindBufferBase(this._gl.TRANSFORM_FEEDBACK_BUFFER, 0, r ? r.underlyingResource : null);
+ }, l(126), Gt.a.prototype.updateVideoTexture = function(r, t, e) {
+ if (r && !r._isDisabled) {
+ var n = this._bindTextureDirectly(this._gl.TEXTURE_2D, r, !0);
+ this._unpackFlipY(!e);
+ try {
+ if (this._videoTextureSupported === void 0 && (this._gl.getError(), this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA, this._gl.UNSIGNED_BYTE, t), this._gl.getError() !== 0 ? this._videoTextureSupported = !1 : this._videoTextureSupported = !0), this._videoTextureSupported)
+ this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA, this._gl.UNSIGNED_BYTE, t);
+ else {
+ if (!r._workingCanvas) {
+ r._workingCanvas = _l.a.CreateCanvas(r.width, r.height);
+ var i = r._workingCanvas.getContext("2d");
+ if (!i)
+ throw new Error("Unable to get 2d context");
+ r._workingContext = i, r._workingCanvas.width = r.width, r._workingCanvas.height = r.height;
+ }
+ r._workingContext.clearRect(0, 0, r.width, r.height), r._workingContext.drawImage(t, 0, 0, t.videoWidth, t.videoHeight, 0, 0, r.width, r.height), this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA, this._gl.UNSIGNED_BYTE, r._workingCanvas);
+ }
+ r.generateMipMaps && this._gl.generateMipmap(this._gl.TEXTURE_2D), n || this._bindTextureDirectly(this._gl.TEXTURE_2D, null), r.isReady = !0;
+ } catch {
+ r._isDisabled = !0;
+ }
+ }
+ }, Gt.a.prototype.restoreSingleAttachment = function() {
+ var r = this._gl;
+ this.bindAttachments([r.BACK]);
+ }, Gt.a.prototype.buildTextureLayout = function(r) {
+ for (var t = this._gl, e = [], n = 0; n < r.length; n++)
+ r[n] ? e.push(t["COLOR_ATTACHMENT" + n]) : e.push(t.NONE);
+ return e;
+ }, Gt.a.prototype.bindAttachments = function(r) {
+ this._gl.drawBuffers(r);
+ }, Gt.a.prototype.unBindMultiColorAttachmentFramebuffer = function(r, t, e) {
+ t === void 0 && (t = !1), this._currentRenderTarget = null;
+ var n = this._gl, i = r[0]._attachments, o = i.length;
+ if (r[0]._MSAAFramebuffer) {
+ n.bindFramebuffer(n.READ_FRAMEBUFFER, r[0]._MSAAFramebuffer), n.bindFramebuffer(n.DRAW_FRAMEBUFFER, r[0]._framebuffer);
+ for (var a = 0; a < o; a++) {
+ for (var s = r[a], p = 0; p < o; p++)
+ i[p] = n.NONE;
+ i[a] = n[this.webGLVersion > 1 ? "COLOR_ATTACHMENT" + a : "COLOR_ATTACHMENT" + a + "_WEBGL"], n.readBuffer(i[a]), n.drawBuffers(i), n.blitFramebuffer(0, 0, s.width, s.height, 0, 0, s.width, s.height, n.COLOR_BUFFER_BIT, n.NEAREST);
+ }
+ for (a = 0; a < o; a++)
+ i[a] = n[this.webGLVersion > 1 ? "COLOR_ATTACHMENT" + a : "COLOR_ATTACHMENT" + a + "_WEBGL"];
+ n.drawBuffers(i);
+ }
+ for (a = 0; a < o; a++)
+ !(s = r[a]).generateMipMaps || t || s.isCube || (this._bindTextureDirectly(n.TEXTURE_2D, s, !0), n.generateMipmap(n.TEXTURE_2D), this._bindTextureDirectly(n.TEXTURE_2D, null));
+ e && (r[0]._MSAAFramebuffer && this._bindUnboundFramebuffer(r[0]._framebuffer), e()), this._bindUnboundFramebuffer(null);
+ }, Gt.a.prototype.createMultipleRenderTarget = function(r, t) {
+ var e = !1, n = !0, i = !1, o = !1, a = 1, s = d.a.TEXTURETYPE_UNSIGNED_INT, p = d.a.TEXTURE_TRILINEAR_SAMPLINGMODE, m = new Array(), S = new Array();
+ t !== void 0 && (e = t.generateMipMaps !== void 0 && t.generateMipMaps, n = t.generateDepthBuffer === void 0 || t.generateDepthBuffer, i = t.generateStencilBuffer !== void 0 && t.generateStencilBuffer, o = t.generateDepthTexture !== void 0 && t.generateDepthTexture, a = t.textureCount || 1, t.types && (m = t.types), t.samplingModes && (S = t.samplingModes));
+ var O = this._gl, I = O.createFramebuffer();
+ this._bindUnboundFramebuffer(I);
+ for (var G = r.width || r, k = r.height || r, K = [], re = [], se = this._setupFramebufferDepthAttachments(i, n, G, k), ue = 0; ue < a; ue++) {
+ var he = S[ue] || p, pe = m[ue] || s;
+ (pe !== d.a.TEXTURETYPE_FLOAT || this._caps.textureFloatLinearFiltering) && (pe !== d.a.TEXTURETYPE_HALF_FLOAT || this._caps.textureHalfFloatLinearFiltering) || (he = d.a.TEXTURE_NEAREST_SAMPLINGMODE);
+ var ve = this._getSamplingParameters(he, e);
+ pe !== d.a.TEXTURETYPE_FLOAT || this._caps.textureFloat || (pe = d.a.TEXTURETYPE_UNSIGNED_INT, h.a.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type"));
+ var Ee = new Rt.a(this, Rt.b.MultiRenderTarget), Ae = O[this.webGLVersion > 1 ? "COLOR_ATTACHMENT" + ue : "COLOR_ATTACHMENT" + ue + "_WEBGL"];
+ K.push(Ee), re.push(Ae), O.activeTexture(O["TEXTURE" + ue]), O.bindTexture(O.TEXTURE_2D, Ee._webGLTexture), O.texParameteri(O.TEXTURE_2D, O.TEXTURE_MAG_FILTER, ve.mag), O.texParameteri(O.TEXTURE_2D, O.TEXTURE_MIN_FILTER, ve.min), O.texParameteri(O.TEXTURE_2D, O.TEXTURE_WRAP_S, O.CLAMP_TO_EDGE), O.texParameteri(O.TEXTURE_2D, O.TEXTURE_WRAP_T, O.CLAMP_TO_EDGE), O.texImage2D(O.TEXTURE_2D, 0, this._getRGBABufferInternalSizedFormat(pe), G, k, 0, O.RGBA, this._getWebGLTextureType(pe), null), O.framebufferTexture2D(O.DRAW_FRAMEBUFFER, Ae, O.TEXTURE_2D, Ee._webGLTexture, 0), e && this._gl.generateMipmap(this._gl.TEXTURE_2D), this._bindTextureDirectly(O.TEXTURE_2D, null), Ee._framebuffer = I, Ee._depthStencilBuffer = se, Ee.baseWidth = G, Ee.baseHeight = k, Ee.width = G, Ee.height = k, Ee.isReady = !0, Ee.samples = 1, Ee.generateMipMaps = e, Ee.samplingMode = he, Ee.type = pe, Ee._generateDepthBuffer = n, Ee._generateStencilBuffer = i, Ee._attachments = re, Ee._textureArray = K, this._internalTexturesCache.push(Ee);
+ }
+ if (o && this._caps.depthTextureExtension) {
+ var Ie = new Rt.a(this, Rt.b.MultiRenderTarget);
+ O.activeTexture(O.TEXTURE0), O.bindTexture(O.TEXTURE_2D, Ie._webGLTexture), O.texParameteri(O.TEXTURE_2D, O.TEXTURE_MAG_FILTER, O.NEAREST), O.texParameteri(O.TEXTURE_2D, O.TEXTURE_MIN_FILTER, O.NEAREST), O.texParameteri(O.TEXTURE_2D, O.TEXTURE_WRAP_S, O.CLAMP_TO_EDGE), O.texParameteri(O.TEXTURE_2D, O.TEXTURE_WRAP_T, O.CLAMP_TO_EDGE), O.texImage2D(O.TEXTURE_2D, 0, this.webGLVersion < 2 ? O.DEPTH_COMPONENT : O.DEPTH_COMPONENT16, G, k, 0, O.DEPTH_COMPONENT, O.UNSIGNED_SHORT, null), O.framebufferTexture2D(O.FRAMEBUFFER, O.DEPTH_ATTACHMENT, O.TEXTURE_2D, Ie._webGLTexture, 0), Ie._framebuffer = I, Ie.baseWidth = G, Ie.baseHeight = k, Ie.width = G, Ie.height = k, Ie.isReady = !0, Ie.samples = 1, Ie.generateMipMaps = e, Ie.samplingMode = O.NEAREST, Ie._generateDepthBuffer = n, Ie._generateStencilBuffer = i, K.push(Ie), this._internalTexturesCache.push(Ie);
+ }
+ return O.drawBuffers(re), this._bindUnboundFramebuffer(null), this.resetTextureCache(), K;
+ }, Gt.a.prototype.updateMultipleRenderTargetTextureSampleCount = function(r, t) {
+ if (this.webGLVersion < 2 || !r)
+ return 1;
+ if (r[0].samples === t)
+ return t;
+ var e = r[0]._attachments.length;
+ if (e === 0)
+ return 1;
+ var n = this._gl;
+ t = Math.min(t, this.getCaps().maxMSAASamples), r[0]._depthStencilBuffer && (n.deleteRenderbuffer(r[0]._depthStencilBuffer), r[0]._depthStencilBuffer = null), r[0]._MSAAFramebuffer && (n.deleteFramebuffer(r[0]._MSAAFramebuffer), r[0]._MSAAFramebuffer = null);
+ for (var i = 0; i < e; i++)
+ r[i]._MSAARenderBuffer && (n.deleteRenderbuffer(r[i]._MSAARenderBuffer), r[i]._MSAARenderBuffer = null);
+ if (t > 1 && n.renderbufferStorageMultisample) {
+ var o = n.createFramebuffer();
+ if (!o)
+ throw new Error("Unable to create multi sampled framebuffer");
+ this._bindUnboundFramebuffer(o);
+ var a = this._setupFramebufferDepthAttachments(r[0]._generateStencilBuffer, r[0]._generateDepthBuffer, r[0].width, r[0].height, t), s = [];
+ for (i = 0; i < e; i++) {
+ var p = r[i], m = n[this.webGLVersion > 1 ? "COLOR_ATTACHMENT" + i : "COLOR_ATTACHMENT" + i + "_WEBGL"], S = n.createRenderbuffer();
+ if (!S)
+ throw new Error("Unable to create multi sampled framebuffer");
+ n.bindRenderbuffer(n.RENDERBUFFER, S), n.renderbufferStorageMultisample(n.RENDERBUFFER, t, this._getRGBAMultiSampleBufferFormat(p.type), p.width, p.height), n.framebufferRenderbuffer(n.FRAMEBUFFER, m, n.RENDERBUFFER, S), p._MSAAFramebuffer = o, p._MSAARenderBuffer = S, p.samples = t, p._depthStencilBuffer = a, n.bindRenderbuffer(n.RENDERBUFFER, null), s.push(m);
+ }
+ n.drawBuffers(s);
+ } else
+ this._bindUnboundFramebuffer(r[0]._framebuffer);
+ return this._bindUnboundFramebuffer(null), t;
+ };
+ var ba = l(56);
+ Gt.a.prototype._createDepthStencilCubeTexture = function(r, t) {
+ var e = new Rt.a(this, Rt.b.Unknown);
+ if (e.isCube = !0, this.webGLVersion === 1)
+ return h.a.Error("Depth cube texture is not supported by WebGL 1."), e;
+ var n = Object(u.a)({ bilinearFiltering: !1, comparisonFunction: 0, generateStencil: !1 }, t), i = this._gl;
+ this._bindTextureDirectly(i.TEXTURE_CUBE_MAP, e, !0), this._setupDepthStencilTexture(e, r, n.generateStencil, n.bilinearFiltering, n.comparisonFunction);
+ for (var o = 0; o < 6; o++)
+ n.generateStencil ? i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + o, 0, i.DEPTH24_STENCIL8, r, r, 0, i.DEPTH_STENCIL, i.UNSIGNED_INT_24_8, null) : i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + o, 0, i.DEPTH_COMPONENT24, r, r, 0, i.DEPTH_COMPONENT, i.UNSIGNED_INT, null);
+ return this._bindTextureDirectly(i.TEXTURE_CUBE_MAP, null), e;
+ }, Gt.a.prototype._partialLoadFile = function(r, t, e, n, i) {
+ i === void 0 && (i = null), this._loadFile(r, function(o) {
+ e[t] = o, e._internalCount++, e._internalCount === 6 && n(e);
+ }, void 0, void 0, !0, function(o, a) {
+ i && o && i(o.status + " " + o.statusText, a);
+ });
+ }, Gt.a.prototype._cascadeLoadFiles = function(r, t, e, n) {
+ n === void 0 && (n = null);
+ var i = [];
+ i._internalCount = 0;
+ for (var o = 0; o < 6; o++)
+ this._partialLoadFile(e[o], o, i, t, n);
+ }, Gt.a.prototype._cascadeLoadImgs = function(r, t, e, n, i) {
+ n === void 0 && (n = null);
+ var o = [];
+ o._internalCount = 0;
+ for (var a = 0; a < 6; a++)
+ this._partialLoadImg(e[a], a, o, r, t, n, i);
+ }, Gt.a.prototype._partialLoadImg = function(r, t, e, n, i, o, a) {
+ var s;
+ o === void 0 && (o = null), s = ba.a.LoadImage(r, function() {
+ s && (e[t] = s, e._internalCount++, n && n._removePendingData(s)), e._internalCount === 6 && i(e);
+ }, function(p, m) {
+ n && n._removePendingData(s), o && o(p, m);
+ }, n ? n.offlineProvider : null, a), n && s && n._addPendingData(s);
+ }, Gt.a.prototype._setCubeMapTextureParams = function(r, t) {
+ var e = this._gl;
+ e.texParameteri(e.TEXTURE_CUBE_MAP, e.TEXTURE_MAG_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_CUBE_MAP, e.TEXTURE_MIN_FILTER, t ? e.LINEAR_MIPMAP_LINEAR : e.LINEAR), e.texParameteri(e.TEXTURE_CUBE_MAP, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_CUBE_MAP, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), r.samplingMode = t ? d.a.TEXTURE_TRILINEAR_SAMPLINGMODE : d.a.TEXTURE_LINEAR_LINEAR, this._bindTextureDirectly(e.TEXTURE_CUBE_MAP, null);
+ }, Gt.a.prototype.createCubeTexture = function(r, t, e, n, i, o, a, s, p, m, S, O, I) {
+ var G = this;
+ i === void 0 && (i = null), o === void 0 && (o = null), s === void 0 && (s = null), p === void 0 && (p = !1), m === void 0 && (m = 0), S === void 0 && (S = 0), O === void 0 && (O = null);
+ var k = this._gl, K = O || new Rt.a(this, Rt.b.Cube);
+ K.isCube = !0, K.url = r, K.generateMipMaps = !n, K._lodGenerationScale = m, K._lodGenerationOffset = S, this._doNotHandleContextLost || (K._extension = s, K._files = e);
+ var re = r;
+ this._transformTextureUrl && !O && (r = this._transformTextureUrl(r));
+ for (var se = r.lastIndexOf("."), ue = s || (se > -1 ? r.substring(se).toLowerCase() : ""), he = null, pe = 0, ve = Gt.a._TextureLoaders; pe < ve.length; pe++) {
+ var Ee = ve[pe];
+ if (Ee.canLoad(ue)) {
+ he = Ee;
+ break;
+ }
+ }
+ if (he) {
+ var Ae = function(Ie) {
+ G._bindTextureDirectly(k.TEXTURE_CUBE_MAP, K, !0), he.loadCubeData(Ie, K, p, i, o);
+ };
+ e && e.length === 6 ? he.supportCascades ? this._cascadeLoadFiles(t, function(Ie) {
+ return Ae(Ie.map(function(xe) {
+ return new Uint8Array(xe);
+ }));
+ }, e, o) : o ? o("Textures type does not support cascades.") : h.a.Warn("Texture loader does not support cascades.") : this._loadFile(r, function(Ie) {
+ return Ae(new Uint8Array(Ie));
+ }, void 0, void 0, !0, function(Ie, xe) {
+ r === re ? o && Ie && o(Ie.status + " " + Ie.statusText, xe) : (h.a.Warn("Failed to load " + r + ", falling back to the " + re), G.createCubeTexture(re, t, e, n, i, o, a, s, p, m, S, K, I));
+ });
+ } else {
+ if (!e)
+ throw new Error("Cannot load cubemap because files were not defined");
+ this._cascadeLoadImgs(t, function(Ie) {
+ var xe = G.needPOTTextures ? Gt.a.GetExponentOfTwo(Ie[0].width, G._caps.maxCubemapTextureSize) : Ie[0].width, Pe = xe, Ce = [k.TEXTURE_CUBE_MAP_POSITIVE_X, k.TEXTURE_CUBE_MAP_POSITIVE_Y, k.TEXTURE_CUBE_MAP_POSITIVE_Z, k.TEXTURE_CUBE_MAP_NEGATIVE_X, k.TEXTURE_CUBE_MAP_NEGATIVE_Y, k.TEXTURE_CUBE_MAP_NEGATIVE_Z];
+ G._bindTextureDirectly(k.TEXTURE_CUBE_MAP, K, !0), G._unpackFlipY(!1);
+ for (var Fe = a ? G._getInternalFormat(a) : G._gl.RGBA, Oe = 0; Oe < Ce.length; Oe++)
+ if (Ie[Oe].width !== xe || Ie[Oe].height !== Pe) {
+ if (G._prepareWorkingCanvas(), !G._workingCanvas || !G._workingContext)
+ return void h.a.Warn("Cannot create canvas to resize texture.");
+ G._workingCanvas.width = xe, G._workingCanvas.height = Pe, G._workingContext.drawImage(Ie[Oe], 0, 0, Ie[Oe].width, Ie[Oe].height, 0, 0, xe, Pe), k.texImage2D(Ce[Oe], 0, Fe, Fe, k.UNSIGNED_BYTE, G._workingCanvas);
+ } else
+ k.texImage2D(Ce[Oe], 0, Fe, Fe, k.UNSIGNED_BYTE, Ie[Oe]);
+ n || k.generateMipmap(k.TEXTURE_CUBE_MAP), G._setCubeMapTextureParams(K, !n), K.width = xe, K.height = Pe, K.isReady = !0, a && (K.format = a), K.onLoadedObservable.notifyObservers(K), K.onLoadedObservable.clear(), i && i();
+ }, e, o);
+ }
+ return this._internalTexturesCache.push(K), K;
+ }, l(153), l(124);
+ var gb = function() {
+ };
+ ke.a.prototype.getInputElement = function() {
+ return this.inputElement || this.getRenderingCanvas();
+ }, ke.a.prototype.registerView = function(r, t) {
+ var e = this;
+ this.views || (this.views = []);
+ for (var n = 0, i = this.views; n < i.length; n++) {
+ var o = i[n];
+ if (o.target === r)
+ return o;
+ }
+ var a = this.getRenderingCanvas();
+ a && (r.width = a.width, r.height = a.height);
+ var s = { target: r, camera: t };
+ return this.views.push(s), t && t.onDisposeObservable.add(function() {
+ e.unRegisterView(r);
+ }), s;
+ }, ke.a.prototype.unRegisterView = function(r) {
+ if (!this.views)
+ return this;
+ for (var t = 0, e = this.views; t < e.length; t++) {
+ var n = e[t];
+ if (n.target === r) {
+ var i = this.views.indexOf(n);
+ i !== -1 && this.views.splice(i, 1);
+ break;
+ }
+ }
+ return this;
+ }, ke.a.prototype._renderViews = function() {
+ if (!this.views)
+ return !1;
+ var r = this.getRenderingCanvas();
+ if (!r)
+ return !1;
+ for (var t = 0, e = this.views; t < e.length; t++) {
+ var n = e[t], i = n.target, o = i.getContext("2d");
+ if (o) {
+ var a = n.camera, s = null, p = null;
+ if (a) {
+ if ((p = a.getScene()).activeCameras && p.activeCameras.length)
+ continue;
+ this.activeView = n, s = p.activeCamera, p.activeCamera = a;
+ }
+ var m = i.width !== i.clientWidth || i.height !== i.clientHeight;
+ if (i.clientWidth && i.clientHeight && m && (i.width = i.clientWidth, i.height = i.clientHeight, r.width = i.clientWidth, r.height = i.clientHeight, this.resize()), !r.width || !r.height)
+ return !1;
+ this._renderFrame(), o.drawImage(r, 0, 0), s && p && (p.activeCamera = s);
+ }
+ }
+ return this.activeView = null, !0;
+ }, l(129);
+ function vb(r) {
+ if (this._excludedCompressedTextures && this._excludedCompressedTextures.some(function(i) {
+ var o = "\\b" + i + "\\b";
+ return r && (r === i || r.match(new RegExp(o, "g")));
+ }))
+ return r;
+ var t = r.lastIndexOf("."), e = r.lastIndexOf("?"), n = e > -1 ? r.substring(e, r.length) : "";
+ return (t > -1 ? r.substring(0, t) : r) + this._textureFormatInUse + n;
+ }
+ Object.defineProperty(ke.a.prototype, "texturesSupported", { get: function() {
+ var r = new Array();
+ return this._caps.astc && r.push("-astc.ktx"), this._caps.s3tc && r.push("-dxt.ktx"), this._caps.pvrtc && r.push("-pvrtc.ktx"), this._caps.etc2 && r.push("-etc2.ktx"), this._caps.etc1 && r.push("-etc1.ktx"), r;
+ }, enumerable: !0, configurable: !0 }), Object.defineProperty(ke.a.prototype, "textureFormatInUse", { get: function() {
+ return this._textureFormatInUse || null;
+ }, enumerable: !0, configurable: !0 }), ke.a.prototype.setCompressedTextureExclusions = function(r) {
+ this._excludedCompressedTextures = r;
+ }, ke.a.prototype.setTextureFormatToUse = function(r) {
+ for (var t = this.texturesSupported, e = 0, n = t.length; e < n; e++)
+ for (var i = 0, o = r.length; i < o; i++)
+ if (t[e] === r[i].toLowerCase())
+ return this._transformTextureUrl = vb.bind(this), this._textureFormatInUse = t[e];
+ return this._textureFormatInUse = "", this._transformTextureUrl = null, null;
+ };
+ var bb = l(144), of = l(118), af = l(89), ki = [Math.sqrt(1 / (4 * Math.PI)), -Math.sqrt(3 / (4 * Math.PI)), Math.sqrt(3 / (4 * Math.PI)), -Math.sqrt(3 / (4 * Math.PI)), Math.sqrt(15 / (4 * Math.PI)), -Math.sqrt(15 / (4 * Math.PI)), Math.sqrt(5 / (16 * Math.PI)), -Math.sqrt(15 / (4 * Math.PI)), Math.sqrt(15 / (16 * Math.PI))], yb = [function(r) {
+ return 1;
+ }, function(r) {
+ return r.y;
+ }, function(r) {
+ return r.z;
+ }, function(r) {
+ return r.x;
+ }, function(r) {
+ return r.x * r.y;
+ }, function(r) {
+ return r.y * r.z;
+ }, function(r) {
+ return 3 * r.z * r.z - 1;
+ }, function(r) {
+ return r.x * r.z;
+ }, function(r) {
+ return r.x * r.x - r.y * r.y;
+ }], er = function(r, t) {
+ return ki[r] * yb[r](t);
+ }, tr = [Math.PI, 2 * Math.PI / 3, 2 * Math.PI / 3, 2 * Math.PI / 3, Math.PI / 4, Math.PI / 4, Math.PI / 4, Math.PI / 4, Math.PI / 4], Al = function() {
+ function r() {
+ this.preScaled = !1, this.l00 = c.e.Zero(), this.l1_1 = c.e.Zero(), this.l10 = c.e.Zero(), this.l11 = c.e.Zero(), this.l2_2 = c.e.Zero(), this.l2_1 = c.e.Zero(), this.l20 = c.e.Zero(), this.l21 = c.e.Zero(), this.l22 = c.e.Zero();
+ }
+ return r.prototype.addLight = function(t, e, n) {
+ var i = new c.e(e.r, e.g, e.b).scale(n);
+ this.l00 = this.l00.add(i.scale(er(0, t))), this.l1_1 = this.l1_1.add(i.scale(er(1, t))), this.l10 = this.l10.add(i.scale(er(2, t))), this.l11 = this.l11.add(i.scale(er(3, t))), this.l2_2 = this.l2_2.add(i.scale(er(4, t))), this.l2_1 = this.l2_1.add(i.scale(er(5, t))), this.l20 = this.l20.add(i.scale(er(6, t))), this.l21 = this.l21.add(i.scale(er(7, t))), this.l22 = this.l22.add(i.scale(er(8, t)));
+ }, r.prototype.scaleInPlace = function(t) {
+ this.l00.scaleInPlace(t), this.l1_1.scaleInPlace(t), this.l10.scaleInPlace(t), this.l11.scaleInPlace(t), this.l2_2.scaleInPlace(t), this.l2_1.scaleInPlace(t), this.l20.scaleInPlace(t), this.l21.scaleInPlace(t), this.l22.scaleInPlace(t);
+ }, r.prototype.convertIncidentRadianceToIrradiance = function() {
+ this.l00.scaleInPlace(tr[0]), this.l1_1.scaleInPlace(tr[1]), this.l10.scaleInPlace(tr[2]), this.l11.scaleInPlace(tr[3]), this.l2_2.scaleInPlace(tr[4]), this.l2_1.scaleInPlace(tr[5]), this.l20.scaleInPlace(tr[6]), this.l21.scaleInPlace(tr[7]), this.l22.scaleInPlace(tr[8]);
+ }, r.prototype.convertIrradianceToLambertianRadiance = function() {
+ this.scaleInPlace(1 / Math.PI);
+ }, r.prototype.preScaleForRendering = function() {
+ this.preScaled = !0, this.l00.scaleInPlace(ki[0]), this.l1_1.scaleInPlace(ki[1]), this.l10.scaleInPlace(ki[2]), this.l11.scaleInPlace(ki[3]), this.l2_2.scaleInPlace(ki[4]), this.l2_1.scaleInPlace(ki[5]), this.l20.scaleInPlace(ki[6]), this.l21.scaleInPlace(ki[7]), this.l22.scaleInPlace(ki[8]);
+ }, r.FromArray = function(t) {
+ var e = new r();
+ return c.e.FromArrayToRef(t[0], 0, e.l00), c.e.FromArrayToRef(t[1], 0, e.l1_1), c.e.FromArrayToRef(t[2], 0, e.l10), c.e.FromArrayToRef(t[3], 0, e.l11), c.e.FromArrayToRef(t[4], 0, e.l2_2), c.e.FromArrayToRef(t[5], 0, e.l2_1), c.e.FromArrayToRef(t[6], 0, e.l20), c.e.FromArrayToRef(t[7], 0, e.l21), c.e.FromArrayToRef(t[8], 0, e.l22), e;
+ }, r.FromPolynomial = function(t) {
+ var e = new r();
+ return e.l00 = t.xx.scale(0.376127).add(t.yy.scale(0.376127)).add(t.zz.scale(0.376126)), e.l1_1 = t.y.scale(0.977204), e.l10 = t.z.scale(0.977204), e.l11 = t.x.scale(0.977204), e.l2_2 = t.xy.scale(1.16538), e.l2_1 = t.yz.scale(1.16538), e.l20 = t.zz.scale(1.34567).subtract(t.xx.scale(0.672834)).subtract(t.yy.scale(0.672834)), e.l21 = t.zx.scale(1.16538), e.l22 = t.xx.scale(1.16538).subtract(t.yy.scale(1.16538)), e.l1_1.scaleInPlace(-1), e.l11.scaleInPlace(-1), e.l2_1.scaleInPlace(-1), e.l21.scaleInPlace(-1), e.scaleInPlace(Math.PI), e;
+ }, r;
+ }(), ya = function() {
+ function r() {
+ this.x = c.e.Zero(), this.y = c.e.Zero(), this.z = c.e.Zero(), this.xx = c.e.Zero(), this.yy = c.e.Zero(), this.zz = c.e.Zero(), this.xy = c.e.Zero(), this.yz = c.e.Zero(), this.zx = c.e.Zero();
+ }
+ return Object.defineProperty(r.prototype, "preScaledHarmonics", { get: function() {
+ return this._harmonics || (this._harmonics = Al.FromPolynomial(this)), this._harmonics.preScaled || this._harmonics.preScaleForRendering(), this._harmonics;
+ }, enumerable: !1, configurable: !0 }), r.prototype.addAmbient = function(t) {
+ var e = new c.e(t.r, t.g, t.b);
+ this.xx = this.xx.add(e), this.yy = this.yy.add(e), this.zz = this.zz.add(e);
+ }, r.prototype.scaleInPlace = function(t) {
+ this.x.scaleInPlace(t), this.y.scaleInPlace(t), this.z.scaleInPlace(t), this.xx.scaleInPlace(t), this.yy.scaleInPlace(t), this.zz.scaleInPlace(t), this.yz.scaleInPlace(t), this.zx.scaleInPlace(t), this.xy.scaleInPlace(t);
+ }, r.FromHarmonics = function(t) {
+ var e = new r();
+ return e._harmonics = t, e.x = t.l11.scale(1.02333).scale(-1), e.y = t.l1_1.scale(1.02333).scale(-1), e.z = t.l10.scale(1.02333), e.xx = t.l00.scale(0.886277).subtract(t.l20.scale(0.247708)).add(t.l22.scale(0.429043)), e.yy = t.l00.scale(0.886277).subtract(t.l20.scale(0.247708)).subtract(t.l22.scale(0.429043)), e.zz = t.l00.scale(0.886277).add(t.l20.scale(0.495417)), e.yz = t.l2_1.scale(0.858086).scale(-1), e.zx = t.l21.scale(0.858086).scale(-1), e.xy = t.l2_2.scale(0.858086), e.scaleInPlace(1 / Math.PI), e;
+ }, r.FromArray = function(t) {
+ var e = new r();
+ return c.e.FromArrayToRef(t[0], 0, e.x), c.e.FromArrayToRef(t[1], 0, e.y), c.e.FromArrayToRef(t[2], 0, e.z), c.e.FromArrayToRef(t[3], 0, e.xx), c.e.FromArrayToRef(t[4], 0, e.yy), c.e.FromArrayToRef(t[5], 0, e.zz), c.e.FromArrayToRef(t[6], 0, e.yz), c.e.FromArrayToRef(t[7], 0, e.zx), c.e.FromArrayToRef(t[8], 0, e.xy), e;
+ }, r;
+ }(), oi = l(52), To = function(r, t, e, n) {
+ this.name = r, this.worldAxisForNormal = t, this.worldAxisForFileX = e, this.worldAxisForFileY = n;
+ }, Ts = function() {
+ function r() {
+ }
+ return r.ConvertCubeMapTextureToSphericalPolynomial = function(t) {
+ if (!t.isCube)
+ return null;
+ var e, n, i = t.getSize().width, o = t.readPixels(0), a = t.readPixels(1);
+ t.isRenderTarget ? (e = t.readPixels(3), n = t.readPixels(2)) : (e = t.readPixels(2), n = t.readPixels(3));
+ var s = t.readPixels(4), p = t.readPixels(5), m = t.gammaSpace, S = d.a.TEXTUREFORMAT_RGBA, O = d.a.TEXTURETYPE_UNSIGNED_INT;
+ t.textureType != d.a.TEXTURETYPE_FLOAT && t.textureType != d.a.TEXTURETYPE_HALF_FLOAT || (O = d.a.TEXTURETYPE_FLOAT);
+ var I = { size: i, right: o, left: a, up: e, down: n, front: s, back: p, format: S, type: O, gammaSpace: m };
+ return this.ConvertCubeMapToSphericalPolynomial(I);
+ }, r.ConvertCubeMapToSphericalPolynomial = function(t) {
+ for (var e = new Al(), n = 0, i = 2 / t.size, o = i, a = 0.5 * i - 1, s = 0; s < 6; s++)
+ for (var p = this.FileFaces[s], m = t[p.name], S = a, O = t.format === d.a.TEXTUREFORMAT_RGBA ? 4 : 3, I = 0; I < t.size; I++) {
+ for (var G = a, k = 0; k < t.size; k++) {
+ var K = p.worldAxisForFileX.scale(G).add(p.worldAxisForFileY.scale(S)).add(p.worldAxisForNormal);
+ K.normalize();
+ var re = Math.pow(1 + G * G + S * S, -1.5), se = m[I * t.size * O + k * O + 0], ue = m[I * t.size * O + k * O + 1], he = m[I * t.size * O + k * O + 2];
+ isNaN(se) && (se = 0), isNaN(ue) && (ue = 0), isNaN(he) && (he = 0), t.type === d.a.TEXTURETYPE_UNSIGNED_INT && (se /= 255, ue /= 255, he /= 255), t.gammaSpace && (se = Math.pow(ee.a.Clamp(se), Xt.c), ue = Math.pow(ee.a.Clamp(ue), Xt.c), he = Math.pow(ee.a.Clamp(he), Xt.c)), se = ee.a.Clamp(se, 0, 4096), ue = ee.a.Clamp(ue, 0, 4096), he = ee.a.Clamp(he, 0, 4096);
+ var pe = new C.a(se, ue, he);
+ e.addLight(K, pe, re), n += re, G += i;
+ }
+ S += o;
+ }
+ var ve = 6 * (4 * Math.PI) / 6 / n;
+ return e.scaleInPlace(ve), e.convertIncidentRadianceToIrradiance(), e.convertIrradianceToLambertianRadiance(), ya.FromHarmonics(e);
+ }, r.FileFaces = [new To("right", new c.e(1, 0, 0), new c.e(0, 0, -1), new c.e(0, -1, 0)), new To("left", new c.e(-1, 0, 0), new c.e(0, 0, 1), new c.e(0, -1, 0)), new To("up", new c.e(0, 1, 0), new c.e(1, 0, 0), new c.e(0, 0, 1)), new To("down", new c.e(0, -1, 0), new c.e(1, 0, 0), new c.e(0, 0, -1)), new To("front", new c.e(0, 0, 1), new c.e(1, 0, 0), new c.e(0, -1, 0)), new To("back", new c.e(0, 0, -1), new c.e(-1, 0, 0), new c.e(0, -1, 0))], r;
+ }();
+ Object.defineProperty(oi.a.prototype, "sphericalPolynomial", { get: function() {
+ if (this._texture) {
+ if (this._texture._sphericalPolynomial)
+ return this._texture._sphericalPolynomial;
+ if (this._texture.isReady)
+ return this._texture._sphericalPolynomial = Ts.ConvertCubeMapTextureToSphericalPolynomial(this), this._texture._sphericalPolynomial;
+ }
+ return null;
+ }, set: function(r) {
+ this._texture && (this._texture._sphericalPolynomial = r);
+ }, enumerable: !0, configurable: !0 });
+ var Eb = `
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+#include
+void main(void)
+{
+gl_FragColor=toRGBD(texture2D(textureSampler,vUV).rgb);
+}`;
+ We.a.ShadersStore.rgbdEncodePixelShader = Eb;
+ var Tb = `
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+#include
+void main(void)
+{
+gl_FragColor=vec4(fromRGBD(texture2D(textureSampler,vUV)),1.0);
+}`;
+ We.a.ShadersStore.rgbdDecodePixelShader = Tb;
+ var nr = function() {
+ function r() {
+ }
+ return r.GetEnvInfo = function(t) {
+ for (var e = new DataView(t.buffer, t.byteOffset, t.byteLength), n = 0, i = 0; i < r._MagicBytes.length; i++)
+ if (e.getUint8(n++) !== r._MagicBytes[i])
+ return h.a.Error("Not a babylon environment map"), null;
+ for (var o = "", a = 0; a = e.getUint8(n++); )
+ o += String.fromCharCode(a);
+ var s = JSON.parse(o);
+ return s.specular && (s.specular.specularDataPosition = n, s.specular.lodGenerationScale = s.specular.lodGenerationScale || 0.8), s;
+ }, r.CreateEnvTextureAsync = function(t) {
+ var e = this, n = t.getInternalTexture();
+ if (!n)
+ return Promise.reject("The cube texture is invalid.");
+ var i = n.getEngine();
+ if (i && i.premultipliedAlpha)
+ return Promise.reject("Env texture can only be created when the engine is created with the premultipliedAlpha option set to false.");
+ if (t.textureType === d.a.TEXTURETYPE_UNSIGNED_INT)
+ return Promise.reject("The cube texture should allow HDR (Full Float or Half Float).");
+ var o = i.getRenderingCanvas();
+ if (!o)
+ return Promise.reject("Env texture can only be created when the engine is associated to a canvas.");
+ var a = d.a.TEXTURETYPE_FLOAT;
+ if (!i.getCaps().textureFloatRender && (a = d.a.TEXTURETYPE_HALF_FLOAT, !i.getCaps().textureHalfFloatRender))
+ return Promise.reject("Env texture can only be created when the browser supports half float or full float rendering.");
+ var s = n.width, p = new ge.a(i), m = {}, S = [], O = ee.a.Log2(n.width);
+ O = Math.round(O);
+ for (var I = function(k) {
+ for (var K = Math.pow(2, O - k), re = function(ue) {
+ var he = t.readPixels(ue, k), pe = i.createRawTexture(he, K, K, d.a.TEXTUREFORMAT_RGBA, !1, !1, d.a.TEXTURE_NEAREST_SAMPLINGMODE, null, a), ve = new Promise(function(Ee, Ae) {
+ var Ie = new _t("rgbdEncode", "rgbdEncode", null, null, 1, null, d.a.TEXTURE_NEAREST_SAMPLINGMODE, i, !1, void 0, d.a.TEXTURETYPE_UNSIGNED_INT, void 0, null, !1);
+ Ie.getEffect().executeWhenCompiled(function() {
+ Ie.onApply = function(Ce) {
+ Ce._bindTexture("textureSampler", pe);
+ };
+ var xe = i.getRenderWidth(), Pe = i.getRenderHeight();
+ i.setSize(K, K), p.postProcessManager.directRender([Ie], null), Ke.b.ToBlob(o, function(Ce) {
+ var Fe = new FileReader();
+ Fe.onload = function(Oe) {
+ var Be = Oe.target.result;
+ m[6 * k + ue] = Be, Ee();
+ }, Fe.readAsArrayBuffer(Ce);
+ }), i.setSize(xe, Pe);
+ });
+ });
+ S.push(ve);
+ }, se = 0; se < 6; se++)
+ re(se);
+ }, G = 0; G <= O; G++)
+ I(G);
+ return Promise.all(S).then(function() {
+ p.dispose();
+ for (var k = { version: 1, width: s, irradiance: e._CreateEnvTextureIrradiance(t), specular: { mipmaps: [], lodGenerationScale: t.lodGenerationScale } }, K = 0, re = 0; re <= O; re++)
+ for (var se = 0; se < 6; se++) {
+ var ue = m[6 * re + se].byteLength;
+ k.specular.mipmaps.push({ length: ue, position: K }), K += ue;
+ }
+ for (var he = JSON.stringify(k), pe = new ArrayBuffer(he.length + 1), ve = new Uint8Array(pe), Ee = (re = 0, he.length); re < Ee; re++)
+ ve[re] = he.charCodeAt(re);
+ ve[he.length] = 0;
+ var Ae = r._MagicBytes.length + K + pe.byteLength, Ie = new ArrayBuffer(Ae), xe = new Uint8Array(Ie), Pe = new DataView(Ie), Ce = 0;
+ for (re = 0; re < r._MagicBytes.length; re++)
+ Pe.setUint8(Ce++, r._MagicBytes[re]);
+ for (xe.set(new Uint8Array(pe), Ce), Ce += pe.byteLength, re = 0; re <= O; re++)
+ for (se = 0; se < 6; se++) {
+ var Fe = m[6 * re + se];
+ xe.set(new Uint8Array(Fe), Ce), Ce += Fe.byteLength;
+ }
+ return Ie;
+ });
+ }, r._CreateEnvTextureIrradiance = function(t) {
+ var e = t.sphericalPolynomial;
+ return e == null ? null : { x: [e.x.x, e.x.y, e.x.z], y: [e.y.x, e.y.y, e.y.z], z: [e.z.x, e.z.y, e.z.z], xx: [e.xx.x, e.xx.y, e.xx.z], yy: [e.yy.x, e.yy.y, e.yy.z], zz: [e.zz.x, e.zz.y, e.zz.z], yz: [e.yz.x, e.yz.y, e.yz.z], zx: [e.zx.x, e.zx.y, e.zx.z], xy: [e.xy.x, e.xy.y, e.xy.z] };
+ }, r.CreateImageDataArrayBufferViews = function(t, e) {
+ if (e.version !== 1)
+ throw new Error('Unsupported babylon environment map version "' + e.version + '"');
+ var n = e.specular, i = ee.a.Log2(e.width);
+ if (i = Math.round(i) + 1, n.mipmaps.length !== 6 * i)
+ throw new Error('Unsupported specular mipmaps number "' + n.mipmaps.length + '"');
+ for (var o = new Array(i), a = 0; a < i; a++) {
+ o[a] = new Array(6);
+ for (var s = 0; s < 6; s++) {
+ var p = n.mipmaps[6 * a + s];
+ o[a][s] = new Uint8Array(t.buffer, t.byteOffset + n.specularDataPosition + p.position, p.length);
+ }
+ }
+ return o;
+ }, r.UploadEnvLevelsAsync = function(t, e, n) {
+ if (n.version !== 1)
+ throw new Error('Unsupported babylon environment map version "' + n.version + '"');
+ var i = n.specular;
+ if (!i)
+ return Promise.resolve();
+ t._lodGenerationScale = i.lodGenerationScale;
+ var o = r.CreateImageDataArrayBufferViews(e, n);
+ return r.UploadLevelsAsync(t, o);
+ }, r._OnImageReadyAsync = function(t, e, n, i, o, a, s, p, m, S, O) {
+ return new Promise(function(I, G) {
+ if (n) {
+ var k = e.createTexture(null, !0, !0, null, d.a.TEXTURE_NEAREST_SAMPLINGMODE, null, function(re) {
+ G(re);
+ }, t);
+ i.getEffect().executeWhenCompiled(function() {
+ i.onApply = function(re) {
+ re._bindTexture("textureSampler", k), re.setFloat2("scale", 1, 1);
+ }, e.scenes[0].postProcessManager.directRender([i], S, !0, a, s), e.restoreDefaultFramebuffer(), k.dispose(), URL.revokeObjectURL(o), I();
+ });
+ } else {
+ if (e._uploadImageToTexture(O, t, a, s), p) {
+ var K = m[s];
+ K && e._uploadImageToTexture(K._texture, t, a, 0);
+ }
+ I();
+ }
+ });
+ }, r.UploadLevelsAsync = function(t, e) {
+ var n = this;
+ if (!Ke.b.IsExponentOfTwo(t.width))
+ throw new Error("Texture size must be a power of two");
+ var i = Math.round(ee.a.Log2(t.width)) + 1, o = t.getEngine(), a = !1, s = !1, p = null, m = null, S = null, O = o.getCaps();
+ if (t.format = d.a.TEXTUREFORMAT_RGBA, t.type = d.a.TEXTURETYPE_UNSIGNED_INT, t.generateMipMaps = !0, t._cachedAnisotropicFilteringLevel = null, o.updateTextureSamplingMode(d.a.TEXTURE_TRILINEAR_SAMPLINGMODE, t), O.textureLOD ? o.webGLVersion < 2 ? a = !1 : O.textureHalfFloatRender && O.textureHalfFloatLinearFiltering ? (a = !0, t.type = d.a.TEXTURETYPE_HALF_FLOAT) : O.textureFloatRender && O.textureFloatLinearFiltering && (a = !0, t.type = d.a.TEXTURETYPE_FLOAT) : (a = !1, s = !0, S = {}), a)
+ p = new _t("rgbdDecode", "rgbdDecode", null, null, 1, null, d.a.TEXTURE_TRILINEAR_SAMPLINGMODE, o, !1, void 0, t.type, void 0, null, !1), t._isRGBD = !1, t.invertY = !1, m = o.createRenderTargetCubeTexture(t.width, { generateDepthBuffer: !1, generateMipMaps: !0, generateStencilBuffer: !1, samplingMode: d.a.TEXTURE_TRILINEAR_SAMPLINGMODE, type: t.type, format: d.a.TEXTUREFORMAT_RGBA });
+ else if (t._isRGBD = !0, t.invertY = !0, s)
+ for (var I = t._lodGenerationScale, G = t._lodGenerationOffset, k = 0; k < 3; k++) {
+ var K = (i - 1) * I + G, re = G + (K - G) * (1 - k / 2), se = Math.round(Math.min(Math.max(re, 0), K)), ue = new Rt.a(o, Rt.b.Temp);
+ ue.isCube = !0, ue.invertY = !0, ue.generateMipMaps = !1, o.updateTextureSamplingMode(d.a.TEXTURE_LINEAR_LINEAR, ue);
+ var he = new oi.a(null);
+ switch (he.isCube = !0, he._texture = ue, S[se] = he, k) {
+ case 0:
+ t._lodTextureLow = he;
+ break;
+ case 1:
+ t._lodTextureMid = he;
+ break;
+ case 2:
+ t._lodTextureHigh = he;
+ }
+ }
+ var pe = [], ve = function(Pe) {
+ for (var Ce = function(Oe) {
+ var Be = e[Pe][Oe], Le = new Blob([Be], { type: "image/png" }), Ve = URL.createObjectURL(Le), Qe = void 0;
+ if (typeof Image > "u")
+ Qe = createImageBitmap(Le).then(function(rt) {
+ return n._OnImageReadyAsync(rt, o, a, p, Ve, Oe, Pe, s, S, m, t);
+ });
+ else {
+ var nt = new Image();
+ nt.src = Ve, Qe = new Promise(function(rt, ut) {
+ nt.onload = function() {
+ n._OnImageReadyAsync(nt, o, a, p, Ve, Oe, Pe, s, S, m, t).then(function() {
+ return rt();
+ }).catch(function(qe) {
+ ut(qe);
+ });
+ }, nt.onerror = function(qe) {
+ ut(qe);
+ };
+ });
+ }
+ pe.push(Qe);
+ }, Fe = 0; Fe < 6; Fe++)
+ Ce(Fe);
+ };
+ for (k = 0; k < e.length; k++)
+ ve(k);
+ if (e.length < i) {
+ var Ee = void 0, Ae = Math.pow(2, i - 1 - e.length), Ie = Ae * Ae * 4;
+ switch (t.type) {
+ case d.a.TEXTURETYPE_UNSIGNED_INT:
+ Ee = new Uint8Array(Ie);
+ break;
+ case d.a.TEXTURETYPE_HALF_FLOAT:
+ Ee = new Uint16Array(Ie);
+ break;
+ case d.a.TEXTURETYPE_FLOAT:
+ Ee = new Float32Array(Ie);
+ }
+ for (k = e.length; k < i; k++)
+ for (var xe = 0; xe < 6; xe++)
+ o._uploadArrayBufferViewToTexture(t, Ee, xe, k);
+ }
+ return Promise.all(pe).then(function() {
+ m && (o._releaseFramebufferObjects(m), o._releaseTexture(t), m._swapAndDie(t)), p && p.dispose(), s && (t._lodTextureHigh && t._lodTextureHigh._texture && (t._lodTextureHigh._texture.isReady = !0), t._lodTextureMid && t._lodTextureMid._texture && (t._lodTextureMid._texture.isReady = !0), t._lodTextureLow && t._lodTextureLow._texture && (t._lodTextureLow._texture.isReady = !0));
+ });
+ }, r.UploadEnvSpherical = function(t, e) {
+ e.version !== 1 && h.a.Warn('Unsupported babylon environment map version "' + e.version + '"');
+ var n = e.irradiance;
+ if (n) {
+ var i = new ya();
+ c.e.FromArrayToRef(n.x, 0, i.x), c.e.FromArrayToRef(n.y, 0, i.y), c.e.FromArrayToRef(n.z, 0, i.z), c.e.FromArrayToRef(n.xx, 0, i.xx), c.e.FromArrayToRef(n.yy, 0, i.yy), c.e.FromArrayToRef(n.zz, 0, i.zz), c.e.FromArrayToRef(n.yz, 0, i.yz), c.e.FromArrayToRef(n.zx, 0, i.zx), c.e.FromArrayToRef(n.xy, 0, i.xy), t._sphericalPolynomial = i;
+ }
+ }, r._UpdateRGBDAsync = function(t, e, n, i, o) {
+ return t._source = Rt.b.CubeRawRGBD, t._bufferViewArrayArray = e, t._lodGenerationScale = i, t._lodGenerationOffset = o, t._sphericalPolynomial = n, r.UploadLevelsAsync(t, e).then(function() {
+ t.isReady = !0;
+ });
+ }, r._MagicBytes = [134, 22, 135, 150, 246, 214, 150, 54], r;
+ }();
+ Rt.a._UpdateRGBDAsync = nr._UpdateRGBDAsync;
+ var ir, Pl = function() {
+ function r(t, e) {
+ e === void 0 && (e = 20), this.debug = !1, this._sourceCode = t, this._numMaxIterations = e, this._functionDescr = [], this.inlineToken = "#define inline";
+ }
+ return Object.defineProperty(r.prototype, "code", { get: function() {
+ return this._sourceCode;
+ }, enumerable: !1, configurable: !0 }), r.prototype.processCode = function() {
+ this.debug && console.log("Start inlining process (code size=" + this._sourceCode.length + ")..."), this._collectFunctions(), this._processInlining(this._numMaxIterations), this.debug && console.log("End of inlining process.");
+ }, r.prototype._collectFunctions = function() {
+ for (var t = 0; t < this._sourceCode.length; ) {
+ var e = this._sourceCode.indexOf(this.inlineToken, t);
+ if (e < 0)
+ break;
+ var n = this._sourceCode.indexOf("(", e + this.inlineToken.length);
+ if (n < 0)
+ this.debug && console.warn("Could not find the opening parenthesis after the token. startIndex=" + t), t = e + this.inlineToken.length;
+ else {
+ var i = r._RegexpFindFunctionNameAndType.exec(this._sourceCode.substring(e + this.inlineToken.length, n));
+ if (i) {
+ var o = [i[3], i[4]], a = o[0], s = o[1], p = this._extractBetweenMarkers("(", ")", this._sourceCode, n);
+ if (p < 0)
+ this.debug && console.warn("Could not extract the parameters the function '" + s + "' (type=" + a + "). funcParamsStartIndex=" + n), t = e + this.inlineToken.length;
+ else {
+ var m = this._sourceCode.substring(n + 1, p), S = this._skipWhitespaces(this._sourceCode, p + 1);
+ if (S !== this._sourceCode.length) {
+ var O = this._extractBetweenMarkers("{", "}", this._sourceCode, S);
+ if (O < 0)
+ this.debug && console.warn("Could not extract the body of the function '" + s + "' (type=" + a + "). funcBodyStartIndex=" + S), t = e + this.inlineToken.length;
+ else {
+ for (var I = this._sourceCode.substring(S, O + 1), G = this._removeComments(m).split(","), k = [], K = 0; K < G.length; ++K) {
+ var re = G[K].trim(), se = re.lastIndexOf(" ");
+ se >= 0 && k.push(re.substring(se + 1));
+ }
+ a !== "void" && k.push("return"), this._functionDescr.push({ name: s, type: a, parameters: k, body: I, callIndex: 0 }), t = O + 1;
+ var ue = e > 0 ? this._sourceCode.substring(0, e) : "", he = O + 1 < this._sourceCode.length - 1 ? this._sourceCode.substring(O + 1) : "";
+ this._sourceCode = ue + he, t -= O + 1 - e;
+ }
+ } else
+ this.debug && console.warn("Could not extract the body of the function '" + s + "' (type=" + a + "). funcParamsEndIndex=" + p), t = e + this.inlineToken.length;
+ }
+ } else
+ this.debug && console.warn("Could not extract the name/type of the function from: " + this._sourceCode.substring(e + this.inlineToken.length, n)), t = e + this.inlineToken.length;
+ }
+ }
+ this.debug && console.log("Collect functions: " + this._functionDescr.length + " functions found. functionDescr=", this._functionDescr);
+ }, r.prototype._processInlining = function(t) {
+ for (t === void 0 && (t = 20); t-- >= 0 && this._replaceFunctionCallsByCode(); )
+ ;
+ return this.debug && console.log("numMaxIterations is " + t + " after inlining process"), t >= 0;
+ }, r.prototype._extractBetweenMarkers = function(t, e, n, i) {
+ for (var o = i, a = 0, s = ""; o < n.length; ) {
+ var p = n.charAt(o);
+ if (s)
+ p === s ? s === '"' || s === "'" ? n.charAt(o - 1) !== "\\" && (s = "") : s = "" : s === "*/" && p === "*" && o + 1 < n.length && (n.charAt(o + 1) === "/" && (s = ""), s === "" && o++);
+ else
+ switch (p) {
+ case t:
+ a++;
+ break;
+ case e:
+ a--;
+ break;
+ case '"':
+ case "'":
+ case "`":
+ s = p;
+ break;
+ case "/":
+ if (o + 1 < n.length) {
+ var m = n.charAt(o + 1);
+ m === "/" ? s = `
+` : m === "*" && (s = "*/");
+ }
+ }
+ if (o++, a === 0)
+ break;
+ }
+ return a === 0 ? o - 1 : -1;
+ }, r.prototype._skipWhitespaces = function(t, e) {
+ for (; e < t.length; ) {
+ var n = t[e];
+ if (n !== " " && n !== `
+` && n !== "\r" && n !== " " && n !== `
+` && n !== " ")
+ break;
+ e++;
+ }
+ return e;
+ }, r.prototype._removeComments = function(t) {
+ for (var e = 0, n = "", i = !1, o = []; e < t.length; ) {
+ var a = t.charAt(e);
+ if (n)
+ a === n ? n === '"' || n === "'" ? (t.charAt(e - 1) !== "\\" && (n = ""), o.push(a)) : (n = "", i = !1) : n === "*/" && a === "*" && e + 1 < t.length ? (t.charAt(e + 1) === "/" && (n = ""), n === "" && (i = !1, e++)) : i || o.push(a);
+ else {
+ switch (a) {
+ case '"':
+ case "'":
+ case "`":
+ n = a;
+ break;
+ case "/":
+ if (e + 1 < t.length) {
+ var s = t.charAt(e + 1);
+ s === "/" ? (n = `
+`, i = !0) : s === "*" && (n = "*/", i = !0);
+ }
+ }
+ i || o.push(a);
+ }
+ e++;
+ }
+ return o.join("");
+ }, r.prototype._replaceFunctionCallsByCode = function() {
+ for (var t = !1, e = 0, n = this._functionDescr; e < n.length; e++)
+ for (var i = n[e], o = i.name, a = i.type, s = i.parameters, p = i.body, m = 0; m < this._sourceCode.length; ) {
+ var S = this._sourceCode.indexOf(o, m);
+ if (S < 0)
+ break;
+ var O = this._skipWhitespaces(this._sourceCode, S + o.length);
+ if (O !== this._sourceCode.length && this._sourceCode.charAt(O) === "(") {
+ var I = this._extractBetweenMarkers("(", ")", this._sourceCode, O);
+ if (I < 0)
+ this.debug && console.warn("Could not extract the parameters of the function call. Function '" + o + "' (type=" + a + "). callParamsStartIndex=" + O), m = S + o.length;
+ else {
+ for (var G = this._sourceCode.substring(O + 1, I), k = this._removeComments(G).split(","), K = [], re = 0; re < k.length; ++re) {
+ var se = k[re].trim();
+ K.push(se);
+ }
+ var ue = a !== "void" ? o + "_" + i.callIndex++ : null;
+ if (ue && K.push(ue + " ="), K.length === s.length) {
+ m = I + 1;
+ var he = this._replaceNames(p, s, K), pe = S > 0 ? this._sourceCode.substring(0, S) : "", ve = I + 1 < this._sourceCode.length - 1 ? this._sourceCode.substring(I + 1) : "";
+ if (ue) {
+ var Ee = this._findBackward(this._sourceCode, S - 1, `
+`);
+ pe = this._sourceCode.substring(0, Ee + 1);
+ var Ae = this._sourceCode.substring(Ee + 1, S);
+ this._sourceCode = pe + a + " " + ue + `;
+` + he + `
+` + Ae + ue + ve, this.debug && console.log("Replace function call by code. Function '" + o + "' (type=" + a + "). injectDeclarationIndex=" + Ee);
+ } else
+ this._sourceCode = pe + he + ve, m += he.length - (I + 1 - S), this.debug && console.log("Replace function call by code. Function '" + o + "' (type=" + a + "). functionCallIndex=" + S);
+ t = !0;
+ } else
+ this.debug && console.warn("Invalid function call: not the same number of parameters for the call than the number expected by the function. Function '" + o + "' (type=" + a + "). function parameters=" + s + ", call parameters=" + K), m = S + o.length;
+ }
+ } else
+ m = S + o.length;
+ }
+ return t;
+ }, r.prototype._findBackward = function(t, e, n) {
+ for (; e >= 0 && t.charAt(e) !== n; )
+ e--;
+ return e;
+ }, r.prototype._escapeRegExp = function(t) {
+ return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
+ }, r.prototype._replaceNames = function(t, e, n) {
+ for (var i = 0; i < e.length; ++i) {
+ var o = new RegExp(this._escapeRegExp(e[i]), "g"), a = n[i];
+ t = t.replace(o, a);
+ }
+ return t;
+ }, r._RegexpFindFunctionNameAndType = /((\s+?)(\w+)\s+(\w+)\s*?)$/, r;
+ }(), Sb = function() {
+ function r() {
+ this.isAsync = !1, this.isReady = !1;
+ }
+ return r.prototype._getVertexShaderCode = function() {
+ return null;
+ }, r.prototype._getFragmentShaderCode = function() {
+ return null;
+ }, r.prototype._handlesSpectorRebuildCallback = function(t) {
+ throw new Error("Not implemented");
+ }, r;
+ }(), sf = function(r) {
+ function t() {
+ return r !== null && r.apply(this, arguments) || this;
+ }
+ return Object(u.d)(t, r), t;
+ }(af.a), cf = function(r) {
+ function t() {
+ return r !== null && r.apply(this, arguments) || this;
+ }
+ return Object(u.d)(t, r), t.prototype.getInternalTexture = function() {
+ return this;
+ }, t.prototype.getViewCount = function() {
+ return 1;
+ }, t;
+ }(Rt.a), Ab = function(r) {
+ function t() {
+ var e = r.call(this, null) || this;
+ return e._native = new _native.Engine(), e.INVALID_HANDLE = 65535, e._boundBuffersVertexArray = null, e._currentDepthTest = e._native.DEPTH_TEST_LEQUAL, e._webGLVersion = 2, e.disableUniformBuffers = !0, e._caps = { maxTexturesImageUnits: 16, maxVertexTextureImageUnits: 16, maxCombinedTexturesImageUnits: 32, maxTextureSize: 512, maxCubemapTextureSize: 512, maxRenderTextureSize: 512, maxVertexAttribs: 16, maxVaryingVectors: 16, maxFragmentUniformVectors: 16, maxVertexUniformVectors: 16, standardDerivatives: !0, astc: null, pvrtc: null, etc1: null, etc2: null, bptc: null, maxAnisotropy: 16, uintIndices: !0, fragmentDepthSupported: !1, highPrecisionShaderSupported: !0, colorBufferFloat: !1, textureFloat: !1, textureFloatLinearFiltering: !1, textureFloatRender: !1, textureHalfFloat: !1, textureHalfFloatLinearFiltering: !1, textureHalfFloatRender: !1, textureLOD: !0, drawBuffersExtension: !1, depthTextureExtension: !1, vertexArrayObject: !0, instancedArrays: !1, canUseTimestampForTimerQuery: !1, blendMinMax: !1, maxMSAASamples: 1 }, Ke.b.Log("Babylon Native (v" + ke.a.Version + ") launched"), Ke.b.LoadScript = function(n, i, o, a) {
+ Ke.b.LoadFile(n, function(s) {
+ Function(s).apply(null), i && i();
+ }, void 0, void 0, !1, function(s, p) {
+ o && o("LoadScript Error", p);
+ });
+ }, typeof URL > "u" && (window.URL = { createObjectURL: function() {
+ }, revokeObjectURL: function() {
+ } }), typeof Blob > "u" && (window.Blob = function() {
+ }), e._shaderProcessor = new of.a(), e;
+ }
+ return Object(u.d)(t, r), t.prototype.getHardwareScalingLevel = function() {
+ return 1;
+ }, t.prototype.dispose = function() {
+ r.prototype.dispose.call(this), this._boundBuffersVertexArray && this._native.deleteVertexArray(this._boundBuffersVertexArray), this._native.dispose();
+ }, t.prototype._queueNewFrame = function(e, n) {
+ return n.requestAnimationFrame && n !== window ? n.requestAnimationFrame(e) : this._native.requestAnimationFrame(e), 0;
+ }, t.prototype._bindUnboundFramebuffer = function(e) {
+ this._currentFramebuffer !== e && (this._currentFramebuffer && this._native.unbindFramebuffer(this._currentFramebuffer), e && this._native.bindFramebuffer(e), this._currentFramebuffer = e);
+ }, t.prototype.getHostDocument = function() {
+ return null;
+ }, t.prototype.clear = function(e, n, i, o) {
+ o === void 0 && (o = !1);
+ var a = 0;
+ n && e && (this._native.clearColor(e.r, e.g, e.b, e.a !== void 0 ? e.a : 1), a |= this._native.CLEAR_FLAG_COLOR), i && (this._native.clearDepth(1), a |= this._native.CLEAR_FLAG_DEPTH), o && (this._native.clearStencil(0), a |= this._native.CLEAR_FLAG_STENCIL), this._native.clear(a);
+ }, t.prototype.createIndexBuffer = function(e, n) {
+ var i = this._normalizeIndexData(e), o = new sf();
+ if (o.references = 1, o.is32Bits = i.BYTES_PER_ELEMENT === 4, i.length) {
+ if (o.nativeIndexBuffer = this._native.createIndexBuffer(i, n != null && n), o.nativeVertexBuffer === this.INVALID_HANDLE)
+ throw new Error("Could not create a native index buffer.");
+ } else
+ o.nativeVertexBuffer = this.INVALID_HANDLE;
+ return o;
+ }, t.prototype.createVertexBuffer = function(e, n) {
+ var i = new sf();
+ if (i.references = 1, i.nativeVertexBuffer = this._native.createVertexBuffer(ArrayBuffer.isView(e) ? e : new Float32Array(e), n != null && n), i.nativeVertexBuffer === this.INVALID_HANDLE)
+ throw new Error("Could not create a native vertex buffer.");
+ return i;
+ }, t.prototype._recordVertexArrayObject = function(e, n, i, o) {
+ i && this._native.recordIndexBuffer(e, i.nativeIndexBuffer);
+ for (var a = o.getAttributesNames(), s = 0; s < a.length; s++) {
+ var p = o.getAttributeLocation(s);
+ if (p >= 0) {
+ var m = n[a[s]];
+ if (m) {
+ var S = m.getBuffer();
+ S && this._native.recordVertexBuffer(e, S.nativeVertexBuffer, p, m.byteOffset, m.byteStride, m.getSize(), this._getNativeAttribType(m.type), m.normalized);
+ }
+ }
+ }
+ }, t.prototype.bindBuffers = function(e, n, i) {
+ this._boundBuffersVertexArray && this._native.deleteVertexArray(this._boundBuffersVertexArray), this._boundBuffersVertexArray = this._native.createVertexArray(), this._recordVertexArrayObject(this._boundBuffersVertexArray, e, n, i), this._native.bindVertexArray(this._boundBuffersVertexArray);
+ }, t.prototype.recordVertexArrayObject = function(e, n, i) {
+ var o = this._native.createVertexArray();
+ return this._recordVertexArrayObject(o, e, n, i), o;
+ }, t.prototype.bindVertexArrayObject = function(e) {
+ this._native.bindVertexArray(e);
+ }, t.prototype.releaseVertexArrayObject = function(e) {
+ this._native.deleteVertexArray(e);
+ }, t.prototype.getAttributes = function(e, n) {
+ var i = e;
+ return this._native.getAttributes(i.nativeProgram, n);
+ }, t.prototype.drawElementsType = function(e, n, i, o) {
+ this._drawCalls.addCount(1, !1), this._native.drawIndexed(e, n, i);
+ }, t.prototype.drawArraysType = function(e, n, i, o) {
+ this._drawCalls.addCount(1, !1), this._native.draw(e, n, i);
+ }, t.prototype.createPipelineContext = function() {
+ return new Sb();
+ }, t.prototype._preparePipelineContext = function(e, n, i, o, a, s, p) {
+ var m = e;
+ m.nativeProgram = o ? this.createRawShaderProgram(e, n, i, void 0, p) : this.createShaderProgram(e, n, i, s, void 0, p);
+ }, t.prototype._isRenderingStateCompiled = function(e) {
+ return !0;
+ }, t.prototype._executeWhenRenderingStateIsCompiled = function(e, n) {
+ n();
+ }, t.prototype.createRawShaderProgram = function(e, n, i, o, a) {
+ throw new Error("Not Supported");
+ }, t.prototype.createShaderProgram = function(e, n, i, o, a, s) {
+ this.onBeforeShaderCompilationObservable.notifyObservers(this);
+ var p = new Pl(n);
+ p.processCode(), n = p.code;
+ var m = new Pl(i);
+ m.processCode(), i = m.code, n = Gt.a._ConcatenateShader(n, o), i = Gt.a._ConcatenateShader(i, o);
+ var S = this._native.createProgram(n, i);
+ return this.onAfterShaderCompilationObservable.notifyObservers(this), S;
+ }, t.prototype._setProgram = function(e) {
+ this._currentProgram !== e && (this._native.setProgram(e), this._currentProgram = e);
+ }, t.prototype._releaseEffect = function(e) {
+ }, t.prototype._deletePipelineContext = function(e) {
+ }, t.prototype.getUniforms = function(e, n) {
+ var i = e;
+ return this._native.getUniforms(i.nativeProgram, n);
+ }, t.prototype.bindUniformBlock = function(e, n, i) {
+ throw new Error("Not Implemented");
+ }, t.prototype.bindSamplers = function(e) {
+ var n = e.getPipelineContext();
+ this._setProgram(n.nativeProgram);
+ for (var i = e.getSamplers(), o = 0; o < i.length; o++) {
+ var a = e.getUniform(i[o]);
+ a && (this._boundUniforms[o] = a);
+ }
+ this._currentEffect = null;
+ }, t.prototype.setMatrix = function(e, n) {
+ e && this._native.setMatrix(e, n.toArray());
+ }, t.prototype.getRenderWidth = function(e) {
+ return e === void 0 && (e = !1), !e && this._currentRenderTarget ? this._currentRenderTarget.width : this._native.getRenderWidth();
+ }, t.prototype.getRenderHeight = function(e) {
+ return e === void 0 && (e = !1), !e && this._currentRenderTarget ? this._currentRenderTarget.height : this._native.getRenderHeight();
+ }, t.prototype.setViewport = function(e, n, i) {
+ this._cachedViewport = e, this._native.setViewPort(e.x, e.y, e.width, e.height);
+ }, t.prototype.setState = function(e, n, i, o) {
+ n === void 0 && (n = 0), o === void 0 && (o = !1), this._native.setState(e, n, o);
+ }, t.prototype.setZOffset = function(e) {
+ this._native.setZOffset(e);
+ }, t.prototype.getZOffset = function() {
+ return this._native.getZOffset();
+ }, t.prototype.setDepthBuffer = function(e) {
+ this._native.setDepthTest(e ? this._currentDepthTest : this._native.DEPTH_TEST_ALWAYS);
+ }, t.prototype.getDepthWrite = function() {
+ return this._native.getDepthWrite();
+ }, t.prototype.setDepthFunctionToGreater = function() {
+ this._currentDepthTest = this._native.DEPTH_TEST_GREATER, this._native.setDepthTest(this._currentDepthTest);
+ }, t.prototype.setDepthFunctionToGreaterOrEqual = function() {
+ this._currentDepthTest = this._native.DEPTH_TEST_GEQUAL, this._native.setDepthTest(this._currentDepthTest);
+ }, t.prototype.setDepthFunctionToLess = function() {
+ this._currentDepthTest = this._native.DEPTH_TEST_LESS, this._native.setDepthTest(this._currentDepthTest);
+ }, t.prototype.setDepthFunctionToLessOrEqual = function() {
+ this._currentDepthTest = this._native.DEPTH_TEST_LEQUAL, this._native.setDepthTest(this._currentDepthTest);
+ }, t.prototype.setDepthWrite = function(e) {
+ this._native.setDepthWrite(e);
+ }, t.prototype.setColorWrite = function(e) {
+ this._native.setColorWrite(e), this._colorWrite = e;
+ }, t.prototype.getColorWrite = function() {
+ return this._colorWrite;
+ }, t.prototype.setAlphaConstants = function(e, n, i, o) {
+ throw new Error("Setting alpha blend constant color not yet implemented.");
+ }, t.prototype.setAlphaMode = function(e, n) {
+ n === void 0 && (n = !1), this._alphaMode !== e && (e = this._getNativeAlphaMode(e), this._native.setBlendMode(e), n || this.setDepthWrite(e === d.a.ALPHA_DISABLE), this._alphaMode = e);
+ }, t.prototype.getAlphaMode = function() {
+ return this._alphaMode;
+ }, t.prototype.setInt = function(e, n) {
+ return !!e && (this._native.setInt(e, n), !0);
+ }, t.prototype.setIntArray = function(e, n) {
+ return !!e && (this._native.setIntArray(e, n), !0);
+ }, t.prototype.setIntArray2 = function(e, n) {
+ return !!e && (this._native.setIntArray2(e, n), !0);
+ }, t.prototype.setIntArray3 = function(e, n) {
+ return !!e && (this._native.setIntArray3(e, n), !0);
+ }, t.prototype.setIntArray4 = function(e, n) {
+ return !!e && (this._native.setIntArray4(e, n), !0);
+ }, t.prototype.setFloatArray = function(e, n) {
+ return !!e && (this._native.setFloatArray(e, n), !0);
+ }, t.prototype.setFloatArray2 = function(e, n) {
+ return !!e && (this._native.setFloatArray2(e, n), !0);
+ }, t.prototype.setFloatArray3 = function(e, n) {
+ return !!e && (this._native.setFloatArray3(e, n), !0);
+ }, t.prototype.setFloatArray4 = function(e, n) {
+ return !!e && (this._native.setFloatArray4(e, n), !0);
+ }, t.prototype.setArray = function(e, n) {
+ return !!e && (this._native.setFloatArray(e, n), !0);
+ }, t.prototype.setArray2 = function(e, n) {
+ return !!e && (this._native.setFloatArray2(e, n), !0);
+ }, t.prototype.setArray3 = function(e, n) {
+ return !!e && (this._native.setFloatArray3(e, n), !0);
+ }, t.prototype.setArray4 = function(e, n) {
+ return !!e && (this._native.setFloatArray4(e, n), !0);
+ }, t.prototype.setMatrices = function(e, n) {
+ return !!e && (this._native.setMatrices(e, n), !0);
+ }, t.prototype.setMatrix3x3 = function(e, n) {
+ return !!e && (this._native.setMatrix3x3(e, n), !0);
+ }, t.prototype.setMatrix2x2 = function(e, n) {
+ return !!e && (this._native.setMatrix2x2(e, n), !0);
+ }, t.prototype.setFloat = function(e, n) {
+ return !!e && (this._native.setFloat(e, n), !0);
+ }, t.prototype.setFloat2 = function(e, n, i) {
+ return !!e && (this._native.setFloat2(e, n, i), !0);
+ }, t.prototype.setFloat3 = function(e, n, i, o) {
+ return !!e && (this._native.setFloat3(e, n, i, o), !0);
+ }, t.prototype.setFloat4 = function(e, n, i, o, a) {
+ return !!e && (this._native.setFloat4(e, n, i, o, a), !0);
+ }, t.prototype.setColor3 = function(e, n) {
+ return !!e && (this._native.setFloat3(e, n.r, n.g, n.b), !0);
+ }, t.prototype.setColor4 = function(e, n, i) {
+ return !!e && (this._native.setFloat4(e, n.r, n.g, n.b, i), !0);
+ }, t.prototype.wipeCaches = function(e) {
+ this.preventCacheWipeBetweenFrames || (this.resetTextureCache(), this._currentEffect = null, e && (this._currentProgram = null, this._stencilState.reset(), this._depthCullingState.reset(), this._alphaState.reset()), this._cachedVertexBuffers = null, this._cachedIndexBuffer = null, this._cachedEffectForVertexBuffers = null);
+ }, t.prototype._createTexture = function() {
+ return this._native.createTexture();
+ }, t.prototype._deleteTexture = function(e) {
+ this._native.deleteTexture(e);
+ }, t.prototype.updateDynamicTexture = function(e, n, i, o, a) {
+ this.createTexture("data:my_image_name", !0, i, null, Ue.a.BILINEAR_SAMPLINGMODE, void 0, void 0, "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAYSURBVChTY/z//z8DPsAEpXGC4aCAgQEAGGMDDWwwgqsAAAAASUVORK5CYII=", e, t.TEXTUREFORMAT_RGBA, null, void 0);
+ }, t.prototype.createTexture = function(e, n, i, o, a, s, p, m, S, O, I, G, k) {
+ var K = this;
+ a === void 0 && (a = d.a.TEXTURE_TRILINEAR_SAMPLINGMODE), s === void 0 && (s = null), p === void 0 && (p = null), m === void 0 && (m = null), S === void 0 && (S = null), O === void 0 && (O = null), I === void 0 && (I = null);
+ var re = (e = e || "").substr(0, 5) === "data:", se = re && e.indexOf(";base64,") !== -1, ue = S || new Rt.a(this, Rt.b.Url), he = e;
+ !this._transformTextureUrl || se || S || m || (e = this._transformTextureUrl(e));
+ for (var pe = e.lastIndexOf("."), ve = I || (pe > -1 ? e.substring(pe).toLowerCase() : ""), Ee = null, Ae = 0, Ie = ke.a._TextureLoaders; Ae < Ie.length; Ae++) {
+ var xe = Ie[Ae];
+ if (xe.canLoad(ve)) {
+ Ee = xe;
+ break;
+ }
+ }
+ o && o._addPendingData(ue), ue.url = e, ue.generateMipMaps = !n, ue.samplingMode = a, ue.invertY = i, this.doNotHandleContextLost || (ue._buffer = m);
+ var Pe = null;
+ if (s && !S && (Pe = ue.onLoadedObservable.add(s)), S || this._internalTexturesCache.push(ue), Ee)
+ throw new Error("Loading textures from IInternalTextureLoader not yet implemented.");
+ var Ce = function(Fe) {
+ var Oe = ue._webGLTexture;
+ Oe ? K._native.loadTexture(Oe, Fe, !n, i, function() {
+ ue.baseWidth = K._native.getTextureWidth(Oe), ue.baseHeight = K._native.getTextureHeight(Oe), ue.width = ue.baseWidth, ue.height = ue.baseHeight, ue.isReady = !0;
+ var Be = K._getNativeSamplingMode(a);
+ K._native.setTextureSampling(Oe, Be), o && o._removePendingData(ue), ue.onLoadedObservable.notifyObservers(ue), ue.onLoadedObservable.clear();
+ }, function() {
+ throw new Error("Could not load a native texture.");
+ }) : o && o._removePendingData(ue);
+ };
+ if (re)
+ if (m instanceof ArrayBuffer)
+ Ce(new Uint8Array(m));
+ else if (ArrayBuffer.isView(m))
+ Ce(m);
+ else {
+ if (typeof m != "string")
+ throw new Error("Unsupported buffer type");
+ Ce(new Uint8Array(Ke.b.DecodeBase64(m)));
+ }
+ else
+ se ? Ce(new Uint8Array(Ke.b.DecodeBase64(e))) : this._loadFile(e, function(Fe) {
+ return Ce(new Uint8Array(Fe));
+ }, void 0, void 0, !0, function(Fe, Oe) {
+ (function(Be, Le) {
+ o && o._removePendingData(ue), e === he ? (Pe && ue.onLoadedObservable.remove(Pe), te.a.UseFallbackTexture && K.createTexture(te.a.FallbackTexture, n, ue.invertY, o, a, null, p, m, ue), p && p((Be || "Unknown error") + (te.a.UseFallbackTexture ? " - Fallback texture was used" : ""), Le)) : (h.a.Warn("Failed to load " + e + ", falling back to " + he), K.createTexture(he, n, ue.invertY, o, a, s, p, m, ue, O, I, G, k));
+ })("Unable to load " + (Fe && Fe.responseURL, Oe));
+ });
+ return ue;
+ }, t.prototype._createDepthStencilTexture = function(e, n) {
+ var i = new cf(this, Rt.b.Depth), o = e.width || e, a = e.height || e, s = this._native.createDepthTexture(i._webGLTexture, o, a);
+ return i._framebuffer = s, i;
+ }, t.prototype._releaseFramebufferObjects = function(e) {
+ }, t.prototype.createCubeTexture = function(e, n, i, o, a, s, p, m, S, O, I, G) {
+ var k = this;
+ a === void 0 && (a = null), s === void 0 && (s = null), m === void 0 && (m = null), O === void 0 && (O = 0), I === void 0 && (I = 0), G === void 0 && (G = null);
+ var K = G || new Rt.a(this, Rt.b.Cube);
+ K.isCube = !0, K.url = e, K.generateMipMaps = !o, K._lodGenerationScale = O, K._lodGenerationOffset = I, this._doNotHandleContextLost || (K._extension = m, K._files = i);
+ var re = e.lastIndexOf(".");
+ if ((m || (re > -1 ? e.substring(re).toLowerCase() : "")) === ".env") {
+ if (i && i.length === 6)
+ throw new Error("Multi-file loading not allowed on env files.");
+ this._loadFile(e, function(ue) {
+ return function(he) {
+ var pe = nr.GetEnvInfo(he);
+ if (K.width = pe.width, K.height = pe.width, nr.UploadEnvSpherical(K, pe), pe.version !== 1)
+ throw new Error('Unsupported babylon environment map version "' + pe.version + '"');
+ var ve = pe.specular;
+ if (!ve)
+ throw new Error("Nothing else parsed so far");
+ K._lodGenerationScale = ve.lodGenerationScale;
+ var Ee = nr.CreateImageDataArrayBufferViews(he, pe);
+ K.format = d.a.TEXTUREFORMAT_RGBA, K.type = d.a.TEXTURETYPE_UNSIGNED_INT, K.generateMipMaps = !0, K.getEngine().updateTextureSamplingMode(Ue.a.TRILINEAR_SAMPLINGMODE, K), K._isRGBD = !0, K.invertY = !0, k._native.loadCubeTextureWithMips(K._webGLTexture, Ee, function() {
+ K.isReady = !0, a && a();
+ }, function() {
+ throw new Error("Could not load a native cube texture.");
+ });
+ }(new Uint8Array(ue));
+ }, void 0, void 0, !0, function(ue, he) {
+ s && ue && s(ue.status + " " + ue.statusText, he);
+ });
+ } else {
+ if (!i || i.length !== 6)
+ throw new Error("Cannot load cubemap because 6 files were not defined");
+ var se = [i[0], i[3], i[1], i[4], i[2], i[5]];
+ Promise.all(se.map(function(ue) {
+ return Ke.b.LoadFileAsync(ue).then(function(he) {
+ return new Uint8Array(he);
+ });
+ })).then(function(ue) {
+ return new Promise(function(he, pe) {
+ k._native.loadCubeTexture(K._webGLTexture, ue, !o, he, pe);
+ });
+ }).then(function() {
+ K.isReady = !0, a && a();
+ }, function(ue) {
+ s && s("Failed to load cubemap: " + ue.message, ue);
+ });
+ }
+ return this._internalTexturesCache.push(K), K;
+ }, t.prototype.createRenderTargetTexture = function(e, n) {
+ var i = new Md.a();
+ n !== void 0 && typeof n == "object" ? (i.generateMipMaps = n.generateMipMaps, i.generateDepthBuffer = n.generateDepthBuffer === void 0 || n.generateDepthBuffer, i.generateStencilBuffer = i.generateDepthBuffer && n.generateStencilBuffer, i.type = n.type === void 0 ? d.a.TEXTURETYPE_UNSIGNED_INT : n.type, i.samplingMode = n.samplingMode === void 0 ? d.a.TEXTURE_TRILINEAR_SAMPLINGMODE : n.samplingMode, i.format = n.format === void 0 ? d.a.TEXTUREFORMAT_RGBA : n.format) : (i.generateMipMaps = n, i.generateDepthBuffer = !0, i.generateStencilBuffer = !1, i.type = d.a.TEXTURETYPE_UNSIGNED_INT, i.samplingMode = d.a.TEXTURE_TRILINEAR_SAMPLINGMODE, i.format = d.a.TEXTUREFORMAT_RGBA), (i.type !== d.a.TEXTURETYPE_FLOAT || this._caps.textureFloatLinearFiltering) && (i.type !== d.a.TEXTURETYPE_HALF_FLOAT || this._caps.textureHalfFloatLinearFiltering) || (i.samplingMode = d.a.TEXTURE_NEAREST_SAMPLINGMODE);
+ var o = new cf(this, Rt.b.RenderTarget), a = e.width || e, s = e.height || e;
+ i.type !== d.a.TEXTURETYPE_FLOAT || this._caps.textureFloat || (i.type = d.a.TEXTURETYPE_UNSIGNED_INT, h.a.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type"));
+ var p = this._native.createFramebuffer(o._webGLTexture, a, s, this._getNativeTextureFormat(i.format, i.type), i.samplingMode, !!i.generateStencilBuffer, i.generateDepthBuffer, !!i.generateMipMaps);
+ return o._framebuffer = p, o.baseWidth = a, o.baseHeight = s, o.width = a, o.height = s, o.isReady = !0, o.samples = 1, o.generateMipMaps = !!i.generateMipMaps, o.samplingMode = i.samplingMode, o.type = i.type, o.format = i.format, o._generateDepthBuffer = i.generateDepthBuffer, o._generateStencilBuffer = !!i.generateStencilBuffer, this._internalTexturesCache.push(o), o;
+ }, t.prototype.updateTextureSamplingMode = function(e, n) {
+ if (n._webGLTexture) {
+ var i = this._getNativeSamplingMode(e);
+ this._native.setTextureSampling(n._webGLTexture, i);
+ }
+ n.samplingMode = e;
+ }, t.prototype.bindFramebuffer = function(e, n, i, o, a) {
+ if (n)
+ throw new Error("Cuboid frame buffers are not yet supported in NativeEngine.");
+ if (i || o)
+ throw new Error("Required width/height for frame buffers not yet supported in NativeEngine.");
+ e._depthStencilTexture ? this._bindUnboundFramebuffer(e._depthStencilTexture._framebuffer) : this._bindUnboundFramebuffer(e._framebuffer);
+ }, t.prototype.unBindFramebuffer = function(e, n, i) {
+ n === void 0 && (n = !1), n && h.a.Warn("Disabling mipmap generation not yet supported in NativeEngine. Ignoring."), i && i(), this._bindUnboundFramebuffer(null);
+ }, t.prototype.createDynamicVertexBuffer = function(e) {
+ return this.createVertexBuffer(e, !0);
+ }, t.prototype.updateDynamicIndexBuffer = function(e, n, i) {
+ i === void 0 && (i = 0);
+ var o = e, a = this._normalizeIndexData(n);
+ o.is32Bits = a.BYTES_PER_ELEMENT === 4, this._native.updateDynamicIndexBuffer(o.nativeIndexBuffer, a, i);
+ }, t.prototype.updateDynamicVertexBuffer = function(e, n, i, o) {
+ var a = e, s = ArrayBuffer.isView(n) ? n : new Float32Array(n);
+ this._native.updateDynamicVertexBuffer(a.nativeVertexBuffer, s, i ?? 0, o ?? s.byteLength);
+ }, t.prototype._setTexture = function(e, n, i, o) {
+ o === void 0 && (o = !1);
+ var a, s = this._boundUniforms[e];
+ if (!s)
+ return !1;
+ if (!n)
+ return this._boundTexturesCache[e] != null && (this._activeChannel = e, this._native.setTexture(s, null)), !1;
+ if (n.video)
+ this._activeChannel = e, n.update();
+ else if (n.delayLoadState === d.a.DELAYLOADSTATE_NOTLOADED)
+ return n.delayLoad(), !1;
+ return a = o ? n.depthStencilTexture : n.isReady() ? n.getInternalTexture() : n.isCube ? this.emptyCubeTexture : n.is3D ? this.emptyTexture3D : n.is2DArray ? this.emptyTexture2DArray : this.emptyTexture, this._activeChannel = e, !(!a || !a._webGLTexture) && (this._native.setTextureWrapMode(a._webGLTexture, this._getAddressMode(n.wrapU), this._getAddressMode(n.wrapV), this._getAddressMode(n.wrapR)), this._updateAnisotropicLevel(n), this._native.setTexture(s, a._webGLTexture), !0);
+ }, t.prototype._updateAnisotropicLevel = function(e) {
+ var n = e.getInternalTexture(), i = e.anisotropicFilteringLevel;
+ n && n._webGLTexture && n._cachedAnisotropicFilteringLevel !== i && (this._native.setTextureAnisotropicLevel(n._webGLTexture, i), n._cachedAnisotropicFilteringLevel = i);
+ }, t.prototype._getAddressMode = function(e) {
+ switch (e) {
+ case d.a.TEXTURE_WRAP_ADDRESSMODE:
+ return this._native.ADDRESS_MODE_WRAP;
+ case d.a.TEXTURE_CLAMP_ADDRESSMODE:
+ return this._native.ADDRESS_MODE_CLAMP;
+ case d.a.TEXTURE_MIRROR_ADDRESSMODE:
+ return this._native.ADDRESS_MODE_MIRROR;
+ default:
+ throw new Error("Unexpected wrap mode: " + e + ".");
+ }
+ }, t.prototype._bindTexture = function(e, n) {
+ var i = this._boundUniforms[e];
+ i && this._native.setTexture(i, n._webGLTexture);
+ }, t.prototype._deleteBuffer = function(e) {
+ e.nativeIndexBuffer && (this._native.deleteIndexBuffer(e.nativeIndexBuffer), delete e.nativeIndexBuffer), e.nativeVertexBuffer && (this._native.deleteVertexBuffer(e.nativeVertexBuffer), delete e.nativeVertexBuffer);
+ }, t.prototype.releaseEffects = function() {
+ }, t.prototype._uploadCompressedDataToTextureDirectly = function(e, n, i, o, a, s, p) {
+ throw new Error("_uploadCompressedDataToTextureDirectly not implemented.");
+ }, t.prototype._uploadDataToTextureDirectly = function(e, n, i, o) {
+ throw new Error("_uploadDataToTextureDirectly not implemented.");
+ }, t.prototype._uploadArrayBufferViewToTexture = function(e, n, i, o) {
+ throw new Error("_uploadArrayBufferViewToTexture not implemented.");
+ }, t.prototype._uploadImageToTexture = function(e, n, i, o) {
+ throw new Error("_uploadArrayBufferViewToTexture not implemented.");
+ }, t.prototype._getNativeSamplingMode = function(e) {
+ switch (e) {
+ case d.a.TEXTURE_NEAREST_NEAREST:
+ return this._native.TEXTURE_NEAREST_NEAREST;
+ case d.a.TEXTURE_LINEAR_LINEAR:
+ return this._native.TEXTURE_LINEAR_LINEAR;
+ case d.a.TEXTURE_LINEAR_LINEAR_MIPLINEAR:
+ return this._native.TEXTURE_LINEAR_LINEAR_MIPLINEAR;
+ case d.a.TEXTURE_NEAREST_NEAREST_MIPNEAREST:
+ return this._native.TEXTURE_NEAREST_NEAREST_MIPNEAREST;
+ case d.a.TEXTURE_NEAREST_LINEAR_MIPNEAREST:
+ return this._native.TEXTURE_NEAREST_LINEAR_MIPNEAREST;
+ case d.a.TEXTURE_NEAREST_LINEAR_MIPLINEAR:
+ return this._native.TEXTURE_NEAREST_LINEAR_MIPLINEAR;
+ case d.a.TEXTURE_NEAREST_LINEAR:
+ return this._native.TEXTURE_NEAREST_LINEAR;
+ case d.a.TEXTURE_NEAREST_NEAREST_MIPLINEAR:
+ return this._native.TEXTURE_NEAREST_NEAREST_MIPLINEAR;
+ case d.a.TEXTURE_LINEAR_NEAREST_MIPNEAREST:
+ return this._native.TEXTURE_LINEAR_NEAREST_MIPNEAREST;
+ case d.a.TEXTURE_LINEAR_NEAREST_MIPLINEAR:
+ return this._native.TEXTURE_LINEAR_NEAREST_MIPLINEAR;
+ case d.a.TEXTURE_LINEAR_LINEAR_MIPNEAREST:
+ return this._native.TEXTURE_LINEAR_LINEAR_MIPNEAREST;
+ case d.a.TEXTURE_LINEAR_NEAREST:
+ return this._native.TEXTURE_LINEAR_NEAREST;
+ default:
+ throw new Error("Unsupported sampling mode: " + e + ".");
+ }
+ }, t.prototype._getNativeTextureFormat = function(e, n) {
+ if (e == d.a.TEXTUREFORMAT_RGBA && n == d.a.TEXTURETYPE_UNSIGNED_INT)
+ return this._native.TEXTURE_FORMAT_RGBA8;
+ if (e == d.a.TEXTUREFORMAT_RGBA && n == d.a.TEXTURETYPE_FLOAT)
+ return this._native.TEXTURE_FORMAT_RGBA32F;
+ throw new Error("Unsupported texture format or type: format " + e + ", type " + n + ".");
+ }, t.prototype._getNativeAlphaMode = function(e) {
+ switch (e) {
+ case d.a.ALPHA_DISABLE:
+ return this._native.ALPHA_DISABLE;
+ case d.a.ALPHA_ADD:
+ return this._native.ALPHA_ADD;
+ case d.a.ALPHA_COMBINE:
+ return this._native.ALPHA_COMBINE;
+ case d.a.ALPHA_SUBTRACT:
+ return this._native.ALPHA_SUBTRACT;
+ case d.a.ALPHA_MULTIPLY:
+ return this._native.ALPHA_MULTIPLY;
+ case d.a.ALPHA_MAXIMIZED:
+ return this._native.ALPHA_MAXIMIZED;
+ case d.a.ALPHA_ONEONE:
+ return this._native.ALPHA_ONEONE;
+ case d.a.ALPHA_PREMULTIPLIED:
+ return this._native.ALPHA_PREMULTIPLIED;
+ case d.a.ALPHA_PREMULTIPLIED_PORTERDUFF:
+ return this._native.ALPHA_PREMULTIPLIED_PORTERDUFF;
+ case d.a.ALPHA_INTERPOLATE:
+ return this._native.ALPHA_INTERPOLATE;
+ case d.a.ALPHA_SCREENMODE:
+ return this._native.ALPHA_SCREENMODE;
+ default:
+ throw new Error("Unsupported alpha mode: " + e + ".");
+ }
+ }, t.prototype._getNativeAttribType = function(e) {
+ switch (e) {
+ case De.b.UNSIGNED_BYTE:
+ return this._native.ATTRIB_TYPE_UINT8;
+ case De.b.SHORT:
+ return this._native.ATTRIB_TYPE_INT16;
+ case De.b.FLOAT:
+ return this._native.ATTRIB_TYPE_FLOAT;
+ default:
+ throw new Error("Unsupported attribute type: " + e + ".");
+ }
+ }, t;
+ }(ke.a), Pb = l(74), Ss = function() {
+ function r() {
+ }
+ return r.COPY = 1, r.CUT = 2, r.PASTE = 3, r;
+ }(), Cb = function() {
+ function r(t, e) {
+ this.type = t, this.event = e;
+ }
+ return r.GetTypeFromCharacter = function(t) {
+ switch (t) {
+ case 67:
+ return Ss.COPY;
+ case 86:
+ return Ss.PASTE;
+ case 88:
+ return Ss.CUT;
+ default:
+ return -1;
+ }
+ }, r;
+ }(), Cl = l(83), rr = l(69);
+ (function(r) {
+ r[r.Clean = 0] = "Clean", r[r.Stop = 1] = "Stop", r[r.Sync = 2] = "Sync", r[r.NoSync = 3] = "NoSync";
+ })(ir || (ir = {}));
+ var zt = function() {
+ function r() {
+ }
+ return Object.defineProperty(r, "ForceFullSceneLoadingForIncremental", { get: function() {
+ return rr.a.ForceFullSceneLoadingForIncremental;
+ }, set: function(t) {
+ rr.a.ForceFullSceneLoadingForIncremental = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r, "ShowLoadingScreen", { get: function() {
+ return rr.a.ShowLoadingScreen;
+ }, set: function(t) {
+ rr.a.ShowLoadingScreen = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r, "loggingLevel", { get: function() {
+ return rr.a.loggingLevel;
+ }, set: function(t) {
+ rr.a.loggingLevel = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r, "CleanBoneMatrixWeights", { get: function() {
+ return rr.a.CleanBoneMatrixWeights;
+ }, set: function(t) {
+ rr.a.CleanBoneMatrixWeights = t;
+ }, enumerable: !1, configurable: !0 }), r.GetDefaultPlugin = function() {
+ return r._registeredPlugins[".babylon"];
+ }, r._GetPluginForExtension = function(t) {
+ var e = r._registeredPlugins[t];
+ return e || (h.a.Warn("Unable to find a plugin to load " + t + " files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: https://doc.babylonjs.com/how_to/load_from_any_file_type"), r.GetDefaultPlugin());
+ }, r._GetPluginForDirectLoad = function(t) {
+ for (var e in r._registeredPlugins) {
+ var n = r._registeredPlugins[e].plugin;
+ if (n.canDirectLoad && n.canDirectLoad(t))
+ return r._registeredPlugins[e];
+ }
+ return r.GetDefaultPlugin();
+ }, r._GetPluginForFilename = function(t) {
+ var e = t.indexOf("?");
+ e !== -1 && (t = t.substring(0, e));
+ var n = t.lastIndexOf("."), i = t.substring(n, t.length).toLowerCase();
+ return r._GetPluginForExtension(i);
+ }, r._GetDirectLoad = function(t) {
+ return t.substr(0, 5) === "data:" ? t.substr(5) : null;
+ }, r._LoadData = function(t, e, n, i, o, a, s) {
+ var p, m = r._GetDirectLoad(t.name), S = s ? r._GetPluginForExtension(s) : m ? r._GetPluginForDirectLoad(t.name) : r._GetPluginForFilename(t.name);
+ if (!(p = S.plugin.createPlugin !== void 0 ? S.plugin.createPlugin() : S.plugin))
+ throw "The loader plugin corresponding to the file type you are trying to load has not been found. If using es6, please import the plugin you wish to use before.";
+ if (r.OnPluginActivatedObservable.notifyObservers(p), m) {
+ if (p.directLoad) {
+ var O = p.directLoad(e, m);
+ O.then ? O.then(function(xe) {
+ n(p, xe);
+ }).catch(function(xe) {
+ o("Error in directLoad of _loadData: " + xe, xe);
+ }) : n(p, O);
+ } else
+ n(p, m);
+ return p;
+ }
+ var I = S.isBinary, G = function(xe, Pe) {
+ e.isDisposed ? o("Scene has been disposed") : n(p, xe, Pe);
+ }, k = null, K = !1, re = p.onDisposeObservable;
+ re && re.add(function() {
+ K = !0, k && (k.abort(), k = null), a();
+ });
+ var se = function() {
+ if (!K) {
+ var xe = function(Ce, Fe) {
+ G(Ce, Fe ? Fe.responseURL : void 0);
+ }, Pe = function(Ce) {
+ o(Ce.message, Ce);
+ };
+ k = p.requestFile ? p.requestFile(e, t.url, xe, i, I, Pe) : e._requestFile(t.url, xe, i, !0, I, Pe);
+ }
+ }, ue = t.file || Cl.a.FilesToLoad[t.name.toLowerCase()];
+ if (t.rootUrl.indexOf("file:") === -1 || t.rootUrl.indexOf("file:") !== -1 && !ue) {
+ var he = e.getEngine(), pe = he.enableOfflineSupport;
+ if (pe) {
+ for (var ve = !1, Ee = 0, Ae = e.disableOfflineSupportExceptionRules; Ee < Ae.length; Ee++)
+ if (Ae[Ee].test(t.url)) {
+ ve = !0;
+ break;
+ }
+ pe = !ve;
+ }
+ pe && ke.a.OfflineProviderFactory ? e.offlineProvider = ke.a.OfflineProviderFactory(t.url, se, he.disableManifestCheck) : se();
+ } else if (ue) {
+ var Ie = function(xe) {
+ o(xe.message, xe);
+ };
+ k = p.readFile ? p.readFile(e, ue, G, i, I, Ie) : e._readFile(ue, G, i, I, Ie);
+ } else
+ o("Unable to find file named " + t.name);
+ return p;
+ }, r._GetFileInfo = function(t, e) {
+ var n, i, o = null;
+ if (e)
+ if (e.name) {
+ var a = e;
+ n = t + a.name, i = a.name, o = a;
+ } else {
+ var s = e;
+ if (s.substr(0, 1) === "/")
+ return Ke.b.Error("Wrong sceneFilename parameter"), null;
+ n = t + s, i = s;
+ }
+ else
+ n = t, i = Ke.b.GetFilename(t), t = Ke.b.GetFolderPath(t);
+ return { url: n, rootUrl: t, name: i, file: o };
+ }, r.GetPluginForExtension = function(t) {
+ return r._GetPluginForExtension(t).plugin;
+ }, r.IsPluginForExtensionAvailable = function(t) {
+ return !!r._registeredPlugins[t];
+ }, r.RegisterPlugin = function(t) {
+ if (typeof t.extensions == "string") {
+ var e = t.extensions;
+ r._registeredPlugins[e.toLowerCase()] = { plugin: t, isBinary: !1 };
+ } else {
+ var n = t.extensions;
+ Object.keys(n).forEach(function(i) {
+ r._registeredPlugins[i.toLowerCase()] = { plugin: t, isBinary: n[i].isBinary };
+ });
+ }
+ }, r.ImportMesh = function(t, e, n, i, o, a, s, p) {
+ if (n === void 0 && (n = ""), i === void 0 && (i = te.a.LastCreatedScene), o === void 0 && (o = null), a === void 0 && (a = null), s === void 0 && (s = null), p === void 0 && (p = null), !i)
+ return h.a.Error("No scene available to import mesh to"), null;
+ var m = r._GetFileInfo(e, n);
+ if (!m)
+ return null;
+ var S = {};
+ i._addPendingData(S);
+ var O = function() {
+ i._removePendingData(S);
+ }, I = function(K, re) {
+ var se = "Unable to import meshes from " + m.url + ": " + K;
+ s ? s(i, se, re) : h.a.Error(se), O();
+ }, G = a ? function(K) {
+ try {
+ a(K);
+ } catch (re) {
+ I("Error in onProgress callback: " + re, re);
+ }
+ } : void 0, k = function(K, re, se, ue, he, pe, ve) {
+ if (i.importedMeshesFiles.push(m.url), o)
+ try {
+ o(K, re, se, ue, he, pe, ve);
+ } catch (Ee) {
+ I("Error in onSuccess callback: " + Ee, Ee);
+ }
+ i._removePendingData(S);
+ };
+ return r._LoadData(m, i, function(K, re, se) {
+ if (K.rewriteRootURL && (m.rootUrl = K.rewriteRootURL(m.rootUrl, se)), K.importMesh) {
+ var ue = K, he = new Array(), pe = new Array(), ve = new Array();
+ if (!ue.importMesh(t, i, re, m.rootUrl, he, pe, ve, I))
+ return;
+ i.loadingPluginName = K.name, k(he, pe, ve, [], [], [], []);
+ } else
+ K.importMeshAsync(t, i, re, m.rootUrl, G, m.name).then(function(Ee) {
+ i.loadingPluginName = K.name, k(Ee.meshes, Ee.particleSystems, Ee.skeletons, Ee.animationGroups, Ee.transformNodes, Ee.geometries, Ee.lights);
+ }).catch(function(Ee) {
+ I(Ee.message, Ee);
+ });
+ }, G, I, O, p);
+ }, r.ImportMeshAsync = function(t, e, n, i, o, a) {
+ return n === void 0 && (n = ""), i === void 0 && (i = te.a.LastCreatedScene), o === void 0 && (o = null), a === void 0 && (a = null), new Promise(function(s, p) {
+ r.ImportMesh(t, e, n, i, function(m, S, O, I, G, k, K) {
+ s({ meshes: m, particleSystems: S, skeletons: O, animationGroups: I, transformNodes: G, geometries: k, lights: K });
+ }, o, function(m, S, O) {
+ p(O || new Error(S));
+ }, a);
+ });
+ }, r.Load = function(t, e, n, i, o, a, s) {
+ return e === void 0 && (e = ""), n === void 0 && (n = te.a.LastCreatedEngine), i === void 0 && (i = null), o === void 0 && (o = null), a === void 0 && (a = null), s === void 0 && (s = null), n ? r.Append(t, e, new ge.a(n), i, o, a, s) : (Ke.b.Error("No engine available"), null);
+ }, r.LoadAsync = function(t, e, n, i, o) {
+ return e === void 0 && (e = ""), n === void 0 && (n = te.a.LastCreatedEngine), i === void 0 && (i = null), o === void 0 && (o = null), new Promise(function(a, s) {
+ r.Load(t, e, n, function(p) {
+ a(p);
+ }, i, function(p, m, S) {
+ s(S || new Error(m));
+ }, o);
+ });
+ }, r.Append = function(t, e, n, i, o, a, s) {
+ var p = this;
+ if (e === void 0 && (e = ""), n === void 0 && (n = te.a.LastCreatedScene), i === void 0 && (i = null), o === void 0 && (o = null), a === void 0 && (a = null), s === void 0 && (s = null), !n)
+ return h.a.Error("No scene available to append to"), null;
+ var m = r._GetFileInfo(t, e);
+ if (!m)
+ return null;
+ r.ShowLoadingScreen && !this._showingLoadingScreen && (this._showingLoadingScreen = !0, n.getEngine().displayLoadingUI(), n.executeWhenReady(function() {
+ n.getEngine().hideLoadingUI(), p._showingLoadingScreen = !1;
+ }));
+ var S = {};
+ n._addPendingData(S);
+ var O = function() {
+ n._removePendingData(S);
+ }, I = function(K, re) {
+ var se = "Unable to load from " + m.url + (K ? ": " + K : "");
+ a ? a(n, se, re) : h.a.Error(se), O();
+ }, G = o ? function(K) {
+ try {
+ o(K);
+ } catch (re) {
+ I("Error in onProgress callback", re);
+ }
+ } : void 0, k = function() {
+ if (i)
+ try {
+ i(n);
+ } catch (K) {
+ I("Error in onSuccess callback", K);
+ }
+ n._removePendingData(S);
+ };
+ return r._LoadData(m, n, function(K, re) {
+ if (K.load) {
+ if (!K.load(n, re, m.rootUrl, I))
+ return;
+ n.loadingPluginName = K.name, k();
+ } else
+ K.loadAsync(n, re, m.rootUrl, G, m.name).then(function() {
+ n.loadingPluginName = K.name, k();
+ }).catch(function(se) {
+ I(se.message, se);
+ });
+ }, G, I, O, s);
+ }, r.AppendAsync = function(t, e, n, i, o) {
+ return e === void 0 && (e = ""), n === void 0 && (n = te.a.LastCreatedScene), i === void 0 && (i = null), o === void 0 && (o = null), new Promise(function(a, s) {
+ r.Append(t, e, n, function(p) {
+ a(p);
+ }, i, function(p, m, S) {
+ s(S || new Error(m));
+ }, o);
+ });
+ }, r.LoadAssetContainer = function(t, e, n, i, o, a, s) {
+ if (e === void 0 && (e = ""), n === void 0 && (n = te.a.LastCreatedScene), i === void 0 && (i = null), o === void 0 && (o = null), a === void 0 && (a = null), s === void 0 && (s = null), !n)
+ return h.a.Error("No scene available to load asset container to"), null;
+ var p = r._GetFileInfo(t, e);
+ if (!p)
+ return null;
+ var m = {};
+ n._addPendingData(m);
+ var S = function() {
+ n._removePendingData(m);
+ }, O = function(k, K) {
+ var re = "Unable to load assets from " + p.url + (k ? ": " + k : "");
+ K && K.message && (re += " (" + K.message + ")"), a ? a(n, re, K) : h.a.Error(re), S();
+ }, I = o ? function(k) {
+ try {
+ o(k);
+ } catch (K) {
+ O("Error in onProgress callback", K);
+ }
+ } : void 0, G = function(k) {
+ if (i)
+ try {
+ i(k);
+ } catch (K) {
+ O("Error in onSuccess callback", K);
+ }
+ n._removePendingData(m);
+ };
+ return r._LoadData(p, n, function(k, K) {
+ if (k.loadAssetContainer) {
+ var re = k.loadAssetContainer(n, K, p.rootUrl, O);
+ if (!re)
+ return;
+ n.loadingPluginName = k.name, G(re);
+ } else
+ k.loadAssetContainerAsync ? k.loadAssetContainerAsync(n, K, p.rootUrl, I, p.name).then(function(se) {
+ n.loadingPluginName = k.name, G(se);
+ }).catch(function(se) {
+ O(se.message, se);
+ }) : O("LoadAssetContainer is not supported by this plugin. Plugin did not provide a loadAssetContainer or loadAssetContainerAsync method.");
+ }, I, O, S, s);
+ }, r.LoadAssetContainerAsync = function(t, e, n, i, o) {
+ return e === void 0 && (e = ""), n === void 0 && (n = te.a.LastCreatedScene), i === void 0 && (i = null), o === void 0 && (o = null), new Promise(function(a, s) {
+ r.LoadAssetContainer(t, e, n, function(p) {
+ a(p);
+ }, i, function(p, m, S) {
+ s(S || new Error(m));
+ }, o);
+ });
+ }, r.ImportAnimations = function(t, e, n, i, o, a, s, p, m, S) {
+ if (e === void 0 && (e = ""), n === void 0 && (n = te.a.LastCreatedScene), i === void 0 && (i = !0), o === void 0 && (o = ir.Clean), a === void 0 && (a = null), s === void 0 && (s = null), p === void 0 && (p = null), m === void 0 && (m = null), S === void 0 && (S = null), n) {
+ if (i) {
+ for (var O = 0, I = n.animatables; O < I.length; O++)
+ I[O].reset();
+ n.stopAllAnimations(), n.animationGroups.slice().forEach(function(k) {
+ k.dispose();
+ }), n.getNodes().forEach(function(k) {
+ k.animations && (k.animations = []);
+ });
+ } else
+ switch (o) {
+ case ir.Clean:
+ n.animationGroups.slice().forEach(function(k) {
+ k.dispose();
+ });
+ break;
+ case ir.Stop:
+ n.animationGroups.forEach(function(k) {
+ k.stop();
+ });
+ break;
+ case ir.Sync:
+ n.animationGroups.forEach(function(k) {
+ k.reset(), k.restart();
+ });
+ break;
+ case ir.NoSync:
+ break;
+ default:
+ return void h.a.Error("Unknown animation group loading mode value '" + o + "'");
+ }
+ var G = n.animatables.length;
+ this.LoadAssetContainer(t, e, n, function(k) {
+ k.mergeAnimationsTo(n, n.animatables.slice(G), a), k.dispose(), n.onAnimationFileImportedObservable.notifyObservers(n), s && s(n);
+ }, p, m, S);
+ } else
+ h.a.Error("No scene available to load animations to");
+ }, r.ImportAnimationsAsync = function(t, e, n, i, o, a, s, p, m, S) {
+ return e === void 0 && (e = ""), n === void 0 && (n = te.a.LastCreatedScene), i === void 0 && (i = !0), o === void 0 && (o = ir.Clean), a === void 0 && (a = null), p === void 0 && (p = null), S === void 0 && (S = null), new Promise(function(O, I) {
+ r.ImportAnimations(t, e, n, i, o, a, function(G) {
+ O(G);
+ }, p, function(G, k, K) {
+ I(K || new Error(k));
+ }, S);
+ });
+ }, r.NO_LOGGING = d.a.SCENELOADER_NO_LOGGING, r.MINIMAL_LOGGING = d.a.SCENELOADER_MINIMAL_LOGGING, r.SUMMARY_LOGGING = d.a.SCENELOADER_SUMMARY_LOGGING, r.DETAILED_LOGGING = d.a.SCENELOADER_DETAILED_LOGGING, r.OnPluginActivatedObservable = new P.c(), r._registeredPlugins = {}, r._showingLoadingScreen = !1, r;
+ }(), xl = function(r) {
+ function t(e) {
+ var n = r.call(this, e) || this;
+ return n.controllerType = Si.DAYDREAM, n;
+ }
+ return Object(u.d)(t, r), t.prototype.initControllerMesh = function(e, n) {
+ var i = this;
+ zt.ImportMesh("", t.MODEL_BASE_URL, t.MODEL_FILENAME, e, function(o) {
+ i._defaultModel = o[1], i.attachToMesh(i._defaultModel), n && n(i._defaultModel);
+ });
+ }, t.prototype._handleButtonChange = function(e, n, i) {
+ if (e === 0) {
+ var o = this.onTriggerStateChangedObservable;
+ o && o.notifyObservers(n);
+ } else
+ h.a.Warn("Unrecognized Daydream button index: " + e);
+ }, t.MODEL_BASE_URL = "https://controllers.babylonjs.com/generic/", t.MODEL_FILENAME = "generic.babylon", t.GAMEPAD_ID_PREFIX = "Daydream", t;
+ }(mr);
+ pr._ControllerFactories.push({ canCreate: function(r) {
+ return r.id.indexOf(xl.GAMEPAD_ID_PREFIX) === 0;
+ }, create: function(r) {
+ return new xl(r);
+ } });
+ var Rl = function(r) {
+ function t(e) {
+ var n = r.call(this, e) || this;
+ return n._buttonIndexToObservableNameMap = ["onPadStateChangedObservable", "onTriggerStateChangedObservable"], n.controllerType = Si.GEAR_VR, n._calculatedPosition = new c.e(n.hand == "left" ? -0.15 : 0.15, -0.5, 0.25), n._disableTrackPosition(n._calculatedPosition), n;
+ }
+ return Object(u.d)(t, r), t.prototype.initControllerMesh = function(e, n) {
+ var i = this;
+ zt.ImportMesh("", t.MODEL_BASE_URL, t.MODEL_FILENAME, e, function(o) {
+ var a = new we.a("", e);
+ o[1].parent = a, o[1].position.z = -0.15, i._defaultModel = a, i.attachToMesh(i._defaultModel), n && n(i._defaultModel);
+ });
+ }, t.prototype._handleButtonChange = function(e, n, i) {
+ if (e < this._buttonIndexToObservableNameMap.length) {
+ var o = this[this._buttonIndexToObservableNameMap[e]];
+ o && o.notifyObservers(n);
+ }
+ }, t.MODEL_BASE_URL = "https://controllers.babylonjs.com/generic/", t.MODEL_FILENAME = "generic.babylon", t.GAMEPAD_ID_PREFIX = "Gear VR", t;
+ }(mr);
+ pr._ControllerFactories.push({ canCreate: function(r) {
+ return r.id.indexOf(Rl.GAMEPAD_ID_PREFIX) === 0 || r.id.indexOf("Oculus Go") !== -1 || r.id.indexOf("Vive Focus") !== -1;
+ }, create: function(r) {
+ return new Rl(r);
+ } });
+ var As = function(r) {
+ function t(e) {
+ return r.call(this, e) || this;
+ }
+ return Object(u.d)(t, r), t.prototype.initControllerMesh = function(e, n) {
+ var i = this;
+ zt.ImportMesh("", t.MODEL_BASE_URL, t.MODEL_FILENAME, e, function(o) {
+ i._defaultModel = o[1], i.attachToMesh(i._defaultModel), n && n(i._defaultModel);
+ });
+ }, t.prototype._handleButtonChange = function(e, n, i) {
+ console.log("Button id: " + e + "state: "), console.dir(n);
+ }, t.MODEL_BASE_URL = "https://controllers.babylonjs.com/generic/", t.MODEL_FILENAME = "generic.babylon", t;
+ }(mr);
+ pr._DefaultControllerFactory = function(r) {
+ return new As(r);
+ };
+ var Ol = function(r) {
+ function t(e) {
+ var n = r.call(this, e) || this;
+ return n.onSecondaryTriggerStateChangedObservable = new P.c(), n.onThumbRestChangedObservable = new P.c(), n.controllerType = Si.OCULUS, n;
+ }
+ return Object(u.d)(t, r), t.prototype.initControllerMesh = function(e, n) {
+ var i, o = this;
+ i = this.hand === "left" ? t.MODEL_LEFT_FILENAME : t.MODEL_RIGHT_FILENAME, zt.ImportMesh("", t._IsQuest ? t.QUEST_MODEL_BASE_URL : t.MODEL_BASE_URL, i, e, function(a) {
+ o._defaultModel = t._IsQuest ? a[0] : a[1], o.attachToMesh(o._defaultModel), n && n(o._defaultModel);
+ });
+ }, Object.defineProperty(t.prototype, "onAButtonStateChangedObservable", { get: function() {
+ if (this.hand === "right")
+ return this.onMainButtonStateChangedObservable;
+ throw new Error("No A button on left hand");
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "onBButtonStateChangedObservable", { get: function() {
+ if (this.hand === "right")
+ return this.onSecondaryButtonStateChangedObservable;
+ throw new Error("No B button on left hand");
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "onXButtonStateChangedObservable", { get: function() {
+ if (this.hand === "left")
+ return this.onMainButtonStateChangedObservable;
+ throw new Error("No X button on right hand");
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "onYButtonStateChangedObservable", { get: function() {
+ if (this.hand === "left")
+ return this.onSecondaryButtonStateChangedObservable;
+ throw new Error("No Y button on right hand");
+ }, enumerable: !1, configurable: !0 }), t.prototype._handleButtonChange = function(e, n, i) {
+ var o = n, a = this.hand === "right" ? -1 : 1;
+ switch (e) {
+ case 0:
+ return void this.onPadStateChangedObservable.notifyObservers(o);
+ case 1:
+ return !t._IsQuest && this._defaultModel && (this._defaultModel.getChildren()[3].rotation.x = 0.2 * -o.value, this._defaultModel.getChildren()[3].position.y = 5e-3 * -o.value, this._defaultModel.getChildren()[3].position.z = 5e-3 * -o.value), void this.onTriggerStateChangedObservable.notifyObservers(o);
+ case 2:
+ return !t._IsQuest && this._defaultModel && (this._defaultModel.getChildren()[4].position.x = a * o.value * 35e-4), void this.onSecondaryTriggerStateChangedObservable.notifyObservers(o);
+ case 3:
+ return !t._IsQuest && this._defaultModel && (o.pressed ? this._defaultModel.getChildren()[1].position.y = -1e-3 : this._defaultModel.getChildren()[1].position.y = 0), void this.onMainButtonStateChangedObservable.notifyObservers(o);
+ case 4:
+ return !t._IsQuest && this._defaultModel && (o.pressed ? this._defaultModel.getChildren()[2].position.y = -1e-3 : this._defaultModel.getChildren()[2].position.y = 0), void this.onSecondaryButtonStateChangedObservable.notifyObservers(o);
+ case 5:
+ return void this.onThumbRestChangedObservable.notifyObservers(o);
+ }
+ }, t.MODEL_BASE_URL = "https://controllers.babylonjs.com/oculus/", t.MODEL_LEFT_FILENAME = "left.babylon", t.MODEL_RIGHT_FILENAME = "right.babylon", t.QUEST_MODEL_BASE_URL = "https://controllers.babylonjs.com/oculusQuest/", t._IsQuest = !1, t;
+ }(mr);
+ pr._ControllerFactories.push({ canCreate: function(r) {
+ return ke.a.LastCreatedEngine && ke.a.LastCreatedEngine._vrDisplay && ke.a.LastCreatedEngine._vrDisplay.displayName === "Oculus Quest" && (Ol._IsQuest = !0), r.id.indexOf("Oculus Touch") !== -1;
+ }, create: function(r) {
+ return new Ol(r);
+ } });
+ var lf = function(r) {
+ function t(e) {
+ var n = r.call(this, e) || this;
+ return n.controllerType = Si.VIVE, n._invertLeftStickY = !0, n;
+ }
+ return Object(u.d)(t, r), t.prototype.initControllerMesh = function(e, n) {
+ var i = this;
+ zt.ImportMesh("", t.MODEL_BASE_URL, t.MODEL_FILENAME, e, function(o) {
+ i._defaultModel = o[1], i.attachToMesh(i._defaultModel), n && n(i._defaultModel);
+ });
+ }, Object.defineProperty(t.prototype, "onLeftButtonStateChangedObservable", { get: function() {
+ return this.onMainButtonStateChangedObservable;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "onRightButtonStateChangedObservable", { get: function() {
+ return this.onMainButtonStateChangedObservable;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "onMenuButtonStateChangedObservable", { get: function() {
+ return this.onSecondaryButtonStateChangedObservable;
+ }, enumerable: !1, configurable: !0 }), t.prototype._handleButtonChange = function(e, n, i) {
+ var o = n;
+ switch (e) {
+ case 0:
+ return void this.onPadStateChangedObservable.notifyObservers(o);
+ case 1:
+ return this._defaultModel && (this._defaultModel.getChildren()[6].rotation.x = 0.15 * -o.value), void this.onTriggerStateChangedObservable.notifyObservers(o);
+ case 2:
+ return void this.onMainButtonStateChangedObservable.notifyObservers(o);
+ case 3:
+ return this._defaultModel && (o.pressed ? this._defaultModel.getChildren()[2].position.y = -1e-3 : this._defaultModel.getChildren()[2].position.y = 0), void this.onSecondaryButtonStateChangedObservable.notifyObservers(o);
+ }
+ }, t.MODEL_BASE_URL = "https://controllers.babylonjs.com/vive/", t.MODEL_FILENAME = "wand.babylon", t;
+ }(mr);
+ pr._ControllerFactories.push({ canCreate: function(r) {
+ return r.id.toLowerCase().indexOf("openvr") !== -1;
+ }, create: function(r) {
+ return new lf(r);
+ } });
+ var xb = function() {
+ this.buttonMeshes = {}, this.axisMeshes = {};
+ }, Ps = function(r) {
+ function t(e) {
+ var n = r.call(this, e) || this;
+ return n._mapping = { buttons: ["thumbstick", "trigger", "grip", "menu", "trackpad"], buttonMeshNames: { trigger: "SELECT", menu: "MENU", grip: "GRASP", thumbstick: "THUMBSTICK_PRESS", trackpad: "TOUCHPAD_PRESS" }, buttonObservableNames: { trigger: "onTriggerStateChangedObservable", menu: "onSecondaryButtonStateChangedObservable", grip: "onMainButtonStateChangedObservable", thumbstick: "onPadStateChangedObservable", trackpad: "onTrackpadChangedObservable" }, axisMeshNames: ["THUMBSTICK_X", "THUMBSTICK_Y", "TOUCHPAD_TOUCH_X", "TOUCHPAD_TOUCH_Y"], pointingPoseMeshName: mo.POINTING_POSE }, n.onTrackpadChangedObservable = new P.c(), n.onTrackpadValuesChangedObservable = new P.c(), n.trackpad = { x: 0, y: 0 }, n.controllerType = Si.WINDOWS, n._loadedMeshInfo = null, n;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "onTriggerButtonStateChangedObservable", { get: function() {
+ return this.onTriggerStateChangedObservable;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "onMenuButtonStateChangedObservable", { get: function() {
+ return this.onSecondaryButtonStateChangedObservable;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "onGripButtonStateChangedObservable", { get: function() {
+ return this.onMainButtonStateChangedObservable;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "onThumbstickButtonStateChangedObservable", { get: function() {
+ return this.onPadStateChangedObservable;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "onTouchpadButtonStateChangedObservable", { get: function() {
+ return this.onTrackpadChangedObservable;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "onTouchpadValuesChangedObservable", { get: function() {
+ return this.onTrackpadValuesChangedObservable;
+ }, enumerable: !1, configurable: !0 }), t.prototype._updateTrackpad = function() {
+ !this.browserGamepad.axes || this.browserGamepad.axes[2] == this.trackpad.x && this.browserGamepad.axes[3] == this.trackpad.y || (this.trackpad.x = this.browserGamepad.axes[this._mapping.axisMeshNames.indexOf("TOUCHPAD_TOUCH_X")], this.trackpad.y = this.browserGamepad.axes[this._mapping.axisMeshNames.indexOf("TOUCHPAD_TOUCH_Y")], this.onTrackpadValuesChangedObservable.notifyObservers(this.trackpad));
+ }, t.prototype.update = function() {
+ if (r.prototype.update.call(this), this.browserGamepad.axes && (this._updateTrackpad(), this._loadedMeshInfo))
+ for (var e = 0; e < this._mapping.axisMeshNames.length; e++)
+ this._lerpAxisTransform(e, this.browserGamepad.axes[e]);
+ }, t.prototype._handleButtonChange = function(e, n, i) {
+ var o = this._mapping.buttons[e];
+ if (o) {
+ this._updateTrackpad();
+ var a = this[this._mapping.buttonObservableNames[o]];
+ a && a.notifyObservers(n), this._lerpButtonTransform(o, n.value);
+ }
+ }, t.prototype._lerpButtonTransform = function(e, n) {
+ if (this._loadedMeshInfo) {
+ var i = this._loadedMeshInfo.buttonMeshes[e];
+ i && i.unpressed.rotationQuaternion && i.pressed.rotationQuaternion && i.value.rotationQuaternion && (c.b.SlerpToRef(i.unpressed.rotationQuaternion, i.pressed.rotationQuaternion, n, i.value.rotationQuaternion), c.e.LerpToRef(i.unpressed.position, i.pressed.position, n, i.value.position));
+ }
+ }, t.prototype._lerpAxisTransform = function(e, n) {
+ if (this._loadedMeshInfo) {
+ var i = this._loadedMeshInfo.axisMeshes[e];
+ if (i && i.min.rotationQuaternion && i.max.rotationQuaternion && i.value.rotationQuaternion) {
+ var o = 0.5 * n + 0.5;
+ c.b.SlerpToRef(i.min.rotationQuaternion, i.max.rotationQuaternion, o, i.value.rotationQuaternion), c.e.LerpToRef(i.min.position, i.max.position, o, i.value.position);
+ }
+ }
+ }, t.prototype.initControllerMesh = function(e, n, i) {
+ var o, a, s = this;
+ if (i === void 0 && (i = !1), zt.IsPluginForExtensionAvailable(".glb")) {
+ var p = "default";
+ if (this.id && !i) {
+ var m = this.id.match(t.GAMEPAD_ID_PATTERN);
+ p = m && m[0] || p;
+ }
+ a = this.hand === "left" ? t.MODEL_LEFT_FILENAME : t.MODEL_RIGHT_FILENAME, o = t.MODEL_BASE_URL + p + "/";
+ } else
+ h.a.Warn("You need to reference GLTF loader to load Windows Motion Controllers model. Falling back to generic models"), o = As.MODEL_BASE_URL, a = As.MODEL_FILENAME;
+ zt.ImportMesh("", o, a, e, function(S) {
+ s._loadedMeshInfo = s.processModel(e, S), s._loadedMeshInfo && (s._defaultModel = s._loadedMeshInfo.rootNode, s.attachToMesh(s._defaultModel), n && n(s._defaultModel));
+ }, null, function(S, O) {
+ h.a.Log(O), h.a.Warn("Failed to retrieve controller model from the remote server: " + o + a), i || s.initControllerMesh(S, n, !0);
+ });
+ }, t.prototype.processModel = function(e, n) {
+ for (var i = null, o = new we.a(this.id + " " + this.hand, e), a = null, s = 0; s < n.length; s++) {
+ var p = n[s];
+ if (!p.parent) {
+ p.isPickable = !1, a = p;
+ break;
+ }
+ }
+ return a ? (a.setParent(o), i = this.createMeshInfo(o)) : h.a.Warn("Could not find root node in model file."), i;
+ }, t.prototype.createMeshInfo = function(e) {
+ var n, i = new xb();
+ for (i.rootNode = e, i.buttonMeshes = {}, i.axisMeshes = {}, n = 0; n < this._mapping.buttons.length; n++) {
+ var o = this._mapping.buttonMeshNames[this._mapping.buttons[n]];
+ if (o) {
+ var a = O(e, o);
+ if (a) {
+ var s = { index: n, value: I(a, "VALUE"), pressed: I(a, "PRESSED"), unpressed: I(a, "UNPRESSED") };
+ s.value && s.pressed && s.unpressed ? i.buttonMeshes[this._mapping.buttons[n]] = s : h.a.Warn("Missing button submesh under mesh with name: " + o + "(VALUE: " + !!s.value + ", PRESSED: " + !!s.pressed + ", UNPRESSED:" + !!s.unpressed + ")");
+ } else
+ h.a.Warn("Missing button mesh with name: " + o);
+ } else
+ h.a.Log("Skipping unknown button at index: " + n + " with mapped name: " + this._mapping.buttons[n]);
+ }
+ for (n = 0; n < this._mapping.axisMeshNames.length; n++) {
+ var p = this._mapping.axisMeshNames[n];
+ if (p) {
+ var m = O(e, p);
+ if (m) {
+ var S = { index: n, value: I(m, "VALUE"), min: I(m, "MIN"), max: I(m, "MAX") };
+ S.value && S.min && S.max ? i.axisMeshes[n] = S : h.a.Warn("Missing axis submesh under mesh with name: " + p + "(VALUE: " + !!S.value + ", MIN: " + !!S.min + ", MAX:" + !!S.max + ")");
+ } else
+ h.a.Warn("Missing axis mesh with name: " + p);
+ } else
+ h.a.Log("Skipping unknown axis at index: " + n);
+ }
+ return i.pointingPoseNode = O(e, this._mapping.pointingPoseMeshName), i.pointingPoseNode ? this._pointingPoseNode = i.pointingPoseNode : h.a.Warn("Missing pointing pose mesh with name: " + this._mapping.pointingPoseMeshName), i;
+ function O(G, k) {
+ return G.getChildren(function(K) {
+ return K.name === k;
+ }, !1)[0];
+ }
+ function I(G, k) {
+ return G.getChildren(function(K) {
+ return K.name == k;
+ }, !0)[0];
+ }
+ }, t.prototype.getForwardRay = function(e) {
+ if (e === void 0 && (e = 100), !this._loadedMeshInfo || !this._loadedMeshInfo.pointingPoseNode)
+ return r.prototype.getForwardRay.call(this, e);
+ var n = this._loadedMeshInfo.pointingPoseNode.getWorldMatrix(), i = n.getTranslation(), o = new c.e(0, 0, -1), a = c.e.TransformNormal(o, n), s = c.e.Normalize(a);
+ return new An.a(i, s, e);
+ }, t.prototype.dispose = function() {
+ r.prototype.dispose.call(this), this.onTrackpadChangedObservable.clear(), this.onTrackpadValuesChangedObservable.clear();
+ }, t.MODEL_BASE_URL = "https://controllers.babylonjs.com/microsoft/", t.MODEL_LEFT_FILENAME = "left.glb", t.MODEL_RIGHT_FILENAME = "right.glb", t.GAMEPAD_ID_PREFIX = "Spatial Controller (Spatial Interaction Source) ", t.GAMEPAD_ID_PATTERN = /([0-9a-zA-Z]+-[0-9a-zA-Z]+)$/, t;
+ }(mr), Rb = function(r) {
+ function t(e) {
+ var n = r.call(this, e) || this;
+ return n._mapping = { buttons: ["trigger", "grip", "trackpad", "thumbstick", "menu"], buttonMeshNames: { trigger: "SELECT", menu: "MENU", grip: "GRASP", thumbstick: "THUMBSTICK_PRESS", trackpad: "TOUCHPAD_PRESS" }, buttonObservableNames: { trigger: "onTriggerStateChangedObservable", menu: "onSecondaryButtonStateChangedObservable", grip: "onMainButtonStateChangedObservable", thumbstick: "onThumbstickStateChangedObservable", trackpad: "onTrackpadChangedObservable" }, axisMeshNames: ["TOUCHPAD_TOUCH_X", "TOUCHPAD_TOUCH_Y", "THUMBSTICK_X", "THUMBSTICK_Y"], pointingPoseMeshName: mo.POINTING_POSE }, n.thumbstickValues = { x: 0, y: 0 }, n.onThumbstickStateChangedObservable = new P.c(), n.onThumbstickValuesChangedObservable = new P.c(), n.onTrackpadChangedObservable = n.onPadStateChangedObservable, n.onTrackpadValuesChangedObservable = n.onPadValuesChangedObservable, n;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "onThumbstickButtonStateChangedObservable", { get: function() {
+ return this.onThumbstickStateChangedObservable;
+ }, enumerable: !1, configurable: !0 }), t.prototype._updateTrackpad = function() {
+ !this.browserGamepad.axes || this.browserGamepad.axes[2] == this.thumbstickValues.x && this.browserGamepad.axes[3] == this.thumbstickValues.y || (this.trackpad.x = this.browserGamepad.axes[2], this.trackpad.y = this.browserGamepad.axes[3], this.onThumbstickValuesChangedObservable.notifyObservers(this.trackpad));
+ }, t.prototype.dispose = function() {
+ r.prototype.dispose.call(this), this.onThumbstickStateChangedObservable.clear(), this.onThumbstickValuesChangedObservable.clear();
+ }, t;
+ }(Ps);
+ pr._ControllerFactories.push({ canCreate: function(r) {
+ return r.id.indexOf(Ps.GAMEPAD_ID_PREFIX) === 0;
+ }, create: function(r) {
+ return new Ps(r);
+ } });
+ var Cs = l(75), So = l(63), Kn = l(51), Gn = l(36), Ea = function(r) {
+ function t(e, n, i, o, a) {
+ var s, p, m, S, O, I, G;
+ n === void 0 && (n = C.a.Gray()), i === void 0 && (i = Gn.a.DefaultUtilityLayer), o === void 0 && (o = null), a === void 0 && (a = 1);
+ var k = r.call(this, i) || this;
+ k._pointerObserver = null, k.snapDistance = 0, k.onSnapObservable = new P.c(), k.uniformScaling = !1, k.sensitivity = 1, k._isEnabled = !0, k._parent = null, k._dragging = !1, k._tmpVector = new c.e(), k._tmpMatrix = new c.a(), k._tmpMatrix2 = new c.a(), k._parent = o, k._coloredMaterial = new kt.a("", i.utilityLayerScene), k._coloredMaterial.diffuseColor = n, k._coloredMaterial.specularColor = n.subtract(new C.a(0.1, 0.1, 0.1)), k._hoverMaterial = new kt.a("", i.utilityLayerScene), k._hoverMaterial.diffuseColor = C.a.Yellow(), k._disableMaterial = new kt.a("", i.utilityLayerScene), k._disableMaterial.diffuseColor = C.a.Gray(), k._disableMaterial.alpha = 0.4, k._gizmoMesh = new we.a("axis", i.utilityLayerScene);
+ var K = k._createGizmoMesh(k._gizmoMesh, a), re = K.arrowMesh, se = K.arrowTail, ue = k._createGizmoMesh(k._gizmoMesh, a + 4, !0);
+ k._gizmoMesh.lookAt(k._rootMesh.position.add(e)), k._rootMesh.addChild(k._gizmoMesh), k._gizmoMesh.scaling.scaleInPlace(1 / 3);
+ var he = re.position.clone(), pe = se.position.clone(), ve = se.scaling.clone(), Ee = function(Oe) {
+ var Be = Oe * (3 / k._rootMesh.scaling.length()) * 6;
+ re.position.z += Be / 3.5, se.scaling.y += Be, se.position.z = re.position.z / 2;
+ }, Ae = function() {
+ re.position.set(he.x, he.y, he.z), se.position.set(pe.x, pe.y, pe.z), se.scaling.set(ve.x, ve.y, ve.z), k._dragging = !1;
+ };
+ k.dragBehavior = new Ji.a({ dragAxis: e }), k.dragBehavior.moveAttached = !1, k._rootMesh.addBehavior(k.dragBehavior);
+ var Ie = 0, xe = new c.e(), Pe = { snapDistance: 0 };
+ k.dragBehavior.onDragObservable.add(function(Oe) {
+ if (k.attachedNode) {
+ var Be = k.sensitivity * Oe.dragDistance * (3 * k.scaleRatio / k._rootMesh.scaling.length()), Le = !1, Ve = 0;
+ k.uniformScaling ? (k.attachedNode.getWorldMatrix().decompose(xe), xe.normalize(), xe.y < 0 && xe.scaleInPlace(-1)) : xe.copyFrom(e), k.snapDistance == 0 ? xe.scaleToRef(Be, xe) : (Ie += Be, Math.abs(Ie) > k.snapDistance ? (Ve = Math.floor(Math.abs(Ie) / k.snapDistance), Ie < 0 && (Ve *= -1), Ie %= k.snapDistance, xe.scaleToRef(k.snapDistance * Ve, xe), Le = !0) : xe.scaleInPlace(0)), c.a.ScalingToRef(1 + xe.x, 1 + xe.y, 1 + xe.z, k._tmpMatrix2), k._tmpMatrix2.multiplyToRef(k.attachedNode.getWorldMatrix(), k._tmpMatrix), k._tmpMatrix.decompose(k._tmpVector), Math.abs(k._tmpVector.x) < 1e5 && Math.abs(k._tmpVector.y) < 1e5 && Math.abs(k._tmpVector.z) < 1e5 && k.attachedNode.getWorldMatrix().copyFrom(k._tmpMatrix), Le && (Pe.snapDistance = k.snapDistance * Ve, k.onSnapObservable.notifyObservers(Pe)), k._matrixChanged();
+ }
+ }), k.dragBehavior.onDragStartObservable.add(function() {
+ k._dragging = !0;
+ }), k.dragBehavior.onDragObservable.add(function(Oe) {
+ return Ee(Oe.dragDistance);
+ }), k.dragBehavior.onDragEndObservable.add(Ae), (m = (p = (s = o == null ? void 0 : o.uniformScaleGizmo) === null || s === void 0 ? void 0 : s.dragBehavior) === null || p === void 0 ? void 0 : p.onDragObservable) === null || m === void 0 || m.add(function(Oe) {
+ return Ee(Oe.delta.y);
+ }), (I = (O = (S = o == null ? void 0 : o.uniformScaleGizmo) === null || S === void 0 ? void 0 : S.dragBehavior) === null || O === void 0 ? void 0 : O.onDragEndObservable) === null || I === void 0 || I.add(Ae);
+ var Ce = { gizmoMeshes: [re, se], colliderMeshes: [ue.arrowMesh, ue.arrowTail], material: k._coloredMaterial, hoverMaterial: k._hoverMaterial, disableMaterial: k._disableMaterial, active: !1 };
+ (G = k._parent) === null || G === void 0 || G.addToAxisCache(k._gizmoMesh, Ce), k._pointerObserver = i.utilityLayerScene.onPointerObservable.add(function(Oe) {
+ var Be;
+ if (!k._customMeshSet && (k._isHovered = Ce.colliderMeshes.indexOf((Be = Oe == null ? void 0 : Oe.pickInfo) === null || Be === void 0 ? void 0 : Be.pickedMesh) != -1, !k._parent)) {
+ var Le = k._isHovered || k._dragging ? k._hoverMaterial : k._coloredMaterial;
+ Ce.gizmoMeshes.forEach(function(Ve) {
+ Ve.material = Le, Ve.color && (Ve.color = Le.diffuseColor);
+ });
+ }
+ });
+ var Fe = i._getSharedGizmoLight();
+ return Fe.includedOnlyMeshes = Fe.includedOnlyMeshes.concat(k._rootMesh.getChildMeshes()), k;
+ }
+ return Object(u.d)(t, r), t.prototype._createGizmoMesh = function(e, n, i) {
+ i === void 0 && (i = !1);
+ var o = So.a.CreateBox("yPosMesh", { size: 0.4 * (1 + (n - 1) / 4) }, this.gizmoLayer.utilityLayerScene), a = Vi.a.CreateCylinder("cylinder", { diameterTop: 5e-3 * n, height: 0.275, diameterBottom: 5e-3 * n, tessellation: 96 }, this.gizmoLayer.utilityLayerScene);
+ return o.scaling.scaleInPlace(0.1), o.material = this._coloredMaterial, o.rotation.x = Math.PI / 2, o.position.z += 0.3, a.material = this._coloredMaterial, a.position.z += 0.1375, a.rotation.x = Math.PI / 2, i && (o.visibility = 0, a.visibility = 0), e.addChild(o), e.addChild(a), { arrowMesh: o, arrowTail: a };
+ }, t.prototype._attachedNodeChanged = function(e) {
+ this.dragBehavior && (this.dragBehavior.enabled = !!e);
+ }, Object.defineProperty(t.prototype, "isEnabled", { get: function() {
+ return this._isEnabled;
+ }, set: function(e) {
+ this._isEnabled = e, e ? this._parent && (this.attachedMesh = this._parent.attachedMesh, this.attachedNode = this._parent.attachedNode) : (this.attachedMesh = null, this.attachedNode = null);
+ }, enumerable: !1, configurable: !0 }), t.prototype.dispose = function() {
+ this.onSnapObservable.clear(), this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver), this.dragBehavior.detach(), this._gizmoMesh && this._gizmoMesh.dispose(), [this._coloredMaterial, this._hoverMaterial, this._disableMaterial].forEach(function(e) {
+ e && e.dispose();
+ }), r.prototype.dispose.call(this);
+ }, t.prototype.setCustomMesh = function(e, n) {
+ var i = this;
+ n === void 0 && (n = !1), r.prototype.setCustomMesh.call(this, e), n && (this._rootMesh.getChildMeshes().forEach(function(o) {
+ o.material = i._coloredMaterial, o.color && (o.color = i._coloredMaterial.diffuseColor);
+ }), this._customMeshSet = !1);
+ }, t;
+ }(Kn.a), Qn = l(45), yn = l(40), uf = function(r) {
+ function t(e, n) {
+ e === void 0 && (e = C.a.Gray()), n === void 0 && (n = Gn.a.DefaultKeepDepthUtilityLayer);
+ var i = r.call(this, n) || this;
+ i._boundingDimensions = new c.e(1, 1, 1), i._renderObserver = null, i._pointerObserver = null, i._scaleDragSpeed = 0.2, i._tmpQuaternion = new c.b(), i._tmpVector = new c.e(0, 0, 0), i._tmpRotationMatrix = new c.a(), i.ignoreChildren = !1, i.includeChildPredicate = null, i.rotationSphereSize = 0.1, i.scaleBoxSize = 0.1, i.fixedDragMeshScreenSize = !1, i.fixedDragMeshBoundsSize = !1, i.fixedDragMeshScreenSizeDistanceFactor = 10, i.onDragStartObservable = new P.c(), i.onScaleBoxDragObservable = new P.c(), i.onScaleBoxDragEndObservable = new P.c(), i.onRotationSphereDragObservable = new P.c(), i.onRotationSphereDragEndObservable = new P.c(), i.scalePivot = null, i._existingMeshScale = new c.e(), i._dragMesh = null, i.pointerDragBehavior = new Ji.a(), i.updateScale = !1, i._anchorMesh = new Nt.a("anchor", n.utilityLayerScene), i.coloredMaterial = new kt.a("", n.utilityLayerScene), i.coloredMaterial.disableLighting = !0, i.hoverColoredMaterial = new kt.a("", n.utilityLayerScene), i.hoverColoredMaterial.disableLighting = !0, i._lineBoundingBox = new Nt.a("", n.utilityLayerScene), i._lineBoundingBox.rotationQuaternion = new c.b();
+ var o = [];
+ o.push(yn.a.CreateLines("lines", { points: [new c.e(0, 0, 0), new c.e(i._boundingDimensions.x, 0, 0)] }, n.utilityLayerScene)), o.push(yn.a.CreateLines("lines", { points: [new c.e(0, 0, 0), new c.e(0, i._boundingDimensions.y, 0)] }, n.utilityLayerScene)), o.push(yn.a.CreateLines("lines", { points: [new c.e(0, 0, 0), new c.e(0, 0, i._boundingDimensions.z)] }, n.utilityLayerScene)), o.push(yn.a.CreateLines("lines", { points: [new c.e(i._boundingDimensions.x, 0, 0), new c.e(i._boundingDimensions.x, i._boundingDimensions.y, 0)] }, n.utilityLayerScene)), o.push(yn.a.CreateLines("lines", { points: [new c.e(i._boundingDimensions.x, 0, 0), new c.e(i._boundingDimensions.x, 0, i._boundingDimensions.z)] }, n.utilityLayerScene)), o.push(yn.a.CreateLines("lines", { points: [new c.e(0, i._boundingDimensions.y, 0), new c.e(i._boundingDimensions.x, i._boundingDimensions.y, 0)] }, n.utilityLayerScene)), o.push(yn.a.CreateLines("lines", { points: [new c.e(0, i._boundingDimensions.y, 0), new c.e(0, i._boundingDimensions.y, i._boundingDimensions.z)] }, n.utilityLayerScene)), o.push(yn.a.CreateLines("lines", { points: [new c.e(0, 0, i._boundingDimensions.z), new c.e(i._boundingDimensions.x, 0, i._boundingDimensions.z)] }, n.utilityLayerScene)), o.push(yn.a.CreateLines("lines", { points: [new c.e(0, 0, i._boundingDimensions.z), new c.e(0, i._boundingDimensions.y, i._boundingDimensions.z)] }, n.utilityLayerScene)), o.push(yn.a.CreateLines("lines", { points: [new c.e(i._boundingDimensions.x, i._boundingDimensions.y, i._boundingDimensions.z), new c.e(0, i._boundingDimensions.y, i._boundingDimensions.z)] }, n.utilityLayerScene)), o.push(yn.a.CreateLines("lines", { points: [new c.e(i._boundingDimensions.x, i._boundingDimensions.y, i._boundingDimensions.z), new c.e(i._boundingDimensions.x, 0, i._boundingDimensions.z)] }, n.utilityLayerScene)), o.push(yn.a.CreateLines("lines", { points: [new c.e(i._boundingDimensions.x, i._boundingDimensions.y, i._boundingDimensions.z), new c.e(i._boundingDimensions.x, i._boundingDimensions.y, 0)] }, n.utilityLayerScene)), o.forEach(function(re) {
+ re.color = e, re.position.addInPlace(new c.e(-i._boundingDimensions.x / 2, -i._boundingDimensions.y / 2, -i._boundingDimensions.z / 2)), re.isPickable = !1, i._lineBoundingBox.addChild(re);
+ }), i._rootMesh.addChild(i._lineBoundingBox), i.setColor(e), i._rotateSpheresParent = new Nt.a("", n.utilityLayerScene), i._rotateSpheresParent.rotationQuaternion = new c.b();
+ for (var a = function(re) {
+ var se = Qn.a.CreateSphere("", { diameter: 1 }, n.utilityLayerScene);
+ se.rotationQuaternion = new c.b(), se.material = s.coloredMaterial, (O = new Ji.a({})).moveAttached = !1, O.updateDragPlane = !1, se.addBehavior(O);
+ var ue = new c.e(1, 0, 0), he = 0;
+ O.onDragStartObservable.add(function() {
+ ue.copyFrom(se.forward), he = 0;
+ }), O.onDragObservable.add(function(pe) {
+ if (i.onRotationSphereDragObservable.notifyObservers({}), i.attachedMesh) {
+ var ve = i.attachedMesh.parent;
+ if (ve && ve.scaling && ve.scaling.isNonUniformWithinEpsilon(1e-3))
+ return void h.a.Warn("BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling");
+ ii.a._RemoveAndStorePivotPoint(i.attachedMesh);
+ var Ee = ue, Ae = pe.dragPlaneNormal.scale(c.e.Dot(pe.dragPlaneNormal, Ee)), Ie = Ee.subtract(Ae).normalizeToNew(), xe = c.e.Dot(Ie, pe.delta) < 0 ? Math.abs(pe.delta.length()) : -Math.abs(pe.delta.length());
+ xe = xe / i._boundingDimensions.length() * i._anchorMesh.scaling.length(), i.attachedMesh.rotationQuaternion || (i.attachedMesh.rotationQuaternion = c.b.RotationYawPitchRoll(i.attachedMesh.rotation.y, i.attachedMesh.rotation.x, i.attachedMesh.rotation.z)), i._anchorMesh.rotationQuaternion || (i._anchorMesh.rotationQuaternion = c.b.RotationYawPitchRoll(i._anchorMesh.rotation.y, i._anchorMesh.rotation.x, i._anchorMesh.rotation.z)), he += xe, Math.abs(he) <= 2 * Math.PI && (re >= 8 ? c.b.RotationYawPitchRollToRef(0, 0, xe, i._tmpQuaternion) : re >= 4 ? c.b.RotationYawPitchRollToRef(xe, 0, 0, i._tmpQuaternion) : c.b.RotationYawPitchRollToRef(0, xe, 0, i._tmpQuaternion), i._anchorMesh.addChild(i.attachedMesh), i._anchorMesh.rotationQuaternion.multiplyToRef(i._tmpQuaternion, i._anchorMesh.rotationQuaternion), i._anchorMesh.removeChild(i.attachedMesh), i.attachedMesh.setParent(ve)), i.updateBoundingBox(), ii.a._RestorePivotPoint(i.attachedMesh);
+ }
+ i._updateDummy();
+ }), O.onDragStartObservable.add(function() {
+ i.onDragStartObservable.notifyObservers({}), i._selectNode(se);
+ }), O.onDragEndObservable.add(function() {
+ i.onRotationSphereDragEndObservable.notifyObservers({}), i._selectNode(null), i._updateDummy();
+ }), s._rotateSpheresParent.addChild(se);
+ }, s = this, p = 0; p < 12; p++)
+ a(p);
+ i._rootMesh.addChild(i._rotateSpheresParent), i._scaleBoxesParent = new Nt.a("", n.utilityLayerScene), i._scaleBoxesParent.rotationQuaternion = new c.b();
+ for (var m = 0; m < 3; m++)
+ for (var S = 0; S < 3; S++)
+ for (var O, I = function() {
+ var re = (m === 1 ? 1 : 0) + (S === 1 ? 1 : 0) + (k === 1 ? 1 : 0);
+ if (re === 1 || re === 3)
+ return "continue";
+ var se = So.a.CreateBox("", { size: 1 }, n.utilityLayerScene);
+ se.material = G.coloredMaterial, se.metadata = re === 2;
+ var ue = new c.e(m - 1, S - 1, k - 1).normalize();
+ (O = new Ji.a({ dragAxis: ue })).updateDragPlane = !1, O.moveAttached = !1, se.addBehavior(O), O.onDragObservable.add(function(he) {
+ if (i.onScaleBoxDragObservable.notifyObservers({}), i.attachedMesh) {
+ var pe = i.attachedMesh.parent;
+ if (pe && pe.scaling && pe.scaling.isNonUniformWithinEpsilon(1e-3))
+ return void h.a.Warn("BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling");
+ ii.a._RemoveAndStorePivotPoint(i.attachedMesh);
+ var ve = he.dragDistance / i._boundingDimensions.length() * i._anchorMesh.scaling.length(), Ee = new c.e(ve, ve, ve);
+ re === 2 && (Ee.x *= Math.abs(ue.x), Ee.y *= Math.abs(ue.y), Ee.z *= Math.abs(ue.z)), Ee.scaleInPlace(i._scaleDragSpeed), i.updateBoundingBox(), i.scalePivot ? (i.attachedMesh.getWorldMatrix().getRotationMatrixToRef(i._tmpRotationMatrix), i._boundingDimensions.scaleToRef(0.5, i._tmpVector), c.e.TransformCoordinatesToRef(i._tmpVector, i._tmpRotationMatrix, i._tmpVector), i._anchorMesh.position.subtractInPlace(i._tmpVector), i._boundingDimensions.multiplyToRef(i.scalePivot, i._tmpVector), c.e.TransformCoordinatesToRef(i._tmpVector, i._tmpRotationMatrix, i._tmpVector), i._anchorMesh.position.addInPlace(i._tmpVector)) : (se.absolutePosition.subtractToRef(i._anchorMesh.position, i._tmpVector), i._anchorMesh.position.subtractInPlace(i._tmpVector)), i._anchorMesh.addChild(i.attachedMesh), i._anchorMesh.scaling.addInPlace(Ee), (i._anchorMesh.scaling.x < 0 || i._anchorMesh.scaling.y < 0 || i._anchorMesh.scaling.z < 0) && i._anchorMesh.scaling.subtractInPlace(Ee), i._anchorMesh.removeChild(i.attachedMesh), i.attachedMesh.setParent(pe), ii.a._RestorePivotPoint(i.attachedMesh);
+ }
+ i._updateDummy();
+ }), O.onDragStartObservable.add(function() {
+ i.onDragStartObservable.notifyObservers({}), i._selectNode(se);
+ }), O.onDragEndObservable.add(function() {
+ i.onScaleBoxDragEndObservable.notifyObservers({}), i._selectNode(null), i._updateDummy();
+ }), G._scaleBoxesParent.addChild(se);
+ }, G = this, k = 0; k < 3; k++)
+ I();
+ i._rootMesh.addChild(i._scaleBoxesParent);
+ var K = new Array();
+ return i._pointerObserver = n.utilityLayerScene.onPointerObservable.add(function(re) {
+ K[re.event.pointerId] ? re.pickInfo && re.pickInfo.pickedMesh != K[re.event.pointerId] && (K[re.event.pointerId].material = i.coloredMaterial, delete K[re.event.pointerId]) : i._rotateSpheresParent.getChildMeshes().concat(i._scaleBoxesParent.getChildMeshes()).forEach(function(se) {
+ re.pickInfo && re.pickInfo.pickedMesh == se && (K[re.event.pointerId] = se, se.material = i.hoverColoredMaterial);
+ });
+ }), i._renderObserver = i.gizmoLayer.originalScene.onBeforeRenderObservable.add(function() {
+ i.attachedMesh && !i._existingMeshScale.equals(i.attachedMesh.scaling) ? i.updateBoundingBox() : (i.fixedDragMeshScreenSize || i.fixedDragMeshBoundsSize) && (i._updateRotationSpheres(), i._updateScaleBoxes()), i._dragMesh && i.attachedMesh && i.pointerDragBehavior.dragging && (i._lineBoundingBox.position.rotateByQuaternionToRef(i._rootMesh.rotationQuaternion, i._tmpVector), i.attachedMesh.setAbsolutePosition(i._dragMesh.position.add(i._tmpVector.scale(-1))));
+ }), i.updateBoundingBox(), i;
+ }
+ return Object(u.d)(t, r), t.prototype.setColor = function(e) {
+ this.coloredMaterial.emissiveColor = e, this.hoverColoredMaterial.emissiveColor = e.clone().add(new C.a(0.3, 0.3, 0.3)), this._lineBoundingBox.getChildren().forEach(function(n) {
+ n.color && (n.color = e);
+ });
+ }, t.prototype._attachedNodeChanged = function(e) {
+ var n = this;
+ if (e) {
+ ii.a._RemoveAndStorePivotPoint(e);
+ var i = e.parent;
+ this._anchorMesh.addChild(e), this._anchorMesh.removeChild(e), e.setParent(i), ii.a._RestorePivotPoint(e), this.updateBoundingBox(), e.getChildMeshes(!1).forEach(function(o) {
+ o.markAsDirty("scaling");
+ }), this.gizmoLayer.utilityLayerScene.onAfterRenderObservable.addOnce(function() {
+ n._updateDummy();
+ });
+ }
+ }, t.prototype._selectNode = function(e) {
+ this._rotateSpheresParent.getChildMeshes().concat(this._scaleBoxesParent.getChildMeshes()).forEach(function(n) {
+ n.isVisible = !e || n == e;
+ });
+ }, t.prototype.updateBoundingBox = function() {
+ if (this.attachedMesh) {
+ ii.a._RemoveAndStorePivotPoint(this.attachedMesh);
+ var e = this.attachedMesh.parent;
+ this.attachedMesh.setParent(null);
+ var n = null;
+ this.attachedMesh.skeleton && (n = this.attachedMesh.skeleton.overrideMesh, this.attachedMesh.skeleton.overrideMesh = null), this._update(), this.attachedMesh.rotationQuaternion || (this.attachedMesh.rotationQuaternion = c.b.RotationYawPitchRoll(this.attachedMesh.rotation.y, this.attachedMesh.rotation.x, this.attachedMesh.rotation.z)), this._anchorMesh.rotationQuaternion || (this._anchorMesh.rotationQuaternion = c.b.RotationYawPitchRoll(this._anchorMesh.rotation.y, this._anchorMesh.rotation.x, this._anchorMesh.rotation.z)), this._anchorMesh.rotationQuaternion.copyFrom(this.attachedMesh.rotationQuaternion), this._tmpQuaternion.copyFrom(this.attachedMesh.rotationQuaternion), this._tmpVector.copyFrom(this.attachedMesh.position), this.attachedMesh.rotationQuaternion.set(0, 0, 0, 1), this.attachedMesh.position.set(0, 0, 0);
+ var i = this.attachedMesh.getHierarchyBoundingVectors(!this.ignoreChildren, this.includeChildPredicate);
+ i.max.subtractToRef(i.min, this._boundingDimensions), this._lineBoundingBox.scaling.copyFrom(this._boundingDimensions), this._lineBoundingBox.position.set((i.max.x + i.min.x) / 2, (i.max.y + i.min.y) / 2, (i.max.z + i.min.z) / 2), this._rotateSpheresParent.position.copyFrom(this._lineBoundingBox.position), this._scaleBoxesParent.position.copyFrom(this._lineBoundingBox.position), this._lineBoundingBox.computeWorldMatrix(), this._anchorMesh.position.copyFrom(this._lineBoundingBox.absolutePosition), this.attachedMesh.rotationQuaternion.copyFrom(this._tmpQuaternion), this.attachedMesh.position.copyFrom(this._tmpVector), this.attachedMesh.setParent(e), this.attachedMesh.skeleton && (this.attachedMesh.skeleton.overrideMesh = n);
+ }
+ this._updateRotationSpheres(), this._updateScaleBoxes(), this.attachedMesh && (this._existingMeshScale.copyFrom(this.attachedMesh.scaling), ii.a._RestorePivotPoint(this.attachedMesh));
+ }, t.prototype._updateRotationSpheres = function() {
+ for (var e = this._rotateSpheresParent.getChildMeshes(), n = 0; n < 3; n++)
+ for (var i = 0; i < 2; i++)
+ for (var o = 0; o < 2; o++) {
+ var a = 4 * n + 2 * i + o;
+ if (n == 0 && (e[a].position.set(this._boundingDimensions.x / 2, this._boundingDimensions.y * i, this._boundingDimensions.z * o), e[a].position.addInPlace(new c.e(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2)), e[a].lookAt(c.e.Cross(e[a].position.normalizeToNew(), c.e.Right()).normalizeToNew().add(e[a].position))), n == 1 && (e[a].position.set(this._boundingDimensions.x * i, this._boundingDimensions.y / 2, this._boundingDimensions.z * o), e[a].position.addInPlace(new c.e(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2)), e[a].lookAt(c.e.Cross(e[a].position.normalizeToNew(), c.e.Up()).normalizeToNew().add(e[a].position))), n == 2 && (e[a].position.set(this._boundingDimensions.x * i, this._boundingDimensions.y * o, this._boundingDimensions.z / 2), e[a].position.addInPlace(new c.e(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2)), e[a].lookAt(c.e.Cross(e[a].position.normalizeToNew(), c.e.Forward()).normalizeToNew().add(e[a].position))), this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {
+ e[a].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);
+ var s = this.rotationSphereSize * this._tmpVector.length() / this.fixedDragMeshScreenSizeDistanceFactor;
+ e[a].scaling.set(s, s, s);
+ } else
+ this.fixedDragMeshBoundsSize ? e[a].scaling.set(this.rotationSphereSize * this._boundingDimensions.x, this.rotationSphereSize * this._boundingDimensions.y, this.rotationSphereSize * this._boundingDimensions.z) : e[a].scaling.set(this.rotationSphereSize, this.rotationSphereSize, this.rotationSphereSize);
+ }
+ }, t.prototype._updateScaleBoxes = function() {
+ for (var e = this._scaleBoxesParent.getChildMeshes(), n = 0, i = 0; i < 3; i++)
+ for (var o = 0; o < 3; o++)
+ for (var a = 0; a < 3; a++) {
+ var s = (i === 1 ? 1 : 0) + (o === 1 ? 1 : 0) + (a === 1 ? 1 : 0);
+ if (s !== 1 && s !== 3) {
+ if (e[n])
+ if (e[n].position.set(this._boundingDimensions.x * (i / 2), this._boundingDimensions.y * (o / 2), this._boundingDimensions.z * (a / 2)), e[n].position.addInPlace(new c.e(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2)), this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {
+ e[n].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);
+ var p = this.scaleBoxSize * this._tmpVector.length() / this.fixedDragMeshScreenSizeDistanceFactor;
+ e[n].scaling.set(p, p, p);
+ } else
+ this.fixedDragMeshBoundsSize ? e[n].scaling.set(this.scaleBoxSize * this._boundingDimensions.x, this.scaleBoxSize * this._boundingDimensions.y, this.scaleBoxSize * this._boundingDimensions.z) : e[n].scaling.set(this.scaleBoxSize, this.scaleBoxSize, this.scaleBoxSize);
+ n++;
+ }
+ }
+ }, t.prototype.setEnabledRotationAxis = function(e) {
+ this._rotateSpheresParent.getChildMeshes().forEach(function(n, i) {
+ i < 4 ? n.setEnabled(e.indexOf("x") != -1) : i < 8 ? n.setEnabled(e.indexOf("y") != -1) : n.setEnabled(e.indexOf("z") != -1);
+ });
+ }, t.prototype.setEnabledScaling = function(e, n) {
+ n === void 0 && (n = !1), this._scaleBoxesParent.getChildMeshes().forEach(function(i, o) {
+ var a = e;
+ n && i.metadata === !0 && (a = !1), i.setEnabled(a);
+ });
+ }, t.prototype._updateDummy = function() {
+ this._dragMesh && (this._dragMesh.position.copyFrom(this._lineBoundingBox.getAbsolutePosition()), this._dragMesh.scaling.copyFrom(this._lineBoundingBox.scaling), this._dragMesh.rotationQuaternion.copyFrom(this._rootMesh.rotationQuaternion));
+ }, t.prototype.enableDragBehavior = function() {
+ this._dragMesh = we.a.CreateBox("dummy", 1, this.gizmoLayer.utilityLayerScene), this._dragMesh.visibility = 0, this._dragMesh.rotationQuaternion = new c.b(), this.pointerDragBehavior.useObjectOrientationForDragging = !1, this._dragMesh.addBehavior(this.pointerDragBehavior);
+ }, t.prototype.dispose = function() {
+ this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver), this.gizmoLayer.originalScene.onBeforeRenderObservable.remove(this._renderObserver), this._lineBoundingBox.dispose(), this._rotateSpheresParent.dispose(), this._scaleBoxesParent.dispose(), this._dragMesh && this._dragMesh.dispose(), r.prototype.dispose.call(this);
+ }, t.MakeNotPickableAndWrapInBoundingBox = function(e) {
+ var n = function(p) {
+ p.isPickable = !1, p.getChildMeshes().forEach(function(m) {
+ n(m);
+ });
+ };
+ n(e), e.rotationQuaternion || (e.rotationQuaternion = c.b.RotationYawPitchRoll(e.rotation.y, e.rotation.x, e.rotation.z));
+ var i = e.position.clone(), o = e.rotationQuaternion.clone();
+ e.rotationQuaternion.set(0, 0, 0, 1), e.position.set(0, 0, 0);
+ var a = So.a.CreateBox("box", { size: 1 }, e.getScene()), s = e.getHierarchyBoundingVectors();
+ return s.max.subtractToRef(s.min, a.scaling), a.scaling.y === 0 && (a.scaling.y = Xt.a), a.scaling.x === 0 && (a.scaling.x = Xt.a), a.scaling.z === 0 && (a.scaling.z = Xt.a), a.position.set((s.max.x + s.min.x) / 2, (s.max.y + s.min.y) / 2, (s.max.z + s.min.z) / 2), e.addChild(a), e.rotationQuaternion.copyFrom(o), e.position.copyFrom(i), e.removeChild(a), a.addChild(e), a.visibility = 0, a;
+ }, t.prototype.setCustomMesh = function(e) {
+ h.a.Error("Custom meshes are not supported on this gizmo");
+ }, t;
+ }(Kn.a), xs = function(r) {
+ function t(e, n, i, o, a, s, p) {
+ var m;
+ n === void 0 && (n = C.a.Gray()), i === void 0 && (i = Gn.a.DefaultUtilityLayer), o === void 0 && (o = 32), a === void 0 && (a = null), p === void 0 && (p = 1);
+ var S = r.call(this, i) || this;
+ S._pointerObserver = null, S.snapDistance = 0, S.onSnapObservable = new P.c(), S._isEnabled = !0, S._parent = null, S._dragging = !1, S._parent = a, S._coloredMaterial = new kt.a("", i.utilityLayerScene), S._coloredMaterial.diffuseColor = n, S._coloredMaterial.specularColor = n.subtract(new C.a(0.1, 0.1, 0.1)), S._hoverMaterial = new kt.a("", i.utilityLayerScene), S._hoverMaterial.diffuseColor = C.a.Yellow(), S._disableMaterial = new kt.a("", i.utilityLayerScene), S._disableMaterial.diffuseColor = C.a.Gray(), S._disableMaterial.alpha = 0.4, S._gizmoMesh = new we.a("", i.utilityLayerScene);
+ var O = S._createGizmoMesh(S._gizmoMesh, p, o), I = O.rotationMesh, G = O.collider, k = [];
+ S._rotationCircle = S.setupRotationCircle(k, S._gizmoMesh), S._gizmoMesh.lookAt(S._rootMesh.position.add(e)), S._rootMesh.addChild(S._gizmoMesh), S._gizmoMesh.scaling.scaleInPlace(1 / 3), S.dragBehavior = new Ji.a({ dragPlaneNormal: e }), S.dragBehavior.moveAttached = !1, S.dragBehavior.maxDragAngle = 9 * Math.PI / 20, S.dragBehavior._useAlternatePickedPointAboveMaxDragAngle = !0, S._rootMesh.addBehavior(S.dragBehavior);
+ var K = 0, re = new c.e(), se = new c.e(), ue = new c.a(), he = new c.e(), pe = new c.e();
+ S.dragBehavior.onDragStartObservable.add(function(Ce) {
+ if (S.attachedNode) {
+ re.copyFrom(Ce.dragPlanePoint);
+ var Fe = new c.e(0, 0, 1), Oe = S._rotationCircle.getDirection(Fe);
+ Oe.normalize(), S._gizmoMesh.removeChild(S._rotationCircle), re.copyFrom(Ce.dragPlanePoint), se = Ce.dragPlanePoint;
+ var Be = S._rotationCircle.getAbsolutePosition().clone(), Le = S._rotationCircle.getAbsolutePosition().clone().addInPlace(Oe), Ve = Ce.dragPlanePoint, Qe = c.e.GetAngleBetweenVectors(Le.subtract(Be), Ve.subtract(Be), S._rotationCircle.up);
+ S._rotationCircle.addRotation(0, Qe, 0), S._dragging = !0;
+ }
+ }), S.dragBehavior.onDragEndObservable.add(function() {
+ K = 0, S.updateRotationCircle(S._rotationCircle, k, K, se), S._gizmoMesh.addChild(S._rotationCircle), S._dragging = !1;
+ });
+ var ve = { snapDistance: 0 }, Ee = 0, Ae = new c.a(), Ie = new c.b();
+ S.dragBehavior.onDragObservable.add(function(Ce) {
+ if (S.attachedNode) {
+ var Fe = new c.e(1, 1, 1), Oe = new c.b(0, 0, 0, 1), Be = new c.e(0, 0, 0);
+ S.attachedNode.getWorldMatrix().decompose(Fe, Oe, Be);
+ var Le = Ce.dragPlanePoint.subtract(Be).normalize(), Ve = re.subtract(Be).normalize(), Qe = c.e.Cross(Le, Ve), nt = c.e.Dot(Le, Ve), rt = Math.atan2(Qe.length(), nt);
+ he.copyFrom(e), pe.copyFrom(e), S.updateGizmoRotationToMatchAttachedMesh && (Oe.toRotationMatrix(ue), pe = c.e.TransformCoordinates(he, ue));
+ var ut = !1;
+ if (i.utilityLayerScene.activeCamera) {
+ var qe = i.utilityLayerScene.activeCamera.position.subtract(Be);
+ c.e.Dot(qe, pe) > 0 && (he.scaleInPlace(-1), pe.scaleInPlace(-1), ut = !0);
+ }
+ c.e.Dot(pe, Qe) > 0 && (rt = -rt);
+ var at = !1;
+ if (S.snapDistance != 0)
+ if (Ee += rt, Math.abs(Ee) > S.snapDistance) {
+ var ot = Math.floor(Math.abs(Ee) / S.snapDistance);
+ Ee < 0 && (ot *= -1), Ee %= S.snapDistance, rt = S.snapDistance * ot, at = !0;
+ } else
+ rt = 0;
+ K += ut ? -rt : rt, S.updateRotationCircle(S._rotationCircle, k, K, se);
+ var Je = Math.sin(rt / 2);
+ if (Ie.set(he.x * Je, he.y * Je, he.z * Je, Math.cos(rt / 2)), Ae.determinant() > 0) {
+ var dt = new c.e();
+ Ie.toEulerAnglesToRef(dt), c.b.RotationYawPitchRollToRef(dt.y, -dt.x, -dt.z, Ie);
+ }
+ S.updateGizmoRotationToMatchAttachedMesh ? Oe.multiplyToRef(Ie, Oe) : Ie.multiplyToRef(Oe, Oe), S.attachedNode.getWorldMatrix().copyFrom(c.a.Compose(Fe, Oe, Be)), re.copyFrom(Ce.dragPlanePoint), at && (ve.snapDistance = rt, S.onSnapObservable.notifyObservers(ve)), S._matrixChanged();
+ }
+ });
+ var xe = i._getSharedGizmoLight();
+ xe.includedOnlyMeshes = xe.includedOnlyMeshes.concat(S._rootMesh.getChildMeshes(!1));
+ var Pe = { colliderMeshes: [G], gizmoMeshes: [I], material: S._coloredMaterial, hoverMaterial: S._hoverMaterial, disableMaterial: S._disableMaterial, active: !1 };
+ return (m = S._parent) === null || m === void 0 || m.addToAxisCache(S._gizmoMesh, Pe), S._pointerObserver = i.utilityLayerScene.onPointerObservable.add(function(Ce) {
+ var Fe;
+ if (!S._customMeshSet && (S._isHovered = Pe.colliderMeshes.indexOf((Fe = Ce == null ? void 0 : Ce.pickInfo) === null || Fe === void 0 ? void 0 : Fe.pickedMesh) != -1, !S._parent)) {
+ var Oe = S._isHovered || S._dragging ? S._hoverMaterial : S._coloredMaterial;
+ Pe.gizmoMeshes.forEach(function(Be) {
+ Be.material = Oe, Be.color && (Be.color = Oe.diffuseColor);
+ });
+ }
+ }), S;
+ }
+ return Object(u.d)(t, r), t.prototype._createGizmoMesh = function(e, n, i) {
+ var o = we.a.CreateTorus("ignore", 0.6, 0.03 * n, i, this.gizmoLayer.utilityLayerScene);
+ o.visibility = 0;
+ var a = we.a.CreateTorus("", 0.6, 5e-3 * n, i, this.gizmoLayer.utilityLayerScene);
+ return a.material = this._coloredMaterial, a.rotation.x = Math.PI / 2, o.rotation.x = Math.PI / 2, e.addChild(a), e.addChild(o), { rotationMesh: a, collider: o };
+ }, t.prototype._attachedNodeChanged = function(e) {
+ this.dragBehavior && (this.dragBehavior.enabled = !!e);
+ }, t.prototype.setupRotationCircle = function(e, n) {
+ for (var i = t._CircleConstants.pi2 / t._CircleConstants.tessellation, o = -Math.PI / 2; o < Math.PI / 2 - 1.5; o += i / 2) {
+ for (var a = [], s = 0; s < t._CircleConstants.pi2 * t._CircleConstants.rotationCircleRange + 0.01; s += i)
+ if (s < 0) {
+ var p = t._CircleConstants.radius * Math.sin(s) * Math.cos(o), m = t._CircleConstants.radius * Math.cos(s) * Math.cos(o);
+ a.push(new c.e(p, 0, m));
+ } else
+ a.push(new c.e(0, 0, 0));
+ e.push(a);
+ }
+ var S = new kt.a("", this.gizmoLayer.utilityLayerScene);
+ S.diffuseColor = C.a.Yellow(), S.backFaceCulling = !1;
+ var O = we.a.CreateRibbon("rotationCircle", e, !1, !1, 0, this.gizmoLayer.utilityLayerScene, !0);
+ return O.material = S, O.material.alpha = 0.25, O.rotation.x = Math.PI / 2, n.addChild(O), O;
+ }, t.prototype.updateRotationPath = function(e, n) {
+ for (var i = t._CircleConstants.pi2 / t._CircleConstants.tessellation, o = 0, a = -Math.PI / 2; a < Math.PI / 2 - 1.5; a += i / 2) {
+ var s = e[o];
+ if (s)
+ for (var p = 0, m = 0; m < t._CircleConstants.pi2 * t._CircleConstants.rotationCircleRange + 0.01; m += i) {
+ if (s[p])
+ if (m < Math.abs(n)) {
+ var S = n > 0 ? m : -1 * m, O = n > 0 ? a : -1 * a;
+ s[p].set(t._CircleConstants.radius * Math.sin(S) * Math.cos(O), 0, t._CircleConstants.radius * Math.cos(S) * Math.cos(O));
+ } else
+ s[p].set(0, 0, 0);
+ p++;
+ }
+ o++;
+ }
+ }, t.prototype.updateRotationCircle = function(e, n, i, o) {
+ this.updateRotationPath(n, i), we.a.CreateRibbon("rotationCircle", n, !1, !1, 0, this.gizmoLayer.utilityLayerScene, void 0, void 0, e.geometry ? e : void 0);
+ }, Object.defineProperty(t.prototype, "isEnabled", { get: function() {
+ return this._isEnabled;
+ }, set: function(e) {
+ this._isEnabled = e, e ? this._parent && (this.attachedMesh = this._parent.attachedMesh) : this.attachedMesh = null;
+ }, enumerable: !1, configurable: !0 }), t.prototype.dispose = function() {
+ this.onSnapObservable.clear(), this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver), this.dragBehavior.detach(), this._gizmoMesh && this._gizmoMesh.dispose(), this._rotationCircle && this._rotationCircle.dispose(), [this._coloredMaterial, this._hoverMaterial, this._disableMaterial].forEach(function(e) {
+ e && e.dispose();
+ }), r.prototype.dispose.call(this);
+ }, t._CircleConstants = { radius: 0.3, pi2: 2 * Math.PI, tessellation: 70, rotationCircleRange: 4 }, t;
+ }(Kn.a), hf = function(r) {
+ function t(e, n, i, o, a) {
+ e === void 0 && (e = Gn.a.DefaultUtilityLayer), n === void 0 && (n = 32), i === void 0 && (i = !1), o === void 0 && (o = 1);
+ var s = r.call(this, e) || this;
+ return s.onDragStartObservable = new P.c(), s.onDragEndObservable = new P.c(), s._observables = [], s._gizmoAxisCache = /* @__PURE__ */ new Map(), s.xGizmo = new xs(new c.e(1, 0, 0), C.a.Red().scale(0.5), e, n, s, i, o), s.yGizmo = new xs(new c.e(0, 1, 0), C.a.Green().scale(0.5), e, n, s, i, o), s.zGizmo = new xs(new c.e(0, 0, 1), C.a.Blue().scale(0.5), e, n, s, i, o), [s.xGizmo, s.yGizmo, s.zGizmo].forEach(function(p) {
+ p.dragBehavior.onDragStartObservable.add(function() {
+ s.onDragStartObservable.notifyObservers({});
+ }), p.dragBehavior.onDragEndObservable.add(function() {
+ s.onDragEndObservable.notifyObservers({});
+ });
+ }), s.attachedMesh = null, s.attachedNode = null, a ? a.addToAxisCache(s._gizmoAxisCache) : Kn.a.GizmoAxisPointerObserver(e, s._gizmoAxisCache), s;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "attachedMesh", { get: function() {
+ return this._meshAttached;
+ }, set: function(e) {
+ this._meshAttached = e, this._nodeAttached = e, this._checkBillboardTransform(), [this.xGizmo, this.yGizmo, this.zGizmo].forEach(function(n) {
+ n.isEnabled ? n.attachedMesh = e : n.attachedMesh = null;
+ });
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "attachedNode", { get: function() {
+ return this._nodeAttached;
+ }, set: function(e) {
+ this._meshAttached = null, this._nodeAttached = e, this._checkBillboardTransform(), [this.xGizmo, this.yGizmo, this.zGizmo].forEach(function(n) {
+ n.isEnabled ? n.attachedNode = e : n.attachedNode = null;
+ });
+ }, enumerable: !1, configurable: !0 }), t.prototype._checkBillboardTransform = function() {
+ this._nodeAttached && this._nodeAttached.billboardMode && console.log("Rotation Gizmo will not work with transforms in billboard mode.");
+ }, Object.defineProperty(t.prototype, "isHovered", { get: function() {
+ var e = !1;
+ return [this.xGizmo, this.yGizmo, this.zGizmo].forEach(function(n) {
+ e = e || n.isHovered;
+ }), e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "updateGizmoRotationToMatchAttachedMesh", { get: function() {
+ return this.xGizmo.updateGizmoRotationToMatchAttachedMesh;
+ }, set: function(e) {
+ this.xGizmo && (this.xGizmo.updateGizmoRotationToMatchAttachedMesh = e, this.yGizmo.updateGizmoRotationToMatchAttachedMesh = e, this.zGizmo.updateGizmoRotationToMatchAttachedMesh = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "snapDistance", { get: function() {
+ return this.xGizmo.snapDistance;
+ }, set: function(e) {
+ this.xGizmo && (this.xGizmo.snapDistance = e, this.yGizmo.snapDistance = e, this.zGizmo.snapDistance = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "scaleRatio", { get: function() {
+ return this.xGizmo.scaleRatio;
+ }, set: function(e) {
+ this.xGizmo && (this.xGizmo.scaleRatio = e, this.yGizmo.scaleRatio = e, this.zGizmo.scaleRatio = e);
+ }, enumerable: !1, configurable: !0 }), t.prototype.addToAxisCache = function(e, n) {
+ this._gizmoAxisCache.set(e, n);
+ }, t.prototype.dispose = function() {
+ var e = this;
+ this.xGizmo.dispose(), this.yGizmo.dispose(), this.zGizmo.dispose(), this.onDragStartObservable.clear(), this.onDragEndObservable.clear(), this._observables.forEach(function(n) {
+ e.gizmoLayer.utilityLayerScene.onPointerObservable.remove(n);
+ });
+ }, t.prototype.setCustomMesh = function(e) {
+ h.a.Error("Custom meshes are not supported on this gizmo, please set the custom meshes on the gizmos contained within this one (gizmo.xGizmo, gizmo.yGizmo, gizmo.zGizmo)");
+ }, t;
+ }(Kn.a), Ao = l(46), Ml = l(84), Rs = function(r) {
+ function t(e, n, i, o) {
+ var a;
+ n === void 0 && (n = C.a.Gray()), i === void 0 && (i = Gn.a.DefaultUtilityLayer), o === void 0 && (o = null);
+ var s = r.call(this, i) || this;
+ s._pointerObserver = null, s.snapDistance = 0, s.onSnapObservable = new P.c(), s._isEnabled = !1, s._parent = null, s._dragging = !1, s._parent = o, s._coloredMaterial = new kt.a("", i.utilityLayerScene), s._coloredMaterial.diffuseColor = n, s._coloredMaterial.specularColor = n.subtract(new C.a(0.1, 0.1, 0.1)), s._hoverMaterial = new kt.a("", i.utilityLayerScene), s._hoverMaterial.diffuseColor = C.a.Yellow(), s._disableMaterial = new kt.a("", i.utilityLayerScene), s._disableMaterial.diffuseColor = C.a.Gray(), s._disableMaterial.alpha = 0.4, s._gizmoMesh = t._CreatePlane(i.utilityLayerScene, s._coloredMaterial), s._gizmoMesh.lookAt(s._rootMesh.position.add(e)), s._gizmoMesh.scaling.scaleInPlace(1 / 3), s._gizmoMesh.parent = s._rootMesh;
+ var p = 0, m = new c.e(), S = { snapDistance: 0 };
+ s.dragBehavior = new Ji.a({ dragPlaneNormal: e }), s.dragBehavior.moveAttached = !1, s._rootMesh.addBehavior(s.dragBehavior), s.dragBehavior.onDragObservable.add(function(G) {
+ if (s.attachedNode) {
+ if (s.snapDistance == 0)
+ s.attachedNode.getWorldMatrix().addTranslationFromFloats(G.delta.x, G.delta.y, G.delta.z);
+ else if (p += G.dragDistance, Math.abs(p) > s.snapDistance) {
+ var k = Math.floor(Math.abs(p) / s.snapDistance);
+ p %= s.snapDistance, G.delta.normalizeToRef(m), m.scaleInPlace(s.snapDistance * k), s.attachedNode.getWorldMatrix().addTranslationFromFloats(m.x, m.y, m.z), S.snapDistance = s.snapDistance * k, s.onSnapObservable.notifyObservers(S);
+ }
+ s._matrixChanged();
+ }
+ }), s.dragBehavior.onDragStartObservable.add(function() {
+ s._dragging = !0;
+ }), s.dragBehavior.onDragEndObservable.add(function() {
+ s._dragging = !1;
+ });
+ var O = i._getSharedGizmoLight();
+ O.includedOnlyMeshes = O.includedOnlyMeshes.concat(s._rootMesh.getChildMeshes(!1));
+ var I = { gizmoMeshes: s._gizmoMesh.getChildMeshes(), colliderMeshes: s._gizmoMesh.getChildMeshes(), material: s._coloredMaterial, hoverMaterial: s._hoverMaterial, disableMaterial: s._disableMaterial, active: !1 };
+ return (a = s._parent) === null || a === void 0 || a.addToAxisCache(s._gizmoMesh, I), s._pointerObserver = i.utilityLayerScene.onPointerObservable.add(function(G) {
+ var k;
+ if (!s._customMeshSet && (s._isHovered = I.colliderMeshes.indexOf((k = G == null ? void 0 : G.pickInfo) === null || k === void 0 ? void 0 : k.pickedMesh) != -1, !s._parent)) {
+ var K = s._isHovered || s._dragging ? s._hoverMaterial : s._coloredMaterial;
+ I.gizmoMeshes.forEach(function(re) {
+ re.material = K;
+ });
+ }
+ }), s;
+ }
+ return Object(u.d)(t, r), t._CreatePlane = function(e, n) {
+ var i = new Ao.a("plane", e), o = Ml.a.CreatePlane("dragPlane", { width: 0.1375, height: 0.1375, sideOrientation: 2 }, e);
+ return o.material = n, o.parent = i, i;
+ }, t.prototype._attachedNodeChanged = function(e) {
+ this.dragBehavior && (this.dragBehavior.enabled = !!e);
+ }, Object.defineProperty(t.prototype, "isEnabled", { get: function() {
+ return this._isEnabled;
+ }, set: function(e) {
+ this._isEnabled = e, e ? this._parent && (this.attachedNode = this._parent.attachedNode) : this.attachedNode = null;
+ }, enumerable: !1, configurable: !0 }), t.prototype.dispose = function() {
+ this.onSnapObservable.clear(), this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver), this.dragBehavior.detach(), r.prototype.dispose.call(this), this._gizmoMesh && this._gizmoMesh.dispose(), [this._coloredMaterial, this._hoverMaterial, this._disableMaterial].forEach(function(e) {
+ e && e.dispose();
+ });
+ }, t;
+ }(Kn.a), df = function(r) {
+ function t(e, n, i) {
+ e === void 0 && (e = Gn.a.DefaultUtilityLayer), n === void 0 && (n = 1);
+ var o = r.call(this, e) || this;
+ return o._meshAttached = null, o._nodeAttached = null, o._observables = [], o._gizmoAxisCache = /* @__PURE__ */ new Map(), o.onDragStartObservable = new P.c(), o.onDragEndObservable = new P.c(), o._planarGizmoEnabled = !1, o.xGizmo = new Cs.a(new c.e(1, 0, 0), C.a.Red().scale(0.5), e, o, n), o.yGizmo = new Cs.a(new c.e(0, 1, 0), C.a.Green().scale(0.5), e, o, n), o.zGizmo = new Cs.a(new c.e(0, 0, 1), C.a.Blue().scale(0.5), e, o, n), o.xPlaneGizmo = new Rs(new c.e(1, 0, 0), C.a.Red().scale(0.5), o.gizmoLayer, o), o.yPlaneGizmo = new Rs(new c.e(0, 1, 0), C.a.Green().scale(0.5), o.gizmoLayer, o), o.zPlaneGizmo = new Rs(new c.e(0, 0, 1), C.a.Blue().scale(0.5), o.gizmoLayer, o), [o.xGizmo, o.yGizmo, o.zGizmo, o.xPlaneGizmo, o.yPlaneGizmo, o.zPlaneGizmo].forEach(function(a) {
+ a.dragBehavior.onDragStartObservable.add(function() {
+ o.onDragStartObservable.notifyObservers({});
+ }), a.dragBehavior.onDragEndObservable.add(function() {
+ o.onDragEndObservable.notifyObservers({});
+ });
+ }), o.attachedMesh = null, i ? i.addToAxisCache(o._gizmoAxisCache) : Kn.a.GizmoAxisPointerObserver(e, o._gizmoAxisCache), o;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "attachedMesh", { get: function() {
+ return this._meshAttached;
+ }, set: function(e) {
+ this._meshAttached = e, this._nodeAttached = e, [this.xGizmo, this.yGizmo, this.zGizmo, this.xPlaneGizmo, this.yPlaneGizmo, this.zPlaneGizmo].forEach(function(n) {
+ n.isEnabled ? n.attachedMesh = e : n.attachedMesh = null;
+ });
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "attachedNode", { get: function() {
+ return this._nodeAttached;
+ }, set: function(e) {
+ this._meshAttached = null, this._nodeAttached = null, [this.xGizmo, this.yGizmo, this.zGizmo, this.xPlaneGizmo, this.yPlaneGizmo, this.zPlaneGizmo].forEach(function(n) {
+ n.isEnabled ? n.attachedNode = e : n.attachedNode = null;
+ });
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "isHovered", { get: function() {
+ var e = !1;
+ return [this.xGizmo, this.yGizmo, this.zGizmo, this.xPlaneGizmo, this.yPlaneGizmo, this.zPlaneGizmo].forEach(function(n) {
+ e = e || n.isHovered;
+ }), e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "planarGizmoEnabled", { get: function() {
+ return this._planarGizmoEnabled;
+ }, set: function(e) {
+ var n = this;
+ this._planarGizmoEnabled = e, [this.xPlaneGizmo, this.yPlaneGizmo, this.zPlaneGizmo].forEach(function(i) {
+ i && (i.isEnabled = e, e && (i.attachedMesh ? i.attachedMesh = n.attachedMesh : i.attachedNode = n.attachedNode));
+ }, this);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "updateGizmoRotationToMatchAttachedMesh", { get: function() {
+ return this._updateGizmoRotationToMatchAttachedMesh;
+ }, set: function(e) {
+ this._updateGizmoRotationToMatchAttachedMesh = e, [this.xGizmo, this.yGizmo, this.zGizmo, this.xPlaneGizmo, this.yPlaneGizmo, this.zPlaneGizmo].forEach(function(n) {
+ n && (n.updateGizmoRotationToMatchAttachedMesh = e);
+ });
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "snapDistance", { get: function() {
+ return this._snapDistance;
+ }, set: function(e) {
+ this._snapDistance = e, [this.xGizmo, this.yGizmo, this.zGizmo, this.xPlaneGizmo, this.yPlaneGizmo, this.zPlaneGizmo].forEach(function(n) {
+ n && (n.snapDistance = e);
+ });
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "scaleRatio", { get: function() {
+ return this._scaleRatio;
+ }, set: function(e) {
+ this._scaleRatio = e, [this.xGizmo, this.yGizmo, this.zGizmo, this.xPlaneGizmo, this.yPlaneGizmo, this.zPlaneGizmo].forEach(function(n) {
+ n && (n.scaleRatio = e);
+ });
+ }, enumerable: !1, configurable: !0 }), t.prototype.addToAxisCache = function(e, n) {
+ this._gizmoAxisCache.set(e, n);
+ }, t.prototype.dispose = function() {
+ var e = this;
+ [this.xGizmo, this.yGizmo, this.zGizmo, this.xPlaneGizmo, this.yPlaneGizmo, this.zPlaneGizmo].forEach(function(n) {
+ n && n.dispose();
+ }), this._observables.forEach(function(n) {
+ e.gizmoLayer.utilityLayerScene.onPointerObservable.remove(n);
+ }), this.onDragStartObservable.clear(), this.onDragEndObservable.clear();
+ }, t.prototype.setCustomMesh = function(e) {
+ h.a.Error("Custom meshes are not supported on this gizmo, please set the custom meshes on the gizmos contained within this one (gizmo.xGizmo, gizmo.yGizmo, gizmo.zGizmo,gizmo.xPlaneGizmo, gizmo.yPlaneGizmo, gizmo.zPlaneGizmo)");
+ }, t;
+ }(Kn.a);
+ ft.a.CreatePolyhedron = function(r) {
+ var t = [];
+ t[0] = { vertex: [[0, 0, 1.732051], [1.632993, 0, -0.5773503], [-0.8164966, 1.414214, -0.5773503], [-0.8164966, -1.414214, -0.5773503]], face: [[0, 1, 2], [0, 2, 3], [0, 3, 1], [1, 3, 2]] }, t[1] = { vertex: [[0, 0, 1.414214], [1.414214, 0, 0], [0, 1.414214, 0], [-1.414214, 0, 0], [0, -1.414214, 0], [0, 0, -1.414214]], face: [[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 1], [1, 4, 5], [1, 5, 2], [2, 5, 3], [3, 5, 4]] }, t[2] = { vertex: [[0, 0, 1.070466], [0.7136442, 0, 0.7978784], [-0.3568221, 0.618034, 0.7978784], [-0.3568221, -0.618034, 0.7978784], [0.7978784, 0.618034, 0.3568221], [0.7978784, -0.618034, 0.3568221], [-0.9341724, 0.381966, 0.3568221], [0.1362939, 1, 0.3568221], [0.1362939, -1, 0.3568221], [-0.9341724, -0.381966, 0.3568221], [0.9341724, 0.381966, -0.3568221], [0.9341724, -0.381966, -0.3568221], [-0.7978784, 0.618034, -0.3568221], [-0.1362939, 1, -0.3568221], [-0.1362939, -1, -0.3568221], [-0.7978784, -0.618034, -0.3568221], [0.3568221, 0.618034, -0.7978784], [0.3568221, -0.618034, -0.7978784], [-0.7136442, 0, -0.7978784], [0, 0, -1.070466]], face: [[0, 1, 4, 7, 2], [0, 2, 6, 9, 3], [0, 3, 8, 5, 1], [1, 5, 11, 10, 4], [2, 7, 13, 12, 6], [3, 9, 15, 14, 8], [4, 10, 16, 13, 7], [5, 8, 14, 17, 11], [6, 12, 18, 15, 9], [10, 11, 17, 19, 16], [12, 13, 16, 19, 18], [14, 15, 18, 19, 17]] }, t[3] = { vertex: [[0, 0, 1.175571], [1.051462, 0, 0.5257311], [0.3249197, 1, 0.5257311], [-0.8506508, 0.618034, 0.5257311], [-0.8506508, -0.618034, 0.5257311], [0.3249197, -1, 0.5257311], [0.8506508, 0.618034, -0.5257311], [0.8506508, -0.618034, -0.5257311], [-0.3249197, 1, -0.5257311], [-1.051462, 0, -0.5257311], [-0.3249197, -1, -0.5257311], [0, 0, -1.175571]], face: [[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 5], [0, 5, 1], [1, 5, 7], [1, 7, 6], [1, 6, 2], [2, 6, 8], [2, 8, 3], [3, 8, 9], [3, 9, 4], [4, 9, 10], [4, 10, 5], [5, 10, 7], [6, 7, 11], [6, 11, 8], [7, 10, 11], [8, 11, 9], [9, 11, 10]] }, t[4] = { vertex: [[0, 0, 1.070722], [0.7148135, 0, 0.7971752], [-0.104682, 0.7071068, 0.7971752], [-0.6841528, 0.2071068, 0.7971752], [-0.104682, -0.7071068, 0.7971752], [0.6101315, 0.7071068, 0.5236279], [1.04156, 0.2071068, 0.1367736], [0.6101315, -0.7071068, 0.5236279], [-0.3574067, 1, 0.1367736], [-0.7888348, -0.5, 0.5236279], [-0.9368776, 0.5, 0.1367736], [-0.3574067, -1, 0.1367736], [0.3574067, 1, -0.1367736], [0.9368776, -0.5, -0.1367736], [0.7888348, 0.5, -0.5236279], [0.3574067, -1, -0.1367736], [-0.6101315, 0.7071068, -0.5236279], [-1.04156, -0.2071068, -0.1367736], [-0.6101315, -0.7071068, -0.5236279], [0.104682, 0.7071068, -0.7971752], [0.6841528, -0.2071068, -0.7971752], [0.104682, -0.7071068, -0.7971752], [-0.7148135, 0, -0.7971752], [0, 0, -1.070722]], face: [[0, 2, 3], [1, 6, 5], [4, 9, 11], [7, 15, 13], [8, 16, 10], [12, 14, 19], [17, 22, 18], [20, 21, 23], [0, 1, 5, 2], [0, 3, 9, 4], [0, 4, 7, 1], [1, 7, 13, 6], [2, 5, 12, 8], [2, 8, 10, 3], [3, 10, 17, 9], [4, 11, 15, 7], [5, 6, 14, 12], [6, 13, 20, 14], [8, 12, 19, 16], [9, 17, 18, 11], [10, 16, 22, 17], [11, 18, 21, 15], [13, 15, 21, 20], [14, 20, 23, 19], [16, 19, 23, 22], [18, 22, 23, 21]] }, t[5] = { vertex: [[0, 0, 1.322876], [1.309307, 0, 0.1889822], [-0.9819805, 0.8660254, 0.1889822], [0.1636634, -1.299038, 0.1889822], [0.3273268, 0.8660254, -0.9449112], [-0.8183171, -0.4330127, -0.9449112]], face: [[0, 3, 1], [2, 4, 5], [0, 1, 4, 2], [0, 2, 5, 3], [1, 3, 5, 4]] }, t[6] = { vertex: [[0, 0, 1.159953], [1.013464, 0, 0.5642542], [-0.3501431, 0.9510565, 0.5642542], [-0.7715208, -0.6571639, 0.5642542], [0.6633206, 0.9510565, -0.03144481], [0.8682979, -0.6571639, -0.3996071], [-1.121664, 0.2938926, -0.03144481], [-0.2348831, -1.063314, -0.3996071], [0.5181548, 0.2938926, -0.9953061], [-0.5850262, -0.112257, -0.9953061]], face: [[0, 1, 4, 2], [0, 2, 6, 3], [1, 5, 8, 4], [3, 6, 9, 7], [5, 7, 9, 8], [0, 3, 7, 5, 1], [2, 4, 8, 9, 6]] }, t[7] = { vertex: [[0, 0, 1.118034], [0.8944272, 0, 0.6708204], [-0.2236068, 0.8660254, 0.6708204], [-0.7826238, -0.4330127, 0.6708204], [0.6708204, 0.8660254, 0.2236068], [1.006231, -0.4330127, -0.2236068], [-1.006231, 0.4330127, 0.2236068], [-0.6708204, -0.8660254, -0.2236068], [0.7826238, 0.4330127, -0.6708204], [0.2236068, -0.8660254, -0.6708204], [-0.8944272, 0, -0.6708204], [0, 0, -1.118034]], face: [[0, 1, 4, 2], [0, 2, 6, 3], [1, 5, 8, 4], [3, 6, 10, 7], [5, 9, 11, 8], [7, 10, 11, 9], [0, 3, 7, 9, 5, 1], [2, 4, 8, 11, 10, 6]] }, t[8] = { vertex: [[-0.729665, 0.670121, 0.319155], [-0.655235, -0.29213, -0.754096], [-0.093922, -0.607123, 0.537818], [0.702196, 0.595691, 0.485187], [0.776626, -0.36656, -0.588064]], face: [[1, 4, 2], [0, 1, 2], [3, 0, 2], [4, 3, 2], [4, 1, 0, 3]] }, t[9] = { vertex: [[-0.868849, -0.100041, 0.61257], [-0.329458, 0.976099, 0.28078], [-0.26629, -0.013796, -0.477654], [-0.13392, -1.034115, 0.229829], [0.738834, 0.707117, -0.307018], [0.859683, -0.535264, -0.338508]], face: [[3, 0, 2], [5, 3, 2], [4, 5, 2], [1, 4, 2], [0, 1, 2], [0, 3, 5, 4, 1]] }, t[10] = { vertex: [[-0.610389, 0.243975, 0.531213], [-0.187812, -0.48795, -0.664016], [-0.187812, 0.9759, -0.664016], [0.187812, -0.9759, 0.664016], [0.798201, 0.243975, 0.132803]], face: [[1, 3, 0], [3, 4, 0], [3, 1, 4], [0, 2, 1], [0, 4, 2], [2, 4, 1]] }, t[11] = { vertex: [[-1.028778, 0.392027, -0.048786], [-0.640503, -0.646161, 0.621837], [-0.125162, -0.395663, -0.540059], [4683e-6, 0.888447, -0.651988], [0.125161, 0.395663, 0.540059], [0.632925, -0.791376, 0.433102], [1.031672, 0.157063, -0.354165]], face: [[3, 2, 0], [2, 1, 0], [2, 5, 1], [0, 4, 3], [0, 1, 4], [4, 1, 5], [2, 3, 6], [3, 4, 6], [5, 2, 6], [4, 5, 6]] }, t[12] = { vertex: [[-0.669867, 0.334933, -0.529576], [-0.669867, 0.334933, 0.529577], [-0.4043, 1.212901, 0], [-0.334933, -0.669867, -0.529576], [-0.334933, -0.669867, 0.529577], [0.334933, 0.669867, -0.529576], [0.334933, 0.669867, 0.529577], [0.4043, -1.212901, 0], [0.669867, -0.334933, -0.529576], [0.669867, -0.334933, 0.529577]], face: [[8, 9, 7], [6, 5, 2], [3, 8, 7], [5, 0, 2], [4, 3, 7], [0, 1, 2], [9, 4, 7], [1, 6, 2], [9, 8, 5, 6], [8, 3, 0, 5], [3, 4, 1, 0], [4, 9, 6, 1]] }, t[13] = { vertex: [[-0.931836, 0.219976, -0.264632], [-0.636706, 0.318353, 0.692816], [-0.613483, -0.735083, -0.264632], [-0.326545, 0.979634, 0], [-0.318353, -0.636706, 0.692816], [-0.159176, 0.477529, -0.856368], [0.159176, -0.477529, -0.856368], [0.318353, 0.636706, 0.692816], [0.326545, -0.979634, 0], [0.613482, 0.735082, -0.264632], [0.636706, -0.318353, 0.692816], [0.931835, -0.219977, -0.264632]], face: [[11, 10, 8], [7, 9, 3], [6, 11, 8], [9, 5, 3], [2, 6, 8], [5, 0, 3], [4, 2, 8], [0, 1, 3], [10, 4, 8], [1, 7, 3], [10, 11, 9, 7], [11, 6, 5, 9], [6, 2, 0, 5], [2, 4, 1, 0], [4, 10, 7, 1]] }, t[14] = { vertex: [[-0.93465, 0.300459, -0.271185], [-0.838689, -0.260219, -0.516017], [-0.711319, 0.717591, 0.128359], [-0.710334, -0.156922, 0.080946], [-0.599799, 0.556003, -0.725148], [-0.503838, -4675e-6, -0.969981], [-0.487004, 0.26021, 0.48049], [-0.460089, -0.750282, -0.512622], [-0.376468, 0.973135, -0.325605], [-0.331735, -0.646985, 0.084342], [-0.254001, 0.831847, 0.530001], [-0.125239, -0.494738, -0.966586], [0.029622, 0.027949, 0.730817], [0.056536, -0.982543, -0.262295], [0.08085, 1.087391, 0.076037], [0.125583, -0.532729, 0.485984], [0.262625, 0.599586, 0.780328], [0.391387, -0.726999, -0.716259], [0.513854, -0.868287, 0.139347], [0.597475, 0.85513, 0.326364], [0.641224, 0.109523, 0.783723], [0.737185, -0.451155, 0.538891], [0.848705, -0.612742, -0.314616], [0.976075, 0.365067, 0.32976], [1.072036, -0.19561, 0.084927]], face: [[15, 18, 21], [12, 20, 16], [6, 10, 2], [3, 0, 1], [9, 7, 13], [2, 8, 4, 0], [0, 4, 5, 1], [1, 5, 11, 7], [7, 11, 17, 13], [13, 17, 22, 18], [18, 22, 24, 21], [21, 24, 23, 20], [20, 23, 19, 16], [16, 19, 14, 10], [10, 14, 8, 2], [15, 9, 13, 18], [12, 15, 21, 20], [6, 12, 16, 10], [3, 6, 2, 0], [9, 3, 1, 7], [9, 15, 12, 6, 3], [22, 17, 11, 5, 4, 8, 14, 19, 23, 24]] };
+ var e, n, i, o, a, s, p = r.type && (r.type < 0 || r.type >= t.length) ? 0 : r.type || 0, m = r.size, S = r.sizeX || m || 1, O = r.sizeY || m || 1, I = r.sizeZ || m || 1, G = r.custom || t[p], k = G.face.length, K = r.faceUV || new Array(k), re = r.faceColors, se = r.flat === void 0 || r.flat, ue = r.sideOrientation === 0 ? 0 : r.sideOrientation || ft.a.DEFAULTSIDE, he = new Array(), pe = new Array(), ve = new Array(), Ee = new Array(), Ae = new Array(), Ie = 0, xe = 0, Pe = new Array(), Ce = 0, Fe = 0;
+ if (se)
+ for (Fe = 0; Fe < k; Fe++)
+ re && re[Fe] === void 0 && (re[Fe] = new C.b(1, 1, 1, 1)), K && K[Fe] === void 0 && (K[Fe] = new c.f(0, 0, 1, 1));
+ if (se)
+ for (Fe = 0; Fe < k; Fe++) {
+ var Oe = G.face[Fe].length;
+ for (i = 2 * Math.PI / Oe, o = 0.5 * Math.tan(i / 2), a = 0.5, Ce = 0; Ce < Oe; Ce++)
+ he.push(G.vertex[G.face[Fe][Ce]][0] * S, G.vertex[G.face[Fe][Ce]][1] * O, G.vertex[G.face[Fe][Ce]][2] * I), Pe.push(Ie), Ie++, e = K[Fe].x + (K[Fe].z - K[Fe].x) * (0.5 + o), n = K[Fe].y + (K[Fe].w - K[Fe].y) * (a - 0.5), Ee.push(e, n), s = o * Math.cos(i) - a * Math.sin(i), a = o * Math.sin(i) + a * Math.cos(i), o = s, re && Ae.push(re[Fe].r, re[Fe].g, re[Fe].b, re[Fe].a);
+ for (Ce = 0; Ce < Oe - 2; Ce++)
+ pe.push(Pe[0 + xe], Pe[Ce + 2 + xe], Pe[Ce + 1 + xe]);
+ xe += Oe;
+ }
+ else {
+ for (Ce = 0; Ce < G.vertex.length; Ce++)
+ he.push(G.vertex[Ce][0] * S, G.vertex[Ce][1] * O, G.vertex[Ce][2] * I), Ee.push(0, 0);
+ for (Fe = 0; Fe < k; Fe++)
+ for (Ce = 0; Ce < G.face[Fe].length - 2; Ce++)
+ pe.push(G.face[Fe][0], G.face[Fe][Ce + 2], G.face[Fe][Ce + 1]);
+ }
+ ft.a.ComputeNormals(he, pe, ve), ft.a._ComputeSides(ue, he, pe, ve, Ee, r.frontUVs, r.backUVs);
+ var Be = new ft.a();
+ return Be.positions = he, Be.indices = pe, Be.normals = ve, Be.uvs = Ee, re && se && (Be.colors = Ae), Be;
+ }, we.a.CreatePolyhedron = function(r, t, e) {
+ return Ta.CreatePolyhedron(r, t, e);
+ };
+ var Ta = function() {
+ function r() {
+ }
+ return r.CreatePolyhedron = function(t, e, n) {
+ n === void 0 && (n = null);
+ var i = new we.a(t, n);
+ return e.sideOrientation = we.a._GetDefaultSideOrientation(e.sideOrientation), i._originalBuilderSideOrientation = e.sideOrientation, ft.a.CreatePolyhedron(e).applyToMesh(i, e.updatable), i;
+ }, r;
+ }(), ff = function(r) {
+ function t(e, n, i) {
+ e === void 0 && (e = Gn.a.DefaultUtilityLayer), n === void 0 && (n = 1);
+ var o = r.call(this, e) || this;
+ return o._meshAttached = null, o._nodeAttached = null, o._sensitivity = 1, o._observables = [], o._gizmoAxisCache = /* @__PURE__ */ new Map(), o.onDragStartObservable = new P.c(), o.onDragEndObservable = new P.c(), o.uniformScaleGizmo = o._createUniformScaleMesh(), o.xGizmo = new Ea(new c.e(1, 0, 0), C.a.Red().scale(0.5), e, o, n), o.yGizmo = new Ea(new c.e(0, 1, 0), C.a.Green().scale(0.5), e, o, n), o.zGizmo = new Ea(new c.e(0, 0, 1), C.a.Blue().scale(0.5), e, o, n), [o.xGizmo, o.yGizmo, o.zGizmo, o.uniformScaleGizmo].forEach(function(a) {
+ a.dragBehavior.onDragStartObservable.add(function() {
+ o.onDragStartObservable.notifyObservers({});
+ }), a.dragBehavior.onDragEndObservable.add(function() {
+ o.onDragEndObservable.notifyObservers({});
+ });
+ }), o.attachedMesh = null, o.attachedNode = null, i ? i.addToAxisCache(o._gizmoAxisCache) : Kn.a.GizmoAxisPointerObserver(e, o._gizmoAxisCache), o;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "attachedMesh", { get: function() {
+ return this._meshAttached;
+ }, set: function(e) {
+ this._meshAttached = e, this._nodeAttached = e, [this.xGizmo, this.yGizmo, this.zGizmo, this.uniformScaleGizmo].forEach(function(n) {
+ n.isEnabled ? n.attachedMesh = e : n.attachedMesh = null;
+ });
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "attachedNode", { get: function() {
+ return this._nodeAttached;
+ }, set: function(e) {
+ this._meshAttached = null, this._nodeAttached = e, [this.xGizmo, this.yGizmo, this.zGizmo, this.uniformScaleGizmo].forEach(function(n) {
+ n.isEnabled ? n.attachedNode = e : n.attachedNode = null;
+ });
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "isHovered", { get: function() {
+ var e = !1;
+ return [this.xGizmo, this.yGizmo, this.zGizmo].forEach(function(n) {
+ e = e || n.isHovered;
+ }), e;
+ }, enumerable: !1, configurable: !0 }), t.prototype._createUniformScaleMesh = function() {
+ this._coloredMaterial = new kt.a("", this.gizmoLayer.utilityLayerScene), this._coloredMaterial.diffuseColor = C.a.Gray(), this._hoverMaterial = new kt.a("", this.gizmoLayer.utilityLayerScene), this._hoverMaterial.diffuseColor = C.a.Yellow(), this._disableMaterial = new kt.a("", this.gizmoLayer.utilityLayerScene), this._disableMaterial.diffuseColor = C.a.Gray(), this._disableMaterial.alpha = 0.4;
+ var e = new Ea(new c.e(0, 1, 0), C.a.Gray().scale(0.5), this.gizmoLayer, this);
+ e.updateGizmoRotationToMatchAttachedMesh = !1, e.uniformScaling = !0, this._uniformScalingMesh = Ta.CreatePolyhedron("uniform", { type: 1 }, e.gizmoLayer.utilityLayerScene), this._uniformScalingMesh.scaling.scaleInPlace(0.01), this._uniformScalingMesh.visibility = 0, this._octahedron = Ta.CreatePolyhedron("", { type: 1 }, e.gizmoLayer.utilityLayerScene), this._octahedron.scaling.scaleInPlace(7e-3), this._uniformScalingMesh.addChild(this._octahedron), e.setCustomMesh(this._uniformScalingMesh, !0);
+ var n = this.gizmoLayer._getSharedGizmoLight();
+ n.includedOnlyMeshes = n.includedOnlyMeshes.concat(this._octahedron);
+ var i = { gizmoMeshes: [this._octahedron, this._uniformScalingMesh], colliderMeshes: [this._uniformScalingMesh], material: this._coloredMaterial, hoverMaterial: this._hoverMaterial, disableMaterial: this._disableMaterial, active: !1 };
+ return this.addToAxisCache(e._rootMesh, i), e;
+ }, Object.defineProperty(t.prototype, "updateGizmoRotationToMatchAttachedMesh", { get: function() {
+ return this._updateGizmoRotationToMatchAttachedMesh;
+ }, set: function(e) {
+ e ? (this._updateGizmoRotationToMatchAttachedMesh = e, [this.xGizmo, this.yGizmo, this.zGizmo, this.uniformScaleGizmo].forEach(function(n) {
+ n && (n.updateGizmoRotationToMatchAttachedMesh = e);
+ })) : h.a.Warn("Setting updateGizmoRotationToMatchAttachedMesh = false on scaling gizmo is not supported.");
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "snapDistance", { get: function() {
+ return this._snapDistance;
+ }, set: function(e) {
+ this._snapDistance = e, [this.xGizmo, this.yGizmo, this.zGizmo, this.uniformScaleGizmo].forEach(function(n) {
+ n && (n.snapDistance = e);
+ });
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "scaleRatio", { get: function() {
+ return this._scaleRatio;
+ }, set: function(e) {
+ this._scaleRatio = e, [this.xGizmo, this.yGizmo, this.zGizmo, this.uniformScaleGizmo].forEach(function(n) {
+ n && (n.scaleRatio = e);
+ });
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "sensitivity", { get: function() {
+ return this._sensitivity;
+ }, set: function(e) {
+ this._sensitivity = e, [this.xGizmo, this.yGizmo, this.zGizmo, this.uniformScaleGizmo].forEach(function(n) {
+ n && (n.sensitivity = e);
+ });
+ }, enumerable: !1, configurable: !0 }), t.prototype.addToAxisCache = function(e, n) {
+ this._gizmoAxisCache.set(e, n);
+ }, t.prototype.dispose = function() {
+ var e = this;
+ [this.xGizmo, this.yGizmo, this.zGizmo, this.uniformScaleGizmo].forEach(function(n) {
+ n && n.dispose();
+ }), this._observables.forEach(function(n) {
+ e.gizmoLayer.utilityLayerScene.onPointerObservable.remove(n);
+ }), this.onDragStartObservable.clear(), this.onDragEndObservable.clear(), [this._uniformScalingMesh, this._octahedron].forEach(function(n) {
+ n && n.dispose();
+ }), [this._coloredMaterial, this._hoverMaterial, this._disableMaterial].forEach(function(n) {
+ n && n.dispose();
+ });
+ }, t;
+ }(Kn.a), Ob = function() {
+ function r(t, e, n, i) {
+ e === void 0 && (e = 1), n === void 0 && (n = Gn.a.DefaultUtilityLayer), i === void 0 && (i = Gn.a.DefaultKeepDepthUtilityLayer), this.scene = t, this.clearGizmoOnEmptyPointerEvent = !1, this.onAttachedToMeshObservable = new P.c(), this.onAttachedToNodeObservable = new P.c(), this._gizmosEnabled = { positionGizmo: !1, rotationGizmo: !1, scaleGizmo: !1, boundingBoxGizmo: !1 }, this._pointerObservers = [], this._attachedMesh = null, this._attachedNode = null, this._boundingBoxColor = C.a.FromHexString("#0984e3"), this._thickness = 1, this._gizmoAxisCache = /* @__PURE__ */ new Map(), this.boundingBoxDragBehavior = new _d(), this.attachableMeshes = null, this.attachableNodes = null, this.usePointerToAttachGizmos = !0, this._defaultUtilityLayer = n, this._defaultKeepDepthUtilityLayer = i, this._defaultKeepDepthUtilityLayer.utilityLayerScene.autoClearDepthAndStencil = !1, this._thickness = e, this.gizmos = { positionGizmo: null, rotationGizmo: null, scaleGizmo: null, boundingBoxGizmo: null };
+ var o = this._attachToMeshPointerObserver(t), a = Kn.a.GizmoAxisPointerObserver(this._defaultUtilityLayer, this._gizmoAxisCache);
+ this._pointerObservers = [o, a];
+ }
+ return Object.defineProperty(r.prototype, "keepDepthUtilityLayer", { get: function() {
+ return this._defaultKeepDepthUtilityLayer;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "utilityLayer", { get: function() {
+ return this._defaultUtilityLayer;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "isHovered", { get: function() {
+ var t = !1;
+ for (var e in this.gizmos) {
+ var n = this.gizmos[e];
+ if (n && n.isHovered) {
+ t = !0;
+ break;
+ }
+ }
+ return t;
+ }, enumerable: !1, configurable: !0 }), r.prototype._attachToMeshPointerObserver = function(t) {
+ var e = this;
+ return t.onPointerObservable.add(function(n) {
+ if (e.usePointerToAttachGizmos && n.type == Et.a.POINTERDOWN)
+ if (n.pickInfo && n.pickInfo.pickedMesh) {
+ var i = n.pickInfo.pickedMesh;
+ if (e.attachableMeshes == null)
+ for (; i && i.parent != null; )
+ i = i.parent;
+ else {
+ var o = !1;
+ e.attachableMeshes.forEach(function(a) {
+ i && (i == a || i.isDescendantOf(a)) && (i = a, o = !0);
+ }), o || (i = null);
+ }
+ i instanceof Nt.a ? e._attachedMesh != i && e.attachToMesh(i) : e.clearGizmoOnEmptyPointerEvent && e.attachToMesh(null);
+ } else
+ e.clearGizmoOnEmptyPointerEvent && e.attachToMesh(null);
+ });
+ }, r.prototype.attachToMesh = function(t) {
+ for (var e in this._attachedMesh && this._attachedMesh.removeBehavior(this.boundingBoxDragBehavior), this._attachedNode && this._attachedNode.removeBehavior(this.boundingBoxDragBehavior), this._attachedMesh = t, this._attachedNode = null, this.gizmos) {
+ var n = this.gizmos[e];
+ n && this._gizmosEnabled[e] && (n.attachedMesh = t);
+ }
+ this.boundingBoxGizmoEnabled && this._attachedMesh && this._attachedMesh.addBehavior(this.boundingBoxDragBehavior), this.onAttachedToMeshObservable.notifyObservers(t);
+ }, r.prototype.attachToNode = function(t) {
+ for (var e in this._attachedMesh && this._attachedMesh.removeBehavior(this.boundingBoxDragBehavior), this._attachedNode && this._attachedNode.removeBehavior(this.boundingBoxDragBehavior), this._attachedMesh = null, this._attachedNode = t, this.gizmos) {
+ var n = this.gizmos[e];
+ n && this._gizmosEnabled[e] && (n.attachedNode = t);
+ }
+ this.boundingBoxGizmoEnabled && this._attachedNode && this._attachedNode.addBehavior(this.boundingBoxDragBehavior), this.onAttachedToNodeObservable.notifyObservers(t);
+ }, Object.defineProperty(r.prototype, "positionGizmoEnabled", { get: function() {
+ return this._gizmosEnabled.positionGizmo;
+ }, set: function(t) {
+ t ? (this.gizmos.positionGizmo || (this.gizmos.positionGizmo = new df(this._defaultUtilityLayer, this._thickness, this)), this._attachedNode ? this.gizmos.positionGizmo.attachedNode = this._attachedNode : this.gizmos.positionGizmo.attachedMesh = this._attachedMesh) : this.gizmos.positionGizmo && (this.gizmos.positionGizmo.attachedNode = null), this._gizmosEnabled.positionGizmo = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "rotationGizmoEnabled", { get: function() {
+ return this._gizmosEnabled.rotationGizmo;
+ }, set: function(t) {
+ t ? (this.gizmos.rotationGizmo || (this.gizmos.rotationGizmo = new hf(this._defaultUtilityLayer, 32, !1, this._thickness, this)), this._attachedNode ? this.gizmos.rotationGizmo.attachedNode = this._attachedNode : this.gizmos.rotationGizmo.attachedMesh = this._attachedMesh) : this.gizmos.rotationGizmo && (this.gizmos.rotationGizmo.attachedNode = null), this._gizmosEnabled.rotationGizmo = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "scaleGizmoEnabled", { get: function() {
+ return this._gizmosEnabled.scaleGizmo;
+ }, set: function(t) {
+ t ? (this.gizmos.scaleGizmo = this.gizmos.scaleGizmo || new ff(this._defaultUtilityLayer, this._thickness, this), this._attachedNode ? this.gizmos.scaleGizmo.attachedNode = this._attachedNode : this.gizmos.scaleGizmo.attachedMesh = this._attachedMesh) : this.gizmos.scaleGizmo && (this.gizmos.scaleGizmo.attachedNode = null), this._gizmosEnabled.scaleGizmo = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "boundingBoxGizmoEnabled", { get: function() {
+ return this._gizmosEnabled.boundingBoxGizmo;
+ }, set: function(t) {
+ t ? (this.gizmos.boundingBoxGizmo = this.gizmos.boundingBoxGizmo || new uf(this._boundingBoxColor, this._defaultKeepDepthUtilityLayer), this._attachedMesh ? this.gizmos.boundingBoxGizmo.attachedMesh = this._attachedMesh : this.gizmos.boundingBoxGizmo.attachedNode = this._attachedNode, this._attachedMesh ? (this._attachedMesh.removeBehavior(this.boundingBoxDragBehavior), this._attachedMesh.addBehavior(this.boundingBoxDragBehavior)) : this._attachedNode && (this._attachedNode.removeBehavior(this.boundingBoxDragBehavior), this._attachedNode.addBehavior(this.boundingBoxDragBehavior))) : this.gizmos.boundingBoxGizmo && (this._attachedMesh ? this._attachedMesh.removeBehavior(this.boundingBoxDragBehavior) : this._attachedNode && this._attachedNode.removeBehavior(this.boundingBoxDragBehavior), this.gizmos.boundingBoxGizmo.attachedNode = null), this._gizmosEnabled.boundingBoxGizmo = t;
+ }, enumerable: !1, configurable: !0 }), r.prototype.addToAxisCache = function(t) {
+ var e = this;
+ t.size > 0 && t.forEach(function(n, i) {
+ e._gizmoAxisCache.set(i, n);
+ });
+ }, r.prototype.dispose = function() {
+ var t = this;
+ for (var e in this._pointerObservers.forEach(function(i) {
+ t.scene.onPointerObservable.remove(i);
+ }), this.gizmos) {
+ var n = this.gizmos[e];
+ n && n.dispose();
+ }
+ this._defaultKeepDepthUtilityLayer.dispose(), this._defaultUtilityLayer.dispose(), this.boundingBoxDragBehavior.detach(), this.onAttachedToMeshObservable.clear();
+ }, r;
+ }(), or = l(48), Os = function(r) {
+ function t() {
+ var e = r !== null && r.apply(this, arguments) || this;
+ return e._needProjectionMatrixCompute = !0, e;
+ }
+ return Object(u.d)(t, r), t.prototype._setPosition = function(e) {
+ this._position = e;
+ }, Object.defineProperty(t.prototype, "position", { get: function() {
+ return this._position;
+ }, set: function(e) {
+ this._setPosition(e);
+ }, enumerable: !1, configurable: !0 }), t.prototype._setDirection = function(e) {
+ this._direction = e;
+ }, Object.defineProperty(t.prototype, "direction", { get: function() {
+ return this._direction;
+ }, set: function(e) {
+ this._setDirection(e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "shadowMinZ", { get: function() {
+ return this._shadowMinZ;
+ }, set: function(e) {
+ this._shadowMinZ = e, this.forceProjectionMatrixCompute();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "shadowMaxZ", { get: function() {
+ return this._shadowMaxZ;
+ }, set: function(e) {
+ this._shadowMaxZ = e, this.forceProjectionMatrixCompute();
+ }, enumerable: !1, configurable: !0 }), t.prototype.computeTransformedInformation = function() {
+ return !(!this.parent || !this.parent.getWorldMatrix) && (this.transformedPosition || (this.transformedPosition = c.e.Zero()), c.e.TransformCoordinatesToRef(this.position, this.parent.getWorldMatrix(), this.transformedPosition), this.direction && (this.transformedDirection || (this.transformedDirection = c.e.Zero()), c.e.TransformNormalToRef(this.direction, this.parent.getWorldMatrix(), this.transformedDirection)), !0);
+ }, t.prototype.getDepthScale = function() {
+ return 50;
+ }, t.prototype.getShadowDirection = function(e) {
+ return this.transformedDirection ? this.transformedDirection : this.direction;
+ }, t.prototype.getAbsolutePosition = function() {
+ return this.transformedPosition ? this.transformedPosition : this.position;
+ }, t.prototype.setDirectionToTarget = function(e) {
+ return this.direction = c.e.Normalize(e.subtract(this.position)), this.direction;
+ }, t.prototype.getRotation = function() {
+ this.direction.normalize();
+ var e = c.e.Cross(this.direction, Se.a.Y), n = c.e.Cross(e, this.direction);
+ return c.e.RotationFromAxis(e, n, this.direction);
+ }, t.prototype.needCube = function() {
+ return !1;
+ }, t.prototype.needProjectionMatrixCompute = function() {
+ return this._needProjectionMatrixCompute;
+ }, t.prototype.forceProjectionMatrixCompute = function() {
+ this._needProjectionMatrixCompute = !0;
+ }, t.prototype._initCache = function() {
+ r.prototype._initCache.call(this), this._cache.position = c.e.Zero();
+ }, t.prototype._isSynchronized = function() {
+ return !!this._cache.position.equals(this.position);
+ }, t.prototype.computeWorldMatrix = function(e) {
+ return !e && this.isSynchronized() ? (this._currentRenderId = this.getScene().getRenderId(), this._worldMatrix) : (this._updateCache(), this._cache.position.copyFrom(this.position), this._worldMatrix || (this._worldMatrix = c.a.Identity()), c.a.TranslationToRef(this.position.x, this.position.y, this.position.z, this._worldMatrix), this.parent && this.parent.getWorldMatrix && (this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._worldMatrix), this._markSyncedWithParent()), this._worldMatrixDeterminantIsDirty = !0, this._worldMatrix);
+ }, t.prototype.getDepthMinZ = function(e) {
+ return this.shadowMinZ !== void 0 ? this.shadowMinZ : e.minZ;
+ }, t.prototype.getDepthMaxZ = function(e) {
+ return this.shadowMaxZ !== void 0 ? this.shadowMaxZ : e.maxZ;
+ }, t.prototype.setShadowProjectionMatrix = function(e, n, i) {
+ return this.customProjectionMatrixBuilder ? this.customProjectionMatrixBuilder(n, i, e) : this._setDefaultShadowProjectionMatrix(e, n, i), this;
+ }, Object(u.c)([Object(w.o)()], t.prototype, "position", null), Object(u.c)([Object(w.o)()], t.prototype, "direction", null), Object(u.c)([Object(w.c)()], t.prototype, "shadowMinZ", null), Object(u.c)([Object(w.c)()], t.prototype, "shadowMaxZ", null), t;
+ }(or.a);
+ q.a.AddNodeConstructor("Light_Type_1", function(r, t) {
+ return function() {
+ return new Il(r, c.e.Zero(), t);
+ };
+ });
+ var Il = function(r) {
+ function t(e, n, i) {
+ var o = r.call(this, e, i) || this;
+ return o._shadowFrustumSize = 0, o._shadowOrthoScale = 0.1, o.autoUpdateExtends = !0, o.autoCalcShadowZBounds = !1, o._orthoLeft = Number.MAX_VALUE, o._orthoRight = Number.MIN_VALUE, o._orthoTop = Number.MIN_VALUE, o._orthoBottom = Number.MAX_VALUE, o.position = n.scale(-1), o.direction = n, o;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "shadowFrustumSize", { get: function() {
+ return this._shadowFrustumSize;
+ }, set: function(e) {
+ this._shadowFrustumSize = e, this.forceProjectionMatrixCompute();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "shadowOrthoScale", { get: function() {
+ return this._shadowOrthoScale;
+ }, set: function(e) {
+ this._shadowOrthoScale = e, this.forceProjectionMatrixCompute();
+ }, enumerable: !1, configurable: !0 }), t.prototype.getClassName = function() {
+ return "DirectionalLight";
+ }, t.prototype.getTypeID = function() {
+ return or.a.LIGHTTYPEID_DIRECTIONALLIGHT;
+ }, t.prototype._setDefaultShadowProjectionMatrix = function(e, n, i) {
+ this.shadowFrustumSize > 0 ? this._setDefaultFixedFrustumShadowProjectionMatrix(e) : this._setDefaultAutoExtendShadowProjectionMatrix(e, n, i);
+ }, t.prototype._setDefaultFixedFrustumShadowProjectionMatrix = function(e) {
+ var n = this.getScene().activeCamera;
+ n && c.a.OrthoLHToRef(this.shadowFrustumSize, this.shadowFrustumSize, this.shadowMinZ !== void 0 ? this.shadowMinZ : n.minZ, this.shadowMaxZ !== void 0 ? this.shadowMaxZ : n.maxZ, e);
+ }, t.prototype._setDefaultAutoExtendShadowProjectionMatrix = function(e, n, i) {
+ var o = this.getScene().activeCamera;
+ if (o) {
+ if (this.autoUpdateExtends || this._orthoLeft === Number.MAX_VALUE) {
+ var a = c.e.Zero();
+ this._orthoLeft = Number.MAX_VALUE, this._orthoRight = Number.MIN_VALUE, this._orthoTop = Number.MIN_VALUE, this._orthoBottom = Number.MAX_VALUE;
+ for (var s = Number.MAX_VALUE, p = Number.MIN_VALUE, m = 0; m < i.length; m++) {
+ var S = i[m];
+ if (S)
+ for (var O = S.getBoundingInfo().boundingBox, I = 0; I < O.vectorsWorld.length; I++)
+ c.e.TransformCoordinatesToRef(O.vectorsWorld[I], n, a), a.x < this._orthoLeft && (this._orthoLeft = a.x), a.y < this._orthoBottom && (this._orthoBottom = a.y), a.x > this._orthoRight && (this._orthoRight = a.x), a.y > this._orthoTop && (this._orthoTop = a.y), this.autoCalcShadowZBounds && (a.z < s && (s = a.z), a.z > p && (p = a.z));
+ }
+ this.autoCalcShadowZBounds && (this._shadowMinZ = s, this._shadowMaxZ = p);
+ }
+ var G = this._orthoRight - this._orthoLeft, k = this._orthoTop - this._orthoBottom;
+ c.a.OrthoOffCenterLHToRef(this._orthoLeft - G * this.shadowOrthoScale, this._orthoRight + G * this.shadowOrthoScale, this._orthoBottom - k * this.shadowOrthoScale, this._orthoTop + k * this.shadowOrthoScale, this.shadowMinZ !== void 0 ? this.shadowMinZ : o.minZ, this.shadowMaxZ !== void 0 ? this.shadowMaxZ : o.maxZ, e);
+ }
+ }, t.prototype._buildUniformLayout = function() {
+ this._uniformBuffer.addUniform("vLightData", 4), this._uniformBuffer.addUniform("vLightDiffuse", 4), this._uniformBuffer.addUniform("vLightSpecular", 4), this._uniformBuffer.addUniform("shadowsInfo", 3), this._uniformBuffer.addUniform("depthValues", 2), this._uniformBuffer.create();
+ }, t.prototype.transferToEffect = function(e, n) {
+ return this.computeTransformedInformation() ? (this._uniformBuffer.updateFloat4("vLightData", this.transformedDirection.x, this.transformedDirection.y, this.transformedDirection.z, 1, n), this) : (this._uniformBuffer.updateFloat4("vLightData", this.direction.x, this.direction.y, this.direction.z, 1, n), this);
+ }, t.prototype.transferToNodeMaterialEffect = function(e, n) {
+ return this.computeTransformedInformation() ? (e.setFloat3(n, this.transformedDirection.x, this.transformedDirection.y, this.transformedDirection.z), this) : (e.setFloat3(n, this.direction.x, this.direction.y, this.direction.z), this);
+ }, t.prototype.getDepthMinZ = function(e) {
+ return 1;
+ }, t.prototype.getDepthMaxZ = function(e) {
+ return 1;
+ }, t.prototype.prepareLightSpecificDefines = function(e, n) {
+ e["DIRLIGHT" + n] = !0;
+ }, Object(u.c)([Object(w.c)()], t.prototype, "shadowFrustumSize", null), Object(u.c)([Object(w.c)()], t.prototype, "shadowOrthoScale", null), Object(u.c)([Object(w.c)()], t.prototype, "autoUpdateExtends", void 0), Object(u.c)([Object(w.c)()], t.prototype, "autoCalcShadowZBounds", void 0), t;
+ }(Os);
+ we.a.CreateHemisphere = function(r, t, e, n) {
+ var i = { segments: t, diameter: e };
+ return Ms.CreateHemisphere(r, i, n);
+ };
+ var Ms = function() {
+ function r() {
+ }
+ return r.CreateHemisphere = function(t, e, n) {
+ e.diameter || (e.diameter = 1), e.segments || (e.segments = 16);
+ var i = Qn.a.CreateSphere("", { slice: 0.5, diameter: e.diameter, segments: e.segments }, n), o = we.a.CreateDisc("", e.diameter / 2, 3 * e.segments + (4 - e.segments), n);
+ o.rotation.x = -Math.PI / 2, o.parent = i;
+ var a = we.a.MergeMeshes([o, i], !0);
+ return a.name = t, a;
+ }, r;
+ }();
+ q.a.AddNodeConstructor("Light_Type_2", function(r, t) {
+ return function() {
+ return new Dl(r, c.e.Zero(), c.e.Zero(), 0, 0, t);
+ };
+ });
+ var Dl = function(r) {
+ function t(e, n, i, o, a, s) {
+ var p = r.call(this, e, s) || this;
+ return p._innerAngle = 0, p._projectionTextureMatrix = c.a.Zero(), p._projectionTextureLightNear = 1e-6, p._projectionTextureLightFar = 1e3, p._projectionTextureUpDirection = c.e.Up(), p._projectionTextureViewLightDirty = !0, p._projectionTextureProjectionLightDirty = !0, p._projectionTextureDirty = !0, p._projectionTextureViewTargetVector = c.e.Zero(), p._projectionTextureViewLightMatrix = c.a.Zero(), p._projectionTextureProjectionLightMatrix = c.a.Zero(), p._projectionTextureScalingMatrix = c.a.FromValues(0.5, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0.5, 0, 0.5, 0.5, 0.5, 1), p.position = n, p.direction = i, p.angle = o, p.exponent = a, p;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "angle", { get: function() {
+ return this._angle;
+ }, set: function(e) {
+ this._angle = e, this._cosHalfAngle = Math.cos(0.5 * e), this._projectionTextureProjectionLightDirty = !0, this.forceProjectionMatrixCompute(), this._computeAngleValues();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "innerAngle", { get: function() {
+ return this._innerAngle;
+ }, set: function(e) {
+ this._innerAngle = e, this._computeAngleValues();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "shadowAngleScale", { get: function() {
+ return this._shadowAngleScale;
+ }, set: function(e) {
+ this._shadowAngleScale = e, this.forceProjectionMatrixCompute();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "projectionTextureMatrix", { get: function() {
+ return this._projectionTextureMatrix;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "projectionTextureLightNear", { get: function() {
+ return this._projectionTextureLightNear;
+ }, set: function(e) {
+ this._projectionTextureLightNear = e, this._projectionTextureProjectionLightDirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "projectionTextureLightFar", { get: function() {
+ return this._projectionTextureLightFar;
+ }, set: function(e) {
+ this._projectionTextureLightFar = e, this._projectionTextureProjectionLightDirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "projectionTextureUpDirection", { get: function() {
+ return this._projectionTextureUpDirection;
+ }, set: function(e) {
+ this._projectionTextureUpDirection = e, this._projectionTextureProjectionLightDirty = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "projectionTexture", { get: function() {
+ return this._projectionTexture;
+ }, set: function(e) {
+ var n = this;
+ this._projectionTexture !== e && (this._projectionTexture = e, this._projectionTextureDirty = !0, this._projectionTexture && !this._projectionTexture.isReady() && (t._IsProceduralTexture(this._projectionTexture) ? this._projectionTexture.getEffect().executeWhenCompiled(function() {
+ n._markMeshesAsLightDirty();
+ }) : t._IsTexture(this._projectionTexture) && this._projectionTexture.onLoadObservable.addOnce(function() {
+ n._markMeshesAsLightDirty();
+ })));
+ }, enumerable: !1, configurable: !0 }), t._IsProceduralTexture = function(e) {
+ return e.onGeneratedObservable !== void 0;
+ }, t._IsTexture = function(e) {
+ return e.onLoadObservable !== void 0;
+ }, t.prototype.getClassName = function() {
+ return "SpotLight";
+ }, t.prototype.getTypeID = function() {
+ return or.a.LIGHTTYPEID_SPOTLIGHT;
+ }, t.prototype._setDirection = function(e) {
+ r.prototype._setDirection.call(this, e), this._projectionTextureViewLightDirty = !0;
+ }, t.prototype._setPosition = function(e) {
+ r.prototype._setPosition.call(this, e), this._projectionTextureViewLightDirty = !0;
+ }, t.prototype._setDefaultShadowProjectionMatrix = function(e, n, i) {
+ var o = this.getScene().activeCamera;
+ if (o) {
+ this._shadowAngleScale = this._shadowAngleScale || 1;
+ var a = this._shadowAngleScale * this._angle;
+ c.a.PerspectiveFovLHToRef(a, 1, this.getDepthMinZ(o), this.getDepthMaxZ(o), e);
+ }
+ }, t.prototype._computeProjectionTextureViewLightMatrix = function() {
+ this._projectionTextureViewLightDirty = !1, this._projectionTextureDirty = !0, this.position.addToRef(this.direction, this._projectionTextureViewTargetVector), c.a.LookAtLHToRef(this.position, this._projectionTextureViewTargetVector, this._projectionTextureUpDirection, this._projectionTextureViewLightMatrix);
+ }, t.prototype._computeProjectionTextureProjectionLightMatrix = function() {
+ this._projectionTextureProjectionLightDirty = !1, this._projectionTextureDirty = !0;
+ var e = this.projectionTextureLightFar, n = this.projectionTextureLightNear, i = e / (e - n), o = -i * n, a = 1 / Math.tan(this._angle / 2);
+ c.a.FromValuesToRef(a / 1, 0, 0, 0, 0, a, 0, 0, 0, 0, i, 1, 0, 0, o, 0, this._projectionTextureProjectionLightMatrix);
+ }, t.prototype._computeProjectionTextureMatrix = function() {
+ if (this._projectionTextureDirty = !1, this._projectionTextureViewLightMatrix.multiplyToRef(this._projectionTextureProjectionLightMatrix, this._projectionTextureMatrix), this._projectionTexture instanceof Ue.a) {
+ var e = this._projectionTexture.uScale / 2, n = this._projectionTexture.vScale / 2;
+ c.a.FromValuesToRef(e, 0, 0, 0, 0, n, 0, 0, 0, 0, 0.5, 0, 0.5, 0.5, 0.5, 1, this._projectionTextureScalingMatrix);
+ }
+ this._projectionTextureMatrix.multiplyToRef(this._projectionTextureScalingMatrix, this._projectionTextureMatrix);
+ }, t.prototype._buildUniformLayout = function() {
+ this._uniformBuffer.addUniform("vLightData", 4), this._uniformBuffer.addUniform("vLightDiffuse", 4), this._uniformBuffer.addUniform("vLightSpecular", 4), this._uniformBuffer.addUniform("vLightDirection", 3), this._uniformBuffer.addUniform("vLightFalloff", 4), this._uniformBuffer.addUniform("shadowsInfo", 3), this._uniformBuffer.addUniform("depthValues", 2), this._uniformBuffer.create();
+ }, t.prototype._computeAngleValues = function() {
+ this._lightAngleScale = 1 / Math.max(1e-3, Math.cos(0.5 * this._innerAngle) - this._cosHalfAngle), this._lightAngleOffset = -this._cosHalfAngle * this._lightAngleScale;
+ }, t.prototype.transferTexturesToEffect = function(e, n) {
+ return this.projectionTexture && this.projectionTexture.isReady() && (this._projectionTextureViewLightDirty && this._computeProjectionTextureViewLightMatrix(), this._projectionTextureProjectionLightDirty && this._computeProjectionTextureProjectionLightMatrix(), this._projectionTextureDirty && this._computeProjectionTextureMatrix(), e.setMatrix("textureProjectionMatrix" + n, this._projectionTextureMatrix), e.setTexture("projectionLightSampler" + n, this.projectionTexture)), this;
+ }, t.prototype.transferToEffect = function(e, n) {
+ var i;
+ return this.computeTransformedInformation() ? (this._uniformBuffer.updateFloat4("vLightData", this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, this.exponent, n), i = c.e.Normalize(this.transformedDirection)) : (this._uniformBuffer.updateFloat4("vLightData", this.position.x, this.position.y, this.position.z, this.exponent, n), i = c.e.Normalize(this.direction)), this._uniformBuffer.updateFloat4("vLightDirection", i.x, i.y, i.z, this._cosHalfAngle, n), this._uniformBuffer.updateFloat4("vLightFalloff", this.range, this._inverseSquaredRange, this._lightAngleScale, this._lightAngleOffset, n), this;
+ }, t.prototype.transferToNodeMaterialEffect = function(e, n) {
+ var i;
+ return i = this.computeTransformedInformation() ? c.e.Normalize(this.transformedDirection) : c.e.Normalize(this.direction), this.getScene().useRightHandedSystem ? e.setFloat3(n, -i.x, -i.y, -i.z) : e.setFloat3(n, i.x, i.y, i.z), this;
+ }, t.prototype.dispose = function() {
+ r.prototype.dispose.call(this), this._projectionTexture && this._projectionTexture.dispose();
+ }, t.prototype.prepareLightSpecificDefines = function(e, n) {
+ e["SPOTLIGHT" + n] = !0, e["PROJECTEDLIGHTTEXTURE" + n] = !(!this.projectionTexture || !this.projectionTexture.isReady());
+ }, Object(u.c)([Object(w.c)()], t.prototype, "angle", null), Object(u.c)([Object(w.c)()], t.prototype, "innerAngle", null), Object(u.c)([Object(w.c)()], t.prototype, "shadowAngleScale", null), Object(u.c)([Object(w.c)()], t.prototype, "exponent", void 0), Object(u.c)([Object(w.c)()], t.prototype, "projectionTextureLightNear", null), Object(u.c)([Object(w.c)()], t.prototype, "projectionTextureLightFar", null), Object(u.c)([Object(w.c)()], t.prototype, "projectionTextureUpDirection", null), Object(u.c)([Object(w.m)("projectedLightTexture")], t.prototype, "_projectionTexture", void 0), t;
+ }(Os), Mb = function(r) {
+ function t(e) {
+ e === void 0 && (e = Gn.a.DefaultUtilityLayer);
+ var n = r.call(this, e) || this;
+ return n._cachedPosition = new c.e(), n._cachedForward = new c.e(0, 0, 1), n._pointerObserver = null, n.onClickedObservable = new P.c(), n._light = null, n.attachedMesh = new Nt.a("", n.gizmoLayer.utilityLayerScene), n._attachedMeshParent = new Ao.a("parent", n.gizmoLayer.utilityLayerScene), n.attachedMesh.parent = n._attachedMeshParent, n._material = new kt.a("light", n.gizmoLayer.utilityLayerScene), n._material.diffuseColor = new C.a(0.5, 0.5, 0.5), n._material.specularColor = new C.a(0.1, 0.1, 0.1), n._pointerObserver = e.utilityLayerScene.onPointerObservable.add(function(i) {
+ n._light && (n._isHovered = !(!i.pickInfo || n._rootMesh.getChildMeshes().indexOf(i.pickInfo.pickedMesh) == -1), n._isHovered && i.event.button === 0 && n.onClickedObservable.notifyObservers(n._light));
+ }, Et.a.POINTERDOWN), n;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "light", { get: function() {
+ return this._light;
+ }, set: function(e) {
+ var n = this;
+ if (this._light = e, e) {
+ this._lightMesh && this._lightMesh.dispose(), e instanceof vs.a ? this._lightMesh = t._CreateHemisphericLightMesh(this.gizmoLayer.utilityLayerScene) : this._lightMesh = e instanceof Il ? t._CreateDirectionalLightMesh(this.gizmoLayer.utilityLayerScene) : e instanceof Dl ? t._CreateSpotLightMesh(this.gizmoLayer.utilityLayerScene) : t._CreatePointLightMesh(this.gizmoLayer.utilityLayerScene), this._lightMesh.getChildMeshes(!1).forEach(function(o) {
+ o.material = n._material;
+ }), this._lightMesh.parent = this._rootMesh;
+ var i = this.gizmoLayer._getSharedGizmoLight();
+ i.includedOnlyMeshes = i.includedOnlyMeshes.concat(this._lightMesh.getChildMeshes(!1)), this._lightMesh.rotationQuaternion = new c.b(), this.attachedMesh.reservedDataStore || (this.attachedMesh.reservedDataStore = {}), this.attachedMesh.reservedDataStore.lightGizmo = this, e.parent && this._attachedMeshParent.freezeWorldMatrix(e.parent.getWorldMatrix()), e.position && (this.attachedMesh.position.copyFrom(e.position), this.attachedMesh.computeWorldMatrix(!0), this._cachedPosition.copyFrom(this.attachedMesh.position)), e.direction && (this.attachedMesh.setDirection(e.direction), this.attachedMesh.computeWorldMatrix(!0), this._cachedForward.copyFrom(this.attachedMesh.forward)), this._update();
+ }
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "material", { get: function() {
+ return this._material;
+ }, enumerable: !1, configurable: !0 }), t.prototype._update = function() {
+ r.prototype._update.call(this), this._light && (this._light.parent && this._attachedMeshParent.freezeWorldMatrix(this._light.parent.getWorldMatrix()), this._light.position && (this.attachedMesh.position.equals(this._cachedPosition) ? (this.attachedMesh.position.copyFrom(this._light.position), this.attachedMesh.computeWorldMatrix(!0), this._cachedPosition.copyFrom(this.attachedMesh.position)) : (this._light.position.copyFrom(this.attachedMesh.position), this._cachedPosition.copyFrom(this.attachedMesh.position))), this._light.direction && (c.e.DistanceSquared(this.attachedMesh.forward, this._cachedForward) > 1e-4 ? (this._light.direction.copyFrom(this.attachedMesh.forward), this._cachedForward.copyFrom(this.attachedMesh.forward)) : c.e.DistanceSquared(this.attachedMesh.forward, this._light.direction) > 1e-4 && (this.attachedMesh.setDirection(this._light.direction), this.attachedMesh.computeWorldMatrix(!0), this._cachedForward.copyFrom(this.attachedMesh.forward))));
+ }, t.prototype.dispose = function() {
+ this.onClickedObservable.clear(), this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver), this._material.dispose(), r.prototype.dispose.call(this), this._attachedMeshParent.dispose();
+ }, t._CreateHemisphericLightMesh = function(e) {
+ var n = new we.a("hemisphereLight", e), i = Ms.CreateHemisphere(n.name, { segments: 10, diameter: 1 }, e);
+ i.position.z = -0.15, i.rotation.x = Math.PI / 2, i.parent = n;
+ var o = this._CreateLightLines(3, e);
+ return o.parent = n, o.position.z, n.scaling.scaleInPlace(t._Scale), n.rotation.x = Math.PI / 2, n;
+ }, t._CreatePointLightMesh = function(e) {
+ var n = new we.a("pointLight", e), i = Qn.a.CreateSphere(n.name, { segments: 10, diameter: 1 }, e);
+ return i.rotation.x = Math.PI / 2, i.parent = n, this._CreateLightLines(5, e).parent = n, n.scaling.scaleInPlace(t._Scale), n.rotation.x = Math.PI / 2, n;
+ }, t._CreateSpotLightMesh = function(e) {
+ var n = new we.a("spotLight", e);
+ Qn.a.CreateSphere(n.name, { segments: 10, diameter: 1 }, e).parent = n;
+ var i = Ms.CreateHemisphere(n.name, { segments: 10, diameter: 2 }, e);
+ return i.parent = n, i.rotation.x = -Math.PI / 2, this._CreateLightLines(2, e).parent = n, n.scaling.scaleInPlace(t._Scale), n.rotation.x = Math.PI / 2, n;
+ }, t._CreateDirectionalLightMesh = function(e) {
+ var n = new we.a("directionalLight", e), i = new we.a(n.name, e);
+ i.parent = n, Qn.a.CreateSphere(n.name, { diameter: 1.2, segments: 10 }, e).parent = i;
+ var o = we.a.CreateCylinder(n.name, 6, 0.3, 0.3, 6, 1, e);
+ o.parent = i, (a = o.clone(n.name)).scaling.y = 0.5, a.position.x += 1.25, (s = o.clone(n.name)).scaling.y = 0.5, s.position.x += -1.25;
+ var a, s, p = we.a.CreateCylinder(n.name, 1, 0, 0.6, 6, 1, e);
+ return p.position.y += 3, p.parent = i, (a = p.clone(n.name)).position.y = 1.5, a.position.x += 1.25, (s = p.clone(n.name)).position.y = 1.5, s.position.x += -1.25, i.scaling.scaleInPlace(t._Scale), i.rotation.z = Math.PI / 2, i.rotation.y = Math.PI / 2, n;
+ }, t._Scale = 7e-3, t._CreateLightLines = function(e, n) {
+ var i = new we.a("root", n);
+ i.rotation.x = Math.PI / 2;
+ var o = new we.a("linePivot", n);
+ o.parent = i;
+ var a = we.a.CreateCylinder("line", 2, 0.2, 0.3, 6, 1, n);
+ if (a.position.y = a.scaling.y / 2 + 1.2, a.parent = o, e < 2)
+ return o;
+ for (var s = 0; s < 4; s++)
+ (p = o.clone("lineParentClone")).rotation.z = Math.PI / 4, p.rotation.y = Math.PI / 2 + Math.PI / 2 * s, p.getChildMeshes()[0].scaling.y = 0.5, p.getChildMeshes()[0].scaling.x = p.getChildMeshes()[0].scaling.z = 0.8, p.getChildMeshes()[0].position.y = p.getChildMeshes()[0].scaling.y / 2 + 1.2;
+ if (e < 3)
+ return i;
+ for (s = 0; s < 4; s++)
+ (p = o.clone("linePivotClone")).rotation.z = Math.PI / 2, p.rotation.y = Math.PI / 2 * s;
+ if (e < 4)
+ return i;
+ for (s = 0; s < 4; s++) {
+ var p;
+ (p = o.clone("linePivotClone")).rotation.z = Math.PI + Math.PI / 4, p.rotation.y = Math.PI / 2 + Math.PI / 2 * s, p.getChildMeshes()[0].scaling.y = 0.5, p.getChildMeshes()[0].scaling.x = p.getChildMeshes()[0].scaling.z = 0.8, p.getChildMeshes()[0].position.y = p.getChildMeshes()[0].scaling.y / 2 + 1.2;
+ }
+ return e < 5 || ((p = o.clone("linePivotClone")).rotation.z = Math.PI), i;
+ }, t;
+ }(Kn.a), Ll = function() {
+ function r(t, e) {
+ t === void 0 && (t = c.e.Zero()), e === void 0 && (e = c.e.Up()), this.position = t, this.normal = e;
+ }
+ return r.prototype.clone = function() {
+ return new r(this.position.clone(), this.normal.clone());
+ }, r;
+ }(), Ib = function() {
+ function r(t, e, n) {
+ t === void 0 && (t = c.e.Zero()), e === void 0 && (e = c.e.Up()), n === void 0 && (n = c.d.Zero()), this.position = t, this.normal = e, this.uv = n;
+ }
+ return r.prototype.clone = function() {
+ return new r(this.position.clone(), this.normal.clone(), this.uv.clone());
+ }, r;
+ }(), Db = function(r) {
+ function t(e) {
+ e === void 0 && (e = Gn.a.DefaultUtilityLayer);
+ var n = r.call(this, e) || this;
+ return n._pointerObserver = null, n.onClickedObservable = new P.c(), n._camera = null, n._invProjection = new c.a(), n._material = new kt.a("cameraGizmoMaterial", n.gizmoLayer.utilityLayerScene), n._material.diffuseColor = new C.a(0.5, 0.5, 0.5), n._material.specularColor = new C.a(0.1, 0.1, 0.1), n._pointerObserver = e.utilityLayerScene.onPointerObservable.add(function(i) {
+ n._camera && (n._isHovered = !(!i.pickInfo || n._rootMesh.getChildMeshes().indexOf(i.pickInfo.pickedMesh) == -1), n._isHovered && i.event.button === 0 && n.onClickedObservable.notifyObservers(n._camera));
+ }, Et.a.POINTERDOWN), n;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "displayFrustum", { get: function() {
+ return this._cameraLinesMesh.isEnabled();
+ }, set: function(e) {
+ this._cameraLinesMesh.setEnabled(e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "camera", { get: function() {
+ return this._camera;
+ }, set: function(e) {
+ var n = this;
+ if (this._camera = e, this.attachedNode = e, e) {
+ this._cameraMesh && this._cameraMesh.dispose(), this._cameraLinesMesh && this._cameraLinesMesh.dispose(), this._cameraMesh = t._CreateCameraMesh(this.gizmoLayer.utilityLayerScene), this._cameraLinesMesh = t._CreateCameraFrustum(this.gizmoLayer.utilityLayerScene), this._cameraMesh.getChildMeshes(!1).forEach(function(o) {
+ o.material = n._material;
+ }), this._cameraMesh.parent = this._rootMesh, this._cameraLinesMesh.parent = this._rootMesh, this.gizmoLayer.utilityLayerScene.activeCamera && this.gizmoLayer.utilityLayerScene.activeCamera.maxZ < 1.5 * e.maxZ && (this.gizmoLayer.utilityLayerScene.activeCamera.maxZ = 1.5 * e.maxZ), this.attachedNode.reservedDataStore || (this.attachedNode.reservedDataStore = {}), this.attachedNode.reservedDataStore.cameraGizmo = this;
+ var i = this.gizmoLayer._getSharedGizmoLight();
+ i.includedOnlyMeshes = i.includedOnlyMeshes.concat(this._cameraMesh.getChildMeshes(!1)), this._update();
+ }
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "material", { get: function() {
+ return this._material;
+ }, enumerable: !1, configurable: !0 }), t.prototype._update = function() {
+ r.prototype._update.call(this), this._camera && (this._camera.getProjectionMatrix().invertToRef(this._invProjection), this._cameraLinesMesh.setPivotMatrix(this._invProjection, !1), this._cameraLinesMesh.scaling.x = 1 / this._rootMesh.scaling.x, this._cameraLinesMesh.scaling.y = 1 / this._rootMesh.scaling.y, this._cameraLinesMesh.scaling.z = 1 / this._rootMesh.scaling.z, this._cameraMesh.parent = null, this._cameraMesh.rotation.y = 0.5 * Math.PI * (this._camera.getScene().useRightHandedSystem ? 1 : -1), this._cameraMesh.parent = this._rootMesh);
+ }, t.prototype.dispose = function() {
+ this.onClickedObservable.clear(), this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver), this._cameraMesh && this._cameraMesh.dispose(), this._cameraLinesMesh && this._cameraLinesMesh.dispose(), this._material.dispose(), r.prototype.dispose.call(this);
+ }, t._CreateCameraMesh = function(e) {
+ var n = new we.a("rootCameraGizmo", e), i = new we.a(n.name, e);
+ i.parent = n, So.a.CreateBox(n.name, { width: 1, height: 0.8, depth: 0.5 }, e).parent = i;
+ var o = Vi.a.CreateCylinder(n.name, { height: 0.5, diameterTop: 0.8, diameterBottom: 0.8 }, e);
+ o.parent = i, o.position.y = 0.3, o.position.x = -0.6, o.rotation.x = 0.5 * Math.PI;
+ var a = Vi.a.CreateCylinder(n.name, { height: 0.5, diameterTop: 0.6, diameterBottom: 0.6 }, e);
+ a.parent = i, a.position.y = 0.5, a.position.x = 0.4, a.rotation.x = 0.5 * Math.PI;
+ var s = Vi.a.CreateCylinder(n.name, { height: 0.5, diameterTop: 0.5, diameterBottom: 0.5 }, e);
+ return s.parent = i, s.position.y = 0, s.position.x = 0.6, s.rotation.z = 0.5 * Math.PI, n.scaling.scaleInPlace(t._Scale), i.position.x = -0.9, n;
+ }, t._CreateCameraFrustum = function(e) {
+ var n = new we.a("rootCameraGizmo", e), i = new we.a(n.name, e);
+ i.parent = n;
+ for (var o = 0; o < 4; o += 2)
+ for (var a = 0; a < 4; a += 2) {
+ var s;
+ (s = yn.a.CreateLines("lines", { points: [new c.e(-1 + a, -1 + o, -1), new c.e(-1 + a, -1 + o, 1)] }, e)).parent = i, s.alwaysSelectAsActiveMesh = !0, s.isPickable = !1, (s = yn.a.CreateLines("lines", { points: [new c.e(-1, -1 + a, -1 + o), new c.e(1, -1 + a, -1 + o)] }, e)).parent = i, s.alwaysSelectAsActiveMesh = !0, s.isPickable = !1, (s = yn.a.CreateLines("lines", { points: [new c.e(-1 + a, -1, -1 + o), new c.e(-1 + a, 1, -1 + o)] }, e)).parent = i, s.alwaysSelectAsActiveMesh = !0, s.isPickable = !1;
+ }
+ return n;
+ }, t._Scale = 0.05, t;
+ }(Kn.a);
+ We.a.IncludesShadersStore.kernelBlurVaryingDeclaration = "varying vec2 sampleCoord{X};";
+ var Lb = `vec4 pack(float depth)
+{
+const vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);
+const vec4 bit_mask=vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);
+vec4 res=fract(depth*bit_shift);
+res-=res.xxyz*bit_mask;
+return res;
+}
+float unpack(vec4 color)
+{
+const vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);
+return dot(color,bit_shift);
+}`;
+ We.a.IncludesShadersStore.packingFunctions = Lb;
+ var wb = `#ifdef DOF
+factor=sampleCoC(sampleCoord{X});
+computedWeight=KERNEL_WEIGHT{X}*factor;
+sumOfWeights+=computedWeight;
+#else
+computedWeight=KERNEL_WEIGHT{X};
+#endif
+#ifdef PACKEDFLOAT
+blend+=unpack(texture2D(textureSampler,sampleCoord{X}))*computedWeight;
+#else
+blend+=texture2D(textureSampler,sampleCoord{X})*computedWeight;
+#endif`;
+ We.a.IncludesShadersStore.kernelBlurFragment = wb;
+ var Nb = `#ifdef DOF
+factor=sampleCoC(sampleCenter+delta*KERNEL_DEP_OFFSET{X});
+computedWeight=KERNEL_DEP_WEIGHT{X}*factor;
+sumOfWeights+=computedWeight;
+#else
+computedWeight=KERNEL_DEP_WEIGHT{X};
+#endif
+#ifdef PACKEDFLOAT
+blend+=unpack(texture2D(textureSampler,sampleCenter+delta*KERNEL_DEP_OFFSET{X}))*computedWeight;
+#else
+blend+=texture2D(textureSampler,sampleCenter+delta*KERNEL_DEP_OFFSET{X})*computedWeight;
+#endif`;
+ We.a.IncludesShadersStore.kernelBlurFragment2 = Nb;
+ var Fb = `
+uniform sampler2D textureSampler;
+uniform vec2 delta;
+
+varying vec2 sampleCenter;
+#ifdef DOF
+uniform sampler2D circleOfConfusionSampler;
+uniform vec2 cameraMinMaxZ;
+float sampleDistance(const in vec2 offset) {
+float depth=texture2D(circleOfConfusionSampler,offset).g;
+return cameraMinMaxZ.x+(cameraMinMaxZ.y-cameraMinMaxZ.x)*depth;
+}
+float sampleCoC(const in vec2 offset) {
+float coc=texture2D(circleOfConfusionSampler,offset).r;
+return coc;
+}
+#endif
+#include[0..varyingCount]
+#ifdef PACKEDFLOAT
+#include
+#endif
+void main(void)
+{
+float computedWeight=0.0;
+#ifdef PACKEDFLOAT
+float blend=0.;
+#else
+vec4 blend=vec4(0.);
+#endif
+#ifdef DOF
+float sumOfWeights=CENTER_WEIGHT;
+float factor=0.0;
+
+#ifdef PACKEDFLOAT
+blend+=unpack(texture2D(textureSampler,sampleCenter))*CENTER_WEIGHT;
+#else
+blend+=texture2D(textureSampler,sampleCenter)*CENTER_WEIGHT;
+#endif
+#endif
+#include[0..varyingCount]
+#include[0..depCount]
+#ifdef PACKEDFLOAT
+gl_FragColor=pack(blend);
+#else
+gl_FragColor=blend;
+#endif
+#ifdef DOF
+gl_FragColor/=sumOfWeights;
+#endif
+}`;
+ We.a.ShadersStore.kernelBlurPixelShader = Fb, We.a.IncludesShadersStore.kernelBlurVertex = "sampleCoord{X}=sampleCenter+delta*KERNEL_OFFSET{X};";
+ var Bb = `
+attribute vec2 position;
+
+uniform vec2 delta;
+
+varying vec2 sampleCenter;
+#include[0..varyingCount]
+const vec2 madd=vec2(0.5,0.5);
+void main(void) {
+sampleCenter=(position*madd+madd);
+#include[0..varyingCount]
+gl_Position=vec4(position,0.0,1.0);
+}`;
+ We.a.ShadersStore.kernelBlurVertexShader = Bb;
+ var xn = function(r) {
+ function t(e, n, i, o, a, s, p, m, S, O, I) {
+ s === void 0 && (s = Ue.a.BILINEAR_SAMPLINGMODE), S === void 0 && (S = d.a.TEXTURETYPE_UNSIGNED_INT), O === void 0 && (O = ""), I === void 0 && (I = !1);
+ var G = r.call(this, e, "kernelBlur", ["delta", "direction", "cameraMinMaxZ"], ["circleOfConfusionSampler"], o, a, s, p, m, null, S, "kernelBlur", { varyingCount: 0, depCount: 0 }, !0) || this;
+ return G.blockCompilation = I, G._packedFloat = !1, G._staticDefines = "", G._staticDefines = O, G.direction = n, G.onApplyObservable.add(function(k) {
+ G._outputTexture ? k.setFloat2("delta", 1 / G._outputTexture.width * G.direction.x, 1 / G._outputTexture.height * G.direction.y) : k.setFloat2("delta", 1 / G.width * G.direction.x, 1 / G.height * G.direction.y);
+ }), G.kernel = i, G;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "kernel", { get: function() {
+ return this._idealKernel;
+ }, set: function(e) {
+ this._idealKernel !== e && (e = Math.max(e, 1), this._idealKernel = e, this._kernel = this._nearestBestKernel(e), this.blockCompilation || this._updateParameters());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "packedFloat", { get: function() {
+ return this._packedFloat;
+ }, set: function(e) {
+ this._packedFloat !== e && (this._packedFloat = e, this.blockCompilation || this._updateParameters());
+ }, enumerable: !1, configurable: !0 }), t.prototype.getClassName = function() {
+ return "BlurPostProcess";
+ }, t.prototype.updateEffect = function(e, n, i, o, a, s) {
+ this._updateParameters(a, s);
+ }, t.prototype._updateParameters = function(e, n) {
+ for (var i = this._kernel, o = (i - 1) / 2, a = [], s = [], p = 0, m = 0; m < i; m++) {
+ var S = m / (i - 1), O = this._gaussianWeight(2 * S - 1);
+ a[m] = m - o, s[m] = O, p += O;
+ }
+ for (m = 0; m < s.length; m++)
+ s[m] /= p;
+ var I = [], G = [], k = [];
+ for (m = 0; m <= o; m += 2) {
+ var K = Math.min(m + 1, Math.floor(o));
+ if (m === K)
+ k.push({ o: a[m], w: s[m] });
+ else {
+ var re = K === o, se = s[m] + s[K] * (re ? 0.5 : 1), ue = a[m] + 1 / (1 + s[m] / s[K]);
+ ue === 0 ? (k.push({ o: a[m], w: s[m] }), k.push({ o: a[m + 1], w: s[m + 1] })) : (k.push({ o: ue, w: se }), k.push({ o: -ue, w: se }));
+ }
+ }
+ for (m = 0; m < k.length; m++)
+ G[m] = k[m].o, I[m] = k[m].w;
+ a = G, s = I;
+ var he = this.getEngine().getCaps().maxVaryingVectors, pe = Math.max(he, 0) - 1, ve = Math.min(a.length, pe), Ee = "";
+ for (Ee += this._staticDefines, this._staticDefines.indexOf("DOF") != -1 && (Ee += "#define CENTER_WEIGHT " + this._glslFloat(s[ve - 1]) + `\r
+`, ve--), m = 0; m < ve; m++)
+ Ee += "#define KERNEL_OFFSET" + m + " " + this._glslFloat(a[m]) + `\r
+`, Ee += "#define KERNEL_WEIGHT" + m + " " + this._glslFloat(s[m]) + `\r
+`;
+ var Ae = 0;
+ for (m = pe; m < a.length; m++)
+ Ee += "#define KERNEL_DEP_OFFSET" + Ae + " " + this._glslFloat(a[m]) + `\r
+`, Ee += "#define KERNEL_DEP_WEIGHT" + Ae + " " + this._glslFloat(s[m]) + `\r
+`, Ae++;
+ this.packedFloat && (Ee += "#define PACKEDFLOAT 1"), this.blockCompilation = !1, r.prototype.updateEffect.call(this, Ee, null, null, { varyingCount: ve, depCount: Ae }, e, n);
+ }, t.prototype._nearestBestKernel = function(e) {
+ for (var n = Math.round(e), i = 0, o = [n, n - 1, n + 1, n - 2, n + 2]; i < o.length; i++) {
+ var a = o[i];
+ if (a % 2 != 0 && Math.floor(a / 2) % 2 == 0 && a > 0)
+ return Math.max(a, 3);
+ }
+ return Math.max(n, 3);
+ }, t.prototype._gaussianWeight = function(e) {
+ var n = -e * e / 0.2222222222222222;
+ return 1 / (Math.sqrt(2 * Math.PI) * (1 / 3)) * Math.exp(n);
+ }, t.prototype._glslFloat = function(e, n) {
+ return n === void 0 && (n = 8), e.toFixed(n).replace(/0+$/, "");
+ }, t._Parse = function(e, n, i, o) {
+ return w.a.Parse(function() {
+ return new t(e.name, e.direction, e.kernel, e.options, n, e.renderTargetSamplingMode, i.getEngine(), e.reusable, e.textureType, void 0, !1);
+ }, e, i, o);
+ }, Object(u.c)([Object(w.c)("kernel")], t.prototype, "_kernel", void 0), Object(u.c)([Object(w.c)("packedFloat")], t.prototype, "_packedFloat", void 0), Object(u.c)([Object(w.n)()], t.prototype, "direction", void 0), t;
+ }(_t);
+ x.a.RegisteredTypes["BABYLON.BlurPostProcess"] = xn;
+ var wl = function(r) {
+ function t(e, n, i, o, a, s, p) {
+ a === void 0 && (a = d.a.TEXTURETYPE_UNSIGNED_INT), s === void 0 && (s = Ue.a.BILINEAR_SAMPLINGMODE), p === void 0 && (p = !0);
+ var m = r.call(this, e, n, i, o, !0, a, !1, s, p) || this;
+ return m.scene = i, m.mirrorPlane = new yo.a(0, 1, 0, 1), m._transformMatrix = c.a.Zero(), m._mirrorMatrix = c.a.Zero(), m._adaptiveBlurKernel = 0, m._blurKernelX = 0, m._blurKernelY = 0, m._blurRatio = 1, m.ignoreCameraViewport = !0, m._updateGammaSpace(), m._imageProcessingConfigChangeObserver = i.imageProcessingConfiguration.onUpdateParameters.add(function() {
+ m._updateGammaSpace;
+ }), m.onBeforeRenderObservable.add(function() {
+ c.a.ReflectionToRef(m.mirrorPlane, m._mirrorMatrix), m._savedViewMatrix = i.getViewMatrix(), m._mirrorMatrix.multiplyToRef(m._savedViewMatrix, m._transformMatrix), i.setTransformMatrix(m._transformMatrix, i.getProjectionMatrix()), i.clipPlane = m.mirrorPlane, i.getEngine().cullBackFaces = !1, i._mirroredCameraPosition = c.e.TransformCoordinates(i.activeCamera.globalPosition, m._mirrorMatrix);
+ }), m.onAfterRenderObservable.add(function() {
+ i.setTransformMatrix(m._savedViewMatrix, i.getProjectionMatrix()), i.getEngine().cullBackFaces = !0, i._mirroredCameraPosition = null, i.clipPlane = null;
+ }), m;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "blurRatio", { get: function() {
+ return this._blurRatio;
+ }, set: function(e) {
+ this._blurRatio !== e && (this._blurRatio = e, this._preparePostProcesses());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "adaptiveBlurKernel", { set: function(e) {
+ this._adaptiveBlurKernel = e, this._autoComputeBlurKernel();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "blurKernel", { set: function(e) {
+ this.blurKernelX = e, this.blurKernelY = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "blurKernelX", { get: function() {
+ return this._blurKernelX;
+ }, set: function(e) {
+ this._blurKernelX !== e && (this._blurKernelX = e, this._preparePostProcesses());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "blurKernelY", { get: function() {
+ return this._blurKernelY;
+ }, set: function(e) {
+ this._blurKernelY !== e && (this._blurKernelY = e, this._preparePostProcesses());
+ }, enumerable: !1, configurable: !0 }), t.prototype._autoComputeBlurKernel = function() {
+ var e = this.getScene().getEngine(), n = this.getRenderWidth() / e.getRenderWidth(), i = this.getRenderHeight() / e.getRenderHeight();
+ this.blurKernelX = this._adaptiveBlurKernel * n, this.blurKernelY = this._adaptiveBlurKernel * i;
+ }, t.prototype._onRatioRescale = function() {
+ this._sizeRatio && (this.resize(this._initialSizeParameter), this._adaptiveBlurKernel || this._preparePostProcesses()), this._adaptiveBlurKernel && this._autoComputeBlurKernel();
+ }, t.prototype._updateGammaSpace = function() {
+ this.gammaSpace = !this.scene.imageProcessingConfiguration.isEnabled || !this.scene.imageProcessingConfiguration.applyByPostProcess;
+ }, t.prototype._preparePostProcesses = function() {
+ if (this.clearPostProcesses(!0), this._blurKernelX && this._blurKernelY) {
+ var e = this.getScene().getEngine(), n = e.getCaps().textureFloatRender ? d.a.TEXTURETYPE_FLOAT : d.a.TEXTURETYPE_HALF_FLOAT;
+ this._blurX = new xn("horizontal blur", new c.d(1, 0), this._blurKernelX, this._blurRatio, null, Ue.a.BILINEAR_SAMPLINGMODE, e, !1, n), this._blurX.autoClear = !1, this._blurRatio === 1 && this.samples < 2 && this._texture ? this._blurX.inputTexture = this._texture : this._blurX.alwaysForcePOT = !0, this._blurY = new xn("vertical blur", new c.d(0, 1), this._blurKernelY, this._blurRatio, null, Ue.a.BILINEAR_SAMPLINGMODE, e, !1, n), this._blurY.autoClear = !1, this._blurY.alwaysForcePOT = this._blurRatio !== 1, this.addPostProcess(this._blurX), this.addPostProcess(this._blurY);
+ } else
+ this._blurY && (this.removePostProcess(this._blurY), this._blurY.dispose(), this._blurY = null), this._blurX && (this.removePostProcess(this._blurX), this._blurX.dispose(), this._blurX = null);
+ }, t.prototype.clone = function() {
+ var e = this.getScene();
+ if (!e)
+ return this;
+ var n = this.getSize(), i = new t(this.name, n.width, e, this._renderTargetOptions.generateMipMaps, this._renderTargetOptions.type, this._renderTargetOptions.samplingMode, this._renderTargetOptions.generateDepthBuffer);
+ return i.hasAlpha = this.hasAlpha, i.level = this.level, i.mirrorPlane = this.mirrorPlane.clone(), this.renderList && (i.renderList = this.renderList.slice(0)), i;
+ }, t.prototype.serialize = function() {
+ if (!this.name)
+ return null;
+ var e = r.prototype.serialize.call(this);
+ return e.mirrorPlane = this.mirrorPlane.asArray(), e;
+ }, t.prototype.dispose = function() {
+ r.prototype.dispose.call(this), this.scene.imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingConfigChangeObserver);
+ }, t;
+ }(bn);
+ Ue.a._CreateMirror = function(r, t, e, n) {
+ return new wl(r, t, e, n);
+ };
+ var ui = l(34), Pi = function(r) {
+ function t(e, n, i, o, a, s, p, m, S, O, I, G, k, K) {
+ var re;
+ i === void 0 && (i = null), o === void 0 && (o = !1), a === void 0 && (a = null), s === void 0 && (s = null), p === void 0 && (p = null), m === void 0 && (m = d.a.TEXTUREFORMAT_RGBA), S === void 0 && (S = !1), O === void 0 && (O = null), I === void 0 && (I = !1), G === void 0 && (G = 0.8), k === void 0 && (k = 0);
+ var se = r.call(this, n) || this;
+ if (se.onLoadObservable = new P.c(), se.boundingBoxPosition = c.e.Zero(), se._rotationY = 0, se._files = null, se._forcedExtension = null, se._extensions = null, se.name = e, se.url = e, se._noMipmap = o, se.hasAlpha = !1, se._format = m, se.isCube = !0, se._textureMatrix = c.a.Identity(), se._createPolynomials = I, se.coordinatesMode = Ue.a.CUBIC_MODE, se._extensions = i, se._files = a, se._forcedExtension = O, se._loaderOptions = K, !e && !a)
+ return se;
+ var ue = e.lastIndexOf("."), he = O || (ue > -1 ? e.substring(ue).toLowerCase() : ""), pe = he === ".dds", ve = he === ".env";
+ if (ve ? (se.gammaSpace = !1, se._prefiltered = !1, se.anisotropicFilteringLevel = 1) : (se._prefiltered = S, S && (se.gammaSpace = !1, se.anisotropicFilteringLevel = 1)), se._texture = se._getFromCache(e, o), !a && (ve || pe || i || (i = ["_px.jpg", "_py.jpg", "_pz.jpg", "_nx.jpg", "_ny.jpg", "_nz.jpg"]), a = [], i))
+ for (var Ee = 0; Ee < i.length; Ee++)
+ a.push(e + i[Ee]);
+ se._files = a;
+ var Ae = function() {
+ se.onLoadObservable.notifyObservers(se), s && s();
+ };
+ if (se._texture)
+ se._texture.isReady ? Ke.b.SetImmediate(function() {
+ return Ae();
+ }) : se._texture.onLoadedObservable.add(function() {
+ return Ae();
+ });
+ else {
+ var Ie = se.getScene();
+ Ie != null && Ie.useDelayedTextureLoading ? se.delayLoadState = d.a.DELAYLOADSTATE_NOTLOADED : (se._texture = S ? se._getEngine().createPrefilteredCubeTexture(e, Ie, G, k, s, p, m, O, se._createPolynomials) : se._getEngine().createCubeTexture(e, Ie, a, o, s, p, se._format, O, !1, G, k, null, K), (re = se._texture) === null || re === void 0 || re.onLoadedObservable.add(function() {
+ return se.onLoadObservable.notifyObservers(se);
+ }));
+ }
+ return se;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "boundingBoxSize", { get: function() {
+ return this._boundingBoxSize;
+ }, set: function(e) {
+ if (!this._boundingBoxSize || !this._boundingBoxSize.equals(e)) {
+ this._boundingBoxSize = e;
+ var n = this.getScene();
+ n && n.markAllMaterialsAsDirty(d.a.MATERIAL_TextureDirtyFlag);
+ }
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "rotationY", { get: function() {
+ return this._rotationY;
+ }, set: function(e) {
+ this._rotationY = e, this.setReflectionTextureMatrix(c.a.RotationY(this._rotationY));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "noMipmap", { get: function() {
+ return this._noMipmap;
+ }, enumerable: !1, configurable: !0 }), t.CreateFromImages = function(e, n, i) {
+ var o = "";
+ return e.forEach(function(a) {
+ return o += a;
+ }), new t(o, n, null, i, e);
+ }, t.CreateFromPrefilteredData = function(e, n, i, o) {
+ i === void 0 && (i = null), o === void 0 && (o = !0);
+ var a = n.useDelayedTextureLoading;
+ n.useDelayedTextureLoading = !1;
+ var s = new t(e, n, null, !1, null, null, null, void 0, !0, i, o);
+ return n.useDelayedTextureLoading = a, s;
+ }, t.prototype.getClassName = function() {
+ return "CubeTexture";
+ }, t.prototype.updateURL = function(e, n, i, o) {
+ var a;
+ o === void 0 && (o = !1), this.url && (this.releaseInternalTexture(), (a = this.getScene()) === null || a === void 0 || a.markAllMaterialsAsDirty(d.a.MATERIAL_TextureDirtyFlag)), this.name && !ui.a.StartsWith(this.name, "data:") || (this.name = e), this.url = e, this.delayLoadState = d.a.DELAYLOADSTATE_NOTLOADED, this._prefiltered = o, this._prefiltered && (this.gammaSpace = !1, this.anisotropicFilteringLevel = 1), this._forcedExtension = n || null, i && (this._delayedOnLoad = i), this.delayLoad(n);
+ }, t.prototype.delayLoad = function(e) {
+ var n, i = this;
+ if (this.delayLoadState === d.a.DELAYLOADSTATE_NOTLOADED && (this.delayLoadState = d.a.DELAYLOADSTATE_LOADED, this._texture = this._getFromCache(this.url, this._noMipmap), !this._texture)) {
+ var o = this.getScene();
+ this._prefiltered ? this._texture = this._getEngine().createPrefilteredCubeTexture(this.url, o, 0.8, 0, this._delayedOnLoad, void 0, this._format, e, this._createPolynomials) : this._texture = this._getEngine().createCubeTexture(this.url, o, this._files, this._noMipmap, this._delayedOnLoad, null, this._format, e, !1, 0, 0, null, this._loaderOptions), (n = this._texture) === null || n === void 0 || n.onLoadedObservable.add(function() {
+ return i.onLoadObservable.notifyObservers(i);
+ });
+ }
+ }, t.prototype.getReflectionTextureMatrix = function() {
+ return this._textureMatrix;
+ }, t.prototype.setReflectionTextureMatrix = function(e) {
+ var n, i = this;
+ e.updateFlag !== this._textureMatrix.updateFlag && (e.isIdentity() !== this._textureMatrix.isIdentity() && ((n = this.getScene()) === null || n === void 0 || n.markAllMaterialsAsDirty(d.a.MATERIAL_TextureDirtyFlag, function(o) {
+ return o.getActiveTextures().indexOf(i) !== -1;
+ })), this._textureMatrix = e);
+ }, t.Parse = function(e, n, i) {
+ var o = w.a.Parse(function() {
+ var m = !1;
+ return e.prefiltered && (m = e.prefiltered), new t(i + e.name, n, e.extensions, !1, e.files || null, null, null, void 0, m, e.forcedExtension);
+ }, e, n);
+ if (e.boundingBoxPosition && (o.boundingBoxPosition = c.e.FromArray(e.boundingBoxPosition)), e.boundingBoxSize && (o.boundingBoxSize = c.e.FromArray(e.boundingBoxSize)), e.animations)
+ for (var a = 0; a < e.animations.length; a++) {
+ var s = e.animations[a], p = x.a.GetClass("BABYLON.Animation");
+ p && o.animations.push(p.Parse(s));
+ }
+ return o;
+ }, t.prototype.clone = function() {
+ var e = this, n = 0, i = w.a.Clone(function() {
+ var o = new t(e.url, e.getScene() || e._getEngine(), e._extensions, e._noMipmap, e._files);
+ return n = o.uniqueId, o;
+ }, this);
+ return i.uniqueId = n, i;
+ }, Object(u.c)([Object(w.c)()], t.prototype, "url", void 0), Object(u.c)([Object(w.c)("rotationY")], t.prototype, "rotationY", null), Object(u.c)([Object(w.c)("files")], t.prototype, "_files", void 0), Object(u.c)([Object(w.c)("forcedExtension")], t.prototype, "_forcedExtension", void 0), Object(u.c)([Object(w.c)("extensions")], t.prototype, "_extensions", void 0), Object(u.c)([Object(w.j)("textureMatrix")], t.prototype, "_textureMatrix", void 0), t;
+ }(oi.a);
+ Ue.a._CubeTextureParser = Pi.Parse, x.a.RegisteredTypes["BABYLON.CubeTexture"] = Pi;
+ var tt = l(15), Is = l(76), Ds = l(87), ht = l(19), Ub = ` uniform vec4 vPrimaryColor;
+#ifdef USEHIGHLIGHTANDSHADOWCOLORS
+uniform vec4 vPrimaryColorShadow;
+#endif
+uniform float shadowLevel;
+uniform float alpha;
+#ifdef DIFFUSE
+uniform vec2 vDiffuseInfos;
+#endif
+#ifdef REFLECTION
+uniform vec2 vReflectionInfos;
+uniform mat4 reflectionMatrix;
+uniform vec3 vReflectionMicrosurfaceInfos;
+#endif
+#if defined(REFLECTIONFRESNEL) || defined(OPACITYFRESNEL)
+uniform vec3 vBackgroundCenter;
+#endif
+#ifdef REFLECTIONFRESNEL
+uniform vec4 vReflectionControl;
+#endif
+#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)
+uniform mat4 view;
+#endif`;
+ We.a.IncludesShadersStore.backgroundFragmentDeclaration = Ub;
+ var Vb = `layout(std140,column_major) uniform;
+uniform Material
+{
+uniform vec4 vPrimaryColor;
+uniform vec4 vPrimaryColorShadow;
+uniform vec2 vDiffuseInfos;
+uniform vec2 vReflectionInfos;
+uniform mat4 diffuseMatrix;
+uniform mat4 reflectionMatrix;
+uniform vec3 vReflectionMicrosurfaceInfos;
+uniform float fFovMultiplier;
+uniform float pointSize;
+uniform float shadowLevel;
+uniform float alpha;
+#if defined(REFLECTIONFRESNEL) || defined(OPACITYFRESNEL)
+uniform vec3 vBackgroundCenter;
+#endif
+#ifdef REFLECTIONFRESNEL
+uniform vec4 vReflectionControl;
+#endif
+};
+uniform Scene {
+mat4 viewProjection;
+#ifdef MULTIVIEW
+mat4 viewProjectionR;
+#endif
+mat4 view;
+};`;
+ We.a.IncludesShadersStore.backgroundUboDeclaration = Vb, l(131), l(106), l(107), l(154), l(130), l(115), l(125), l(110), l(135), l(136);
+ var kb = `#ifdef TEXTURELODSUPPORT
+#extension GL_EXT_shader_texture_lod : enable
+#endif
+precision highp float;
+#include<__decl__backgroundFragment>
+#define RECIPROCAL_PI2 0.15915494
+
+uniform vec3 vEyePosition;
+
+varying vec3 vPositionW;
+#ifdef MAINUV1
+varying vec2 vMainUV1;
+#endif
+#ifdef MAINUV2
+varying vec2 vMainUV2;
+#endif
+#ifdef NORMAL
+varying vec3 vNormalW;
+#endif
+#ifdef DIFFUSE
+#if DIFFUSEDIRECTUV == 1
+#define vDiffuseUV vMainUV1
+#elif DIFFUSEDIRECTUV == 2
+#define vDiffuseUV vMainUV2
+#else
+varying vec2 vDiffuseUV;
+#endif
+uniform sampler2D diffuseSampler;
+#endif
+
+#ifdef REFLECTION
+#ifdef REFLECTIONMAP_3D
+#define sampleReflection(s,c) textureCube(s,c)
+uniform samplerCube reflectionSampler;
+#ifdef TEXTURELODSUPPORT
+#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)
+#else
+uniform samplerCube reflectionSamplerLow;
+uniform samplerCube reflectionSamplerHigh;
+#endif
+#else
+#define sampleReflection(s,c) texture2D(s,c)
+uniform sampler2D reflectionSampler;
+#ifdef TEXTURELODSUPPORT
+#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)
+#else
+uniform samplerCube reflectionSamplerLow;
+uniform samplerCube reflectionSamplerHigh;
+#endif
+#endif
+#ifdef REFLECTIONMAP_SKYBOX
+varying vec3 vPositionUVW;
+#else
+#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
+varying vec3 vDirectionW;
+#endif
+#endif
+#include
+#endif
+
+#ifndef FROMLINEARSPACE
+#define FROMLINEARSPACE;
+#endif
+
+#ifndef SHADOWONLY
+#define SHADOWONLY;
+#endif
+#include
+
+#include<__decl__lightFragment>[0..maxSimultaneousLights]
+#include
+#include
+#include
+#include
+#include
+
+#include
+#ifdef REFLECTIONFRESNEL
+#define FRESNEL_MAXIMUM_ON_ROUGH 0.25
+vec3 fresnelSchlickEnvironmentGGX(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)
+{
+
+float weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);
+return reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));
+}
+#endif
+void main(void) {
+#include
+vec3 viewDirectionW=normalize(vEyePosition-vPositionW);
+
+#ifdef NORMAL
+vec3 normalW=normalize(vNormalW);
+#else
+vec3 normalW=vec3(0.0,1.0,0.0);
+#endif
+
+float shadow=1.;
+float globalShadow=0.;
+float shadowLightCount=0.;
+#include[0..maxSimultaneousLights]
+#ifdef SHADOWINUSE
+globalShadow/=shadowLightCount;
+#else
+globalShadow=1.0;
+#endif
+#ifndef BACKMAT_SHADOWONLY
+
+vec4 reflectionColor=vec4(1.,1.,1.,1.);
+#ifdef REFLECTION
+vec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW);
+#ifdef REFLECTIONMAP_OPPOSITEZ
+reflectionVector.z*=-1.0;
+#endif
+
+#ifdef REFLECTIONMAP_3D
+vec3 reflectionCoords=reflectionVector;
+#else
+vec2 reflectionCoords=reflectionVector.xy;
+#ifdef REFLECTIONMAP_PROJECTION
+reflectionCoords/=reflectionVector.z;
+#endif
+reflectionCoords.y=1.0-reflectionCoords.y;
+#endif
+#ifdef REFLECTIONBLUR
+float reflectionLOD=vReflectionInfos.y;
+#ifdef TEXTURELODSUPPORT
+
+reflectionLOD=reflectionLOD*log2(vReflectionMicrosurfaceInfos.x)*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;
+reflectionColor=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);
+#else
+float lodReflectionNormalized=saturate(reflectionLOD);
+float lodReflectionNormalizedDoubled=lodReflectionNormalized*2.0;
+vec4 reflectionSpecularMid=sampleReflection(reflectionSampler,reflectionCoords);
+if(lodReflectionNormalizedDoubled<1.0){
+reflectionColor=mix(
+sampleReflection(reflectionSamplerHigh,reflectionCoords),
+reflectionSpecularMid,
+lodReflectionNormalizedDoubled
+);
+} else {
+reflectionColor=mix(
+reflectionSpecularMid,
+sampleReflection(reflectionSamplerLow,reflectionCoords),
+lodReflectionNormalizedDoubled-1.0
+);
+}
+#endif
+#else
+vec4 reflectionSample=sampleReflection(reflectionSampler,reflectionCoords);
+reflectionColor=reflectionSample;
+#endif
+#ifdef RGBDREFLECTION
+reflectionColor.rgb=fromRGBD(reflectionColor);
+#endif
+#ifdef GAMMAREFLECTION
+reflectionColor.rgb=toLinearSpace(reflectionColor.rgb);
+#endif
+#ifdef REFLECTIONBGR
+reflectionColor.rgb=reflectionColor.bgr;
+#endif
+
+reflectionColor.rgb*=vReflectionInfos.x;
+#endif
+
+vec3 diffuseColor=vec3(1.,1.,1.);
+float finalAlpha=alpha;
+#ifdef DIFFUSE
+vec4 diffuseMap=texture2D(diffuseSampler,vDiffuseUV);
+#ifdef GAMMADIFFUSE
+diffuseMap.rgb=toLinearSpace(diffuseMap.rgb);
+#endif
+
+diffuseMap.rgb*=vDiffuseInfos.y;
+#ifdef DIFFUSEHASALPHA
+finalAlpha*=diffuseMap.a;
+#endif
+diffuseColor=diffuseMap.rgb;
+#endif
+
+#ifdef REFLECTIONFRESNEL
+vec3 colorBase=diffuseColor;
+#else
+vec3 colorBase=reflectionColor.rgb*diffuseColor;
+#endif
+colorBase=max(colorBase,0.0);
+
+#ifdef USERGBCOLOR
+vec3 finalColor=colorBase;
+#else
+#ifdef USEHIGHLIGHTANDSHADOWCOLORS
+vec3 mainColor=mix(vPrimaryColorShadow.rgb,vPrimaryColor.rgb,colorBase);
+#else
+vec3 mainColor=vPrimaryColor.rgb;
+#endif
+vec3 finalColor=colorBase*mainColor;
+#endif
+
+#ifdef REFLECTIONFRESNEL
+vec3 reflectionAmount=vReflectionControl.xxx;
+vec3 reflectionReflectance0=vReflectionControl.yyy;
+vec3 reflectionReflectance90=vReflectionControl.zzz;
+float VdotN=dot(normalize(vEyePosition),normalW);
+vec3 planarReflectionFresnel=fresnelSchlickEnvironmentGGX(saturate(VdotN),reflectionReflectance0,reflectionReflectance90,1.0);
+reflectionAmount*=planarReflectionFresnel;
+#ifdef REFLECTIONFALLOFF
+float reflectionDistanceFalloff=1.0-saturate(length(vPositionW.xyz-vBackgroundCenter)*vReflectionControl.w);
+reflectionDistanceFalloff*=reflectionDistanceFalloff;
+reflectionAmount*=reflectionDistanceFalloff;
+#endif
+finalColor=mix(finalColor,reflectionColor.rgb,saturate(reflectionAmount));
+#endif
+#ifdef OPACITYFRESNEL
+float viewAngleToFloor=dot(normalW,normalize(vEyePosition-vBackgroundCenter));
+
+const float startAngle=0.1;
+float fadeFactor=saturate(viewAngleToFloor/startAngle);
+finalAlpha*=fadeFactor*fadeFactor;
+#endif
+
+#ifdef SHADOWINUSE
+finalColor=mix(finalColor*shadowLevel,finalColor,globalShadow);
+#endif
+
+vec4 color=vec4(finalColor,finalAlpha);
+#else
+vec4 color=vec4(vPrimaryColor.rgb,(1.0-clamp(globalShadow,0.,1.))*alpha);
+#endif
+#include
+#ifdef IMAGEPROCESSINGPOSTPROCESS
+
+
+color.rgb=clamp(color.rgb,0.,30.0);
+#else
+
+color=applyImageProcessing(color);
+#endif
+#ifdef PREMULTIPLYALPHA
+
+color.rgb*=color.a;
+#endif
+#ifdef NOISE
+color.rgb+=dither(vPositionW.xy,0.5);
+color=max(color,0.0);
+#endif
+gl_FragColor=color;
+}
+`;
+ We.a.ShadersStore.backgroundPixelShader = kb;
+ var Gb = `uniform mat4 view;
+uniform mat4 viewProjection;
+uniform float shadowLevel;
+#ifdef DIFFUSE
+uniform mat4 diffuseMatrix;
+uniform vec2 vDiffuseInfos;
+#endif
+#ifdef REFLECTION
+uniform vec2 vReflectionInfos;
+uniform mat4 reflectionMatrix;
+uniform vec3 vReflectionMicrosurfaceInfos;
+uniform float fFovMultiplier;
+#endif
+#ifdef POINTSIZE
+uniform float pointSize;
+#endif`;
+ We.a.IncludesShadersStore.backgroundVertexDeclaration = Gb, l(78), l(79), l(117), l(137), l(80), l(81), l(111), l(157), l(138);
+ var zb = `precision highp float;
+#include<__decl__backgroundVertex>
+#include
+
+attribute vec3 position;
+#ifdef NORMAL
+attribute vec3 normal;
+#endif
+#include
+
+#include
+
+varying vec3 vPositionW;
+#ifdef NORMAL
+varying vec3 vNormalW;
+#endif
+#ifdef UV1
+attribute vec2 uv;
+#endif
+#ifdef UV2
+attribute vec2 uv2;
+#endif
+#ifdef MAINUV1
+varying vec2 vMainUV1;
+#endif
+#ifdef MAINUV2
+varying vec2 vMainUV2;
+#endif
+#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0
+varying vec2 vDiffuseUV;
+#endif
+#include
+#include
+#include<__decl__lightFragment>[0..maxSimultaneousLights]
+#ifdef REFLECTIONMAP_SKYBOX
+varying vec3 vPositionUVW;
+#endif
+#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
+varying vec3 vDirectionW;
+#endif
+void main(void) {
+#ifdef REFLECTIONMAP_SKYBOX
+vPositionUVW=position;
+#endif
+#include
+#include
+#ifdef MULTIVIEW
+if (gl_ViewID_OVR == 0u) {
+gl_Position=viewProjection*finalWorld*vec4(position,1.0);
+} else {
+gl_Position=viewProjectionR*finalWorld*vec4(position,1.0);
+}
+#else
+gl_Position=viewProjection*finalWorld*vec4(position,1.0);
+#endif
+vec4 worldPos=finalWorld*vec4(position,1.0);
+vPositionW=vec3(worldPos);
+#ifdef NORMAL
+mat3 normalWorld=mat3(finalWorld);
+#ifdef NONUNIFORMSCALING
+normalWorld=transposeMat3(inverseMat3(normalWorld));
+#endif
+vNormalW=normalize(normalWorld*normal);
+#endif
+#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
+vDirectionW=normalize(vec3(finalWorld*vec4(position,0.0)));
+#ifdef EQUIRECTANGULAR_RELFECTION_FOV
+mat3 screenToWorld=inverseMat3(mat3(finalWorld*viewProjection));
+vec3 segment=mix(vDirectionW,screenToWorld*vec3(0.0,0.0,1.0),abs(fFovMultiplier-1.0));
+if (fFovMultiplier<=1.0) {
+vDirectionW=normalize(segment);
+} else {
+vDirectionW=normalize(vDirectionW+(vDirectionW-segment));
+}
+#endif
+#endif
+#ifndef UV1
+vec2 uv=vec2(0.,0.);
+#endif
+#ifndef UV2
+vec2 uv2=vec2(0.,0.);
+#endif
+#ifdef MAINUV1
+vMainUV1=uv;
+#endif
+#ifdef MAINUV2
+vMainUV2=uv2;
+#endif
+#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0
+if (vDiffuseInfos.x == 0.)
+{
+vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));
+}
+else
+{
+vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+
+#include
+
+#include
+
+#include[0..maxSimultaneousLights]
+
+#ifdef VERTEXCOLOR
+vColor=color;
+#endif
+
+#ifdef POINTSIZE
+gl_PointSize=pointSize;
+#endif
+}
+`;
+ We.a.ShadersStore.backgroundVertexShader = zb;
+ var Po = l(67), jb = function(r) {
+ function t() {
+ var e = r.call(this) || this;
+ return e.DIFFUSE = !1, e.DIFFUSEDIRECTUV = 0, e.GAMMADIFFUSE = !1, e.DIFFUSEHASALPHA = !1, e.OPACITYFRESNEL = !1, e.REFLECTIONBLUR = !1, e.REFLECTIONFRESNEL = !1, e.REFLECTIONFALLOFF = !1, e.TEXTURELODSUPPORT = !1, e.PREMULTIPLYALPHA = !1, e.USERGBCOLOR = !1, e.USEHIGHLIGHTANDSHADOWCOLORS = !1, e.BACKMAT_SHADOWONLY = !1, e.NOISE = !1, e.REFLECTIONBGR = !1, e.IMAGEPROCESSING = !1, e.VIGNETTE = !1, e.VIGNETTEBLENDMODEMULTIPLY = !1, e.VIGNETTEBLENDMODEOPAQUE = !1, e.TONEMAPPING = !1, e.TONEMAPPING_ACES = !1, e.CONTRAST = !1, e.COLORCURVES = !1, e.COLORGRADING = !1, e.COLORGRADING3D = !1, e.SAMPLER3DGREENDEPTH = !1, e.SAMPLER3DBGRMAP = !1, e.IMAGEPROCESSINGPOSTPROCESS = !1, e.EXPOSURE = !1, e.MULTIVIEW = !1, e.REFLECTION = !1, e.REFLECTIONMAP_3D = !1, e.REFLECTIONMAP_SPHERICAL = !1, e.REFLECTIONMAP_PLANAR = !1, e.REFLECTIONMAP_CUBIC = !1, e.REFLECTIONMAP_PROJECTION = !1, e.REFLECTIONMAP_SKYBOX = !1, e.REFLECTIONMAP_EXPLICIT = !1, e.REFLECTIONMAP_EQUIRECTANGULAR = !1, e.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = !1, e.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = !1, e.INVERTCUBICMAP = !1, e.REFLECTIONMAP_OPPOSITEZ = !1, e.LODINREFLECTIONALPHA = !1, e.GAMMAREFLECTION = !1, e.RGBDREFLECTION = !1, e.EQUIRECTANGULAR_RELFECTION_FOV = !1, e.MAINUV1 = !1, e.MAINUV2 = !1, e.UV1 = !1, e.UV2 = !1, e.CLIPPLANE = !1, e.CLIPPLANE2 = !1, e.CLIPPLANE3 = !1, e.CLIPPLANE4 = !1, e.CLIPPLANE5 = !1, e.CLIPPLANE6 = !1, e.POINTSIZE = !1, e.FOG = !1, e.NORMAL = !1, e.NUM_BONE_INFLUENCERS = 0, e.BonesPerMesh = 0, e.INSTANCES = !1, e.SHADOWFLOAT = !1, e.rebuild(), e;
+ }
+ return Object(u.d)(t, r), t;
+ }(Is.a), Sa = function(r) {
+ function t(e, n) {
+ var i = r.call(this, e, n) || this;
+ return i.primaryColor = C.a.White(), i._primaryColorShadowLevel = 0, i._primaryColorHighlightLevel = 0, i.reflectionTexture = null, i.reflectionBlur = 0, i.diffuseTexture = null, i._shadowLights = null, i.shadowLights = null, i.shadowLevel = 0, i.sceneCenter = c.e.Zero(), i.opacityFresnel = !0, i.reflectionFresnel = !1, i.reflectionFalloffDistance = 0, i.reflectionAmount = 1, i.reflectionReflectance0 = 0.05, i.reflectionReflectance90 = 0.5, i.useRGBColor = !0, i.enableNoise = !1, i._fovMultiplier = 1, i.useEquirectangularFOV = !1, i._maxSimultaneousLights = 4, i.maxSimultaneousLights = 4, i._shadowOnly = !1, i.shadowOnly = !1, i._imageProcessingObserver = null, i.switchToBGR = !1, i._renderTargets = new Ui.a(16), i._reflectionControls = c.f.Zero(), i._white = C.a.White(), i._primaryShadowColor = C.a.Black(), i._primaryHighlightColor = C.a.Black(), i._attachImageProcessingConfiguration(null), i.getRenderTargetTextures = function() {
+ return i._renderTargets.reset(), i._diffuseTexture && i._diffuseTexture.isRenderTarget && i._renderTargets.push(i._diffuseTexture), i._reflectionTexture && i._reflectionTexture.isRenderTarget && i._renderTargets.push(i._reflectionTexture), i._renderTargets;
+ }, i;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "_perceptualColor", { get: function() {
+ return this.__perceptualColor;
+ }, set: function(e) {
+ this.__perceptualColor = e, this._computePrimaryColorFromPerceptualColor(), this._markAllSubMeshesAsLightsDirty();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "primaryColorShadowLevel", { get: function() {
+ return this._primaryColorShadowLevel;
+ }, set: function(e) {
+ this._primaryColorShadowLevel = e, this._computePrimaryColors(), this._markAllSubMeshesAsLightsDirty();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "primaryColorHighlightLevel", { get: function() {
+ return this._primaryColorHighlightLevel;
+ }, set: function(e) {
+ this._primaryColorHighlightLevel = e, this._computePrimaryColors(), this._markAllSubMeshesAsLightsDirty();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "reflectionStandardFresnelWeight", { set: function(e) {
+ var n = e;
+ n < 0.5 ? (n *= 2, this.reflectionReflectance0 = t.StandardReflectance0 * n, this.reflectionReflectance90 = t.StandardReflectance90 * n) : (n = 2 * n - 1, this.reflectionReflectance0 = t.StandardReflectance0 + (1 - t.StandardReflectance0) * n, this.reflectionReflectance90 = t.StandardReflectance90 + (1 - t.StandardReflectance90) * n);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "fovMultiplier", { get: function() {
+ return this._fovMultiplier;
+ }, set: function(e) {
+ isNaN(e) && (e = 1), this._fovMultiplier = Math.max(0, Math.min(2, e));
+ }, enumerable: !1, configurable: !0 }), t.prototype._attachImageProcessingConfiguration = function(e) {
+ var n = this;
+ e !== this._imageProcessingConfiguration && (this._imageProcessingConfiguration && this._imageProcessingObserver && this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver), this._imageProcessingConfiguration = e || this.getScene().imageProcessingConfiguration, this._imageProcessingConfiguration && (this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(function() {
+ n._computePrimaryColorFromPerceptualColor(), n._markAllSubMeshesAsImageProcessingDirty();
+ })));
+ }, Object.defineProperty(t.prototype, "imageProcessingConfiguration", { get: function() {
+ return this._imageProcessingConfiguration;
+ }, set: function(e) {
+ this._attachImageProcessingConfiguration(e), this._markAllSubMeshesAsTexturesDirty();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "cameraColorCurvesEnabled", { get: function() {
+ return this.imageProcessingConfiguration.colorCurvesEnabled;
+ }, set: function(e) {
+ this.imageProcessingConfiguration.colorCurvesEnabled = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "cameraColorGradingEnabled", { get: function() {
+ return this.imageProcessingConfiguration.colorGradingEnabled;
+ }, set: function(e) {
+ this.imageProcessingConfiguration.colorGradingEnabled = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "cameraToneMappingEnabled", { get: function() {
+ return this._imageProcessingConfiguration.toneMappingEnabled;
+ }, set: function(e) {
+ this._imageProcessingConfiguration.toneMappingEnabled = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "cameraExposure", { get: function() {
+ return this._imageProcessingConfiguration.exposure;
+ }, set: function(e) {
+ this._imageProcessingConfiguration.exposure = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "cameraContrast", { get: function() {
+ return this._imageProcessingConfiguration.contrast;
+ }, set: function(e) {
+ this._imageProcessingConfiguration.contrast = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "cameraColorGradingTexture", { get: function() {
+ return this._imageProcessingConfiguration.colorGradingTexture;
+ }, set: function(e) {
+ this.imageProcessingConfiguration.colorGradingTexture = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "cameraColorCurves", { get: function() {
+ return this.imageProcessingConfiguration.colorCurves;
+ }, set: function(e) {
+ this.imageProcessingConfiguration.colorCurves = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "hasRenderTargetTextures", { get: function() {
+ return !(!this._diffuseTexture || !this._diffuseTexture.isRenderTarget) || !(!this._reflectionTexture || !this._reflectionTexture.isRenderTarget);
+ }, enumerable: !1, configurable: !0 }), t.prototype.needAlphaTesting = function() {
+ return !0;
+ }, t.prototype.needAlphaBlending = function() {
+ return this.alpha < 1 || this._diffuseTexture != null && this._diffuseTexture.hasAlpha || this._shadowOnly;
+ }, t.prototype.isReadyForSubMesh = function(e, n, i) {
+ var o = this;
+ if (i === void 0 && (i = !1), n.effect && this.isFrozen && n.effect._wasPreviouslyReady)
+ return !0;
+ n._materialDefines || (n._materialDefines = new jb());
+ var a = this.getScene(), s = n._materialDefines;
+ if (this._isReadyForSubMesh(n))
+ return !0;
+ var p = a.getEngine();
+ if (tt.a.PrepareDefinesForLights(a, e, s, !1, this._maxSimultaneousLights), s._needNormals = !0, tt.a.PrepareDefinesForMultiview(a, s), s._areTexturesDirty) {
+ if (s._needUVs = !1, a.texturesEnabled) {
+ if (a.getEngine().getCaps().textureLOD && (s.TEXTURELODSUPPORT = !0), this._diffuseTexture && ht.a.DiffuseTextureEnabled) {
+ if (!this._diffuseTexture.isReadyOrNotBlocking())
+ return !1;
+ tt.a.PrepareDefinesForMergedUV(this._diffuseTexture, s, "DIFFUSE"), s.DIFFUSEHASALPHA = this._diffuseTexture.hasAlpha, s.GAMMADIFFUSE = this._diffuseTexture.gammaSpace, s.OPACITYFRESNEL = this._opacityFresnel;
+ } else
+ s.DIFFUSE = !1, s.DIFFUSEHASALPHA = !1, s.GAMMADIFFUSE = !1, s.OPACITYFRESNEL = !1;
+ var m = this._reflectionTexture;
+ if (m && ht.a.ReflectionTextureEnabled) {
+ if (!m.isReadyOrNotBlocking())
+ return !1;
+ switch (s.REFLECTION = !0, s.GAMMAREFLECTION = m.gammaSpace, s.RGBDREFLECTION = m.isRGBD, s.REFLECTIONBLUR = this._reflectionBlur > 0, s.REFLECTIONMAP_OPPOSITEZ = this.getScene().useRightHandedSystem ? !m.invertZ : m.invertZ, s.LODINREFLECTIONALPHA = m.lodLevelInAlpha, s.EQUIRECTANGULAR_RELFECTION_FOV = this.useEquirectangularFOV, s.REFLECTIONBGR = this.switchToBGR, m.coordinatesMode === Ue.a.INVCUBIC_MODE && (s.INVERTCUBICMAP = !0), s.REFLECTIONMAP_3D = m.isCube, m.coordinatesMode) {
+ case Ue.a.EXPLICIT_MODE:
+ s.REFLECTIONMAP_EXPLICIT = !0;
+ break;
+ case Ue.a.PLANAR_MODE:
+ s.REFLECTIONMAP_PLANAR = !0;
+ break;
+ case Ue.a.PROJECTION_MODE:
+ s.REFLECTIONMAP_PROJECTION = !0;
+ break;
+ case Ue.a.SKYBOX_MODE:
+ s.REFLECTIONMAP_SKYBOX = !0;
+ break;
+ case Ue.a.SPHERICAL_MODE:
+ s.REFLECTIONMAP_SPHERICAL = !0;
+ break;
+ case Ue.a.EQUIRECTANGULAR_MODE:
+ s.REFLECTIONMAP_EQUIRECTANGULAR = !0;
+ break;
+ case Ue.a.FIXED_EQUIRECTANGULAR_MODE:
+ s.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = !0;
+ break;
+ case Ue.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:
+ s.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = !0;
+ break;
+ case Ue.a.CUBIC_MODE:
+ case Ue.a.INVCUBIC_MODE:
+ default:
+ s.REFLECTIONMAP_CUBIC = !0;
+ }
+ this.reflectionFresnel ? (s.REFLECTIONFRESNEL = !0, s.REFLECTIONFALLOFF = this.reflectionFalloffDistance > 0, this._reflectionControls.x = this.reflectionAmount, this._reflectionControls.y = this.reflectionReflectance0, this._reflectionControls.z = this.reflectionReflectance90, this._reflectionControls.w = 1 / this.reflectionFalloffDistance) : (s.REFLECTIONFRESNEL = !1, s.REFLECTIONFALLOFF = !1);
+ } else
+ s.REFLECTION = !1, s.REFLECTIONFRESNEL = !1, s.REFLECTIONFALLOFF = !1, s.REFLECTIONBLUR = !1, s.REFLECTIONMAP_3D = !1, s.REFLECTIONMAP_SPHERICAL = !1, s.REFLECTIONMAP_PLANAR = !1, s.REFLECTIONMAP_CUBIC = !1, s.REFLECTIONMAP_PROJECTION = !1, s.REFLECTIONMAP_SKYBOX = !1, s.REFLECTIONMAP_EXPLICIT = !1, s.REFLECTIONMAP_EQUIRECTANGULAR = !1, s.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = !1, s.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = !1, s.INVERTCUBICMAP = !1, s.REFLECTIONMAP_OPPOSITEZ = !1, s.LODINREFLECTIONALPHA = !1, s.GAMMAREFLECTION = !1, s.RGBDREFLECTION = !1;
+ }
+ s.PREMULTIPLYALPHA = this.alphaMode === d.a.ALPHA_PREMULTIPLIED || this.alphaMode === d.a.ALPHA_PREMULTIPLIED_PORTERDUFF, s.USERGBCOLOR = this._useRGBColor, s.NOISE = this._enableNoise;
+ }
+ if (s._areLightsDirty && (s.USEHIGHLIGHTANDSHADOWCOLORS = !this._useRGBColor && (this._primaryColorShadowLevel !== 0 || this._primaryColorHighlightLevel !== 0), s.BACKMAT_SHADOWONLY = this._shadowOnly), s._areImageProcessingDirty && this._imageProcessingConfiguration) {
+ if (!this._imageProcessingConfiguration.isReady())
+ return !1;
+ this._imageProcessingConfiguration.prepareDefines(s);
+ }
+ if (tt.a.PrepareDefinesForMisc(e, a, !1, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(e), s), tt.a.PrepareDefinesForFrameBoundValues(a, p, s, i, null, n.getRenderingMesh().hasThinInstances), tt.a.PrepareDefinesForAttributes(e, s, !1, !0, !1) && e && (a.getEngine().getCaps().standardDerivatives || e.isVerticesDataPresent(De.b.NormalKind) || (e.createNormals(!0), h.a.Warn("BackgroundMaterial: Normals have been created for the mesh: " + e.name))), s.isDirty) {
+ s.markAsProcessed(), a.resetCachedMaterial();
+ var S = new Po.a();
+ s.FOG && S.addFallback(0, "FOG"), s.POINTSIZE && S.addFallback(1, "POINTSIZE"), s.MULTIVIEW && S.addFallback(0, "MULTIVIEW"), tt.a.HandleFallbacksForShadows(s, S, this._maxSimultaneousLights);
+ var O = [De.b.PositionKind];
+ s.NORMAL && O.push(De.b.NormalKind), s.UV1 && O.push(De.b.UVKind), s.UV2 && O.push(De.b.UV2Kind), tt.a.PrepareAttributesForBones(O, e, s, S), tt.a.PrepareAttributesForInstances(O, s);
+ var I = ["world", "view", "viewProjection", "vEyePosition", "vLightsType", "vFogInfos", "vFogColor", "pointSize", "vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6", "mBones", "vPrimaryColor", "vPrimaryColorShadow", "vReflectionInfos", "reflectionMatrix", "vReflectionMicrosurfaceInfos", "fFovMultiplier", "shadowLevel", "alpha", "vBackgroundCenter", "vReflectionControl", "vDiffuseInfos", "diffuseMatrix"], G = ["diffuseSampler", "reflectionSampler", "reflectionSamplerLow", "reflectionSamplerHigh"], k = ["Material", "Scene"];
+ In.a && (In.a.PrepareUniforms(I, s), In.a.PrepareSamplers(G, s)), tt.a.PrepareUniformsAndSamplersList({ uniformsNames: I, uniformBuffersNames: k, samplers: G, defines: s, maxSimultaneousLights: this._maxSimultaneousLights });
+ var K = s.toString();
+ n.setEffect(a.getEngine().createEffect("background", { attributes: O, uniformsNames: I, uniformBuffersNames: k, samplers: G, defines: K, fallbacks: S, onCompiled: function(re) {
+ o.onCompiled && o.onCompiled(re), o.bindSceneUniformBuffer(re, a.getSceneUniformBuffer());
+ }, onError: this.onError, indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights } }, p), s), this.buildUniformLayout();
+ }
+ return !(!n.effect || !n.effect.isReady()) && (s._renderId = a.getRenderId(), n.effect._wasPreviouslyReady = !0, !0);
+ }, t.prototype._computePrimaryColorFromPerceptualColor = function() {
+ this.__perceptualColor && (this._primaryColor.copyFrom(this.__perceptualColor), this._primaryColor.toLinearSpaceToRef(this._primaryColor), this._imageProcessingConfiguration && this._primaryColor.scaleToRef(1 / this._imageProcessingConfiguration.exposure, this._primaryColor), this._computePrimaryColors());
+ }, t.prototype._computePrimaryColors = function() {
+ this._primaryColorShadowLevel === 0 && this._primaryColorHighlightLevel === 0 || (this._primaryColor.scaleToRef(this._primaryColorShadowLevel, this._primaryShadowColor), this._primaryColor.subtractToRef(this._primaryShadowColor, this._primaryShadowColor), this._white.subtractToRef(this._primaryColor, this._primaryHighlightColor), this._primaryHighlightColor.scaleToRef(this._primaryColorHighlightLevel, this._primaryHighlightColor), this._primaryColor.addToRef(this._primaryHighlightColor, this._primaryHighlightColor));
+ }, t.prototype.buildUniformLayout = function() {
+ this._uniformBuffer.addUniform("vPrimaryColor", 4), this._uniformBuffer.addUniform("vPrimaryColorShadow", 4), this._uniformBuffer.addUniform("vDiffuseInfos", 2), this._uniformBuffer.addUniform("vReflectionInfos", 2), this._uniformBuffer.addUniform("diffuseMatrix", 16), this._uniformBuffer.addUniform("reflectionMatrix", 16), this._uniformBuffer.addUniform("vReflectionMicrosurfaceInfos", 3), this._uniformBuffer.addUniform("fFovMultiplier", 1), this._uniformBuffer.addUniform("pointSize", 1), this._uniformBuffer.addUniform("shadowLevel", 1), this._uniformBuffer.addUniform("alpha", 1), this._uniformBuffer.addUniform("vBackgroundCenter", 3), this._uniformBuffer.addUniform("vReflectionControl", 4), this._uniformBuffer.create();
+ }, t.prototype.unbind = function() {
+ this._diffuseTexture && this._diffuseTexture.isRenderTarget && this._uniformBuffer.setTexture("diffuseSampler", null), this._reflectionTexture && this._reflectionTexture.isRenderTarget && this._uniformBuffer.setTexture("reflectionSampler", null), r.prototype.unbind.call(this);
+ }, t.prototype.bindOnlyWorldMatrix = function(e) {
+ this._activeEffect.setMatrix("world", e);
+ }, t.prototype.bindForSubMesh = function(e, n, i) {
+ var o = this.getScene(), a = i._materialDefines;
+ if (a) {
+ var s = i.effect;
+ if (s) {
+ this._activeEffect = s, this.bindOnlyWorldMatrix(e), tt.a.BindBonesParameters(n, this._activeEffect);
+ var p = this._mustRebind(o, s, n.visibility);
+ if (p) {
+ this._uniformBuffer.bindToEffect(s, "Material"), this.bindViewProjection(s);
+ var m = this._reflectionTexture;
+ this._uniformBuffer.useUbo && this.isFrozen && this._uniformBuffer.isSync || (o.texturesEnabled && (this._diffuseTexture && ht.a.DiffuseTextureEnabled && (this._uniformBuffer.updateFloat2("vDiffuseInfos", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level), tt.a.BindTextureMatrix(this._diffuseTexture, this._uniformBuffer, "diffuse")), m && ht.a.ReflectionTextureEnabled && (this._uniformBuffer.updateMatrix("reflectionMatrix", m.getReflectionTextureMatrix()), this._uniformBuffer.updateFloat2("vReflectionInfos", m.level, this._reflectionBlur), this._uniformBuffer.updateFloat3("vReflectionMicrosurfaceInfos", m.getSize().width, m.lodGenerationScale, m.lodGenerationOffset))), this.shadowLevel > 0 && this._uniformBuffer.updateFloat("shadowLevel", this.shadowLevel), this._uniformBuffer.updateFloat("alpha", this.alpha), this.pointsCloud && this._uniformBuffer.updateFloat("pointSize", this.pointSize), a.USEHIGHLIGHTANDSHADOWCOLORS ? (this._uniformBuffer.updateColor4("vPrimaryColor", this._primaryHighlightColor, 1), this._uniformBuffer.updateColor4("vPrimaryColorShadow", this._primaryShadowColor, 1)) : this._uniformBuffer.updateColor4("vPrimaryColor", this._primaryColor, 1)), this._uniformBuffer.updateFloat("fFovMultiplier", this._fovMultiplier), o.texturesEnabled && (this._diffuseTexture && ht.a.DiffuseTextureEnabled && this._uniformBuffer.setTexture("diffuseSampler", this._diffuseTexture), m && ht.a.ReflectionTextureEnabled && (a.REFLECTIONBLUR && a.TEXTURELODSUPPORT ? this._uniformBuffer.setTexture("reflectionSampler", m) : a.REFLECTIONBLUR ? (this._uniformBuffer.setTexture("reflectionSampler", m._lodTextureMid || m), this._uniformBuffer.setTexture("reflectionSamplerLow", m._lodTextureLow || m), this._uniformBuffer.setTexture("reflectionSamplerHigh", m._lodTextureHigh || m)) : this._uniformBuffer.setTexture("reflectionSampler", m), a.REFLECTIONFRESNEL && (this._uniformBuffer.updateFloat3("vBackgroundCenter", this.sceneCenter.x, this.sceneCenter.y, this.sceneCenter.z), this._uniformBuffer.updateFloat4("vReflectionControl", this._reflectionControls.x, this._reflectionControls.y, this._reflectionControls.z, this._reflectionControls.w)))), tt.a.BindClipPlane(this._activeEffect, o), tt.a.BindEyePosition(s, o);
+ }
+ !p && this.isFrozen || (o.lightsEnabled && tt.a.BindLights(o, n, this._activeEffect, a, this._maxSimultaneousLights, !1), this.bindView(s), tt.a.BindFogParameters(o, n, this._activeEffect, !0), this._imageProcessingConfiguration && this._imageProcessingConfiguration.bind(this._activeEffect)), this._uniformBuffer.update(), this._afterBind(n, this._activeEffect);
+ }
+ }
+ }, t.prototype.hasTexture = function(e) {
+ return !!r.prototype.hasTexture.call(this, e) || this._reflectionTexture === e || this._diffuseTexture === e;
+ }, t.prototype.dispose = function(e, n) {
+ e === void 0 && (e = !1), n === void 0 && (n = !1), n && (this.diffuseTexture && this.diffuseTexture.dispose(), this.reflectionTexture && this.reflectionTexture.dispose()), this._renderTargets.dispose(), this._imageProcessingConfiguration && this._imageProcessingObserver && this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver), r.prototype.dispose.call(this, e);
+ }, t.prototype.clone = function(e) {
+ var n = this;
+ return w.a.Clone(function() {
+ return new t(e, n.getScene());
+ }, this);
+ }, t.prototype.serialize = function() {
+ var e = w.a.Serialize(this);
+ return e.customType = "BABYLON.BackgroundMaterial", e;
+ }, t.prototype.getClassName = function() {
+ return "BackgroundMaterial";
+ }, t.Parse = function(e, n, i) {
+ return w.a.Parse(function() {
+ return new t(e.name, n);
+ }, e, n, i);
+ }, t.StandardReflectance0 = 0.05, t.StandardReflectance90 = 0.5, Object(u.c)([Object(w.e)()], t.prototype, "_primaryColor", void 0), Object(u.c)([Object(w.b)("_markAllSubMeshesAsLightsDirty")], t.prototype, "primaryColor", void 0), Object(u.c)([Object(w.e)()], t.prototype, "__perceptualColor", void 0), Object(u.c)([Object(w.c)()], t.prototype, "_primaryColorShadowLevel", void 0), Object(u.c)([Object(w.c)()], t.prototype, "_primaryColorHighlightLevel", void 0), Object(u.c)([Object(w.b)("_markAllSubMeshesAsLightsDirty")], t.prototype, "primaryColorHighlightLevel", null), Object(u.c)([Object(w.m)()], t.prototype, "_reflectionTexture", void 0), Object(u.c)([Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionTexture", void 0), Object(u.c)([Object(w.c)()], t.prototype, "_reflectionBlur", void 0), Object(u.c)([Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionBlur", void 0), Object(u.c)([Object(w.m)()], t.prototype, "_diffuseTexture", void 0), Object(u.c)([Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "diffuseTexture", void 0), Object(u.c)([Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "shadowLights", void 0), Object(u.c)([Object(w.c)()], t.prototype, "_shadowLevel", void 0), Object(u.c)([Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "shadowLevel", void 0), Object(u.c)([Object(w.o)()], t.prototype, "_sceneCenter", void 0), Object(u.c)([Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "sceneCenter", void 0), Object(u.c)([Object(w.c)()], t.prototype, "_opacityFresnel", void 0), Object(u.c)([Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "opacityFresnel", void 0), Object(u.c)([Object(w.c)()], t.prototype, "_reflectionFresnel", void 0), Object(u.c)([Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionFresnel", void 0), Object(u.c)([Object(w.c)()], t.prototype, "_reflectionFalloffDistance", void 0), Object(u.c)([Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionFalloffDistance", void 0), Object(u.c)([Object(w.c)()], t.prototype, "_reflectionAmount", void 0), Object(u.c)([Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionAmount", void 0), Object(u.c)([Object(w.c)()], t.prototype, "_reflectionReflectance0", void 0), Object(u.c)([Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionReflectance0", void 0), Object(u.c)([Object(w.c)()], t.prototype, "_reflectionReflectance90", void 0), Object(u.c)([Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionReflectance90", void 0), Object(u.c)([Object(w.c)()], t.prototype, "_useRGBColor", void 0), Object(u.c)([Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useRGBColor", void 0), Object(u.c)([Object(w.c)()], t.prototype, "_enableNoise", void 0), Object(u.c)([Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "enableNoise", void 0), Object(u.c)([Object(w.c)()], t.prototype, "_maxSimultaneousLights", void 0), Object(u.c)([Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "maxSimultaneousLights", void 0), Object(u.c)([Object(w.c)()], t.prototype, "_shadowOnly", void 0), Object(u.c)([Object(w.b)("_markAllSubMeshesAsLightsDirty")], t.prototype, "shadowOnly", void 0), Object(u.c)([Object(w.i)()], t.prototype, "_imageProcessingConfiguration", void 0), t;
+ }(Ds.a);
+ x.a.RegisteredTypes["BABYLON.BackgroundMaterial"] = Sa;
+ var Nl = function() {
+ function r(t, e) {
+ var n = this;
+ this._errorHandler = function(i, o) {
+ n.onErrorObservable.notifyObservers({ message: i, exception: o });
+ }, this._options = Object(u.a)(Object(u.a)({}, r._getDefaultOptions()), t), this._scene = e, this.onErrorObservable = new P.c(), this._setupBackground(), this._setupImageProcessing();
+ }
+ return r._getDefaultOptions = function() {
+ return { createGround: !0, groundSize: 15, groundTexture: this._groundTextureCDNUrl, groundColor: new C.a(0.2, 0.2, 0.3).toLinearSpace().scale(3), groundOpacity: 0.9, enableGroundShadow: !0, groundShadowLevel: 0.5, enableGroundMirror: !1, groundMirrorSizeRatio: 0.3, groundMirrorBlurKernel: 64, groundMirrorAmount: 1, groundMirrorFresnelWeight: 1, groundMirrorFallOffDistance: 0, groundMirrorTextureType: d.a.TEXTURETYPE_UNSIGNED_INT, groundYBias: 1e-5, createSkybox: !0, skyboxSize: 20, skyboxTexture: this._skyboxTextureCDNUrl, skyboxColor: new C.a(0.2, 0.2, 0.3).toLinearSpace().scale(3), backgroundYRotation: 0, sizeAuto: !0, rootPosition: c.e.Zero(), setupImageProcessing: !0, environmentTexture: this._environmentTextureCDNUrl, cameraExposure: 0.8, cameraContrast: 1.2, toneMappingEnabled: !0 };
+ }, Object.defineProperty(r.prototype, "rootMesh", { get: function() {
+ return this._rootMesh;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "skybox", { get: function() {
+ return this._skybox;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "skyboxTexture", { get: function() {
+ return this._skyboxTexture;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "skyboxMaterial", { get: function() {
+ return this._skyboxMaterial;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "ground", { get: function() {
+ return this._ground;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "groundTexture", { get: function() {
+ return this._groundTexture;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "groundMirror", { get: function() {
+ return this._groundMirror;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "groundMirrorRenderList", { get: function() {
+ return this._groundMirror ? this._groundMirror.renderList : null;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "groundMaterial", { get: function() {
+ return this._groundMaterial;
+ }, enumerable: !1, configurable: !0 }), r.prototype.updateOptions = function(t) {
+ var e = Object(u.a)(Object(u.a)({}, this._options), t);
+ this._ground && !e.createGround && (this._ground.dispose(), this._ground = null), this._groundMaterial && !e.createGround && (this._groundMaterial.dispose(), this._groundMaterial = null), this._groundTexture && this._options.groundTexture != e.groundTexture && (this._groundTexture.dispose(), this._groundTexture = null), this._skybox && !e.createSkybox && (this._skybox.dispose(), this._skybox = null), this._skyboxMaterial && !e.createSkybox && (this._skyboxMaterial.dispose(), this._skyboxMaterial = null), this._skyboxTexture && this._options.skyboxTexture != e.skyboxTexture && (this._skyboxTexture.dispose(), this._skyboxTexture = null), this._groundMirror && !e.enableGroundMirror && (this._groundMirror.dispose(), this._groundMirror = null), this._scene.environmentTexture && this._options.environmentTexture != e.environmentTexture && this._scene.environmentTexture.dispose(), this._options = e, this._setupBackground(), this._setupImageProcessing();
+ }, r.prototype.setMainColor = function(t) {
+ this.groundMaterial && (this.groundMaterial.primaryColor = t), this.skyboxMaterial && (this.skyboxMaterial.primaryColor = t), this.groundMirror && (this.groundMirror.clearColor = new C.b(t.r, t.g, t.b, 1));
+ }, r.prototype._setupImageProcessing = function() {
+ this._options.setupImageProcessing && (this._scene.imageProcessingConfiguration.contrast = this._options.cameraContrast, this._scene.imageProcessingConfiguration.exposure = this._options.cameraExposure, this._scene.imageProcessingConfiguration.toneMappingEnabled = this._options.toneMappingEnabled, this._setupEnvironmentTexture());
+ }, r.prototype._setupEnvironmentTexture = function() {
+ if (!this._scene.environmentTexture)
+ if (this._options.environmentTexture instanceof oi.a)
+ this._scene.environmentTexture = this._options.environmentTexture;
+ else {
+ var t = Pi.CreateFromPrefilteredData(this._options.environmentTexture, this._scene);
+ this._scene.environmentTexture = t;
+ }
+ }, r.prototype._setupBackground = function() {
+ this._rootMesh || (this._rootMesh = new we.a("BackgroundHelper", this._scene)), this._rootMesh.rotation.y = this._options.backgroundYRotation;
+ var t = this._getSceneSize();
+ this._options.createGround && (this._setupGround(t), this._setupGroundMaterial(), this._setupGroundDiffuseTexture(), this._options.enableGroundMirror && this._setupGroundMirrorTexture(t), this._setupMirrorInGroundMaterial()), this._options.createSkybox && (this._setupSkybox(t), this._setupSkyboxMaterial(), this._setupSkyboxReflectionTexture()), this._rootMesh.position.x = t.rootPosition.x, this._rootMesh.position.z = t.rootPosition.z, this._rootMesh.position.y = t.rootPosition.y;
+ }, r.prototype._getSceneSize = function() {
+ var t = this, e = this._options.groundSize, n = this._options.skyboxSize, i = this._options.rootPosition;
+ if (!this._scene.meshes || this._scene.meshes.length === 1)
+ return { groundSize: e, skyboxSize: n, rootPosition: i };
+ var o = this._scene.getWorldExtends(function(p) {
+ return p !== t._ground && p !== t._rootMesh && p !== t._skybox;
+ }), a = o.max.subtract(o.min);
+ if (this._options.sizeAuto) {
+ this._scene.activeCamera instanceof Gr && this._scene.activeCamera.upperRadiusLimit && (n = e = 2 * this._scene.activeCamera.upperRadiusLimit);
+ var s = a.length();
+ s > e && (n = e = 2 * s), e *= 1.1, n *= 1.5, (i = o.min.add(a.scale(0.5))).y = o.min.y - this._options.groundYBias;
+ }
+ return { groundSize: e, skyboxSize: n, rootPosition: i };
+ }, r.prototype._setupGround = function(t) {
+ var e = this;
+ this._ground && !this._ground.isDisposed() || (this._ground = we.a.CreatePlane("BackgroundPlane", t.groundSize, this._scene), this._ground.rotation.x = Math.PI / 2, this._ground.parent = this._rootMesh, this._ground.onDisposeObservable.add(function() {
+ e._ground = null;
+ })), this._ground.receiveShadows = this._options.enableGroundShadow;
+ }, r.prototype._setupGroundMaterial = function() {
+ this._groundMaterial || (this._groundMaterial = new Sa("BackgroundPlaneMaterial", this._scene)), this._groundMaterial.alpha = this._options.groundOpacity, this._groundMaterial.alphaMode = d.a.ALPHA_PREMULTIPLIED_PORTERDUFF, this._groundMaterial.shadowLevel = this._options.groundShadowLevel, this._groundMaterial.primaryColor = this._options.groundColor, this._groundMaterial.useRGBColor = !1, this._groundMaterial.enableNoise = !0, this._ground && (this._ground.material = this._groundMaterial);
+ }, r.prototype._setupGroundDiffuseTexture = function() {
+ this._groundMaterial && (this._groundTexture || (this._options.groundTexture instanceof oi.a ? this._groundMaterial.diffuseTexture = this._options.groundTexture : (this._groundTexture = new Ue.a(this._options.groundTexture, this._scene, void 0, void 0, void 0, void 0, this._errorHandler), this._groundTexture.gammaSpace = !1, this._groundTexture.hasAlpha = !0, this._groundMaterial.diffuseTexture = this._groundTexture)));
+ }, r.prototype._setupGroundMirrorTexture = function(t) {
+ var e = Ue.a.CLAMP_ADDRESSMODE;
+ if (!this._groundMirror && (this._groundMirror = new wl("BackgroundPlaneMirrorTexture", { ratio: this._options.groundMirrorSizeRatio }, this._scene, !1, this._options.groundMirrorTextureType, Ue.a.BILINEAR_SAMPLINGMODE, !0), this._groundMirror.mirrorPlane = new yo.a(0, -1, 0, t.rootPosition.y), this._groundMirror.anisotropicFilteringLevel = 1, this._groundMirror.wrapU = e, this._groundMirror.wrapV = e, this._groundMirror.gammaSpace = !1, this._groundMirror.renderList))
+ for (var n = 0; n < this._scene.meshes.length; n++) {
+ var i = this._scene.meshes[n];
+ i !== this._ground && i !== this._skybox && i !== this._rootMesh && this._groundMirror.renderList.push(i);
+ }
+ this._groundMirror.clearColor = new C.b(this._options.groundColor.r, this._options.groundColor.g, this._options.groundColor.b, 1), this._groundMirror.adaptiveBlurKernel = this._options.groundMirrorBlurKernel;
+ }, r.prototype._setupMirrorInGroundMaterial = function() {
+ this._groundMaterial && (this._groundMaterial.reflectionTexture = this._groundMirror, this._groundMaterial.reflectionFresnel = !0, this._groundMaterial.reflectionAmount = this._options.groundMirrorAmount, this._groundMaterial.reflectionStandardFresnelWeight = this._options.groundMirrorFresnelWeight, this._groundMaterial.reflectionFalloffDistance = this._options.groundMirrorFallOffDistance);
+ }, r.prototype._setupSkybox = function(t) {
+ var e = this;
+ this._skybox && !this._skybox.isDisposed() || (this._skybox = we.a.CreateBox("BackgroundSkybox", t.skyboxSize, this._scene, void 0, we.a.BACKSIDE), this._skybox.onDisposeObservable.add(function() {
+ e._skybox = null;
+ })), this._skybox.parent = this._rootMesh;
+ }, r.prototype._setupSkyboxMaterial = function() {
+ this._skybox && (this._skyboxMaterial || (this._skyboxMaterial = new Sa("BackgroundSkyboxMaterial", this._scene)), this._skyboxMaterial.useRGBColor = !1, this._skyboxMaterial.primaryColor = this._options.skyboxColor, this._skyboxMaterial.enableNoise = !0, this._skybox.material = this._skyboxMaterial);
+ }, r.prototype._setupSkyboxReflectionTexture = function() {
+ this._skyboxMaterial && (this._skyboxTexture || (this._options.skyboxTexture instanceof oi.a ? this._skyboxMaterial.reflectionTexture = this._options.skyboxTexture : (this._skyboxTexture = new Pi(this._options.skyboxTexture, this._scene, void 0, void 0, void 0, void 0, this._errorHandler), this._skyboxTexture.coordinatesMode = Ue.a.SKYBOX_MODE, this._skyboxTexture.gammaSpace = !1, this._skyboxMaterial.reflectionTexture = this._skyboxTexture)));
+ }, r.prototype.dispose = function() {
+ this._groundMaterial && this._groundMaterial.dispose(!0, !0), this._skyboxMaterial && this._skyboxMaterial.dispose(!0, !0), this._rootMesh.dispose(!1);
+ }, r._groundTextureCDNUrl = "https://assets.babylonjs.com/environments/backgroundGround.png", r._skyboxTextureCDNUrl = "https://assets.babylonjs.com/environments/backgroundSkybox.dds", r._environmentTextureCDNUrl = "https://assets.babylonjs.com/environments/environmentSpecular.env", r;
+ }(), br = function(r) {
+ function t(e, n, i, o, a) {
+ a === void 0 && (a = null);
+ var s = r.call(this, e, o) || this;
+ s.onError = a, s._halfDome = !1, s._crossEye = !1, s._useDirectMapping = !1, s._textureMode = t.MODE_MONOSCOPIC, s._onBeforeCameraRenderObserver = null, s.onLoadErrorObservable = new P.c(), o = s.getScene(), e = e || "textureDome", i.resolution = 0 | Math.abs(i.resolution) || 32, i.clickToPlay = !!i.clickToPlay, i.autoPlay = i.autoPlay === void 0 || !!i.autoPlay, i.loop = i.loop === void 0 || !!i.loop, i.size = Math.abs(i.size) || (o.activeCamera ? 0.48 * o.activeCamera.maxZ : 1e3), i.useDirectMapping === void 0 ? s._useDirectMapping = !0 : s._useDirectMapping = i.useDirectMapping, i.faceForward === void 0 && (i.faceForward = !0), s._setReady(!1), s._mesh = we.a.CreateSphere(e + "_mesh", i.resolution, i.size, o, !1, we.a.BACKSIDE);
+ var p = s._material = new Sa(e + "_material", o);
+ p.useEquirectangularFOV = !0, p.fovMultiplier = 1, p.opacityFresnel = !1;
+ var m = s._initTexture(n, o, i);
+ if (s.texture = m, s._mesh.material = p, s._mesh.parent = s, s._halfDomeMask = Qn.a.CreateSphere("", { slice: 0.5, diameter: 0.98 * i.size, segments: 2 * i.resolution, sideOrientation: we.a.BACKSIDE }, o), s._halfDomeMask.rotate(Se.a.X, -Math.PI / 2), s._halfDomeMask.parent = s._mesh, s._halfDome = !!i.halfDomeMode, s._halfDomeMask.setEnabled(s._halfDome), s._crossEye = !!i.crossEyeMode, s._texture.anisotropicFilteringLevel = 1, s._texture.onLoadObservable.addOnce(function() {
+ s._setReady(!0);
+ }), i.faceForward && o.activeCamera) {
+ var S = o.activeCamera, O = c.e.Forward(), I = c.e.TransformNormal(O, S.getViewMatrix());
+ I.normalize(), s.rotation.y = Math.acos(c.e.Dot(O, I));
+ }
+ return s._changeTextureMode(s._textureMode), s;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "texture", { get: function() {
+ return this._texture;
+ }, set: function(e) {
+ this._texture !== e && (this._texture = e, this._useDirectMapping ? (this._texture.wrapU = Ue.a.CLAMP_ADDRESSMODE, this._texture.wrapV = Ue.a.CLAMP_ADDRESSMODE, this._material.diffuseTexture = this._texture) : (this._texture.coordinatesMode = Ue.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE, this._texture.wrapV = Ue.a.CLAMP_ADDRESSMODE, this._material.reflectionTexture = this._texture), this._changeTextureMode(this._textureMode));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "mesh", { get: function() {
+ return this._mesh;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "fovMultiplier", { get: function() {
+ return this._material.fovMultiplier;
+ }, set: function(e) {
+ this._material.fovMultiplier = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "textureMode", { get: function() {
+ return this._textureMode;
+ }, set: function(e) {
+ this._textureMode !== e && this._changeTextureMode(e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "halfDome", { get: function() {
+ return this._halfDome;
+ }, set: function(e) {
+ this._halfDome = e, this._halfDomeMask.setEnabled(e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "crossEye", { get: function() {
+ return this._crossEye;
+ }, set: function(e) {
+ this._crossEye = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "material", { get: function() {
+ return this._material;
+ }, enumerable: !1, configurable: !0 }), t.prototype._changeTextureMode = function(e) {
+ var n = this;
+ switch (this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver), this._textureMode = e, this._texture.uScale = 1, this._texture.vScale = 1, this._texture.uOffset = 0, this._texture.vOffset = 0, this._texture.vAng = 0, e) {
+ case t.MODE_MONOSCOPIC:
+ this._halfDome && (this._texture.uScale = 2, this._texture.uOffset = -1);
+ break;
+ case t.MODE_SIDEBYSIDE:
+ this._texture.uScale = this._halfDome ? 0.99999 : 0.5;
+ var i = this._halfDome ? 0 : 0.5, o = this._halfDome ? -0.5 : 0;
+ this._onBeforeCameraRenderObserver = this._scene.onBeforeCameraRenderObservable.add(function(a) {
+ var s = a.isRightCamera;
+ n._crossEye && (s = !s), n._texture.uOffset = s ? i : o;
+ });
+ break;
+ case t.MODE_TOPBOTTOM:
+ this._texture.vScale = this._halfDome ? 0.99999 : 0.5, this._onBeforeCameraRenderObserver = this._scene.onBeforeCameraRenderObservable.add(function(a) {
+ var s = a.isRightCamera;
+ n._crossEye && (s = !s), n._texture.vOffset = s ? 0.5 : 0;
+ });
+ }
+ }, t.prototype.dispose = function(e, n) {
+ n === void 0 && (n = !1), this._texture.dispose(), this._mesh.dispose(), this._material.dispose(), this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver), this.onLoadErrorObservable.clear(), r.prototype.dispose.call(this, e, n);
+ }, t.MODE_MONOSCOPIC = 0, t.MODE_TOPBOTTOM = 1, t.MODE_SIDEBYSIDE = 2, t;
+ }(Ao.a), Hb = function(r) {
+ function t() {
+ return r !== null && r.apply(this, arguments) || this;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "photoTexture", { get: function() {
+ return this.texture;
+ }, set: function(e) {
+ this.texture = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "imageMode", { get: function() {
+ return this.textureMode;
+ }, set: function(e) {
+ this.textureMode = e;
+ }, enumerable: !1, configurable: !0 }), t.prototype._initTexture = function(e, n, i) {
+ var o = this;
+ return new Ue.a(e, n, !i.generateMipMaps, !this._useDirectMapping, void 0, void 0, function(a, s) {
+ o.onLoadErrorObservable.notifyObservers(a || "Unknown error occured"), o.onError && o.onError(a, s);
+ });
+ }, t.MODE_MONOSCOPIC = br.MODE_MONOSCOPIC, t.MODE_TOPBOTTOM = br.MODE_TOPBOTTOM, t.MODE_SIDEBYSIDE = br.MODE_SIDEBYSIDE, t;
+ }(br), pf = function() {
+ function r() {
+ }
+ return r.ExpandRGBDTexture = function(t) {
+ var e = t._texture;
+ if (e && t.isRGBD) {
+ var n = e.getEngine(), i = n.getCaps(), o = !1;
+ i.textureHalfFloatRender && i.textureHalfFloatLinearFiltering ? (o = !0, e.type = d.a.TEXTURETYPE_HALF_FLOAT) : i.textureFloatRender && i.textureFloatLinearFiltering && (o = !0, e.type = d.a.TEXTURETYPE_FLOAT), o && (e.isReady = !1, e._isRGBD = !1, e.invertY = !1), t.onLoadObservable.addOnce(function() {
+ if (o) {
+ var a = new _t("rgbdDecode", "rgbdDecode", null, null, 1, null, d.a.TEXTURE_TRILINEAR_SAMPLINGMODE, n, !1, void 0, e.type, void 0, null, !1), s = n.createRenderTargetTexture(e.width, { generateDepthBuffer: !1, generateMipMaps: !1, generateStencilBuffer: !1, samplingMode: e.samplingMode, type: e.type, format: d.a.TEXTUREFORMAT_RGBA });
+ a.getEffect().executeWhenCompiled(function() {
+ a.onApply = function(p) {
+ p._bindTexture("textureSampler", e), p.setFloat2("scale", 1, 1);
+ }, t.getScene().postProcessManager.directRender([a], s, !0), n.restoreDefaultFramebuffer(), n._releaseTexture(e), n._releaseFramebufferObjects(s), a && a.dispose(), s._swapAndDie(e), e.isReady = !0;
+ });
+ }
+ });
+ }
+ }, r;
+ }(), Ls = function() {
+ function r() {
+ }
+ return r.GetEnvironmentBRDFTexture = function(t) {
+ if (!t.environmentBRDFTexture) {
+ var e = t.useDelayedTextureLoading;
+ t.useDelayedTextureLoading = !1;
+ var n = t._blockEntityCollection;
+ t._blockEntityCollection = !1;
+ var i = Ue.a.CreateFromBase64String(this._environmentBRDFBase64Texture, "EnvironmentBRDFTexture" + this._instanceNumber++, t, !0, !1, Ue.a.BILINEAR_SAMPLINGMODE);
+ t._blockEntityCollection = n;
+ var o = t.getEngine().getLoadedTexturesCache(), a = o.indexOf(i.getInternalTexture());
+ a !== -1 && o.splice(a, 1), i.isRGBD = !0, i.wrapU = Ue.a.CLAMP_ADDRESSMODE, i.wrapV = Ue.a.CLAMP_ADDRESSMODE, t.environmentBRDFTexture = i, t.useDelayedTextureLoading = e, pf.ExpandRGBDTexture(i);
+ }
+ return t.environmentBRDFTexture;
+ }, r._instanceNumber = 0, r._environmentBRDFBase64Texture = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAgAElEQVR42u29yY5tWXIlZnbuiSaTbZFUkZRKrCKhElASQA0EoQABgn6hJvoXzfUP+gP9hWb6Bg00IgRoQJaKqUxmZmTEe8/v0uB2u7Fm2T7HIyIrnz88uPvt3f2a2WrMbOvf/u3PvvzP/sUf/N6//i8vf/lv/3v5H//d//Sb//Uq/5u8yf8hV/m/5Cp/L1f5hVzlG7nKJ7mKyJuIXN/hPwqXI/g++zq6rPI5u8z+WqfLre+zy7PrVv9L8brsMiGvk8XLmM/sdfHXal4e3ad6GXPdyu2ij8u/+uv/5cuf/OSLfdtEfvUr+dnf/d0X//t3H/7bf/hP//N/928h/0Yg/4VA/kogfyGQP5Wr/IFAvhbIlwK5CGQTPP+9z5uPeePJSW+yo2+s/GtN30Rnv1E+f5zxof9R/lSXv/nr//mrr3+i+5dfyX7ZZQP07Tffys//8R/l/9TtX7790T/7r/8G8pdy+/8XAvnnAvkzgfwzgfyxQP5AIL8vkJ8K5KsmMVzu1U7p5PA5AXxOAJ8TwPf7sX/51ZeXfcemqnp9w/W77/S7X/6T/vzf/7383RWCX3/z05/9i3/13/0PX//eX/2FyP8tIv+PiPy9iPy/IvIzEfm5iPxCRH4lIt/c/393//9BRD6KyKf7f488fP74/PH544dJAF9cLl98IZfLBZtuqterXr/7Dt9982v95S9+Lv+gF/3i7Spv/8lf/vnf/vGf/dF/JfKnIvLnIvLvReQ/NEngn0TklyLy6/v/34jIt00iGJOBlxAsdvv54/PH5493SQCXy9t2ueh2ueimKorrFbjq9eNH+fDtb+TXv/ol/vHyhX4Fxfbx7euPf/Lnf/PfiPyeiPyhiPxxkwB+fk8AvxzQgJcIrGTwFsiAEXH4/PH54/PHUgLY7whgu2C7bLqpQgHB2xvePn6SDx8+6G9+84384vKF/IPu8iVU9Y/+7C/+jWxffiHytYj8VER+X0T+oEEBvxqQwCMJeIngo5EI3goIwVMIPn98/vj8ESaAbbtu2ybbvl8u2ybbdtluSECA65u8ffqIDx8+6G++/VZ/efkV/sO261dQXP7wT/7kX8vl8qXIFyLylbySwe/dE0CLAr65B/9vGn0gQwRMMqgmhM/J4fPH548eAezbZd/lsm3YtssNAYiqiogAAkCvb5/k46cP8u2HD/rrb7+R/2/b9Wu9yJe//8d/9Ney6S5yEZFdRL68/38khG/uKOCnAwoYkcCoEXwkEgGDDq7CeQfyOTl8/vhd1QCum26ybZtu2yabbrKpQvXue1yvuF6v+vbpTT5+/CDffviAX1++1V9sO77WXb/66R/+4V/dgkbllQi+aBLBV/dE8LWRALwkYCWCNyMZXElkwLTMeMkga/P4/PH547ccAVwuctkvdxSw6bbdtYDbTfSZBN7e8PHTR/3u4wf55vKd/nL7DX6mu3791U9//5+/gkNFZGuSgZUQvnKowKgLWLTAQgRtEniTuEfwaELw0MJvf3LQzynud+53uG+X6y3gN9kul+2y6XVT1U27JCDAFVc8ksAn/e7jR/nN5YP+avtWfq6Xy9f7Vz/9w1dgRYngiyYhfNkkgzYBWHTg44AEMmqQUYQKOmDaiCIa8TmsfmzB+DnZDQjgcpGLbti2y3bZHjRAdRMVvb/dcYU8kcDbPQlsH/CrbddfbF98+RPZfvLFnAQeieCRDC5DMvju/vmD4JkEvjRQgKULeGggowdHkAHTYxihg89vu88I5UeGAPSOAFTlrgPopiqbKPSmCKreUoAAkCcSePukHz590m8vH+WbD9/JP335k6/+tA86KxFchv8jMvhiogE4JQm8XhfKqOAqx5qRPyeGzx8/cgSwbXcUoLJtim27C4Oi93+4v6VxQwKAvl2v+Hj9pB8+fZJvt4/yzfbF9lPdv/wJnsE2BogmyeCRED40tGFvksIXiSbgiYSRRpDNDZ6BDI6ghM+J4fPHeyKAO+zX7cb9t4tedMMNAQju5V+f1uAtBSiu1zsduMrHy5t8ePsk3376KN98sX/xE5FPAnm7/782o0DiUINXMkCXCB7/P94/e87AWUmARQWVvgMuKej9t1RLBp+Tw+ePgwngsutFFdu26WXbbl+rSvdfbnqAiuA23QcBgCugV1zl7e1NPm5v+LC96XfbJ/1W9y++fgXjA3bDYXV+MuhRwSPwL3JLMFYC+HS/LU8HYrGwIhwyNOF12SvgM4SgztdifP85MXz+KGsA2C6X7aJ6bXSAOwrY5OYIqGy3d5uq4P5GhABXuV6veLvRAf10fZMPb2/y3b7vX7+g+9v98/WOBq7GG7RNAlYy+Dgkhhb+Xxp0sE8IAC4SGAP/TbgVJK/PoJPBnAiwPKxsXfbbnRg+i3s/JAK4Q/4b9NfLtomBAqCickMBjy7BuywAUVyv8na94tMjCVzf9KNcLl/0SeA6oAEYb1i9g+FtSALb/bKL8/+t+wxXFMyswqiHoK4ToIgKqslgpg1qUC0QoYbvJZg/B/q5v4szHmPX7YEAsD0CX25OwEUVm9xag1+agKg+nxQArnKjAtDr9U0+Xd/k4/UqH7bL5YsewrcBBiMJZPRAp6TwQgWfjM9vgRbgUYGL8AvLWH2gqhesCokeUmCSwPsnhs8fP2YNYMO2XeSmAWxy2VQaXeDmDIhApf33rD4PTUCuV+DtCn27XuXT5ir8VmCJ2G5BpBM8/r/dEcJb8/0lEQMtJHA5TAlqNuLRhJChhEpSqFabH3di+G1AGj+W1/dyAR4IYJNNnuLf6+tWC9CHHiAtFhAIFLjK2/Uqn65X+SS67aK+3QeTDoy/IG2ogQ7fb/dAtz5vBgrYGqrwNtCHsVfgIvwK07OTQBURVNCBFpKCOjqCHn5L/67TgTN+fpySAC56nwSUi256kXsSuFGAVyLoUIDo8/Pz7fdoErr/v17lk162HbgHvFpIYDfoAJJfW4sGPjkU4VNAF8ZEcLmLhdc7kljdY1y1Dq9yLiI4IiRqcLujb138KIPn80ejATwRwIbtBvn1cqv+2J78/5EI5N4cJA8qIPcmwRsKAHDF9WYP6mV7VmrgLuTpxYTcMEW0LAmoQxFsuvAI8tv/a/C5fV2ZMMiKg++FCM7RDPRu8ebWY7VG6VJi+Bzk35MI2LsAckMAgwvQ0gC5DQjd3ABg2HQLAPpEAlZ1Bu7VV7MGHDFRAbo3VKsTbAY9sPWC/uvx86gBbDK3D1eEQS8pbAeSgSwmhepnJb6uBv/o/PzHLzxWA/X7TH77De5j6AGQi6o0CUGfCOD2X7cXAlCFQABtEsGLDtxuOyQB2UTQBKZe5GUPXgkUYCUAbZJRhBDeuq8xBf+bgwbehDm+BFQi2IJksOocvA8ysIMfxluVcRsY/eB3JzH8GFDAXQO48X/dcIf9jyDHptIigDsFkEe066tBSETQUYF7ElDdYEBytN4+rk9UcBPfrKaZqFHWcw3i4J8/X4ev2//bSXqAhwTay6OEIPLD2Ipt8OtAGzxkwLw9WVFRjTc/qC6H3+YK/b1oAA0KuOizHfieCLaHHiAb5NYTIC9EMEbZrVEQt1xwhVy1UfBh8PUOquMizwaap3tQXfY5B//tea/NZdfhsvbz+PURQTDSGWB87VX/7WSd4KxjUqrIgE0IUkoKGnhIvwvawpGf6eECXJ7tv4qbA7DJgwpsKthEmmYgfaAAffYF3HLxo0vwNjJ0SwRWMG4db4eh1gPNm18vQ+us/0eGmxDemu/fnM/X4evq/8342ksGHgLY5LyT/zg0wM8lcMjgGFXwqIOVFJBQw99eCvF9oZL9Mfl3QwAvIXDsBRC9R+fz8x0FPBLB0xJEpwUobrfAkARgIAF41h3wQgP6QAmX5E/7eI43IxGwwf/moIkRyWRJQIPgt9CA9b39nzt4bYUWjAlCjWDPgv8IEjgLJfzuaAsrv9VdVG4OwOXW/fdoA35qAdL0BDwvf6AAUVHd8LIEu94A3K+Q+2YxaB84MOH62P//qoo38fCRDERE2zf0JfmDa+MieElAjcDPKz+mRKCOtdgGtXaBjgNJ4H2owSpNeAW/rRH4CaHSpMwnBYYycjgSJwfie9CR6mPu20Uv8kABF206AvXlBMiIBPSlB9wjBW1fwEuSb94296VCqgMaGCt/G1BbExi3IG+r3a3J6P48Gv/J0YmEYoiGY7V/SxwFCwGoE/xa0AJ0CEiV9QPCJb1OJ5F1VTjEY2/MO9AEJvj1BJTQpqLfTlGwjABuzT962e4IoKnyrdh3+/6mzDVJ4PHOxj0JqGKoy20+wBMN6D1gLWi9NQHfVP5MEEPzjGYy8BMAOnTAJgEr8HUIejRo5xrA5xkR5AngmiSHs+zDDAmMgWzTg55GSJEmHE8IvWPAoYTfhWak/Wn/bQ0CGLSAjv83SUEfKp5q24LXuQICpzrjrgWoza8xVE00CQCORdhMJuTUT/rjuls0gO4Iby8BIEgK6gS7BsGuTtDrScH/fR68biUHNVGBnxjeNyHEvQe/ve3LZQqgG3rof6cEclsNflG9J4KtaQ8WHcVBHS1BtHE4QP9OBMS98mpbKTeDW7dJwRsnHpMBTFJpV4I+b0kY/NqInVFSyBLANbnMSgBM8F+Fqfxq/h657/Up+GaBnwV9hRqc9bZ/vA6vu+T9E8KPJWns94UfTeCj2QXwCHS9dNL8Xf3Ho/rfewSeFODGDV69AU0y6NFAE1DP3qK++rdB7/1HRxf86gT376zOr99T/h/ioBiXWQkgQgVeIrCC/WomhDmQK+hASI2ARQZKooHMLdCJwGEBBXC3+uERwg+VOHZ9ioAt9H80AI06wGgJ3nQA3BoCut6AhxYwgcPOFnxuFnrphk+NIKIGrWPQtgz3b0i7Y6D5rs1GKqTop0nQX52vmQC4BkjA+r4a7Kx9WLENGeegkhSETBCrNXIMdi/444Rw1n6E96ry7OPuj8UfLxtQ78NA2iSBbg7gIiIbdDLsb5agPhLC3RkYKv8NDbS2YGsatNRAG2oQwf9ZIOydgy1MAzBkAw8UwEEIDzSAqdPQ6za0PkeJAMH3Z0wXniUSZoHvBXU2mcjQgv56TedIKglCpIoQfgwCIjOytd8WgN0bfxoR8Fn9Gx0Aj5Zgq0lIZbsH/ibSJoFnS+C98g9ooHEELI3gliy25yONIiE6pb0NfBlyNEYyENoodkKwgl6I6s8kARgJ4ZoEfuYWHLEJa0LhSBXm7kImGeSfVdoJ1DO2G7WXsehAptupSOoyrCSF904k+6vt98X/ZcM98Hsd4JYIXhQAIg3/f9AAUYhsLQKAtkHVBnzjCKhOoYl2ym+iBtvzDzQ2DLXJ4PUmbJHAVnBQX4jkxfvHhNDqAdHXGQJgv0aSDGItgOseHIU+K9hXnIJzkoGlEKzNHagTdJ6VWEUH4iCKH4fd2AwDPaYBm4Wgng4gQ9V/CoGiuNmD04AQtNGMGzSAAQ2I2pzfogY9LRh7BrbOh4+D30sAencljFu2CUFrwY8UAWRfWwGvVOVfbx2uIILM0pwDv082dUTw8hYs8L+uIWiHGpWgClnAa1lMPJogovvvbePPs/q3Xr++kgCsfgB5oQF9WYKPJqEn6G+OE3i5AqouF59FQOmahQC8rlPLj38kg1c2f30vw+XaoIX24/pMGIgSBoZqoH3wo0sIIGlA9PWcCPrAtpPB8eBf6x1o6cHra+2+tpIFP4PgBfxZtZUJfo4qxELT948D9ucK8Mt9+ccjIQw6QJcEbrD/1g340ATuDgDkFfx6twSf1f9xvuBECYxq/7ythQQGm+5JDx6Brw4CkMGT3wgscCUoQ4sU2t6DR2ciBjTgtcpenQoZVX9NuL4Owc+dVaDursYVkVALX+shjSBKBuvCYDUZjE5BdNkxdHAUBexyHwB6NP7Iyw7sxUDViwge1t+mz8B/LAvVx/c3PeBBCToB8IUGOgqA3iV4yUg6UAOxaUFHDx6CYS8SorMOue0CCJGAf5YfRhoAI+A1CvwxqNkAY5yAIx2EQmkFfeWOXi+nEdSQQA0ZHMEItiagJArQxDXIrj8nCfQi4HZPAttrIahso9oPQ/2/JwV5JQU8zw+7I4D7/sBn4EO6rjw0FR+i3Z9fHtahzsFvJgM0X+tmVH5vaYiNDGAigewAz+gyNLThnjCURQFR1b9d3lZvnVqmj9mEPDKIUIC4KCCjBXywS4N+otp/Hk3QVthOkwEKlV9PQwXjT7s/zwF4Qf9toAAzFdjuaEB6S7D1//U5FIQu2MevO0rQQH8ZmoXE6B/IkgE60XCjVoq8gt2iCG0S8L5GdxkM1cGsfsCMArSCAnrr7dzAZxCEEpepvB8tqHJ/q+bmJGGts/AcAXFOMMeTwC7Pw0B6CtCtA2vWgonqBQJFSwH0JQK29OB2kvgj2HHXAoyeAIsCQO0kMNECAhFMqCBf8mElAkyBbX1tJQP2RJ/ha0gpAfS9l+/5n00CkrQpq0MZbOdAuxmMvHswog62jZj7BnYQe19b14kxNq2D/ehX/p68HEcF+x3yP7z/V/A/q/5DA3i5A/dzA5pdgbKp3v3/wQF4Bb70WkCTHGRAA6+KL0bFl6FJaFw0ImZwm6igSwbbwPn9RMBWf3sN2JgA/BVh/Rg0kQBgePf6HglAHLFQwqQQOwDjbdVxNZjR4iM6Qa3WxwvNxh0JFb3g/WzFQQS8b/ttKcDWoABtUMAd8j9hf0MB2uDXhzX4CHj03L9DBU3Qjz0C0l4mLSLQPicOOwZoVCB6P6dA7nDbGkVuxcNr8PU2JQO4wX5trEqmccZaHU4q8oCDFOpzAnOwqyMIMktNNNAHouDGxO37DgArQZzlmp/14W1QlqHTMaIIx7SCx0+5yza7AKJ3IXBrNAHVDcMZAU/BT/vgv/ULPOA+XiLggAREDF2g0ci6xNDRglegd7P7TWWH5oJfayliEg7bScQRBVgI4Ookg/F6rvpLWP29swREqA3CaG8/FpKqS8DTAV4TiBqIqtxfzaQRLys5I0XEFIFrPbZRQb+16Fgi2LvJv8EFUPW1gGfQv1T/F/d/HBnccP7rAwnIIyHI4ArgWeGbU4eHy6Tx/EeTZIb5bo/BsMBjmjBE08f/RB0PHYBd9eVRAGY7cHRwiBf8WeCPHY1bgBTa9xKTELzEkQX9CPtl0gJiqsAmCT7I8xbjivh3JGFI+D2nBcSJQJ8agDX+O9iBL7UfG4bzAkcaICrbtYHz1ycSmGmAjJfL3CMgT3tQpmrfB7gxSzC1DnvdhQMieG47u75+kTouKNkM8c/+vq/Q7ZYjO/hhVvRq8F/9gGfhP8aqE9EIdR6LTwJ1h0BItyDqB8iFwuNqASscRnYioxOg9ApvnYA35f8e9Ohbfe8J4rknoFkO0lmA2gmAG0YK0DkB4ieEjiLoMD8wBzom27ANZkzIoU8EMHk/uo1mzeVoEoRWKn8L/62EYAX/lsB7D/LXg74uAMr9oGivJ0CNJCGD6i9DhZdQF+gtOp4S+NODRzsDVbhdgv4BqTMNyIL9SCKwL9/FGPp5oQKxIf8A/UX6r231H7YIqLML0Ae2GtrADOvRQH5b/MPE9dt9BGLNG8jVTAQvIaK5TtvvvWQgDvyXIClUA78S9Nfg7VtIBlO7cbsEYkQDMot+ygQ7QwmOawTHnAM2XUSnJvPIYRYMmYPS+sv3J+cfP3d04JYIXsF/EwMbBKB9Q9AY+BiSwFj9mzrSXmcJhFPVHySTbgHJCPvRQ/z7G/SVUETsg0ZF+i3CRoCjhf7y1A9mOiDD7TwdwEoEXjLwAv+avLE2B7Jnb+OqDpBoAchoQJskxKnss0vu7Q2YhcDv4ySeLOg9GsCKiUIihP7yfW7zbTsBh0TQfN0iAWn9f72Z56/Ax9P7j5OAH/Qvv3/QxKfk0DgDuP+R3USg3bzBC7bO/QT9Eeh9QvDPG7glBQzJwK740lAFFgFk8P88CqDGAa223YckWYhr+c0BPdwetl2ocnsfzePAWcVnnAIp6gDVhDLyfV4nqFEDPxHsbWD3k4BDkN+pARqKMLYBPzYEvxp9xmCHQQdgWH/9EtH2TIFpu3AH/cdGydv1j0TQbRrq+D/mLcX3ZACZ15bF378CG0My6Kq/zoGOQwhASDFwFbxyNGBuSxbCEhQ/uEPe/6gAERWQObCVVfjPpQX+rexxYhYFxIkgpgX7Y/vPs+Pvxf9vwt8kAs7i32t3QCP+3SPaTwIytQXP38u0PESm+YER+o9B3vr8mETAUfDrEkPI80ck0FZ0dXh9U+HRbhey0cAc2H7A4y4egoD6y8JfkBiigLdFP8v2W00E8deT2IeAKujZ/QAVKpAtKI20gLWksHedfgPcb+0+NEHefd9vB9rayi8h7J91gBbaw20MsnWAF5xHkyDUCOoXp+yrOwwxcKj0aL6fFppaaKDv6OpHR5sgx5BAlK/+fYhuP1D196o8e7lFBaKqv5YIMnFQpd0FGVR35RJCnCDaABaXBtgbiSwtICMtalKC+1JQ6bx/PLcDPQL91QFodQNKpwOgF/9eqcBxBBqRcKAAVk+ArQOMx1RYGgB6naDhlK+uQQwJYx4meQbxtNnYQwMjt/d4f3M9ZE4UOld1LAh99fbfzOxiEkKFCkTJIUIMUeVnJ/9sDt8/e1NEJOi9oVHDGYhgnSLss9DX2IAqw1zALUncKcDr0FB5NP+0cBQNrEezDiyiADPkt9qGpwoPdL0AGPx/NOKeyf3b9WJNdfcFv6bKd2cLMJVfJ6Y3B6wB9WFUfWWEwKMfGiQL+3bz9XGQz2EHKhF41GCtZyDi/gUCsNhYoAr3UNJ58YidHKqnMb/6AB5J4N73/4L+t7mAkeeP3P+1LNSB/l0SkMEd8DcEuUlguEw6t2AU/PCE/q++Akw6QFf1u6SBrj1ZnnhG50AfkoGIdf7gJv1KcSfgzWWkQ9U33Z3tHXYASKJ9e/YhU90rvD+q9Ej69/wxYJVs506Eg/r3DkMDzEdDBRGgcZay49XihLA30P+l8N+hf1f57/0AoxbQbwYaan/rBMirE9Dk+sBzTkC8JNDEUlv5McB8PP19Y01Gayep+hC/2zvQ/2HGLAurowsNGlA1cnqGGzeH5weiYLZm7h3QQC4O2tXdhvMMk1ZS5ebpgI8eMrPvPGkwaxayk8Yc6PMOBPEdC1XZ+2UfbfOPtxLMQQAG9BcZFoF0gp/RKjxe7+oAw9T7ZPWhgedodgz0gf5KBtrtIZhQAZpAV1Bi36w6t98qVfH7hqGI318lLCjLCUFlxRHwqYEH9a2qb4XjWvDT7kBwfbZA5P0+PNuRuW1yf4yNQH3zzwv6b70QOJ0G9OT/dhoYRUGT15uQH/71MjQLtQlxfDuiCXrtM+SkA+icQdH6sU/xz7Ze7FlubV4TpoTQ2osdpaEjtqADmEU7OkBEFoLeC3IWFFeswJXKXzkboNL+wzcFHU8hTGKIboO7CLi1/P+5F+gydQhuvRbwEgxvtACmANikhLTbj0gCYk8KdlYgmj+4Ymaod7TwahwadICuX0Cm2fE5iNHPK0x/CDV66Kyg1MnqjNFBnhBoLQCgUULfaVe5nq/6EQWY67bXCszUb+7232fVPz51iGB12owK9peyP1T4raMFF/OEYJP792mgXYfZ04GHMAhBkCSmSj+dKqRPgVFGHbpLEGMiGFeQWfSgrY52VxaeDUPSNJI0P7NoisG729HHl78z6hxfs9rV3m4JjgM/lsui2qmThjCfDFSb+I9vwUqG5wwL55U7C+6ot8B+7N2o6r3q37T9trfpjgmTvv7PSQATLLeRAOZhIJHBQfDQQJPBdUwEbVW3+L08EcEE/9G4ANrCeWcnPKRHDupbNynMx5AA9IRYLmrc/YLSiD5EaEBS/s/TgnU9ILcH19n+CpHwegLejx7Mn/d25fdN+e9U/1vgb7bqf08MOtf8EXxaoh+GY8L6gDfhvs4i6HQ7seYI2sv1GchdMsBIG3xlvxcCRzdgCPTn+6q/TW00VE8Q9FaFv+R2VlOM1vm/hhjhDCdgNflVKME5B47I9xT8z0YgPAJ8myb/LqHy36j/Mwqw9AALxuO1JVjiuQAYLcFzIhiEPe05fk8tRjGw7yWQbsfuLAT2VqOId1osnr0F49VM8INACPHDoBz4B5mqqSnUgyh3ArjXxfQH5BbgUS8gP7aU+w0zHD9GGD0CGHf+P1p/DeivlhU4BbxR9a2kYFR58YaDZCUR2P0DMmgED2eg77puegy6PgDphEB0CwlG/i9d+/Hs34pBEQrBn0W51mqGnJAk3ACCHeiqkQ1XFQA5AlKH7Lk8yJKWY3/nym14h2C3JvxeMwD9ZVMz0BPMi1n1RbKl1cYhIVblF3G0ATsRiCMUvoK9//OgcwYMoe+ZKOLlC6/Xk50br9NFz9fanqA8UIYSpCwlBO4kHc4WLLBfBHVaKwKgLQjmP4Un61Vq+3s7Bsyi0WztmLjJwJwFeE0I2vD/1Q6MVwefxfUf32skCPbCnxQqf+QMPEUDHZ7vGeyj020JgkPXXwsldA7SYR1RE3h94NvNtugswcgxXEkIcBPCGZ1rmrgDC0A4K88nm2fn/eTnpQtWyZfybRoK8Dro4zYDIMGsf7saTBzvX0SMbkAD6o9CYbsfMK38cJKD9l2FJt9/VGs0h5Gib33pxMKWNsigFUh3G2un+/N1WUglI/EEx8fq27vUNnwsiOoKecL7kQS8VnWAGCFUgn6dBtQhv40CmIYggwK0uwDHRGAuBXVdfwzHUjZzATLMAoyJ4FmBhzaWBlrHld9CCWpPHRqofBqMReMGTJ78q9rDes1Tv7/0m0v0AFHXNR6P6g30SHivin7V1BOhh3iWPwvps/yE836L2XiwnUT8x2iHgfqhnwn667QHEE8oLQjEvtEW7GYBZDrDVkwNIO4G5GiBDf9fGoFM6n+vbEtzXwP6u9AduaWnGYSLAlVdl/AU+ikrSeEIKgwdaZ4AACAASURBVKj4/wtgHcHtdO2nWKcBkPfxcvnNQvsj2Me9f02r76T8q0IBn9OLKfz1HX8yVXQYGoAB/2UeBQ5/5kCL6+H/OGGoRnLSwdd3oH8r7KkGTbgIxEwVWvnF8KOpHnyzfF9Jod5Px+IF1h8owyitDw/XEgRb5bPqbt1uvn7qBIQ16vtS/u+DP3cR7CH0WWJgd5mTJKYgNzoGjQrfvu99NDBC+bnyW1x/qhTatv2OaMKgJWPvv5kwnMgxHYGFRtJW8VMl3uP+MgoqSZyWFKr7+KIDw1d6+IiOgZI4+d5iYL3imzbgyO+tph9t2oSBxOM3ugHtPoFZ1LM0hF4kXNEBssvVgPdjdXZWK7uKvyS3q1Xb1WQwtVDqSUggq+Vw3t56JA2cz7PXOwGNW1ecwxPhfe3QEUsDsFaAz8jg0nf+iZMAHNg/XSazDuC18Iq1HBRrOsAQ8NLB+16g614jmuSgs3bROxE55D+WDDQNA4ivdMJ9M1b309UqknaDU8ObV9/PwmMPATvTMAxpABLBzugUtV9bLdhNDQA+7B9tQJ06/7QNDHGSwtgZOCIA47InIoDdROQGtt0U1HI3GaoUnCnC/rzBMQJteN17+VaAzYNA7e+PFqHQUyXPUYB7iQYa5ZFjq1Zqpx8Uqu/XT7+6BWC1Xaj0GlBIwMoHu7UzcI/6/Acb8KIq+hzmGWmAYnADrIpvKP7TZeLaf0LAeQkGgebbq9FToI44p654F47tekKkI0L5PQNZPsDwPBpy/ni+wKMN76Vav4+2cFZFf8+JwAraMt0DFB7beA/u4Zz/a+RXx0M/ct4/jwaNAS8G17eSwmta0Fhx0VRxJkHMivso+onMXr+YwdWKbgioy1jp4x4AzIKg5lEA7wvHEYCRmdx11TAuT6lDLVl4KvXkAET9P4RT8H2u+lg9EPQIpw+/NpJ7RwE8HaDv/Mu4f3OdNkq/EfAiEiOANjEALvcWL9gfFV4NZbgbQc6qPky4Pm35QZxtH1f4j+P/jXuaYPcWwIEH/fmEPBoAO4m4LGxV3txOQqDU+dXgey+UwSzuqP++uImO/u/6ogCb7wTc1n61sL+vZi87rxnrNas+giTg6QLzaUCjIp6JfhwtGI7AjBBB9JjDY4ePYVR6ZPgN4owVv6Q2N5hhVHwNeYrM+w6dN6K1sMHZm/Ce7bHe3dzKr1xw1w4JrSQMZtgnoQHlr18fzunAszD4qurNUg/TDqzx/lfCaO6t4tACMUQ6P6htWjDPC1hCoZ8kpODzJ70MUR9AODcgwyqyPhmE+wfHYB/hvSqt6qeXUShhXH+d9SR8DzrDaZZdpSp/HxqLMQuATgDU/qDPRgOIeT8cvz/h/XC6BtE7ACLOWPE0KIS4UUjmZaJ2grBphiWgT41BUVWZfP3AnEIT6OrfoF122l2rMycBoU5i/OXoUZ4/aglsXwLzHNU++FVF3qikOj5HXm2PBitT1WuvJRAB+6O//W0/PY8vQH5IrAsMs/WuVmAdHBrQgrbOxJShXwRSsu08h8JMBpo0+aDTALwV4tbswgzHrftG/dJKIAQb5h9KCssWIMeto+GYqG12/HWGjx8kzqNJaa0noMWOr2KwW01AMwJoNvhMQda2/RKQP/3ecABM3g9uD6BY68Ntz9+nDOMb5iV+hIE+dP/Zs/wwJhJ9mgBnohBuStABUXjugF3hkXF9ZZJAjefKdHZCc389LoStKvIl7QIEb1d9RyciQgFDI9Cjyccc/23Aam7/PZJBhgDgin5CtQvbCzX8ip9YgIFtOAt+w0owp/hOiCWgEGbVHuYjRigPGR/YOnEoqPDoV5z5YqB3mRq2ox5ICmSSgAP1Ne+XV2NE+/vuFbCTRADxtS70VRBCjgBk2OyDUQiUgfl77b7DwaHm2rAZ7osRSOOUoHgKfNBSLI767+oDYrfwZvqChSpGfj3pFwZFsCJg2jeIQQBUiyI4WgD68ww4qO8khuWkkIuDrxWv2nv+UTBpJYiPd0KemTA8qqFiuUF1jWS3BoG6pADJq751JqBI0wvAVPyMQvjcX1zbELltKK+zBiXRFiRxG+b7q3M9xuLdzR8g0gCGNzSM5gNYfqGO9CBT8OHct6oB3KsSDBisUnwsFuISQaRHxDSv0vptt2oeLHMERfRn/FG/Cx01EpgIQG8LP+/i37PKw53xn6sYCM4/JwSRrCnIeB1ZkLsawDhaPKv/njU3wnZ/dBdGE8+YTHSG8+ofGgIjsC19YnwdM/KAnTSsqj6ig7uGgIPw3nYFzhhIIvriAxFP9CQd4HSlnzgxONIdrE7A8ZDPx9fjib8ifgegNIliRgdx95+E1T7+3nQVNNhEzDgGA3T2rEDLduwtPpuuouPcs8swwXFjdTaMKt+jA5gUAQPcf95KJQxYU0cYxEDvsBSmYuukp7AwnqniC9Afa5z8vboI68ImT0t26CvwBzSggkj447r9IojvCn7U92J/Hw0QSdwZKNNjxPCfSxRqnATkdwpOwh88oc4J8KTSm/wdbZjrc+4iFP8YO0/5JJDCfaijK5xVXevqfg6zGRrQf83chvX4aRfAE//6vv5+6490U4ADdO7QgM/5bcHP/n4OtCQhBEFeDWSvos8DPq8/IwzLzjpa8/U6MMSkBklDm8e0mn3QIY7XG1Om8wzN48y7HwhOK3P0/ZwUQHHv4psbdoVeb9VlAjChBCdtDDpOKTh9ZfcagOYq31RFjN4/gwBYzp8lAwYNwBELhZoxECeZxMlAzWGdCRV0fQWGHo8+8Kx+AAxnCIzowAxy9KvNepWfsfp4RR9kUrD88CPVTuXRybhqqTHcnxEGndsgub1Gdug8yz9fHt3Hpl57x/mfCOC29FOSQ7/noAZR5W3Ob24UMpuPYAYiQrQgk1gnFoUIKr4vKFpV15pHUJO3Y5rfH3UFHU4bGkU+NKJ9f2hJyOMxDBDpjAgwiYqvk5TqNl9EH2Arb6fA3yaA4cBtPWewhkEcIQJBlGzYp6zRmr1v+e3Fv27xpzvyI44NGDkCIi7CGNV9Dw0M8NtHC2vUwHINumCGNG8erxOwtQINsW88Tlwdoc+F85nI559ngEDpt2F/Uu3hiXYrkN/pBFS26hYDAkFgErMK67y9mGBA3L5ore5izf8b3n805MOq/t7XU4WHv1DUF/5gugCSOAIW/59uMwl6CHWAib8bvfxWl9/rBGEMTTwDfG+ezEYG4yk6FvRPuPwE+wvc39IRjENWM+/cm5b0W4Pf4WuKUnw/vD6eDbB1ETs5vl77Dhnm/51g6wPWwQAqxnivgQaeS3gy/u/1H4hpTPrIgHAN0mSgXUX13YP5PMIuQAfBr/f70cdeE+QoCX3i8nFMLcAjInBoAIYqt1LhC1WdtvmSab28AYffaeivCB+ohdYQgfUa/WS4ToMsNLHLc9nnvPZLwn1/EefPVf+U/xvnCVSEQEkEQEnEQJO7S7RvYDxNeNYKrG7DKMhtsQ8cMmhgPKKKj+F7CiHYFR5KIIPxOmg5IVAtu3ACQSPh7CzUQOgAej5CWEkIe3vgxz0ROGO//qYfz/dnLT+ZxDr4QW0eNCJBorCFOVC312Ec2TiY5Bk0cAaQmiA1VH1MOwDHQ0kHdEDDf+2UTWhS4Z8diQMicLx8MLBfverLcP/jQzF0P8EJj5+NGK9RCz755S6F/f1+X/gxeP+Wsedv+vF8/54aSPJYFjIQd624MDz/UDLQnr8HU3ztKHRf8Qeno1vyAQJBaLcMtTV3cvgP56COCqd/QP9xLgBkH4BxO13n4hNUDtACC6G1S3zqooZ6Ba4lp/zcAFb7iERKQwQcF39IFJjdXECGADw0IE4gg674pYAnk4HoHPx54tD5daO5vxrugSkMjgiiqc7TVKAT6AT8R4ckbHEQCYR/IZBxJgA+XZjsR7vaoRpIxWqeqfXuGC2CxwudicwePEB1kNkaZCuwyF0DuKv/4sz9mzP/Qxdg3BDkBTMC8Q+loD6UGBzx0Kz6eAX/KArOQTlPHFoI4vVtf4rNuLrca9edRn4xBP7k8w+9AgZCgBfEUZWfEs8iFNZ3UO7TqmkjCO/rWdgco/yIqHcQWaC2EGTzgz5y/iXQAvyx3riyxxV/JeBriaGB9OrTA5g9/eokM+37GszqfA/UZk9iW5UnCtBqBl3XoNN6Ag/+zy6A5evPAp+TIFDn15gQw9rjrOzFX0s2JBVAxa/nP1a6AsNWYGjPNGPLTQgBsNUFvOA3Ht9o/rGDN0tWOCcxJGp+f7++kkP7PxcGv1+GjkaLt/fawpwwerQxBJNW4b+PJsYEgiAYYdEAGIlDNaAbRkIgK3ut0jKByp+8yz23X6GttmBmjwDvChgiYLP5V/zhH6/110sGcKo5CkggCngxnIPoPja0j2B+1BRkiYJiviaLJqghDI63G2nAgAxMCuDdnoD0wIQm+urMB3VuAwbBrFGgGgnhAFqg9+ujKsLxB3qGCQNEEtPinIQlAj4WgIw7/iXc9V/x/yUWFs2KH504bAh4aYWf4TrTLGTy9YbftyLeVOWNfYNyt/ji29mQnqMAltU3ioTtbX343yv/1u0YPUBz6zB702tQucnX0gWaFh6DgPdmhXaapGotw0SFz1qDiTMdd8h45HfcqCPRUhA3+NmKz1l9teCPaMd4urGaewRitNBDdahR5c3AfQmDCFT9vmtQEwqAYXX4XI2n23Z9B/Yb1FL+LWox6wHGbZSo6FR1LzyG+3hriSZvWT6jfXhl2cmQZJDrAbuYAqAHo1GA/EOgD8eGcU7A8eDvH4fQBuAhBL/Zp/vamPTrRENDGLTV/7E1WEPLDlP/PwzU4YhusIMUgfIPAr6Dhv5R4y2r8ldFwiFoYHnmr8TAHbhRQSZOctH598ZYhqt6wP7q/ouqe77RJxvzFYaji/z4vna4v5cUMDXqDAJ5ytktqtBDckyjvJg04hl16LB0xFfyMfD77PZjErGQRRjYIfSvoAXntks0ok8MsUC4KARWnYPlJBeIgLeFrUgDOHYCag0/XNAbWgRwQuLAsaQwIhC1g7+jCNKuT38JfnYSyTi+QQEwwHeT4/dWHYxJPxfOj5oAnRQqgU3YgGZSOaDyK3n/qkDYBKptzR3oD6B4fyRKjp2AzSl80YR/3P+/1vBjX18Jbu+YsrMRgbqPP8zrDLTAaupphfeZtyPs9BPztpLSBZjowF3woYRwBwOWaqbev15b7X4RWsiqYiY6ZkFEIoUwUA2OrkeEQE8HYNyD/rl3m88jCGgO/nPW3xy8x4Q/HBcM1dYg5q8N+B/SBSYhtD0EY1PRGLDoKIBHF3yLz4H/gSYQJRETgqeB2d4vC8L2NVnQn4PoVJJAcP0inahAfdXVI8CFszjRagCTtRdV7Sr895NBpRKXIT64RMFw/iw5eChhEvmmyUIH+k+Qu3cLzOAN6ILlFvgWnx3YWFDz0f38ze9GlfP6UQ3ojEY0gtqRIEbA5/WgQFhsEuIeL75uTzvqHktAWfj/OD6sQXssROcGiRgFn0QVkld7OznMDT7CJKzhMIqxW9B+LCOQdH4uyxIcE49VTSeLj0wKjzcp2oDXQA8YoDEGBLMW0BJw+eAxXejPV/IXd59/tp5rVyYXDw5BlRetSpQAcvgfOwVM8ObzBq/AQ2wX4lwkQV3vNhYFfn2LFgaoDU1ogqsfqGkJYmrj9Tr22KQwBLzbLuzDeA9yzyJjVRfwegWq0H+FThDPA6ZhZwX2M2Kh4waovCzAWJTzD/qY00c+6PM8coz08VNqglzx54LfHuTJK7z2rwX35ABLg1DzsZ7Qv7l/f2yXDlbf4C/irg0MJ0aCuD0wP74MrxfdFlX7tq+vtRdCpvt599EG9Yz3V+P+Oj/n4zLruZHcJ7oMt/MNp9eD6HEeFb6/TMfbWo85Pb79HJo8t3371/PuIAZqMvjPC34nVV6ZB4hEuA7AzA5cfU0y2n6ux89D/35/n2/vWY5Bf0qwf3tPLISO1Tap9qzFB6eap/beqI94NCCbGwgqOItY3CGl446CaQ8i2Q9g0AvmgJOnBoAA0gu17tsKtKS7D4udgCYERy2QIceCX/P7mBW+g/7D9S6Mn50CS0eAoQPDcBjopIA5+EcxEjLweRjXq0UbLIjcBxsGx2IZvlf0ATjz/6qypAmY7bhrk4ahsIis6ccXKHdueAfUgk+RWPCLh42c6zEeKyJpRTdRAOqBbl/Wq/uT+q+Fx3FoTIuCzc6+hN8j4veGjuAnhSE5gKnco3A3XwYlq2sq+lmP4yEOpqEoG0M+mGDYuYT0pKCFHgLHKt3T7T9p8GcWH+n1UwGa8X6kQt2x4CeqPexegT6o/Z4Cr313PHdgrsS2ZReLfpKIf+IMFnmVmwxQ9AhithYT73+p2s+JIVfrjwiHnpAZrSsr9CMstQXP1+1+510N/q8E/YoekMN9OMFvi5LvkRDsy9rgFCOoPdpgaQIWBZjf5KCSQszZJ1ivTvLokpen6tsJAVND0NFqb6GUGg2Im4Dyx9Pn7/0dm4pADAslJzTv+dKNrAPQ0wyySm7bj1RQgbAXsRa4R+mBJzpaQmHLmy0BLoL+Nh2ZRca8uUc6P37k97n451fvTieAE8BdZ2ItqFEK6oOJIYPsiU4woo140Oh+H/UC++gatHYcOFT+2y3AYvD1rM/fpxdUcsAi70c0OxAEP45X/hymE9XeoC0zfYhbcqfbhs09HpwnKMDR6g0mmYyKth/UcLl9ITGQ8N1S6s+gA1HvQCc2pluPvN2Br8SyZyfyxPP/VhCi1L1HWX2CQCuAE8TIq/sBYdANZmTIwqq0sb0HIzhhugBeUpBZLFyA8y+EErsBUYDZHYN9QAAooQwOws+uQlhdESSSqk5Qsh8LSYI6LDS1AbmOvLlRBqQIeITvM36+TP63VfE5hFClCTr9zEyVFwS3STQBy66DMHB+PJWIrfgGnYBx2dTboPa2X49GaBVlePA7CFx4iaGi4ns0aLVjMGvtPTDtmO4XEE8E5Kb/8qYai+NHl60LgAICcUCoJPVeiYG6Pxw/X9VFNVbFn9FNPzXoIRDTyzcpREYB5Fm1EQQn3KRi9wKApR8Tz48SwxnV3qM0q7ZhpdKvr0zfY+gO4oQf+EGPFYW/Xf5hwWsUgxiBbShGoGIx+D2eH1h2EeR3UQMH4zMaUKr4033nzkSkfQADelFbLOQCalxdxvN8mInhPas9bxtGJw29Fx3Y8429MAS0fL33Oeo7qFZeiToCC3B/VSNYuU0fgDnkhxGgMFdxiYEY7MYel+OHPH30IMeVFK1C79l+QdXVpFqHlMAXEf3EYDyfkkGdNvJ8f3RAXU0jpgM7jMNA5yCrtfzOicKG/M9bgEkEjqqPPDEcDfqVwGZv6zcO9avDfOhf4OmLFd9OLBHHdxp51HvOBlnAoQksYjASA1xnIhPsapTCPjbsGB2YevpPpgM73EYeSYIftgPgte6CWesVBB9QEgfnWYMgoeC8ql69bWoRIqYHvSIv/u26bj/jdqZ9KSGk74JRo6QS9PuTiSHm6Z62kLUGH0UO4rwWrhtRETkR4iKRdI8giJ2D2nUCMjsA0TXiVDb98NAf/rCMlajA9wesWHZrAe1dlwRyVI2jx4KkyUHSx7YDe6YD4tOC6XW01puEdAJwaEJzf1uATHi6ZlSCpBQscsh6C1xRcWEG4bCFeKcAVhVlDu54JQIkTT21hptIT/Afk0kMcS9BKfjBJozcDXCrtgbWXxbMAw3INQIxtQJPAGwXmYaBbYh4SCsuKwLOAQ5awKskCMmRg8P3xwlBfbosQaDqyZqBkyQe1CLQACoTgN4qbyHsPwkTiF2pYaj6MAXBmUosQHnUEYCsBL3MW39SNKMJ5PfoBsT33DVJCEbFnBCMOkHfvj6Xq8uw+dgRIhGgAiUqf5QgKDFyhe8nnYrlqn9sG1GoAfirubygX4H+8IM1CmQrMFAJ5ExzKIp54nPoVU2Auh6eBShDlTV4u5c4HE/fVvjFrsII0Ik6QX+Iq68jB19ziLoKC27FYe0gC+j1RSS+BgB7AvAM3m8HLdy5fV60C8RMVuhD1ieQB32MCCq0QPJuvuw5IHF/geMKwOPdpmsxBwVEfGEOgeincJqNmuSFIPhPq/xM81CWIIi+gCFBqDX3QPYd2OcCRo6GZBoA3AM+00aesAOQ7/2Pe/vBCXoguD4OBD1WfPwClzcui12AuH+gC0gEwW72KfjBCQRBr05D0IQc7N8PzOCMehPWK384MPVDJQim7yDdoiRTItzzFV/ZOX9sYFetP0fsQzb6O7wOoFjxk89YoQXv+BmSN+yYHYO+BsDRAXHhuJXsEFbdIEGZQWUkNVNzGA9NZUVBIQL7jASR0AclE4Pb7JN3BO72mG92+o8UG3nybj+mASh0FsLKn9GPxDrEcS2Au35BzHO1BksriIJdpqWjKR1wlpR4fN977rZqI+XbYjYDgVDpcYQalOYKMiuQbB3G6Pu/HlMbi9a0EMkksXtjvvXTfgMKAEZRN/i/O7yD8Da2S2Bdh3ICWfp8yuMkYl5a4df4vVWt4UF0yyqEnaT6swYyWB8/j111Y1ERS9oB0SLMtBGDEBD1PEHwtdjUEAHnqmoHU4wCDAoAS+lHwtu9eQLUAgmxVvAuMB9cELMV3m8EUtcBYYI9nkNIEEJYrQeUHfnzzRyC39j8CgSkir/E0P2odnAmAqDnDIhqrtV9BDNS2POjv/0pwKr6z1h/PMz3uf9ykFYq9TtoAXSwpz0HljdvBCVAPY6t7osv6gFhMpkX13rcfXQMIpuTsfTibkfOPRAC2meLRipI4mDPwMD5x+v3+Ey+qEfACwoUEkKQSMZxYJDz9R68PyP43yvo2aYf881rNQbZgRU/jp80QnW/hdXqJxMvCFxXQSNHpE8QiF4XI+wFfQcw7VL2Md7RRajsKgh2D+6SLAKPF356+/7yXYBTUgFy/38StUjFHweD+iiHh8/LV/i/TSvGk4L5x7F6AsIKbgb4C0YjgdGRIToGUx7cgS3JKP8pRcgak95BJGQbjaJdBYQ1qHYnYHL8F45QgHx2gLMQ2cDxBD/4SeR0LSDi5XzPQNjM4ySE/HGG6g+ugltLNSARn281BPtNO72eJLjdX4ITSEgpQvJYFEUg24f1qAYQNQdxx6Q/RcB85j9f+03zf2QV33IDPHegNgPABTfqFR8cZK9TA7/ll0EQbUUHW8Gr1d+MSadia+LRHwhunv87yWoJ3h/pRDwJAbDNQQFd2P2mH4kP/wDT/ZeN3CK3+ZjvgVpw4r20AMafb58j4N1UMknuj6iCx883PU9g2VHVH5JX2eEcPghSgRBCKPzK0Q3fknwPN0Hk0CyC0zBkz//7duEetgFjVtypASDI4CsknYJgYDhqsBxxy29+eyxrAZX75EEf8f+CkOcijMDDHx4ASYGGu8WHgPwpHJc0qOG8FgFTuVk0cRZVePFwHEIUEu8xSHoL5qWg4I7/HgOKXe2dcnu2SSdCGIDTA+AcxY1zYL6Q6AAFu+/1GvjKPSeEoJV3NiM4Dz9C6oWkEav+NWjPWXNOIkKgNTi2I8LeBgaZHJxqrC4oNXoB9pzzMws/OW3ghSyQJgjbygOVEDhoj4nHLld8HPD6UUMFVLIgKrTL7cFoBRLQgEdXIseZ2/HhFPKbk4d5tYWwwR0nIFQSD2P5gQhs6meVfB+Bkyz2fOIvX/zxqsSODuAGIOLtPNnmIPCrv6Kqvgz3q4tCwNl9lWYfnsdHj2HTgQw5IBHwULmfSu1jEV3gDFSxTBmqSEVqiYK2IkWcRiAkwV/cyW9YhqHXDw9dkNQAcO6HFNJT7oChfrPUYc3KY17zAd+evAwF2w5SCKLV4EuCEKsKfjBVWHu9Q9Arh4CoBqEMWYBsNX7YgKP/69uC3M7/mOOz232QT+ox4iCyJGEFP4oBHd+GVvXBwX35nqp7qeIbV6L6tdZub3ueJ+gBIKgC6S5gOQFxDoGr+Bv2nzqbknd7ph/EmXzO0o+kZdc/wqvQkAOUffVMzKtYgx5Vob1/+HAfCdzHSiXHenX35/2JTr3KZ9Ruj2lYiMhLIFoNyMq9hFroeYMTE0bSLbhb4l3YlFPa6hMd2jk8dmrDgdQCnC4/+ANFlYTB6ATlx2GDGXP1rvL+SnWHw+cJes5/rRWt4H2pw9GklD4uSMpwasIQiaYR92gIyFX5S8dtRZt/nCAH48VXW3hRE/HKOsGquj8EM85Q9cfeAV4XwNGAlmIFIwPYrfLKuxV476RRetzcdeAsRSZhiHizCKEIOHn3EMOWy5X4uIJnXX6sFiBFLaBm/THOQAkVJK9j6TKwiSDTBWpwHkSPQJX7U959uAkoaTUuug6oQCBz1Zlxm0OJSIoIw04M+7zCGuYiznCfHww9AN6Ir+HXA7lfn2oBSJ2FOOh8SzINfmcAyITq8JX/sOMPx6A9LeYtVfwgCBZhdu25OB9/XmWWNPUEPD5dUuJ68wd1AqD2+w1PI9KxE9BW5t3z/igdYGWiL7L+wPv9jgVY8f0ZcbCKCuLAHN+c5wa69Zpr0J9t2KnpAGzyiAIPiFalJ8/xXrrA6Y+/8NoDnWCPNwFJzf5DpVkHte8hx76P+HU1+HEytEeSEIzAsu5r6wPJGu6oLz8VrKofXLce+ywIHhNa/Dmw8LrptWXZ4NKZm4pr/QQ7Qk8ehMrPtAF7PQCD309QgRgRZMKgAbFREAfBBXNalbHA9cEHMo4IgIUuPjjBWEUFEQpYTkhVO43eRiynJw9Jjj8TOUIlJExK+0wA4gWgQvcFBHAc7P4/u78/Ff4CC5ATB3P3oUwFClYgcALcxzp/B9Ez4DUV8RjBbsCBrMH4dLNwIDaCGhA6o3pXksdBvYBsktrXDgNJKAFy1Z+ZGIy5NXgXoBT8a3ZgVSPIUAMV6DjLxhsV8wX4n4ibbONObHNyCr8Z4FinNFjg8ziiF5zSV8A99u7Zdf5OisvVaAAAG3VJREFU/kIPAJLWX3hUIFD6o7MD4WkHIMXBk4IftSrPNBJVk0OoC7ice8HGS8XBKDoz/YFBLaQi392lGpCMJfhD9xVkx5Xbj73P9V4m1j0v73x9FjDDPlYvATkgFAVWcdNvJBamliOjAwRV0EpeRymAe717kMYRyy/j5FwFBX0fP7Dyx8gq8wn2ZXi8GfGYR+lFcGJSxa3Y84WgzBHetlU4cvKY44Ps4iP9fsgsPGEhQTAcHqwwGCj61SoPexKwasXFqtxq8qhD9SixoBBYcJEDNzmIoi3J7QkoJActVHocTVpPBCDhElAvMDK1PT/Sq3DwB/ygmyB9GNhYDH4so4Foy48kkPtZfZEv1PQTxYpyX0EI3Bu+/5krcN8fgwVdwWu2JNVNWAk+PcOOPMNdGFyAZ5Aj6gicgzNfwuHZg0HrLxBWfjSRl88fVCo/apX/IBrIvf65ZxtEoK9Bec4KZIPLe76osQns46NwW0pUPCPAyMc4A/KXOwZzFLGbAqD5xhhbgBcWfoJBAlarcCSQgdQJ+Movnih4gjZQTw51rz588y/ZgxVUEAQ8soCfX8OR26JwujCLGFAMsOjnwGrlPuQw9D/PPv8BYVR7pG/eeFtQpsLzR2KFI8SwKj9KlX++HeLOPuSBKrKeHBi7L4b+Kx184+ptAp4Trcscv69oARVYzWgaK01H1X0K3zNSmARKtxXYHvwJuT+8gLGGWgpHcWOmBeljFB2Ckg6wiAYOqfxEK3GMCAj6kIiTWdCBCXhkjUKMgJcLk271N9uLSbtvvK0S69OXAvoA5z94VsFubbmZvx4QAnXgBnJxENyQjy38wef81uPhxMpPJIQzr5ckuUTKe0wZyN57iFTWga8GvCwlh5UqvYgmaNV9XSxEVWs40kkosFwA70RgNOu8mLZfR6wDiwRa35y7j08NksqPQhcfkRBK/J8R75Iz+9C8gJpqzwiIeZII3QnYOkJWbVEI5jNuA+o2BwK82ifwnpSgHwaC+GNAdmW2VXfC+vPu6wR6lBj84C9WfvivZyUhZMJlJhjSukDlFJ3g4AvGJfC1iEpQJ/CaEd7G9wds7p71+odruKrHip/C7RdsxeVjzIxhoNkFGOW/+sk/YVAGtltfzZAIfzix8gcHhZCXpcGN2u69qWqD9OlRFAy7x2fQBhHUiETB+DocqvArYt98f+AEAXApsEmEcNLC0t2uPHCqPQIXwHYDfI4/9+8LMpchqr5HK39MJSrBXwnutNqjovjHFdq+fcHLp7YLR4mGgduW5hFpAXUoL4cTTuW5HJSkB5PC0S7A+8c+837DyoM1J9iv/po/o3BunlDqPjOSO/YbLFd+FGy9sxKFeT8b+nLNPrkAyD53FtT27yUS32yqUaEGTMBiASGcZ0FmK8nWxbvjC1q6WQC4VdWdAcBY8eFoAzIrC0b7Wt8wlPcIdE1FhUWeKU1Igv8Q/0dl4k/NnYSxdlDon8diUDeuQB4c8XVzcahRgyyZmNC+LAgeCfSVALde8/t1DCYawNoePGT83wlOpFUdOZKwxn89OsMEf0X8CxJCBN/dwKbFwkSMgx0ACJJDJD4iC1JEYh6XcEqVHpx4+J4I4UiAl26r5x64sttvSlAn3LBuQCz6edU8C+J5epBrC4YP52EFDgHrCw1B0eU9bOaTgh3wmYvQV3Oqqcf53XnVNXUBELX1xtSgFrirlII5d3HFulxBCNEfZx0h7K2f34XwdHpuYQcguN189Ow/nPXclaUcqMH5leCXjKOjbv3F0a7i2ZaRHmBe5zwnhA9S736ZC8AH8LHkg/T5znYgmES1dtuzGo92qwHIquiWX+4KgVLd8utv9Ml1BQNhEJW/FOgweiTguCUoQHkEwYhjfQIgm8eAzPKzHqAG5xGiiPyxeGRRaYetUpDVpHVC1T9bHGyaknb/TQTnuG7rDYwYCUT7/cMjtILzA+Go/FPw581F/mWeTkDuBsBCAK8ki+A29nMzPn4Rzjv6QV7xWW4fzQFUxb9jQQ1qc28kMi4mDl1NBr4usIsz5ltZqNm7AeJXfuTHd7nioLEyPBISU+8/tP1AC4Il/n+YGmjg2NiBRdl6yCw//zG5ph7bqaBuz8B4VMU/TqSsNPbwCeZA1cdxyG9SgKzRZPL+GXFOiH1/SFZ9wX8M3zUgvH8a4rMBjZj/h1W9MrwTiN6MlsCKiI4gycBzgV/xUaQGjGDHwHiYi0VIzeEAasCpNuL76AC7BIEl7i4AIxnAfoMxk35eJbZ68wWEUChs8IPz/EEE9BkUoNA4RCWSLJkY1h0Y/dG9bVCtUVPe7QRhtStXG4nOECDfUxc4Uw/Ik8JkA9o9+a83IrfHH11EdFUWc4phNgVFWkPsIHBnCvCCYBSgqEN9qtoXuwHhByYoJJA7BxIkkRwpDGgAHo+vQ3ZGOwCFJCJKUAx4MBpFZWvReeLgtBBkDDQu2OJxXa7SE/P4ZiUPHABjY1DsFIhPAaygWewiXK72hHjow/k8gCL6gKES8qcDZ7A+EhYlWCPGCX1wXIwzkQEKt8cP6iqkC0FEhFj/ZYtvXCtwuBLcDT5wXN+9H6ZEIkTwV/x/s78fXFX3siWHEKrC3tw7EFZ31Ll7ttknQyEMGgAqCaVe1bGk8r8nFWCQQR0h7CY0dsU/mIeIuA1AGCo02Q0YVXxub36sG1Qgfo0CBBUXxap+ECFEycQVyViBEBFPt14TK9rZHB9EwMG7DPXOv0OVHkdtx7OSCXfb3av4CFZGTwQBwT7/hKPHE4PzpJ4L4+FM9r1n8B+B+9R9I4Fu9brYUZgCunZWNxdQgIs8mASBQ4F8hJpEiaf4GPihk8FdAxin/kybjZjTj+mAQy6ihZ9whDvHAWB6BKrBXQr+5SBfqPaINwiz12UIwoTmbPACZY/fshBBBKNlW8ZCHwH/cVKSOZMm4Mxk4OwE9JeB+EFkn1IzcPQoiSB4vGgNeJSoik1A7m0TCmE/HrggB+/1M12C1Z18ACGoIeH1pH2IhAqFWgBq+kDFEWAvA3X8tpW0cnSD5WAOriOHhnYraF1eLTkS8P/QsHUBdtMPnOrMaANJE9AZiaKWII5Ue/8PTHn/UcCSTgIF2xN4zdmAQYIAKeBFl6FiO0aKfq5jcImHfPwTxcEdRmD3LcFoAva1Hdjm9UgGggI9YOoPkOBYLsT8HlG3nucMDGkOOJ8CkNOELdSO7D5qqAeJYBb2GpABgRi2gxLITgrOQ9C937HgB+0i7MeRx3gfPWCXLtgbLJAu/gCFBPzRX8eADJqCvA3FViC/BlOQC4LZyrBq8BdQAOUKoKjqR7v7EFfVFMojPgEoSlJesNIePyLHwW9NRgq7E6HvUN8A0yj0wyWDHRZ3J2A1jHdMyu3hCGwSDwdRir7h9VP7AKLgPoMCgKziOFLtrUm8aIFHlgxYfz8WBYUU55iAXauo+evJaIK/NTgRJM9sUcZRzcCnMdNKMJc7usnAyrpxHYkTRHK+n1HxS01LheAHqRWwKIDqLvQC0+PupHZgBawfVGsiniTVHwZHRqbUI/D4Cd+ftgyLAR1ehkIiqaKFw7MJEwUIuK5zsu4svoFYCFKgBJZACBuppOId2RDkPZas8H9kULcA9a0KTCQDGtpnzT+RMJiOGseHl4BQ1C29AWUXIIf/OIwwqoNEK3SCuA7FRiBrE9B4/PcrGJ1OQNj83F4Xbol/TgVHfMiIZLAdcaVkgh8sLrd+liNQH/FqsNTfj15m1J0X+ffZuq/gTY7QnvIfJz6UzBJLs83ItQpt3RfZz5iuGfNPajpngUm0R8DoA5jDlzsOTAwZjzsC3Jjxg7H914PjlcskGdghgx9HG4OOQH34uwQyzz61/0qiYNQjXxECuWYbGM/DrjtPH/Mw/K+gBLLSA+cEfPr4MroArzcDuybbr8Zc72i2UnzeHnTgzD4Ug78SzIvCoARVOQxaFFR3TzWnkkHUVFShEuqKxZnKz4p4YYcf8ZhYhuu8wFgSHcuuwCJagI4bgchJQK/qe9c/RT6nGcg6KGREJpb+MI0EY/b0jcsni3AJBeCQNsBOFVYoApcM2Aom4VFgIRdHpeIG8D3YaxBD+qCiQ+rBOSVnci8hzkAG1t/pgHA4uwDzmu8xFKkkkIqCfkIRs204r/hiDgutoAAcowBMZ9+KS0CcXVBOHCvJw2jMQSJyeoeExF2DuTuRcuWAo9sefyUQ6/oBaIjPtiRH1KvQKvygAHb171d+vc4GRMDPoxN/kL5pwlVh1mBQ1quQJAJ5j0TgOAis+h8d3mnC8xTKE34+8sDNjyVXE6nFMN+H39TQDmocHScENvN74LoGScGU4f7g6IG3n3C3qnG6JBS+Z5tHOOzRYQx+u7MZmAl0OSsRLAS/VIKfRAWU92+12aaVPksGDBWQuCMvgNy2M2Mt8EwqbjosZAec5xLEAmXmcFTHiOWARWglpNpjdEtBQRxJJU5VL5/7F1X86XntXgUK4q+KggsUoIIK8oA+kgy4+zLaACqQGTVOX6MBWdehL6BxHn+tlyBMDGAqufd7WOX5WTJwKYDfXJJP2GXDPk7Tj5Ed7BOG7DMFaBRAJgI/+H2Ngeb2SKb0zkoGlQBHkefDr7xMA5HZeJPtKIzyApI9gmnPgf1c3mulfhe0gFekDCdNFnrOwi4Gs6eTACNjB+Uegcgojog4V25P8bctRYY6RL8AJklE9ACFAGZdBEahd4d4CmghFhbzcwaXYH5qTlS6DY+KfNH5Avzjo2JJ0poDkSCMxLn73H/eB+ifvgvyIFCWAji7BWC8hd0qj0FziMdrS70BlVbgamIgcmotGZDNPwm0L9l5iHv7WRoAFx57ScFS2r2iwot8oKu8l+TOCOg2mZ2nFdjTgOFQENzKkJ8OjEnsE8f6AzyXwT6MNF3RDRnuj0Lwo6wTlBMDIyqaz6G+RiLJMg/KUrQV/rh9uH0tWduwoxmky0kSMQ+rnXxZsGadgnxfgk1pCnsIsGYltvfdzTOBIclIsN8MLAGcz5gBwj94AE8DuC9Molip/JGwB57nRyJiyD3pyk6q5ij+3TzRLohcqyqCEQBTepF15+WVmW8SEr5jMUUkx3oMIsrH3ndwAQganKzyMpOJNxMQooGBYwcByw7axIhgPRGEr6GSGJhkAELoQ1YRg+dPeD5IIRDIqq5PA2Jh0Rq0YcS8XBi0ghGRFpCtWTdum5+yLOsQf2EuYY8AfnbQZDgCjHxBSKwTGpt8QCIDVH3/4H5OwEvldhliINwAFLsEyyIfGKV+vm3eEehVqKTdNxtDiPoLHCRiuwTJxCECxMDqDjTvZ63KaPKvRgV2i/F3ohm88V8LN8hgJcXD5pVGIPPNn9EBqSQC0I4AMxBUcQNCkarkFgSn/oCs9GCVep4eUG5BRAOcQOCWlGSc3If0IFqRfURQGRrKewPKEJ9sLnIowKCcw+f48N6UHjqYtgInaCCkBbPSj8VEkCr2g8U43wY1xX/BNkwreQrzg+oaJghOCGTU8RBxuIp6VFOGoEXgEsBLIgV6gBgxoLSI5CgiYNT+GBHsU01GthrceiMUtv9KgAYktgVNeGrBbtiOQVi9x8WjiAW7UNUnm4Vet7WtsFgDCDYEwQ/EVL1PnQf/xCDLTowTh4c4HPRDoQaiwhKIAae4B7xgCBydI/CDPOrevK0FR4p6w3VfoXgQiB3T1N8Y1PCD0X19JqcHGfzB5WkQE4p/kdeXBcEVUXEIFqSij82lMyrWq/7c+LFHA7z5/dwOHHg8s/Y8C2CmhbmALtare+4UWLfb25BmXABKABTniC8gRAP2yvDAiUAsElnrxFzITQa/sAFecAOY7zPV/8jMQHSbWAiUPGkQNABhw85xrSCv+mMSzFR8+7mjw01A8f4F8S/td4jnDHYxpT8/OEyV3gz2+GTfdAeAszswfJNGlQhEIjB0Bls0BKn4Iw7WKu9f1gmSagmvqleEwJwnZwjO7npz1HdCJ1hS/mlBcRXyF3i/M7NxqJFoeH27z7nnJaBmpUZKHsTbGUc1ALEoIGsGYl9ixS50gjAT/VhB8IzvGTrBVfWEz1MzAkRFTtecW731VdjNQPukVdhdn0Y8d/a7WYH6i/TBPBzUFwAlHwtGHOQISrgb1AMUgDETTA3+THAdeRJhg59V/Ektofa9I8wxVICkC7QQSAd2O3cftzPzdMK6aA4iZI4ILfYRbb9RgqICt2AxVnYZ4kkBvHOBxT/zN9ybHx/f5Ql2fkGCX6ANm6F8WCfqAS+Eq5AGcHJd2IFHagTMHAAj+mWBnDXuc81CjhsAi5dL2K8QCYI1aJ/PJtSSxEFXASv7C2I3ZB9/a0j/7nDn/j1pHsz9Jr8fNpxPBUAUUYD4wz5GBlmyAiORjtAIGDFwzSUwqiNZ1d1tPiB7/Q9VeI9KeJU16/knkEeQJEALjY4rkp74fCZiMDSA/PgvT/aT2gYgp5E/P29AKBQAo6TRth5T4VesQFb0i4K7RA2MZpgyFXCEQHCOixuYMPgy2L7+45ezSSKt2oUkURlpXkEMOLSiXPuDQZjk63N5bmzOSxQdLHX7AhwUEA0BAeQPJIQzkAuFlOK/GtyLdiGDKEBdllQ7YouxV2Xdwza9So4Kp5Z0yAgUhTlJgFzSFrznIHYIwKcCu2/L3LsCg6UI1b1/CA+ApIV5/32HqOIjdQusE4azip5Wc1b0q/QGIAlaWEJbXP3r/L+AEipw/+BtkQVY9fIM2i/ZhgVEgJO6DZ1ksVtlYdoQAPhVO0oKmYBmnAYco4DRCRB3TwCziptaE0auER9/VzRqKNOEYINOQg2m1l9GpGNQAhh1v6UmxNQh2M4+LmlUzll0OTjYQOaGlZAEMCrdhmBphaMBwBADrSQQc3//He8KgFETT7p6BHnjj2X9EXsDjrgBS6ihoAmcSQVYmE4JgYWFpp1waAQRoqDzxDhU+HxSnZHz/9JEY6Y5MJA+cwoWrt99+U3Mc/9g/NQTFaigAEtwB1yBzwzucZSX7RZEILhR1d5GDCsBLVUdIQvsldZfEJt5i/MHx2hGJZFkVVyK242iFeh58oBUFqIQbkfp2DV2X0CkAYgv1sU+P+I/HmBu8nErugdRnUWhfp+A/ddlbEH3uQlBsNobUEMHasK1HOYn8BEEvCUaiuigXRIKj+sGOPA4KAWz9/s7WxcgB4+a6/fI2osEwv4yOENAiPf+wQhbc/5f0gGisWuQaRFmGoIqguARWsBQgTTocDLMT5OJUQnhqdCEig+/EShKSEgTVV0MBMnz04BcshPnLk/+OaV0/dwKzB4QUt1NB6uTDfGOP+cNm9mEsBAFiM7AQh9AKVEU75vy68jeOxrUC4mDEuYO0oLqoSdHaEF2eXYYSm0V+oEOwpLmYFOF3Z4CmAeBTIGueiIw2xoKPzDBJVBXQ5g5O8/twwA+QguIjJt3+g0NQEcDfUXgO5gsqlTBLkQLdl86K3CWneitQ8sg/5oWAUJP2C3V3RoEyji5n4b9lB4t9pz2CA+cAFn1Z9I/uzYsU/ELtEBOCHYQQqGcFejV+yeuRJX31zsKV5IGjway9z6PLDxKwNEPsBuOEiqw57jGgOtZ1Y++T50AuMFl7hPIbhskiOwsATtRoc7rS7dXrpcgrMCGJca6ELJo+Y0be0BW5ZKGcFz4y8W9BduwcDnK9iO5fagsKpp9ANnvDPxeP8THNyIVFo1AMas8Qk5v2Ytm0LCCYAXqn+wQsPTBh/5Bcnne14Os3uCQt28vsK1WUESJFviBgAW//3u9PLxusXchcCR2WsNzv/ImvgZzzkUByDUAIrjTvmSHAowpJBQE4SUlxMxnARlQbIqkArVAJ6pBBvELCCKlkyCDAP45BYfEPfcUpfMch3Vn4bheYK4E66BxAxHSVd5INgEPgU/NBCDfNQ8Ho1CoINAPQAW/QT8OCIZlNFCB84XhoDChFByHGjx35v9BLgyhmojqHYb5QYXnuAecvua0hZe6BV9f7v4ibvgvamrmAc1TmaEir0LQ9h97eYAYVoM/nWA60i8Q3Ifezha9BqaaL3zvqd6IAuwwLSCCuCLuJWch4h30giPtyiAphKEBcCu9BV5wwzkMxID8rhMwdwMhcSFgrBT3RUTQboAUg3+p+Qe1IGarOioVnazmefV3lHpwA0AcLWCahUiXwePHWJsP+GH1gnp/we5KfOhJAbsj0H/BIEb04TbrTPsAyb2LLu93KwfCvn5PLAwrOXAa72eEQRo1CNdw5IprsAZ3hApy9zlcITG2vpCihsRSYxNS+J4vdBZ6B52eqRcQ/QXmSjAWSfa/5GA5qEg4iJFtm624AqXLrSA2gx8p1Mdqcghv41S0lSp/xAYs9gakQc4Ie2RTUYwYgt748mV+FU1Xgp14eW3XYZ6cdqGTNHwHICTwEeTPl0jEZwIgP9gDEaogeg5IHWCF+1eoAhvEKPB/EAeTRsM/pSAP5wjWEUMM1/NJRhwJbpJSgK7S7zF3EOsI5jBQBK9DV80Z8Y0COzvmWzJXgDl40KEC6cqvqgi4OB5cpgLFYK/1CvDiItXqC6/S87wfAUfPtxqfGNzlYaOjlf1IsHPPvffHgDAoEeEST4ZLZUd/RSo91/BjXY5ggWgQ4In3fyj4mUqPrInHOCLKO3wUwRsfyXpt1nEIRLrqcWeTuk7bigsbid1zD4iDRQtnIdQsyIXnFCn1I9D7ADgxEhOvR5AJosoUbu1FkJyYCi9OhQERoIx+4AX/YqUXQhtYEwKN4Cy1HntLMmtaAQpqfrT/UCoLSxeswjA5UWPPi0mjajUWxMTdVusNvt/ChMdmILK5IRMFu90BMEzFYHdg2GAgeYVHMMJIBTA7EFTx/5fpgTFXz9w/en0ZjD8kCDoKPNGwlB01BmoWQbh+AxR689mBponGJOr9OwmMu3dtJ/ylW1Tik4ElUPmR9RqII+pVhD9ychABMQ51gOIZg+/G+5mGIzLB1JJC5WhzYjhJ7IWmLDpA8jzsAafUPkB2WnFBF4iSxkq1ty7f25rv/+EQLOxs2oUdTSA9HIR9swdBlCcFe9owPC3XWDDC0ISVzsEVbSCF/sWdA5Fu4HJqankp2SeQCYYrImNalfmhpVxYrGkUS4LeSUjg8dD7+D7w/ybIfy7vlB9/HJ978zr7/45Qgajzj+4EjIK/ULHPRAOlKr/aG0AFcqCyu0GcW45Igh6JMJmhA49/U+cEssHNJhtXDC1MOya3j/sAiAGcrEtqtgjBD6wEzSDc7D8o6C8rIqAZyPk+NQoNLAZ1hR64Yl1FBY648smUYKnSg1Xwk/0DyRyArByMUobyByhCcPnOaPyoegREFS4jNfYAw+IHCjdC1J2WDZBke/OyN85J24WiXwDYPoJyYuCD238ulvuzwt6KgHf0shWKsqCFFGjB/w8HU8eeTED9wAAAAABJRU5ErkJggg==", r;
+ }(), Co = function() {
+ function r(t) {
+ this._isEnabled = !1, this.isEnabled = !1, this.intensity = 1, this.roughness = 0, this._indexOfRefraction = r._DefaultIndexOfRefraction, this.indexOfRefraction = r._DefaultIndexOfRefraction, this._texture = null, this.texture = null, this._useRoughnessFromMainTexture = !0, this.useRoughnessFromMainTexture = !0, this._textureRoughness = null, this.textureRoughness = null, this._remapF0OnInterfaceChange = !0, this.remapF0OnInterfaceChange = !0, this._bumpTexture = null, this.bumpTexture = null, this._isTintEnabled = !1, this.isTintEnabled = !1, this.tintColor = C.a.White(), this.tintColorAtDistance = 1, this.tintThickness = 1, this._tintTexture = null, this.tintTexture = null, this._internalMarkAllSubMeshesAsTexturesDirty = t;
+ }
+ return r.prototype._markAllSubMeshesAsTexturesDirty = function() {
+ this._internalMarkAllSubMeshesAsTexturesDirty();
+ }, r.prototype.isReadyForSubMesh = function(t, e, n, i) {
+ return !(t._areTexturesDirty && e.texturesEnabled && (this._texture && ht.a.ClearCoatTextureEnabled && !this._texture.isReadyOrNotBlocking() || this._textureRoughness && ht.a.ClearCoatTextureEnabled && !this._textureRoughness.isReadyOrNotBlocking() || n.getCaps().standardDerivatives && this._bumpTexture && ht.a.ClearCoatBumpTextureEnabled && !i && !this._bumpTexture.isReady() || this._isTintEnabled && this._tintTexture && ht.a.ClearCoatTintTextureEnabled && !this._tintTexture.isReadyOrNotBlocking()));
+ }, r.prototype.prepareDefines = function(t, e) {
+ var n;
+ this._isEnabled ? (t.CLEARCOAT = !0, t.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE = this._useRoughnessFromMainTexture, t.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL = this._texture !== null && this._texture._texture === ((n = this._textureRoughness) === null || n === void 0 ? void 0 : n._texture) && this._texture.checkTransformsAreIdentical(this._textureRoughness), t.CLEARCOAT_REMAP_F0 = this._remapF0OnInterfaceChange, t._areTexturesDirty && e.texturesEnabled && (this._texture && ht.a.ClearCoatTextureEnabled ? tt.a.PrepareDefinesForMergedUV(this._texture, t, "CLEARCOAT_TEXTURE") : t.CLEARCOAT_TEXTURE = !1, this._textureRoughness && ht.a.ClearCoatTextureEnabled ? tt.a.PrepareDefinesForMergedUV(this._textureRoughness, t, "CLEARCOAT_TEXTURE_ROUGHNESS") : t.CLEARCOAT_TEXTURE_ROUGHNESS = !1, this._bumpTexture && ht.a.ClearCoatBumpTextureEnabled ? tt.a.PrepareDefinesForMergedUV(this._bumpTexture, t, "CLEARCOAT_BUMP") : t.CLEARCOAT_BUMP = !1, t.CLEARCOAT_DEFAULTIOR = this._indexOfRefraction === r._DefaultIndexOfRefraction, this._isTintEnabled ? (t.CLEARCOAT_TINT = !0, this._tintTexture && ht.a.ClearCoatTintTextureEnabled ? tt.a.PrepareDefinesForMergedUV(this._tintTexture, t, "CLEARCOAT_TINT_TEXTURE") : t.CLEARCOAT_TINT_TEXTURE = !1) : (t.CLEARCOAT_TINT = !1, t.CLEARCOAT_TINT_TEXTURE = !1))) : (t.CLEARCOAT = !1, t.CLEARCOAT_TEXTURE = !1, t.CLEARCOAT_TEXTURE_ROUGHNESS = !1, t.CLEARCOAT_BUMP = !1, t.CLEARCOAT_TINT = !1, t.CLEARCOAT_TINT_TEXTURE = !1, t.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE = !1, t.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL = !1);
+ }, r.prototype.bindForSubMesh = function(t, e, n, i, o, a, s, p) {
+ var m, S, O, I, G, k, K, re, se = p._materialDefines, ue = se.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL;
+ if (!t.useUbo || !o || !t.isSync) {
+ ue && ht.a.ClearCoatTextureEnabled ? (t.updateFloat4("vClearCoatInfos", this._texture.coordinatesIndex, this._texture.level, -1, -1), tt.a.BindTextureMatrix(this._texture, t, "clearCoat")) : (this._texture || this._textureRoughness) && ht.a.ClearCoatTextureEnabled && (t.updateFloat4("vClearCoatInfos", (S = (m = this._texture) === null || m === void 0 ? void 0 : m.coordinatesIndex) !== null && S !== void 0 ? S : 0, (I = (O = this._texture) === null || O === void 0 ? void 0 : O.level) !== null && I !== void 0 ? I : 0, (k = (G = this._textureRoughness) === null || G === void 0 ? void 0 : G.coordinatesIndex) !== null && k !== void 0 ? k : 0, (re = (K = this._textureRoughness) === null || K === void 0 ? void 0 : K.level) !== null && re !== void 0 ? re : 0), this._texture && tt.a.BindTextureMatrix(this._texture, t, "clearCoat"), !this._textureRoughness || ue || se.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE || tt.a.BindTextureMatrix(this._textureRoughness, t, "clearCoatRoughness")), this._bumpTexture && n.getCaps().standardDerivatives && ht.a.ClearCoatTextureEnabled && !i && (t.updateFloat2("vClearCoatBumpInfos", this._bumpTexture.coordinatesIndex, this._bumpTexture.level), tt.a.BindTextureMatrix(this._bumpTexture, t, "clearCoatBump"), e._mirroredCameraPosition ? t.updateFloat2("vClearCoatTangentSpaceParams", a ? 1 : -1, s ? 1 : -1) : t.updateFloat2("vClearCoatTangentSpaceParams", a ? -1 : 1, s ? -1 : 1)), this._tintTexture && ht.a.ClearCoatTintTextureEnabled && (t.updateFloat2("vClearCoatTintInfos", this._tintTexture.coordinatesIndex, this._tintTexture.level), tt.a.BindTextureMatrix(this._tintTexture, t, "clearCoatTint")), t.updateFloat2("vClearCoatParams", this.intensity, this.roughness);
+ var he = 1 - this._indexOfRefraction, pe = 1 + this._indexOfRefraction, ve = Math.pow(-he / pe, 2), Ee = 1 / this._indexOfRefraction;
+ t.updateFloat4("vClearCoatRefractionParams", ve, Ee, he, pe), this._isTintEnabled && (t.updateFloat4("vClearCoatTintParams", this.tintColor.r, this.tintColor.g, this.tintColor.b, Math.max(1e-5, this.tintThickness)), t.updateFloat("clearCoatColorAtDistance", Math.max(1e-5, this.tintColorAtDistance)));
+ }
+ e.texturesEnabled && (this._texture && ht.a.ClearCoatTextureEnabled && t.setTexture("clearCoatSampler", this._texture), this._textureRoughness && !ue && !se.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE && ht.a.ClearCoatTextureEnabled && t.setTexture("clearCoatRoughnessSampler", this._textureRoughness), this._bumpTexture && n.getCaps().standardDerivatives && ht.a.ClearCoatBumpTextureEnabled && !i && t.setTexture("clearCoatBumpSampler", this._bumpTexture), this._isTintEnabled && this._tintTexture && ht.a.ClearCoatTintTextureEnabled && t.setTexture("clearCoatTintSampler", this._tintTexture));
+ }, r.prototype.hasTexture = function(t) {
+ return this._texture === t || this._textureRoughness === t || this._bumpTexture === t || this._tintTexture === t;
+ }, r.prototype.getActiveTextures = function(t) {
+ this._texture && t.push(this._texture), this._textureRoughness && t.push(this._textureRoughness), this._bumpTexture && t.push(this._bumpTexture), this._tintTexture && t.push(this._tintTexture);
+ }, r.prototype.getAnimatables = function(t) {
+ this._texture && this._texture.animations && this._texture.animations.length > 0 && t.push(this._texture), this._textureRoughness && this._textureRoughness.animations && this._textureRoughness.animations.length > 0 && t.push(this._textureRoughness), this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0 && t.push(this._bumpTexture), this._tintTexture && this._tintTexture.animations && this._tintTexture.animations.length > 0 && t.push(this._tintTexture);
+ }, r.prototype.dispose = function(t) {
+ var e, n, i, o;
+ t && ((e = this._texture) === null || e === void 0 || e.dispose(), (n = this._textureRoughness) === null || n === void 0 || n.dispose(), (i = this._bumpTexture) === null || i === void 0 || i.dispose(), (o = this._tintTexture) === null || o === void 0 || o.dispose());
+ }, r.prototype.getClassName = function() {
+ return "PBRClearCoatConfiguration";
+ }, r.AddFallbacks = function(t, e, n) {
+ return t.CLEARCOAT_BUMP && e.addFallback(n++, "CLEARCOAT_BUMP"), t.CLEARCOAT_TINT && e.addFallback(n++, "CLEARCOAT_TINT"), t.CLEARCOAT && e.addFallback(n++, "CLEARCOAT"), n;
+ }, r.AddUniforms = function(t) {
+ t.push("vClearCoatTangentSpaceParams", "vClearCoatParams", "vClearCoatRefractionParams", "vClearCoatTintParams", "clearCoatColorAtDistance", "clearCoatMatrix", "clearCoatRoughnessMatrix", "clearCoatBumpMatrix", "clearCoatTintMatrix", "vClearCoatInfos", "vClearCoatBumpInfos", "vClearCoatTintInfos");
+ }, r.AddSamplers = function(t) {
+ t.push("clearCoatSampler", "clearCoatRoughnessSampler", "clearCoatBumpSampler", "clearCoatTintSampler");
+ }, r.PrepareUniformBuffer = function(t) {
+ t.addUniform("vClearCoatParams", 2), t.addUniform("vClearCoatRefractionParams", 4), t.addUniform("vClearCoatInfos", 4), t.addUniform("clearCoatMatrix", 16), t.addUniform("clearCoatRoughnessMatrix", 16), t.addUniform("vClearCoatBumpInfos", 2), t.addUniform("vClearCoatTangentSpaceParams", 2), t.addUniform("clearCoatBumpMatrix", 16), t.addUniform("vClearCoatTintParams", 4), t.addUniform("clearCoatColorAtDistance", 1), t.addUniform("vClearCoatTintInfos", 2), t.addUniform("clearCoatTintMatrix", 16);
+ }, r.prototype.copyTo = function(t) {
+ w.a.Clone(function() {
+ return t;
+ }, this);
+ }, r.prototype.serialize = function() {
+ return w.a.Serialize(this);
+ }, r.prototype.parse = function(t, e, n) {
+ var i = this;
+ w.a.Parse(function() {
+ return i;
+ }, t, e, n);
+ }, r._DefaultIndexOfRefraction = 1.5, Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "isEnabled", void 0), Object(u.c)([Object(w.c)()], r.prototype, "intensity", void 0), Object(u.c)([Object(w.c)()], r.prototype, "roughness", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "indexOfRefraction", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "texture", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "useRoughnessFromMainTexture", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "textureRoughness", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "remapF0OnInterfaceChange", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "bumpTexture", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "isTintEnabled", void 0), Object(u.c)([Object(w.e)()], r.prototype, "tintColor", void 0), Object(u.c)([Object(w.c)()], r.prototype, "tintColorAtDistance", void 0), Object(u.c)([Object(w.c)()], r.prototype, "tintThickness", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "tintTexture", void 0), r;
+ }(), xo = function() {
+ function r(t) {
+ this._isEnabled = !1, this.isEnabled = !1, this.intensity = 1, this.direction = new c.d(1, 0), this._texture = null, this.texture = null, this._internalMarkAllSubMeshesAsTexturesDirty = t;
+ }
+ return r.prototype._markAllSubMeshesAsTexturesDirty = function() {
+ this._internalMarkAllSubMeshesAsTexturesDirty();
+ }, r.prototype.isReadyForSubMesh = function(t, e) {
+ return !(t._areTexturesDirty && e.texturesEnabled && this._texture && ht.a.AnisotropicTextureEnabled && !this._texture.isReadyOrNotBlocking());
+ }, r.prototype.prepareDefines = function(t, e, n) {
+ this._isEnabled ? (t.ANISOTROPIC = this._isEnabled, this._isEnabled && !e.isVerticesDataPresent(De.b.TangentKind) && (t._needUVs = !0, t.MAINUV1 = !0), t._areTexturesDirty && n.texturesEnabled && (this._texture && ht.a.AnisotropicTextureEnabled ? tt.a.PrepareDefinesForMergedUV(this._texture, t, "ANISOTROPIC_TEXTURE") : t.ANISOTROPIC_TEXTURE = !1)) : (t.ANISOTROPIC = !1, t.ANISOTROPIC_TEXTURE = !1);
+ }, r.prototype.bindForSubMesh = function(t, e, n) {
+ t.useUbo && n && t.isSync || (this._texture && ht.a.AnisotropicTextureEnabled && (t.updateFloat2("vAnisotropyInfos", this._texture.coordinatesIndex, this._texture.level), tt.a.BindTextureMatrix(this._texture, t, "anisotropy")), t.updateFloat3("vAnisotropy", this.direction.x, this.direction.y, this.intensity)), e.texturesEnabled && this._texture && ht.a.AnisotropicTextureEnabled && t.setTexture("anisotropySampler", this._texture);
+ }, r.prototype.hasTexture = function(t) {
+ return this._texture === t;
+ }, r.prototype.getActiveTextures = function(t) {
+ this._texture && t.push(this._texture);
+ }, r.prototype.getAnimatables = function(t) {
+ this._texture && this._texture.animations && this._texture.animations.length > 0 && t.push(this._texture);
+ }, r.prototype.dispose = function(t) {
+ t && this._texture && this._texture.dispose();
+ }, r.prototype.getClassName = function() {
+ return "PBRAnisotropicConfiguration";
+ }, r.AddFallbacks = function(t, e, n) {
+ return t.ANISOTROPIC && e.addFallback(n++, "ANISOTROPIC"), n;
+ }, r.AddUniforms = function(t) {
+ t.push("vAnisotropy", "vAnisotropyInfos", "anisotropyMatrix");
+ }, r.PrepareUniformBuffer = function(t) {
+ t.addUniform("vAnisotropy", 3), t.addUniform("vAnisotropyInfos", 2), t.addUniform("anisotropyMatrix", 16);
+ }, r.AddSamplers = function(t) {
+ t.push("anisotropySampler");
+ }, r.prototype.copyTo = function(t) {
+ w.a.Clone(function() {
+ return t;
+ }, this);
+ }, r.prototype.serialize = function() {
+ return w.a.Serialize(this);
+ }, r.prototype.parse = function(t, e, n) {
+ var i = this;
+ w.a.Parse(function() {
+ return i;
+ }, t, e, n);
+ }, Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "isEnabled", void 0), Object(u.c)([Object(w.c)()], r.prototype, "intensity", void 0), Object(u.c)([Object(w.n)()], r.prototype, "direction", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "texture", void 0), r;
+ }(), Wb = function() {
+ function r(t) {
+ this._useEnergyConservation = r.DEFAULT_USE_ENERGY_CONSERVATION, this.useEnergyConservation = r.DEFAULT_USE_ENERGY_CONSERVATION, this._useSmithVisibilityHeightCorrelated = r.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED, this.useSmithVisibilityHeightCorrelated = r.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED, this._useSphericalHarmonics = r.DEFAULT_USE_SPHERICAL_HARMONICS, this.useSphericalHarmonics = r.DEFAULT_USE_SPHERICAL_HARMONICS, this._useSpecularGlossinessInputEnergyConservation = r.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION, this.useSpecularGlossinessInputEnergyConservation = r.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION, this._internalMarkAllSubMeshesAsMiscDirty = t;
+ }
+ return r.prototype._markAllSubMeshesAsMiscDirty = function() {
+ this._internalMarkAllSubMeshesAsMiscDirty();
+ }, r.prototype.prepareDefines = function(t) {
+ t.BRDF_V_HEIGHT_CORRELATED = this._useSmithVisibilityHeightCorrelated, t.MS_BRDF_ENERGY_CONSERVATION = this._useEnergyConservation && this._useSmithVisibilityHeightCorrelated, t.SPHERICAL_HARMONICS = this._useSphericalHarmonics, t.SPECULAR_GLOSSINESS_ENERGY_CONSERVATION = this._useSpecularGlossinessInputEnergyConservation;
+ }, r.prototype.getClassName = function() {
+ return "PBRBRDFConfiguration";
+ }, r.prototype.copyTo = function(t) {
+ w.a.Clone(function() {
+ return t;
+ }, this);
+ }, r.prototype.serialize = function() {
+ return w.a.Serialize(this);
+ }, r.prototype.parse = function(t, e, n) {
+ var i = this;
+ w.a.Parse(function() {
+ return i;
+ }, t, e, n);
+ }, r.DEFAULT_USE_ENERGY_CONSERVATION = !0, r.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED = !0, r.DEFAULT_USE_SPHERICAL_HARMONICS = !0, r.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION = !0, Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsMiscDirty")], r.prototype, "useEnergyConservation", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsMiscDirty")], r.prototype, "useSmithVisibilityHeightCorrelated", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsMiscDirty")], r.prototype, "useSphericalHarmonics", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsMiscDirty")], r.prototype, "useSpecularGlossinessInputEnergyConservation", void 0), r;
+ }(), Aa = function() {
+ function r(t) {
+ this._isEnabled = !1, this.isEnabled = !1, this._linkSheenWithAlbedo = !1, this.linkSheenWithAlbedo = !1, this.intensity = 1, this.color = C.a.White(), this._texture = null, this.texture = null, this._useRoughnessFromMainTexture = !0, this.useRoughnessFromMainTexture = !0, this._roughness = null, this.roughness = null, this._textureRoughness = null, this.textureRoughness = null, this._albedoScaling = !1, this.albedoScaling = !1, this._internalMarkAllSubMeshesAsTexturesDirty = t;
+ }
+ return r.prototype._markAllSubMeshesAsTexturesDirty = function() {
+ this._internalMarkAllSubMeshesAsTexturesDirty();
+ }, r.prototype.isReadyForSubMesh = function(t, e) {
+ return !(t._areTexturesDirty && e.texturesEnabled && (this._texture && ht.a.SheenTextureEnabled && !this._texture.isReadyOrNotBlocking() || this._textureRoughness && ht.a.SheenTextureEnabled && !this._textureRoughness.isReadyOrNotBlocking()));
+ }, r.prototype.prepareDefines = function(t, e) {
+ var n;
+ this._isEnabled ? (t.SHEEN = this._isEnabled, t.SHEEN_LINKWITHALBEDO = this._linkSheenWithAlbedo, t.SHEEN_ROUGHNESS = this._roughness !== null, t.SHEEN_ALBEDOSCALING = this._albedoScaling, t.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE = this._useRoughnessFromMainTexture, t.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL = this._texture !== null && this._texture._texture === ((n = this._textureRoughness) === null || n === void 0 ? void 0 : n._texture) && this._texture.checkTransformsAreIdentical(this._textureRoughness), t._areTexturesDirty && e.texturesEnabled && (this._texture && ht.a.SheenTextureEnabled ? tt.a.PrepareDefinesForMergedUV(this._texture, t, "SHEEN_TEXTURE") : t.SHEEN_TEXTURE = !1, this._textureRoughness && ht.a.SheenTextureEnabled ? tt.a.PrepareDefinesForMergedUV(this._textureRoughness, t, "SHEEN_TEXTURE_ROUGHNESS") : t.SHEEN_TEXTURE_ROUGHNESS = !1)) : (t.SHEEN = !1, t.SHEEN_TEXTURE = !1, t.SHEEN_TEXTURE_ROUGHNESS = !1, t.SHEEN_LINKWITHALBEDO = !1, t.SHEEN_ROUGHNESS = !1, t.SHEEN_ALBEDOSCALING = !1, t.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE = !1, t.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL = !1);
+ }, r.prototype.bindForSubMesh = function(t, e, n, i) {
+ var o, a, s, p, m, S, O, I, G = i._materialDefines, k = G.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL;
+ t.useUbo && n && t.isSync || (k && ht.a.SheenTextureEnabled ? (t.updateFloat4("vSheenInfos", this._texture.coordinatesIndex, this._texture.level, -1, -1), tt.a.BindTextureMatrix(this._texture, t, "sheen")) : (this._texture || this._textureRoughness) && ht.a.SheenTextureEnabled && (t.updateFloat4("vSheenInfos", (a = (o = this._texture) === null || o === void 0 ? void 0 : o.coordinatesIndex) !== null && a !== void 0 ? a : 0, (p = (s = this._texture) === null || s === void 0 ? void 0 : s.level) !== null && p !== void 0 ? p : 0, (S = (m = this._textureRoughness) === null || m === void 0 ? void 0 : m.coordinatesIndex) !== null && S !== void 0 ? S : 0, (I = (O = this._textureRoughness) === null || O === void 0 ? void 0 : O.level) !== null && I !== void 0 ? I : 0), this._texture && tt.a.BindTextureMatrix(this._texture, t, "sheen"), !this._textureRoughness || k || G.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE || tt.a.BindTextureMatrix(this._textureRoughness, t, "sheenRoughness")), t.updateFloat4("vSheenColor", this.color.r, this.color.g, this.color.b, this.intensity), this._roughness !== null && t.updateFloat("vSheenRoughness", this._roughness)), e.texturesEnabled && (this._texture && ht.a.SheenTextureEnabled && t.setTexture("sheenSampler", this._texture), this._textureRoughness && !k && !G.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE && ht.a.SheenTextureEnabled && t.setTexture("sheenRoughnessSampler", this._textureRoughness));
+ }, r.prototype.hasTexture = function(t) {
+ return this._texture === t || this._textureRoughness === t;
+ }, r.prototype.getActiveTextures = function(t) {
+ this._texture && t.push(this._texture), this._textureRoughness && t.push(this._textureRoughness);
+ }, r.prototype.getAnimatables = function(t) {
+ this._texture && this._texture.animations && this._texture.animations.length > 0 && t.push(this._texture), this._textureRoughness && this._textureRoughness.animations && this._textureRoughness.animations.length > 0 && t.push(this._textureRoughness);
+ }, r.prototype.dispose = function(t) {
+ var e, n;
+ t && ((e = this._texture) === null || e === void 0 || e.dispose(), (n = this._textureRoughness) === null || n === void 0 || n.dispose());
+ }, r.prototype.getClassName = function() {
+ return "PBRSheenConfiguration";
+ }, r.AddFallbacks = function(t, e, n) {
+ return t.SHEEN && e.addFallback(n++, "SHEEN"), n;
+ }, r.AddUniforms = function(t) {
+ t.push("vSheenColor", "vSheenRoughness", "vSheenInfos", "sheenMatrix", "sheenRoughnessMatrix");
+ }, r.PrepareUniformBuffer = function(t) {
+ t.addUniform("vSheenColor", 4), t.addUniform("vSheenRoughness", 1), t.addUniform("vSheenInfos", 4), t.addUniform("sheenMatrix", 16), t.addUniform("sheenRoughnessMatrix", 16);
+ }, r.AddSamplers = function(t) {
+ t.push("sheenSampler"), t.push("sheenRoughnessSampler");
+ }, r.prototype.copyTo = function(t) {
+ w.a.Clone(function() {
+ return t;
+ }, this);
+ }, r.prototype.serialize = function() {
+ return w.a.Serialize(this);
+ }, r.prototype.parse = function(t, e, n) {
+ var i = this;
+ w.a.Parse(function() {
+ return i;
+ }, t, e, n);
+ }, Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "isEnabled", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "linkSheenWithAlbedo", void 0), Object(u.c)([Object(w.c)()], r.prototype, "intensity", void 0), Object(u.c)([Object(w.e)()], r.prototype, "color", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "texture", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "useRoughnessFromMainTexture", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "roughness", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "textureRoughness", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "albedoScaling", void 0), r;
+ }(), Pa = function() {
+ function r(t, e, n) {
+ this._isRefractionEnabled = !1, this.isRefractionEnabled = !1, this._isTranslucencyEnabled = !1, this.isTranslucencyEnabled = !1, this._isScatteringEnabled = !1, this.isScatteringEnabled = !1, this._scatteringDiffusionProfileIndex = 0, this.refractionIntensity = 1, this.translucencyIntensity = 1, this.useAlbedoToTintRefraction = !1, this._thicknessTexture = null, this.thicknessTexture = null, this._refractionTexture = null, this.refractionTexture = null, this._indexOfRefraction = 1.5, this.indexOfRefraction = 1.5, this._volumeIndexOfRefraction = -1, this._invertRefractionY = !1, this.invertRefractionY = !1, this._linkRefractionWithTransparency = !1, this.linkRefractionWithTransparency = !1, this.minimumThickness = 0, this.maximumThickness = 1, this.tintColor = C.a.White(), this.tintColorAtDistance = 1, this.diffusionDistance = C.a.White(), this._useMaskFromThicknessTexture = !1, this.useMaskFromThicknessTexture = !1, this._useMaskFromThicknessTextureGltf = !1, this.useMaskFromThicknessTextureGltf = !1, this._internalMarkAllSubMeshesAsTexturesDirty = t, this._internalMarkScenePrePassDirty = e, this._scene = n;
+ }
+ return Object.defineProperty(r.prototype, "scatteringDiffusionProfile", { get: function() {
+ return this._scene.subSurfaceConfiguration ? this._scene.subSurfaceConfiguration.ssDiffusionProfileColors[this._scatteringDiffusionProfileIndex] : null;
+ }, set: function(t) {
+ this._scene.enableSubSurfaceForPrePass() && t && (this._scatteringDiffusionProfileIndex = this._scene.subSurfaceConfiguration.addDiffusionProfile(t));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "volumeIndexOfRefraction", { get: function() {
+ return this._volumeIndexOfRefraction >= 1 ? this._volumeIndexOfRefraction : this._indexOfRefraction;
+ }, set: function(t) {
+ this._volumeIndexOfRefraction = t >= 1 ? t : -1;
+ }, enumerable: !1, configurable: !0 }), r.prototype._markAllSubMeshesAsTexturesDirty = function() {
+ this._internalMarkAllSubMeshesAsTexturesDirty();
+ }, r.prototype._markScenePrePassDirty = function() {
+ this._internalMarkAllSubMeshesAsTexturesDirty(), this._internalMarkScenePrePassDirty();
+ }, r.prototype.isReadyForSubMesh = function(t, e) {
+ if (t._areTexturesDirty && e.texturesEnabled) {
+ if (this._thicknessTexture && ht.a.ThicknessTextureEnabled && !this._thicknessTexture.isReadyOrNotBlocking())
+ return !1;
+ var n = this._getRefractionTexture(e);
+ if (n && ht.a.RefractionTextureEnabled && !n.isReadyOrNotBlocking())
+ return !1;
+ }
+ return !0;
+ }, r.prototype.prepareDefines = function(t, e) {
+ if (t._areTexturesDirty && (t.SUBSURFACE = !1, t.SS_TRANSLUCENCY = this._isTranslucencyEnabled, t.SS_SCATTERING = this._isScatteringEnabled, t.SS_THICKNESSANDMASK_TEXTURE = !1, t.SS_MASK_FROM_THICKNESS_TEXTURE = !1, t.SS_MASK_FROM_THICKNESS_TEXTURE_GLTF = !1, t.SS_REFRACTION = !1, t.SS_REFRACTIONMAP_3D = !1, t.SS_GAMMAREFRACTION = !1, t.SS_RGBDREFRACTION = !1, t.SS_LINEARSPECULARREFRACTION = !1, t.SS_REFRACTIONMAP_OPPOSITEZ = !1, t.SS_LODINREFRACTIONALPHA = !1, t.SS_LINKREFRACTIONTOTRANSPARENCY = !1, t.SS_ALBEDOFORREFRACTIONTINT = !1, (this._isRefractionEnabled || this._isTranslucencyEnabled || this._isScatteringEnabled) && (t.SUBSURFACE = !0, t._areTexturesDirty && e.texturesEnabled && this._thicknessTexture && ht.a.ThicknessTextureEnabled && tt.a.PrepareDefinesForMergedUV(this._thicknessTexture, t, "SS_THICKNESSANDMASK_TEXTURE"), t.SS_MASK_FROM_THICKNESS_TEXTURE = this._useMaskFromThicknessTexture, t.SS_MASK_FROM_THICKNESS_TEXTURE_GLTF = this._useMaskFromThicknessTextureGltf), this._isRefractionEnabled && e.texturesEnabled)) {
+ var n = this._getRefractionTexture(e);
+ n && ht.a.RefractionTextureEnabled && (t.SS_REFRACTION = !0, t.SS_REFRACTIONMAP_3D = n.isCube, t.SS_GAMMAREFRACTION = n.gammaSpace, t.SS_RGBDREFRACTION = n.isRGBD, t.SS_LINEARSPECULARREFRACTION = n.linearSpecularLOD, t.SS_REFRACTIONMAP_OPPOSITEZ = n.invertZ, t.SS_LODINREFRACTIONALPHA = n.lodLevelInAlpha, t.SS_LINKREFRACTIONTOTRANSPARENCY = this._linkRefractionWithTransparency, t.SS_ALBEDOFORREFRACTIONTINT = this.useAlbedoToTintRefraction);
+ }
+ }, r.prototype.bindForSubMesh = function(t, e, n, i, o, a) {
+ var s = this._getRefractionTexture(e);
+ if (!t.useUbo || !i || !t.isSync) {
+ if (this._thicknessTexture && ht.a.ThicknessTextureEnabled && (t.updateFloat2("vThicknessInfos", this._thicknessTexture.coordinatesIndex, this._thicknessTexture.level), tt.a.BindTextureMatrix(this._thicknessTexture, t, "thickness")), t.updateFloat2("vThicknessParam", this.minimumThickness, this.maximumThickness - this.minimumThickness), s && ht.a.RefractionTextureEnabled) {
+ t.updateMatrix("refractionMatrix", s.getReflectionTextureMatrix());
+ var p = 1;
+ s.isCube || s.depth && (p = s.depth);
+ var m = s.getSize().width, S = this.volumeIndexOfRefraction;
+ t.updateFloat4("vRefractionInfos", s.level, 1 / S, p, this._invertRefractionY ? -1 : 1), t.updateFloat3("vRefractionMicrosurfaceInfos", m, s.lodGenerationScale, s.lodGenerationOffset), a && t.updateFloat2("vRefractionFilteringInfo", m, ee.a.Log2(m));
+ }
+ this.isScatteringEnabled && t.updateFloat("scatteringDiffusionProfile", this._scatteringDiffusionProfileIndex), t.updateColor3("vDiffusionDistance", this.diffusionDistance), t.updateFloat4("vTintColor", this.tintColor.r, this.tintColor.g, this.tintColor.b, this.tintColorAtDistance), t.updateFloat3("vSubSurfaceIntensity", this.refractionIntensity, this.translucencyIntensity, 0);
+ }
+ e.texturesEnabled && (this._thicknessTexture && ht.a.ThicknessTextureEnabled && t.setTexture("thicknessSampler", this._thicknessTexture), s && ht.a.RefractionTextureEnabled && (o ? t.setTexture("refractionSampler", s) : (t.setTexture("refractionSampler", s._lodTextureMid || s), t.setTexture("refractionSamplerLow", s._lodTextureLow || s), t.setTexture("refractionSamplerHigh", s._lodTextureHigh || s))));
+ }, r.prototype.unbind = function(t) {
+ return !(!this._refractionTexture || !this._refractionTexture.isRenderTarget) && (t.setTexture("refractionSampler", null), !0);
+ }, r.prototype._getRefractionTexture = function(t) {
+ return this._refractionTexture ? this._refractionTexture : this._isRefractionEnabled ? t.environmentTexture : null;
+ }, Object.defineProperty(r.prototype, "disableAlphaBlending", { get: function() {
+ return this.isRefractionEnabled && this._linkRefractionWithTransparency;
+ }, enumerable: !1, configurable: !0 }), r.prototype.fillRenderTargetTextures = function(t) {
+ ht.a.RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget && t.push(this._refractionTexture);
+ }, r.prototype.hasTexture = function(t) {
+ return this._thicknessTexture === t || this._refractionTexture === t;
+ }, r.prototype.hasRenderTargetTextures = function() {
+ return !!(ht.a.RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget);
+ }, r.prototype.getActiveTextures = function(t) {
+ this._thicknessTexture && t.push(this._thicknessTexture), this._refractionTexture && t.push(this._refractionTexture);
+ }, r.prototype.getAnimatables = function(t) {
+ this._thicknessTexture && this._thicknessTexture.animations && this._thicknessTexture.animations.length > 0 && t.push(this._thicknessTexture), this._refractionTexture && this._refractionTexture.animations && this._refractionTexture.animations.length > 0 && t.push(this._refractionTexture);
+ }, r.prototype.dispose = function(t) {
+ t && (this._thicknessTexture && this._thicknessTexture.dispose(), this._refractionTexture && this._refractionTexture.dispose());
+ }, r.prototype.getClassName = function() {
+ return "PBRSubSurfaceConfiguration";
+ }, r.AddFallbacks = function(t, e, n) {
+ return t.SS_SCATTERING && e.addFallback(n++, "SS_SCATTERING"), t.SS_TRANSLUCENCY && e.addFallback(n++, "SS_TRANSLUCENCY"), n;
+ }, r.AddUniforms = function(t) {
+ t.push("vDiffusionDistance", "vTintColor", "vSubSurfaceIntensity", "vRefractionMicrosurfaceInfos", "vRefractionFilteringInfo", "vRefractionInfos", "vThicknessInfos", "vThicknessParam", "refractionMatrix", "thicknessMatrix", "scatteringDiffusionProfile");
+ }, r.AddSamplers = function(t) {
+ t.push("thicknessSampler", "refractionSampler", "refractionSamplerLow", "refractionSamplerHigh");
+ }, r.PrepareUniformBuffer = function(t) {
+ t.addUniform("vRefractionMicrosurfaceInfos", 3), t.addUniform("vRefractionFilteringInfo", 2), t.addUniform("vRefractionInfos", 4), t.addUniform("refractionMatrix", 16), t.addUniform("vThicknessInfos", 2), t.addUniform("thicknessMatrix", 16), t.addUniform("vThicknessParam", 2), t.addUniform("vDiffusionDistance", 3), t.addUniform("vTintColor", 4), t.addUniform("vSubSurfaceIntensity", 3), t.addUniform("scatteringDiffusionProfile", 1);
+ }, r.prototype.copyTo = function(t) {
+ w.a.Clone(function() {
+ return t;
+ }, this);
+ }, r.prototype.serialize = function() {
+ return w.a.Serialize(this);
+ }, r.prototype.parse = function(t, e, n) {
+ var i = this;
+ w.a.Parse(function() {
+ return i;
+ }, t, e, n);
+ }, Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "isRefractionEnabled", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "isTranslucencyEnabled", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markScenePrePassDirty")], r.prototype, "isScatteringEnabled", void 0), Object(u.c)([Object(w.c)()], r.prototype, "_scatteringDiffusionProfileIndex", void 0), Object(u.c)([Object(w.c)()], r.prototype, "refractionIntensity", void 0), Object(u.c)([Object(w.c)()], r.prototype, "translucencyIntensity", void 0), Object(u.c)([Object(w.c)()], r.prototype, "useAlbedoToTintRefraction", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "thicknessTexture", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "refractionTexture", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "indexOfRefraction", void 0), Object(u.c)([Object(w.c)()], r.prototype, "_volumeIndexOfRefraction", void 0), Object(u.c)([Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "volumeIndexOfRefraction", null), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "invertRefractionY", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "linkRefractionWithTransparency", void 0), Object(u.c)([Object(w.c)()], r.prototype, "minimumThickness", void 0), Object(u.c)([Object(w.c)()], r.prototype, "maximumThickness", void 0), Object(u.c)([Object(w.e)()], r.prototype, "tintColor", void 0), Object(u.c)([Object(w.c)()], r.prototype, "tintColorAtDistance", void 0), Object(u.c)([Object(w.e)()], r.prototype, "diffusionDistance", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "useMaskFromThicknessTexture", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], r.prototype, "useMaskFromThicknessTextureGltf", void 0), r;
+ }(), Fl = l(105), Zt = l(25), Xb = (l(160), `uniform vec3 vReflectionColor;
+uniform vec4 vAlbedoColor;
+
+uniform vec4 vLightingIntensity;
+uniform vec4 vReflectivityColor;
+uniform vec4 vMetallicReflectanceFactors;
+uniform vec3 vEmissiveColor;
+uniform float visibility;
+
+#ifdef ALBEDO
+uniform vec2 vAlbedoInfos;
+#endif
+#ifdef AMBIENT
+uniform vec4 vAmbientInfos;
+#endif
+#ifdef BUMP
+uniform vec3 vBumpInfos;
+uniform vec2 vTangentSpaceParams;
+#endif
+#ifdef OPACITY
+uniform vec2 vOpacityInfos;
+#endif
+#ifdef EMISSIVE
+uniform vec2 vEmissiveInfos;
+#endif
+#ifdef LIGHTMAP
+uniform vec2 vLightmapInfos;
+#endif
+#ifdef REFLECTIVITY
+uniform vec3 vReflectivityInfos;
+#endif
+#ifdef MICROSURFACEMAP
+uniform vec2 vMicroSurfaceSamplerInfos;
+#endif
+
+#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(SS_REFRACTION)
+uniform mat4 view;
+#endif
+
+#ifdef REFLECTION
+uniform vec2 vReflectionInfos;
+#ifdef REALTIME_FILTERING
+uniform vec2 vReflectionFilteringInfo;
+#endif
+uniform mat4 reflectionMatrix;
+uniform vec3 vReflectionMicrosurfaceInfos;
+#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)
+uniform vec3 vReflectionPosition;
+uniform vec3 vReflectionSize;
+#endif
+#endif
+
+#ifdef CLEARCOAT
+uniform vec2 vClearCoatParams;
+uniform vec4 vClearCoatRefractionParams;
+#if defined(CLEARCOAT_TEXTURE) || defined(CLEARCOAT_TEXTURE_ROUGHNESS)
+uniform vec4 vClearCoatInfos;
+#endif
+#ifdef CLEARCOAT_TEXTURE
+uniform mat4 clearCoatMatrix;
+#endif
+#ifdef CLEARCOAT_TEXTURE_ROUGHNESS
+uniform mat4 clearCoatRoughnessMatrix;
+#endif
+#ifdef CLEARCOAT_BUMP
+uniform vec2 vClearCoatBumpInfos;
+uniform vec2 vClearCoatTangentSpaceParams;
+uniform mat4 clearCoatBumpMatrix;
+#endif
+#ifdef CLEARCOAT_TINT
+uniform vec4 vClearCoatTintParams;
+uniform float clearCoatColorAtDistance;
+#ifdef CLEARCOAT_TINT_TEXTURE
+uniform vec2 vClearCoatTintInfos;
+uniform mat4 clearCoatTintMatrix;
+#endif
+#endif
+#endif
+
+#ifdef ANISOTROPIC
+uniform vec3 vAnisotropy;
+#ifdef ANISOTROPIC_TEXTURE
+uniform vec2 vAnisotropyInfos;
+uniform mat4 anisotropyMatrix;
+#endif
+#endif
+
+#ifdef SHEEN
+uniform vec4 vSheenColor;
+#ifdef SHEEN_ROUGHNESS
+uniform float vSheenRoughness;
+#endif
+#if defined(SHEEN_TEXTURE) || defined(SHEEN_TEXTURE_ROUGHNESS)
+uniform vec4 vSheenInfos;
+#endif
+#ifdef SHEEN_TEXTURE
+uniform mat4 sheenMatrix;
+#endif
+#ifdef SHEEN_TEXTURE_ROUGHNESS
+uniform mat4 sheenRoughnessMatrix;
+#endif
+#endif
+
+#ifdef SUBSURFACE
+#ifdef SS_REFRACTION
+uniform vec3 vRefractionMicrosurfaceInfos;
+uniform vec4 vRefractionInfos;
+uniform mat4 refractionMatrix;
+#ifdef REALTIME_FILTERING
+uniform vec2 vRefractionFilteringInfo;
+#endif
+#endif
+#ifdef SS_THICKNESSANDMASK_TEXTURE
+uniform vec2 vThicknessInfos;
+uniform mat4 thicknessMatrix;
+#endif
+uniform vec2 vThicknessParam;
+uniform vec3 vDiffusionDistance;
+uniform vec4 vTintColor;
+uniform vec3 vSubSurfaceIntensity;
+#endif
+#ifdef PREPASS
+#ifdef PREPASS_IRRADIANCE
+uniform float scatteringDiffusionProfile;
+#endif
+#endif`);
+ We.a.IncludesShadersStore.pbrFragmentDeclaration = Xb;
+ var Yb = `layout(std140,column_major) uniform;
+uniform Material
+{
+uniform vec2 vAlbedoInfos;
+uniform vec4 vAmbientInfos;
+uniform vec2 vOpacityInfos;
+uniform vec2 vEmissiveInfos;
+uniform vec2 vLightmapInfos;
+uniform vec3 vReflectivityInfos;
+uniform vec2 vMicroSurfaceSamplerInfos;
+uniform vec2 vReflectionInfos;
+uniform vec2 vReflectionFilteringInfo;
+uniform vec3 vReflectionPosition;
+uniform vec3 vReflectionSize;
+uniform vec3 vBumpInfos;
+uniform mat4 albedoMatrix;
+uniform mat4 ambientMatrix;
+uniform mat4 opacityMatrix;
+uniform mat4 emissiveMatrix;
+uniform mat4 lightmapMatrix;
+uniform mat4 reflectivityMatrix;
+uniform mat4 microSurfaceSamplerMatrix;
+uniform mat4 bumpMatrix;
+uniform vec2 vTangentSpaceParams;
+uniform mat4 reflectionMatrix;
+uniform vec3 vReflectionColor;
+uniform vec4 vAlbedoColor;
+uniform vec4 vLightingIntensity;
+uniform vec3 vReflectionMicrosurfaceInfos;
+uniform float pointSize;
+uniform vec4 vReflectivityColor;
+uniform vec3 vEmissiveColor;
+uniform float visibility;
+uniform vec4 vMetallicReflectanceFactors;
+uniform vec2 vMetallicReflectanceInfos;
+uniform mat4 metallicReflectanceMatrix;
+uniform vec2 vClearCoatParams;
+uniform vec4 vClearCoatRefractionParams;
+uniform vec4 vClearCoatInfos;
+uniform mat4 clearCoatMatrix;
+uniform mat4 clearCoatRoughnessMatrix;
+uniform vec2 vClearCoatBumpInfos;
+uniform vec2 vClearCoatTangentSpaceParams;
+uniform mat4 clearCoatBumpMatrix;
+uniform vec4 vClearCoatTintParams;
+uniform float clearCoatColorAtDistance;
+uniform vec2 vClearCoatTintInfos;
+uniform mat4 clearCoatTintMatrix;
+uniform vec3 vAnisotropy;
+uniform vec2 vAnisotropyInfos;
+uniform mat4 anisotropyMatrix;
+uniform vec4 vSheenColor;
+uniform float vSheenRoughness;
+uniform vec4 vSheenInfos;
+uniform mat4 sheenMatrix;
+uniform mat4 sheenRoughnessMatrix;
+uniform vec3 vRefractionMicrosurfaceInfos;
+uniform vec2 vRefractionFilteringInfo;
+uniform vec4 vRefractionInfos;
+uniform mat4 refractionMatrix;
+uniform vec2 vThicknessInfos;
+uniform mat4 thicknessMatrix;
+uniform vec2 vThicknessParam;
+uniform vec3 vDiffusionDistance;
+uniform vec4 vTintColor;
+uniform vec3 vSubSurfaceIntensity;
+uniform float scatteringDiffusionProfile;
+uniform vec4 vDetailInfos;
+uniform mat4 detailMatrix;
+};
+uniform Scene {
+mat4 viewProjection;
+#ifdef MULTIVIEW
+mat4 viewProjectionR;
+#endif
+mat4 view;
+};`;
+ We.a.IncludesShadersStore.pbrUboDeclaration = Yb;
+ var Kb = `uniform vec4 vEyePosition;
+uniform vec3 vAmbientColor;
+uniform vec4 vCameraInfos;
+
+varying vec3 vPositionW;
+#if DEBUGMODE>0
+uniform vec2 vDebugMode;
+varying vec4 vClipSpacePosition;
+#endif
+#ifdef MAINUV1
+varying vec2 vMainUV1;
+#endif
+#ifdef MAINUV2
+varying vec2 vMainUV2;
+#endif
+#ifdef NORMAL
+varying vec3 vNormalW;
+#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)
+varying vec3 vEnvironmentIrradiance;
+#endif
+#endif
+#ifdef VERTEXCOLOR
+varying vec4 vColor;
+#endif`;
+ We.a.IncludesShadersStore.pbrFragmentExtraDeclaration = Kb;
+ var Qb = `#ifdef ALBEDO
+#if ALBEDODIRECTUV == 1
+#define vAlbedoUV vMainUV1
+#elif ALBEDODIRECTUV == 2
+#define vAlbedoUV vMainUV2
+#else
+varying vec2 vAlbedoUV;
+#endif
+uniform sampler2D albedoSampler;
+#endif
+#ifdef AMBIENT
+#if AMBIENTDIRECTUV == 1
+#define vAmbientUV vMainUV1
+#elif AMBIENTDIRECTUV == 2
+#define vAmbientUV vMainUV2
+#else
+varying vec2 vAmbientUV;
+#endif
+uniform sampler2D ambientSampler;
+#endif
+#ifdef OPACITY
+#if OPACITYDIRECTUV == 1
+#define vOpacityUV vMainUV1
+#elif OPACITYDIRECTUV == 2
+#define vOpacityUV vMainUV2
+#else
+varying vec2 vOpacityUV;
+#endif
+uniform sampler2D opacitySampler;
+#endif
+#ifdef EMISSIVE
+#if EMISSIVEDIRECTUV == 1
+#define vEmissiveUV vMainUV1
+#elif EMISSIVEDIRECTUV == 2
+#define vEmissiveUV vMainUV2
+#else
+varying vec2 vEmissiveUV;
+#endif
+uniform sampler2D emissiveSampler;
+#endif
+#ifdef LIGHTMAP
+#if LIGHTMAPDIRECTUV == 1
+#define vLightmapUV vMainUV1
+#elif LIGHTMAPDIRECTUV == 2
+#define vLightmapUV vMainUV2
+#else
+varying vec2 vLightmapUV;
+#endif
+uniform sampler2D lightmapSampler;
+#endif
+#ifdef REFLECTIVITY
+#if REFLECTIVITYDIRECTUV == 1
+#define vReflectivityUV vMainUV1
+#elif REFLECTIVITYDIRECTUV == 2
+#define vReflectivityUV vMainUV2
+#else
+varying vec2 vReflectivityUV;
+#endif
+uniform sampler2D reflectivitySampler;
+#endif
+#ifdef MICROSURFACEMAP
+#if MICROSURFACEMAPDIRECTUV == 1
+#define vMicroSurfaceSamplerUV vMainUV1
+#elif MICROSURFACEMAPDIRECTUV == 2
+#define vMicroSurfaceSamplerUV vMainUV2
+#else
+varying vec2 vMicroSurfaceSamplerUV;
+#endif
+uniform sampler2D microSurfaceSampler;
+#endif
+#ifdef METALLIC_REFLECTANCE
+#if METALLIC_REFLECTANCEDIRECTUV == 1
+#define vMetallicReflectanceUV vMainUV1
+#elif METALLIC_REFLECTANCEDIRECTUV == 2
+#define vMetallicReflectanceUV vMainUV2
+#else
+varying vec2 vMetallicReflectanceUV;
+#endif
+uniform sampler2D metallicReflectanceSampler;
+#endif
+#ifdef CLEARCOAT
+#if defined(CLEARCOAT_TEXTURE)
+#if CLEARCOAT_TEXTUREDIRECTUV == 1
+#define vClearCoatUV vMainUV1
+#elif CLEARCOAT_TEXTUREDIRECTUV == 2
+#define vClearCoatUV vMainUV2
+#else
+varying vec2 vClearCoatUV;
+#endif
+#endif
+#if defined(CLEARCOAT_TEXTURE_ROUGHNESS)
+#if CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV == 1
+#define vClearCoatRoughnessUV vMainUV1
+#elif CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV == 2
+#define vClearCoatRoughnessUV vMainUV2
+#else
+varying vec2 vClearCoatRoughnessUV;
+#endif
+#endif
+#ifdef CLEARCOAT_TEXTURE
+uniform sampler2D clearCoatSampler;
+#endif
+#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL)
+uniform sampler2D clearCoatRoughnessSampler;
+#endif
+#ifdef CLEARCOAT_BUMP
+#if CLEARCOAT_BUMPDIRECTUV == 1
+#define vClearCoatBumpUV vMainUV1
+#elif CLEARCOAT_BUMPDIRECTUV == 2
+#define vClearCoatBumpUV vMainUV2
+#else
+varying vec2 vClearCoatBumpUV;
+#endif
+uniform sampler2D clearCoatBumpSampler;
+#endif
+#ifdef CLEARCOAT_TINT_TEXTURE
+#if CLEARCOAT_TINT_TEXTUREDIRECTUV == 1
+#define vClearCoatTintUV vMainUV1
+#elif CLEARCOAT_TINT_TEXTUREDIRECTUV == 2
+#define vClearCoatTintUV vMainUV2
+#else
+varying vec2 vClearCoatTintUV;
+#endif
+uniform sampler2D clearCoatTintSampler;
+#endif
+#endif
+#ifdef SHEEN
+#ifdef SHEEN_TEXTURE
+#if SHEEN_TEXTUREDIRECTUV == 1
+#define vSheenUV vMainUV1
+#elif SHEEN_TEXTUREDIRECTUV == 2
+#define vSheenUV vMainUV2
+#else
+varying vec2 vSheenUV;
+#endif
+#endif
+#ifdef SHEEN_TEXTURE_ROUGHNESS
+#if SHEEN_TEXTURE_ROUGHNESSDIRECTUV == 1
+#define vSheenRoughnessUV vMainUV1
+#elif SHEEN_TEXTURE_ROUGHNESSDIRECTUV == 2
+#define vSheenRoughnessUV vMainUV2
+#else
+varying vec2 vSheenRoughnessUV;
+#endif
+#endif
+#ifdef SHEEN_TEXTURE
+uniform sampler2D sheenSampler;
+#endif
+#if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL)
+uniform sampler2D sheenRoughnessSampler;
+#endif
+#endif
+#ifdef ANISOTROPIC
+#ifdef ANISOTROPIC_TEXTURE
+#if ANISOTROPIC_TEXTUREDIRECTUV == 1
+#define vAnisotropyUV vMainUV1
+#elif ANISOTROPIC_TEXTUREDIRECTUV == 2
+#define vAnisotropyUV vMainUV2
+#else
+varying vec2 vAnisotropyUV;
+#endif
+uniform sampler2D anisotropySampler;
+#endif
+#endif
+
+#ifdef REFLECTION
+#ifdef REFLECTIONMAP_3D
+#define sampleReflection(s,c) textureCube(s,c)
+uniform samplerCube reflectionSampler;
+#ifdef LODBASEDMICROSFURACE
+#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)
+#else
+uniform samplerCube reflectionSamplerLow;
+uniform samplerCube reflectionSamplerHigh;
+#endif
+#ifdef USEIRRADIANCEMAP
+uniform samplerCube irradianceSampler;
+#endif
+#else
+#define sampleReflection(s,c) texture2D(s,c)
+uniform sampler2D reflectionSampler;
+#ifdef LODBASEDMICROSFURACE
+#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)
+#else
+uniform sampler2D reflectionSamplerLow;
+uniform sampler2D reflectionSamplerHigh;
+#endif
+#ifdef USEIRRADIANCEMAP
+uniform sampler2D irradianceSampler;
+#endif
+#endif
+#ifdef REFLECTIONMAP_SKYBOX
+varying vec3 vPositionUVW;
+#else
+#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
+varying vec3 vDirectionW;
+#endif
+#endif
+#endif
+#ifdef ENVIRONMENTBRDF
+uniform sampler2D environmentBrdfSampler;
+#endif
+
+#ifdef SUBSURFACE
+#ifdef SS_REFRACTION
+#ifdef SS_REFRACTIONMAP_3D
+#define sampleRefraction(s,c) textureCube(s,c)
+uniform samplerCube refractionSampler;
+#ifdef LODBASEDMICROSFURACE
+#define sampleRefractionLod(s,c,l) textureCubeLodEXT(s,c,l)
+#else
+uniform samplerCube refractionSamplerLow;
+uniform samplerCube refractionSamplerHigh;
+#endif
+#else
+#define sampleRefraction(s,c) texture2D(s,c)
+uniform sampler2D refractionSampler;
+#ifdef LODBASEDMICROSFURACE
+#define sampleRefractionLod(s,c,l) texture2DLodEXT(s,c,l)
+#else
+uniform sampler2D refractionSamplerLow;
+uniform sampler2D refractionSamplerHigh;
+#endif
+#endif
+#endif
+#ifdef SS_THICKNESSANDMASK_TEXTURE
+#if SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 1
+#define vThicknessUV vMainUV1
+#elif SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 2
+#define vThicknessUV vMainUV2
+#else
+varying vec2 vThicknessUV;
+#endif
+uniform sampler2D thicknessSampler;
+#endif
+#endif`;
+ We.a.IncludesShadersStore.pbrFragmentSamplersDeclaration = Qb, l(116), We.a.IncludesShadersStore.subSurfaceScatteringFunctions = `bool testLightingForSSS(float diffusionProfile)
+{
+return diffusionProfile<1.;
+}`;
+ var qb = `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+vec3 hemisphereCosSample(vec2 u) {
+
+float phi=2.*PI*u.x;
+float cosTheta2=1.-u.y;
+float cosTheta=sqrt(cosTheta2);
+float sinTheta=sqrt(1.-cosTheta2);
+return vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+vec3 hemisphereImportanceSampleDggx(vec2 u,float a) {
+
+float phi=2.*PI*u.x;
+
+float cosTheta2=(1.-u.y)/(1.+(a+1.)*((a-1.)*u.y));
+float cosTheta=sqrt(cosTheta2);
+float sinTheta=sqrt(1.-cosTheta2);
+return vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+vec3 hemisphereImportanceSampleDCharlie(vec2 u,float a) {
+
+float phi=2.*PI*u.x;
+float sinTheta=pow(u.y,a/(2.*a+1.));
+float cosTheta=sqrt(1.-sinTheta*sinTheta);
+return vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);
+}`;
+ We.a.IncludesShadersStore.importanceSampling = qb;
+ var Zb = `
+#define RECIPROCAL_PI2 0.15915494
+#define RECIPROCAL_PI 0.31830988618
+
+#define MINIMUMVARIANCE 0.0005
+float convertRoughnessToAverageSlope(float roughness)
+{
+
+return square(roughness)+MINIMUMVARIANCE;
+}
+float fresnelGrazingReflectance(float reflectance0) {
+
+
+float reflectance90=saturate(reflectance0*25.0);
+return reflectance90;
+}
+vec2 getAARoughnessFactors(vec3 normalVector) {
+#ifdef SPECULARAA
+vec3 nDfdx=dFdx(normalVector.xyz);
+vec3 nDfdy=dFdy(normalVector.xyz);
+float slopeSquare=max(dot(nDfdx,nDfdx),dot(nDfdy,nDfdy));
+
+float geometricRoughnessFactor=pow(saturate(slopeSquare),0.333);
+
+float geometricAlphaGFactor=sqrt(slopeSquare);
+
+geometricAlphaGFactor*=0.75;
+return vec2(geometricRoughnessFactor,geometricAlphaGFactor);
+#else
+return vec2(0.);
+#endif
+}
+#ifdef ANISOTROPIC
+
+
+vec2 getAnisotropicRoughness(float alphaG,float anisotropy) {
+float alphaT=max(alphaG*(1.0+anisotropy),MINIMUMVARIANCE);
+float alphaB=max(alphaG*(1.0-anisotropy),MINIMUMVARIANCE);
+return vec2(alphaT,alphaB);
+}
+
+
+vec3 getAnisotropicBentNormals(const vec3 T,const vec3 B,const vec3 N,const vec3 V,float anisotropy) {
+vec3 anisotropicFrameDirection=anisotropy>=0.0 ? B : T;
+vec3 anisotropicFrameTangent=cross(normalize(anisotropicFrameDirection),V);
+vec3 anisotropicFrameNormal=cross(anisotropicFrameTangent,anisotropicFrameDirection);
+vec3 anisotropicNormal=normalize(mix(N,anisotropicFrameNormal,abs(anisotropy)));
+return anisotropicNormal;
+
+}
+#endif
+#if defined(CLEARCOAT) || defined(SS_REFRACTION)
+
+
+
+vec3 cocaLambert(vec3 alpha,float distance) {
+return exp(-alpha*distance);
+}
+
+vec3 cocaLambert(float NdotVRefract,float NdotLRefract,vec3 alpha,float thickness) {
+return cocaLambert(alpha,(thickness*((NdotLRefract+NdotVRefract)/(NdotLRefract*NdotVRefract))));
+}
+
+vec3 computeColorAtDistanceInMedia(vec3 color,float distance) {
+return -log(color)/distance;
+}
+vec3 computeClearCoatAbsorption(float NdotVRefract,float NdotLRefract,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {
+vec3 clearCoatAbsorption=mix(vec3(1.0),
+cocaLambert(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness),
+clearCoatIntensity);
+return clearCoatAbsorption;
+}
+#endif
+
+
+
+
+#ifdef MICROSURFACEAUTOMATIC
+float computeDefaultMicroSurface(float microSurface,vec3 reflectivityColor)
+{
+const float kReflectivityNoAlphaWorkflow_SmoothnessMax=0.95;
+float reflectivityLuminance=getLuminance(reflectivityColor);
+float reflectivityLuma=sqrt(reflectivityLuminance);
+microSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;
+return microSurface;
+}
+#endif`;
+ We.a.IncludesShadersStore.pbrHelperFunctions = Zb;
+ var Jb = `#ifdef USESPHERICALFROMREFLECTIONMAP
+#ifdef SPHERICAL_HARMONICS
+uniform vec3 vSphericalL00;
+uniform vec3 vSphericalL1_1;
+uniform vec3 vSphericalL10;
+uniform vec3 vSphericalL11;
+uniform vec3 vSphericalL2_2;
+uniform vec3 vSphericalL2_1;
+uniform vec3 vSphericalL20;
+uniform vec3 vSphericalL21;
+uniform vec3 vSphericalL22;
+
+
+
+
+
+
+
+vec3 computeEnvironmentIrradiance(vec3 normal) {
+return vSphericalL00
++vSphericalL1_1*(normal.y)
++vSphericalL10*(normal.z)
++vSphericalL11*(normal.x)
++vSphericalL2_2*(normal.y*normal.x)
++vSphericalL2_1*(normal.y*normal.z)
++vSphericalL20*((3.0*normal.z*normal.z)-1.0)
++vSphericalL21*(normal.z*normal.x)
++vSphericalL22*(normal.x*normal.x-(normal.y*normal.y));
+}
+#else
+uniform vec3 vSphericalX;
+uniform vec3 vSphericalY;
+uniform vec3 vSphericalZ;
+uniform vec3 vSphericalXX_ZZ;
+uniform vec3 vSphericalYY_ZZ;
+uniform vec3 vSphericalZZ;
+uniform vec3 vSphericalXY;
+uniform vec3 vSphericalYZ;
+uniform vec3 vSphericalZX;
+
+vec3 computeEnvironmentIrradiance(vec3 normal) {
+
+
+
+
+
+
+
+
+
+float Nx=normal.x;
+float Ny=normal.y;
+float Nz=normal.z;
+vec3 C1=vSphericalZZ.rgb;
+vec3 Cx=vSphericalX.rgb;
+vec3 Cy=vSphericalY.rgb;
+vec3 Cz=vSphericalZ.rgb;
+vec3 Cxx_zz=vSphericalXX_ZZ.rgb;
+vec3 Cyy_zz=vSphericalYY_ZZ.rgb;
+vec3 Cxy=vSphericalXY.rgb;
+vec3 Cyz=vSphericalYZ.rgb;
+vec3 Czx=vSphericalZX.rgb;
+vec3 a1=Cyy_zz*Ny+Cy;
+vec3 a2=Cyz*Nz+a1;
+vec3 b1=Czx*Nz+Cx;
+vec3 b2=Cxy*Ny+b1;
+vec3 b3=Cxx_zz*Nx+b2;
+vec3 t1=Cz*Nz+C1;
+vec3 t2=a2*Ny+t1;
+vec3 t3=b3*Nx+t2;
+return t3;
+}
+#endif
+#endif`;
+ We.a.IncludesShadersStore.harmonicsFunctions = Jb;
+ var $b = `
+struct preLightingInfo
+{
+
+vec3 lightOffset;
+float lightDistanceSquared;
+float lightDistance;
+
+float attenuation;
+
+vec3 L;
+vec3 H;
+float NdotV;
+float NdotLUnclamped;
+float NdotL;
+float VdotH;
+float roughness;
+};
+preLightingInfo computePointAndSpotPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {
+preLightingInfo result;
+
+result.lightOffset=lightData.xyz-vPositionW;
+result.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);
+
+result.lightDistance=sqrt(result.lightDistanceSquared);
+
+result.L=normalize(result.lightOffset);
+result.H=normalize(V+result.L);
+result.VdotH=saturate(dot(V,result.H));
+result.NdotLUnclamped=dot(N,result.L);
+result.NdotL=saturateEps(result.NdotLUnclamped);
+return result;
+}
+preLightingInfo computeDirectionalPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {
+preLightingInfo result;
+
+result.lightDistance=length(-lightData.xyz);
+
+result.L=normalize(-lightData.xyz);
+result.H=normalize(V+result.L);
+result.VdotH=saturate(dot(V,result.H));
+result.NdotLUnclamped=dot(N,result.L);
+result.NdotL=saturateEps(result.NdotLUnclamped);
+return result;
+}
+preLightingInfo computeHemisphericPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {
+preLightingInfo result;
+
+
+result.NdotL=dot(N,lightData.xyz)*0.5+0.5;
+result.NdotL=saturateEps(result.NdotL);
+result.NdotLUnclamped=result.NdotL;
+#ifdef SPECULARTERM
+result.L=normalize(lightData.xyz);
+result.H=normalize(V+result.L);
+result.VdotH=saturate(dot(V,result.H));
+#endif
+return result;
+}`;
+ We.a.IncludesShadersStore.pbrDirectLightingSetupFunctions = $b;
+ var ey = `float computeDistanceLightFalloff_Standard(vec3 lightOffset,float range)
+{
+return max(0.,1.0-length(lightOffset)/range);
+}
+float computeDistanceLightFalloff_Physical(float lightDistanceSquared)
+{
+return 1.0/maxEps(lightDistanceSquared);
+}
+float computeDistanceLightFalloff_GLTF(float lightDistanceSquared,float inverseSquaredRange)
+{
+float lightDistanceFalloff=1.0/maxEps(lightDistanceSquared);
+float factor=lightDistanceSquared*inverseSquaredRange;
+float attenuation=saturate(1.0-factor*factor);
+attenuation*=attenuation;
+
+lightDistanceFalloff*=attenuation;
+return lightDistanceFalloff;
+}
+float computeDistanceLightFalloff(vec3 lightOffset,float lightDistanceSquared,float range,float inverseSquaredRange)
+{
+#ifdef USEPHYSICALLIGHTFALLOFF
+return computeDistanceLightFalloff_Physical(lightDistanceSquared);
+#elif defined(USEGLTFLIGHTFALLOFF)
+return computeDistanceLightFalloff_GLTF(lightDistanceSquared,inverseSquaredRange);
+#else
+return computeDistanceLightFalloff_Standard(lightOffset,range);
+#endif
+}
+float computeDirectionalLightFalloff_Standard(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent)
+{
+float falloff=0.0;
+float cosAngle=maxEps(dot(-lightDirection,directionToLightCenterW));
+if (cosAngle>=cosHalfAngle)
+{
+falloff=max(0.,pow(cosAngle,exponent));
+}
+return falloff;
+}
+float computeDirectionalLightFalloff_Physical(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle)
+{
+const float kMinusLog2ConeAngleIntensityRatio=6.64385618977;
+
+
+
+
+
+float concentrationKappa=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);
+
+
+vec4 lightDirectionSpreadSG=vec4(-lightDirection*concentrationKappa,-concentrationKappa);
+float falloff=exp2(dot(vec4(directionToLightCenterW,1.0),lightDirectionSpreadSG));
+return falloff;
+}
+float computeDirectionalLightFalloff_GLTF(vec3 lightDirection,vec3 directionToLightCenterW,float lightAngleScale,float lightAngleOffset)
+{
+
+
+
+float cd=dot(-lightDirection,directionToLightCenterW);
+float falloff=saturate(cd*lightAngleScale+lightAngleOffset);
+
+falloff*=falloff;
+return falloff;
+}
+float computeDirectionalLightFalloff(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent,float lightAngleScale,float lightAngleOffset)
+{
+#ifdef USEPHYSICALLIGHTFALLOFF
+return computeDirectionalLightFalloff_Physical(lightDirection,directionToLightCenterW,cosHalfAngle);
+#elif defined(USEGLTFLIGHTFALLOFF)
+return computeDirectionalLightFalloff_GLTF(lightDirection,directionToLightCenterW,lightAngleScale,lightAngleOffset);
+#else
+return computeDirectionalLightFalloff_Standard(lightDirection,directionToLightCenterW,cosHalfAngle,exponent);
+#endif
+}`;
+ We.a.IncludesShadersStore.pbrDirectLightingFalloffFunctions = ey;
+ var ty = `
+#define FRESNEL_MAXIMUM_ON_ROUGH 0.25
+
+
+
+
+#ifdef MS_BRDF_ENERGY_CONSERVATION
+
+
+vec3 getEnergyConservationFactor(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {
+return 1.0+specularEnvironmentR0*(1.0/environmentBrdf.y-1.0);
+}
+#endif
+#ifdef ENVIRONMENTBRDF
+vec3 getBRDFLookup(float NdotV,float perceptualRoughness) {
+
+vec2 UV=vec2(NdotV,perceptualRoughness);
+
+vec4 brdfLookup=texture2D(environmentBrdfSampler,UV);
+#ifdef ENVIRONMENTBRDF_RGBD
+brdfLookup.rgb=fromRGBD(brdfLookup.rgba);
+#endif
+return brdfLookup.rgb;
+}
+vec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 specularEnvironmentR90,const vec3 environmentBrdf) {
+#ifdef BRDF_V_HEIGHT_CORRELATED
+vec3 reflectance=(specularEnvironmentR90-specularEnvironmentR0)*environmentBrdf.x+specularEnvironmentR0*environmentBrdf.y;
+
+#else
+vec3 reflectance=specularEnvironmentR0*environmentBrdf.x+specularEnvironmentR90*environmentBrdf.y;
+#endif
+return reflectance;
+}
+vec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {
+#ifdef BRDF_V_HEIGHT_CORRELATED
+vec3 reflectance=mix(environmentBrdf.xxx,environmentBrdf.yyy,specularEnvironmentR0);
+#else
+vec3 reflectance=specularEnvironmentR0*environmentBrdf.x+environmentBrdf.y;
+#endif
+return reflectance;
+}
+#endif
+
+#if !defined(ENVIRONMENTBRDF) || defined(REFLECTIONMAP_SKYBOX) || defined(ALPHAFRESNEL)
+vec3 getReflectanceFromAnalyticalBRDFLookup_Jones(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)
+{
+
+float weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);
+return reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));
+}
+#endif
+#if defined(SHEEN) && defined(ENVIRONMENTBRDF)
+
+vec3 getSheenReflectanceFromBRDFLookup(const vec3 reflectance0,const vec3 environmentBrdf) {
+vec3 sheenEnvironmentReflectance=reflectance0*environmentBrdf.b;
+return sheenEnvironmentReflectance;
+}
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+vec3 fresnelSchlickGGX(float VdotH,vec3 reflectance0,vec3 reflectance90)
+{
+return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);
+}
+float fresnelSchlickGGX(float VdotH,float reflectance0,float reflectance90)
+{
+return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);
+}
+#ifdef CLEARCOAT
+
+
+
+
+
+vec3 getR0RemappedForClearCoat(vec3 f0) {
+#ifdef CLEARCOAT_DEFAULTIOR
+#ifdef MOBILE
+return saturate(f0*(f0*0.526868+0.529324)-0.0482256);
+#else
+return saturate(f0*(f0*(0.941892-0.263008*f0)+0.346479)-0.0285998);
+#endif
+#else
+vec3 s=sqrt(f0);
+vec3 t=(vClearCoatRefractionParams.z+vClearCoatRefractionParams.w*s)/(vClearCoatRefractionParams.w+vClearCoatRefractionParams.z*s);
+return t*t;
+#endif
+}
+#endif
+
+
+
+
+
+
+float normalDistributionFunction_TrowbridgeReitzGGX(float NdotH,float alphaG)
+{
+
+
+
+float a2=square(alphaG);
+float d=NdotH*NdotH*(a2-1.0)+1.0;
+return a2/(PI*d*d);
+}
+#ifdef SHEEN
+
+
+float normalDistributionFunction_CharlieSheen(float NdotH,float alphaG)
+{
+float invR=1./alphaG;
+float cos2h=NdotH*NdotH;
+float sin2h=1.-cos2h;
+return (2.+invR)*pow(sin2h,invR*.5)/(2.*PI);
+}
+#endif
+#ifdef ANISOTROPIC
+
+
+float normalDistributionFunction_BurleyGGX_Anisotropic(float NdotH,float TdotH,float BdotH,const vec2 alphaTB) {
+float a2=alphaTB.x*alphaTB.y;
+vec3 v=vec3(alphaTB.y*TdotH,alphaTB.x*BdotH,a2*NdotH);
+float v2=dot(v,v);
+float w2=a2/v2;
+return a2*w2*w2*RECIPROCAL_PI;
+}
+#endif
+
+
+
+
+#ifdef BRDF_V_HEIGHT_CORRELATED
+
+
+
+float smithVisibility_GGXCorrelated(float NdotL,float NdotV,float alphaG) {
+#ifdef MOBILE
+
+float GGXV=NdotL*(NdotV*(1.0-alphaG)+alphaG);
+float GGXL=NdotV*(NdotL*(1.0-alphaG)+alphaG);
+return 0.5/(GGXV+GGXL);
+#else
+float a2=alphaG*alphaG;
+float GGXV=NdotL*sqrt(NdotV*(NdotV-a2*NdotV)+a2);
+float GGXL=NdotV*sqrt(NdotL*(NdotL-a2*NdotL)+a2);
+return 0.5/(GGXV+GGXL);
+#endif
+}
+#else
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+float smithVisibilityG1_TrowbridgeReitzGGXFast(float dot,float alphaG)
+{
+#ifdef MOBILE
+
+return 1.0/(dot+alphaG+(1.0-alphaG)*dot ));
+#else
+float alphaSquared=alphaG*alphaG;
+return 1.0/(dot+sqrt(alphaSquared+(1.0-alphaSquared)*dot*dot));
+#endif
+}
+float smithVisibility_TrowbridgeReitzGGXFast(float NdotL,float NdotV,float alphaG)
+{
+float visibility=smithVisibilityG1_TrowbridgeReitzGGXFast(NdotL,alphaG)*smithVisibilityG1_TrowbridgeReitzGGXFast(NdotV,alphaG);
+
+return visibility;
+}
+#endif
+#ifdef ANISOTROPIC
+
+
+float smithVisibility_GGXCorrelated_Anisotropic(float NdotL,float NdotV,float TdotV,float BdotV,float TdotL,float BdotL,const vec2 alphaTB) {
+float lambdaV=NdotL*length(vec3(alphaTB.x*TdotV,alphaTB.y*BdotV,NdotV));
+float lambdaL=NdotV*length(vec3(alphaTB.x*TdotL,alphaTB.y*BdotL,NdotL));
+float v=0.5/(lambdaV+lambdaL);
+return v;
+}
+#endif
+#ifdef CLEARCOAT
+float visibility_Kelemen(float VdotH) {
+
+
+
+return 0.25/(VdotH*VdotH);
+}
+#endif
+#ifdef SHEEN
+
+
+
+float visibility_Ashikhmin(float NdotL,float NdotV)
+{
+return 1./(4.*(NdotL+NdotV-NdotL*NdotV));
+}
+
+#endif
+
+
+
+
+
+
+
+float diffuseBRDF_Burley(float NdotL,float NdotV,float VdotH,float roughness) {
+
+
+float diffuseFresnelNV=pow5(saturateEps(1.0-NdotL));
+float diffuseFresnelNL=pow5(saturateEps(1.0-NdotV));
+float diffuseFresnel90=0.5+2.0*VdotH*VdotH*roughness;
+float fresnel =
+(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNL) *
+(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNV);
+return fresnel/PI;
+}
+#ifdef SS_TRANSLUCENCY
+
+
+vec3 transmittanceBRDF_Burley(const vec3 tintColor,const vec3 diffusionDistance,float thickness) {
+vec3 S=1./maxEps(diffusionDistance);
+vec3 temp=exp((-0.333333333*thickness)*S);
+return tintColor.rgb*0.25*(temp*temp*temp+3.0*temp);
+}
+
+
+float computeWrappedDiffuseNdotL(float NdotL,float w) {
+float t=1.0+w;
+float invt2=1.0/square(t);
+return saturate((NdotL+w)*invt2);
+}
+#endif
+`;
+ We.a.IncludesShadersStore.pbrBRDFFunctions = ty;
+ var ny = `#ifdef NUM_SAMPLES
+#if NUM_SAMPLES>0
+#ifdef WEBGL2
+
+
+float radicalInverse_VdC(uint bits)
+{
+bits=(bits << 16u) | (bits >> 16u);
+bits=((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
+bits=((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
+bits=((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
+bits=((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
+return float(bits)*2.3283064365386963e-10;
+}
+vec2 hammersley(uint i,uint N)
+{
+return vec2(float(i)/float(N),radicalInverse_VdC(i));
+}
+#else
+float vanDerCorpus(int n,int base)
+{
+float invBase=1.0/float(base);
+float denom=1.0;
+float result=0.0;
+for(int i=0; i<32; ++i)
+{
+if(n>0)
+{
+denom=mod(float(n),2.0);
+result+=denom*invBase;
+invBase=invBase/2.0;
+n=int(float(n)/2.0);
+}
+}
+return result;
+}
+vec2 hammersley(int i,int N)
+{
+return vec2(float(i)/float(N),vanDerCorpus(i,2));
+}
+#endif
+float log4(float x) {
+return log2(x)/2.;
+}
+const float NUM_SAMPLES_FLOAT=float(NUM_SAMPLES);
+const float NUM_SAMPLES_FLOAT_INVERSED=1./NUM_SAMPLES_FLOAT;
+const float K=4.;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#define inline
+vec3 irradiance(samplerCube inputTexture,vec3 inputN,vec2 filteringInfo)
+{
+vec3 n=normalize(inputN);
+vec3 result=vec3(0.0);
+vec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);
+tangent=normalize(cross(tangent,n));
+vec3 bitangent=cross(n,tangent);
+mat3 tbn=mat3(tangent,bitangent,n);
+float maxLevel=filteringInfo.y;
+float dim0=filteringInfo.x;
+float omegaP=(4.*PI)/(6.*dim0*dim0);
+#ifdef WEBGL2
+for(uint i=0u; i0.) {
+float pdf_inversed=PI/NoL;
+float omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;
+float l=log4(omegaS)-log4(omegaP)+log4(K);
+float mipLevel=clamp(l,0.0,maxLevel);
+vec3 c=textureCubeLodEXT(inputTexture,tbn*Ls,mipLevel).rgb;
+#ifdef GAMMA_INPUT
+c=toLinearSpace(c);
+#endif
+result+=c;
+}
+}
+result=result*NUM_SAMPLES_FLOAT_INVERSED;
+return result;
+}
+#define inline
+vec3 radiance(float alphaG,samplerCube inputTexture,vec3 inputN,vec2 filteringInfo)
+{
+vec3 n=normalize(inputN);
+if (alphaG == 0.) {
+vec3 c=textureCube(inputTexture,n).rgb;
+#ifdef GAMMA_INPUT
+c=toLinearSpace(c);
+#endif
+return c;
+}
+vec3 result=vec3(0.);
+vec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);
+tangent=normalize(cross(tangent,n));
+vec3 bitangent=cross(n,tangent);
+mat3 tbn=mat3(tangent,bitangent,n);
+float maxLevel=filteringInfo.y;
+float dim0=filteringInfo.x;
+float omegaP=(4.*PI)/(6.*dim0*dim0);
+float weight=0.;
+#ifdef WEBGL2
+for(uint i=0u; i0.) {
+float pdf_inversed=4./normalDistributionFunction_TrowbridgeReitzGGX(NoH,alphaG);
+float omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;
+float l=log4(omegaS)-log4(omegaP)+log4(K);
+float mipLevel=clamp(float(l),0.0,maxLevel);
+weight+=NoL;
+vec3 c=textureCubeLodEXT(inputTexture,tbn*L,mipLevel).rgb;
+#ifdef GAMMA_INPUT
+c=toLinearSpace(c);
+#endif
+result+=c*NoL;
+}
+}
+result=result/weight;
+return result;
+}
+#endif
+#endif`;
+ We.a.IncludesShadersStore.hdrFilteringFunctions = ny;
+ var iy = `#define CLEARCOATREFLECTANCE90 1.0
+
+struct lightingInfo
+{
+vec3 diffuse;
+#ifdef SPECULARTERM
+vec3 specular;
+#endif
+#ifdef CLEARCOAT
+
+
+vec4 clearCoat;
+#endif
+#ifdef SHEEN
+vec3 sheen;
+#endif
+};
+
+float adjustRoughnessFromLightProperties(float roughness,float lightRadius,float lightDistance) {
+#if defined(USEPHYSICALLIGHTFALLOFF) || defined(USEGLTFLIGHTFALLOFF)
+
+float lightRoughness=lightRadius/lightDistance;
+
+float totalRoughness=saturate(lightRoughness+roughness);
+return totalRoughness;
+#else
+return roughness;
+#endif
+}
+vec3 computeHemisphericDiffuseLighting(preLightingInfo info,vec3 lightColor,vec3 groundColor) {
+return mix(groundColor,lightColor,info.NdotL);
+}
+vec3 computeDiffuseLighting(preLightingInfo info,vec3 lightColor) {
+float diffuseTerm=diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness);
+return diffuseTerm*info.attenuation*info.NdotL*lightColor;
+}
+#define inline
+vec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix){
+vec4 strq=textureProjectionMatrix*vec4(vPositionW,1.0);
+strq/=strq.w;
+vec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;
+return toLinearSpace(textureColor);
+}
+#ifdef SS_TRANSLUCENCY
+vec3 computeDiffuseAndTransmittedLighting(preLightingInfo info,vec3 lightColor,vec3 transmittance) {
+float NdotL=absEps(info.NdotLUnclamped);
+
+float wrapNdotL=computeWrappedDiffuseNdotL(NdotL,0.02);
+
+float trAdapt=step(0.,info.NdotLUnclamped);
+vec3 transmittanceNdotL=mix(transmittance*wrapNdotL,vec3(wrapNdotL),trAdapt);
+float diffuseTerm=diffuseBRDF_Burley(NdotL,info.NdotV,info.VdotH,info.roughness);
+return diffuseTerm*transmittanceNdotL*info.attenuation*lightColor;
+}
+#endif
+#ifdef SPECULARTERM
+vec3 computeSpecularLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {
+float NdotH=saturateEps(dot(N,info.H));
+float roughness=max(info.roughness,geometricRoughnessFactor);
+float alphaG=convertRoughnessToAverageSlope(roughness);
+vec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);
+float distribution=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG);
+#ifdef BRDF_V_HEIGHT_CORRELATED
+float smithVisibility=smithVisibility_GGXCorrelated(info.NdotL,info.NdotV,alphaG);
+#else
+float smithVisibility=smithVisibility_TrowbridgeReitzGGXFast(info.NdotL,info.NdotV,alphaG);
+#endif
+vec3 specTerm=fresnel*distribution*smithVisibility;
+return specTerm*info.attenuation*info.NdotL*lightColor;
+}
+#endif
+#ifdef ANISOTROPIC
+vec3 computeAnisotropicSpecularLighting(preLightingInfo info,vec3 V,vec3 N,vec3 T,vec3 B,float anisotropy,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {
+float NdotH=saturateEps(dot(N,info.H));
+float TdotH=dot(T,info.H);
+float BdotH=dot(B,info.H);
+float TdotV=dot(T,V);
+float BdotV=dot(B,V);
+float TdotL=dot(T,info.L);
+float BdotL=dot(B,info.L);
+float alphaG=convertRoughnessToAverageSlope(info.roughness);
+vec2 alphaTB=getAnisotropicRoughness(alphaG,anisotropy);
+alphaTB=max(alphaTB,square(geometricRoughnessFactor));
+vec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);
+float distribution=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);
+float smithVisibility=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);
+vec3 specTerm=fresnel*distribution*smithVisibility;
+return specTerm*info.attenuation*info.NdotL*lightColor;
+}
+#endif
+#ifdef CLEARCOAT
+vec4 computeClearCoatLighting(preLightingInfo info,vec3 Ncc,float geometricRoughnessFactor,float clearCoatIntensity,vec3 lightColor) {
+float NccdotL=saturateEps(dot(Ncc,info.L));
+float NccdotH=saturateEps(dot(Ncc,info.H));
+float clearCoatRoughness=max(info.roughness,geometricRoughnessFactor);
+float alphaG=convertRoughnessToAverageSlope(clearCoatRoughness);
+float fresnel=fresnelSchlickGGX(info.VdotH,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);
+fresnel*=clearCoatIntensity;
+float distribution=normalDistributionFunction_TrowbridgeReitzGGX(NccdotH,alphaG);
+float kelemenVisibility=visibility_Kelemen(info.VdotH);
+float clearCoatTerm=fresnel*distribution*kelemenVisibility;
+return vec4(
+clearCoatTerm*info.attenuation*NccdotL*lightColor,
+1.0-fresnel
+);
+}
+vec3 computeClearCoatLightingAbsorption(float NdotVRefract,vec3 L,vec3 Ncc,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {
+vec3 LRefract=-refract(L,Ncc,vClearCoatRefractionParams.y);
+float NdotLRefract=saturateEps(dot(Ncc,LRefract));
+vec3 absorption=computeClearCoatAbsorption(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness,clearCoatIntensity);
+return absorption;
+}
+#endif
+#ifdef SHEEN
+vec3 computeSheenLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {
+float NdotH=saturateEps(dot(N,info.H));
+float roughness=max(info.roughness,geometricRoughnessFactor);
+float alphaG=convertRoughnessToAverageSlope(roughness);
+
+
+float fresnel=1.;
+float distribution=normalDistributionFunction_CharlieSheen(NdotH,alphaG);
+
+float visibility=visibility_Ashikhmin(info.NdotL,info.NdotV);
+
+float sheenTerm=fresnel*distribution*visibility;
+return sheenTerm*info.attenuation*info.NdotL*lightColor;
+}
+#endif
+`;
+ We.a.IncludesShadersStore.pbrDirectLightingFunctions = iy;
+ var ry = `#if defined(REFLECTION) || defined(SS_REFRACTION)
+float getLodFromAlphaG(float cubeMapDimensionPixels,float microsurfaceAverageSlope) {
+float microsurfaceAverageSlopeTexels=cubeMapDimensionPixels*microsurfaceAverageSlope;
+float lod=log2(microsurfaceAverageSlopeTexels);
+return lod;
+}
+float getLinearLodFromRoughness(float cubeMapDimensionPixels,float roughness) {
+float lod=log2(cubeMapDimensionPixels)*roughness;
+return lod;
+}
+#endif
+#if defined(ENVIRONMENTBRDF) && defined(RADIANCEOCCLUSION)
+float environmentRadianceOcclusion(float ambientOcclusion,float NdotVUnclamped) {
+
+
+float temp=NdotVUnclamped+ambientOcclusion;
+return saturate(square(temp)-1.0+ambientOcclusion);
+}
+#endif
+#if defined(ENVIRONMENTBRDF) && defined(HORIZONOCCLUSION)
+float environmentHorizonOcclusion(vec3 view,vec3 normal,vec3 geometricNormal) {
+
+vec3 reflection=reflect(view,normal);
+float temp=saturate(1.0+1.1*dot(reflection,geometricNormal));
+return square(temp);
+}
+#endif
+
+
+
+
+#if defined(LODINREFLECTIONALPHA) || defined(SS_LODINREFRACTIONALPHA)
+
+
+#define UNPACK_LOD(x) (1.0-x)*255.0
+float getLodFromAlphaG(float cubeMapDimensionPixels,float alphaG,float NdotV) {
+float microsurfaceAverageSlope=alphaG;
+
+
+
+
+
+
+microsurfaceAverageSlope*=sqrt(abs(NdotV));
+return getLodFromAlphaG(cubeMapDimensionPixels,microsurfaceAverageSlope);
+}
+#endif`;
+ We.a.IncludesShadersStore.pbrIBLFunctions = ry, l(132), l(133);
+ var oy = `struct albedoOpacityOutParams
+{
+vec3 surfaceAlbedo;
+float alpha;
+};
+#define pbr_inline
+void albedoOpacityBlock(
+const in vec4 vAlbedoColor,
+#ifdef ALBEDO
+const in vec4 albedoTexture,
+const in vec2 albedoInfos,
+#endif
+#ifdef OPACITY
+const in vec4 opacityMap,
+const in vec2 vOpacityInfos,
+#endif
+#ifdef DETAIL
+const in vec4 detailColor,
+const in vec4 vDetailInfos,
+#endif
+out albedoOpacityOutParams outParams
+)
+{
+
+vec3 surfaceAlbedo=vAlbedoColor.rgb;
+float alpha=vAlbedoColor.a;
+#ifdef ALBEDO
+#if defined(ALPHAFROMALBEDO) || defined(ALPHATEST)
+alpha*=albedoTexture.a;
+#endif
+#ifdef GAMMAALBEDO
+surfaceAlbedo*=toLinearSpace(albedoTexture.rgb);
+#else
+surfaceAlbedo*=albedoTexture.rgb;
+#endif
+surfaceAlbedo*=albedoInfos.y;
+#endif
+#ifdef VERTEXCOLOR
+surfaceAlbedo*=vColor.rgb;
+#endif
+#ifdef DETAIL
+float detailAlbedo=2.0*mix(0.5,detailColor.r,vDetailInfos.y);
+surfaceAlbedo.rgb=surfaceAlbedo.rgb*detailAlbedo*detailAlbedo;
+#endif
+#define CUSTOM_FRAGMENT_UPDATE_ALBEDO
+
+#ifdef OPACITY
+#ifdef OPACITYRGB
+alpha=getLuminance(opacityMap.rgb);
+#else
+alpha*=opacityMap.a;
+#endif
+alpha*=vOpacityInfos.y;
+#endif
+#ifdef VERTEXALPHA
+alpha*=vColor.a;
+#endif
+#if !defined(SS_LINKREFRACTIONTOTRANSPARENCY) && !defined(ALPHAFRESNEL)
+#ifdef ALPHATEST
+if (alpha0
+vec4 surfaceMetallicColorMap;
+vec4 surfaceReflectivityColorMap;
+vec2 metallicRoughness;
+vec3 metallicF0;
+#endif
+};
+#define pbr_inline
+void reflectivityBlock(
+const in vec4 vReflectivityColor,
+#ifdef METALLICWORKFLOW
+const in vec3 surfaceAlbedo,
+const in vec4 metallicReflectanceFactors,
+#endif
+#ifdef REFLECTIVITY
+const in vec3 reflectivityInfos,
+const in vec4 surfaceMetallicOrReflectivityColorMap,
+#endif
+#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)
+const in vec3 ambientOcclusionColorIn,
+#endif
+#ifdef MICROSURFACEMAP
+const in vec4 microSurfaceTexel,
+#endif
+#ifdef DETAIL
+const in vec4 detailColor,
+const in vec4 vDetailInfos,
+#endif
+out reflectivityOutParams outParams
+)
+{
+float microSurface=vReflectivityColor.a;
+vec3 surfaceReflectivityColor=vReflectivityColor.rgb;
+#ifdef METALLICWORKFLOW
+vec2 metallicRoughness=surfaceReflectivityColor.rg;
+#ifdef REFLECTIVITY
+#if DEBUGMODE>0
+outParams.surfaceMetallicColorMap=surfaceMetallicOrReflectivityColorMap;
+#endif
+#ifdef AOSTOREINMETALMAPRED
+vec3 aoStoreInMetalMap=vec3(surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r);
+outParams.ambientOcclusionColor=mix(ambientOcclusionColorIn,aoStoreInMetalMap,reflectivityInfos.z);
+#endif
+#ifdef METALLNESSSTOREINMETALMAPBLUE
+metallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.b;
+#else
+metallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.r;
+#endif
+#ifdef ROUGHNESSSTOREINMETALMAPALPHA
+metallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.a;
+#else
+#ifdef ROUGHNESSSTOREINMETALMAPGREEN
+metallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.g;
+#endif
+#endif
+#endif
+#ifdef DETAIL
+float detailRoughness=mix(0.5,detailColor.b,vDetailInfos.w);
+float loLerp=mix(0.,metallicRoughness.g,detailRoughness*2.);
+float hiLerp=mix(metallicRoughness.g,1.,(detailRoughness-0.5)*2.);
+metallicRoughness.g=mix(loLerp,hiLerp,step(detailRoughness,0.5));
+#endif
+#ifdef MICROSURFACEMAP
+metallicRoughness.g*=microSurfaceTexel.r;
+#endif
+#if DEBUGMODE>0
+outParams.metallicRoughness=metallicRoughness;
+#endif
+#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS
+
+microSurface=1.0-metallicRoughness.g;
+
+vec3 baseColor=surfaceAlbedo;
+#ifdef FROSTBITE_REFLECTANCE
+
+
+
+
+
+
+outParams.surfaceAlbedo=baseColor.rgb*(1.0-metallicRoughness.r);
+
+surfaceReflectivityColor=mix(0.16*reflectance*reflectance,baseColor,metallicRoughness.r);
+#else
+vec3 metallicF0=metallicReflectanceFactors.rgb;
+#if DEBUGMODE>0
+outParams.metallicF0=metallicF0;
+#endif
+
+outParams.surfaceAlbedo=mix(baseColor.rgb*(1.0-metallicF0),vec3(0.,0.,0.),metallicRoughness.r);
+
+surfaceReflectivityColor=mix(metallicF0,baseColor,metallicRoughness.r);
+#endif
+#else
+#ifdef REFLECTIVITY
+surfaceReflectivityColor*=surfaceMetallicOrReflectivityColorMap.rgb;
+#if DEBUGMODE>0
+outParams.surfaceReflectivityColorMap=surfaceMetallicOrReflectivityColorMap;
+#endif
+#ifdef MICROSURFACEFROMREFLECTIVITYMAP
+microSurface*=surfaceMetallicOrReflectivityColorMap.a;
+microSurface*=reflectivityInfos.z;
+#else
+#ifdef MICROSURFACEAUTOMATIC
+microSurface*=computeDefaultMicroSurface(microSurface,surfaceReflectivityColor);
+#endif
+#ifdef MICROSURFACEMAP
+microSurface*=microSurfaceTexel.r;
+#endif
+#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE
+#endif
+#endif
+#endif
+
+microSurface=saturate(microSurface);
+
+float roughness=1.-microSurface;
+outParams.microSurface=microSurface;
+outParams.roughness=roughness;
+outParams.surfaceReflectivityColor=surfaceReflectivityColor;
+}
+`;
+ We.a.IncludesShadersStore.pbrBlockReflectivity = ay;
+ var sy = `struct ambientOcclusionOutParams
+{
+vec3 ambientOcclusionColor;
+#if DEBUGMODE>0
+vec3 ambientOcclusionColorMap;
+#endif
+};
+#define pbr_inline
+void ambientOcclusionBlock(
+#ifdef AMBIENT
+const in vec3 ambientOcclusionColorMap_,
+const in vec4 vAmbientInfos,
+#endif
+out ambientOcclusionOutParams outParams
+)
+{
+vec3 ambientOcclusionColor=vec3(1.,1.,1.);
+#ifdef AMBIENT
+vec3 ambientOcclusionColorMap=ambientOcclusionColorMap_*vAmbientInfos.y;
+#ifdef AMBIENTINGRAYSCALE
+ambientOcclusionColorMap=vec3(ambientOcclusionColorMap.r,ambientOcclusionColorMap.r,ambientOcclusionColorMap.r);
+#endif
+ambientOcclusionColor=mix(ambientOcclusionColor,ambientOcclusionColorMap,vAmbientInfos.z);
+#if DEBUGMODE>0
+outParams.ambientOcclusionColorMap=ambientOcclusionColorMap;
+#endif
+#endif
+outParams.ambientOcclusionColor=ambientOcclusionColor;
+}
+`;
+ We.a.IncludesShadersStore.pbrBlockAmbientOcclusion = sy;
+ var cy = `#ifdef ALPHAFRESNEL
+#if defined(ALPHATEST) || defined(ALPHABLEND)
+struct alphaFresnelOutParams
+{
+float alpha;
+};
+#define pbr_inline
+void alphaFresnelBlock(
+const in vec3 normalW,
+const in vec3 viewDirectionW,
+const in float alpha,
+const in float microSurface,
+out alphaFresnelOutParams outParams
+)
+{
+
+
+
+float opacityPerceptual=alpha;
+#ifdef LINEARALPHAFRESNEL
+float opacity0=opacityPerceptual;
+#else
+float opacity0=opacityPerceptual*opacityPerceptual;
+#endif
+float opacity90=fresnelGrazingReflectance(opacity0);
+vec3 normalForward=faceforward(normalW,-viewDirectionW,normalW);
+
+outParams.alpha=getReflectanceFromAnalyticalBRDFLookup_Jones(saturate(dot(viewDirectionW,normalForward)),vec3(opacity0),vec3(opacity90),sqrt(microSurface)).x;
+#ifdef ALPHATEST
+if (outParams.alpha0
+vec3 anisotropyMapData;
+#endif
+};
+#define pbr_inline
+void anisotropicBlock(
+const in vec3 vAnisotropy,
+#ifdef ANISOTROPIC_TEXTURE
+const in vec3 anisotropyMapData,
+#endif
+const in mat3 TBN,
+const in vec3 normalW,
+const in vec3 viewDirectionW,
+out anisotropicOutParams outParams
+)
+{
+float anisotropy=vAnisotropy.b;
+vec3 anisotropyDirection=vec3(vAnisotropy.xy,0.);
+#ifdef ANISOTROPIC_TEXTURE
+anisotropy*=anisotropyMapData.b;
+anisotropyDirection.rg*=anisotropyMapData.rg*2.0-1.0;
+#if DEBUGMODE>0
+outParams.anisotropyMapData=anisotropyMapData;
+#endif
+#endif
+mat3 anisoTBN=mat3(normalize(TBN[0]),normalize(TBN[1]),normalize(TBN[2]));
+vec3 anisotropicTangent=normalize(anisoTBN*anisotropyDirection);
+vec3 anisotropicBitangent=normalize(cross(anisoTBN[2],anisotropicTangent));
+outParams.anisotropy=anisotropy;
+outParams.anisotropicTangent=anisotropicTangent;
+outParams.anisotropicBitangent=anisotropicBitangent;
+outParams.anisotropicNormal=getAnisotropicBentNormals(anisotropicTangent,anisotropicBitangent,normalW,viewDirectionW,anisotropy);
+}
+#endif
+`;
+ We.a.IncludesShadersStore.pbrBlockAnisotropic = ly;
+ var uy = `#ifdef REFLECTION
+struct reflectionOutParams
+{
+vec4 environmentRadiance;
+vec3 environmentIrradiance;
+#ifdef REFLECTIONMAP_3D
+vec3 reflectionCoords;
+#else
+vec2 reflectionCoords;
+#endif
+#ifdef SS_TRANSLUCENCY
+#ifdef USESPHERICALFROMREFLECTIONMAP
+#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)
+vec3 irradianceVector;
+#endif
+#endif
+#endif
+};
+#define pbr_inline
+void createReflectionCoords(
+const in vec3 vPositionW,
+const in vec3 normalW,
+#ifdef ANISOTROPIC
+const in anisotropicOutParams anisotropicOut,
+#endif
+#ifdef REFLECTIONMAP_3D
+out vec3 reflectionCoords
+#else
+out vec2 reflectionCoords
+#endif
+)
+{
+#ifdef ANISOTROPIC
+vec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),anisotropicOut.anisotropicNormal);
+#else
+vec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW);
+#endif
+#ifdef REFLECTIONMAP_OPPOSITEZ
+reflectionVector.z*=-1.0;
+#endif
+
+#ifdef REFLECTIONMAP_3D
+reflectionCoords=reflectionVector;
+#else
+reflectionCoords=reflectionVector.xy;
+#ifdef REFLECTIONMAP_PROJECTION
+reflectionCoords/=reflectionVector.z;
+#endif
+reflectionCoords.y=1.0-reflectionCoords.y;
+#endif
+}
+#define pbr_inline
+#define inline
+void sampleReflectionTexture(
+const in float alphaG,
+const in vec3 vReflectionMicrosurfaceInfos,
+const in vec2 vReflectionInfos,
+const in vec3 vReflectionColor,
+#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
+const in float NdotVUnclamped,
+#endif
+#ifdef LINEARSPECULARREFLECTION
+const in float roughness,
+#endif
+#ifdef REFLECTIONMAP_3D
+const in samplerCube reflectionSampler,
+const vec3 reflectionCoords,
+#else
+const in sampler2D reflectionSampler,
+const vec2 reflectionCoords,
+#endif
+#ifndef LODBASEDMICROSFURACE
+#ifdef REFLECTIONMAP_3D
+const in samplerCube reflectionSamplerLow,
+const in samplerCube reflectionSamplerHigh,
+#else
+const in sampler2D reflectionSamplerLow,
+const in sampler2D reflectionSamplerHigh,
+#endif
+#endif
+#ifdef REALTIME_FILTERING
+const in vec2 vReflectionFilteringInfo,
+#endif
+out vec4 environmentRadiance
+)
+{
+
+#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
+float reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG,NdotVUnclamped);
+#elif defined(LINEARSPECULARREFLECTION)
+float reflectionLOD=getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x,roughness);
+#else
+float reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG);
+#endif
+#ifdef LODBASEDMICROSFURACE
+
+reflectionLOD=reflectionLOD*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;
+#ifdef LODINREFLECTIONALPHA
+
+
+
+
+
+
+
+
+
+float automaticReflectionLOD=UNPACK_LOD(sampleReflection(reflectionSampler,reflectionCoords).a);
+float requestedReflectionLOD=max(automaticReflectionLOD,reflectionLOD);
+#else
+float requestedReflectionLOD=reflectionLOD;
+#endif
+#ifdef REALTIME_FILTERING
+environmentRadiance=vec4(radiance(alphaG,reflectionSampler,reflectionCoords,vReflectionFilteringInfo),1.0);
+#else
+environmentRadiance=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);
+#endif
+#else
+float lodReflectionNormalized=saturate(reflectionLOD/log2(vReflectionMicrosurfaceInfos.x));
+float lodReflectionNormalizedDoubled=lodReflectionNormalized*2.0;
+vec4 environmentMid=sampleReflection(reflectionSampler,reflectionCoords);
+if (lodReflectionNormalizedDoubled<1.0){
+environmentRadiance=mix(
+sampleReflection(reflectionSamplerHigh,reflectionCoords),
+environmentMid,
+lodReflectionNormalizedDoubled
+);
+} else {
+environmentRadiance=mix(
+environmentMid,
+sampleReflection(reflectionSamplerLow,reflectionCoords),
+lodReflectionNormalizedDoubled-1.0
+);
+}
+#endif
+#ifdef RGBDREFLECTION
+environmentRadiance.rgb=fromRGBD(environmentRadiance);
+#endif
+#ifdef GAMMAREFLECTION
+environmentRadiance.rgb=toLinearSpace(environmentRadiance.rgb);
+#endif
+
+environmentRadiance.rgb*=vReflectionInfos.x;
+environmentRadiance.rgb*=vReflectionColor.rgb;
+}
+#define pbr_inline
+#define inline
+void reflectionBlock(
+const in vec3 vPositionW,
+const in vec3 normalW,
+const in float alphaG,
+const in vec3 vReflectionMicrosurfaceInfos,
+const in vec2 vReflectionInfos,
+const in vec3 vReflectionColor,
+#ifdef ANISOTROPIC
+const in anisotropicOutParams anisotropicOut,
+#endif
+#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
+const in float NdotVUnclamped,
+#endif
+#ifdef LINEARSPECULARREFLECTION
+const in float roughness,
+#endif
+#ifdef REFLECTIONMAP_3D
+const in samplerCube reflectionSampler,
+#else
+const in sampler2D reflectionSampler,
+#endif
+#if defined(NORMAL) && defined(USESPHERICALINVERTEX)
+const in vec3 vEnvironmentIrradiance,
+#endif
+#ifdef USESPHERICALFROMREFLECTIONMAP
+#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)
+const in mat4 reflectionMatrix,
+#endif
+#endif
+#ifdef USEIRRADIANCEMAP
+#ifdef REFLECTIONMAP_3D
+const in samplerCube irradianceSampler,
+#else
+const in sampler2D irradianceSampler,
+#endif
+#endif
+#ifndef LODBASEDMICROSFURACE
+#ifdef REFLECTIONMAP_3D
+const in samplerCube reflectionSamplerLow,
+const in samplerCube reflectionSamplerHigh,
+#else
+const in sampler2D reflectionSamplerLow,
+const in sampler2D reflectionSamplerHigh,
+#endif
+#endif
+#ifdef REALTIME_FILTERING
+const in vec2 vReflectionFilteringInfo,
+#endif
+out reflectionOutParams outParams
+)
+{
+
+vec4 environmentRadiance=vec4(0.,0.,0.,0.);
+#ifdef REFLECTIONMAP_3D
+vec3 reflectionCoords=vec3(0.);
+#else
+vec2 reflectionCoords=vec2(0.);
+#endif
+createReflectionCoords(
+vPositionW,
+normalW,
+#ifdef ANISOTROPIC
+anisotropicOut,
+#endif
+reflectionCoords
+);
+sampleReflectionTexture(
+alphaG,
+vReflectionMicrosurfaceInfos,
+vReflectionInfos,
+vReflectionColor,
+#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
+NdotVUnclamped,
+#endif
+#ifdef LINEARSPECULARREFLECTION
+roughness,
+#endif
+#ifdef REFLECTIONMAP_3D
+reflectionSampler,
+reflectionCoords,
+#else
+reflectionSampler,
+reflectionCoords,
+#endif
+#ifndef LODBASEDMICROSFURACE
+reflectionSamplerLow,
+reflectionSamplerHigh,
+#endif
+#ifdef REALTIME_FILTERING
+vReflectionFilteringInfo,
+#endif
+environmentRadiance
+);
+
+vec3 environmentIrradiance=vec3(0.,0.,0.);
+#ifdef USESPHERICALFROMREFLECTIONMAP
+#if defined(NORMAL) && defined(USESPHERICALINVERTEX)
+environmentIrradiance=vEnvironmentIrradiance;
+#else
+#ifdef ANISOTROPIC
+vec3 irradianceVector=vec3(reflectionMatrix*vec4(anisotropicOut.anisotropicNormal,0)).xyz;
+#else
+vec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz;
+#endif
+#ifdef REFLECTIONMAP_OPPOSITEZ
+irradianceVector.z*=-1.0;
+#endif
+#ifdef INVERTCUBICMAP
+irradianceVector.y*=-1.0;
+#endif
+#if defined(REALTIME_FILTERING)
+environmentIrradiance=irradiance(reflectionSampler,irradianceVector,vReflectionFilteringInfo);
+#else
+environmentIrradiance=computeEnvironmentIrradiance(irradianceVector);
+#endif
+#ifdef SS_TRANSLUCENCY
+outParams.irradianceVector=irradianceVector;
+#endif
+#endif
+#elif defined(USEIRRADIANCEMAP)
+vec4 environmentIrradiance4=sampleReflection(irradianceSampler,reflectionCoords);
+environmentIrradiance=environmentIrradiance4.rgb;
+#ifdef RGBDREFLECTION
+environmentIrradiance.rgb=fromRGBD(environmentIrradiance4);
+#endif
+#ifdef GAMMAREFLECTION
+environmentIrradiance.rgb=toLinearSpace(environmentIrradiance.rgb);
+#endif
+#endif
+environmentIrradiance*=vReflectionColor.rgb;
+outParams.environmentRadiance=environmentRadiance;
+outParams.environmentIrradiance=environmentIrradiance;
+outParams.reflectionCoords=reflectionCoords;
+}
+#endif
+`;
+ We.a.IncludesShadersStore.pbrBlockReflection = uy;
+ var hy = `#ifdef SHEEN
+struct sheenOutParams
+{
+float sheenIntensity;
+vec3 sheenColor;
+float sheenRoughness;
+#ifdef SHEEN_LINKWITHALBEDO
+vec3 surfaceAlbedo;
+#endif
+#if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)
+float sheenAlbedoScaling;
+#endif
+#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)
+vec3 finalSheenRadianceScaled;
+#endif
+#if DEBUGMODE>0
+vec4 sheenMapData;
+vec3 sheenEnvironmentReflectance;
+#endif
+};
+#define pbr_inline
+#define inline
+void sheenBlock(
+const in vec4 vSheenColor,
+#ifdef SHEEN_ROUGHNESS
+const in float vSheenRoughness,
+#if defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)
+const in vec4 sheenMapRoughnessData,
+#endif
+#endif
+const in float roughness,
+#ifdef SHEEN_TEXTURE
+const in vec4 sheenMapData,
+#endif
+const in float reflectance,
+#ifdef SHEEN_LINKWITHALBEDO
+const in vec3 baseColor,
+const in vec3 surfaceAlbedo,
+#endif
+#ifdef ENVIRONMENTBRDF
+const in float NdotV,
+const in vec3 environmentBrdf,
+#endif
+#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)
+const in vec2 AARoughnessFactors,
+const in vec3 vReflectionMicrosurfaceInfos,
+const in vec2 vReflectionInfos,
+const in vec3 vReflectionColor,
+const in vec4 vLightingIntensity,
+#ifdef REFLECTIONMAP_3D
+const in samplerCube reflectionSampler,
+const in vec3 reflectionCoords,
+#else
+const in sampler2D reflectionSampler,
+const in vec2 reflectionCoords,
+#endif
+const in float NdotVUnclamped,
+#ifndef LODBASEDMICROSFURACE
+#ifdef REFLECTIONMAP_3D
+const in samplerCube reflectionSamplerLow,
+const in samplerCube reflectionSamplerHigh,
+#else
+const in sampler2D reflectionSamplerLow,
+const in sampler2D reflectionSamplerHigh,
+#endif
+#endif
+#ifdef REALTIME_FILTERING
+const in vec2 vReflectionFilteringInfo,
+#endif
+#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)
+const in float seo,
+#endif
+#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)
+const in float eho,
+#endif
+#endif
+out sheenOutParams outParams
+)
+{
+float sheenIntensity=vSheenColor.a;
+#ifdef SHEEN_TEXTURE
+#if DEBUGMODE>0
+outParams.sheenMapData=sheenMapData;
+#endif
+#endif
+#ifdef SHEEN_LINKWITHALBEDO
+float sheenFactor=pow5(1.0-sheenIntensity);
+vec3 sheenColor=baseColor.rgb*(1.0-sheenFactor);
+float sheenRoughness=sheenIntensity;
+outParams.surfaceAlbedo=surfaceAlbedo*sheenFactor;
+#ifdef SHEEN_TEXTURE
+sheenIntensity*=sheenMapData.a;
+#endif
+#else
+vec3 sheenColor=vSheenColor.rgb;
+#ifdef SHEEN_TEXTURE
+sheenColor.rgb*=sheenMapData.rgb;
+#endif
+#ifdef SHEEN_ROUGHNESS
+float sheenRoughness=vSheenRoughness;
+#ifdef SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE
+#if defined(SHEEN_TEXTURE)
+sheenRoughness*=sheenMapData.a;
+#endif
+#elif defined(SHEEN_TEXTURE_ROUGHNESS)
+#ifdef SHEEN_TEXTURE_ROUGHNESS_IDENTICAL
+sheenRoughness*=sheenMapData.a;
+#else
+sheenRoughness*=sheenMapRoughnessData.a;
+#endif
+#endif
+#else
+float sheenRoughness=roughness;
+#ifdef SHEEN_TEXTURE
+sheenIntensity*=sheenMapData.a;
+#endif
+#endif
+
+#if !defined(SHEEN_ALBEDOSCALING)
+sheenIntensity*=(1.-reflectance);
+#endif
+
+sheenColor*=sheenIntensity;
+#endif
+
+#ifdef ENVIRONMENTBRDF
+
+#ifdef SHEEN_ROUGHNESS
+vec3 environmentSheenBrdf=getBRDFLookup(NdotV,sheenRoughness);
+#else
+vec3 environmentSheenBrdf=environmentBrdf;
+#endif
+
+#endif
+#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)
+float sheenAlphaG=convertRoughnessToAverageSlope(sheenRoughness);
+#ifdef SPECULARAA
+
+sheenAlphaG+=AARoughnessFactors.y;
+#endif
+vec4 environmentSheenRadiance=vec4(0.,0.,0.,0.);
+sampleReflectionTexture(
+sheenAlphaG,
+vReflectionMicrosurfaceInfos,
+vReflectionInfos,
+vReflectionColor,
+#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
+NdotVUnclamped,
+#endif
+#ifdef LINEARSPECULARREFLECTION
+sheenRoughness,
+#endif
+reflectionSampler,
+reflectionCoords,
+#ifndef LODBASEDMICROSFURACE
+reflectionSamplerLow,
+reflectionSamplerHigh,
+#endif
+#ifdef REALTIME_FILTERING
+vReflectionFilteringInfo,
+#endif
+environmentSheenRadiance
+);
+vec3 sheenEnvironmentReflectance=getSheenReflectanceFromBRDFLookup(sheenColor,environmentSheenBrdf);
+#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)
+sheenEnvironmentReflectance*=seo;
+#endif
+#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)
+sheenEnvironmentReflectance*=eho;
+#endif
+#if DEBUGMODE>0
+outParams.sheenEnvironmentReflectance=sheenEnvironmentReflectance;
+#endif
+outParams.finalSheenRadianceScaled=
+environmentSheenRadiance.rgb *
+sheenEnvironmentReflectance *
+vLightingIntensity.z;
+
+
+
+
+
+#endif
+#if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)
+
+
+
+outParams.sheenAlbedoScaling=1.0-sheenIntensity*max(max(sheenColor.r,sheenColor.g),sheenColor.b)*environmentSheenBrdf.b;
+#endif
+
+outParams.sheenIntensity=sheenIntensity;
+outParams.sheenColor=sheenColor;
+outParams.sheenRoughness=sheenRoughness;
+}
+#endif
+`;
+ We.a.IncludesShadersStore.pbrBlockSheen = hy;
+ var dy = `struct clearcoatOutParams
+{
+vec3 specularEnvironmentR0;
+float conservationFactor;
+vec3 clearCoatNormalW;
+vec2 clearCoatAARoughnessFactors;
+float clearCoatIntensity;
+float clearCoatRoughness;
+#ifdef REFLECTION
+vec3 finalClearCoatRadianceScaled;
+#endif
+#ifdef CLEARCOAT_TINT
+vec3 absorption;
+float clearCoatNdotVRefract;
+vec3 clearCoatColor;
+float clearCoatThickness;
+#endif
+#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)
+vec3 energyConservationFactorClearCoat;
+#endif
+#if DEBUGMODE>0
+mat3 TBNClearCoat;
+vec2 clearCoatMapData;
+vec4 clearCoatTintMapData;
+vec4 environmentClearCoatRadiance;
+float clearCoatNdotV;
+vec3 clearCoatEnvironmentReflectance;
+#endif
+};
+#ifdef CLEARCOAT
+#define pbr_inline
+#define inline
+void clearcoatBlock(
+const in vec3 vPositionW,
+const in vec3 geometricNormalW,
+const in vec3 viewDirectionW,
+const in vec2 vClearCoatParams,
+#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)
+const in vec4 clearCoatMapRoughnessData,
+#endif
+const in vec3 specularEnvironmentR0,
+#ifdef CLEARCOAT_TEXTURE
+const in vec2 clearCoatMapData,
+#endif
+#ifdef CLEARCOAT_TINT
+const in vec4 vClearCoatTintParams,
+const in float clearCoatColorAtDistance,
+const in vec4 vClearCoatRefractionParams,
+#ifdef CLEARCOAT_TINT_TEXTURE
+const in vec4 clearCoatTintMapData,
+#endif
+#endif
+#ifdef CLEARCOAT_BUMP
+const in vec2 vClearCoatBumpInfos,
+const in vec4 clearCoatBumpMapData,
+const in vec2 vClearCoatBumpUV,
+#if defined(TANGENT) && defined(NORMAL)
+const in mat3 vTBN,
+#else
+const in vec2 vClearCoatTangentSpaceParams,
+#endif
+#ifdef OBJECTSPACE_NORMALMAP
+const in mat4 normalMatrix,
+#endif
+#endif
+#if defined(FORCENORMALFORWARD) && defined(NORMAL)
+const in vec3 faceNormal,
+#endif
+#ifdef REFLECTION
+const in vec3 vReflectionMicrosurfaceInfos,
+const in vec2 vReflectionInfos,
+const in vec3 vReflectionColor,
+const in vec4 vLightingIntensity,
+#ifdef REFLECTIONMAP_3D
+const in samplerCube reflectionSampler,
+#else
+const in sampler2D reflectionSampler,
+#endif
+#ifndef LODBASEDMICROSFURACE
+#ifdef REFLECTIONMAP_3D
+const in samplerCube reflectionSamplerLow,
+const in samplerCube reflectionSamplerHigh,
+#else
+const in sampler2D reflectionSamplerLow,
+const in sampler2D reflectionSamplerHigh,
+#endif
+#endif
+#ifdef REALTIME_FILTERING
+const in vec2 vReflectionFilteringInfo,
+#endif
+#endif
+#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
+#ifdef RADIANCEOCCLUSION
+const in float ambientMonochrome,
+#endif
+#endif
+out clearcoatOutParams outParams
+)
+{
+
+float clearCoatIntensity=vClearCoatParams.x;
+float clearCoatRoughness=vClearCoatParams.y;
+#ifdef CLEARCOAT_TEXTURE
+clearCoatIntensity*=clearCoatMapData.x;
+#ifdef CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE
+clearCoatRoughness*=clearCoatMapData.y;
+#endif
+#if DEBUGMODE>0
+outParams.clearCoatMapData=clearCoatMapData;
+#endif
+#endif
+#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)
+#ifdef CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL
+clearCoatRoughness*=clearCoatMapData.y;
+#else
+clearCoatRoughness*=clearCoatMapRoughnessData.y;
+#endif
+#endif
+outParams.clearCoatIntensity=clearCoatIntensity;
+outParams.clearCoatRoughness=clearCoatRoughness;
+#ifdef CLEARCOAT_TINT
+vec3 clearCoatColor=vClearCoatTintParams.rgb;
+float clearCoatThickness=vClearCoatTintParams.a;
+#ifdef CLEARCOAT_TINT_TEXTURE
+clearCoatColor*=clearCoatTintMapData.rgb;
+clearCoatThickness*=clearCoatTintMapData.a;
+#if DEBUGMODE>0
+outParams.clearCoatTintMapData=clearCoatTintMapData;
+#endif
+#endif
+outParams.clearCoatColor=computeColorAtDistanceInMedia(clearCoatColor,clearCoatColorAtDistance);
+outParams.clearCoatThickness=clearCoatThickness;
+#endif
+
+
+
+
+#ifdef CLEARCOAT_REMAP_F0
+vec3 specularEnvironmentR0Updated=getR0RemappedForClearCoat(specularEnvironmentR0);
+#else
+vec3 specularEnvironmentR0Updated=specularEnvironmentR0;
+#endif
+outParams.specularEnvironmentR0=mix(specularEnvironmentR0,specularEnvironmentR0Updated,clearCoatIntensity);
+
+vec3 clearCoatNormalW=geometricNormalW;
+#ifdef CLEARCOAT_BUMP
+#ifdef NORMALXYSCALE
+float clearCoatNormalScale=1.0;
+#else
+float clearCoatNormalScale=vClearCoatBumpInfos.y;
+#endif
+#if defined(TANGENT) && defined(NORMAL)
+mat3 TBNClearCoat=vTBN;
+#else
+mat3 TBNClearCoat=cotangent_frame(clearCoatNormalW*clearCoatNormalScale,vPositionW,vClearCoatBumpUV,vClearCoatTangentSpaceParams);
+#endif
+#if DEBUGMODE>0
+outParams.TBNClearCoat=TBNClearCoat;
+#endif
+#ifdef OBJECTSPACE_NORMALMAP
+clearCoatNormalW=normalize(clearCoatBumpMapData.xyz*2.0-1.0);
+clearCoatNormalW=normalize(mat3(normalMatrix)*clearCoatNormalW);
+#else
+clearCoatNormalW=perturbNormal(TBNClearCoat,clearCoatBumpMapData.xyz,vClearCoatBumpInfos.y);
+#endif
+#endif
+#if defined(FORCENORMALFORWARD) && defined(NORMAL)
+clearCoatNormalW*=sign(dot(clearCoatNormalW,faceNormal));
+#endif
+#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)
+clearCoatNormalW=gl_FrontFacing ? clearCoatNormalW : -clearCoatNormalW;
+#endif
+outParams.clearCoatNormalW=clearCoatNormalW;
+
+outParams.clearCoatAARoughnessFactors=getAARoughnessFactors(clearCoatNormalW.xyz);
+
+float clearCoatNdotVUnclamped=dot(clearCoatNormalW,viewDirectionW);
+
+float clearCoatNdotV=absEps(clearCoatNdotVUnclamped);
+#if DEBUGMODE>0
+outParams.clearCoatNdotV=clearCoatNdotV;
+#endif
+#ifdef CLEARCOAT_TINT
+
+vec3 clearCoatVRefract=-refract(vPositionW,clearCoatNormalW,vClearCoatRefractionParams.y);
+
+outParams.clearCoatNdotVRefract=absEps(dot(clearCoatNormalW,clearCoatVRefract));
+#endif
+#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
+
+vec3 environmentClearCoatBrdf=getBRDFLookup(clearCoatNdotV,clearCoatRoughness);
+#endif
+
+#if defined(REFLECTION)
+float clearCoatAlphaG=convertRoughnessToAverageSlope(clearCoatRoughness);
+#ifdef SPECULARAA
+
+clearCoatAlphaG+=outParams.clearCoatAARoughnessFactors.y;
+#endif
+vec4 environmentClearCoatRadiance=vec4(0.,0.,0.,0.);
+vec3 clearCoatReflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),clearCoatNormalW);
+#ifdef REFLECTIONMAP_OPPOSITEZ
+clearCoatReflectionVector.z*=-1.0;
+#endif
+
+#ifdef REFLECTIONMAP_3D
+vec3 clearCoatReflectionCoords=clearCoatReflectionVector;
+#else
+vec2 clearCoatReflectionCoords=clearCoatReflectionVector.xy;
+#ifdef REFLECTIONMAP_PROJECTION
+clearCoatReflectionCoords/=clearCoatReflectionVector.z;
+#endif
+clearCoatReflectionCoords.y=1.0-clearCoatReflectionCoords.y;
+#endif
+sampleReflectionTexture(
+clearCoatAlphaG,
+vReflectionMicrosurfaceInfos,
+vReflectionInfos,
+vReflectionColor,
+#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
+clearCoatNdotVUnclamped,
+#endif
+#ifdef LINEARSPECULARREFLECTION
+clearCoatRoughness,
+#endif
+reflectionSampler,
+clearCoatReflectionCoords,
+#ifndef LODBASEDMICROSFURACE
+reflectionSamplerLow,
+reflectionSamplerHigh,
+#endif
+#ifdef REALTIME_FILTERING
+vReflectionFilteringInfo,
+#endif
+environmentClearCoatRadiance
+);
+#if DEBUGMODE>0
+outParams.environmentClearCoatRadiance=environmentClearCoatRadiance;
+#endif
+
+#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
+vec3 clearCoatEnvironmentReflectance=getReflectanceFromBRDFLookup(vec3(vClearCoatRefractionParams.x),environmentClearCoatBrdf);
+#ifdef RADIANCEOCCLUSION
+float clearCoatSeo=environmentRadianceOcclusion(ambientMonochrome,clearCoatNdotVUnclamped);
+clearCoatEnvironmentReflectance*=clearCoatSeo;
+#endif
+#ifdef HORIZONOCCLUSION
+#ifdef BUMP
+#ifdef REFLECTIONMAP_3D
+float clearCoatEho=environmentHorizonOcclusion(-viewDirectionW,clearCoatNormalW,geometricNormalW);
+clearCoatEnvironmentReflectance*=clearCoatEho;
+#endif
+#endif
+#endif
+#else
+
+vec3 clearCoatEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(clearCoatNdotV,vec3(1.),vec3(1.),sqrt(1.-clearCoatRoughness));
+#endif
+clearCoatEnvironmentReflectance*=clearCoatIntensity;
+#if DEBUGMODE>0
+outParams.clearCoatEnvironmentReflectance=clearCoatEnvironmentReflectance;
+#endif
+outParams.finalClearCoatRadianceScaled=
+environmentClearCoatRadiance.rgb *
+clearCoatEnvironmentReflectance *
+vLightingIntensity.z;
+#endif
+#if defined(CLEARCOAT_TINT)
+
+outParams.absorption=computeClearCoatAbsorption(outParams.clearCoatNdotVRefract,outParams.clearCoatNdotVRefract,outParams.clearCoatColor,clearCoatThickness,clearCoatIntensity);
+#endif
+
+float fresnelIBLClearCoat=fresnelSchlickGGX(clearCoatNdotV,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);
+fresnelIBLClearCoat*=clearCoatIntensity;
+outParams.conservationFactor=(1.-fresnelIBLClearCoat);
+#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)
+outParams.energyConservationFactorClearCoat=getEnergyConservationFactor(outParams.specularEnvironmentR0,environmentClearCoatBrdf);
+#endif
+}
+#endif
+`;
+ We.a.IncludesShadersStore.pbrBlockClearcoat = dy;
+ var fy = `struct subSurfaceOutParams
+{
+vec3 specularEnvironmentReflectance;
+#ifdef SS_REFRACTION
+vec3 finalRefraction;
+vec3 surfaceAlbedo;
+#ifdef SS_LINKREFRACTIONTOTRANSPARENCY
+float alpha;
+#endif
+#ifdef REFLECTION
+float refractionFactorForIrradiance;
+#endif
+#endif
+#ifdef SS_TRANSLUCENCY
+vec3 transmittance;
+float translucencyIntensity;
+#ifdef REFLECTION
+vec3 refractionIrradiance;
+#endif
+#endif
+#if DEBUGMODE>0
+vec4 thicknessMap;
+vec4 environmentRefraction;
+vec3 refractionTransmittance;
+#endif
+};
+#ifdef SUBSURFACE
+#define pbr_inline
+#define inline
+void subSurfaceBlock(
+const in vec3 vSubSurfaceIntensity,
+const in vec2 vThicknessParam,
+const in vec4 vTintColor,
+const in vec3 normalW,
+const in vec3 specularEnvironmentReflectance,
+#ifdef SS_THICKNESSANDMASK_TEXTURE
+const in vec4 thicknessMap,
+#endif
+#ifdef REFLECTION
+#ifdef SS_TRANSLUCENCY
+const in mat4 reflectionMatrix,
+#ifdef USESPHERICALFROMREFLECTIONMAP
+#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)
+const in vec3 irradianceVector_,
+#endif
+#if defined(REALTIME_FILTERING)
+const in samplerCube reflectionSampler,
+const in vec2 vReflectionFilteringInfo,
+#endif
+#endif
+#ifdef USEIRRADIANCEMAP
+#ifdef REFLECTIONMAP_3D
+const in samplerCube irradianceSampler,
+#else
+const in sampler2D irradianceSampler,
+#endif
+#endif
+#endif
+#endif
+#ifdef SS_REFRACTION
+const in vec3 vPositionW,
+const in vec3 viewDirectionW,
+const in mat4 view,
+const in vec3 surfaceAlbedo,
+const in vec4 vRefractionInfos,
+const in mat4 refractionMatrix,
+const in vec3 vRefractionMicrosurfaceInfos,
+const in vec4 vLightingIntensity,
+#ifdef SS_LINKREFRACTIONTOTRANSPARENCY
+const in float alpha,
+#endif
+#ifdef SS_LODINREFRACTIONALPHA
+const in float NdotVUnclamped,
+#endif
+#ifdef SS_LINEARSPECULARREFRACTION
+const in float roughness,
+#else
+const in float alphaG,
+#endif
+#ifdef SS_REFRACTIONMAP_3D
+const in samplerCube refractionSampler,
+#ifndef LODBASEDMICROSFURACE
+const in samplerCube refractionSamplerLow,
+const in samplerCube refractionSamplerHigh,
+#endif
+#else
+const in sampler2D refractionSampler,
+#ifndef LODBASEDMICROSFURACE
+const in sampler2D refractionSamplerLow,
+const in sampler2D refractionSamplerHigh,
+#endif
+#endif
+#ifdef ANISOTROPIC
+const in anisotropicOutParams anisotropicOut,
+#endif
+#ifdef REALTIME_FILTERING
+const in vec2 vRefractionFilteringInfo,
+#endif
+#endif
+#ifdef SS_TRANSLUCENCY
+const in vec3 vDiffusionDistance,
+#endif
+out subSurfaceOutParams outParams
+)
+{
+outParams.specularEnvironmentReflectance=specularEnvironmentReflectance;
+
+
+
+#ifdef SS_REFRACTION
+float refractionIntensity=vSubSurfaceIntensity.x;
+#ifdef SS_LINKREFRACTIONTOTRANSPARENCY
+refractionIntensity*=(1.0-alpha);
+
+outParams.alpha=1.0;
+#endif
+#endif
+#ifdef SS_TRANSLUCENCY
+float translucencyIntensity=vSubSurfaceIntensity.y;
+#endif
+#ifdef SS_THICKNESSANDMASK_TEXTURE
+float thickness=thicknessMap.r*vThicknessParam.y+vThicknessParam.x;
+#if DEBUGMODE>0
+outParams.thicknessMap=thicknessMap;
+#endif
+#ifdef SS_MASK_FROM_THICKNESS_TEXTURE
+#ifdef SS_REFRACTION
+refractionIntensity*=thicknessMap.g;
+#endif
+#ifdef SS_TRANSLUCENCY
+translucencyIntensity*=thicknessMap.b;
+#endif
+#elif defined(SS_MASK_FROM_THICKNESS_TEXTURE_GLTF)
+#ifdef SS_REFRACTION
+refractionIntensity*=thicknessMap.r;
+#elif defined(SS_TRANSLUCENCY)
+translucencyIntensity*=thicknessMap.r;
+#endif
+thickness=thicknessMap.g*vThicknessParam.y+vThicknessParam.x;
+#endif
+#else
+float thickness=vThicknessParam.y;
+#endif
+
+
+
+#ifdef SS_TRANSLUCENCY
+thickness=maxEps(thickness);
+vec3 transmittance=transmittanceBRDF_Burley(vTintColor.rgb,vDiffusionDistance,thickness);
+transmittance*=translucencyIntensity;
+outParams.transmittance=transmittance;
+outParams.translucencyIntensity=translucencyIntensity;
+#endif
+
+
+
+#ifdef SS_REFRACTION
+vec4 environmentRefraction=vec4(0.,0.,0.,0.);
+#ifdef ANISOTROPIC
+vec3 refractionVector=refract(-viewDirectionW,anisotropicOut.anisotropicNormal,vRefractionInfos.y);
+#else
+vec3 refractionVector=refract(-viewDirectionW,normalW,vRefractionInfos.y);
+#endif
+#ifdef SS_REFRACTIONMAP_OPPOSITEZ
+refractionVector.z*=-1.0;
+#endif
+
+#ifdef SS_REFRACTIONMAP_3D
+refractionVector.y=refractionVector.y*vRefractionInfos.w;
+vec3 refractionCoords=refractionVector;
+refractionCoords=vec3(refractionMatrix*vec4(refractionCoords,0));
+#else
+vec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));
+vec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;
+refractionCoords.y=1.0-refractionCoords.y;
+#endif
+#ifdef SS_LODINREFRACTIONALPHA
+float refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,alphaG,NdotVUnclamped);
+#elif defined(SS_LINEARSPECULARREFRACTION)
+float refractionLOD=getLinearLodFromRoughness(vRefractionMicrosurfaceInfos.x,roughness);
+#else
+float refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,alphaG);
+#endif
+#ifdef LODBASEDMICROSFURACE
+
+refractionLOD=refractionLOD*vRefractionMicrosurfaceInfos.y+vRefractionMicrosurfaceInfos.z;
+#ifdef SS_LODINREFRACTIONALPHA
+
+
+
+
+
+
+
+
+
+float automaticRefractionLOD=UNPACK_LOD(sampleRefraction(refractionSampler,refractionCoords).a);
+float requestedRefractionLOD=max(automaticRefractionLOD,refractionLOD);
+#else
+float requestedRefractionLOD=refractionLOD;
+#endif
+#ifdef REALTIME_FILTERING
+environmentRefraction=vec4(radiance(alphaG,refractionSampler,refractionCoords,vRefractionFilteringInfo),1.0);
+#else
+environmentRefraction=sampleRefractionLod(refractionSampler,refractionCoords,requestedRefractionLOD);
+#endif
+#else
+float lodRefractionNormalized=saturate(refractionLOD/log2(vRefractionMicrosurfaceInfos.x));
+float lodRefractionNormalizedDoubled=lodRefractionNormalized*2.0;
+vec4 environmentRefractionMid=sampleRefraction(refractionSampler,refractionCoords);
+if (lodRefractionNormalizedDoubled<1.0){
+environmentRefraction=mix(
+sampleRefraction(refractionSamplerHigh,refractionCoords),
+environmentRefractionMid,
+lodRefractionNormalizedDoubled
+);
+} else {
+environmentRefraction=mix(
+environmentRefractionMid,
+sampleRefraction(refractionSamplerLow,refractionCoords),
+lodRefractionNormalizedDoubled-1.0
+);
+}
+#endif
+#ifdef SS_RGBDREFRACTION
+environmentRefraction.rgb=fromRGBD(environmentRefraction);
+#endif
+#ifdef SS_GAMMAREFRACTION
+environmentRefraction.rgb=toLinearSpace(environmentRefraction.rgb);
+#endif
+
+environmentRefraction.rgb*=vRefractionInfos.x;
+#endif
+
+
+
+#ifdef SS_REFRACTION
+vec3 refractionTransmittance=vec3(refractionIntensity);
+#ifdef SS_THICKNESSANDMASK_TEXTURE
+vec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);
+
+
+
+
+
+refractionTransmittance*=cocaLambert(volumeAlbedo,thickness);
+#elif defined(SS_LINKREFRACTIONTOTRANSPARENCY)
+
+float maxChannel=max(max(surfaceAlbedo.r,surfaceAlbedo.g),surfaceAlbedo.b);
+vec3 volumeAlbedo=saturate(maxChannel*surfaceAlbedo);
+
+environmentRefraction.rgb*=volumeAlbedo;
+#else
+
+vec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);
+refractionTransmittance*=cocaLambert(volumeAlbedo,vThicknessParam.y);
+#endif
+#ifdef SS_ALBEDOFORREFRACTIONTINT
+
+environmentRefraction.rgb*=surfaceAlbedo.rgb;
+#endif
+
+outParams.surfaceAlbedo=surfaceAlbedo*(1.-refractionIntensity);
+#ifdef REFLECTION
+
+outParams.refractionFactorForIrradiance=(1.-refractionIntensity);
+
+#endif
+
+vec3 bounceSpecularEnvironmentReflectance=(2.0*specularEnvironmentReflectance)/(1.0+specularEnvironmentReflectance);
+outParams.specularEnvironmentReflectance=mix(bounceSpecularEnvironmentReflectance,specularEnvironmentReflectance,refractionIntensity);
+
+refractionTransmittance*=1.0-outParams.specularEnvironmentReflectance;
+#if DEBUGMODE>0
+outParams.refractionTransmittance=refractionTransmittance;
+#endif
+outParams.finalRefraction=environmentRefraction.rgb*refractionTransmittance*vLightingIntensity.z;
+#if DEBUGMODE>0
+outParams.environmentRefraction=environmentRefraction;
+#endif
+#endif
+
+
+
+#if defined(REFLECTION) && defined(SS_TRANSLUCENCY)
+#if defined(NORMAL) && defined(USESPHERICALINVERTEX) || !defined(USESPHERICALFROMREFLECTIONMAP)
+vec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz;
+#ifdef REFLECTIONMAP_OPPOSITEZ
+irradianceVector.z*=-1.0;
+#endif
+#ifdef INVERTCUBICMAP
+irradianceVector.y*=-1.0;
+#endif
+#else
+vec3 irradianceVector=irradianceVector_;
+#endif
+#if defined(USESPHERICALFROMREFLECTIONMAP)
+#if defined(REALTIME_FILTERING)
+vec3 refractionIrradiance=irradiance(reflectionSampler,-irradianceVector,vReflectionFilteringInfo);
+#else
+vec3 refractionIrradiance=computeEnvironmentIrradiance(-irradianceVector);
+#endif
+#elif defined(USEIRRADIANCEMAP)
+#ifdef REFLECTIONMAP_3D
+vec3 irradianceCoords=irradianceVector;
+#else
+vec2 irradianceCoords=irradianceVector.xy;
+#ifdef REFLECTIONMAP_PROJECTION
+irradianceCoords/=irradianceVector.z;
+#endif
+irradianceCoords.y=1.0-irradianceCoords.y;
+#endif
+vec4 refractionIrradiance=sampleReflection(irradianceSampler,-irradianceCoords);
+#ifdef RGBDREFLECTION
+refractionIrradiance.rgb=fromRGBD(refractionIrradiance);
+#endif
+#ifdef GAMMAREFLECTION
+refractionIrradiance.rgb=toLinearSpace(refractionIrradiance.rgb);
+#endif
+#else
+vec4 refractionIrradiance=vec4(0.);
+#endif
+refractionIrradiance.rgb*=transmittance;
+outParams.refractionIrradiance=refractionIrradiance.rgb;
+#endif
+}
+#endif
+`;
+ We.a.IncludesShadersStore.pbrBlockSubSurface = fy;
+ var py = `vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);
+#ifdef NORMAL
+vec3 normalW=normalize(vNormalW);
+#else
+vec3 normalW=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;
+#endif
+vec3 geometricNormalW=normalW;
+#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)
+geometricNormalW=gl_FrontFacing ? geometricNormalW : -geometricNormalW;
+#endif
+`;
+ We.a.IncludesShadersStore.pbrBlockNormalGeometric = py, l(134);
+ var _y = `#if defined(FORCENORMALFORWARD) && defined(NORMAL)
+vec3 faceNormal=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;
+#if defined(TWOSIDEDLIGHTING)
+faceNormal=gl_FrontFacing ? faceNormal : -faceNormal;
+#endif
+normalW*=sign(dot(normalW,faceNormal));
+#endif
+#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)
+normalW=gl_FrontFacing ? normalW : -normalW;
+#endif
+`;
+ We.a.IncludesShadersStore.pbrBlockNormalFinal = _y, l(162);
+ var my = `#ifdef LIGHTMAP
+vec4 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset);
+#ifdef RGBDLIGHTMAP
+lightmapColor.rgb=fromRGBD(lightmapColor);
+#endif
+#ifdef GAMMALIGHTMAP
+lightmapColor.rgb=toLinearSpace(lightmapColor.rgb);
+#endif
+lightmapColor.rgb*=vLightmapInfos.y;
+#endif
+`;
+ We.a.IncludesShadersStore.pbrBlockLightmapInit = my;
+ var gy = `float NdotVUnclamped=dot(normalW,viewDirectionW);
+
+float NdotV=absEps(NdotVUnclamped);
+float alphaG=convertRoughnessToAverageSlope(roughness);
+vec2 AARoughnessFactors=getAARoughnessFactors(normalW.xyz);
+#ifdef SPECULARAA
+
+alphaG+=AARoughnessFactors.y;
+#endif
+#if defined(ENVIRONMENTBRDF)
+
+vec3 environmentBrdf=getBRDFLookup(NdotV,roughness);
+#endif
+#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
+#ifdef RADIANCEOCCLUSION
+#ifdef AMBIENTINGRAYSCALE
+float ambientMonochrome=aoOut.ambientOcclusionColor.r;
+#else
+float ambientMonochrome=getLuminance(aoOut.ambientOcclusionColor);
+#endif
+float seo=environmentRadianceOcclusion(ambientMonochrome,NdotVUnclamped);
+#endif
+#ifdef HORIZONOCCLUSION
+#ifdef BUMP
+#ifdef REFLECTIONMAP_3D
+float eho=environmentHorizonOcclusion(-viewDirectionW,normalW,geometricNormalW);
+#endif
+#endif
+#endif
+#endif
+`;
+ We.a.IncludesShadersStore.pbrBlockGeometryInfo = gy;
+ var vy = `float reflectance=max(max(reflectivityOut.surfaceReflectivityColor.r,reflectivityOut.surfaceReflectivityColor.g),reflectivityOut.surfaceReflectivityColor.b);
+vec3 specularEnvironmentR0=reflectivityOut.surfaceReflectivityColor.rgb;
+#ifdef METALLICWORKFLOW
+vec3 specularEnvironmentR90=vec3(metallicReflectanceFactors.a);
+#else
+vec3 specularEnvironmentR90=vec3(1.0,1.0,1.0);
+#endif
+
+#ifdef ALPHAFRESNEL
+float reflectance90=fresnelGrazingReflectance(reflectance);
+specularEnvironmentR90=specularEnvironmentR90*reflectance90;
+#endif
+`;
+ We.a.IncludesShadersStore.pbrBlockReflectance0 = vy;
+ var by = `#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
+vec3 specularEnvironmentReflectance=getReflectanceFromBRDFLookup(clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,environmentBrdf);
+#ifdef RADIANCEOCCLUSION
+specularEnvironmentReflectance*=seo;
+#endif
+#ifdef HORIZONOCCLUSION
+#ifdef BUMP
+#ifdef REFLECTIONMAP_3D
+specularEnvironmentReflectance*=eho;
+#endif
+#endif
+#endif
+#else
+
+vec3 specularEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(NdotV,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,sqrt(microSurface));
+#endif
+#ifdef CLEARCOAT
+specularEnvironmentReflectance*=clearcoatOut.conservationFactor;
+#if defined(CLEARCOAT_TINT)
+specularEnvironmentReflectance*=clearcoatOut.absorption;
+#endif
+#endif
+`;
+ We.a.IncludesShadersStore.pbrBlockReflectance = by;
+ var yy = `vec3 diffuseBase=vec3(0.,0.,0.);
+#ifdef SPECULARTERM
+vec3 specularBase=vec3(0.,0.,0.);
+#endif
+#ifdef CLEARCOAT
+vec3 clearCoatBase=vec3(0.,0.,0.);
+#endif
+#ifdef SHEEN
+vec3 sheenBase=vec3(0.,0.,0.);
+#endif
+
+preLightingInfo preInfo;
+lightingInfo info;
+float shadow=1.;
+#if defined(CLEARCOAT) && defined(CLEARCOAT_TINT)
+vec3 absorption=vec3(0.);
+#endif
+`;
+ We.a.IncludesShadersStore.pbrBlockDirectLighting = yy;
+ var Ey = `
+
+
+
+#if defined(ENVIRONMENTBRDF)
+#ifdef MS_BRDF_ENERGY_CONSERVATION
+vec3 energyConservationFactor=getEnergyConservationFactor(clearcoatOut.specularEnvironmentR0,environmentBrdf);
+#endif
+#endif
+#ifndef METALLICWORKFLOW
+#ifdef SPECULAR_GLOSSINESS_ENERGY_CONSERVATION
+surfaceAlbedo.rgb=(1.-reflectance)*surfaceAlbedo.rgb;
+#endif
+#endif
+#if defined(SHEEN) && defined(SHEEN_ALBEDOSCALING) && defined(ENVIRONMENTBRDF)
+surfaceAlbedo.rgb=sheenOut.sheenAlbedoScaling*surfaceAlbedo.rgb;
+#endif
+
+#ifdef REFLECTION
+vec3 finalIrradiance=reflectionOut.environmentIrradiance;
+#if defined(CLEARCOAT)
+finalIrradiance*=clearcoatOut.conservationFactor;
+#if defined(CLEARCOAT_TINT)
+finalIrradiance*=clearcoatOut.absorption;
+#endif
+#endif
+#if defined(SS_REFRACTION)
+finalIrradiance*=subSurfaceOut.refractionFactorForIrradiance;
+#endif
+#if defined(SS_TRANSLUCENCY)
+finalIrradiance*=(1.0-subSurfaceOut.translucencyIntensity);
+finalIrradiance+=subSurfaceOut.refractionIrradiance;
+#endif
+finalIrradiance*=surfaceAlbedo.rgb;
+finalIrradiance*=vLightingIntensity.z;
+finalIrradiance*=aoOut.ambientOcclusionColor;
+#endif
+
+#ifdef SPECULARTERM
+vec3 finalSpecular=specularBase;
+finalSpecular=max(finalSpecular,0.0);
+vec3 finalSpecularScaled=finalSpecular*vLightingIntensity.x*vLightingIntensity.w;
+#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)
+finalSpecularScaled*=energyConservationFactor;
+#endif
+#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)
+finalSpecularScaled*=sheenOut.sheenAlbedoScaling;
+#endif
+#endif
+
+#ifdef REFLECTION
+vec3 finalRadiance=reflectionOut.environmentRadiance.rgb;
+finalRadiance*=subSurfaceOut.specularEnvironmentReflectance;
+vec3 finalRadianceScaled=finalRadiance*vLightingIntensity.z;
+#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)
+finalRadianceScaled*=energyConservationFactor;
+#endif
+#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)
+finalRadianceScaled*=sheenOut.sheenAlbedoScaling;
+#endif
+#endif
+
+#ifdef SHEEN
+vec3 finalSheen=sheenBase*sheenOut.sheenColor;
+finalSheen=max(finalSheen,0.0);
+vec3 finalSheenScaled=finalSheen*vLightingIntensity.x*vLightingIntensity.w;
+#if defined(CLEARCOAT) && defined(REFLECTION) && defined(ENVIRONMENTBRDF)
+sheenOut.finalSheenRadianceScaled*=clearcoatOut.conservationFactor;
+#if defined(CLEARCOAT_TINT)
+sheenOut.finalSheenRadianceScaled*=clearcoatOut.absorption;
+#endif
+#endif
+#endif
+
+#ifdef CLEARCOAT
+vec3 finalClearCoat=clearCoatBase;
+finalClearCoat=max(finalClearCoat,0.0);
+vec3 finalClearCoatScaled=finalClearCoat*vLightingIntensity.x*vLightingIntensity.w;
+#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)
+finalClearCoatScaled*=clearcoatOut.energyConservationFactorClearCoat;
+#endif
+#ifdef SS_REFRACTION
+subSurfaceOut.finalRefraction*=clearcoatOut.conservationFactor;
+#ifdef CLEARCOAT_TINT
+subSurfaceOut.finalRefraction*=clearcoatOut.absorption;
+#endif
+#endif
+#endif
+
+#ifdef ALPHABLEND
+float luminanceOverAlpha=0.0;
+#if defined(REFLECTION) && defined(RADIANCEOVERALPHA)
+luminanceOverAlpha+=getLuminance(finalRadianceScaled);
+#if defined(CLEARCOAT)
+luminanceOverAlpha+=getLuminance(clearcoatOut.finalClearCoatRadianceScaled);
+#endif
+#endif
+#if defined(SPECULARTERM) && defined(SPECULAROVERALPHA)
+luminanceOverAlpha+=getLuminance(finalSpecularScaled);
+#endif
+#if defined(CLEARCOAT) && defined(CLEARCOATOVERALPHA)
+luminanceOverAlpha+=getLuminance(finalClearCoatScaled);
+#endif
+#if defined(RADIANCEOVERALPHA) || defined(SPECULAROVERALPHA) || defined(CLEARCOATOVERALPHA)
+alpha=saturate(alpha+luminanceOverAlpha*luminanceOverAlpha);
+#endif
+#endif
+`;
+ We.a.IncludesShadersStore.pbrBlockFinalLitComponents = Ey;
+ var Ty = `
+vec3 finalDiffuse=diffuseBase;
+finalDiffuse*=surfaceAlbedo.rgb;
+finalDiffuse=max(finalDiffuse,0.0);
+finalDiffuse*=vLightingIntensity.x;
+
+vec3 finalAmbient=vAmbientColor;
+finalAmbient*=surfaceAlbedo.rgb;
+
+vec3 finalEmissive=vEmissiveColor;
+#ifdef EMISSIVE
+vec3 emissiveColorTex=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb;
+finalEmissive*=toLinearSpace(emissiveColorTex.rgb);
+finalEmissive*=vEmissiveInfos.y;
+#endif
+finalEmissive*=vLightingIntensity.y;
+
+#ifdef AMBIENT
+vec3 ambientOcclusionForDirectDiffuse=mix(vec3(1.),aoOut.ambientOcclusionColor,vAmbientInfos.w);
+#else
+vec3 ambientOcclusionForDirectDiffuse=aoOut.ambientOcclusionColor;
+#endif
+finalAmbient*=aoOut.ambientOcclusionColor;
+finalDiffuse*=ambientOcclusionForDirectDiffuse;
+`;
+ We.a.IncludesShadersStore.pbrBlockFinalUnlitComponents = Ty;
+ var Sy = `vec4 finalColor=vec4(
+finalAmbient +
+finalDiffuse +
+#ifndef UNLIT
+#ifdef REFLECTION
+finalIrradiance +
+#endif
+#ifdef SPECULARTERM
+finalSpecularScaled +
+#endif
+#ifdef SHEEN
+finalSheenScaled +
+#endif
+#ifdef CLEARCOAT
+finalClearCoatScaled +
+#endif
+#ifdef REFLECTION
+finalRadianceScaled +
+#if defined(SHEEN) && defined(ENVIRONMENTBRDF)
+sheenOut.finalSheenRadianceScaled +
+#endif
+#ifdef CLEARCOAT
+clearcoatOut.finalClearCoatRadianceScaled +
+#endif
+#endif
+#ifdef SS_REFRACTION
+subSurfaceOut.finalRefraction +
+#endif
+#endif
+finalEmissive,
+alpha);
+
+#ifdef LIGHTMAP
+#ifndef LIGHTMAPEXCLUDED
+#ifdef USELIGHTMAPASSHADOWMAP
+finalColor.rgb*=lightmapColor.rgb;
+#else
+finalColor.rgb+=lightmapColor.rgb;
+#endif
+#endif
+#endif
+#define CUSTOM_FRAGMENT_BEFORE_FOG
+
+finalColor=max(finalColor,0.0);
+`;
+ We.a.IncludesShadersStore.pbrBlockFinalColorComposition = Sy, l(155);
+ var Ay = `#ifdef IMAGEPROCESSINGPOSTPROCESS
+
+
+finalColor.rgb=clamp(finalColor.rgb,0.,30.0);
+#else
+
+finalColor=applyImageProcessing(finalColor);
+#endif
+finalColor.a*=visibility;
+#ifdef PREMULTIPLYALPHA
+
+finalColor.rgb*=finalColor.a;
+#endif
+`;
+ We.a.IncludesShadersStore.pbrBlockImageProcessing = Ay;
+ var Py = `#if DEBUGMODE>0
+if (vClipSpacePosition.x/vClipSpacePosition.w>=vDebugMode.x) {
+
+#if DEBUGMODE == 1
+gl_FragColor.rgb=vPositionW.rgb;
+#define DEBUGMODE_NORMALIZE
+#elif DEBUGMODE == 2 && defined(NORMAL)
+gl_FragColor.rgb=vNormalW.rgb;
+#define DEBUGMODE_NORMALIZE
+#elif DEBUGMODE == 3 && defined(BUMP) || DEBUGMODE == 3 && defined(PARALLAX) || DEBUGMODE == 3 && defined(ANISOTROPIC)
+
+gl_FragColor.rgb=TBN[0];
+#define DEBUGMODE_NORMALIZE
+#elif DEBUGMODE == 4 && defined(BUMP) || DEBUGMODE == 4 && defined(PARALLAX) || DEBUGMODE == 4 && defined(ANISOTROPIC)
+
+gl_FragColor.rgb=TBN[1];
+#define DEBUGMODE_NORMALIZE
+#elif DEBUGMODE == 5
+
+gl_FragColor.rgb=normalW;
+#define DEBUGMODE_NORMALIZE
+#elif DEBUGMODE == 6 && defined(MAINUV1)
+gl_FragColor.rgb=vec3(vMainUV1,0.0);
+#elif DEBUGMODE == 7 && defined(MAINUV2)
+gl_FragColor.rgb=vec3(vMainUV2,0.0);
+#elif DEBUGMODE == 8 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)
+
+gl_FragColor.rgb=clearcoatOut.TBNClearCoat[0];
+#define DEBUGMODE_NORMALIZE
+#elif DEBUGMODE == 9 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)
+
+gl_FragColor.rgb=clearcoatOut.TBNClearCoat[1];
+#define DEBUGMODE_NORMALIZE
+#elif DEBUGMODE == 10 && defined(CLEARCOAT)
+
+gl_FragColor.rgb=clearcoatOut.clearCoatNormalW;
+#define DEBUGMODE_NORMALIZE
+#elif DEBUGMODE == 11 && defined(ANISOTROPIC)
+gl_FragColor.rgb=anisotropicOut.anisotropicNormal;
+#define DEBUGMODE_NORMALIZE
+#elif DEBUGMODE == 12 && defined(ANISOTROPIC)
+gl_FragColor.rgb=anisotropicOut.anisotropicTangent;
+#define DEBUGMODE_NORMALIZE
+#elif DEBUGMODE == 13 && defined(ANISOTROPIC)
+gl_FragColor.rgb=anisotropicOut.anisotropicBitangent;
+#define DEBUGMODE_NORMALIZE
+
+#elif DEBUGMODE == 20 && defined(ALBEDO)
+gl_FragColor.rgb=albedoTexture.rgb;
+#elif DEBUGMODE == 21 && defined(AMBIENT)
+gl_FragColor.rgb=aoOut.ambientOcclusionColorMap.rgb;
+#elif DEBUGMODE == 22 && defined(OPACITY)
+gl_FragColor.rgb=opacityMap.rgb;
+#elif DEBUGMODE == 23 && defined(EMISSIVE)
+gl_FragColor.rgb=emissiveColorTex.rgb;
+#define DEBUGMODE_GAMMA
+#elif DEBUGMODE == 24 && defined(LIGHTMAP)
+gl_FragColor.rgb=lightmapColor.rgb;
+#define DEBUGMODE_GAMMA
+#elif DEBUGMODE == 25 && defined(REFLECTIVITY) && defined(METALLICWORKFLOW)
+gl_FragColor.rgb=reflectivityOut.surfaceMetallicColorMap.rgb;
+#elif DEBUGMODE == 26 && defined(REFLECTIVITY) && !defined(METALLICWORKFLOW)
+gl_FragColor.rgb=reflectivityOut.surfaceReflectivityColorMap.rgb;
+#define DEBUGMODE_GAMMA
+#elif DEBUGMODE == 27 && defined(CLEARCOAT) && defined(CLEARCOAT_TEXTURE)
+gl_FragColor.rgb=vec3(clearcoatOut.clearCoatMapData.rg,0.0);
+#elif DEBUGMODE == 28 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)
+gl_FragColor.rgb=clearcoatOut.clearCoatTintMapData.rgb;
+#elif DEBUGMODE == 29 && defined(SHEEN) && defined(SHEEN_TEXTURE)
+gl_FragColor.rgb=sheenOut.sheenMapData.rgb;
+#elif DEBUGMODE == 30 && defined(ANISOTROPIC) && defined(ANISOTROPIC_TEXTURE)
+gl_FragColor.rgb=anisotropicOut.anisotropyMapData.rgb;
+#elif DEBUGMODE == 31 && defined(SUBSURFACE) && defined(SS_THICKNESSANDMASK_TEXTURE)
+gl_FragColor.rgb=subSurfaceOut.thicknessMap.rgb;
+
+#elif DEBUGMODE == 40 && defined(SS_REFRACTION)
+
+gl_FragColor.rgb=subSurfaceOut.environmentRefraction.rgb;
+#define DEBUGMODE_GAMMA
+#elif DEBUGMODE == 41 && defined(REFLECTION)
+gl_FragColor.rgb=reflectionOut.environmentRadiance.rgb;
+#define DEBUGMODE_GAMMA
+#elif DEBUGMODE == 42 && defined(CLEARCOAT) && defined(REFLECTION)
+gl_FragColor.rgb=clearcoatOut.environmentClearCoatRadiance.rgb;
+#define DEBUGMODE_GAMMA
+
+#elif DEBUGMODE == 50
+gl_FragColor.rgb=diffuseBase.rgb;
+#define DEBUGMODE_GAMMA
+#elif DEBUGMODE == 51 && defined(SPECULARTERM)
+gl_FragColor.rgb=specularBase.rgb;
+#define DEBUGMODE_GAMMA
+#elif DEBUGMODE == 52 && defined(CLEARCOAT)
+gl_FragColor.rgb=clearCoatBase.rgb;
+#define DEBUGMODE_GAMMA
+#elif DEBUGMODE == 53 && defined(SHEEN)
+gl_FragColor.rgb=sheenBase.rgb;
+#define DEBUGMODE_GAMMA
+#elif DEBUGMODE == 54 && defined(REFLECTION)
+gl_FragColor.rgb=reflectionOut.environmentIrradiance.rgb;
+#define DEBUGMODE_GAMMA
+
+#elif DEBUGMODE == 60
+gl_FragColor.rgb=surfaceAlbedo.rgb;
+#define DEBUGMODE_GAMMA
+#elif DEBUGMODE == 61
+gl_FragColor.rgb=clearcoatOut.specularEnvironmentR0;
+#define DEBUGMODE_GAMMA
+#elif DEBUGMODE == 62 && defined(METALLICWORKFLOW)
+gl_FragColor.rgb=vec3(reflectivityOut.metallicRoughness.r);
+#elif DEBUGMODE == 71 && defined(METALLICWORKFLOW)
+gl_FragColor.rgb=reflectivityOut.metallicF0;
+#elif DEBUGMODE == 63
+gl_FragColor.rgb=vec3(roughness);
+#elif DEBUGMODE == 64
+gl_FragColor.rgb=vec3(alphaG);
+#elif DEBUGMODE == 65
+gl_FragColor.rgb=vec3(NdotV);
+#elif DEBUGMODE == 66 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT)
+gl_FragColor.rgb=clearcoatOut.clearCoatColor.rgb;
+#define DEBUGMODE_GAMMA
+#elif DEBUGMODE == 67 && defined(CLEARCOAT)
+gl_FragColor.rgb=vec3(clearcoatOut.clearCoatRoughness);
+#elif DEBUGMODE == 68 && defined(CLEARCOAT)
+gl_FragColor.rgb=vec3(clearcoatOut.clearCoatNdotV);
+#elif DEBUGMODE == 69 && defined(SUBSURFACE) && defined(SS_TRANSLUCENCY)
+gl_FragColor.rgb=subSurfaceOut.transmittance;
+#elif DEBUGMODE == 70 && defined(SUBSURFACE) && defined(SS_REFRACTION)
+gl_FragColor.rgb=subSurfaceOut.refractionTransmittance;
+
+#elif DEBUGMODE == 80 && defined(RADIANCEOCCLUSION)
+gl_FragColor.rgb=vec3(seo);
+#elif DEBUGMODE == 81 && defined(HORIZONOCCLUSION)
+gl_FragColor.rgb=vec3(eho);
+#elif DEBUGMODE == 82 && defined(MS_BRDF_ENERGY_CONSERVATION)
+gl_FragColor.rgb=vec3(energyConservationFactor);
+#elif DEBUGMODE == 83 && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
+gl_FragColor.rgb=specularEnvironmentReflectance;
+#define DEBUGMODE_GAMMA
+#elif DEBUGMODE == 84 && defined(CLEARCOAT) && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
+gl_FragColor.rgb=clearcoatOut.clearCoatEnvironmentReflectance;
+#define DEBUGMODE_GAMMA
+#elif DEBUGMODE == 85 && defined(SHEEN) && defined(REFLECTION)
+gl_FragColor.rgb=sheenOut.sheenEnvironmentReflectance;
+#define DEBUGMODE_GAMMA
+#elif DEBUGMODE == 86 && defined(ALPHABLEND)
+gl_FragColor.rgb=vec3(luminanceOverAlpha);
+#elif DEBUGMODE == 87
+gl_FragColor.rgb=vec3(alpha);
+#endif
+gl_FragColor.rgb*=vDebugMode.y;
+#ifdef DEBUGMODE_NORMALIZE
+gl_FragColor.rgb=normalize(gl_FragColor.rgb)*0.5+0.5;
+#endif
+#ifdef DEBUGMODE_GAMMA
+gl_FragColor.rgb=toGammaSpace(gl_FragColor.rgb);
+#endif
+gl_FragColor.a=1.0;
+#ifdef PREPASS
+gl_FragData[0]=toLinearSpace(gl_FragColor);
+gl_FragData[1]=vec4(0.,0.,0.,0.);
+#endif
+return;
+}
+#endif`;
+ We.a.IncludesShadersStore.pbrDebug = Py;
+ var Cy = `#if defined(BUMP) || !defined(NORMAL) || defined(FORCENORMALFORWARD) || defined(SPECULARAA) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)
+#extension GL_OES_standard_derivatives : enable
+#endif
+#ifdef LODBASEDMICROSFURACE
+#extension GL_EXT_shader_texture_lod : enable
+#endif
+#define CUSTOM_FRAGMENT_BEGIN
+#ifdef LOGARITHMICDEPTH
+#extension GL_EXT_frag_depth : enable
+#endif
+#include[SCENE_MRT_COUNT]
+precision highp float;
+
+#ifndef FROMLINEARSPACE
+#define FROMLINEARSPACE
+#endif
+
+#include<__decl__pbrFragment>
+#include
+#include<__decl__lightFragment>[0..maxSimultaneousLights]
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#ifdef REFLECTION
+#include
+#endif
+#define CUSTOM_FRAGMENT_DEFINITIONS
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+void main(void) {
+#define CUSTOM_FRAGMENT_MAIN_BEGIN
+#include
+
+#include
+#include
+#include
+
+albedoOpacityOutParams albedoOpacityOut;
+#ifdef ALBEDO
+vec4 albedoTexture=texture2D(albedoSampler,vAlbedoUV+uvOffset);
+#endif
+#ifdef OPACITY
+vec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);
+#endif
+albedoOpacityBlock(
+vAlbedoColor,
+#ifdef ALBEDO
+albedoTexture,
+vAlbedoInfos,
+#endif
+#ifdef OPACITY
+opacityMap,
+vOpacityInfos,
+#endif
+#ifdef DETAIL
+detailColor,
+vDetailInfos,
+#endif
+albedoOpacityOut
+);
+vec3 surfaceAlbedo=albedoOpacityOut.surfaceAlbedo;
+float alpha=albedoOpacityOut.alpha;
+#define CUSTOM_FRAGMENT_UPDATE_ALPHA
+#include
+#define CUSTOM_FRAGMENT_BEFORE_LIGHTS
+
+ambientOcclusionOutParams aoOut;
+#ifdef AMBIENT
+vec3 ambientOcclusionColorMap=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb;
+#endif
+ambientOcclusionBlock(
+#ifdef AMBIENT
+ambientOcclusionColorMap,
+vAmbientInfos,
+#endif
+aoOut
+);
+#include
+#ifdef UNLIT
+vec3 diffuseBase=vec3(1.,1.,1.);
+#else
+
+vec3 baseColor=surfaceAlbedo;
+reflectivityOutParams reflectivityOut;
+#if defined(REFLECTIVITY)
+vec4 surfaceMetallicOrReflectivityColorMap=texture2D(reflectivitySampler,vReflectivityUV+uvOffset);
+vec4 baseReflectivity=surfaceMetallicOrReflectivityColorMap;
+#ifndef METALLICWORKFLOW
+surfaceMetallicOrReflectivityColorMap=toLinearSpace(surfaceMetallicOrReflectivityColorMap);
+surfaceMetallicOrReflectivityColorMap.rgb*=vReflectivityInfos.y;
+#endif
+#endif
+#if defined(MICROSURFACEMAP)
+vec4 microSurfaceTexel=texture2D(microSurfaceSampler,vMicroSurfaceSamplerUV+uvOffset)*vMicroSurfaceSamplerInfos.y;
+#endif
+#ifdef METALLICWORKFLOW
+vec4 metallicReflectanceFactors=vMetallicReflectanceFactors;
+#ifdef METALLIC_REFLECTANCE
+vec4 metallicReflectanceFactorsMap=texture2D(metallicReflectanceSampler,vMetallicReflectanceUV+uvOffset);
+metallicReflectanceFactorsMap=toLinearSpace(metallicReflectanceFactorsMap);
+metallicReflectanceFactors*=metallicReflectanceFactorsMap;
+#endif
+#endif
+reflectivityBlock(
+vReflectivityColor,
+#ifdef METALLICWORKFLOW
+surfaceAlbedo,
+metallicReflectanceFactors,
+#endif
+#ifdef REFLECTIVITY
+vReflectivityInfos,
+surfaceMetallicOrReflectivityColorMap,
+#endif
+#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)
+aoOut.ambientOcclusionColor,
+#endif
+#ifdef MICROSURFACEMAP
+microSurfaceTexel,
+#endif
+#ifdef DETAIL
+detailColor,
+vDetailInfos,
+#endif
+reflectivityOut
+);
+float microSurface=reflectivityOut.microSurface;
+float roughness=reflectivityOut.roughness;
+#ifdef METALLICWORKFLOW
+surfaceAlbedo=reflectivityOut.surfaceAlbedo;
+#endif
+#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)
+aoOut.ambientOcclusionColor=reflectivityOut.ambientOcclusionColor;
+#endif
+
+#ifdef ALPHAFRESNEL
+#if defined(ALPHATEST) || defined(ALPHABLEND)
+alphaFresnelOutParams alphaFresnelOut;
+alphaFresnelBlock(
+normalW,
+viewDirectionW,
+alpha,
+microSurface,
+alphaFresnelOut
+);
+alpha=alphaFresnelOut.alpha;
+#endif
+#endif
+
+#include
+
+#ifdef ANISOTROPIC
+anisotropicOutParams anisotropicOut;
+#ifdef ANISOTROPIC_TEXTURE
+vec3 anisotropyMapData=texture2D(anisotropySampler,vAnisotropyUV+uvOffset).rgb*vAnisotropyInfos.y;
+#endif
+anisotropicBlock(
+vAnisotropy,
+#ifdef ANISOTROPIC_TEXTURE
+anisotropyMapData,
+#endif
+TBN,
+normalW,
+viewDirectionW,
+anisotropicOut
+);
+#endif
+
+#ifdef REFLECTION
+reflectionOutParams reflectionOut;
+reflectionBlock(
+vPositionW,
+normalW,
+alphaG,
+vReflectionMicrosurfaceInfos,
+vReflectionInfos,
+vReflectionColor,
+#ifdef ANISOTROPIC
+anisotropicOut,
+#endif
+#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
+NdotVUnclamped,
+#endif
+#ifdef LINEARSPECULARREFLECTION
+roughness,
+#endif
+reflectionSampler,
+#if defined(NORMAL) && defined(USESPHERICALINVERTEX)
+vEnvironmentIrradiance,
+#endif
+#ifdef USESPHERICALFROMREFLECTIONMAP
+#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)
+reflectionMatrix,
+#endif
+#endif
+#ifdef USEIRRADIANCEMAP
+irradianceSampler,
+#endif
+#ifndef LODBASEDMICROSFURACE
+reflectionSamplerLow,
+reflectionSamplerHigh,
+#endif
+#ifdef REALTIME_FILTERING
+vReflectionFilteringInfo,
+#endif
+reflectionOut
+);
+#endif
+
+#include
+
+#ifdef SHEEN
+sheenOutParams sheenOut;
+#ifdef SHEEN_TEXTURE
+vec4 sheenMapData=toLinearSpace(texture2D(sheenSampler,vSheenUV+uvOffset))*vSheenInfos.y;
+#endif
+#if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)
+vec4 sheenMapRoughnessData=texture2D(sheenRoughnessSampler,vSheenRoughnessUV+uvOffset)*vSheenInfos.w;
+#endif
+sheenBlock(
+vSheenColor,
+#ifdef SHEEN_ROUGHNESS
+vSheenRoughness,
+#if defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)
+sheenMapRoughnessData,
+#endif
+#endif
+roughness,
+#ifdef SHEEN_TEXTURE
+sheenMapData,
+#endif
+reflectance,
+#ifdef SHEEN_LINKWITHALBEDO
+baseColor,
+surfaceAlbedo,
+#endif
+#ifdef ENVIRONMENTBRDF
+NdotV,
+environmentBrdf,
+#endif
+#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)
+AARoughnessFactors,
+vReflectionMicrosurfaceInfos,
+vReflectionInfos,
+vReflectionColor,
+vLightingIntensity,
+reflectionSampler,
+reflectionOut.reflectionCoords,
+NdotVUnclamped,
+#ifndef LODBASEDMICROSFURACE
+reflectionSamplerLow,
+reflectionSamplerHigh,
+#endif
+#ifdef REALTIME_FILTERING
+vReflectionFilteringInfo,
+#endif
+#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)
+seo,
+#endif
+#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)
+eho,
+#endif
+#endif
+sheenOut
+);
+#ifdef SHEEN_LINKWITHALBEDO
+surfaceAlbedo=sheenOut.surfaceAlbedo;
+#endif
+#endif
+
+clearcoatOutParams clearcoatOut;
+#ifdef CLEARCOAT
+#ifdef CLEARCOAT_TEXTURE
+vec2 clearCoatMapData=texture2D(clearCoatSampler,vClearCoatUV+uvOffset).rg*vClearCoatInfos.y;
+#endif
+#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)
+vec4 clearCoatMapRoughnessData=texture2D(clearCoatRoughnessSampler,vClearCoatRoughnessUV+uvOffset)*vClearCoatInfos.w;
+#endif
+#if defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)
+vec4 clearCoatTintMapData=toLinearSpace(texture2D(clearCoatTintSampler,vClearCoatTintUV+uvOffset));
+#endif
+#ifdef CLEARCOAT_BUMP
+vec4 clearCoatBumpMapData=texture2D(clearCoatBumpSampler,vClearCoatBumpUV+uvOffset);
+#endif
+clearcoatBlock(
+vPositionW,
+geometricNormalW,
+viewDirectionW,
+vClearCoatParams,
+#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)
+clearCoatMapRoughnessData,
+#endif
+specularEnvironmentR0,
+#ifdef CLEARCOAT_TEXTURE
+clearCoatMapData,
+#endif
+#ifdef CLEARCOAT_TINT
+vClearCoatTintParams,
+clearCoatColorAtDistance,
+vClearCoatRefractionParams,
+#ifdef CLEARCOAT_TINT_TEXTURE
+clearCoatTintMapData,
+#endif
+#endif
+#ifdef CLEARCOAT_BUMP
+vClearCoatBumpInfos,
+clearCoatBumpMapData,
+vClearCoatBumpUV,
+#if defined(TANGENT) && defined(NORMAL)
+vTBN,
+#else
+vClearCoatTangentSpaceParams,
+#endif
+#ifdef OBJECTSPACE_NORMALMAP
+normalMatrix,
+#endif
+#endif
+#if defined(FORCENORMALFORWARD) && defined(NORMAL)
+faceNormal,
+#endif
+#ifdef REFLECTION
+vReflectionMicrosurfaceInfos,
+vReflectionInfos,
+vReflectionColor,
+vLightingIntensity,
+reflectionSampler,
+#ifndef LODBASEDMICROSFURACE
+reflectionSamplerLow,
+reflectionSamplerHigh,
+#endif
+#ifdef REALTIME_FILTERING
+vReflectionFilteringInfo,
+#endif
+#endif
+#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
+#ifdef RADIANCEOCCLUSION
+ambientMonochrome,
+#endif
+#endif
+clearcoatOut
+);
+#else
+clearcoatOut.specularEnvironmentR0=specularEnvironmentR0;
+#endif
+
+#include
+
+subSurfaceOutParams subSurfaceOut;
+#ifdef SUBSURFACE
+#ifdef SS_THICKNESSANDMASK_TEXTURE
+vec4 thicknessMap=texture2D(thicknessSampler,vThicknessUV+uvOffset);
+#endif
+subSurfaceBlock(
+vSubSurfaceIntensity,
+vThicknessParam,
+vTintColor,
+normalW,
+specularEnvironmentReflectance,
+#ifdef SS_THICKNESSANDMASK_TEXTURE
+thicknessMap,
+#endif
+#ifdef REFLECTION
+#ifdef SS_TRANSLUCENCY
+reflectionMatrix,
+#ifdef USESPHERICALFROMREFLECTIONMAP
+#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)
+reflectionOut.irradianceVector,
+#endif
+#if defined(REALTIME_FILTERING)
+reflectionSampler,
+vReflectionFilteringInfo,
+#endif
+#endif
+#ifdef USEIRRADIANCEMAP
+irradianceSampler,
+#endif
+#endif
+#endif
+#ifdef SS_REFRACTION
+vPositionW,
+viewDirectionW,
+view,
+surfaceAlbedo,
+vRefractionInfos,
+refractionMatrix,
+vRefractionMicrosurfaceInfos,
+vLightingIntensity,
+#ifdef SS_LINKREFRACTIONTOTRANSPARENCY
+alpha,
+#endif
+#ifdef SS_LODINREFRACTIONALPHA
+NdotVUnclamped,
+#endif
+#ifdef SS_LINEARSPECULARREFRACTION
+roughness,
+#else
+alphaG,
+#endif
+refractionSampler,
+#ifndef LODBASEDMICROSFURACE
+refractionSamplerLow,
+refractionSamplerHigh,
+#endif
+#ifdef ANISOTROPIC
+anisotropicOut,
+#endif
+#ifdef REALTIME_FILTERING
+vRefractionFilteringInfo,
+#endif
+#endif
+#ifdef SS_TRANSLUCENCY
+vDiffusionDistance,
+#endif
+subSurfaceOut
+);
+#ifdef SS_REFRACTION
+surfaceAlbedo=subSurfaceOut.surfaceAlbedo;
+#ifdef SS_LINKREFRACTIONTOTRANSPARENCY
+alpha=subSurfaceOut.alpha;
+#endif
+#endif
+#else
+subSurfaceOut.specularEnvironmentReflectance=specularEnvironmentReflectance;
+#endif
+
+#include
+#include[0..maxSimultaneousLights]
+
+#include
+#endif
+#include
+#include
+#include
+#include(color,finalColor)
+#include
+#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR
+#ifdef PREPASS
+#ifdef PREPASS_POSITION
+gl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,1.0);
+#endif
+#ifdef PREPASS_VELOCITY
+vec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;
+vec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;
+vec2 velocity=abs(a-b);
+velocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;
+gl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,1.0);
+#endif
+#ifdef PREPASS_IRRADIANCE
+vec3 irradiance=finalDiffuse;
+#ifndef UNLIT
+#ifdef REFLECTION
+irradiance+=finalIrradiance;
+#endif
+#endif
+vec3 sqAlbedo=sqrt(surfaceAlbedo);
+#ifdef SS_SCATTERING
+gl_FragData[0]=vec4(finalColor.rgb-irradiance,finalColor.a);
+irradiance/=sqAlbedo;
+#else
+gl_FragData[0]=finalColor;
+float scatteringDiffusionProfile=255.;
+#endif
+gl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(irradiance,scatteringDiffusionProfile/255.);
+#else
+gl_FragData[0]=vec4(finalColor.rgb,finalColor.a);
+#endif
+#ifdef PREPASS_DEPTHNORMAL
+gl_FragData[PREPASS_DEPTHNORMAL_INDEX]=vec4(vViewPos.z,(view*vec4(normalW,0.0)).rgb);
+#endif
+#ifdef PREPASS_ALBEDO
+gl_FragData[PREPASS_ALBEDO_INDEX]=vec4(sqAlbedo,1.0);
+#endif
+#ifdef PREPASS_REFLECTIVITY
+#if defined(REFLECTIVITY)
+gl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(baseReflectivity.rgb,1.0);
+#else
+gl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(0.0,0.0,0.0,1.0);
+#endif
+#endif
+#endif
+#if !defined(PREPASS) || defined(WEBGL2)
+gl_FragColor=finalColor;
+#endif
+#include
+}
+`;
+ We.a.ShadersStore.pbrPixelShader = Cy;
+ var xy = `uniform mat4 view;
+uniform mat4 viewProjection;
+#ifdef ALBEDO
+uniform mat4 albedoMatrix;
+uniform vec2 vAlbedoInfos;
+#endif
+#ifdef AMBIENT
+uniform mat4 ambientMatrix;
+uniform vec4 vAmbientInfos;
+#endif
+#ifdef OPACITY
+uniform mat4 opacityMatrix;
+uniform vec2 vOpacityInfos;
+#endif
+#ifdef EMISSIVE
+uniform vec2 vEmissiveInfos;
+uniform mat4 emissiveMatrix;
+#endif
+#ifdef LIGHTMAP
+uniform vec2 vLightmapInfos;
+uniform mat4 lightmapMatrix;
+#endif
+#ifdef REFLECTIVITY
+uniform vec3 vReflectivityInfos;
+uniform mat4 reflectivityMatrix;
+#endif
+#ifdef METALLIC_REFLECTANCE
+uniform vec2 vMetallicReflectanceInfos;
+uniform mat4 metallicReflectanceMatrix;
+#endif
+#ifdef MICROSURFACEMAP
+uniform vec2 vMicroSurfaceSamplerInfos;
+uniform mat4 microSurfaceSamplerMatrix;
+#endif
+#ifdef BUMP
+uniform vec3 vBumpInfos;
+uniform mat4 bumpMatrix;
+#endif
+#ifdef POINTSIZE
+uniform float pointSize;
+#endif
+
+#ifdef REFLECTION
+uniform vec2 vReflectionInfos;
+uniform mat4 reflectionMatrix;
+#endif
+
+#ifdef CLEARCOAT
+#if defined(CLEARCOAT_TEXTURE) || defined(CLEARCOAT_TEXTURE_ROUGHNESS)
+uniform vec4 vClearCoatInfos;
+#endif
+#ifdef CLEARCOAT_TEXTURE
+uniform mat4 clearCoatMatrix;
+#endif
+#ifdef CLEARCOAT_TEXTURE_ROUGHNESS
+uniform mat4 clearCoatRoughnessMatrix;
+#endif
+#ifdef CLEARCOAT_BUMP
+uniform vec2 vClearCoatBumpInfos;
+uniform mat4 clearCoatBumpMatrix;
+#endif
+#ifdef CLEARCOAT_TINT_TEXTURE
+uniform vec2 vClearCoatTintInfos;
+uniform mat4 clearCoatTintMatrix;
+#endif
+#endif
+
+#ifdef ANISOTROPIC
+#ifdef ANISOTROPIC_TEXTURE
+uniform vec2 vAnisotropyInfos;
+uniform mat4 anisotropyMatrix;
+#endif
+#endif
+
+#ifdef SHEEN
+#if defined(SHEEN_TEXTURE) || defined(SHEEN_TEXTURE_ROUGHNESS)
+uniform vec4 vSheenInfos;
+#endif
+#ifdef SHEEN_TEXTURE
+uniform mat4 sheenMatrix;
+#endif
+#ifdef SHEEN_TEXTURE_ROUGHNESS
+uniform mat4 sheenRoughnessMatrix;
+#endif
+#endif
+
+#ifdef SUBSURFACE
+#ifdef SS_REFRACTION
+uniform vec4 vRefractionInfos;
+uniform mat4 refractionMatrix;
+#endif
+#ifdef SS_THICKNESSANDMASK_TEXTURE
+uniform vec2 vThicknessInfos;
+uniform mat4 thicknessMatrix;
+#endif
+#endif
+`;
+ We.a.IncludesShadersStore.pbrVertexDeclaration = xy, l(163), l(164), l(93), l(94), l(100), l(165), l(156), l(158);
+ var Ry = `precision highp float;
+#include<__decl__pbrVertex>
+#define CUSTOM_VERTEX_BEGIN
+
+attribute vec3 position;
+#ifdef NORMAL
+attribute vec3 normal;
+#endif
+#ifdef TANGENT
+attribute vec4 tangent;
+#endif
+#ifdef UV1
+attribute vec2 uv;
+#endif
+#ifdef UV2
+attribute vec2 uv2;
+#endif
+#ifdef MAINUV1
+varying vec2 vMainUV1;
+#endif
+#ifdef MAINUV2
+varying vec2 vMainUV2;
+#endif
+#ifdef VERTEXCOLOR
+attribute vec4 color;
+#endif
+#include
+#include
+
+#include
+#include
+#if defined(ALBEDO) && ALBEDODIRECTUV == 0
+varying vec2 vAlbedoUV;
+#endif
+#if defined(DETAIL) && DETAILDIRECTUV == 0
+varying vec2 vDetailUV;
+#endif
+#if defined(AMBIENT) && AMBIENTDIRECTUV == 0
+varying vec2 vAmbientUV;
+#endif
+#if defined(OPACITY) && OPACITYDIRECTUV == 0
+varying vec2 vOpacityUV;
+#endif
+#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0
+varying vec2 vEmissiveUV;
+#endif
+#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0
+varying vec2 vLightmapUV;
+#endif
+#if defined(REFLECTIVITY) && REFLECTIVITYDIRECTUV == 0
+varying vec2 vReflectivityUV;
+#endif
+#if defined(MICROSURFACEMAP) && MICROSURFACEMAPDIRECTUV == 0
+varying vec2 vMicroSurfaceSamplerUV;
+#endif
+#if defined(METALLIC_REFLECTANCE) && METALLIC_REFLECTANCEDIRECTUV == 0
+varying vec2 vMetallicReflectanceUV;
+#endif
+#if defined(BUMP) && BUMPDIRECTUV == 0
+varying vec2 vBumpUV;
+#endif
+#ifdef CLEARCOAT
+#if defined(CLEARCOAT_TEXTURE) && CLEARCOAT_TEXTUREDIRECTUV == 0
+varying vec2 vClearCoatUV;
+#endif
+#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV == 0
+varying vec2 vClearCoatRoughnessUV;
+#endif
+#if defined(CLEARCOAT_BUMP) && CLEARCOAT_BUMPDIRECTUV == 0
+varying vec2 vClearCoatBumpUV;
+#endif
+#if defined(CLEARCOAT_TINT_TEXTURE) && CLEARCOAT_TINT_TEXTUREDIRECTUV == 0
+varying vec2 vClearCoatTintUV;
+#endif
+#endif
+#ifdef SHEEN
+#if defined(SHEEN_TEXTURE) && SHEEN_TEXTUREDIRECTUV == 0
+varying vec2 vSheenUV;
+#endif
+#if defined(SHEEN_TEXTURE_ROUGHNESS) && SHEEN_TEXTURE_ROUGHNESSDIRECTUV == 0
+varying vec2 vSheenRoughnessUV;
+#endif
+#endif
+#ifdef ANISOTROPIC
+#if defined(ANISOTROPIC_TEXTURE) && ANISOTROPIC_TEXTUREDIRECTUV == 0
+varying vec2 vAnisotropyUV;
+#endif
+#endif
+#ifdef SUBSURFACE
+#if defined(SS_THICKNESSANDMASK_TEXTURE) && SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 0
+varying vec2 vThicknessUV;
+#endif
+#endif
+
+varying vec3 vPositionW;
+#if DEBUGMODE>0
+varying vec4 vClipSpacePosition;
+#endif
+#ifdef NORMAL
+varying vec3 vNormalW;
+#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)
+varying vec3 vEnvironmentIrradiance;
+#include
+#endif
+#endif
+#ifdef VERTEXCOLOR
+varying vec4 vColor;
+#endif
+#include
+#include
+#include
+#include<__decl__lightFragment>[0..maxSimultaneousLights]
+#include
+#include[0..maxSimultaneousMorphTargets]
+#ifdef REFLECTIONMAP_SKYBOX
+varying vec3 vPositionUVW;
+#endif
+#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
+varying vec3 vDirectionW;
+#endif
+#include
+#define CUSTOM_VERTEX_DEFINITIONS
+void main(void) {
+#define CUSTOM_VERTEX_MAIN_BEGIN
+vec3 positionUpdated=position;
+#ifdef NORMAL
+vec3 normalUpdated=normal;
+#endif
+#ifdef TANGENT
+vec4 tangentUpdated=tangent;
+#endif
+#ifdef UV1
+vec2 uvUpdated=uv;
+#endif
+#include[0..maxSimultaneousMorphTargets]
+#ifdef REFLECTIONMAP_SKYBOX
+vPositionUVW=positionUpdated;
+#endif
+#define CUSTOM_VERTEX_UPDATE_POSITION
+#define CUSTOM_VERTEX_UPDATE_NORMAL
+#include
+#if defined(PREPASS) && defined(PREPASS_VELOCITY) && !defined(BONES_VELOCITY_ENABLED)
+
+vCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);
+vPreviousPosition=previousViewProjection*previousWorld*vec4(positionUpdated,1.0);
+#endif
+#include
+vec4 worldPos=finalWorld*vec4(positionUpdated,1.0);
+vPositionW=vec3(worldPos);
+#include
+#ifdef NORMAL
+mat3 normalWorld=mat3(finalWorld);
+#if defined(INSTANCES) && defined(THIN_INSTANCES)
+vNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));
+vNormalW=normalize(normalWorld*vNormalW);
+#else
+#ifdef NONUNIFORMSCALING
+normalWorld=transposeMat3(inverseMat3(normalWorld));
+#endif
+vNormalW=normalize(normalWorld*normalUpdated);
+#endif
+#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)
+vec3 reflectionVector=vec3(reflectionMatrix*vec4(vNormalW,0)).xyz;
+#ifdef REFLECTIONMAP_OPPOSITEZ
+reflectionVector.z*=-1.0;
+#endif
+vEnvironmentIrradiance=computeEnvironmentIrradiance(reflectionVector);
+#endif
+#endif
+#define CUSTOM_VERTEX_UPDATE_WORLDPOS
+#ifdef MULTIVIEW
+if (gl_ViewID_OVR == 0u) {
+gl_Position=viewProjection*worldPos;
+} else {
+gl_Position=viewProjectionR*worldPos;
+}
+#else
+gl_Position=viewProjection*worldPos;
+#endif
+#if DEBUGMODE>0
+vClipSpacePosition=gl_Position;
+#endif
+#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
+vDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));
+#endif
+
+#ifndef UV1
+vec2 uvUpdated=vec2(0.,0.);
+#endif
+#ifndef UV2
+vec2 uv2=vec2(0.,0.);
+#endif
+#ifdef MAINUV1
+vMainUV1=uvUpdated;
+#endif
+#ifdef MAINUV2
+vMainUV2=uv2;
+#endif
+#if defined(ALBEDO) && ALBEDODIRECTUV == 0
+if (vAlbedoInfos.x == 0.)
+{
+vAlbedoUV=vec2(albedoMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vAlbedoUV=vec2(albedoMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#if defined(DETAIL) && DETAILDIRECTUV == 0
+if (vDetailInfos.x == 0.)
+{
+vDetailUV=vec2(detailMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vDetailUV=vec2(detailMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#if defined(AMBIENT) && AMBIENTDIRECTUV == 0
+if (vAmbientInfos.x == 0.)
+{
+vAmbientUV=vec2(ambientMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vAmbientUV=vec2(ambientMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#if defined(OPACITY) && OPACITYDIRECTUV == 0
+if (vOpacityInfos.x == 0.)
+{
+vOpacityUV=vec2(opacityMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0
+if (vEmissiveInfos.x == 0.)
+{
+vEmissiveUV=vec2(emissiveMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vEmissiveUV=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0
+if (vLightmapInfos.x == 0.)
+{
+vLightmapUV=vec2(lightmapMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vLightmapUV=vec2(lightmapMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#if defined(REFLECTIVITY) && REFLECTIVITYDIRECTUV == 0
+if (vReflectivityInfos.x == 0.)
+{
+vReflectivityUV=vec2(reflectivityMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vReflectivityUV=vec2(reflectivityMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#if defined(MICROSURFACEMAP) && MICROSURFACEMAPDIRECTUV == 0
+if (vMicroSurfaceSamplerInfos.x == 0.)
+{
+vMicroSurfaceSamplerUV=vec2(microSurfaceSamplerMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vMicroSurfaceSamplerUV=vec2(microSurfaceSamplerMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#if defined(METALLIC_REFLECTANCE) && METALLIC_REFLECTANCEDIRECTUV == 0
+if (vMetallicReflectanceInfos.x == 0.)
+{
+vMetallicReflectanceUV=vec2(metallicReflectanceMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vMetallicReflectanceUV=vec2(metallicReflectanceMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#if defined(BUMP) && BUMPDIRECTUV == 0
+if (vBumpInfos.x == 0.)
+{
+vBumpUV=vec2(bumpMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#ifdef CLEARCOAT
+#if defined(CLEARCOAT_TEXTURE) && CLEARCOAT_TEXTUREDIRECTUV == 0
+if (vClearCoatInfos.x == 0.)
+{
+vClearCoatUV=vec2(clearCoatMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vClearCoatUV=vec2(clearCoatMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV == 0
+if (vClearCoatInfos.z == 0.)
+{
+vClearCoatRoughnessUV=vec2(clearCoatRoughnessMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vClearCoatRoughnessUV=vec2(clearCoatRoughnessMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#if defined(CLEARCOAT_BUMP) && CLEARCOAT_BUMPDIRECTUV == 0
+if (vClearCoatBumpInfos.x == 0.)
+{
+vClearCoatBumpUV=vec2(clearCoatBumpMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vClearCoatBumpUV=vec2(clearCoatBumpMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#if defined(CLEARCOAT_TINT_TEXTURE) && CLEARCOAT_TINT_TEXTUREDIRECTUV == 0
+if (vClearCoatTintInfos.x == 0.)
+{
+vClearCoatTintUV=vec2(clearCoatTintMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vClearCoatTintUV=vec2(clearCoatTintMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#endif
+#ifdef SHEEN
+#if defined(SHEEN_TEXTURE) && SHEEN_TEXTUREDIRECTUV == 0
+if (vSheenInfos.x == 0.)
+{
+vSheenUV=vec2(sheenMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vSheenUV=vec2(sheenMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#if defined(SHEEN_TEXTURE_ROUGHNESS) && SHEEN_TEXTURE_ROUGHNESSDIRECTUV == 0
+if (vSheenInfos.z == 0.)
+{
+vSheenRoughnessUV=vec2(sheenRoughnessMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vSheenRoughnessUV=vec2(sheenRoughnessMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#endif
+#ifdef ANISOTROPIC
+#if defined(ANISOTROPIC_TEXTURE) && ANISOTROPIC_TEXTUREDIRECTUV == 0
+if (vAnisotropyInfos.x == 0.)
+{
+vAnisotropyUV=vec2(anisotropyMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vAnisotropyUV=vec2(anisotropyMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#endif
+#ifdef SUBSURFACE
+#if defined(SS_THICKNESSANDMASK_TEXTURE) && SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 0
+if (vThicknessInfos.x == 0.)
+{
+vThicknessUV=vec2(thicknessMatrix*vec4(uvUpdated,1.0,0.0));
+}
+else
+{
+vThicknessUV=vec2(thicknessMatrix*vec4(uv2,1.0,0.0));
+}
+#endif
+#endif
+
+#include
+
+#include
+
+#include
+
+#include[0..maxSimultaneousLights]
+
+#ifdef VERTEXCOLOR
+vColor=color;
+#endif
+
+#ifdef POINTSIZE
+gl_PointSize=pointSize;
+#endif
+
+#include
+#define CUSTOM_VERTEX_MAIN_END
+}`;
+ We.a.ShadersStore.pbrVertexShader = Ry;
+ var ws = l(92), Ro = { effect: null, subMesh: null }, Bl = function(r) {
+ function t() {
+ var e = r.call(this) || this;
+ return e.PBR = !0, e.NUM_SAMPLES = "0", e.REALTIME_FILTERING = !1, e.MAINUV1 = !1, e.MAINUV2 = !1, e.UV1 = !1, e.UV2 = !1, e.ALBEDO = !1, e.GAMMAALBEDO = !1, e.ALBEDODIRECTUV = 0, e.VERTEXCOLOR = !1, e.DETAIL = !1, e.DETAILDIRECTUV = 0, e.DETAIL_NORMALBLENDMETHOD = 0, e.AMBIENT = !1, e.AMBIENTDIRECTUV = 0, e.AMBIENTINGRAYSCALE = !1, e.OPACITY = !1, e.VERTEXALPHA = !1, e.OPACITYDIRECTUV = 0, e.OPACITYRGB = !1, e.ALPHATEST = !1, e.DEPTHPREPASS = !1, e.ALPHABLEND = !1, e.ALPHAFROMALBEDO = !1, e.ALPHATESTVALUE = "0.5", e.SPECULAROVERALPHA = !1, e.RADIANCEOVERALPHA = !1, e.ALPHAFRESNEL = !1, e.LINEARALPHAFRESNEL = !1, e.PREMULTIPLYALPHA = !1, e.EMISSIVE = !1, e.EMISSIVEDIRECTUV = 0, e.REFLECTIVITY = !1, e.REFLECTIVITYDIRECTUV = 0, e.SPECULARTERM = !1, e.MICROSURFACEFROMREFLECTIVITYMAP = !1, e.MICROSURFACEAUTOMATIC = !1, e.LODBASEDMICROSFURACE = !1, e.MICROSURFACEMAP = !1, e.MICROSURFACEMAPDIRECTUV = 0, e.METALLICWORKFLOW = !1, e.ROUGHNESSSTOREINMETALMAPALPHA = !1, e.ROUGHNESSSTOREINMETALMAPGREEN = !1, e.METALLNESSSTOREINMETALMAPBLUE = !1, e.AOSTOREINMETALMAPRED = !1, e.METALLIC_REFLECTANCE = !1, e.METALLIC_REFLECTANCEDIRECTUV = 0, e.ENVIRONMENTBRDF = !1, e.ENVIRONMENTBRDF_RGBD = !1, e.NORMAL = !1, e.TANGENT = !1, e.BUMP = !1, e.BUMPDIRECTUV = 0, e.OBJECTSPACE_NORMALMAP = !1, e.PARALLAX = !1, e.PARALLAXOCCLUSION = !1, e.NORMALXYSCALE = !0, e.LIGHTMAP = !1, e.LIGHTMAPDIRECTUV = 0, e.USELIGHTMAPASSHADOWMAP = !1, e.GAMMALIGHTMAP = !1, e.RGBDLIGHTMAP = !1, e.REFLECTION = !1, e.REFLECTIONMAP_3D = !1, e.REFLECTIONMAP_SPHERICAL = !1, e.REFLECTIONMAP_PLANAR = !1, e.REFLECTIONMAP_CUBIC = !1, e.USE_LOCAL_REFLECTIONMAP_CUBIC = !1, e.REFLECTIONMAP_PROJECTION = !1, e.REFLECTIONMAP_SKYBOX = !1, e.REFLECTIONMAP_EXPLICIT = !1, e.REFLECTIONMAP_EQUIRECTANGULAR = !1, e.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = !1, e.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = !1, e.INVERTCUBICMAP = !1, e.USESPHERICALFROMREFLECTIONMAP = !1, e.USEIRRADIANCEMAP = !1, e.SPHERICAL_HARMONICS = !1, e.USESPHERICALINVERTEX = !1, e.REFLECTIONMAP_OPPOSITEZ = !1, e.LODINREFLECTIONALPHA = !1, e.GAMMAREFLECTION = !1, e.RGBDREFLECTION = !1, e.LINEARSPECULARREFLECTION = !1, e.RADIANCEOCCLUSION = !1, e.HORIZONOCCLUSION = !1, e.INSTANCES = !1, e.THIN_INSTANCES = !1, e.PREPASS = !1, e.PREPASS_IRRADIANCE = !1, e.PREPASS_IRRADIANCE_INDEX = -1, e.PREPASS_ALBEDO = !1, e.PREPASS_ALBEDO_INDEX = -1, e.PREPASS_DEPTHNORMAL = !1, e.PREPASS_DEPTHNORMAL_INDEX = -1, e.PREPASS_POSITION = !1, e.PREPASS_POSITION_INDEX = -1, e.PREPASS_VELOCITY = !1, e.PREPASS_VELOCITY_INDEX = -1, e.PREPASS_REFLECTIVITY = !1, e.PREPASS_REFLECTIVITY_INDEX = -1, e.SCENE_MRT_COUNT = 0, e.NUM_BONE_INFLUENCERS = 0, e.BonesPerMesh = 0, e.BONETEXTURE = !1, e.BONES_VELOCITY_ENABLED = !1, e.NONUNIFORMSCALING = !1, e.MORPHTARGETS = !1, e.MORPHTARGETS_NORMAL = !1, e.MORPHTARGETS_TANGENT = !1, e.MORPHTARGETS_UV = !1, e.NUM_MORPH_INFLUENCERS = 0, e.IMAGEPROCESSING = !1, e.VIGNETTE = !1, e.VIGNETTEBLENDMODEMULTIPLY = !1, e.VIGNETTEBLENDMODEOPAQUE = !1, e.TONEMAPPING = !1, e.TONEMAPPING_ACES = !1, e.CONTRAST = !1, e.COLORCURVES = !1, e.COLORGRADING = !1, e.COLORGRADING3D = !1, e.SAMPLER3DGREENDEPTH = !1, e.SAMPLER3DBGRMAP = !1, e.IMAGEPROCESSINGPOSTPROCESS = !1, e.EXPOSURE = !1, e.MULTIVIEW = !1, e.USEPHYSICALLIGHTFALLOFF = !1, e.USEGLTFLIGHTFALLOFF = !1, e.TWOSIDEDLIGHTING = !1, e.SHADOWFLOAT = !1, e.CLIPPLANE = !1, e.CLIPPLANE2 = !1, e.CLIPPLANE3 = !1, e.CLIPPLANE4 = !1, e.CLIPPLANE5 = !1, e.CLIPPLANE6 = !1, e.POINTSIZE = !1, e.FOG = !1, e.LOGARITHMICDEPTH = !1, e.FORCENORMALFORWARD = !1, e.SPECULARAA = !1, e.CLEARCOAT = !1, e.CLEARCOAT_DEFAULTIOR = !1, e.CLEARCOAT_TEXTURE = !1, e.CLEARCOAT_TEXTURE_ROUGHNESS = !1, e.CLEARCOAT_TEXTUREDIRECTUV = 0, e.CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV = 0, e.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE = !1, e.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL = !1, e.CLEARCOAT_BUMP = !1, e.CLEARCOAT_BUMPDIRECTUV = 0, e.CLEARCOAT_REMAP_F0 = !0, e.CLEARCOAT_TINT = !1, e.CLEARCOAT_TINT_TEXTURE = !1, e.CLEARCOAT_TINT_TEXTUREDIRECTUV = 0, e.ANISOTROPIC = !1, e.ANISOTROPIC_TEXTURE = !1, e.ANISOTROPIC_TEXTUREDIRECTUV = 0, e.BRDF_V_HEIGHT_CORRELATED = !1, e.MS_BRDF_ENERGY_CONSERVATION = !1, e.SPECULAR_GLOSSINESS_ENERGY_CONSERVATION = !1, e.SHEEN = !1, e.SHEEN_TEXTURE = !1, e.SHEEN_TEXTURE_ROUGHNESS = !1, e.SHEEN_TEXTUREDIRECTUV = 0, e.SHEEN_TEXTURE_ROUGHNESSDIRECTUV = 0, e.SHEEN_LINKWITHALBEDO = !1, e.SHEEN_ROUGHNESS = !1, e.SHEEN_ALBEDOSCALING = !1, e.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE = !1, e.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL = !1, e.SUBSURFACE = !1, e.SS_REFRACTION = !1, e.SS_TRANSLUCENCY = !1, e.SS_SCATTERING = !1, e.SS_THICKNESSANDMASK_TEXTURE = !1, e.SS_THICKNESSANDMASK_TEXTUREDIRECTUV = 0, e.SS_REFRACTIONMAP_3D = !1, e.SS_REFRACTIONMAP_OPPOSITEZ = !1, e.SS_LODINREFRACTIONALPHA = !1, e.SS_GAMMAREFRACTION = !1, e.SS_RGBDREFRACTION = !1, e.SS_LINEARSPECULARREFRACTION = !1, e.SS_LINKREFRACTIONTOTRANSPARENCY = !1, e.SS_ALBEDOFORREFRACTIONTINT = !1, e.SS_MASK_FROM_THICKNESS_TEXTURE = !1, e.SS_MASK_FROM_THICKNESS_TEXTURE_GLTF = !1, e.UNLIT = !1, e.DEBUGMODE = 0, e.rebuild(), e;
+ }
+ return Object(u.d)(t, r), t.prototype.reset = function() {
+ r.prototype.reset.call(this), this.ALPHATESTVALUE = "0.5", this.PBR = !0;
+ }, t;
+ }(Is.a), Cn = function(r) {
+ function t(e, n) {
+ var i = r.call(this, e, n) || this;
+ return i._directIntensity = 1, i._emissiveIntensity = 1, i._environmentIntensity = 1, i._specularIntensity = 1, i._lightingInfos = new c.f(i._directIntensity, i._emissiveIntensity, i._environmentIntensity, i._specularIntensity), i._disableBumpMap = !1, i._albedoTexture = null, i._ambientTexture = null, i._ambientTextureStrength = 1, i._ambientTextureImpactOnAnalyticalLights = t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS, i._opacityTexture = null, i._reflectionTexture = null, i._emissiveTexture = null, i._reflectivityTexture = null, i._metallicTexture = null, i._metallic = null, i._roughness = null, i._metallicF0Factor = 1, i._metallicReflectanceColor = C.a.White(), i._metallicReflectanceTexture = null, i._microSurfaceTexture = null, i._bumpTexture = null, i._lightmapTexture = null, i._ambientColor = new C.a(0, 0, 0), i._albedoColor = new C.a(1, 1, 1), i._reflectivityColor = new C.a(1, 1, 1), i._reflectionColor = new C.a(1, 1, 1), i._emissiveColor = new C.a(0, 0, 0), i._microSurface = 0.9, i._useLightmapAsShadowmap = !1, i._useHorizonOcclusion = !0, i._useRadianceOcclusion = !0, i._useAlphaFromAlbedoTexture = !1, i._useSpecularOverAlpha = !0, i._useMicroSurfaceFromReflectivityMapAlpha = !1, i._useRoughnessFromMetallicTextureAlpha = !0, i._useRoughnessFromMetallicTextureGreen = !1, i._useMetallnessFromMetallicTextureBlue = !1, i._useAmbientOcclusionFromMetallicTextureRed = !1, i._useAmbientInGrayScale = !1, i._useAutoMicroSurfaceFromReflectivityMap = !1, i._lightFalloff = t.LIGHTFALLOFF_PHYSICAL, i._useRadianceOverAlpha = !0, i._useObjectSpaceNormalMap = !1, i._useParallax = !1, i._useParallaxOcclusion = !1, i._parallaxScaleBias = 0.05, i._disableLighting = !1, i._maxSimultaneousLights = 4, i._invertNormalMapX = !1, i._invertNormalMapY = !1, i._twoSidedLighting = !1, i._alphaCutOff = 0.4, i._forceAlphaTest = !1, i._useAlphaFresnel = !1, i._useLinearAlphaFresnel = !1, i._environmentBRDFTexture = null, i._forceIrradianceInFragment = !1, i._realTimeFiltering = !1, i._realTimeFilteringQuality = d.a.TEXTURE_FILTERING_QUALITY_LOW, i._forceNormalForward = !1, i._enableSpecularAntiAliasing = !1, i._imageProcessingObserver = null, i._renderTargets = new Ui.a(16), i._globalAmbientColor = new C.a(0, 0, 0), i._useLogarithmicDepth = !1, i._unlit = !1, i._debugMode = 0, i.debugMode = 0, i.debugLimit = -1, i.debugFactor = 1, i.clearCoat = new Co(i._markAllSubMeshesAsTexturesDirty.bind(i)), i.anisotropy = new xo(i._markAllSubMeshesAsTexturesDirty.bind(i)), i.brdf = new Wb(i._markAllSubMeshesAsMiscDirty.bind(i)), i.sheen = new Aa(i._markAllSubMeshesAsTexturesDirty.bind(i)), i.detailMap = new ws.a(i._markAllSubMeshesAsTexturesDirty.bind(i)), i._rebuildInParallel = !1, i._attachImageProcessingConfiguration(null), i.getRenderTargetTextures = function() {
+ return i._renderTargets.reset(), ht.a.ReflectionTextureEnabled && i._reflectionTexture && i._reflectionTexture.isRenderTarget && i._renderTargets.push(i._reflectionTexture), i.subSurface.fillRenderTargetTextures(i._renderTargets), i._renderTargets;
+ }, i._environmentBRDFTexture = Ls.GetEnvironmentBRDFTexture(n), i.subSurface = new Pa(i._markAllSubMeshesAsTexturesDirty.bind(i), i._markScenePrePassDirty.bind(i), n), i.prePassConfiguration = new Fl.a(), i;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "realTimeFiltering", { get: function() {
+ return this._realTimeFiltering;
+ }, set: function(e) {
+ this._realTimeFiltering = e, this.markAsDirty(d.a.MATERIAL_TextureDirtyFlag);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "realTimeFilteringQuality", { get: function() {
+ return this._realTimeFilteringQuality;
+ }, set: function(e) {
+ this._realTimeFilteringQuality = e, this.markAsDirty(d.a.MATERIAL_TextureDirtyFlag);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "canRenderToMRT", { get: function() {
+ return !0;
+ }, enumerable: !1, configurable: !0 }), t.prototype._attachImageProcessingConfiguration = function(e) {
+ var n = this;
+ e !== this._imageProcessingConfiguration && (this._imageProcessingConfiguration && this._imageProcessingObserver && this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver), this._imageProcessingConfiguration = e || this.getScene().imageProcessingConfiguration, this._imageProcessingConfiguration && (this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(function() {
+ n._markAllSubMeshesAsImageProcessingDirty();
+ })));
+ }, Object.defineProperty(t.prototype, "hasRenderTargetTextures", { get: function() {
+ return !!(ht.a.ReflectionTextureEnabled && this._reflectionTexture && this._reflectionTexture.isRenderTarget) || this.subSurface.hasRenderTargetTextures();
+ }, enumerable: !1, configurable: !0 }), t.prototype.getClassName = function() {
+ return "PBRBaseMaterial";
+ }, Object.defineProperty(t.prototype, "useLogarithmicDepth", { get: function() {
+ return this._useLogarithmicDepth;
+ }, set: function(e) {
+ this._useLogarithmicDepth = e && this.getScene().getEngine().getCaps().fragmentDepthSupported;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "_disableAlphaBlending", { get: function() {
+ return this.subSurface.disableAlphaBlending || this._transparencyMode === t.PBRMATERIAL_OPAQUE || this._transparencyMode === t.PBRMATERIAL_ALPHATEST;
+ }, enumerable: !1, configurable: !0 }), t.prototype.needAlphaBlending = function() {
+ return !this._disableAlphaBlending && (this.alpha < 1 || this._opacityTexture != null || this._shouldUseAlphaFromAlbedoTexture());
+ }, t.prototype.needAlphaTesting = function() {
+ return !!this._forceAlphaTest || !this.subSurface.disableAlphaBlending && this._hasAlphaChannel() && (this._transparencyMode == null || this._transparencyMode === t.PBRMATERIAL_ALPHATEST);
+ }, t.prototype._shouldUseAlphaFromAlbedoTexture = function() {
+ return this._albedoTexture != null && this._albedoTexture.hasAlpha && this._useAlphaFromAlbedoTexture && this._transparencyMode !== t.PBRMATERIAL_OPAQUE;
+ }, t.prototype._hasAlphaChannel = function() {
+ return this._albedoTexture != null && this._albedoTexture.hasAlpha || this._opacityTexture != null;
+ }, t.prototype.getAlphaTestTexture = function() {
+ return this._albedoTexture;
+ }, t.prototype.isReadyForSubMesh = function(e, n, i) {
+ if (n.effect && this.isFrozen && n.effect._wasPreviouslyReady)
+ return !0;
+ n._materialDefines || (n._materialDefines = new Bl());
+ var o = n._materialDefines;
+ if (this._isReadyForSubMesh(n))
+ return !0;
+ var a = this.getScene(), s = a.getEngine();
+ if (o._areTexturesDirty && a.texturesEnabled) {
+ if (this._albedoTexture && ht.a.DiffuseTextureEnabled && !this._albedoTexture.isReadyOrNotBlocking() || this._ambientTexture && ht.a.AmbientTextureEnabled && !this._ambientTexture.isReadyOrNotBlocking() || this._opacityTexture && ht.a.OpacityTextureEnabled && !this._opacityTexture.isReadyOrNotBlocking())
+ return !1;
+ var p = this._getReflectionTexture();
+ if (p && ht.a.ReflectionTextureEnabled && (!p.isReadyOrNotBlocking() || p.irradianceTexture && !p.irradianceTexture.isReadyOrNotBlocking()) || this._lightmapTexture && ht.a.LightmapTextureEnabled && !this._lightmapTexture.isReadyOrNotBlocking() || this._emissiveTexture && ht.a.EmissiveTextureEnabled && !this._emissiveTexture.isReadyOrNotBlocking())
+ return !1;
+ if (ht.a.SpecularTextureEnabled) {
+ if (this._metallicTexture) {
+ if (!this._metallicTexture.isReadyOrNotBlocking())
+ return !1;
+ } else if (this._reflectivityTexture && !this._reflectivityTexture.isReadyOrNotBlocking())
+ return !1;
+ if (this._metallicReflectanceTexture && !this._metallicReflectanceTexture.isReadyOrNotBlocking() || this._microSurfaceTexture && !this._microSurfaceTexture.isReadyOrNotBlocking())
+ return !1;
+ }
+ if (s.getCaps().standardDerivatives && this._bumpTexture && ht.a.BumpTextureEnabled && !this._disableBumpMap && !this._bumpTexture.isReady() || this._environmentBRDFTexture && ht.a.ReflectionTextureEnabled && !this._environmentBRDFTexture.isReady())
+ return !1;
+ }
+ if (!(this.subSurface.isReadyForSubMesh(o, a) && this.clearCoat.isReadyForSubMesh(o, a, s, this._disableBumpMap) && this.sheen.isReadyForSubMesh(o, a) && this.anisotropy.isReadyForSubMesh(o, a) && this.detailMap.isReadyForSubMesh(o, a)) || o._areImageProcessingDirty && this._imageProcessingConfiguration && !this._imageProcessingConfiguration.isReady())
+ return !1;
+ s.getCaps().standardDerivatives || e.isVerticesDataPresent(De.b.NormalKind) || (e.createNormals(!0), h.a.Warn("PBRMaterial: Normals have been created for the mesh: " + e.name));
+ var m = n.effect, S = o._areLightsDisposed, O = this._prepareEffect(e, o, this.onCompiled, this.onError, i, null, n.getRenderingMesh().hasThinInstances);
+ if (O)
+ if (this._onEffectCreatedObservable && (Ro.effect = O, Ro.subMesh = n, this._onEffectCreatedObservable.notifyObservers(Ro)), this.allowShaderHotSwapping && m && !O.isReady()) {
+ if (O = m, this._rebuildInParallel = !0, o.markAsUnprocessed(), S)
+ return o._areLightsDisposed = !0, !1;
+ } else
+ this._rebuildInParallel = !1, a.resetCachedMaterial(), n.setEffect(O, o), this.buildUniformLayout();
+ return !(!n.effect || !n.effect.isReady()) && (o._renderId = a.getRenderId(), n.effect._wasPreviouslyReady = !0, !0);
+ }, t.prototype.isMetallicWorkflow = function() {
+ return !(this._metallic == null && this._roughness == null && !this._metallicTexture);
+ }, t.prototype._prepareEffect = function(e, n, i, o, a, s, p) {
+ if (i === void 0 && (i = null), o === void 0 && (o = null), a === void 0 && (a = null), s === void 0 && (s = null), this._prepareDefines(e, n, a, s, p), !n.isDirty)
+ return null;
+ n.markAsProcessed();
+ var m = this.getScene().getEngine(), S = new Po.a(), O = 0;
+ n.USESPHERICALINVERTEX && S.addFallback(O++, "USESPHERICALINVERTEX"), n.FOG && S.addFallback(O, "FOG"), n.SPECULARAA && S.addFallback(O, "SPECULARAA"), n.POINTSIZE && S.addFallback(O, "POINTSIZE"), n.LOGARITHMICDEPTH && S.addFallback(O, "LOGARITHMICDEPTH"), n.PARALLAX && S.addFallback(O, "PARALLAX"), n.PARALLAXOCCLUSION && S.addFallback(O++, "PARALLAXOCCLUSION"), O = xo.AddFallbacks(n, S, O), O = xo.AddFallbacks(n, S, O), O = Pa.AddFallbacks(n, S, O), O = Aa.AddFallbacks(n, S, O), n.ENVIRONMENTBRDF && S.addFallback(O++, "ENVIRONMENTBRDF"), n.TANGENT && S.addFallback(O++, "TANGENT"), n.BUMP && S.addFallback(O++, "BUMP"), O = tt.a.HandleFallbacksForShadows(n, S, this._maxSimultaneousLights, O++), n.SPECULARTERM && S.addFallback(O++, "SPECULARTERM"), n.USESPHERICALFROMREFLECTIONMAP && S.addFallback(O++, "USESPHERICALFROMREFLECTIONMAP"), n.USEIRRADIANCEMAP && S.addFallback(O++, "USEIRRADIANCEMAP"), n.LIGHTMAP && S.addFallback(O++, "LIGHTMAP"), n.NORMAL && S.addFallback(O++, "NORMAL"), n.AMBIENT && S.addFallback(O++, "AMBIENT"), n.EMISSIVE && S.addFallback(O++, "EMISSIVE"), n.VERTEXCOLOR && S.addFallback(O++, "VERTEXCOLOR"), n.MORPHTARGETS && S.addFallback(O++, "MORPHTARGETS"), n.MULTIVIEW && S.addFallback(0, "MULTIVIEW");
+ var I = [De.b.PositionKind];
+ n.NORMAL && I.push(De.b.NormalKind), n.TANGENT && I.push(De.b.TangentKind), n.UV1 && I.push(De.b.UVKind), n.UV2 && I.push(De.b.UV2Kind), n.VERTEXCOLOR && I.push(De.b.ColorKind), tt.a.PrepareAttributesForBones(I, e, n, S), tt.a.PrepareAttributesForInstances(I, n), tt.a.PrepareAttributesForMorphTargets(I, e, n);
+ var G = "pbr", k = ["world", "view", "viewProjection", "vEyePosition", "vLightsType", "vAmbientColor", "vAlbedoColor", "vReflectivityColor", "vMetallicReflectanceFactors", "vEmissiveColor", "visibility", "vReflectionColor", "vFogInfos", "vFogColor", "pointSize", "vAlbedoInfos", "vAmbientInfos", "vOpacityInfos", "vReflectionInfos", "vReflectionPosition", "vReflectionSize", "vEmissiveInfos", "vReflectivityInfos", "vReflectionFilteringInfo", "vMetallicReflectanceInfos", "vMicroSurfaceSamplerInfos", "vBumpInfos", "vLightmapInfos", "mBones", "vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6", "albedoMatrix", "ambientMatrix", "opacityMatrix", "reflectionMatrix", "emissiveMatrix", "reflectivityMatrix", "normalMatrix", "microSurfaceSamplerMatrix", "bumpMatrix", "lightmapMatrix", "metallicReflectanceMatrix", "vLightingIntensity", "logarithmicDepthConstant", "vSphericalX", "vSphericalY", "vSphericalZ", "vSphericalXX_ZZ", "vSphericalYY_ZZ", "vSphericalZZ", "vSphericalXY", "vSphericalYZ", "vSphericalZX", "vSphericalL00", "vSphericalL1_1", "vSphericalL10", "vSphericalL11", "vSphericalL2_2", "vSphericalL2_1", "vSphericalL20", "vSphericalL21", "vSphericalL22", "vReflectionMicrosurfaceInfos", "vTangentSpaceParams", "boneTextureWidth", "vDebugMode"], K = ["albedoSampler", "reflectivitySampler", "ambientSampler", "emissiveSampler", "bumpSampler", "lightmapSampler", "opacitySampler", "reflectionSampler", "reflectionSamplerLow", "reflectionSamplerHigh", "irradianceSampler", "microSurfaceSampler", "environmentBrdfSampler", "boneSampler", "metallicReflectanceSampler"], re = ["Material", "Scene"];
+ ws.a.AddUniforms(k), ws.a.AddSamplers(K), Pa.AddUniforms(k), Pa.AddSamplers(K), Co.AddUniforms(k), Co.AddSamplers(K), xo.AddUniforms(k), xo.AddSamplers(K), Aa.AddUniforms(k), Aa.AddSamplers(K), Fl.a.AddUniforms(k), Fl.a.AddSamplers(k), In.a && (In.a.PrepareUniforms(k, n), In.a.PrepareSamplers(K, n)), tt.a.PrepareUniformsAndSamplersList({ uniformsNames: k, uniformBuffersNames: re, samplers: K, defines: n, maxSimultaneousLights: this._maxSimultaneousLights });
+ var se = {};
+ this.customShaderNameResolve && (G = this.customShaderNameResolve(G, k, re, K, n, I, se));
+ var ue = n.toString();
+ return m.createEffect(G, { attributes: I, uniformsNames: k, uniformBuffersNames: re, samplers: K, defines: ue, fallbacks: S, onCompiled: i, onError: o, indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights, maxSimultaneousMorphTargets: n.NUM_MORPH_INFLUENCERS }, processFinalCode: se.processFinalCode, multiTarget: n.PREPASS }, m);
+ }, t.prototype._prepareDefines = function(e, n, i, o, a) {
+ i === void 0 && (i = null), o === void 0 && (o = null), a === void 0 && (a = !1);
+ var s = this.getScene(), p = s.getEngine();
+ if (tt.a.PrepareDefinesForLights(s, e, n, !0, this._maxSimultaneousLights, this._disableLighting), n._needNormals = !0, tt.a.PrepareDefinesForMultiview(s, n), tt.a.PrepareDefinesForPrePass(s, n, this.canRenderToMRT), n.METALLICWORKFLOW = this.isMetallicWorkflow(), n._areTexturesDirty) {
+ if (n._needUVs = !1, s.texturesEnabled) {
+ s.getEngine().getCaps().textureLOD && (n.LODBASEDMICROSFURACE = !0), this._albedoTexture && ht.a.DiffuseTextureEnabled ? (tt.a.PrepareDefinesForMergedUV(this._albedoTexture, n, "ALBEDO"), n.GAMMAALBEDO = this._albedoTexture.gammaSpace) : n.ALBEDO = !1, this._ambientTexture && ht.a.AmbientTextureEnabled ? (tt.a.PrepareDefinesForMergedUV(this._ambientTexture, n, "AMBIENT"), n.AMBIENTINGRAYSCALE = this._useAmbientInGrayScale) : n.AMBIENT = !1, this._opacityTexture && ht.a.OpacityTextureEnabled ? (tt.a.PrepareDefinesForMergedUV(this._opacityTexture, n, "OPACITY"), n.OPACITYRGB = this._opacityTexture.getAlphaFromRGB) : n.OPACITY = !1;
+ var m = this._getReflectionTexture();
+ if (m && ht.a.ReflectionTextureEnabled) {
+ switch (n.REFLECTION = !0, n.GAMMAREFLECTION = m.gammaSpace, n.RGBDREFLECTION = m.isRGBD, n.REFLECTIONMAP_OPPOSITEZ = this.getScene().useRightHandedSystem ? !m.invertZ : m.invertZ, n.LODINREFLECTIONALPHA = m.lodLevelInAlpha, n.LINEARSPECULARREFLECTION = m.linearSpecularLOD, this.realTimeFiltering && this.realTimeFilteringQuality > 0 ? (n.NUM_SAMPLES = "" + this.realTimeFilteringQuality, p.webGLVersion > 1 && (n.NUM_SAMPLES = n.NUM_SAMPLES + "u"), n.REALTIME_FILTERING = !0) : n.REALTIME_FILTERING = !1, m.coordinatesMode === Ue.a.INVCUBIC_MODE && (n.INVERTCUBICMAP = !0), n.REFLECTIONMAP_3D = m.isCube, n.REFLECTIONMAP_CUBIC = !1, n.REFLECTIONMAP_EXPLICIT = !1, n.REFLECTIONMAP_PLANAR = !1, n.REFLECTIONMAP_PROJECTION = !1, n.REFLECTIONMAP_SKYBOX = !1, n.REFLECTIONMAP_SPHERICAL = !1, n.REFLECTIONMAP_EQUIRECTANGULAR = !1, n.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = !1, n.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = !1, m.coordinatesMode) {
+ case Ue.a.EXPLICIT_MODE:
+ n.REFLECTIONMAP_EXPLICIT = !0;
+ break;
+ case Ue.a.PLANAR_MODE:
+ n.REFLECTIONMAP_PLANAR = !0;
+ break;
+ case Ue.a.PROJECTION_MODE:
+ n.REFLECTIONMAP_PROJECTION = !0;
+ break;
+ case Ue.a.SKYBOX_MODE:
+ n.REFLECTIONMAP_SKYBOX = !0;
+ break;
+ case Ue.a.SPHERICAL_MODE:
+ n.REFLECTIONMAP_SPHERICAL = !0;
+ break;
+ case Ue.a.EQUIRECTANGULAR_MODE:
+ n.REFLECTIONMAP_EQUIRECTANGULAR = !0;
+ break;
+ case Ue.a.FIXED_EQUIRECTANGULAR_MODE:
+ n.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = !0;
+ break;
+ case Ue.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:
+ n.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = !0;
+ break;
+ case Ue.a.CUBIC_MODE:
+ case Ue.a.INVCUBIC_MODE:
+ default:
+ n.REFLECTIONMAP_CUBIC = !0, n.USE_LOCAL_REFLECTIONMAP_CUBIC = !!m.boundingBoxSize;
+ }
+ m.coordinatesMode !== Ue.a.SKYBOX_MODE && (m.irradianceTexture ? (n.USEIRRADIANCEMAP = !0, n.USESPHERICALFROMREFLECTIONMAP = !1) : m.isCube && (n.USESPHERICALFROMREFLECTIONMAP = !0, n.USEIRRADIANCEMAP = !1, this._forceIrradianceInFragment || this.realTimeFiltering || s.getEngine().getCaps().maxVaryingVectors <= 8 ? n.USESPHERICALINVERTEX = !1 : n.USESPHERICALINVERTEX = !0));
+ } else
+ n.REFLECTION = !1, n.REFLECTIONMAP_3D = !1, n.REFLECTIONMAP_SPHERICAL = !1, n.REFLECTIONMAP_PLANAR = !1, n.REFLECTIONMAP_CUBIC = !1, n.USE_LOCAL_REFLECTIONMAP_CUBIC = !1, n.REFLECTIONMAP_PROJECTION = !1, n.REFLECTIONMAP_SKYBOX = !1, n.REFLECTIONMAP_EXPLICIT = !1, n.REFLECTIONMAP_EQUIRECTANGULAR = !1, n.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = !1, n.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = !1, n.INVERTCUBICMAP = !1, n.USESPHERICALFROMREFLECTIONMAP = !1, n.USEIRRADIANCEMAP = !1, n.USESPHERICALINVERTEX = !1, n.REFLECTIONMAP_OPPOSITEZ = !1, n.LODINREFLECTIONALPHA = !1, n.GAMMAREFLECTION = !1, n.RGBDREFLECTION = !1, n.LINEARSPECULARREFLECTION = !1;
+ this._lightmapTexture && ht.a.LightmapTextureEnabled ? (tt.a.PrepareDefinesForMergedUV(this._lightmapTexture, n, "LIGHTMAP"), n.USELIGHTMAPASSHADOWMAP = this._useLightmapAsShadowmap, n.GAMMALIGHTMAP = this._lightmapTexture.gammaSpace, n.RGBDLIGHTMAP = this._lightmapTexture.isRGBD) : n.LIGHTMAP = !1, this._emissiveTexture && ht.a.EmissiveTextureEnabled ? tt.a.PrepareDefinesForMergedUV(this._emissiveTexture, n, "EMISSIVE") : n.EMISSIVE = !1, ht.a.SpecularTextureEnabled ? (this._metallicTexture ? (tt.a.PrepareDefinesForMergedUV(this._metallicTexture, n, "REFLECTIVITY"), n.ROUGHNESSSTOREINMETALMAPALPHA = this._useRoughnessFromMetallicTextureAlpha, n.ROUGHNESSSTOREINMETALMAPGREEN = !this._useRoughnessFromMetallicTextureAlpha && this._useRoughnessFromMetallicTextureGreen, n.METALLNESSSTOREINMETALMAPBLUE = this._useMetallnessFromMetallicTextureBlue, n.AOSTOREINMETALMAPRED = this._useAmbientOcclusionFromMetallicTextureRed) : this._reflectivityTexture ? (tt.a.PrepareDefinesForMergedUV(this._reflectivityTexture, n, "REFLECTIVITY"), n.MICROSURFACEFROMREFLECTIVITYMAP = this._useMicroSurfaceFromReflectivityMapAlpha, n.MICROSURFACEAUTOMATIC = this._useAutoMicroSurfaceFromReflectivityMap) : n.REFLECTIVITY = !1, this._metallicReflectanceTexture ? tt.a.PrepareDefinesForMergedUV(this._metallicReflectanceTexture, n, "METALLIC_REFLECTANCE") : n.METALLIC_REFLECTANCE = !1, this._microSurfaceTexture ? tt.a.PrepareDefinesForMergedUV(this._microSurfaceTexture, n, "MICROSURFACEMAP") : n.MICROSURFACEMAP = !1) : (n.REFLECTIVITY = !1, n.MICROSURFACEMAP = !1), s.getEngine().getCaps().standardDerivatives && this._bumpTexture && ht.a.BumpTextureEnabled && !this._disableBumpMap ? (tt.a.PrepareDefinesForMergedUV(this._bumpTexture, n, "BUMP"), this._useParallax && this._albedoTexture && ht.a.DiffuseTextureEnabled ? (n.PARALLAX = !0, n.PARALLAXOCCLUSION = !!this._useParallaxOcclusion) : n.PARALLAX = !1, n.OBJECTSPACE_NORMALMAP = this._useObjectSpaceNormalMap) : n.BUMP = !1, this._environmentBRDFTexture && ht.a.ReflectionTextureEnabled ? (n.ENVIRONMENTBRDF = !0, n.ENVIRONMENTBRDF_RGBD = this._environmentBRDFTexture.isRGBD) : (n.ENVIRONMENTBRDF = !1, n.ENVIRONMENTBRDF_RGBD = !1), this._shouldUseAlphaFromAlbedoTexture() ? n.ALPHAFROMALBEDO = !0 : n.ALPHAFROMALBEDO = !1;
+ }
+ n.SPECULAROVERALPHA = this._useSpecularOverAlpha, this._lightFalloff === t.LIGHTFALLOFF_STANDARD ? (n.USEPHYSICALLIGHTFALLOFF = !1, n.USEGLTFLIGHTFALLOFF = !1) : this._lightFalloff === t.LIGHTFALLOFF_GLTF ? (n.USEPHYSICALLIGHTFALLOFF = !1, n.USEGLTFLIGHTFALLOFF = !0) : (n.USEPHYSICALLIGHTFALLOFF = !0, n.USEGLTFLIGHTFALLOFF = !1), n.RADIANCEOVERALPHA = this._useRadianceOverAlpha, !this.backFaceCulling && this._twoSidedLighting ? n.TWOSIDEDLIGHTING = !0 : n.TWOSIDEDLIGHTING = !1, n.SPECULARAA = s.getEngine().getCaps().standardDerivatives && this._enableSpecularAntiAliasing;
+ }
+ (n._areTexturesDirty || n._areMiscDirty) && (n.ALPHATESTVALUE = this._alphaCutOff + (this._alphaCutOff % 1 == 0 ? "." : ""), n.PREMULTIPLYALPHA = this.alphaMode === d.a.ALPHA_PREMULTIPLIED || this.alphaMode === d.a.ALPHA_PREMULTIPLIED_PORTERDUFF, n.ALPHABLEND = this.needAlphaBlendingForMesh(e), n.ALPHAFRESNEL = this._useAlphaFresnel || this._useLinearAlphaFresnel, n.LINEARALPHAFRESNEL = this._useLinearAlphaFresnel), n._areImageProcessingDirty && this._imageProcessingConfiguration && this._imageProcessingConfiguration.prepareDefines(n), n.FORCENORMALFORWARD = this._forceNormalForward, n.RADIANCEOCCLUSION = this._useRadianceOcclusion, n.HORIZONOCCLUSION = this._useHorizonOcclusion, n._areMiscDirty && (tt.a.PrepareDefinesForMisc(e, s, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(e) || this._forceAlphaTest, n), n.UNLIT = this._unlit || (this.pointsCloud || this.wireframe) && !e.isVerticesDataPresent(De.b.NormalKind), n.DEBUGMODE = this._debugMode), this.detailMap.prepareDefines(n, s), this.subSurface.prepareDefines(n, s), this.clearCoat.prepareDefines(n, s), this.anisotropy.prepareDefines(n, e, s), this.brdf.prepareDefines(n), this.sheen.prepareDefines(n, s), tt.a.PrepareDefinesForFrameBoundValues(s, p, n, !!i, o, a), tt.a.PrepareDefinesForAttributes(e, n, !0, !0, !0, this._transparencyMode !== t.PBRMATERIAL_OPAQUE);
+ }, t.prototype.forceCompilation = function(e, n, i) {
+ var o = this, a = Object(u.a)({ clipPlane: !1, useInstances: !1 }, i), s = new Bl(), p = this._prepareEffect(e, s, void 0, void 0, a.useInstances, a.clipPlane, e.hasThinInstances);
+ this._onEffectCreatedObservable && (Ro.effect = p, Ro.subMesh = null, this._onEffectCreatedObservable.notifyObservers(Ro)), p.isReady() ? n && n(this) : p.onCompileObservable.add(function() {
+ n && n(o);
+ });
+ }, t.prototype.buildUniformLayout = function() {
+ var e = this._uniformBuffer;
+ e.addUniform("vAlbedoInfos", 2), e.addUniform("vAmbientInfos", 4), e.addUniform("vOpacityInfos", 2), e.addUniform("vEmissiveInfos", 2), e.addUniform("vLightmapInfos", 2), e.addUniform("vReflectivityInfos", 3), e.addUniform("vMicroSurfaceSamplerInfos", 2), e.addUniform("vReflectionInfos", 2), e.addUniform("vReflectionFilteringInfo", 2), e.addUniform("vReflectionPosition", 3), e.addUniform("vReflectionSize", 3), e.addUniform("vBumpInfos", 3), e.addUniform("albedoMatrix", 16), e.addUniform("ambientMatrix", 16), e.addUniform("opacityMatrix", 16), e.addUniform("emissiveMatrix", 16), e.addUniform("lightmapMatrix", 16), e.addUniform("reflectivityMatrix", 16), e.addUniform("microSurfaceSamplerMatrix", 16), e.addUniform("bumpMatrix", 16), e.addUniform("vTangentSpaceParams", 2), e.addUniform("reflectionMatrix", 16), e.addUniform("vReflectionColor", 3), e.addUniform("vAlbedoColor", 4), e.addUniform("vLightingIntensity", 4), e.addUniform("vReflectionMicrosurfaceInfos", 3), e.addUniform("pointSize", 1), e.addUniform("vReflectivityColor", 4), e.addUniform("vEmissiveColor", 3), e.addUniform("visibility", 1), e.addUniform("vMetallicReflectanceFactors", 4), e.addUniform("vMetallicReflectanceInfos", 2), e.addUniform("metallicReflectanceMatrix", 16), Co.PrepareUniformBuffer(e), xo.PrepareUniformBuffer(e), Aa.PrepareUniformBuffer(e), Pa.PrepareUniformBuffer(e), ws.a.PrepareUniformBuffer(e), e.create();
+ }, t.prototype.unbind = function() {
+ if (this._activeEffect) {
+ var e = !1;
+ this._reflectionTexture && this._reflectionTexture.isRenderTarget && (this._activeEffect.setTexture("reflection2DSampler", null), e = !0), this.subSurface.unbind(this._activeEffect) && (e = !0), e && this._markAllSubMeshesAsTexturesDirty();
+ }
+ r.prototype.unbind.call(this);
+ }, t.prototype.bindForSubMesh = function(e, n, i) {
+ var o = this.getScene(), a = i._materialDefines;
+ if (a) {
+ var s = i.effect;
+ if (s) {
+ this._activeEffect = s, a.INSTANCES && !a.THIN_INSTANCES || this.bindOnlyWorldMatrix(e), this.prePassConfiguration.bindForSubMesh(this._activeEffect, o, n, e, this.isFrozen), a.OBJECTSPACE_NORMALMAP && (e.toNormalMatrix(this._normalMatrix), this.bindOnlyNormalMatrix(this._normalMatrix));
+ var p = this._mustRebind(o, s, n.visibility);
+ tt.a.BindBonesParameters(n, this._activeEffect, this.prePassConfiguration);
+ var m = null, S = this._uniformBuffer;
+ if (p) {
+ var O = o.getEngine();
+ if (S.bindToEffect(s, "Material"), this.bindViewProjection(s), m = this._getReflectionTexture(), !S.useUbo || !this.isFrozen || !S.isSync) {
+ if (o.texturesEnabled) {
+ if (this._albedoTexture && ht.a.DiffuseTextureEnabled && (S.updateFloat2("vAlbedoInfos", this._albedoTexture.coordinatesIndex, this._albedoTexture.level), tt.a.BindTextureMatrix(this._albedoTexture, S, "albedo")), this._ambientTexture && ht.a.AmbientTextureEnabled && (S.updateFloat4("vAmbientInfos", this._ambientTexture.coordinatesIndex, this._ambientTexture.level, this._ambientTextureStrength, this._ambientTextureImpactOnAnalyticalLights), tt.a.BindTextureMatrix(this._ambientTexture, S, "ambient")), this._opacityTexture && ht.a.OpacityTextureEnabled && (S.updateFloat2("vOpacityInfos", this._opacityTexture.coordinatesIndex, this._opacityTexture.level), tt.a.BindTextureMatrix(this._opacityTexture, S, "opacity")), m && ht.a.ReflectionTextureEnabled) {
+ if (S.updateMatrix("reflectionMatrix", m.getReflectionTextureMatrix()), S.updateFloat2("vReflectionInfos", m.level, 0), m.boundingBoxSize) {
+ var I = m;
+ S.updateVector3("vReflectionPosition", I.boundingBoxPosition), S.updateVector3("vReflectionSize", I.boundingBoxSize);
+ }
+ if (this.realTimeFiltering) {
+ var G = m.getSize().width;
+ S.updateFloat2("vReflectionFilteringInfo", G, ee.a.Log2(G));
+ }
+ if (!a.USEIRRADIANCEMAP) {
+ var k = m.sphericalPolynomial;
+ if (a.USESPHERICALFROMREFLECTIONMAP && k)
+ if (a.SPHERICAL_HARMONICS) {
+ var K = k.preScaledHarmonics;
+ this._activeEffect.setVector3("vSphericalL00", K.l00), this._activeEffect.setVector3("vSphericalL1_1", K.l1_1), this._activeEffect.setVector3("vSphericalL10", K.l10), this._activeEffect.setVector3("vSphericalL11", K.l11), this._activeEffect.setVector3("vSphericalL2_2", K.l2_2), this._activeEffect.setVector3("vSphericalL2_1", K.l2_1), this._activeEffect.setVector3("vSphericalL20", K.l20), this._activeEffect.setVector3("vSphericalL21", K.l21), this._activeEffect.setVector3("vSphericalL22", K.l22);
+ } else
+ this._activeEffect.setFloat3("vSphericalX", k.x.x, k.x.y, k.x.z), this._activeEffect.setFloat3("vSphericalY", k.y.x, k.y.y, k.y.z), this._activeEffect.setFloat3("vSphericalZ", k.z.x, k.z.y, k.z.z), this._activeEffect.setFloat3("vSphericalXX_ZZ", k.xx.x - k.zz.x, k.xx.y - k.zz.y, k.xx.z - k.zz.z), this._activeEffect.setFloat3("vSphericalYY_ZZ", k.yy.x - k.zz.x, k.yy.y - k.zz.y, k.yy.z - k.zz.z), this._activeEffect.setFloat3("vSphericalZZ", k.zz.x, k.zz.y, k.zz.z), this._activeEffect.setFloat3("vSphericalXY", k.xy.x, k.xy.y, k.xy.z), this._activeEffect.setFloat3("vSphericalYZ", k.yz.x, k.yz.y, k.yz.z), this._activeEffect.setFloat3("vSphericalZX", k.zx.x, k.zx.y, k.zx.z);
+ }
+ S.updateFloat3("vReflectionMicrosurfaceInfos", m.getSize().width, m.lodGenerationScale, m.lodGenerationOffset);
+ }
+ this._emissiveTexture && ht.a.EmissiveTextureEnabled && (S.updateFloat2("vEmissiveInfos", this._emissiveTexture.coordinatesIndex, this._emissiveTexture.level), tt.a.BindTextureMatrix(this._emissiveTexture, S, "emissive")), this._lightmapTexture && ht.a.LightmapTextureEnabled && (S.updateFloat2("vLightmapInfos", this._lightmapTexture.coordinatesIndex, this._lightmapTexture.level), tt.a.BindTextureMatrix(this._lightmapTexture, S, "lightmap")), ht.a.SpecularTextureEnabled && (this._metallicTexture ? (S.updateFloat3("vReflectivityInfos", this._metallicTexture.coordinatesIndex, this._metallicTexture.level, this._ambientTextureStrength), tt.a.BindTextureMatrix(this._metallicTexture, S, "reflectivity")) : this._reflectivityTexture && (S.updateFloat3("vReflectivityInfos", this._reflectivityTexture.coordinatesIndex, this._reflectivityTexture.level, 1), tt.a.BindTextureMatrix(this._reflectivityTexture, S, "reflectivity")), this._metallicReflectanceTexture && (S.updateFloat2("vMetallicReflectanceInfos", this._metallicReflectanceTexture.coordinatesIndex, this._metallicReflectanceTexture.level), tt.a.BindTextureMatrix(this._metallicReflectanceTexture, S, "metallicReflectance")), this._microSurfaceTexture && (S.updateFloat2("vMicroSurfaceSamplerInfos", this._microSurfaceTexture.coordinatesIndex, this._microSurfaceTexture.level), tt.a.BindTextureMatrix(this._microSurfaceTexture, S, "microSurfaceSampler"))), this._bumpTexture && O.getCaps().standardDerivatives && ht.a.BumpTextureEnabled && !this._disableBumpMap && (S.updateFloat3("vBumpInfos", this._bumpTexture.coordinatesIndex, this._bumpTexture.level, this._parallaxScaleBias), tt.a.BindTextureMatrix(this._bumpTexture, S, "bump"), o._mirroredCameraPosition ? S.updateFloat2("vTangentSpaceParams", this._invertNormalMapX ? 1 : -1, this._invertNormalMapY ? 1 : -1) : S.updateFloat2("vTangentSpaceParams", this._invertNormalMapX ? -1 : 1, this._invertNormalMapY ? -1 : 1));
+ }
+ if (this.pointsCloud && S.updateFloat("pointSize", this.pointSize), a.METALLICWORKFLOW) {
+ C.c.Color3[0].r = this._metallic === void 0 || this._metallic === null ? 1 : this._metallic, C.c.Color3[0].g = this._roughness === void 0 || this._roughness === null ? 1 : this._roughness, S.updateColor4("vReflectivityColor", C.c.Color3[0], 1);
+ var re = this.subSurface.indexOfRefraction, se = Math.pow((re - 1) / (re + 1), 2);
+ this._metallicReflectanceColor.scaleToRef(se * this._metallicF0Factor, C.c.Color3[0]);
+ var ue = this._metallicF0Factor;
+ S.updateColor4("vMetallicReflectanceFactors", C.c.Color3[0], ue);
+ } else
+ S.updateColor4("vReflectivityColor", this._reflectivityColor, this._microSurface);
+ S.updateColor3("vEmissiveColor", ht.a.EmissiveTextureEnabled ? this._emissiveColor : C.a.BlackReadOnly), S.updateColor3("vReflectionColor", this._reflectionColor), !a.SS_REFRACTION && this.subSurface.linkRefractionWithTransparency ? S.updateColor4("vAlbedoColor", this._albedoColor, 1) : S.updateColor4("vAlbedoColor", this._albedoColor, this.alpha), this._lightingInfos.x = this._directIntensity, this._lightingInfos.y = this._emissiveIntensity, this._lightingInfos.z = this._environmentIntensity * o.environmentIntensity, this._lightingInfos.w = this._specularIntensity, S.updateVector4("vLightingIntensity", this._lightingInfos);
+ }
+ S.updateFloat("visibility", n.visibility), o.texturesEnabled && (this._albedoTexture && ht.a.DiffuseTextureEnabled && S.setTexture("albedoSampler", this._albedoTexture), this._ambientTexture && ht.a.AmbientTextureEnabled && S.setTexture("ambientSampler", this._ambientTexture), this._opacityTexture && ht.a.OpacityTextureEnabled && S.setTexture("opacitySampler", this._opacityTexture), m && ht.a.ReflectionTextureEnabled && (a.LODBASEDMICROSFURACE ? S.setTexture("reflectionSampler", m) : (S.setTexture("reflectionSampler", m._lodTextureMid || m), S.setTexture("reflectionSamplerLow", m._lodTextureLow || m), S.setTexture("reflectionSamplerHigh", m._lodTextureHigh || m)), a.USEIRRADIANCEMAP && S.setTexture("irradianceSampler", m.irradianceTexture)), a.ENVIRONMENTBRDF && S.setTexture("environmentBrdfSampler", this._environmentBRDFTexture), this._emissiveTexture && ht.a.EmissiveTextureEnabled && S.setTexture("emissiveSampler", this._emissiveTexture), this._lightmapTexture && ht.a.LightmapTextureEnabled && S.setTexture("lightmapSampler", this._lightmapTexture), ht.a.SpecularTextureEnabled && (this._metallicTexture ? S.setTexture("reflectivitySampler", this._metallicTexture) : this._reflectivityTexture && S.setTexture("reflectivitySampler", this._reflectivityTexture), this._metallicReflectanceTexture && S.setTexture("metallicReflectanceSampler", this._metallicReflectanceTexture), this._microSurfaceTexture && S.setTexture("microSurfaceSampler", this._microSurfaceTexture)), this._bumpTexture && O.getCaps().standardDerivatives && ht.a.BumpTextureEnabled && !this._disableBumpMap && S.setTexture("bumpSampler", this._bumpTexture)), this.detailMap.bindForSubMesh(S, o, this.isFrozen), this.subSurface.bindForSubMesh(S, o, O, this.isFrozen, a.LODBASEDMICROSFURACE, this.realTimeFiltering), this.clearCoat.bindForSubMesh(S, o, O, this._disableBumpMap, this.isFrozen, this._invertNormalMapX, this._invertNormalMapY, i), this.anisotropy.bindForSubMesh(S, o, this.isFrozen), this.sheen.bindForSubMesh(S, o, this.isFrozen, i), tt.a.BindClipPlane(this._activeEffect, o), o.ambientColor.multiplyToRef(this._ambientColor, this._globalAmbientColor);
+ var he = o._forcedViewPosition ? o._forcedViewPosition : o._mirroredCameraPosition ? o._mirroredCameraPosition : o.activeCamera.globalPosition, pe = o.useRightHandedSystem === (o._mirroredCameraPosition != null);
+ s.setFloat4("vEyePosition", he.x, he.y, he.z, pe ? -1 : 1), s.setColor3("vAmbientColor", this._globalAmbientColor), s.setFloat2("vDebugMode", this.debugLimit, this.debugFactor);
+ }
+ !p && this.isFrozen || (o.lightsEnabled && !this._disableLighting && tt.a.BindLights(o, n, this._activeEffect, a, this._maxSimultaneousLights, this._rebuildInParallel), (o.fogEnabled && n.applyFog && o.fogMode !== ge.a.FOGMODE_NONE || m) && this.bindView(s), tt.a.BindFogParameters(o, n, this._activeEffect, !0), a.NUM_MORPH_INFLUENCERS && tt.a.BindMorphTargetParameters(n, this._activeEffect), this._imageProcessingConfiguration.bind(this._activeEffect), tt.a.BindLogDepth(a, this._activeEffect, o)), S.update(), this._afterBind(n, this._activeEffect);
+ }
+ }
+ }, t.prototype.getAnimatables = function() {
+ var e = [];
+ return this._albedoTexture && this._albedoTexture.animations && this._albedoTexture.animations.length > 0 && e.push(this._albedoTexture), this._ambientTexture && this._ambientTexture.animations && this._ambientTexture.animations.length > 0 && e.push(this._ambientTexture), this._opacityTexture && this._opacityTexture.animations && this._opacityTexture.animations.length > 0 && e.push(this._opacityTexture), this._reflectionTexture && this._reflectionTexture.animations && this._reflectionTexture.animations.length > 0 && e.push(this._reflectionTexture), this._emissiveTexture && this._emissiveTexture.animations && this._emissiveTexture.animations.length > 0 && e.push(this._emissiveTexture), this._metallicTexture && this._metallicTexture.animations && this._metallicTexture.animations.length > 0 ? e.push(this._metallicTexture) : this._reflectivityTexture && this._reflectivityTexture.animations && this._reflectivityTexture.animations.length > 0 && e.push(this._reflectivityTexture), this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0 && e.push(this._bumpTexture), this._lightmapTexture && this._lightmapTexture.animations && this._lightmapTexture.animations.length > 0 && e.push(this._lightmapTexture), this.detailMap.getAnimatables(e), this.subSurface.getAnimatables(e), this.clearCoat.getAnimatables(e), this.sheen.getAnimatables(e), this.anisotropy.getAnimatables(e), e;
+ }, t.prototype._getReflectionTexture = function() {
+ return this._reflectionTexture ? this._reflectionTexture : this.getScene().environmentTexture;
+ }, t.prototype.getActiveTextures = function() {
+ var e = r.prototype.getActiveTextures.call(this);
+ return this._albedoTexture && e.push(this._albedoTexture), this._ambientTexture && e.push(this._ambientTexture), this._opacityTexture && e.push(this._opacityTexture), this._reflectionTexture && e.push(this._reflectionTexture), this._emissiveTexture && e.push(this._emissiveTexture), this._reflectivityTexture && e.push(this._reflectivityTexture), this._metallicTexture && e.push(this._metallicTexture), this._metallicReflectanceTexture && e.push(this._metallicReflectanceTexture), this._microSurfaceTexture && e.push(this._microSurfaceTexture), this._bumpTexture && e.push(this._bumpTexture), this._lightmapTexture && e.push(this._lightmapTexture), this.detailMap.getActiveTextures(e), this.subSurface.getActiveTextures(e), this.clearCoat.getActiveTextures(e), this.sheen.getActiveTextures(e), this.anisotropy.getActiveTextures(e), e;
+ }, t.prototype.hasTexture = function(e) {
+ return !!r.prototype.hasTexture.call(this, e) || this._albedoTexture === e || this._ambientTexture === e || this._opacityTexture === e || this._reflectionTexture === e || this._reflectivityTexture === e || this._metallicTexture === e || this._metallicReflectanceTexture === e || this._microSurfaceTexture === e || this._bumpTexture === e || this._lightmapTexture === e || this.detailMap.hasTexture(e) || this.subSurface.hasTexture(e) || this.clearCoat.hasTexture(e) || this.sheen.hasTexture(e) || this.anisotropy.hasTexture(e);
+ }, t.prototype.setPrePassRenderer = function(e) {
+ if (this.subSurface.isScatteringEnabled) {
+ var n = this.getScene().enableSubSurfaceForPrePass();
+ return n && (n.enabled = !0), !0;
+ }
+ return !1;
+ }, t.prototype.dispose = function(e, n) {
+ var i, o, a, s, p, m, S, O, I, G, k;
+ n && (this._environmentBRDFTexture && this.getScene().environmentBRDFTexture !== this._environmentBRDFTexture && this._environmentBRDFTexture.dispose(), (i = this._albedoTexture) === null || i === void 0 || i.dispose(), (o = this._ambientTexture) === null || o === void 0 || o.dispose(), (a = this._opacityTexture) === null || a === void 0 || a.dispose(), (s = this._reflectionTexture) === null || s === void 0 || s.dispose(), (p = this._emissiveTexture) === null || p === void 0 || p.dispose(), (m = this._metallicTexture) === null || m === void 0 || m.dispose(), (S = this._reflectivityTexture) === null || S === void 0 || S.dispose(), (O = this._bumpTexture) === null || O === void 0 || O.dispose(), (I = this._lightmapTexture) === null || I === void 0 || I.dispose(), (G = this._metallicReflectanceTexture) === null || G === void 0 || G.dispose(), (k = this._microSurfaceTexture) === null || k === void 0 || k.dispose()), this.detailMap.dispose(n), this.subSurface.dispose(n), this.clearCoat.dispose(n), this.sheen.dispose(n), this.anisotropy.dispose(n), this._renderTargets.dispose(), this._imageProcessingConfiguration && this._imageProcessingObserver && this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver), r.prototype.dispose.call(this, e, n);
+ }, t.PBRMATERIAL_OPAQUE = Zt.a.MATERIAL_OPAQUE, t.PBRMATERIAL_ALPHATEST = Zt.a.MATERIAL_ALPHATEST, t.PBRMATERIAL_ALPHABLEND = Zt.a.MATERIAL_ALPHABLEND, t.PBRMATERIAL_ALPHATESTANDBLEND = Zt.a.MATERIAL_ALPHATESTANDBLEND, t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS = 0, t.LIGHTFALLOFF_PHYSICAL = 0, t.LIGHTFALLOFF_GLTF = 1, t.LIGHTFALLOFF_STANDARD = 2, Object(u.c)([Object(w.i)()], t.prototype, "_imageProcessingConfiguration", void 0), Object(u.c)([Object(w.b)("_markAllSubMeshesAsMiscDirty")], t.prototype, "debugMode", void 0), Object(u.c)([Object(w.c)()], t.prototype, "useLogarithmicDepth", null), t;
+ }(Ds.a), Ca = function(r) {
+ function t(e, n) {
+ var i = r.call(this, e, n) || this;
+ return i.directIntensity = 1, i.emissiveIntensity = 1, i.environmentIntensity = 1, i.specularIntensity = 1, i.disableBumpMap = !1, i.ambientTextureStrength = 1, i.ambientTextureImpactOnAnalyticalLights = t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS, i.metallicF0Factor = 1, i.metallicReflectanceColor = C.a.White(), i.ambientColor = new C.a(0, 0, 0), i.albedoColor = new C.a(1, 1, 1), i.reflectivityColor = new C.a(1, 1, 1), i.reflectionColor = new C.a(1, 1, 1), i.emissiveColor = new C.a(0, 0, 0), i.microSurface = 1, i.useLightmapAsShadowmap = !1, i.useAlphaFromAlbedoTexture = !1, i.forceAlphaTest = !1, i.alphaCutOff = 0.4, i.useSpecularOverAlpha = !0, i.useMicroSurfaceFromReflectivityMapAlpha = !1, i.useRoughnessFromMetallicTextureAlpha = !0, i.useRoughnessFromMetallicTextureGreen = !1, i.useMetallnessFromMetallicTextureBlue = !1, i.useAmbientOcclusionFromMetallicTextureRed = !1, i.useAmbientInGrayScale = !1, i.useAutoMicroSurfaceFromReflectivityMap = !1, i.useRadianceOverAlpha = !0, i.useObjectSpaceNormalMap = !1, i.useParallax = !1, i.useParallaxOcclusion = !1, i.parallaxScaleBias = 0.05, i.disableLighting = !1, i.forceIrradianceInFragment = !1, i.maxSimultaneousLights = 4, i.invertNormalMapX = !1, i.invertNormalMapY = !1, i.twoSidedLighting = !1, i.useAlphaFresnel = !1, i.useLinearAlphaFresnel = !1, i.environmentBRDFTexture = null, i.forceNormalForward = !1, i.enableSpecularAntiAliasing = !1, i.useHorizonOcclusion = !0, i.useRadianceOcclusion = !0, i.unlit = !1, i._environmentBRDFTexture = Ls.GetEnvironmentBRDFTexture(n), i;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "refractionTexture", { get: function() {
+ return this.subSurface.refractionTexture;
+ }, set: function(e) {
+ this.subSurface.refractionTexture = e, e ? this.subSurface.isRefractionEnabled = !0 : this.subSurface.linkRefractionWithTransparency || (this.subSurface.isRefractionEnabled = !1);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "indexOfRefraction", { get: function() {
+ return this.subSurface.indexOfRefraction;
+ }, set: function(e) {
+ this.subSurface.indexOfRefraction = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "invertRefractionY", { get: function() {
+ return this.subSurface.invertRefractionY;
+ }, set: function(e) {
+ this.subSurface.invertRefractionY = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "linkRefractionWithTransparency", { get: function() {
+ return this.subSurface.linkRefractionWithTransparency;
+ }, set: function(e) {
+ this.subSurface.linkRefractionWithTransparency = e, e && (this.subSurface.isRefractionEnabled = !0);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "usePhysicalLightFalloff", { get: function() {
+ return this._lightFalloff === Cn.LIGHTFALLOFF_PHYSICAL;
+ }, set: function(e) {
+ e !== this.usePhysicalLightFalloff && (this._markAllSubMeshesAsTexturesDirty(), this._lightFalloff = e ? Cn.LIGHTFALLOFF_PHYSICAL : Cn.LIGHTFALLOFF_STANDARD);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "useGLTFLightFalloff", { get: function() {
+ return this._lightFalloff === Cn.LIGHTFALLOFF_GLTF;
+ }, set: function(e) {
+ e !== this.useGLTFLightFalloff && (this._markAllSubMeshesAsTexturesDirty(), this._lightFalloff = e ? Cn.LIGHTFALLOFF_GLTF : Cn.LIGHTFALLOFF_STANDARD);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "imageProcessingConfiguration", { get: function() {
+ return this._imageProcessingConfiguration;
+ }, set: function(e) {
+ this._attachImageProcessingConfiguration(e), this._markAllSubMeshesAsTexturesDirty();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "cameraColorCurvesEnabled", { get: function() {
+ return this.imageProcessingConfiguration.colorCurvesEnabled;
+ }, set: function(e) {
+ this.imageProcessingConfiguration.colorCurvesEnabled = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "cameraColorGradingEnabled", { get: function() {
+ return this.imageProcessingConfiguration.colorGradingEnabled;
+ }, set: function(e) {
+ this.imageProcessingConfiguration.colorGradingEnabled = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "cameraToneMappingEnabled", { get: function() {
+ return this._imageProcessingConfiguration.toneMappingEnabled;
+ }, set: function(e) {
+ this._imageProcessingConfiguration.toneMappingEnabled = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "cameraExposure", { get: function() {
+ return this._imageProcessingConfiguration.exposure;
+ }, set: function(e) {
+ this._imageProcessingConfiguration.exposure = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "cameraContrast", { get: function() {
+ return this._imageProcessingConfiguration.contrast;
+ }, set: function(e) {
+ this._imageProcessingConfiguration.contrast = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "cameraColorGradingTexture", { get: function() {
+ return this._imageProcessingConfiguration.colorGradingTexture;
+ }, set: function(e) {
+ this._imageProcessingConfiguration.colorGradingTexture = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "cameraColorCurves", { get: function() {
+ return this._imageProcessingConfiguration.colorCurves;
+ }, set: function(e) {
+ this._imageProcessingConfiguration.colorCurves = e;
+ }, enumerable: !1, configurable: !0 }), t.prototype.getClassName = function() {
+ return "PBRMaterial";
+ }, t.prototype.clone = function(e) {
+ var n = this, i = w.a.Clone(function() {
+ return new t(e, n.getScene());
+ }, this);
+ return i.id = e, i.name = e, this.clearCoat.copyTo(i.clearCoat), this.anisotropy.copyTo(i.anisotropy), this.brdf.copyTo(i.brdf), this.sheen.copyTo(i.sheen), this.subSurface.copyTo(i.subSurface), i;
+ }, t.prototype.serialize = function() {
+ var e = w.a.Serialize(this);
+ return e.customType = "BABYLON.PBRMaterial", e.clearCoat = this.clearCoat.serialize(), e.anisotropy = this.anisotropy.serialize(), e.brdf = this.brdf.serialize(), e.sheen = this.sheen.serialize(), e.subSurface = this.subSurface.serialize(), e;
+ }, t.Parse = function(e, n, i) {
+ var o = w.a.Parse(function() {
+ return new t(e.name, n);
+ }, e, n, i);
+ return e.clearCoat && o.clearCoat.parse(e.clearCoat, n, i), e.anisotropy && o.anisotropy.parse(e.anisotropy, n, i), e.brdf && o.brdf.parse(e.brdf, n, i), e.sheen && o.sheen.parse(e.sheen, n, i), e.subSurface && o.subSurface.parse(e.subSurface, n, i), o;
+ }, t.PBRMATERIAL_OPAQUE = Cn.PBRMATERIAL_OPAQUE, t.PBRMATERIAL_ALPHATEST = Cn.PBRMATERIAL_ALPHATEST, t.PBRMATERIAL_ALPHABLEND = Cn.PBRMATERIAL_ALPHABLEND, t.PBRMATERIAL_ALPHATESTANDBLEND = Cn.PBRMATERIAL_ALPHATESTANDBLEND, t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS = Cn.DEFAULT_AO_ON_ANALYTICAL_LIGHTS, Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "directIntensity", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "emissiveIntensity", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "environmentIntensity", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "specularIntensity", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "disableBumpMap", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "albedoTexture", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "ambientTexture", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "ambientTextureStrength", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "ambientTextureImpactOnAnalyticalLights", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesAndMiscDirty")], t.prototype, "opacityTexture", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionTexture", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "emissiveTexture", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectivityTexture", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "metallicTexture", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "metallic", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "roughness", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "metallicF0Factor", void 0), Object(u.c)([Object(w.e)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "metallicReflectanceColor", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "metallicReflectanceTexture", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "microSurfaceTexture", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "bumpTexture", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty", null)], t.prototype, "lightmapTexture", void 0), Object(u.c)([Object(w.e)("ambient"), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "ambientColor", void 0), Object(u.c)([Object(w.e)("albedo"), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "albedoColor", void 0), Object(u.c)([Object(w.e)("reflectivity"), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectivityColor", void 0), Object(u.c)([Object(w.e)("reflection"), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionColor", void 0), Object(u.c)([Object(w.e)("emissive"), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "emissiveColor", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "microSurface", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useLightmapAsShadowmap", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesAndMiscDirty")], t.prototype, "useAlphaFromAlbedoTexture", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesAndMiscDirty")], t.prototype, "forceAlphaTest", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesAndMiscDirty")], t.prototype, "alphaCutOff", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useSpecularOverAlpha", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useMicroSurfaceFromReflectivityMapAlpha", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useRoughnessFromMetallicTextureAlpha", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useRoughnessFromMetallicTextureGreen", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useMetallnessFromMetallicTextureBlue", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useAmbientOcclusionFromMetallicTextureRed", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useAmbientInGrayScale", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useAutoMicroSurfaceFromReflectivityMap", void 0), Object(u.c)([Object(w.c)()], t.prototype, "usePhysicalLightFalloff", null), Object(u.c)([Object(w.c)()], t.prototype, "useGLTFLightFalloff", null), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useRadianceOverAlpha", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useObjectSpaceNormalMap", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useParallax", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useParallaxOcclusion", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "parallaxScaleBias", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsLightsDirty")], t.prototype, "disableLighting", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "forceIrradianceInFragment", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsLightsDirty")], t.prototype, "maxSimultaneousLights", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "invertNormalMapX", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "invertNormalMapY", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "twoSidedLighting", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useAlphaFresnel", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useLinearAlphaFresnel", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "environmentBRDFTexture", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "forceNormalForward", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "enableSpecularAntiAliasing", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useHorizonOcclusion", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useRadianceOcclusion", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsMiscDirty")], t.prototype, "unlit", void 0), t;
+ }(Cn);
+ x.a.RegisteredTypes["BABYLON.PBRMaterial"] = Ca;
+ function Ns(r) {
+ return r.charCodeAt(0) + (r.charCodeAt(1) << 8) + (r.charCodeAt(2) << 16) + (r.charCodeAt(3) << 24);
+ }
+ var _f = Ns("DXT1"), mf = Ns("DXT3"), gf = Ns("DXT5"), Ul = Ns("DX10"), yr = function() {
+ function r() {
+ }
+ return r.GetDDSInfo = function(t) {
+ var e = new Int32Array(t.buffer, t.byteOffset, 31), n = new Int32Array(t.buffer, t.byteOffset, 35), i = 1;
+ 131072 & e[2] && (i = Math.max(1, e[7]));
+ var o = e[21], a = o === Ul ? n[32] : 0, s = d.a.TEXTURETYPE_UNSIGNED_INT;
+ switch (o) {
+ case 113:
+ s = d.a.TEXTURETYPE_HALF_FLOAT;
+ break;
+ case 116:
+ s = d.a.TEXTURETYPE_FLOAT;
+ break;
+ case Ul:
+ if (a === 10) {
+ s = d.a.TEXTURETYPE_HALF_FLOAT;
+ break;
+ }
+ if (a === 2) {
+ s = d.a.TEXTURETYPE_FLOAT;
+ break;
+ }
+ }
+ return { width: e[4], height: e[3], mipmapCount: i, isFourCC: (4 & e[20]) == 4, isRGB: (64 & e[20]) == 64, isLuminance: (131072 & e[20]) == 131072, isCube: (512 & e[28]) == 512, isCompressed: o === _f || o === mf || o === gf, dxgiFormat: a, textureType: s };
+ }, r._ToHalfFloat = function(t) {
+ r._FloatView || (r._FloatView = new Float32Array(1), r._Int32View = new Int32Array(r._FloatView.buffer)), r._FloatView[0] = t;
+ var e = r._Int32View[0], n = e >> 16 & 32768, i = e >> 12 & 2047, o = e >> 23 & 255;
+ return o < 103 ? n : o > 142 ? (n |= 31744, n |= (o == 255 ? 0 : 1) && 8388607 & e) : o < 113 ? n |= ((i |= 2048) >> 114 - o) + (i >> 113 - o & 1) : (n |= o - 112 << 10 | i >> 1, n += 1 & i);
+ }, r._FromHalfFloat = function(t) {
+ var e = (32768 & t) >> 15, n = (31744 & t) >> 10, i = 1023 & t;
+ return n === 0 ? (e ? -1 : 1) * Math.pow(2, -14) * (i / Math.pow(2, 10)) : n == 31 ? i ? NaN : 1 / 0 * (e ? -1 : 1) : (e ? -1 : 1) * Math.pow(2, n - 15) * (1 + i / Math.pow(2, 10));
+ }, r._GetHalfFloatAsFloatRGBAArrayBuffer = function(t, e, n, i, o, a) {
+ for (var s = new Float32Array(i), p = new Uint16Array(o, n), m = 0, S = 0; S < e; S++)
+ for (var O = 0; O < t; O++) {
+ var I = 4 * (O + S * t);
+ s[m] = r._FromHalfFloat(p[I]), s[m + 1] = r._FromHalfFloat(p[I + 1]), s[m + 2] = r._FromHalfFloat(p[I + 2]), r.StoreLODInAlphaChannel ? s[m + 3] = a : s[m + 3] = r._FromHalfFloat(p[I + 3]), m += 4;
+ }
+ return s;
+ }, r._GetHalfFloatRGBAArrayBuffer = function(t, e, n, i, o, a) {
+ if (r.StoreLODInAlphaChannel) {
+ for (var s = new Uint16Array(i), p = new Uint16Array(o, n), m = 0, S = 0; S < e; S++)
+ for (var O = 0; O < t; O++) {
+ var I = 4 * (O + S * t);
+ s[m] = p[I], s[m + 1] = p[I + 1], s[m + 2] = p[I + 2], s[m + 3] = r._ToHalfFloat(a), m += 4;
+ }
+ return s;
+ }
+ return new Uint16Array(o, n, i);
+ }, r._GetFloatRGBAArrayBuffer = function(t, e, n, i, o, a) {
+ if (r.StoreLODInAlphaChannel) {
+ for (var s = new Float32Array(i), p = new Float32Array(o, n), m = 0, S = 0; S < e; S++)
+ for (var O = 0; O < t; O++) {
+ var I = 4 * (O + S * t);
+ s[m] = p[I], s[m + 1] = p[I + 1], s[m + 2] = p[I + 2], s[m + 3] = a, m += 4;
+ }
+ return s;
+ }
+ return new Float32Array(o, n, i);
+ }, r._GetFloatAsUIntRGBAArrayBuffer = function(t, e, n, i, o, a) {
+ for (var s = new Uint8Array(i), p = new Float32Array(o, n), m = 0, S = 0; S < e; S++)
+ for (var O = 0; O < t; O++) {
+ var I = 4 * (O + S * t);
+ s[m] = 255 * ee.a.Clamp(p[I]), s[m + 1] = 255 * ee.a.Clamp(p[I + 1]), s[m + 2] = 255 * ee.a.Clamp(p[I + 2]), r.StoreLODInAlphaChannel ? s[m + 3] = a : s[m + 3] = 255 * ee.a.Clamp(p[I + 3]), m += 4;
+ }
+ return s;
+ }, r._GetHalfFloatAsUIntRGBAArrayBuffer = function(t, e, n, i, o, a) {
+ for (var s = new Uint8Array(i), p = new Uint16Array(o, n), m = 0, S = 0; S < e; S++)
+ for (var O = 0; O < t; O++) {
+ var I = 4 * (O + S * t);
+ s[m] = 255 * ee.a.Clamp(r._FromHalfFloat(p[I])), s[m + 1] = 255 * ee.a.Clamp(r._FromHalfFloat(p[I + 1])), s[m + 2] = 255 * ee.a.Clamp(r._FromHalfFloat(p[I + 2])), r.StoreLODInAlphaChannel ? s[m + 3] = a : s[m + 3] = 255 * ee.a.Clamp(r._FromHalfFloat(p[I + 3])), m += 4;
+ }
+ return s;
+ }, r._GetRGBAArrayBuffer = function(t, e, n, i, o, a, s, p, m) {
+ for (var S = new Uint8Array(i), O = new Uint8Array(o, n), I = 0, G = 0; G < e; G++)
+ for (var k = 0; k < t; k++) {
+ var K = 4 * (k + G * t);
+ S[I] = O[K + a], S[I + 1] = O[K + s], S[I + 2] = O[K + p], S[I + 3] = O[K + m], I += 4;
+ }
+ return S;
+ }, r._ExtractLongWordOrder = function(t) {
+ return t === 0 || t === 255 || t === -16777216 ? 0 : 1 + r._ExtractLongWordOrder(t >> 8);
+ }, r._GetRGBArrayBuffer = function(t, e, n, i, o, a, s, p) {
+ for (var m = new Uint8Array(i), S = new Uint8Array(o, n), O = 0, I = 0; I < e; I++)
+ for (var G = 0; G < t; G++) {
+ var k = 3 * (G + I * t);
+ m[O] = S[k + a], m[O + 1] = S[k + s], m[O + 2] = S[k + p], O += 3;
+ }
+ return m;
+ }, r._GetLuminanceArrayBuffer = function(t, e, n, i, o) {
+ for (var a = new Uint8Array(i), s = new Uint8Array(o, n), p = 0, m = 0; m < e; m++)
+ for (var S = 0; S < t; S++) {
+ var O = S + m * t;
+ a[p] = s[O], p++;
+ }
+ return a;
+ }, r.UploadDDSLevels = function(t, e, n, i, o, a, s, p) {
+ s === void 0 && (s = -1);
+ var m = null;
+ i.sphericalPolynomial && (m = new Array());
+ var S, O, I, G, k, K, re, se = t.getCaps().s3tc, ue = new Int32Array(n.buffer, n.byteOffset, 31), he = 0, pe = 0, ve = 1;
+ if (ue[0] === 542327876)
+ if (i.isFourCC || i.isRGB || i.isLuminance)
+ if (!i.isCompressed || se) {
+ var Ee = ue[22];
+ G = ue[1] + 4;
+ var Ae, Ie = !1;
+ if (i.isFourCC)
+ switch (S = ue[21]) {
+ case _f:
+ ve = 8, pe = se.COMPRESSED_RGBA_S3TC_DXT1_EXT;
+ break;
+ case mf:
+ ve = 16, pe = se.COMPRESSED_RGBA_S3TC_DXT3_EXT;
+ break;
+ case gf:
+ ve = 16, pe = se.COMPRESSED_RGBA_S3TC_DXT5_EXT;
+ break;
+ case 113:
+ case 116:
+ Ie = !0;
+ break;
+ case Ul:
+ G += 20;
+ var xe = !1;
+ switch (i.dxgiFormat) {
+ case 10:
+ case 2:
+ Ie = !0, xe = !0;
+ break;
+ case 88:
+ i.isRGB = !0, i.isFourCC = !1, Ee = 32, xe = !0;
+ }
+ if (xe)
+ break;
+ default:
+ return void console.error("Unsupported FourCC code:", (Ae = S, String.fromCharCode(255 & Ae, Ae >> 8 & 255, Ae >> 16 & 255, Ae >> 24 & 255)));
+ }
+ var Pe = r._ExtractLongWordOrder(ue[23]), Ce = r._ExtractLongWordOrder(ue[24]), Fe = r._ExtractLongWordOrder(ue[25]), Oe = r._ExtractLongWordOrder(ue[26]);
+ Ie && (pe = t._getRGBABufferInternalSizedFormat(i.textureType)), K = 1, 131072 & ue[2] && o !== !1 && (K = Math.max(1, ue[7]));
+ for (var Be = p || 0; Be < a; Be++) {
+ for (O = ue[4], I = ue[3], re = 0; re < K; ++re) {
+ if (s === -1 || s === re) {
+ var Le = s === -1 ? re : 0;
+ if (!i.isCompressed && i.isFourCC) {
+ e.format = d.a.TEXTUREFORMAT_RGBA, he = O * I * 4;
+ var Ve = null;
+ t._badOS || t._badDesktopOS || !t.getCaps().textureHalfFloat && !t.getCaps().textureFloat ? (Ee === 128 ? (Ve = r._GetFloatAsUIntRGBAArrayBuffer(O, I, n.byteOffset + G, he, n.buffer, Le), m && Le == 0 && m.push(r._GetFloatRGBAArrayBuffer(O, I, n.byteOffset + G, he, n.buffer, Le))) : Ee === 64 && (Ve = r._GetHalfFloatAsUIntRGBAArrayBuffer(O, I, n.byteOffset + G, he, n.buffer, Le), m && Le == 0 && m.push(r._GetHalfFloatAsFloatRGBAArrayBuffer(O, I, n.byteOffset + G, he, n.buffer, Le))), e.type = d.a.TEXTURETYPE_UNSIGNED_INT) : Ee === 128 ? (e.type = d.a.TEXTURETYPE_FLOAT, Ve = r._GetFloatRGBAArrayBuffer(O, I, n.byteOffset + G, he, n.buffer, Le), m && Le == 0 && m.push(Ve)) : Ee !== 64 || t.getCaps().textureHalfFloat ? (e.type = d.a.TEXTURETYPE_HALF_FLOAT, Ve = r._GetHalfFloatRGBAArrayBuffer(O, I, n.byteOffset + G, he, n.buffer, Le), m && Le == 0 && m.push(r._GetHalfFloatAsFloatRGBAArrayBuffer(O, I, G, he, n.buffer, Le))) : (e.type = d.a.TEXTURETYPE_FLOAT, Ve = r._GetHalfFloatAsFloatRGBAArrayBuffer(O, I, n.byteOffset + G, he, n.buffer, Le), m && Le == 0 && m.push(Ve)), Ve && t._uploadDataToTextureDirectly(e, Ve, Be, Le);
+ } else if (i.isRGB)
+ e.type = d.a.TEXTURETYPE_UNSIGNED_INT, Ee === 24 ? (e.format = d.a.TEXTUREFORMAT_RGB, he = O * I * 3, k = r._GetRGBArrayBuffer(O, I, n.byteOffset + G, he, n.buffer, Pe, Ce, Fe), t._uploadDataToTextureDirectly(e, k, Be, Le)) : (e.format = d.a.TEXTUREFORMAT_RGBA, he = O * I * 4, k = r._GetRGBAArrayBuffer(O, I, n.byteOffset + G, he, n.buffer, Pe, Ce, Fe, Oe), t._uploadDataToTextureDirectly(e, k, Be, Le));
+ else if (i.isLuminance) {
+ var Qe = t._getUnpackAlignement(), nt = O;
+ he = Math.floor((O + Qe - 1) / Qe) * Qe * (I - 1) + nt, k = r._GetLuminanceArrayBuffer(O, I, n.byteOffset + G, he, n.buffer), e.format = d.a.TEXTUREFORMAT_LUMINANCE, e.type = d.a.TEXTURETYPE_UNSIGNED_INT, t._uploadDataToTextureDirectly(e, k, Be, Le);
+ } else
+ he = Math.max(4, O) / 4 * Math.max(4, I) / 4 * ve, k = new Uint8Array(n.buffer, n.byteOffset + G, he), e.type = d.a.TEXTURETYPE_UNSIGNED_INT, t._uploadCompressedDataToTextureDirectly(e, pe, O, I, k, Be, Le);
+ }
+ G += Ee ? O * I * (Ee / 8) : he, O *= 0.5, I *= 0.5, O = Math.max(1, O), I = Math.max(1, I);
+ }
+ if (p !== void 0)
+ break;
+ }
+ m && m.length > 0 ? i.sphericalPolynomial = Ts.ConvertCubeMapToSphericalPolynomial({ size: ue[4], right: m[0], left: m[1], up: m[2], down: m[3], front: m[4], back: m[5], format: d.a.TEXTUREFORMAT_RGBA, type: d.a.TEXTURETYPE_FLOAT, gammaSpace: !1 }) : i.sphericalPolynomial = void 0;
+ } else
+ h.a.Error("Compressed textures are not supported on this platform.");
+ else
+ h.a.Error("Unsupported format, must contain a FourCC, RGB or LUMINANCE code");
+ else
+ h.a.Error("Invalid magic number in DDS header");
+ }, r.StoreLODInAlphaChannel = !1, r;
+ }();
+ Gt.a.prototype.createPrefilteredCubeTexture = function(r, t, e, n, i, o, a, s, p) {
+ var m = this;
+ return i === void 0 && (i = null), o === void 0 && (o = null), s === void 0 && (s = null), p === void 0 && (p = !0), this.createCubeTexture(r, t, null, !1, function(S) {
+ if (S) {
+ var O = S.texture;
+ if (p ? S.info.sphericalPolynomial && (O._sphericalPolynomial = S.info.sphericalPolynomial) : O._sphericalPolynomial = new ya(), O._source = Rt.b.CubePrefiltered, m.getCaps().textureLOD)
+ i && i(O);
+ else {
+ var I = m._gl, G = S.width;
+ if (G) {
+ for (var k = [], K = 0; K < 3; K++) {
+ var re = 1 - K / 2, se = n, ue = ee.a.Log2(G) * e + n, he = se + (ue - se) * re, pe = Math.round(Math.min(Math.max(he, 0), ue)), ve = new Rt.a(m, Rt.b.Temp);
+ if (ve.type = O.type, ve.format = O.format, ve.width = Math.pow(2, Math.max(ee.a.Log2(G) - pe, 0)), ve.height = ve.width, ve.isCube = !0, m._bindTextureDirectly(I.TEXTURE_CUBE_MAP, ve, !0), ve.samplingMode = d.a.TEXTURE_LINEAR_LINEAR, I.texParameteri(I.TEXTURE_CUBE_MAP, I.TEXTURE_MAG_FILTER, I.LINEAR), I.texParameteri(I.TEXTURE_CUBE_MAP, I.TEXTURE_MIN_FILTER, I.LINEAR), I.texParameteri(I.TEXTURE_CUBE_MAP, I.TEXTURE_WRAP_S, I.CLAMP_TO_EDGE), I.texParameteri(I.TEXTURE_CUBE_MAP, I.TEXTURE_WRAP_T, I.CLAMP_TO_EDGE), S.isDDS) {
+ var Ee = S.info, Ae = S.data;
+ m._unpackFlipY(Ee.isCompressed), yr.UploadDDSLevels(m, ve, Ae, Ee, !0, 6, pe);
+ } else
+ h.a.Warn("DDS is the only prefiltered cube map supported so far.");
+ m._bindTextureDirectly(I.TEXTURE_CUBE_MAP, null);
+ var Ie = new oi.a(t);
+ Ie.isCube = !0, Ie._texture = ve, ve.isReady = !0, k.push(Ie);
+ }
+ O._lodTextureHigh = k[2], O._lodTextureMid = k[1], O._lodTextureLow = k[0], i && i(O);
+ }
+ }
+ } else
+ i && i(null);
+ }, o, a, s, p, e, n);
+ };
+ var vf = function() {
+ function r() {
+ this.supportCascades = !0;
+ }
+ return r.prototype.canLoad = function(t) {
+ return ui.a.EndsWith(t, ".dds");
+ }, r.prototype.loadCubeData = function(t, e, n, i, o) {
+ var a, s = e.getEngine(), p = !1;
+ if (Array.isArray(t))
+ for (var m = 0; m < t.length; m++) {
+ var S = t[m];
+ a = yr.GetDDSInfo(S), e.width = a.width, e.height = a.height, p = (a.isRGB || a.isLuminance || a.mipmapCount > 1) && e.generateMipMaps, s._unpackFlipY(a.isCompressed), yr.UploadDDSLevels(s, e, S, a, p, 6, -1, m), a.isFourCC || a.mipmapCount !== 1 || s.generateMipMapsForCubemap(e);
+ }
+ else {
+ var O = t;
+ a = yr.GetDDSInfo(O), e.width = a.width, e.height = a.height, n && (a.sphericalPolynomial = new ya()), p = (a.isRGB || a.isLuminance || a.mipmapCount > 1) && e.generateMipMaps, s._unpackFlipY(a.isCompressed), yr.UploadDDSLevels(s, e, O, a, p, 6), a.isFourCC || a.mipmapCount !== 1 || s.generateMipMapsForCubemap(e, !1);
+ }
+ s._setCubeMapTextureParams(e, p), e.isReady = !0, e.onLoadedObservable.notifyObservers(e), e.onLoadedObservable.clear(), i && i({ isDDS: !0, width: e.width, info: a, data: t, texture: e });
+ }, r.prototype.loadData = function(t, e, n) {
+ var i = yr.GetDDSInfo(t), o = (i.isRGB || i.isLuminance || i.mipmapCount > 1) && e.generateMipMaps && i.width >> i.mipmapCount - 1 == 1;
+ n(i.width, i.height, o, i.isFourCC, function() {
+ yr.UploadDDSLevels(e.getEngine(), e, t, i, o, 1);
+ });
+ }, r;
+ }();
+ ke.a._TextureLoaders.push(new vf());
+ var bf = function() {
+ function r() {
+ this.supportCascades = !1;
+ }
+ return r.prototype.canLoad = function(t) {
+ return ui.a.EndsWith(t, ".env");
+ }, r.prototype.loadCubeData = function(t, e, n, i, o) {
+ if (!Array.isArray(t)) {
+ var a = nr.GetEnvInfo(t);
+ a ? (e.width = a.width, e.height = a.width, nr.UploadEnvSpherical(e, a), nr.UploadEnvLevelsAsync(e, t, a).then(function() {
+ e.isReady = !0, e.onLoadedObservable.notifyObservers(e), e.onLoadedObservable.clear(), i && i();
+ })) : o && o("Can not parse the environment file", null);
+ }
+ }, r.prototype.loadData = function(t, e, n) {
+ throw ".env not supported in 2d.";
+ }, r;
+ }();
+ ke.a._TextureLoaders.push(new bf());
+ var Fs = function() {
+ function r(t, e, n, i) {
+ if (this.data = t, this.isInvalid = !1, !r.IsValid(t))
+ return this.isInvalid = !0, void h.a.Error("texture missing KTX identifier");
+ var o = Uint32Array.BYTES_PER_ELEMENT, a = new DataView(this.data.buffer, this.data.byteOffset + 12, 13 * o), s = a.getUint32(0, !0) === 67305985;
+ this.glType = a.getUint32(1 * o, s), this.glTypeSize = a.getUint32(2 * o, s), this.glFormat = a.getUint32(3 * o, s), this.glInternalFormat = a.getUint32(4 * o, s), this.glBaseInternalFormat = a.getUint32(5 * o, s), this.pixelWidth = a.getUint32(6 * o, s), this.pixelHeight = a.getUint32(7 * o, s), this.pixelDepth = a.getUint32(8 * o, s), this.numberOfArrayElements = a.getUint32(9 * o, s), this.numberOfFaces = a.getUint32(10 * o, s), this.numberOfMipmapLevels = a.getUint32(11 * o, s), this.bytesOfKeyValueData = a.getUint32(12 * o, s), this.glType === 0 ? (this.numberOfMipmapLevels = Math.max(1, this.numberOfMipmapLevels), this.pixelHeight !== 0 && this.pixelDepth === 0 ? this.numberOfArrayElements === 0 ? this.numberOfFaces === e ? this.loadType = r.COMPRESSED_2D : h.a.Error("number of faces expected" + e + ", but found " + this.numberOfFaces) : h.a.Error("texture arrays not currently supported") : h.a.Error("only 2D textures currently supported")) : h.a.Error("only compressed formats currently supported");
+ }
+ return r.prototype.uploadLevels = function(t, e) {
+ switch (this.loadType) {
+ case r.COMPRESSED_2D:
+ this._upload2DCompressedLevels(t, e);
+ break;
+ case r.TEX_2D:
+ case r.COMPRESSED_3D:
+ case r.TEX_3D:
+ }
+ }, r.prototype._upload2DCompressedLevels = function(t, e) {
+ for (var n = r.HEADER_LEN + this.bytesOfKeyValueData, i = this.pixelWidth, o = this.pixelHeight, a = e ? this.numberOfMipmapLevels : 1, s = 0; s < a; s++) {
+ var p = new Int32Array(this.data.buffer, this.data.byteOffset + n, 1)[0];
+ n += 4;
+ for (var m = 0; m < this.numberOfFaces; m++) {
+ var S = new Uint8Array(this.data.buffer, this.data.byteOffset + n, p);
+ t.getEngine()._uploadCompressedDataToTextureDirectly(t, this.glInternalFormat, i, o, S, m, s), n += p, n += 3 - (p + 3) % 4;
+ }
+ i = Math.max(1, 0.5 * i), o = Math.max(1, 0.5 * o);
+ }
+ }, r.IsValid = function(t) {
+ if (t.byteLength >= 12) {
+ var e = new Uint8Array(t.buffer, t.byteOffset, 12);
+ if (e[0] === 171 && e[1] === 75 && e[2] === 84 && e[3] === 88 && e[4] === 32 && e[5] === 49 && e[6] === 49 && e[7] === 187 && e[8] === 13 && e[9] === 10 && e[10] === 26 && e[11] === 10)
+ return !0;
+ }
+ return !1;
+ }, r.HEADER_LEN = 64, r.COMPRESSED_2D = 0, r.COMPRESSED_3D = 1, r.TEX_2D = 2, r.TEX_3D = 3, r;
+ }(), Vl = function() {
+ function r(t) {
+ this._pendingActions = new Array(), this._workerInfos = t.map(function(e) {
+ return { worker: e, active: !1 };
+ });
+ }
+ return r.prototype.dispose = function() {
+ for (var t = 0, e = this._workerInfos; t < e.length; t++)
+ e[t].worker.terminate();
+ this._workerInfos = [], this._pendingActions = [];
+ }, r.prototype.push = function(t) {
+ for (var e = 0, n = this._workerInfos; e < n.length; e++) {
+ var i = n[e];
+ if (!i.active)
+ return void this._execute(i, t);
+ }
+ this._pendingActions.push(t);
+ }, r.prototype._execute = function(t, e) {
+ var n = this;
+ t.active = !0, e(t.worker, function() {
+ t.active = !1;
+ var i = n._pendingActions.shift();
+ i && n._execute(t, i);
+ });
+ }, r;
+ }(), kl = function() {
+ function r(t, e) {
+ e === void 0 && (e = r.DefaultNumWorkers), this._engine = t, r._Initialized || r._CreateWorkerPool(e);
+ }
+ return r.GetDefaultNumWorkers = function() {
+ return typeof navigator == "object" && navigator.hardwareConcurrency ? Math.min(Math.floor(0.5 * navigator.hardwareConcurrency), 4) : 1;
+ }, r._CreateWorkerPool = function(t) {
+ this._Initialized = !0, t && typeof Worker == "function" ? r._WorkerPoolPromise = new Promise(function(e) {
+ for (var n = "(" + Oy + ")()", i = URL.createObjectURL(new Blob([n], { type: "application/javascript" })), o = new Array(t), a = 0; a < o.length; a++)
+ o[a] = new Promise(function(s, p) {
+ var m = new Worker(i), S = function(I) {
+ m.removeEventListener("error", S), m.removeEventListener("message", O), p(I);
+ }, O = function(I) {
+ I.data.action === "init" && (m.removeEventListener("error", S), m.removeEventListener("message", O), s(m));
+ };
+ m.addEventListener("error", S), m.addEventListener("message", O), m.postMessage({ action: "init", urls: r.URLConfig });
+ });
+ Promise.all(o).then(function(s) {
+ e(new Vl(s));
+ });
+ }) : (KTX2DECODER.MSCTranscoder.UseFromWorkerThread = !1, KTX2DECODER.WASMMemoryManager.LoadBinariesFromCurrentThread = !0);
+ }, r.prototype.uploadAsync = function(t, e, n) {
+ var i = this, o = this._engine.getCaps(), a = { astc: !!o.astc, bptc: !!o.bptc, s3tc: !!o.s3tc, pvrtc: !!o.pvrtc, etc2: !!o.etc2, etc1: !!o.etc1 };
+ return r._WorkerPoolPromise ? r._WorkerPoolPromise.then(function(s) {
+ return new Promise(function(p, m) {
+ s.push(function(S, O) {
+ var I = function(k) {
+ S.removeEventListener("error", I), S.removeEventListener("message", G), m(k), O();
+ }, G = function(k) {
+ if (k.data.action === "decoded") {
+ if (S.removeEventListener("error", I), S.removeEventListener("message", G), k.data.success)
+ try {
+ i._createTexture(k.data.decodedData, e, n), p();
+ } catch (K) {
+ m({ message: K });
+ }
+ else
+ m({ message: k.data.msg });
+ O();
+ }
+ };
+ S.addEventListener("error", I), S.addEventListener("message", G), S.postMessage({ action: "decode", data: t, caps: a, options: n });
+ });
+ });
+ }) : new Promise(function(s, p) {
+ r._Ktx2Decoder || (r._Ktx2Decoder = new KTX2DECODER.KTX2Decoder()), r._Ktx2Decoder.decode(t, o).then(function(m) {
+ i._createTexture(m, e), s();
+ }).catch(function(m) {
+ p({ message: m });
+ });
+ });
+ }, r.prototype.dispose = function() {
+ r._WorkerPoolPromise && r._WorkerPoolPromise.then(function(t) {
+ t.dispose();
+ }), delete r._WorkerPoolPromise;
+ }, r.prototype._createTexture = function(t, e, n) {
+ if (this._engine._bindTextureDirectly(this._engine._gl.TEXTURE_2D, e), n && (n.transcodedFormat = t.transcodedFormat, n.isInGammaSpace = t.isInGammaSpace, n.transcoderName = t.transcoderName), t.transcodedFormat === 32856 ? (e.type = d.a.TEXTURETYPE_UNSIGNED_BYTE, e.format = d.a.TEXTUREFORMAT_RGBA) : e.format = t.transcodedFormat, e._gammaSpace = t.isInGammaSpace, t.errors)
+ throw new Error("KTX2 container - could not transcode the data. " + t.errors);
+ for (var i = 0; i < t.mipmaps.length; ++i) {
+ var o = t.mipmaps[i];
+ if (!o || !o.data)
+ throw new Error("KTX2 container - could not transcode one of the image");
+ t.transcodedFormat === 32856 ? (e.width = o.width, e.height = o.height, this._engine._uploadDataToTextureDirectly(e, o.data, 0, i, void 0, !0)) : this._engine._uploadCompressedDataToTextureDirectly(e, t.transcodedFormat, o.width, o.height, o.data, 0, i);
+ }
+ e.width = t.mipmaps[0].width, e.height = t.mipmaps[0].height, e.generateMipMaps = t.mipmaps.length > 1, e.isReady = !0, this._engine._bindTextureDirectly(this._engine._gl.TEXTURE_2D, null);
+ }, r.IsValid = function(t) {
+ if (t.byteLength >= 12) {
+ var e = new Uint8Array(t.buffer, t.byteOffset, 12);
+ if (e[0] === 171 && e[1] === 75 && e[2] === 84 && e[3] === 88 && e[4] === 32 && e[5] === 50 && e[6] === 48 && e[7] === 187 && e[8] === 13 && e[9] === 10 && e[10] === 26 && e[11] === 10)
+ return !0;
+ }
+ return !1;
+ }, r.URLConfig = { jsDecoderModule: "https://preview.babylonjs.com/babylon.ktx2Decoder.js", wasmUASTCToASTC: null, wasmUASTCToBC7: null, wasmUASTCToRGBA_UNORM: null, wasmUASTCToRGBA_SRGB: null, jsMSCTranscoder: null, wasmMSCTranscoder: null }, r.DefaultNumWorkers = r.GetDefaultNumWorkers(), r;
+ }();
+ function Oy() {
+ var r;
+ onmessage = function(t) {
+ switch (t.data.action) {
+ case "init":
+ var e = t.data.urls;
+ importScripts(e.jsDecoderModule), e.wasmUASTCToASTC !== null && (KTX2DECODER.LiteTranscoder_UASTC_ASTC.WasmModuleURL = e.wasmUASTCToASTC), e.wasmUASTCToBC7 !== null && (KTX2DECODER.LiteTranscoder_UASTC_BC7.WasmModuleURL = e.wasmUASTCToBC7), e.wasmUASTCToRGBA_UNORM !== null && (KTX2DECODER.LiteTranscoder_UASTC_RGBA_UNORM.WasmModuleURL = e.wasmUASTCToRGBA_UNORM), e.wasmUASTCToRGBA_SRGB !== null && (KTX2DECODER.LiteTranscoder_UASTC_RGBA_SRGB.WasmModuleURL = e.wasmUASTCToRGBA_SRGB), e.jsMSCTranscoder !== null && (KTX2DECODER.MSCTranscoder.JSModuleURL = e.jsMSCTranscoder), e.wasmMSCTranscoder !== null && (KTX2DECODER.MSCTranscoder.WasmModuleURL = e.wasmMSCTranscoder), r = new KTX2DECODER.KTX2Decoder(), postMessage({ action: "init" });
+ break;
+ case "decode":
+ r.decode(t.data.data, t.data.caps, t.data.options).then(function(n) {
+ for (var i = [], o = 0; o < n.mipmaps.length; ++o) {
+ var a = n.mipmaps[o];
+ a && a.data && i.push(a.data.buffer);
+ }
+ postMessage({ action: "decoded", success: !0, decodedData: n }, i);
+ }).catch(function(n) {
+ postMessage({ action: "decoded", success: !1, msg: n });
+ });
+ }
+ };
+ }
+ var yf = function() {
+ function r() {
+ this.supportCascades = !1;
+ }
+ return r.prototype.canLoad = function(t, e) {
+ return ui.a.EndsWith(t, ".ktx") || ui.a.EndsWith(t, ".ktx2") || e === "image/ktx" || e === "image/ktx2";
+ }, r.prototype.loadCubeData = function(t, e, n, i, o) {
+ if (!Array.isArray(t)) {
+ e._invertVScale = !e.invertY;
+ var a = e.getEngine(), s = new Fs(t, 6), p = s.numberOfMipmapLevels > 1 && e.generateMipMaps;
+ a._unpackFlipY(!0), s.uploadLevels(e, e.generateMipMaps), e.width = s.pixelWidth, e.height = s.pixelHeight, a._setCubeMapTextureParams(e, p), e.isReady = !0, e.onLoadedObservable.notifyObservers(e), e.onLoadedObservable.clear(), i && i();
+ }
+ }, r.prototype.loadData = function(t, e, n, i) {
+ if (Fs.IsValid(t)) {
+ e._invertVScale = !e.invertY;
+ var o = new Fs(t, 1);
+ n(o.pixelWidth, o.pixelHeight, e.generateMipMaps, !0, function() {
+ o.uploadLevels(e, e.generateMipMaps);
+ }, o.isInvalid);
+ } else
+ kl.IsValid(t) ? new kl(e.getEngine()).uploadAsync(t, e, i).then(function() {
+ n(e.width, e.height, e.generateMipMaps, !0, function() {
+ }, !1);
+ }, function(a) {
+ h.a.Warn("Failed to load KTX2 texture data: " + a.message), n(0, 0, !1, !1, function() {
+ }, !0);
+ }) : (h.a.Error("texture missing KTX identifier"), n(0, 0, !1, !1, function() {
+ }, !0));
+ }, r;
+ }();
+ ke.a._TextureLoaders.unshift(new yf());
+ var Ef = function(r) {
+ function t(e, n, i) {
+ var o = r.call(this, e, c.e.Zero(), n) || this;
+ return o._xrSessionManager = i, o._firstFrame = !1, o._referenceQuaternion = c.b.Identity(), o._referencedPosition = new c.e(), o._xrInvPositionCache = new c.e(), o._xrInvQuaternionCache = c.b.Identity(), o._trackingState = Hr.NOT_TRACKING, o.onBeforeCameraTeleport = new P.c(), o.onAfterCameraTeleport = new P.c(), o.onTrackingStateChanged = new P.c(), o.compensateOnFirstFrame = !0, o._rotate180 = new c.b(0, 1, 0, 0), o.minZ = 0.1, o.rotationQuaternion = new c.b(), o.cameraRigMode = gt.a.RIG_MODE_CUSTOM, o.updateUpVectorFromRotation = !0, o._updateNumberOfRigCameras(1), o.freezeProjectionMatrix(), o._xrSessionManager.onXRSessionInit.add(function() {
+ o._referencedPosition.copyFromFloats(0, 0, 0), o._referenceQuaternion.copyFromFloats(0, 0, 0, 1), o._firstFrame = o.compensateOnFirstFrame;
+ }), o._xrSessionManager.onXRFrameObservable.add(function(a) {
+ o._firstFrame && o._updateFromXRSession(), o._updateReferenceSpace(), o._updateFromXRSession();
+ }, void 0, !0), o;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "trackingState", { get: function() {
+ return this._trackingState;
+ }, enumerable: !1, configurable: !0 }), t.prototype._setTrackingState = function(e) {
+ this._trackingState !== e && (this._trackingState = e, this.onTrackingStateChanged.notifyObservers(e));
+ }, Object.defineProperty(t.prototype, "realWorldHeight", { get: function() {
+ var e = this._xrSessionManager.currentFrame && this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.baseReferenceSpace);
+ return e && e.transform ? e.transform.position.y : 0;
+ }, enumerable: !1, configurable: !0 }), t.prototype._updateForDualEyeDebugging = function() {
+ this._updateNumberOfRigCameras(2), this.rigCameras[0].viewport = new li.a(0, 0, 0.5, 1), this.rigCameras[0].outputRenderTarget = null, this.rigCameras[1].viewport = new li.a(0.5, 0, 0.5, 1), this.rigCameras[1].outputRenderTarget = null;
+ }, t.prototype.setTransformationFromNonVRCamera = function(e, n) {
+ e === void 0 && (e = this.getScene().activeCamera), n === void 0 && (n = !0), e && e !== this && (e.computeWorldMatrix().decompose(void 0, this.rotationQuaternion, this.position), this.position.y = 0, c.b.FromEulerAnglesToRef(0, this.rotationQuaternion.toEulerAngles().y, 0, this.rotationQuaternion), this._firstFrame = !0, n && this._xrSessionManager.resetReferenceSpace());
+ }, t.prototype.getClassName = function() {
+ return "WebXRCamera";
+ }, t.prototype._updateFromXRSession = function() {
+ var e = this, n = this._xrSessionManager.currentFrame && this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.referenceSpace);
+ if (n) {
+ var i = n.emulatedPosition ? Hr.TRACKING_LOST : Hr.TRACKING;
+ if (this._setTrackingState(i), n.transform) {
+ var o = n.transform.position;
+ this._referencedPosition.set(o.x, o.y, o.z);
+ var a = n.transform.orientation;
+ this._referenceQuaternion.set(a.x, a.y, a.z, a.w), this._scene.useRightHandedSystem || (this._referencedPosition.z *= -1, this._referenceQuaternion.z *= -1, this._referenceQuaternion.w *= -1), this._firstFrame ? (this._firstFrame = !1, this.position.y += this._referencedPosition.y, this._referenceQuaternion.copyFromFloats(0, 0, 0, 1)) : (this.rotationQuaternion.copyFrom(this._referenceQuaternion), this.position.copyFrom(this._referencedPosition));
+ }
+ this.rigCameras.length !== n.views.length && this._updateNumberOfRigCameras(n.views.length), n.views.forEach(function(s, p) {
+ var m = e.rigCameras[p];
+ m.isLeftCamera || m.isRightCamera || (s.eye === "right" ? m._isRightCamera = !0 : s.eye === "left" && (m._isLeftCamera = !0));
+ var S = s.transform.position, O = s.transform.orientation;
+ if (m.position.set(S.x, S.y, S.z), m.rotationQuaternion.set(O.x, O.y, O.z, O.w), e._scene.useRightHandedSystem ? m.rotationQuaternion.multiplyInPlace(e._rotate180) : (m.position.z *= -1, m.rotationQuaternion.z *= -1, m.rotationQuaternion.w *= -1), c.a.FromFloat32ArrayToRefScaled(s.projectionMatrix, 0, 1, m._projectionMatrix), e._scene.useRightHandedSystem || m._projectionMatrix.toggleProjectionMatrixHandInPlace(), p === 0 && e._projectionMatrix.copyFrom(m._projectionMatrix), e._xrSessionManager.session.renderState.baseLayer) {
+ var I = e._xrSessionManager.session.renderState.baseLayer.getViewport(s), G = e._xrSessionManager.session.renderState.baseLayer.framebufferWidth, k = e._xrSessionManager.session.renderState.baseLayer.framebufferHeight;
+ m.viewport.width = I.width / G, m.viewport.height = I.height / k, m.viewport.x = I.x / G, m.viewport.y = I.y / k;
+ }
+ m.outputRenderTarget = e._xrSessionManager.getRenderTargetTextureForEye(s.eye);
+ });
+ } else
+ this._setTrackingState(Hr.NOT_TRACKING);
+ }, t.prototype._updateNumberOfRigCameras = function(e) {
+ for (e === void 0 && (e = 1); this.rigCameras.length < e; ) {
+ var n = new fr("XR-RigCamera: " + this.rigCameras.length, c.e.Zero(), this.getScene());
+ n.minZ = 0.1, n.rotationQuaternion = new c.b(), n.updateUpVectorFromRotation = !0, n.isRigCamera = !0, n.rigParent = this, n.freezeProjectionMatrix(), this.rigCameras.push(n);
+ }
+ for (; this.rigCameras.length > e; ) {
+ var i = this.rigCameras.pop();
+ i && i.dispose();
+ }
+ }, t.prototype._updateReferenceSpace = function() {
+ this.position.equals(this._referencedPosition) && this.rotationQuaternion.equals(this._referenceQuaternion) || (this.position.subtractToRef(this._referencedPosition, this._referencedPosition), this._referenceQuaternion.conjugateInPlace(), this._referenceQuaternion.multiplyToRef(this.rotationQuaternion, this._referenceQuaternion), this._updateReferenceSpaceOffset(this._referencedPosition, this._referenceQuaternion.normalize()));
+ }, t.prototype._updateReferenceSpaceOffset = function(e, n, i) {
+ if (i === void 0 && (i = !1), this._xrSessionManager.referenceSpace && this._xrSessionManager.currentFrame) {
+ this._xrInvPositionCache.copyFrom(e), n ? this._xrInvQuaternionCache.copyFrom(n) : this._xrInvQuaternionCache.copyFromFloats(0, 0, 0, 1), this._scene.useRightHandedSystem || (this._xrInvPositionCache.z *= -1, this._xrInvQuaternionCache.z *= -1, this._xrInvQuaternionCache.w *= -1), this._xrInvPositionCache.negateInPlace(), this._xrInvQuaternionCache.conjugateInPlace(), this._xrInvPositionCache.rotateByQuaternionToRef(this._xrInvQuaternionCache, this._xrInvPositionCache), i && (this._xrInvPositionCache.y = 0);
+ var o = new XRRigidTransform({ x: this._xrInvPositionCache.x, y: this._xrInvPositionCache.y, z: this._xrInvPositionCache.z }, { x: this._xrInvQuaternionCache.x, y: this._xrInvQuaternionCache.y, z: this._xrInvQuaternionCache.z, w: this._xrInvQuaternionCache.w }), a = this._xrSessionManager.referenceSpace.getOffsetReferenceSpace(o), s = this._xrSessionManager.currentFrame && this._xrSessionManager.currentFrame.getViewerPose(a);
+ if (s) {
+ var p = new c.e(s.transform.position.x, s.transform.position.y, s.transform.position.z);
+ this._scene.useRightHandedSystem || (p.z *= -1), this.position.subtractToRef(p, p), this._scene.useRightHandedSystem || (p.z *= -1), p.negateInPlace();
+ var m = new XRRigidTransform({ x: p.x, y: p.y, z: p.z });
+ this._xrSessionManager.referenceSpace = a.getOffsetReferenceSpace(m);
+ }
+ }
+ }, t;
+ }(ci), Ci = function() {
+ function r() {
+ }
+ return r.ANCHOR_SYSTEM = "xr-anchor-system", r.BACKGROUND_REMOVER = "xr-background-remover", r.HIT_TEST = "xr-hit-test", r.PHYSICS_CONTROLLERS = "xr-physics-controller", r.PLANE_DETECTION = "xr-plane-detection", r.POINTER_SELECTION = "xr-controller-pointer-selection", r.TELEPORTATION = "xr-controller-teleportation", r.FEATURE_POINTS = "xr-feature-points", r.HAND_TRACKING = "xr-hand-tracking", r;
+ }(), hi = function() {
+ function r(t) {
+ var e = this;
+ this._xrSessionManager = t, this._features = {}, this._xrSessionManager.onXRSessionInit.add(function() {
+ e.getEnabledFeatures().forEach(function(n) {
+ var i = e._features[n];
+ !i.enabled || i.featureImplementation.attached || i.featureImplementation.disableAutoAttach || e.attachFeature(n);
+ });
+ }), this._xrSessionManager.onXRSessionEnded.add(function() {
+ e.getEnabledFeatures().forEach(function(n) {
+ var i = e._features[n];
+ i.enabled && i.featureImplementation.attached && e.detachFeature(n);
+ });
+ });
+ }
+ return r.AddWebXRFeature = function(t, e, n, i) {
+ n === void 0 && (n = 1), i === void 0 && (i = !1), this._AvailableFeatures[t] = this._AvailableFeatures[t] || { latest: n }, n > this._AvailableFeatures[t].latest && (this._AvailableFeatures[t].latest = n), i && (this._AvailableFeatures[t].stable = n), this._AvailableFeatures[t][n] = e;
+ }, r.ConstructFeature = function(t, e, n, i) {
+ e === void 0 && (e = 1);
+ var o = this._AvailableFeatures[t][e];
+ if (!o)
+ throw new Error("feature not found");
+ return o(n, i);
+ }, r.GetAvailableFeatures = function() {
+ return Object.keys(this._AvailableFeatures);
+ }, r.GetAvailableVersions = function(t) {
+ return Object.keys(this._AvailableFeatures[t]);
+ }, r.GetLatestVersionOfFeature = function(t) {
+ return this._AvailableFeatures[t] && this._AvailableFeatures[t].latest || -1;
+ }, r.GetStableVersionOfFeature = function(t) {
+ return this._AvailableFeatures[t] && this._AvailableFeatures[t].stable || -1;
+ }, r.prototype.attachFeature = function(t) {
+ var e = this._features[t];
+ e && e.enabled && !e.featureImplementation.attached && e.featureImplementation.attach();
+ }, r.prototype.detachFeature = function(t) {
+ var e = this._features[t];
+ e && e.featureImplementation.attached && e.featureImplementation.detach();
+ }, r.prototype.disableFeature = function(t) {
+ var e = typeof t == "string" ? t : t.Name, n = this._features[e];
+ return !(!n || !n.enabled) && (n.enabled = !1, this.detachFeature(e), n.featureImplementation.dispose(), !0);
+ }, r.prototype.dispose = function() {
+ var t = this;
+ this.getEnabledFeatures().forEach(function(e) {
+ t.disableFeature(e), t._features[e].featureImplementation.dispose();
+ });
+ }, r.prototype.enableFeature = function(t, e, n, i, o) {
+ var a = this;
+ e === void 0 && (e = "latest"), n === void 0 && (n = {}), i === void 0 && (i = !0), o === void 0 && (o = !0);
+ var s = typeof t == "string" ? t : t.Name, p = 0;
+ if (typeof e == "string") {
+ if (!e)
+ throw new Error("Error in provided version - " + s + " (" + e + ")");
+ if ((p = e === "stable" ? r.GetStableVersionOfFeature(s) : e === "latest" ? r.GetLatestVersionOfFeature(s) : +e) === -1 || isNaN(p))
+ throw new Error("feature not found - " + s + " (" + e + ")");
+ } else
+ p = e;
+ var m = this._features[s], S = r.ConstructFeature(s, p, this._xrSessionManager, n);
+ if (!S)
+ throw new Error("feature not found - " + s);
+ m && this.disableFeature(s);
+ var O = S();
+ if (O.dependsOn && !O.dependsOn.every(function(I) {
+ return !!a._features[I];
+ }))
+ throw new Error("Dependant features missing. Make sure the following features are enabled - " + O.dependsOn.join(", "));
+ if (O.isCompatible())
+ return this._features[s] = { featureImplementation: O, enabled: !0, version: p, required: o }, i ? this._xrSessionManager.session && !this._features[s].featureImplementation.attached && this.attachFeature(s) : this._features[s].featureImplementation.disableAutoAttach = !0, this._features[s].featureImplementation;
+ if (o)
+ throw new Error("required feature not compatible");
+ return Ke.b.Warn("Feature " + s + " not compatible with the current environment/browser and was not enabled."), O;
+ }, r.prototype.getEnabledFeature = function(t) {
+ return this._features[t] && this._features[t].featureImplementation;
+ }, r.prototype.getEnabledFeatures = function() {
+ return Object.keys(this._features);
+ }, r.prototype.extendXRSessionInitObject = function(t) {
+ var e = this;
+ return this.getEnabledFeatures().forEach(function(n) {
+ var i = e._features[n], o = i.featureImplementation.xrNativeFeatureName;
+ o && (i.required ? (t.requiredFeatures = t.requiredFeatures || [], t.requiredFeatures.indexOf(o) === -1 && t.requiredFeatures.push(o)) : (t.optionalFeatures = t.optionalFeatures || [], t.optionalFeatures.indexOf(o) === -1 && t.optionalFeatures.push(o)));
+ }), t;
+ }, r._AvailableFeatures = {}, r;
+ }(), Tf = function() {
+ function r(t) {
+ var e = this;
+ this.scene = t, this._nonVRCamera = null, this._originalSceneAutoClear = !0, this._supported = !1, this.onInitialXRPoseSetObservable = new P.c(), this.onStateChangedObservable = new P.c(), this.state = Pn.NOT_IN_XR, this.sessionManager = new gl(t), this.camera = new Ef("", t, this.sessionManager), this.featuresManager = new hi(this.sessionManager), t.onDisposeObservable.add(function() {
+ e.exitXRAsync();
+ });
+ }
+ return r.CreateAsync = function(t) {
+ var e = new r(t);
+ return e.sessionManager.initializeAsync().then(function() {
+ return e._supported = !0, e;
+ }).catch(function(n) {
+ throw e._setState(Pn.NOT_IN_XR), e.dispose(), n;
+ });
+ }, r.prototype.dispose = function() {
+ this.camera.dispose(), this.onStateChangedObservable.clear(), this.onInitialXRPoseSetObservable.clear(), this.sessionManager.dispose(), this._nonVRCamera && (this.scene.activeCamera = this._nonVRCamera);
+ }, r.prototype.enterXRAsync = function(t, e, n, i) {
+ var o = this;
+ if (n === void 0 && (n = this.sessionManager.getWebXRRenderTarget()), i === void 0 && (i = {}), !this._supported)
+ throw "WebXR not supported in this browser or environment";
+ return this._setState(Pn.ENTERING_XR), e !== "viewer" && e !== "local" && (i.optionalFeatures = i.optionalFeatures || [], i.optionalFeatures.push(e)), this.featuresManager.extendXRSessionInitObject(i), t === "immersive-ar" && e !== "unbounded" && h.a.Warn("We recommend using 'unbounded' reference space type when using 'immersive-ar' session mode"), this.sessionManager.initializeSessionAsync(t, i).then(function() {
+ return o.sessionManager.setReferenceSpaceTypeAsync(e);
+ }).then(function() {
+ return n.initializeXRLayerAsync(o.sessionManager.session);
+ }).then(function() {
+ return o.sessionManager.updateRenderStateAsync({ depthFar: o.camera.maxZ, depthNear: o.camera.minZ, baseLayer: n.xrLayer });
+ }).then(function() {
+ return o.sessionManager.runXRRenderLoop(), o._originalSceneAutoClear = o.scene.autoClear, o._nonVRCamera = o.scene.activeCamera, o.scene.activeCamera = o.camera, t !== "immersive-ar" ? o._nonXRToXRCamera() : (o.scene.autoClear = !1, o.camera.compensateOnFirstFrame = !1), o.sessionManager.onXRSessionEnded.addOnce(function() {
+ o.camera.rigCameras.forEach(function(a) {
+ a.outputRenderTarget = null;
+ }), o.scene.autoClear = o._originalSceneAutoClear, o.scene.activeCamera = o._nonVRCamera, t !== "immersive-ar" && o.camera.compensateOnFirstFrame && (o._nonVRCamera.setPosition ? o._nonVRCamera.setPosition(o.camera.position) : o._nonVRCamera.position.copyFrom(o.camera.position)), o._setState(Pn.NOT_IN_XR);
+ }), o.sessionManager.onXRFrameObservable.addOnce(function() {
+ o._setState(Pn.IN_XR);
+ }), o.sessionManager;
+ }).catch(function(a) {
+ throw console.log(a), console.log(a.message), o._setState(Pn.NOT_IN_XR), a;
+ });
+ }, r.prototype.exitXRAsync = function() {
+ return this.state !== Pn.IN_XR ? Promise.resolve() : (this._setState(Pn.EXITING_XR), this.sessionManager.exitXRAsync());
+ }, r.prototype._nonXRToXRCamera = function() {
+ this.camera.setTransformationFromNonVRCamera(this._nonVRCamera), this.onInitialXRPoseSetObservable.notifyObservers(this.camera);
+ }, r.prototype._setState = function(t) {
+ this.state !== t && (this.state = t, this.onStateChangedObservable.notifyObservers(this.state));
+ }, r;
+ }(), Oo = function() {
+ function r(t, e, n, i) {
+ n === void 0 && (n = -1), i === void 0 && (i = []), this.id = t, this.type = e, this._buttonIndex = n, this._axesIndices = i, this._axes = { x: 0, y: 0 }, this._changes = {}, this._currentValue = 0, this._hasChanges = !1, this._pressed = !1, this._touched = !1, this.onAxisValueChangedObservable = new P.c(), this.onButtonStateChangedObservable = new P.c();
+ }
+ return Object.defineProperty(r.prototype, "axes", { get: function() {
+ return this._axes;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "changes", { get: function() {
+ return this._changes;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "hasChanges", { get: function() {
+ return this._hasChanges;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "pressed", { get: function() {
+ return this._pressed;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "touched", { get: function() {
+ return this._touched;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "value", { get: function() {
+ return this._currentValue;
+ }, enumerable: !1, configurable: !0 }), r.prototype.dispose = function() {
+ this.onAxisValueChangedObservable.clear(), this.onButtonStateChangedObservable.clear();
+ }, r.prototype.isAxes = function() {
+ return this._axesIndices.length !== 0;
+ }, r.prototype.isButton = function() {
+ return this._buttonIndex !== -1;
+ }, r.prototype.update = function(t) {
+ var e = !1, n = !1;
+ if (this._hasChanges = !1, this._changes = {}, this.isButton()) {
+ var i = t.buttons[this._buttonIndex];
+ if (!i)
+ return;
+ this._currentValue !== i.value && (this.changes.value = { current: i.value, previous: this._currentValue }, e = !0, this._currentValue = i.value), this._touched !== i.touched && (this.changes.touched = { current: i.touched, previous: this._touched }, e = !0, this._touched = i.touched), this._pressed !== i.pressed && (this.changes.pressed = { current: i.pressed, previous: this._pressed }, e = !0, this._pressed = i.pressed);
+ }
+ this.isAxes() && (this._axes.x !== t.axes[this._axesIndices[0]] && (this.changes.axes = { current: { x: t.axes[this._axesIndices[0]], y: this._axes.y }, previous: { x: this._axes.x, y: this._axes.y } }, this._axes.x = t.axes[this._axesIndices[0]], n = !0), this._axes.y !== t.axes[this._axesIndices[1]] && (this.changes.axes ? this.changes.axes.current.y = t.axes[this._axesIndices[1]] : this.changes.axes = { current: { x: this._axes.x, y: t.axes[this._axesIndices[1]] }, previous: { x: this._axes.x, y: this._axes.y } }, this._axes.y = t.axes[this._axesIndices[1]], n = !0)), e && (this._hasChanges = !0, this.onButtonStateChangedObservable.notifyObservers(this)), n && (this._hasChanges = !0, this.onAxisValueChangedObservable.notifyObservers(this._axes));
+ }, r.BUTTON_TYPE = "button", r.SQUEEZE_TYPE = "squeeze", r.THUMBSTICK_TYPE = "thumbstick", r.TOUCHPAD_TYPE = "touchpad", r.TRIGGER_TYPE = "trigger", r;
+ }(), Mo = function() {
+ function r(t, e, n, i, o) {
+ var a = this;
+ this.scene = t, this.layout = e, this.gamepadObject = n, this.handedness = i, this._initComponent = function(s) {
+ if (s) {
+ var p = a.layout.components[s], m = p.type, S = p.gamepadIndices.button, O = [];
+ p.gamepadIndices.xAxis !== void 0 && p.gamepadIndices.yAxis !== void 0 && O.push(p.gamepadIndices.xAxis, p.gamepadIndices.yAxis), a.components[s] = new Oo(s, m, S, O);
+ }
+ }, this._modelReady = !1, this.components = {}, this.disableAnimation = !1, this.onModelLoadedObservable = new P.c(), e.components && Object.keys(e.components).forEach(this._initComponent);
+ }
+ return r.prototype.dispose = function() {
+ var t = this;
+ this.getComponentIds().forEach(function(e) {
+ return t.getComponent(e).dispose();
+ }), this.rootMesh && this.rootMesh.dispose();
+ }, r.prototype.getAllComponentsOfType = function(t) {
+ var e = this;
+ return this.getComponentIds().map(function(n) {
+ return e.components[n];
+ }).filter(function(n) {
+ return n.type === t;
+ });
+ }, r.prototype.getComponent = function(t) {
+ return this.components[t];
+ }, r.prototype.getComponentIds = function() {
+ return Object.keys(this.components);
+ }, r.prototype.getComponentOfType = function(t) {
+ return this.getAllComponentsOfType(t)[0] || null;
+ }, r.prototype.getMainComponent = function() {
+ return this.getComponent(this.layout.selectComponentId);
+ }, r.prototype.loadModel = function() {
+ return Object(u.b)(this, void 0, void 0, function() {
+ var t, e, n = this;
+ return Object(u.e)(this, function(i) {
+ return t = !this._getModelLoadingConstraints(), e = this._getGenericFilenameAndPath(), t ? h.a.Warn("Falling back to generic models") : e = this._getFilenameAndPath(), [2, new Promise(function(o, a) {
+ zt.ImportMesh("", e.path, e.filename, n.scene, function(s) {
+ t ? n._getGenericParentMesh(s) : n._setRootMesh(s), n._processLoadedModel(s), n._modelReady = !0, n.onModelLoadedObservable.notifyObservers(n), o(!0);
+ }, null, function(s, p) {
+ h.a.Log(p), h.a.Warn("Failed to retrieve controller model of type " + n.profileId + " from the remote server: " + e.path + e.filename), a(p);
+ });
+ })];
+ });
+ });
+ }, r.prototype.updateFromXRFrame = function(t) {
+ var e = this;
+ this.getComponentIds().forEach(function(n) {
+ return e.getComponent(n).update(e.gamepadObject);
+ }), this.updateModel(t);
+ }, Object.defineProperty(r.prototype, "handness", { get: function() {
+ return this.handedness;
+ }, enumerable: !1, configurable: !0 }), r.prototype.pulse = function(t, e, n) {
+ return n === void 0 && (n = 0), this.gamepadObject.hapticActuators && this.gamepadObject.hapticActuators[n] ? this.gamepadObject.hapticActuators[n].pulse(t, e) : Promise.resolve(!1);
+ }, r.prototype._getChildByName = function(t, e) {
+ return t.getChildren(function(n) {
+ return n.name === e;
+ }, !1)[0];
+ }, r.prototype._getImmediateChildByName = function(t, e) {
+ return t.getChildren(function(n) {
+ return n.name == e;
+ }, !0)[0];
+ }, r.prototype._lerpTransform = function(t, e, n) {
+ if (t.minMesh && t.maxMesh && t.valueMesh && t.minMesh.rotationQuaternion && t.maxMesh.rotationQuaternion && t.valueMesh.rotationQuaternion) {
+ var i = n ? 0.5 * e + 0.5 : e;
+ c.b.SlerpToRef(t.minMesh.rotationQuaternion, t.maxMesh.rotationQuaternion, i, t.valueMesh.rotationQuaternion), c.e.LerpToRef(t.minMesh.position, t.maxMesh.position, i, t.valueMesh.position);
+ }
+ }, r.prototype.updateModel = function(t) {
+ this._modelReady && this._updateModel(t);
+ }, r.prototype._getGenericFilenameAndPath = function() {
+ return { filename: "generic.babylon", path: "https://controllers.babylonjs.com/generic/" };
+ }, r.prototype._getGenericParentMesh = function(t) {
+ var e = this;
+ this.rootMesh = new we.a(this.profileId + " " + this.handedness, this.scene), t.forEach(function(n) {
+ n.parent || (n.isPickable = !1, n.setParent(e.rootMesh));
+ }), this.rootMesh.rotationQuaternion = c.b.FromEulerAngles(0, Math.PI, 0);
+ }, r;
+ }(), Gl = function(r) {
+ function t(e, n, i) {
+ var o = r.call(this, e, My[i], n, i) || this;
+ return o.profileId = t.ProfileId, o;
+ }
+ return Object(u.d)(t, r), t.prototype._getFilenameAndPath = function() {
+ return { filename: "generic.babylon", path: "https://controllers.babylonjs.com/generic/" };
+ }, t.prototype._getModelLoadingConstraints = function() {
+ return !0;
+ }, t.prototype._processLoadedModel = function(e) {
+ }, t.prototype._setRootMesh = function(e) {
+ var n = this;
+ this.rootMesh = new we.a(this.profileId + " " + this.handedness, this.scene), e.forEach(function(i) {
+ i.isPickable = !1, i.parent || i.setParent(n.rootMesh);
+ }), this.rootMesh.rotationQuaternion = c.b.FromEulerAngles(0, Math.PI, 0);
+ }, t.prototype._updateModel = function() {
+ }, t.ProfileId = "generic-trigger", t;
+ }(Mo), My = { left: { selectComponentId: "xr-standard-trigger", components: { "xr-standard-trigger": { type: "trigger", gamepadIndices: { button: 0 }, rootNodeName: "xr_standard_trigger", visualResponses: {} } }, gamepadMapping: "xr-standard", rootNodeName: "generic-trigger-left", assetPath: "left.glb" }, right: { selectComponentId: "xr-standard-trigger", components: { "xr-standard-trigger": { type: "trigger", gamepadIndices: { button: 0 }, rootNodeName: "xr_standard_trigger", visualResponses: {} } }, gamepadMapping: "xr-standard", rootNodeName: "generic-trigger-right", assetPath: "right.glb" }, none: { selectComponentId: "xr-standard-trigger", components: { "xr-standard-trigger": { type: "trigger", gamepadIndices: { button: 0 }, rootNodeName: "xr_standard_trigger", visualResponses: {} } }, gamepadMapping: "xr-standard", rootNodeName: "generic-trigger-none", assetPath: "none.glb" } }, Sf = function(r) {
+ function t(e, n, i, o) {
+ var a = r.call(this, e, i.layouts[n.handedness || "none"], n.gamepad, n.handedness) || this;
+ return a._repositoryUrl = o, a._buttonMeshMapping = {}, a._touchDots = {}, a.profileId = i.profileId, a;
+ }
+ return Object(u.d)(t, r), t.prototype.dispose = function() {
+ var e = this;
+ r.prototype.dispose.call(this), Object.keys(this._touchDots).forEach(function(n) {
+ e._touchDots[n].dispose();
+ });
+ }, t.prototype._getFilenameAndPath = function() {
+ return { filename: this.layout.assetPath, path: this._repositoryUrl + "/profiles/" + this.profileId + "/" };
+ }, t.prototype._getModelLoadingConstraints = function() {
+ var e = zt.IsPluginForExtensionAvailable(".glb");
+ return e || h.a.Warn("glTF / glb loaded was not registered, using generic controller instead"), e;
+ }, t.prototype._processLoadedModel = function(e) {
+ var n = this;
+ this.getComponentIds().forEach(function(i) {
+ var o = n.layout.components[i];
+ n._buttonMeshMapping[i] = { mainMesh: n._getChildByName(n.rootMesh, o.rootNodeName), states: {} }, Object.keys(o.visualResponses).forEach(function(a) {
+ var s = o.visualResponses[a];
+ if (s.valueNodeProperty === "transform")
+ n._buttonMeshMapping[i].states[a] = { valueMesh: n._getChildByName(n.rootMesh, s.valueNodeName), minMesh: n._getChildByName(n.rootMesh, s.minNodeName), maxMesh: n._getChildByName(n.rootMesh, s.maxNodeName) };
+ else {
+ var p = o.type === Oo.TOUCHPAD_TYPE && o.touchPointNodeName ? o.touchPointNodeName : s.valueNodeName;
+ if (n._buttonMeshMapping[i].states[a] = { valueMesh: n._getChildByName(n.rootMesh, p) }, o.type === Oo.TOUCHPAD_TYPE && !n._touchDots[a]) {
+ var m = Qn.a.CreateSphere(a + "dot", { diameter: 15e-4, segments: 8 }, n.scene);
+ m.material = new kt.a(a + "mat", n.scene), m.material.diffuseColor = C.a.Red(), m.parent = n._buttonMeshMapping[i].states[a].valueMesh || null, m.isVisible = !1, n._touchDots[a] = m;
+ }
+ }
+ });
+ });
+ }, t.prototype._setRootMesh = function(e) {
+ var n;
+ this.rootMesh = new we.a(this.profileId + "-" + this.handedness, this.scene), this.rootMesh.isPickable = !1;
+ for (var i = 0; i < e.length; i++) {
+ var o = e[i];
+ o.isPickable = !1, o.parent || (n = o);
+ }
+ n && n.setParent(this.rootMesh), this.scene.useRightHandedSystem || this.rootMesh.rotate(Se.a.Y, Math.PI, Se.c.WORLD);
+ }, t.prototype._updateModel = function(e) {
+ var n = this;
+ this.disableAnimation || this.getComponentIds().forEach(function(i) {
+ var o = n.getComponent(i);
+ if (o.hasChanges) {
+ var a = n._buttonMeshMapping[i], s = n.layout.components[i];
+ Object.keys(s.visualResponses).forEach(function(p) {
+ var m = s.visualResponses[p], S = o.value;
+ if (m.componentProperty === "xAxis" ? S = o.axes.x : m.componentProperty === "yAxis" && (S = o.axes.y), m.valueNodeProperty === "transform")
+ n._lerpTransform(a.states[p], S, m.componentProperty !== "button");
+ else {
+ var O = a.states[p].valueMesh;
+ O && (O.isVisible = o.touched || o.pressed), n._touchDots[p] && (n._touchDots[p].isVisible = o.touched || o.pressed);
+ }
+ });
+ }
+ });
+ }, t;
+ }(Mo), qn = function() {
+ function r() {
+ }
+ return r.ClearProfilesCache = function() {
+ this._ProfilesList = null, this._ProfileLoadingPromises = {};
+ }, r.DefaultFallbacks = function() {
+ this.RegisterFallbacksForProfileId("google-daydream", ["generic-touchpad"]), this.RegisterFallbacksForProfileId("htc-vive-focus", ["generic-trigger-touchpad"]), this.RegisterFallbacksForProfileId("htc-vive", ["generic-trigger-squeeze-touchpad"]), this.RegisterFallbacksForProfileId("magicleap-one", ["generic-trigger-squeeze-touchpad"]), this.RegisterFallbacksForProfileId("windows-mixed-reality", ["generic-trigger-squeeze-touchpad-thumbstick"]), this.RegisterFallbacksForProfileId("microsoft-mixed-reality", ["windows-mixed-reality", "generic-trigger-squeeze-touchpad-thumbstick"]), this.RegisterFallbacksForProfileId("oculus-go", ["generic-trigger-touchpad"]), this.RegisterFallbacksForProfileId("oculus-touch-v2", ["oculus-touch", "generic-trigger-squeeze-thumbstick"]), this.RegisterFallbacksForProfileId("oculus-touch", ["generic-trigger-squeeze-thumbstick"]), this.RegisterFallbacksForProfileId("samsung-gearvr", ["windows-mixed-reality", "generic-trigger-squeeze-touchpad-thumbstick"]), this.RegisterFallbacksForProfileId("samsung-odyssey", ["generic-touchpad"]), this.RegisterFallbacksForProfileId("valve-index", ["generic-trigger-squeeze-touchpad-thumbstick"]);
+ }, r.FindFallbackWithProfileId = function(t) {
+ var e = this._Fallbacks[t] || [];
+ return e.unshift(t), e;
+ }, r.GetMotionControllerWithXRInput = function(t, e, n) {
+ var i = this, o = [];
+ if (n && o.push(n), o.push.apply(o, t.profiles || []), o.length && !o[0] && o.pop(), t.gamepad && t.gamepad.id)
+ switch (t.gamepad.id) {
+ case (t.gamepad.id.match(/oculus touch/gi) ? t.gamepad.id : void 0):
+ o.push("oculus-touch-v2");
+ }
+ var a = o.indexOf("windows-mixed-reality");
+ if (a !== -1 && o.splice(a, 0, "microsoft-mixed-reality"), o.length || o.push("generic-trigger"), this.UseOnlineRepository) {
+ var s = this.PrioritizeOnlineRepository ? this._LoadProfileFromRepository : this._LoadProfilesFromAvailableControllers, p = this.PrioritizeOnlineRepository ? this._LoadProfilesFromAvailableControllers : this._LoadProfileFromRepository;
+ return s.call(this, o, t, e).catch(function() {
+ return p.call(i, o, t, e);
+ });
+ }
+ return this._LoadProfilesFromAvailableControllers(o, t, e);
+ }, r.RegisterController = function(t, e) {
+ this._AvailableControllers[t] = e;
+ }, r.RegisterFallbacksForProfileId = function(t, e) {
+ var n;
+ this._Fallbacks[t] ? (n = this._Fallbacks[t]).push.apply(n, e) : this._Fallbacks[t] = e;
+ }, r.UpdateProfilesList = function() {
+ return this._ProfilesList = Ke.b.LoadFileAsync(this.BaseRepositoryUrl + "/profiles/profilesList.json", !1).then(function(t) {
+ return JSON.parse(t.toString());
+ }), this._ProfilesList;
+ }, r._LoadProfileFromRepository = function(t, e, n) {
+ var i = this;
+ return Promise.resolve().then(function() {
+ return i._ProfilesList ? i._ProfilesList : i.UpdateProfilesList();
+ }).then(function(o) {
+ for (var a = 0; a < t.length; ++a)
+ if (t[a] && o[t[a]])
+ return t[a];
+ throw new Error("neither controller " + t[0] + " nor all fallbacks were found in the repository,");
+ }).then(function(o) {
+ return i._ProfileLoadingPromises[o] || (i._ProfileLoadingPromises[o] = Ke.b.LoadFileAsync(i.BaseRepositoryUrl + "/profiles/" + o + "/profile.json", !1).then(function(a) {
+ return JSON.parse(a);
+ })), i._ProfileLoadingPromises[o];
+ }).then(function(o) {
+ return new Sf(n, e, o, i.BaseRepositoryUrl);
+ });
+ }, r._LoadProfilesFromAvailableControllers = function(t, e, n) {
+ for (var i = 0; i < t.length; ++i)
+ if (t[i])
+ for (var o = this.FindFallbackWithProfileId(t[i]), a = 0; a < o.length; ++a) {
+ var s = this._AvailableControllers[o[a]];
+ if (s)
+ return Promise.resolve(s(e, n));
+ }
+ throw new Error("no controller requested was found in the available controllers list");
+ }, r._AvailableControllers = {}, r._Fallbacks = {}, r._ProfileLoadingPromises = {}, r.BaseRepositoryUrl = "https://immersive-web.github.io/webxr-input-profiles/packages/viewer/dist", r.PrioritizeOnlineRepository = !0, r.UseOnlineRepository = !0, r;
+ }();
+ qn.RegisterController(Gl.ProfileId, function(r, t) {
+ return new Gl(t, r.gamepad, r.handedness);
+ }), qn.DefaultFallbacks();
+ var Iy = 0, Af = function() {
+ function r(t, e, n) {
+ var i = this;
+ n === void 0 && (n = {}), this._scene = t, this.inputSource = e, this._options = n, this._tmpVector = new c.e(), this._disposed = !1, this.onDisposeObservable = new P.c(), this.onMeshLoadedObservable = new P.c(), this.onMotionControllerInitObservable = new P.c(), this._uniqueId = "controller-" + Iy++ + "-" + e.targetRayMode + "-" + e.handedness, this.pointer = new Nt.a(this._uniqueId + "-pointer", t), this.pointer.rotationQuaternion = new c.b(), this.inputSource.gripSpace && (this.grip = new Nt.a(this._uniqueId + "-grip", this._scene), this.grip.rotationQuaternion = new c.b()), this._tmpVector.set(0, 0, this._scene.useRightHandedSystem ? -1 : 1), this.inputSource.gamepad && qn.GetMotionControllerWithXRInput(e, t, this._options.forceControllerProfile).then(function(o) {
+ i.motionController = o, i.onMotionControllerInitObservable.notifyObservers(o), i._options.doNotLoadControllerMesh || i.motionController.loadModel().then(function(a) {
+ var s;
+ a && i.motionController && i.motionController.rootMesh && (i._options.renderingGroupId && (i.motionController.rootMesh.renderingGroupId = i._options.renderingGroupId, i.motionController.rootMesh.getChildMeshes(!1).forEach(function(p) {
+ return p.renderingGroupId = i._options.renderingGroupId;
+ })), i.onMeshLoadedObservable.notifyObservers(i.motionController.rootMesh), i.motionController.rootMesh.parent = i.grip || i.pointer, i.motionController.disableAnimation = !!i._options.disableMotionControllerAnimation), i._disposed && ((s = i.motionController) === null || s === void 0 || s.dispose());
+ });
+ }, function() {
+ Ke.b.Warn("Could not find a matching motion controller for the registered input source");
+ });
+ }
+ return Object.defineProperty(r.prototype, "uniqueId", { get: function() {
+ return this._uniqueId;
+ }, enumerable: !1, configurable: !0 }), r.prototype.dispose = function() {
+ this.grip && this.grip.dispose(), this.motionController && this.motionController.dispose(), this.pointer.dispose(), this.onMotionControllerInitObservable.clear(), this.onMeshLoadedObservable.clear(), this.onDisposeObservable.notifyObservers(this), this.onDisposeObservable.clear(), this._disposed = !0;
+ }, r.prototype.getWorldPointerRayToRef = function(t, e) {
+ e === void 0 && (e = !1);
+ var n = e && this.grip ? this.grip : this.pointer;
+ c.e.TransformNormalToRef(this._tmpVector, n.getWorldMatrix(), t.direction), t.direction.normalize(), t.origin.copyFrom(n.absolutePosition), t.length = 1e3;
+ }, r.prototype.updateFromXRFrame = function(t, e) {
+ var n = t.getPose(this.inputSource.targetRaySpace, e);
+ if (n) {
+ var i = n.transform.position;
+ this.pointer.position.set(i.x, i.y, i.z);
+ var o = n.transform.orientation;
+ this.pointer.rotationQuaternion.set(o.x, o.y, o.z, o.w), this._scene.useRightHandedSystem || (this.pointer.position.z *= -1, this.pointer.rotationQuaternion.z *= -1, this.pointer.rotationQuaternion.w *= -1);
+ }
+ if (this.inputSource.gripSpace && this.grip) {
+ var a = t.getPose(this.inputSource.gripSpace, e);
+ if (a) {
+ i = a.transform.position;
+ var s = a.transform.orientation;
+ this.grip.position.set(i.x, i.y, i.z), this.grip.rotationQuaternion.set(s.x, s.y, s.z, s.w), this._scene.useRightHandedSystem || (this.grip.position.z *= -1, this.grip.rotationQuaternion.z *= -1, this.grip.rotationQuaternion.w *= -1);
+ }
+ }
+ this.motionController && this.motionController.updateFromXRFrame(t);
+ }, r;
+ }(), Pf = function() {
+ function r(t, e, n) {
+ var i = this;
+ if (n === void 0 && (n = {}), this.xrSessionManager = t, this.xrCamera = e, this.options = n, this.controllers = [], this.onControllerAddedObservable = new P.c(), this.onControllerRemovedObservable = new P.c(), this._onInputSourcesChange = function(o) {
+ i._addAndRemoveControllers(o.added, o.removed);
+ }, this._sessionEndedObserver = this.xrSessionManager.onXRSessionEnded.add(function() {
+ i._addAndRemoveControllers([], i.controllers.map(function(o) {
+ return o.inputSource;
+ }));
+ }), this._sessionInitObserver = this.xrSessionManager.onXRSessionInit.add(function(o) {
+ o.addEventListener("inputsourceschange", i._onInputSourcesChange);
+ }), this._frameObserver = this.xrSessionManager.onXRFrameObservable.add(function(o) {
+ i.controllers.forEach(function(a) {
+ a.updateFromXRFrame(o, i.xrSessionManager.referenceSpace);
+ });
+ }), this.options.customControllersRepositoryURL && (qn.BaseRepositoryUrl = this.options.customControllersRepositoryURL), qn.UseOnlineRepository = !this.options.disableOnlineControllerRepository, qn.UseOnlineRepository)
+ try {
+ qn.UpdateProfilesList().catch(function() {
+ qn.UseOnlineRepository = !1;
+ });
+ } catch {
+ qn.UseOnlineRepository = !1;
+ }
+ }
+ return r.prototype._addAndRemoveControllers = function(t, e) {
+ for (var n = this, i = this.controllers.map(function(O) {
+ return O.inputSource;
+ }), o = 0, a = t; o < a.length; o++) {
+ var s = a[o];
+ if (i.indexOf(s) === -1) {
+ var p = new Af(this.xrSessionManager.scene, s, Object(u.a)(Object(u.a)({}, this.options.controllerOptions || {}), { forceControllerProfile: this.options.forceInputProfile, doNotLoadControllerMesh: this.options.doNotLoadControllerMeshes, disableMotionControllerAnimation: this.options.disableControllerAnimation }));
+ this.controllers.push(p), this.onControllerAddedObservable.notifyObservers(p);
+ }
+ }
+ var m = [], S = [];
+ this.controllers.forEach(function(O) {
+ e.indexOf(O.inputSource) === -1 ? m.push(O) : S.push(O);
+ }), this.controllers = m, S.forEach(function(O) {
+ n.onControllerRemovedObservable.notifyObservers(O), O.dispose();
+ });
+ }, r.prototype.dispose = function() {
+ this.controllers.forEach(function(t) {
+ t.dispose();
+ }), this.xrSessionManager.onXRFrameObservable.remove(this._frameObserver), this.xrSessionManager.onXRSessionInit.remove(this._sessionInitObserver), this.xrSessionManager.onXRSessionEnded.remove(this._sessionEndedObserver), this.onControllerAddedObservable.clear(), this.onControllerRemovedObservable.clear();
+ }, r;
+ }(), xi = function() {
+ function r(t) {
+ this._xrSessionManager = t, this._attached = !1, this._removeOnDetach = [], this.isDisposed = !1, this.disableAutoAttach = !1, this.xrNativeFeatureName = "";
+ }
+ return Object.defineProperty(r.prototype, "attached", { get: function() {
+ return this._attached;
+ }, enumerable: !1, configurable: !0 }), r.prototype.attach = function(t) {
+ var e = this;
+ if (this.isDisposed)
+ return !1;
+ if (t)
+ this.attached && this.detach();
+ else if (this.attached)
+ return !1;
+ return this._attached = !0, this._addNewAttachObserver(this._xrSessionManager.onXRFrameObservable, function(n) {
+ return e._onXRFrame(n);
+ }), !0;
+ }, r.prototype.detach = function() {
+ return this._attached ? (this._attached = !1, this._removeOnDetach.forEach(function(t) {
+ t.observable.remove(t.observer);
+ }), !0) : (this.disableAutoAttach = !0, !1);
+ }, r.prototype.dispose = function() {
+ this.detach(), this.isDisposed = !0;
+ }, r.prototype.isCompatible = function() {
+ return !0;
+ }, r.prototype._addNewAttachObserver = function(t, e) {
+ this._removeOnDetach.push({ observable: t, observer: t.add(e) });
+ }, r;
+ }(), xa = function(r) {
+ function t(e, n) {
+ var i = r.call(this, e) || this;
+ return i._options = n, i._attachController = function(o) {
+ if (!i._controllers[o.uniqueId]) {
+ var a = i._generateNewMeshPair(o.pointer), s = a.laserPointer, p = a.selectionMesh;
+ switch (i._controllers[o.uniqueId] = { xrController: o, laserPointer: s, selectionMesh: p, meshUnderPointer: null, pick: null, tmpRay: new An.a(new c.e(), new c.e()), id: t._idCounter++ }, i._attachedController ? !i._options.enablePointerSelectionOnAllControllers && i._options.preferredHandedness && o.inputSource.handedness === i._options.preferredHandedness && (i._attachedController = o.uniqueId) : i._options.enablePointerSelectionOnAllControllers || (i._attachedController = o.uniqueId), o.inputSource.targetRayMode) {
+ case "tracked-pointer":
+ return i._attachTrackedPointerRayMode(o);
+ case "gaze":
+ return i._attachGazeMode(o);
+ case "screen":
+ return i._attachScreenRayMode(o);
+ }
+ }
+ }, i._controllers = {}, i._tmpVectorForPickCompare = new c.e(), i.disablePointerLighting = !0, i.disableSelectionMeshLighting = !0, i.displayLaserPointer = !0, i.displaySelectionMesh = !0, i.laserPointerPickedColor = new C.a(0.9, 0.9, 0.9), i.laserPointerDefaultColor = new C.a(0.7, 0.7, 0.7), i.selectionMeshDefaultColor = new C.a(0.8, 0.8, 0.8), i.selectionMeshPickedColor = new C.a(0.3, 0.3, 1), i._identityMatrix = c.a.Identity(), i._screenCoordinatesRef = c.e.Zero(), i._viewportRef = new li.a(0, 0, 0, 0), i._scene = i._xrSessionManager.scene, i;
+ }
+ return Object(u.d)(t, r), t.prototype.attach = function() {
+ var e = this;
+ if (!r.prototype.attach.call(this))
+ return !1;
+ if (this._options.xrInput.controllers.forEach(this._attachController), this._addNewAttachObserver(this._options.xrInput.onControllerAddedObservable, this._attachController), this._addNewAttachObserver(this._options.xrInput.onControllerRemovedObservable, function(s) {
+ e._detachController(s.uniqueId);
+ }), this._scene.constantlyUpdateMeshUnderPointer = !0, this._options.gazeCamera) {
+ var n = this._options.gazeCamera, i = this._generateNewMeshPair(n), o = i.laserPointer, a = i.selectionMesh;
+ this._controllers.camera = { webXRCamera: n, laserPointer: o, selectionMesh: a, meshUnderPointer: null, pick: null, tmpRay: new An.a(new c.e(), new c.e()), id: t._idCounter++ }, this._attachGazeMode();
+ }
+ return !0;
+ }, t.prototype.detach = function() {
+ var e = this;
+ return !!r.prototype.detach.call(this) && (Object.keys(this._controllers).forEach(function(n) {
+ e._detachController(n);
+ }), !0);
+ }, t.prototype.getMeshUnderPointer = function(e) {
+ return this._controllers[e] ? this._controllers[e].meshUnderPointer : null;
+ }, t.prototype.getXRControllerByPointerId = function(e) {
+ for (var n = Object.keys(this._controllers), i = 0; i < n.length; ++i)
+ if (this._controllers[n[i]].id === e)
+ return this._controllers[n[i]].xrController || null;
+ return null;
+ }, t.prototype._onXRFrame = function(e) {
+ var n = this;
+ Object.keys(this._controllers).forEach(function(i) {
+ var o, a = n._controllers[i];
+ if (!n._options.enablePointerSelectionOnAllControllers && i !== n._attachedController)
+ return a.selectionMesh.isVisible = !1, a.laserPointer.isVisible = !1, void (a.pick = null);
+ if (a.laserPointer.isVisible = n.displayLaserPointer, a.xrController)
+ o = a.xrController.pointer.position, a.xrController.getWorldPointerRayToRef(a.tmpRay);
+ else {
+ if (!a.webXRCamera)
+ return;
+ o = a.webXRCamera.position, a.webXRCamera.getForwardRayToRef(a.tmpRay);
+ }
+ if (n._options.maxPointerDistance && (a.tmpRay.length = n._options.maxPointerDistance), !n._options.disableScenePointerVectorUpdate && o) {
+ var s = n._xrSessionManager.scene, p = n._options.xrInput.xrCamera;
+ p && (p.viewport.toGlobalToRef(s.getEngine().getRenderWidth(), s.getEngine().getRenderHeight(), n._viewportRef), c.e.ProjectToRef(o, n._identityMatrix, s.getTransformMatrix(), n._viewportRef, n._screenCoordinatesRef), s.pointerX = n._screenCoordinatesRef.x, s.pointerY = n._screenCoordinatesRef.y);
+ }
+ a.pick = n._scene.pickWithRay(a.tmpRay, n._scene.pointerMovePredicate || n.raySelectionPredicate);
+ var m = a.pick;
+ if (m && m.pickedPoint && m.hit) {
+ n._updatePointerDistance(a.laserPointer, m.distance), a.selectionMesh.position.copyFrom(m.pickedPoint), a.selectionMesh.scaling.x = Math.sqrt(m.distance), a.selectionMesh.scaling.y = Math.sqrt(m.distance), a.selectionMesh.scaling.z = Math.sqrt(m.distance);
+ var S = n._convertNormalToDirectionOfRay(m.getNormal(!0), a.tmpRay);
+ if (a.selectionMesh.position.copyFrom(m.pickedPoint), S) {
+ var O = c.e.Cross(Se.a.Y, S), I = c.e.Cross(S, O);
+ c.e.RotationFromAxisToRef(I, S, O, a.selectionMesh.rotation), a.selectionMesh.position.addInPlace(S.scale(1e-3));
+ }
+ a.selectionMesh.isVisible = n.displaySelectionMesh, a.meshUnderPointer = m.pickedMesh;
+ } else
+ a.selectionMesh.isVisible = !1, n._updatePointerDistance(a.laserPointer, 1), a.meshUnderPointer = null;
+ });
+ }, t.prototype._attachGazeMode = function(e) {
+ var n = this, i = this._controllers[e && e.uniqueId || "camera"], o = this._options.timeToSelect || 3e3, a = this._options.useUtilityLayer ? this._options.customUtilityLayerScene || Gn.a.DefaultUtilityLayer.utilityLayerScene : this._scene, s = new Wr.a(), p = bo.CreateTorus("selection", { diameter: 0.0525, thickness: 0.015, tessellation: 20 }, a);
+ p.isVisible = !1, p.isPickable = !1, p.parent = i.selectionMesh;
+ var m = 0, S = !1;
+ i.onFrameObserver = this._xrSessionManager.onXRFrameObservable.add(function() {
+ if (i.pick) {
+ if (i.laserPointer.material.alpha = 0, p.isVisible = !1, i.pick.hit)
+ if (n._pickingMoved(s, i.pick))
+ S && (n._options.disablePointerUpOnTouchOut || n._scene.simulatePointerUp(i.pick, { pointerId: i.id })), S = !1, m = 0;
+ else if (m > o / 10 && (p.isVisible = !0), (m += n._scene.getEngine().getDeltaTime()) >= o)
+ n._scene.simulatePointerDown(i.pick, { pointerId: i.id }), S = !0, n._options.disablePointerUpOnTouchOut && n._scene.simulatePointerUp(i.pick, { pointerId: i.id }), p.isVisible = !1;
+ else {
+ var O = 1 - m / o;
+ p.scaling.set(O, O, O);
+ }
+ else
+ S = !1, m = 0;
+ n._scene.simulatePointerMove(i.pick, { pointerId: i.id }), s = i.pick;
+ }
+ }), this._options.renderingGroupId !== void 0 && (p.renderingGroupId = this._options.renderingGroupId), e && e.onDisposeObservable.addOnce(function() {
+ i.pick && !n._options.disablePointerUpOnTouchOut && S && n._scene.simulatePointerUp(i.pick, { pointerId: i.id }), p.dispose();
+ });
+ }, t.prototype._attachScreenRayMode = function(e) {
+ var n = this, i = this._controllers[e.uniqueId], o = !1;
+ i.onFrameObserver = this._xrSessionManager.onXRFrameObservable.add(function() {
+ !i.pick || n._options.disablePointerUpOnTouchOut && o || (o ? n._scene.simulatePointerMove(i.pick, { pointerId: i.id }) : (n._scene.simulatePointerDown(i.pick, { pointerId: i.id }), o = !0, n._options.disablePointerUpOnTouchOut && n._scene.simulatePointerUp(i.pick, { pointerId: i.id })));
+ }), e.onDisposeObservable.addOnce(function() {
+ i.pick && o && !n._options.disablePointerUpOnTouchOut && n._scene.simulatePointerUp(i.pick, { pointerId: i.id });
+ });
+ }, t.prototype._attachTrackedPointerRayMode = function(e) {
+ var n = this, i = this._controllers[e.uniqueId];
+ if (this._options.forceGazeMode)
+ return this._attachGazeMode(e);
+ if (i.onFrameObserver = this._xrSessionManager.onXRFrameObservable.add(function() {
+ i.laserPointer.material.disableLighting = n.disablePointerLighting, i.selectionMesh.material.disableLighting = n.disableSelectionMeshLighting, i.pick && n._scene.simulatePointerMove(i.pick, { pointerId: i.id });
+ }), e.inputSource.gamepad) {
+ var o = function(p) {
+ n._options.overrideButtonId && (i.selectionComponent = p.getComponent(n._options.overrideButtonId)), i.selectionComponent || (i.selectionComponent = p.getMainComponent()), i.onButtonChangedObserver = i.selectionComponent.onButtonStateChangedObservable.add(function(m) {
+ if (m.changes.pressed) {
+ var S = m.changes.pressed.current;
+ i.pick ? (n._options.enablePointerSelectionOnAllControllers || e.uniqueId === n._attachedController) && (S ? (n._scene.simulatePointerDown(i.pick, { pointerId: i.id }), i.selectionMesh.material.emissiveColor = n.selectionMeshPickedColor, i.laserPointer.material.emissiveColor = n.laserPointerPickedColor) : (n._scene.simulatePointerUp(i.pick, { pointerId: i.id }), i.selectionMesh.material.emissiveColor = n.selectionMeshDefaultColor, i.laserPointer.material.emissiveColor = n.laserPointerDefaultColor)) : !S || n._options.enablePointerSelectionOnAllControllers || n._options.disableSwitchOnClick || (n._attachedController = e.uniqueId);
+ }
+ });
+ };
+ e.motionController ? o(e.motionController) : e.onMotionControllerInitObservable.add(o);
+ } else {
+ var a = function(p) {
+ i.xrController && p.inputSource === i.xrController.inputSource && i.pick && (n._scene.simulatePointerDown(i.pick, { pointerId: i.id }), i.selectionMesh.material.emissiveColor = n.selectionMeshPickedColor, i.laserPointer.material.emissiveColor = n.laserPointerPickedColor);
+ }, s = function(p) {
+ i.xrController && p.inputSource === i.xrController.inputSource && i.pick && (n._scene.simulatePointerUp(i.pick, { pointerId: i.id }), i.selectionMesh.material.emissiveColor = n.selectionMeshDefaultColor, i.laserPointer.material.emissiveColor = n.laserPointerDefaultColor);
+ };
+ i.eventListeners = { selectend: s, selectstart: a }, this._xrSessionManager.session.addEventListener("selectstart", a), this._xrSessionManager.session.addEventListener("selectend", s);
+ }
+ }, t.prototype._convertNormalToDirectionOfRay = function(e, n) {
+ return e && Math.acos(c.e.Dot(e, n.direction)) < Math.PI / 2 && e.scaleInPlace(-1), e;
+ }, t.prototype._detachController = function(e) {
+ var n = this, i = this._controllers[e];
+ if (i && (i.selectionComponent && i.onButtonChangedObserver && i.selectionComponent.onButtonStateChangedObservable.remove(i.onButtonChangedObserver), i.onFrameObserver && this._xrSessionManager.onXRFrameObservable.remove(i.onFrameObserver), i.eventListeners && Object.keys(i.eventListeners).forEach(function(a) {
+ var s = i.eventListeners && i.eventListeners[a];
+ s && n._xrSessionManager.session.removeEventListener(a, s);
+ }), i.selectionMesh.dispose(), i.laserPointer.dispose(), delete this._controllers[e], this._attachedController === e)) {
+ var o = Object.keys(this._controllers);
+ o.length ? this._attachedController = o[0] : this._attachedController = "";
+ }
+ }, t.prototype._generateNewMeshPair = function(e) {
+ var n = this._options.useUtilityLayer ? this._options.customUtilityLayerScene || Gn.a.DefaultUtilityLayer.utilityLayerScene : this._scene, i = Vi.a.CreateCylinder("laserPointer", { height: 1, diameterTop: 2e-4, diameterBottom: 4e-3, tessellation: 20, subdivisions: 1 }, n);
+ i.parent = e;
+ var o = new kt.a("laserPointerMat", n);
+ o.emissiveColor = this.laserPointerDefaultColor, o.alpha = 0.7, i.material = o, i.rotation.x = Math.PI / 2, this._updatePointerDistance(i, 1), i.isPickable = !1;
+ var a = bo.CreateTorus("gazeTracker", { diameter: 0.0105, thickness: 75e-4, tessellation: 20 }, n);
+ a.bakeCurrentTransformIntoVertices(), a.isPickable = !1, a.isVisible = !1;
+ var s = new kt.a("targetMat", n);
+ return s.specularColor = C.a.Black(), s.emissiveColor = this.selectionMeshDefaultColor, s.backFaceCulling = !1, a.material = s, this._options.renderingGroupId !== void 0 && (i.renderingGroupId = this._options.renderingGroupId, a.renderingGroupId = this._options.renderingGroupId), { laserPointer: i, selectionMesh: a };
+ }, t.prototype._pickingMoved = function(e, n) {
+ var i;
+ if (!e.hit || !n.hit || !(e.pickedMesh && e.pickedPoint && n.pickedMesh && n.pickedPoint) || e.pickedMesh !== n.pickedMesh)
+ return !0;
+ (i = e.pickedPoint) === null || i === void 0 || i.subtractToRef(n.pickedPoint, this._tmpVectorForPickCompare), this._tmpVectorForPickCompare.set(Math.abs(this._tmpVectorForPickCompare.x), Math.abs(this._tmpVectorForPickCompare.y), Math.abs(this._tmpVectorForPickCompare.z));
+ var o = 0.01 * (this._options.gazeModePointerMovedFactor || 1) * n.distance;
+ return this._tmpVectorForPickCompare.length() > o;
+ }, t.prototype._updatePointerDistance = function(e, n) {
+ n === void 0 && (n = 100), e.scaling.y = n, this._scene.useRightHandedSystem && (n *= -1), e.position.z = n / 2 + 0.05;
+ }, Object.defineProperty(t.prototype, "lasterPointerDefaultColor", { get: function() {
+ return this.laserPointerDefaultColor;
+ }, enumerable: !1, configurable: !0 }), t._idCounter = 200, t.Name = Ci.POINTER_SELECTION, t.Version = 1, t;
+ }(xi);
+ hi.AddWebXRFeature(xa.Name, function(r, t) {
+ return function() {
+ return new xa(r, t);
+ };
+ }, xa.Version, !0);
+ var Er, Cf = function() {
+ function r(t, e, n) {
+ this.element = t, this.sessionMode = e, this.referenceSpaceType = n;
+ }
+ return r.prototype.update = function(t) {
+ }, r;
+ }(), Dy = function() {
+ }, xf = function() {
+ function r(t, e) {
+ var n = this;
+ if (this.scene = t, this.options = e, this._activeButton = null, this._buttons = [], this.activeButtonChangedObservable = new P.c(), this.overlay = document.createElement("div"), this.overlay.classList.add("xr-button-overlay"), this.overlay.style.cssText = "z-index:11;position: absolute; right: 20px;bottom: 50px;", typeof window < "u" && window.location && window.location.protocol === "http:" && Ke.b.Warn("WebXR can only be served over HTTPS"), e.customButtons)
+ this._buttons = e.customButtons;
+ else {
+ var i = e.sessionMode || "immersive-vr", o = e.referenceSpaceType || "local-floor", a = ".babylonVRicon { color: #868686; border-color: #868686; border-style: solid; margin-left: 10px; height: 50px; width: 80px; background-color: rgba(51,51,51,0.7); background-image: url(" + (typeof SVGSVGElement > "u" ? "https://cdn.babylonjs.com/Assets/vrButton.png" : "data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%222048%22%20height%3D%221152%22%20viewBox%3D%220%200%202048%201152%22%20version%3D%221.1%22%3E%3Cpath%20transform%3D%22rotate%28180%201024%2C576.0000000000001%29%22%20d%3D%22m1109%2C896q17%2C0%2030%2C-12t13%2C-30t-12.5%2C-30.5t-30.5%2C-12.5l-170%2C0q-18%2C0%20-30.5%2C12.5t-12.5%2C30.5t13%2C30t30%2C12l170%2C0zm-85%2C256q59%2C0%20132.5%2C-1.5t154.5%2C-5.5t164.5%2C-11.5t163%2C-20t150%2C-30t124.5%2C-41.5q23%2C-11%2042%2C-24t38%2C-30q27%2C-25%2041%2C-61.5t14%2C-72.5l0%2C-257q0%2C-123%20-47%2C-232t-128%2C-190t-190%2C-128t-232%2C-47l-81%2C0q-37%2C0%20-68.5%2C14t-60.5%2C34.5t-55.5%2C45t-53%2C45t-53%2C34.5t-55.5%2C14t-55.5%2C-14t-53%2C-34.5t-53%2C-45t-55.5%2C-45t-60.5%2C-34.5t-68.5%2C-14l-81%2C0q-123%2C0%20-232%2C47t-190%2C128t-128%2C190t-47%2C232l0%2C257q0%2C68%2038%2C115t97%2C73q54%2C24%20124.5%2C41.5t150%2C30t163%2C20t164.5%2C11.5t154.5%2C5.5t132.5%2C1.5zm939%2C-298q0%2C39%20-24.5%2C67t-58.5%2C42q-54%2C23%20-122%2C39.5t-143.5%2C28t-155.5%2C19t-157%2C11t-148.5%2C5t-129.5%2C1.5q-59%2C0%20-130%2C-1.5t-148%2C-5t-157%2C-11t-155.5%2C-19t-143.5%2C-28t-122%2C-39.5q-34%2C-14%20-58.5%2C-42t-24.5%2C-67l0%2C-257q0%2C-106%2040.5%2C-199t110%2C-162.5t162.5%2C-109.5t199%2C-40l81%2C0q27%2C0%2052%2C14t50%2C34.5t51%2C44.5t55.5%2C44.5t63.5%2C34.5t74%2C14t74%2C-14t63.5%2C-34.5t55.5%2C-44.5t51%2C-44.5t50%2C-34.5t52%2C-14l14%2C0q37%2C0%2070%2C0.5t64.5%2C4.5t63.5%2C12t68%2C23q71%2C30%20128.5%2C78.5t98.5%2C110t63.5%2C133.5t22.5%2C149l0%2C257z%22%20fill%3D%22white%22%20/%3E%3C/svg%3E%0A") + "); background-size: 80%; background-repeat:no-repeat; background-position: center; border: none; outline: none; transition: transform 0.125s ease-out } .babylonVRicon:hover { transform: scale(1.05) } .babylonVRicon:active {background-color: rgba(51,51,51,1) } .babylonVRicon:focus {background-color: rgba(51,51,51,1) }";
+ a += '.babylonVRicon.vrdisplaypresenting { background-image: none;} .vrdisplaypresenting::after { content: "EXIT"} .xr-error::after { content: "ERROR"}';
+ var s = document.createElement("style");
+ s.appendChild(document.createTextNode(a)), document.getElementsByTagName("head")[0].appendChild(s);
+ var p = document.createElement("button");
+ p.className = "babylonVRicon", p.title = i + " - " + o, this._buttons.push(new Cf(p, i, o)), this._buttons[this._buttons.length - 1].update = function(S) {
+ this.element.style.display = S === null || S === this ? "" : "none", p.className = "babylonVRicon" + (S === this ? " vrdisplaypresenting" : "");
+ }, this._updateButtons(null);
+ }
+ var m = t.getEngine().getInputElement();
+ m && m.parentNode && (m.parentNode.appendChild(this.overlay), t.onDisposeObservable.addOnce(function() {
+ n.dispose();
+ }));
+ }
+ return r.CreateAsync = function(t, e, n) {
+ var i = this, o = new r(t, n), a = o._buttons.map(function(s) {
+ return e.sessionManager.isSessionSupportedAsync(s.sessionMode);
+ });
+ return e.onStateChangedObservable.add(function(s) {
+ s == Pn.NOT_IN_XR && o._updateButtons(null);
+ }), Promise.all(a).then(function(s) {
+ return s.forEach(function(p, m) {
+ p ? (o.overlay.appendChild(o._buttons[m].element), o._buttons[m].element.onclick = function() {
+ return Object(u.b)(i, void 0, void 0, function() {
+ var S, O, I;
+ return Object(u.e)(this, function(G) {
+ switch (G.label) {
+ case 0:
+ return e.state != Pn.IN_XR ? [3, 2] : [4, e.exitXRAsync()];
+ case 1:
+ return G.sent(), o._updateButtons(null), [3, 6];
+ case 2:
+ if (e.state != Pn.NOT_IN_XR)
+ return [3, 6];
+ if (!n.renderTarget)
+ return [3, 6];
+ G.label = 3;
+ case 3:
+ return G.trys.push([3, 5, , 6]), [4, e.enterXRAsync(o._buttons[m].sessionMode, o._buttons[m].referenceSpaceType, n.renderTarget, { optionalFeatures: n.optionalFeatures, requiredFeatures: n.requiredFeatures })];
+ case 4:
+ return G.sent(), o._updateButtons(o._buttons[m]), [3, 6];
+ case 5:
+ return S = G.sent(), o._updateButtons(null), O = o._buttons[m].element, I = O.title, O.title = "Error entering XR session : " + I, O.classList.add("xr-error"), n.onError && n.onError(S), [3, 6];
+ case 6:
+ return [2];
+ }
+ });
+ });
+ }) : Ke.b.Warn('Session mode "' + o._buttons[m].sessionMode + '" not supported in browser');
+ }), o;
+ });
+ }, r.prototype.dispose = function() {
+ var t = this.scene.getEngine().getInputElement();
+ t && t.parentNode && t.parentNode.contains(this.overlay) && t.parentNode.removeChild(this.overlay), this.activeButtonChangedObservable.clear();
+ }, r.prototype._updateButtons = function(t) {
+ var e = this;
+ this._activeButton = t, this._buttons.forEach(function(n) {
+ n.update(e._activeButton);
+ }), this.activeButtonChangedObservable.notifyObservers(this._activeButton);
+ }, r;
+ }();
+ function zl(r) {
+ var t, e = 0, n = Date.now();
+ r.observableParameters = (t = r.observableParameters) !== null && t !== void 0 ? t : {};
+ var i = r.contextObservable.add(function(o) {
+ var a = Date.now(), s = { startTime: n, currentTime: a, deltaTime: e = a - n, completeRate: e / r.timeout, payload: o };
+ r.onTick && r.onTick(s), r.breakCondition && r.breakCondition() && (r.contextObservable.remove(i), r.onAborted && r.onAborted(s)), e >= r.timeout && (r.contextObservable.remove(i), r.onEnded && r.onEnded(s));
+ }, r.observableParameters.mask, r.observableParameters.insertFirst, r.observableParameters.scope);
+ return i;
+ }
+ (function(r) {
+ r[r.INIT = 0] = "INIT", r[r.STARTED = 1] = "STARTED", r[r.ENDED = 2] = "ENDED";
+ })(Er || (Er = {}));
+ var Ly = function() {
+ function r(t) {
+ var e, n, i = this;
+ this.onEachCountObservable = new P.c(), this.onTimerAbortedObservable = new P.c(), this.onTimerEndedObservable = new P.c(), this.onStateChangedObservable = new P.c(), this._observer = null, this._breakOnNextTick = !1, this._tick = function(o) {
+ var a = Date.now();
+ i._timer = a - i._startTime;
+ var s = { startTime: i._startTime, currentTime: a, deltaTime: i._timer, completeRate: i._timer / i._timeToEnd, payload: o }, p = i._breakOnNextTick || i._breakCondition(s);
+ p || i._timer >= i._timeToEnd ? i._stop(s, p) : i.onEachCountObservable.notifyObservers(s);
+ }, this._setState(Er.INIT), this._contextObservable = t.contextObservable, this._observableParameters = (e = t.observableParameters) !== null && e !== void 0 ? e : {}, this._breakCondition = (n = t.breakCondition) !== null && n !== void 0 ? n : function() {
+ return !1;
+ }, t.onEnded && this.onTimerEndedObservable.add(t.onEnded), t.onTick && this.onEachCountObservable.add(t.onTick), t.onAborted && this.onTimerAbortedObservable.add(t.onAborted);
+ }
+ return Object.defineProperty(r.prototype, "breakCondition", { set: function(t) {
+ this._breakCondition = t;
+ }, enumerable: !1, configurable: !0 }), r.prototype.clearObservables = function() {
+ this.onEachCountObservable.clear(), this.onTimerAbortedObservable.clear(), this.onTimerEndedObservable.clear(), this.onStateChangedObservable.clear();
+ }, r.prototype.start = function(t) {
+ if (t === void 0 && (t = this._timeToEnd), this._state === Er.STARTED)
+ throw new Error("Timer already started. Please stop it before starting again");
+ this._timeToEnd = t, this._startTime = Date.now(), this._timer = 0, this._observer = this._contextObservable.add(this._tick, this._observableParameters.mask, this._observableParameters.insertFirst, this._observableParameters.scope), this._setState(Er.STARTED);
+ }, r.prototype.stop = function() {
+ this._state === Er.STARTED && (this._breakOnNextTick = !0);
+ }, r.prototype.dispose = function() {
+ this._observer && this._contextObservable.remove(this._observer), this.clearObservables();
+ }, r.prototype._setState = function(t) {
+ this._state = t, this.onStateChangedObservable.notifyObservers(this._state);
+ }, r.prototype._stop = function(t, e) {
+ e === void 0 && (e = !1), this._contextObservable.remove(this._observer), this._setState(Er.ENDED), e ? this.onTimerAbortedObservable.notifyObservers(t) : this.onTimerEndedObservable.notifyObservers(t);
+ }, r;
+ }(), Ra = function(r) {
+ function t(e, n) {
+ var i = r.call(this, e) || this;
+ return i._options = n, i._controllers = {}, i._snappedToPoint = !1, i._tmpRay = new An.a(new c.e(), new c.e()), i._tmpVector = new c.e(), i._tmpQuaternion = new c.b(), i.backwardsMovementEnabled = !0, i.backwardsTeleportationDistance = 0.7, i.parabolicCheckRadius = 5, i.parabolicRayEnabled = !0, i.straightRayEnabled = !0, i.rotationAngle = Math.PI / 8, i._rotationEnabled = !0, i._attachController = function(o) {
+ if (!(i._controllers[o.uniqueId] || i._options.forceHandedness && o.inputSource.handedness !== i._options.forceHandedness)) {
+ i._controllers[o.uniqueId] = { xrController: o, teleportationState: { forward: !1, backwards: !1, rotating: !1, currentRotation: 0, baseRotation: 0 } };
+ var a = i._controllers[o.uniqueId];
+ if (a.xrController.inputSource.targetRayMode === "tracked-pointer" && a.xrController.inputSource.gamepad) {
+ var s = function() {
+ if (o.motionController) {
+ var p = o.motionController.getComponentOfType(Oo.THUMBSTICK_TYPE) || o.motionController.getComponentOfType(Oo.TOUCHPAD_TYPE);
+ if (!p || i._options.useMainComponentOnly) {
+ var m = o.motionController.getMainComponent();
+ if (!m)
+ return;
+ a.teleportationComponent = m, a.onButtonChangedObserver = m.onButtonStateChangedObservable.add(function() {
+ m.changes.pressed && (m.changes.pressed.current ? (a.teleportationState.forward = !0, i._currentTeleportationControllerId = a.xrController.uniqueId, a.teleportationState.baseRotation = i._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y, a.teleportationState.currentRotation = 0, zl({ timeout: i._options.timeToTeleport || 3e3, contextObservable: i._xrSessionManager.onXRFrameObservable, breakCondition: function() {
+ return !m.pressed;
+ }, onEnded: function() {
+ i._currentTeleportationControllerId === a.xrController.uniqueId && a.teleportationState.forward && i._teleportForward(o.uniqueId);
+ } })) : (a.teleportationState.forward = !1, i._currentTeleportationControllerId = ""));
+ });
+ } else
+ a.teleportationComponent = p, a.onAxisChangedObserver = p.onAxisValueChangedObservable.add(function(S) {
+ if (S.y <= 0.7 && a.teleportationState.backwards && (a.teleportationState.backwards = !1), S.y > 0.7 && !a.teleportationState.forward && i.backwardsMovementEnabled && !i.snapPointsOnly && !a.teleportationState.backwards) {
+ a.teleportationState.backwards = !0, i._tmpQuaternion.copyFrom(i._options.xrInput.xrCamera.rotationQuaternion), i._tmpQuaternion.toEulerAnglesToRef(i._tmpVector), i._tmpVector.x = 0, i._tmpVector.z = 0, c.b.FromEulerVectorToRef(i._tmpVector, i._tmpQuaternion), i._tmpVector.set(0, 0, i.backwardsTeleportationDistance * (i._xrSessionManager.scene.useRightHandedSystem ? 1 : -1)), i._tmpVector.rotateByQuaternionToRef(i._tmpQuaternion, i._tmpVector), i._tmpVector.addInPlace(i._options.xrInput.xrCamera.position), i._tmpRay.origin.copyFrom(i._tmpVector), i._tmpRay.length = i._options.xrInput.xrCamera.realWorldHeight + 0.1, i._tmpRay.direction.set(0, -1, 0);
+ var O = i._xrSessionManager.scene.pickWithRay(i._tmpRay, function(G) {
+ return i._floorMeshes.indexOf(G) !== -1;
+ });
+ O && O.pickedPoint && (i._options.xrInput.xrCamera.position.x = O.pickedPoint.x, i._options.xrInput.xrCamera.position.z = O.pickedPoint.z);
+ }
+ if (S.y < -0.7 && !i._currentTeleportationControllerId && !a.teleportationState.rotating && (a.teleportationState.forward = !0, i._currentTeleportationControllerId = a.xrController.uniqueId, a.teleportationState.baseRotation = i._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y), S.x) {
+ if (a.teleportationState.forward)
+ i._currentTeleportationControllerId === a.xrController.uniqueId && (i.rotationEnabled ? setTimeout(function() {
+ a.teleportationState.currentRotation = Math.atan2(S.x, S.y * (i._xrSessionManager.scene.useRightHandedSystem ? 1 : -1));
+ }) : a.teleportationState.currentRotation = 0);
+ else if (!a.teleportationState.rotating && Math.abs(S.x) > 0.7) {
+ a.teleportationState.rotating = !0;
+ var I = i.rotationAngle * (S.x > 0 ? 1 : -1) * (i._xrSessionManager.scene.useRightHandedSystem ? -1 : 1);
+ i._options.xrInput.xrCamera.rotationQuaternion.multiplyInPlace(c.b.FromEulerAngles(0, I, 0));
+ }
+ } else
+ a.teleportationState.rotating = !1;
+ S.x === 0 && S.y === 0 && a.teleportationState.forward && i._teleportForward(o.uniqueId);
+ });
+ }
+ };
+ o.motionController ? s() : o.onMotionControllerInitObservable.addOnce(function() {
+ s();
+ });
+ } else
+ i._xrSessionManager.scene.onPointerObservable.add(function(p) {
+ p.type === Et.a.POINTERDOWN ? (a.teleportationState.forward = !0, i._currentTeleportationControllerId = a.xrController.uniqueId, a.teleportationState.baseRotation = i._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y, a.teleportationState.currentRotation = 0, zl({ timeout: i._options.timeToTeleport || 3e3, contextObservable: i._xrSessionManager.onXRFrameObservable, onEnded: function() {
+ i._currentTeleportationControllerId === a.xrController.uniqueId && a.teleportationState.forward && i._teleportForward(o.uniqueId);
+ } })) : p.type === Et.a.POINTERUP && (a.teleportationState.forward = !1, i._currentTeleportationControllerId = "");
+ });
+ }
+ }, i._options.teleportationTargetMesh || i._createDefaultTargetMesh(), i._floorMeshes = i._options.floorMeshes || [], i._snapToPositions = i._options.snapPositions || [], i._setTargetMeshVisibility(!1), i;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "rotationEnabled", { get: function() {
+ return this._rotationEnabled;
+ }, set: function(e) {
+ if (this._rotationEnabled = e, this._options.teleportationTargetMesh) {
+ var n = this._options.teleportationTargetMesh.getChildMeshes(!1, function(i) {
+ return i.name === "rotationCone";
+ });
+ n[0] && n[0].setEnabled(e);
+ }
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "teleportationTargetMesh", { get: function() {
+ return this._options.teleportationTargetMesh || null;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "snapPointsOnly", { get: function() {
+ return !!this._options.snapPointsOnly;
+ }, set: function(e) {
+ this._options.snapPointsOnly = e;
+ }, enumerable: !1, configurable: !0 }), t.prototype.addFloorMesh = function(e) {
+ this._floorMeshes.push(e);
+ }, t.prototype.addSnapPoint = function(e) {
+ this._snapToPositions.push(e);
+ }, t.prototype.attach = function() {
+ var e = this;
+ return !!r.prototype.attach.call(this) && (this._currentTeleportationControllerId = "", this._options.xrInput.controllers.forEach(this._attachController), this._addNewAttachObserver(this._options.xrInput.onControllerAddedObservable, this._attachController), this._addNewAttachObserver(this._options.xrInput.onControllerRemovedObservable, function(n) {
+ e._detachController(n.uniqueId);
+ }), !0);
+ }, t.prototype.detach = function() {
+ var e = this;
+ return !!r.prototype.detach.call(this) && (Object.keys(this._controllers).forEach(function(n) {
+ e._detachController(n);
+ }), this._setTargetMeshVisibility(!1), this._currentTeleportationControllerId = "", this._controllers = {}, !0);
+ }, t.prototype.dispose = function() {
+ r.prototype.dispose.call(this), this._options.teleportationTargetMesh && this._options.teleportationTargetMesh.dispose(!1, !0);
+ }, t.prototype.removeFloorMesh = function(e) {
+ var n = this._floorMeshes.indexOf(e);
+ n !== -1 && this._floorMeshes.splice(n, 1);
+ }, t.prototype.removeFloorMeshByName = function(e) {
+ var n = this._xrSessionManager.scene.getMeshByName(e);
+ n && this.removeFloorMesh(n);
+ }, t.prototype.removeSnapPoint = function(e) {
+ var n = this._snapToPositions.indexOf(e);
+ if (n === -1) {
+ for (var i = 0; i < this._snapToPositions.length; ++i)
+ if (this._snapToPositions[i].equals(e)) {
+ n = i;
+ break;
+ }
+ }
+ return n !== -1 && (this._snapToPositions.splice(n, 1), !0);
+ }, t.prototype.setSelectionFeature = function(e) {
+ this._selectionFeature = e;
+ }, t.prototype._onXRFrame = function(e) {
+ var n = this, i = this._xrSessionManager.currentFrame, o = this._xrSessionManager.scene;
+ if (this.attach && i) {
+ var a = this._options.teleportationTargetMesh;
+ if (this._currentTeleportationControllerId) {
+ if (!a)
+ return;
+ a.rotationQuaternion = a.rotationQuaternion || new c.b();
+ var s = this._controllers[this._currentTeleportationControllerId];
+ if (s && s.teleportationState.forward) {
+ c.b.RotationYawPitchRollToRef(s.teleportationState.currentRotation + s.teleportationState.baseRotation, 0, 0, a.rotationQuaternion);
+ var p = !1;
+ if (s.xrController.getWorldPointerRayToRef(this._tmpRay), this.straightRayEnabled) {
+ if ((m = o.pickWithRay(this._tmpRay, function(G) {
+ if (n._options.pickBlockerMeshes && n._options.pickBlockerMeshes.indexOf(G) !== -1)
+ return !0;
+ var k = n._floorMeshes.indexOf(G);
+ return k !== -1 && n._floorMeshes[k].absolutePosition.y < n._options.xrInput.xrCamera.position.y;
+ })) && m.pickedMesh && this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(m.pickedMesh) !== -1)
+ return;
+ m && m.pickedPoint && (p = !0, this._setTargetMeshPosition(m.pickedPoint), this._setTargetMeshVisibility(!0), this._showParabolicPath(m));
+ }
+ if (this.parabolicRayEnabled && !p) {
+ var m, S = s.xrController.pointer.rotationQuaternion.toEulerAngles().x, O = Math.PI / 2 - Math.abs(S) + 1, I = this.parabolicCheckRadius * O;
+ if (this._tmpRay.origin.addToRef(this._tmpRay.direction.scale(2 * I), this._tmpVector), this._tmpVector.y = this._tmpRay.origin.y, this._tmpRay.origin.addInPlace(this._tmpRay.direction.scale(I)), this._tmpVector.subtractToRef(this._tmpRay.origin, this._tmpRay.direction), this._tmpRay.direction.normalize(), (m = o.pickWithRay(this._tmpRay, function(G) {
+ return !(!n._options.pickBlockerMeshes || n._options.pickBlockerMeshes.indexOf(G) === -1) || n._floorMeshes.indexOf(G) !== -1;
+ })) && m.pickedMesh && this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(m.pickedMesh) !== -1)
+ return;
+ m && m.pickedPoint && (p = !0, this._setTargetMeshPosition(m.pickedPoint), this._setTargetMeshVisibility(!0), this._showParabolicPath(m));
+ }
+ this._setTargetMeshVisibility(p);
+ } else
+ this._setTargetMeshVisibility(!1);
+ } else
+ this._setTargetMeshVisibility(!1);
+ }
+ }, t.prototype._createDefaultTargetMesh = function() {
+ this._options.defaultTargetMeshOptions = this._options.defaultTargetMeshOptions || {};
+ var e = this._options.useUtilityLayer ? this._options.customUtilityLayerScene || Gn.a.DefaultUtilityLayer.utilityLayerScene : this._xrSessionManager.scene, n = gr.CreateGround("teleportationTarget", { width: 2, height: 2, subdivisions: 2 }, e);
+ n.isPickable = !1;
+ var i = new $i.a("teleportationPlaneDynamicTexture", 512, e, !0);
+ i.hasAlpha = !0;
+ var o = i.getContext();
+ o.beginPath(), o.arc(256, 256, 200, 0, 2 * Math.PI, !1), o.fillStyle = this._options.defaultTargetMeshOptions.teleportationFillColor || "#444444", o.fill(), o.lineWidth = 10, o.strokeStyle = this._options.defaultTargetMeshOptions.teleportationBorderColor || "#FFFFFF", o.stroke(), o.closePath(), i.update();
+ var a = new kt.a("teleportationPlaneMaterial", e);
+ a.diffuseTexture = i, n.material = a;
+ var s = bo.CreateTorus("torusTeleportation", { diameter: 0.75, thickness: 0.1, tessellation: 20 }, e);
+ if (s.isPickable = !1, s.parent = n, !this._options.defaultTargetMeshOptions.disableAnimation) {
+ var p = new H("animationInnerCircle", "position.y", 30, H.ANIMATIONTYPE_FLOAT, H.ANIMATIONLOOPMODE_CYCLE), m = [];
+ m.push({ frame: 0, value: 0 }), m.push({ frame: 30, value: 0.4 }), m.push({ frame: 60, value: 0 }), p.setKeys(m);
+ var S = new _n();
+ S.setEasingMode(je.EASINGMODE_EASEINOUT), p.setEasingFunction(S), s.animations = [], s.animations.push(p), e.beginAnimation(s, 0, 60, !0);
+ }
+ var O = Vi.a.CreateCylinder("rotationCone", { diameterTop: 0, tessellation: 4 }, e);
+ if (O.isPickable = !1, O.scaling.set(0.5, 0.12, 0.2), O.rotate(Se.a.X, Math.PI / 2), O.position.z = 0.6, O.parent = s, this._options.defaultTargetMeshOptions.torusArrowMaterial)
+ s.material = this._options.defaultTargetMeshOptions.torusArrowMaterial, O.material = this._options.defaultTargetMeshOptions.torusArrowMaterial;
+ else {
+ var I = new kt.a("torusConsMat", e);
+ I.disableLighting = !!this._options.defaultTargetMeshOptions.disableLighting, I.disableLighting ? I.emissiveColor = new C.a(0.3, 0.3, 1) : I.diffuseColor = new C.a(0.3, 0.3, 1), I.alpha = 0.9, s.material = I, O.material = I, this._teleportationRingMaterial = I;
+ }
+ this._options.renderingGroupId !== void 0 && (n.renderingGroupId = this._options.renderingGroupId, s.renderingGroupId = this._options.renderingGroupId, O.renderingGroupId = this._options.renderingGroupId), this._options.teleportationTargetMesh = n;
+ }, t.prototype._detachController = function(e) {
+ var n = this._controllers[e];
+ n && (n.teleportationComponent && (n.onAxisChangedObserver && n.teleportationComponent.onAxisValueChangedObservable.remove(n.onAxisChangedObserver), n.onButtonChangedObserver && n.teleportationComponent.onButtonStateChangedObservable.remove(n.onButtonChangedObserver)), delete this._controllers[e]);
+ }, t.prototype._findClosestSnapPointWithRadius = function(e, n) {
+ n === void 0 && (n = this._options.snapToPositionRadius || 0.8);
+ var i = null, o = Number.MAX_VALUE;
+ if (this._snapToPositions.length) {
+ var a = n * n;
+ this._snapToPositions.forEach(function(s) {
+ var p = c.e.DistanceSquared(s, e);
+ p <= a && p < o && (o = p, i = s);
+ });
+ }
+ return i;
+ }, t.prototype._setTargetMeshPosition = function(e) {
+ if (this._options.teleportationTargetMesh) {
+ var n = this._findClosestSnapPointWithRadius(e);
+ this._snappedToPoint = !!n, this.snapPointsOnly && !this._snappedToPoint && this._teleportationRingMaterial ? this._teleportationRingMaterial.diffuseColor.set(1, 0.3, 0.3) : this.snapPointsOnly && this._snappedToPoint && this._teleportationRingMaterial && this._teleportationRingMaterial.diffuseColor.set(0.3, 0.3, 1), this._options.teleportationTargetMesh.position.copyFrom(n || e), this._options.teleportationTargetMesh.position.y += 0.01;
+ }
+ }, t.prototype._setTargetMeshVisibility = function(e) {
+ this._options.teleportationTargetMesh && this._options.teleportationTargetMesh.isVisible !== e && (this._options.teleportationTargetMesh.isVisible = e, this._options.teleportationTargetMesh.getChildren(void 0, !1).forEach(function(n) {
+ n.isVisible = e;
+ }), e ? this._selectionFeature && this._selectionFeature.detach() : (this._quadraticBezierCurve && (this._quadraticBezierCurve.dispose(), this._quadraticBezierCurve = null), this._selectionFeature && this._selectionFeature.attach()));
+ }, t.prototype._showParabolicPath = function(e) {
+ if (e.pickedPoint) {
+ var n = this._controllers[this._currentTeleportationControllerId], i = Ze.d.CreateQuadraticBezier(n.xrController.pointer.absolutePosition, e.ray.origin, e.pickedPoint, 25);
+ this._options.generateRayPathMesh ? this._quadraticBezierCurve = this._options.generateRayPathMesh(i.getPoints()) : this._quadraticBezierCurve = yn.a.CreateLines("teleportation path line", { points: i.getPoints(), instance: this._quadraticBezierCurve, updatable: !0 }), this._quadraticBezierCurve.isPickable = !1;
+ }
+ }, t.prototype._teleportForward = function(e) {
+ var n = this._controllers[e];
+ if (n && n.teleportationState.forward && (n.teleportationState.forward = !1, this._currentTeleportationControllerId = "", (!this.snapPointsOnly || this._snappedToPoint) && this._options.teleportationTargetMesh && this._options.teleportationTargetMesh.isVisible)) {
+ var i = this._options.xrInput.xrCamera.realWorldHeight;
+ this._options.xrInput.xrCamera.onBeforeCameraTeleport.notifyObservers(this._options.xrInput.xrCamera.position), this._options.xrInput.xrCamera.position.copyFrom(this._options.teleportationTargetMesh.position), this._options.xrInput.xrCamera.position.y += i, this._options.xrInput.xrCamera.rotationQuaternion.multiplyInPlace(c.b.FromEulerAngles(0, n.teleportationState.currentRotation - (this._xrSessionManager.scene.useRightHandedSystem ? Math.PI : 0), 0)), this._options.xrInput.xrCamera.onAfterCameraTeleport.notifyObservers(this._options.xrInput.xrCamera.position);
+ }
+ }, t.Name = Ci.TELEPORTATION, t.Version = 1, t;
+ }(xi);
+ hi.AddWebXRFeature(Ra.Name, function(r, t) {
+ return function() {
+ return new Ra(r, t);
+ };
+ }, Ra.Version, !0);
+ var wy = function() {
+ }, Rf = function() {
+ function r() {
+ }
+ return r.CreateAsync = function(t, e) {
+ e === void 0 && (e = {});
+ var n = new r();
+ return Tf.CreateAsync(t).then(function(i) {
+ if (n.baseExperience = i, e.ignoreNativeCameraTransformation && (n.baseExperience.camera.compensateOnFirstFrame = !1), n.input = new Pf(i.sessionManager, i.camera, Object(u.a)({ controllerOptions: { renderingGroupId: e.renderingGroupId } }, e.inputOptions || {})), n.pointerSelection = n.baseExperience.featuresManager.enableFeature(xa.Name, e.useStablePlugins ? "stable" : "latest", { xrInput: n.input, renderingGroupId: e.renderingGroupId }), e.disableTeleportation || (n.teleportation = n.baseExperience.featuresManager.enableFeature(Ra.Name, e.useStablePlugins ? "stable" : "latest", { floorMeshes: e.floorMeshes, xrInput: n.input, renderingGroupId: e.renderingGroupId }), n.teleportation.setSelectionFeature(n.pointerSelection)), n.renderTarget = n.baseExperience.sessionManager.getWebXRRenderTarget(e.outputCanvasOptions), !e.disableDefaultUI) {
+ var o = Object(u.a)({ renderTarget: n.renderTarget }, e.uiOptions || {});
+ return e.optionalFeatures && (typeof e.optionalFeatures == "boolean" ? o.optionalFeatures = ["hit-test", "anchors", "plane-detection", "hand-tracking"] : o.optionalFeatures = e.optionalFeatures), xf.CreateAsync(t, n.baseExperience, o).then(function(a) {
+ n.enterExitUI = a;
+ });
+ }
+ }).then(function() {
+ return n;
+ }).catch(function(i) {
+ return h.a.Error("Error initializing XR"), h.a.Error(i), n;
+ });
+ }, r.prototype.dispose = function() {
+ this.baseExperience && this.baseExperience.dispose(), this.input && this.input.dispose(), this.enterExitUI && this.enterExitUI.dispose(), this.renderTarget && this.renderTarget.dispose();
+ }, r;
+ }(), Ny = !0;
+ ge.a.prototype.createDefaultLight = function(r) {
+ if (r === void 0 && (r = !1), r && this.lights)
+ for (var t = 0; t < this.lights.length; t++)
+ this.lights[t].dispose();
+ this.lights.length === 0 && new vs.a("default light", c.e.Up(), this);
+ }, ge.a.prototype.createDefaultCamera = function(r, t, e) {
+ if (r === void 0 && (r = !1), t === void 0 && (t = !1), e === void 0 && (e = !1), t && this.activeCamera && (this.activeCamera.dispose(), this.activeCamera = null), !this.activeCamera) {
+ var n, i = this.getWorldExtends(function(O) {
+ return O.isVisible && O.isEnabled();
+ }), o = i.max.subtract(i.min), a = i.min.add(o.scale(0.5)), s = 1.5 * o.length();
+ if (isFinite(s) || (s = 1, a.copyFromFloats(0, 0, 0)), r) {
+ var p = new Gr("default camera", -Math.PI / 2, Math.PI / 2, s, a, this);
+ p.lowerRadiusLimit = 0.01 * s, p.wheelPrecision = 100 / s, n = p;
+ } else {
+ var m = new ci("default camera", new c.e(a.x, a.y, -s), this);
+ m.setTarget(a), n = m;
+ }
+ n.minZ = 0.01 * s, n.maxZ = 1e3 * s, n.speed = 0.2 * s, this.activeCamera = n;
+ var S = this.getEngine().getInputElement();
+ e && S && n.attachControl();
+ }
+ }, ge.a.prototype.createDefaultCameraOrLight = function(r, t, e) {
+ r === void 0 && (r = !1), t === void 0 && (t = !1), e === void 0 && (e = !1), this.createDefaultLight(t), this.createDefaultCamera(r, t, e);
+ }, ge.a.prototype.createDefaultSkybox = function(r, t, e, n, i) {
+ if (t === void 0 && (t = !1), e === void 0 && (e = 1e3), n === void 0 && (n = 0), i === void 0 && (i = !0), !r)
+ return h.a.Warn("Can not create default skybox without environment texture."), null;
+ i && r && (this.environmentTexture = r);
+ var o = we.a.CreateBox("hdrSkyBox", e, this);
+ if (t) {
+ var a = new Ca("skyBox", this);
+ a.backFaceCulling = !1, a.reflectionTexture = r.clone(), a.reflectionTexture && (a.reflectionTexture.coordinatesMode = Ue.a.SKYBOX_MODE), a.microSurface = 1 - n, a.disableLighting = !0, a.twoSidedLighting = !0, o.infiniteDistance = !0, o.material = a;
+ } else {
+ var s = new kt.a("skyBox", this);
+ s.backFaceCulling = !1, s.reflectionTexture = r.clone(), s.reflectionTexture && (s.reflectionTexture.coordinatesMode = Ue.a.SKYBOX_MODE), s.disableLighting = !0, o.infiniteDistance = !0, o.material = s;
+ }
+ return o.isPickable = !1, o;
+ }, ge.a.prototype.createDefaultEnvironment = function(r) {
+ return Nl ? new Nl(r, this) : null;
+ }, ge.a.prototype.createDefaultVRExperience = function(r) {
+ return r === void 0 && (r = {}), new Kd(this, r);
+ }, ge.a.prototype.createDefaultXRExperienceAsync = function(r) {
+ return r === void 0 && (r = {}), Rf.CreateAsync(this, r).then(function(t) {
+ return t;
+ });
+ };
+ var Of = function(r) {
+ function t(e, n, i, o, a, s, p) {
+ o === void 0 && (o = !1), a === void 0 && (a = !1), s === void 0 && (s = Ue.a.TRILINEAR_SAMPLINGMODE), p === void 0 && (p = { autoPlay: !0, loop: !0, autoUpdateTexture: !0 });
+ var m = r.call(this, null, i, !o, a) || this;
+ m._onUserActionRequestedObservable = null, m._stillImageCaptured = !1, m._displayingPosterTexture = !1, m._frameId = -1, m._currentSrc = null, m._createInternalTexture = function() {
+ if (m._texture != null) {
+ if (!m._displayingPosterTexture)
+ return;
+ m._texture.dispose(), m._displayingPosterTexture = !1;
+ }
+ if (!m._getEngine().needPOTTextures || Ke.b.IsExponentOfTwo(m.video.videoWidth) && Ke.b.IsExponentOfTwo(m.video.videoHeight) ? (m.wrapU = Ue.a.WRAP_ADDRESSMODE, m.wrapV = Ue.a.WRAP_ADDRESSMODE) : (m.wrapU = Ue.a.CLAMP_ADDRESSMODE, m.wrapV = Ue.a.CLAMP_ADDRESSMODE, m._generateMipMaps = !1), m._texture = m._getEngine().createDynamicTexture(m.video.videoWidth, m.video.videoHeight, m._generateMipMaps, m.samplingMode), m.video.autoplay || m._settings.poster)
+ m._texture.isReady = !0, m._updateInternalTexture(), m.onLoadObservable.hasObservers() && m.onLoadObservable.notifyObservers(m);
+ else {
+ var O = m.video.onplaying, I = !1, G = m.video.muted;
+ m.video.muted = !0, m.video.onplaying = function() {
+ m.video.muted = G, m.video.onplaying = O, m._texture.isReady = !0, m._updateInternalTexture(), I || m.video.pause(), m.onLoadObservable.hasObservers() && m.onLoadObservable.notifyObservers(m);
+ };
+ var k = m.video.play();
+ k ? k.then(function() {
+ }).catch(function() {
+ I = !0, m._onUserActionRequestedObservable && m._onUserActionRequestedObservable.hasObservers() && m._onUserActionRequestedObservable.notifyObservers(m);
+ }) : (m.video.onplaying = O, m._texture.isReady = !0, m._updateInternalTexture(), m.onLoadObservable.hasObservers() && m.onLoadObservable.notifyObservers(m));
+ }
+ }, m.reset = function() {
+ m._texture != null && (m._displayingPosterTexture || (m._texture.dispose(), m._texture = null));
+ }, m._updateInternalTexture = function() {
+ if (m._texture != null && m._texture.isReady && !(m.video.readyState < m.video.HAVE_CURRENT_DATA || m._displayingPosterTexture)) {
+ var O = m.getScene().getFrameId();
+ m._frameId !== O && (m._frameId = O, m._getEngine().updateVideoTexture(m._texture, m.video, m._invertY));
+ }
+ }, m._generateMipMaps = o, m._initialSamplingMode = s, m.autoUpdateTexture = p.autoUpdateTexture, m._currentSrc = n, m.name = e || m._getName(n), m.video = m._getVideo(n), m._settings = p, p.poster && (m.video.poster = p.poster), p.autoPlay !== void 0 && (m.video.autoplay = p.autoPlay), p.loop !== void 0 && (m.video.loop = p.loop), p.muted !== void 0 && (m.video.muted = p.muted), m.video.setAttribute("playsinline", ""), m.video.addEventListener("paused", m._updateInternalTexture), m.video.addEventListener("seeked", m._updateInternalTexture), m.video.addEventListener("emptied", m.reset), m._createInternalTextureOnEvent = p.poster && !p.autoPlay ? "play" : "canplay", m.video.addEventListener(m._createInternalTextureOnEvent, m._createInternalTexture), p.autoPlay && m.video.play();
+ var S = m.video.readyState >= m.video.HAVE_CURRENT_DATA;
+ return !p.poster || p.autoPlay && S ? S && m._createInternalTexture() : (m._texture = m._getEngine().createTexture(p.poster, !1, !m.invertY, i), m._displayingPosterTexture = !0), m;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "onUserActionRequestedObservable", { get: function() {
+ return this._onUserActionRequestedObservable || (this._onUserActionRequestedObservable = new P.c()), this._onUserActionRequestedObservable;
+ }, enumerable: !1, configurable: !0 }), t.prototype._getName = function(e) {
+ return e instanceof HTMLVideoElement ? e.currentSrc : typeof e == "object" ? e.toString() : e;
+ }, t.prototype._getVideo = function(e) {
+ if (e instanceof HTMLVideoElement)
+ return Ke.b.SetCorsBehavior(e.currentSrc, e), e;
+ var n = document.createElement("video");
+ return typeof e == "string" ? (Ke.b.SetCorsBehavior(e, n), n.src = e) : (Ke.b.SetCorsBehavior(e[0], n), e.forEach(function(i) {
+ var o = document.createElement("source");
+ o.src = i, n.appendChild(o);
+ })), n;
+ }, t.prototype._rebuild = function() {
+ this.update();
+ }, t.prototype.update = function() {
+ this.autoUpdateTexture && this.updateTexture(!0);
+ }, t.prototype.updateTexture = function(e) {
+ e && (this.video.paused && this._stillImageCaptured || (this._stillImageCaptured = !0, this._updateInternalTexture()));
+ }, t.prototype.updateURL = function(e) {
+ this.video.src = e, this._currentSrc = e;
+ }, t.prototype.clone = function() {
+ return new t(this.name, this._currentSrc, this.getScene(), this._generateMipMaps, this.invertY, this.samplingMode, this._settings);
+ }, t.prototype.dispose = function() {
+ r.prototype.dispose.call(this), this._currentSrc = null, this._onUserActionRequestedObservable && (this._onUserActionRequestedObservable.clear(), this._onUserActionRequestedObservable = null), this.video.removeEventListener(this._createInternalTextureOnEvent, this._createInternalTexture), this.video.removeEventListener("paused", this._updateInternalTexture), this.video.removeEventListener("seeked", this._updateInternalTexture), this.video.removeEventListener("emptied", this.reset), this.video.pause();
+ }, t.CreateFromStreamAsync = function(e, n) {
+ var i = document.createElement("video");
+ return e.getEngine()._badOS && (document.body.appendChild(i), i.style.transform = "scale(0.0001, 0.0001)", i.style.opacity = "0", i.style.position = "fixed", i.style.bottom = "0px", i.style.right = "0px"), i.setAttribute("autoplay", ""), i.setAttribute("muted", "true"), i.setAttribute("playsinline", ""), i.muted = !0, i.mozSrcObject !== void 0 ? i.mozSrcObject = n : typeof i.srcObject == "object" ? i.srcObject = n : (window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL, i.src = window.URL && window.URL.createObjectURL(n)), new Promise(function(o) {
+ var a = function() {
+ o(new t("video", i, e, !0, !0)), i.removeEventListener("playing", a);
+ };
+ i.addEventListener("playing", a), i.play();
+ });
+ }, t.CreateFromWebCamAsync = function(e, n, i) {
+ var o, a = this;
+ return i === void 0 && (i = !1), n && n.deviceId && (o = { exact: n.deviceId }), navigator.mediaDevices ? navigator.mediaDevices.getUserMedia({ video: n, audio: i }).then(function(s) {
+ return a.CreateFromStreamAsync(e, s);
+ }) : (navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia, navigator.getUserMedia && navigator.getUserMedia({ video: { deviceId: o, width: { min: n && n.minWidth || 256, max: n && n.maxWidth || 640 }, height: { min: n && n.minHeight || 256, max: n && n.maxHeight || 480 } }, audio: i }, function(s) {
+ return a.CreateFromStreamAsync(e, s);
+ }, function(s) {
+ h.a.Error(s.name);
+ }), Promise.reject("No support for userMedia on this device"));
+ }, t.CreateFromWebCam = function(e, n, i, o) {
+ o === void 0 && (o = !1), this.CreateFromWebCamAsync(e, i, o).then(function(a) {
+ n && n(a);
+ }).catch(function(a) {
+ h.a.Error(a.name);
+ });
+ }, t;
+ }(Ue.a), Fy = function(r) {
+ function t() {
+ return r !== null && r.apply(this, arguments) || this;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "videoTexture", { get: function() {
+ return this._texture;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "videoMode", { get: function() {
+ return this.textureMode;
+ }, set: function(e) {
+ this.textureMode = e;
+ }, enumerable: !1, configurable: !0 }), t.prototype._initTexture = function(e, n, i) {
+ var o = this, a = { loop: i.loop, autoPlay: i.autoPlay, autoUpdateTexture: !0, poster: i.poster }, s = new Of((this.name || "videoDome") + "_texture", e, n, i.generateMipMaps, this._useDirectMapping, Ue.a.TRILINEAR_SAMPLINGMODE, a);
+ return i.clickToPlay && (n.onPointerUp = function() {
+ o._texture.video.play();
+ }), s;
+ }, t.MODE_MONOSCOPIC = br.MODE_MONOSCOPIC, t.MODE_TOPBOTTOM = br.MODE_TOPBOTTOM, t.MODE_SIDEBYSIDE = br.MODE_SIDEBYSIDE, t;
+ }(br), ai = l(55), By = function() {
+ function r(t) {
+ this.engine = t, this._captureGPUFrameTime = !1, this._gpuFrameTime = new ai.a(), this._captureShaderCompilationTime = !1, this._shaderCompilationTime = new ai.a(), this._onBeginFrameObserver = null, this._onEndFrameObserver = null, this._onBeforeShaderCompilationObserver = null, this._onAfterShaderCompilationObserver = null;
+ }
+ return Object.defineProperty(r.prototype, "gpuFrameTimeCounter", { get: function() {
+ return this._gpuFrameTime;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "captureGPUFrameTime", { get: function() {
+ return this._captureGPUFrameTime;
+ }, set: function(t) {
+ var e = this;
+ t !== this._captureGPUFrameTime && (this._captureGPUFrameTime = t, t ? (this._onBeginFrameObserver = this.engine.onBeginFrameObservable.add(function() {
+ e._gpuFrameTimeToken || (e._gpuFrameTimeToken = e.engine.startTimeQuery());
+ }), this._onEndFrameObserver = this.engine.onEndFrameObservable.add(function() {
+ if (e._gpuFrameTimeToken) {
+ var n = e.engine.endTimeQuery(e._gpuFrameTimeToken);
+ n > -1 && (e._gpuFrameTimeToken = null, e._gpuFrameTime.fetchNewFrame(), e._gpuFrameTime.addCount(n, !0));
+ }
+ })) : (this.engine.onBeginFrameObservable.remove(this._onBeginFrameObserver), this._onBeginFrameObserver = null, this.engine.onEndFrameObservable.remove(this._onEndFrameObserver), this._onEndFrameObserver = null));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "shaderCompilationTimeCounter", { get: function() {
+ return this._shaderCompilationTime;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "captureShaderCompilationTime", { get: function() {
+ return this._captureShaderCompilationTime;
+ }, set: function(t) {
+ var e = this;
+ t !== this._captureShaderCompilationTime && (this._captureShaderCompilationTime = t, t ? (this._onBeforeShaderCompilationObserver = this.engine.onBeforeShaderCompilationObservable.add(function() {
+ e._shaderCompilationTime.fetchNewFrame(), e._shaderCompilationTime.beginMonitoring();
+ }), this._onAfterShaderCompilationObserver = this.engine.onAfterShaderCompilationObservable.add(function() {
+ e._shaderCompilationTime.endMonitoring();
+ })) : (this.engine.onBeforeShaderCompilationObservable.remove(this._onBeforeShaderCompilationObserver), this._onBeforeShaderCompilationObserver = null, this.engine.onAfterShaderCompilationObservable.remove(this._onAfterShaderCompilationObserver), this._onAfterShaderCompilationObserver = null));
+ }, enumerable: !1, configurable: !0 }), r.prototype.dispose = function() {
+ this.engine.onBeginFrameObservable.remove(this._onBeginFrameObserver), this._onBeginFrameObserver = null, this.engine.onEndFrameObservable.remove(this._onEndFrameObserver), this._onEndFrameObserver = null, this.engine.onBeforeShaderCompilationObservable.remove(this._onBeforeShaderCompilationObserver), this._onBeforeShaderCompilationObserver = null, this.engine.onAfterShaderCompilationObservable.remove(this._onAfterShaderCompilationObserver), this._onAfterShaderCompilationObserver = null, this.engine = null;
+ }, r;
+ }(), Uy = function() {
+ function r(t) {
+ var e = this;
+ this.scene = t, this._captureActiveMeshesEvaluationTime = !1, this._activeMeshesEvaluationTime = new ai.a(), this._captureRenderTargetsRenderTime = !1, this._renderTargetsRenderTime = new ai.a(), this._captureFrameTime = !1, this._frameTime = new ai.a(), this._captureRenderTime = !1, this._renderTime = new ai.a(), this._captureInterFrameTime = !1, this._interFrameTime = new ai.a(), this._captureParticlesRenderTime = !1, this._particlesRenderTime = new ai.a(), this._captureSpritesRenderTime = !1, this._spritesRenderTime = new ai.a(), this._capturePhysicsTime = !1, this._physicsTime = new ai.a(), this._captureAnimationsTime = !1, this._animationsTime = new ai.a(), this._captureCameraRenderTime = !1, this._cameraRenderTime = new ai.a(), this._onBeforeActiveMeshesEvaluationObserver = null, this._onAfterActiveMeshesEvaluationObserver = null, this._onBeforeRenderTargetsRenderObserver = null, this._onAfterRenderTargetsRenderObserver = null, this._onAfterRenderObserver = null, this._onBeforeDrawPhaseObserver = null, this._onAfterDrawPhaseObserver = null, this._onBeforeAnimationsObserver = null, this._onBeforeParticlesRenderingObserver = null, this._onAfterParticlesRenderingObserver = null, this._onBeforeSpritesRenderingObserver = null, this._onAfterSpritesRenderingObserver = null, this._onBeforePhysicsObserver = null, this._onAfterPhysicsObserver = null, this._onAfterAnimationsObserver = null, this._onBeforeCameraRenderObserver = null, this._onAfterCameraRenderObserver = null, this._onBeforeAnimationsObserver = t.onBeforeAnimationsObservable.add(function() {
+ e._captureActiveMeshesEvaluationTime && e._activeMeshesEvaluationTime.fetchNewFrame(), e._captureRenderTargetsRenderTime && e._renderTargetsRenderTime.fetchNewFrame(), e._captureFrameTime && (Ke.b.StartPerformanceCounter("Scene rendering"), e._frameTime.beginMonitoring()), e._captureInterFrameTime && e._interFrameTime.endMonitoring(), e._captureParticlesRenderTime && e._particlesRenderTime.fetchNewFrame(), e._captureSpritesRenderTime && e._spritesRenderTime.fetchNewFrame(), e._captureAnimationsTime && e._animationsTime.beginMonitoring(), e.scene.getEngine()._drawCalls.fetchNewFrame();
+ }), this._onAfterRenderObserver = t.onAfterRenderObservable.add(function() {
+ e._captureFrameTime && (Ke.b.EndPerformanceCounter("Scene rendering"), e._frameTime.endMonitoring()), e._captureRenderTime && e._renderTime.endMonitoring(!1), e._captureInterFrameTime && e._interFrameTime.beginMonitoring();
+ });
+ }
+ return Object.defineProperty(r.prototype, "activeMeshesEvaluationTimeCounter", { get: function() {
+ return this._activeMeshesEvaluationTime;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "captureActiveMeshesEvaluationTime", { get: function() {
+ return this._captureActiveMeshesEvaluationTime;
+ }, set: function(t) {
+ var e = this;
+ t !== this._captureActiveMeshesEvaluationTime && (this._captureActiveMeshesEvaluationTime = t, t ? (this._onBeforeActiveMeshesEvaluationObserver = this.scene.onBeforeActiveMeshesEvaluationObservable.add(function() {
+ Ke.b.StartPerformanceCounter("Active meshes evaluation"), e._activeMeshesEvaluationTime.beginMonitoring();
+ }), this._onAfterActiveMeshesEvaluationObserver = this.scene.onAfterActiveMeshesEvaluationObservable.add(function() {
+ Ke.b.EndPerformanceCounter("Active meshes evaluation"), e._activeMeshesEvaluationTime.endMonitoring();
+ })) : (this.scene.onBeforeActiveMeshesEvaluationObservable.remove(this._onBeforeActiveMeshesEvaluationObserver), this._onBeforeActiveMeshesEvaluationObserver = null, this.scene.onAfterActiveMeshesEvaluationObservable.remove(this._onAfterActiveMeshesEvaluationObserver), this._onAfterActiveMeshesEvaluationObserver = null));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "renderTargetsRenderTimeCounter", { get: function() {
+ return this._renderTargetsRenderTime;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "captureRenderTargetsRenderTime", { get: function() {
+ return this._captureRenderTargetsRenderTime;
+ }, set: function(t) {
+ var e = this;
+ t !== this._captureRenderTargetsRenderTime && (this._captureRenderTargetsRenderTime = t, t ? (this._onBeforeRenderTargetsRenderObserver = this.scene.onBeforeRenderTargetsRenderObservable.add(function() {
+ Ke.b.StartPerformanceCounter("Render targets rendering"), e._renderTargetsRenderTime.beginMonitoring();
+ }), this._onAfterRenderTargetsRenderObserver = this.scene.onAfterRenderTargetsRenderObservable.add(function() {
+ Ke.b.EndPerformanceCounter("Render targets rendering"), e._renderTargetsRenderTime.endMonitoring(!1);
+ })) : (this.scene.onBeforeRenderTargetsRenderObservable.remove(this._onBeforeRenderTargetsRenderObserver), this._onBeforeRenderTargetsRenderObserver = null, this.scene.onAfterRenderTargetsRenderObservable.remove(this._onAfterRenderTargetsRenderObserver), this._onAfterRenderTargetsRenderObserver = null));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "particlesRenderTimeCounter", { get: function() {
+ return this._particlesRenderTime;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "captureParticlesRenderTime", { get: function() {
+ return this._captureParticlesRenderTime;
+ }, set: function(t) {
+ var e = this;
+ t !== this._captureParticlesRenderTime && (this._captureParticlesRenderTime = t, t ? (this._onBeforeParticlesRenderingObserver = this.scene.onBeforeParticlesRenderingObservable.add(function() {
+ Ke.b.StartPerformanceCounter("Particles"), e._particlesRenderTime.beginMonitoring();
+ }), this._onAfterParticlesRenderingObserver = this.scene.onAfterParticlesRenderingObservable.add(function() {
+ Ke.b.EndPerformanceCounter("Particles"), e._particlesRenderTime.endMonitoring(!1);
+ })) : (this.scene.onBeforeParticlesRenderingObservable.remove(this._onBeforeParticlesRenderingObserver), this._onBeforeParticlesRenderingObserver = null, this.scene.onAfterParticlesRenderingObservable.remove(this._onAfterParticlesRenderingObserver), this._onAfterParticlesRenderingObserver = null));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "spritesRenderTimeCounter", { get: function() {
+ return this._spritesRenderTime;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "captureSpritesRenderTime", { get: function() {
+ return this._captureSpritesRenderTime;
+ }, set: function(t) {
+ var e = this;
+ t !== this._captureSpritesRenderTime && (this._captureSpritesRenderTime = t, this.scene.spriteManagers && (t ? (this._onBeforeSpritesRenderingObserver = this.scene.onBeforeSpritesRenderingObservable.add(function() {
+ Ke.b.StartPerformanceCounter("Sprites"), e._spritesRenderTime.beginMonitoring();
+ }), this._onAfterSpritesRenderingObserver = this.scene.onAfterSpritesRenderingObservable.add(function() {
+ Ke.b.EndPerformanceCounter("Sprites"), e._spritesRenderTime.endMonitoring(!1);
+ })) : (this.scene.onBeforeSpritesRenderingObservable.remove(this._onBeforeSpritesRenderingObserver), this._onBeforeSpritesRenderingObserver = null, this.scene.onAfterSpritesRenderingObservable.remove(this._onAfterSpritesRenderingObserver), this._onAfterSpritesRenderingObserver = null)));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "physicsTimeCounter", { get: function() {
+ return this._physicsTime;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "capturePhysicsTime", { get: function() {
+ return this._capturePhysicsTime;
+ }, set: function(t) {
+ var e = this;
+ t !== this._capturePhysicsTime && this.scene.onBeforePhysicsObservable && (this._capturePhysicsTime = t, t ? (this._onBeforePhysicsObserver = this.scene.onBeforePhysicsObservable.add(function() {
+ Ke.b.StartPerformanceCounter("Physics"), e._physicsTime.beginMonitoring();
+ }), this._onAfterPhysicsObserver = this.scene.onAfterPhysicsObservable.add(function() {
+ Ke.b.EndPerformanceCounter("Physics"), e._physicsTime.endMonitoring();
+ })) : (this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver), this._onBeforePhysicsObserver = null, this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver), this._onAfterPhysicsObserver = null));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "animationsTimeCounter", { get: function() {
+ return this._animationsTime;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "captureAnimationsTime", { get: function() {
+ return this._captureAnimationsTime;
+ }, set: function(t) {
+ var e = this;
+ t !== this._captureAnimationsTime && (this._captureAnimationsTime = t, t ? this._onAfterAnimationsObserver = this.scene.onAfterAnimationsObservable.add(function() {
+ e._animationsTime.endMonitoring();
+ }) : (this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver), this._onAfterAnimationsObserver = null));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "frameTimeCounter", { get: function() {
+ return this._frameTime;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "captureFrameTime", { get: function() {
+ return this._captureFrameTime;
+ }, set: function(t) {
+ this._captureFrameTime = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "interFrameTimeCounter", { get: function() {
+ return this._interFrameTime;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "captureInterFrameTime", { get: function() {
+ return this._captureInterFrameTime;
+ }, set: function(t) {
+ this._captureInterFrameTime = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "renderTimeCounter", { get: function() {
+ return this._renderTime;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "captureRenderTime", { get: function() {
+ return this._captureRenderTime;
+ }, set: function(t) {
+ var e = this;
+ t !== this._captureRenderTime && (this._captureRenderTime = t, t ? (this._onBeforeDrawPhaseObserver = this.scene.onBeforeDrawPhaseObservable.add(function() {
+ e._renderTime.beginMonitoring(), Ke.b.StartPerformanceCounter("Main render");
+ }), this._onAfterDrawPhaseObserver = this.scene.onAfterDrawPhaseObservable.add(function() {
+ e._renderTime.endMonitoring(!1), Ke.b.EndPerformanceCounter("Main render");
+ })) : (this.scene.onBeforeDrawPhaseObservable.remove(this._onBeforeDrawPhaseObserver), this._onBeforeDrawPhaseObserver = null, this.scene.onAfterDrawPhaseObservable.remove(this._onAfterDrawPhaseObserver), this._onAfterDrawPhaseObserver = null));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "cameraRenderTimeCounter", { get: function() {
+ return this._cameraRenderTime;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "captureCameraRenderTime", { get: function() {
+ return this._captureCameraRenderTime;
+ }, set: function(t) {
+ var e = this;
+ t !== this._captureCameraRenderTime && (this._captureCameraRenderTime = t, t ? (this._onBeforeCameraRenderObserver = this.scene.onBeforeCameraRenderObservable.add(function(n) {
+ e._cameraRenderTime.beginMonitoring(), Ke.b.StartPerformanceCounter("Rendering camera " + n.name);
+ }), this._onAfterCameraRenderObserver = this.scene.onAfterCameraRenderObservable.add(function(n) {
+ e._cameraRenderTime.endMonitoring(!1), Ke.b.EndPerformanceCounter("Rendering camera " + n.name);
+ })) : (this.scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver), this._onBeforeCameraRenderObserver = null, this.scene.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver), this._onAfterCameraRenderObserver = null));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "drawCallsCounter", { get: function() {
+ return this.scene.getEngine()._drawCalls;
+ }, enumerable: !1, configurable: !0 }), r.prototype.dispose = function() {
+ this.scene.onAfterRenderObservable.remove(this._onAfterRenderObserver), this._onAfterRenderObserver = null, this.scene.onBeforeActiveMeshesEvaluationObservable.remove(this._onBeforeActiveMeshesEvaluationObserver), this._onBeforeActiveMeshesEvaluationObserver = null, this.scene.onAfterActiveMeshesEvaluationObservable.remove(this._onAfterActiveMeshesEvaluationObserver), this._onAfterActiveMeshesEvaluationObserver = null, this.scene.onBeforeRenderTargetsRenderObservable.remove(this._onBeforeRenderTargetsRenderObserver), this._onBeforeRenderTargetsRenderObserver = null, this.scene.onAfterRenderTargetsRenderObservable.remove(this._onAfterRenderTargetsRenderObserver), this._onAfterRenderTargetsRenderObserver = null, this.scene.onBeforeAnimationsObservable.remove(this._onBeforeAnimationsObserver), this._onBeforeAnimationsObserver = null, this.scene.onBeforeParticlesRenderingObservable.remove(this._onBeforeParticlesRenderingObserver), this._onBeforeParticlesRenderingObserver = null, this.scene.onAfterParticlesRenderingObservable.remove(this._onAfterParticlesRenderingObserver), this._onAfterParticlesRenderingObserver = null, this._onBeforeSpritesRenderingObserver && (this.scene.onBeforeSpritesRenderingObservable.remove(this._onBeforeSpritesRenderingObserver), this._onBeforeSpritesRenderingObserver = null), this._onAfterSpritesRenderingObserver && (this.scene.onAfterSpritesRenderingObservable.remove(this._onAfterSpritesRenderingObserver), this._onAfterSpritesRenderingObserver = null), this.scene.onBeforeDrawPhaseObservable.remove(this._onBeforeDrawPhaseObserver), this._onBeforeDrawPhaseObserver = null, this.scene.onAfterDrawPhaseObservable.remove(this._onAfterDrawPhaseObserver), this._onAfterDrawPhaseObserver = null, this._onBeforePhysicsObserver && (this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver), this._onBeforePhysicsObserver = null), this._onAfterPhysicsObserver && (this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver), this._onAfterPhysicsObserver = null), this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver), this._onAfterAnimationsObserver = null, this.scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver), this._onBeforeCameraRenderObserver = null, this.scene.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver), this._onAfterCameraRenderObserver = null, this.scene = null;
+ }, r;
+ }(), Vy = `#ifdef DIFFUSE
+varying vec2 vUVDiffuse;
+uniform sampler2D diffuseSampler;
+#endif
+#ifdef OPACITY
+varying vec2 vUVOpacity;
+uniform sampler2D opacitySampler;
+uniform float opacityIntensity;
+#endif
+#ifdef EMISSIVE
+varying vec2 vUVEmissive;
+uniform sampler2D emissiveSampler;
+#endif
+#ifdef VERTEXALPHA
+varying vec4 vColor;
+#endif
+uniform vec4 glowColor;
+void main(void)
+{
+vec4 finalColor=glowColor;
+
+#ifdef DIFFUSE
+vec4 albedoTexture=texture2D(diffuseSampler,vUVDiffuse);
+#ifdef GLOW
+
+finalColor.a*=albedoTexture.a;
+#endif
+#ifdef HIGHLIGHT
+
+finalColor.a=albedoTexture.a;
+#endif
+#endif
+#ifdef OPACITY
+vec4 opacityMap=texture2D(opacitySampler,vUVOpacity);
+#ifdef OPACITYRGB
+finalColor.a*=getLuminance(opacityMap.rgb);
+#else
+finalColor.a*=opacityMap.a;
+#endif
+finalColor.a*=opacityIntensity;
+#endif
+#ifdef VERTEXALPHA
+finalColor.a*=vColor.a;
+#endif
+#ifdef ALPHATEST
+if (finalColor.a
+#include
+#include[0..maxSimultaneousMorphTargets]
+
+#include
+uniform mat4 viewProjection;
+varying vec4 vPosition;
+#ifdef UV1
+attribute vec2 uv;
+#endif
+#ifdef UV2
+attribute vec2 uv2;
+#endif
+#ifdef DIFFUSE
+varying vec2 vUVDiffuse;
+uniform mat4 diffuseMatrix;
+#endif
+#ifdef OPACITY
+varying vec2 vUVOpacity;
+uniform mat4 opacityMatrix;
+#endif
+#ifdef EMISSIVE
+varying vec2 vUVEmissive;
+uniform mat4 emissiveMatrix;
+#endif
+#ifdef VERTEXALPHA
+attribute vec4 color;
+varying vec4 vColor;
+#endif
+void main(void)
+{
+vec3 positionUpdated=position;
+#ifdef UV1
+vec2 uvUpdated=uv;
+#endif
+#include[0..maxSimultaneousMorphTargets]
+#include
+#include
+#ifdef CUBEMAP
+vPosition=finalWorld*vec4(positionUpdated,1.0);
+gl_Position=viewProjection*finalWorld*vec4(position,1.0);
+#else
+vPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);
+gl_Position=vPosition;
+#endif
+#ifdef DIFFUSE
+#ifdef DIFFUSEUV1
+vUVDiffuse=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));
+#endif
+#ifdef DIFFUSEUV2
+vUVDiffuse=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));
+#endif
+#endif
+#ifdef OPACITY
+#ifdef OPACITYUV1
+vUVOpacity=vec2(opacityMatrix*vec4(uvUpdated,1.0,0.0));
+#endif
+#ifdef OPACITYUV2
+vUVOpacity=vec2(opacityMatrix*vec4(uv2,1.0,0.0));
+#endif
+#endif
+#ifdef EMISSIVE
+#ifdef EMISSIVEUV1
+vUVEmissive=vec2(emissiveMatrix*vec4(uvUpdated,1.0,0.0));
+#endif
+#ifdef EMISSIVEUV2
+vUVEmissive=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));
+#endif
+#endif
+#ifdef VERTEXALPHA
+vColor=color;
+#endif
+}`;
+ We.a.ShadersStore.glowMapGenerationVertexShader = ky;
+ var Oa = function() {
+ function r(t, e) {
+ this._vertexBuffers = {}, this._maxSize = 0, this._mainTextureDesiredSize = { width: 0, height: 0 }, this._shouldRender = !0, this._postProcesses = [], this._textures = [], this._emissiveTextureAndColor = { texture: null, color: new C.b() }, this.neutralColor = new C.b(), this.isEnabled = !0, this.disableBoundingBoxesFromEffectLayer = !1, this.onDisposeObservable = new P.c(), this.onBeforeRenderMainTextureObservable = new P.c(), this.onBeforeComposeObservable = new P.c(), this.onBeforeRenderMeshToEffect = new P.c(), this.onAfterRenderMeshToEffect = new P.c(), this.onAfterComposeObservable = new P.c(), this.onSizeChangedObservable = new P.c(), this.name = t, this._scene = e || te.a.LastCreatedScene, r._SceneComponentInitialization(this._scene), this._engine = this._scene.getEngine(), this._maxSize = this._engine.getCaps().maxTextureSize, this._scene.effectLayers.push(this), this._generateIndexBuffer(), this._generateVertexBuffer();
+ }
+ return Object.defineProperty(r.prototype, "camera", { get: function() {
+ return this._effectLayerOptions.camera;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "renderingGroupId", { get: function() {
+ return this._effectLayerOptions.renderingGroupId;
+ }, set: function(t) {
+ this._effectLayerOptions.renderingGroupId = t;
+ }, enumerable: !1, configurable: !0 }), r.prototype._init = function(t) {
+ this._effectLayerOptions = Object(u.a)({ mainTextureRatio: 0.5, alphaBlendingMode: d.a.ALPHA_COMBINE, camera: null, renderingGroupId: -1 }, t), this._setMainTextureSize(), this._createMainTexture(), this._createTextureAndPostProcesses(), this._mergeEffect = this._createMergeEffect();
+ }, r.prototype._generateIndexBuffer = function() {
+ var t = [];
+ t.push(0), t.push(1), t.push(2), t.push(0), t.push(2), t.push(3), this._indexBuffer = this._engine.createIndexBuffer(t);
+ }, r.prototype._generateVertexBuffer = function() {
+ var t = [];
+ t.push(1, 1), t.push(-1, 1), t.push(-1, -1), t.push(1, -1);
+ var e = new De.b(this._engine, t, De.b.PositionKind, !1, !1, 2);
+ this._vertexBuffers[De.b.PositionKind] = e;
+ }, r.prototype._setMainTextureSize = function() {
+ this._effectLayerOptions.mainTextureFixedSize ? (this._mainTextureDesiredSize.width = this._effectLayerOptions.mainTextureFixedSize, this._mainTextureDesiredSize.height = this._effectLayerOptions.mainTextureFixedSize) : (this._mainTextureDesiredSize.width = this._engine.getRenderWidth() * this._effectLayerOptions.mainTextureRatio, this._mainTextureDesiredSize.height = this._engine.getRenderHeight() * this._effectLayerOptions.mainTextureRatio, this._mainTextureDesiredSize.width = this._engine.needPOTTextures ? ke.a.GetExponentOfTwo(this._mainTextureDesiredSize.width, this._maxSize) : this._mainTextureDesiredSize.width, this._mainTextureDesiredSize.height = this._engine.needPOTTextures ? ke.a.GetExponentOfTwo(this._mainTextureDesiredSize.height, this._maxSize) : this._mainTextureDesiredSize.height), this._mainTextureDesiredSize.width = Math.floor(this._mainTextureDesiredSize.width), this._mainTextureDesiredSize.height = Math.floor(this._mainTextureDesiredSize.height);
+ }, r.prototype._createMainTexture = function() {
+ var t = this;
+ this._mainTexture = new bn("HighlightLayerMainRTT", { width: this._mainTextureDesiredSize.width, height: this._mainTextureDesiredSize.height }, this._scene, !1, !0, d.a.TEXTURETYPE_UNSIGNED_INT), this._mainTexture.activeCamera = this._effectLayerOptions.camera, this._mainTexture.wrapU = Ue.a.CLAMP_ADDRESSMODE, this._mainTexture.wrapV = Ue.a.CLAMP_ADDRESSMODE, this._mainTexture.anisotropicFilteringLevel = 1, this._mainTexture.updateSamplingMode(Ue.a.BILINEAR_SAMPLINGMODE), this._mainTexture.renderParticles = !1, this._mainTexture.renderList = null, this._mainTexture.ignoreCameraViewport = !0, this._mainTexture.customRenderFunction = function(n, i, o, a) {
+ var s;
+ t.onBeforeRenderMainTextureObservable.notifyObservers(t);
+ var p = t._scene.getEngine();
+ if (a.length) {
+ for (p.setColorWrite(!1), s = 0; s < a.length; s++)
+ t._renderSubMesh(a.data[s]);
+ p.setColorWrite(!0);
+ }
+ for (s = 0; s < n.length; s++)
+ t._renderSubMesh(n.data[s]);
+ for (s = 0; s < i.length; s++)
+ t._renderSubMesh(i.data[s]);
+ var m = p.getAlphaMode();
+ for (s = 0; s < o.length; s++)
+ t._renderSubMesh(o.data[s], !0);
+ p.setAlphaMode(m);
+ }, this._mainTexture.onClearObservable.add(function(n) {
+ n.clear(t.neutralColor, !0, !0, !0);
+ });
+ var e = this._scene.getBoundingBoxRenderer().enabled;
+ this._mainTexture.onBeforeBindObservable.add(function() {
+ t._scene.getBoundingBoxRenderer().enabled = !t.disableBoundingBoxesFromEffectLayer && e;
+ }), this._mainTexture.onAfterUnbindObservable.add(function() {
+ t._scene.getBoundingBoxRenderer().enabled = e;
+ });
+ }, r.prototype._addCustomEffectDefines = function(t) {
+ }, r.prototype._isReady = function(t, e, n) {
+ var i = t.getMaterial();
+ if (!i || !i.isReadyForSubMesh(t.getMesh(), t, e))
+ return !1;
+ var o = [], a = [De.b.PositionKind], s = t.getMesh(), p = !1, m = !1;
+ if (i) {
+ var S = i.needAlphaTesting(), O = i.getAlphaTestTexture(), I = O && O.hasAlpha && (i.useAlphaFromDiffuseTexture || i._useAlphaFromAlbedoTexture);
+ O && (S || I) && (o.push("#define DIFFUSE"), s.isVerticesDataPresent(De.b.UV2Kind) && O.coordinatesIndex === 1 ? (o.push("#define DIFFUSEUV2"), m = !0) : s.isVerticesDataPresent(De.b.UVKind) && (o.push("#define DIFFUSEUV1"), p = !0), S && (o.push("#define ALPHATEST"), o.push("#define ALPHATESTVALUE 0.4")));
+ var G = i.opacityTexture;
+ G && (o.push("#define OPACITY"), s.isVerticesDataPresent(De.b.UV2Kind) && G.coordinatesIndex === 1 ? (o.push("#define OPACITYUV2"), m = !0) : s.isVerticesDataPresent(De.b.UVKind) && (o.push("#define OPACITYUV1"), p = !0));
+ }
+ n && (o.push("#define EMISSIVE"), s.isVerticesDataPresent(De.b.UV2Kind) && n.coordinatesIndex === 1 ? (o.push("#define EMISSIVEUV2"), m = !0) : s.isVerticesDataPresent(De.b.UVKind) && (o.push("#define EMISSIVEUV1"), p = !0)), s.isVerticesDataPresent(De.b.ColorKind) && s.hasVertexAlpha && (a.push(De.b.ColorKind), o.push("#define VERTEXALPHA")), p && (a.push(De.b.UVKind), o.push("#define UV1")), m && (a.push(De.b.UV2Kind), o.push("#define UV2"));
+ var k = new Po.a();
+ if (s.useBones && s.computeBonesUsingShaders) {
+ a.push(De.b.MatricesIndicesKind), a.push(De.b.MatricesWeightsKind), s.numBoneInfluencers > 4 && (a.push(De.b.MatricesIndicesExtraKind), a.push(De.b.MatricesWeightsExtraKind)), o.push("#define NUM_BONE_INFLUENCERS " + s.numBoneInfluencers);
+ var K = s.skeleton;
+ K && K.isUsingTextureForMatrices ? o.push("#define BONETEXTURE") : o.push("#define BonesPerMesh " + (K ? K.bones.length + 1 : 0)), s.numBoneInfluencers > 0 && k.addCPUSkinningFallback(0, s);
+ } else
+ o.push("#define NUM_BONE_INFLUENCERS 0");
+ var re = s.morphTargetManager, se = 0;
+ re && re.numInfluencers > 0 && (o.push("#define MORPHTARGETS"), se = re.numInfluencers, o.push("#define NUM_MORPH_INFLUENCERS " + se), tt.a.PrepareAttributesForMorphTargetsInfluencers(a, s, se)), e && (o.push("#define INSTANCES"), tt.a.PushAttributesForInstances(a), t.getRenderingMesh().hasThinInstances && o.push("#define THIN_INSTANCES")), this._addCustomEffectDefines(o);
+ var ue = o.join(`
+`);
+ return this._cachedDefines !== ue && (this._cachedDefines = ue, this._effectLayerMapGenerationEffect = this._scene.getEngine().createEffect("glowMapGeneration", a, ["world", "mBones", "viewProjection", "glowColor", "morphTargetInfluences", "boneTextureWidth", "diffuseMatrix", "emissiveMatrix", "opacityMatrix", "opacityIntensity"], ["diffuseSampler", "emissiveSampler", "opacitySampler", "boneSampler"], ue, k, void 0, void 0, { maxSimultaneousMorphTargets: se })), this._effectLayerMapGenerationEffect.isReady();
+ }, r.prototype.render = function() {
+ var t = this._mergeEffect;
+ if (t.isReady()) {
+ for (var e = 0; e < this._postProcesses.length; e++)
+ if (!this._postProcesses[e].isReady())
+ return;
+ var n = this._scene.getEngine();
+ this.onBeforeComposeObservable.notifyObservers(this), n.enableEffect(t), n.setState(!1), n.bindBuffers(this._vertexBuffers, this._indexBuffer, t);
+ var i = n.getAlphaMode();
+ n.setAlphaMode(this._effectLayerOptions.alphaBlendingMode), this._internalRender(t), n.setAlphaMode(i), this.onAfterComposeObservable.notifyObservers(this);
+ var o = this._mainTexture.getSize();
+ this._setMainTextureSize(), o.width === this._mainTextureDesiredSize.width && o.height === this._mainTextureDesiredSize.height || (this.onSizeChangedObservable.notifyObservers(this), this._disposeTextureAndPostProcesses(), this._createMainTexture(), this._createTextureAndPostProcesses());
+ }
+ }, r.prototype.hasMesh = function(t) {
+ return this.renderingGroupId === -1 || t.renderingGroupId === this.renderingGroupId;
+ }, r.prototype.shouldRender = function() {
+ return this.isEnabled && this._shouldRender;
+ }, r.prototype._shouldRenderMesh = function(t) {
+ return !0;
+ }, r.prototype._canRenderMesh = function(t, e) {
+ return !e.needAlphaBlendingForMesh(t);
+ }, r.prototype._shouldRenderEmissiveTextureForMesh = function() {
+ return !0;
+ }, r.prototype._renderSubMesh = function(t, e) {
+ var n, i = this;
+ if (e === void 0 && (e = !1), this.shouldRender()) {
+ var o = t.getMaterial(), a = t.getMesh(), s = t.getReplacementMesh(), p = t.getRenderingMesh(), m = t.getEffectiveMesh(), S = this._scene, O = S.getEngine();
+ if (m._internalAbstractMeshDataInfo._isActiveIntermediate = !1, o && this._canRenderMesh(p, o)) {
+ var I = (n = p.overrideMaterialSideOrientation) !== null && n !== void 0 ? n : o.sideOrientation;
+ p._getWorldMatrixDeterminant() < 0 && (I = I === Zt.a.ClockWiseSideOrientation ? Zt.a.CounterClockWiseSideOrientation : Zt.a.ClockWiseSideOrientation);
+ var G = I === Zt.a.ClockWiseSideOrientation;
+ O.setState(o.backFaceCulling, o.zOffset, void 0, G);
+ var k = p._getInstancesRenderList(t._id, !!s);
+ if (!k.mustReturn && this._shouldRenderMesh(p)) {
+ var K = k.hardwareInstancedRendering[t._id] || p.hasThinInstances;
+ if (this._setEmissiveTextureAndColor(p, t, o), this.onBeforeRenderMeshToEffect.notifyObservers(a), this._useMeshMaterial(p))
+ p.render(t, K, s || void 0);
+ else if (this._isReady(t, K, this._emissiveTextureAndColor.texture)) {
+ O.enableEffect(this._effectLayerMapGenerationEffect), p._bind(t, this._effectLayerMapGenerationEffect, Zt.a.TriangleFillMode), this._effectLayerMapGenerationEffect.setMatrix("viewProjection", S.getTransformMatrix()), this._effectLayerMapGenerationEffect.setMatrix("world", m.getWorldMatrix()), this._effectLayerMapGenerationEffect.setFloat4("glowColor", this._emissiveTextureAndColor.color.r, this._emissiveTextureAndColor.color.g, this._emissiveTextureAndColor.color.b, this._emissiveTextureAndColor.color.a);
+ var re = o.needAlphaTesting(), se = o.getAlphaTestTexture(), ue = se && se.hasAlpha && (o.useAlphaFromDiffuseTexture || o._useAlphaFromAlbedoTexture);
+ se && (re || ue) && (this._effectLayerMapGenerationEffect.setTexture("diffuseSampler", se), (he = se.getTextureMatrix()) && this._effectLayerMapGenerationEffect.setMatrix("diffuseMatrix", he));
+ var he, pe = o.opacityTexture;
+ if (pe && (this._effectLayerMapGenerationEffect.setTexture("opacitySampler", pe), this._effectLayerMapGenerationEffect.setFloat("opacityIntensity", pe.level), (he = pe.getTextureMatrix()) && this._effectLayerMapGenerationEffect.setMatrix("opacityMatrix", he)), this._emissiveTextureAndColor.texture && (this._effectLayerMapGenerationEffect.setTexture("emissiveSampler", this._emissiveTextureAndColor.texture), this._effectLayerMapGenerationEffect.setMatrix("emissiveMatrix", this._emissiveTextureAndColor.texture.getTextureMatrix())), p.useBones && p.computeBonesUsingShaders && p.skeleton) {
+ var ve = p.skeleton;
+ if (ve.isUsingTextureForMatrices) {
+ var Ee = ve.getTransformMatrixTexture(p);
+ if (!Ee)
+ return;
+ this._effectLayerMapGenerationEffect.setTexture("boneSampler", Ee), this._effectLayerMapGenerationEffect.setFloat("boneTextureWidth", 4 * (ve.bones.length + 1));
+ } else
+ this._effectLayerMapGenerationEffect.setMatrices("mBones", ve.getTransformMatrices(p));
+ }
+ tt.a.BindMorphTargetParameters(p, this._effectLayerMapGenerationEffect), e && O.setAlphaMode(o.alphaMode), p._processRendering(m, t, this._effectLayerMapGenerationEffect, o.fillMode, k, K, function(Ae, Ie) {
+ return i._effectLayerMapGenerationEffect.setMatrix("world", Ie);
+ });
+ } else
+ this._mainTexture.resetRefreshCounter();
+ this.onAfterRenderMeshToEffect.notifyObservers(a);
+ }
+ }
+ }
+ }, r.prototype._useMeshMaterial = function(t) {
+ return !1;
+ }, r.prototype._rebuild = function() {
+ var t = this._vertexBuffers[De.b.PositionKind];
+ t && t._rebuild(), this._generateIndexBuffer();
+ }, r.prototype._disposeTextureAndPostProcesses = function() {
+ this._mainTexture.dispose();
+ for (var t = 0; t < this._postProcesses.length; t++)
+ this._postProcesses[t] && this._postProcesses[t].dispose();
+ for (this._postProcesses = [], t = 0; t < this._textures.length; t++)
+ this._textures[t] && this._textures[t].dispose();
+ this._textures = [];
+ }, r.prototype.dispose = function() {
+ var t = this._vertexBuffers[De.b.PositionKind];
+ t && (t.dispose(), this._vertexBuffers[De.b.PositionKind] = null), this._indexBuffer && (this._scene.getEngine()._releaseBuffer(this._indexBuffer), this._indexBuffer = null), this._disposeTextureAndPostProcesses();
+ var e = this._scene.effectLayers.indexOf(this, 0);
+ e > -1 && this._scene.effectLayers.splice(e, 1), this.onDisposeObservable.notifyObservers(this), this.onDisposeObservable.clear(), this.onBeforeRenderMainTextureObservable.clear(), this.onBeforeComposeObservable.clear(), this.onBeforeRenderMeshToEffect.clear(), this.onAfterRenderMeshToEffect.clear(), this.onAfterComposeObservable.clear(), this.onSizeChangedObservable.clear();
+ }, r.prototype.getClassName = function() {
+ return "EffectLayer";
+ }, r.Parse = function(t, e, n) {
+ return Ke.b.Instantiate(t.customType).Parse(t, e, n);
+ }, r._SceneComponentInitialization = function(t) {
+ throw Nn.a.WarnImport("EffectLayerSceneComponent");
+ }, Object(u.c)([Object(w.c)()], r.prototype, "name", void 0), Object(u.c)([Object(w.f)()], r.prototype, "neutralColor", void 0), Object(u.c)([Object(w.c)()], r.prototype, "isEnabled", void 0), Object(u.c)([Object(w.d)()], r.prototype, "camera", null), Object(u.c)([Object(w.c)()], r.prototype, "renderingGroupId", null), Object(u.c)([Object(w.c)()], r.prototype, "disableBoundingBoxesFromEffectLayer", void 0), r;
+ }();
+ D.a.AddParser(st.a.NAME_EFFECTLAYER, function(r, t, e, n) {
+ if (r.effectLayers) {
+ e.effectLayers || (e.effectLayers = new Array());
+ for (var i = 0; i < r.effectLayers.length; i++) {
+ var o = Oa.Parse(r.effectLayers[i], t, n);
+ e.effectLayers.push(o);
+ }
+ }
+ }), D.a.prototype.removeEffectLayer = function(r) {
+ var t = this.effectLayers.indexOf(r);
+ return t !== -1 && this.effectLayers.splice(t, 1), t;
+ }, D.a.prototype.addEffectLayer = function(r) {
+ this.effectLayers.push(r);
+ };
+ var Mf = function() {
+ function r(t) {
+ this.name = st.a.NAME_EFFECTLAYER, this._renderEffects = !1, this._needStencil = !1, this._previousStencilState = !1, this.scene = t, this._engine = t.getEngine(), t.effectLayers = new Array();
+ }
+ return r.prototype.register = function() {
+ this.scene._isReadyForMeshStage.registerStep(st.a.STEP_ISREADYFORMESH_EFFECTLAYER, this, this._isReadyForMesh), this.scene._cameraDrawRenderTargetStage.registerStep(st.a.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER, this, this._renderMainTexture), this.scene._beforeCameraDrawStage.registerStep(st.a.STEP_BEFORECAMERADRAW_EFFECTLAYER, this, this._setStencil), this.scene._afterRenderingGroupDrawStage.registerStep(st.a.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW, this, this._drawRenderingGroup), this.scene._afterCameraDrawStage.registerStep(st.a.STEP_AFTERCAMERADRAW_EFFECTLAYER, this, this._setStencilBack), this.scene._afterCameraDrawStage.registerStep(st.a.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW, this, this._drawCamera);
+ }, r.prototype.rebuild = function() {
+ for (var t = 0, e = this.scene.effectLayers; t < e.length; t++)
+ e[t]._rebuild();
+ }, r.prototype.serialize = function(t) {
+ t.effectLayers = [];
+ for (var e = 0, n = this.scene.effectLayers; e < n.length; e++) {
+ var i = n[e];
+ i.serialize && t.effectLayers.push(i.serialize());
+ }
+ }, r.prototype.addFromContainer = function(t) {
+ var e = this;
+ t.effectLayers && t.effectLayers.forEach(function(n) {
+ e.scene.addEffectLayer(n);
+ });
+ }, r.prototype.removeFromContainer = function(t, e) {
+ var n = this;
+ t.effectLayers && t.effectLayers.forEach(function(i) {
+ n.scene.removeEffectLayer(i), e && i.dispose();
+ });
+ }, r.prototype.dispose = function() {
+ for (var t = this.scene.effectLayers; t.length; )
+ t[0].dispose();
+ }, r.prototype._isReadyForMesh = function(t, e) {
+ for (var n = 0, i = this.scene.effectLayers; n < i.length; n++) {
+ var o = i[n];
+ if (o.hasMesh(t))
+ for (var a = 0, s = t.subMeshes; a < s.length; a++) {
+ var p = s[a];
+ if (!o.isReady(p, e))
+ return !1;
+ }
+ }
+ return !0;
+ }, r.prototype._renderMainTexture = function(t) {
+ this._renderEffects = !1, this._needStencil = !1;
+ var e = !1, n = this.scene.effectLayers;
+ if (n && n.length > 0) {
+ this._previousStencilState = this._engine.getStencilBuffer();
+ for (var i = 0, o = n; i < o.length; i++) {
+ var a = o[i];
+ if (a.shouldRender() && (!a.camera || a.camera.cameraRigMode === gt.a.RIG_MODE_NONE && t === a.camera || a.camera.cameraRigMode !== gt.a.RIG_MODE_NONE && a.camera._rigCameras.indexOf(t) > -1)) {
+ this._renderEffects = !0, this._needStencil = this._needStencil || a.needStencil();
+ var s = a._mainTexture;
+ s._shouldRender() && (this.scene.incrementRenderId(), s.render(!1, !1), e = !0);
+ }
+ }
+ this.scene.incrementRenderId();
+ }
+ return e;
+ }, r.prototype._setStencil = function() {
+ this._needStencil && this._engine.setStencilBuffer(!0);
+ }, r.prototype._setStencilBack = function() {
+ this._needStencil && this._engine.setStencilBuffer(this._previousStencilState);
+ }, r.prototype._draw = function(t) {
+ if (this._renderEffects) {
+ this._engine.setDepthBuffer(!1);
+ for (var e = this.scene.effectLayers, n = 0; n < e.length; n++) {
+ var i = e[n];
+ i.renderingGroupId === t && i.shouldRender() && i.render();
+ }
+ this._engine.setDepthBuffer(!0);
+ }
+ }, r.prototype._drawCamera = function() {
+ this._renderEffects && this._draw(-1);
+ }, r.prototype._drawRenderingGroup = function(t) {
+ !this.scene._isInIntermediateRendering() && this._renderEffects && this._draw(t);
+ }, r;
+ }();
+ Oa._SceneComponentInitialization = function(r) {
+ var t = r._getComponent(st.a.NAME_EFFECTLAYER);
+ t || (t = new Mf(r), r._addComponent(t));
+ };
+ var Gy = `
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+#ifdef EMISSIVE
+uniform sampler2D textureSampler2;
+#endif
+
+uniform float offset;
+void main(void) {
+vec4 baseColor=texture2D(textureSampler,vUV);
+#ifdef EMISSIVE
+baseColor+=texture2D(textureSampler2,vUV);
+baseColor*=offset;
+#else
+baseColor.a=abs(offset-baseColor.a);
+#ifdef STROKE
+float alpha=smoothstep(.0,.1,baseColor.a);
+baseColor.a=alpha;
+baseColor.rgb=baseColor.rgb*alpha;
+#endif
+#endif
+gl_FragColor=baseColor;
+}`;
+ We.a.ShadersStore.glowMapMergePixelShader = Gy;
+ var zy = `
+attribute vec2 position;
+
+varying vec2 vUV;
+const vec2 madd=vec2(0.5,0.5);
+void main(void) {
+vUV=position*madd+madd;
+gl_Position=vec4(position,0.0,1.0);
+}`;
+ We.a.ShadersStore.glowMapMergeVertexShader = zy, D.a.prototype.getGlowLayerByName = function(r) {
+ for (var t = 0; t < this.effectLayers.length; t++)
+ if (this.effectLayers[t].name === r && this.effectLayers[t].getEffectName() === Bs.EffectName)
+ return this.effectLayers[t];
+ return null;
+ };
+ var Bs = function(r) {
+ function t(e, n, i) {
+ var o = r.call(this, e, n) || this;
+ return o._intensity = 1, o._includedOnlyMeshes = [], o._excludedMeshes = [], o._meshesUsingTheirOwnMaterials = [], o.neutralColor = new C.b(0, 0, 0, 1), o._options = Object(u.a)({ mainTextureRatio: t.DefaultTextureRatio, blurKernelSize: 32, mainTextureFixedSize: void 0, camera: null, mainTextureSamples: 1, renderingGroupId: -1 }, i), o._init({ alphaBlendingMode: d.a.ALPHA_ADD, camera: o._options.camera, mainTextureFixedSize: o._options.mainTextureFixedSize, mainTextureRatio: o._options.mainTextureRatio, renderingGroupId: o._options.renderingGroupId }), o;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "blurKernelSize", { get: function() {
+ return this._horizontalBlurPostprocess1.kernel;
+ }, set: function(e) {
+ this._horizontalBlurPostprocess1.kernel = e, this._verticalBlurPostprocess1.kernel = e, this._horizontalBlurPostprocess2.kernel = e, this._verticalBlurPostprocess2.kernel = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "intensity", { get: function() {
+ return this._intensity;
+ }, set: function(e) {
+ this._intensity = e;
+ }, enumerable: !1, configurable: !0 }), t.prototype.getEffectName = function() {
+ return t.EffectName;
+ }, t.prototype._createMergeEffect = function() {
+ return this._engine.createEffect("glowMapMerge", [De.b.PositionKind], ["offset"], ["textureSampler", "textureSampler2"], `#define EMISSIVE
+`);
+ }, t.prototype._createTextureAndPostProcesses = function() {
+ var e = this, n = this._mainTextureDesiredSize.width, i = this._mainTextureDesiredSize.height;
+ n = this._engine.needPOTTextures ? ke.a.GetExponentOfTwo(n, this._maxSize) : n, i = this._engine.needPOTTextures ? ke.a.GetExponentOfTwo(i, this._maxSize) : i;
+ var o = 0;
+ o = this._engine.getCaps().textureHalfFloatRender ? d.a.TEXTURETYPE_HALF_FLOAT : d.a.TEXTURETYPE_UNSIGNED_INT, this._blurTexture1 = new bn("GlowLayerBlurRTT", { width: n, height: i }, this._scene, !1, !0, o), this._blurTexture1.wrapU = Ue.a.CLAMP_ADDRESSMODE, this._blurTexture1.wrapV = Ue.a.CLAMP_ADDRESSMODE, this._blurTexture1.updateSamplingMode(Ue.a.BILINEAR_SAMPLINGMODE), this._blurTexture1.renderParticles = !1, this._blurTexture1.ignoreCameraViewport = !0;
+ var a = Math.floor(n / 2), s = Math.floor(i / 2);
+ this._blurTexture2 = new bn("GlowLayerBlurRTT2", { width: a, height: s }, this._scene, !1, !0, o), this._blurTexture2.wrapU = Ue.a.CLAMP_ADDRESSMODE, this._blurTexture2.wrapV = Ue.a.CLAMP_ADDRESSMODE, this._blurTexture2.updateSamplingMode(Ue.a.BILINEAR_SAMPLINGMODE), this._blurTexture2.renderParticles = !1, this._blurTexture2.ignoreCameraViewport = !0, this._textures = [this._blurTexture1, this._blurTexture2], this._horizontalBlurPostprocess1 = new xn("GlowLayerHBP1", new c.d(1, 0), this._options.blurKernelSize / 2, { width: n, height: i }, null, Ue.a.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1, o), this._horizontalBlurPostprocess1.width = n, this._horizontalBlurPostprocess1.height = i, this._horizontalBlurPostprocess1.onApplyObservable.add(function(p) {
+ p.setTexture("textureSampler", e._mainTexture);
+ }), this._verticalBlurPostprocess1 = new xn("GlowLayerVBP1", new c.d(0, 1), this._options.blurKernelSize / 2, { width: n, height: i }, null, Ue.a.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1, o), this._horizontalBlurPostprocess2 = new xn("GlowLayerHBP2", new c.d(1, 0), this._options.blurKernelSize / 2, { width: a, height: s }, null, Ue.a.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1, o), this._horizontalBlurPostprocess2.width = a, this._horizontalBlurPostprocess2.height = s, this._horizontalBlurPostprocess2.onApplyObservable.add(function(p) {
+ p.setTexture("textureSampler", e._blurTexture1);
+ }), this._verticalBlurPostprocess2 = new xn("GlowLayerVBP2", new c.d(0, 1), this._options.blurKernelSize / 2, { width: a, height: s }, null, Ue.a.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1, o), this._postProcesses = [this._horizontalBlurPostprocess1, this._verticalBlurPostprocess1, this._horizontalBlurPostprocess2, this._verticalBlurPostprocess2], this._postProcesses1 = [this._horizontalBlurPostprocess1, this._verticalBlurPostprocess1], this._postProcesses2 = [this._horizontalBlurPostprocess2, this._verticalBlurPostprocess2], this._mainTexture.samples = this._options.mainTextureSamples, this._mainTexture.onAfterUnbindObservable.add(function() {
+ var p = e._blurTexture1.getInternalTexture();
+ if (p) {
+ e._scene.postProcessManager.directRender(e._postProcesses1, p, !0);
+ var m = e._blurTexture2.getInternalTexture();
+ m && e._scene.postProcessManager.directRender(e._postProcesses2, m, !0), e._engine.unBindFramebuffer(m ?? p, !0);
+ }
+ }), this._postProcesses.map(function(p) {
+ p.autoClear = !1;
+ });
+ }, t.prototype.isReady = function(e, n) {
+ var i = e.getMaterial(), o = e.getRenderingMesh();
+ if (!i || !o)
+ return !1;
+ var a = i.emissiveTexture;
+ return r.prototype._isReady.call(this, e, n, a);
+ }, t.prototype.needStencil = function() {
+ return !1;
+ }, t.prototype._canRenderMesh = function(e, n) {
+ return !0;
+ }, t.prototype._internalRender = function(e) {
+ e.setTexture("textureSampler", this._blurTexture1), e.setTexture("textureSampler2", this._blurTexture2), e.setFloat("offset", this._intensity);
+ var n = this._engine, i = n.getStencilBuffer();
+ n.setStencilBuffer(!1), n.drawElementsType(Zt.a.TriangleFillMode, 0, 6), n.setStencilBuffer(i);
+ }, t.prototype._setEmissiveTextureAndColor = function(e, n, i) {
+ var o = 1;
+ this.customEmissiveTextureSelector ? this._emissiveTextureAndColor.texture = this.customEmissiveTextureSelector(e, n, i) : i ? (this._emissiveTextureAndColor.texture = i.emissiveTexture, this._emissiveTextureAndColor.texture && (o = this._emissiveTextureAndColor.texture.level)) : this._emissiveTextureAndColor.texture = null, this.customEmissiveColorSelector ? this.customEmissiveColorSelector(e, n, i, this._emissiveTextureAndColor.color) : i.emissiveColor ? this._emissiveTextureAndColor.color.set(i.emissiveColor.r * o, i.emissiveColor.g * o, i.emissiveColor.b * o, i.alpha) : this._emissiveTextureAndColor.color.set(this.neutralColor.r, this.neutralColor.g, this.neutralColor.b, this.neutralColor.a);
+ }, t.prototype._shouldRenderMesh = function(e) {
+ return this.hasMesh(e);
+ }, t.prototype._addCustomEffectDefines = function(e) {
+ e.push("#define GLOW");
+ }, t.prototype.addExcludedMesh = function(e) {
+ this._excludedMeshes.indexOf(e.uniqueId) === -1 && this._excludedMeshes.push(e.uniqueId);
+ }, t.prototype.removeExcludedMesh = function(e) {
+ var n = this._excludedMeshes.indexOf(e.uniqueId);
+ n !== -1 && this._excludedMeshes.splice(n, 1);
+ }, t.prototype.addIncludedOnlyMesh = function(e) {
+ this._includedOnlyMeshes.indexOf(e.uniqueId) === -1 && this._includedOnlyMeshes.push(e.uniqueId);
+ }, t.prototype.removeIncludedOnlyMesh = function(e) {
+ var n = this._includedOnlyMeshes.indexOf(e.uniqueId);
+ n !== -1 && this._includedOnlyMeshes.splice(n, 1);
+ }, t.prototype.hasMesh = function(e) {
+ return !!r.prototype.hasMesh.call(this, e) && (this._includedOnlyMeshes.length ? this._includedOnlyMeshes.indexOf(e.uniqueId) !== -1 : !this._excludedMeshes.length || this._excludedMeshes.indexOf(e.uniqueId) === -1);
+ }, t.prototype._useMeshMaterial = function(e) {
+ return this._meshesUsingTheirOwnMaterials.length != 0 && this._meshesUsingTheirOwnMaterials.indexOf(e.uniqueId) > -1;
+ }, t.prototype.referenceMeshToUseItsOwnMaterial = function(e) {
+ this._meshesUsingTheirOwnMaterials.push(e.uniqueId);
+ }, t.prototype.unReferenceMeshFromUsingItsOwnMaterial = function(e) {
+ for (var n = this._meshesUsingTheirOwnMaterials.indexOf(e.uniqueId); n >= 0; )
+ this._meshesUsingTheirOwnMaterials.splice(n, 1), n = this._meshesUsingTheirOwnMaterials.indexOf(e.uniqueId);
+ }, t.prototype._disposeMesh = function(e) {
+ this.removeIncludedOnlyMesh(e), this.removeExcludedMesh(e);
+ }, t.prototype.getClassName = function() {
+ return "GlowLayer";
+ }, t.prototype.serialize = function() {
+ var e, n = w.a.Serialize(this);
+ if (n.customType = "BABYLON.GlowLayer", n.includedMeshes = [], this._includedOnlyMeshes.length)
+ for (e = 0; e < this._includedOnlyMeshes.length; e++)
+ (i = this._scene.getMeshByUniqueID(this._includedOnlyMeshes[e])) && n.includedMeshes.push(i.id);
+ if (n.excludedMeshes = [], this._excludedMeshes.length)
+ for (e = 0; e < this._excludedMeshes.length; e++) {
+ var i;
+ (i = this._scene.getMeshByUniqueID(this._excludedMeshes[e])) && n.excludedMeshes.push(i.id);
+ }
+ return n;
+ }, t.Parse = function(e, n, i) {
+ var o, a = w.a.Parse(function() {
+ return new t(e.name, n, e.options);
+ }, e, n, i);
+ for (o = 0; o < e.excludedMeshes.length; o++)
+ (s = n.getMeshByID(e.excludedMeshes[o])) && a.addExcludedMesh(s);
+ for (o = 0; o < e.includedMeshes.length; o++) {
+ var s;
+ (s = n.getMeshByID(e.includedMeshes[o])) && a.addIncludedOnlyMesh(s);
+ }
+ return a;
+ }, t.EffectName = "GlowLayer", t.DefaultBlurKernelSize = 32, t.DefaultTextureRatio = 0.5, Object(u.c)([Object(w.c)()], t.prototype, "blurKernelSize", null), Object(u.c)([Object(w.c)()], t.prototype, "intensity", null), Object(u.c)([Object(w.c)("options")], t.prototype, "_options", void 0), t;
+ }(Oa);
+ x.a.RegisteredTypes["BABYLON.GlowLayer"] = Bs;
+ var jy = `
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+
+uniform vec2 screenSize;
+uniform vec2 direction;
+uniform float blurWidth;
+
+float getLuminance(vec3 color)
+{
+return dot(color,vec3(0.2126,0.7152,0.0722));
+}
+void main(void)
+{
+float weights[7];
+weights[0]=0.05;
+weights[1]=0.1;
+weights[2]=0.2;
+weights[3]=0.3;
+weights[4]=0.2;
+weights[5]=0.1;
+weights[6]=0.05;
+vec2 texelSize=vec2(1.0/screenSize.x,1.0/screenSize.y);
+vec2 texelStep=texelSize*direction*blurWidth;
+vec2 start=vUV-3.0*texelStep;
+vec4 baseColor=vec4(0.,0.,0.,0.);
+vec2 texelOffset=vec2(0.,0.);
+for (int i=0; i<7; i++)
+{
+
+vec4 texel=texture2D(textureSampler,start+texelOffset);
+baseColor.a+=texel.a*weights[i];
+
+float luminance=getLuminance(baseColor.rgb);
+float luminanceTexel=getLuminance(texel.rgb);
+float choice=step(luminanceTexel,luminance);
+baseColor.rgb=choice*baseColor.rgb+(1.0-choice)*texel.rgb;
+texelOffset+=texelStep;
+}
+gl_FragColor=baseColor;
+}`;
+ We.a.ShadersStore.glowBlurPostProcessPixelShader = jy, D.a.prototype.getHighlightLayerByName = function(r) {
+ for (var t = 0; t < this.effectLayers.length; t++)
+ if (this.effectLayers[t].name === r && this.effectLayers[t].getEffectName() === jl.EffectName)
+ return this.effectLayers[t];
+ return null;
+ };
+ var If = function(r) {
+ function t(e, n, i, o, a, s, p, m) {
+ s === void 0 && (s = Ue.a.BILINEAR_SAMPLINGMODE);
+ var S = r.call(this, e, "glowBlurPostProcess", ["screenSize", "direction", "blurWidth"], null, o, a, s, p, m) || this;
+ return S.direction = n, S.kernel = i, S.onApplyObservable.add(function(O) {
+ O.setFloat2("screenSize", S.width, S.height), O.setVector2("direction", S.direction), O.setFloat("blurWidth", S.kernel);
+ }), S;
+ }
+ return Object(u.d)(t, r), t;
+ }(_t), jl = function(r) {
+ function t(e, n, i) {
+ var o = r.call(this, e, n) || this;
+ return o.name = e, o.innerGlow = !0, o.outerGlow = !0, o.onBeforeBlurObservable = new P.c(), o.onAfterBlurObservable = new P.c(), o._instanceGlowingMeshStencilReference = t.GlowingMeshStencilReference++, o._meshes = {}, o._excludedMeshes = {}, o.neutralColor = t.NeutralColor, o._engine.isStencilEnable || h.a.Warn("Rendering the Highlight Layer requires the stencil to be active on the canvas. var engine = new Engine(canvas, antialias, { stencil: true }"), o._options = Object(u.a)({ mainTextureRatio: 0.5, blurTextureSizeRatio: 0.5, blurHorizontalSize: 1, blurVerticalSize: 1, alphaBlendingMode: d.a.ALPHA_COMBINE, camera: null, renderingGroupId: -1 }, i), o._init({ alphaBlendingMode: o._options.alphaBlendingMode, camera: o._options.camera, mainTextureFixedSize: o._options.mainTextureFixedSize, mainTextureRatio: o._options.mainTextureRatio, renderingGroupId: o._options.renderingGroupId }), o._shouldRender = !1, o;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "blurHorizontalSize", { get: function() {
+ return this._horizontalBlurPostprocess.kernel;
+ }, set: function(e) {
+ this._horizontalBlurPostprocess.kernel = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "blurVerticalSize", { get: function() {
+ return this._verticalBlurPostprocess.kernel;
+ }, set: function(e) {
+ this._verticalBlurPostprocess.kernel = e;
+ }, enumerable: !1, configurable: !0 }), t.prototype.getEffectName = function() {
+ return t.EffectName;
+ }, t.prototype._createMergeEffect = function() {
+ return this._engine.createEffect("glowMapMerge", [De.b.PositionKind], ["offset"], ["textureSampler"], this._options.isStroke ? `#define STROKE
+` : void 0);
+ }, t.prototype._createTextureAndPostProcesses = function() {
+ var e = this, n = this._mainTextureDesiredSize.width * this._options.blurTextureSizeRatio, i = this._mainTextureDesiredSize.height * this._options.blurTextureSizeRatio;
+ n = this._engine.needPOTTextures ? ke.a.GetExponentOfTwo(n, this._maxSize) : n, i = this._engine.needPOTTextures ? ke.a.GetExponentOfTwo(i, this._maxSize) : i;
+ var o = 0;
+ o = this._engine.getCaps().textureHalfFloatRender ? d.a.TEXTURETYPE_HALF_FLOAT : d.a.TEXTURETYPE_UNSIGNED_INT, this._blurTexture = new bn("HighlightLayerBlurRTT", { width: n, height: i }, this._scene, !1, !0, o), this._blurTexture.wrapU = Ue.a.CLAMP_ADDRESSMODE, this._blurTexture.wrapV = Ue.a.CLAMP_ADDRESSMODE, this._blurTexture.anisotropicFilteringLevel = 16, this._blurTexture.updateSamplingMode(Ue.a.TRILINEAR_SAMPLINGMODE), this._blurTexture.renderParticles = !1, this._blurTexture.ignoreCameraViewport = !0, this._textures = [this._blurTexture], this._options.alphaBlendingMode === d.a.ALPHA_COMBINE ? (this._downSamplePostprocess = new _r("HighlightLayerPPP", this._options.blurTextureSizeRatio, null, Ue.a.BILINEAR_SAMPLINGMODE, this._scene.getEngine()), this._downSamplePostprocess.onApplyObservable.add(function(a) {
+ a.setTexture("textureSampler", e._mainTexture);
+ }), this._horizontalBlurPostprocess = new If("HighlightLayerHBP", new c.d(1, 0), this._options.blurHorizontalSize, 1, null, Ue.a.BILINEAR_SAMPLINGMODE, this._scene.getEngine()), this._horizontalBlurPostprocess.onApplyObservable.add(function(a) {
+ a.setFloat2("screenSize", n, i);
+ }), this._verticalBlurPostprocess = new If("HighlightLayerVBP", new c.d(0, 1), this._options.blurVerticalSize, 1, null, Ue.a.BILINEAR_SAMPLINGMODE, this._scene.getEngine()), this._verticalBlurPostprocess.onApplyObservable.add(function(a) {
+ a.setFloat2("screenSize", n, i);
+ }), this._postProcesses = [this._downSamplePostprocess, this._horizontalBlurPostprocess, this._verticalBlurPostprocess]) : (this._horizontalBlurPostprocess = new xn("HighlightLayerHBP", new c.d(1, 0), this._options.blurHorizontalSize / 2, { width: n, height: i }, null, Ue.a.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1, o), this._horizontalBlurPostprocess.width = n, this._horizontalBlurPostprocess.height = i, this._horizontalBlurPostprocess.onApplyObservable.add(function(a) {
+ a.setTexture("textureSampler", e._mainTexture);
+ }), this._verticalBlurPostprocess = new xn("HighlightLayerVBP", new c.d(0, 1), this._options.blurVerticalSize / 2, { width: n, height: i }, null, Ue.a.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1, o), this._postProcesses = [this._horizontalBlurPostprocess, this._verticalBlurPostprocess]), this._mainTexture.onAfterUnbindObservable.add(function() {
+ e.onBeforeBlurObservable.notifyObservers(e);
+ var a = e._blurTexture.getInternalTexture();
+ a && (e._scene.postProcessManager.directRender(e._postProcesses, a, !0), e._engine.unBindFramebuffer(a, !0)), e.onAfterBlurObservable.notifyObservers(e);
+ }), this._postProcesses.map(function(a) {
+ a.autoClear = !1;
+ });
+ }, t.prototype.needStencil = function() {
+ return !0;
+ }, t.prototype.isReady = function(e, n) {
+ var i = e.getMaterial(), o = e.getRenderingMesh();
+ if (!i || !o || !this._meshes)
+ return !1;
+ var a = null, s = this._meshes[o.uniqueId];
+ return s && s.glowEmissiveOnly && i && (a = i.emissiveTexture), r.prototype._isReady.call(this, e, n, a);
+ }, t.prototype._internalRender = function(e) {
+ e.setTexture("textureSampler", this._blurTexture);
+ var n = this._engine;
+ n.cacheStencilState(), n.setStencilOperationPass(d.a.REPLACE), n.setStencilOperationFail(d.a.KEEP), n.setStencilOperationDepthFail(d.a.KEEP), n.setStencilMask(0), n.setStencilBuffer(!0), n.setStencilFunctionReference(this._instanceGlowingMeshStencilReference), this.outerGlow && (e.setFloat("offset", 0), n.setStencilFunction(d.a.NOTEQUAL), n.drawElementsType(Zt.a.TriangleFillMode, 0, 6)), this.innerGlow && (e.setFloat("offset", 1), n.setStencilFunction(d.a.EQUAL), n.drawElementsType(Zt.a.TriangleFillMode, 0, 6)), n.restoreStencilState();
+ }, t.prototype.shouldRender = function() {
+ return !!r.prototype.shouldRender.call(this) && !!this._meshes;
+ }, t.prototype._shouldRenderMesh = function(e) {
+ return (!this._excludedMeshes || !this._excludedMeshes[e.uniqueId]) && !!r.prototype.hasMesh.call(this, e);
+ }, t.prototype._canRenderMesh = function(e, n) {
+ return !0;
+ }, t.prototype._addCustomEffectDefines = function(e) {
+ e.push("#define HIGHLIGHT");
+ }, t.prototype._setEmissiveTextureAndColor = function(e, n, i) {
+ var o = this._meshes[e.uniqueId];
+ o ? this._emissiveTextureAndColor.color.set(o.color.r, o.color.g, o.color.b, 1) : this._emissiveTextureAndColor.color.set(this.neutralColor.r, this.neutralColor.g, this.neutralColor.b, this.neutralColor.a), o && o.glowEmissiveOnly && i ? (this._emissiveTextureAndColor.texture = i.emissiveTexture, this._emissiveTextureAndColor.color.set(1, 1, 1, 1)) : this._emissiveTextureAndColor.texture = null;
+ }, t.prototype.addExcludedMesh = function(e) {
+ this._excludedMeshes && (this._excludedMeshes[e.uniqueId] || (this._excludedMeshes[e.uniqueId] = { mesh: e, beforeBind: e.onBeforeBindObservable.add(function(n) {
+ n.getEngine().setStencilBuffer(!1);
+ }), afterRender: e.onAfterRenderObservable.add(function(n) {
+ n.getEngine().setStencilBuffer(!0);
+ }) }));
+ }, t.prototype.removeExcludedMesh = function(e) {
+ if (this._excludedMeshes) {
+ var n = this._excludedMeshes[e.uniqueId];
+ n && (n.beforeBind && e.onBeforeBindObservable.remove(n.beforeBind), n.afterRender && e.onAfterRenderObservable.remove(n.afterRender)), this._excludedMeshes[e.uniqueId] = null;
+ }
+ }, t.prototype.hasMesh = function(e) {
+ return !!this._meshes && !!r.prototype.hasMesh.call(this, e) && this._meshes[e.uniqueId] !== void 0 && this._meshes[e.uniqueId] !== null;
+ }, t.prototype.addMesh = function(e, n, i) {
+ var o = this;
+ if (i === void 0 && (i = !1), this._meshes) {
+ var a = this._meshes[e.uniqueId];
+ a ? a.color = n : (this._meshes[e.uniqueId] = { mesh: e, color: n, observerHighlight: e.onBeforeBindObservable.add(function(s) {
+ o.isEnabled && (o._excludedMeshes && o._excludedMeshes[s.uniqueId] ? o._defaultStencilReference(s) : s.getScene().getEngine().setStencilFunctionReference(o._instanceGlowingMeshStencilReference));
+ }), observerDefault: e.onAfterRenderObservable.add(function(s) {
+ o.isEnabled && o._defaultStencilReference(s);
+ }), glowEmissiveOnly: i }, e.onDisposeObservable.add(function() {
+ o._disposeMesh(e);
+ })), this._shouldRender = !0;
+ }
+ }, t.prototype.removeMesh = function(e) {
+ if (this._meshes) {
+ var n = this._meshes[e.uniqueId];
+ for (var i in n && (n.observerHighlight && e.onBeforeBindObservable.remove(n.observerHighlight), n.observerDefault && e.onAfterRenderObservable.remove(n.observerDefault), delete this._meshes[e.uniqueId]), this._shouldRender = !1, this._meshes)
+ if (this._meshes[i]) {
+ this._shouldRender = !0;
+ break;
+ }
+ }
+ }, t.prototype.removeAllMeshes = function() {
+ if (this._meshes) {
+ for (var e in this._meshes)
+ if (this._meshes.hasOwnProperty(e)) {
+ var n = this._meshes[e];
+ n && this.removeMesh(n.mesh);
+ }
+ }
+ }, t.prototype._defaultStencilReference = function(e) {
+ e.getScene().getEngine().setStencilFunctionReference(t.NormalMeshStencilReference);
+ }, t.prototype._disposeMesh = function(e) {
+ this.removeMesh(e), this.removeExcludedMesh(e);
+ }, t.prototype.dispose = function() {
+ if (this._meshes) {
+ for (var e in this._meshes)
+ (n = this._meshes[e]) && n.mesh && (n.observerHighlight && n.mesh.onBeforeBindObservable.remove(n.observerHighlight), n.observerDefault && n.mesh.onAfterRenderObservable.remove(n.observerDefault));
+ this._meshes = null;
+ }
+ if (this._excludedMeshes) {
+ for (var e in this._excludedMeshes) {
+ var n;
+ (n = this._excludedMeshes[e]) && (n.beforeBind && n.mesh.onBeforeBindObservable.remove(n.beforeBind), n.afterRender && n.mesh.onAfterRenderObservable.remove(n.afterRender));
+ }
+ this._excludedMeshes = null;
+ }
+ r.prototype.dispose.call(this);
+ }, t.prototype.getClassName = function() {
+ return "HighlightLayer";
+ }, t.prototype.serialize = function() {
+ var e = w.a.Serialize(this);
+ if (e.customType = "BABYLON.HighlightLayer", e.meshes = [], this._meshes)
+ for (var n in this._meshes) {
+ var i = this._meshes[n];
+ i && e.meshes.push({ glowEmissiveOnly: i.glowEmissiveOnly, color: i.color.asArray(), meshId: i.mesh.id });
+ }
+ if (e.excludedMeshes = [], this._excludedMeshes)
+ for (var o in this._excludedMeshes) {
+ var a = this._excludedMeshes[o];
+ a && e.excludedMeshes.push(a.mesh.id);
+ }
+ return e;
+ }, t.Parse = function(e, n, i) {
+ var o, a = w.a.Parse(function() {
+ return new t(e.name, n, e.options);
+ }, e, n, i);
+ for (o = 0; o < e.excludedMeshes.length; o++)
+ (s = n.getMeshByID(e.excludedMeshes[o])) && a.addExcludedMesh(s);
+ for (o = 0; o < e.meshes.length; o++) {
+ var s, p = e.meshes[o];
+ (s = n.getMeshByID(p.meshId)) && a.addMesh(s, C.a.FromArray(p.color), p.glowEmissiveOnly);
+ }
+ return a;
+ }, t.EffectName = "HighlightLayer", t.NeutralColor = new C.b(0, 0, 0, 0), t.GlowingMeshStencilReference = 2, t.NormalMeshStencilReference = 1, Object(u.c)([Object(w.c)()], t.prototype, "innerGlow", void 0), Object(u.c)([Object(w.c)()], t.prototype, "outerGlow", void 0), Object(u.c)([Object(w.c)()], t.prototype, "blurHorizontalSize", null), Object(u.c)([Object(w.c)()], t.prototype, "blurVerticalSize", null), Object(u.c)([Object(w.c)("options")], t.prototype, "_options", void 0), t;
+ }(Oa);
+ x.a.RegisteredTypes["BABYLON.HighlightLayer"] = jl;
+ var Df = function() {
+ function r(t) {
+ this.name = st.a.NAME_LAYER, this.scene = t, this._engine = t.getEngine(), t.layers = new Array();
+ }
+ return r.prototype.register = function() {
+ this.scene._beforeCameraDrawStage.registerStep(st.a.STEP_BEFORECAMERADRAW_LAYER, this, this._drawCameraBackground), this.scene._afterCameraDrawStage.registerStep(st.a.STEP_AFTERCAMERADRAW_LAYER, this, this._drawCameraForeground), this.scene._beforeRenderTargetDrawStage.registerStep(st.a.STEP_BEFORERENDERTARGETDRAW_LAYER, this, this._drawRenderTargetBackground), this.scene._afterRenderTargetDrawStage.registerStep(st.a.STEP_AFTERRENDERTARGETDRAW_LAYER, this, this._drawRenderTargetForeground);
+ }, r.prototype.rebuild = function() {
+ for (var t = 0, e = this.scene.layers; t < e.length; t++)
+ e[t]._rebuild();
+ }, r.prototype.dispose = function() {
+ for (var t = this.scene.layers; t.length; )
+ t[0].dispose();
+ }, r.prototype._draw = function(t) {
+ var e = this.scene.layers;
+ if (e.length) {
+ this._engine.setDepthBuffer(!1);
+ for (var n = 0, i = e; n < i.length; n++) {
+ var o = i[n];
+ t(o) && o.render();
+ }
+ this._engine.setDepthBuffer(!0);
+ }
+ }, r.prototype._drawCameraPredicate = function(t, e, n) {
+ return !t.renderOnlyInRenderTargetTextures && t.isBackground === e && (t.layerMask & n) != 0;
+ }, r.prototype._drawCameraBackground = function(t) {
+ var e = this;
+ this._draw(function(n) {
+ return e._drawCameraPredicate(n, !0, t.layerMask);
+ });
+ }, r.prototype._drawCameraForeground = function(t) {
+ var e = this;
+ this._draw(function(n) {
+ return e._drawCameraPredicate(n, !1, t.layerMask);
+ });
+ }, r.prototype._drawRenderTargetPredicate = function(t, e, n, i) {
+ return t.renderTargetTextures.length > 0 && t.isBackground === e && t.renderTargetTextures.indexOf(i) > -1 && (t.layerMask & n) != 0;
+ }, r.prototype._drawRenderTargetBackground = function(t) {
+ var e = this;
+ this._draw(function(n) {
+ return e._drawRenderTargetPredicate(n, !0, e.scene.activeCamera.layerMask, t);
+ });
+ }, r.prototype._drawRenderTargetForeground = function(t) {
+ var e = this;
+ this._draw(function(n) {
+ return e._drawRenderTargetPredicate(n, !1, e.scene.activeCamera.layerMask, t);
+ });
+ }, r.prototype.addFromContainer = function(t) {
+ var e = this;
+ t.layers && t.layers.forEach(function(n) {
+ e.scene.layers.push(n);
+ });
+ }, r.prototype.removeFromContainer = function(t, e) {
+ var n = this;
+ e === void 0 && (e = !1), t.layers && t.layers.forEach(function(i) {
+ var o = n.scene.layers.indexOf(i);
+ o !== -1 && n.scene.layers.splice(o, 1), e && i.dispose();
+ });
+ }, r;
+ }(), Hy = `
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+
+uniform vec4 color;
+
+#include
+void main(void) {
+vec4 baseColor=texture2D(textureSampler,vUV);
+#ifdef LINEAR
+baseColor.rgb=toGammaSpace(baseColor.rgb);
+#endif
+#ifdef ALPHATEST
+if (baseColor.a<0.4)
+discard;
+#endif
+gl_FragColor=baseColor*color;
+}`;
+ We.a.ShadersStore.layerPixelShader = Hy;
+ var Wy = `
+attribute vec2 position;
+
+uniform vec2 scale;
+uniform vec2 offset;
+uniform mat4 textureMatrix;
+
+varying vec2 vUV;
+const vec2 madd=vec2(0.5,0.5);
+void main(void) {
+vec2 shiftedPosition=position*scale+offset;
+vUV=vec2(textureMatrix*vec4(shiftedPosition*madd+madd,1.0,0.0));
+gl_Position=vec4(shiftedPosition,0.0,1.0);
+}`;
+ We.a.ShadersStore.layerVertexShader = Wy;
+ var Xy = function() {
+ function r(t, e, n, i, o) {
+ this.name = t, this.scale = new c.d(1, 1), this.offset = new c.d(0, 0), this.alphaBlendingMode = d.a.ALPHA_COMBINE, this.layerMask = 268435455, this.renderTargetTextures = [], this.renderOnlyInRenderTargetTextures = !1, this._vertexBuffers = {}, this.onDisposeObservable = new P.c(), this.onBeforeRenderObservable = new P.c(), this.onAfterRenderObservable = new P.c(), this.texture = e ? new Ue.a(e, n, !0) : null, this.isBackground = i === void 0 || i, this.color = o === void 0 ? new C.b(1, 1, 1, 1) : o, this._scene = n || te.a.LastCreatedScene;
+ var a = this._scene._getComponent(st.a.NAME_LAYER);
+ a || (a = new Df(this._scene), this._scene._addComponent(a)), this._scene.layers.push(this);
+ var s = this._scene.getEngine(), p = [];
+ p.push(1, 1), p.push(-1, 1), p.push(-1, -1), p.push(1, -1);
+ var m = new De.b(s, p, De.b.PositionKind, !1, !1, 2);
+ this._vertexBuffers[De.b.PositionKind] = m, this._createIndexBuffer();
+ }
+ return Object.defineProperty(r.prototype, "onDispose", { set: function(t) {
+ this._onDisposeObserver && this.onDisposeObservable.remove(this._onDisposeObserver), this._onDisposeObserver = this.onDisposeObservable.add(t);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "onBeforeRender", { set: function(t) {
+ this._onBeforeRenderObserver && this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver), this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(t);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "onAfterRender", { set: function(t) {
+ this._onAfterRenderObserver && this.onAfterRenderObservable.remove(this._onAfterRenderObserver), this._onAfterRenderObserver = this.onAfterRenderObservable.add(t);
+ }, enumerable: !1, configurable: !0 }), r.prototype._createIndexBuffer = function() {
+ var t = this._scene.getEngine(), e = [];
+ e.push(0), e.push(1), e.push(2), e.push(0), e.push(2), e.push(3), this._indexBuffer = t.createIndexBuffer(e);
+ }, r.prototype._rebuild = function() {
+ var t = this._vertexBuffers[De.b.PositionKind];
+ t && t._rebuild(), this._createIndexBuffer();
+ }, r.prototype.render = function() {
+ var t = this._scene.getEngine(), e = "";
+ this.alphaTest && (e = "#define ALPHATEST"), this.texture && !this.texture.gammaSpace && (e += `\r
+#define LINEAR`), this._previousDefines !== e && (this._previousDefines = e, this._effect = t.createEffect("layer", [De.b.PositionKind], ["textureMatrix", "color", "scale", "offset"], ["textureSampler"], e));
+ var n = this._effect;
+ n && n.isReady() && this.texture && this.texture.isReady() && (t = this._scene.getEngine(), this.onBeforeRenderObservable.notifyObservers(this), t.enableEffect(n), t.setState(!1), n.setTexture("textureSampler", this.texture), n.setMatrix("textureMatrix", this.texture.getTextureMatrix()), n.setFloat4("color", this.color.r, this.color.g, this.color.b, this.color.a), n.setVector2("offset", this.offset), n.setVector2("scale", this.scale), t.bindBuffers(this._vertexBuffers, this._indexBuffer, n), this.alphaTest ? t.drawElementsType(Zt.a.TriangleFillMode, 0, 6) : (t.setAlphaMode(this.alphaBlendingMode), t.drawElementsType(Zt.a.TriangleFillMode, 0, 6), t.setAlphaMode(d.a.ALPHA_DISABLE)), this.onAfterRenderObservable.notifyObservers(this));
+ }, r.prototype.dispose = function() {
+ var t = this._vertexBuffers[De.b.PositionKind];
+ t && (t.dispose(), this._vertexBuffers[De.b.PositionKind] = null), this._indexBuffer && (this._scene.getEngine()._releaseBuffer(this._indexBuffer), this._indexBuffer = null), this.texture && (this.texture.dispose(), this.texture = null), this.renderTargetTextures = [];
+ var e = this._scene.layers.indexOf(this);
+ this._scene.layers.splice(e, 1), this.onDisposeObservable.notifyObservers(this), this.onDisposeObservable.clear(), this.onAfterRenderObservable.clear(), this.onBeforeRenderObservable.clear();
+ }, r;
+ }(), Lf = function() {
+ function r(t, e, n, i, o) {
+ this.size = t, this.position = e, this.alphaMode = d.a.ALPHA_ONEONE, this.color = n || new C.a(1, 1, 1), this.texture = i ? new Ue.a(i, o.getScene(), !0) : null, this._system = o, o.lensFlares.push(this);
+ }
+ return r.AddFlare = function(t, e, n, i, o) {
+ return new r(t, e, n, i, o);
+ }, r.prototype.dispose = function() {
+ this.texture && this.texture.dispose();
+ var t = this._system.lensFlares.indexOf(this);
+ this._system.lensFlares.splice(t, 1);
+ }, r;
+ }(), Yy = `
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+
+uniform vec4 color;
+void main(void) {
+vec4 baseColor=texture2D(textureSampler,vUV);
+gl_FragColor=baseColor*color;
+}`;
+ We.a.ShadersStore.lensFlarePixelShader = Yy;
+ var Ky = `
+attribute vec2 position;
+
+uniform mat4 viewportMatrix;
+
+varying vec2 vUV;
+const vec2 madd=vec2(0.5,0.5);
+void main(void) {
+vUV=position*madd+madd;
+gl_Position=viewportMatrix*vec4(position,0.0,1.0);
+}`;
+ We.a.ShadersStore.lensFlareVertexShader = Ky;
+ var Hl = function() {
+ function r(t, e, n) {
+ this.name = t, this.lensFlares = new Array(), this.borderLimit = 300, this.viewportBorder = 0, this.layerMask = 268435455, this._vertexBuffers = {}, this._isEnabled = !0, this._scene = n || te.a.LastCreatedScene, r._SceneComponentInitialization(this._scene), this._emitter = e, this.id = t, n.lensFlareSystems.push(this), this.meshesSelectionPredicate = function(s) {
+ return n.activeCamera && s.material && s.isVisible && s.isEnabled() && s.isBlocker && (s.layerMask & n.activeCamera.layerMask) != 0;
+ };
+ var i = n.getEngine(), o = [];
+ o.push(1, 1), o.push(-1, 1), o.push(-1, -1), o.push(1, -1), this._vertexBuffers[De.b.PositionKind] = new De.b(i, o, De.b.PositionKind, !1, !1, 2);
+ var a = [];
+ a.push(0), a.push(1), a.push(2), a.push(0), a.push(2), a.push(3), this._indexBuffer = i.createIndexBuffer(a), this._effect = i.createEffect("lensFlare", [De.b.PositionKind], ["color", "viewportMatrix"], ["textureSampler"], "");
+ }
+ return Object.defineProperty(r.prototype, "isEnabled", { get: function() {
+ return this._isEnabled;
+ }, set: function(t) {
+ this._isEnabled = t;
+ }, enumerable: !1, configurable: !0 }), r.prototype.getScene = function() {
+ return this._scene;
+ }, r.prototype.getEmitter = function() {
+ return this._emitter;
+ }, r.prototype.setEmitter = function(t) {
+ this._emitter = t;
+ }, r.prototype.getEmitterPosition = function() {
+ return this._emitter.getAbsolutePosition ? this._emitter.getAbsolutePosition() : this._emitter.position;
+ }, r.prototype.computeEffectivePosition = function(t) {
+ var e = this.getEmitterPosition();
+ return e = c.e.Project(e, c.a.Identity(), this._scene.getTransformMatrix(), t), this._positionX = e.x, this._positionY = e.y, e = c.e.TransformCoordinates(this.getEmitterPosition(), this._scene.getViewMatrix()), this.viewportBorder > 0 && (t.x -= this.viewportBorder, t.y -= this.viewportBorder, t.width += 2 * this.viewportBorder, t.height += 2 * this.viewportBorder, e.x += this.viewportBorder, e.y += this.viewportBorder, this._positionX += this.viewportBorder, this._positionY += this.viewportBorder), e.z > 0 && (this._positionX > t.x && this._positionX < t.x + t.width && this._positionY > t.y && (this._positionY, t.y, t.height), !0);
+ }, r.prototype._isVisible = function() {
+ if (!this._isEnabled || !this._scene.activeCamera)
+ return !1;
+ var t = this.getEmitterPosition().subtract(this._scene.activeCamera.globalPosition), e = t.length();
+ t.normalize();
+ var n = new An.a(this._scene.activeCamera.globalPosition, t), i = this._scene.pickWithRay(n, this.meshesSelectionPredicate, !0);
+ return !i || !i.hit || i.distance > e;
+ }, r.prototype.render = function() {
+ if (!this._effect.isReady() || !this._scene.activeCamera)
+ return !1;
+ var t, e, n = this._scene.getEngine(), i = this._scene.activeCamera.viewport.toGlobal(n.getRenderWidth(!0), n.getRenderHeight(!0));
+ if (!this.computeEffectivePosition(i) || !this._isVisible())
+ return !1;
+ var o = (t = this._positionX < this.borderLimit + i.x ? this.borderLimit + i.x - this._positionX : this._positionX > i.x + i.width - this.borderLimit ? this._positionX - i.x - i.width + this.borderLimit : 0) > (e = this._positionY < this.borderLimit + i.y ? this.borderLimit + i.y - this._positionY : this._positionY > i.y + i.height - this.borderLimit ? this._positionY - i.y - i.height + this.borderLimit : 0) ? t : e;
+ (o -= this.viewportBorder) > this.borderLimit && (o = this.borderLimit);
+ var a = 1 - ee.a.Clamp(o / this.borderLimit, 0, 1);
+ if (a < 0)
+ return !1;
+ a > 1 && (a = 1), this.viewportBorder > 0 && (i.x += this.viewportBorder, i.y += this.viewportBorder, i.width -= 2 * this.viewportBorder, i.height -= 2 * this.viewportBorder, this._positionX -= this.viewportBorder, this._positionY -= this.viewportBorder);
+ var s = i.x + i.width / 2, p = i.y + i.height / 2, m = s - this._positionX, S = p - this._positionY;
+ n.enableEffect(this._effect), n.setState(!1), n.setDepthBuffer(!1), n.bindBuffers(this._vertexBuffers, this._indexBuffer, this._effect);
+ for (var O = 0; O < this.lensFlares.length; O++) {
+ var I = this.lensFlares[O];
+ if (!I.texture || I.texture.isReady()) {
+ n.setAlphaMode(I.alphaMode);
+ var G = s - m * I.position, k = p - S * I.position, K = I.size, re = I.size * n.getAspectRatio(this._scene.activeCamera, !0), se = G / (i.width + 2 * i.x) * 2 - 1, ue = 1 - k / (i.height + 2 * i.y) * 2, he = c.a.FromValues(K / 2, 0, 0, 0, 0, re / 2, 0, 0, 0, 0, 1, 0, se, ue, 0, 1);
+ this._effect.setMatrix("viewportMatrix", he), this._effect.setTexture("textureSampler", I.texture), this._effect.setFloat4("color", I.color.r * a, I.color.g * a, I.color.b * a, 1), n.drawElementsType(Zt.a.TriangleFillMode, 0, 6);
+ }
+ }
+ return n.setDepthBuffer(!0), n.setAlphaMode(d.a.ALPHA_DISABLE), !0;
+ }, r.prototype.dispose = function() {
+ var t = this._vertexBuffers[De.b.PositionKind];
+ for (t && (t.dispose(), this._vertexBuffers[De.b.PositionKind] = null), this._indexBuffer && (this._scene.getEngine()._releaseBuffer(this._indexBuffer), this._indexBuffer = null); this.lensFlares.length; )
+ this.lensFlares[0].dispose();
+ var e = this._scene.lensFlareSystems.indexOf(this);
+ this._scene.lensFlareSystems.splice(e, 1);
+ }, r.Parse = function(t, e, n) {
+ var i = e.getLastEntryByID(t.emitterId), o = t.name || "lensFlareSystem#" + t.emitterId, a = new r(o, i, e);
+ a.id = t.id || o, a.borderLimit = t.borderLimit;
+ for (var s = 0; s < t.flares.length; s++) {
+ var p = t.flares[s];
+ Lf.AddFlare(p.size, p.position, C.a.FromArray(p.color), p.textureName ? n + p.textureName : "", a);
+ }
+ return a;
+ }, r.prototype.serialize = function() {
+ var t = {};
+ t.id = this.id, t.name = this.name, t.emitterId = this.getEmitter().id, t.borderLimit = this.borderLimit, t.flares = [];
+ for (var e = 0; e < this.lensFlares.length; e++) {
+ var n = this.lensFlares[e];
+ t.flares.push({ size: n.size, position: n.position, color: n.color.asArray(), textureName: Ke.b.GetFilename(n.texture ? n.texture.name : "") });
+ }
+ return t;
+ }, r._SceneComponentInitialization = function(t) {
+ throw Nn.a.WarnImport("LensFlareSystemSceneComponent");
+ }, r;
+ }();
+ D.a.AddParser(st.a.NAME_LENSFLARESYSTEM, function(r, t, e, n) {
+ if (r.lensFlareSystems !== void 0 && r.lensFlareSystems !== null) {
+ e.lensFlareSystems || (e.lensFlareSystems = new Array());
+ for (var i = 0, o = r.lensFlareSystems.length; i < o; i++) {
+ var a = r.lensFlareSystems[i], s = Hl.Parse(a, t, n);
+ e.lensFlareSystems.push(s);
+ }
+ }
+ }), D.a.prototype.getLensFlareSystemByName = function(r) {
+ for (var t = 0; t < this.lensFlareSystems.length; t++)
+ if (this.lensFlareSystems[t].name === r)
+ return this.lensFlareSystems[t];
+ return null;
+ }, D.a.prototype.getLensFlareSystemByID = function(r) {
+ for (var t = 0; t < this.lensFlareSystems.length; t++)
+ if (this.lensFlareSystems[t].id === r)
+ return this.lensFlareSystems[t];
+ return null;
+ }, D.a.prototype.removeLensFlareSystem = function(r) {
+ var t = this.lensFlareSystems.indexOf(r);
+ return t !== -1 && this.lensFlareSystems.splice(t, 1), t;
+ }, D.a.prototype.addLensFlareSystem = function(r) {
+ this.lensFlareSystems.push(r);
+ };
+ var wf = function() {
+ function r(t) {
+ this.name = st.a.NAME_LENSFLARESYSTEM, this.scene = t, t.lensFlareSystems = new Array();
+ }
+ return r.prototype.register = function() {
+ this.scene._afterCameraDrawStage.registerStep(st.a.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM, this, this._draw);
+ }, r.prototype.rebuild = function() {
+ }, r.prototype.addFromContainer = function(t) {
+ var e = this;
+ t.lensFlareSystems && t.lensFlareSystems.forEach(function(n) {
+ e.scene.addLensFlareSystem(n);
+ });
+ }, r.prototype.removeFromContainer = function(t, e) {
+ var n = this;
+ t.lensFlareSystems && t.lensFlareSystems.forEach(function(i) {
+ n.scene.removeLensFlareSystem(i), e && i.dispose();
+ });
+ }, r.prototype.serialize = function(t) {
+ t.lensFlareSystems = [];
+ for (var e = 0, n = this.scene.lensFlareSystems; e < n.length; e++) {
+ var i = n[e];
+ t.lensFlareSystems.push(i.serialize());
+ }
+ }, r.prototype.dispose = function() {
+ for (var t = this.scene.lensFlareSystems; t.length; )
+ t[0].dispose();
+ }, r.prototype._draw = function(t) {
+ if (this.scene.lensFlaresEnabled) {
+ var e = this.scene.lensFlareSystems;
+ Ke.b.StartPerformanceCounter("Lens flares", e.length > 0);
+ for (var n = 0, i = e; n < i.length; n++) {
+ var o = i[n];
+ t.layerMask & o.layerMask && o.render();
+ }
+ Ke.b.EndPerformanceCounter("Lens flares", e.length > 0);
+ }
+ }, r;
+ }();
+ Hl._SceneComponentInitialization = function(r) {
+ var t = r._getComponent(st.a.NAME_LENSFLARESYSTEM);
+ t || (t = new wf(r), r._addComponent(t));
+ };
+ var Qy = `
+
+
+
+
+float bayerDither2(vec2 _P) {
+return mod(2.0*_P.y+_P.x+1.0,4.0);
+}
+
+
+float bayerDither4(vec2 _P) {
+vec2 P1=mod(_P,2.0);
+vec2 P2=floor(0.5*mod(_P,4.0));
+return 4.0*bayerDither2(P1)+bayerDither2(P2);
+}
+
+float bayerDither8(vec2 _P) {
+vec2 P1=mod(_P,2.0);
+vec2 P2=floor(0.5*mod(_P,4.0));
+vec2 P4=floor(0.25*mod(_P,8.0));
+return 4.0*(4.0*bayerDither2(P1)+bayerDither2(P2))+bayerDither2(P4);
+}
+`;
+ We.a.IncludesShadersStore.bayerDitherFunctions = Qy;
+ var qy = `#if SM_FLOAT == 0
+#include
+#endif
+#if SM_SOFTTRANSPARENTSHADOW == 1
+#include
+uniform float softTransparentShadowSM;
+#endif
+varying float vDepthMetricSM;
+#if SM_USEDISTANCE == 1
+uniform vec3 lightDataSM;
+varying vec3 vPositionWSM;
+#endif
+uniform vec3 biasAndScaleSM;
+uniform vec2 depthValuesSM;
+#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP == 1
+varying float zSM;
+#endif
+`;
+ We.a.IncludesShadersStore.shadowMapFragmentDeclaration = qy;
+ var Zy = ` float depthSM=vDepthMetricSM;
+#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP == 1
+#if SM_USEDISTANCE == 1
+depthSM=clamp(((length(vPositionWSM-lightDataSM)+depthValuesSM.x)/(depthValuesSM.y))+biasAndScaleSM.x,0.0,1.0);
+#else
+depthSM=clamp(((zSM+depthValuesSM.x)/(depthValuesSM.y))+biasAndScaleSM.x,0.0,1.0);
+#endif
+gl_FragDepth=depthSM;
+#elif SM_USEDISTANCE == 1
+depthSM=(length(vPositionWSM-lightDataSM)+depthValuesSM.x)/(depthValuesSM.y)+biasAndScaleSM.x;
+#endif
+#if SM_ESM == 1
+depthSM=clamp(exp(-min(87.,biasAndScaleSM.z*depthSM)),0.,1.);
+#endif
+#if SM_FLOAT == 1
+gl_FragColor=vec4(depthSM,1.0,1.0,1.0);
+#else
+gl_FragColor=pack(depthSM);
+#endif
+return;`;
+ We.a.IncludesShadersStore.shadowMapFragment = Zy;
+ var Jy = `#include
+#ifdef ALPHATEST
+varying vec2 vUV;
+uniform sampler2D diffuseSampler;
+#endif
+#include
+void main(void)
+{
+#include
+#ifdef ALPHATEST
+float alphaFromAlphaTexture=texture2D(diffuseSampler,vUV).a;
+if (alphaFromAlphaTexture<0.4)
+discard;
+#endif
+#if SM_SOFTTRANSPARENTSHADOW == 1
+#ifdef ALPHATEST
+if ((bayerDither8(floor(mod(gl_FragCoord.xy,8.0))))/64.0>=softTransparentShadowSM*alphaFromAlphaTexture) discard;
+#else
+if ((bayerDither8(floor(mod(gl_FragCoord.xy,8.0))))/64.0>=softTransparentShadowSM) discard;
+#endif
+#endif
+#include
+}`;
+ We.a.ShadersStore.shadowMapPixelShader = Jy;
+ var $y = `#if SM_NORMALBIAS == 1
+uniform vec3 lightDataSM;
+#endif
+uniform vec3 biasAndScaleSM;
+uniform vec2 depthValuesSM;
+varying float vDepthMetricSM;
+#if SM_USEDISTANCE == 1
+varying vec3 vPositionWSM;
+#endif
+#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP == 1
+varying float zSM;
+#endif
+`;
+ We.a.IncludesShadersStore.shadowMapVertexDeclaration = $y;
+ var e0 = `
+#if SM_NORMALBIAS == 1
+#if SM_DIRECTIONINLIGHTDATA == 1
+vec3 worldLightDirSM=normalize(-lightDataSM.xyz);
+#else
+vec3 directionToLightSM=lightDataSM.xyz-worldPos.xyz;
+vec3 worldLightDirSM=normalize(directionToLightSM);
+#endif
+float ndlSM=dot(vNormalW,worldLightDirSM);
+float sinNLSM=sqrt(1.0-ndlSM*ndlSM);
+float normalBiasSM=biasAndScaleSM.y*sinNLSM;
+worldPos.xyz-=vNormalW*normalBiasSM;
+#endif
+`;
+ We.a.IncludesShadersStore.shadowMapVertexNormalBias = e0;
+ var t0 = `#if SM_USEDISTANCE == 1
+vPositionWSM=worldPos.xyz;
+#endif
+#if SM_DEPTHTEXTURE == 1
+
+gl_Position.z+=biasAndScaleSM.x*gl_Position.w;
+#endif
+#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP == 1
+zSM=gl_Position.z;
+gl_Position.z=0.0;
+#elif SM_USEDISTANCE == 0
+
+vDepthMetricSM=((gl_Position.z+depthValuesSM.x)/(depthValuesSM.y))+biasAndScaleSM.x;
+#endif
+`;
+ We.a.IncludesShadersStore.shadowMapVertexMetric = t0;
+ var n0 = `
+attribute vec3 position;
+#ifdef NORMAL
+attribute vec3 normal;
+#endif
+#include
+#include
+#include[0..maxSimultaneousMorphTargets]
+
+#include
+#include
+uniform mat4 viewProjection;
+#ifdef ALPHATEST
+varying vec2 vUV;
+uniform mat4 diffuseMatrix;
+#ifdef UV1
+attribute vec2 uv;
+#endif
+#ifdef UV2
+attribute vec2 uv2;
+#endif
+#endif
+#include
+#include
+void main(void)
+{
+vec3 positionUpdated=position;
+#ifdef UV1
+vec2 uvUpdated=uv;
+#endif
+#ifdef NORMAL
+vec3 normalUpdated=normal;
+#endif
+#include[0..maxSimultaneousMorphTargets]
+#include
+#include
+vec4 worldPos=finalWorld*vec4(positionUpdated,1.0);
+#ifdef NORMAL
+mat3 normWorldSM=mat3(finalWorld);
+#if defined(INSTANCES) && defined(THIN_INSTANCES)
+vec3 vNormalW=normalUpdated/vec3(dot(normWorldSM[0],normWorldSM[0]),dot(normWorldSM[1],normWorldSM[1]),dot(normWorldSM[2],normWorldSM[2]));
+vNormalW=normalize(normWorldSM*vNormalW);
+#else
+#ifdef NONUNIFORMSCALING
+normWorldSM=transposeMat3(inverseMat3(normWorldSM));
+#endif
+vec3 vNormalW=normalize(normWorldSM*normalUpdated);
+#endif
+#endif
+#include
+
+gl_Position=viewProjection*worldPos;
+#include
+#ifdef ALPHATEST
+#ifdef UV1
+vUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));
+#endif
+#ifdef UV2
+vUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));
+#endif
+#endif
+#include
+}`;
+ We.a.ShadersStore.shadowMapVertexShader = n0;
+ var i0 = `
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+
+uniform vec2 screenSize;
+void main(void)
+{
+vec4 colorDepth=vec4(0.0);
+for (int x=-OFFSET; x<=OFFSET; x++)
+for (int y=-OFFSET; y<=OFFSET; y++)
+colorDepth+=texture2D(textureSampler,vUV+vec2(x,y)/screenSize);
+gl_FragColor=(colorDepth/float((OFFSET*2+1)*(OFFSET*2+1)));
+}`;
+ We.a.ShadersStore.depthBoxBlurPixelShader = i0;
+ var r0 = `#if SM_SOFTTRANSPARENTSHADOW == 1
+if ((bayerDither8(floor(mod(gl_FragCoord.xy,8.0))))/64.0>=softTransparentShadowSM*alpha) discard;
+#endif
+`;
+ We.a.IncludesShadersStore.shadowMapFragmentSoftTransparentShadow = r0;
+ var Nf = new c.a(), Ff = new c.a(), Zn = function() {
+ function r(t, e, n) {
+ this.onBeforeShadowMapRenderObservable = new P.c(), this.onAfterShadowMapRenderObservable = new P.c(), this.onBeforeShadowMapRenderMeshObservable = new P.c(), this.onAfterShadowMapRenderMeshObservable = new P.c(), this._bias = 5e-5, this._normalBias = 0, this._blurBoxOffset = 1, this._blurScale = 2, this._blurKernel = 1, this._useKernelBlur = !1, this._filter = r.FILTER_NONE, this._filteringQuality = r.QUALITY_HIGH, this._contactHardeningLightSizeUVRatio = 0.1, this._darkness = 0, this._transparencyShadow = !1, this.enableSoftTransparentShadow = !1, this.frustumEdgeFalloff = 0, this.forceBackFacesOnly = !1, this._lightDirection = c.e.Zero(), this._viewMatrix = c.a.Zero(), this._projectionMatrix = c.a.Zero(), this._transformMatrix = c.a.Zero(), this._cachedPosition = new c.e(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), this._cachedDirection = new c.e(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), this._currentFaceIndex = 0, this._currentFaceIndexCache = 0, this._defaultTextureMatrix = c.a.Identity(), this._mapSize = t, this._light = e, this._scene = e.getScene(), e._shadowGenerator = this, this.id = e.id, r._SceneComponentInitialization(this._scene);
+ var i = this._scene.getEngine().getCaps();
+ n ? i.textureFloatRender && i.textureFloatLinearFiltering ? this._textureType = d.a.TEXTURETYPE_FLOAT : i.textureHalfFloatRender && i.textureHalfFloatLinearFiltering ? this._textureType = d.a.TEXTURETYPE_HALF_FLOAT : this._textureType = d.a.TEXTURETYPE_UNSIGNED_INT : i.textureHalfFloatRender && i.textureHalfFloatLinearFiltering ? this._textureType = d.a.TEXTURETYPE_HALF_FLOAT : i.textureFloatRender && i.textureFloatLinearFiltering ? this._textureType = d.a.TEXTURETYPE_FLOAT : this._textureType = d.a.TEXTURETYPE_UNSIGNED_INT, this._initializeGenerator(), this._applyFilterValues();
+ }
+ return Object.defineProperty(r.prototype, "bias", { get: function() {
+ return this._bias;
+ }, set: function(t) {
+ this._bias = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "normalBias", { get: function() {
+ return this._normalBias;
+ }, set: function(t) {
+ this._normalBias = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "blurBoxOffset", { get: function() {
+ return this._blurBoxOffset;
+ }, set: function(t) {
+ this._blurBoxOffset !== t && (this._blurBoxOffset = t, this._disposeBlurPostProcesses());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "blurScale", { get: function() {
+ return this._blurScale;
+ }, set: function(t) {
+ this._blurScale !== t && (this._blurScale = t, this._disposeBlurPostProcesses());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "blurKernel", { get: function() {
+ return this._blurKernel;
+ }, set: function(t) {
+ this._blurKernel !== t && (this._blurKernel = t, this._disposeBlurPostProcesses());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "useKernelBlur", { get: function() {
+ return this._useKernelBlur;
+ }, set: function(t) {
+ this._useKernelBlur !== t && (this._useKernelBlur = t, this._disposeBlurPostProcesses());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "depthScale", { get: function() {
+ return this._depthScale !== void 0 ? this._depthScale : this._light.getDepthScale();
+ }, set: function(t) {
+ this._depthScale = t;
+ }, enumerable: !1, configurable: !0 }), r.prototype._validateFilter = function(t) {
+ return t;
+ }, Object.defineProperty(r.prototype, "filter", { get: function() {
+ return this._filter;
+ }, set: function(t) {
+ if (t = this._validateFilter(t), this._light.needCube()) {
+ if (t === r.FILTER_BLUREXPONENTIALSHADOWMAP)
+ return void (this.useExponentialShadowMap = !0);
+ if (t === r.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP)
+ return void (this.useCloseExponentialShadowMap = !0);
+ if (t === r.FILTER_PCF || t === r.FILTER_PCSS)
+ return void (this.usePoissonSampling = !0);
+ }
+ t !== r.FILTER_PCF && t !== r.FILTER_PCSS || this._scene.getEngine().webGLVersion !== 1 ? this._filter !== t && (this._filter = t, this._disposeBlurPostProcesses(), this._applyFilterValues(), this._light._markMeshesAsLightDirty()) : this.usePoissonSampling = !0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "usePoissonSampling", { get: function() {
+ return this.filter === r.FILTER_POISSONSAMPLING;
+ }, set: function(t) {
+ var e = this._validateFilter(r.FILTER_POISSONSAMPLING);
+ (t || this.filter === r.FILTER_POISSONSAMPLING) && (this.filter = t ? e : r.FILTER_NONE);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "useExponentialShadowMap", { get: function() {
+ return this.filter === r.FILTER_EXPONENTIALSHADOWMAP;
+ }, set: function(t) {
+ var e = this._validateFilter(r.FILTER_EXPONENTIALSHADOWMAP);
+ (t || this.filter === r.FILTER_EXPONENTIALSHADOWMAP) && (this.filter = t ? e : r.FILTER_NONE);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "useBlurExponentialShadowMap", { get: function() {
+ return this.filter === r.FILTER_BLUREXPONENTIALSHADOWMAP;
+ }, set: function(t) {
+ var e = this._validateFilter(r.FILTER_BLUREXPONENTIALSHADOWMAP);
+ (t || this.filter === r.FILTER_BLUREXPONENTIALSHADOWMAP) && (this.filter = t ? e : r.FILTER_NONE);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "useCloseExponentialShadowMap", { get: function() {
+ return this.filter === r.FILTER_CLOSEEXPONENTIALSHADOWMAP;
+ }, set: function(t) {
+ var e = this._validateFilter(r.FILTER_CLOSEEXPONENTIALSHADOWMAP);
+ (t || this.filter === r.FILTER_CLOSEEXPONENTIALSHADOWMAP) && (this.filter = t ? e : r.FILTER_NONE);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "useBlurCloseExponentialShadowMap", { get: function() {
+ return this.filter === r.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP;
+ }, set: function(t) {
+ var e = this._validateFilter(r.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP);
+ (t || this.filter === r.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP) && (this.filter = t ? e : r.FILTER_NONE);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "usePercentageCloserFiltering", { get: function() {
+ return this.filter === r.FILTER_PCF;
+ }, set: function(t) {
+ var e = this._validateFilter(r.FILTER_PCF);
+ (t || this.filter === r.FILTER_PCF) && (this.filter = t ? e : r.FILTER_NONE);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "filteringQuality", { get: function() {
+ return this._filteringQuality;
+ }, set: function(t) {
+ this._filteringQuality !== t && (this._filteringQuality = t, this._disposeBlurPostProcesses(), this._applyFilterValues(), this._light._markMeshesAsLightDirty());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "useContactHardeningShadow", { get: function() {
+ return this.filter === r.FILTER_PCSS;
+ }, set: function(t) {
+ var e = this._validateFilter(r.FILTER_PCSS);
+ (t || this.filter === r.FILTER_PCSS) && (this.filter = t ? e : r.FILTER_NONE);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "contactHardeningLightSizeUVRatio", { get: function() {
+ return this._contactHardeningLightSizeUVRatio;
+ }, set: function(t) {
+ this._contactHardeningLightSizeUVRatio = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "darkness", { get: function() {
+ return this._darkness;
+ }, set: function(t) {
+ this.setDarkness(t);
+ }, enumerable: !1, configurable: !0 }), r.prototype.getDarkness = function() {
+ return this._darkness;
+ }, r.prototype.setDarkness = function(t) {
+ return this._darkness = t >= 1 ? 1 : t <= 0 ? 0 : t, this;
+ }, Object.defineProperty(r.prototype, "transparencyShadow", { get: function() {
+ return this._transparencyShadow;
+ }, set: function(t) {
+ this.setTransparencyShadow(t);
+ }, enumerable: !1, configurable: !0 }), r.prototype.setTransparencyShadow = function(t) {
+ return this._transparencyShadow = t, this;
+ }, r.prototype.getShadowMap = function() {
+ return this._shadowMap;
+ }, r.prototype.getShadowMapForRendering = function() {
+ return this._shadowMap2 ? this._shadowMap2 : this._shadowMap;
+ }, r.prototype.getClassName = function() {
+ return r.CLASSNAME;
+ }, r.prototype.addShadowCaster = function(t, e) {
+ var n;
+ return e === void 0 && (e = !0), this._shadowMap ? (this._shadowMap.renderList || (this._shadowMap.renderList = []), this._shadowMap.renderList.push(t), e && (n = this._shadowMap.renderList).push.apply(n, t.getChildMeshes()), this) : this;
+ }, r.prototype.removeShadowCaster = function(t, e) {
+ if (e === void 0 && (e = !0), !this._shadowMap || !this._shadowMap.renderList)
+ return this;
+ var n = this._shadowMap.renderList.indexOf(t);
+ if (n !== -1 && this._shadowMap.renderList.splice(n, 1), e)
+ for (var i = 0, o = t.getChildren(); i < o.length; i++) {
+ var a = o[i];
+ this.removeShadowCaster(a);
+ }
+ return this;
+ }, r.prototype.getLight = function() {
+ return this._light;
+ }, Object.defineProperty(r.prototype, "mapSize", { get: function() {
+ return this._mapSize;
+ }, set: function(t) {
+ this._mapSize = t, this._light._markMeshesAsLightDirty(), this.recreateShadowMap();
+ }, enumerable: !1, configurable: !0 }), r.prototype._initializeGenerator = function() {
+ this._light._markMeshesAsLightDirty(), this._initializeShadowMap();
+ }, r.prototype._createTargetRenderTexture = function() {
+ this._scene.getEngine().webGLVersion > 1 ? (this._shadowMap = new bn(this._light.name + "_shadowMap", this._mapSize, this._scene, !1, !0, this._textureType, this._light.needCube(), void 0, !1, !1), this._shadowMap.createDepthStencilTexture(d.a.LESS, !0)) : this._shadowMap = new bn(this._light.name + "_shadowMap", this._mapSize, this._scene, !1, !0, this._textureType, this._light.needCube());
+ }, r.prototype._initializeShadowMap = function() {
+ var t = this;
+ if (this._createTargetRenderTexture(), this._shadowMap !== null) {
+ this._shadowMap.wrapU = Ue.a.CLAMP_ADDRESSMODE, this._shadowMap.wrapV = Ue.a.CLAMP_ADDRESSMODE, this._shadowMap.anisotropicFilteringLevel = 1, this._shadowMap.updateSamplingMode(Ue.a.BILINEAR_SAMPLINGMODE), this._shadowMap.renderParticles = !1, this._shadowMap.ignoreCameraViewport = !0, this._storedUniqueId && (this._shadowMap.uniqueId = this._storedUniqueId), this._shadowMap.customRenderFunction = this._renderForShadowMap.bind(this), this._shadowMap.customIsReadyFunction = function(a, s) {
+ return !0;
+ };
+ var e = this._scene.getEngine();
+ this._shadowMap.onBeforeRenderObservable.add(function(a) {
+ if (t._currentFaceIndex = a, t._filter === r.FILTER_PCF && e.setColorWrite(!1), t._scene.getSceneUniformBuffer().useUbo) {
+ var s = t._scene.getSceneUniformBuffer();
+ s.updateMatrix("viewProjection", t.getTransformMatrix()), s.updateMatrix("view", t._viewMatrix), s.update();
+ }
+ }), this._shadowMap.onAfterUnbindObservable.add(function() {
+ if (t._scene.getSceneUniformBuffer().useUbo) {
+ var a = t._scene.getSceneUniformBuffer();
+ a.updateMatrix("viewProjection", t._scene.getTransformMatrix()), a.updateMatrix("view", t._scene.getViewMatrix()), a.update();
+ }
+ if (t._filter === r.FILTER_PCF && e.setColorWrite(!0), t.useBlurExponentialShadowMap || t.useBlurCloseExponentialShadowMap) {
+ var s = t.getShadowMapForRendering();
+ if (s) {
+ var p = s.getInternalTexture();
+ t._scene.postProcessManager.directRender(t._blurPostProcesses, p, !0), e.unBindFramebuffer(p, !0);
+ }
+ }
+ });
+ var n = new C.b(0, 0, 0, 0), i = new C.b(1, 1, 1, 1);
+ this._shadowMap.onClearObservable.add(function(a) {
+ t._filter === r.FILTER_PCF ? a.clear(i, !1, !0, !1) : t.useExponentialShadowMap || t.useBlurExponentialShadowMap ? a.clear(n, !0, !0, !1) : a.clear(i, !0, !0, !1);
+ }), this._shadowMap.onResizeObservable.add(function(a) {
+ t._storedUniqueId = t._shadowMap.uniqueId, t._mapSize = a.getRenderSize(), t._light._markMeshesAsLightDirty(), t.recreateShadowMap();
+ });
+ for (var o = ga.b.MIN_RENDERINGGROUPS; o < ga.b.MAX_RENDERINGGROUPS; o++)
+ this._shadowMap.setRenderingAutoClearDepthStencil(o, !1);
+ }
+ }, r.prototype._initializeBlurRTTAndPostProcesses = function() {
+ var t = this, e = this._scene.getEngine(), n = this._mapSize / this.blurScale;
+ this.useKernelBlur && this.blurScale === 1 || (this._shadowMap2 = new bn(this._light.name + "_shadowMap2", n, this._scene, !1, !0, this._textureType), this._shadowMap2.wrapU = Ue.a.CLAMP_ADDRESSMODE, this._shadowMap2.wrapV = Ue.a.CLAMP_ADDRESSMODE, this._shadowMap2.updateSamplingMode(Ue.a.BILINEAR_SAMPLINGMODE)), this.useKernelBlur ? (this._kernelBlurXPostprocess = new xn(this._light.name + "KernelBlurX", new c.d(1, 0), this.blurKernel, 1, null, Ue.a.BILINEAR_SAMPLINGMODE, e, !1, this._textureType), this._kernelBlurXPostprocess.width = n, this._kernelBlurXPostprocess.height = n, this._kernelBlurXPostprocess.onApplyObservable.add(function(i) {
+ i.setTexture("textureSampler", t._shadowMap);
+ }), this._kernelBlurYPostprocess = new xn(this._light.name + "KernelBlurY", new c.d(0, 1), this.blurKernel, 1, null, Ue.a.BILINEAR_SAMPLINGMODE, e, !1, this._textureType), this._kernelBlurXPostprocess.autoClear = !1, this._kernelBlurYPostprocess.autoClear = !1, this._textureType === d.a.TEXTURETYPE_UNSIGNED_INT && (this._kernelBlurXPostprocess.packedFloat = !0, this._kernelBlurYPostprocess.packedFloat = !0), this._blurPostProcesses = [this._kernelBlurXPostprocess, this._kernelBlurYPostprocess]) : (this._boxBlurPostprocess = new _t(this._light.name + "DepthBoxBlur", "depthBoxBlur", ["screenSize", "boxOffset"], [], 1, null, Ue.a.BILINEAR_SAMPLINGMODE, e, !1, "#define OFFSET " + this._blurBoxOffset, this._textureType), this._boxBlurPostprocess.onApplyObservable.add(function(i) {
+ i.setFloat2("screenSize", n, n), i.setTexture("textureSampler", t._shadowMap);
+ }), this._boxBlurPostprocess.autoClear = !1, this._blurPostProcesses = [this._boxBlurPostprocess]);
+ }, r.prototype._renderForShadowMap = function(t, e, n, i) {
+ var o, a = this._scene.getEngine(), s = a.getColorWrite();
+ if (i.length) {
+ for (a.setColorWrite(!1), o = 0; o < i.length; o++)
+ this._renderSubMeshForShadowMap(i.data[o]);
+ a.setColorWrite(s);
+ }
+ for (o = 0; o < t.length; o++)
+ this._renderSubMeshForShadowMap(t.data[o]);
+ for (o = 0; o < e.length; o++)
+ this._renderSubMeshForShadowMap(e.data[o]);
+ if (this._transparencyShadow)
+ for (o = 0; o < n.length; o++)
+ this._renderSubMeshForShadowMap(n.data[o], !0);
+ else
+ for (o = 0; o < n.length; o++)
+ n.data[o].getEffectiveMesh()._internalAbstractMeshDataInfo._isActiveIntermediate = !1;
+ }, r.prototype._bindCustomEffectForRenderSubMeshForShadowMap = function(t, e, n, i) {
+ var o, a, s, p, m, S;
+ e.setMatrix((o = n == null ? void 0 : n.viewProjection) !== null && o !== void 0 ? o : "viewProjection", this.getTransformMatrix()), e.setMatrix((a = n == null ? void 0 : n.view) !== null && a !== void 0 ? a : "view", this._viewMatrix), e.setMatrix((s = n == null ? void 0 : n.projection) !== null && s !== void 0 ? s : "projection", this._projectionMatrix);
+ var O = i.getWorldMatrix();
+ e.setMatrix((p = n == null ? void 0 : n.world) !== null && p !== void 0 ? p : "world", O), O.multiplyToRef(this.getTransformMatrix(), Nf), e.setMatrix((m = n == null ? void 0 : n.worldViewProjection) !== null && m !== void 0 ? m : "worldViewProjection", Nf), O.multiplyToRef(this._viewMatrix, Ff), e.setMatrix((S = n == null ? void 0 : n.worldView) !== null && S !== void 0 ? S : "worldView", Ff);
+ }, r.prototype._renderSubMeshForShadowMap = function(t, e) {
+ var n, i;
+ e === void 0 && (e = !1);
+ var o = t.getRenderingMesh(), a = t.getEffectiveMesh(), s = this._scene, p = s.getEngine(), m = t.getMaterial();
+ if (a._internalAbstractMeshDataInfo._isActiveIntermediate = !1, m && t.verticesCount !== 0 && t._renderId !== s.getRenderId()) {
+ p.setState(m.backFaceCulling);
+ var S = o._getInstancesRenderList(t._id, !!t.getReplacementMesh());
+ if (!S.mustReturn) {
+ var O = p.getCaps().instancedArrays && (S.visibleInstances[t._id] !== null && S.visibleInstances[t._id] !== void 0 || o.hasThinInstances);
+ if (!this.customAllowRendering || this.customAllowRendering(t))
+ if (this.isReady(t, O, e)) {
+ t._renderId = s.getRenderId();
+ var I = (n = o.material) === null || n === void 0 ? void 0 : n.shadowDepthWrapper, G = (i = I == null ? void 0 : I.getEffect(t, this)) !== null && i !== void 0 ? i : this._effect;
+ if (p.enableEffect(G), o._bind(t, G, m.fillMode), this.getTransformMatrix(), G.setFloat3("biasAndScaleSM", this.bias, this.normalBias, this.depthScale), this.getLight().getTypeID() === or.a.LIGHTTYPEID_DIRECTIONALLIGHT ? G.setVector3("lightDataSM", this._cachedDirection) : G.setVector3("lightDataSM", this._cachedPosition), s.activeCamera && G.setFloat2("depthValuesSM", this.getLight().getDepthMinZ(s.activeCamera), this.getLight().getDepthMinZ(s.activeCamera) + this.getLight().getDepthMaxZ(s.activeCamera)), e && this.enableSoftTransparentShadow && G.setFloat("softTransparentShadowSM", a.visibility), I)
+ t._effectOverride = G, I.standalone ? I.baseMaterial.bindForSubMesh(a.getWorldMatrix(), o, t) : m.bindForSubMesh(a.getWorldMatrix(), o, t), t._effectOverride = null;
+ else {
+ if (G.setMatrix("viewProjection", this.getTransformMatrix()), m && m.needAlphaTesting()) {
+ var k = m.getAlphaTestTexture();
+ k && (G.setTexture("diffuseSampler", k), G.setMatrix("diffuseMatrix", k.getTextureMatrix() || this._defaultTextureMatrix));
+ }
+ if (o.useBones && o.computeBonesUsingShaders && o.skeleton) {
+ var K = o.skeleton;
+ if (K.isUsingTextureForMatrices) {
+ var re = K.getTransformMatrixTexture(o);
+ if (!re)
+ return;
+ G.setTexture("boneSampler", re), G.setFloat("boneTextureWidth", 4 * (K.bones.length + 1));
+ } else
+ G.setMatrices("mBones", K.getTransformMatrices(o));
+ }
+ tt.a.BindMorphTargetParameters(o, G), tt.a.BindClipPlane(G, s);
+ }
+ this._bindCustomEffectForRenderSubMeshForShadowMap(t, G, I == null ? void 0 : I._matriceNames, a), this.forceBackFacesOnly && p.setState(!0, 0, !1, !0), this.onBeforeShadowMapRenderMeshObservable.notifyObservers(o), this.onBeforeShadowMapRenderObservable.notifyObservers(G), o._processRendering(a, t, G, m.fillMode, S, O, function(se, ue) {
+ return G.setMatrix("world", ue);
+ }), this.forceBackFacesOnly && p.setState(!0, 0, !1, !1), this.onAfterShadowMapRenderObservable.notifyObservers(G), this.onAfterShadowMapRenderMeshObservable.notifyObservers(o);
+ } else
+ this._shadowMap && this._shadowMap.resetRefreshCounter();
+ }
+ }
+ }, r.prototype._applyFilterValues = function() {
+ this._shadowMap && (this.filter === r.FILTER_NONE || this.filter === r.FILTER_PCSS ? this._shadowMap.updateSamplingMode(Ue.a.NEAREST_SAMPLINGMODE) : this._shadowMap.updateSamplingMode(Ue.a.BILINEAR_SAMPLINGMODE));
+ }, r.prototype.forceCompilation = function(t, e) {
+ var n = this, i = Object(u.a)({ useInstances: !1 }, e), o = this.getShadowMap();
+ if (o) {
+ var a = o.renderList;
+ if (a) {
+ for (var s = new Array(), p = 0, m = a; p < m.length; p++) {
+ var S = m[p];
+ s.push.apply(s, S.subMeshes);
+ }
+ if (s.length !== 0) {
+ var O = 0, I = function() {
+ var G, k;
+ if (n._scene && n._scene.getEngine()) {
+ for (; n.isReady(s[O], i.useInstances, (k = (G = s[O].getMaterial()) === null || G === void 0 ? void 0 : G.needAlphaBlendingForMesh(s[O].getMesh())) !== null && k !== void 0 && k); )
+ if (++O >= s.length)
+ return void (t && t(n));
+ setTimeout(I, 16);
+ }
+ };
+ I();
+ } else
+ t && t(this);
+ } else
+ t && t(this);
+ } else
+ t && t(this);
+ }, r.prototype.forceCompilationAsync = function(t) {
+ var e = this;
+ return new Promise(function(n) {
+ e.forceCompilation(function() {
+ n();
+ }, t);
+ });
+ }, r.prototype._isReadyCustomDefines = function(t, e, n) {
+ }, r.prototype._prepareShadowDefines = function(t, e, n, i) {
+ n.push("#define SM_FLOAT " + (this._textureType !== d.a.TEXTURETYPE_UNSIGNED_INT ? "1" : "0")), n.push("#define SM_ESM " + (this.useExponentialShadowMap || this.useBlurExponentialShadowMap ? "1" : "0")), n.push("#define SM_DEPTHTEXTURE " + (this.usePercentageCloserFiltering || this.useContactHardeningShadow ? "1" : "0"));
+ var o = t.getMesh();
+ return n.push("#define SM_NORMALBIAS " + (this.normalBias && o.isVerticesDataPresent(De.b.NormalKind) ? "1" : "0")), n.push("#define SM_DIRECTIONINLIGHTDATA " + (this.getLight().getTypeID() === or.a.LIGHTTYPEID_DIRECTIONALLIGHT ? "1" : "0")), n.push("#define SM_USEDISTANCE " + (this._light.needCube() ? "1" : "0")), n.push("#define SM_SOFTTRANSPARENTSHADOW " + (this.enableSoftTransparentShadow && i ? "1" : "0")), this._isReadyCustomDefines(n, t, e), n;
+ }, r.prototype.isReady = function(t, e, n) {
+ var i = t.getMaterial(), o = i == null ? void 0 : i.shadowDepthWrapper, a = [];
+ if (this._prepareShadowDefines(t, e, a, n), o) {
+ if (!o.isReadyForSubMesh(t, a, this, e))
+ return !1;
+ } else {
+ var s = [De.b.PositionKind], p = t.getMesh();
+ if (this.normalBias && p.isVerticesDataPresent(De.b.NormalKind) && (s.push(De.b.NormalKind), a.push("#define NORMAL"), p.nonUniformScaling && a.push("#define NONUNIFORMSCALING")), i && i.needAlphaTesting()) {
+ var m = i.getAlphaTestTexture();
+ if (m) {
+ if (!m.isReady())
+ return !1;
+ a.push("#define ALPHATEST"), p.isVerticesDataPresent(De.b.UVKind) && (s.push(De.b.UVKind), a.push("#define UV1")), p.isVerticesDataPresent(De.b.UV2Kind) && m.coordinatesIndex === 1 && (s.push(De.b.UV2Kind), a.push("#define UV2"));
+ }
+ }
+ var S = new Po.a();
+ if (p.useBones && p.computeBonesUsingShaders && p.skeleton) {
+ s.push(De.b.MatricesIndicesKind), s.push(De.b.MatricesWeightsKind), p.numBoneInfluencers > 4 && (s.push(De.b.MatricesIndicesExtraKind), s.push(De.b.MatricesWeightsExtraKind));
+ var O = p.skeleton;
+ a.push("#define NUM_BONE_INFLUENCERS " + p.numBoneInfluencers), p.numBoneInfluencers > 0 && S.addCPUSkinningFallback(0, p), O.isUsingTextureForMatrices ? a.push("#define BONETEXTURE") : a.push("#define BonesPerMesh " + (O.bones.length + 1));
+ } else
+ a.push("#define NUM_BONE_INFLUENCERS 0");
+ var I = p.morphTargetManager, G = 0;
+ I && I.numInfluencers > 0 && (a.push("#define MORPHTARGETS"), G = I.numInfluencers, a.push("#define NUM_MORPH_INFLUENCERS " + G), tt.a.PrepareAttributesForMorphTargetsInfluencers(s, p, G));
+ var k = this._scene;
+ if (k.clipPlane && a.push("#define CLIPPLANE"), k.clipPlane2 && a.push("#define CLIPPLANE2"), k.clipPlane3 && a.push("#define CLIPPLANE3"), k.clipPlane4 && a.push("#define CLIPPLANE4"), k.clipPlane5 && a.push("#define CLIPPLANE5"), k.clipPlane6 && a.push("#define CLIPPLANE6"), e && (a.push("#define INSTANCES"), tt.a.PushAttributesForInstances(s), t.getRenderingMesh().hasThinInstances && a.push("#define THIN_INSTANCES")), this.customShaderOptions && this.customShaderOptions.defines)
+ for (var K = 0, re = this.customShaderOptions.defines; K < re.length; K++) {
+ var se = re[K];
+ a.indexOf(se) === -1 && a.push(se);
+ }
+ var ue = a.join(`
+`);
+ if (this._cachedDefines !== ue) {
+ this._cachedDefines = ue;
+ var he = "shadowMap", pe = ["world", "mBones", "viewProjection", "diffuseMatrix", "lightDataSM", "depthValuesSM", "biasAndScaleSM", "morphTargetInfluences", "boneTextureWidth", "vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6", "softTransparentShadowSM"], ve = ["diffuseSampler", "boneSampler"];
+ if (this.customShaderOptions) {
+ if (he = this.customShaderOptions.shaderName, this.customShaderOptions.attributes)
+ for (var Ee = 0, Ae = this.customShaderOptions.attributes; Ee < Ae.length; Ee++) {
+ var Ie = Ae[Ee];
+ s.indexOf(Ie) === -1 && s.push(Ie);
+ }
+ if (this.customShaderOptions.uniforms)
+ for (var xe = 0, Pe = this.customShaderOptions.uniforms; xe < Pe.length; xe++) {
+ var Ce = Pe[xe];
+ pe.indexOf(Ce) === -1 && pe.push(Ce);
+ }
+ if (this.customShaderOptions.samplers)
+ for (var Fe = 0, Oe = this.customShaderOptions.samplers; Fe < Oe.length; Fe++) {
+ var Be = Oe[Fe];
+ ve.indexOf(Be) === -1 && ve.push(Be);
+ }
+ }
+ this._effect = this._scene.getEngine().createEffect(he, s, pe, ve, ue, S, void 0, void 0, { maxSimultaneousMorphTargets: G });
+ }
+ if (!this._effect.isReady())
+ return !1;
+ }
+ return (this.useBlurExponentialShadowMap || this.useBlurCloseExponentialShadowMap) && (this._blurPostProcesses && this._blurPostProcesses.length || this._initializeBlurRTTAndPostProcesses()), !(this._kernelBlurXPostprocess && !this._kernelBlurXPostprocess.isReady()) && !(this._kernelBlurYPostprocess && !this._kernelBlurYPostprocess.isReady()) && !(this._boxBlurPostprocess && !this._boxBlurPostprocess.isReady());
+ }, r.prototype.prepareDefines = function(t, e) {
+ var n = this._scene, i = this._light;
+ n.shadowsEnabled && i.shadowEnabled && (t["SHADOW" + e] = !0, this.useContactHardeningShadow ? (t["SHADOWPCSS" + e] = !0, this._filteringQuality === r.QUALITY_LOW ? t["SHADOWLOWQUALITY" + e] = !0 : this._filteringQuality === r.QUALITY_MEDIUM && (t["SHADOWMEDIUMQUALITY" + e] = !0)) : this.usePercentageCloserFiltering ? (t["SHADOWPCF" + e] = !0, this._filteringQuality === r.QUALITY_LOW ? t["SHADOWLOWQUALITY" + e] = !0 : this._filteringQuality === r.QUALITY_MEDIUM && (t["SHADOWMEDIUMQUALITY" + e] = !0)) : this.usePoissonSampling ? t["SHADOWPOISSON" + e] = !0 : this.useExponentialShadowMap || this.useBlurExponentialShadowMap ? t["SHADOWESM" + e] = !0 : (this.useCloseExponentialShadowMap || this.useBlurCloseExponentialShadowMap) && (t["SHADOWCLOSEESM" + e] = !0), i.needCube() && (t["SHADOWCUBE" + e] = !0));
+ }, r.prototype.bindShadowLight = function(t, e) {
+ var n = this._light, i = this._scene;
+ if (i.shadowsEnabled && n.shadowEnabled) {
+ var o = i.activeCamera;
+ if (o) {
+ var a = this.getShadowMap();
+ a && (n.needCube() || e.setMatrix("lightMatrix" + t, this.getTransformMatrix()), this._filter === r.FILTER_PCF ? (e.setDepthStencilTexture("shadowSampler" + t, this.getShadowMapForRendering()), n._uniformBuffer.updateFloat4("shadowsInfo", this.getDarkness(), a.getSize().width, 1 / a.getSize().width, this.frustumEdgeFalloff, t)) : this._filter === r.FILTER_PCSS ? (e.setDepthStencilTexture("shadowSampler" + t, this.getShadowMapForRendering()), e.setTexture("depthSampler" + t, this.getShadowMapForRendering()), n._uniformBuffer.updateFloat4("shadowsInfo", this.getDarkness(), 1 / a.getSize().width, this._contactHardeningLightSizeUVRatio * a.getSize().width, this.frustumEdgeFalloff, t)) : (e.setTexture("shadowSampler" + t, this.getShadowMapForRendering()), n._uniformBuffer.updateFloat4("shadowsInfo", this.getDarkness(), this.blurScale / a.getSize().width, this.depthScale, this.frustumEdgeFalloff, t)), n._uniformBuffer.updateFloat2("depthValues", this.getLight().getDepthMinZ(o), this.getLight().getDepthMinZ(o) + this.getLight().getDepthMaxZ(o), t));
+ }
+ }
+ }, r.prototype.getTransformMatrix = function() {
+ var t = this._scene;
+ if (this._currentRenderID === t.getRenderId() && this._currentFaceIndexCache === this._currentFaceIndex)
+ return this._transformMatrix;
+ this._currentRenderID = t.getRenderId(), this._currentFaceIndexCache = this._currentFaceIndex;
+ var e = this._light.position;
+ if (this._light.computeTransformedInformation() && (e = this._light.transformedPosition), c.e.NormalizeToRef(this._light.getShadowDirection(this._currentFaceIndex), this._lightDirection), Math.abs(c.e.Dot(this._lightDirection, c.e.Up())) === 1 && (this._lightDirection.z = 1e-13), this._light.needProjectionMatrixCompute() || !this._cachedPosition || !this._cachedDirection || !e.equals(this._cachedPosition) || !this._lightDirection.equals(this._cachedDirection)) {
+ this._cachedPosition.copyFrom(e), this._cachedDirection.copyFrom(this._lightDirection), c.a.LookAtLHToRef(e, e.add(this._lightDirection), c.e.Up(), this._viewMatrix);
+ var n = this.getShadowMap();
+ if (n) {
+ var i = n.renderList;
+ i && this._light.setShadowProjectionMatrix(this._projectionMatrix, this._viewMatrix, i);
+ }
+ this._viewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix);
+ }
+ return this._transformMatrix;
+ }, r.prototype.recreateShadowMap = function() {
+ var t = this._shadowMap;
+ if (t) {
+ var e = t.renderList;
+ this._disposeRTTandPostProcesses(), this._initializeGenerator(), this.filter = this.filter, this._applyFilterValues(), this._shadowMap.renderList = e;
+ }
+ }, r.prototype._disposeBlurPostProcesses = function() {
+ this._shadowMap2 && (this._shadowMap2.dispose(), this._shadowMap2 = null), this._boxBlurPostprocess && (this._boxBlurPostprocess.dispose(), this._boxBlurPostprocess = null), this._kernelBlurXPostprocess && (this._kernelBlurXPostprocess.dispose(), this._kernelBlurXPostprocess = null), this._kernelBlurYPostprocess && (this._kernelBlurYPostprocess.dispose(), this._kernelBlurYPostprocess = null), this._blurPostProcesses = [];
+ }, r.prototype._disposeRTTandPostProcesses = function() {
+ this._shadowMap && (this._shadowMap.dispose(), this._shadowMap = null), this._disposeBlurPostProcesses();
+ }, r.prototype.dispose = function() {
+ this._disposeRTTandPostProcesses(), this._light && (this._light._shadowGenerator = null, this._light._markMeshesAsLightDirty()), this.onBeforeShadowMapRenderMeshObservable.clear(), this.onBeforeShadowMapRenderObservable.clear(), this.onAfterShadowMapRenderMeshObservable.clear(), this.onAfterShadowMapRenderObservable.clear();
+ }, r.prototype.serialize = function() {
+ var t = {}, e = this.getShadowMap();
+ if (!e)
+ return t;
+ if (t.className = this.getClassName(), t.lightId = this._light.id, t.id = this._light.id, t.mapSize = e.getRenderSize(), t.forceBackFacesOnly = this.forceBackFacesOnly, t.darkness = this.getDarkness(), t.transparencyShadow = this._transparencyShadow, t.frustumEdgeFalloff = this.frustumEdgeFalloff, t.bias = this.bias, t.normalBias = this.normalBias, t.usePercentageCloserFiltering = this.usePercentageCloserFiltering, t.useContactHardeningShadow = this.useContactHardeningShadow, t.contactHardeningLightSizeUVRatio = this.contactHardeningLightSizeUVRatio, t.filteringQuality = this.filteringQuality, t.useExponentialShadowMap = this.useExponentialShadowMap, t.useBlurExponentialShadowMap = this.useBlurExponentialShadowMap, t.useCloseExponentialShadowMap = this.useBlurExponentialShadowMap, t.useBlurCloseExponentialShadowMap = this.useBlurExponentialShadowMap, t.usePoissonSampling = this.usePoissonSampling, t.depthScale = this.depthScale, t.blurBoxOffset = this.blurBoxOffset, t.blurKernel = this.blurKernel, t.blurScale = this.blurScale, t.useKernelBlur = this.useKernelBlur, t.renderList = [], e.renderList)
+ for (var n = 0; n < e.renderList.length; n++) {
+ var i = e.renderList[n];
+ t.renderList.push(i.id);
+ }
+ return t;
+ }, r.Parse = function(t, e, n) {
+ for (var i = e.getLightByID(t.lightId), o = n ? n(t.mapSize, i) : new r(t.mapSize, i), a = o.getShadowMap(), s = 0; s < t.renderList.length; s++)
+ e.getMeshesByID(t.renderList[s]).forEach(function(p) {
+ a && (a.renderList || (a.renderList = []), a.renderList.push(p));
+ });
+ return t.id !== void 0 && (o.id = t.id), o.forceBackFacesOnly = !!t.forceBackFacesOnly, t.darkness !== void 0 && o.setDarkness(t.darkness), t.transparencyShadow && o.setTransparencyShadow(!0), t.frustumEdgeFalloff !== void 0 && (o.frustumEdgeFalloff = t.frustumEdgeFalloff), t.bias !== void 0 && (o.bias = t.bias), t.normalBias !== void 0 && (o.normalBias = t.normalBias), t.usePercentageCloserFiltering ? o.usePercentageCloserFiltering = !0 : t.useContactHardeningShadow ? o.useContactHardeningShadow = !0 : t.usePoissonSampling ? o.usePoissonSampling = !0 : t.useExponentialShadowMap ? o.useExponentialShadowMap = !0 : t.useBlurExponentialShadowMap ? o.useBlurExponentialShadowMap = !0 : t.useCloseExponentialShadowMap ? o.useCloseExponentialShadowMap = !0 : t.useBlurCloseExponentialShadowMap ? o.useBlurCloseExponentialShadowMap = !0 : t.useVarianceShadowMap ? o.useExponentialShadowMap = !0 : t.useBlurVarianceShadowMap && (o.useBlurExponentialShadowMap = !0), t.contactHardeningLightSizeUVRatio !== void 0 && (o.contactHardeningLightSizeUVRatio = t.contactHardeningLightSizeUVRatio), t.filteringQuality !== void 0 && (o.filteringQuality = t.filteringQuality), t.depthScale && (o.depthScale = t.depthScale), t.blurScale && (o.blurScale = t.blurScale), t.blurBoxOffset && (o.blurBoxOffset = t.blurBoxOffset), t.useKernelBlur && (o.useKernelBlur = t.useKernelBlur), t.blurKernel && (o.blurKernel = t.blurKernel), o;
+ }, r.CLASSNAME = "ShadowGenerator", r.FILTER_NONE = 0, r.FILTER_EXPONENTIALSHADOWMAP = 1, r.FILTER_POISSONSAMPLING = 2, r.FILTER_BLUREXPONENTIALSHADOWMAP = 3, r.FILTER_CLOSEEXPONENTIALSHADOWMAP = 4, r.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP = 5, r.FILTER_PCF = 6, r.FILTER_PCSS = 7, r.QUALITY_HIGH = 0, r.QUALITY_MEDIUM = 1, r.QUALITY_LOW = 2, r._SceneComponentInitialization = function(t) {
+ throw Nn.a.WarnImport("ShadowGeneratorSceneComponent");
+ }, r;
+ }(), o0 = `#ifdef ALPHATEST
+varying vec2 vUV;
+uniform sampler2D diffuseSampler;
+#endif
+varying float vDepthMetric;
+#ifdef PACKED
+#include
+#endif
+void main(void)
+{
+#ifdef ALPHATEST
+if (texture2D(diffuseSampler,vUV).a<0.4)
+discard;
+#endif
+#ifdef NONLINEARDEPTH
+#ifdef PACKED
+gl_FragColor=pack(gl_FragCoord.z);
+#else
+gl_FragColor=vec4(gl_FragCoord.z,0.0,0.0,0.0);
+#endif
+#else
+#ifdef PACKED
+gl_FragColor=pack(vDepthMetric);
+#else
+gl_FragColor=vec4(vDepthMetric,0.0,0.0,1.0);
+#endif
+#endif
+}`;
+ We.a.ShadersStore.depthPixelShader = o0;
+ var a0 = `
+attribute vec3 position;
+#include
+#include
+#include[0..maxSimultaneousMorphTargets]
+
+#include
+uniform mat4 viewProjection;
+uniform vec2 depthValues;
+#if defined(ALPHATEST) || defined(NEED_UV)
+varying vec2 vUV;
+uniform mat4 diffuseMatrix;
+#ifdef UV1
+attribute vec2 uv;
+#endif
+#ifdef UV2
+attribute vec2 uv2;
+#endif
+#endif
+varying float vDepthMetric;
+void main(void)
+{
+vec3 positionUpdated=position;
+#ifdef UV1
+vec2 uvUpdated=uv;
+#endif
+#include[0..maxSimultaneousMorphTargets]
+#include
+#include
+gl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);
+vDepthMetric=((gl_Position.z+depthValues.x)/(depthValues.y));
+#if defined(ALPHATEST) || defined(BASIC_RENDER)
+#ifdef UV1
+vUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));
+#endif
+#ifdef UV2
+vUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));
+#endif
+#endif
+}
+`;
+ We.a.ShadersStore.depthVertexShader = a0;
+ var Us = function() {
+ function r(t, e, n, i) {
+ var o = this;
+ e === void 0 && (e = d.a.TEXTURETYPE_FLOAT), n === void 0 && (n = null), i === void 0 && (i = !1), this.enabled = !0, this.useOnlyInActiveCamera = !1, this._scene = t, this._storeNonLinearDepth = i, this.isPacked = e === d.a.TEXTURETYPE_UNSIGNED_BYTE, this.isPacked ? this._clearColor = new C.b(1, 1, 1, 1) : this._clearColor = new C.b(1, 0, 0, 1), r._SceneComponentInitialization(this._scene), this._camera = n;
+ var a = t.getEngine(), s = this.isPacked || a.webGLVersion === 1 ? d.a.TEXTUREFORMAT_RGBA : d.a.TEXTUREFORMAT_R;
+ this._depthMap = new bn("depthMap", { width: a.getRenderWidth(), height: a.getRenderHeight() }, this._scene, !1, !0, e, !1, void 0, void 0, void 0, void 0, s), this._depthMap.wrapU = Ue.a.CLAMP_ADDRESSMODE, this._depthMap.wrapV = Ue.a.CLAMP_ADDRESSMODE, this._depthMap.refreshRate = 1, this._depthMap.renderParticles = !1, this._depthMap.renderList = null, this._depthMap.activeCamera = this._camera, this._depthMap.ignoreCameraViewport = !0, this._depthMap.useCameraPostProcesses = !1, this._depthMap.onClearObservable.add(function(m) {
+ m.clear(o._clearColor, !0, !0, !0);
+ });
+ var p = function(m) {
+ var S = m.getRenderingMesh(), O = m.getEffectiveMesh(), I = o._scene, G = I.getEngine(), k = m.getMaterial();
+ if (O._internalAbstractMeshDataInfo._isActiveIntermediate = !1, k && m.verticesCount !== 0 && m._renderId !== I.getRenderId()) {
+ G.setState(k.backFaceCulling, 0, !1, I.useRightHandedSystem);
+ var K = S._getInstancesRenderList(m._id, !!m.getReplacementMesh());
+ if (!K.mustReturn) {
+ var re = G.getCaps().instancedArrays && (K.visibleInstances[m._id] !== null && K.visibleInstances[m._id] !== void 0 || S.hasThinInstances), se = o._camera || I.activeCamera;
+ if (o.isReady(m, re) && se) {
+ if (m._renderId = I.getRenderId(), G.enableEffect(o._effect), S._bind(m, o._effect, k.fillMode), o._effect.setMatrix("viewProjection", I.getTransformMatrix()), o._effect.setFloat2("depthValues", se.minZ, se.minZ + se.maxZ), k && k.needAlphaTesting()) {
+ var ue = k.getAlphaTestTexture();
+ ue && (o._effect.setTexture("diffuseSampler", ue), o._effect.setMatrix("diffuseMatrix", ue.getTextureMatrix()));
+ }
+ S.useBones && S.computeBonesUsingShaders && S.skeleton && o._effect.setMatrices("mBones", S.skeleton.getTransformMatrices(S)), tt.a.BindMorphTargetParameters(S, o._effect), S._processRendering(O, m, o._effect, k.fillMode, K, re, function(he, pe) {
+ return o._effect.setMatrix("world", pe);
+ });
+ }
+ }
+ }
+ };
+ this._depthMap.customRenderFunction = function(m, S, O, I) {
+ var G;
+ if (I.length) {
+ for (a.setColorWrite(!1), G = 0; G < I.length; G++)
+ p(I.data[G]);
+ a.setColorWrite(!0);
+ }
+ for (G = 0; G < m.length; G++)
+ p(m.data[G]);
+ for (G = 0; G < S.length; G++)
+ p(S.data[G]);
+ };
+ }
+ return r.prototype.isReady = function(t, e) {
+ var n = t.getMaterial();
+ if (n.disableDepthWrite)
+ return !1;
+ var i = [], o = [De.b.PositionKind], a = t.getMesh();
+ n && n.needAlphaTesting() && n.getAlphaTestTexture() && (i.push("#define ALPHATEST"), a.isVerticesDataPresent(De.b.UVKind) && (o.push(De.b.UVKind), i.push("#define UV1")), a.isVerticesDataPresent(De.b.UV2Kind) && (o.push(De.b.UV2Kind), i.push("#define UV2"))), a.useBones && a.computeBonesUsingShaders ? (o.push(De.b.MatricesIndicesKind), o.push(De.b.MatricesWeightsKind), a.numBoneInfluencers > 4 && (o.push(De.b.MatricesIndicesExtraKind), o.push(De.b.MatricesWeightsExtraKind)), i.push("#define NUM_BONE_INFLUENCERS " + a.numBoneInfluencers), i.push("#define BonesPerMesh " + (a.skeleton ? a.skeleton.bones.length + 1 : 0))) : i.push("#define NUM_BONE_INFLUENCERS 0");
+ var s = a.morphTargetManager, p = 0;
+ s && s.numInfluencers > 0 && (p = s.numInfluencers, i.push("#define MORPHTARGETS"), i.push("#define NUM_MORPH_INFLUENCERS " + p), tt.a.PrepareAttributesForMorphTargetsInfluencers(o, a, p)), e && (i.push("#define INSTANCES"), tt.a.PushAttributesForInstances(o), t.getRenderingMesh().hasThinInstances && i.push("#define THIN_INSTANCES")), this._storeNonLinearDepth && i.push("#define NONLINEARDEPTH"), this.isPacked && i.push("#define PACKED");
+ var m = i.join(`
+`);
+ return this._cachedDefines !== m && (this._cachedDefines = m, this._effect = this._scene.getEngine().createEffect("depth", o, ["world", "mBones", "viewProjection", "diffuseMatrix", "depthValues", "morphTargetInfluences"], ["diffuseSampler"], m, void 0, void 0, void 0, { maxSimultaneousMorphTargets: p })), this._effect.isReady();
+ }, r.prototype.getDepthMap = function() {
+ return this._depthMap;
+ }, r.prototype.dispose = function() {
+ this._depthMap.dispose();
+ }, r._SceneComponentInitialization = function(t) {
+ throw Nn.a.WarnImport("DepthRendererSceneComponent");
+ }, r;
+ }(), s0 = `attribute vec2 vUV;
+uniform sampler2D textureSampler;
+#if defined(INITIAL)
+uniform sampler2D sourceTexture;
+uniform vec2 texSize;
+void main(void)
+{
+ivec2 coord=ivec2(vUV*(texSize-1.0));
+float f1=texelFetch(sourceTexture,coord,0).r;
+float f2=texelFetch(sourceTexture,coord+ivec2(1,0),0).r;
+float f3=texelFetch(sourceTexture,coord+ivec2(1,1),0).r;
+float f4=texelFetch(sourceTexture,coord+ivec2(0,1),0).r;
+float minz=min(min(min(f1,f2),f3),f4);
+#ifdef DEPTH_REDUX
+float maxz=max(max(max(sign(1.0-f1)*f1,sign(1.0-f2)*f2),sign(1.0-f3)*f3),sign(1.0-f4)*f4);
+#else
+float maxz=max(max(max(f1,f2),f3),f4);
+#endif
+glFragColor=vec4(minz,maxz,0.,0.);
+}
+#elif defined(MAIN)
+uniform vec2 texSize;
+void main(void)
+{
+ivec2 coord=ivec2(vUV*(texSize-1.0));
+vec2 f1=texelFetch(textureSampler,coord,0).rg;
+vec2 f2=texelFetch(textureSampler,coord+ivec2(1,0),0).rg;
+vec2 f3=texelFetch(textureSampler,coord+ivec2(1,1),0).rg;
+vec2 f4=texelFetch(textureSampler,coord+ivec2(0,1),0).rg;
+float minz=min(min(min(f1.x,f2.x),f3.x),f4.x);
+float maxz=max(max(max(f1.y,f2.y),f3.y),f4.y);
+glFragColor=vec4(minz,maxz,0.,0.);
+}
+#elif defined(ONEBEFORELAST)
+uniform ivec2 texSize;
+void main(void)
+{
+ivec2 coord=ivec2(vUV*vec2(texSize-1));
+vec2 f1=texelFetch(textureSampler,coord % texSize,0).rg;
+vec2 f2=texelFetch(textureSampler,(coord+ivec2(1,0)) % texSize,0).rg;
+vec2 f3=texelFetch(textureSampler,(coord+ivec2(1,1)) % texSize,0).rg;
+vec2 f4=texelFetch(textureSampler,(coord+ivec2(0,1)) % texSize,0).rg;
+float minz=min(f1.x,f2.x);
+float maxz=max(f1.y,f2.y);
+glFragColor=vec4(minz,maxz,0.,0.);
+}
+#elif defined(LAST)
+void main(void)
+{
+discard;
+glFragColor=vec4(0.);
+}
+#endif
+`;
+ We.a.ShadersStore.minmaxReduxPixelShader = s0;
+ var Bf = function() {
+ function r(t) {
+ this.onAfterReductionPerformed = new P.c(), this._forceFullscreenViewport = !0, this._activated = !1, this._camera = t, this._postProcessManager = new fl.a(t.getScene());
+ }
+ return Object.defineProperty(r.prototype, "sourceTexture", { get: function() {
+ return this._sourceTexture;
+ }, enumerable: !1, configurable: !0 }), r.prototype.setSourceTexture = function(t, e, n, i) {
+ var o = this;
+ if (n === void 0 && (n = d.a.TEXTURETYPE_HALF_FLOAT), i === void 0 && (i = !0), t !== this._sourceTexture) {
+ this.dispose(!1), this._sourceTexture = t, this._reductionSteps = [], this._forceFullscreenViewport = i;
+ var a = this._camera.getScene(), s = new _t("Initial reduction phase", "minmaxRedux", ["texSize"], ["sourceTexture"], 1, null, d.a.TEXTURE_NEAREST_NEAREST, a.getEngine(), !1, "#define INITIAL" + (e ? `
+#define DEPTH_REDUX` : ""), n, void 0, void 0, void 0, d.a.TEXTUREFORMAT_RG);
+ s.autoClear = !1, s.forceFullscreenViewport = i;
+ var p = this._sourceTexture.getRenderWidth(), m = this._sourceTexture.getRenderHeight();
+ s.onApply = function(I, G) {
+ return function(k) {
+ k.setTexture("sourceTexture", o._sourceTexture), k.setFloatArray2("texSize", new Float32Array([I, G]));
+ };
+ }(p, m), this._reductionSteps.push(s);
+ for (var S = 1; p > 1 || m > 1; ) {
+ p = Math.max(Math.round(p / 2), 1), m = Math.max(Math.round(m / 2), 1);
+ var O = new _t("Reduction phase " + S, "minmaxRedux", ["texSize"], null, { width: p, height: m }, null, d.a.TEXTURE_NEAREST_NEAREST, a.getEngine(), !1, "#define " + (p == 1 && m == 1 ? "LAST" : p == 1 || m == 1 ? "ONEBEFORELAST" : "MAIN"), n, void 0, void 0, void 0, d.a.TEXTUREFORMAT_RG);
+ O.autoClear = !1, O.forceFullscreenViewport = i, O.onApply = function(I, G) {
+ return function(k) {
+ I == 1 || G == 1 ? k.setIntArray2("texSize", new Int32Array([I, G])) : k.setFloatArray2("texSize", new Float32Array([I, G]));
+ };
+ }(p, m), this._reductionSteps.push(O), S++, p == 1 && m == 1 && O.onAfterRenderObservable.add(function(I, G, k) {
+ var K = new Float32Array(4 * I * G), re = { min: 0, max: 0 };
+ return function() {
+ a.getEngine()._readTexturePixels(k.inputTexture, I, G, -1, 0, K), re.min = K[0], re.max = K[1], o.onAfterReductionPerformed.notifyObservers(re);
+ };
+ }(p, m, O));
+ }
+ }
+ }, Object.defineProperty(r.prototype, "refreshRate", { get: function() {
+ return this._sourceTexture ? this._sourceTexture.refreshRate : -1;
+ }, set: function(t) {
+ this._sourceTexture && (this._sourceTexture.refreshRate = t);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "activated", { get: function() {
+ return this._activated;
+ }, enumerable: !1, configurable: !0 }), r.prototype.activate = function() {
+ var t = this;
+ !this._onAfterUnbindObserver && this._sourceTexture && (this._onAfterUnbindObserver = this._sourceTexture.onAfterUnbindObservable.add(function() {
+ t._reductionSteps[0].activate(t._camera), t._postProcessManager.directRender(t._reductionSteps, t._reductionSteps[0].inputTexture, t._forceFullscreenViewport), t._camera.getScene().getEngine().unBindFramebuffer(t._reductionSteps[0].inputTexture, !1);
+ }), this._activated = !0);
+ }, r.prototype.deactivate = function() {
+ this._onAfterUnbindObserver && this._sourceTexture && (this._sourceTexture.onAfterUnbindObservable.remove(this._onAfterUnbindObserver), this._onAfterUnbindObserver = null, this._activated = !1);
+ }, r.prototype.dispose = function(t) {
+ if (t === void 0 && (t = !0), t && this.onAfterReductionPerformed.clear(), this.deactivate(), this._reductionSteps) {
+ for (var e = 0; e < this._reductionSteps.length; ++e)
+ this._reductionSteps[e].dispose();
+ this._reductionSteps = null;
+ }
+ this._postProcessManager && t && this._postProcessManager.dispose(), this._sourceTexture = null;
+ }, r;
+ }(), Uf = function(r) {
+ function t(e) {
+ return r.call(this, e) || this;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "depthRenderer", { get: function() {
+ return this._depthRenderer;
+ }, enumerable: !1, configurable: !0 }), t.prototype.setDepthRenderer = function(e, n, i) {
+ e === void 0 && (e = null), n === void 0 && (n = d.a.TEXTURETYPE_HALF_FLOAT), i === void 0 && (i = !0);
+ var o = this._camera.getScene();
+ this._depthRenderer && (delete o._depthRenderer[this._depthRendererId], this._depthRenderer.dispose(), this._depthRenderer = null), e === null && (o._depthRenderer || (o._depthRenderer = {}), (e = this._depthRenderer = new Us(o, n, this._camera, !1)).enabled = !1, this._depthRendererId = "minmax" + this._camera.id, o._depthRenderer[this._depthRendererId] = e), r.prototype.setSourceTexture.call(this, e.getDepthMap(), !0, n, i);
+ }, t.prototype.setSourceTexture = function(e, n, i, o) {
+ i === void 0 && (i = d.a.TEXTURETYPE_HALF_FLOAT), o === void 0 && (o = !0), r.prototype.setSourceTexture.call(this, e, n, i, o);
+ }, t.prototype.activate = function() {
+ this._depthRenderer && (this._depthRenderer.enabled = !0), r.prototype.activate.call(this);
+ }, t.prototype.deactivate = function() {
+ r.prototype.deactivate.call(this), this._depthRenderer && (this._depthRenderer.enabled = !1);
+ }, t.prototype.dispose = function(e) {
+ if (e === void 0 && (e = !0), r.prototype.dispose.call(this, e), this._depthRenderer && e) {
+ var n = this._depthRenderer.getDepthMap().getScene();
+ n && delete n._depthRenderer[this._depthRendererId], this._depthRenderer.dispose(), this._depthRenderer = null;
+ }
+ }, t;
+ }(Bf), Vf = c.e.Up(), c0 = c.e.Zero(), Rn = new c.e(), Io = new c.e(), Do = new c.a(), kf = new c.a(), Wl = function(r) {
+ function t(e, n, i) {
+ var o = this;
+ if (t.IsSupported)
+ return (o = r.call(this, e, n, i) || this).usePercentageCloserFiltering = !0, o;
+ h.a.Error("CascadedShadowMap needs WebGL 2 support.");
+ }
+ return Object(u.d)(t, r), t.prototype._validateFilter = function(e) {
+ return e === Zn.FILTER_NONE || e === Zn.FILTER_PCF || e === Zn.FILTER_PCSS ? e : (console.error('Unsupported filter "' + e + '"!'), Zn.FILTER_NONE);
+ }, Object.defineProperty(t.prototype, "numCascades", { get: function() {
+ return this._numCascades;
+ }, set: function(e) {
+ (e = Math.min(Math.max(e, t.MIN_CASCADES_COUNT), t.MAX_CASCADES_COUNT)) !== this._numCascades && (this._numCascades = e, this.recreateShadowMap());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "freezeShadowCastersBoundingInfo", { get: function() {
+ return this._freezeShadowCastersBoundingInfo;
+ }, set: function(e) {
+ this._freezeShadowCastersBoundingInfoObservable && e && (this._scene.onBeforeRenderObservable.remove(this._freezeShadowCastersBoundingInfoObservable), this._freezeShadowCastersBoundingInfoObservable = null), this._freezeShadowCastersBoundingInfoObservable || e || (this._freezeShadowCastersBoundingInfoObservable = this._scene.onBeforeRenderObservable.add(this._computeShadowCastersBoundingInfo.bind(this))), this._freezeShadowCastersBoundingInfo = e, e && this._computeShadowCastersBoundingInfo();
+ }, enumerable: !1, configurable: !0 }), t.prototype._computeShadowCastersBoundingInfo = function() {
+ if (this._scbiMin.copyFromFloats(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), this._scbiMax.copyFromFloats(Number.MIN_VALUE, Number.MIN_VALUE, Number.MIN_VALUE), this._shadowMap && this._shadowMap.renderList) {
+ for (var e = this._shadowMap.renderList, n = 0; n < e.length; n++)
+ if (a = e[n]) {
+ var i = a.getBoundingInfo().boundingBox;
+ this._scbiMin.minimizeInPlace(i.minimumWorld), this._scbiMax.maximizeInPlace(i.maximumWorld);
+ }
+ var o = this._scene.meshes;
+ for (n = 0; n < o.length; n++) {
+ var a;
+ (a = o[n]) && a.isVisible && a.isEnabled && a.receiveShadows && (i = a.getBoundingInfo().boundingBox, this._scbiMin.minimizeInPlace(i.minimumWorld), this._scbiMax.maximizeInPlace(i.maximumWorld));
+ }
+ }
+ this._shadowCastersBoundingInfo.reConstruct(this._scbiMin, this._scbiMax);
+ }, Object.defineProperty(t.prototype, "shadowCastersBoundingInfo", { get: function() {
+ return this._shadowCastersBoundingInfo;
+ }, set: function(e) {
+ this._shadowCastersBoundingInfo = e;
+ }, enumerable: !1, configurable: !0 }), t.prototype.setMinMaxDistance = function(e, n) {
+ this._minDistance === e && this._maxDistance === n || (e > n && (e = 0, n = 1), e < 0 && (e = 0), n > 1 && (n = 1), this._minDistance = e, this._maxDistance = n, this._breaksAreDirty = !0);
+ }, Object.defineProperty(t.prototype, "minDistance", { get: function() {
+ return this._minDistance;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "maxDistance", { get: function() {
+ return this._maxDistance;
+ }, enumerable: !1, configurable: !0 }), t.prototype.getClassName = function() {
+ return t.CLASSNAME;
+ }, t.prototype.getCascadeMinExtents = function(e) {
+ return e >= 0 && e < this._numCascades ? this._cascadeMinExtents[e] : null;
+ }, t.prototype.getCascadeMaxExtents = function(e) {
+ return e >= 0 && e < this._numCascades ? this._cascadeMaxExtents[e] : null;
+ }, Object.defineProperty(t.prototype, "shadowMaxZ", { get: function() {
+ return this._scene && this._scene.activeCamera ? this._shadowMaxZ : 0;
+ }, set: function(e) {
+ this._scene && this._scene.activeCamera ? this._shadowMaxZ === e || e < this._scene.activeCamera.minZ || e > this._scene.activeCamera.maxZ || (this._shadowMaxZ = e, this._light._markMeshesAsLightDirty(), this._breaksAreDirty = !0) : this._shadowMaxZ = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "debug", { get: function() {
+ return this._debug;
+ }, set: function(e) {
+ this._debug = e, this._light._markMeshesAsLightDirty();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "depthClamp", { get: function() {
+ return this._depthClamp;
+ }, set: function(e) {
+ this._depthClamp = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "cascadeBlendPercentage", { get: function() {
+ return this._cascadeBlendPercentage;
+ }, set: function(e) {
+ this._cascadeBlendPercentage = e, this._light._markMeshesAsLightDirty();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "lambda", { get: function() {
+ return this._lambda;
+ }, set: function(e) {
+ var n = Math.min(Math.max(e, 0), 1);
+ this._lambda != n && (this._lambda = n, this._breaksAreDirty = !0);
+ }, enumerable: !1, configurable: !0 }), t.prototype.getCascadeViewMatrix = function(e) {
+ return e >= 0 && e < this._numCascades ? this._viewMatrices[e] : null;
+ }, t.prototype.getCascadeProjectionMatrix = function(e) {
+ return e >= 0 && e < this._numCascades ? this._projectionMatrices[e] : null;
+ }, t.prototype.getCascadeTransformMatrix = function(e) {
+ return e >= 0 && e < this._numCascades ? this._transformMatrices[e] : null;
+ }, t.prototype.setDepthRenderer = function(e) {
+ this._depthRenderer = e, this._depthReducer && this._depthReducer.setDepthRenderer(this._depthRenderer);
+ }, Object.defineProperty(t.prototype, "autoCalcDepthBounds", { get: function() {
+ return this._autoCalcDepthBounds;
+ }, set: function(e) {
+ var n = this, i = this._scene.activeCamera;
+ if (i) {
+ if (this._autoCalcDepthBounds = e, !e)
+ return this._depthReducer && this._depthReducer.deactivate(), void this.setMinMaxDistance(0, 1);
+ this._depthReducer || (this._depthReducer = new Uf(i), this._depthReducer.onAfterReductionPerformed.add(function(o) {
+ var a = o.min, s = o.max;
+ a >= s && (a = 0, s = 1), a == n._minDistance && s == n._maxDistance || n.setMinMaxDistance(a, s);
+ }), this._depthReducer.setDepthRenderer(this._depthRenderer)), this._depthReducer.activate();
+ }
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "autoCalcDepthBoundsRefreshRate", { get: function() {
+ var e, n, i;
+ return (i = (n = (e = this._depthReducer) === null || e === void 0 ? void 0 : e.depthRenderer) === null || n === void 0 ? void 0 : n.getDepthMap().refreshRate) !== null && i !== void 0 ? i : -1;
+ }, set: function(e) {
+ var n;
+ !((n = this._depthReducer) === null || n === void 0) && n.depthRenderer && (this._depthReducer.depthRenderer.getDepthMap().refreshRate = e);
+ }, enumerable: !1, configurable: !0 }), t.prototype.splitFrustum = function() {
+ this._breaksAreDirty = !0;
+ }, t.prototype._splitFrustum = function() {
+ var e = this._scene.activeCamera;
+ if (e) {
+ for (var n = e.minZ, i = e.maxZ, o = i - n, a = this._minDistance, s = n + a * o, p = n + (this._shadowMaxZ < i && this._shadowMaxZ >= n ? Math.min((this._shadowMaxZ - n) / (i - n), this._maxDistance) : this._maxDistance) * o, m = p - s, S = p / s, O = 0; O < this._cascades.length; ++O) {
+ var I = (O + 1) / this._numCascades, G = s * Math.pow(S, I), k = s + m * I, K = this._lambda * (G - k) + k;
+ this._cascades[O].prevBreakDistance = O === 0 ? a : this._cascades[O - 1].breakDistance, this._cascades[O].breakDistance = (K - n) / o, this._viewSpaceFrustumsZ[O] = n + this._cascades[O].breakDistance * o, this._frustumLengths[O] = (this._cascades[O].breakDistance - this._cascades[O].prevBreakDistance) * o;
+ }
+ this._breaksAreDirty = !1;
+ }
+ }, t.prototype._computeMatrices = function() {
+ if (this._scene.activeCamera) {
+ c.e.NormalizeToRef(this._light.getShadowDirection(0), this._lightDirection), Math.abs(c.e.Dot(this._lightDirection, c.e.Up())) === 1 && (this._lightDirection.z = 1e-13), this._cachedDirection.copyFrom(this._lightDirection);
+ for (var e = 0; e < this._numCascades; ++e) {
+ this._computeFrustumInWorldSpace(e), this._computeCascadeFrustum(e), this._cascadeMaxExtents[e].subtractToRef(this._cascadeMinExtents[e], Rn), this._frustumCenter[e].addToRef(this._lightDirection.scale(this._cascadeMinExtents[e].z), this._shadowCameraPos[e]), c.a.LookAtLHToRef(this._shadowCameraPos[e], this._frustumCenter[e], Vf, this._viewMatrices[e]);
+ var n = 0, i = Rn.z, o = this._shadowCastersBoundingInfo;
+ o.update(this._viewMatrices[e]), i = Math.min(i, o.boundingBox.maximumWorld.z), n = this._depthClamp && this.filter !== Zn.FILTER_PCSS ? Math.max(n, o.boundingBox.minimumWorld.z) : Math.min(n, o.boundingBox.minimumWorld.z), c.a.OrthoOffCenterLHToRef(this._cascadeMinExtents[e].x, this._cascadeMaxExtents[e].x, this._cascadeMinExtents[e].y, this._cascadeMaxExtents[e].y, n, i, this._projectionMatrices[e]), this._cascadeMinExtents[e].z = n, this._cascadeMaxExtents[e].z = i, this._viewMatrices[e].multiplyToRef(this._projectionMatrices[e], this._transformMatrices[e]), c.e.TransformCoordinatesToRef(c0, this._transformMatrices[e], Rn), Rn.scaleInPlace(this._mapSize / 2), Io.copyFromFloats(Math.round(Rn.x), Math.round(Rn.y), Math.round(Rn.z)), Io.subtractInPlace(Rn).scaleInPlace(2 / this._mapSize), c.a.TranslationToRef(Io.x, Io.y, 0, Do), this._projectionMatrices[e].multiplyToRef(Do, this._projectionMatrices[e]), this._viewMatrices[e].multiplyToRef(this._projectionMatrices[e], this._transformMatrices[e]), this._transformMatrices[e].copyToArray(this._transformMatricesAsArray, 16 * e);
+ }
+ }
+ }, t.prototype._computeFrustumInWorldSpace = function(e) {
+ if (this._scene.activeCamera) {
+ var n = this._cascades[e].prevBreakDistance, i = this._cascades[e].breakDistance;
+ this._scene.activeCamera.getViewMatrix();
+ for (var o = c.a.Invert(this._scene.activeCamera.getTransformationMatrix()), a = 0; a < t.frustumCornersNDCSpace.length; ++a)
+ c.e.TransformCoordinatesToRef(t.frustumCornersNDCSpace[a], o, this._frustumCornersWorldSpace[e][a]);
+ for (a = 0; a < t.frustumCornersNDCSpace.length / 2; ++a)
+ Rn.copyFrom(this._frustumCornersWorldSpace[e][a + 4]).subtractInPlace(this._frustumCornersWorldSpace[e][a]), Io.copyFrom(Rn).scaleInPlace(n), Rn.scaleInPlace(i), Rn.addInPlace(this._frustumCornersWorldSpace[e][a]), this._frustumCornersWorldSpace[e][a + 4].copyFrom(Rn), this._frustumCornersWorldSpace[e][a].addInPlace(Io);
+ }
+ }, t.prototype._computeCascadeFrustum = function(e) {
+ if (this._cascadeMinExtents[e].copyFromFloats(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), this._cascadeMaxExtents[e].copyFromFloats(Number.MIN_VALUE, Number.MIN_VALUE, Number.MIN_VALUE), this._frustumCenter[e].copyFromFloats(0, 0, 0), this._scene.activeCamera) {
+ for (var n = 0; n < this._frustumCornersWorldSpace[e].length; ++n)
+ this._frustumCenter[e].addInPlace(this._frustumCornersWorldSpace[e][n]);
+ if (this._frustumCenter[e].scaleInPlace(1 / this._frustumCornersWorldSpace[e].length), this.stabilizeCascades) {
+ var i = 0;
+ for (n = 0; n < this._frustumCornersWorldSpace[e].length; ++n) {
+ var o = this._frustumCornersWorldSpace[e][n].subtractToRef(this._frustumCenter[e], Rn).length();
+ i = Math.max(i, o);
+ }
+ i = Math.ceil(16 * i) / 16, this._cascadeMaxExtents[e].copyFromFloats(i, i, i), this._cascadeMinExtents[e].copyFromFloats(-i, -i, -i);
+ } else {
+ var a = this._frustumCenter[e];
+ for (this._frustumCenter[e].addToRef(this._lightDirection, Rn), c.a.LookAtLHToRef(a, Rn, Vf, Do), n = 0; n < this._frustumCornersWorldSpace[e].length; ++n)
+ c.e.TransformCoordinatesToRef(this._frustumCornersWorldSpace[e][n], Do, Rn), this._cascadeMinExtents[e].minimizeInPlace(Rn), this._cascadeMaxExtents[e].maximizeInPlace(Rn);
+ }
+ }
+ }, Object.defineProperty(t, "IsSupported", { get: function() {
+ var e = te.a.LastCreatedEngine;
+ return !!e && e.webGLVersion != 1;
+ }, enumerable: !1, configurable: !0 }), t.prototype._initializeGenerator = function() {
+ var e, n, i, o, a, s, p, m, S, O, I, G, k, K, re, se, ue, he, pe, ve;
+ this.penumbraDarkness = (e = this.penumbraDarkness) !== null && e !== void 0 ? e : 1, this._numCascades = (n = this._numCascades) !== null && n !== void 0 ? n : t.DEFAULT_CASCADES_COUNT, this.stabilizeCascades = (i = this.stabilizeCascades) !== null && i !== void 0 && i, this._freezeShadowCastersBoundingInfoObservable = (o = this._freezeShadowCastersBoundingInfoObservable) !== null && o !== void 0 ? o : null, this.freezeShadowCastersBoundingInfo = (a = this.freezeShadowCastersBoundingInfo) !== null && a !== void 0 && a, this._scbiMin = (s = this._scbiMin) !== null && s !== void 0 ? s : new c.e(0, 0, 0), this._scbiMax = (p = this._scbiMax) !== null && p !== void 0 ? p : new c.e(0, 0, 0), this._shadowCastersBoundingInfo = (m = this._shadowCastersBoundingInfo) !== null && m !== void 0 ? m : new vr.a(new c.e(0, 0, 0), new c.e(0, 0, 0)), this._breaksAreDirty = (S = this._breaksAreDirty) === null || S === void 0 || S, this._minDistance = (O = this._minDistance) !== null && O !== void 0 ? O : 0, this._maxDistance = (I = this._maxDistance) !== null && I !== void 0 ? I : 1, this._currentLayer = (G = this._currentLayer) !== null && G !== void 0 ? G : 0, this._shadowMaxZ = (re = (k = this._shadowMaxZ) !== null && k !== void 0 ? k : (K = this._scene.activeCamera) === null || K === void 0 ? void 0 : K.maxZ) !== null && re !== void 0 ? re : 1e4, this._debug = (se = this._debug) !== null && se !== void 0 && se, this._depthClamp = (ue = this._depthClamp) === null || ue === void 0 || ue, this._cascadeBlendPercentage = (he = this._cascadeBlendPercentage) !== null && he !== void 0 ? he : 0.1, this._lambda = (pe = this._lambda) !== null && pe !== void 0 ? pe : 0.5, this._autoCalcDepthBounds = (ve = this._autoCalcDepthBounds) !== null && ve !== void 0 && ve, r.prototype._initializeGenerator.call(this);
+ }, t.prototype._createTargetRenderTexture = function() {
+ var e = { width: this._mapSize, height: this._mapSize, layers: this.numCascades };
+ this._shadowMap = new bn(this._light.name + "_shadowMap", e, this._scene, !1, !0, this._textureType, !1, void 0, !1, !1, void 0), this._shadowMap.createDepthStencilTexture(d.a.LESS, !0);
+ }, t.prototype._initializeShadowMap = function() {
+ var e = this;
+ if (r.prototype._initializeShadowMap.call(this), this._shadowMap !== null) {
+ this._transformMatricesAsArray = new Float32Array(16 * this._numCascades), this._viewSpaceFrustumsZ = new Array(this._numCascades), this._frustumLengths = new Array(this._numCascades), this._lightSizeUVCorrection = new Array(2 * this._numCascades), this._depthCorrection = new Array(this._numCascades), this._cascades = [], this._viewMatrices = [], this._projectionMatrices = [], this._transformMatrices = [], this._cascadeMinExtents = [], this._cascadeMaxExtents = [], this._frustumCenter = [], this._shadowCameraPos = [], this._frustumCornersWorldSpace = [];
+ for (var n = 0; n < this._numCascades; ++n) {
+ this._cascades[n] = { prevBreakDistance: 0, breakDistance: 0 }, this._viewMatrices[n] = c.a.Zero(), this._projectionMatrices[n] = c.a.Zero(), this._transformMatrices[n] = c.a.Zero(), this._cascadeMinExtents[n] = new c.e(), this._cascadeMaxExtents[n] = new c.e(), this._frustumCenter[n] = new c.e(), this._shadowCameraPos[n] = new c.e(), this._frustumCornersWorldSpace[n] = new Array(t.frustumCornersNDCSpace.length);
+ for (var i = 0; i < t.frustumCornersNDCSpace.length; ++i)
+ this._frustumCornersWorldSpace[n][i] = new c.e();
+ }
+ this._shadowMap.onBeforeRenderObservable.add(function(o) {
+ if (e._currentLayer = o, e._scene.getSceneUniformBuffer().useUbo) {
+ var a = e._scene.getSceneUniformBuffer();
+ a.updateMatrix("viewProjection", e.getCascadeTransformMatrix(o)), a.updateMatrix("view", e.getCascadeViewMatrix(o)), a.update();
+ }
+ }), this._shadowMap.onBeforeBindObservable.add(function() {
+ e._breaksAreDirty && e._splitFrustum(), e._computeMatrices();
+ }), this._splitFrustum();
+ }
+ }, t.prototype._bindCustomEffectForRenderSubMeshForShadowMap = function(e, n, i, o) {
+ var a, s, p, m, S, O;
+ n.setMatrix((a = i == null ? void 0 : i.viewProjection) !== null && a !== void 0 ? a : "viewProjection", this.getCascadeTransformMatrix(this._currentLayer)), n.setMatrix((s = i == null ? void 0 : i.view) !== null && s !== void 0 ? s : "view", this.getCascadeViewMatrix(this._currentLayer)), n.setMatrix((p = i == null ? void 0 : i.projection) !== null && p !== void 0 ? p : "projection", this.getCascadeProjectionMatrix(this._currentLayer));
+ var I = o.getWorldMatrix();
+ n.setMatrix((m = i == null ? void 0 : i.world) !== null && m !== void 0 ? m : "world", I), I.multiplyToRef(this.getCascadeTransformMatrix(this._currentLayer), Do), n.setMatrix((S = i == null ? void 0 : i.worldViewProjection) !== null && S !== void 0 ? S : "worldViewProjection", Do), I.multiplyToRef(this.getCascadeViewMatrix(this._currentLayer), kf), n.setMatrix((O = i == null ? void 0 : i.worldView) !== null && O !== void 0 ? O : "worldView", kf);
+ }, t.prototype._isReadyCustomDefines = function(e, n, i) {
+ e.push("#define SM_DEPTHCLAMP " + (this._depthClamp && this._filter !== Zn.FILTER_PCSS ? "1" : "0"));
+ }, t.prototype.prepareDefines = function(e, n) {
+ r.prototype.prepareDefines.call(this, e, n);
+ var i = this._scene, o = this._light;
+ if (i.shadowsEnabled && o.shadowEnabled) {
+ e["SHADOWCSM" + n] = !0, e["SHADOWCSMDEBUG" + n] = this.debug, e["SHADOWCSMNUM_CASCADES" + n] = this.numCascades, e["SHADOWCSM_RIGHTHANDED" + n] = i.useRightHandedSystem;
+ var a = i.activeCamera;
+ a && this._shadowMaxZ < a.maxZ && (e["SHADOWCSMUSESHADOWMAXZ" + n] = !0), this.cascadeBlendPercentage === 0 && (e["SHADOWCSMNOBLEND" + n] = !0);
+ }
+ }, t.prototype.bindShadowLight = function(e, n) {
+ var i = this._light, o = this._scene;
+ if (o.shadowsEnabled && i.shadowEnabled) {
+ var a = o.activeCamera;
+ if (a) {
+ var s = this.getShadowMap();
+ if (s) {
+ var p = s.getSize().width;
+ if (n.setMatrices("lightMatrix" + e, this._transformMatricesAsArray), n.setArray("viewFrustumZ" + e, this._viewSpaceFrustumsZ), n.setFloat("cascadeBlendFactor" + e, this.cascadeBlendPercentage === 0 ? 1e4 : 1 / this.cascadeBlendPercentage), n.setArray("frustumLengths" + e, this._frustumLengths), this._filter === Zn.FILTER_PCF)
+ n.setDepthStencilTexture("shadowSampler" + e, s), i._uniformBuffer.updateFloat4("shadowsInfo", this.getDarkness(), p, 1 / p, this.frustumEdgeFalloff, e);
+ else if (this._filter === Zn.FILTER_PCSS) {
+ for (var m = 0; m < this._numCascades; ++m)
+ this._lightSizeUVCorrection[2 * m + 0] = m === 0 ? 1 : (this._cascadeMaxExtents[0].x - this._cascadeMinExtents[0].x) / (this._cascadeMaxExtents[m].x - this._cascadeMinExtents[m].x), this._lightSizeUVCorrection[2 * m + 1] = m === 0 ? 1 : (this._cascadeMaxExtents[0].y - this._cascadeMinExtents[0].y) / (this._cascadeMaxExtents[m].y - this._cascadeMinExtents[m].y), this._depthCorrection[m] = m === 0 ? 1 : (this._cascadeMaxExtents[m].z - this._cascadeMinExtents[m].z) / (this._cascadeMaxExtents[0].z - this._cascadeMinExtents[0].z);
+ n.setDepthStencilTexture("shadowSampler" + e, s), n.setTexture("depthSampler" + e, s), n.setArray2("lightSizeUVCorrection" + e, this._lightSizeUVCorrection), n.setArray("depthCorrection" + e, this._depthCorrection), n.setFloat("penumbraDarkness" + e, this.penumbraDarkness), i._uniformBuffer.updateFloat4("shadowsInfo", this.getDarkness(), 1 / p, this._contactHardeningLightSizeUVRatio * p, this.frustumEdgeFalloff, e);
+ } else
+ n.setTexture("shadowSampler" + e, s), i._uniformBuffer.updateFloat4("shadowsInfo", this.getDarkness(), p, 1 / p, this.frustumEdgeFalloff, e);
+ i._uniformBuffer.updateFloat2("depthValues", this.getLight().getDepthMinZ(a), this.getLight().getDepthMinZ(a) + this.getLight().getDepthMaxZ(a), e);
+ }
+ }
+ }
+ }, t.prototype.getTransformMatrix = function() {
+ return this.getCascadeTransformMatrix(0);
+ }, t.prototype.dispose = function() {
+ r.prototype.dispose.call(this), this._freezeShadowCastersBoundingInfoObservable && (this._scene.onBeforeRenderObservable.remove(this._freezeShadowCastersBoundingInfoObservable), this._freezeShadowCastersBoundingInfoObservable = null), this._depthReducer && (this._depthReducer.dispose(), this._depthReducer = null);
+ }, t.prototype.serialize = function() {
+ var e = r.prototype.serialize.call(this), n = this.getShadowMap();
+ if (!n)
+ return e;
+ if (e.numCascades = this._numCascades, e.debug = this._debug, e.stabilizeCascades = this.stabilizeCascades, e.lambda = this._lambda, e.cascadeBlendPercentage = this.cascadeBlendPercentage, e.depthClamp = this._depthClamp, e.autoCalcDepthBounds = this.autoCalcDepthBounds, e.shadowMaxZ = this._shadowMaxZ, e.penumbraDarkness = this.penumbraDarkness, e.freezeShadowCastersBoundingInfo = this._freezeShadowCastersBoundingInfo, e.minDistance = this.minDistance, e.maxDistance = this.maxDistance, e.renderList = [], n.renderList)
+ for (var i = 0; i < n.renderList.length; i++) {
+ var o = n.renderList[i];
+ e.renderList.push(o.id);
+ }
+ return e;
+ }, t.Parse = function(e, n) {
+ var i = Zn.Parse(e, n, function(o, a) {
+ return new t(o, a);
+ });
+ return e.numCascades !== void 0 && (i.numCascades = e.numCascades), e.debug !== void 0 && (i.debug = e.debug), e.stabilizeCascades !== void 0 && (i.stabilizeCascades = e.stabilizeCascades), e.lambda !== void 0 && (i.lambda = e.lambda), e.cascadeBlendPercentage !== void 0 && (i.cascadeBlendPercentage = e.cascadeBlendPercentage), e.depthClamp !== void 0 && (i.depthClamp = e.depthClamp), e.autoCalcDepthBounds !== void 0 && (i.autoCalcDepthBounds = e.autoCalcDepthBounds), e.shadowMaxZ !== void 0 && (i.shadowMaxZ = e.shadowMaxZ), e.penumbraDarkness !== void 0 && (i.penumbraDarkness = e.penumbraDarkness), e.freezeShadowCastersBoundingInfo !== void 0 && (i.freezeShadowCastersBoundingInfo = e.freezeShadowCastersBoundingInfo), e.minDistance !== void 0 && e.maxDistance !== void 0 && i.setMinMaxDistance(e.minDistance, e.maxDistance), i;
+ }, t.frustumCornersNDCSpace = [new c.e(-1, 1, -1), new c.e(1, 1, -1), new c.e(1, -1, -1), new c.e(-1, -1, -1), new c.e(-1, 1, 1), new c.e(1, 1, 1), new c.e(1, -1, 1), new c.e(-1, -1, 1)], t.CLASSNAME = "CascadedShadowGenerator", t.DEFAULT_CASCADES_COUNT = 4, t.MIN_CASCADES_COUNT = 2, t.MAX_CASCADES_COUNT = 4, t._SceneComponentInitialization = function(e) {
+ throw Nn.a.WarnImport("ShadowGeneratorSceneComponent");
+ }, t;
+ }(Zn);
+ D.a.AddParser(st.a.NAME_SHADOWGENERATOR, function(r, t) {
+ if (r.shadowGenerators !== void 0 && r.shadowGenerators !== null)
+ for (var e = 0, n = r.shadowGenerators.length; e < n; e++) {
+ var i = r.shadowGenerators[e];
+ i.className === Wl.CLASSNAME ? Wl.Parse(i, t) : Zn.Parse(i, t);
+ }
+ });
+ var Gf = function() {
+ function r(t) {
+ this.name = st.a.NAME_SHADOWGENERATOR, this.scene = t;
+ }
+ return r.prototype.register = function() {
+ this.scene._gatherRenderTargetsStage.registerStep(st.a.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR, this, this._gatherRenderTargets);
+ }, r.prototype.rebuild = function() {
+ }, r.prototype.serialize = function(t) {
+ t.shadowGenerators = [];
+ for (var e = 0, n = this.scene.lights; e < n.length; e++) {
+ var i = n[e].getShadowGenerator();
+ i && t.shadowGenerators.push(i.serialize());
+ }
+ }, r.prototype.addFromContainer = function(t) {
+ }, r.prototype.removeFromContainer = function(t, e) {
+ }, r.prototype.dispose = function() {
+ }, r.prototype._gatherRenderTargets = function(t) {
+ var e = this.scene;
+ if (this.scene.shadowsEnabled)
+ for (var n = 0; n < e.lights.length; n++) {
+ var i = e.lights[n], o = i.getShadowGenerator();
+ if (i.isEnabled() && i.shadowEnabled && o) {
+ var a = o.getShadowMap();
+ e.textures.indexOf(a) !== -1 && t.push(a);
+ }
+ }
+ }, r;
+ }();
+ Zn._SceneComponentInitialization = function(r) {
+ var t = r._getComponent(st.a.NAME_SHADOWGENERATOR);
+ t || (t = new Gf(r), r._addComponent(t));
+ }, q.a.AddNodeConstructor("Light_Type_0", function(r, t) {
+ return function() {
+ return new Xl(r, c.e.Zero(), t);
+ };
+ });
+ var Xl = function(r) {
+ function t(e, n, i) {
+ var o = r.call(this, e, i) || this;
+ return o._shadowAngle = Math.PI / 2, o.position = n, o;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "shadowAngle", { get: function() {
+ return this._shadowAngle;
+ }, set: function(e) {
+ this._shadowAngle = e, this.forceProjectionMatrixCompute();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "direction", { get: function() {
+ return this._direction;
+ }, set: function(e) {
+ var n = this.needCube();
+ this._direction = e, this.needCube() !== n && this._shadowGenerator && this._shadowGenerator.recreateShadowMap();
+ }, enumerable: !1, configurable: !0 }), t.prototype.getClassName = function() {
+ return "PointLight";
+ }, t.prototype.getTypeID = function() {
+ return or.a.LIGHTTYPEID_POINTLIGHT;
+ }, t.prototype.needCube = function() {
+ return !this.direction;
+ }, t.prototype.getShadowDirection = function(e) {
+ if (this.direction)
+ return r.prototype.getShadowDirection.call(this, e);
+ switch (e) {
+ case 0:
+ return new c.e(1, 0, 0);
+ case 1:
+ return new c.e(-1, 0, 0);
+ case 2:
+ return new c.e(0, -1, 0);
+ case 3:
+ return new c.e(0, 1, 0);
+ case 4:
+ return new c.e(0, 0, 1);
+ case 5:
+ return new c.e(0, 0, -1);
+ }
+ return c.e.Zero();
+ }, t.prototype._setDefaultShadowProjectionMatrix = function(e, n, i) {
+ var o = this.getScene().activeCamera;
+ o && c.a.PerspectiveFovLHToRef(this.shadowAngle, 1, this.getDepthMinZ(o), this.getDepthMaxZ(o), e);
+ }, t.prototype._buildUniformLayout = function() {
+ this._uniformBuffer.addUniform("vLightData", 4), this._uniformBuffer.addUniform("vLightDiffuse", 4), this._uniformBuffer.addUniform("vLightSpecular", 4), this._uniformBuffer.addUniform("vLightFalloff", 4), this._uniformBuffer.addUniform("shadowsInfo", 3), this._uniformBuffer.addUniform("depthValues", 2), this._uniformBuffer.create();
+ }, t.prototype.transferToEffect = function(e, n) {
+ return this.computeTransformedInformation() ? this._uniformBuffer.updateFloat4("vLightData", this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, 0, n) : this._uniformBuffer.updateFloat4("vLightData", this.position.x, this.position.y, this.position.z, 0, n), this._uniformBuffer.updateFloat4("vLightFalloff", this.range, this._inverseSquaredRange, 0, 0, n), this;
+ }, t.prototype.transferToNodeMaterialEffect = function(e, n) {
+ return this.computeTransformedInformation() ? e.setFloat3(n, this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z) : e.setFloat3(n, this.position.x, this.position.y, this.position.z), this;
+ }, t.prototype.prepareLightSpecificDefines = function(e, n) {
+ e["POINTLIGHT" + n] = !0;
+ }, Object(u.c)([Object(w.c)()], t.prototype, "shadowAngle", null), t;
+ }(Os), zf = function() {
+ function r(t, e, n) {
+ var i = this;
+ e === void 0 && (e = ""), n === void 0 && (n = "black"), this._renderingCanvas = t, this._loadingText = e, this._loadingDivBackgroundColor = n, this._resizeLoadingUI = function() {
+ var o = i._renderingCanvas.getBoundingClientRect(), a = window.getComputedStyle(i._renderingCanvas).position;
+ i._loadingDiv && (i._loadingDiv.style.position = a === "fixed" ? "fixed" : "absolute", i._loadingDiv.style.left = o.left + "px", i._loadingDiv.style.top = o.top + "px", i._loadingDiv.style.width = o.width + "px", i._loadingDiv.style.height = o.height + "px");
+ };
+ }
+ return r.prototype.displayLoadingUI = function() {
+ if (!this._loadingDiv) {
+ this._loadingDiv = document.createElement("div"), this._loadingDiv.id = "babylonjsLoadingDiv", this._loadingDiv.style.opacity = "0", this._loadingDiv.style.transition = "opacity 1.5s ease", this._loadingDiv.style.pointerEvents = "none", this._loadingDiv.style.display = "grid", this._loadingDiv.style.gridTemplateRows = "100%", this._loadingDiv.style.gridTemplateColumns = "100%", this._loadingDiv.style.justifyItems = "center", this._loadingDiv.style.alignItems = "center", this._loadingTextDiv = document.createElement("div"), this._loadingTextDiv.style.position = "absolute", this._loadingTextDiv.style.left = "0", this._loadingTextDiv.style.top = "50%", this._loadingTextDiv.style.marginTop = "80px", this._loadingTextDiv.style.width = "100%", this._loadingTextDiv.style.height = "20px", this._loadingTextDiv.style.fontFamily = "Arial", this._loadingTextDiv.style.fontSize = "14px", this._loadingTextDiv.style.color = "white", this._loadingTextDiv.style.textAlign = "center", this._loadingTextDiv.style.zIndex = "1", this._loadingTextDiv.innerHTML = "Loading", this._loadingDiv.appendChild(this._loadingTextDiv), this._loadingTextDiv.innerHTML = this._loadingText;
+ var t = document.createElement("style");
+ t.type = "text/css", t.innerHTML = `@-webkit-keyframes spin1 { 0% { -webkit-transform: rotate(0deg);}
+ 100% { -webkit-transform: rotate(360deg);}
+ } @keyframes spin1 { 0% { transform: rotate(0deg);}
+ 100% { transform: rotate(360deg);}
+ }`, document.getElementsByTagName("head")[0].appendChild(t);
+ var e = !!window.SVGSVGElement, n = new Image();
+ r.DefaultLogoUrl ? n.src = r.DefaultLogoUrl : n.src = e ? "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxODAuMTcgMjA4LjA0Ij48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2ZmZjt9LmNscy0ye2ZpbGw6I2UwNjg0Yjt9LmNscy0ze2ZpbGw6I2JiNDY0Yjt9LmNscy00e2ZpbGw6I2UwZGVkODt9LmNscy01e2ZpbGw6I2Q1ZDJjYTt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPkJhYnlsb25Mb2dvPC90aXRsZT48ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj48ZyBpZD0iUGFnZV9FbGVtZW50cyIgZGF0YS1uYW1lPSJQYWdlIEVsZW1lbnRzIj48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik05MC4wOSwwLDAsNTJWMTU2bDkwLjA5LDUyLDkwLjA4LTUyVjUyWiIvPjxwb2x5Z29uIGNsYXNzPSJjbHMtMiIgcG9pbnRzPSIxODAuMTcgNTIuMDEgMTUxLjk3IDM1LjczIDEyNC44NSA1MS4zOSAxNTMuMDUgNjcuNjcgMTgwLjE3IDUyLjAxIi8+PHBvbHlnb24gY2xhc3M9ImNscy0yIiBwb2ludHM9IjI3LjEyIDY3LjY3IDExNy4yMSAxNS42NiA5MC4wOCAwIDAgNTIuMDEgMjcuMTIgNjcuNjciLz48cG9seWdvbiBjbGFzcz0iY2xzLTIiIHBvaW50cz0iNjEuODkgMTIwLjMgOTAuMDggMTM2LjU4IDExOC4yOCAxMjAuMyA5MC4wOCAxMDQuMDIgNjEuODkgMTIwLjMiLz48cG9seWdvbiBjbGFzcz0iY2xzLTMiIHBvaW50cz0iMTUzLjA1IDY3LjY3IDE1My4wNSAxNDAuMzcgOTAuMDggMTc2LjcyIDI3LjEyIDE0MC4zNyAyNy4xMiA2Ny42NyAwIDUyLjAxIDAgMTU2LjAzIDkwLjA4IDIwOC4wNCAxODAuMTcgMTU2LjAzIDE4MC4xNyA1Mi4wMSAxNTMuMDUgNjcuNjciLz48cG9seWdvbiBjbGFzcz0iY2xzLTMiIHBvaW50cz0iOTAuMDggNzEuNDYgNjEuODkgODcuNzQgNjEuODkgMTIwLjMgOTAuMDggMTA0LjAyIDExOC4yOCAxMjAuMyAxMTguMjggODcuNzQgOTAuMDggNzEuNDYiLz48cG9seWdvbiBjbGFzcz0iY2xzLTQiIHBvaW50cz0iMTUzLjA1IDY3LjY3IDExOC4yOCA4Ny43NCAxMTguMjggMTIwLjMgOTAuMDggMTM2LjU4IDkwLjA4IDE3Ni43MiAxNTMuMDUgMTQwLjM3IDE1My4wNSA2Ny42NyIvPjxwb2x5Z29uIGNsYXNzPSJjbHMtNSIgcG9pbnRzPSIyNy4xMiA2Ny42NyA2MS44OSA4Ny43NCA2MS44OSAxMjAuMyA5MC4wOCAxMzYuNTggOTAuMDggMTc2LjcyIDI3LjEyIDE0MC4zNyAyNy4xMiA2Ny42NyIvPjwvZz48L2c+PC9zdmc+" : "https://cdn.babylonjs.com/Assets/babylonLogo.png", n.style.width = "150px", n.style.gridColumn = "1", n.style.gridRow = "1", n.style.top = "50%", n.style.left = "50%", n.style.transform = "translate(-50%, -50%)", n.style.position = "absolute";
+ var i = document.createElement("div");
+ i.style.width = "300px", i.style.gridColumn = "1", i.style.gridRow = "1", i.style.top = "50%", i.style.left = "50%", i.style.transform = "translate(-50%, -50%)", i.style.position = "absolute";
+ var o = new Image();
+ if (r.DefaultSpinnerUrl ? o.src = r.DefaultSpinnerUrl : o.src = e ? "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOTIgMzkyIj48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2UwNjg0Yjt9LmNscy0ye2ZpbGw6bm9uZTt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPlNwaW5uZXJJY29uPC90aXRsZT48ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj48ZyBpZD0iU3Bpbm5lciI+PHBhdGggY2xhc3M9ImNscy0xIiBkPSJNNDAuMjEsMTI2LjQzYzMuNy03LjMxLDcuNjctMTQuNDQsMTItMjEuMzJsMy4zNi01LjEsMy41Mi01YzEuMjMtMS42MywyLjQxLTMuMjksMy42NS00LjkxczIuNTMtMy4yMSwzLjgyLTQuNzlBMTg1LjIsMTg1LjIsMCwwLDEsODMuNCw2Ny40M2EyMDgsMjA4LDAsMCwxLDE5LTE1LjY2YzMuMzUtMi40MSw2Ljc0LTQuNzgsMTAuMjUtN3M3LjExLTQuMjgsMTAuNzUtNi4zMmM3LjI5LTQsMTQuNzMtOCwyMi41My0xMS40OSwzLjktMS43Miw3Ljg4LTMuMywxMi00LjY0YTEwNC4yMiwxMDQuMjIsMCwwLDEsMTIuNDQtMy4yMyw2Mi40NCw2Mi40NCwwLDAsMSwxMi43OC0xLjM5QTI1LjkyLDI1LjkyLDAsMCwxLDE5NiwyMS40NGE2LjU1LDYuNTUsMCwwLDEsMi4wNSw5LDYuNjYsNi42NiwwLDAsMS0xLjY0LDEuNzhsLS40MS4yOWEyMi4wNywyMi4wNywwLDAsMS01Ljc4LDMsMzAuNDIsMzAuNDIsMCwwLDEtNS42NywxLjYyLDM3LjgyLDM3LjgyLDAsMCwxLTUuNjkuNzFjLTEsMC0xLjkuMTgtMi44NS4yNmwtMi44NS4yNHEtNS43Mi41MS0xMS40OCwxLjFjLTMuODQuNC03LjcxLjgyLTExLjU4LDEuNGExMTIuMzQsMTEyLjM0LDAsMCwwLTIyLjk0LDUuNjFjLTMuNzIsMS4zNS03LjM0LDMtMTAuOTQsNC42NHMtNy4xNCwzLjUxLTEwLjYsNS41MUExNTEuNiwxNTEuNiwwLDAsMCw2OC41Niw4N0M2Ny4yMyw4OC40OCw2Niw5MCw2NC42NCw5MS41NnMtMi41MSwzLjE1LTMuNzUsNC43M2wtMy41NCw0LjljLTEuMTMsMS42Ni0yLjIzLDMuMzUtMy4zMyw1YTEyNywxMjcsMCwwLDAtMTAuOTMsMjEuNDksMS41OCwxLjU4LDAsMSwxLTMtMS4xNVM0MC4xOSwxMjYuNDcsNDAuMjEsMTI2LjQzWiIvPjxyZWN0IGNsYXNzPSJjbHMtMiIgd2lkdGg9IjM5MiIgaGVpZ2h0PSIzOTIiLz48L2c+PC9nPjwvc3ZnPg==" : "https://cdn.babylonjs.com/Assets/loadingIcon.png", o.style.animation = "spin1 0.75s infinite linear", o.style.webkitAnimation = "spin1 0.75s infinite linear", o.style.transformOrigin = "50% 50%", o.style.webkitTransformOrigin = "50% 50%", !e) {
+ var a = { w: 16, h: 18.5 }, s = { w: 30, h: 30 };
+ n.style.width = a.w + "vh", n.style.height = a.h + "vh", n.style.left = "calc(50% - " + a.w / 2 + "vh)", n.style.top = "calc(50% - " + a.h / 2 + "vh)", o.style.width = s.w + "vh", o.style.height = s.h + "vh", o.style.left = "calc(50% - " + s.w / 2 + "vh)", o.style.top = "calc(50% - " + s.h / 2 + "vh)";
+ }
+ i.appendChild(o), this._loadingDiv.appendChild(n), this._loadingDiv.appendChild(i), this._resizeLoadingUI(), window.addEventListener("resize", this._resizeLoadingUI), this._loadingDiv.style.backgroundColor = this._loadingDivBackgroundColor, document.body.appendChild(this._loadingDiv), this._loadingDiv.style.opacity = "1";
+ }
+ }, r.prototype.hideLoadingUI = function() {
+ var t = this;
+ this._loadingDiv && (this._loadingDiv.style.opacity = "0", this._loadingDiv.addEventListener("transitionend", function() {
+ t._loadingDiv && (t._loadingDiv.parentElement && t._loadingDiv.parentElement.removeChild(t._loadingDiv), window.removeEventListener("resize", t._resizeLoadingUI), t._loadingDiv = null);
+ }));
+ }, Object.defineProperty(r.prototype, "loadingUIText", { get: function() {
+ return this._loadingText;
+ }, set: function(t) {
+ this._loadingText = t, this._loadingTextDiv && (this._loadingTextDiv.innerHTML = this._loadingText);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "loadingUIBackgroundColor", { get: function() {
+ return this._loadingDivBackgroundColor;
+ }, set: function(t) {
+ this._loadingDivBackgroundColor = t, this._loadingDiv && (this._loadingDiv.style.backgroundColor = this._loadingDivBackgroundColor);
+ }, enumerable: !1, configurable: !0 }), r.DefaultLogoUrl = "", r.DefaultSpinnerUrl = "", r;
+ }();
+ ke.a.DefaultLoadingScreenFactory = function(r) {
+ return new zf(r);
+ };
+ var Yl = l(71), Yr = l(68), Kl = function() {
+ function r() {
+ }
+ return r.ConvertPanoramaToCubemap = function(t, e, n, i) {
+ if (!t)
+ throw "ConvertPanoramaToCubemap: input cannot be null";
+ if (t.length != e * n * 3)
+ throw "ConvertPanoramaToCubemap: input size is wrong";
+ return { front: this.CreateCubemapTexture(i, this.FACE_FRONT, t, e, n), back: this.CreateCubemapTexture(i, this.FACE_BACK, t, e, n), left: this.CreateCubemapTexture(i, this.FACE_LEFT, t, e, n), right: this.CreateCubemapTexture(i, this.FACE_RIGHT, t, e, n), up: this.CreateCubemapTexture(i, this.FACE_UP, t, e, n), down: this.CreateCubemapTexture(i, this.FACE_DOWN, t, e, n), size: i, type: d.a.TEXTURETYPE_FLOAT, format: d.a.TEXTUREFORMAT_RGB, gammaSpace: !1 };
+ }, r.CreateCubemapTexture = function(t, e, n, i, o) {
+ for (var a = new ArrayBuffer(t * t * 4 * 3), s = new Float32Array(a), p = e[1].subtract(e[0]).scale(1 / t), m = e[3].subtract(e[2]).scale(1 / t), S = 1 / t, O = 0, I = 0; I < t; I++) {
+ for (var G = e[0], k = e[2], K = 0; K < t; K++) {
+ var re = k.subtract(G).scale(O).add(G);
+ re.normalize();
+ var se = this.CalcProjectionSpherical(re, n, i, o);
+ s[I * t * 3 + 3 * K + 0] = se.r, s[I * t * 3 + 3 * K + 1] = se.g, s[I * t * 3 + 3 * K + 2] = se.b, G = G.add(p), k = k.add(m);
+ }
+ O += S;
+ }
+ return s;
+ }, r.CalcProjectionSpherical = function(t, e, n, i) {
+ for (var o = Math.atan2(t.z, t.x), a = Math.acos(t.y); o < -Math.PI; )
+ o += 2 * Math.PI;
+ for (; o > Math.PI; )
+ o -= 2 * Math.PI;
+ var s = o / Math.PI, p = a / Math.PI;
+ s = 0.5 * s + 0.5;
+ var m = Math.round(s * n);
+ m < 0 ? m = 0 : m >= n && (m = n - 1);
+ var S = Math.round(p * i);
+ S < 0 ? S = 0 : S >= i && (S = i - 1);
+ var O = i - S - 1;
+ return { r: e[O * n * 3 + 3 * m + 0], g: e[O * n * 3 + 3 * m + 1], b: e[O * n * 3 + 3 * m + 2] };
+ }, r.FACE_LEFT = [new c.e(-1, -1, -1), new c.e(1, -1, -1), new c.e(-1, 1, -1), new c.e(1, 1, -1)], r.FACE_RIGHT = [new c.e(1, -1, 1), new c.e(-1, -1, 1), new c.e(1, 1, 1), new c.e(-1, 1, 1)], r.FACE_FRONT = [new c.e(1, -1, -1), new c.e(1, -1, 1), new c.e(1, 1, -1), new c.e(1, 1, 1)], r.FACE_BACK = [new c.e(-1, -1, 1), new c.e(-1, -1, -1), new c.e(-1, 1, 1), new c.e(-1, 1, -1)], r.FACE_DOWN = [new c.e(1, 1, -1), new c.e(1, 1, 1), new c.e(-1, 1, -1), new c.e(-1, 1, 1)], r.FACE_UP = [new c.e(-1, -1, -1), new c.e(-1, -1, 1), new c.e(1, -1, -1), new c.e(1, -1, 1)], r;
+ }(), jf = function() {
+ function r() {
+ }
+ return r.Ldexp = function(t, e) {
+ return e > 1023 ? t * Math.pow(2, 1023) * Math.pow(2, e - 1023) : e < -1074 ? t * Math.pow(2, -1074) * Math.pow(2, e + 1074) : t * Math.pow(2, e);
+ }, r.Rgbe2float = function(t, e, n, i, o, a) {
+ o > 0 ? (o = this.Ldexp(1, o - 136), t[a + 0] = e * o, t[a + 1] = n * o, t[a + 2] = i * o) : (t[a + 0] = 0, t[a + 1] = 0, t[a + 2] = 0);
+ }, r.readStringLine = function(t, e) {
+ for (var n = "", i = "", o = e; o < t.length - e && (i = String.fromCharCode(t[o])) != `
+`; o++)
+ n += i;
+ return n;
+ }, r.RGBE_ReadHeader = function(t) {
+ var e, n, i = this.readStringLine(t, 0);
+ if (i[0] != "#" || i[1] != "?")
+ throw "Bad HDR Format.";
+ var o = !1, a = !1, s = 0;
+ do
+ s += i.length + 1, (i = this.readStringLine(t, s)) == "FORMAT=32-bit_rle_rgbe" ? a = !0 : i.length == 0 && (o = !0);
+ while (!o);
+ if (!a)
+ throw "HDR Bad header format, unsupported FORMAT";
+ s += i.length + 1, i = this.readStringLine(t, s);
+ var p = /^\-Y (.*) \+X (.*)$/g.exec(i);
+ if (!p || p.length < 3)
+ throw "HDR Bad header format, no size";
+ if (n = parseInt(p[2]), e = parseInt(p[1]), n < 8 || n > 32767)
+ throw "HDR Bad header format, unsupported size";
+ return { height: e, width: n, dataPosition: s += i.length + 1 };
+ }, r.GetCubeMapTextureData = function(t, e) {
+ var n = new Uint8Array(t), i = this.RGBE_ReadHeader(n), o = this.RGBE_ReadPixels(n, i);
+ return Kl.ConvertPanoramaToCubemap(o, i.width, i.height, e);
+ }, r.RGBE_ReadPixels = function(t, e) {
+ return this.RGBE_ReadPixels_RLE(t, e);
+ }, r.RGBE_ReadPixels_RLE = function(t, e) {
+ for (var n, i, o, a, s, p = e.height, m = e.width, S = e.dataPosition, O = 0, I = 0, G = 0, k = new ArrayBuffer(4 * m), K = new Uint8Array(k), re = new ArrayBuffer(e.width * e.height * 4 * 3), se = new Float32Array(re); p > 0; ) {
+ if (n = t[S++], i = t[S++], o = t[S++], a = t[S++], n != 2 || i != 2 || 128 & o || e.width < 8 || e.width > 32767)
+ return this.RGBE_ReadPixels_NOT_RLE(t, e);
+ if ((o << 8 | a) != m)
+ throw "HDR Bad header format, wrong scan line width";
+ for (O = 0, G = 0; G < 4; G++)
+ for (I = (G + 1) * m; O < I; )
+ if (n = t[S++], i = t[S++], n > 128) {
+ if ((s = n - 128) == 0 || s > I - O)
+ throw "HDR Bad Format, bad scanline data (run)";
+ for (; s-- > 0; )
+ K[O++] = i;
+ } else {
+ if ((s = n) == 0 || s > I - O)
+ throw "HDR Bad Format, bad scanline data (non-run)";
+ if (K[O++] = i, --s > 0)
+ for (var ue = 0; ue < s; ue++)
+ K[O++] = t[S++];
+ }
+ for (G = 0; G < m; G++)
+ n = K[G], i = K[G + m], o = K[G + 2 * m], a = K[G + 3 * m], this.Rgbe2float(se, n, i, o, a, (e.height - p) * m * 3 + 3 * G);
+ p--;
+ }
+ return se;
+ }, r.RGBE_ReadPixels_NOT_RLE = function(t, e) {
+ for (var n, i, o, a, s, p = e.height, m = e.width, S = e.dataPosition, O = new ArrayBuffer(e.width * e.height * 4 * 3), I = new Float32Array(O); p > 0; ) {
+ for (s = 0; s < e.width; s++)
+ n = t[S++], i = t[S++], o = t[S++], a = t[S++], this.Rgbe2float(I, n, i, o, a, (e.height - p) * m * 3 + 3 * s);
+ p--;
+ }
+ return I;
+ }, r;
+ }(), Hf = function() {
+ function r(t, e) {
+ var n;
+ e === void 0 && (e = r._DefaultOptions), this.engine = t, this._fullscreenViewport = new li.a(0, 0, 1, 1), e = Object(u.a)(Object(u.a)({}, r._DefaultOptions), e), this._vertexBuffers = ((n = {})[De.b.PositionKind] = new De.b(t, e.positions, De.b.PositionKind, !1, !1, 2), n), this._indexBuffer = t.createIndexBuffer(e.indices);
+ }
+ return r.prototype.setViewport = function(t) {
+ t === void 0 && (t = this._fullscreenViewport), this.engine.setViewport(t);
+ }, r.prototype.bindBuffers = function(t) {
+ this.engine.bindBuffers(this._vertexBuffers, this._indexBuffer, t);
+ }, r.prototype.applyEffectWrapper = function(t) {
+ this.engine.depthCullingState.depthTest = !1, this.engine.stencilState.stencilTest = !1, this.engine.enableEffect(t.effect), this.bindBuffers(t.effect), t.onApplyObservable.notifyObservers({});
+ }, r.prototype.restoreStates = function() {
+ this.engine.depthCullingState.depthTest = !0, this.engine.stencilState.stencilTest = !0;
+ }, r.prototype.draw = function() {
+ this.engine.drawElementsType(d.a.MATERIAL_TriangleFillMode, 0, 6);
+ }, r.prototype.isRenderTargetTexture = function(t) {
+ return t.renderList !== void 0;
+ }, r.prototype.render = function(t, e) {
+ if (e === void 0 && (e = null), t.effect.isReady()) {
+ this.setViewport();
+ var n = e === null ? null : this.isRenderTargetTexture(e) ? e.getInternalTexture() : e;
+ n && this.engine.bindFramebuffer(n), this.applyEffectWrapper(t), this.draw(), n && this.engine.unBindFramebuffer(n), this.restoreStates();
+ }
+ }, r.prototype.dispose = function() {
+ var t = this._vertexBuffers[De.b.PositionKind];
+ t && (t.dispose(), delete this._vertexBuffers[De.b.PositionKind]), this._indexBuffer && this.engine._releaseBuffer(this._indexBuffer);
+ }, r._DefaultOptions = { positions: [1, 1, -1, 1, -1, -1, 1, -1], indices: [0, 1, 2, 0, 2, 3] }, r;
+ }(), Wf = function() {
+ function r(t) {
+ var e, n = this;
+ this.onApplyObservable = new P.c();
+ var i = t.uniformNames || [];
+ t.vertexShader ? e = { fragmentSource: t.fragmentShader, vertexSource: t.vertexShader, spectorName: t.name || "effectWrapper" } : (i.push("scale"), e = { fragmentSource: t.fragmentShader, vertex: "postprocess", spectorName: t.name || "effectWrapper" }, this.onApplyObservable.add(function() {
+ n.effect.setFloat2("scale", 1, 1);
+ }));
+ var o = t.defines ? t.defines.join(`
+`) : "";
+ t.useShaderStore ? (e.fragment = e.fragmentSource, e.vertex || (e.vertex = e.vertexSource), delete e.fragmentSource, delete e.vertexSource, this.effect = t.engine.createEffect(e.spectorName, t.attributeNames || ["position"], i, t.samplerNames, o, void 0, t.onCompiled)) : this.effect = new We.a(e, t.attributeNames || ["position"], i, t.samplerNames, t.engine, o, void 0, t.onCompiled);
+ }
+ return r.prototype.dispose = function() {
+ this.effect.dispose();
+ }, r;
+ }(), l0 = `
+attribute vec2 position;
+
+varying vec3 direction;
+
+uniform vec3 up;
+uniform vec3 right;
+uniform vec3 front;
+void main(void) {
+mat3 view=mat3(up,right,front);
+direction=view*vec3(position,1.0);
+gl_Position=vec4(position,0.0,1.0);
+}`;
+ We.a.ShadersStore.hdrFilteringVertexShader = l0;
+ var u0 = `#include
+#include
+#include
+#include
+uniform float alphaG;
+uniform samplerCube inputTexture;
+uniform vec2 vFilteringInfo;
+uniform float hdrScale;
+varying vec3 direction;
+void main() {
+vec3 color=radiance(alphaG,inputTexture,direction,vFilteringInfo);
+gl_FragColor=vec4(color*hdrScale,1.0);
+}`;
+ We.a.ShadersStore.hdrFilteringPixelShader = u0;
+ var Xf = function() {
+ function r(t, e) {
+ e === void 0 && (e = {}), this._lodGenerationOffset = 0, this._lodGenerationScale = 0.8, this.quality = d.a.TEXTURE_FILTERING_QUALITY_OFFLINE, this.hdrScale = 1, this._engine = t, this.hdrScale = e.hdrScale || this.hdrScale, this.quality = e.hdrScale || this.quality;
+ }
+ return r.prototype._createRenderTarget = function(t) {
+ var e = d.a.TEXTURETYPE_UNSIGNED_BYTE;
+ this._engine.getCaps().textureHalfFloatRender ? e = d.a.TEXTURETYPE_HALF_FLOAT : this._engine.getCaps().textureFloatRender && (e = d.a.TEXTURETYPE_FLOAT);
+ var n = this._engine.createRenderTargetCubeTexture(t, { format: d.a.TEXTUREFORMAT_RGBA, type: e, generateMipMaps: !1, generateDepthBuffer: !1, generateStencilBuffer: !1, samplingMode: d.a.TEXTURE_NEAREST_SAMPLINGMODE });
+ return this._engine.updateTextureWrappingMode(n, d.a.TEXTURE_CLAMP_ADDRESSMODE, d.a.TEXTURE_CLAMP_ADDRESSMODE, d.a.TEXTURE_CLAMP_ADDRESSMODE), this._engine.updateTextureSamplingMode(d.a.TEXTURE_TRILINEAR_SAMPLINGMODE, n, !0), n;
+ }, r.prototype._prefilterInternal = function(t) {
+ var e = t.getSize().width, n = Math.round(ee.a.Log2(e)) + 1, i = this._effectWrapper.effect, o = this._createRenderTarget(e);
+ this._effectRenderer.setViewport();
+ var a = t.getInternalTexture();
+ a && this._engine.updateTextureSamplingMode(d.a.TEXTURE_TRILINEAR_SAMPLINGMODE, a, !0), this._effectRenderer.applyEffectWrapper(this._effectWrapper);
+ var s = [[new c.e(0, 0, -1), new c.e(0, -1, 0), new c.e(1, 0, 0)], [new c.e(0, 0, 1), new c.e(0, -1, 0), new c.e(-1, 0, 0)], [new c.e(1, 0, 0), new c.e(0, 0, 1), new c.e(0, 1, 0)], [new c.e(1, 0, 0), new c.e(0, 0, -1), new c.e(0, -1, 0)], [new c.e(1, 0, 0), new c.e(0, -1, 0), new c.e(0, 0, 1)], [new c.e(-1, 0, 0), new c.e(0, -1, 0), new c.e(0, 0, -1)]];
+ i.setFloat("hdrScale", this.hdrScale), i.setFloat2("vFilteringInfo", t.getSize().width, n), i.setTexture("inputTexture", t);
+ for (var p = 0; p < 6; p++) {
+ i.setVector3("up", s[p][0]), i.setVector3("right", s[p][1]), i.setVector3("front", s[p][2]);
+ for (var m = 0; m < n; m++) {
+ this._engine.bindFramebuffer(o, p, void 0, void 0, !0, m), this._effectRenderer.applyEffectWrapper(this._effectWrapper);
+ var S = Math.pow(2, (m - this._lodGenerationOffset) / this._lodGenerationScale) / e;
+ m === 0 && (S = 0), i.setFloat("alphaG", S), this._effectRenderer.draw();
+ }
+ }
+ return this._effectRenderer.restoreStates(), this._engine.restoreDefaultFramebuffer(), this._engine._releaseFramebufferObjects(o), this._engine._releaseTexture(t._texture), o._swapAndDie(t._texture), t._prefiltered = !0, t;
+ }, r.prototype._createEffect = function(t, e) {
+ var n = [];
+ return t.gammaSpace && n.push("#define GAMMA_INPUT"), n.push("#define NUM_SAMPLES " + this.quality + "u"), new Wf({ engine: this._engine, name: "hdrFiltering", vertexShader: "hdrFiltering", fragmentShader: "hdrFiltering", samplerNames: ["inputTexture"], uniformNames: ["vSampleDirections", "vWeights", "up", "right", "front", "vFilteringInfo", "hdrScale", "alphaG"], useShaderStore: !0, defines: n, onCompiled: e });
+ }, r.prototype.isReady = function(t) {
+ return t.isReady() && this._effectWrapper.effect.isReady();
+ }, r.prototype.prefilter = function(t, e) {
+ var n = this;
+ if (e === void 0 && (e = null), this._engine.webGLVersion !== 1)
+ return new Promise(function(i) {
+ n._effectRenderer = new Hf(n._engine), n._effectWrapper = n._createEffect(t), n._effectWrapper.effect.executeWhenCompiled(function() {
+ n._prefilterInternal(t), n._effectRenderer.dispose(), n._effectWrapper.dispose(), i(), e && e();
+ });
+ });
+ h.a.Warn("HDR prefiltering is not available in WebGL 1., you can use real time filtering instead.");
+ }, r;
+ }(), Vs = function(r) {
+ function t(e, n, i, o, a, s, p, m, S) {
+ var O;
+ o === void 0 && (o = !1), a === void 0 && (a = !0), s === void 0 && (s = !1), p === void 0 && (p = !1), m === void 0 && (m = null), S === void 0 && (S = null);
+ var I = r.call(this, n) || this;
+ return I._generateHarmonics = !0, I._onLoad = null, I._onError = null, I._isBlocking = !0, I._rotationY = 0, I.boundingBoxPosition = c.e.Zero(), e && (I._coordinatesMode = Ue.a.CUBIC_MODE, I.name = e, I.url = e, I.hasAlpha = !1, I.isCube = !0, I._textureMatrix = c.a.Identity(), I._prefilterOnLoad = p, I._onLoad = m, I._onError = S, I.gammaSpace = s, I._noMipmap = o, I._size = i, I._generateHarmonics = a, I._texture = I._getFromCache(e, I._noMipmap), I._texture ? m && (I._texture.isReady ? Ke.b.SetImmediate(function() {
+ return m();
+ }) : I._texture.onLoadedObservable.add(m)) : !((O = I.getScene()) === null || O === void 0) && O.useDelayedTextureLoading ? I.delayLoadState = d.a.DELAYLOADSTATE_NOTLOADED : I.loadTexture()), I;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "isBlocking", { get: function() {
+ return this._isBlocking;
+ }, set: function(e) {
+ this._isBlocking = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "rotationY", { get: function() {
+ return this._rotationY;
+ }, set: function(e) {
+ this._rotationY = e, this.setReflectionTextureMatrix(c.a.RotationY(this._rotationY));
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "boundingBoxSize", { get: function() {
+ return this._boundingBoxSize;
+ }, set: function(e) {
+ if (!this._boundingBoxSize || !this._boundingBoxSize.equals(e)) {
+ this._boundingBoxSize = e;
+ var n = this.getScene();
+ n && n.markAllMaterialsAsDirty(d.a.MATERIAL_TextureDirtyFlag);
+ }
+ }, enumerable: !1, configurable: !0 }), t.prototype.getClassName = function() {
+ return "HDRCubeTexture";
+ }, t.prototype.loadTexture = function() {
+ var e = this, n = this._getEngine();
+ if (this._getEngine().webGLVersion >= 2 && this._prefilterOnLoad) {
+ var i = this._onLoad, o = new Xf(n);
+ this._onLoad = function() {
+ o.prefilter(e, i);
+ };
+ }
+ this._texture = n.createRawCubeTextureFromUrl(this.url, this.getScene(), this._size, d.a.TEXTUREFORMAT_RGB, n.getCaps().textureFloat ? d.a.TEXTURETYPE_FLOAT : d.a.TEXTURETYPE_UNSIGNED_INT, this._noMipmap, function(a) {
+ e.lodGenerationOffset = 0, e.lodGenerationScale = 0.8;
+ var s = jf.GetCubeMapTextureData(a, e._size);
+ if (e._generateHarmonics) {
+ var p = Ts.ConvertCubeMapToSphericalPolynomial(s);
+ e.sphericalPolynomial = p;
+ }
+ for (var m = [], S = null, O = 0; O < 6; O++) {
+ if (!n.getCaps().textureFloat) {
+ var I = new ArrayBuffer(e._size * e._size * 3);
+ S = new Uint8Array(I);
+ }
+ var G = s[t._facesMapping[O]];
+ if (e.gammaSpace || S) {
+ for (var k = 0; k < e._size * e._size; k++)
+ if (e.gammaSpace && (G[3 * k + 0] = Math.pow(G[3 * k + 0], Xt.b), G[3 * k + 1] = Math.pow(G[3 * k + 1], Xt.b), G[3 * k + 2] = Math.pow(G[3 * k + 2], Xt.b)), S) {
+ var K = Math.max(255 * G[3 * k + 0], 0), re = Math.max(255 * G[3 * k + 1], 0), se = Math.max(255 * G[3 * k + 2], 0), ue = Math.max(Math.max(K, re), se);
+ if (ue > 255) {
+ var he = 255 / ue;
+ K *= he, re *= he, se *= he;
+ }
+ S[3 * k + 0] = K, S[3 * k + 1] = re, S[3 * k + 2] = se;
+ }
+ }
+ S ? m.push(S) : m.push(G);
+ }
+ return m;
+ }, null, this._onLoad, this._onError);
+ }, t.prototype.clone = function() {
+ var e = new t(this.url, this.getScene() || this._getEngine(), this._size, this._noMipmap, this._generateHarmonics, this.gammaSpace);
+ return e.level = this.level, e.wrapU = this.wrapU, e.wrapV = this.wrapV, e.coordinatesIndex = this.coordinatesIndex, e.coordinatesMode = this.coordinatesMode, e;
+ }, t.prototype.delayLoad = function() {
+ this.delayLoadState === d.a.DELAYLOADSTATE_NOTLOADED && (this.delayLoadState = d.a.DELAYLOADSTATE_LOADED, this._texture = this._getFromCache(this.url, this._noMipmap), this._texture || this.loadTexture());
+ }, t.prototype.getReflectionTextureMatrix = function() {
+ return this._textureMatrix;
+ }, t.prototype.setReflectionTextureMatrix = function(e) {
+ var n, i = this;
+ this._textureMatrix = e, e.updateFlag !== this._textureMatrix.updateFlag && e.isIdentity() !== this._textureMatrix.isIdentity() && ((n = this.getScene()) === null || n === void 0 || n.markAllMaterialsAsDirty(d.a.MATERIAL_TextureDirtyFlag, function(o) {
+ return o.getActiveTextures().indexOf(i) !== -1;
+ }));
+ }, t.Parse = function(e, n, i) {
+ var o = null;
+ return e.name && !e.isRenderTarget && ((o = new t(i + e.name, n, e.size, e.noMipmap, e.generateHarmonics, e.useInGammaSpace)).name = e.name, o.hasAlpha = e.hasAlpha, o.level = e.level, o.coordinatesMode = e.coordinatesMode, o.isBlocking = e.isBlocking), o && (e.boundingBoxPosition && (o.boundingBoxPosition = c.e.FromArray(e.boundingBoxPosition)), e.boundingBoxSize && (o.boundingBoxSize = c.e.FromArray(e.boundingBoxSize)), e.rotationY && (o.rotationY = e.rotationY)), o;
+ }, t.prototype.serialize = function() {
+ if (!this.name)
+ return null;
+ var e = {};
+ return e.name = this.name, e.hasAlpha = this.hasAlpha, e.isCube = !0, e.level = this.level, e.size = this._size, e.coordinatesMode = this.coordinatesMode, e.useInGammaSpace = this.gammaSpace, e.generateHarmonics = this._generateHarmonics, e.customType = "BABYLON.HDRCubeTexture", e.noMipmap = this._noMipmap, e.isBlocking = this._isBlocking, e.rotationY = this._rotationY, e;
+ }, t._facesMapping = ["right", "left", "up", "down", "front", "back"], t;
+ }(oi.a);
+ x.a.RegisteredTypes["BABYLON.HDRCubeTexture"] = Vs;
+ var Yf = function() {
+ function r(t, e, n) {
+ e === void 0 && (e = 0), n === void 0 && (n = null), this.name = t, this.animations = new Array(), this._positions = null, this._normals = null, this._tangents = null, this._uvs = null, this._uniqueId = 0, this.onInfluenceChanged = new P.c(), this._onDataLayoutChanged = new P.c(), this._animationPropertiesOverride = null, this._scene = n || te.a.LastCreatedScene, this.influence = e, this._scene && (this._uniqueId = this._scene.getUniqueId());
+ }
+ return Object.defineProperty(r.prototype, "influence", { get: function() {
+ return this._influence;
+ }, set: function(t) {
+ if (this._influence !== t) {
+ var e = this._influence;
+ this._influence = t, this.onInfluenceChanged.hasObservers() && this.onInfluenceChanged.notifyObservers(e === 0 || t === 0);
+ }
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "animationPropertiesOverride", { get: function() {
+ return !this._animationPropertiesOverride && this._scene ? this._scene.animationPropertiesOverride : this._animationPropertiesOverride;
+ }, set: function(t) {
+ this._animationPropertiesOverride = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "uniqueId", { get: function() {
+ return this._uniqueId;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "hasPositions", { get: function() {
+ return !!this._positions;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "hasNormals", { get: function() {
+ return !!this._normals;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "hasTangents", { get: function() {
+ return !!this._tangents;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "hasUVs", { get: function() {
+ return !!this._uvs;
+ }, enumerable: !1, configurable: !0 }), r.prototype.setPositions = function(t) {
+ var e = this.hasPositions;
+ this._positions = t, e !== this.hasPositions && this._onDataLayoutChanged.notifyObservers(void 0);
+ }, r.prototype.getPositions = function() {
+ return this._positions;
+ }, r.prototype.setNormals = function(t) {
+ var e = this.hasNormals;
+ this._normals = t, e !== this.hasNormals && this._onDataLayoutChanged.notifyObservers(void 0);
+ }, r.prototype.getNormals = function() {
+ return this._normals;
+ }, r.prototype.setTangents = function(t) {
+ var e = this.hasTangents;
+ this._tangents = t, e !== this.hasTangents && this._onDataLayoutChanged.notifyObservers(void 0);
+ }, r.prototype.getTangents = function() {
+ return this._tangents;
+ }, r.prototype.setUVs = function(t) {
+ var e = this.hasUVs;
+ this._uvs = t, e !== this.hasUVs && this._onDataLayoutChanged.notifyObservers(void 0);
+ }, r.prototype.getUVs = function() {
+ return this._uvs;
+ }, r.prototype.clone = function() {
+ var t = this, e = w.a.Clone(function() {
+ return new r(t.name, t.influence, t._scene);
+ }, this);
+ return e._positions = this._positions, e._normals = this._normals, e._tangents = this._tangents, e._uvs = this._uvs, e;
+ }, r.prototype.serialize = function() {
+ var t = {};
+ return t.name = this.name, t.influence = this.influence, t.positions = Array.prototype.slice.call(this.getPositions()), this.id != null && (t.id = this.id), this.hasNormals && (t.normals = Array.prototype.slice.call(this.getNormals())), this.hasTangents && (t.tangents = Array.prototype.slice.call(this.getTangents())), this.hasUVs && (t.uvs = Array.prototype.slice.call(this.getUVs())), w.a.AppendSerializedAnimations(this, t), t;
+ }, r.prototype.getClassName = function() {
+ return "MorphTarget";
+ }, r.Parse = function(t) {
+ var e = new r(t.name, t.influence);
+ if (e.setPositions(t.positions), t.id != null && (e.id = t.id), t.normals && e.setNormals(t.normals), t.tangents && e.setTangents(t.tangents), t.uvs && e.setUVs(t.uvs), t.animations)
+ for (var n = 0; n < t.animations.length; n++) {
+ var i = t.animations[n], o = x.a.GetClass("BABYLON.Animation");
+ o && e.animations.push(o.Parse(i));
+ }
+ return e;
+ }, r.FromMesh = function(t, e, n) {
+ e || (e = t.name);
+ var i = new r(e, n, t.getScene());
+ return i.setPositions(t.getVerticesData(De.b.PositionKind)), t.isVerticesDataPresent(De.b.NormalKind) && i.setNormals(t.getVerticesData(De.b.NormalKind)), t.isVerticesDataPresent(De.b.TangentKind) && i.setTangents(t.getVerticesData(De.b.TangentKind)), t.isVerticesDataPresent(De.b.UVKind) && i.setUVs(t.getVerticesData(De.b.UVKind)), i;
+ }, Object(u.c)([Object(w.c)()], r.prototype, "id", void 0), r;
+ }(), ks = function() {
+ function r(t) {
+ t === void 0 && (t = null), this._targets = new Array(), this._targetInfluenceChangedObservers = new Array(), this._targetDataLayoutChangedObservers = new Array(), this._activeTargets = new Ui.a(16), this._supportsNormals = !1, this._supportsTangents = !1, this._supportsUVs = !1, this._vertexCount = 0, this._uniqueId = 0, this._tempInfluences = new Array(), this.enableNormalMorphing = !0, this.enableTangentMorphing = !0, this.enableUVMorphing = !0, t || (t = te.a.LastCreatedScene), this._scene = t, this._scene && (this._scene.morphTargetManagers.push(this), this._uniqueId = this._scene.getUniqueId());
+ }
+ return Object.defineProperty(r.prototype, "uniqueId", { get: function() {
+ return this._uniqueId;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "vertexCount", { get: function() {
+ return this._vertexCount;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "supportsNormals", { get: function() {
+ return this._supportsNormals && this.enableNormalMorphing;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "supportsTangents", { get: function() {
+ return this._supportsTangents && this.enableTangentMorphing;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "supportsUVs", { get: function() {
+ return this._supportsUVs && this.enableUVMorphing;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "numTargets", { get: function() {
+ return this._targets.length;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "numInfluencers", { get: function() {
+ return this._activeTargets.length;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "influences", { get: function() {
+ return this._influences;
+ }, enumerable: !1, configurable: !0 }), r.prototype.getActiveTarget = function(t) {
+ return this._activeTargets.data[t];
+ }, r.prototype.getTarget = function(t) {
+ return this._targets[t];
+ }, r.prototype.addTarget = function(t) {
+ var e = this;
+ this._targets.push(t), this._targetInfluenceChangedObservers.push(t.onInfluenceChanged.add(function(n) {
+ e._syncActiveTargets(n);
+ })), this._targetDataLayoutChangedObservers.push(t._onDataLayoutChanged.add(function() {
+ e._syncActiveTargets(!0);
+ })), this._syncActiveTargets(!0);
+ }, r.prototype.removeTarget = function(t) {
+ var e = this._targets.indexOf(t);
+ e >= 0 && (this._targets.splice(e, 1), t.onInfluenceChanged.remove(this._targetInfluenceChangedObservers.splice(e, 1)[0]), t._onDataLayoutChanged.remove(this._targetDataLayoutChangedObservers.splice(e, 1)[0]), this._syncActiveTargets(!0));
+ }, r.prototype.clone = function() {
+ for (var t = new r(this._scene), e = 0, n = this._targets; e < n.length; e++) {
+ var i = n[e];
+ t.addTarget(i.clone());
+ }
+ return t.enableNormalMorphing = this.enableNormalMorphing, t.enableTangentMorphing = this.enableTangentMorphing, t.enableUVMorphing = this.enableUVMorphing, t;
+ }, r.prototype.serialize = function() {
+ var t = {};
+ t.id = this.uniqueId, t.targets = [];
+ for (var e = 0, n = this._targets; e < n.length; e++) {
+ var i = n[e];
+ t.targets.push(i.serialize());
+ }
+ return t;
+ }, r.prototype._syncActiveTargets = function(t) {
+ var e = 0;
+ this._activeTargets.reset(), this._supportsNormals = !0, this._supportsTangents = !0, this._supportsUVs = !0, this._vertexCount = 0;
+ for (var n = 0, i = this._targets; n < i.length; n++) {
+ var o = i[n];
+ if (o.influence !== 0) {
+ this._activeTargets.push(o), this._tempInfluences[e++] = o.influence, this._supportsNormals = this._supportsNormals && o.hasNormals, this._supportsTangents = this._supportsTangents && o.hasTangents, this._supportsUVs = this._supportsUVs && o.hasUVs;
+ var a = o.getPositions();
+ if (a) {
+ var s = a.length / 3;
+ if (this._vertexCount === 0)
+ this._vertexCount = s;
+ else if (this._vertexCount !== s)
+ return void h.a.Error("Incompatible target. Targets must all have the same vertices count.");
+ }
+ }
+ }
+ this._influences && this._influences.length === e || (this._influences = new Float32Array(e));
+ for (var p = 0; p < e; p++)
+ this._influences[p] = this._tempInfluences[p];
+ t && this.synchronize();
+ }, r.prototype.synchronize = function() {
+ if (this._scene)
+ for (var t = 0, e = this._scene.meshes; t < e.length; t++) {
+ var n = e[t];
+ n.morphTargetManager === this && n._syncGeometryWithMorphTargetManager();
+ }
+ }, r.Parse = function(t, e) {
+ var n = new r(e);
+ n._uniqueId = t.id;
+ for (var i = 0, o = t.targets; i < o.length; i++) {
+ var a = o[i];
+ n.addTarget(Yf.Parse(a));
+ }
+ return n;
+ }, r;
+ }(), Ct = l(32), un = l(50), Lo = function() {
+ function r(t, e) {
+ if (e === void 0 && (e = r.DefaultPluginFactory()), this._physicsPlugin = e, this._impostors = [], this._joints = [], this._subTimeStep = 0, !this._physicsPlugin.isSupported())
+ throw new Error("Physics Engine " + this._physicsPlugin.name + " cannot be found. Please make sure it is included.");
+ t = t || new c.e(0, -9.807, 0), this.setGravity(t), this.setTimeStep();
+ }
+ return r.DefaultPluginFactory = function() {
+ throw Nn.a.WarnImport("CannonJSPlugin");
+ }, r.prototype.setGravity = function(t) {
+ this.gravity = t, this._physicsPlugin.setGravity(this.gravity);
+ }, r.prototype.setTimeStep = function(t) {
+ t === void 0 && (t = 1 / 60), this._physicsPlugin.setTimeStep(t);
+ }, r.prototype.getTimeStep = function() {
+ return this._physicsPlugin.getTimeStep();
+ }, r.prototype.setSubTimeStep = function(t) {
+ t === void 0 && (t = 0), this._subTimeStep = t;
+ }, r.prototype.getSubTimeStep = function() {
+ return this._subTimeStep;
+ }, r.prototype.dispose = function() {
+ this._impostors.forEach(function(t) {
+ t.dispose();
+ }), this._physicsPlugin.dispose();
+ }, r.prototype.getPhysicsPluginName = function() {
+ return this._physicsPlugin.name;
+ }, r.prototype.addImpostor = function(t) {
+ t.uniqueId = this._impostors.push(t), t.parent || this._physicsPlugin.generatePhysicsBody(t);
+ }, r.prototype.removeImpostor = function(t) {
+ var e = this._impostors.indexOf(t);
+ e > -1 && this._impostors.splice(e, 1).length && this.getPhysicsPlugin().removePhysicsBody(t);
+ }, r.prototype.addJoint = function(t, e, n) {
+ var i = { mainImpostor: t, connectedImpostor: e, joint: n };
+ n.physicsPlugin = this._physicsPlugin, this._joints.push(i), this._physicsPlugin.generateJoint(i);
+ }, r.prototype.removeJoint = function(t, e, n) {
+ var i = this._joints.filter(function(o) {
+ return o.connectedImpostor === e && o.joint === n && o.mainImpostor === t;
+ });
+ i.length && this._physicsPlugin.removeJoint(i[0]);
+ }, r.prototype._step = function(t) {
+ var e = this;
+ this._impostors.forEach(function(n) {
+ n.isBodyInitRequired() && e._physicsPlugin.generatePhysicsBody(n);
+ }), t > 0.1 ? t = 0.1 : t <= 0 && (t = 1 / 60), this._physicsPlugin.executeStep(t, this._impostors);
+ }, r.prototype.getPhysicsPlugin = function() {
+ return this._physicsPlugin;
+ }, r.prototype.getImpostors = function() {
+ return this._impostors;
+ }, r.prototype.getImpostorForPhysicsObject = function(t) {
+ for (var e = 0; e < this._impostors.length; ++e)
+ if (this._impostors[e].object === t)
+ return this._impostors[e];
+ return null;
+ }, r.prototype.getImpostorWithPhysicsBody = function(t) {
+ for (var e = 0; e < this._impostors.length; ++e)
+ if (this._impostors[e].physicsBody === t)
+ return this._impostors[e];
+ return null;
+ }, r.prototype.raycast = function(t, e) {
+ return this._physicsPlugin.raycast(t, e);
+ }, r.Epsilon = 1e-3, r;
+ }(), Ql = function() {
+ function r() {
+ this._hasHit = !1, this._hitDistance = 0, this._hitNormalWorld = c.e.Zero(), this._hitPointWorld = c.e.Zero(), this._rayFromWorld = c.e.Zero(), this._rayToWorld = c.e.Zero();
+ }
+ return Object.defineProperty(r.prototype, "hasHit", { get: function() {
+ return this._hasHit;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "hitDistance", { get: function() {
+ return this._hitDistance;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "hitNormalWorld", { get: function() {
+ return this._hitNormalWorld;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "hitPointWorld", { get: function() {
+ return this._hitPointWorld;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "rayFromWorld", { get: function() {
+ return this._rayFromWorld;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "rayToWorld", { get: function() {
+ return this._rayToWorld;
+ }, enumerable: !1, configurable: !0 }), r.prototype.setHitData = function(t, e) {
+ this._hasHit = !0, this._hitNormalWorld = new c.e(t.x, t.y, t.z), this._hitPointWorld = new c.e(e.x, e.y, e.z);
+ }, r.prototype.setHitDistance = function(t) {
+ this._hitDistance = t;
+ }, r.prototype.calculateHitDistance = function() {
+ this._hitDistance = c.e.Distance(this._rayFromWorld, this._hitPointWorld);
+ }, r.prototype.reset = function(t, e) {
+ t === void 0 && (t = c.e.Zero()), e === void 0 && (e = c.e.Zero()), this._rayFromWorld = t, this._rayToWorld = e, this._hasHit = !1, this._hitDistance = 0, this._hitNormalWorld = c.e.Zero(), this._hitPointWorld = c.e.Zero();
+ }, r;
+ }(), ql = function() {
+ function r(t, e, n) {
+ t === void 0 && (t = !0), e === void 0 && (e = 10), n === void 0 && (n = CANNON), this._useDeltaForWorldStep = t, this.name = "CannonJSPlugin", this._physicsMaterials = new Array(), this._fixedTimeStep = 1 / 60, this._physicsBodysToRemoveAfterStep = new Array(), this._firstFrame = !0, this._minus90X = new c.b(-0.7071067811865475, 0, 0, 0.7071067811865475), this._plus90X = new c.b(0.7071067811865475, 0, 0, 0.7071067811865475), this._tmpPosition = c.e.Zero(), this._tmpDeltaPosition = c.e.Zero(), this._tmpUnityRotation = new c.b(), this.BJSCANNON = n, this.isSupported() ? (this._extendNamespace(), this.world = new this.BJSCANNON.World(), this.world.broadphase = new this.BJSCANNON.NaiveBroadphase(), this.world.solver.iterations = e, this._cannonRaycastResult = new this.BJSCANNON.RaycastResult(), this._raycastResult = new Ql()) : h.a.Error("CannonJS is not available. Please make sure you included the js file.");
+ }
+ return r.prototype.setGravity = function(t) {
+ var e = t;
+ this.world.gravity.set(e.x, e.y, e.z);
+ }, r.prototype.setTimeStep = function(t) {
+ this._fixedTimeStep = t;
+ }, r.prototype.getTimeStep = function() {
+ return this._fixedTimeStep;
+ }, r.prototype.executeStep = function(t, e) {
+ if (this._firstFrame) {
+ this._firstFrame = !1;
+ for (var n = 0, i = e; n < i.length; n++) {
+ var o = i[n];
+ o.type != Ct.a.HeightmapImpostor && o.type !== Ct.a.PlaneImpostor && o.beforeStep();
+ }
+ }
+ this.world.step(this._useDeltaForWorldStep ? t : this._fixedTimeStep), this._removeMarkedPhysicsBodiesFromWorld();
+ }, r.prototype._removeMarkedPhysicsBodiesFromWorld = function() {
+ var t = this;
+ this._physicsBodysToRemoveAfterStep.length > 0 && (this._physicsBodysToRemoveAfterStep.forEach(function(e) {
+ t.world.remove(e);
+ }), this._physicsBodysToRemoveAfterStep = []);
+ }, r.prototype.applyImpulse = function(t, e, n) {
+ var i = new this.BJSCANNON.Vec3(n.x, n.y, n.z), o = new this.BJSCANNON.Vec3(e.x, e.y, e.z);
+ t.physicsBody.applyImpulse(o, i);
+ }, r.prototype.applyForce = function(t, e, n) {
+ var i = new this.BJSCANNON.Vec3(n.x, n.y, n.z), o = new this.BJSCANNON.Vec3(e.x, e.y, e.z);
+ t.physicsBody.applyForce(o, i);
+ }, r.prototype.generatePhysicsBody = function(t) {
+ if (this._removeMarkedPhysicsBodiesFromWorld(), t.parent)
+ t.physicsBody && (this.removePhysicsBody(t), t.forceUpdate());
+ else {
+ if (t.isBodyInitRequired()) {
+ var e = this._createShape(t), n = t.physicsBody;
+ n && this.removePhysicsBody(t);
+ var i = this._addMaterial("mat-" + t.uniqueId, t.getParam("friction"), t.getParam("restitution")), o = { mass: t.getParam("mass"), material: i }, a = t.getParam("nativeOptions");
+ for (var s in a)
+ a.hasOwnProperty(s) && (o[s] = a[s]);
+ t.physicsBody = new this.BJSCANNON.Body(o), t.physicsBody.addEventListener("collide", t.onCollide), this.world.addEventListener("preStep", t.beforeStep), this.world.addEventListener("postStep", t.afterStep), t.physicsBody.addShape(e), this.world.add(t.physicsBody), n && ["force", "torque", "velocity", "angularVelocity"].forEach(function(p) {
+ var m = n[p];
+ t.physicsBody[p].set(m.x, m.y, m.z);
+ }), this._processChildMeshes(t);
+ }
+ this._updatePhysicsBodyTransformation(t);
+ }
+ }, r.prototype._processChildMeshes = function(t) {
+ var e = this, n = t.object.getChildMeshes ? t.object.getChildMeshes(!0) : [], i = t.object.rotationQuaternion;
+ if (n.length) {
+ var o = function(a) {
+ if (i && a.rotationQuaternion) {
+ var s = a.getPhysicsImpostor();
+ if (s && s.parent !== t) {
+ var p = a.getAbsolutePosition().subtract(a.parent.getAbsolutePosition()), m = a.rotationQuaternion;
+ s.physicsBody && (e.removePhysicsBody(s), s.physicsBody = null), s.parent = t, s.resetUpdateFlags(), t.physicsBody.addShape(e._createShape(s), new e.BJSCANNON.Vec3(p.x, p.y, p.z), new e.BJSCANNON.Quaternion(m.x, m.y, m.z, m.w)), t.physicsBody.mass += s.getParam("mass");
+ }
+ i.multiplyInPlace(a.rotationQuaternion), a.getChildMeshes(!0).filter(function(S) {
+ return !!S.physicsImpostor;
+ }).forEach(o);
+ }
+ };
+ n.filter(function(a) {
+ return !!a.physicsImpostor;
+ }).forEach(o);
+ }
+ }, r.prototype.removePhysicsBody = function(t) {
+ t.physicsBody.removeEventListener("collide", t.onCollide), this.world.removeEventListener("preStep", t.beforeStep), this.world.removeEventListener("postStep", t.afterStep), this._physicsBodysToRemoveAfterStep.indexOf(t.physicsBody) === -1 && this._physicsBodysToRemoveAfterStep.push(t.physicsBody);
+ }, r.prototype.generateJoint = function(t) {
+ var e = t.mainImpostor.physicsBody, n = t.connectedImpostor.physicsBody;
+ if (e && n) {
+ var i, o = t.joint.jointData, a = { pivotA: o.mainPivot ? new this.BJSCANNON.Vec3().set(o.mainPivot.x, o.mainPivot.y, o.mainPivot.z) : null, pivotB: o.connectedPivot ? new this.BJSCANNON.Vec3().set(o.connectedPivot.x, o.connectedPivot.y, o.connectedPivot.z) : null, axisA: o.mainAxis ? new this.BJSCANNON.Vec3().set(o.mainAxis.x, o.mainAxis.y, o.mainAxis.z) : null, axisB: o.connectedAxis ? new this.BJSCANNON.Vec3().set(o.connectedAxis.x, o.connectedAxis.y, o.connectedAxis.z) : null, maxForce: o.nativeParams.maxForce, collideConnected: !!o.collision };
+ switch (t.joint.type) {
+ case un.e.HingeJoint:
+ case un.e.Hinge2Joint:
+ i = new this.BJSCANNON.HingeConstraint(e, n, a);
+ break;
+ case un.e.DistanceJoint:
+ i = new this.BJSCANNON.DistanceConstraint(e, n, o.maxDistance || 2);
+ break;
+ case un.e.SpringJoint:
+ var s = o;
+ i = new this.BJSCANNON.Spring(e, n, { restLength: s.length, stiffness: s.stiffness, damping: s.damping, localAnchorA: a.pivotA, localAnchorB: a.pivotB });
+ break;
+ case un.e.LockJoint:
+ i = new this.BJSCANNON.LockConstraint(e, n, a);
+ break;
+ case un.e.PointToPointJoint:
+ case un.e.BallAndSocketJoint:
+ default:
+ i = new this.BJSCANNON.PointToPointConstraint(e, a.pivotA, n, a.pivotB, a.maxForce);
+ }
+ i.collideConnected = !!o.collision, t.joint.physicsJoint = i, t.joint.type !== un.e.SpringJoint ? this.world.addConstraint(i) : (t.joint.jointData.forceApplicationCallback = t.joint.jointData.forceApplicationCallback || function() {
+ i.applyForce();
+ }, t.mainImpostor.registerAfterPhysicsStep(t.joint.jointData.forceApplicationCallback));
+ }
+ }, r.prototype.removeJoint = function(t) {
+ t.joint.type !== un.e.SpringJoint ? this.world.removeConstraint(t.joint.physicsJoint) : t.mainImpostor.unregisterAfterPhysicsStep(t.joint.jointData.forceApplicationCallback);
+ }, r.prototype._addMaterial = function(t, e, n) {
+ var i, o;
+ for (i = 0; i < this._physicsMaterials.length; i++)
+ if ((o = this._physicsMaterials[i]).friction === e && o.restitution === n)
+ return o;
+ var a = new this.BJSCANNON.Material(t);
+ return a.friction = e, a.restitution = n, this._physicsMaterials.push(a), a;
+ }, r.prototype._checkWithEpsilon = function(t) {
+ return t < Lo.Epsilon ? Lo.Epsilon : t;
+ }, r.prototype._createShape = function(t) {
+ var e, n = t.object, i = t.getObjectExtendSize();
+ switch (t.type) {
+ case Ct.a.SphereImpostor:
+ var o = i.x, a = i.y, s = i.z;
+ e = new this.BJSCANNON.Sphere(Math.max(this._checkWithEpsilon(o), this._checkWithEpsilon(a), this._checkWithEpsilon(s)) / 2);
+ break;
+ case Ct.a.CylinderImpostor:
+ var p = t.getParam("nativeOptions");
+ p || (p = {});
+ var m = p.radiusTop !== void 0 ? p.radiusTop : this._checkWithEpsilon(i.x) / 2, S = p.radiusBottom !== void 0 ? p.radiusBottom : this._checkWithEpsilon(i.x) / 2, O = p.height !== void 0 ? p.height : this._checkWithEpsilon(i.y), I = p.numSegments !== void 0 ? p.numSegments : 16;
+ e = new this.BJSCANNON.Cylinder(m, S, O, I);
+ var G = new this.BJSCANNON.Quaternion();
+ G.setFromAxisAngle(new this.BJSCANNON.Vec3(1, 0, 0), -Math.PI / 2);
+ var k = new this.BJSCANNON.Vec3(0, 0, 0);
+ e.transformAllPoints(k, G);
+ break;
+ case Ct.a.BoxImpostor:
+ var K = i.scale(0.5);
+ e = new this.BJSCANNON.Box(new this.BJSCANNON.Vec3(this._checkWithEpsilon(K.x), this._checkWithEpsilon(K.y), this._checkWithEpsilon(K.z)));
+ break;
+ case Ct.a.PlaneImpostor:
+ h.a.Warn("Attention, PlaneImposter might not behave as you expect. Consider using BoxImposter instead"), e = new this.BJSCANNON.Plane();
+ break;
+ case Ct.a.MeshImpostor:
+ var re = n.getVerticesData ? n.getVerticesData(De.b.PositionKind) : [], se = n.getIndices ? n.getIndices() : [];
+ if (!re)
+ return;
+ var ue = n.position.clone(), he = n.rotation && n.rotation.clone(), pe = n.rotationQuaternion && n.rotationQuaternion.clone();
+ n.position.copyFromFloats(0, 0, 0), n.rotation && n.rotation.copyFromFloats(0, 0, 0), n.rotationQuaternion && n.rotationQuaternion.copyFrom(t.getParentsRotation()), n.rotationQuaternion && n.parent && n.rotationQuaternion.conjugateInPlace();
+ var ve, Ee = n.computeWorldMatrix(!0), Ae = new Array();
+ for (ve = 0; ve < re.length; ve += 3)
+ c.e.TransformCoordinates(c.e.FromArray(re, ve), Ee).toArray(Ae, ve);
+ h.a.Warn("MeshImpostor only collides against spheres."), e = new this.BJSCANNON.Trimesh(Ae, se), n.position.copyFrom(ue), he && n.rotation && n.rotation.copyFrom(he), pe && n.rotationQuaternion && n.rotationQuaternion.copyFrom(pe);
+ break;
+ case Ct.a.HeightmapImpostor:
+ var Ie = n.position.clone(), xe = n.rotation && n.rotation.clone(), Pe = n.rotationQuaternion && n.rotationQuaternion.clone();
+ n.position.copyFromFloats(0, 0, 0), n.rotation && n.rotation.copyFromFloats(0, 0, 0), n.rotationQuaternion && n.rotationQuaternion.copyFrom(t.getParentsRotation()), n.rotationQuaternion && n.parent && n.rotationQuaternion.conjugateInPlace(), n.rotationQuaternion && n.rotationQuaternion.multiplyInPlace(this._minus90X), e = this._createHeightmap(n), n.position.copyFrom(Ie), xe && n.rotation && n.rotation.copyFrom(xe), Pe && n.rotationQuaternion && n.rotationQuaternion.copyFrom(Pe), n.computeWorldMatrix(!0);
+ break;
+ case Ct.a.ParticleImpostor:
+ e = new this.BJSCANNON.Particle();
+ break;
+ case Ct.a.NoImpostor:
+ e = new this.BJSCANNON.Box(new this.BJSCANNON.Vec3(0, 0, 0));
+ }
+ return e;
+ }, r.prototype._createHeightmap = function(t, e) {
+ var n, i = t.getVerticesData(De.b.PositionKind), o = t.computeWorldMatrix(!0), a = new Array();
+ for (n = 0; n < i.length; n += 3)
+ c.e.TransformCoordinates(c.e.FromArray(i, n), o).toArray(a, n);
+ i = a;
+ for (var s = new Array(), p = e || ~~(Math.sqrt(i.length / 3) - 1), m = t.getBoundingInfo(), S = Math.min(m.boundingBox.extendSizeWorld.x, m.boundingBox.extendSizeWorld.y), O = m.boundingBox.extendSizeWorld.z, I = 2 * S / p, G = 0; G < i.length; G += 3) {
+ var k = Math.round(i[G + 0] / I + p / 2), K = Math.round(-1 * (i[G + 1] / I - p / 2)), re = -i[G + 2] + O;
+ s[k] || (s[k] = []), s[k][K] || (s[k][K] = re), s[k][K] = Math.max(re, s[k][K]);
+ }
+ for (k = 0; k <= p; ++k) {
+ if (!s[k]) {
+ for (var se = 1; !s[(k + se) % p]; )
+ se++;
+ s[k] = s[(k + se) % p].slice();
+ }
+ for (K = 0; K <= p; ++K)
+ if (!s[k][K]) {
+ var ue;
+ for (se = 1; ue === void 0; )
+ ue = s[k][(K + se++) % p];
+ s[k][K] = ue;
+ }
+ }
+ var he = new this.BJSCANNON.Heightfield(s, { elementSize: I });
+ return he.minY = O, he;
+ }, r.prototype._updatePhysicsBodyTransformation = function(t) {
+ var e = t.object;
+ if (e.computeWorldMatrix && e.computeWorldMatrix(!0), e.getBoundingInfo()) {
+ var n = t.getObjectCenter();
+ this._tmpDeltaPosition.copyFrom(e.getAbsolutePivotPoint().subtract(n)), this._tmpDeltaPosition.divideInPlace(t.object.scaling), this._tmpPosition.copyFrom(n);
+ var i = e.rotationQuaternion;
+ if (i) {
+ if (t.type !== Ct.a.PlaneImpostor && t.type !== Ct.a.HeightmapImpostor || (i = i.multiply(this._minus90X), t.setDeltaRotation(this._plus90X)), t.type === Ct.a.HeightmapImpostor) {
+ var o = e, a = o.getBoundingInfo(), s = o.rotationQuaternion;
+ o.rotationQuaternion = this._tmpUnityRotation, o.computeWorldMatrix(!0);
+ var p = n.clone(), m = o.getPivotMatrix();
+ m = m ? m.clone() : c.a.Identity();
+ var S = c.a.Translation(a.boundingBox.extendSizeWorld.x, 0, -a.boundingBox.extendSizeWorld.z);
+ o.setPreTransformMatrix(S), o.computeWorldMatrix(!0);
+ var O = a.boundingBox.centerWorld.subtract(n).subtract(o.position).negate();
+ this._tmpPosition.copyFromFloats(O.x, O.y - a.boundingBox.extendSizeWorld.y, O.z), this._tmpDeltaPosition.copyFrom(a.boundingBox.centerWorld.subtract(p)), this._tmpDeltaPosition.y += a.boundingBox.extendSizeWorld.y, o.rotationQuaternion = s, o.setPreTransformMatrix(m), o.computeWorldMatrix(!0);
+ } else
+ t.type === Ct.a.MeshImpostor && this._tmpDeltaPosition.copyFromFloats(0, 0, 0);
+ t.setDeltaPosition(this._tmpDeltaPosition), t.physicsBody.position.set(this._tmpPosition.x, this._tmpPosition.y, this._tmpPosition.z), t.physicsBody.quaternion.set(i.x, i.y, i.z, i.w);
+ }
+ }
+ }, r.prototype.setTransformationFromPhysicsBody = function(t) {
+ if (t.object.position.set(t.physicsBody.position.x, t.physicsBody.position.y, t.physicsBody.position.z), t.object.rotationQuaternion) {
+ var e = t.physicsBody.quaternion;
+ t.object.rotationQuaternion.set(e.x, e.y, e.z, e.w);
+ }
+ }, r.prototype.setPhysicsBodyTransformation = function(t, e, n) {
+ t.physicsBody.position.set(e.x, e.y, e.z), t.physicsBody.quaternion.set(n.x, n.y, n.z, n.w);
+ }, r.prototype.isSupported = function() {
+ return this.BJSCANNON !== void 0;
+ }, r.prototype.setLinearVelocity = function(t, e) {
+ t.physicsBody.velocity.set(e.x, e.y, e.z);
+ }, r.prototype.setAngularVelocity = function(t, e) {
+ t.physicsBody.angularVelocity.set(e.x, e.y, e.z);
+ }, r.prototype.getLinearVelocity = function(t) {
+ var e = t.physicsBody.velocity;
+ return e ? new c.e(e.x, e.y, e.z) : null;
+ }, r.prototype.getAngularVelocity = function(t) {
+ var e = t.physicsBody.angularVelocity;
+ return e ? new c.e(e.x, e.y, e.z) : null;
+ }, r.prototype.setBodyMass = function(t, e) {
+ t.physicsBody.mass = e, t.physicsBody.updateMassProperties();
+ }, r.prototype.getBodyMass = function(t) {
+ return t.physicsBody.mass;
+ }, r.prototype.getBodyFriction = function(t) {
+ return t.physicsBody.material.friction;
+ }, r.prototype.setBodyFriction = function(t, e) {
+ t.physicsBody.material.friction = e;
+ }, r.prototype.getBodyRestitution = function(t) {
+ return t.physicsBody.material.restitution;
+ }, r.prototype.setBodyRestitution = function(t, e) {
+ t.physicsBody.material.restitution = e;
+ }, r.prototype.sleepBody = function(t) {
+ t.physicsBody.sleep();
+ }, r.prototype.wakeUpBody = function(t) {
+ t.physicsBody.wakeUp();
+ }, r.prototype.updateDistanceJoint = function(t, e) {
+ t.physicsJoint.distance = e;
+ }, r.prototype.setMotor = function(t, e, n, i) {
+ i || (t.physicsJoint.enableMotor(), t.physicsJoint.setMotorSpeed(e), n && this.setLimit(t, n));
+ }, r.prototype.setLimit = function(t, e, n) {
+ t.physicsJoint.motorEquation.maxForce = e, t.physicsJoint.motorEquation.minForce = n === void 0 ? -e : n;
+ }, r.prototype.syncMeshWithImpostor = function(t, e) {
+ var n = e.physicsBody;
+ t.position.x = n.position.x, t.position.y = n.position.y, t.position.z = n.position.z, t.rotationQuaternion && (t.rotationQuaternion.x = n.quaternion.x, t.rotationQuaternion.y = n.quaternion.y, t.rotationQuaternion.z = n.quaternion.z, t.rotationQuaternion.w = n.quaternion.w);
+ }, r.prototype.getRadius = function(t) {
+ return t.physicsBody.shapes[0].boundingSphereRadius;
+ }, r.prototype.getBoxSizeToRef = function(t, e) {
+ var n = t.physicsBody.shapes[0];
+ e.x = 2 * n.halfExtents.x, e.y = 2 * n.halfExtents.y, e.z = 2 * n.halfExtents.z;
+ }, r.prototype.dispose = function() {
+ }, r.prototype._extendNamespace = function() {
+ var t = new this.BJSCANNON.Vec3(), e = this.BJSCANNON;
+ this.BJSCANNON.World.prototype.step = function(n, i, o) {
+ if (o = o || 10, (i = i || 0) === 0)
+ this.internalStep(n), this.time += n;
+ else {
+ var a = Math.floor((this.time + i) / n) - Math.floor(this.time / n);
+ a = Math.min(a, o) || 1;
+ for (var s = performance.now(), p = 0; p !== a && (this.internalStep(n), !(performance.now() - s > 1e3 * n)); p++)
+ ;
+ this.time += i;
+ for (var m = this.time % n / n, S = t, O = this.bodies, I = 0; I !== O.length; I++) {
+ var G = O[I];
+ G.type !== e.Body.STATIC && G.sleepState !== e.Body.SLEEPING ? (G.position.vsub(G.previousPosition, S), S.scale(m, S), G.position.vadd(S, G.interpolatedPosition)) : (G.interpolatedPosition.set(G.position.x, G.position.y, G.position.z), G.interpolatedQuaternion.set(G.quaternion.x, G.quaternion.y, G.quaternion.z, G.quaternion.w));
+ }
+ }
+ };
+ }, r.prototype.raycast = function(t, e) {
+ return this._cannonRaycastResult.reset(), this.world.raycastClosest(t, e, {}, this._cannonRaycastResult), this._raycastResult.reset(t, e), this._cannonRaycastResult.hasHit && (this._raycastResult.setHitData({ x: this._cannonRaycastResult.hitNormalWorld.x, y: this._cannonRaycastResult.hitNormalWorld.y, z: this._cannonRaycastResult.hitNormalWorld.z }, { x: this._cannonRaycastResult.hitPointWorld.x, y: this._cannonRaycastResult.hitPointWorld.y, z: this._cannonRaycastResult.hitPointWorld.z }), this._raycastResult.setHitDistance(this._cannonRaycastResult.distance)), this._raycastResult;
+ }, r;
+ }();
+ Lo.DefaultPluginFactory = function() {
+ return new ql();
+ };
+ var Kf = function() {
+ function r(t, e, n) {
+ t === void 0 && (t = !0), n === void 0 && (n = OIMO), this._useDeltaForWorldStep = t, this.name = "OimoJSPlugin", this._fixedTimeStep = 1 / 60, this._tmpImpostorsArray = [], this._tmpPositionVector = c.e.Zero(), this.BJSOIMO = n, this.world = new this.BJSOIMO.World({ iterations: e }), this.world.clear(), this._raycastResult = new Ql();
+ }
+ return r.prototype.setGravity = function(t) {
+ this.world.gravity.set(t.x, t.y, t.z);
+ }, r.prototype.setTimeStep = function(t) {
+ this.world.timeStep = t;
+ }, r.prototype.getTimeStep = function() {
+ return this.world.timeStep;
+ }, r.prototype.executeStep = function(t, e) {
+ var n = this;
+ e.forEach(function(s) {
+ s.beforeStep();
+ }), this.world.timeStep = this._useDeltaForWorldStep ? t : this._fixedTimeStep, this.world.step(), e.forEach(function(s) {
+ s.afterStep(), n._tmpImpostorsArray[s.uniqueId] = s;
+ });
+ for (var i = this.world.contacts; i !== null; )
+ if (!i.touching || i.body1.sleeping || i.body2.sleeping) {
+ var o = this._tmpImpostorsArray[+i.body1.name], a = this._tmpImpostorsArray[+i.body2.name];
+ o && a && (o.onCollide({ body: a.physicsBody, point: null }), a.onCollide({ body: o.physicsBody, point: null })), i = i.next;
+ } else
+ i = i.next;
+ }, r.prototype.applyImpulse = function(t, e, n) {
+ var i = t.physicsBody.mass;
+ t.physicsBody.applyImpulse(n.scale(this.world.invScale), e.scale(this.world.invScale * i));
+ }, r.prototype.applyForce = function(t, e, n) {
+ h.a.Warn("Oimo doesn't support applying force. Using impule instead."), this.applyImpulse(t, e, n);
+ }, r.prototype.generatePhysicsBody = function(t) {
+ var e = this;
+ if (t.parent)
+ t.physicsBody && (this.removePhysicsBody(t), t.forceUpdate());
+ else {
+ if (t.isBodyInitRequired()) {
+ var n = { name: t.uniqueId, config: [t.getParam("mass") || 1e-3, t.getParam("friction"), t.getParam("restitution")], size: [], type: [], pos: [], posShape: [], rot: [], rotShape: [], move: t.getParam("mass") !== 0, density: t.getParam("mass"), friction: t.getParam("friction"), restitution: t.getParam("restitution"), world: this.world }, i = [t];
+ (s = t.object).getChildMeshes && s.getChildMeshes().forEach(function(p) {
+ p.physicsImpostor && i.push(p.physicsImpostor);
+ });
+ var o = function(p) {
+ return Math.max(p, Lo.Epsilon);
+ }, a = new c.b();
+ i.forEach(function(p) {
+ if (p.object.rotationQuaternion) {
+ var m = p.object.rotationQuaternion;
+ a.copyFrom(m), p.object.rotationQuaternion.set(0, 0, 0, 1), p.object.computeWorldMatrix(!0);
+ var S = a.toEulerAngles(), O = p.getObjectExtendSize();
+ if (p === t) {
+ var I = t.getObjectCenter();
+ t.object.getAbsolutePivotPoint().subtractToRef(I, e._tmpPositionVector), e._tmpPositionVector.divideInPlace(t.object.scaling), n.pos.push(I.x), n.pos.push(I.y), n.pos.push(I.z), n.posShape.push(0, 0, 0), n.rotShape.push(0, 0, 0);
+ } else {
+ var G = p.object.position.clone();
+ n.posShape.push(G.x), n.posShape.push(G.y), n.posShape.push(G.z), n.rotShape.push(57.29577951308232 * S.x, 57.29577951308232 * S.y, 57.29577951308232 * S.z);
+ }
+ switch (p.object.rotationQuaternion.copyFrom(a), p.type) {
+ case Ct.a.ParticleImpostor:
+ h.a.Warn("No Particle support in OIMO.js. using SphereImpostor instead");
+ case Ct.a.SphereImpostor:
+ var k = O.x, K = O.y, re = O.z, se = Math.max(o(k), o(K), o(re)) / 2;
+ n.type.push("sphere"), n.size.push(se), n.size.push(se), n.size.push(se);
+ break;
+ case Ct.a.CylinderImpostor:
+ var ue = o(O.x) / 2, he = o(O.y);
+ n.type.push("cylinder"), n.size.push(ue), n.size.push(he), n.size.push(he);
+ break;
+ case Ct.a.PlaneImpostor:
+ case Ct.a.BoxImpostor:
+ default:
+ ue = o(O.x), he = o(O.y);
+ var pe = o(O.z);
+ n.type.push("box"), n.size.push(ue), n.size.push(he), n.size.push(pe);
+ }
+ p.object.rotationQuaternion = m;
+ }
+ }), t.physicsBody = this.world.add(n), t.physicsBody.resetQuaternion(a), t.physicsBody.updatePosition(0);
+ } else
+ this._tmpPositionVector.copyFromFloats(0, 0, 0);
+ var s;
+ t.setDeltaPosition(this._tmpPositionVector);
+ }
+ }, r.prototype.removePhysicsBody = function(t) {
+ this.world.removeRigidBody(t.physicsBody);
+ }, r.prototype.generateJoint = function(t) {
+ var e = t.mainImpostor.physicsBody, n = t.connectedImpostor.physicsBody;
+ if (e && n) {
+ var i, o = t.joint.jointData, a = o.nativeParams || {}, s = { body1: e, body2: n, axe1: a.axe1 || (o.mainAxis ? o.mainAxis.asArray() : null), axe2: a.axe2 || (o.connectedAxis ? o.connectedAxis.asArray() : null), pos1: a.pos1 || (o.mainPivot ? o.mainPivot.asArray() : null), pos2: a.pos2 || (o.connectedPivot ? o.connectedPivot.asArray() : null), min: a.min, max: a.max, collision: a.collision || o.collision, spring: a.spring, world: this.world };
+ switch (t.joint.type) {
+ case un.e.BallAndSocketJoint:
+ i = "jointBall";
+ break;
+ case un.e.SpringJoint:
+ h.a.Warn("OIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead");
+ var p = o;
+ s.min = p.length || s.min, s.max = Math.max(s.min, s.max);
+ case un.e.DistanceJoint:
+ i = "jointDistance", s.max = o.maxDistance;
+ break;
+ case un.e.PrismaticJoint:
+ i = "jointPrisme";
+ break;
+ case un.e.SliderJoint:
+ i = "jointSlide";
+ break;
+ case un.e.WheelJoint:
+ i = "jointWheel";
+ break;
+ case un.e.HingeJoint:
+ default:
+ i = "jointHinge";
+ }
+ s.type = i, t.joint.physicsJoint = this.world.add(s);
+ }
+ }, r.prototype.removeJoint = function(t) {
+ try {
+ this.world.removeJoint(t.joint.physicsJoint);
+ } catch (e) {
+ h.a.Warn(e);
+ }
+ }, r.prototype.isSupported = function() {
+ return this.BJSOIMO !== void 0;
+ }, r.prototype.setTransformationFromPhysicsBody = function(t) {
+ if (!t.physicsBody.sleeping) {
+ if (t.physicsBody.shapes.next) {
+ for (var e = t.physicsBody.shapes; e.next; )
+ e = e.next;
+ t.object.position.set(e.position.x, e.position.y, e.position.z);
+ } else {
+ var n = t.physicsBody.getPosition();
+ t.object.position.set(n.x, n.y, n.z);
+ }
+ if (t.object.rotationQuaternion) {
+ var i = t.physicsBody.getQuaternion();
+ t.object.rotationQuaternion.set(i.x, i.y, i.z, i.w);
+ }
+ }
+ }, r.prototype.setPhysicsBodyTransformation = function(t, e, n) {
+ var i = t.physicsBody;
+ t.physicsBody.shapes.next || (i.position.set(e.x, e.y, e.z), i.orientation.set(n.x, n.y, n.z, n.w), i.syncShapes(), i.awake());
+ }, r.prototype.setLinearVelocity = function(t, e) {
+ t.physicsBody.linearVelocity.set(e.x, e.y, e.z);
+ }, r.prototype.setAngularVelocity = function(t, e) {
+ t.physicsBody.angularVelocity.set(e.x, e.y, e.z);
+ }, r.prototype.getLinearVelocity = function(t) {
+ var e = t.physicsBody.linearVelocity;
+ return e ? new c.e(e.x, e.y, e.z) : null;
+ }, r.prototype.getAngularVelocity = function(t) {
+ var e = t.physicsBody.angularVelocity;
+ return e ? new c.e(e.x, e.y, e.z) : null;
+ }, r.prototype.setBodyMass = function(t, e) {
+ var n = e === 0;
+ t.physicsBody.shapes.density = n ? 1 : e, t.physicsBody.setupMass(n ? 2 : 1);
+ }, r.prototype.getBodyMass = function(t) {
+ return t.physicsBody.shapes.density;
+ }, r.prototype.getBodyFriction = function(t) {
+ return t.physicsBody.shapes.friction;
+ }, r.prototype.setBodyFriction = function(t, e) {
+ t.physicsBody.shapes.friction = e;
+ }, r.prototype.getBodyRestitution = function(t) {
+ return t.physicsBody.shapes.restitution;
+ }, r.prototype.setBodyRestitution = function(t, e) {
+ t.physicsBody.shapes.restitution = e;
+ }, r.prototype.sleepBody = function(t) {
+ t.physicsBody.sleep();
+ }, r.prototype.wakeUpBody = function(t) {
+ t.physicsBody.awake();
+ }, r.prototype.updateDistanceJoint = function(t, e, n) {
+ t.physicsJoint.limitMotor.upperLimit = e, n !== void 0 && (t.physicsJoint.limitMotor.lowerLimit = n);
+ }, r.prototype.setMotor = function(t, e, n, i) {
+ n !== void 0 ? h.a.Warn("OimoJS plugin currently has unexpected behavior when using setMotor with force parameter") : n = 1e6, e *= -1;
+ var o = i ? t.physicsJoint.rotationalLimitMotor2 : t.physicsJoint.rotationalLimitMotor1 || t.physicsJoint.rotationalLimitMotor || t.physicsJoint.limitMotor;
+ o && o.setMotor(e, n);
+ }, r.prototype.setLimit = function(t, e, n, i) {
+ var o = i ? t.physicsJoint.rotationalLimitMotor2 : t.physicsJoint.rotationalLimitMotor1 || t.physicsJoint.rotationalLimitMotor || t.physicsJoint.limitMotor;
+ o && o.setLimit(e, n === void 0 ? -e : n);
+ }, r.prototype.syncMeshWithImpostor = function(t, e) {
+ var n = e.physicsBody;
+ t.position.x = n.position.x, t.position.y = n.position.y, t.position.z = n.position.z, t.rotationQuaternion && (t.rotationQuaternion.x = n.orientation.x, t.rotationQuaternion.y = n.orientation.y, t.rotationQuaternion.z = n.orientation.z, t.rotationQuaternion.w = n.orientation.s);
+ }, r.prototype.getRadius = function(t) {
+ return t.physicsBody.shapes.radius;
+ }, r.prototype.getBoxSizeToRef = function(t, e) {
+ var n = t.physicsBody.shapes;
+ e.x = 2 * n.halfWidth, e.y = 2 * n.halfHeight, e.z = 2 * n.halfDepth;
+ }, r.prototype.dispose = function() {
+ this.world.clear();
+ }, r.prototype.raycast = function(t, e) {
+ return h.a.Warn("raycast is not currently supported by the Oimo physics plugin"), this._raycastResult.reset(t, e), this._raycastResult;
+ }, r;
+ }(), Gs = l(97), Qf = function() {
+ function r(t, e, n) {
+ var i = this;
+ t === void 0 && (t = !0), e === void 0 && (e = Ammo), n === void 0 && (n = null), this._useDeltaForWorldStep = t, this.bjsAMMO = {}, this.name = "AmmoJSPlugin", this._timeStep = 1 / 60, this._fixedTimeStep = 1 / 60, this._maxSteps = 5, this._tmpQuaternion = new c.b(), this._tmpContactCallbackResult = !1, this._tmpContactPoint = new c.e(), this._tmpMatrix = new c.a(), typeof e == "function" ? e(this.bjsAMMO) : this.bjsAMMO = e, this.isSupported() ? (this._collisionConfiguration = new this.bjsAMMO.btSoftBodyRigidBodyCollisionConfiguration(), this._dispatcher = new this.bjsAMMO.btCollisionDispatcher(this._collisionConfiguration), this._overlappingPairCache = n || new this.bjsAMMO.btDbvtBroadphase(), this._solver = new this.bjsAMMO.btSequentialImpulseConstraintSolver(), this._softBodySolver = new this.bjsAMMO.btDefaultSoftBodySolver(), this.world = new this.bjsAMMO.btSoftRigidDynamicsWorld(this._dispatcher, this._overlappingPairCache, this._solver, this._collisionConfiguration, this._softBodySolver), this._tmpAmmoConcreteContactResultCallback = new this.bjsAMMO.ConcreteContactResultCallback(), this._tmpAmmoConcreteContactResultCallback.addSingleResult = function(o, a, s, p) {
+ var m = (o = i.bjsAMMO.wrapPointer(o, Ammo.btManifoldPoint)).getPositionWorldOnA();
+ i._tmpContactPoint.x = m.x(), i._tmpContactPoint.y = m.y(), i._tmpContactPoint.z = m.z(), i._tmpContactCallbackResult = !0;
+ }, this._raycastResult = new Ql(), this._tmpAmmoTransform = new this.bjsAMMO.btTransform(), this._tmpAmmoTransform.setIdentity(), this._tmpAmmoQuaternion = new this.bjsAMMO.btQuaternion(0, 0, 0, 1), this._tmpAmmoVectorA = new this.bjsAMMO.btVector3(0, 0, 0), this._tmpAmmoVectorB = new this.bjsAMMO.btVector3(0, 0, 0), this._tmpAmmoVectorC = new this.bjsAMMO.btVector3(0, 0, 0), this._tmpAmmoVectorD = new this.bjsAMMO.btVector3(0, 0, 0)) : h.a.Error("AmmoJS is not available. Please make sure you included the js file.");
+ }
+ return r.prototype.setGravity = function(t) {
+ this._tmpAmmoVectorA.setValue(t.x, t.y, t.z), this.world.setGravity(this._tmpAmmoVectorA), this.world.getWorldInfo().set_m_gravity(this._tmpAmmoVectorA);
+ }, r.prototype.setTimeStep = function(t) {
+ this._timeStep = t;
+ }, r.prototype.setFixedTimeStep = function(t) {
+ this._fixedTimeStep = t;
+ }, r.prototype.setMaxSteps = function(t) {
+ this._maxSteps = t;
+ }, r.prototype.getTimeStep = function() {
+ return this._timeStep;
+ }, r.prototype._isImpostorInContact = function(t) {
+ return this._tmpContactCallbackResult = !1, this.world.contactTest(t.physicsBody, this._tmpAmmoConcreteContactResultCallback), this._tmpContactCallbackResult;
+ }, r.prototype._isImpostorPairInContact = function(t, e) {
+ return this._tmpContactCallbackResult = !1, this.world.contactPairTest(t.physicsBody, e.physicsBody, this._tmpAmmoConcreteContactResultCallback), this._tmpContactCallbackResult;
+ }, r.prototype._stepSimulation = function(t, e, n) {
+ if (t === void 0 && (t = 1 / 60), e === void 0 && (e = 10), n === void 0 && (n = 1 / 60), e == 0)
+ this.world.stepSimulation(t, 0);
+ else
+ for (; e > 0 && t > 0; )
+ t - n < n ? (this.world.stepSimulation(t, 0), t = 0) : (t -= n, this.world.stepSimulation(n, 0)), e--;
+ }, r.prototype.executeStep = function(t, e) {
+ for (var n = 0, i = e; n < i.length; n++) {
+ var o = i[n];
+ o.soft || o.beforeStep();
+ }
+ this._stepSimulation(this._useDeltaForWorldStep ? t : this._timeStep, this._maxSteps, this._fixedTimeStep);
+ for (var a = 0, s = e; a < s.length; a++) {
+ var p = s[a];
+ if (p.soft ? this._afterSoftStep(p) : p.afterStep(), p._onPhysicsCollideCallbacks.length > 0 && this._isImpostorInContact(p))
+ for (var m = 0, S = p._onPhysicsCollideCallbacks; m < S.length; m++)
+ for (var O = 0, I = S[m].otherImpostors; O < I.length; O++) {
+ var G = I[O];
+ (p.physicsBody.isActive() || G.physicsBody.isActive()) && this._isImpostorPairInContact(p, G) && (p.onCollide({ body: G.physicsBody, point: this._tmpContactPoint }), G.onCollide({ body: p.physicsBody, point: this._tmpContactPoint }));
+ }
+ }
+ }, r.prototype._afterSoftStep = function(t) {
+ t.type === Ct.a.RopeImpostor ? this._ropeStep(t) : this._softbodyOrClothStep(t);
+ }, r.prototype._ropeStep = function(t) {
+ for (var e, n, i, o, a = t.physicsBody.get_m_nodes(), s = a.size(), p = new Array(), m = 0; m < s; m++)
+ n = (e = a.at(m).get_m_x()).x(), i = e.y(), o = e.z(), p.push(new c.e(n, i, o));
+ var S = t.object, O = t.getParam("shape");
+ t._isFromLine ? t.object = yn.a.CreateLines("lines", { points: p, instance: S }) : t.object = Gs.a.ExtrudeShape("ext", { shape: O, path: p, instance: S });
+ }, r.prototype._softbodyOrClothStep = function(t) {
+ var e = t.type === Ct.a.ClothImpostor ? 1 : -1, n = t.object, i = n.getVerticesData(De.b.PositionKind);
+ i || (i = []);
+ var o = n.getVerticesData(De.b.NormalKind);
+ o || (o = []);
+ for (var a, s, p, m, S, O, I, G, k = i.length / 3, K = t.physicsBody.get_m_nodes(), re = 0; re < k; re++) {
+ var se;
+ p = (s = (a = K.at(re)).get_m_x()).x(), m = s.y(), S = s.z() * e, O = (se = a.get_m_n()).x(), I = se.y(), G = se.z() * e, i[3 * re] = p, i[3 * re + 1] = m, i[3 * re + 2] = S, o[3 * re] = O, o[3 * re + 1] = I, o[3 * re + 2] = G;
+ }
+ var ue = new ft.a();
+ ue.positions = i, ue.normals = o, ue.uvs = n.getVerticesData(De.b.UVKind), ue.colors = n.getVerticesData(De.b.ColorKind), n && n.getIndices && (ue.indices = n.getIndices()), ue.applyToMesh(n);
+ }, r.prototype.applyImpulse = function(t, e, n) {
+ if (t.soft)
+ h.a.Warn("Cannot be applied to a soft body");
+ else {
+ t.physicsBody.activate();
+ var i = this._tmpAmmoVectorA, o = this._tmpAmmoVectorB;
+ t.object && t.object.getWorldMatrix && n.subtractInPlace(t.object.getWorldMatrix().getTranslation()), i.setValue(n.x, n.y, n.z), o.setValue(e.x, e.y, e.z), t.physicsBody.applyImpulse(o, i);
+ }
+ }, r.prototype.applyForce = function(t, e, n) {
+ if (t.soft)
+ h.a.Warn("Cannot be applied to a soft body");
+ else {
+ t.physicsBody.activate();
+ var i = this._tmpAmmoVectorA, o = this._tmpAmmoVectorB;
+ t.object && t.object.getWorldMatrix && n.subtractInPlace(t.object.getWorldMatrix().getTranslation()), i.setValue(n.x, n.y, n.z), o.setValue(e.x, e.y, e.z), t.physicsBody.applyForce(o, i);
+ }
+ }, r.prototype.generatePhysicsBody = function(t) {
+ if (t._pluginData.toDispose = [], t.parent)
+ t.physicsBody && (this.removePhysicsBody(t), t.forceUpdate());
+ else if (t.isBodyInitRequired()) {
+ var e = this._createShape(t), n = t.getParam("mass");
+ if (t._pluginData.mass = n, t.soft)
+ e.get_m_cfg().set_collisions(17), e.get_m_cfg().set_kDP(t.getParam("damping")), this.bjsAMMO.castObject(e, this.bjsAMMO.btCollisionObject).getCollisionShape().setMargin(t.getParam("margin")), e.setActivationState(r.DISABLE_DEACTIVATION_FLAG), this.world.addSoftBody(e, 1, -1), t.physicsBody = e, t._pluginData.toDispose.push(e), this.setBodyPressure(t, 0), t.type === Ct.a.SoftbodyImpostor && this.setBodyPressure(t, t.getParam("pressure")), this.setBodyStiffness(t, t.getParam("stiffness")), this.setBodyVelocityIterations(t, t.getParam("velocityIterations")), this.setBodyPositionIterations(t, t.getParam("positionIterations"));
+ else {
+ var i = new this.bjsAMMO.btVector3(0, 0, 0), o = new this.bjsAMMO.btTransform();
+ o.setIdentity(), n !== 0 && e.calculateLocalInertia(n, i), this._tmpAmmoVectorA.setValue(t.object.position.x, t.object.position.y, t.object.position.z), this._tmpAmmoQuaternion.setValue(t.object.rotationQuaternion.x, t.object.rotationQuaternion.y, t.object.rotationQuaternion.z, t.object.rotationQuaternion.w), o.setOrigin(this._tmpAmmoVectorA), o.setRotation(this._tmpAmmoQuaternion);
+ var a = new this.bjsAMMO.btDefaultMotionState(o), s = new this.bjsAMMO.btRigidBodyConstructionInfo(n, a, e, i), p = new this.bjsAMMO.btRigidBody(s);
+ n === 0 && (p.setCollisionFlags(p.getCollisionFlags() | r.KINEMATIC_FLAG), p.setActivationState(r.DISABLE_DEACTIVATION_FLAG)), t.type != Ct.a.NoImpostor || e.getChildShape || p.setCollisionFlags(p.getCollisionFlags() | r.DISABLE_COLLISION_FLAG);
+ var m = t.getParam("group"), S = t.getParam("mask");
+ m && S ? this.world.addRigidBody(p, m, S) : this.world.addRigidBody(p), t.physicsBody = p, t._pluginData.toDispose = t._pluginData.toDispose.concat([p, s, a, o, i, e]);
+ }
+ this.setBodyRestitution(t, t.getParam("restitution")), this.setBodyFriction(t, t.getParam("friction"));
+ }
+ }, r.prototype.removePhysicsBody = function(t) {
+ var e = this;
+ this.world && (t.soft ? this.world.removeSoftBody(t.physicsBody) : this.world.removeRigidBody(t.physicsBody), t._pluginData && (t._pluginData.toDispose.forEach(function(n) {
+ e.bjsAMMO.destroy(n);
+ }), t._pluginData.toDispose = []));
+ }, r.prototype.generateJoint = function(t) {
+ var e = t.mainImpostor.physicsBody, n = t.connectedImpostor.physicsBody;
+ if (e && n) {
+ var i, o = t.joint.jointData;
+ switch (o.mainPivot || (o.mainPivot = new c.e(0, 0, 0)), o.connectedPivot || (o.connectedPivot = new c.e(0, 0, 0)), t.joint.type) {
+ case un.e.DistanceJoint:
+ var a = o.maxDistance;
+ a && (o.mainPivot = new c.e(0, -a / 2, 0), o.connectedPivot = new c.e(0, a / 2, 0)), i = new this.bjsAMMO.btPoint2PointConstraint(e, n, new this.bjsAMMO.btVector3(o.mainPivot.x, o.mainPivot.y, o.mainPivot.z), new this.bjsAMMO.btVector3(o.connectedPivot.x, o.connectedPivot.y, o.connectedPivot.z));
+ break;
+ case un.e.HingeJoint:
+ o.mainAxis || (o.mainAxis = new c.e(0, 0, 0)), o.connectedAxis || (o.connectedAxis = new c.e(0, 0, 0));
+ var s = new this.bjsAMMO.btVector3(o.mainAxis.x, o.mainAxis.y, o.mainAxis.z), p = new this.bjsAMMO.btVector3(o.connectedAxis.x, o.connectedAxis.y, o.connectedAxis.z);
+ i = new this.bjsAMMO.btHingeConstraint(e, n, new this.bjsAMMO.btVector3(o.mainPivot.x, o.mainPivot.y, o.mainPivot.z), new this.bjsAMMO.btVector3(o.connectedPivot.x, o.connectedPivot.y, o.connectedPivot.z), s, p);
+ break;
+ case un.e.BallAndSocketJoint:
+ i = new this.bjsAMMO.btPoint2PointConstraint(e, n, new this.bjsAMMO.btVector3(o.mainPivot.x, o.mainPivot.y, o.mainPivot.z), new this.bjsAMMO.btVector3(o.connectedPivot.x, o.connectedPivot.y, o.connectedPivot.z));
+ break;
+ default:
+ h.a.Warn("JointType not currently supported by the Ammo plugin, falling back to PhysicsJoint.BallAndSocketJoint"), i = new this.bjsAMMO.btPoint2PointConstraint(e, n, new this.bjsAMMO.btVector3(o.mainPivot.x, o.mainPivot.y, o.mainPivot.z), new this.bjsAMMO.btVector3(o.connectedPivot.x, o.connectedPivot.y, o.connectedPivot.z));
+ }
+ this.world.addConstraint(i, !t.joint.jointData.collision), t.joint.physicsJoint = i;
+ }
+ }, r.prototype.removeJoint = function(t) {
+ this.world && this.world.removeConstraint(t.joint.physicsJoint);
+ }, r.prototype._addMeshVerts = function(t, e, n) {
+ var i = this, o = 0;
+ if (n && n.getIndices && n.getWorldMatrix && n.getChildMeshes) {
+ var a = n.getIndices();
+ a || (a = []);
+ var s = n.getVerticesData(De.b.PositionKind);
+ s || (s = []), n.computeWorldMatrix(!1);
+ for (var p = a.length / 3, m = 0; m < p; m++) {
+ for (var S = [], O = 0; O < 3; O++) {
+ var I, G = new c.e(s[3 * a[3 * m + O] + 0], s[3 * a[3 * m + O] + 1], s[3 * a[3 * m + O] + 2]);
+ c.a.ScalingToRef(n.scaling.x, n.scaling.y, n.scaling.z, this._tmpMatrix), G = c.e.TransformCoordinates(G, this._tmpMatrix), (I = O == 0 ? this._tmpAmmoVectorA : O == 1 ? this._tmpAmmoVectorB : this._tmpAmmoVectorC).setValue(G.x, G.y, G.z), S.push(I);
+ }
+ t.addTriangle(S[0], S[1], S[2]), o++;
+ }
+ n.getChildMeshes().forEach(function(k) {
+ o += i._addMeshVerts(t, e, k);
+ });
+ }
+ return o;
+ }, r.prototype._softVertexData = function(t) {
+ var e = t.object;
+ if (e && e.getIndices && e.getWorldMatrix && e.getChildMeshes) {
+ e.getIndices();
+ var n = e.getVerticesData(De.b.PositionKind);
+ n || (n = []);
+ var i = e.getVerticesData(De.b.NormalKind);
+ i || (i = []), e.computeWorldMatrix(!1);
+ for (var o = [], a = [], s = 0; s < n.length; s += 3) {
+ var p = new c.e(n[s], n[s + 1], n[s + 2]), m = new c.e(i[s], i[s + 1], i[s + 2]);
+ p = c.e.TransformCoordinates(p, e.getWorldMatrix()), m = c.e.TransformNormal(m, e.getWorldMatrix()), o.push(p.x, p.y, p.z), a.push(m.x, m.y, m.z);
+ }
+ var S = new ft.a();
+ return S.positions = o, S.normals = a, S.uvs = e.getVerticesData(De.b.UVKind), S.colors = e.getVerticesData(De.b.ColorKind), e && e.getIndices && (S.indices = e.getIndices()), S.applyToMesh(e), e.position = c.e.Zero(), e.rotationQuaternion = null, e.rotation = c.e.Zero(), e.computeWorldMatrix(!0), S;
+ }
+ return ft.a.ExtractFromMesh(e);
+ }, r.prototype._createSoftbody = function(t) {
+ var e = t.object;
+ if (e && e.getIndices) {
+ var n = e.getIndices();
+ n || (n = []);
+ var i = this._softVertexData(t), o = i.positions, a = i.normals;
+ if (o === null || a === null)
+ return new this.bjsAMMO.btCompoundShape();
+ for (var s = [], p = [], m = 0; m < o.length; m += 3) {
+ var S = new c.e(o[m], o[m + 1], o[m + 2]), O = new c.e(a[m], a[m + 1], a[m + 2]);
+ s.push(S.x, S.y, -S.z), p.push(O.x, O.y, -O.z);
+ }
+ var I = new this.bjsAMMO.btSoftBodyHelpers().CreateFromTriMesh(this.world.getWorldInfo(), s, e.getIndices(), n.length / 3, !0), G = o.length / 3, k = I.get_m_nodes();
+ for (m = 0; m < G; m++) {
+ var K;
+ (K = k.at(m).get_m_n()).setX(p[3 * m]), K.setY(p[3 * m + 1]), K.setZ(p[3 * m + 2]);
+ }
+ return I;
+ }
+ }, r.prototype._createCloth = function(t) {
+ var e = t.object;
+ if (e && e.getIndices) {
+ e.getIndices();
+ var n = this._softVertexData(t), i = n.positions, o = n.normals;
+ if (i === null || o === null)
+ return new this.bjsAMMO.btCompoundShape();
+ var a = i.length, s = Math.sqrt(a / 3);
+ t.segments = s;
+ var p = s - 1;
+ return this._tmpAmmoVectorA.setValue(i[0], i[1], i[2]), this._tmpAmmoVectorB.setValue(i[3 * p], i[3 * p + 1], i[3 * p + 2]), this._tmpAmmoVectorD.setValue(i[a - 3], i[a - 2], i[a - 1]), this._tmpAmmoVectorC.setValue(i[a - 3 - 3 * p], i[a - 2 - 3 * p], i[a - 1 - 3 * p]), new this.bjsAMMO.btSoftBodyHelpers().CreatePatch(this.world.getWorldInfo(), this._tmpAmmoVectorA, this._tmpAmmoVectorB, this._tmpAmmoVectorC, this._tmpAmmoVectorD, s, s, t.getParam("fixedPoints"), !0);
+ }
+ }, r.prototype._createRope = function(t) {
+ var e, n, i = this._softVertexData(t), o = i.positions, a = i.normals;
+ if (o === null || a === null)
+ return new this.bjsAMMO.btCompoundShape();
+ if (i.applyToMesh(t.object, !0), t._isFromLine = !0, a.map(function(S) {
+ return S * S;
+ }).reduce(function(S, O) {
+ return S + O;
+ }) === 0)
+ n = (e = o.length) / 3 - 1, this._tmpAmmoVectorA.setValue(o[0], o[1], o[2]), this._tmpAmmoVectorB.setValue(o[e - 3], o[e - 2], o[e - 1]);
+ else {
+ t._isFromLine = !1;
+ var s = t.getParam("path");
+ if (t.getParam("shape") === null)
+ return h.a.Warn("No shape available for extruded mesh"), new this.bjsAMMO.btCompoundShape();
+ if (o.length % (3 * s.length) != 0)
+ return h.a.Warn("Path does not match extrusion"), new this.bjsAMMO.btCompoundShape();
+ n = (e = s.length) - 1, this._tmpAmmoVectorA.setValue(s[0].x, s[0].y, s[0].z), this._tmpAmmoVectorB.setValue(s[e - 1].x, s[e - 1].y, s[e - 1].z);
+ }
+ t.segments = n;
+ var p = t.getParam("fixedPoints");
+ p = p > 3 ? 3 : p;
+ var m = new this.bjsAMMO.btSoftBodyHelpers().CreateRope(this.world.getWorldInfo(), this._tmpAmmoVectorA, this._tmpAmmoVectorB, n - 1, p);
+ return m.get_m_cfg().set_collisions(17), m;
+ }, r.prototype._createCustom = function(t) {
+ var e = null;
+ return this.onCreateCustomShape && (e = this.onCreateCustomShape(t)), e == null && (e = new this.bjsAMMO.btCompoundShape()), e;
+ }, r.prototype._addHullVerts = function(t, e, n) {
+ var i = this, o = 0;
+ if (n && n.getIndices && n.getWorldMatrix && n.getChildMeshes) {
+ var a = n.getIndices();
+ a || (a = []);
+ var s = n.getVerticesData(De.b.PositionKind);
+ s || (s = []), n.computeWorldMatrix(!1);
+ for (var p = a.length / 3, m = 0; m < p; m++) {
+ for (var S = [], O = 0; O < 3; O++) {
+ var I, G = new c.e(s[3 * a[3 * m + O] + 0], s[3 * a[3 * m + O] + 1], s[3 * a[3 * m + O] + 2]);
+ c.a.ScalingToRef(n.scaling.x, n.scaling.y, n.scaling.z, this._tmpMatrix), G = c.e.TransformCoordinates(G, this._tmpMatrix), (I = O == 0 ? this._tmpAmmoVectorA : O == 1 ? this._tmpAmmoVectorB : this._tmpAmmoVectorC).setValue(G.x, G.y, G.z), S.push(I);
+ }
+ t.addPoint(S[0], !0), t.addPoint(S[1], !0), t.addPoint(S[2], !0), o++;
+ }
+ n.getChildMeshes().forEach(function(k) {
+ o += i._addHullVerts(t, e, k);
+ });
+ }
+ return o;
+ }, r.prototype._createShape = function(t, e) {
+ var n = this;
+ e === void 0 && (e = !1);
+ var i, o = t.object, a = t.getObjectExtendSize();
+ if (!e) {
+ var s = t.object.getChildMeshes ? t.object.getChildMeshes(!0) : [];
+ i = new this.bjsAMMO.btCompoundShape();
+ var p = 0;
+ if (s.forEach(function(k) {
+ var K = k.getPhysicsImpostor();
+ if (K) {
+ if (K.type == Ct.a.MeshImpostor)
+ throw "A child MeshImpostor is not supported. Only primitive impostors are supported as children (eg. box or sphere)";
+ var re = n._createShape(K), se = k.parent.getWorldMatrix().clone(), ue = new c.e();
+ se.decompose(ue), n._tmpAmmoTransform.getOrigin().setValue(k.position.x * ue.x, k.position.y * ue.y, k.position.z * ue.z), n._tmpAmmoQuaternion.setValue(k.rotationQuaternion.x, k.rotationQuaternion.y, k.rotationQuaternion.z, k.rotationQuaternion.w), n._tmpAmmoTransform.setRotation(n._tmpAmmoQuaternion), i.addChildShape(n._tmpAmmoTransform, re), K.dispose(), p++;
+ }
+ }), p > 0) {
+ if (t.type != Ct.a.NoImpostor) {
+ var m = this._createShape(t, !0);
+ m && (this._tmpAmmoTransform.getOrigin().setValue(0, 0, 0), this._tmpAmmoQuaternion.setValue(0, 0, 0, 1), this._tmpAmmoTransform.setRotation(this._tmpAmmoQuaternion), i.addChildShape(this._tmpAmmoTransform, m));
+ }
+ return i;
+ }
+ this.bjsAMMO.destroy(i), i = null;
+ }
+ switch (t.type) {
+ case Ct.a.SphereImpostor:
+ if (ee.a.WithinEpsilon(a.x, a.y, 1e-4) && ee.a.WithinEpsilon(a.x, a.z, 1e-4))
+ i = new this.bjsAMMO.btSphereShape(a.x / 2);
+ else {
+ var S = [new this.bjsAMMO.btVector3(0, 0, 0)];
+ (i = new this.bjsAMMO.btMultiSphereShape(S, [1], 1)).setLocalScaling(new this.bjsAMMO.btVector3(a.x / 2, a.y / 2, a.z / 2));
+ }
+ break;
+ case Ct.a.CapsuleImpostor:
+ i = new this.bjsAMMO.btCapsuleShape(a.x / 2, a.y / 2);
+ break;
+ case Ct.a.CylinderImpostor:
+ this._tmpAmmoVectorA.setValue(a.x / 2, a.y / 2, a.z / 2), i = new this.bjsAMMO.btCylinderShape(this._tmpAmmoVectorA);
+ break;
+ case Ct.a.PlaneImpostor:
+ case Ct.a.BoxImpostor:
+ this._tmpAmmoVectorA.setValue(a.x / 2, a.y / 2, a.z / 2), i = new this.bjsAMMO.btBoxShape(this._tmpAmmoVectorA);
+ break;
+ case Ct.a.MeshImpostor:
+ if (t.getParam("mass") == 0) {
+ var O = new this.bjsAMMO.btTriangleMesh();
+ t._pluginData.toDispose.push(O);
+ var I = this._addMeshVerts(O, o, o);
+ i = I == 0 ? new this.bjsAMMO.btCompoundShape() : new this.bjsAMMO.btBvhTriangleMeshShape(O);
+ break;
+ }
+ case Ct.a.ConvexHullImpostor:
+ var G = new this.bjsAMMO.btConvexHullShape();
+ (I = this._addHullVerts(G, o, o)) == 0 ? (t._pluginData.toDispose.push(G), i = new this.bjsAMMO.btCompoundShape()) : i = G;
+ break;
+ case Ct.a.NoImpostor:
+ i = new this.bjsAMMO.btSphereShape(a.x / 2);
+ break;
+ case Ct.a.CustomImpostor:
+ i = this._createCustom(t);
+ break;
+ case Ct.a.SoftbodyImpostor:
+ i = this._createSoftbody(t);
+ break;
+ case Ct.a.ClothImpostor:
+ i = this._createCloth(t);
+ break;
+ case Ct.a.RopeImpostor:
+ i = this._createRope(t);
+ break;
+ default:
+ h.a.Warn("The impostor type is not currently supported by the ammo plugin.");
+ }
+ return i;
+ }, r.prototype.setTransformationFromPhysicsBody = function(t) {
+ t.physicsBody.getMotionState().getWorldTransform(this._tmpAmmoTransform), t.object.position.set(this._tmpAmmoTransform.getOrigin().x(), this._tmpAmmoTransform.getOrigin().y(), this._tmpAmmoTransform.getOrigin().z()), t.object.rotationQuaternion ? t.object.rotationQuaternion.set(this._tmpAmmoTransform.getRotation().x(), this._tmpAmmoTransform.getRotation().y(), this._tmpAmmoTransform.getRotation().z(), this._tmpAmmoTransform.getRotation().w()) : t.object.rotation && (this._tmpQuaternion.set(this._tmpAmmoTransform.getRotation().x(), this._tmpAmmoTransform.getRotation().y(), this._tmpAmmoTransform.getRotation().z(), this._tmpAmmoTransform.getRotation().w()), this._tmpQuaternion.toEulerAnglesToRef(t.object.rotation));
+ }, r.prototype.setPhysicsBodyTransformation = function(t, e, n) {
+ var i = t.physicsBody.getWorldTransform();
+ if (Math.abs(i.getOrigin().x() - e.x) > Xt.a || Math.abs(i.getOrigin().y() - e.y) > Xt.a || Math.abs(i.getOrigin().z() - e.z) > Xt.a || Math.abs(i.getRotation().x() - n.x) > Xt.a || Math.abs(i.getRotation().y() - n.y) > Xt.a || Math.abs(i.getRotation().z() - n.z) > Xt.a || Math.abs(i.getRotation().w() - n.w) > Xt.a)
+ if (this._tmpAmmoVectorA.setValue(e.x, e.y, e.z), i.setOrigin(this._tmpAmmoVectorA), this._tmpAmmoQuaternion.setValue(n.x, n.y, n.z, n.w), i.setRotation(this._tmpAmmoQuaternion), t.physicsBody.setWorldTransform(i), t.mass == 0) {
+ var o = t.physicsBody.getMotionState();
+ o && o.setWorldTransform(i);
+ } else
+ t.physicsBody.activate();
+ }, r.prototype.isSupported = function() {
+ return this.bjsAMMO !== void 0;
+ }, r.prototype.setLinearVelocity = function(t, e) {
+ this._tmpAmmoVectorA.setValue(e.x, e.y, e.z), t.soft ? t.physicsBody.linearVelocity(this._tmpAmmoVectorA) : t.physicsBody.setLinearVelocity(this._tmpAmmoVectorA);
+ }, r.prototype.setAngularVelocity = function(t, e) {
+ this._tmpAmmoVectorA.setValue(e.x, e.y, e.z), t.soft ? t.physicsBody.angularVelocity(this._tmpAmmoVectorA) : t.physicsBody.setAngularVelocity(this._tmpAmmoVectorA);
+ }, r.prototype.getLinearVelocity = function(t) {
+ if (t.soft)
+ var e = t.physicsBody.linearVelocity();
+ else
+ e = t.physicsBody.getLinearVelocity();
+ if (!e)
+ return null;
+ var n = new c.e(e.x(), e.y(), e.z());
+ return this.bjsAMMO.destroy(e), n;
+ }, r.prototype.getAngularVelocity = function(t) {
+ if (t.soft)
+ var e = t.physicsBody.angularVelocity();
+ else
+ e = t.physicsBody.getAngularVelocity();
+ if (!e)
+ return null;
+ var n = new c.e(e.x(), e.y(), e.z());
+ return this.bjsAMMO.destroy(e), n;
+ }, r.prototype.setBodyMass = function(t, e) {
+ t.soft ? t.physicsBody.setTotalMass(e, !1) : t.physicsBody.setMassProps(e), t._pluginData.mass = e;
+ }, r.prototype.getBodyMass = function(t) {
+ return t._pluginData.mass || 0;
+ }, r.prototype.getBodyFriction = function(t) {
+ return t._pluginData.friction || 0;
+ }, r.prototype.setBodyFriction = function(t, e) {
+ t.soft ? t.physicsBody.get_m_cfg().set_kDF(e) : t.physicsBody.setFriction(e), t._pluginData.friction = e;
+ }, r.prototype.getBodyRestitution = function(t) {
+ return t._pluginData.restitution || 0;
+ }, r.prototype.setBodyRestitution = function(t, e) {
+ t.physicsBody.setRestitution(e), t._pluginData.restitution = e;
+ }, r.prototype.getBodyPressure = function(t) {
+ return t.soft ? t._pluginData.pressure || 0 : (h.a.Warn("Pressure is not a property of a rigid body"), 0);
+ }, r.prototype.setBodyPressure = function(t, e) {
+ t.soft ? t.type === Ct.a.SoftbodyImpostor ? (t.physicsBody.get_m_cfg().set_kPR(e), t._pluginData.pressure = e) : (t.physicsBody.get_m_cfg().set_kPR(0), t._pluginData.pressure = 0) : h.a.Warn("Pressure can only be applied to a softbody");
+ }, r.prototype.getBodyStiffness = function(t) {
+ return t.soft ? t._pluginData.stiffness || 0 : (h.a.Warn("Stiffness is not a property of a rigid body"), 0);
+ }, r.prototype.setBodyStiffness = function(t, e) {
+ t.soft ? (e = (e = e < 0 ? 0 : e) > 1 ? 1 : e, t.physicsBody.get_m_materials().at(0).set_m_kLST(e), t._pluginData.stiffness = e) : h.a.Warn("Stiffness cannot be applied to a rigid body");
+ }, r.prototype.getBodyVelocityIterations = function(t) {
+ return t.soft ? t._pluginData.velocityIterations || 0 : (h.a.Warn("Velocity iterations is not a property of a rigid body"), 0);
+ }, r.prototype.setBodyVelocityIterations = function(t, e) {
+ t.soft ? (e = e < 0 ? 0 : e, t.physicsBody.get_m_cfg().set_viterations(e), t._pluginData.velocityIterations = e) : h.a.Warn("Velocity iterations cannot be applied to a rigid body");
+ }, r.prototype.getBodyPositionIterations = function(t) {
+ return t.soft ? t._pluginData.positionIterations || 0 : (h.a.Warn("Position iterations is not a property of a rigid body"), 0);
+ }, r.prototype.setBodyPositionIterations = function(t, e) {
+ t.soft ? (e = e < 0 ? 0 : e, t.physicsBody.get_m_cfg().set_piterations(e), t._pluginData.positionIterations = e) : h.a.Warn("Position iterations cannot be applied to a rigid body");
+ }, r.prototype.appendAnchor = function(t, e, n, i, o, a) {
+ o === void 0 && (o = 1), a === void 0 && (a = !1);
+ var s = t.segments, p = Math.round((s - 1) * n) + s * (s - 1 - Math.round((s - 1) * i));
+ t.physicsBody.appendAnchor(p, e.physicsBody, a, o);
+ }, r.prototype.appendHook = function(t, e, n, i, o) {
+ i === void 0 && (i = 1), o === void 0 && (o = !1);
+ var a = Math.round(t.segments * n);
+ t.physicsBody.appendAnchor(a, e.physicsBody, o, i);
+ }, r.prototype.sleepBody = function(t) {
+ h.a.Warn("sleepBody is not currently supported by the Ammo physics plugin");
+ }, r.prototype.wakeUpBody = function(t) {
+ t.physicsBody.activate();
+ }, r.prototype.updateDistanceJoint = function(t, e, n) {
+ h.a.Warn("updateDistanceJoint is not currently supported by the Ammo physics plugin");
+ }, r.prototype.setMotor = function(t, e, n, i) {
+ t.physicsJoint.enableAngularMotor(!0, e, n);
+ }, r.prototype.setLimit = function(t, e, n) {
+ h.a.Warn("setLimit is not currently supported by the Ammo physics plugin");
+ }, r.prototype.syncMeshWithImpostor = function(t, e) {
+ e.physicsBody.getMotionState().getWorldTransform(this._tmpAmmoTransform), t.position.x = this._tmpAmmoTransform.getOrigin().x(), t.position.y = this._tmpAmmoTransform.getOrigin().y(), t.position.z = this._tmpAmmoTransform.getOrigin().z(), t.rotationQuaternion && (t.rotationQuaternion.x = this._tmpAmmoTransform.getRotation().x(), t.rotationQuaternion.y = this._tmpAmmoTransform.getRotation().y(), t.rotationQuaternion.z = this._tmpAmmoTransform.getRotation().z(), t.rotationQuaternion.w = this._tmpAmmoTransform.getRotation().w());
+ }, r.prototype.getRadius = function(t) {
+ return t.getObjectExtendSize().x / 2;
+ }, r.prototype.getBoxSizeToRef = function(t, e) {
+ var n = t.getObjectExtendSize();
+ e.x = n.x, e.y = n.y, e.z = n.z;
+ }, r.prototype.dispose = function() {
+ this.bjsAMMO.destroy(this.world), this.bjsAMMO.destroy(this._solver), this.bjsAMMO.destroy(this._overlappingPairCache), this.bjsAMMO.destroy(this._dispatcher), this.bjsAMMO.destroy(this._collisionConfiguration), this.bjsAMMO.destroy(this._tmpAmmoVectorA), this.bjsAMMO.destroy(this._tmpAmmoVectorB), this.bjsAMMO.destroy(this._tmpAmmoVectorC), this.bjsAMMO.destroy(this._tmpAmmoTransform), this.bjsAMMO.destroy(this._tmpAmmoQuaternion), this.bjsAMMO.destroy(this._tmpAmmoConcreteContactResultCallback), this.world = null;
+ }, r.prototype.raycast = function(t, e) {
+ this._tmpAmmoVectorRCA = new this.bjsAMMO.btVector3(t.x, t.y, t.z), this._tmpAmmoVectorRCB = new this.bjsAMMO.btVector3(e.x, e.y, e.z);
+ var n = new this.bjsAMMO.ClosestRayResultCallback(this._tmpAmmoVectorRCA, this._tmpAmmoVectorRCB);
+ return this.world.rayTest(this._tmpAmmoVectorRCA, this._tmpAmmoVectorRCB, n), this._raycastResult.reset(t, e), n.hasHit() && (this._raycastResult.setHitData({ x: n.get_m_hitNormalWorld().x(), y: n.get_m_hitNormalWorld().y(), z: n.get_m_hitNormalWorld().z() }, { x: n.get_m_hitPointWorld().x(), y: n.get_m_hitPointWorld().y(), z: n.get_m_hitPointWorld().z() }), this._raycastResult.calculateHitDistance()), this.bjsAMMO.destroy(n), this.bjsAMMO.destroy(this._tmpAmmoVectorRCA), this.bjsAMMO.destroy(this._tmpAmmoVectorRCB), this._raycastResult;
+ }, r.DISABLE_COLLISION_FLAG = 4, r.KINEMATIC_FLAG = 2, r.DISABLE_DEACTIVATION_FLAG = 4, r;
+ }();
+ D.a.prototype.removeReflectionProbe = function(r) {
+ if (!this.reflectionProbes)
+ return -1;
+ var t = this.reflectionProbes.indexOf(r);
+ return t !== -1 && this.reflectionProbes.splice(t, 1), t;
+ }, D.a.prototype.addReflectionProbe = function(r) {
+ this.reflectionProbes || (this.reflectionProbes = []), this.reflectionProbes.push(r);
+ };
+ var qf = function() {
+ function r(t, e, n, i, o) {
+ var a = this;
+ i === void 0 && (i = !0), o === void 0 && (o = !1), this.name = t, this._viewMatrix = c.a.Identity(), this._target = c.e.Zero(), this._add = c.e.Zero(), this._invertYAxis = !1, this.position = c.e.Zero(), this._scene = n, this._scene.reflectionProbes || (this._scene.reflectionProbes = new Array()), this._scene.reflectionProbes.push(this);
+ var s = d.a.TEXTURETYPE_UNSIGNED_BYTE;
+ if (o) {
+ var p = this._scene.getEngine().getCaps();
+ p.textureHalfFloatRender ? s = d.a.TEXTURETYPE_HALF_FLOAT : p.textureFloatRender && (s = d.a.TEXTURETYPE_FLOAT);
+ }
+ this._renderTargetTexture = new bn(t, e, n, i, !0, s, !0), this._renderTargetTexture.onBeforeRenderObservable.add(function(m) {
+ switch (m) {
+ case 0:
+ a._add.copyFromFloats(1, 0, 0);
+ break;
+ case 1:
+ a._add.copyFromFloats(-1, 0, 0);
+ break;
+ case 2:
+ a._add.copyFromFloats(0, a._invertYAxis ? 1 : -1, 0);
+ break;
+ case 3:
+ a._add.copyFromFloats(0, a._invertYAxis ? -1 : 1, 0);
+ break;
+ case 4:
+ a._add.copyFromFloats(0, 0, 1);
+ break;
+ case 5:
+ a._add.copyFromFloats(0, 0, -1);
+ }
+ a._attachedMesh && a.position.copyFrom(a._attachedMesh.getAbsolutePosition()), a.position.addToRef(a._add, a._target), c.a.LookAtLHToRef(a.position, a._target, c.e.Up(), a._viewMatrix), n.activeCamera && (a._projectionMatrix = c.a.PerspectiveFovLH(Math.PI / 2, 1, n.activeCamera.minZ, n.activeCamera.maxZ), n.setTransformMatrix(a._viewMatrix, a._projectionMatrix)), n._forcedViewPosition = a.position;
+ }), this._renderTargetTexture.onAfterUnbindObservable.add(function() {
+ n._forcedViewPosition = null, n.updateTransformMatrix(!0);
+ });
+ }
+ return Object.defineProperty(r.prototype, "samples", { get: function() {
+ return this._renderTargetTexture.samples;
+ }, set: function(t) {
+ this._renderTargetTexture.samples = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "refreshRate", { get: function() {
+ return this._renderTargetTexture.refreshRate;
+ }, set: function(t) {
+ this._renderTargetTexture.refreshRate = t;
+ }, enumerable: !1, configurable: !0 }), r.prototype.getScene = function() {
+ return this._scene;
+ }, Object.defineProperty(r.prototype, "cubeTexture", { get: function() {
+ return this._renderTargetTexture;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "renderList", { get: function() {
+ return this._renderTargetTexture.renderList;
+ }, enumerable: !1, configurable: !0 }), r.prototype.attachToMesh = function(t) {
+ this._attachedMesh = t;
+ }, r.prototype.setRenderingAutoClearDepthStencil = function(t, e) {
+ this._renderTargetTexture.setRenderingAutoClearDepthStencil(t, e);
+ }, r.prototype.dispose = function() {
+ var t = this._scene.reflectionProbes.indexOf(this);
+ t !== -1 && this._scene.reflectionProbes.splice(t, 1), this._renderTargetTexture && (this._renderTargetTexture.dispose(), this._renderTargetTexture = null);
+ }, r.prototype.toString = function(t) {
+ var e = "Name: " + this.name;
+ return t && (e += ", position: " + this.position.toString(), this._attachedMesh && (e += ", attached mesh: " + this._attachedMesh.name)), e;
+ }, r.prototype.getClassName = function() {
+ return "ReflectionProbe";
+ }, r.prototype.serialize = function() {
+ var t = w.a.Serialize(this, this._renderTargetTexture.serialize());
+ return t.isReflectionProbe = !0, t;
+ }, r.Parse = function(t, e, n) {
+ var i = null;
+ if (e.reflectionProbes)
+ for (var o = 0; o < e.reflectionProbes.length; o++) {
+ var a = e.reflectionProbes[o];
+ if (a.name === t.name) {
+ i = a;
+ break;
+ }
+ }
+ return (i = w.a.Parse(function() {
+ return i || new r(t.name, t.renderTargetSize, e, t._generateMipMaps);
+ }, t, e, n)).cubeTexture._waitingRenderList = t.renderList, t._attachedMesh && i.attachToMesh(e.getMeshByID(t._attachedMesh)), i;
+ }, Object(u.c)([Object(w.k)()], r.prototype, "_attachedMesh", void 0), Object(u.c)([Object(w.o)()], r.prototype, "position", void 0), r;
+ }(), h0 = !0, zs = function() {
+ function r() {
+ }
+ return r.LoaderInjectedPhysicsEngine = void 0, r;
+ }(), Zf = function(r, t, e, n) {
+ for (var i = 0, o = t.materials.length; i < o; i++) {
+ var a = t.materials[i];
+ if (a.id === r)
+ return Zt.a.Parse(a, e, n);
+ }
+ return null;
+ }, d0 = function(r, t, e) {
+ for (var n in t)
+ if (r.name === t[n])
+ return e.push(r.id), !0;
+ return !(!r.parentId || e.indexOf(r.parentId) === -1) && (e.push(r.id), !0);
+ }, wo = function(r, t) {
+ return r + " of " + (t ? t.file + " from " + t.name + " version: " + t.version + ", exporter version: " + t.exporter_version : "unknown");
+ }, Jf = function(r, t) {
+ var e = t;
+ if (t._waitingData.lods) {
+ if (t._waitingData.lods.ids && t._waitingData.lods.ids.length > 0) {
+ var n = t._waitingData.lods.ids, i = e.isEnabled(!1);
+ if (t._waitingData.lods.distances) {
+ var o = t._waitingData.lods.distances;
+ if (o.length >= n.length) {
+ var a = o.length > n.length ? o[o.length - 1] : 0;
+ e.setEnabled(!1);
+ for (var s = 0; s < n.length; s++) {
+ var p = n[s], m = r.getMeshByID(p);
+ m != null && e.addLODLevel(o[s], m);
+ }
+ a > 0 && e.addLODLevel(a, null), i === !0 && e.setEnabled(!0);
+ } else
+ Ke.b.Warn("Invalid level of detail distances for " + t.name);
+ }
+ }
+ t._waitingData.lods = null;
+ }
+ }, $f = function(r, t, e, n, i) {
+ i === void 0 && (i = !1);
+ var o = new Un(r), a = "importScene has failed JSON parse";
+ try {
+ var s = JSON.parse(t);
+ a = "";
+ var p, m, S = zt.loggingLevel === zt.DETAILED_LOGGING;
+ if (s.environmentTexture !== void 0 && s.environmentTexture !== null) {
+ var O = s.isPBR === void 0 || s.isPBR;
+ if (s.environmentTextureType && s.environmentTextureType === "BABYLON.HDRCubeTexture") {
+ var I = s.environmentTextureSize ? s.environmentTextureSize : 128, G = new Vs((s.environmentTexture.match(/https?:\/\//g) ? "" : e) + s.environmentTexture, r, I, !0, !O);
+ s.environmentTextureRotationY && (G.rotationY = s.environmentTextureRotationY), r.environmentTexture = G;
+ } else if (ui.a.EndsWith(s.environmentTexture, ".env")) {
+ var k = new Pi((s.environmentTexture.match(/https?:\/\//g) ? "" : e) + s.environmentTexture, r);
+ s.environmentTextureRotationY && (k.rotationY = s.environmentTextureRotationY), r.environmentTexture = k;
+ } else {
+ var K = Pi.CreateFromPrefilteredData((s.environmentTexture.match(/https?:\/\//g) ? "" : e) + s.environmentTexture, r);
+ s.environmentTextureRotationY && (K.rotationY = s.environmentTextureRotationY), r.environmentTexture = K;
+ }
+ if (s.createDefaultSkybox === !0) {
+ var re = r.activeCamera !== void 0 && r.activeCamera !== null ? (r.activeCamera.maxZ - r.activeCamera.minZ) / 2 : 1e3, se = s.skyboxBlurLevel || 0;
+ r.createDefaultSkybox(r.environmentTexture, O, re, se);
+ }
+ o.environmentTexture = r.environmentTexture;
+ }
+ if (s.environmentIntensity !== void 0 && s.environmentIntensity !== null && (r.environmentIntensity = s.environmentIntensity), s.lights !== void 0 && s.lights !== null)
+ for (p = 0, m = s.lights.length; p < m; p++) {
+ var ue = s.lights[p], he = or.a.Parse(ue, r);
+ he && (o.lights.push(he), a += p === 0 ? `
+ Lights:` : "", a += `
+ ` + he.toString(S));
+ }
+ if (s.reflectionProbes !== void 0 && s.reflectionProbes !== null)
+ for (p = 0, m = s.reflectionProbes.length; p < m; p++) {
+ var pe = s.reflectionProbes[p], ve = qf.Parse(pe, r, e);
+ ve && (o.reflectionProbes.push(ve), a += p === 0 ? `
+ Reflection Probes:` : "", a += `
+ ` + ve.toString(S));
+ }
+ if (s.animations !== void 0 && s.animations !== null)
+ for (p = 0, m = s.animations.length; p < m; p++) {
+ var Ee = s.animations[p], Ae = x.a.GetClass("BABYLON.Animation");
+ if (Ae) {
+ var Ie = Ae.Parse(Ee);
+ r.animations.push(Ie), o.animations.push(Ie), a += p === 0 ? `
+ Animations:` : "", a += `
+ ` + Ie.toString(S);
+ }
+ }
+ if (s.materials !== void 0 && s.materials !== null)
+ for (p = 0, m = s.materials.length; p < m; p++) {
+ var xe = s.materials[p], Pe = Zt.a.Parse(xe, r, e);
+ Pe && (o.materials.push(Pe), a += p === 0 ? `
+ Materials:` : "", a += `
+ ` + Pe.toString(S), Pe.getActiveTextures().forEach(function(on) {
+ o.textures.indexOf(on) == -1 && o.textures.push(on);
+ }));
+ }
+ if (s.multiMaterials !== void 0 && s.multiMaterials !== null)
+ for (p = 0, m = s.multiMaterials.length; p < m; p++) {
+ var Ce = s.multiMaterials[p], Fe = Yr.a.ParseMultiMaterial(Ce, r);
+ o.multiMaterials.push(Fe), a += p === 0 ? `
+ MultiMaterials:` : "", a += `
+ ` + Fe.toString(S), Fe.getActiveTextures().forEach(function(on) {
+ o.textures.indexOf(on) == -1 && o.textures.push(on);
+ });
+ }
+ if (s.morphTargetManagers !== void 0 && s.morphTargetManagers !== null)
+ for (var Oe = 0, Be = s.morphTargetManagers; Oe < Be.length; Oe++) {
+ var Le = Be[Oe];
+ o.morphTargetManagers.push(ks.Parse(Le, r));
+ }
+ if (s.skeletons !== void 0 && s.skeletons !== null)
+ for (p = 0, m = s.skeletons.length; p < m; p++) {
+ var Ve = s.skeletons[p], Qe = fs.Parse(Ve, r);
+ o.skeletons.push(Qe), a += p === 0 ? `
+ Skeletons:` : "", a += `
+ ` + Qe.toString(S);
+ }
+ var nt = s.geometries;
+ if (nt != null) {
+ var rt = new Array(), ut = nt.vertexData;
+ if (ut != null)
+ for (p = 0, m = ut.length; p < m; p++) {
+ var qe = ut[p];
+ rt.push(Yl.a.Parse(qe, r, e));
+ }
+ rt.forEach(function(on) {
+ on && o.geometries.push(on);
+ });
+ }
+ if (s.transformNodes !== void 0 && s.transformNodes !== null)
+ for (p = 0, m = s.transformNodes.length; p < m; p++) {
+ var at = s.transformNodes[p], ot = Ao.a.Parse(at, r, e);
+ o.transformNodes.push(ot);
+ }
+ if (s.meshes !== void 0 && s.meshes !== null)
+ for (p = 0, m = s.meshes.length; p < m; p++) {
+ var Je = s.meshes[p], dt = we.a.Parse(Je, r, e);
+ if (o.meshes.push(dt), dt.hasInstances)
+ for (var Ge = 0, $e = dt.instances; Ge < $e.length; Ge++) {
+ var yt = $e[Ge];
+ o.meshes.push(yt);
+ }
+ a += p === 0 ? `
+ Meshes:` : "", a += `
+ ` + dt.toString(S);
+ }
+ if (s.cameras !== void 0 && s.cameras !== null)
+ for (p = 0, m = s.cameras.length; p < m; p++) {
+ var Jt = s.cameras[p], Bt = gt.a.Parse(Jt, r);
+ o.cameras.push(Bt), a += p === 0 ? `
+ Cameras:` : "", a += `
+ ` + Bt.toString(S);
+ }
+ if (s.postProcesses !== void 0 && s.postProcesses !== null)
+ for (p = 0, m = s.postProcesses.length; p < m; p++) {
+ var rn = s.postProcesses[p], vt = _t.Parse(rn, r, e);
+ vt && (o.postProcesses.push(vt), a += p === 0 ? `
+Postprocesses:` : "", a += `
+ ` + vt.toString());
+ }
+ if (s.animationGroups !== void 0 && s.animationGroups !== null)
+ for (p = 0, m = s.animationGroups.length; p < m; p++) {
+ var sn = s.animationGroups[p], $t = He.Parse(sn, r);
+ o.animationGroups.push($t), a += p === 0 ? `
+ AnimationGroups:` : "", a += `
+ ` + $t.toString(S);
+ }
+ for (p = 0, m = r.cameras.length; p < m; p++)
+ (Bt = r.cameras[p])._waitingParentId && (Bt.parent = r.getLastEntryByID(Bt._waitingParentId), Bt._waitingParentId = null);
+ for (p = 0, m = r.lights.length; p < m; p++) {
+ var Qt = r.lights[p];
+ Qt && Qt._waitingParentId && (Qt.parent = r.getLastEntryByID(Qt._waitingParentId), Qt._waitingParentId = null);
+ }
+ for (p = 0, m = r.transformNodes.length; p < m; p++) {
+ var en = r.transformNodes[p];
+ en._waitingParentId && (en.parent = r.getLastEntryByID(en._waitingParentId), en._waitingParentId = null);
+ }
+ for (p = 0, m = r.meshes.length; p < m; p++)
+ (dt = r.meshes[p])._waitingParentId && (dt.parent = r.getLastEntryByID(dt._waitingParentId), dt._waitingParentId = null), dt._waitingData.lods && Jf(r, dt);
+ for (p = 0, m = r.skeletons.length; p < m; p++)
+ (Qe = r.skeletons[p])._hasWaitingData && (Qe.bones != null && Qe.bones.forEach(function(on) {
+ if (on._waitingTransformNodeId) {
+ var Mi = r.getLastEntryByID(on._waitingTransformNodeId);
+ Mi && on.linkTransformNode(Mi), on._waitingTransformNodeId = null;
+ }
+ }), Qe._waitingOverrideMeshId && (Qe.overrideMesh = r.getMeshByID(Qe._waitingOverrideMeshId), Qe._waitingOverrideMeshId = null), Qe._hasWaitingData = null);
+ for (p = 0, m = r.meshes.length; p < m; p++) {
+ var Tt = r.meshes[p];
+ Tt._waitingData.freezeWorldMatrix ? (Tt.freezeWorldMatrix(), Tt._waitingData.freezeWorldMatrix = null) : Tt.computeWorldMatrix(!0);
+ }
+ for (p = 0, m = r.lights.length; p < m; p++) {
+ var It = r.lights[p];
+ if (It._excludedMeshesIds.length > 0) {
+ for (var cn = 0; cn < It._excludedMeshesIds.length; cn++) {
+ var Hn = r.getMeshByID(It._excludedMeshesIds[cn]);
+ Hn && It.excludedMeshes.push(Hn);
+ }
+ It._excludedMeshesIds = [];
+ }
+ if (It._includedOnlyMeshesIds.length > 0) {
+ for (var Jn = 0; Jn < It._includedOnlyMeshesIds.length; Jn++) {
+ var pi = r.getMeshByID(It._includedOnlyMeshesIds[Jn]);
+ pi && It.includedOnlyMeshes.push(pi);
+ }
+ It._includedOnlyMeshesIds = [];
+ }
+ }
+ for (D.a.Parse(s, r, o, e), p = 0, m = r.meshes.length; p < m; p++)
+ (dt = r.meshes[p])._waitingData.actions && (de.Parse(dt._waitingData.actions, dt, r), dt._waitingData.actions = null);
+ s.actions !== void 0 && s.actions !== null && de.Parse(s.actions, null, r);
+ } catch (on) {
+ var Wn = wo("loadAssets", s ? s.producer : "Unknown") + a;
+ if (!n)
+ throw h.a.Log(Wn), on;
+ n(Wn, on);
+ } finally {
+ i || o.removeAllFromScene(), a !== null && zt.loggingLevel !== zt.NO_LOGGING && h.a.Log(wo("loadAssets", s ? s.producer : "Unknown") + (zt.loggingLevel !== zt.MINIMAL_LOGGING ? a : ""));
+ }
+ return o;
+ };
+ zt.RegisterPlugin({ name: "babylon.js", extensions: ".babylon", canDirectLoad: function(r) {
+ return r.indexOf("babylon") !== -1;
+ }, importMesh: function(r, t, e, n, i, o, a, s) {
+ var p = "importMesh has failed JSON parse";
+ try {
+ var m = JSON.parse(e);
+ p = "";
+ var S = zt.loggingLevel === zt.DETAILED_LOGGING;
+ r ? Array.isArray(r) || (r = [r]) : r = null;
+ var O = new Array();
+ if (m.meshes !== void 0 && m.meshes !== null) {
+ var I, G, k, K = [], re = [];
+ for (I = 0, G = m.meshes.length; I < G; I++) {
+ var se = m.meshes[I];
+ if (r === null || d0(se, r, O)) {
+ if (r !== null && delete r[r.indexOf(se.name)], se.geometryId !== void 0 && se.geometryId !== null && m.geometries !== void 0 && m.geometries !== null) {
+ var ue = !1;
+ ["boxes", "spheres", "cylinders", "toruses", "grounds", "planes", "torusKnots", "vertexData"].forEach(function(ot) {
+ ue !== !0 && m.geometries[ot] && Array.isArray(m.geometries[ot]) && m.geometries[ot].forEach(function(Je) {
+ if (Je.id === se.geometryId) {
+ switch (ot) {
+ case "vertexData":
+ Yl.a.Parse(Je, t, n);
+ }
+ ue = !0;
+ }
+ });
+ }), ue === !1 && h.a.Warn("Geometry not found for mesh " + se.id);
+ }
+ if (se.materialId) {
+ var he = re.indexOf(se.materialId) !== -1;
+ if (he === !1 && m.multiMaterials !== void 0 && m.multiMaterials !== null)
+ for (var pe = 0, ve = m.multiMaterials.length; pe < ve; pe++) {
+ var Ee = m.multiMaterials[pe];
+ if (Ee.id === se.materialId) {
+ for (var Ae = 0, Ie = Ee.materials.length; Ae < Ie; Ae++) {
+ var xe, Pe = Ee.materials[Ae];
+ re.push(Pe), (xe = Zf(Pe, m, t, n)) && (p += `
+ Material ` + xe.toString(S));
+ }
+ re.push(Ee.id);
+ var Ce = Yr.a.ParseMultiMaterial(Ee, t);
+ Ce && (he = !0, p += `
+ Multi-Material ` + Ce.toString(S));
+ break;
+ }
+ }
+ he === !1 && (re.push(se.materialId), (xe = Zf(se.materialId, m, t, n)) ? p += `
+ Material ` + xe.toString(S) : h.a.Warn("Material not found for mesh " + se.id));
+ }
+ if (se.skeletonId > -1 && m.skeletons !== void 0 && m.skeletons !== null && !(K.indexOf(se.skeletonId) > -1))
+ for (var Fe = 0, Oe = m.skeletons.length; Fe < Oe; Fe++) {
+ var Be = m.skeletons[Fe];
+ if (Be.id === se.skeletonId) {
+ var Le = fs.Parse(Be, t);
+ a.push(Le), K.push(Be.id), p += `
+ Skeleton ` + Le.toString(S);
+ }
+ }
+ if (m.morphTargetManagers !== void 0 && m.morphTargetManagers !== null)
+ for (var Ve = 0, Qe = m.morphTargetManagers; Ve < Qe.length; Ve++) {
+ var nt = Qe[Ve];
+ ks.Parse(nt, t);
+ }
+ var rt = we.a.Parse(se, t, n);
+ i.push(rt), p += `
+ Mesh ` + rt.toString(S);
+ }
+ }
+ for (I = 0, G = t.meshes.length; I < G; I++)
+ (k = t.meshes[I])._waitingParentId && (k.parent = t.getLastEntryByID(k._waitingParentId), k._waitingParentId = null), k._waitingData.lods && Jf(t, k);
+ for (I = 0, G = t.skeletons.length; I < G; I++)
+ (Le = t.skeletons[I])._hasWaitingData && (Le.bones != null && Le.bones.forEach(function(ot) {
+ if (ot._waitingTransformNodeId) {
+ var Je = t.getLastEntryByID(ot._waitingTransformNodeId);
+ Je && ot.linkTransformNode(Je), ot._waitingTransformNodeId = null;
+ }
+ }), Le._waitingOverrideMeshId && (Le.overrideMesh = t.getMeshByID(Le._waitingOverrideMeshId), Le._waitingOverrideMeshId = null), Le._hasWaitingData = null);
+ for (I = 0, G = t.meshes.length; I < G; I++)
+ (k = t.meshes[I])._waitingData.freezeWorldMatrix ? (k.freezeWorldMatrix(), k._waitingData.freezeWorldMatrix = null) : k.computeWorldMatrix(!0);
+ }
+ if (m.particleSystems !== void 0 && m.particleSystems !== null) {
+ var ut = D.a.GetIndividualParser(st.a.NAME_PARTICLESYSTEM);
+ if (ut)
+ for (I = 0, G = m.particleSystems.length; I < G; I++) {
+ var qe = m.particleSystems[I];
+ O.indexOf(qe.emitterId) !== -1 && o.push(ut(qe, t, n));
+ }
+ }
+ return !0;
+ } catch (ot) {
+ var at = wo("importMesh", m ? m.producer : "Unknown") + p;
+ if (!s)
+ throw h.a.Log(at), ot;
+ s(at, ot);
+ } finally {
+ p !== null && zt.loggingLevel !== zt.NO_LOGGING && h.a.Log(wo("importMesh", m ? m.producer : "Unknown") + (zt.loggingLevel !== zt.MINIMAL_LOGGING ? p : ""));
+ }
+ return !1;
+ }, load: function(r, t, e, n) {
+ var i = "importScene has failed JSON parse";
+ try {
+ var o = JSON.parse(t);
+ if (i = "", o.useDelayedTextureLoading !== void 0 && o.useDelayedTextureLoading !== null && (r.useDelayedTextureLoading = o.useDelayedTextureLoading && !zt.ForceFullSceneLoadingForIncremental), o.autoClear !== void 0 && o.autoClear !== null && (r.autoClear = o.autoClear), o.clearColor !== void 0 && o.clearColor !== null && (r.clearColor = C.b.FromArray(o.clearColor)), o.ambientColor !== void 0 && o.ambientColor !== null && (r.ambientColor = C.a.FromArray(o.ambientColor)), o.gravity !== void 0 && o.gravity !== null && (r.gravity = c.e.FromArray(o.gravity)), o.fogMode && o.fogMode !== 0)
+ switch (r.fogMode = o.fogMode, r.fogColor = C.a.FromArray(o.fogColor), r.fogStart = o.fogStart, r.fogEnd = o.fogEnd, r.fogDensity = o.fogDensity, i += " Fog mode for scene: ", r.fogMode) {
+ case 1:
+ i += `exp
+`;
+ break;
+ case 2:
+ i += `exp2
+`;
+ break;
+ case 3:
+ i += `linear
+`;
+ }
+ if (o.physicsEnabled) {
+ var a;
+ o.physicsEngine === "cannon" ? a = new ql(void 0, void 0, zs.LoaderInjectedPhysicsEngine) : o.physicsEngine === "oimo" ? a = new Kf(void 0, zs.LoaderInjectedPhysicsEngine) : o.physicsEngine === "ammo" && (a = new Qf(void 0, zs.LoaderInjectedPhysicsEngine, void 0)), i = " Physics engine " + (o.physicsEngine ? o.physicsEngine : "oimo") + ` enabled
+`;
+ var s = o.physicsGravity ? c.e.FromArray(o.physicsGravity) : null;
+ r.enablePhysics(s, a);
+ }
+ return o.metadata !== void 0 && o.metadata !== null && (r.metadata = o.metadata), o.collisionsEnabled !== void 0 && o.collisionsEnabled !== null && (r.collisionsEnabled = o.collisionsEnabled), !!$f(r, t, e, n, !0) && (o.autoAnimate && r.beginAnimation(r, o.autoAnimateFrom, o.autoAnimateTo, o.autoAnimateLoop, o.autoAnimateSpeed || 1), o.activeCameraID !== void 0 && o.activeCameraID !== null && r.setActiveCameraByID(o.activeCameraID), !0);
+ } catch (m) {
+ var p = wo("importScene", o ? o.producer : "Unknown") + i;
+ if (!n)
+ throw h.a.Log(p), m;
+ n(p, m);
+ } finally {
+ i !== null && zt.loggingLevel !== zt.NO_LOGGING && h.a.Log(wo("importScene", o ? o.producer : "Unknown") + (zt.loggingLevel !== zt.MINIMAL_LOGGING ? i : ""));
+ }
+ return !1;
+ }, loadAssetContainer: function(r, t, e, n) {
+ return $f(r, t, e, n);
+ } });
+ var f0 = l(121), ep = function() {
+ function r(t) {
+ t === void 0 && (t = {}), this._isEnabled = !0, this.bias = t.bias === void 0 ? 0 : t.bias, this.power = t.power === void 0 ? 1 : t.power, this.leftColor = t.leftColor || C.a.White(), this.rightColor = t.rightColor || C.a.Black(), t.isEnabled === !1 && (this.isEnabled = !1);
+ }
+ return Object.defineProperty(r.prototype, "isEnabled", { get: function() {
+ return this._isEnabled;
+ }, set: function(t) {
+ this._isEnabled !== t && (this._isEnabled = t, ke.a.MarkAllMaterialsAsDirty(d.a.MATERIAL_FresnelDirtyFlag | d.a.MATERIAL_MiscDirtyFlag));
+ }, enumerable: !1, configurable: !0 }), r.prototype.clone = function() {
+ var t = new r();
+ return _e.a.DeepCopy(this, t), t;
+ }, r.prototype.equals = function(t) {
+ return t && this.bias === t.bias && this.power === t.power && this.leftColor.equals(t.leftColor) && this.rightColor.equals(t.rightColor) && this.isEnabled === t.isEnabled;
+ }, r.prototype.serialize = function() {
+ return { isEnabled: this.isEnabled, leftColor: this.leftColor.asArray(), rightColor: this.rightColor.asArray(), bias: this.bias, power: this.power };
+ }, r.Parse = function(t) {
+ return new r({ isEnabled: t.isEnabled, leftColor: C.a.FromArray(t.leftColor), rightColor: C.a.FromArray(t.rightColor), bias: t.bias, power: t.power || 1 });
+ }, r;
+ }();
+ w.a._FresnelParametersParser = ep.Parse;
+ var tp = l(119), Zl = function(r) {
+ function t(e, n) {
+ var i = r.call(this, e, n) || this;
+ return i.maxSimultaneousLights = 4, i.disableLighting = !1, i.invertNormalMapX = !1, i.invertNormalMapY = !1, i.emissiveColor = new C.a(0, 0, 0), i.occlusionStrength = 1, i.useLightmapAsShadowmap = !1, i._useAlphaFromAlbedoTexture = !0, i._useAmbientInGrayScale = !0, i;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "doubleSided", { get: function() {
+ return this._twoSidedLighting;
+ }, set: function(e) {
+ this._twoSidedLighting !== e && (this._twoSidedLighting = e, this.backFaceCulling = !e, this._markAllSubMeshesAsTexturesDirty());
+ }, enumerable: !1, configurable: !0 }), t.prototype.getClassName = function() {
+ return "PBRBaseSimpleMaterial";
+ }, Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsLightsDirty")], t.prototype, "maxSimultaneousLights", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsLightsDirty")], t.prototype, "disableLighting", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty", "_reflectionTexture")], t.prototype, "environmentTexture", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "invertNormalMapX", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "invertNormalMapY", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty", "_bumpTexture")], t.prototype, "normalTexture", void 0), Object(u.c)([Object(w.e)("emissive"), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "emissiveColor", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "emissiveTexture", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty", "_ambientTextureStrength")], t.prototype, "occlusionStrength", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty", "_ambientTexture")], t.prototype, "occlusionTexture", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty", "_alphaCutOff")], t.prototype, "alphaCutOff", void 0), Object(u.c)([Object(w.c)()], t.prototype, "doubleSided", null), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty", null)], t.prototype, "lightmapTexture", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useLightmapAsShadowmap", void 0), t;
+ }(Cn), np = function(r) {
+ function t(e, n) {
+ var i = r.call(this, e, n) || this;
+ return i._useRoughnessFromMetallicTextureAlpha = !1, i._useRoughnessFromMetallicTextureGreen = !0, i._useMetallnessFromMetallicTextureBlue = !0, i.metallic = 1, i.roughness = 1, i;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "PBRMetallicRoughnessMaterial";
+ }, t.prototype.clone = function(e) {
+ var n = this, i = w.a.Clone(function() {
+ return new t(e, n.getScene());
+ }, this);
+ return i.id = e, i.name = e, this.clearCoat.copyTo(i.clearCoat), this.anisotropy.copyTo(i.anisotropy), this.brdf.copyTo(i.brdf), this.sheen.copyTo(i.sheen), this.subSurface.copyTo(i.subSurface), i;
+ }, t.prototype.serialize = function() {
+ var e = w.a.Serialize(this);
+ return e.customType = "BABYLON.PBRMetallicRoughnessMaterial", e.clearCoat = this.clearCoat.serialize(), e.anisotropy = this.anisotropy.serialize(), e.brdf = this.brdf.serialize(), e.sheen = this.sheen.serialize(), e.subSurface = this.subSurface.serialize(), e;
+ }, t.Parse = function(e, n, i) {
+ var o = w.a.Parse(function() {
+ return new t(e.name, n);
+ }, e, n, i);
+ return e.clearCoat && o.clearCoat.parse(e.clearCoat, n, i), e.anisotropy && o.anisotropy.parse(e.anisotropy, n, i), e.brdf && o.brdf.parse(e.brdf, n, i), e.sheen && o.sheen.parse(e.sheen, n, i), e.subSurface && o.subSurface.parse(e.subSurface, n, i), o;
+ }, Object(u.c)([Object(w.e)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty", "_albedoColor")], t.prototype, "baseColor", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty", "_albedoTexture")], t.prototype, "baseTexture", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "metallic", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "roughness", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty", "_metallicTexture")], t.prototype, "metallicRoughnessTexture", void 0), t;
+ }(Zl);
+ x.a.RegisteredTypes["BABYLON.PBRMetallicRoughnessMaterial"] = np;
+ var ip = function(r) {
+ function t(e, n) {
+ var i = r.call(this, e, n) || this;
+ return i._useMicroSurfaceFromReflectivityMapAlpha = !0, i;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "PBRSpecularGlossinessMaterial";
+ }, t.prototype.clone = function(e) {
+ var n = this, i = w.a.Clone(function() {
+ return new t(e, n.getScene());
+ }, this);
+ return i.id = e, i.name = e, this.clearCoat.copyTo(i.clearCoat), this.anisotropy.copyTo(i.anisotropy), this.brdf.copyTo(i.brdf), this.sheen.copyTo(i.sheen), this.subSurface.copyTo(i.subSurface), i;
+ }, t.prototype.serialize = function() {
+ var e = w.a.Serialize(this);
+ return e.customType = "BABYLON.PBRSpecularGlossinessMaterial", e.clearCoat = this.clearCoat.serialize(), e.anisotropy = this.anisotropy.serialize(), e.brdf = this.brdf.serialize(), e.sheen = this.sheen.serialize(), e.subSurface = this.subSurface.serialize(), e;
+ }, t.Parse = function(e, n, i) {
+ var o = w.a.Parse(function() {
+ return new t(e.name, n);
+ }, e, n, i);
+ return e.clearCoat && o.clearCoat.parse(e.clearCoat, n, i), e.anisotropy && o.anisotropy.parse(e.anisotropy, n, i), e.brdf && o.brdf.parse(e.brdf, n, i), e.sheen && o.sheen.parse(e.sheen, n, i), e.subSurface && o.subSurface.parse(e.subSurface, n, i), o;
+ }, Object(u.c)([Object(w.e)("diffuse"), Object(w.b)("_markAllSubMeshesAsTexturesDirty", "_albedoColor")], t.prototype, "diffuseColor", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty", "_albedoTexture")], t.prototype, "diffuseTexture", void 0), Object(u.c)([Object(w.e)("specular"), Object(w.b)("_markAllSubMeshesAsTexturesDirty", "_reflectivityColor")], t.prototype, "specularColor", void 0), Object(u.c)([Object(w.c)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty", "_microSurface")], t.prototype, "glossiness", void 0), Object(u.c)([Object(w.m)(), Object(w.b)("_markAllSubMeshesAsTexturesDirty", "_reflectivityTexture")], t.prototype, "specularGlossinessTexture", void 0), t;
+ }(Zl);
+ x.a.RegisteredTypes["BABYLON.PBRSpecularGlossinessMaterial"] = ip;
+ var js = l(73), rp = function(r) {
+ function t(e, n, i) {
+ i === void 0 && (i = null);
+ var o = r.call(this, n) || this;
+ if (!e)
+ return o;
+ if (o._textureMatrix = c.a.Identity(), o.name = e, o.url = e, o._onLoad = i, o._texture = o._getFromCache(e, !0), o._texture)
+ o._triggerOnLoad();
+ else {
+ var a = o.getScene();
+ a && a.useDelayedTextureLoading ? o.delayLoadState = d.a.DELAYLOADSTATE_NOTLOADED : o.loadTexture();
+ }
+ return o;
+ }
+ return Object(u.d)(t, r), t.prototype._triggerOnLoad = function() {
+ this._onLoad && this._onLoad();
+ }, t.prototype.getTextureMatrix = function() {
+ return this._textureMatrix;
+ }, t.prototype.load3dlTexture = function() {
+ var e, n = this, i = this._getEngine();
+ e = i.webGLVersion === 1 ? i.createRawTexture(null, 1, 1, d.a.TEXTUREFORMAT_RGBA, !1, !1, d.a.TEXTURE_BILINEAR_SAMPLINGMODE, null, d.a.TEXTURETYPE_UNSIGNED_INT) : i.createRawTexture3D(null, 1, 1, 1, d.a.TEXTUREFORMAT_RGBA, !1, !1, d.a.TEXTURE_BILINEAR_SAMPLINGMODE, null, d.a.TEXTURETYPE_UNSIGNED_INT), this._texture = e, this._texture.isReady = !1, this.isCube = !1, this.is3D = i.webGLVersion > 1, this.wrapU = d.a.TEXTURE_CLAMP_ADDRESSMODE, this.wrapV = d.a.TEXTURE_CLAMP_ADDRESSMODE, this.wrapR = d.a.TEXTURE_CLAMP_ADDRESSMODE, this.anisotropicFilteringLevel = 1;
+ var o = function(s) {
+ if (typeof s == "string") {
+ for (var p, m = null, S = null, O = s.split(`
+`), I = 0, G = 0, k = 0, K = 0, re = 0, se = 0; se < O.length; se++)
+ if (p = O[se], t._noneEmptyLineRegex.test(p) && p.indexOf("#") !== 0) {
+ var ue = p.split(" ");
+ if (I !== 0) {
+ if (I != 0) {
+ var he = Math.max(parseInt(ue[0]), 0), pe = Math.max(parseInt(ue[1]), 0), ve = Math.max(parseInt(ue[2]), 0);
+ re = Math.max(he, re), re = Math.max(pe, re), re = Math.max(ve, re);
+ var Ee = 4 * (G + K * I + k * I * I);
+ S && (S[Ee + 0] = he, S[Ee + 1] = pe, S[Ee + 2] = ve), ++k % I == 0 && (k = 0, ++K % I == 0 && (G++, K = 0));
+ }
+ } else
+ I = ue.length, m = new Uint8Array(I * I * I * 4), S = new Float32Array(I * I * I * 4);
+ }
+ if (S && m)
+ for (se = 0; se < S.length; se++)
+ if (se > 0 && (se + 1) % 4 == 0)
+ m[se] = 255;
+ else {
+ var Ae = S[se];
+ m[se] = Ae / re * 255;
+ }
+ e.is3D ? (e.updateSize(I, I, I), i.updateRawTexture3D(e, m, d.a.TEXTUREFORMAT_RGBA, !1)) : (e.updateSize(I * I, I), i.updateRawTexture(e, m, d.a.TEXTUREFORMAT_RGBA, !1)), e.isReady = !0, n._triggerOnLoad();
+ }
+ }, a = this.getScene();
+ return a ? a._loadFile(this.url, o) : i._loadFile(this.url, o), this._texture;
+ }, t.prototype.loadTexture = function() {
+ this.url && this.url.toLocaleLowerCase().indexOf(".3dl") == this.url.length - 4 && this.load3dlTexture();
+ }, t.prototype.clone = function() {
+ var e = new t(this.url, this.getScene() || this._getEngine());
+ return e.level = this.level, e;
+ }, t.prototype.delayLoad = function() {
+ this.delayLoadState === d.a.DELAYLOADSTATE_NOTLOADED && (this.delayLoadState = d.a.DELAYLOADSTATE_LOADED, this._texture = this._getFromCache(this.url, !0), this._texture || this.loadTexture());
+ }, t.Parse = function(e, n) {
+ var i = null;
+ return e.name && !e.isRenderTarget && ((i = new t(e.name, n)).name = e.name, i.level = e.level), i;
+ }, t.prototype.serialize = function() {
+ if (!this.name)
+ return null;
+ var e = {};
+ return e.name = this.name, e.level = this.level, e.customType = "BABYLON.ColorGradingTexture", e;
+ }, t._noneEmptyLineRegex = /\S+/, t;
+ }(oi.a);
+ x.a.RegisteredTypes["BABYLON.ColorGradingTexture"] = rp;
+ var op = function(r) {
+ function t(e, n, i, o, a, s, p) {
+ o === void 0 && (o = !1), a === void 0 && (a = !0), s === void 0 && (s = null), p === void 0 && (p = null);
+ var m = r.call(this, n) || this;
+ if (m._onLoad = null, m._onError = null, !e)
+ throw new Error("Image url is not set");
+ return m._coordinatesMode = Ue.a.CUBIC_MODE, m.name = e, m.url = e, m._size = i, m._noMipmap = o, m.gammaSpace = a, m._onLoad = s, m._onError = p, m.hasAlpha = !1, m.isCube = !0, m._texture = m._getFromCache(e, m._noMipmap), m._texture ? s && (m._texture.isReady ? Ke.b.SetImmediate(function() {
+ return s();
+ }) : m._texture.onLoadedObservable.add(s)) : n.useDelayedTextureLoading ? m.delayLoadState = d.a.DELAYLOADSTATE_NOTLOADED : m.loadImage(m.loadTexture.bind(m), m._onError), m;
+ }
+ return Object(u.d)(t, r), t.prototype.loadImage = function(e, n) {
+ var i = this, o = document.createElement("canvas"), a = new Image();
+ a.addEventListener("load", function() {
+ i._width = a.width, i._height = a.height, o.width = i._width, o.height = i._height;
+ var s = o.getContext("2d");
+ s.drawImage(a, 0, 0);
+ var p = s.getImageData(0, 0, a.width, a.height);
+ i._buffer = p.data.buffer, o.remove(), e();
+ }), a.addEventListener("error", function(s) {
+ n && n(i.getClassName() + " could not be loaded", s);
+ }), a.src = this.url;
+ }, t.prototype.loadTexture = function() {
+ var e = this, n = this.getScene();
+ n && (this._texture = n.getEngine().createRawCubeTextureFromUrl(this.url, n, this._size, d.a.TEXTUREFORMAT_RGB, n.getEngine().getCaps().textureFloat ? d.a.TEXTURETYPE_FLOAT : d.a.TEXTURETYPE_UNSIGNED_INTEGER, this._noMipmap, function() {
+ for (var i = e.getFloat32ArrayFromArrayBuffer(e._buffer), o = Kl.ConvertPanoramaToCubemap(i, e._width, e._height, e._size), a = [], s = 0; s < 6; s++) {
+ var p = o[t._FacesMapping[s]];
+ a.push(p);
+ }
+ return a;
+ }, null, this._onLoad, this._onError));
+ }, t.prototype.getFloat32ArrayFromArrayBuffer = function(e) {
+ for (var n = new DataView(e), i = new Float32Array(3 * e.byteLength / 4), o = 0, a = 0; a < e.byteLength; a++)
+ (a + 1) % 4 != 0 && (i[o++] = n.getUint8(a) / 255);
+ return i;
+ }, t.prototype.getClassName = function() {
+ return "EquiRectangularCubeTexture";
+ }, t.prototype.clone = function() {
+ var e = this.getScene();
+ if (!e)
+ return this;
+ var n = new t(this.url, e, this._size, this._noMipmap, this.gammaSpace);
+ return n.level = this.level, n.wrapU = this.wrapU, n.wrapV = this.wrapV, n.coordinatesIndex = this.coordinatesIndex, n.coordinatesMode = this.coordinatesMode, n;
+ }, t._FacesMapping = ["right", "left", "up", "down", "front", "back"], t;
+ }(oi.a), p0 = function(r) {
+ function t(e, n, i) {
+ var o = r.call(this, i.scene || i.engine) || this;
+ return n && (i.engine || i.scene) && (i = Object(u.a)(Object(u.a)({}, t.DefaultOptions), i), o._generateMipMaps = i.generateMipMaps, o._samplingMode = i.samplingMode, o._textureMatrix = c.a.Identity(), o.name = e, o.element = n, o._isVideo = n instanceof HTMLVideoElement, o.anisotropicFilteringLevel = 1, o._createInternalTexture()), o;
+ }
+ return Object(u.d)(t, r), t.prototype._createInternalTexture = function() {
+ var e = 0, n = 0;
+ this._isVideo ? (e = this.element.videoWidth, n = this.element.videoHeight) : (e = this.element.width, n = this.element.height);
+ var i = this._getEngine();
+ i && (this._texture = i.createDynamicTexture(e, n, this._generateMipMaps, this._samplingMode)), this.update();
+ }, t.prototype.getTextureMatrix = function() {
+ return this._textureMatrix;
+ }, t.prototype.update = function(e) {
+ e === void 0 && (e = null);
+ var n = this._getEngine();
+ if (this._texture != null && n != null)
+ if (this._isVideo) {
+ var i = this.element;
+ if (i.readyState < i.HAVE_CURRENT_DATA)
+ return;
+ n.updateVideoTexture(this._texture, i, e === null || e);
+ } else {
+ var o = this.element;
+ n.updateDynamicTexture(this._texture, o, e === null || e, !1);
+ }
+ }, t.DefaultOptions = { generateMipMaps: !1, samplingMode: d.a.TEXTURE_BILINEAR_SAMPLINGMODE, engine: null, scene: null }, t;
+ }(oi.a), Hs = function() {
+ function r() {
+ }
+ return r.GetTGAHeader = function(t) {
+ var e = 0;
+ return { id_length: t[e++], colormap_type: t[e++], image_type: t[e++], colormap_index: t[e++] | t[e++] << 8, colormap_length: t[e++] | t[e++] << 8, colormap_size: t[e++], origin: [t[e++] | t[e++] << 8, t[e++] | t[e++] << 8], width: t[e++] | t[e++] << 8, height: t[e++] | t[e++] << 8, pixel_size: t[e++], flags: t[e++] };
+ }, r.UploadContent = function(t, e) {
+ if (e.length < 19)
+ h.a.Error("Unable to load TGA file - Not enough data to contain header");
+ else {
+ var n = 18, i = r.GetTGAHeader(e);
+ if (i.id_length + n > e.length)
+ h.a.Error("Unable to load TGA file - Not enough data");
+ else {
+ n += i.id_length;
+ var o, a = !1, s = !1, p = !1;
+ switch (i.image_type) {
+ case r._TYPE_RLE_INDEXED:
+ a = !0;
+ case r._TYPE_INDEXED:
+ s = !0;
+ break;
+ case r._TYPE_RLE_RGB:
+ a = !0;
+ case r._TYPE_RGB:
+ break;
+ case r._TYPE_RLE_GREY:
+ a = !0;
+ case r._TYPE_GREY:
+ p = !0;
+ }
+ var m, S, O, I, G, k, K, re = i.pixel_size >> 3, se = i.width * i.height * re;
+ if (s && (m = e.subarray(n, n += i.colormap_length * (i.colormap_size >> 3))), a) {
+ var ue, he, pe;
+ o = new Uint8Array(se);
+ for (var ve = 0, Ee = new Uint8Array(re); n < se && ve < se; )
+ if (he = 1 + (127 & (ue = e[n++])), 128 & ue) {
+ for (pe = 0; pe < re; ++pe)
+ Ee[pe] = e[n++];
+ for (pe = 0; pe < he; ++pe)
+ o.set(Ee, ve + pe * re);
+ ve += re * he;
+ } else {
+ for (he *= re, pe = 0; pe < he; ++pe)
+ o[ve + pe] = e[n++];
+ ve += he;
+ }
+ } else
+ o = e.subarray(n, n += s ? i.width * i.height : se);
+ switch ((i.flags & r._ORIGIN_MASK) >> r._ORIGIN_SHIFT) {
+ default:
+ case r._ORIGIN_UL:
+ S = 0, I = 1, K = i.width, O = 0, G = 1, k = i.height;
+ break;
+ case r._ORIGIN_BL:
+ S = 0, I = 1, K = i.width, O = i.height - 1, G = -1, k = -1;
+ break;
+ case r._ORIGIN_UR:
+ S = i.width - 1, I = -1, K = -1, O = 0, G = 1, k = i.height;
+ break;
+ case r._ORIGIN_BR:
+ S = i.width - 1, I = -1, K = -1, O = i.height - 1, G = -1, k = -1;
+ }
+ var Ae = r["_getImageData" + (p ? "Grey" : "") + i.pixel_size + "bits"](i, m, o, O, G, k, S, I, K);
+ t.getEngine()._uploadDataToTextureDirectly(t, Ae);
+ }
+ }
+ }, r._getImageData8bits = function(t, e, n, i, o, a, s, p, m) {
+ var S, O, I, G = n, k = e, K = t.width, re = t.height, se = 0, ue = new Uint8Array(K * re * 4);
+ for (I = i; I !== a; I += o)
+ for (O = s; O !== m; O += p, se++)
+ S = G[se], ue[4 * (O + K * I) + 3] = 255, ue[4 * (O + K * I) + 2] = k[3 * S + 0], ue[4 * (O + K * I) + 1] = k[3 * S + 1], ue[4 * (O + K * I) + 0] = k[3 * S + 2];
+ return ue;
+ }, r._getImageData16bits = function(t, e, n, i, o, a, s, p, m) {
+ var S, O, I, G = n, k = t.width, K = t.height, re = 0, se = new Uint8Array(k * K * 4);
+ for (I = i; I !== a; I += o)
+ for (O = s; O !== m; O += p, re += 2) {
+ var ue = 255 * ((31744 & (S = G[re + 0] + (G[re + 1] << 8))) >> 10) / 31 | 0, he = 255 * ((992 & S) >> 5) / 31 | 0, pe = 255 * (31 & S) / 31 | 0;
+ se[4 * (O + k * I) + 0] = ue, se[4 * (O + k * I) + 1] = he, se[4 * (O + k * I) + 2] = pe, se[4 * (O + k * I) + 3] = 32768 & S ? 0 : 255;
+ }
+ return se;
+ }, r._getImageData24bits = function(t, e, n, i, o, a, s, p, m) {
+ var S, O, I = n, G = t.width, k = t.height, K = 0, re = new Uint8Array(G * k * 4);
+ for (O = i; O !== a; O += o)
+ for (S = s; S !== m; S += p, K += 3)
+ re[4 * (S + G * O) + 3] = 255, re[4 * (S + G * O) + 2] = I[K + 0], re[4 * (S + G * O) + 1] = I[K + 1], re[4 * (S + G * O) + 0] = I[K + 2];
+ return re;
+ }, r._getImageData32bits = function(t, e, n, i, o, a, s, p, m) {
+ var S, O, I = n, G = t.width, k = t.height, K = 0, re = new Uint8Array(G * k * 4);
+ for (O = i; O !== a; O += o)
+ for (S = s; S !== m; S += p, K += 4)
+ re[4 * (S + G * O) + 2] = I[K + 0], re[4 * (S + G * O) + 1] = I[K + 1], re[4 * (S + G * O) + 0] = I[K + 2], re[4 * (S + G * O) + 3] = I[K + 3];
+ return re;
+ }, r._getImageDataGrey8bits = function(t, e, n, i, o, a, s, p, m) {
+ var S, O, I, G = n, k = t.width, K = t.height, re = 0, se = new Uint8Array(k * K * 4);
+ for (I = i; I !== a; I += o)
+ for (O = s; O !== m; O += p, re++)
+ S = G[re], se[4 * (O + k * I) + 0] = S, se[4 * (O + k * I) + 1] = S, se[4 * (O + k * I) + 2] = S, se[4 * (O + k * I) + 3] = 255;
+ return se;
+ }, r._getImageDataGrey16bits = function(t, e, n, i, o, a, s, p, m) {
+ var S, O, I = n, G = t.width, k = t.height, K = 0, re = new Uint8Array(G * k * 4);
+ for (O = i; O !== a; O += o)
+ for (S = s; S !== m; S += p, K += 2)
+ re[4 * (S + G * O) + 0] = I[K + 0], re[4 * (S + G * O) + 1] = I[K + 0], re[4 * (S + G * O) + 2] = I[K + 0], re[4 * (S + G * O) + 3] = I[K + 1];
+ return re;
+ }, r._TYPE_INDEXED = 1, r._TYPE_RGB = 2, r._TYPE_GREY = 3, r._TYPE_RLE_INDEXED = 9, r._TYPE_RLE_RGB = 10, r._TYPE_RLE_GREY = 11, r._ORIGIN_MASK = 48, r._ORIGIN_SHIFT = 4, r._ORIGIN_BL = 0, r._ORIGIN_BR = 1, r._ORIGIN_UL = 2, r._ORIGIN_UR = 3, r;
+ }(), ap = function() {
+ function r() {
+ this.supportCascades = !1;
+ }
+ return r.prototype.canLoad = function(t) {
+ return ui.a.EndsWith(t, ".tga");
+ }, r.prototype.loadCubeData = function(t, e, n, i, o) {
+ throw ".env not supported in Cube.";
+ }, r.prototype.loadData = function(t, e, n) {
+ var i = new Uint8Array(t.buffer, t.byteOffset, t.byteLength), o = Hs.GetTGAHeader(i);
+ n(o.width, o.height, e.generateMipMaps, !1, function() {
+ Hs.UploadContent(e, i);
+ });
+ }, r;
+ }();
+ ke.a._TextureLoaders.push(new ap());
+ var Ma, _0 = function() {
+ };
+ (function(r) {
+ r[r.cTFETC1 = 0] = "cTFETC1", r[r.cTFBC1 = 1] = "cTFBC1", r[r.cTFBC4 = 2] = "cTFBC4", r[r.cTFPVRTC1_4_OPAQUE_ONLY = 3] = "cTFPVRTC1_4_OPAQUE_ONLY", r[r.cTFBC7_M6_OPAQUE_ONLY = 4] = "cTFBC7_M6_OPAQUE_ONLY", r[r.cTFETC2 = 5] = "cTFETC2", r[r.cTFBC3 = 6] = "cTFBC3", r[r.cTFBC5 = 7] = "cTFBC5";
+ })(Ma || (Ma = {}));
+ var Ia = function() {
+ function r() {
+ }
+ return r.GetInternalFormatFromBasisFormat = function(t) {
+ if (t === Ma.cTFETC1)
+ return 36196;
+ if (t === Ma.cTFBC1)
+ return 33776;
+ if (t === Ma.cTFBC3)
+ return 33779;
+ throw "The chosen Basis transcoder format is not currently supported";
+ }, r._CreateWorkerAsync = function() {
+ var t = this;
+ return this._WorkerPromise || (this._WorkerPromise = new Promise(function(e) {
+ t._Worker ? e(t._Worker) : Ke.b.LoadFileAsync(r.WasmModuleURL).then(function(n) {
+ var i = URL.createObjectURL(new Blob(["(" + m0 + ")()"], { type: "application/javascript" }));
+ t._Worker = new Worker(i);
+ var o = function(a) {
+ a.data.action === "init" && (t._Worker.removeEventListener("message", o), e(t._Worker));
+ };
+ t._Worker.addEventListener("message", o), t._Worker.postMessage({ action: "init", url: r.JSModuleURL, wasmBinary: n });
+ });
+ })), this._WorkerPromise;
+ }, r.TranscodeAsync = function(t, e) {
+ var n = this, i = t instanceof ArrayBuffer ? new Uint8Array(t) : t;
+ return new Promise(function(o, a) {
+ n._CreateWorkerAsync().then(function() {
+ var s = n._actionId++, p = function(S) {
+ S.data.action === "transcode" && S.data.id === s && (n._Worker.removeEventListener("message", p), S.data.success ? o(S.data) : a("Transcode is not supported on this device"));
+ };
+ n._Worker.addEventListener("message", p);
+ var m = new Uint8Array(i.byteLength);
+ m.set(new Uint8Array(i.buffer, i.byteOffset, i.byteLength)), n._Worker.postMessage({ action: "transcode", id: s, imageData: m, config: e, ignoreSupportedFormats: n._IgnoreSupportedFormats }, [m.buffer]);
+ });
+ });
+ }, r.LoadTextureFromTranscodeResult = function(t, e) {
+ for (var n, i = t.getEngine(), o = function() {
+ if (n = e.fileInfo.images[a].levels[0], t._invertVScale = t.invertY, e.format === -1)
+ if (t.type = d.a.TEXTURETYPE_UNSIGNED_SHORT_5_6_5, t.format = d.a.TEXTUREFORMAT_RGB, i.webGLVersion < 2 && (ee.a.Log2(n.width) % 1 != 0 || ee.a.Log2(n.height) % 1 != 0)) {
+ var s = new Rt.a(i, Rt.b.Temp);
+ t._invertVScale = t.invertY, s.type = d.a.TEXTURETYPE_UNSIGNED_SHORT_5_6_5, s.format = d.a.TEXTUREFORMAT_RGB, s.width = n.width + 3 & -4, s.height = n.height + 3 & -4, i._bindTextureDirectly(i._gl.TEXTURE_2D, s, !0), i._uploadDataToTextureDirectly(s, n.transcodedPixels, a, 0, d.a.TEXTUREFORMAT_RGB, !0), i._rescaleTexture(s, t, i.scenes[0], i._getInternalFormat(d.a.TEXTUREFORMAT_RGB), function() {
+ i._releaseTexture(s), i._bindTextureDirectly(i._gl.TEXTURE_2D, t, !0);
+ });
+ } else
+ t._invertVScale = !t.invertY, t.width = n.width + 3 & -4, t.height = n.height + 3 & -4, i._uploadDataToTextureDirectly(t, n.transcodedPixels, a, 0, d.a.TEXTUREFORMAT_RGB, !0);
+ else
+ t.width = n.width, t.height = n.height, e.fileInfo.images[a].levels.forEach(function(p, m) {
+ i._uploadCompressedDataToTextureDirectly(t, r.GetInternalFormatFromBasisFormat(e.format), p.width, p.height, p.transcodedPixels, a, m);
+ }), i.webGLVersion < 2 && (ee.a.Log2(t.width) % 1 != 0 || ee.a.Log2(t.height) % 1 != 0) && (Ke.b.Warn("Loaded .basis texture width and height are not a power of two. Texture wrapping will be set to Texture.CLAMP_ADDRESSMODE as other modes are not supported with non power of two dimensions in webGL 1."), t._cachedWrapU = Ue.a.CLAMP_ADDRESSMODE, t._cachedWrapV = Ue.a.CLAMP_ADDRESSMODE);
+ }, a = 0; a < e.fileInfo.images.length; a++)
+ o();
+ }, r._IgnoreSupportedFormats = !1, r.JSModuleURL = "https://preview.babylonjs.com/basisTranscoder/basis_transcoder.js", r.WasmModuleURL = "https://preview.babylonjs.com/basisTranscoder/basis_transcoder.wasm", r._WorkerPromise = null, r._Worker = null, r._actionId = 0, r;
+ }();
+ function m0() {
+ var r = 0, t = 1, e = 5, n = 6, i = null;
+ function o(a, s, p, m, S) {
+ var O = a.getImageTranscodedSizeInBytes(s, p, m), I = new Uint8Array(O);
+ return a.transcodeImage(I, s, p, m, 1, 0) ? (S && (I = function(G, k, K, re) {
+ for (var se = new Uint16Array(4), ue = new Uint16Array(K * re), he = K / 4, pe = re / 4, ve = 0; ve < pe; ve++)
+ for (var Ee = 0; Ee < he; Ee++) {
+ var Ae = k + 8 * (ve * he + Ee);
+ se[0] = G[Ae] | G[Ae + 1] << 8, se[1] = G[Ae + 2] | G[Ae + 3] << 8, se[2] = (2 * (31 & se[0]) + 1 * (31 & se[1])) / 3 | (2 * (2016 & se[0]) + 1 * (2016 & se[1])) / 3 & 2016 | (2 * (63488 & se[0]) + 1 * (63488 & se[1])) / 3 & 63488, se[3] = (2 * (31 & se[1]) + 1 * (31 & se[0])) / 3 | (2 * (2016 & se[1]) + 1 * (2016 & se[0])) / 3 & 2016 | (2 * (63488 & se[1]) + 1 * (63488 & se[0])) / 3 & 63488;
+ for (var Ie = 0; Ie < 4; Ie++) {
+ var xe = G[Ae + 4 + Ie], Pe = (4 * ve + Ie) * K + 4 * Ee;
+ ue[Pe++] = se[3 & xe], ue[Pe++] = se[xe >> 2 & 3], ue[Pe++] = se[xe >> 4 & 3], ue[Pe++] = se[xe >> 6 & 3];
+ }
+ }
+ return ue;
+ }(I, 0, a.getImageWidth(s, p) + 3 & -4, a.getImageHeight(s, p) + 3 & -4)), I) : null;
+ }
+ onmessage = function(a) {
+ if (a.data.action === "init")
+ i || (Module = { wasmBinary: a.data.wasmBinary }, importScripts(a.data.url), i = new Promise(function(ve) {
+ Module.onRuntimeInitialized = function() {
+ Module.initializeBasis(), ve();
+ };
+ })), i.then(function() {
+ postMessage({ action: "init" });
+ });
+ else if (a.data.action === "transcode") {
+ var s = a.data.config, p = a.data.imageData, m = new Module.BasisFile(p), S = function(ve) {
+ for (var Ee = ve.getHasAlpha(), Ae = ve.getNumImages(), Ie = [], xe = 0; xe < Ae; xe++) {
+ for (var Pe = { levels: [] }, Ce = ve.getNumLevels(xe), Fe = 0; Fe < Ce; Fe++) {
+ var Oe = { width: ve.getImageWidth(xe, Fe), height: ve.getImageHeight(xe, Fe) };
+ Pe.levels.push(Oe);
+ }
+ Ie.push(Pe);
+ }
+ return { hasAlpha: Ee, images: Ie };
+ }(m), O = a.data.ignoreSupportedFormats ? null : function(ve, Ee) {
+ var Ae = null;
+ return ve.supportedCompressionFormats && (ve.supportedCompressionFormats.etc1 ? Ae = r : ve.supportedCompressionFormats.s3tc ? Ae = Ee.hasAlpha ? n : t : ve.supportedCompressionFormats.pvrtc || ve.supportedCompressionFormats.etc2 && (Ae = e)), Ae;
+ }(a.data.config, S), I = !1;
+ O === null && (I = !0, O = S.hasAlpha ? n : t);
+ var G = !0;
+ m.startTranscoding() || (G = !1);
+ for (var k = [], K = 0; K < S.images.length && G; K++) {
+ var re = S.images[K];
+ if (s.loadSingleImage === void 0 || s.loadSingleImage === K) {
+ var se = re.levels.length;
+ s.loadMipmapLevels === !1 && (se = 1);
+ for (var ue = 0; ue < se; ue++) {
+ var he = re.levels[ue], pe = o(m, K, ue, O, I);
+ if (!pe) {
+ G = !1;
+ break;
+ }
+ he.transcodedPixels = pe, k.push(he.transcodedPixels.buffer);
+ }
+ }
+ }
+ m.close(), m.delete(), I && (O = -1), G ? postMessage({ action: "transcode", success: G, id: a.data.id, fileInfo: S, format: O }, k) : postMessage({ action: "transcode", success: G, id: a.data.id });
+ }
+ };
+ }
+ var sp = function() {
+ function r() {
+ this.supportCascades = !1;
+ }
+ return r.prototype.canLoad = function(t) {
+ return ui.a.EndsWith(t, ".basis");
+ }, r.prototype.loadCubeData = function(t, e, n, i, o) {
+ if (!Array.isArray(t)) {
+ var a = e.getEngine().getCaps(), s = { supportedCompressionFormats: { etc1: !!a.etc1, s3tc: !!a.s3tc, pvrtc: !!a.pvrtc, etc2: !!a.etc2 } };
+ Ia.TranscodeAsync(t, s).then(function(p) {
+ var m = p.fileInfo.images[0].levels.length > 1 && e.generateMipMaps;
+ Ia.LoadTextureFromTranscodeResult(e, p), e.getEngine()._setCubeMapTextureParams(e, m), e.isReady = !0, e.onLoadedObservable.notifyObservers(e), e.onLoadedObservable.clear(), i && i();
+ }).catch(function(p) {
+ Ke.b.Warn("Failed to transcode Basis file, transcoding may not be supported on this device"), e.isReady = !0;
+ });
+ }
+ }, r.prototype.loadData = function(t, e, n) {
+ var i = e.getEngine().getCaps(), o = { supportedCompressionFormats: { etc1: !!i.etc1, s3tc: !!i.s3tc, pvrtc: !!i.pvrtc, etc2: !!i.etc2 } };
+ Ia.TranscodeAsync(t, o).then(function(a) {
+ var s = a.fileInfo.images[0].levels[0], p = a.fileInfo.images[0].levels.length > 1 && e.generateMipMaps;
+ n(s.width, s.height, p, a.format !== -1, function() {
+ Ia.LoadTextureFromTranscodeResult(e, a);
+ });
+ }).catch(function(a) {
+ Ke.b.Warn("Failed to transcode Basis file, transcoding may not be supported on this device"), n(0, 0, !1, !1, function() {
+ });
+ });
+ }, r;
+ }();
+ ke.a._TextureLoaders.push(new sp());
+ var Jl = function(r) {
+ function t(e, n, i, o, a) {
+ var s = this, p = !(!a || !a.generateMipMaps) && a.generateMipMaps, m = !(!a || !a.generateDepthTexture) && a.generateDepthTexture, S = !a || a.doNotChangeAspectRatio === void 0 || a.doNotChangeAspectRatio;
+ if ((s = r.call(this, e, n, o, p, S) || this).isSupported) {
+ var O = [], I = [];
+ s._initTypes(i, O, I, a);
+ var G = !a || a.generateDepthBuffer === void 0 || a.generateDepthBuffer, k = !(!a || a.generateStencilBuffer === void 0) && a.generateStencilBuffer;
+ return s._size = n, s._multiRenderTargetOptions = { samplingModes: I, generateMipMaps: p, generateDepthBuffer: G, generateStencilBuffer: k, generateDepthTexture: m, types: O, textureCount: i }, s._count = i, s._createInternalTextures(), s._createTextures(), s;
+ }
+ s.dispose();
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "isSupported", { get: function() {
+ return this._getEngine().webGLVersion > 1 || this._getEngine().getCaps().drawBuffersExtension;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "textures", { get: function() {
+ return this._textures;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "count", { get: function() {
+ return this._count;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "depthTexture", { get: function() {
+ return this._textures[this._textures.length - 1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "wrapU", { set: function(e) {
+ if (this._textures)
+ for (var n = 0; n < this._textures.length; n++)
+ this._textures[n].wrapU = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "wrapV", { set: function(e) {
+ if (this._textures)
+ for (var n = 0; n < this._textures.length; n++)
+ this._textures[n].wrapV = e;
+ }, enumerable: !1, configurable: !0 }), t.prototype._initTypes = function(e, n, i, o) {
+ for (var a = 0; a < e; a++)
+ o && o.types && o.types[a] !== void 0 ? n.push(o.types[a]) : n.push(o && o.defaultType ? o.defaultType : d.a.TEXTURETYPE_UNSIGNED_INT), o && o.samplingModes && o.samplingModes[a] !== void 0 ? i.push(o.samplingModes[a]) : i.push(Ue.a.BILINEAR_SAMPLINGMODE);
+ }, t.prototype._rebuild = function(e) {
+ e === void 0 && (e = !1), this.releaseInternalTextures(), this._createInternalTextures(), e && this._createTextures();
+ for (var n = 0; n < this._internalTextures.length; n++)
+ this._textures[n]._texture = this._internalTextures[n];
+ this._texture = this._internalTextures[0], this.samples !== 1 && this._getEngine().updateMultipleRenderTargetTextureSampleCount(this._internalTextures, this.samples);
+ }, t.prototype._createInternalTextures = function() {
+ this._internalTextures = this._getEngine().createMultipleRenderTarget(this._size, this._multiRenderTargetOptions);
+ }, t.prototype._createTextures = function() {
+ this._textures = [];
+ for (var e = 0; e < this._internalTextures.length; e++) {
+ var n = new Ue.a(null, this.getScene());
+ n._texture = this._internalTextures[e], this._textures.push(n);
+ }
+ this._texture = this._internalTextures[0];
+ }, t.prototype.replaceTexture = function(e, n) {
+ e._texture && (this._textures[n] = e, this._internalTextures[n] = e._texture);
+ }, Object.defineProperty(t.prototype, "samples", { get: function() {
+ return this._samples;
+ }, set: function(e) {
+ this._samples !== e && (this._samples = this._getEngine().updateMultipleRenderTargetTextureSampleCount(this._internalTextures, e));
+ }, enumerable: !1, configurable: !0 }), t.prototype.resize = function(e) {
+ this._size = e, this._rebuild();
+ }, t.prototype.updateCount = function(e, n) {
+ this._multiRenderTargetOptions.textureCount = e, this._count = e;
+ var i = [], o = [];
+ this._initTypes(e, i, o, n), this._multiRenderTargetOptions.types = i, this._multiRenderTargetOptions.samplingModes = o, this._rebuild(!0);
+ }, t.prototype.unbindFrameBuffer = function(e, n) {
+ var i = this;
+ e.unBindMultiColorAttachmentFramebuffer(this._internalTextures, this.isCube, function() {
+ i.onAfterRenderObservable.notifyObservers(n);
+ });
+ }, t.prototype.dispose = function() {
+ this.releaseInternalTextures(), r.prototype.dispose.call(this);
+ }, t.prototype.releaseInternalTextures = function() {
+ if (this._internalTextures)
+ for (var e = this._internalTextures.length - 1; e >= 0; e--)
+ this._internalTextures[e] !== void 0 && (this._internalTextures[e].dispose(), this._internalTextures.splice(e, 1));
+ }, t;
+ }(bn), $l = function(r, t, e) {
+ this.id = r, this.scale = t, this.offset = e;
+ }, g0 = function() {
+ function r(t, e, n, i) {
+ var o, a, s, p, m, S, O, I, G, k, K, re, se;
+ return this.name = t, this.meshes = e, this.scene = i, this.options = n, this.options.map = (o = this.options.map) !== null && o !== void 0 ? o : ["ambientTexture", "bumpTexture", "diffuseTexture", "emissiveTexture", "lightmapTexture", "opacityTexture", "reflectionTexture", "refractionTexture", "specularTexture"], this.options.uvsIn = (a = this.options.uvsIn) !== null && a !== void 0 ? a : De.b.UVKind, this.options.uvsOut = (s = this.options.uvsOut) !== null && s !== void 0 ? s : De.b.UVKind, this.options.layout = (p = this.options.layout) !== null && p !== void 0 ? p : r.LAYOUT_STRIP, this.options.layout === r.LAYOUT_COLNUM && (this.options.colnum = (m = this.options.colnum) !== null && m !== void 0 ? m : 8), this.options.updateInputMeshes = (S = this.options.updateInputMeshes) === null || S === void 0 || S, this.options.disposeSources = (O = this.options.disposeSources) === null || O === void 0 || O, this._expecting = 0, this.options.fillBlanks = (I = this.options.fillBlanks) === null || I === void 0 || I, this.options.fillBlanks === !0 && (this.options.customFillColor = (G = this.options.customFillColor) !== null && G !== void 0 ? G : "black"), this.options.frameSize = (k = this.options.frameSize) !== null && k !== void 0 ? k : 256, this.options.paddingRatio = (K = this.options.paddingRatio) !== null && K !== void 0 ? K : 0.0115, this._paddingValue = Math.ceil(this.options.frameSize * this.options.paddingRatio), this._paddingValue % 2 != 0 && this._paddingValue++, this.options.paddingMode = (re = this.options.paddingMode) !== null && re !== void 0 ? re : r.SUBUV_WRAP, this.options.paddingMode === r.SUBUV_COLOR && (this.options.paddingColor = (se = this.options.paddingColor) !== null && se !== void 0 ? se : new C.b(0, 0, 0, 1)), this.sets = {}, this.frames = [], this;
+ }
+ return r.prototype._createFrames = function(t) {
+ for (var e = this, n = this._calculateSize(), i = new c.d(1, 1).divide(n), o = 0, a = this._expecting, s = this.meshes.length, p = Object.keys(this.sets), m = 0; m < p.length; m++) {
+ var S = p[m], O = new $i.a(this.name + ".TexturePack." + S + "Set", { width: n.x, height: n.y }, this.scene, !0, Ue.a.TRILINEAR_SAMPLINGMODE, ke.a.TEXTUREFORMAT_RGBA), I = O.getContext();
+ I.fillStyle = "rgba(0,0,0,0)", I.fillRect(0, 0, n.x, n.y), O.update(!1), this.sets[S] = O;
+ }
+ var G = this.options.frameSize || 256, k = this._paddingValue, K = G + 2 * k;
+ for (m = 0; m < s; m++)
+ for (var re = this.meshes[m].material, se = function(pe) {
+ var ve = new $i.a("temp", K, ue.scene, !0), Ee = ve.getContext(), Ae = ue._getFrameOffset(m), Ie = function() {
+ o++, ve.update(!1);
+ var Fe = Ee.getImageData(0, 0, K, K), Oe = e.sets[xe];
+ if (Oe.getContext().putImageData(Fe, n.x * Ae.x, n.y * Ae.y), ve.dispose(), Oe.update(!1), o == a)
+ return e._calculateMeshUVFrames(G, k, n, i, e.options.updateInputMeshes || !1), void t();
+ }, xe = p[pe] || "_blank";
+ if (re && re[xe] !== null) {
+ var Pe = re[xe], Ce = new Image();
+ Pe instanceof $i.a ? Ce.src = Pe.getContext().canvas.toDataURL("image/png") : Ce.src = Pe.url, Ke.b.SetCorsBehavior(Ce.src, Ce), Ce.onload = function() {
+ Ee.fillStyle = "rgba(0,0,0,0)", Ee.fillRect(0, 0, K, K), ve.update(!1), Ee.setTransform(1, 0, 0, -1, 0, 0);
+ var Fe = [0, 0, 1, 0, 1, 1, 0, 1, -1, 1, -1, 0, -2, 0, -1, 1, -1];
+ switch (e.options.paddingMode) {
+ case 0:
+ for (var Oe = 0; Oe < 9; Oe++)
+ Ee.drawImage(Ce, 0, 0, Ce.width, Ce.height, k + G * Fe[Oe], k + G * Fe[Oe + 1] - K, G, G);
+ break;
+ case 1:
+ for (var Be = 0; Be < k; Be++)
+ Ee.drawImage(Ce, 0, 0, Ce.width, Ce.height, Be + G * Fe[0], k - K, G, G), Ee.drawImage(Ce, 0, 0, Ce.width, Ce.height, 2 * k - Be, k - K, G, G), Ee.drawImage(Ce, 0, 0, Ce.width, Ce.height, k, Be - K, G, G), Ee.drawImage(Ce, 0, 0, Ce.width, Ce.height, k, 2 * k - Be - K, G, G);
+ Ee.drawImage(Ce, 0, 0, Ce.width, Ce.height, k + G * Fe[0], k + G * Fe[1] - K, G, G);
+ break;
+ case 2:
+ Ee.fillStyle = (e.options.paddingColor || C.a.Black()).toHexString(), Ee.fillRect(0, 0, K, -K), Ee.clearRect(k, k, G, G), Ee.drawImage(Ce, 0, 0, Ce.width, Ce.height, k + G * Fe[0], k + G * Fe[1] - K, G, G);
+ }
+ Ee.setTransform(1, 0, 0, 1, 0, 0), Ie();
+ };
+ } else
+ Ee.fillStyle = "rgba(0,0,0,0)", ue.options.fillBlanks && (Ee.fillStyle = ue.options.customFillColor), Ee.fillRect(0, 0, K, K), Ie();
+ }, ue = this, he = 0; he < p.length; he++)
+ se(he);
+ }, r.prototype._calculateSize = function() {
+ var t = this.meshes.length || 0, e = this.options.frameSize || 0, n = this._paddingValue || 0;
+ switch (this.options.layout) {
+ case 0:
+ return new c.d(e * t + 2 * n * t, e + 2 * n);
+ case 1:
+ var i = Math.max(2, Math.ceil(Math.sqrt(t))), o = e * i + 2 * n * i;
+ return new c.d(o, o);
+ case 2:
+ var a = this.options.colnum || 1, s = Math.max(1, Math.ceil(t / a));
+ return new c.d(e * a + 2 * n * a, e * s + 2 * n * s);
+ }
+ return c.d.Zero();
+ }, r.prototype._calculateMeshUVFrames = function(t, e, n, i, o) {
+ for (var a = this.meshes.length, s = 0; s < a; s++) {
+ var p = this.meshes[s], m = new c.d(t / n.x, t / n.y), S = i.clone().scale(e), O = this._getFrameOffset(s).add(S), I = new $l(s, m, O);
+ this.frames.push(I), o && (this._updateMeshUV(p, s), this._updateTextureReferences(p));
+ }
+ }, r.prototype._getFrameOffset = function(t) {
+ var e, n, i, o = this.meshes.length;
+ switch (this.options.layout) {
+ case 0:
+ return e = 1 / o, new c.d(t * e, 0);
+ case 1:
+ var a = Math.max(2, Math.ceil(Math.sqrt(o)));
+ return i = t - (n = Math.floor(t / a)) * a, e = 1 / a, new c.d(i * e, n * e);
+ case 2:
+ var s = this.options.colnum || 1, p = Math.max(1, Math.ceil(o / s));
+ return n = t - (i = Math.floor(t / p)) * p, e = new c.d(1 / s, 1 / p), new c.d(i * e.x, n * e.y);
+ }
+ return c.d.Zero();
+ }, r.prototype._updateMeshUV = function(t, e) {
+ var n = this.frames[e], i = t.getVerticesData(this.options.uvsIn || De.b.UVKind), o = [], a = 0;
+ i.length && (a = i.length || 0);
+ for (var s = 0; s < a; s += 2)
+ o.push(i[s] * n.scale.x + n.offset.x, i[s + 1] * n.scale.y + n.offset.y);
+ t.setVerticesData(this.options.uvsOut || De.b.UVKind, o);
+ }, r.prototype._updateTextureReferences = function(t, e) {
+ e === void 0 && (e = !1);
+ for (var n = t.material, i = Object.keys(this.sets), o = function(p) {
+ p.dispose && p.dispose();
+ }, a = 0; a < i.length; a++) {
+ var s = i[a];
+ if (e)
+ n[s] !== null && o(n[s]), n[s] = this.sets[s];
+ else {
+ if (!n)
+ return;
+ n[s] !== null && (o(n[s]), n[s] = this.sets[s]);
+ }
+ }
+ }, r.prototype.setMeshToFrame = function(t, e, n) {
+ n === void 0 && (n = !1), this._updateMeshUV(t, e), n && this._updateTextureReferences(t, !0);
+ }, r.prototype.processAsync = function() {
+ var t = this;
+ return new Promise(function(e, n) {
+ try {
+ if (t.meshes.length === 0)
+ return void e();
+ for (var i = 0, o = function(p) {
+ var m = t.meshes[p], S = m.material;
+ if (!S)
+ return ++i === t.meshes.length ? { value: t._createFrames(e) } : "continue";
+ S.forceCompilationAsync(m).then(function() {
+ (function(O) {
+ if (i++, t.options.map) {
+ for (var I = 0; I < t.options.map.length; I++)
+ O[t.options.map[I]] !== null && (t.sets[t.options.map[I]] || (t.sets[t.options.map[I]] = !0), t._expecting++);
+ i === t.meshes.length && t._createFrames(e);
+ }
+ })(S);
+ });
+ }, a = 0; a < t.meshes.length; a++) {
+ var s = o(a);
+ if (typeof s == "object")
+ return s.value;
+ }
+ } catch (p) {
+ return n(p);
+ }
+ });
+ }, r.prototype.dispose = function() {
+ for (var t = Object.keys(this.sets), e = 0; e < t.length; e++) {
+ var n = t[e];
+ this.sets[n].dispose();
+ }
+ }, r.prototype.download = function(t, e) {
+ var n = this;
+ t === void 0 && (t = "png"), e === void 0 && (e = 1), setTimeout(function() {
+ var i = { name: n.name, sets: {}, options: {}, frames: [] }, o = Object.keys(n.sets), a = Object.keys(n.options);
+ try {
+ for (var s = 0; s < o.length; s++) {
+ var p = o[s], m = n.sets[p];
+ i.sets[p] = m.getContext().canvas.toDataURL("image/" + t, e);
+ }
+ for (s = 0; s < a.length; s++) {
+ var S = a[s];
+ i.options[S] = n.options[S];
+ }
+ for (s = 0; s < n.frames.length; s++) {
+ var O = n.frames[s];
+ i.frames.push(O.scale.x, O.scale.y, O.offset.x, O.offset.y);
+ }
+ } catch (k) {
+ return void h.a.Warn("Unable to download: " + k);
+ }
+ var I = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(i, null, 4)), G = document.createElement("a");
+ G.setAttribute("href", I), G.setAttribute("download", n.name + "_texurePackage.json"), document.body.appendChild(G), G.click(), G.remove();
+ }, 0);
+ }, r.prototype.updateFromJSON = function(t) {
+ try {
+ var e = JSON.parse(t);
+ this.name = e.name;
+ for (var n = Object.keys(e.options), i = 0; i < n.length; i++)
+ this.options[n[i]] = e.options[n[i]];
+ for (i = 0; i < e.frames.length; i += 4) {
+ var o = new $l(i / 4, new c.d(e.frames[i], e.frames[i + 1]), new c.d(e.frames[i + 2], e.frames[i + 3]));
+ this.frames.push(o);
+ }
+ var a = Object.keys(e.sets);
+ for (i = 0; i < a.length; i++) {
+ var s = new Ue.a(e.sets[a[i]], this.scene, !1, !1);
+ this.sets[a[i]] = s;
+ }
+ } catch (p) {
+ h.a.Warn("Unable to update from JSON: " + p);
+ }
+ }, r.LAYOUT_STRIP = 0, r.LAYOUT_POWER2 = 1, r.LAYOUT_COLNUM = 2, r.SUBUV_WRAP = 0, r.SUBUV_EXTEND = 1, r.SUBUV_COLOR = 2, r;
+ }(), cp = function() {
+ function r(t) {
+ this.name = st.a.NAME_PROCEDURALTEXTURE, this.scene = t, this.scene.proceduralTextures = new Array();
+ }
+ return r.prototype.register = function() {
+ this.scene._beforeClearStage.registerStep(st.a.STEP_BEFORECLEAR_PROCEDURALTEXTURE, this, this._beforeClear);
+ }, r.prototype.rebuild = function() {
+ }, r.prototype.dispose = function() {
+ }, r.prototype._beforeClear = function() {
+ if (this.scene.proceduralTexturesEnabled) {
+ Ke.b.StartPerformanceCounter("Procedural textures", this.scene.proceduralTextures.length > 0);
+ for (var t = 0; t < this.scene.proceduralTextures.length; t++) {
+ var e = this.scene.proceduralTextures[t];
+ e._shouldRender() && e.render();
+ }
+ Ke.b.EndPerformanceCounter("Procedural textures", this.scene.proceduralTextures.length > 0);
+ }
+ }, r;
+ }(), v0 = `
+attribute vec2 position;
+
+varying vec2 vPosition;
+varying vec2 vUV;
+const vec2 madd=vec2(0.5,0.5);
+void main(void) {
+vPosition=position;
+vUV=position*madd+madd;
+gl_Position=vec4(position,0.0,1.0);
+}`;
+ We.a.ShadersStore.proceduralVertexShader = v0;
+ var Da = function(r) {
+ function t(e, n, i, o, a, s, p, m) {
+ a === void 0 && (a = null), s === void 0 && (s = !0), p === void 0 && (p = !1), m === void 0 && (m = d.a.TEXTURETYPE_UNSIGNED_INT);
+ var S = r.call(this, null, o, !s) || this;
+ S.isEnabled = !0, S.autoClear = !0, S.onGeneratedObservable = new P.c(), S.onBeforeGenerationObservable = new P.c(), S.nodeMaterialSource = null, S._textures = {}, S._currentRefreshId = -1, S._frameId = -1, S._refreshRate = 1, S._vertexBuffers = {}, S._uniforms = new Array(), S._samplers = new Array(), S._floats = {}, S._ints = {}, S._floatsArrays = {}, S._colors3 = {}, S._colors4 = {}, S._vectors2 = {}, S._vectors3 = {}, S._matrices = {}, S._fallbackTextureUsed = !1, S._cachedDefines = "", S._contentUpdateId = -1;
+ var O = (o = S.getScene() || te.a.LastCreatedScene)._getComponent(st.a.NAME_PROCEDURALTEXTURE);
+ O || (O = new cp(o), o._addComponent(O)), o.proceduralTextures.push(S), S._fullEngine = o.getEngine(), S.name = e, S.isRenderTarget = !0, S._size = n, S._generateMipMaps = s, S.setFragment(i), S._fallbackTexture = a, p ? (S._texture = S._fullEngine.createRenderTargetCubeTexture(n, { generateMipMaps: s, generateDepthBuffer: !1, generateStencilBuffer: !1, type: m }), S.setFloat("face", 0)) : S._texture = S._fullEngine.createRenderTargetTexture(n, { generateMipMaps: s, generateDepthBuffer: !1, generateStencilBuffer: !1, type: m });
+ var I = [];
+ return I.push(1, 1), I.push(-1, 1), I.push(-1, -1), I.push(1, -1), S._vertexBuffers[De.b.PositionKind] = new De.b(S._fullEngine, I, De.b.PositionKind, !1, !1, 2), S._createIndexBuffer(), S;
+ }
+ return Object(u.d)(t, r), t.prototype.getEffect = function() {
+ return this._effect;
+ }, t.prototype.getContent = function() {
+ return this._contentData && this._frameId === this._contentUpdateId || (this._contentData = this.readPixels(0, 0, this._contentData), this._contentUpdateId = this._frameId), this._contentData;
+ }, t.prototype._createIndexBuffer = function() {
+ var e = this._fullEngine, n = [];
+ n.push(0), n.push(1), n.push(2), n.push(0), n.push(2), n.push(3), this._indexBuffer = e.createIndexBuffer(n);
+ }, t.prototype._rebuild = function() {
+ var e = this._vertexBuffers[De.b.PositionKind];
+ e && e._rebuild(), this._createIndexBuffer(), this.refreshRate === bn.REFRESHRATE_RENDER_ONCE && (this.refreshRate = bn.REFRESHRATE_RENDER_ONCE);
+ }, t.prototype.reset = function() {
+ this._effect !== void 0 && this._effect.dispose();
+ }, t.prototype._getDefines = function() {
+ return "";
+ }, t.prototype.isReady = function() {
+ var e, n = this, i = this._fullEngine;
+ if (this.nodeMaterialSource)
+ return this._effect.isReady();
+ if (!this._fragment)
+ return !1;
+ if (this._fallbackTextureUsed)
+ return !0;
+ var o = this._getDefines();
+ return !(!this._effect || o !== this._cachedDefines || !this._effect.isReady()) || (e = this._fragment.fragmentElement !== void 0 ? { vertex: "procedural", fragmentElement: this._fragment.fragmentElement } : { vertex: "procedural", fragment: this._fragment }, this._cachedDefines = o, this._effect = i.createEffect(e, [De.b.PositionKind], this._uniforms, this._samplers, o, void 0, void 0, function() {
+ n.releaseInternalTexture(), n._fallbackTexture && (n._texture = n._fallbackTexture._texture, n._texture && n._texture.incrementReferences()), n._fallbackTextureUsed = !0;
+ }), this._effect.isReady());
+ }, t.prototype.resetRefreshCounter = function() {
+ this._currentRefreshId = -1;
+ }, t.prototype.setFragment = function(e) {
+ this._fragment = e;
+ }, Object.defineProperty(t.prototype, "refreshRate", { get: function() {
+ return this._refreshRate;
+ }, set: function(e) {
+ this._refreshRate = e, this.resetRefreshCounter();
+ }, enumerable: !1, configurable: !0 }), t.prototype._shouldRender = function() {
+ return this.isEnabled && this.isReady() && this._texture ? !this._fallbackTextureUsed && (this._currentRefreshId === -1 || this.refreshRate === this._currentRefreshId ? (this._currentRefreshId = 1, this._frameId++, !0) : (this._currentRefreshId++, !1)) : (this._texture && (this._texture.isReady = !1), !1);
+ }, t.prototype.getRenderSize = function() {
+ return this._size;
+ }, t.prototype.resize = function(e, n) {
+ this._fallbackTextureUsed || (this.releaseInternalTexture(), this._texture = this._fullEngine.createRenderTargetTexture(e, n), this._size = e, this._generateMipMaps = n);
+ }, t.prototype._checkUniform = function(e) {
+ this._uniforms.indexOf(e) === -1 && this._uniforms.push(e);
+ }, t.prototype.setTexture = function(e, n) {
+ return this._samplers.indexOf(e) === -1 && this._samplers.push(e), this._textures[e] = n, this;
+ }, t.prototype.setFloat = function(e, n) {
+ return this._checkUniform(e), this._floats[e] = n, this;
+ }, t.prototype.setInt = function(e, n) {
+ return this._checkUniform(e), this._ints[e] = n, this;
+ }, t.prototype.setFloats = function(e, n) {
+ return this._checkUniform(e), this._floatsArrays[e] = n, this;
+ }, t.prototype.setColor3 = function(e, n) {
+ return this._checkUniform(e), this._colors3[e] = n, this;
+ }, t.prototype.setColor4 = function(e, n) {
+ return this._checkUniform(e), this._colors4[e] = n, this;
+ }, t.prototype.setVector2 = function(e, n) {
+ return this._checkUniform(e), this._vectors2[e] = n, this;
+ }, t.prototype.setVector3 = function(e, n) {
+ return this._checkUniform(e), this._vectors3[e] = n, this;
+ }, t.prototype.setMatrix = function(e, n) {
+ return this._checkUniform(e), this._matrices[e] = n, this;
+ }, t.prototype.render = function(e) {
+ var n = this.getScene();
+ if (n) {
+ var i = this._fullEngine;
+ if (i.enableEffect(this._effect), this.onBeforeGenerationObservable.notifyObservers(this), i.setState(!1), !this.nodeMaterialSource) {
+ for (var o in this._textures)
+ this._effect.setTexture(o, this._textures[o]);
+ for (o in this._ints)
+ this._effect.setInt(o, this._ints[o]);
+ for (o in this._floats)
+ this._effect.setFloat(o, this._floats[o]);
+ for (o in this._floatsArrays)
+ this._effect.setArray(o, this._floatsArrays[o]);
+ for (o in this._colors3)
+ this._effect.setColor3(o, this._colors3[o]);
+ for (o in this._colors4) {
+ var a = this._colors4[o];
+ this._effect.setFloat4(o, a.r, a.g, a.b, a.a);
+ }
+ for (o in this._vectors2)
+ this._effect.setVector2(o, this._vectors2[o]);
+ for (o in this._vectors3)
+ this._effect.setVector3(o, this._vectors3[o]);
+ for (o in this._matrices)
+ this._effect.setMatrix(o, this._matrices[o]);
+ }
+ if (this._texture) {
+ if (this.isCube)
+ for (var s = 0; s < 6; s++)
+ i.bindFramebuffer(this._texture, s, void 0, void 0, !0), i.bindBuffers(this._vertexBuffers, this._indexBuffer, this._effect), this._effect.setFloat("face", s), this.autoClear && i.clear(n.clearColor, !0, !1, !1), i.drawElementsType(Zt.a.TriangleFillMode, 0, 6), s === 5 && i.generateMipMapsForCubemap(this._texture);
+ else
+ i.bindFramebuffer(this._texture, 0, void 0, void 0, !0), i.bindBuffers(this._vertexBuffers, this._indexBuffer, this._effect), this.autoClear && i.clear(n.clearColor, !0, !1, !1), i.drawElementsType(Zt.a.TriangleFillMode, 0, 6);
+ i.unBindFramebuffer(this._texture, this.isCube), this.onGenerated && this.onGenerated(), this.onGeneratedObservable.notifyObservers(this);
+ }
+ }
+ }, t.prototype.clone = function() {
+ var e = this.getSize(), n = new t(this.name, e.width, this._fragment, this.getScene(), this._fallbackTexture, this._generateMipMaps);
+ return n.hasAlpha = this.hasAlpha, n.level = this.level, n.coordinatesMode = this.coordinatesMode, n;
+ }, t.prototype.dispose = function() {
+ var e = this.getScene();
+ if (e) {
+ var n = e.proceduralTextures.indexOf(this);
+ n >= 0 && e.proceduralTextures.splice(n, 1);
+ var i = this._vertexBuffers[De.b.PositionKind];
+ i && (i.dispose(), this._vertexBuffers[De.b.PositionKind] = null), this._indexBuffer && this._fullEngine._releaseBuffer(this._indexBuffer) && (this._indexBuffer = null), this.onGeneratedObservable.clear(), this.onBeforeGenerationObservable.clear(), r.prototype.dispose.call(this);
+ }
+ }, Object(u.c)([Object(w.c)()], t.prototype, "isEnabled", void 0), Object(u.c)([Object(w.c)()], t.prototype, "autoClear", void 0), Object(u.c)([Object(w.c)()], t.prototype, "_generateMipMaps", void 0), Object(u.c)([Object(w.c)()], t.prototype, "_size", void 0), Object(u.c)([Object(w.c)()], t.prototype, "refreshRate", null), t;
+ }(Ue.a);
+ x.a.RegisteredTypes["BABYLON.ProceduralTexture"] = Da;
+ var b0 = function(r) {
+ function t(e, n, i, o, a, s) {
+ var p = r.call(this, e, i, null, o, a, s) || this;
+ return p._animate = !0, p._time = 0, p._texturePath = n, p._loadJson(n), p.refreshRate = 1, p;
+ }
+ return Object(u.d)(t, r), t.prototype._loadJson = function(e) {
+ var n = this, i = function() {
+ try {
+ n.setFragment(n._texturePath);
+ } catch {
+ h.a.Error("No json or ShaderStore or DOM element found for CustomProceduralTexture");
+ }
+ }, o = e + "/config.json", a = new ce.a();
+ a.open("GET", o), a.addEventListener("load", function() {
+ if (a.status === 200 || a.responseText && a.responseText.length > 0)
+ try {
+ n._config = JSON.parse(a.response), n.updateShaderUniforms(), n.updateTextures(), n.setFragment(n._texturePath + "/custom"), n._animate = n._config.animate, n.refreshRate = n._config.refreshrate;
+ } catch {
+ i();
+ }
+ else
+ i();
+ }, !1), a.addEventListener("error", function() {
+ i();
+ }, !1);
+ try {
+ a.send();
+ } catch {
+ h.a.Error("CustomProceduralTexture: Error on XHR send request.");
+ }
+ }, t.prototype.isReady = function() {
+ if (!r.prototype.isReady.call(this))
+ return !1;
+ for (var e in this._textures)
+ if (!this._textures[e].isReady())
+ return !1;
+ return !0;
+ }, t.prototype.render = function(e) {
+ var n = this.getScene();
+ this._animate && n && (this._time += 0.03 * n.getAnimationRatio(), this.updateShaderUniforms()), r.prototype.render.call(this, e);
+ }, t.prototype.updateTextures = function() {
+ for (var e = 0; e < this._config.sampler2Ds.length; e++)
+ this.setTexture(this._config.sampler2Ds[e].sample2Dname, new Ue.a(this._texturePath + "/" + this._config.sampler2Ds[e].textureRelativeUrl, this.getScene()));
+ }, t.prototype.updateShaderUniforms = function() {
+ if (this._config)
+ for (var e = 0; e < this._config.uniforms.length; e++) {
+ var n = this._config.uniforms[e];
+ switch (n.type) {
+ case "float":
+ this.setFloat(n.name, n.value);
+ break;
+ case "color3":
+ this.setColor3(n.name, new C.a(n.r, n.g, n.b));
+ break;
+ case "color4":
+ this.setColor4(n.name, new C.b(n.r, n.g, n.b, n.a));
+ break;
+ case "vector2":
+ this.setVector2(n.name, new c.d(n.x, n.y));
+ break;
+ case "vector3":
+ this.setVector3(n.name, new c.e(n.x, n.y, n.z));
+ }
+ }
+ this.setFloat("time", this._time);
+ }, Object.defineProperty(t.prototype, "animate", { get: function() {
+ return this._animate;
+ }, set: function(e) {
+ this._animate = e;
+ }, enumerable: !1, configurable: !0 }), t;
+ }(Da), y0 = `
+
+uniform float brightness;
+uniform float persistence;
+uniform float timeScale;
+
+varying vec2 vUV;
+
+vec2 hash22(vec2 p)
+{
+p=p*mat2(127.1,311.7,269.5,183.3);
+p=-1.0+2.0*fract(sin(p)*43758.5453123);
+return sin(p*6.283+timeScale);
+}
+float interpolationNoise(vec2 p)
+{
+vec2 pi=floor(p);
+vec2 pf=p-pi;
+vec2 w=pf*pf*(3.-2.*pf);
+float f00=dot(hash22(pi+vec2(.0,.0)),pf-vec2(.0,.0));
+float f01=dot(hash22(pi+vec2(.0,1.)),pf-vec2(.0,1.));
+float f10=dot(hash22(pi+vec2(1.0,0.)),pf-vec2(1.0,0.));
+float f11=dot(hash22(pi+vec2(1.0,1.)),pf-vec2(1.0,1.));
+float xm1=mix(f00,f10,w.x);
+float xm2=mix(f01,f11,w.x);
+float ym=mix(xm1,xm2,w.y);
+return ym;
+}
+float perlinNoise2D(float x,float y)
+{
+float sum=0.0;
+float frequency=0.0;
+float amplitude=0.0;
+for(int i=0; i 0;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "isConnectedInVertexShader", { get: function() {
+ if (this.target === Me.Vertex)
+ return !0;
+ if (!this.hasEndpoints)
+ return !1;
+ for (var t = 0, e = this._endpoints; t < e.length; t++) {
+ var n = e[t];
+ if (n.ownerBlock.target === Me.Vertex || n.target === Me.Vertex || (n.ownerBlock.target === Me.Neutral || n.ownerBlock.target === Me.VertexAndFragment) && n.ownerBlock.outputs.some(function(i) {
+ return i.isConnectedInVertexShader;
+ }))
+ return !0;
+ }
+ return !1;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "isConnectedInFragmentShader", { get: function() {
+ if (this.target === Me.Fragment)
+ return !0;
+ if (!this.hasEndpoints)
+ return !1;
+ for (var t = 0, e = this._endpoints; t < e.length; t++) {
+ var n = e[t];
+ if (n.ownerBlock.target === Me.Fragment || (n.ownerBlock.target === Me.Neutral || n.ownerBlock.target === Me.VertexAndFragment) && n.ownerBlock.outputs.some(function(i) {
+ return i.isConnectedInFragmentShader;
+ }))
+ return !0;
+ }
+ return !1;
+ }, enumerable: !1, configurable: !0 }), r.prototype.createCustomInputBlock = function() {
+ return null;
+ }, r.prototype.getClassName = function() {
+ return "NodeMaterialConnectionPoint";
+ }, r.prototype.canConnectTo = function(t) {
+ return this.checkCompatibilityState(t) === Ri.Compatible;
+ }, r.prototype.checkCompatibilityState = function(t) {
+ if (this._ownerBlock.target === Me.Fragment) {
+ var e = t.ownerBlock;
+ if (e.target === Me.Vertex)
+ return Ri.TargetIncompatible;
+ for (var n = 0, i = e.outputs; n < i.length; n++)
+ if (i[n].isConnectedInVertexShader)
+ return Ri.TargetIncompatible;
+ }
+ return this.type !== t.type && t.innerType !== fe.AutoDetect ? r.AreEquivalentTypes(this.type, t.type) || t.acceptedConnectionPointTypes && t.acceptedConnectionPointTypes.indexOf(this.type) !== -1 || t._acceptedConnectionPointType && r.AreEquivalentTypes(t._acceptedConnectionPointType.type, this.type) ? Ri.Compatible : Ri.TypeIncompatible : t.excludedConnectionPointTypes && t.excludedConnectionPointTypes.indexOf(this.type) !== -1 ? 1 : Ri.Compatible;
+ }, r.prototype.connectTo = function(t, e) {
+ if (e === void 0 && (e = !1), !e && !this.canConnectTo(t))
+ throw "Cannot connect these two connectors.";
+ return this._endpoints.push(t), t._connectedPoint = this, this._enforceAssociatedVariableName = !1, this.onConnectionObservable.notifyObservers(t), t.onConnectionObservable.notifyObservers(this), this;
+ }, r.prototype.disconnectFrom = function(t) {
+ var e = this._endpoints.indexOf(t);
+ return e === -1 || (this._endpoints.splice(e, 1), t._connectedPoint = null, this._enforceAssociatedVariableName = !1, t._enforceAssociatedVariableName = !1), this;
+ }, r.prototype.serialize = function(t) {
+ t === void 0 && (t = !0);
+ var e = {};
+ return e.name = this.name, e.displayName = this.displayName, t && this.connectedPoint && (e.inputName = this.name, e.targetBlockId = this.connectedPoint.ownerBlock.uniqueId, e.targetConnectionName = this.connectedPoint.name, e.isExposedOnFrame = !0, e.exposedPortPosition = this.exposedPortPosition), (this.isExposedOnFrame || this.exposedPortPosition >= 0) && (e.isExposedOnFrame = !0, e.exposedPortPosition = this.exposedPortPosition), e;
+ }, r.prototype.dispose = function() {
+ this.onConnectionObservable.clear();
+ }, r;
+ }(), P0 = l(152), pt = function() {
+ function r(t, e, n, i) {
+ e === void 0 && (e = Me.Vertex), n === void 0 && (n = !1), i === void 0 && (i = !1), this._isFinalMerger = !1, this._isInput = !1, this._name = "", this._isUnique = !1, this.inputsAreExclusive = !1, this._codeVariableName = "", this._inputs = new Array(), this._outputs = new Array(), this.comments = "", this.visibleInInspector = !1, this._target = e, this._isFinalMerger = n, this._isInput = i, this._name = t, this.uniqueId = P0.a.UniqueId;
+ }
+ return Object.defineProperty(r.prototype, "name", { get: function() {
+ return this._name;
+ }, set: function(t) {
+ this.validateBlockName(t) && (this._name = t);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "isUnique", { get: function() {
+ return this._isUnique;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "isFinalMerger", { get: function() {
+ return this._isFinalMerger;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "isInput", { get: function() {
+ return this._isInput;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "buildId", { get: function() {
+ return this._buildId;
+ }, set: function(t) {
+ this._buildId = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "target", { get: function() {
+ return this._target;
+ }, set: function(t) {
+ !(this._target & t) && (this._target = t);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "inputs", { get: function() {
+ return this._inputs;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "outputs", { get: function() {
+ return this._outputs;
+ }, enumerable: !1, configurable: !0 }), r.prototype.getInputByName = function(t) {
+ var e = this._inputs.filter(function(n) {
+ return n.name === t;
+ });
+ return e.length ? e[0] : null;
+ }, r.prototype.getOutputByName = function(t) {
+ var e = this._outputs.filter(function(n) {
+ return n.name === t;
+ });
+ return e.length ? e[0] : null;
+ }, r.prototype.initialize = function(t) {
+ }, r.prototype.bind = function(t, e, n, i) {
+ }, r.prototype._declareOutput = function(t, e) {
+ return e._getGLType(t.type) + " " + t.associatedVariableName;
+ }, r.prototype._writeVariable = function(t) {
+ return t.connectedPoint ? "" + t.associatedVariableName : "0.";
+ }, r.prototype._writeFloat = function(t) {
+ var e = t.toString();
+ return e.indexOf(".") === -1 && (e += ".0"), "" + e;
+ }, r.prototype.getClassName = function() {
+ return "NodeMaterialBlock";
+ }, r.prototype.registerInput = function(t, e, n, i, o) {
+ return n === void 0 && (n = !1), (o = o ?? new Ws(t, this, Dn.Input)).type = e, o.isOptional = n, i && (o.target = i), this._inputs.push(o), this;
+ }, r.prototype.registerOutput = function(t, e, n, i) {
+ return (i = i ?? new Ws(t, this, Dn.Output)).type = e, n && (i.target = n), this._outputs.push(i), this;
+ }, r.prototype.getFirstAvailableInput = function(t) {
+ t === void 0 && (t = null);
+ for (var e = 0, n = this._inputs; e < n.length; e++) {
+ var i = n[e];
+ if (!(i.connectedPoint || t && t.type !== i.type && i.type !== fe.AutoDetect))
+ return i;
+ }
+ return null;
+ }, r.prototype.getFirstAvailableOutput = function(t) {
+ t === void 0 && (t = null);
+ for (var e = 0, n = this._outputs; e < n.length; e++) {
+ var i = n[e];
+ if (!t || !t.target || t.target === Me.Neutral || t.target & i.target)
+ return i;
+ }
+ return null;
+ }, r.prototype.getSiblingOutput = function(t) {
+ var e = this._outputs.indexOf(t);
+ return e === -1 || e >= this._outputs.length ? null : this._outputs[e + 1];
+ }, r.prototype.connectTo = function(t, e) {
+ if (this._outputs.length !== 0) {
+ for (var n = e && e.output ? this.getOutputByName(e.output) : this.getFirstAvailableOutput(t), i = !0; i; ) {
+ var o = e && e.input ? t.getInputByName(e.input) : t.getFirstAvailableInput(n);
+ if (n && o && n.canConnectTo(o))
+ n.connectTo(o), i = !1;
+ else {
+ if (!n)
+ throw "Unable to find a compatible match";
+ n = this.getSiblingOutput(n);
+ }
+ }
+ return this;
+ }
+ }, r.prototype._buildBlock = function(t) {
+ }, r.prototype.updateUniformsAndSamples = function(t, e, n, i) {
+ }, r.prototype.provideFallbacks = function(t, e) {
+ }, r.prototype.initializeDefines = function(t, e, n, i) {
+ }, r.prototype.prepareDefines = function(t, e, n, i, o) {
+ }, r.prototype.autoConfigure = function(t) {
+ }, r.prototype.replaceRepeatableContent = function(t, e, n, i) {
+ }, r.prototype.isReady = function(t, e, n, i) {
+ return !0;
+ }, r.prototype._linkConnectionTypes = function(t, e, n) {
+ n === void 0 && (n = !1), n ? this._inputs[e]._acceptedConnectionPointType = this._inputs[t] : this._inputs[t]._linkedConnectionSource = this._inputs[e], this._inputs[e]._linkedConnectionSource = this._inputs[t];
+ }, r.prototype._processBuild = function(t, e, n, i) {
+ t.build(e, i);
+ var o = e._vertexState != null, a = t._buildTarget === Me.Vertex && t.target !== Me.VertexAndFragment;
+ if (o && (!(t.target & t._buildTarget) || !(t.target & n.target) || this.target !== Me.VertexAndFragment && a) && (!t.isInput && e.target !== t._buildTarget || t.isInput && t.isAttribute && !t._noContextSwitch)) {
+ var s = n.connectedPoint;
+ e._vertexState._emitVaryingFromString("v_" + s.associatedVariableName, e._getGLType(s.type)) && (e._vertexState.compilationString += "v_" + s.associatedVariableName + " = " + s.associatedVariableName + `;\r
+`), n.associatedVariableName = "v_" + s.associatedVariableName, n._enforceAssociatedVariableName = !0;
+ }
+ }, r.prototype.validateBlockName = function(t) {
+ for (var e = 0, n = ["position", "normal", "tangent", "particle_positionw", "uv", "uv2", "position2d", "particle_uv", "matricesIndices", "matricesWeights", "world0", "world1", "world2", "world3", "particle_color", "particle_texturemask"]; e < n.length; e++)
+ if (t === n[e])
+ return !1;
+ return !0;
+ }, r.prototype.build = function(t, e) {
+ if (this._buildId === t.sharedData.buildId)
+ return !0;
+ if (!this.isInput)
+ for (var n = 0, i = this._outputs; n < i.length; n++)
+ (S = i[n]).associatedVariableName || (S.associatedVariableName = t._getFreeVariableName(S.name));
+ for (var o = 0, a = this._inputs; o < a.length; o++) {
+ var s = a[o];
+ if (s.connectedPoint) {
+ if (this.target !== Me.Neutral && (!(s.target & this.target) || !(s.target & t.target)))
+ continue;
+ (G = s.connectedPoint.ownerBlock) && G !== this && this._processBuild(G, t, s, e);
+ } else
+ s.isOptional || t.sharedData.checks.notConnectedNonOptionalInputs.push(s);
+ }
+ if (this._buildId === t.sharedData.buildId)
+ return !0;
+ if (t.sharedData.verbose && console.log((t.target === Me.Vertex ? "Vertex shader" : "Fragment shader") + ": Building " + this.name + " [" + this.getClassName() + "]"), this.isFinalMerger)
+ switch (t.target) {
+ case Me.Vertex:
+ t.sharedData.checks.emitVertex = !0;
+ break;
+ case Me.Fragment:
+ t.sharedData.checks.emitFragment = !0;
+ }
+ !this.isInput && t.sharedData.emitComments && (t.compilationString += `\r
+//` + this.name + `\r
+`), this._buildBlock(t), this._buildId = t.sharedData.buildId, this._buildTarget = t.target;
+ for (var p = 0, m = this._outputs; p < m.length; p++) {
+ var S;
+ if ((S = m[p]).target & t.target)
+ for (var O = 0, I = S.endpoints; O < I.length; O++) {
+ var G, k = I[O];
+ (G = k.ownerBlock) && G.target & t.target && e.indexOf(G) !== -1 && this._processBuild(G, t, k, e);
+ }
+ }
+ return !1;
+ }, r.prototype._inputRename = function(t) {
+ return t;
+ }, r.prototype._outputRename = function(t) {
+ return t;
+ }, r.prototype._dumpPropertiesCode = function() {
+ return this._codeVariableName + ".visibleInInspector = " + this.visibleInInspector + `;\r
+`;
+ }, r.prototype._dumpCode = function(t, e) {
+ var n;
+ e.push(this);
+ var i = this.name.replace(/[^A-Za-z_]+/g, "");
+ if (this._codeVariableName = i || this.getClassName() + "_" + this.uniqueId, t.indexOf(this._codeVariableName) !== -1) {
+ var o = 0;
+ do
+ o++, this._codeVariableName = i + o;
+ while (t.indexOf(this._codeVariableName) !== -1);
+ }
+ t.push(this._codeVariableName), n = `\r
+// ` + this.getClassName() + `\r
+`, this.comments && (n += "// " + this.comments + `\r
+`), n += "var " + this._codeVariableName + " = new BABYLON." + this.getClassName() + '("' + this.name + `");\r
+`, n += this._dumpPropertiesCode();
+ for (var a = 0, s = this.inputs; a < s.length; a++) {
+ var p = s[a];
+ if (p.isConnected) {
+ var m = p.connectedPoint.ownerBlock;
+ e.indexOf(m) === -1 && (n += m._dumpCode(t, e));
+ }
+ }
+ for (var S = 0, O = this.outputs; S < O.length; S++) {
+ var I = O[S];
+ if (I.hasEndpoints)
+ for (var G = 0, k = I.endpoints; G < k.length; G++)
+ (m = k[G].ownerBlock) && e.indexOf(m) === -1 && (n += m._dumpCode(t, e));
+ }
+ return n;
+ }, r.prototype._dumpCodeForOutputConnections = function(t) {
+ var e = "";
+ if (t.indexOf(this) !== -1)
+ return e;
+ t.push(this);
+ for (var n = 0, i = this.inputs; n < i.length; n++) {
+ var o = i[n];
+ if (o.isConnected) {
+ var a = o.connectedPoint, s = a.ownerBlock;
+ e += s._dumpCodeForOutputConnections(t), e += s._codeVariableName + "." + s._outputRename(a.name) + ".connectTo(" + this._codeVariableName + "." + this._inputRename(o.name) + `);\r
+`;
+ }
+ }
+ return e;
+ }, r.prototype.clone = function(t, e) {
+ e === void 0 && (e = "");
+ var n = this.serialize(), i = x.a.GetClass(n.customType);
+ if (i) {
+ var o = new i();
+ return o._deserialize(n, t, e), o;
+ }
+ return null;
+ }, r.prototype.serialize = function() {
+ var t = {};
+ t.customType = "BABYLON." + this.getClassName(), t.id = this.uniqueId, t.name = this.name, t.comments = this.comments, t.visibleInInspector = this.visibleInInspector, t.inputs = [], t.outputs = [];
+ for (var e = 0, n = this.inputs; e < n.length; e++) {
+ var i = n[e];
+ t.inputs.push(i.serialize());
+ }
+ for (var o = 0, a = this.outputs; o < a.length; o++) {
+ var s = a[o];
+ t.outputs.push(s.serialize(!1));
+ }
+ return t;
+ }, r.prototype._deserialize = function(t, e, n) {
+ this.name = t.name, this.comments = t.comments, this.visibleInInspector = !!t.visibleInInspector, this._deserializePortDisplayNamesAndExposedOnFrame(t);
+ }, r.prototype._deserializePortDisplayNamesAndExposedOnFrame = function(t) {
+ var e = this, n = t.inputs, i = t.outputs;
+ n && n.forEach(function(o, a) {
+ o.displayName && (e.inputs[a].displayName = o.displayName), o.isExposedOnFrame && (e.inputs[a].isExposedOnFrame = o.isExposedOnFrame, e.inputs[a].exposedPortPosition = o.exposedPortPosition);
+ }), i && i.forEach(function(o, a) {
+ o.displayName && (e.outputs[a].displayName = o.displayName), o.isExposedOnFrame && (e.outputs[a].isExposedOnFrame = o.isExposedOnFrame, e.outputs[a].exposedPortPosition = o.exposedPortPosition);
+ });
+ }, r.prototype.dispose = function() {
+ for (var t = 0, e = this.inputs; t < e.length; t++)
+ e[t].dispose();
+ for (var n = 0, i = this.outputs; n < i.length; n++)
+ i[n].dispose();
+ }, r;
+ }(), up = function() {
+ function r() {
+ this.supportUniformBuffers = !1, this.attributes = new Array(), this.uniforms = new Array(), this.constants = new Array(), this.samplers = new Array(), this.functions = {}, this.extensions = {}, this.counters = {}, this._attributeDeclaration = "", this._uniformDeclaration = "", this._constantDeclaration = "", this._samplerDeclaration = "", this._varyingTransfer = "", this._injectAtEnd = "", this._repeatableContentAnchorIndex = 0, this._builtCompilationString = "", this.compilationString = "";
+ }
+ return r.prototype.finalize = function(t) {
+ var e = t.sharedData.emitComments, n = this.target === Me.Fragment;
+ this.compilationString = `\r
+` + (e ? `//Entry point\r
+` : "") + `void main(void) {\r
+` + this.compilationString, this._constantDeclaration && (this.compilationString = `\r
+` + (e ? `//Constants\r
+` : "") + this._constantDeclaration + `\r
+` + this.compilationString);
+ var i = "";
+ for (var o in this.functions)
+ i += this.functions[o] + `\r
+`;
+ for (var a in this.compilationString = `\r
+` + i + `\r
+` + this.compilationString, !n && this._varyingTransfer && (this.compilationString = this.compilationString + `\r
+` + this._varyingTransfer), this._injectAtEnd && (this.compilationString = this.compilationString + `\r
+` + this._injectAtEnd), this.compilationString = this.compilationString + `\r
+}`, this.sharedData.varyingDeclaration && (this.compilationString = `\r
+` + (e ? `//Varyings\r
+` : "") + this.sharedData.varyingDeclaration + `\r
+` + this.compilationString), this._samplerDeclaration && (this.compilationString = `\r
+` + (e ? `//Samplers\r
+` : "") + this._samplerDeclaration + `\r
+` + this.compilationString), this._uniformDeclaration && (this.compilationString = `\r
+` + (e ? `//Uniforms\r
+` : "") + this._uniformDeclaration + `\r
+` + this.compilationString), this._attributeDeclaration && !n && (this.compilationString = `\r
+` + (e ? `//Attributes\r
+` : "") + this._attributeDeclaration + `\r
+` + this.compilationString), this.compilationString = `precision highp float;\r
+` + this.compilationString, this.extensions) {
+ var s = this.extensions[a];
+ this.compilationString = `\r
+` + s + `\r
+` + this.compilationString;
+ }
+ this._builtCompilationString = this.compilationString;
+ }, Object.defineProperty(r.prototype, "_repeatableContentAnchor", { get: function() {
+ return "###___ANCHOR" + this._repeatableContentAnchorIndex++ + "___###";
+ }, enumerable: !1, configurable: !0 }), r.prototype._getFreeVariableName = function(t) {
+ return t = t.replace(/[^a-zA-Z_]+/g, ""), this.sharedData.variableNames[t] === void 0 ? (this.sharedData.variableNames[t] = 0, t === "output" || t === "texture" ? t + this.sharedData.variableNames[t] : t) : (this.sharedData.variableNames[t]++, t + this.sharedData.variableNames[t]);
+ }, r.prototype._getFreeDefineName = function(t) {
+ return this.sharedData.defineNames[t] === void 0 ? this.sharedData.defineNames[t] = 0 : this.sharedData.defineNames[t]++, t + this.sharedData.defineNames[t];
+ }, r.prototype._excludeVariableName = function(t) {
+ this.sharedData.variableNames[t] = 0;
+ }, r.prototype._emit2DSampler = function(t) {
+ this.samplers.indexOf(t) < 0 && (this._samplerDeclaration += "uniform sampler2D " + t + `;\r
+`, this.samplers.push(t));
+ }, r.prototype._getGLType = function(t) {
+ switch (t) {
+ case fe.Float:
+ return "float";
+ case fe.Int:
+ return "int";
+ case fe.Vector2:
+ return "vec2";
+ case fe.Color3:
+ case fe.Vector3:
+ return "vec3";
+ case fe.Color4:
+ case fe.Vector4:
+ return "vec4";
+ case fe.Matrix:
+ return "mat4";
+ }
+ return "";
+ }, r.prototype._emitExtension = function(t, e, n) {
+ n === void 0 && (n = ""), this.extensions[t] || (n && (e = "#if " + n + `\r
+` + e + `\r
+#endif`), this.extensions[t] = e);
+ }, r.prototype._emitFunction = function(t, e, n) {
+ this.functions[t] || (this.sharedData.emitComments && (e = n + `\r
+` + e), this.functions[t] = e);
+ }, r.prototype._emitCodeFromInclude = function(t, e, n) {
+ if (n && n.repeatKey)
+ return "#include<" + t + ">[0.." + n.repeatKey + `]\r
+`;
+ var i = We.a.IncludesShadersStore[t] + `\r
+`;
+ if (this.sharedData.emitComments && (i = e + `\r
+` + i), !n)
+ return i;
+ if (n.replaceStrings)
+ for (var o = 0; o < n.replaceStrings.length; o++) {
+ var a = n.replaceStrings[o];
+ i = i.replace(a.search, a.replace);
+ }
+ return i;
+ }, r.prototype._emitFunctionFromInclude = function(t, e, n, i) {
+ i === void 0 && (i = "");
+ var o = t + i;
+ if (!this.functions[o]) {
+ if (!(n && (n.removeAttributes || n.removeUniforms || n.removeVaryings || n.removeIfDef || n.replaceStrings)))
+ return n && n.repeatKey ? this.functions[o] = "#include<" + t + ">[0.." + n.repeatKey + `]\r
+` : this.functions[o] = "#include<" + t + `>\r
+`, void (this.sharedData.emitComments && (this.functions[o] = e + `\r
+` + this.functions[o]));
+ if (this.functions[o] = We.a.IncludesShadersStore[t], this.sharedData.emitComments && (this.functions[o] = e + `\r
+` + this.functions[o]), n.removeIfDef && (this.functions[o] = this.functions[o].replace(/^\s*?#ifdef.+$/gm, ""), this.functions[o] = this.functions[o].replace(/^\s*?#endif.*$/gm, ""), this.functions[o] = this.functions[o].replace(/^\s*?#else.*$/gm, ""), this.functions[o] = this.functions[o].replace(/^\s*?#elif.*$/gm, "")), n.removeAttributes && (this.functions[o] = this.functions[o].replace(/^\s*?attribute.+$/gm, "")), n.removeUniforms && (this.functions[o] = this.functions[o].replace(/^\s*?uniform.+$/gm, "")), n.removeVaryings && (this.functions[o] = this.functions[o].replace(/^\s*?varying.+$/gm, "")), n.replaceStrings)
+ for (var a = 0; a < n.replaceStrings.length; a++) {
+ var s = n.replaceStrings[a];
+ this.functions[o] = this.functions[o].replace(s.search, s.replace);
+ }
+ }
+ }, r.prototype._registerTempVariable = function(t) {
+ return this.sharedData.temps.indexOf(t) === -1 && (this.sharedData.temps.push(t), !0);
+ }, r.prototype._emitVaryingFromString = function(t, e, n, i) {
+ return n === void 0 && (n = ""), i === void 0 && (i = !1), this.sharedData.varyings.indexOf(t) === -1 && (this.sharedData.varyings.push(t), n && (ui.a.StartsWith(n, "defined(") ? this.sharedData.varyingDeclaration += "#if " + n + `\r
+` : this.sharedData.varyingDeclaration += (i ? "#ifndef" : "#ifdef") + " " + n + `\r
+`), this.sharedData.varyingDeclaration += "varying " + e + " " + t + `;\r
+`, n && (this.sharedData.varyingDeclaration += `#endif\r
+`), !0);
+ }, r.prototype._emitUniformFromString = function(t, e, n, i) {
+ n === void 0 && (n = ""), i === void 0 && (i = !1), this.uniforms.indexOf(t) === -1 && (this.uniforms.push(t), n && (ui.a.StartsWith(n, "defined(") ? this._uniformDeclaration += "#if " + n + `\r
+` : this._uniformDeclaration += (i ? "#ifndef" : "#ifdef") + " " + n + `\r
+`), this._uniformDeclaration += "uniform " + e + " " + t + `;\r
+`, n && (this._uniformDeclaration += `#endif\r
+`));
+ }, r.prototype._emitFloat = function(t) {
+ return t.toString() === t.toFixed(0) ? t + ".0" : t.toString();
+ }, r;
+ }(), C0 = function() {
+ function r() {
+ this.temps = new Array(), this.varyings = new Array(), this.varyingDeclaration = "", this.inputBlocks = new Array(), this.textureBlocks = new Array(), this.bindableBlocks = new Array(), this.blocksWithFallbacks = new Array(), this.blocksWithDefines = new Array(), this.repeatableContentBlocks = new Array(), this.dynamicUniformBlocks = new Array(), this.blockingBlocks = new Array(), this.animatedInputs = new Array(), this.variableNames = {}, this.defineNames = {}, this.hints = { needWorldViewMatrix: !1, needWorldViewProjectionMatrix: !1, needAlphaBlending: !1, needAlphaTesting: !1 }, this.checks = { emitVertex: !1, emitFragment: !1, notConnectedNonOptionalInputs: new Array() }, this.allowEmptyVertexProgram = !1, this.variableNames.position = 0, this.variableNames.normal = 0, this.variableNames.tangent = 0, this.variableNames.uv = 0, this.variableNames.uv2 = 0, this.variableNames.uv3 = 0, this.variableNames.uv4 = 0, this.variableNames.uv4 = 0, this.variableNames.uv5 = 0, this.variableNames.uv6 = 0, this.variableNames.color = 0, this.variableNames.matricesIndices = 0, this.variableNames.matricesWeights = 0, this.variableNames.matricesIndicesExtra = 0, this.variableNames.matricesWeightsExtra = 0, this.variableNames.diffuseBase = 0, this.variableNames.specularBase = 0, this.variableNames.worldPos = 0, this.variableNames.shadow = 0, this.variableNames.view = 0, this.variableNames.vTBN = 0, this.defineNames.MAINUV0 = 0, this.defineNames.MAINUV1 = 0, this.defineNames.MAINUV2 = 0, this.defineNames.MAINUV3 = 0, this.defineNames.MAINUV4 = 0, this.defineNames.MAINUV5 = 0, this.defineNames.MAINUV6 = 0, this.defineNames.MAINUV7 = 0;
+ }
+ return r.prototype.emitErrors = function() {
+ var t = "";
+ this.checks.emitVertex || this.allowEmptyVertexProgram || (t += `NodeMaterial does not have a vertex output. You need to at least add a block that generates a glPosition value.\r
+`), this.checks.emitFragment || (t += `NodeMaterial does not have a fragment output. You need to at least add a block that generates a glFragColor value.\r
+`);
+ for (var e = 0, n = this.checks.notConnectedNonOptionalInputs; e < n.length; e++) {
+ var i = n[e];
+ t += "input " + i.name + " from block " + i.ownerBlock.name + "[" + i.ownerBlock.getClassName() + `] is not connected and is not optional.\r
+`;
+ }
+ if (t)
+ throw `Build of NodeMaterial failed:\r
+` + t;
+ }, r;
+ }(), Xs = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Vertex) || this;
+ return n.complementW = 1, n.complementZ = 0, n.registerInput("vector", fe.AutoDetect), n.registerInput("transform", fe.Matrix), n.registerOutput("output", fe.Vector4), n.registerOutput("xyz", fe.Vector3), n._inputs[0].onConnectionObservable.add(function(i) {
+ if (i.ownerBlock.isInput) {
+ var o = i.ownerBlock;
+ o.name !== "normal" && o.name !== "tangent" || (n.complementW = 0);
+ }
+ }), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "TransformBlock";
+ }, Object.defineProperty(t.prototype, "vector", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "xyz", { get: function() {
+ return this._outputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "transform", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this.vector, i = this.transform;
+ if (n.connectedPoint) {
+ if (this.complementW === 0) {
+ var o = "//" + this.name;
+ e._emitFunctionFromInclude("helperFunctions", o), e.sharedData.blocksWithDefines.push(this);
+ var a = e._getFreeVariableName(i.associatedVariableName + "_NUS");
+ switch (e.compilationString += "mat3 " + a + " = mat3(" + i.associatedVariableName + `);\r
+`, e.compilationString += `#ifdef NONUNIFORMSCALING\r
+`, e.compilationString += a + " = transposeMat3(inverseMat3(" + a + `));\r
+`, e.compilationString += `#endif\r
+`, n.connectedPoint.type) {
+ case fe.Vector2:
+ e.compilationString += this._declareOutput(this.output, e) + " = vec4(" + a + " * vec3(" + n.associatedVariableName + ", " + this._writeFloat(this.complementZ) + "), " + this._writeFloat(this.complementW) + `);\r
+`;
+ break;
+ case fe.Vector3:
+ case fe.Color3:
+ e.compilationString += this._declareOutput(this.output, e) + " = vec4(" + a + " * " + n.associatedVariableName + ", " + this._writeFloat(this.complementW) + `);\r
+`;
+ break;
+ default:
+ e.compilationString += this._declareOutput(this.output, e) + " = vec4(" + a + " * " + n.associatedVariableName + ".xyz, " + this._writeFloat(this.complementW) + `);\r
+`;
+ }
+ } else
+ switch (a = i.associatedVariableName, n.connectedPoint.type) {
+ case fe.Vector2:
+ e.compilationString += this._declareOutput(this.output, e) + " = " + a + " * vec4(" + n.associatedVariableName + ", " + this._writeFloat(this.complementZ) + ", " + this._writeFloat(this.complementW) + `);\r
+`;
+ break;
+ case fe.Vector3:
+ case fe.Color3:
+ e.compilationString += this._declareOutput(this.output, e) + " = " + a + " * vec4(" + n.associatedVariableName + ", " + this._writeFloat(this.complementW) + `);\r
+`;
+ break;
+ default:
+ e.compilationString += this._declareOutput(this.output, e) + " = " + a + " * " + n.associatedVariableName + `;\r
+`;
+ }
+ this.xyz.hasEndpoints && (e.compilationString += this._declareOutput(this.xyz, e) + " = " + this.output.associatedVariableName + `.xyz;\r
+`);
+ }
+ return this;
+ }, t.prototype.prepareDefines = function(e, n, i, o, a) {
+ e.nonUniformScaling && i.setValue("NONUNIFORMSCALING", !0);
+ }, t.prototype.serialize = function() {
+ var e = r.prototype.serialize.call(this);
+ return e.complementZ = this.complementZ, e.complementW = this.complementW, e;
+ }, t.prototype._deserialize = function(e, n, i) {
+ r.prototype._deserialize.call(this, e, n, i), this.complementZ = e.complementZ !== void 0 ? e.complementZ : 0, this.complementW = e.complementW !== void 0 ? e.complementW : 1;
+ }, t.prototype._dumpPropertiesCode = function() {
+ var e = this._codeVariableName + ".complementZ = " + this.complementZ + `;\r
+`;
+ return e += this._codeVariableName + ".complementW = " + this.complementW + `;\r
+`;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.TransformBlock"] = Xs;
+ var La = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Vertex, !0) || this;
+ return n.registerInput("vector", fe.Vector4), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "VertexOutputBlock";
+ }, Object.defineProperty(t.prototype, "vector", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this.vector;
+ return e.compilationString += "gl_Position = " + n.associatedVariableName + `;\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.VertexOutputBlock"] = La;
+ var Tr, No = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Fragment, !0) || this;
+ return n.registerInput("rgba", fe.Color4, !0), n.registerInput("rgb", fe.Color3, !0), n.registerInput("a", fe.Float, !0), n.rgb.acceptedConnectionPointTypes.push(fe.Float), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "FragmentOutputBlock";
+ }, Object.defineProperty(t.prototype, "rgba", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "rgb", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "a", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this.rgba, i = this.rgb, o = this.a;
+ if (e.sharedData.hints.needAlphaBlending = n.isConnected || o.isConnected, n.connectedPoint)
+ o.isConnected ? e.compilationString += "gl_FragColor = vec4(" + n.associatedVariableName + ".rgb, " + o.associatedVariableName + `);\r
+` : e.compilationString += "gl_FragColor = " + n.associatedVariableName + `;\r
+`;
+ else if (i.connectedPoint) {
+ var a = "1.0";
+ o.connectedPoint && (a = o.associatedVariableName), i.connectedPoint.type === fe.Float ? e.compilationString += "gl_FragColor = vec4(" + i.associatedVariableName + ", " + i.associatedVariableName + ", " + i.associatedVariableName + ", " + a + `);\r
+` : e.compilationString += "gl_FragColor = vec4(" + i.associatedVariableName + ", " + a + `);\r
+`;
+ } else
+ e.sharedData.checks.notConnectedNonOptionalInputs.push(n);
+ return this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.FragmentOutputBlock"] = No, function(r) {
+ r[r.None = 0] = "None", r[r.Time = 1] = "Time";
+ }(Tr || (Tr = {}));
+ var x0 = { position2d: "position", particle_uv: "vUV", particle_color: "vColor", particle_texturemask: "textureMask", particle_positionw: "vPositionW" }, eu = { particle_uv: !0, particle_color: !0, particle_texturemask: !0, particle_positionw: !0 }, hp = { particle_texturemask: !0 }, At = function(r) {
+ function t(e, n, i) {
+ n === void 0 && (n = Me.Vertex), i === void 0 && (i = fe.AutoDetect);
+ var o = r.call(this, e, n, !1, !0) || this;
+ return o._mode = On.Undefined, o._animationType = Tr.None, o.min = 0, o.max = 0, o.isBoolean = !1, o.matrixMode = 0, o._systemValue = null, o.isConstant = !1, o.groupInInspector = "", o.onValueChangedObservable = new P.c(), o.convertToGammaSpace = !1, o.convertToLinearSpace = !1, o._type = i, o.setDefaultValue(), o.registerOutput("output", i), o;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "type", { get: function() {
+ if (this._type === fe.AutoDetect) {
+ if (this.isUniform && this.value != null) {
+ if (!isNaN(this.value))
+ return this._type = fe.Float, this._type;
+ switch (this.value.getClassName()) {
+ case "Vector2":
+ return this._type = fe.Vector2, this._type;
+ case "Vector3":
+ return this._type = fe.Vector3, this._type;
+ case "Vector4":
+ return this._type = fe.Vector4, this._type;
+ case "Color3":
+ return this._type = fe.Color3, this._type;
+ case "Color4":
+ return this._type = fe.Color4, this._type;
+ case "Matrix":
+ return this._type = fe.Matrix, this._type;
+ }
+ }
+ if (this.isAttribute)
+ switch (this.name) {
+ case "position":
+ case "normal":
+ case "tangent":
+ case "particle_positionw":
+ return this._type = fe.Vector3, this._type;
+ case "uv":
+ case "uv2":
+ case "position2d":
+ case "particle_uv":
+ return this._type = fe.Vector2, this._type;
+ case "matricesIndices":
+ case "matricesWeights":
+ case "world0":
+ case "world1":
+ case "world2":
+ case "world3":
+ return this._type = fe.Vector4, this._type;
+ case "color":
+ case "particle_color":
+ case "particle_texturemask":
+ return this._type = fe.Color4, this._type;
+ }
+ if (this.isSystemValue)
+ switch (this._systemValue) {
+ case bt.World:
+ case bt.WorldView:
+ case bt.WorldViewProjection:
+ case bt.View:
+ case bt.ViewProjection:
+ case bt.Projection:
+ return this._type = fe.Matrix, this._type;
+ case bt.CameraPosition:
+ return this._type = fe.Vector3, this._type;
+ case bt.FogColor:
+ return this._type = fe.Color3, this._type;
+ case bt.DeltaTime:
+ return this._type = fe.Float, this._type;
+ }
+ }
+ return this._type;
+ }, enumerable: !1, configurable: !0 }), t.prototype.validateBlockName = function(e) {
+ return !!this.isAttribute || r.prototype.validateBlockName.call(this, e);
+ }, Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype.setAsAttribute = function(e) {
+ return this._mode = On.Attribute, e && (this.name = e), this;
+ }, t.prototype.setAsSystemValue = function(e) {
+ return this.systemValue = e, this;
+ }, Object.defineProperty(t.prototype, "value", { get: function() {
+ return this._storedValue;
+ }, set: function(e) {
+ this.type === fe.Float && (this.isBoolean ? e = e ? 1 : 0 : this.min !== this.max && (e = Math.max(this.min, e), e = Math.min(this.max, e))), this._storedValue = e, this._mode = On.Uniform, this.onValueChangedObservable.notifyObservers(this);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "valueCallback", { get: function() {
+ return this._valueCallback;
+ }, set: function(e) {
+ this._valueCallback = e, this._mode = On.Uniform;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "associatedVariableName", { get: function() {
+ return this._associatedVariableName;
+ }, set: function(e) {
+ this._associatedVariableName = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "animationType", { get: function() {
+ return this._animationType;
+ }, set: function(e) {
+ this._animationType = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "isUndefined", { get: function() {
+ return this._mode === On.Undefined;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "isUniform", { get: function() {
+ return this._mode === On.Uniform;
+ }, set: function(e) {
+ this._mode = e ? On.Uniform : On.Undefined, this.associatedVariableName = "";
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "isAttribute", { get: function() {
+ return this._mode === On.Attribute;
+ }, set: function(e) {
+ this._mode = e ? On.Attribute : On.Undefined, this.associatedVariableName = "";
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "isVarying", { get: function() {
+ return this._mode === On.Varying;
+ }, set: function(e) {
+ this._mode = e ? On.Varying : On.Undefined, this.associatedVariableName = "";
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "isSystemValue", { get: function() {
+ return this._systemValue != null;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "systemValue", { get: function() {
+ return this._systemValue;
+ }, set: function(e) {
+ this._mode = On.Uniform, this.associatedVariableName = "", this._systemValue = e;
+ }, enumerable: !1, configurable: !0 }), t.prototype.getClassName = function() {
+ return "InputBlock";
+ }, t.prototype.animate = function(e) {
+ switch (this._animationType) {
+ case Tr.Time:
+ this.type === fe.Float && (this.value += 0.01 * e.getAnimationRatio());
+ }
+ }, t.prototype._emitDefine = function(e) {
+ return e[0] === "!" ? "#ifndef " + e.substring(1) + `\r
+` : "#ifdef " + e + `\r
+`;
+ }, t.prototype.initialize = function(e) {
+ this.associatedVariableName = "";
+ }, t.prototype.setDefaultValue = function() {
+ switch (this.type) {
+ case fe.Float:
+ this.value = 0;
+ break;
+ case fe.Vector2:
+ this.value = c.d.Zero();
+ break;
+ case fe.Vector3:
+ this.value = c.e.Zero();
+ break;
+ case fe.Vector4:
+ this.value = c.f.Zero();
+ break;
+ case fe.Color3:
+ this.value = C.a.White();
+ break;
+ case fe.Color4:
+ this.value = new C.b(1, 1, 1, 1);
+ break;
+ case fe.Matrix:
+ this.value = c.a.Identity();
+ }
+ }, t.prototype._emitConstant = function(e) {
+ switch (this.type) {
+ case fe.Float:
+ return "" + e._emitFloat(this.value);
+ case fe.Vector2:
+ return "vec2(" + this.value.x + ", " + this.value.y + ")";
+ case fe.Vector3:
+ return "vec3(" + this.value.x + ", " + this.value.y + ", " + this.value.z + ")";
+ case fe.Vector4:
+ return "vec4(" + this.value.x + ", " + this.value.y + ", " + this.value.z + ", " + this.value.w + ")";
+ case fe.Color3:
+ return C.c.Color3[0].set(this.value.r, this.value.g, this.value.b), this.convertToGammaSpace && C.c.Color3[0].toGammaSpaceToRef(C.c.Color3[0]), this.convertToLinearSpace && C.c.Color3[0].toLinearSpaceToRef(C.c.Color3[0]), "vec3(" + C.c.Color3[0].r + ", " + C.c.Color3[0].g + ", " + C.c.Color3[0].b + ")";
+ case fe.Color4:
+ return C.c.Color4[0].set(this.value.r, this.value.g, this.value.b, this.value.a), this.convertToGammaSpace && C.c.Color4[0].toGammaSpaceToRef(C.c.Color4[0]), this.convertToLinearSpace && C.c.Color4[0].toLinearSpaceToRef(C.c.Color4[0]), "vec4(" + C.c.Color4[0].r + ", " + C.c.Color4[0].g + ", " + C.c.Color4[0].b + ", " + C.c.Color4[0].a + ")";
+ }
+ return "";
+ }, Object.defineProperty(t.prototype, "_noContextSwitch", { get: function() {
+ return eu[this.name];
+ }, enumerable: !1, configurable: !0 }), t.prototype._emit = function(e, n) {
+ var i;
+ if (this.isUniform) {
+ if (this.associatedVariableName || (this.associatedVariableName = e._getFreeVariableName("u_" + this.name)), this.isConstant)
+ return e.constants.indexOf(this.associatedVariableName) !== -1 ? void 0 : (e.constants.push(this.associatedVariableName), void (e._constantDeclaration += this._declareOutput(this.output, e) + " = " + this._emitConstant(e) + `;\r
+`));
+ if (e.uniforms.indexOf(this.associatedVariableName) !== -1)
+ return;
+ e.uniforms.push(this.associatedVariableName), n && (e._uniformDeclaration += this._emitDefine(n)), e._uniformDeclaration += "uniform " + e._getGLType(this.type) + " " + this.associatedVariableName + `;\r
+`, n && (e._uniformDeclaration += `#endif\r
+`);
+ var o = e.sharedData.hints;
+ if (this._systemValue !== null && this._systemValue !== void 0)
+ switch (this._systemValue) {
+ case bt.WorldView:
+ o.needWorldViewMatrix = !0;
+ break;
+ case bt.WorldViewProjection:
+ o.needWorldViewProjectionMatrix = !0;
+ }
+ else
+ this._animationType !== Tr.None && e.sharedData.animatedInputs.push(this);
+ } else if (this.isAttribute) {
+ if (this.associatedVariableName = (i = x0[this.name]) !== null && i !== void 0 ? i : this.name, this.target === Me.Vertex && e._vertexState)
+ return void (eu[this.name] ? hp[this.name] ? e._emitUniformFromString(this.associatedVariableName, e._getGLType(this.type), n) : e._emitVaryingFromString(this.associatedVariableName, e._getGLType(this.type), n) : this._emit(e._vertexState, n));
+ if (e.attributes.indexOf(this.associatedVariableName) !== -1)
+ return;
+ e.attributes.push(this.associatedVariableName), eu[this.name] ? hp[this.name] ? e._emitUniformFromString(this.associatedVariableName, e._getGLType(this.type), n) : e._emitVaryingFromString(this.associatedVariableName, e._getGLType(this.type), n) : (n && (e._attributeDeclaration += this._emitDefine(n)), e._attributeDeclaration += "attribute " + e._getGLType(this.type) + " " + this.associatedVariableName + `;\r
+`, n && (e._attributeDeclaration += `#endif\r
+`));
+ }
+ }, t.prototype._transmitWorld = function(e, n, i, o) {
+ if (this._systemValue) {
+ var a = this.associatedVariableName;
+ switch (this._systemValue) {
+ case bt.World:
+ e.setMatrix(a, n);
+ break;
+ case bt.WorldView:
+ e.setMatrix(a, i);
+ break;
+ case bt.WorldViewProjection:
+ e.setMatrix(a, o);
+ }
+ }
+ }, t.prototype._transmit = function(e, n) {
+ if (!this.isAttribute) {
+ var i = this.associatedVariableName;
+ if (this._systemValue)
+ switch (this._systemValue) {
+ case bt.World:
+ case bt.WorldView:
+ case bt.WorldViewProjection:
+ return;
+ case bt.View:
+ e.setMatrix(i, n.getViewMatrix());
+ break;
+ case bt.Projection:
+ e.setMatrix(i, n.getProjectionMatrix());
+ break;
+ case bt.ViewProjection:
+ e.setMatrix(i, n.getTransformMatrix());
+ break;
+ case bt.CameraPosition:
+ tt.a.BindEyePosition(e, n, i);
+ break;
+ case bt.FogColor:
+ e.setColor3(i, n.fogColor);
+ break;
+ case bt.DeltaTime:
+ e.setFloat(i, n.deltaTime / 1e3);
+ }
+ else {
+ var o = this._valueCallback ? this._valueCallback() : this._storedValue;
+ if (o !== null)
+ switch (this.type) {
+ case fe.Float:
+ e.setFloat(i, o);
+ break;
+ case fe.Int:
+ e.setInt(i, o);
+ break;
+ case fe.Color3:
+ C.c.Color3[0].set(this.value.r, this.value.g, this.value.b), this.convertToGammaSpace && C.c.Color3[0].toGammaSpaceToRef(C.c.Color3[0]), this.convertToLinearSpace && C.c.Color3[0].toLinearSpaceToRef(C.c.Color3[0]), e.setColor3(i, C.c.Color3[0]);
+ break;
+ case fe.Color4:
+ C.c.Color4[0].set(this.value.r, this.value.g, this.value.b, this.value.a), this.convertToGammaSpace && C.c.Color4[0].toGammaSpaceToRef(C.c.Color4[0]), this.convertToLinearSpace && C.c.Color4[0].toLinearSpaceToRef(C.c.Color4[0]), e.setDirectColor4(i, C.c.Color4[0]);
+ break;
+ case fe.Vector2:
+ e.setVector2(i, o);
+ break;
+ case fe.Vector3:
+ e.setVector3(i, o);
+ break;
+ case fe.Vector4:
+ e.setVector4(i, o);
+ break;
+ case fe.Matrix:
+ e.setMatrix(i, o);
+ }
+ }
+ }
+ }, t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e), (this.isUniform || this.isSystemValue) && e.sharedData.inputBlocks.push(this), this._emit(e);
+ }, t.prototype._dumpPropertiesCode = function() {
+ var e = this._codeVariableName;
+ if (this.isAttribute)
+ return e + '.setAsAttribute("' + this.name + `");\r
+`;
+ if (this.isSystemValue)
+ return e + ".setAsSystemValue(BABYLON.NodeMaterialSystemValues." + bt[this._systemValue] + `);\r
+`;
+ if (this.isUniform) {
+ var n = [], i = "";
+ switch (this.type) {
+ case fe.Float:
+ i = "" + this.value;
+ break;
+ case fe.Vector2:
+ i = "new BABYLON.Vector2(" + this.value.x + ", " + this.value.y + ")";
+ break;
+ case fe.Vector3:
+ i = "new BABYLON.Vector3(" + this.value.x + ", " + this.value.y + ", " + this.value.z + ")";
+ break;
+ case fe.Vector4:
+ i = "new BABYLON.Vector4(" + this.value.x + ", " + this.value.y + ", " + this.value.z + ", " + this.value.w + ")";
+ break;
+ case fe.Color3:
+ i = "new BABYLON.Color3(" + this.value.r + ", " + this.value.g + ", " + this.value.b + ")", this.convertToGammaSpace && (i += ".toGammaSpace()"), this.convertToLinearSpace && (i += ".toLinearSpace()");
+ break;
+ case fe.Color4:
+ i = "new BABYLON.Color4(" + this.value.r + ", " + this.value.g + ", " + this.value.b + ", " + this.value.a + ")", this.convertToGammaSpace && (i += ".toGammaSpace()"), this.convertToLinearSpace && (i += ".toLinearSpace()");
+ break;
+ case fe.Matrix:
+ i = "BABYLON.Matrix.FromArray([" + this.value.m + "])";
+ }
+ return n.push(e + ".value = " + i), this.type === fe.Float && n.push(e + ".min = " + this.min, e + ".max = " + this.max, e + ".isBoolean = " + this.isBoolean, e + ".matrixMode = " + this.matrixMode, e + ".animationType = BABYLON.AnimatedInputBlockTypes." + Tr[this.animationType]), n.push(e + ".isConstant = " + this.isConstant), n.push(""), n.join(`;\r
+`);
+ }
+ return "";
+ }, t.prototype.dispose = function() {
+ this.onValueChangedObservable.clear(), r.prototype.dispose.call(this);
+ }, t.prototype.serialize = function() {
+ var e = r.prototype.serialize.call(this);
+ return e.type = this.type, e.mode = this._mode, e.systemValue = this._systemValue, e.animationType = this._animationType, e.min = this.min, e.max = this.max, e.isBoolean = this.isBoolean, e.matrixMode = this.matrixMode, e.isConstant = this.isConstant, e.groupInInspector = this.groupInInspector, e.convertToGammaSpace = this.convertToGammaSpace, e.convertToLinearSpace = this.convertToLinearSpace, this._storedValue != null && this._mode === On.Uniform && (this._storedValue.asArray ? (e.valueType = "BABYLON." + this._storedValue.getClassName(), e.value = this._storedValue.asArray()) : (e.valueType = "number", e.value = this._storedValue)), e;
+ }, t.prototype._deserialize = function(e, n, i) {
+ if (this._mode = e.mode, r.prototype._deserialize.call(this, e, n, i), this._type = e.type, this._systemValue = e.systemValue || e.wellKnownValue, this._animationType = e.animationType, this.min = e.min || 0, this.max = e.max || 0, this.isBoolean = !!e.isBoolean, this.matrixMode = e.matrixMode || 0, this.isConstant = !!e.isConstant, this.groupInInspector = e.groupInInspector || "", this.convertToGammaSpace = !!e.convertToGammaSpace, this.convertToLinearSpace = !!e.convertToLinearSpace, e.valueType)
+ if (e.valueType === "number")
+ this._storedValue = e.value;
+ else {
+ var o = x.a.GetClass(e.valueType);
+ o && (this._storedValue = o.FromArray(e.value));
+ }
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.InputBlock"] = At;
+ var tu = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.VertexAndFragment) || this;
+ return n._samplerName = "textureSampler", n.convertToGammaSpace = !1, n.convertToLinearSpace = !1, n._isUnique = !1, n.registerInput("uv", fe.Vector2, !1, Me.VertexAndFragment), n.registerOutput("rgba", fe.Color4, Me.Neutral), n.registerOutput("rgb", fe.Color3, Me.Neutral), n.registerOutput("r", fe.Float, Me.Neutral), n.registerOutput("g", fe.Float, Me.Neutral), n.registerOutput("b", fe.Float, Me.Neutral), n.registerOutput("a", fe.Float, Me.Neutral), n._inputs[0].acceptedConnectionPointTypes.push(fe.Vector3), n._inputs[0].acceptedConnectionPointTypes.push(fe.Vector4), n._inputs[0]._prioritizeVertex = !1, n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "CurrentScreenBlock";
+ }, Object.defineProperty(t.prototype, "uv", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "rgba", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "rgb", { get: function() {
+ return this._outputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "r", { get: function() {
+ return this._outputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "g", { get: function() {
+ return this._outputs[3];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "b", { get: function() {
+ return this._outputs[4];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "a", { get: function() {
+ return this._outputs[5];
+ }, enumerable: !1, configurable: !0 }), t.prototype.initialize = function(e) {
+ e._excludeVariableName("textureSampler");
+ }, Object.defineProperty(t.prototype, "target", { get: function() {
+ return this.uv.isConnected ? this.uv.sourceBlock.isInput ? Me.VertexAndFragment : Me.Fragment : Me.VertexAndFragment;
+ }, enumerable: !1, configurable: !0 }), t.prototype.prepareDefines = function(e, n, i) {
+ i.setValue(this._linearDefineName, this.convertToGammaSpace, !0), i.setValue(this._gammaDefineName, this.convertToLinearSpace, !0);
+ }, t.prototype.isReady = function() {
+ return !(this.texture && !this.texture.isReadyOrNotBlocking());
+ }, t.prototype._injectVertexCode = function(e) {
+ var n = this.uv;
+ if (n.connectedPoint.ownerBlock.isInput && (n.connectedPoint.ownerBlock.isAttribute || e._emitUniformFromString(n.associatedVariableName, "vec2")), this._mainUVName = "vMain" + n.associatedVariableName, e._emitVaryingFromString(this._mainUVName, "vec2"), e.compilationString += this._mainUVName + " = " + n.associatedVariableName + `.xy;\r
+`, this._outputs.some(function(s) {
+ return s.isConnectedInVertexShader;
+ })) {
+ this._writeTextureRead(e, !0);
+ for (var i = 0, o = this._outputs; i < o.length; i++) {
+ var a = o[i];
+ a.hasEndpoints && this._writeOutput(e, a, a.name, !0);
+ }
+ }
+ }, t.prototype._writeTextureRead = function(e, n) {
+ n === void 0 && (n = !1);
+ var i = this.uv;
+ if (n) {
+ if (e.target === Me.Fragment)
+ return;
+ e.compilationString += "vec4 " + this._tempTextureRead + " = texture2D(" + this._samplerName + ", " + i.associatedVariableName + `);\r
+`;
+ } else
+ this.uv.ownerBlock.target !== Me.Fragment ? e.compilationString += "vec4 " + this._tempTextureRead + " = texture2D(" + this._samplerName + ", " + this._mainUVName + `);\r
+` : e.compilationString += "vec4 " + this._tempTextureRead + " = texture2D(" + this._samplerName + ", " + i.associatedVariableName + `);\r
+`;
+ }, t.prototype._writeOutput = function(e, n, i, o) {
+ if (o === void 0 && (o = !1), o) {
+ if (e.target === Me.Fragment)
+ return;
+ e.compilationString += this._declareOutput(n, e) + " = " + this._tempTextureRead + "." + i + `;\r
+`;
+ } else
+ this.uv.ownerBlock.target !== Me.Fragment ? (e.compilationString += this._declareOutput(n, e) + " = " + this._tempTextureRead + "." + i + `;\r
+`, e.compilationString += "#ifdef " + this._linearDefineName + `\r
+`, e.compilationString += n.associatedVariableName + " = toGammaSpace(" + n.associatedVariableName + `);\r
+`, e.compilationString += `#endif\r
+`, e.compilationString += "#ifdef " + this._gammaDefineName + `\r
+`, e.compilationString += n.associatedVariableName + " = toLinearSpace(" + n.associatedVariableName + `);\r
+`, e.compilationString += `#endif\r
+`) : e.compilationString += this._declareOutput(n, e) + " = " + this._tempTextureRead + "." + i + `;\r
+`;
+ }, t.prototype._buildBlock = function(e) {
+ if (r.prototype._buildBlock.call(this, e), this._tempTextureRead = e._getFreeVariableName("tempTextureRead"), e.sharedData.blockingBlocks.indexOf(this) < 0 && e.sharedData.blockingBlocks.push(this), e.sharedData.textureBlocks.indexOf(this) < 0 && e.sharedData.textureBlocks.push(this), e.sharedData.blocksWithDefines.indexOf(this) < 0 && e.sharedData.blocksWithDefines.push(this), e.target !== Me.Fragment)
+ return e._emit2DSampler(this._samplerName), void this._injectVertexCode(e);
+ if (this._outputs.some(function(s) {
+ return s.isConnectedInFragmentShader;
+ })) {
+ e._emit2DSampler(this._samplerName), this._linearDefineName = e._getFreeDefineName("ISLINEAR"), this._gammaDefineName = e._getFreeDefineName("ISGAMMA");
+ var n = "//" + this.name;
+ e._emitFunctionFromInclude("helperFunctions", n), this._writeTextureRead(e);
+ for (var i = 0, o = this._outputs; i < o.length; i++) {
+ var a = o[i];
+ a.hasEndpoints && this._writeOutput(e, a, a.name);
+ }
+ return this;
+ }
+ }, t.prototype.serialize = function() {
+ var e = r.prototype.serialize.call(this);
+ return e.convertToGammaSpace = this.convertToGammaSpace, e.convertToLinearSpace = this.convertToLinearSpace, this.texture && (e.texture = this.texture.serialize()), e;
+ }, t.prototype._deserialize = function(e, n, i) {
+ r.prototype._deserialize.call(this, e, n, i), this.convertToGammaSpace = e.convertToGammaSpace, this.convertToLinearSpace = !!e.convertToLinearSpace, e.texture && (i = e.texture.url.indexOf("data:") === 0 ? "" : i, this.texture = Ue.a.Parse(e.texture, n, i));
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.CurrentScreenBlock"] = tu;
+ var nu = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Fragment) || this;
+ return n._samplerName = "diffuseSampler", n.convertToGammaSpace = !1, n.convertToLinearSpace = !1, n._isUnique = !1, n.registerInput("uv", fe.Vector2, !1, Me.VertexAndFragment), n.registerOutput("rgba", fe.Color4, Me.Neutral), n.registerOutput("rgb", fe.Color3, Me.Neutral), n.registerOutput("r", fe.Float, Me.Neutral), n.registerOutput("g", fe.Float, Me.Neutral), n.registerOutput("b", fe.Float, Me.Neutral), n.registerOutput("a", fe.Float, Me.Neutral), n._inputs[0].acceptedConnectionPointTypes.push(fe.Vector3), n._inputs[0].acceptedConnectionPointTypes.push(fe.Vector4), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "ParticleTextureBlock";
+ }, Object.defineProperty(t.prototype, "uv", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "rgba", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "rgb", { get: function() {
+ return this._outputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "r", { get: function() {
+ return this._outputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "g", { get: function() {
+ return this._outputs[3];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "b", { get: function() {
+ return this._outputs[4];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "a", { get: function() {
+ return this._outputs[5];
+ }, enumerable: !1, configurable: !0 }), t.prototype.initialize = function(e) {
+ e._excludeVariableName("diffuseSampler");
+ }, t.prototype.autoConfigure = function(e) {
+ if (!this.uv.isConnected) {
+ var n = e.getInputBlockByPredicate(function(i) {
+ return i.isAttribute && i.name === "particle_uv";
+ });
+ n || (n = new At("uv")).setAsAttribute("particle_uv"), n.output.connectTo(this.uv);
+ }
+ }, t.prototype.prepareDefines = function(e, n, i) {
+ i.setValue(this._linearDefineName, this.convertToGammaSpace, !0), i.setValue(this._gammaDefineName, this.convertToLinearSpace, !0);
+ }, t.prototype.isReady = function() {
+ return !(this.texture && !this.texture.isReadyOrNotBlocking());
+ }, t.prototype._writeOutput = function(e, n, i) {
+ e.compilationString += this._declareOutput(n, e) + " = " + this._tempTextureRead + "." + i + `;\r
+`, e.compilationString += "#ifdef " + this._linearDefineName + `\r
+`, e.compilationString += n.associatedVariableName + " = toGammaSpace(" + n.associatedVariableName + `);\r
+`, e.compilationString += `#endif\r
+`, e.compilationString += "#ifdef " + this._gammaDefineName + `\r
+`, e.compilationString += n.associatedVariableName + " = toLinearSpace(" + n.associatedVariableName + `);\r
+`, e.compilationString += `#endif\r
+`;
+ }, t.prototype._buildBlock = function(e) {
+ if (r.prototype._buildBlock.call(this, e), e.target !== Me.Vertex) {
+ this._tempTextureRead = e._getFreeVariableName("tempTextureRead"), e._emit2DSampler(this._samplerName), e.sharedData.blockingBlocks.push(this), e.sharedData.textureBlocks.push(this), e.sharedData.blocksWithDefines.push(this), this._linearDefineName = e._getFreeDefineName("ISLINEAR"), this._gammaDefineName = e._getFreeDefineName("ISGAMMA");
+ var n = "//" + this.name;
+ e._emitFunctionFromInclude("helperFunctions", n), e.compilationString += "vec4 " + this._tempTextureRead + " = texture2D(" + this._samplerName + ", " + this.uv.associatedVariableName + `);\r
+`;
+ for (var i = 0, o = this._outputs; i < o.length; i++) {
+ var a = o[i];
+ a.hasEndpoints && this._writeOutput(e, a, a.name);
+ }
+ return this;
+ }
+ }, t.prototype.serialize = function() {
+ var e = r.prototype.serialize.call(this);
+ return e.convertToGammaSpace = this.convertToGammaSpace, e.convertToLinearSpace = this.convertToLinearSpace, this.texture && (e.texture = this.texture.serialize()), e;
+ }, t.prototype._deserialize = function(e, n, i) {
+ r.prototype._deserialize.call(this, e, n, i), this.convertToGammaSpace = e.convertToGammaSpace, this.convertToLinearSpace = !!e.convertToLinearSpace, e.texture && (i = e.texture.url.indexOf("data:") === 0 ? "" : i, this.texture = Ue.a.Parse(e.texture, n, i));
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.ParticleTextureBlock"] = nu;
+ var iu = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Fragment) || this;
+ return n._isUnique = !0, n.registerInput("color", fe.Color4, !1, Me.Fragment), n.registerOutput("rampColor", fe.Color4, Me.Fragment), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "ParticleRampGradientBlock";
+ }, Object.defineProperty(t.prototype, "color", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "rampColor", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype.initialize = function(e) {
+ e._excludeVariableName("remapRanges"), e._excludeVariableName("rampSampler"), e._excludeVariableName("baseColor"), e._excludeVariableName("alpha"), e._excludeVariableName("remappedColorIndex"), e._excludeVariableName("rampColor"), e._excludeVariableName("finalAlpha");
+ }, t.prototype._buildBlock = function(e) {
+ if (r.prototype._buildBlock.call(this, e), e.target !== Me.Vertex)
+ return e._emit2DSampler("rampSampler"), e._emitVaryingFromString("remapRanges", "vec4", "RAMPGRADIENT"), e.compilationString += `
+ #ifdef RAMPGRADIENT
+ vec4 baseColor = ` + this.color.associatedVariableName + `;
+ float alpha = ` + this.color.associatedVariableName + `.a;
+
+ float remappedColorIndex = clamp((alpha - remapRanges.x) / remapRanges.y, 0.0, 1.0);
+
+ vec4 rampColor = texture2D(rampSampler, vec2(1.0 - remappedColorIndex, 0.));
+ baseColor.rgb *= rampColor.rgb;
+
+ // Remapped alpha
+ float finalAlpha = baseColor.a;
+ baseColor.a = clamp((alpha * rampColor.a - remapRanges.z) / remapRanges.w, 0.0, 1.0);
+
+ ` + this._declareOutput(this.rampColor, e) + ` = baseColor;
+ #else
+ ` + this._declareOutput(this.rampColor, e) + " = " + this.color.associatedVariableName + `;
+ #endif
+ `, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.ParticleRampGradientBlock"] = iu;
+ var ru = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Fragment) || this;
+ return n._isUnique = !0, n.registerInput("color", fe.Color4, !1, Me.Fragment), n.registerInput("alphaTexture", fe.Float, !1, Me.Fragment), n.registerInput("alphaColor", fe.Float, !1, Me.Fragment), n.registerOutput("blendColor", fe.Color4, Me.Fragment), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "ParticleBlendMultiplyBlock";
+ }, Object.defineProperty(t.prototype, "color", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "alphaTexture", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "alphaColor", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "blendColor", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype.initialize = function(e) {
+ e._excludeVariableName("sourceAlpha");
+ }, t.prototype._buildBlock = function(e) {
+ if (r.prototype._buildBlock.call(this, e), e.target !== Me.Vertex)
+ return e.compilationString += `
+ #ifdef BLENDMULTIPLYMODE
+ ` + this._declareOutput(this.blendColor, e) + `;
+ float sourceAlpha = ` + this.alphaColor.associatedVariableName + " * " + this.alphaTexture.associatedVariableName + `;
+ ` + this.blendColor.associatedVariableName + ".rgb = " + this.color.associatedVariableName + `.rgb * sourceAlpha + vec3(1.0) * (1.0 - sourceAlpha);
+ ` + this.blendColor.associatedVariableName + ".a = " + this.color.associatedVariableName + `.a;
+ #else
+ ` + this._declareOutput(this.blendColor, e) + " = " + this.color.associatedVariableName + `;
+ #endif
+ `, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.ParticleBlendMultiplyBlock"] = ru;
+ var Ft, wa = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("xyz ", fe.Vector3, !0), n.registerInput("xy ", fe.Vector2, !0), n.registerInput("x", fe.Float, !0), n.registerInput("y", fe.Float, !0), n.registerInput("z", fe.Float, !0), n.registerInput("w", fe.Float, !0), n.registerOutput("xyzw", fe.Vector4), n.registerOutput("xyz", fe.Vector3), n.registerOutput("xy", fe.Vector2), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "VectorMergerBlock";
+ }, Object.defineProperty(t.prototype, "xyzIn", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "xyIn", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "x", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "y", { get: function() {
+ return this._inputs[3];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "z", { get: function() {
+ return this._inputs[4];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "w", { get: function() {
+ return this._inputs[5];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "xyzw", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "xyzOut", { get: function() {
+ return this._outputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "xyOut", { get: function() {
+ return this._outputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "xy", { get: function() {
+ return this.xyOut;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "xyz", { get: function() {
+ return this.xyzOut;
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this.x, i = this.y, o = this.z, a = this.w, s = this.xyIn, p = this.xyzIn, m = this._outputs[0], S = this._outputs[1], O = this._outputs[2];
+ return p.isConnected ? m.hasEndpoints ? e.compilationString += this._declareOutput(m, e) + " = vec4(" + p.associatedVariableName + ", " + (a.isConnected ? this._writeVariable(a) : "0.0") + `);\r
+` : S.hasEndpoints ? e.compilationString += this._declareOutput(S, e) + " = " + p.associatedVariableName + `;\r
+` : O.hasEndpoints && (e.compilationString += this._declareOutput(O, e) + " = " + p.associatedVariableName + `.xy;\r
+`) : s.isConnected ? m.hasEndpoints ? e.compilationString += this._declareOutput(m, e) + " = vec4(" + s.associatedVariableName + ", " + (o.isConnected ? this._writeVariable(o) : "0.0") + ", " + (a.isConnected ? this._writeVariable(a) : "0.0") + `);\r
+` : S.hasEndpoints ? e.compilationString += this._declareOutput(S, e) + " = vec3(" + s.associatedVariableName + ", " + (o.isConnected ? this._writeVariable(o) : "0.0") + `);\r
+` : O.hasEndpoints && (e.compilationString += this._declareOutput(O, e) + " = " + s.associatedVariableName + `;\r
+`) : m.hasEndpoints ? e.compilationString += this._declareOutput(m, e) + " = vec4(" + (n.isConnected ? this._writeVariable(n) : "0.0") + ", " + (i.isConnected ? this._writeVariable(i) : "0.0") + ", " + (o.isConnected ? this._writeVariable(o) : "0.0") + ", " + (a.isConnected ? this._writeVariable(a) : "0.0") + `);\r
+` : S.hasEndpoints ? e.compilationString += this._declareOutput(S, e) + " = vec3(" + (n.isConnected ? this._writeVariable(n) : "0.0") + ", " + (i.isConnected ? this._writeVariable(i) : "0.0") + ", " + (o.isConnected ? this._writeVariable(o) : "0.0") + `);\r
+` : O.hasEndpoints && (e.compilationString += this._declareOutput(O, e) + " = vec2(" + (n.isConnected ? this._writeVariable(n) : "0.0") + ", " + (i.isConnected ? this._writeVariable(i) : "0.0") + `);\r
+`), this;
+ }, t;
+ }(pt);
+ function jt(r, t, e, n) {
+ return t === void 0 && (t = Ft.Boolean), e === void 0 && (e = "PROPERTIES"), function(i, o) {
+ var a = i._propStore;
+ a || (a = [], i._propStore = a), a.push({ propertyName: o, displayName: r, type: t, groupName: e, options: n ?? {} });
+ };
+ }
+ x.a.RegisteredTypes["BABYLON.VectorMergerBlock"] = wa, function(r) {
+ r[r.Boolean = 0] = "Boolean", r[r.Float = 1] = "Float", r[r.Vector2 = 2] = "Vector2", r[r.List = 3] = "List";
+ }(Ft || (Ft = {}));
+ var ou = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.sourceRange = new c.d(-1, 1), n.targetRange = new c.d(0, 1), n.registerInput("input", fe.AutoDetect), n.registerInput("sourceMin", fe.Float, !0), n.registerInput("sourceMax", fe.Float, !0), n.registerInput("targetMin", fe.Float, !0), n.registerInput("targetMax", fe.Float, !0), n.registerOutput("output", fe.BasedOnInput), n._outputs[0]._typeConnectionSource = n._inputs[0], n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "RemapBlock";
+ }, Object.defineProperty(t.prototype, "input", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "sourceMin", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "sourceMax", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "targetMin", { get: function() {
+ return this._inputs[3];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "targetMax", { get: function() {
+ return this._inputs[4];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0], i = this.sourceMin.isConnected ? this.sourceMin.associatedVariableName : this._writeFloat(this.sourceRange.x), o = this.sourceMax.isConnected ? this.sourceMax.associatedVariableName : this._writeFloat(this.sourceRange.y), a = this.targetMin.isConnected ? this.targetMin.associatedVariableName : this._writeFloat(this.targetRange.x), s = this.targetMax.isConnected ? this.targetMax.associatedVariableName : this._writeFloat(this.targetRange.y);
+ return e.compilationString += this._declareOutput(n, e) + " = " + a + " + (" + this._inputs[0].associatedVariableName + " - " + i + ") * (" + s + " - " + a + ") / (" + o + " - " + i + `);\r
+`, this;
+ }, t.prototype._dumpPropertiesCode = function() {
+ var e = this._codeVariableName + ".sourceRange = new BABYLON.Vector2(" + this.sourceRange.x + ", " + this.sourceRange.y + `);\r
+`;
+ return e += this._codeVariableName + ".targetRange = new BABYLON.Vector2(" + this.targetRange.x + ", " + this.targetRange.y + `);\r
+`;
+ }, t.prototype.serialize = function() {
+ var e = r.prototype.serialize.call(this);
+ return e.sourceRange = this.sourceRange.asArray(), e.targetRange = this.targetRange.asArray(), e;
+ }, t.prototype._deserialize = function(e, n, i) {
+ r.prototype._deserialize.call(this, e, n, i), this.sourceRange = c.d.FromArray(e.sourceRange), this.targetRange = c.d.FromArray(e.targetRange);
+ }, Object(u.c)([jt("From", Ft.Vector2)], t.prototype, "sourceRange", void 0), Object(u.c)([jt("To", Ft.Vector2)], t.prototype, "targetRange", void 0), t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.RemapBlock"] = ou;
+ var Ys = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("left", fe.AutoDetect), n.registerInput("right", fe.AutoDetect), n.registerOutput("output", fe.BasedOnInput), n._outputs[0]._typeConnectionSource = n._inputs[0], n._linkConnectionTypes(0, 1), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "MultiplyBlock";
+ }, Object.defineProperty(t.prototype, "left", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "right", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = " + this.left.associatedVariableName + " * " + this.right.associatedVariableName + `;\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.MultiplyBlock"] = Ys;
+ var Fo = function() {
+ function r() {
+ this.direction1 = new c.e(0, 1, 0), this.direction2 = new c.e(0, 1, 0), this.minEmitBox = new c.e(-0.5, -0.5, -0.5), this.maxEmitBox = new c.e(0.5, 0.5, 0.5);
+ }
+ return r.prototype.startDirectionFunction = function(t, e, n, i) {
+ var o = ee.a.RandomRange(this.direction1.x, this.direction2.x), a = ee.a.RandomRange(this.direction1.y, this.direction2.y), s = ee.a.RandomRange(this.direction1.z, this.direction2.z);
+ if (i)
+ return e.x = o, e.y = a, void (e.z = s);
+ c.e.TransformNormalFromFloatsToRef(o, a, s, t, e);
+ }, r.prototype.startPositionFunction = function(t, e, n, i) {
+ var o = ee.a.RandomRange(this.minEmitBox.x, this.maxEmitBox.x), a = ee.a.RandomRange(this.minEmitBox.y, this.maxEmitBox.y), s = ee.a.RandomRange(this.minEmitBox.z, this.maxEmitBox.z);
+ if (i)
+ return e.x = o, e.y = a, void (e.z = s);
+ c.e.TransformCoordinatesFromFloatsToRef(o, a, s, t, e);
+ }, r.prototype.clone = function() {
+ var t = new r();
+ return _e.a.DeepCopy(this, t), t;
+ }, r.prototype.applyToShader = function(t) {
+ t.setVector3("direction1", this.direction1), t.setVector3("direction2", this.direction2), t.setVector3("minEmitBox", this.minEmitBox), t.setVector3("maxEmitBox", this.maxEmitBox);
+ }, r.prototype.getEffectDefines = function() {
+ return "#define BOXEMITTER";
+ }, r.prototype.getClassName = function() {
+ return "BoxParticleEmitter";
+ }, r.prototype.serialize = function() {
+ var t = {};
+ return t.type = this.getClassName(), t.direction1 = this.direction1.asArray(), t.direction2 = this.direction2.asArray(), t.minEmitBox = this.minEmitBox.asArray(), t.maxEmitBox = this.maxEmitBox.asArray(), t;
+ }, r.prototype.parse = function(t) {
+ c.e.FromArrayToRef(t.direction1, 0, this.direction1), c.e.FromArrayToRef(t.direction2, 0, this.direction2), c.e.FromArrayToRef(t.minEmitBox, 0, this.minEmitBox), c.e.FromArrayToRef(t.maxEmitBox, 0, this.maxEmitBox);
+ }, r;
+ }(), au = function() {
+ function r(t, e, n) {
+ t === void 0 && (t = 1), e === void 0 && (e = Math.PI), n === void 0 && (n = 0), this.directionRandomizer = n, this.radiusRange = 1, this.heightRange = 1, this.emitFromSpawnPointOnly = !1, this.angle = e, this.radius = t;
+ }
+ return Object.defineProperty(r.prototype, "radius", { get: function() {
+ return this._radius;
+ }, set: function(t) {
+ this._radius = t, this._buildHeight();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "angle", { get: function() {
+ return this._angle;
+ }, set: function(t) {
+ this._angle = t, this._buildHeight();
+ }, enumerable: !1, configurable: !0 }), r.prototype._buildHeight = function() {
+ this._angle !== 0 ? this._height = this._radius / Math.tan(this._angle / 2) : this._height = 1;
+ }, r.prototype.startDirectionFunction = function(t, e, n, i) {
+ i ? c.c.Vector3[0].copyFrom(n._localPosition).normalize() : n.position.subtractToRef(t.getTranslation(), c.c.Vector3[0]).normalize();
+ var o = ee.a.RandomRange(0, this.directionRandomizer), a = ee.a.RandomRange(0, this.directionRandomizer), s = ee.a.RandomRange(0, this.directionRandomizer);
+ e.x = c.c.Vector3[0].x + o, e.y = c.c.Vector3[0].y + a, e.z = c.c.Vector3[0].z + s, e.normalize();
+ }, r.prototype.startPositionFunction = function(t, e, n, i) {
+ var o, a = ee.a.RandomRange(0, 2 * Math.PI);
+ o = this.emitFromSpawnPointOnly ? 1e-4 : 1 - (o = ee.a.RandomRange(0, this.heightRange)) * o;
+ var s = this._radius - ee.a.RandomRange(0, this._radius * this.radiusRange), p = (s *= o) * Math.sin(a), m = s * Math.cos(a), S = o * this._height;
+ if (i)
+ return e.x = p, e.y = S, void (e.z = m);
+ c.e.TransformCoordinatesFromFloatsToRef(p, S, m, t, e);
+ }, r.prototype.clone = function() {
+ var t = new r(this._radius, this._angle, this.directionRandomizer);
+ return _e.a.DeepCopy(this, t), t;
+ }, r.prototype.applyToShader = function(t) {
+ t.setFloat2("radius", this._radius, this.radiusRange), t.setFloat("coneAngle", this._angle), t.setFloat2("height", this._height, this.heightRange), t.setFloat("directionRandomizer", this.directionRandomizer);
+ }, r.prototype.getEffectDefines = function() {
+ var t = "#define CONEEMITTER";
+ return this.emitFromSpawnPointOnly && (t += `
+#define CONEEMITTERSPAWNPOINT`), t;
+ }, r.prototype.getClassName = function() {
+ return "ConeParticleEmitter";
+ }, r.prototype.serialize = function() {
+ var t = {};
+ return t.type = this.getClassName(), t.radius = this._radius, t.angle = this._angle, t.directionRandomizer = this.directionRandomizer, t.radiusRange = this.radiusRange, t.heightRange = this.heightRange, t.emitFromSpawnPointOnly = this.emitFromSpawnPointOnly, t;
+ }, r.prototype.parse = function(t) {
+ this.radius = t.radius, this.angle = t.angle, this.directionRandomizer = t.directionRandomizer, this.radiusRange = t.radiusRange !== void 0 ? t.radiusRange : 1, this.heightRange = t.radiusRange !== void 0 ? t.heightRange : 1, this.emitFromSpawnPointOnly = t.emitFromSpawnPointOnly !== void 0 && t.emitFromSpawnPointOnly;
+ }, r;
+ }(), Ks = function() {
+ function r(t, e, n, i) {
+ t === void 0 && (t = 1), e === void 0 && (e = 1), n === void 0 && (n = 1), i === void 0 && (i = 0), this.radius = t, this.height = e, this.radiusRange = n, this.directionRandomizer = i;
+ }
+ return r.prototype.startDirectionFunction = function(t, e, n, i) {
+ var o = n.position.subtract(t.getTranslation()).normalize(), a = ee.a.RandomRange(-this.directionRandomizer / 2, this.directionRandomizer / 2), s = Math.atan2(o.x, o.z);
+ s += ee.a.RandomRange(-Math.PI / 2, Math.PI / 2) * this.directionRandomizer, o.y = a, o.x = Math.sin(s), o.z = Math.cos(s), o.normalize(), i ? e.copyFrom(o) : c.e.TransformNormalFromFloatsToRef(o.x, o.y, o.z, t, e);
+ }, r.prototype.startPositionFunction = function(t, e, n, i) {
+ var o = ee.a.RandomRange(-this.height / 2, this.height / 2), a = ee.a.RandomRange(0, 2 * Math.PI), s = ee.a.RandomRange((1 - this.radiusRange) * (1 - this.radiusRange), 1), p = Math.sqrt(s) * this.radius, m = p * Math.cos(a), S = p * Math.sin(a);
+ i ? e.copyFromFloats(m, o, S) : c.e.TransformCoordinatesFromFloatsToRef(m, o, S, t, e);
+ }, r.prototype.clone = function() {
+ var t = new r(this.radius, this.directionRandomizer);
+ return _e.a.DeepCopy(this, t), t;
+ }, r.prototype.applyToShader = function(t) {
+ t.setFloat("radius", this.radius), t.setFloat("height", this.height), t.setFloat("radiusRange", this.radiusRange), t.setFloat("directionRandomizer", this.directionRandomizer);
+ }, r.prototype.getEffectDefines = function() {
+ return "#define CYLINDEREMITTER";
+ }, r.prototype.getClassName = function() {
+ return "CylinderParticleEmitter";
+ }, r.prototype.serialize = function() {
+ var t = {};
+ return t.type = this.getClassName(), t.radius = this.radius, t.height = this.height, t.radiusRange = this.radiusRange, t.directionRandomizer = this.directionRandomizer, t;
+ }, r.prototype.parse = function(t) {
+ this.radius = t.radius, this.height = t.height, this.radiusRange = t.radiusRange, this.directionRandomizer = t.directionRandomizer;
+ }, r;
+ }(), su = function(r) {
+ function t(e, n, i, o, a) {
+ e === void 0 && (e = 1), n === void 0 && (n = 1), i === void 0 && (i = 1), o === void 0 && (o = new c.e(0, 1, 0)), a === void 0 && (a = new c.e(0, 1, 0));
+ var s = r.call(this, e, n, i) || this;
+ return s.direction1 = o, s.direction2 = a, s;
+ }
+ return Object(u.d)(t, r), t.prototype.startDirectionFunction = function(e, n, i) {
+ var o = ee.a.RandomRange(this.direction1.x, this.direction2.x), a = ee.a.RandomRange(this.direction1.y, this.direction2.y), s = ee.a.RandomRange(this.direction1.z, this.direction2.z);
+ c.e.TransformNormalFromFloatsToRef(o, a, s, e, n);
+ }, t.prototype.clone = function() {
+ var e = new t(this.radius, this.height, this.radiusRange, this.direction1, this.direction2);
+ return _e.a.DeepCopy(this, e), e;
+ }, t.prototype.applyToShader = function(e) {
+ e.setFloat("radius", this.radius), e.setFloat("height", this.height), e.setFloat("radiusRange", this.radiusRange), e.setVector3("direction1", this.direction1), e.setVector3("direction2", this.direction2);
+ }, t.prototype.getEffectDefines = function() {
+ return `#define CYLINDEREMITTER
+#define DIRECTEDCYLINDEREMITTER`;
+ }, t.prototype.getClassName = function() {
+ return "CylinderDirectedParticleEmitter";
+ }, t.prototype.serialize = function() {
+ var e = r.prototype.serialize.call(this);
+ return e.direction1 = this.direction1.asArray(), e.direction2 = this.direction2.asArray(), e;
+ }, t.prototype.parse = function(e) {
+ r.prototype.parse.call(this, e), this.direction1.copyFrom(e.direction1), this.direction2.copyFrom(e.direction2);
+ }, t;
+ }(Ks), cu = function() {
+ function r(t, e, n) {
+ t === void 0 && (t = 1), e === void 0 && (e = 1), n === void 0 && (n = 0), this.radius = t, this.radiusRange = e, this.directionRandomizer = n;
+ }
+ return r.prototype.startDirectionFunction = function(t, e, n, i) {
+ var o = n.position.subtract(t.getTranslation()).normalize(), a = ee.a.RandomRange(0, this.directionRandomizer), s = ee.a.RandomRange(0, this.directionRandomizer), p = ee.a.RandomRange(0, this.directionRandomizer);
+ o.x += a, o.y += s, o.z += p, o.normalize(), i ? e.copyFrom(o) : c.e.TransformNormalFromFloatsToRef(o.x, o.y, o.z, t, e);
+ }, r.prototype.startPositionFunction = function(t, e, n, i) {
+ var o = this.radius - ee.a.RandomRange(0, this.radius * this.radiusRange), a = ee.a.RandomRange(0, 1), s = ee.a.RandomRange(0, 2 * Math.PI), p = Math.acos(2 * a - 1), m = o * Math.cos(s) * Math.sin(p), S = o * Math.cos(p), O = o * Math.sin(s) * Math.sin(p);
+ i ? e.copyFromFloats(m, Math.abs(S), O) : c.e.TransformCoordinatesFromFloatsToRef(m, Math.abs(S), O, t, e);
+ }, r.prototype.clone = function() {
+ var t = new r(this.radius, this.directionRandomizer);
+ return _e.a.DeepCopy(this, t), t;
+ }, r.prototype.applyToShader = function(t) {
+ t.setFloat("radius", this.radius), t.setFloat("radiusRange", this.radiusRange), t.setFloat("directionRandomizer", this.directionRandomizer);
+ }, r.prototype.getEffectDefines = function() {
+ return "#define HEMISPHERICEMITTER";
+ }, r.prototype.getClassName = function() {
+ return "HemisphericParticleEmitter";
+ }, r.prototype.serialize = function() {
+ var t = {};
+ return t.type = this.getClassName(), t.radius = this.radius, t.radiusRange = this.radiusRange, t.directionRandomizer = this.directionRandomizer, t;
+ }, r.prototype.parse = function(t) {
+ this.radius = t.radius, this.radiusRange = t.radiusRange, this.directionRandomizer = t.directionRandomizer;
+ }, r;
+ }(), lu = function() {
+ function r() {
+ this.direction1 = new c.e(0, 1, 0), this.direction2 = new c.e(0, 1, 0);
+ }
+ return r.prototype.startDirectionFunction = function(t, e, n, i) {
+ var o = ee.a.RandomRange(this.direction1.x, this.direction2.x), a = ee.a.RandomRange(this.direction1.y, this.direction2.y), s = ee.a.RandomRange(this.direction1.z, this.direction2.z);
+ i ? e.copyFromFloats(o, a, s) : c.e.TransformNormalFromFloatsToRef(o, a, s, t, e);
+ }, r.prototype.startPositionFunction = function(t, e, n, i) {
+ i ? e.copyFromFloats(0, 0, 0) : c.e.TransformCoordinatesFromFloatsToRef(0, 0, 0, t, e);
+ }, r.prototype.clone = function() {
+ var t = new r();
+ return _e.a.DeepCopy(this, t), t;
+ }, r.prototype.applyToShader = function(t) {
+ t.setVector3("direction1", this.direction1), t.setVector3("direction2", this.direction2);
+ }, r.prototype.getEffectDefines = function() {
+ return "#define POINTEMITTER";
+ }, r.prototype.getClassName = function() {
+ return "PointParticleEmitter";
+ }, r.prototype.serialize = function() {
+ var t = {};
+ return t.type = this.getClassName(), t.direction1 = this.direction1.asArray(), t.direction2 = this.direction2.asArray(), t;
+ }, r.prototype.parse = function(t) {
+ c.e.FromArrayToRef(t.direction1, 0, this.direction1), c.e.FromArrayToRef(t.direction2, 0, this.direction2);
+ }, r;
+ }(), Qs = function() {
+ function r(t, e, n) {
+ t === void 0 && (t = 1), e === void 0 && (e = 1), n === void 0 && (n = 0), this.radius = t, this.radiusRange = e, this.directionRandomizer = n;
+ }
+ return r.prototype.startDirectionFunction = function(t, e, n, i) {
+ var o = n.position.subtract(t.getTranslation()).normalize(), a = ee.a.RandomRange(0, this.directionRandomizer), s = ee.a.RandomRange(0, this.directionRandomizer), p = ee.a.RandomRange(0, this.directionRandomizer);
+ o.x += a, o.y += s, o.z += p, o.normalize(), i ? e.copyFrom(o) : c.e.TransformNormalFromFloatsToRef(o.x, o.y, o.z, t, e);
+ }, r.prototype.startPositionFunction = function(t, e, n, i) {
+ var o = this.radius - ee.a.RandomRange(0, this.radius * this.radiusRange), a = ee.a.RandomRange(0, 1), s = ee.a.RandomRange(0, 2 * Math.PI), p = Math.acos(2 * a - 1), m = o * Math.cos(s) * Math.sin(p), S = o * Math.cos(p), O = o * Math.sin(s) * Math.sin(p);
+ i ? e.copyFromFloats(m, S, O) : c.e.TransformCoordinatesFromFloatsToRef(m, S, O, t, e);
+ }, r.prototype.clone = function() {
+ var t = new r(this.radius, this.directionRandomizer);
+ return _e.a.DeepCopy(this, t), t;
+ }, r.prototype.applyToShader = function(t) {
+ t.setFloat("radius", this.radius), t.setFloat("radiusRange", this.radiusRange), t.setFloat("directionRandomizer", this.directionRandomizer);
+ }, r.prototype.getEffectDefines = function() {
+ return "#define SPHEREEMITTER";
+ }, r.prototype.getClassName = function() {
+ return "SphereParticleEmitter";
+ }, r.prototype.serialize = function() {
+ var t = {};
+ return t.type = this.getClassName(), t.radius = this.radius, t.radiusRange = this.radiusRange, t.directionRandomizer = this.directionRandomizer, t;
+ }, r.prototype.parse = function(t) {
+ this.radius = t.radius, this.radiusRange = t.radiusRange, this.directionRandomizer = t.directionRandomizer;
+ }, r;
+ }(), uu = function(r) {
+ function t(e, n, i) {
+ e === void 0 && (e = 1), n === void 0 && (n = new c.e(0, 1, 0)), i === void 0 && (i = new c.e(0, 1, 0));
+ var o = r.call(this, e) || this;
+ return o.direction1 = n, o.direction2 = i, o;
+ }
+ return Object(u.d)(t, r), t.prototype.startDirectionFunction = function(e, n, i) {
+ var o = ee.a.RandomRange(this.direction1.x, this.direction2.x), a = ee.a.RandomRange(this.direction1.y, this.direction2.y), s = ee.a.RandomRange(this.direction1.z, this.direction2.z);
+ c.e.TransformNormalFromFloatsToRef(o, a, s, e, n);
+ }, t.prototype.clone = function() {
+ var e = new t(this.radius, this.direction1, this.direction2);
+ return _e.a.DeepCopy(this, e), e;
+ }, t.prototype.applyToShader = function(e) {
+ e.setFloat("radius", this.radius), e.setFloat("radiusRange", this.radiusRange), e.setVector3("direction1", this.direction1), e.setVector3("direction2", this.direction2);
+ }, t.prototype.getEffectDefines = function() {
+ return `#define SPHEREEMITTER
+#define DIRECTEDSPHEREEMITTER`;
+ }, t.prototype.getClassName = function() {
+ return "SphereDirectedParticleEmitter";
+ }, t.prototype.serialize = function() {
+ var e = r.prototype.serialize.call(this);
+ return e.direction1 = this.direction1.asArray(), e.direction2 = this.direction2.asArray(), e;
+ }, t.prototype.parse = function(e) {
+ r.prototype.parse.call(this, e), this.direction1.copyFrom(e.direction1), this.direction2.copyFrom(e.direction2);
+ }, t;
+ }(Qs), Bo = function() {
+ function r() {
+ this.particlePositionGenerator = function() {
+ }, this.particleDestinationGenerator = function() {
+ };
+ }
+ return r.prototype.startDirectionFunction = function(t, e, n, i) {
+ var o = c.c.Vector3[0];
+ if (this.particleDestinationGenerator) {
+ this.particleDestinationGenerator(-1, n, o);
+ var a = c.c.Vector3[1];
+ o.subtractToRef(n.position, a), a.scaleToRef(1 / n.lifeTime, o);
+ } else
+ o.set(0, 0, 0);
+ i ? e.copyFrom(o) : c.e.TransformNormalToRef(o, t, e);
+ }, r.prototype.startPositionFunction = function(t, e, n, i) {
+ var o = c.c.Vector3[0];
+ this.particlePositionGenerator ? this.particlePositionGenerator(-1, n, o) : o.set(0, 0, 0), i ? e.copyFrom(o) : c.e.TransformCoordinatesToRef(o, t, e);
+ }, r.prototype.clone = function() {
+ var t = new r();
+ return _e.a.DeepCopy(this, t), t;
+ }, r.prototype.applyToShader = function(t) {
+ }, r.prototype.getEffectDefines = function() {
+ return "#define CUSTOMEMITTER";
+ }, r.prototype.getClassName = function() {
+ return "CustomParticleEmitter";
+ }, r.prototype.serialize = function() {
+ var t = {};
+ return t.type = this.getClassName(), t;
+ }, r.prototype.parse = function(t) {
+ }, r;
+ }(), dp = function() {
+ function r(t) {
+ t === void 0 && (t = null), this._indices = null, this._positions = null, this._normals = null, this._storedNormal = c.e.Zero(), this._mesh = null, this.direction1 = new c.e(0, 1, 0), this.direction2 = new c.e(0, 1, 0), this.useMeshNormalsForDirection = !0, this.mesh = t;
+ }
+ return Object.defineProperty(r.prototype, "mesh", { get: function() {
+ return this._mesh;
+ }, set: function(t) {
+ this._mesh !== t && (this._mesh = t, t ? (this._indices = t.getIndices(), this._positions = t.getVerticesData(De.b.PositionKind), this._normals = t.getVerticesData(De.b.NormalKind)) : (this._indices = null, this._positions = null, this._normals = null));
+ }, enumerable: !1, configurable: !0 }), r.prototype.startDirectionFunction = function(t, e, n, i) {
+ if (this.useMeshNormalsForDirection && this._normals)
+ c.e.TransformNormalToRef(this._storedNormal, t, e);
+ else {
+ var o = ee.a.RandomRange(this.direction1.x, this.direction2.x), a = ee.a.RandomRange(this.direction1.y, this.direction2.y), s = ee.a.RandomRange(this.direction1.z, this.direction2.z);
+ i ? e.copyFromFloats(o, a, s) : c.e.TransformNormalFromFloatsToRef(o, a, s, t, e);
+ }
+ }, r.prototype.startPositionFunction = function(t, e, n, i) {
+ if (this._indices && this._positions) {
+ var o = 3 * Math.random() * (this._indices.length / 3) | 0, a = Math.random(), s = Math.random() * (1 - a), p = 1 - a - s, m = this._indices[o], S = this._indices[o + 1], O = this._indices[o + 2], I = c.c.Vector3[0], G = c.c.Vector3[1], k = c.c.Vector3[2], K = c.c.Vector3[3];
+ c.e.FromArrayToRef(this._positions, 3 * m, I), c.e.FromArrayToRef(this._positions, 3 * S, G), c.e.FromArrayToRef(this._positions, 3 * O, k), K.x = a * I.x + s * G.x + p * k.x, K.y = a * I.y + s * G.y + p * k.y, K.z = a * I.z + s * G.z + p * k.z, i ? e.copyFromFloats(K.x, K.y, K.z) : c.e.TransformCoordinatesFromFloatsToRef(K.x, K.y, K.z, t, e), this.useMeshNormalsForDirection && this._normals && (c.e.FromArrayToRef(this._normals, 3 * m, I), c.e.FromArrayToRef(this._normals, 3 * S, G), c.e.FromArrayToRef(this._normals, 3 * O, k), this._storedNormal.x = a * I.x + s * G.x + p * k.x, this._storedNormal.y = a * I.y + s * G.y + p * k.y, this._storedNormal.z = a * I.z + s * G.z + p * k.z);
+ }
+ }, r.prototype.clone = function() {
+ var t = new r(this.mesh);
+ return _e.a.DeepCopy(this, t), t;
+ }, r.prototype.applyToShader = function(t) {
+ t.setVector3("direction1", this.direction1), t.setVector3("direction2", this.direction2);
+ }, r.prototype.getEffectDefines = function() {
+ return "";
+ }, r.prototype.getClassName = function() {
+ return "MeshParticleEmitter";
+ }, r.prototype.serialize = function() {
+ var t, e = {};
+ return e.type = this.getClassName(), e.direction1 = this.direction1.asArray(), e.direction2 = this.direction2.asArray(), e.meshId = (t = this.mesh) === null || t === void 0 ? void 0 : t.id, e.useMeshNormalsForDirection = this.useMeshNormalsForDirection, e;
+ }, r.prototype.parse = function(t, e) {
+ c.e.FromArrayToRef(t.direction1, 0, this.direction1), c.e.FromArrayToRef(t.direction2, 0, this.direction2), t.meshId && e && (this.mesh = e.getLastMeshByID(t.meshId)), this.useMeshNormalsForDirection = t.useMeshNormalsForDirection;
+ }, r;
+ }(), Na = function() {
+ function r(t) {
+ this.animations = [], this.renderingGroupId = 0, this.emitter = c.e.Zero(), this.emitRate = 10, this.manualEmitCount = -1, this.updateSpeed = 0.01, this.targetStopDuration = 0, this.disposeOnStop = !1, this.minEmitPower = 1, this.maxEmitPower = 1, this.minLifeTime = 1, this.maxLifeTime = 1, this.minSize = 1, this.maxSize = 1, this.minScaleX = 1, this.maxScaleX = 1, this.minScaleY = 1, this.maxScaleY = 1, this.minInitialRotation = 0, this.maxInitialRotation = 0, this.minAngularSpeed = 0, this.maxAngularSpeed = 0, this.layerMask = 268435455, this.customShader = null, this.preventAutoStart = !1, this.noiseStrength = new c.e(10, 10, 10), this.onAnimationEnd = null, this.blendMode = r.BLENDMODE_ONEONE, this.forceDepthWrite = !1, this.preWarmCycles = 0, this.preWarmStepOffset = 1, this.spriteCellChangeSpeed = 1, this.startSpriteCellID = 0, this.endSpriteCellID = 0, this.spriteCellWidth = 0, this.spriteCellHeight = 0, this.spriteRandomStartCell = !1, this.translationPivot = new c.d(0, 0), this.beginAnimationOnStart = !1, this.beginAnimationFrom = 0, this.beginAnimationTo = 60, this.beginAnimationLoop = !1, this.worldOffset = new c.e(0, 0, 0), this.gravity = c.e.Zero(), this._colorGradients = null, this._sizeGradients = null, this._lifeTimeGradients = null, this._angularSpeedGradients = null, this._velocityGradients = null, this._limitVelocityGradients = null, this._dragGradients = null, this._emitRateGradients = null, this._startSizeGradients = null, this._rampGradients = null, this._colorRemapGradients = null, this._alphaRemapGradients = null, this.startDelay = 0, this.limitVelocityDamping = 0.4, this.color1 = new C.b(1, 1, 1, 1), this.color2 = new C.b(1, 1, 1, 1), this.colorDead = new C.b(0, 0, 0, 1), this.textureMask = new C.b(1, 1, 1, 1), this._isSubEmitter = !1, this.billboardMode = d.a.PARTICLES_BILLBOARDMODE_ALL, this._isBillboardBased = !0, this._imageProcessingConfigurationDefines = new In.b(), this.id = t, this.name = t;
+ }
+ return Object.defineProperty(r.prototype, "noiseTexture", { get: function() {
+ return this._noiseTexture;
+ }, set: function(t) {
+ this._noiseTexture !== t && (this._noiseTexture = t, this._reset());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "isAnimationSheetEnabled", { get: function() {
+ return this._isAnimationSheetEnabled;
+ }, set: function(t) {
+ this._isAnimationSheetEnabled != t && (this._isAnimationSheetEnabled = t, this._reset());
+ }, enumerable: !1, configurable: !0 }), r.prototype.getScene = function() {
+ return this._scene;
+ }, r.prototype._hasTargetStopDurationDependantGradient = function() {
+ return this._startSizeGradients && this._startSizeGradients.length > 0 || this._emitRateGradients && this._emitRateGradients.length > 0 || this._lifeTimeGradients && this._lifeTimeGradients.length > 0;
+ }, r.prototype.getDragGradients = function() {
+ return this._dragGradients;
+ }, r.prototype.getLimitVelocityGradients = function() {
+ return this._limitVelocityGradients;
+ }, r.prototype.getColorGradients = function() {
+ return this._colorGradients;
+ }, r.prototype.getSizeGradients = function() {
+ return this._sizeGradients;
+ }, r.prototype.getColorRemapGradients = function() {
+ return this._colorRemapGradients;
+ }, r.prototype.getAlphaRemapGradients = function() {
+ return this._alphaRemapGradients;
+ }, r.prototype.getLifeTimeGradients = function() {
+ return this._lifeTimeGradients;
+ }, r.prototype.getAngularSpeedGradients = function() {
+ return this._angularSpeedGradients;
+ }, r.prototype.getVelocityGradients = function() {
+ return this._velocityGradients;
+ }, r.prototype.getStartSizeGradients = function() {
+ return this._startSizeGradients;
+ }, r.prototype.getEmitRateGradients = function() {
+ return this._emitRateGradients;
+ }, Object.defineProperty(r.prototype, "direction1", { get: function() {
+ return this.particleEmitterType.direction1 ? this.particleEmitterType.direction1 : c.e.Zero();
+ }, set: function(t) {
+ this.particleEmitterType.direction1 && (this.particleEmitterType.direction1 = t);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "direction2", { get: function() {
+ return this.particleEmitterType.direction2 ? this.particleEmitterType.direction2 : c.e.Zero();
+ }, set: function(t) {
+ this.particleEmitterType.direction2 && (this.particleEmitterType.direction2 = t);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "minEmitBox", { get: function() {
+ return this.particleEmitterType.minEmitBox ? this.particleEmitterType.minEmitBox : c.e.Zero();
+ }, set: function(t) {
+ this.particleEmitterType.minEmitBox && (this.particleEmitterType.minEmitBox = t);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "maxEmitBox", { get: function() {
+ return this.particleEmitterType.maxEmitBox ? this.particleEmitterType.maxEmitBox : c.e.Zero();
+ }, set: function(t) {
+ this.particleEmitterType.maxEmitBox && (this.particleEmitterType.maxEmitBox = t);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "isBillboardBased", { get: function() {
+ return this._isBillboardBased;
+ }, set: function(t) {
+ this._isBillboardBased !== t && (this._isBillboardBased = t, this._reset());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "imageProcessingConfiguration", { get: function() {
+ return this._imageProcessingConfiguration;
+ }, set: function(t) {
+ this._attachImageProcessingConfiguration(t);
+ }, enumerable: !1, configurable: !0 }), r.prototype._attachImageProcessingConfiguration = function(t) {
+ t !== this._imageProcessingConfiguration && (!t && this._scene ? this._imageProcessingConfiguration = this._scene.imageProcessingConfiguration : this._imageProcessingConfiguration = t);
+ }, r.prototype._reset = function() {
+ }, r.prototype._removeGradientAndTexture = function(t, e, n) {
+ if (!e)
+ return this;
+ for (var i = 0, o = 0, a = e; o < a.length; o++) {
+ if (a[o].gradient === t) {
+ e.splice(i, 1);
+ break;
+ }
+ i++;
+ }
+ return n && n.dispose(), this;
+ }, r.prototype.createPointEmitter = function(t, e) {
+ var n = new lu();
+ return n.direction1 = t, n.direction2 = e, this.particleEmitterType = n, n;
+ }, r.prototype.createHemisphericEmitter = function(t, e) {
+ t === void 0 && (t = 1), e === void 0 && (e = 1);
+ var n = new cu(t, e);
+ return this.particleEmitterType = n, n;
+ }, r.prototype.createSphereEmitter = function(t, e) {
+ t === void 0 && (t = 1), e === void 0 && (e = 1);
+ var n = new Qs(t, e);
+ return this.particleEmitterType = n, n;
+ }, r.prototype.createDirectedSphereEmitter = function(t, e, n) {
+ t === void 0 && (t = 1), e === void 0 && (e = new c.e(0, 1, 0)), n === void 0 && (n = new c.e(0, 1, 0));
+ var i = new uu(t, e, n);
+ return this.particleEmitterType = i, i;
+ }, r.prototype.createCylinderEmitter = function(t, e, n, i) {
+ t === void 0 && (t = 1), e === void 0 && (e = 1), n === void 0 && (n = 1), i === void 0 && (i = 0);
+ var o = new Ks(t, e, n, i);
+ return this.particleEmitterType = o, o;
+ }, r.prototype.createDirectedCylinderEmitter = function(t, e, n, i, o) {
+ t === void 0 && (t = 1), e === void 0 && (e = 1), n === void 0 && (n = 1), i === void 0 && (i = new c.e(0, 1, 0)), o === void 0 && (o = new c.e(0, 1, 0));
+ var a = new su(t, e, n, i, o);
+ return this.particleEmitterType = a, a;
+ }, r.prototype.createConeEmitter = function(t, e) {
+ t === void 0 && (t = 1), e === void 0 && (e = Math.PI / 4);
+ var n = new au(t, e);
+ return this.particleEmitterType = n, n;
+ }, r.prototype.createBoxEmitter = function(t, e, n, i) {
+ var o = new Fo();
+ return this.particleEmitterType = o, this.direction1 = t, this.direction2 = e, this.minEmitBox = n, this.maxEmitBox = i, o;
+ }, r.BLENDMODE_ONEONE = 0, r.BLENDMODE_STANDARD = 1, r.BLENDMODE_ADD = 2, r.BLENDMODE_MULTIPLY = 3, r.BLENDMODE_MULTIPLYADD = 4, r;
+ }(), hu = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("rgba", fe.Color4, !0), n.registerInput("rgb ", fe.Color3, !0), n.registerOutput("rgb", fe.Color3), n.registerOutput("r", fe.Float), n.registerOutput("g", fe.Float), n.registerOutput("b", fe.Float), n.registerOutput("a", fe.Float), n.inputsAreExclusive = !0, n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "ColorSplitterBlock";
+ }, Object.defineProperty(t.prototype, "rgba", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "rgbIn", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "rgbOut", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "r", { get: function() {
+ return this._outputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "g", { get: function() {
+ return this._outputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "b", { get: function() {
+ return this._outputs[3];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "a", { get: function() {
+ return this._outputs[4];
+ }, enumerable: !1, configurable: !0 }), t.prototype._inputRename = function(e) {
+ return e === "rgb " ? "rgbIn" : e;
+ }, t.prototype._outputRename = function(e) {
+ return e === "rgb" ? "rgbOut" : e;
+ }, t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this.rgba.isConnected ? this.rgba : this.rgbIn;
+ if (n.isConnected) {
+ var i = this._outputs[0], o = this._outputs[1], a = this._outputs[2], s = this._outputs[3], p = this._outputs[4];
+ return i.hasEndpoints && (e.compilationString += this._declareOutput(i, e) + " = " + n.associatedVariableName + `.rgb;\r
+`), o.hasEndpoints && (e.compilationString += this._declareOutput(o, e) + " = " + n.associatedVariableName + `.r;\r
+`), a.hasEndpoints && (e.compilationString += this._declareOutput(a, e) + " = " + n.associatedVariableName + `.g;\r
+`), s.hasEndpoints && (e.compilationString += this._declareOutput(s, e) + " = " + n.associatedVariableName + `.b;\r
+`), p.hasEndpoints && (e.compilationString += this._declareOutput(p, e) + " = " + n.associatedVariableName + `.a;\r
+`), this;
+ }
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.ColorSplitterBlock"] = hu;
+ var fn, fp = l(104);
+ (function(r) {
+ r[r.Cos = 0] = "Cos", r[r.Sin = 1] = "Sin", r[r.Abs = 2] = "Abs", r[r.Exp = 3] = "Exp", r[r.Exp2 = 4] = "Exp2", r[r.Round = 5] = "Round", r[r.Floor = 6] = "Floor", r[r.Ceiling = 7] = "Ceiling", r[r.Sqrt = 8] = "Sqrt", r[r.Log = 9] = "Log", r[r.Tan = 10] = "Tan", r[r.ArcTan = 11] = "ArcTan", r[r.ArcCos = 12] = "ArcCos", r[r.ArcSin = 13] = "ArcSin", r[r.Fract = 14] = "Fract", r[r.Sign = 15] = "Sign", r[r.Radians = 16] = "Radians", r[r.Degrees = 17] = "Degrees";
+ })(fn || (fn = {}));
+ var du = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.operation = fn.Cos, n.registerInput("input", fe.AutoDetect), n.registerOutput("output", fe.BasedOnInput), n._outputs[0]._typeConnectionSource = n._inputs[0], n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "TrigonometryBlock";
+ }, Object.defineProperty(t.prototype, "input", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0], i = "";
+ switch (this.operation) {
+ case fn.Cos:
+ i = "cos";
+ break;
+ case fn.Sin:
+ i = "sin";
+ break;
+ case fn.Abs:
+ i = "abs";
+ break;
+ case fn.Exp:
+ i = "exp";
+ break;
+ case fn.Exp2:
+ i = "exp2";
+ break;
+ case fn.Round:
+ i = "round";
+ break;
+ case fn.Floor:
+ i = "floor";
+ break;
+ case fn.Ceiling:
+ i = "ceil";
+ break;
+ case fn.Sqrt:
+ i = "sqrt";
+ break;
+ case fn.Log:
+ i = "log";
+ break;
+ case fn.Tan:
+ i = "tan";
+ break;
+ case fn.ArcTan:
+ i = "atan";
+ break;
+ case fn.ArcCos:
+ i = "acos";
+ break;
+ case fn.ArcSin:
+ i = "asin";
+ break;
+ case fn.Fract:
+ i = "fract";
+ break;
+ case fn.Sign:
+ i = "sign";
+ break;
+ case fn.Radians:
+ i = "radians";
+ break;
+ case fn.Degrees:
+ i = "degrees";
+ }
+ return e.compilationString += this._declareOutput(n, e) + " = " + i + "(" + this.input.associatedVariableName + `);\r
+`, this;
+ }, t.prototype.serialize = function() {
+ var e = r.prototype.serialize.call(this);
+ return e.operation = this.operation, e;
+ }, t.prototype._deserialize = function(e, n, i) {
+ r.prototype._deserialize.call(this, e, n, i), this.operation = e.operation;
+ }, t.prototype._dumpPropertiesCode = function() {
+ return this._codeVariableName + ".operation = BABYLON.TrigonometryBlockOperations." + fn[this.operation] + `;\r
+`;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.TrigonometryBlock"] = du;
+ var fu = { effect: null, subMesh: null }, Fa = function(r) {
+ function t() {
+ var e = r.call(this) || this;
+ return e.NORMAL = !1, e.TANGENT = !1, e.UV1 = !1, e.NUM_BONE_INFLUENCERS = 0, e.BonesPerMesh = 0, e.BONETEXTURE = !1, e.MORPHTARGETS = !1, e.MORPHTARGETS_NORMAL = !1, e.MORPHTARGETS_TANGENT = !1, e.MORPHTARGETS_UV = !1, e.NUM_MORPH_INFLUENCERS = 0, e.IMAGEPROCESSING = !1, e.VIGNETTE = !1, e.VIGNETTEBLENDMODEMULTIPLY = !1, e.VIGNETTEBLENDMODEOPAQUE = !1, e.TONEMAPPING = !1, e.TONEMAPPING_ACES = !1, e.CONTRAST = !1, e.EXPOSURE = !1, e.COLORCURVES = !1, e.COLORGRADING = !1, e.COLORGRADING3D = !1, e.SAMPLER3DGREENDEPTH = !1, e.SAMPLER3DBGRMAP = !1, e.IMAGEPROCESSINGPOSTPROCESS = !1, e.BUMPDIRECTUV = 0, e.rebuild(), e;
+ }
+ return Object(u.d)(t, r), t.prototype.setValue = function(e, n, i) {
+ i === void 0 && (i = !1), this[e] === void 0 && this._keys.push(e), i && this[e] !== n && this.markAsUnprocessed(), this[e] = n;
+ }, t;
+ }(Is.a), qs = function(r) {
+ function t(e, n, i) {
+ i === void 0 && (i = {});
+ var o = r.call(this, e, n || ke.a.LastCreatedScene) || this;
+ return o._buildId = t._BuildIdGenerator++, o._buildWasSuccessful = !1, o._cachedWorldViewMatrix = new c.a(), o._cachedWorldViewProjectionMatrix = new c.a(), o._optimizers = new Array(), o._animationFrame = -1, o.BJSNODEMATERIALEDITOR = o._getGlobalNodeMaterialEditor(), o.editorData = null, o.ignoreAlpha = !1, o.maxSimultaneousLights = 4, o.onBuildObservable = new P.c(), o._vertexOutputNodes = new Array(), o._fragmentOutputNodes = new Array(), o.attachedBlocks = new Array(), o._mode = zn.Material, o._options = Object(u.a)({ emitComments: !1 }, i), o._attachImageProcessingConfiguration(null), o;
+ }
+ return Object(u.d)(t, r), t.prototype._getGlobalNodeMaterialEditor = function() {
+ return typeof NODEEDITOR < "u" ? NODEEDITOR : typeof BABYLON < "u" && BABYLON.NodeEditor !== void 0 ? BABYLON : void 0;
+ }, Object.defineProperty(t.prototype, "options", { get: function() {
+ return this._options;
+ }, set: function(e) {
+ this._options = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "imageProcessingConfiguration", { get: function() {
+ return this._imageProcessingConfiguration;
+ }, set: function(e) {
+ this._attachImageProcessingConfiguration(e), this._markAllSubMeshesAsTexturesDirty();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "mode", { get: function() {
+ return this._mode;
+ }, enumerable: !1, configurable: !0 }), t.prototype.getClassName = function() {
+ return "NodeMaterial";
+ }, t.prototype._attachImageProcessingConfiguration = function(e) {
+ var n = this;
+ e !== this._imageProcessingConfiguration && (this._imageProcessingConfiguration && this._imageProcessingObserver && this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver), this._imageProcessingConfiguration = e || this.getScene().imageProcessingConfiguration, this._imageProcessingConfiguration && (this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(function() {
+ n._markAllSubMeshesAsImageProcessingDirty();
+ })));
+ }, t.prototype.getBlockByName = function(e) {
+ for (var n = null, i = 0, o = this.attachedBlocks; i < o.length; i++) {
+ var a = o[i];
+ if (a.name === e) {
+ if (n)
+ return Ke.b.Warn("More than one block was found with the name `" + e + "`"), n;
+ n = a;
+ }
+ }
+ return n;
+ }, t.prototype.getBlockByPredicate = function(e) {
+ for (var n = 0, i = this.attachedBlocks; n < i.length; n++) {
+ var o = i[n];
+ if (e(o))
+ return o;
+ }
+ return null;
+ }, t.prototype.getInputBlockByPredicate = function(e) {
+ for (var n = 0, i = this.attachedBlocks; n < i.length; n++) {
+ var o = i[n];
+ if (o.isInput && e(o))
+ return o;
+ }
+ return null;
+ }, t.prototype.getInputBlocks = function() {
+ for (var e = [], n = 0, i = this.attachedBlocks; n < i.length; n++) {
+ var o = i[n];
+ o.isInput && e.push(o);
+ }
+ return e;
+ }, t.prototype.registerOptimizer = function(e) {
+ if (!(this._optimizers.indexOf(e) > -1))
+ return this._optimizers.push(e), this;
+ }, t.prototype.unregisterOptimizer = function(e) {
+ var n = this._optimizers.indexOf(e);
+ if (n !== -1)
+ return this._optimizers.splice(n, 1), this;
+ }, t.prototype.addOutputNode = function(e) {
+ if (e.target === null)
+ throw "This node is not meant to be an output node. You may want to explicitly set its target value.";
+ return e.target & Me.Vertex && this._addVertexOutputNode(e), e.target & Me.Fragment && this._addFragmentOutputNode(e), this;
+ }, t.prototype.removeOutputNode = function(e) {
+ return e.target === null || (e.target & Me.Vertex && this._removeVertexOutputNode(e), e.target & Me.Fragment && this._removeFragmentOutputNode(e)), this;
+ }, t.prototype._addVertexOutputNode = function(e) {
+ if (this._vertexOutputNodes.indexOf(e) === -1)
+ return e.target = Me.Vertex, this._vertexOutputNodes.push(e), this;
+ }, t.prototype._removeVertexOutputNode = function(e) {
+ var n = this._vertexOutputNodes.indexOf(e);
+ if (n !== -1)
+ return this._vertexOutputNodes.splice(n, 1), this;
+ }, t.prototype._addFragmentOutputNode = function(e) {
+ if (this._fragmentOutputNodes.indexOf(e) === -1)
+ return e.target = Me.Fragment, this._fragmentOutputNodes.push(e), this;
+ }, t.prototype._removeFragmentOutputNode = function(e) {
+ var n = this._fragmentOutputNodes.indexOf(e);
+ if (n !== -1)
+ return this._fragmentOutputNodes.splice(n, 1), this;
+ }, t.prototype.needAlphaBlending = function() {
+ return !this.ignoreAlpha && (this.alpha < 1 || this._sharedData && this._sharedData.hints.needAlphaBlending);
+ }, t.prototype.needAlphaTesting = function() {
+ return this._sharedData && this._sharedData.hints.needAlphaTesting;
+ }, t.prototype._initializeBlock = function(e, n, i) {
+ if (e.initialize(n), e.autoConfigure(this), e._preparationId = this._buildId, this.attachedBlocks.indexOf(e) === -1) {
+ if (e.isUnique) {
+ for (var o = e.getClassName(), a = 0, s = this.attachedBlocks; a < s.length; a++)
+ if (s[a].getClassName() === o)
+ throw "Cannot have multiple blocks of type " + o + " in the same NodeMaterial";
+ }
+ this.attachedBlocks.push(e);
+ }
+ for (var p = 0, m = e.inputs; p < m.length; p++) {
+ var S = m[p];
+ S.associatedVariableName = "";
+ var O = S.connectedPoint;
+ if (O) {
+ var I = O.ownerBlock;
+ I !== e && ((I.target === Me.VertexAndFragment || n.target === Me.Fragment && I.target === Me.Vertex && I._preparationId !== this._buildId) && i.push(I), this._initializeBlock(I, n, i));
+ }
+ }
+ for (var G = 0, k = e.outputs; G < k.length; G++)
+ k[G].associatedVariableName = "";
+ }, t.prototype._resetDualBlocks = function(e, n) {
+ e.target === Me.VertexAndFragment && (e.buildId = n);
+ for (var i = 0, o = e.inputs; i < o.length; i++) {
+ var a = o[i].connectedPoint;
+ if (a) {
+ var s = a.ownerBlock;
+ s !== e && this._resetDualBlocks(s, n);
+ }
+ }
+ }, t.prototype.removeBlock = function(e) {
+ var n = this.attachedBlocks.indexOf(e);
+ n > -1 && this.attachedBlocks.splice(n, 1), e.isFinalMerger && this.removeOutputNode(e);
+ }, t.prototype.build = function(e) {
+ e === void 0 && (e = !1), this._buildWasSuccessful = !1;
+ var n = this.getScene().getEngine(), i = this._mode === zn.Particle;
+ if (this._vertexOutputNodes.length === 0 && !i)
+ throw "You must define at least one vertexOutputNode";
+ if (this._fragmentOutputNodes.length === 0)
+ throw "You must define at least one fragmentOutputNode";
+ this._vertexCompilationState = new up(), this._vertexCompilationState.supportUniformBuffers = n.supportsUniformBuffers, this._vertexCompilationState.target = Me.Vertex, this._fragmentCompilationState = new up(), this._fragmentCompilationState.supportUniformBuffers = n.supportsUniformBuffers, this._fragmentCompilationState.target = Me.Fragment, this._sharedData = new C0(), this._vertexCompilationState.sharedData = this._sharedData, this._fragmentCompilationState.sharedData = this._sharedData, this._sharedData.buildId = this._buildId, this._sharedData.emitComments = this._options.emitComments, this._sharedData.verbose = e, this._sharedData.scene = this.getScene(), this._sharedData.allowEmptyVertexProgram = i;
+ for (var o = [], a = [], s = 0, p = this._vertexOutputNodes; s < p.length; s++) {
+ var m = p[s];
+ o.push(m), this._initializeBlock(m, this._vertexCompilationState, a);
+ }
+ for (var S = 0, O = this._fragmentOutputNodes; S < O.length; S++) {
+ var I = O[S];
+ a.push(I), this._initializeBlock(I, this._fragmentCompilationState, o);
+ }
+ this.optimize();
+ for (var G = 0, k = o; G < k.length; G++)
+ (m = k[G]).build(this._vertexCompilationState, o);
+ this._fragmentCompilationState.uniforms = this._vertexCompilationState.uniforms.slice(0), this._fragmentCompilationState._uniformDeclaration = this._vertexCompilationState._uniformDeclaration, this._fragmentCompilationState._constantDeclaration = this._vertexCompilationState._constantDeclaration, this._fragmentCompilationState._vertexState = this._vertexCompilationState;
+ for (var K = 0, re = a; K < re.length; K++)
+ I = re[K], this._resetDualBlocks(I, this._buildId - 1);
+ for (var se = 0, ue = a; se < ue.length; se++)
+ (I = ue[se]).build(this._fragmentCompilationState, a);
+ this._vertexCompilationState.finalize(this._vertexCompilationState), this._fragmentCompilationState.finalize(this._fragmentCompilationState), this._buildId = t._BuildIdGenerator++, this._sharedData.emitErrors(), e && (console.log("Vertex shader:"), console.log(this._vertexCompilationState.compilationString), console.log("Fragment shader:"), console.log(this._fragmentCompilationState.compilationString)), this._buildWasSuccessful = !0, this.onBuildObservable.notifyObservers(this);
+ for (var he = 0, pe = this.getScene().meshes; he < pe.length; he++) {
+ var ve = pe[he];
+ if (ve.subMeshes)
+ for (var Ee = 0, Ae = ve.subMeshes; Ee < Ae.length; Ee++) {
+ var Ie = Ae[Ee];
+ if (Ie.getMaterial() === this && Ie._materialDefines) {
+ var xe = Ie._materialDefines;
+ xe.markAllAsDirty(), xe.reset();
+ }
+ }
+ }
+ }, t.prototype.optimize = function() {
+ for (var e = 0, n = this._optimizers; e < n.length; e++)
+ n[e].optimize(this._vertexOutputNodes, this._fragmentOutputNodes);
+ }, t.prototype._prepareDefinesForAttributes = function(e, n) {
+ var i = n.NORMAL, o = n.TANGENT, a = n.UV1;
+ n.NORMAL = e.isVerticesDataPresent(De.b.NormalKind), n.TANGENT = e.isVerticesDataPresent(De.b.TangentKind), n.UV1 = e.isVerticesDataPresent(De.b.UVKind), i === n.NORMAL && o === n.TANGENT && a === n.UV1 || n.markAsAttributesDirty();
+ }, t.prototype.createPostProcess = function(e, n, i, o, a, s, p) {
+ return n === void 0 && (n = 1), i === void 0 && (i = d.a.TEXTURE_NEAREST_SAMPLINGMODE), s === void 0 && (s = d.a.TEXTURETYPE_UNSIGNED_INT), p === void 0 && (p = d.a.TEXTUREFORMAT_RGBA), this.mode !== zn.PostProcess ? (console.log("Incompatible material mode"), null) : this._createEffectForPostProcess(null, e, n, i, o, a, s, p);
+ }, t.prototype.createEffectForPostProcess = function(e) {
+ this._createEffectForPostProcess(e);
+ }, t.prototype._createEffectForPostProcess = function(e, n, i, o, a, s, p, m) {
+ var S = this;
+ i === void 0 && (i = 1), o === void 0 && (o = d.a.TEXTURE_NEAREST_SAMPLINGMODE), p === void 0 && (p = d.a.TEXTURETYPE_UNSIGNED_INT), m === void 0 && (m = d.a.TEXTUREFORMAT_RGBA);
+ var O = this.name + this._buildId, I = new Fa(), G = new Nt.a(O + "PostProcess", this.getScene()), k = this._buildId;
+ return this._processDefines(G, I), We.a.RegisterShader(O, this._fragmentCompilationState._builtCompilationString, this._vertexCompilationState._builtCompilationString), e ? e.updateEffect(I.toString(), this._fragmentCompilationState.uniforms, this._fragmentCompilationState.samplers, { maxSimultaneousLights: this.maxSimultaneousLights }, void 0, void 0, O, O) : e = new _t(this.name + "PostProcess", O, this._fragmentCompilationState.uniforms, this._fragmentCompilationState.samplers, i, n, o, a, s, I.toString(), p, O, { maxSimultaneousLights: this.maxSimultaneousLights }, !1, m), e.nodeMaterialSource = this, e.onApplyObservable.add(function(K) {
+ k !== S._buildId && (delete We.a.ShadersStore[O + "VertexShader"], delete We.a.ShadersStore[O + "PixelShader"], O = S.name + S._buildId, I.markAsUnprocessed(), k = S._buildId), S._processDefines(G, I) && (We.a.RegisterShader(O, S._fragmentCompilationState._builtCompilationString, S._vertexCompilationState._builtCompilationString), fp.a.SetImmediate(function() {
+ return e.updateEffect(I.toString(), S._fragmentCompilationState.uniforms, S._fragmentCompilationState.samplers, { maxSimultaneousLights: S.maxSimultaneousLights }, void 0, void 0, O, O);
+ })), S._checkInternals(K);
+ }), e;
+ }, t.prototype.createProceduralTexture = function(e, n) {
+ var i = this;
+ if (this.mode !== zn.ProceduralTexture)
+ return console.log("Incompatible material mode"), null;
+ var o = this.name + this._buildId, a = new Da(o, e, null, n), s = new Nt.a(o + "Procedural", this.getScene());
+ s.reservedDataStore = { hidden: !0 };
+ var p = new Fa(), m = this._processDefines(s, p);
+ We.a.RegisterShader(o, this._fragmentCompilationState._builtCompilationString, this._vertexCompilationState._builtCompilationString);
+ var S = this.getScene().getEngine().createEffect({ vertexElement: o, fragmentElement: o }, [De.b.PositionKind], this._fragmentCompilationState.uniforms, this._fragmentCompilationState.samplers, p.toString(), m == null ? void 0 : m.fallbacks, void 0);
+ a.nodeMaterialSource = this, a._effect = S;
+ var O = this._buildId;
+ return a.onBeforeGenerationObservable.add(function() {
+ O !== i._buildId && (delete We.a.ShadersStore[o + "VertexShader"], delete We.a.ShadersStore[o + "PixelShader"], o = i.name + i._buildId, p.markAsUnprocessed(), O = i._buildId);
+ var I = i._processDefines(s, p);
+ I && (We.a.RegisterShader(o, i._fragmentCompilationState._builtCompilationString, i._vertexCompilationState._builtCompilationString), fp.a.SetImmediate(function() {
+ S = i.getScene().getEngine().createEffect({ vertexElement: o, fragmentElement: o }, [De.b.PositionKind], i._fragmentCompilationState.uniforms, i._fragmentCompilationState.samplers, p.toString(), I == null ? void 0 : I.fallbacks, void 0), a._effect = S;
+ })), i._checkInternals(S);
+ }), a;
+ }, t.prototype._createEffectForParticles = function(e, n, i, o, a, s, p, m) {
+ var S = this;
+ m === void 0 && (m = "");
+ var O = this.name + this._buildId + "_" + n;
+ s || (s = new Fa()), p || (p = this.getScene().getMeshByName(this.name + "Particle")) || ((p = new Nt.a(this.name + "Particle", this.getScene())).reservedDataStore = { hidden: !0 });
+ var I = this._buildId, G = [], k = m;
+ if (!a) {
+ var K = this._processDefines(p, s);
+ We.a.RegisterShader(O, this._fragmentCompilationState._builtCompilationString), e.fillDefines(G, n), k = G.join(`
+`), a = this.getScene().getEngine().createEffectForParticles(O, this._fragmentCompilationState.uniforms, this._fragmentCompilationState.samplers, s.toString() + `
+` + k, K == null ? void 0 : K.fallbacks, i, o, e), e.setCustomEffect(a, n);
+ }
+ a.onBindObservable.add(function(re) {
+ I !== S._buildId && (delete We.a.ShadersStore[O + "PixelShader"], O = S.name + S._buildId + "_" + n, s.markAsUnprocessed(), I = S._buildId), G.length = 0, e.fillDefines(G, n);
+ var se = G.join(`
+`);
+ se !== k && (s.markAsUnprocessed(), k = se);
+ var ue = S._processDefines(p, s);
+ if (ue)
+ return We.a.RegisterShader(O, S._fragmentCompilationState._builtCompilationString), re = S.getScene().getEngine().createEffectForParticles(O, S._fragmentCompilationState.uniforms, S._fragmentCompilationState.samplers, s.toString() + `
+` + k, ue == null ? void 0 : ue.fallbacks, i, o, e), e.setCustomEffect(re, n), void S._createEffectForParticles(e, n, i, o, re, s, p, k);
+ S._checkInternals(re);
+ });
+ }, t.prototype._checkInternals = function(e) {
+ if (this._sharedData.animatedInputs) {
+ var n = this.getScene(), i = n.getFrameId();
+ if (this._animationFrame !== i) {
+ for (var o = 0, a = this._sharedData.animatedInputs; o < a.length; o++)
+ a[o].animate(n);
+ this._animationFrame = i;
+ }
+ }
+ for (var s = 0, p = this._sharedData.bindableBlocks; s < p.length; s++)
+ p[s].bind(e, this);
+ for (var m = 0, S = this._sharedData.inputBlocks; m < S.length; m++)
+ S[m]._transmit(e, this.getScene());
+ }, t.prototype.createEffectForParticles = function(e, n, i) {
+ this.mode === zn.Particle ? (this._createEffectForParticles(e, Na.BLENDMODE_ONEONE, n, i), this._createEffectForParticles(e, Na.BLENDMODE_MULTIPLY, n, i)) : console.log("Incompatible material mode");
+ }, t.prototype._processDefines = function(e, n, i, o) {
+ var a = this;
+ i === void 0 && (i = !1);
+ var s = null;
+ if (this._sharedData.blocksWithDefines.forEach(function(G) {
+ G.initializeDefines(e, a, n, i);
+ }), this._sharedData.blocksWithDefines.forEach(function(G) {
+ G.prepareDefines(e, a, n, i, o);
+ }), n.isDirty) {
+ var p = n._areLightsDisposed;
+ n.markAsProcessed(), this._vertexCompilationState.compilationString = this._vertexCompilationState._builtCompilationString, this._fragmentCompilationState.compilationString = this._fragmentCompilationState._builtCompilationString, this._sharedData.repeatableContentBlocks.forEach(function(G) {
+ G.replaceRepeatableContent(a._vertexCompilationState, a._fragmentCompilationState, e, n);
+ });
+ var m = [];
+ this._sharedData.dynamicUniformBlocks.forEach(function(G) {
+ G.updateUniformsAndSamples(a._vertexCompilationState, a, n, m);
+ });
+ var S = this._vertexCompilationState.uniforms;
+ this._fragmentCompilationState.uniforms.forEach(function(G) {
+ S.indexOf(G) === -1 && S.push(G);
+ });
+ var O = this._vertexCompilationState.samplers;
+ this._fragmentCompilationState.samplers.forEach(function(G) {
+ O.indexOf(G) === -1 && O.push(G);
+ });
+ var I = new Po.a();
+ this._sharedData.blocksWithFallbacks.forEach(function(G) {
+ G.provideFallbacks(e, I);
+ }), s = { lightDisposed: p, uniformBuffers: m, mergedUniforms: S, mergedSamplers: O, fallbacks: I };
+ }
+ return s;
+ }, t.prototype.isReadyForSubMesh = function(e, n, i) {
+ var o = this;
+ if (i === void 0 && (i = !1), !this._buildWasSuccessful)
+ return !1;
+ var a = this.getScene();
+ if (this._sharedData.animatedInputs) {
+ var s = a.getFrameId();
+ if (this._animationFrame !== s) {
+ for (var p = 0, m = this._sharedData.animatedInputs; p < m.length; p++)
+ m[p].animate(a);
+ this._animationFrame = s;
+ }
+ }
+ if (n.effect && this.isFrozen && n.effect._wasPreviouslyReady)
+ return !0;
+ n._materialDefines || (n._materialDefines = new Fa());
+ var S = n._materialDefines;
+ if (this._isReadyForSubMesh(n))
+ return !0;
+ var O = a.getEngine();
+ if (this._prepareDefinesForAttributes(e, S), this._sharedData.blockingBlocks.some(function(re) {
+ return !re.isReady(e, o, S, i);
+ }))
+ return !1;
+ var I = this._processDefines(e, S, i, n);
+ if (I) {
+ var G = n.effect, k = S.toString(), K = O.createEffect({ vertex: "nodeMaterial" + this._buildId, fragment: "nodeMaterial" + this._buildId, vertexSource: this._vertexCompilationState.compilationString, fragmentSource: this._fragmentCompilationState.compilationString }, { attributes: this._vertexCompilationState.attributes, uniformsNames: I.mergedUniforms, uniformBuffersNames: I.uniformBuffers, samplers: I.mergedSamplers, defines: k, fallbacks: I.fallbacks, onCompiled: this.onCompiled, onError: this.onError, indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights, maxSimultaneousMorphTargets: S.NUM_MORPH_INFLUENCERS } }, O);
+ if (K)
+ if (this._onEffectCreatedObservable && (fu.effect = K, fu.subMesh = n, this._onEffectCreatedObservable.notifyObservers(fu)), this.allowShaderHotSwapping && G && !K.isReady()) {
+ if (K = G, S.markAsUnprocessed(), I.lightDisposed)
+ return S._areLightsDisposed = !0, !1;
+ } else
+ a.resetCachedMaterial(), n.setEffect(K, S);
+ }
+ return !(!n.effect || !n.effect.isReady()) && (S._renderId = a.getRenderId(), n.effect._wasPreviouslyReady = !0, !0);
+ }, Object.defineProperty(t.prototype, "compiledShaders", { get: function() {
+ return `// Vertex shader\r
+` + this._vertexCompilationState.compilationString + `\r
+\r
+// Fragment shader\r
+` + this._fragmentCompilationState.compilationString;
+ }, enumerable: !1, configurable: !0 }), t.prototype.bindOnlyWorldMatrix = function(e) {
+ var n = this.getScene();
+ if (this._activeEffect) {
+ var i = this._sharedData.hints;
+ i.needWorldViewMatrix && e.multiplyToRef(n.getViewMatrix(), this._cachedWorldViewMatrix), i.needWorldViewProjectionMatrix && e.multiplyToRef(n.getTransformMatrix(), this._cachedWorldViewProjectionMatrix);
+ for (var o = 0, a = this._sharedData.inputBlocks; o < a.length; o++)
+ a[o]._transmitWorld(this._activeEffect, e, this._cachedWorldViewMatrix, this._cachedWorldViewProjectionMatrix);
+ }
+ }, t.prototype.bindForSubMesh = function(e, n, i) {
+ var o = this.getScene(), a = i.effect;
+ if (a) {
+ if (this._activeEffect = a, this.bindOnlyWorldMatrix(e), this._mustRebind(o, a, n.visibility)) {
+ var s = this._sharedData;
+ if (a && o.getCachedEffect() !== a) {
+ for (var p = 0, m = s.bindableBlocks; p < m.length; p++)
+ m[p].bind(a, this, n, i);
+ for (var S = 0, O = s.inputBlocks; S < O.length; S++)
+ O[S]._transmit(a, o);
+ }
+ }
+ this._afterBind(n, this._activeEffect);
+ }
+ }, t.prototype.getActiveTextures = function() {
+ var e = r.prototype.getActiveTextures.call(this);
+ return this._sharedData && e.push.apply(e, this._sharedData.textureBlocks.filter(function(n) {
+ return n.texture;
+ }).map(function(n) {
+ return n.texture;
+ })), e;
+ }, t.prototype.getTextureBlocks = function() {
+ return this._sharedData ? this._sharedData.textureBlocks : [];
+ }, t.prototype.hasTexture = function(e) {
+ if (r.prototype.hasTexture.call(this, e))
+ return !0;
+ if (!this._sharedData)
+ return !1;
+ for (var n = 0, i = this._sharedData.textureBlocks; n < i.length; n++)
+ if (i[n].texture === e)
+ return !0;
+ return !1;
+ }, t.prototype.dispose = function(e, n, i) {
+ if (n)
+ for (var o = 0, a = this._sharedData.textureBlocks.filter(function(m) {
+ return m.texture;
+ }).map(function(m) {
+ return m.texture;
+ }); o < a.length; o++)
+ a[o].dispose();
+ for (var s = 0, p = this.attachedBlocks; s < p.length; s++)
+ p[s].dispose();
+ this.onBuildObservable.clear(), r.prototype.dispose.call(this, e, n, i);
+ }, t.prototype._createNodeEditor = function() {
+ this.BJSNODEMATERIALEDITOR = this.BJSNODEMATERIALEDITOR || this._getGlobalNodeMaterialEditor(), this.BJSNODEMATERIALEDITOR.NodeEditor.Show({ nodeMaterial: this });
+ }, t.prototype.edit = function(e) {
+ var n = this;
+ return new Promise(function(i, o) {
+ if (n.BJSNODEMATERIALEDITOR === void 0) {
+ var a = e && e.editorURL ? e.editorURL : t.EditorURL;
+ Ke.b.LoadScript(a, function() {
+ n._createNodeEditor(), i();
+ });
+ } else
+ n._createNodeEditor(), i();
+ });
+ }, t.prototype.clear = function() {
+ this._vertexOutputNodes = [], this._fragmentOutputNodes = [], this.attachedBlocks = [];
+ }, t.prototype.setToDefault = function() {
+ this.clear(), this.editorData = null;
+ var e = new At("Position");
+ e.setAsAttribute("position");
+ var n = new At("World");
+ n.setAsSystemValue(BABYLON.NodeMaterialSystemValues.World);
+ var i = new Xs("WorldPos");
+ e.connectTo(i), n.connectTo(i);
+ var o = new At("ViewProjection");
+ o.setAsSystemValue(BABYLON.NodeMaterialSystemValues.ViewProjection);
+ var a = new Xs("WorldPos * ViewProjectionTransform");
+ i.connectTo(a), o.connectTo(a);
+ var s = new La("VertexOutput");
+ a.connectTo(s);
+ var p = new At("color");
+ p.value = new C.b(0.8, 0.8, 0.8, 1);
+ var m = new No("FragmentOutput");
+ p.connectTo(m), this.addOutputNode(s), this.addOutputNode(m), this._mode = zn.Material;
+ }, t.prototype.setToDefaultPostProcess = function() {
+ this.clear(), this.editorData = null;
+ var e = new At("Position");
+ e.setAsAttribute("position2d");
+ var n = new At("Constant1");
+ n.isConstant = !0, n.value = 1;
+ var i = new wa("Position3D");
+ e.connectTo(i), n.connectTo(i, { input: "w" });
+ var o = new La("VertexOutput");
+ i.connectTo(o);
+ var a = new At("Scale");
+ a.visibleInInspector = !0, a.value = new c.d(1, 1);
+ var s = new ou("uv0");
+ e.connectTo(s);
+ var p = new Ys("UV scale");
+ s.connectTo(p), a.connectTo(p);
+ var m = new tu("CurrentScreen");
+ p.connectTo(m), m.texture = new Ue.a("https://assets.babylonjs.com/nme/currentScreenPostProcess.png", this.getScene());
+ var S = new No("FragmentOutput");
+ m.connectTo(S, { output: "rgba" }), this.addOutputNode(o), this.addOutputNode(S), this._mode = zn.PostProcess;
+ }, t.prototype.setToDefaultProceduralTexture = function() {
+ this.clear(), this.editorData = null;
+ var e = new At("Position");
+ e.setAsAttribute("position2d");
+ var n = new At("Constant1");
+ n.isConstant = !0, n.value = 1;
+ var i = new wa("Position3D");
+ e.connectTo(i), n.connectTo(i, { input: "w" });
+ var o = new La("VertexOutput");
+ i.connectTo(o);
+ var a = new At("Time");
+ a.value = 0, a.min = 0, a.max = 0, a.isBoolean = !1, a.matrixMode = 0, a.animationType = Tr.Time, a.isConstant = !1;
+ var s = new At("Color3");
+ s.value = new C.a(1, 1, 1), s.isConstant = !1;
+ var p = new No("FragmentOutput"), m = new wa("VectorMerger");
+ m.visibleInInspector = !1;
+ var S = new du("Cos");
+ S.operation = fn.Cos, e.connectTo(m), a.output.connectTo(S.input), S.output.connectTo(m.z), m.xyzOut.connectTo(p.rgb), this.addOutputNode(o), this.addOutputNode(p), this._mode = zn.ProceduralTexture;
+ }, t.prototype.setToDefaultParticle = function() {
+ this.clear(), this.editorData = null;
+ var e = new At("uv");
+ e.setAsAttribute("particle_uv");
+ var n = new nu("ParticleTexture");
+ e.connectTo(n);
+ var i = new At("Color");
+ i.setAsAttribute("particle_color");
+ var o = new Ys("Texture * Color");
+ n.connectTo(o), i.connectTo(o);
+ var a = new iu("ParticleRampGradient");
+ o.connectTo(a);
+ var s = new hu("ColorSplitter");
+ i.connectTo(s);
+ var p = new ru("ParticleBlendMultiply");
+ a.connectTo(p), n.connectTo(p, { output: "a" }), s.connectTo(p, { output: "a" });
+ var m = new No("FragmentOutput");
+ p.connectTo(m), this.addOutputNode(m), this._mode = zn.Particle;
+ }, t.prototype.loadAsync = function(e) {
+ var n = this;
+ return this.getScene()._loadFileAsync(e).then(function(i) {
+ var o = JSON.parse(i);
+ n.loadFromSerialization(o, "");
+ });
+ }, t.prototype._gatherBlocks = function(e, n) {
+ if (n.indexOf(e) === -1) {
+ n.push(e);
+ for (var i = 0, o = e.inputs; i < o.length; i++) {
+ var a = o[i].connectedPoint;
+ if (a) {
+ var s = a.ownerBlock;
+ s !== e && this._gatherBlocks(s, n);
+ }
+ }
+ }
+ }, t.prototype.generateCode = function() {
+ for (var e = [], n = [], i = [], o = 0, a = this._vertexOutputNodes; o < a.length; o++) {
+ var s = a[o];
+ this._gatherBlocks(s, n);
+ }
+ for (var p = [], m = 0, S = this._fragmentOutputNodes; m < S.length; m++)
+ s = S[m], this._gatherBlocks(s, p);
+ for (var O = 'var nodeMaterial = new BABYLON.NodeMaterial("' + (this.name || "node material") + `");\r
+`, I = 0, G = n; I < G.length; I++)
+ (Ie = G[I]).isInput && e.indexOf(Ie) === -1 && (O += Ie._dumpCode(i, e));
+ for (var k = 0, K = p; k < K.length; k++)
+ (Ie = K[k]).isInput && e.indexOf(Ie) === -1 && (O += Ie._dumpCode(i, e));
+ e = [], O += `\r
+// Connections\r
+`;
+ for (var re = 0, se = this._vertexOutputNodes; re < se.length; re++)
+ O += (Ie = se[re])._dumpCodeForOutputConnections(e);
+ for (var ue = 0, he = this._fragmentOutputNodes; ue < he.length; ue++)
+ O += (Ie = he[ue])._dumpCodeForOutputConnections(e);
+ O += `\r
+// Output nodes\r
+`;
+ for (var pe = 0, ve = this._vertexOutputNodes; pe < ve.length; pe++)
+ O += "nodeMaterial.addOutputNode(" + (Ie = ve[pe])._codeVariableName + `);\r
+`;
+ for (var Ee = 0, Ae = this._fragmentOutputNodes; Ee < Ae.length; Ee++) {
+ var Ie;
+ O += "nodeMaterial.addOutputNode(" + (Ie = Ae[Ee])._codeVariableName + `);\r
+`;
+ }
+ return O += `nodeMaterial.build();\r
+`;
+ }, t.prototype.serialize = function(e) {
+ var n = e ? {} : w.a.Serialize(this);
+ n.editorData = JSON.parse(JSON.stringify(this.editorData));
+ var i = [];
+ if (e)
+ i = e;
+ else {
+ n.customType = "BABYLON.NodeMaterial", n.outputNodes = [];
+ for (var o = 0, a = this._vertexOutputNodes; o < a.length; o++) {
+ var s = a[o];
+ this._gatherBlocks(s, i), n.outputNodes.push(s.uniqueId);
+ }
+ for (var p = 0, m = this._fragmentOutputNodes; p < m.length; p++)
+ s = m[p], this._gatherBlocks(s, i), n.outputNodes.indexOf(s.uniqueId) === -1 && n.outputNodes.push(s.uniqueId);
+ }
+ n.blocks = [];
+ for (var S = 0, O = i; S < O.length; S++) {
+ var I = O[S];
+ n.blocks.push(I.serialize());
+ }
+ if (!e)
+ for (var G = 0, k = this.attachedBlocks; G < k.length; G++)
+ I = k[G], i.indexOf(I) === -1 && n.blocks.push(I.serialize());
+ return n;
+ }, t.prototype._restoreConnections = function(e, n, i) {
+ for (var o = 0, a = e.outputs; o < a.length; o++)
+ for (var s = a[o], p = 0, m = n.blocks; p < m.length; p++) {
+ var S = m[p], O = i[S.id];
+ if (O)
+ for (var I = 0, G = S.inputs; I < G.length; I++) {
+ var k = G[I];
+ if (!(i[k.targetBlockId] !== e || k.targetConnectionName !== s.name)) {
+ var K = O.getInputByName(k.inputName);
+ if (!K || K.isConnected)
+ continue;
+ s.connectTo(K, !0), this._restoreConnections(O, n, i);
+ }
+ }
+ }
+ }, t.prototype.loadFromSerialization = function(e, n, i) {
+ var o;
+ n === void 0 && (n = ""), i === void 0 && (i = !1), i || this.clear();
+ for (var a = {}, s = 0, p = e.blocks; s < p.length; s++) {
+ var m = p[s], S = x.a.GetClass(m.customType);
+ S && ((I = new S())._deserialize(m, this.getScene(), n), a[m.id] = I, this.attachedBlocks.push(I));
+ }
+ for (var O = 0; O < e.blocks.length; O++) {
+ var I;
+ (I = a[e.blocks[O].id]) && (I.inputs.length && !i || this._restoreConnections(I, e, a));
+ }
+ if (e.outputNodes)
+ for (var G = 0, k = e.outputNodes; G < k.length; G++) {
+ var K = k[G];
+ this.addOutputNode(a[K]);
+ }
+ if (e.locations || e.editorData && e.editorData.locations) {
+ for (var re = e.locations || e.editorData.locations, se = 0, ue = re; se < ue.length; se++) {
+ var he = ue[se];
+ a[he.blockId] && (he.blockId = a[he.blockId].uniqueId);
+ }
+ i && this.editorData && this.editorData.locations && re.concat(this.editorData.locations), e.locations ? this.editorData = { locations: re } : (this.editorData = e.editorData, this.editorData.locations = re);
+ var pe = [];
+ for (var ve in a)
+ pe[ve] = a[ve].uniqueId;
+ this.editorData.map = pe;
+ }
+ this.comment = e.comment, i || (this._mode = (o = e.mode) !== null && o !== void 0 ? o : zn.Material);
+ }, t.prototype.clone = function(e) {
+ var n = this, i = this.serialize(), o = w.a.Clone(function() {
+ return new t(e, n.getScene(), n.options);
+ }, this);
+ return o.id = e, o.name = e, o.loadFromSerialization(i), o.build(), o;
+ }, t.Parse = function(e, n, i) {
+ i === void 0 && (i = "");
+ var o = w.a.Parse(function() {
+ return new t(e.name, n);
+ }, e, n, i);
+ return o.loadFromSerialization(e, i), o.build(), o;
+ }, t.ParseFromFileAsync = function(e, n, i) {
+ var o = new t(e, i);
+ return new Promise(function(a, s) {
+ return o.loadAsync(n).then(function() {
+ o.build(), a(o);
+ }).catch(s);
+ });
+ }, t.ParseFromSnippetAsync = function(e, n, i, o) {
+ var a = this;
+ return i === void 0 && (i = ""), e === "_BLANK" ? Promise.resolve(this.CreateDefault("blank", n)) : new Promise(function(s, p) {
+ var m = new ce.a();
+ m.addEventListener("readystatechange", function() {
+ if (m.readyState == 4)
+ if (m.status == 200) {
+ var S = JSON.parse(JSON.parse(m.responseText).jsonPayload), O = JSON.parse(S.nodeMaterial);
+ o || ((o = w.a.Parse(function() {
+ return new t(e, n);
+ }, O, n, i)).uniqueId = n.getUniqueId()), o.loadFromSerialization(O), o.snippetId = e;
+ try {
+ o.build(), s(o);
+ } catch (I) {
+ p(I);
+ }
+ } else
+ p("Unable to load the snippet " + e);
+ }), m.open("GET", a.SnippetUrl + "/" + e.replace(/#/g, "/")), m.send();
+ });
+ }, t.CreateDefault = function(e, n) {
+ var i = new t(e, n);
+ return i.setToDefault(), i.build(), i;
+ }, t._BuildIdGenerator = 0, t.EditorURL = "https://unpkg.com/babylonjs-node-editor@" + ke.a.Version + "/babylon.nodeEditor.js", t.SnippetUrl = "https://snippet.babylonjs.com", t.IgnoreTexturesAtLoadTime = !1, Object(u.c)([Object(w.c)("mode")], t.prototype, "_mode", void 0), Object(u.c)([Object(w.c)("comment")], t.prototype, "comment", void 0), t;
+ }(Ds.a);
+ x.a.RegisteredTypes["BABYLON.NodeMaterial"] = qs;
+ var pp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Vertex) || this;
+ return n.registerInput("matricesIndices", fe.Vector4), n.registerInput("matricesWeights", fe.Vector4), n.registerInput("matricesIndicesExtra", fe.Vector4, !0), n.registerInput("matricesWeightsExtra", fe.Vector4, !0), n.registerInput("world", fe.Matrix), n.registerOutput("output", fe.Matrix), n;
+ }
+ return Object(u.d)(t, r), t.prototype.initialize = function(e) {
+ e._excludeVariableName("boneSampler"), e._excludeVariableName("boneTextureWidth"), e._excludeVariableName("mBones"), e._excludeVariableName("BonesPerMesh");
+ }, t.prototype.getClassName = function() {
+ return "BonesBlock";
+ }, Object.defineProperty(t.prototype, "matricesIndices", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "matricesWeights", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "matricesIndicesExtra", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "matricesWeightsExtra", { get: function() {
+ return this._inputs[3];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "world", { get: function() {
+ return this._inputs[4];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype.autoConfigure = function(e) {
+ if (!this.matricesIndices.isConnected) {
+ var n = e.getInputBlockByPredicate(function(a) {
+ return a.isAttribute && a.name === "matricesIndices";
+ });
+ n || (n = new At("matricesIndices")).setAsAttribute("matricesIndices"), n.output.connectTo(this.matricesIndices);
+ }
+ if (!this.matricesWeights.isConnected) {
+ var i = e.getInputBlockByPredicate(function(a) {
+ return a.isAttribute && a.name === "matricesWeights";
+ });
+ i || (i = new At("matricesWeights")).setAsAttribute("matricesWeights"), i.output.connectTo(this.matricesWeights);
+ }
+ if (!this.world.isConnected) {
+ var o = e.getInputBlockByPredicate(function(a) {
+ return a.systemValue === bt.World;
+ });
+ o || (o = new At("world")).setAsSystemValue(bt.World), o.output.connectTo(this.world);
+ }
+ }, t.prototype.provideFallbacks = function(e, n) {
+ e && e.useBones && e.computeBonesUsingShaders && e.skeleton && n.addCPUSkinningFallback(0, e);
+ }, t.prototype.bind = function(e, n, i) {
+ tt.a.BindBonesParameters(i, e);
+ }, t.prototype.prepareDefines = function(e, n, i) {
+ i._areAttributesDirty && tt.a.PrepareDefinesForBones(e, i);
+ }, t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e), e.sharedData.blocksWithFallbacks.push(this), e.sharedData.bindableBlocks.push(this), e.sharedData.blocksWithDefines.push(this), e.uniforms.push("boneTextureWidth"), e.uniforms.push("mBones"), e.samplers.push("boneSampler");
+ var n = "//" + this.name;
+ e._emitFunctionFromInclude("bonesDeclaration", n, { removeAttributes: !0, removeUniforms: !1, removeVaryings: !0, removeIfDef: !1 });
+ var i = e._getFreeVariableName("influence");
+ e.compilationString += e._emitCodeFromInclude("bonesVertex", n, { replaceStrings: [{ search: /finalWorld=finalWorld\*influence;/, replace: "" }, { search: /influence/gm, replace: i }] });
+ var o = this._outputs[0], a = this.world;
+ return e.compilationString += `#if NUM_BONE_INFLUENCERS>0\r
+`, e.compilationString += this._declareOutput(o, e) + " = " + a.associatedVariableName + " * " + i + `;\r
+`, e.compilationString += `#else\r
+`, e.compilationString += this._declareOutput(o, e) + " = " + a.associatedVariableName + `;\r
+`, e.compilationString += `#endif\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.BonesBlock"] = pp;
+ var _p = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Vertex) || this;
+ return n.registerInput("world0", fe.Vector4), n.registerInput("world1", fe.Vector4), n.registerInput("world2", fe.Vector4), n.registerInput("world3", fe.Vector4), n.registerInput("world", fe.Matrix, !0), n.registerOutput("output", fe.Matrix), n.registerOutput("instanceID", fe.Float), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "InstancesBlock";
+ }, Object.defineProperty(t.prototype, "world0", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "world1", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "world2", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "world3", { get: function() {
+ return this._inputs[3];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "world", { get: function() {
+ return this._inputs[4];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "instanceID", { get: function() {
+ return this._outputs[1];
+ }, enumerable: !1, configurable: !0 }), t.prototype.autoConfigure = function(e) {
+ if (!this.world0.connectedPoint) {
+ var n = e.getInputBlockByPredicate(function(p) {
+ return p.isAttribute && p.name === "world0";
+ });
+ n || (n = new At("world0")).setAsAttribute("world0"), n.output.connectTo(this.world0);
+ }
+ if (!this.world1.connectedPoint) {
+ var i = e.getInputBlockByPredicate(function(p) {
+ return p.isAttribute && p.name === "world1";
+ });
+ i || (i = new At("world1")).setAsAttribute("world1"), i.output.connectTo(this.world1);
+ }
+ if (!this.world2.connectedPoint) {
+ var o = e.getInputBlockByPredicate(function(p) {
+ return p.isAttribute && p.name === "world2";
+ });
+ o || (o = new At("world2")).setAsAttribute("world2"), o.output.connectTo(this.world2);
+ }
+ if (!this.world3.connectedPoint) {
+ var a = e.getInputBlockByPredicate(function(p) {
+ return p.isAttribute && p.name === "world3";
+ });
+ a || (a = new At("world3")).setAsAttribute("world3"), a.output.connectTo(this.world3);
+ }
+ if (!this.world.connectedPoint) {
+ var s = e.getInputBlockByPredicate(function(p) {
+ return p.isAttribute && p.name === "world";
+ });
+ s || (s = new At("world")).setAsSystemValue(bt.World), s.output.connectTo(this.world);
+ }
+ this.world.define = "!INSTANCES || THIN_INSTANCES";
+ }, t.prototype.prepareDefines = function(e, n, i, o, a) {
+ o === void 0 && (o = !1);
+ var s = !1;
+ i.INSTANCES !== o && (i.setValue("INSTANCES", o), s = !0), a && i.THIN_INSTANCES !== !!(a != null && a.getRenderingMesh().hasThinInstances) && (i.setValue("THIN_INSTANCES", !!(a != null && a.getRenderingMesh().hasThinInstances)), s = !0), s && i.markAsUnprocessed();
+ }, t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e), e.sharedData.blocksWithDefines.push(this);
+ var n = this._outputs[0], i = this._outputs[1], o = this.world0, a = this.world1, s = this.world2, p = this.world3;
+ return e.compilationString += `#ifdef INSTANCES\r
+`, e.compilationString += this._declareOutput(n, e) + " = mat4(" + o.associatedVariableName + ", " + a.associatedVariableName + ", " + s.associatedVariableName + ", " + p.associatedVariableName + `);\r
+`, e.compilationString += `#ifdef THIN_INSTANCES\r
+`, e.compilationString += n.associatedVariableName + " = " + this.world.associatedVariableName + " * " + n.associatedVariableName + `;\r
+`, e.compilationString += `#endif\r
+`, e.compilationString += this._declareOutput(i, e) + ` = float(gl_InstanceID);\r
+`, e.compilationString += `#else\r
+`, e.compilationString += this._declareOutput(n, e) + " = " + this.world.associatedVariableName + `;\r
+`, e.compilationString += this._declareOutput(i, e) + ` = 0.0;\r
+`, e.compilationString += `#endif\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.InstancesBlock"] = _p;
+ var mp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Vertex) || this;
+ return n.registerInput("position", fe.Vector3), n.registerInput("normal", fe.Vector3), n.registerInput("tangent", fe.Vector3), n.registerInput("uv", fe.Vector2), n.registerOutput("positionOutput", fe.Vector3), n.registerOutput("normalOutput", fe.Vector3), n.registerOutput("tangentOutput", fe.Vector3), n.registerOutput("uvOutput", fe.Vector2), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "MorphTargetsBlock";
+ }, Object.defineProperty(t.prototype, "position", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "normal", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "tangent", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "uv", { get: function() {
+ return this._inputs[3];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "positionOutput", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "normalOutput", { get: function() {
+ return this._outputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "tangentOutput", { get: function() {
+ return this._outputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "uvOutput", { get: function() {
+ return this._outputs[3];
+ }, enumerable: !1, configurable: !0 }), t.prototype.initialize = function(e) {
+ e._excludeVariableName("morphTargetInfluences");
+ }, t.prototype.autoConfigure = function(e) {
+ if (!this.position.isConnected) {
+ var n = e.getInputBlockByPredicate(function(s) {
+ return s.isAttribute && s.name === "position";
+ });
+ n || (n = new At("position")).setAsAttribute(), n.output.connectTo(this.position);
+ }
+ if (!this.normal.isConnected) {
+ var i = e.getInputBlockByPredicate(function(s) {
+ return s.isAttribute && s.name === "normal";
+ });
+ i || (i = new At("normal")).setAsAttribute("normal"), i.output.connectTo(this.normal);
+ }
+ if (!this.tangent.isConnected) {
+ var o = e.getInputBlockByPredicate(function(s) {
+ return s.isAttribute && s.name === "tangent";
+ });
+ o || (o = new At("tangent")).setAsAttribute("tangent"), o.output.connectTo(this.tangent);
+ }
+ if (!this.uv.isConnected) {
+ var a = e.getInputBlockByPredicate(function(s) {
+ return s.isAttribute && s.name === "uv";
+ });
+ a || (a = new At("uv")).setAsAttribute("uv"), a.output.connectTo(this.uv);
+ }
+ }, t.prototype.prepareDefines = function(e, n, i) {
+ i._areAttributesDirty && tt.a.PrepareDefinesForMorphTargets(e, i);
+ }, t.prototype.bind = function(e, n, i) {
+ i && i.morphTargetManager && i.morphTargetManager.numInfluencers > 0 && tt.a.BindMorphTargetParameters(i, e);
+ }, t.prototype.replaceRepeatableContent = function(e, n, i, o) {
+ for (var a = this.position, s = this.normal, p = this.tangent, m = this.uv, S = this.positionOutput, O = this.normalOutput, I = this.tangentOutput, G = this.uvOutput, k = e, K = o.NUM_MORPH_INFLUENCERS, re = i.morphTargetManager, se = re && re.supportsNormals && o.NORMAL, ue = re && re.supportsTangents && o.TANGENT, he = re && re.supportsUVs && o.UV1, pe = "", ve = 0; ve < K; ve++)
+ pe += `#ifdef MORPHTARGETS\r
+`, pe += S.associatedVariableName + " += (position" + ve + " - " + a.associatedVariableName + ") * morphTargetInfluences[" + ve + `];\r
+`, se && (pe += `#ifdef MORPHTARGETS_NORMAL\r
+`, pe += O.associatedVariableName + " += (normal" + ve + " - " + s.associatedVariableName + ") * morphTargetInfluences[" + ve + `];\r
+`, pe += `#endif\r
+`), ue && (pe += `#ifdef MORPHTARGETS_TANGENT\r
+`, pe += I.associatedVariableName + ".xyz += (tangent" + ve + " - " + p.associatedVariableName + ".xyz) * morphTargetInfluences[" + ve + `];\r
+`, pe += `#endif\r
+`), he && (pe += `#ifdef MORPHTARGETS_UV\r
+`, pe += G.associatedVariableName + ".xy += (uv_" + ve + " - " + m.associatedVariableName + ".xy) * morphTargetInfluences[" + ve + `];\r
+`, pe += `#endif\r
+`), pe += `#endif\r
+`;
+ if (k.compilationString = k.compilationString.replace(this._repeatableContentAnchor, pe), K > 0)
+ for (ve = 0; ve < K; ve++)
+ k.attributes.push(De.b.PositionKind + ve), se && k.attributes.push(De.b.NormalKind + ve), ue && k.attributes.push(De.b.TangentKind + ve), he && k.attributes.push(De.b.UVKind + "_" + ve);
+ }, t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e), e.sharedData.blocksWithDefines.push(this), e.sharedData.bindableBlocks.push(this), e.sharedData.repeatableContentBlocks.push(this);
+ var n = this.position, i = this.normal, o = this.tangent, a = this.uv, s = this.positionOutput, p = this.normalOutput, m = this.tangentOutput, S = this.uvOutput, O = "//" + this.name;
+ return e.uniforms.push("morphTargetInfluences"), e._emitFunctionFromInclude("morphTargetsVertexGlobalDeclaration", O), e._emitFunctionFromInclude("morphTargetsVertexDeclaration", O, { repeatKey: "maxSimultaneousMorphTargets" }), e.compilationString += this._declareOutput(s, e) + " = " + n.associatedVariableName + `;\r
+`, e.compilationString += `#ifdef NORMAL\r
+`, e.compilationString += this._declareOutput(p, e) + " = " + i.associatedVariableName + `;\r
+`, e.compilationString += `#else\r
+`, e.compilationString += this._declareOutput(p, e) + ` = vec3(0., 0., 0.);\r
+`, e.compilationString += `#endif\r
+`, e.compilationString += `#ifdef TANGENT\r
+`, e.compilationString += this._declareOutput(m, e) + " = " + o.associatedVariableName + `;\r
+`, e.compilationString += `#else\r
+`, e.compilationString += this._declareOutput(m, e) + ` = vec3(0., 0., 0.);\r
+`, e.compilationString += `#endif\r
+`, e.compilationString += `#ifdef UV1\r
+`, e.compilationString += this._declareOutput(S, e) + " = " + a.associatedVariableName + `;\r
+`, e.compilationString += `#else\r
+`, e.compilationString += this._declareOutput(S, e) + ` = vec2(0., 0.);\r
+`, e.compilationString += `#endif\r
+`, this._repeatableContentAnchor = e._repeatableContentAnchor, e.compilationString += this._repeatableContentAnchor, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.MorphTargetsBlock"] = mp;
+ var gp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Vertex) || this;
+ return n.registerInput("worldPosition", fe.Vector4, !1, Me.Vertex), n.registerOutput("direction", fe.Vector3), n.registerOutput("color", fe.Color3), n.registerOutput("intensity", fe.Float), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "LightInformationBlock";
+ }, Object.defineProperty(t.prototype, "worldPosition", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "direction", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "color", { get: function() {
+ return this._outputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "intensity", { get: function() {
+ return this._outputs[2];
+ }, enumerable: !1, configurable: !0 }), t.prototype.bind = function(e, n, i) {
+ if (i) {
+ this.light && this.light.isDisposed && (this.light = null);
+ var o = this.light, a = n.getScene();
+ if (!o && a.lights.length && (o = a.lights[0]), !o || !o.isEnabled)
+ return e.setFloat3(this._lightDataUniformName, 0, 0, 0), void e.setFloat4(this._lightColorUniformName, 0, 0, 0, 0);
+ o.transferToNodeMaterialEffect(e, this._lightDataUniformName), e.setColor4(this._lightColorUniformName, o.diffuse, o.intensity);
+ }
+ }, t.prototype.prepareDefines = function(e, n, i) {
+ if (i._areLightsDirty) {
+ var o = this.light;
+ i.setValue(this._lightTypeDefineName, !!(o && o instanceof Xl));
+ }
+ }, t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e), e.sharedData.bindableBlocks.push(this), e.sharedData.blocksWithDefines.push(this);
+ var n = this.direction, i = this.color, o = this.intensity;
+ return this._lightDataUniformName = e._getFreeVariableName("lightData"), this._lightColorUniformName = e._getFreeVariableName("lightColor"), this._lightTypeDefineName = e._getFreeDefineName("LIGHTPOINTTYPE"), e._emitUniformFromString(this._lightDataUniformName, "vec3"), e._emitUniformFromString(this._lightColorUniformName, "vec4"), e.compilationString += "#ifdef " + this._lightTypeDefineName + `\r
+`, e.compilationString += this._declareOutput(n, e) + " = normalize(" + this.worldPosition.associatedVariableName + ".xyz - " + this._lightDataUniformName + `);\r
+`, e.compilationString += `#else\r
+`, e.compilationString += this._declareOutput(n, e) + " = " + this._lightDataUniformName + `;\r
+`, e.compilationString += `#endif\r
+`, e.compilationString += this._declareOutput(i, e) + " = " + this._lightColorUniformName + `.rgb;\r
+`, e.compilationString += this._declareOutput(o, e) + " = " + this._lightColorUniformName + `.a;\r
+`, this;
+ }, t.prototype.serialize = function() {
+ var e = r.prototype.serialize.call(this);
+ return this.light && (e.lightId = this.light.id), e;
+ }, t.prototype._deserialize = function(e, n, i) {
+ r.prototype._deserialize.call(this, e, n, i), e.lightId && (this.light = n.getLightByID(e.lightId));
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.LightInformationBlock"] = gp;
+ var vp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Fragment) || this;
+ return n.registerInput("color", fe.Color4), n.registerOutput("output", fe.Color4), n._inputs[0].acceptedConnectionPointTypes.push(fe.Color3), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "ImageProcessingBlock";
+ }, Object.defineProperty(t.prototype, "color", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype.initialize = function(e) {
+ e._excludeVariableName("exposureLinear"), e._excludeVariableName("contrast"), e._excludeVariableName("vInverseScreenSize"), e._excludeVariableName("vignetteSettings1"), e._excludeVariableName("vignetteSettings2"), e._excludeVariableName("vCameraColorCurveNegative"), e._excludeVariableName("vCameraColorCurveNeutral"), e._excludeVariableName("vCameraColorCurvePositive"), e._excludeVariableName("txColorTransform"), e._excludeVariableName("colorTransformSettings");
+ }, t.prototype.isReady = function(e, n, i) {
+ return !(i._areImageProcessingDirty && n.imageProcessingConfiguration && !n.imageProcessingConfiguration.isReady());
+ }, t.prototype.prepareDefines = function(e, n, i) {
+ i._areImageProcessingDirty && n.imageProcessingConfiguration && n.imageProcessingConfiguration.prepareDefines(i);
+ }, t.prototype.bind = function(e, n, i) {
+ i && n.imageProcessingConfiguration && n.imageProcessingConfiguration.bind(e);
+ }, t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e), e.sharedData.blocksWithDefines.push(this), e.sharedData.blockingBlocks.push(this), e.sharedData.bindableBlocks.push(this), e.uniforms.push("exposureLinear"), e.uniforms.push("contrast"), e.uniforms.push("vInverseScreenSize"), e.uniforms.push("vignetteSettings1"), e.uniforms.push("vignetteSettings2"), e.uniforms.push("vCameraColorCurveNegative"), e.uniforms.push("vCameraColorCurveNeutral"), e.uniforms.push("vCameraColorCurvePositive"), e.uniforms.push("txColorTransform"), e.uniforms.push("colorTransformSettings");
+ var n = this.color, i = this._outputs[0], o = "//" + this.name;
+ return e._emitFunctionFromInclude("helperFunctions", o), e._emitFunctionFromInclude("imageProcessingDeclaration", o), e._emitFunctionFromInclude("imageProcessingFunctions", o), n.connectedPoint.type === fe.Color4 || n.connectedPoint.type === fe.Vector4 ? e.compilationString += this._declareOutput(i, e) + " = " + n.associatedVariableName + `;\r
+` : e.compilationString += this._declareOutput(i, e) + " = vec4(" + n.associatedVariableName + `, 1.0);\r
+`, e.compilationString += `#ifdef IMAGEPROCESSINGPOSTPROCESS\r
+`, e.compilationString += i.associatedVariableName + ".rgb = toLinearSpace(" + n.associatedVariableName + `.rgb);\r
+`, e.compilationString += `#else\r
+`, e.compilationString += `#ifdef IMAGEPROCESSING\r
+`, e.compilationString += i.associatedVariableName + ".rgb = toLinearSpace(" + n.associatedVariableName + `.rgb);\r
+`, e.compilationString += i.associatedVariableName + " = applyImageProcessing(" + i.associatedVariableName + `);\r
+`, e.compilationString += `#endif\r
+`, e.compilationString += `#endif\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.ImageProcessingBlock"] = vp;
+ var bp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Fragment) || this;
+ return n._tangentSpaceParameterName = "", n.invertX = !1, n.invertY = !1, n.registerInput("worldPosition", fe.Vector4, !1), n.registerInput("worldNormal", fe.Vector4, !1), n.registerInput("worldTangent", fe.Vector4, !0), n.registerInput("uv", fe.Vector2, !1), n.registerInput("normalMapColor", fe.Color3, !1), n.registerInput("strength", fe.Float, !1), n.registerOutput("output", fe.Vector4), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "PerturbNormalBlock";
+ }, Object.defineProperty(t.prototype, "worldPosition", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "worldNormal", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "worldTangent", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "uv", { get: function() {
+ return this._inputs[3];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "normalMapColor", { get: function() {
+ return this._inputs[4];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "strength", { get: function() {
+ return this._inputs[5];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype.prepareDefines = function(e, n, i) {
+ i.setValue("BUMP", !0);
+ }, t.prototype.bind = function(e, n, i) {
+ n.getScene()._mirroredCameraPosition ? e.setFloat2(this._tangentSpaceParameterName, this.invertX ? 1 : -1, this.invertY ? 1 : -1) : e.setFloat2(this._tangentSpaceParameterName, this.invertX ? -1 : 1, this.invertY ? -1 : 1);
+ }, t.prototype.autoConfigure = function(e) {
+ if (!this.uv.isConnected) {
+ var n = e.getInputBlockByPredicate(function(o) {
+ return o.isAttribute && o.name === "uv";
+ });
+ n || (n = new At("uv")).setAsAttribute(), n.output.connectTo(this.uv);
+ }
+ if (!this.strength.isConnected) {
+ var i = new At("strength");
+ i.value = 1, i.output.connectTo(this.strength);
+ }
+ }, t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = "//" + this.name, i = this.uv, o = this.worldPosition, a = this.worldNormal, s = this.worldTangent;
+ e.sharedData.blocksWithDefines.push(this), e.sharedData.bindableBlocks.push(this), this._tangentSpaceParameterName = e._getFreeDefineName("tangentSpaceParameter"), e._emitUniformFromString(this._tangentSpaceParameterName, "vec2");
+ var p = this.strength.isConnectedToInputBlock && this.strength.connectInputBlock.isConstant ? "" + e._emitFloat(1 / this.strength.connectInputBlock.value) : "1.0 / " + this.strength.associatedVariableName;
+ e._emitExtension("derivatives", "#extension GL_OES_standard_derivatives : enable");
+ var m = { search: /defined\(TANGENT\)/g, replace: s.isConnected ? "defined(TANGENT)" : "defined(IGNORE)" };
+ return s.isConnected && (e.compilationString += "vec3 tbnNormal = normalize(" + a.associatedVariableName + `.xyz);\r
+`, e.compilationString += "vec3 tbnTangent = normalize(" + s.associatedVariableName + `.xyz);\r
+`, e.compilationString += `vec3 tbnBitangent = cross(tbnNormal, tbnTangent);\r
+`, e.compilationString += `mat3 vTBN = mat3(tbnTangent, tbnBitangent, tbnNormal);\r
+`), e._emitFunctionFromInclude("bumpFragmentMainFunctions", n, { replaceStrings: [m] }), e._emitFunctionFromInclude("bumpFragmentFunctions", n, { replaceStrings: [{ search: /vBumpInfos.y/g, replace: p }, { search: /vTangentSpaceParams/g, replace: this._tangentSpaceParameterName }, { search: /vPositionW/g, replace: o.associatedVariableName + ".xyz" }] }), e.compilationString += this._declareOutput(this.output, e) + ` = vec4(0.);\r
+`, e.compilationString += e._emitCodeFromInclude("bumpFragment", n, { replaceStrings: [{ search: /perturbNormal\(TBN,vBumpUV\+uvOffset\)/g, replace: "perturbNormal(TBN, " + this.normalMapColor.associatedVariableName + ")" }, { search: /vBumpInfos.y/g, replace: p }, { search: /vBumpUV/g, replace: i.associatedVariableName }, { search: /vPositionW/g, replace: o.associatedVariableName + ".xyz" }, { search: /normalW=/g, replace: this.output.associatedVariableName + ".xyz = " }, { search: /mat3\(normalMatrix\)\*normalW/g, replace: "mat3(normalMatrix) * " + this.output.associatedVariableName + ".xyz" }, { search: /normalW/g, replace: a.associatedVariableName + ".xyz" }, m] }), this;
+ }, t.prototype._dumpPropertiesCode = function() {
+ var e = this._codeVariableName + ".invertX = " + this.invertX + `;\r
+`;
+ return e += this._codeVariableName + ".invertY = " + this.invertY + `;\r
+`;
+ }, t.prototype.serialize = function() {
+ var e = r.prototype.serialize.call(this);
+ return e.invertX = this.invertX, e.invertY = this.invertY, e;
+ }, t.prototype._deserialize = function(e, n, i) {
+ r.prototype._deserialize.call(this, e, n, i), this.invertX = e.invertX, this.invertY = e.invertY;
+ }, Object(u.c)([jt("Invert X axis", Ft.Boolean, "PROPERTIES", { notifiers: { update: !1 } })], t.prototype, "invertX", void 0), Object(u.c)([jt("Invert Y axis", Ft.Boolean, "PROPERTIES", { notifiers: { update: !1 } })], t.prototype, "invertY", void 0), t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.PerturbNormalBlock"] = bp;
+ var yp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Fragment, !0) || this;
+ return n.registerInput("value", fe.Float, !0), n.registerInput("cutoff", fe.Float, !0), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "DiscardBlock";
+ }, Object.defineProperty(t.prototype, "value", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "cutoff", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ if (r.prototype._buildBlock.call(this, e), e.sharedData.hints.needAlphaTesting = !0, this.cutoff.isConnected && this.value.isConnected)
+ return e.compilationString += "if (" + this.value.associatedVariableName + " < " + this.cutoff.associatedVariableName + `) discard;\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.DiscardBlock"] = yp;
+ var Ep = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Fragment) || this;
+ return n.registerOutput("output", fe.Float, Me.Fragment), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "FrontFacingBlock";
+ }, Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ if (r.prototype._buildBlock.call(this, e), e.target === Me.Vertex)
+ throw "FrontFacingBlock must only be used in a fragment shader";
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + ` = gl_FrontFacing ? 1.0 : 0.0;\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.FrontFacingBlock"] = Ep;
+ var Tp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Fragment) || this;
+ return n.registerInput("input", fe.AutoDetect, !1), n.registerOutput("dx", fe.BasedOnInput), n.registerOutput("dy", fe.BasedOnInput), n._outputs[0]._typeConnectionSource = n._inputs[0], n._outputs[1]._typeConnectionSource = n._inputs[0], n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "DerivativeBlock";
+ }, Object.defineProperty(t.prototype, "input", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "dx", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "dy", { get: function() {
+ return this._outputs[1];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0], i = this._outputs[1];
+ return e._emitExtension("derivatives", "#extension GL_OES_standard_derivatives : enable"), n.hasEndpoints && (e.compilationString += this._declareOutput(n, e) + " = dFdx(" + this.input.associatedVariableName + `);\r
+`), i.hasEndpoints && (e.compilationString += this._declareOutput(i, e) + " = dFdy(" + this.input.associatedVariableName + `);\r
+`), this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.DerivativeBlock"] = Tp;
+ var Sp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Fragment) || this;
+ return n.registerOutput("xy", fe.Vector2, Me.Fragment), n.registerOutput("xyz", fe.Vector3, Me.Fragment), n.registerOutput("xyzw", fe.Vector4, Me.Fragment), n.registerOutput("x", fe.Float, Me.Fragment), n.registerOutput("y", fe.Float, Me.Fragment), n.registerOutput("z", fe.Float, Me.Fragment), n.registerOutput("w", fe.Float, Me.Fragment), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "FragCoordBlock";
+ }, Object.defineProperty(t.prototype, "xy", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "xyz", { get: function() {
+ return this._outputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "xyzw", { get: function() {
+ return this._outputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "x", { get: function() {
+ return this._outputs[3];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "y", { get: function() {
+ return this._outputs[4];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "z", { get: function() {
+ return this._outputs[5];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[6];
+ }, enumerable: !1, configurable: !0 }), t.prototype.writeOutputs = function(e) {
+ for (var n = "", i = 0, o = this._outputs; i < o.length; i++) {
+ var a = o[i];
+ a.hasEndpoints && (n += this._declareOutput(a, e) + " = gl_FragCoord." + a.name + `;\r
+`);
+ }
+ return n;
+ }, t.prototype._buildBlock = function(e) {
+ if (r.prototype._buildBlock.call(this, e), e.target === Me.Vertex)
+ throw "FragCoordBlock must only be used in a fragment shader";
+ return e.compilationString += this.writeOutputs(e), this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.FragCoordBlock"] = Sp;
+ var Ap = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Fragment) || this;
+ return n.registerOutput("xy", fe.Vector2, Me.Fragment), n.registerOutput("x", fe.Float, Me.Fragment), n.registerOutput("y", fe.Float, Me.Fragment), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "ScreenSizeBlock";
+ }, Object.defineProperty(t.prototype, "xy", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "x", { get: function() {
+ return this._outputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "y", { get: function() {
+ return this._outputs[2];
+ }, enumerable: !1, configurable: !0 }), t.prototype.bind = function(e, n, i) {
+ var o = this._scene.getEngine();
+ e.setFloat2(this._varName, o.getRenderWidth(), o.getRenderWidth());
+ }, t.prototype.writeOutputs = function(e, n) {
+ for (var i = "", o = 0, a = this._outputs; o < a.length; o++) {
+ var s = a[o];
+ s.hasEndpoints && (i += this._declareOutput(s, e) + " = " + n + "." + s.name + `;\r
+`);
+ }
+ return i;
+ }, t.prototype._buildBlock = function(e) {
+ if (r.prototype._buildBlock.call(this, e), this._scene = e.sharedData.scene, e.target === Me.Vertex)
+ throw "ScreenSizeBlock must only be used in a fragment shader";
+ return e.sharedData.bindableBlocks.push(this), this._varName = e._getFreeVariableName("screenSize"), e._emitUniformFromString(this._varName, "vec2"), e.compilationString += this.writeOutputs(e, this._varName), this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.ScreenSizeBlock"] = Ap;
+ var Pp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.VertexAndFragment, !0) || this;
+ return n.registerInput("worldPosition", fe.Vector4, !1, Me.Vertex), n.registerInput("view", fe.Matrix, !1, Me.Vertex), n.registerInput("input", fe.Color3, !1, Me.Fragment), n.registerInput("fogColor", fe.Color3, !1, Me.Fragment), n.registerOutput("output", fe.Color3, Me.Fragment), n.input.acceptedConnectionPointTypes.push(fe.Color4), n.fogColor.acceptedConnectionPointTypes.push(fe.Color4), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "FogBlock";
+ }, Object.defineProperty(t.prototype, "worldPosition", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "view", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "input", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "fogColor", { get: function() {
+ return this._inputs[3];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype.autoConfigure = function(e) {
+ if (!this.view.isConnected) {
+ var n = e.getInputBlockByPredicate(function(o) {
+ return o.systemValue === bt.View;
+ });
+ n || (n = new At("view")).setAsSystemValue(bt.View), n.output.connectTo(this.view);
+ }
+ if (!this.fogColor.isConnected) {
+ var i = e.getInputBlockByPredicate(function(o) {
+ return o.systemValue === bt.FogColor;
+ });
+ i || (i = new At("fogColor", void 0, fe.Color3)).setAsSystemValue(bt.FogColor), i.output.connectTo(this.fogColor);
+ }
+ }, t.prototype.prepareDefines = function(e, n, i) {
+ var o = e.getScene();
+ i.setValue("FOG", n.fogEnabled && tt.a.GetFogState(e, o));
+ }, t.prototype.bind = function(e, n, i) {
+ if (i) {
+ var o = i.getScene();
+ e.setFloat4(this._fogParameters, o.fogMode, o.fogStart, o.fogEnd, o.fogDensity);
+ }
+ }, t.prototype._buildBlock = function(e) {
+ if (r.prototype._buildBlock.call(this, e), e.target === Me.Fragment) {
+ e.sharedData.blocksWithDefines.push(this), e.sharedData.bindableBlocks.push(this), e._emitFunctionFromInclude("fogFragmentDeclaration", "//" + this.name, { removeUniforms: !0, removeVaryings: !0, removeIfDef: !1, replaceStrings: [{ search: /float CalcFogFactor\(\)/, replace: "float CalcFogFactor(vec3 vFogDistance, vec4 vFogInfos)" }] });
+ var n = e._getFreeVariableName("fog"), i = this.input, o = this.fogColor;
+ this._fogParameters = e._getFreeVariableName("fogParameters");
+ var a = this._outputs[0];
+ e._emitUniformFromString(this._fogParameters, "vec4"), e.compilationString += `#ifdef FOG\r
+`, e.compilationString += "float " + n + " = CalcFogFactor(" + this._fogDistanceName + ", " + this._fogParameters + `);\r
+`, e.compilationString += this._declareOutput(a, e) + " = " + n + " * " + i.associatedVariableName + ".rgb + (1.0 - " + n + ") * " + o.associatedVariableName + `.rgb;\r
+`, e.compilationString += `#else\r
+` + this._declareOutput(a, e) + " = " + i.associatedVariableName + `.rgb;\r
+`, e.compilationString += `#endif\r
+`;
+ } else {
+ var s = this.worldPosition, p = this.view;
+ this._fogDistanceName = e._getFreeVariableName("vFogDistance"), e._emitVaryingFromString(this._fogDistanceName, "vec3"), e.compilationString += this._fogDistanceName + " = (" + p.associatedVariableName + " * " + s.associatedVariableName + `).xyz;\r
+`;
+ }
+ return this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.FogBlock"] = Pp;
+ var Cp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.VertexAndFragment) || this;
+ return n._isUnique = !0, n.registerInput("worldPosition", fe.Vector4, !1, Me.Vertex), n.registerInput("worldNormal", fe.Vector4, !1, Me.Fragment), n.registerInput("cameraPosition", fe.Vector3, !1, Me.Fragment), n.registerInput("glossiness", fe.Float, !0, Me.Fragment), n.registerInput("glossPower", fe.Float, !0, Me.Fragment), n.registerInput("diffuseColor", fe.Color3, !0, Me.Fragment), n.registerInput("specularColor", fe.Color3, !0, Me.Fragment), n.registerInput("view", fe.Matrix, !0), n.registerOutput("diffuseOutput", fe.Color3, Me.Fragment), n.registerOutput("specularOutput", fe.Color3, Me.Fragment), n.registerOutput("shadow", fe.Float, Me.Fragment), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "LightBlock";
+ }, Object.defineProperty(t.prototype, "worldPosition", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "worldNormal", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "cameraPosition", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "glossiness", { get: function() {
+ return this._inputs[3];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "glossPower", { get: function() {
+ return this._inputs[4];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "diffuseColor", { get: function() {
+ return this._inputs[5];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "specularColor", { get: function() {
+ return this._inputs[6];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "view", { get: function() {
+ return this._inputs[7];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "diffuseOutput", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "specularOutput", { get: function() {
+ return this._outputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "shadow", { get: function() {
+ return this._outputs[2];
+ }, enumerable: !1, configurable: !0 }), t.prototype.autoConfigure = function(e) {
+ if (!this.cameraPosition.isConnected) {
+ var n = e.getInputBlockByPredicate(function(i) {
+ return i.systemValue === bt.CameraPosition;
+ });
+ n || (n = new At("cameraPosition")).setAsSystemValue(bt.CameraPosition), n.output.connectTo(this.cameraPosition);
+ }
+ }, t.prototype.prepareDefines = function(e, n, i) {
+ if (i._areLightsDirty) {
+ var o = e.getScene();
+ if (this.light) {
+ var a = { needNormals: !1, needRebuild: !1, lightmapMode: !1, shadowEnabled: !1, specularEnabled: !1 };
+ tt.a.PrepareDefinesForLight(o, e, this.light, this._lightId, i, !0, a), a.needRebuild && i.rebuild();
+ } else
+ tt.a.PrepareDefinesForLights(o, e, i, !0, n.maxSimultaneousLights);
+ }
+ }, t.prototype.updateUniformsAndSamples = function(e, n, i, o) {
+ for (var a = 0; a < n.maxSimultaneousLights && i["LIGHT" + a]; a++) {
+ var s = e.uniforms.indexOf("vLightData" + a) >= 0;
+ tt.a.PrepareUniformsAndSamplersForLight(a, e.uniforms, e.samplers, i["PROJECTEDLIGHTTEXTURE" + a], o, s);
+ }
+ }, t.prototype.bind = function(e, n, i) {
+ if (i) {
+ var o = i.getScene();
+ this.light ? tt.a.BindLight(this.light, this._lightId, o, e, !0) : tt.a.BindLights(o, i, e, !0, n.maxSimultaneousLights);
+ }
+ }, t.prototype._injectVertexCode = function(e) {
+ var n = this.worldPosition, i = "//" + this.name;
+ this.light ? (this._lightId = (e.counters.lightCounter !== void 0 ? e.counters.lightCounter : -1) + 1, e.counters.lightCounter = this._lightId, e._emitFunctionFromInclude(e.supportUniformBuffers ? "lightUboDeclaration" : "lightFragmentDeclaration", i, { replaceStrings: [{ search: /{X}/g, replace: this._lightId.toString() }] }, this._lightId.toString())) : (e._emitFunctionFromInclude(e.supportUniformBuffers ? "lightUboDeclaration" : "lightFragmentDeclaration", i, { repeatKey: "maxSimultaneousLights" }), this._lightId = 0, e.sharedData.dynamicUniformBlocks.push(this));
+ var o = "v_" + n.associatedVariableName;
+ e._emitVaryingFromString(o, "vec4") && (e.compilationString += o + " = " + n.associatedVariableName + `;\r
+`), this.light ? e.compilationString += e._emitCodeFromInclude("shadowsVertex", i, { replaceStrings: [{ search: /{X}/g, replace: this._lightId.toString() }, { search: /worldPos/g, replace: n.associatedVariableName }] }) : (e.compilationString += "vec4 worldPos = " + n.associatedVariableName + `;\r
+`, this.view.isConnected && (e.compilationString += "mat4 view = " + this.view.associatedVariableName + `;\r
+`), e.compilationString += e._emitCodeFromInclude("shadowsVertex", i, { repeatKey: "maxSimultaneousLights" }));
+ }, t.prototype._buildBlock = function(e) {
+ if (r.prototype._buildBlock.call(this, e), e.target === Me.Fragment) {
+ e.sharedData.bindableBlocks.push(this), e.sharedData.blocksWithDefines.push(this);
+ var n = "//" + this.name, i = this.worldPosition;
+ e._emitFunctionFromInclude("helperFunctions", n), e._emitFunctionFromInclude("lightsFragmentFunctions", n, { replaceStrings: [{ search: /vPositionW/g, replace: "v_" + i.associatedVariableName + ".xyz" }] }), e._emitFunctionFromInclude("shadowsFragmentFunctions", n, { replaceStrings: [{ search: /vPositionW/g, replace: "v_" + i.associatedVariableName + ".xyz" }] }), this.light ? e._emitFunctionFromInclude(e.supportUniformBuffers ? "lightUboDeclaration" : "lightFragmentDeclaration", n, { replaceStrings: [{ search: /{X}/g, replace: this._lightId.toString() }] }, this._lightId.toString()) : e._emitFunctionFromInclude(e.supportUniformBuffers ? "lightUboDeclaration" : "lightFragmentDeclaration", n, { repeatKey: "maxSimultaneousLights" }), this._lightId === 0 && (e._registerTempVariable("viewDirectionW") && (e.compilationString += "vec3 viewDirectionW = normalize(" + this.cameraPosition.associatedVariableName + " - v_" + i.associatedVariableName + `.xyz);\r
+`), e.compilationString += `lightingInfo info;\r
+`, e.compilationString += `float shadow = 1.;\r
+`, e.compilationString += "float glossiness = " + (this.glossiness.isConnected ? this.glossiness.associatedVariableName : "1.0") + " * " + (this.glossPower.isConnected ? this.glossPower.associatedVariableName : "1024.0") + `;\r
+`, e.compilationString += `vec3 diffuseBase = vec3(0., 0., 0.);\r
+`, e.compilationString += `vec3 specularBase = vec3(0., 0., 0.);\r
+`, e.compilationString += "vec3 normalW = " + this.worldNormal.associatedVariableName + `.xyz;\r
+`), this.light ? e.compilationString += e._emitCodeFromInclude("lightFragment", n, { replaceStrings: [{ search: /{X}/g, replace: this._lightId.toString() }] }) : e.compilationString += e._emitCodeFromInclude("lightFragment", n, { repeatKey: "maxSimultaneousLights" });
+ var o = this.diffuseOutput, a = this.specularOutput;
+ return e.compilationString += this._declareOutput(o, e) + " = diffuseBase" + (this.diffuseColor.isConnected ? " * " + this.diffuseColor.associatedVariableName : "") + `;\r
+`, a.hasEndpoints && (e.compilationString += this._declareOutput(a, e) + " = specularBase" + (this.specularColor.isConnected ? " * " + this.specularColor.associatedVariableName : "") + `;\r
+`), this.shadow.hasEndpoints && (e.compilationString += this._declareOutput(this.shadow, e) + ` = shadow;\r
+`), this;
+ }
+ this._injectVertexCode(e);
+ }, t.prototype.serialize = function() {
+ var e = r.prototype.serialize.call(this);
+ return this.light && (e.lightId = this.light.id), e;
+ }, t.prototype._deserialize = function(e, n, i) {
+ r.prototype._deserialize.call(this, e, n, i), e.lightId && (this.light = n.getLightByID(e.lightId));
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.LightBlock"] = Cp;
+ var xp = function(r) {
+ function t(e, n) {
+ n === void 0 && (n = !1);
+ var i = r.call(this, e, n ? Me.Fragment : Me.VertexAndFragment) || this;
+ return i.convertToGammaSpace = !1, i.convertToLinearSpace = !1, i._fragmentOnly = n, i.registerInput("uv", fe.Vector2, !1, Me.VertexAndFragment), i.registerOutput("rgba", fe.Color4, Me.Neutral), i.registerOutput("rgb", fe.Color3, Me.Neutral), i.registerOutput("r", fe.Float, Me.Neutral), i.registerOutput("g", fe.Float, Me.Neutral), i.registerOutput("b", fe.Float, Me.Neutral), i.registerOutput("a", fe.Float, Me.Neutral), i._inputs[0].acceptedConnectionPointTypes.push(fe.Vector3), i._inputs[0].acceptedConnectionPointTypes.push(fe.Vector4), i._inputs[0]._prioritizeVertex = !n, i;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "TextureBlock";
+ }, Object.defineProperty(t.prototype, "uv", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "rgba", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "rgb", { get: function() {
+ return this._outputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "r", { get: function() {
+ return this._outputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "g", { get: function() {
+ return this._outputs[3];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "b", { get: function() {
+ return this._outputs[4];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "a", { get: function() {
+ return this._outputs[5];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "target", { get: function() {
+ if (this._fragmentOnly)
+ return Me.Fragment;
+ if (!this.uv.isConnected || this.uv.sourceBlock.isInput)
+ return Me.VertexAndFragment;
+ for (var e = this.uv.connectedPoint; e; ) {
+ if (e.target === Me.Fragment)
+ return Me.Fragment;
+ if (e.target === Me.Vertex)
+ return Me.VertexAndFragment;
+ if (e.target === Me.Neutral || e.target === Me.VertexAndFragment) {
+ var n = e.ownerBlock;
+ e = null;
+ for (var i = 0, o = n.inputs; i < o.length; i++) {
+ var a = o[i];
+ if (a.connectedPoint) {
+ e = a.connectedPoint;
+ break;
+ }
+ }
+ }
+ }
+ return Me.VertexAndFragment;
+ }, enumerable: !1, configurable: !0 }), t.prototype.autoConfigure = function(e) {
+ if (!this.uv.isConnected)
+ if (e.mode === zn.PostProcess)
+ (n = e.getBlockByPredicate(function(o) {
+ return o.name === "uv";
+ })) && n.connectTo(this);
+ else {
+ var n, i = e.mode === zn.Particle ? "particle_uv" : "uv";
+ (n = e.getInputBlockByPredicate(function(o) {
+ return o.isAttribute && o.name === i;
+ })) || (n = new At("uv")).setAsAttribute(i), n.output.connectTo(this.uv);
+ }
+ }, t.prototype.initializeDefines = function(e, n, i, o) {
+ i._areTexturesDirty && i.setValue(this._mainUVDefineName, !1);
+ }, t.prototype.prepareDefines = function(e, n, i) {
+ if (i._areTexturesDirty) {
+ if (!this.texture || !this.texture.getTextureMatrix)
+ return i.setValue(this._defineName, !1), void i.setValue(this._mainUVDefineName, !0);
+ i.setValue(this._linearDefineName, this.convertToGammaSpace), i.setValue(this._gammaDefineName, this.convertToLinearSpace), this._isMixed && (this.texture.getTextureMatrix().isIdentityAs3x2() ? (i.setValue(this._defineName, !1), i.setValue(this._mainUVDefineName, !0)) : i.setValue(this._defineName, !0));
+ }
+ }, t.prototype.isReady = function() {
+ return !(this.texture && !this.texture.isReadyOrNotBlocking());
+ }, t.prototype.bind = function(e, n, i) {
+ this.texture && (this._isMixed && (e.setFloat(this._textureInfoName, this.texture.level), e.setMatrix(this._textureTransformName, this.texture.getTextureMatrix())), e.setTexture(this._samplerName, this.texture));
+ }, Object.defineProperty(t.prototype, "_isMixed", { get: function() {
+ return this.target !== Me.Fragment;
+ }, enumerable: !1, configurable: !0 }), t.prototype._injectVertexCode = function(e) {
+ var n = this.uv;
+ if (this._defineName = e._getFreeDefineName("UVTRANSFORM"), this._mainUVDefineName = "VMAIN" + n.associatedVariableName.toUpperCase(), n.connectedPoint.ownerBlock.isInput && (n.connectedPoint.ownerBlock.isAttribute || e._emitUniformFromString(n.associatedVariableName, "vec2")), this._mainUVName = "vMain" + n.associatedVariableName, this._transformedUVName = e._getFreeVariableName("transformedUV"), this._textureTransformName = e._getFreeVariableName("textureTransform"), this._textureInfoName = e._getFreeVariableName("textureInfoName"), e._emitVaryingFromString(this._transformedUVName, "vec2", this._defineName), e._emitVaryingFromString(this._mainUVName, "vec2", this._mainUVDefineName), e._emitUniformFromString(this._textureTransformName, "mat4", this._defineName), e.compilationString += "#ifdef " + this._defineName + `\r
+`, e.compilationString += this._transformedUVName + " = vec2(" + this._textureTransformName + " * vec4(" + n.associatedVariableName + `.xy, 1.0, 0.0));\r
+`, e.compilationString += "#elif defined(" + this._mainUVDefineName + `)\r
+`, e.compilationString += this._mainUVName + " = " + n.associatedVariableName + `.xy;\r
+`, e.compilationString += `#endif\r
+`, this._outputs.some(function(s) {
+ return s.isConnectedInVertexShader;
+ })) {
+ this._writeTextureRead(e, !0);
+ for (var i = 0, o = this._outputs; i < o.length; i++) {
+ var a = o[i];
+ a.hasEndpoints && this._writeOutput(e, a, a.name, !0);
+ }
+ }
+ }, t.prototype._writeTextureRead = function(e, n) {
+ n === void 0 && (n = !1);
+ var i = this.uv;
+ if (n) {
+ if (e.target === Me.Fragment)
+ return;
+ e.compilationString += "vec4 " + this._tempTextureRead + " = texture2D(" + this._samplerName + ", " + i.associatedVariableName + `);\r
+`;
+ } else
+ this.uv.ownerBlock.target !== Me.Fragment ? (e.compilationString += "#ifdef " + this._defineName + `\r
+`, e.compilationString += "vec4 " + this._tempTextureRead + " = texture2D(" + this._samplerName + ", " + this._transformedUVName + `);\r
+`, e.compilationString += "#elif defined(" + this._mainUVDefineName + `)\r
+`, e.compilationString += "vec4 " + this._tempTextureRead + " = texture2D(" + this._samplerName + ", " + this._mainUVName + `);\r
+`, e.compilationString += `#endif\r
+`) : e.compilationString += "vec4 " + this._tempTextureRead + " = texture2D(" + this._samplerName + ", " + i.associatedVariableName + `);\r
+`;
+ }, t.prototype._writeOutput = function(e, n, i, o) {
+ if (o === void 0 && (o = !1), o) {
+ if (e.target === Me.Fragment)
+ return;
+ e.compilationString += this._declareOutput(n, e) + " = " + this._tempTextureRead + "." + i + `;\r
+`;
+ } else if (this.uv.ownerBlock.target !== Me.Fragment) {
+ var a = " * " + this._textureInfoName;
+ e.compilationString += this._declareOutput(n, e) + " = " + this._tempTextureRead + "." + i + a + `;\r
+`, i !== "a" && (e.compilationString += "#ifdef " + this._linearDefineName + `\r
+`, e.compilationString += n.associatedVariableName + " = toGammaSpace(" + n.associatedVariableName + `);\r
+`, e.compilationString += `#endif\r
+`, e.compilationString += "#ifdef " + this._gammaDefineName + `\r
+`, e.compilationString += n.associatedVariableName + " = toLinearSpace(" + n.associatedVariableName + `);\r
+`, e.compilationString += `#endif\r
+`);
+ } else
+ e.compilationString += this._declareOutput(n, e) + " = " + this._tempTextureRead + "." + i + `;\r
+`;
+ }, t.prototype._buildBlock = function(e) {
+ if (r.prototype._buildBlock.call(this, e), (e.target === Me.Vertex || this._fragmentOnly) && (this._tempTextureRead = e._getFreeVariableName("tempTextureRead")), (!this._isMixed && e.target === Me.Fragment || this._isMixed && e.target === Me.Vertex) && (this._samplerName = e._getFreeVariableName(this.name + "Sampler"), e._emit2DSampler(this._samplerName), e.sharedData.blockingBlocks.push(this), e.sharedData.textureBlocks.push(this), e.sharedData.blocksWithDefines.push(this), e.sharedData.bindableBlocks.push(this)), e.target === Me.Fragment) {
+ if (this._outputs.some(function(s) {
+ return s.isConnectedInFragmentShader;
+ })) {
+ this._isMixed && e._emit2DSampler(this._samplerName), this._linearDefineName = e._getFreeDefineName("ISLINEAR"), this._gammaDefineName = e._getFreeDefineName("ISGAMMA");
+ var n = "//" + this.name;
+ e._emitFunctionFromInclude("helperFunctions", n), this._isMixed && e._emitUniformFromString(this._textureInfoName, "float"), this._writeTextureRead(e);
+ for (var i = 0, o = this._outputs; i < o.length; i++) {
+ var a = o[i];
+ a.hasEndpoints && this._writeOutput(e, a, a.name);
+ }
+ return this;
+ }
+ } else
+ this._injectVertexCode(e);
+ }, t.prototype._dumpPropertiesCode = function() {
+ if (!this.texture)
+ return "";
+ var e = this._codeVariableName + '.texture = new BABYLON.Texture("' + this.texture.name + `", null);\r
+`;
+ return e += this._codeVariableName + ".texture.wrapU = " + this.texture.wrapU + `;\r
+`, e += this._codeVariableName + ".texture.wrapV = " + this.texture.wrapV + `;\r
+`, e += this._codeVariableName + ".texture.uAng = " + this.texture.uAng + `;\r
+`, e += this._codeVariableName + ".texture.vAng = " + this.texture.vAng + `;\r
+`, e += this._codeVariableName + ".texture.wAng = " + this.texture.wAng + `;\r
+`, e += this._codeVariableName + ".texture.uOffset = " + this.texture.uOffset + `;\r
+`, e += this._codeVariableName + ".texture.vOffset = " + this.texture.vOffset + `;\r
+`, e += this._codeVariableName + ".texture.uScale = " + this.texture.uScale + `;\r
+`, e += this._codeVariableName + ".texture.vScale = " + this.texture.vScale + `;\r
+`, e += this._codeVariableName + ".convertToGammaSpace = " + this.convertToGammaSpace + `;\r
+`, e += this._codeVariableName + ".convertToLinearSpace = " + this.convertToLinearSpace + `;\r
+`;
+ }, t.prototype.serialize = function() {
+ var e = r.prototype.serialize.call(this);
+ return e.convertToGammaSpace = this.convertToGammaSpace, e.convertToLinearSpace = this.convertToLinearSpace, e.fragmentOnly = this._fragmentOnly, this.texture && !this.texture.isRenderTarget && (e.texture = this.texture.serialize()), e;
+ }, t.prototype._deserialize = function(e, n, i) {
+ r.prototype._deserialize.call(this, e, n, i), this.convertToGammaSpace = e.convertToGammaSpace, this.convertToLinearSpace = !!e.convertToLinearSpace, this._fragmentOnly = !!e.fragmentOnly, e.texture && !qs.IgnoreTexturesAtLoadTime && (i = e.texture.url.indexOf("data:") === 0 ? "" : i, this.texture = Ue.a.Parse(e.texture, n, i));
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.TextureBlock"] = xp;
+ var pu = function(r) {
+ function t(e) {
+ return r.call(this, e, Me.VertexAndFragment) || this;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "ReflectionTextureBaseBlock";
+ }, t.prototype._getTexture = function() {
+ return this.texture;
+ }, t.prototype.autoConfigure = function(e) {
+ if (!this.position.isConnected) {
+ var n = e.getInputBlockByPredicate(function(a) {
+ return a.isAttribute && a.name === "position";
+ });
+ n || (n = new At("position")).setAsAttribute(), n.output.connectTo(this.position);
+ }
+ if (!this.world.isConnected) {
+ var i = e.getInputBlockByPredicate(function(a) {
+ return a.systemValue === bt.World;
+ });
+ i || (i = new At("world")).setAsSystemValue(bt.World), i.output.connectTo(this.world);
+ }
+ if (this.view && !this.view.isConnected) {
+ var o = e.getInputBlockByPredicate(function(a) {
+ return a.systemValue === bt.View;
+ });
+ o || (o = new At("view")).setAsSystemValue(bt.View), o.output.connectTo(this.view);
+ }
+ }, t.prototype.prepareDefines = function(e, n, i) {
+ if (i._areTexturesDirty) {
+ var o = this._getTexture();
+ o && o.getTextureMatrix && (i.setValue(this._define3DName, o.isCube, !0), i.setValue(this._defineLocalCubicName, !!o.boundingBoxSize, !0), i.setValue(this._defineExplicitName, o.coordinatesMode === d.a.TEXTURE_EXPLICIT_MODE, !0), i.setValue(this._defineSkyboxName, o.coordinatesMode === d.a.TEXTURE_SKYBOX_MODE, !0), i.setValue(this._defineCubicName, o.coordinatesMode === d.a.TEXTURE_CUBIC_MODE || o.coordinatesMode === d.a.TEXTURE_INVCUBIC_MODE, !0), i.setValue("INVERTCUBICMAP", o.coordinatesMode === d.a.TEXTURE_INVCUBIC_MODE, !0), i.setValue(this._defineSphericalName, o.coordinatesMode === d.a.TEXTURE_SPHERICAL_MODE, !0), i.setValue(this._definePlanarName, o.coordinatesMode === d.a.TEXTURE_PLANAR_MODE, !0), i.setValue(this._defineProjectionName, o.coordinatesMode === d.a.TEXTURE_PROJECTION_MODE, !0), i.setValue(this._defineEquirectangularName, o.coordinatesMode === d.a.TEXTURE_EQUIRECTANGULAR_MODE, !0), i.setValue(this._defineEquirectangularFixedName, o.coordinatesMode === d.a.TEXTURE_FIXED_EQUIRECTANGULAR_MODE, !0), i.setValue(this._defineMirroredEquirectangularFixedName, o.coordinatesMode === d.a.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE, !0));
+ }
+ }, t.prototype.isReady = function() {
+ var e = this._getTexture();
+ return !(e && !e.isReadyOrNotBlocking());
+ }, t.prototype.bind = function(e, n, i) {
+ var o = this._getTexture();
+ i && o && (e.setMatrix(this._reflectionMatrixName, o.getReflectionTextureMatrix()), o.isCube ? e.setTexture(this._cubeSamplerName, o) : e.setTexture(this._2DSamplerName, o));
+ }, t.prototype.handleVertexSide = function(e) {
+ this._define3DName = e._getFreeDefineName("REFLECTIONMAP_3D"), this._defineCubicName = e._getFreeDefineName("REFLECTIONMAP_CUBIC"), this._defineSphericalName = e._getFreeDefineName("REFLECTIONMAP_SPHERICAL"), this._definePlanarName = e._getFreeDefineName("REFLECTIONMAP_PLANAR"), this._defineProjectionName = e._getFreeDefineName("REFLECTIONMAP_PROJECTION"), this._defineExplicitName = e._getFreeDefineName("REFLECTIONMAP_EXPLICIT"), this._defineEquirectangularName = e._getFreeDefineName("REFLECTIONMAP_EQUIRECTANGULAR"), this._defineLocalCubicName = e._getFreeDefineName("USE_LOCAL_REFLECTIONMAP_CUBIC"), this._defineMirroredEquirectangularFixedName = e._getFreeDefineName("REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED"), this._defineEquirectangularFixedName = e._getFreeDefineName("REFLECTIONMAP_EQUIRECTANGULAR_FIXED"), this._defineSkyboxName = e._getFreeDefineName("REFLECTIONMAP_SKYBOX"), this._defineOppositeZ = e._getFreeDefineName("REFLECTIONMAP_OPPOSITEZ"), this._reflectionMatrixName = e._getFreeVariableName("reflectionMatrix"), e._emitUniformFromString(this._reflectionMatrixName, "mat4");
+ var n = "", i = "v_" + this.worldPosition.associatedVariableName;
+ return e._emitVaryingFromString(i, "vec4") && (n += i + " = " + this.worldPosition.associatedVariableName + `;\r
+`), this._positionUVWName = e._getFreeVariableName("positionUVW"), this._directionWName = e._getFreeVariableName("directionW"), e._emitVaryingFromString(this._positionUVWName, "vec3", this._defineSkyboxName) && (n += "#ifdef " + this._defineSkyboxName + `\r
+`, n += this._positionUVWName + " = " + this.position.associatedVariableName + `.xyz;\r
+`, n += `#endif\r
+`), e._emitVaryingFromString(this._directionWName, "vec3", "defined(" + this._defineEquirectangularFixedName + ") || defined(" + this._defineMirroredEquirectangularFixedName + ")") && (n += "#if defined(" + this._defineEquirectangularFixedName + ") || defined(" + this._defineMirroredEquirectangularFixedName + `)\r
+`, n += this._directionWName + " = normalize(vec3(" + this.world.associatedVariableName + " * vec4(" + this.position.associatedVariableName + `.xyz, 0.0)));\r
+`, n += `#endif\r
+`), n;
+ }, t.prototype.handleFragmentSideInits = function(e) {
+ e.sharedData.blockingBlocks.push(this), e.sharedData.textureBlocks.push(this), this._cubeSamplerName = e._getFreeVariableName(this.name + "CubeSampler"), e.samplers.push(this._cubeSamplerName), this._2DSamplerName = e._getFreeVariableName(this.name + "2DSampler"), e.samplers.push(this._2DSamplerName), e._samplerDeclaration += "#ifdef " + this._define3DName + `\r
+`, e._samplerDeclaration += "uniform samplerCube " + this._cubeSamplerName + `;\r
+`, e._samplerDeclaration += `#else\r
+`, e._samplerDeclaration += "uniform sampler2D " + this._2DSamplerName + `;\r
+`, e._samplerDeclaration += `#endif\r
+`, e.sharedData.blocksWithDefines.push(this), e.sharedData.bindableBlocks.push(this);
+ var n = "//" + this.name;
+ e._emitFunction("ReciprocalPI", "#define RECIPROCAL_PI2 0.15915494", ""), e._emitFunctionFromInclude("reflectionFunction", n, { replaceStrings: [{ search: /vec3 computeReflectionCoords/g, replace: "void DUMMYFUNC" }] }), this._reflectionColorName = e._getFreeVariableName("reflectionColor"), this._reflectionVectorName = e._getFreeVariableName("reflectionUVW"), this._reflectionCoordsName = e._getFreeVariableName("reflectionCoords");
+ }, t.prototype.handleFragmentSideCodeReflectionCoords = function(e, n, i) {
+ i === void 0 && (i = !1), n || (n = "v_" + this.worldPosition.associatedVariableName);
+ var o = this._reflectionMatrixName, a = "normalize(" + this._directionWName + ")", s = "" + this._positionUVWName, p = "" + this.cameraPosition.associatedVariableName, m = "" + this.view.associatedVariableName;
+ e += ".xyz";
+ var S = `
+ #ifdef ` + this._defineMirroredEquirectangularFixedName + `
+ vec3 ` + this._reflectionVectorName + " = computeMirroredFixedEquirectangularCoords(" + n + ", " + e + ", " + a + `);
+ #endif
+
+ #ifdef ` + this._defineEquirectangularFixedName + `
+ vec3 ` + this._reflectionVectorName + " = computeFixedEquirectangularCoords(" + n + ", " + e + ", " + a + `);
+ #endif
+
+ #ifdef ` + this._defineEquirectangularName + `
+ vec3 ` + this._reflectionVectorName + " = computeEquirectangularCoords(" + n + ", " + e + ", " + p + ".xyz, " + o + `);
+ #endif
+
+ #ifdef ` + this._defineSphericalName + `
+ vec3 ` + this._reflectionVectorName + " = computeSphericalCoords(" + n + ", " + e + ", " + m + ", " + o + `);
+ #endif
+
+ #ifdef ` + this._definePlanarName + `
+ vec3 ` + this._reflectionVectorName + " = computePlanarCoords(" + n + ", " + e + ", " + p + ".xyz, " + o + `);
+ #endif
+
+ #ifdef ` + this._defineCubicName + `
+ #ifdef ` + this._defineLocalCubicName + `
+ vec3 ` + this._reflectionVectorName + " = computeCubicLocalCoords(" + n + ", " + e + ", " + p + ".xyz, " + o + `, vReflectionSize, vReflectionPosition);
+ #else
+ vec3 ` + this._reflectionVectorName + " = computeCubicCoords(" + n + ", " + e + ", " + p + ".xyz, " + o + `);
+ #endif
+ #endif
+
+ #ifdef ` + this._defineProjectionName + `
+ vec3 ` + this._reflectionVectorName + " = computeProjectionCoords(" + n + ", " + m + ", " + o + `);
+ #endif
+
+ #ifdef ` + this._defineSkyboxName + `
+ vec3 ` + this._reflectionVectorName + " = computeSkyBoxCoords(" + s + ", " + o + `);
+ #endif
+
+ #ifdef ` + this._defineExplicitName + `
+ vec3 ` + this._reflectionVectorName + ` = vec3(0, 0, 0);
+ #endif
+
+ #ifdef ` + this._defineOppositeZ + `
+ ` + this._reflectionVectorName + `.z *= -1.0;
+ #endif\r
+`;
+ return i || (S += `
+ #ifdef ` + this._define3DName + `
+ vec3 ` + this._reflectionCoordsName + " = " + this._reflectionVectorName + `;
+ #else
+ vec2 ` + this._reflectionCoordsName + " = " + this._reflectionVectorName + `.xy;
+ #ifdef ` + this._defineProjectionName + `
+ ` + this._reflectionCoordsName + " /= " + this._reflectionVectorName + `.z;
+ #endif
+ ` + this._reflectionCoordsName + ".y = 1.0 - " + this._reflectionCoordsName + `.y;
+ #endif\r
+`), S;
+ }, t.prototype.handleFragmentSideCodeReflectionColor = function(e, n) {
+ n === void 0 && (n = ".rgb");
+ var i = "vec" + (n.length === 0 ? "4" : n.length - 1) + " " + this._reflectionColorName + `;
+ #ifdef ` + this._define3DName + `\r
+`;
+ return i += e ? this._reflectionColorName + " = textureCubeLodEXT(" + this._cubeSamplerName + ", " + this._reflectionVectorName + ", " + e + ")" + n + `;\r
+` : this._reflectionColorName + " = textureCube(" + this._cubeSamplerName + ", " + this._reflectionVectorName + ")" + n + `;\r
+`, i += `
+ #else\r
+`, i += e ? this._reflectionColorName + " = texture2DLodEXT(" + this._2DSamplerName + ", " + this._reflectionCoordsName + ", " + e + ")" + n + `;\r
+` : this._reflectionColorName + " = texture2D(" + this._2DSamplerName + ", " + this._reflectionCoordsName + ")" + n + `;\r
+`, i += `#endif\r
+`;
+ }, t.prototype.writeOutputs = function(e, n) {
+ var i = "";
+ if (e.target === Me.Fragment)
+ for (var o = 0, a = this._outputs; o < a.length; o++) {
+ var s = a[o];
+ s.hasEndpoints && (i += this._declareOutput(s, e) + " = " + n + "." + s.name + `;\r
+`);
+ }
+ return i;
+ }, t.prototype._buildBlock = function(e) {
+ return r.prototype._buildBlock.call(this, e), this;
+ }, t.prototype._dumpPropertiesCode = function() {
+ return this.texture ? (e = this.texture.isCube ? this._codeVariableName + '.texture = new BABYLON.CubeTexture("' + this.texture.name + `");\r
+` : this._codeVariableName + '.texture = new BABYLON.Texture("' + this.texture.name + `");\r
+`, e += this._codeVariableName + ".texture.coordinatesMode = " + this.texture.coordinatesMode + `;\r
+`) : "";
+ var e;
+ }, t.prototype.serialize = function() {
+ var e = r.prototype.serialize.call(this);
+ return this.texture && (e.texture = this.texture.serialize()), e;
+ }, t.prototype._deserialize = function(e, n, i) {
+ r.prototype._deserialize.call(this, e, n, i), e.texture && (i = e.texture.url.indexOf("data:") === 0 ? "" : i, e.texture.isCube ? this.texture = Pi.Parse(e.texture, n, i) : this.texture = Ue.a.Parse(e.texture, n, i));
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.ReflectionTextureBaseBlock"] = pu;
+ var Rp = function(r) {
+ function t(e) {
+ var n = r.call(this, e) || this;
+ return n.registerInput("position", fe.Vector3, !1, Me.Vertex), n.registerInput("worldPosition", fe.Vector4, !1, Me.Vertex), n.registerInput("worldNormal", fe.Vector4, !1, Me.Fragment), n.registerInput("world", fe.Matrix, !1, Me.Vertex), n.registerInput("cameraPosition", fe.Vector3, !1, Me.Fragment), n.registerInput("view", fe.Matrix, !1, Me.Fragment), n.registerOutput("rgb", fe.Color3, Me.Fragment), n.registerOutput("rgba", fe.Color4, Me.Fragment), n.registerOutput("r", fe.Float, Me.Fragment), n.registerOutput("g", fe.Float, Me.Fragment), n.registerOutput("b", fe.Float, Me.Fragment), n.registerOutput("a", fe.Float, Me.Fragment), n._inputs[0].acceptedConnectionPointTypes.push(fe.Vector4), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "ReflectionTextureBlock";
+ }, Object.defineProperty(t.prototype, "position", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "worldPosition", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "worldNormal", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "world", { get: function() {
+ return this._inputs[3];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "cameraPosition", { get: function() {
+ return this._inputs[4];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "view", { get: function() {
+ return this._inputs[5];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "rgb", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "rgba", { get: function() {
+ return this._outputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "r", { get: function() {
+ return this._outputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "g", { get: function() {
+ return this._outputs[3];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "b", { get: function() {
+ return this._outputs[4];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "a", { get: function() {
+ return this._outputs[5];
+ }, enumerable: !1, configurable: !0 }), t.prototype.autoConfigure = function(e) {
+ if (r.prototype.autoConfigure.call(this, e), !this.cameraPosition.isConnected) {
+ var n = e.getInputBlockByPredicate(function(i) {
+ return i.systemValue === bt.CameraPosition;
+ });
+ n || (n = new At("cameraPosition")).setAsSystemValue(bt.CameraPosition), n.output.connectTo(this.cameraPosition);
+ }
+ }, t.prototype._buildBlock = function(e) {
+ if (r.prototype._buildBlock.call(this, e), !this.texture)
+ return e.compilationString += this.writeOutputs(e, "vec3(0.)"), this;
+ if (e.target !== Me.Fragment)
+ return e.compilationString += this.handleVertexSide(e), this;
+ this.handleFragmentSideInits(e);
+ var n = e._getFreeVariableName("normalWUnit");
+ return e.compilationString += "vec4 " + n + " = normalize(" + this.worldNormal.associatedVariableName + `);\r
+`, e.compilationString += this.handleFragmentSideCodeReflectionCoords(n), e.compilationString += this.handleFragmentSideCodeReflectionColor(void 0, ""), e.compilationString += this.writeOutputs(e, this._reflectionColorName), this;
+ }, t;
+ }(pu);
+ x.a.RegisteredTypes["BABYLON.ReflectionTextureBlock"] = Rp;
+ var Op = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("left", fe.AutoDetect), n.registerInput("right", fe.AutoDetect), n.registerOutput("output", fe.BasedOnInput), n._outputs[0]._typeConnectionSource = n._inputs[0], n._linkConnectionTypes(0, 1), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "AddBlock";
+ }, Object.defineProperty(t.prototype, "left", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "right", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = " + this.left.associatedVariableName + " + " + this.right.associatedVariableName + `;\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.AddBlock"] = Op;
+ var Mp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("input", fe.AutoDetect), n.registerInput("factor", fe.Float), n.registerOutput("output", fe.BasedOnInput), n._outputs[0]._typeConnectionSource = n._inputs[0], n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "ScaleBlock";
+ }, Object.defineProperty(t.prototype, "input", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "factor", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = " + this.input.associatedVariableName + " * " + this.factor.associatedVariableName + `;\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.ScaleBlock"] = Mp;
+ var Ip = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.minimum = 0, n.maximum = 1, n.registerInput("value", fe.AutoDetect), n.registerOutput("output", fe.BasedOnInput), n._outputs[0]._typeConnectionSource = n._inputs[0], n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "ClampBlock";
+ }, Object.defineProperty(t.prototype, "value", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = clamp(" + this.value.associatedVariableName + ", " + this._writeFloat(this.minimum) + ", " + this._writeFloat(this.maximum) + `);\r
+`, this;
+ }, t.prototype._dumpPropertiesCode = function() {
+ var e = this._codeVariableName + ".minimum = " + this.minimum + `;\r
+`;
+ return e += this._codeVariableName + ".maximum = " + this.maximum + `;\r
+`;
+ }, t.prototype.serialize = function() {
+ var e = r.prototype.serialize.call(this);
+ return e.minimum = this.minimum, e.maximum = this.maximum, e;
+ }, t.prototype._deserialize = function(e, n, i) {
+ r.prototype._deserialize.call(this, e, n, i), this.minimum = e.minimum, this.maximum = e.maximum;
+ }, Object(u.c)([jt("Minimum", Ft.Float)], t.prototype, "minimum", void 0), Object(u.c)([jt("Maximum", Ft.Float)], t.prototype, "maximum", void 0), t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.ClampBlock"] = Ip;
+ var Dp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("left", fe.AutoDetect), n.registerInput("right", fe.AutoDetect), n.registerOutput("output", fe.Vector3), n._linkConnectionTypes(0, 1), n._inputs[0].excludedConnectionPointTypes.push(fe.Float), n._inputs[0].excludedConnectionPointTypes.push(fe.Matrix), n._inputs[0].excludedConnectionPointTypes.push(fe.Vector2), n._inputs[1].excludedConnectionPointTypes.push(fe.Float), n._inputs[1].excludedConnectionPointTypes.push(fe.Matrix), n._inputs[1].excludedConnectionPointTypes.push(fe.Vector2), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "CrossBlock";
+ }, Object.defineProperty(t.prototype, "left", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "right", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = cross(" + this.left.associatedVariableName + ".xyz, " + this.right.associatedVariableName + `.xyz);\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.CrossBlock"] = Dp;
+ var Lp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("left", fe.AutoDetect), n.registerInput("right", fe.AutoDetect), n.registerOutput("output", fe.Float), n._linkConnectionTypes(0, 1), n._inputs[0].excludedConnectionPointTypes.push(fe.Float), n._inputs[0].excludedConnectionPointTypes.push(fe.Matrix), n._inputs[1].excludedConnectionPointTypes.push(fe.Float), n._inputs[1].excludedConnectionPointTypes.push(fe.Matrix), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "DotBlock";
+ }, Object.defineProperty(t.prototype, "left", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "right", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = dot(" + this.left.associatedVariableName + ", " + this.right.associatedVariableName + `);\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.DotBlock"] = Lp;
+ var wp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("input", fe.AutoDetect), n.registerOutput("output", fe.BasedOnInput), n._outputs[0]._typeConnectionSource = n._inputs[0], n._inputs[0].excludedConnectionPointTypes.push(fe.Float), n._inputs[0].excludedConnectionPointTypes.push(fe.Matrix), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "NormalizeBlock";
+ }, Object.defineProperty(t.prototype, "input", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0], i = this._inputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = normalize(" + i.associatedVariableName + `);\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.NormalizeBlock"] = wp;
+ var Np = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("rgb ", fe.Color3, !0), n.registerInput("r", fe.Float, !0), n.registerInput("g", fe.Float, !0), n.registerInput("b", fe.Float, !0), n.registerInput("a", fe.Float, !0), n.registerOutput("rgba", fe.Color4), n.registerOutput("rgb", fe.Color3), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "ColorMergerBlock";
+ }, Object.defineProperty(t.prototype, "rgbIn", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "r", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "g", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "b", { get: function() {
+ return this._inputs[3];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "a", { get: function() {
+ return this._inputs[4];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "rgba", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "rgbOut", { get: function() {
+ return this._outputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "rgb", { get: function() {
+ return this.rgbOut;
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this.r, i = this.g, o = this.b, a = this.a, s = this.rgbIn, p = this._outputs[0], m = this._outputs[1];
+ return s.isConnected ? p.hasEndpoints ? e.compilationString += this._declareOutput(p, e) + " = vec4(" + s.associatedVariableName + ", " + (a.isConnected ? this._writeVariable(a) : "0.0") + `);\r
+` : m.hasEndpoints && (e.compilationString += this._declareOutput(m, e) + " = " + s.associatedVariableName + `;\r
+`) : p.hasEndpoints ? e.compilationString += this._declareOutput(p, e) + " = vec4(" + (n.isConnected ? this._writeVariable(n) : "0.0") + ", " + (i.isConnected ? this._writeVariable(i) : "0.0") + ", " + (o.isConnected ? this._writeVariable(o) : "0.0") + ", " + (a.isConnected ? this._writeVariable(a) : "0.0") + `);\r
+` : m.hasEndpoints && (e.compilationString += this._declareOutput(m, e) + " = vec3(" + (n.isConnected ? this._writeVariable(n) : "0.0") + ", " + (i.isConnected ? this._writeVariable(i) : "0.0") + ", " + (o.isConnected ? this._writeVariable(o) : "0.0") + `);\r
+`), this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.ColorMergerBlock"] = Np;
+ var Fp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("xyzw", fe.Vector4, !0), n.registerInput("xyz ", fe.Vector3, !0), n.registerInput("xy ", fe.Vector2, !0), n.registerOutput("xyz", fe.Vector3), n.registerOutput("xy", fe.Vector2), n.registerOutput("x", fe.Float), n.registerOutput("y", fe.Float), n.registerOutput("z", fe.Float), n.registerOutput("w", fe.Float), n.inputsAreExclusive = !0, n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "VectorSplitterBlock";
+ }, Object.defineProperty(t.prototype, "xyzw", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "xyzIn", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "xyIn", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "xyzOut", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "xyOut", { get: function() {
+ return this._outputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "x", { get: function() {
+ return this._outputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "y", { get: function() {
+ return this._outputs[3];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "z", { get: function() {
+ return this._outputs[4];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "w", { get: function() {
+ return this._outputs[5];
+ }, enumerable: !1, configurable: !0 }), t.prototype._inputRename = function(e) {
+ switch (e) {
+ case "xy ":
+ return "xyIn";
+ case "xyz ":
+ return "xyzIn";
+ default:
+ return e;
+ }
+ }, t.prototype._outputRename = function(e) {
+ switch (e) {
+ case "xy":
+ return "xyOut";
+ case "xyz":
+ return "xyzOut";
+ default:
+ return e;
+ }
+ }, t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this.xyzw.isConnected ? this.xyzw : this.xyzIn.isConnected ? this.xyzIn : this.xyIn, i = this._outputs[0], o = this._outputs[1], a = this._outputs[2], s = this._outputs[3], p = this._outputs[4], m = this._outputs[5];
+ return i.hasEndpoints && (n === this.xyIn ? e.compilationString += this._declareOutput(i, e) + " = vec3(" + n.associatedVariableName + `, 0.0);\r
+` : e.compilationString += this._declareOutput(i, e) + " = " + n.associatedVariableName + `.xyz;\r
+`), o.hasEndpoints && (e.compilationString += this._declareOutput(o, e) + " = " + n.associatedVariableName + `.xy;\r
+`), a.hasEndpoints && (e.compilationString += this._declareOutput(a, e) + " = " + n.associatedVariableName + `.x;\r
+`), s.hasEndpoints && (e.compilationString += this._declareOutput(s, e) + " = " + n.associatedVariableName + `.y;\r
+`), p.hasEndpoints && (e.compilationString += this._declareOutput(p, e) + " = " + n.associatedVariableName + `.z;\r
+`), m.hasEndpoints && (e.compilationString += this._declareOutput(m, e) + " = " + n.associatedVariableName + `.w;\r
+`), this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.VectorSplitterBlock"] = Fp;
+ var Bp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("left", fe.AutoDetect), n.registerInput("right", fe.AutoDetect), n.registerInput("gradient", fe.AutoDetect), n.registerOutput("output", fe.BasedOnInput), n._outputs[0]._typeConnectionSource = n._inputs[0], n._linkConnectionTypes(0, 1), n._linkConnectionTypes(1, 2, !0), n._inputs[2].acceptedConnectionPointTypes.push(fe.Float), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "LerpBlock";
+ }, Object.defineProperty(t.prototype, "left", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "right", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "gradient", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = mix(" + this.left.associatedVariableName + " , " + this.right.associatedVariableName + ", " + this.gradient.associatedVariableName + `);\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.LerpBlock"] = Bp;
+ var Up = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("left", fe.AutoDetect), n.registerInput("right", fe.AutoDetect), n.registerOutput("output", fe.BasedOnInput), n._outputs[0]._typeConnectionSource = n._inputs[0], n._linkConnectionTypes(0, 1), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "DivideBlock";
+ }, Object.defineProperty(t.prototype, "left", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "right", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = " + this.left.associatedVariableName + " / " + this.right.associatedVariableName + `;\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.DivideBlock"] = Up;
+ var Vp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("left", fe.AutoDetect), n.registerInput("right", fe.AutoDetect), n.registerOutput("output", fe.BasedOnInput), n._outputs[0]._typeConnectionSource = n._inputs[0], n._linkConnectionTypes(0, 1), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "SubtractBlock";
+ }, Object.defineProperty(t.prototype, "left", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "right", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = " + this.left.associatedVariableName + " - " + this.right.associatedVariableName + `;\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.SubtractBlock"] = Vp;
+ var kp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("value", fe.Float), n.registerInput("edge", fe.Float), n.registerOutput("output", fe.Float), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "StepBlock";
+ }, Object.defineProperty(t.prototype, "value", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "edge", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = step(" + this.edge.associatedVariableName + ", " + this.value.associatedVariableName + `);\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.StepBlock"] = kp;
+ var _u = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("input", fe.AutoDetect), n.registerOutput("output", fe.BasedOnInput), n._outputs[0]._typeConnectionSource = n._inputs[0], n._outputs[0].excludedConnectionPointTypes.push(fe.Matrix), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "OneMinusBlock";
+ }, Object.defineProperty(t.prototype, "input", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = 1. - " + this.input.associatedVariableName + `;\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.OneMinusBlock"] = _u, x.a.RegisteredTypes["BABYLON.OppositeBlock"] = _u;
+ var mu = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("worldPosition", fe.Vector4), n.registerInput("cameraPosition", fe.Vector3), n.registerOutput("output", fe.Vector3), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "ViewDirectionBlock";
+ }, Object.defineProperty(t.prototype, "worldPosition", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "cameraPosition", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype.autoConfigure = function(e) {
+ if (!this.cameraPosition.isConnected) {
+ var n = e.getInputBlockByPredicate(function(i) {
+ return i.systemValue === bt.CameraPosition;
+ });
+ n || (n = new At("cameraPosition")).setAsSystemValue(bt.CameraPosition), n.output.connectTo(this.cameraPosition);
+ }
+ }, t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = normalize(" + this.cameraPosition.associatedVariableName + " - " + this.worldPosition.associatedVariableName + `.xyz);\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.ViewDirectionBlock"] = mu, l(161);
+ var Gp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("worldNormal", fe.Vector4), n.registerInput("viewDirection", fe.Vector3), n.registerInput("bias", fe.Float), n.registerInput("power", fe.Float), n.registerOutput("fresnel", fe.Float), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "FresnelBlock";
+ }, Object.defineProperty(t.prototype, "worldNormal", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "viewDirection", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "bias", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "power", { get: function() {
+ return this._inputs[3];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "fresnel", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype.autoConfigure = function(e) {
+ if (!this.viewDirection.isConnected) {
+ var n = new mu("View direction");
+ n.output.connectTo(this.viewDirection), n.autoConfigure(e);
+ }
+ if (!this.bias.isConnected) {
+ var i = new At("bias");
+ i.value = 0, i.output.connectTo(this.bias);
+ }
+ if (!this.power.isConnected) {
+ var o = new At("power");
+ o.value = 1, o.output.connectTo(this.power);
+ }
+ }, t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = "//" + this.name;
+ return e._emitFunctionFromInclude("fresnelFunction", n, { removeIfDef: !0 }), e.compilationString += this._declareOutput(this.fresnel, e) + " = computeFresnelTerm(" + this.viewDirection.associatedVariableName + ".xyz, " + this.worldNormal.associatedVariableName + ".xyz, " + this.bias.associatedVariableName + ", " + this.power.associatedVariableName + `);\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.FresnelBlock"] = Gp;
+ var zp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("left", fe.AutoDetect), n.registerInput("right", fe.AutoDetect), n.registerOutput("output", fe.BasedOnInput), n._outputs[0]._typeConnectionSource = n._inputs[0], n._linkConnectionTypes(0, 1), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "MaxBlock";
+ }, Object.defineProperty(t.prototype, "left", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "right", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = max(" + this.left.associatedVariableName + ", " + this.right.associatedVariableName + `);\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.MaxBlock"] = zp;
+ var jp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("left", fe.AutoDetect), n.registerInput("right", fe.AutoDetect), n.registerOutput("output", fe.BasedOnInput), n._outputs[0]._typeConnectionSource = n._inputs[0], n._linkConnectionTypes(0, 1), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "MinBlock";
+ }, Object.defineProperty(t.prototype, "left", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "right", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = min(" + this.left.associatedVariableName + ", " + this.right.associatedVariableName + `);\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.MinBlock"] = jp;
+ var Hp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("left", fe.AutoDetect), n.registerInput("right", fe.AutoDetect), n.registerOutput("output", fe.Float), n._linkConnectionTypes(0, 1), n._inputs[0].excludedConnectionPointTypes.push(fe.Float), n._inputs[0].excludedConnectionPointTypes.push(fe.Matrix), n._inputs[1].excludedConnectionPointTypes.push(fe.Float), n._inputs[1].excludedConnectionPointTypes.push(fe.Matrix), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "DistanceBlock";
+ }, Object.defineProperty(t.prototype, "left", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "right", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = length(" + this.left.associatedVariableName + " - " + this.right.associatedVariableName + `);\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.DistanceBlock"] = Hp;
+ var Wp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("value", fe.AutoDetect), n.registerOutput("output", fe.Float), n._inputs[0].excludedConnectionPointTypes.push(fe.Float), n._inputs[0].excludedConnectionPointTypes.push(fe.Matrix), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "LengthBlock";
+ }, Object.defineProperty(t.prototype, "value", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = length(" + this.value.associatedVariableName + `);\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.LengthBlock"] = Wp;
+ var Xp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("value", fe.AutoDetect), n.registerOutput("output", fe.BasedOnInput), n._outputs[0]._typeConnectionSource = n._inputs[0], n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "NegateBlock";
+ }, Object.defineProperty(t.prototype, "value", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = -1.0 * " + this.value.associatedVariableName + `;\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.NegateBlock"] = Xp;
+ var Yp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("value", fe.AutoDetect), n.registerInput("power", fe.AutoDetect), n.registerOutput("output", fe.BasedOnInput), n._outputs[0]._typeConnectionSource = n._inputs[0], n._linkConnectionTypes(0, 1), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "PowBlock";
+ }, Object.defineProperty(t.prototype, "value", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "power", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = pow(" + this.value.associatedVariableName + ", " + this.power.associatedVariableName + `);\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.PowBlock"] = Yp;
+ var Kp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("seed", fe.Vector2), n.registerOutput("output", fe.Float), n._inputs[0].acceptedConnectionPointTypes.push(fe.Vector3), n._inputs[0].acceptedConnectionPointTypes.push(fe.Vector4), n._inputs[0].acceptedConnectionPointTypes.push(fe.Color3), n._inputs[0].acceptedConnectionPointTypes.push(fe.Color4), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "RandomNumberBlock";
+ }, Object.defineProperty(t.prototype, "seed", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0], i = "//" + this.name;
+ return e._emitFunctionFromInclude("helperFunctions", i), e.compilationString += this._declareOutput(n, e) + " = getRand(" + this.seed.associatedVariableName + `.xy);\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.RandomNumberBlock"] = Kp;
+ var Qp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("x", fe.Float), n.registerInput("y", fe.Float), n.registerOutput("output", fe.Float), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "ArcTan2Block";
+ }, Object.defineProperty(t.prototype, "x", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "y", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = atan(" + this.x.associatedVariableName + ", " + this.y.associatedVariableName + `);\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.ArcTan2Block"] = Qp;
+ var qp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("value", fe.AutoDetect), n.registerInput("edge0", fe.Float), n.registerInput("edge1", fe.Float), n.registerOutput("output", fe.BasedOnInput), n._outputs[0]._typeConnectionSource = n._inputs[0], n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "SmoothStepBlock";
+ }, Object.defineProperty(t.prototype, "value", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "edge0", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "edge1", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = smoothstep(" + this.edge0.associatedVariableName + ", " + this.edge1.associatedVariableName + ", " + this.value.associatedVariableName + `);\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.SmoothStepBlock"] = qp;
+ var Zp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("input", fe.AutoDetect), n.registerOutput("output", fe.BasedOnInput), n._outputs[0]._typeConnectionSource = n._inputs[0], n._outputs[0].excludedConnectionPointTypes.push(fe.Matrix), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "ReciprocalBlock";
+ }, Object.defineProperty(t.prototype, "input", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = 1. / " + this.input.associatedVariableName + `;\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.ReciprocalBlock"] = Zp;
+ var Jp = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("value", fe.AutoDetect), n.registerInput("reference", fe.AutoDetect), n.registerInput("distance", fe.Float), n.registerInput("replacement", fe.AutoDetect), n.registerOutput("output", fe.BasedOnInput), n._outputs[0]._typeConnectionSource = n._inputs[0], n._linkConnectionTypes(0, 1), n._linkConnectionTypes(0, 3), n._inputs[0].excludedConnectionPointTypes.push(fe.Float), n._inputs[0].excludedConnectionPointTypes.push(fe.Matrix), n._inputs[1].excludedConnectionPointTypes.push(fe.Float), n._inputs[1].excludedConnectionPointTypes.push(fe.Matrix), n._inputs[3].excludedConnectionPointTypes.push(fe.Float), n._inputs[3].excludedConnectionPointTypes.push(fe.Matrix), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "ReplaceColorBlock";
+ }, Object.defineProperty(t.prototype, "value", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "reference", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "distance", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "replacement", { get: function() {
+ return this._inputs[3];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + `;\r
+`, e.compilationString += "if (length(" + this.value.associatedVariableName + " - " + this.reference.associatedVariableName + ") < " + this.distance.associatedVariableName + `) {\r
+`, e.compilationString += n.associatedVariableName + " = " + this.replacement.associatedVariableName + `;\r
+`, e.compilationString += `} else {\r
+`, e.compilationString += n.associatedVariableName + " = " + this.value.associatedVariableName + `;\r
+`, e.compilationString += `}\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.ReplaceColorBlock"] = Jp;
+ var Kr, $p = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("value", fe.AutoDetect), n.registerInput("steps", fe.AutoDetect), n.registerOutput("output", fe.BasedOnInput), n._outputs[0]._typeConnectionSource = n._inputs[0], n._linkConnectionTypes(0, 1), n._inputs[0].excludedConnectionPointTypes.push(fe.Matrix), n._inputs[1].excludedConnectionPointTypes.push(fe.Matrix), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "PosterizeBlock";
+ }, Object.defineProperty(t.prototype, "value", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "steps", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = floor(" + this.value.associatedVariableName + " / (1.0 / " + this.steps.associatedVariableName + ")) * (1.0 / " + this.steps.associatedVariableName + `);\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.PosterizeBlock"] = $p, function(r) {
+ r[r.SawTooth = 0] = "SawTooth", r[r.Square = 1] = "Square", r[r.Triangle = 2] = "Triangle";
+ }(Kr || (Kr = {}));
+ var e_ = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.kind = Kr.SawTooth, n.registerInput("input", fe.AutoDetect), n.registerOutput("output", fe.BasedOnInput), n._outputs[0]._typeConnectionSource = n._inputs[0], n._inputs[0].excludedConnectionPointTypes.push(fe.Matrix), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "WaveBlock";
+ }, Object.defineProperty(t.prototype, "input", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ switch (this.kind) {
+ case Kr.SawTooth:
+ e.compilationString += this._declareOutput(n, e) + " = " + this.input.associatedVariableName + " - floor(0.5 + " + this.input.associatedVariableName + `);\r
+`;
+ break;
+ case Kr.Square:
+ e.compilationString += this._declareOutput(n, e) + " = 1.0 - 2.0 * round(fract(" + this.input.associatedVariableName + `));\r
+`;
+ break;
+ case Kr.Triangle:
+ e.compilationString += this._declareOutput(n, e) + " = 2.0 * abs(2.0 * (" + this.input.associatedVariableName + " - floor(0.5 + " + this.input.associatedVariableName + `))) - 1.0;\r
+`;
+ }
+ return this;
+ }, t.prototype.serialize = function() {
+ var e = r.prototype.serialize.call(this);
+ return e.kind = this.kind, e;
+ }, t.prototype._deserialize = function(e, n, i) {
+ r.prototype._deserialize.call(this, e, n, i), this.kind = e.kind;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.WaveBlock"] = e_;
+ var Zs = function() {
+ function r(t, e) {
+ this.step = t, this.color = e;
+ }
+ return Object.defineProperty(r.prototype, "step", { get: function() {
+ return this._step;
+ }, set: function(t) {
+ this._step = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "color", { get: function() {
+ return this._color;
+ }, set: function(t) {
+ this._color = t;
+ }, enumerable: !1, configurable: !0 }), r;
+ }(), t_ = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.colorSteps = [new Zs(0, C.a.Black()), new Zs(1, C.a.White())], n.onValueChangedObservable = new P.c(), n.registerInput("gradient", fe.Float), n.registerOutput("output", fe.Color3), n._inputs[0].acceptedConnectionPointTypes.push(fe.Vector2), n._inputs[0].acceptedConnectionPointTypes.push(fe.Vector3), n._inputs[0].acceptedConnectionPointTypes.push(fe.Vector4), n._inputs[0].acceptedConnectionPointTypes.push(fe.Color3), n._inputs[0].acceptedConnectionPointTypes.push(fe.Color4), n;
+ }
+ return Object(u.d)(t, r), t.prototype.colorStepsUpdated = function() {
+ this.onValueChangedObservable.notifyObservers(this);
+ }, t.prototype.getClassName = function() {
+ return "GradientBlock";
+ }, Object.defineProperty(t.prototype, "gradient", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._writeColorConstant = function(e) {
+ var n = this.colorSteps[e];
+ return "vec3(" + n.color.r + ", " + n.color.g + ", " + n.color.b + ")";
+ }, t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ if (this.colorSteps.length && this.gradient.connectedPoint) {
+ var i = e._getFreeVariableName("gradientTempColor"), o = e._getFreeVariableName("gradientTempPosition");
+ e.compilationString += "vec3 " + i + " = " + this._writeColorConstant(0) + `;\r
+`, e.compilationString += "float " + o + `;\r
+`;
+ var a = this.gradient.associatedVariableName;
+ this.gradient.connectedPoint.type !== fe.Float && (a += ".x");
+ for (var s = 1; s < this.colorSteps.length; s++) {
+ var p = this.colorSteps[s], m = this.colorSteps[s - 1];
+ e.compilationString += o + " = clamp((" + a + " - " + e._emitFloat(m.step) + ") / (" + e._emitFloat(p.step) + " - " + e._emitFloat(m.step) + "), 0.0, 1.0) * step(" + e._emitFloat(s) + ", " + e._emitFloat(this.colorSteps.length - 1) + `);\r
+`, e.compilationString += i + " = mix(" + i + ", " + this._writeColorConstant(s) + ", " + o + `);\r
+`;
+ }
+ return e.compilationString += this._declareOutput(n, e) + " = " + i + `;\r
+`, this;
+ }
+ e.compilationString += this._declareOutput(n, e) + ` = vec3(0., 0., 0.);\r
+`;
+ }, t.prototype.serialize = function() {
+ var e = r.prototype.serialize.call(this);
+ e.colorSteps = [];
+ for (var n = 0, i = this.colorSteps; n < i.length; n++) {
+ var o = i[n];
+ e.colorSteps.push({ step: o.step, color: { r: o.color.r, g: o.color.g, b: o.color.b } });
+ }
+ return e;
+ }, t.prototype._deserialize = function(e, n, i) {
+ r.prototype._deserialize.call(this, e, n, i), this.colorSteps = [];
+ for (var o = 0, a = e.colorSteps; o < a.length; o++) {
+ var s = a[o];
+ this.colorSteps.push(new Zs(s.step, new C.a(s.color.r, s.color.g, s.color.b)));
+ }
+ }, t.prototype._dumpPropertiesCode = function() {
+ for (var e = "", n = 0, i = this.colorSteps; n < i.length; n++) {
+ var o = i[n];
+ e += this._codeVariableName + ".colorSteps.push(new BABYLON.GradientBlockColorStep(" + o.step + ", new BABYLON.Color3(" + o.color.r + ", " + o.color.g + ", " + o.color.b + `)));\r
+`;
+ }
+ return e;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.GradientBlock"] = t_;
+ var n_ = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("left", fe.AutoDetect), n.registerInput("right", fe.AutoDetect), n.registerInput("gradient", fe.AutoDetect), n.registerOutput("output", fe.BasedOnInput), n._outputs[0]._typeConnectionSource = n._inputs[0], n._linkConnectionTypes(0, 1), n._linkConnectionTypes(1, 2, !0), n._inputs[2].acceptedConnectionPointTypes.push(fe.Float), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "NLerpBlock";
+ }, Object.defineProperty(t.prototype, "left", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "right", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "gradient", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = normalize(mix(" + this.left.associatedVariableName + " , " + this.right.associatedVariableName + ", " + this.gradient.associatedVariableName + `));\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.NLerpBlock"] = n_;
+ var i_ = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.manhattanDistance = !1, n.registerInput("seed", fe.Vector3), n.registerInput("jitter", fe.Float), n.registerOutput("output", fe.Vector2), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "WorleyNoise3DBlock";
+ }, Object.defineProperty(t.prototype, "seed", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "jitter", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ if (r.prototype._buildBlock.call(this, e), this.seed.isConnected && this._outputs[0].hasEndpoints)
+ return e._emitFunction("worley3D", `vec3 permute(vec3 x){\r
+ return mod((34.0 * x + 1.0) * x, 289.0);\r
+}\r
+\r
+vec3 dist(vec3 x, vec3 y, vec3 z, bool manhattanDistance){\r
+ return manhattanDistance ? abs(x) + abs(y) + abs(z) : (x * x + y * y + z * z);\r
+}\r
+\r
+vec2 worley(vec3 P, float jitter, bool manhattanDistance){\r
+ float K = 0.142857142857; // 1/7\r
+ float Ko = 0.428571428571; // 1/2-K/2\r
+ float K2 = 0.020408163265306; // 1/(7*7)\r
+ float Kz = 0.166666666667; // 1/6\r
+ float Kzo = 0.416666666667; // 1/2-1/6*2\r
+\r
+ vec3 Pi = mod(floor(P), 289.0);\r
+ vec3 Pf = fract(P) - 0.5;\r
+\r
+ vec3 Pfx = Pf.x + vec3(1.0, 0.0, -1.0);\r
+ vec3 Pfy = Pf.y + vec3(1.0, 0.0, -1.0);\r
+ vec3 Pfz = Pf.z + vec3(1.0, 0.0, -1.0);\r
+\r
+ vec3 p = permute(Pi.x + vec3(-1.0, 0.0, 1.0));\r
+ vec3 p1 = permute(p + Pi.y - 1.0);\r
+ vec3 p2 = permute(p + Pi.y);\r
+ vec3 p3 = permute(p + Pi.y + 1.0);\r
+\r
+ vec3 p11 = permute(p1 + Pi.z - 1.0);\r
+ vec3 p12 = permute(p1 + Pi.z);\r
+ vec3 p13 = permute(p1 + Pi.z + 1.0);\r
+\r
+ vec3 p21 = permute(p2 + Pi.z - 1.0);\r
+ vec3 p22 = permute(p2 + Pi.z);\r
+ vec3 p23 = permute(p2 + Pi.z + 1.0);\r
+\r
+ vec3 p31 = permute(p3 + Pi.z - 1.0);\r
+ vec3 p32 = permute(p3 + Pi.z);\r
+ vec3 p33 = permute(p3 + Pi.z + 1.0);\r
+\r
+ vec3 ox11 = fract(p11*K) - Ko;\r
+ vec3 oy11 = mod(floor(p11*K), 7.0)*K - Ko;\r
+ vec3 oz11 = floor(p11*K2)*Kz - Kzo; // p11 < 289 guaranteed\r
+\r
+ vec3 ox12 = fract(p12*K) - Ko;\r
+ vec3 oy12 = mod(floor(p12*K), 7.0)*K - Ko;\r
+ vec3 oz12 = floor(p12*K2)*Kz - Kzo;\r
+\r
+ vec3 ox13 = fract(p13*K) - Ko;\r
+ vec3 oy13 = mod(floor(p13*K), 7.0)*K - Ko;\r
+ vec3 oz13 = floor(p13*K2)*Kz - Kzo;\r
+\r
+ vec3 ox21 = fract(p21*K) - Ko;\r
+ vec3 oy21 = mod(floor(p21*K), 7.0)*K - Ko;\r
+ vec3 oz21 = floor(p21*K2)*Kz - Kzo;\r
+\r
+ vec3 ox22 = fract(p22*K) - Ko;\r
+ vec3 oy22 = mod(floor(p22*K), 7.0)*K - Ko;\r
+ vec3 oz22 = floor(p22*K2)*Kz - Kzo;\r
+\r
+ vec3 ox23 = fract(p23*K) - Ko;\r
+ vec3 oy23 = mod(floor(p23*K), 7.0)*K - Ko;\r
+ vec3 oz23 = floor(p23*K2)*Kz - Kzo;\r
+\r
+ vec3 ox31 = fract(p31*K) - Ko;\r
+ vec3 oy31 = mod(floor(p31*K), 7.0)*K - Ko;\r
+ vec3 oz31 = floor(p31*K2)*Kz - Kzo;\r
+\r
+ vec3 ox32 = fract(p32*K) - Ko;\r
+ vec3 oy32 = mod(floor(p32*K), 7.0)*K - Ko;\r
+ vec3 oz32 = floor(p32*K2)*Kz - Kzo;\r
+\r
+ vec3 ox33 = fract(p33*K) - Ko;\r
+ vec3 oy33 = mod(floor(p33*K), 7.0)*K - Ko;\r
+ vec3 oz33 = floor(p33*K2)*Kz - Kzo;\r
+\r
+ vec3 dx11 = Pfx + jitter*ox11;\r
+ vec3 dy11 = Pfy.x + jitter*oy11;\r
+ vec3 dz11 = Pfz.x + jitter*oz11;\r
+\r
+ vec3 dx12 = Pfx + jitter*ox12;\r
+ vec3 dy12 = Pfy.x + jitter*oy12;\r
+ vec3 dz12 = Pfz.y + jitter*oz12;\r
+\r
+ vec3 dx13 = Pfx + jitter*ox13;\r
+ vec3 dy13 = Pfy.x + jitter*oy13;\r
+ vec3 dz13 = Pfz.z + jitter*oz13;\r
+\r
+ vec3 dx21 = Pfx + jitter*ox21;\r
+ vec3 dy21 = Pfy.y + jitter*oy21;\r
+ vec3 dz21 = Pfz.x + jitter*oz21;\r
+\r
+ vec3 dx22 = Pfx + jitter*ox22;\r
+ vec3 dy22 = Pfy.y + jitter*oy22;\r
+ vec3 dz22 = Pfz.y + jitter*oz22;\r
+\r
+ vec3 dx23 = Pfx + jitter*ox23;\r
+ vec3 dy23 = Pfy.y + jitter*oy23;\r
+ vec3 dz23 = Pfz.z + jitter*oz23;\r
+\r
+ vec3 dx31 = Pfx + jitter*ox31;\r
+ vec3 dy31 = Pfy.z + jitter*oy31;\r
+ vec3 dz31 = Pfz.x + jitter*oz31;\r
+\r
+ vec3 dx32 = Pfx + jitter*ox32;\r
+ vec3 dy32 = Pfy.z + jitter*oy32;\r
+ vec3 dz32 = Pfz.y + jitter*oz32;\r
+\r
+ vec3 dx33 = Pfx + jitter*ox33;\r
+ vec3 dy33 = Pfy.z + jitter*oy33;\r
+ vec3 dz33 = Pfz.z + jitter*oz33;\r
+\r
+ vec3 d11 = dist(dx11, dy11, dz11, manhattanDistance);\r
+ vec3 d12 =dist(dx12, dy12, dz12, manhattanDistance);\r
+ vec3 d13 = dist(dx13, dy13, dz13, manhattanDistance);\r
+ vec3 d21 = dist(dx21, dy21, dz21, manhattanDistance);\r
+ vec3 d22 = dist(dx22, dy22, dz22, manhattanDistance);\r
+ vec3 d23 = dist(dx23, dy23, dz23, manhattanDistance);\r
+ vec3 d31 = dist(dx31, dy31, dz31, manhattanDistance);\r
+ vec3 d32 = dist(dx32, dy32, dz32, manhattanDistance);\r
+ vec3 d33 = dist(dx33, dy33, dz33, manhattanDistance);\r
+\r
+ vec3 d1a = min(d11, d12);\r
+ d12 = max(d11, d12);\r
+ d11 = min(d1a, d13); // Smallest now not in d12 or d13\r
+ d13 = max(d1a, d13);\r
+ d12 = min(d12, d13); // 2nd smallest now not in d13\r
+ vec3 d2a = min(d21, d22);\r
+ d22 = max(d21, d22);\r
+ d21 = min(d2a, d23); // Smallest now not in d22 or d23\r
+ d23 = max(d2a, d23);\r
+ d22 = min(d22, d23); // 2nd smallest now not in d23\r
+ vec3 d3a = min(d31, d32);\r
+ d32 = max(d31, d32);\r
+ d31 = min(d3a, d33); // Smallest now not in d32 or d33\r
+ d33 = max(d3a, d33);\r
+ d32 = min(d32, d33); // 2nd smallest now not in d33\r
+ vec3 da = min(d11, d21);\r
+ d21 = max(d11, d21);\r
+ d11 = min(da, d31); // Smallest now in d11\r
+ d31 = max(da, d31); // 2nd smallest now not in d31\r
+ d11.xy = (d11.x < d11.y) ? d11.xy : d11.yx;\r
+ d11.xz = (d11.x < d11.z) ? d11.xz : d11.zx; // d11.x now smallest\r
+ d12 = min(d12, d21); // 2nd smallest now not in d21\r
+ d12 = min(d12, d22); // nor in d22\r
+ d12 = min(d12, d31); // nor in d31\r
+ d12 = min(d12, d32); // nor in d32\r
+ d11.yz = min(d11.yz,d12.xy); // nor in d12.yz\r
+ d11.y = min(d11.y,d12.z); // Only two more to go\r
+ d11.y = min(d11.y,d11.z); // Done! (Phew!)\r
+ return sqrt(d11.xy); // F1, F2\r
+}\r
+\r
+`, "// Worley3D"), e.compilationString += this._declareOutput(this._outputs[0], e) + " = worley(" + this.seed.associatedVariableName + ", " + this.jitter.associatedVariableName + ", " + this.manhattanDistance + `);\r
+`, this;
+ }, t.prototype._dumpPropertiesCode = function() {
+ return this._codeVariableName + ".manhattanDistance = " + this.manhattanDistance + `;\r
+`;
+ }, t.prototype.serialize = function() {
+ var e = r.prototype.serialize.call(this);
+ return e.manhattanDistance = this.manhattanDistance, e;
+ }, t.prototype._deserialize = function(e, n, i) {
+ r.prototype._deserialize.call(this, e, n, i), this.manhattanDistance = e.manhattanDistance;
+ }, Object(u.c)([jt("Use Manhattan Distance", Ft.Boolean, "PROPERTIES", { notifiers: { update: !1 } })], t.prototype, "manhattanDistance", void 0), t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.WorleyNoise3DBlock"] = i_;
+ var r_ = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("seed", fe.Vector3), n.registerOutput("output", fe.Float), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "SimplexPerlin3DBlock";
+ }, Object.defineProperty(t.prototype, "seed", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ if (r.prototype._buildBlock.call(this, e), this.seed.isConnected && this._outputs[0].hasEndpoints)
+ return e._emitFunction("SimplexPerlin3D", `const float SKEWFACTOR = 1.0/3.0;\r
+const float UNSKEWFACTOR = 1.0/6.0;\r
+const float SIMPLEX_CORNER_POS = 0.5;\r
+const float SIMPLEX_TETRAHADRON_HEIGHT = 0.70710678118654752440084436210485;\r
+float SimplexPerlin3D( vec3 P ){\r
+ P *= SIMPLEX_TETRAHADRON_HEIGHT;\r
+ vec3 Pi = floor( P + dot( P, vec3( SKEWFACTOR) ) ); vec3 x0 = P - Pi + dot(Pi, vec3( UNSKEWFACTOR ) );\r
+ vec3 g = step(x0.yzx, x0.xyz);\r
+ vec3 l = 1.0 - g;\r
+ vec3 Pi_1 = min( g.xyz, l.zxy );\r
+ vec3 Pi_2 = max( g.xyz, l.zxy );\r
+ vec3 x1 = x0 - Pi_1 + UNSKEWFACTOR;\r
+ vec3 x2 = x0 - Pi_2 + SKEWFACTOR;\r
+ vec3 x3 = x0 - SIMPLEX_CORNER_POS;\r
+ vec4 v1234_x = vec4( x0.x, x1.x, x2.x, x3.x );\r
+ vec4 v1234_y = vec4( x0.y, x1.y, x2.y, x3.y );\r
+ vec4 v1234_z = vec4( x0.z, x1.z, x2.z, x3.z );\r
+ Pi.xyz = Pi.xyz - floor(Pi.xyz * ( 1.0 / 69.0 )) * 69.0;\r
+ vec3 Pi_inc1 = step( Pi, vec3( 69.0 - 1.5 ) ) * ( Pi + 1.0 );\r
+ vec4 Pt = vec4( Pi.xy, Pi_inc1.xy ) + vec2( 50.0, 161.0 ).xyxy;\r
+ Pt *= Pt;\r
+ vec4 V1xy_V2xy = mix( Pt.xyxy, Pt.zwzw, vec4( Pi_1.xy, Pi_2.xy ) );\r
+ Pt = vec4( Pt.x, V1xy_V2xy.xz, Pt.z ) * vec4( Pt.y, V1xy_V2xy.yw, Pt.w );\r
+ const vec3 SOMELARGEFLOATS = vec3( 635.298681, 682.357502, 668.926525 );\r
+ const vec3 ZINC = vec3( 48.500388, 65.294118, 63.934599 );\r
+ vec3 lowz_mods = vec3( 1.0 / ( SOMELARGEFLOATS.xyz + Pi.zzz * ZINC.xyz ) );\r
+ vec3 highz_mods = vec3( 1.0 / ( SOMELARGEFLOATS.xyz + Pi_inc1.zzz * ZINC.xyz ) );\r
+ Pi_1 = ( Pi_1.z < 0.5 ) ? lowz_mods : highz_mods;\r
+ Pi_2 = ( Pi_2.z < 0.5 ) ? lowz_mods : highz_mods;\r
+ vec4 hash_0 = fract( Pt * vec4( lowz_mods.x, Pi_1.x, Pi_2.x, highz_mods.x ) ) - 0.49999;\r
+ vec4 hash_1 = fract( Pt * vec4( lowz_mods.y, Pi_1.y, Pi_2.y, highz_mods.y ) ) - 0.49999;\r
+ vec4 hash_2 = fract( Pt * vec4( lowz_mods.z, Pi_1.z, Pi_2.z, highz_mods.z ) ) - 0.49999;\r
+ vec4 grad_results = inversesqrt( hash_0 * hash_0 + hash_1 * hash_1 + hash_2 * hash_2 ) * ( hash_0 * v1234_x + hash_1 * v1234_y + hash_2 * v1234_z );\r
+ const float FINAL_NORMALIZATION = 37.837227241611314102871574478976;\r
+ vec4 kernel_weights = v1234_x * v1234_x + v1234_y * v1234_y + v1234_z * v1234_z;\r
+ kernel_weights = max(0.5 - kernel_weights, 0.0);\r
+ kernel_weights = kernel_weights*kernel_weights*kernel_weights;\r
+ return dot( kernel_weights, grad_results ) * FINAL_NORMALIZATION;\r
+}\r
+`, "// SimplexPerlin3D"), e.compilationString += this._declareOutput(this._outputs[0], e) + " = SimplexPerlin3D(" + this.seed.associatedVariableName + `);\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.SimplexPerlin3DBlock"] = r_;
+ var o_ = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("normalMap0", fe.Vector3), n.registerInput("normalMap1", fe.Vector3), n.registerOutput("output", fe.Vector3), n._inputs[0].acceptedConnectionPointTypes.push(fe.Color3), n._inputs[0].acceptedConnectionPointTypes.push(fe.Color4), n._inputs[0].acceptedConnectionPointTypes.push(fe.Vector4), n._inputs[1].acceptedConnectionPointTypes.push(fe.Color3), n._inputs[1].acceptedConnectionPointTypes.push(fe.Color4), n._inputs[1].acceptedConnectionPointTypes.push(fe.Vector4), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "NormalBlendBlock";
+ }, Object.defineProperty(t.prototype, "normalMap0", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "normalMap1", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0], i = this._inputs[0], o = this._inputs[1], a = e._getFreeVariableName("stepR"), s = e._getFreeVariableName("stepG");
+ return e.compilationString += "float " + a + " = step(0.5, " + i.associatedVariableName + `.r);\r
+`, e.compilationString += "float " + s + " = step(0.5, " + i.associatedVariableName + `.g);\r
+`, e.compilationString += this._declareOutput(n, e) + `;\r
+`, e.compilationString += n.associatedVariableName + ".r = (1.0 - " + a + ") * " + i.associatedVariableName + ".r * " + o.associatedVariableName + ".r * 2.0 + " + a + " * (1.0 - " + i.associatedVariableName + ".r) * (1.0 - " + o.associatedVariableName + `.r) * 2.0;\r
+`, e.compilationString += n.associatedVariableName + ".g = (1.0 - " + s + ") * " + i.associatedVariableName + ".g * " + o.associatedVariableName + ".g * 2.0 + " + s + " * (1.0 - " + i.associatedVariableName + ".g) * (1.0 - " + o.associatedVariableName + `.g) * 2.0;\r
+`, e.compilationString += n.associatedVariableName + ".b = " + i.associatedVariableName + ".b * " + o.associatedVariableName + `.b;\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.NormalBlendBlock"] = o_;
+ var a_ = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("input", fe.Vector2), n.registerInput("angle", fe.Float), n.registerOutput("output", fe.Vector2), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "Rotate2dBlock";
+ }, Object.defineProperty(t.prototype, "input", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "angle", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype.autoConfigure = function(e) {
+ if (!this.angle.isConnected) {
+ var n = new At("angle");
+ n.value = 0, n.output.connectTo(this.angle);
+ }
+ }, t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0], i = this.angle, o = this.input;
+ return e.compilationString += this._declareOutput(n, e) + " = vec2(cos(" + i.associatedVariableName + ") * " + o.associatedVariableName + ".x - sin(" + i.associatedVariableName + ") * " + o.associatedVariableName + ".y, sin(" + i.associatedVariableName + ") * " + o.associatedVariableName + ".x + cos(" + i.associatedVariableName + ") * " + o.associatedVariableName + `.y);\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.Rotate2dBlock"] = a_;
+ var s_ = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("incident", fe.Vector3), n.registerInput("normal", fe.Vector3), n.registerOutput("output", fe.Vector3), n._inputs[0].acceptedConnectionPointTypes.push(fe.Vector4), n._inputs[0].acceptedConnectionPointTypes.push(fe.Color3), n._inputs[0].acceptedConnectionPointTypes.push(fe.Color4), n._inputs[1].acceptedConnectionPointTypes.push(fe.Vector4), n._inputs[1].acceptedConnectionPointTypes.push(fe.Color3), n._inputs[1].acceptedConnectionPointTypes.push(fe.Color4), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "ReflectBlock";
+ }, Object.defineProperty(t.prototype, "incident", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "normal", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = reflect(" + this.incident.associatedVariableName + ".xyz, " + this.normal.associatedVariableName + `.xyz);\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.ReflectBlock"] = s_;
+ var c_ = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("incident", fe.Vector3), n.registerInput("normal", fe.Vector3), n.registerInput("ior", fe.Float), n.registerOutput("output", fe.Vector3), n._inputs[0].acceptedConnectionPointTypes.push(fe.Vector4), n._inputs[0].acceptedConnectionPointTypes.push(fe.Color3), n._inputs[0].acceptedConnectionPointTypes.push(fe.Color4), n._inputs[1].acceptedConnectionPointTypes.push(fe.Vector4), n._inputs[1].acceptedConnectionPointTypes.push(fe.Color3), n._inputs[1].acceptedConnectionPointTypes.push(fe.Color4), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "RefractBlock";
+ }, Object.defineProperty(t.prototype, "incident", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "normal", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "ior", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = refract(" + this.incident.associatedVariableName + ".xyz, " + this.normal.associatedVariableName + ".xyz, " + this.ior.associatedVariableName + `);\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.RefractBlock"] = c_;
+ var l_ = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("color", fe.Color3), n.registerInput("level", fe.Float), n.registerOutput("output", fe.Color3), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "DesaturateBlock";
+ }, Object.defineProperty(t.prototype, "color", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "level", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0], i = this.color.associatedVariableName, o = e._getFreeVariableName("colorMin"), a = e._getFreeVariableName("colorMax"), s = e._getFreeVariableName("colorMerge");
+ return e.compilationString += "float " + o + " = min(min(" + i + ".x, " + i + ".y), " + i + `.z);\r
+`, e.compilationString += "float " + a + " = max(max(" + i + ".x, " + i + ".y), " + i + `.z);\r
+`, e.compilationString += "float " + s + " = 0.5 * (" + o + " + " + a + `);\r
+`, e.compilationString += this._declareOutput(n, e) + " = mix(" + i + ", vec3(" + s + ", " + s + ", " + s + "), " + this.level.associatedVariableName + `);\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.DesaturateBlock"] = l_;
+ var di = function(r) {
+ function t(e, n, i, o, a, s) {
+ var p = r.call(this, e, n, i) || this;
+ return p._blockType = o, p._blockName = a, p._nameForCheking = s, p._nameForCheking || (p._nameForCheking = e), p.needDualDirectionValidation = !0, p;
+ }
+ return Object(u.d)(t, r), t.prototype.checkCompatibilityState = function(e) {
+ return e instanceof t && e.name === this._nameForCheking ? Ri.Compatible : Ri.TypeIncompatible;
+ }, t.prototype.createCustomInputBlock = function() {
+ return [new this._blockType(this._blockName), this.name];
+ }, t;
+ }(Ws), gu = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Fragment) || this;
+ return n.albedoScaling = !1, n.linkSheenWithAlbedo = !1, n._isUnique = !0, n.registerInput("intensity", fe.Float, !0, Me.Fragment), n.registerInput("color", fe.Color3, !0, Me.Fragment), n.registerInput("roughness", fe.Float, !0, Me.Fragment), n.registerOutput("sheen", fe.Object, Me.Fragment, new di("sheen", n, Dn.Output, t, "SheenBlock")), n;
+ }
+ return Object(u.d)(t, r), t.prototype.initialize = function(e) {
+ e._excludeVariableName("sheenOut"), e._excludeVariableName("sheenMapData"), e._excludeVariableName("vSheenColor"), e._excludeVariableName("vSheenRoughness");
+ }, t.prototype.getClassName = function() {
+ return "SheenBlock";
+ }, Object.defineProperty(t.prototype, "intensity", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "color", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "roughness", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "sheen", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype.prepareDefines = function(e, n, i) {
+ r.prototype.prepareDefines.call(this, e, n, i), i.setValue("SHEEN", !0), i.setValue("SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE", !0, !0), i.setValue("SHEEN_LINKWITHALBEDO", this.linkSheenWithAlbedo, !0), i.setValue("SHEEN_ROUGHNESS", this.roughness.isConnected, !0), i.setValue("SHEEN_ALBEDOSCALING", this.albedoScaling, !0);
+ }, t.prototype.getCode = function(e) {
+ return `#ifdef SHEEN
+ sheenOutParams sheenOut;
+
+ vec4 vSheenColor = vec4(` + (this.color.isConnected ? this.color.associatedVariableName : "vec3(1.)") + ", " + (this.intensity.isConnected ? this.intensity.associatedVariableName : "1.") + `);
+
+ sheenBlock(
+ vSheenColor,
+ #ifdef SHEEN_ROUGHNESS
+ ` + (this.roughness.isConnected ? this.roughness.associatedVariableName : "0.") + `,
+ #endif
+ roughness,
+ #ifdef SHEEN_TEXTURE
+ vec4(0.),
+ #endif
+ reflectance,
+ #ifdef SHEEN_LINKWITHALBEDO
+ baseColor,
+ surfaceAlbedo,
+ #endif
+ #ifdef ENVIRONMENTBRDF
+ NdotV,
+ environmentBrdf,
+ #endif
+ #if defined(REFLECTION) && defined(ENVIRONMENTBRDF)
+ AARoughnessFactors,
+ ` + (e == null ? void 0 : e._vReflectionMicrosurfaceInfosName) + `,
+ ` + (e == null ? void 0 : e._vReflectionInfosName) + `,
+ ` + (e == null ? void 0 : e.reflectionColor) + `,
+ vLightingIntensity,
+ #ifdef ` + (e == null ? void 0 : e._define3DName) + `
+ ` + (e == null ? void 0 : e._cubeSamplerName) + `,
+ #else
+ ` + (e == null ? void 0 : e._2DSamplerName) + `,
+ #endif
+ reflectionOut.reflectionCoords,
+ NdotVUnclamped,
+ #ifndef LODBASEDMICROSFURACE
+ #ifdef ` + (e == null ? void 0 : e._define3DName) + `
+ ` + (e == null ? void 0 : e._cubeSamplerName) + `,
+ ` + (e == null ? void 0 : e._cubeSamplerName) + `,
+ #else
+ ` + (e == null ? void 0 : e._2DSamplerName) + `,
+ ` + (e == null ? void 0 : e._2DSamplerName) + `,
+ #endif
+ #endif
+ #if !defined(` + (e == null ? void 0 : e._defineSkyboxName) + `) && defined(RADIANCEOCCLUSION)
+ seo,
+ #endif
+ #if !defined(` + (e == null ? void 0 : e._defineSkyboxName) + ") && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(" + (e == null ? void 0 : e._define3DName) + `)
+ eho,
+ #endif
+ #endif
+ sheenOut
+ );
+
+ #ifdef SHEEN_LINKWITHALBEDO
+ surfaceAlbedo = sheenOut.surfaceAlbedo;
+ #endif
+ #endif\r
+`;
+ }, t.prototype._buildBlock = function(e) {
+ return e.target === Me.Fragment && e.sharedData.blocksWithDefines.push(this), this;
+ }, t.prototype._dumpPropertiesCode = function() {
+ var e = r.prototype._dumpPropertiesCode.call(this);
+ return e += this._codeVariableName + ".albedoScaling = " + this.albedoScaling + `;\r
+`, e += this._codeVariableName + ".linkSheenWithAlbedo = " + this.linkSheenWithAlbedo + `;\r
+`;
+ }, t.prototype.serialize = function() {
+ var e = r.prototype.serialize.call(this);
+ return e.albedoScaling = this.albedoScaling, e.linkSheenWithAlbedo = this.linkSheenWithAlbedo, e;
+ }, t.prototype._deserialize = function(e, n, i) {
+ r.prototype._deserialize.call(this, e, n, i), this.albedoScaling = e.albedoScaling, this.linkSheenWithAlbedo = e.linkSheenWithAlbedo;
+ }, Object(u.c)([jt("Albedo scaling", Ft.Boolean, "PROPERTIES", { notifiers: { update: !0 } })], t.prototype, "albedoScaling", void 0), Object(u.c)([jt("Link sheen with albedo", Ft.Boolean, "PROPERTIES", { notifiers: { update: !0 } })], t.prototype, "linkSheenWithAlbedo", void 0), t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.SheenBlock"] = gu;
+ var vu = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Fragment) || this;
+ return n._isUnique = !0, n.registerInput("intensity", fe.Float, !0, Me.Fragment), n.registerInput("direction", fe.Vector2, !0, Me.Fragment), n.registerInput("uv", fe.Vector2, !0), n.registerInput("worldTangent", fe.Vector4, !0), n.registerOutput("anisotropy", fe.Object, Me.Fragment, new di("anisotropy", n, Dn.Output, t, "AnisotropyBlock")), n;
+ }
+ return Object(u.d)(t, r), t.prototype.initialize = function(e) {
+ e._excludeVariableName("anisotropicOut"), e._excludeVariableName("TBN");
+ }, t.prototype.getClassName = function() {
+ return "AnisotropyBlock";
+ }, Object.defineProperty(t.prototype, "intensity", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "direction", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "uv", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "worldTangent", { get: function() {
+ return this._inputs[3];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "anisotropy", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._generateTBNSpace = function(e) {
+ var n = "", i = "//" + this.name, o = this.uv, a = this.worldPositionConnectionPoint, s = this.worldNormalConnectionPoint, p = this.worldTangent;
+ o.isConnected || console.error("You must connect the 'uv' input of the Anisotropy block!"), e._emitExtension("derivatives", "#extension GL_OES_standard_derivatives : enable");
+ var m = { search: /defined\(TANGENT\)/g, replace: p.isConnected ? "defined(TANGENT)" : "defined(IGNORE)" };
+ return p.isConnected && (n += "vec3 tbnNormal = normalize(" + s.associatedVariableName + `.xyz);\r
+`, n += "vec3 tbnTangent = normalize(" + p.associatedVariableName + `.xyz);\r
+`, n += `vec3 tbnBitangent = cross(tbnNormal, tbnTangent);\r
+`, n += `mat3 vTBN = mat3(tbnTangent, tbnBitangent, tbnNormal);\r
+`), n += `
+ #if defined(` + (p.isConnected ? "TANGENT" : "IGNORE") + `) && defined(NORMAL)
+ mat3 TBN = vTBN;
+ #else
+ mat3 TBN = cotangent_frame(` + s.associatedVariableName + ".xyz, v_" + a.associatedVariableName + ".xyz, " + (o.isConnected ? o.associatedVariableName : "vec2(0.)") + `, vec2(1., 1.));
+ #endif\r
+`, e._emitFunctionFromInclude("bumpFragmentMainFunctions", i, { replaceStrings: [m] }), n;
+ }, t.prototype.getCode = function(e, n) {
+ n === void 0 && (n = !1);
+ var i = "";
+ n && (i += this._generateTBNSpace(e));
+ var o = this.intensity.isConnected ? this.intensity.associatedVariableName : "1.0";
+ return i += `anisotropicOutParams anisotropicOut;
+ anisotropicBlock(
+ vec3(` + (this.direction.isConnected ? this.direction.associatedVariableName : "vec2(1., 0.)") + ", " + o + `),
+ #ifdef ANISOTROPIC_TEXTURE
+ vec3(0.),
+ #endif
+ TBN,
+ normalW,
+ viewDirectionW,
+ anisotropicOut
+ );\r
+`;
+ }, t.prototype.prepareDefines = function(e, n, i) {
+ r.prototype.prepareDefines.call(this, e, n, i), i.setValue("ANISOTROPIC", !0), i.setValue("ANISOTROPIC_TEXTURE", !1, !0);
+ }, t.prototype._buildBlock = function(e) {
+ return e.target === Me.Fragment && e.sharedData.blocksWithDefines.push(this), this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.AnisotropyBlock"] = vu;
+ var bu = function(r) {
+ function t(e) {
+ var n = r.call(this, e) || this;
+ return n.useSphericalHarmonics = !0, n.forceIrradianceInFragment = !1, n._isUnique = !0, n.registerInput("position", fe.Vector3, !1, Me.Vertex), n.registerInput("world", fe.Matrix, !1, Me.Vertex), n.registerInput("color", fe.Color3, !0, Me.Fragment), n.registerOutput("reflection", fe.Object, Me.Fragment, new di("reflection", n, Dn.Output, t, "ReflectionBlock")), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "ReflectionBlock";
+ }, Object.defineProperty(t.prototype, "position", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "worldPosition", { get: function() {
+ return this.worldPositionConnectionPoint;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "worldNormal", { get: function() {
+ return this.worldNormalConnectionPoint;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "world", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "cameraPosition", { get: function() {
+ return this.cameraPositionConnectionPoint;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "view", { get: function() {
+ return this.viewConnectionPoint;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "color", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "reflection", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "hasTexture", { get: function() {
+ return !!this._getTexture();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "reflectionColor", { get: function() {
+ return this.color.isConnected ? this.color.associatedVariableName : "vec3(1., 1., 1.)";
+ }, enumerable: !1, configurable: !0 }), t.prototype._getTexture = function() {
+ return this.texture ? this.texture : this._scene.environmentTexture;
+ }, t.prototype.prepareDefines = function(e, n, i) {
+ r.prototype.prepareDefines.call(this, e, n, i);
+ var o = this._getTexture(), a = o && o.getTextureMatrix;
+ i.setValue("REFLECTION", a, !0), a && (i.setValue(this._defineLODReflectionAlpha, o.lodLevelInAlpha, !0), i.setValue(this._defineLinearSpecularReflection, o.linearSpecularLOD, !0), i.setValue(this._defineOppositeZ, this._scene.useRightHandedSystem ? !o.invertZ : o.invertZ, !0), i.setValue("SPHERICAL_HARMONICS", this.useSphericalHarmonics, !0), i.setValue("GAMMAREFLECTION", o.gammaSpace, !0), i.setValue("RGBDREFLECTION", o.isRGBD, !0), o && o.coordinatesMode !== Ue.a.SKYBOX_MODE && o.isCube && (i.setValue("USESPHERICALFROMREFLECTIONMAP", !0), i.setValue("USEIRRADIANCEMAP", !1), this.forceIrradianceInFragment || this._scene.getEngine().getCaps().maxVaryingVectors <= 8 ? i.setValue("USESPHERICALINVERTEX", !1) : i.setValue("USESPHERICALINVERTEX", !0)));
+ }, t.prototype.bind = function(e, n, i, o) {
+ r.prototype.bind.call(this, e, n, i);
+ var a = this._getTexture();
+ if (a && o) {
+ a.isCube ? e.setTexture(this._cubeSamplerName, a) : e.setTexture(this._2DSamplerName, a);
+ var s = a.getSize().width;
+ e.setFloat3(this._vReflectionMicrosurfaceInfosName, s, a.lodGenerationScale, a.lodGenerationOffset), e.setFloat2(this._vReflectionFilteringInfoName, s, ee.a.Log2(s));
+ var p = o._materialDefines, m = a.sphericalPolynomial;
+ if (p.USESPHERICALFROMREFLECTIONMAP && m)
+ if (p.SPHERICAL_HARMONICS) {
+ var S = m.preScaledHarmonics;
+ e.setVector3("vSphericalL00", S.l00), e.setVector3("vSphericalL1_1", S.l1_1), e.setVector3("vSphericalL10", S.l10), e.setVector3("vSphericalL11", S.l11), e.setVector3("vSphericalL2_2", S.l2_2), e.setVector3("vSphericalL2_1", S.l2_1), e.setVector3("vSphericalL20", S.l20), e.setVector3("vSphericalL21", S.l21), e.setVector3("vSphericalL22", S.l22);
+ } else
+ e.setFloat3("vSphericalX", m.x.x, m.x.y, m.x.z), e.setFloat3("vSphericalY", m.y.x, m.y.y, m.y.z), e.setFloat3("vSphericalZ", m.z.x, m.z.y, m.z.z), e.setFloat3("vSphericalXX_ZZ", m.xx.x - m.zz.x, m.xx.y - m.zz.y, m.xx.z - m.zz.z), e.setFloat3("vSphericalYY_ZZ", m.yy.x - m.zz.x, m.yy.y - m.zz.y, m.yy.z - m.zz.z), e.setFloat3("vSphericalZZ", m.zz.x, m.zz.y, m.zz.z), e.setFloat3("vSphericalXY", m.xy.x, m.xy.y, m.xy.z), e.setFloat3("vSphericalYZ", m.yz.x, m.yz.y, m.yz.z), e.setFloat3("vSphericalZX", m.zx.x, m.zx.y, m.zx.z);
+ }
+ }, t.prototype.handleVertexSide = function(e) {
+ var n = r.prototype.handleVertexSide.call(this, e);
+ e._emitFunctionFromInclude("harmonicsFunctions", "//" + this.name, { replaceStrings: [{ search: /uniform vec3 vSphericalL00;[\s\S]*?uniform vec3 vSphericalL22;/g, replace: "" }, { search: /uniform vec3 vSphericalX;[\s\S]*?uniform vec3 vSphericalZX;/g, replace: "" }] });
+ var i = e._getFreeVariableName("reflectionVector");
+ return this._vEnvironmentIrradianceName = e._getFreeVariableName("vEnvironmentIrradiance"), e._emitVaryingFromString(this._vEnvironmentIrradianceName, "vec3", "defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)"), e._emitUniformFromString("vSphericalL00", "vec3", "SPHERICAL_HARMONICS"), e._emitUniformFromString("vSphericalL1_1", "vec3", "SPHERICAL_HARMONICS"), e._emitUniformFromString("vSphericalL10", "vec3", "SPHERICAL_HARMONICS"), e._emitUniformFromString("vSphericalL11", "vec3", "SPHERICAL_HARMONICS"), e._emitUniformFromString("vSphericalL2_2", "vec3", "SPHERICAL_HARMONICS"), e._emitUniformFromString("vSphericalL2_1", "vec3", "SPHERICAL_HARMONICS"), e._emitUniformFromString("vSphericalL20", "vec3", "SPHERICAL_HARMONICS"), e._emitUniformFromString("vSphericalL21", "vec3", "SPHERICAL_HARMONICS"), e._emitUniformFromString("vSphericalL22", "vec3", "SPHERICAL_HARMONICS"), e._emitUniformFromString("vSphericalX", "vec3", "SPHERICAL_HARMONICS", !0), e._emitUniformFromString("vSphericalY", "vec3", "SPHERICAL_HARMONICS", !0), e._emitUniformFromString("vSphericalZ", "vec3", "SPHERICAL_HARMONICS", !0), e._emitUniformFromString("vSphericalXX_ZZ", "vec3", "SPHERICAL_HARMONICS", !0), e._emitUniformFromString("vSphericalYY_ZZ", "vec3", "SPHERICAL_HARMONICS", !0), e._emitUniformFromString("vSphericalZZ", "vec3", "SPHERICAL_HARMONICS", !0), e._emitUniformFromString("vSphericalXY", "vec3", "SPHERICAL_HARMONICS", !0), e._emitUniformFromString("vSphericalYZ", "vec3", "SPHERICAL_HARMONICS", !0), e._emitUniformFromString("vSphericalZX", "vec3", "SPHERICAL_HARMONICS", !0), n += `#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)
+ vec3 ` + i + " = vec3(" + this._reflectionMatrixName + " * vec4(normalize(" + this.worldNormal.associatedVariableName + `).xyz, 0)).xyz;
+ #ifdef ` + this._defineOppositeZ + `
+ ` + i + `.z *= -1.0;
+ #endif
+ ` + this._vEnvironmentIrradianceName + " = computeEnvironmentIrradiance(" + i + `);
+ #endif\r
+`;
+ }, t.prototype.getCode = function(e, n) {
+ var i = "";
+ this.handleFragmentSideInits(e), e._emitFunctionFromInclude("harmonicsFunctions", "//" + this.name, { replaceStrings: [{ search: /uniform vec3 vSphericalL00;[\s\S]*?uniform vec3 vSphericalL22;/g, replace: "" }, { search: /uniform vec3 vSphericalX;[\s\S]*?uniform vec3 vSphericalZX;/g, replace: "" }] }), e._emitFunction("sampleReflection", `
+ #ifdef ` + this._define3DName + `
+ #define sampleReflection(s, c) textureCube(s, c)
+ #else
+ #define sampleReflection(s, c) texture2D(s, c)
+ #endif\r
+`, "//" + this.name), e._emitFunction("sampleReflectionLod", `
+ #ifdef ` + this._define3DName + `
+ #define sampleReflectionLod(s, c, l) textureCubeLodEXT(s, c, l)
+ #else
+ #define sampleReflectionLod(s, c, l) texture2DLodEXT(s, c, l)
+ #endif\r
+`, "//" + this.name);
+ var o = `
+ vec3 computeReflectionCoordsPBR(vec4 worldPos, vec3 worldNormal) {
+ ` + this.handleFragmentSideCodeReflectionCoords("worldNormal", "worldPos", !0) + `
+ return ` + this._reflectionVectorName + `;
+ }\r
+`;
+ return e._emitFunction("computeReflectionCoordsPBR", o, "//" + this.name), this._vReflectionMicrosurfaceInfosName = e._getFreeVariableName("vReflectionMicrosurfaceInfos"), e._emitUniformFromString(this._vReflectionMicrosurfaceInfosName, "vec3"), this._vReflectionInfosName = e._getFreeVariableName("vReflectionInfos"), this._vReflectionFilteringInfoName = e._getFreeVariableName("vReflectionFilteringInfo"), e._emitUniformFromString(this._vReflectionFilteringInfoName, "vec2"), i += `#ifdef REFLECTION
+ vec2 ` + this._vReflectionInfosName + ` = vec2(1., 0.);
+
+ reflectionOutParams reflectionOut;
+
+ reflectionBlock(
+ v_` + this.worldPosition.associatedVariableName + `.xyz,
+ ` + n + `,
+ alphaG,
+ ` + this._vReflectionMicrosurfaceInfosName + `,
+ ` + this._vReflectionInfosName + `,
+ ` + this.reflectionColor + `,
+ #ifdef ANISOTROPIC
+ anisotropicOut,
+ #endif
+ #if defined(` + this._defineLODReflectionAlpha + ") && !defined(" + this._defineSkyboxName + `)
+ NdotVUnclamped,
+ #endif
+ #ifdef ` + this._defineLinearSpecularReflection + `
+ roughness,
+ #endif
+ #ifdef ` + this._define3DName + `
+ ` + this._cubeSamplerName + `,
+ #else
+ ` + this._2DSamplerName + `,
+ #endif
+ #if defined(NORMAL) && defined(USESPHERICALINVERTEX)
+ ` + this._vEnvironmentIrradianceName + `,
+ #endif
+ #ifdef USESPHERICALFROMREFLECTIONMAP
+ #if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)
+ ` + this._reflectionMatrixName + `,
+ #endif
+ #endif
+ #ifdef USEIRRADIANCEMAP
+ irradianceSampler, // ** not handled **
+ #endif
+ #ifndef LODBASEDMICROSFURACE
+ #ifdef ` + this._define3DName + `
+ ` + this._cubeSamplerName + `,
+ ` + this._cubeSamplerName + `,
+ #else
+ ` + this._2DSamplerName + `,
+ ` + this._2DSamplerName + `,
+ #endif
+ #endif
+ #ifdef REALTIME_FILTERING
+ ` + this._vReflectionFilteringInfoName + `,
+ #endif
+ reflectionOut
+ );
+ #endif\r
+`;
+ }, t.prototype._buildBlock = function(e) {
+ return this._scene = e.sharedData.scene, e.target !== Me.Fragment && (this._defineLODReflectionAlpha = e._getFreeDefineName("LODINREFLECTIONALPHA"), this._defineLinearSpecularReflection = e._getFreeDefineName("LINEARSPECULARREFLECTION")), this;
+ }, t.prototype._dumpPropertiesCode = function() {
+ var e = r.prototype._dumpPropertiesCode.call(this);
+ return this.texture && (e += this._codeVariableName + ".texture.gammaSpace = " + this.texture.gammaSpace + `);\r
+`), e += this._codeVariableName + ".useSphericalHarmonics = " + this.useSphericalHarmonics + `;\r
+`, e += this._codeVariableName + ".forceIrradianceInFragment = " + this.forceIrradianceInFragment + `;\r
+`;
+ }, t.prototype.serialize = function() {
+ var e, n, i = r.prototype.serialize.call(this);
+ return i.useSphericalHarmonics = this.useSphericalHarmonics, i.forceIrradianceInFragment = this.forceIrradianceInFragment, i.gammaSpace = (n = (e = this.texture) === null || e === void 0 ? void 0 : e.gammaSpace) === null || n === void 0 || n, i;
+ }, t.prototype._deserialize = function(e, n, i) {
+ r.prototype._deserialize.call(this, e, n, i), this.useSphericalHarmonics = e.useSphericalHarmonics, this.forceIrradianceInFragment = e.forceIrradianceInFragment, this.texture && (this.texture.gammaSpace = e.gammaSpace);
+ }, Object(u.c)([jt("Spherical Harmonics", Ft.Boolean, "ADVANCED", { notifiers: { update: !0 } })], t.prototype, "useSphericalHarmonics", void 0), Object(u.c)([jt("Force irradiance in fragment", Ft.Boolean, "ADVANCED", { notifiers: { update: !0 } })], t.prototype, "forceIrradianceInFragment", void 0), t;
+ }(pu);
+ x.a.RegisteredTypes["BABYLON.ReflectionBlock"] = bu;
+ var Js = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Fragment) || this;
+ return n.remapF0OnInterfaceChange = !0, n._isUnique = !0, n.registerInput("intensity", fe.Float, !1, Me.Fragment), n.registerInput("roughness", fe.Float, !0, Me.Fragment), n.registerInput("indexOfRefraction", fe.Float, !0, Me.Fragment), n.registerInput("normalMapColor", fe.Color3, !0, Me.Fragment), n.registerInput("uv", fe.Vector2, !0, Me.Fragment), n.registerInput("tintColor", fe.Color3, !0, Me.Fragment), n.registerInput("tintAtDistance", fe.Float, !0, Me.Fragment), n.registerInput("tintThickness", fe.Float, !0, Me.Fragment), n.registerInput("worldTangent", fe.Vector4, !0), n.registerOutput("clearcoat", fe.Object, Me.Fragment, new di("clearcoat", n, Dn.Output, t, "ClearCoatBlock")), n;
+ }
+ return Object(u.d)(t, r), t.prototype.initialize = function(e) {
+ e._excludeVariableName("clearcoatOut"), e._excludeVariableName("vClearCoatParams"), e._excludeVariableName("vClearCoatTintParams"), e._excludeVariableName("vClearCoatRefractionParams"), e._excludeVariableName("vClearCoatTangentSpaceParams");
+ }, t.prototype.getClassName = function() {
+ return "ClearCoatBlock";
+ }, Object.defineProperty(t.prototype, "intensity", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "roughness", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "indexOfRefraction", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "normalMapColor", { get: function() {
+ return this._inputs[3];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "uv", { get: function() {
+ return this._inputs[4];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "tintColor", { get: function() {
+ return this._inputs[5];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "tintAtDistance", { get: function() {
+ return this._inputs[6];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "tintThickness", { get: function() {
+ return this._inputs[7];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "worldTangent", { get: function() {
+ return this._inputs[8];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "clearcoat", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype.autoConfigure = function(e) {
+ if (!this.intensity.isConnected) {
+ var n = new At("ClearCoat intensity", Me.Fragment, fe.Float);
+ n.value = 1, n.output.connectTo(this.intensity);
+ }
+ }, t.prototype.prepareDefines = function(e, n, i) {
+ r.prototype.prepareDefines.call(this, e, n, i), i.setValue("CLEARCOAT", !0), i.setValue("CLEARCOAT_TEXTURE", !1, !0), i.setValue("CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE", !0, !0), i.setValue("CLEARCOAT_TINT", this.tintColor.isConnected || this.tintThickness.isConnected || this.tintAtDistance.isConnected, !0), i.setValue("CLEARCOAT_BUMP", this.normalMapColor.isConnected, !0), i.setValue("CLEARCOAT_DEFAULTIOR", !this.indexOfRefraction.isConnected || this.indexOfRefraction.connectInputBlock.value === Co._DefaultIndexOfRefraction, !0), i.setValue("CLEARCOAT_REMAP_F0", this.remapF0OnInterfaceChange, !0);
+ }, t.prototype.bind = function(e, n, i, o) {
+ var a, s;
+ r.prototype.bind.call(this, e, n, i);
+ var p = (s = (a = this.indexOfRefraction.connectInputBlock) === null || a === void 0 ? void 0 : a.value) !== null && s !== void 0 ? s : Co._DefaultIndexOfRefraction, m = 1 - p, S = 1 + p, O = Math.pow(-m / S, 2), I = 1 / p;
+ e.setFloat4("vClearCoatRefractionParams", O, I, m, S);
+ var G = this.clearcoat.hasEndpoints ? this.clearcoat.endpoints[0].ownerBlock : null, k = G != null && G.perturbedNormal.isConnected ? G.perturbedNormal.connectedPoint.ownerBlock : null;
+ this._scene._mirroredCameraPosition ? e.setFloat2("vClearCoatTangentSpaceParams", k != null && k.invertX ? 1 : -1, k != null && k.invertY ? 1 : -1) : e.setFloat2("vClearCoatTangentSpaceParams", k != null && k.invertX ? -1 : 1, k != null && k.invertY ? -1 : 1);
+ }, t.prototype._generateTBNSpace = function(e, n, i) {
+ var o = "", a = "//" + this.name, s = this.worldTangent;
+ e._emitExtension("derivatives", "#extension GL_OES_standard_derivatives : enable");
+ var p = { search: /defined\(TANGENT\)/g, replace: s.isConnected ? "defined(TANGENT)" : "defined(IGNORE)" };
+ return s.isConnected && (o += "vec3 tbnNormal = normalize(" + i + `.xyz);\r
+`, o += "vec3 tbnTangent = normalize(" + s.associatedVariableName + `.xyz);\r
+`, o += `vec3 tbnBitangent = cross(tbnNormal, tbnTangent);\r
+`, o += `mat3 vTBN = mat3(tbnTangent, tbnBitangent, tbnNormal);\r
+`), e._emitFunctionFromInclude("bumpFragmentMainFunctions", a, { replaceStrings: [p] }), o;
+ }, t.GetCode = function(e, n, i, o, a, s, p) {
+ var m = "", S = n != null && n.intensity.isConnected ? n.intensity.associatedVariableName : "1.", O = n != null && n.roughness.isConnected ? n.roughness.associatedVariableName : "0.", I = n != null && n.normalMapColor.isConnected ? n.normalMapColor.associatedVariableName : "vec3(0.)", G = n != null && n.uv.isConnected ? n.uv.associatedVariableName : "vec2(0.)", k = n != null && n.tintColor.isConnected ? n.tintColor.associatedVariableName : "vec3(1.)", K = n != null && n.tintThickness.isConnected ? n.tintThickness.associatedVariableName : "1.", re = n != null && n.tintAtDistance.isConnected ? n.tintAtDistance.associatedVariableName : "1.";
+ return n && (e._emitUniformFromString("vClearCoatRefractionParams", "vec4"), e._emitUniformFromString("vClearCoatTangentSpaceParams", "vec2")), a && n && (m += n._generateTBNSpace(e, o, p), s = n.worldTangent.isConnected), m += `clearcoatOutParams clearcoatOut;
+
+ #ifdef CLEARCOAT
+ vec2 vClearCoatParams = vec2(` + S + ", " + O + `);
+ vec4 vClearCoatTintParams = vec4(` + k + ", " + K + `);
+
+ clearcoatBlock(
+ ` + o + `.xyz,
+ geometricNormalW,
+ viewDirectionW,
+ vClearCoatParams,
+ specularEnvironmentR0,
+ #ifdef CLEARCOAT_TEXTURE
+ vec2(0.),
+ #endif
+ #ifdef CLEARCOAT_TINT
+ vClearCoatTintParams,
+ ` + re + `,
+ vClearCoatRefractionParams,
+ #ifdef CLEARCOAT_TINT_TEXTURE
+ vec4(0.),
+ #endif
+ #endif
+ #ifdef CLEARCOAT_BUMP
+ vec2(0., 1.),
+ vec4(` + I + `, 0.),
+ ` + G + `,
+ #if defined(` + (s ? "TANGENT" : "IGNORE") + `) && defined(NORMAL)
+ vTBN,
+ #else
+ vClearCoatTangentSpaceParams,
+ #endif
+ #ifdef OBJECTSPACE_NORMALMAP
+ normalMatrix,
+ #endif
+ #endif
+ #if defined(FORCENORMALFORWARD) && defined(NORMAL)
+ faceNormal,
+ #endif
+ #ifdef REFLECTION
+ ` + (i == null ? void 0 : i._vReflectionMicrosurfaceInfosName) + `,
+ ` + (i == null ? void 0 : i._vReflectionInfosName) + `,
+ ` + (i == null ? void 0 : i.reflectionColor) + `,
+ vLightingIntensity,
+ #ifdef ` + (i == null ? void 0 : i._define3DName) + `
+ ` + (i == null ? void 0 : i._cubeSamplerName) + `,
+ #else
+ ` + (i == null ? void 0 : i._2DSamplerName) + `,
+ #endif
+ #ifndef LODBASEDMICROSFURACE
+ #ifdef ` + (i == null ? void 0 : i._define3DName) + `
+ ` + (i == null ? void 0 : i._cubeSamplerName) + `,
+ ` + (i == null ? void 0 : i._cubeSamplerName) + `,
+ #else
+ ` + (i == null ? void 0 : i._2DSamplerName) + `,
+ ` + (i == null ? void 0 : i._2DSamplerName) + `,
+ #endif
+ #endif
+ #endif
+ #if defined(ENVIRONMENTBRDF) && !defined(` + (i == null ? void 0 : i._defineSkyboxName) + `)
+ #ifdef RADIANCEOCCLUSION
+ ambientMonochrome,
+ #endif
+ #endif
+ clearcoatOut
+ );
+ #else
+ clearcoatOut.specularEnvironmentR0 = specularEnvironmentR0;
+ #endif\r
+`;
+ }, t.prototype._buildBlock = function(e) {
+ return this._scene = e.sharedData.scene, e.target === Me.Fragment && (e.sharedData.bindableBlocks.push(this), e.sharedData.blocksWithDefines.push(this)), this;
+ }, t.prototype._dumpPropertiesCode = function() {
+ var e = "";
+ return e += this._codeVariableName + ".remapF0OnInterfaceChange = " + this.remapF0OnInterfaceChange + `;\r
+`;
+ }, t.prototype.serialize = function() {
+ var e = r.prototype.serialize.call(this);
+ return e.remapF0OnInterfaceChange = this.remapF0OnInterfaceChange, e;
+ }, t.prototype._deserialize = function(e, n, i) {
+ var o;
+ r.prototype._deserialize.call(this, e, n, i), this.remapF0OnInterfaceChange = (o = e.remapF0OnInterfaceChange) === null || o === void 0 || o;
+ }, Object(u.c)([jt("Remap F0 on interface change", Ft.Boolean, "ADVANCED")], t.prototype, "remapF0OnInterfaceChange", void 0), t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.ClearCoatBlock"] = Js;
+ var yu = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Fragment) || this;
+ return n.linkRefractionWithTransparency = !1, n.invertRefractionY = !1, n._isUnique = !0, n.registerInput("intensity", fe.Float, !1, Me.Fragment), n.registerInput("tintAtDistance", fe.Float, !0, Me.Fragment), n.registerOutput("refraction", fe.Object, Me.Fragment, new di("refraction", n, Dn.Output, t, "RefractionBlock")), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "RefractionBlock";
+ }, Object.defineProperty(t.prototype, "intensity", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "tintAtDistance", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "view", { get: function() {
+ return this.viewConnectionPoint;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "refraction", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "hasTexture", { get: function() {
+ return !!this._getTexture();
+ }, enumerable: !1, configurable: !0 }), t.prototype._getTexture = function() {
+ return this.texture ? this.texture : this._scene.environmentTexture;
+ }, t.prototype.autoConfigure = function(e) {
+ if (!this.intensity.isConnected) {
+ var n = new At("Refraction intensity", Me.Fragment, fe.Float);
+ n.value = 1, n.output.connectTo(this.intensity);
+ }
+ if (this.view && !this.view.isConnected) {
+ var i = e.getInputBlockByPredicate(function(o) {
+ return o.systemValue === bt.View;
+ });
+ i || (i = new At("view")).setAsSystemValue(bt.View), i.output.connectTo(this.view);
+ }
+ }, t.prototype.prepareDefines = function(e, n, i) {
+ r.prototype.prepareDefines.call(this, e, n, i);
+ var o = this._getTexture(), a = o && o.getTextureMatrix;
+ i.setValue("SS_REFRACTION", a, !0), a && (i.setValue(this._define3DName, o.isCube, !0), i.setValue(this._defineLODRefractionAlpha, o.lodLevelInAlpha, !0), i.setValue(this._defineLinearSpecularRefraction, o.linearSpecularLOD, !0), i.setValue(this._defineOppositeZ, this._scene.useRightHandedSystem ? !o.invertZ : o.invertZ, !0), i.setValue("SS_LINKREFRACTIONTOTRANSPARENCY", this.linkRefractionWithTransparency, !0), i.setValue("SS_GAMMAREFRACTION", o.gammaSpace, !0), i.setValue("SS_RGBDREFRACTION", o.isRGBD, !0));
+ }, t.prototype.isReady = function() {
+ var e = this._getTexture();
+ return !(e && !e.isReadyOrNotBlocking());
+ }, t.prototype.bind = function(e, n, i, o) {
+ var a, s;
+ r.prototype.bind.call(this, e, n, i);
+ var p = this._getTexture();
+ if (p) {
+ p.isCube ? e.setTexture(this._cubeSamplerName, p) : e.setTexture(this._2DSamplerName, p), e.setMatrix(this._refractionMatrixName, p.getReflectionTextureMatrix());
+ var m = 1;
+ p.isCube || p.depth && (m = p.depth);
+ var S = (s = (a = this.indexOfRefractionConnectionPoint.connectInputBlock) === null || a === void 0 ? void 0 : a.value) !== null && s !== void 0 ? s : 1.5;
+ e.setFloat4(this._vRefractionInfosName, p.level, 1 / S, m, this.invertRefractionY ? -1 : 1), e.setFloat3(this._vRefractionMicrosurfaceInfosName, p.getSize().width, p.lodGenerationScale, p.lodGenerationOffset);
+ var O = p.getSize().width;
+ e.setFloat2(this._vRefractionFilteringInfoName, O, ee.a.Log2(O));
+ }
+ }, t.prototype.getCode = function(e) {
+ return e.sharedData.blockingBlocks.push(this), e.sharedData.textureBlocks.push(this), this._cubeSamplerName = e._getFreeVariableName(this.name + "CubeSampler"), e.samplers.push(this._cubeSamplerName), this._2DSamplerName = e._getFreeVariableName(this.name + "2DSampler"), e.samplers.push(this._2DSamplerName), this._define3DName = e._getFreeDefineName("SS_REFRACTIONMAP_3D"), e._samplerDeclaration += "#ifdef " + this._define3DName + `\r
+`, e._samplerDeclaration += "uniform samplerCube " + this._cubeSamplerName + `;\r
+`, e._samplerDeclaration += `#else\r
+`, e._samplerDeclaration += "uniform sampler2D " + this._2DSamplerName + `;\r
+`, e._samplerDeclaration += `#endif\r
+`, e.sharedData.blocksWithDefines.push(this), e.sharedData.bindableBlocks.push(this), this._defineLODRefractionAlpha = e._getFreeDefineName("SS_LODINREFRACTIONALPHA"), this._defineLinearSpecularRefraction = e._getFreeDefineName("SS_LINEARSPECULARREFRACTION"), this._defineOppositeZ = e._getFreeDefineName("SS_REFRACTIONMAP_OPPOSITEZ"), this._refractionMatrixName = e._getFreeVariableName("refractionMatrix"), e._emitUniformFromString(this._refractionMatrixName, "mat4"), e._emitFunction("sampleRefraction", `
+ #ifdef ` + this._define3DName + `
+ #define sampleRefraction(s, c) textureCube(s, c)
+ #else
+ #define sampleRefraction(s, c) texture2D(s, c)
+ #endif\r
+`, "//" + this.name), e._emitFunction("sampleRefractionLod", `
+ #ifdef ` + this._define3DName + `
+ #define sampleRefractionLod(s, c, l) textureCubeLodEXT(s, c, l)
+ #else
+ #define sampleRefractionLod(s, c, l) texture2DLodEXT(s, c, l)
+ #endif\r
+`, "//" + this.name), this._vRefractionMicrosurfaceInfosName = e._getFreeVariableName("vRefractionMicrosurfaceInfos"), e._emitUniformFromString(this._vRefractionMicrosurfaceInfosName, "vec3"), this._vRefractionInfosName = e._getFreeVariableName("vRefractionInfos"), e._emitUniformFromString(this._vRefractionInfosName, "vec4"), this._vRefractionFilteringInfoName = e._getFreeVariableName("vRefractionFilteringInfo"), e._emitUniformFromString(this._vRefractionFilteringInfoName, "vec2"), "";
+ }, t.prototype._buildBlock = function(e) {
+ return this._scene = e.sharedData.scene, this;
+ }, t.prototype._dumpPropertiesCode = function() {
+ var e = r.prototype._dumpPropertiesCode.call(this);
+ return this.texture && (e = this.texture.isCube ? this._codeVariableName + '.texture = new BABYLON.CubeTexture("' + this.texture.name + `");\r
+` : this._codeVariableName + '.texture = new BABYLON.Texture("' + this.texture.name + `");\r
+`, e += this._codeVariableName + ".texture.coordinatesMode = " + this.texture.coordinatesMode + `;\r
+`), e += this._codeVariableName + ".linkRefractionWithTransparency = " + this.linkRefractionWithTransparency + `;\r
+`, e += this._codeVariableName + ".invertRefractionY = " + this.invertRefractionY + `;\r
+`;
+ }, t.prototype.serialize = function() {
+ var e = r.prototype.serialize.call(this);
+ return this.texture && (e.texture = this.texture.serialize()), e.linkRefractionWithTransparency = this.linkRefractionWithTransparency, e.invertRefractionY = this.invertRefractionY, e;
+ }, t.prototype._deserialize = function(e, n, i) {
+ r.prototype._deserialize.call(this, e, n, i), e.texture && (i = e.texture.url.indexOf("data:") === 0 ? "" : i, e.texture.isCube ? this.texture = Pi.Parse(e.texture, n, i) : this.texture = Ue.a.Parse(e.texture, n, i)), this.linkRefractionWithTransparency = e.linkRefractionWithTransparency, this.invertRefractionY = e.invertRefractionY;
+ }, Object(u.c)([jt("Link refraction to transparency", Ft.Boolean, "ADVANCED", { notifiers: { update: !0 } })], t.prototype, "linkRefractionWithTransparency", void 0), Object(u.c)([jt("Invert refraction Y", Ft.Boolean, "ADVANCED", { notifiers: { update: !0 } })], t.prototype, "invertRefractionY", void 0), t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.RefractionBlock"] = yu;
+ var $s = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Fragment) || this;
+ return n._isUnique = !0, n.registerInput("thickness", fe.Float, !1, Me.Fragment), n.registerInput("tintColor", fe.Color3, !0, Me.Fragment), n.registerInput("translucencyIntensity", fe.Float, !0, Me.Fragment), n.registerInput("translucencyDiffusionDist", fe.Color3, !0, Me.Fragment), n.registerInput("refraction", fe.Object, !0, Me.Fragment, new di("refraction", n, Dn.Input, yu, "RefractionBlock")), n.registerOutput("subsurface", fe.Object, Me.Fragment, new di("subsurface", n, Dn.Output, t, "SubSurfaceBlock")), n;
+ }
+ return Object(u.d)(t, r), t.prototype.initialize = function(e) {
+ e._excludeVariableName("subSurfaceOut"), e._excludeVariableName("vThicknessParam"), e._excludeVariableName("vTintColor"), e._excludeVariableName("vSubSurfaceIntensity");
+ }, t.prototype.getClassName = function() {
+ return "SubSurfaceBlock";
+ }, Object.defineProperty(t.prototype, "thickness", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "tintColor", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "translucencyIntensity", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "translucencyDiffusionDist", { get: function() {
+ return this._inputs[3];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "refraction", { get: function() {
+ return this._inputs[4];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "subsurface", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype.autoConfigure = function(e) {
+ if (!this.thickness.isConnected) {
+ var n = new At("SubSurface thickness", Me.Fragment, fe.Float);
+ n.value = 0, n.output.connectTo(this.thickness);
+ }
+ }, t.prototype.prepareDefines = function(e, n, i) {
+ r.prototype.prepareDefines.call(this, e, n, i);
+ var o = this.translucencyDiffusionDist.isConnected || this.translucencyIntensity.isConnected;
+ i.setValue("SUBSURFACE", o || this.refraction.isConnected, !0), i.setValue("SS_TRANSLUCENCY", o, !0), i.setValue("SS_THICKNESSANDMASK_TEXTURE", !1, !0), i.setValue("SS_MASK_FROM_THICKNESS_TEXTURE", !1, !0), i.setValue("SS_MASK_FROM_THICKNESS_TEXTURE_GLTF", !1, !0);
+ }, t.GetCode = function(e, n, i, o) {
+ var a, s, p, m, S, O, I, G, k, K, re, se, ue, he, pe, ve, Ee = "", Ae = n != null && n.thickness.isConnected ? n.thickness.associatedVariableName : "0.", Ie = n != null && n.tintColor.isConnected ? n.tintColor.associatedVariableName : "vec3(1.)", xe = n != null && n.translucencyIntensity.isConnected ? n == null ? void 0 : n.translucencyIntensity.associatedVariableName : "1.", Pe = n != null && n.translucencyDiffusionDist.isConnected ? n == null ? void 0 : n.translucencyDiffusionDist.associatedVariableName : "vec3(1.)", Ce = n != null && n.refraction.isConnected ? (a = n == null ? void 0 : n.refraction.connectedPoint) === null || a === void 0 ? void 0 : a.ownerBlock : null, Fe = Ce != null && Ce.tintAtDistance.isConnected ? Ce.tintAtDistance.associatedVariableName : "1.", Oe = Ce != null && Ce.intensity.isConnected ? Ce.intensity.associatedVariableName : "1.", Be = Ce != null && Ce.view.isConnected ? Ce.view.associatedVariableName : "";
+ return Ee += (s = Ce == null ? void 0 : Ce.getCode(e)) !== null && s !== void 0 ? s : "", Ee += `subSurfaceOutParams subSurfaceOut;
+
+ #ifdef SUBSURFACE
+ vec2 vThicknessParam = vec2(0., ` + Ae + `);
+ vec4 vTintColor = vec4(` + Ie + ", " + Fe + `);
+ vec3 vSubSurfaceIntensity = vec3(` + Oe + ", " + xe + `, 0.);
+
+ subSurfaceBlock(
+ vSubSurfaceIntensity,
+ vThicknessParam,
+ vTintColor,
+ normalW,
+ specularEnvironmentReflectance,
+ #ifdef SS_THICKNESSANDMASK_TEXTURE
+ vec4(0.),
+ #endif
+ #ifdef REFLECTION
+ #ifdef SS_TRANSLUCENCY
+ ` + (i == null ? void 0 : i._reflectionMatrixName) + `,
+ #ifdef USESPHERICALFROMREFLECTIONMAP
+ #if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)
+ reflectionOut.irradianceVector,
+ #endif
+ #if defined(REALTIME_FILTERING)
+ ` + (i == null ? void 0 : i._cubeSamplerName) + `,
+ ` + (i == null ? void 0 : i._vReflectionFilteringInfoName) + `,
+ #endif
+ #endif
+ #ifdef USEIRRADIANCEMAP
+ irradianceSampler,
+ #endif
+ #endif
+ #endif
+ #ifdef SS_REFRACTION
+ ` + o + `.xyz,
+ viewDirectionW,
+ ` + Be + `,
+ surfaceAlbedo,
+ ` + ((p = Ce == null ? void 0 : Ce._vRefractionInfosName) !== null && p !== void 0 ? p : "") + `,
+ ` + ((m = Ce == null ? void 0 : Ce._refractionMatrixName) !== null && m !== void 0 ? m : "") + `,
+ ` + ((S = Ce == null ? void 0 : Ce._vRefractionMicrosurfaceInfosName) !== null && S !== void 0 ? S : "") + `,
+ vLightingIntensity,
+ #ifdef SS_LINKREFRACTIONTOTRANSPARENCY
+ alpha,
+ #endif
+ #ifdef ` + ((O = Ce == null ? void 0 : Ce._defineLODRefractionAlpha) !== null && O !== void 0 ? O : "IGNORE") + `
+ NdotVUnclamped,
+ #endif
+ #ifdef ` + ((I = Ce == null ? void 0 : Ce._defineLinearSpecularRefraction) !== null && I !== void 0 ? I : "IGNORE") + `
+ roughness,
+ #else
+ alphaG,
+ #endif
+ #ifdef ` + ((G = Ce == null ? void 0 : Ce._define3DName) !== null && G !== void 0 ? G : "IGNORE") + `
+ ` + ((k = Ce == null ? void 0 : Ce._cubeSamplerName) !== null && k !== void 0 ? k : "") + `,
+ #else
+ ` + ((K = Ce == null ? void 0 : Ce._2DSamplerName) !== null && K !== void 0 ? K : "") + `,
+ #endif
+ #ifndef LODBASEDMICROSFURACE
+ #ifdef ` + ((re = Ce == null ? void 0 : Ce._define3DName) !== null && re !== void 0 ? re : "IGNORE") + `
+ ` + ((se = Ce == null ? void 0 : Ce._cubeSamplerName) !== null && se !== void 0 ? se : "") + `,
+ ` + ((ue = Ce == null ? void 0 : Ce._cubeSamplerName) !== null && ue !== void 0 ? ue : "") + `,
+ #else
+ ` + ((he = Ce == null ? void 0 : Ce._2DSamplerName) !== null && he !== void 0 ? he : "") + `,
+ ` + ((pe = Ce == null ? void 0 : Ce._2DSamplerName) !== null && pe !== void 0 ? pe : "") + `,
+ #endif
+ #endif
+ #ifdef ANISOTROPIC
+ anisotropicOut,
+ #endif
+ #ifdef REALTIME_FILTERING
+ ` + ((ve = Ce == null ? void 0 : Ce._vRefractionFilteringInfoName) !== null && ve !== void 0 ? ve : "") + `,
+ #endif
+ #endif
+ #ifdef SS_TRANSLUCENCY
+ ` + Pe + `,
+ #endif
+ subSurfaceOut
+ );
+
+ #ifdef SS_REFRACTION
+ surfaceAlbedo = subSurfaceOut.surfaceAlbedo;
+ #ifdef SS_LINKREFRACTIONTOTRANSPARENCY
+ alpha = subSurfaceOut.alpha;
+ #endif
+ #endif
+ #else
+ subSurfaceOut.specularEnvironmentReflectance = specularEnvironmentReflectance;
+ #endif\r
+`;
+ }, t.prototype._buildBlock = function(e) {
+ return e.target === Me.Fragment && e.sharedData.blocksWithDefines.push(this), this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.SubSurfaceBlock"] = $s;
+ var R0 = { ambientClr: ["finalAmbient", ""], diffuseDir: ["finalDiffuse", ""], specularDir: ["finalSpecularScaled", "!defined(UNLIT) && defined(SPECULARTERM)"], clearcoatDir: ["finalClearCoatScaled", "!defined(UNLIT) && defined(CLEARCOAT)"], sheenDir: ["finalSheenScaled", "!defined(UNLIT) && defined(SHEEN)"], diffuseInd: ["finalIrradiance", "!defined(UNLIT) && defined(REFLECTION)"], specularInd: ["finalRadianceScaled", "!defined(UNLIT) && defined(REFLECTION)"], clearcoatInd: ["clearcoatOut.finalClearCoatRadianceScaled", "!defined(UNLIT) && defined(REFLECTION) && defined(CLEARCOAT)"], sheenInd: ["sheenOut.finalSheenRadianceScaled", "!defined(UNLIT) && defined(REFLECTION) && defined(SHEEN) && defined(ENVIRONMENTBRDF)"], refraction: ["subSurfaceOut.finalRefraction", "!defined(UNLIT) && defined(SS_REFRACTION)"], lighting: ["finalColor.rgb", ""], shadow: ["shadow", ""], alpha: ["alpha", ""] }, u_ = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.VertexAndFragment) || this;
+ return n._environmentBRDFTexture = null, n._metallicReflectanceColor = C.a.White(), n._metallicF0Factor = 1, n.directIntensity = 1, n.environmentIntensity = 1, n.specularIntensity = 1, n.lightFalloff = 0, n.useAlphaTest = !1, n.alphaTestCutoff = 0.5, n.useAlphaBlending = !1, n.useRadianceOverAlpha = !0, n.useSpecularOverAlpha = !0, n.enableSpecularAntiAliasing = !1, n.realTimeFiltering = !1, n.realTimeFilteringQuality = d.a.TEXTURE_FILTERING_QUALITY_LOW, n.useEnergyConservation = !0, n.useRadianceOcclusion = !0, n.useHorizonOcclusion = !0, n.unlit = !1, n.forceNormalForward = !1, n.debugMode = 0, n.debugLimit = 0, n.debugFactor = 1, n._isUnique = !0, n.registerInput("worldPosition", fe.Vector4, !1, Me.Vertex), n.registerInput("worldNormal", fe.Vector4, !1, Me.Fragment), n.registerInput("view", fe.Matrix, !1), n.registerInput("cameraPosition", fe.Vector3, !1, Me.Fragment), n.registerInput("perturbedNormal", fe.Vector4, !0, Me.Fragment), n.registerInput("baseColor", fe.Color3, !0, Me.Fragment), n.registerInput("metallic", fe.Float, !1, Me.Fragment), n.registerInput("roughness", fe.Float, !1, Me.Fragment), n.registerInput("ambientOcc", fe.Float, !0, Me.Fragment), n.registerInput("opacity", fe.Float, !0, Me.Fragment), n.registerInput("indexOfRefraction", fe.Float, !0, Me.Fragment), n.registerInput("ambientColor", fe.Color3, !0, Me.Fragment), n.registerInput("reflection", fe.Object, !0, Me.Fragment, new di("reflection", n, Dn.Input, bu, "ReflectionBlock")), n.registerInput("clearcoat", fe.Object, !0, Me.Fragment, new di("clearcoat", n, Dn.Input, Js, "ClearCoatBlock")), n.registerInput("sheen", fe.Object, !0, Me.Fragment, new di("sheen", n, Dn.Input, gu, "SheenBlock")), n.registerInput("subsurface", fe.Object, !0, Me.Fragment, new di("subsurface", n, Dn.Input, $s, "SubSurfaceBlock")), n.registerInput("anisotropy", fe.Object, !0, Me.Fragment, new di("anisotropy", n, Dn.Input, vu, "AnisotropyBlock")), n.registerOutput("ambientClr", fe.Color3, Me.Fragment), n.registerOutput("diffuseDir", fe.Color3, Me.Fragment), n.registerOutput("specularDir", fe.Color3, Me.Fragment), n.registerOutput("clearcoatDir", fe.Color3, Me.Fragment), n.registerOutput("sheenDir", fe.Color3, Me.Fragment), n.registerOutput("diffuseInd", fe.Color3, Me.Fragment), n.registerOutput("specularInd", fe.Color3, Me.Fragment), n.registerOutput("clearcoatInd", fe.Color3, Me.Fragment), n.registerOutput("sheenInd", fe.Color3, Me.Fragment), n.registerOutput("refraction", fe.Color3, Me.Fragment), n.registerOutput("lighting", fe.Color3, Me.Fragment), n.registerOutput("shadow", fe.Float, Me.Fragment), n.registerOutput("alpha", fe.Float, Me.Fragment), n;
+ }
+ return Object(u.d)(t, r), t.prototype.initialize = function(e) {
+ e._excludeVariableName("vLightingIntensity"), e._excludeVariableName("geometricNormalW"), e._excludeVariableName("normalW"), e._excludeVariableName("faceNormal"), e._excludeVariableName("albedoOpacityOut"), e._excludeVariableName("surfaceAlbedo"), e._excludeVariableName("alpha"), e._excludeVariableName("aoOut"), e._excludeVariableName("baseColor"), e._excludeVariableName("reflectivityOut"), e._excludeVariableName("microSurface"), e._excludeVariableName("roughness"), e._excludeVariableName("NdotVUnclamped"), e._excludeVariableName("NdotV"), e._excludeVariableName("alphaG"), e._excludeVariableName("AARoughnessFactors"), e._excludeVariableName("environmentBrdf"), e._excludeVariableName("ambientMonochrome"), e._excludeVariableName("seo"), e._excludeVariableName("eho"), e._excludeVariableName("environmentRadiance"), e._excludeVariableName("irradianceVector"), e._excludeVariableName("environmentIrradiance"), e._excludeVariableName("diffuseBase"), e._excludeVariableName("specularBase"), e._excludeVariableName("preInfo"), e._excludeVariableName("info"), e._excludeVariableName("shadow"), e._excludeVariableName("finalDiffuse"), e._excludeVariableName("finalAmbient"), e._excludeVariableName("ambientOcclusionForDirectDiffuse"), e._excludeVariableName("finalColor"), e._excludeVariableName("vClipSpacePosition"), e._excludeVariableName("vDebugMode");
+ }, t.prototype.getClassName = function() {
+ return "PBRMetallicRoughnessBlock";
+ }, Object.defineProperty(t.prototype, "worldPosition", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "worldNormal", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "view", { get: function() {
+ return this._inputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "cameraPosition", { get: function() {
+ return this._inputs[3];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "perturbedNormal", { get: function() {
+ return this._inputs[4];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "baseColor", { get: function() {
+ return this._inputs[5];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "metallic", { get: function() {
+ return this._inputs[6];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "roughness", { get: function() {
+ return this._inputs[7];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "ambientOcc", { get: function() {
+ return this._inputs[8];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "opacity", { get: function() {
+ return this._inputs[9];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "indexOfRefraction", { get: function() {
+ return this._inputs[10];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "ambientColor", { get: function() {
+ return this._inputs[11];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "reflection", { get: function() {
+ return this._inputs[12];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "clearcoat", { get: function() {
+ return this._inputs[13];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "sheen", { get: function() {
+ return this._inputs[14];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "subsurface", { get: function() {
+ return this._inputs[15];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "anisotropy", { get: function() {
+ return this._inputs[16];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "ambientClr", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "diffuseDir", { get: function() {
+ return this._outputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "specularDir", { get: function() {
+ return this._outputs[2];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "clearcoatDir", { get: function() {
+ return this._outputs[3];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "sheenDir", { get: function() {
+ return this._outputs[4];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "diffuseIndirect", { get: function() {
+ return this._outputs[5];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "specularIndirect", { get: function() {
+ return this._outputs[6];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "clearcoatIndirect", { get: function() {
+ return this._outputs[7];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "sheenIndirect", { get: function() {
+ return this._outputs[8];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "refraction", { get: function() {
+ return this._outputs[9];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "lighting", { get: function() {
+ return this._outputs[10];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "shadow", { get: function() {
+ return this._outputs[11];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "alpha", { get: function() {
+ return this._outputs[12];
+ }, enumerable: !1, configurable: !0 }), t.prototype.autoConfigure = function(e) {
+ if (!this.cameraPosition.isConnected) {
+ var n = e.getInputBlockByPredicate(function(o) {
+ return o.systemValue === bt.CameraPosition;
+ });
+ n || (n = new At("cameraPosition")).setAsSystemValue(bt.CameraPosition), n.output.connectTo(this.cameraPosition);
+ }
+ if (!this.view.isConnected) {
+ var i = e.getInputBlockByPredicate(function(o) {
+ return o.systemValue === bt.View;
+ });
+ i || (i = new At("view")).setAsSystemValue(bt.View), i.output.connectTo(this.view);
+ }
+ }, t.prototype.prepareDefines = function(e, n, i) {
+ i.setValue("PBR", !0), i.setValue("METALLICWORKFLOW", !0), i.setValue("DEBUGMODE", this.debugMode, !0), i.setValue("NORMALXYSCALE", !0), i.setValue("BUMP", this.perturbedNormal.isConnected, !0), i.setValue("LODBASEDMICROSFURACE", this._scene.getEngine().getCaps().textureLOD), i.setValue("ALBEDO", !1, !0), i.setValue("OPACITY", this.opacity.isConnected, !0), i.setValue("AMBIENT", !0, !0), i.setValue("AMBIENTINGRAYSCALE", !1, !0), i.setValue("REFLECTIVITY", !1, !0), i.setValue("AOSTOREINMETALMAPRED", !1, !0), i.setValue("METALLNESSSTOREINMETALMAPBLUE", !1, !0), i.setValue("ROUGHNESSSTOREINMETALMAPALPHA", !1, !0), i.setValue("ROUGHNESSSTOREINMETALMAPGREEN", !1, !0), this.lightFalloff === Cn.LIGHTFALLOFF_STANDARD ? (i.setValue("USEPHYSICALLIGHTFALLOFF", !1), i.setValue("USEGLTFLIGHTFALLOFF", !1)) : this.lightFalloff === Cn.LIGHTFALLOFF_GLTF ? (i.setValue("USEPHYSICALLIGHTFALLOFF", !1), i.setValue("USEGLTFLIGHTFALLOFF", !0)) : (i.setValue("USEPHYSICALLIGHTFALLOFF", !0), i.setValue("USEGLTFLIGHTFALLOFF", !1));
+ var o = this.alphaTestCutoff.toString();
+ if (i.setValue("ALPHABLEND", this.useAlphaBlending, !0), i.setValue("ALPHAFROMALBEDO", !1, !0), i.setValue("ALPHATEST", this.useAlphaTest, !0), i.setValue("ALPHATESTVALUE", o.indexOf(".") < 0 ? o + "." : o, !0), i.setValue("OPACITYRGB", !1, !0), i.setValue("RADIANCEOVERALPHA", this.useRadianceOverAlpha, !0), i.setValue("SPECULAROVERALPHA", this.useSpecularOverAlpha, !0), i.setValue("SPECULARAA", this._scene.getEngine().getCaps().standardDerivatives && this.enableSpecularAntiAliasing, !0), i.setValue("REALTIME_FILTERING", this.realTimeFiltering, !0), this._scene.getEngine().webGLVersion > 1 ? i.setValue("NUM_SAMPLES", this.realTimeFilteringQuality + "u", !0) : i.setValue("NUM_SAMPLES", "" + this.realTimeFilteringQuality, !0), i.setValue("BRDF_V_HEIGHT_CORRELATED", !0), i.setValue("MS_BRDF_ENERGY_CONSERVATION", this.useEnergyConservation, !0), i.setValue("RADIANCEOCCLUSION", this.useRadianceOcclusion, !0), i.setValue("HORIZONOCCLUSION", this.useHorizonOcclusion, !0), i.setValue("UNLIT", this.unlit, !0), i.setValue("FORCENORMALFORWARD", this.forceNormalForward, !0), this._environmentBRDFTexture && ht.a.ReflectionTextureEnabled ? (i.setValue("ENVIRONMENTBRDF", !0), i.setValue("ENVIRONMENTBRDF_RGBD", this._environmentBRDFTexture.isRGBD, !0)) : (i.setValue("ENVIRONMENTBRDF", !1), i.setValue("ENVIRONMENTBRDF_RGBD", !1)), i._areLightsDirty) {
+ var a = e.getScene();
+ if (this.light) {
+ var s = { needNormals: !1, needRebuild: !1, lightmapMode: !1, shadowEnabled: !1, specularEnabled: !1 };
+ tt.a.PrepareDefinesForLight(a, e, this.light, this._lightId, i, !0, s), s.needRebuild && i.rebuild();
+ } else
+ tt.a.PrepareDefinesForLights(a, e, i, !0, n.maxSimultaneousLights), i._needNormals = !0, tt.a.PrepareDefinesForMultiview(a, i);
+ }
+ }, t.prototype.updateUniformsAndSamples = function(e, n, i, o) {
+ for (var a = 0; a < n.maxSimultaneousLights && i["LIGHT" + a]; a++) {
+ var s = e.uniforms.indexOf("vLightData" + a) >= 0;
+ tt.a.PrepareUniformsAndSamplersForLight(a, e.uniforms, e.samplers, i["PROJECTEDLIGHTTEXTURE" + a], o, s);
+ }
+ }, t.prototype.bind = function(e, n, i) {
+ var o, a;
+ if (i) {
+ var s = i.getScene();
+ this.light ? tt.a.BindLight(this.light, this._lightId, s, e, !0) : tt.a.BindLights(s, i, e, !0, n.maxSimultaneousLights), e.setTexture(this._environmentBrdfSamplerName, this._environmentBRDFTexture), e.setFloat2("vDebugMode", this.debugLimit, this.debugFactor);
+ var p = this._scene.ambientColor;
+ p && e.setColor3("ambientFromScene", p);
+ var m = s.useRightHandedSystem === (s._mirroredCameraPosition != null);
+ e.setFloat(this._invertNormalName, m ? -1 : 1), e.setFloat4("vLightingIntensity", this.directIntensity, 1, this.environmentIntensity * this._scene.environmentIntensity, this.specularIntensity);
+ var S = (a = (o = this.indexOfRefraction.connectInputBlock) === null || o === void 0 ? void 0 : o.value) !== null && a !== void 0 ? a : 1.5, O = Math.pow((S - 1) / (S + 1), 2);
+ this._metallicReflectanceColor.scaleToRef(O * this._metallicF0Factor, C.c.Color3[0]);
+ var I = this._metallicF0Factor;
+ e.setColor4(this._vMetallicReflectanceFactorsName, C.c.Color3[0], I);
+ }
+ }, t.prototype._injectVertexCode = function(e) {
+ var n, i, o = this.worldPosition, a = "//" + this.name;
+ this.light ? (this._lightId = (e.counters.lightCounter !== void 0 ? e.counters.lightCounter : -1) + 1, e.counters.lightCounter = this._lightId, e._emitFunctionFromInclude(e.supportUniformBuffers ? "lightUboDeclaration" : "lightFragmentDeclaration", a, { replaceStrings: [{ search: /{X}/g, replace: this._lightId.toString() }] }, this._lightId.toString())) : (e._emitFunctionFromInclude(e.supportUniformBuffers ? "lightUboDeclaration" : "lightFragmentDeclaration", a, { repeatKey: "maxSimultaneousLights" }), this._lightId = 0, e.sharedData.dynamicUniformBlocks.push(this));
+ var s = "v_" + o.associatedVariableName;
+ e._emitVaryingFromString(s, "vec4") && (e.compilationString += s + " = " + o.associatedVariableName + `;\r
+`);
+ var p = this.reflection.isConnected ? (n = this.reflection.connectedPoint) === null || n === void 0 ? void 0 : n.ownerBlock : null;
+ p && (p.viewConnectionPoint = this.view), e.compilationString += (i = p == null ? void 0 : p.handleVertexSide(e)) !== null && i !== void 0 ? i : "", e._emitUniformFromString("vDebugMode", "vec2", "defined(IGNORE) || DEBUGMODE > 0"), e._emitUniformFromString("ambientFromScene", "vec3"), e._emitVaryingFromString("vClipSpacePosition", "vec4", "defined(IGNORE) || DEBUGMODE > 0") && (e._injectAtEnd += `#if DEBUGMODE > 0\r
+`, e._injectAtEnd += `vClipSpacePosition = gl_Position;\r
+`, e._injectAtEnd += `#endif\r
+`), this.light ? e.compilationString += e._emitCodeFromInclude("shadowsVertex", a, { replaceStrings: [{ search: /{X}/g, replace: this._lightId.toString() }, { search: /worldPos/g, replace: o.associatedVariableName }] }) : (e.compilationString += "vec4 worldPos = " + o.associatedVariableName + `;\r
+`, this.view.isConnected && (e.compilationString += "mat4 view = " + this.view.associatedVariableName + `;\r
+`), e.compilationString += e._emitCodeFromInclude("shadowsVertex", a, { repeatKey: "maxSimultaneousLights" }));
+ }, t.prototype._getAlbedoOpacityCode = function() {
+ var e = `albedoOpacityOutParams albedoOpacityOut;\r
+`;
+ return e += `albedoOpacityBlock(
+ vec4(` + (this.baseColor.isConnected ? this.baseColor.associatedVariableName : "vec3(1.)") + `, 1.),
+ #ifdef ALBEDO
+ vec4(1.),
+ vec2(1., 1.),
+ #endif
+ #ifdef OPACITY
+ vec4(` + (this.opacity.isConnected ? this.opacity.associatedVariableName : "1.") + `),
+ vec2(1., 1.),
+ #endif
+ albedoOpacityOut
+ );
+
+ vec3 surfaceAlbedo = albedoOpacityOut.surfaceAlbedo;
+ float alpha = albedoOpacityOut.alpha;\r
+`;
+ }, t.prototype._getAmbientOcclusionCode = function() {
+ var e = `ambientOcclusionOutParams aoOut;\r
+`;
+ return e += `ambientOcclusionBlock(
+ #ifdef AMBIENT
+ vec3(` + (this.ambientOcc.isConnected ? this.ambientOcc.associatedVariableName : "1.") + `),
+ vec4(0., 1.0, 1.0, 0.),
+ #endif
+ aoOut
+ );\r
+`;
+ }, t.prototype._getReflectivityCode = function(e) {
+ var n = `reflectivityOutParams reflectivityOut;\r
+`;
+ return this._vMetallicReflectanceFactorsName = e._getFreeVariableName("vMetallicReflectanceFactors"), e._emitUniformFromString(this._vMetallicReflectanceFactorsName, "vec4"), n += `vec3 baseColor = surfaceAlbedo;
+
+ reflectivityBlock(
+ vec4(` + this.metallic.associatedVariableName + ", " + this.roughness.associatedVariableName + `, 0., 0.),
+ #ifdef METALLICWORKFLOW
+ surfaceAlbedo,
+ ` + this._vMetallicReflectanceFactorsName + `,
+ #endif
+ #ifdef REFLECTIVITY
+ vec3(0., 0., 1.),
+ vec4(1.),
+ #endif
+ #if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)
+ aoOut.ambientOcclusionColor,
+ #endif
+ #ifdef MICROSURFACEMAP
+ microSurfaceTexel, <== not handled!
+ #endif
+ reflectivityOut
+ );
+
+ float microSurface = reflectivityOut.microSurface;
+ float roughness = reflectivityOut.roughness;
+
+ #ifdef METALLICWORKFLOW
+ surfaceAlbedo = reflectivityOut.surfaceAlbedo;
+ #endif
+ #if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)
+ aoOut.ambientOcclusionColor = reflectivityOut.ambientOcclusionColor;
+ #endif\r
+`;
+ }, t.prototype._buildBlock = function(e) {
+ var n, i, o, a, s, p, m, S, O, I, G, k, K, re, se, ue, he, pe, ve, Ee, Ae, Ie, xe, Pe, Ce, Fe, Oe, Be, Le, Ve, Qe, nt, rt, ut, qe, at, ot, Je, dt;
+ r.prototype._buildBlock.call(this, e), this._scene = e.sharedData.scene, this._environmentBRDFTexture || (this._environmentBRDFTexture = Ls.GetEnvironmentBRDFTexture(this._scene));
+ var Ge = this.reflection.isConnected ? (n = this.reflection.connectedPoint) === null || n === void 0 ? void 0 : n.ownerBlock : null;
+ if (Ge && (Ge.worldPositionConnectionPoint = this.worldPosition, Ge.cameraPositionConnectionPoint = this.cameraPosition, Ge.worldNormalConnectionPoint = this.worldNormal), e.target !== Me.Fragment)
+ return this._injectVertexCode(e), this;
+ e.sharedData.bindableBlocks.push(this), e.sharedData.blocksWithDefines.push(this);
+ var $e = "//" + this.name, yt = "v_" + this.worldPosition.associatedVariableName, Jt = this.perturbedNormal;
+ this._environmentBrdfSamplerName = e._getFreeVariableName("environmentBrdfSampler"), e._emit2DSampler(this._environmentBrdfSamplerName), e.sharedData.hints.needAlphaBlending = e.sharedData.hints.needAlphaBlending || this.useAlphaBlending, e.sharedData.hints.needAlphaTesting = e.sharedData.hints.needAlphaTesting || this.useAlphaTest, e._emitExtension("lod", "#extension GL_EXT_shader_texture_lod : enable", "defined(LODBASEDMICROSFURACE)"), e._emitExtension("derivatives", "#extension GL_OES_standard_derivatives : enable"), this.light ? e._emitFunctionFromInclude(e.supportUniformBuffers ? "lightUboDeclaration" : "lightFragmentDeclaration", $e, { replaceStrings: [{ search: /{X}/g, replace: this._lightId.toString() }] }, this._lightId.toString()) : e._emitFunctionFromInclude(e.supportUniformBuffers ? "lightUboDeclaration" : "lightFragmentDeclaration", $e, { repeatKey: "maxSimultaneousLights" }), e._emitFunctionFromInclude("helperFunctions", $e), e._emitFunctionFromInclude("importanceSampling", $e), e._emitFunctionFromInclude("pbrHelperFunctions", $e), e._emitFunctionFromInclude("imageProcessingFunctions", $e), e._emitFunctionFromInclude("shadowsFragmentFunctions", $e, { replaceStrings: [{ search: /vPositionW/g, replace: yt + ".xyz" }] }), e._emitFunctionFromInclude("pbrDirectLightingSetupFunctions", $e, { replaceStrings: [{ search: /vPositionW/g, replace: yt + ".xyz" }] }), e._emitFunctionFromInclude("pbrDirectLightingFalloffFunctions", $e), e._emitFunctionFromInclude("pbrBRDFFunctions", $e, { replaceStrings: [{ search: /REFLECTIONMAP_SKYBOX/g, replace: (i = Ge == null ? void 0 : Ge._defineSkyboxName) !== null && i !== void 0 ? i : "REFLECTIONMAP_SKYBOX" }] }), e._emitFunctionFromInclude("hdrFilteringFunctions", $e), e._emitFunctionFromInclude("pbrDirectLightingFunctions", $e, { replaceStrings: [{ search: /vPositionW/g, replace: yt + ".xyz" }] }), e._emitFunctionFromInclude("pbrIBLFunctions", $e), e._emitFunctionFromInclude("pbrBlockAlbedoOpacity", $e), e._emitFunctionFromInclude("pbrBlockReflectivity", $e), e._emitFunctionFromInclude("pbrBlockAmbientOcclusion", $e), e._emitFunctionFromInclude("pbrBlockAlphaFresnel", $e), e._emitFunctionFromInclude("pbrBlockAnisotropic", $e), e._emitUniformFromString("vLightingIntensity", "vec4"), this._vNormalWName = e._getFreeVariableName("vNormalW"), e.compilationString += "vec4 " + this._vNormalWName + " = normalize(" + this.worldNormal.associatedVariableName + `);\r
+`, e._registerTempVariable("viewDirectionW") && (e.compilationString += "vec3 viewDirectionW = normalize(" + this.cameraPosition.associatedVariableName + " - " + yt + `.xyz);\r
+`), e.compilationString += "vec3 geometricNormalW = " + this._vNormalWName + `.xyz;\r
+`, e.compilationString += "vec3 normalW = " + (Jt.isConnected ? "normalize(" + Jt.associatedVariableName + ".xyz)" : "geometricNormalW") + `;\r
+`, this._invertNormalName = e._getFreeVariableName("invertNormal"), e._emitUniformFromString(this._invertNormalName, "float"), e.compilationString += e._emitCodeFromInclude("pbrBlockNormalFinal", $e, { replaceStrings: [{ search: /vPositionW/g, replace: yt + ".xyz" }, { search: /vEyePosition.w/g, replace: this._invertNormalName }] }), e.compilationString += this._getAlbedoOpacityCode(), e.compilationString += e._emitCodeFromInclude("depthPrePass", $e), e.compilationString += this._getAmbientOcclusionCode(), e.compilationString += e._emitCodeFromInclude("pbrBlockLightmapInit", $e), e.compilationString += `#ifdef UNLIT
+ vec3 diffuseBase = vec3(1., 1., 1.);
+ #else\r
+`, e.compilationString += this._getReflectivityCode(e), e.compilationString += e._emitCodeFromInclude("pbrBlockGeometryInfo", $e, { replaceStrings: [{ search: /REFLECTIONMAP_SKYBOX/g, replace: (o = Ge == null ? void 0 : Ge._defineSkyboxName) !== null && o !== void 0 ? o : "REFLECTIONMAP_SKYBOX" }, { search: /REFLECTIONMAP_3D/g, replace: (a = Ge == null ? void 0 : Ge._define3DName) !== null && a !== void 0 ? a : "REFLECTIONMAP_3D" }] });
+ var Bt = this.anisotropy.isConnected ? (s = this.anisotropy.connectedPoint) === null || s === void 0 ? void 0 : s.ownerBlock : null;
+ Bt && (Bt.worldPositionConnectionPoint = this.worldPosition, Bt.worldNormalConnectionPoint = this.worldNormal, e.compilationString += Bt.getCode(e, !this.perturbedNormal.isConnected)), Ge && Ge.hasTexture && (e.compilationString += Ge.getCode(e, Bt ? "anisotropicOut.anisotropicNormal" : "normalW")), e._emitFunctionFromInclude("pbrBlockReflection", $e, { replaceStrings: [{ search: /computeReflectionCoords/g, replace: "computeReflectionCoordsPBR" }, { search: /REFLECTIONMAP_3D/g, replace: (p = Ge == null ? void 0 : Ge._define3DName) !== null && p !== void 0 ? p : "REFLECTIONMAP_3D" }, { search: /REFLECTIONMAP_OPPOSITEZ/g, replace: (m = Ge == null ? void 0 : Ge._defineOppositeZ) !== null && m !== void 0 ? m : "REFLECTIONMAP_OPPOSITEZ" }, { search: /REFLECTIONMAP_PROJECTION/g, replace: (S = Ge == null ? void 0 : Ge._defineProjectionName) !== null && S !== void 0 ? S : "REFLECTIONMAP_PROJECTION" }, { search: /REFLECTIONMAP_SKYBOX/g, replace: (O = Ge == null ? void 0 : Ge._defineSkyboxName) !== null && O !== void 0 ? O : "REFLECTIONMAP_SKYBOX" }, { search: /LODINREFLECTIONALPHA/g, replace: (I = Ge == null ? void 0 : Ge._defineLODReflectionAlpha) !== null && I !== void 0 ? I : "LODINREFLECTIONALPHA" }, { search: /LINEARSPECULARREFLECTION/g, replace: (G = Ge == null ? void 0 : Ge._defineLinearSpecularReflection) !== null && G !== void 0 ? G : "LINEARSPECULARREFLECTION" }, { search: /vReflectionFilteringInfo/g, replace: (k = Ge == null ? void 0 : Ge._vReflectionFilteringInfoName) !== null && k !== void 0 ? k : "vReflectionFilteringInfo" }] }), e.compilationString += e._emitCodeFromInclude("pbrBlockReflectance0", $e, { replaceStrings: [{ search: /metallicReflectanceFactors/g, replace: this._vMetallicReflectanceFactorsName }] });
+ var rn = this.sheen.isConnected ? (K = this.sheen.connectedPoint) === null || K === void 0 ? void 0 : K.ownerBlock : null;
+ rn && (e.compilationString += rn.getCode(Ge)), e._emitFunctionFromInclude("pbrBlockSheen", $e, { replaceStrings: [{ search: /REFLECTIONMAP_3D/g, replace: (re = Ge == null ? void 0 : Ge._define3DName) !== null && re !== void 0 ? re : "REFLECTIONMAP_3D" }, { search: /REFLECTIONMAP_SKYBOX/g, replace: (se = Ge == null ? void 0 : Ge._defineSkyboxName) !== null && se !== void 0 ? se : "REFLECTIONMAP_SKYBOX" }, { search: /LODINREFLECTIONALPHA/g, replace: (ue = Ge == null ? void 0 : Ge._defineLODReflectionAlpha) !== null && ue !== void 0 ? ue : "LODINREFLECTIONALPHA" }, { search: /LINEARSPECULARREFLECTION/g, replace: (he = Ge == null ? void 0 : Ge._defineLinearSpecularReflection) !== null && he !== void 0 ? he : "LINEARSPECULARREFLECTION" }] });
+ var vt = this.clearcoat.isConnected ? (pe = this.clearcoat.connectedPoint) === null || pe === void 0 ? void 0 : pe.ownerBlock : null, sn = !this.perturbedNormal.isConnected && !this.anisotropy.isConnected, $t = this.perturbedNormal.isConnected && ((ve = this.perturbedNormal.connectedPoint) === null || ve === void 0 ? void 0 : ve.ownerBlock).worldTangent.isConnected, Qt = this.anisotropy.isConnected && ((Ee = this.anisotropy.connectedPoint) === null || Ee === void 0 ? void 0 : Ee.ownerBlock).worldTangent.isConnected, en = $t || !this.perturbedNormal.isConnected && Qt;
+ e.compilationString += Js.GetCode(e, vt, Ge, yt, sn, en, this.worldNormal.associatedVariableName), sn && (en = (Ae = vt == null ? void 0 : vt.worldTangent.isConnected) !== null && Ae !== void 0 && Ae), e._emitFunctionFromInclude("pbrBlockClearcoat", $e, { replaceStrings: [{ search: /computeReflectionCoords/g, replace: "computeReflectionCoordsPBR" }, { search: /REFLECTIONMAP_3D/g, replace: (Ie = Ge == null ? void 0 : Ge._define3DName) !== null && Ie !== void 0 ? Ie : "REFLECTIONMAP_3D" }, { search: /REFLECTIONMAP_OPPOSITEZ/g, replace: (xe = Ge == null ? void 0 : Ge._defineOppositeZ) !== null && xe !== void 0 ? xe : "REFLECTIONMAP_OPPOSITEZ" }, { search: /REFLECTIONMAP_PROJECTION/g, replace: (Pe = Ge == null ? void 0 : Ge._defineProjectionName) !== null && Pe !== void 0 ? Pe : "REFLECTIONMAP_PROJECTION" }, { search: /REFLECTIONMAP_SKYBOX/g, replace: (Ce = Ge == null ? void 0 : Ge._defineSkyboxName) !== null && Ce !== void 0 ? Ce : "REFLECTIONMAP_SKYBOX" }, { search: /LODINREFLECTIONALPHA/g, replace: (Fe = Ge == null ? void 0 : Ge._defineLODReflectionAlpha) !== null && Fe !== void 0 ? Fe : "LODINREFLECTIONALPHA" }, { search: /LINEARSPECULARREFLECTION/g, replace: (Oe = Ge == null ? void 0 : Ge._defineLinearSpecularReflection) !== null && Oe !== void 0 ? Oe : "LINEARSPECULARREFLECTION" }, { search: /defined\(TANGENT\)/g, replace: en ? "defined(TANGENT)" : "defined(IGNORE)" }] }), e.compilationString += e._emitCodeFromInclude("pbrBlockReflectance", $e, { replaceStrings: [{ search: /REFLECTIONMAP_SKYBOX/g, replace: (Be = Ge == null ? void 0 : Ge._defineSkyboxName) !== null && Be !== void 0 ? Be : "REFLECTIONMAP_SKYBOX" }, { search: /REFLECTIONMAP_3D/g, replace: (Le = Ge == null ? void 0 : Ge._define3DName) !== null && Le !== void 0 ? Le : "REFLECTIONMAP_3D" }] });
+ var Tt = this.subsurface.isConnected ? (Ve = this.subsurface.connectedPoint) === null || Ve === void 0 ? void 0 : Ve.ownerBlock : null, It = this.subsurface.isConnected ? (nt = ((Qe = this.subsurface.connectedPoint) === null || Qe === void 0 ? void 0 : Qe.ownerBlock).refraction.connectedPoint) === null || nt === void 0 ? void 0 : nt.ownerBlock : null;
+ It && (It.viewConnectionPoint = this.view, It.indexOfRefractionConnectionPoint = this.indexOfRefraction), e.compilationString += $s.GetCode(e, Tt, Ge, yt), e._emitFunctionFromInclude("pbrBlockSubSurface", $e, { replaceStrings: [{ search: /REFLECTIONMAP_3D/g, replace: (rt = Ge == null ? void 0 : Ge._define3DName) !== null && rt !== void 0 ? rt : "REFLECTIONMAP_3D" }, { search: /REFLECTIONMAP_OPPOSITEZ/g, replace: (ut = Ge == null ? void 0 : Ge._defineOppositeZ) !== null && ut !== void 0 ? ut : "REFLECTIONMAP_OPPOSITEZ" }, { search: /REFLECTIONMAP_PROJECTION/g, replace: (qe = Ge == null ? void 0 : Ge._defineProjectionName) !== null && qe !== void 0 ? qe : "REFLECTIONMAP_PROJECTION" }, { search: /SS_REFRACTIONMAP_3D/g, replace: (at = It == null ? void 0 : It._define3DName) !== null && at !== void 0 ? at : "SS_REFRACTIONMAP_3D" }, { search: /SS_LODINREFRACTIONALPHA/g, replace: (ot = It == null ? void 0 : It._defineLODRefractionAlpha) !== null && ot !== void 0 ? ot : "SS_LODINREFRACTIONALPHA" }, { search: /SS_LINEARSPECULARREFRACTION/g, replace: (Je = It == null ? void 0 : It._defineLinearSpecularRefraction) !== null && Je !== void 0 ? Je : "SS_LINEARSPECULARREFRACTION" }, { search: /SS_REFRACTIONMAP_OPPOSITEZ/g, replace: (dt = It == null ? void 0 : It._defineOppositeZ) !== null && dt !== void 0 ? dt : "SS_REFRACTIONMAP_OPPOSITEZ" }] }), e.compilationString += e._emitCodeFromInclude("pbrBlockDirectLighting", $e), this.light ? e.compilationString += e._emitCodeFromInclude("lightFragment", $e, { replaceStrings: [{ search: /{X}/g, replace: this._lightId.toString() }] }) : e.compilationString += e._emitCodeFromInclude("lightFragment", $e, { repeatKey: "maxSimultaneousLights" }), e.compilationString += e._emitCodeFromInclude("pbrBlockFinalLitComponents", $e), e.compilationString += `#endif\r
+`;
+ var cn = this.ambientColor.isConnected ? this.ambientColor.associatedVariableName : "vec3(0., 0., 0.)", Hn = Cn.DEFAULT_AO_ON_ANALYTICAL_LIGHTS.toString();
+ Hn.indexOf(".") === -1 && (Hn += "."), e.compilationString += e._emitCodeFromInclude("pbrBlockFinalUnlitComponents", $e, { replaceStrings: [{ search: /vec3 finalEmissive[\s\S]*?finalEmissive\*=vLightingIntensity\.y;/g, replace: "" }, { search: /vAmbientColor/g, replace: cn + " * ambientFromScene" }, { search: /vAmbientInfos\.w/g, replace: Hn }] }), e.compilationString += e._emitCodeFromInclude("pbrBlockFinalColorComposition", $e, { replaceStrings: [{ search: /finalEmissive/g, replace: "vec3(0.)" }] }), e.compilationString += e._emitCodeFromInclude("pbrBlockImageProcessing", $e, { replaceStrings: [{ search: /visibility/g, replace: "1." }] }), e.compilationString += e._emitCodeFromInclude("pbrDebug", $e, { replaceStrings: [{ search: /vNormalW/g, replace: this._vNormalWName }, { search: /vPositionW/g, replace: yt }, { search: /albedoTexture\.rgb;/g, replace: `vec3(1.);\r
+gl_FragColor.rgb = toGammaSpace(gl_FragColor.rgb);\r
+` }] });
+ for (var Jn = 0, pi = this._outputs; Jn < pi.length; Jn++) {
+ var Wn = pi[Jn];
+ if (Wn.hasEndpoints) {
+ var on = R0[Wn.name];
+ if (on) {
+ var Mi = on[0], ar = on[1];
+ ar && (e.compilationString += "#if " + ar + `\r
+`), e.compilationString += this._declareOutput(Wn, e) + " = " + Mi + `;\r
+`, ar && (e.compilationString += `#else\r
+`, e.compilationString += this._declareOutput(Wn, e) + ` = vec3(0.);\r
+`, e.compilationString += `#endif\r
+`);
+ } else
+ console.error("There's no remapping for the " + Wn.name + " end point! No code generated");
+ }
+ }
+ return this;
+ }, t.prototype._dumpPropertiesCode = function() {
+ var e = "";
+ return e += this._codeVariableName + ".lightFalloff = " + this.lightFalloff + `;\r
+`, e += this._codeVariableName + ".useAlphaTest = " + this.useAlphaTest + `;\r
+`, e += this._codeVariableName + ".alphaTestCutoff = " + this.alphaTestCutoff + `;\r
+`, e += this._codeVariableName + ".useAlphaBlending = " + this.useAlphaBlending + `;\r
+`, e += this._codeVariableName + ".useRadianceOverAlpha = " + this.useRadianceOverAlpha + `;\r
+`, e += this._codeVariableName + ".useSpecularOverAlpha = " + this.useSpecularOverAlpha + `;\r
+`, e += this._codeVariableName + ".enableSpecularAntiAliasing = " + this.enableSpecularAntiAliasing + `;\r
+`, e += this._codeVariableName + ".realTimeFiltering = " + this.realTimeFiltering + `;\r
+`, e += this._codeVariableName + ".realTimeFilteringQuality = " + this.realTimeFilteringQuality + `;\r
+`, e += this._codeVariableName + ".useEnergyConservation = " + this.useEnergyConservation + `;\r
+`, e += this._codeVariableName + ".useRadianceOcclusion = " + this.useRadianceOcclusion + `;\r
+`, e += this._codeVariableName + ".useHorizonOcclusion = " + this.useHorizonOcclusion + `;\r
+`, e += this._codeVariableName + ".unlit = " + this.unlit + `;\r
+`, e += this._codeVariableName + ".forceNormalForward = " + this.forceNormalForward + `;\r
+`, e += this._codeVariableName + ".debugMode = " + this.debugMode + `;\r
+`, e += this._codeVariableName + ".debugLimit = " + this.debugLimit + `;\r
+`, e += this._codeVariableName + ".debugFactor = " + this.debugFactor + `;\r
+`;
+ }, t.prototype.serialize = function() {
+ var e = r.prototype.serialize.call(this);
+ return this.light && (e.lightId = this.light.id), e.lightFalloff = this.lightFalloff, e.useAlphaTest = this.useAlphaTest, e.alphaTestCutoff = this.alphaTestCutoff, e.useAlphaBlending = this.useAlphaBlending, e.useRadianceOverAlpha = this.useRadianceOverAlpha, e.useSpecularOverAlpha = this.useSpecularOverAlpha, e.enableSpecularAntiAliasing = this.enableSpecularAntiAliasing, e.realTimeFiltering = this.realTimeFiltering, e.realTimeFilteringQuality = this.realTimeFilteringQuality, e.useEnergyConservation = this.useEnergyConservation, e.useRadianceOcclusion = this.useRadianceOcclusion, e.useHorizonOcclusion = this.useHorizonOcclusion, e.unlit = this.unlit, e.forceNormalForward = this.forceNormalForward, e.debugMode = this.debugMode, e.debugLimit = this.debugLimit, e.debugFactor = this.debugFactor, e;
+ }, t.prototype._deserialize = function(e, n, i) {
+ var o, a;
+ r.prototype._deserialize.call(this, e, n, i), e.lightId && (this.light = n.getLightByID(e.lightId)), this.lightFalloff = (o = e.lightFalloff) !== null && o !== void 0 ? o : 0, this.useAlphaTest = e.useAlphaTest, this.alphaTestCutoff = e.alphaTestCutoff, this.useAlphaBlending = e.useAlphaBlending, this.useRadianceOverAlpha = e.useRadianceOverAlpha, this.useSpecularOverAlpha = e.useSpecularOverAlpha, this.enableSpecularAntiAliasing = e.enableSpecularAntiAliasing, this.realTimeFiltering = !!e.realTimeFiltering, this.realTimeFilteringQuality = (a = e.realTimeFilteringQuality) !== null && a !== void 0 ? a : d.a.TEXTURE_FILTERING_QUALITY_LOW, this.useEnergyConservation = e.useEnergyConservation, this.useRadianceOcclusion = e.useRadianceOcclusion, this.useHorizonOcclusion = e.useHorizonOcclusion, this.unlit = e.unlit, this.forceNormalForward = !!e.forceNormalForward, this.debugMode = e.debugMode, this.debugLimit = e.debugLimit, this.debugFactor = e.debugFactor;
+ }, Object(u.c)([jt("Direct lights", Ft.Float, "INTENSITY", { min: 0, max: 1, notifiers: { update: !0 } })], t.prototype, "directIntensity", void 0), Object(u.c)([jt("Environment lights", Ft.Float, "INTENSITY", { min: 0, max: 1, notifiers: { update: !0 } })], t.prototype, "environmentIntensity", void 0), Object(u.c)([jt("Specular highlights", Ft.Float, "INTENSITY", { min: 0, max: 1, notifiers: { update: !0 } })], t.prototype, "specularIntensity", void 0), Object(u.c)([jt("Light falloff", Ft.List, "LIGHTING & COLORS", { notifiers: { update: !0 }, options: [{ label: "Physical", value: Cn.LIGHTFALLOFF_PHYSICAL }, { label: "GLTF", value: Cn.LIGHTFALLOFF_GLTF }, { label: "Standard", value: Cn.LIGHTFALLOFF_STANDARD }] })], t.prototype, "lightFalloff", void 0), Object(u.c)([jt("Alpha Testing", Ft.Boolean, "OPACITY")], t.prototype, "useAlphaTest", void 0), Object(u.c)([jt("Alpha CutOff", Ft.Float, "OPACITY", { min: 0, max: 1, notifiers: { update: !0 } })], t.prototype, "alphaTestCutoff", void 0), Object(u.c)([jt("Alpha blending", Ft.Boolean, "OPACITY")], t.prototype, "useAlphaBlending", void 0), Object(u.c)([jt("Radiance over alpha", Ft.Boolean, "RENDERING", { notifiers: { update: !0 } })], t.prototype, "useRadianceOverAlpha", void 0), Object(u.c)([jt("Specular over alpha", Ft.Boolean, "RENDERING", { notifiers: { update: !0 } })], t.prototype, "useSpecularOverAlpha", void 0), Object(u.c)([jt("Specular anti-aliasing", Ft.Boolean, "RENDERING", { notifiers: { update: !0 } })], t.prototype, "enableSpecularAntiAliasing", void 0), Object(u.c)([jt("Realtime filtering", Ft.Boolean, "RENDERING", { notifiers: { update: !0 } })], t.prototype, "realTimeFiltering", void 0), Object(u.c)([jt("Realtime filtering quality", Ft.List, "RENDERING", { notifiers: { update: !0 }, options: [{ label: "Low", value: d.a.TEXTURE_FILTERING_QUALITY_LOW }, { label: "Medium", value: d.a.TEXTURE_FILTERING_QUALITY_MEDIUM }, { label: "High", value: d.a.TEXTURE_FILTERING_QUALITY_HIGH }] })], t.prototype, "realTimeFilteringQuality", void 0), Object(u.c)([jt("Energy Conservation", Ft.Boolean, "ADVANCED", { notifiers: { update: !0 } })], t.prototype, "useEnergyConservation", void 0), Object(u.c)([jt("Radiance occlusion", Ft.Boolean, "ADVANCED", { notifiers: { update: !0 } })], t.prototype, "useRadianceOcclusion", void 0), Object(u.c)([jt("Horizon occlusion", Ft.Boolean, "ADVANCED", { notifiers: { update: !0 } })], t.prototype, "useHorizonOcclusion", void 0), Object(u.c)([jt("Unlit", Ft.Boolean, "ADVANCED", { notifiers: { update: !0 } })], t.prototype, "unlit", void 0), Object(u.c)([jt("Force normal forward", Ft.Boolean, "ADVANCED", { notifiers: { update: !0 } })], t.prototype, "forceNormalForward", void 0), Object(u.c)([jt("Debug mode", Ft.List, "DEBUG", { notifiers: { update: !0 }, options: [{ label: "None", value: 0 }, { label: "Normalized position", value: 1 }, { label: "Normals", value: 2 }, { label: "Tangents", value: 3 }, { label: "Bitangents", value: 4 }, { label: "Bump Normals", value: 5 }, { label: "ClearCoat Normals", value: 8 }, { label: "ClearCoat Tangents", value: 9 }, { label: "ClearCoat Bitangents", value: 10 }, { label: "Anisotropic Normals", value: 11 }, { label: "Anisotropic Tangents", value: 12 }, { label: "Anisotropic Bitangents", value: 13 }, { label: "Env Refraction", value: 40 }, { label: "Env Reflection", value: 41 }, { label: "Env Clear Coat", value: 42 }, { label: "Direct Diffuse", value: 50 }, { label: "Direct Specular", value: 51 }, { label: "Direct Clear Coat", value: 52 }, { label: "Direct Sheen", value: 53 }, { label: "Env Irradiance", value: 54 }, { label: "Surface Albedo", value: 60 }, { label: "Reflectance 0", value: 61 }, { label: "Metallic", value: 62 }, { label: "Metallic F0", value: 71 }, { label: "Roughness", value: 63 }, { label: "AlphaG", value: 64 }, { label: "NdotV", value: 65 }, { label: "ClearCoat Color", value: 66 }, { label: "ClearCoat Roughness", value: 67 }, { label: "ClearCoat NdotV", value: 68 }, { label: "Transmittance", value: 69 }, { label: "Refraction Transmittance", value: 70 }, { label: "SEO", value: 80 }, { label: "EHO", value: 81 }, { label: "Energy Factor", value: 82 }, { label: "Specular Reflectance", value: 83 }, { label: "Clear Coat Reflectance", value: 84 }, { label: "Sheen Reflectance", value: 85 }, { label: "Luminance Over Alpha", value: 86 }, { label: "Alpha", value: 87 }] })], t.prototype, "debugMode", void 0), Object(u.c)([jt("Split position", Ft.Float, "DEBUG", { min: -1, max: 1, notifiers: { update: !0 } })], t.prototype, "debugLimit", void 0), Object(u.c)([jt("Output factor", Ft.Float, "DEBUG", { min: 0, max: 5, notifiers: { update: !0 } })], t.prototype, "debugFactor", void 0), t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.PBRMetallicRoughnessBlock"] = u_;
+ var h_ = function(r) {
+ function t(e) {
+ var n = r.call(this, e, Me.Neutral) || this;
+ return n.registerInput("left", fe.AutoDetect), n.registerInput("right", fe.AutoDetect), n.registerOutput("output", fe.BasedOnInput), n._outputs[0]._typeConnectionSource = n._inputs[0], n._linkConnectionTypes(0, 1), n;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "ModBlock";
+ }, Object.defineProperty(t.prototype, "left", { get: function() {
+ return this._inputs[0];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "right", { get: function() {
+ return this._inputs[1];
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "output", { get: function() {
+ return this._outputs[0];
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildBlock = function(e) {
+ r.prototype._buildBlock.call(this, e);
+ var n = this._outputs[0];
+ return e.compilationString += this._declareOutput(n, e) + " = mod(" + this.left.associatedVariableName + ", " + this.right.associatedVariableName + `);\r
+`, this;
+ }, t;
+ }(pt);
+ x.a.RegisteredTypes["BABYLON.ModBlock"] = h_;
+ var O0 = function() {
+ function r() {
+ }
+ return r.prototype.optimize = function(t, e) {
+ }, r;
+ }(), M0 = l(120), I0 = function() {
+ function r() {
+ this.mm = /* @__PURE__ */ new Map();
+ }
+ return r.prototype.get = function(t, e) {
+ var n = this.mm.get(t);
+ if (n !== void 0)
+ return n.get(e);
+ }, r.prototype.set = function(t, e, n) {
+ var i = this.mm.get(t);
+ i === void 0 && this.mm.set(t, i = /* @__PURE__ */ new Map()), i.set(e, n);
+ }, r;
+ }(), D0 = function() {
+ function r(t, e, n) {
+ var i = this;
+ this._baseMaterial = t, this._scene = e, this._options = n, this._subMeshToEffect = /* @__PURE__ */ new Map(), this._subMeshToDepthEffect = new I0(), this._meshes = /* @__PURE__ */ new Map();
+ var o = t.getClassName() === "NodeMaterial" ? "u_" : "";
+ if (o) {
+ this._matriceNames = { world: o + "World", view: o + "View", projection: o + "Projection", viewProjection: o + "ViewProjection", worldView: o + "WorldxView", worldViewProjection: o + "WorldxViewxProjection" };
+ for (var a = t.getInputBlocks(), s = 0; s < a.length; ++s)
+ switch (a[s]._systemValue) {
+ case bt.World:
+ this._matriceNames.world = a[s].associatedVariableName;
+ break;
+ case bt.View:
+ this._matriceNames.view = a[s].associatedVariableName;
+ break;
+ case bt.Projection:
+ this._matriceNames.projection = a[s].associatedVariableName;
+ break;
+ case bt.ViewProjection:
+ this._matriceNames.viewProjection = a[s].associatedVariableName;
+ break;
+ case bt.WorldView:
+ this._matriceNames.worldView = a[s].associatedVariableName;
+ break;
+ case bt.WorldViewProjection:
+ this._matriceNames.worldViewProjection = a[s].associatedVariableName;
+ }
+ } else
+ this._matriceNames = { world: o + "world", view: o + "view", projection: o + "projection", viewProjection: o + "viewProjection", worldView: o + "worldView", worldViewProjection: o + "worldViewProjection" };
+ this._onEffectCreatedObserver = this._baseMaterial.onEffectCreatedObservable.add(function(p) {
+ var m, S = (m = p.subMesh) === null || m === void 0 ? void 0 : m.getMesh();
+ S && !i._meshes.has(S) && i._meshes.set(S, S.onDisposeObservable.add(function(O) {
+ for (var I = i._subMeshToEffect.keys(), G = I.next(); G.done !== !0; G = I.next()) {
+ var k = G.value;
+ (k == null ? void 0 : k.getMesh()) === O && (i._subMeshToEffect.delete(k), i._subMeshToDepthEffect.mm.delete(k));
+ }
+ })), i._subMeshToEffect.set(p.subMesh, p.effect), i._subMeshToDepthEffect.mm.delete(p.subMesh);
+ });
+ }
+ return Object.defineProperty(r.prototype, "standalone", { get: function() {
+ var t, e;
+ return (e = (t = this._options) === null || t === void 0 ? void 0 : t.standalone) !== null && e !== void 0 && e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "baseMaterial", { get: function() {
+ return this._baseMaterial;
+ }, enumerable: !1, configurable: !0 }), r.prototype.getEffect = function(t, e) {
+ var n, i, o, a, s, p;
+ return (p = (o = (i = (n = this._subMeshToDepthEffect.mm.get(t)) === null || n === void 0 ? void 0 : n.get(e)) === null || i === void 0 ? void 0 : i.depthEffect) !== null && o !== void 0 ? o : (s = (a = this._subMeshToDepthEffect.mm.get(null)) === null || a === void 0 ? void 0 : a.get(e)) === null || s === void 0 ? void 0 : s.depthEffect) !== null && p !== void 0 ? p : null;
+ }, r.prototype.isReadyForSubMesh = function(t, e, n, i) {
+ var o, a;
+ return this.standalone && this._baseMaterial.isReadyForSubMesh(t.getMesh(), t, i), (a = (o = this._makeEffect(t, e, n)) === null || o === void 0 ? void 0 : o.isReady()) !== null && a !== void 0 && a;
+ }, r.prototype.dispose = function() {
+ this._baseMaterial.onEffectCreatedObservable.remove(this._onEffectCreatedObserver), this._onEffectCreatedObserver = null;
+ for (var t = this._meshes.entries(), e = t.next(); e.done !== !0; e = t.next()) {
+ var n = e.value, i = n[0], o = n[1];
+ i.onDisposeObservable.remove(o);
+ }
+ }, r.prototype._makeEffect = function(t, e, n) {
+ var i, o = (i = this._subMeshToEffect.get(t)) !== null && i !== void 0 ? i : this._subMeshToEffect.get(null);
+ if (!o)
+ return null;
+ var a = this._subMeshToDepthEffect.get(t, n);
+ a || (a = { depthEffect: null, depthDefines: "", token: M0.a.RandomId() }, this._subMeshToDepthEffect.set(t, n, a));
+ var s = e.join(`
+`);
+ if (a.depthEffect && s === a.depthDefines)
+ return a.depthEffect;
+ a.depthDefines = s;
+ var p = o.rawVertexSourceCode, m = o.rawFragmentSourceCode, S = this._options && this._options.remappedVariables ? "#include(" + this._options.remappedVariables.join(",") + ")" : We.a.IncludesShadersStore.shadowMapVertexNormalBias, O = this._options && this._options.remappedVariables ? "#include(" + this._options.remappedVariables.join(",") + ")" : We.a.IncludesShadersStore.shadowMapVertexMetric, I = this._options && this._options.remappedVariables ? "#include(" + this._options.remappedVariables.join(",") + ")" : We.a.IncludesShadersStore.shadowMapFragmentSoftTransparentShadow, G = We.a.IncludesShadersStore.shadowMapFragment;
+ p = (p = (p = (p = p.replace(/void\s+?main/g, We.a.IncludesShadersStore.shadowMapVertexDeclaration + `\r
+void main`)).replace(/#define SHADOWDEPTH_NORMALBIAS|#define CUSTOM_VERTEX_UPDATE_WORLDPOS/g, S)).indexOf("#define SHADOWDEPTH_METRIC") !== -1 ? p.replace(/#define SHADOWDEPTH_METRIC/g, O) : p.replace(/}\s*$/g, O + `\r
+}`)).replace(/#define SHADER_NAME.*?\n|out vec4 glFragColor;\n/g, "");
+ var k = m.indexOf("#define SHADOWDEPTH_SOFTTRANSPARENTSHADOW") >= 0 || m.indexOf("#define CUSTOM_FRAGMENT_BEFORE_FOG") >= 0, K = m.indexOf("#define SHADOWDEPTH_FRAGMENT") !== -1, re = "";
+ k ? m = m.replace(/#define SHADOWDEPTH_SOFTTRANSPARENTSHADOW|#define CUSTOM_FRAGMENT_BEFORE_FOG/g, I) : re = I + `\r
+`, m = m.replace(/void\s+?main/g, We.a.IncludesShadersStore.shadowMapFragmentDeclaration + `\r
+void main`), K ? m = m.replace(/#define SHADOWDEPTH_FRAGMENT/g, G) : re += G + `\r
+`, re && (m = m.replace(/}\s*$/g, re + "}")), m = m.replace(/#define SHADER_NAME.*?\n|out vec4 glFragColor;\n/g, "");
+ var se = o.getUniformNames().slice();
+ return se.push("biasAndScaleSM", "depthValuesSM", "lightDataSM", "softTransparentShadowSM"), a.depthEffect = this._scene.getEngine().createEffect({ vertexSource: p, fragmentSource: m, vertexToken: a.token, fragmentToken: a.token }, { attributes: o.getAttributesNames(), uniformsNames: se, uniformBuffersNames: o.getUniformBuffersNames(), samplers: o.getSamplers(), defines: s + `
+` + o.defines.replace("#define SHADOWS", "").replace(/#define SHADOW\d/g, ""), indexParameters: o.getIndexParameters() }, this._scene.getEngine()), a.depthEffect;
+ }, r;
+ }(), d_ = l(101);
+ function Eu(r, t, e, n, i) {
+ var o = new r.DecoderBuffer();
+ o.Init(t, t.byteLength);
+ var a, s, p = new r.Decoder();
+ try {
+ var m = p.GetEncodedGeometryType(o);
+ switch (m) {
+ case r.TRIANGULAR_MESH:
+ a = new r.Mesh(), s = p.DecodeBufferToMesh(o, a);
+ break;
+ case r.POINT_CLOUD:
+ a = new r.PointCloud(), s = p.DecodeBufferToPointCloud(o, a);
+ break;
+ default:
+ throw new Error("Invalid geometry type " + m);
+ }
+ if (!s.ok() || !a.ptr)
+ throw new Error(s.error_msg());
+ if (m === r.TRIANGULAR_MESH) {
+ var S = 3 * a.num_faces(), O = 4 * S, I = r._malloc(O);
+ try {
+ p.GetTrianglesUInt32Array(a, O, I);
+ var G = new Uint32Array(S);
+ G.set(new Uint32Array(r.HEAPF32.buffer, I, S)), n(G);
+ } finally {
+ r._free(I);
+ }
+ }
+ var k = function(ue, he) {
+ var pe = he.num_components(), ve = a.num_points(), Ee = ve * pe, Ae = Ee * Float32Array.BYTES_PER_ELEMENT, Ie = r._malloc(Ae);
+ try {
+ p.GetAttributeDataArrayForAllPoints(a, he, r.DT_FLOAT32, Ae, Ie);
+ var xe = new Float32Array(r.HEAPF32.buffer, Ie, Ee);
+ if (ue === "color" && pe === 3) {
+ for (var Pe = new Float32Array(4 * ve), Ce = 0, Fe = 0; Ce < Pe.length; Ce += 4, Fe += pe)
+ Pe[Ce + 0] = xe[Fe + 0], Pe[Ce + 1] = xe[Fe + 1], Pe[Ce + 2] = xe[Fe + 2], Pe[Ce + 3] = 1;
+ i(ue, Pe);
+ } else
+ (Pe = new Float32Array(Ee)).set(new Float32Array(r.HEAPF32.buffer, Ie, Ee)), i(ue, Pe);
+ } finally {
+ r._free(Ie);
+ }
+ };
+ if (e)
+ for (var K in e) {
+ var re = e[K];
+ k(K, p.GetAttributeByUniqueId(a, re));
+ }
+ else {
+ var se = { position: "POSITION", normal: "NORMAL", color: "COLOR", uv: "TEX_COORD" };
+ for (var K in se)
+ (re = p.GetAttributeId(a, r[se[K]])) !== -1 && k(K, p.GetAttribute(a, re));
+ }
+ } finally {
+ a && r.destroy(a), r.destroy(p), r.destroy(o);
+ }
+ }
+ function L0() {
+ var r;
+ onmessage = function(t) {
+ var e = t.data;
+ switch (e.id) {
+ case "init":
+ var n = e.decoder;
+ n.url && (importScripts(n.url), r = DracoDecoderModule({ wasmBinary: n.wasmBinary })), postMessage("done");
+ break;
+ case "decodeMesh":
+ if (!r)
+ throw new Error("Draco decoder module is not available");
+ r.then(function(i) {
+ Eu(i, e.dataView, e.attributes, function(o) {
+ postMessage({ id: "indices", value: o }, [o.buffer]);
+ }, function(o, a) {
+ postMessage({ id: o, value: a }, [a.buffer]);
+ }), postMessage("done");
+ });
+ }
+ };
+ }
+ function f_(r) {
+ return typeof document != "object" || typeof r != "string" ? r : Ke.b.GetAbsoluteUrl(r);
+ }
+ var w0 = function() {
+ function r(t) {
+ t === void 0 && (t = r.DefaultNumWorkers);
+ var e = r.Configuration.decoder, n = e.wasmUrl && e.wasmBinaryUrl && typeof WebAssembly == "object" ? { url: e.wasmUrl, wasmBinaryPromise: Ke.b.LoadFileAsync(f_(e.wasmBinaryUrl)) } : { url: e.fallbackUrl, wasmBinaryPromise: Promise.resolve(void 0) };
+ t && typeof Worker == "function" ? this._workerPoolPromise = n.wasmBinaryPromise.then(function(i) {
+ for (var o = Eu + "(" + L0 + ")()", a = URL.createObjectURL(new Blob([o], { type: "application/javascript" })), s = new Array(t), p = 0; p < s.length; p++)
+ s[p] = new Promise(function(m, S) {
+ var O = new Worker(a), I = function(k) {
+ O.removeEventListener("error", I), O.removeEventListener("message", G), S(k);
+ }, G = function(k) {
+ k.data === "done" && (O.removeEventListener("error", I), O.removeEventListener("message", G), m(O));
+ };
+ O.addEventListener("error", I), O.addEventListener("message", G), O.postMessage({ id: "init", decoder: { url: f_(n.url), wasmBinary: i } });
+ });
+ return Promise.all(s).then(function(m) {
+ return new Vl(m);
+ });
+ }) : this._decoderModulePromise = n.wasmBinaryPromise.then(function(i) {
+ if (!n.url)
+ throw new Error("Draco decoder module is not available");
+ return Ke.b.LoadScriptAsync(n.url).then(function() {
+ return o = i, new Promise(function(a) {
+ DracoDecoderModule({ wasmBinary: o }).then(function(s) {
+ a({ module: s });
+ });
+ });
+ var o;
+ });
+ });
+ }
+ return Object.defineProperty(r, "DecoderAvailable", { get: function() {
+ var t = r.Configuration.decoder;
+ return !!(t.wasmUrl && t.wasmBinaryUrl && typeof WebAssembly == "object" || t.fallbackUrl);
+ }, enumerable: !1, configurable: !0 }), r.GetDefaultNumWorkers = function() {
+ return typeof navigator == "object" && navigator.hardwareConcurrency ? Math.min(Math.floor(0.5 * navigator.hardwareConcurrency), 4) : 1;
+ }, Object.defineProperty(r, "Default", { get: function() {
+ return r._Default || (r._Default = new r()), r._Default;
+ }, enumerable: !1, configurable: !0 }), r.prototype.dispose = function() {
+ this._workerPoolPromise && this._workerPoolPromise.then(function(t) {
+ t.dispose();
+ }), delete this._workerPoolPromise, delete this._decoderModulePromise;
+ }, r.prototype.whenReadyAsync = function() {
+ return this._workerPoolPromise ? this._workerPoolPromise.then(function() {
+ }) : this._decoderModulePromise ? this._decoderModulePromise.then(function() {
+ }) : Promise.resolve();
+ }, r.prototype.decodeMeshAsync = function(t, e) {
+ var n = t instanceof ArrayBuffer ? new Uint8Array(t) : t;
+ if (this._workerPoolPromise)
+ return this._workerPoolPromise.then(function(i) {
+ return new Promise(function(o, a) {
+ i.push(function(s, p) {
+ var m = new ft.a(), S = function(G) {
+ s.removeEventListener("error", S), s.removeEventListener("message", O), a(G), p();
+ }, O = function(G) {
+ G.data === "done" ? (s.removeEventListener("error", S), s.removeEventListener("message", O), o(m), p()) : G.data.id === "indices" ? m.indices = G.data.value : m.set(G.data.value, G.data.id);
+ };
+ s.addEventListener("error", S), s.addEventListener("message", O);
+ var I = new Uint8Array(n.byteLength);
+ I.set(new Uint8Array(n.buffer, n.byteOffset, n.byteLength)), s.postMessage({ id: "decodeMesh", dataView: I, attributes: e }, [I.buffer]);
+ });
+ });
+ });
+ if (this._decoderModulePromise)
+ return this._decoderModulePromise.then(function(i) {
+ var o = new ft.a();
+ return Eu(i.module, n, e, function(a) {
+ o.indices = a;
+ }, function(a, s) {
+ o.set(s, a);
+ }), o;
+ });
+ throw new Error("Draco decoder module is not available");
+ }, r.Configuration = { decoder: { wasmUrl: "https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js", wasmBinaryUrl: "https://preview.babylonjs.com/draco_decoder_gltf.wasm", fallbackUrl: "https://preview.babylonjs.com/draco_decoder_gltf.js" } }, r.DefaultNumWorkers = r.GetDefaultNumWorkers(), r._Default = null, r;
+ }(), Ba = l(61), p_ = 0, N0 = function() {
+ function r(t, e, n, i) {
+ this.pos = t, this.normal = e, this.uv = n, this.vertColor = i;
+ }
+ return r.prototype.clone = function() {
+ var t, e;
+ return new r(this.pos.clone(), this.normal.clone(), (t = this.uv) === null || t === void 0 ? void 0 : t.clone(), (e = this.vertColor) === null || e === void 0 ? void 0 : e.clone());
+ }, r.prototype.flip = function() {
+ this.normal = this.normal.scale(-1);
+ }, r.prototype.interpolate = function(t, e) {
+ return new r(c.e.Lerp(this.pos, t.pos, e), c.e.Lerp(this.normal, t.normal, e), this.uv && t.uv ? c.d.Lerp(this.uv, t.uv, e) : void 0, this.vertColor && t.vertColor ? C.b.Lerp(this.vertColor, t.vertColor, e) : void 0);
+ }, r;
+ }(), F0 = function() {
+ function r(t, e) {
+ this.normal = t, this.w = e;
+ }
+ return r.FromPoints = function(t, e, n) {
+ var i = n.subtract(t), o = e.subtract(t);
+ if (i.lengthSquared() === 0 || o.lengthSquared() === 0)
+ return null;
+ var a = c.e.Normalize(c.e.Cross(i, o));
+ return new r(a, c.e.Dot(a, t));
+ }, r.prototype.clone = function() {
+ return new r(this.normal.clone(), this.w);
+ }, r.prototype.flip = function() {
+ this.normal.scaleInPlace(-1), this.w = -this.w;
+ }, r.prototype.splitPolygon = function(t, e, n, i, o) {
+ var a, s, p = 0, m = [];
+ for (a = 0; a < t.vertices.length; a++) {
+ var S = (s = c.e.Dot(this.normal, t.vertices[a].pos) - this.w) < -r.EPSILON ? 2 : s > r.EPSILON ? 1 : 0;
+ p |= S, m.push(S);
+ }
+ switch (p) {
+ case 0:
+ (c.e.Dot(this.normal, t.plane.normal) > 0 ? e : n).push(t);
+ break;
+ case 1:
+ i.push(t);
+ break;
+ case 2:
+ o.push(t);
+ break;
+ case 3:
+ var O, I = [], G = [];
+ for (a = 0; a < t.vertices.length; a++) {
+ var k = (a + 1) % t.vertices.length, K = m[a], re = m[k], se = t.vertices[a], ue = t.vertices[k];
+ if (K !== 2 && I.push(se), K !== 1 && G.push(K !== 2 ? se.clone() : se), (K | re) == 3) {
+ s = (this.w - c.e.Dot(this.normal, se.pos)) / c.e.Dot(this.normal, ue.pos.subtract(se.pos));
+ var he = se.interpolate(ue, s);
+ I.push(he), G.push(he.clone());
+ }
+ }
+ I.length >= 3 && (O = new Tu(I, t.shared)).plane && i.push(O), G.length >= 3 && (O = new Tu(G, t.shared)).plane && o.push(O);
+ }
+ }, r.EPSILON = 1e-5, r;
+ }(), Tu = function() {
+ function r(t, e) {
+ this.vertices = t, this.shared = e, this.plane = F0.FromPoints(t[0].pos, t[1].pos, t[2].pos);
+ }
+ return r.prototype.clone = function() {
+ return new r(this.vertices.map(function(t) {
+ return t.clone();
+ }), this.shared);
+ }, r.prototype.flip = function() {
+ this.vertices.reverse().map(function(t) {
+ t.flip();
+ }), this.plane.flip();
+ }, r;
+ }(), fi = function() {
+ function r(t) {
+ this.plane = null, this.front = null, this.back = null, this.polygons = new Array(), t && this.build(t);
+ }
+ return r.prototype.clone = function() {
+ var t = new r();
+ return t.plane = this.plane && this.plane.clone(), t.front = this.front && this.front.clone(), t.back = this.back && this.back.clone(), t.polygons = this.polygons.map(function(e) {
+ return e.clone();
+ }), t;
+ }, r.prototype.invert = function() {
+ for (var t = 0; t < this.polygons.length; t++)
+ this.polygons[t].flip();
+ this.plane && this.plane.flip(), this.front && this.front.invert(), this.back && this.back.invert();
+ var e = this.front;
+ this.front = this.back, this.back = e;
+ }, r.prototype.clipPolygons = function(t) {
+ if (!this.plane)
+ return t.slice();
+ for (var e = new Array(), n = new Array(), i = 0; i < t.length; i++)
+ this.plane.splitPolygon(t[i], e, n, e, n);
+ return this.front && (e = this.front.clipPolygons(e)), n = this.back ? this.back.clipPolygons(n) : [], e.concat(n);
+ }, r.prototype.clipTo = function(t) {
+ this.polygons = t.clipPolygons(this.polygons), this.front && this.front.clipTo(t), this.back && this.back.clipTo(t);
+ }, r.prototype.allPolygons = function() {
+ var t = this.polygons.slice();
+ return this.front && (t = t.concat(this.front.allPolygons())), this.back && (t = t.concat(this.back.allPolygons())), t;
+ }, r.prototype.build = function(t) {
+ if (t.length) {
+ this.plane || (this.plane = t[0].plane.clone());
+ for (var e = new Array(), n = new Array(), i = 0; i < t.length; i++)
+ this.plane.splitPolygon(t[i], this.polygons, this.polygons, e, n);
+ e.length && (this.front || (this.front = new r()), this.front.build(e)), n.length && (this.back || (this.back = new r()), this.back.build(n));
+ }
+ }, r;
+ }(), B0 = function() {
+ function r() {
+ this.polygons = new Array();
+ }
+ return r.FromMesh = function(t) {
+ var e, n, i, o, a, s, p, m, S, O = void 0, I = void 0, G = new Array(), k = null;
+ if (!(t instanceof we.a))
+ throw "BABYLON.CSG: Wrong Mesh type, must be BABYLON.Mesh";
+ t.computeWorldMatrix(!0), s = t.getWorldMatrix(), p = t.position.clone(), m = t.rotation.clone(), t.rotationQuaternion && (k = t.rotationQuaternion.clone()), S = t.scaling.clone();
+ for (var K = t.getIndices(), re = t.getVerticesData(De.b.PositionKind), se = t.getVerticesData(De.b.NormalKind), ue = t.getVerticesData(De.b.UVKind), he = t.getVerticesData(De.b.ColorKind), pe = t.subMeshes, ve = 0, Ee = pe.length; ve < Ee; ve++)
+ for (var Ae = pe[ve].indexStart, Ie = pe[ve].indexCount + pe[ve].indexStart; Ae < Ie; Ae += 3) {
+ a = [];
+ for (var xe = 0; xe < 3; xe++) {
+ var Pe = new c.e(se[3 * K[Ae + xe]], se[3 * K[Ae + xe] + 1], se[3 * K[Ae + xe] + 2]);
+ ue && (O = new c.d(ue[2 * K[Ae + xe]], ue[2 * K[Ae + xe] + 1])), he && (I = new C.b(he[4 * K[Ae + xe]], he[4 * K[Ae + xe] + 1], he[4 * K[Ae + xe] + 2], he[4 * K[Ae + xe] + 3]));
+ var Ce = new c.e(re[3 * K[Ae + xe]], re[3 * K[Ae + xe] + 1], re[3 * K[Ae + xe] + 2]);
+ i = c.e.TransformCoordinates(Ce, s), n = c.e.TransformNormal(Pe, s), e = new N0(i, n, O, I), a.push(e);
+ }
+ (o = new Tu(a, { subMeshId: ve, meshId: p_, materialIndex: pe[ve].materialIndex })).plane && G.push(o);
+ }
+ var Fe = r.FromPolygons(G);
+ return Fe.matrix = s, Fe.position = p, Fe.rotation = m, Fe.scaling = S, Fe.rotationQuaternion = k, p_++, Fe;
+ }, r.FromPolygons = function(t) {
+ var e = new r();
+ return e.polygons = t, e;
+ }, r.prototype.clone = function() {
+ var t = new r();
+ return t.polygons = this.polygons.map(function(e) {
+ return e.clone();
+ }), t.copyTransformAttributes(this), t;
+ }, r.prototype.union = function(t) {
+ var e = new fi(this.clone().polygons), n = new fi(t.clone().polygons);
+ return e.clipTo(n), n.clipTo(e), n.invert(), n.clipTo(e), n.invert(), e.build(n.allPolygons()), r.FromPolygons(e.allPolygons()).copyTransformAttributes(this);
+ }, r.prototype.unionInPlace = function(t) {
+ var e = new fi(this.polygons), n = new fi(t.polygons);
+ e.clipTo(n), n.clipTo(e), n.invert(), n.clipTo(e), n.invert(), e.build(n.allPolygons()), this.polygons = e.allPolygons();
+ }, r.prototype.subtract = function(t) {
+ var e = new fi(this.clone().polygons), n = new fi(t.clone().polygons);
+ return e.invert(), e.clipTo(n), n.clipTo(e), n.invert(), n.clipTo(e), n.invert(), e.build(n.allPolygons()), e.invert(), r.FromPolygons(e.allPolygons()).copyTransformAttributes(this);
+ }, r.prototype.subtractInPlace = function(t) {
+ var e = new fi(this.polygons), n = new fi(t.polygons);
+ e.invert(), e.clipTo(n), n.clipTo(e), n.invert(), n.clipTo(e), n.invert(), e.build(n.allPolygons()), e.invert(), this.polygons = e.allPolygons();
+ }, r.prototype.intersect = function(t) {
+ var e = new fi(this.clone().polygons), n = new fi(t.clone().polygons);
+ return e.invert(), n.clipTo(e), n.invert(), e.clipTo(n), n.clipTo(e), e.build(n.allPolygons()), e.invert(), r.FromPolygons(e.allPolygons()).copyTransformAttributes(this);
+ }, r.prototype.intersectInPlace = function(t) {
+ var e = new fi(this.polygons), n = new fi(t.polygons);
+ e.invert(), n.clipTo(e), n.invert(), e.clipTo(n), n.clipTo(e), e.build(n.allPolygons()), e.invert(), this.polygons = e.allPolygons();
+ }, r.prototype.inverse = function() {
+ var t = this.clone();
+ return t.inverseInPlace(), t;
+ }, r.prototype.inverseInPlace = function() {
+ this.polygons.map(function(t) {
+ t.flip();
+ });
+ }, r.prototype.copyTransformAttributes = function(t) {
+ return this.matrix = t.matrix, this.position = t.position, this.rotation = t.rotation, this.scaling = t.scaling, this.rotationQuaternion = t.rotationQuaternion, this;
+ }, r.prototype.buildMeshGeometry = function(t, e, n) {
+ var i = this.matrix.clone();
+ i.invert();
+ var o, a, s, p = new we.a(t, e), m = [], S = [], O = [], I = null, G = null, k = c.e.Zero(), K = c.e.Zero(), re = c.d.Zero(), se = new C.b(0, 0, 0, 0), ue = this.polygons, he = [0, 0, 0], pe = {}, ve = 0, Ee = {};
+ n && ue.sort(function(ut, qe) {
+ return ut.shared.meshId === qe.shared.meshId ? ut.shared.subMeshId - qe.shared.subMeshId : ut.shared.meshId - qe.shared.meshId;
+ });
+ for (var Ae = 0, Ie = ue.length; Ae < Ie; Ae++) {
+ Ee[(o = ue[Ae]).shared.meshId] || (Ee[o.shared.meshId] = {}), Ee[o.shared.meshId][o.shared.subMeshId] || (Ee[o.shared.meshId][o.shared.subMeshId] = { indexStart: 1 / 0, indexEnd: -1 / 0, materialIndex: o.shared.materialIndex }), s = Ee[o.shared.meshId][o.shared.subMeshId];
+ for (var xe = 2, Pe = o.vertices.length; xe < Pe; xe++) {
+ he[0] = 0, he[1] = xe - 1, he[2] = xe;
+ for (var Ce = 0; Ce < 3; Ce++) {
+ k.copyFrom(o.vertices[he[Ce]].pos), K.copyFrom(o.vertices[he[Ce]].normal), o.vertices[he[Ce]].uv && (I || (I = []), re.copyFrom(o.vertices[he[Ce]].uv)), o.vertices[he[Ce]].vertColor && (G || (G = []), se.copyFrom(o.vertices[he[Ce]].vertColor));
+ var Fe = c.e.TransformCoordinates(k, i), Oe = c.e.TransformNormal(K, i);
+ a = pe[Fe.x + "," + Fe.y + "," + Fe.z];
+ var Be = !1;
+ I && I[2 * a] !== re.x && I[2 * a + 1] !== re.y && (Be = !0);
+ var Le = !1;
+ G && G[4 * a] !== se.r && G[4 * a + 1] !== se.g && G[4 * a + 2] !== se.b && G[4 * a + 3] !== se.a && (Le = !0), (a === void 0 || O[3 * a] !== Oe.x || O[3 * a + 1] !== Oe.y || O[3 * a + 2] !== Oe.z || Be || Le) && (m.push(Fe.x, Fe.y, Fe.z), I && I.push(re.x, re.y), O.push(K.x, K.y, K.z), G && G.push(se.r, se.g, se.b, se.a), a = pe[Fe.x + "," + Fe.y + "," + Fe.z] = m.length / 3 - 1), S.push(a), s.indexStart = Math.min(ve, s.indexStart), s.indexEnd = Math.max(ve, s.indexEnd), ve++;
+ }
+ }
+ }
+ if (p.setVerticesData(De.b.PositionKind, m), p.setVerticesData(De.b.NormalKind, O), I && p.setVerticesData(De.b.UVKind, I), G && p.setVerticesData(De.b.ColorKind, G), p.setIndices(S, null), n) {
+ var Ve, Qe = 0;
+ for (var nt in p.subMeshes = new Array(), Ee) {
+ for (var rt in Ve = -1, Ee[nt])
+ s = Ee[nt][rt], Ba.a.CreateFromIndices(s.materialIndex + Qe, s.indexStart, s.indexEnd - s.indexStart + 1, p), Ve = Math.max(s.materialIndex, Ve);
+ Qe += ++Ve;
+ }
+ }
+ return p;
+ }, r.prototype.toMesh = function(t, e, n, i) {
+ e === void 0 && (e = null);
+ var o = this.buildMeshGeometry(t, n, i);
+ return o.material = e, o.position.copyFrom(this.position), o.rotation.copyFrom(this.rotation), this.rotationQuaternion && (o.rotationQuaternion = this.rotationQuaternion.clone()), o.scaling.copyFrom(this.scaling), o.computeWorldMatrix(!0), o;
+ }, r;
+ }(), U0 = function(r) {
+ function t(e, n, i, o, a, s) {
+ o === void 0 && (o = 1), a === void 0 && (a = 60), s === void 0 && (s = !0);
+ var p = r.call(this, e, i) || this;
+ p._sectionPolygonPointsCount = 4, p._running = !1, p._autoStart = s, p._generator = n, p._diameter = o, p._length = a, p._sectionVectors = [], p._sectionNormalVectors = [];
+ for (var m = 0; m < p._sectionPolygonPointsCount; m++)
+ p._sectionVectors[m] = c.e.Zero(), p._sectionNormalVectors[m] = c.e.Zero();
+ return p._createMesh(), p;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "TrailMesh";
+ }, t.prototype._createMesh = function() {
+ var e = new ft.a(), n = [], i = [], o = [], a = c.e.Zero();
+ a = this._generator instanceof Nt.a && this._generator._boundingInfo ? this._generator._boundingInfo.boundingBox.centerWorld : this._generator.position;
+ for (var s = 2 * Math.PI / this._sectionPolygonPointsCount, p = 0; p < this._sectionPolygonPointsCount; p++)
+ n.push(a.x + Math.cos(p * s) * this._diameter, a.y + Math.sin(p * s) * this._diameter, a.z);
+ for (p = 1; p <= this._length; p++) {
+ for (var m = 0; m < this._sectionPolygonPointsCount; m++)
+ n.push(a.x + Math.cos(m * s) * this._diameter, a.y + Math.sin(m * s) * this._diameter, a.z);
+ var S = n.length / 3 - 2 * this._sectionPolygonPointsCount;
+ for (m = 0; m < this._sectionPolygonPointsCount - 1; m++)
+ o.push(S + m, S + m + this._sectionPolygonPointsCount, S + m + this._sectionPolygonPointsCount + 1), o.push(S + m, S + m + this._sectionPolygonPointsCount + 1, S + m + 1);
+ o.push(S + this._sectionPolygonPointsCount - 1, S + this._sectionPolygonPointsCount - 1 + this._sectionPolygonPointsCount, S + this._sectionPolygonPointsCount), o.push(S + this._sectionPolygonPointsCount - 1, S + this._sectionPolygonPointsCount, S);
+ }
+ ft.a.ComputeNormals(n, o, i), e.positions = n, e.normals = i, e.indices = o, e.applyToMesh(this, !0), this._autoStart && this.start();
+ }, t.prototype.start = function() {
+ var e = this;
+ this._running || (this._running = !0, this._beforeRenderObserver = this.getScene().onBeforeRenderObservable.add(function() {
+ e.update();
+ }));
+ }, t.prototype.stop = function() {
+ this._beforeRenderObserver && this._running && (this._running = !1, this.getScene().onBeforeRenderObservable.remove(this._beforeRenderObserver));
+ }, t.prototype.update = function() {
+ var e = this.getVerticesData(De.b.PositionKind), n = this.getVerticesData(De.b.NormalKind), i = this._generator.getWorldMatrix();
+ if (e && n) {
+ for (var o = 3 * this._sectionPolygonPointsCount; o < e.length; o++)
+ e[o - 3 * this._sectionPolygonPointsCount] = e[o] - n[o] / this._length * this._diameter;
+ for (o = 3 * this._sectionPolygonPointsCount; o < n.length; o++)
+ n[o - 3 * this._sectionPolygonPointsCount] = n[o];
+ var a = e.length - 3 * this._sectionPolygonPointsCount, s = 2 * Math.PI / this._sectionPolygonPointsCount;
+ for (o = 0; o < this._sectionPolygonPointsCount; o++)
+ this._sectionVectors[o].copyFromFloats(Math.cos(o * s) * this._diameter, Math.sin(o * s) * this._diameter, 0), this._sectionNormalVectors[o].copyFromFloats(Math.cos(o * s), Math.sin(o * s), 0), c.e.TransformCoordinatesToRef(this._sectionVectors[o], i, this._sectionVectors[o]), c.e.TransformNormalToRef(this._sectionNormalVectors[o], i, this._sectionNormalVectors[o]);
+ for (o = 0; o < this._sectionPolygonPointsCount; o++)
+ e[a + 3 * o] = this._sectionVectors[o].x, e[a + 3 * o + 1] = this._sectionVectors[o].y, e[a + 3 * o + 2] = this._sectionVectors[o].z, n[a + 3 * o] = this._sectionNormalVectors[o].x, n[a + 3 * o + 1] = this._sectionNormalVectors[o].y, n[a + 3 * o + 2] = this._sectionNormalVectors[o].z;
+ this.updateVerticesData(De.b.PositionKind, e, !0, !1), this.updateVerticesData(De.b.NormalKind, n, !0, !1);
+ }
+ }, t.prototype.clone = function(e, n) {
+ return e === void 0 && (e = ""), new t(e, n === void 0 ? this._generator : n, this.getScene(), this._diameter, this._length, this._autoStart);
+ }, t.prototype.serialize = function(e) {
+ r.prototype.serialize.call(this, e);
+ }, t.Parse = function(e, n) {
+ return new t(e.name, e._generator, n, e._diameter, e._length, e._autoStart);
+ }, t;
+ }(we.a), V0 = l(151), Ua = l(98), Va = l(82);
+ ft.a.CreateDisc = function(r) {
+ var t = new Array(), e = new Array(), n = new Array(), i = new Array(), o = r.radius || 0.5, a = r.tessellation || 64, s = r.arc && (r.arc <= 0 || r.arc > 1) ? 1 : r.arc || 1, p = r.sideOrientation === 0 ? 0 : r.sideOrientation || ft.a.DEFAULTSIDE;
+ t.push(0, 0, 0), i.push(0.5, 0.5);
+ for (var m = 2 * Math.PI * s, S = s === 1 ? m / a : m / (a - 1), O = 0, I = 0; I < a; I++) {
+ var G = Math.cos(O), k = Math.sin(O), K = (G + 1) / 2, re = (1 - k) / 2;
+ t.push(o * G, o * k, 0), i.push(K, re), O += S;
+ }
+ s === 1 && (t.push(t[3], t[4], t[5]), i.push(i[2], i[3]));
+ for (var se = t.length / 3, ue = 1; ue < se - 1; ue++)
+ e.push(ue + 1, 0, ue);
+ ft.a.ComputeNormals(t, e, n), ft.a._ComputeSides(p, t, e, n, i, r.frontUVs, r.backUVs);
+ var he = new ft.a();
+ return he.indices = e, he.positions = t, he.normals = n, he.uvs = i, he;
+ }, we.a.CreateDisc = function(r, t, e, n, i, o) {
+ n === void 0 && (n = null);
+ var a = { radius: t, tessellation: e, sideOrientation: o, updatable: i };
+ return ec.CreateDisc(r, a, n);
+ };
+ var ec = function() {
+ function r() {
+ }
+ return r.CreateDisc = function(t, e, n) {
+ n === void 0 && (n = null);
+ var i = new we.a(t, n);
+ return e.sideOrientation = we.a._GetDefaultSideOrientation(e.sideOrientation), i._originalBuilderSideOrientation = e.sideOrientation, ft.a.CreateDisc(e).applyToMesh(i, e.updatable), i;
+ }, r;
+ }();
+ ft.a.CreateTiledBox = function(r) {
+ for (var t = r.faceUV || new Array(6), e = r.faceColors, n = r.pattern || we.a.NO_FLIP, i = r.width || r.size || 1, o = r.height || r.size || 1, a = r.depth || r.size || 1, s = r.tileWidth || r.tileSize || 1, p = r.tileHeight || r.tileSize || 1, m = r.alignHorizontal || 0, S = r.alignVertical || 0, O = r.sideOrientation === 0 ? 0 : r.sideOrientation || ft.a.DEFAULTSIDE, I = 0; I < 6; I++)
+ t[I] === void 0 && (t[I] = new c.f(0, 0, 1, 1)), e && e[I] === void 0 && (e[I] = new C.b(1, 1, 1, 1));
+ var G = i / 2, k = o / 2, K = a / 2, re = [];
+ for (I = 0; I < 2; I++)
+ re[I] = ft.a.CreateTiledPlane({ pattern: n, tileWidth: s, tileHeight: p, width: i, height: o, alignVertical: S, alignHorizontal: m, sideOrientation: O });
+ for (I = 2; I < 4; I++)
+ re[I] = ft.a.CreateTiledPlane({ pattern: n, tileWidth: s, tileHeight: p, width: a, height: o, alignVertical: S, alignHorizontal: m, sideOrientation: O });
+ var se = S;
+ for (S === we.a.BOTTOM ? se = we.a.TOP : S === we.a.TOP && (se = we.a.BOTTOM), I = 4; I < 6; I++)
+ re[I] = ft.a.CreateTiledPlane({ pattern: n, tileWidth: s, tileHeight: p, width: i, height: a, alignVertical: se, alignHorizontal: m, sideOrientation: O });
+ var ue = [], he = [], pe = [], ve = [], Ee = [], Ae = [], Ie = [], xe = [], Pe = 0, Ce = 0, Fe = 0;
+ for (I = 0; I < 6; I++) {
+ Pe = re[I].positions.length, Ae[I] = [], Ie[I] = [];
+ for (var Oe = 0; Oe < Pe / 3; Oe++)
+ Ae[I].push(new c.e(re[I].positions[3 * Oe], re[I].positions[3 * Oe + 1], re[I].positions[3 * Oe + 2])), Ie[I].push(new c.e(re[I].normals[3 * Oe], re[I].normals[3 * Oe + 1], re[I].normals[3 * Oe + 2]));
+ Ce = re[I].uvs.length, xe[I] = [];
+ for (var Be = 0; Be < Ce; Be += 2)
+ xe[I][Be] = t[I].x + (t[I].z - t[I].x) * re[I].uvs[Be], xe[I][Be + 1] = t[I].y + (t[I].w - t[I].y) * re[I].uvs[Be + 1];
+ if (pe = pe.concat(xe[I]), ve = ve.concat(re[I].indices.map(function(Ge) {
+ return Ge + Fe;
+ })), Fe += Ae[I].length, e)
+ for (var Le = 0; Le < 4; Le++)
+ Ee.push(e[I].r, e[I].g, e[I].b, e[I].a);
+ }
+ var Ve = new c.e(0, 0, K), Qe = c.a.RotationY(Math.PI);
+ ue = Ae[0].map(function(Ge) {
+ return c.e.TransformNormal(Ge, Qe).add(Ve);
+ }).map(function(Ge) {
+ return [Ge.x, Ge.y, Ge.z];
+ }).reduce(function(Ge, $e) {
+ return Ge.concat($e);
+ }, []), he = Ie[0].map(function(Ge) {
+ return c.e.TransformNormal(Ge, Qe);
+ }).map(function(Ge) {
+ return [Ge.x, Ge.y, Ge.z];
+ }).reduce(function(Ge, $e) {
+ return Ge.concat($e);
+ }, []), ue = ue.concat(Ae[1].map(function(Ge) {
+ return Ge.subtract(Ve);
+ }).map(function(Ge) {
+ return [Ge.x, Ge.y, Ge.z];
+ }).reduce(function(Ge, $e) {
+ return Ge.concat($e);
+ }, [])), he = he.concat(Ie[1].map(function(Ge) {
+ return [Ge.x, Ge.y, Ge.z];
+ }).reduce(function(Ge, $e) {
+ return Ge.concat($e);
+ }, []));
+ var nt = new c.e(G, 0, 0), rt = c.a.RotationY(-Math.PI / 2);
+ ue = ue.concat(Ae[2].map(function(Ge) {
+ return c.e.TransformNormal(Ge, rt).add(nt);
+ }).map(function(Ge) {
+ return [Ge.x, Ge.y, Ge.z];
+ }).reduce(function(Ge, $e) {
+ return Ge.concat($e);
+ }, [])), he = he.concat(Ie[2].map(function(Ge) {
+ return c.e.TransformNormal(Ge, rt);
+ }).map(function(Ge) {
+ return [Ge.x, Ge.y, Ge.z];
+ }).reduce(function(Ge, $e) {
+ return Ge.concat($e);
+ }, []));
+ var ut = c.a.RotationY(Math.PI / 2);
+ ue = ue.concat(Ae[3].map(function(Ge) {
+ return c.e.TransformNormal(Ge, ut).subtract(nt);
+ }).map(function(Ge) {
+ return [Ge.x, Ge.y, Ge.z];
+ }).reduce(function(Ge, $e) {
+ return Ge.concat($e);
+ }, [])), he = he.concat(Ie[3].map(function(Ge) {
+ return c.e.TransformNormal(Ge, ut);
+ }).map(function(Ge) {
+ return [Ge.x, Ge.y, Ge.z];
+ }).reduce(function(Ge, $e) {
+ return Ge.concat($e);
+ }, []));
+ var qe = new c.e(0, k, 0), at = c.a.RotationX(Math.PI / 2);
+ ue = ue.concat(Ae[4].map(function(Ge) {
+ return c.e.TransformNormal(Ge, at).add(qe);
+ }).map(function(Ge) {
+ return [Ge.x, Ge.y, Ge.z];
+ }).reduce(function(Ge, $e) {
+ return Ge.concat($e);
+ }, [])), he = he.concat(Ie[4].map(function(Ge) {
+ return c.e.TransformNormal(Ge, at);
+ }).map(function(Ge) {
+ return [Ge.x, Ge.y, Ge.z];
+ }).reduce(function(Ge, $e) {
+ return Ge.concat($e);
+ }, []));
+ var ot = c.a.RotationX(-Math.PI / 2);
+ ue = ue.concat(Ae[5].map(function(Ge) {
+ return c.e.TransformNormal(Ge, ot).subtract(qe);
+ }).map(function(Ge) {
+ return [Ge.x, Ge.y, Ge.z];
+ }).reduce(function(Ge, $e) {
+ return Ge.concat($e);
+ }, [])), he = he.concat(Ie[5].map(function(Ge) {
+ return c.e.TransformNormal(Ge, ot);
+ }).map(function(Ge) {
+ return [Ge.x, Ge.y, Ge.z];
+ }).reduce(function(Ge, $e) {
+ return Ge.concat($e);
+ }, [])), ft.a._ComputeSides(O, ue, ve, he, pe);
+ var Je = new ft.a();
+ if (Je.indices = ve, Je.positions = ue, Je.normals = he, Je.uvs = pe, e) {
+ var dt = O === ft.a.DOUBLESIDE ? Ee.concat(Ee) : Ee;
+ Je.colors = dt;
+ }
+ return Je;
+ };
+ var __ = function() {
+ function r() {
+ }
+ return r.CreateTiledBox = function(t, e, n) {
+ n === void 0 && (n = null);
+ var i = new we.a(t, n);
+ return e.sideOrientation = we.a._GetDefaultSideOrientation(e.sideOrientation), i._originalBuilderSideOrientation = e.sideOrientation, ft.a.CreateTiledBox(e).applyToMesh(i, e.updatable), i;
+ }, r;
+ }();
+ ft.a.CreateTorusKnot = function(r) {
+ var t, e, n = new Array(), i = new Array(), o = new Array(), a = new Array(), s = r.radius || 2, p = r.tube || 0.5, m = r.radialSegments || 32, S = r.tubularSegments || 32, O = r.p || 2, I = r.q || 3, G = r.sideOrientation === 0 ? 0 : r.sideOrientation || ft.a.DEFAULTSIDE, k = function(Be) {
+ var Le = Math.cos(Be), Ve = Math.sin(Be), Qe = I / O * Be, nt = Math.cos(Qe), rt = s * (2 + nt) * 0.5 * Le, ut = s * (2 + nt) * Ve * 0.5, qe = s * Math.sin(Qe) * 0.5;
+ return new c.e(rt, ut, qe);
+ };
+ for (t = 0; t <= m; t++) {
+ var K = t % m / m * 2 * O * Math.PI, re = k(K), se = k(K + 0.01), ue = se.subtract(re), he = se.add(re), pe = c.e.Cross(ue, he);
+ for (he = c.e.Cross(pe, ue), pe.normalize(), he.normalize(), e = 0; e < S; e++) {
+ var ve = e % S / S * 2 * Math.PI, Ee = -p * Math.cos(ve), Ae = p * Math.sin(ve);
+ i.push(re.x + Ee * he.x + Ae * pe.x), i.push(re.y + Ee * he.y + Ae * pe.y), i.push(re.z + Ee * he.z + Ae * pe.z), a.push(t / m), a.push(e / S);
+ }
+ }
+ for (t = 0; t < m; t++)
+ for (e = 0; e < S; e++) {
+ var Ie = (e + 1) % S, xe = t * S + e, Pe = (t + 1) * S + e, Ce = (t + 1) * S + Ie, Fe = t * S + Ie;
+ n.push(Fe), n.push(Pe), n.push(xe), n.push(Fe), n.push(Ce), n.push(Pe);
+ }
+ ft.a.ComputeNormals(i, n, o), ft.a._ComputeSides(G, i, n, o, a, r.frontUVs, r.backUVs);
+ var Oe = new ft.a();
+ return Oe.indices = n, Oe.positions = i, Oe.normals = o, Oe.uvs = a, Oe;
+ }, we.a.CreateTorusKnot = function(r, t, e, n, i, o, a, s, p, m) {
+ var S = { radius: t, tube: e, radialSegments: n, tubularSegments: i, p: o, q: a, sideOrientation: m, updatable: p };
+ return Su.CreateTorusKnot(r, S, s);
+ };
+ var Su = function() {
+ function r() {
+ }
+ return r.CreateTorusKnot = function(t, e, n) {
+ var i = new we.a(t, n);
+ return e.sideOrientation = we.a._GetDefaultSideOrientation(e.sideOrientation), i._originalBuilderSideOrientation = e.sideOrientation, ft.a.CreateTorusKnot(e).applyToMesh(i, e.updatable), i;
+ }, r;
+ }(), k0 = function(r) {
+ function t(e, n) {
+ var i = r.call(this, e.x, e.y) || this;
+ return i.index = n, i;
+ }
+ return Object(u.d)(t, r), t;
+ }(c.d), Au = function() {
+ function r() {
+ this.elements = new Array();
+ }
+ return r.prototype.add = function(t) {
+ var e = this, n = new Array();
+ return t.forEach(function(i) {
+ var o = new k0(i, e.elements.length);
+ n.push(o), e.elements.push(o);
+ }), n;
+ }, r.prototype.computeBounds = function() {
+ var t = new c.d(this.elements[0].x, this.elements[0].y), e = new c.d(this.elements[0].x, this.elements[0].y);
+ return this.elements.forEach(function(n) {
+ n.x < t.x ? t.x = n.x : n.x > e.x && (e.x = n.x), n.y < t.y ? t.y = n.y : n.y > e.y && (e.y = n.y);
+ }), { min: t, max: e, width: e.x - t.x, height: e.y - t.y };
+ }, r;
+ }(), G0 = function() {
+ function r() {
+ }
+ return r.Rectangle = function(t, e, n, i) {
+ return [new c.d(t, e), new c.d(n, e), new c.d(n, i), new c.d(t, i)];
+ }, r.Circle = function(t, e, n, i) {
+ e === void 0 && (e = 0), n === void 0 && (n = 0), i === void 0 && (i = 32);
+ for (var o = new Array(), a = 0, s = 2 * Math.PI / i, p = 0; p < i; p++)
+ o.push(new c.d(e + Math.cos(a) * t, n + Math.sin(a) * t)), a -= s;
+ return o;
+ }, r.Parse = function(t) {
+ var e, n = t.split(/[^-+eE\.\d]+/).map(parseFloat).filter(function(o) {
+ return !isNaN(o);
+ }), i = [];
+ for (e = 0; e < (2147483646 & n.length); e += 2)
+ i.push(new c.d(n[e], n[e + 1]));
+ return i;
+ }, r.StartingAt = function(t, e) {
+ return Ze.f.StartingAt(t, e);
+ }, r;
+ }(), m_ = function() {
+ function r(t, e, n, i) {
+ var o;
+ i === void 0 && (i = earcut), this._points = new Au(), this._outlinepoints = new Au(), this._holes = new Array(), this._epoints = new Array(), this._eholes = new Array(), this.bjsEarcut = i, this._name = t, this._scene = n || ke.a.LastCreatedScene, o = e instanceof Ze.f ? e.getPoints() : e, this._addToepoint(o), this._points.add(o), this._outlinepoints.add(o), this.bjsEarcut === void 0 && h.a.Warn("Earcut was not found, the polygon will not be built.");
+ }
+ return r.prototype._addToepoint = function(t) {
+ for (var e = 0, n = t; e < n.length; e++) {
+ var i = n[e];
+ this._epoints.push(i.x, i.y);
+ }
+ }, r.prototype.addHole = function(t) {
+ this._points.add(t);
+ var e = new Au();
+ return e.add(t), this._holes.push(e), this._eholes.push(this._epoints.length / 2), this._addToepoint(t), this;
+ }, r.prototype.build = function(t, e) {
+ t === void 0 && (t = !1), e === void 0 && (e = 0);
+ var n = new we.a(this._name, this._scene), i = this.buildVertexData(e);
+ return n.setVerticesData(De.b.PositionKind, i.positions, t), n.setVerticesData(De.b.NormalKind, i.normals, t), n.setVerticesData(De.b.UVKind, i.uvs, t), n.setIndices(i.indices), n;
+ }, r.prototype.buildVertexData = function(t) {
+ var e = this;
+ t === void 0 && (t = 0);
+ var n = new ft.a(), i = new Array(), o = new Array(), a = new Array(), s = this._points.computeBounds();
+ this._points.elements.forEach(function(re) {
+ i.push(0, 1, 0), o.push(re.x, 0, re.y), a.push((re.x - s.min.x) / s.width, (re.y - s.min.y) / s.height);
+ });
+ for (var p = new Array(), m = this.bjsEarcut(this._epoints, this._eholes, 2), S = 0; S < m.length; S++)
+ p.push(m[S]);
+ if (t > 0) {
+ var O = o.length / 3;
+ this._points.elements.forEach(function(re) {
+ i.push(0, -1, 0), o.push(re.x, -t, re.y), a.push(1 - (re.x - s.min.x) / s.width, 1 - (re.y - s.min.y) / s.height);
+ });
+ var I = p.length;
+ for (S = 0; S < I; S += 3) {
+ var G = p[S + 0], k = p[S + 1], K = p[S + 2];
+ p.push(K + O), p.push(k + O), p.push(G + O);
+ }
+ this.addSide(o, i, a, p, s, this._outlinepoints, t, !1), this._holes.forEach(function(re) {
+ e.addSide(o, i, a, p, s, re, t, !0);
+ });
+ }
+ return n.indices = p, n.positions = o, n.normals = i, n.uvs = a, n;
+ }, r.prototype.addSide = function(t, e, n, i, o, a, s, p) {
+ for (var m = t.length / 3, S = 0, O = 0; O < a.elements.length; O++) {
+ var I, G = a.elements[O];
+ I = O + 1 > a.elements.length - 1 ? a.elements[0] : a.elements[O + 1], t.push(G.x, 0, G.y), t.push(G.x, -s, G.y), t.push(I.x, 0, I.y), t.push(I.x, -s, I.y);
+ var k = new c.e(G.x, 0, G.y), K = new c.e(I.x, 0, I.y).subtract(k), re = new c.e(0, 1, 0), se = c.e.Cross(K, re);
+ se = se.normalize(), n.push(S / o.width, 0), n.push(S / o.width, 1), S += K.length(), n.push(S / o.width, 0), n.push(S / o.width, 1), p ? (e.push(se.x, se.y, se.z), e.push(se.x, se.y, se.z), e.push(se.x, se.y, se.z), e.push(se.x, se.y, se.z), i.push(m), i.push(m + 2), i.push(m + 1), i.push(m + 1), i.push(m + 2), i.push(m + 3)) : (e.push(-se.x, -se.y, -se.z), e.push(-se.x, -se.y, -se.z), e.push(-se.x, -se.y, -se.z), e.push(-se.x, -se.y, -se.z), i.push(m), i.push(m + 1), i.push(m + 2), i.push(m + 1), i.push(m + 3), i.push(m + 2)), m += 4;
+ }
+ }, r;
+ }();
+ ft.a.CreatePolygon = function(r, t, e, n, i, o, a) {
+ for (var s = e || new Array(3), p = n, m = [], S = a || !1, O = 0; O < 3; O++)
+ s[O] === void 0 && (s[O] = new c.f(0, 0, 1, 1)), p && p[O] === void 0 && (p[O] = new C.b(1, 1, 1, 1));
+ var I = r.getVerticesData(De.b.PositionKind), G = r.getVerticesData(De.b.NormalKind), k = r.getVerticesData(De.b.UVKind), K = r.getIndices(), re = I.length / 9, se = 0, ue = 0, he = 0, pe = 0, ve = [0];
+ if (S)
+ for (var Ee = re; Ee < I.length / 3; Ee += 4)
+ ue = I[3 * (Ee + 2)] - I[3 * Ee], he = I[3 * (Ee + 2) + 2] - I[3 * Ee + 2], pe += Math.sqrt(ue * ue + he * he), ve.push(pe);
+ Ee = 0;
+ for (var Ae = 0, Ie = 0; Ie < G.length; Ie += 3)
+ Math.abs(G[Ie + 1]) < 1e-3 && (Ae = 1), Math.abs(G[Ie + 1] - 1) < 1e-3 && (Ae = 0), Math.abs(G[Ie + 1] + 1) < 1e-3 && (Ae = 2), Ee = Ie / 3, Ae === 1 ? (se = Ee - re, k[2 * Ee] = se % 4 < 1.5 ? S ? s[Ae].x + (s[Ae].z - s[Ae].x) * ve[Math.floor(se / 4)] / pe : s[Ae].x : S ? s[Ae].x + (s[Ae].z - s[Ae].x) * ve[Math.floor(se / 4) + 1] / pe : s[Ae].z, k[2 * Ee + 1] = se % 2 == 0 ? s[Ae].w : s[Ae].y) : (k[2 * Ee] = (1 - k[2 * Ee]) * s[Ae].x + k[2 * Ee] * s[Ae].z, k[2 * Ee + 1] = (1 - k[2 * Ee + 1]) * s[Ae].y + k[2 * Ee + 1] * s[Ae].w), p && m.push(p[Ae].r, p[Ae].g, p[Ae].b, p[Ae].a);
+ ft.a._ComputeSides(t, I, K, G, k, i, o);
+ var xe = new ft.a();
+ if (xe.indices = K, xe.positions = I, xe.normals = G, xe.uvs = k, p) {
+ var Pe = t === ft.a.DOUBLESIDE ? m.concat(m) : m;
+ xe.colors = Pe;
+ }
+ return xe;
+ }, we.a.CreatePolygon = function(r, t, e, n, i, o, a) {
+ a === void 0 && (a = earcut);
+ var s = { shape: t, holes: n, updatable: i, sideOrientation: o };
+ return ka.CreatePolygon(r, s, e, a);
+ }, we.a.ExtrudePolygon = function(r, t, e, n, i, o, a, s) {
+ s === void 0 && (s = earcut);
+ var p = { shape: t, holes: i, depth: e, updatable: o, sideOrientation: a };
+ return ka.ExtrudePolygon(r, p, n, s);
+ };
+ var ka = function() {
+ function r() {
+ }
+ return r.CreatePolygon = function(t, e, n, i) {
+ n === void 0 && (n = null), i === void 0 && (i = earcut), e.sideOrientation = we.a._GetDefaultSideOrientation(e.sideOrientation);
+ for (var o = e.shape, a = e.holes || [], s = e.depth || 0, p = [], m = [], S = 0; S < o.length; S++)
+ p[S] = new c.d(o[S].x, o[S].z);
+ p[0].equalsWithEpsilon(p[p.length - 1], 1e-8) && p.pop();
+ for (var O = new m_(t, p, n || te.a.LastCreatedScene, i), I = 0; I < a.length; I++) {
+ m = [];
+ for (var G = 0; G < a[I].length; G++)
+ m.push(new c.d(a[I][G].x, a[I][G].z));
+ O.addHole(m);
+ }
+ var k = O.build(e.updatable, s);
+ return k._originalBuilderSideOrientation = e.sideOrientation, ft.a.CreatePolygon(k, e.sideOrientation, e.faceUV, e.faceColors, e.frontUVs, e.backUVs, e.wrap).applyToMesh(k, e.updatable), k;
+ }, r.ExtrudePolygon = function(t, e, n, i) {
+ return n === void 0 && (n = null), i === void 0 && (i = earcut), r.CreatePolygon(t, e, n, i);
+ }, r;
+ }();
+ we.a.CreateLathe = function(r, t, e, n, i, o, a) {
+ var s = { shape: t, radius: e, tessellation: n, sideOrientation: a, updatable: o };
+ return Pu.CreateLathe(r, s, i);
+ };
+ var Pu = function() {
+ function r() {
+ }
+ return r.CreateLathe = function(t, e, n) {
+ n === void 0 && (n = null);
+ var i, o = e.arc ? e.arc <= 0 || e.arc > 1 ? 1 : e.arc : 1, a = e.closed === void 0 || e.closed, s = e.shape, p = e.radius || 1, m = e.tessellation || 64, S = e.clip || 0, O = e.updatable, I = we.a._GetDefaultSideOrientation(e.sideOrientation), G = e.cap || we.a.NO_CAP, k = 2 * Math.PI, K = new Array(), re = e.invertUV || !1, se = 0, ue = 0, he = k / m * o, pe = new Array();
+ for (se = 0; se <= m - S; se++) {
+ for (pe = [], G != we.a.CAP_START && G != we.a.CAP_ALL || (pe.push(new c.e(0, s[0].y, 0)), pe.push(new c.e(Math.cos(se * he) * s[0].x * p, s[0].y, Math.sin(se * he) * s[0].x * p))), ue = 0; ue < s.length; ue++)
+ i = new c.e(Math.cos(se * he) * s[ue].x * p, s[ue].y, Math.sin(se * he) * s[ue].x * p), pe.push(i);
+ G != we.a.CAP_END && G != we.a.CAP_ALL || (pe.push(new c.e(Math.cos(se * he) * s[s.length - 1].x * p, s[s.length - 1].y, Math.sin(se * he) * s[s.length - 1].x * p)), pe.push(new c.e(0, s[s.length - 1].y, 0))), K.push(pe);
+ }
+ return Va.a.CreateRibbon(t, { pathArray: K, closeArray: a, sideOrientation: I, updatable: O, invertUV: re, frontUVs: e.frontUVs, backUVs: e.backUVs }, n);
+ }, r;
+ }();
+ ft.a.CreateTiledPlane = function(r) {
+ var t = r.pattern || we.a.NO_FLIP, e = r.tileWidth || r.tileSize || 1, n = r.tileHeight || r.tileSize || 1, i = r.alignHorizontal || 0, o = r.alignVertical || 0, a = r.width || r.size || 1, s = Math.floor(a / e), p = a - s * e, m = r.height || r.size || 1, S = Math.floor(m / n), O = m - S * n, I = e * s / 2, G = n * S / 2, k = 0, K = 0, re = 0, se = 0, ue = 0, he = 0;
+ if (p > 0 || O > 0) {
+ switch (re = -I, se = -G, ue = I, he = G, i) {
+ case we.a.CENTER:
+ re -= p /= 2, ue += p;
+ break;
+ case we.a.LEFT:
+ ue += p, k = -p / 2;
+ break;
+ case we.a.RIGHT:
+ re -= p, k = p / 2;
+ }
+ switch (o) {
+ case we.a.CENTER:
+ se -= O /= 2, he += O;
+ break;
+ case we.a.BOTTOM:
+ he += O, K = -O / 2;
+ break;
+ case we.a.TOP:
+ se -= O, K = O / 2;
+ }
+ }
+ var pe = [], ve = [], Ee = [];
+ Ee[0] = [0, 0, 1, 0, 1, 1, 0, 1], Ee[1] = [0, 0, 1, 0, 1, 1, 0, 1], t !== we.a.ROTATE_TILE && t !== we.a.ROTATE_ROW || (Ee[1] = [1, 1, 0, 1, 0, 0, 1, 0]), t !== we.a.FLIP_TILE && t !== we.a.FLIP_ROW || (Ee[1] = [1, 0, 0, 0, 0, 1, 1, 1]), t !== we.a.FLIP_N_ROTATE_TILE && t !== we.a.FLIP_N_ROTATE_ROW || (Ee[1] = [0, 1, 1, 1, 1, 0, 0, 0]);
+ for (var Ae = [], Ie = [], xe = [], Pe = 0, Ce = 0; Ce < S; Ce++)
+ for (var Fe = 0; Fe < s; Fe++)
+ pe.push(Fe * e - I + k, Ce * n - G + K, 0), pe.push((Fe + 1) * e - I + k, Ce * n - G + K, 0), pe.push((Fe + 1) * e - I + k, (Ce + 1) * n - G + K, 0), pe.push(Fe * e - I + k, (Ce + 1) * n - G + K, 0), xe.push(Pe, Pe + 1, Pe + 3, Pe + 1, Pe + 2, Pe + 3), Ae = t === we.a.FLIP_TILE || t === we.a.ROTATE_TILE || t === we.a.FLIP_N_ROTATE_TILE ? Ae.concat(Ee[(Fe % 2 + Ce % 2) % 2]) : t === we.a.FLIP_ROW || t === we.a.ROTATE_ROW || t === we.a.FLIP_N_ROTATE_ROW ? Ae.concat(Ee[Ce % 2]) : Ae.concat(Ee[0]), Ie.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), ve.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1), Pe += 4;
+ if (p > 0 || O > 0) {
+ var Oe, Be, Le, Ve, Qe = O > 0 && (o === we.a.CENTER || o === we.a.TOP), nt = O > 0 && (o === we.a.CENTER || o === we.a.BOTTOM), rt = p > 0 && (i === we.a.CENTER || i === we.a.RIGHT), ut = p > 0 && (i === we.a.CENTER || i === we.a.LEFT), qe = [];
+ if (Qe && rt && (pe.push(re + k, se + K, 0), pe.push(-I + k, se + K, 0), pe.push(-I + k, se + O + K, 0), pe.push(re + k, se + O + K, 0), xe.push(Pe, Pe + 1, Pe + 3, Pe + 1, Pe + 2, Pe + 3), Pe += 4, qe = [Oe = 1 - p / e, Be = 1 - O / n, Le = 1, Be, Le, Ve = 1, Oe, Ve], t === we.a.ROTATE_ROW && (qe = [1 - Oe, 1 - Be, 1 - Le, 1 - Be, 1 - Le, 1 - Ve, 1 - Oe, 1 - Ve]), t === we.a.FLIP_ROW && (qe = [1 - Oe, Be, 1 - Le, Be, 1 - Le, Ve, 1 - Oe, Ve]), t === we.a.FLIP_N_ROTATE_ROW && (qe = [Oe, 1 - Be, Le, 1 - Be, Le, 1 - Ve, Oe, 1 - Ve]), Ae = Ae.concat(qe), Ie.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), ve.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1)), Qe && ut && (pe.push(I + k, se + K, 0), pe.push(ue + k, se + K, 0), pe.push(ue + k, se + O + K, 0), pe.push(I + k, se + O + K, 0), xe.push(Pe, Pe + 1, Pe + 3, Pe + 1, Pe + 2, Pe + 3), Pe += 4, qe = [Oe = 0, Be = 1 - O / n, Le = p / e, Be, Le, Ve = 1, Oe, Ve], (t === we.a.ROTATE_ROW || t === we.a.ROTATE_TILE && s % 2 == 0) && (qe = [1 - Oe, 1 - Be, 1 - Le, 1 - Be, 1 - Le, 1 - Ve, 1 - Oe, 1 - Ve]), (t === we.a.FLIP_ROW || t === we.a.FLIP_TILE && s % 2 == 0) && (qe = [1 - Oe, Be, 1 - Le, Be, 1 - Le, Ve, 1 - Oe, Ve]), (t === we.a.FLIP_N_ROTATE_ROW || t === we.a.FLIP_N_ROTATE_TILE && s % 2 == 0) && (qe = [Oe, 1 - Be, Le, 1 - Be, Le, 1 - Ve, Oe, 1 - Ve]), Ae = Ae.concat(qe), Ie.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), ve.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1)), nt && rt && (pe.push(re + k, G + K, 0), pe.push(-I + k, G + K, 0), pe.push(-I + k, he + K, 0), pe.push(re + k, he + K, 0), xe.push(Pe, Pe + 1, Pe + 3, Pe + 1, Pe + 2, Pe + 3), Pe += 4, qe = [Oe = 1 - p / e, Be = 0, Le = 1, Be, Le, Ve = O / n, Oe, Ve], (t === we.a.ROTATE_ROW && S % 2 == 1 || t === we.a.ROTATE_TILE && S % 1 == 0) && (qe = [1 - Oe, 1 - Be, 1 - Le, 1 - Be, 1 - Le, 1 - Ve, 1 - Oe, 1 - Ve]), (t === we.a.FLIP_ROW && S % 2 == 1 || t === we.a.FLIP_TILE && S % 2 == 0) && (qe = [1 - Oe, Be, 1 - Le, Be, 1 - Le, Ve, 1 - Oe, Ve]), (t === we.a.FLIP_N_ROTATE_ROW && S % 2 == 1 || t === we.a.FLIP_N_ROTATE_TILE && S % 2 == 0) && (qe = [Oe, 1 - Be, Le, 1 - Be, Le, 1 - Ve, Oe, 1 - Ve]), Ae = Ae.concat(qe), Ie.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), ve.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1)), nt && ut && (pe.push(I + k, G + K, 0), pe.push(ue + k, G + K, 0), pe.push(ue + k, he + K, 0), pe.push(I + k, he + K, 0), xe.push(Pe, Pe + 1, Pe + 3, Pe + 1, Pe + 2, Pe + 3), Pe += 4, qe = [Oe = 0, Be = 0, Le = p / e, Be, Le, Ve = O / n, Oe, Ve], (t === we.a.ROTATE_ROW && S % 2 == 1 || t === we.a.ROTATE_TILE && (S + s) % 2 == 1) && (qe = [1 - Oe, 1 - Be, 1 - Le, 1 - Be, 1 - Le, 1 - Ve, 1 - Oe, 1 - Ve]), (t === we.a.FLIP_ROW && S % 2 == 1 || t === we.a.FLIP_TILE && (S + s) % 2 == 1) && (qe = [1 - Oe, Be, 1 - Le, Be, 1 - Le, Ve, 1 - Oe, Ve]), (t === we.a.FLIP_N_ROTATE_ROW && S % 2 == 1 || t === we.a.FLIP_N_ROTATE_TILE && (S + s) % 2 == 1) && (qe = [Oe, 1 - Be, Le, 1 - Be, Le, 1 - Ve, Oe, 1 - Ve]), Ae = Ae.concat(qe), Ie.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), ve.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1)), Qe) {
+ var at = [];
+ for (Oe = 0, Be = 1 - O / n, Le = 1, Ve = 1, at[0] = [Oe, Be, Le, Be, Le, Ve, Oe, Ve], at[1] = [Oe, Be, Le, Be, Le, Ve, Oe, Ve], t !== we.a.ROTATE_TILE && t !== we.a.ROTATE_ROW || (at[1] = [1 - Oe, 1 - Be, 1 - Le, 1 - Be, 1 - Le, 1 - Ve, 1 - Oe, 1 - Ve]), t !== we.a.FLIP_TILE && t !== we.a.FLIP_ROW || (at[1] = [1 - Oe, Be, 1 - Le, Be, 1 - Le, Ve, 1 - Oe, Ve]), t !== we.a.FLIP_N_ROTATE_TILE && t !== we.a.FLIP_N_ROTATE_ROW || (at[1] = [Oe, 1 - Be, Le, 1 - Be, Le, 1 - Ve, Oe, 1 - Ve]), Fe = 0; Fe < s; Fe++)
+ pe.push(Fe * e - I + k, se + K, 0), pe.push((Fe + 1) * e - I + k, se + K, 0), pe.push((Fe + 1) * e - I + k, se + O + K, 0), pe.push(Fe * e - I + k, se + O + K, 0), xe.push(Pe, Pe + 1, Pe + 3, Pe + 1, Pe + 2, Pe + 3), Pe += 4, Ae = t === we.a.FLIP_TILE || t === we.a.ROTATE_TILE || t === we.a.FLIP_N_ROTATE_TILE ? Ae.concat(at[(Fe + 1) % 2]) : t === we.a.FLIP_ROW || t === we.a.ROTATE_ROW || t === we.a.FLIP_N_ROTATE_ROW ? Ae.concat(at[1]) : Ae.concat(at[0]), Ie.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), ve.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);
+ }
+ if (nt) {
+ var ot = [];
+ for (Oe = 0, Be = 0, Le = 1, Ve = O / n, ot[0] = [Oe, Be, Le, Be, Le, Ve, Oe, Ve], ot[1] = [Oe, Be, Le, Be, Le, Ve, Oe, Ve], t !== we.a.ROTATE_TILE && t !== we.a.ROTATE_ROW || (ot[1] = [1 - Oe, 1 - Be, 1 - Le, 1 - Be, 1 - Le, 1 - Ve, 1 - Oe, 1 - Ve]), t !== we.a.FLIP_TILE && t !== we.a.FLIP_ROW || (ot[1] = [1 - Oe, Be, 1 - Le, Be, 1 - Le, Ve, 1 - Oe, Ve]), t !== we.a.FLIP_N_ROTATE_TILE && t !== we.a.FLIP_N_ROTATE_ROW || (ot[1] = [Oe, 1 - Be, Le, 1 - Be, Le, 1 - Ve, Oe, 1 - Ve]), Fe = 0; Fe < s; Fe++)
+ pe.push(Fe * e - I + k, he - O + K, 0), pe.push((Fe + 1) * e - I + k, he - O + K, 0), pe.push((Fe + 1) * e - I + k, he + K, 0), pe.push(Fe * e - I + k, he + K, 0), xe.push(Pe, Pe + 1, Pe + 3, Pe + 1, Pe + 2, Pe + 3), Pe += 4, Ae = t === we.a.FLIP_TILE || t === we.a.ROTATE_TILE || t === we.a.FLIP_N_ROTATE_TILE ? Ae.concat(ot[(Fe + S) % 2]) : t === we.a.FLIP_ROW || t === we.a.ROTATE_ROW || t === we.a.FLIP_N_ROTATE_ROW ? Ae.concat(ot[S % 2]) : Ae.concat(ot[0]), Ie.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), ve.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);
+ }
+ if (rt) {
+ var Je = [];
+ for (Oe = 1 - p / e, Be = 0, Le = 1, Ve = 1, Je[0] = [Oe, Be, Le, Be, Le, Ve, Oe, Ve], Je[1] = [Oe, Be, Le, Be, Le, Ve, Oe, Ve], t !== we.a.ROTATE_TILE && t !== we.a.ROTATE_ROW || (Je[1] = [1 - Oe, 1 - Be, 1 - Le, 1 - Be, 1 - Le, 1 - Ve, 1 - Oe, 1 - Ve]), t !== we.a.FLIP_TILE && t !== we.a.FLIP_ROW || (Je[1] = [1 - Oe, Be, 1 - Le, Be, 1 - Le, Ve, 1 - Oe, Ve]), t !== we.a.FLIP_N_ROTATE_TILE && t !== we.a.FLIP_N_ROTATE_ROW || (Je[1] = [Oe, 1 - Be, Le, 1 - Be, Le, 1 - Ve, Oe, 1 - Ve]), Ce = 0; Ce < S; Ce++)
+ pe.push(re + k, Ce * n - G + K, 0), pe.push(re + p + k, Ce * n - G + K, 0), pe.push(re + p + k, (Ce + 1) * n - G + K, 0), pe.push(re + k, (Ce + 1) * n - G + K, 0), xe.push(Pe, Pe + 1, Pe + 3, Pe + 1, Pe + 2, Pe + 3), Pe += 4, Ae = t === we.a.FLIP_TILE || t === we.a.ROTATE_TILE || t === we.a.FLIP_N_ROTATE_TILE ? Ae.concat(Je[(Ce + 1) % 2]) : t === we.a.FLIP_ROW || t === we.a.ROTATE_ROW || t === we.a.FLIP_N_ROTATE_ROW ? Ae.concat(Je[Ce % 2]) : Ae.concat(Je[0]), Ie.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), ve.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);
+ }
+ if (ut) {
+ var dt = [];
+ for (Oe = 0, Be = 0, Le = p / n, Ve = 1, dt[0] = [Oe, Be, Le, Be, Le, Ve, Oe, Ve], dt[1] = [Oe, Be, Le, Be, Le, Ve, Oe, Ve], t !== we.a.ROTATE_TILE && t !== we.a.ROTATE_ROW || (dt[1] = [1 - Oe, 1 - Be, 1 - Le, 1 - Be, 1 - Le, 1 - Ve, 1 - Oe, 1 - Ve]), t !== we.a.FLIP_TILE && t !== we.a.FLIP_ROW || (dt[1] = [1 - Oe, Be, 1 - Le, Be, 1 - Le, Ve, 1 - Oe, Ve]), t !== we.a.FLIP_N_ROTATE_TILE && t !== we.a.FLIP_N_ROTATE_ROW || (dt[1] = [Oe, 1 - Be, Le, 1 - Be, Le, 1 - Ve, Oe, 1 - Ve]), Ce = 0; Ce < S; Ce++)
+ pe.push(ue - p + k, Ce * n - G + K, 0), pe.push(ue + k, Ce * n - G + K, 0), pe.push(ue + k, (Ce + 1) * n - G + K, 0), pe.push(ue - p + k, (Ce + 1) * n - G + K, 0), xe.push(Pe, Pe + 1, Pe + 3, Pe + 1, Pe + 2, Pe + 3), Pe += 4, Ae = t === we.a.FLIP_TILE || t === we.a.ROTATE_TILE || t === we.a.FLIP_N_ROTATE_TILE ? Ae.concat(dt[(Ce + s) % 2]) : t === we.a.FLIP_ROW || t === we.a.ROTATE_ROW || t === we.a.FLIP_N_ROTATE_ROW ? Ae.concat(dt[Ce % 2]) : Ae.concat(dt[0]), Ie.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), ve.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);
+ }
+ }
+ var Ge = r.sideOrientation === 0 ? 0 : r.sideOrientation || ft.a.DEFAULTSIDE;
+ ft.a._ComputeSides(Ge, pe, xe, ve, Ae, r.frontUVs, r.backUVs);
+ var $e = new ft.a();
+ $e.indices = xe, $e.positions = pe, $e.normals = ve, $e.uvs = Ae;
+ var yt = Ge === ft.a.DOUBLESIDE ? Ie.concat(Ie) : Ie;
+ return $e.colors = yt, $e;
+ };
+ var g_ = function() {
+ function r() {
+ }
+ return r.CreateTiledPlane = function(t, e, n) {
+ n === void 0 && (n = null);
+ var i = new we.a(t, n);
+ return e.sideOrientation = we.a._GetDefaultSideOrientation(e.sideOrientation), i._originalBuilderSideOrientation = e.sideOrientation, ft.a.CreateTiledPlane(e).applyToMesh(i, e.updatable), i;
+ }, r;
+ }();
+ we.a.CreateTube = function(r, t, e, n, i, o, a, s, p, m) {
+ var S = { path: t, radius: e, tessellation: n, radiusFunction: i, arc: 1, cap: o, updatable: s, sideOrientation: p, instance: m };
+ return Cu.CreateTube(r, S, a);
+ };
+ var Cu = function() {
+ function r() {
+ }
+ return r.CreateTube = function(t, e, n) {
+ n === void 0 && (n = null);
+ var i = e.path, o = e.instance, a = 1;
+ e.radius !== void 0 ? a = e.radius : o && (a = o._creationDataStorage.radius);
+ var s = e.tessellation || 64, p = e.radiusFunction || null, m = e.cap || we.a.NO_CAP, S = e.invertUV || !1, O = e.updatable, I = we.a._GetDefaultSideOrientation(e.sideOrientation);
+ e.arc = e.arc && (e.arc <= 0 || e.arc > 1) ? 1 : e.arc || 1;
+ var G, k, K = function(he, pe, ve, Ee, Ae, Ie, xe, Pe) {
+ for (var Ce, Fe, Oe, Be, Le = pe.getTangents(), Ve = pe.getNormals(), Qe = pe.getDistances(), nt = 2 * Math.PI / Ae * Pe, rt = Ie || function() {
+ return Ee;
+ }, ut = c.c.Matrix[0], qe = xe === we.a.NO_CAP || xe === we.a.CAP_END ? 0 : 2, at = 0; at < he.length; at++) {
+ Fe = rt(at, Qe[at]), Ce = Array(), Oe = Ve[at];
+ for (var ot = 0; ot < Ae; ot++)
+ c.a.RotationAxisToRef(Le[at], nt * ot, ut), Be = Ce[ot] ? Ce[ot] : c.e.Zero(), c.e.TransformCoordinatesToRef(Oe, ut, Be), Be.scaleInPlace(Fe).addInPlace(he[at]), Ce[ot] = Be;
+ ve[qe] = Ce, qe++;
+ }
+ var Je = function(dt, Ge) {
+ for (var $e = Array(), yt = 0; yt < dt; yt++)
+ $e.push(he[Ge]);
+ return $e;
+ };
+ switch (xe) {
+ case we.a.NO_CAP:
+ break;
+ case we.a.CAP_START:
+ ve[0] = Je(Ae, 0), ve[1] = ve[2].slice(0);
+ break;
+ case we.a.CAP_END:
+ ve[qe] = ve[qe - 1].slice(0), ve[qe + 1] = Je(Ae, he.length - 1);
+ break;
+ case we.a.CAP_ALL:
+ ve[0] = Je(Ae, 0), ve[1] = ve[2].slice(0), ve[qe] = ve[qe - 1].slice(0), ve[qe + 1] = Je(Ae, he.length - 1);
+ }
+ return ve;
+ };
+ if (o) {
+ var re = o._creationDataStorage, se = e.arc || re.arc;
+ return k = K(i, G = re.path3D.update(i), re.pathArray, a, re.tessellation, p, re.cap, se), o = Va.a.CreateRibbon("", { pathArray: k, instance: o }), re.path3D = G, re.pathArray = k, re.arc = se, re.radius = a, o;
+ }
+ k = K(i, G = new Ze.g(i), new Array(), a, s, p, m = m < 0 || m > 3 ? 0 : m, e.arc);
+ var ue = Va.a.CreateRibbon(t, { pathArray: k, closePath: !0, closeArray: !1, updatable: O, sideOrientation: I, invertUV: S, frontUVs: e.frontUVs, backUVs: e.backUVs }, n);
+ return ue._creationDataStorage.pathArray = k, ue._creationDataStorage.path3D = G, ue._creationDataStorage.tessellation = s, ue._creationDataStorage.cap = m, ue._creationDataStorage.arc = e.arc, ue._creationDataStorage.radius = a, ue;
+ }, r;
+ }();
+ ft.a.CreateIcoSphere = function(r) {
+ var t, e = r.sideOrientation || ft.a.DEFAULTSIDE, n = r.radius || 1, i = r.flat === void 0 || r.flat, o = r.subdivisions || 4, a = r.radiusX || n, s = r.radiusY || n, p = r.radiusZ || n, m = (1 + Math.sqrt(5)) / 2, S = [-1, m, -0, 1, m, 0, -1, -m, 0, 1, -m, 0, 0, -1, -m, 0, 1, -m, 0, -1, m, 0, 1, m, m, 0, 1, m, 0, -1, -m, 0, 1, -m, 0, -1], O = [0, 11, 5, 0, 5, 1, 0, 1, 7, 0, 7, 10, 12, 22, 23, 1, 5, 20, 5, 11, 4, 23, 22, 13, 22, 18, 6, 7, 1, 8, 14, 21, 4, 14, 4, 2, 16, 13, 6, 15, 6, 19, 3, 8, 9, 4, 21, 5, 13, 17, 23, 6, 13, 22, 19, 6, 18, 9, 8, 1], I = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 2, 3, 3, 3, 4, 7, 8, 9, 9, 10, 11], G = [5, 1, 3, 1, 6, 4, 0, 0, 5, 3, 4, 2, 2, 2, 4, 0, 2, 0, 1, 1, 6, 0, 6, 2, 0, 4, 3, 3, 4, 4, 3, 1, 4, 2, 4, 4, 0, 2, 1, 1, 2, 2, 3, 3, 1, 3, 2, 4], k = [0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0], K = new Array(), re = new Array(), se = new Array(), ue = new Array(), he = 0, pe = new Array(3), ve = new Array(3);
+ for (t = 0; t < 3; t++)
+ pe[t] = c.e.Zero(), ve[t] = c.d.Zero();
+ for (var Ee = 0; Ee < 20; Ee++) {
+ for (t = 0; t < 3; t++) {
+ var Ae = O[3 * Ee + t];
+ pe[t].copyFromFloats(S[3 * I[Ae]], S[3 * I[Ae] + 1], S[3 * I[Ae] + 2]), pe[t].normalize().scaleInPlace(n), ve[t].copyFromFloats(G[2 * Ae] * (138 / 1024) + 60 / 1024 + k[Ee] * (-40 / 1024), G[2 * Ae + 1] * (239 / 1024) + 26 / 1024 + k[Ee] * (20 / 1024));
+ }
+ for (var Ie = function(Fe, Oe, Be, Le) {
+ var Ve, Qe = c.e.Lerp(pe[0], pe[2], Oe / o), nt = c.e.Lerp(pe[1], pe[2], Oe / o), rt = o === Oe ? pe[2] : c.e.Lerp(Qe, nt, Fe / (o - Oe));
+ if (rt.normalize(), i) {
+ var ut = c.e.Lerp(pe[0], pe[2], Le / o), qe = c.e.Lerp(pe[1], pe[2], Le / o);
+ Ve = c.e.Lerp(ut, qe, Be / (o - Le));
+ } else
+ Ve = new c.e(rt.x, rt.y, rt.z);
+ Ve.x /= a, Ve.y /= s, Ve.z /= p, Ve.normalize();
+ var at = c.d.Lerp(ve[0], ve[2], Oe / o), ot = c.d.Lerp(ve[1], ve[2], Oe / o), Je = o === Oe ? ve[2] : c.d.Lerp(at, ot, Fe / (o - Oe));
+ re.push(rt.x * a, rt.y * s, rt.z * p), se.push(Ve.x, Ve.y, Ve.z), ue.push(Je.x, Je.y), K.push(he), he++;
+ }, xe = 0; xe < o; xe++)
+ for (var Pe = 0; Pe + xe < o; Pe++)
+ Ie(Pe, xe, Pe + 1 / 3, xe + 1 / 3), Ie(Pe + 1, xe, Pe + 1 / 3, xe + 1 / 3), Ie(Pe, xe + 1, Pe + 1 / 3, xe + 1 / 3), Pe + xe + 1 < o && (Ie(Pe + 1, xe, Pe + 2 / 3, xe + 2 / 3), Ie(Pe + 1, xe + 1, Pe + 2 / 3, xe + 2 / 3), Ie(Pe, xe + 1, Pe + 2 / 3, xe + 2 / 3));
+ }
+ ft.a._ComputeSides(e, re, K, se, ue, r.frontUVs, r.backUVs);
+ var Ce = new ft.a();
+ return Ce.indices = K, Ce.positions = re, Ce.normals = se, Ce.uvs = ue, Ce;
+ }, we.a.CreateIcoSphere = function(r, t, e) {
+ return xu.CreateIcoSphere(r, t, e);
+ };
+ var xu = function() {
+ function r() {
+ }
+ return r.CreateIcoSphere = function(t, e, n) {
+ n === void 0 && (n = null);
+ var i = new we.a(t, n);
+ return e.sideOrientation = we.a._GetDefaultSideOrientation(e.sideOrientation), i._originalBuilderSideOrientation = e.sideOrientation, ft.a.CreateIcoSphere(e).applyToMesh(i, e.updatable), i;
+ }, r;
+ }();
+ we.a.CreateDecal = function(r, t, e, n, i, o) {
+ var a = { position: e, normal: n, size: i, angle: o };
+ return Ru.CreateDecal(r, t, a);
+ };
+ var Ru = function() {
+ function r() {
+ }
+ return r.CreateDecal = function(t, e, n) {
+ var i = e.getIndices(), o = e.getVerticesData(De.b.PositionKind), a = e.getVerticesData(De.b.NormalKind), s = n.position || c.e.Zero(), p = n.normal || c.e.Up(), m = n.size || c.e.One(), S = n.angle || 0;
+ if (!p) {
+ var O = new c.e(0, 0, 1), I = e.getScene().activeCamera, G = c.e.TransformCoordinates(O, I.getWorldMatrix());
+ p = I.globalPosition.subtract(G);
+ }
+ var k = -Math.atan2(p.z, p.x) - Math.PI / 2, K = Math.sqrt(p.x * p.x + p.z * p.z), re = Math.atan2(p.y, K), se = c.a.RotationYawPitchRoll(k, re, S).multiply(c.a.Translation(s.x, s.y, s.z)), ue = c.a.Invert(se), he = e.getWorldMatrix().multiply(ue), pe = new ft.a();
+ pe.indices = [], pe.positions = [], pe.normals = [], pe.uvs = [];
+ for (var ve = 0, Ee = function(Oe) {
+ var Be = new Ll();
+ if (!i || !o || !a)
+ return Be;
+ var Le = i[Oe];
+ return Be.position = new c.e(o[3 * Le], o[3 * Le + 1], o[3 * Le + 2]), Be.position = c.e.TransformCoordinates(Be.position, he), Be.normal = new c.e(a[3 * Le], a[3 * Le + 1], a[3 * Le + 2]), Be.normal = c.e.TransformNormal(Be.normal, he), Be;
+ }, Ae = function(Oe, Be) {
+ if (Oe.length === 0)
+ return Oe;
+ for (var Le = 0.5 * Math.abs(c.e.Dot(m, Be)), Ve = function(Ge, $e) {
+ var yt = c.e.GetClipFactor(Ge.position, $e.position, Be, Le);
+ return new Ll(c.e.Lerp(Ge.position, $e.position, yt), c.e.Lerp(Ge.normal, $e.normal, yt));
+ }, Qe = new Array(), nt = 0; nt < Oe.length; nt += 3) {
+ var rt, ut, qe, at = null, ot = null, Je = null, dt = null;
+ switch (((rt = c.e.Dot(Oe[nt].position, Be) - Le > 0) ? 1 : 0) + ((ut = c.e.Dot(Oe[nt + 1].position, Be) - Le > 0) ? 1 : 0) + ((qe = c.e.Dot(Oe[nt + 2].position, Be) - Le > 0) ? 1 : 0)) {
+ case 0:
+ Qe.push(Oe[nt]), Qe.push(Oe[nt + 1]), Qe.push(Oe[nt + 2]);
+ break;
+ case 1:
+ if (rt && (at = Oe[nt + 1], ot = Oe[nt + 2], Je = Ve(Oe[nt], at), dt = Ve(Oe[nt], ot)), ut) {
+ at = Oe[nt], ot = Oe[nt + 2], Je = Ve(Oe[nt + 1], at), dt = Ve(Oe[nt + 1], ot), Qe.push(Je), Qe.push(ot.clone()), Qe.push(at.clone()), Qe.push(ot.clone()), Qe.push(Je.clone()), Qe.push(dt);
+ break;
+ }
+ qe && (at = Oe[nt], ot = Oe[nt + 1], Je = Ve(Oe[nt + 2], at), dt = Ve(Oe[nt + 2], ot)), at && ot && Je && dt && (Qe.push(at.clone()), Qe.push(ot.clone()), Qe.push(Je), Qe.push(dt), Qe.push(Je.clone()), Qe.push(ot.clone()));
+ break;
+ case 2:
+ rt || (ot = Ve(at = Oe[nt].clone(), Oe[nt + 1]), Je = Ve(at, Oe[nt + 2]), Qe.push(at), Qe.push(ot), Qe.push(Je)), ut || (ot = Ve(at = Oe[nt + 1].clone(), Oe[nt + 2]), Je = Ve(at, Oe[nt]), Qe.push(at), Qe.push(ot), Qe.push(Je)), qe || (ot = Ve(at = Oe[nt + 2].clone(), Oe[nt]), Je = Ve(at, Oe[nt + 1]), Qe.push(at), Qe.push(ot), Qe.push(Je));
+ }
+ }
+ return Qe;
+ }, Ie = 0; Ie < i.length; Ie += 3) {
+ var xe = new Array();
+ if (xe.push(Ee(Ie)), xe.push(Ee(Ie + 1)), xe.push(Ee(Ie + 2)), xe = Ae(xe, new c.e(1, 0, 0)), xe = Ae(xe, new c.e(-1, 0, 0)), xe = Ae(xe, new c.e(0, 1, 0)), xe = Ae(xe, new c.e(0, -1, 0)), xe = Ae(xe, new c.e(0, 0, 1)), (xe = Ae(xe, new c.e(0, 0, -1))).length !== 0)
+ for (var Pe = 0; Pe < xe.length; Pe++) {
+ var Ce = xe[Pe];
+ pe.indices.push(ve), Ce.position.toArray(pe.positions, 3 * ve), Ce.normal.toArray(pe.normals, 3 * ve), pe.uvs.push(0.5 + Ce.position.x / m.x), pe.uvs.push(0.5 + Ce.position.y / m.y), ve++;
+ }
+ }
+ var Fe = new we.a(t, e.getScene());
+ return pe.applyToMesh(Fe), Fe.position = s.clone(), Fe.rotation = new c.e(re, k, S), Fe;
+ }, r;
+ }();
+ ft.a.CreateCapsule = function(r) {
+ r === void 0 && (r = { subdivisions: 2, tessellation: 16, height: 1, radius: 0.25, capSubdivisions: 6 });
+ var t, e, n = Math.max(r.subdivisions ? r.subdivisions : 2, 1), i = Math.max(r.tessellation ? r.tessellation : 16, 3), o = Math.max(r.height ? r.height : 1, 0), a = Math.max(r.radius ? r.radius : 0.25, 0), s = Math.max(r.capSubdivisions ? r.capSubdivisions : 6, 1), p = i, m = n, S = Math.max(r.radiusTop ? r.radiusTop : a, 0), O = Math.max(r.radiusBottom ? r.radiusBottom : a, 0), I = o - (S + O), G = 2 * Math.PI, k = Math.max(r.topCapSubdivisions ? r.topCapSubdivisions : s, 1), K = Math.max(r.bottomCapSubdivisions ? r.bottomCapSubdivisions : s, 1), re = Math.acos((O - S) / o), se = [], ue = [], he = [], pe = [], ve = 0, Ee = [], Ae = 0.5 * I, Ie = 0.5 * Math.PI, xe = c.e.Zero(), Pe = c.e.Zero(), Ce = Math.cos(re), Fe = Math.sin(re), Oe = new c.d(S * Fe, Ae + S * Ce).subtract(new c.d(O * Fe, O * Ce - Ae)).length(), Be = S * re + Oe + O * (Ie - re), Le = 0;
+ for (e = 0; e <= k; e++) {
+ var Ve = [], Qe = Ie - re * (e / k);
+ Le += S * re / k;
+ var nt = Math.cos(Qe), rt = Math.sin(Qe), ut = nt * S;
+ for (t = 0; t <= p; t++) {
+ var qe = (Ge = t / p) * G + 0, at = Math.sin(qe), ot = Math.cos(qe);
+ Pe.x = ut * at, Pe.y = Ae + rt * S, Pe.z = ut * ot, ue.push(Pe.x, Pe.y, Pe.z), xe.set(nt * at, rt, nt * ot), he.push(xe.x, xe.y, xe.z), pe.push(Ge, 1 - Le / Be), Ve.push(ve), ve++;
+ }
+ Ee.push(Ve);
+ }
+ var Je = o - S - O + Ce * S - Ce * O, dt = Fe * (O - S) / Je;
+ for (e = 1; e <= m; e++) {
+ for (Ve = [], Le += Oe / m, ut = Fe * (e * (O - S) / m + S), t = 0; t <= p; t++)
+ qe = (Ge = t / p) * G + 0, at = Math.sin(qe), ot = Math.cos(qe), Pe.x = ut * at, Pe.y = Ae + Ce * S - e * Je / m, Pe.z = ut * ot, ue.push(Pe.x, Pe.y, Pe.z), xe.set(at, dt, ot).normalize(), he.push(xe.x, xe.y, xe.z), pe.push(Ge, 1 - Le / Be), Ve.push(ve), ve++;
+ Ee.push(Ve);
+ }
+ for (e = 1; e <= K; e++) {
+ for (Ve = [], Qe = Ie - re - (Math.PI - re) * (e / K), Le += O * re / K, nt = Math.cos(Qe), rt = Math.sin(Qe), ut = nt * O, t = 0; t <= p; t++) {
+ var Ge;
+ qe = (Ge = t / p) * G + 0, at = Math.sin(qe), ot = Math.cos(qe), Pe.x = ut * at, Pe.y = rt * O - Ae, Pe.z = ut * ot, ue.push(Pe.x, Pe.y, Pe.z), xe.set(nt * at, rt, nt * ot), he.push(xe.x, xe.y, xe.z), pe.push(Ge, 1 - Le / Be), Ve.push(ve), ve++;
+ }
+ Ee.push(Ve);
+ }
+ for (t = 0; t < p; t++)
+ for (e = 0; e < k + m + K; e++) {
+ var $e = Ee[e][t], yt = Ee[e + 1][t], Jt = Ee[e + 1][t + 1], Bt = Ee[e][t + 1];
+ se.push($e), se.push(yt), se.push(Bt), se.push(yt), se.push(Jt), se.push(Bt);
+ }
+ if (se = se.reverse(), r.orientation && !r.orientation.equals(c.e.Up())) {
+ var rn = new c.a();
+ r.orientation.clone().scale(0.5 * Math.PI).cross(c.e.Up()).toQuaternion().toRotationMatrix(rn);
+ for (var vt = c.e.Zero(), sn = 0; sn < ue.length; sn += 3)
+ vt.set(ue[sn], ue[sn + 1], ue[sn + 2]), c.e.TransformCoordinatesToRef(vt.clone(), rn, vt), ue[sn] = vt.x, ue[sn + 1] = vt.y, ue[sn + 2] = vt.z;
+ }
+ var $t = new ft.a();
+ return $t.positions = ue, $t.normals = he, $t.uvs = pe, $t.indices = se, $t;
+ }, we.a.CreateCapsule = function(r, t, e) {
+ return Ou.CreateCapsule(r, t, e);
+ };
+ var Ga, Ou = function() {
+ function r() {
+ }
+ return r.CreateCapsule = function(t, e, n) {
+ e === void 0 && (e = { orientation: c.e.Up(), subdivisions: 2, tessellation: 16, height: 1, radius: 0.25, capSubdivisions: 6 });
+ var i = new we.a(t, n);
+ return ft.a.CreateCapsule(e).applyToMesh(i), i;
+ }, r;
+ }(), z0 = function() {
+ function r() {
+ }
+ return r.CreateBox = function(t, e, n) {
+ return n === void 0 && (n = null), So.a.CreateBox(t, e, n);
+ }, r.CreateTiledBox = function(t, e, n) {
+ return n === void 0 && (n = null), __.CreateTiledBox(t, e, n);
+ }, r.CreateSphere = function(t, e, n) {
+ return n === void 0 && (n = null), Qn.a.CreateSphere(t, e, n);
+ }, r.CreateDisc = function(t, e, n) {
+ return n === void 0 && (n = null), ec.CreateDisc(t, e, n);
+ }, r.CreateIcoSphere = function(t, e, n) {
+ return n === void 0 && (n = null), xu.CreateIcoSphere(t, e, n);
+ }, r.CreateRibbon = function(t, e, n) {
+ return n === void 0 && (n = null), Va.a.CreateRibbon(t, e, n);
+ }, r.CreateCylinder = function(t, e, n) {
+ return n === void 0 && (n = null), Vi.a.CreateCylinder(t, e, n);
+ }, r.CreateTorus = function(t, e, n) {
+ return n === void 0 && (n = null), bo.CreateTorus(t, e, n);
+ }, r.CreateTorusKnot = function(t, e, n) {
+ return n === void 0 && (n = null), Su.CreateTorusKnot(t, e, n);
+ }, r.CreateLineSystem = function(t, e, n) {
+ return yn.a.CreateLineSystem(t, e, n);
+ }, r.CreateLines = function(t, e, n) {
+ return n === void 0 && (n = null), yn.a.CreateLines(t, e, n);
+ }, r.CreateDashedLines = function(t, e, n) {
+ return n === void 0 && (n = null), yn.a.CreateDashedLines(t, e, n);
+ }, r.ExtrudeShape = function(t, e, n) {
+ return n === void 0 && (n = null), Gs.a.ExtrudeShape(t, e, n);
+ }, r.ExtrudeShapeCustom = function(t, e, n) {
+ return n === void 0 && (n = null), Gs.a.ExtrudeShapeCustom(t, e, n);
+ }, r.CreateLathe = function(t, e, n) {
+ return n === void 0 && (n = null), Pu.CreateLathe(t, e, n);
+ }, r.CreateTiledPlane = function(t, e, n) {
+ return n === void 0 && (n = null), g_.CreateTiledPlane(t, e, n);
+ }, r.CreatePlane = function(t, e, n) {
+ return n === void 0 && (n = null), Ml.a.CreatePlane(t, e, n);
+ }, r.CreateGround = function(t, e, n) {
+ return n === void 0 && (n = null), gr.CreateGround(t, e, n);
+ }, r.CreateTiledGround = function(t, e, n) {
+ return n === void 0 && (n = null), gr.CreateTiledGround(t, e, n);
+ }, r.CreateGroundFromHeightMap = function(t, e, n, i) {
+ return i === void 0 && (i = null), gr.CreateGroundFromHeightMap(t, e, n, i);
+ }, r.CreatePolygon = function(t, e, n, i) {
+ return n === void 0 && (n = null), i === void 0 && (i = earcut), ka.CreatePolygon(t, e, n, i);
+ }, r.ExtrudePolygon = function(t, e, n, i) {
+ return n === void 0 && (n = null), i === void 0 && (i = earcut), ka.ExtrudePolygon(t, e, n, i);
+ }, r.CreateTube = function(t, e, n) {
+ return n === void 0 && (n = null), Cu.CreateTube(t, e, n);
+ }, r.CreatePolyhedron = function(t, e, n) {
+ return n === void 0 && (n = null), Ta.CreatePolyhedron(t, e, n);
+ }, r.CreateDecal = function(t, e, n) {
+ return Ru.CreateDecal(t, e, n);
+ }, r.CreateCapsule = function(t, e, n) {
+ return e === void 0 && (e = { orientation: c.e.Up(), subdivisions: 2, tessellation: 16, height: 1, radius: 0.25, capSubdivisions: 6 }), n === void 0 && (n = null), Ou.CreateCapsule(t, e, n);
+ }, r;
+ }(), j0 = function(r, t, e) {
+ this.quality = r, this.distance = t, this.optimizeMesh = e;
+ }, v_ = function() {
+ function r() {
+ this.running = !1, this._simplificationArray = [];
+ }
+ return r.prototype.addTask = function(t) {
+ this._simplificationArray.push(t);
+ }, r.prototype.executeNext = function() {
+ var t = this._simplificationArray.pop();
+ t ? (this.running = !0, this.runSimplification(t)) : this.running = !1;
+ }, r.prototype.runSimplification = function(t) {
+ var e = this;
+ if (t.parallelProcessing)
+ t.settings.forEach(function(i) {
+ e.getSimplifier(t).simplify(i, function(o) {
+ i.distance !== void 0 && t.mesh.addLODLevel(i.distance, o), o.isVisible = !0, i.quality === t.settings[t.settings.length - 1].quality && t.successCallback && t.successCallback(), e.executeNext();
+ });
+ });
+ else {
+ var n = this.getSimplifier(t);
+ Ke.a.Run(t.settings.length, function(i) {
+ var o, a;
+ o = t.settings[i.index], a = function() {
+ i.executeNext();
+ }, n.simplify(o, function(s) {
+ o.distance !== void 0 && t.mesh.addLODLevel(o.distance, s), s.isVisible = !0, a();
+ });
+ }, function() {
+ t.successCallback && t.successCallback(), e.executeNext();
+ });
+ }
+ }, r.prototype.getSimplifier = function(t) {
+ switch (t.simplificationType) {
+ case Ga.QUADRATIC:
+ default:
+ return new y_(t.mesh);
+ }
+ }, r;
+ }();
+ (function(r) {
+ r[r.QUADRATIC = 0] = "QUADRATIC";
+ })(Ga || (Ga = {}));
+ var H0 = function(r) {
+ this.vertices = r, this.error = new Array(4), this.deleted = !1, this.isDirty = !1, this.deletePending = !1, this.borderFactor = 0;
+ }, W0 = function() {
+ function r(t, e) {
+ this.position = t, this.id = e, this.isBorder = !0, this.q = new b_(), this.triangleCount = 0, this.triangleStart = 0, this.originalOffsets = [];
+ }
+ return r.prototype.updatePosition = function(t) {
+ this.position.copyFrom(t);
+ }, r;
+ }(), b_ = function() {
+ function r(t) {
+ this.data = new Array(10);
+ for (var e = 0; e < 10; ++e)
+ t && t[e] ? this.data[e] = t[e] : this.data[e] = 0;
+ }
+ return r.prototype.det = function(t, e, n, i, o, a, s, p, m) {
+ return this.data[t] * this.data[o] * this.data[m] + this.data[n] * this.data[i] * this.data[p] + this.data[e] * this.data[a] * this.data[s] - this.data[n] * this.data[o] * this.data[s] - this.data[t] * this.data[a] * this.data[p] - this.data[e] * this.data[i] * this.data[m];
+ }, r.prototype.addInPlace = function(t) {
+ for (var e = 0; e < 10; ++e)
+ this.data[e] += t.data[e];
+ }, r.prototype.addArrayInPlace = function(t) {
+ for (var e = 0; e < 10; ++e)
+ this.data[e] += t[e];
+ }, r.prototype.add = function(t) {
+ for (var e = new r(), n = 0; n < 10; ++n)
+ e.data[n] = this.data[n] + t.data[n];
+ return e;
+ }, r.FromData = function(t, e, n, i) {
+ return new r(r.DataFromNumbers(t, e, n, i));
+ }, r.DataFromNumbers = function(t, e, n, i) {
+ return [t * t, t * e, t * n, t * i, e * e, e * n, e * i, n * n, n * i, i * i];
+ }, r;
+ }(), X0 = function(r, t) {
+ this.vertexId = r, this.triangleId = t;
+ }, y_ = function() {
+ function r(t) {
+ this._mesh = t, this.syncIterations = 5e3, this.aggressiveness = 7, this.decimationIterations = 100, this.boundingBoxEpsilon = Xt.a;
+ }
+ return r.prototype.simplify = function(t, e) {
+ var n = this;
+ this.initDecimatedMesh(), Ke.a.Run(this._mesh.subMeshes.length, function(i) {
+ n.initWithMesh(i.index, function() {
+ n.runDecimation(t, i.index, function() {
+ i.executeNext();
+ });
+ }, t.optimizeMesh);
+ }, function() {
+ setTimeout(function() {
+ e(n._reconstructedMesh);
+ }, 0);
+ });
+ }, r.prototype.runDecimation = function(t, e, n) {
+ var i = this, o = ~~(this.triangles.length * t.quality), a = 0, s = this.triangles.length;
+ Ke.a.Run(this.decimationIterations, function(p) {
+ var m, S;
+ s - a <= o ? p.breakLoop() : (m = p.index, S = function() {
+ p.executeNext();
+ }, setTimeout(function() {
+ m % 5 == 0 && i.updateMesh(m === 0);
+ for (var O = 0; O < i.triangles.length; ++O)
+ i.triangles[O].isDirty = !1;
+ var I = 1e-9 * Math.pow(m + 3, i.aggressiveness);
+ Ke.a.SyncAsyncForLoop(i.triangles.length, i.syncIterations, function(G) {
+ var k = ~~((i.triangles.length / 2 + G) % i.triangles.length), K = i.triangles[k];
+ if (K && !(K.error[3] > I || K.deleted || K.isDirty)) {
+ for (var re = 0; re < 3; ++re)
+ if (K.error[re] < I) {
+ var se = [], ue = [], he = K.vertices[re], pe = K.vertices[(re + 1) % 3];
+ if (he.isBorder || pe.isBorder)
+ continue;
+ var ve = c.e.Zero();
+ i.calculateError(he, pe, ve);
+ var Ee = new Array();
+ if (i.isFlipped(he, pe, ve, se, Ee) || i.isFlipped(pe, he, ve, ue, Ee) || se.indexOf(!0) < 0 || ue.indexOf(!0) < 0)
+ continue;
+ var Ae = new Array();
+ if (Ee.forEach(function(Ce) {
+ Ae.indexOf(Ce) === -1 && (Ce.deletePending = !0, Ae.push(Ce));
+ }), Ae.length % 2 != 0)
+ continue;
+ he.q = pe.q.add(he.q), he.updatePosition(ve);
+ var Ie = i.references.length;
+ a = i.updateTriangles(he, he, se, a), a = i.updateTriangles(he, pe, ue, a);
+ var xe = i.references.length - Ie;
+ if (xe <= he.triangleCount) {
+ if (xe)
+ for (var Pe = 0; Pe < xe; Pe++)
+ i.references[he.triangleStart + Pe] = i.references[Ie + Pe];
+ } else
+ he.triangleStart = Ie;
+ he.triangleCount = xe;
+ break;
+ }
+ }
+ }, S, function() {
+ return s - a <= o;
+ });
+ }, 0));
+ }, function() {
+ setTimeout(function() {
+ i.reconstructMesh(e), n();
+ }, 0);
+ });
+ }, r.prototype.initWithMesh = function(t, e, n) {
+ var i = this;
+ this.vertices = [], this.triangles = [];
+ var o = this._mesh.getVerticesData(De.b.PositionKind), a = this._mesh.getIndices(), s = this._mesh.subMeshes[t], p = [], m = s.verticesCount;
+ Ke.a.SyncAsyncForLoop(m, this.syncIterations / 4 >> 0, function(S) {
+ if (o) {
+ var O = S + s.verticesStart, I = c.e.FromArray(o, 3 * O), G = function(k) {
+ if (n) {
+ for (var K = 0; K < i.vertices.length; ++K)
+ if (i.vertices[K].position.equalsWithEpsilon(k, 1e-4))
+ return i.vertices[K];
+ }
+ return null;
+ }(I) || new W0(I, i.vertices.length);
+ G.originalOffsets.push(O), G.id === i.vertices.length && i.vertices.push(G), p.push(G.id);
+ }
+ }, function() {
+ Ke.a.SyncAsyncForLoop(s.indexCount / 3, i.syncIterations, function(S) {
+ if (a) {
+ var O = 3 * (s.indexStart / 3 + S), I = a[O + 0], G = a[O + 1], k = a[O + 2], K = i.vertices[p[I - s.verticesStart]], re = i.vertices[p[G - s.verticesStart]], se = i.vertices[p[k - s.verticesStart]], ue = new H0([K, re, se]);
+ ue.originalOffset = O, i.triangles.push(ue);
+ }
+ }, function() {
+ i.init(e);
+ });
+ });
+ }, r.prototype.init = function(t) {
+ var e = this;
+ Ke.a.SyncAsyncForLoop(this.triangles.length, this.syncIterations, function(n) {
+ var i = e.triangles[n];
+ i.normal = c.e.Cross(i.vertices[1].position.subtract(i.vertices[0].position), i.vertices[2].position.subtract(i.vertices[0].position)).normalize();
+ for (var o = 0; o < 3; o++)
+ i.vertices[o].q.addArrayInPlace(b_.DataFromNumbers(i.normal.x, i.normal.y, i.normal.z, -c.e.Dot(i.normal, i.vertices[0].position)));
+ }, function() {
+ Ke.a.SyncAsyncForLoop(e.triangles.length, e.syncIterations, function(n) {
+ for (var i = e.triangles[n], o = 0; o < 3; ++o)
+ i.error[o] = e.calculateError(i.vertices[o], i.vertices[(o + 1) % 3]);
+ i.error[3] = Math.min(i.error[0], i.error[1], i.error[2]);
+ }, function() {
+ t();
+ });
+ });
+ }, r.prototype.reconstructMesh = function(t) {
+ var e, n, i, o = [];
+ for (e = 0; e < this.vertices.length; ++e)
+ this.vertices[e].triangleCount = 0;
+ for (e = 0; e < this.triangles.length; ++e)
+ if (!this.triangles[e].deleted) {
+ for (n = this.triangles[e], i = 0; i < 3; ++i)
+ n.vertices[i].triangleCount = 1;
+ o.push(n);
+ }
+ var a = this._reconstructedMesh.getVerticesData(De.b.PositionKind) || [], s = this._reconstructedMesh.getVerticesData(De.b.NormalKind) || [], p = this._reconstructedMesh.getVerticesData(De.b.UVKind) || [], m = this._reconstructedMesh.getVerticesData(De.b.ColorKind) || [], S = this._mesh.getVerticesData(De.b.NormalKind), O = this._mesh.getVerticesData(De.b.UVKind), I = this._mesh.getVerticesData(De.b.ColorKind), G = 0;
+ for (e = 0; e < this.vertices.length; ++e) {
+ var k = this.vertices[e];
+ k.id = G, k.triangleCount && k.originalOffsets.forEach(function(ve) {
+ a.push(k.position.x), a.push(k.position.y), a.push(k.position.z), S && S.length && (s.push(S[3 * ve]), s.push(S[3 * ve + 1]), s.push(S[3 * ve + 2])), O && O.length && (p.push(O[2 * ve]), p.push(O[2 * ve + 1])), I && I.length && (m.push(I[4 * ve]), m.push(I[4 * ve + 1]), m.push(I[4 * ve + 2]), m.push(I[4 * ve + 3])), ++G;
+ });
+ }
+ var K = this._reconstructedMesh.getTotalIndices(), re = this._reconstructedMesh.getTotalVertices(), se = this._reconstructedMesh.subMeshes;
+ this._reconstructedMesh.subMeshes = [];
+ var ue = this._reconstructedMesh.getIndices(), he = this._mesh.getIndices();
+ for (e = 0; e < o.length; ++e)
+ n = o[e], [0, 1, 2].forEach(function(ve) {
+ var Ee = he[n.originalOffset + ve], Ae = n.vertices[ve].originalOffsets.indexOf(Ee);
+ Ae < 0 && (Ae = 0), ue.push(n.vertices[ve].id + Ae + re);
+ });
+ this._reconstructedMesh.setIndices(ue), this._reconstructedMesh.setVerticesData(De.b.PositionKind, a), s.length > 0 && this._reconstructedMesh.setVerticesData(De.b.NormalKind, s), p.length > 0 && this._reconstructedMesh.setVerticesData(De.b.UVKind, p), m.length > 0 && this._reconstructedMesh.setVerticesData(De.b.ColorKind, m);
+ var pe = this._mesh.subMeshes[t];
+ t > 0 && (this._reconstructedMesh.subMeshes = [], se.forEach(function(ve) {
+ Ba.a.AddToMesh(ve.materialIndex, ve.verticesStart, ve.verticesCount, ve.indexStart, ve.indexCount, ve.getMesh());
+ }), Ba.a.AddToMesh(pe.materialIndex, re, G, K, 3 * o.length, this._reconstructedMesh));
+ }, r.prototype.initDecimatedMesh = function() {
+ this._reconstructedMesh = new we.a(this._mesh.name + "Decimated", this._mesh.getScene()), this._reconstructedMesh.material = this._mesh.material, this._reconstructedMesh.parent = this._mesh.parent, this._reconstructedMesh.isVisible = !1, this._reconstructedMesh.renderingGroupId = this._mesh.renderingGroupId;
+ }, r.prototype.isFlipped = function(t, e, n, i, o) {
+ for (var a = 0; a < t.triangleCount; ++a) {
+ var s = this.triangles[this.references[t.triangleStart + a].triangleId];
+ if (!s.deleted) {
+ var p = this.references[t.triangleStart + a].vertexId, m = s.vertices[(p + 1) % 3], S = s.vertices[(p + 2) % 3];
+ if (m !== e && S !== e) {
+ var O = m.position.subtract(n);
+ O = O.normalize();
+ var I = S.position.subtract(n);
+ if (I = I.normalize(), Math.abs(c.e.Dot(O, I)) > 0.999)
+ return !0;
+ var G = c.e.Cross(O, I).normalize();
+ if (i[a] = !1, c.e.Dot(G, s.normal) < 0.2)
+ return !0;
+ } else
+ i[a] = !0, o.push(s);
+ }
+ }
+ return !1;
+ }, r.prototype.updateTriangles = function(t, e, n, i) {
+ for (var o = i, a = 0; a < e.triangleCount; ++a) {
+ var s = this.references[e.triangleStart + a], p = this.triangles[s.triangleId];
+ p.deleted || (n[a] && p.deletePending ? (p.deleted = !0, o++) : (p.vertices[s.vertexId] = t, p.isDirty = !0, p.error[0] = this.calculateError(p.vertices[0], p.vertices[1]) + p.borderFactor / 2, p.error[1] = this.calculateError(p.vertices[1], p.vertices[2]) + p.borderFactor / 2, p.error[2] = this.calculateError(p.vertices[2], p.vertices[0]) + p.borderFactor / 2, p.error[3] = Math.min(p.error[0], p.error[1], p.error[2]), this.references.push(s)));
+ }
+ return o;
+ }, r.prototype.identifyBorder = function() {
+ for (var t = 0; t < this.vertices.length; ++t) {
+ var e, n = [], i = [], o = this.vertices[t];
+ for (e = 0; e < o.triangleCount; ++e)
+ for (var a = this.triangles[this.references[o.triangleStart + e].triangleId], s = 0; s < 3; s++) {
+ for (var p = 0, m = a.vertices[s]; p < n.length && i[p] !== m.id; )
+ ++p;
+ p === n.length ? (n.push(1), i.push(m.id)) : n[p]++;
+ }
+ for (e = 0; e < n.length; ++e)
+ n[e] === 1 ? this.vertices[i[e]].isBorder = !0 : this.vertices[i[e]].isBorder = !1;
+ }
+ }, r.prototype.updateMesh = function(t) {
+ var e, n, i, o;
+ if (t === void 0 && (t = !1), !t) {
+ var a = [];
+ for (e = 0; e < this.triangles.length; ++e)
+ this.triangles[e].deleted || a.push(this.triangles[e]);
+ this.triangles = a;
+ }
+ for (e = 0; e < this.vertices.length; ++e)
+ this.vertices[e].triangleCount = 0, this.vertices[e].triangleStart = 0;
+ for (e = 0; e < this.triangles.length; ++e)
+ for (n = this.triangles[e], i = 0; i < 3; ++i)
+ (o = n.vertices[i]).triangleCount++;
+ var s = 0;
+ for (e = 0; e < this.vertices.length; ++e)
+ this.vertices[e].triangleStart = s, s += this.vertices[e].triangleCount, this.vertices[e].triangleCount = 0;
+ var p = new Array(3 * this.triangles.length);
+ for (e = 0; e < this.triangles.length; ++e)
+ for (n = this.triangles[e], i = 0; i < 3; ++i)
+ p[(o = n.vertices[i]).triangleStart + o.triangleCount] = new X0(i, e), o.triangleCount++;
+ this.references = p, t && this.identifyBorder();
+ }, r.prototype.vertexError = function(t, e) {
+ var n = e.x, i = e.y, o = e.z;
+ return t.data[0] * n * n + 2 * t.data[1] * n * i + 2 * t.data[2] * n * o + 2 * t.data[3] * n + t.data[4] * i * i + 2 * t.data[5] * i * o + 2 * t.data[6] * i + t.data[7] * o * o + 2 * t.data[8] * o + t.data[9];
+ }, r.prototype.calculateError = function(t, e, n) {
+ var i = t.q.add(e.q), o = t.isBorder && e.isBorder, a = 0, s = i.det(0, 1, 2, 1, 4, 5, 2, 5, 7);
+ if (s === 0 || o) {
+ var p = t.position.add(e.position).divide(new c.e(2, 2, 2)), m = this.vertexError(i, t.position), S = this.vertexError(i, e.position), O = this.vertexError(i, p);
+ (a = Math.min(m, S, O)) === m ? n && n.copyFrom(t.position) : a === S ? n && n.copyFrom(e.position) : n && n.copyFrom(p);
+ } else
+ n || (n = c.e.Zero()), n.x = -1 / s * i.det(1, 2, 3, 4, 5, 6, 5, 7, 8), n.y = 1 / s * i.det(0, 2, 3, 1, 5, 6, 2, 7, 8), n.z = -1 / s * i.det(0, 1, 3, 1, 4, 6, 2, 5, 8), a = this.vertexError(i, n);
+ return a;
+ }, r;
+ }();
+ Object.defineProperty(ge.a.prototype, "simplificationQueue", { get: function() {
+ if (!this._simplificationQueue) {
+ this._simplificationQueue = new v_();
+ var r = this._getComponent(st.a.NAME_SIMPLIFICATIONQUEUE);
+ r || (r = new E_(this), this._addComponent(r));
+ }
+ return this._simplificationQueue;
+ }, set: function(r) {
+ this._simplificationQueue = r;
+ }, enumerable: !0, configurable: !0 }), we.a.prototype.simplify = function(r, t, e, n) {
+ return t === void 0 && (t = !0), e === void 0 && (e = Ga.QUADRATIC), this.getScene().simplificationQueue.addTask({ settings: r, parallelProcessing: t, mesh: this, simplificationType: e, successCallback: n }), this;
+ };
+ var E_ = function() {
+ function r(t) {
+ this.name = st.a.NAME_SIMPLIFICATIONQUEUE, this.scene = t;
+ }
+ return r.prototype.register = function() {
+ this.scene._beforeCameraUpdateStage.registerStep(st.a.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE, this, this._beforeCameraUpdate);
+ }, r.prototype.rebuild = function() {
+ }, r.prototype.dispose = function() {
+ }, r.prototype._beforeCameraUpdate = function() {
+ this.scene._simplificationQueue && !this.scene._simplificationQueue.running && this.scene._simplificationQueue.executeNext();
+ }, r;
+ }(), Y0 = l(149), K0 = l(88);
+ we.a.prototype.thinInstanceAdd = function(r, t) {
+ t === void 0 && (t = !0), this._thinInstanceUpdateBufferSize("matrix", Array.isArray(r) ? r.length : 1);
+ var e = this._thinInstanceDataStorage.instancesCount;
+ if (Array.isArray(r))
+ for (var n = 0; n < r.length; ++n)
+ this.thinInstanceSetMatrixAt(this._thinInstanceDataStorage.instancesCount++, r[n], n === r.length - 1 && t);
+ else
+ this.thinInstanceSetMatrixAt(this._thinInstanceDataStorage.instancesCount++, r, t);
+ return e;
+ }, we.a.prototype.thinInstanceAddSelf = function(r) {
+ return r === void 0 && (r = !0), this.thinInstanceAdd(c.a.IdentityReadOnly, r);
+ }, we.a.prototype.thinInstanceRegisterAttribute = function(r, t) {
+ this.removeVerticesData(r), this._thinInstanceInitializeUserStorage(), this._userThinInstanceBuffersStorage.strides[r] = t, this._userThinInstanceBuffersStorage.sizes[r] = t * Math.max(32, this._thinInstanceDataStorage.instancesCount), this._userThinInstanceBuffersStorage.data[r] = new Float32Array(this._userThinInstanceBuffersStorage.sizes[r]), this._userThinInstanceBuffersStorage.vertexBuffers[r] = new De.b(this.getEngine(), this._userThinInstanceBuffersStorage.data[r], r, !0, !1, t, !0), this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[r]);
+ }, we.a.prototype.thinInstanceSetMatrixAt = function(r, t, e) {
+ if (e === void 0 && (e = !0), !this._thinInstanceDataStorage.matrixData || r >= this._thinInstanceDataStorage.instancesCount)
+ return !1;
+ var n = this._thinInstanceDataStorage.matrixData;
+ return t.copyToArray(n, 16 * r), this._thinInstanceDataStorage.worldMatrices && (this._thinInstanceDataStorage.worldMatrices[r] = t), e && (this.thinInstanceBufferUpdated("matrix"), this.doNotSyncBoundingInfo || this.thinInstanceRefreshBoundingInfo(!1)), !0;
+ }, we.a.prototype.thinInstanceSetAttributeAt = function(r, t, e, n) {
+ return n === void 0 && (n = !0), !(!this._userThinInstanceBuffersStorage || !this._userThinInstanceBuffersStorage.data[r] || t >= this._thinInstanceDataStorage.instancesCount) && (this._thinInstanceUpdateBufferSize(r, 0), this._userThinInstanceBuffersStorage.data[r].set(e, t * this._userThinInstanceBuffersStorage.strides[r]), n && this.thinInstanceBufferUpdated(r), !0);
+ }, Object.defineProperty(we.a.prototype, "thinInstanceCount", { get: function() {
+ return this._thinInstanceDataStorage.instancesCount;
+ }, set: function(r) {
+ var t, e;
+ r <= ((e = (t = this._thinInstanceDataStorage.matrixData) === null || t === void 0 ? void 0 : t.length) !== null && e !== void 0 ? e : 0) / 16 && (this._thinInstanceDataStorage.instancesCount = r);
+ }, enumerable: !0, configurable: !0 }), we.a.prototype.thinInstanceSetBuffer = function(r, t, e, n) {
+ var i, o;
+ if (e === void 0 && (e = 0), n === void 0 && (n = !1), e = e || 16, r === "matrix")
+ if ((i = this._thinInstanceDataStorage.matrixBuffer) === null || i === void 0 || i.dispose(), this._thinInstanceDataStorage.matrixBuffer = null, this._thinInstanceDataStorage.matrixBufferSize = t ? t.length : 32 * e, this._thinInstanceDataStorage.matrixData = t, this._thinInstanceDataStorage.worldMatrices = null, t !== null) {
+ this._thinInstanceDataStorage.instancesCount = t.length / e;
+ var a = new De.a(this.getEngine(), t, !n, e, !1, !0);
+ this._thinInstanceDataStorage.matrixBuffer = a, this.setVerticesBuffer(a.createVertexBuffer("world0", 0, 4)), this.setVerticesBuffer(a.createVertexBuffer("world1", 4, 4)), this.setVerticesBuffer(a.createVertexBuffer("world2", 8, 4)), this.setVerticesBuffer(a.createVertexBuffer("world3", 12, 4)), this.doNotSyncBoundingInfo || this.thinInstanceRefreshBoundingInfo(!1);
+ } else
+ this._thinInstanceDataStorage.instancesCount = 0, this.doNotSyncBoundingInfo || this.refreshBoundingInfo(!0);
+ else
+ t === null ? !((o = this._userThinInstanceBuffersStorage) === null || o === void 0) && o.data[r] && (this.removeVerticesData(r), delete this._userThinInstanceBuffersStorage.data[r], delete this._userThinInstanceBuffersStorage.strides[r], delete this._userThinInstanceBuffersStorage.sizes[r], delete this._userThinInstanceBuffersStorage.vertexBuffers[r]) : (this._thinInstanceInitializeUserStorage(), this._userThinInstanceBuffersStorage.data[r] = t, this._userThinInstanceBuffersStorage.strides[r] = e, this._userThinInstanceBuffersStorage.sizes[r] = t.length, this._userThinInstanceBuffersStorage.vertexBuffers[r] = new De.b(this.getEngine(), t, r, !n, !1, e, !0), this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[r]));
+ }, we.a.prototype.thinInstanceBufferUpdated = function(r) {
+ var t;
+ r === "matrix" ? this._thinInstanceDataStorage.matrixBuffer && this._thinInstanceDataStorage.matrixBuffer.updateDirectly(this._thinInstanceDataStorage.matrixData, 0, this._thinInstanceDataStorage.instancesCount) : !((t = this._userThinInstanceBuffersStorage) === null || t === void 0) && t.vertexBuffers[r] && this._userThinInstanceBuffersStorage.vertexBuffers[r].updateDirectly(this._userThinInstanceBuffersStorage.data[r], 0);
+ }, we.a.prototype.thinInstancePartialBufferUpdate = function(r, t, e) {
+ var n;
+ r === "matrix" ? this._thinInstanceDataStorage.matrixBuffer && this._thinInstanceDataStorage.matrixBuffer.updateDirectly(t, e) : !((n = this._userThinInstanceBuffersStorage) === null || n === void 0) && n.vertexBuffers[r] && this._userThinInstanceBuffersStorage.vertexBuffers[r].updateDirectly(t, e);
+ }, we.a.prototype.thinInstanceGetWorldMatrices = function() {
+ if (!this._thinInstanceDataStorage.matrixData || !this._thinInstanceDataStorage.matrixBuffer)
+ return [];
+ var r = this._thinInstanceDataStorage.matrixData;
+ if (!this._thinInstanceDataStorage.worldMatrices) {
+ this._thinInstanceDataStorage.worldMatrices = new Array();
+ for (var t = 0; t < this._thinInstanceDataStorage.instancesCount; ++t)
+ this._thinInstanceDataStorage.worldMatrices[t] = c.a.FromArray(r, 16 * t);
+ }
+ return this._thinInstanceDataStorage.worldMatrices;
+ }, we.a.prototype.thinInstanceRefreshBoundingInfo = function(r) {
+ if (r === void 0 && (r = !1), this._thinInstanceDataStorage.matrixData && this._thinInstanceDataStorage.matrixBuffer) {
+ var t = this._thinInstanceDataStorage.boundingVectors;
+ r && (t.length = 0, this.refreshBoundingInfo(!0));
+ var e = this.getBoundingInfo(), n = this._thinInstanceDataStorage.matrixData;
+ if (t.length === 0)
+ for (var i = 0; i < e.boundingBox.vectors.length; ++i)
+ t.push(e.boundingBox.vectors[i].clone());
+ c.c.Vector3[0].setAll(Number.POSITIVE_INFINITY), c.c.Vector3[1].setAll(Number.NEGATIVE_INFINITY);
+ for (var o = 0; o < this._thinInstanceDataStorage.instancesCount; ++o)
+ for (c.a.FromArrayToRef(n, 16 * o, c.c.Matrix[0]), i = 0; i < t.length; ++i)
+ c.e.TransformCoordinatesToRef(t[i], c.c.Matrix[0], c.c.Vector3[2]), c.c.Vector3[0].minimizeInPlace(c.c.Vector3[2]), c.c.Vector3[1].maximizeInPlace(c.c.Vector3[2]);
+ e.reConstruct(c.c.Vector3[0], c.c.Vector3[1]), this._updateBoundingInfo();
+ }
+ }, we.a.prototype._thinInstanceUpdateBufferSize = function(r, t) {
+ var e, n;
+ t === void 0 && (t = 1);
+ var i = r === "matrix";
+ if (i || this._userThinInstanceBuffersStorage && this._userThinInstanceBuffersStorage.strides[r]) {
+ for (var o = i ? 16 : this._userThinInstanceBuffersStorage.strides[r], a = i ? this._thinInstanceDataStorage.matrixBufferSize : this._userThinInstanceBuffersStorage.sizes[r], s = i ? this._thinInstanceDataStorage.matrixData : this._userThinInstanceBuffersStorage.data[r], p = (this._thinInstanceDataStorage.instancesCount + t) * o, m = a; m < p; )
+ m *= 2;
+ if (!s || a != m) {
+ if (s) {
+ var S = new Float32Array(m);
+ S.set(s, 0), s = S;
+ } else
+ s = new Float32Array(m);
+ if (i) {
+ (e = this._thinInstanceDataStorage.matrixBuffer) === null || e === void 0 || e.dispose();
+ var O = new De.a(this.getEngine(), s, !0, o, !1, !0);
+ this._thinInstanceDataStorage.matrixBuffer = O, this._thinInstanceDataStorage.matrixData = s, this._thinInstanceDataStorage.matrixBufferSize = m, this.setVerticesBuffer(O.createVertexBuffer("world0", 0, 4)), this.setVerticesBuffer(O.createVertexBuffer("world1", 4, 4)), this.setVerticesBuffer(O.createVertexBuffer("world2", 8, 4)), this.setVerticesBuffer(O.createVertexBuffer("world3", 12, 4));
+ } else
+ (n = this._userThinInstanceBuffersStorage.vertexBuffers[r]) === null || n === void 0 || n.dispose(), this._userThinInstanceBuffersStorage.data[r] = s, this._userThinInstanceBuffersStorage.sizes[r] = m, this._userThinInstanceBuffersStorage.vertexBuffers[r] = new De.b(this.getEngine(), s, r, !0, !1, o, !0), this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[r]);
+ }
+ }
+ }, we.a.prototype._thinInstanceInitializeUserStorage = function() {
+ this._userThinInstanceBuffersStorage || (this._userThinInstanceBuffersStorage = { data: {}, sizes: {}, vertexBuffers: {}, strides: {} });
+ }, we.a.prototype._disposeThinInstanceSpecificData = function() {
+ var r;
+ !((r = this._thinInstanceDataStorage) === null || r === void 0) && r.matrixBuffer && (this._thinInstanceDataStorage.matrixBuffer.dispose(), this._thinInstanceDataStorage.matrixBuffer = null);
+ };
+ var Q0 = function() {
+ function r(t) {
+ t === void 0 && (t = Recast), this.bjsRECAST = {}, this.name = "RecastJSPlugin", this._maximumSubStepCount = 10, this._timeStep = 1 / 60, typeof t == "function" ? t(this.bjsRECAST) : this.bjsRECAST = t, this.isSupported() ? this.setTimeStep() : h.a.Error("RecastJS is not available. Please make sure you included the js file.");
+ }
+ return r.prototype.setTimeStep = function(t) {
+ t === void 0 && (t = 1 / 60), this._timeStep = t;
+ }, r.prototype.getTimeStep = function() {
+ return this._timeStep;
+ }, r.prototype.setMaximumSubStepCount = function(t) {
+ t === void 0 && (t = 10), this._maximumSubStepCount = t;
+ }, r.prototype.getMaximumSubStepCount = function() {
+ return this._maximumSubStepCount;
+ }, r.prototype.createNavMesh = function(t, e) {
+ var n, i, o, a = new this.bjsRECAST.rcConfig();
+ a.cs = e.cs, a.ch = e.ch, a.borderSize = 0, a.tileSize = 0, a.walkableSlopeAngle = e.walkableSlopeAngle, a.walkableHeight = e.walkableHeight, a.walkableClimb = e.walkableClimb, a.walkableRadius = e.walkableRadius, a.maxEdgeLen = e.maxEdgeLen, a.maxSimplificationError = e.maxSimplificationError, a.minRegionArea = e.minRegionArea, a.mergeRegionArea = e.mergeRegionArea, a.maxVertsPerPoly = e.maxVertsPerPoly, a.detailSampleDist = e.detailSampleDist, a.detailSampleMaxError = e.detailSampleMaxError, this.navMesh = new this.bjsRECAST.NavMesh();
+ var s = [], p = [], m = 0;
+ for (n = 0; n < t.length; n++)
+ if (t[n]) {
+ var S = t[n], O = S.getIndices();
+ if (!O)
+ continue;
+ var I = S.getVerticesData(De.b.PositionKind, !1, !1);
+ if (!I)
+ continue;
+ var G = S.computeWorldMatrix(!0);
+ for (i = 0; i < O.length; i++)
+ s.push(O[i] + m);
+ var k = c.e.Zero(), K = c.e.Zero();
+ for (o = 0; o < I.length; o += 3)
+ c.e.FromArrayToRef(I, o, K), c.e.TransformCoordinatesToRef(K, G, k), p.push(k.x, k.y, k.z);
+ m += I.length / 3;
+ }
+ this.navMesh.build(p, m, s, s.length, a);
+ }, r.prototype.createDebugNavMesh = function(t) {
+ var e, n, i = this.navMesh.getDebugNavMesh(), o = i.getTriangleCount(), a = [], s = [];
+ for (e = 0; e < 3 * o; e++)
+ a.push(e);
+ for (e = 0; e < o; e++)
+ for (n = 0; n < 3; n++) {
+ var p = i.getTriangle(e).getPoint(n);
+ s.push(p.x, p.y, p.z);
+ }
+ var m = new we.a("NavMeshDebug", t), S = new ft.a();
+ return S.indices = a, S.positions = s, S.applyToMesh(m, !1), m;
+ }, r.prototype.getClosestPoint = function(t) {
+ var e = new this.bjsRECAST.Vec3(t.x, t.y, t.z), n = this.navMesh.getClosestPoint(e);
+ return new c.e(n.x, n.y, n.z);
+ }, r.prototype.getClosestPointToRef = function(t, e) {
+ var n = new this.bjsRECAST.Vec3(t.x, t.y, t.z), i = this.navMesh.getClosestPoint(n);
+ e.set(i.x, i.y, i.z);
+ }, r.prototype.getRandomPointAround = function(t, e) {
+ var n = new this.bjsRECAST.Vec3(t.x, t.y, t.z), i = this.navMesh.getRandomPointAround(n, e);
+ return new c.e(i.x, i.y, i.z);
+ }, r.prototype.getRandomPointAroundToRef = function(t, e, n) {
+ var i = new this.bjsRECAST.Vec3(t.x, t.y, t.z), o = this.navMesh.getRandomPointAround(i, e);
+ n.set(o.x, o.y, o.z);
+ }, r.prototype.moveAlong = function(t, e) {
+ var n = new this.bjsRECAST.Vec3(t.x, t.y, t.z), i = new this.bjsRECAST.Vec3(e.x, e.y, e.z), o = this.navMesh.moveAlong(n, i);
+ return new c.e(o.x, o.y, o.z);
+ }, r.prototype.moveAlongToRef = function(t, e, n) {
+ var i = new this.bjsRECAST.Vec3(t.x, t.y, t.z), o = new this.bjsRECAST.Vec3(e.x, e.y, e.z), a = this.navMesh.moveAlong(i, o);
+ n.set(a.x, a.y, a.z);
+ }, r.prototype.computePath = function(t, e) {
+ var n, i = new this.bjsRECAST.Vec3(t.x, t.y, t.z), o = new this.bjsRECAST.Vec3(e.x, e.y, e.z), a = this.navMesh.computePath(i, o), s = a.getPointCount(), p = [];
+ for (n = 0; n < s; n++) {
+ var m = a.getPoint(n);
+ p.push(new c.e(m.x, m.y, m.z));
+ }
+ return p;
+ }, r.prototype.createCrowd = function(t, e, n) {
+ return new T_(this, t, e, n);
+ }, r.prototype.setDefaultQueryExtent = function(t) {
+ var e = new this.bjsRECAST.Vec3(t.x, t.y, t.z);
+ this.navMesh.setDefaultQueryExtent(e);
+ }, r.prototype.getDefaultQueryExtent = function() {
+ var t = this.navMesh.getDefaultQueryExtent();
+ return new c.e(t.x, t.y, t.z);
+ }, r.prototype.buildFromNavmeshData = function(t) {
+ var e = t.length * t.BYTES_PER_ELEMENT, n = this.bjsRECAST._malloc(e), i = new Uint8Array(this.bjsRECAST.HEAPU8.buffer, n, e);
+ i.set(t);
+ var o = new this.bjsRECAST.NavmeshData();
+ o.dataPointer = i.byteOffset, o.size = t.length, this.navMesh = new this.bjsRECAST.NavMesh(), this.navMesh.buildFromNavmeshData(o), this.bjsRECAST._free(i.byteOffset);
+ }, r.prototype.getNavmeshData = function() {
+ var t = this.navMesh.getNavmeshData(), e = new Uint8Array(this.bjsRECAST.HEAPU8.buffer, t.dataPointer, t.size), n = new Uint8Array(t.size);
+ return n.set(e), this.navMesh.freeNavmeshData(t), n;
+ }, r.prototype.getDefaultQueryExtentToRef = function(t) {
+ var e = this.navMesh.getDefaultQueryExtent();
+ t.set(e.x, e.y, e.z);
+ }, r.prototype.dispose = function() {
+ }, r.prototype.isSupported = function() {
+ return this.bjsRECAST !== void 0;
+ }, r;
+ }(), T_ = function() {
+ function r(t, e, n, i) {
+ var o = this;
+ this.recastCrowd = {}, this.transforms = new Array(), this.agents = new Array(), this._onBeforeAnimationsObserver = null, this.bjsRECASTPlugin = t, this.recastCrowd = new this.bjsRECASTPlugin.bjsRECAST.Crowd(e, n, this.bjsRECASTPlugin.navMesh.getNavMesh()), this._scene = i, this._onBeforeAnimationsObserver = i.onBeforeAnimationsObservable.add(function() {
+ o.update(1e-3 * i.getEngine().getDeltaTime());
+ });
+ }
+ return r.prototype.addAgent = function(t, e, n) {
+ var i = new this.bjsRECASTPlugin.bjsRECAST.dtCrowdAgentParams();
+ i.radius = e.radius, i.height = e.height, i.maxAcceleration = e.maxAcceleration, i.maxSpeed = e.maxSpeed, i.collisionQueryRange = e.collisionQueryRange, i.pathOptimizationRange = e.pathOptimizationRange, i.separationWeight = e.separationWeight, i.updateFlags = 7, i.obstacleAvoidanceType = 0, i.queryFilterType = 0, i.userData = 0;
+ var o = this.recastCrowd.addAgent(new this.bjsRECASTPlugin.bjsRECAST.Vec3(t.x, t.y, t.z), i);
+ return this.transforms.push(n), this.agents.push(o), o;
+ }, r.prototype.getAgentPosition = function(t) {
+ var e = this.recastCrowd.getAgentPosition(t);
+ return new c.e(e.x, e.y, e.z);
+ }, r.prototype.getAgentPositionToRef = function(t, e) {
+ var n = this.recastCrowd.getAgentPosition(t);
+ e.set(n.x, n.y, n.z);
+ }, r.prototype.getAgentVelocity = function(t) {
+ var e = this.recastCrowd.getAgentVelocity(t);
+ return new c.e(e.x, e.y, e.z);
+ }, r.prototype.getAgentVelocityToRef = function(t, e) {
+ var n = this.recastCrowd.getAgentVelocity(t);
+ e.set(n.x, n.y, n.z);
+ }, r.prototype.getAgentNextTargetPath = function(t) {
+ var e = this.recastCrowd.getAgentNextTargetPath(t);
+ return new c.e(e.x, e.y, e.z);
+ }, r.prototype.getAgentNextTargetPathToRef = function(t, e) {
+ var n = this.recastCrowd.getAgentNextTargetPath(t);
+ e.set(n.x, n.y, n.z);
+ }, r.prototype.getAgentState = function(t) {
+ return this.recastCrowd.getAgentState(t);
+ }, r.prototype.overOffmeshConnection = function(t) {
+ return this.recastCrowd.overOffmeshConnection(t);
+ }, r.prototype.agentGoto = function(t, e) {
+ this.recastCrowd.agentGoto(t, new this.bjsRECASTPlugin.bjsRECAST.Vec3(e.x, e.y, e.z));
+ }, r.prototype.agentTeleport = function(t, e) {
+ this.recastCrowd.agentTeleport(t, new this.bjsRECASTPlugin.bjsRECAST.Vec3(e.x, e.y, e.z));
+ }, r.prototype.updateAgentParameters = function(t, e) {
+ var n = this.recastCrowd.getAgentParameters(t);
+ e.radius !== void 0 && (n.radius = e.radius), e.height !== void 0 && (n.height = e.height), e.maxAcceleration !== void 0 && (n.maxAcceleration = e.maxAcceleration), e.maxSpeed !== void 0 && (n.maxSpeed = e.maxSpeed), e.collisionQueryRange !== void 0 && (n.collisionQueryRange = e.collisionQueryRange), e.pathOptimizationRange !== void 0 && (n.pathOptimizationRange = e.pathOptimizationRange), e.separationWeight !== void 0 && (n.separationWeight = e.separationWeight), this.recastCrowd.setAgentParameters(t, n);
+ }, r.prototype.removeAgent = function(t) {
+ this.recastCrowd.removeAgent(t);
+ var e = this.agents.indexOf(t);
+ e > -1 && (this.agents.splice(e, 1), this.transforms.splice(e, 1));
+ }, r.prototype.getAgents = function() {
+ return this.agents;
+ }, r.prototype.update = function(t) {
+ var e = this.bjsRECASTPlugin.getTimeStep(), n = this.bjsRECASTPlugin.getMaximumSubStepCount();
+ if (e <= Xt.a)
+ this.recastCrowd.update(t);
+ else {
+ var i = t / e;
+ n && i > n && (i = n), i < 1 && (i = 1);
+ for (var o = 0; o < i; o++)
+ this.recastCrowd.update(e);
+ }
+ for (var a = 0; a < this.agents.length; a++)
+ this.transforms[a].position = this.getAgentPosition(this.agents[a]);
+ }, r.prototype.setDefaultQueryExtent = function(t) {
+ var e = new this.bjsRECASTPlugin.bjsRECAST.Vec3(t.x, t.y, t.z);
+ this.recastCrowd.setDefaultQueryExtent(e);
+ }, r.prototype.getDefaultQueryExtent = function() {
+ var t = this.recastCrowd.getDefaultQueryExtent();
+ return new c.e(t.x, t.y, t.z);
+ }, r.prototype.getDefaultQueryExtentToRef = function(t) {
+ var e = this.recastCrowd.getDefaultQueryExtent();
+ t.set(e.x, e.y, e.z);
+ }, r.prototype.dispose = function() {
+ this.recastCrowd.destroy(), this._scene.onBeforeAnimationsObservable.remove(this._onBeforeAnimationsObserver), this._onBeforeAnimationsObserver = null;
+ }, r;
+ }();
+ ke.a.OfflineProviderFactory = function(r, t, e) {
+ return e === void 0 && (e = !1), new S_(r, t, e);
+ };
+ var Uo, S_ = function() {
+ function r(t, e, n) {
+ var i = this;
+ n === void 0 && (n = !1), this._idbFactory = typeof window < "u" ? window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB : indexedDB, this._callbackManifestChecked = e, this._currentSceneUrl = r._ReturnFullUrlLocation(t), this._db = null, this._enableSceneOffline = !1, this._enableTexturesOffline = !1, this._manifestVersionFound = 0, this._mustUpdateRessources = !1, this._hasReachedQuota = !1, r.IDBStorageEnabled ? n ? (this._enableSceneOffline = !0, this._enableTexturesOffline = !0, this._manifestVersionFound = 1, Ke.b.SetImmediate(function() {
+ i._callbackManifestChecked(!0);
+ })) : this._checkManifestFile() : this._callbackManifestChecked(!0);
+ }
+ return Object.defineProperty(r.prototype, "enableSceneOffline", { get: function() {
+ return this._enableSceneOffline;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "enableTexturesOffline", { get: function() {
+ return this._enableTexturesOffline;
+ }, enumerable: !1, configurable: !0 }), r.prototype._checkManifestFile = function() {
+ var t = this, e = function() {
+ t._enableSceneOffline = !1, t._enableTexturesOffline = !1, t._callbackManifestChecked(!1);
+ }, n = !1, i = this._currentSceneUrl + ".manifest", o = new ce.a();
+ navigator.onLine && (n = !0, i = i + (i.match(/\?/) == null ? "?" : "&") + Date.now()), o.open("GET", i), o.addEventListener("load", function() {
+ if (o.status === 200 || r._ValidateXHRData(o, 1))
+ try {
+ var a = JSON.parse(o.response);
+ t._enableSceneOffline = a.enableSceneOffline, t._enableTexturesOffline = a.enableTexturesOffline && r.IsUASupportingBlobStorage, a.version && !isNaN(parseInt(a.version)) && (t._manifestVersionFound = a.version), t._callbackManifestChecked && t._callbackManifestChecked(!0);
+ } catch {
+ e();
+ }
+ else
+ e();
+ }, !1), o.addEventListener("error", function() {
+ if (n) {
+ n = !1;
+ var a = t._currentSceneUrl + ".manifest";
+ o.open("GET", a), o.send();
+ } else
+ e();
+ }, !1);
+ try {
+ o.send();
+ } catch {
+ h.a.Error("Error on XHR send request."), this._callbackManifestChecked(!1);
+ }
+ }, r.prototype.open = function(t, e) {
+ var n = this, i = function() {
+ n._isSupported = !1, e && e();
+ };
+ if (this._idbFactory && (this._enableSceneOffline || this._enableTexturesOffline))
+ if (this._db)
+ t && t();
+ else {
+ this._hasReachedQuota = !1, this._isSupported = !0;
+ var o = this._idbFactory.open("babylonjs", 1);
+ o.onerror = function() {
+ i();
+ }, o.onblocked = function() {
+ h.a.Error("IDB request blocked. Please reload the page."), i();
+ }, o.onsuccess = function() {
+ n._db = o.result, t();
+ }, o.onupgradeneeded = function(a) {
+ if (n._db = a.target.result, n._db)
+ try {
+ n._db.createObjectStore("scenes", { keyPath: "sceneUrl" }), n._db.createObjectStore("versions", { keyPath: "sceneUrl" }), n._db.createObjectStore("textures", { keyPath: "textureUrl" });
+ } catch (s) {
+ h.a.Error("Error while creating object stores. Exception: " + s.message), i();
+ }
+ };
+ }
+ else
+ this._isSupported = !1, e && e();
+ }, r.prototype.loadImage = function(t, e) {
+ var n = this, i = r._ReturnFullUrlLocation(t), o = function() {
+ n._hasReachedQuota || n._db === null ? e.src = t : n._saveImageIntoDBAsync(i, e);
+ };
+ this._mustUpdateRessources ? o() : this._loadImageFromDBAsync(i, e, o);
+ }, r.prototype._loadImageFromDBAsync = function(t, e, n) {
+ if (this._isSupported && this._db !== null) {
+ var i, o = this._db.transaction(["textures"]);
+ o.onabort = function() {
+ e.src = t;
+ }, o.oncomplete = function() {
+ var s;
+ if (i) {
+ var p = window.URL || window.webkitURL;
+ s = p.createObjectURL(i.data), e.onerror = function() {
+ h.a.Error("Error loading image from blob URL: " + s + " switching back to web url: " + t), e.src = t;
+ }, e.src = s;
+ } else
+ n();
+ };
+ var a = o.objectStore("textures").get(t);
+ a.onsuccess = function(s) {
+ i = s.target.result;
+ }, a.onerror = function() {
+ h.a.Error("Error loading texture " + t + " from DB."), e.src = t;
+ };
+ } else
+ h.a.Error("Error: IndexedDB not supported by your browser or BabylonJS Database is not open."), e.src = t;
+ }, r.prototype._saveImageIntoDBAsync = function(t, e) {
+ var n = this;
+ if (this._isSupported) {
+ var i = function() {
+ var s;
+ if (o) {
+ var p = window.URL || window.webkitURL;
+ try {
+ s = p.createObjectURL(o);
+ } catch {
+ s = p.createObjectURL(o);
+ }
+ }
+ s && (e.src = s);
+ };
+ if (r.IsUASupportingBlobStorage) {
+ var o, a = new ce.a();
+ a.open("GET", t), a.responseType = "blob", a.addEventListener("load", function() {
+ if (a.status === 200 && n._db) {
+ o = a.response;
+ var s = n._db.transaction(["textures"], "readwrite");
+ s.onabort = function(S) {
+ try {
+ var O = (S.srcElement || S.target).error;
+ O && O.name === "QuotaExceededError" && (n._hasReachedQuota = !0);
+ } catch {
+ }
+ i();
+ }, s.oncomplete = function() {
+ i();
+ };
+ var p = { textureUrl: t, data: o };
+ try {
+ var m = s.objectStore("textures").put(p);
+ m.onsuccess = function() {
+ }, m.onerror = function() {
+ i();
+ };
+ } catch (S) {
+ S.code === 25 && (r.IsUASupportingBlobStorage = !1, n._enableTexturesOffline = !1), e.src = t;
+ }
+ } else
+ e.src = t;
+ }, !1), a.addEventListener("error", function() {
+ h.a.Error("Error in XHR request in BABYLON.Database."), e.src = t;
+ }, !1), a.send();
+ } else
+ e.src = t;
+ } else
+ h.a.Error("Error: IndexedDB not supported by your browser or Babylon.js database is not open."), e.src = t;
+ }, r.prototype._checkVersionFromDB = function(t, e) {
+ var n = this;
+ this._loadVersionFromDBAsync(t, e, function() {
+ n._saveVersionIntoDBAsync(t, e);
+ });
+ }, r.prototype._loadVersionFromDBAsync = function(t, e, n) {
+ var i, o = this;
+ if (this._isSupported && this._db)
+ try {
+ var a = this._db.transaction(["versions"]);
+ a.oncomplete = function() {
+ i ? o._manifestVersionFound !== i.data ? (o._mustUpdateRessources = !0, n()) : e(i.data) : (o._mustUpdateRessources = !0, n());
+ }, a.onabort = function() {
+ e(-1);
+ };
+ var s = a.objectStore("versions").get(t);
+ s.onsuccess = function(p) {
+ i = p.target.result;
+ }, s.onerror = function() {
+ h.a.Error("Error loading version for scene " + t + " from DB."), e(-1);
+ };
+ } catch (p) {
+ h.a.Error("Error while accessing 'versions' object store (READ OP). Exception: " + p.message), e(-1);
+ }
+ else
+ h.a.Error("Error: IndexedDB not supported by your browser or Babylon.js database is not open."), e(-1);
+ }, r.prototype._saveVersionIntoDBAsync = function(t, e) {
+ var n = this;
+ if (this._isSupported && !this._hasReachedQuota && this._db)
+ try {
+ var i = this._db.transaction(["versions"], "readwrite");
+ i.onabort = function(s) {
+ try {
+ var p = s.srcElement.error;
+ p && p.name === "QuotaExceededError" && (n._hasReachedQuota = !0);
+ } catch {
+ }
+ e(-1);
+ }, i.oncomplete = function() {
+ e(n._manifestVersionFound);
+ };
+ var o = { sceneUrl: t, data: this._manifestVersionFound }, a = i.objectStore("versions").put(o);
+ a.onsuccess = function() {
+ }, a.onerror = function() {
+ h.a.Error("Error in DB add version request in BABYLON.Database.");
+ };
+ } catch (s) {
+ h.a.Error("Error while accessing 'versions' object store (WRITE OP). Exception: " + s.message), e(-1);
+ }
+ else
+ e(-1);
+ }, r.prototype.loadFile = function(t, e, n, i, o) {
+ var a = this, s = r._ReturnFullUrlLocation(t), p = function() {
+ a._saveFileAsync(s, e, n, o, i);
+ };
+ this._checkVersionFromDB(s, function(m) {
+ m !== -1 ? a._mustUpdateRessources ? a._saveFileAsync(s, e, n, o, i) : a._loadFileAsync(s, e, p) : i && i();
+ });
+ }, r.prototype._loadFileAsync = function(t, e, n) {
+ if (this._isSupported && this._db) {
+ var i, o;
+ i = t.indexOf(".babylon") !== -1 ? "scenes" : "textures";
+ var a = this._db.transaction([i]);
+ a.oncomplete = function() {
+ o ? e(o.data) : n();
+ }, a.onabort = function() {
+ n();
+ };
+ var s = a.objectStore(i).get(t);
+ s.onsuccess = function(p) {
+ o = p.target.result;
+ }, s.onerror = function() {
+ h.a.Error("Error loading file " + t + " from DB."), n();
+ };
+ } else
+ h.a.Error("Error: IndexedDB not supported by your browser or BabylonJS Database is not open."), e();
+ }, r.prototype._saveFileAsync = function(t, e, n, i, o) {
+ var a = this;
+ if (this._isSupported) {
+ var s;
+ s = t.indexOf(".babylon") !== -1 ? "scenes" : "textures";
+ var p, m = new ce.a();
+ m.open("GET", t + "?" + Date.now()), i && (m.responseType = "arraybuffer"), n && (m.onprogress = n), m.addEventListener("load", function() {
+ if (m.status === 200 || m.status < 400 && r._ValidateXHRData(m, i ? 6 : 1))
+ if (p = i ? m.response : m.responseText, !a._hasReachedQuota && a._db) {
+ var S, O = a._db.transaction([s], "readwrite");
+ O.onabort = function(G) {
+ try {
+ var k = G.srcElement.error;
+ k && k.name === "QuotaExceededError" && (a._hasReachedQuota = !0);
+ } catch {
+ }
+ e(p);
+ }, O.oncomplete = function() {
+ e(p);
+ }, S = s === "scenes" ? { sceneUrl: t, data: p, version: a._manifestVersionFound } : { textureUrl: t, data: p };
+ try {
+ var I = O.objectStore(s).put(S);
+ I.onsuccess = function() {
+ }, I.onerror = function() {
+ h.a.Error("Error in DB add file request in BABYLON.Database.");
+ };
+ } catch {
+ e(p);
+ }
+ } else
+ e(p);
+ else
+ m.status >= 400 && o ? o(m) : e();
+ }, !1), m.addEventListener("error", function() {
+ h.a.Error("error on XHR request."), e();
+ }, !1), m.send();
+ } else
+ h.a.Error("Error: IndexedDB not supported by your browser or Babylon.js database is not open."), e();
+ }, r._ValidateXHRData = function(t, e) {
+ e === void 0 && (e = 7);
+ try {
+ if (1 & e) {
+ if (t.responseText && t.responseText.length > 0)
+ return !0;
+ if (e === 1)
+ return !1;
+ }
+ if (2 & e) {
+ var n = Hs.GetTGAHeader(t.response);
+ if (n.width && n.height && n.width > 0 && n.height > 0)
+ return !0;
+ if (e === 2)
+ return !1;
+ }
+ if (4 & e) {
+ var i = new Uint8Array(t.response, 0, 3);
+ return i[0] === 68 && i[1] === 68 && i[2] === 83;
+ }
+ } catch {
+ }
+ return !1;
+ }, r.IsUASupportingBlobStorage = !0, r.IDBStorageEnabled = !1, r._ParseURL = function(t) {
+ document.createElement("a").href = t;
+ var e = t.substring(0, t.lastIndexOf("#")), n = t.substring(e.lastIndexOf("/") + 1, t.length);
+ return t.substring(0, t.indexOf(n, 0));
+ }, r._ReturnFullUrlLocation = function(t) {
+ return t.indexOf("http:/") === -1 && t.indexOf("https:/") === -1 && typeof window < "u" ? r._ParseURL(window.location.href) + t : t;
+ }, r;
+ }(), Mu = function() {
+ function r(t, e, n) {
+ this.gradient = t, this.color1 = e, this.color2 = n;
+ }
+ return r.prototype.getColorToRef = function(t) {
+ this.color2 ? C.b.LerpToRef(this.color1, this.color2, Math.random(), t) : t.copyFrom(this.color1);
+ }, r;
+ }(), A_ = function(r, t) {
+ this.gradient = r, this.color = t;
+ }, Iu = function() {
+ function r(t, e, n) {
+ this.gradient = t, this.factor1 = e, this.factor2 = n;
+ }
+ return r.prototype.getFactor = function() {
+ return this.factor2 === void 0 || this.factor2 === this.factor1 ? this.factor1 : this.factor1 + (this.factor2 - this.factor1) * Math.random();
+ }, r;
+ }(), jn = function() {
+ function r() {
+ }
+ return r.GetCurrentGradient = function(t, e, n) {
+ if (e[0].gradient > t)
+ n(e[0], e[0], 1);
+ else {
+ for (var i = 0; i < e.length - 1; i++) {
+ var o = e[i], a = e[i + 1];
+ if (t >= o.gradient && t <= a.gradient)
+ return void n(o, a, (t - o.gradient) / (a.gradient - o.gradient));
+ }
+ var s = e.length - 1;
+ n(e[s], e[s], 1);
+ }
+ }, r;
+ }(), P_ = function() {
+ function r(t) {
+ this.particleSystem = t, this.position = c.e.Zero(), this.direction = c.e.Zero(), this.color = new C.b(0, 0, 0, 0), this.colorStep = new C.b(0, 0, 0, 0), this.lifeTime = 1, this.age = 0, this.size = 0, this.scale = new c.d(1, 1), this.angle = 0, this.angularSpeed = 0, this.cellIndex = 0, this._attachedSubEmitters = null, this._currentColor1 = new C.b(0, 0, 0, 0), this._currentColor2 = new C.b(0, 0, 0, 0), this._currentSize1 = 0, this._currentSize2 = 0, this._currentAngularSpeed1 = 0, this._currentAngularSpeed2 = 0, this._currentVelocity1 = 0, this._currentVelocity2 = 0, this._currentLimitVelocity1 = 0, this._currentLimitVelocity2 = 0, this._currentDrag1 = 0, this._currentDrag2 = 0, this.id = r._Count++, this.particleSystem.isAnimationSheetEnabled && this.updateCellInfoFromSystem();
+ }
+ return r.prototype.updateCellInfoFromSystem = function() {
+ this.cellIndex = this.particleSystem.startSpriteCellID;
+ }, r.prototype.updateCellIndex = function() {
+ var t = this.age, e = this.particleSystem.spriteCellChangeSpeed;
+ this.particleSystem.spriteRandomStartCell && (this._randomCellOffset === void 0 && (this._randomCellOffset = Math.random() * this.lifeTime), e === 0 ? (e = 1, t = this._randomCellOffset) : t += this._randomCellOffset);
+ var n = this._initialEndSpriteCellID - this._initialStartSpriteCellID, i = ee.a.Clamp(t * e % this.lifeTime / this.lifeTime);
+ this.cellIndex = this._initialStartSpriteCellID + i * n | 0;
+ }, r.prototype._inheritParticleInfoToSubEmitter = function(t) {
+ if (t.particleSystem.emitter.position) {
+ var e = t.particleSystem.emitter;
+ if (e.position.copyFrom(this.position), t.inheritDirection) {
+ var n = c.c.Vector3[0];
+ this.direction.normalizeToRef(n), e.setDirection(n, 0, Math.PI / 2);
+ }
+ } else
+ t.particleSystem.emitter.copyFrom(this.position);
+ this.direction.scaleToRef(t.inheritedVelocityAmount / 2, c.c.Vector3[0]), t.particleSystem._inheritedVelocityOffset.copyFrom(c.c.Vector3[0]);
+ }, r.prototype._inheritParticleInfoToSubEmitters = function() {
+ var t = this;
+ this._attachedSubEmitters && this._attachedSubEmitters.length > 0 && this._attachedSubEmitters.forEach(function(e) {
+ t._inheritParticleInfoToSubEmitter(e);
+ });
+ }, r.prototype._reset = function() {
+ this.age = 0, this.id = r._Count++, this._currentColorGradient = null, this._currentSizeGradient = null, this._currentAngularSpeedGradient = null, this._currentVelocityGradient = null, this._currentLimitVelocityGradient = null, this._currentDragGradient = null, this.cellIndex = this.particleSystem.startSpriteCellID, this._randomCellOffset = void 0;
+ }, r.prototype.copyTo = function(t) {
+ t.position.copyFrom(this.position), this._initialDirection ? t._initialDirection ? t._initialDirection.copyFrom(this._initialDirection) : t._initialDirection = this._initialDirection.clone() : t._initialDirection = null, t.direction.copyFrom(this.direction), this._localPosition && (t._localPosition ? t._localPosition.copyFrom(this._localPosition) : t._localPosition = this._localPosition.clone()), t.color.copyFrom(this.color), t.colorStep.copyFrom(this.colorStep), t.lifeTime = this.lifeTime, t.age = this.age, t._randomCellOffset = this._randomCellOffset, t.size = this.size, t.scale.copyFrom(this.scale), t.angle = this.angle, t.angularSpeed = this.angularSpeed, t.particleSystem = this.particleSystem, t.cellIndex = this.cellIndex, t.id = this.id, t._attachedSubEmitters = this._attachedSubEmitters, this._currentColorGradient && (t._currentColorGradient = this._currentColorGradient, t._currentColor1.copyFrom(this._currentColor1), t._currentColor2.copyFrom(this._currentColor2)), this._currentSizeGradient && (t._currentSizeGradient = this._currentSizeGradient, t._currentSize1 = this._currentSize1, t._currentSize2 = this._currentSize2), this._currentAngularSpeedGradient && (t._currentAngularSpeedGradient = this._currentAngularSpeedGradient, t._currentAngularSpeed1 = this._currentAngularSpeed1, t._currentAngularSpeed2 = this._currentAngularSpeed2), this._currentVelocityGradient && (t._currentVelocityGradient = this._currentVelocityGradient, t._currentVelocity1 = this._currentVelocity1, t._currentVelocity2 = this._currentVelocity2), this._currentLimitVelocityGradient && (t._currentLimitVelocityGradient = this._currentLimitVelocityGradient, t._currentLimitVelocity1 = this._currentLimitVelocity1, t._currentLimitVelocity2 = this._currentLimitVelocity2), this._currentDragGradient && (t._currentDragGradient = this._currentDragGradient, t._currentDrag1 = this._currentDrag1, t._currentDrag2 = this._currentDrag2), this.particleSystem.isAnimationSheetEnabled && (t._initialStartSpriteCellID = this._initialStartSpriteCellID, t._initialEndSpriteCellID = this._initialEndSpriteCellID), this.particleSystem.useRampGradients && (t.remapData && this.remapData ? t.remapData.copyFrom(this.remapData) : t.remapData = new c.f(0, 0, 0, 0)), this._randomNoiseCoordinates1 && (t._randomNoiseCoordinates1 ? (t._randomNoiseCoordinates1.copyFrom(this._randomNoiseCoordinates1), t._randomNoiseCoordinates2.copyFrom(this._randomNoiseCoordinates2)) : (t._randomNoiseCoordinates1 = this._randomNoiseCoordinates1.clone(), t._randomNoiseCoordinates2 = this._randomNoiseCoordinates2.clone()));
+ }, r._Count = 0, r;
+ }();
+ (function(r) {
+ r[r.ATTACHED = 0] = "ATTACHED", r[r.END = 1] = "END";
+ })(Uo || (Uo = {}));
+ var za = function() {
+ function r(t) {
+ if (this.particleSystem = t, this.type = Uo.END, this.inheritDirection = !1, this.inheritedVelocityAmount = 0, !t.emitter || !t.emitter.dispose) {
+ var e = x.a.GetClass("BABYLON.AbstractMesh");
+ t.emitter = new e("SubemitterSystemEmitter", t.getScene());
+ }
+ t.onDisposeObservable.add(function() {
+ t.emitter && t.emitter.dispose && t.emitter.dispose();
+ });
+ }
+ return r.prototype.clone = function() {
+ var t = this.particleSystem.emitter;
+ t ? t instanceof c.e ? t = t.clone() : t.getClassName().indexOf("Mesh") !== -1 && ((t = new (x.a.GetClass("BABYLON.Mesh"))("", t.getScene())).isVisible = !1) : t = new c.e();
+ var e = new r(this.particleSystem.clone("", t));
+ return e.particleSystem.name += "Clone", e.type = this.type, e.inheritDirection = this.inheritDirection, e.inheritedVelocityAmount = this.inheritedVelocityAmount, e.particleSystem._disposeEmitterOnDispose = !0, e.particleSystem.disposeOnStop = !0, e;
+ }, r.prototype.serialize = function() {
+ var t = {};
+ return t.type = this.type, t.inheritDirection = this.inheritDirection, t.inheritedVelocityAmount = this.inheritedVelocityAmount, t.particleSystem = this.particleSystem.serialize(), t;
+ }, r._ParseParticleSystem = function(t, e, n) {
+ throw Nn.a.WarnImport("ParseParticle");
+ }, r.Parse = function(t, e, n) {
+ var i = t.particleSystem, o = new r(r._ParseParticleSystem(i, e, n));
+ return o.type = t.type, o.inheritDirection = t.inheritDirection, o.inheritedVelocityAmount = t.inheritedVelocityAmount, o.particleSystem._isSubEmitter = !0, o;
+ }, r.prototype.dispose = function() {
+ this.particleSystem.dispose();
+ }, r;
+ }(), q0 = `
+varying vec2 vUV;
+varying vec4 vColor;
+uniform vec4 textureMask;
+uniform sampler2D diffuseSampler;
+#include
+#include
+#include
+#include
+#ifdef RAMPGRADIENT
+varying vec4 remapRanges;
+uniform sampler2D rampSampler;
+#endif
+void main(void) {
+#include
+vec4 textureColor=texture2D(diffuseSampler,vUV);
+vec4 baseColor=(textureColor*textureMask+(vec4(1.,1.,1.,1.)-textureMask))*vColor;
+#ifdef RAMPGRADIENT
+float alpha=baseColor.a;
+float remappedColorIndex=clamp((alpha-remapRanges.x)/remapRanges.y,0.0,1.0);
+vec4 rampColor=texture2D(rampSampler,vec2(1.0-remappedColorIndex,0.));
+baseColor.rgb*=rampColor.rgb;
+
+float finalAlpha=baseColor.a;
+baseColor.a=clamp((alpha*rampColor.a-remapRanges.z)/remapRanges.w,0.0,1.0);
+#endif
+#ifdef BLENDMULTIPLYMODE
+float sourceAlpha=vColor.a*textureColor.a;
+baseColor.rgb=baseColor.rgb*sourceAlpha+vec3(1.0)*(1.0-sourceAlpha);
+#endif
+
+
+#ifdef IMAGEPROCESSINGPOSTPROCESS
+baseColor.rgb=toLinearSpace(baseColor.rgb);
+#else
+#ifdef IMAGEPROCESSING
+baseColor.rgb=toLinearSpace(baseColor.rgb);
+baseColor=applyImageProcessing(baseColor);
+#endif
+#endif
+gl_FragColor=baseColor;
+}`;
+ We.a.ShadersStore.particlesPixelShader = q0;
+ var Z0 = `
+attribute vec3 position;
+attribute vec4 color;
+attribute float angle;
+attribute vec2 size;
+#ifdef ANIMATESHEET
+attribute float cellIndex;
+#endif
+#ifndef BILLBOARD
+attribute vec3 direction;
+#endif
+#ifdef BILLBOARDSTRETCHED
+attribute vec3 direction;
+#endif
+#ifdef RAMPGRADIENT
+attribute vec4 remapData;
+#endif
+attribute vec2 offset;
+
+uniform mat4 view;
+uniform mat4 projection;
+uniform vec2 translationPivot;
+#ifdef ANIMATESHEET
+uniform vec3 particlesInfos;
+#endif
+
+varying vec2 vUV;
+varying vec4 vColor;
+varying vec3 vPositionW;
+#ifdef RAMPGRADIENT
+varying vec4 remapRanges;
+#endif
+#if defined(BILLBOARD) && !defined(BILLBOARDY) && !defined(BILLBOARDSTRETCHED)
+uniform mat4 invView;
+#endif
+#include
+#ifdef BILLBOARD
+uniform vec3 eyePosition;
+#endif
+vec3 rotate(vec3 yaxis,vec3 rotatedCorner) {
+vec3 xaxis=normalize(cross(vec3(0.,1.0,0.),yaxis));
+vec3 zaxis=normalize(cross(yaxis,xaxis));
+vec3 row0=vec3(xaxis.x,xaxis.y,xaxis.z);
+vec3 row1=vec3(yaxis.x,yaxis.y,yaxis.z);
+vec3 row2=vec3(zaxis.x,zaxis.y,zaxis.z);
+mat3 rotMatrix=mat3(row0,row1,row2);
+vec3 alignedCorner=rotMatrix*rotatedCorner;
+return position+alignedCorner;
+}
+#ifdef BILLBOARDSTRETCHED
+vec3 rotateAlign(vec3 toCamera,vec3 rotatedCorner) {
+vec3 normalizedToCamera=normalize(toCamera);
+vec3 normalizedCrossDirToCamera=normalize(cross(normalize(direction),normalizedToCamera));
+vec3 crossProduct=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));
+vec3 row0=vec3(normalizedCrossDirToCamera.x,normalizedCrossDirToCamera.y,normalizedCrossDirToCamera.z);
+vec3 row1=vec3(crossProduct.x,crossProduct.y,crossProduct.z);
+vec3 row2=vec3(normalizedToCamera.x,normalizedToCamera.y,normalizedToCamera.z);
+mat3 rotMatrix=mat3(row0,row1,row2);
+vec3 alignedCorner=rotMatrix*rotatedCorner;
+return position+alignedCorner;
+}
+#endif
+void main(void) {
+vec2 cornerPos;
+cornerPos=(vec2(offset.x-0.5,offset.y-0.5)-translationPivot)*size+translationPivot;
+#ifdef BILLBOARD
+
+vec3 rotatedCorner;
+#ifdef BILLBOARDY
+rotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);
+rotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);
+rotatedCorner.y=0.;
+vec3 yaxis=position-eyePosition;
+yaxis.y=0.;
+vPositionW=rotate(normalize(yaxis),rotatedCorner);
+vec3 viewPos=(view*vec4(vPositionW,1.0)).xyz;
+#elif defined(BILLBOARDSTRETCHED)
+rotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);
+rotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);
+rotatedCorner.z=0.;
+vec3 toCamera=position-eyePosition;
+vPositionW=rotateAlign(toCamera,rotatedCorner);
+vec3 viewPos=(view*vec4(vPositionW,1.0)).xyz;
+#else
+rotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);
+rotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);
+rotatedCorner.z=0.;
+vec3 viewPos=(view*vec4(position,1.0)).xyz+rotatedCorner;
+vPositionW=(invView*vec4(viewPos,1)).xyz;
+#endif
+#ifdef RAMPGRADIENT
+remapRanges=remapData;
+#endif
+
+gl_Position=projection*vec4(viewPos,1.0);
+#else
+
+vec3 rotatedCorner;
+rotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);
+rotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);
+rotatedCorner.y=0.;
+vec3 yaxis=normalize(direction);
+vPositionW=rotate(yaxis,rotatedCorner);
+gl_Position=projection*view*vec4(vPositionW,1.0);
+#endif
+vColor=color;
+#ifdef ANIMATESHEET
+float rowOffset=floor(cellIndex*particlesInfos.z);
+float columnOffset=cellIndex-rowOffset/particlesInfos.z;
+vec2 uvScale=particlesInfos.xy;
+vec2 uvOffset=vec2(offset.x ,1.0-offset.y);
+vUV=(uvOffset+vec2(columnOffset,rowOffset))*uvScale;
+#else
+vUV=offset;
+#endif
+
+#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)
+vec4 worldPos=vec4(vPositionW,1.0);
+#endif
+#include
+}`;
+ We.a.ShadersStore.particlesVertexShader = Z0;
+ var En = function(r) {
+ function t(e, n, i, o, a, s) {
+ o === void 0 && (o = null), a === void 0 && (a = !1), s === void 0 && (s = 0.01);
+ var p = r.call(this, e) || this;
+ return p._inheritedVelocityOffset = new c.e(), p.onDisposeObservable = new P.c(), p.onStoppedObservable = new P.c(), p._particles = new Array(), p._stockParticles = new Array(), p._newPartsExcess = 0, p._vertexBuffers = {}, p._scaledColorStep = new C.b(0, 0, 0, 0), p._colorDiff = new C.b(0, 0, 0, 0), p._scaledDirection = c.e.Zero(), p._scaledGravity = c.e.Zero(), p._currentRenderId = -1, p._useInstancing = !1, p._started = !1, p._stopped = !1, p._actualFrame = 0, p._currentEmitRate1 = 0, p._currentEmitRate2 = 0, p._currentStartSize1 = 0, p._currentStartSize2 = 0, p._rawTextureWidth = 256, p._useRampGradients = !1, p._disposeEmitterOnDispose = !1, p.isLocal = !1, p._onBeforeDrawParticlesObservable = null, p.recycleParticle = function(m) {
+ var S = p._particles.pop();
+ S !== m && S.copyTo(m), p._stockParticles.push(S);
+ }, p._createParticle = function() {
+ var m;
+ if (p._stockParticles.length !== 0 ? (m = p._stockParticles.pop())._reset() : m = new P_(p), p._subEmitters && p._subEmitters.length > 0) {
+ var S = p._subEmitters[Math.floor(Math.random() * p._subEmitters.length)];
+ m._attachedSubEmitters = [], S.forEach(function(O) {
+ if (O.type === Uo.ATTACHED) {
+ var I = O.clone();
+ m._attachedSubEmitters.push(I), I.particleSystem.start();
+ }
+ });
+ }
+ return m;
+ }, p._emitFromParticle = function(m) {
+ if (p._subEmitters && p._subEmitters.length !== 0) {
+ var S = Math.floor(Math.random() * p._subEmitters.length);
+ p._subEmitters[S].forEach(function(O) {
+ if (O.type === Uo.END) {
+ var I = O.clone();
+ m._inheritParticleInfoToSubEmitter(I), I.particleSystem._rootParticleSystem = p, p.activeSubSystems.push(I.particleSystem), I.particleSystem.start();
+ }
+ });
+ }
+ }, p._capacity = n, p._epsilon = s, p._isAnimationSheetEnabled = a, i && i.getClassName() !== "Scene" ? (p._engine = i, p.defaultProjectionMatrix = c.a.PerspectiveFovLH(0.8, 1, 0.1, 100)) : (p._scene = i || te.a.LastCreatedScene, p._engine = p._scene.getEngine(), p.uniqueId = p._scene.getUniqueId(), p._scene.particleSystems.push(p)), p._engine.getCaps().vertexArrayObject && (p._vertexArrayObject = null), p._attachImageProcessingConfiguration(null), p._customEffect = { 0: o }, p._useInstancing = p._engine.getCaps().instancedArrays, p._createIndexBuffer(), p._createVertexBuffers(), p.particleEmitterType = new Fo(), p.updateFunction = function(m) {
+ var S = null, O = null;
+ p.noiseTexture && (S = p.noiseTexture.getSize(), O = p.noiseTexture.getContent());
+ for (var I, G = function() {
+ I = m[k];
+ var K = p._scaledUpdateSpeed, re = I.age;
+ if (I.age += K, I.age > I.lifeTime) {
+ var se = I.age - re;
+ K = (I.lifeTime - re) * K / se, I.age = I.lifeTime;
+ }
+ var ue = I.age / I.lifeTime;
+ p._colorGradients && p._colorGradients.length > 0 ? jn.GetCurrentGradient(ue, p._colorGradients, function(xe, Pe, Ce) {
+ xe !== I._currentColorGradient && (I._currentColor1.copyFrom(I._currentColor2), Pe.getColorToRef(I._currentColor2), I._currentColorGradient = xe), C.b.LerpToRef(I._currentColor1, I._currentColor2, Ce, I.color);
+ }) : (I.colorStep.scaleToRef(K, p._scaledColorStep), I.color.addInPlace(p._scaledColorStep), I.color.a < 0 && (I.color.a = 0)), p._angularSpeedGradients && p._angularSpeedGradients.length > 0 && jn.GetCurrentGradient(ue, p._angularSpeedGradients, function(xe, Pe, Ce) {
+ xe !== I._currentAngularSpeedGradient && (I._currentAngularSpeed1 = I._currentAngularSpeed2, I._currentAngularSpeed2 = Pe.getFactor(), I._currentAngularSpeedGradient = xe), I.angularSpeed = ee.a.Lerp(I._currentAngularSpeed1, I._currentAngularSpeed2, Ce);
+ }), I.angle += I.angularSpeed * K;
+ var he = K;
+ if (p._velocityGradients && p._velocityGradients.length > 0 && jn.GetCurrentGradient(ue, p._velocityGradients, function(xe, Pe, Ce) {
+ xe !== I._currentVelocityGradient && (I._currentVelocity1 = I._currentVelocity2, I._currentVelocity2 = Pe.getFactor(), I._currentVelocityGradient = xe), he *= ee.a.Lerp(I._currentVelocity1, I._currentVelocity2, Ce);
+ }), I.direction.scaleToRef(he, p._scaledDirection), p._limitVelocityGradients && p._limitVelocityGradients.length > 0 && jn.GetCurrentGradient(ue, p._limitVelocityGradients, function(xe, Pe, Ce) {
+ xe !== I._currentLimitVelocityGradient && (I._currentLimitVelocity1 = I._currentLimitVelocity2, I._currentLimitVelocity2 = Pe.getFactor(), I._currentLimitVelocityGradient = xe);
+ var Fe = ee.a.Lerp(I._currentLimitVelocity1, I._currentLimitVelocity2, Ce);
+ I.direction.length() > Fe && I.direction.scaleInPlace(p.limitVelocityDamping);
+ }), p._dragGradients && p._dragGradients.length > 0 && jn.GetCurrentGradient(ue, p._dragGradients, function(xe, Pe, Ce) {
+ xe !== I._currentDragGradient && (I._currentDrag1 = I._currentDrag2, I._currentDrag2 = Pe.getFactor(), I._currentDragGradient = xe);
+ var Fe = ee.a.Lerp(I._currentDrag1, I._currentDrag2, Ce);
+ p._scaledDirection.scaleInPlace(1 - Fe);
+ }), p.isLocal && I._localPosition ? (I._localPosition.addInPlace(p._scaledDirection), c.e.TransformCoordinatesToRef(I._localPosition, p._emitterWorldMatrix, I.position)) : I.position.addInPlace(p._scaledDirection), O && S && I._randomNoiseCoordinates1) {
+ var pe = p._fetchR(I._randomNoiseCoordinates1.x, I._randomNoiseCoordinates1.y, S.width, S.height, O), ve = p._fetchR(I._randomNoiseCoordinates1.z, I._randomNoiseCoordinates2.x, S.width, S.height, O), Ee = p._fetchR(I._randomNoiseCoordinates2.y, I._randomNoiseCoordinates2.z, S.width, S.height, O), Ae = c.c.Vector3[0], Ie = c.c.Vector3[1];
+ Ae.copyFromFloats((2 * pe - 1) * p.noiseStrength.x, (2 * ve - 1) * p.noiseStrength.y, (2 * Ee - 1) * p.noiseStrength.z), Ae.scaleToRef(K, Ie), I.direction.addInPlace(Ie);
+ }
+ if (p.gravity.scaleToRef(K, p._scaledGravity), I.direction.addInPlace(p._scaledGravity), p._sizeGradients && p._sizeGradients.length > 0 && jn.GetCurrentGradient(ue, p._sizeGradients, function(xe, Pe, Ce) {
+ xe !== I._currentSizeGradient && (I._currentSize1 = I._currentSize2, I._currentSize2 = Pe.getFactor(), I._currentSizeGradient = xe), I.size = ee.a.Lerp(I._currentSize1, I._currentSize2, Ce);
+ }), p._useRampGradients && (p._colorRemapGradients && p._colorRemapGradients.length > 0 && jn.GetCurrentGradient(ue, p._colorRemapGradients, function(xe, Pe, Ce) {
+ var Fe = ee.a.Lerp(xe.factor1, Pe.factor1, Ce), Oe = ee.a.Lerp(xe.factor2, Pe.factor2, Ce);
+ I.remapData.x = Fe, I.remapData.y = Oe - Fe;
+ }), p._alphaRemapGradients && p._alphaRemapGradients.length > 0 && jn.GetCurrentGradient(ue, p._alphaRemapGradients, function(xe, Pe, Ce) {
+ var Fe = ee.a.Lerp(xe.factor1, Pe.factor1, Ce), Oe = ee.a.Lerp(xe.factor2, Pe.factor2, Ce);
+ I.remapData.z = Fe, I.remapData.w = Oe - Fe;
+ })), p._isAnimationSheetEnabled && I.updateCellIndex(), I._inheritParticleInfoToSubEmitters(), I.age >= I.lifeTime)
+ return p._emitFromParticle(I), I._attachedSubEmitters && (I._attachedSubEmitters.forEach(function(xe) {
+ xe.particleSystem.disposeOnStop = !0, xe.particleSystem.stop();
+ }), I._attachedSubEmitters = null), p.recycleParticle(I), k--, "continue";
+ }, k = 0; k < m.length; k++)
+ G();
+ }, p;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "onDispose", { set: function(e) {
+ this._onDisposeObserver && this.onDisposeObservable.remove(this._onDisposeObserver), this._onDisposeObserver = this.onDisposeObservable.add(e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "useRampGradients", { get: function() {
+ return this._useRampGradients;
+ }, set: function(e) {
+ this._useRampGradients !== e && (this._useRampGradients = e, this._resetEffect());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "particles", { get: function() {
+ return this._particles;
+ }, enumerable: !1, configurable: !0 }), t.prototype.getActiveCount = function() {
+ return this._particles.length;
+ }, t.prototype.getClassName = function() {
+ return "ParticleSystem";
+ }, t.prototype.isStopping = function() {
+ return this._stopped && this.isAlive();
+ }, t.prototype.getCustomEffect = function(e) {
+ var n;
+ return e === void 0 && (e = 0), (n = this._customEffect[e]) !== null && n !== void 0 ? n : this._customEffect[0];
+ }, t.prototype.setCustomEffect = function(e, n) {
+ n === void 0 && (n = 0), this._customEffect[n] = e;
+ }, Object.defineProperty(t.prototype, "onBeforeDrawParticlesObservable", { get: function() {
+ return this._onBeforeDrawParticlesObservable || (this._onBeforeDrawParticlesObservable = new P.c()), this._onBeforeDrawParticlesObservable;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "vertexShaderName", { get: function() {
+ return "particles";
+ }, enumerable: !1, configurable: !0 }), t.prototype._addFactorGradient = function(e, n, i, o) {
+ var a = new Iu(n, i, o);
+ e.push(a), e.sort(function(s, p) {
+ return s.gradient < p.gradient ? -1 : s.gradient > p.gradient ? 1 : 0;
+ });
+ }, t.prototype._removeFactorGradient = function(e, n) {
+ if (e)
+ for (var i = 0, o = 0, a = e; o < a.length; o++) {
+ if (a[o].gradient === n) {
+ e.splice(i, 1);
+ break;
+ }
+ i++;
+ }
+ }, t.prototype.addLifeTimeGradient = function(e, n, i) {
+ return this._lifeTimeGradients || (this._lifeTimeGradients = []), this._addFactorGradient(this._lifeTimeGradients, e, n, i), this;
+ }, t.prototype.removeLifeTimeGradient = function(e) {
+ return this._removeFactorGradient(this._lifeTimeGradients, e), this;
+ }, t.prototype.addSizeGradient = function(e, n, i) {
+ return this._sizeGradients || (this._sizeGradients = []), this._addFactorGradient(this._sizeGradients, e, n, i), this;
+ }, t.prototype.removeSizeGradient = function(e) {
+ return this._removeFactorGradient(this._sizeGradients, e), this;
+ }, t.prototype.addColorRemapGradient = function(e, n, i) {
+ return this._colorRemapGradients || (this._colorRemapGradients = []), this._addFactorGradient(this._colorRemapGradients, e, n, i), this;
+ }, t.prototype.removeColorRemapGradient = function(e) {
+ return this._removeFactorGradient(this._colorRemapGradients, e), this;
+ }, t.prototype.addAlphaRemapGradient = function(e, n, i) {
+ return this._alphaRemapGradients || (this._alphaRemapGradients = []), this._addFactorGradient(this._alphaRemapGradients, e, n, i), this;
+ }, t.prototype.removeAlphaRemapGradient = function(e) {
+ return this._removeFactorGradient(this._alphaRemapGradients, e), this;
+ }, t.prototype.addAngularSpeedGradient = function(e, n, i) {
+ return this._angularSpeedGradients || (this._angularSpeedGradients = []), this._addFactorGradient(this._angularSpeedGradients, e, n, i), this;
+ }, t.prototype.removeAngularSpeedGradient = function(e) {
+ return this._removeFactorGradient(this._angularSpeedGradients, e), this;
+ }, t.prototype.addVelocityGradient = function(e, n, i) {
+ return this._velocityGradients || (this._velocityGradients = []), this._addFactorGradient(this._velocityGradients, e, n, i), this;
+ }, t.prototype.removeVelocityGradient = function(e) {
+ return this._removeFactorGradient(this._velocityGradients, e), this;
+ }, t.prototype.addLimitVelocityGradient = function(e, n, i) {
+ return this._limitVelocityGradients || (this._limitVelocityGradients = []), this._addFactorGradient(this._limitVelocityGradients, e, n, i), this;
+ }, t.prototype.removeLimitVelocityGradient = function(e) {
+ return this._removeFactorGradient(this._limitVelocityGradients, e), this;
+ }, t.prototype.addDragGradient = function(e, n, i) {
+ return this._dragGradients || (this._dragGradients = []), this._addFactorGradient(this._dragGradients, e, n, i), this;
+ }, t.prototype.removeDragGradient = function(e) {
+ return this._removeFactorGradient(this._dragGradients, e), this;
+ }, t.prototype.addEmitRateGradient = function(e, n, i) {
+ return this._emitRateGradients || (this._emitRateGradients = []), this._addFactorGradient(this._emitRateGradients, e, n, i), this;
+ }, t.prototype.removeEmitRateGradient = function(e) {
+ return this._removeFactorGradient(this._emitRateGradients, e), this;
+ }, t.prototype.addStartSizeGradient = function(e, n, i) {
+ return this._startSizeGradients || (this._startSizeGradients = []), this._addFactorGradient(this._startSizeGradients, e, n, i), this;
+ }, t.prototype.removeStartSizeGradient = function(e) {
+ return this._removeFactorGradient(this._startSizeGradients, e), this;
+ }, t.prototype._createRampGradientTexture = function() {
+ if (this._rampGradients && this._rampGradients.length && !this._rampGradientsTexture && this._scene) {
+ for (var e = new Uint8Array(4 * this._rawTextureWidth), n = C.c.Color3[0], i = 0; i < this._rawTextureWidth; i++) {
+ var o = i / this._rawTextureWidth;
+ jn.GetCurrentGradient(o, this._rampGradients, function(a, s, p) {
+ C.a.LerpToRef(a.color, s.color, p, n), e[4 * i] = 255 * n.r, e[4 * i + 1] = 255 * n.g, e[4 * i + 2] = 255 * n.b, e[4 * i + 3] = 255;
+ });
+ }
+ this._rampGradientsTexture = Ti.CreateRGBATexture(e, this._rawTextureWidth, 1, this._scene, !1, !1, d.a.TEXTURE_NEAREST_SAMPLINGMODE);
+ }
+ }, t.prototype.getRampGradients = function() {
+ return this._rampGradients;
+ }, t.prototype.forceRefreshGradients = function() {
+ this._syncRampGradientTexture();
+ }, t.prototype._syncRampGradientTexture = function() {
+ this._rampGradients && (this._rampGradients.sort(function(e, n) {
+ return e.gradient < n.gradient ? -1 : e.gradient > n.gradient ? 1 : 0;
+ }), this._rampGradientsTexture && (this._rampGradientsTexture.dispose(), this._rampGradientsTexture = null), this._createRampGradientTexture());
+ }, t.prototype.addRampGradient = function(e, n) {
+ this._rampGradients || (this._rampGradients = []);
+ var i = new A_(e, n);
+ return this._rampGradients.push(i), this._syncRampGradientTexture(), this;
+ }, t.prototype.removeRampGradient = function(e) {
+ return this._removeGradientAndTexture(e, this._rampGradients, this._rampGradientsTexture), this._rampGradientsTexture = null, this._rampGradients && this._rampGradients.length > 0 && this._createRampGradientTexture(), this;
+ }, t.prototype.addColorGradient = function(e, n, i) {
+ this._colorGradients || (this._colorGradients = []);
+ var o = new Mu(e, n, i);
+ return this._colorGradients.push(o), this._colorGradients.sort(function(a, s) {
+ return a.gradient < s.gradient ? -1 : a.gradient > s.gradient ? 1 : 0;
+ }), this;
+ }, t.prototype.removeColorGradient = function(e) {
+ if (!this._colorGradients)
+ return this;
+ for (var n = 0, i = 0, o = this._colorGradients; i < o.length; i++) {
+ if (o[i].gradient === e) {
+ this._colorGradients.splice(n, 1);
+ break;
+ }
+ n++;
+ }
+ return this;
+ }, t.prototype._fetchR = function(e, n, i, o, a) {
+ return a[4 * (((e = 0.5 * Math.abs(e) + 0.5) * i % i | 0) + ((n = 0.5 * Math.abs(n) + 0.5) * o % o | 0) * i)] / 255;
+ }, t.prototype._reset = function() {
+ this._resetEffect();
+ }, t.prototype._resetEffect = function() {
+ this._vertexBuffer && (this._vertexBuffer.dispose(), this._vertexBuffer = null), this._spriteBuffer && (this._spriteBuffer.dispose(), this._spriteBuffer = null), this._vertexArrayObject && (this._engine.releaseVertexArrayObject(this._vertexArrayObject), this._vertexArrayObject = null), this._createVertexBuffers();
+ }, t.prototype._createVertexBuffers = function() {
+ this._vertexBufferSize = this._useInstancing ? 10 : 12, this._isAnimationSheetEnabled && (this._vertexBufferSize += 1), this._isBillboardBased && this.billboardMode !== t.BILLBOARDMODE_STRETCHED || (this._vertexBufferSize += 3), this._useRampGradients && (this._vertexBufferSize += 4);
+ var e = this._engine;
+ this._vertexData = new Float32Array(this._capacity * this._vertexBufferSize * (this._useInstancing ? 1 : 4)), this._vertexBuffer = new De.a(e, this._vertexData, !0, this._vertexBufferSize);
+ var n = 0, i = this._vertexBuffer.createVertexBuffer(De.b.PositionKind, n, 3, this._vertexBufferSize, this._useInstancing);
+ this._vertexBuffers[De.b.PositionKind] = i, n += 3;
+ var o = this._vertexBuffer.createVertexBuffer(De.b.ColorKind, n, 4, this._vertexBufferSize, this._useInstancing);
+ this._vertexBuffers[De.b.ColorKind] = o, n += 4;
+ var a = this._vertexBuffer.createVertexBuffer("angle", n, 1, this._vertexBufferSize, this._useInstancing);
+ this._vertexBuffers.angle = a, n += 1;
+ var s, p = this._vertexBuffer.createVertexBuffer("size", n, 2, this._vertexBufferSize, this._useInstancing);
+ if (this._vertexBuffers.size = p, n += 2, this._isAnimationSheetEnabled) {
+ var m = this._vertexBuffer.createVertexBuffer("cellIndex", n, 1, this._vertexBufferSize, this._useInstancing);
+ this._vertexBuffers.cellIndex = m, n += 1;
+ }
+ if (!this._isBillboardBased || this.billboardMode === t.BILLBOARDMODE_STRETCHED) {
+ var S = this._vertexBuffer.createVertexBuffer("direction", n, 3, this._vertexBufferSize, this._useInstancing);
+ this._vertexBuffers.direction = S, n += 3;
+ }
+ if (this._useRampGradients) {
+ var O = this._vertexBuffer.createVertexBuffer("remapData", n, 4, this._vertexBufferSize, this._useInstancing);
+ this._vertexBuffers.remapData = O, n += 4;
+ }
+ if (this._useInstancing) {
+ var I = new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]);
+ this._spriteBuffer = new De.a(e, I, !1, 2), s = this._spriteBuffer.createVertexBuffer("offset", 0, 2);
+ } else
+ s = this._vertexBuffer.createVertexBuffer("offset", n, 2, this._vertexBufferSize, this._useInstancing), n += 2;
+ this._vertexBuffers.offset = s;
+ }, t.prototype._createIndexBuffer = function() {
+ if (!this._useInstancing) {
+ for (var e = [], n = 0, i = 0; i < this._capacity; i++)
+ e.push(n), e.push(n + 1), e.push(n + 2), e.push(n), e.push(n + 2), e.push(n + 3), n += 4;
+ this._indexBuffer = this._engine.createIndexBuffer(e);
+ }
+ }, t.prototype.getCapacity = function() {
+ return this._capacity;
+ }, t.prototype.isAlive = function() {
+ return this._alive;
+ }, t.prototype.isStarted = function() {
+ return this._started;
+ }, t.prototype._prepareSubEmitterInternalArray = function() {
+ var e = this;
+ this._subEmitters = new Array(), this.subEmitters && this.subEmitters.forEach(function(n) {
+ n instanceof t ? e._subEmitters.push([new za(n)]) : n instanceof za ? e._subEmitters.push([n]) : n instanceof Array && e._subEmitters.push(n);
+ });
+ }, t.prototype.start = function(e) {
+ var n, i = this;
+ if (e === void 0 && (e = this.startDelay), !this.targetStopDuration && this._hasTargetStopDurationDependantGradient())
+ throw "Particle system started with a targetStopDuration dependant gradient (eg. startSizeGradients) but no targetStopDuration set";
+ if (e)
+ setTimeout(function() {
+ i.start(0);
+ }, e);
+ else {
+ if (this._prepareSubEmitterInternalArray(), this._started = !0, this._stopped = !1, this._actualFrame = 0, this._subEmitters && this._subEmitters.length != 0 && (this.activeSubSystems = new Array()), this._emitRateGradients && (this._emitRateGradients.length > 0 && (this._currentEmitRateGradient = this._emitRateGradients[0], this._currentEmitRate1 = this._currentEmitRateGradient.getFactor(), this._currentEmitRate2 = this._currentEmitRate1), this._emitRateGradients.length > 1 && (this._currentEmitRate2 = this._emitRateGradients[1].getFactor())), this._startSizeGradients && (this._startSizeGradients.length > 0 && (this._currentStartSizeGradient = this._startSizeGradients[0], this._currentStartSize1 = this._currentStartSizeGradient.getFactor(), this._currentStartSize2 = this._currentStartSize1), this._startSizeGradients.length > 1 && (this._currentStartSize2 = this._startSizeGradients[1].getFactor())), this.preWarmCycles) {
+ ((n = this.emitter) === null || n === void 0 ? void 0 : n.getClassName().indexOf("Mesh")) !== -1 && this.emitter.computeWorldMatrix(!0);
+ var o = this.noiseTexture;
+ if (o && o.onGeneratedObservable)
+ o.onGeneratedObservable.addOnce(function() {
+ setTimeout(function() {
+ for (var s = 0; s < i.preWarmCycles; s++)
+ i.animate(!0), o.render();
+ });
+ });
+ else
+ for (var a = 0; a < this.preWarmCycles; a++)
+ this.animate(!0);
+ }
+ this.beginAnimationOnStart && this.animations && this.animations.length > 0 && this._scene && this._scene.beginAnimation(this, this.beginAnimationFrom, this.beginAnimationTo, this.beginAnimationLoop);
+ }
+ }, t.prototype.stop = function(e) {
+ e === void 0 && (e = !0), this._stopped || (this.onStoppedObservable.notifyObservers(this), this._stopped = !0, e && this._stopSubEmitters());
+ }, t.prototype.reset = function() {
+ this._stockParticles = [], this._particles = [];
+ }, t.prototype._appendParticleVertex = function(e, n, i, o) {
+ var a = e * this._vertexBufferSize;
+ if (this._vertexData[a++] = n.position.x + this.worldOffset.x, this._vertexData[a++] = n.position.y + this.worldOffset.y, this._vertexData[a++] = n.position.z + this.worldOffset.z, this._vertexData[a++] = n.color.r, this._vertexData[a++] = n.color.g, this._vertexData[a++] = n.color.b, this._vertexData[a++] = n.color.a, this._vertexData[a++] = n.angle, this._vertexData[a++] = n.scale.x * n.size, this._vertexData[a++] = n.scale.y * n.size, this._isAnimationSheetEnabled && (this._vertexData[a++] = n.cellIndex), this._isBillboardBased)
+ this.billboardMode === t.BILLBOARDMODE_STRETCHED && (this._vertexData[a++] = n.direction.x, this._vertexData[a++] = n.direction.y, this._vertexData[a++] = n.direction.z);
+ else if (n._initialDirection) {
+ var s = n._initialDirection;
+ this.isLocal && (c.e.TransformNormalToRef(s, this._emitterWorldMatrix, c.c.Vector3[0]), s = c.c.Vector3[0]), s.x === 0 && s.z === 0 && (s.x = 1e-3), this._vertexData[a++] = s.x, this._vertexData[a++] = s.y, this._vertexData[a++] = s.z;
+ } else {
+ var p = n.direction;
+ this.isLocal && (c.e.TransformNormalToRef(p, this._emitterWorldMatrix, c.c.Vector3[0]), p = c.c.Vector3[0]), p.x === 0 && p.z === 0 && (p.x = 1e-3), this._vertexData[a++] = p.x, this._vertexData[a++] = p.y, this._vertexData[a++] = p.z;
+ }
+ this._useRampGradients && n.remapData && (this._vertexData[a++] = n.remapData.x, this._vertexData[a++] = n.remapData.y, this._vertexData[a++] = n.remapData.z, this._vertexData[a++] = n.remapData.w), this._useInstancing || (this._isAnimationSheetEnabled && (i === 0 ? i = this._epsilon : i === 1 && (i = 1 - this._epsilon), o === 0 ? o = this._epsilon : o === 1 && (o = 1 - this._epsilon)), this._vertexData[a++] = i, this._vertexData[a++] = o);
+ }, t.prototype._stopSubEmitters = function() {
+ this.activeSubSystems && (this.activeSubSystems.forEach(function(e) {
+ e.stop(!0);
+ }), this.activeSubSystems = new Array());
+ }, t.prototype._removeFromRoot = function() {
+ if (this._rootParticleSystem) {
+ var e = this._rootParticleSystem.activeSubSystems.indexOf(this);
+ e !== -1 && this._rootParticleSystem.activeSubSystems.splice(e, 1), this._rootParticleSystem = null;
+ }
+ }, t.prototype._update = function(e) {
+ var n, i = this;
+ if (this._alive = this._particles.length > 0, this.emitter.position) {
+ var o = this.emitter;
+ this._emitterWorldMatrix = o.getWorldMatrix();
+ } else {
+ var a = this.emitter;
+ this._emitterWorldMatrix = c.a.Translation(a.x, a.y, a.z);
+ }
+ this.updateFunction(this._particles);
+ for (var s, p = function() {
+ if (m._particles.length === m._capacity)
+ return "break";
+ if (n = m._createParticle(), m._particles.push(n), m.targetStopDuration && m._lifeTimeGradients && m._lifeTimeGradients.length > 0) {
+ var O = ee.a.Clamp(m._actualFrame / m.targetStopDuration);
+ jn.GetCurrentGradient(O, m._lifeTimeGradients, function(k, K) {
+ var re = k, se = K, ue = re.getFactor(), he = se.getFactor(), pe = (O - re.gradient) / (se.gradient - re.gradient);
+ n.lifeTime = ee.a.Lerp(ue, he, pe);
+ });
+ } else
+ n.lifeTime = ee.a.RandomRange(m.minLifeTime, m.maxLifeTime);
+ var I = ee.a.RandomRange(m.minEmitPower, m.maxEmitPower);
+ if (m.startPositionFunction ? m.startPositionFunction(m._emitterWorldMatrix, n.position, n, m.isLocal) : m.particleEmitterType.startPositionFunction(m._emitterWorldMatrix, n.position, n, m.isLocal), m.isLocal && (n._localPosition ? n._localPosition.copyFrom(n.position) : n._localPosition = n.position.clone(), c.e.TransformCoordinatesToRef(n._localPosition, m._emitterWorldMatrix, n.position)), m.startDirectionFunction ? m.startDirectionFunction(m._emitterWorldMatrix, n.direction, n, m.isLocal) : m.particleEmitterType.startDirectionFunction(m._emitterWorldMatrix, n.direction, n, m.isLocal), I === 0 ? n._initialDirection ? n._initialDirection.copyFrom(n.direction) : n._initialDirection = n.direction.clone() : n._initialDirection = null, n.direction.scaleInPlace(I), m._sizeGradients && m._sizeGradients.length !== 0 ? (n._currentSizeGradient = m._sizeGradients[0], n._currentSize1 = n._currentSizeGradient.getFactor(), n.size = n._currentSize1, m._sizeGradients.length > 1 ? n._currentSize2 = m._sizeGradients[1].getFactor() : n._currentSize2 = n._currentSize1) : n.size = ee.a.RandomRange(m.minSize, m.maxSize), n.scale.copyFromFloats(ee.a.RandomRange(m.minScaleX, m.maxScaleX), ee.a.RandomRange(m.minScaleY, m.maxScaleY)), m._startSizeGradients && m._startSizeGradients[0] && m.targetStopDuration) {
+ var G = m._actualFrame / m.targetStopDuration;
+ jn.GetCurrentGradient(G, m._startSizeGradients, function(k, K, re) {
+ k !== i._currentStartSizeGradient && (i._currentStartSize1 = i._currentStartSize2, i._currentStartSize2 = K.getFactor(), i._currentStartSizeGradient = k);
+ var se = ee.a.Lerp(i._currentStartSize1, i._currentStartSize2, re);
+ n.scale.scaleInPlace(se);
+ });
+ }
+ m._angularSpeedGradients && m._angularSpeedGradients.length !== 0 ? (n._currentAngularSpeedGradient = m._angularSpeedGradients[0], n.angularSpeed = n._currentAngularSpeedGradient.getFactor(), n._currentAngularSpeed1 = n.angularSpeed, m._angularSpeedGradients.length > 1 ? n._currentAngularSpeed2 = m._angularSpeedGradients[1].getFactor() : n._currentAngularSpeed2 = n._currentAngularSpeed1) : n.angularSpeed = ee.a.RandomRange(m.minAngularSpeed, m.maxAngularSpeed), n.angle = ee.a.RandomRange(m.minInitialRotation, m.maxInitialRotation), m._velocityGradients && m._velocityGradients.length > 0 && (n._currentVelocityGradient = m._velocityGradients[0], n._currentVelocity1 = n._currentVelocityGradient.getFactor(), m._velocityGradients.length > 1 ? n._currentVelocity2 = m._velocityGradients[1].getFactor() : n._currentVelocity2 = n._currentVelocity1), m._limitVelocityGradients && m._limitVelocityGradients.length > 0 && (n._currentLimitVelocityGradient = m._limitVelocityGradients[0], n._currentLimitVelocity1 = n._currentLimitVelocityGradient.getFactor(), m._limitVelocityGradients.length > 1 ? n._currentLimitVelocity2 = m._limitVelocityGradients[1].getFactor() : n._currentLimitVelocity2 = n._currentLimitVelocity1), m._dragGradients && m._dragGradients.length > 0 && (n._currentDragGradient = m._dragGradients[0], n._currentDrag1 = n._currentDragGradient.getFactor(), m._dragGradients.length > 1 ? n._currentDrag2 = m._dragGradients[1].getFactor() : n._currentDrag2 = n._currentDrag1), m._colorGradients && m._colorGradients.length !== 0 ? (n._currentColorGradient = m._colorGradients[0], n._currentColorGradient.getColorToRef(n.color), n._currentColor1.copyFrom(n.color), m._colorGradients.length > 1 ? m._colorGradients[1].getColorToRef(n._currentColor2) : n._currentColor2.copyFrom(n.color)) : (s = ee.a.RandomRange(0, 1), C.b.LerpToRef(m.color1, m.color2, s, n.color), m.colorDead.subtractToRef(n.color, m._colorDiff), m._colorDiff.scaleToRef(1 / n.lifeTime, n.colorStep)), m._isAnimationSheetEnabled && (n._initialStartSpriteCellID = m.startSpriteCellID, n._initialEndSpriteCellID = m.endSpriteCellID), n.direction.addInPlace(m._inheritedVelocityOffset), m._useRampGradients && (n.remapData = new c.f(0, 1, 0, 1)), m.noiseTexture && (n._randomNoiseCoordinates1 ? (n._randomNoiseCoordinates1.copyFromFloats(Math.random(), Math.random(), Math.random()), n._randomNoiseCoordinates2.copyFromFloats(Math.random(), Math.random(), Math.random())) : (n._randomNoiseCoordinates1 = new c.e(Math.random(), Math.random(), Math.random()), n._randomNoiseCoordinates2 = new c.e(Math.random(), Math.random(), Math.random()))), n._inheritParticleInfoToSubEmitters();
+ }, m = this, S = 0; S < e && p() !== "break"; S++)
+ ;
+ }, t._GetAttributeNamesOrOptions = function(e, n, i) {
+ e === void 0 && (e = !1), n === void 0 && (n = !1), i === void 0 && (i = !1);
+ var o = [De.b.PositionKind, De.b.ColorKind, "angle", "offset", "size"];
+ return e && o.push("cellIndex"), n || o.push("direction"), i && o.push("remapData"), o;
+ }, t._GetEffectCreationOptions = function(e) {
+ e === void 0 && (e = !1);
+ var n = ["invView", "view", "projection", "vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6", "textureMask", "translationPivot", "eyePosition"];
+ return e && n.push("particlesInfos"), n;
+ }, t.prototype.fillDefines = function(e, n) {
+ if (this._scene && (this._scene.clipPlane && e.push("#define CLIPPLANE"), this._scene.clipPlane2 && e.push("#define CLIPPLANE2"), this._scene.clipPlane3 && e.push("#define CLIPPLANE3"), this._scene.clipPlane4 && e.push("#define CLIPPLANE4"), this._scene.clipPlane5 && e.push("#define CLIPPLANE5"), this._scene.clipPlane6 && e.push("#define CLIPPLANE6")), this._isAnimationSheetEnabled && e.push("#define ANIMATESHEET"), n === t.BLENDMODE_MULTIPLY && e.push("#define BLENDMULTIPLYMODE"), this._useRampGradients && e.push("#define RAMPGRADIENT"), this._isBillboardBased)
+ switch (e.push("#define BILLBOARD"), this.billboardMode) {
+ case t.BILLBOARDMODE_Y:
+ e.push("#define BILLBOARDY");
+ break;
+ case t.BILLBOARDMODE_STRETCHED:
+ e.push("#define BILLBOARDSTRETCHED");
+ break;
+ case t.BILLBOARDMODE_ALL:
+ e.push("#define BILLBOARDMODE_ALL");
+ }
+ this._imageProcessingConfiguration && (this._imageProcessingConfiguration.prepareDefines(this._imageProcessingConfigurationDefines), e.push(this._imageProcessingConfigurationDefines.toString()));
+ }, t.prototype.fillUniformsAttributesAndSamplerNames = function(e, n, i) {
+ n.push.apply(n, t._GetAttributeNamesOrOptions(this._isAnimationSheetEnabled, this._isBillboardBased && this.billboardMode !== t.BILLBOARDMODE_STRETCHED, this._useRampGradients)), e.push.apply(e, t._GetEffectCreationOptions(this._isAnimationSheetEnabled)), i.push("diffuseSampler", "rampSampler"), this._imageProcessingConfiguration && (In.a.PrepareUniforms(e, this._imageProcessingConfigurationDefines), In.a.PrepareSamplers(i, this._imageProcessingConfigurationDefines));
+ }, t.prototype._getEffect = function(e) {
+ var n = this.getCustomEffect(e);
+ if (n)
+ return n;
+ var i = [];
+ this.fillDefines(i, e);
+ var o = i.join(`
+`);
+ if (this._cachedDefines !== o) {
+ this._cachedDefines = o;
+ var a = [], s = [], p = [];
+ this.fillUniformsAttributesAndSamplerNames(s, a, p), this._effect = this._engine.createEffect("particles", a, s, p, o);
+ }
+ return this._effect;
+ }, t.prototype.animate = function(e) {
+ var n, i = this;
+ if (e === void 0 && (e = !1), this._started) {
+ if (!e && this._scene) {
+ if (!this.isReady() || this._currentRenderId === this._scene.getFrameId())
+ return;
+ this._currentRenderId = this._scene.getFrameId();
+ }
+ var o;
+ if (this._scaledUpdateSpeed = this.updateSpeed * (e ? this.preWarmStepOffset : ((n = this._scene) === null || n === void 0 ? void 0 : n.getAnimationRatio()) || 1), this.manualEmitCount > -1)
+ o = this.manualEmitCount, this._newPartsExcess = 0, this.manualEmitCount = 0;
+ else {
+ var a = this.emitRate;
+ if (this._emitRateGradients && this._emitRateGradients.length > 0 && this.targetStopDuration) {
+ var s = this._actualFrame / this.targetStopDuration;
+ jn.GetCurrentGradient(s, this._emitRateGradients, function(O, I, G) {
+ O !== i._currentEmitRateGradient && (i._currentEmitRate1 = i._currentEmitRate2, i._currentEmitRate2 = I.getFactor(), i._currentEmitRateGradient = O), a = ee.a.Lerp(i._currentEmitRate1, i._currentEmitRate2, G);
+ });
+ }
+ o = a * this._scaledUpdateSpeed >> 0, this._newPartsExcess += a * this._scaledUpdateSpeed - o;
+ }
+ if (this._newPartsExcess > 1 && (o += this._newPartsExcess >> 0, this._newPartsExcess -= this._newPartsExcess >> 0), this._alive = !1, this._stopped ? o = 0 : (this._actualFrame += this._scaledUpdateSpeed, this.targetStopDuration && this._actualFrame >= this.targetStopDuration && this.stop()), this._update(o), this._stopped && (this._alive || (this._started = !1, this.onAnimationEnd && this.onAnimationEnd(), this.disposeOnStop && this._scene && this._scene._toBeDisposed.push(this))), !e) {
+ for (var p = 0, m = 0; m < this._particles.length; m++) {
+ var S = this._particles[m];
+ this._appendParticleVertices(p, S), p += this._useInstancing ? 1 : 4;
+ }
+ this._vertexBuffer && this._vertexBuffer.update(this._vertexData);
+ }
+ this.manualEmitCount === 0 && this.disposeOnStop && this.stop();
+ }
+ }, t.prototype._appendParticleVertices = function(e, n) {
+ this._appendParticleVertex(e++, n, 0, 0), this._useInstancing || (this._appendParticleVertex(e++, n, 1, 0), this._appendParticleVertex(e++, n, 1, 1), this._appendParticleVertex(e++, n, 0, 1));
+ }, t.prototype.rebuild = function() {
+ for (var e in this._createIndexBuffer(), this._vertexBuffer && this._vertexBuffer._rebuild(), this._vertexBuffers)
+ this._vertexBuffers[e]._rebuild();
+ }, t.prototype.isReady = function() {
+ if (!this.emitter || this._imageProcessingConfiguration && !this._imageProcessingConfiguration.isReady() || !this.particleTexture || !this.particleTexture.isReady())
+ return !1;
+ if (this.blendMode !== t.BLENDMODE_MULTIPLYADD) {
+ if (!this._getEffect(this.blendMode).isReady())
+ return !1;
+ } else if (!this._getEffect(t.BLENDMODE_MULTIPLY).isReady() || !this._getEffect(t.BLENDMODE_ADD).isReady())
+ return !1;
+ return !0;
+ }, t.prototype._render = function(e) {
+ var n, i, o = this._getEffect(e), a = this._engine;
+ a.enableEffect(o);
+ var s = (n = this.defaultViewMatrix) !== null && n !== void 0 ? n : this._scene.getViewMatrix();
+ if (o.setTexture("diffuseSampler", this.particleTexture), o.setMatrix("view", s), o.setMatrix("projection", (i = this.defaultProjectionMatrix) !== null && i !== void 0 ? i : this._scene.getProjectionMatrix()), this._isAnimationSheetEnabled && this.particleTexture) {
+ var p = this.particleTexture.getBaseSize();
+ o.setFloat3("particlesInfos", this.spriteCellWidth / p.width, this.spriteCellHeight / p.height, this.spriteCellWidth / p.width);
+ }
+ if (o.setVector2("translationPivot", this.translationPivot), o.setFloat4("textureMask", this.textureMask.r, this.textureMask.g, this.textureMask.b, this.textureMask.a), this._isBillboardBased && this._scene) {
+ var m = this._scene.activeCamera;
+ o.setVector3("eyePosition", m.globalPosition);
+ }
+ this._rampGradientsTexture && (this._rampGradients && this._rampGradients.length || (this._rampGradientsTexture.dispose(), this._rampGradientsTexture = null), o.setTexture("rampSampler", this._rampGradientsTexture));
+ var S = o.defines;
+ switch (this._scene && (this._scene.clipPlane || this._scene.clipPlane2 || this._scene.clipPlane3 || this._scene.clipPlane4 || this._scene.clipPlane5 || this._scene.clipPlane6) && tp.a.BindClipPlane(o, this._scene), S.indexOf("#define BILLBOARDMODE_ALL") >= 0 && (s.invertToRef(c.c.Matrix[0]), o.setMatrix("invView", c.c.Matrix[0])), this._vertexArrayObject !== void 0 ? (this._vertexArrayObject || (this._vertexArrayObject = this._engine.recordVertexArrayObject(this._vertexBuffers, this._indexBuffer, o)), this._engine.bindVertexArrayObject(this._vertexArrayObject, this._indexBuffer)) : a.bindBuffers(this._vertexBuffers, this._indexBuffer, o), this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess && this._imageProcessingConfiguration.bind(o), e) {
+ case t.BLENDMODE_ADD:
+ a.setAlphaMode(d.a.ALPHA_ADD);
+ break;
+ case t.BLENDMODE_ONEONE:
+ a.setAlphaMode(d.a.ALPHA_ONEONE);
+ break;
+ case t.BLENDMODE_STANDARD:
+ a.setAlphaMode(d.a.ALPHA_COMBINE);
+ break;
+ case t.BLENDMODE_MULTIPLY:
+ a.setAlphaMode(d.a.ALPHA_MULTIPLY);
+ }
+ return this._onBeforeDrawParticlesObservable && this._onBeforeDrawParticlesObservable.notifyObservers(o), this._useInstancing ? a.drawArraysType(d.a.MATERIAL_TriangleFanDrawMode, 0, 4, this._particles.length) : a.drawElementsType(d.a.MATERIAL_TriangleFillMode, 0, 6 * this._particles.length), this._particles.length;
+ }, t.prototype.render = function() {
+ if (!this.isReady() || !this._particles.length)
+ return 0;
+ var e = this._engine;
+ e.setState && (e.setState(!1), this.forceDepthWrite && e.setDepthWrite(!0));
+ var n = 0;
+ return n = this.blendMode === t.BLENDMODE_MULTIPLYADD ? this._render(t.BLENDMODE_MULTIPLY) + this._render(t.BLENDMODE_ADD) : this._render(this.blendMode), this._engine.unbindInstanceAttributes(), this._engine.setAlphaMode(d.a.ALPHA_DISABLE), n;
+ }, t.prototype.dispose = function(e) {
+ if (e === void 0 && (e = !0), this._vertexBuffer && (this._vertexBuffer.dispose(), this._vertexBuffer = null), this._spriteBuffer && (this._spriteBuffer.dispose(), this._spriteBuffer = null), this._indexBuffer && (this._engine._releaseBuffer(this._indexBuffer), this._indexBuffer = null), this._vertexArrayObject && (this._engine.releaseVertexArrayObject(this._vertexArrayObject), this._vertexArrayObject = null), e && this.particleTexture && (this.particleTexture.dispose(), this.particleTexture = null), e && this.noiseTexture && (this.noiseTexture.dispose(), this.noiseTexture = null), this._rampGradientsTexture && (this._rampGradientsTexture.dispose(), this._rampGradientsTexture = null), this._removeFromRoot(), this._subEmitters && this._subEmitters.length) {
+ for (var n = 0; n < this._subEmitters.length; n++)
+ for (var i = 0, o = this._subEmitters[n]; i < o.length; i++)
+ o[i].dispose();
+ this._subEmitters = [], this.subEmitters = [];
+ }
+ this._disposeEmitterOnDispose && this.emitter && this.emitter.dispose && this.emitter.dispose(!0), this._onBeforeDrawParticlesObservable && this._onBeforeDrawParticlesObservable.clear(), this._scene && ((n = this._scene.particleSystems.indexOf(this)) > -1 && this._scene.particleSystems.splice(n, 1), this._scene._activeParticleSystems.dispose()), this.onDisposeObservable.notifyObservers(this), this.onDisposeObservable.clear(), this.onStoppedObservable.clear(), this.reset();
+ }, t.prototype.clone = function(e, n) {
+ var i = Object(u.a)({}, this._customEffect), o = null, a = this._engine;
+ if (a.createEffectForParticles && this.customShader != null) {
+ var s = (o = this.customShader).shaderOptions.defines.length > 0 ? o.shaderOptions.defines.join(`
+`) : "";
+ i[0] = a.createEffectForParticles(o.shaderPath.fragmentElement, o.shaderOptions.uniforms, o.shaderOptions.samplers, s);
+ }
+ var p = this.serialize(), m = t.Parse(p, this._scene || this._engine, "");
+ return m.name = e, m.customShader = o, m._customEffect = i, n === void 0 && (n = this.emitter), this.noiseTexture && (m.noiseTexture = this.noiseTexture.clone()), m.emitter = n, this.preventAutoStart || m.start(), m;
+ }, t.prototype.serialize = function(e) {
+ e === void 0 && (e = !1);
+ var n = {};
+ if (t._Serialize(n, this, e), n.textureMask = this.textureMask.asArray(), n.customShader = this.customShader, n.preventAutoStart = this.preventAutoStart, this.subEmitters) {
+ n.subEmitters = [], this._subEmitters || this._prepareSubEmitterInternalArray();
+ for (var i = 0, o = this._subEmitters; i < o.length; i++) {
+ for (var a = [], s = 0, p = o[i]; s < p.length; s++) {
+ var m = p[s];
+ a.push(m.serialize());
+ }
+ n.subEmitters.push(a);
+ }
+ }
+ return n;
+ }, t._Serialize = function(e, n, i) {
+ if (e.name = n.name, e.id = n.id, e.capacity = n.getCapacity(), n.emitter.position) {
+ var o = n.emitter;
+ e.emitterId = o.id;
+ } else {
+ var a = n.emitter;
+ e.emitter = a.asArray();
+ }
+ n.particleEmitterType && (e.particleEmitterType = n.particleEmitterType.serialize()), n.particleTexture && (i ? e.texture = n.particleTexture.serialize() : (e.textureName = n.particleTexture.name, e.invertY = !!n.particleTexture._invertY)), e.isLocal = n.isLocal, w.a.AppendSerializedAnimations(n, e), e.beginAnimationOnStart = n.beginAnimationOnStart, e.beginAnimationFrom = n.beginAnimationFrom, e.beginAnimationTo = n.beginAnimationTo, e.beginAnimationLoop = n.beginAnimationLoop, e.startDelay = n.startDelay, e.renderingGroupId = n.renderingGroupId, e.isBillboardBased = n.isBillboardBased, e.billboardMode = n.billboardMode, e.minAngularSpeed = n.minAngularSpeed, e.maxAngularSpeed = n.maxAngularSpeed, e.minSize = n.minSize, e.maxSize = n.maxSize, e.minScaleX = n.minScaleX, e.maxScaleX = n.maxScaleX, e.minScaleY = n.minScaleY, e.maxScaleY = n.maxScaleY, e.minEmitPower = n.minEmitPower, e.maxEmitPower = n.maxEmitPower, e.minLifeTime = n.minLifeTime, e.maxLifeTime = n.maxLifeTime, e.emitRate = n.emitRate, e.gravity = n.gravity.asArray(), e.noiseStrength = n.noiseStrength.asArray(), e.color1 = n.color1.asArray(), e.color2 = n.color2.asArray(), e.colorDead = n.colorDead.asArray(), e.updateSpeed = n.updateSpeed, e.targetStopDuration = n.targetStopDuration, e.blendMode = n.blendMode, e.preWarmCycles = n.preWarmCycles, e.preWarmStepOffset = n.preWarmStepOffset, e.minInitialRotation = n.minInitialRotation, e.maxInitialRotation = n.maxInitialRotation, e.startSpriteCellID = n.startSpriteCellID, e.endSpriteCellID = n.endSpriteCellID, e.spriteCellChangeSpeed = n.spriteCellChangeSpeed, e.spriteCellWidth = n.spriteCellWidth, e.spriteCellHeight = n.spriteCellHeight, e.spriteRandomStartCell = n.spriteRandomStartCell, e.isAnimationSheetEnabled = n.isAnimationSheetEnabled;
+ var s = n.getColorGradients();
+ if (s) {
+ e.colorGradients = [];
+ for (var p = 0, m = s; p < m.length; p++) {
+ var S = m[p], O = { gradient: S.gradient, color1: S.color1.asArray() };
+ S.color2 ? O.color2 = S.color2.asArray() : O.color2 = S.color1.asArray(), e.colorGradients.push(O);
+ }
+ }
+ var I = n.getRampGradients();
+ if (I) {
+ e.rampGradients = [];
+ for (var G = 0, k = I; G < k.length; G++) {
+ var K = k[G];
+ O = { gradient: K.gradient, color: K.color.asArray() }, e.rampGradients.push(O);
+ }
+ e.useRampGradients = n.useRampGradients;
+ }
+ var re = n.getColorRemapGradients();
+ if (re) {
+ e.colorRemapGradients = [];
+ for (var se = 0, ue = re; se < ue.length; se++) {
+ var he = ue[se];
+ O = { gradient: he.gradient, factor1: he.factor1 }, he.factor2 !== void 0 ? O.factor2 = he.factor2 : O.factor2 = he.factor1, e.colorRemapGradients.push(O);
+ }
+ }
+ var pe = n.getAlphaRemapGradients();
+ if (pe) {
+ e.alphaRemapGradients = [];
+ for (var ve = 0, Ee = pe; ve < Ee.length; ve++) {
+ var Ae = Ee[ve];
+ O = { gradient: Ae.gradient, factor1: Ae.factor1 }, Ae.factor2 !== void 0 ? O.factor2 = Ae.factor2 : O.factor2 = Ae.factor1, e.alphaRemapGradients.push(O);
+ }
+ }
+ var Ie = n.getSizeGradients();
+ if (Ie) {
+ e.sizeGradients = [];
+ for (var xe = 0, Pe = Ie; xe < Pe.length; xe++) {
+ var Ce = Pe[xe];
+ O = { gradient: Ce.gradient, factor1: Ce.factor1 }, Ce.factor2 !== void 0 ? O.factor2 = Ce.factor2 : O.factor2 = Ce.factor1, e.sizeGradients.push(O);
+ }
+ }
+ var Fe = n.getAngularSpeedGradients();
+ if (Fe) {
+ e.angularSpeedGradients = [];
+ for (var Oe = 0, Be = Fe; Oe < Be.length; Oe++) {
+ var Le = Be[Oe];
+ O = { gradient: Le.gradient, factor1: Le.factor1 }, Le.factor2 !== void 0 ? O.factor2 = Le.factor2 : O.factor2 = Le.factor1, e.angularSpeedGradients.push(O);
+ }
+ }
+ var Ve = n.getVelocityGradients();
+ if (Ve) {
+ e.velocityGradients = [];
+ for (var Qe = 0, nt = Ve; Qe < nt.length; Qe++) {
+ var rt = nt[Qe];
+ O = { gradient: rt.gradient, factor1: rt.factor1 }, rt.factor2 !== void 0 ? O.factor2 = rt.factor2 : O.factor2 = rt.factor1, e.velocityGradients.push(O);
+ }
+ }
+ var ut = n.getDragGradients();
+ if (ut) {
+ e.dragGradients = [];
+ for (var qe = 0, at = ut; qe < at.length; qe++) {
+ var ot = at[qe];
+ O = { gradient: ot.gradient, factor1: ot.factor1 }, ot.factor2 !== void 0 ? O.factor2 = ot.factor2 : O.factor2 = ot.factor1, e.dragGradients.push(O);
+ }
+ }
+ var Je = n.getEmitRateGradients();
+ if (Je) {
+ e.emitRateGradients = [];
+ for (var dt = 0, Ge = Je; dt < Ge.length; dt++) {
+ var $e = Ge[dt];
+ O = { gradient: $e.gradient, factor1: $e.factor1 }, $e.factor2 !== void 0 ? O.factor2 = $e.factor2 : O.factor2 = $e.factor1, e.emitRateGradients.push(O);
+ }
+ }
+ var yt = n.getStartSizeGradients();
+ if (yt) {
+ e.startSizeGradients = [];
+ for (var Jt = 0, Bt = yt; Jt < Bt.length; Jt++) {
+ var rn = Bt[Jt];
+ O = { gradient: rn.gradient, factor1: rn.factor1 }, rn.factor2 !== void 0 ? O.factor2 = rn.factor2 : O.factor2 = rn.factor1, e.startSizeGradients.push(O);
+ }
+ }
+ var vt = n.getLifeTimeGradients();
+ if (vt) {
+ e.lifeTimeGradients = [];
+ for (var sn = 0, $t = vt; sn < $t.length; sn++) {
+ var Qt = $t[sn];
+ O = { gradient: Qt.gradient, factor1: Qt.factor1 }, Qt.factor2 !== void 0 ? O.factor2 = Qt.factor2 : O.factor2 = Qt.factor1, e.lifeTimeGradients.push(O);
+ }
+ }
+ var en = n.getLimitVelocityGradients();
+ if (en) {
+ e.limitVelocityGradients = [];
+ for (var Tt = 0, It = en; Tt < It.length; Tt++) {
+ var cn = It[Tt];
+ O = { gradient: cn.gradient, factor1: cn.factor1 }, cn.factor2 !== void 0 ? O.factor2 = cn.factor2 : O.factor2 = cn.factor1, e.limitVelocityGradients.push(O);
+ }
+ e.limitVelocityDamping = n.limitVelocityDamping;
+ }
+ n.noiseTexture && (e.noiseTexture = n.noiseTexture.serialize());
+ }, t._Parse = function(e, n, i, o) {
+ var a;
+ a = i instanceof Gt.a ? null : i;
+ var s, p = x.a.GetClass("BABYLON.Texture");
+ if (p && a && (e.texture ? n.particleTexture = p.Parse(e.texture, a, o) : e.textureName && (n.particleTexture = new p(o + e.textureName, a, !1, e.invertY === void 0 || e.invertY), n.particleTexture.name = e.textureName)), e.emitterId || e.emitterId === 0 || e.emitter !== void 0 ? e.emitterId && a ? n.emitter = a.getLastMeshByID(e.emitterId) : n.emitter = c.e.FromArray(e.emitter) : n.emitter = c.e.Zero(), n.isLocal = !!e.isLocal, e.renderingGroupId !== void 0 && (n.renderingGroupId = e.renderingGroupId), e.isBillboardBased !== void 0 && (n.isBillboardBased = e.isBillboardBased), e.billboardMode !== void 0 && (n.billboardMode = e.billboardMode), e.animations) {
+ for (var m = 0; m < e.animations.length; m++) {
+ var S = e.animations[m], O = x.a.GetClass("BABYLON.Animation");
+ O && n.animations.push(O.Parse(S));
+ }
+ n.beginAnimationOnStart = e.beginAnimationOnStart, n.beginAnimationFrom = e.beginAnimationFrom, n.beginAnimationTo = e.beginAnimationTo, n.beginAnimationLoop = e.beginAnimationLoop;
+ }
+ if (e.autoAnimate && a && a.beginAnimation(n, e.autoAnimateFrom, e.autoAnimateTo, e.autoAnimateLoop, e.autoAnimateSpeed || 1), n.startDelay = 0 | e.startDelay, n.minAngularSpeed = e.minAngularSpeed, n.maxAngularSpeed = e.maxAngularSpeed, n.minSize = e.minSize, n.maxSize = e.maxSize, e.minScaleX && (n.minScaleX = e.minScaleX, n.maxScaleX = e.maxScaleX, n.minScaleY = e.minScaleY, n.maxScaleY = e.maxScaleY), e.preWarmCycles !== void 0 && (n.preWarmCycles = e.preWarmCycles, n.preWarmStepOffset = e.preWarmStepOffset), e.minInitialRotation !== void 0 && (n.minInitialRotation = e.minInitialRotation, n.maxInitialRotation = e.maxInitialRotation), n.minLifeTime = e.minLifeTime, n.maxLifeTime = e.maxLifeTime, n.minEmitPower = e.minEmitPower, n.maxEmitPower = e.maxEmitPower, n.emitRate = e.emitRate, n.gravity = c.e.FromArray(e.gravity), e.noiseStrength && (n.noiseStrength = c.e.FromArray(e.noiseStrength)), n.color1 = C.b.FromArray(e.color1), n.color2 = C.b.FromArray(e.color2), n.colorDead = C.b.FromArray(e.colorDead), n.updateSpeed = e.updateSpeed, n.targetStopDuration = e.targetStopDuration, n.blendMode = e.blendMode, e.colorGradients)
+ for (var I = 0, G = e.colorGradients; I < G.length; I++) {
+ var k = G[I];
+ n.addColorGradient(k.gradient, C.b.FromArray(k.color1), k.color2 ? C.b.FromArray(k.color2) : void 0);
+ }
+ if (e.rampGradients) {
+ for (var K = 0, re = e.rampGradients; K < re.length; K++) {
+ var se = re[K];
+ n.addRampGradient(se.gradient, C.a.FromArray(se.color));
+ }
+ n.useRampGradients = e.useRampGradients;
+ }
+ if (e.colorRemapGradients)
+ for (var ue = 0, he = e.colorRemapGradients; ue < he.length; ue++) {
+ var pe = he[ue];
+ n.addColorRemapGradient(pe.gradient, pe.factor1 !== void 0 ? pe.factor1 : pe.factor, pe.factor2);
+ }
+ if (e.alphaRemapGradients)
+ for (var ve = 0, Ee = e.alphaRemapGradients; ve < Ee.length; ve++) {
+ var Ae = Ee[ve];
+ n.addAlphaRemapGradient(Ae.gradient, Ae.factor1 !== void 0 ? Ae.factor1 : Ae.factor, Ae.factor2);
+ }
+ if (e.sizeGradients)
+ for (var Ie = 0, xe = e.sizeGradients; Ie < xe.length; Ie++) {
+ var Pe = xe[Ie];
+ n.addSizeGradient(Pe.gradient, Pe.factor1 !== void 0 ? Pe.factor1 : Pe.factor, Pe.factor2);
+ }
+ if (e.angularSpeedGradients)
+ for (var Ce = 0, Fe = e.angularSpeedGradients; Ce < Fe.length; Ce++) {
+ var Oe = Fe[Ce];
+ n.addAngularSpeedGradient(Oe.gradient, Oe.factor1 !== void 0 ? Oe.factor1 : Oe.factor, Oe.factor2);
+ }
+ if (e.velocityGradients)
+ for (var Be = 0, Le = e.velocityGradients; Be < Le.length; Be++) {
+ var Ve = Le[Be];
+ n.addVelocityGradient(Ve.gradient, Ve.factor1 !== void 0 ? Ve.factor1 : Ve.factor, Ve.factor2);
+ }
+ if (e.dragGradients)
+ for (var Qe = 0, nt = e.dragGradients; Qe < nt.length; Qe++) {
+ var rt = nt[Qe];
+ n.addDragGradient(rt.gradient, rt.factor1 !== void 0 ? rt.factor1 : rt.factor, rt.factor2);
+ }
+ if (e.emitRateGradients)
+ for (var ut = 0, qe = e.emitRateGradients; ut < qe.length; ut++) {
+ var at = qe[ut];
+ n.addEmitRateGradient(at.gradient, at.factor1 !== void 0 ? at.factor1 : at.factor, at.factor2);
+ }
+ if (e.startSizeGradients)
+ for (var ot = 0, Je = e.startSizeGradients; ot < Je.length; ot++) {
+ var dt = Je[ot];
+ n.addStartSizeGradient(dt.gradient, dt.factor1 !== void 0 ? dt.factor1 : dt.factor, dt.factor2);
+ }
+ if (e.lifeTimeGradients)
+ for (var Ge = 0, $e = e.lifeTimeGradients; Ge < $e.length; Ge++) {
+ var yt = $e[Ge];
+ n.addLifeTimeGradient(yt.gradient, yt.factor1 !== void 0 ? yt.factor1 : yt.factor, yt.factor2);
+ }
+ if (e.limitVelocityGradients) {
+ for (var Jt = 0, Bt = e.limitVelocityGradients; Jt < Bt.length; Jt++) {
+ var rn = Bt[Jt];
+ n.addLimitVelocityGradient(rn.gradient, rn.factor1 !== void 0 ? rn.factor1 : rn.factor, rn.factor2);
+ }
+ n.limitVelocityDamping = e.limitVelocityDamping;
+ }
+ if (e.noiseTexture && a) {
+ var vt = x.a.GetClass("BABYLON.ProceduralTexture");
+ n.noiseTexture = vt.Parse(e.noiseTexture, a, o);
+ }
+ if (e.particleEmitterType) {
+ switch (e.particleEmitterType.type) {
+ case "SphereParticleEmitter":
+ s = new Qs();
+ break;
+ case "SphereDirectedParticleEmitter":
+ s = new uu();
+ break;
+ case "ConeEmitter":
+ case "ConeParticleEmitter":
+ s = new au();
+ break;
+ case "CylinderParticleEmitter":
+ s = new Ks();
+ break;
+ case "CylinderDirectedParticleEmitter":
+ s = new su();
+ break;
+ case "HemisphericParticleEmitter":
+ s = new cu();
+ break;
+ case "PointParticleEmitter":
+ s = new lu();
+ break;
+ case "MeshParticleEmitter":
+ s = new dp();
+ break;
+ case "BoxEmitter":
+ case "BoxParticleEmitter":
+ default:
+ s = new Fo();
+ }
+ s.parse(e.particleEmitterType, a);
+ } else
+ (s = new Fo()).parse(e, a);
+ n.particleEmitterType = s, n.startSpriteCellID = e.startSpriteCellID, n.endSpriteCellID = e.endSpriteCellID, n.spriteCellWidth = e.spriteCellWidth, n.spriteCellHeight = e.spriteCellHeight, n.spriteCellChangeSpeed = e.spriteCellChangeSpeed, n.spriteRandomStartCell = e.spriteRandomStartCell;
+ }, t.Parse = function(e, n, i, o) {
+ o === void 0 && (o = !1);
+ var a, s = e.name, p = null, m = null;
+ if (a = n instanceof Gt.a ? n : n.getEngine(), e.customShader && a.createEffectForParticles) {
+ var S = (m = e.customShader).shaderOptions.defines.length > 0 ? m.shaderOptions.defines.join(`
+`) : "";
+ p = a.createEffectForParticles(m.shaderPath.fragmentElement, m.shaderOptions.uniforms, m.shaderOptions.samplers, S);
+ }
+ var O = new t(s, e.capacity, n, p, e.isAnimationSheetEnabled);
+ if (O.customShader = m, e.id && (O.id = e.id), e.subEmitters) {
+ O.subEmitters = [];
+ for (var I = 0, G = e.subEmitters; I < G.length; I++) {
+ for (var k = [], K = 0, re = G[I]; K < re.length; K++) {
+ var se = re[K];
+ k.push(za.Parse(se, n, i));
+ }
+ O.subEmitters.push(k);
+ }
+ }
+ return t._Parse(e, O, n, i), e.textureMask && (O.textureMask = C.b.FromArray(e.textureMask)), e.preventAutoStart && (O.preventAutoStart = e.preventAutoStart), o || O.preventAutoStart || O.start(), O;
+ }, t.BILLBOARDMODE_Y = d.a.PARTICLES_BILLBOARDMODE_Y, t.BILLBOARDMODE_ALL = d.a.PARTICLES_BILLBOARDMODE_ALL, t.BILLBOARDMODE_STRETCHED = d.a.PARTICLES_BILLBOARDMODE_STRETCHED, t;
+ }(Na);
+ za._ParseParticleSystem = En.Parse, We.a.ShadersStore.gpuUpdateParticlesPixelShader = `#version 300 es
+void main() {
+discard;
+}
+`;
+ var J0 = `#version 300 es
+#define PI 3.14159
+uniform float currentCount;
+uniform float timeDelta;
+uniform float stopFactor;
+#ifndef LOCAL
+uniform mat4 emitterWM;
+#endif
+uniform vec2 lifeTime;
+uniform vec2 emitPower;
+uniform vec2 sizeRange;
+uniform vec4 scaleRange;
+#ifndef COLORGRADIENTS
+uniform vec4 color1;
+uniform vec4 color2;
+#endif
+uniform vec3 gravity;
+uniform sampler2D randomSampler;
+uniform sampler2D randomSampler2;
+uniform vec4 angleRange;
+#ifdef BOXEMITTER
+uniform vec3 direction1;
+uniform vec3 direction2;
+uniform vec3 minEmitBox;
+uniform vec3 maxEmitBox;
+#endif
+#ifdef POINTEMITTER
+uniform vec3 direction1;
+uniform vec3 direction2;
+#endif
+#ifdef HEMISPHERICEMITTER
+uniform float radius;
+uniform float radiusRange;
+uniform float directionRandomizer;
+#endif
+#ifdef SPHEREEMITTER
+uniform float radius;
+uniform float radiusRange;
+#ifdef DIRECTEDSPHEREEMITTER
+uniform vec3 direction1;
+uniform vec3 direction2;
+#else
+uniform float directionRandomizer;
+#endif
+#endif
+#ifdef CYLINDEREMITTER
+uniform float radius;
+uniform float height;
+uniform float radiusRange;
+#ifdef DIRECTEDCYLINDEREMITTER
+uniform vec3 direction1;
+uniform vec3 direction2;
+#else
+uniform float directionRandomizer;
+#endif
+#endif
+#ifdef CONEEMITTER
+uniform vec2 radius;
+uniform float coneAngle;
+uniform vec2 height;
+uniform float directionRandomizer;
+#endif
+
+in vec3 position;
+#ifdef CUSTOMEMITTER
+in vec3 initialPosition;
+#endif
+in float age;
+in float life;
+in vec4 seed;
+in vec3 size;
+#ifndef COLORGRADIENTS
+in vec4 color;
+#endif
+in vec3 direction;
+#ifndef BILLBOARD
+in vec3 initialDirection;
+#endif
+#ifdef ANGULARSPEEDGRADIENTS
+in float angle;
+#else
+in vec2 angle;
+#endif
+#ifdef ANIMATESHEET
+in float cellIndex;
+#ifdef ANIMATESHEETRANDOMSTART
+in float cellStartOffset;
+#endif
+#endif
+#ifdef NOISE
+in vec3 noiseCoordinates1;
+in vec3 noiseCoordinates2;
+#endif
+
+out vec3 outPosition;
+#ifdef CUSTOMEMITTER
+out vec3 outInitialPosition;
+#endif
+out float outAge;
+out float outLife;
+out vec4 outSeed;
+out vec3 outSize;
+#ifndef COLORGRADIENTS
+out vec4 outColor;
+#endif
+out vec3 outDirection;
+#ifndef BILLBOARD
+out vec3 outInitialDirection;
+#endif
+#ifdef ANGULARSPEEDGRADIENTS
+out float outAngle;
+#else
+out vec2 outAngle;
+#endif
+#ifdef ANIMATESHEET
+out float outCellIndex;
+#ifdef ANIMATESHEETRANDOMSTART
+out float outCellStartOffset;
+#endif
+#endif
+#ifdef NOISE
+out vec3 outNoiseCoordinates1;
+out vec3 outNoiseCoordinates2;
+#endif
+#ifdef SIZEGRADIENTS
+uniform sampler2D sizeGradientSampler;
+#endif
+#ifdef ANGULARSPEEDGRADIENTS
+uniform sampler2D angularSpeedGradientSampler;
+#endif
+#ifdef VELOCITYGRADIENTS
+uniform sampler2D velocityGradientSampler;
+#endif
+#ifdef LIMITVELOCITYGRADIENTS
+uniform sampler2D limitVelocityGradientSampler;
+uniform float limitVelocityDamping;
+#endif
+#ifdef DRAGGRADIENTS
+uniform sampler2D dragGradientSampler;
+#endif
+#ifdef NOISE
+uniform vec3 noiseStrength;
+uniform sampler2D noiseSampler;
+#endif
+#ifdef ANIMATESHEET
+uniform vec3 cellInfos;
+#endif
+vec3 getRandomVec3(float offset) {
+return texture(randomSampler2,vec2(float(gl_VertexID)*offset/currentCount,0)).rgb;
+}
+vec4 getRandomVec4(float offset) {
+return texture(randomSampler,vec2(float(gl_VertexID)*offset/currentCount,0));
+}
+void main() {
+float newAge=age+timeDelta;
+
+if (newAge>=life && stopFactor != 0.) {
+vec3 newPosition;
+vec3 newDirection;
+
+vec4 randoms=getRandomVec4(seed.x);
+
+outLife=lifeTime.x+(lifeTime.y-lifeTime.x)*randoms.r;
+outAge=newAge-life;
+
+outSeed=seed;
+
+#ifdef SIZEGRADIENTS
+outSize.x=texture(sizeGradientSampler,vec2(0,0)).r;
+#else
+outSize.x=sizeRange.x+(sizeRange.y-sizeRange.x)*randoms.g;
+#endif
+outSize.y=scaleRange.x+(scaleRange.y-scaleRange.x)*randoms.b;
+outSize.z=scaleRange.z+(scaleRange.w-scaleRange.z)*randoms.a;
+#ifndef COLORGRADIENTS
+
+outColor=color1+(color2-color1)*randoms.b;
+#endif
+
+#ifndef ANGULARSPEEDGRADIENTS
+outAngle.y=angleRange.x+(angleRange.y-angleRange.x)*randoms.a;
+outAngle.x=angleRange.z+(angleRange.w-angleRange.z)*randoms.r;
+#else
+outAngle=angleRange.z+(angleRange.w-angleRange.z)*randoms.r;
+#endif
+
+#ifdef POINTEMITTER
+vec3 randoms2=getRandomVec3(seed.y);
+vec3 randoms3=getRandomVec3(seed.z);
+newPosition=vec3(0,0,0);
+newDirection=direction1+(direction2-direction1)*randoms3;
+#elif defined(BOXEMITTER)
+vec3 randoms2=getRandomVec3(seed.y);
+vec3 randoms3=getRandomVec3(seed.z);
+newPosition=minEmitBox+(maxEmitBox-minEmitBox)*randoms2;
+newDirection=direction1+(direction2-direction1)*randoms3;
+#elif defined(HEMISPHERICEMITTER)
+vec3 randoms2=getRandomVec3(seed.y);
+vec3 randoms3=getRandomVec3(seed.z);
+
+float phi=2.0*PI*randoms2.x;
+float theta=acos(2.0*randoms2.y-1.0);
+float randX=cos(phi)*sin(theta);
+float randY=cos(theta);
+float randZ=sin(phi)*sin(theta);
+newPosition=(radius-(radius*radiusRange*randoms2.z))*vec3(randX,abs(randY),randZ);
+newDirection=newPosition+directionRandomizer*randoms3;
+#elif defined(SPHEREEMITTER)
+vec3 randoms2=getRandomVec3(seed.y);
+vec3 randoms3=getRandomVec3(seed.z);
+
+float phi=2.0*PI*randoms2.x;
+float theta=acos(2.0*randoms2.y-1.0);
+float randX=cos(phi)*sin(theta);
+float randY=cos(theta);
+float randZ=sin(phi)*sin(theta);
+newPosition=(radius-(radius*radiusRange*randoms2.z))*vec3(randX,randY,randZ);
+#ifdef DIRECTEDSPHEREEMITTER
+newDirection=direction1+(direction2-direction1)*randoms3;
+#else
+
+newDirection=newPosition+directionRandomizer*randoms3;
+#endif
+#elif defined(CYLINDEREMITTER)
+vec3 randoms2=getRandomVec3(seed.y);
+vec3 randoms3=getRandomVec3(seed.z);
+
+float yPos=(randoms2.x-0.5)*height;
+float angle=randoms2.y*PI*2.;
+float inverseRadiusRangeSquared=((1.-radiusRange)*(1.-radiusRange));
+float positionRadius=radius*sqrt(inverseRadiusRangeSquared+(randoms2.z*(1.-inverseRadiusRangeSquared)));
+float xPos=positionRadius*cos(angle);
+float zPos=positionRadius*sin(angle);
+newPosition=vec3(xPos,yPos,zPos);
+#ifdef DIRECTEDCYLINDEREMITTER
+newDirection=direction1+(direction2-direction1)*randoms3;
+#else
+
+angle=angle+((randoms3.x-0.5)*PI);
+newDirection=vec3(cos(angle),randoms3.y-0.5,sin(angle));
+newDirection=normalize(newDirection);
+#endif
+#elif defined(CONEEMITTER)
+vec3 randoms2=getRandomVec3(seed.y);
+float s=2.0*PI*randoms2.x;
+#ifdef CONEEMITTERSPAWNPOINT
+float h=0.0001;
+#else
+float h=randoms2.y*height.y;
+
+h=1.-h*h;
+#endif
+float lRadius=radius.x-radius.x*randoms2.z*radius.y;
+lRadius=lRadius*h;
+float randX=lRadius*sin(s);
+float randZ=lRadius*cos(s);
+float randY=h*height.x;
+newPosition=vec3(randX,randY,randZ);
+
+if (abs(cos(coneAngle)) == 1.0) {
+newDirection=vec3(0.,1.0,0.);
+} else {
+vec3 randoms3=getRandomVec3(seed.z);
+newDirection=normalize(newPosition+directionRandomizer*randoms3);
+}
+#elif defined(CUSTOMEMITTER)
+newPosition=initialPosition;
+outInitialPosition=initialPosition;
+#else
+
+newPosition=vec3(0.,0.,0.);
+
+newDirection=2.0*(getRandomVec3(seed.w)-vec3(0.5,0.5,0.5));
+#endif
+float power=emitPower.x+(emitPower.y-emitPower.x)*randoms.a;
+#ifdef LOCAL
+outPosition=newPosition;
+#else
+outPosition=(emitterWM*vec4(newPosition,1.)).xyz;
+#endif
+#ifdef CUSTOMEMITTER
+outDirection=direction;
+#ifndef BILLBOARD
+outInitialDirection=direction;
+#endif
+#else
+#ifdef LOCAL
+vec3 initial=newDirection;
+#else
+vec3 initial=(emitterWM*vec4(newDirection,0.)).xyz;
+#endif
+outDirection=initial*power;
+#ifndef BILLBOARD
+outInitialDirection=initial;
+#endif
+#endif
+#ifdef ANIMATESHEET
+outCellIndex=cellInfos.x;
+#ifdef ANIMATESHEETRANDOMSTART
+outCellStartOffset=randoms.a*outLife;
+#endif
+#endif
+#ifdef NOISE
+outNoiseCoordinates1=noiseCoordinates1;
+outNoiseCoordinates2=noiseCoordinates2;
+#endif
+} else {
+float directionScale=timeDelta;
+outAge=newAge;
+float ageGradient=newAge/life;
+#ifdef VELOCITYGRADIENTS
+directionScale*=texture(velocityGradientSampler,vec2(ageGradient,0)).r;
+#endif
+#ifdef DRAGGRADIENTS
+directionScale*=1.0-texture(dragGradientSampler,vec2(ageGradient,0)).r;
+#endif
+#if defined(CUSTOMEMITTER)
+outPosition=position+(direction-position)*ageGradient;
+outInitialPosition=initialPosition;
+#else
+outPosition=position+direction*directionScale;
+#endif
+outLife=life;
+outSeed=seed;
+#ifndef COLORGRADIENTS
+outColor=color;
+#endif
+#ifdef SIZEGRADIENTS
+outSize.x=texture(sizeGradientSampler,vec2(ageGradient,0)).r;
+outSize.yz=size.yz;
+#else
+outSize=size;
+#endif
+#ifndef BILLBOARD
+outInitialDirection=initialDirection;
+#endif
+#ifdef CUSTOMEMITTER
+outDirection=direction;
+#else
+vec3 updatedDirection=direction+gravity*timeDelta;
+#ifdef LIMITVELOCITYGRADIENTS
+float limitVelocity=texture(limitVelocityGradientSampler,vec2(ageGradient,0)).r;
+float currentVelocity=length(updatedDirection);
+if (currentVelocity>limitVelocity) {
+updatedDirection=updatedDirection*limitVelocityDamping;
+}
+#endif
+outDirection=updatedDirection;
+#ifdef NOISE
+float fetchedR=texture(noiseSampler,vec2(noiseCoordinates1.x,noiseCoordinates1.y)*vec2(0.5)+vec2(0.5)).r;
+float fetchedG=texture(noiseSampler,vec2(noiseCoordinates1.z,noiseCoordinates2.x)*vec2(0.5)+vec2(0.5)).r;
+float fetchedB=texture(noiseSampler,vec2(noiseCoordinates2.y,noiseCoordinates2.z)*vec2(0.5)+vec2(0.5)).r;
+vec3 force=vec3(2.*fetchedR-1.,2.*fetchedG-1.,2.*fetchedB-1.)*noiseStrength;
+outDirection=outDirection+force*timeDelta;
+outNoiseCoordinates1=noiseCoordinates1;
+outNoiseCoordinates2=noiseCoordinates2;
+#endif
+#endif
+#ifdef ANGULARSPEEDGRADIENTS
+float angularSpeed=texture(angularSpeedGradientSampler,vec2(ageGradient,0)).r;
+outAngle=angle+angularSpeed*timeDelta;
+#else
+outAngle=vec2(angle.x+angle.y*timeDelta,angle.y);
+#endif
+#ifdef ANIMATESHEET
+float offsetAge=outAge;
+float dist=cellInfos.y-cellInfos.x;
+#ifdef ANIMATESHEETRANDOMSTART
+outCellStartOffset=cellStartOffset;
+offsetAge+=cellStartOffset;
+#else
+float cellStartOffset=0.;
+#endif
+float ratio=clamp(mod(cellStartOffset+cellInfos.z*offsetAge,life)/life,0.,1.0);
+outCellIndex=float(int(cellInfos.x+ratio*dist));
+#endif
+}
+}`;
+ We.a.ShadersStore.gpuUpdateParticlesVertexShader = J0;
+ var $0 = `#ifdef CLIPPLANE
+in float fClipDistance;
+#endif
+#ifdef CLIPPLANE2
+in float fClipDistance2;
+#endif
+#ifdef CLIPPLANE3
+in float fClipDistance3;
+#endif
+#ifdef CLIPPLANE4
+in float fClipDistance4;
+#endif
+#ifdef CLIPPLANE5
+in float fClipDistance5;
+#endif
+#ifdef CLIPPLANE6
+in float fClipDistance6;
+#endif`;
+ We.a.IncludesShadersStore.clipPlaneFragmentDeclaration2 = $0;
+ var eE = `#version 300 es
+uniform sampler2D diffuseSampler;
+in vec2 vUV;
+in vec4 vColor;
+out vec4 outFragColor;
+#include
+#include
+#include
+#include
+void main() {
+#include
+vec4 textureColor=texture(diffuseSampler,vUV);
+outFragColor=textureColor*vColor;
+#ifdef BLENDMULTIPLYMODE
+float alpha=vColor.a*textureColor.a;
+outFragColor.rgb=outFragColor.rgb*alpha+vec3(1.0)*(1.0-alpha);
+#endif
+
+
+#ifdef IMAGEPROCESSINGPOSTPROCESS
+outFragColor.rgb=toLinearSpace(outFragColor.rgb);
+#else
+#ifdef IMAGEPROCESSING
+outFragColor.rgb=toLinearSpace(outFragColor.rgb);
+outFragColor=applyImageProcessing(outFragColor);
+#endif
+#endif
+}
+`;
+ We.a.ShadersStore.gpuRenderParticlesPixelShader = eE;
+ var tE = `#ifdef CLIPPLANE
+uniform vec4 vClipPlane;
+out float fClipDistance;
+#endif
+#ifdef CLIPPLANE2
+uniform vec4 vClipPlane2;
+out float fClipDistance2;
+#endif
+#ifdef CLIPPLANE3
+uniform vec4 vClipPlane3;
+out float fClipDistance3;
+#endif
+#ifdef CLIPPLANE4
+uniform vec4 vClipPlane4;
+out float fClipDistance4;
+#endif
+#ifdef CLIPPLANE5
+uniform vec4 vClipPlane5;
+out float fClipDistance5;
+#endif
+#ifdef CLIPPLANE6
+uniform vec4 vClipPlane6;
+out float fClipDistance6;
+#endif`;
+ We.a.IncludesShadersStore.clipPlaneVertexDeclaration2 = tE;
+ var nE = `#version 300 es
+uniform mat4 view;
+uniform mat4 projection;
+uniform vec2 translationPivot;
+uniform vec3 worldOffset;
+#ifdef LOCAL
+uniform mat4 emitterWM;
+#endif
+
+in vec3 position;
+in float age;
+in float life;
+in vec3 size;
+#ifndef BILLBOARD
+in vec3 initialDirection;
+#endif
+#ifdef BILLBOARDSTRETCHED
+in vec3 direction;
+#endif
+in float angle;
+#ifdef ANIMATESHEET
+in float cellIndex;
+#endif
+in vec2 offset;
+in vec2 uv;
+out vec2 vUV;
+out vec4 vColor;
+out vec3 vPositionW;
+#if defined(BILLBOARD) && !defined(BILLBOARDY) && !defined(BILLBOARDSTRETCHED)
+uniform mat4 invView;
+#endif
+#include
+#ifdef COLORGRADIENTS
+uniform sampler2D colorGradientSampler;
+#else
+uniform vec4 colorDead;
+in vec4 color;
+#endif
+#ifdef ANIMATESHEET
+uniform vec3 sheetInfos;
+#endif
+#ifdef BILLBOARD
+uniform vec3 eyePosition;
+#endif
+vec3 rotate(vec3 yaxis,vec3 rotatedCorner) {
+vec3 xaxis=normalize(cross(vec3(0.,1.0,0.),yaxis));
+vec3 zaxis=normalize(cross(yaxis,xaxis));
+vec3 row0=vec3(xaxis.x,xaxis.y,xaxis.z);
+vec3 row1=vec3(yaxis.x,yaxis.y,yaxis.z);
+vec3 row2=vec3(zaxis.x,zaxis.y,zaxis.z);
+mat3 rotMatrix=mat3(row0,row1,row2);
+vec3 alignedCorner=rotMatrix*rotatedCorner;
+#ifdef LOCAL
+return ((emitterWM*vec4(position,1.0)).xyz+worldOffset)+alignedCorner;
+#else
+return (position+worldOffset)+alignedCorner;
+#endif
+}
+#ifdef BILLBOARDSTRETCHED
+vec3 rotateAlign(vec3 toCamera,vec3 rotatedCorner) {
+vec3 normalizedToCamera=normalize(toCamera);
+vec3 normalizedCrossDirToCamera=normalize(cross(normalize(direction),normalizedToCamera));
+vec3 crossProduct=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));
+vec3 row0=vec3(normalizedCrossDirToCamera.x,normalizedCrossDirToCamera.y,normalizedCrossDirToCamera.z);
+vec3 row1=vec3(crossProduct.x,crossProduct.y,crossProduct.z);
+vec3 row2=vec3(normalizedToCamera.x,normalizedToCamera.y,normalizedToCamera.z);
+mat3 rotMatrix=mat3(row0,row1,row2);
+vec3 alignedCorner=rotMatrix*rotatedCorner;
+#ifdef LOCAL
+return ((emitterWM*vec4(position,1.0)).xyz+worldOffset)+alignedCorner;
+#else
+return (position+worldOffset)+alignedCorner;
+#endif
+}
+#endif
+void main() {
+#ifdef ANIMATESHEET
+float rowOffset=floor(cellIndex/sheetInfos.z);
+float columnOffset=cellIndex-rowOffset*sheetInfos.z;
+vec2 uvScale=sheetInfos.xy;
+vec2 uvOffset=vec2(uv.x ,1.0-uv.y);
+vUV=(uvOffset+vec2(columnOffset,rowOffset))*uvScale;
+#else
+vUV=uv;
+#endif
+float ratio=age/life;
+#ifdef COLORGRADIENTS
+vColor=texture(colorGradientSampler,vec2(ratio,0));
+#else
+vColor=color*vec4(1.0-ratio)+colorDead*vec4(ratio);
+#endif
+vec2 cornerPos=(offset-translationPivot)*size.yz*size.x+translationPivot;
+#ifdef BILLBOARD
+vec4 rotatedCorner;
+rotatedCorner.w=0.;
+#ifdef BILLBOARDY
+rotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);
+rotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);
+rotatedCorner.y=0.;
+vec3 yaxis=(position+worldOffset)-eyePosition;
+yaxis.y=0.;
+vPositionW=rotate(normalize(yaxis),rotatedCorner.xyz);
+vec4 viewPosition=(view*vec4(vPositionW,1.0));
+#elif defined(BILLBOARDSTRETCHED)
+rotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);
+rotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);
+rotatedCorner.z=0.;
+vec3 toCamera=(position+worldOffset)-eyePosition;
+vPositionW=rotateAlign(toCamera,rotatedCorner.xyz);
+vec4 viewPosition=(view*vec4(vPositionW,1.0));
+#else
+
+rotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);
+rotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);
+rotatedCorner.z=0.;
+
+#ifdef LOCAL
+vec4 viewPosition=view*vec4(((emitterWM*vec4(position,1.0)).xyz+worldOffset),1.0)+rotatedCorner;
+#else
+vec4 viewPosition=view*vec4((position+worldOffset),1.0)+rotatedCorner;
+#endif
+vPositionW=(invView*viewPosition).xyz;
+#endif
+#else
+
+vec3 rotatedCorner;
+rotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);
+rotatedCorner.y=0.;
+rotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);
+vec3 yaxis=normalize(initialDirection);
+vPositionW=rotate(yaxis,rotatedCorner);
+
+vec4 viewPosition=view*vec4(vPositionW,1.0);
+#endif
+gl_Position=projection*viewPosition;
+
+#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)
+vec4 worldPos=vec4(vPositionW,1.0);
+#endif
+#include
+}`;
+ We.a.ShadersStore.gpuRenderParticlesVertexShader = nE;
+ var Qr = function(r) {
+ function t(e, n, i, o, a) {
+ o === void 0 && (o = !1), a === void 0 && (a = null);
+ var s = r.call(this, e) || this;
+ s.layerMask = 268435455, s._accumulatedCount = 0, s._targetIndex = 0, s._currentRenderId = -1, s._started = !1, s._stopped = !1, s._timeDelta = 0, s._actualFrame = 0, s._rawTextureWidth = 256, s.onDisposeObservable = new P.c(), s.onStoppedObservable = new P.c(), s.forceDepthWrite = !1, s._preWarmDone = !1, s.isLocal = !1, s._onBeforeDrawParticlesObservable = null, i && i.getClassName() !== "Scene" ? (s._engine = i, s.defaultProjectionMatrix = c.a.PerspectiveFovLH(0.8, 1, 0.1, 100)) : (s._scene = i || te.a.LastCreatedScene, s._engine = s._scene.getEngine(), s.uniqueId = s._scene.getUniqueId(), s._scene.particleSystems.push(s)), s._customEffect = { 0: a }, s._attachImageProcessingConfiguration(null), n.randomTextureSize || delete n.randomTextureSize;
+ var p = Object(u.a)({ capacity: 5e4, randomTextureSize: s._engine.getCaps().maxTextureSize }, n), m = n;
+ isFinite(m) && (p.capacity = m), s._capacity = p.capacity, s._activeCount = p.capacity, s._currentActiveCount = 0, s._isAnimationSheetEnabled = o, s._updateEffectOptions = { attributes: ["position", "initialPosition", "age", "life", "seed", "size", "color", "direction", "initialDirection", "angle", "cellIndex", "cellStartOffset", "noiseCoordinates1", "noiseCoordinates2"], uniformsNames: ["currentCount", "timeDelta", "emitterWM", "lifeTime", "color1", "color2", "sizeRange", "scaleRange", "gravity", "emitPower", "direction1", "direction2", "minEmitBox", "maxEmitBox", "radius", "directionRandomizer", "height", "coneAngle", "stopFactor", "angleRange", "radiusRange", "cellInfos", "noiseStrength", "limitVelocityDamping"], uniformBuffersNames: [], samplers: ["randomSampler", "randomSampler2", "sizeGradientSampler", "angularSpeedGradientSampler", "velocityGradientSampler", "limitVelocityGradientSampler", "noiseSampler", "dragGradientSampler"], defines: "", fallbacks: null, onCompiled: null, onError: null, indexParameters: null, maxSimultaneousLights: 0, transformFeedbackVaryings: [] }, s.particleEmitterType = new Fo();
+ for (var S = Math.min(s._engine.getCaps().maxTextureSize, p.randomTextureSize), O = [], I = 0; I < S; ++I)
+ O.push(Math.random()), O.push(Math.random()), O.push(Math.random()), O.push(Math.random());
+ for (s._randomTexture = new Ti(new Float32Array(O), S, 1, d.a.TEXTUREFORMAT_RGBA, i, !1, !1, d.a.TEXTURE_NEAREST_SAMPLINGMODE, d.a.TEXTURETYPE_FLOAT), s._randomTexture.wrapU = d.a.TEXTURE_WRAP_ADDRESSMODE, s._randomTexture.wrapV = d.a.TEXTURE_WRAP_ADDRESSMODE, O = [], I = 0; I < S; ++I)
+ O.push(Math.random()), O.push(Math.random()), O.push(Math.random()), O.push(Math.random());
+ return s._randomTexture2 = new Ti(new Float32Array(O), S, 1, d.a.TEXTUREFORMAT_RGBA, i, !1, !1, d.a.TEXTURE_NEAREST_SAMPLINGMODE, d.a.TEXTURETYPE_FLOAT), s._randomTexture2.wrapU = d.a.TEXTURE_WRAP_ADDRESSMODE, s._randomTexture2.wrapV = d.a.TEXTURE_WRAP_ADDRESSMODE, s._randomTextureSize = S, s;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t, "IsSupported", { get: function() {
+ return !!te.a.LastCreatedEngine && te.a.LastCreatedEngine.webGLVersion > 1;
+ }, enumerable: !1, configurable: !0 }), t.prototype.getCapacity = function() {
+ return this._capacity;
+ }, Object.defineProperty(t.prototype, "activeParticleCount", { get: function() {
+ return this._activeCount;
+ }, set: function(e) {
+ this._activeCount = Math.min(e, this._capacity);
+ }, enumerable: !1, configurable: !0 }), t.prototype.isReady = function() {
+ return this._updateEffect ? !!(this.emitter && this._updateEffect.isReady() && (!this._imageProcessingConfiguration || this._imageProcessingConfiguration.isReady()) && this._getEffect().isReady() && this.particleTexture && this.particleTexture.isReady()) : (this._recreateUpdateEffect(), this._recreateRenderEffect(), !1);
+ }, t.prototype.isStarted = function() {
+ return this._started;
+ }, t.prototype.isStopped = function() {
+ return this._stopped;
+ }, t.prototype.isStopping = function() {
+ return !1;
+ }, t.prototype.getActiveCount = function() {
+ return this._currentActiveCount;
+ }, t.prototype.start = function(e) {
+ var n = this;
+ if (e === void 0 && (e = this.startDelay), !this.targetStopDuration && this._hasTargetStopDurationDependantGradient())
+ throw "Particle system started with a targetStopDuration dependant gradient (eg. startSizeGradients) but no targetStopDuration set";
+ e ? setTimeout(function() {
+ n.start(0);
+ }, e) : (this._started = !0, this._stopped = !1, this._preWarmDone = !1, this.beginAnimationOnStart && this.animations && this.animations.length > 0 && this._scene && this._scene.beginAnimation(this, this.beginAnimationFrom, this.beginAnimationTo, this.beginAnimationLoop));
+ }, t.prototype.stop = function() {
+ this._stopped || (this._stopped = !0);
+ }, t.prototype.reset = function() {
+ this._releaseBuffers(), this._releaseVAOs(), this._currentActiveCount = 0, this._targetIndex = 0;
+ }, t.prototype.getClassName = function() {
+ return "GPUParticleSystem";
+ }, t.prototype.getCustomEffect = function(e) {
+ var n;
+ return e === void 0 && (e = 0), (n = this._customEffect[e]) !== null && n !== void 0 ? n : this._customEffect[0];
+ }, t.prototype.setCustomEffect = function(e, n) {
+ n === void 0 && (n = 0), this._customEffect[n] = e;
+ }, Object.defineProperty(t.prototype, "onBeforeDrawParticlesObservable", { get: function() {
+ return this._onBeforeDrawParticlesObservable || (this._onBeforeDrawParticlesObservable = new P.c()), this._onBeforeDrawParticlesObservable;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "vertexShaderName", { get: function() {
+ return "gpuRenderParticles";
+ }, enumerable: !1, configurable: !0 }), t.prototype._removeGradientAndTexture = function(e, n, i) {
+ return r.prototype._removeGradientAndTexture.call(this, e, n, i), this._releaseBuffers(), this;
+ }, t.prototype.addColorGradient = function(e, n, i) {
+ this._colorGradients || (this._colorGradients = []);
+ var o = new Mu(e, n);
+ return this._colorGradients.push(o), this._refreshColorGradient(!0), this._releaseBuffers(), this;
+ }, t.prototype._refreshColorGradient = function(e) {
+ e === void 0 && (e = !1), this._colorGradients && (e && this._colorGradients.sort(function(n, i) {
+ return n.gradient < i.gradient ? -1 : n.gradient > i.gradient ? 1 : 0;
+ }), this._colorGradientsTexture && (this._colorGradientsTexture.dispose(), this._colorGradientsTexture = null));
+ }, t.prototype.forceRefreshGradients = function() {
+ this._refreshColorGradient(), this._refreshFactorGradient(this._sizeGradients, "_sizeGradientsTexture"), this._refreshFactorGradient(this._angularSpeedGradients, "_angularSpeedGradientsTexture"), this._refreshFactorGradient(this._velocityGradients, "_velocityGradientsTexture"), this._refreshFactorGradient(this._limitVelocityGradients, "_limitVelocityGradientsTexture"), this._refreshFactorGradient(this._dragGradients, "_dragGradientsTexture"), this.reset();
+ }, t.prototype.removeColorGradient = function(e) {
+ return this._removeGradientAndTexture(e, this._colorGradients, this._colorGradientsTexture), this._colorGradientsTexture = null, this;
+ }, t.prototype._addFactorGradient = function(e, n, i) {
+ var o = new Iu(n, i);
+ e.push(o), this._releaseBuffers();
+ }, t.prototype.addSizeGradient = function(e, n) {
+ return this._sizeGradients || (this._sizeGradients = []), this._addFactorGradient(this._sizeGradients, e, n), this._refreshFactorGradient(this._sizeGradients, "_sizeGradientsTexture", !0), this._releaseBuffers(), this;
+ }, t.prototype.removeSizeGradient = function(e) {
+ return this._removeGradientAndTexture(e, this._sizeGradients, this._sizeGradientsTexture), this._sizeGradientsTexture = null, this;
+ }, t.prototype._refreshFactorGradient = function(e, n, i) {
+ i === void 0 && (i = !1), e && (i && e.sort(function(o, a) {
+ return o.gradient < a.gradient ? -1 : o.gradient > a.gradient ? 1 : 0;
+ }), this[n] && (this[n].dispose(), this[n] = null));
+ }, t.prototype.addAngularSpeedGradient = function(e, n) {
+ return this._angularSpeedGradients || (this._angularSpeedGradients = []), this._addFactorGradient(this._angularSpeedGradients, e, n), this._refreshFactorGradient(this._angularSpeedGradients, "_angularSpeedGradientsTexture", !0), this._releaseBuffers(), this;
+ }, t.prototype.removeAngularSpeedGradient = function(e) {
+ return this._removeGradientAndTexture(e, this._angularSpeedGradients, this._angularSpeedGradientsTexture), this._angularSpeedGradientsTexture = null, this;
+ }, t.prototype.addVelocityGradient = function(e, n) {
+ return this._velocityGradients || (this._velocityGradients = []), this._addFactorGradient(this._velocityGradients, e, n), this._refreshFactorGradient(this._velocityGradients, "_velocityGradientsTexture", !0), this._releaseBuffers(), this;
+ }, t.prototype.removeVelocityGradient = function(e) {
+ return this._removeGradientAndTexture(e, this._velocityGradients, this._velocityGradientsTexture), this._velocityGradientsTexture = null, this;
+ }, t.prototype.addLimitVelocityGradient = function(e, n) {
+ return this._limitVelocityGradients || (this._limitVelocityGradients = []), this._addFactorGradient(this._limitVelocityGradients, e, n), this._refreshFactorGradient(this._limitVelocityGradients, "_limitVelocityGradientsTexture", !0), this._releaseBuffers(), this;
+ }, t.prototype.removeLimitVelocityGradient = function(e) {
+ return this._removeGradientAndTexture(e, this._limitVelocityGradients, this._limitVelocityGradientsTexture), this._limitVelocityGradientsTexture = null, this;
+ }, t.prototype.addDragGradient = function(e, n) {
+ return this._dragGradients || (this._dragGradients = []), this._addFactorGradient(this._dragGradients, e, n), this._refreshFactorGradient(this._dragGradients, "_dragGradientsTexture", !0), this._releaseBuffers(), this;
+ }, t.prototype.removeDragGradient = function(e) {
+ return this._removeGradientAndTexture(e, this._dragGradients, this._dragGradientsTexture), this._dragGradientsTexture = null, this;
+ }, t.prototype.addEmitRateGradient = function(e, n, i) {
+ return this;
+ }, t.prototype.removeEmitRateGradient = function(e) {
+ return this;
+ }, t.prototype.addStartSizeGradient = function(e, n, i) {
+ return this;
+ }, t.prototype.removeStartSizeGradient = function(e) {
+ return this;
+ }, t.prototype.addColorRemapGradient = function(e, n, i) {
+ return this;
+ }, t.prototype.removeColorRemapGradient = function() {
+ return this;
+ }, t.prototype.addAlphaRemapGradient = function(e, n, i) {
+ return this;
+ }, t.prototype.removeAlphaRemapGradient = function() {
+ return this;
+ }, t.prototype.addRampGradient = function(e, n) {
+ return this;
+ }, t.prototype.removeRampGradient = function() {
+ return this;
+ }, t.prototype.getRampGradients = function() {
+ return null;
+ }, Object.defineProperty(t.prototype, "useRampGradients", { get: function() {
+ return !1;
+ }, set: function(e) {
+ }, enumerable: !1, configurable: !0 }), t.prototype.addLifeTimeGradient = function(e, n, i) {
+ return this;
+ }, t.prototype.removeLifeTimeGradient = function(e) {
+ return this;
+ }, t.prototype._reset = function() {
+ this._releaseBuffers();
+ }, t.prototype._createUpdateVAO = function(e) {
+ var n = {};
+ n.position = e.createVertexBuffer("position", 0, 3);
+ var i = 3;
+ this.particleEmitterType instanceof Bo && (n.initialPosition = e.createVertexBuffer("initialPosition", i, 3), i += 3), n.age = e.createVertexBuffer("age", i, 1), i += 1, n.life = e.createVertexBuffer("life", i, 1), i += 1, n.seed = e.createVertexBuffer("seed", i, 4), i += 4, n.size = e.createVertexBuffer("size", i, 3), i += 3, this._colorGradientsTexture || (n.color = e.createVertexBuffer("color", i, 4), i += 4), n.direction = e.createVertexBuffer("direction", i, 3), i += 3, this._isBillboardBased || (n.initialDirection = e.createVertexBuffer("initialDirection", i, 3), i += 3), this._angularSpeedGradientsTexture ? (n.angle = e.createVertexBuffer("angle", i, 1), i += 1) : (n.angle = e.createVertexBuffer("angle", i, 2), i += 2), this._isAnimationSheetEnabled && (n.cellIndex = e.createVertexBuffer("cellIndex", i, 1), i += 1, this.spriteRandomStartCell && (n.cellStartOffset = e.createVertexBuffer("cellStartOffset", i, 1), i += 1)), this.noiseTexture && (n.noiseCoordinates1 = e.createVertexBuffer("noiseCoordinates1", i, 3), i += 3, n.noiseCoordinates2 = e.createVertexBuffer("noiseCoordinates2", i, 3), i += 3);
+ var o = this._engine.recordVertexArrayObject(n, null, this._updateEffect);
+ return this._engine.bindArrayBuffer(null), o;
+ }, t.prototype._createRenderVAO = function(e, n) {
+ var i = {};
+ i.position = e.createVertexBuffer("position", 0, 3, this._attributesStrideSize, !0);
+ var o = 3;
+ this.particleEmitterType instanceof Bo && (o += 3), i.age = e.createVertexBuffer("age", o, 1, this._attributesStrideSize, !0), o += 1, i.life = e.createVertexBuffer("life", o, 1, this._attributesStrideSize, !0), o += 5, i.size = e.createVertexBuffer("size", o, 3, this._attributesStrideSize, !0), o += 3, this._colorGradientsTexture || (i.color = e.createVertexBuffer("color", o, 4, this._attributesStrideSize, !0), o += 4), this.billboardMode === En.BILLBOARDMODE_STRETCHED && (i.direction = e.createVertexBuffer("direction", o, 3, this._attributesStrideSize, !0)), o += 3, this._isBillboardBased || (i.initialDirection = e.createVertexBuffer("initialDirection", o, 3, this._attributesStrideSize, !0), o += 3), i.angle = e.createVertexBuffer("angle", o, 1, this._attributesStrideSize, !0), this._angularSpeedGradientsTexture ? o++ : o += 2, this._isAnimationSheetEnabled && (i.cellIndex = e.createVertexBuffer("cellIndex", o, 1, this._attributesStrideSize, !0), o += 1, this.spriteRandomStartCell && (i.cellStartOffset = e.createVertexBuffer("cellStartOffset", o, 1, this._attributesStrideSize, !0), o += 1)), this.noiseTexture && (i.noiseCoordinates1 = e.createVertexBuffer("noiseCoordinates1", o, 3, this._attributesStrideSize, !0), o += 3, i.noiseCoordinates2 = e.createVertexBuffer("noiseCoordinates2", o, 3, this._attributesStrideSize, !0), o += 3), i.offset = n.createVertexBuffer("offset", 0, 2), i.uv = n.createVertexBuffer("uv", 2, 2);
+ var a = this._engine.recordVertexArrayObject(i, null, this._getEffect());
+ return this._engine.bindArrayBuffer(null), a;
+ }, t.prototype._initialize = function(e) {
+ if (e === void 0 && (e = !1), !this._buffer0 || e) {
+ var n = this._engine, i = new Array();
+ this._attributesStrideSize = 21, this._targetIndex = 0, this.particleEmitterType instanceof Bo && (this._attributesStrideSize += 3), this.isBillboardBased || (this._attributesStrideSize += 3), this._colorGradientsTexture && (this._attributesStrideSize -= 4), this._angularSpeedGradientsTexture && (this._attributesStrideSize -= 1), this._isAnimationSheetEnabled && (this._attributesStrideSize += 1, this.spriteRandomStartCell && (this._attributesStrideSize += 1)), this.noiseTexture && (this._attributesStrideSize += 6);
+ for (var o = this.particleEmitterType instanceof Bo, a = c.c.Vector3[0], s = 0; s < this._capacity; s++)
+ i.push(0), i.push(0), i.push(0), o && (this.particleEmitterType.particlePositionGenerator(s, null, a), i.push(a.x), i.push(a.y), i.push(a.z)), i.push(0), i.push(0), i.push(Math.random()), i.push(Math.random()), i.push(Math.random()), i.push(Math.random()), i.push(0), i.push(0), i.push(0), this._colorGradientsTexture || (i.push(0), i.push(0), i.push(0), i.push(0)), o ? (this.particleEmitterType.particleDestinationGenerator(s, null, a), i.push(a.x), i.push(a.y), i.push(a.z)) : (i.push(0), i.push(0), i.push(0)), this.isBillboardBased || (i.push(0), i.push(0), i.push(0)), i.push(0), this._angularSpeedGradientsTexture || i.push(0), this._isAnimationSheetEnabled && (i.push(0), this.spriteRandomStartCell && i.push(0)), this.noiseTexture && (i.push(Math.random()), i.push(Math.random()), i.push(Math.random()), i.push(Math.random()), i.push(Math.random()), i.push(Math.random()));
+ var p = new Float32Array([0.5, 0.5, 1, 1, -0.5, 0.5, 0, 1, -0.5, -0.5, 0, 0, 0.5, -0.5, 1, 0]);
+ this._buffer0 = new De.a(n, i, !1, this._attributesStrideSize), this._buffer1 = new De.a(n, i, !1, this._attributesStrideSize), this._spriteBuffer = new De.a(n, p, !1, 4), this._updateVAO = [], this._updateVAO.push(this._createUpdateVAO(this._buffer0)), this._updateVAO.push(this._createUpdateVAO(this._buffer1)), this._renderVAO = [], this._renderVAO.push(this._createRenderVAO(this._buffer1, this._spriteBuffer)), this._renderVAO.push(this._createRenderVAO(this._buffer0, this._spriteBuffer)), this._sourceBuffer = this._buffer0, this._targetBuffer = this._buffer1;
+ }
+ }, t.prototype._recreateUpdateEffect = function() {
+ var e = this.particleEmitterType ? this.particleEmitterType.getEffectDefines() : "";
+ this._isBillboardBased && (e += `
+#define BILLBOARD`), this._colorGradientsTexture && (e += `
+#define COLORGRADIENTS`), this._sizeGradientsTexture && (e += `
+#define SIZEGRADIENTS`), this._angularSpeedGradientsTexture && (e += `
+#define ANGULARSPEEDGRADIENTS`), this._velocityGradientsTexture && (e += `
+#define VELOCITYGRADIENTS`), this._limitVelocityGradientsTexture && (e += `
+#define LIMITVELOCITYGRADIENTS`), this._dragGradientsTexture && (e += `
+#define DRAGGRADIENTS`), this.isAnimationSheetEnabled && (e += `
+#define ANIMATESHEET`, this.spriteRandomStartCell && (e += `
+#define ANIMATESHEETRANDOMSTART`)), this.noiseTexture && (e += `
+#define NOISE`), this.isLocal && (e += `
+#define LOCAL`), this._updateEffect && this._updateEffectOptions.defines === e || (this._updateEffectOptions.transformFeedbackVaryings = ["outPosition"], this.particleEmitterType instanceof Bo && this._updateEffectOptions.transformFeedbackVaryings.push("outInitialPosition"), this._updateEffectOptions.transformFeedbackVaryings.push("outAge"), this._updateEffectOptions.transformFeedbackVaryings.push("outLife"), this._updateEffectOptions.transformFeedbackVaryings.push("outSeed"), this._updateEffectOptions.transformFeedbackVaryings.push("outSize"), this._colorGradientsTexture || this._updateEffectOptions.transformFeedbackVaryings.push("outColor"), this._updateEffectOptions.transformFeedbackVaryings.push("outDirection"), this._isBillboardBased || this._updateEffectOptions.transformFeedbackVaryings.push("outInitialDirection"), this._updateEffectOptions.transformFeedbackVaryings.push("outAngle"), this.isAnimationSheetEnabled && (this._updateEffectOptions.transformFeedbackVaryings.push("outCellIndex"), this.spriteRandomStartCell && this._updateEffectOptions.transformFeedbackVaryings.push("outCellStartOffset")), this.noiseTexture && (this._updateEffectOptions.transformFeedbackVaryings.push("outNoiseCoordinates1"), this._updateEffectOptions.transformFeedbackVaryings.push("outNoiseCoordinates2")), this._updateEffectOptions.defines = e, this._updateEffect = new We.a("gpuUpdateParticles", this._updateEffectOptions, this._engine));
+ }, t.prototype._getEffect = function() {
+ var e;
+ return (e = this.getCustomEffect()) !== null && e !== void 0 ? e : this._renderEffect;
+ }, t.prototype.fillDefines = function(e, n) {
+ if (this._scene && (this._scene.clipPlane && e.push("#define CLIPPLANE"), this._scene.clipPlane2 && e.push("#define CLIPPLANE2"), this._scene.clipPlane3 && e.push("#define CLIPPLANE3"), this._scene.clipPlane4 && e.push("#define CLIPPLANE4"), this._scene.clipPlane5 && e.push("#define CLIPPLANE5"), this._scene.clipPlane6 && e.push("#define CLIPPLANE6")), this.blendMode === En.BLENDMODE_MULTIPLY && e.push("#define BLENDMULTIPLYMODE"), this.isLocal && e.push("#define LOCAL"), this._isBillboardBased)
+ switch (e.push("#define BILLBOARD"), this.billboardMode) {
+ case En.BILLBOARDMODE_Y:
+ e.push("#define BILLBOARDY");
+ break;
+ case En.BILLBOARDMODE_STRETCHED:
+ e.push("#define BILLBOARDSTRETCHED");
+ break;
+ case En.BILLBOARDMODE_ALL:
+ e.push("#define BILLBOARDMODE_ALL");
+ }
+ this._colorGradientsTexture && e.push("#define COLORGRADIENTS"), this.isAnimationSheetEnabled && e.push("#define ANIMATESHEET"), this._imageProcessingConfiguration && (this._imageProcessingConfiguration.prepareDefines(this._imageProcessingConfigurationDefines), e.push("" + this._imageProcessingConfigurationDefines.toString()));
+ }, t.prototype.fillUniformsAttributesAndSamplerNames = function(e, n, i) {
+ n.push("position", "age", "life", "size", "color", "offset", "uv", "direction", "initialDirection", "angle", "cellIndex"), e.push("emitterWM", "worldOffset", "view", "projection", "colorDead", "invView", "vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6", "sheetInfos", "translationPivot", "eyePosition"), i.push("diffuseSampler", "colorGradientSampler"), this._imageProcessingConfiguration && (In.a.PrepareUniforms(e, this._imageProcessingConfigurationDefines), In.a.PrepareSamplers(i, this._imageProcessingConfigurationDefines));
+ }, t.prototype._recreateRenderEffect = function() {
+ var e = this.getCustomEffect();
+ if (e)
+ return e;
+ var n = [];
+ this.fillDefines(n);
+ var i = n.join(`
+`);
+ if (this._renderEffect && this._renderEffect.defines === i)
+ return this._renderEffect;
+ var o = [], a = [], s = [];
+ return this.fillUniformsAttributesAndSamplerNames(a, o, s), this._renderEffect = new We.a("gpuRenderParticles", o, a, s, this._engine, i), this._renderEffect;
+ }, t.prototype.animate = function(e) {
+ var n;
+ e === void 0 && (e = !1), this._timeDelta = this.updateSpeed * (e ? this.preWarmStepOffset : ((n = this._scene) === null || n === void 0 ? void 0 : n.getAnimationRatio()) || 1), this._actualFrame += this._timeDelta, this._stopped || this.targetStopDuration && this._actualFrame >= this.targetStopDuration && this.stop();
+ }, t.prototype._createFactorGradientTexture = function(e, n) {
+ var i = this[n];
+ if (e && e.length && !i) {
+ for (var o = new Float32Array(this._rawTextureWidth), a = 0; a < this._rawTextureWidth; a++) {
+ var s = a / this._rawTextureWidth;
+ jn.GetCurrentGradient(s, e, function(p, m, S) {
+ o[a] = ee.a.Lerp(p.factor1, m.factor1, S);
+ });
+ }
+ this[n] = Ti.CreateRTexture(o, this._rawTextureWidth, 1, this._scene || this._engine, !1, !1, d.a.TEXTURE_NEAREST_SAMPLINGMODE);
+ }
+ }, t.prototype._createSizeGradientTexture = function() {
+ this._createFactorGradientTexture(this._sizeGradients, "_sizeGradientsTexture");
+ }, t.prototype._createAngularSpeedGradientTexture = function() {
+ this._createFactorGradientTexture(this._angularSpeedGradients, "_angularSpeedGradientsTexture");
+ }, t.prototype._createVelocityGradientTexture = function() {
+ this._createFactorGradientTexture(this._velocityGradients, "_velocityGradientsTexture");
+ }, t.prototype._createLimitVelocityGradientTexture = function() {
+ this._createFactorGradientTexture(this._limitVelocityGradients, "_limitVelocityGradientsTexture");
+ }, t.prototype._createDragGradientTexture = function() {
+ this._createFactorGradientTexture(this._dragGradients, "_dragGradientsTexture");
+ }, t.prototype._createColorGradientTexture = function() {
+ if (this._colorGradients && this._colorGradients.length && !this._colorGradientsTexture) {
+ for (var e = new Uint8Array(4 * this._rawTextureWidth), n = C.c.Color4[0], i = 0; i < this._rawTextureWidth; i++) {
+ var o = i / this._rawTextureWidth;
+ jn.GetCurrentGradient(o, this._colorGradients, function(a, s, p) {
+ C.b.LerpToRef(a.color1, s.color1, p, n), e[4 * i] = 255 * n.r, e[4 * i + 1] = 255 * n.g, e[4 * i + 2] = 255 * n.b, e[4 * i + 3] = 255 * n.a;
+ });
+ }
+ this._colorGradientsTexture = Ti.CreateRGBATexture(e, this._rawTextureWidth, 1, this._scene, !1, !1, d.a.TEXTURE_NEAREST_SAMPLINGMODE);
+ }
+ }, t.prototype.render = function(e) {
+ var n, i;
+ if (e === void 0 && (e = !1), !this._started || (this._createColorGradientTexture(), this._createSizeGradientTexture(), this._createAngularSpeedGradientTexture(), this._createVelocityGradientTexture(), this._createLimitVelocityGradientTexture(), this._createDragGradientTexture(), this._recreateUpdateEffect(), this._recreateRenderEffect(), !this.isReady()))
+ return 0;
+ if (!e && this._scene) {
+ if (!this._preWarmDone && this.preWarmCycles) {
+ for (var o = 0; o < this.preWarmCycles; o++)
+ this.animate(!0), this.render(!0);
+ this._preWarmDone = !0;
+ }
+ if (this._currentRenderId === this._scene.getFrameId())
+ return 0;
+ this._currentRenderId = this._scene.getFrameId();
+ }
+ if (this._initialize(), this._accumulatedCount += this.emitRate * this._timeDelta, this._accumulatedCount > 1) {
+ var a = 0 | this._accumulatedCount;
+ this._accumulatedCount -= a, this._currentActiveCount = Math.min(this._activeCount, this._currentActiveCount + a);
+ }
+ if (!this._currentActiveCount)
+ return 0;
+ this._engine.enableEffect(this._updateEffect);
+ var s, p = this._engine;
+ if (!p.setState)
+ throw new Error("GPU particles cannot work with a full Engine. ThinEngine is not supported");
+ if (this._updateEffect.setFloat("currentCount", this._currentActiveCount), this._updateEffect.setFloat("timeDelta", this._timeDelta), this._updateEffect.setFloat("stopFactor", this._stopped ? 0 : 1), this._updateEffect.setTexture("randomSampler", this._randomTexture), this._updateEffect.setTexture("randomSampler2", this._randomTexture2), this._updateEffect.setFloat2("lifeTime", this.minLifeTime, this.maxLifeTime), this._updateEffect.setFloat2("emitPower", this.minEmitPower, this.maxEmitPower), this._colorGradientsTexture || (this._updateEffect.setDirectColor4("color1", this.color1), this._updateEffect.setDirectColor4("color2", this.color2)), this._updateEffect.setFloat2("sizeRange", this.minSize, this.maxSize), this._updateEffect.setFloat4("scaleRange", this.minScaleX, this.maxScaleX, this.minScaleY, this.maxScaleY), this._updateEffect.setFloat4("angleRange", this.minAngularSpeed, this.maxAngularSpeed, this.minInitialRotation, this.maxInitialRotation), this._updateEffect.setVector3("gravity", this.gravity), this._sizeGradientsTexture && this._updateEffect.setTexture("sizeGradientSampler", this._sizeGradientsTexture), this._angularSpeedGradientsTexture && this._updateEffect.setTexture("angularSpeedGradientSampler", this._angularSpeedGradientsTexture), this._velocityGradientsTexture && this._updateEffect.setTexture("velocityGradientSampler", this._velocityGradientsTexture), this._limitVelocityGradientsTexture && (this._updateEffect.setTexture("limitVelocityGradientSampler", this._limitVelocityGradientsTexture), this._updateEffect.setFloat("limitVelocityDamping", this.limitVelocityDamping)), this._dragGradientsTexture && this._updateEffect.setTexture("dragGradientSampler", this._dragGradientsTexture), this.particleEmitterType && this.particleEmitterType.applyToShader(this._updateEffect), this._isAnimationSheetEnabled && this._updateEffect.setFloat3("cellInfos", this.startSpriteCellID, this.endSpriteCellID, this.spriteCellChangeSpeed), this.noiseTexture && (this._updateEffect.setTexture("noiseSampler", this.noiseTexture), this._updateEffect.setVector3("noiseStrength", this.noiseStrength)), this.emitter.position)
+ s = this.emitter.getWorldMatrix();
+ else {
+ var m = this.emitter;
+ s = c.a.Translation(m.x, m.y, m.z);
+ }
+ if (this.isLocal || this._updateEffect.setMatrix("emitterWM", s), this._engine.bindVertexArrayObject(this._updateVAO[this._targetIndex], null), p.bindTransformFeedbackBuffer(this._targetBuffer.getBuffer()), p.setRasterizerState(!1), p.beginTransformFeedback(!0), p.drawArraysType(d.a.MATERIAL_PointListDrawMode, 0, this._currentActiveCount), p.endTransformFeedback(), p.setRasterizerState(!0), p.bindTransformFeedbackBuffer(null), !e) {
+ var S = this._getEffect();
+ this._engine.enableEffect(S);
+ var O = ((n = this._scene) === null || n === void 0 ? void 0 : n.getViewMatrix()) || c.a.IdentityReadOnly;
+ if (S.setMatrix("view", O), S.setMatrix("projection", (i = this.defaultProjectionMatrix) !== null && i !== void 0 ? i : this._scene.getProjectionMatrix()), S.setTexture("diffuseSampler", this.particleTexture), S.setVector2("translationPivot", this.translationPivot), S.setVector3("worldOffset", this.worldOffset), this.isLocal && S.setMatrix("emitterWM", s), this._colorGradientsTexture ? S.setTexture("colorGradientSampler", this._colorGradientsTexture) : S.setDirectColor4("colorDead", this.colorDead), this._isAnimationSheetEnabled && this.particleTexture) {
+ var I = this.particleTexture.getBaseSize();
+ S.setFloat3("sheetInfos", this.spriteCellWidth / I.width, this.spriteCellHeight / I.height, I.width / this.spriteCellWidth);
+ }
+ if (this._isBillboardBased && this._scene) {
+ var G = this._scene.activeCamera;
+ S.setVector3("eyePosition", G.globalPosition);
+ }
+ var k = S.defines;
+ if (this._scene && (this._scene.clipPlane || this._scene.clipPlane2 || this._scene.clipPlane3 || this._scene.clipPlane4 || this._scene.clipPlane5 || this._scene.clipPlane6) && tt.a.BindClipPlane(S, this._scene), k.indexOf("#define BILLBOARDMODE_ALL") >= 0) {
+ var K = O.clone();
+ K.invert(), S.setMatrix("invView", K);
+ }
+ switch (this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess && this._imageProcessingConfiguration.bind(S), this.blendMode) {
+ case En.BLENDMODE_ADD:
+ this._engine.setAlphaMode(d.a.ALPHA_ADD);
+ break;
+ case En.BLENDMODE_ONEONE:
+ this._engine.setAlphaMode(d.a.ALPHA_ONEONE);
+ break;
+ case En.BLENDMODE_STANDARD:
+ this._engine.setAlphaMode(d.a.ALPHA_COMBINE);
+ break;
+ case En.BLENDMODE_MULTIPLY:
+ this._engine.setAlphaMode(d.a.ALPHA_MULTIPLY);
+ }
+ this.forceDepthWrite && p.setDepthWrite(!0), this._engine.bindVertexArrayObject(this._renderVAO[this._targetIndex], null), this._onBeforeDrawParticlesObservable && this._onBeforeDrawParticlesObservable.notifyObservers(S), this._engine.drawArraysType(d.a.MATERIAL_TriangleFanDrawMode, 0, 4, this._currentActiveCount), this._engine.setAlphaMode(d.a.ALPHA_DISABLE);
+ }
+ this._targetIndex++, this._targetIndex === 2 && (this._targetIndex = 0);
+ var re = this._sourceBuffer;
+ return this._sourceBuffer = this._targetBuffer, this._targetBuffer = re, this._currentActiveCount;
+ }, t.prototype.rebuild = function() {
+ this._initialize(!0);
+ }, t.prototype._releaseBuffers = function() {
+ this._buffer0 && (this._buffer0.dispose(), this._buffer0 = null), this._buffer1 && (this._buffer1.dispose(), this._buffer1 = null), this._spriteBuffer && (this._spriteBuffer.dispose(), this._spriteBuffer = null);
+ }, t.prototype._releaseVAOs = function() {
+ if (this._updateVAO) {
+ for (var e = 0; e < this._updateVAO.length; e++)
+ this._engine.releaseVertexArrayObject(this._updateVAO[e]);
+ for (this._updateVAO = [], e = 0; e < this._renderVAO.length; e++)
+ this._engine.releaseVertexArrayObject(this._renderVAO[e]);
+ this._renderVAO = [];
+ }
+ }, t.prototype.dispose = function(e) {
+ if (e === void 0 && (e = !0), this._scene) {
+ var n = this._scene.particleSystems.indexOf(this);
+ n > -1 && this._scene.particleSystems.splice(n, 1);
+ }
+ this._releaseBuffers(), this._releaseVAOs(), this._colorGradientsTexture && (this._colorGradientsTexture.dispose(), this._colorGradientsTexture = null), this._sizeGradientsTexture && (this._sizeGradientsTexture.dispose(), this._sizeGradientsTexture = null), this._angularSpeedGradientsTexture && (this._angularSpeedGradientsTexture.dispose(), this._angularSpeedGradientsTexture = null), this._velocityGradientsTexture && (this._velocityGradientsTexture.dispose(), this._velocityGradientsTexture = null), this._limitVelocityGradientsTexture && (this._limitVelocityGradientsTexture.dispose(), this._limitVelocityGradientsTexture = null), this._dragGradientsTexture && (this._dragGradientsTexture.dispose(), this._dragGradientsTexture = null), this._randomTexture && (this._randomTexture.dispose(), this._randomTexture = null), this._randomTexture2 && (this._randomTexture2.dispose(), this._randomTexture2 = null), e && this.particleTexture && (this.particleTexture.dispose(), this.particleTexture = null), e && this.noiseTexture && (this.noiseTexture.dispose(), this.noiseTexture = null), this.onStoppedObservable.clear(), this.onDisposeObservable.notifyObservers(this), this.onDisposeObservable.clear();
+ }, t.prototype.clone = function(e, n) {
+ var i = this.serialize(), o = t.Parse(i, this._scene || this._engine, ""), a = Object(u.a)({}, this._customEffect);
+ return o.name = e, o._customEffect = a, n === void 0 && (n = this.emitter), o.emitter = n, o.noiseTexture = this.noiseTexture, o;
+ }, t.prototype.serialize = function(e) {
+ e === void 0 && (e = !1);
+ var n = {};
+ return En._Serialize(n, this, e), n.activeParticleCount = this.activeParticleCount, n.randomTextureSize = this._randomTextureSize, n;
+ }, t.Parse = function(e, n, i, o) {
+ o === void 0 && (o = !1);
+ var a = new t(e.name, { capacity: e.capacity, randomTextureSize: e.randomTextureSize }, n);
+ return e.activeParticleCount && (a.activeParticleCount = e.activeParticleCount), En._Parse(e, a, n, i), e.preventAutoStart && (a.preventAutoStart = e.preventAutoStart), o || a.preventAutoStart || a.start(), a;
+ }, t;
+ }(Na), tc = function() {
+ function r() {
+ this.systems = new Array();
+ }
+ return Object.defineProperty(r.prototype, "emitterNode", { get: function() {
+ return this._emitterNode;
+ }, enumerable: !1, configurable: !0 }), r.prototype.setEmitterAsSphere = function(t, e, n) {
+ this._emitterNode && this._emitterNode.dispose(), this._emitterCreationOptions = { kind: "Sphere", options: t, renderingGroupId: e };
+ var i = Qn.a.CreateSphere("emitterSphere", { diameter: t.diameter, segments: t.segments }, n);
+ i.renderingGroupId = e;
+ var o = new kt.a("emitterSphereMaterial", n);
+ o.emissiveColor = t.color, i.material = o;
+ for (var a = 0, s = this.systems; a < s.length; a++)
+ s[a].emitter = i;
+ this._emitterNode = i;
+ }, r.prototype.start = function(t) {
+ for (var e = 0, n = this.systems; e < n.length; e++) {
+ var i = n[e];
+ t && (i.emitter = t), i.start();
+ }
+ }, r.prototype.dispose = function() {
+ for (var t = 0, e = this.systems; t < e.length; t++)
+ e[t].dispose();
+ this.systems = [], this._emitterNode && (this._emitterNode.dispose(), this._emitterNode = null);
+ }, r.prototype.serialize = function(t) {
+ t === void 0 && (t = !1);
+ for (var e = { systems: [] }, n = 0, i = this.systems; n < i.length; n++) {
+ var o = i[n];
+ e.systems.push(o.serialize(t));
+ }
+ return this._emitterNode && (e.emitter = this._emitterCreationOptions), e;
+ }, r.Parse = function(t, e, n) {
+ n === void 0 && (n = !1);
+ var i = new r(), o = this.BaseAssetsUrl + "/textures/";
+ e = e || te.a.LastCreatedScene;
+ for (var a = 0, s = t.systems; a < s.length; a++) {
+ var p = s[a];
+ i.systems.push(n ? Qr.Parse(p, e, o, !0) : En.Parse(p, e, o, !0));
+ }
+ if (t.emitter) {
+ var m = t.emitter.options;
+ switch (t.emitter.kind) {
+ case "Sphere":
+ i.setEmitterAsSphere({ diameter: m.diameter, segments: m.segments, color: C.a.FromArray(m.color) }, t.emitter.renderingGroupId, e);
+ }
+ }
+ return i;
+ }, r.BaseAssetsUrl = "https://assets.babylonjs.com/particles", r;
+ }(), iE = function() {
+ function r() {
+ }
+ return r.CreateDefault = function(t, e, n, i) {
+ var o;
+ return e === void 0 && (e = 500), i === void 0 && (i = !1), (o = i ? new Qr("default system", { capacity: e }, n) : new En("default system", e, n)).emitter = t, o.particleTexture = new Ue.a("https://www.babylonjs.com/assets/Flare.png", o.getScene()), o.createConeEmitter(0.1, Math.PI / 4), o.color1 = new C.b(1, 1, 1, 1), o.color2 = new C.b(1, 1, 1, 1), o.colorDead = new C.b(1, 1, 1, 0), o.minSize = 0.1, o.maxSize = 0.1, o.minEmitPower = 2, o.maxEmitPower = 2, o.updateSpeed = 1 / 60, o.emitRate = 30, o;
+ }, r.CreateAsync = function(t, e, n) {
+ n === void 0 && (n = !1), e || (e = te.a.LastCreatedScene);
+ var i = {};
+ return e._addPendingData(i), new Promise(function(o, a) {
+ if (n && !Qr.IsSupported)
+ return e._removePendingData(i), a("Particle system with GPU is not supported.");
+ Ke.b.LoadFile(r.BaseAssetsUrl + "/systems/" + t + ".json", function(s) {
+ e._removePendingData(i);
+ var p = JSON.parse(s.toString());
+ return o(tc.Parse(p, e, n));
+ }, void 0, void 0, void 0, function() {
+ return e._removePendingData(i), a("An error occured while the creation of your particle system. Check if your type '" + t + "' exists.");
+ });
+ });
+ }, r.ExportSet = function(t) {
+ for (var e = new tc(), n = 0, i = t; n < i.length; n++) {
+ var o = i[n];
+ e.systems.push(o);
+ }
+ return e;
+ }, r.ParseFromFileAsync = function(t, e, n, i, o) {
+ return i === void 0 && (i = !1), o === void 0 && (o = ""), new Promise(function(a, s) {
+ var p = new ce.a();
+ p.addEventListener("readystatechange", function() {
+ if (p.readyState == 4)
+ if (p.status == 200) {
+ var m = JSON.parse(p.responseText), S = void 0;
+ S = i ? Qr.Parse(m, n, o) : En.Parse(m, n, o), t && (S.name = t), a(S);
+ } else
+ s("Unable to load the particle system");
+ }), p.open("GET", e), p.send();
+ });
+ }, r.CreateFromSnippetAsync = function(t, e, n, i) {
+ var o = this;
+ if (n === void 0 && (n = !1), i === void 0 && (i = ""), t === "_BLANK") {
+ var a = this.CreateDefault(null);
+ return a.start(), Promise.resolve(a);
+ }
+ return new Promise(function(s, p) {
+ var m = new ce.a();
+ m.addEventListener("readystatechange", function() {
+ if (m.readyState == 4)
+ if (m.status == 200) {
+ var S = JSON.parse(JSON.parse(m.responseText).jsonPayload), O = JSON.parse(S.particleSystem), I = void 0;
+ (I = n ? Qr.Parse(O, e, i) : En.Parse(O, e, i)).snippetId = t, s(I);
+ } else
+ p("Unable to load the snippet " + t);
+ }), m.open("GET", o.SnippetUrl + "/" + t.replace(/#/g, "/")), m.send();
+ });
+ }, r.BaseAssetsUrl = tc.BaseAssetsUrl, r.SnippetUrl = "https://snippet.babylonjs.com", r;
+ }();
+ D.a.AddParser(st.a.NAME_PARTICLESYSTEM, function(r, t, e, n) {
+ var i = D.a.GetIndividualParser(st.a.NAME_PARTICLESYSTEM);
+ if (i && r.particleSystems !== void 0 && r.particleSystems !== null)
+ for (var o = 0, a = r.particleSystems.length; o < a; o++) {
+ var s = r.particleSystems[o];
+ e.particleSystems.push(i(s, t, n));
+ }
+ }), D.a.AddIndividualParser(st.a.NAME_PARTICLESYSTEM, function(r, t, e) {
+ return r.activeParticleCount ? Qr.Parse(r, t, e) : En.Parse(r, t, e);
+ }), ke.a.prototype.createEffectForParticles = function(r, t, e, n, i, o, a, s) {
+ var p;
+ t === void 0 && (t = []), e === void 0 && (e = []), n === void 0 && (n = "");
+ var m = [], S = [], O = [];
+ return s ? s.fillUniformsAttributesAndSamplerNames(S, m, O) : (m = En._GetAttributeNamesOrOptions(), S = En._GetEffectCreationOptions()), n.indexOf(" BILLBOARD") === -1 && (n += `
+#define BILLBOARD
+`), e.indexOf("diffuseSampler") === -1 && e.push("diffuseSampler"), this.createEffect({ vertex: (p = s == null ? void 0 : s.vertexShaderName) !== null && p !== void 0 ? p : "particles", fragmentElement: r }, m, S.concat(t), O.concat(e), n, i, o, a);
+ }, we.a.prototype.getEmittedParticleSystems = function() {
+ for (var r = new Array(), t = 0; t < this.getScene().particleSystems.length; t++) {
+ var e = this.getScene().particleSystems[t];
+ e.emitter === this && r.push(e);
+ }
+ return r;
+ }, we.a.prototype.getHierarchyEmittedParticleSystems = function() {
+ var r = new Array(), t = this.getDescendants();
+ t.push(this);
+ for (var e = 0; e < this.getScene().particleSystems.length; e++) {
+ var n = this.getScene().particleSystems[e], i = n.emitter;
+ i.position && t.indexOf(i) !== -1 && r.push(n);
+ }
+ return r;
+ };
+ var Ln, Du = function() {
+ function r(t, e, n, i, o, a, s, p, m, S) {
+ m === void 0 && (m = null), S === void 0 && (S = null), this.idx = 0, this.id = 0, this.color = new C.b(1, 1, 1, 1), this.position = c.e.Zero(), this.rotation = c.e.Zero(), this.scaling = c.e.One(), this.uvs = new c.f(0, 0, 1, 1), this.velocity = c.e.Zero(), this.pivot = c.e.Zero(), this.translateFromPivot = !1, this.alive = !0, this.isVisible = !0, this._pos = 0, this._ind = 0, this.shapeId = 0, this.idxInShape = 0, this._stillInvisible = !1, this._rotationMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1], this.parentId = null, this.materialIndex = null, this.props = null, this.cullingStrategy = Nt.a.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY, this._globalPosition = c.e.Zero(), this.idx = t, this.id = e, this._pos = n, this._ind = i, this._model = o, this.shapeId = a, this.idxInShape = s, this._sps = p, m && (this._modelBoundingInfo = m, this._boundingInfo = new vr.a(m.minimum, m.maximum)), S !== null && (this.materialIndex = S);
+ }
+ return r.prototype.copyToRef = function(t) {
+ return t.position.copyFrom(this.position), t.rotation.copyFrom(this.rotation), this.rotationQuaternion && (t.rotationQuaternion ? t.rotationQuaternion.copyFrom(this.rotationQuaternion) : t.rotationQuaternion = this.rotationQuaternion.clone()), t.scaling.copyFrom(this.scaling), this.color && (t.color ? t.color.copyFrom(this.color) : t.color = this.color.clone()), t.uvs.copyFrom(this.uvs), t.velocity.copyFrom(this.velocity), t.pivot.copyFrom(this.pivot), t.translateFromPivot = this.translateFromPivot, t.alive = this.alive, t.isVisible = this.isVisible, t.parentId = this.parentId, t.cullingStrategy = this.cullingStrategy, this.materialIndex !== null && (t.materialIndex = this.materialIndex), this;
+ }, Object.defineProperty(r.prototype, "scale", { get: function() {
+ return this.scaling;
+ }, set: function(t) {
+ this.scaling = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "quaternion", { get: function() {
+ return this.rotationQuaternion;
+ }, set: function(t) {
+ this.rotationQuaternion = t;
+ }, enumerable: !1, configurable: !0 }), r.prototype.intersectsMesh = function(t) {
+ return !(!this._boundingInfo || !t._boundingInfo) && (this._sps._bSphereOnly ? Zd.a.Intersects(this._boundingInfo.boundingSphere, t._boundingInfo.boundingSphere) : this._boundingInfo.intersects(t._boundingInfo, !1));
+ }, r.prototype.isInFrustum = function(t) {
+ return this._boundingInfo !== null && this._boundingInfo.isInFrustum(t, this.cullingStrategy);
+ }, r.prototype.getRotationMatrix = function(t) {
+ var e;
+ if (this.rotationQuaternion)
+ e = this.rotationQuaternion;
+ else {
+ e = c.c.Quaternion[0];
+ var n = this.rotation;
+ c.b.RotationYawPitchRollToRef(n.y, n.x, n.z, e);
+ }
+ e.toRotationMatrix(t);
+ }, r;
+ }(), Lu = function(r, t, e, n, i, o, a, s, p) {
+ this._indicesLength = 0, this.shapeID = r, this._shape = t, this._indices = e, this._indicesLength = e.length, this._shapeUV = o, this._shapeColors = i, this._normals = n, this._positionFunction = a, this._vertexFunction = s, this._material = p;
+ }, C_ = function(r, t, e, n) {
+ this.idx = 0, this.ind = 0, this.indicesLength = 0, this.sqDistance = 0, this.materialIndex = 0, this.idx = r, this.ind = t, this.indicesLength = e, this.materialIndex = n;
+ }, x_ = function() {
+ function r() {
+ this.position = c.e.Zero(), this.color = new C.b(1, 1, 1, 1), this.uv = c.d.Zero();
+ }
+ return Object.defineProperty(r.prototype, "x", { get: function() {
+ return this.position.x;
+ }, set: function(t) {
+ this.position.x = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "y", { get: function() {
+ return this.position.y;
+ }, set: function(t) {
+ this.position.y = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "z", { get: function() {
+ return this.position.z;
+ }, set: function(t) {
+ this.position.z = t;
+ }, enumerable: !1, configurable: !0 }), r;
+ }(), rE = function() {
+ function r(t, e, n) {
+ this.particles = new Array(), this.nbParticles = 0, this.billboard = !1, this.recomputeNormals = !1, this.counter = 0, this.vars = {}, this._bSphereOnly = !1, this._bSphereRadiusFactor = 1, this._positions = new Array(), this._indices = new Array(), this._normals = new Array(), this._colors = new Array(), this._uvs = new Array(), this._index = 0, this._updatable = !0, this._pickable = !1, this._isVisibilityBoxLocked = !1, this._alwaysVisible = !1, this._depthSort = !1, this._expandable = !1, this._shapeCounter = 0, this._copy = new Du(0, 0, 0, 0, null, 0, 0, this), this._color = new C.b(0, 0, 0, 0), this._computeParticleColor = !0, this._computeParticleTexture = !0, this._computeParticleRotation = !0, this._computeParticleVertex = !1, this._computeBoundingBox = !1, this._depthSortParticles = !0, this._mustUnrotateFixedNormals = !1, this._particlesIntersect = !1, this._needs32Bits = !1, this._isNotBuilt = !0, this._lastParticleId = 0, this._idxOfId = [], this._multimaterialEnabled = !1, this._useModelMaterial = !1, this._depthSortFunction = function(i, o) {
+ return o.sqDistance - i.sqDistance;
+ }, this._materialSortFunction = function(i, o) {
+ return i.materialIndex - o.materialIndex;
+ }, this._autoUpdateSubMeshes = !1, this.name = t, this._scene = e || te.a.LastCreatedScene, this._camera = e.activeCamera, this._pickable = !!n && n.isPickable, this._depthSort = !!n && n.enableDepthSort, this._multimaterialEnabled = !!n && n.enableMultiMaterial, this._useModelMaterial = !!n && n.useModelMaterial, this._multimaterialEnabled = !!this._useModelMaterial || this._multimaterialEnabled, this._expandable = !!n && n.expandable, this._particlesIntersect = !!n && n.particleIntersection, this._bSphereOnly = !!n && n.boundingSphereOnly, this._bSphereRadiusFactor = n && n.bSphereRadiusFactor ? n.bSphereRadiusFactor : 1, n && n.updatable !== void 0 ? this._updatable = n.updatable : this._updatable = !0, this._pickable && (this.pickedBySubMesh = [[]], this.pickedParticles = this.pickedBySubMesh[0]), (this._depthSort || this._multimaterialEnabled) && (this.depthSortedParticles = []), this._multimaterialEnabled && (this._multimaterial = new Yr.a(this.name + "MultiMaterial", this._scene), this._materials = [], this._materialIndexesById = {}), this._tmpVertex = new x_();
+ }
+ return r.prototype.buildMesh = function() {
+ if (!this._isNotBuilt && this.mesh)
+ return this.mesh;
+ if (this.nbParticles === 0 && !this.mesh) {
+ var t = ec.CreateDisc("", { radius: 1, tessellation: 3 }, this._scene);
+ this.addShape(t, 1), t.dispose();
+ }
+ if (this._indices32 = this._needs32Bits ? new Uint32Array(this._indices) : new Uint16Array(this._indices), this._positions32 = new Float32Array(this._positions), this._uvs32 = new Float32Array(this._uvs), this._colors32 = new Float32Array(this._colors), !this.mesh) {
+ var e = new we.a(this.name, this._scene);
+ this.mesh = e;
+ }
+ !this._updatable && this._multimaterialEnabled && this._sortParticlesByMaterial(), this.recomputeNormals && ft.a.ComputeNormals(this._positions32, this._indices32, this._normals), this._normals32 = new Float32Array(this._normals), this._fixedNormal32 = new Float32Array(this._normals), this._mustUnrotateFixedNormals && this._unrotateFixedNormals();
+ var n = new ft.a();
+ if (n.indices = this._depthSort ? this._indices : this._indices32, n.set(this._positions32, De.b.PositionKind), n.set(this._normals32, De.b.NormalKind), this._uvs32.length > 0 && n.set(this._uvs32, De.b.UVKind), this._colors32.length > 0 && n.set(this._colors32, De.b.ColorKind), n.applyToMesh(this.mesh, this._updatable), this.mesh.isPickable = this._pickable, this._pickable) {
+ for (var i = 0, o = 0; o < this.nbParticles; o++)
+ for (var a = this.particles[o], s = a._model._indicesLength, p = 0; p < s; p++)
+ if (p % 3 == 0) {
+ var m = { idx: a.idx, faceId: i };
+ this.pickedParticles[i] = m, i++;
+ }
+ }
+ return this._multimaterialEnabled && this.setMultiMaterial(this._materials), this._expandable || (this._depthSort || this._multimaterialEnabled || (this._indices = null), this._positions = null, this._normals = null, this._uvs = null, this._colors = null, this._updatable || (this.particles.length = 0)), this._isNotBuilt = !1, this.recomputeNormals = !1, this.mesh;
+ }, r.prototype.digest = function(t, e) {
+ var n = e && e.facetNb || 1, i = e && e.number || 0, o = e && e.delta || 0, a = t.getVerticesData(De.b.PositionKind), s = t.getIndices(), p = t.getVerticesData(De.b.UVKind), m = t.getVerticesData(De.b.ColorKind), S = t.getVerticesData(De.b.NormalKind), O = e && e.storage ? e.storage : null, I = 0, G = s.length / 3;
+ i ? (i = i > G ? G : i, n = Math.round(G / i), o = 0) : n = n > G ? G : n;
+ for (var k = [], K = [], re = [], se = [], ue = [], he = c.e.Zero(), pe = n; I < G; ) {
+ I > G - (n = pe + Math.floor((1 + o) * Math.random())) && (n = G - I), k.length = 0, K.length = 0, re.length = 0, se.length = 0, ue.length = 0;
+ for (var ve = 0, Ee = 3 * I; Ee < 3 * (I + n); Ee++) {
+ re.push(ve);
+ var Ae = s[Ee], Ie = 3 * Ae;
+ if (k.push(a[Ie], a[Ie + 1], a[Ie + 2]), K.push(S[Ie], S[Ie + 1], S[Ie + 2]), p) {
+ var xe = 2 * Ae;
+ se.push(p[xe], p[xe + 1]);
+ }
+ if (m) {
+ var Pe = 4 * Ae;
+ ue.push(m[Pe], m[Pe + 1], m[Pe + 2], m[Pe + 3]);
+ }
+ ve++;
+ }
+ var Ce, Fe = this.nbParticles, Oe = this._posToShape(k), Be = this._uvsToShapeUV(se), Le = Ke.b.Slice(re), Ve = Ke.b.Slice(ue), Qe = Ke.b.Slice(K);
+ for (he.copyFromFloats(0, 0, 0), Ce = 0; Ce < Oe.length; Ce++)
+ he.addInPlace(Oe[Ce]);
+ he.scaleInPlace(1 / Oe.length);
+ var nt, rt = new c.e(1 / 0, 1 / 0, 1 / 0), ut = new c.e(-1 / 0, -1 / 0, -1 / 0);
+ for (Ce = 0; Ce < Oe.length; Ce++)
+ Oe[Ce].subtractInPlace(he), rt.minimizeInPlaceFromFloats(Oe[Ce].x, Oe[Ce].y, Oe[Ce].z), ut.maximizeInPlaceFromFloats(Oe[Ce].x, Oe[Ce].y, Oe[Ce].z);
+ this._particlesIntersect && (nt = new vr.a(rt, ut));
+ var qe = null;
+ this._useModelMaterial && (qe = t.material ? t.material : this._setDefaultMaterial());
+ var at = new Lu(this._shapeCounter, Oe, Le, Qe, Ve, Be, null, null, qe), ot = this._positions.length, Je = this._indices.length;
+ this._meshBuilder(this._index, Je, Oe, this._positions, Le, this._indices, se, this._uvs, Ve, this._colors, Qe, this._normals, Fe, 0, null, at), this._addParticle(Fe, this._lastParticleId, ot, Je, at, this._shapeCounter, 0, nt, O), this.particles[this.nbParticles].position.addInPlace(he), O || (this._index += Oe.length, Fe++, this.nbParticles++, this._lastParticleId++), this._shapeCounter++, I += n;
+ }
+ return this._isNotBuilt = !0, this;
+ }, r.prototype._unrotateFixedNormals = function() {
+ for (var t = 0, e = 0, n = c.c.Vector3[0], i = c.c.Quaternion[0], o = c.c.Matrix[0], a = 0; a < this.particles.length; a++) {
+ var s = this.particles[a], p = s._model._shape;
+ if (s.rotationQuaternion)
+ s.rotationQuaternion.conjugateToRef(i);
+ else {
+ var m = s.rotation;
+ c.b.RotationYawPitchRollToRef(m.y, m.x, m.z, i), i.conjugateInPlace();
+ }
+ i.toRotationMatrix(o);
+ for (var S = 0; S < p.length; S++)
+ e = t + 3 * S, c.e.TransformNormalFromFloatsToRef(this._normals32[e], this._normals32[e + 1], this._normals32[e + 2], o, n), n.toArray(this._fixedNormal32, e);
+ t = e + 3;
+ }
+ }, r.prototype._resetCopy = function() {
+ var t = this._copy;
+ t.position.setAll(0), t.rotation.setAll(0), t.rotationQuaternion = null, t.scaling.setAll(1), t.uvs.copyFromFloats(0, 0, 1, 1), t.color = null, t.translateFromPivot = !1, t.shapeId = 0, t.materialIndex = null;
+ }, r.prototype._meshBuilder = function(t, e, n, i, o, a, s, p, m, S, O, I, G, k, K, re) {
+ var se, ue = 0, he = 0, pe = 0;
+ this._resetCopy();
+ var ve = this._copy, Ee = !(!K || !K.storage);
+ if (ve.idx = G, ve.idxInShape = k, ve.shapeId = re.shapeID, this._useModelMaterial) {
+ var Ae = re._material.uniqueId, Ie = this._materialIndexesById;
+ Ie.hasOwnProperty(Ae) || (Ie[Ae] = this._materials.length, this._materials.push(re._material));
+ var xe = Ie[Ae];
+ ve.materialIndex = xe;
+ }
+ if (K && K.positionFunction && (K.positionFunction(ve, G, k), this._mustUnrotateFixedNormals = !0), Ee)
+ return ve;
+ var Pe = c.c.Matrix[0], Ce = this._tmpVertex, Fe = Ce.position, Oe = Ce.color, Be = Ce.uv, Le = c.c.Vector3[1], Ve = c.c.Vector3[2], Qe = c.c.Vector3[3];
+ c.a.IdentityToRef(Pe), ve.getRotationMatrix(Pe), ve.pivot.multiplyToRef(ve.scaling, Qe), ve.translateFromPivot ? Ve.setAll(0) : Ve.copyFrom(Qe);
+ var nt = K && K.vertexFunction;
+ for (se = 0; se < n.length; se++) {
+ if (Fe.copyFrom(n[se]), ve.color && Oe.copyFrom(ve.color), s && Be.copyFromFloats(s[ue], s[ue + 1]), nt && K.vertexFunction(ve, Ce, se), Fe.multiplyInPlace(ve.scaling).subtractInPlace(Qe), c.e.TransformCoordinatesToRef(Fe, Pe, Le), Le.addInPlace(Ve).addInPlace(ve.position), i.push(Le.x, Le.y, Le.z), s) {
+ var rt = ve.uvs;
+ p.push((rt.z - rt.x) * Be.x + rt.x, (rt.w - rt.y) * Be.y + rt.y), ue += 2;
+ }
+ if (ve.color)
+ this._color.copyFrom(Oe);
+ else {
+ var ut = this._color;
+ m && m[he] !== void 0 ? (ut.r = m[he], ut.g = m[he + 1], ut.b = m[he + 2], ut.a = m[he + 3]) : (ut.r = 1, ut.g = 1, ut.b = 1, ut.a = 1);
+ }
+ S.push(this._color.r, this._color.g, this._color.b, this._color.a), he += 4, !this.recomputeNormals && O && (c.e.TransformNormalFromFloatsToRef(O[pe], O[pe + 1], O[pe + 2], Pe, Fe), I.push(Fe.x, Fe.y, Fe.z), pe += 3);
+ }
+ for (se = 0; se < o.length; se++) {
+ var qe = t + o[se];
+ a.push(qe), qe > 65535 && (this._needs32Bits = !0);
+ }
+ if (this._depthSort || this._multimaterialEnabled) {
+ var at = ve.materialIndex !== null ? ve.materialIndex : 0;
+ this.depthSortedParticles.push(new C_(G, e, o.length, at));
+ }
+ return ve;
+ }, r.prototype._posToShape = function(t) {
+ for (var e = [], n = 0; n < t.length; n += 3)
+ e.push(c.e.FromArray(t, n));
+ return e;
+ }, r.prototype._uvsToShapeUV = function(t) {
+ var e = [];
+ if (t)
+ for (var n = 0; n < t.length; n++)
+ e.push(t[n]);
+ return e;
+ }, r.prototype._addParticle = function(t, e, n, i, o, a, s, p, m) {
+ p === void 0 && (p = null), m === void 0 && (m = null);
+ var S = new Du(t, e, n, i, o, a, s, this, p);
+ return (m || this.particles).push(S), S;
+ }, r.prototype.addShape = function(t, e, n) {
+ var i = t.getVerticesData(De.b.PositionKind), o = t.getIndices(), a = t.getVerticesData(De.b.UVKind), s = t.getVerticesData(De.b.ColorKind), p = t.getVerticesData(De.b.NormalKind);
+ this.recomputeNormals = !p;
+ var m = Ke.b.SliceToArray(o), S = Ke.b.SliceToArray(p), O = s ? Ke.b.SliceToArray(s) : [], I = n && n.storage ? n.storage : null, G = null;
+ this._particlesIntersect && (G = t.getBoundingInfo());
+ var k = this._posToShape(i), K = this._uvsToShapeUV(a), re = n ? n.positionFunction : null, se = n ? n.vertexFunction : null, ue = null;
+ this._useModelMaterial && (ue = t.material ? t.material : this._setDefaultMaterial());
+ for (var he = new Lu(this._shapeCounter, k, m, S, O, K, re, se, ue), pe = 0; pe < e; pe++)
+ this._insertNewParticle(this.nbParticles, pe, he, k, o, a, s, p, G, I, n);
+ return this._shapeCounter++, this._isNotBuilt = !0, this._shapeCounter - 1;
+ }, r.prototype._rebuildParticle = function(t, e) {
+ e === void 0 && (e = !1), this._resetCopy();
+ var n = this._copy;
+ t._model._positionFunction && t._model._positionFunction(n, t.idx, t.idxInShape);
+ var i = c.c.Matrix[0], o = c.c.Vector3[0], a = c.c.Vector3[1], s = c.c.Vector3[2], p = c.c.Vector3[3];
+ n.getRotationMatrix(i), t.pivot.multiplyToRef(t.scaling, p), n.translateFromPivot ? s.copyFromFloats(0, 0, 0) : s.copyFrom(p);
+ for (var m = t._model._shape, S = 0; S < m.length; S++)
+ o.copyFrom(m[S]), t._model._vertexFunction && t._model._vertexFunction(n, o, S), o.multiplyInPlace(n.scaling).subtractInPlace(p), c.e.TransformCoordinatesToRef(o, i, a), a.addInPlace(s).addInPlace(n.position).toArray(this._positions32, t._pos + 3 * S);
+ e && (t.position.setAll(0), t.rotation.setAll(0), t.rotationQuaternion = null, t.scaling.setAll(1), t.uvs.setAll(0), t.pivot.setAll(0), t.translateFromPivot = !1, t.parentId = null);
+ }, r.prototype.rebuildMesh = function(t) {
+ t === void 0 && (t = !1);
+ for (var e = 0; e < this.particles.length; e++)
+ this._rebuildParticle(this.particles[e], t);
+ return this.mesh.updateVerticesData(De.b.PositionKind, this._positions32, !1, !1), this;
+ }, r.prototype.removeParticles = function(t, e) {
+ var n = e - t + 1;
+ if (!this._expandable || n <= 0 || n >= this.nbParticles || !this._updatable)
+ return [];
+ var i = this.particles, o = this.nbParticles;
+ if (e < o - 1)
+ for (var a = e + 1, s = i[a]._pos - i[t]._pos, p = i[a]._ind - i[t]._ind, m = a; m < o; m++) {
+ var S = i[m];
+ S._pos -= s, S._ind -= p;
+ }
+ var O = i.splice(t, n);
+ this._positions.length = 0, this._indices.length = 0, this._colors.length = 0, this._uvs.length = 0, this._normals.length = 0, this._index = 0, this._idxOfId.length = 0, (this._depthSort || this._multimaterialEnabled) && (this.depthSortedParticles = []);
+ for (var I = 0, G = i.length, k = 0; k < G; k++) {
+ var K = i[k], re = K._model, se = re._shape, ue = re._indices, he = re._normals, pe = re._shapeColors, ve = re._shapeUV;
+ K.idx = k, this._idxOfId[K.id] = k, this._meshBuilder(this._index, I, se, this._positions, ue, this._indices, ve, this._uvs, pe, this._colors, he, this._normals, K.idx, K.idxInShape, null, re), this._index += se.length, I += ue.length;
+ }
+ return this.nbParticles -= n, this._isNotBuilt = !0, O;
+ }, r.prototype.insertParticlesFromArray = function(t) {
+ if (!this._expandable)
+ return this;
+ for (var e = 0, n = t[0].shapeId, i = t.length, o = 0; o < i; o++) {
+ var a = t[o], s = a._model, p = s._shape, m = s._indices, S = s._shapeUV, O = s._shapeColors, I = s._normals, G = !I;
+ this.recomputeNormals = G || this.recomputeNormals;
+ var k = a._boundingInfo, K = this._insertNewParticle(this.nbParticles, e, s, p, m, S, O, I, k, null, null);
+ a.copyToRef(K), e++, n != a.shapeId && (n = a.shapeId, e = 0);
+ }
+ return this._isNotBuilt = !0, this;
+ }, r.prototype._insertNewParticle = function(t, e, n, i, o, a, s, p, m, S, O) {
+ var I = this._positions.length, G = this._indices.length, k = this._meshBuilder(this._index, G, i, this._positions, o, this._indices, a, this._uvs, s, this._colors, p, this._normals, t, e, O, n), K = null;
+ return this._updatable && ((K = this._addParticle(this.nbParticles, this._lastParticleId, I, G, n, this._shapeCounter, e, m, S)).position.copyFrom(k.position), K.rotation.copyFrom(k.rotation), k.rotationQuaternion && (K.rotationQuaternion ? K.rotationQuaternion.copyFrom(k.rotationQuaternion) : K.rotationQuaternion = k.rotationQuaternion.clone()), k.color && (K.color ? K.color.copyFrom(k.color) : K.color = k.color.clone()), K.scaling.copyFrom(k.scaling), K.uvs.copyFrom(k.uvs), k.materialIndex !== null && (K.materialIndex = k.materialIndex), this.expandable && (this._idxOfId[K.id] = K.idx)), S || (this._index += i.length, this.nbParticles++, this._lastParticleId++), K;
+ }, r.prototype.setParticles = function(t, e, n) {
+ if (t === void 0 && (t = 0), e === void 0 && (e = this.nbParticles - 1), n === void 0 && (n = !0), !this._updatable || this._isNotBuilt)
+ return this;
+ this.beforeUpdateParticles(t, e, n);
+ var i = c.c.Matrix[0], o = c.c.Matrix[1], a = this.mesh, s = this._colors32, p = this._positions32, m = this._normals32, S = this._uvs32, O = this._indices32, I = this._indices, G = this._fixedNormal32, k = c.c.Vector3, K = k[5].copyFromFloats(1, 0, 0), re = k[6].copyFromFloats(0, 1, 0), se = k[7].copyFromFloats(0, 0, 1), ue = k[8].setAll(Number.MAX_VALUE), he = k[9].setAll(-Number.MAX_VALUE), pe = k[10].setAll(0), ve = this._tmpVertex, Ee = ve.position, Ae = ve.color, Ie = ve.uv;
+ if ((this.billboard || this._depthSort) && (this.mesh.computeWorldMatrix(!0), this.mesh._worldMatrix.invertToRef(o)), this.billboard) {
+ var xe = k[0];
+ this._camera.getDirectionToRef(Se.a.Z, xe), c.e.TransformNormalToRef(xe, o, se), se.normalize();
+ var Pe = this._camera.getViewMatrix(!0);
+ c.e.TransformNormalFromFloatsToRef(Pe.m[1], Pe.m[5], Pe.m[9], o, re), c.e.CrossToRef(re, se, K), re.normalize(), K.normalize();
+ }
+ this._depthSort && c.e.TransformCoordinatesToRef(this._camera.globalPosition, o, pe), c.a.IdentityToRef(i);
+ var Ce = 0, Fe = 0, Oe = 0, Be = 0, Le = 0, Ve = 0, Qe = 0;
+ if (this.mesh.isFacetDataEnabled && (this._computeBoundingBox = !0), e = e >= this.nbParticles ? this.nbParticles - 1 : e, this._computeBoundingBox && (t != 0 || e != this.nbParticles - 1)) {
+ var nt = this.mesh._boundingInfo;
+ nt && (ue.copyFrom(nt.minimum), he.copyFrom(nt.maximum));
+ }
+ var rt = (Fe = this.particles[t]._pos) / 3 | 0;
+ Be = 4 * rt, Ve = 2 * rt;
+ for (var ut = t; ut <= e; ut++) {
+ var qe = this.particles[ut];
+ this.updateParticle(qe);
+ var at = qe._model._shape, ot = qe._model._shapeUV, Je = qe._rotationMatrix, dt = qe.position, Ge = qe.rotation, $e = qe.scaling, yt = qe._globalPosition;
+ if (this._depthSort && this._depthSortParticles) {
+ var Jt = this.depthSortedParticles[ut];
+ Jt.idx = qe.idx, Jt.ind = qe._ind, Jt.indicesLength = qe._model._indicesLength, Jt.sqDistance = c.e.DistanceSquared(qe.position, pe);
+ }
+ if (!qe.alive || qe._stillInvisible && !qe.isVisible)
+ Fe += 3 * (Qe = at.length), Be += 4 * Qe, Ve += 2 * Qe;
+ else {
+ if (qe.isVisible) {
+ qe._stillInvisible = !1;
+ var Bt = k[12];
+ if (qe.pivot.multiplyToRef($e, Bt), this.billboard && (Ge.x = 0, Ge.y = 0), (this._computeParticleRotation || this.billboard) && qe.getRotationMatrix(i), qe.parentId !== null) {
+ var rn = this.getParticleById(qe.parentId);
+ if (rn) {
+ var vt = rn._rotationMatrix, sn = rn._globalPosition, $t = dt.x * vt[1] + dt.y * vt[4] + dt.z * vt[7], Qt = dt.x * vt[0] + dt.y * vt[3] + dt.z * vt[6], en = dt.x * vt[2] + dt.y * vt[5] + dt.z * vt[8];
+ if (yt.x = sn.x + Qt, yt.y = sn.y + $t, yt.z = sn.z + en, this._computeParticleRotation || this.billboard) {
+ var Tt = i.m;
+ Je[0] = Tt[0] * vt[0] + Tt[1] * vt[3] + Tt[2] * vt[6], Je[1] = Tt[0] * vt[1] + Tt[1] * vt[4] + Tt[2] * vt[7], Je[2] = Tt[0] * vt[2] + Tt[1] * vt[5] + Tt[2] * vt[8], Je[3] = Tt[4] * vt[0] + Tt[5] * vt[3] + Tt[6] * vt[6], Je[4] = Tt[4] * vt[1] + Tt[5] * vt[4] + Tt[6] * vt[7], Je[5] = Tt[4] * vt[2] + Tt[5] * vt[5] + Tt[6] * vt[8], Je[6] = Tt[8] * vt[0] + Tt[9] * vt[3] + Tt[10] * vt[6], Je[7] = Tt[8] * vt[1] + Tt[9] * vt[4] + Tt[10] * vt[7], Je[8] = Tt[8] * vt[2] + Tt[9] * vt[5] + Tt[10] * vt[8];
+ }
+ } else
+ qe.parentId = null;
+ } else
+ yt.x = dt.x, yt.y = dt.y, yt.z = dt.z, (this._computeParticleRotation || this.billboard) && (Tt = i.m, Je[0] = Tt[0], Je[1] = Tt[1], Je[2] = Tt[2], Je[3] = Tt[4], Je[4] = Tt[5], Je[5] = Tt[6], Je[6] = Tt[8], Je[7] = Tt[9], Je[8] = Tt[10]);
+ var It = k[11];
+ for (qe.translateFromPivot ? It.setAll(0) : It.copyFrom(Bt), Qe = 0; Qe < at.length; Qe++) {
+ Ce = Fe + 3 * Qe, Oe = Be + 4 * Qe, Le = Ve + 2 * Qe;
+ var cn = 2 * Qe, Hn = cn + 1;
+ Ee.copyFrom(at[Qe]), this._computeParticleColor && qe.color && Ae.copyFrom(qe.color), this._computeParticleTexture && Ie.copyFromFloats(ot[cn], ot[Hn]), this._computeParticleVertex && this.updateParticleVertex(qe, ve, Qe);
+ var Jn = Ee.x * $e.x - Bt.x, pi = Ee.y * $e.y - Bt.y, Wn = Ee.z * $e.z - Bt.z;
+ Qt = Jn * Je[0] + pi * Je[3] + Wn * Je[6], $t = Jn * Je[1] + pi * Je[4] + Wn * Je[7], en = Jn * Je[2] + pi * Je[5] + Wn * Je[8], Qt += It.x, $t += It.y, en += It.z;
+ var on = p[Ce] = yt.x + K.x * Qt + re.x * $t + se.x * en, Mi = p[Ce + 1] = yt.y + K.y * Qt + re.y * $t + se.y * en, ar = p[Ce + 2] = yt.z + K.z * Qt + re.z * $t + se.z * en;
+ if (this._computeBoundingBox && (ue.minimizeInPlaceFromFloats(on, Mi, ar), he.maximizeInPlaceFromFloats(on, Mi, ar)), !this._computeParticleVertex) {
+ var jo = G[Ce], Ho = G[Ce + 1], Ii = G[Ce + 2], Sr = jo * Je[0] + Ho * Je[3] + Ii * Je[6], Wo = jo * Je[1] + Ho * Je[4] + Ii * Je[7], qt = jo * Je[2] + Ho * Je[5] + Ii * Je[8];
+ m[Ce] = K.x * Sr + re.x * Wo + se.x * qt, m[Ce + 1] = K.y * Sr + re.y * Wo + se.y * qt, m[Ce + 2] = K.z * Sr + re.z * Wo + se.z * qt;
+ }
+ if (this._computeParticleColor && qe.color) {
+ var Ar = this._colors32;
+ Ar[Oe] = Ae.r, Ar[Oe + 1] = Ae.g, Ar[Oe + 2] = Ae.b, Ar[Oe + 3] = Ae.a;
+ }
+ if (this._computeParticleTexture) {
+ var wn = qe.uvs;
+ S[Le] = Ie.x * (wn.z - wn.x) + wn.x, S[Le + 1] = Ie.y * (wn.w - wn.y) + wn.y;
+ }
+ }
+ } else
+ for (qe._stillInvisible = !0, Qe = 0; Qe < at.length; Qe++) {
+ if (Oe = Be + 4 * Qe, Le = Ve + 2 * Qe, p[Ce = Fe + 3 * Qe] = p[Ce + 1] = p[Ce + 2] = 0, m[Ce] = m[Ce + 1] = m[Ce + 2] = 0, this._computeParticleColor && qe.color) {
+ var Jr = qe.color;
+ s[Oe] = Jr.r, s[Oe + 1] = Jr.g, s[Oe + 2] = Jr.b, s[Oe + 3] = Jr.a;
+ }
+ this._computeParticleTexture && (wn = qe.uvs, S[Le] = ot[2 * Qe] * (wn.z - wn.x) + wn.x, S[Le + 1] = ot[2 * Qe + 1] * (wn.w - wn.y) + wn.y);
+ }
+ if (this._particlesIntersect) {
+ var sr = qe._boundingInfo, bc = sr.boundingBox, yc = sr.boundingSphere, Xo = qe._modelBoundingInfo;
+ if (!this._bSphereOnly) {
+ var Pr = Xo.boundingBox.vectors, Cr = k[1], $r = k[2];
+ Cr.setAll(Number.MAX_VALUE), $r.setAll(-Number.MAX_VALUE);
+ for (var xr = 0; xr < 8; xr++) {
+ var Yo = Pr[xr].x * $e.x, Ko = Pr[xr].y * $e.y, Qo = Pr[xr].z * $e.z, Rr = (Qt = Yo * Je[0] + Ko * Je[3] + Qo * Je[6], $t = Yo * Je[1] + Ko * Je[4] + Qo * Je[7], en = Yo * Je[2] + Ko * Je[5] + Qo * Je[8], dt.x + K.x * Qt + re.x * $t + se.x * en), Or = dt.y + K.y * Qt + re.y * $t + se.y * en, qo = dt.z + K.z * Qt + re.z * $t + se.z * en;
+ Cr.minimizeInPlaceFromFloats(Rr, Or, qo), $r.maximizeInPlaceFromFloats(Rr, Or, qo);
+ }
+ bc.reConstruct(Cr, $r, a._worldMatrix);
+ }
+ var cr = Xo.minimum.multiplyToRef($e, k[1]), Xn = Xo.maximum.multiplyToRef($e, k[2]), Xa = Xn.addToRef(cr, k[3]).scaleInPlace(0.5).addInPlace(yt), eo = Xn.subtractToRef(cr, k[4]).scaleInPlace(0.5 * this._bSphereRadiusFactor), Ya = Xa.subtractToRef(eo, k[1]), kT = Xa.addToRef(eo, k[2]);
+ yc.reConstruct(Ya, kT, a._worldMatrix);
+ }
+ Fe = Ce + 3, Be = Oe + 4, Ve = Le + 2;
+ }
+ }
+ if (n) {
+ if (this._computeParticleColor && a.updateVerticesData(De.b.ColorKind, s, !1, !1), this._computeParticleTexture && a.updateVerticesData(De.b.UVKind, S, !1, !1), a.updateVerticesData(De.b.PositionKind, p, !1, !1), !a.areNormalsFrozen || a.isFacetDataEnabled) {
+ if (this._computeParticleVertex || a.isFacetDataEnabled) {
+ var GT = a.isFacetDataEnabled ? a.getFacetDataParameters() : null;
+ ft.a.ComputeNormals(p, O, m, GT);
+ for (var lr = 0; lr < m.length; lr++)
+ G[lr] = m[lr];
+ }
+ a.areNormalsFrozen || a.updateVerticesData(De.b.NormalKind, m, !1, !1);
+ }
+ if (this._depthSort && this._depthSortParticles) {
+ var nh = this.depthSortedParticles;
+ nh.sort(this._depthSortFunction);
+ for (var zT = nh.length, ym = 0, ih = 0, rh = 0; rh < zT; rh++) {
+ var oh = nh[rh], jT = oh.indicesLength, HT = oh.ind;
+ for (lr = 0; lr < jT; lr++)
+ if (O[ym] = I[HT + lr], ym++, this._pickable && lr % 3 == 0) {
+ var Em = this.pickedParticles[ih];
+ Em.idx = oh.idx, Em.faceId = ih, ih++;
+ }
+ }
+ a.updateIndices(O);
+ }
+ }
+ return this._computeBoundingBox && (a._boundingInfo ? a._boundingInfo.reConstruct(ue, he, a._worldMatrix) : a._boundingInfo = new vr.a(ue, he, a._worldMatrix)), this._autoUpdateSubMeshes && this.computeSubMeshes(), this.afterUpdateParticles(t, e, n), this;
+ }, r.prototype.dispose = function() {
+ this.mesh.dispose(), this.vars = null, this._positions = null, this._indices = null, this._normals = null, this._uvs = null, this._colors = null, this._indices32 = null, this._positions32 = null, this._normals32 = null, this._fixedNormal32 = null, this._uvs32 = null, this._colors32 = null, this.pickedParticles = null, this.pickedBySubMesh = null, this._materials = null, this._materialIndexes = null, this._indicesByMaterial = null, this._idxOfId = null;
+ }, r.prototype.pickedParticle = function(t) {
+ if (t.hit) {
+ var e = t.subMeshId, n = t.faceId, i = this.pickedBySubMesh;
+ if (i[e] && i[e][n])
+ return i[e][n];
+ }
+ return null;
+ }, r.prototype.getParticleById = function(t) {
+ var e = this.particles[t];
+ if (e && e.id == t)
+ return e;
+ var n = this.particles, i = this._idxOfId[t];
+ if (i !== void 0)
+ return n[i];
+ for (var o = 0, a = this.nbParticles; o < a; ) {
+ var s = n[o];
+ if (s.id == t)
+ return s;
+ o++;
+ }
+ return null;
+ }, r.prototype.getParticlesByShapeId = function(t) {
+ var e = [];
+ return this.getParticlesByShapeIdToRef(t, e), e;
+ }, r.prototype.getParticlesByShapeIdToRef = function(t, e) {
+ e.length = 0;
+ for (var n = 0; n < this.nbParticles; n++) {
+ var i = this.particles[n];
+ i.shapeId == t && e.push(i);
+ }
+ return this;
+ }, r.prototype.computeSubMeshes = function() {
+ if (!this.mesh || !this._multimaterialEnabled)
+ return this;
+ var t = this.depthSortedParticles;
+ if (this.particles.length > 0)
+ for (var e = 0; e < this.particles.length; e++) {
+ var n = this.particles[e];
+ n.materialIndex || (n.materialIndex = 0);
+ var i = t[e];
+ i.materialIndex = n.materialIndex, i.ind = n._ind, i.indicesLength = n._model._indicesLength, i.idx = n.idx;
+ }
+ this._sortParticlesByMaterial();
+ var o = this._indicesByMaterial, a = this._materialIndexes, s = this.mesh;
+ s.subMeshes = [];
+ for (var p = s.getTotalVertices(), m = 0; m < a.length; m++) {
+ var S = o[m], O = o[m + 1] - S, I = a[m];
+ new Ba.a(I, 0, p, S, O, s);
+ }
+ return this;
+ }, r.prototype._sortParticlesByMaterial = function() {
+ var t = [0];
+ this._indicesByMaterial = t;
+ var e = [];
+ this._materialIndexes = e;
+ var n = this.depthSortedParticles;
+ n.sort(this._materialSortFunction);
+ var i = n.length, o = this._indices32, a = this._indices, s = 0, p = 0, m = 0, S = n[0].materialIndex;
+ e.push(S), this._pickable && (this.pickedBySubMesh = [[]], this.pickedParticles = this.pickedBySubMesh[0]);
+ for (var O = 0; O < i; O++) {
+ var I = n[O], G = I.indicesLength, k = I.ind;
+ I.materialIndex !== S && (S = I.materialIndex, t.push(m), e.push(S), this._pickable && (s++, this.pickedBySubMesh[s] = [], p = 0));
+ for (var K = 0, re = 0; re < G; re++) {
+ if (o[m] = a[k + re], this._pickable && re % 3 == 0) {
+ var se = this.pickedBySubMesh[s][p];
+ se ? (se.idx = I.idx, se.faceId = K) : this.pickedBySubMesh[s][p] = { idx: I.idx, faceId: K }, p++, K++;
+ }
+ m++;
+ }
+ }
+ return t.push(o.length), this._updatable && this.mesh.updateIndices(o), this;
+ }, r.prototype._setMaterialIndexesById = function() {
+ this._materialIndexesById = {};
+ for (var t = 0; t < this._materials.length; t++) {
+ var e = this._materials[t].uniqueId;
+ this._materialIndexesById[e] = t;
+ }
+ }, r.prototype._filterUniqueMaterialId = function(t) {
+ return t.filter(function(e, n, i) {
+ return i.indexOf(e) === n;
+ });
+ }, r.prototype._setDefaultMaterial = function() {
+ return this._defaultMaterial || (this._defaultMaterial = new kt.a(this.name + "DefaultMaterial", this._scene)), this._defaultMaterial;
+ }, r.prototype.refreshVisibleSize = function() {
+ return this._isVisibilityBoxLocked || this.mesh.refreshBoundingInfo(), this;
+ }, r.prototype.setVisibilityBox = function(t) {
+ var e = t / 2;
+ this.mesh._boundingInfo = new vr.a(new c.e(-e, -e, -e), new c.e(e, e, e));
+ }, Object.defineProperty(r.prototype, "isAlwaysVisible", { get: function() {
+ return this._alwaysVisible;
+ }, set: function(t) {
+ this._alwaysVisible = t, this.mesh.alwaysSelectAsActiveMesh = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "isVisibilityBoxLocked", { get: function() {
+ return this._isVisibilityBoxLocked;
+ }, set: function(t) {
+ this._isVisibilityBoxLocked = t, this.mesh.getBoundingInfo().isLocked = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "computeParticleRotation", { get: function() {
+ return this._computeParticleRotation;
+ }, set: function(t) {
+ this._computeParticleRotation = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "computeParticleColor", { get: function() {
+ return this._computeParticleColor;
+ }, set: function(t) {
+ this._computeParticleColor = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "computeParticleTexture", { get: function() {
+ return this._computeParticleTexture;
+ }, set: function(t) {
+ this._computeParticleTexture = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "computeParticleVertex", { get: function() {
+ return this._computeParticleVertex;
+ }, set: function(t) {
+ this._computeParticleVertex = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "computeBoundingBox", { get: function() {
+ return this._computeBoundingBox;
+ }, set: function(t) {
+ this._computeBoundingBox = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "depthSortParticles", { get: function() {
+ return this._depthSortParticles;
+ }, set: function(t) {
+ this._depthSortParticles = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "expandable", { get: function() {
+ return this._expandable;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "multimaterialEnabled", { get: function() {
+ return this._multimaterialEnabled;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "useModelMaterial", { get: function() {
+ return this._useModelMaterial;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "materials", { get: function() {
+ return this._materials;
+ }, enumerable: !1, configurable: !0 }), r.prototype.setMultiMaterial = function(t) {
+ this._materials = this._filterUniqueMaterialId(t), this._setMaterialIndexesById(), this._multimaterial && this._multimaterial.dispose(), this._multimaterial = new Yr.a(this.name + "MultiMaterial", this._scene);
+ for (var e = 0; e < this._materials.length; e++)
+ this._multimaterial.subMaterials.push(this._materials[e]);
+ this.computeSubMeshes(), this.mesh.material = this._multimaterial;
+ }, Object.defineProperty(r.prototype, "multimaterial", { get: function() {
+ return this._multimaterial;
+ }, set: function(t) {
+ this._multimaterial = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "autoUpdateSubMeshes", { get: function() {
+ return this._autoUpdateSubMeshes;
+ }, set: function(t) {
+ this._autoUpdateSubMeshes = t;
+ }, enumerable: !1, configurable: !0 }), r.prototype.initParticles = function() {
+ }, r.prototype.recycleParticle = function(t) {
+ return t;
+ }, r.prototype.updateParticle = function(t) {
+ return t;
+ }, r.prototype.updateParticleVertex = function(t, e, n) {
+ return this;
+ }, r.prototype.beforeUpdateParticles = function(t, e, n) {
+ }, r.prototype.afterUpdateParticles = function(t, e, n) {
+ }, r;
+ }(), R_ = function() {
+ function r(t, e, n, i, o) {
+ this.idx = 0, this.color = new C.b(1, 1, 1, 1), this.position = c.e.Zero(), this.rotation = c.e.Zero(), this.uv = new c.d(0, 0), this.velocity = c.e.Zero(), this.pivot = c.e.Zero(), this.translateFromPivot = !1, this._pos = 0, this._ind = 0, this.groupId = 0, this.idxInGroup = 0, this._stillInvisible = !1, this._rotationMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1], this.parentId = null, this._globalPosition = c.e.Zero(), this.idx = t, this._group = e, this.groupId = n, this.idxInGroup = i, this._pcs = o;
+ }
+ return Object.defineProperty(r.prototype, "size", { get: function() {
+ return this.size;
+ }, set: function(t) {
+ this.size = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "quaternion", { get: function() {
+ return this.rotationQuaternion;
+ }, set: function(t) {
+ this.rotationQuaternion = t;
+ }, enumerable: !1, configurable: !0 }), r.prototype.intersectsMesh = function(t, e) {
+ if (!t._boundingInfo)
+ return !1;
+ if (e = e || !1)
+ return t.getBoundingInfo().boundingSphere.intersectsPoint(this.position.add(this._pcs.mesh.position));
+ var n, i, o, a, s, p;
+ n = t.getBoundingInfo().boundingBox.maximumWorld.x, i = t.getBoundingInfo().boundingBox.minimumWorld.x, o = t.getBoundingInfo().boundingBox.maximumWorld.y, a = t.getBoundingInfo().boundingBox.minimumWorld.y, s = t.getBoundingInfo().boundingBox.maximumWorld.z, p = t.getBoundingInfo().boundingBox.minimumWorld.z;
+ var m = this.position.x + this._pcs.mesh.position.x, S = this.position.y + this._pcs.mesh.position.y, O = this.position.z + this._pcs.mesh.position.z;
+ return i <= m && m <= n && a <= S && S <= o && p <= O && O <= s;
+ }, r.prototype.getRotationMatrix = function(t) {
+ var e;
+ if (this.rotationQuaternion)
+ e = this.rotationQuaternion;
+ else {
+ e = c.c.Quaternion[0];
+ var n = this.rotation;
+ c.b.RotationYawPitchRollToRef(n.y, n.x, n.z, e);
+ }
+ e.toRotationMatrix(t);
+ }, r;
+ }(), nc = function(r, t) {
+ this.groupID = r, this._positionFunction = t;
+ };
+ (function(r) {
+ r[r.Color = 2] = "Color", r[r.UV = 1] = "UV", r[r.Random = 0] = "Random", r[r.Stated = 3] = "Stated";
+ })(Ln || (Ln = {}));
+ var oE = function() {
+ function r(t, e, n, i) {
+ this.particles = new Array(), this.nbParticles = 0, this.counter = 0, this.vars = {}, this._promises = [], this._positions = new Array(), this._indices = new Array(), this._normals = new Array(), this._colors = new Array(), this._uvs = new Array(), this._updatable = !0, this._isVisibilityBoxLocked = !1, this._alwaysVisible = !1, this._groups = new Array(), this._groupCounter = 0, this._computeParticleColor = !0, this._computeParticleTexture = !0, this._computeParticleRotation = !0, this._computeBoundingBox = !1, this._isReady = !1, this.name = t, this._size = e, this._scene = n || te.a.LastCreatedScene, i && i.updatable !== void 0 ? this._updatable = i.updatable : this._updatable = !0;
+ }
+ return r.prototype.buildMeshAsync = function() {
+ var t = this;
+ return Promise.all(this._promises).then(function() {
+ return t._isReady = !0, t._buildMesh();
+ });
+ }, r.prototype._buildMesh = function() {
+ this.nbParticles === 0 && this.addPoints(1), this._positions32 = new Float32Array(this._positions), this._uvs32 = new Float32Array(this._uvs), this._colors32 = new Float32Array(this._colors);
+ var t = new ft.a();
+ t.set(this._positions32, De.b.PositionKind), this._uvs32.length > 0 && t.set(this._uvs32, De.b.UVKind);
+ var e = 0;
+ this._colors32.length > 0 && (e = 1, t.set(this._colors32, De.b.ColorKind));
+ var n = new we.a(this.name, this._scene);
+ t.applyToMesh(n, this._updatable), this.mesh = n, this._positions = null, this._uvs = null, this._colors = null, this._updatable || (this.particles.length = 0);
+ var i = new kt.a("point cloud material", this._scene);
+ return i.emissiveColor = new C.a(e, e, e), i.disableLighting = !0, i.pointsCloud = !0, i.pointSize = this._size, n.material = i, new Promise(function(o) {
+ return o(n);
+ });
+ }, r.prototype._addParticle = function(t, e, n, i) {
+ var o = new R_(t, e, n, i, this);
+ return this.particles.push(o), o;
+ }, r.prototype._randomUnitVector = function(t) {
+ t.position = new c.e(Math.random(), Math.random(), Math.random()), t.color = new C.b(1, 1, 1, 1);
+ }, r.prototype._getColorIndicesForCoord = function(t, e, n, i) {
+ var o = t._groupImageData, a = n * (4 * i) + 4 * e, s = [a, a + 1, a + 2, a + 3], p = s[1], m = s[2], S = s[3], O = o[s[0]], I = o[p], G = o[m], k = o[S];
+ return new C.b(O / 255, I / 255, G / 255, k);
+ }, r.prototype._setPointsColorOrUV = function(t, e, n, i, o, a, s) {
+ n && t.updateFacetData();
+ var p = 2 * t.getBoundingInfo().boundingSphere.radius, m = t.getVerticesData(De.b.PositionKind), S = t.getIndices(), O = t.getVerticesData(De.b.UVKind), I = t.getVerticesData(De.b.ColorKind), G = c.e.Zero();
+ t.computeWorldMatrix();
+ var k = t.getWorldMatrix();
+ if (!k.isIdentity())
+ for (var K = 0; K < m.length / 3; K++)
+ c.e.TransformCoordinatesFromFloatsToRef(m[3 * K], m[3 * K + 1], m[3 * K + 2], k, G), m[3 * K] = G.x, m[3 * K + 1] = G.y, m[3 * K + 2] = G.z;
+ var re, se, ue = 0, he = 0, pe = 0, ve = 0, Ee = 0, Ae = 0, Ie = 0, xe = 0, Pe = 0, Ce = 0, Fe = 0, Oe = 0, Be = 0, Le = 0, Ve = c.e.Zero(), Qe = c.e.Zero(), nt = c.e.Zero(), rt = c.e.Zero(), ut = c.e.Zero(), qe = 0, at = 0, ot = 0, Je = 0, dt = 0, Ge = 0, $e = c.d.Zero(), yt = c.d.Zero(), Jt = c.d.Zero(), Bt = c.d.Zero(), rn = c.d.Zero(), vt = 0, sn = 0, $t = 0, Qt = 0, en = 0, Tt = 0, It = 0, cn = 0, Hn = 0, Jn = 0, pi = 0, Wn = 0, on = c.f.Zero(), Mi = c.f.Zero(), ar = c.f.Zero(), jo = c.f.Zero(), Ho = c.f.Zero(), Ii = 0, Sr = 0;
+ s = s || 0;
+ var Wo, qt = new c.f(0, 0, 0, 0), Ar = c.e.Zero(), wn = c.e.Zero(), Jr = c.e.Zero(), sr = 0, bc = c.e.Zero(), yc = 0, Xo = 0, Pr = new An.a(c.e.Zero(), new c.e(1, 0, 0)), Cr = c.e.Zero();
+ for (he = 0; he < S.length / 3; he++) {
+ var $r, xr, Yo, Ko, Qo, Rr, Or, qo;
+ pe = S[3 * he], ve = S[3 * he + 1], Ee = S[3 * he + 2], Ae = m[3 * pe], Ie = m[3 * pe + 1], xe = m[3 * pe + 2], Pe = m[3 * ve], Ce = m[3 * ve + 1], Fe = m[3 * ve + 2], Oe = m[3 * Ee], Be = m[3 * Ee + 1], Le = m[3 * Ee + 2], Ve.set(Ae, Ie, xe), Qe.set(Pe, Ce, Fe), nt.set(Oe, Be, Le), Qe.subtractToRef(Ve, rt), nt.subtractToRef(Qe, ut), O && (qe = O[2 * pe], at = O[2 * pe + 1], ot = O[2 * ve], Je = O[2 * ve + 1], dt = O[2 * Ee], Ge = O[2 * Ee + 1], $e.set(qe, at), yt.set(ot, Je), Jt.set(dt, Ge), yt.subtractToRef($e, Bt), Jt.subtractToRef(yt, rn)), I && i && (vt = I[4 * pe], sn = I[4 * pe + 1], $t = I[4 * pe + 2], Qt = I[4 * pe + 3], en = I[4 * ve], Tt = I[4 * ve + 1], It = I[4 * ve + 2], cn = I[4 * ve + 3], Hn = I[4 * Ee], Jn = I[4 * Ee + 1], pi = I[4 * Ee + 2], Wn = I[4 * Ee + 3], on.set(vt, sn, $t, Qt), Mi.set(en, Tt, It, cn), ar.set(Hn, Jn, pi, Wn), Mi.subtractToRef(on, jo), ar.subtractToRef(Mi, Ho));
+ for (var cr, Xn, Xa = new C.a(0, 0, 0), eo = new C.a(0, 0, 0), Ya = 0; Ya < e._groupDensity[he]; Ya++)
+ ue = this.particles.length, this._addParticle(ue, e, this._groupCounter, he + Ya), Xn = this.particles[ue], Ii = ee.a.RandomRange(0, 1), Sr = ee.a.RandomRange(0, 1), re = Ve.add(rt.scale(Ii)).add(ut.scale(Ii * Sr)), n && (Ar = t.getFacetNormal(he).normalize().scale(-1), wn = rt.clone().normalize(), Jr = c.e.Cross(Ar, wn), sr = ee.a.RandomRange(0, 2 * Math.PI), bc = wn.scale(Math.cos(sr)).add(Jr.scale(Math.sin(sr))), sr = ee.a.RandomRange(0.1, Math.PI / 2), Cr = bc.scale(Math.cos(sr)).add(Ar.scale(Math.sin(sr))), Pr.origin = re.add(Cr.scale(1e-5)), Pr.direction = Cr, Pr.length = p, (Wo = Pr.intersectsMesh(t)).hit && (Xo = Wo.pickedPoint.subtract(re).length(), yc = ee.a.RandomRange(0, 1) * Xo, re.addInPlace(Cr.scale(yc)))), Xn.position = re.clone(), this._positions.push(Xn.position.x, Xn.position.y, Xn.position.z), i !== void 0 ? O && (se = $e.add(Bt.scale(Ii)).add(rn.scale(Ii * Sr)), i ? o && e._groupImageData !== null ? ($r = e._groupImgWidth, xr = e._groupImgHeight, cr = this._getColorIndicesForCoord(e, Math.round(se.x * $r), Math.round(se.y * xr), $r), Xn.color = cr, this._colors.push(cr.r, cr.g, cr.b, cr.a)) : I ? (qt = on.add(jo.scale(Ii)).add(Ho.scale(Ii * Sr)), Xn.color = new C.b(qt.x, qt.y, qt.z, qt.w), this._colors.push(qt.x, qt.y, qt.z, qt.w)) : (qt = on.set(Math.random(), Math.random(), Math.random(), 1), Xn.color = new C.b(qt.x, qt.y, qt.z, qt.w), this._colors.push(qt.x, qt.y, qt.z, qt.w)) : (Xn.uv = se.clone(), this._uvs.push(Xn.uv.x, Xn.uv.y))) : (a ? (Xa.set(a.r, a.g, a.b), Yo = ee.a.RandomRange(-s, s), Ko = ee.a.RandomRange(-s, s), Qo = (qo = Xa.toHSV()).r, (Rr = qo.g + Yo) < 0 && (Rr = 0), Rr > 1 && (Rr = 1), (Or = qo.b + Ko) < 0 && (Or = 0), Or > 1 && (Or = 1), C.a.HSVtoRGBToRef(Qo, Rr, Or, eo), qt.set(eo.r, eo.g, eo.b, 1)) : qt = on.set(Math.random(), Math.random(), Math.random(), 1), Xn.color = new C.b(qt.x, qt.y, qt.z, qt.w), this._colors.push(qt.x, qt.y, qt.z, qt.w));
+ }
+ }, r.prototype._colorFromTexture = function(t, e, n) {
+ var i = this;
+ if (t.material === null)
+ return h.a.Warn(t.name + "has no material."), e._groupImageData = null, void this._setPointsColorOrUV(t, e, n, !0, !1);
+ var o = t.material.getActiveTextures();
+ if (o.length === 0)
+ return h.a.Warn(t.name + "has no useable texture."), e._groupImageData = null, void this._setPointsColorOrUV(t, e, n, !0, !1);
+ var a = t.clone();
+ a.setEnabled(!1), this._promises.push(new Promise(function(s) {
+ oi.a.WhenAllReady(o, function() {
+ var p = e._textureNb;
+ return p < 0 && (p = 0), p > o.length - 1 && (p = o.length - 1), e._groupImageData = o[p].readPixels(), e._groupImgWidth = o[p].getSize().width, e._groupImgHeight = o[p].getSize().height, i._setPointsColorOrUV(a, e, n, !0, !0), a.dispose(), s();
+ });
+ }));
+ }, r.prototype._calculateDensity = function(t, e, n) {
+ for (var i, o, a, s, p, m, S, O, I, G, k, K, re, se, ue, he, pe, ve = new Array(), Ee = c.e.Zero(), Ae = c.e.Zero(), Ie = c.e.Zero(), xe = c.e.Zero(), Pe = c.e.Zero(), Ce = c.e.Zero(), Fe = new Array(), Oe = 0, Be = n.length / 3, Le = 0; Le < Be; Le++)
+ i = n[3 * Le], o = n[3 * Le + 1], a = n[3 * Le + 2], s = e[3 * i], p = e[3 * i + 1], m = e[3 * i + 2], S = e[3 * o], O = e[3 * o + 1], I = e[3 * o + 2], G = e[3 * a], k = e[3 * a + 1], K = e[3 * a + 2], Ee.set(s, p, m), Ae.set(S, O, I), Ie.set(G, k, K), Ae.subtractToRef(Ee, xe), Ie.subtractToRef(Ae, Pe), Ie.subtractToRef(Ee, Ce), he = ((re = xe.length()) + (se = Pe.length()) + (ue = Ce.length())) / 2, Oe += pe = Math.sqrt(he * (he - re) * (he - se) * (he - ue)), Fe[Le] = pe;
+ var Ve = 0;
+ for (Le = 0; Le < Be; Le++)
+ ve[Le] = Math.floor(t * Fe[Le] / Oe), Ve += ve[Le];
+ var Qe = t - Ve, nt = Math.floor(Qe / Be), rt = Qe % Be;
+ for (nt > 0 && (ve = ve.map(function(ut) {
+ return ut + nt;
+ })), Le = 0; Le < rt; Le++)
+ ve[Le] += 1;
+ return ve;
+ }, r.prototype.addPoints = function(t, e) {
+ e === void 0 && (e = this._randomUnitVector);
+ for (var n, i = new nc(this._groupCounter, e), o = this.nbParticles, a = 0; a < t; a++)
+ n = this._addParticle(o, i, this._groupCounter, a), i && i._positionFunction && i._positionFunction(n, o, a), this._positions.push(n.position.x, n.position.y, n.position.z), n.color && this._colors.push(n.color.r, n.color.g, n.color.b, n.color.a), n.uv && this._uvs.push(n.uv.x, n.uv.y), o++;
+ return this.nbParticles += t, this._groupCounter++, this._groupCounter;
+ }, r.prototype.addSurfacePoints = function(t, e, n, i, o) {
+ var a = n || Ln.Random;
+ (isNaN(a) || a < 0 || a > 3) && (a = Ln.Random);
+ var s = t.getVerticesData(De.b.PositionKind), p = t.getIndices();
+ this._groups.push(this._groupCounter);
+ var m = new nc(this._groupCounter, null);
+ switch (m._groupDensity = this._calculateDensity(e, s, p), a === Ln.Color ? m._textureNb = i || 0 : i = i || new C.b(1, 1, 1, 1), a) {
+ case Ln.Color:
+ this._colorFromTexture(t, m, !1);
+ break;
+ case Ln.UV:
+ this._setPointsColorOrUV(t, m, !1, !1, !1);
+ break;
+ case Ln.Random:
+ this._setPointsColorOrUV(t, m, !1);
+ break;
+ case Ln.Stated:
+ this._setPointsColorOrUV(t, m, !1, void 0, void 0, i, o);
+ }
+ return this.nbParticles += e, this._groupCounter++, this._groupCounter - 1;
+ }, r.prototype.addVolumePoints = function(t, e, n, i, o) {
+ var a = n || Ln.Random;
+ (isNaN(a) || a < 0 || a > 3) && (a = Ln.Random);
+ var s = t.getVerticesData(De.b.PositionKind), p = t.getIndices();
+ this._groups.push(this._groupCounter);
+ var m = new nc(this._groupCounter, null);
+ switch (m._groupDensity = this._calculateDensity(e, s, p), a === Ln.Color ? m._textureNb = i || 0 : i = i || new C.b(1, 1, 1, 1), a) {
+ case Ln.Color:
+ this._colorFromTexture(t, m, !0);
+ break;
+ case Ln.UV:
+ this._setPointsColorOrUV(t, m, !0, !1, !1);
+ break;
+ case Ln.Random:
+ this._setPointsColorOrUV(t, m, !0);
+ break;
+ case Ln.Stated:
+ this._setPointsColorOrUV(t, m, !0, void 0, void 0, i, o);
+ }
+ return this.nbParticles += e, this._groupCounter++, this._groupCounter - 1;
+ }, r.prototype.setParticles = function(t, e, n) {
+ if (t === void 0 && (t = 0), e === void 0 && (e = this.nbParticles - 1), n === void 0 && (n = !0), !this._updatable || !this._isReady)
+ return this;
+ this.beforeUpdateParticles(t, e, n);
+ var i = c.c.Matrix[0], o = this.mesh, a = this._colors32, s = this._positions32, p = this._uvs32, m = c.c.Vector3, S = m[5].copyFromFloats(1, 0, 0), O = m[6].copyFromFloats(0, 1, 0), I = m[7].copyFromFloats(0, 0, 1), G = m[8].setAll(Number.MAX_VALUE), k = m[9].setAll(-Number.MAX_VALUE);
+ c.a.IdentityToRef(i);
+ var K = 0;
+ if (this.mesh.isFacetDataEnabled && (this._computeBoundingBox = !0), e = e >= this.nbParticles ? this.nbParticles - 1 : e, this._computeBoundingBox && (t != 0 || e != this.nbParticles - 1)) {
+ var re = this.mesh._boundingInfo;
+ re && (G.copyFrom(re.minimum), k.copyFrom(re.maximum));
+ }
+ K = 0;
+ for (var se = 0, ue = 0, he = 0, pe = t; pe <= e; pe++) {
+ var ve = this.particles[pe];
+ se = 3 * (K = ve.idx), ue = 4 * K, he = 2 * K, this.updateParticle(ve);
+ var Ee = ve._rotationMatrix, Ae = ve.position, Ie = ve._globalPosition;
+ if (this._computeParticleRotation && ve.getRotationMatrix(i), ve.parentId !== null) {
+ var xe = this.particles[ve.parentId], Pe = xe._rotationMatrix, Ce = xe._globalPosition, Fe = Ae.x * Pe[1] + Ae.y * Pe[4] + Ae.z * Pe[7], Oe = Ae.x * Pe[0] + Ae.y * Pe[3] + Ae.z * Pe[6], Be = Ae.x * Pe[2] + Ae.y * Pe[5] + Ae.z * Pe[8];
+ if (Ie.x = Ce.x + Oe, Ie.y = Ce.y + Fe, Ie.z = Ce.z + Be, this._computeParticleRotation) {
+ var Le = i.m;
+ Ee[0] = Le[0] * Pe[0] + Le[1] * Pe[3] + Le[2] * Pe[6], Ee[1] = Le[0] * Pe[1] + Le[1] * Pe[4] + Le[2] * Pe[7], Ee[2] = Le[0] * Pe[2] + Le[1] * Pe[5] + Le[2] * Pe[8], Ee[3] = Le[4] * Pe[0] + Le[5] * Pe[3] + Le[6] * Pe[6], Ee[4] = Le[4] * Pe[1] + Le[5] * Pe[4] + Le[6] * Pe[7], Ee[5] = Le[4] * Pe[2] + Le[5] * Pe[5] + Le[6] * Pe[8], Ee[6] = Le[8] * Pe[0] + Le[9] * Pe[3] + Le[10] * Pe[6], Ee[7] = Le[8] * Pe[1] + Le[9] * Pe[4] + Le[10] * Pe[7], Ee[8] = Le[8] * Pe[2] + Le[9] * Pe[5] + Le[10] * Pe[8];
+ }
+ } else
+ Ie.x = 0, Ie.y = 0, Ie.z = 0, this._computeParticleRotation && (Le = i.m, Ee[0] = Le[0], Ee[1] = Le[1], Ee[2] = Le[2], Ee[3] = Le[4], Ee[4] = Le[5], Ee[5] = Le[6], Ee[6] = Le[8], Ee[7] = Le[9], Ee[8] = Le[10]);
+ var Ve = m[11];
+ ve.translateFromPivot ? Ve.setAll(0) : Ve.copyFrom(ve.pivot);
+ var Qe = m[0];
+ Qe.copyFrom(ve.position);
+ var nt = Qe.x - ve.pivot.x, rt = Qe.y - ve.pivot.y, ut = Qe.z - ve.pivot.z, qe = nt * Ee[0] + rt * Ee[3] + ut * Ee[6], at = nt * Ee[1] + rt * Ee[4] + ut * Ee[7], ot = nt * Ee[2] + rt * Ee[5] + ut * Ee[8];
+ qe += Ve.x, at += Ve.y, ot += Ve.z;
+ var Je = s[se] = Ie.x + S.x * qe + O.x * at + I.x * ot, dt = s[se + 1] = Ie.y + S.y * qe + O.y * at + I.y * ot, Ge = s[se + 2] = Ie.z + S.z * qe + O.z * at + I.z * ot;
+ if (this._computeBoundingBox && (G.minimizeInPlaceFromFloats(Je, dt, Ge), k.maximizeInPlaceFromFloats(Je, dt, Ge)), this._computeParticleColor && ve.color) {
+ var $e = ve.color, yt = this._colors32;
+ yt[ue] = $e.r, yt[ue + 1] = $e.g, yt[ue + 2] = $e.b, yt[ue + 3] = $e.a;
+ }
+ if (this._computeParticleTexture && ve.uv) {
+ var Jt = ve.uv, Bt = this._uvs32;
+ Bt[he] = Jt.x, Bt[he + 1] = Jt.y;
+ }
+ }
+ return n && (this._computeParticleColor && o.updateVerticesData(De.b.ColorKind, a, !1, !1), this._computeParticleTexture && o.updateVerticesData(De.b.UVKind, p, !1, !1), o.updateVerticesData(De.b.PositionKind, s, !1, !1)), this._computeBoundingBox && (o._boundingInfo ? o._boundingInfo.reConstruct(G, k, o._worldMatrix) : o._boundingInfo = new vr.a(G, k, o._worldMatrix)), this.afterUpdateParticles(t, e, n), this;
+ }, r.prototype.dispose = function() {
+ this.mesh.dispose(), this.vars = null, this._positions = null, this._indices = null, this._normals = null, this._uvs = null, this._colors = null, this._indices32 = null, this._positions32 = null, this._uvs32 = null, this._colors32 = null;
+ }, r.prototype.refreshVisibleSize = function() {
+ return this._isVisibilityBoxLocked || this.mesh.refreshBoundingInfo(), this;
+ }, r.prototype.setVisibilityBox = function(t) {
+ var e = t / 2;
+ this.mesh._boundingInfo = new vr.a(new c.e(-e, -e, -e), new c.e(e, e, e));
+ }, Object.defineProperty(r.prototype, "isAlwaysVisible", { get: function() {
+ return this._alwaysVisible;
+ }, set: function(t) {
+ this._alwaysVisible = t, this.mesh.alwaysSelectAsActiveMesh = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "computeParticleRotation", { set: function(t) {
+ this._computeParticleRotation = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "computeParticleColor", { get: function() {
+ return this._computeParticleColor;
+ }, set: function(t) {
+ this._computeParticleColor = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "computeParticleTexture", { get: function() {
+ return this._computeParticleTexture;
+ }, set: function(t) {
+ this._computeParticleTexture = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "computeBoundingBox", { get: function() {
+ return this._computeBoundingBox;
+ }, set: function(t) {
+ this._computeBoundingBox = t;
+ }, enumerable: !1, configurable: !0 }), r.prototype.initParticles = function() {
+ }, r.prototype.recycleParticle = function(t) {
+ return t;
+ }, r.prototype.updateParticle = function(t) {
+ return t;
+ }, r.prototype.beforeUpdateParticles = function(t, e, n) {
+ }, r.prototype.afterUpdateParticles = function(t, e, n) {
+ }, r;
+ }();
+ ge.a.prototype.getPhysicsEngine = function() {
+ return this._physicsEngine;
+ }, ge.a.prototype.enablePhysics = function(r, t) {
+ if (r === void 0 && (r = null), this._physicsEngine)
+ return !0;
+ var e = this._getComponent(st.a.NAME_PHYSICSENGINE);
+ e || (e = new O_(this), this._addComponent(e));
+ try {
+ return this._physicsEngine = new Lo(r, t), this._physicsTimeAccumulator = 0, !0;
+ } catch (n) {
+ return h.a.Error(n.message), !1;
+ }
+ }, ge.a.prototype.disablePhysicsEngine = function() {
+ this._physicsEngine && (this._physicsEngine.dispose(), this._physicsEngine = null);
+ }, ge.a.prototype.isPhysicsEnabled = function() {
+ return this._physicsEngine !== void 0;
+ }, ge.a.prototype.deleteCompoundImpostor = function(r) {
+ var t = r.parts[0].mesh;
+ t.physicsImpostor && (t.physicsImpostor.dispose(), t.physicsImpostor = null);
+ }, ge.a.prototype._advancePhysicsEngineStep = function(r) {
+ if (this._physicsEngine) {
+ var t = this._physicsEngine.getSubTimeStep();
+ if (t > 0)
+ for (this._physicsTimeAccumulator += r; this._physicsTimeAccumulator > t; )
+ this.onBeforePhysicsObservable.notifyObservers(this), this._physicsEngine._step(t / 1e3), this.onAfterPhysicsObservable.notifyObservers(this), this._physicsTimeAccumulator -= t;
+ else
+ this.onBeforePhysicsObservable.notifyObservers(this), this._physicsEngine._step(r / 1e3), this.onAfterPhysicsObservable.notifyObservers(this);
+ }
+ }, Object.defineProperty(Nt.a.prototype, "physicsImpostor", { get: function() {
+ return this._physicsImpostor;
+ }, set: function(r) {
+ var t = this;
+ this._physicsImpostor !== r && (this._disposePhysicsObserver && this.onDisposeObservable.remove(this._disposePhysicsObserver), this._physicsImpostor = r, r && (this._disposePhysicsObserver = this.onDisposeObservable.add(function() {
+ t.physicsImpostor && (t.physicsImpostor.dispose(), t.physicsImpostor = null);
+ })));
+ }, enumerable: !0, configurable: !0 }), Nt.a.prototype.getPhysicsImpostor = function() {
+ return this.physicsImpostor;
+ }, Nt.a.prototype.applyImpulse = function(r, t) {
+ return this.physicsImpostor ? (this.physicsImpostor.applyImpulse(r, t), this) : this;
+ }, Nt.a.prototype.setPhysicsLinkWith = function(r, t, e, n) {
+ return this.physicsImpostor && r.physicsImpostor ? (this.physicsImpostor.createJoint(r.physicsImpostor, un.e.HingeJoint, { mainPivot: t, connectedPivot: e, nativeParams: n }), this) : this;
+ };
+ var ja, Vo, O_ = function() {
+ function r(t) {
+ var e = this;
+ this.name = st.a.NAME_PHYSICSENGINE, this.scene = t, this.scene.onBeforePhysicsObservable = new P.c(), this.scene.onAfterPhysicsObservable = new P.c(), this.scene.getDeterministicFrameTime = function() {
+ return e.scene._physicsEngine ? 1e3 * e.scene._physicsEngine.getTimeStep() : 1e3 / 60;
+ };
+ }
+ return r.prototype.register = function() {
+ }, r.prototype.rebuild = function() {
+ }, r.prototype.dispose = function() {
+ this.scene.onBeforePhysicsObservable.clear(), this.scene.onAfterPhysicsObservable.clear(), this.scene._physicsEngine && this.scene.disablePhysicsEngine();
+ }, r;
+ }(), aE = function() {
+ function r(t) {
+ this._scene = t, this._physicsEngine = this._scene.getPhysicsEngine(), this._physicsEngine || h.a.Warn("Physics engine not enabled. Please enable the physics before you can use the methods.");
+ }
+ return r.prototype.applyRadialExplosionImpulse = function(t, e, n, i) {
+ if (!this._physicsEngine)
+ return h.a.Warn("Physics engine not enabled. Please enable the physics before you call this method."), null;
+ var o = this._physicsEngine.getImpostors();
+ if (o.length === 0)
+ return null;
+ typeof e == "number" && ((e = new ko()).radius = e, e.strength = n || e.strength, e.falloff = i || e.falloff);
+ var a = new M_(this._scene, e), s = Array();
+ return o.forEach(function(p) {
+ var m = a.getImpostorHitData(p, t);
+ m && (p.applyImpulse(m.force, m.contactPoint), s.push({ impostor: p, hitData: m }));
+ }), a.triggerAffectedImpostorsCallback(s), a.dispose(!1), a;
+ }, r.prototype.applyRadialExplosionForce = function(t, e, n, i) {
+ if (!this._physicsEngine)
+ return h.a.Warn("Physics engine not enabled. Please enable the physics before you call the PhysicsHelper."), null;
+ var o = this._physicsEngine.getImpostors();
+ if (o.length === 0)
+ return null;
+ typeof e == "number" && ((e = new ko()).radius = e, e.strength = n || e.strength, e.falloff = i || e.falloff);
+ var a = new M_(this._scene, e), s = Array();
+ return o.forEach(function(p) {
+ var m = a.getImpostorHitData(p, t);
+ m && (p.applyForce(m.force, m.contactPoint), s.push({ impostor: p, hitData: m }));
+ }), a.triggerAffectedImpostorsCallback(s), a.dispose(!1), a;
+ }, r.prototype.gravitationalField = function(t, e, n, i) {
+ if (!this._physicsEngine)
+ return h.a.Warn("Physics engine not enabled. Please enable the physics before you call the PhysicsHelper."), null;
+ if (this._physicsEngine.getImpostors().length === 0)
+ return null;
+ typeof e == "number" && ((e = new ko()).radius = e, e.strength = n || e.strength, e.falloff = i || e.falloff);
+ var o = new sE(this, this._scene, t, e);
+ return o.dispose(!1), o;
+ }, r.prototype.updraft = function(t, e, n, i, o) {
+ if (!this._physicsEngine)
+ return h.a.Warn("Physics engine not enabled. Please enable the physics before you call the PhysicsHelper."), null;
+ if (this._physicsEngine.getImpostors().length === 0)
+ return null;
+ typeof e == "number" && ((e = new wu()).radius = e, e.strength = n || e.strength, e.height = i || e.height, e.updraftMode = o || e.updraftMode);
+ var a = new cE(this._scene, t, e);
+ return a.dispose(!1), a;
+ }, r.prototype.vortex = function(t, e, n, i) {
+ if (!this._physicsEngine)
+ return h.a.Warn("Physics engine not enabled. Please enable the physics before you call the PhysicsHelper."), null;
+ if (this._physicsEngine.getImpostors().length === 0)
+ return null;
+ typeof e == "number" && ((e = new Nu()).radius = e, e.strength = n || e.strength, e.height = i || e.height);
+ var o = new lE(this._scene, t, e);
+ return o.dispose(!1), o;
+ }, r;
+ }(), M_ = function() {
+ function r(t, e) {
+ this._scene = t, this._options = e, this._dataFetched = !1, this._options = Object(u.a)(Object(u.a)({}, new ko()), this._options);
+ }
+ return r.prototype.getData = function() {
+ return this._dataFetched = !0, { sphere: this._sphere };
+ }, r.prototype.getImpostorHitData = function(t, e) {
+ if (t.mass === 0 || !this._intersectsWithSphere(t, e, this._options.radius) || t.object.getClassName() !== "Mesh" && t.object.getClassName() !== "InstancedMesh")
+ return null;
+ var n = t.getObjectCenter().subtract(e), i = new An.a(e, n, this._options.radius).intersectsMesh(t.object).pickedPoint;
+ if (!i)
+ return null;
+ var o = c.e.Distance(e, i);
+ if (o > this._options.radius)
+ return null;
+ var a = this._options.falloff === ja.Constant ? this._options.strength : this._options.strength * (1 - o / this._options.radius);
+ return { force: n.multiplyByFloats(a, a, a), contactPoint: i, distanceFromOrigin: o };
+ }, r.prototype.triggerAffectedImpostorsCallback = function(t) {
+ this._options.affectedImpostorsCallback && this._options.affectedImpostorsCallback(t);
+ }, r.prototype.dispose = function(t) {
+ var e = this;
+ t === void 0 && (t = !0), t ? this._sphere.dispose() : setTimeout(function() {
+ e._dataFetched || e._sphere.dispose();
+ }, 0);
+ }, r.prototype._prepareSphere = function() {
+ this._sphere || (this._sphere = Qn.a.CreateSphere("radialExplosionEventSphere", this._options.sphere, this._scene), this._sphere.isVisible = !1);
+ }, r.prototype._intersectsWithSphere = function(t, e, n) {
+ var i = t.object;
+ return this._prepareSphere(), this._sphere.position = e, this._sphere.scaling = new c.e(2 * n, 2 * n, 2 * n), this._sphere._updateBoundingInfo(), this._sphere.computeWorldMatrix(!0), this._sphere.intersectsMesh(i, !0);
+ }, r;
+ }(), sE = function() {
+ function r(t, e, n, i) {
+ this._physicsHelper = t, this._scene = e, this._origin = n, this._options = i, this._dataFetched = !1, this._options = Object(u.a)(Object(u.a)({}, new ko()), this._options), this._tickCallback = this._tick.bind(this), this._options.strength = -1 * this._options.strength;
+ }
+ return r.prototype.getData = function() {
+ return this._dataFetched = !0, { sphere: this._sphere };
+ }, r.prototype.enable = function() {
+ this._tickCallback.call(this), this._scene.registerBeforeRender(this._tickCallback);
+ }, r.prototype.disable = function() {
+ this._scene.unregisterBeforeRender(this._tickCallback);
+ }, r.prototype.dispose = function(t) {
+ var e = this;
+ t === void 0 && (t = !0), t ? this._sphere.dispose() : setTimeout(function() {
+ e._dataFetched || e._sphere.dispose();
+ }, 0);
+ }, r.prototype._tick = function() {
+ if (this._sphere)
+ this._physicsHelper.applyRadialExplosionForce(this._origin, this._options);
+ else {
+ var t = this._physicsHelper.applyRadialExplosionForce(this._origin, this._options);
+ t && (this._sphere = t.getData().sphere.clone("radialExplosionEventSphereClone"));
+ }
+ }, r;
+ }(), cE = function() {
+ function r(t, e, n) {
+ this._scene = t, this._origin = e, this._options = n, this._originTop = c.e.Zero(), this._originDirection = c.e.Zero(), this._cylinderPosition = c.e.Zero(), this._dataFetched = !1, this._physicsEngine = this._scene.getPhysicsEngine(), this._options = Object(u.a)(Object(u.a)({}, new wu()), this._options), this._origin.addToRef(new c.e(0, this._options.height / 2, 0), this._cylinderPosition), this._origin.addToRef(new c.e(0, this._options.height, 0), this._originTop), this._options.updraftMode === Vo.Perpendicular && (this._originDirection = this._origin.subtract(this._originTop).normalize()), this._tickCallback = this._tick.bind(this), this._prepareCylinder();
+ }
+ return r.prototype.getData = function() {
+ return this._dataFetched = !0, { cylinder: this._cylinder };
+ }, r.prototype.enable = function() {
+ this._tickCallback.call(this), this._scene.registerBeforeRender(this._tickCallback);
+ }, r.prototype.disable = function() {
+ this._scene.unregisterBeforeRender(this._tickCallback);
+ }, r.prototype.dispose = function(t) {
+ var e = this;
+ t === void 0 && (t = !0), this._cylinder && (t ? this._cylinder.dispose() : setTimeout(function() {
+ e._dataFetched || e._cylinder.dispose();
+ }, 0));
+ }, r.prototype.getImpostorHitData = function(t) {
+ if (t.mass === 0 || !this._intersectsWithCylinder(t))
+ return null;
+ var e = t.getObjectCenter();
+ if (this._options.updraftMode === Vo.Perpendicular)
+ var n = this._originDirection;
+ else
+ n = e.subtract(this._originTop);
+ var i = c.e.Distance(this._origin, e), o = -1 * this._options.strength;
+ return { force: n.multiplyByFloats(o, o, o), contactPoint: e, distanceFromOrigin: i };
+ }, r.prototype._tick = function() {
+ var t = this;
+ this._physicsEngine.getImpostors().forEach(function(e) {
+ var n = t.getImpostorHitData(e);
+ n && e.applyForce(n.force, n.contactPoint);
+ });
+ }, r.prototype._prepareCylinder = function() {
+ this._cylinder || (this._cylinder = Vi.a.CreateCylinder("updraftEventCylinder", { height: this._options.height, diameter: 2 * this._options.radius }, this._scene), this._cylinder.isVisible = !1);
+ }, r.prototype._intersectsWithCylinder = function(t) {
+ var e = t.object;
+ return this._cylinder.position = this._cylinderPosition, this._cylinder.intersectsMesh(e, !0);
+ }, r;
+ }(), lE = function() {
+ function r(t, e, n) {
+ this._scene = t, this._origin = e, this._options = n, this._originTop = c.e.Zero(), this._cylinderPosition = c.e.Zero(), this._dataFetched = !1, this._physicsEngine = this._scene.getPhysicsEngine(), this._options = Object(u.a)(Object(u.a)({}, new Nu()), this._options), this._origin.addToRef(new c.e(0, this._options.height / 2, 0), this._cylinderPosition), this._origin.addToRef(new c.e(0, this._options.height, 0), this._originTop), this._tickCallback = this._tick.bind(this), this._prepareCylinder();
+ }
+ return r.prototype.getData = function() {
+ return this._dataFetched = !0, { cylinder: this._cylinder };
+ }, r.prototype.enable = function() {
+ this._tickCallback.call(this), this._scene.registerBeforeRender(this._tickCallback);
+ }, r.prototype.disable = function() {
+ this._scene.unregisterBeforeRender(this._tickCallback);
+ }, r.prototype.dispose = function(t) {
+ var e = this;
+ t === void 0 && (t = !0), t ? this._cylinder.dispose() : setTimeout(function() {
+ e._dataFetched || e._cylinder.dispose();
+ }, 0);
+ }, r.prototype.getImpostorHitData = function(t) {
+ if (t.mass === 0 || !this._intersectsWithCylinder(t) || t.object.getClassName() !== "Mesh" && t.object.getClassName() !== "InstancedMesh")
+ return null;
+ var e = t.getObjectCenter(), n = new c.e(this._origin.x, e.y, this._origin.z), i = e.subtract(n), o = new An.a(n, i, this._options.radius).intersectsMesh(t.object), a = o.pickedPoint;
+ if (!a)
+ return null;
+ var s = o.distance / this._options.radius, p = a.normalize();
+ if (s > this._options.centripetalForceThreshold && (p = p.negate()), s > this._options.centripetalForceThreshold)
+ var m = p.x * this._options.centripetalForceMultiplier, S = p.y * this._options.updraftForceMultiplier, O = p.z * this._options.centripetalForceMultiplier;
+ else {
+ var I = c.e.Cross(n, e).normalize();
+ m = (I.x + p.x) * this._options.centrifugalForceMultiplier, S = this._originTop.y * this._options.updraftForceMultiplier, O = (I.z + p.z) * this._options.centrifugalForceMultiplier;
+ }
+ var G = new c.e(m, S, O);
+ return { force: G = G.multiplyByFloats(this._options.strength, this._options.strength, this._options.strength), contactPoint: e, distanceFromOrigin: s };
+ }, r.prototype._tick = function() {
+ var t = this;
+ this._physicsEngine.getImpostors().forEach(function(e) {
+ var n = t.getImpostorHitData(e);
+ n && e.applyForce(n.force, n.contactPoint);
+ });
+ }, r.prototype._prepareCylinder = function() {
+ this._cylinder || (this._cylinder = Vi.a.CreateCylinder("vortexEventCylinder", { height: this._options.height, diameter: 2 * this._options.radius }, this._scene), this._cylinder.isVisible = !1);
+ }, r.prototype._intersectsWithCylinder = function(t) {
+ var e = t.object;
+ return this._cylinder.position = this._cylinderPosition, this._cylinder.intersectsMesh(e, !0);
+ }, r;
+ }(), ko = function() {
+ this.radius = 5, this.strength = 10, this.falloff = ja.Constant, this.sphere = { segments: 32, diameter: 1 };
+ }, wu = function() {
+ this.radius = 5, this.strength = 10, this.height = 10, this.updraftMode = Vo.Center;
+ }, Nu = function() {
+ this.radius = 5, this.strength = 10, this.height = 10, this.centripetalForceThreshold = 0.7, this.centripetalForceMultiplier = 5, this.centrifugalForceMultiplier = 0.5, this.updraftForceMultiplier = 0.02;
+ };
+ (function(r) {
+ r[r.Constant = 0] = "Constant", r[r.Linear = 1] = "Linear";
+ })(ja || (ja = {})), function(r) {
+ r[r.Center = 0] = "Center", r[r.Perpendicular = 1] = "Perpendicular";
+ }(Vo || (Vo = {}));
+ var uE = `
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+uniform float degree;
+void main(void)
+{
+vec3 color=texture2D(textureSampler,vUV).rgb;
+float luminance=dot(color,vec3(0.3,0.59,0.11));
+vec3 blackAndWhite=vec3(luminance,luminance,luminance);
+gl_FragColor=vec4(color-((color-blackAndWhite)*degree),1.0);
+}`;
+ We.a.ShadersStore.blackAndWhitePixelShader = uE;
+ var I_ = function(r) {
+ function t(e, n, i, o, a, s) {
+ var p = r.call(this, e, "blackAndWhite", ["degree"], null, n, i, o, a, s) || this;
+ return p.degree = 1, p.onApplyObservable.add(function(m) {
+ m.setFloat("degree", p.degree);
+ }), p;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "BlackAndWhitePostProcess";
+ }, t._Parse = function(e, n, i, o) {
+ return w.a.Parse(function() {
+ return new t(e.name, e.options, n, e.renderTargetSamplingMode, i.getEngine(), e.reusable);
+ }, e, i, o);
+ }, Object(u.c)([Object(w.c)()], t.prototype, "degree", void 0), t;
+ }(_t);
+ x.a.RegisteredTypes["BABYLON.BlackAndWhitePostProcess"] = I_;
+ var Ot = function() {
+ function r(t, e, n, i) {
+ this._name = e, this._singleInstance = i || !0, this._getPostProcesses = n, this._cameras = {}, this._indicesForCamera = {}, this._postProcesses = {};
+ }
+ return Object.defineProperty(r.prototype, "isSupported", { get: function() {
+ for (var t in this._postProcesses)
+ if (this._postProcesses.hasOwnProperty(t)) {
+ for (var e = this._postProcesses[t], n = 0; n < e.length; n++)
+ if (!e[n].isSupported)
+ return !1;
+ }
+ return !0;
+ }, enumerable: !1, configurable: !0 }), r.prototype._update = function() {
+ }, r.prototype._attachCameras = function(t) {
+ var e, n = this, i = Ke.b.MakeArray(t || this._cameras);
+ if (i)
+ for (var o = 0; o < i.length; o++) {
+ var a = i[o];
+ if (a) {
+ var s = a.name;
+ if (e = this._singleInstance ? 0 : s, !this._postProcesses[e]) {
+ var p = this._getPostProcesses();
+ p && (this._postProcesses[e] = Array.isArray(p) ? p : [p]);
+ }
+ this._indicesForCamera[s] || (this._indicesForCamera[s] = []), this._postProcesses[e].forEach(function(m) {
+ var S = a.attachPostProcess(m);
+ n._indicesForCamera[s].push(S);
+ }), this._cameras[s] || (this._cameras[s] = a);
+ }
+ }
+ }, r.prototype._detachCameras = function(t) {
+ var e = Ke.b.MakeArray(t || this._cameras);
+ if (e)
+ for (var n = 0; n < e.length; n++) {
+ var i = e[n], o = i.name, a = this._postProcesses[this._singleInstance ? 0 : o];
+ a && a.forEach(function(s) {
+ i.detachPostProcess(s);
+ }), this._cameras[o] && (this._cameras[o] = null);
+ }
+ }, r.prototype._enable = function(t) {
+ var e = this, n = Ke.b.MakeArray(t || this._cameras);
+ if (n)
+ for (var i = 0; i < n.length; i++)
+ for (var o = n[i], a = o.name, s = 0; s < this._indicesForCamera[a].length; s++)
+ o._postProcesses[this._indicesForCamera[a][s]] !== void 0 && o._postProcesses[this._indicesForCamera[a][s]] !== null || this._postProcesses[this._singleInstance ? 0 : a].forEach(function(p) {
+ n[i].attachPostProcess(p, e._indicesForCamera[a][s]);
+ });
+ }, r.prototype._disable = function(t) {
+ var e = Ke.b.MakeArray(t || this._cameras);
+ if (e)
+ for (var n = 0; n < e.length; n++) {
+ var i = e[n], o = i.name;
+ this._postProcesses[this._singleInstance ? 0 : o].forEach(function(a) {
+ i.detachPostProcess(a);
+ });
+ }
+ }, r.prototype.getPostProcesses = function(t) {
+ return this._singleInstance ? this._postProcesses[0] : t ? this._postProcesses[t.name] : null;
+ }, r;
+ }(), hE = `#include
+
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+uniform float threshold;
+uniform float exposure;
+void main(void)
+{
+gl_FragColor=texture2D(textureSampler,vUV);
+float luma=getLuminance(gl_FragColor.rgb*exposure);
+gl_FragColor.rgb=step(threshold,luma)*gl_FragColor.rgb;
+}`;
+ We.a.ShadersStore.extractHighlightsPixelShader = hE;
+ var Fu = function(r) {
+ function t(e, n, i, o, a, s, p, m) {
+ p === void 0 && (p = d.a.TEXTURETYPE_UNSIGNED_INT), m === void 0 && (m = !1);
+ var S = r.call(this, e, "extractHighlights", ["threshold", "exposure"], null, n, i, o, a, s, null, p, void 0, null, m) || this;
+ return S.threshold = 0.9, S._exposure = 1, S._inputPostProcess = null, S.onApplyObservable.add(function(O) {
+ S._inputPostProcess && O.setTextureFromPostProcess("textureSampler", S._inputPostProcess), O.setFloat("threshold", Math.pow(S.threshold, Xt.b)), O.setFloat("exposure", S._exposure);
+ }), S;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "ExtractHighlightsPostProcess";
+ }, Object(u.c)([Object(w.c)()], t.prototype, "threshold", void 0), t;
+ }(_t);
+ x.a.RegisteredTypes["BABYLON.ExtractHighlightsPostProcess"] = Fu;
+ var dE = `uniform sampler2D textureSampler;
+uniform sampler2D bloomBlur;
+varying vec2 vUV;
+uniform float bloomWeight;
+void main(void)
+{
+gl_FragColor=texture2D(textureSampler,vUV);
+vec3 blurred=texture2D(bloomBlur,vUV).rgb;
+gl_FragColor.rgb=gl_FragColor.rgb+(blurred.rgb*bloomWeight);
+}
+`;
+ We.a.ShadersStore.bloomMergePixelShader = dE;
+ var Bu = function(r) {
+ function t(e, n, i, o, a, s, p, m, S, O, I) {
+ O === void 0 && (O = d.a.TEXTURETYPE_UNSIGNED_INT), I === void 0 && (I = !1);
+ var G = r.call(this, e, "bloomMerge", ["bloomWeight"], ["circleOfConfusionSampler", "blurStep0", "blurStep1", "blurStep2", "bloomBlur"], a, s, p, m, S, null, O, void 0, null, !0) || this;
+ return G.weight = 1, G.weight = o, G.onApplyObservable.add(function(k) {
+ k.setTextureFromPostProcess("textureSampler", n), k.setTextureFromPostProcessOutput("bloomBlur", i), k.setFloat("bloomWeight", G.weight);
+ }), I || G.updateEffect(), G;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "BloomMergePostProcess";
+ }, Object(u.c)([Object(w.c)()], t.prototype, "weight", void 0), t;
+ }(_t);
+ x.a.RegisteredTypes["BABYLON.BloomMergePostProcess"] = Bu;
+ var Uu = function(r) {
+ function t(e, n, i, o, a, s) {
+ a === void 0 && (a = 0), s === void 0 && (s = !1);
+ var p = r.call(this, e.getEngine(), "bloom", function() {
+ return p._effects;
+ }, !0) || this;
+ return p.bloomScale = n, p._effects = [], p._downscale = new Fu("highlights", 1, null, Ue.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, a, s), p._blurX = new xn("horizontal blur", new c.d(1, 0), 10, n, null, Ue.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, a, void 0, s), p._blurX.alwaysForcePOT = !0, p._blurX.autoClear = !1, p._blurY = new xn("vertical blur", new c.d(0, 1), 10, n, null, Ue.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, a, void 0, s), p._blurY.alwaysForcePOT = !0, p._blurY.autoClear = !1, p.kernel = o, p._effects = [p._downscale, p._blurX, p._blurY], p._merge = new Bu("bloomMerge", p._downscale, p._blurY, i, n, null, Ue.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, a, s), p._merge.autoClear = !1, p._effects.push(p._merge), p;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "threshold", { get: function() {
+ return this._downscale.threshold;
+ }, set: function(e) {
+ this._downscale.threshold = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "weight", { get: function() {
+ return this._merge.weight;
+ }, set: function(e) {
+ this._merge.weight = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "kernel", { get: function() {
+ return this._blurX.kernel / this.bloomScale;
+ }, set: function(e) {
+ this._blurX.kernel = e * this.bloomScale, this._blurY.kernel = e * this.bloomScale;
+ }, enumerable: !1, configurable: !0 }), t.prototype.disposeEffects = function(e) {
+ for (var n = 0; n < this._effects.length; n++)
+ this._effects[n].dispose(e);
+ }, t.prototype._updateEffects = function() {
+ for (var e = 0; e < this._effects.length; e++)
+ this._effects[e].updateEffect();
+ }, t.prototype._isReady = function() {
+ for (var e = 0; e < this._effects.length; e++)
+ if (!this._effects[e].isReady())
+ return !1;
+ return !0;
+ }, t;
+ }(Ot), fE = `
+uniform sampler2D textureSampler;
+
+uniform float chromatic_aberration;
+uniform float radialIntensity;
+uniform vec2 direction;
+uniform vec2 centerPosition;
+uniform float screen_width;
+uniform float screen_height;
+
+varying vec2 vUV;
+void main(void)
+{
+vec2 centered_screen_pos=vec2(vUV.x-centerPosition.x,vUV.y-centerPosition.y);
+vec2 directionOfEffect=direction;
+if(directionOfEffect.x == 0. && directionOfEffect.y == 0.){
+directionOfEffect=normalize(centered_screen_pos);
+}
+float radius2=centered_screen_pos.x*centered_screen_pos.x
++centered_screen_pos.y*centered_screen_pos.y;
+float radius=sqrt(radius2);
+vec4 original=texture2D(textureSampler,vUV);
+
+vec3 ref_indices=vec3(-0.3,0.0,0.3);
+float ref_shiftX=chromatic_aberration*pow(radius,radialIntensity)*directionOfEffect.x/screen_width;
+float ref_shiftY=chromatic_aberration*pow(radius,radialIntensity)*directionOfEffect.y/screen_height;
+
+vec2 ref_coords_r=vec2(vUV.x+ref_indices.r*ref_shiftX,vUV.y+ref_indices.r*ref_shiftY*0.5);
+vec2 ref_coords_g=vec2(vUV.x+ref_indices.g*ref_shiftX,vUV.y+ref_indices.g*ref_shiftY*0.5);
+vec2 ref_coords_b=vec2(vUV.x+ref_indices.b*ref_shiftX,vUV.y+ref_indices.b*ref_shiftY*0.5);
+original.r=texture2D(textureSampler,ref_coords_r).r;
+original.g=texture2D(textureSampler,ref_coords_g).g;
+original.b=texture2D(textureSampler,ref_coords_b).b;
+original.a=clamp(texture2D(textureSampler,ref_coords_r).a+texture2D(textureSampler,ref_coords_g).a+texture2D(textureSampler,ref_coords_b).a,0.,1.);
+gl_FragColor=original;
+}`;
+ We.a.ShadersStore.chromaticAberrationPixelShader = fE;
+ var Vu = function(r) {
+ function t(e, n, i, o, a, s, p, m, S, O) {
+ S === void 0 && (S = d.a.TEXTURETYPE_UNSIGNED_INT), O === void 0 && (O = !1);
+ var I = r.call(this, e, "chromaticAberration", ["chromatic_aberration", "screen_width", "screen_height", "direction", "radialIntensity", "centerPosition"], [], o, a, s, p, m, null, S, void 0, null, O) || this;
+ return I.aberrationAmount = 30, I.radialIntensity = 0, I.direction = new c.d(0.707, 0.707), I.centerPosition = new c.d(0.5, 0.5), I.screenWidth = n, I.screenHeight = i, I.onApplyObservable.add(function(G) {
+ G.setFloat("chromatic_aberration", I.aberrationAmount), G.setFloat("screen_width", n), G.setFloat("screen_height", i), G.setFloat("radialIntensity", I.radialIntensity), G.setFloat2("direction", I.direction.x, I.direction.y), G.setFloat2("centerPosition", I.centerPosition.x, I.centerPosition.y);
+ }), I;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "ChromaticAberrationPostProcess";
+ }, t._Parse = function(e, n, i, o) {
+ return w.a.Parse(function() {
+ return new t(e.name, e.screenWidth, e.screenHeight, e.options, n, e.renderTargetSamplingMode, i.getEngine(), e.reusable, e.textureType, !1);
+ }, e, i, o);
+ }, Object(u.c)([Object(w.c)()], t.prototype, "aberrationAmount", void 0), Object(u.c)([Object(w.c)()], t.prototype, "radialIntensity", void 0), Object(u.c)([Object(w.c)()], t.prototype, "direction", void 0), Object(u.c)([Object(w.c)()], t.prototype, "centerPosition", void 0), Object(u.c)([Object(w.c)()], t.prototype, "screenWidth", void 0), Object(u.c)([Object(w.c)()], t.prototype, "screenHeight", void 0), t;
+ }(_t);
+ x.a.RegisteredTypes["BABYLON.ChromaticAberrationPostProcess"] = Vu;
+ var pE = `
+uniform sampler2D depthSampler;
+
+varying vec2 vUV;
+
+uniform vec2 cameraMinMaxZ;
+
+uniform float focusDistance;
+uniform float cocPrecalculation;
+void main(void)
+{
+float depth=texture2D(depthSampler,vUV).r;
+float pixelDistance=(cameraMinMaxZ.x+(cameraMinMaxZ.y-cameraMinMaxZ.x)*depth)*1000.0;
+float coc=abs(cocPrecalculation* ((focusDistance-pixelDistance)/pixelDistance));
+coc=clamp(coc,0.0,1.0);
+gl_FragColor=vec4(coc,depth,coc,1.0);
+}
+`;
+ We.a.ShadersStore.circleOfConfusionPixelShader = pE;
+ var ku = function(r) {
+ function t(e, n, i, o, a, s, p, m, S) {
+ m === void 0 && (m = d.a.TEXTURETYPE_UNSIGNED_INT), S === void 0 && (S = !1);
+ var O = r.call(this, e, "circleOfConfusion", ["cameraMinMaxZ", "focusDistance", "cocPrecalculation"], ["depthSampler"], i, o, a, s, p, null, m, void 0, null, S) || this;
+ return O.lensSize = 50, O.fStop = 1.4, O.focusDistance = 2e3, O.focalLength = 50, O._depthTexture = null, O._depthTexture = n, O.onApplyObservable.add(function(I) {
+ if (O._depthTexture) {
+ I.setTexture("depthSampler", O._depthTexture);
+ var G = O.lensSize / O.fStop * O.focalLength / (O.focusDistance - O.focalLength);
+ I.setFloat("focusDistance", O.focusDistance), I.setFloat("cocPrecalculation", G), I.setFloat2("cameraMinMaxZ", O._depthTexture.activeCamera.minZ, O._depthTexture.activeCamera.maxZ);
+ } else
+ h.a.Warn("No depth texture set on CircleOfConfusionPostProcess");
+ }), O;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "CircleOfConfusionPostProcess";
+ }, Object.defineProperty(t.prototype, "depthTexture", { set: function(e) {
+ this._depthTexture = e;
+ }, enumerable: !1, configurable: !0 }), Object(u.c)([Object(w.c)()], t.prototype, "lensSize", void 0), Object(u.c)([Object(w.c)()], t.prototype, "fStop", void 0), Object(u.c)([Object(w.c)()], t.prototype, "focusDistance", void 0), Object(u.c)([Object(w.c)()], t.prototype, "focalLength", void 0), t;
+ }(_t);
+ x.a.RegisteredTypes["BABYLON.CircleOfConfusionPostProcess"] = ku;
+ var _E = `
+uniform sampler2D textureSampler;
+uniform sampler2D colorTable;
+
+varying vec2 vUV;
+
+const float SLICE_COUNT=16.0;
+
+vec4 sampleAs3DTexture(sampler2D textureSampler,vec3 uv,float width) {
+float sliceSize=1.0/width;
+float slicePixelSize=sliceSize/width;
+float sliceInnerSize=slicePixelSize*(width-1.0);
+float zSlice0=min(floor(uv.z*width),width-1.0);
+float zSlice1=min(zSlice0+1.0,width-1.0);
+float xOffset=slicePixelSize*0.5+uv.x*sliceInnerSize;
+float s0=xOffset+(zSlice0*sliceSize);
+float s1=xOffset+(zSlice1*sliceSize);
+vec4 slice0Color=texture2D(textureSampler,vec2(s0,uv.y));
+vec4 slice1Color=texture2D(textureSampler,vec2(s1,uv.y));
+float zOffset=mod(uv.z*width,1.0);
+vec4 result=mix(slice0Color,slice1Color,zOffset);
+return result;
+}
+void main(void)
+{
+vec4 screen_color=texture2D(textureSampler,vUV);
+gl_FragColor=sampleAs3DTexture(colorTable,screen_color.rgb,SLICE_COUNT);
+}`;
+ We.a.ShadersStore.colorCorrectionPixelShader = _E;
+ var D_ = function(r) {
+ function t(e, n, i, o, a, s, p) {
+ var m = r.call(this, e, "colorCorrection", null, ["colorTable"], i, o, a, s, p) || this;
+ return m._colorTableTexture = new Ue.a(n, o.getScene(), !0, !1, Ue.a.TRILINEAR_SAMPLINGMODE), m._colorTableTexture.anisotropicFilteringLevel = 1, m._colorTableTexture.wrapU = Ue.a.CLAMP_ADDRESSMODE, m._colorTableTexture.wrapV = Ue.a.CLAMP_ADDRESSMODE, m.colorTableUrl = n, m.onApply = function(S) {
+ S.setTexture("colorTable", m._colorTableTexture);
+ }, m;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "ColorCorrectionPostProcess";
+ }, t._Parse = function(e, n, i, o) {
+ return w.a.Parse(function() {
+ return new t(e.name, e.colorTableUrl, e.options, n, e.renderTargetSamplingMode, i.getEngine(), e.reusable);
+ }, e, i, o);
+ }, Object(u.c)([Object(w.c)()], t.prototype, "colorTableUrl", void 0), t;
+ }(_t);
+ x.a.RegisteredTypes["BABYLON.ColorCorrectionPostProcess"] = D_;
+ var mE = `
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+uniform vec2 screenSize;
+uniform float kernel[9];
+void main(void)
+{
+vec2 onePixel=vec2(1.0,1.0)/screenSize;
+vec4 colorSum =
+texture2D(textureSampler,vUV+onePixel*vec2(-1,-1))*kernel[0] +
+texture2D(textureSampler,vUV+onePixel*vec2(0,-1))*kernel[1] +
+texture2D(textureSampler,vUV+onePixel*vec2(1,-1))*kernel[2] +
+texture2D(textureSampler,vUV+onePixel*vec2(-1,0))*kernel[3] +
+texture2D(textureSampler,vUV+onePixel*vec2(0,0))*kernel[4] +
+texture2D(textureSampler,vUV+onePixel*vec2(1,0))*kernel[5] +
+texture2D(textureSampler,vUV+onePixel*vec2(-1,1))*kernel[6] +
+texture2D(textureSampler,vUV+onePixel*vec2(0,1))*kernel[7] +
+texture2D(textureSampler,vUV+onePixel*vec2(1,1))*kernel[8];
+float kernelWeight =
+kernel[0] +
+kernel[1] +
+kernel[2] +
+kernel[3] +
+kernel[4] +
+kernel[5] +
+kernel[6] +
+kernel[7] +
+kernel[8];
+if (kernelWeight<=0.0) {
+kernelWeight=1.0;
+}
+gl_FragColor=vec4((colorSum/kernelWeight).rgb,1);
+}`;
+ We.a.ShadersStore.convolutionPixelShader = mE;
+ var L_ = function(r) {
+ function t(e, n, i, o, a, s, p, m) {
+ m === void 0 && (m = d.a.TEXTURETYPE_UNSIGNED_INT);
+ var S = r.call(this, e, "convolution", ["kernel", "screenSize"], null, i, o, a, s, p, null, m) || this;
+ return S.kernel = n, S.onApply = function(O) {
+ O.setFloat2("screenSize", S.width, S.height), O.setArray("kernel", S.kernel);
+ }, S;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "ConvolutionPostProcess";
+ }, t._Parse = function(e, n, i, o) {
+ return w.a.Parse(function() {
+ return new t(e.name, e.kernel, e.options, n, e.renderTargetSamplingMode, i.getEngine(), e.reusable, e.textureType);
+ }, e, i, o);
+ }, t.EdgeDetect0Kernel = [1, 0, -1, 0, 0, 0, -1, 0, 1], t.EdgeDetect1Kernel = [0, 1, 0, 1, -4, 1, 0, 1, 0], t.EdgeDetect2Kernel = [-1, -1, -1, -1, 8, -1, -1, -1, -1], t.SharpenKernel = [0, -1, 0, -1, 5, -1, 0, -1, 0], t.EmbossKernel = [-2, -1, 0, -1, 1, 1, 0, 1, 2], t.GaussianKernel = [0, 1, 0, 1, 1, 1, 0, 1, 0], Object(u.c)([Object(w.c)()], t.prototype, "kernel", void 0), t;
+ }(_t);
+ x.a.RegisteredTypes["BABYLON.ConvolutionPostProcess"] = L_;
+ var ic = function(r) {
+ function t(e, n, i, o, a, s, p, m, S, O, I, G, k) {
+ m === void 0 && (m = null), S === void 0 && (S = Ue.a.BILINEAR_SAMPLINGMODE), G === void 0 && (G = d.a.TEXTURETYPE_UNSIGNED_INT), k === void 0 && (k = !1);
+ var K = r.call(this, e, i, o, a, s, S = d.a.TEXTURE_BILINEAR_SAMPLINGMODE, O, I, G = d.a.TEXTURETYPE_UNSIGNED_INT, `#define DOF 1\r
+`, k) || this;
+ return K.direction = i, K.onApplyObservable.add(function(re) {
+ m != null && re.setTextureFromPostProcess("textureSampler", m), re.setTextureFromPostProcessOutput("circleOfConfusionSampler", p), n.activeCamera && re.setFloat2("cameraMinMaxZ", n.activeCamera.minZ, n.activeCamera.maxZ);
+ }), K;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "DepthOfFieldBlurPostProcess";
+ }, Object(u.c)([Object(w.c)()], t.prototype, "direction", void 0), t;
+ }(xn);
+ x.a.RegisteredTypes["BABYLON.DepthOfFieldBlurPostProcess"] = ic;
+ var gE = `uniform sampler2D textureSampler;
+varying vec2 vUV;
+uniform sampler2D circleOfConfusionSampler;
+uniform sampler2D blurStep0;
+#if BLUR_LEVEL>0
+uniform sampler2D blurStep1;
+#endif
+#if BLUR_LEVEL>1
+uniform sampler2D blurStep2;
+#endif
+void main(void)
+{
+float coc=texture2D(circleOfConfusionSampler,vUV).r;
+#if BLUR_LEVEL == 0
+vec4 original=texture2D(textureSampler,vUV);
+vec4 blurred0=texture2D(blurStep0,vUV);
+gl_FragColor=mix(original,blurred0,coc);
+#endif
+#if BLUR_LEVEL == 1
+if(coc<0.5){
+vec4 original=texture2D(textureSampler,vUV);
+vec4 blurred1=texture2D(blurStep1,vUV);
+gl_FragColor=mix(original,blurred1,coc/0.5);
+}else{
+vec4 blurred0=texture2D(blurStep0,vUV);
+vec4 blurred1=texture2D(blurStep1,vUV);
+gl_FragColor=mix(blurred1,blurred0,(coc-0.5)/0.5);
+}
+#endif
+#if BLUR_LEVEL == 2
+if(coc<0.33){
+vec4 original=texture2D(textureSampler,vUV);
+vec4 blurred2=texture2D(blurStep2,vUV);
+gl_FragColor=mix(original,blurred2,coc/0.33);
+}else if(coc<0.66){
+vec4 blurred1=texture2D(blurStep1,vUV);
+vec4 blurred2=texture2D(blurStep2,vUV);
+gl_FragColor=mix(blurred2,blurred1,(coc-0.33)/0.33);
+}else{
+vec4 blurred0=texture2D(blurStep0,vUV);
+vec4 blurred1=texture2D(blurStep1,vUV);
+gl_FragColor=mix(blurred1,blurred0,(coc-0.66)/0.34);
+}
+#endif
+}
+`;
+ We.a.ShadersStore.depthOfFieldMergePixelShader = gE;
+ var qr, vE = function() {
+ }, w_ = function(r) {
+ function t(e, n, i, o, a, s, p, m, S, O, I) {
+ O === void 0 && (O = d.a.TEXTURETYPE_UNSIGNED_INT), I === void 0 && (I = !1);
+ var G = r.call(this, e, "depthOfFieldMerge", [], ["circleOfConfusionSampler", "blurStep0", "blurStep1", "blurStep2"], a, s, p, m, S, null, O, void 0, null, !0) || this;
+ return G.blurSteps = o, G.onApplyObservable.add(function(k) {
+ k.setTextureFromPostProcess("textureSampler", n), k.setTextureFromPostProcessOutput("circleOfConfusionSampler", i), o.forEach(function(K, re) {
+ k.setTextureFromPostProcessOutput("blurStep" + (o.length - re - 1), K);
+ });
+ }), I || G.updateEffect(), G;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "DepthOfFieldMergePostProcess";
+ }, t.prototype.updateEffect = function(e, n, i, o, a, s) {
+ e === void 0 && (e = null), n === void 0 && (n = null), i === void 0 && (i = null), e || (e = "", e += "#define BLUR_LEVEL " + (this.blurSteps.length - 1) + `
+`), r.prototype.updateEffect.call(this, e, n, i, o, a, s);
+ }, t;
+ }(_t);
+ (function(r) {
+ r[r.Low = 0] = "Low", r[r.Medium = 1] = "Medium", r[r.High = 2] = "High";
+ })(qr || (qr = {}));
+ var Gu = function(r) {
+ function t(e, n, i, o, a) {
+ i === void 0 && (i = qr.Low), o === void 0 && (o = 0), a === void 0 && (a = !1);
+ var s = r.call(this, e.getEngine(), "depth of field", function() {
+ return s._effects;
+ }, !0) || this;
+ s._effects = [], s._circleOfConfusion = new ku("circleOfConfusion", n, 1, null, Ue.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, o, a), s._depthOfFieldBlurY = [], s._depthOfFieldBlurX = [];
+ var p = 1, m = 15;
+ switch (i) {
+ case qr.High:
+ p = 3, m = 51;
+ break;
+ case qr.Medium:
+ p = 2, m = 31;
+ break;
+ default:
+ m = 15, p = 1;
+ }
+ for (var S = m / Math.pow(2, p - 1), O = 1, I = 0; I < p; I++) {
+ var G = new ic("verticle blur", e, new c.d(0, 1), S, O, null, s._circleOfConfusion, I == 0 ? s._circleOfConfusion : null, Ue.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, o, a);
+ G.autoClear = !1, O = 0.75 / Math.pow(2, I);
+ var k = new ic("horizontal blur", e, new c.d(1, 0), S, O, null, s._circleOfConfusion, null, Ue.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, o, a);
+ k.autoClear = !1, s._depthOfFieldBlurY.push(G), s._depthOfFieldBlurX.push(k);
+ }
+ for (s._effects = [s._circleOfConfusion], I = 0; I < s._depthOfFieldBlurX.length; I++)
+ s._effects.push(s._depthOfFieldBlurY[I]), s._effects.push(s._depthOfFieldBlurX[I]);
+ return s._dofMerge = new w_("dofMerge", s._circleOfConfusion, s._circleOfConfusion, s._depthOfFieldBlurX, O, null, Ue.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, o, a), s._dofMerge.autoClear = !1, s._effects.push(s._dofMerge), s;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "focalLength", { get: function() {
+ return this._circleOfConfusion.focalLength;
+ }, set: function(e) {
+ this._circleOfConfusion.focalLength = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "fStop", { get: function() {
+ return this._circleOfConfusion.fStop;
+ }, set: function(e) {
+ this._circleOfConfusion.fStop = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "focusDistance", { get: function() {
+ return this._circleOfConfusion.focusDistance;
+ }, set: function(e) {
+ this._circleOfConfusion.focusDistance = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "lensSize", { get: function() {
+ return this._circleOfConfusion.lensSize;
+ }, set: function(e) {
+ this._circleOfConfusion.lensSize = e;
+ }, enumerable: !1, configurable: !0 }), t.prototype.getClassName = function() {
+ return "DepthOfFieldEffect";
+ }, Object.defineProperty(t.prototype, "depthTexture", { set: function(e) {
+ this._circleOfConfusion.depthTexture = e;
+ }, enumerable: !1, configurable: !0 }), t.prototype.disposeEffects = function(e) {
+ for (var n = 0; n < this._effects.length; n++)
+ this._effects[n].dispose(e);
+ }, t.prototype._updateEffects = function() {
+ for (var e = 0; e < this._effects.length; e++)
+ this._effects[e].updateEffect();
+ }, t.prototype._isReady = function() {
+ for (var e = 0; e < this._effects.length; e++)
+ if (!this._effects[e].isReady())
+ return !1;
+ return !0;
+ }, t;
+ }(Ot), bE = `
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+uniform sampler2D passSampler;
+void main(void)
+{
+gl_FragColor=texture2D(passSampler,vUV);
+}`;
+ We.a.ShadersStore.displayPassPixelShader = bE;
+ var N_ = function(r) {
+ function t(e, n, i, o, a, s) {
+ return r.call(this, e, "displayPass", ["passSampler"], ["passSampler"], n, i, o, a, s) || this;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "DisplayPassPostProcess";
+ }, t._Parse = function(e, n, i, o) {
+ return w.a.Parse(function() {
+ return new t(e.name, e.options, n, e.renderTargetSamplingMode, i.getEngine(), e.reusable);
+ }, e, i, o);
+ }, t;
+ }(_t);
+ x.a.RegisteredTypes["BABYLON.DisplayPassPostProcess"] = N_;
+ var yE = `
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+uniform mat4 kernelMatrix;
+void main(void)
+{
+vec3 baseColor=texture2D(textureSampler,vUV).rgb;
+vec3 updatedColor=(kernelMatrix*vec4(baseColor,1.0)).rgb;
+gl_FragColor=vec4(updatedColor,1.0);
+}`;
+ We.a.ShadersStore.filterPixelShader = yE;
+ var F_ = function(r) {
+ function t(e, n, i, o, a, s, p) {
+ var m = r.call(this, e, "filter", ["kernelMatrix"], null, i, o, a, s, p) || this;
+ return m.kernelMatrix = n, m.onApply = function(S) {
+ S.setMatrix("kernelMatrix", m.kernelMatrix);
+ }, m;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "FilterPostProcess";
+ }, t._Parse = function(e, n, i, o) {
+ return w.a.Parse(function() {
+ return new t(e.name, e.kernelMatrix, e.options, n, e.renderTargetSamplingMode, i.getEngine(), e.reusable);
+ }, e, i, o);
+ }, Object(u.c)([Object(w.j)()], t.prototype, "kernelMatrix", void 0), t;
+ }(_t);
+ x.a.RegisteredTypes["BABYLON.FilterPostProcess"] = F_;
+ var EE = `uniform sampler2D textureSampler;
+uniform vec2 texelSize;
+varying vec2 vUV;
+varying vec2 sampleCoordS;
+varying vec2 sampleCoordE;
+varying vec2 sampleCoordN;
+varying vec2 sampleCoordW;
+varying vec2 sampleCoordNW;
+varying vec2 sampleCoordSE;
+varying vec2 sampleCoordNE;
+varying vec2 sampleCoordSW;
+const float fxaaQualitySubpix=1.0;
+const float fxaaQualityEdgeThreshold=0.166;
+const float fxaaQualityEdgeThresholdMin=0.0833;
+const vec3 kLumaCoefficients=vec3(0.2126,0.7152,0.0722);
+#define FxaaLuma(rgba) dot(rgba.rgb,kLumaCoefficients)
+void main(){
+vec2 posM;
+posM.x=vUV.x;
+posM.y=vUV.y;
+vec4 rgbyM=texture2D(textureSampler,vUV,0.0);
+float lumaM=FxaaLuma(rgbyM);
+float lumaS=FxaaLuma(texture2D(textureSampler,sampleCoordS,0.0));
+float lumaE=FxaaLuma(texture2D(textureSampler,sampleCoordE,0.0));
+float lumaN=FxaaLuma(texture2D(textureSampler,sampleCoordN,0.0));
+float lumaW=FxaaLuma(texture2D(textureSampler,sampleCoordW,0.0));
+float maxSM=max(lumaS,lumaM);
+float minSM=min(lumaS,lumaM);
+float maxESM=max(lumaE,maxSM);
+float minESM=min(lumaE,minSM);
+float maxWN=max(lumaN,lumaW);
+float minWN=min(lumaN,lumaW);
+float rangeMax=max(maxWN,maxESM);
+float rangeMin=min(minWN,minESM);
+float rangeMaxScaled=rangeMax*fxaaQualityEdgeThreshold;
+float range=rangeMax-rangeMin;
+float rangeMaxClamped=max(fxaaQualityEdgeThresholdMin,rangeMaxScaled);
+#ifndef MALI
+if(range=edgeVert;
+float subpixA=subpixNSWE*2.0+subpixNWSWNESE;
+if (!horzSpan)
+{
+lumaN=lumaW;
+}
+if (!horzSpan)
+{
+lumaS=lumaE;
+}
+if (horzSpan)
+{
+lengthSign=texelSize.y;
+}
+float subpixB=(subpixA*(1.0/12.0))-lumaM;
+float gradientN=lumaN-lumaM;
+float gradientS=lumaS-lumaM;
+float lumaNN=lumaN+lumaM;
+float lumaSS=lumaS+lumaM;
+bool pairN=abs(gradientN)>=abs(gradientS);
+float gradient=max(abs(gradientN),abs(gradientS));
+if (pairN)
+{
+lengthSign=-lengthSign;
+}
+float subpixC=clamp(abs(subpixB)*subpixRcpRange,0.0,1.0);
+vec2 posB;
+posB.x=posM.x;
+posB.y=posM.y;
+vec2 offNP;
+offNP.x=(!horzSpan) ? 0.0 : texelSize.x;
+offNP.y=(horzSpan) ? 0.0 : texelSize.y;
+if (!horzSpan)
+{
+posB.x+=lengthSign*0.5;
+}
+if (horzSpan)
+{
+posB.y+=lengthSign*0.5;
+}
+vec2 posN;
+posN.x=posB.x-offNP.x*1.5;
+posN.y=posB.y-offNP.y*1.5;
+vec2 posP;
+posP.x=posB.x+offNP.x*1.5;
+posP.y=posB.y+offNP.y*1.5;
+float subpixD=((-2.0)*subpixC)+3.0;
+float lumaEndN=FxaaLuma(texture2D(textureSampler,posN,0.0));
+float subpixE=subpixC*subpixC;
+float lumaEndP=FxaaLuma(texture2D(textureSampler,posP,0.0));
+if (!pairN)
+{
+lumaNN=lumaSS;
+}
+float gradientScaled=gradient*1.0/4.0;
+float lumaMM=lumaM-lumaNN*0.5;
+float subpixF=subpixD*subpixE;
+bool lumaMLTZero=lumaMM<0.0;
+lumaEndN-=lumaNN*0.5;
+lumaEndP-=lumaNN*0.5;
+bool doneN=abs(lumaEndN)>=gradientScaled;
+bool doneP=abs(lumaEndP)>=gradientScaled;
+if (!doneN)
+{
+posN.x-=offNP.x*3.0;
+}
+if (!doneN)
+{
+posN.y-=offNP.y*3.0;
+}
+bool doneNP=(!doneN) || (!doneP);
+if (!doneP)
+{
+posP.x+=offNP.x*3.0;
+}
+if (!doneP)
+{
+posP.y+=offNP.y*3.0;
+}
+if (doneNP)
+{
+if (!doneN) lumaEndN=FxaaLuma(texture2D(textureSampler,posN.xy,0.0));
+if (!doneP) lumaEndP=FxaaLuma(texture2D(textureSampler,posP.xy,0.0));
+if (!doneN) lumaEndN=lumaEndN-lumaNN*0.5;
+if (!doneP) lumaEndP=lumaEndP-lumaNN*0.5;
+doneN=abs(lumaEndN)>=gradientScaled;
+doneP=abs(lumaEndP)>=gradientScaled;
+if (!doneN) posN.x-=offNP.x*12.0;
+if (!doneN) posN.y-=offNP.y*12.0;
+doneNP=(!doneN) || (!doneP);
+if (!doneP) posP.x+=offNP.x*12.0;
+if (!doneP) posP.y+=offNP.y*12.0;
+}
+float dstN=posM.x-posN.x;
+float dstP=posP.x-posM.x;
+if (!horzSpan)
+{
+dstN=posM.y-posN.y;
+}
+if (!horzSpan)
+{
+dstP=posP.y-posM.y;
+}
+bool goodSpanN=(lumaEndN<0.0) != lumaMLTZero;
+float spanLength=(dstP+dstN);
+bool goodSpanP=(lumaEndP<0.0) != lumaMLTZero;
+float spanLengthRcp=1.0/spanLength;
+bool directionN=dstN -1 ? `#define MALI 1
+` : null;
+ }, t._Parse = function(e, n, i, o) {
+ return w.a.Parse(function() {
+ return new t(e.name, e.options, n, e.renderTargetSamplingMode, i.getEngine(), e.reusable);
+ }, e, i, o);
+ }, t;
+ }(_t);
+ x.a.RegisteredTypes["BABYLON.FxaaPostProcess"] = Ha;
+ var SE = `#include
+
+uniform sampler2D textureSampler;
+
+uniform float intensity;
+uniform float animatedSeed;
+
+varying vec2 vUV;
+void main(void)
+{
+gl_FragColor=texture2D(textureSampler,vUV);
+vec2 seed=vUV*(animatedSeed);
+float grain=dither(seed,intensity);
+
+float lum=getLuminance(gl_FragColor.rgb);
+float grainAmount=(cos(-PI+(lum*PI*2.))+1.)/2.;
+gl_FragColor.rgb+=grain*grainAmount;
+gl_FragColor.rgb=max(gl_FragColor.rgb,0.0);
+}`;
+ We.a.ShadersStore.grainPixelShader = SE;
+ var zu = function(r) {
+ function t(e, n, i, o, a, s, p, m) {
+ p === void 0 && (p = d.a.TEXTURETYPE_UNSIGNED_INT), m === void 0 && (m = !1);
+ var S = r.call(this, e, "grain", ["intensity", "animatedSeed"], [], n, i, o, a, s, null, p, void 0, null, m) || this;
+ return S.intensity = 30, S.animated = !1, S.onApplyObservable.add(function(O) {
+ O.setFloat("intensity", S.intensity), O.setFloat("animatedSeed", S.animated ? Math.random() + 1 : 1);
+ }), S;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "GrainPostProcess";
+ }, t._Parse = function(e, n, i, o) {
+ return w.a.Parse(function() {
+ return new t(e.name, e.options, n, e.renderTargetSamplingMode, i.getEngine(), e.reusable);
+ }, e, i, o);
+ }, Object(u.c)([Object(w.c)()], t.prototype, "intensity", void 0), Object(u.c)([Object(w.c)()], t.prototype, "animated", void 0), t;
+ }(_t);
+ x.a.RegisteredTypes["BABYLON.GrainPostProcess"] = zu;
+ var AE = `
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+const vec3 RGBLuminanceCoefficients=vec3(0.2126,0.7152,0.0722);
+void main(void)
+{
+vec4 tex=texture2D(textureSampler,vUV);
+vec3 c=tex.rgb;
+float luma=dot(c.rgb,RGBLuminanceCoefficients);
+
+
+gl_FragColor=vec4(pow(c,vec3(25.0-luma*15.0)),tex.a);
+}`;
+ We.a.ShadersStore.highlightsPixelShader = AE;
+ var PE = function(r) {
+ function t(e, n, i, o, a, s, p) {
+ return p === void 0 && (p = d.a.TEXTURETYPE_UNSIGNED_INT), r.call(this, e, "highlights", null, null, n, i, o, a, s, null, p) || this;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "HighlightsPostProcess";
+ }, t;
+ }(_t);
+ We.a.IncludesShadersStore.mrtFragmentDeclaration = `#if __VERSION__>=200
+layout(location=0) out vec4 glFragData[{X}];
+#endif
+`;
+ var CE = `#extension GL_EXT_draw_buffers : require
+#if defined(BUMP) || !defined(NORMAL)
+#extension GL_OES_standard_derivatives : enable
+#endif
+precision highp float;
+precision highp int;
+#ifdef BUMP
+varying mat4 vWorldView;
+varying vec3 vNormalW;
+#else
+varying vec3 vNormalV;
+#endif
+varying vec4 vViewPos;
+#if defined(POSITION) || defined(BUMP)
+varying vec3 vPositionW;
+#endif
+#ifdef VELOCITY
+varying vec4 vCurrentPosition;
+varying vec4 vPreviousPosition;
+#endif
+#ifdef NEED_UV
+varying vec2 vUV;
+#endif
+#ifdef BUMP
+uniform vec3 vBumpInfos;
+uniform vec2 vTangentSpaceParams;
+#endif
+#ifdef REFLECTIVITY
+varying vec2 vReflectivityUV;
+uniform sampler2D reflectivitySampler;
+#endif
+#ifdef ALPHATEST
+uniform sampler2D diffuseSampler;
+#endif
+#include[RENDER_TARGET_COUNT]
+#include
+#include
+void main() {
+#ifdef ALPHATEST
+if (texture2D(diffuseSampler,vUV).a<0.4)
+discard;
+#endif
+vec3 normalOutput;
+#ifdef BUMP
+vec3 normalW=normalize(vNormalW);
+#include
+normalOutput=normalize(vec3(vWorldView*vec4(normalW,0.0)));
+#else
+normalOutput=normalize(vNormalV);
+#endif
+#ifdef PREPASS
+#ifdef PREPASS_DEPTHNORMAL
+gl_FragData[DEPTHNORMAL_INDEX]=vec4(vViewPos.z/vViewPos.w,normalOutput);
+#endif
+#else
+gl_FragData[0]=vec4(vViewPos.z/vViewPos.w,0.0,0.0,1.0);
+gl_FragData[1]=vec4(normalOutput,1.0);
+#endif
+#ifdef POSITION
+gl_FragData[POSITION_INDEX]=vec4(vPositionW,1.0);
+#endif
+#ifdef VELOCITY
+vec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;
+vec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;
+vec2 velocity=abs(a-b);
+velocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;
+gl_FragData[VELOCITY_INDEX]=vec4(velocity,0.0,1.0);
+#endif
+#ifdef REFLECTIVITY
+#ifdef HAS_SPECULAR
+
+vec4 reflectivity=texture2D(reflectivitySampler,vReflectivityUV);
+#elif HAS_REFLECTIVITY
+
+vec4 reflectivity=vec4(texture2D(reflectivitySampler,vReflectivityUV).rgb,1.0);
+#else
+vec4 reflectivity=vec4(0.0,0.0,0.0,1.0);
+#endif
+gl_FragData[REFLECTIVITY_INDEX]=reflectivity;
+#endif
+}`;
+ We.a.ShadersStore.geometryPixelShader = CE;
+ var xE = `precision highp float;
+precision highp int;
+#include
+#include
+#include[0..maxSimultaneousMorphTargets]
+#include
+attribute vec3 position;
+attribute vec3 normal;
+#ifdef NEED_UV
+varying vec2 vUV;
+#ifdef ALPHATEST
+uniform mat4 diffuseMatrix;
+#endif
+#ifdef BUMP
+uniform mat4 bumpMatrix;
+varying vec2 vBumpUV;
+#endif
+#ifdef REFLECTIVITY
+uniform mat4 reflectivityMatrix;
+varying vec2 vReflectivityUV;
+#endif
+#ifdef UV1
+attribute vec2 uv;
+#endif
+#ifdef UV2
+attribute vec2 uv2;
+#endif
+#endif
+
+uniform mat4 viewProjection;
+uniform mat4 view;
+#ifdef BUMP
+varying mat4 vWorldView;
+#endif
+#ifdef BUMP
+varying vec3 vNormalW;
+#else
+varying vec3 vNormalV;
+#endif
+varying vec4 vViewPos;
+#if defined(POSITION) || defined(BUMP)
+varying vec3 vPositionW;
+#endif
+#ifdef VELOCITY
+uniform mat4 previousWorld;
+uniform mat4 previousViewProjection;
+#ifdef BONES_VELOCITY_ENABLED
+#if NUM_BONE_INFLUENCERS>0
+uniform mat4 mPreviousBones[BonesPerMesh];
+#endif
+#endif
+varying vec4 vCurrentPosition;
+varying vec4 vPreviousPosition;
+#endif
+void main(void)
+{
+vec3 positionUpdated=position;
+vec3 normalUpdated=normal;
+#ifdef UV1
+vec2 uvUpdated=uv;
+#endif
+#include[0..maxSimultaneousMorphTargets]
+#include
+#if defined(VELOCITY) && !defined(BONES_VELOCITY_ENABLED)
+
+vCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);
+vPreviousPosition=previousViewProjection*previousWorld*vec4(positionUpdated,1.0);
+#endif
+#include
+vec4 pos=vec4(finalWorld*vec4(positionUpdated,1.0));
+#ifdef BUMP
+vWorldView=view*finalWorld;
+vNormalW=normalUpdated;
+#else
+vNormalV=normalize(vec3((view*finalWorld)*vec4(normalUpdated,0.0)));
+#endif
+vViewPos=view*pos;
+#if defined(VELOCITY) && defined(BONES_VELOCITY_ENABLED)
+vCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);
+#if NUM_BONE_INFLUENCERS>0
+mat4 previousInfluence;
+previousInfluence=mPreviousBones[int(matricesIndices[0])]*matricesWeights[0];
+#if NUM_BONE_INFLUENCERS>1
+previousInfluence+=mPreviousBones[int(matricesIndices[1])]*matricesWeights[1];
+#endif
+#if NUM_BONE_INFLUENCERS>2
+previousInfluence+=mPreviousBones[int(matricesIndices[2])]*matricesWeights[2];
+#endif
+#if NUM_BONE_INFLUENCERS>3
+previousInfluence+=mPreviousBones[int(matricesIndices[3])]*matricesWeights[3];
+#endif
+#if NUM_BONE_INFLUENCERS>4
+previousInfluence+=mPreviousBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];
+#endif
+#if NUM_BONE_INFLUENCERS>5
+previousInfluence+=mPreviousBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];
+#endif
+#if NUM_BONE_INFLUENCERS>6
+previousInfluence+=mPreviousBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];
+#endif
+#if NUM_BONE_INFLUENCERS>7
+previousInfluence+=mPreviousBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];
+#endif
+vPreviousPosition=previousViewProjection*previousWorld*previousInfluence*vec4(positionUpdated,1.0);
+#else
+vPreviousPosition=previousViewProjection*previousWorld*vec4(positionUpdated,1.0);
+#endif
+#endif
+#if defined(POSITION) || defined(BUMP)
+vPositionW=pos.xyz/pos.w;
+#endif
+gl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);
+#ifdef NEED_UV
+#ifdef UV1
+#ifdef ALPHATEST
+vUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));
+#else
+vUV=uv;
+#endif
+#ifdef BUMP
+vBumpUV=vec2(bumpMatrix*vec4(uvUpdated,1.0,0.0));
+#endif
+#ifdef REFLECTIVITY
+vReflectivityUV=vec2(reflectivityMatrix*vec4(uvUpdated,1.0,0.0));
+#endif
+#endif
+#ifdef UV2
+#ifdef ALPHATEST
+vUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));
+#else
+vUV=uv2;
+#endif
+#ifdef BUMP
+vBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));
+#endif
+#ifdef REFLECTIVITY
+vReflectivityUV=vec2(reflectivityMatrix*vec4(uv2,1.0,0.0));
+#endif
+#endif
+#endif
+#include
+}
+`;
+ We.a.ShadersStore.geometryVertexShader = xE;
+ var Oi = function() {
+ function r(t, e) {
+ e === void 0 && (e = 1), this._previousTransformationMatrices = {}, this._previousBonesTransformationMatrices = {}, this.excludedSkinnedMeshesFromVelocity = [], this.renderTransparentMeshes = !0, this._resizeObserver = null, this._enablePosition = !1, this._enableVelocity = !1, this._enableReflectivity = !1, this._positionIndex = -1, this._velocityIndex = -1, this._reflectivityIndex = -1, this._depthNormalIndex = -1, this._linkedWithPrePass = !1, this._scene = t, this._ratio = e, r._SceneComponentInitialization(this._scene), this._createRenderTargets();
+ }
+ return r.prototype._linkPrePassRenderer = function(t) {
+ this._linkedWithPrePass = !0, this._prePassRenderer = t, this._multiRenderTarget && (this._multiRenderTarget.onClearObservable.clear(), this._multiRenderTarget.onClearObservable.add(function(e) {
+ }));
+ }, r.prototype._unlinkPrePassRenderer = function() {
+ this._linkedWithPrePass = !1, this._createRenderTargets();
+ }, r.prototype._resetLayout = function() {
+ this._enablePosition = !1, this._enableReflectivity = !1, this._enableVelocity = !1, this._attachments = [];
+ }, r.prototype._forceTextureType = function(t, e) {
+ t === r.POSITION_TEXTURE_TYPE ? (this._positionIndex = e, this._enablePosition = !0) : t === r.VELOCITY_TEXTURE_TYPE ? (this._velocityIndex = e, this._enableVelocity = !0) : t === r.REFLECTIVITY_TEXTURE_TYPE ? (this._reflectivityIndex = e, this._enableReflectivity = !0) : t === r.DEPTHNORMAL_TEXTURE_TYPE && (this._depthNormalIndex = e);
+ }, r.prototype._setAttachments = function(t) {
+ this._attachments = t;
+ }, r.prototype._linkInternalTexture = function(t) {
+ this._multiRenderTarget._texture = t;
+ }, Object.defineProperty(r.prototype, "renderList", { get: function() {
+ return this._multiRenderTarget.renderList;
+ }, set: function(t) {
+ this._multiRenderTarget.renderList = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "isSupported", { get: function() {
+ return this._multiRenderTarget.isSupported;
+ }, enumerable: !1, configurable: !0 }), r.prototype.getTextureIndex = function(t) {
+ switch (t) {
+ case r.POSITION_TEXTURE_TYPE:
+ return this._positionIndex;
+ case r.VELOCITY_TEXTURE_TYPE:
+ return this._velocityIndex;
+ case r.REFLECTIVITY_TEXTURE_TYPE:
+ return this._reflectivityIndex;
+ default:
+ return -1;
+ }
+ }, Object.defineProperty(r.prototype, "enablePosition", { get: function() {
+ return this._enablePosition;
+ }, set: function(t) {
+ this._enablePosition = t, this._linkedWithPrePass || (this.dispose(), this._createRenderTargets());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "enableVelocity", { get: function() {
+ return this._enableVelocity;
+ }, set: function(t) {
+ this._enableVelocity = t, t || (this._previousTransformationMatrices = {}), this._linkedWithPrePass || (this.dispose(), this._createRenderTargets());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "enableReflectivity", { get: function() {
+ return this._enableReflectivity;
+ }, set: function(t) {
+ this._enableReflectivity = t, this._linkedWithPrePass || (this.dispose(), this._createRenderTargets());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "scene", { get: function() {
+ return this._scene;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "ratio", { get: function() {
+ return this._ratio;
+ }, enumerable: !1, configurable: !0 }), r.prototype.isReady = function(t, e) {
+ var n = t.getMaterial();
+ if (n && n.disableDepthWrite)
+ return !1;
+ var i = [], o = [De.b.PositionKind, De.b.NormalKind], a = t.getMesh();
+ if (n) {
+ var s = !1;
+ n.needAlphaTesting() && (i.push("#define ALPHATEST"), s = !0), n.bumpTexture && kt.a.BumpTextureEnabled && (i.push("#define BUMP"), i.push("#define BUMPDIRECTUV 0"), s = !0), this._enableReflectivity && (n instanceof kt.a && n.specularTexture ? (i.push("#define HAS_SPECULAR"), s = !0) : n instanceof Ca && n.reflectivityTexture && (i.push("#define HAS_REFLECTIVITY"), s = !0)), s && (i.push("#define NEED_UV"), a.isVerticesDataPresent(De.b.UVKind) && (o.push(De.b.UVKind), i.push("#define UV1")), a.isVerticesDataPresent(De.b.UV2Kind) && (o.push(De.b.UV2Kind), i.push("#define UV2")));
+ }
+ this._linkedWithPrePass && (i.push("#define PREPASS"), this._depthNormalIndex !== -1 && (i.push("#define DEPTHNORMAL_INDEX " + this._depthNormalIndex), i.push("#define PREPASS_DEPTHNORMAL"))), this._enablePosition && (i.push("#define POSITION"), i.push("#define POSITION_INDEX " + this._positionIndex)), this._enableVelocity && (i.push("#define VELOCITY"), i.push("#define VELOCITY_INDEX " + this._velocityIndex), this.excludedSkinnedMeshesFromVelocity.indexOf(a) === -1 && i.push("#define BONES_VELOCITY_ENABLED")), this._enableReflectivity && (i.push("#define REFLECTIVITY"), i.push("#define REFLECTIVITY_INDEX " + this._reflectivityIndex)), a.useBones && a.computeBonesUsingShaders ? (o.push(De.b.MatricesIndicesKind), o.push(De.b.MatricesWeightsKind), a.numBoneInfluencers > 4 && (o.push(De.b.MatricesIndicesExtraKind), o.push(De.b.MatricesWeightsExtraKind)), i.push("#define NUM_BONE_INFLUENCERS " + a.numBoneInfluencers), i.push("#define BonesPerMesh " + (a.skeleton ? a.skeleton.bones.length + 1 : 0))) : i.push("#define NUM_BONE_INFLUENCERS 0");
+ var p = a.morphTargetManager, m = 0;
+ p && p.numInfluencers > 0 && (m = p.numInfluencers, i.push("#define MORPHTARGETS"), i.push("#define NUM_MORPH_INFLUENCERS " + m), tt.a.PrepareAttributesForMorphTargetsInfluencers(o, a, m)), e && (i.push("#define INSTANCES"), tt.a.PushAttributesForInstances(o), t.getRenderingMesh().hasThinInstances && i.push("#define THIN_INSTANCES")), this._linkedWithPrePass ? i.push("#define RENDER_TARGET_COUNT " + this._attachments.length) : i.push("#define RENDER_TARGET_COUNT " + this._multiRenderTarget.textures.length);
+ var S = i.join(`
+`);
+ return this._cachedDefines !== S && (this._cachedDefines = S, this._effect = this._scene.getEngine().createEffect("geometry", o, ["world", "mBones", "viewProjection", "diffuseMatrix", "view", "previousWorld", "previousViewProjection", "mPreviousBones", "morphTargetInfluences", "bumpMatrix", "reflectivityMatrix", "vTangentSpaceParams", "vBumpInfos"], ["diffuseSampler", "bumpSampler", "reflectivitySampler"], S, void 0, void 0, void 0, { buffersCount: this._multiRenderTarget.textures.length - 1, maxSimultaneousMorphTargets: m })), this._effect.isReady();
+ }, r.prototype.getGBuffer = function() {
+ return this._multiRenderTarget;
+ }, Object.defineProperty(r.prototype, "samples", { get: function() {
+ return this._multiRenderTarget.samples;
+ }, set: function(t) {
+ this._multiRenderTarget.samples = t;
+ }, enumerable: !1, configurable: !0 }), r.prototype.dispose = function() {
+ this._resizeObserver && (this._scene.getEngine().onResizeObservable.remove(this._resizeObserver), this._resizeObserver = null), this.getGBuffer().dispose();
+ }, r.prototype._assignRenderTargetIndices = function() {
+ var t = 2;
+ return this._enablePosition && (this._positionIndex = t, t++), this._enableVelocity && (this._velocityIndex = t, t++), this._enableReflectivity && (this._reflectivityIndex = t, t++), t;
+ }, r.prototype._createRenderTargets = function() {
+ var t = this, e = this._scene.getEngine(), n = this._assignRenderTargetIndices();
+ if (this._multiRenderTarget = new Jl("gBuffer", { width: e.getRenderWidth() * this._ratio, height: e.getRenderHeight() * this._ratio }, n, this._scene, { generateMipMaps: !1, generateDepthTexture: !0, defaultType: d.a.TEXTURETYPE_FLOAT }), this.isSupported) {
+ this._multiRenderTarget.wrapU = Ue.a.CLAMP_ADDRESSMODE, this._multiRenderTarget.wrapV = Ue.a.CLAMP_ADDRESSMODE, this._multiRenderTarget.refreshRate = 1, this._multiRenderTarget.renderParticles = !1, this._multiRenderTarget.renderList = null, this._multiRenderTarget.onClearObservable.add(function(o) {
+ o.clear(new C.b(0, 0, 0, 1), !0, !0, !0);
+ }), this._resizeObserver = e.onResizeObservable.add(function() {
+ t._multiRenderTarget && t._multiRenderTarget.resize({ width: e.getRenderWidth() * t._ratio, height: e.getRenderHeight() * t._ratio });
+ });
+ var i = function(o) {
+ var a = o.getRenderingMesh(), s = o.getEffectiveMesh(), p = t._scene, m = p.getEngine(), S = o.getMaterial();
+ if (S) {
+ if (s._internalAbstractMeshDataInfo._isActiveIntermediate = !1, t._enableVelocity && !t._previousTransformationMatrices[s.uniqueId] && (t._previousTransformationMatrices[s.uniqueId] = { world: c.a.Identity(), viewProjection: p.getTransformMatrix() }, a.skeleton)) {
+ var O = a.skeleton.getTransformMatrices(a);
+ t._previousBonesTransformationMatrices[a.uniqueId] = t._copyBonesTransformationMatrices(O, new Float32Array(O.length));
+ }
+ var I = a._getInstancesRenderList(o._id, !!o.getReplacementMesh());
+ if (!I.mustReturn) {
+ var G = m.getCaps().instancedArrays && (I.visibleInstances[o._id] !== null || a.hasThinInstances), k = s.getWorldMatrix();
+ if (t.isReady(o, G)) {
+ if (m.enableEffect(t._effect), a._bind(o, t._effect, S.fillMode), t._effect.setMatrix("viewProjection", p.getTransformMatrix()), t._effect.setMatrix("view", p.getViewMatrix()), S) {
+ var K, re = s._instanceDataStorage;
+ if (re.isFrozen || !S.backFaceCulling && S.overrideMaterialSideOrientation === null)
+ K = re.sideOrientation;
+ else {
+ var se = s._getWorldMatrixDeterminant();
+ (K = S.overrideMaterialSideOrientation) == null && (K = S.sideOrientation), se < 0 && (K = K === Zt.a.ClockWiseSideOrientation ? Zt.a.CounterClockWiseSideOrientation : Zt.a.ClockWiseSideOrientation);
+ }
+ if (S._preBind(t._effect, K), S.needAlphaTesting()) {
+ var ue = S.getAlphaTestTexture();
+ ue && (t._effect.setTexture("diffuseSampler", ue), t._effect.setMatrix("diffuseMatrix", ue.getTextureMatrix()));
+ }
+ S.bumpTexture && p.getEngine().getCaps().standardDerivatives && kt.a.BumpTextureEnabled && (t._effect.setFloat3("vBumpInfos", S.bumpTexture.coordinatesIndex, 1 / S.bumpTexture.level, S.parallaxScaleBias), t._effect.setMatrix("bumpMatrix", S.bumpTexture.getTextureMatrix()), t._effect.setTexture("bumpSampler", S.bumpTexture), t._effect.setFloat2("vTangentSpaceParams", S.invertNormalMapX ? -1 : 1, S.invertNormalMapY ? -1 : 1)), t._enableReflectivity && (S instanceof kt.a && S.specularTexture ? (t._effect.setMatrix("reflectivityMatrix", S.specularTexture.getTextureMatrix()), t._effect.setTexture("reflectivitySampler", S.specularTexture)) : S instanceof Ca && S.reflectivityTexture && (t._effect.setMatrix("reflectivityMatrix", S.reflectivityTexture.getTextureMatrix()), t._effect.setTexture("reflectivitySampler", S.reflectivityTexture)));
+ }
+ a.useBones && a.computeBonesUsingShaders && a.skeleton && (t._effect.setMatrices("mBones", a.skeleton.getTransformMatrices(a)), t._enableVelocity && t._effect.setMatrices("mPreviousBones", t._previousBonesTransformationMatrices[a.uniqueId])), tt.a.BindMorphTargetParameters(a, t._effect), t._enableVelocity && (t._effect.setMatrix("previousWorld", t._previousTransformationMatrices[s.uniqueId].world), t._effect.setMatrix("previousViewProjection", t._previousTransformationMatrices[s.uniqueId].viewProjection)), a._processRendering(s, o, t._effect, S.fillMode, I, G, function(he, pe) {
+ return t._effect.setMatrix("world", pe);
+ });
+ }
+ t._enableVelocity && (t._previousTransformationMatrices[s.uniqueId].world = k.clone(), t._previousTransformationMatrices[s.uniqueId].viewProjection = t._scene.getTransformMatrix().clone(), a.skeleton && t._copyBonesTransformationMatrices(a.skeleton.getTransformMatrices(a), t._previousBonesTransformationMatrices[s.uniqueId]));
+ }
+ }
+ };
+ this._multiRenderTarget.customRenderFunction = function(o, a, s, p) {
+ var m;
+ if (t._linkedWithPrePass) {
+ if (!t._prePassRenderer.enabled)
+ return;
+ t._scene.getEngine().bindAttachments(t._attachments);
+ }
+ if (p.length) {
+ for (e.setColorWrite(!1), m = 0; m < p.length; m++)
+ i(p.data[m]);
+ e.setColorWrite(!0);
+ }
+ for (m = 0; m < o.length; m++)
+ i(o.data[m]);
+ for (m = 0; m < a.length; m++)
+ i(a.data[m]);
+ if (t.renderTransparentMeshes)
+ for (m = 0; m < s.length; m++)
+ i(s.data[m]);
+ };
+ }
+ }, r.prototype._copyBonesTransformationMatrices = function(t, e) {
+ for (var n = 0; n < t.length; n++)
+ e[n] = t[n];
+ return e;
+ }, r.DEPTHNORMAL_TEXTURE_TYPE = 0, r.POSITION_TEXTURE_TYPE = 1, r.VELOCITY_TEXTURE_TYPE = 2, r.REFLECTIVITY_TEXTURE_TYPE = 3, r._SceneComponentInitialization = function(t) {
+ throw Nn.a.WarnImport("GeometryBufferRendererSceneComponent");
+ }, r;
+ }(), RE = function() {
+ this.enabled = !1, this.name = "motionBlur", this.texturesRequired = [d.a.PREPASS_VELOCITY_TEXTURE_TYPE];
+ };
+ Object.defineProperty(ge.a.prototype, "geometryBufferRenderer", { get: function() {
+ this._geometryBufferRenderer;
+ }, set: function(r) {
+ r && r.isSupported && (this._geometryBufferRenderer = r);
+ }, enumerable: !0, configurable: !0 }), ge.a.prototype.enableGeometryBufferRenderer = function(r) {
+ return r === void 0 && (r = 1), this._geometryBufferRenderer || (this._geometryBufferRenderer = new Oi(this, r), this._geometryBufferRenderer.isSupported || (this._geometryBufferRenderer = null)), this._geometryBufferRenderer;
+ }, ge.a.prototype.disableGeometryBufferRenderer = function() {
+ this._geometryBufferRenderer && (this._geometryBufferRenderer.dispose(), this._geometryBufferRenderer = null);
+ };
+ var B_ = function() {
+ function r(t) {
+ this.name = st.a.NAME_GEOMETRYBUFFERRENDERER, this.scene = t;
+ }
+ return r.prototype.register = function() {
+ this.scene._gatherRenderTargetsStage.registerStep(st.a.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER, this, this._gatherRenderTargets);
+ }, r.prototype.rebuild = function() {
+ }, r.prototype.dispose = function() {
+ }, r.prototype._gatherRenderTargets = function(t) {
+ this.scene._geometryBufferRenderer && t.push(this.scene._geometryBufferRenderer.getGBuffer());
+ }, r;
+ }();
+ Oi._SceneComponentInitialization = function(r) {
+ var t = r._getComponent(st.a.NAME_GEOMETRYBUFFERRENDERER);
+ t || (t = new B_(r), r._addComponent(t));
+ };
+ var OE = `
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+uniform float motionStrength;
+uniform float motionScale;
+uniform vec2 screenSize;
+#ifdef OBJECT_BASED
+uniform sampler2D velocitySampler;
+#else
+uniform sampler2D depthSampler;
+uniform mat4 inverseViewProjection;
+uniform mat4 prevViewProjection;
+#endif
+void main(void)
+{
+#ifdef GEOMETRY_SUPPORTED
+#ifdef OBJECT_BASED
+vec2 texelSize=1.0/screenSize;
+vec2 velocityColor=texture2D(velocitySampler,vUV).rg*2.0-1.0;
+vec2 velocity=vec2(pow(velocityColor.r,3.0),pow(velocityColor.g,3.0));
+velocity*=motionScale*motionStrength;
+float speed=length(velocity/texelSize);
+int samplesCount=int(clamp(speed,1.0,SAMPLES));
+velocity=normalize(velocity)*texelSize;
+float hlim=float(-samplesCount)*0.5+0.5;
+vec4 result=texture2D(textureSampler,vUV);
+for (int i=1; i=samplesCount)
+break;
+vec2 offset=vUV+velocity*(hlim+float(i));
+result+=texture2D(textureSampler,offset);
+}
+gl_FragColor=result/float(samplesCount);
+gl_FragColor.a=1.0;
+#else
+vec2 texelSize=1.0/screenSize;
+float depth=texture2D(depthSampler,vUV).r;
+vec4 cpos=vec4(vUV*2.0-1.0,depth,1.0);
+cpos=cpos*inverseViewProjection;
+vec4 ppos=cpos*prevViewProjection;
+ppos.xyz/=ppos.w;
+ppos.xy=ppos.xy*0.5+0.5;
+vec2 velocity=(ppos.xy-vUV)*motionScale*motionStrength;
+float speed=length(velocity/texelSize);
+int nSamples=int(clamp(speed,1.0,SAMPLES));
+vec4 result=texture2D(textureSampler,vUV);
+for (int i=1; i=nSamples)
+break;
+vec2 offset1=vUV+velocity*(float(i)/float(nSamples-1)-0.5);
+result+=texture2D(textureSampler,offset1);
+}
+gl_FragColor=result/float(nSamples);
+#endif
+#else
+gl_FragColor=texture2D(textureSampler,vUV);
+#endif
+}
+`;
+ We.a.ShadersStore.motionBlurPixelShader = OE;
+ var ju = function(r) {
+ function t(e, n, i, o, a, s, p, m, S, O) {
+ m === void 0 && (m = d.a.TEXTURETYPE_UNSIGNED_INT), S === void 0 && (S = !1), O === void 0 && (O = !0);
+ var I = r.call(this, e, "motionBlur", ["motionStrength", "motionScale", "screenSize", "inverseViewProjection", "prevViewProjection"], ["velocitySampler"], i, o, a, s, p, `#define GEOMETRY_SUPPORTED
+#define SAMPLES 64.0
+#define OBJECT_BASED`, m, void 0, null, S) || this;
+ return I.motionStrength = 1, I._motionBlurSamples = 32, I._isObjectBased = !0, I._forceGeometryBuffer = !1, I._geometryBufferRenderer = null, I._prePassRenderer = null, I._invViewProjection = null, I._previousViewProjection = null, I._forceGeometryBuffer = O, I._forceGeometryBuffer ? (I._geometryBufferRenderer = n.enableGeometryBufferRenderer(), I._geometryBufferRenderer && (I._geometryBufferRenderer.enableVelocity = !0)) : (I._prePassRenderer = n.enablePrePassRenderer(), I._prePassRenderer && (I._prePassRenderer.markAsDirty(), I._prePassEffectConfiguration = new RE())), I._applyMode(), I;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "motionBlurSamples", { get: function() {
+ return this._motionBlurSamples;
+ }, set: function(e) {
+ this._motionBlurSamples = e, this._updateEffect();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "isObjectBased", { get: function() {
+ return this._isObjectBased;
+ }, set: function(e) {
+ this._isObjectBased !== e && (this._isObjectBased = e, this._applyMode());
+ }, enumerable: !1, configurable: !0 }), t.prototype.getClassName = function() {
+ return "MotionBlurPostProcess";
+ }, t.prototype.excludeSkinnedMesh = function(e) {
+ if (e.skeleton) {
+ var n = void 0;
+ if (this._geometryBufferRenderer)
+ n = this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity;
+ else {
+ if (!this._prePassRenderer)
+ return;
+ n = this._prePassRenderer.excludedSkinnedMesh;
+ }
+ n.push(e);
+ }
+ }, t.prototype.removeExcludedSkinnedMesh = function(e) {
+ if (e.skeleton) {
+ var n = void 0;
+ if (this._geometryBufferRenderer)
+ n = this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity;
+ else {
+ if (!this._prePassRenderer)
+ return;
+ n = this._prePassRenderer.excludedSkinnedMesh;
+ }
+ var i = n.indexOf(e);
+ i !== -1 && n.splice(i, 1);
+ }
+ }, t.prototype.dispose = function(e) {
+ this._geometryBufferRenderer && (this._geometryBufferRenderer._previousTransformationMatrices = {}, this._geometryBufferRenderer._previousBonesTransformationMatrices = {}, this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity = []), r.prototype.dispose.call(this, e);
+ }, t.prototype._applyMode = function() {
+ var e = this;
+ if (!this._geometryBufferRenderer && !this._prePassRenderer)
+ return h.a.Warn("Multiple Render Target support needed to compute object based motion blur"), this.updateEffect();
+ this._updateEffect(), this._invViewProjection = null, this._previousViewProjection = null, this.isObjectBased ? (this._prePassRenderer && this._prePassEffectConfiguration && (this._prePassEffectConfiguration.texturesRequired[0] = d.a.PREPASS_VELOCITY_TEXTURE_TYPE), this.onApply = function(n) {
+ return e._onApplyObjectBased(n);
+ }) : (this._invViewProjection = c.a.Identity(), this._previousViewProjection = c.a.Identity(), this._prePassRenderer && this._prePassEffectConfiguration && (this._prePassEffectConfiguration.texturesRequired[0] = d.a.PREPASS_DEPTHNORMAL_TEXTURE_TYPE), this.onApply = function(n) {
+ return e._onApplyScreenBased(n);
+ });
+ }, t.prototype._onApplyObjectBased = function(e) {
+ if (e.setVector2("screenSize", new c.d(this.width, this.height)), e.setFloat("motionScale", this._scene.getAnimationRatio()), e.setFloat("motionStrength", this.motionStrength), this._geometryBufferRenderer) {
+ var n = this._geometryBufferRenderer.getTextureIndex(Oi.VELOCITY_TEXTURE_TYPE);
+ e.setTexture("velocitySampler", this._geometryBufferRenderer.getGBuffer().textures[n]);
+ } else
+ this._prePassRenderer && (n = this._prePassRenderer.getIndex(d.a.PREPASS_VELOCITY_TEXTURE_TYPE), e.setTexture("velocitySampler", this._prePassRenderer.prePassRT.textures[n]));
+ }, t.prototype._onApplyScreenBased = function(e) {
+ var n = this._scene.getProjectionMatrix().multiply(this._scene.getViewMatrix());
+ if (n.invertToRef(this._invViewProjection), e.setMatrix("inverseViewProjection", this._invViewProjection), e.setMatrix("prevViewProjection", this._previousViewProjection), this._previousViewProjection = n, e.setVector2("screenSize", new c.d(this.width, this.height)), e.setFloat("motionScale", this._scene.getAnimationRatio()), e.setFloat("motionStrength", this.motionStrength), this._geometryBufferRenderer) {
+ var i = this._geometryBufferRenderer.getTextureIndex(Oi.DEPTHNORMAL_TEXTURE_TYPE);
+ e.setTexture("depthSampler", this._geometryBufferRenderer.getGBuffer().textures[i]);
+ } else
+ this._prePassRenderer && (i = this._prePassRenderer.getIndex(d.a.PREPASS_DEPTHNORMAL_TEXTURE_TYPE), e.setTexture("depthSampler", this._prePassRenderer.prePassRT.textures[i]));
+ }, t.prototype._updateEffect = function() {
+ if (this._geometryBufferRenderer || this._prePassRenderer) {
+ var e = ["#define GEOMETRY_SUPPORTED", "#define SAMPLES " + this._motionBlurSamples.toFixed(1), this._isObjectBased ? "#define OBJECT_BASED" : "#define SCREEN_BASED"];
+ this.updateEffect(e.join(`
+`));
+ }
+ }, t._Parse = function(e, n, i, o) {
+ return w.a.Parse(function() {
+ return new t(e.name, i, e.options, n, e.renderTargetSamplingMode, i.getEngine(), e.reusable, e.textureType, !1);
+ }, e, i, o);
+ }, Object(u.c)([Object(w.c)()], t.prototype, "motionStrength", void 0), Object(u.c)([Object(w.c)()], t.prototype, "motionBlurSamples", null), Object(u.c)([Object(w.c)()], t.prototype, "isObjectBased", null), t;
+ }(_t);
+ x.a.RegisteredTypes["BABYLON.MotionBlurPostProcess"] = ju;
+ var ME = `
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+uniform sampler2D refractionSampler;
+
+uniform vec3 baseColor;
+uniform float depth;
+uniform float colorLevel;
+void main() {
+float ref=1.0-texture2D(refractionSampler,vUV).r;
+vec2 uv=vUV-vec2(0.5);
+vec2 offset=uv*depth*ref;
+vec3 sourceColor=texture2D(textureSampler,vUV-offset).rgb;
+gl_FragColor=vec4(sourceColor+sourceColor*ref*colorLevel,1.0);
+}`;
+ We.a.ShadersStore.refractionPixelShader = ME;
+ var U_ = function(r) {
+ function t(e, n, i, o, a, s, p, m, S, O) {
+ var I = r.call(this, e, "refraction", ["baseColor", "depth", "colorLevel"], ["refractionSampler"], s, p, m, S, O) || this;
+ return I._ownRefractionTexture = !0, I.color = i, I.depth = o, I.colorLevel = a, I.refractionTextureUrl = n, I.onActivateObservable.add(function(G) {
+ I._refTexture = I._refTexture || new Ue.a(n, G.getScene());
+ }), I.onApplyObservable.add(function(G) {
+ G.setColor3("baseColor", I.color), G.setFloat("depth", I.depth), G.setFloat("colorLevel", I.colorLevel), G.setTexture("refractionSampler", I._refTexture);
+ }), I;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "refractionTexture", { get: function() {
+ return this._refTexture;
+ }, set: function(e) {
+ this._refTexture && this._ownRefractionTexture && this._refTexture.dispose(), this._refTexture = e, this._ownRefractionTexture = !1;
+ }, enumerable: !1, configurable: !0 }), t.prototype.getClassName = function() {
+ return "RefractionPostProcess";
+ }, t.prototype.dispose = function(e) {
+ this._refTexture && this._ownRefractionTexture && (this._refTexture.dispose(), this._refTexture = null), r.prototype.dispose.call(this, e);
+ }, t._Parse = function(e, n, i, o) {
+ return w.a.Parse(function() {
+ return new t(e.name, e.refractionTextureUrl, e.color, e.depth, e.colorLevel, e.options, n, e.renderTargetSamplingMode, i.getEngine(), e.reusable);
+ }, e, i, o);
+ }, Object(u.c)([Object(w.c)()], t.prototype, "color", void 0), Object(u.c)([Object(w.c)()], t.prototype, "depth", void 0), Object(u.c)([Object(w.c)()], t.prototype, "colorLevel", void 0), Object(u.c)([Object(w.c)()], t.prototype, "refractionTextureUrl", void 0), t;
+ }(_t);
+ x.a.RegisteredTypes["BABYLON.RefractionPostProcess"] = U_;
+ var IE = `
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+uniform vec2 screenSize;
+uniform vec2 sharpnessAmounts;
+void main(void)
+{
+vec2 onePixel=vec2(1.0,1.0)/screenSize;
+vec4 color=texture2D(textureSampler,vUV);
+vec4 edgeDetection=texture2D(textureSampler,vUV+onePixel*vec2(0,-1)) +
+texture2D(textureSampler,vUV+onePixel*vec2(-1,0)) +
+texture2D(textureSampler,vUV+onePixel*vec2(1,0)) +
+texture2D(textureSampler,vUV+onePixel*vec2(0,1)) -
+color*4.0;
+gl_FragColor=max(vec4(color.rgb*sharpnessAmounts.y,color.a)-(sharpnessAmounts.x*vec4(edgeDetection.rgb,0)),0.);
+}`;
+ We.a.ShadersStore.sharpenPixelShader = IE;
+ var Hu = function(r) {
+ function t(e, n, i, o, a, s, p, m) {
+ p === void 0 && (p = d.a.TEXTURETYPE_UNSIGNED_INT), m === void 0 && (m = !1);
+ var S = r.call(this, e, "sharpen", ["sharpnessAmounts", "screenSize"], null, n, i, o, a, s, null, p, void 0, null, m) || this;
+ return S.colorAmount = 1, S.edgeAmount = 0.3, S.onApply = function(O) {
+ O.setFloat2("screenSize", S.width, S.height), O.setFloat2("sharpnessAmounts", S.edgeAmount, S.colorAmount);
+ }, S;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "SharpenPostProcess";
+ }, t._Parse = function(e, n, i, o) {
+ return w.a.Parse(function() {
+ return new t(e.name, e.options, n, e.renderTargetSamplingMode, i.getEngine(), e.textureType, e.reusable);
+ }, e, i, o);
+ }, Object(u.c)([Object(w.c)()], t.prototype, "colorAmount", void 0), Object(u.c)([Object(w.c)()], t.prototype, "edgeAmount", void 0), t;
+ }(_t);
+ x.a.RegisteredTypes["BABYLON.SharpenPostProcess"] = Hu;
+ var Go = function() {
+ function r(t, e) {
+ this.engine = t, this._name = e, this._renderEffects = {}, this._renderEffectsForIsolatedPass = new Array(), this._cameras = [];
+ }
+ return Object.defineProperty(r.prototype, "name", { get: function() {
+ return this._name;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "cameras", { get: function() {
+ return this._cameras;
+ }, enumerable: !1, configurable: !0 }), r.prototype.getClassName = function() {
+ return "PostProcessRenderPipeline";
+ }, Object.defineProperty(r.prototype, "isSupported", { get: function() {
+ for (var t in this._renderEffects)
+ if (this._renderEffects.hasOwnProperty(t) && !this._renderEffects[t].isSupported)
+ return !1;
+ return !0;
+ }, enumerable: !1, configurable: !0 }), r.prototype.addEffect = function(t) {
+ this._renderEffects[t._name] = t;
+ }, r.prototype._rebuild = function() {
+ }, r.prototype._enableEffect = function(t, e) {
+ var n = this._renderEffects[t];
+ n && n._enable(Ke.b.MakeArray(e || this._cameras));
+ }, r.prototype._disableEffect = function(t, e) {
+ var n = this._renderEffects[t];
+ n && n._disable(Ke.b.MakeArray(e || this._cameras));
+ }, r.prototype._attachCameras = function(t, e) {
+ var n = Ke.b.MakeArray(t || this._cameras);
+ if (n) {
+ var i, o = [];
+ for (i = 0; i < n.length; i++) {
+ var a = n[i];
+ if (a) {
+ var s = a.name;
+ this._cameras.indexOf(a) === -1 ? this._cameras[s] = a : e && o.push(i);
+ }
+ }
+ for (i = 0; i < o.length; i++)
+ t.splice(o[i], 1);
+ for (var p in this._renderEffects)
+ this._renderEffects.hasOwnProperty(p) && this._renderEffects[p]._attachCameras(n);
+ }
+ }, r.prototype._detachCameras = function(t) {
+ var e = Ke.b.MakeArray(t || this._cameras);
+ if (e) {
+ for (var n in this._renderEffects)
+ this._renderEffects.hasOwnProperty(n) && this._renderEffects[n]._detachCameras(e);
+ for (var i = 0; i < e.length; i++)
+ this._cameras.splice(this._cameras.indexOf(e[i]), 1);
+ }
+ }, r.prototype._update = function() {
+ for (var t in this._renderEffects)
+ this._renderEffects.hasOwnProperty(t) && this._renderEffects[t]._update();
+ for (var e = 0; e < this._cameras.length; e++)
+ if (this._cameras[e]) {
+ var n = this._cameras[e].name;
+ this._renderEffectsForIsolatedPass[n] && this._renderEffectsForIsolatedPass[n]._update();
+ }
+ }, r.prototype._reset = function() {
+ this._renderEffects = {}, this._renderEffectsForIsolatedPass = new Array();
+ }, r.prototype._enableMSAAOnFirstPostProcess = function(t) {
+ if (this.engine.webGLVersion === 1)
+ return !1;
+ var e = Object.keys(this._renderEffects);
+ if (e.length > 0) {
+ var n = this._renderEffects[e[0]].getPostProcesses();
+ n && (n[0].samples = t);
+ }
+ return !0;
+ }, r.prototype.setPrePassRenderer = function(t) {
+ return !1;
+ }, r.prototype.dispose = function() {
+ }, Object(u.c)([Object(w.c)()], r.prototype, "_name", void 0), r;
+ }(), V_ = function() {
+ function r() {
+ this._renderPipelines = {};
+ }
+ return Object.defineProperty(r.prototype, "supportedPipelines", { get: function() {
+ var t = [];
+ for (var e in this._renderPipelines)
+ if (this._renderPipelines.hasOwnProperty(e)) {
+ var n = this._renderPipelines[e];
+ n.isSupported && t.push(n);
+ }
+ return t;
+ }, enumerable: !1, configurable: !0 }), r.prototype.addPipeline = function(t) {
+ this._renderPipelines[t._name] = t;
+ }, r.prototype.attachCamerasToRenderPipeline = function(t, e, n) {
+ n === void 0 && (n = !1);
+ var i = this._renderPipelines[t];
+ i && i._attachCameras(e, n);
+ }, r.prototype.detachCamerasFromRenderPipeline = function(t, e) {
+ var n = this._renderPipelines[t];
+ n && n._detachCameras(e);
+ }, r.prototype.enableEffectInPipeline = function(t, e, n) {
+ var i = this._renderPipelines[t];
+ i && i._enableEffect(e, n);
+ }, r.prototype.disableEffectInPipeline = function(t, e, n) {
+ var i = this._renderPipelines[t];
+ i && i._disableEffect(e, n);
+ }, r.prototype.update = function() {
+ for (var t in this._renderPipelines)
+ if (this._renderPipelines.hasOwnProperty(t)) {
+ var e = this._renderPipelines[t];
+ e.isSupported ? e._update() : (e.dispose(), delete this._renderPipelines[t]);
+ }
+ }, r.prototype._rebuild = function() {
+ for (var t in this._renderPipelines)
+ this._renderPipelines.hasOwnProperty(t) && this._renderPipelines[t]._rebuild();
+ }, r.prototype.dispose = function() {
+ for (var t in this._renderPipelines)
+ this._renderPipelines.hasOwnProperty(t) && this._renderPipelines[t].dispose();
+ }, r;
+ }();
+ Object.defineProperty(ge.a.prototype, "postProcessRenderPipelineManager", { get: function() {
+ if (!this._postProcessRenderPipelineManager) {
+ var r = this._getComponent(st.a.NAME_POSTPROCESSRENDERPIPELINEMANAGER);
+ r || (r = new k_(this), this._addComponent(r)), this._postProcessRenderPipelineManager = new V_();
+ }
+ return this._postProcessRenderPipelineManager;
+ }, enumerable: !0, configurable: !0 });
+ var k_ = function() {
+ function r(t) {
+ this.name = st.a.NAME_POSTPROCESSRENDERPIPELINEMANAGER, this.scene = t;
+ }
+ return r.prototype.register = function() {
+ this.scene._gatherRenderTargetsStage.registerStep(st.a.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER, this, this._gatherRenderTargets);
+ }, r.prototype.rebuild = function() {
+ this.scene._postProcessRenderPipelineManager && this.scene._postProcessRenderPipelineManager._rebuild();
+ }, r.prototype.dispose = function() {
+ this.scene._postProcessRenderPipelineManager && this.scene._postProcessRenderPipelineManager.dispose();
+ }, r.prototype._gatherRenderTargets = function() {
+ this.scene._postProcessRenderPipelineManager && this.scene._postProcessRenderPipelineManager.update();
+ }, r;
+ }(), G_ = function(r) {
+ function t(e, n, i, o, a) {
+ e === void 0 && (e = ""), n === void 0 && (n = !0), i === void 0 && (i = te.a.LastCreatedScene), a === void 0 && (a = !0);
+ var s = r.call(this, i.getEngine(), e) || this;
+ s._camerasToBeAttached = [], s.SharpenPostProcessId = "SharpenPostProcessEffect", s.ImageProcessingPostProcessId = "ImageProcessingPostProcessEffect", s.FxaaPostProcessId = "FxaaPostProcessEffect", s.ChromaticAberrationPostProcessId = "ChromaticAberrationPostProcessEffect", s.GrainPostProcessId = "GrainPostProcessEffect", s._glowLayer = null, s.animations = [], s._imageProcessingConfigurationObserver = null, s._sharpenEnabled = !1, s._bloomEnabled = !1, s._depthOfFieldEnabled = !1, s._depthOfFieldBlurLevel = qr.Low, s._fxaaEnabled = !1, s._imageProcessingEnabled = !0, s._bloomScale = 0.5, s._chromaticAberrationEnabled = !1, s._grainEnabled = !1, s._buildAllowed = !0, s.onBuildObservable = new P.c(), s._resizeObserver = null, s._hardwareScaleLevel = 1, s._bloomKernel = 64, s._bloomWeight = 0.15, s._bloomThreshold = 0.9, s._samples = 1, s._hasCleared = !1, s._prevPostProcess = null, s._prevPrevPostProcess = null, s._depthOfFieldSceneObserver = null, s._cameras = o || i.cameras, s._cameras = s._cameras.slice(), s._camerasToBeAttached = s._cameras.slice(), s._buildAllowed = a, s._scene = i;
+ var p = s._scene.getEngine().getCaps();
+ s._hdr = n && (p.textureHalfFloatRender || p.textureFloatRender), s._hdr ? p.textureHalfFloatRender ? s._defaultPipelineTextureType = d.a.TEXTURETYPE_HALF_FLOAT : p.textureFloatRender && (s._defaultPipelineTextureType = d.a.TEXTURETYPE_FLOAT) : s._defaultPipelineTextureType = d.a.TEXTURETYPE_UNSIGNED_INT, i.postProcessRenderPipelineManager.addPipeline(s);
+ var m = s._scene.getEngine();
+ return s.sharpen = new Hu("sharpen", 1, null, Ue.a.BILINEAR_SAMPLINGMODE, m, !1, s._defaultPipelineTextureType, !0), s._sharpenEffect = new Ot(m, s.SharpenPostProcessId, function() {
+ return s.sharpen;
+ }, !0), s.depthOfField = new Gu(s._scene, null, s._depthOfFieldBlurLevel, s._defaultPipelineTextureType, !0), s.bloom = new Uu(s._scene, s._bloomScale, s._bloomWeight, s.bloomKernel, s._defaultPipelineTextureType, !0), s.chromaticAberration = new Vu("ChromaticAberration", m.getRenderWidth(), m.getRenderHeight(), 1, null, Ue.a.BILINEAR_SAMPLINGMODE, m, !1, s._defaultPipelineTextureType, !0), s._chromaticAberrationEffect = new Ot(m, s.ChromaticAberrationPostProcessId, function() {
+ return s.chromaticAberration;
+ }, !0), s.grain = new zu("Grain", 1, null, Ue.a.BILINEAR_SAMPLINGMODE, m, !1, s._defaultPipelineTextureType, !0), s._grainEffect = new Ot(m, s.GrainPostProcessId, function() {
+ return s.grain;
+ }, !0), s._resizeObserver = m.onResizeObservable.add(function() {
+ s._hardwareScaleLevel = m.getHardwareScalingLevel(), s.bloomKernel = s.bloomKernel;
+ }), s._imageProcessingConfigurationObserver = s._scene.imageProcessingConfiguration.onUpdateParameters.add(function() {
+ s.bloom._downscale._exposure = s._scene.imageProcessingConfiguration.exposure, s.imageProcessingEnabled !== s._scene.imageProcessingConfiguration.isEnabled && (s._imageProcessingEnabled = s._scene.imageProcessingConfiguration.isEnabled, s._buildPipeline());
+ }), s._buildPipeline(), s;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "scene", { get: function() {
+ return this._scene;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "sharpenEnabled", { get: function() {
+ return this._sharpenEnabled;
+ }, set: function(e) {
+ this._sharpenEnabled !== e && (this._sharpenEnabled = e, this._buildPipeline());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "bloomKernel", { get: function() {
+ return this._bloomKernel;
+ }, set: function(e) {
+ this._bloomKernel = e, this.bloom.kernel = e / this._hardwareScaleLevel;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "bloomWeight", { get: function() {
+ return this._bloomWeight;
+ }, set: function(e) {
+ this._bloomWeight !== e && (this.bloom.weight = e, this._bloomWeight = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "bloomThreshold", { get: function() {
+ return this._bloomThreshold;
+ }, set: function(e) {
+ this._bloomThreshold !== e && (this.bloom.threshold = e, this._bloomThreshold = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "bloomScale", { get: function() {
+ return this._bloomScale;
+ }, set: function(e) {
+ this._bloomScale !== e && (this._bloomScale = e, this._rebuildBloom(), this._buildPipeline());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "bloomEnabled", { get: function() {
+ return this._bloomEnabled;
+ }, set: function(e) {
+ this._bloomEnabled !== e && (this._bloomEnabled = e, this._buildPipeline());
+ }, enumerable: !1, configurable: !0 }), t.prototype._rebuildBloom = function() {
+ var e = this.bloom;
+ this.bloom = new Uu(this._scene, this.bloomScale, this._bloomWeight, this.bloomKernel, this._defaultPipelineTextureType, !1), this.bloom.threshold = e.threshold;
+ for (var n = 0; n < this._cameras.length; n++)
+ e.disposeEffects(this._cameras[n]);
+ }, Object.defineProperty(t.prototype, "depthOfFieldEnabled", { get: function() {
+ return this._depthOfFieldEnabled;
+ }, set: function(e) {
+ this._depthOfFieldEnabled !== e && (this._depthOfFieldEnabled = e, this._buildPipeline());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "depthOfFieldBlurLevel", { get: function() {
+ return this._depthOfFieldBlurLevel;
+ }, set: function(e) {
+ if (this._depthOfFieldBlurLevel !== e) {
+ this._depthOfFieldBlurLevel = e;
+ var n = this.depthOfField;
+ this.depthOfField = new Gu(this._scene, null, this._depthOfFieldBlurLevel, this._defaultPipelineTextureType, !1), this.depthOfField.focalLength = n.focalLength, this.depthOfField.focusDistance = n.focusDistance, this.depthOfField.fStop = n.fStop, this.depthOfField.lensSize = n.lensSize;
+ for (var i = 0; i < this._cameras.length; i++)
+ n.disposeEffects(this._cameras[i]);
+ this._buildPipeline();
+ }
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "fxaaEnabled", { get: function() {
+ return this._fxaaEnabled;
+ }, set: function(e) {
+ this._fxaaEnabled !== e && (this._fxaaEnabled = e, this._buildPipeline());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "samples", { get: function() {
+ return this._samples;
+ }, set: function(e) {
+ this._samples !== e && (this._samples = e, this._buildPipeline());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "imageProcessingEnabled", { get: function() {
+ return this._imageProcessingEnabled;
+ }, set: function(e) {
+ this._imageProcessingEnabled !== e && (this._scene.imageProcessingConfiguration.isEnabled = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "glowLayerEnabled", { get: function() {
+ return this._glowLayer != null;
+ }, set: function(e) {
+ e && !this._glowLayer ? this._glowLayer = new Bs("", this._scene) : !e && this._glowLayer && (this._glowLayer.dispose(), this._glowLayer = null);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "glowLayer", { get: function() {
+ return this._glowLayer;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "chromaticAberrationEnabled", { get: function() {
+ return this._chromaticAberrationEnabled;
+ }, set: function(e) {
+ this._chromaticAberrationEnabled !== e && (this._chromaticAberrationEnabled = e, this._buildPipeline());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "grainEnabled", { get: function() {
+ return this._grainEnabled;
+ }, set: function(e) {
+ this._grainEnabled !== e && (this._grainEnabled = e, this._buildPipeline());
+ }, enumerable: !1, configurable: !0 }), t.prototype.getClassName = function() {
+ return "DefaultRenderingPipeline";
+ }, t.prototype.prepare = function() {
+ var e = this._buildAllowed;
+ this._buildAllowed = !0, this._buildPipeline(), this._buildAllowed = e;
+ }, t.prototype._setAutoClearAndTextureSharing = function(e, n) {
+ n === void 0 && (n = !1), this._hasCleared ? e.autoClear = !1 : (e.autoClear = !0, this._scene.autoClear = !1, this._hasCleared = !0), n || (this._prevPrevPostProcess ? e.shareOutputWith(this._prevPrevPostProcess) : e.useOwnOutput(), this._prevPostProcess && (this._prevPrevPostProcess = this._prevPostProcess), this._prevPostProcess = e);
+ }, t.prototype._buildPipeline = function() {
+ var e = this;
+ if (this._buildAllowed) {
+ this._scene.autoClear = !0;
+ var n = this._scene.getEngine();
+ if (this._disposePostProcesses(), this._cameras !== null && (this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._cameras), this._cameras = this._camerasToBeAttached.slice()), this._reset(), this._prevPostProcess = null, this._prevPrevPostProcess = null, this._hasCleared = !1, this.depthOfFieldEnabled) {
+ if (this._cameras.length > 1) {
+ for (var i = 0, o = this._cameras; i < o.length; i++) {
+ var a = o[i];
+ (s = this._scene.enableDepthRenderer(a)).useOnlyInActiveCamera = !0;
+ }
+ this._depthOfFieldSceneObserver = this._scene.onAfterRenderTargetsRenderObservable.add(function(p) {
+ e._cameras.indexOf(p.activeCamera) > -1 && (e.depthOfField.depthTexture = p.enableDepthRenderer(p.activeCamera).getDepthMap());
+ });
+ } else {
+ this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);
+ var s = this._scene.enableDepthRenderer(this._cameras[0]);
+ this.depthOfField.depthTexture = s.getDepthMap();
+ }
+ this.depthOfField._isReady() || this.depthOfField._updateEffects(), this.addEffect(this.depthOfField), this._setAutoClearAndTextureSharing(this.depthOfField._effects[0], !0);
+ } else
+ this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);
+ this.bloomEnabled && (this.bloom._isReady() || this.bloom._updateEffects(), this.addEffect(this.bloom), this._setAutoClearAndTextureSharing(this.bloom._effects[0], !0)), this._imageProcessingEnabled && (this.imageProcessing = new ys("imageProcessing", 1, null, Ue.a.BILINEAR_SAMPLINGMODE, n, !1, this._defaultPipelineTextureType), this._hdr ? (this.addEffect(new Ot(n, this.ImageProcessingPostProcessId, function() {
+ return e.imageProcessing;
+ }, !0)), this._setAutoClearAndTextureSharing(this.imageProcessing)) : this._scene.imageProcessingConfiguration.applyByPostProcess = !1, this.cameras && this.cameras.length !== 0 || (this._scene.imageProcessingConfiguration.applyByPostProcess = !1), this.imageProcessing.getEffect() || this.imageProcessing._updateParameters()), this.sharpenEnabled && (this.sharpen.isReady() || this.sharpen.updateEffect(), this.addEffect(this._sharpenEffect), this._setAutoClearAndTextureSharing(this.sharpen)), this.grainEnabled && (this.grain.isReady() || this.grain.updateEffect(), this.addEffect(this._grainEffect), this._setAutoClearAndTextureSharing(this.grain)), this.chromaticAberrationEnabled && (this.chromaticAberration.isReady() || this.chromaticAberration.updateEffect(), this.addEffect(this._chromaticAberrationEffect), this._setAutoClearAndTextureSharing(this.chromaticAberration)), this.fxaaEnabled && (this.fxaa = new Ha("fxaa", 1, null, Ue.a.BILINEAR_SAMPLINGMODE, n, !1, this._defaultPipelineTextureType), this.addEffect(new Ot(n, this.FxaaPostProcessId, function() {
+ return e.fxaa;
+ }, !0)), this._setAutoClearAndTextureSharing(this.fxaa, !0)), this._cameras !== null && this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name, this._cameras), this._scene.activeCameras && this._scene.activeCameras.length > 1 && (this._scene.autoClear = !0), !this._enableMSAAOnFirstPostProcess(this.samples) && this.samples > 1 && h.a.Warn("MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0"), this.onBuildObservable.notifyObservers(this);
+ }
+ }, t.prototype._disposePostProcesses = function(e) {
+ e === void 0 && (e = !1);
+ for (var n = 0; n < this._cameras.length; n++) {
+ var i = this._cameras[n];
+ this.imageProcessing && this.imageProcessing.dispose(i), this.fxaa && this.fxaa.dispose(i), e && (this.sharpen && this.sharpen.dispose(i), this.depthOfField && (this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver), this.depthOfField.disposeEffects(i)), this.bloom && this.bloom.disposeEffects(i), this.chromaticAberration && this.chromaticAberration.dispose(i), this.grain && this.grain.dispose(i), this._glowLayer && this._glowLayer.dispose());
+ }
+ this.imageProcessing = null, this.fxaa = null, e && (this.sharpen = null, this._sharpenEffect = null, this.depthOfField = null, this.bloom = null, this.chromaticAberration = null, this._chromaticAberrationEffect = null, this.grain = null, this._grainEffect = null, this._glowLayer = null);
+ }, t.prototype.addCamera = function(e) {
+ this._camerasToBeAttached.push(e), this._buildPipeline();
+ }, t.prototype.removeCamera = function(e) {
+ var n = this._camerasToBeAttached.indexOf(e);
+ this._camerasToBeAttached.splice(n, 1), this._buildPipeline();
+ }, t.prototype.dispose = function() {
+ this.onBuildObservable.clear(), this._disposePostProcesses(!0), this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._cameras), this._scene.autoClear = !0, this._resizeObserver && (this._scene.getEngine().onResizeObservable.remove(this._resizeObserver), this._resizeObserver = null), this._scene.imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingConfigurationObserver), r.prototype.dispose.call(this);
+ }, t.prototype.serialize = function() {
+ var e = w.a.Serialize(this);
+ return e.customType = "DefaultRenderingPipeline", e;
+ }, t.Parse = function(e, n, i) {
+ return w.a.Parse(function() {
+ return new t(e._name, e._name._hdr, n);
+ }, e, n, i);
+ }, Object(u.c)([Object(w.c)()], t.prototype, "sharpenEnabled", null), Object(u.c)([Object(w.c)()], t.prototype, "bloomKernel", null), Object(u.c)([Object(w.c)()], t.prototype, "_bloomWeight", void 0), Object(u.c)([Object(w.c)()], t.prototype, "_bloomThreshold", void 0), Object(u.c)([Object(w.c)()], t.prototype, "_hdr", void 0), Object(u.c)([Object(w.c)()], t.prototype, "bloomWeight", null), Object(u.c)([Object(w.c)()], t.prototype, "bloomThreshold", null), Object(u.c)([Object(w.c)()], t.prototype, "bloomScale", null), Object(u.c)([Object(w.c)()], t.prototype, "bloomEnabled", null), Object(u.c)([Object(w.c)()], t.prototype, "depthOfFieldEnabled", null), Object(u.c)([Object(w.c)()], t.prototype, "depthOfFieldBlurLevel", null), Object(u.c)([Object(w.c)()], t.prototype, "fxaaEnabled", null), Object(u.c)([Object(w.c)()], t.prototype, "samples", null), Object(u.c)([Object(w.c)()], t.prototype, "imageProcessingEnabled", null), Object(u.c)([Object(w.c)()], t.prototype, "glowLayerEnabled", null), Object(u.c)([Object(w.c)()], t.prototype, "chromaticAberrationEnabled", null), Object(u.c)([Object(w.c)()], t.prototype, "grainEnabled", null), t;
+ }(Go);
+ x.a.RegisteredTypes["BABYLON.DefaultRenderingPipeline"] = G_;
+ var DE = `
+uniform sampler2D textureSampler;
+
+uniform float gain;
+uniform float threshold;
+uniform float screen_width;
+uniform float screen_height;
+
+varying vec2 vUV;
+
+vec4 highlightColor(vec4 color) {
+vec4 highlight=color;
+float luminance=dot(highlight.rgb,vec3(0.2125,0.7154,0.0721));
+float lum_threshold;
+if (threshold>1.0) { lum_threshold=0.94+0.01*threshold; }
+else { lum_threshold=0.5+0.44*threshold; }
+luminance=clamp((luminance-lum_threshold)*(1.0/(1.0-lum_threshold)),0.0,1.0);
+highlight*=luminance*gain;
+highlight.a=1.0;
+return highlight;
+}
+void main(void)
+{
+vec4 original=texture2D(textureSampler,vUV);
+
+if (gain == -1.0) {
+gl_FragColor=vec4(0.0,0.0,0.0,1.0);
+return;
+}
+float w=2.0/screen_width;
+float h=2.0/screen_height;
+float weight=1.0;
+
+vec4 blurred=vec4(0.0,0.0,0.0,0.0);
+#ifdef PENTAGON
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.84*w,0.43*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.48*w,-1.29*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.61*w,1.51*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.55*w,-0.74*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.71*w,-0.52*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.94*w,1.59*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.40*w,-1.87*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.62*w,1.16*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.09*w,0.25*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.46*w,-1.71*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.08*w,2.42*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.85*w,-1.89*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.89*w,0.16*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.29*w,1.88*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.40*w,-2.81*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.54*w,2.26*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.60*w,-0.61*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.31*w,-1.30*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.83*w,2.53*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.12*w,-2.48*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.60*w,1.11*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.99*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.50*w,-2.81*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.85*w,3.33*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.94*w,-1.92*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.27*w,-0.53*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.95*w,2.48*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.23*w,-3.04*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.17*w,2.05*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.97*w,-0.04*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.25*w,-2.00*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.31*w,3.08*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.94*w,-2.59*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.37*w,0.64*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.13*w,1.93*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.03*w,-3.65*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.60*w,3.17*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.14*w,-1.19*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.00*w,-1.19*h)));
+#else
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.85*w,0.36*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.52*w,-1.14*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.46*w,1.42*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.46*w,-0.83*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.79*w,-0.42*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.11*w,1.62*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.29*w,-2.07*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.69*w,1.39*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.28*w,0.12*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.65*w,-1.69*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.08*w,2.44*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.63*w,-1.90*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.55*w,0.31*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.13*w,1.52*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.56*w,-2.61*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.38*w,2.34*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.64*w,-0.81*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.53*w,-1.21*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.06*w,2.63*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.00*w,-2.69*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.59*w,1.32*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.78*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.57*w,-2.50*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.54*w,2.93*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.39*w,-1.81*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,-0.28*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.04*w,2.25*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.02*w,-3.05*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.09*w,2.25*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.07*w,-0.25*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.44*w,-1.90*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.52*w,3.05*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.68*w,-2.61*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,0.79*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.76*w,1.46*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.05*w,-2.94*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.21*w,2.88*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.84*w,-1.30*h)));
+blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.98*w,-0.96*h)));
+#endif
+blurred/=39.0;
+gl_FragColor=blurred;
+
+}`;
+ We.a.ShadersStore.lensHighlightsPixelShader = DE;
+ var LE = `
+
+
+
+
+uniform sampler2D textureSampler;
+uniform sampler2D highlightsSampler;
+uniform sampler2D depthSampler;
+uniform sampler2D grainSampler;
+
+uniform float grain_amount;
+uniform bool blur_noise;
+uniform float screen_width;
+uniform float screen_height;
+uniform float distortion;
+uniform bool dof_enabled;
+
+uniform float screen_distance;
+uniform float aperture;
+uniform float darken;
+uniform float edge_blur;
+uniform bool highlights;
+
+uniform float near;
+uniform float far;
+
+varying vec2 vUV;
+
+#define PI 3.14159265
+#define TWOPI 6.28318530
+#define inverse_focal_length 0.1
+
+vec2 centered_screen_pos;
+vec2 distorted_coords;
+float radius2;
+float radius;
+
+vec2 rand(vec2 co)
+{
+float noise1=(fract(sin(dot(co,vec2(12.9898,78.233)))*43758.5453));
+float noise2=(fract(sin(dot(co,vec2(12.9898,78.233)*2.0))*43758.5453));
+return clamp(vec2(noise1,noise2),0.0,1.0);
+}
+
+vec2 getDistortedCoords(vec2 coords) {
+if (distortion == 0.0) { return coords; }
+vec2 direction=1.0*normalize(centered_screen_pos);
+vec2 dist_coords=vec2(0.5,0.5);
+dist_coords.x=0.5+direction.x*radius2*1.0;
+dist_coords.y=0.5+direction.y*radius2*1.0;
+float dist_amount=clamp(distortion*0.23,0.0,1.0);
+dist_coords=mix(coords,dist_coords,dist_amount);
+return dist_coords;
+}
+
+float sampleScreen(inout vec4 color,const in vec2 offset,const in float weight) {
+
+vec2 coords=distorted_coords;
+float angle=rand(coords*100.0).x*TWOPI;
+coords+=vec2(offset.x*cos(angle)-offset.y*sin(angle),offset.x*sin(angle)+offset.y*cos(angle));
+color+=texture2D(textureSampler,coords)*weight;
+return weight;
+}
+
+float getBlurLevel(float size) {
+return min(3.0,ceil(size/1.0));
+}
+
+vec4 getBlurColor(float size) {
+vec4 col=texture2D(textureSampler,distorted_coords);
+if (size == 0.0) { return col; }
+
+
+float blur_level=getBlurLevel(size);
+float w=(size/screen_width);
+float h=(size/screen_height);
+float total_weight=1.0;
+vec2 sample_coords;
+total_weight+=sampleScreen(col,vec2(-0.50*w,0.24*h),0.93);
+total_weight+=sampleScreen(col,vec2(0.30*w,-0.75*h),0.90);
+total_weight+=sampleScreen(col,vec2(0.36*w,0.96*h),0.87);
+total_weight+=sampleScreen(col,vec2(-1.08*w,-0.55*h),0.85);
+total_weight+=sampleScreen(col,vec2(1.33*w,-0.37*h),0.83);
+total_weight+=sampleScreen(col,vec2(-0.82*w,1.31*h),0.80);
+total_weight+=sampleScreen(col,vec2(-0.31*w,-1.67*h),0.78);
+total_weight+=sampleScreen(col,vec2(1.47*w,1.11*h),0.76);
+total_weight+=sampleScreen(col,vec2(-1.97*w,0.19*h),0.74);
+total_weight+=sampleScreen(col,vec2(1.42*w,-1.57*h),0.72);
+if (blur_level>1.0) {
+total_weight+=sampleScreen(col,vec2(0.01*w,2.25*h),0.70);
+total_weight+=sampleScreen(col,vec2(-1.62*w,-1.74*h),0.67);
+total_weight+=sampleScreen(col,vec2(2.49*w,0.20*h),0.65);
+total_weight+=sampleScreen(col,vec2(-2.07*w,1.61*h),0.63);
+total_weight+=sampleScreen(col,vec2(0.46*w,-2.70*h),0.61);
+total_weight+=sampleScreen(col,vec2(1.55*w,2.40*h),0.59);
+total_weight+=sampleScreen(col,vec2(-2.88*w,-0.75*h),0.56);
+total_weight+=sampleScreen(col,vec2(2.73*w,-1.44*h),0.54);
+total_weight+=sampleScreen(col,vec2(-1.08*w,3.02*h),0.52);
+total_weight+=sampleScreen(col,vec2(-1.28*w,-3.05*h),0.49);
+}
+if (blur_level>2.0) {
+total_weight+=sampleScreen(col,vec2(3.11*w,1.43*h),0.46);
+total_weight+=sampleScreen(col,vec2(-3.36*w,1.08*h),0.44);
+total_weight+=sampleScreen(col,vec2(1.80*w,-3.16*h),0.41);
+total_weight+=sampleScreen(col,vec2(0.83*w,3.65*h),0.38);
+total_weight+=sampleScreen(col,vec2(-3.16*w,-2.19*h),0.34);
+total_weight+=sampleScreen(col,vec2(3.92*w,-0.53*h),0.31);
+total_weight+=sampleScreen(col,vec2(-2.59*w,3.12*h),0.26);
+total_weight+=sampleScreen(col,vec2(-0.20*w,-4.15*h),0.22);
+total_weight+=sampleScreen(col,vec2(3.02*w,3.00*h),0.15);
+}
+col/=total_weight;
+
+if (darken>0.0) {
+col.rgb*=clamp(0.3,1.0,1.05-size*0.5*darken);
+}
+
+
+
+
+return col;
+}
+void main(void)
+{
+
+centered_screen_pos=vec2(vUV.x-0.5,vUV.y-0.5);
+radius2=centered_screen_pos.x*centered_screen_pos.x+centered_screen_pos.y*centered_screen_pos.y;
+radius=sqrt(radius2);
+distorted_coords=getDistortedCoords(vUV);
+vec2 texels_coords=vec2(vUV.x*screen_width,vUV.y*screen_height);
+float depth=texture2D(depthSampler,distorted_coords).r;
+float distance=near+(far-near)*depth;
+vec4 color=texture2D(textureSampler,vUV);
+
+
+float coc=abs(aperture*(screen_distance*(inverse_focal_length-1.0/distance)-1.0));
+
+if (dof_enabled == false || coc<0.07) { coc=0.0; }
+
+float edge_blur_amount=0.0;
+if (edge_blur>0.0) {
+edge_blur_amount=clamp((radius*2.0-1.0+0.15*edge_blur)*1.5,0.0,1.0)*1.3;
+}
+
+float blur_amount=max(edge_blur_amount,coc);
+
+if (blur_amount == 0.0) {
+gl_FragColor=texture2D(textureSampler,distorted_coords);
+}
+else {
+
+gl_FragColor=getBlurColor(blur_amount*1.7);
+
+if (highlights) {
+gl_FragColor.rgb+=clamp(coc,0.0,1.0)*texture2D(highlightsSampler,distorted_coords).rgb;
+}
+if (blur_noise) {
+
+vec2 noise=rand(distorted_coords)*0.01*blur_amount;
+vec2 blurred_coord=vec2(distorted_coords.x+noise.x,distorted_coords.y+noise.y);
+gl_FragColor=0.04*texture2D(textureSampler,blurred_coord)+0.96*gl_FragColor;
+}
+}
+
+if (grain_amount>0.0) {
+vec4 grain_color=texture2D(grainSampler,texels_coords*0.003);
+gl_FragColor.rgb+=(-0.5+grain_color.rgb)*0.30*grain_amount;
+}
+}
+`;
+ We.a.ShadersStore.depthOfFieldPixelShader = LE;
+ var wE = function(r) {
+ function t(e, n, i, o, a) {
+ o === void 0 && (o = 1);
+ var s = r.call(this, i.getEngine(), e) || this;
+ return s.LensChromaticAberrationEffect = "LensChromaticAberrationEffect", s.HighlightsEnhancingEffect = "HighlightsEnhancingEffect", s.LensDepthOfFieldEffect = "LensDepthOfFieldEffect", s._pentagonBokehIsEnabled = !1, s._scene = i, s._depthTexture = i.enableDepthRenderer().getDepthMap(), n.grain_texture ? s._grainTexture = n.grain_texture : s._createGrainTexture(), s._edgeBlur = n.edge_blur ? n.edge_blur : 0, s._grainAmount = n.grain_amount ? n.grain_amount : 0, s._chromaticAberration = n.chromatic_aberration ? n.chromatic_aberration : 0, s._distortion = n.distortion ? n.distortion : 0, s._highlightsGain = n.dof_gain !== void 0 ? n.dof_gain : -1, s._highlightsThreshold = n.dof_threshold ? n.dof_threshold : 1, s._dofDistance = n.dof_focus_distance !== void 0 ? n.dof_focus_distance : -1, s._dofAperture = n.dof_aperture ? n.dof_aperture : 1, s._dofDarken = n.dof_darken ? n.dof_darken : 0, s._dofPentagon = n.dof_pentagon === void 0 || n.dof_pentagon, s._blurNoise = n.blur_noise === void 0 || n.blur_noise, s._createChromaticAberrationPostProcess(o), s._createHighlightsPostProcess(o), s._createDepthOfFieldPostProcess(o / 4), s.addEffect(new Ot(i.getEngine(), s.LensChromaticAberrationEffect, function() {
+ return s._chromaticAberrationPostProcess;
+ }, !0)), s.addEffect(new Ot(i.getEngine(), s.HighlightsEnhancingEffect, function() {
+ return s._highlightsPostProcess;
+ }, !0)), s.addEffect(new Ot(i.getEngine(), s.LensDepthOfFieldEffect, function() {
+ return s._depthOfFieldPostProcess;
+ }, !0)), s._highlightsGain === -1 && s._disableEffect(s.HighlightsEnhancingEffect, null), i.postProcessRenderPipelineManager.addPipeline(s), a && i.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(e, a), s;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "LensRenderingPipeline";
+ }, Object.defineProperty(t.prototype, "scene", { get: function() {
+ return this._scene;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "edgeBlur", { get: function() {
+ return this._edgeBlur;
+ }, set: function(e) {
+ this.setEdgeBlur(e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "grainAmount", { get: function() {
+ return this._grainAmount;
+ }, set: function(e) {
+ this.setGrainAmount(e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "chromaticAberration", { get: function() {
+ return this._chromaticAberration;
+ }, set: function(e) {
+ this.setChromaticAberration(e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "dofAperture", { get: function() {
+ return this._dofAperture;
+ }, set: function(e) {
+ this.setAperture(e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "edgeDistortion", { get: function() {
+ return this._distortion;
+ }, set: function(e) {
+ this.setEdgeDistortion(e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "dofDistortion", { get: function() {
+ return this._dofDistance;
+ }, set: function(e) {
+ this.setFocusDistance(e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "darkenOutOfFocus", { get: function() {
+ return this._dofDarken;
+ }, set: function(e) {
+ this.setDarkenOutOfFocus(e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "blurNoise", { get: function() {
+ return this._blurNoise;
+ }, set: function(e) {
+ this._blurNoise = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "pentagonBokeh", { get: function() {
+ return this._pentagonBokehIsEnabled;
+ }, set: function(e) {
+ e ? this.enablePentagonBokeh() : this.disablePentagonBokeh();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "highlightsGain", { get: function() {
+ return this._highlightsGain;
+ }, set: function(e) {
+ this.setHighlightsGain(e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "highlightsThreshold", { get: function() {
+ return this._highlightsThreshold;
+ }, set: function(e) {
+ this.setHighlightsThreshold(e);
+ }, enumerable: !1, configurable: !0 }), t.prototype.setEdgeBlur = function(e) {
+ this._edgeBlur = e;
+ }, t.prototype.disableEdgeBlur = function() {
+ this._edgeBlur = 0;
+ }, t.prototype.setGrainAmount = function(e) {
+ this._grainAmount = e;
+ }, t.prototype.disableGrain = function() {
+ this._grainAmount = 0;
+ }, t.prototype.setChromaticAberration = function(e) {
+ this._chromaticAberration = e;
+ }, t.prototype.disableChromaticAberration = function() {
+ this._chromaticAberration = 0;
+ }, t.prototype.setEdgeDistortion = function(e) {
+ this._distortion = e;
+ }, t.prototype.disableEdgeDistortion = function() {
+ this._distortion = 0;
+ }, t.prototype.setFocusDistance = function(e) {
+ this._dofDistance = e;
+ }, t.prototype.disableDepthOfField = function() {
+ this._dofDistance = -1;
+ }, t.prototype.setAperture = function(e) {
+ this._dofAperture = e;
+ }, t.prototype.setDarkenOutOfFocus = function(e) {
+ this._dofDarken = e;
+ }, t.prototype.enablePentagonBokeh = function() {
+ this._highlightsPostProcess.updateEffect(`#define PENTAGON
+`), this._pentagonBokehIsEnabled = !0;
+ }, t.prototype.disablePentagonBokeh = function() {
+ this._pentagonBokehIsEnabled = !1, this._highlightsPostProcess.updateEffect();
+ }, t.prototype.enableNoiseBlur = function() {
+ this._blurNoise = !0;
+ }, t.prototype.disableNoiseBlur = function() {
+ this._blurNoise = !1;
+ }, t.prototype.setHighlightsGain = function(e) {
+ this._highlightsGain = e;
+ }, t.prototype.setHighlightsThreshold = function(e) {
+ this._highlightsGain === -1 && (this._highlightsGain = 1), this._highlightsThreshold = e;
+ }, t.prototype.disableHighlights = function() {
+ this._highlightsGain = -1;
+ }, t.prototype.dispose = function(e) {
+ e === void 0 && (e = !1), this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._scene.cameras), this._chromaticAberrationPostProcess = null, this._highlightsPostProcess = null, this._depthOfFieldPostProcess = null, this._grainTexture.dispose(), e && this._scene.disableDepthRenderer();
+ }, t.prototype._createChromaticAberrationPostProcess = function(e) {
+ var n = this;
+ this._chromaticAberrationPostProcess = new _t("LensChromaticAberration", "chromaticAberration", ["chromatic_aberration", "screen_width", "screen_height", "direction", "radialIntensity", "centerPosition"], [], e, null, Ue.a.TRILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1), this._chromaticAberrationPostProcess.onApply = function(i) {
+ i.setFloat("chromatic_aberration", n._chromaticAberration), i.setFloat("screen_width", n._scene.getEngine().getRenderWidth()), i.setFloat("screen_height", n._scene.getEngine().getRenderHeight()), i.setFloat("radialIntensity", 1), i.setFloat2("direction", 17, 17), i.setFloat2("centerPosition", 0.5, 0.5);
+ };
+ }, t.prototype._createHighlightsPostProcess = function(e) {
+ var n = this;
+ this._highlightsPostProcess = new _t("LensHighlights", "lensHighlights", ["gain", "threshold", "screen_width", "screen_height"], [], e, null, Ue.a.TRILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1, this._dofPentagon ? `#define PENTAGON
+` : ""), this._highlightsPostProcess.onApply = function(i) {
+ i.setFloat("gain", n._highlightsGain), i.setFloat("threshold", n._highlightsThreshold), i.setTextureFromPostProcess("textureSampler", n._chromaticAberrationPostProcess), i.setFloat("screen_width", n._scene.getEngine().getRenderWidth()), i.setFloat("screen_height", n._scene.getEngine().getRenderHeight());
+ };
+ }, t.prototype._createDepthOfFieldPostProcess = function(e) {
+ var n = this;
+ this._depthOfFieldPostProcess = new _t("LensDepthOfField", "depthOfField", ["grain_amount", "blur_noise", "screen_width", "screen_height", "distortion", "dof_enabled", "screen_distance", "aperture", "darken", "edge_blur", "highlights", "near", "far"], ["depthSampler", "grainSampler", "highlightsSampler"], e, null, Ue.a.TRILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1), this._depthOfFieldPostProcess.onApply = function(i) {
+ i.setTexture("depthSampler", n._depthTexture), i.setTexture("grainSampler", n._grainTexture), i.setTextureFromPostProcess("textureSampler", n._highlightsPostProcess), i.setTextureFromPostProcess("highlightsSampler", n._depthOfFieldPostProcess), i.setFloat("grain_amount", n._grainAmount), i.setBool("blur_noise", n._blurNoise), i.setFloat("screen_width", n._scene.getEngine().getRenderWidth()), i.setFloat("screen_height", n._scene.getEngine().getRenderHeight()), i.setFloat("distortion", n._distortion), i.setBool("dof_enabled", n._dofDistance !== -1), i.setFloat("screen_distance", 1 / (0.1 - 1 / n._dofDistance)), i.setFloat("aperture", n._dofAperture), i.setFloat("darken", n._dofDarken), i.setFloat("edge_blur", n._edgeBlur), i.setBool("highlights", n._highlightsGain !== -1), n._scene.activeCamera && (i.setFloat("near", n._scene.activeCamera.minZ), i.setFloat("far", n._scene.activeCamera.maxZ));
+ };
+ }, t.prototype._createGrainTexture = function() {
+ this._grainTexture = new $i.a("LensNoiseTexture", 512, this._scene, !1, Ue.a.BILINEAR_SAMPLINGMODE), this._grainTexture.wrapU = Ue.a.WRAP_ADDRESSMODE, this._grainTexture.wrapV = Ue.a.WRAP_ADDRESSMODE;
+ for (var e, n, i, o = this._grainTexture.getContext(), a = 0; a < 512; a++)
+ for (var s = 0; s < 512; s++)
+ e = Math.floor(255 * (n = 0.42, i = 0.58, Math.random() * (i - n) + n)), o.fillStyle = "rgb(" + e + ", " + e + ", " + e + ")", o.fillRect(a, s, 1, 1);
+ this._grainTexture.update(!1);
+ }, t;
+ }(Go), NE = function() {
+ this.enabled = !1, this.name = "ssao2", this.texturesRequired = [d.a.PREPASS_DEPTHNORMAL_TEXTURE_TYPE];
+ }, FE = `
+precision highp float;
+uniform sampler2D textureSampler;
+uniform float near;
+uniform float far;
+uniform float radius;
+float scales[16]=float[16](
+0.1,
+0.11406250000000001,
+0.131640625,
+0.15625,
+0.187890625,
+0.2265625,
+0.272265625,
+0.325,
+0.384765625,
+0.4515625,
+0.525390625,
+0.60625,
+0.694140625,
+0.7890625,
+0.891015625,
+1.0
+);
+varying vec2 vUV;
+float perspectiveDepthToViewZ( const in float invClipZ,const in float near,const in float far ) {
+return ( near*far )/( ( far-near )*invClipZ-far );
+}
+float viewZToPerspectiveDepth( const in float viewZ,const in float near,const in float far ) {
+return ( near*far/viewZ+far)/( far-near );
+}
+float viewZToOrthographicDepth( const in float viewZ,const in float near,const in float far ) {
+return ( viewZ+near )/( near-far );
+}
+#ifdef SSAO
+uniform sampler2D randomSampler;
+#ifndef GEOMETRYBUFFER
+uniform sampler2D depthNormalSampler;
+#else
+uniform sampler2D depthSampler;
+uniform sampler2D normalSampler;
+#endif
+uniform float randTextureTiles;
+uniform float samplesFactor;
+uniform vec3 sampleSphere[SAMPLES];
+uniform float totalStrength;
+uniform float base;
+uniform float xViewport;
+uniform float yViewport;
+uniform float maxZ;
+uniform float minZAspect;
+uniform vec2 texelSize;
+uniform mat4 projection;
+void main()
+{
+vec3 random=texture2D(randomSampler,vUV*randTextureTiles).rgb;
+#ifndef GEOMETRYBUFFER
+float depth=texture2D(depthNormalSampler,vUV).r;
+#else
+float depth=texture2D(depthSampler,vUV).r;
+#endif
+float depthSign=depth/abs(depth);
+depth=depth*depthSign;
+#ifndef GEOMETRYBUFFER
+vec3 normal=texture2D(depthNormalSampler,vUV).gba;
+#else
+vec3 normal=texture2D(normalSampler,vUV).rgb;
+#endif
+float occlusion=0.0;
+float correctedRadius=min(radius,minZAspect*depth/near);
+vec3 vViewRay=vec3((vUV.x*2.0-1.0)*xViewport,(vUV.y*2.0-1.0)*yViewport,depthSign);
+vec3 origin=vViewRay*depth;
+vec3 rvec=random*2.0-1.0;
+rvec.z=0.0;
+
+float dotProduct=dot(rvec,normal);
+rvec=1.0-abs(dotProduct)>1e-2 ? rvec : vec3(-rvec.y,0.0,rvec.x);
+vec3 tangent=normalize(rvec-normal*dot(rvec,normal));
+vec3 bitangent=cross(normal,tangent);
+mat3 tbn=mat3(tangent,bitangent,normal);
+float difference;
+for (int i=0; i1.0 || offset.y>1.0) {
+continue;
+}
+
+#ifndef GEOMETRYBUFFER
+float sampleDepth=abs(texture2D(depthNormalSampler,offset.xy).r);
+#else
+float sampleDepth=abs(texture2D(depthSampler,offset.xy).r);
+#endif
+
+difference=depthSign*samplePosition.z-sampleDepth;
+float rangeCheck=1.0-smoothstep(correctedRadius*0.5,correctedRadius,difference);
+occlusion+=(difference>=0.0 ? 1.0 : 0.0)*rangeCheck;
+}
+occlusion=occlusion*(1.0-smoothstep(maxZ*0.75,maxZ,depth));
+float ao=1.0-totalStrength*occlusion*samplesFactor;
+float result=clamp(ao+base,0.0,1.0);
+gl_FragColor=vec4(vec3(result),1.0);
+}
+#endif
+#ifdef BILATERAL_BLUR
+uniform sampler2D depthNormalSampler;
+uniform float outSize;
+uniform float samplerOffsets[SAMPLES];
+vec4 blur9(sampler2D image,vec2 uv,float resolution,vec2 direction) {
+vec4 color=vec4(0.0);
+vec2 off1=vec2(1.3846153846)*direction;
+vec2 off2=vec2(3.2307692308)*direction;
+color+=texture2D(image,uv)*0.2270270270;
+color+=texture2D(image,uv+(off1/resolution))*0.3162162162;
+color+=texture2D(image,uv-(off1/resolution))*0.3162162162;
+color+=texture2D(image,uv+(off2/resolution))*0.0702702703;
+color+=texture2D(image,uv-(off2/resolution))*0.0702702703;
+return color;
+}
+vec4 blur13(sampler2D image,vec2 uv,float resolution,vec2 direction) {
+vec4 color=vec4(0.0);
+vec2 off1=vec2(1.411764705882353)*direction;
+vec2 off2=vec2(3.2941176470588234)*direction;
+vec2 off3=vec2(5.176470588235294)*direction;
+color+=texture2D(image,uv)*0.1964825501511404;
+color+=texture2D(image,uv+(off1/resolution))*0.2969069646728344;
+color+=texture2D(image,uv-(off1/resolution))*0.2969069646728344;
+color+=texture2D(image,uv+(off2/resolution))*0.09447039785044732;
+color+=texture2D(image,uv-(off2/resolution))*0.09447039785044732;
+color+=texture2D(image,uv+(off3/resolution))*0.010381362401148057;
+color+=texture2D(image,uv-(off3/resolution))*0.010381362401148057;
+return color;
+}
+vec4 blur13Bilateral(sampler2D image,vec2 uv,float resolution,vec2 direction) {
+vec4 color=vec4(0.0);
+vec2 off1=vec2(1.411764705882353)*direction;
+vec2 off2=vec2(3.2941176470588234)*direction;
+vec2 off3=vec2(5.176470588235294)*direction;
+float compareDepth=abs(texture2D(depthNormalSampler,uv).r);
+float sampleDepth;
+float weight;
+float weightSum=30.0;
+color+=texture2D(image,uv)*30.0;
+sampleDepth=abs(texture2D(depthNormalSampler,uv+(off1/resolution)).r);
+weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);
+weightSum+=weight;
+color+=texture2D(image,uv+(off1/resolution))*weight;
+sampleDepth=abs(texture2D(depthNormalSampler,uv-(off1/resolution)).r);
+weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);
+weightSum+=weight;
+color+=texture2D(image,uv-(off1/resolution))*weight;
+sampleDepth=abs(texture2D(depthNormalSampler,uv+(off2/resolution)).r);
+weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);
+weightSum+=weight;
+color+=texture2D(image,uv+(off2/resolution))*weight;
+sampleDepth=abs(texture2D(depthNormalSampler,uv-(off2/resolution)).r);
+weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);
+weightSum+=weight;
+color+=texture2D(image,uv-(off2/resolution))*weight;
+sampleDepth=abs(texture2D(depthNormalSampler,uv+(off3/resolution)).r);
+weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);
+weightSum+=weight;
+color+=texture2D(image,uv+(off3/resolution))*weight;
+sampleDepth=abs(texture2D(depthNormalSampler,uv-(off3/resolution)).r);
+weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);
+weightSum+=weight;
+color+=texture2D(image,uv-(off3/resolution))*weight;
+return color/weightSum;
+}
+void main()
+{
+#if EXPENSIVE
+float compareDepth=abs(texture2D(depthNormalSampler,vUV).r);
+float texelsize=1.0/outSize;
+float result=0.0;
+float weightSum=0.0;
+for (int i=0; i= 2;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "scene", { get: function() {
+ return this._scene;
+ }, enumerable: !1, configurable: !0 }), t.prototype.getClassName = function() {
+ return "SSAO2RenderingPipeline";
+ }, t.prototype.dispose = function(e) {
+ e === void 0 && (e = !1);
+ for (var n = 0; n < this._scene.cameras.length; n++) {
+ var i = this._scene.cameras[n];
+ this._originalColorPostProcess.dispose(i), this._ssaoPostProcess.dispose(i), this._blurHPostProcess.dispose(i), this._blurVPostProcess.dispose(i), this._ssaoCombinePostProcess.dispose(i);
+ }
+ this._randomTexture.dispose(), e && this._scene.disableGeometryBufferRenderer(), this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._scene.cameras), r.prototype.dispose.call(this);
+ }, t.prototype._createBlurPostProcess = function(e, n) {
+ var i = this;
+ this._samplerOffsets = [];
+ for (var o = this.expensiveBlur, a = -8; a < 8; a++)
+ this._samplerOffsets.push(2 * a + 0.5);
+ this._blurHPostProcess = new _t("BlurH", "ssao2", ["outSize", "samplerOffsets", "near", "far", "radius"], ["depthNormalSampler"], e, null, Ue.a.TRILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1, `#define BILATERAL_BLUR
+#define BILATERAL_BLUR_H
+#define SAMPLES 16
+#define EXPENSIVE ` + (o ? "1" : "0") + `
+`), this._blurHPostProcess.onApply = function(s) {
+ i._scene.activeCamera && (s.setFloat("outSize", i._ssaoCombinePostProcess.width > 0 ? i._ssaoCombinePostProcess.width : i._originalColorPostProcess.width), s.setFloat("near", i._scene.activeCamera.minZ), s.setFloat("far", i._scene.activeCamera.maxZ), s.setFloat("radius", i.radius), i._forceGeometryBuffer ? s.setTexture("depthNormalSampler", i._scene.enableGeometryBufferRenderer().getGBuffer().textures[0]) : s.setTexture("depthNormalSampler", i._prePassRenderer.prePassRT.textures[i._prePassRenderer.getIndex(d.a.PREPASS_DEPTHNORMAL_TEXTURE_TYPE)]), s.setArray("samplerOffsets", i._samplerOffsets));
+ }, this._blurVPostProcess = new _t("BlurV", "ssao2", ["outSize", "samplerOffsets", "near", "far", "radius"], ["depthNormalSampler"], n, null, Ue.a.TRILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1, `#define BILATERAL_BLUR
+#define BILATERAL_BLUR_V
+#define SAMPLES 16
+#define EXPENSIVE ` + (o ? "1" : "0") + `
+`), this._blurVPostProcess.onApply = function(s) {
+ i._scene.activeCamera && (s.setFloat("outSize", i._ssaoCombinePostProcess.height > 0 ? i._ssaoCombinePostProcess.height : i._originalColorPostProcess.height), s.setFloat("near", i._scene.activeCamera.minZ), s.setFloat("far", i._scene.activeCamera.maxZ), s.setFloat("radius", i.radius), i._forceGeometryBuffer ? s.setTexture("depthNormalSampler", i._scene.enableGeometryBufferRenderer().getGBuffer().textures[0]) : s.setTexture("depthNormalSampler", i._prePassRenderer.prePassRT.textures[i._prePassRenderer.getIndex(d.a.PREPASS_DEPTHNORMAL_TEXTURE_TYPE)]), s.setArray("samplerOffsets", i._samplerOffsets));
+ }, this._blurHPostProcess.samples = this.textureSamples, this._blurVPostProcess.samples = this.textureSamples;
+ }, t.prototype._rebuild = function() {
+ r.prototype._rebuild.call(this);
+ }, t.prototype._radicalInverse_VdC = function(e) {
+ return this._bits[0] = e, this._bits[0] = (this._bits[0] << 16 | this._bits[0] >> 16) >>> 0, this._bits[0] = (1431655765 & this._bits[0]) << 1 | (2863311530 & this._bits[0]) >>> 1 >>> 0, this._bits[0] = (858993459 & this._bits[0]) << 2 | (3435973836 & this._bits[0]) >>> 2 >>> 0, this._bits[0] = (252645135 & this._bits[0]) << 4 | (4042322160 & this._bits[0]) >>> 4 >>> 0, this._bits[0] = (16711935 & this._bits[0]) << 8 | (4278255360 & this._bits[0]) >>> 8 >>> 0, 23283064365386963e-26 * this._bits[0];
+ }, t.prototype._hammersley = function(e, n) {
+ return [e / n, this._radicalInverse_VdC(e)];
+ }, t.prototype._hemisphereSample_uniform = function(e, n) {
+ var i = 2 * n * Math.PI, o = 1 - (0.85 * e + 0.15), a = Math.sqrt(1 - o * o);
+ return new c.e(Math.cos(i) * a, Math.sin(i) * a, o);
+ }, t.prototype._generateHemisphere = function() {
+ for (var e, n = this.samples, i = [], o = 0; o < n; ) {
+ if (n < 16)
+ e = this._hemisphereSample_uniform(Math.random(), Math.random());
+ else {
+ var a = this._hammersley(o, n);
+ e = this._hemisphereSample_uniform(a[0], a[1]);
+ }
+ i.push(e.x, e.y, e.z), o++;
+ }
+ return i;
+ }, t.prototype._getDefinesForSSAO = function() {
+ var e = "#define SAMPLES " + this.samples + `
+#define SSAO`;
+ return this._forceGeometryBuffer && (e += `
+#define GEOMETRYBUFFER`), e;
+ }, t.prototype._createSSAOPostProcess = function(e) {
+ var n = this;
+ this._sampleSphere = this._generateHemisphere();
+ var i, o = this._getDefinesForSSAO();
+ i = this._forceGeometryBuffer ? ["randomSampler", "depthSampler", "normalSampler"] : ["randomSampler", "depthNormalSampler"], this._ssaoPostProcess = new _t("ssao2", "ssao2", ["sampleSphere", "samplesFactor", "randTextureTiles", "totalStrength", "radius", "base", "range", "projection", "near", "far", "texelSize", "xViewport", "yViewport", "maxZ", "minZAspect"], i, e, null, Ue.a.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1, o), this._ssaoPostProcess.onApply = function(a) {
+ n._scene.activeCamera && (a.setArray3("sampleSphere", n._sampleSphere), a.setFloat("randTextureTiles", 32), a.setFloat("samplesFactor", 1 / n.samples), a.setFloat("totalStrength", n.totalStrength), a.setFloat2("texelSize", 1 / n._ssaoPostProcess.width, 1 / n._ssaoPostProcess.height), a.setFloat("radius", n.radius), a.setFloat("maxZ", n.maxZ), a.setFloat("minZAspect", n.minZAspect), a.setFloat("base", n.base), a.setFloat("near", n._scene.activeCamera.minZ), a.setFloat("far", n._scene.activeCamera.maxZ), a.setFloat("xViewport", Math.tan(n._scene.activeCamera.fov / 2) * n._scene.getEngine().getAspectRatio(n._scene.activeCamera, !0)), a.setFloat("yViewport", Math.tan(n._scene.activeCamera.fov / 2)), a.setMatrix("projection", n._scene.getProjectionMatrix()), n._forceGeometryBuffer ? (a.setTexture("depthSampler", n._scene.enableGeometryBufferRenderer().getGBuffer().textures[0]), a.setTexture("normalSampler", n._scene.enableGeometryBufferRenderer().getGBuffer().textures[1])) : a.setTexture("depthNormalSampler", n._prePassRenderer.prePassRT.textures[n._prePassRenderer.getIndex(d.a.PREPASS_DEPTHNORMAL_TEXTURE_TYPE)]), a.setTexture("randomSampler", n._randomTexture));
+ }, this._ssaoPostProcess.samples = this.textureSamples;
+ }, t.prototype._createSSAOCombinePostProcess = function(e) {
+ var n = this;
+ this._ssaoCombinePostProcess = new _t("ssaoCombine", "ssaoCombine", [], ["originalColor", "viewport"], e, null, Ue.a.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1), this._ssaoCombinePostProcess.onApply = function(i) {
+ var o = n._scene.activeCamera.viewport;
+ i.setVector4("viewport", c.c.Vector4[0].copyFromFloats(o.x, o.y, o.width, o.height)), i.setTextureFromPostProcessOutput("originalColor", n._originalColorPostProcess);
+ }, this._ssaoCombinePostProcess.samples = this.textureSamples, this._forceGeometryBuffer || (this._ssaoCombinePostProcess._prePassEffectConfiguration = new NE());
+ }, t.prototype._createRandomTexture = function() {
+ this._randomTexture = new $i.a("SSAORandomTexture", 128, this._scene, !1, Ue.a.TRILINEAR_SAMPLINGMODE), this._randomTexture.wrapU = Ue.a.WRAP_ADDRESSMODE, this._randomTexture.wrapV = Ue.a.WRAP_ADDRESSMODE;
+ for (var e = this._randomTexture.getContext(), n = function(s, p) {
+ return Math.random() * (p - s) + s;
+ }, i = c.e.Zero(), o = 0; o < 128; o++)
+ for (var a = 0; a < 128; a++)
+ i.x = n(0, 1), i.y = n(0, 1), i.z = 0, i.normalize(), i.scaleInPlace(255), i.x = Math.floor(i.x), i.y = Math.floor(i.y), e.fillStyle = "rgb(" + i.x + ", " + i.y + ", " + i.z + ")", e.fillRect(o, a, 1, 1);
+ this._randomTexture.update(!1);
+ }, t.prototype.serialize = function() {
+ var e = w.a.Serialize(this);
+ return e.customType = "SSAO2RenderingPipeline", e;
+ }, t.Parse = function(e, n, i) {
+ return w.a.Parse(function() {
+ return new t(e._name, n, e._ratio);
+ }, e, n, i);
+ }, Object(u.c)([Object(w.c)()], t.prototype, "totalStrength", void 0), Object(u.c)([Object(w.c)()], t.prototype, "maxZ", void 0), Object(u.c)([Object(w.c)()], t.prototype, "minZAspect", void 0), Object(u.c)([Object(w.c)("samples")], t.prototype, "_samples", void 0), Object(u.c)([Object(w.c)("textureSamples")], t.prototype, "_textureSamples", void 0), Object(u.c)([Object(w.c)()], t.prototype, "_ratio", void 0), Object(u.c)([Object(w.c)("expensiveBlur")], t.prototype, "_expensiveBlur", void 0), Object(u.c)([Object(w.c)()], t.prototype, "radius", void 0), Object(u.c)([Object(w.c)()], t.prototype, "base", void 0), t;
+ }(Go);
+ x.a.RegisteredTypes["BABYLON.SSAO2RenderingPipeline"] = z_;
+ var UE = `
+uniform sampler2D textureSampler;
+varying vec2 vUV;
+#ifdef SSAO
+uniform sampler2D randomSampler;
+uniform float randTextureTiles;
+uniform float samplesFactor;
+uniform vec3 sampleSphere[SAMPLES];
+uniform float totalStrength;
+uniform float radius;
+uniform float area;
+uniform float fallOff;
+uniform float base;
+vec3 normalFromDepth(float depth,vec2 coords)
+{
+vec2 offset1=vec2(0.0,radius);
+vec2 offset2=vec2(radius,0.0);
+float depth1=texture2D(textureSampler,coords+offset1).r;
+float depth2=texture2D(textureSampler,coords+offset2).r;
+vec3 p1=vec3(offset1,depth1-depth);
+vec3 p2=vec3(offset2,depth2-depth);
+vec3 normal=cross(p1,p2);
+normal.z=-normal.z;
+return normalize(normal);
+}
+void main()
+{
+vec3 random=normalize(texture2D(randomSampler,vUV*randTextureTiles).rgb);
+float depth=texture2D(textureSampler,vUV).r;
+vec3 position=vec3(vUV,depth);
+vec3 normal=normalFromDepth(depth,vUV);
+float radiusDepth=radius/depth;
+float occlusion=0.0;
+vec3 ray;
+vec3 hemiRay;
+float occlusionDepth;
+float difference;
+for (int i=0; i0.0)
+hitCoord-=dir;
+else
+hitCoord+=dir;
+info.color+=texture2D(textureSampler,projectedCoord.xy).rgb;
+}
+projectedCoord=projection*vec4(hitCoord,1.0);
+projectedCoord.xy/=projectedCoord.w;
+projectedCoord.xy=0.5*projectedCoord.xy+vec2(0.5);
+
+info.coords=vec4(projectedCoord.xy,sampledDepth,1.0);
+info.color+=texture2D(textureSampler,projectedCoord.xy).rgb;
+info.color/=float(SMOOTH_STEPS+1);
+return info;
+}
+
+ReflectionInfo getReflectionInfo(vec3 dir,vec3 hitCoord)
+{
+ReflectionInfo info;
+vec4 projectedCoord;
+float sampledDepth;
+dir*=step;
+for(int i=0; i> 0)), e.push("#define SMOOTH_STEPS " + (this._smoothSteps >> 0)), this.updateEffect(e.join(`
+`));
+ }, t._Parse = function(e, n, i, o) {
+ return w.a.Parse(function() {
+ return new t(e.name, i, e.options, n, e.renderTargetSamplingMode, i.getEngine(), e.textureType, e.reusable);
+ }, e, i, o);
+ }, Object(u.c)([Object(w.c)()], t.prototype, "threshold", void 0), Object(u.c)([Object(w.c)()], t.prototype, "strength", void 0), Object(u.c)([Object(w.c)()], t.prototype, "reflectionSpecularFalloffExponent", void 0), Object(u.c)([Object(w.c)()], t.prototype, "step", void 0), Object(u.c)([Object(w.c)()], t.prototype, "roughnessFactor", void 0), Object(u.c)([Object(w.c)()], t.prototype, "enableSmoothReflections", null), Object(u.c)([Object(w.c)()], t.prototype, "reflectionSamples", null), Object(u.c)([Object(w.c)()], t.prototype, "smoothSteps", null), t;
+ }(_t);
+ x.a.RegisteredTypes["BABYLON.ScreenSpaceReflectionPostProcess"] = Wu;
+ var zE = `uniform sampler2D textureSampler;
+varying vec2 vUV;
+#if defined(PASS_POST_PROCESS)
+void main(void)
+{
+vec4 color=texture2D(textureSampler,vUV);
+gl_FragColor=color;
+}
+#endif
+#if defined(DOWN_SAMPLE_X4)
+uniform vec2 dsOffsets[16];
+void main(void)
+{
+vec4 average=vec4(0.0,0.0,0.0,0.0);
+average=texture2D(textureSampler,vUV+dsOffsets[0]);
+average+=texture2D(textureSampler,vUV+dsOffsets[1]);
+average+=texture2D(textureSampler,vUV+dsOffsets[2]);
+average+=texture2D(textureSampler,vUV+dsOffsets[3]);
+average+=texture2D(textureSampler,vUV+dsOffsets[4]);
+average+=texture2D(textureSampler,vUV+dsOffsets[5]);
+average+=texture2D(textureSampler,vUV+dsOffsets[6]);
+average+=texture2D(textureSampler,vUV+dsOffsets[7]);
+average+=texture2D(textureSampler,vUV+dsOffsets[8]);
+average+=texture2D(textureSampler,vUV+dsOffsets[9]);
+average+=texture2D(textureSampler,vUV+dsOffsets[10]);
+average+=texture2D(textureSampler,vUV+dsOffsets[11]);
+average+=texture2D(textureSampler,vUV+dsOffsets[12]);
+average+=texture2D(textureSampler,vUV+dsOffsets[13]);
+average+=texture2D(textureSampler,vUV+dsOffsets[14]);
+average+=texture2D(textureSampler,vUV+dsOffsets[15]);
+average/=16.0;
+gl_FragColor=average;
+}
+#endif
+#if defined(BRIGHT_PASS)
+uniform vec2 dsOffsets[4];
+uniform float brightThreshold;
+void main(void)
+{
+vec4 average=vec4(0.0,0.0,0.0,0.0);
+average=texture2D(textureSampler,vUV+vec2(dsOffsets[0].x,dsOffsets[0].y));
+average+=texture2D(textureSampler,vUV+vec2(dsOffsets[1].x,dsOffsets[1].y));
+average+=texture2D(textureSampler,vUV+vec2(dsOffsets[2].x,dsOffsets[2].y));
+average+=texture2D(textureSampler,vUV+vec2(dsOffsets[3].x,dsOffsets[3].y));
+average*=0.25;
+float luminance=length(average.rgb);
+if (luminanceshadowPixelDepth)
+accumFog+=sunColor*computeScattering(dot(rayDirection,sunDirection));
+currentPosition+=stepL;
+}
+accumFog/=NB_STEPS;
+vec3 color=accumFog*scatteringPower;
+gl_FragColor=vec4(color*exp(color) ,1.0);
+}
+#endif
+#if defined(VLSMERGE)
+uniform sampler2D originalSampler;
+void main(void)
+{
+gl_FragColor=texture2D(originalSampler,vUV)+texture2D(textureSampler,vUV);
+}
+#endif
+#if defined(LUMINANCE)
+uniform vec2 lumOffsets[4];
+void main()
+{
+float average=0.0;
+vec4 color=vec4(0.0);
+float maximum=-1e20;
+vec3 weight=vec3(0.299,0.587,0.114);
+for (int i=0; i<4; i++)
+{
+color=texture2D(textureSampler,vUV+ lumOffsets[i]);
+
+float GreyValue=dot(color.rgb,vec3(0.33,0.33,0.33));
+
+#ifdef WEIGHTED_AVERAGE
+float GreyValue=dot(color.rgb,weight);
+#endif
+#ifdef BRIGHTNESS
+float GreyValue=max(color.r,max(color.g,color.b));
+#endif
+#ifdef HSL_COMPONENT
+float GreyValue=0.5*(max(color.r,max(color.g,color.b))+min(color.r,min(color.g,color.b)));
+#endif
+#ifdef MAGNITUDE
+float GreyValue=length(color.rgb);
+#endif
+maximum=max(maximum,GreyValue);
+average+=(0.25*log(1e-5+GreyValue));
+}
+average=exp(average);
+gl_FragColor=vec4(average,maximum,0.0,1.0);
+}
+#endif
+#if defined(LUMINANCE_DOWN_SAMPLE)
+uniform vec2 dsOffsets[9];
+uniform float halfDestPixelSize;
+#ifdef FINAL_DOWN_SAMPLER
+#include
+#endif
+void main()
+{
+vec4 color=vec4(0.0);
+float average=0.0;
+for (int i=0; i<9; i++)
+{
+color=texture2D(textureSampler,vUV+vec2(halfDestPixelSize,halfDestPixelSize)+dsOffsets[i]);
+average+=color.r;
+}
+average/=9.0;
+#ifdef FINAL_DOWN_SAMPLER
+gl_FragColor=pack(average);
+#else
+gl_FragColor=vec4(average,average,0.0,1.0);
+#endif
+}
+#endif
+#if defined(HDR)
+uniform sampler2D textureAdderSampler;
+uniform float averageLuminance;
+void main()
+{
+vec4 color=texture2D(textureAdderSampler,vUV);
+#ifndef AUTO_EXPOSURE
+vec4 adjustedColor=color/averageLuminance;
+color=adjustedColor;
+color.a=1.0;
+#endif
+gl_FragColor=color;
+}
+#endif
+#if defined(LENS_FLARE)
+#define GHOSTS 3
+uniform sampler2D lensColorSampler;
+uniform float strength;
+uniform float ghostDispersal;
+uniform float haloWidth;
+uniform vec2 resolution;
+uniform float distortionStrength;
+float hash(vec2 p)
+{
+float h=dot(p,vec2(127.1,311.7));
+return -1.0+2.0*fract(sin(h)*43758.5453123);
+}
+float noise(in vec2 p)
+{
+vec2 i=floor(p);
+vec2 f=fract(p);
+vec2 u=f*f*(3.0-2.0*f);
+return mix(mix(hash(i+vec2(0.0,0.0)),
+hash(i+vec2(1.0,0.0)),u.x),
+mix(hash(i+vec2(0.0,1.0)),
+hash(i+vec2(1.0,1.0)),u.x),u.y);
+}
+float fbm(vec2 p)
+{
+float f=0.0;
+f+=0.5000*noise(p); p*=2.02;
+f+=0.2500*noise(p); p*=2.03;
+f+=0.1250*noise(p); p*=2.01;
+f+=0.0625*noise(p); p*=2.04;
+f/=0.9375;
+return f;
+}
+vec3 pattern(vec2 uv)
+{
+vec2 p=-1.0+2.0*uv;
+float p2=dot(p,p);
+float f=fbm(vec2(15.0*p2))/2.0;
+float r=0.2+0.6*sin(12.5*length(uv-vec2(0.5)));
+float g=0.2+0.6*sin(20.5*length(uv-vec2(0.5)));
+float b=0.2+0.6*sin(17.2*length(uv-vec2(0.5)));
+return (1.0-f)*vec3(r,g,b);
+}
+float luminance(vec3 color)
+{
+return dot(color.rgb,vec3(0.2126,0.7152,0.0722));
+}
+vec4 textureDistorted(sampler2D tex,vec2 texcoord,vec2 direction,vec3 distortion)
+{
+return vec4(
+texture2D(tex,texcoord+direction*distortion.r).r,
+texture2D(tex,texcoord+direction*distortion.g).g,
+texture2D(tex,texcoord+direction*distortion.b).b,
+1.0
+);
+}
+void main(void)
+{
+vec2 uv=-vUV+vec2(1.0);
+vec2 ghostDir=(vec2(0.5)-uv)*ghostDispersal;
+vec2 texelSize=1.0/resolution;
+vec3 distortion=vec3(-texelSize.x*distortionStrength,0.0,texelSize.x*distortionStrength);
+vec4 result=vec4(0.0);
+float ghostIndice=1.0;
+for (int i=0; i=nSamples)
+break;
+vec2 offset1=vUV+velocity*(float(i)/float(nSamples-1)-0.5);
+result+=texture2D(textureSampler,offset1);
+}
+gl_FragColor=result/float(nSamples);
+}
+#endif
+`;
+ We.a.ShadersStore.standardPixelShader = zE;
+ var j_ = function(r) {
+ function t(e, n, i, o, a) {
+ o === void 0 && (o = null);
+ var s = r.call(this, n.getEngine(), e) || this;
+ return s.downSampleX4PostProcess = null, s.brightPassPostProcess = null, s.blurHPostProcesses = [], s.blurVPostProcesses = [], s.textureAdderPostProcess = null, s.volumetricLightPostProcess = null, s.volumetricLightSmoothXPostProcess = null, s.volumetricLightSmoothYPostProcess = null, s.volumetricLightMergePostProces = null, s.volumetricLightFinalPostProcess = null, s.luminancePostProcess = null, s.luminanceDownSamplePostProcesses = [], s.hdrPostProcess = null, s.textureAdderFinalPostProcess = null, s.lensFlareFinalPostProcess = null, s.hdrFinalPostProcess = null, s.lensFlarePostProcess = null, s.lensFlareComposePostProcess = null, s.motionBlurPostProcess = null, s.depthOfFieldPostProcess = null, s.fxaaPostProcess = null, s.screenSpaceReflectionPostProcess = null, s.brightThreshold = 1, s.blurWidth = 512, s.horizontalBlur = !1, s.lensTexture = null, s.volumetricLightCoefficient = 0.2, s.volumetricLightPower = 4, s.volumetricLightBlurScale = 64, s.sourceLight = null, s.hdrMinimumLuminance = 1, s.hdrDecreaseRate = 0.5, s.hdrIncreaseRate = 0.5, s.lensColorTexture = null, s.lensFlareStrength = 20, s.lensFlareGhostDispersal = 1.4, s.lensFlareHaloWidth = 0.7, s.lensFlareDistortionStrength = 16, s.lensFlareBlurWidth = 512, s.lensStarTexture = null, s.lensFlareDirtTexture = null, s.depthOfFieldDistance = 10, s.depthOfFieldBlurWidth = 64, s.animations = [], s._currentDepthOfFieldSource = null, s._fixedExposure = 1, s._currentExposure = 1, s._hdrAutoExposure = !1, s._hdrCurrentLuminance = 1, s._motionStrength = 1, s._isObjectBasedMotionBlur = !1, s._camerasToBeAttached = [], s._bloomEnabled = !1, s._depthOfFieldEnabled = !1, s._vlsEnabled = !1, s._lensFlareEnabled = !1, s._hdrEnabled = !1, s._motionBlurEnabled = !1, s._fxaaEnabled = !1, s._screenSpaceReflectionsEnabled = !1, s._motionBlurSamples = 64, s._volumetricLightStepsCount = 50, s._samples = 1, s._cameras = a || n.cameras, s._cameras = s._cameras.slice(), s._camerasToBeAttached = s._cameras.slice(), s._scene = n, s._basePostProcess = o, s._ratio = i, s._floatTextureType = n.getEngine().getCaps().textureFloatRender ? d.a.TEXTURETYPE_FLOAT : d.a.TEXTURETYPE_HALF_FLOAT, n.postProcessRenderPipelineManager.addPipeline(s), s._buildPipeline(), s;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "exposure", { get: function() {
+ return this._fixedExposure;
+ }, set: function(e) {
+ this._fixedExposure = e, this._currentExposure = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "hdrAutoExposure", { get: function() {
+ return this._hdrAutoExposure;
+ }, set: function(e) {
+ if (this._hdrAutoExposure = e, this.hdrPostProcess) {
+ var n = ["#define HDR"];
+ e && n.push("#define AUTO_EXPOSURE"), this.hdrPostProcess.updateEffect(n.join(`
+`));
+ }
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "motionStrength", { get: function() {
+ return this._motionStrength;
+ }, set: function(e) {
+ this._motionStrength = e, this._isObjectBasedMotionBlur && this.motionBlurPostProcess && (this.motionBlurPostProcess.motionStrength = e);
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "objectBasedMotionBlur", { get: function() {
+ return this._isObjectBasedMotionBlur;
+ }, set: function(e) {
+ var n = this._isObjectBasedMotionBlur !== e;
+ this._isObjectBasedMotionBlur = e, n && this._buildPipeline();
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "BloomEnabled", { get: function() {
+ return this._bloomEnabled;
+ }, set: function(e) {
+ this._bloomEnabled !== e && (this._bloomEnabled = e, this._buildPipeline());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "DepthOfFieldEnabled", { get: function() {
+ return this._depthOfFieldEnabled;
+ }, set: function(e) {
+ this._depthOfFieldEnabled !== e && (this._depthOfFieldEnabled = e, this._buildPipeline());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "LensFlareEnabled", { get: function() {
+ return this._lensFlareEnabled;
+ }, set: function(e) {
+ this._lensFlareEnabled !== e && (this._lensFlareEnabled = e, this._buildPipeline());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "HDREnabled", { get: function() {
+ return this._hdrEnabled;
+ }, set: function(e) {
+ this._hdrEnabled !== e && (this._hdrEnabled = e, this._buildPipeline());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "VLSEnabled", { get: function() {
+ return this._vlsEnabled;
+ }, set: function(e) {
+ if (this._vlsEnabled !== e) {
+ if (e && !this._scene.enableGeometryBufferRenderer())
+ return void h.a.Warn("Geometry renderer is not supported, cannot create volumetric lights in Standard Rendering Pipeline");
+ this._vlsEnabled = e, this._buildPipeline();
+ }
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "MotionBlurEnabled", { get: function() {
+ return this._motionBlurEnabled;
+ }, set: function(e) {
+ this._motionBlurEnabled !== e && (this._motionBlurEnabled = e, this._buildPipeline());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "fxaaEnabled", { get: function() {
+ return this._fxaaEnabled;
+ }, set: function(e) {
+ this._fxaaEnabled !== e && (this._fxaaEnabled = e, this._buildPipeline());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "screenSpaceReflectionsEnabled", { get: function() {
+ return this._screenSpaceReflectionsEnabled;
+ }, set: function(e) {
+ this._screenSpaceReflectionsEnabled !== e && (this._screenSpaceReflectionsEnabled = e, this._buildPipeline());
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "volumetricLightStepsCount", { get: function() {
+ return this._volumetricLightStepsCount;
+ }, set: function(e) {
+ this.volumetricLightPostProcess && this.volumetricLightPostProcess.updateEffect(`#define VLS
+#define NB_STEPS ` + e.toFixed(1)), this._volumetricLightStepsCount = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "motionBlurSamples", { get: function() {
+ return this._motionBlurSamples;
+ }, set: function(e) {
+ this.motionBlurPostProcess && (this._isObjectBasedMotionBlur ? this.motionBlurPostProcess.motionBlurSamples = e : this.motionBlurPostProcess.updateEffect(`#define MOTION_BLUR
+#define MAX_MOTION_SAMPLES ` + e.toFixed(1))), this._motionBlurSamples = e;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "samples", { get: function() {
+ return this._samples;
+ }, set: function(e) {
+ this._samples !== e && (this._samples = e, this._buildPipeline());
+ }, enumerable: !1, configurable: !0 }), t.prototype._buildPipeline = function() {
+ var e = this, n = this._ratio, i = this._scene;
+ this._disposePostProcesses(), this._cameras !== null && (this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._cameras), this._cameras = this._camerasToBeAttached.slice()), this._reset(), this._screenSpaceReflectionsEnabled && (this.screenSpaceReflectionPostProcess = new Wu("HDRPass", i, n, null, Ue.a.BILINEAR_SAMPLINGMODE, i.getEngine(), !1, this._floatTextureType), this.screenSpaceReflectionPostProcess.onApplyObservable.add(function() {
+ e._currentDepthOfFieldSource = e.screenSpaceReflectionPostProcess;
+ }), this.addEffect(new Ot(i.getEngine(), "HDRScreenSpaceReflections", function() {
+ return e.screenSpaceReflectionPostProcess;
+ }, !0))), this._basePostProcess ? this.originalPostProcess = this._basePostProcess : this.originalPostProcess = new _t("HDRPass", "standard", [], [], n, null, Ue.a.BILINEAR_SAMPLINGMODE, i.getEngine(), !1, "#define PASS_POST_PROCESS", this._floatTextureType), this.originalPostProcess.autoClear = !this.screenSpaceReflectionPostProcess, this.originalPostProcess.onApplyObservable.add(function() {
+ e._currentDepthOfFieldSource = e.originalPostProcess;
+ }), this.addEffect(new Ot(i.getEngine(), "HDRPassPostProcess", function() {
+ return e.originalPostProcess;
+ }, !0)), this._bloomEnabled && (this._createDownSampleX4PostProcess(i, n / 4), this._createBrightPassPostProcess(i, n / 4), this._createBlurPostProcesses(i, n / 4, 1), this._createTextureAdderPostProcess(i, n), this.textureAdderFinalPostProcess = new _t("HDRDepthOfFieldSource", "standard", [], [], n, null, Ue.a.BILINEAR_SAMPLINGMODE, i.getEngine(), !1, "#define PASS_POST_PROCESS", d.a.TEXTURETYPE_UNSIGNED_INT), this.addEffect(new Ot(i.getEngine(), "HDRBaseDepthOfFieldSource", function() {
+ return e.textureAdderFinalPostProcess;
+ }, !0))), this._vlsEnabled && (this._createVolumetricLightPostProcess(i, n), this.volumetricLightFinalPostProcess = new _t("HDRVLSFinal", "standard", [], [], n, null, Ue.a.BILINEAR_SAMPLINGMODE, i.getEngine(), !1, "#define PASS_POST_PROCESS", d.a.TEXTURETYPE_UNSIGNED_INT), this.addEffect(new Ot(i.getEngine(), "HDRVLSFinal", function() {
+ return e.volumetricLightFinalPostProcess;
+ }, !0))), this._lensFlareEnabled && (this._createLensFlarePostProcess(i, n), this.lensFlareFinalPostProcess = new _t("HDRPostLensFlareDepthOfFieldSource", "standard", [], [], n, null, Ue.a.BILINEAR_SAMPLINGMODE, i.getEngine(), !1, "#define PASS_POST_PROCESS", d.a.TEXTURETYPE_UNSIGNED_INT), this.addEffect(new Ot(i.getEngine(), "HDRPostLensFlareDepthOfFieldSource", function() {
+ return e.lensFlareFinalPostProcess;
+ }, !0))), this._hdrEnabled && (this._createLuminancePostProcesses(i, this._floatTextureType), this._createHdrPostProcess(i, n), this.hdrFinalPostProcess = new _t("HDRPostHDReDepthOfFieldSource", "standard", [], [], n, null, Ue.a.BILINEAR_SAMPLINGMODE, i.getEngine(), !1, "#define PASS_POST_PROCESS", d.a.TEXTURETYPE_UNSIGNED_INT), this.addEffect(new Ot(i.getEngine(), "HDRPostHDReDepthOfFieldSource", function() {
+ return e.hdrFinalPostProcess;
+ }, !0))), this._depthOfFieldEnabled && (this._createBlurPostProcesses(i, n / 2, 3, "depthOfFieldBlurWidth"), this._createDepthOfFieldPostProcess(i, n)), this._motionBlurEnabled && this._createMotionBlurPostProcess(i, n), this._fxaaEnabled && (this.fxaaPostProcess = new Ha("fxaa", 1, null, Ue.a.BILINEAR_SAMPLINGMODE, i.getEngine(), !1, d.a.TEXTURETYPE_UNSIGNED_INT), this.addEffect(new Ot(i.getEngine(), "HDRFxaa", function() {
+ return e.fxaaPostProcess;
+ }, !0))), this._cameras !== null && this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name, this._cameras), !this._enableMSAAOnFirstPostProcess(this._samples) && this._samples > 1 && h.a.Warn("MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0");
+ }, t.prototype._createDownSampleX4PostProcess = function(e, n) {
+ var i = this, o = new Array(32);
+ this.downSampleX4PostProcess = new _t("HDRDownSampleX4", "standard", ["dsOffsets"], [], n, null, Ue.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, "#define DOWN_SAMPLE_X4", this._floatTextureType), this.downSampleX4PostProcess.onApply = function(a) {
+ for (var s = 0, p = i.downSampleX4PostProcess.width, m = i.downSampleX4PostProcess.height, S = -2; S < 2; S++)
+ for (var O = -2; O < 2; O++)
+ o[s] = (S + 0.5) * (1 / p), o[s + 1] = (O + 0.5) * (1 / m), s += 2;
+ a.setArray2("dsOffsets", o);
+ }, this.addEffect(new Ot(e.getEngine(), "HDRDownSampleX4", function() {
+ return i.downSampleX4PostProcess;
+ }, !0));
+ }, t.prototype._createBrightPassPostProcess = function(e, n) {
+ var i = this, o = new Array(8);
+ this.brightPassPostProcess = new _t("HDRBrightPass", "standard", ["dsOffsets", "brightThreshold"], [], n, null, Ue.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, "#define BRIGHT_PASS", this._floatTextureType), this.brightPassPostProcess.onApply = function(a) {
+ var s = 1 / i.brightPassPostProcess.width, p = 1 / i.brightPassPostProcess.height;
+ o[0] = -0.5 * s, o[1] = 0.5 * p, o[2] = 0.5 * s, o[3] = 0.5 * p, o[4] = -0.5 * s, o[5] = -0.5 * p, o[6] = 0.5 * s, o[7] = -0.5 * p, a.setArray2("dsOffsets", o), a.setFloat("brightThreshold", i.brightThreshold);
+ }, this.addEffect(new Ot(e.getEngine(), "HDRBrightPass", function() {
+ return i.brightPassPostProcess;
+ }, !0));
+ }, t.prototype._createBlurPostProcesses = function(e, n, i, o) {
+ var a = this;
+ o === void 0 && (o = "blurWidth");
+ var s = e.getEngine(), p = new xn("HDRBlurH_" + i, new c.d(1, 0), this[o], n, null, Ue.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, this._floatTextureType), m = new xn("HDRBlurV_" + i, new c.d(0, 1), this[o], n, null, Ue.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, this._floatTextureType);
+ p.onActivateObservable.add(function() {
+ var S = p.width / s.getRenderWidth();
+ p.kernel = a[o] * S;
+ }), m.onActivateObservable.add(function() {
+ var S = m.height / s.getRenderHeight();
+ m.kernel = a.horizontalBlur ? 64 * S : a[o] * S;
+ }), this.addEffect(new Ot(e.getEngine(), "HDRBlurH" + i, function() {
+ return p;
+ }, !0)), this.addEffect(new Ot(e.getEngine(), "HDRBlurV" + i, function() {
+ return m;
+ }, !0)), this.blurHPostProcesses.push(p), this.blurVPostProcesses.push(m);
+ }, t.prototype._createTextureAdderPostProcess = function(e, n) {
+ var i = this;
+ this.textureAdderPostProcess = new _t("HDRTextureAdder", "standard", ["exposure"], ["otherSampler", "lensSampler"], n, null, Ue.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, "#define TEXTURE_ADDER", this._floatTextureType), this.textureAdderPostProcess.onApply = function(o) {
+ o.setTextureFromPostProcess("otherSampler", i._vlsEnabled ? i._currentDepthOfFieldSource : i.originalPostProcess), o.setTexture("lensSampler", i.lensTexture), o.setFloat("exposure", i._currentExposure), i._currentDepthOfFieldSource = i.textureAdderFinalPostProcess;
+ }, this.addEffect(new Ot(e.getEngine(), "HDRTextureAdder", function() {
+ return i.textureAdderPostProcess;
+ }, !0));
+ }, t.prototype._createVolumetricLightPostProcess = function(e, n) {
+ var i = this, o = e.enableGeometryBufferRenderer();
+ o.enablePosition = !0;
+ var a = o.getGBuffer();
+ this.volumetricLightPostProcess = new _t("HDRVLS", "standard", ["shadowViewProjection", "cameraPosition", "sunDirection", "sunColor", "scatteringCoefficient", "scatteringPower", "depthValues"], ["shadowMapSampler", "positionSampler"], n / 8, null, Ue.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, `#define VLS
+#define NB_STEPS ` + this._volumetricLightStepsCount.toFixed(1));
+ var s = c.d.Zero();
+ this.volumetricLightPostProcess.onApply = function(p) {
+ if (i.sourceLight && i.sourceLight.getShadowGenerator() && i._scene.activeCamera) {
+ var m = i.sourceLight.getShadowGenerator();
+ p.setTexture("shadowMapSampler", m.getShadowMap()), p.setTexture("positionSampler", a.textures[2]), p.setColor3("sunColor", i.sourceLight.diffuse), p.setVector3("sunDirection", i.sourceLight.getShadowDirection()), p.setVector3("cameraPosition", i._scene.activeCamera.globalPosition), p.setMatrix("shadowViewProjection", m.getTransformMatrix()), p.setFloat("scatteringCoefficient", i.volumetricLightCoefficient), p.setFloat("scatteringPower", i.volumetricLightPower), s.x = i.sourceLight.getDepthMinZ(i._scene.activeCamera), s.y = i.sourceLight.getDepthMaxZ(i._scene.activeCamera), p.setVector2("depthValues", s);
+ }
+ }, this.addEffect(new Ot(e.getEngine(), "HDRVLS", function() {
+ return i.volumetricLightPostProcess;
+ }, !0)), this._createBlurPostProcesses(e, n / 4, 0, "volumetricLightBlurScale"), this.volumetricLightMergePostProces = new _t("HDRVLSMerge", "standard", [], ["originalSampler"], n, null, Ue.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, "#define VLSMERGE"), this.volumetricLightMergePostProces.onApply = function(p) {
+ p.setTextureFromPostProcess("originalSampler", i._bloomEnabled ? i.textureAdderFinalPostProcess : i.originalPostProcess), i._currentDepthOfFieldSource = i.volumetricLightFinalPostProcess;
+ }, this.addEffect(new Ot(e.getEngine(), "HDRVLSMerge", function() {
+ return i.volumetricLightMergePostProces;
+ }, !0));
+ }, t.prototype._createLuminancePostProcesses = function(e, n) {
+ var i = this, o = Math.pow(3, t.LuminanceSteps);
+ this.luminancePostProcess = new _t("HDRLuminance", "standard", ["lumOffsets"], [], { width: o, height: o }, null, Ue.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, "#define LUMINANCE", n);
+ var a = [];
+ this.luminancePostProcess.onApply = function(O) {
+ var I = 1 / i.luminancePostProcess.width, G = 1 / i.luminancePostProcess.height;
+ a[0] = -0.5 * I, a[1] = 0.5 * G, a[2] = 0.5 * I, a[3] = 0.5 * G, a[4] = -0.5 * I, a[5] = -0.5 * G, a[6] = 0.5 * I, a[7] = -0.5 * G, O.setArray2("lumOffsets", a);
+ }, this.addEffect(new Ot(e.getEngine(), "HDRLuminance", function() {
+ return i.luminancePostProcess;
+ }, !0));
+ for (var s = t.LuminanceSteps - 1; s >= 0; s--) {
+ o = Math.pow(3, s);
+ var p = `#define LUMINANCE_DOWN_SAMPLE
+`;
+ s === 0 && (p += "#define FINAL_DOWN_SAMPLER");
+ var m = new _t("HDRLuminanceDownSample" + s, "standard", ["dsOffsets", "halfDestPixelSize"], [], { width: o, height: o }, null, Ue.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, p, n);
+ this.luminanceDownSamplePostProcesses.push(m);
+ }
+ var S = this.luminancePostProcess;
+ this.luminanceDownSamplePostProcesses.forEach(function(O, I) {
+ var G = new Array(18);
+ O.onApply = function(k) {
+ if (S) {
+ for (var K = 0, re = -1; re < 2; re++)
+ for (var se = -1; se < 2; se++)
+ G[K] = re / S.width, G[K + 1] = se / S.height, K += 2;
+ k.setArray2("dsOffsets", G), k.setFloat("halfDestPixelSize", 0.5 / S.width), S = I === i.luminanceDownSamplePostProcesses.length - 1 ? i.luminancePostProcess : O;
+ }
+ }, I === i.luminanceDownSamplePostProcesses.length - 1 && (O.onAfterRender = function() {
+ var k = e.getEngine().readPixels(0, 0, 1, 1), K = new c.f(1 / 16581375, 1 / 65025, 1 / 255, 1);
+ i._hdrCurrentLuminance = (k[0] * K.x + k[1] * K.y + k[2] * K.z + k[3] * K.w) / 100;
+ }), i.addEffect(new Ot(e.getEngine(), "HDRLuminanceDownSample" + I, function() {
+ return O;
+ }, !0));
+ });
+ }, t.prototype._createHdrPostProcess = function(e, n) {
+ var i = this, o = ["#define HDR"];
+ this._hdrAutoExposure && o.push("#define AUTO_EXPOSURE"), this.hdrPostProcess = new _t("HDR", "standard", ["averageLuminance"], ["textureAdderSampler"], n, null, Ue.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, o.join(`
+`), d.a.TEXTURETYPE_UNSIGNED_INT);
+ var a = 1, s = 0, p = 0;
+ this.hdrPostProcess.onApply = function(m) {
+ if (m.setTextureFromPostProcess("textureAdderSampler", i._currentDepthOfFieldSource), s += e.getEngine().getDeltaTime(), a < 0)
+ a = i._hdrCurrentLuminance;
+ else {
+ var S = (p - s) / 1e3;
+ i._hdrCurrentLuminance < a + i.hdrDecreaseRate * S ? a += i.hdrDecreaseRate * S : i._hdrCurrentLuminance > a - i.hdrIncreaseRate * S ? a -= i.hdrIncreaseRate * S : a = i._hdrCurrentLuminance;
+ }
+ i.hdrAutoExposure ? i._currentExposure = i._fixedExposure / a : (a = ee.a.Clamp(a, i.hdrMinimumLuminance, 1e20), m.setFloat("averageLuminance", a)), p = s, i._currentDepthOfFieldSource = i.hdrFinalPostProcess;
+ }, this.addEffect(new Ot(e.getEngine(), "HDR", function() {
+ return i.hdrPostProcess;
+ }, !0));
+ }, t.prototype._createLensFlarePostProcess = function(e, n) {
+ var i = this;
+ this.lensFlarePostProcess = new _t("HDRLensFlare", "standard", ["strength", "ghostDispersal", "haloWidth", "resolution", "distortionStrength"], ["lensColorSampler"], n / 2, null, Ue.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, "#define LENS_FLARE", d.a.TEXTURETYPE_UNSIGNED_INT), this.addEffect(new Ot(e.getEngine(), "HDRLensFlare", function() {
+ return i.lensFlarePostProcess;
+ }, !0)), this._createBlurPostProcesses(e, n / 4, 2, "lensFlareBlurWidth"), this.lensFlareComposePostProcess = new _t("HDRLensFlareCompose", "standard", ["lensStarMatrix"], ["otherSampler", "lensDirtSampler", "lensStarSampler"], n, null, Ue.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, "#define LENS_FLARE_COMPOSE", d.a.TEXTURETYPE_UNSIGNED_INT), this.addEffect(new Ot(e.getEngine(), "HDRLensFlareCompose", function() {
+ return i.lensFlareComposePostProcess;
+ }, !0));
+ var o = new c.d(0, 0);
+ this.lensFlarePostProcess.onApply = function(p) {
+ p.setTextureFromPostProcess("textureSampler", i._bloomEnabled ? i.blurHPostProcesses[0] : i.originalPostProcess), p.setTexture("lensColorSampler", i.lensColorTexture), p.setFloat("strength", i.lensFlareStrength), p.setFloat("ghostDispersal", i.lensFlareGhostDispersal), p.setFloat("haloWidth", i.lensFlareHaloWidth), o.x = i.lensFlarePostProcess.width, o.y = i.lensFlarePostProcess.height, p.setVector2("resolution", o), p.setFloat("distortionStrength", i.lensFlareDistortionStrength);
+ };
+ var a = c.a.FromValues(2, 0, -1, 0, 0, 2, -1, 0, 0, 0, 1, 0, 0, 0, 0, 1), s = c.a.FromValues(0.5, 0, 0.5, 0, 0, 0.5, 0.5, 0, 0, 0, 1, 0, 0, 0, 0, 1);
+ this.lensFlareComposePostProcess.onApply = function(p) {
+ if (i._scene.activeCamera) {
+ p.setTextureFromPostProcess("otherSampler", i.lensFlarePostProcess), p.setTexture("lensDirtSampler", i.lensFlareDirtTexture), p.setTexture("lensStarSampler", i.lensStarTexture);
+ var m = i._scene.activeCamera.getViewMatrix().getRow(0), S = i._scene.activeCamera.getViewMatrix().getRow(2), O = c.e.Dot(m.toVector3(), new c.e(1, 0, 0)) + c.e.Dot(S.toVector3(), new c.e(0, 0, 1));
+ O *= 4;
+ var I = c.a.FromValues(0.5 * Math.cos(O), -Math.sin(O), 0, 0, Math.sin(O), 0.5 * Math.cos(O), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), G = s.multiply(I).multiply(a);
+ p.setMatrix("lensStarMatrix", G), i._currentDepthOfFieldSource = i.lensFlareFinalPostProcess;
+ }
+ };
+ }, t.prototype._createDepthOfFieldPostProcess = function(e, n) {
+ var i = this;
+ this.depthOfFieldPostProcess = new _t("HDRDepthOfField", "standard", ["distance"], ["otherSampler", "depthSampler"], n, null, Ue.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, "#define DEPTH_OF_FIELD", d.a.TEXTURETYPE_UNSIGNED_INT), this.depthOfFieldPostProcess.onApply = function(o) {
+ o.setTextureFromPostProcess("otherSampler", i._currentDepthOfFieldSource), o.setTexture("depthSampler", i._getDepthTexture()), o.setFloat("distance", i.depthOfFieldDistance);
+ }, this.addEffect(new Ot(e.getEngine(), "HDRDepthOfField", function() {
+ return i.depthOfFieldPostProcess;
+ }, !0));
+ }, t.prototype._createMotionBlurPostProcess = function(e, n) {
+ var i = this;
+ if (this._isObjectBasedMotionBlur) {
+ var o = new ju("HDRMotionBlur", e, n, null, Ue.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, d.a.TEXTURETYPE_UNSIGNED_INT);
+ o.motionStrength = this.motionStrength, o.motionBlurSamples = this.motionBlurSamples, this.motionBlurPostProcess = o;
+ } else {
+ this.motionBlurPostProcess = new _t("HDRMotionBlur", "standard", ["inverseViewProjection", "prevViewProjection", "screenSize", "motionScale", "motionStrength"], ["depthSampler"], n, null, Ue.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, `#define MOTION_BLUR
+#define MAX_MOTION_SAMPLES ` + this.motionBlurSamples.toFixed(1), d.a.TEXTURETYPE_UNSIGNED_INT);
+ var a = 0, s = c.a.Identity(), p = c.a.Identity(), m = c.a.Identity(), S = c.d.Zero();
+ this.motionBlurPostProcess.onApply = function(O) {
+ (m = e.getProjectionMatrix().multiply(e.getViewMatrix())).invertToRef(p), O.setMatrix("inverseViewProjection", p), O.setMatrix("prevViewProjection", s), s = m, S.x = i.motionBlurPostProcess.width, S.y = i.motionBlurPostProcess.height, O.setVector2("screenSize", S), a = e.getEngine().getFps() / 60, O.setFloat("motionScale", a), O.setFloat("motionStrength", i.motionStrength), O.setTexture("depthSampler", i._getDepthTexture());
+ };
+ }
+ this.addEffect(new Ot(e.getEngine(), "HDRMotionBlur", function() {
+ return i.motionBlurPostProcess;
+ }, !0));
+ }, t.prototype._getDepthTexture = function() {
+ return this._scene.getEngine().getCaps().drawBuffersExtension ? this._scene.enableGeometryBufferRenderer().getGBuffer().textures[0] : this._scene.enableDepthRenderer().getDepthMap();
+ }, t.prototype._disposePostProcesses = function() {
+ for (var e = 0; e < this._cameras.length; e++) {
+ var n = this._cameras[e];
+ this.originalPostProcess && this.originalPostProcess.dispose(n), this.screenSpaceReflectionPostProcess && this.screenSpaceReflectionPostProcess.dispose(n), this.downSampleX4PostProcess && this.downSampleX4PostProcess.dispose(n), this.brightPassPostProcess && this.brightPassPostProcess.dispose(n), this.textureAdderPostProcess && this.textureAdderPostProcess.dispose(n), this.volumetricLightPostProcess && this.volumetricLightPostProcess.dispose(n), this.volumetricLightSmoothXPostProcess && this.volumetricLightSmoothXPostProcess.dispose(n), this.volumetricLightSmoothYPostProcess && this.volumetricLightSmoothYPostProcess.dispose(n), this.volumetricLightMergePostProces && this.volumetricLightMergePostProces.dispose(n), this.volumetricLightFinalPostProcess && this.volumetricLightFinalPostProcess.dispose(n), this.lensFlarePostProcess && this.lensFlarePostProcess.dispose(n), this.lensFlareComposePostProcess && this.lensFlareComposePostProcess.dispose(n);
+ for (var i = 0; i < this.luminanceDownSamplePostProcesses.length; i++)
+ this.luminanceDownSamplePostProcesses[i].dispose(n);
+ for (this.luminancePostProcess && this.luminancePostProcess.dispose(n), this.hdrPostProcess && this.hdrPostProcess.dispose(n), this.hdrFinalPostProcess && this.hdrFinalPostProcess.dispose(n), this.depthOfFieldPostProcess && this.depthOfFieldPostProcess.dispose(n), this.motionBlurPostProcess && this.motionBlurPostProcess.dispose(n), this.fxaaPostProcess && this.fxaaPostProcess.dispose(n), i = 0; i < this.blurHPostProcesses.length; i++)
+ this.blurHPostProcesses[i].dispose(n);
+ for (i = 0; i < this.blurVPostProcesses.length; i++)
+ this.blurVPostProcesses[i].dispose(n);
+ }
+ this.originalPostProcess = null, this.downSampleX4PostProcess = null, this.brightPassPostProcess = null, this.textureAdderPostProcess = null, this.textureAdderFinalPostProcess = null, this.volumetricLightPostProcess = null, this.volumetricLightSmoothXPostProcess = null, this.volumetricLightSmoothYPostProcess = null, this.volumetricLightMergePostProces = null, this.volumetricLightFinalPostProcess = null, this.lensFlarePostProcess = null, this.lensFlareComposePostProcess = null, this.luminancePostProcess = null, this.hdrPostProcess = null, this.hdrFinalPostProcess = null, this.depthOfFieldPostProcess = null, this.motionBlurPostProcess = null, this.fxaaPostProcess = null, this.screenSpaceReflectionPostProcess = null, this.luminanceDownSamplePostProcesses = [], this.blurHPostProcesses = [], this.blurVPostProcesses = [];
+ }, t.prototype.dispose = function() {
+ this._disposePostProcesses(), this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._cameras), r.prototype.dispose.call(this);
+ }, t.prototype.serialize = function() {
+ var e = w.a.Serialize(this);
+ return this.sourceLight && (e.sourceLightId = this.sourceLight.id), this.screenSpaceReflectionPostProcess && (e.screenSpaceReflectionPostProcess = w.a.Serialize(this.screenSpaceReflectionPostProcess)), e.customType = "StandardRenderingPipeline", e;
+ }, t.Parse = function(e, n, i) {
+ var o = w.a.Parse(function() {
+ return new t(e._name, n, e._ratio);
+ }, e, n, i);
+ return e.sourceLightId && (o.sourceLight = n.getLightByID(e.sourceLightId)), e.screenSpaceReflectionPostProcess && w.a.Parse(function() {
+ return o.screenSpaceReflectionPostProcess;
+ }, e.screenSpaceReflectionPostProcess, n, i), o;
+ }, t.LuminanceSteps = 6, Object(u.c)([Object(w.c)()], t.prototype, "brightThreshold", void 0), Object(u.c)([Object(w.c)()], t.prototype, "blurWidth", void 0), Object(u.c)([Object(w.c)()], t.prototype, "horizontalBlur", void 0), Object(u.c)([Object(w.c)()], t.prototype, "exposure", null), Object(u.c)([Object(w.m)("lensTexture")], t.prototype, "lensTexture", void 0), Object(u.c)([Object(w.c)()], t.prototype, "volumetricLightCoefficient", void 0), Object(u.c)([Object(w.c)()], t.prototype, "volumetricLightPower", void 0), Object(u.c)([Object(w.c)()], t.prototype, "volumetricLightBlurScale", void 0), Object(u.c)([Object(w.c)()], t.prototype, "hdrMinimumLuminance", void 0), Object(u.c)([Object(w.c)()], t.prototype, "hdrDecreaseRate", void 0), Object(u.c)([Object(w.c)()], t.prototype, "hdrIncreaseRate", void 0), Object(u.c)([Object(w.c)()], t.prototype, "hdrAutoExposure", null), Object(u.c)([Object(w.m)("lensColorTexture")], t.prototype, "lensColorTexture", void 0), Object(u.c)([Object(w.c)()], t.prototype, "lensFlareStrength", void 0), Object(u.c)([Object(w.c)()], t.prototype, "lensFlareGhostDispersal", void 0), Object(u.c)([Object(w.c)()], t.prototype, "lensFlareHaloWidth", void 0), Object(u.c)([Object(w.c)()], t.prototype, "lensFlareDistortionStrength", void 0), Object(u.c)([Object(w.c)()], t.prototype, "lensFlareBlurWidth", void 0), Object(u.c)([Object(w.m)("lensStarTexture")], t.prototype, "lensStarTexture", void 0), Object(u.c)([Object(w.m)("lensFlareDirtTexture")], t.prototype, "lensFlareDirtTexture", void 0), Object(u.c)([Object(w.c)()], t.prototype, "depthOfFieldDistance", void 0), Object(u.c)([Object(w.c)()], t.prototype, "depthOfFieldBlurWidth", void 0), Object(u.c)([Object(w.c)()], t.prototype, "motionStrength", null), Object(u.c)([Object(w.c)()], t.prototype, "objectBasedMotionBlur", null), Object(u.c)([Object(w.c)()], t.prototype, "_ratio", void 0), Object(u.c)([Object(w.c)()], t.prototype, "BloomEnabled", null), Object(u.c)([Object(w.c)()], t.prototype, "DepthOfFieldEnabled", null), Object(u.c)([Object(w.c)()], t.prototype, "LensFlareEnabled", null), Object(u.c)([Object(w.c)()], t.prototype, "HDREnabled", null), Object(u.c)([Object(w.c)()], t.prototype, "VLSEnabled", null), Object(u.c)([Object(w.c)()], t.prototype, "MotionBlurEnabled", null), Object(u.c)([Object(w.c)()], t.prototype, "fxaaEnabled", null), Object(u.c)([Object(w.c)()], t.prototype, "screenSpaceReflectionsEnabled", null), Object(u.c)([Object(w.c)()], t.prototype, "volumetricLightStepsCount", null), Object(u.c)([Object(w.c)()], t.prototype, "motionBlurSamples", null), Object(u.c)([Object(w.c)()], t.prototype, "samples", null), t;
+ }(Go);
+ x.a.RegisteredTypes["BABYLON.StandardRenderingPipeline"] = j_;
+ var jE = `const vec3 TWO=vec3(2.0,2.0,2.0);
+varying vec2 vUV;
+uniform sampler2D camASampler;
+uniform sampler2D textureSampler;
+uniform vec2 stepSize;
+void main(void)
+{
+bool useCamA;
+bool useCamB;
+vec2 texCoord1;
+vec2 texCoord2;
+vec3 frag1;
+vec3 frag2;
+#ifdef IS_STEREOSCOPIC_HORIZ
+useCamB=vUV.x>0.5;
+useCamA=!useCamB;
+texCoord1=vec2(useCamB ? (vUV.x-0.5)*2.0 : vUV.x*2.0,vUV.y);
+texCoord2=vec2(texCoord1.x+stepSize.x,vUV.y);
+#else
+#ifdef IS_STEREOSCOPIC_INTERLACED
+float rowNum=floor(vUV.y/stepSize.y);
+useCamA=mod(rowNum,2.0) == 1.0;
+useCamB=mod(rowNum,2.0) == 0.0;
+texCoord1=vec2(vUV.x,vUV.y);
+texCoord2=vec2(vUV.x,vUV.y);
+#else
+useCamB=vUV.y>0.5;
+useCamA=!useCamB;
+texCoord1=vec2(vUV.x,useCamB ? (vUV.y-0.5)*2.0 : vUV.y*2.0);
+texCoord2=vec2(vUV.x,texCoord1.y+stepSize.y);
+#endif
+#endif
+
+if (useCamB){
+frag1=texture2D(textureSampler,texCoord1).rgb;
+frag2=texture2D(textureSampler,texCoord2).rgb;
+}else if (useCamA){
+frag1=texture2D(camASampler ,texCoord1).rgb;
+frag2=texture2D(camASampler ,texCoord2).rgb;
+}else {
+discard;
+}
+gl_FragColor=vec4((frag1+frag2)/TWO,1.0);
+}
+`;
+ We.a.ShadersStore.stereoscopicInterlacePixelShader = jE;
+ var HE = function(r) {
+ function t(e, n, i, o, a, s, p) {
+ var m = r.call(this, e, "stereoscopicInterlace", ["stepSize"], ["camASampler"], 1, n[1], a, s, p, o ? "#define IS_STEREOSCOPIC_INTERLACED 1" : i ? "#define IS_STEREOSCOPIC_HORIZ 1" : void 0) || this;
+ return m._passedProcess = n[0]._rigPostProcess, m._stepSize = new c.d(1 / m.width, 1 / m.height), m.onSizeChangedObservable.add(function() {
+ m._stepSize = new c.d(1 / m.width, 1 / m.height);
+ }), m.onApplyObservable.add(function(S) {
+ S.setTextureFromPostProcess("camASampler", m._passedProcess), S.setFloat2("stepSize", m._stepSize.x, m._stepSize.y);
+ }), m;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "StereoscopicInterlacePostProcessI";
+ }, t;
+ }(_t), WE = function(r) {
+ function t(e, n, i, o, a, s) {
+ var p = r.call(this, e, "stereoscopicInterlace", ["stepSize"], ["camASampler"], 1, n[1], o, a, s, i ? "#define IS_STEREOSCOPIC_HORIZ 1" : void 0) || this;
+ return p._passedProcess = n[0]._rigPostProcess, p._stepSize = new c.d(1 / p.width, 1 / p.height), p.onSizeChangedObservable.add(function() {
+ p._stepSize = new c.d(1 / p.width, 1 / p.height);
+ }), p.onApplyObservable.add(function(m) {
+ m.setTextureFromPostProcess("camASampler", p._passedProcess), m.setFloat2("stepSize", p._stepSize.x, p._stepSize.y);
+ }), p;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "StereoscopicInterlacePostProcess";
+ }, t;
+ }(_t), XE = `
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+
+uniform float _ExposureAdjustment;
+#if defined(HABLE_TONEMAPPING)
+const float A=0.15;
+const float B=0.50;
+const float C=0.10;
+const float D=0.20;
+const float E=0.02;
+const float F=0.30;
+const float W=11.2;
+#endif
+float Luminance(vec3 c)
+{
+return dot(c,vec3(0.22,0.707,0.071));
+}
+void main(void)
+{
+vec3 colour=texture2D(textureSampler,vUV).rgb;
+#if defined(REINHARD_TONEMAPPING)
+float lum=Luminance(colour.rgb);
+float lumTm=lum*_ExposureAdjustment;
+float scale=lumTm/(1.0+lumTm);
+colour*=scale/lum;
+#elif defined(HABLE_TONEMAPPING)
+colour*=_ExposureAdjustment;
+const float ExposureBias=2.0;
+vec3 x=ExposureBias*colour;
+vec3 curr=((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;
+x=vec3(W,W,W);
+vec3 whiteScale=1.0/(((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F);
+colour=curr*whiteScale;
+#elif defined(OPTIMIZED_HEJIDAWSON_TONEMAPPING)
+colour*=_ExposureAdjustment;
+vec3 X=max(vec3(0.0,0.0,0.0),colour-0.004);
+vec3 retColor=(X*(6.2*X+0.5))/(X*(6.2*X+1.7)+0.06);
+colour=retColor*retColor;
+#elif defined(PHOTOGRAPHIC_TONEMAPPING)
+colour=vec3(1.0,1.0,1.0)-exp2(-_ExposureAdjustment*colour);
+#endif
+gl_FragColor=vec4(colour.rgb,1.0);
+}`;
+ We.a.ShadersStore.tonemapPixelShader = XE;
+ var Zr;
+ (function(r) {
+ r[r.Hable = 0] = "Hable", r[r.Reinhard = 1] = "Reinhard", r[r.HejiDawson = 2] = "HejiDawson", r[r.Photographic = 3] = "Photographic";
+ })(Zr || (Zr = {}));
+ var YE = function(r) {
+ function t(e, n, i, o, a, s, p) {
+ a === void 0 && (a = d.a.TEXTURE_BILINEAR_SAMPLINGMODE), p === void 0 && (p = d.a.TEXTURETYPE_UNSIGNED_INT);
+ var m = r.call(this, e, "tonemap", ["_ExposureAdjustment"], null, 1, o, a, s, !0, null, p) || this;
+ m._operator = n, m.exposureAdjustment = i;
+ var S = "#define ";
+ return m._operator === Zr.Hable ? S += "HABLE_TONEMAPPING" : m._operator === Zr.Reinhard ? S += "REINHARD_TONEMAPPING" : m._operator === Zr.HejiDawson ? S += "OPTIMIZED_HEJIDAWSON_TONEMAPPING" : m._operator === Zr.Photographic && (S += "PHOTOGRAPHIC_TONEMAPPING"), m.updateEffect(S), m.onApply = function(O) {
+ O.setFloat("_ExposureAdjustment", m.exposureAdjustment);
+ }, m;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "TonemapPostProcess";
+ }, t;
+ }(_t), KE = `uniform sampler2D textureSampler;
+uniform sampler2D lightScatteringSampler;
+uniform float decay;
+uniform float exposure;
+uniform float weight;
+uniform float density;
+uniform vec2 meshPositionOnScreen;
+varying vec2 vUV;
+void main(void) {
+vec2 tc=vUV;
+vec2 deltaTexCoord=(tc-meshPositionOnScreen.xy);
+deltaTexCoord*=1.0/float(NUM_SAMPLES)*density;
+float illuminationDecay=1.0;
+vec4 color=texture2D(lightScatteringSampler,tc)*0.4;
+for(int i=0; i
+#include
+#include[0..maxSimultaneousMorphTargets]
+
+#include
+uniform mat4 viewProjection;
+uniform vec2 depthValues;
+#if defined(ALPHATEST) || defined(NEED_UV)
+varying vec2 vUV;
+uniform mat4 diffuseMatrix;
+#ifdef UV1
+attribute vec2 uv;
+#endif
+#ifdef UV2
+attribute vec2 uv2;
+#endif
+#endif
+void main(void)
+{
+vec3 positionUpdated=position;
+#if (defined(ALPHATEST) || defined(NEED_UV)) && defined(UV1)
+vec2 uvUpdated=uv;
+#endif
+#include[0..maxSimultaneousMorphTargets]
+#include
+#include
+gl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);
+#if defined(ALPHATEST) || defined(BASIC_RENDER)
+#ifdef UV1
+vUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));
+#endif
+#ifdef UV2
+vUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));
+#endif
+#endif
+}
+`;
+ We.a.ShadersStore.volumetricLightScatteringPassVertexShader = QE;
+ var qE = `#if defined(ALPHATEST) || defined(NEED_UV)
+varying vec2 vUV;
+#endif
+#if defined(ALPHATEST)
+uniform sampler2D diffuseSampler;
+#endif
+void main(void)
+{
+#if defined(ALPHATEST)
+vec4 diffuseColor=texture2D(diffuseSampler,vUV);
+if (diffuseColor.a<0.4)
+discard;
+#endif
+gl_FragColor=vec4(0.0,0.0,0.0,1.0);
+}
+`;
+ We.a.ShadersStore.volumetricLightScatteringPassPixelShader = qE;
+ var H_ = function(r) {
+ function t(e, n, i, o, a, s, p, m, S) {
+ a === void 0 && (a = 100), s === void 0 && (s = Ue.a.BILINEAR_SAMPLINGMODE);
+ var O = r.call(this, e, "volumetricLightScattering", ["decay", "exposure", "weight", "meshPositionOnScreen", "density"], ["lightScatteringSampler"], n.postProcessRatio || n, i, s, p, m, "#define NUM_SAMPLES " + a) || this;
+ return O._screenCoordinates = c.d.Zero(), O.customMeshPosition = c.e.Zero(), O.useCustomMeshPosition = !1, O.invert = !0, O.excludedMeshes = new Array(), O.exposure = 0.3, O.decay = 0.96815, O.weight = 0.58767, O.density = 0.926, p = (S = i === null ? S : i.getScene()).getEngine(), O._viewPort = new li.a(0, 0, 1, 1).toGlobal(p.getRenderWidth(), p.getRenderHeight()), O.mesh = o !== null ? o : t.CreateDefaultMesh("VolumetricLightScatteringMesh", S), O._createPass(S, n.passRatio || n), O.onActivate = function(I) {
+ O.isSupported || O.dispose(I), O.onActivate = null;
+ }, O.onApplyObservable.add(function(I) {
+ O._updateMeshScreenCoordinates(S), I.setTexture("lightScatteringSampler", O._volumetricLightScatteringRTT), I.setFloat("exposure", O.exposure), I.setFloat("decay", O.decay), I.setFloat("weight", O.weight), I.setFloat("density", O.density), I.setVector2("meshPositionOnScreen", O._screenCoordinates);
+ }), O;
+ }
+ return Object(u.d)(t, r), Object.defineProperty(t.prototype, "useDiffuseColor", { get: function() {
+ return h.a.Warn("VolumetricLightScatteringPostProcess.useDiffuseColor is no longer used, use the mesh material directly instead"), !1;
+ }, set: function(e) {
+ h.a.Warn("VolumetricLightScatteringPostProcess.useDiffuseColor is no longer used, use the mesh material directly instead");
+ }, enumerable: !1, configurable: !0 }), t.prototype.getClassName = function() {
+ return "VolumetricLightScatteringPostProcess";
+ }, t.prototype._isReady = function(e, n) {
+ var i = e.getMesh();
+ if (i === this.mesh && i.material)
+ return i.material.isReady(i);
+ var o = [], a = [De.b.PositionKind], s = e.getMaterial();
+ s && (s.needAlphaTesting() && o.push("#define ALPHATEST"), i.isVerticesDataPresent(De.b.UVKind) && (a.push(De.b.UVKind), o.push("#define UV1")), i.isVerticesDataPresent(De.b.UV2Kind) && (a.push(De.b.UV2Kind), o.push("#define UV2"))), i.useBones && i.computeBonesUsingShaders ? (a.push(De.b.MatricesIndicesKind), a.push(De.b.MatricesWeightsKind), o.push("#define NUM_BONE_INFLUENCERS " + i.numBoneInfluencers), o.push("#define BonesPerMesh " + (i.skeleton ? i.skeleton.bones.length + 1 : 0))) : o.push("#define NUM_BONE_INFLUENCERS 0"), n && (o.push("#define INSTANCES"), tt.a.PushAttributesForInstances(a), e.getRenderingMesh().hasThinInstances && o.push("#define THIN_INSTANCES"));
+ var p = o.join(`
+`);
+ return this._cachedDefines !== p && (this._cachedDefines = p, this._volumetricLightScatteringPass = i.getScene().getEngine().createEffect("volumetricLightScatteringPass", a, ["world", "mBones", "viewProjection", "diffuseMatrix"], ["diffuseSampler"], p, void 0, void 0, void 0, { maxSimultaneousMorphTargets: i.numBoneInfluencers })), this._volumetricLightScatteringPass.isReady();
+ }, t.prototype.setCustomMeshPosition = function(e) {
+ this.customMeshPosition = e;
+ }, t.prototype.getCustomMeshPosition = function() {
+ return this.customMeshPosition;
+ }, t.prototype.dispose = function(e) {
+ var n = e.getScene().customRenderTargets.indexOf(this._volumetricLightScatteringRTT);
+ n !== -1 && e.getScene().customRenderTargets.splice(n, 1), this._volumetricLightScatteringRTT.dispose(), r.prototype.dispose.call(this, e);
+ }, t.prototype.getPass = function() {
+ return this._volumetricLightScatteringRTT;
+ }, t.prototype._meshExcluded = function(e) {
+ return this.excludedMeshes.length > 0 && this.excludedMeshes.indexOf(e) !== -1;
+ }, t.prototype._createPass = function(e, n) {
+ var i = this, o = e.getEngine();
+ this._volumetricLightScatteringRTT = new bn("volumetricLightScatteringMap", { width: o.getRenderWidth() * n, height: o.getRenderHeight() * n }, e, !1, !0, d.a.TEXTURETYPE_UNSIGNED_INT), this._volumetricLightScatteringRTT.wrapU = Ue.a.CLAMP_ADDRESSMODE, this._volumetricLightScatteringRTT.wrapV = Ue.a.CLAMP_ADDRESSMODE, this._volumetricLightScatteringRTT.renderList = null, this._volumetricLightScatteringRTT.renderParticles = !1, this._volumetricLightScatteringRTT.ignoreCameraViewport = !0;
+ var a = this.getCamera();
+ a ? a.customRenderTargets.push(this._volumetricLightScatteringRTT) : e.customRenderTargets.push(this._volumetricLightScatteringRTT);
+ var s, p = function(S) {
+ var O = S.getRenderingMesh(), I = S.getEffectiveMesh();
+ if (!i._meshExcluded(O)) {
+ I._internalAbstractMeshDataInfo._isActiveIntermediate = !1;
+ var G = S.getMaterial();
+ if (G) {
+ var k = O.getScene(), K = k.getEngine();
+ K.setState(G.backFaceCulling);
+ var re = O._getInstancesRenderList(S._id, !!S.getReplacementMesh());
+ if (!re.mustReturn) {
+ var se = K.getCaps().instancedArrays && (re.visibleInstances[S._id] !== null || O.hasThinInstances);
+ if (i._isReady(S, se)) {
+ var ue = i._volumetricLightScatteringPass;
+ if (O === i.mesh && (ue = S.effect ? S.effect : G.getEffect()), K.enableEffect(ue), O._bind(S, ue, G.fillMode), O === i.mesh)
+ G.bind(I.getWorldMatrix(), O);
+ else {
+ if (i._volumetricLightScatteringPass.setMatrix("viewProjection", k.getTransformMatrix()), G && G.needAlphaTesting()) {
+ var he = G.getAlphaTestTexture();
+ i._volumetricLightScatteringPass.setTexture("diffuseSampler", he), he && i._volumetricLightScatteringPass.setMatrix("diffuseMatrix", he.getTextureMatrix());
+ }
+ O.useBones && O.computeBonesUsingShaders && O.skeleton && i._volumetricLightScatteringPass.setMatrices("mBones", O.skeleton.getTransformMatrices(O));
+ }
+ O._processRendering(I, S, i._volumetricLightScatteringPass, Zt.a.TriangleFillMode, re, se, function(pe, ve) {
+ return ue.setMatrix("world", ve);
+ });
+ }
+ }
+ }
+ }
+ }, m = new C.b(0, 0, 0, 1);
+ this._volumetricLightScatteringRTT.onBeforeRenderObservable.add(function() {
+ s = e.clearColor, e.clearColor = m;
+ }), this._volumetricLightScatteringRTT.onAfterRenderObservable.add(function() {
+ e.clearColor = s;
+ }), this._volumetricLightScatteringRTT.customRenderFunction = function(S, O, I, G) {
+ var k, K = e.getEngine();
+ if (G.length) {
+ for (K.setColorWrite(!1), k = 0; k < G.length; k++)
+ p(G.data[k]);
+ K.setColorWrite(!0);
+ }
+ for (k = 0; k < S.length; k++)
+ p(S.data[k]);
+ for (k = 0; k < O.length; k++)
+ p(O.data[k]);
+ if (I.length) {
+ for (k = 0; k < I.length; k++) {
+ var re = I.data[k], se = re.getBoundingInfo();
+ se && e.activeCamera && (re._alphaIndex = re.getMesh().alphaIndex, re._distanceToCamera = se.boundingSphere.centerWorld.subtract(e.activeCamera.position).length());
+ }
+ var ue = I.data.slice(0, I.length);
+ for (ue.sort(function(he, pe) {
+ return he._alphaIndex > pe._alphaIndex ? 1 : he._alphaIndex < pe._alphaIndex ? -1 : he._distanceToCamera < pe._distanceToCamera ? 1 : he._distanceToCamera > pe._distanceToCamera ? -1 : 0;
+ }), K.setAlphaMode(d.a.ALPHA_COMBINE), k = 0; k < ue.length; k++)
+ p(ue[k]);
+ K.setAlphaMode(d.a.ALPHA_DISABLE);
+ }
+ };
+ }, t.prototype._updateMeshScreenCoordinates = function(e) {
+ var n, i = e.getTransformMatrix();
+ n = this.useCustomMeshPosition ? this.customMeshPosition : this.attachedNode ? this.attachedNode.position : this.mesh.parent ? this.mesh.getAbsolutePosition() : this.mesh.position;
+ var o = c.e.Project(n, c.a.Identity(), i, this._viewPort);
+ this._screenCoordinates.x = o.x / this._viewPort.width, this._screenCoordinates.y = o.y / this._viewPort.height, this.invert && (this._screenCoordinates.y = 1 - this._screenCoordinates.y);
+ }, t.CreateDefaultMesh = function(e, n) {
+ var i = we.a.CreatePlane(e, 1, n);
+ i.billboardMode = Nt.a.BILLBOARDMODE_ALL;
+ var o = new kt.a(e + "Material", n);
+ return o.emissiveColor = new C.a(1, 1, 1), i.material = o, i;
+ }, Object(u.c)([Object(w.o)()], t.prototype, "customMeshPosition", void 0), Object(u.c)([Object(w.c)()], t.prototype, "useCustomMeshPosition", void 0), Object(u.c)([Object(w.c)()], t.prototype, "invert", void 0), Object(u.c)([Object(w.k)()], t.prototype, "mesh", void 0), Object(u.c)([Object(w.c)()], t.prototype, "excludedMeshes", void 0), Object(u.c)([Object(w.c)()], t.prototype, "exposure", void 0), Object(u.c)([Object(w.c)()], t.prototype, "decay", void 0), Object(u.c)([Object(w.c)()], t.prototype, "weight", void 0), Object(u.c)([Object(w.c)()], t.prototype, "density", void 0), t;
+ }(_t);
+ x.a.RegisteredTypes["BABYLON.VolumetricLightScatteringPostProcess"] = H_;
+ var ZE = `
+
+precision highp float;
+
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+uniform sampler2D normalSampler;
+uniform float curvature_ridge;
+uniform float curvature_valley;
+#ifndef CURVATURE_OFFSET
+#define CURVATURE_OFFSET 1
+#endif
+float curvature_soft_clamp(float curvature,float control)
+{
+if (curvature<0.5/control)
+return curvature*(1.0-curvature*control);
+return 0.25/control;
+}
+float calculate_curvature(ivec2 texel,float ridge,float valley)
+{
+vec2 normal_up=texelFetchOffset(normalSampler,texel,0,ivec2(0,CURVATURE_OFFSET)).rb;
+vec2 normal_down=texelFetchOffset(normalSampler,texel,0,ivec2(0,-CURVATURE_OFFSET)).rb;
+vec2 normal_left=texelFetchOffset(normalSampler,texel,0,ivec2(-CURVATURE_OFFSET,0)).rb;
+vec2 normal_right=texelFetchOffset(normalSampler,texel,0,ivec2( CURVATURE_OFFSET,0)).rb;
+float normal_diff=((normal_up.g-normal_down.g)+(normal_right.r-normal_left.r));
+if (normal_diff<0.0)
+return -2.0*curvature_soft_clamp(-normal_diff,valley);
+return 2.0*curvature_soft_clamp(normal_diff,ridge);
+}
+void main(void)
+{
+ivec2 texel=ivec2(gl_FragCoord.xy);
+vec4 baseColor=texture2D(textureSampler,vUV);
+float curvature=calculate_curvature(texel,curvature_ridge,curvature_valley);
+baseColor.rgb*=curvature+1.0;
+gl_FragColor=baseColor;
+}`;
+ We.a.ShadersStore.screenSpaceCurvaturePixelShader = ZE;
+ var W_ = function(r) {
+ function t(e, n, i, o, a, s, p, m, S) {
+ m === void 0 && (m = d.a.TEXTURETYPE_UNSIGNED_INT), S === void 0 && (S = !1);
+ var O = r.call(this, e, "screenSpaceCurvature", ["curvature_ridge", "curvature_valley"], ["textureSampler", "normalSampler"], i, o, a, s, p, void 0, m, void 0, null, S) || this;
+ return O.ridge = 1, O.valley = 1, O._geometryBufferRenderer = n.enableGeometryBufferRenderer(), O._geometryBufferRenderer ? O.onApply = function(I) {
+ I.setFloat("curvature_ridge", 0.5 / Math.max(O.ridge * O.ridge, 1e-4)), I.setFloat("curvature_valley", 0.7 / Math.max(O.valley * O.valley, 1e-4));
+ var G = O._geometryBufferRenderer.getGBuffer().textures[1];
+ I.setTexture("normalSampler", G);
+ } : h.a.Error("Multiple Render Target support needed for screen space curvature post process. Please use IsSupported test first."), O;
+ }
+ return Object(u.d)(t, r), t.prototype.getClassName = function() {
+ return "ScreenSpaceCurvaturePostProcess";
+ }, Object.defineProperty(t, "IsSupported", { get: function() {
+ var e = te.a.LastCreatedEngine;
+ return !!e && (e.webGLVersion > 1 || e.getCaps().drawBuffersExtension);
+ }, enumerable: !1, configurable: !0 }), t._Parse = function(e, n, i, o) {
+ return w.a.Parse(function() {
+ return new t(e.name, i, e.options, n, e.renderTargetSamplingMode, i.getEngine(), e.textureType, e.reusable);
+ }, e, i, o);
+ }, Object(u.c)([Object(w.c)()], t.prototype, "ridge", void 0), Object(u.c)([Object(w.c)()], t.prototype, "valley", void 0), t;
+ }(_t);
+ x.a.RegisteredTypes["BABYLON.ScreenSpaceCurvaturePostProcess"] = W_, l(166), l(167), Object.defineProperty(ge.a.prototype, "forceShowBoundingBoxes", { get: function() {
+ return this._forceShowBoundingBoxes || !1;
+ }, set: function(r) {
+ this._forceShowBoundingBoxes = r, r && this.getBoundingBoxRenderer();
+ }, enumerable: !0, configurable: !0 }), ge.a.prototype.getBoundingBoxRenderer = function() {
+ return this._boundingBoxRenderer || (this._boundingBoxRenderer = new X_(this)), this._boundingBoxRenderer;
+ }, Object.defineProperty(Nt.a.prototype, "showBoundingBox", { get: function() {
+ return this._showBoundingBox || !1;
+ }, set: function(r) {
+ this._showBoundingBox = r, r && this.getScene().getBoundingBoxRenderer();
+ }, enumerable: !0, configurable: !0 });
+ var X_ = function() {
+ function r(t) {
+ this.name = st.a.NAME_BOUNDINGBOXRENDERER, this.frontColor = new C.a(1, 1, 1), this.backColor = new C.a(0.1, 0.1, 0.1), this.showBackLines = !0, this.onBeforeBoxRenderingObservable = new P.c(), this.onAfterBoxRenderingObservable = new P.c(), this.onResourcesReadyObservable = new P.c(), this.enabled = !0, this.renderList = new Ui.a(32), this._vertexBuffers = {}, this._fillIndexBuffer = null, this._fillIndexData = null, this.scene = t, t._addComponent(this);
+ }
+ return r.prototype.register = function() {
+ this.scene._beforeEvaluateActiveMeshStage.registerStep(st.a.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER, this, this.reset), this.scene._preActiveMeshStage.registerStep(st.a.STEP_PREACTIVEMESH_BOUNDINGBOXRENDERER, this, this._preActiveMesh), this.scene._evaluateSubMeshStage.registerStep(st.a.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER, this, this._evaluateSubMesh), this.scene._afterRenderingGroupDrawStage.registerStep(st.a.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER, this, this.render);
+ }, r.prototype._evaluateSubMesh = function(t, e) {
+ if (t.showSubMeshesBoundingBox) {
+ var n = e.getBoundingInfo();
+ n != null && (n.boundingBox._tag = t.renderingGroupId, this.renderList.push(n.boundingBox));
+ }
+ }, r.prototype._preActiveMesh = function(t) {
+ if (t.showBoundingBox || this.scene.forceShowBoundingBoxes) {
+ var e = t.getBoundingInfo();
+ e.boundingBox._tag = t.renderingGroupId, this.renderList.push(e.boundingBox);
+ }
+ }, r.prototype._prepareResources = function() {
+ if (!this._colorShader) {
+ this._colorShader = new js.a("colorShader", this.scene, "color", { attributes: [De.b.PositionKind], uniforms: ["world", "viewProjection", "color"] }), this._colorShader.reservedDataStore = { hidden: !0 };
+ var t = this.scene.getEngine(), e = ft.a.CreateBox({ size: 1 });
+ this._vertexBuffers[De.b.PositionKind] = new De.b(t, e.positions, De.b.PositionKind, !1), this._createIndexBuffer(), this._fillIndexData = e.indices, this.onResourcesReadyObservable.notifyObservers(this);
+ }
+ }, r.prototype._createIndexBuffer = function() {
+ var t = this.scene.getEngine();
+ this._indexBuffer = t.createIndexBuffer([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 7, 1, 6, 2, 5, 3, 4]);
+ }, r.prototype.rebuild = function() {
+ var t = this._vertexBuffers[De.b.PositionKind];
+ t && t._rebuild(), this._createIndexBuffer();
+ }, r.prototype.reset = function() {
+ this.renderList.reset();
+ }, r.prototype.render = function(t) {
+ if (this.renderList.length !== 0 && this.enabled && (this._prepareResources(), this._colorShader.isReady())) {
+ var e = this.scene.getEngine();
+ e.setDepthWrite(!1), this._colorShader._preBind();
+ for (var n = 0; n < this.renderList.length; n++) {
+ var i = this.renderList.data[n];
+ if (i._tag === t) {
+ this.onBeforeBoxRenderingObservable.notifyObservers(i);
+ var o = i.minimum, a = i.maximum.subtract(o), s = o.add(a.scale(0.5)), p = c.a.Scaling(a.x, a.y, a.z).multiply(c.a.Translation(s.x, s.y, s.z)).multiply(i.getWorldMatrix());
+ e.bindBuffers(this._vertexBuffers, this._indexBuffer, this._colorShader.getEffect()), this.showBackLines && (e.setDepthFunctionToGreaterOrEqual(), this.scene.resetCachedMaterial(), this._colorShader.setColor4("color", this.backColor.toColor4()), this._colorShader.bind(p), e.drawElementsType(Zt.a.LineListDrawMode, 0, 24)), e.setDepthFunctionToLess(), this.scene.resetCachedMaterial(), this._colorShader.setColor4("color", this.frontColor.toColor4()), this._colorShader.bind(p), e.drawElementsType(Zt.a.LineListDrawMode, 0, 24), this.onAfterBoxRenderingObservable.notifyObservers(i);
+ }
+ }
+ this._colorShader.unbind(), e.setDepthFunctionToLessOrEqual(), e.setDepthWrite(!0);
+ }
+ }, r.prototype.renderOcclusionBoundingBox = function(t) {
+ if (this._prepareResources(), this._colorShader.isReady() && t._boundingInfo) {
+ var e = this.scene.getEngine();
+ this._fillIndexBuffer || (this._fillIndexBuffer = e.createIndexBuffer(this._fillIndexData)), e.setDepthWrite(!1), e.setColorWrite(!1), this._colorShader._preBind();
+ var n = t._boundingInfo.boundingBox, i = n.minimum, o = n.maximum.subtract(i), a = i.add(o.scale(0.5)), s = c.a.Scaling(o.x, o.y, o.z).multiply(c.a.Translation(a.x, a.y, a.z)).multiply(n.getWorldMatrix());
+ e.bindBuffers(this._vertexBuffers, this._fillIndexBuffer, this._colorShader.getEffect()), e.setDepthFunctionToLess(), this.scene.resetCachedMaterial(), this._colorShader.bind(s), e.drawElementsType(Zt.a.TriangleFillMode, 0, 36), this._colorShader.unbind(), e.setDepthFunctionToLessOrEqual(), e.setDepthWrite(!0), e.setColorWrite(!0);
+ }
+ }, r.prototype.dispose = function() {
+ if (this._colorShader) {
+ this.onBeforeBoxRenderingObservable.clear(), this.onAfterBoxRenderingObservable.clear(), this.onResourcesReadyObservable.clear(), this.renderList.dispose(), this._colorShader.dispose();
+ var t = this._vertexBuffers[De.b.PositionKind];
+ t && (t.dispose(), this._vertexBuffers[De.b.PositionKind] = null), this.scene.getEngine()._releaseBuffer(this._indexBuffer), this._fillIndexBuffer && (this.scene.getEngine()._releaseBuffer(this._fillIndexBuffer), this._fillIndexBuffer = null);
+ }
+ }, r;
+ }();
+ ge.a.prototype.enableDepthRenderer = function(r, t, e) {
+ if (t === void 0 && (t = !1), e === void 0 && (e = !1), !(r = r || this.activeCamera))
+ throw "No camera available to enable depth renderer";
+ if (this._depthRenderer || (this._depthRenderer = {}), !this._depthRenderer[r.id]) {
+ var n = !!this.getEngine().getCaps().textureFloatRender, i = 0;
+ i = !this.getEngine().getCaps().textureHalfFloatRender || e && n ? n ? d.a.TEXTURETYPE_FLOAT : d.a.TEXTURETYPE_UNSIGNED_BYTE : d.a.TEXTURETYPE_HALF_FLOAT, this._depthRenderer[r.id] = new Us(this, i, r, t);
+ }
+ return this._depthRenderer[r.id];
+ }, ge.a.prototype.disableDepthRenderer = function(r) {
+ (r = r || this.activeCamera) && this._depthRenderer && this._depthRenderer[r.id] && (this._depthRenderer[r.id].dispose(), delete this._depthRenderer[r.id]);
+ };
+ var Y_ = function() {
+ function r(t) {
+ this.name = st.a.NAME_DEPTHRENDERER, this.scene = t;
+ }
+ return r.prototype.register = function() {
+ this.scene._gatherRenderTargetsStage.registerStep(st.a.STEP_GATHERRENDERTARGETS_DEPTHRENDERER, this, this._gatherRenderTargets), this.scene._gatherActiveCameraRenderTargetsStage.registerStep(st.a.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER, this, this._gatherActiveCameraRenderTargets);
+ }, r.prototype.rebuild = function() {
+ }, r.prototype.dispose = function() {
+ for (var t in this.scene._depthRenderer)
+ this.scene._depthRenderer[t].dispose();
+ }, r.prototype._gatherRenderTargets = function(t) {
+ if (this.scene._depthRenderer)
+ for (var e in this.scene._depthRenderer) {
+ var n = this.scene._depthRenderer[e];
+ n.enabled && !n.useOnlyInActiveCamera && t.push(n.getDepthMap());
+ }
+ }, r.prototype._gatherActiveCameraRenderTargets = function(t) {
+ if (this.scene._depthRenderer)
+ for (var e in this.scene._depthRenderer) {
+ var n = this.scene._depthRenderer[e];
+ n.enabled && n.useOnlyInActiveCamera && this.scene.activeCamera.id === e && t.push(n.getDepthMap());
+ }
+ }, r;
+ }();
+ Us._SceneComponentInitialization = function(r) {
+ var t = r._getComponent(st.a.NAME_DEPTHRENDERER);
+ t || (t = new Y_(r), r._addComponent(t));
+ }, We.a.ShadersStore.linePixelShader = `uniform vec4 color;
+void main(void) {
+gl_FragColor=color;
+}`;
+ var JE = `#include
+
+attribute vec3 position;
+attribute vec4 normal;
+
+uniform mat4 viewProjection;
+uniform float width;
+uniform float aspectRatio;
+void main(void) {
+#include
+mat4 worldViewProjection=viewProjection*finalWorld;
+vec4 viewPosition=worldViewProjection*vec4(position,1.0);
+vec4 viewPositionNext=worldViewProjection*vec4(normal.xyz,1.0);
+vec2 currentScreen=viewPosition.xy/viewPosition.w;
+vec2 nextScreen=viewPositionNext.xy/viewPositionNext.w;
+currentScreen.x*=aspectRatio;
+nextScreen.x*=aspectRatio;
+vec2 dir=normalize(nextScreen-currentScreen);
+vec2 normalDir=vec2(-dir.y,dir.x);
+normalDir*=width/2.0;
+normalDir.x/=aspectRatio;
+vec4 offset=vec4(normalDir*normal.w,0.0,0.0);
+gl_Position=viewPosition+offset;
+}`;
+ We.a.ShadersStore.lineVertexShader = JE, Nt.a.prototype.disableEdgesRendering = function() {
+ return this._edgesRenderer && (this._edgesRenderer.dispose(), this._edgesRenderer = null), this;
+ }, Nt.a.prototype.enableEdgesRendering = function(r, t, e) {
+ return r === void 0 && (r = 0.95), t === void 0 && (t = !1), this.disableEdgesRendering(), this._edgesRenderer = new Xu(this, r, t, !0, e), this;
+ }, Object.defineProperty(Nt.a.prototype, "edgesRenderer", { get: function() {
+ return this._edgesRenderer;
+ }, enumerable: !0, configurable: !0 }), Ua.b.prototype.enableEdgesRendering = function(r, t) {
+ return r === void 0 && (r = 0.95), t === void 0 && (t = !1), this.disableEdgesRendering(), this._edgesRenderer = new K_(this, r, t), this;
+ }, Ua.a.prototype.enableEdgesRendering = function(r, t) {
+ return r === void 0 && (r = 0.95), t === void 0 && (t = !1), Ua.b.prototype.enableEdgesRendering.apply(this, arguments), this;
+ };
+ var $E = function() {
+ this.edges = new Array(), this.edgesConnectedCount = 0;
+ }, Xu = function() {
+ function r(t, e, n, i, o) {
+ var a, s = this;
+ e === void 0 && (e = 0.95), n === void 0 && (n = !1), i === void 0 && (i = !0), this.edgesWidthScalerForOrthographic = 1e3, this.edgesWidthScalerForPerspective = 50, this._linesPositions = new Array(), this._linesNormals = new Array(), this._linesIndices = new Array(), this._buffers = {}, this._buffersForInstances = {}, this._checkVerticesInsteadOfIndices = !1, this.isEnabled = !0, this.customInstances = new Ui.a(32), this._source = t, this._checkVerticesInsteadOfIndices = n, this._options = o ?? null, this._epsilon = e, this._prepareRessources(), i && ((a = o == null ? void 0 : o.useAlternateEdgeFinder) === null || a === void 0 || a ? this._generateEdgesLinesAlternate() : this._generateEdgesLines()), this._meshRebuildObserver = this._source.onRebuildObservable.add(function() {
+ s._rebuild();
+ }), this._meshDisposeObserver = this._source.onDisposeObservable.add(function() {
+ s.dispose();
+ });
+ }
+ return Object.defineProperty(r.prototype, "linesPositions", { get: function() {
+ return this._linesPositions;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "linesNormals", { get: function() {
+ return this._linesNormals;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "linesIndices", { get: function() {
+ return this._linesIndices;
+ }, enumerable: !1, configurable: !0 }), r.GetShader = function(t) {
+ if (!t._edgeRenderLineShader) {
+ var e = new js.a("lineShader", t, "line", { attributes: ["position", "normal"], uniforms: ["world", "viewProjection", "color", "width", "aspectRatio"] });
+ e.disableDepthWrite = !0, e.backFaceCulling = !1, t._edgeRenderLineShader = e;
+ }
+ return t._edgeRenderLineShader;
+ }, r.prototype._prepareRessources = function() {
+ this._lineShader || (this._lineShader = r.GetShader(this._source.getScene()));
+ }, r.prototype._rebuild = function() {
+ var t = this._buffers[De.b.PositionKind];
+ t && t._rebuild(), (t = this._buffers[De.b.NormalKind]) && t._rebuild();
+ var e = this._source.getScene().getEngine();
+ this._ib = e.createIndexBuffer(this._linesIndices);
+ }, r.prototype.dispose = function() {
+ this._source.onRebuildObservable.remove(this._meshRebuildObserver), this._source.onDisposeObservable.remove(this._meshDisposeObserver);
+ var t = this._buffers[De.b.PositionKind];
+ t && (t.dispose(), this._buffers[De.b.PositionKind] = null), (t = this._buffers[De.b.NormalKind]) && (t.dispose(), this._buffers[De.b.NormalKind] = null), this._ib && this._source.getScene().getEngine()._releaseBuffer(this._ib), this._lineShader.dispose();
+ }, r.prototype._processEdgeForAdjacencies = function(t, e, n, i, o) {
+ return t === n && e === i || t === i && e === n ? 0 : t === i && e === o || t === o && e === i ? 1 : t === o && e === n || t === n && e === o ? 2 : -1;
+ }, r.prototype._processEdgeForAdjacenciesWithVertices = function(t, e, n, i, o) {
+ var a = 1e-10;
+ return t.equalsWithEpsilon(n, a) && e.equalsWithEpsilon(i, a) || t.equalsWithEpsilon(i, a) && e.equalsWithEpsilon(n, a) ? 0 : t.equalsWithEpsilon(i, a) && e.equalsWithEpsilon(o, a) || t.equalsWithEpsilon(o, a) && e.equalsWithEpsilon(i, a) ? 1 : t.equalsWithEpsilon(o, a) && e.equalsWithEpsilon(n, a) || t.equalsWithEpsilon(n, a) && e.equalsWithEpsilon(o, a) ? 2 : -1;
+ }, r.prototype._checkEdge = function(t, e, n, i, o) {
+ var a;
+ e === void 0 ? a = !0 : a = c.e.Dot(n[t], n[e]) < this._epsilon, a && this.createLine(i, o, this._linesPositions.length / 3);
+ }, r.prototype.createLine = function(t, e, n) {
+ this._linesPositions.push(t.x, t.y, t.z, t.x, t.y, t.z, e.x, e.y, e.z, e.x, e.y, e.z), this._linesNormals.push(e.x, e.y, e.z, -1, e.x, e.y, e.z, 1, t.x, t.y, t.z, -1, t.x, t.y, t.z, 1), this._linesIndices.push(n, n + 1, n + 2, n, n + 2, n + 3);
+ }, r.prototype._tessellateTriangle = function(t, e, n, i) {
+ var o = function(xe, Pe, Ce) {
+ Ce >= 0 && Pe.push(Ce);
+ for (var Fe = 0; Fe < xe.length; ++Fe)
+ Pe.push(xe[Fe][0]);
+ }, a = 0;
+ t[1].length >= t[0].length && t[1].length >= t[2].length ? a = 1 : t[2].length >= t[0].length && t[2].length >= t[1].length && (a = 2);
+ for (var s = 0; s < 3; ++s)
+ s === a ? t[s].sort(function(xe, Pe) {
+ return xe[1] < Pe[1] ? -1 : xe[1] > Pe[1] ? 1 : 0;
+ }) : t[s].sort(function(xe, Pe) {
+ return xe[1] > Pe[1] ? -1 : xe[1] < Pe[1] ? 1 : 0;
+ });
+ var p = [], m = [];
+ o(t[a], p, -1);
+ for (var S = p.length, O = a + 2; O >= a + 1; --O)
+ o(t[O % 3], m, O !== a + 2 ? i[n[e + (O + 1) % 3]] : -1);
+ var I = m.length;
+ n.push(i[n[e + a]], p[0], m[0]), n.push(i[n[e + (a + 1) % 3]], m[I - 1], p[S - 1]);
+ for (var G = S <= I, k = G ? S : I, K = G ? I : S, re = G ? S - 1 : I - 1, se = G ? 0 : 1, ue = S + I - 2, he = 0, pe = 0, ve = G ? p : m, Ee = G ? m : p, Ae = 0; ue-- > 0; ) {
+ se ? n.push(ve[he], Ee[pe]) : n.push(Ee[pe], ve[he]);
+ var Ie = void 0;
+ (Ae += k) >= K && he < re ? (Ie = ve[++he], Ae -= K) : Ie = Ee[++pe], n.push(Ie);
+ }
+ n[e + 0] = n[n.length - 3], n[e + 1] = n[n.length - 2], n[e + 2] = n[n.length - 1], n.length = n.length - 3;
+ }, r.prototype._generateEdgesLinesAlternate = function() {
+ var t, e, n, i, o, a, s, p, m, S = this._source.getVerticesData(De.b.PositionKind), O = this._source.getIndices();
+ if (O && S) {
+ Array.isArray(O) || (O = Ke.b.SliceToArray(O));
+ var I = (e = (t = this._options) === null || t === void 0 ? void 0 : t.useFastVertexMerger) === null || e === void 0 || e, G = I ? Math.round(-Math.log((i = (n = this._options) === null || n === void 0 ? void 0 : n.epsilonVertexMerge) !== null && i !== void 0 ? i : 1e-6) / Math.log(10)) : (a = (o = this._options) === null || o === void 0 ? void 0 : o.epsilonVertexMerge) !== null && a !== void 0 ? a : 1e-6, k = [], K = [];
+ if (I)
+ for (var re = {}, se = 0; se < S.length; se += 3) {
+ var ue = S[se + 0], he = S[se + 1], pe = S[se + 2];
+ if (re[It = ue.toFixed(G) + "|" + he.toFixed(G) + "|" + pe.toFixed(G)] !== void 0)
+ k.push(re[It]);
+ else {
+ var ve = se / 3;
+ re[It] = ve, k.push(ve), K.push(ve);
+ }
+ }
+ else
+ for (se = 0; se < S.length; se += 3) {
+ ue = S[se + 0], he = S[se + 1], pe = S[se + 2];
+ for (var Ee = !1, Ae = 0; Ae < se && !Ee; Ae += 3) {
+ var Ie = S[Ae + 0], xe = S[Ae + 1], Pe = S[Ae + 2];
+ if (Math.abs(ue - Ie) < G && Math.abs(he - xe) < G && Math.abs(pe - Pe) < G) {
+ k.push(Ae / 3), Ee = !0;
+ break;
+ }
+ }
+ Ee || (k.push(se / 3), K.push(se / 3));
+ }
+ if (!((s = this._options) === null || s === void 0) && s.applyTessellation) {
+ for (var Ce = (m = (p = this._options) === null || p === void 0 ? void 0 : p.epsilonVertexAligned) !== null && m !== void 0 ? m : 1e-6, Fe = [], Oe = 0; Oe < O.length; Oe += 3)
+ for (var Be = void 0, Le = 0; Le < 3; ++Le) {
+ var Ve = k[O[Oe + Le]], Qe = k[O[Oe + (Le + 1) % 3]], nt = k[O[Oe + (Le + 2) % 3]];
+ if (Ve !== Qe)
+ for (var rt = S[3 * Ve + 0], ut = S[3 * Ve + 1], qe = S[3 * Ve + 2], at = S[3 * Qe + 0], ot = S[3 * Qe + 1], Je = S[3 * Qe + 2], dt = Math.sqrt((at - rt) * (at - rt) + (ot - ut) * (ot - ut) + (Je - qe) * (Je - qe)), Ge = 0; Ge < K.length - 1; Ge++) {
+ var $e = K[Ge];
+ if ($e !== Ve && $e !== Qe && $e !== nt) {
+ var yt = S[3 * $e + 0], Jt = S[3 * $e + 1], Bt = S[3 * $e + 2], rn = Math.sqrt((yt - rt) * (yt - rt) + (Jt - ut) * (Jt - ut) + (Bt - qe) * (Bt - qe)), vt = Math.sqrt((yt - at) * (yt - at) + (Jt - ot) * (Jt - ot) + (Bt - Je) * (Bt - Je));
+ Math.abs(rn + vt - dt) < Ce && (Be || (Be = { index: Oe, edgesPoints: [[], [], []] }, Fe.push(Be)), Be.edgesPoints[Le].push([$e, rn]));
+ }
+ }
+ }
+ for (var sn = 0; sn < Fe.length; ++sn) {
+ var $t = Fe[sn];
+ this._tessellateTriangle($t.edgesPoints, $t.index, O, k);
+ }
+ Fe = null;
+ }
+ var Qt = {};
+ for (Oe = 0; Oe < O.length; Oe += 3) {
+ var en = void 0;
+ for (Le = 0; Le < 3; ++Le)
+ if (Ve = k[O[Oe + Le]], Qe = k[O[Oe + (Le + 1) % 3]], nt = k[O[Oe + (Le + 2) % 3]], Ve !== Qe) {
+ if (c.c.Vector3[0].copyFromFloats(S[3 * Ve + 0], S[3 * Ve + 1], S[3 * Ve + 2]), c.c.Vector3[1].copyFromFloats(S[3 * Qe + 0], S[3 * Qe + 1], S[3 * Qe + 2]), c.c.Vector3[2].copyFromFloats(S[3 * nt + 0], S[3 * nt + 1], S[3 * nt + 2]), en || (c.c.Vector3[1].subtractToRef(c.c.Vector3[0], c.c.Vector3[3]), c.c.Vector3[2].subtractToRef(c.c.Vector3[1], c.c.Vector3[4]), (en = c.e.Cross(c.c.Vector3[3], c.c.Vector3[4])).normalize()), Ve > Qe) {
+ var Tt = Ve;
+ Ve = Qe, Qe = Tt;
+ }
+ (cn = Qt[It = Ve + "_" + Qe]) ? cn.done || (c.e.Dot(en, cn.normal) < this._epsilon && this.createLine(c.c.Vector3[0], c.c.Vector3[1], this._linesPositions.length / 3), cn.done = !0) : Qt[It] = { normal: en, done: !1, index: Oe, i: Le };
+ }
+ }
+ for (var It in Qt) {
+ var cn;
+ (cn = Qt[It]).done || (Ve = k[O[cn.index + cn.i]], Qe = k[O[cn.index + (cn.i + 1) % 3]], c.c.Vector3[0].copyFromFloats(S[3 * Ve + 0], S[3 * Ve + 1], S[3 * Ve + 2]), c.c.Vector3[1].copyFromFloats(S[3 * Qe + 0], S[3 * Qe + 1], S[3 * Qe + 2]), this.createLine(c.c.Vector3[0], c.c.Vector3[1], this._linesPositions.length / 3));
+ }
+ var Hn = this._source.getScene().getEngine();
+ this._buffers[De.b.PositionKind] = new De.b(Hn, this._linesPositions, De.b.PositionKind, !1), this._buffers[De.b.NormalKind] = new De.b(Hn, this._linesNormals, De.b.NormalKind, !1, !1, 4), this._buffersForInstances[De.b.PositionKind] = this._buffers[De.b.PositionKind], this._buffersForInstances[De.b.NormalKind] = this._buffers[De.b.NormalKind], this._ib = Hn.createIndexBuffer(this._linesIndices), this._indicesCount = this._linesIndices.length;
+ }
+ }, r.prototype._generateEdgesLines = function() {
+ var t = this._source.getVerticesData(De.b.PositionKind), e = this._source.getIndices();
+ if (e && t) {
+ var n, i, o = new Array(), a = new Array();
+ for (n = 0; n < e.length; n += 3) {
+ i = new $E();
+ var s = e[n], p = e[n + 1], m = e[n + 2];
+ i.p0 = new c.e(t[3 * s], t[3 * s + 1], t[3 * s + 2]), i.p1 = new c.e(t[3 * p], t[3 * p + 1], t[3 * p + 2]), i.p2 = new c.e(t[3 * m], t[3 * m + 1], t[3 * m + 2]);
+ var S = c.e.Cross(i.p1.subtract(i.p0), i.p2.subtract(i.p1));
+ S.normalize(), a.push(S), o.push(i);
+ }
+ for (n = 0; n < o.length; n++) {
+ i = o[n];
+ for (var O = n + 1; O < o.length; O++) {
+ var I = o[O];
+ if (i.edgesConnectedCount === 3)
+ break;
+ if (I.edgesConnectedCount !== 3)
+ for (var G = e[3 * O], k = e[3 * O + 1], K = e[3 * O + 2], re = 0; re < 3; re++) {
+ var se = 0;
+ if (i.edges[re] === void 0) {
+ switch (re) {
+ case 0:
+ se = this._checkVerticesInsteadOfIndices ? this._processEdgeForAdjacenciesWithVertices(i.p0, i.p1, I.p0, I.p1, I.p2) : this._processEdgeForAdjacencies(e[3 * n], e[3 * n + 1], G, k, K);
+ break;
+ case 1:
+ se = this._checkVerticesInsteadOfIndices ? this._processEdgeForAdjacenciesWithVertices(i.p1, i.p2, I.p0, I.p1, I.p2) : this._processEdgeForAdjacencies(e[3 * n + 1], e[3 * n + 2], G, k, K);
+ break;
+ case 2:
+ se = this._checkVerticesInsteadOfIndices ? this._processEdgeForAdjacenciesWithVertices(i.p2, i.p0, I.p0, I.p1, I.p2) : this._processEdgeForAdjacencies(e[3 * n + 2], e[3 * n], G, k, K);
+ }
+ if (se !== -1 && (i.edges[re] = O, I.edges[se] = n, i.edgesConnectedCount++, I.edgesConnectedCount++, i.edgesConnectedCount === 3))
+ break;
+ }
+ }
+ }
+ }
+ for (n = 0; n < o.length; n++) {
+ var ue = o[n];
+ this._checkEdge(n, ue.edges[0], a, ue.p0, ue.p1), this._checkEdge(n, ue.edges[1], a, ue.p1, ue.p2), this._checkEdge(n, ue.edges[2], a, ue.p2, ue.p0);
+ }
+ var he = this._source.getScene().getEngine();
+ this._buffers[De.b.PositionKind] = new De.b(he, this._linesPositions, De.b.PositionKind, !1), this._buffers[De.b.NormalKind] = new De.b(he, this._linesNormals, De.b.NormalKind, !1, !1, 4), this._buffersForInstances[De.b.PositionKind] = this._buffers[De.b.PositionKind], this._buffersForInstances[De.b.NormalKind] = this._buffers[De.b.NormalKind], this._ib = he.createIndexBuffer(this._linesIndices), this._indicesCount = this._linesIndices.length;
+ }
+ }, r.prototype.isReady = function() {
+ return this._lineShader.isReady(this._source, this._source.hasInstances && this.customInstances.length > 0 || this._source.hasThinInstances);
+ }, r.prototype.render = function() {
+ var t = this._source.getScene();
+ if (this.isReady() && t.activeCamera) {
+ var e = t.getEngine();
+ this._lineShader._preBind(), this._source.edgesColor.a !== 1 ? e.setAlphaMode(d.a.ALPHA_COMBINE) : e.setAlphaMode(d.a.ALPHA_DISABLE);
+ var n = this._source.hasInstances && this.customInstances.length > 0, i = n || this._source.hasThinInstances, o = 0;
+ if (i)
+ if (this._buffersForInstances.world0 = this._source.getVertexBuffer("world0"), this._buffersForInstances.world1 = this._source.getVertexBuffer("world1"), this._buffersForInstances.world2 = this._source.getVertexBuffer("world2"), this._buffersForInstances.world3 = this._source.getVertexBuffer("world3"), n) {
+ var a = this._source._instanceDataStorage;
+ if (o = this.customInstances.length, !a.isFrozen) {
+ for (var s = 0, p = 0; p < o; ++p)
+ this.customInstances.data[p].copyToArray(a.instancesData, s), s += 16;
+ a.instancesBuffer.updateDirectly(a.instancesData, 0, o);
+ }
+ } else
+ o = this._source.thinInstanceCount;
+ e.bindBuffers(i ? this._buffersForInstances : this._buffers, this._ib, this._lineShader.getEffect()), t.resetCachedMaterial(), this._lineShader.setColor4("color", this._source.edgesColor), t.activeCamera.mode === gt.a.ORTHOGRAPHIC_CAMERA ? this._lineShader.setFloat("width", this._source.edgesWidth / this.edgesWidthScalerForOrthographic) : this._lineShader.setFloat("width", this._source.edgesWidth / this.edgesWidthScalerForPerspective), this._lineShader.setFloat("aspectRatio", e.getAspectRatio(t.activeCamera)), this._lineShader.bind(this._source.getWorldMatrix()), e.drawElementsType(Zt.a.TriangleFillMode, 0, this._indicesCount, o), this._lineShader.unbind(), i && e.unbindInstanceAttributes(), this._source.getScene()._activeMeshesFrozen || this.customInstances.reset();
+ }
+ }, r;
+ }(), K_ = function(r) {
+ function t(e, n, i) {
+ n === void 0 && (n = 0.95), i === void 0 && (i = !1);
+ var o = r.call(this, e, n, i, !1) || this;
+ return o._generateEdgesLines(), o;
+ }
+ return Object(u.d)(t, r), t.prototype._generateEdgesLines = function() {
+ var e = this._source.getVerticesData(De.b.PositionKind), n = this._source.getIndices();
+ if (n && e) {
+ for (var i = c.c.Vector3[0], o = c.c.Vector3[1], a = n.length - 1, s = 0, p = 0; s < a; s += 2, p += 4)
+ c.e.FromArrayToRef(e, 3 * n[s], i), c.e.FromArrayToRef(e, 3 * n[s + 1], o), this.createLine(i, o, p);
+ var m = this._source.getScene().getEngine();
+ this._buffers[De.b.PositionKind] = new De.b(m, this._linesPositions, De.b.PositionKind, !1), this._buffers[De.b.NormalKind] = new De.b(m, this._linesNormals, De.b.NormalKind, !1, !1, 4), this._ib = m.createIndexBuffer(this._linesIndices), this._indicesCount = this._linesIndices.length;
+ }
+ }, t;
+ }(Xu), Yu = function() {
+ function r(t) {
+ this._textureFormats = [{ type: d.a.PREPASS_IRRADIANCE_TEXTURE_TYPE, format: d.a.TEXTURETYPE_HALF_FLOAT }, { type: d.a.PREPASS_POSITION_TEXTURE_TYPE, format: d.a.TEXTURETYPE_HALF_FLOAT }, { type: d.a.PREPASS_VELOCITY_TEXTURE_TYPE, format: d.a.TEXTURETYPE_HALF_FLOAT }, { type: d.a.PREPASS_REFLECTIVITY_TEXTURE_TYPE, format: d.a.TEXTURETYPE_UNSIGNED_INT }, { type: d.a.PREPASS_COLOR_TEXTURE_TYPE, format: d.a.TEXTURETYPE_HALF_FLOAT }, { type: d.a.PREPASS_DEPTHNORMAL_TEXTURE_TYPE, format: d.a.TEXTURETYPE_HALF_FLOAT }, { type: d.a.PREPASS_ALBEDO_TEXTURE_TYPE, format: d.a.TEXTURETYPE_UNSIGNED_INT }], this.excludedSkinnedMesh = [], this.excludedMaterials = [], this._textureIndices = [], this._isDirty = !1, this.mrtCount = 0, this._postProcesses = [], this._clearColor = new C.b(0, 0, 0, 0), this._effectConfigurations = [], this._mrtFormats = [], this._enabled = !1, this._useGeometryBufferFallback = !1, this.disableGammaTransform = !1, this._scene = t, this._engine = t.getEngine(), r._SceneComponentInitialization(this._scene), this._resetLayout();
+ }
+ return Object.defineProperty(r.prototype, "enabled", { get: function() {
+ return this._enabled;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "samples", { get: function() {
+ return this.prePassRT.samples;
+ }, set: function(t) {
+ this.imageProcessingPostProcess || this._createCompositionEffect(), this.prePassRT.samples = t;
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(r.prototype, "useGeometryBufferFallback", { get: function() {
+ return this._useGeometryBufferFallback;
+ }, set: function(t) {
+ if (this._useGeometryBufferFallback = t, t) {
+ if (this._geometryBuffer = this._scene.enableGeometryBufferRenderer(), !this._geometryBuffer)
+ return void (this._useGeometryBufferFallback = !1);
+ this._geometryBuffer.renderList = [], this._geometryBuffer._linkPrePassRenderer(this), this._updateGeometryBufferLayout();
+ } else
+ this._geometryBuffer && this._geometryBuffer._unlinkPrePassRenderer(), this._geometryBuffer = null, this._scene.disableGeometryBufferRenderer();
+ }, enumerable: !1, configurable: !0 }), r.prototype._initializeAttachments = function() {
+ for (var t = [], e = [!1], n = [!0], i = 0; i < this.mrtCount; i++)
+ t.push(!0), i > 0 && (e.push(!0), n.push(!1));
+ this._multiRenderAttachments = this._engine.buildTextureLayout(t), this._clearAttachments = this._engine.buildTextureLayout(e), this._defaultAttachments = this._engine.buildTextureLayout(n);
+ }, r.prototype._createCompositionEffect = function() {
+ this.prePassRT = new Jl("sceneprePassRT", { width: this._engine.getRenderWidth(), height: this._engine.getRenderHeight() }, this.mrtCount, this._scene, { generateMipMaps: !1, generateDepthTexture: !0, defaultType: d.a.TEXTURETYPE_UNSIGNED_INT, types: this._mrtFormats }), this.prePassRT.samples = 1, this._initializeAttachments(), this._useGeometryBufferFallback && !this._geometryBuffer && (this.useGeometryBufferFallback = !0), this.imageProcessingPostProcess = new ys("sceneCompositionPass", 1, null, void 0, this._engine), this.imageProcessingPostProcess.autoClear = !1;
+ }, Object.defineProperty(r.prototype, "isSupported", { get: function() {
+ return this._engine.webGLVersion > 1 || this._scene.getEngine().getCaps().drawBuffersExtension;
+ }, enumerable: !1, configurable: !0 }), r.prototype.bindAttachmentsForEffect = function(t, e) {
+ if (this.enabled) {
+ if (t._multiTarget)
+ this._engine.bindAttachments(this._multiRenderAttachments);
+ else if (this._engine.bindAttachments(this._defaultAttachments), this._geometryBuffer) {
+ var n = e.getMaterial();
+ n && this.excludedMaterials.indexOf(n) === -1 && this._geometryBuffer.renderList.push(e.getRenderingMesh());
+ }
+ }
+ }, r.prototype.restoreAttachments = function() {
+ this.enabled && this._defaultAttachments && this._engine.bindAttachments(this._defaultAttachments);
+ }, r.prototype._beforeCameraDraw = function() {
+ this._isDirty && this._update(), this._geometryBuffer && (this._geometryBuffer.renderList.length = 0), this._bindFrameBuffer();
+ }, r.prototype._afterCameraDraw = function() {
+ if (this._enabled) {
+ var t = this._scene.activeCamera && this._scene.activeCamera._getFirstPostProcess();
+ t && this._postProcesses.length && this._scene.postProcessManager._prepareFrame(), this._scene.postProcessManager.directRender(this._postProcesses, t ? t.inputTexture : null);
+ }
+ }, r.prototype._checkRTSize = function() {
+ var t = this._engine.getRenderWidth(!0), e = this._engine.getRenderHeight(!0), n = this.prePassRT.getRenderWidth(), i = this.prePassRT.getRenderHeight();
+ n === t && i === e || (this.prePassRT.resize({ width: t, height: e }), this._updateGeometryBufferLayout(), this._bindPostProcessChain());
+ }, r.prototype._bindFrameBuffer = function() {
+ if (this._enabled) {
+ this._checkRTSize();
+ var t = this.prePassRT.getInternalTexture();
+ t && this._engine.bindFramebuffer(t);
+ }
+ }, r.prototype.clear = function() {
+ this._enabled && (this._bindFrameBuffer(), this._engine.clear(this._scene.clearColor, this._scene.autoClear || this._scene.forceWireframe || this._scene.forcePointsCloud, this._scene.autoClearDepthAndStencil, this._scene.autoClearDepthAndStencil), this._engine.bindAttachments(this._clearAttachments), this._engine.clear(this._clearColor, !0, !1, !1), this._engine.bindAttachments(this._defaultAttachments));
+ }, r.prototype._setState = function(t) {
+ this._enabled = t, this._scene.prePass = t, this.imageProcessingPostProcess && (this.imageProcessingPostProcess.imageProcessingConfiguration.applyByPostProcess = t);
+ }, r.prototype._updateGeometryBufferLayout = function() {
+ if (this._geometryBuffer) {
+ this._geometryBuffer._resetLayout();
+ for (var t = [], e = 0; e < this._mrtLayout.length; e++)
+ t.push(!1);
+ this._geometryBuffer._linkInternalTexture(this.prePassRT.getInternalTexture());
+ var n = [{ prePassConstant: d.a.PREPASS_DEPTHNORMAL_TEXTURE_TYPE, geometryBufferConstant: Oi.DEPTHNORMAL_TEXTURE_TYPE }, { prePassConstant: d.a.PREPASS_POSITION_TEXTURE_TYPE, geometryBufferConstant: Oi.POSITION_TEXTURE_TYPE }, { prePassConstant: d.a.PREPASS_REFLECTIVITY_TEXTURE_TYPE, geometryBufferConstant: Oi.REFLECTIVITY_TEXTURE_TYPE }, { prePassConstant: d.a.PREPASS_VELOCITY_TEXTURE_TYPE, geometryBufferConstant: Oi.VELOCITY_TEXTURE_TYPE }];
+ for (e = 0; e < n.length; e++) {
+ var i = this._mrtLayout.indexOf(n[e].prePassConstant);
+ i !== -1 && (this._geometryBuffer._forceTextureType(n[e].geometryBufferConstant, i), t[i] = !0);
+ }
+ this._geometryBuffer._setAttachments(this._engine.buildTextureLayout(t));
+ }
+ }, r.prototype.addEffectConfiguration = function(t) {
+ for (var e = 0; e < this._effectConfigurations.length; e++)
+ if (this._effectConfigurations[e].name === t.name)
+ return this._effectConfigurations[e];
+ return this._effectConfigurations.push(t), t;
+ }, r.prototype.getIndex = function(t) {
+ return this._textureIndices[t];
+ }, r.prototype._enable = function() {
+ for (var t, e, n = this.mrtCount, i = 0; i < this._effectConfigurations.length; i++)
+ this._effectConfigurations[i].enabled && this._enableTextures(this._effectConfigurations[i].texturesRequired);
+ for (this.prePassRT && this.mrtCount !== n && this.prePassRT.updateCount(this.mrtCount, { types: this._mrtFormats }), this._updateGeometryBufferLayout(), this._resetPostProcessChain(), i = 0; i < this._effectConfigurations.length; i++)
+ this._effectConfigurations[i].enabled && (!this._effectConfigurations[i].postProcess && this._effectConfigurations[i].createPostProcess && this._effectConfigurations[i].createPostProcess(), this._effectConfigurations[i].postProcess && this._postProcesses.push(this._effectConfigurations[i].postProcess));
+ this._initializeAttachments(), this.imageProcessingPostProcess || this._createCompositionEffect();
+ var o = !1;
+ if (!((t = this._scene.activeCamera) === null || t === void 0) && t._postProcesses)
+ for (i = 0; i < this._scene.activeCamera._postProcesses.length; i++)
+ ((e = this._scene.activeCamera._postProcesses[i]) === null || e === void 0 ? void 0 : e.getClassName()) === "ImageProcessingPostProcess" && (o = !0);
+ o || this.disableGammaTransform || this._postProcesses.push(this.imageProcessingPostProcess), this._bindPostProcessChain(), this._setState(!0);
+ }, r.prototype._disable = function() {
+ this._setState(!1), this._resetLayout();
+ for (var t = 0; t < this._effectConfigurations.length; t++)
+ this._effectConfigurations[t].enabled = !1;
+ }, r.prototype._resetLayout = function() {
+ for (var t = 0; t < this._textureFormats.length; t++)
+ this._textureIndices[this._textureFormats[t].type] = -1;
+ this._textureIndices[d.a.PREPASS_COLOR_TEXTURE_TYPE] = 0, this._mrtLayout = [d.a.PREPASS_COLOR_TEXTURE_TYPE], this._mrtFormats = [d.a.TEXTURETYPE_HALF_FLOAT], this.mrtCount = 1;
+ }, r.prototype._resetPostProcessChain = function() {
+ this._postProcesses = [], this.imageProcessingPostProcess && this.imageProcessingPostProcess.restoreDefaultInputTexture();
+ for (var t = 0; t < this._effectConfigurations.length; t++)
+ this._effectConfigurations[t].postProcess && this._effectConfigurations[t].postProcess.restoreDefaultInputTexture();
+ }, r.prototype._bindPostProcessChain = function() {
+ var t;
+ if (this._postProcesses.length)
+ this._postProcesses[0].inputTexture = this.prePassRT.getInternalTexture();
+ else {
+ var e = (t = this._scene.activeCamera) === null || t === void 0 ? void 0 : t._getFirstPostProcess();
+ e && (e.inputTexture = this.prePassRT.getInternalTexture());
+ }
+ }, r.prototype.markAsDirty = function() {
+ this._isDirty = !0;
+ }, r.prototype._enableTextures = function(t) {
+ for (var e = 0; e < t.length; e++) {
+ var n = t[e];
+ this._textureIndices[n] === -1 && (this._textureIndices[n] = this._mrtLayout.length, this._mrtLayout.push(n), this._mrtFormats.push(this._textureFormats[n].format), this.mrtCount++);
+ }
+ }, r.prototype._update = function() {
+ this._disable();
+ for (var t = !1, e = 0; e < this._scene.materials.length; e++)
+ this._scene.materials[e].setPrePassRenderer(this) && (t = !0);
+ var n = this._scene.activeCamera;
+ if (n) {
+ var i = n._postProcesses.filter(function(o) {
+ return o != null;
+ });
+ if (i)
+ for (e = 0; e < i.length; e++)
+ i[e].setPrePassRenderer(this) && (t = !0);
+ this._markAllMaterialsAsPrePassDirty(), this._isDirty = !1, t && this._enable(), this.enabled || (this._engine.restoreDefaultFramebuffer(), this._engine.restoreSingleAttachment());
+ }
+ }, r.prototype._markAllMaterialsAsPrePassDirty = function() {
+ for (var t = this._scene.materials, e = 0; e < t.length; e++)
+ t[e].markAsDirty(Zt.a.PrePassDirtyFlag);
+ }, r.prototype.dispose = function() {
+ for (var t = 0; t < this._effectConfigurations.length; t++)
+ this._effectConfigurations[t].dispose && this._effectConfigurations[t].dispose();
+ this.imageProcessingPostProcess.dispose(), this.prePassRT.dispose();
+ }, r._SceneComponentInitialization = function(t) {
+ throw Nn.a.WarnImport("PrePassRendererSceneComponent");
+ }, r;
+ }();
+ Object.defineProperty(ge.a.prototype, "prePassRenderer", { get: function() {
+ return this._prePassRenderer;
+ }, set: function(r) {
+ r && r.isSupported && (this._prePassRenderer = r);
+ }, enumerable: !0, configurable: !0 }), ge.a.prototype.enablePrePassRenderer = function() {
+ return this._prePassRenderer || (this._prePassRenderer = new Yu(this), this._prePassRenderer.isSupported || (this._prePassRenderer = null, h.a.Error(`PrePassRenderer needs WebGL 2 support.
+Maybe you tried to use the following features that need the PrePassRenderer :
+ + Subsurface Scattering`))), this._prePassRenderer;
+ }, ge.a.prototype.disablePrePassRenderer = function() {
+ this._prePassRenderer && (this._prePassRenderer.dispose(), this._prePassRenderer = null);
+ };
+ var Q_ = function() {
+ function r(t) {
+ this.name = st.a.NAME_PREPASSRENDERER, this.scene = t;
+ }
+ return r.prototype.register = function() {
+ this.scene._beforeCameraDrawStage.registerStep(st.a.STEP_BEFORECAMERADRAW_PREPASS, this, this._beforeCameraDraw), this.scene._afterCameraDrawStage.registerStep(st.a.STEP_AFTERCAMERADRAW_PREPASS, this, this._afterCameraDraw), this.scene._beforeClearStage.registerStep(st.a.STEP_BEFORECLEARSTAGE_PREPASS, this, this._beforeClearStage), this.scene._beforeRenderingMeshStage.registerStep(st.a.STEP_BEFORERENDERINGMESH_PREPASS, this, this._beforeRenderingMeshStage), this.scene._afterRenderingMeshStage.registerStep(st.a.STEP_AFTERRENDERINGMESH_PREPASS, this, this._afterRenderingMeshStage);
+ }, r.prototype._beforeCameraDraw = function() {
+ this.scene.prePassRenderer && this.scene.prePassRenderer._beforeCameraDraw();
+ }, r.prototype._afterCameraDraw = function() {
+ this.scene.prePassRenderer && this.scene.prePassRenderer._afterCameraDraw();
+ }, r.prototype._beforeClearStage = function() {
+ this.scene.prePassRenderer && this.scene.prePassRenderer.clear();
+ }, r.prototype._beforeRenderingMeshStage = function(t, e, n, i) {
+ if (i) {
+ var o = t.getScene();
+ o.prePassRenderer && o.prePassRenderer.bindAttachmentsForEffect(i, e);
+ }
+ }, r.prototype._afterRenderingMeshStage = function(t) {
+ var e = t.getScene();
+ e.prePassRenderer && e.prePassRenderer.restoreAttachments();
+ }, r.prototype.rebuild = function() {
+ }, r.prototype.dispose = function() {
+ }, r;
+ }();
+ Yu._SceneComponentInitialization = function(r) {
+ var t = r._getComponent(st.a.NAME_PREPASSRENDERER);
+ t || (t = new Q_(r), r._addComponent(t));
+ };
+ var eT = `#define rcp(x) 1./x
+#define GOLDEN_RATIO 1.618033988749895
+#define TWO_PI 6.2831855
+
+
+vec2 Golden2dSeq(int i,float n)
+{
+
+
+return vec2(float(i)/n+(0.5/n),fract(float(i)*rcp(GOLDEN_RATIO)));
+}
+vec2 SampleDiskGolden(int i,int sampleCount)
+{
+vec2 f=Golden2dSeq(i,float(sampleCount));
+return vec2(sqrt(f.x),TWO_PI*f.y);
+}`;
+ We.a.IncludesShadersStore.fibonacci = eT;
+ var tT = `uniform vec3 diffusionS[5];
+uniform float diffusionD[5];
+uniform float filterRadii[5];`;
+ We.a.IncludesShadersStore.diffusionProfile = tT;
+ var nT = `
+#include
+#include
+#include
+#include
+varying vec2 vUV;
+uniform vec2 texelSize;
+uniform sampler2D textureSampler;
+uniform sampler2D irradianceSampler;
+uniform sampler2D depthSampler;
+uniform sampler2D albedoSampler;
+uniform vec2 viewportSize;
+uniform float metersPerUnit;
+const float LOG2_E=1.4426950408889634;
+const float SSS_PIXELS_PER_SAMPLE=4.;
+const int _SssSampleBudget=40;
+#define rcp(x) 1./x
+#define Sq(x) x*x
+#define SSS_BILATERAL_FILTER true
+
+
+vec3 EvalBurleyDiffusionProfile(float r,vec3 S)
+{
+vec3 exp_13=exp2(((LOG2_E*(-1.0/3.0))*r)*S);
+vec3 expSum=exp_13*(1.+exp_13*exp_13);
+return (S*rcp(8.*PI))*expSum;
+}
+
+
+
+
+
+
+vec2 SampleBurleyDiffusionProfile(float u,float rcpS)
+{
+u=1.-u;
+float g=1.+(4.*u)*(2.*u+sqrt(1.+(4.*u)*u));
+float n=exp2(log2(g)*(-1.0/3.0));
+float p=(g*n)*n;
+float c=1.+p+n;
+float d=(3./LOG2_E*2.)+(3./LOG2_E)*log2(u);
+float x=(3./LOG2_E)*log2(c)-d;
+
+
+
+
+
+
+float rcpExp=((c*c)*c)*rcp((4.*u)*((c*c)+(4.*u)*(4.*u)));
+float r=x*rcpS;
+float rcpPdf=(8.*PI*rcpS)*rcpExp;
+return vec2(r,rcpPdf);
+}
+
+
+vec3 ComputeBilateralWeight(float xy2,float z,float mmPerUnit,vec3 S,float rcpPdf)
+{
+#ifndef SSS_BILATERAL_FILTER
+z=0.;
+#endif
+
+
+
+float r=sqrt(xy2+(z*mmPerUnit)*(z*mmPerUnit));
+float area=rcpPdf;
+#if SSS_CLAMP_ARTIFACT
+return clamp(EvalBurleyDiffusionProfile(r,S)*area,0.0,1.0);
+#else
+return EvalBurleyDiffusionProfile(r,S)*area;
+#endif
+}
+void EvaluateSample(int i,int n,vec3 S,float d,vec3 centerPosVS,float mmPerUnit,float pixelsPerMm,
+float phase,inout vec3 totalIrradiance,inout vec3 totalWeight)
+{
+
+float scale=rcp(float(n));
+float offset=rcp(float(n))*0.5;
+
+float sinPhase,cosPhase;
+sinPhase=sin(phase);
+cosPhase=cos(phase);
+vec2 bdp=SampleBurleyDiffusionProfile(float(i)*scale+offset,d);
+float r=bdp.x;
+float rcpPdf=bdp.y;
+float phi=SampleDiskGolden(i,n).y;
+float sinPhi,cosPhi;
+sinPhi=sin(phi);
+cosPhi=cos(phi);
+float sinPsi=cosPhase*sinPhi+sinPhase*cosPhi;
+float cosPsi=cosPhase*cosPhi-sinPhase*sinPhi;
+vec2 vec=r*vec2(cosPsi,sinPsi);
+
+vec2 position;
+float xy2;
+position=vUV+round((pixelsPerMm*r)*vec2(cosPsi,sinPsi))*texelSize;
+xy2=r*r;
+vec4 textureSample=texture2D(irradianceSampler,position);
+float viewZ=texture2D(depthSampler,position).r;
+vec3 irradiance=textureSample.rgb;
+if (testLightingForSSS(textureSample.a))
+{
+
+float relZ=viewZ-centerPosVS.z;
+vec3 weight=ComputeBilateralWeight(xy2,relZ,mmPerUnit,S,rcpPdf);
+totalIrradiance+=weight*irradiance;
+totalWeight+=weight;
+}
+else
+{
+
+
+
+
+
+
+}
+}
+void main(void)
+{
+vec4 irradianceAndDiffusionProfile=texture2D(irradianceSampler,vUV);
+vec3 centerIrradiance=irradianceAndDiffusionProfile.rgb;
+int diffusionProfileIndex=int(round(irradianceAndDiffusionProfile.a*255.));
+float centerDepth=0.;
+vec4 inputColor=texture2D(textureSampler,vUV);
+bool passedStencilTest=testLightingForSSS(irradianceAndDiffusionProfile.a);
+if (passedStencilTest)
+{
+centerDepth=texture2D(depthSampler,vUV).r;
+}
+if (!passedStencilTest) {
+gl_FragColor=inputColor;
+return;
+}
+float distScale=1.;
+vec3 S=diffusionS[diffusionProfileIndex];
+float d=diffusionD[diffusionProfileIndex];
+float filterRadius=filterRadii[diffusionProfileIndex];
+
+vec2 centerPosNDC=vUV;
+vec2 cornerPosNDC=vUV+0.5*texelSize;
+vec3 centerPosVS=vec3(centerPosNDC*viewportSize,1.0)*centerDepth;
+vec3 cornerPosVS=vec3(cornerPosNDC*viewportSize,1.0)*centerDepth;
+
+float mmPerUnit=1000.*(metersPerUnit*rcp(distScale));
+float unitsPerMm=rcp(mmPerUnit);
+
+
+float unitsPerPixel=2.*abs(cornerPosVS.x-centerPosVS.x);
+float pixelsPerMm=rcp(unitsPerPixel)*unitsPerMm;
+
+float filterArea=PI*Sq(filterRadius*pixelsPerMm);
+int sampleCount=int(filterArea*rcp(SSS_PIXELS_PER_SAMPLE));
+int sampleBudget=_SssSampleBudget;
+int texturingMode=0;
+vec3 albedo=texture2D(albedoSampler,vUV).rgb;
+if (distScale == 0. || sampleCount<1)
+{
+#ifdef DEBUG_SSS_SAMPLES
+vec3 green=vec3(0.,1.,0.);
+gl_FragColor=vec4(green,1.0);
+return;
+#endif
+gl_FragColor=vec4(inputColor.rgb+albedo*centerIrradiance,1.0);
+return;
+}
+#ifdef DEBUG_SSS_SAMPLES
+vec3 red=vec3(1.,0.,0.);
+vec3 blue=vec3(0.,0.,1.);
+gl_FragColor=vec4(mix(blue,red,clamp(float(sampleCount)/float(sampleBudget),0.0,1.0)),1.0);
+return;
+#endif
+
+float phase=0.;
+int n=min(sampleCount,sampleBudget);
+
+vec3 centerWeight=vec3(0.);
+vec3 totalIrradiance=vec3(0.);
+vec3 totalWeight=vec3(0.);
+for (int i=0; i= 5)
+ return h.a.Error("You already reached the maximum number of diffusion profiles."), 0;
+ for (var e = 0; e < this._ssDiffusionS.length / 3; e++)
+ if (this._ssDiffusionS[3 * e] === t.r && this._ssDiffusionS[3 * e + 1] === t.g && this._ssDiffusionS[3 * e + 2] === t.b)
+ return e;
+ return this._ssDiffusionS.push(t.r, t.b, t.g), this._ssDiffusionD.push(Math.max(Math.max(t.r, t.b), t.g)), this._ssFilterRadii.push(this.getDiffusionProfileParameters(t)), this.ssDiffusionProfileColors.push(t), this._ssDiffusionD.length - 1;
+ }, r.prototype.createPostProcess = function() {
+ return this.postProcess = new iT("subSurfaceScattering", this._scene, 1, null, void 0, this._scene.getEngine()), this.postProcess.autoClear = !1, this.postProcess;
+ }, r.prototype.clearAllDiffusionProfiles = function() {
+ this._ssDiffusionD = [], this._ssDiffusionS = [], this._ssFilterRadii = [], this.ssDiffusionProfileColors = [];
+ }, r.prototype.dispose = function() {
+ this.clearAllDiffusionProfiles(), this.postProcess.dispose();
+ }, r.prototype.getDiffusionProfileParameters = function(t) {
+ var e = Math.max(t.r, t.g, t.b);
+ return this._sampleBurleyDiffusionProfile(0.997, e);
+ }, r.prototype._sampleBurleyDiffusionProfile = function(t, e) {
+ var n = 1 + 4 * (t = 1 - t) * (2 * t + Math.sqrt(1 + 4 * t * t)), i = Math.pow(n, -1 / 3), o = 1 + n * i * i + i;
+ return 3 * Math.log(o / (4 * t)) * e;
+ }, r._SceneComponentInitialization = function(t) {
+ throw Nn.a.WarnImport("PrePassRendererSceneComponent");
+ }, r;
+ }();
+ D.a.AddParser(st.a.NAME_SUBSURFACE, function(r, t) {
+ if (r.ssDiffusionProfileColors !== void 0 && r.ssDiffusionProfileColors !== null && (t.enableSubSurfaceForPrePass(), t.subSurfaceConfiguration))
+ for (var e = 0, n = r.ssDiffusionProfileColors.length; e < n; e++) {
+ var i = r.ssDiffusionProfileColors[e];
+ t.subSurfaceConfiguration.addDiffusionProfile(new C.a(i.r, i.g, i.b));
+ }
+ }), Object.defineProperty(ge.a.prototype, "subSurfaceConfiguration", { get: function() {
+ return this._subSurfaceConfiguration;
+ }, set: function(r) {
+ r && this.enablePrePassRenderer() && (this._subSurfaceConfiguration = r);
+ }, enumerable: !0, configurable: !0 }), ge.a.prototype.enableSubSurfaceForPrePass = function() {
+ if (this._subSurfaceConfiguration)
+ return this._subSurfaceConfiguration;
+ var r = this.enablePrePassRenderer();
+ return r ? (this._subSurfaceConfiguration = new q_(this), r.addEffectConfiguration(this._subSurfaceConfiguration), this._subSurfaceConfiguration) : null;
+ }, ge.a.prototype.disableSubSurfaceForPrePass = function() {
+ this._subSurfaceConfiguration && (this._subSurfaceConfiguration.dispose(), this._subSurfaceConfiguration = null);
+ };
+ var Z_ = function() {
+ function r(t) {
+ this.name = st.a.NAME_PREPASSRENDERER, this.scene = t;
+ }
+ return r.prototype.register = function() {
+ }, r.prototype.serialize = function(t) {
+ if (this.scene.subSurfaceConfiguration) {
+ var e = this.scene.subSurfaceConfiguration.ssDiffusionProfileColors;
+ t.ssDiffusionProfileColors = [];
+ for (var n = 0; n < e.length; n++)
+ t.ssDiffusionProfileColors.push({ r: e[n].r, g: e[n].g, b: e[n].b });
+ }
+ }, r.prototype.addFromContainer = function(t) {
+ }, r.prototype.removeFromContainer = function(t, e) {
+ this.scene.prePassRenderer && this.scene.subSurfaceConfiguration && this.scene.subSurfaceConfiguration.clearAllDiffusionProfiles();
+ }, r.prototype.rebuild = function() {
+ }, r.prototype.dispose = function() {
+ }, r;
+ }();
+ q_._SceneComponentInitialization = function(r) {
+ var t = r._getComponent(st.a.NAME_SUBSURFACE);
+ t || (t = new Z_(r), r._addComponent(t));
+ };
+ var rT = `#ifdef LOGARITHMICDEPTH
+#extension GL_EXT_frag_depth : enable
+#endif
+uniform vec4 color;
+#ifdef ALPHATEST
+varying vec2 vUV;
+uniform sampler2D diffuseSampler;
+#endif
+#include
+void main(void) {
+#ifdef ALPHATEST
+if (texture2D(diffuseSampler,vUV).a<0.4)
+discard;
+#endif
+#include
+gl_FragColor=color;
+}`;
+ We.a.ShadersStore.outlinePixelShader = rT;
+ var oT = `
+attribute vec3 position;
+attribute vec3 normal;
+#include
+#include
+#include