diff --git a/assets/dark/1.jpg b/assets/dark/1.jpg deleted file mode 100644 index 6a32479f..00000000 Binary files a/assets/dark/1.jpg and /dev/null differ diff --git a/assets/icons/blank_fallback.svg b/assets/icons/blank_fallback.svg new file mode 100644 index 00000000..00585d2d --- /dev/null +++ b/assets/icons/blank_fallback.svg @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/assets/icons/cardano.svg b/assets/icons/cardano.svg new file mode 100644 index 00000000..b732eef6 --- /dev/null +++ b/assets/icons/cardano.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/icons/index.ts b/assets/icons/index.ts index 90177943..5bbf1e5d 100644 --- a/assets/icons/index.ts +++ b/assets/icons/index.ts @@ -7,3 +7,5 @@ export { default as StarIcon } from "./star.svg"; export { default as CopyIcon } from "./copy.svg"; export { default as CopySuccessIcon } from "./copy_success.svg"; export { default as SingleCommitIcon } from "./single_commit.svg"; +export { default as CardanoIcon } from "./cardano.svg"; +export { default as BlankFallback } from "./blank_fallback.svg"; diff --git a/assets/icons/oss.svg b/assets/icons/oss.svg index 3c7642e6..6e0a8644 100644 --- a/assets/icons/oss.svg +++ b/assets/icons/oss.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/images/black_sand.jpg b/assets/images/black_sand.jpg deleted file mode 100644 index 6a32479f..00000000 Binary files a/assets/images/black_sand.jpg and /dev/null differ diff --git a/assets/light/1.jpg b/assets/light/1.jpg deleted file mode 100644 index ed6d403a..00000000 Binary files a/assets/light/1.jpg and /dev/null differ diff --git a/components/Favicon.tsx b/components/Favicon.tsx deleted file mode 100644 index 1a3d93eb..00000000 --- a/components/Favicon.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import Image from "next/image"; - -type FaviconProps = { - url: string | null; -}; - -const Favicon = ({ url }: FaviconProps) => { - return ( -
- {""} -
- ); -}; - -export default Favicon; diff --git a/components/HomeHero.jsx b/components/HomeHero.jsx index 726acd1d..5855b911 100644 --- a/components/HomeHero.jsx +++ b/components/HomeHero.jsx @@ -1,4 +1,3 @@ -// components/HomeHero.jsx import Link from "next/link"; import Image from "next/image"; import bgImage from "../assets/images/bg.jpg"; @@ -26,7 +25,10 @@ const HomeHero = () => {

-
+
Adastack is your comprehensive guide to the Cardano ecosystem. Open-source knowledge, curated by the Cardano community. diff --git a/components/LibraryInfoBar.tsx b/components/LibraryInfoBar.tsx new file mode 100644 index 00000000..d8cc9105 --- /dev/null +++ b/components/LibraryInfoBar.tsx @@ -0,0 +1,21 @@ +import React from "react"; +import RepoShieldIo from "./badges/shield_io_badges/RepoShieldIo"; +import LanguageShieldIo from "./badges/shield_io_badges/LanguageShieldIo"; +import LatestCommitBadgeIo from "./badges/shield_io_badges/LatestCommitBadgeIo"; + +interface LibraryInfoBarProps { + repoURL: string; + language: string; +} + +const LibraryInfoBar = ({ repoURL, language }: LibraryInfoBarProps) => { + return ( +
+ + + +
+ ); +}; + +export default LibraryInfoBar; diff --git a/components/StarBadge.tsx b/components/StarBadge.tsx deleted file mode 100644 index b8ca0c08..00000000 --- a/components/StarBadge.tsx +++ /dev/null @@ -1,138 +0,0 @@ -import React, { useEffect, useState, useCallback } from "react"; - -const isValidRepoURL = (url) => { - try { - const parsedURL = new URL(url); - const isGitHub = parsedURL.hostname === "github.com"; - const pathParts = parsedURL.pathname.split("/").filter(Boolean); - - return isGitHub && pathParts.length >= 1; - } catch (error) { - console.error("Error parsing URL:", error); - return false; - } -}; - -// Memoized StarIcon component -const StarIcon = React.memo(() => ( - -)); - -StarIcon.displayName = "StarIcon"; - -const StarBadge = ({ repoURL }) => { - const [stars, setStars] = useState(null); - const [loading, setLoading] = useState(true); - const [error, setError] = useState(null); - - // Function to fetch all GitHub repos for a user or organization - const fetchAllGitHubRepos = useCallback(async (url, name) => { - let response = await fetch(url, { - headers: { - Authorization: `token ${process.env.GITHUB_ACCESS_TOKEN}`, - Accept: "application/vnd.github.v3+json", - }, - }); - if (response.status === 404) { - // If user not found, try organization endpoint - url = `https://api.github.com/orgs/${name}/repos?per_page=100`; - response = await fetch(url, { - headers: { - Authorization: `token ${process.env.GITHUB_ACCESS_TOKEN}`, - Accept: "application/vnd.github.v3+json", - }, - }); - } - if (!response.ok) { - const errorMessage = `HTTP error! Status: ${response.status}, Text: ${response.statusText}`; - console.error(errorMessage); - throw new Error(errorMessage); - } - const repos = await response.json(); - const nextLink = response.headers - .get("Link") - ?.match(/<([^>]+)>;\s*rel="next"/)?.[1]; - return { repos, nextLink }; - }, []); - - // Function to fetch total star count for a GitHub user or organization - const fetchGitHubStars = useCallback( - async (name) => { - let url = `https://api.github.com/users/${name}/repos?per_page=100`; - let totalStars = 0; - - while (url) { - const { repos, nextLink } = await fetchAllGitHubRepos(url, name); - totalStars += repos.reduce( - (sum, repo) => sum + repo.stargazers_count, - 0 - ); - url = nextLink; - } - return totalStars; - }, - [fetchAllGitHubRepos] - ); - - // Main function to fetch stars - const fetchStars = useCallback(async () => { - if (!isValidRepoURL(repoURL)) { - console.error("Error: Invalid repository URL"); - setError("Error: Invalid URL"); - setLoading(false); - return; - } - - try { - const urlParts = new URL(repoURL).pathname.split("/").filter(Boolean); - const owner = urlParts[0]; - const starCount = await fetchGitHubStars(owner); - - setStars(starCount); - setLoading(false); - } catch (error) { - console.error("Error fetching stars:", error); - setError("Unable to fetch data"); - setLoading(false); - } - }, [repoURL, fetchGitHubStars]); - - // Effect to trigger star fetching - useEffect(() => { - fetchStars(); - }, [fetchStars]); - - // Determine badge content based on loading/error state - const getBadgeContent = () => { - if (loading) return "Loading..."; - if (error) return error; - return stars !== null ? stars.toLocaleString() : "N/A"; - }; - - // Render the star badge - return ( - - - - {getBadgeContent()} - - - ); -}; - -export default StarBadge; diff --git a/components/badges/Favicon.tsx b/components/badges/Favicon.tsx index 89ba2d54..b0f5d07b 100644 --- a/components/badges/Favicon.tsx +++ b/components/badges/Favicon.tsx @@ -1,16 +1,31 @@ import Image from "next/image"; +import { useState } from "react"; +import { BlankFallback } from "../../assets/icons"; type FaviconProps = { url: string | null; }; const Favicon = ({ url }: FaviconProps) => { + const [imageError, setImageError] = useState(false); + const [src] = useState( + `https://www.google.com/s2/favicons?sz=128&domain_url=${url}` + ); + return ( - - {""} + + {imageError ? ( + + ) : ( + Favicon setImageError(true)} + /> + )} ); }; diff --git a/components/badges/OS.tsx b/components/badges/OS.tsx new file mode 100644 index 00000000..a96e6f73 --- /dev/null +++ b/components/badges/OS.tsx @@ -0,0 +1,19 @@ +import { OSIcon } from "../../assets/icons"; + +const OS = ({ url, className }) => { + if (!url) return null; + + const spanClass = className + ? `open-source-icon-inline inline-block h-3 w-3 ${className}` + : "open-source-icon-inline inline-block h-3 w-3"; + + return ( + + + + + + ); +}; + +export default OS; diff --git a/components/badges/shield_io_badges/CodeLanguageShieldIoBadge.tsx b/components/badges/shield_io_badges/CodeLanguageShieldIoBadge.tsx deleted file mode 100644 index f27b337f..00000000 --- a/components/badges/shield_io_badges/CodeLanguageShieldIoBadge.tsx +++ /dev/null @@ -1,108 +0,0 @@ -import React from "react"; -import Image from "next/image"; - -const CodeLanguageShieldIoBadge = ({ language }) => { - if (!language) return null; - - // Convert language name to lowercase and handle special cases - const formatLanguageName = (name) => { - const specialCases = { - "c++": "cpp", - "c#": "csharp", - "f#": "fsharp", - "objective-c": "objectivec", - "jupyter notebook": "jupyter", - cuda: "nvidia", - }; - return specialCases[name.toLowerCase()] || name.toLowerCase(); - }; - - const languageLower = formatLanguageName(language); - - // Logo colors mapped to GitHub's language colors - const logoColorMap = { - assembly: "6E4C13", - c: "555555", - cpp: "F34B7D", - csharp: "178600", - css: "563D7C", - dart: "00B4AB", - elixir: "6E4A7E", - elm: "60B5CC", - erlang: "B83998", - fsharp: "B845FC", - go: "00ADD8", - groovy: "4298B8", - haskell: "5D4F85", - html: "E34C26", - java: "B07219", - javascript: "F1E05A", - julia: "A270BA", - jupyter: "DA5B0B", - kotlin: "A97BFF", - latex: "008080", - lua: "000080", - markdown: "083FA1", - nix: "7E7EFF", - objectivec: "438EFF", - ocaml: "3BE133", - perl: "0298C3", - php: "4F5D95", - python: "3572A5", - r: "198CE7", - ruby: "701516", - rust: "DEA584", - scala: "C22D40", - shell: "89E051", - solidity: "AA6746", - swift: "F05138", - typescript: "007ACC", - vim: "199F4B", - vue: "41B883", - webassembly: "04133B", - zig: "EC915C", - default: "333333", - }; - - const logoColor = logoColorMap[languageLower] || logoColorMap.default; - - return ( - <> - - {`${language} - {`${language} - - ); -}; - -export default CodeLanguageShieldIoBadge; diff --git a/components/badges/shield_io_badges/LanguageShieldIo.tsx b/components/badges/shield_io_badges/LanguageShieldIo.tsx new file mode 100644 index 00000000..90d6b87a --- /dev/null +++ b/components/badges/shield_io_badges/LanguageShieldIo.tsx @@ -0,0 +1,114 @@ +import React from "react"; + +interface LanguageShieldIoProps { + language: string; + isColorChanging?: boolean; +} + +const LanguageShieldIo = ({ + language, + isColorChanging = false, +}: LanguageShieldIoProps) => { + if (!language) return null; + + const capitalizedLanguage = + language.charAt(0).toUpperCase() + language.slice(1); + + // Convert language name to lowercase and handle special cases + const formatLanguageName = (name) => { + const specialCases = { + "c++": "cplusplus", + "c#": "csharp", + "f#": "fsharp", + "objective-c": "objectivec", + "jupyter notebook": "jupyter", + html: "html5", + java: "openjdk", + nix: "nixos", + css: "css3", + scss: "sass", + }; + return specialCases[name.toLowerCase()] || name.toLowerCase(); + }; + + const languageLower = formatLanguageName(language); + + const encodedLanguage = encodeURIComponent(capitalizedLanguage); + + // Logo colors mapped to GitHub's language colors + const logoColorMap = { + cplusplus: "007cc7", + csharp: "178600", + fsharp: "B845FC", + objectivec: "438EFF", + jupyter: "DA5B0B", + html5: "E34C26", + openjdk: "ED8B00", + nixos: "5277c3", + assembly: "6E4C13", + css3: "563D7C", + sass: "cc6599", + agda: "315665", + c: "555555", + dart: "00B4AB", + elixir: "6E4A7E", + elm: "60B5CC", + erlang: "B83998", + go: "00ADD8", + groovy: "4298B8", + gleam: "FFAFF3", + haskell: "5D4F85", + javascript: "F1E05A", + julia: "A270BA", + kotlin: "A97BFF", + latex: "008080", + lua: "000080", + markdown: "083FA1", + ocaml: "3BE133", + perl: "0298C3", + php: "4F5D95", + python: "3572A5", + r: "198CE7", + ruby: "701516", + rust: "DEA584", + scala: "C22D40", + shell: "89E051", + solidity: "AA6746", + swift: "F05138", + typescript: "007ACC", + vim: "199F4B", + vue: "4FC08D", + webassembly: "04133B", + zig: "EC915C", + default: "333333", + }; + + const logoColor = logoColorMap[languageLower] || logoColorMap.default; + + if (!isColorChanging) { + return ( + {`${encodedLanguage} + ); + } + + return ( + <> + {`${encodedLanguage} + {`${encodedLanguage} + + ); +}; + +export default LanguageShieldIo; diff --git a/components/badges/shield_io_badges/LatestCommitBadgeIo.tsx b/components/badges/shield_io_badges/LatestCommitBadgeIo.tsx new file mode 100644 index 00000000..ebe9ac1d --- /dev/null +++ b/components/badges/shield_io_badges/LatestCommitBadgeIo.tsx @@ -0,0 +1,36 @@ +import React from "react"; + +interface LatestCommitBadgeIoProps { + repoURL: string; +} + +const LatestCommitBadgeIo = ({ repoURL }: LatestCommitBadgeIoProps) => { + const url = new URL(repoURL); + const cleanPath = url.pathname.replace(/\/+$/, ""); + const pathSegments = cleanPath.split("/").filter(Boolean); + const [owner, repo] = pathSegments; + + const isGitLab = url.hostname === "gitlab.com"; + + + const latestURL = isGitLab + ? `${url.origin}/${owner}/${repo}/-/commits/` + : `${url.origin}/${owner}/${repo}/commits/`; + + + const shieldUrl = isGitLab + ? `https://img.shields.io/gitlab/last-commit/${owner}/${repo}?color=dfe8f0&labelColor=white` + : `https://img.shields.io/github/last-commit/${owner}/${repo}?color=dfe8f0&labelColor=white`; + + return ( + + Latest Commit + + ); +}; + +export default LatestCommitBadgeIo; diff --git a/components/badges/shield_io_badges/RepoShieldIo.tsx b/components/badges/shield_io_badges/RepoShieldIo.tsx new file mode 100644 index 00000000..42f06721 --- /dev/null +++ b/components/badges/shield_io_badges/RepoShieldIo.tsx @@ -0,0 +1,30 @@ +import React from "react"; + +interface RepoShieldIoProps { + repoURL: string; +} + +const RepoShieldIo = ({ repoURL }: RepoShieldIoProps) => { + const url = new URL(repoURL); + const cleanPath = url.pathname.replace(/\/+$/, ''); + const pathSegments = cleanPath.split('/').filter(Boolean); + const [owner, repo] = pathSegments; + + const isGitLab = url.hostname === 'gitlab.com'; + + const shieldUrl = isGitLab + ? `https://img.shields.io/gitlab/stars/${owner}/${repo}?style=social&label=GitLab` + : `https://img.shields.io/github/stars/${owner}/${repo}?style=social&label=GitHub`; + + return ( + + {`${isGitLab + + ); +}; + +export default RepoShieldIo; \ No newline at end of file diff --git a/components/badges/shield_io_badges/RepoShieldIoBadge.tsx b/components/badges/shield_io_badges/RepoShieldIoBadge.tsx deleted file mode 100644 index 98dc4c10..00000000 --- a/components/badges/shield_io_badges/RepoShieldIoBadge.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import React from "react"; -import Image from "next/image"; - -interface RepoShieldIoBadgeProps { - githubUrl: string; - text?: string; -} - -const RepoShieldIoBadge: React.FC = React.memo( - ({ githubUrl, text = "Repo Github" }) => { - if (!githubUrl) { - return null; - } - - // Extract owner and repo from GitHub URL - const urlParts = githubUrl.split("/"); - const owner = urlParts[urlParts.length - 2]; - const repo = urlParts[urlParts.length - 1]; - - // Create shields.io URL with flat style and white background - const shieldsIoUrl = `https://img.shields.io/github/stars/${owner}/${repo}?style=flat&logo=github&logoColor=000000&label=${encodeURIComponent( - text - )}&labelColor=ffffff&color=ffffff`; - - return ( - - {`${text} - - ); - } -); - -// Assign display name to the memoized component -RepoShieldIoBadge.displayName = "RepoShieldIoBadge"; - -export default RepoShieldIoBadge; diff --git a/components/demo_components/blackhole.js b/components/demo_components/blackhole.js deleted file mode 100644 index e64abdef..00000000 --- a/components/demo_components/blackhole.js +++ /dev/null @@ -1,33398 +0,0 @@ -import React, { useEffect } from "react"; -import * as THREE from "three"; -import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js"; -function Blackhole() { - useEffect(() => { - var lu = Object.defineProperty; - var cu = (r, e, t) => - e in r - ? lu(r, e, { - enumerable: !0, - configurable: !0, - writable: !0, - value: t, - }) - : (r[e] = t); - var Xr = (r, e, t) => (cu(r, typeof e != "symbol" ? e + "" : e, t), t); - const hu = function () { - const e = document.createElement("link").relList; - if (e && e.supports && e.supports("modulepreload")) return; - for (const i of document.querySelectorAll('link[rel="modulepreload"]')) - n(i); - new MutationObserver((i) => { - for (const s of i) - if (s.type === "childList") - for (const a of s.addedNodes) - a.tagName === "LINK" && a.rel === "modulepreload" && n(a); - }).observe(document, { childList: !0, subtree: !0 }); - function t(i) { - const s = {}; - return ( - i.integrity && (s.integrity = i.integrity), - i.referrerpolicy && (s.referrerPolicy = i.referrerpolicy), - i.crossorigin === "use-credentials" - ? (s.credentials = "include") - : i.crossorigin === "anonymous" - ? (s.credentials = "omit") - : (s.credentials = "same-origin"), - s - ); - } - function n(i) { - if (i.ep) return; - i.ep = !0; - const s = t(i); - fetch(i.href, s); - } - }; - hu(); - /** - * @license - * Copyright 2010-2022 Three.js Authors - * SPDX-License-Identifier: MIT - */ const to = "141", - mi = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 }, - gi = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }, - uu = 0, - Io = 1, - du = 2, - Cc = 1, - Lc = 2, - _s = 3, - ki = 0, - qt = 1, - cn = 2, - fu = 1, - Un = 0, - zi = 1, - Sr = 2, - Fo = 3, - No = 4, - pu = 5, - Di = 100, - mu = 101, - gu = 102, - zo = 103, - Oo = 104, - vu = 200, - _u = 201, - xu = 202, - yu = 203, - Rc = 204, - Pc = 205, - Mu = 206, - wu = 207, - bu = 208, - Su = 209, - Tu = 210, - Eu = 0, - Au = 1, - Cu = 2, - Fa = 3, - Lu = 4, - Ru = 5, - Pu = 6, - Du = 7, - zr = 0, - Iu = 1, - Fu = 2, - $t = 0, - Dc = 1, - Ic = 2, - Fc = 3, - Nc = 4, - Nu = 5, - zc = 300, - Ui = 301, - Bi = 302, - Tr = 303, - Na = 304, - Or = 306, - hn = 1e3, - gt = 1001, - Er = 1002, - ft = 1003, - za = 1004, - Oa = 1005, - $e = 1006, - Oc = 1007, - li = 1008, - oi = 1009, - zu = 1010, - Ou = 1011, - kc = 1012, - ku = 1013, - ii = 1014, - Ft = 1015, - Mn = 1016, - Uu = 1017, - Bu = 1018, - Oi = 1020, - Vu = 1021, - Gu = 1022, - Nt = 1023, - Hu = 1024, - Wu = 1025, - ri = 1026, - Vi = 1027, - Uc = 1028, - ju = 1029, - Xu = 1030, - qu = 1031, - $u = 1033, - qr = 33776, - $r = 33777, - Yr = 33778, - Kr = 33779, - ko = 35840, - Uo = 35841, - Bo = 35842, - Vo = 35843, - Yu = 36196, - Go = 37492, - Ho = 37496, - Wo = 37808, - jo = 37809, - Xo = 37810, - qo = 37811, - $o = 37812, - Yo = 37813, - Ko = 37814, - Zo = 37815, - Jo = 37816, - Qo = 37817, - el = 37818, - tl = 37819, - nl = 37820, - il = 37821, - sl = 36492, - Es = 2300, - Gi = 2301, - Zr = 2302, - rl = 2400, - al = 2401, - ol = 2402, - Ku = 2500, - Zu = 2501, - Ju = 1, - Bc = 2, - Vn = 3e3, - Pe = 3001, - Qu = 3200, - ed = 3201, - ci = 0, - td = 1, - yn = "srgb", - si = "srgb-linear", - Jr = 7680, - nd = 519, - ka = 35044, - Tn = "300 es", - Ua = 1035; - class hi { - addEventListener(e, t) { - this._listeners === void 0 && (this._listeners = {}); - const n = this._listeners; - n[e] === void 0 && (n[e] = []), - n[e].indexOf(t) === -1 && n[e].push(t); - } - hasEventListener(e, t) { - if (this._listeners === void 0) return !1; - const n = this._listeners; - return n[e] !== void 0 && n[e].indexOf(t) !== -1; - } - removeEventListener(e, t) { - if (this._listeners === void 0) return; - const i = this._listeners[e]; - if (i !== void 0) { - const s = i.indexOf(t); - s !== -1 && i.splice(s, 1); - } - } - dispatchEvent(e) { - if (this._listeners === void 0) return; - const n = this._listeners[e.type]; - if (n !== void 0) { - e.target = this; - const i = n.slice(0); - for (let s = 0, a = i.length; s < a; s++) i[s].call(this, e); - e.target = null; - } - } - } - const dt = []; - for (let r = 0; r < 256; r++) - dt[r] = (r < 16 ? "0" : "") + r.toString(16); - let ll = 1234567; - const ys = Math.PI / 180, - As = 180 / Math.PI; - function Yt() { - const r = (Math.random() * 4294967295) | 0, - e = (Math.random() * 4294967295) | 0, - t = (Math.random() * 4294967295) | 0, - n = (Math.random() * 4294967295) | 0; - return ( - dt[r & 255] + - dt[(r >> 8) & 255] + - dt[(r >> 16) & 255] + - dt[(r >> 24) & 255] + - "-" + - dt[e & 255] + - dt[(e >> 8) & 255] + - "-" + - dt[((e >> 16) & 15) | 64] + - dt[(e >> 24) & 255] + - "-" + - dt[(t & 63) | 128] + - dt[(t >> 8) & 255] + - "-" + - dt[(t >> 16) & 255] + - dt[(t >> 24) & 255] + - dt[n & 255] + - dt[(n >> 8) & 255] + - dt[(n >> 16) & 255] + - dt[(n >> 24) & 255] - ).toLowerCase(); - } - function at(r, e, t) { - return Math.max(e, Math.min(t, r)); - } - function no(r, e) { - return ((r % e) + e) % e; - } - function id(r, e, t, n, i) { - return n + ((r - e) * (i - n)) / (t - e); - } - function sd(r, e, t) { - return r !== e ? (t - r) / (e - r) : 0; - } - function Ms(r, e, t) { - return (1 - t) * r + t * e; - } - function rd(r, e, t, n) { - return Ms(r, e, 1 - Math.exp(-t * n)); - } - function ad(r, e = 1) { - return e - Math.abs(no(r, e * 2) - e); - } - function od(r, e, t) { - return r <= e - ? 0 - : r >= t - ? 1 - : ((r = (r - e) / (t - e)), r * r * (3 - 2 * r)); - } - function ld(r, e, t) { - return r <= e - ? 0 - : r >= t - ? 1 - : ((r = (r - e) / (t - e)), r * r * r * (r * (r * 6 - 15) + 10)); - } - function cd(r, e) { - return r + Math.floor(Math.random() * (e - r + 1)); - } - function hd(r, e) { - return r + Math.random() * (e - r); - } - function ud(r) { - return r * (0.5 - Math.random()); - } - function dd(r) { - r !== void 0 && (ll = r); - let e = (ll += 1831565813); - return ( - (e = Math.imul(e ^ (e >>> 15), e | 1)), - (e ^= e + Math.imul(e ^ (e >>> 7), e | 61)), - ((e ^ (e >>> 14)) >>> 0) / 4294967296 - ); - } - function fd(r) { - return r * ys; - } - function pd(r) { - return r * As; - } - function Ba(r) { - return (r & (r - 1)) === 0 && r !== 0; - } - function Vc(r) { - return Math.pow(2, Math.ceil(Math.log(r) / Math.LN2)); - } - function Ar(r) { - return Math.pow(2, Math.floor(Math.log(r) / Math.LN2)); - } - function md(r, e, t, n, i) { - const s = Math.cos, - a = Math.sin, - o = s(t / 2), - l = a(t / 2), - c = s((e + n) / 2), - u = a((e + n) / 2), - h = s((e - n) / 2), - d = a((e - n) / 2), - f = s((n - e) / 2), - g = a((n - e) / 2); - switch (i) { - case "XYX": - r.set(o * u, l * h, l * d, o * c); - break; - case "YZY": - r.set(l * d, o * u, l * h, o * c); - break; - case "ZXZ": - r.set(l * h, l * d, o * u, o * c); - break; - case "XZX": - r.set(o * u, l * g, l * f, o * c); - break; - case "YXY": - r.set(l * f, o * u, l * g, o * c); - break; - case "ZYZ": - r.set(l * g, l * f, o * u, o * c); - break; - default: - console.warn( - "THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: " + - i - ); - } - } - function gd(r, e) { - switch (e.constructor) { - case Float32Array: - return r; - case Uint16Array: - return r / 65535; - case Uint8Array: - return r / 255; - case Int16Array: - return Math.max(r / 32767, -1); - case Int8Array: - return Math.max(r / 127, -1); - default: - throw new Error("Invalid component type."); - } - } - function vd(r, e) { - switch (e.constructor) { - case Float32Array: - return r; - case Uint16Array: - return Math.round(r * 65535); - case Uint8Array: - return Math.round(r * 255); - case Int16Array: - return Math.round(r * 32767); - case Int8Array: - return Math.round(r * 127); - default: - throw new Error("Invalid component type."); - } - } - var jt = Object.freeze({ - __proto__: null, - DEG2RAD: ys, - RAD2DEG: As, - generateUUID: Yt, - clamp: at, - euclideanModulo: no, - mapLinear: id, - inverseLerp: sd, - lerp: Ms, - damp: rd, - pingpong: ad, - smoothstep: od, - smootherstep: ld, - randInt: cd, - randFloat: hd, - randFloatSpread: ud, - seededRandom: dd, - degToRad: fd, - radToDeg: pd, - isPowerOfTwo: Ba, - ceilPowerOfTwo: Vc, - floorPowerOfTwo: Ar, - setQuaternionFromProperEuler: md, - normalize: vd, - denormalize: gd, - }); - class ve { - constructor(e = 0, t = 0) { - (this.isVector2 = !0), (this.x = e), (this.y = t); - } - get width() { - return this.x; - } - set width(e) { - this.x = e; - } - get height() { - return this.y; - } - set height(e) { - this.y = e; - } - set(e, t) { - return (this.x = e), (this.y = t), this; - } - setScalar(e) { - return (this.x = e), (this.y = e), this; - } - setX(e) { - return (this.x = e), this; - } - setY(e) { - return (this.y = e), this; - } - setComponent(e, t) { - switch (e) { - case 0: - this.x = t; - break; - case 1: - this.y = t; - break; - default: - throw new Error("index is out of range: " + e); - } - return this; - } - getComponent(e) { - switch (e) { - case 0: - return this.x; - case 1: - return this.y; - default: - throw new Error("index is out of range: " + e); - } - } - clone() { - return new this.constructor(this.x, this.y); - } - copy(e) { - return (this.x = e.x), (this.y = e.y), this; - } - add(e, t) { - return t !== void 0 - ? (console.warn( - "THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead." - ), - this.addVectors(e, t)) - : ((this.x += e.x), (this.y += e.y), this); - } - addScalar(e) { - return (this.x += e), (this.y += e), this; - } - addVectors(e, t) { - return (this.x = e.x + t.x), (this.y = e.y + t.y), this; - } - addScaledVector(e, t) { - return (this.x += e.x * t), (this.y += e.y * t), this; - } - sub(e, t) { - return t !== void 0 - ? (console.warn( - "THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead." - ), - this.subVectors(e, t)) - : ((this.x -= e.x), (this.y -= e.y), this); - } - subScalar(e) { - return (this.x -= e), (this.y -= e), this; - } - subVectors(e, t) { - return (this.x = e.x - t.x), (this.y = e.y - t.y), this; - } - multiply(e) { - return (this.x *= e.x), (this.y *= e.y), this; - } - multiplyScalar(e) { - return (this.x *= e), (this.y *= e), this; - } - divide(e) { - return (this.x /= e.x), (this.y /= e.y), this; - } - divideScalar(e) { - return this.multiplyScalar(1 / e); - } - applyMatrix3(e) { - const t = this.x, - n = this.y, - i = e.elements; - return ( - (this.x = i[0] * t + i[3] * n + i[6]), - (this.y = i[1] * t + i[4] * n + i[7]), - this - ); - } - min(e) { - return ( - (this.x = Math.min(this.x, e.x)), - (this.y = Math.min(this.y, e.y)), - this - ); - } - max(e) { - return ( - (this.x = Math.max(this.x, e.x)), - (this.y = Math.max(this.y, e.y)), - this - ); - } - clamp(e, t) { - return ( - (this.x = Math.max(e.x, Math.min(t.x, this.x))), - (this.y = Math.max(e.y, Math.min(t.y, this.y))), - this - ); - } - clampScalar(e, t) { - return ( - (this.x = Math.max(e, Math.min(t, this.x))), - (this.y = Math.max(e, Math.min(t, this.y))), - this - ); - } - clampLength(e, t) { - const n = this.length(); - return this.divideScalar(n || 1).multiplyScalar( - Math.max(e, Math.min(t, n)) - ); - } - floor() { - return ( - (this.x = Math.floor(this.x)), (this.y = Math.floor(this.y)), this - ); - } - ceil() { - return ( - (this.x = Math.ceil(this.x)), (this.y = Math.ceil(this.y)), this - ); - } - round() { - return ( - (this.x = Math.round(this.x)), (this.y = Math.round(this.y)), this - ); - } - roundToZero() { - return ( - (this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x)), - (this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y)), - this - ); - } - negate() { - return (this.x = -this.x), (this.y = -this.y), this; - } - dot(e) { - return this.x * e.x + this.y * e.y; - } - cross(e) { - return this.x * e.y - this.y * e.x; - } - lengthSq() { - return this.x * this.x + this.y * this.y; - } - length() { - return Math.sqrt(this.x * this.x + this.y * this.y); - } - manhattanLength() { - return Math.abs(this.x) + Math.abs(this.y); - } - normalize() { - return this.divideScalar(this.length() || 1); - } - angle() { - return Math.atan2(-this.y, -this.x) + Math.PI; - } - distanceTo(e) { - return Math.sqrt(this.distanceToSquared(e)); - } - distanceToSquared(e) { - const t = this.x - e.x, - n = this.y - e.y; - return t * t + n * n; - } - manhattanDistanceTo(e) { - return Math.abs(this.x - e.x) + Math.abs(this.y - e.y); - } - setLength(e) { - return this.normalize().multiplyScalar(e); - } - lerp(e, t) { - return ( - (this.x += (e.x - this.x) * t), (this.y += (e.y - this.y) * t), this - ); - } - lerpVectors(e, t, n) { - return ( - (this.x = e.x + (t.x - e.x) * n), - (this.y = e.y + (t.y - e.y) * n), - this - ); - } - equals(e) { - return e.x === this.x && e.y === this.y; - } - fromArray(e, t = 0) { - return (this.x = e[t]), (this.y = e[t + 1]), this; - } - toArray(e = [], t = 0) { - return (e[t] = this.x), (e[t + 1] = this.y), e; - } - fromBufferAttribute(e, t, n) { - return ( - n !== void 0 && - console.warn( - "THREE.Vector2: offset has been removed from .fromBufferAttribute()." - ), - (this.x = e.getX(t)), - (this.y = e.getY(t)), - this - ); - } - rotateAround(e, t) { - const n = Math.cos(t), - i = Math.sin(t), - s = this.x - e.x, - a = this.y - e.y; - return ( - (this.x = s * n - a * i + e.x), (this.y = s * i + a * n + e.y), this - ); - } - random() { - return (this.x = Math.random()), (this.y = Math.random()), this; - } - *[Symbol.iterator]() { - yield this.x, yield this.y; - } - } - class Xt { - constructor() { - (this.isMatrix3 = !0), - (this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1]), - arguments.length > 0 && - console.error( - "THREE.Matrix3: the constructor no longer reads arguments. use .set() instead." - ); - } - set(e, t, n, i, s, a, o, l, c) { - const u = this.elements; - return ( - (u[0] = e), - (u[1] = i), - (u[2] = o), - (u[3] = t), - (u[4] = s), - (u[5] = l), - (u[6] = n), - (u[7] = a), - (u[8] = c), - this - ); - } - identity() { - return this.set(1, 0, 0, 0, 1, 0, 0, 0, 1), this; - } - copy(e) { - const t = this.elements, - n = e.elements; - return ( - (t[0] = n[0]), - (t[1] = n[1]), - (t[2] = n[2]), - (t[3] = n[3]), - (t[4] = n[4]), - (t[5] = n[5]), - (t[6] = n[6]), - (t[7] = n[7]), - (t[8] = n[8]), - this - ); - } - extractBasis(e, t, n) { - return ( - e.setFromMatrix3Column(this, 0), - t.setFromMatrix3Column(this, 1), - n.setFromMatrix3Column(this, 2), - this - ); - } - setFromMatrix4(e) { - const t = e.elements; - return ( - this.set(t[0], t[4], t[8], t[1], t[5], t[9], t[2], t[6], t[10]), - this - ); - } - multiply(e) { - return this.multiplyMatrices(this, e); - } - premultiply(e) { - return this.multiplyMatrices(e, this); - } - multiplyMatrices(e, t) { - const n = e.elements, - i = t.elements, - s = this.elements, - a = n[0], - o = n[3], - l = n[6], - c = n[1], - u = n[4], - h = n[7], - d = n[2], - f = n[5], - g = n[8], - m = i[0], - p = i[3], - v = i[6], - M = i[1], - x = i[4], - w = i[7], - y = i[2], - A = i[5], - L = i[8]; - return ( - (s[0] = a * m + o * M + l * y), - (s[3] = a * p + o * x + l * A), - (s[6] = a * v + o * w + l * L), - (s[1] = c * m + u * M + h * y), - (s[4] = c * p + u * x + h * A), - (s[7] = c * v + u * w + h * L), - (s[2] = d * m + f * M + g * y), - (s[5] = d * p + f * x + g * A), - (s[8] = d * v + f * w + g * L), - this - ); - } - multiplyScalar(e) { - const t = this.elements; - return ( - (t[0] *= e), - (t[3] *= e), - (t[6] *= e), - (t[1] *= e), - (t[4] *= e), - (t[7] *= e), - (t[2] *= e), - (t[5] *= e), - (t[8] *= e), - this - ); - } - determinant() { - const e = this.elements, - t = e[0], - n = e[1], - i = e[2], - s = e[3], - a = e[4], - o = e[5], - l = e[6], - c = e[7], - u = e[8]; - return ( - t * a * u - - t * o * c - - n * s * u + - n * o * l + - i * s * c - - i * a * l - ); - } - invert() { - const e = this.elements, - t = e[0], - n = e[1], - i = e[2], - s = e[3], - a = e[4], - o = e[5], - l = e[6], - c = e[7], - u = e[8], - h = u * a - o * c, - d = o * l - u * s, - f = c * s - a * l, - g = t * h + n * d + i * f; - if (g === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0); - const m = 1 / g; - return ( - (e[0] = h * m), - (e[1] = (i * c - u * n) * m), - (e[2] = (o * n - i * a) * m), - (e[3] = d * m), - (e[4] = (u * t - i * l) * m), - (e[5] = (i * s - o * t) * m), - (e[6] = f * m), - (e[7] = (n * l - c * t) * m), - (e[8] = (a * t - n * s) * m), - this - ); - } - transpose() { - let e; - const t = this.elements; - return ( - (e = t[1]), - (t[1] = t[3]), - (t[3] = e), - (e = t[2]), - (t[2] = t[6]), - (t[6] = e), - (e = t[5]), - (t[5] = t[7]), - (t[7] = e), - this - ); - } - getNormalMatrix(e) { - return this.setFromMatrix4(e).invert().transpose(); - } - transposeIntoArray(e) { - const t = this.elements; - return ( - (e[0] = t[0]), - (e[1] = t[3]), - (e[2] = t[6]), - (e[3] = t[1]), - (e[4] = t[4]), - (e[5] = t[7]), - (e[6] = t[2]), - (e[7] = t[5]), - (e[8] = t[8]), - this - ); - } - setUvTransform(e, t, n, i, s, a, o) { - const l = Math.cos(s), - c = Math.sin(s); - return ( - this.set( - n * l, - n * c, - -n * (l * a + c * o) + a + e, - -i * c, - i * l, - -i * (-c * a + l * o) + o + t, - 0, - 0, - 1 - ), - this - ); - } - scale(e, t) { - const n = this.elements; - return ( - (n[0] *= e), - (n[3] *= e), - (n[6] *= e), - (n[1] *= t), - (n[4] *= t), - (n[7] *= t), - this - ); - } - rotate(e) { - const t = Math.cos(e), - n = Math.sin(e), - i = this.elements, - s = i[0], - a = i[3], - o = i[6], - l = i[1], - c = i[4], - u = i[7]; - return ( - (i[0] = t * s + n * l), - (i[3] = t * a + n * c), - (i[6] = t * o + n * u), - (i[1] = -n * s + t * l), - (i[4] = -n * a + t * c), - (i[7] = -n * o + t * u), - this - ); - } - translate(e, t) { - const n = this.elements; - return ( - (n[0] += e * n[2]), - (n[3] += e * n[5]), - (n[6] += e * n[8]), - (n[1] += t * n[2]), - (n[4] += t * n[5]), - (n[7] += t * n[8]), - this - ); - } - equals(e) { - const t = this.elements, - n = e.elements; - for (let i = 0; i < 9; i++) if (t[i] !== n[i]) return !1; - return !0; - } - fromArray(e, t = 0) { - for (let n = 0; n < 9; n++) this.elements[n] = e[n + t]; - return this; - } - toArray(e = [], t = 0) { - const n = this.elements; - return ( - (e[t] = n[0]), - (e[t + 1] = n[1]), - (e[t + 2] = n[2]), - (e[t + 3] = n[3]), - (e[t + 4] = n[4]), - (e[t + 5] = n[5]), - (e[t + 6] = n[6]), - (e[t + 7] = n[7]), - (e[t + 8] = n[8]), - e - ); - } - clone() { - return new this.constructor().fromArray(this.elements); - } - } - function Gc(r) { - for (let e = r.length - 1; e >= 0; --e) if (r[e] > 65535) return !0; - return !1; - } - function Cs(r) { - return document.createElementNS("http://www.w3.org/1999/xhtml", r); - } - function ai(r) { - return r < 0.04045 - ? r * 0.0773993808 - : Math.pow(r * 0.9478672986 + 0.0521327014, 2.4); - } - function vr(r) { - return r < 0.0031308 ? r * 12.92 : 1.055 * Math.pow(r, 0.41666) - 0.055; - } - const Qr = { [yn]: { [si]: ai }, [si]: { [yn]: vr } }, - Ut = { - legacyMode: !0, - get workingColorSpace() { - return si; - }, - set workingColorSpace(r) { - console.warn( - "THREE.ColorManagement: .workingColorSpace is readonly." - ); - }, - convert: function (r, e, t) { - if (this.legacyMode || e === t || !e || !t) return r; - if (Qr[e] && Qr[e][t] !== void 0) { - const n = Qr[e][t]; - return (r.r = n(r.r)), (r.g = n(r.g)), (r.b = n(r.b)), r; - } - throw new Error("Unsupported color space conversion."); - }, - fromWorkingColorSpace: function (r, e) { - return this.convert(r, this.workingColorSpace, e); - }, - toWorkingColorSpace: function (r, e) { - return this.convert(r, e, this.workingColorSpace); - }, - }, - Hc = { - aliceblue: 15792383, - antiquewhite: 16444375, - aqua: 65535, - aquamarine: 8388564, - azure: 15794175, - beige: 16119260, - bisque: 16770244, - black: 0, - blanchedalmond: 16772045, - blue: 255, - blueviolet: 9055202, - brown: 10824234, - burlywood: 14596231, - cadetblue: 6266528, - chartreuse: 8388352, - chocolate: 13789470, - coral: 16744272, - cornflowerblue: 6591981, - cornsilk: 16775388, - crimson: 14423100, - cyan: 65535, - darkblue: 139, - darkcyan: 35723, - darkgoldenrod: 12092939, - darkgray: 11119017, - darkgreen: 25600, - darkgrey: 11119017, - darkkhaki: 12433259, - darkmagenta: 9109643, - darkolivegreen: 5597999, - darkorange: 16747520, - darkorchid: 10040012, - darkred: 9109504, - darksalmon: 15308410, - darkseagreen: 9419919, - darkslateblue: 4734347, - darkslategray: 3100495, - darkslategrey: 3100495, - darkturquoise: 52945, - darkviolet: 9699539, - deeppink: 16716947, - deepskyblue: 49151, - dimgray: 6908265, - dimgrey: 6908265, - dodgerblue: 2003199, - firebrick: 11674146, - floralwhite: 16775920, - forestgreen: 2263842, - fuchsia: 16711935, - gainsboro: 14474460, - ghostwhite: 16316671, - gold: 16766720, - goldenrod: 14329120, - gray: 8421504, - green: 32768, - greenyellow: 11403055, - grey: 8421504, - honeydew: 15794160, - hotpink: 16738740, - indianred: 13458524, - indigo: 4915330, - ivory: 16777200, - khaki: 15787660, - lavender: 15132410, - lavenderblush: 16773365, - lawngreen: 8190976, - lemonchiffon: 16775885, - lightblue: 11393254, - lightcoral: 15761536, - lightcyan: 14745599, - lightgoldenrodyellow: 16448210, - lightgray: 13882323, - lightgreen: 9498256, - lightgrey: 13882323, - lightpink: 16758465, - lightsalmon: 16752762, - lightseagreen: 2142890, - lightskyblue: 8900346, - lightslategray: 7833753, - lightslategrey: 7833753, - lightsteelblue: 11584734, - lightyellow: 16777184, - lime: 65280, - limegreen: 3329330, - linen: 16445670, - magenta: 16711935, - maroon: 8388608, - mediumaquamarine: 6737322, - mediumblue: 205, - mediumorchid: 12211667, - mediumpurple: 9662683, - mediumseagreen: 3978097, - mediumslateblue: 8087790, - mediumspringgreen: 64154, - mediumturquoise: 4772300, - mediumvioletred: 13047173, - midnightblue: 1644912, - mintcream: 16121850, - mistyrose: 16770273, - moccasin: 16770229, - navajowhite: 16768685, - navy: 128, - oldlace: 16643558, - olive: 8421376, - olivedrab: 7048739, - orange: 16753920, - orangered: 16729344, - orchid: 14315734, - palegoldenrod: 15657130, - palegreen: 10025880, - paleturquoise: 11529966, - palevioletred: 14381203, - papayawhip: 16773077, - peachpuff: 16767673, - peru: 13468991, - pink: 16761035, - plum: 14524637, - powderblue: 11591910, - purple: 8388736, - rebeccapurple: 6697881, - red: 16711680, - rosybrown: 12357519, - royalblue: 4286945, - saddlebrown: 9127187, - salmon: 16416882, - sandybrown: 16032864, - seagreen: 3050327, - seashell: 16774638, - sienna: 10506797, - silver: 12632256, - skyblue: 8900331, - slateblue: 6970061, - slategray: 7372944, - slategrey: 7372944, - snow: 16775930, - springgreen: 65407, - steelblue: 4620980, - tan: 13808780, - teal: 32896, - thistle: 14204888, - tomato: 16737095, - turquoise: 4251856, - violet: 15631086, - wheat: 16113331, - white: 16777215, - whitesmoke: 16119285, - yellow: 16776960, - yellowgreen: 10145074, - }, - rt = { r: 0, g: 0, b: 0 }, - Bt = { h: 0, s: 0, l: 0 }, - js = { h: 0, s: 0, l: 0 }; - function ea(r, e, t) { - return ( - t < 0 && (t += 1), - t > 1 && (t -= 1), - t < 1 / 6 - ? r + (e - r) * 6 * t - : t < 1 / 2 - ? e - : t < 2 / 3 - ? r + (e - r) * 6 * (2 / 3 - t) - : r - ); - } - function Xs(r, e) { - return (e.r = r.r), (e.g = r.g), (e.b = r.b), e; - } - class de { - constructor(e, t, n) { - return ( - (this.isColor = !0), - (this.r = 1), - (this.g = 1), - (this.b = 1), - t === void 0 && n === void 0 ? this.set(e) : this.setRGB(e, t, n) - ); - } - set(e) { - return ( - e && e.isColor - ? this.copy(e) - : typeof e == "number" - ? this.setHex(e) - : typeof e == "string" && this.setStyle(e), - this - ); - } - setScalar(e) { - return (this.r = e), (this.g = e), (this.b = e), this; - } - setHex(e, t = yn) { - return ( - (e = Math.floor(e)), - (this.r = ((e >> 16) & 255) / 255), - (this.g = ((e >> 8) & 255) / 255), - (this.b = (e & 255) / 255), - Ut.toWorkingColorSpace(this, t), - this - ); - } - setRGB(e, t, n, i = si) { - return ( - (this.r = e), - (this.g = t), - (this.b = n), - Ut.toWorkingColorSpace(this, i), - this - ); - } - setHSL(e, t, n, i = si) { - if (((e = no(e, 1)), (t = at(t, 0, 1)), (n = at(n, 0, 1)), t === 0)) - this.r = this.g = this.b = n; - else { - const s = n <= 0.5 ? n * (1 + t) : n + t - n * t, - a = 2 * n - s; - (this.r = ea(a, s, e + 1 / 3)), - (this.g = ea(a, s, e)), - (this.b = ea(a, s, e - 1 / 3)); - } - return Ut.toWorkingColorSpace(this, i), this; - } - setStyle(e, t = yn) { - function n(s) { - s !== void 0 && - parseFloat(s) < 1 && - console.warn( - "THREE.Color: Alpha component of " + e + " will be ignored." - ); - } - let i; - if ((i = /^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e))) { - let s; - const a = i[1], - o = i[2]; - switch (a) { - case "rgb": - case "rgba": - if ( - (s = - /^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec( - o - )) - ) - return ( - (this.r = Math.min(255, parseInt(s[1], 10)) / 255), - (this.g = Math.min(255, parseInt(s[2], 10)) / 255), - (this.b = Math.min(255, parseInt(s[3], 10)) / 255), - Ut.toWorkingColorSpace(this, t), - n(s[4]), - this - ); - if ( - (s = - /^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec( - o - )) - ) - return ( - (this.r = Math.min(100, parseInt(s[1], 10)) / 100), - (this.g = Math.min(100, parseInt(s[2], 10)) / 100), - (this.b = Math.min(100, parseInt(s[3], 10)) / 100), - Ut.toWorkingColorSpace(this, t), - n(s[4]), - this - ); - break; - case "hsl": - case "hsla": - if ( - (s = - /^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec( - o - )) - ) { - const l = parseFloat(s[1]) / 360, - c = parseInt(s[2], 10) / 100, - u = parseInt(s[3], 10) / 100; - return n(s[4]), this.setHSL(l, c, u, t); - } - break; - } - } else if ((i = /^\#([A-Fa-f\d]+)$/.exec(e))) { - const s = i[1], - a = s.length; - if (a === 3) - return ( - (this.r = parseInt(s.charAt(0) + s.charAt(0), 16) / 255), - (this.g = parseInt(s.charAt(1) + s.charAt(1), 16) / 255), - (this.b = parseInt(s.charAt(2) + s.charAt(2), 16) / 255), - Ut.toWorkingColorSpace(this, t), - this - ); - if (a === 6) - return ( - (this.r = parseInt(s.charAt(0) + s.charAt(1), 16) / 255), - (this.g = parseInt(s.charAt(2) + s.charAt(3), 16) / 255), - (this.b = parseInt(s.charAt(4) + s.charAt(5), 16) / 255), - Ut.toWorkingColorSpace(this, t), - this - ); - } - return e && e.length > 0 ? this.setColorName(e, t) : this; - } - setColorName(e, t = yn) { - const n = Hc[e.toLowerCase()]; - return ( - n !== void 0 - ? this.setHex(n, t) - : console.warn("THREE.Color: Unknown color " + e), - this - ); - } - clone() { - return new this.constructor(this.r, this.g, this.b); - } - copy(e) { - return (this.r = e.r), (this.g = e.g), (this.b = e.b), this; - } - copySRGBToLinear(e) { - return ( - (this.r = ai(e.r)), (this.g = ai(e.g)), (this.b = ai(e.b)), this - ); - } - copyLinearToSRGB(e) { - return ( - (this.r = vr(e.r)), (this.g = vr(e.g)), (this.b = vr(e.b)), this - ); - } - convertSRGBToLinear() { - return this.copySRGBToLinear(this), this; - } - convertLinearToSRGB() { - return this.copyLinearToSRGB(this), this; - } - getHex(e = yn) { - return ( - Ut.fromWorkingColorSpace(Xs(this, rt), e), - (at(rt.r * 255, 0, 255) << 16) ^ - (at(rt.g * 255, 0, 255) << 8) ^ - (at(rt.b * 255, 0, 255) << 0) - ); - } - getHexString(e = yn) { - return ("000000" + this.getHex(e).toString(16)).slice(-6); - } - getHSL(e, t = si) { - Ut.fromWorkingColorSpace(Xs(this, rt), t); - const n = rt.r, - i = rt.g, - s = rt.b, - a = Math.max(n, i, s), - o = Math.min(n, i, s); - let l, c; - const u = (o + a) / 2; - if (o === a) (l = 0), (c = 0); - else { - const h = a - o; - switch (((c = u <= 0.5 ? h / (a + o) : h / (2 - a - o)), a)) { - case n: - l = (i - s) / h + (i < s ? 6 : 0); - break; - case i: - l = (s - n) / h + 2; - break; - case s: - l = (n - i) / h + 4; - break; - } - l /= 6; - } - return (e.h = l), (e.s = c), (e.l = u), e; - } - getRGB(e, t = si) { - return ( - Ut.fromWorkingColorSpace(Xs(this, rt), t), - (e.r = rt.r), - (e.g = rt.g), - (e.b = rt.b), - e - ); - } - getStyle(e = yn) { - return ( - Ut.fromWorkingColorSpace(Xs(this, rt), e), - e !== yn - ? `color(${e} ${rt.r} ${rt.g} ${rt.b})` - : `rgb(${(rt.r * 255) | 0},${(rt.g * 255) | 0},${ - (rt.b * 255) | 0 - })` - ); - } - offsetHSL(e, t, n) { - return ( - this.getHSL(Bt), - (Bt.h += e), - (Bt.s += t), - (Bt.l += n), - this.setHSL(Bt.h, Bt.s, Bt.l), - this - ); - } - add(e) { - return (this.r += e.r), (this.g += e.g), (this.b += e.b), this; - } - addColors(e, t) { - return ( - (this.r = e.r + t.r), - (this.g = e.g + t.g), - (this.b = e.b + t.b), - this - ); - } - addScalar(e) { - return (this.r += e), (this.g += e), (this.b += e), this; - } - sub(e) { - return ( - (this.r = Math.max(0, this.r - e.r)), - (this.g = Math.max(0, this.g - e.g)), - (this.b = Math.max(0, this.b - e.b)), - this - ); - } - multiply(e) { - return (this.r *= e.r), (this.g *= e.g), (this.b *= e.b), this; - } - multiplyScalar(e) { - return (this.r *= e), (this.g *= e), (this.b *= e), this; - } - lerp(e, t) { - return ( - (this.r += (e.r - this.r) * t), - (this.g += (e.g - this.g) * t), - (this.b += (e.b - this.b) * t), - this - ); - } - lerpColors(e, t, n) { - return ( - (this.r = e.r + (t.r - e.r) * n), - (this.g = e.g + (t.g - e.g) * n), - (this.b = e.b + (t.b - e.b) * n), - this - ); - } - lerpHSL(e, t) { - this.getHSL(Bt), e.getHSL(js); - const n = Ms(Bt.h, js.h, t), - i = Ms(Bt.s, js.s, t), - s = Ms(Bt.l, js.l, t); - return this.setHSL(n, i, s), this; - } - equals(e) { - return e.r === this.r && e.g === this.g && e.b === this.b; - } - fromArray(e, t = 0) { - return ( - (this.r = e[t]), (this.g = e[t + 1]), (this.b = e[t + 2]), this - ); - } - toArray(e = [], t = 0) { - return (e[t] = this.r), (e[t + 1] = this.g), (e[t + 2] = this.b), e; - } - fromBufferAttribute(e, t) { - return ( - (this.r = e.getX(t)), - (this.g = e.getY(t)), - (this.b = e.getZ(t)), - e.normalized === !0 && - ((this.r /= 255), (this.g /= 255), (this.b /= 255)), - this - ); - } - toJSON() { - return this.getHex(); - } - *[Symbol.iterator]() { - yield this.r, yield this.g, yield this.b; - } - } - de.NAMES = Hc; - let vi; - class Wc { - static getDataURL(e) { - if (/^data:/i.test(e.src) || typeof HTMLCanvasElement == "undefined") - return e.src; - let t; - if (e instanceof HTMLCanvasElement) t = e; - else { - vi === void 0 && (vi = Cs("canvas")), - (vi.width = e.width), - (vi.height = e.height); - const n = vi.getContext("2d"); - e instanceof ImageData - ? n.putImageData(e, 0, 0) - : n.drawImage(e, 0, 0, e.width, e.height), - (t = vi); - } - return t.width > 2048 || t.height > 2048 - ? (console.warn( - "THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons", - e - ), - t.toDataURL("image/jpeg", 0.6)) - : t.toDataURL("image/png"); - } - static sRGBToLinear(e) { - if ( - (typeof HTMLImageElement != "undefined" && - e instanceof HTMLImageElement) || - (typeof HTMLCanvasElement != "undefined" && - e instanceof HTMLCanvasElement) || - (typeof ImageBitmap != "undefined" && e instanceof ImageBitmap) - ) { - const t = Cs("canvas"); - (t.width = e.width), (t.height = e.height); - const n = t.getContext("2d"); - n.drawImage(e, 0, 0, e.width, e.height); - const i = n.getImageData(0, 0, e.width, e.height), - s = i.data; - for (let a = 0; a < s.length; a++) s[a] = ai(s[a] / 255) * 255; - return n.putImageData(i, 0, 0), t; - } else if (e.data) { - const t = e.data.slice(0); - for (let n = 0; n < t.length; n++) - t instanceof Uint8Array || t instanceof Uint8ClampedArray - ? (t[n] = Math.floor(ai(t[n] / 255) * 255)) - : (t[n] = ai(t[n])); - return { data: t, width: e.width, height: e.height }; - } else - return ( - console.warn( - "THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied." - ), - e - ); - } - } - class jc { - constructor(e = null) { - (this.isSource = !0), - (this.uuid = Yt()), - (this.data = e), - (this.version = 0); - } - set needsUpdate(e) { - e === !0 && this.version++; - } - toJSON(e) { - const t = e === void 0 || typeof e == "string"; - if (!t && e.images[this.uuid] !== void 0) return e.images[this.uuid]; - const n = { uuid: this.uuid, url: "" }, - i = this.data; - if (i !== null) { - let s; - if (Array.isArray(i)) { - s = []; - for (let a = 0, o = i.length; a < o; a++) - i[a].isDataTexture ? s.push(ta(i[a].image)) : s.push(ta(i[a])); - } else s = ta(i); - n.url = s; - } - return t || (e.images[this.uuid] = n), n; - } - } - function ta(r) { - return (typeof HTMLImageElement != "undefined" && - r instanceof HTMLImageElement) || - (typeof HTMLCanvasElement != "undefined" && - r instanceof HTMLCanvasElement) || - (typeof ImageBitmap != "undefined" && r instanceof ImageBitmap) - ? Wc.getDataURL(r) - : r.data - ? { - data: Array.prototype.slice.call(r.data), - width: r.width, - height: r.height, - type: r.data.constructor.name, - } - : (console.warn("THREE.Texture: Unable to serialize Texture."), {}); - } - let _d = 0; - class nt extends hi { - constructor( - e = nt.DEFAULT_IMAGE, - t = nt.DEFAULT_MAPPING, - n = gt, - i = gt, - s = $e, - a = li, - o = Nt, - l = oi, - c = 1, - u = Vn - ) { - super(), - (this.isTexture = !0), - Object.defineProperty(this, "id", { value: _d++ }), - (this.uuid = Yt()), - (this.name = ""), - (this.source = new jc(e)), - (this.mipmaps = []), - (this.mapping = t), - (this.wrapS = n), - (this.wrapT = i), - (this.magFilter = s), - (this.minFilter = a), - (this.anisotropy = c), - (this.format = o), - (this.internalFormat = null), - (this.type = l), - (this.offset = new ve(0, 0)), - (this.repeat = new ve(1, 1)), - (this.center = new ve(0, 0)), - (this.rotation = 0), - (this.matrixAutoUpdate = !0), - (this.matrix = new Xt()), - (this.generateMipmaps = !0), - (this.premultiplyAlpha = !1), - (this.flipY = !0), - (this.unpackAlignment = 4), - (this.encoding = u), - (this.userData = {}), - (this.version = 0), - (this.onUpdate = null), - (this.isRenderTargetTexture = !1), - (this.needsPMREMUpdate = !1); - } - get image() { - return this.source.data; - } - set image(e) { - this.source.data = e; - } - updateMatrix() { - this.matrix.setUvTransform( - this.offset.x, - this.offset.y, - this.repeat.x, - this.repeat.y, - this.rotation, - this.center.x, - this.center.y - ); - } - clone() { - return new this.constructor().copy(this); - } - copy(e) { - return ( - (this.name = e.name), - (this.source = e.source), - (this.mipmaps = e.mipmaps.slice(0)), - (this.mapping = e.mapping), - (this.wrapS = e.wrapS), - (this.wrapT = e.wrapT), - (this.magFilter = e.magFilter), - (this.minFilter = e.minFilter), - (this.anisotropy = e.anisotropy), - (this.format = e.format), - (this.internalFormat = e.internalFormat), - (this.type = e.type), - this.offset.copy(e.offset), - this.repeat.copy(e.repeat), - this.center.copy(e.center), - (this.rotation = e.rotation), - (this.matrixAutoUpdate = e.matrixAutoUpdate), - this.matrix.copy(e.matrix), - (this.generateMipmaps = e.generateMipmaps), - (this.premultiplyAlpha = e.premultiplyAlpha), - (this.flipY = e.flipY), - (this.unpackAlignment = e.unpackAlignment), - (this.encoding = e.encoding), - (this.userData = JSON.parse(JSON.stringify(e.userData))), - (this.needsUpdate = !0), - this - ); - } - toJSON(e) { - const t = e === void 0 || typeof e == "string"; - if (!t && e.textures[this.uuid] !== void 0) - return e.textures[this.uuid]; - const n = { - metadata: { - version: 4.5, - type: "Texture", - generator: "Texture.toJSON", - }, - uuid: this.uuid, - name: this.name, - image: this.source.toJSON(e).uuid, - mapping: this.mapping, - repeat: [this.repeat.x, this.repeat.y], - offset: [this.offset.x, this.offset.y], - center: [this.center.x, this.center.y], - rotation: this.rotation, - wrap: [this.wrapS, this.wrapT], - format: this.format, - type: this.type, - encoding: this.encoding, - minFilter: this.minFilter, - magFilter: this.magFilter, - anisotropy: this.anisotropy, - flipY: this.flipY, - premultiplyAlpha: this.premultiplyAlpha, - unpackAlignment: this.unpackAlignment, - }; - return ( - JSON.stringify(this.userData) !== "{}" && - (n.userData = this.userData), - t || (e.textures[this.uuid] = n), - n - ); - } - dispose() { - this.dispatchEvent({ type: "dispose" }); - } - transformUv(e) { - if (this.mapping !== zc) return e; - if ((e.applyMatrix3(this.matrix), e.x < 0 || e.x > 1)) - switch (this.wrapS) { - case hn: - e.x = e.x - Math.floor(e.x); - break; - case gt: - e.x = e.x < 0 ? 0 : 1; - break; - case Er: - Math.abs(Math.floor(e.x) % 2) === 1 - ? (e.x = Math.ceil(e.x) - e.x) - : (e.x = e.x - Math.floor(e.x)); - break; - } - if (e.y < 0 || e.y > 1) - switch (this.wrapT) { - case hn: - e.y = e.y - Math.floor(e.y); - break; - case gt: - e.y = e.y < 0 ? 0 : 1; - break; - case Er: - Math.abs(Math.floor(e.y) % 2) === 1 - ? (e.y = Math.ceil(e.y) - e.y) - : (e.y = e.y - Math.floor(e.y)); - break; - } - return this.flipY && (e.y = 1 - e.y), e; - } - set needsUpdate(e) { - e === !0 && (this.version++, (this.source.needsUpdate = !0)); - } - } - nt.DEFAULT_IMAGE = null; - nt.DEFAULT_MAPPING = zc; - class Ue { - constructor(e = 0, t = 0, n = 0, i = 1) { - (this.isVector4 = !0), - (this.x = e), - (this.y = t), - (this.z = n), - (this.w = i); - } - get width() { - return this.z; - } - set width(e) { - this.z = e; - } - get height() { - return this.w; - } - set height(e) { - this.w = e; - } - set(e, t, n, i) { - return (this.x = e), (this.y = t), (this.z = n), (this.w = i), this; - } - setScalar(e) { - return (this.x = e), (this.y = e), (this.z = e), (this.w = e), this; - } - setX(e) { - return (this.x = e), this; - } - setY(e) { - return (this.y = e), this; - } - setZ(e) { - return (this.z = e), this; - } - setW(e) { - return (this.w = e), this; - } - setComponent(e, t) { - switch (e) { - case 0: - this.x = t; - break; - case 1: - this.y = t; - break; - case 2: - this.z = t; - break; - case 3: - this.w = t; - break; - default: - throw new Error("index is out of range: " + e); - } - return this; - } - getComponent(e) { - switch (e) { - case 0: - return this.x; - case 1: - return this.y; - case 2: - return this.z; - case 3: - return this.w; - default: - throw new Error("index is out of range: " + e); - } - } - clone() { - return new this.constructor(this.x, this.y, this.z, this.w); - } - copy(e) { - return ( - (this.x = e.x), - (this.y = e.y), - (this.z = e.z), - (this.w = e.w !== void 0 ? e.w : 1), - this - ); - } - add(e, t) { - return t !== void 0 - ? (console.warn( - "THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead." - ), - this.addVectors(e, t)) - : ((this.x += e.x), - (this.y += e.y), - (this.z += e.z), - (this.w += e.w), - this); - } - addScalar(e) { - return ( - (this.x += e), (this.y += e), (this.z += e), (this.w += e), this - ); - } - addVectors(e, t) { - return ( - (this.x = e.x + t.x), - (this.y = e.y + t.y), - (this.z = e.z + t.z), - (this.w = e.w + t.w), - this - ); - } - addScaledVector(e, t) { - return ( - (this.x += e.x * t), - (this.y += e.y * t), - (this.z += e.z * t), - (this.w += e.w * t), - this - ); - } - sub(e, t) { - return t !== void 0 - ? (console.warn( - "THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead." - ), - this.subVectors(e, t)) - : ((this.x -= e.x), - (this.y -= e.y), - (this.z -= e.z), - (this.w -= e.w), - this); - } - subScalar(e) { - return ( - (this.x -= e), (this.y -= e), (this.z -= e), (this.w -= e), this - ); - } - subVectors(e, t) { - return ( - (this.x = e.x - t.x), - (this.y = e.y - t.y), - (this.z = e.z - t.z), - (this.w = e.w - t.w), - this - ); - } - multiply(e) { - return ( - (this.x *= e.x), - (this.y *= e.y), - (this.z *= e.z), - (this.w *= e.w), - this - ); - } - multiplyScalar(e) { - return ( - (this.x *= e), (this.y *= e), (this.z *= e), (this.w *= e), this - ); - } - applyMatrix4(e) { - const t = this.x, - n = this.y, - i = this.z, - s = this.w, - a = e.elements; - return ( - (this.x = a[0] * t + a[4] * n + a[8] * i + a[12] * s), - (this.y = a[1] * t + a[5] * n + a[9] * i + a[13] * s), - (this.z = a[2] * t + a[6] * n + a[10] * i + a[14] * s), - (this.w = a[3] * t + a[7] * n + a[11] * i + a[15] * s), - this - ); - } - divideScalar(e) { - return this.multiplyScalar(1 / e); - } - setAxisAngleFromQuaternion(e) { - this.w = 2 * Math.acos(e.w); - const t = Math.sqrt(1 - e.w * e.w); - return ( - t < 1e-4 - ? ((this.x = 1), (this.y = 0), (this.z = 0)) - : ((this.x = e.x / t), (this.y = e.y / t), (this.z = e.z / t)), - this - ); - } - setAxisAngleFromRotationMatrix(e) { - let t, n, i, s; - const l = e.elements, - c = l[0], - u = l[4], - h = l[8], - d = l[1], - f = l[5], - g = l[9], - m = l[2], - p = l[6], - v = l[10]; - if ( - Math.abs(u - d) < 0.01 && - Math.abs(h - m) < 0.01 && - Math.abs(g - p) < 0.01 - ) { - if ( - Math.abs(u + d) < 0.1 && - Math.abs(h + m) < 0.1 && - Math.abs(g + p) < 0.1 && - Math.abs(c + f + v - 3) < 0.1 - ) - return this.set(1, 0, 0, 0), this; - t = Math.PI; - const x = (c + 1) / 2, - w = (f + 1) / 2, - y = (v + 1) / 2, - A = (u + d) / 4, - L = (h + m) / 4, - _ = (g + p) / 4; - return ( - x > w && x > y - ? x < 0.01 - ? ((n = 0), (i = 0.707106781), (s = 0.707106781)) - : ((n = Math.sqrt(x)), (i = A / n), (s = L / n)) - : w > y - ? w < 0.01 - ? ((n = 0.707106781), (i = 0), (s = 0.707106781)) - : ((i = Math.sqrt(w)), (n = A / i), (s = _ / i)) - : y < 0.01 - ? ((n = 0.707106781), (i = 0.707106781), (s = 0)) - : ((s = Math.sqrt(y)), (n = L / s), (i = _ / s)), - this.set(n, i, s, t), - this - ); - } - let M = Math.sqrt( - (p - g) * (p - g) + (h - m) * (h - m) + (d - u) * (d - u) - ); - return ( - Math.abs(M) < 0.001 && (M = 1), - (this.x = (p - g) / M), - (this.y = (h - m) / M), - (this.z = (d - u) / M), - (this.w = Math.acos((c + f + v - 1) / 2)), - this - ); - } - min(e) { - return ( - (this.x = Math.min(this.x, e.x)), - (this.y = Math.min(this.y, e.y)), - (this.z = Math.min(this.z, e.z)), - (this.w = Math.min(this.w, e.w)), - this - ); - } - max(e) { - return ( - (this.x = Math.max(this.x, e.x)), - (this.y = Math.max(this.y, e.y)), - (this.z = Math.max(this.z, e.z)), - (this.w = Math.max(this.w, e.w)), - this - ); - } - clamp(e, t) { - return ( - (this.x = Math.max(e.x, Math.min(t.x, this.x))), - (this.y = Math.max(e.y, Math.min(t.y, this.y))), - (this.z = Math.max(e.z, Math.min(t.z, this.z))), - (this.w = Math.max(e.w, Math.min(t.w, this.w))), - this - ); - } - clampScalar(e, t) { - return ( - (this.x = Math.max(e, Math.min(t, this.x))), - (this.y = Math.max(e, Math.min(t, this.y))), - (this.z = Math.max(e, Math.min(t, this.z))), - (this.w = Math.max(e, Math.min(t, this.w))), - this - ); - } - clampLength(e, t) { - const n = this.length(); - return this.divideScalar(n || 1).multiplyScalar( - Math.max(e, Math.min(t, n)) - ); - } - floor() { - return ( - (this.x = Math.floor(this.x)), - (this.y = Math.floor(this.y)), - (this.z = Math.floor(this.z)), - (this.w = Math.floor(this.w)), - this - ); - } - ceil() { - return ( - (this.x = Math.ceil(this.x)), - (this.y = Math.ceil(this.y)), - (this.z = Math.ceil(this.z)), - (this.w = Math.ceil(this.w)), - this - ); - } - round() { - return ( - (this.x = Math.round(this.x)), - (this.y = Math.round(this.y)), - (this.z = Math.round(this.z)), - (this.w = Math.round(this.w)), - this - ); - } - roundToZero() { - return ( - (this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x)), - (this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y)), - (this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z)), - (this.w = this.w < 0 ? Math.ceil(this.w) : Math.floor(this.w)), - this - ); - } - negate() { - return ( - (this.x = -this.x), - (this.y = -this.y), - (this.z = -this.z), - (this.w = -this.w), - this - ); - } - dot(e) { - return this.x * e.x + this.y * e.y + this.z * e.z + this.w * e.w; - } - lengthSq() { - return ( - this.x * this.x + - this.y * this.y + - this.z * this.z + - this.w * this.w - ); - } - length() { - return Math.sqrt( - this.x * this.x + - this.y * this.y + - this.z * this.z + - this.w * this.w - ); - } - manhattanLength() { - return ( - Math.abs(this.x) + - Math.abs(this.y) + - Math.abs(this.z) + - Math.abs(this.w) - ); - } - normalize() { - return this.divideScalar(this.length() || 1); - } - setLength(e) { - return this.normalize().multiplyScalar(e); - } - lerp(e, t) { - return ( - (this.x += (e.x - this.x) * t), - (this.y += (e.y - this.y) * t), - (this.z += (e.z - this.z) * t), - (this.w += (e.w - this.w) * t), - this - ); - } - lerpVectors(e, t, n) { - return ( - (this.x = e.x + (t.x - e.x) * n), - (this.y = e.y + (t.y - e.y) * n), - (this.z = e.z + (t.z - e.z) * n), - (this.w = e.w + (t.w - e.w) * n), - this - ); - } - equals(e) { - return ( - e.x === this.x && e.y === this.y && e.z === this.z && e.w === this.w - ); - } - fromArray(e, t = 0) { - return ( - (this.x = e[t]), - (this.y = e[t + 1]), - (this.z = e[t + 2]), - (this.w = e[t + 3]), - this - ); - } - toArray(e = [], t = 0) { - return ( - (e[t] = this.x), - (e[t + 1] = this.y), - (e[t + 2] = this.z), - (e[t + 3] = this.w), - e - ); - } - fromBufferAttribute(e, t, n) { - return ( - n !== void 0 && - console.warn( - "THREE.Vector4: offset has been removed from .fromBufferAttribute()." - ), - (this.x = e.getX(t)), - (this.y = e.getY(t)), - (this.z = e.getZ(t)), - (this.w = e.getW(t)), - this - ); - } - random() { - return ( - (this.x = Math.random()), - (this.y = Math.random()), - (this.z = Math.random()), - (this.w = Math.random()), - this - ); - } - *[Symbol.iterator]() { - yield this.x, yield this.y, yield this.z, yield this.w; - } - } - class Kt extends hi { - constructor(e, t, n = {}) { - super(), - (this.isWebGLRenderTarget = !0), - (this.width = e), - (this.height = t), - (this.depth = 1), - (this.scissor = new Ue(0, 0, e, t)), - (this.scissorTest = !1), - (this.viewport = new Ue(0, 0, e, t)); - const i = { width: e, height: t, depth: 1 }; - (this.texture = new nt( - i, - n.mapping, - n.wrapS, - n.wrapT, - n.magFilter, - n.minFilter, - n.format, - n.type, - n.anisotropy, - n.encoding - )), - (this.texture.isRenderTargetTexture = !0), - (this.texture.flipY = !1), - (this.texture.generateMipmaps = - n.generateMipmaps !== void 0 ? n.generateMipmaps : !1), - (this.texture.internalFormat = - n.internalFormat !== void 0 ? n.internalFormat : null), - (this.texture.minFilter = - n.minFilter !== void 0 ? n.minFilter : $e), - (this.depthBuffer = n.depthBuffer !== void 0 ? n.depthBuffer : !0), - (this.stencilBuffer = - n.stencilBuffer !== void 0 ? n.stencilBuffer : !1), - (this.depthTexture = - n.depthTexture !== void 0 ? n.depthTexture : null), - (this.samples = n.samples !== void 0 ? n.samples : 0); - } - setSize(e, t, n = 1) { - (this.width !== e || this.height !== t || this.depth !== n) && - ((this.width = e), - (this.height = t), - (this.depth = n), - (this.texture.image.width = e), - (this.texture.image.height = t), - (this.texture.image.depth = n), - this.dispose()), - this.viewport.set(0, 0, e, t), - this.scissor.set(0, 0, e, t); - } - clone() { - return new this.constructor().copy(this); - } - copy(e) { - (this.width = e.width), - (this.height = e.height), - (this.depth = e.depth), - this.viewport.copy(e.viewport), - (this.texture = e.texture.clone()), - (this.texture.isRenderTargetTexture = !0); - const t = Object.assign({}, e.texture.image); - return ( - (this.texture.source = new jc(t)), - (this.depthBuffer = e.depthBuffer), - (this.stencilBuffer = e.stencilBuffer), - e.depthTexture !== null && - (this.depthTexture = e.depthTexture.clone()), - (this.samples = e.samples), - this - ); - } - dispose() { - this.dispatchEvent({ type: "dispose" }); - } - } - class Xc extends nt { - constructor(e = null, t = 1, n = 1, i = 1) { - super(null), - (this.isDataArrayTexture = !0), - (this.image = { data: e, width: t, height: n, depth: i }), - (this.magFilter = ft), - (this.minFilter = ft), - (this.wrapR = gt), - (this.generateMipmaps = !1), - (this.flipY = !1), - (this.unpackAlignment = 1); - } - } - class xd extends nt { - constructor(e = null, t = 1, n = 1, i = 1) { - super(null), - (this.isData3DTexture = !0), - (this.image = { data: e, width: t, height: n, depth: i }), - (this.magFilter = ft), - (this.minFilter = ft), - (this.wrapR = gt), - (this.generateMipmaps = !1), - (this.flipY = !1), - (this.unpackAlignment = 1); - } - } - class Mt { - constructor(e = 0, t = 0, n = 0, i = 1) { - (this.isQuaternion = !0), - (this._x = e), - (this._y = t), - (this._z = n), - (this._w = i); - } - static slerp(e, t, n, i) { - return ( - console.warn( - "THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead." - ), - n.slerpQuaternions(e, t, i) - ); - } - static slerpFlat(e, t, n, i, s, a, o) { - let l = n[i + 0], - c = n[i + 1], - u = n[i + 2], - h = n[i + 3]; - const d = s[a + 0], - f = s[a + 1], - g = s[a + 2], - m = s[a + 3]; - if (o === 0) { - (e[t + 0] = l), (e[t + 1] = c), (e[t + 2] = u), (e[t + 3] = h); - return; - } - if (o === 1) { - (e[t + 0] = d), (e[t + 1] = f), (e[t + 2] = g), (e[t + 3] = m); - return; - } - if (h !== m || l !== d || c !== f || u !== g) { - let p = 1 - o; - const v = l * d + c * f + u * g + h * m, - M = v >= 0 ? 1 : -1, - x = 1 - v * v; - if (x > Number.EPSILON) { - const y = Math.sqrt(x), - A = Math.atan2(y, v * M); - (p = Math.sin(p * A) / y), (o = Math.sin(o * A) / y); - } - const w = o * M; - if ( - ((l = l * p + d * w), - (c = c * p + f * w), - (u = u * p + g * w), - (h = h * p + m * w), - p === 1 - o) - ) { - const y = 1 / Math.sqrt(l * l + c * c + u * u + h * h); - (l *= y), (c *= y), (u *= y), (h *= y); - } - } - (e[t] = l), (e[t + 1] = c), (e[t + 2] = u), (e[t + 3] = h); - } - static multiplyQuaternionsFlat(e, t, n, i, s, a) { - const o = n[i], - l = n[i + 1], - c = n[i + 2], - u = n[i + 3], - h = s[a], - d = s[a + 1], - f = s[a + 2], - g = s[a + 3]; - return ( - (e[t] = o * g + u * h + l * f - c * d), - (e[t + 1] = l * g + u * d + c * h - o * f), - (e[t + 2] = c * g + u * f + o * d - l * h), - (e[t + 3] = u * g - o * h - l * d - c * f), - e - ); - } - get x() { - return this._x; - } - set x(e) { - (this._x = e), this._onChangeCallback(); - } - get y() { - return this._y; - } - set y(e) { - (this._y = e), this._onChangeCallback(); - } - get z() { - return this._z; - } - set z(e) { - (this._z = e), this._onChangeCallback(); - } - get w() { - return this._w; - } - set w(e) { - (this._w = e), this._onChangeCallback(); - } - set(e, t, n, i) { - return ( - (this._x = e), - (this._y = t), - (this._z = n), - (this._w = i), - this._onChangeCallback(), - this - ); - } - clone() { - return new this.constructor(this._x, this._y, this._z, this._w); - } - copy(e) { - return ( - (this._x = e.x), - (this._y = e.y), - (this._z = e.z), - (this._w = e.w), - this._onChangeCallback(), - this - ); - } - setFromEuler(e, t) { - if (!(e && e.isEuler)) - throw new Error( - "THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order." - ); - const n = e._x, - i = e._y, - s = e._z, - a = e._order, - o = Math.cos, - l = Math.sin, - c = o(n / 2), - u = o(i / 2), - h = o(s / 2), - d = l(n / 2), - f = l(i / 2), - g = l(s / 2); - switch (a) { - case "XYZ": - (this._x = d * u * h + c * f * g), - (this._y = c * f * h - d * u * g), - (this._z = c * u * g + d * f * h), - (this._w = c * u * h - d * f * g); - break; - case "YXZ": - (this._x = d * u * h + c * f * g), - (this._y = c * f * h - d * u * g), - (this._z = c * u * g - d * f * h), - (this._w = c * u * h + d * f * g); - break; - case "ZXY": - (this._x = d * u * h - c * f * g), - (this._y = c * f * h + d * u * g), - (this._z = c * u * g + d * f * h), - (this._w = c * u * h - d * f * g); - break; - case "ZYX": - (this._x = d * u * h - c * f * g), - (this._y = c * f * h + d * u * g), - (this._z = c * u * g - d * f * h), - (this._w = c * u * h + d * f * g); - break; - case "YZX": - (this._x = d * u * h + c * f * g), - (this._y = c * f * h + d * u * g), - (this._z = c * u * g - d * f * h), - (this._w = c * u * h - d * f * g); - break; - case "XZY": - (this._x = d * u * h - c * f * g), - (this._y = c * f * h - d * u * g), - (this._z = c * u * g + d * f * h), - (this._w = c * u * h + d * f * g); - break; - default: - console.warn( - "THREE.Quaternion: .setFromEuler() encountered an unknown order: " + - a - ); - } - return t !== !1 && this._onChangeCallback(), this; - } - setFromAxisAngle(e, t) { - const n = t / 2, - i = Math.sin(n); - return ( - (this._x = e.x * i), - (this._y = e.y * i), - (this._z = e.z * i), - (this._w = Math.cos(n)), - this._onChangeCallback(), - this - ); - } - setFromRotationMatrix(e) { - const t = e.elements, - n = t[0], - i = t[4], - s = t[8], - a = t[1], - o = t[5], - l = t[9], - c = t[2], - u = t[6], - h = t[10], - d = n + o + h; - if (d > 0) { - const f = 0.5 / Math.sqrt(d + 1); - (this._w = 0.25 / f), - (this._x = (u - l) * f), - (this._y = (s - c) * f), - (this._z = (a - i) * f); - } else if (n > o && n > h) { - const f = 2 * Math.sqrt(1 + n - o - h); - (this._w = (u - l) / f), - (this._x = 0.25 * f), - (this._y = (i + a) / f), - (this._z = (s + c) / f); - } else if (o > h) { - const f = 2 * Math.sqrt(1 + o - n - h); - (this._w = (s - c) / f), - (this._x = (i + a) / f), - (this._y = 0.25 * f), - (this._z = (l + u) / f); - } else { - const f = 2 * Math.sqrt(1 + h - n - o); - (this._w = (a - i) / f), - (this._x = (s + c) / f), - (this._y = (l + u) / f), - (this._z = 0.25 * f); - } - return this._onChangeCallback(), this; - } - setFromUnitVectors(e, t) { - let n = e.dot(t) + 1; - return ( - n < Number.EPSILON - ? ((n = 0), - Math.abs(e.x) > Math.abs(e.z) - ? ((this._x = -e.y), - (this._y = e.x), - (this._z = 0), - (this._w = n)) - : ((this._x = 0), - (this._y = -e.z), - (this._z = e.y), - (this._w = n))) - : ((this._x = e.y * t.z - e.z * t.y), - (this._y = e.z * t.x - e.x * t.z), - (this._z = e.x * t.y - e.y * t.x), - (this._w = n)), - this.normalize() - ); - } - angleTo(e) { - return 2 * Math.acos(Math.abs(at(this.dot(e), -1, 1))); - } - rotateTowards(e, t) { - const n = this.angleTo(e); - if (n === 0) return this; - const i = Math.min(1, t / n); - return this.slerp(e, i), this; - } - identity() { - return this.set(0, 0, 0, 1); - } - invert() { - return this.conjugate(); - } - conjugate() { - return ( - (this._x *= -1), - (this._y *= -1), - (this._z *= -1), - this._onChangeCallback(), - this - ); - } - dot(e) { - return ( - this._x * e._x + this._y * e._y + this._z * e._z + this._w * e._w - ); - } - lengthSq() { - return ( - this._x * this._x + - this._y * this._y + - this._z * this._z + - this._w * this._w - ); - } - length() { - return Math.sqrt( - this._x * this._x + - this._y * this._y + - this._z * this._z + - this._w * this._w - ); - } - normalize() { - let e = this.length(); - return ( - e === 0 - ? ((this._x = 0), (this._y = 0), (this._z = 0), (this._w = 1)) - : ((e = 1 / e), - (this._x = this._x * e), - (this._y = this._y * e), - (this._z = this._z * e), - (this._w = this._w * e)), - this._onChangeCallback(), - this - ); - } - multiply(e, t) { - return t !== void 0 - ? (console.warn( - "THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead." - ), - this.multiplyQuaternions(e, t)) - : this.multiplyQuaternions(this, e); - } - premultiply(e) { - return this.multiplyQuaternions(e, this); - } - multiplyQuaternions(e, t) { - const n = e._x, - i = e._y, - s = e._z, - a = e._w, - o = t._x, - l = t._y, - c = t._z, - u = t._w; - return ( - (this._x = n * u + a * o + i * c - s * l), - (this._y = i * u + a * l + s * o - n * c), - (this._z = s * u + a * c + n * l - i * o), - (this._w = a * u - n * o - i * l - s * c), - this._onChangeCallback(), - this - ); - } - slerp(e, t) { - if (t === 0) return this; - if (t === 1) return this.copy(e); - const n = this._x, - i = this._y, - s = this._z, - a = this._w; - let o = a * e._w + n * e._x + i * e._y + s * e._z; - if ( - (o < 0 - ? ((this._w = -e._w), - (this._x = -e._x), - (this._y = -e._y), - (this._z = -e._z), - (o = -o)) - : this.copy(e), - o >= 1) - ) - return ( - (this._w = a), (this._x = n), (this._y = i), (this._z = s), this - ); - const l = 1 - o * o; - if (l <= Number.EPSILON) { - const f = 1 - t; - return ( - (this._w = f * a + t * this._w), - (this._x = f * n + t * this._x), - (this._y = f * i + t * this._y), - (this._z = f * s + t * this._z), - this.normalize(), - this._onChangeCallback(), - this - ); - } - const c = Math.sqrt(l), - u = Math.atan2(c, o), - h = Math.sin((1 - t) * u) / c, - d = Math.sin(t * u) / c; - return ( - (this._w = a * h + this._w * d), - (this._x = n * h + this._x * d), - (this._y = i * h + this._y * d), - (this._z = s * h + this._z * d), - this._onChangeCallback(), - this - ); - } - slerpQuaternions(e, t, n) { - return this.copy(e).slerp(t, n); - } - random() { - const e = Math.random(), - t = Math.sqrt(1 - e), - n = Math.sqrt(e), - i = 2 * Math.PI * Math.random(), - s = 2 * Math.PI * Math.random(); - return this.set( - t * Math.cos(i), - n * Math.sin(s), - n * Math.cos(s), - t * Math.sin(i) - ); - } - equals(e) { - return ( - e._x === this._x && - e._y === this._y && - e._z === this._z && - e._w === this._w - ); - } - fromArray(e, t = 0) { - return ( - (this._x = e[t]), - (this._y = e[t + 1]), - (this._z = e[t + 2]), - (this._w = e[t + 3]), - this._onChangeCallback(), - this - ); - } - toArray(e = [], t = 0) { - return ( - (e[t] = this._x), - (e[t + 1] = this._y), - (e[t + 2] = this._z), - (e[t + 3] = this._w), - e - ); - } - fromBufferAttribute(e, t) { - return ( - (this._x = e.getX(t)), - (this._y = e.getY(t)), - (this._z = e.getZ(t)), - (this._w = e.getW(t)), - this - ); - } - _onChange(e) { - return (this._onChangeCallback = e), this; - } - _onChangeCallback() {} - *[Symbol.iterator]() { - yield this._x, yield this._y, yield this._z, yield this._w; - } - } - class P { - constructor(e = 0, t = 0, n = 0) { - (this.isVector3 = !0), (this.x = e), (this.y = t), (this.z = n); - } - set(e, t, n) { - return ( - n === void 0 && (n = this.z), - (this.x = e), - (this.y = t), - (this.z = n), - this - ); - } - setScalar(e) { - return (this.x = e), (this.y = e), (this.z = e), this; - } - setX(e) { - return (this.x = e), this; - } - setY(e) { - return (this.y = e), this; - } - setZ(e) { - return (this.z = e), this; - } - setComponent(e, t) { - switch (e) { - case 0: - this.x = t; - break; - case 1: - this.y = t; - break; - case 2: - this.z = t; - break; - default: - throw new Error("index is out of range: " + e); - } - return this; - } - getComponent(e) { - switch (e) { - case 0: - return this.x; - case 1: - return this.y; - case 2: - return this.z; - default: - throw new Error("index is out of range: " + e); - } - } - clone() { - return new this.constructor(this.x, this.y, this.z); - } - copy(e) { - return (this.x = e.x), (this.y = e.y), (this.z = e.z), this; - } - add(e, t) { - return t !== void 0 - ? (console.warn( - "THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead." - ), - this.addVectors(e, t)) - : ((this.x += e.x), (this.y += e.y), (this.z += e.z), this); - } - addScalar(e) { - return (this.x += e), (this.y += e), (this.z += e), this; - } - addVectors(e, t) { - return ( - (this.x = e.x + t.x), - (this.y = e.y + t.y), - (this.z = e.z + t.z), - this - ); - } - addScaledVector(e, t) { - return ( - (this.x += e.x * t), (this.y += e.y * t), (this.z += e.z * t), this - ); - } - sub(e, t) { - return t !== void 0 - ? (console.warn( - "THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead." - ), - this.subVectors(e, t)) - : ((this.x -= e.x), (this.y -= e.y), (this.z -= e.z), this); - } - subScalar(e) { - return (this.x -= e), (this.y -= e), (this.z -= e), this; - } - subVectors(e, t) { - return ( - (this.x = e.x - t.x), - (this.y = e.y - t.y), - (this.z = e.z - t.z), - this - ); - } - multiply(e, t) { - return t !== void 0 - ? (console.warn( - "THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead." - ), - this.multiplyVectors(e, t)) - : ((this.x *= e.x), (this.y *= e.y), (this.z *= e.z), this); - } - multiplyScalar(e) { - return (this.x *= e), (this.y *= e), (this.z *= e), this; - } - multiplyVectors(e, t) { - return ( - (this.x = e.x * t.x), - (this.y = e.y * t.y), - (this.z = e.z * t.z), - this - ); - } - applyEuler(e) { - return ( - (e && e.isEuler) || - console.error( - "THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order." - ), - this.applyQuaternion(cl.setFromEuler(e)) - ); - } - applyAxisAngle(e, t) { - return this.applyQuaternion(cl.setFromAxisAngle(e, t)); - } - applyMatrix3(e) { - const t = this.x, - n = this.y, - i = this.z, - s = e.elements; - return ( - (this.x = s[0] * t + s[3] * n + s[6] * i), - (this.y = s[1] * t + s[4] * n + s[7] * i), - (this.z = s[2] * t + s[5] * n + s[8] * i), - this - ); - } - applyNormalMatrix(e) { - return this.applyMatrix3(e).normalize(); - } - applyMatrix4(e) { - const t = this.x, - n = this.y, - i = this.z, - s = e.elements, - a = 1 / (s[3] * t + s[7] * n + s[11] * i + s[15]); - return ( - (this.x = (s[0] * t + s[4] * n + s[8] * i + s[12]) * a), - (this.y = (s[1] * t + s[5] * n + s[9] * i + s[13]) * a), - (this.z = (s[2] * t + s[6] * n + s[10] * i + s[14]) * a), - this - ); - } - applyQuaternion(e) { - const t = this.x, - n = this.y, - i = this.z, - s = e.x, - a = e.y, - o = e.z, - l = e.w, - c = l * t + a * i - o * n, - u = l * n + o * t - s * i, - h = l * i + s * n - a * t, - d = -s * t - a * n - o * i; - return ( - (this.x = c * l + d * -s + u * -o - h * -a), - (this.y = u * l + d * -a + h * -s - c * -o), - (this.z = h * l + d * -o + c * -a - u * -s), - this - ); - } - project(e) { - return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4( - e.projectionMatrix - ); - } - unproject(e) { - return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4( - e.matrixWorld - ); - } - transformDirection(e) { - const t = this.x, - n = this.y, - i = this.z, - s = e.elements; - return ( - (this.x = s[0] * t + s[4] * n + s[8] * i), - (this.y = s[1] * t + s[5] * n + s[9] * i), - (this.z = s[2] * t + s[6] * n + s[10] * i), - this.normalize() - ); - } - divide(e) { - return (this.x /= e.x), (this.y /= e.y), (this.z /= e.z), this; - } - divideScalar(e) { - return this.multiplyScalar(1 / e); - } - min(e) { - return ( - (this.x = Math.min(this.x, e.x)), - (this.y = Math.min(this.y, e.y)), - (this.z = Math.min(this.z, e.z)), - this - ); - } - max(e) { - return ( - (this.x = Math.max(this.x, e.x)), - (this.y = Math.max(this.y, e.y)), - (this.z = Math.max(this.z, e.z)), - this - ); - } - clamp(e, t) { - return ( - (this.x = Math.max(e.x, Math.min(t.x, this.x))), - (this.y = Math.max(e.y, Math.min(t.y, this.y))), - (this.z = Math.max(e.z, Math.min(t.z, this.z))), - this - ); - } - clampScalar(e, t) { - return ( - (this.x = Math.max(e, Math.min(t, this.x))), - (this.y = Math.max(e, Math.min(t, this.y))), - (this.z = Math.max(e, Math.min(t, this.z))), - this - ); - } - clampLength(e, t) { - const n = this.length(); - return this.divideScalar(n || 1).multiplyScalar( - Math.max(e, Math.min(t, n)) - ); - } - floor() { - return ( - (this.x = Math.floor(this.x)), - (this.y = Math.floor(this.y)), - (this.z = Math.floor(this.z)), - this - ); - } - ceil() { - return ( - (this.x = Math.ceil(this.x)), - (this.y = Math.ceil(this.y)), - (this.z = Math.ceil(this.z)), - this - ); - } - round() { - return ( - (this.x = Math.round(this.x)), - (this.y = Math.round(this.y)), - (this.z = Math.round(this.z)), - this - ); - } - roundToZero() { - return ( - (this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x)), - (this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y)), - (this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z)), - this - ); - } - negate() { - return ( - (this.x = -this.x), (this.y = -this.y), (this.z = -this.z), this - ); - } - dot(e) { - return this.x * e.x + this.y * e.y + this.z * e.z; - } - lengthSq() { - return this.x * this.x + this.y * this.y + this.z * this.z; - } - length() { - return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); - } - manhattanLength() { - return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z); - } - normalize() { - return this.divideScalar(this.length() || 1); - } - setLength(e) { - return this.normalize().multiplyScalar(e); - } - lerp(e, t) { - return ( - (this.x += (e.x - this.x) * t), - (this.y += (e.y - this.y) * t), - (this.z += (e.z - this.z) * t), - this - ); - } - lerpVectors(e, t, n) { - return ( - (this.x = e.x + (t.x - e.x) * n), - (this.y = e.y + (t.y - e.y) * n), - (this.z = e.z + (t.z - e.z) * n), - this - ); - } - cross(e, t) { - return t !== void 0 - ? (console.warn( - "THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead." - ), - this.crossVectors(e, t)) - : this.crossVectors(this, e); - } - crossVectors(e, t) { - const n = e.x, - i = e.y, - s = e.z, - a = t.x, - o = t.y, - l = t.z; - return ( - (this.x = i * l - s * o), - (this.y = s * a - n * l), - (this.z = n * o - i * a), - this - ); - } - projectOnVector(e) { - const t = e.lengthSq(); - if (t === 0) return this.set(0, 0, 0); - const n = e.dot(this) / t; - return this.copy(e).multiplyScalar(n); - } - projectOnPlane(e) { - return na.copy(this).projectOnVector(e), this.sub(na); - } - reflect(e) { - return this.sub(na.copy(e).multiplyScalar(2 * this.dot(e))); - } - angleTo(e) { - const t = Math.sqrt(this.lengthSq() * e.lengthSq()); - if (t === 0) return Math.PI / 2; - const n = this.dot(e) / t; - return Math.acos(at(n, -1, 1)); - } - distanceTo(e) { - return Math.sqrt(this.distanceToSquared(e)); - } - distanceToSquared(e) { - const t = this.x - e.x, - n = this.y - e.y, - i = this.z - e.z; - return t * t + n * n + i * i; - } - manhattanDistanceTo(e) { - return ( - Math.abs(this.x - e.x) + - Math.abs(this.y - e.y) + - Math.abs(this.z - e.z) - ); - } - setFromSpherical(e) { - return this.setFromSphericalCoords(e.radius, e.phi, e.theta); - } - setFromSphericalCoords(e, t, n) { - const i = Math.sin(t) * e; - return ( - (this.x = i * Math.sin(n)), - (this.y = Math.cos(t) * e), - (this.z = i * Math.cos(n)), - this - ); - } - setFromCylindrical(e) { - return this.setFromCylindricalCoords(e.radius, e.theta, e.y); - } - setFromCylindricalCoords(e, t, n) { - return ( - (this.x = e * Math.sin(t)), - (this.y = n), - (this.z = e * Math.cos(t)), - this - ); - } - setFromMatrixPosition(e) { - const t = e.elements; - return (this.x = t[12]), (this.y = t[13]), (this.z = t[14]), this; - } - setFromMatrixScale(e) { - const t = this.setFromMatrixColumn(e, 0).length(), - n = this.setFromMatrixColumn(e, 1).length(), - i = this.setFromMatrixColumn(e, 2).length(); - return (this.x = t), (this.y = n), (this.z = i), this; - } - setFromMatrixColumn(e, t) { - return this.fromArray(e.elements, t * 4); - } - setFromMatrix3Column(e, t) { - return this.fromArray(e.elements, t * 3); - } - setFromEuler(e) { - return (this.x = e._x), (this.y = e._y), (this.z = e._z), this; - } - equals(e) { - return e.x === this.x && e.y === this.y && e.z === this.z; - } - fromArray(e, t = 0) { - return ( - (this.x = e[t]), (this.y = e[t + 1]), (this.z = e[t + 2]), this - ); - } - toArray(e = [], t = 0) { - return (e[t] = this.x), (e[t + 1] = this.y), (e[t + 2] = this.z), e; - } - fromBufferAttribute(e, t, n) { - return ( - n !== void 0 && - console.warn( - "THREE.Vector3: offset has been removed from .fromBufferAttribute()." - ), - (this.x = e.getX(t)), - (this.y = e.getY(t)), - (this.z = e.getZ(t)), - this - ); - } - random() { - return ( - (this.x = Math.random()), - (this.y = Math.random()), - (this.z = Math.random()), - this - ); - } - randomDirection() { - const e = (Math.random() - 0.5) * 2, - t = Math.random() * Math.PI * 2, - n = Math.sqrt(1 - e ** 2); - return ( - (this.x = n * Math.cos(t)), - (this.y = n * Math.sin(t)), - (this.z = e), - this - ); - } - *[Symbol.iterator]() { - yield this.x, yield this.y, yield this.z; - } - } - const na = new P(), - cl = new Mt(); - class Ki { - constructor( - e = new P(1 / 0, 1 / 0, 1 / 0), - t = new P(-1 / 0, -1 / 0, -1 / 0) - ) { - (this.isBox3 = !0), (this.min = e), (this.max = t); - } - set(e, t) { - return this.min.copy(e), this.max.copy(t), this; - } - setFromArray(e) { - let t = 1 / 0, - n = 1 / 0, - i = 1 / 0, - s = -1 / 0, - a = -1 / 0, - o = -1 / 0; - for (let l = 0, c = e.length; l < c; l += 3) { - const u = e[l], - h = e[l + 1], - d = e[l + 2]; - u < t && (t = u), - h < n && (n = h), - d < i && (i = d), - u > s && (s = u), - h > a && (a = h), - d > o && (o = d); - } - return this.min.set(t, n, i), this.max.set(s, a, o), this; - } - setFromBufferAttribute(e) { - let t = 1 / 0, - n = 1 / 0, - i = 1 / 0, - s = -1 / 0, - a = -1 / 0, - o = -1 / 0; - for (let l = 0, c = e.count; l < c; l++) { - const u = e.getX(l), - h = e.getY(l), - d = e.getZ(l); - u < t && (t = u), - h < n && (n = h), - d < i && (i = d), - u > s && (s = u), - h > a && (a = h), - d > o && (o = d); - } - return this.min.set(t, n, i), this.max.set(s, a, o), this; - } - setFromPoints(e) { - this.makeEmpty(); - for (let t = 0, n = e.length; t < n; t++) this.expandByPoint(e[t]); - return this; - } - setFromCenterAndSize(e, t) { - const n = Kn.copy(t).multiplyScalar(0.5); - return this.min.copy(e).sub(n), this.max.copy(e).add(n), this; - } - setFromObject(e, t = !1) { - return this.makeEmpty(), this.expandByObject(e, t); - } - clone() { - return new this.constructor().copy(this); - } - copy(e) { - return this.min.copy(e.min), this.max.copy(e.max), this; - } - makeEmpty() { - return ( - (this.min.x = this.min.y = this.min.z = 1 / 0), - (this.max.x = this.max.y = this.max.z = -1 / 0), - this - ); - } - isEmpty() { - return ( - this.max.x < this.min.x || - this.max.y < this.min.y || - this.max.z < this.min.z - ); - } - getCenter(e) { - return this.isEmpty() - ? e.set(0, 0, 0) - : e.addVectors(this.min, this.max).multiplyScalar(0.5); - } - getSize(e) { - return this.isEmpty() - ? e.set(0, 0, 0) - : e.subVectors(this.max, this.min); - } - expandByPoint(e) { - return this.min.min(e), this.max.max(e), this; - } - expandByVector(e) { - return this.min.sub(e), this.max.add(e), this; - } - expandByScalar(e) { - return this.min.addScalar(-e), this.max.addScalar(e), this; - } - expandByObject(e, t = !1) { - e.updateWorldMatrix(!1, !1); - const n = e.geometry; - if (n !== void 0) - if (t && n.attributes != null && n.attributes.position !== void 0) { - const s = n.attributes.position; - for (let a = 0, o = s.count; a < o; a++) - Kn.fromBufferAttribute(s, a).applyMatrix4(e.matrixWorld), - this.expandByPoint(Kn); - } else - n.boundingBox === null && n.computeBoundingBox(), - ia.copy(n.boundingBox), - ia.applyMatrix4(e.matrixWorld), - this.union(ia); - const i = e.children; - for (let s = 0, a = i.length; s < a; s++) - this.expandByObject(i[s], t); - return this; - } - containsPoint(e) { - return !( - e.x < this.min.x || - e.x > this.max.x || - e.y < this.min.y || - e.y > this.max.y || - e.z < this.min.z || - e.z > this.max.z - ); - } - containsBox(e) { - return ( - this.min.x <= e.min.x && - e.max.x <= this.max.x && - this.min.y <= e.min.y && - e.max.y <= this.max.y && - this.min.z <= e.min.z && - e.max.z <= this.max.z - ); - } - getParameter(e, t) { - return t.set( - (e.x - this.min.x) / (this.max.x - this.min.x), - (e.y - this.min.y) / (this.max.y - this.min.y), - (e.z - this.min.z) / (this.max.z - this.min.z) - ); - } - intersectsBox(e) { - return !( - e.max.x < this.min.x || - e.min.x > this.max.x || - e.max.y < this.min.y || - e.min.y > this.max.y || - e.max.z < this.min.z || - e.min.z > this.max.z - ); - } - intersectsSphere(e) { - return ( - this.clampPoint(e.center, Kn), - Kn.distanceToSquared(e.center) <= e.radius * e.radius - ); - } - intersectsPlane(e) { - let t, n; - return ( - e.normal.x > 0 - ? ((t = e.normal.x * this.min.x), (n = e.normal.x * this.max.x)) - : ((t = e.normal.x * this.max.x), (n = e.normal.x * this.min.x)), - e.normal.y > 0 - ? ((t += e.normal.y * this.min.y), (n += e.normal.y * this.max.y)) - : ((t += e.normal.y * this.max.y), - (n += e.normal.y * this.min.y)), - e.normal.z > 0 - ? ((t += e.normal.z * this.min.z), (n += e.normal.z * this.max.z)) - : ((t += e.normal.z * this.max.z), - (n += e.normal.z * this.min.z)), - t <= -e.constant && n >= -e.constant - ); - } - intersectsTriangle(e) { - if (this.isEmpty()) return !1; - this.getCenter(ds), - qs.subVectors(this.max, ds), - _i.subVectors(e.a, ds), - xi.subVectors(e.b, ds), - yi.subVectors(e.c, ds), - Rn.subVectors(xi, _i), - Pn.subVectors(yi, xi), - Zn.subVectors(_i, yi); - let t = [ - 0, - -Rn.z, - Rn.y, - 0, - -Pn.z, - Pn.y, - 0, - -Zn.z, - Zn.y, - Rn.z, - 0, - -Rn.x, - Pn.z, - 0, - -Pn.x, - Zn.z, - 0, - -Zn.x, - -Rn.y, - Rn.x, - 0, - -Pn.y, - Pn.x, - 0, - -Zn.y, - Zn.x, - 0, - ]; - return !sa(t, _i, xi, yi, qs) || - ((t = [1, 0, 0, 0, 1, 0, 0, 0, 1]), !sa(t, _i, xi, yi, qs)) - ? !1 - : ($s.crossVectors(Rn, Pn), - (t = [$s.x, $s.y, $s.z]), - sa(t, _i, xi, yi, qs)); - } - clampPoint(e, t) { - return t.copy(e).clamp(this.min, this.max); - } - distanceToPoint(e) { - return Kn.copy(e).clamp(this.min, this.max).sub(e).length(); - } - getBoundingSphere(e) { - return ( - this.getCenter(e.center), - (e.radius = this.getSize(Kn).length() * 0.5), - e - ); - } - intersect(e) { - return ( - this.min.max(e.min), - this.max.min(e.max), - this.isEmpty() && this.makeEmpty(), - this - ); - } - union(e) { - return this.min.min(e.min), this.max.max(e.max), this; - } - applyMatrix4(e) { - return this.isEmpty() - ? this - : (fn[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(e), - fn[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(e), - fn[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(e), - fn[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(e), - fn[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(e), - fn[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(e), - fn[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(e), - fn[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(e), - this.setFromPoints(fn), - this); - } - translate(e) { - return this.min.add(e), this.max.add(e), this; - } - equals(e) { - return e.min.equals(this.min) && e.max.equals(this.max); - } - } - const fn = [ - new P(), - new P(), - new P(), - new P(), - new P(), - new P(), - new P(), - new P(), - ], - Kn = new P(), - ia = new Ki(), - _i = new P(), - xi = new P(), - yi = new P(), - Rn = new P(), - Pn = new P(), - Zn = new P(), - ds = new P(), - qs = new P(), - $s = new P(), - Jn = new P(); - function sa(r, e, t, n, i) { - for (let s = 0, a = r.length - 3; s <= a; s += 3) { - Jn.fromArray(r, s); - const o = - i.x * Math.abs(Jn.x) + - i.y * Math.abs(Jn.y) + - i.z * Math.abs(Jn.z), - l = e.dot(Jn), - c = t.dot(Jn), - u = n.dot(Jn); - if (Math.max(-Math.max(l, c, u), Math.min(l, c, u)) > o) return !1; - } - return !0; - } - const yd = new Ki(), - hl = new P(), - Ys = new P(), - ra = new P(); - class Zi { - constructor(e = new P(), t = -1) { - (this.center = e), (this.radius = t); - } - set(e, t) { - return this.center.copy(e), (this.radius = t), this; - } - setFromPoints(e, t) { - const n = this.center; - t !== void 0 ? n.copy(t) : yd.setFromPoints(e).getCenter(n); - let i = 0; - for (let s = 0, a = e.length; s < a; s++) - i = Math.max(i, n.distanceToSquared(e[s])); - return (this.radius = Math.sqrt(i)), this; - } - copy(e) { - return this.center.copy(e.center), (this.radius = e.radius), this; - } - isEmpty() { - return this.radius < 0; - } - makeEmpty() { - return this.center.set(0, 0, 0), (this.radius = -1), this; - } - containsPoint(e) { - return e.distanceToSquared(this.center) <= this.radius * this.radius; - } - distanceToPoint(e) { - return e.distanceTo(this.center) - this.radius; - } - intersectsSphere(e) { - const t = this.radius + e.radius; - return e.center.distanceToSquared(this.center) <= t * t; - } - intersectsBox(e) { - return e.intersectsSphere(this); - } - intersectsPlane(e) { - return Math.abs(e.distanceToPoint(this.center)) <= this.radius; - } - clampPoint(e, t) { - const n = this.center.distanceToSquared(e); - return ( - t.copy(e), - n > this.radius * this.radius && - (t.sub(this.center).normalize(), - t.multiplyScalar(this.radius).add(this.center)), - t - ); - } - getBoundingBox(e) { - return this.isEmpty() - ? (e.makeEmpty(), e) - : (e.set(this.center, this.center), - e.expandByScalar(this.radius), - e); - } - applyMatrix4(e) { - return ( - this.center.applyMatrix4(e), - (this.radius = this.radius * e.getMaxScaleOnAxis()), - this - ); - } - translate(e) { - return this.center.add(e), this; - } - expandByPoint(e) { - ra.subVectors(e, this.center); - const t = ra.lengthSq(); - if (t > this.radius * this.radius) { - const n = Math.sqrt(t), - i = (n - this.radius) * 0.5; - this.center.add(ra.multiplyScalar(i / n)), (this.radius += i); - } - return this; - } - union(e) { - return ( - this.center.equals(e.center) === !0 - ? Ys.set(0, 0, 1).multiplyScalar(e.radius) - : Ys.subVectors(e.center, this.center) - .normalize() - .multiplyScalar(e.radius), - this.expandByPoint(hl.copy(e.center).add(Ys)), - this.expandByPoint(hl.copy(e.center).sub(Ys)), - this - ); - } - equals(e) { - return e.center.equals(this.center) && e.radius === this.radius; - } - clone() { - return new this.constructor().copy(this); - } - } - const pn = new P(), - aa = new P(), - Ks = new P(), - Dn = new P(), - oa = new P(), - Zs = new P(), - la = new P(); - class io { - constructor(e = new P(), t = new P(0, 0, -1)) { - (this.origin = e), (this.direction = t); - } - set(e, t) { - return this.origin.copy(e), this.direction.copy(t), this; - } - copy(e) { - return ( - this.origin.copy(e.origin), this.direction.copy(e.direction), this - ); - } - at(e, t) { - return t.copy(this.direction).multiplyScalar(e).add(this.origin); - } - lookAt(e) { - return this.direction.copy(e).sub(this.origin).normalize(), this; - } - recast(e) { - return this.origin.copy(this.at(e, pn)), this; - } - closestPointToPoint(e, t) { - t.subVectors(e, this.origin); - const n = t.dot(this.direction); - return n < 0 - ? t.copy(this.origin) - : t.copy(this.direction).multiplyScalar(n).add(this.origin); - } - distanceToPoint(e) { - return Math.sqrt(this.distanceSqToPoint(e)); - } - distanceSqToPoint(e) { - const t = pn.subVectors(e, this.origin).dot(this.direction); - return t < 0 - ? this.origin.distanceToSquared(e) - : (pn.copy(this.direction).multiplyScalar(t).add(this.origin), - pn.distanceToSquared(e)); - } - distanceSqToSegment(e, t, n, i) { - aa.copy(e).add(t).multiplyScalar(0.5), - Ks.copy(t).sub(e).normalize(), - Dn.copy(this.origin).sub(aa); - const s = e.distanceTo(t) * 0.5, - a = -this.direction.dot(Ks), - o = Dn.dot(this.direction), - l = -Dn.dot(Ks), - c = Dn.lengthSq(), - u = Math.abs(1 - a * a); - let h, d, f, g; - if (u > 0) - if (((h = a * l - o), (d = a * o - l), (g = s * u), h >= 0)) - if (d >= -g) - if (d <= g) { - const m = 1 / u; - (h *= m), - (d *= m), - (f = h * (h + a * d + 2 * o) + d * (a * h + d + 2 * l) + c); - } else - (d = s), - (h = Math.max(0, -(a * d + o))), - (f = -h * h + d * (d + 2 * l) + c); - else - (d = -s), - (h = Math.max(0, -(a * d + o))), - (f = -h * h + d * (d + 2 * l) + c); - else - d <= -g - ? ((h = Math.max(0, -(-a * s + o))), - (d = h > 0 ? -s : Math.min(Math.max(-s, -l), s)), - (f = -h * h + d * (d + 2 * l) + c)) - : d <= g - ? ((h = 0), - (d = Math.min(Math.max(-s, -l), s)), - (f = d * (d + 2 * l) + c)) - : ((h = Math.max(0, -(a * s + o))), - (d = h > 0 ? s : Math.min(Math.max(-s, -l), s)), - (f = -h * h + d * (d + 2 * l) + c)); - else - (d = a > 0 ? -s : s), - (h = Math.max(0, -(a * d + o))), - (f = -h * h + d * (d + 2 * l) + c); - return ( - n && n.copy(this.direction).multiplyScalar(h).add(this.origin), - i && i.copy(Ks).multiplyScalar(d).add(aa), - f - ); - } - intersectSphere(e, t) { - pn.subVectors(e.center, this.origin); - const n = pn.dot(this.direction), - i = pn.dot(pn) - n * n, - s = e.radius * e.radius; - if (i > s) return null; - const a = Math.sqrt(s - i), - o = n - a, - l = n + a; - return o < 0 && l < 0 ? null : o < 0 ? this.at(l, t) : this.at(o, t); - } - intersectsSphere(e) { - return this.distanceSqToPoint(e.center) <= e.radius * e.radius; - } - distanceToPlane(e) { - const t = e.normal.dot(this.direction); - if (t === 0) return e.distanceToPoint(this.origin) === 0 ? 0 : null; - const n = -(this.origin.dot(e.normal) + e.constant) / t; - return n >= 0 ? n : null; - } - intersectPlane(e, t) { - const n = this.distanceToPlane(e); - return n === null ? null : this.at(n, t); - } - intersectsPlane(e) { - const t = e.distanceToPoint(this.origin); - return t === 0 || e.normal.dot(this.direction) * t < 0; - } - intersectBox(e, t) { - let n, i, s, a, o, l; - const c = 1 / this.direction.x, - u = 1 / this.direction.y, - h = 1 / this.direction.z, - d = this.origin; - return ( - c >= 0 - ? ((n = (e.min.x - d.x) * c), (i = (e.max.x - d.x) * c)) - : ((n = (e.max.x - d.x) * c), (i = (e.min.x - d.x) * c)), - u >= 0 - ? ((s = (e.min.y - d.y) * u), (a = (e.max.y - d.y) * u)) - : ((s = (e.max.y - d.y) * u), (a = (e.min.y - d.y) * u)), - n > a || - s > i || - ((s > n || n !== n) && (n = s), - (a < i || i !== i) && (i = a), - h >= 0 - ? ((o = (e.min.z - d.z) * h), (l = (e.max.z - d.z) * h)) - : ((o = (e.max.z - d.z) * h), (l = (e.min.z - d.z) * h)), - n > l || o > i) || - ((o > n || n !== n) && (n = o), - (l < i || i !== i) && (i = l), - i < 0) - ? null - : this.at(n >= 0 ? n : i, t) - ); - } - intersectsBox(e) { - return this.intersectBox(e, pn) !== null; - } - intersectTriangle(e, t, n, i, s) { - oa.subVectors(t, e), Zs.subVectors(n, e), la.crossVectors(oa, Zs); - let a = this.direction.dot(la), - o; - if (a > 0) { - if (i) return null; - o = 1; - } else if (a < 0) (o = -1), (a = -a); - else return null; - Dn.subVectors(this.origin, e); - const l = o * this.direction.dot(Zs.crossVectors(Dn, Zs)); - if (l < 0) return null; - const c = o * this.direction.dot(oa.cross(Dn)); - if (c < 0 || l + c > a) return null; - const u = -o * Dn.dot(la); - return u < 0 ? null : this.at(u / a, s); - } - applyMatrix4(e) { - return ( - this.origin.applyMatrix4(e), - this.direction.transformDirection(e), - this - ); - } - equals(e) { - return ( - e.origin.equals(this.origin) && e.direction.equals(this.direction) - ); - } - clone() { - return new this.constructor().copy(this); - } - } - class pe { - constructor() { - (this.isMatrix4 = !0), - (this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]), - arguments.length > 0 && - console.error( - "THREE.Matrix4: the constructor no longer reads arguments. use .set() instead." - ); - } - set(e, t, n, i, s, a, o, l, c, u, h, d, f, g, m, p) { - const v = this.elements; - return ( - (v[0] = e), - (v[4] = t), - (v[8] = n), - (v[12] = i), - (v[1] = s), - (v[5] = a), - (v[9] = o), - (v[13] = l), - (v[2] = c), - (v[6] = u), - (v[10] = h), - (v[14] = d), - (v[3] = f), - (v[7] = g), - (v[11] = m), - (v[15] = p), - this - ); - } - identity() { - return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this; - } - clone() { - return new pe().fromArray(this.elements); - } - copy(e) { - const t = this.elements, - n = e.elements; - return ( - (t[0] = n[0]), - (t[1] = n[1]), - (t[2] = n[2]), - (t[3] = n[3]), - (t[4] = n[4]), - (t[5] = n[5]), - (t[6] = n[6]), - (t[7] = n[7]), - (t[8] = n[8]), - (t[9] = n[9]), - (t[10] = n[10]), - (t[11] = n[11]), - (t[12] = n[12]), - (t[13] = n[13]), - (t[14] = n[14]), - (t[15] = n[15]), - this - ); - } - copyPosition(e) { - const t = this.elements, - n = e.elements; - return (t[12] = n[12]), (t[13] = n[13]), (t[14] = n[14]), this; - } - setFromMatrix3(e) { - const t = e.elements; - return ( - this.set( - t[0], - t[3], - t[6], - 0, - t[1], - t[4], - t[7], - 0, - t[2], - t[5], - t[8], - 0, - 0, - 0, - 0, - 1 - ), - this - ); - } - extractBasis(e, t, n) { - return ( - e.setFromMatrixColumn(this, 0), - t.setFromMatrixColumn(this, 1), - n.setFromMatrixColumn(this, 2), - this - ); - } - makeBasis(e, t, n) { - return ( - this.set( - e.x, - t.x, - n.x, - 0, - e.y, - t.y, - n.y, - 0, - e.z, - t.z, - n.z, - 0, - 0, - 0, - 0, - 1 - ), - this - ); - } - extractRotation(e) { - const t = this.elements, - n = e.elements, - i = 1 / Mi.setFromMatrixColumn(e, 0).length(), - s = 1 / Mi.setFromMatrixColumn(e, 1).length(), - a = 1 / Mi.setFromMatrixColumn(e, 2).length(); - return ( - (t[0] = n[0] * i), - (t[1] = n[1] * i), - (t[2] = n[2] * i), - (t[3] = 0), - (t[4] = n[4] * s), - (t[5] = n[5] * s), - (t[6] = n[6] * s), - (t[7] = 0), - (t[8] = n[8] * a), - (t[9] = n[9] * a), - (t[10] = n[10] * a), - (t[11] = 0), - (t[12] = 0), - (t[13] = 0), - (t[14] = 0), - (t[15] = 1), - this - ); - } - makeRotationFromEuler(e) { - (e && e.isEuler) || - console.error( - "THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order." - ); - const t = this.elements, - n = e.x, - i = e.y, - s = e.z, - a = Math.cos(n), - o = Math.sin(n), - l = Math.cos(i), - c = Math.sin(i), - u = Math.cos(s), - h = Math.sin(s); - if (e.order === "XYZ") { - const d = a * u, - f = a * h, - g = o * u, - m = o * h; - (t[0] = l * u), - (t[4] = -l * h), - (t[8] = c), - (t[1] = f + g * c), - (t[5] = d - m * c), - (t[9] = -o * l), - (t[2] = m - d * c), - (t[6] = g + f * c), - (t[10] = a * l); - } else if (e.order === "YXZ") { - const d = l * u, - f = l * h, - g = c * u, - m = c * h; - (t[0] = d + m * o), - (t[4] = g * o - f), - (t[8] = a * c), - (t[1] = a * h), - (t[5] = a * u), - (t[9] = -o), - (t[2] = f * o - g), - (t[6] = m + d * o), - (t[10] = a * l); - } else if (e.order === "ZXY") { - const d = l * u, - f = l * h, - g = c * u, - m = c * h; - (t[0] = d - m * o), - (t[4] = -a * h), - (t[8] = g + f * o), - (t[1] = f + g * o), - (t[5] = a * u), - (t[9] = m - d * o), - (t[2] = -a * c), - (t[6] = o), - (t[10] = a * l); - } else if (e.order === "ZYX") { - const d = a * u, - f = a * h, - g = o * u, - m = o * h; - (t[0] = l * u), - (t[4] = g * c - f), - (t[8] = d * c + m), - (t[1] = l * h), - (t[5] = m * c + d), - (t[9] = f * c - g), - (t[2] = -c), - (t[6] = o * l), - (t[10] = a * l); - } else if (e.order === "YZX") { - const d = a * l, - f = a * c, - g = o * l, - m = o * c; - (t[0] = l * u), - (t[4] = m - d * h), - (t[8] = g * h + f), - (t[1] = h), - (t[5] = a * u), - (t[9] = -o * u), - (t[2] = -c * u), - (t[6] = f * h + g), - (t[10] = d - m * h); - } else if (e.order === "XZY") { - const d = a * l, - f = a * c, - g = o * l, - m = o * c; - (t[0] = l * u), - (t[4] = -h), - (t[8] = c * u), - (t[1] = d * h + m), - (t[5] = a * u), - (t[9] = f * h - g), - (t[2] = g * h - f), - (t[6] = o * u), - (t[10] = m * h + d); - } - return ( - (t[3] = 0), - (t[7] = 0), - (t[11] = 0), - (t[12] = 0), - (t[13] = 0), - (t[14] = 0), - (t[15] = 1), - this - ); - } - makeRotationFromQuaternion(e) { - return this.compose(Md, e, wd); - } - lookAt(e, t, n) { - const i = this.elements; - return ( - Ct.subVectors(e, t), - Ct.lengthSq() === 0 && (Ct.z = 1), - Ct.normalize(), - In.crossVectors(n, Ct), - In.lengthSq() === 0 && - (Math.abs(n.z) === 1 ? (Ct.x += 1e-4) : (Ct.z += 1e-4), - Ct.normalize(), - In.crossVectors(n, Ct)), - In.normalize(), - Js.crossVectors(Ct, In), - (i[0] = In.x), - (i[4] = Js.x), - (i[8] = Ct.x), - (i[1] = In.y), - (i[5] = Js.y), - (i[9] = Ct.y), - (i[2] = In.z), - (i[6] = Js.z), - (i[10] = Ct.z), - this - ); - } - multiply(e, t) { - return t !== void 0 - ? (console.warn( - "THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead." - ), - this.multiplyMatrices(e, t)) - : this.multiplyMatrices(this, e); - } - premultiply(e) { - return this.multiplyMatrices(e, this); - } - multiplyMatrices(e, t) { - const n = e.elements, - i = t.elements, - s = this.elements, - a = n[0], - o = n[4], - l = n[8], - c = n[12], - u = n[1], - h = n[5], - d = n[9], - f = n[13], - g = n[2], - m = n[6], - p = n[10], - v = n[14], - M = n[3], - x = n[7], - w = n[11], - y = n[15], - A = i[0], - L = i[4], - _ = i[8], - T = i[12], - I = i[1], - F = i[5], - H = i[9], - B = i[13], - D = i[2], - z = i[6], - N = i[10], - k = i[14], - G = i[3], - U = i[7], - X = i[11], - Z = i[15]; - return ( - (s[0] = a * A + o * I + l * D + c * G), - (s[4] = a * L + o * F + l * z + c * U), - (s[8] = a * _ + o * H + l * N + c * X), - (s[12] = a * T + o * B + l * k + c * Z), - (s[1] = u * A + h * I + d * D + f * G), - (s[5] = u * L + h * F + d * z + f * U), - (s[9] = u * _ + h * H + d * N + f * X), - (s[13] = u * T + h * B + d * k + f * Z), - (s[2] = g * A + m * I + p * D + v * G), - (s[6] = g * L + m * F + p * z + v * U), - (s[10] = g * _ + m * H + p * N + v * X), - (s[14] = g * T + m * B + p * k + v * Z), - (s[3] = M * A + x * I + w * D + y * G), - (s[7] = M * L + x * F + w * z + y * U), - (s[11] = M * _ + x * H + w * N + y * X), - (s[15] = M * T + x * B + w * k + y * Z), - this - ); - } - multiplyScalar(e) { - const t = this.elements; - return ( - (t[0] *= e), - (t[4] *= e), - (t[8] *= e), - (t[12] *= e), - (t[1] *= e), - (t[5] *= e), - (t[9] *= e), - (t[13] *= e), - (t[2] *= e), - (t[6] *= e), - (t[10] *= e), - (t[14] *= e), - (t[3] *= e), - (t[7] *= e), - (t[11] *= e), - (t[15] *= e), - this - ); - } - determinant() { - const e = this.elements, - t = e[0], - n = e[4], - i = e[8], - s = e[12], - a = e[1], - o = e[5], - l = e[9], - c = e[13], - u = e[2], - h = e[6], - d = e[10], - f = e[14], - g = e[3], - m = e[7], - p = e[11], - v = e[15]; - return ( - g * - (+s * l * h - - i * c * h - - s * o * d + - n * c * d + - i * o * f - - n * l * f) + - m * - (+t * l * f - - t * c * d + - s * a * d - - i * a * f + - i * c * u - - s * l * u) + - p * - (+t * c * h - - t * o * f - - s * a * h + - n * a * f + - s * o * u - - n * c * u) + - v * - (-i * o * u - - t * l * h + - t * o * d + - i * a * h - - n * a * d + - n * l * u) - ); - } - transpose() { - const e = this.elements; - let t; - return ( - (t = e[1]), - (e[1] = e[4]), - (e[4] = t), - (t = e[2]), - (e[2] = e[8]), - (e[8] = t), - (t = e[6]), - (e[6] = e[9]), - (e[9] = t), - (t = e[3]), - (e[3] = e[12]), - (e[12] = t), - (t = e[7]), - (e[7] = e[13]), - (e[13] = t), - (t = e[11]), - (e[11] = e[14]), - (e[14] = t), - this - ); - } - setPosition(e, t, n) { - const i = this.elements; - return ( - e.isVector3 - ? ((i[12] = e.x), (i[13] = e.y), (i[14] = e.z)) - : ((i[12] = e), (i[13] = t), (i[14] = n)), - this - ); - } - invert() { - const e = this.elements, - t = e[0], - n = e[1], - i = e[2], - s = e[3], - a = e[4], - o = e[5], - l = e[6], - c = e[7], - u = e[8], - h = e[9], - d = e[10], - f = e[11], - g = e[12], - m = e[13], - p = e[14], - v = e[15], - M = - h * p * c - - m * d * c + - m * l * f - - o * p * f - - h * l * v + - o * d * v, - x = - g * d * c - - u * p * c - - g * l * f + - a * p * f + - u * l * v - - a * d * v, - w = - u * m * c - - g * h * c + - g * o * f - - a * m * f - - u * o * v + - a * h * v, - y = - g * h * l - - u * m * l - - g * o * d + - a * m * d + - u * o * p - - a * h * p, - A = t * M + n * x + i * w + s * y; - if (A === 0) - return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - const L = 1 / A; - return ( - (e[0] = M * L), - (e[1] = - (m * d * s - - h * p * s - - m * i * f + - n * p * f + - h * i * v - - n * d * v) * - L), - (e[2] = - (o * p * s - - m * l * s + - m * i * c - - n * p * c - - o * i * v + - n * l * v) * - L), - (e[3] = - (h * l * s - - o * d * s - - h * i * c + - n * d * c + - o * i * f - - n * l * f) * - L), - (e[4] = x * L), - (e[5] = - (u * p * s - - g * d * s + - g * i * f - - t * p * f - - u * i * v + - t * d * v) * - L), - (e[6] = - (g * l * s - - a * p * s - - g * i * c + - t * p * c + - a * i * v - - t * l * v) * - L), - (e[7] = - (a * d * s - - u * l * s + - u * i * c - - t * d * c - - a * i * f + - t * l * f) * - L), - (e[8] = w * L), - (e[9] = - (g * h * s - - u * m * s - - g * n * f + - t * m * f + - u * n * v - - t * h * v) * - L), - (e[10] = - (a * m * s - - g * o * s + - g * n * c - - t * m * c - - a * n * v + - t * o * v) * - L), - (e[11] = - (u * o * s - - a * h * s - - u * n * c + - t * h * c + - a * n * f - - t * o * f) * - L), - (e[12] = y * L), - (e[13] = - (u * m * i - - g * h * i + - g * n * d - - t * m * d - - u * n * p + - t * h * p) * - L), - (e[14] = - (g * o * i - - a * m * i - - g * n * l + - t * m * l + - a * n * p - - t * o * p) * - L), - (e[15] = - (a * h * i - - u * o * i + - u * n * l - - t * h * l - - a * n * d + - t * o * d) * - L), - this - ); - } - scale(e) { - const t = this.elements, - n = e.x, - i = e.y, - s = e.z; - return ( - (t[0] *= n), - (t[4] *= i), - (t[8] *= s), - (t[1] *= n), - (t[5] *= i), - (t[9] *= s), - (t[2] *= n), - (t[6] *= i), - (t[10] *= s), - (t[3] *= n), - (t[7] *= i), - (t[11] *= s), - this - ); - } - getMaxScaleOnAxis() { - const e = this.elements, - t = e[0] * e[0] + e[1] * e[1] + e[2] * e[2], - n = e[4] * e[4] + e[5] * e[5] + e[6] * e[6], - i = e[8] * e[8] + e[9] * e[9] + e[10] * e[10]; - return Math.sqrt(Math.max(t, n, i)); - } - makeTranslation(e, t, n) { - return this.set(1, 0, 0, e, 0, 1, 0, t, 0, 0, 1, n, 0, 0, 0, 1), this; - } - makeRotationX(e) { - const t = Math.cos(e), - n = Math.sin(e); - return ( - this.set(1, 0, 0, 0, 0, t, -n, 0, 0, n, t, 0, 0, 0, 0, 1), this - ); - } - makeRotationY(e) { - const t = Math.cos(e), - n = Math.sin(e); - return ( - this.set(t, 0, n, 0, 0, 1, 0, 0, -n, 0, t, 0, 0, 0, 0, 1), this - ); - } - makeRotationZ(e) { - const t = Math.cos(e), - n = Math.sin(e); - return ( - this.set(t, -n, 0, 0, n, t, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this - ); - } - makeRotationAxis(e, t) { - const n = Math.cos(t), - i = Math.sin(t), - s = 1 - n, - a = e.x, - o = e.y, - l = e.z, - c = s * a, - u = s * o; - return ( - this.set( - c * a + n, - c * o - i * l, - c * l + i * o, - 0, - c * o + i * l, - u * o + n, - u * l - i * a, - 0, - c * l - i * o, - u * l + i * a, - s * l * l + n, - 0, - 0, - 0, - 0, - 1 - ), - this - ); - } - makeScale(e, t, n) { - return this.set(e, 0, 0, 0, 0, t, 0, 0, 0, 0, n, 0, 0, 0, 0, 1), this; - } - makeShear(e, t, n, i, s, a) { - return this.set(1, n, s, 0, e, 1, a, 0, t, i, 1, 0, 0, 0, 0, 1), this; - } - compose(e, t, n) { - const i = this.elements, - s = t._x, - a = t._y, - o = t._z, - l = t._w, - c = s + s, - u = a + a, - h = o + o, - d = s * c, - f = s * u, - g = s * h, - m = a * u, - p = a * h, - v = o * h, - M = l * c, - x = l * u, - w = l * h, - y = n.x, - A = n.y, - L = n.z; - return ( - (i[0] = (1 - (m + v)) * y), - (i[1] = (f + w) * y), - (i[2] = (g - x) * y), - (i[3] = 0), - (i[4] = (f - w) * A), - (i[5] = (1 - (d + v)) * A), - (i[6] = (p + M) * A), - (i[7] = 0), - (i[8] = (g + x) * L), - (i[9] = (p - M) * L), - (i[10] = (1 - (d + m)) * L), - (i[11] = 0), - (i[12] = e.x), - (i[13] = e.y), - (i[14] = e.z), - (i[15] = 1), - this - ); - } - decompose(e, t, n) { - const i = this.elements; - let s = Mi.set(i[0], i[1], i[2]).length(); - const a = Mi.set(i[4], i[5], i[6]).length(), - o = Mi.set(i[8], i[9], i[10]).length(); - this.determinant() < 0 && (s = -s), - (e.x = i[12]), - (e.y = i[13]), - (e.z = i[14]), - Vt.copy(this); - const c = 1 / s, - u = 1 / a, - h = 1 / o; - return ( - (Vt.elements[0] *= c), - (Vt.elements[1] *= c), - (Vt.elements[2] *= c), - (Vt.elements[4] *= u), - (Vt.elements[5] *= u), - (Vt.elements[6] *= u), - (Vt.elements[8] *= h), - (Vt.elements[9] *= h), - (Vt.elements[10] *= h), - t.setFromRotationMatrix(Vt), - (n.x = s), - (n.y = a), - (n.z = o), - this - ); - } - makePerspective(e, t, n, i, s, a) { - a === void 0 && - console.warn( - "THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs." - ); - const o = this.elements, - l = (2 * s) / (t - e), - c = (2 * s) / (n - i), - u = (t + e) / (t - e), - h = (n + i) / (n - i), - d = -(a + s) / (a - s), - f = (-2 * a * s) / (a - s); - return ( - (o[0] = l), - (o[4] = 0), - (o[8] = u), - (o[12] = 0), - (o[1] = 0), - (o[5] = c), - (o[9] = h), - (o[13] = 0), - (o[2] = 0), - (o[6] = 0), - (o[10] = d), - (o[14] = f), - (o[3] = 0), - (o[7] = 0), - (o[11] = -1), - (o[15] = 0), - this - ); - } - makeOrthographic(e, t, n, i, s, a) { - const o = this.elements, - l = 1 / (t - e), - c = 1 / (n - i), - u = 1 / (a - s), - h = (t + e) * l, - d = (n + i) * c, - f = (a + s) * u; - return ( - (o[0] = 2 * l), - (o[4] = 0), - (o[8] = 0), - (o[12] = -h), - (o[1] = 0), - (o[5] = 2 * c), - (o[9] = 0), - (o[13] = -d), - (o[2] = 0), - (o[6] = 0), - (o[10] = -2 * u), - (o[14] = -f), - (o[3] = 0), - (o[7] = 0), - (o[11] = 0), - (o[15] = 1), - this - ); - } - equals(e) { - const t = this.elements, - n = e.elements; - for (let i = 0; i < 16; i++) if (t[i] !== n[i]) return !1; - return !0; - } - fromArray(e, t = 0) { - for (let n = 0; n < 16; n++) this.elements[n] = e[n + t]; - return this; - } - toArray(e = [], t = 0) { - const n = this.elements; - return ( - (e[t] = n[0]), - (e[t + 1] = n[1]), - (e[t + 2] = n[2]), - (e[t + 3] = n[3]), - (e[t + 4] = n[4]), - (e[t + 5] = n[5]), - (e[t + 6] = n[6]), - (e[t + 7] = n[7]), - (e[t + 8] = n[8]), - (e[t + 9] = n[9]), - (e[t + 10] = n[10]), - (e[t + 11] = n[11]), - (e[t + 12] = n[12]), - (e[t + 13] = n[13]), - (e[t + 14] = n[14]), - (e[t + 15] = n[15]), - e - ); - } - } - const Mi = new P(), - Vt = new pe(), - Md = new P(0, 0, 0), - wd = new P(1, 1, 1), - In = new P(), - Js = new P(), - Ct = new P(), - ul = new pe(), - dl = new Mt(); - class an { - constructor(e = 0, t = 0, n = 0, i = an.DefaultOrder) { - (this.isEuler = !0), - (this._x = e), - (this._y = t), - (this._z = n), - (this._order = i); - } - get x() { - return this._x; - } - set x(e) { - (this._x = e), this._onChangeCallback(); - } - get y() { - return this._y; - } - set y(e) { - (this._y = e), this._onChangeCallback(); - } - get z() { - return this._z; - } - set z(e) { - (this._z = e), this._onChangeCallback(); - } - get order() { - return this._order; - } - set order(e) { - (this._order = e), this._onChangeCallback(); - } - set(e, t, n, i = this._order) { - return ( - (this._x = e), - (this._y = t), - (this._z = n), - (this._order = i), - this._onChangeCallback(), - this - ); - } - clone() { - return new this.constructor(this._x, this._y, this._z, this._order); - } - copy(e) { - return ( - (this._x = e._x), - (this._y = e._y), - (this._z = e._z), - (this._order = e._order), - this._onChangeCallback(), - this - ); - } - setFromRotationMatrix(e, t = this._order, n = !0) { - const i = e.elements, - s = i[0], - a = i[4], - o = i[8], - l = i[1], - c = i[5], - u = i[9], - h = i[2], - d = i[6], - f = i[10]; - switch (t) { - case "XYZ": - (this._y = Math.asin(at(o, -1, 1))), - Math.abs(o) < 0.9999999 - ? ((this._x = Math.atan2(-u, f)), - (this._z = Math.atan2(-a, s))) - : ((this._x = Math.atan2(d, c)), (this._z = 0)); - break; - case "YXZ": - (this._x = Math.asin(-at(u, -1, 1))), - Math.abs(u) < 0.9999999 - ? ((this._y = Math.atan2(o, f)), (this._z = Math.atan2(l, c))) - : ((this._y = Math.atan2(-h, s)), (this._z = 0)); - break; - case "ZXY": - (this._x = Math.asin(at(d, -1, 1))), - Math.abs(d) < 0.9999999 - ? ((this._y = Math.atan2(-h, f)), - (this._z = Math.atan2(-a, c))) - : ((this._y = 0), (this._z = Math.atan2(l, s))); - break; - case "ZYX": - (this._y = Math.asin(-at(h, -1, 1))), - Math.abs(h) < 0.9999999 - ? ((this._x = Math.atan2(d, f)), (this._z = Math.atan2(l, s))) - : ((this._x = 0), (this._z = Math.atan2(-a, c))); - break; - case "YZX": - (this._z = Math.asin(at(l, -1, 1))), - Math.abs(l) < 0.9999999 - ? ((this._x = Math.atan2(-u, c)), - (this._y = Math.atan2(-h, s))) - : ((this._x = 0), (this._y = Math.atan2(o, f))); - break; - case "XZY": - (this._z = Math.asin(-at(a, -1, 1))), - Math.abs(a) < 0.9999999 - ? ((this._x = Math.atan2(d, c)), (this._y = Math.atan2(o, s))) - : ((this._x = Math.atan2(-u, f)), (this._y = 0)); - break; - default: - console.warn( - "THREE.Euler: .setFromRotationMatrix() encountered an unknown order: " + - t - ); - } - return (this._order = t), n === !0 && this._onChangeCallback(), this; - } - setFromQuaternion(e, t, n) { - return ( - ul.makeRotationFromQuaternion(e), - this.setFromRotationMatrix(ul, t, n) - ); - } - setFromVector3(e, t = this._order) { - return this.set(e.x, e.y, e.z, t); - } - reorder(e) { - return dl.setFromEuler(this), this.setFromQuaternion(dl, e); - } - equals(e) { - return ( - e._x === this._x && - e._y === this._y && - e._z === this._z && - e._order === this._order - ); - } - fromArray(e) { - return ( - (this._x = e[0]), - (this._y = e[1]), - (this._z = e[2]), - e[3] !== void 0 && (this._order = e[3]), - this._onChangeCallback(), - this - ); - } - toArray(e = [], t = 0) { - return ( - (e[t] = this._x), - (e[t + 1] = this._y), - (e[t + 2] = this._z), - (e[t + 3] = this._order), - e - ); - } - _onChange(e) { - return (this._onChangeCallback = e), this; - } - _onChangeCallback() {} - *[Symbol.iterator]() { - yield this._x, yield this._y, yield this._z, yield this._order; - } - toVector3() { - console.error( - "THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead" - ); - } - } - an.DefaultOrder = "XYZ"; - an.RotationOrders = ["XYZ", "YZX", "ZXY", "XZY", "YXZ", "ZYX"]; - class qc { - constructor() { - this.mask = 1; - } - set(e) { - this.mask = ((1 << e) | 0) >>> 0; - } - enable(e) { - this.mask |= (1 << e) | 0; - } - enableAll() { - this.mask = -1; - } - toggle(e) { - this.mask ^= (1 << e) | 0; - } - disable(e) { - this.mask &= ~((1 << e) | 0); - } - disableAll() { - this.mask = 0; - } - test(e) { - return (this.mask & e.mask) !== 0; - } - isEnabled(e) { - return (this.mask & ((1 << e) | 0)) !== 0; - } - } - let bd = 0; - const fl = new P(), - wi = new Mt(), - mn = new pe(), - Qs = new P(), - fs = new P(), - Sd = new P(), - Td = new Mt(), - pl = new P(1, 0, 0), - ml = new P(0, 1, 0), - gl = new P(0, 0, 1), - Ed = { type: "added" }, - vl = { type: "removed" }; - class Ye extends hi { - constructor() { - super(), - (this.isObject3D = !0), - Object.defineProperty(this, "id", { value: bd++ }), - (this.uuid = Yt()), - (this.name = ""), - (this.type = "Object3D"), - (this.parent = null), - (this.children = []), - (this.up = Ye.DefaultUp.clone()); - const e = new P(), - t = new an(), - n = new Mt(), - i = new P(1, 1, 1); - function s() { - n.setFromEuler(t, !1); - } - function a() { - t.setFromQuaternion(n, void 0, !1); - } - t._onChange(s), - n._onChange(a), - Object.defineProperties(this, { - position: { configurable: !0, enumerable: !0, value: e }, - rotation: { configurable: !0, enumerable: !0, value: t }, - quaternion: { configurable: !0, enumerable: !0, value: n }, - scale: { configurable: !0, enumerable: !0, value: i }, - modelViewMatrix: { value: new pe() }, - normalMatrix: { value: new Xt() }, - }), - (this.matrix = new pe()), - (this.matrixWorld = new pe()), - (this.matrixAutoUpdate = Ye.DefaultMatrixAutoUpdate), - (this.matrixWorldNeedsUpdate = !1), - (this.layers = new qc()), - (this.visible = !0), - (this.castShadow = !1), - (this.receiveShadow = !1), - (this.frustumCulled = !0), - (this.renderOrder = 0), - (this.animations = []), - (this.userData = {}); - } - onBeforeRender() {} - onAfterRender() {} - applyMatrix4(e) { - this.matrixAutoUpdate && this.updateMatrix(), - this.matrix.premultiply(e), - this.matrix.decompose(this.position, this.quaternion, this.scale); - } - applyQuaternion(e) { - return this.quaternion.premultiply(e), this; - } - setRotationFromAxisAngle(e, t) { - this.quaternion.setFromAxisAngle(e, t); - } - setRotationFromEuler(e) { - this.quaternion.setFromEuler(e, !0); - } - setRotationFromMatrix(e) { - this.quaternion.setFromRotationMatrix(e); - } - setRotationFromQuaternion(e) { - this.quaternion.copy(e); - } - rotateOnAxis(e, t) { - return wi.setFromAxisAngle(e, t), this.quaternion.multiply(wi), this; - } - rotateOnWorldAxis(e, t) { - return ( - wi.setFromAxisAngle(e, t), this.quaternion.premultiply(wi), this - ); - } - rotateX(e) { - return this.rotateOnAxis(pl, e); - } - rotateY(e) { - return this.rotateOnAxis(ml, e); - } - rotateZ(e) { - return this.rotateOnAxis(gl, e); - } - translateOnAxis(e, t) { - return ( - fl.copy(e).applyQuaternion(this.quaternion), - this.position.add(fl.multiplyScalar(t)), - this - ); - } - translateX(e) { - return this.translateOnAxis(pl, e); - } - translateY(e) { - return this.translateOnAxis(ml, e); - } - translateZ(e) { - return this.translateOnAxis(gl, e); - } - localToWorld(e) { - return e.applyMatrix4(this.matrixWorld); - } - worldToLocal(e) { - return e.applyMatrix4(mn.copy(this.matrixWorld).invert()); - } - lookAt(e, t, n) { - e.isVector3 ? Qs.copy(e) : Qs.set(e, t, n); - const i = this.parent; - this.updateWorldMatrix(!0, !1), - fs.setFromMatrixPosition(this.matrixWorld), - this.isCamera || this.isLight - ? mn.lookAt(fs, Qs, this.up) - : mn.lookAt(Qs, fs, this.up), - this.quaternion.setFromRotationMatrix(mn), - i && - (mn.extractRotation(i.matrixWorld), - wi.setFromRotationMatrix(mn), - this.quaternion.premultiply(wi.invert())); - } - add(e) { - if (arguments.length > 1) { - for (let t = 0; t < arguments.length; t++) this.add(arguments[t]); - return this; - } - return e === this - ? (console.error( - "THREE.Object3D.add: object can't be added as a child of itself.", - e - ), - this) - : (e && e.isObject3D - ? (e.parent !== null && e.parent.remove(e), - (e.parent = this), - this.children.push(e), - e.dispatchEvent(Ed)) - : console.error( - "THREE.Object3D.add: object not an instance of THREE.Object3D.", - e - ), - this); - } - remove(e) { - if (arguments.length > 1) { - for (let n = 0; n < arguments.length; n++) - this.remove(arguments[n]); - return this; - } - const t = this.children.indexOf(e); - return ( - t !== -1 && - ((e.parent = null), - this.children.splice(t, 1), - e.dispatchEvent(vl)), - this - ); - } - removeFromParent() { - const e = this.parent; - return e !== null && e.remove(this), this; - } - clear() { - for (let e = 0; e < this.children.length; e++) { - const t = this.children[e]; - (t.parent = null), t.dispatchEvent(vl); - } - return (this.children.length = 0), this; - } - attach(e) { - return ( - this.updateWorldMatrix(!0, !1), - mn.copy(this.matrixWorld).invert(), - e.parent !== null && - (e.parent.updateWorldMatrix(!0, !1), - mn.multiply(e.parent.matrixWorld)), - e.applyMatrix4(mn), - this.add(e), - e.updateWorldMatrix(!1, !0), - this - ); - } - getObjectById(e) { - return this.getObjectByProperty("id", e); - } - getObjectByName(e) { - return this.getObjectByProperty("name", e); - } - getObjectByProperty(e, t) { - if (this[e] === t) return this; - for (let n = 0, i = this.children.length; n < i; n++) { - const a = this.children[n].getObjectByProperty(e, t); - if (a !== void 0) return a; - } - } - getWorldPosition(e) { - return ( - this.updateWorldMatrix(!0, !1), - e.setFromMatrixPosition(this.matrixWorld) - ); - } - getWorldQuaternion(e) { - return ( - this.updateWorldMatrix(!0, !1), - this.matrixWorld.decompose(fs, e, Sd), - e - ); - } - getWorldScale(e) { - return ( - this.updateWorldMatrix(!0, !1), - this.matrixWorld.decompose(fs, Td, e), - e - ); - } - getWorldDirection(e) { - this.updateWorldMatrix(!0, !1); - const t = this.matrixWorld.elements; - return e.set(t[8], t[9], t[10]).normalize(); - } - raycast() {} - traverse(e) { - e(this); - const t = this.children; - for (let n = 0, i = t.length; n < i; n++) t[n].traverse(e); - } - traverseVisible(e) { - if (this.visible === !1) return; - e(this); - const t = this.children; - for (let n = 0, i = t.length; n < i; n++) t[n].traverseVisible(e); - } - traverseAncestors(e) { - const t = this.parent; - t !== null && (e(t), t.traverseAncestors(e)); - } - updateMatrix() { - this.matrix.compose(this.position, this.quaternion, this.scale), - (this.matrixWorldNeedsUpdate = !0); - } - updateMatrixWorld(e) { - this.matrixAutoUpdate && this.updateMatrix(), - (this.matrixWorldNeedsUpdate || e) && - (this.parent === null - ? this.matrixWorld.copy(this.matrix) - : this.matrixWorld.multiplyMatrices( - this.parent.matrixWorld, - this.matrix - ), - (this.matrixWorldNeedsUpdate = !1), - (e = !0)); - const t = this.children; - for (let n = 0, i = t.length; n < i; n++) t[n].updateMatrixWorld(e); - } - updateWorldMatrix(e, t) { - const n = this.parent; - if ( - (e === !0 && n !== null && n.updateWorldMatrix(!0, !1), - this.matrixAutoUpdate && this.updateMatrix(), - this.parent === null - ? this.matrixWorld.copy(this.matrix) - : this.matrixWorld.multiplyMatrices( - this.parent.matrixWorld, - this.matrix - ), - t === !0) - ) { - const i = this.children; - for (let s = 0, a = i.length; s < a; s++) - i[s].updateWorldMatrix(!1, !0); - } - } - toJSON(e) { - const t = e === void 0 || typeof e == "string", - n = {}; - t && - ((e = { - geometries: {}, - materials: {}, - textures: {}, - images: {}, - shapes: {}, - skeletons: {}, - animations: {}, - nodes: {}, - }), - (n.metadata = { - version: 4.5, - type: "Object", - generator: "Object3D.toJSON", - })); - const i = {}; - (i.uuid = this.uuid), - (i.type = this.type), - this.name !== "" && (i.name = this.name), - this.castShadow === !0 && (i.castShadow = !0), - this.receiveShadow === !0 && (i.receiveShadow = !0), - this.visible === !1 && (i.visible = !1), - this.frustumCulled === !1 && (i.frustumCulled = !1), - this.renderOrder !== 0 && (i.renderOrder = this.renderOrder), - JSON.stringify(this.userData) !== "{}" && - (i.userData = this.userData), - (i.layers = this.layers.mask), - (i.matrix = this.matrix.toArray()), - this.matrixAutoUpdate === !1 && (i.matrixAutoUpdate = !1), - this.isInstancedMesh && - ((i.type = "InstancedMesh"), - (i.count = this.count), - (i.instanceMatrix = this.instanceMatrix.toJSON()), - this.instanceColor !== null && - (i.instanceColor = this.instanceColor.toJSON())); - function s(o, l) { - return o[l.uuid] === void 0 && (o[l.uuid] = l.toJSON(e)), l.uuid; - } - if (this.isScene) - this.background && - (this.background.isColor - ? (i.background = this.background.toJSON()) - : this.background.isTexture && - (i.background = this.background.toJSON(e).uuid)), - this.environment && - this.environment.isTexture && - (i.environment = this.environment.toJSON(e).uuid); - else if (this.isMesh || this.isLine || this.isPoints) { - i.geometry = s(e.geometries, this.geometry); - const o = this.geometry.parameters; - if (o !== void 0 && o.shapes !== void 0) { - const l = o.shapes; - if (Array.isArray(l)) - for (let c = 0, u = l.length; c < u; c++) { - const h = l[c]; - s(e.shapes, h); - } - else s(e.shapes, l); - } - } - if ( - (this.isSkinnedMesh && - ((i.bindMode = this.bindMode), - (i.bindMatrix = this.bindMatrix.toArray()), - this.skeleton !== void 0 && - (s(e.skeletons, this.skeleton), - (i.skeleton = this.skeleton.uuid))), - this.material !== void 0) - ) - if (Array.isArray(this.material)) { - const o = []; - for (let l = 0, c = this.material.length; l < c; l++) - o.push(s(e.materials, this.material[l])); - i.material = o; - } else i.material = s(e.materials, this.material); - if (this.children.length > 0) { - i.children = []; - for (let o = 0; o < this.children.length; o++) - i.children.push(this.children[o].toJSON(e).object); - } - if (this.animations.length > 0) { - i.animations = []; - for (let o = 0; o < this.animations.length; o++) { - const l = this.animations[o]; - i.animations.push(s(e.animations, l)); - } - } - if (t) { - const o = a(e.geometries), - l = a(e.materials), - c = a(e.textures), - u = a(e.images), - h = a(e.shapes), - d = a(e.skeletons), - f = a(e.animations), - g = a(e.nodes); - o.length > 0 && (n.geometries = o), - l.length > 0 && (n.materials = l), - c.length > 0 && (n.textures = c), - u.length > 0 && (n.images = u), - h.length > 0 && (n.shapes = h), - d.length > 0 && (n.skeletons = d), - f.length > 0 && (n.animations = f), - g.length > 0 && (n.nodes = g); - } - return (n.object = i), n; - function a(o) { - const l = []; - for (const c in o) { - const u = o[c]; - delete u.metadata, l.push(u); - } - return l; - } - } - clone(e) { - return new this.constructor().copy(this, e); - } - copy(e, t = !0) { - if ( - ((this.name = e.name), - this.up.copy(e.up), - this.position.copy(e.position), - (this.rotation.order = e.rotation.order), - this.quaternion.copy(e.quaternion), - this.scale.copy(e.scale), - this.matrix.copy(e.matrix), - this.matrixWorld.copy(e.matrixWorld), - (this.matrixAutoUpdate = e.matrixAutoUpdate), - (this.matrixWorldNeedsUpdate = e.matrixWorldNeedsUpdate), - (this.layers.mask = e.layers.mask), - (this.visible = e.visible), - (this.castShadow = e.castShadow), - (this.receiveShadow = e.receiveShadow), - (this.frustumCulled = e.frustumCulled), - (this.renderOrder = e.renderOrder), - (this.userData = JSON.parse(JSON.stringify(e.userData))), - t === !0) - ) - for (let n = 0; n < e.children.length; n++) { - const i = e.children[n]; - this.add(i.clone()); - } - return this; - } - } - Ye.DefaultUp = new P(0, 1, 0); - Ye.DefaultMatrixAutoUpdate = !0; - const Gt = new P(), - gn = new P(), - ca = new P(), - vn = new P(), - bi = new P(), - Si = new P(), - _l = new P(), - ha = new P(), - ua = new P(), - da = new P(); - class rn { - constructor(e = new P(), t = new P(), n = new P()) { - (this.a = e), (this.b = t), (this.c = n); - } - static getNormal(e, t, n, i) { - i.subVectors(n, t), Gt.subVectors(e, t), i.cross(Gt); - const s = i.lengthSq(); - return s > 0 ? i.multiplyScalar(1 / Math.sqrt(s)) : i.set(0, 0, 0); - } - static getBarycoord(e, t, n, i, s) { - Gt.subVectors(i, t), gn.subVectors(n, t), ca.subVectors(e, t); - const a = Gt.dot(Gt), - o = Gt.dot(gn), - l = Gt.dot(ca), - c = gn.dot(gn), - u = gn.dot(ca), - h = a * c - o * o; - if (h === 0) return s.set(-2, -1, -1); - const d = 1 / h, - f = (c * l - o * u) * d, - g = (a * u - o * l) * d; - return s.set(1 - f - g, g, f); - } - static containsPoint(e, t, n, i) { - return ( - this.getBarycoord(e, t, n, i, vn), - vn.x >= 0 && vn.y >= 0 && vn.x + vn.y <= 1 - ); - } - static getUV(e, t, n, i, s, a, o, l) { - return ( - this.getBarycoord(e, t, n, i, vn), - l.set(0, 0), - l.addScaledVector(s, vn.x), - l.addScaledVector(a, vn.y), - l.addScaledVector(o, vn.z), - l - ); - } - static isFrontFacing(e, t, n, i) { - return ( - Gt.subVectors(n, t), gn.subVectors(e, t), Gt.cross(gn).dot(i) < 0 - ); - } - set(e, t, n) { - return this.a.copy(e), this.b.copy(t), this.c.copy(n), this; - } - setFromPointsAndIndices(e, t, n, i) { - return this.a.copy(e[t]), this.b.copy(e[n]), this.c.copy(e[i]), this; - } - setFromAttributeAndIndices(e, t, n, i) { - return ( - this.a.fromBufferAttribute(e, t), - this.b.fromBufferAttribute(e, n), - this.c.fromBufferAttribute(e, i), - this - ); - } - clone() { - return new this.constructor().copy(this); - } - copy(e) { - return this.a.copy(e.a), this.b.copy(e.b), this.c.copy(e.c), this; - } - getArea() { - return ( - Gt.subVectors(this.c, this.b), - gn.subVectors(this.a, this.b), - Gt.cross(gn).length() * 0.5 - ); - } - getMidpoint(e) { - return e - .addVectors(this.a, this.b) - .add(this.c) - .multiplyScalar(1 / 3); - } - getNormal(e) { - return rn.getNormal(this.a, this.b, this.c, e); - } - getPlane(e) { - return e.setFromCoplanarPoints(this.a, this.b, this.c); - } - getBarycoord(e, t) { - return rn.getBarycoord(e, this.a, this.b, this.c, t); - } - getUV(e, t, n, i, s) { - return rn.getUV(e, this.a, this.b, this.c, t, n, i, s); - } - containsPoint(e) { - return rn.containsPoint(e, this.a, this.b, this.c); - } - isFrontFacing(e) { - return rn.isFrontFacing(this.a, this.b, this.c, e); - } - intersectsBox(e) { - return e.intersectsTriangle(this); - } - closestPointToPoint(e, t) { - const n = this.a, - i = this.b, - s = this.c; - let a, o; - bi.subVectors(i, n), Si.subVectors(s, n), ha.subVectors(e, n); - const l = bi.dot(ha), - c = Si.dot(ha); - if (l <= 0 && c <= 0) return t.copy(n); - ua.subVectors(e, i); - const u = bi.dot(ua), - h = Si.dot(ua); - if (u >= 0 && h <= u) return t.copy(i); - const d = l * h - u * c; - if (d <= 0 && l >= 0 && u <= 0) - return (a = l / (l - u)), t.copy(n).addScaledVector(bi, a); - da.subVectors(e, s); - const f = bi.dot(da), - g = Si.dot(da); - if (g >= 0 && f <= g) return t.copy(s); - const m = f * c - l * g; - if (m <= 0 && c >= 0 && g <= 0) - return (o = c / (c - g)), t.copy(n).addScaledVector(Si, o); - const p = u * g - f * h; - if (p <= 0 && h - u >= 0 && f - g >= 0) - return ( - _l.subVectors(s, i), - (o = (h - u) / (h - u + (f - g))), - t.copy(i).addScaledVector(_l, o) - ); - const v = 1 / (p + m + d); - return ( - (a = m * v), - (o = d * v), - t.copy(n).addScaledVector(bi, a).addScaledVector(Si, o) - ); - } - equals(e) { - return e.a.equals(this.a) && e.b.equals(this.b) && e.c.equals(this.c); - } - } - let Ad = 0; - class it extends hi { - constructor() { - super(), - (this.isMaterial = !0), - Object.defineProperty(this, "id", { value: Ad++ }), - (this.uuid = Yt()), - (this.name = ""), - (this.type = "Material"), - (this.blending = zi), - (this.side = ki), - (this.vertexColors = !1), - (this.opacity = 1), - (this.transparent = !1), - (this.blendSrc = Rc), - (this.blendDst = Pc), - (this.blendEquation = Di), - (this.blendSrcAlpha = null), - (this.blendDstAlpha = null), - (this.blendEquationAlpha = null), - (this.depthFunc = Fa), - (this.depthTest = !0), - (this.depthWrite = !0), - (this.stencilWriteMask = 255), - (this.stencilFunc = nd), - (this.stencilRef = 0), - (this.stencilFuncMask = 255), - (this.stencilFail = Jr), - (this.stencilZFail = Jr), - (this.stencilZPass = Jr), - (this.stencilWrite = !1), - (this.clippingPlanes = null), - (this.clipIntersection = !1), - (this.clipShadows = !1), - (this.shadowSide = null), - (this.colorWrite = !0), - (this.precision = null), - (this.polygonOffset = !1), - (this.polygonOffsetFactor = 0), - (this.polygonOffsetUnits = 0), - (this.dithering = !1), - (this.alphaToCoverage = !1), - (this.premultipliedAlpha = !1), - (this.visible = !0), - (this.toneMapped = !0), - (this.userData = {}), - (this.version = 0), - (this._alphaTest = 0); - } - get alphaTest() { - return this._alphaTest; - } - set alphaTest(e) { - this._alphaTest > 0 != e > 0 && this.version++, (this._alphaTest = e); - } - onBuild() {} - onBeforeRender() {} - onBeforeCompile() {} - customProgramCacheKey() { - return this.onBeforeCompile.toString(); - } - setValues(e) { - if (e !== void 0) - for (const t in e) { - const n = e[t]; - if (n === void 0) { - console.warn( - "THREE.Material: '" + t + "' parameter is undefined." - ); - continue; - } - if (t === "shading") { - console.warn( - "THREE." + - this.type + - ": .shading has been removed. Use the boolean .flatShading instead." - ), - (this.flatShading = n === fu); - continue; - } - const i = this[t]; - if (i === void 0) { - console.warn( - "THREE." + - this.type + - ": '" + - t + - "' is not a property of this material." - ); - continue; - } - i && i.isColor - ? i.set(n) - : i && i.isVector3 && n && n.isVector3 - ? i.copy(n) - : (this[t] = n); - } - } - toJSON(e) { - const t = e === void 0 || typeof e == "string"; - t && (e = { textures: {}, images: {} }); - const n = { - metadata: { - version: 4.5, - type: "Material", - generator: "Material.toJSON", - }, - }; - (n.uuid = this.uuid), - (n.type = this.type), - this.name !== "" && (n.name = this.name), - this.color && this.color.isColor && (n.color = this.color.getHex()), - this.roughness !== void 0 && (n.roughness = this.roughness), - this.metalness !== void 0 && (n.metalness = this.metalness), - this.sheen !== void 0 && (n.sheen = this.sheen), - this.sheenColor && - this.sheenColor.isColor && - (n.sheenColor = this.sheenColor.getHex()), - this.sheenRoughness !== void 0 && - (n.sheenRoughness = this.sheenRoughness), - this.emissive && - this.emissive.isColor && - (n.emissive = this.emissive.getHex()), - this.emissiveIntensity && - this.emissiveIntensity !== 1 && - (n.emissiveIntensity = this.emissiveIntensity), - this.specular && - this.specular.isColor && - (n.specular = this.specular.getHex()), - this.specularIntensity !== void 0 && - (n.specularIntensity = this.specularIntensity), - this.specularColor && - this.specularColor.isColor && - (n.specularColor = this.specularColor.getHex()), - this.shininess !== void 0 && (n.shininess = this.shininess), - this.clearcoat !== void 0 && (n.clearcoat = this.clearcoat), - this.clearcoatRoughness !== void 0 && - (n.clearcoatRoughness = this.clearcoatRoughness), - this.clearcoatMap && - this.clearcoatMap.isTexture && - (n.clearcoatMap = this.clearcoatMap.toJSON(e).uuid), - this.clearcoatRoughnessMap && - this.clearcoatRoughnessMap.isTexture && - (n.clearcoatRoughnessMap = - this.clearcoatRoughnessMap.toJSON(e).uuid), - this.clearcoatNormalMap && - this.clearcoatNormalMap.isTexture && - ((n.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(e).uuid), - (n.clearcoatNormalScale = this.clearcoatNormalScale.toArray())), - this.iridescence !== void 0 && (n.iridescence = this.iridescence), - this.iridescenceIOR !== void 0 && - (n.iridescenceIOR = this.iridescenceIOR), - this.iridescenceThicknessRange !== void 0 && - (n.iridescenceThicknessRange = this.iridescenceThicknessRange), - this.iridescenceMap && - this.iridescenceMap.isTexture && - (n.iridescenceMap = this.iridescenceMap.toJSON(e).uuid), - this.iridescenceThicknessMap && - this.iridescenceThicknessMap.isTexture && - (n.iridescenceThicknessMap = - this.iridescenceThicknessMap.toJSON(e).uuid), - this.map && this.map.isTexture && (n.map = this.map.toJSON(e).uuid), - this.matcap && - this.matcap.isTexture && - (n.matcap = this.matcap.toJSON(e).uuid), - this.alphaMap && - this.alphaMap.isTexture && - (n.alphaMap = this.alphaMap.toJSON(e).uuid), - this.lightMap && - this.lightMap.isTexture && - ((n.lightMap = this.lightMap.toJSON(e).uuid), - (n.lightMapIntensity = this.lightMapIntensity)), - this.aoMap && - this.aoMap.isTexture && - ((n.aoMap = this.aoMap.toJSON(e).uuid), - (n.aoMapIntensity = this.aoMapIntensity)), - this.bumpMap && - this.bumpMap.isTexture && - ((n.bumpMap = this.bumpMap.toJSON(e).uuid), - (n.bumpScale = this.bumpScale)), - this.normalMap && - this.normalMap.isTexture && - ((n.normalMap = this.normalMap.toJSON(e).uuid), - (n.normalMapType = this.normalMapType), - (n.normalScale = this.normalScale.toArray())), - this.displacementMap && - this.displacementMap.isTexture && - ((n.displacementMap = this.displacementMap.toJSON(e).uuid), - (n.displacementScale = this.displacementScale), - (n.displacementBias = this.displacementBias)), - this.roughnessMap && - this.roughnessMap.isTexture && - (n.roughnessMap = this.roughnessMap.toJSON(e).uuid), - this.metalnessMap && - this.metalnessMap.isTexture && - (n.metalnessMap = this.metalnessMap.toJSON(e).uuid), - this.emissiveMap && - this.emissiveMap.isTexture && - (n.emissiveMap = this.emissiveMap.toJSON(e).uuid), - this.specularMap && - this.specularMap.isTexture && - (n.specularMap = this.specularMap.toJSON(e).uuid), - this.specularIntensityMap && - this.specularIntensityMap.isTexture && - (n.specularIntensityMap = - this.specularIntensityMap.toJSON(e).uuid), - this.specularColorMap && - this.specularColorMap.isTexture && - (n.specularColorMap = this.specularColorMap.toJSON(e).uuid), - this.envMap && - this.envMap.isTexture && - ((n.envMap = this.envMap.toJSON(e).uuid), - this.combine !== void 0 && (n.combine = this.combine)), - this.envMapIntensity !== void 0 && - (n.envMapIntensity = this.envMapIntensity), - this.reflectivity !== void 0 && - (n.reflectivity = this.reflectivity), - this.refractionRatio !== void 0 && - (n.refractionRatio = this.refractionRatio), - this.gradientMap && - this.gradientMap.isTexture && - (n.gradientMap = this.gradientMap.toJSON(e).uuid), - this.transmission !== void 0 && - (n.transmission = this.transmission), - this.transmissionMap && - this.transmissionMap.isTexture && - (n.transmissionMap = this.transmissionMap.toJSON(e).uuid), - this.thickness !== void 0 && (n.thickness = this.thickness), - this.thicknessMap && - this.thicknessMap.isTexture && - (n.thicknessMap = this.thicknessMap.toJSON(e).uuid), - this.attenuationDistance !== void 0 && - (n.attenuationDistance = this.attenuationDistance), - this.attenuationColor !== void 0 && - (n.attenuationColor = this.attenuationColor.getHex()), - this.size !== void 0 && (n.size = this.size), - this.shadowSide !== null && (n.shadowSide = this.shadowSide), - this.sizeAttenuation !== void 0 && - (n.sizeAttenuation = this.sizeAttenuation), - this.blending !== zi && (n.blending = this.blending), - this.side !== ki && (n.side = this.side), - this.vertexColors && (n.vertexColors = !0), - this.opacity < 1 && (n.opacity = this.opacity), - this.transparent === !0 && (n.transparent = this.transparent), - (n.depthFunc = this.depthFunc), - (n.depthTest = this.depthTest), - (n.depthWrite = this.depthWrite), - (n.colorWrite = this.colorWrite), - (n.stencilWrite = this.stencilWrite), - (n.stencilWriteMask = this.stencilWriteMask), - (n.stencilFunc = this.stencilFunc), - (n.stencilRef = this.stencilRef), - (n.stencilFuncMask = this.stencilFuncMask), - (n.stencilFail = this.stencilFail), - (n.stencilZFail = this.stencilZFail), - (n.stencilZPass = this.stencilZPass), - this.rotation !== void 0 && - this.rotation !== 0 && - (n.rotation = this.rotation), - this.polygonOffset === !0 && (n.polygonOffset = !0), - this.polygonOffsetFactor !== 0 && - (n.polygonOffsetFactor = this.polygonOffsetFactor), - this.polygonOffsetUnits !== 0 && - (n.polygonOffsetUnits = this.polygonOffsetUnits), - this.linewidth !== void 0 && - this.linewidth !== 1 && - (n.linewidth = this.linewidth), - this.dashSize !== void 0 && (n.dashSize = this.dashSize), - this.gapSize !== void 0 && (n.gapSize = this.gapSize), - this.scale !== void 0 && (n.scale = this.scale), - this.dithering === !0 && (n.dithering = !0), - this.alphaTest > 0 && (n.alphaTest = this.alphaTest), - this.alphaToCoverage === !0 && - (n.alphaToCoverage = this.alphaToCoverage), - this.premultipliedAlpha === !0 && - (n.premultipliedAlpha = this.premultipliedAlpha), - this.wireframe === !0 && (n.wireframe = this.wireframe), - this.wireframeLinewidth > 1 && - (n.wireframeLinewidth = this.wireframeLinewidth), - this.wireframeLinecap !== "round" && - (n.wireframeLinecap = this.wireframeLinecap), - this.wireframeLinejoin !== "round" && - (n.wireframeLinejoin = this.wireframeLinejoin), - this.flatShading === !0 && (n.flatShading = this.flatShading), - this.visible === !1 && (n.visible = !1), - this.toneMapped === !1 && (n.toneMapped = !1), - this.fog === !1 && (n.fog = !1), - JSON.stringify(this.userData) !== "{}" && - (n.userData = this.userData); - function i(s) { - const a = []; - for (const o in s) { - const l = s[o]; - delete l.metadata, a.push(l); - } - return a; - } - if (t) { - const s = i(e.textures), - a = i(e.images); - s.length > 0 && (n.textures = s), a.length > 0 && (n.images = a); - } - return n; - } - clone() { - return new this.constructor().copy(this); - } - copy(e) { - (this.name = e.name), - (this.blending = e.blending), - (this.side = e.side), - (this.vertexColors = e.vertexColors), - (this.opacity = e.opacity), - (this.transparent = e.transparent), - (this.blendSrc = e.blendSrc), - (this.blendDst = e.blendDst), - (this.blendEquation = e.blendEquation), - (this.blendSrcAlpha = e.blendSrcAlpha), - (this.blendDstAlpha = e.blendDstAlpha), - (this.blendEquationAlpha = e.blendEquationAlpha), - (this.depthFunc = e.depthFunc), - (this.depthTest = e.depthTest), - (this.depthWrite = e.depthWrite), - (this.stencilWriteMask = e.stencilWriteMask), - (this.stencilFunc = e.stencilFunc), - (this.stencilRef = e.stencilRef), - (this.stencilFuncMask = e.stencilFuncMask), - (this.stencilFail = e.stencilFail), - (this.stencilZFail = e.stencilZFail), - (this.stencilZPass = e.stencilZPass), - (this.stencilWrite = e.stencilWrite); - const t = e.clippingPlanes; - let n = null; - if (t !== null) { - const i = t.length; - n = new Array(i); - for (let s = 0; s !== i; ++s) n[s] = t[s].clone(); - } - return ( - (this.clippingPlanes = n), - (this.clipIntersection = e.clipIntersection), - (this.clipShadows = e.clipShadows), - (this.shadowSide = e.shadowSide), - (this.colorWrite = e.colorWrite), - (this.precision = e.precision), - (this.polygonOffset = e.polygonOffset), - (this.polygonOffsetFactor = e.polygonOffsetFactor), - (this.polygonOffsetUnits = e.polygonOffsetUnits), - (this.dithering = e.dithering), - (this.alphaTest = e.alphaTest), - (this.alphaToCoverage = e.alphaToCoverage), - (this.premultipliedAlpha = e.premultipliedAlpha), - (this.visible = e.visible), - (this.toneMapped = e.toneMapped), - (this.userData = JSON.parse(JSON.stringify(e.userData))), - this - ); - } - dispose() { - this.dispatchEvent({ type: "dispose" }); - } - set needsUpdate(e) { - e === !0 && this.version++; - } - get vertexTangents() { - return ( - console.warn( - "THREE." + this.type + ": .vertexTangents has been removed." - ), - !1 - ); - } - set vertexTangents(e) { - console.warn( - "THREE." + this.type + ": .vertexTangents has been removed." - ); - } - } - it.fromType = function () { - return null; - }; - class wn extends it { - constructor(e) { - super(), - (this.isMeshBasicMaterial = !0), - (this.type = "MeshBasicMaterial"), - (this.color = new de(16777215)), - (this.map = null), - (this.lightMap = null), - (this.lightMapIntensity = 1), - (this.aoMap = null), - (this.aoMapIntensity = 1), - (this.specularMap = null), - (this.alphaMap = null), - (this.envMap = null), - (this.combine = zr), - (this.reflectivity = 1), - (this.refractionRatio = 0.98), - (this.wireframe = !1), - (this.wireframeLinewidth = 1), - (this.wireframeLinecap = "round"), - (this.wireframeLinejoin = "round"), - (this.fog = !0), - this.setValues(e); - } - copy(e) { - return ( - super.copy(e), - this.color.copy(e.color), - (this.map = e.map), - (this.lightMap = e.lightMap), - (this.lightMapIntensity = e.lightMapIntensity), - (this.aoMap = e.aoMap), - (this.aoMapIntensity = e.aoMapIntensity), - (this.specularMap = e.specularMap), - (this.alphaMap = e.alphaMap), - (this.envMap = e.envMap), - (this.combine = e.combine), - (this.reflectivity = e.reflectivity), - (this.refractionRatio = e.refractionRatio), - (this.wireframe = e.wireframe), - (this.wireframeLinewidth = e.wireframeLinewidth), - (this.wireframeLinecap = e.wireframeLinecap), - (this.wireframeLinejoin = e.wireframeLinejoin), - (this.fog = e.fog), - this - ); - } - } - const tt = new P(), - er = new ve(); - class wt { - constructor(e, t, n) { - if (Array.isArray(e)) - throw new TypeError( - "THREE.BufferAttribute: array should be a Typed Array." - ); - (this.isBufferAttribute = !0), - (this.name = ""), - (this.array = e), - (this.itemSize = t), - (this.count = e !== void 0 ? e.length / t : 0), - (this.normalized = n === !0), - (this.usage = ka), - (this.updateRange = { offset: 0, count: -1 }), - (this.version = 0); - } - onUploadCallback() {} - set needsUpdate(e) { - e === !0 && this.version++; - } - setUsage(e) { - return (this.usage = e), this; - } - copy(e) { - return ( - (this.name = e.name), - (this.array = new e.array.constructor(e.array)), - (this.itemSize = e.itemSize), - (this.count = e.count), - (this.normalized = e.normalized), - (this.usage = e.usage), - this - ); - } - copyAt(e, t, n) { - (e *= this.itemSize), (n *= t.itemSize); - for (let i = 0, s = this.itemSize; i < s; i++) - this.array[e + i] = t.array[n + i]; - return this; - } - copyArray(e) { - return this.array.set(e), this; - } - copyColorsArray(e) { - const t = this.array; - let n = 0; - for (let i = 0, s = e.length; i < s; i++) { - let a = e[i]; - a === void 0 && - (console.warn( - "THREE.BufferAttribute.copyColorsArray(): color is undefined", - i - ), - (a = new de())), - (t[n++] = a.r), - (t[n++] = a.g), - (t[n++] = a.b); - } - return this; - } - copyVector2sArray(e) { - const t = this.array; - let n = 0; - for (let i = 0, s = e.length; i < s; i++) { - let a = e[i]; - a === void 0 && - (console.warn( - "THREE.BufferAttribute.copyVector2sArray(): vector is undefined", - i - ), - (a = new ve())), - (t[n++] = a.x), - (t[n++] = a.y); - } - return this; - } - copyVector3sArray(e) { - const t = this.array; - let n = 0; - for (let i = 0, s = e.length; i < s; i++) { - let a = e[i]; - a === void 0 && - (console.warn( - "THREE.BufferAttribute.copyVector3sArray(): vector is undefined", - i - ), - (a = new P())), - (t[n++] = a.x), - (t[n++] = a.y), - (t[n++] = a.z); - } - return this; - } - copyVector4sArray(e) { - const t = this.array; - let n = 0; - for (let i = 0, s = e.length; i < s; i++) { - let a = e[i]; - a === void 0 && - (console.warn( - "THREE.BufferAttribute.copyVector4sArray(): vector is undefined", - i - ), - (a = new Ue())), - (t[n++] = a.x), - (t[n++] = a.y), - (t[n++] = a.z), - (t[n++] = a.w); - } - return this; - } - applyMatrix3(e) { - if (this.itemSize === 2) - for (let t = 0, n = this.count; t < n; t++) - er.fromBufferAttribute(this, t), - er.applyMatrix3(e), - this.setXY(t, er.x, er.y); - else if (this.itemSize === 3) - for (let t = 0, n = this.count; t < n; t++) - tt.fromBufferAttribute(this, t), - tt.applyMatrix3(e), - this.setXYZ(t, tt.x, tt.y, tt.z); - return this; - } - applyMatrix4(e) { - for (let t = 0, n = this.count; t < n; t++) - tt.fromBufferAttribute(this, t), - tt.applyMatrix4(e), - this.setXYZ(t, tt.x, tt.y, tt.z); - return this; - } - applyNormalMatrix(e) { - for (let t = 0, n = this.count; t < n; t++) - tt.fromBufferAttribute(this, t), - tt.applyNormalMatrix(e), - this.setXYZ(t, tt.x, tt.y, tt.z); - return this; - } - transformDirection(e) { - for (let t = 0, n = this.count; t < n; t++) - tt.fromBufferAttribute(this, t), - tt.transformDirection(e), - this.setXYZ(t, tt.x, tt.y, tt.z); - return this; - } - set(e, t = 0) { - return this.array.set(e, t), this; - } - getX(e) { - return this.array[e * this.itemSize]; - } - setX(e, t) { - return (this.array[e * this.itemSize] = t), this; - } - getY(e) { - return this.array[e * this.itemSize + 1]; - } - setY(e, t) { - return (this.array[e * this.itemSize + 1] = t), this; - } - getZ(e) { - return this.array[e * this.itemSize + 2]; - } - setZ(e, t) { - return (this.array[e * this.itemSize + 2] = t), this; - } - getW(e) { - return this.array[e * this.itemSize + 3]; - } - setW(e, t) { - return (this.array[e * this.itemSize + 3] = t), this; - } - setXY(e, t, n) { - return ( - (e *= this.itemSize), - (this.array[e + 0] = t), - (this.array[e + 1] = n), - this - ); - } - setXYZ(e, t, n, i) { - return ( - (e *= this.itemSize), - (this.array[e + 0] = t), - (this.array[e + 1] = n), - (this.array[e + 2] = i), - this - ); - } - setXYZW(e, t, n, i, s) { - return ( - (e *= this.itemSize), - (this.array[e + 0] = t), - (this.array[e + 1] = n), - (this.array[e + 2] = i), - (this.array[e + 3] = s), - this - ); - } - onUpload(e) { - return (this.onUploadCallback = e), this; - } - clone() { - return new this.constructor(this.array, this.itemSize).copy(this); - } - toJSON() { - const e = { - itemSize: this.itemSize, - type: this.array.constructor.name, - array: Array.prototype.slice.call(this.array), - normalized: this.normalized, - }; - return ( - this.name !== "" && (e.name = this.name), - this.usage !== ka && (e.usage = this.usage), - (this.updateRange.offset !== 0 || this.updateRange.count !== -1) && - (e.updateRange = this.updateRange), - e - ); - } - } - class so extends wt { - constructor(e, t, n) { - super(new Uint16Array(e), t, n); - } - } - class $c extends wt { - constructor(e, t, n) { - super(new Uint32Array(e), t, n); - } - } - class Xe extends wt { - constructor(e, t, n) { - super(new Float32Array(e), t, n); - } - } - let Cd = 0; - const Dt = new pe(), - fa = new Ye(), - Ti = new P(), - Lt = new Ki(), - ps = new Ki(), - lt = new P(); - class ct extends hi { - constructor() { - super(), - (this.isBufferGeometry = !0), - Object.defineProperty(this, "id", { value: Cd++ }), - (this.uuid = Yt()), - (this.name = ""), - (this.type = "BufferGeometry"), - (this.index = null), - (this.attributes = {}), - (this.morphAttributes = {}), - (this.morphTargetsRelative = !1), - (this.groups = []), - (this.boundingBox = null), - (this.boundingSphere = null), - (this.drawRange = { start: 0, count: 1 / 0 }), - (this.userData = {}); - } - getIndex() { - return this.index; - } - setIndex(e) { - return ( - Array.isArray(e) - ? (this.index = new (Gc(e) ? $c : so)(e, 1)) - : (this.index = e), - this - ); - } - getAttribute(e) { - return this.attributes[e]; - } - setAttribute(e, t) { - return (this.attributes[e] = t), this; - } - deleteAttribute(e) { - return delete this.attributes[e], this; - } - hasAttribute(e) { - return this.attributes[e] !== void 0; - } - addGroup(e, t, n = 0) { - this.groups.push({ start: e, count: t, materialIndex: n }); - } - clearGroups() { - this.groups = []; - } - setDrawRange(e, t) { - (this.drawRange.start = e), (this.drawRange.count = t); - } - applyMatrix4(e) { - const t = this.attributes.position; - t !== void 0 && (t.applyMatrix4(e), (t.needsUpdate = !0)); - const n = this.attributes.normal; - if (n !== void 0) { - const s = new Xt().getNormalMatrix(e); - n.applyNormalMatrix(s), (n.needsUpdate = !0); - } - const i = this.attributes.tangent; - return ( - i !== void 0 && (i.transformDirection(e), (i.needsUpdate = !0)), - this.boundingBox !== null && this.computeBoundingBox(), - this.boundingSphere !== null && this.computeBoundingSphere(), - this - ); - } - applyQuaternion(e) { - return Dt.makeRotationFromQuaternion(e), this.applyMatrix4(Dt), this; - } - rotateX(e) { - return Dt.makeRotationX(e), this.applyMatrix4(Dt), this; - } - rotateY(e) { - return Dt.makeRotationY(e), this.applyMatrix4(Dt), this; - } - rotateZ(e) { - return Dt.makeRotationZ(e), this.applyMatrix4(Dt), this; - } - translate(e, t, n) { - return Dt.makeTranslation(e, t, n), this.applyMatrix4(Dt), this; - } - scale(e, t, n) { - return Dt.makeScale(e, t, n), this.applyMatrix4(Dt), this; - } - lookAt(e) { - return ( - fa.lookAt(e), fa.updateMatrix(), this.applyMatrix4(fa.matrix), this - ); - } - center() { - return ( - this.computeBoundingBox(), - this.boundingBox.getCenter(Ti).negate(), - this.translate(Ti.x, Ti.y, Ti.z), - this - ); - } - setFromPoints(e) { - const t = []; - for (let n = 0, i = e.length; n < i; n++) { - const s = e[n]; - t.push(s.x, s.y, s.z || 0); - } - return this.setAttribute("position", new Xe(t, 3)), this; - } - computeBoundingBox() { - this.boundingBox === null && (this.boundingBox = new Ki()); - const e = this.attributes.position, - t = this.morphAttributes.position; - if (e && e.isGLBufferAttribute) { - console.error( - 'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".', - this - ), - this.boundingBox.set( - new P(-1 / 0, -1 / 0, -1 / 0), - new P(1 / 0, 1 / 0, 1 / 0) - ); - return; - } - if (e !== void 0) { - if ((this.boundingBox.setFromBufferAttribute(e), t)) - for (let n = 0, i = t.length; n < i; n++) { - const s = t[n]; - Lt.setFromBufferAttribute(s), - this.morphTargetsRelative - ? (lt.addVectors(this.boundingBox.min, Lt.min), - this.boundingBox.expandByPoint(lt), - lt.addVectors(this.boundingBox.max, Lt.max), - this.boundingBox.expandByPoint(lt)) - : (this.boundingBox.expandByPoint(Lt.min), - this.boundingBox.expandByPoint(Lt.max)); - } - } else this.boundingBox.makeEmpty(); - (isNaN(this.boundingBox.min.x) || - isNaN(this.boundingBox.min.y) || - isNaN(this.boundingBox.min.z)) && - console.error( - 'THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', - this - ); - } - computeBoundingSphere() { - this.boundingSphere === null && (this.boundingSphere = new Zi()); - const e = this.attributes.position, - t = this.morphAttributes.position; - if (e && e.isGLBufferAttribute) { - console.error( - 'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".', - this - ), - this.boundingSphere.set(new P(), 1 / 0); - return; - } - if (e) { - const n = this.boundingSphere.center; - if ((Lt.setFromBufferAttribute(e), t)) - for (let s = 0, a = t.length; s < a; s++) { - const o = t[s]; - ps.setFromBufferAttribute(o), - this.morphTargetsRelative - ? (lt.addVectors(Lt.min, ps.min), - Lt.expandByPoint(lt), - lt.addVectors(Lt.max, ps.max), - Lt.expandByPoint(lt)) - : (Lt.expandByPoint(ps.min), Lt.expandByPoint(ps.max)); - } - Lt.getCenter(n); - let i = 0; - for (let s = 0, a = e.count; s < a; s++) - lt.fromBufferAttribute(e, s), - (i = Math.max(i, n.distanceToSquared(lt))); - if (t) - for (let s = 0, a = t.length; s < a; s++) { - const o = t[s], - l = this.morphTargetsRelative; - for (let c = 0, u = o.count; c < u; c++) - lt.fromBufferAttribute(o, c), - l && (Ti.fromBufferAttribute(e, c), lt.add(Ti)), - (i = Math.max(i, n.distanceToSquared(lt))); - } - (this.boundingSphere.radius = Math.sqrt(i)), - isNaN(this.boundingSphere.radius) && - console.error( - 'THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', - this - ); - } - } - computeTangents() { - const e = this.index, - t = this.attributes; - if ( - e === null || - t.position === void 0 || - t.normal === void 0 || - t.uv === void 0 - ) { - console.error( - "THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)" - ); - return; - } - const n = e.array, - i = t.position.array, - s = t.normal.array, - a = t.uv.array, - o = i.length / 3; - this.hasAttribute("tangent") === !1 && - this.setAttribute("tangent", new wt(new Float32Array(4 * o), 4)); - const l = this.getAttribute("tangent").array, - c = [], - u = []; - for (let I = 0; I < o; I++) (c[I] = new P()), (u[I] = new P()); - const h = new P(), - d = new P(), - f = new P(), - g = new ve(), - m = new ve(), - p = new ve(), - v = new P(), - M = new P(); - function x(I, F, H) { - h.fromArray(i, I * 3), - d.fromArray(i, F * 3), - f.fromArray(i, H * 3), - g.fromArray(a, I * 2), - m.fromArray(a, F * 2), - p.fromArray(a, H * 2), - d.sub(h), - f.sub(h), - m.sub(g), - p.sub(g); - const B = 1 / (m.x * p.y - p.x * m.y); - !isFinite(B) || - (v - .copy(d) - .multiplyScalar(p.y) - .addScaledVector(f, -m.y) - .multiplyScalar(B), - M.copy(f) - .multiplyScalar(m.x) - .addScaledVector(d, -p.x) - .multiplyScalar(B), - c[I].add(v), - c[F].add(v), - c[H].add(v), - u[I].add(M), - u[F].add(M), - u[H].add(M)); - } - let w = this.groups; - w.length === 0 && (w = [{ start: 0, count: n.length }]); - for (let I = 0, F = w.length; I < F; ++I) { - const H = w[I], - B = H.start, - D = H.count; - for (let z = B, N = B + D; z < N; z += 3) - x(n[z + 0], n[z + 1], n[z + 2]); - } - const y = new P(), - A = new P(), - L = new P(), - _ = new P(); - function T(I) { - L.fromArray(s, I * 3), _.copy(L); - const F = c[I]; - y.copy(F), - y.sub(L.multiplyScalar(L.dot(F))).normalize(), - A.crossVectors(_, F); - const B = A.dot(u[I]) < 0 ? -1 : 1; - (l[I * 4] = y.x), - (l[I * 4 + 1] = y.y), - (l[I * 4 + 2] = y.z), - (l[I * 4 + 3] = B); - } - for (let I = 0, F = w.length; I < F; ++I) { - const H = w[I], - B = H.start, - D = H.count; - for (let z = B, N = B + D; z < N; z += 3) - T(n[z + 0]), T(n[z + 1]), T(n[z + 2]); - } - } - computeVertexNormals() { - const e = this.index, - t = this.getAttribute("position"); - if (t !== void 0) { - let n = this.getAttribute("normal"); - if (n === void 0) - (n = new wt(new Float32Array(t.count * 3), 3)), - this.setAttribute("normal", n); - else for (let d = 0, f = n.count; d < f; d++) n.setXYZ(d, 0, 0, 0); - const i = new P(), - s = new P(), - a = new P(), - o = new P(), - l = new P(), - c = new P(), - u = new P(), - h = new P(); - if (e) - for (let d = 0, f = e.count; d < f; d += 3) { - const g = e.getX(d + 0), - m = e.getX(d + 1), - p = e.getX(d + 2); - i.fromBufferAttribute(t, g), - s.fromBufferAttribute(t, m), - a.fromBufferAttribute(t, p), - u.subVectors(a, s), - h.subVectors(i, s), - u.cross(h), - o.fromBufferAttribute(n, g), - l.fromBufferAttribute(n, m), - c.fromBufferAttribute(n, p), - o.add(u), - l.add(u), - c.add(u), - n.setXYZ(g, o.x, o.y, o.z), - n.setXYZ(m, l.x, l.y, l.z), - n.setXYZ(p, c.x, c.y, c.z); - } - else - for (let d = 0, f = t.count; d < f; d += 3) - i.fromBufferAttribute(t, d + 0), - s.fromBufferAttribute(t, d + 1), - a.fromBufferAttribute(t, d + 2), - u.subVectors(a, s), - h.subVectors(i, s), - u.cross(h), - n.setXYZ(d + 0, u.x, u.y, u.z), - n.setXYZ(d + 1, u.x, u.y, u.z), - n.setXYZ(d + 2, u.x, u.y, u.z); - this.normalizeNormals(), (n.needsUpdate = !0); - } - } - merge(e, t) { - if (!(e && e.isBufferGeometry)) { - console.error( - "THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.", - e - ); - return; - } - t === void 0 && - ((t = 0), - console.warn( - "THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge." - )); - const n = this.attributes; - for (const i in n) { - if (e.attributes[i] === void 0) continue; - const a = n[i].array, - o = e.attributes[i], - l = o.array, - c = o.itemSize * t, - u = Math.min(l.length, a.length - c); - for (let h = 0, d = c; h < u; h++, d++) a[d] = l[h]; - } - return this; - } - normalizeNormals() { - const e = this.attributes.normal; - for (let t = 0, n = e.count; t < n; t++) - lt.fromBufferAttribute(e, t), - lt.normalize(), - e.setXYZ(t, lt.x, lt.y, lt.z); - } - toNonIndexed() { - function e(o, l) { - const c = o.array, - u = o.itemSize, - h = o.normalized, - d = new c.constructor(l.length * u); - let f = 0, - g = 0; - for (let m = 0, p = l.length; m < p; m++) { - o.isInterleavedBufferAttribute - ? (f = l[m] * o.data.stride + o.offset) - : (f = l[m] * u); - for (let v = 0; v < u; v++) d[g++] = c[f++]; - } - return new wt(d, u, h); - } - if (this.index === null) - return ( - console.warn( - "THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed." - ), - this - ); - const t = new ct(), - n = this.index.array, - i = this.attributes; - for (const o in i) { - const l = i[o], - c = e(l, n); - t.setAttribute(o, c); - } - const s = this.morphAttributes; - for (const o in s) { - const l = [], - c = s[o]; - for (let u = 0, h = c.length; u < h; u++) { - const d = c[u], - f = e(d, n); - l.push(f); - } - t.morphAttributes[o] = l; - } - t.morphTargetsRelative = this.morphTargetsRelative; - const a = this.groups; - for (let o = 0, l = a.length; o < l; o++) { - const c = a[o]; - t.addGroup(c.start, c.count, c.materialIndex); - } - return t; - } - toJSON() { - const e = { - metadata: { - version: 4.5, - type: "BufferGeometry", - generator: "BufferGeometry.toJSON", - }, - }; - if ( - ((e.uuid = this.uuid), - (e.type = this.type), - this.name !== "" && (e.name = this.name), - Object.keys(this.userData).length > 0 && - (e.userData = this.userData), - this.parameters !== void 0) - ) { - const l = this.parameters; - for (const c in l) l[c] !== void 0 && (e[c] = l[c]); - return e; - } - e.data = { attributes: {} }; - const t = this.index; - t !== null && - (e.data.index = { - type: t.array.constructor.name, - array: Array.prototype.slice.call(t.array), - }); - const n = this.attributes; - for (const l in n) { - const c = n[l]; - e.data.attributes[l] = c.toJSON(e.data); - } - const i = {}; - let s = !1; - for (const l in this.morphAttributes) { - const c = this.morphAttributes[l], - u = []; - for (let h = 0, d = c.length; h < d; h++) { - const f = c[h]; - u.push(f.toJSON(e.data)); - } - u.length > 0 && ((i[l] = u), (s = !0)); - } - s && - ((e.data.morphAttributes = i), - (e.data.morphTargetsRelative = this.morphTargetsRelative)); - const a = this.groups; - a.length > 0 && (e.data.groups = JSON.parse(JSON.stringify(a))); - const o = this.boundingSphere; - return ( - o !== null && - (e.data.boundingSphere = { - center: o.center.toArray(), - radius: o.radius, - }), - e - ); - } - clone() { - return new this.constructor().copy(this); - } - copy(e) { - (this.index = null), - (this.attributes = {}), - (this.morphAttributes = {}), - (this.groups = []), - (this.boundingBox = null), - (this.boundingSphere = null); - const t = {}; - this.name = e.name; - const n = e.index; - n !== null && this.setIndex(n.clone(t)); - const i = e.attributes; - for (const c in i) { - const u = i[c]; - this.setAttribute(c, u.clone(t)); - } - const s = e.morphAttributes; - for (const c in s) { - const u = [], - h = s[c]; - for (let d = 0, f = h.length; d < f; d++) u.push(h[d].clone(t)); - this.morphAttributes[c] = u; - } - this.morphTargetsRelative = e.morphTargetsRelative; - const a = e.groups; - for (let c = 0, u = a.length; c < u; c++) { - const h = a[c]; - this.addGroup(h.start, h.count, h.materialIndex); - } - const o = e.boundingBox; - o !== null && (this.boundingBox = o.clone()); - const l = e.boundingSphere; - return ( - l !== null && (this.boundingSphere = l.clone()), - (this.drawRange.start = e.drawRange.start), - (this.drawRange.count = e.drawRange.count), - (this.userData = e.userData), - e.parameters !== void 0 && - (this.parameters = Object.assign({}, e.parameters)), - this - ); - } - dispose() { - this.dispatchEvent({ type: "dispose" }); - } - } - const xl = new pe(), - Ei = new io(), - pa = new Zi(), - Fn = new P(), - Nn = new P(), - zn = new P(), - ma = new P(), - ga = new P(), - va = new P(), - tr = new P(), - nr = new P(), - ir = new P(), - sr = new ve(), - rr = new ve(), - ar = new ve(), - _a = new P(), - or = new P(); - class Qe extends Ye { - constructor(e = new ct(), t = new wn()) { - super(), - (this.isMesh = !0), - (this.type = "Mesh"), - (this.geometry = e), - (this.material = t), - this.updateMorphTargets(); - } - copy(e, t) { - return ( - super.copy(e, t), - e.morphTargetInfluences !== void 0 && - (this.morphTargetInfluences = e.morphTargetInfluences.slice()), - e.morphTargetDictionary !== void 0 && - (this.morphTargetDictionary = Object.assign( - {}, - e.morphTargetDictionary - )), - (this.material = e.material), - (this.geometry = e.geometry), - this - ); - } - updateMorphTargets() { - const t = this.geometry.morphAttributes, - n = Object.keys(t); - if (n.length > 0) { - const i = t[n[0]]; - if (i !== void 0) { - (this.morphTargetInfluences = []), - (this.morphTargetDictionary = {}); - for (let s = 0, a = i.length; s < a; s++) { - const o = i[s].name || String(s); - this.morphTargetInfluences.push(0), - (this.morphTargetDictionary[o] = s); - } - } - } - } - raycast(e, t) { - const n = this.geometry, - i = this.material, - s = this.matrixWorld; - if ( - i === void 0 || - (n.boundingSphere === null && n.computeBoundingSphere(), - pa.copy(n.boundingSphere), - pa.applyMatrix4(s), - e.ray.intersectsSphere(pa) === !1) || - (xl.copy(s).invert(), - Ei.copy(e.ray).applyMatrix4(xl), - n.boundingBox !== null && Ei.intersectsBox(n.boundingBox) === !1) - ) - return; - let a; - const o = n.index, - l = n.attributes.position, - c = n.morphAttributes.position, - u = n.morphTargetsRelative, - h = n.attributes.uv, - d = n.attributes.uv2, - f = n.groups, - g = n.drawRange; - if (o !== null) - if (Array.isArray(i)) - for (let m = 0, p = f.length; m < p; m++) { - const v = f[m], - M = i[v.materialIndex], - x = Math.max(v.start, g.start), - w = Math.min( - o.count, - Math.min(v.start + v.count, g.start + g.count) - ); - for (let y = x, A = w; y < A; y += 3) { - const L = o.getX(y), - _ = o.getX(y + 1), - T = o.getX(y + 2); - (a = lr(this, M, e, Ei, l, c, u, h, d, L, _, T)), - a && - ((a.faceIndex = Math.floor(y / 3)), - (a.face.materialIndex = v.materialIndex), - t.push(a)); - } - } - else { - const m = Math.max(0, g.start), - p = Math.min(o.count, g.start + g.count); - for (let v = m, M = p; v < M; v += 3) { - const x = o.getX(v), - w = o.getX(v + 1), - y = o.getX(v + 2); - (a = lr(this, i, e, Ei, l, c, u, h, d, x, w, y)), - a && ((a.faceIndex = Math.floor(v / 3)), t.push(a)); - } - } - else if (l !== void 0) - if (Array.isArray(i)) - for (let m = 0, p = f.length; m < p; m++) { - const v = f[m], - M = i[v.materialIndex], - x = Math.max(v.start, g.start), - w = Math.min( - l.count, - Math.min(v.start + v.count, g.start + g.count) - ); - for (let y = x, A = w; y < A; y += 3) { - const L = y, - _ = y + 1, - T = y + 2; - (a = lr(this, M, e, Ei, l, c, u, h, d, L, _, T)), - a && - ((a.faceIndex = Math.floor(y / 3)), - (a.face.materialIndex = v.materialIndex), - t.push(a)); - } - } - else { - const m = Math.max(0, g.start), - p = Math.min(l.count, g.start + g.count); - for (let v = m, M = p; v < M; v += 3) { - const x = v, - w = v + 1, - y = v + 2; - (a = lr(this, i, e, Ei, l, c, u, h, d, x, w, y)), - a && ((a.faceIndex = Math.floor(v / 3)), t.push(a)); - } - } - } - } - function Ld(r, e, t, n, i, s, a, o) { - let l; - if ( - (e.side === qt - ? (l = n.intersectTriangle(a, s, i, !0, o)) - : (l = n.intersectTriangle(i, s, a, e.side !== cn, o)), - l === null) - ) - return null; - or.copy(o), or.applyMatrix4(r.matrixWorld); - const c = t.ray.origin.distanceTo(or); - return c < t.near || c > t.far - ? null - : { distance: c, point: or.clone(), object: r }; - } - function lr(r, e, t, n, i, s, a, o, l, c, u, h) { - Fn.fromBufferAttribute(i, c), - Nn.fromBufferAttribute(i, u), - zn.fromBufferAttribute(i, h); - const d = r.morphTargetInfluences; - if (s && d) { - tr.set(0, 0, 0), nr.set(0, 0, 0), ir.set(0, 0, 0); - for (let g = 0, m = s.length; g < m; g++) { - const p = d[g], - v = s[g]; - p !== 0 && - (ma.fromBufferAttribute(v, c), - ga.fromBufferAttribute(v, u), - va.fromBufferAttribute(v, h), - a - ? (tr.addScaledVector(ma, p), - nr.addScaledVector(ga, p), - ir.addScaledVector(va, p)) - : (tr.addScaledVector(ma.sub(Fn), p), - nr.addScaledVector(ga.sub(Nn), p), - ir.addScaledVector(va.sub(zn), p))); - } - Fn.add(tr), Nn.add(nr), zn.add(ir); - } - r.isSkinnedMesh && - (r.boneTransform(c, Fn), - r.boneTransform(u, Nn), - r.boneTransform(h, zn)); - const f = Ld(r, e, t, n, Fn, Nn, zn, _a); - if (f) { - o && - (sr.fromBufferAttribute(o, c), - rr.fromBufferAttribute(o, u), - ar.fromBufferAttribute(o, h), - (f.uv = rn.getUV(_a, Fn, Nn, zn, sr, rr, ar, new ve()))), - l && - (sr.fromBufferAttribute(l, c), - rr.fromBufferAttribute(l, u), - ar.fromBufferAttribute(l, h), - (f.uv2 = rn.getUV(_a, Fn, Nn, zn, sr, rr, ar, new ve()))); - const g = { a: c, b: u, c: h, normal: new P(), materialIndex: 0 }; - rn.getNormal(Fn, Nn, zn, g.normal), (f.face = g); - } - return f; - } - class Ns extends ct { - constructor(e = 1, t = 1, n = 1, i = 1, s = 1, a = 1) { - super(), - (this.type = "BoxGeometry"), - (this.parameters = { - width: e, - height: t, - depth: n, - widthSegments: i, - heightSegments: s, - depthSegments: a, - }); - const o = this; - (i = Math.floor(i)), (s = Math.floor(s)), (a = Math.floor(a)); - const l = [], - c = [], - u = [], - h = []; - let d = 0, - f = 0; - g("z", "y", "x", -1, -1, n, t, e, a, s, 0), - g("z", "y", "x", 1, -1, n, t, -e, a, s, 1), - g("x", "z", "y", 1, 1, e, n, t, i, a, 2), - g("x", "z", "y", 1, -1, e, n, -t, i, a, 3), - g("x", "y", "z", 1, -1, e, t, n, i, s, 4), - g("x", "y", "z", -1, -1, e, t, -n, i, s, 5), - this.setIndex(l), - this.setAttribute("position", new Xe(c, 3)), - this.setAttribute("normal", new Xe(u, 3)), - this.setAttribute("uv", new Xe(h, 2)); - function g(m, p, v, M, x, w, y, A, L, _, T) { - const I = w / L, - F = y / _, - H = w / 2, - B = y / 2, - D = A / 2, - z = L + 1, - N = _ + 1; - let k = 0, - G = 0; - const U = new P(); - for (let X = 0; X < N; X++) { - const Z = X * F - B; - for (let Y = 0; Y < z; Y++) { - const J = Y * I - H; - (U[m] = J * M), - (U[p] = Z * x), - (U[v] = D), - c.push(U.x, U.y, U.z), - (U[m] = 0), - (U[p] = 0), - (U[v] = A > 0 ? 1 : -1), - u.push(U.x, U.y, U.z), - h.push(Y / L), - h.push(1 - X / _), - (k += 1); - } - } - for (let X = 0; X < _; X++) - for (let Z = 0; Z < L; Z++) { - const Y = d + Z + z * X, - J = d + Z + z * (X + 1), - ae = d + (Z + 1) + z * (X + 1), - ue = d + (Z + 1) + z * X; - l.push(Y, J, ue), l.push(J, ae, ue), (G += 6); - } - o.addGroup(f, G, T), (f += G), (d += k); - } - } - static fromJSON(e) { - return new Ns( - e.width, - e.height, - e.depth, - e.widthSegments, - e.heightSegments, - e.depthSegments - ); - } - } - function Hi(r) { - const e = {}; - for (const t in r) { - e[t] = {}; - for (const n in r[t]) { - const i = r[t][n]; - i && - (i.isColor || - i.isMatrix3 || - i.isMatrix4 || - i.isVector2 || - i.isVector3 || - i.isVector4 || - i.isTexture || - i.isQuaternion) - ? (e[t][n] = i.clone()) - : Array.isArray(i) - ? (e[t][n] = i.slice()) - : (e[t][n] = i); - } - } - return e; - } - function pt(r) { - const e = {}; - for (let t = 0; t < r.length; t++) { - const n = Hi(r[t]); - for (const i in n) e[i] = n[i]; - } - return e; - } - const Rd = { clone: Hi, merge: pt }; - var Pd = `void main() { - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); -}`, - Dd = `void main() { - gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); -}`; - class En extends it { - constructor(e) { - super(), - (this.isShaderMaterial = !0), - (this.type = "ShaderMaterial"), - (this.defines = {}), - (this.uniforms = {}), - (this.vertexShader = Pd), - (this.fragmentShader = Dd), - (this.linewidth = 1), - (this.wireframe = !1), - (this.wireframeLinewidth = 1), - (this.fog = !1), - (this.lights = !1), - (this.clipping = !1), - (this.extensions = { - derivatives: !1, - fragDepth: !1, - drawBuffers: !1, - shaderTextureLOD: !1, - }), - (this.defaultAttributeValues = { - color: [1, 1, 1], - uv: [0, 0], - uv2: [0, 0], - }), - (this.index0AttributeName = void 0), - (this.uniformsNeedUpdate = !1), - (this.glslVersion = null), - e !== void 0 && - (e.attributes !== void 0 && - console.error( - "THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead." - ), - this.setValues(e)); - } - copy(e) { - return ( - super.copy(e), - (this.fragmentShader = e.fragmentShader), - (this.vertexShader = e.vertexShader), - (this.uniforms = Hi(e.uniforms)), - (this.defines = Object.assign({}, e.defines)), - (this.wireframe = e.wireframe), - (this.wireframeLinewidth = e.wireframeLinewidth), - (this.fog = e.fog), - (this.lights = e.lights), - (this.clipping = e.clipping), - (this.extensions = Object.assign({}, e.extensions)), - (this.glslVersion = e.glslVersion), - this - ); - } - toJSON(e) { - const t = super.toJSON(e); - (t.glslVersion = this.glslVersion), (t.uniforms = {}); - for (const i in this.uniforms) { - const a = this.uniforms[i].value; - a && a.isTexture - ? (t.uniforms[i] = { type: "t", value: a.toJSON(e).uuid }) - : a && a.isColor - ? (t.uniforms[i] = { type: "c", value: a.getHex() }) - : a && a.isVector2 - ? (t.uniforms[i] = { type: "v2", value: a.toArray() }) - : a && a.isVector3 - ? (t.uniforms[i] = { type: "v3", value: a.toArray() }) - : a && a.isVector4 - ? (t.uniforms[i] = { type: "v4", value: a.toArray() }) - : a && a.isMatrix3 - ? (t.uniforms[i] = { type: "m3", value: a.toArray() }) - : a && a.isMatrix4 - ? (t.uniforms[i] = { type: "m4", value: a.toArray() }) - : (t.uniforms[i] = { value: a }); - } - Object.keys(this.defines).length > 0 && (t.defines = this.defines), - (t.vertexShader = this.vertexShader), - (t.fragmentShader = this.fragmentShader); - const n = {}; - for (const i in this.extensions) - this.extensions[i] === !0 && (n[i] = !0); - return Object.keys(n).length > 0 && (t.extensions = n), t; - } - } - class Yc extends Ye { - constructor() { - super(), - (this.isCamera = !0), - (this.type = "Camera"), - (this.matrixWorldInverse = new pe()), - (this.projectionMatrix = new pe()), - (this.projectionMatrixInverse = new pe()); - } - copy(e, t) { - return ( - super.copy(e, t), - this.matrixWorldInverse.copy(e.matrixWorldInverse), - this.projectionMatrix.copy(e.projectionMatrix), - this.projectionMatrixInverse.copy(e.projectionMatrixInverse), - this - ); - } - getWorldDirection(e) { - this.updateWorldMatrix(!0, !1); - const t = this.matrixWorld.elements; - return e.set(-t[8], -t[9], -t[10]).normalize(); - } - updateMatrixWorld(e) { - super.updateMatrixWorld(e), - this.matrixWorldInverse.copy(this.matrixWorld).invert(); - } - updateWorldMatrix(e, t) { - super.updateWorldMatrix(e, t), - this.matrixWorldInverse.copy(this.matrixWorld).invert(); - } - clone() { - return new this.constructor().copy(this); - } - } - class mt extends Yc { - constructor(e = 50, t = 1, n = 0.1, i = 2e3) { - super(), - (this.isPerspectiveCamera = !0), - (this.type = "PerspectiveCamera"), - (this.fov = e), - (this.zoom = 1), - (this.near = n), - (this.far = i), - (this.focus = 10), - (this.aspect = t), - (this.view = null), - (this.filmGauge = 35), - (this.filmOffset = 0), - this.updateProjectionMatrix(); - } - copy(e, t) { - return ( - super.copy(e, t), - (this.fov = e.fov), - (this.zoom = e.zoom), - (this.near = e.near), - (this.far = e.far), - (this.focus = e.focus), - (this.aspect = e.aspect), - (this.view = e.view === null ? null : Object.assign({}, e.view)), - (this.filmGauge = e.filmGauge), - (this.filmOffset = e.filmOffset), - this - ); - } - setFocalLength(e) { - const t = (0.5 * this.getFilmHeight()) / e; - (this.fov = As * 2 * Math.atan(t)), this.updateProjectionMatrix(); - } - getFocalLength() { - const e = Math.tan(ys * 0.5 * this.fov); - return (0.5 * this.getFilmHeight()) / e; - } - getEffectiveFOV() { - return As * 2 * Math.atan(Math.tan(ys * 0.5 * this.fov) / this.zoom); - } - getFilmWidth() { - return this.filmGauge * Math.min(this.aspect, 1); - } - getFilmHeight() { - return this.filmGauge / Math.max(this.aspect, 1); - } - setViewOffset(e, t, n, i, s, a) { - (this.aspect = e / t), - this.view === null && - (this.view = { - enabled: !0, - fullWidth: 1, - fullHeight: 1, - offsetX: 0, - offsetY: 0, - width: 1, - height: 1, - }), - (this.view.enabled = !0), - (this.view.fullWidth = e), - (this.view.fullHeight = t), - (this.view.offsetX = n), - (this.view.offsetY = i), - (this.view.width = s), - (this.view.height = a), - this.updateProjectionMatrix(); - } - clearViewOffset() { - this.view !== null && (this.view.enabled = !1), - this.updateProjectionMatrix(); - } - updateProjectionMatrix() { - const e = this.near; - let t = (e * Math.tan(ys * 0.5 * this.fov)) / this.zoom, - n = 2 * t, - i = this.aspect * n, - s = -0.5 * i; - const a = this.view; - if (this.view !== null && this.view.enabled) { - const l = a.fullWidth, - c = a.fullHeight; - (s += (a.offsetX * i) / l), - (t -= (a.offsetY * n) / c), - (i *= a.width / l), - (n *= a.height / c); - } - const o = this.filmOffset; - o !== 0 && (s += (e * o) / this.getFilmWidth()), - this.projectionMatrix.makePerspective( - s, - s + i, - t, - t - n, - e, - this.far - ), - this.projectionMatrixInverse.copy(this.projectionMatrix).invert(); - } - toJSON(e) { - const t = super.toJSON(e); - return ( - (t.object.fov = this.fov), - (t.object.zoom = this.zoom), - (t.object.near = this.near), - (t.object.far = this.far), - (t.object.focus = this.focus), - (t.object.aspect = this.aspect), - this.view !== null && - (t.object.view = Object.assign({}, this.view)), - (t.object.filmGauge = this.filmGauge), - (t.object.filmOffset = this.filmOffset), - t - ); - } - } - const Ai = 90, - Ci = 1; - class Id extends Ye { - constructor(e, t, n) { - if ( - (super(), - (this.type = "CubeCamera"), - n.isWebGLCubeRenderTarget !== !0) - ) { - console.error( - "THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter." - ); - return; - } - this.renderTarget = n; - const i = new mt(Ai, Ci, e, t); - (i.layers = this.layers), - i.up.set(0, -1, 0), - i.lookAt(new P(1, 0, 0)), - this.add(i); - const s = new mt(Ai, Ci, e, t); - (s.layers = this.layers), - s.up.set(0, -1, 0), - s.lookAt(new P(-1, 0, 0)), - this.add(s); - const a = new mt(Ai, Ci, e, t); - (a.layers = this.layers), - a.up.set(0, 0, 1), - a.lookAt(new P(0, 1, 0)), - this.add(a); - const o = new mt(Ai, Ci, e, t); - (o.layers = this.layers), - o.up.set(0, 0, -1), - o.lookAt(new P(0, -1, 0)), - this.add(o); - const l = new mt(Ai, Ci, e, t); - (l.layers = this.layers), - l.up.set(0, -1, 0), - l.lookAt(new P(0, 0, 1)), - this.add(l); - const c = new mt(Ai, Ci, e, t); - (c.layers = this.layers), - c.up.set(0, -1, 0), - c.lookAt(new P(0, 0, -1)), - this.add(c); - } - update(e, t) { - this.parent === null && this.updateMatrixWorld(); - const n = this.renderTarget, - [i, s, a, o, l, c] = this.children, - u = e.getRenderTarget(), - h = e.toneMapping, - d = e.xr.enabled; - (e.toneMapping = $t), (e.xr.enabled = !1); - const f = n.texture.generateMipmaps; - (n.texture.generateMipmaps = !1), - e.setRenderTarget(n, 0), - e.render(t, i), - e.setRenderTarget(n, 1), - e.render(t, s), - e.setRenderTarget(n, 2), - e.render(t, a), - e.setRenderTarget(n, 3), - e.render(t, o), - e.setRenderTarget(n, 4), - e.render(t, l), - (n.texture.generateMipmaps = f), - e.setRenderTarget(n, 5), - e.render(t, c), - e.setRenderTarget(u), - (e.toneMapping = h), - (e.xr.enabled = d), - (n.texture.needsPMREMUpdate = !0); - } - } - class Kc extends nt { - constructor(e, t, n, i, s, a, o, l, c, u) { - (e = e !== void 0 ? e : []), - (t = t !== void 0 ? t : Ui), - super(e, t, n, i, s, a, o, l, c, u), - (this.isCubeTexture = !0), - (this.flipY = !1); - } - get images() { - return this.image; - } - set images(e) { - this.image = e; - } - } - class Fd extends Kt { - constructor(e, t = {}) { - super(e, e, t), (this.isWebGLCubeRenderTarget = !0); - const n = { width: e, height: e, depth: 1 }, - i = [n, n, n, n, n, n]; - (this.texture = new Kc( - i, - t.mapping, - t.wrapS, - t.wrapT, - t.magFilter, - t.minFilter, - t.format, - t.type, - t.anisotropy, - t.encoding - )), - (this.texture.isRenderTargetTexture = !0), - (this.texture.generateMipmaps = - t.generateMipmaps !== void 0 ? t.generateMipmaps : !1), - (this.texture.minFilter = - t.minFilter !== void 0 ? t.minFilter : $e); - } - fromEquirectangularTexture(e, t) { - (this.texture.type = t.type), - (this.texture.encoding = t.encoding), - (this.texture.generateMipmaps = t.generateMipmaps), - (this.texture.minFilter = t.minFilter), - (this.texture.magFilter = t.magFilter); - const n = { - uniforms: { tEquirect: { value: null } }, - vertexShader: ` - - varying vec3 vWorldDirection; - - vec3 transformDirection( in vec3 dir, in mat4 matrix ) { - - return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); - - } - - void main() { - - vWorldDirection = transformDirection( position, modelMatrix ); - - #include - #include - - } - `, - fragmentShader: ` - - uniform sampler2D tEquirect; - - varying vec3 vWorldDirection; - - #include - - void main() { - - vec3 direction = normalize( vWorldDirection ); - - vec2 sampleUV = equirectUv( direction ); - - gl_FragColor = texture2D( tEquirect, sampleUV ); - - } - `, - }, - i = new Ns(5, 5, 5), - s = new En({ - name: "CubemapFromEquirect", - uniforms: Hi(n.uniforms), - vertexShader: n.vertexShader, - fragmentShader: n.fragmentShader, - side: qt, - blending: Un, - }); - s.uniforms.tEquirect.value = t; - const a = new Qe(i, s), - o = t.minFilter; - return ( - t.minFilter === li && (t.minFilter = $e), - new Id(1, 10, this).update(e, a), - (t.minFilter = o), - a.geometry.dispose(), - a.material.dispose(), - this - ); - } - clear(e, t, n, i) { - const s = e.getRenderTarget(); - for (let a = 0; a < 6; a++) - e.setRenderTarget(this, a), e.clear(t, n, i); - e.setRenderTarget(s); - } - } - const xa = new P(), - Nd = new P(), - zd = new Xt(); - class Qn { - constructor(e = new P(1, 0, 0), t = 0) { - (this.isPlane = !0), (this.normal = e), (this.constant = t); - } - set(e, t) { - return this.normal.copy(e), (this.constant = t), this; - } - setComponents(e, t, n, i) { - return this.normal.set(e, t, n), (this.constant = i), this; - } - setFromNormalAndCoplanarPoint(e, t) { - return ( - this.normal.copy(e), (this.constant = -t.dot(this.normal)), this - ); - } - setFromCoplanarPoints(e, t, n) { - const i = xa.subVectors(n, t).cross(Nd.subVectors(e, t)).normalize(); - return this.setFromNormalAndCoplanarPoint(i, e), this; - } - copy(e) { - return this.normal.copy(e.normal), (this.constant = e.constant), this; - } - normalize() { - const e = 1 / this.normal.length(); - return this.normal.multiplyScalar(e), (this.constant *= e), this; - } - negate() { - return (this.constant *= -1), this.normal.negate(), this; - } - distanceToPoint(e) { - return this.normal.dot(e) + this.constant; - } - distanceToSphere(e) { - return this.distanceToPoint(e.center) - e.radius; - } - projectPoint(e, t) { - return t - .copy(this.normal) - .multiplyScalar(-this.distanceToPoint(e)) - .add(e); - } - intersectLine(e, t) { - const n = e.delta(xa), - i = this.normal.dot(n); - if (i === 0) - return this.distanceToPoint(e.start) === 0 ? t.copy(e.start) : null; - const s = -(e.start.dot(this.normal) + this.constant) / i; - return s < 0 || s > 1 - ? null - : t.copy(n).multiplyScalar(s).add(e.start); - } - intersectsLine(e) { - const t = this.distanceToPoint(e.start), - n = this.distanceToPoint(e.end); - return (t < 0 && n > 0) || (n < 0 && t > 0); - } - intersectsBox(e) { - return e.intersectsPlane(this); - } - intersectsSphere(e) { - return e.intersectsPlane(this); - } - coplanarPoint(e) { - return e.copy(this.normal).multiplyScalar(-this.constant); - } - applyMatrix4(e, t) { - const n = t || zd.getNormalMatrix(e), - i = this.coplanarPoint(xa).applyMatrix4(e), - s = this.normal.applyMatrix3(n).normalize(); - return (this.constant = -i.dot(s)), this; - } - translate(e) { - return (this.constant -= e.dot(this.normal)), this; - } - equals(e) { - return e.normal.equals(this.normal) && e.constant === this.constant; - } - clone() { - return new this.constructor().copy(this); - } - } - const Li = new Zi(), - cr = new P(); - class ro { - constructor( - e = new Qn(), - t = new Qn(), - n = new Qn(), - i = new Qn(), - s = new Qn(), - a = new Qn() - ) { - this.planes = [e, t, n, i, s, a]; - } - set(e, t, n, i, s, a) { - const o = this.planes; - return ( - o[0].copy(e), - o[1].copy(t), - o[2].copy(n), - o[3].copy(i), - o[4].copy(s), - o[5].copy(a), - this - ); - } - copy(e) { - const t = this.planes; - for (let n = 0; n < 6; n++) t[n].copy(e.planes[n]); - return this; - } - setFromProjectionMatrix(e) { - const t = this.planes, - n = e.elements, - i = n[0], - s = n[1], - a = n[2], - o = n[3], - l = n[4], - c = n[5], - u = n[6], - h = n[7], - d = n[8], - f = n[9], - g = n[10], - m = n[11], - p = n[12], - v = n[13], - M = n[14], - x = n[15]; - return ( - t[0].setComponents(o - i, h - l, m - d, x - p).normalize(), - t[1].setComponents(o + i, h + l, m + d, x + p).normalize(), - t[2].setComponents(o + s, h + c, m + f, x + v).normalize(), - t[3].setComponents(o - s, h - c, m - f, x - v).normalize(), - t[4].setComponents(o - a, h - u, m - g, x - M).normalize(), - t[5].setComponents(o + a, h + u, m + g, x + M).normalize(), - this - ); - } - intersectsObject(e) { - const t = e.geometry; - return ( - t.boundingSphere === null && t.computeBoundingSphere(), - Li.copy(t.boundingSphere).applyMatrix4(e.matrixWorld), - this.intersectsSphere(Li) - ); - } - intersectsSprite(e) { - return ( - Li.center.set(0, 0, 0), - (Li.radius = 0.7071067811865476), - Li.applyMatrix4(e.matrixWorld), - this.intersectsSphere(Li) - ); - } - intersectsSphere(e) { - const t = this.planes, - n = e.center, - i = -e.radius; - for (let s = 0; s < 6; s++) - if (t[s].distanceToPoint(n) < i) return !1; - return !0; - } - intersectsBox(e) { - const t = this.planes; - for (let n = 0; n < 6; n++) { - const i = t[n]; - if ( - ((cr.x = i.normal.x > 0 ? e.max.x : e.min.x), - (cr.y = i.normal.y > 0 ? e.max.y : e.min.y), - (cr.z = i.normal.z > 0 ? e.max.z : e.min.z), - i.distanceToPoint(cr) < 0) - ) - return !1; - } - return !0; - } - containsPoint(e) { - const t = this.planes; - for (let n = 0; n < 6; n++) - if (t[n].distanceToPoint(e) < 0) return !1; - return !0; - } - clone() { - return new this.constructor().copy(this); - } - } - function Zc() { - let r = null, - e = !1, - t = null, - n = null; - function i(s, a) { - t(s, a), (n = r.requestAnimationFrame(i)); - } - return { - start: function () { - e !== !0 && - t !== null && - ((n = r.requestAnimationFrame(i)), (e = !0)); - }, - stop: function () { - r.cancelAnimationFrame(n), (e = !1); - }, - setAnimationLoop: function (s) { - t = s; - }, - setContext: function (s) { - r = s; - }, - }; - } - function Od(r, e) { - const t = e.isWebGL2, - n = new WeakMap(); - function i(c, u) { - const h = c.array, - d = c.usage, - f = r.createBuffer(); - r.bindBuffer(u, f), r.bufferData(u, h, d), c.onUploadCallback(); - let g; - if (h instanceof Float32Array) g = 5126; - else if (h instanceof Uint16Array) - if (c.isFloat16BufferAttribute) - if (t) g = 5131; - else - throw new Error( - "THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2." - ); - else g = 5123; - else if (h instanceof Int16Array) g = 5122; - else if (h instanceof Uint32Array) g = 5125; - else if (h instanceof Int32Array) g = 5124; - else if (h instanceof Int8Array) g = 5120; - else if (h instanceof Uint8Array) g = 5121; - else if (h instanceof Uint8ClampedArray) g = 5121; - else - throw new Error( - "THREE.WebGLAttributes: Unsupported buffer data format: " + h - ); - return { - buffer: f, - type: g, - bytesPerElement: h.BYTES_PER_ELEMENT, - version: c.version, - }; - } - function s(c, u, h) { - const d = u.array, - f = u.updateRange; - r.bindBuffer(h, c), - f.count === -1 - ? r.bufferSubData(h, 0, d) - : (t - ? r.bufferSubData( - h, - f.offset * d.BYTES_PER_ELEMENT, - d, - f.offset, - f.count - ) - : r.bufferSubData( - h, - f.offset * d.BYTES_PER_ELEMENT, - d.subarray(f.offset, f.offset + f.count) - ), - (f.count = -1)); - } - function a(c) { - return c.isInterleavedBufferAttribute && (c = c.data), n.get(c); - } - function o(c) { - c.isInterleavedBufferAttribute && (c = c.data); - const u = n.get(c); - u && (r.deleteBuffer(u.buffer), n.delete(c)); - } - function l(c, u) { - if (c.isGLBufferAttribute) { - const d = n.get(c); - (!d || d.version < c.version) && - n.set(c, { - buffer: c.buffer, - type: c.type, - bytesPerElement: c.elementSize, - version: c.version, - }); - return; - } - c.isInterleavedBufferAttribute && (c = c.data); - const h = n.get(c); - h === void 0 - ? n.set(c, i(c, u)) - : h.version < c.version && - (s(h.buffer, c, u), (h.version = c.version)); - } - return { get: a, remove: o, update: l }; - } - class Gn extends ct { - constructor(e = 1, t = 1, n = 1, i = 1) { - super(), - (this.type = "PlaneGeometry"), - (this.parameters = { - width: e, - height: t, - widthSegments: n, - heightSegments: i, - }); - const s = e / 2, - a = t / 2, - o = Math.floor(n), - l = Math.floor(i), - c = o + 1, - u = l + 1, - h = e / o, - d = t / l, - f = [], - g = [], - m = [], - p = []; - for (let v = 0; v < u; v++) { - const M = v * d - a; - for (let x = 0; x < c; x++) { - const w = x * h - s; - g.push(w, -M, 0), - m.push(0, 0, 1), - p.push(x / o), - p.push(1 - v / l); - } - } - for (let v = 0; v < l; v++) - for (let M = 0; M < o; M++) { - const x = M + c * v, - w = M + c * (v + 1), - y = M + 1 + c * (v + 1), - A = M + 1 + c * v; - f.push(x, w, A), f.push(w, y, A); - } - this.setIndex(f), - this.setAttribute("position", new Xe(g, 3)), - this.setAttribute("normal", new Xe(m, 3)), - this.setAttribute("uv", new Xe(p, 2)); - } - static fromJSON(e) { - return new Gn(e.width, e.height, e.widthSegments, e.heightSegments); - } - } - var kd = `#ifdef USE_ALPHAMAP - diffuseColor.a *= texture2D( alphaMap, vUv ).g; -#endif`, - Ud = `#ifdef USE_ALPHAMAP - uniform sampler2D alphaMap; -#endif`, - Bd = `#ifdef USE_ALPHATEST - if ( diffuseColor.a < alphaTest ) discard; -#endif`, - Vd = `#ifdef USE_ALPHATEST - uniform float alphaTest; -#endif`, - Gd = `#ifdef USE_AOMAP - float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0; - reflectedLight.indirectDiffuse *= ambientOcclusion; - #if defined( USE_ENVMAP ) && defined( STANDARD ) - float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) ); - reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); - #endif -#endif`, - Hd = `#ifdef USE_AOMAP - uniform sampler2D aoMap; - uniform float aoMapIntensity; -#endif`, - Wd = "vec3 transformed = vec3( position );", - jd = `vec3 objectNormal = vec3( normal ); -#ifdef USE_TANGENT - vec3 objectTangent = vec3( tangent.xyz ); -#endif`, - Xd = `vec3 BRDF_Lambert( const in vec3 diffuseColor ) { - return RECIPROCAL_PI * diffuseColor; -} -vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { - float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); - return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} -float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { - float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); - return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} -vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { - float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); - float x2 = x * x; - float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); - return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); -} -float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { - float a2 = pow2( alpha ); - float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); - float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); - return 0.5 / max( gv + gl, EPSILON ); -} -float D_GGX( const in float alpha, const in float dotNH ) { - float a2 = pow2( alpha ); - float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; - return RECIPROCAL_PI * a2 / pow2( denom ); -} -vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) { - float alpha = pow2( roughness ); - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - float dotNH = saturate( dot( normal, halfDir ) ); - float dotVH = saturate( dot( viewDir, halfDir ) ); - vec3 F = F_Schlick( f0, f90, dotVH ); - float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); - float D = D_GGX( alpha, dotNH ); - return F * ( V * D ); -} -#ifdef USE_IRIDESCENCE -vec3 BRDF_GGX_Iridescence( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float iridescence, const in vec3 iridescenceFresnel, const in float roughness ) { - float alpha = pow2( roughness ); - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - float dotNH = saturate( dot( normal, halfDir ) ); - float dotVH = saturate( dot( viewDir, halfDir ) ); - vec3 F = mix(F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence); - float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); - float D = D_GGX( alpha, dotNH ); - return F * ( V * D ); -} -#endif -vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { - const float LUT_SIZE = 64.0; - const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; - const float LUT_BIAS = 0.5 / LUT_SIZE; - float dotNV = saturate( dot( N, V ) ); - vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); - uv = uv * LUT_SCALE + LUT_BIAS; - return uv; -} -float LTC_ClippedSphereFormFactor( const in vec3 f ) { - float l = length( f ); - return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); -} -vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { - float x = dot( v1, v2 ); - float y = abs( x ); - float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; - float b = 3.4175940 + ( 4.1616724 + y ) * y; - float v = a / b; - float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; - return cross( v1, v2 ) * theta_sintheta; -} -vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { - vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; - vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; - vec3 lightNormal = cross( v1, v2 ); - if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); - vec3 T1, T2; - T1 = normalize( V - N * dot( V, N ) ); - T2 = - cross( N, T1 ); - mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); - vec3 coords[ 4 ]; - coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); - coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); - coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); - coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); - coords[ 0 ] = normalize( coords[ 0 ] ); - coords[ 1 ] = normalize( coords[ 1 ] ); - coords[ 2 ] = normalize( coords[ 2 ] ); - coords[ 3 ] = normalize( coords[ 3 ] ); - vec3 vectorFormFactor = vec3( 0.0 ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); - float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); - return vec3( result ); -} -float G_BlinnPhong_Implicit( ) { - return 0.25; -} -float D_BlinnPhong( const in float shininess, const in float dotNH ) { - return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); -} -vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNH = saturate( dot( normal, halfDir ) ); - float dotVH = saturate( dot( viewDir, halfDir ) ); - vec3 F = F_Schlick( specularColor, 1.0, dotVH ); - float G = G_BlinnPhong_Implicit( ); - float D = D_BlinnPhong( shininess, dotNH ); - return F * ( G * D ); -} -#if defined( USE_SHEEN ) -float D_Charlie( float roughness, float dotNH ) { - float alpha = pow2( roughness ); - float invAlpha = 1.0 / alpha; - float cos2h = dotNH * dotNH; - float sin2h = max( 1.0 - cos2h, 0.0078125 ); - return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); -} -float V_Neubelt( float dotNV, float dotNL ) { - return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); -} -vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - float dotNH = saturate( dot( normal, halfDir ) ); - float D = D_Charlie( sheenRoughness, dotNH ); - float V = V_Neubelt( dotNV, dotNL ); - return sheenColor * ( D * V ); -} -#endif`, - qd = `#ifdef USE_IRIDESCENCE -const mat3 XYZ_TO_REC709 = mat3( - 3.2404542, -0.9692660, 0.0556434, - -1.5371385, 1.8760108, -0.2040259, - -0.4985314, 0.0415560, 1.0572252 -); -vec3 Fresnel0ToIor( vec3 fresnel0 ) { - vec3 sqrtF0 = sqrt( fresnel0 ); - return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); -} -vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { - return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); -} -float IorToFresnel0( float transmittedIor, float incidentIor ) { - return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); -} -vec3 evalSensitivity( float OPD, vec3 shift ) { - float phase = 2.0 * PI * OPD * 1.0e-9; - vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); - vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); - vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); - vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( -pow2( phase ) * var ); - xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[0] ) * exp( -4.5282e+09 * pow2( phase ) ); - xyz /= 1.0685e-7; - vec3 srgb = XYZ_TO_REC709 * xyz; - return srgb; -} -vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { - vec3 I; - float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); - float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); - float cosTheta2Sq = 1.0 - sinTheta2Sq; - if ( cosTheta2Sq < 0.0 ) { - return vec3( 1.0 ); - } - float cosTheta2 = sqrt( cosTheta2Sq ); - float R0 = IorToFresnel0( iridescenceIOR, outsideIOR ); - float R12 = F_Schlick( R0, 1.0, cosTheta1 ); - float R21 = R12; - float T121 = 1.0 - R12; - float phi12 = 0.0; - if ( iridescenceIOR < outsideIOR ) phi12 = PI; - float phi21 = PI - phi12; - vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); - vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); - vec3 phi23 = vec3( 0.0 ); - if ( baseIOR[0] < iridescenceIOR ) phi23[0] = PI; - if ( baseIOR[1] < iridescenceIOR ) phi23[1] = PI; - if ( baseIOR[2] < iridescenceIOR ) phi23[2] = PI; - float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; - vec3 phi = vec3( phi21 ) + phi23; - vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); - vec3 r123 = sqrt( R123 ); - vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); - vec3 C0 = R12 + Rs; - I = C0; - vec3 Cm = Rs - T121; - for ( int m = 1; m <= 2; ++m ) { - Cm *= r123; - vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); - I += Cm * Sm; - } - return max( I, vec3( 0.0 ) ); -} -#endif`, - $d = `#ifdef USE_BUMPMAP - uniform sampler2D bumpMap; - uniform float bumpScale; - vec2 dHdxy_fwd() { - vec2 dSTdx = dFdx( vUv ); - vec2 dSTdy = dFdy( vUv ); - float Hll = bumpScale * texture2D( bumpMap, vUv ).x; - float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll; - float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll; - return vec2( dBx, dBy ); - } - vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { - vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) ); - vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) ); - vec3 vN = surf_norm; - vec3 R1 = cross( vSigmaY, vN ); - vec3 R2 = cross( vN, vSigmaX ); - float fDet = dot( vSigmaX, R1 ) * faceDirection; - vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); - return normalize( abs( fDet ) * surf_norm - vGrad ); - } -#endif`, - Yd = `#if NUM_CLIPPING_PLANES > 0 - vec4 plane; - #pragma unroll_loop_start - for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; - } - #pragma unroll_loop_end - #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES - bool clipped = true; - #pragma unroll_loop_start - for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; - } - #pragma unroll_loop_end - if ( clipped ) discard; - #endif -#endif`, - Kd = `#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; - uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`, - Zd = `#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; -#endif`, - Jd = `#if NUM_CLIPPING_PLANES > 0 - vClipPosition = - mvPosition.xyz; -#endif`, - Qd = `#if defined( USE_COLOR_ALPHA ) - diffuseColor *= vColor; -#elif defined( USE_COLOR ) - diffuseColor.rgb *= vColor; -#endif`, - ef = `#if defined( USE_COLOR_ALPHA ) - varying vec4 vColor; -#elif defined( USE_COLOR ) - varying vec3 vColor; -#endif`, - tf = `#if defined( USE_COLOR_ALPHA ) - varying vec4 vColor; -#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) - varying vec3 vColor; -#endif`, - nf = `#if defined( USE_COLOR_ALPHA ) - vColor = vec4( 1.0 ); -#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) - vColor = vec3( 1.0 ); -#endif -#ifdef USE_COLOR - vColor *= color; -#endif -#ifdef USE_INSTANCING_COLOR - vColor.xyz *= instanceColor.xyz; -#endif`, - sf = `#define PI 3.141592653589793 -#define PI2 6.283185307179586 -#define PI_HALF 1.5707963267948966 -#define RECIPROCAL_PI 0.3183098861837907 -#define RECIPROCAL_PI2 0.15915494309189535 -#define EPSILON 1e-6 -#ifndef saturate -#define saturate( a ) clamp( a, 0.0, 1.0 ) -#endif -#define whiteComplement( a ) ( 1.0 - saturate( a ) ) -float pow2( const in float x ) { return x*x; } -vec3 pow2( const in vec3 x ) { return x*x; } -float pow3( const in float x ) { return x*x*x; } -float pow4( const in float x ) { float x2 = x*x; return x2*x2; } -float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } -float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); } -highp float rand( const in vec2 uv ) { - const highp float a = 12.9898, b = 78.233, c = 43758.5453; - highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); - return fract( sin( sn ) * c ); -} -#ifdef HIGH_PRECISION - float precisionSafeLength( vec3 v ) { return length( v ); } -#else - float precisionSafeLength( vec3 v ) { - float maxComponent = max3( abs( v ) ); - return length( v / maxComponent ) * maxComponent; - } -#endif -struct IncidentLight { - vec3 color; - vec3 direction; - bool visible; -}; -struct ReflectedLight { - vec3 directDiffuse; - vec3 directSpecular; - vec3 indirectDiffuse; - vec3 indirectSpecular; -}; -struct GeometricContext { - vec3 position; - vec3 normal; - vec3 viewDir; -#ifdef USE_CLEARCOAT - vec3 clearcoatNormal; -#endif -}; -vec3 transformDirection( in vec3 dir, in mat4 matrix ) { - return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); -} -vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { - return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); -} -mat3 transposeMat3( const in mat3 m ) { - mat3 tmp; - tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); - tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); - tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); - return tmp; -} -float linearToRelativeLuminance( const in vec3 color ) { - vec3 weights = vec3( 0.2126, 0.7152, 0.0722 ); - return dot( weights, color.rgb ); -} -bool isPerspectiveMatrix( mat4 m ) { - return m[ 2 ][ 3 ] == - 1.0; -} -vec2 equirectUv( in vec3 dir ) { - float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; - float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; - return vec2( u, v ); -}`, - rf = `#ifdef ENVMAP_TYPE_CUBE_UV - #define cubeUV_minMipLevel 4.0 - #define cubeUV_minTileSize 16.0 - float getFace( vec3 direction ) { - vec3 absDirection = abs( direction ); - float face = - 1.0; - if ( absDirection.x > absDirection.z ) { - if ( absDirection.x > absDirection.y ) - face = direction.x > 0.0 ? 0.0 : 3.0; - else - face = direction.y > 0.0 ? 1.0 : 4.0; - } else { - if ( absDirection.z > absDirection.y ) - face = direction.z > 0.0 ? 2.0 : 5.0; - else - face = direction.y > 0.0 ? 1.0 : 4.0; - } - return face; - } - vec2 getUV( vec3 direction, float face ) { - vec2 uv; - if ( face == 0.0 ) { - uv = vec2( direction.z, direction.y ) / abs( direction.x ); - } else if ( face == 1.0 ) { - uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); - } else if ( face == 2.0 ) { - uv = vec2( - direction.x, direction.y ) / abs( direction.z ); - } else if ( face == 3.0 ) { - uv = vec2( - direction.z, direction.y ) / abs( direction.x ); - } else if ( face == 4.0 ) { - uv = vec2( - direction.x, direction.z ) / abs( direction.y ); - } else { - uv = vec2( direction.x, direction.y ) / abs( direction.z ); - } - return 0.5 * ( uv + 1.0 ); - } - vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { - float face = getFace( direction ); - float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); - mipInt = max( mipInt, cubeUV_minMipLevel ); - float faceSize = exp2( mipInt ); - vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; - if ( face > 2.0 ) { - uv.y += faceSize; - face -= 3.0; - } - uv.x += face * faceSize; - uv.x += filterInt * 3.0 * cubeUV_minTileSize; - uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); - uv.x *= CUBEUV_TEXEL_WIDTH; - uv.y *= CUBEUV_TEXEL_HEIGHT; - #ifdef texture2DGradEXT - return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; - #else - return texture2D( envMap, uv ).rgb; - #endif - } - #define r0 1.0 - #define v0 0.339 - #define m0 - 2.0 - #define r1 0.8 - #define v1 0.276 - #define m1 - 1.0 - #define r4 0.4 - #define v4 0.046 - #define m4 2.0 - #define r5 0.305 - #define v5 0.016 - #define m5 3.0 - #define r6 0.21 - #define v6 0.0038 - #define m6 4.0 - float roughnessToMip( float roughness ) { - float mip = 0.0; - if ( roughness >= r1 ) { - mip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0; - } else if ( roughness >= r4 ) { - mip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1; - } else if ( roughness >= r5 ) { - mip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4; - } else if ( roughness >= r6 ) { - mip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5; - } else { - mip = - 2.0 * log2( 1.16 * roughness ); } - return mip; - } - vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { - float mip = clamp( roughnessToMip( roughness ), m0, CUBEUV_MAX_MIP ); - float mipF = fract( mip ); - float mipInt = floor( mip ); - vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); - if ( mipF == 0.0 ) { - return vec4( color0, 1.0 ); - } else { - vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); - return vec4( mix( color0, color1, mipF ), 1.0 ); - } - } -#endif`, - af = `vec3 transformedNormal = objectNormal; -#ifdef USE_INSTANCING - mat3 m = mat3( instanceMatrix ); - transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); - transformedNormal = m * transformedNormal; -#endif -transformedNormal = normalMatrix * transformedNormal; -#ifdef FLIP_SIDED - transformedNormal = - transformedNormal; -#endif -#ifdef USE_TANGENT - vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; - #ifdef FLIP_SIDED - transformedTangent = - transformedTangent; - #endif -#endif`, - of = `#ifdef USE_DISPLACEMENTMAP - uniform sampler2D displacementMap; - uniform float displacementScale; - uniform float displacementBias; -#endif`, - lf = `#ifdef USE_DISPLACEMENTMAP - transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias ); -#endif`, - cf = `#ifdef USE_EMISSIVEMAP - vec4 emissiveColor = texture2D( emissiveMap, vUv ); - totalEmissiveRadiance *= emissiveColor.rgb; -#endif`, - hf = `#ifdef USE_EMISSIVEMAP - uniform sampler2D emissiveMap; -#endif`, - uf = "gl_FragColor = linearToOutputTexel( gl_FragColor );", - df = `vec4 LinearToLinear( in vec4 value ) { - return value; -} -vec4 LinearTosRGB( in vec4 value ) { - return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); -}`, - ff = `#ifdef USE_ENVMAP - #ifdef ENV_WORLDPOS - vec3 cameraToFrag; - if ( isOrthographic ) { - cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); - } else { - cameraToFrag = normalize( vWorldPosition - cameraPosition ); - } - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - #ifdef ENVMAP_MODE_REFLECTION - vec3 reflectVec = reflect( cameraToFrag, worldNormal ); - #else - vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); - #endif - #else - vec3 reflectVec = vReflect; - #endif - #ifdef ENVMAP_TYPE_CUBE - vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); - #elif defined( ENVMAP_TYPE_CUBE_UV ) - vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 ); - #else - vec4 envColor = vec4( 0.0 ); - #endif - #ifdef ENVMAP_BLENDING_MULTIPLY - outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); - #elif defined( ENVMAP_BLENDING_MIX ) - outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); - #elif defined( ENVMAP_BLENDING_ADD ) - outgoingLight += envColor.xyz * specularStrength * reflectivity; - #endif -#endif`, - pf = `#ifdef USE_ENVMAP - uniform float envMapIntensity; - uniform float flipEnvMap; - #ifdef ENVMAP_TYPE_CUBE - uniform samplerCube envMap; - #else - uniform sampler2D envMap; - #endif - -#endif`, - mf = `#ifdef USE_ENVMAP - uniform float reflectivity; - #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) - #define ENV_WORLDPOS - #endif - #ifdef ENV_WORLDPOS - varying vec3 vWorldPosition; - uniform float refractionRatio; - #else - varying vec3 vReflect; - #endif -#endif`, - gf = `#ifdef USE_ENVMAP - #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG ) - #define ENV_WORLDPOS - #endif - #ifdef ENV_WORLDPOS - - varying vec3 vWorldPosition; - #else - varying vec3 vReflect; - uniform float refractionRatio; - #endif -#endif`, - vf = `#ifdef USE_ENVMAP - #ifdef ENV_WORLDPOS - vWorldPosition = worldPosition.xyz; - #else - vec3 cameraToVertex; - if ( isOrthographic ) { - cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); - } else { - cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); - } - vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); - #ifdef ENVMAP_MODE_REFLECTION - vReflect = reflect( cameraToVertex, worldNormal ); - #else - vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); - #endif - #endif -#endif`, - _f = `#ifdef USE_FOG - vFogDepth = - mvPosition.z; -#endif`, - xf = `#ifdef USE_FOG - varying float vFogDepth; -#endif`, - yf = `#ifdef USE_FOG - #ifdef FOG_EXP2 - float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); - #else - float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); - #endif - gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); -#endif`, - Mf = `#ifdef USE_FOG - uniform vec3 fogColor; - varying float vFogDepth; - #ifdef FOG_EXP2 - uniform float fogDensity; - #else - uniform float fogNear; - uniform float fogFar; - #endif -#endif`, - wf = `#ifdef USE_GRADIENTMAP - uniform sampler2D gradientMap; -#endif -vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { - float dotNL = dot( normal, lightDirection ); - vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); - #ifdef USE_GRADIENTMAP - return vec3( texture2D( gradientMap, coord ).r ); - #else - return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 ); - #endif -}`, - bf = `#ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vUv2 ); - vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; - reflectedLight.indirectDiffuse += lightMapIrradiance; -#endif`, - Sf = `#ifdef USE_LIGHTMAP - uniform sampler2D lightMap; - uniform float lightMapIntensity; -#endif`, - Tf = `vec3 diffuse = vec3( 1.0 ); -GeometricContext geometry; -geometry.position = mvPosition.xyz; -geometry.normal = normalize( transformedNormal ); -geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz ); -GeometricContext backGeometry; -backGeometry.position = geometry.position; -backGeometry.normal = -geometry.normal; -backGeometry.viewDir = geometry.viewDir; -vLightFront = vec3( 0.0 ); -vIndirectFront = vec3( 0.0 ); -#ifdef DOUBLE_SIDED - vLightBack = vec3( 0.0 ); - vIndirectBack = vec3( 0.0 ); -#endif -IncidentLight directLight; -float dotNL; -vec3 directLightColor_Diffuse; -vIndirectFront += getAmbientLightIrradiance( ambientLightColor ); -vIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal ); -#ifdef DOUBLE_SIDED - vIndirectBack += getAmbientLightIrradiance( ambientLightColor ); - vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal ); -#endif -#if NUM_POINT_LIGHTS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { - getPointLightInfo( pointLights[ i ], geometry, directLight ); - dotNL = dot( geometry.normal, directLight.direction ); - directLightColor_Diffuse = directLight.color; - vLightFront += saturate( dotNL ) * directLightColor_Diffuse; - #ifdef DOUBLE_SIDED - vLightBack += saturate( - dotNL ) * directLightColor_Diffuse; - #endif - } - #pragma unroll_loop_end -#endif -#if NUM_SPOT_LIGHTS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { - getSpotLightInfo( spotLights[ i ], geometry, directLight ); - dotNL = dot( geometry.normal, directLight.direction ); - directLightColor_Diffuse = directLight.color; - vLightFront += saturate( dotNL ) * directLightColor_Diffuse; - #ifdef DOUBLE_SIDED - vLightBack += saturate( - dotNL ) * directLightColor_Diffuse; - #endif - } - #pragma unroll_loop_end -#endif -#if NUM_DIR_LIGHTS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { - getDirectionalLightInfo( directionalLights[ i ], geometry, directLight ); - dotNL = dot( geometry.normal, directLight.direction ); - directLightColor_Diffuse = directLight.color; - vLightFront += saturate( dotNL ) * directLightColor_Diffuse; - #ifdef DOUBLE_SIDED - vLightBack += saturate( - dotNL ) * directLightColor_Diffuse; - #endif - } - #pragma unroll_loop_end -#endif -#if NUM_HEMI_LIGHTS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { - vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); - #ifdef DOUBLE_SIDED - vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal ); - #endif - } - #pragma unroll_loop_end -#endif`, - Ef = `uniform bool receiveShadow; -uniform vec3 ambientLightColor; -uniform vec3 lightProbe[ 9 ]; -vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { - float x = normal.x, y = normal.y, z = normal.z; - vec3 result = shCoefficients[ 0 ] * 0.886227; - result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; - result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; - result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; - result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; - result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; - result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); - result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; - result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); - return result; -} -vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); - return irradiance; -} -vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { - vec3 irradiance = ambientLightColor; - return irradiance; -} -float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { - #if defined ( PHYSICALLY_CORRECT_LIGHTS ) - float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); - if ( cutoffDistance > 0.0 ) { - distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); - } - return distanceFalloff; - #else - if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { - return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); - } - return 1.0; - #endif -} -float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { - return smoothstep( coneCosine, penumbraCosine, angleCosine ); -} -#if NUM_DIR_LIGHTS > 0 - struct DirectionalLight { - vec3 direction; - vec3 color; - }; - uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; - void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) { - light.color = directionalLight.color; - light.direction = directionalLight.direction; - light.visible = true; - } -#endif -#if NUM_POINT_LIGHTS > 0 - struct PointLight { - vec3 position; - vec3 color; - float distance; - float decay; - }; - uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; - void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) { - vec3 lVector = pointLight.position - geometry.position; - light.direction = normalize( lVector ); - float lightDistance = length( lVector ); - light.color = pointLight.color; - light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); - light.visible = ( light.color != vec3( 0.0 ) ); - } -#endif -#if NUM_SPOT_LIGHTS > 0 - struct SpotLight { - vec3 position; - vec3 direction; - vec3 color; - float distance; - float decay; - float coneCos; - float penumbraCos; - }; - uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; - void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) { - vec3 lVector = spotLight.position - geometry.position; - light.direction = normalize( lVector ); - float angleCos = dot( light.direction, spotLight.direction ); - float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); - if ( spotAttenuation > 0.0 ) { - float lightDistance = length( lVector ); - light.color = spotLight.color * spotAttenuation; - light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); - light.visible = ( light.color != vec3( 0.0 ) ); - } else { - light.color = vec3( 0.0 ); - light.visible = false; - } - } -#endif -#if NUM_RECT_AREA_LIGHTS > 0 - struct RectAreaLight { - vec3 color; - vec3 position; - vec3 halfWidth; - vec3 halfHeight; - }; - uniform sampler2D ltc_1; uniform sampler2D ltc_2; - uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; -#endif -#if NUM_HEMI_LIGHTS > 0 - struct HemisphereLight { - vec3 direction; - vec3 skyColor; - vec3 groundColor; - }; - uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; - vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { - float dotNL = dot( normal, hemiLight.direction ); - float hemiDiffuseWeight = 0.5 * dotNL + 0.5; - vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); - return irradiance; - } -#endif`, - Af = `#if defined( USE_ENVMAP ) - vec3 getIBLIrradiance( const in vec3 normal ) { - #if defined( ENVMAP_TYPE_CUBE_UV ) - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); - return PI * envMapColor.rgb * envMapIntensity; - #else - return vec3( 0.0 ); - #endif - } - vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { - #if defined( ENVMAP_TYPE_CUBE_UV ) - vec3 reflectVec = reflect( - viewDir, normal ); - reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); - reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); - vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); - return envMapColor.rgb * envMapIntensity; - #else - return vec3( 0.0 ); - #endif - } -#endif`, - Cf = `ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`, - Lf = `varying vec3 vViewPosition; -struct ToonMaterial { - vec3 diffuseColor; -}; -void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { - vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_Toon -#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon -#define Material_LightProbeLOD( material ) (0)`, - Rf = `BlinnPhongMaterial material; -material.diffuseColor = diffuseColor.rgb; -material.specularColor = specular; -material.specularShininess = shininess; -material.specularStrength = specularStrength;`, - Pf = `varying vec3 vViewPosition; -struct BlinnPhongMaterial { - vec3 diffuseColor; - vec3 specularColor; - float specularShininess; - float specularStrength; -}; -void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); - reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength; -} -void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_BlinnPhong -#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong -#define Material_LightProbeLOD( material ) (0)`, - Df = `PhysicalMaterial material; -material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); -vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) ); -float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); -material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; -material.roughness = min( material.roughness, 1.0 ); -#ifdef IOR - #ifdef SPECULAR - float specularIntensityFactor = specularIntensity; - vec3 specularColorFactor = specularColor; - #ifdef USE_SPECULARINTENSITYMAP - specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a; - #endif - #ifdef USE_SPECULARCOLORMAP - specularColorFactor *= texture2D( specularColorMap, vUv ).rgb; - #endif - material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); - #else - float specularIntensityFactor = 1.0; - vec3 specularColorFactor = vec3( 1.0 ); - material.specularF90 = 1.0; - #endif - material.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); -#else - material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); - material.specularF90 = 1.0; -#endif -#ifdef USE_CLEARCOAT - material.clearcoat = clearcoat; - material.clearcoatRoughness = clearcoatRoughness; - material.clearcoatF0 = vec3( 0.04 ); - material.clearcoatF90 = 1.0; - #ifdef USE_CLEARCOATMAP - material.clearcoat *= texture2D( clearcoatMap, vUv ).x; - #endif - #ifdef USE_CLEARCOAT_ROUGHNESSMAP - material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y; - #endif - material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); - material.clearcoatRoughness += geometryRoughness; - material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); -#endif -#ifdef USE_IRIDESCENCE - material.iridescence = iridescence; - material.iridescenceIOR = iridescenceIOR; - #ifdef USE_IRIDESCENCEMAP - material.iridescence *= texture2D( iridescenceMap, vUv ).r; - #endif - #ifdef USE_IRIDESCENCE_THICKNESSMAP - material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum; - #else - material.iridescenceThickness = iridescenceThicknessMaximum; - #endif -#endif -#ifdef USE_SHEEN - material.sheenColor = sheenColor; - #ifdef USE_SHEENCOLORMAP - material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb; - #endif - material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); - #ifdef USE_SHEENROUGHNESSMAP - material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a; - #endif -#endif`, - If = `struct PhysicalMaterial { - vec3 diffuseColor; - float roughness; - vec3 specularColor; - float specularF90; - #ifdef USE_CLEARCOAT - float clearcoat; - float clearcoatRoughness; - vec3 clearcoatF0; - float clearcoatF90; - #endif - #ifdef USE_IRIDESCENCE - float iridescence; - float iridescenceIOR; - float iridescenceThickness; - vec3 iridescenceFresnel; - vec3 iridescenceF0; - #endif - #ifdef USE_SHEEN - vec3 sheenColor; - float sheenRoughness; - #endif -}; -vec3 clearcoatSpecular = vec3( 0.0 ); -vec3 sheenSpecular = vec3( 0.0 ); -float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) { - float dotNV = saturate( dot( normal, viewDir ) ); - float r2 = roughness * roughness; - float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; - float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; - float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); - return saturate( DG * RECIPROCAL_PI ); -} -vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { - float dotNV = saturate( dot( normal, viewDir ) ); - const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); - const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); - vec4 r = roughness * c0 + c1; - float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; - vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; - return fab; -} -vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { - vec2 fab = DFGApprox( normal, viewDir, roughness ); - return specularColor * fab.x + specularF90 * fab.y; -} -#ifdef USE_IRIDESCENCE -void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { -#else -void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { -#endif - vec2 fab = DFGApprox( normal, viewDir, roughness ); - #ifdef USE_IRIDESCENCE - vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); - #else - vec3 Fr = specularColor; - #endif - vec3 FssEss = Fr * fab.x + specularF90 * fab.y; - float Ess = fab.x + fab.y; - float Ems = 1.0 - Ess; - vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); - singleScatter += FssEss; - multiScatter += Fms * Ems; -} -#if NUM_RECT_AREA_LIGHTS > 0 - void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - vec3 normal = geometry.normal; - vec3 viewDir = geometry.viewDir; - vec3 position = geometry.position; - vec3 lightPos = rectAreaLight.position; - vec3 halfWidth = rectAreaLight.halfWidth; - vec3 halfHeight = rectAreaLight.halfHeight; - vec3 lightColor = rectAreaLight.color; - float roughness = material.roughness; - vec3 rectCoords[ 4 ]; - rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; - rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; - rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; - vec2 uv = LTC_Uv( normal, viewDir, roughness ); - vec4 t1 = texture2D( ltc_1, uv ); - vec4 t2 = texture2D( ltc_2, uv ); - mat3 mInv = mat3( - vec3( t1.x, 0, t1.y ), - vec3( 0, 1, 0 ), - vec3( t1.z, 0, t1.w ) - ); - vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); - reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); - reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); - } -#endif -void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - #ifdef USE_CLEARCOAT - float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) ); - vec3 ccIrradiance = dotNLcc * directLight.color; - clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); - #endif - #ifdef USE_SHEEN - sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness ); - #endif - #ifdef USE_IRIDESCENCE - reflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness ); - #else - reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness ); - #endif - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { - #ifdef USE_CLEARCOAT - clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); - #endif - #ifdef USE_SHEEN - sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness ); - #endif - vec3 singleScattering = vec3( 0.0 ); - vec3 multiScattering = vec3( 0.0 ); - vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; - #ifdef USE_IRIDESCENCE - computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); - #else - computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); - #endif - vec3 totalScattering = singleScattering + multiScattering; - vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); - reflectedLight.indirectSpecular += radiance * singleScattering; - reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; - reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; -} -#define RE_Direct RE_Direct_Physical -#define RE_Direct_RectArea RE_Direct_RectArea_Physical -#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical -#define RE_IndirectSpecular RE_IndirectSpecular_Physical -float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { - return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); -}`, - Ff = ` -GeometricContext geometry; -geometry.position = - vViewPosition; -geometry.normal = normal; -geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); -#ifdef USE_CLEARCOAT - geometry.clearcoatNormal = clearcoatNormal; -#endif -#ifdef USE_IRIDESCENCE -float dotNVi = saturate( dot( normal, geometry.viewDir ) ); -if ( material.iridescenceThickness == 0.0 ) { - material.iridescence = 0.0; -} else { - material.iridescence = saturate( material.iridescence ); -} -if ( material.iridescence > 0.0 ) { - material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); - material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); -} -#endif -IncidentLight directLight; -#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) - PointLight pointLight; - #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 - PointLightShadow pointLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { - pointLight = pointLights[ i ]; - getPointLightInfo( pointLight, geometry, directLight ); - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) - pointLightShadow = pointLightShadows[ i ]; - directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; - #endif - RE_Direct( directLight, geometry, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) - SpotLight spotLight; - #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 - SpotLightShadow spotLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { - spotLight = spotLights[ i ]; - getSpotLightInfo( spotLight, geometry, directLight ); - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - spotLightShadow = spotLightShadows[ i ]; - directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; - #endif - RE_Direct( directLight, geometry, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) - DirectionalLight directionalLight; - #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 - DirectionalLightShadow directionalLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { - directionalLight = directionalLights[ i ]; - getDirectionalLightInfo( directionalLight, geometry, directLight ); - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) - directionalLightShadow = directionalLightShadows[ i ]; - directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - #endif - RE_Direct( directLight, geometry, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) - RectAreaLight rectAreaLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { - rectAreaLight = rectAreaLights[ i ]; - RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if defined( RE_IndirectDiffuse ) - vec3 iblIrradiance = vec3( 0.0 ); - vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); - irradiance += getLightProbeIrradiance( lightProbe, geometry.normal ); - #if ( NUM_HEMI_LIGHTS > 0 ) - #pragma unroll_loop_start - for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { - irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); - } - #pragma unroll_loop_end - #endif -#endif -#if defined( RE_IndirectSpecular ) - vec3 radiance = vec3( 0.0 ); - vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`, - Nf = `#if defined( RE_IndirectDiffuse ) - #ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vUv2 ); - vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; - irradiance += lightMapIrradiance; - #endif - #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) - iblIrradiance += getIBLIrradiance( geometry.normal ); - #endif -#endif -#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) - radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness ); - #ifdef USE_CLEARCOAT - clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness ); - #endif -#endif`, - zf = `#if defined( RE_IndirectDiffuse ) - RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); -#endif -#if defined( RE_IndirectSpecular ) - RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); -#endif`, - Of = `#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) - gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`, - kf = `#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) - uniform float logDepthBufFC; - varying float vFragDepth; - varying float vIsPerspective; -#endif`, - Uf = `#ifdef USE_LOGDEPTHBUF - #ifdef USE_LOGDEPTHBUF_EXT - varying float vFragDepth; - varying float vIsPerspective; - #else - uniform float logDepthBufFC; - #endif -#endif`, - Bf = `#ifdef USE_LOGDEPTHBUF - #ifdef USE_LOGDEPTHBUF_EXT - vFragDepth = 1.0 + gl_Position.w; - vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); - #else - if ( isPerspectiveMatrix( projectionMatrix ) ) { - gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; - gl_Position.z *= gl_Position.w; - } - #endif -#endif`, - Vf = `#ifdef USE_MAP - vec4 sampledDiffuseColor = texture2D( map, vUv ); - #ifdef DECODE_VIDEO_TEXTURE - sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); - #endif - diffuseColor *= sampledDiffuseColor; -#endif`, - Gf = `#ifdef USE_MAP - uniform sampler2D map; -#endif`, - Hf = `#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) - vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; -#endif -#ifdef USE_MAP - diffuseColor *= texture2D( map, uv ); -#endif -#ifdef USE_ALPHAMAP - diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`, - Wf = `#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) - uniform mat3 uvTransform; -#endif -#ifdef USE_MAP - uniform sampler2D map; -#endif -#ifdef USE_ALPHAMAP - uniform sampler2D alphaMap; -#endif`, - jf = `float metalnessFactor = metalness; -#ifdef USE_METALNESSMAP - vec4 texelMetalness = texture2D( metalnessMap, vUv ); - metalnessFactor *= texelMetalness.b; -#endif`, - Xf = `#ifdef USE_METALNESSMAP - uniform sampler2D metalnessMap; -#endif`, - qf = `#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) - vColor *= morphTargetBaseInfluence; - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - #if defined( USE_COLOR_ALPHA ) - if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; - #elif defined( USE_COLOR ) - if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; - #endif - } -#endif`, - $f = `#ifdef USE_MORPHNORMALS - objectNormal *= morphTargetBaseInfluence; - #ifdef MORPHTARGETS_TEXTURE - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; - } - #else - objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; - objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; - objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; - objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; - #endif -#endif`, - Yf = `#ifdef USE_MORPHTARGETS - uniform float morphTargetBaseInfluence; - #ifdef MORPHTARGETS_TEXTURE - uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; - uniform sampler2DArray morphTargetsTexture; - uniform ivec2 morphTargetsTextureSize; - vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { - int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; - int y = texelIndex / morphTargetsTextureSize.x; - int x = texelIndex - y * morphTargetsTextureSize.x; - ivec3 morphUV = ivec3( x, y, morphTargetIndex ); - return texelFetch( morphTargetsTexture, morphUV, 0 ); - } - #else - #ifndef USE_MORPHNORMALS - uniform float morphTargetInfluences[ 8 ]; - #else - uniform float morphTargetInfluences[ 4 ]; - #endif - #endif -#endif`, - Kf = `#ifdef USE_MORPHTARGETS - transformed *= morphTargetBaseInfluence; - #ifdef MORPHTARGETS_TEXTURE - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; - } - #else - transformed += morphTarget0 * morphTargetInfluences[ 0 ]; - transformed += morphTarget1 * morphTargetInfluences[ 1 ]; - transformed += morphTarget2 * morphTargetInfluences[ 2 ]; - transformed += morphTarget3 * morphTargetInfluences[ 3 ]; - #ifndef USE_MORPHNORMALS - transformed += morphTarget4 * morphTargetInfluences[ 4 ]; - transformed += morphTarget5 * morphTargetInfluences[ 5 ]; - transformed += morphTarget6 * morphTargetInfluences[ 6 ]; - transformed += morphTarget7 * morphTargetInfluences[ 7 ]; - #endif - #endif -#endif`, - Zf = `float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; -#ifdef FLAT_SHADED - vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) ); - vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) ); - vec3 normal = normalize( cross( fdx, fdy ) ); -#else - vec3 normal = normalize( vNormal ); - #ifdef DOUBLE_SIDED - normal = normal * faceDirection; - #endif - #ifdef USE_TANGENT - vec3 tangent = normalize( vTangent ); - vec3 bitangent = normalize( vBitangent ); - #ifdef DOUBLE_SIDED - tangent = tangent * faceDirection; - bitangent = bitangent * faceDirection; - #endif - #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP ) - mat3 vTBN = mat3( tangent, bitangent, normal ); - #endif - #endif -#endif -vec3 geometryNormal = normal;`, - Jf = `#ifdef OBJECTSPACE_NORMALMAP - normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; - #ifdef FLIP_SIDED - normal = - normal; - #endif - #ifdef DOUBLE_SIDED - normal = normal * faceDirection; - #endif - normal = normalize( normalMatrix * normal ); -#elif defined( TANGENTSPACE_NORMALMAP ) - vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; - mapN.xy *= normalScale; - #ifdef USE_TANGENT - normal = normalize( vTBN * mapN ); - #else - normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection ); - #endif -#elif defined( USE_BUMPMAP ) - normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`, - Qf = `#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`, - ep = `#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`, - tp = `#ifndef FLAT_SHADED - vNormal = normalize( transformedNormal ); - #ifdef USE_TANGENT - vTangent = normalize( transformedTangent ); - vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); - #endif -#endif`, - np = `#ifdef USE_NORMALMAP - uniform sampler2D normalMap; - uniform vec2 normalScale; -#endif -#ifdef OBJECTSPACE_NORMALMAP - uniform mat3 normalMatrix; -#endif -#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) ) - vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) { - vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) ); - vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) ); - vec2 st0 = dFdx( vUv.st ); - vec2 st1 = dFdy( vUv.st ); - vec3 N = surf_norm; - vec3 q1perp = cross( q1, N ); - vec3 q0perp = cross( N, q0 ); - vec3 T = q1perp * st0.x + q0perp * st1.x; - vec3 B = q1perp * st0.y + q0perp * st1.y; - float det = max( dot( T, T ), dot( B, B ) ); - float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det ); - return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z ); - } -#endif`, - ip = `#ifdef USE_CLEARCOAT - vec3 clearcoatNormal = geometryNormal; -#endif`, - sp = `#ifdef USE_CLEARCOAT_NORMALMAP - vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0; - clearcoatMapN.xy *= clearcoatNormalScale; - #ifdef USE_TANGENT - clearcoatNormal = normalize( vTBN * clearcoatMapN ); - #else - clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection ); - #endif -#endif`, - rp = `#ifdef USE_CLEARCOATMAP - uniform sampler2D clearcoatMap; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - uniform sampler2D clearcoatRoughnessMap; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - uniform sampler2D clearcoatNormalMap; - uniform vec2 clearcoatNormalScale; -#endif`, - ap = `#ifdef USE_IRIDESCENCEMAP - uniform sampler2D iridescenceMap; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - uniform sampler2D iridescenceThicknessMap; -#endif`, - op = `#ifdef OPAQUE -diffuseColor.a = 1.0; -#endif -#ifdef USE_TRANSMISSION -diffuseColor.a *= transmissionAlpha + 0.1; -#endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`, - lp = `vec3 packNormalToRGB( const in vec3 normal ) { - return normalize( normal ) * 0.5 + 0.5; -} -vec3 unpackRGBToNormal( const in vec3 rgb ) { - return 2.0 * rgb.xyz - 1.0; -} -const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; -const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); -const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); -const float ShiftRight8 = 1. / 256.; -vec4 packDepthToRGBA( const in float v ) { - vec4 r = vec4( fract( v * PackFactors ), v ); - r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; -} -float unpackRGBAToDepth( const in vec4 v ) { - return dot( v, UnpackFactors ); -} -vec4 pack2HalfToRGBA( vec2 v ) { - vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); - return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); -} -vec2 unpackRGBATo2Half( vec4 v ) { - return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); -} -float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { - return ( viewZ + near ) / ( near - far ); -} -float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) { - return linearClipZ * ( near - far ) - near; -} -float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { - return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); -} -float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) { - return ( near * far ) / ( ( far - near ) * invClipZ - far ); -}`, - cp = `#ifdef PREMULTIPLIED_ALPHA - gl_FragColor.rgb *= gl_FragColor.a; -#endif`, - hp = `vec4 mvPosition = vec4( transformed, 1.0 ); -#ifdef USE_INSTANCING - mvPosition = instanceMatrix * mvPosition; -#endif -mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`, - up = `#ifdef DITHERING - gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`, - dp = `#ifdef DITHERING - vec3 dithering( vec3 color ) { - float grid_position = rand( gl_FragCoord.xy ); - vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); - dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); - return color + dither_shift_RGB; - } -#endif`, - fp = `float roughnessFactor = roughness; -#ifdef USE_ROUGHNESSMAP - vec4 texelRoughness = texture2D( roughnessMap, vUv ); - roughnessFactor *= texelRoughness.g; -#endif`, - pp = `#ifdef USE_ROUGHNESSMAP - uniform sampler2D roughnessMap; -#endif`, - mp = `#ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; - varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; - struct DirectionalLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; - varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ]; - struct SpotLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; - varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; - struct PointLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - float shadowCameraNear; - float shadowCameraFar; - }; - uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; - #endif - float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { - return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); - } - vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { - return unpackRGBATo2Half( texture2D( shadow, uv ) ); - } - float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ - float occlusion = 1.0; - vec2 distribution = texture2DDistribution( shadow, uv ); - float hard_shadow = step( compare , distribution.x ); - if (hard_shadow != 1.0 ) { - float distance = compare - distribution.x ; - float variance = max( 0.00000, distribution.y * distribution.y ); - float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); - } - return occlusion; - } - float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { - float shadow = 1.0; - shadowCoord.xyz /= shadowCoord.w; - shadowCoord.z += shadowBias; - bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 ); - bool inFrustum = all( inFrustumVec ); - bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 ); - bool frustumTest = all( frustumTestVec ); - if ( frustumTest ) { - #if defined( SHADOWMAP_TYPE_PCF ) - vec2 texelSize = vec2( 1.0 ) / shadowMapSize; - float dx0 = - texelSize.x * shadowRadius; - float dy0 = - texelSize.y * shadowRadius; - float dx1 = + texelSize.x * shadowRadius; - float dy1 = + texelSize.y * shadowRadius; - float dx2 = dx0 / 2.0; - float dy2 = dy0 / 2.0; - float dx3 = dx1 / 2.0; - float dy3 = dy1 / 2.0; - shadow = ( - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) - ) * ( 1.0 / 17.0 ); - #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) - vec2 texelSize = vec2( 1.0 ) / shadowMapSize; - float dx = texelSize.x; - float dy = texelSize.y; - vec2 uv = shadowCoord.xy; - vec2 f = fract( uv * shadowMapSize + 0.5 ); - uv -= f * texelSize; - shadow = ( - texture2DCompare( shadowMap, uv, shadowCoord.z ) + - texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + - texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + - mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), - f.x ) + - mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), - f.x ) + - mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), - f.y ) + - mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), - f.y ) + - mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), - f.x ), - mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), - f.x ), - f.y ) - ) * ( 1.0 / 9.0 ); - #elif defined( SHADOWMAP_TYPE_VSM ) - shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); - #else - shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); - #endif - } - return shadow; - } - vec2 cubeToUV( vec3 v, float texelSizeY ) { - vec3 absV = abs( v ); - float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); - absV *= scaleToCube; - v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); - vec2 planar = v.xy; - float almostATexel = 1.5 * texelSizeY; - float almostOne = 1.0 - almostATexel; - if ( absV.z >= almostOne ) { - if ( v.z > 0.0 ) - planar.x = 4.0 - v.x; - } else if ( absV.x >= almostOne ) { - float signX = sign( v.x ); - planar.x = v.z * signX + 2.0 * signX; - } else if ( absV.y >= almostOne ) { - float signY = sign( v.y ); - planar.x = v.x + 2.0 * signY + 2.0; - planar.y = v.z * signY - 2.0; - } - return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); - } - float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { - vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); - vec3 lightToPosition = shadowCoord.xyz; - float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; - vec3 bd3D = normalize( lightToPosition ); - #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) - vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; - return ( - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) - ) * ( 1.0 / 9.0 ); - #else - return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); - #endif - } -#endif`, - gp = `#ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; - varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; - struct DirectionalLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ]; - varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ]; - struct SpotLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; - varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; - struct PointLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - float shadowCameraNear; - float shadowCameraFar; - }; - uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; - #endif -#endif`, - vp = `#ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 - vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); - vec4 shadowWorldPosition; - #endif - #if NUM_DIR_LIGHT_SHADOWS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { - shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); - vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; - } - #pragma unroll_loop_end - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { - shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 ); - vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition; - } - #pragma unroll_loop_end - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { - shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); - vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; - } - #pragma unroll_loop_end - #endif -#endif`, - _p = `float getShadowMask() { - float shadow = 1.0; - #ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - DirectionalLightShadow directionalLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { - directionalLight = directionalLightShadows[ i ]; - shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - } - #pragma unroll_loop_end - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - SpotLightShadow spotLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { - spotLight = spotLightShadows[ i ]; - shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; - } - #pragma unroll_loop_end - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - PointLightShadow pointLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { - pointLight = pointLightShadows[ i ]; - shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; - } - #pragma unroll_loop_end - #endif - #endif - return shadow; -}`, - xp = `#ifdef USE_SKINNING - mat4 boneMatX = getBoneMatrix( skinIndex.x ); - mat4 boneMatY = getBoneMatrix( skinIndex.y ); - mat4 boneMatZ = getBoneMatrix( skinIndex.z ); - mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`, - yp = `#ifdef USE_SKINNING - uniform mat4 bindMatrix; - uniform mat4 bindMatrixInverse; - uniform highp sampler2D boneTexture; - uniform int boneTextureSize; - mat4 getBoneMatrix( const in float i ) { - float j = i * 4.0; - float x = mod( j, float( boneTextureSize ) ); - float y = floor( j / float( boneTextureSize ) ); - float dx = 1.0 / float( boneTextureSize ); - float dy = 1.0 / float( boneTextureSize ); - y = dy * ( y + 0.5 ); - vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) ); - vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) ); - vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) ); - vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) ); - mat4 bone = mat4( v1, v2, v3, v4 ); - return bone; - } -#endif`, - Mp = `#ifdef USE_SKINNING - vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); - vec4 skinned = vec4( 0.0 ); - skinned += boneMatX * skinVertex * skinWeight.x; - skinned += boneMatY * skinVertex * skinWeight.y; - skinned += boneMatZ * skinVertex * skinWeight.z; - skinned += boneMatW * skinVertex * skinWeight.w; - transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`, - wp = `#ifdef USE_SKINNING - mat4 skinMatrix = mat4( 0.0 ); - skinMatrix += skinWeight.x * boneMatX; - skinMatrix += skinWeight.y * boneMatY; - skinMatrix += skinWeight.z * boneMatZ; - skinMatrix += skinWeight.w * boneMatW; - skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; - objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; - #ifdef USE_TANGENT - objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; - #endif -#endif`, - bp = `float specularStrength; -#ifdef USE_SPECULARMAP - vec4 texelSpecular = texture2D( specularMap, vUv ); - specularStrength = texelSpecular.r; -#else - specularStrength = 1.0; -#endif`, - Sp = `#ifdef USE_SPECULARMAP - uniform sampler2D specularMap; -#endif`, - Tp = `#if defined( TONE_MAPPING ) - gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`, - Ep = `#ifndef saturate -#define saturate( a ) clamp( a, 0.0, 1.0 ) -#endif -uniform float toneMappingExposure; -vec3 LinearToneMapping( vec3 color ) { - return toneMappingExposure * color; -} -vec3 ReinhardToneMapping( vec3 color ) { - color *= toneMappingExposure; - return saturate( color / ( vec3( 1.0 ) + color ) ); -} -vec3 OptimizedCineonToneMapping( vec3 color ) { - color *= toneMappingExposure; - color = max( vec3( 0.0 ), color - 0.004 ); - return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); -} -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 ACESFilmicToneMapping( vec3 color ) { - 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 ) - ); - color *= toneMappingExposure / 0.6; - color = ACESInputMat * color; - color = RRTAndODTFit( color ); - color = ACESOutputMat * color; - return saturate( color ); -} -vec3 CustomToneMapping( vec3 color ) { return color; }`, - Ap = `#ifdef USE_TRANSMISSION - float transmissionAlpha = 1.0; - float transmissionFactor = transmission; - float thicknessFactor = thickness; - #ifdef USE_TRANSMISSIONMAP - transmissionFactor *= texture2D( transmissionMap, vUv ).r; - #endif - #ifdef USE_THICKNESSMAP - thicknessFactor *= texture2D( thicknessMap, vUv ).g; - #endif - vec3 pos = vWorldPosition; - vec3 v = normalize( cameraPosition - pos ); - vec3 n = inverseTransformDirection( normal, viewMatrix ); - vec4 transmission = getIBLVolumeRefraction( - n, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90, - pos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor, - attenuationColor, attenuationDistance ); - totalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor ); - transmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor ); -#endif`, - Cp = `#ifdef USE_TRANSMISSION - uniform float transmission; - uniform float thickness; - uniform float attenuationDistance; - uniform vec3 attenuationColor; - #ifdef USE_TRANSMISSIONMAP - uniform sampler2D transmissionMap; - #endif - #ifdef USE_THICKNESSMAP - uniform sampler2D thicknessMap; - #endif - uniform vec2 transmissionSamplerSize; - uniform sampler2D transmissionSamplerMap; - uniform mat4 modelMatrix; - uniform mat4 projectionMatrix; - varying vec3 vWorldPosition; - vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { - vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); - vec3 modelScale; - modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); - modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); - modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); - return normalize( refractionVector ) * thickness * modelScale; - } - float applyIorToRoughness( const in float roughness, const in float ior ) { - return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); - } - vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { - float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); - #ifdef texture2DLodEXT - return texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod ); - #else - return texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod ); - #endif - } - vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { - if ( attenuationDistance == 0.0 ) { - return radiance; - } else { - vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; - vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance * radiance; - } - } - vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, - const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, - const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, - const in vec3 attenuationColor, const in float attenuationDistance ) { - vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); - vec3 refractedRayExit = position + transmissionRay; - vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); - vec2 refractionCoords = ndcPos.xy / ndcPos.w; - refractionCoords += 1.0; - refractionCoords /= 2.0; - vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); - vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance ); - vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); - return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a ); - } -#endif`, - Lp = `#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) ) - varying vec2 vUv; -#endif`, - Rp = `#ifdef USE_UV - #ifdef UVS_VERTEX_ONLY - vec2 vUv; - #else - varying vec2 vUv; - #endif - uniform mat3 uvTransform; -#endif`, - Pp = `#ifdef USE_UV - vUv = ( uvTransform * vec3( uv, 1 ) ).xy; -#endif`, - Dp = `#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) - varying vec2 vUv2; -#endif`, - Ip = `#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) - attribute vec2 uv2; - varying vec2 vUv2; - uniform mat3 uv2Transform; -#endif`, - Fp = `#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) - vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy; -#endif`, - Np = `#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) - vec4 worldPosition = vec4( transformed, 1.0 ); - #ifdef USE_INSTANCING - worldPosition = instanceMatrix * worldPosition; - #endif - worldPosition = modelMatrix * worldPosition; -#endif`; - const zp = `varying vec2 vUv; -uniform mat3 uvTransform; -void main() { - vUv = ( uvTransform * vec3( uv, 1 ) ).xy; - gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`, - Op = `uniform sampler2D t2D; -varying vec2 vUv; -void main() { - gl_FragColor = texture2D( t2D, vUv ); - #ifdef DECODE_VIDEO_TEXTURE - gl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w ); - #endif - #include - #include -}`, - kp = `varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include - gl_Position.z = gl_Position.w; -}`, - Up = `#include -uniform float opacity; -varying vec3 vWorldDirection; -#include -void main() { - vec3 vReflect = vWorldDirection; - #include - gl_FragColor = envColor; - gl_FragColor.a *= opacity; - #include - #include -}`, - Bp = `#include -#include -#include -#include -#include -#include -#include -varying vec2 vHighPrecisionZW; -void main() { - #include - #include - #ifdef USE_DISPLACEMENTMAP - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - vHighPrecisionZW = gl_Position.zw; -}`, - Vp = `#if DEPTH_PACKING == 3200 - uniform float opacity; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -varying vec2 vHighPrecisionZW; -void main() { - #include - vec4 diffuseColor = vec4( 1.0 ); - #if DEPTH_PACKING == 3200 - diffuseColor.a = opacity; - #endif - #include - #include - #include - #include - float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; - #if DEPTH_PACKING == 3200 - gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); - #elif DEPTH_PACKING == 3201 - gl_FragColor = packDepthToRGBA( fragCoordZ ); - #endif -}`, - Gp = `#define DISTANCE -varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #ifdef USE_DISPLACEMENTMAP - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - vWorldPosition = worldPosition.xyz; -}`, - Hp = `#define DISTANCE -uniform vec3 referencePosition; -uniform float nearDistance; -uniform float farDistance; -varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -#include -void main () { - #include - vec4 diffuseColor = vec4( 1.0 ); - #include - #include - #include - float dist = length( vWorldPosition - referencePosition ); - dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); - dist = saturate( dist ); - gl_FragColor = packDepthToRGBA( dist ); -}`, - Wp = `varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include -}`, - jp = `uniform sampler2D tEquirect; -varying vec3 vWorldDirection; -#include -void main() { - vec3 direction = normalize( vWorldDirection ); - vec2 sampleUV = equirectUv( direction ); - gl_FragColor = texture2D( tEquirect, sampleUV ); - #include - #include -}`, - Xp = `uniform float scale; -attribute float lineDistance; -varying float vLineDistance; -#include -#include -#include -#include -#include -#include -void main() { - vLineDistance = scale * lineDistance; - #include - #include - #include - #include - #include - #include - #include - #include -}`, - qp = `uniform vec3 diffuse; -uniform float opacity; -uniform float dashSize; -uniform float totalSize; -varying float vLineDistance; -#include -#include -#include -#include -#include -void main() { - #include - if ( mod( vLineDistance, totalSize ) > dashSize ) { - discard; - } - vec3 outgoingLight = vec3( 0.0 ); - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include - #include -}`, - $p = `#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) - #include - #include - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`, - Yp = `uniform vec3 diffuse; -uniform float opacity; -#ifndef FLAT_SHADED - varying vec3 vNormal; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - #ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vUv2 ); - reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; - #else - reflectedLight.indirectDiffuse += vec3( 1.0 ); - #endif - #include - reflectedLight.indirectDiffuse *= diffuseColor.rgb; - vec3 outgoingLight = reflectedLight.indirectDiffuse; - #include - #include - #include - #include - #include - #include - #include -}`, - Kp = `#define LAMBERT -varying vec3 vLightFront; -varying vec3 vIndirectFront; -#ifdef DOUBLE_SIDED - varying vec3 vLightBack; - varying vec3 vIndirectBack; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`, - Zp = `uniform vec3 diffuse; -uniform vec3 emissive; -uniform float opacity; -varying vec3 vLightFront; -varying vec3 vIndirectFront; -#ifdef DOUBLE_SIDED - varying vec3 vLightBack; - varying vec3 vIndirectBack; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #ifdef DOUBLE_SIDED - reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack; - #else - reflectedLight.indirectDiffuse += vIndirectFront; - #endif - #include - reflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb ); - #ifdef DOUBLE_SIDED - reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack; - #else - reflectedLight.directDiffuse = vLightFront; - #endif - reflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask(); - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include - #include -}`, - Jp = `#define MATCAP -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; -}`, - Qp = `#define MATCAP -uniform vec3 diffuse; -uniform float opacity; -uniform sampler2D matcap; -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - #include - #include - vec3 viewDir = normalize( vViewPosition ); - vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); - vec3 y = cross( viewDir, x ); - vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; - #ifdef USE_MATCAP - vec4 matcapColor = texture2D( matcap, uv ); - #else - vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); - #endif - vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; - #include - #include - #include - #include - #include - #include -}`, - em = `#define NORMAL -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) - varying vec3 vViewPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) - vViewPosition = - mvPosition.xyz; -#endif -}`, - tm = `#define NORMAL -uniform float opacity; -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) - varying vec3 vViewPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); - #ifdef OPAQUE - gl_FragColor.a = 1.0; - #endif -}`, - nm = `#define PHONG -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include - #include -}`, - im = `#define PHONG -uniform vec3 diffuse; -uniform vec3 emissive; -uniform vec3 specular; -uniform float shininess; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include - #include -}`, - sm = `#define STANDARD -varying vec3 vViewPosition; -#ifdef USE_TRANSMISSION - varying vec3 vWorldPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include -#ifdef USE_TRANSMISSION - vWorldPosition = worldPosition.xyz; -#endif -}`, - rm = `#define STANDARD -#ifdef PHYSICAL - #define IOR - #define SPECULAR -#endif -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float roughness; -uniform float metalness; -uniform float opacity; -#ifdef IOR - uniform float ior; -#endif -#ifdef SPECULAR - uniform float specularIntensity; - uniform vec3 specularColor; - #ifdef USE_SPECULARINTENSITYMAP - uniform sampler2D specularIntensityMap; - #endif - #ifdef USE_SPECULARCOLORMAP - uniform sampler2D specularColorMap; - #endif -#endif -#ifdef USE_CLEARCOAT - uniform float clearcoat; - uniform float clearcoatRoughness; -#endif -#ifdef USE_IRIDESCENCE - uniform float iridescence; - uniform float iridescenceIOR; - uniform float iridescenceThicknessMinimum; - uniform float iridescenceThicknessMaximum; -#endif -#ifdef USE_SHEEN - uniform vec3 sheenColor; - uniform float sheenRoughness; - #ifdef USE_SHEENCOLORMAP - uniform sampler2D sheenColorMap; - #endif - #ifdef USE_SHEENROUGHNESSMAP - uniform sampler2D sheenRoughnessMap; - #endif -#endif -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; - vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; - #include - vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; - #ifdef USE_SHEEN - float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); - outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular; - #endif - #ifdef USE_CLEARCOAT - float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) ); - vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); - outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat; - #endif - #include - #include - #include - #include - #include - #include -}`, - am = `#define TOON -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include -}`, - om = `#define TOON -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include -}`, - lm = `uniform float size; -uniform float scale; -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - gl_PointSize = size; - #ifdef USE_SIZEATTENUATION - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); - #endif - #include - #include - #include - #include -}`, - cm = `uniform vec3 diffuse; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec3 outgoingLight = vec3( 0.0 ); - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include - #include -}`, - hm = `#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`, - um = `uniform vec3 color; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -void main() { - gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); - #include - #include - #include -}`, - dm = `uniform float rotation; -uniform vec2 center; -#include -#include -#include -#include -#include -void main() { - #include - vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); - vec2 scale; - scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); - scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); - #ifndef USE_SIZEATTENUATION - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) scale *= - mvPosition.z; - #endif - vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; - vec2 rotatedPosition; - rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; - rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; - mvPosition.xy += rotatedPosition; - gl_Position = projectionMatrix * mvPosition; - #include - #include - #include -}`, - fm = `uniform vec3 diffuse; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec3 outgoingLight = vec3( 0.0 ); - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include -}`, - Ae = { - alphamap_fragment: kd, - alphamap_pars_fragment: Ud, - alphatest_fragment: Bd, - alphatest_pars_fragment: Vd, - aomap_fragment: Gd, - aomap_pars_fragment: Hd, - begin_vertex: Wd, - beginnormal_vertex: jd, - bsdfs: Xd, - iridescence_fragment: qd, - bumpmap_pars_fragment: $d, - clipping_planes_fragment: Yd, - clipping_planes_pars_fragment: Kd, - clipping_planes_pars_vertex: Zd, - clipping_planes_vertex: Jd, - color_fragment: Qd, - color_pars_fragment: ef, - color_pars_vertex: tf, - color_vertex: nf, - common: sf, - cube_uv_reflection_fragment: rf, - defaultnormal_vertex: af, - displacementmap_pars_vertex: of, - displacementmap_vertex: lf, - emissivemap_fragment: cf, - emissivemap_pars_fragment: hf, - encodings_fragment: uf, - encodings_pars_fragment: df, - envmap_fragment: ff, - envmap_common_pars_fragment: pf, - envmap_pars_fragment: mf, - envmap_pars_vertex: gf, - envmap_physical_pars_fragment: Af, - envmap_vertex: vf, - fog_vertex: _f, - fog_pars_vertex: xf, - fog_fragment: yf, - fog_pars_fragment: Mf, - gradientmap_pars_fragment: wf, - lightmap_fragment: bf, - lightmap_pars_fragment: Sf, - lights_lambert_vertex: Tf, - lights_pars_begin: Ef, - lights_toon_fragment: Cf, - lights_toon_pars_fragment: Lf, - lights_phong_fragment: Rf, - lights_phong_pars_fragment: Pf, - lights_physical_fragment: Df, - lights_physical_pars_fragment: If, - lights_fragment_begin: Ff, - lights_fragment_maps: Nf, - lights_fragment_end: zf, - logdepthbuf_fragment: Of, - logdepthbuf_pars_fragment: kf, - logdepthbuf_pars_vertex: Uf, - logdepthbuf_vertex: Bf, - map_fragment: Vf, - map_pars_fragment: Gf, - map_particle_fragment: Hf, - map_particle_pars_fragment: Wf, - metalnessmap_fragment: jf, - metalnessmap_pars_fragment: Xf, - morphcolor_vertex: qf, - morphnormal_vertex: $f, - morphtarget_pars_vertex: Yf, - morphtarget_vertex: Kf, - normal_fragment_begin: Zf, - normal_fragment_maps: Jf, - normal_pars_fragment: Qf, - normal_pars_vertex: ep, - normal_vertex: tp, - normalmap_pars_fragment: np, - clearcoat_normal_fragment_begin: ip, - clearcoat_normal_fragment_maps: sp, - clearcoat_pars_fragment: rp, - iridescence_pars_fragment: ap, - output_fragment: op, - packing: lp, - premultiplied_alpha_fragment: cp, - project_vertex: hp, - dithering_fragment: up, - dithering_pars_fragment: dp, - roughnessmap_fragment: fp, - roughnessmap_pars_fragment: pp, - shadowmap_pars_fragment: mp, - shadowmap_pars_vertex: gp, - shadowmap_vertex: vp, - shadowmask_pars_fragment: _p, - skinbase_vertex: xp, - skinning_pars_vertex: yp, - skinning_vertex: Mp, - skinnormal_vertex: wp, - specularmap_fragment: bp, - specularmap_pars_fragment: Sp, - tonemapping_fragment: Tp, - tonemapping_pars_fragment: Ep, - transmission_fragment: Ap, - transmission_pars_fragment: Cp, - uv_pars_fragment: Lp, - uv_pars_vertex: Rp, - uv_vertex: Pp, - uv2_pars_fragment: Dp, - uv2_pars_vertex: Ip, - uv2_vertex: Fp, - worldpos_vertex: Np, - background_vert: zp, - background_frag: Op, - cube_vert: kp, - cube_frag: Up, - depth_vert: Bp, - depth_frag: Vp, - distanceRGBA_vert: Gp, - distanceRGBA_frag: Hp, - equirect_vert: Wp, - equirect_frag: jp, - linedashed_vert: Xp, - linedashed_frag: qp, - meshbasic_vert: $p, - meshbasic_frag: Yp, - meshlambert_vert: Kp, - meshlambert_frag: Zp, - meshmatcap_vert: Jp, - meshmatcap_frag: Qp, - meshnormal_vert: em, - meshnormal_frag: tm, - meshphong_vert: nm, - meshphong_frag: im, - meshphysical_vert: sm, - meshphysical_frag: rm, - meshtoon_vert: am, - meshtoon_frag: om, - points_vert: lm, - points_frag: cm, - shadow_vert: hm, - shadow_frag: um, - sprite_vert: dm, - sprite_frag: fm, - }, - oe = { - common: { - diffuse: { value: new de(16777215) }, - opacity: { value: 1 }, - map: { value: null }, - uvTransform: { value: new Xt() }, - uv2Transform: { value: new Xt() }, - alphaMap: { value: null }, - alphaTest: { value: 0 }, - }, - specularmap: { specularMap: { value: null } }, - envmap: { - envMap: { value: null }, - flipEnvMap: { value: -1 }, - reflectivity: { value: 1 }, - ior: { value: 1.5 }, - refractionRatio: { value: 0.98 }, - }, - aomap: { aoMap: { value: null }, aoMapIntensity: { value: 1 } }, - lightmap: { - lightMap: { value: null }, - lightMapIntensity: { value: 1 }, - }, - emissivemap: { emissiveMap: { value: null } }, - bumpmap: { bumpMap: { value: null }, bumpScale: { value: 1 } }, - normalmap: { - normalMap: { value: null }, - normalScale: { value: new ve(1, 1) }, - }, - displacementmap: { - displacementMap: { value: null }, - displacementScale: { value: 1 }, - displacementBias: { value: 0 }, - }, - roughnessmap: { roughnessMap: { value: null } }, - metalnessmap: { metalnessMap: { value: null } }, - gradientmap: { gradientMap: { value: null } }, - fog: { - fogDensity: { value: 25e-5 }, - fogNear: { value: 1 }, - fogFar: { value: 2e3 }, - fogColor: { value: new de(16777215) }, - }, - lights: { - ambientLightColor: { value: [] }, - lightProbe: { value: [] }, - directionalLights: { - value: [], - properties: { direction: {}, color: {} }, - }, - directionalLightShadows: { - value: [], - properties: { - shadowBias: {}, - shadowNormalBias: {}, - shadowRadius: {}, - shadowMapSize: {}, - }, - }, - directionalShadowMap: { value: [] }, - directionalShadowMatrix: { value: [] }, - spotLights: { - value: [], - properties: { - color: {}, - position: {}, - direction: {}, - distance: {}, - coneCos: {}, - penumbraCos: {}, - decay: {}, - }, - }, - spotLightShadows: { - value: [], - properties: { - shadowBias: {}, - shadowNormalBias: {}, - shadowRadius: {}, - shadowMapSize: {}, - }, - }, - spotShadowMap: { value: [] }, - spotShadowMatrix: { value: [] }, - pointLights: { - value: [], - properties: { color: {}, position: {}, decay: {}, distance: {} }, - }, - pointLightShadows: { - value: [], - properties: { - shadowBias: {}, - shadowNormalBias: {}, - shadowRadius: {}, - shadowMapSize: {}, - shadowCameraNear: {}, - shadowCameraFar: {}, - }, - }, - pointShadowMap: { value: [] }, - pointShadowMatrix: { value: [] }, - hemisphereLights: { - value: [], - properties: { direction: {}, skyColor: {}, groundColor: {} }, - }, - rectAreaLights: { - value: [], - properties: { color: {}, position: {}, width: {}, height: {} }, - }, - ltc_1: { value: null }, - ltc_2: { value: null }, - }, - points: { - diffuse: { value: new de(16777215) }, - opacity: { value: 1 }, - size: { value: 1 }, - scale: { value: 1 }, - map: { value: null }, - alphaMap: { value: null }, - alphaTest: { value: 0 }, - uvTransform: { value: new Xt() }, - }, - sprite: { - diffuse: { value: new de(16777215) }, - opacity: { value: 1 }, - center: { value: new ve(0.5, 0.5) }, - rotation: { value: 0 }, - map: { value: null }, - alphaMap: { value: null }, - alphaTest: { value: 0 }, - uvTransform: { value: new Xt() }, - }, - }, - sn = { - basic: { - uniforms: pt([ - oe.common, - oe.specularmap, - oe.envmap, - oe.aomap, - oe.lightmap, - oe.fog, - ]), - vertexShader: Ae.meshbasic_vert, - fragmentShader: Ae.meshbasic_frag, - }, - lambert: { - uniforms: pt([ - oe.common, - oe.specularmap, - oe.envmap, - oe.aomap, - oe.lightmap, - oe.emissivemap, - oe.fog, - oe.lights, - { emissive: { value: new de(0) } }, - ]), - vertexShader: Ae.meshlambert_vert, - fragmentShader: Ae.meshlambert_frag, - }, - phong: { - uniforms: pt([ - oe.common, - oe.specularmap, - oe.envmap, - oe.aomap, - oe.lightmap, - oe.emissivemap, - oe.bumpmap, - oe.normalmap, - oe.displacementmap, - oe.fog, - oe.lights, - { - emissive: { value: new de(0) }, - specular: { value: new de(1118481) }, - shininess: { value: 30 }, - }, - ]), - vertexShader: Ae.meshphong_vert, - fragmentShader: Ae.meshphong_frag, - }, - standard: { - uniforms: pt([ - oe.common, - oe.envmap, - oe.aomap, - oe.lightmap, - oe.emissivemap, - oe.bumpmap, - oe.normalmap, - oe.displacementmap, - oe.roughnessmap, - oe.metalnessmap, - oe.fog, - oe.lights, - { - emissive: { value: new de(0) }, - roughness: { value: 1 }, - metalness: { value: 0 }, - envMapIntensity: { value: 1 }, - }, - ]), - vertexShader: Ae.meshphysical_vert, - fragmentShader: Ae.meshphysical_frag, - }, - toon: { - uniforms: pt([ - oe.common, - oe.aomap, - oe.lightmap, - oe.emissivemap, - oe.bumpmap, - oe.normalmap, - oe.displacementmap, - oe.gradientmap, - oe.fog, - oe.lights, - { emissive: { value: new de(0) } }, - ]), - vertexShader: Ae.meshtoon_vert, - fragmentShader: Ae.meshtoon_frag, - }, - matcap: { - uniforms: pt([ - oe.common, - oe.bumpmap, - oe.normalmap, - oe.displacementmap, - oe.fog, - { matcap: { value: null } }, - ]), - vertexShader: Ae.meshmatcap_vert, - fragmentShader: Ae.meshmatcap_frag, - }, - points: { - uniforms: pt([oe.points, oe.fog]), - vertexShader: Ae.points_vert, - fragmentShader: Ae.points_frag, - }, - dashed: { - uniforms: pt([ - oe.common, - oe.fog, - { - scale: { value: 1 }, - dashSize: { value: 1 }, - totalSize: { value: 2 }, - }, - ]), - vertexShader: Ae.linedashed_vert, - fragmentShader: Ae.linedashed_frag, - }, - depth: { - uniforms: pt([oe.common, oe.displacementmap]), - vertexShader: Ae.depth_vert, - fragmentShader: Ae.depth_frag, - }, - normal: { - uniforms: pt([ - oe.common, - oe.bumpmap, - oe.normalmap, - oe.displacementmap, - { opacity: { value: 1 } }, - ]), - vertexShader: Ae.meshnormal_vert, - fragmentShader: Ae.meshnormal_frag, - }, - sprite: { - uniforms: pt([oe.sprite, oe.fog]), - vertexShader: Ae.sprite_vert, - fragmentShader: Ae.sprite_frag, - }, - background: { - uniforms: { - uvTransform: { value: new Xt() }, - t2D: { value: null }, - }, - vertexShader: Ae.background_vert, - fragmentShader: Ae.background_frag, - }, - cube: { - uniforms: pt([oe.envmap, { opacity: { value: 1 } }]), - vertexShader: Ae.cube_vert, - fragmentShader: Ae.cube_frag, - }, - equirect: { - uniforms: { tEquirect: { value: null } }, - vertexShader: Ae.equirect_vert, - fragmentShader: Ae.equirect_frag, - }, - distanceRGBA: { - uniforms: pt([ - oe.common, - oe.displacementmap, - { - referencePosition: { value: new P() }, - nearDistance: { value: 1 }, - farDistance: { value: 1e3 }, - }, - ]), - vertexShader: Ae.distanceRGBA_vert, - fragmentShader: Ae.distanceRGBA_frag, - }, - shadow: { - uniforms: pt([ - oe.lights, - oe.fog, - { color: { value: new de(0) }, opacity: { value: 1 } }, - ]), - vertexShader: Ae.shadow_vert, - fragmentShader: Ae.shadow_frag, - }, - }; - sn.physical = { - uniforms: pt([ - sn.standard.uniforms, - { - clearcoat: { value: 0 }, - clearcoatMap: { value: null }, - clearcoatRoughness: { value: 0 }, - clearcoatRoughnessMap: { value: null }, - clearcoatNormalScale: { value: new ve(1, 1) }, - clearcoatNormalMap: { value: null }, - iridescence: { value: 0 }, - iridescenceMap: { value: null }, - iridescenceIOR: { value: 1.3 }, - iridescenceThicknessMinimum: { value: 100 }, - iridescenceThicknessMaximum: { value: 400 }, - iridescenceThicknessMap: { value: null }, - sheen: { value: 0 }, - sheenColor: { value: new de(0) }, - sheenColorMap: { value: null }, - sheenRoughness: { value: 1 }, - sheenRoughnessMap: { value: null }, - transmission: { value: 0 }, - transmissionMap: { value: null }, - transmissionSamplerSize: { value: new ve() }, - transmissionSamplerMap: { value: null }, - thickness: { value: 0 }, - thicknessMap: { value: null }, - attenuationDistance: { value: 0 }, - attenuationColor: { value: new de(0) }, - specularIntensity: { value: 1 }, - specularIntensityMap: { value: null }, - specularColor: { value: new de(1, 1, 1) }, - specularColorMap: { value: null }, - }, - ]), - vertexShader: Ae.meshphysical_vert, - fragmentShader: Ae.meshphysical_frag, - }; - function pm(r, e, t, n, i, s) { - const a = new de(0); - let o = i === !0 ? 0 : 1, - l, - c, - u = null, - h = 0, - d = null; - function f(m, p) { - let v = !1, - M = p.isScene === !0 ? p.background : null; - M && M.isTexture && (M = e.get(M)); - const x = r.xr, - w = x.getSession && x.getSession(); - w && w.environmentBlendMode === "additive" && (M = null), - M === null ? g(a, o) : M && M.isColor && (g(M, 1), (v = !0)), - (r.autoClear || v) && - r.clear(r.autoClearColor, r.autoClearDepth, r.autoClearStencil), - M && (M.isCubeTexture || M.mapping === Or) - ? (c === void 0 && - ((c = new Qe( - new Ns(1, 1, 1), - new En({ - name: "BackgroundCubeMaterial", - uniforms: Hi(sn.cube.uniforms), - vertexShader: sn.cube.vertexShader, - fragmentShader: sn.cube.fragmentShader, - side: qt, - depthTest: !1, - depthWrite: !1, - fog: !1, - }) - )), - c.geometry.deleteAttribute("normal"), - c.geometry.deleteAttribute("uv"), - (c.onBeforeRender = function (y, A, L) { - this.matrixWorld.copyPosition(L.matrixWorld); - }), - Object.defineProperty(c.material, "envMap", { - get: function () { - return this.uniforms.envMap.value; - }, - }), - n.update(c)), - (c.material.uniforms.envMap.value = M), - (c.material.uniforms.flipEnvMap.value = - M.isCubeTexture && M.isRenderTargetTexture === !1 ? -1 : 1), - (u !== M || h !== M.version || d !== r.toneMapping) && - ((c.material.needsUpdate = !0), - (u = M), - (h = M.version), - (d = r.toneMapping)), - c.layers.enableAll(), - m.unshift(c, c.geometry, c.material, 0, 0, null)) - : M && - M.isTexture && - (l === void 0 && - ((l = new Qe( - new Gn(2, 2), - new En({ - name: "BackgroundMaterial", - uniforms: Hi(sn.background.uniforms), - vertexShader: sn.background.vertexShader, - fragmentShader: sn.background.fragmentShader, - side: ki, - depthTest: !1, - depthWrite: !1, - fog: !1, - }) - )), - l.geometry.deleteAttribute("normal"), - Object.defineProperty(l.material, "map", { - get: function () { - return this.uniforms.t2D.value; - }, - }), - n.update(l)), - (l.material.uniforms.t2D.value = M), - M.matrixAutoUpdate === !0 && M.updateMatrix(), - l.material.uniforms.uvTransform.value.copy(M.matrix), - (u !== M || h !== M.version || d !== r.toneMapping) && - ((l.material.needsUpdate = !0), - (u = M), - (h = M.version), - (d = r.toneMapping)), - l.layers.enableAll(), - m.unshift(l, l.geometry, l.material, 0, 0, null)); - } - function g(m, p) { - t.buffers.color.setClear(m.r, m.g, m.b, p, s); - } - return { - getClearColor: function () { - return a; - }, - setClearColor: function (m, p = 1) { - a.set(m), (o = p), g(a, o); - }, - getClearAlpha: function () { - return o; - }, - setClearAlpha: function (m) { - (o = m), g(a, o); - }, - render: f, - }; - } - function mm(r, e, t, n) { - const i = r.getParameter(34921), - s = n.isWebGL2 ? null : e.get("OES_vertex_array_object"), - a = n.isWebGL2 || s !== null, - o = {}, - l = p(null); - let c = l, - u = !1; - function h(D, z, N, k, G) { - let U = !1; - if (a) { - const X = m(k, N, z); - c !== X && ((c = X), f(c.object)), - (U = v(D, k, N, G)), - U && M(D, k, N, G); - } else { - const X = z.wireframe === !0; - (c.geometry !== k.id || c.program !== N.id || c.wireframe !== X) && - ((c.geometry = k.id), - (c.program = N.id), - (c.wireframe = X), - (U = !0)); - } - G !== null && t.update(G, 34963), - (U || u) && - ((u = !1), - _(D, z, N, k), - G !== null && r.bindBuffer(34963, t.get(G).buffer)); - } - function d() { - return n.isWebGL2 ? r.createVertexArray() : s.createVertexArrayOES(); - } - function f(D) { - return n.isWebGL2 ? r.bindVertexArray(D) : s.bindVertexArrayOES(D); - } - function g(D) { - return n.isWebGL2 - ? r.deleteVertexArray(D) - : s.deleteVertexArrayOES(D); - } - function m(D, z, N) { - const k = N.wireframe === !0; - let G = o[D.id]; - G === void 0 && ((G = {}), (o[D.id] = G)); - let U = G[z.id]; - U === void 0 && ((U = {}), (G[z.id] = U)); - let X = U[k]; - return X === void 0 && ((X = p(d())), (U[k] = X)), X; - } - function p(D) { - const z = [], - N = [], - k = []; - for (let G = 0; G < i; G++) (z[G] = 0), (N[G] = 0), (k[G] = 0); - return { - geometry: null, - program: null, - wireframe: !1, - newAttributes: z, - enabledAttributes: N, - attributeDivisors: k, - object: D, - attributes: {}, - index: null, - }; - } - function v(D, z, N, k) { - const G = c.attributes, - U = z.attributes; - let X = 0; - const Z = N.getAttributes(); - for (const Y in Z) - if (Z[Y].location >= 0) { - const ae = G[Y]; - let ue = U[Y]; - if ( - (ue === void 0 && - (Y === "instanceMatrix" && - D.instanceMatrix && - (ue = D.instanceMatrix), - Y === "instanceColor" && - D.instanceColor && - (ue = D.instanceColor)), - ae === void 0 || - ae.attribute !== ue || - (ue && ae.data !== ue.data)) - ) - return !0; - X++; - } - return c.attributesNum !== X || c.index !== k; - } - function M(D, z, N, k) { - const G = {}, - U = z.attributes; - let X = 0; - const Z = N.getAttributes(); - for (const Y in Z) - if (Z[Y].location >= 0) { - let ae = U[Y]; - ae === void 0 && - (Y === "instanceMatrix" && - D.instanceMatrix && - (ae = D.instanceMatrix), - Y === "instanceColor" && - D.instanceColor && - (ae = D.instanceColor)); - const ue = {}; - (ue.attribute = ae), - ae && ae.data && (ue.data = ae.data), - (G[Y] = ue), - X++; - } - (c.attributes = G), (c.attributesNum = X), (c.index = k); - } - function x() { - const D = c.newAttributes; - for (let z = 0, N = D.length; z < N; z++) D[z] = 0; - } - function w(D) { - y(D, 0); - } - function y(D, z) { - const N = c.newAttributes, - k = c.enabledAttributes, - G = c.attributeDivisors; - (N[D] = 1), - k[D] === 0 && (r.enableVertexAttribArray(D), (k[D] = 1)), - G[D] !== z && - ((n.isWebGL2 ? r : e.get("ANGLE_instanced_arrays"))[ - n.isWebGL2 ? "vertexAttribDivisor" : "vertexAttribDivisorANGLE" - ](D, z), - (G[D] = z)); - } - function A() { - const D = c.newAttributes, - z = c.enabledAttributes; - for (let N = 0, k = z.length; N < k; N++) - z[N] !== D[N] && (r.disableVertexAttribArray(N), (z[N] = 0)); - } - function L(D, z, N, k, G, U) { - n.isWebGL2 === !0 && (N === 5124 || N === 5125) - ? r.vertexAttribIPointer(D, z, N, G, U) - : r.vertexAttribPointer(D, z, N, k, G, U); - } - function _(D, z, N, k) { - if ( - n.isWebGL2 === !1 && - (D.isInstancedMesh || k.isInstancedBufferGeometry) && - e.get("ANGLE_instanced_arrays") === null - ) - return; - x(); - const G = k.attributes, - U = N.getAttributes(), - X = z.defaultAttributeValues; - for (const Z in U) { - const Y = U[Z]; - if (Y.location >= 0) { - let J = G[Z]; - if ( - (J === void 0 && - (Z === "instanceMatrix" && - D.instanceMatrix && - (J = D.instanceMatrix), - Z === "instanceColor" && - D.instanceColor && - (J = D.instanceColor)), - J !== void 0) - ) { - const ae = J.normalized, - ue = J.itemSize, - q = t.get(J); - if (q === void 0) continue; - const Ie = q.buffer, - me = q.type, - xe = q.bytesPerElement; - if (J.isInterleavedBufferAttribute) { - const ce = J.data, - De = ce.stride, - Se = J.offset; - if (ce.isInstancedInterleavedBuffer) { - for (let Me = 0; Me < Y.locationSize; Me++) - y(Y.location + Me, ce.meshPerAttribute); - D.isInstancedMesh !== !0 && - k._maxInstanceCount === void 0 && - (k._maxInstanceCount = ce.meshPerAttribute * ce.count); - } else - for (let Me = 0; Me < Y.locationSize; Me++) - w(Y.location + Me); - r.bindBuffer(34962, Ie); - for (let Me = 0; Me < Y.locationSize; Me++) - L( - Y.location + Me, - ue / Y.locationSize, - me, - ae, - De * xe, - (Se + (ue / Y.locationSize) * Me) * xe - ); - } else { - if (J.isInstancedBufferAttribute) { - for (let ce = 0; ce < Y.locationSize; ce++) - y(Y.location + ce, J.meshPerAttribute); - D.isInstancedMesh !== !0 && - k._maxInstanceCount === void 0 && - (k._maxInstanceCount = J.meshPerAttribute * J.count); - } else - for (let ce = 0; ce < Y.locationSize; ce++) - w(Y.location + ce); - r.bindBuffer(34962, Ie); - for (let ce = 0; ce < Y.locationSize; ce++) - L( - Y.location + ce, - ue / Y.locationSize, - me, - ae, - ue * xe, - (ue / Y.locationSize) * ce * xe - ); - } - } else if (X !== void 0) { - const ae = X[Z]; - if (ae !== void 0) - switch (ae.length) { - case 2: - r.vertexAttrib2fv(Y.location, ae); - break; - case 3: - r.vertexAttrib3fv(Y.location, ae); - break; - case 4: - r.vertexAttrib4fv(Y.location, ae); - break; - default: - r.vertexAttrib1fv(Y.location, ae); - } - } - } - } - A(); - } - function T() { - H(); - for (const D in o) { - const z = o[D]; - for (const N in z) { - const k = z[N]; - for (const G in k) g(k[G].object), delete k[G]; - delete z[N]; - } - delete o[D]; - } - } - function I(D) { - if (o[D.id] === void 0) return; - const z = o[D.id]; - for (const N in z) { - const k = z[N]; - for (const G in k) g(k[G].object), delete k[G]; - delete z[N]; - } - delete o[D.id]; - } - function F(D) { - for (const z in o) { - const N = o[z]; - if (N[D.id] === void 0) continue; - const k = N[D.id]; - for (const G in k) g(k[G].object), delete k[G]; - delete N[D.id]; - } - } - function H() { - B(), (u = !0), c !== l && ((c = l), f(c.object)); - } - function B() { - (l.geometry = null), (l.program = null), (l.wireframe = !1); - } - return { - setup: h, - reset: H, - resetDefaultState: B, - dispose: T, - releaseStatesOfGeometry: I, - releaseStatesOfProgram: F, - initAttributes: x, - enableAttribute: w, - disableUnusedAttributes: A, - }; - } - function gm(r, e, t, n) { - const i = n.isWebGL2; - let s; - function a(c) { - s = c; - } - function o(c, u) { - r.drawArrays(s, c, u), t.update(u, s, 1); - } - function l(c, u, h) { - if (h === 0) return; - let d, f; - if (i) (d = r), (f = "drawArraysInstanced"); - else if ( - ((d = e.get("ANGLE_instanced_arrays")), - (f = "drawArraysInstancedANGLE"), - d === null) - ) { - console.error( - "THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays." - ); - return; - } - d[f](s, c, u, h), t.update(u, s, h); - } - (this.setMode = a), (this.render = o), (this.renderInstances = l); - } - function vm(r, e, t) { - let n; - function i() { - if (n !== void 0) return n; - if (e.has("EXT_texture_filter_anisotropic") === !0) { - const L = e.get("EXT_texture_filter_anisotropic"); - n = r.getParameter(L.MAX_TEXTURE_MAX_ANISOTROPY_EXT); - } else n = 0; - return n; - } - function s(L) { - if (L === "highp") { - if ( - r.getShaderPrecisionFormat(35633, 36338).precision > 0 && - r.getShaderPrecisionFormat(35632, 36338).precision > 0 - ) - return "highp"; - L = "mediump"; - } - return L === "mediump" && - r.getShaderPrecisionFormat(35633, 36337).precision > 0 && - r.getShaderPrecisionFormat(35632, 36337).precision > 0 - ? "mediump" - : "lowp"; - } - const a = - (typeof WebGL2RenderingContext != "undefined" && - r instanceof WebGL2RenderingContext) || - (typeof WebGL2ComputeRenderingContext != "undefined" && - r instanceof WebGL2ComputeRenderingContext); - let o = t.precision !== void 0 ? t.precision : "highp"; - const l = s(o); - l !== o && - (console.warn( - "THREE.WebGLRenderer:", - o, - "not supported, using", - l, - "instead." - ), - (o = l)); - const c = a || e.has("WEBGL_draw_buffers"), - u = t.logarithmicDepthBuffer === !0, - h = r.getParameter(34930), - d = r.getParameter(35660), - f = r.getParameter(3379), - g = r.getParameter(34076), - m = r.getParameter(34921), - p = r.getParameter(36347), - v = r.getParameter(36348), - M = r.getParameter(36349), - x = d > 0, - w = a || e.has("OES_texture_float"), - y = x && w, - A = a ? r.getParameter(36183) : 0; - return { - isWebGL2: a, - drawBuffers: c, - getMaxAnisotropy: i, - getMaxPrecision: s, - precision: o, - logarithmicDepthBuffer: u, - maxTextures: h, - maxVertexTextures: d, - maxTextureSize: f, - maxCubemapSize: g, - maxAttributes: m, - maxVertexUniforms: p, - maxVaryings: v, - maxFragmentUniforms: M, - vertexTextures: x, - floatFragmentTextures: w, - floatVertexTextures: y, - maxSamples: A, - }; - } - function _m(r) { - const e = this; - let t = null, - n = 0, - i = !1, - s = !1; - const a = new Qn(), - o = new Xt(), - l = { value: null, needsUpdate: !1 }; - (this.uniform = l), - (this.numPlanes = 0), - (this.numIntersection = 0), - (this.init = function (h, d, f) { - const g = h.length !== 0 || d || n !== 0 || i; - return (i = d), (t = u(h, f, 0)), (n = h.length), g; - }), - (this.beginShadows = function () { - (s = !0), u(null); - }), - (this.endShadows = function () { - (s = !1), c(); - }), - (this.setState = function (h, d, f) { - const g = h.clippingPlanes, - m = h.clipIntersection, - p = h.clipShadows, - v = r.get(h); - if (!i || g === null || g.length === 0 || (s && !p)) - s ? u(null) : c(); - else { - const M = s ? 0 : n, - x = M * 4; - let w = v.clippingState || null; - (l.value = w), (w = u(g, d, x, f)); - for (let y = 0; y !== x; ++y) w[y] = t[y]; - (v.clippingState = w), - (this.numIntersection = m ? this.numPlanes : 0), - (this.numPlanes += M); - } - }); - function c() { - l.value !== t && ((l.value = t), (l.needsUpdate = n > 0)), - (e.numPlanes = n), - (e.numIntersection = 0); - } - function u(h, d, f, g) { - const m = h !== null ? h.length : 0; - let p = null; - if (m !== 0) { - if (((p = l.value), g !== !0 || p === null)) { - const v = f + m * 4, - M = d.matrixWorldInverse; - o.getNormalMatrix(M), - (p === null || p.length < v) && (p = new Float32Array(v)); - for (let x = 0, w = f; x !== m; ++x, w += 4) - a.copy(h[x]).applyMatrix4(M, o), - a.normal.toArray(p, w), - (p[w + 3] = a.constant); - } - (l.value = p), (l.needsUpdate = !0); - } - return (e.numPlanes = m), (e.numIntersection = 0), p; - } - } - function xm(r) { - let e = new WeakMap(); - function t(a, o) { - return o === Tr ? (a.mapping = Ui) : o === Na && (a.mapping = Bi), a; - } - function n(a) { - if (a && a.isTexture && a.isRenderTargetTexture === !1) { - const o = a.mapping; - if (o === Tr || o === Na) - if (e.has(a)) { - const l = e.get(a).texture; - return t(l, a.mapping); - } else { - const l = a.image; - if (l && l.height > 0) { - const c = new Fd(l.height / 2); - return ( - c.fromEquirectangularTexture(r, a), - e.set(a, c), - a.addEventListener("dispose", i), - t(c.texture, a.mapping) - ); - } else return null; - } - } - return a; - } - function i(a) { - const o = a.target; - o.removeEventListener("dispose", i); - const l = e.get(o); - l !== void 0 && (e.delete(o), l.dispose()); - } - function s() { - e = new WeakMap(); - } - return { get: n, dispose: s }; - } - class zs extends Yc { - constructor(e = -1, t = 1, n = 1, i = -1, s = 0.1, a = 2e3) { - super(), - (this.isOrthographicCamera = !0), - (this.type = "OrthographicCamera"), - (this.zoom = 1), - (this.view = null), - (this.left = e), - (this.right = t), - (this.top = n), - (this.bottom = i), - (this.near = s), - (this.far = a), - this.updateProjectionMatrix(); - } - copy(e, t) { - return ( - super.copy(e, t), - (this.left = e.left), - (this.right = e.right), - (this.top = e.top), - (this.bottom = e.bottom), - (this.near = e.near), - (this.far = e.far), - (this.zoom = e.zoom), - (this.view = e.view === null ? null : Object.assign({}, e.view)), - this - ); - } - setViewOffset(e, t, n, i, s, a) { - this.view === null && - (this.view = { - enabled: !0, - fullWidth: 1, - fullHeight: 1, - offsetX: 0, - offsetY: 0, - width: 1, - height: 1, - }), - (this.view.enabled = !0), - (this.view.fullWidth = e), - (this.view.fullHeight = t), - (this.view.offsetX = n), - (this.view.offsetY = i), - (this.view.width = s), - (this.view.height = a), - this.updateProjectionMatrix(); - } - clearViewOffset() { - this.view !== null && (this.view.enabled = !1), - this.updateProjectionMatrix(); - } - updateProjectionMatrix() { - const e = (this.right - this.left) / (2 * this.zoom), - t = (this.top - this.bottom) / (2 * this.zoom), - n = (this.right + this.left) / 2, - i = (this.top + this.bottom) / 2; - let s = n - e, - a = n + e, - o = i + t, - l = i - t; - if (this.view !== null && this.view.enabled) { - const c = - (this.right - this.left) / this.view.fullWidth / this.zoom, - u = (this.top - this.bottom) / this.view.fullHeight / this.zoom; - (s += c * this.view.offsetX), - (a = s + c * this.view.width), - (o -= u * this.view.offsetY), - (l = o - u * this.view.height); - } - this.projectionMatrix.makeOrthographic( - s, - a, - o, - l, - this.near, - this.far - ), - this.projectionMatrixInverse.copy(this.projectionMatrix).invert(); - } - toJSON(e) { - const t = super.toJSON(e); - return ( - (t.object.zoom = this.zoom), - (t.object.left = this.left), - (t.object.right = this.right), - (t.object.top = this.top), - (t.object.bottom = this.bottom), - (t.object.near = this.near), - (t.object.far = this.far), - this.view !== null && - (t.object.view = Object.assign({}, this.view)), - t - ); - } - } - const Ni = 4, - yl = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582], - ni = 20, - ya = new zs(), - Ml = new de(); - let Ma = null; - const ei = (1 + Math.sqrt(5)) / 2, - Ri = 1 / ei, - wl = [ - new P(1, 1, 1), - new P(-1, 1, 1), - new P(1, 1, -1), - new P(-1, 1, -1), - new P(0, ei, Ri), - new P(0, ei, -Ri), - new P(Ri, 0, ei), - new P(-Ri, 0, ei), - new P(ei, Ri, 0), - new P(-ei, Ri, 0), - ]; - class bl { - constructor(e) { - (this._renderer = e), - (this._pingPongRenderTarget = null), - (this._lodMax = 0), - (this._cubeSize = 0), - (this._lodPlanes = []), - (this._sizeLods = []), - (this._sigmas = []), - (this._blurMaterial = null), - (this._cubemapMaterial = null), - (this._equirectMaterial = null), - this._compileMaterial(this._blurMaterial); - } - fromScene(e, t = 0, n = 0.1, i = 100) { - (Ma = this._renderer.getRenderTarget()), this._setSize(256); - const s = this._allocateTargets(); - return ( - (s.depthBuffer = !0), - this._sceneToCubeUV(e, n, i, s), - t > 0 && this._blur(s, 0, 0, t), - this._applyPMREM(s), - this._cleanup(s), - s - ); - } - fromEquirectangular(e, t = null) { - return this._fromTexture(e, t); - } - fromCubemap(e, t = null) { - return this._fromTexture(e, t); - } - compileCubemapShader() { - this._cubemapMaterial === null && - ((this._cubemapMaterial = El()), - this._compileMaterial(this._cubemapMaterial)); - } - compileEquirectangularShader() { - this._equirectMaterial === null && - ((this._equirectMaterial = Tl()), - this._compileMaterial(this._equirectMaterial)); - } - dispose() { - this._dispose(), - this._cubemapMaterial !== null && this._cubemapMaterial.dispose(), - this._equirectMaterial !== null && this._equirectMaterial.dispose(); - } - _setSize(e) { - (this._lodMax = Math.floor(Math.log2(e))), - (this._cubeSize = Math.pow(2, this._lodMax)); - } - _dispose() { - this._blurMaterial !== null && this._blurMaterial.dispose(), - this._pingPongRenderTarget !== null && - this._pingPongRenderTarget.dispose(); - for (let e = 0; e < this._lodPlanes.length; e++) - this._lodPlanes[e].dispose(); - } - _cleanup(e) { - this._renderer.setRenderTarget(Ma), - (e.scissorTest = !1), - hr(e, 0, 0, e.width, e.height); - } - _fromTexture(e, t) { - e.mapping === Ui || e.mapping === Bi - ? this._setSize( - e.image.length === 0 - ? 16 - : e.image[0].width || e.image[0].image.width - ) - : this._setSize(e.image.width / 4), - (Ma = this._renderer.getRenderTarget()); - const n = t || this._allocateTargets(); - return ( - this._textureToCubeUV(e, n), - this._applyPMREM(n), - this._cleanup(n), - n - ); - } - _allocateTargets() { - const e = 3 * Math.max(this._cubeSize, 112), - t = 4 * this._cubeSize, - n = { - magFilter: $e, - minFilter: $e, - generateMipmaps: !1, - type: Mn, - format: Nt, - encoding: Vn, - depthBuffer: !1, - }, - i = Sl(e, t, n); - if ( - this._pingPongRenderTarget === null || - this._pingPongRenderTarget.width !== e - ) { - this._pingPongRenderTarget !== null && this._dispose(), - (this._pingPongRenderTarget = Sl(e, t, n)); - const { _lodMax: s } = this; - ({ - sizeLods: this._sizeLods, - lodPlanes: this._lodPlanes, - sigmas: this._sigmas, - } = ym(s)), - (this._blurMaterial = Mm(s, e, t)); - } - return i; - } - _compileMaterial(e) { - const t = new Qe(this._lodPlanes[0], e); - this._renderer.compile(t, ya); - } - _sceneToCubeUV(e, t, n, i) { - const o = new mt(90, 1, t, n), - l = [1, -1, 1, 1, 1, 1], - c = [1, 1, 1, -1, -1, -1], - u = this._renderer, - h = u.autoClear, - d = u.toneMapping; - u.getClearColor(Ml), (u.toneMapping = $t), (u.autoClear = !1); - const f = new wn({ - name: "PMREM.Background", - side: qt, - depthWrite: !1, - depthTest: !1, - }), - g = new Qe(new Ns(), f); - let m = !1; - const p = e.background; - p - ? p.isColor && (f.color.copy(p), (e.background = null), (m = !0)) - : (f.color.copy(Ml), (m = !0)); - for (let v = 0; v < 6; v++) { - const M = v % 3; - M === 0 - ? (o.up.set(0, l[v], 0), o.lookAt(c[v], 0, 0)) - : M === 1 - ? (o.up.set(0, 0, l[v]), o.lookAt(0, c[v], 0)) - : (o.up.set(0, l[v], 0), o.lookAt(0, 0, c[v])); - const x = this._cubeSize; - hr(i, M * x, v > 2 ? x : 0, x, x), - u.setRenderTarget(i), - m && u.render(g, o), - u.render(e, o); - } - g.geometry.dispose(), - g.material.dispose(), - (u.toneMapping = d), - (u.autoClear = h), - (e.background = p); - } - _textureToCubeUV(e, t) { - const n = this._renderer, - i = e.mapping === Ui || e.mapping === Bi; - i - ? (this._cubemapMaterial === null && (this._cubemapMaterial = El()), - (this._cubemapMaterial.uniforms.flipEnvMap.value = - e.isRenderTargetTexture === !1 ? -1 : 1)) - : this._equirectMaterial === null && - (this._equirectMaterial = Tl()); - const s = i ? this._cubemapMaterial : this._equirectMaterial, - a = new Qe(this._lodPlanes[0], s), - o = s.uniforms; - o.envMap.value = e; - const l = this._cubeSize; - hr(t, 0, 0, 3 * l, 2 * l), n.setRenderTarget(t), n.render(a, ya); - } - _applyPMREM(e) { - const t = this._renderer, - n = t.autoClear; - t.autoClear = !1; - for (let i = 1; i < this._lodPlanes.length; i++) { - const s = Math.sqrt( - this._sigmas[i] * this._sigmas[i] - - this._sigmas[i - 1] * this._sigmas[i - 1] - ), - a = wl[(i - 1) % wl.length]; - this._blur(e, i - 1, i, s, a); - } - t.autoClear = n; - } - _blur(e, t, n, i, s) { - const a = this._pingPongRenderTarget; - this._halfBlur(e, a, t, n, i, "latitudinal", s), - this._halfBlur(a, e, n, n, i, "longitudinal", s); - } - _halfBlur(e, t, n, i, s, a, o) { - const l = this._renderer, - c = this._blurMaterial; - a !== "latitudinal" && - a !== "longitudinal" && - console.error( - "blur direction must be either latitudinal or longitudinal!" - ); - const u = 3, - h = new Qe(this._lodPlanes[i], c), - d = c.uniforms, - f = this._sizeLods[n] - 1, - g = isFinite(s) ? Math.PI / (2 * f) : (2 * Math.PI) / (2 * ni - 1), - m = s / g, - p = isFinite(s) ? 1 + Math.floor(u * m) : ni; - p > ni && - console.warn( - `sigmaRadians, ${s}, is too large and will clip, as it requested ${p} samples when the maximum is set to ${ni}` - ); - const v = []; - let M = 0; - for (let L = 0; L < ni; ++L) { - const _ = L / m, - T = Math.exp((-_ * _) / 2); - v.push(T), L === 0 ? (M += T) : L < p && (M += 2 * T); - } - for (let L = 0; L < v.length; L++) v[L] = v[L] / M; - (d.envMap.value = e.texture), - (d.samples.value = p), - (d.weights.value = v), - (d.latitudinal.value = a === "latitudinal"), - o && (d.poleAxis.value = o); - const { _lodMax: x } = this; - (d.dTheta.value = g), (d.mipInt.value = x - n); - const w = this._sizeLods[i], - y = 3 * w * (i > x - Ni ? i - x + Ni : 0), - A = 4 * (this._cubeSize - w); - hr(t, y, A, 3 * w, 2 * w), l.setRenderTarget(t), l.render(h, ya); - } - } - function ym(r) { - const e = [], - t = [], - n = []; - let i = r; - const s = r - Ni + 1 + yl.length; - for (let a = 0; a < s; a++) { - const o = Math.pow(2, i); - t.push(o); - let l = 1 / o; - a > r - Ni ? (l = yl[a - r + Ni - 1]) : a === 0 && (l = 0), n.push(l); - const c = 1 / (o - 2), - u = -c, - h = 1 + c, - d = [u, u, h, u, h, h, u, u, h, h, u, h], - f = 6, - g = 6, - m = 3, - p = 2, - v = 1, - M = new Float32Array(m * g * f), - x = new Float32Array(p * g * f), - w = new Float32Array(v * g * f); - for (let A = 0; A < f; A++) { - const L = ((A % 3) * 2) / 3 - 1, - _ = A > 2 ? 0 : -1, - T = [ - L, - _, - 0, - L + 2 / 3, - _, - 0, - L + 2 / 3, - _ + 1, - 0, - L, - _, - 0, - L + 2 / 3, - _ + 1, - 0, - L, - _ + 1, - 0, - ]; - M.set(T, m * g * A), x.set(d, p * g * A); - const I = [A, A, A, A, A, A]; - w.set(I, v * g * A); - } - const y = new ct(); - y.setAttribute("position", new wt(M, m)), - y.setAttribute("uv", new wt(x, p)), - y.setAttribute("faceIndex", new wt(w, v)), - e.push(y), - i > Ni && i--; - } - return { lodPlanes: e, sizeLods: t, sigmas: n }; - } - function Sl(r, e, t) { - const n = new Kt(r, e, t); - return ( - (n.texture.mapping = Or), - (n.texture.name = "PMREM.cubeUv"), - (n.scissorTest = !0), - n - ); - } - function hr(r, e, t, n, i) { - r.viewport.set(e, t, n, i), r.scissor.set(e, t, n, i); - } - function Mm(r, e, t) { - const n = new Float32Array(ni), - i = new P(0, 1, 0); - return new En({ - name: "SphericalGaussianBlur", - defines: { - n: ni, - CUBEUV_TEXEL_WIDTH: 1 / e, - CUBEUV_TEXEL_HEIGHT: 1 / t, - CUBEUV_MAX_MIP: `${r}.0`, - }, - uniforms: { - envMap: { value: null }, - samples: { value: 1 }, - weights: { value: n }, - latitudinal: { value: !1 }, - dTheta: { value: 0 }, - mipInt: { value: 0 }, - poleAxis: { value: i }, - }, - vertexShader: ao(), - fragmentShader: ` - - precision mediump float; - precision mediump int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - uniform int samples; - uniform float weights[ n ]; - uniform bool latitudinal; - uniform float dTheta; - uniform float mipInt; - uniform vec3 poleAxis; - - #define ENVMAP_TYPE_CUBE_UV - #include - - vec3 getSample( float theta, vec3 axis ) { - - float cosTheta = cos( theta ); - // Rodrigues' axis-angle rotation - vec3 sampleDirection = vOutputDirection * cosTheta - + cross( axis, vOutputDirection ) * sin( theta ) - + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); - - return bilinearCubeUV( envMap, sampleDirection, mipInt ); - - } - - void main() { - - vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); - - if ( all( equal( axis, vec3( 0.0 ) ) ) ) { - - axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); - - } - - axis = normalize( axis ); - - gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); - gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); - - for ( int i = 1; i < n; i++ ) { - - if ( i >= samples ) { - - break; - - } - - float theta = dTheta * float( i ); - gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); - gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); - - } - - } - `, - blending: Un, - depthTest: !1, - depthWrite: !1, - }); - } - function Tl() { - return new En({ - name: "EquirectangularToCubeUV", - uniforms: { envMap: { value: null } }, - vertexShader: ao(), - fragmentShader: ` - - precision mediump float; - precision mediump int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - - #include - - void main() { - - vec3 outputDirection = normalize( vOutputDirection ); - vec2 uv = equirectUv( outputDirection ); - - gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); - - } - `, - blending: Un, - depthTest: !1, - depthWrite: !1, - }); - } - function El() { - return new En({ - name: "CubemapToCubeUV", - uniforms: { envMap: { value: null }, flipEnvMap: { value: -1 } }, - vertexShader: ao(), - fragmentShader: ` - - precision mediump float; - precision mediump int; - - uniform float flipEnvMap; - - varying vec3 vOutputDirection; - - uniform samplerCube envMap; - - void main() { - - gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); - - } - `, - blending: Un, - depthTest: !1, - depthWrite: !1, - }); - } - function ao() { - return ` - - precision mediump float; - precision mediump int; - - attribute float faceIndex; - - varying vec3 vOutputDirection; - - // RH coordinate system; PMREM face-indexing convention - vec3 getDirection( vec2 uv, float face ) { - - uv = 2.0 * uv - 1.0; - - vec3 direction = vec3( uv, 1.0 ); - - if ( face == 0.0 ) { - - direction = direction.zyx; // ( 1, v, u ) pos x - - } else if ( face == 1.0 ) { - - direction = direction.xzy; - direction.xz *= -1.0; // ( -u, 1, -v ) pos y - - } else if ( face == 2.0 ) { - - direction.x *= -1.0; // ( -u, v, 1 ) pos z - - } else if ( face == 3.0 ) { - - direction = direction.zyx; - direction.xz *= -1.0; // ( -1, v, -u ) neg x - - } else if ( face == 4.0 ) { - - direction = direction.xzy; - direction.xy *= -1.0; // ( -u, -1, v ) neg y - - } else if ( face == 5.0 ) { - - direction.z *= -1.0; // ( u, v, -1 ) neg z - - } - - return direction; - - } - - void main() { - - vOutputDirection = getDirection( uv, faceIndex ); - gl_Position = vec4( position, 1.0 ); - - } - `; - } - function wm(r) { - let e = new WeakMap(), - t = null; - function n(o) { - if (o && o.isTexture) { - const l = o.mapping, - c = l === Tr || l === Na, - u = l === Ui || l === Bi; - if (c || u) - if (o.isRenderTargetTexture && o.needsPMREMUpdate === !0) { - o.needsPMREMUpdate = !1; - let h = e.get(o); - return ( - t === null && (t = new bl(r)), - (h = c ? t.fromEquirectangular(o, h) : t.fromCubemap(o, h)), - e.set(o, h), - h.texture - ); - } else { - if (e.has(o)) return e.get(o).texture; - { - const h = o.image; - if ((c && h && h.height > 0) || (u && h && i(h))) { - t === null && (t = new bl(r)); - const d = c ? t.fromEquirectangular(o) : t.fromCubemap(o); - return ( - e.set(o, d), o.addEventListener("dispose", s), d.texture - ); - } else return null; - } - } - } - return o; - } - function i(o) { - let l = 0; - const c = 6; - for (let u = 0; u < c; u++) o[u] !== void 0 && l++; - return l === c; - } - function s(o) { - const l = o.target; - l.removeEventListener("dispose", s); - const c = e.get(l); - c !== void 0 && (e.delete(l), c.dispose()); - } - function a() { - (e = new WeakMap()), t !== null && (t.dispose(), (t = null)); - } - return { get: n, dispose: a }; - } - function bm(r) { - const e = {}; - function t(n) { - if (e[n] !== void 0) return e[n]; - let i; - switch (n) { - case "WEBGL_depth_texture": - i = - r.getExtension("WEBGL_depth_texture") || - r.getExtension("MOZ_WEBGL_depth_texture") || - r.getExtension("WEBKIT_WEBGL_depth_texture"); - break; - case "EXT_texture_filter_anisotropic": - i = - r.getExtension("EXT_texture_filter_anisotropic") || - r.getExtension("MOZ_EXT_texture_filter_anisotropic") || - r.getExtension("WEBKIT_EXT_texture_filter_anisotropic"); - break; - case "WEBGL_compressed_texture_s3tc": - i = - r.getExtension("WEBGL_compressed_texture_s3tc") || - r.getExtension("MOZ_WEBGL_compressed_texture_s3tc") || - r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"); - break; - case "WEBGL_compressed_texture_pvrtc": - i = - r.getExtension("WEBGL_compressed_texture_pvrtc") || - r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"); - break; - default: - i = r.getExtension(n); - } - return (e[n] = i), i; - } - return { - has: function (n) { - return t(n) !== null; - }, - init: function (n) { - n.isWebGL2 - ? t("EXT_color_buffer_float") - : (t("WEBGL_depth_texture"), - t("OES_texture_float"), - t("OES_texture_half_float"), - t("OES_texture_half_float_linear"), - t("OES_standard_derivatives"), - t("OES_element_index_uint"), - t("OES_vertex_array_object"), - t("ANGLE_instanced_arrays")), - t("OES_texture_float_linear"), - t("EXT_color_buffer_half_float"), - t("WEBGL_multisampled_render_to_texture"); - }, - get: function (n) { - const i = t(n); - return ( - i === null && - console.warn( - "THREE.WebGLRenderer: " + n + " extension not supported." - ), - i - ); - }, - }; - } - function Sm(r, e, t, n) { - const i = {}, - s = new WeakMap(); - function a(h) { - const d = h.target; - d.index !== null && e.remove(d.index); - for (const g in d.attributes) e.remove(d.attributes[g]); - d.removeEventListener("dispose", a), delete i[d.id]; - const f = s.get(d); - f && (e.remove(f), s.delete(d)), - n.releaseStatesOfGeometry(d), - d.isInstancedBufferGeometry === !0 && delete d._maxInstanceCount, - t.memory.geometries--; - } - function o(h, d) { - return ( - i[d.id] === !0 || - (d.addEventListener("dispose", a), - (i[d.id] = !0), - t.memory.geometries++), - d - ); - } - function l(h) { - const d = h.attributes; - for (const g in d) e.update(d[g], 34962); - const f = h.morphAttributes; - for (const g in f) { - const m = f[g]; - for (let p = 0, v = m.length; p < v; p++) e.update(m[p], 34962); - } - } - function c(h) { - const d = [], - f = h.index, - g = h.attributes.position; - let m = 0; - if (f !== null) { - const M = f.array; - m = f.version; - for (let x = 0, w = M.length; x < w; x += 3) { - const y = M[x + 0], - A = M[x + 1], - L = M[x + 2]; - d.push(y, A, A, L, L, y); - } - } else { - const M = g.array; - m = g.version; - for (let x = 0, w = M.length / 3 - 1; x < w; x += 3) { - const y = x + 0, - A = x + 1, - L = x + 2; - d.push(y, A, A, L, L, y); - } - } - const p = new (Gc(d) ? $c : so)(d, 1); - p.version = m; - const v = s.get(h); - v && e.remove(v), s.set(h, p); - } - function u(h) { - const d = s.get(h); - if (d) { - const f = h.index; - f !== null && d.version < f.version && c(h); - } else c(h); - return s.get(h); - } - return { get: o, update: l, getWireframeAttribute: u }; - } - function Tm(r, e, t, n) { - const i = n.isWebGL2; - let s; - function a(d) { - s = d; - } - let o, l; - function c(d) { - (o = d.type), (l = d.bytesPerElement); - } - function u(d, f) { - r.drawElements(s, f, o, d * l), t.update(f, s, 1); - } - function h(d, f, g) { - if (g === 0) return; - let m, p; - if (i) (m = r), (p = "drawElementsInstanced"); - else if ( - ((m = e.get("ANGLE_instanced_arrays")), - (p = "drawElementsInstancedANGLE"), - m === null) - ) { - console.error( - "THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays." - ); - return; - } - m[p](s, f, o, d * l, g), t.update(f, s, g); - } - (this.setMode = a), - (this.setIndex = c), - (this.render = u), - (this.renderInstances = h); - } - function Em(r) { - const e = { geometries: 0, textures: 0 }, - t = { frame: 0, calls: 0, triangles: 0, points: 0, lines: 0 }; - function n(s, a, o) { - switch ((t.calls++, a)) { - case 4: - t.triangles += o * (s / 3); - break; - case 1: - t.lines += o * (s / 2); - break; - case 3: - t.lines += o * (s - 1); - break; - case 2: - t.lines += o * s; - break; - case 0: - t.points += o * s; - break; - default: - console.error("THREE.WebGLInfo: Unknown draw mode:", a); - break; - } - } - function i() { - t.frame++, - (t.calls = 0), - (t.triangles = 0), - (t.points = 0), - (t.lines = 0); - } - return { - memory: e, - render: t, - programs: null, - autoReset: !0, - reset: i, - update: n, - }; - } - function Am(r, e) { - return r[0] - e[0]; - } - function Cm(r, e) { - return Math.abs(e[1]) - Math.abs(r[1]); - } - function wa(r, e) { - let t = 1; - const n = e.isInterleavedBufferAttribute ? e.data.array : e.array; - n instanceof Int8Array - ? (t = 127) - : n instanceof Int16Array - ? (t = 32767) - : n instanceof Int32Array - ? (t = 2147483647) - : console.error( - "THREE.WebGLMorphtargets: Unsupported morph attribute data type: ", - n - ), - r.divideScalar(t); - } - function Lm(r, e, t) { - const n = {}, - i = new Float32Array(8), - s = new WeakMap(), - a = new Ue(), - o = []; - for (let c = 0; c < 8; c++) o[c] = [c, 0]; - function l(c, u, h, d) { - const f = c.morphTargetInfluences; - if (e.isWebGL2 === !0) { - const m = - u.morphAttributes.position || - u.morphAttributes.normal || - u.morphAttributes.color, - p = m !== void 0 ? m.length : 0; - let v = s.get(u); - if (v === void 0 || v.count !== p) { - let N = function () { - D.dispose(), s.delete(u), u.removeEventListener("dispose", N); - }; - var g = N; - v !== void 0 && v.texture.dispose(); - const w = u.morphAttributes.position !== void 0, - y = u.morphAttributes.normal !== void 0, - A = u.morphAttributes.color !== void 0, - L = u.morphAttributes.position || [], - _ = u.morphAttributes.normal || [], - T = u.morphAttributes.color || []; - let I = 0; - w === !0 && (I = 1), y === !0 && (I = 2), A === !0 && (I = 3); - let F = u.attributes.position.count * I, - H = 1; - F > e.maxTextureSize && - ((H = Math.ceil(F / e.maxTextureSize)), (F = e.maxTextureSize)); - const B = new Float32Array(F * H * 4 * p), - D = new Xc(B, F, H, p); - (D.type = Ft), (D.needsUpdate = !0); - const z = I * 4; - for (let k = 0; k < p; k++) { - const G = L[k], - U = _[k], - X = T[k], - Z = F * H * 4 * k; - for (let Y = 0; Y < G.count; Y++) { - const J = Y * z; - w === !0 && - (a.fromBufferAttribute(G, Y), - G.normalized === !0 && wa(a, G), - (B[Z + J + 0] = a.x), - (B[Z + J + 1] = a.y), - (B[Z + J + 2] = a.z), - (B[Z + J + 3] = 0)), - y === !0 && - (a.fromBufferAttribute(U, Y), - U.normalized === !0 && wa(a, U), - (B[Z + J + 4] = a.x), - (B[Z + J + 5] = a.y), - (B[Z + J + 6] = a.z), - (B[Z + J + 7] = 0)), - A === !0 && - (a.fromBufferAttribute(X, Y), - X.normalized === !0 && wa(a, X), - (B[Z + J + 8] = a.x), - (B[Z + J + 9] = a.y), - (B[Z + J + 10] = a.z), - (B[Z + J + 11] = X.itemSize === 4 ? a.w : 1)); - } - } - (v = { count: p, texture: D, size: new ve(F, H) }), - s.set(u, v), - u.addEventListener("dispose", N); - } - let M = 0; - for (let w = 0; w < f.length; w++) M += f[w]; - const x = u.morphTargetsRelative ? 1 : 1 - M; - d.getUniforms().setValue(r, "morphTargetBaseInfluence", x), - d.getUniforms().setValue(r, "morphTargetInfluences", f), - d.getUniforms().setValue(r, "morphTargetsTexture", v.texture, t), - d.getUniforms().setValue(r, "morphTargetsTextureSize", v.size); - } else { - const m = f === void 0 ? 0 : f.length; - let p = n[u.id]; - if (p === void 0 || p.length !== m) { - p = []; - for (let y = 0; y < m; y++) p[y] = [y, 0]; - n[u.id] = p; - } - for (let y = 0; y < m; y++) { - const A = p[y]; - (A[0] = y), (A[1] = f[y]); - } - p.sort(Cm); - for (let y = 0; y < 8; y++) - y < m && p[y][1] - ? ((o[y][0] = p[y][0]), (o[y][1] = p[y][1])) - : ((o[y][0] = Number.MAX_SAFE_INTEGER), (o[y][1] = 0)); - o.sort(Am); - const v = u.morphAttributes.position, - M = u.morphAttributes.normal; - let x = 0; - for (let y = 0; y < 8; y++) { - const A = o[y], - L = A[0], - _ = A[1]; - L !== Number.MAX_SAFE_INTEGER && _ - ? (v && - u.getAttribute("morphTarget" + y) !== v[L] && - u.setAttribute("morphTarget" + y, v[L]), - M && - u.getAttribute("morphNormal" + y) !== M[L] && - u.setAttribute("morphNormal" + y, M[L]), - (i[y] = _), - (x += _)) - : (v && - u.hasAttribute("morphTarget" + y) === !0 && - u.deleteAttribute("morphTarget" + y), - M && - u.hasAttribute("morphNormal" + y) === !0 && - u.deleteAttribute("morphNormal" + y), - (i[y] = 0)); - } - const w = u.morphTargetsRelative ? 1 : 1 - x; - d.getUniforms().setValue(r, "morphTargetBaseInfluence", w), - d.getUniforms().setValue(r, "morphTargetInfluences", i); - } - } - return { update: l }; - } - function Rm(r, e, t, n) { - let i = new WeakMap(); - function s(l) { - const c = n.render.frame, - u = l.geometry, - h = e.get(l, u); - return ( - i.get(h) !== c && (e.update(h), i.set(h, c)), - l.isInstancedMesh && - (l.hasEventListener("dispose", o) === !1 && - l.addEventListener("dispose", o), - t.update(l.instanceMatrix, 34962), - l.instanceColor !== null && t.update(l.instanceColor, 34962)), - h - ); - } - function a() { - i = new WeakMap(); - } - function o(l) { - const c = l.target; - c.removeEventListener("dispose", o), - t.remove(c.instanceMatrix), - c.instanceColor !== null && t.remove(c.instanceColor); - } - return { update: s, dispose: a }; - } - const Jc = new nt(), - Qc = new Xc(), - eh = new xd(), - th = new Kc(), - Al = [], - Cl = [], - Ll = new Float32Array(16), - Rl = new Float32Array(9), - Pl = new Float32Array(4); - function Ji(r, e, t) { - const n = r[0]; - if (n <= 0 || n > 0) return r; - const i = e * t; - let s = Al[i]; - if ( - (s === void 0 && ((s = new Float32Array(i)), (Al[i] = s)), e !== 0) - ) { - n.toArray(s, 0); - for (let a = 1, o = 0; a !== e; ++a) (o += t), r[a].toArray(s, o); - } - return s; - } - function bt(r, e) { - if (r.length !== e.length) return !1; - for (let t = 0, n = r.length; t < n; t++) if (r[t] !== e[t]) return !1; - return !0; - } - function St(r, e) { - for (let t = 0, n = e.length; t < n; t++) r[t] = e[t]; - } - function kr(r, e) { - let t = Cl[e]; - t === void 0 && ((t = new Int32Array(e)), (Cl[e] = t)); - for (let n = 0; n !== e; ++n) t[n] = r.allocateTextureUnit(); - return t; - } - function Pm(r, e) { - const t = this.cache; - t[0] !== e && (r.uniform1f(this.addr, e), (t[0] = e)); - } - function Dm(r, e) { - const t = this.cache; - if (e.x !== void 0) - (t[0] !== e.x || t[1] !== e.y) && - (r.uniform2f(this.addr, e.x, e.y), (t[0] = e.x), (t[1] = e.y)); - else { - if (bt(t, e)) return; - r.uniform2fv(this.addr, e), St(t, e); - } - } - function Im(r, e) { - const t = this.cache; - if (e.x !== void 0) - (t[0] !== e.x || t[1] !== e.y || t[2] !== e.z) && - (r.uniform3f(this.addr, e.x, e.y, e.z), - (t[0] = e.x), - (t[1] = e.y), - (t[2] = e.z)); - else if (e.r !== void 0) - (t[0] !== e.r || t[1] !== e.g || t[2] !== e.b) && - (r.uniform3f(this.addr, e.r, e.g, e.b), - (t[0] = e.r), - (t[1] = e.g), - (t[2] = e.b)); - else { - if (bt(t, e)) return; - r.uniform3fv(this.addr, e), St(t, e); - } - } - function Fm(r, e) { - const t = this.cache; - if (e.x !== void 0) - (t[0] !== e.x || t[1] !== e.y || t[2] !== e.z || t[3] !== e.w) && - (r.uniform4f(this.addr, e.x, e.y, e.z, e.w), - (t[0] = e.x), - (t[1] = e.y), - (t[2] = e.z), - (t[3] = e.w)); - else { - if (bt(t, e)) return; - r.uniform4fv(this.addr, e), St(t, e); - } - } - function Nm(r, e) { - const t = this.cache, - n = e.elements; - if (n === void 0) { - if (bt(t, e)) return; - r.uniformMatrix2fv(this.addr, !1, e), St(t, e); - } else { - if (bt(t, n)) return; - Pl.set(n), r.uniformMatrix2fv(this.addr, !1, Pl), St(t, n); - } - } - function zm(r, e) { - const t = this.cache, - n = e.elements; - if (n === void 0) { - if (bt(t, e)) return; - r.uniformMatrix3fv(this.addr, !1, e), St(t, e); - } else { - if (bt(t, n)) return; - Rl.set(n), r.uniformMatrix3fv(this.addr, !1, Rl), St(t, n); - } - } - function Om(r, e) { - const t = this.cache, - n = e.elements; - if (n === void 0) { - if (bt(t, e)) return; - r.uniformMatrix4fv(this.addr, !1, e), St(t, e); - } else { - if (bt(t, n)) return; - Ll.set(n), r.uniformMatrix4fv(this.addr, !1, Ll), St(t, n); - } - } - function km(r, e) { - const t = this.cache; - t[0] !== e && (r.uniform1i(this.addr, e), (t[0] = e)); - } - function Um(r, e) { - const t = this.cache; - bt(t, e) || (r.uniform2iv(this.addr, e), St(t, e)); - } - function Bm(r, e) { - const t = this.cache; - bt(t, e) || (r.uniform3iv(this.addr, e), St(t, e)); - } - function Vm(r, e) { - const t = this.cache; - bt(t, e) || (r.uniform4iv(this.addr, e), St(t, e)); - } - function Gm(r, e) { - const t = this.cache; - t[0] !== e && (r.uniform1ui(this.addr, e), (t[0] = e)); - } - function Hm(r, e) { - const t = this.cache; - bt(t, e) || (r.uniform2uiv(this.addr, e), St(t, e)); - } - function Wm(r, e) { - const t = this.cache; - bt(t, e) || (r.uniform3uiv(this.addr, e), St(t, e)); - } - function jm(r, e) { - const t = this.cache; - bt(t, e) || (r.uniform4uiv(this.addr, e), St(t, e)); - } - function Xm(r, e, t) { - const n = this.cache, - i = t.allocateTextureUnit(); - n[0] !== i && (r.uniform1i(this.addr, i), (n[0] = i)), - t.setTexture2D(e || Jc, i); - } - function qm(r, e, t) { - const n = this.cache, - i = t.allocateTextureUnit(); - n[0] !== i && (r.uniform1i(this.addr, i), (n[0] = i)), - t.setTexture3D(e || eh, i); - } - function $m(r, e, t) { - const n = this.cache, - i = t.allocateTextureUnit(); - n[0] !== i && (r.uniform1i(this.addr, i), (n[0] = i)), - t.setTextureCube(e || th, i); - } - function Ym(r, e, t) { - const n = this.cache, - i = t.allocateTextureUnit(); - n[0] !== i && (r.uniform1i(this.addr, i), (n[0] = i)), - t.setTexture2DArray(e || Qc, i); - } - function Km(r) { - switch (r) { - case 5126: - return Pm; - case 35664: - return Dm; - case 35665: - return Im; - case 35666: - return Fm; - case 35674: - return Nm; - case 35675: - return zm; - case 35676: - return Om; - case 5124: - case 35670: - return km; - case 35667: - case 35671: - return Um; - case 35668: - case 35672: - return Bm; - case 35669: - case 35673: - return Vm; - case 5125: - return Gm; - case 36294: - return Hm; - case 36295: - return Wm; - case 36296: - return jm; - case 35678: - case 36198: - case 36298: - case 36306: - case 35682: - return Xm; - case 35679: - case 36299: - case 36307: - return qm; - case 35680: - case 36300: - case 36308: - case 36293: - return $m; - case 36289: - case 36303: - case 36311: - case 36292: - return Ym; - } - } - function Zm(r, e) { - r.uniform1fv(this.addr, e); - } - function Jm(r, e) { - const t = Ji(e, this.size, 2); - r.uniform2fv(this.addr, t); - } - function Qm(r, e) { - const t = Ji(e, this.size, 3); - r.uniform3fv(this.addr, t); - } - function eg(r, e) { - const t = Ji(e, this.size, 4); - r.uniform4fv(this.addr, t); - } - function tg(r, e) { - const t = Ji(e, this.size, 4); - r.uniformMatrix2fv(this.addr, !1, t); - } - function ng(r, e) { - const t = Ji(e, this.size, 9); - r.uniformMatrix3fv(this.addr, !1, t); - } - function ig(r, e) { - const t = Ji(e, this.size, 16); - r.uniformMatrix4fv(this.addr, !1, t); - } - function sg(r, e) { - r.uniform1iv(this.addr, e); - } - function rg(r, e) { - r.uniform2iv(this.addr, e); - } - function ag(r, e) { - r.uniform3iv(this.addr, e); - } - function og(r, e) { - r.uniform4iv(this.addr, e); - } - function lg(r, e) { - r.uniform1uiv(this.addr, e); - } - function cg(r, e) { - r.uniform2uiv(this.addr, e); - } - function hg(r, e) { - r.uniform3uiv(this.addr, e); - } - function ug(r, e) { - r.uniform4uiv(this.addr, e); - } - function dg(r, e, t) { - const n = e.length, - i = kr(t, n); - r.uniform1iv(this.addr, i); - for (let s = 0; s !== n; ++s) t.setTexture2D(e[s] || Jc, i[s]); - } - function fg(r, e, t) { - const n = e.length, - i = kr(t, n); - r.uniform1iv(this.addr, i); - for (let s = 0; s !== n; ++s) t.setTexture3D(e[s] || eh, i[s]); - } - function pg(r, e, t) { - const n = e.length, - i = kr(t, n); - r.uniform1iv(this.addr, i); - for (let s = 0; s !== n; ++s) t.setTextureCube(e[s] || th, i[s]); - } - function mg(r, e, t) { - const n = e.length, - i = kr(t, n); - r.uniform1iv(this.addr, i); - for (let s = 0; s !== n; ++s) t.setTexture2DArray(e[s] || Qc, i[s]); - } - function gg(r) { - switch (r) { - case 5126: - return Zm; - case 35664: - return Jm; - case 35665: - return Qm; - case 35666: - return eg; - case 35674: - return tg; - case 35675: - return ng; - case 35676: - return ig; - case 5124: - case 35670: - return sg; - case 35667: - case 35671: - return rg; - case 35668: - case 35672: - return ag; - case 35669: - case 35673: - return og; - case 5125: - return lg; - case 36294: - return cg; - case 36295: - return hg; - case 36296: - return ug; - case 35678: - case 36198: - case 36298: - case 36306: - case 35682: - return dg; - case 35679: - case 36299: - case 36307: - return fg; - case 35680: - case 36300: - case 36308: - case 36293: - return pg; - case 36289: - case 36303: - case 36311: - case 36292: - return mg; - } - } - class vg { - constructor(e, t, n) { - (this.id = e), - (this.addr = n), - (this.cache = []), - (this.setValue = Km(t.type)); - } - } - class _g { - constructor(e, t, n) { - (this.id = e), - (this.addr = n), - (this.cache = []), - (this.size = t.size), - (this.setValue = gg(t.type)); - } - } - class xg { - constructor(e) { - (this.id = e), (this.seq = []), (this.map = {}); - } - setValue(e, t, n) { - const i = this.seq; - for (let s = 0, a = i.length; s !== a; ++s) { - const o = i[s]; - o.setValue(e, t[o.id], n); - } - } - } - const ba = /(\w+)(\])?(\[|\.)?/g; - function Dl(r, e) { - r.seq.push(e), (r.map[e.id] = e); - } - function yg(r, e, t) { - const n = r.name, - i = n.length; - for (ba.lastIndex = 0; ; ) { - const s = ba.exec(n), - a = ba.lastIndex; - let o = s[1]; - const l = s[2] === "]", - c = s[3]; - if ((l && (o = o | 0), c === void 0 || (c === "[" && a + 2 === i))) { - Dl(t, c === void 0 ? new vg(o, r, e) : new _g(o, r, e)); - break; - } else { - let h = t.map[o]; - h === void 0 && ((h = new xg(o)), Dl(t, h)), (t = h); - } - } - } - class _r { - constructor(e, t) { - (this.seq = []), (this.map = {}); - const n = e.getProgramParameter(t, 35718); - for (let i = 0; i < n; ++i) { - const s = e.getActiveUniform(t, i), - a = e.getUniformLocation(t, s.name); - yg(s, a, this); - } - } - setValue(e, t, n, i) { - const s = this.map[t]; - s !== void 0 && s.setValue(e, n, i); - } - setOptional(e, t, n) { - const i = t[n]; - i !== void 0 && this.setValue(e, n, i); - } - static upload(e, t, n, i) { - for (let s = 0, a = t.length; s !== a; ++s) { - const o = t[s], - l = n[o.id]; - l.needsUpdate !== !1 && o.setValue(e, l.value, i); - } - } - static seqWithValue(e, t) { - const n = []; - for (let i = 0, s = e.length; i !== s; ++i) { - const a = e[i]; - a.id in t && n.push(a); - } - return n; - } - } - function Il(r, e, t) { - const n = r.createShader(e); - return r.shaderSource(n, t), r.compileShader(n), n; - } - let Mg = 0; - function wg(r, e) { - const t = r.split(` -`), - n = [], - i = Math.max(e - 6, 0), - s = Math.min(e + 6, t.length); - for (let a = i; a < s; a++) { - const o = a + 1; - n.push(`${o === e ? ">" : " "} ${o}: ${t[a]}`); - } - return n.join(` -`); - } - function bg(r) { - switch (r) { - case Vn: - return ["Linear", "( value )"]; - case Pe: - return ["sRGB", "( value )"]; - default: - return ( - console.warn("THREE.WebGLProgram: Unsupported encoding:", r), - ["Linear", "( value )"] - ); - } - } - function Fl(r, e, t) { - const n = r.getShaderParameter(e, 35713), - i = r.getShaderInfoLog(e).trim(); - if (n && i === "") return ""; - const s = /ERROR: 0:(\d+)/.exec(i); - if (s) { - const a = parseInt(s[1]); - return ( - t.toUpperCase() + - ` - -` + - i + - ` - -` + - wg(r.getShaderSource(e), a) - ); - } else return i; - } - function Sg(r, e) { - const t = bg(e); - return ( - "vec4 " + r + "( vec4 value ) { return LinearTo" + t[0] + t[1] + "; }" - ); - } - function Tg(r, e) { - let t; - switch (e) { - case Dc: - t = "Linear"; - break; - case Ic: - t = "Reinhard"; - break; - case Fc: - t = "OptimizedCineon"; - break; - case Nc: - t = "ACESFilmic"; - break; - case Nu: - t = "Custom"; - break; - default: - console.warn("THREE.WebGLProgram: Unsupported toneMapping:", e), - (t = "Linear"); - } - return ( - "vec3 " + - r + - "( vec3 color ) { return " + - t + - "ToneMapping( color ); }" - ); - } - function Eg(r) { - return [ - r.extensionDerivatives || - !!r.envMapCubeUVHeight || - r.bumpMap || - r.tangentSpaceNormalMap || - r.clearcoatNormalMap || - r.flatShading || - r.shaderID === "physical" - ? "#extension GL_OES_standard_derivatives : enable" - : "", - (r.extensionFragDepth || r.logarithmicDepthBuffer) && - r.rendererExtensionFragDepth - ? "#extension GL_EXT_frag_depth : enable" - : "", - r.extensionDrawBuffers && r.rendererExtensionDrawBuffers - ? "#extension GL_EXT_draw_buffers : require" - : "", - (r.extensionShaderTextureLOD || r.envMap || r.transmission) && - r.rendererExtensionShaderTextureLod - ? "#extension GL_EXT_shader_texture_lod : enable" - : "", - ].filter(xs).join(` -`); - } - function Ag(r) { - const e = []; - for (const t in r) { - const n = r[t]; - n !== !1 && e.push("#define " + t + " " + n); - } - return e.join(` -`); - } - function Cg(r, e) { - const t = {}, - n = r.getProgramParameter(e, 35721); - for (let i = 0; i < n; i++) { - const s = r.getActiveAttrib(e, i), - a = s.name; - let o = 1; - s.type === 35674 && (o = 2), - s.type === 35675 && (o = 3), - s.type === 35676 && (o = 4), - (t[a] = { - type: s.type, - location: r.getAttribLocation(e, a), - locationSize: o, - }); - } - return t; - } - function xs(r) { - return r !== ""; - } - function Nl(r, e) { - return r - .replace(/NUM_DIR_LIGHTS/g, e.numDirLights) - .replace(/NUM_SPOT_LIGHTS/g, e.numSpotLights) - .replace(/NUM_RECT_AREA_LIGHTS/g, e.numRectAreaLights) - .replace(/NUM_POINT_LIGHTS/g, e.numPointLights) - .replace(/NUM_HEMI_LIGHTS/g, e.numHemiLights) - .replace(/NUM_DIR_LIGHT_SHADOWS/g, e.numDirLightShadows) - .replace(/NUM_SPOT_LIGHT_SHADOWS/g, e.numSpotLightShadows) - .replace(/NUM_POINT_LIGHT_SHADOWS/g, e.numPointLightShadows); - } - function zl(r, e) { - return r - .replace(/NUM_CLIPPING_PLANES/g, e.numClippingPlanes) - .replace( - /UNION_CLIPPING_PLANES/g, - e.numClippingPlanes - e.numClipIntersection - ); - } - const Lg = /^[ \t]*#include +<([\w\d./]+)>/gm; - function Va(r) { - return r.replace(Lg, Rg); - } - function Rg(r, e) { - const t = Ae[e]; - if (t === void 0) - throw new Error("Can not resolve #include <" + e + ">"); - return Va(t); - } - const Pg = - /#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g, - Dg = - /#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g; - function Ol(r) { - return r.replace(Dg, nh).replace(Pg, Ig); - } - function Ig(r, e, t, n) { - return ( - console.warn( - "WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead." - ), - nh(r, e, t, n) - ); - } - function nh(r, e, t, n) { - let i = ""; - for (let s = parseInt(e); s < parseInt(t); s++) - i += n - .replace(/\[\s*i\s*\]/g, "[ " + s + " ]") - .replace(/UNROLLED_LOOP_INDEX/g, s); - return i; - } - function kl(r) { - let e = - "precision " + - r.precision + - ` float; -precision ` + - r.precision + - " int;"; - return ( - r.precision === "highp" - ? (e += ` -#define HIGH_PRECISION`) - : r.precision === "mediump" - ? (e += ` -#define MEDIUM_PRECISION`) - : r.precision === "lowp" && - (e += ` -#define LOW_PRECISION`), - e - ); - } - function Fg(r) { - let e = "SHADOWMAP_TYPE_BASIC"; - return ( - r.shadowMapType === Cc - ? (e = "SHADOWMAP_TYPE_PCF") - : r.shadowMapType === Lc - ? (e = "SHADOWMAP_TYPE_PCF_SOFT") - : r.shadowMapType === _s && (e = "SHADOWMAP_TYPE_VSM"), - e - ); - } - function Ng(r) { - let e = "ENVMAP_TYPE_CUBE"; - if (r.envMap) - switch (r.envMapMode) { - case Ui: - case Bi: - e = "ENVMAP_TYPE_CUBE"; - break; - case Or: - e = "ENVMAP_TYPE_CUBE_UV"; - break; - } - return e; - } - function zg(r) { - let e = "ENVMAP_MODE_REFLECTION"; - if (r.envMap) - switch (r.envMapMode) { - case Bi: - e = "ENVMAP_MODE_REFRACTION"; - break; - } - return e; - } - function Og(r) { - let e = "ENVMAP_BLENDING_NONE"; - if (r.envMap) - switch (r.combine) { - case zr: - e = "ENVMAP_BLENDING_MULTIPLY"; - break; - case Iu: - e = "ENVMAP_BLENDING_MIX"; - break; - case Fu: - e = "ENVMAP_BLENDING_ADD"; - break; - } - return e; - } - function kg(r) { - const e = r.envMapCubeUVHeight; - if (e === null) return null; - const t = Math.log2(e) - 2, - n = 1 / e; - return { - texelWidth: 1 / (3 * Math.max(Math.pow(2, t), 7 * 16)), - texelHeight: n, - maxMip: t, - }; - } - function Ug(r, e, t, n) { - const i = r.getContext(), - s = t.defines; - let a = t.vertexShader, - o = t.fragmentShader; - const l = Fg(t), - c = Ng(t), - u = zg(t), - h = Og(t), - d = kg(t), - f = t.isWebGL2 ? "" : Eg(t), - g = Ag(s), - m = i.createProgram(); - let p, - v, - M = t.glslVersion - ? "#version " + - t.glslVersion + - ` -` - : ""; - t.isRawShaderMaterial - ? ((p = [g].filter(xs).join(` -`)), - p.length > 0 && - (p += ` -`), - (v = [f, g].filter(xs).join(` -`)), - v.length > 0 && - (v += ` -`)) - : ((p = [ - kl(t), - "#define SHADER_NAME " + t.shaderName, - g, - t.instancing ? "#define USE_INSTANCING" : "", - t.instancingColor ? "#define USE_INSTANCING_COLOR" : "", - t.supportsVertexTextures ? "#define VERTEX_TEXTURES" : "", - t.useFog && t.fog ? "#define USE_FOG" : "", - t.useFog && t.fogExp2 ? "#define FOG_EXP2" : "", - t.map ? "#define USE_MAP" : "", - t.envMap ? "#define USE_ENVMAP" : "", - t.envMap ? "#define " + u : "", - t.lightMap ? "#define USE_LIGHTMAP" : "", - t.aoMap ? "#define USE_AOMAP" : "", - t.emissiveMap ? "#define USE_EMISSIVEMAP" : "", - t.bumpMap ? "#define USE_BUMPMAP" : "", - t.normalMap ? "#define USE_NORMALMAP" : "", - t.normalMap && t.objectSpaceNormalMap - ? "#define OBJECTSPACE_NORMALMAP" - : "", - t.normalMap && t.tangentSpaceNormalMap - ? "#define TANGENTSPACE_NORMALMAP" - : "", - t.clearcoatMap ? "#define USE_CLEARCOATMAP" : "", - t.clearcoatRoughnessMap - ? "#define USE_CLEARCOAT_ROUGHNESSMAP" - : "", - t.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "", - t.iridescenceMap ? "#define USE_IRIDESCENCEMAP" : "", - t.iridescenceThicknessMap - ? "#define USE_IRIDESCENCE_THICKNESSMAP" - : "", - t.displacementMap && t.supportsVertexTextures - ? "#define USE_DISPLACEMENTMAP" - : "", - t.specularMap ? "#define USE_SPECULARMAP" : "", - t.specularIntensityMap ? "#define USE_SPECULARINTENSITYMAP" : "", - t.specularColorMap ? "#define USE_SPECULARCOLORMAP" : "", - t.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", - t.metalnessMap ? "#define USE_METALNESSMAP" : "", - t.alphaMap ? "#define USE_ALPHAMAP" : "", - t.transmission ? "#define USE_TRANSMISSION" : "", - t.transmissionMap ? "#define USE_TRANSMISSIONMAP" : "", - t.thicknessMap ? "#define USE_THICKNESSMAP" : "", - t.sheenColorMap ? "#define USE_SHEENCOLORMAP" : "", - t.sheenRoughnessMap ? "#define USE_SHEENROUGHNESSMAP" : "", - t.vertexTangents ? "#define USE_TANGENT" : "", - t.vertexColors ? "#define USE_COLOR" : "", - t.vertexAlphas ? "#define USE_COLOR_ALPHA" : "", - t.vertexUvs ? "#define USE_UV" : "", - t.uvsVertexOnly ? "#define UVS_VERTEX_ONLY" : "", - t.flatShading ? "#define FLAT_SHADED" : "", - t.skinning ? "#define USE_SKINNING" : "", - t.morphTargets ? "#define USE_MORPHTARGETS" : "", - t.morphNormals && t.flatShading === !1 - ? "#define USE_MORPHNORMALS" - : "", - t.morphColors && t.isWebGL2 ? "#define USE_MORPHCOLORS" : "", - t.morphTargetsCount > 0 && t.isWebGL2 - ? "#define MORPHTARGETS_TEXTURE" - : "", - t.morphTargetsCount > 0 && t.isWebGL2 - ? "#define MORPHTARGETS_TEXTURE_STRIDE " + t.morphTextureStride - : "", - t.morphTargetsCount > 0 && t.isWebGL2 - ? "#define MORPHTARGETS_COUNT " + t.morphTargetsCount - : "", - t.doubleSided ? "#define DOUBLE_SIDED" : "", - t.flipSided ? "#define FLIP_SIDED" : "", - t.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", - t.shadowMapEnabled ? "#define " + l : "", - t.sizeAttenuation ? "#define USE_SIZEATTENUATION" : "", - t.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", - t.logarithmicDepthBuffer && t.rendererExtensionFragDepth - ? "#define USE_LOGDEPTHBUF_EXT" - : "", - "uniform mat4 modelMatrix;", - "uniform mat4 modelViewMatrix;", - "uniform mat4 projectionMatrix;", - "uniform mat4 viewMatrix;", - "uniform mat3 normalMatrix;", - "uniform vec3 cameraPosition;", - "uniform bool isOrthographic;", - "#ifdef USE_INSTANCING", - " attribute mat4 instanceMatrix;", - "#endif", - "#ifdef USE_INSTANCING_COLOR", - " attribute vec3 instanceColor;", - "#endif", - "attribute vec3 position;", - "attribute vec3 normal;", - "attribute vec2 uv;", - "#ifdef USE_TANGENT", - " attribute vec4 tangent;", - "#endif", - "#if defined( USE_COLOR_ALPHA )", - " attribute vec4 color;", - "#elif defined( USE_COLOR )", - " attribute vec3 color;", - "#endif", - "#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )", - " attribute vec3 morphTarget0;", - " attribute vec3 morphTarget1;", - " attribute vec3 morphTarget2;", - " attribute vec3 morphTarget3;", - " #ifdef USE_MORPHNORMALS", - " attribute vec3 morphNormal0;", - " attribute vec3 morphNormal1;", - " attribute vec3 morphNormal2;", - " attribute vec3 morphNormal3;", - " #else", - " attribute vec3 morphTarget4;", - " attribute vec3 morphTarget5;", - " attribute vec3 morphTarget6;", - " attribute vec3 morphTarget7;", - " #endif", - "#endif", - "#ifdef USE_SKINNING", - " attribute vec4 skinIndex;", - " attribute vec4 skinWeight;", - "#endif", - ` -`, - ].filter(xs).join(` -`)), - (v = [ - f, - kl(t), - "#define SHADER_NAME " + t.shaderName, - g, - t.useFog && t.fog ? "#define USE_FOG" : "", - t.useFog && t.fogExp2 ? "#define FOG_EXP2" : "", - t.map ? "#define USE_MAP" : "", - t.matcap ? "#define USE_MATCAP" : "", - t.envMap ? "#define USE_ENVMAP" : "", - t.envMap ? "#define " + c : "", - t.envMap ? "#define " + u : "", - t.envMap ? "#define " + h : "", - d ? "#define CUBEUV_TEXEL_WIDTH " + d.texelWidth : "", - d ? "#define CUBEUV_TEXEL_HEIGHT " + d.texelHeight : "", - d ? "#define CUBEUV_MAX_MIP " + d.maxMip + ".0" : "", - t.lightMap ? "#define USE_LIGHTMAP" : "", - t.aoMap ? "#define USE_AOMAP" : "", - t.emissiveMap ? "#define USE_EMISSIVEMAP" : "", - t.bumpMap ? "#define USE_BUMPMAP" : "", - t.normalMap ? "#define USE_NORMALMAP" : "", - t.normalMap && t.objectSpaceNormalMap - ? "#define OBJECTSPACE_NORMALMAP" - : "", - t.normalMap && t.tangentSpaceNormalMap - ? "#define TANGENTSPACE_NORMALMAP" - : "", - t.clearcoat ? "#define USE_CLEARCOAT" : "", - t.clearcoatMap ? "#define USE_CLEARCOATMAP" : "", - t.clearcoatRoughnessMap - ? "#define USE_CLEARCOAT_ROUGHNESSMAP" - : "", - t.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "", - t.iridescence ? "#define USE_IRIDESCENCE" : "", - t.iridescenceMap ? "#define USE_IRIDESCENCEMAP" : "", - t.iridescenceThicknessMap - ? "#define USE_IRIDESCENCE_THICKNESSMAP" - : "", - t.specularMap ? "#define USE_SPECULARMAP" : "", - t.specularIntensityMap ? "#define USE_SPECULARINTENSITYMAP" : "", - t.specularColorMap ? "#define USE_SPECULARCOLORMAP" : "", - t.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", - t.metalnessMap ? "#define USE_METALNESSMAP" : "", - t.alphaMap ? "#define USE_ALPHAMAP" : "", - t.alphaTest ? "#define USE_ALPHATEST" : "", - t.sheen ? "#define USE_SHEEN" : "", - t.sheenColorMap ? "#define USE_SHEENCOLORMAP" : "", - t.sheenRoughnessMap ? "#define USE_SHEENROUGHNESSMAP" : "", - t.transmission ? "#define USE_TRANSMISSION" : "", - t.transmissionMap ? "#define USE_TRANSMISSIONMAP" : "", - t.thicknessMap ? "#define USE_THICKNESSMAP" : "", - t.decodeVideoTexture ? "#define DECODE_VIDEO_TEXTURE" : "", - t.vertexTangents ? "#define USE_TANGENT" : "", - t.vertexColors || t.instancingColor ? "#define USE_COLOR" : "", - t.vertexAlphas ? "#define USE_COLOR_ALPHA" : "", - t.vertexUvs ? "#define USE_UV" : "", - t.uvsVertexOnly ? "#define UVS_VERTEX_ONLY" : "", - t.gradientMap ? "#define USE_GRADIENTMAP" : "", - t.flatShading ? "#define FLAT_SHADED" : "", - t.doubleSided ? "#define DOUBLE_SIDED" : "", - t.flipSided ? "#define FLIP_SIDED" : "", - t.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", - t.shadowMapEnabled ? "#define " + l : "", - t.premultipliedAlpha ? "#define PREMULTIPLIED_ALPHA" : "", - t.physicallyCorrectLights - ? "#define PHYSICALLY_CORRECT_LIGHTS" - : "", - t.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", - t.logarithmicDepthBuffer && t.rendererExtensionFragDepth - ? "#define USE_LOGDEPTHBUF_EXT" - : "", - "uniform mat4 viewMatrix;", - "uniform vec3 cameraPosition;", - "uniform bool isOrthographic;", - t.toneMapping !== $t ? "#define TONE_MAPPING" : "", - t.toneMapping !== $t ? Ae.tonemapping_pars_fragment : "", - t.toneMapping !== $t ? Tg("toneMapping", t.toneMapping) : "", - t.dithering ? "#define DITHERING" : "", - t.opaque ? "#define OPAQUE" : "", - Ae.encodings_pars_fragment, - Sg("linearToOutputTexel", t.outputEncoding), - t.useDepthPacking - ? "#define DEPTH_PACKING " + t.depthPacking - : "", - ` -`, - ].filter(xs).join(` -`))), - (a = Va(a)), - (a = Nl(a, t)), - (a = zl(a, t)), - (o = Va(o)), - (o = Nl(o, t)), - (o = zl(o, t)), - (a = Ol(a)), - (o = Ol(o)), - t.isWebGL2 && - t.isRawShaderMaterial !== !0 && - ((M = `#version 300 es -`), - (p = - [ - "precision mediump sampler2DArray;", - "#define attribute in", - "#define varying out", - "#define texture2D texture", - ].join(` -`) + - ` -` + - p), - (v = - [ - "#define varying in", - t.glslVersion === Tn - ? "" - : "layout(location = 0) out highp vec4 pc_fragColor;", - t.glslVersion === Tn ? "" : "#define gl_FragColor pc_fragColor", - "#define gl_FragDepthEXT gl_FragDepth", - "#define texture2D texture", - "#define textureCube texture", - "#define texture2DProj textureProj", - "#define texture2DLodEXT textureLod", - "#define texture2DProjLodEXT textureProjLod", - "#define textureCubeLodEXT textureLod", - "#define texture2DGradEXT textureGrad", - "#define texture2DProjGradEXT textureProjGrad", - "#define textureCubeGradEXT textureGrad", - ].join(` -`) + - ` -` + - v)); - const x = M + p + a, - w = M + v + o, - y = Il(i, 35633, x), - A = Il(i, 35632, w); - if ( - (i.attachShader(m, y), - i.attachShader(m, A), - t.index0AttributeName !== void 0 - ? i.bindAttribLocation(m, 0, t.index0AttributeName) - : t.morphTargets === !0 && i.bindAttribLocation(m, 0, "position"), - i.linkProgram(m), - r.debug.checkShaderErrors) - ) { - const T = i.getProgramInfoLog(m).trim(), - I = i.getShaderInfoLog(y).trim(), - F = i.getShaderInfoLog(A).trim(); - let H = !0, - B = !0; - if (i.getProgramParameter(m, 35714) === !1) { - H = !1; - const D = Fl(i, y, "vertex"), - z = Fl(i, A, "fragment"); - console.error( - "THREE.WebGLProgram: Shader Error " + - i.getError() + - " - VALIDATE_STATUS " + - i.getProgramParameter(m, 35715) + - ` - -Program Info Log: ` + - T + - ` -` + - D + - ` -` + - z - ); - } else - T !== "" - ? console.warn("THREE.WebGLProgram: Program Info Log:", T) - : (I === "" || F === "") && (B = !1); - B && - (this.diagnostics = { - runnable: H, - programLog: T, - vertexShader: { log: I, prefix: p }, - fragmentShader: { log: F, prefix: v }, - }); - } - i.deleteShader(y), i.deleteShader(A); - let L; - this.getUniforms = function () { - return L === void 0 && (L = new _r(i, m)), L; - }; - let _; - return ( - (this.getAttributes = function () { - return _ === void 0 && (_ = Cg(i, m)), _; - }), - (this.destroy = function () { - n.releaseStatesOfProgram(this), - i.deleteProgram(m), - (this.program = void 0); - }), - (this.name = t.shaderName), - (this.id = Mg++), - (this.cacheKey = e), - (this.usedTimes = 1), - (this.program = m), - (this.vertexShader = y), - (this.fragmentShader = A), - this - ); - } - let Bg = 0; - class Vg { - constructor() { - (this.shaderCache = new Map()), (this.materialCache = new Map()); - } - update(e) { - const t = e.vertexShader, - n = e.fragmentShader, - i = this._getShaderStage(t), - s = this._getShaderStage(n), - a = this._getShaderCacheForMaterial(e); - return ( - a.has(i) === !1 && (a.add(i), i.usedTimes++), - a.has(s) === !1 && (a.add(s), s.usedTimes++), - this - ); - } - remove(e) { - const t = this.materialCache.get(e); - for (const n of t) - n.usedTimes--, n.usedTimes === 0 && this.shaderCache.delete(n.code); - return this.materialCache.delete(e), this; - } - getVertexShaderID(e) { - return this._getShaderStage(e.vertexShader).id; - } - getFragmentShaderID(e) { - return this._getShaderStage(e.fragmentShader).id; - } - dispose() { - this.shaderCache.clear(), this.materialCache.clear(); - } - _getShaderCacheForMaterial(e) { - const t = this.materialCache; - return t.has(e) === !1 && t.set(e, new Set()), t.get(e); - } - _getShaderStage(e) { - const t = this.shaderCache; - if (t.has(e) === !1) { - const n = new Gg(e); - t.set(e, n); - } - return t.get(e); - } - } - class Gg { - constructor(e) { - (this.id = Bg++), (this.code = e), (this.usedTimes = 0); - } - } - function Hg(r, e, t, n, i, s, a) { - const o = new qc(), - l = new Vg(), - c = [], - u = i.isWebGL2, - h = i.logarithmicDepthBuffer, - d = i.vertexTextures; - let f = i.precision; - const g = { - MeshDepthMaterial: "depth", - MeshDistanceMaterial: "distanceRGBA", - MeshNormalMaterial: "normal", - MeshBasicMaterial: "basic", - MeshLambertMaterial: "lambert", - MeshPhongMaterial: "phong", - MeshToonMaterial: "toon", - MeshStandardMaterial: "physical", - MeshPhysicalMaterial: "physical", - MeshMatcapMaterial: "matcap", - LineBasicMaterial: "basic", - LineDashedMaterial: "dashed", - PointsMaterial: "points", - ShadowMaterial: "shadow", - SpriteMaterial: "sprite", - }; - function m(_, T, I, F, H) { - const B = F.fog, - D = H.geometry, - z = _.isMeshStandardMaterial ? F.environment : null, - N = (_.isMeshStandardMaterial ? t : e).get(_.envMap || z), - k = !!N && N.mapping === Or ? N.image.height : null, - G = g[_.type]; - _.precision !== null && - ((f = i.getMaxPrecision(_.precision)), - f !== _.precision && - console.warn( - "THREE.WebGLProgram.getParameters:", - _.precision, - "not supported, using", - f, - "instead." - )); - const U = - D.morphAttributes.position || - D.morphAttributes.normal || - D.morphAttributes.color, - X = U !== void 0 ? U.length : 0; - let Z = 0; - D.morphAttributes.position !== void 0 && (Z = 1), - D.morphAttributes.normal !== void 0 && (Z = 2), - D.morphAttributes.color !== void 0 && (Z = 3); - let Y, J, ae, ue; - if (G) { - const De = sn[G]; - (Y = De.vertexShader), (J = De.fragmentShader); - } else - (Y = _.vertexShader), - (J = _.fragmentShader), - l.update(_), - (ae = l.getVertexShaderID(_)), - (ue = l.getFragmentShaderID(_)); - const q = r.getRenderTarget(), - Ie = _.alphaTest > 0, - me = _.clearcoat > 0, - xe = _.iridescence > 0; - return { - isWebGL2: u, - shaderID: G, - shaderName: _.type, - vertexShader: Y, - fragmentShader: J, - defines: _.defines, - customVertexShaderID: ae, - customFragmentShaderID: ue, - isRawShaderMaterial: _.isRawShaderMaterial === !0, - glslVersion: _.glslVersion, - precision: f, - instancing: H.isInstancedMesh === !0, - instancingColor: - H.isInstancedMesh === !0 && H.instanceColor !== null, - supportsVertexTextures: d, - outputEncoding: - q === null - ? r.outputEncoding - : q.isXRRenderTarget === !0 - ? q.texture.encoding - : Vn, - map: !!_.map, - matcap: !!_.matcap, - envMap: !!N, - envMapMode: N && N.mapping, - envMapCubeUVHeight: k, - lightMap: !!_.lightMap, - aoMap: !!_.aoMap, - emissiveMap: !!_.emissiveMap, - bumpMap: !!_.bumpMap, - normalMap: !!_.normalMap, - objectSpaceNormalMap: _.normalMapType === td, - tangentSpaceNormalMap: _.normalMapType === ci, - decodeVideoTexture: - !!_.map && _.map.isVideoTexture === !0 && _.map.encoding === Pe, - clearcoat: me, - clearcoatMap: me && !!_.clearcoatMap, - clearcoatRoughnessMap: me && !!_.clearcoatRoughnessMap, - clearcoatNormalMap: me && !!_.clearcoatNormalMap, - iridescence: xe, - iridescenceMap: xe && !!_.iridescenceMap, - iridescenceThicknessMap: xe && !!_.iridescenceThicknessMap, - displacementMap: !!_.displacementMap, - roughnessMap: !!_.roughnessMap, - metalnessMap: !!_.metalnessMap, - specularMap: !!_.specularMap, - specularIntensityMap: !!_.specularIntensityMap, - specularColorMap: !!_.specularColorMap, - opaque: _.transparent === !1 && _.blending === zi, - alphaMap: !!_.alphaMap, - alphaTest: Ie, - gradientMap: !!_.gradientMap, - sheen: _.sheen > 0, - sheenColorMap: !!_.sheenColorMap, - sheenRoughnessMap: !!_.sheenRoughnessMap, - transmission: _.transmission > 0, - transmissionMap: !!_.transmissionMap, - thicknessMap: !!_.thicknessMap, - combine: _.combine, - vertexTangents: !!_.normalMap && !!D.attributes.tangent, - vertexColors: _.vertexColors, - vertexAlphas: - _.vertexColors === !0 && - !!D.attributes.color && - D.attributes.color.itemSize === 4, - vertexUvs: - !!_.map || - !!_.bumpMap || - !!_.normalMap || - !!_.specularMap || - !!_.alphaMap || - !!_.emissiveMap || - !!_.roughnessMap || - !!_.metalnessMap || - !!_.clearcoatMap || - !!_.clearcoatRoughnessMap || - !!_.clearcoatNormalMap || - !!_.iridescenceMap || - !!_.iridescenceThicknessMap || - !!_.displacementMap || - !!_.transmissionMap || - !!_.thicknessMap || - !!_.specularIntensityMap || - !!_.specularColorMap || - !!_.sheenColorMap || - !!_.sheenRoughnessMap, - uvsVertexOnly: - !( - !!_.map || - !!_.bumpMap || - !!_.normalMap || - !!_.specularMap || - !!_.alphaMap || - !!_.emissiveMap || - !!_.roughnessMap || - !!_.metalnessMap || - !!_.clearcoatNormalMap || - !!_.iridescenceMap || - !!_.iridescenceThicknessMap || - _.transmission > 0 || - !!_.transmissionMap || - !!_.thicknessMap || - !!_.specularIntensityMap || - !!_.specularColorMap || - _.sheen > 0 || - !!_.sheenColorMap || - !!_.sheenRoughnessMap - ) && !!_.displacementMap, - fog: !!B, - useFog: _.fog === !0, - fogExp2: B && B.isFogExp2, - flatShading: !!_.flatShading, - sizeAttenuation: _.sizeAttenuation, - logarithmicDepthBuffer: h, - skinning: H.isSkinnedMesh === !0, - morphTargets: D.morphAttributes.position !== void 0, - morphNormals: D.morphAttributes.normal !== void 0, - morphColors: D.morphAttributes.color !== void 0, - morphTargetsCount: X, - morphTextureStride: Z, - numDirLights: T.directional.length, - numPointLights: T.point.length, - numSpotLights: T.spot.length, - numRectAreaLights: T.rectArea.length, - numHemiLights: T.hemi.length, - numDirLightShadows: T.directionalShadowMap.length, - numPointLightShadows: T.pointShadowMap.length, - numSpotLightShadows: T.spotShadowMap.length, - numClippingPlanes: a.numPlanes, - numClipIntersection: a.numIntersection, - dithering: _.dithering, - shadowMapEnabled: r.shadowMap.enabled && I.length > 0, - shadowMapType: r.shadowMap.type, - toneMapping: _.toneMapped ? r.toneMapping : $t, - physicallyCorrectLights: r.physicallyCorrectLights, - premultipliedAlpha: _.premultipliedAlpha, - doubleSided: _.side === cn, - flipSided: _.side === qt, - useDepthPacking: !!_.depthPacking, - depthPacking: _.depthPacking || 0, - index0AttributeName: _.index0AttributeName, - extensionDerivatives: _.extensions && _.extensions.derivatives, - extensionFragDepth: _.extensions && _.extensions.fragDepth, - extensionDrawBuffers: _.extensions && _.extensions.drawBuffers, - extensionShaderTextureLOD: - _.extensions && _.extensions.shaderTextureLOD, - rendererExtensionFragDepth: u || n.has("EXT_frag_depth"), - rendererExtensionDrawBuffers: u || n.has("WEBGL_draw_buffers"), - rendererExtensionShaderTextureLod: - u || n.has("EXT_shader_texture_lod"), - customProgramCacheKey: _.customProgramCacheKey(), - }; - } - function p(_) { - const T = []; - if ( - (_.shaderID - ? T.push(_.shaderID) - : (T.push(_.customVertexShaderID), - T.push(_.customFragmentShaderID)), - _.defines !== void 0) - ) - for (const I in _.defines) T.push(I), T.push(_.defines[I]); - return ( - _.isRawShaderMaterial === !1 && - (v(T, _), M(T, _), T.push(r.outputEncoding)), - T.push(_.customProgramCacheKey), - T.join() - ); - } - function v(_, T) { - _.push(T.precision), - _.push(T.outputEncoding), - _.push(T.envMapMode), - _.push(T.envMapCubeUVHeight), - _.push(T.combine), - _.push(T.vertexUvs), - _.push(T.fogExp2), - _.push(T.sizeAttenuation), - _.push(T.morphTargetsCount), - _.push(T.morphAttributeCount), - _.push(T.numDirLights), - _.push(T.numPointLights), - _.push(T.numSpotLights), - _.push(T.numHemiLights), - _.push(T.numRectAreaLights), - _.push(T.numDirLightShadows), - _.push(T.numPointLightShadows), - _.push(T.numSpotLightShadows), - _.push(T.shadowMapType), - _.push(T.toneMapping), - _.push(T.numClippingPlanes), - _.push(T.numClipIntersection), - _.push(T.depthPacking); - } - function M(_, T) { - o.disableAll(), - T.isWebGL2 && o.enable(0), - T.supportsVertexTextures && o.enable(1), - T.instancing && o.enable(2), - T.instancingColor && o.enable(3), - T.map && o.enable(4), - T.matcap && o.enable(5), - T.envMap && o.enable(6), - T.lightMap && o.enable(7), - T.aoMap && o.enable(8), - T.emissiveMap && o.enable(9), - T.bumpMap && o.enable(10), - T.normalMap && o.enable(11), - T.objectSpaceNormalMap && o.enable(12), - T.tangentSpaceNormalMap && o.enable(13), - T.clearcoat && o.enable(14), - T.clearcoatMap && o.enable(15), - T.clearcoatRoughnessMap && o.enable(16), - T.clearcoatNormalMap && o.enable(17), - T.iridescence && o.enable(18), - T.iridescenceMap && o.enable(19), - T.iridescenceThicknessMap && o.enable(20), - T.displacementMap && o.enable(21), - T.specularMap && o.enable(22), - T.roughnessMap && o.enable(23), - T.metalnessMap && o.enable(24), - T.gradientMap && o.enable(25), - T.alphaMap && o.enable(26), - T.alphaTest && o.enable(27), - T.vertexColors && o.enable(28), - T.vertexAlphas && o.enable(29), - T.vertexUvs && o.enable(30), - T.vertexTangents && o.enable(31), - T.uvsVertexOnly && o.enable(32), - T.fog && o.enable(33), - _.push(o.mask), - o.disableAll(), - T.useFog && o.enable(0), - T.flatShading && o.enable(1), - T.logarithmicDepthBuffer && o.enable(2), - T.skinning && o.enable(3), - T.morphTargets && o.enable(4), - T.morphNormals && o.enable(5), - T.morphColors && o.enable(6), - T.premultipliedAlpha && o.enable(7), - T.shadowMapEnabled && o.enable(8), - T.physicallyCorrectLights && o.enable(9), - T.doubleSided && o.enable(10), - T.flipSided && o.enable(11), - T.useDepthPacking && o.enable(12), - T.dithering && o.enable(13), - T.specularIntensityMap && o.enable(14), - T.specularColorMap && o.enable(15), - T.transmission && o.enable(16), - T.transmissionMap && o.enable(17), - T.thicknessMap && o.enable(18), - T.sheen && o.enable(19), - T.sheenColorMap && o.enable(20), - T.sheenRoughnessMap && o.enable(21), - T.decodeVideoTexture && o.enable(22), - T.opaque && o.enable(23), - _.push(o.mask); - } - function x(_) { - const T = g[_.type]; - let I; - if (T) { - const F = sn[T]; - I = Rd.clone(F.uniforms); - } else I = _.uniforms; - return I; - } - function w(_, T) { - let I; - for (let F = 0, H = c.length; F < H; F++) { - const B = c[F]; - if (B.cacheKey === T) { - (I = B), ++I.usedTimes; - break; - } - } - return I === void 0 && ((I = new Ug(r, T, _, s)), c.push(I)), I; - } - function y(_) { - if (--_.usedTimes === 0) { - const T = c.indexOf(_); - (c[T] = c[c.length - 1]), c.pop(), _.destroy(); - } - } - function A(_) { - l.remove(_); - } - function L() { - l.dispose(); - } - return { - getParameters: m, - getProgramCacheKey: p, - getUniforms: x, - acquireProgram: w, - releaseProgram: y, - releaseShaderCache: A, - programs: c, - dispose: L, - }; - } - function Wg() { - let r = new WeakMap(); - function e(s) { - let a = r.get(s); - return a === void 0 && ((a = {}), r.set(s, a)), a; - } - function t(s) { - r.delete(s); - } - function n(s, a, o) { - r.get(s)[a] = o; - } - function i() { - r = new WeakMap(); - } - return { get: e, remove: t, update: n, dispose: i }; - } - function jg(r, e) { - return r.groupOrder !== e.groupOrder - ? r.groupOrder - e.groupOrder - : r.renderOrder !== e.renderOrder - ? r.renderOrder - e.renderOrder - : r.material.id !== e.material.id - ? r.material.id - e.material.id - : r.z !== e.z - ? r.z - e.z - : r.id - e.id; - } - function Ul(r, e) { - return r.groupOrder !== e.groupOrder - ? r.groupOrder - e.groupOrder - : r.renderOrder !== e.renderOrder - ? r.renderOrder - e.renderOrder - : r.z !== e.z - ? e.z - r.z - : r.id - e.id; - } - function Bl() { - const r = []; - let e = 0; - const t = [], - n = [], - i = []; - function s() { - (e = 0), (t.length = 0), (n.length = 0), (i.length = 0); - } - function a(h, d, f, g, m, p) { - let v = r[e]; - return ( - v === void 0 - ? ((v = { - id: h.id, - object: h, - geometry: d, - material: f, - groupOrder: g, - renderOrder: h.renderOrder, - z: m, - group: p, - }), - (r[e] = v)) - : ((v.id = h.id), - (v.object = h), - (v.geometry = d), - (v.material = f), - (v.groupOrder = g), - (v.renderOrder = h.renderOrder), - (v.z = m), - (v.group = p)), - e++, - v - ); - } - function o(h, d, f, g, m, p) { - const v = a(h, d, f, g, m, p); - f.transmission > 0 - ? n.push(v) - : f.transparent === !0 - ? i.push(v) - : t.push(v); - } - function l(h, d, f, g, m, p) { - const v = a(h, d, f, g, m, p); - f.transmission > 0 - ? n.unshift(v) - : f.transparent === !0 - ? i.unshift(v) - : t.unshift(v); - } - function c(h, d) { - t.length > 1 && t.sort(h || jg), - n.length > 1 && n.sort(d || Ul), - i.length > 1 && i.sort(d || Ul); - } - function u() { - for (let h = e, d = r.length; h < d; h++) { - const f = r[h]; - if (f.id === null) break; - (f.id = null), - (f.object = null), - (f.geometry = null), - (f.material = null), - (f.group = null); - } - } - return { - opaque: t, - transmissive: n, - transparent: i, - init: s, - push: o, - unshift: l, - finish: u, - sort: c, - }; - } - function Xg() { - let r = new WeakMap(); - function e(n, i) { - let s; - return ( - r.has(n) === !1 - ? ((s = new Bl()), r.set(n, [s])) - : i >= r.get(n).length - ? ((s = new Bl()), r.get(n).push(s)) - : (s = r.get(n)[i]), - s - ); - } - function t() { - r = new WeakMap(); - } - return { get: e, dispose: t }; - } - function qg() { - const r = {}; - return { - get: function (e) { - if (r[e.id] !== void 0) return r[e.id]; - let t; - switch (e.type) { - case "DirectionalLight": - t = { direction: new P(), color: new de() }; - break; - case "SpotLight": - t = { - position: new P(), - direction: new P(), - color: new de(), - distance: 0, - coneCos: 0, - penumbraCos: 0, - decay: 0, - }; - break; - case "PointLight": - t = { - position: new P(), - color: new de(), - distance: 0, - decay: 0, - }; - break; - case "HemisphereLight": - t = { - direction: new P(), - skyColor: new de(), - groundColor: new de(), - }; - break; - case "RectAreaLight": - t = { - color: new de(), - position: new P(), - halfWidth: new P(), - halfHeight: new P(), - }; - break; - } - return (r[e.id] = t), t; - }, - }; - } - function $g() { - const r = {}; - return { - get: function (e) { - if (r[e.id] !== void 0) return r[e.id]; - let t; - switch (e.type) { - case "DirectionalLight": - t = { - shadowBias: 0, - shadowNormalBias: 0, - shadowRadius: 1, - shadowMapSize: new ve(), - }; - break; - case "SpotLight": - t = { - shadowBias: 0, - shadowNormalBias: 0, - shadowRadius: 1, - shadowMapSize: new ve(), - }; - break; - case "PointLight": - t = { - shadowBias: 0, - shadowNormalBias: 0, - shadowRadius: 1, - shadowMapSize: new ve(), - shadowCameraNear: 1, - shadowCameraFar: 1e3, - }; - break; - } - return (r[e.id] = t), t; - }, - }; - } - let Yg = 0; - function Kg(r, e) { - return (e.castShadow ? 1 : 0) - (r.castShadow ? 1 : 0); - } - function Zg(r, e) { - const t = new qg(), - n = $g(), - i = { - version: 0, - hash: { - directionalLength: -1, - pointLength: -1, - spotLength: -1, - rectAreaLength: -1, - hemiLength: -1, - numDirectionalShadows: -1, - numPointShadows: -1, - numSpotShadows: -1, - }, - ambient: [0, 0, 0], - probe: [], - directional: [], - directionalShadow: [], - directionalShadowMap: [], - directionalShadowMatrix: [], - spot: [], - spotShadow: [], - spotShadowMap: [], - spotShadowMatrix: [], - rectArea: [], - rectAreaLTC1: null, - rectAreaLTC2: null, - point: [], - pointShadow: [], - pointShadowMap: [], - pointShadowMatrix: [], - hemi: [], - }; - for (let u = 0; u < 9; u++) i.probe.push(new P()); - const s = new P(), - a = new pe(), - o = new pe(); - function l(u, h) { - let d = 0, - f = 0, - g = 0; - for (let T = 0; T < 9; T++) i.probe[T].set(0, 0, 0); - let m = 0, - p = 0, - v = 0, - M = 0, - x = 0, - w = 0, - y = 0, - A = 0; - u.sort(Kg); - const L = h !== !0 ? Math.PI : 1; - for (let T = 0, I = u.length; T < I; T++) { - const F = u[T], - H = F.color, - B = F.intensity, - D = F.distance, - z = F.shadow && F.shadow.map ? F.shadow.map.texture : null; - if (F.isAmbientLight) - (d += H.r * B * L), (f += H.g * B * L), (g += H.b * B * L); - else if (F.isLightProbe) - for (let N = 0; N < 9; N++) - i.probe[N].addScaledVector(F.sh.coefficients[N], B); - else if (F.isDirectionalLight) { - const N = t.get(F); - if ( - (N.color.copy(F.color).multiplyScalar(F.intensity * L), - F.castShadow) - ) { - const k = F.shadow, - G = n.get(F); - (G.shadowBias = k.bias), - (G.shadowNormalBias = k.normalBias), - (G.shadowRadius = k.radius), - (G.shadowMapSize = k.mapSize), - (i.directionalShadow[m] = G), - (i.directionalShadowMap[m] = z), - (i.directionalShadowMatrix[m] = F.shadow.matrix), - w++; - } - (i.directional[m] = N), m++; - } else if (F.isSpotLight) { - const N = t.get(F); - if ( - (N.position.setFromMatrixPosition(F.matrixWorld), - N.color.copy(H).multiplyScalar(B * L), - (N.distance = D), - (N.coneCos = Math.cos(F.angle)), - (N.penumbraCos = Math.cos(F.angle * (1 - F.penumbra))), - (N.decay = F.decay), - F.castShadow) - ) { - const k = F.shadow, - G = n.get(F); - (G.shadowBias = k.bias), - (G.shadowNormalBias = k.normalBias), - (G.shadowRadius = k.radius), - (G.shadowMapSize = k.mapSize), - (i.spotShadow[v] = G), - (i.spotShadowMap[v] = z), - (i.spotShadowMatrix[v] = F.shadow.matrix), - A++; - } - (i.spot[v] = N), v++; - } else if (F.isRectAreaLight) { - const N = t.get(F); - N.color.copy(H).multiplyScalar(B), - N.halfWidth.set(F.width * 0.5, 0, 0), - N.halfHeight.set(0, F.height * 0.5, 0), - (i.rectArea[M] = N), - M++; - } else if (F.isPointLight) { - const N = t.get(F); - if ( - (N.color.copy(F.color).multiplyScalar(F.intensity * L), - (N.distance = F.distance), - (N.decay = F.decay), - F.castShadow) - ) { - const k = F.shadow, - G = n.get(F); - (G.shadowBias = k.bias), - (G.shadowNormalBias = k.normalBias), - (G.shadowRadius = k.radius), - (G.shadowMapSize = k.mapSize), - (G.shadowCameraNear = k.camera.near), - (G.shadowCameraFar = k.camera.far), - (i.pointShadow[p] = G), - (i.pointShadowMap[p] = z), - (i.pointShadowMatrix[p] = F.shadow.matrix), - y++; - } - (i.point[p] = N), p++; - } else if (F.isHemisphereLight) { - const N = t.get(F); - N.skyColor.copy(F.color).multiplyScalar(B * L), - N.groundColor.copy(F.groundColor).multiplyScalar(B * L), - (i.hemi[x] = N), - x++; - } - } - M > 0 && - (e.isWebGL2 || r.has("OES_texture_float_linear") === !0 - ? ((i.rectAreaLTC1 = oe.LTC_FLOAT_1), - (i.rectAreaLTC2 = oe.LTC_FLOAT_2)) - : r.has("OES_texture_half_float_linear") === !0 - ? ((i.rectAreaLTC1 = oe.LTC_HALF_1), - (i.rectAreaLTC2 = oe.LTC_HALF_2)) - : console.error( - "THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions." - )), - (i.ambient[0] = d), - (i.ambient[1] = f), - (i.ambient[2] = g); - const _ = i.hash; - (_.directionalLength !== m || - _.pointLength !== p || - _.spotLength !== v || - _.rectAreaLength !== M || - _.hemiLength !== x || - _.numDirectionalShadows !== w || - _.numPointShadows !== y || - _.numSpotShadows !== A) && - ((i.directional.length = m), - (i.spot.length = v), - (i.rectArea.length = M), - (i.point.length = p), - (i.hemi.length = x), - (i.directionalShadow.length = w), - (i.directionalShadowMap.length = w), - (i.pointShadow.length = y), - (i.pointShadowMap.length = y), - (i.spotShadow.length = A), - (i.spotShadowMap.length = A), - (i.directionalShadowMatrix.length = w), - (i.pointShadowMatrix.length = y), - (i.spotShadowMatrix.length = A), - (_.directionalLength = m), - (_.pointLength = p), - (_.spotLength = v), - (_.rectAreaLength = M), - (_.hemiLength = x), - (_.numDirectionalShadows = w), - (_.numPointShadows = y), - (_.numSpotShadows = A), - (i.version = Yg++)); - } - function c(u, h) { - let d = 0, - f = 0, - g = 0, - m = 0, - p = 0; - const v = h.matrixWorldInverse; - for (let M = 0, x = u.length; M < x; M++) { - const w = u[M]; - if (w.isDirectionalLight) { - const y = i.directional[d]; - y.direction.setFromMatrixPosition(w.matrixWorld), - s.setFromMatrixPosition(w.target.matrixWorld), - y.direction.sub(s), - y.direction.transformDirection(v), - d++; - } else if (w.isSpotLight) { - const y = i.spot[g]; - y.position.setFromMatrixPosition(w.matrixWorld), - y.position.applyMatrix4(v), - y.direction.setFromMatrixPosition(w.matrixWorld), - s.setFromMatrixPosition(w.target.matrixWorld), - y.direction.sub(s), - y.direction.transformDirection(v), - g++; - } else if (w.isRectAreaLight) { - const y = i.rectArea[m]; - y.position.setFromMatrixPosition(w.matrixWorld), - y.position.applyMatrix4(v), - o.identity(), - a.copy(w.matrixWorld), - a.premultiply(v), - o.extractRotation(a), - y.halfWidth.set(w.width * 0.5, 0, 0), - y.halfHeight.set(0, w.height * 0.5, 0), - y.halfWidth.applyMatrix4(o), - y.halfHeight.applyMatrix4(o), - m++; - } else if (w.isPointLight) { - const y = i.point[f]; - y.position.setFromMatrixPosition(w.matrixWorld), - y.position.applyMatrix4(v), - f++; - } else if (w.isHemisphereLight) { - const y = i.hemi[p]; - y.direction.setFromMatrixPosition(w.matrixWorld), - y.direction.transformDirection(v), - p++; - } - } - } - return { setup: l, setupView: c, state: i }; - } - function Vl(r, e) { - const t = new Zg(r, e), - n = [], - i = []; - function s() { - (n.length = 0), (i.length = 0); - } - function a(h) { - n.push(h); - } - function o(h) { - i.push(h); - } - function l(h) { - t.setup(n, h); - } - function c(h) { - t.setupView(n, h); - } - return { - init: s, - state: { lightsArray: n, shadowsArray: i, lights: t }, - setupLights: l, - setupLightsView: c, - pushLight: a, - pushShadow: o, - }; - } - function Jg(r, e) { - let t = new WeakMap(); - function n(s, a = 0) { - let o; - return ( - t.has(s) === !1 - ? ((o = new Vl(r, e)), t.set(s, [o])) - : a >= t.get(s).length - ? ((o = new Vl(r, e)), t.get(s).push(o)) - : (o = t.get(s)[a]), - o - ); - } - function i() { - t = new WeakMap(); - } - return { get: n, dispose: i }; - } - class ih extends it { - constructor(e) { - super(), - (this.isMeshDepthMaterial = !0), - (this.type = "MeshDepthMaterial"), - (this.depthPacking = Qu), - (this.map = null), - (this.alphaMap = null), - (this.displacementMap = null), - (this.displacementScale = 1), - (this.displacementBias = 0), - (this.wireframe = !1), - (this.wireframeLinewidth = 1), - this.setValues(e); - } - copy(e) { - return ( - super.copy(e), - (this.depthPacking = e.depthPacking), - (this.map = e.map), - (this.alphaMap = e.alphaMap), - (this.displacementMap = e.displacementMap), - (this.displacementScale = e.displacementScale), - (this.displacementBias = e.displacementBias), - (this.wireframe = e.wireframe), - (this.wireframeLinewidth = e.wireframeLinewidth), - this - ); - } - } - class sh extends it { - constructor(e) { - super(), - (this.isMeshDistanceMaterial = !0), - (this.type = "MeshDistanceMaterial"), - (this.referencePosition = new P()), - (this.nearDistance = 1), - (this.farDistance = 1e3), - (this.map = null), - (this.alphaMap = null), - (this.displacementMap = null), - (this.displacementScale = 1), - (this.displacementBias = 0), - this.setValues(e); - } - copy(e) { - return ( - super.copy(e), - this.referencePosition.copy(e.referencePosition), - (this.nearDistance = e.nearDistance), - (this.farDistance = e.farDistance), - (this.map = e.map), - (this.alphaMap = e.alphaMap), - (this.displacementMap = e.displacementMap), - (this.displacementScale = e.displacementScale), - (this.displacementBias = e.displacementBias), - this - ); - } - } - const Qg = `void main() { - gl_Position = vec4( position, 1.0 ); -}`, - e0 = `uniform sampler2D shadow_pass; -uniform vec2 resolution; -uniform float radius; -#include -void main() { - const float samples = float( VSM_SAMPLES ); - float mean = 0.0; - float squared_mean = 0.0; - float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); - float uvStart = samples <= 1.0 ? 0.0 : - 1.0; - for ( float i = 0.0; i < samples; i ++ ) { - float uvOffset = uvStart + i * uvStride; - #ifdef HORIZONTAL_PASS - vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); - mean += distribution.x; - squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; - #else - float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); - mean += depth; - squared_mean += depth * depth; - #endif - } - mean = mean / samples; - squared_mean = squared_mean / samples; - float std_dev = sqrt( squared_mean - mean * mean ); - gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`; - function t0(r, e, t) { - let n = new ro(); - const i = new ve(), - s = new ve(), - a = new Ue(), - o = new ih({ depthPacking: ed }), - l = new sh(), - c = {}, - u = t.maxTextureSize, - h = { 0: qt, 1: ki, 2: cn }, - d = new En({ - defines: { VSM_SAMPLES: 8 }, - uniforms: { - shadow_pass: { value: null }, - resolution: { value: new ve() }, - radius: { value: 4 }, - }, - vertexShader: Qg, - fragmentShader: e0, - }), - f = d.clone(); - f.defines.HORIZONTAL_PASS = 1; - const g = new ct(); - g.setAttribute( - "position", - new wt(new Float32Array([-1, -1, 0.5, 3, -1, 0.5, -1, 3, 0.5]), 3) - ); - const m = new Qe(g, d), - p = this; - (this.enabled = !1), - (this.autoUpdate = !0), - (this.needsUpdate = !1), - (this.type = Cc), - (this.render = function (w, y, A) { - if ( - p.enabled === !1 || - (p.autoUpdate === !1 && p.needsUpdate === !1) || - w.length === 0 - ) - return; - const L = r.getRenderTarget(), - _ = r.getActiveCubeFace(), - T = r.getActiveMipmapLevel(), - I = r.state; - I.setBlending(Un), - I.buffers.color.setClear(1, 1, 1, 1), - I.buffers.depth.setTest(!0), - I.setScissorTest(!1); - for (let F = 0, H = w.length; F < H; F++) { - const B = w[F], - D = B.shadow; - if (D === void 0) { - console.warn("THREE.WebGLShadowMap:", B, "has no shadow."); - continue; - } - if (D.autoUpdate === !1 && D.needsUpdate === !1) continue; - i.copy(D.mapSize); - const z = D.getFrameExtents(); - if ( - (i.multiply(z), - s.copy(D.mapSize), - (i.x > u || i.y > u) && - (i.x > u && - ((s.x = Math.floor(u / z.x)), - (i.x = s.x * z.x), - (D.mapSize.x = s.x)), - i.y > u && - ((s.y = Math.floor(u / z.y)), - (i.y = s.y * z.y), - (D.mapSize.y = s.y))), - D.map === null && - !D.isPointLightShadow && - this.type === _s && - ((D.map = new Kt(i.x, i.y)), - (D.map.texture.name = B.name + ".shadowMap"), - (D.mapPass = new Kt(i.x, i.y)), - D.camera.updateProjectionMatrix()), - D.map === null) - ) { - const k = { minFilter: ft, magFilter: ft, format: Nt }; - (D.map = new Kt(i.x, i.y, k)), - (D.map.texture.name = B.name + ".shadowMap"), - D.camera.updateProjectionMatrix(); - } - r.setRenderTarget(D.map), r.clear(); - const N = D.getViewportCount(); - for (let k = 0; k < N; k++) { - const G = D.getViewport(k); - a.set(s.x * G.x, s.y * G.y, s.x * G.z, s.y * G.w), - I.viewport(a), - D.updateMatrices(B, k), - (n = D.getFrustum()), - x(y, A, D.camera, B, this.type); - } - !D.isPointLightShadow && this.type === _s && v(D, A), - (D.needsUpdate = !1); - } - (p.needsUpdate = !1), r.setRenderTarget(L, _, T); - }); - function v(w, y) { - const A = e.update(m); - d.defines.VSM_SAMPLES !== w.blurSamples && - ((d.defines.VSM_SAMPLES = w.blurSamples), - (f.defines.VSM_SAMPLES = w.blurSamples), - (d.needsUpdate = !0), - (f.needsUpdate = !0)), - (d.uniforms.shadow_pass.value = w.map.texture), - (d.uniforms.resolution.value = w.mapSize), - (d.uniforms.radius.value = w.radius), - r.setRenderTarget(w.mapPass), - r.clear(), - r.renderBufferDirect(y, null, A, d, m, null), - (f.uniforms.shadow_pass.value = w.mapPass.texture), - (f.uniforms.resolution.value = w.mapSize), - (f.uniforms.radius.value = w.radius), - r.setRenderTarget(w.map), - r.clear(), - r.renderBufferDirect(y, null, A, f, m, null); - } - function M(w, y, A, L, _, T) { - let I = null; - const F = - A.isPointLight === !0 - ? w.customDistanceMaterial - : w.customDepthMaterial; - if ( - (F !== void 0 ? (I = F) : (I = A.isPointLight === !0 ? l : o), - (r.localClippingEnabled && - y.clipShadows === !0 && - y.clippingPlanes.length !== 0) || - (y.displacementMap && y.displacementScale !== 0) || - (y.alphaMap && y.alphaTest > 0)) - ) { - const H = I.uuid, - B = y.uuid; - let D = c[H]; - D === void 0 && ((D = {}), (c[H] = D)); - let z = D[B]; - z === void 0 && ((z = I.clone()), (D[B] = z)), (I = z); - } - return ( - (I.visible = y.visible), - (I.wireframe = y.wireframe), - T === _s - ? (I.side = y.shadowSide !== null ? y.shadowSide : y.side) - : (I.side = y.shadowSide !== null ? y.shadowSide : h[y.side]), - (I.alphaMap = y.alphaMap), - (I.alphaTest = y.alphaTest), - (I.clipShadows = y.clipShadows), - (I.clippingPlanes = y.clippingPlanes), - (I.clipIntersection = y.clipIntersection), - (I.displacementMap = y.displacementMap), - (I.displacementScale = y.displacementScale), - (I.displacementBias = y.displacementBias), - (I.wireframeLinewidth = y.wireframeLinewidth), - (I.linewidth = y.linewidth), - A.isPointLight === !0 && - I.isMeshDistanceMaterial === !0 && - (I.referencePosition.setFromMatrixPosition(A.matrixWorld), - (I.nearDistance = L), - (I.farDistance = _)), - I - ); - } - function x(w, y, A, L, _) { - if (w.visible === !1) return; - if ( - w.layers.test(y.layers) && - (w.isMesh || w.isLine || w.isPoints) && - (w.castShadow || (w.receiveShadow && _ === _s)) && - (!w.frustumCulled || n.intersectsObject(w)) - ) { - w.modelViewMatrix.multiplyMatrices( - A.matrixWorldInverse, - w.matrixWorld - ); - const F = e.update(w), - H = w.material; - if (Array.isArray(H)) { - const B = F.groups; - for (let D = 0, z = B.length; D < z; D++) { - const N = B[D], - k = H[N.materialIndex]; - if (k && k.visible) { - const G = M(w, k, L, A.near, A.far, _); - r.renderBufferDirect(A, null, F, G, w, N); - } - } - } else if (H.visible) { - const B = M(w, H, L, A.near, A.far, _); - r.renderBufferDirect(A, null, F, B, w, null); - } - } - const I = w.children; - for (let F = 0, H = I.length; F < H; F++) x(I[F], y, A, L, _); - } - } - function n0(r, e, t) { - const n = t.isWebGL2; - function i() { - let R = !1; - const ne = new Ue(); - let ee = null; - const ge = new Ue(0, 0, 0, 0); - return { - setMask: function (le) { - ee !== le && !R && (r.colorMask(le, le, le, le), (ee = le)); - }, - setLocked: function (le) { - R = le; - }, - setClear: function (le, fe, ie, we, Ve) { - Ve === !0 && ((le *= we), (fe *= we), (ie *= we)), - ne.set(le, fe, ie, we), - ge.equals(ne) === !1 && - (r.clearColor(le, fe, ie, we), ge.copy(ne)); - }, - reset: function () { - (R = !1), (ee = null), ge.set(-1, 0, 0, 0); - }, - }; - } - function s() { - let R = !1, - ne = null, - ee = null, - ge = null; - return { - setTest: function (le) { - le ? ue(2929) : q(2929); - }, - setMask: function (le) { - ne !== le && !R && (r.depthMask(le), (ne = le)); - }, - setFunc: function (le) { - if (ee !== le) { - if (le) - switch (le) { - case Eu: - r.depthFunc(512); - break; - case Au: - r.depthFunc(519); - break; - case Cu: - r.depthFunc(513); - break; - case Fa: - r.depthFunc(515); - break; - case Lu: - r.depthFunc(514); - break; - case Ru: - r.depthFunc(518); - break; - case Pu: - r.depthFunc(516); - break; - case Du: - r.depthFunc(517); - break; - default: - r.depthFunc(515); - } - else r.depthFunc(515); - ee = le; - } - }, - setLocked: function (le) { - R = le; - }, - setClear: function (le) { - ge !== le && (r.clearDepth(le), (ge = le)); - }, - reset: function () { - (R = !1), (ne = null), (ee = null), (ge = null); - }, - }; - } - function a() { - let R = !1, - ne = null, - ee = null, - ge = null, - le = null, - fe = null, - ie = null, - we = null, - Ve = null; - return { - setTest: function (Ge) { - R || (Ge ? ue(2960) : q(2960)); - }, - setMask: function (Ge) { - ne !== Ge && !R && (r.stencilMask(Ge), (ne = Ge)); - }, - setFunc: function (Ge, vt, Jt) { - (ee !== Ge || ge !== vt || le !== Jt) && - (r.stencilFunc(Ge, vt, Jt), (ee = Ge), (ge = vt), (le = Jt)); - }, - setOp: function (Ge, vt, Jt) { - (fe !== Ge || ie !== vt || we !== Jt) && - (r.stencilOp(Ge, vt, Jt), (fe = Ge), (ie = vt), (we = Jt)); - }, - setLocked: function (Ge) { - R = Ge; - }, - setClear: function (Ge) { - Ve !== Ge && (r.clearStencil(Ge), (Ve = Ge)); - }, - reset: function () { - (R = !1), - (ne = null), - (ee = null), - (ge = null), - (le = null), - (fe = null), - (ie = null), - (we = null), - (Ve = null); - }, - }; - } - const o = new i(), - l = new s(), - c = new a(); - let u = {}, - h = {}, - d = new WeakMap(), - f = [], - g = null, - m = !1, - p = null, - v = null, - M = null, - x = null, - w = null, - y = null, - A = null, - L = !1, - _ = null, - T = null, - I = null, - F = null, - H = null; - const B = r.getParameter(35661); - let D = !1, - z = 0; - const N = r.getParameter(7938); - N.indexOf("WebGL") !== -1 - ? ((z = parseFloat(/^WebGL (\d)/.exec(N)[1])), (D = z >= 1)) - : N.indexOf("OpenGL ES") !== -1 && - ((z = parseFloat(/^OpenGL ES (\d)/.exec(N)[1])), (D = z >= 2)); - let k = null, - G = {}; - const U = r.getParameter(3088), - X = r.getParameter(2978), - Z = new Ue().fromArray(U), - Y = new Ue().fromArray(X); - function J(R, ne, ee) { - const ge = new Uint8Array(4), - le = r.createTexture(); - r.bindTexture(R, le), - r.texParameteri(R, 10241, 9728), - r.texParameteri(R, 10240, 9728); - for (let fe = 0; fe < ee; fe++) - r.texImage2D(ne + fe, 0, 6408, 1, 1, 0, 6408, 5121, ge); - return le; - } - const ae = {}; - (ae[3553] = J(3553, 3553, 1)), - (ae[34067] = J(34067, 34069, 6)), - o.setClear(0, 0, 0, 1), - l.setClear(1), - c.setClear(0), - ue(2929), - l.setFunc(Fa), - qe(!1), - ot(Io), - ue(2884), - Se(Un); - function ue(R) { - u[R] !== !0 && (r.enable(R), (u[R] = !0)); - } - function q(R) { - u[R] !== !1 && (r.disable(R), (u[R] = !1)); - } - function Ie(R, ne) { - return h[R] !== ne - ? (r.bindFramebuffer(R, ne), - (h[R] = ne), - n && - (R === 36009 && (h[36160] = ne), - R === 36160 && (h[36009] = ne)), - !0) - : !1; - } - function me(R, ne) { - let ee = f, - ge = !1; - if (R) - if ( - ((ee = d.get(ne)), - ee === void 0 && ((ee = []), d.set(ne, ee)), - R.isWebGLMultipleRenderTargets) - ) { - const le = R.texture; - if (ee.length !== le.length || ee[0] !== 36064) { - for (let fe = 0, ie = le.length; fe < ie; fe++) - ee[fe] = 36064 + fe; - (ee.length = le.length), (ge = !0); - } - } else ee[0] !== 36064 && ((ee[0] = 36064), (ge = !0)); - else ee[0] !== 1029 && ((ee[0] = 1029), (ge = !0)); - ge && - (t.isWebGL2 - ? r.drawBuffers(ee) - : e.get("WEBGL_draw_buffers").drawBuffersWEBGL(ee)); - } - function xe(R) { - return g !== R ? (r.useProgram(R), (g = R), !0) : !1; - } - const ce = { [Di]: 32774, [mu]: 32778, [gu]: 32779 }; - if (n) (ce[zo] = 32775), (ce[Oo] = 32776); - else { - const R = e.get("EXT_blend_minmax"); - R !== null && ((ce[zo] = R.MIN_EXT), (ce[Oo] = R.MAX_EXT)); - } - const De = { - [vu]: 0, - [_u]: 1, - [xu]: 768, - [Rc]: 770, - [Tu]: 776, - [bu]: 774, - [Mu]: 772, - [yu]: 769, - [Pc]: 771, - [Su]: 775, - [wu]: 773, - }; - function Se(R, ne, ee, ge, le, fe, ie, we) { - if (R === Un) { - m === !0 && (q(3042), (m = !1)); - return; - } - if ((m === !1 && (ue(3042), (m = !0)), R !== pu)) { - if (R !== p || we !== L) { - if ( - ((v !== Di || w !== Di) && - (r.blendEquation(32774), (v = Di), (w = Di)), - we) - ) - switch (R) { - case zi: - r.blendFuncSeparate(1, 771, 1, 771); - break; - case Sr: - r.blendFunc(1, 1); - break; - case Fo: - r.blendFuncSeparate(0, 769, 0, 1); - break; - case No: - r.blendFuncSeparate(0, 768, 0, 770); - break; - default: - console.error("THREE.WebGLState: Invalid blending: ", R); - break; - } - else - switch (R) { - case zi: - r.blendFuncSeparate(770, 771, 1, 771); - break; - case Sr: - r.blendFunc(770, 1); - break; - case Fo: - r.blendFuncSeparate(0, 769, 0, 1); - break; - case No: - r.blendFunc(0, 768); - break; - default: - console.error("THREE.WebGLState: Invalid blending: ", R); - break; - } - (M = null), (x = null), (y = null), (A = null), (p = R), (L = we); - } - return; - } - (le = le || ne), - (fe = fe || ee), - (ie = ie || ge), - (ne !== v || le !== w) && - (r.blendEquationSeparate(ce[ne], ce[le]), (v = ne), (w = le)), - (ee !== M || ge !== x || fe !== y || ie !== A) && - (r.blendFuncSeparate(De[ee], De[ge], De[fe], De[ie]), - (M = ee), - (x = ge), - (y = fe), - (A = ie)), - (p = R), - (L = null); - } - function Me(R, ne) { - R.side === cn ? q(2884) : ue(2884); - let ee = R.side === qt; - ne && (ee = !ee), - qe(ee), - R.blending === zi && R.transparent === !1 - ? Se(Un) - : Se( - R.blending, - R.blendEquation, - R.blendSrc, - R.blendDst, - R.blendEquationAlpha, - R.blendSrcAlpha, - R.blendDstAlpha, - R.premultipliedAlpha - ), - l.setFunc(R.depthFunc), - l.setTest(R.depthTest), - l.setMask(R.depthWrite), - o.setMask(R.colorWrite); - const ge = R.stencilWrite; - c.setTest(ge), - ge && - (c.setMask(R.stencilWriteMask), - c.setFunc(R.stencilFunc, R.stencilRef, R.stencilFuncMask), - c.setOp(R.stencilFail, R.stencilZFail, R.stencilZPass)), - At(R.polygonOffset, R.polygonOffsetFactor, R.polygonOffsetUnits), - R.alphaToCoverage === !0 ? ue(32926) : q(32926); - } - function qe(R) { - _ !== R && (R ? r.frontFace(2304) : r.frontFace(2305), (_ = R)); - } - function ot(R) { - R !== uu - ? (ue(2884), - R !== T && - (R === Io - ? r.cullFace(1029) - : R === du - ? r.cullFace(1028) - : r.cullFace(1032))) - : q(2884), - (T = R); - } - function ut(R) { - R !== I && (D && r.lineWidth(R), (I = R)); - } - function At(R, ne, ee) { - R - ? (ue(32823), - (F !== ne || H !== ee) && - (r.polygonOffset(ne, ee), (F = ne), (H = ee))) - : q(32823); - } - function st(R) { - R ? ue(3089) : q(3089); - } - function Be(R) { - R === void 0 && (R = 33984 + B - 1), - k !== R && (r.activeTexture(R), (k = R)); - } - function Rt(R, ne) { - k === null && Be(); - let ee = G[k]; - ee === void 0 && - ((ee = { type: void 0, texture: void 0 }), (G[k] = ee)), - (ee.type !== R || ee.texture !== ne) && - (r.bindTexture(R, ne || ae[R]), (ee.type = R), (ee.texture = ne)); - } - function Pt() { - const R = G[k]; - R !== void 0 && - R.type !== void 0 && - (r.bindTexture(R.type, null), - (R.type = void 0), - (R.texture = void 0)); - } - function C() { - try { - r.compressedTexImage2D.apply(r, arguments); - } catch (R) { - console.error("THREE.WebGLState:", R); - } - } - function b() { - try { - r.texSubImage2D.apply(r, arguments); - } catch (R) { - console.error("THREE.WebGLState:", R); - } - } - function j() { - try { - r.texSubImage3D.apply(r, arguments); - } catch (R) { - console.error("THREE.WebGLState:", R); - } - } - function Q() { - try { - r.compressedTexSubImage2D.apply(r, arguments); - } catch (R) { - console.error("THREE.WebGLState:", R); - } - } - function se() { - try { - r.texStorage2D.apply(r, arguments); - } catch (R) { - console.error("THREE.WebGLState:", R); - } - } - function he() { - try { - r.texStorage3D.apply(r, arguments); - } catch (R) { - console.error("THREE.WebGLState:", R); - } - } - function _e() { - try { - r.texImage2D.apply(r, arguments); - } catch (R) { - console.error("THREE.WebGLState:", R); - } - } - function S() { - try { - r.texImage3D.apply(r, arguments); - } catch (R) { - console.error("THREE.WebGLState:", R); - } - } - function K(R) { - Z.equals(R) === !1 && (r.scissor(R.x, R.y, R.z, R.w), Z.copy(R)); - } - function re(R) { - Y.equals(R) === !1 && (r.viewport(R.x, R.y, R.z, R.w), Y.copy(R)); - } - function te() { - r.disable(3042), - r.disable(2884), - r.disable(2929), - r.disable(32823), - r.disable(3089), - r.disable(2960), - r.disable(32926), - r.blendEquation(32774), - r.blendFunc(1, 0), - r.blendFuncSeparate(1, 0, 1, 0), - r.colorMask(!0, !0, !0, !0), - r.clearColor(0, 0, 0, 0), - r.depthMask(!0), - r.depthFunc(513), - r.clearDepth(1), - r.stencilMask(4294967295), - r.stencilFunc(519, 0, 4294967295), - r.stencilOp(7680, 7680, 7680), - r.clearStencil(0), - r.cullFace(1029), - r.frontFace(2305), - r.polygonOffset(0, 0), - r.activeTexture(33984), - r.bindFramebuffer(36160, null), - n === !0 && - (r.bindFramebuffer(36009, null), r.bindFramebuffer(36008, null)), - r.useProgram(null), - r.lineWidth(1), - r.scissor(0, 0, r.canvas.width, r.canvas.height), - r.viewport(0, 0, r.canvas.width, r.canvas.height), - (u = {}), - (k = null), - (G = {}), - (h = {}), - (d = new WeakMap()), - (f = []), - (g = null), - (m = !1), - (p = null), - (v = null), - (M = null), - (x = null), - (w = null), - (y = null), - (A = null), - (L = !1), - (_ = null), - (T = null), - (I = null), - (F = null), - (H = null), - Z.set(0, 0, r.canvas.width, r.canvas.height), - Y.set(0, 0, r.canvas.width, r.canvas.height), - o.reset(), - l.reset(), - c.reset(); - } - return { - buffers: { color: o, depth: l, stencil: c }, - enable: ue, - disable: q, - bindFramebuffer: Ie, - drawBuffers: me, - useProgram: xe, - setBlending: Se, - setMaterial: Me, - setFlipSided: qe, - setCullFace: ot, - setLineWidth: ut, - setPolygonOffset: At, - setScissorTest: st, - activeTexture: Be, - bindTexture: Rt, - unbindTexture: Pt, - compressedTexImage2D: C, - texImage2D: _e, - texImage3D: S, - texStorage2D: se, - texStorage3D: he, - texSubImage2D: b, - texSubImage3D: j, - compressedTexSubImage2D: Q, - scissor: K, - viewport: re, - reset: te, - }; - } - function i0(r, e, t, n, i, s, a) { - const o = i.isWebGL2, - l = i.maxTextures, - c = i.maxCubemapSize, - u = i.maxTextureSize, - h = i.maxSamples, - d = e.has("WEBGL_multisampled_render_to_texture") - ? e.get("WEBGL_multisampled_render_to_texture") - : null, - f = /OculusBrowser/g.test(navigator.userAgent), - g = new WeakMap(); - let m; - const p = new WeakMap(); - let v = !1; - try { - v = - typeof OffscreenCanvas != "undefined" && - new OffscreenCanvas(1, 1).getContext("2d") !== null; - } catch {} - function M(C, b) { - return v ? new OffscreenCanvas(C, b) : Cs("canvas"); - } - function x(C, b, j, Q) { - let se = 1; - if ( - ((C.width > Q || C.height > Q) && - (se = Q / Math.max(C.width, C.height)), - se < 1 || b === !0) - ) - if ( - (typeof HTMLImageElement != "undefined" && - C instanceof HTMLImageElement) || - (typeof HTMLCanvasElement != "undefined" && - C instanceof HTMLCanvasElement) || - (typeof ImageBitmap != "undefined" && C instanceof ImageBitmap) - ) { - const he = b ? Ar : Math.floor, - _e = he(se * C.width), - S = he(se * C.height); - m === void 0 && (m = M(_e, S)); - const K = j ? M(_e, S) : m; - return ( - (K.width = _e), - (K.height = S), - K.getContext("2d").drawImage(C, 0, 0, _e, S), - console.warn( - "THREE.WebGLRenderer: Texture has been resized from (" + - C.width + - "x" + - C.height + - ") to (" + - _e + - "x" + - S + - ")." - ), - K - ); - } else - return ( - "data" in C && - console.warn( - "THREE.WebGLRenderer: Image in DataTexture is too big (" + - C.width + - "x" + - C.height + - ")." - ), - C - ); - return C; - } - function w(C) { - return Ba(C.width) && Ba(C.height); - } - function y(C) { - return o - ? !1 - : C.wrapS !== gt || - C.wrapT !== gt || - (C.minFilter !== ft && C.minFilter !== $e); - } - function A(C, b) { - return ( - C.generateMipmaps && b && C.minFilter !== ft && C.minFilter !== $e - ); - } - function L(C) { - r.generateMipmap(C); - } - function _(C, b, j, Q, se = !1) { - if (o === !1) return b; - if (C !== null) { - if (r[C] !== void 0) return r[C]; - console.warn( - "THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '" + - C + - "'" - ); - } - let he = b; - return ( - b === 6403 && - (j === 5126 && (he = 33326), - j === 5131 && (he = 33325), - j === 5121 && (he = 33321)), - b === 33319 && - (j === 5126 && (he = 33328), - j === 5131 && (he = 33327), - j === 5121 && (he = 33323)), - b === 6408 && - (j === 5126 && (he = 34836), - j === 5131 && (he = 34842), - j === 5121 && (he = Q === Pe && se === !1 ? 35907 : 32856), - j === 32819 && (he = 32854), - j === 32820 && (he = 32855)), - (he === 33325 || - he === 33326 || - he === 33327 || - he === 33328 || - he === 34842 || - he === 34836) && - e.get("EXT_color_buffer_float"), - he - ); - } - function T(C, b, j) { - return A(C, j) === !0 || - (C.isFramebufferTexture && C.minFilter !== ft && C.minFilter !== $e) - ? Math.log2(Math.max(b.width, b.height)) + 1 - : C.mipmaps !== void 0 && C.mipmaps.length > 0 - ? C.mipmaps.length - : C.isCompressedTexture && Array.isArray(C.image) - ? b.mipmaps.length - : 1; - } - function I(C) { - return C === ft || C === za || C === Oa ? 9728 : 9729; - } - function F(C) { - const b = C.target; - b.removeEventListener("dispose", F), - B(b), - b.isVideoTexture && g.delete(b); - } - function H(C) { - const b = C.target; - b.removeEventListener("dispose", H), z(b); - } - function B(C) { - const b = n.get(C); - if (b.__webglInit === void 0) return; - const j = C.source, - Q = p.get(j); - if (Q) { - const se = Q[b.__cacheKey]; - se.usedTimes--, - se.usedTimes === 0 && D(C), - Object.keys(Q).length === 0 && p.delete(j); - } - n.remove(C); - } - function D(C) { - const b = n.get(C); - r.deleteTexture(b.__webglTexture); - const j = C.source, - Q = p.get(j); - delete Q[b.__cacheKey], a.memory.textures--; - } - function z(C) { - const b = C.texture, - j = n.get(C), - Q = n.get(b); - if ( - (Q.__webglTexture !== void 0 && - (r.deleteTexture(Q.__webglTexture), a.memory.textures--), - C.depthTexture && C.depthTexture.dispose(), - C.isWebGLCubeRenderTarget) - ) - for (let se = 0; se < 6; se++) - r.deleteFramebuffer(j.__webglFramebuffer[se]), - j.__webglDepthbuffer && - r.deleteRenderbuffer(j.__webglDepthbuffer[se]); - else { - if ( - (r.deleteFramebuffer(j.__webglFramebuffer), - j.__webglDepthbuffer && - r.deleteRenderbuffer(j.__webglDepthbuffer), - j.__webglMultisampledFramebuffer && - r.deleteFramebuffer(j.__webglMultisampledFramebuffer), - j.__webglColorRenderbuffer) - ) - for (let se = 0; se < j.__webglColorRenderbuffer.length; se++) - j.__webglColorRenderbuffer[se] && - r.deleteRenderbuffer(j.__webglColorRenderbuffer[se]); - j.__webglDepthRenderbuffer && - r.deleteRenderbuffer(j.__webglDepthRenderbuffer); - } - if (C.isWebGLMultipleRenderTargets) - for (let se = 0, he = b.length; se < he; se++) { - const _e = n.get(b[se]); - _e.__webglTexture && - (r.deleteTexture(_e.__webglTexture), a.memory.textures--), - n.remove(b[se]); - } - n.remove(b), n.remove(C); - } - let N = 0; - function k() { - N = 0; - } - function G() { - const C = N; - return ( - C >= l && - console.warn( - "THREE.WebGLTextures: Trying to use " + - C + - " texture units while this GPU supports only " + - l - ), - (N += 1), - C - ); - } - function U(C) { - const b = []; - return ( - b.push(C.wrapS), - b.push(C.wrapT), - b.push(C.magFilter), - b.push(C.minFilter), - b.push(C.anisotropy), - b.push(C.internalFormat), - b.push(C.format), - b.push(C.type), - b.push(C.generateMipmaps), - b.push(C.premultiplyAlpha), - b.push(C.flipY), - b.push(C.unpackAlignment), - b.push(C.encoding), - b.join() - ); - } - function X(C, b) { - const j = n.get(C); - if ( - (C.isVideoTexture && Rt(C), - C.isRenderTargetTexture === !1 && - C.version > 0 && - j.__version !== C.version) - ) { - const Q = C.image; - if (Q === null) - console.warn( - "THREE.WebGLRenderer: Texture marked for update but no image data found." - ); - else if (Q.complete === !1) - console.warn( - "THREE.WebGLRenderer: Texture marked for update but image is incomplete" - ); - else { - me(j, C, b); - return; - } - } - t.activeTexture(33984 + b), t.bindTexture(3553, j.__webglTexture); - } - function Z(C, b) { - const j = n.get(C); - if (C.version > 0 && j.__version !== C.version) { - me(j, C, b); - return; - } - t.activeTexture(33984 + b), t.bindTexture(35866, j.__webglTexture); - } - function Y(C, b) { - const j = n.get(C); - if (C.version > 0 && j.__version !== C.version) { - me(j, C, b); - return; - } - t.activeTexture(33984 + b), t.bindTexture(32879, j.__webglTexture); - } - function J(C, b) { - const j = n.get(C); - if (C.version > 0 && j.__version !== C.version) { - xe(j, C, b); - return; - } - t.activeTexture(33984 + b), t.bindTexture(34067, j.__webglTexture); - } - const ae = { [hn]: 10497, [gt]: 33071, [Er]: 33648 }, - ue = { - [ft]: 9728, - [za]: 9984, - [Oa]: 9986, - [$e]: 9729, - [Oc]: 9985, - [li]: 9987, - }; - function q(C, b, j) { - if ( - (j - ? (r.texParameteri(C, 10242, ae[b.wrapS]), - r.texParameteri(C, 10243, ae[b.wrapT]), - (C === 32879 || C === 35866) && - r.texParameteri(C, 32882, ae[b.wrapR]), - r.texParameteri(C, 10240, ue[b.magFilter]), - r.texParameteri(C, 10241, ue[b.minFilter])) - : (r.texParameteri(C, 10242, 33071), - r.texParameteri(C, 10243, 33071), - (C === 32879 || C === 35866) && - r.texParameteri(C, 32882, 33071), - (b.wrapS !== gt || b.wrapT !== gt) && - console.warn( - "THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping." - ), - r.texParameteri(C, 10240, I(b.magFilter)), - r.texParameteri(C, 10241, I(b.minFilter)), - b.minFilter !== ft && - b.minFilter !== $e && - console.warn( - "THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter." - )), - e.has("EXT_texture_filter_anisotropic") === !0) - ) { - const Q = e.get("EXT_texture_filter_anisotropic"); - if ( - (b.type === Ft && e.has("OES_texture_float_linear") === !1) || - (o === !1 && - b.type === Mn && - e.has("OES_texture_half_float_linear") === !1) - ) - return; - (b.anisotropy > 1 || n.get(b).__currentAnisotropy) && - (r.texParameterf( - C, - Q.TEXTURE_MAX_ANISOTROPY_EXT, - Math.min(b.anisotropy, i.getMaxAnisotropy()) - ), - (n.get(b).__currentAnisotropy = b.anisotropy)); - } - } - function Ie(C, b) { - let j = !1; - C.__webglInit === void 0 && - ((C.__webglInit = !0), b.addEventListener("dispose", F)); - const Q = b.source; - let se = p.get(Q); - se === void 0 && ((se = {}), p.set(Q, se)); - const he = U(b); - if (he !== C.__cacheKey) { - se[he] === void 0 && - ((se[he] = { texture: r.createTexture(), usedTimes: 0 }), - a.memory.textures++, - (j = !0)), - se[he].usedTimes++; - const _e = se[C.__cacheKey]; - _e !== void 0 && - (se[C.__cacheKey].usedTimes--, _e.usedTimes === 0 && D(b)), - (C.__cacheKey = he), - (C.__webglTexture = se[he].texture); - } - return j; - } - function me(C, b, j) { - let Q = 3553; - b.isDataArrayTexture && (Q = 35866), b.isData3DTexture && (Q = 32879); - const se = Ie(C, b), - he = b.source; - if ( - (t.activeTexture(33984 + j), - t.bindTexture(Q, C.__webglTexture), - he.version !== he.__currentVersion || se === !0) - ) { - r.pixelStorei(37440, b.flipY), - r.pixelStorei(37441, b.premultiplyAlpha), - r.pixelStorei(3317, b.unpackAlignment), - r.pixelStorei(37443, 0); - const _e = y(b) && w(b.image) === !1; - let S = x(b.image, _e, !1, u); - S = Pt(b, S); - const K = w(S) || o, - re = s.convert(b.format, b.encoding); - let te = s.convert(b.type), - R = _(b.internalFormat, re, te, b.encoding, b.isVideoTexture); - q(Q, b, K); - let ne; - const ee = b.mipmaps, - ge = o && b.isVideoTexture !== !0, - le = he.__currentVersion === void 0 || se === !0, - fe = T(b, S, K); - if (b.isDepthTexture) - (R = 6402), - o - ? b.type === Ft - ? (R = 36012) - : b.type === ii - ? (R = 33190) - : b.type === Oi - ? (R = 35056) - : (R = 33189) - : b.type === Ft && - console.error( - "WebGLRenderer: Floating point depth texture requires WebGL2." - ), - b.format === ri && - R === 6402 && - b.type !== kc && - b.type !== ii && - (console.warn( - "THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture." - ), - (b.type = ii), - (te = s.convert(b.type))), - b.format === Vi && - R === 6402 && - ((R = 34041), - b.type !== Oi && - (console.warn( - "THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture." - ), - (b.type = Oi), - (te = s.convert(b.type)))), - le && - (ge - ? t.texStorage2D(3553, 1, R, S.width, S.height) - : t.texImage2D( - 3553, - 0, - R, - S.width, - S.height, - 0, - re, - te, - null - )); - else if (b.isDataTexture) - if (ee.length > 0 && K) { - ge && - le && - t.texStorage2D(3553, fe, R, ee[0].width, ee[0].height); - for (let ie = 0, we = ee.length; ie < we; ie++) - (ne = ee[ie]), - ge - ? t.texSubImage2D( - 3553, - ie, - 0, - 0, - ne.width, - ne.height, - re, - te, - ne.data - ) - : t.texImage2D( - 3553, - ie, - R, - ne.width, - ne.height, - 0, - re, - te, - ne.data - ); - b.generateMipmaps = !1; - } else - ge - ? (le && t.texStorage2D(3553, fe, R, S.width, S.height), - t.texSubImage2D( - 3553, - 0, - 0, - 0, - S.width, - S.height, - re, - te, - S.data - )) - : t.texImage2D( - 3553, - 0, - R, - S.width, - S.height, - 0, - re, - te, - S.data - ); - else if (b.isCompressedTexture) { - ge && - le && - t.texStorage2D(3553, fe, R, ee[0].width, ee[0].height); - for (let ie = 0, we = ee.length; ie < we; ie++) - (ne = ee[ie]), - b.format !== Nt - ? re !== null - ? ge - ? t.compressedTexSubImage2D( - 3553, - ie, - 0, - 0, - ne.width, - ne.height, - re, - ne.data - ) - : t.compressedTexImage2D( - 3553, - ie, - R, - ne.width, - ne.height, - 0, - ne.data - ) - : console.warn( - "THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()" - ) - : ge - ? t.texSubImage2D( - 3553, - ie, - 0, - 0, - ne.width, - ne.height, - re, - te, - ne.data - ) - : t.texImage2D( - 3553, - ie, - R, - ne.width, - ne.height, - 0, - re, - te, - ne.data - ); - } else if (b.isDataArrayTexture) - ge - ? (le && - t.texStorage3D(35866, fe, R, S.width, S.height, S.depth), - t.texSubImage3D( - 35866, - 0, - 0, - 0, - 0, - S.width, - S.height, - S.depth, - re, - te, - S.data - )) - : t.texImage3D( - 35866, - 0, - R, - S.width, - S.height, - S.depth, - 0, - re, - te, - S.data - ); - else if (b.isData3DTexture) - ge - ? (le && - t.texStorage3D(32879, fe, R, S.width, S.height, S.depth), - t.texSubImage3D( - 32879, - 0, - 0, - 0, - 0, - S.width, - S.height, - S.depth, - re, - te, - S.data - )) - : t.texImage3D( - 32879, - 0, - R, - S.width, - S.height, - S.depth, - 0, - re, - te, - S.data - ); - else if (b.isFramebufferTexture) { - if (le) - if (ge) t.texStorage2D(3553, fe, R, S.width, S.height); - else { - let ie = S.width, - we = S.height; - for (let Ve = 0; Ve < fe; Ve++) - t.texImage2D(3553, Ve, R, ie, we, 0, re, te, null), - (ie >>= 1), - (we >>= 1); - } - } else if (ee.length > 0 && K) { - ge && - le && - t.texStorage2D(3553, fe, R, ee[0].width, ee[0].height); - for (let ie = 0, we = ee.length; ie < we; ie++) - (ne = ee[ie]), - ge - ? t.texSubImage2D(3553, ie, 0, 0, re, te, ne) - : t.texImage2D(3553, ie, R, re, te, ne); - b.generateMipmaps = !1; - } else - ge - ? (le && t.texStorage2D(3553, fe, R, S.width, S.height), - t.texSubImage2D(3553, 0, 0, 0, re, te, S)) - : t.texImage2D(3553, 0, R, re, te, S); - A(b, K) && L(Q), - (he.__currentVersion = he.version), - b.onUpdate && b.onUpdate(b); - } - C.__version = b.version; - } - function xe(C, b, j) { - if (b.image.length !== 6) return; - const Q = Ie(C, b), - se = b.source; - if ( - (t.activeTexture(33984 + j), - t.bindTexture(34067, C.__webglTexture), - se.version !== se.__currentVersion || Q === !0) - ) { - r.pixelStorei(37440, b.flipY), - r.pixelStorei(37441, b.premultiplyAlpha), - r.pixelStorei(3317, b.unpackAlignment), - r.pixelStorei(37443, 0); - const he = b.isCompressedTexture || b.image[0].isCompressedTexture, - _e = b.image[0] && b.image[0].isDataTexture, - S = []; - for (let ie = 0; ie < 6; ie++) - !he && !_e - ? (S[ie] = x(b.image[ie], !1, !0, c)) - : (S[ie] = _e ? b.image[ie].image : b.image[ie]), - (S[ie] = Pt(b, S[ie])); - const K = S[0], - re = w(K) || o, - te = s.convert(b.format, b.encoding), - R = s.convert(b.type), - ne = _(b.internalFormat, te, R, b.encoding), - ee = o && b.isVideoTexture !== !0, - ge = se.__currentVersion === void 0 || Q === !0; - let le = T(b, K, re); - q(34067, b, re); - let fe; - if (he) { - ee && ge && t.texStorage2D(34067, le, ne, K.width, K.height); - for (let ie = 0; ie < 6; ie++) { - fe = S[ie].mipmaps; - for (let we = 0; we < fe.length; we++) { - const Ve = fe[we]; - b.format !== Nt - ? te !== null - ? ee - ? t.compressedTexSubImage2D( - 34069 + ie, - we, - 0, - 0, - Ve.width, - Ve.height, - te, - Ve.data - ) - : t.compressedTexImage2D( - 34069 + ie, - we, - ne, - Ve.width, - Ve.height, - 0, - Ve.data - ) - : console.warn( - "THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()" - ) - : ee - ? t.texSubImage2D( - 34069 + ie, - we, - 0, - 0, - Ve.width, - Ve.height, - te, - R, - Ve.data - ) - : t.texImage2D( - 34069 + ie, - we, - ne, - Ve.width, - Ve.height, - 0, - te, - R, - Ve.data - ); - } - } - } else { - (fe = b.mipmaps), - ee && - ge && - (fe.length > 0 && le++, - t.texStorage2D(34067, le, ne, S[0].width, S[0].height)); - for (let ie = 0; ie < 6; ie++) - if (_e) { - ee - ? t.texSubImage2D( - 34069 + ie, - 0, - 0, - 0, - S[ie].width, - S[ie].height, - te, - R, - S[ie].data - ) - : t.texImage2D( - 34069 + ie, - 0, - ne, - S[ie].width, - S[ie].height, - 0, - te, - R, - S[ie].data - ); - for (let we = 0; we < fe.length; we++) { - const Ge = fe[we].image[ie].image; - ee - ? t.texSubImage2D( - 34069 + ie, - we + 1, - 0, - 0, - Ge.width, - Ge.height, - te, - R, - Ge.data - ) - : t.texImage2D( - 34069 + ie, - we + 1, - ne, - Ge.width, - Ge.height, - 0, - te, - R, - Ge.data - ); - } - } else { - ee - ? t.texSubImage2D(34069 + ie, 0, 0, 0, te, R, S[ie]) - : t.texImage2D(34069 + ie, 0, ne, te, R, S[ie]); - for (let we = 0; we < fe.length; we++) { - const Ve = fe[we]; - ee - ? t.texSubImage2D( - 34069 + ie, - we + 1, - 0, - 0, - te, - R, - Ve.image[ie] - ) - : t.texImage2D( - 34069 + ie, - we + 1, - ne, - te, - R, - Ve.image[ie] - ); - } - } - } - A(b, re) && L(34067), - (se.__currentVersion = se.version), - b.onUpdate && b.onUpdate(b); - } - C.__version = b.version; - } - function ce(C, b, j, Q, se) { - const he = s.convert(j.format, j.encoding), - _e = s.convert(j.type), - S = _(j.internalFormat, he, _e, j.encoding); - n.get(b).__hasExternalTextures || - (se === 32879 || se === 35866 - ? t.texImage3D( - se, - 0, - S, - b.width, - b.height, - b.depth, - 0, - he, - _e, - null - ) - : t.texImage2D(se, 0, S, b.width, b.height, 0, he, _e, null)), - t.bindFramebuffer(36160, C), - Be(b) - ? d.framebufferTexture2DMultisampleEXT( - 36160, - Q, - se, - n.get(j).__webglTexture, - 0, - st(b) - ) - : r.framebufferTexture2D( - 36160, - Q, - se, - n.get(j).__webglTexture, - 0 - ), - t.bindFramebuffer(36160, null); - } - function De(C, b, j) { - if ( - (r.bindRenderbuffer(36161, C), b.depthBuffer && !b.stencilBuffer) - ) { - let Q = 33189; - if (j || Be(b)) { - const se = b.depthTexture; - se && - se.isDepthTexture && - (se.type === Ft ? (Q = 36012) : se.type === ii && (Q = 33190)); - const he = st(b); - Be(b) - ? d.renderbufferStorageMultisampleEXT( - 36161, - he, - Q, - b.width, - b.height - ) - : r.renderbufferStorageMultisample( - 36161, - he, - Q, - b.width, - b.height - ); - } else r.renderbufferStorage(36161, Q, b.width, b.height); - r.framebufferRenderbuffer(36160, 36096, 36161, C); - } else if (b.depthBuffer && b.stencilBuffer) { - const Q = st(b); - j && Be(b) === !1 - ? r.renderbufferStorageMultisample( - 36161, - Q, - 35056, - b.width, - b.height - ) - : Be(b) - ? d.renderbufferStorageMultisampleEXT( - 36161, - Q, - 35056, - b.width, - b.height - ) - : r.renderbufferStorage(36161, 34041, b.width, b.height), - r.framebufferRenderbuffer(36160, 33306, 36161, C); - } else { - const Q = - b.isWebGLMultipleRenderTargets === !0 ? b.texture : [b.texture]; - for (let se = 0; se < Q.length; se++) { - const he = Q[se], - _e = s.convert(he.format, he.encoding), - S = s.convert(he.type), - K = _(he.internalFormat, _e, S, he.encoding), - re = st(b); - j && Be(b) === !1 - ? r.renderbufferStorageMultisample( - 36161, - re, - K, - b.width, - b.height - ) - : Be(b) - ? d.renderbufferStorageMultisampleEXT( - 36161, - re, - K, - b.width, - b.height - ) - : r.renderbufferStorage(36161, K, b.width, b.height); - } - } - r.bindRenderbuffer(36161, null); - } - function Se(C, b) { - if (b && b.isWebGLCubeRenderTarget) - throw new Error( - "Depth Texture with cube render targets is not supported" - ); - if ( - (t.bindFramebuffer(36160, C), - !(b.depthTexture && b.depthTexture.isDepthTexture)) - ) - throw new Error( - "renderTarget.depthTexture must be an instance of THREE.DepthTexture" - ); - (!n.get(b.depthTexture).__webglTexture || - b.depthTexture.image.width !== b.width || - b.depthTexture.image.height !== b.height) && - ((b.depthTexture.image.width = b.width), - (b.depthTexture.image.height = b.height), - (b.depthTexture.needsUpdate = !0)), - X(b.depthTexture, 0); - const Q = n.get(b.depthTexture).__webglTexture, - se = st(b); - if (b.depthTexture.format === ri) - Be(b) - ? d.framebufferTexture2DMultisampleEXT( - 36160, - 36096, - 3553, - Q, - 0, - se - ) - : r.framebufferTexture2D(36160, 36096, 3553, Q, 0); - else if (b.depthTexture.format === Vi) - Be(b) - ? d.framebufferTexture2DMultisampleEXT( - 36160, - 33306, - 3553, - Q, - 0, - se - ) - : r.framebufferTexture2D(36160, 33306, 3553, Q, 0); - else throw new Error("Unknown depthTexture format"); - } - function Me(C) { - const b = n.get(C), - j = C.isWebGLCubeRenderTarget === !0; - if (C.depthTexture && !b.__autoAllocateDepthBuffer) { - if (j) - throw new Error( - "target.depthTexture not supported in Cube render targets" - ); - Se(b.__webglFramebuffer, C); - } else if (j) { - b.__webglDepthbuffer = []; - for (let Q = 0; Q < 6; Q++) - t.bindFramebuffer(36160, b.__webglFramebuffer[Q]), - (b.__webglDepthbuffer[Q] = r.createRenderbuffer()), - De(b.__webglDepthbuffer[Q], C, !1); - } else - t.bindFramebuffer(36160, b.__webglFramebuffer), - (b.__webglDepthbuffer = r.createRenderbuffer()), - De(b.__webglDepthbuffer, C, !1); - t.bindFramebuffer(36160, null); - } - function qe(C, b, j) { - const Q = n.get(C); - b !== void 0 && ce(Q.__webglFramebuffer, C, C.texture, 36064, 3553), - j !== void 0 && Me(C); - } - function ot(C) { - const b = C.texture, - j = n.get(C), - Q = n.get(b); - C.addEventListener("dispose", H), - C.isWebGLMultipleRenderTargets !== !0 && - (Q.__webglTexture === void 0 && - (Q.__webglTexture = r.createTexture()), - (Q.__version = b.version), - a.memory.textures++); - const se = C.isWebGLCubeRenderTarget === !0, - he = C.isWebGLMultipleRenderTargets === !0, - _e = w(C) || o; - if (se) { - j.__webglFramebuffer = []; - for (let S = 0; S < 6; S++) - j.__webglFramebuffer[S] = r.createFramebuffer(); - } else { - if (((j.__webglFramebuffer = r.createFramebuffer()), he)) - if (i.drawBuffers) { - const S = C.texture; - for (let K = 0, re = S.length; K < re; K++) { - const te = n.get(S[K]); - te.__webglTexture === void 0 && - ((te.__webglTexture = r.createTexture()), - a.memory.textures++); - } - } else - console.warn( - "THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension." - ); - if (o && C.samples > 0 && Be(C) === !1) { - const S = he ? b : [b]; - (j.__webglMultisampledFramebuffer = r.createFramebuffer()), - (j.__webglColorRenderbuffer = []), - t.bindFramebuffer(36160, j.__webglMultisampledFramebuffer); - for (let K = 0; K < S.length; K++) { - const re = S[K]; - (j.__webglColorRenderbuffer[K] = r.createRenderbuffer()), - r.bindRenderbuffer(36161, j.__webglColorRenderbuffer[K]); - const te = s.convert(re.format, re.encoding), - R = s.convert(re.type), - ne = _(re.internalFormat, te, R, re.encoding), - ee = st(C); - r.renderbufferStorageMultisample( - 36161, - ee, - ne, - C.width, - C.height - ), - r.framebufferRenderbuffer( - 36160, - 36064 + K, - 36161, - j.__webglColorRenderbuffer[K] - ); - } - r.bindRenderbuffer(36161, null), - C.depthBuffer && - ((j.__webglDepthRenderbuffer = r.createRenderbuffer()), - De(j.__webglDepthRenderbuffer, C, !0)), - t.bindFramebuffer(36160, null); - } - } - if (se) { - t.bindTexture(34067, Q.__webglTexture), q(34067, b, _e); - for (let S = 0; S < 6; S++) - ce(j.__webglFramebuffer[S], C, b, 36064, 34069 + S); - A(b, _e) && L(34067), t.unbindTexture(); - } else if (he) { - const S = C.texture; - for (let K = 0, re = S.length; K < re; K++) { - const te = S[K], - R = n.get(te); - t.bindTexture(3553, R.__webglTexture), - q(3553, te, _e), - ce(j.__webglFramebuffer, C, te, 36064 + K, 3553), - A(te, _e) && L(3553); - } - t.unbindTexture(); - } else { - let S = 3553; - (C.isWebGL3DRenderTarget || C.isWebGLArrayRenderTarget) && - (o - ? (S = C.isWebGL3DRenderTarget ? 32879 : 35866) - : console.error( - "THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2." - )), - t.bindTexture(S, Q.__webglTexture), - q(S, b, _e), - ce(j.__webglFramebuffer, C, b, 36064, S), - A(b, _e) && L(S), - t.unbindTexture(); - } - C.depthBuffer && Me(C); - } - function ut(C) { - const b = w(C) || o, - j = C.isWebGLMultipleRenderTargets === !0 ? C.texture : [C.texture]; - for (let Q = 0, se = j.length; Q < se; Q++) { - const he = j[Q]; - if (A(he, b)) { - const _e = C.isWebGLCubeRenderTarget ? 34067 : 3553, - S = n.get(he).__webglTexture; - t.bindTexture(_e, S), L(_e), t.unbindTexture(); - } - } - } - function At(C) { - if (o && C.samples > 0 && Be(C) === !1) { - const b = C.isWebGLMultipleRenderTargets ? C.texture : [C.texture], - j = C.width, - Q = C.height; - let se = 16384; - const he = [], - _e = C.stencilBuffer ? 33306 : 36096, - S = n.get(C), - K = C.isWebGLMultipleRenderTargets === !0; - if (K) - for (let re = 0; re < b.length; re++) - t.bindFramebuffer(36160, S.__webglMultisampledFramebuffer), - r.framebufferRenderbuffer(36160, 36064 + re, 36161, null), - t.bindFramebuffer(36160, S.__webglFramebuffer), - r.framebufferTexture2D(36009, 36064 + re, 3553, null, 0); - t.bindFramebuffer(36008, S.__webglMultisampledFramebuffer), - t.bindFramebuffer(36009, S.__webglFramebuffer); - for (let re = 0; re < b.length; re++) { - he.push(36064 + re), C.depthBuffer && he.push(_e); - const te = - S.__ignoreDepthValues !== void 0 ? S.__ignoreDepthValues : !1; - if ( - (te === !1 && - (C.depthBuffer && (se |= 256), - C.stencilBuffer && (se |= 1024)), - K && - r.framebufferRenderbuffer( - 36008, - 36064, - 36161, - S.__webglColorRenderbuffer[re] - ), - te === !0 && - (r.invalidateFramebuffer(36008, [_e]), - r.invalidateFramebuffer(36009, [_e])), - K) - ) { - const R = n.get(b[re]).__webglTexture; - r.framebufferTexture2D(36009, 36064, 3553, R, 0); - } - r.blitFramebuffer(0, 0, j, Q, 0, 0, j, Q, se, 9728), - f && r.invalidateFramebuffer(36008, he); - } - if ( - (t.bindFramebuffer(36008, null), - t.bindFramebuffer(36009, null), - K) - ) - for (let re = 0; re < b.length; re++) { - t.bindFramebuffer(36160, S.__webglMultisampledFramebuffer), - r.framebufferRenderbuffer( - 36160, - 36064 + re, - 36161, - S.__webglColorRenderbuffer[re] - ); - const te = n.get(b[re]).__webglTexture; - t.bindFramebuffer(36160, S.__webglFramebuffer), - r.framebufferTexture2D(36009, 36064 + re, 3553, te, 0); - } - t.bindFramebuffer(36009, S.__webglMultisampledFramebuffer); - } - } - function st(C) { - return Math.min(h, C.samples); - } - function Be(C) { - const b = n.get(C); - return ( - o && - C.samples > 0 && - e.has("WEBGL_multisampled_render_to_texture") === !0 && - b.__useRenderToTexture !== !1 - ); - } - function Rt(C) { - const b = a.render.frame; - g.get(C) !== b && (g.set(C, b), C.update()); - } - function Pt(C, b) { - const j = C.encoding, - Q = C.format, - se = C.type; - return ( - C.isCompressedTexture === !0 || - C.isVideoTexture === !0 || - C.format === Ua || - (j !== Vn && - (j === Pe - ? o === !1 - ? e.has("EXT_sRGB") === !0 && Q === Nt - ? ((C.format = Ua), - (C.minFilter = $e), - (C.generateMipmaps = !1)) - : (b = Wc.sRGBToLinear(b)) - : (Q !== Nt || se !== oi) && - console.warn( - "THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType." - ) - : console.error( - "THREE.WebGLTextures: Unsupported texture encoding:", - j - ))), - b - ); - } - (this.allocateTextureUnit = G), - (this.resetTextureUnits = k), - (this.setTexture2D = X), - (this.setTexture2DArray = Z), - (this.setTexture3D = Y), - (this.setTextureCube = J), - (this.rebindTextures = qe), - (this.setupRenderTarget = ot), - (this.updateRenderTargetMipmap = ut), - (this.updateMultisampleRenderTarget = At), - (this.setupDepthRenderbuffer = Me), - (this.setupFrameBufferTexture = ce), - (this.useMultisampledRTT = Be); - } - function s0(r, e, t) { - const n = t.isWebGL2; - function i(s, a = null) { - let o; - if (s === oi) return 5121; - if (s === Uu) return 32819; - if (s === Bu) return 32820; - if (s === zu) return 5120; - if (s === Ou) return 5122; - if (s === kc) return 5123; - if (s === ku) return 5124; - if (s === ii) return 5125; - if (s === Ft) return 5126; - if (s === Mn) - return n - ? 5131 - : ((o = e.get("OES_texture_half_float")), - o !== null ? o.HALF_FLOAT_OES : null); - if (s === Vu) return 6406; - if (s === Nt) return 6408; - if (s === Hu) return 6409; - if (s === Wu) return 6410; - if (s === ri) return 6402; - if (s === Vi) return 34041; - if (s === Uc) return 6403; - if (s === Gu) - return ( - console.warn( - "THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228" - ), - 6408 - ); - if (s === Ua) - return ( - (o = e.get("EXT_sRGB")), o !== null ? o.SRGB_ALPHA_EXT : null - ); - if (s === ju) return 36244; - if (s === Xu) return 33319; - if (s === qu) return 33320; - if (s === $u) return 36249; - if (s === qr || s === $r || s === Yr || s === Kr) - if (a === Pe) - if ( - ((o = e.get("WEBGL_compressed_texture_s3tc_srgb")), o !== null) - ) { - if (s === qr) return o.COMPRESSED_SRGB_S3TC_DXT1_EXT; - if (s === $r) return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT; - if (s === Yr) return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; - if (s === Kr) return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; - } else return null; - else if ( - ((o = e.get("WEBGL_compressed_texture_s3tc")), o !== null) - ) { - if (s === qr) return o.COMPRESSED_RGB_S3TC_DXT1_EXT; - if (s === $r) return o.COMPRESSED_RGBA_S3TC_DXT1_EXT; - if (s === Yr) return o.COMPRESSED_RGBA_S3TC_DXT3_EXT; - if (s === Kr) return o.COMPRESSED_RGBA_S3TC_DXT5_EXT; - } else return null; - if (s === ko || s === Uo || s === Bo || s === Vo) - if (((o = e.get("WEBGL_compressed_texture_pvrtc")), o !== null)) { - if (s === ko) return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; - if (s === Uo) return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG; - if (s === Bo) return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; - if (s === Vo) return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; - } else return null; - if (s === Yu) - return ( - (o = e.get("WEBGL_compressed_texture_etc1")), - o !== null ? o.COMPRESSED_RGB_ETC1_WEBGL : null - ); - if (s === Go || s === Ho) - if (((o = e.get("WEBGL_compressed_texture_etc")), o !== null)) { - if (s === Go) - return a === Pe - ? o.COMPRESSED_SRGB8_ETC2 - : o.COMPRESSED_RGB8_ETC2; - if (s === Ho) - return a === Pe - ? o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC - : o.COMPRESSED_RGBA8_ETC2_EAC; - } else return null; - if ( - s === Wo || - s === jo || - s === Xo || - s === qo || - s === $o || - s === Yo || - s === Ko || - s === Zo || - s === Jo || - s === Qo || - s === el || - s === tl || - s === nl || - s === il - ) - if (((o = e.get("WEBGL_compressed_texture_astc")), o !== null)) { - if (s === Wo) - return a === Pe - ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR - : o.COMPRESSED_RGBA_ASTC_4x4_KHR; - if (s === jo) - return a === Pe - ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR - : o.COMPRESSED_RGBA_ASTC_5x4_KHR; - if (s === Xo) - return a === Pe - ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR - : o.COMPRESSED_RGBA_ASTC_5x5_KHR; - if (s === qo) - return a === Pe - ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR - : o.COMPRESSED_RGBA_ASTC_6x5_KHR; - if (s === $o) - return a === Pe - ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR - : o.COMPRESSED_RGBA_ASTC_6x6_KHR; - if (s === Yo) - return a === Pe - ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR - : o.COMPRESSED_RGBA_ASTC_8x5_KHR; - if (s === Ko) - return a === Pe - ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR - : o.COMPRESSED_RGBA_ASTC_8x6_KHR; - if (s === Zo) - return a === Pe - ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR - : o.COMPRESSED_RGBA_ASTC_8x8_KHR; - if (s === Jo) - return a === Pe - ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR - : o.COMPRESSED_RGBA_ASTC_10x5_KHR; - if (s === Qo) - return a === Pe - ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR - : o.COMPRESSED_RGBA_ASTC_10x6_KHR; - if (s === el) - return a === Pe - ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR - : o.COMPRESSED_RGBA_ASTC_10x8_KHR; - if (s === tl) - return a === Pe - ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR - : o.COMPRESSED_RGBA_ASTC_10x10_KHR; - if (s === nl) - return a === Pe - ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR - : o.COMPRESSED_RGBA_ASTC_12x10_KHR; - if (s === il) - return a === Pe - ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR - : o.COMPRESSED_RGBA_ASTC_12x12_KHR; - } else return null; - if (s === sl) - if (((o = e.get("EXT_texture_compression_bptc")), o !== null)) { - if (s === sl) - return a === Pe - ? o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT - : o.COMPRESSED_RGBA_BPTC_UNORM_EXT; - } else return null; - return s === Oi - ? n - ? 34042 - : ((o = e.get("WEBGL_depth_texture")), - o !== null ? o.UNSIGNED_INT_24_8_WEBGL : null) - : r[s] !== void 0 - ? r[s] - : null; - } - return { convert: i }; - } - class r0 extends mt { - constructor(e = []) { - super(), (this.isArrayCamera = !0), (this.cameras = e); - } - } - class bn extends Ye { - constructor() { - super(), (this.isGroup = !0), (this.type = "Group"); - } - } - const a0 = { type: "move" }; - class Sa { - constructor() { - (this._targetRay = null), (this._grip = null), (this._hand = null); - } - getHandSpace() { - return ( - this._hand === null && - ((this._hand = new bn()), - (this._hand.matrixAutoUpdate = !1), - (this._hand.visible = !1), - (this._hand.joints = {}), - (this._hand.inputState = { pinching: !1 })), - this._hand - ); - } - getTargetRaySpace() { - return ( - this._targetRay === null && - ((this._targetRay = new bn()), - (this._targetRay.matrixAutoUpdate = !1), - (this._targetRay.visible = !1), - (this._targetRay.hasLinearVelocity = !1), - (this._targetRay.linearVelocity = new P()), - (this._targetRay.hasAngularVelocity = !1), - (this._targetRay.angularVelocity = new P())), - this._targetRay - ); - } - getGripSpace() { - return ( - this._grip === null && - ((this._grip = new bn()), - (this._grip.matrixAutoUpdate = !1), - (this._grip.visible = !1), - (this._grip.hasLinearVelocity = !1), - (this._grip.linearVelocity = new P()), - (this._grip.hasAngularVelocity = !1), - (this._grip.angularVelocity = new P())), - this._grip - ); - } - dispatchEvent(e) { - return ( - this._targetRay !== null && this._targetRay.dispatchEvent(e), - this._grip !== null && this._grip.dispatchEvent(e), - this._hand !== null && this._hand.dispatchEvent(e), - this - ); - } - disconnect(e) { - return ( - this.dispatchEvent({ type: "disconnected", data: e }), - this._targetRay !== null && (this._targetRay.visible = !1), - this._grip !== null && (this._grip.visible = !1), - this._hand !== null && (this._hand.visible = !1), - this - ); - } - update(e, t, n) { - let i = null, - s = null, - a = null; - const o = this._targetRay, - l = this._grip, - c = this._hand; - if (e && t.session.visibilityState !== "visible-blurred") - if ( - (o !== null && - ((i = t.getPose(e.targetRaySpace, n)), - i !== null && - (o.matrix.fromArray(i.transform.matrix), - o.matrix.decompose(o.position, o.rotation, o.scale), - i.linearVelocity - ? ((o.hasLinearVelocity = !0), - o.linearVelocity.copy(i.linearVelocity)) - : (o.hasLinearVelocity = !1), - i.angularVelocity - ? ((o.hasAngularVelocity = !0), - o.angularVelocity.copy(i.angularVelocity)) - : (o.hasAngularVelocity = !1), - this.dispatchEvent(a0))), - c && e.hand) - ) { - a = !0; - for (const m of e.hand.values()) { - const p = t.getJointPose(m, n); - if (c.joints[m.jointName] === void 0) { - const M = new bn(); - (M.matrixAutoUpdate = !1), - (M.visible = !1), - (c.joints[m.jointName] = M), - c.add(M); - } - const v = c.joints[m.jointName]; - p !== null && - (v.matrix.fromArray(p.transform.matrix), - v.matrix.decompose(v.position, v.rotation, v.scale), - (v.jointRadius = p.radius)), - (v.visible = p !== null); - } - const u = c.joints["index-finger-tip"], - h = c.joints["thumb-tip"], - d = u.position.distanceTo(h.position), - f = 0.02, - g = 0.005; - c.inputState.pinching && d > f + g - ? ((c.inputState.pinching = !1), - this.dispatchEvent({ - type: "pinchend", - handedness: e.handedness, - target: this, - })) - : !c.inputState.pinching && - d <= f - g && - ((c.inputState.pinching = !0), - this.dispatchEvent({ - type: "pinchstart", - handedness: e.handedness, - target: this, - })); - } else - l !== null && - e.gripSpace && - ((s = t.getPose(e.gripSpace, n)), - s !== null && - (l.matrix.fromArray(s.transform.matrix), - l.matrix.decompose(l.position, l.rotation, l.scale), - s.linearVelocity - ? ((l.hasLinearVelocity = !0), - l.linearVelocity.copy(s.linearVelocity)) - : (l.hasLinearVelocity = !1), - s.angularVelocity - ? ((l.hasAngularVelocity = !0), - l.angularVelocity.copy(s.angularVelocity)) - : (l.hasAngularVelocity = !1))); - return ( - o !== null && (o.visible = i !== null), - l !== null && (l.visible = s !== null), - c !== null && (c.visible = a !== null), - this - ); - } - } - class o0 extends nt { - constructor(e, t, n, i, s, a, o, l, c, u) { - if (((u = u !== void 0 ? u : ri), u !== ri && u !== Vi)) - throw new Error( - "DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat" - ); - n === void 0 && u === ri && (n = ii), - n === void 0 && u === Vi && (n = Oi), - super(null, i, s, a, o, l, u, n, c), - (this.isDepthTexture = !0), - (this.image = { width: e, height: t }), - (this.magFilter = o !== void 0 ? o : ft), - (this.minFilter = l !== void 0 ? l : ft), - (this.flipY = !1), - (this.generateMipmaps = !1); - } - } - class l0 extends hi { - constructor(e, t) { - super(); - const n = this; - let i = null, - s = 1, - a = null, - o = "local-floor", - l = null, - c = null, - u = null, - h = null, - d = null, - f = null; - const g = t.getContextAttributes(); - let m = null, - p = null; - const v = [], - M = new Map(), - x = new mt(); - x.layers.enable(1), (x.viewport = new Ue()); - const w = new mt(); - w.layers.enable(2), (w.viewport = new Ue()); - const y = [x, w], - A = new r0(); - A.layers.enable(1), A.layers.enable(2); - let L = null, - _ = null; - (this.cameraAutoUpdate = !0), - (this.enabled = !1), - (this.isPresenting = !1), - (this.getController = function (U) { - let X = v[U]; - return ( - X === void 0 && ((X = new Sa()), (v[U] = X)), - X.getTargetRaySpace() - ); - }), - (this.getControllerGrip = function (U) { - let X = v[U]; - return ( - X === void 0 && ((X = new Sa()), (v[U] = X)), X.getGripSpace() - ); - }), - (this.getHand = function (U) { - let X = v[U]; - return ( - X === void 0 && ((X = new Sa()), (v[U] = X)), X.getHandSpace() - ); - }); - function T(U) { - const X = M.get(U.inputSource); - X !== void 0 && - X.dispatchEvent({ type: U.type, data: U.inputSource }); - } - function I() { - i.removeEventListener("select", T), - i.removeEventListener("selectstart", T), - i.removeEventListener("selectend", T), - i.removeEventListener("squeeze", T), - i.removeEventListener("squeezestart", T), - i.removeEventListener("squeezeend", T), - i.removeEventListener("end", I), - i.removeEventListener("inputsourceschange", F), - M.forEach(function (U, X) { - U !== void 0 && U.disconnect(X); - }), - M.clear(), - (L = null), - (_ = null), - e.setRenderTarget(m), - (d = null), - (h = null), - (u = null), - (i = null), - (p = null), - G.stop(), - (n.isPresenting = !1), - n.dispatchEvent({ type: "sessionend" }); - } - (this.setFramebufferScaleFactor = function (U) { - (s = U), - n.isPresenting === !0 && - console.warn( - "THREE.WebXRManager: Cannot change framebuffer scale while presenting." - ); - }), - (this.setReferenceSpaceType = function (U) { - (o = U), - n.isPresenting === !0 && - console.warn( - "THREE.WebXRManager: Cannot change reference space type while presenting." - ); - }), - (this.getReferenceSpace = function () { - return l || a; - }), - (this.setReferenceSpace = function (U) { - l = U; - }), - (this.getBaseLayer = function () { - return h !== null ? h : d; - }), - (this.getBinding = function () { - return u; - }), - (this.getFrame = function () { - return f; - }), - (this.getSession = function () { - return i; - }), - (this.setSession = async function (U) { - if (((i = U), i !== null)) { - if ( - ((m = e.getRenderTarget()), - i.addEventListener("select", T), - i.addEventListener("selectstart", T), - i.addEventListener("selectend", T), - i.addEventListener("squeeze", T), - i.addEventListener("squeezestart", T), - i.addEventListener("squeezeend", T), - i.addEventListener("end", I), - i.addEventListener("inputsourceschange", F), - g.xrCompatible !== !0 && (await t.makeXRCompatible()), - i.renderState.layers === void 0 || - e.capabilities.isWebGL2 === !1) - ) { - const X = { - antialias: - i.renderState.layers === void 0 ? g.antialias : !0, - alpha: g.alpha, - depth: g.depth, - stencil: g.stencil, - framebufferScaleFactor: s, - }; - (d = new XRWebGLLayer(i, t, X)), - i.updateRenderState({ baseLayer: d }), - (p = new Kt(d.framebufferWidth, d.framebufferHeight, { - format: Nt, - type: oi, - encoding: e.outputEncoding, - })); - } else { - let X = null, - Z = null, - Y = null; - g.depth && - ((Y = g.stencil ? 35056 : 33190), - (X = g.stencil ? Vi : ri), - (Z = g.stencil ? Oi : ii)); - const J = { - colorFormat: e.outputEncoding === Pe ? 35907 : 32856, - depthFormat: Y, - scaleFactor: s, - }; - (u = new XRWebGLBinding(i, t)), - (h = u.createProjectionLayer(J)), - i.updateRenderState({ layers: [h] }), - (p = new Kt(h.textureWidth, h.textureHeight, { - format: Nt, - type: oi, - depthTexture: new o0( - h.textureWidth, - h.textureHeight, - Z, - void 0, - void 0, - void 0, - void 0, - void 0, - void 0, - X - ), - stencilBuffer: g.stencil, - encoding: e.outputEncoding, - samples: g.antialias ? 4 : 0, - })); - const ae = e.properties.get(p); - ae.__ignoreDepthValues = h.ignoreDepthValues; - } - (p.isXRRenderTarget = !0), - this.setFoveation(1), - (l = null), - (a = await i.requestReferenceSpace(o)), - G.setContext(i), - G.start(), - (n.isPresenting = !0), - n.dispatchEvent({ type: "sessionstart" }); - } - }); - function F(U) { - const X = i.inputSources; - for (let Z = 0; Z < X.length; Z++) { - const Y = X[Z].handedness === "right" ? 1 : 0; - M.set(X[Z], v[Y]); - } - for (let Z = 0; Z < U.removed.length; Z++) { - const Y = U.removed[Z], - J = M.get(Y); - J && - (J.dispatchEvent({ type: "disconnected", data: Y }), - M.delete(Y)); - } - for (let Z = 0; Z < U.added.length; Z++) { - const Y = U.added[Z], - J = M.get(Y); - J && J.dispatchEvent({ type: "connected", data: Y }); - } - } - const H = new P(), - B = new P(); - function D(U, X, Z) { - H.setFromMatrixPosition(X.matrixWorld), - B.setFromMatrixPosition(Z.matrixWorld); - const Y = H.distanceTo(B), - J = X.projectionMatrix.elements, - ae = Z.projectionMatrix.elements, - ue = J[14] / (J[10] - 1), - q = J[14] / (J[10] + 1), - Ie = (J[9] + 1) / J[5], - me = (J[9] - 1) / J[5], - xe = (J[8] - 1) / J[0], - ce = (ae[8] + 1) / ae[0], - De = ue * xe, - Se = ue * ce, - Me = Y / (-xe + ce), - qe = Me * -xe; - X.matrixWorld.decompose(U.position, U.quaternion, U.scale), - U.translateX(qe), - U.translateZ(Me), - U.matrixWorld.compose(U.position, U.quaternion, U.scale), - U.matrixWorldInverse.copy(U.matrixWorld).invert(); - const ot = ue + Me, - ut = q + Me, - At = De - qe, - st = Se + (Y - qe), - Be = ((Ie * q) / ut) * ot, - Rt = ((me * q) / ut) * ot; - U.projectionMatrix.makePerspective(At, st, Be, Rt, ot, ut); - } - function z(U, X) { - X === null - ? U.matrixWorld.copy(U.matrix) - : U.matrixWorld.multiplyMatrices(X.matrixWorld, U.matrix), - U.matrixWorldInverse.copy(U.matrixWorld).invert(); - } - (this.updateCamera = function (U) { - if (i === null) return; - (A.near = w.near = x.near = U.near), - (A.far = w.far = x.far = U.far), - (L !== A.near || _ !== A.far) && - (i.updateRenderState({ depthNear: A.near, depthFar: A.far }), - (L = A.near), - (_ = A.far)); - const X = U.parent, - Z = A.cameras; - z(A, X); - for (let J = 0; J < Z.length; J++) z(Z[J], X); - A.matrixWorld.decompose(A.position, A.quaternion, A.scale), - U.position.copy(A.position), - U.quaternion.copy(A.quaternion), - U.scale.copy(A.scale), - U.matrix.copy(A.matrix), - U.matrixWorld.copy(A.matrixWorld); - const Y = U.children; - for (let J = 0, ae = Y.length; J < ae; J++) - Y[J].updateMatrixWorld(!0); - Z.length === 2 - ? D(A, x, w) - : A.projectionMatrix.copy(x.projectionMatrix); - }), - (this.getCamera = function () { - return A; - }), - (this.getFoveation = function () { - if (h !== null) return h.fixedFoveation; - if (d !== null) return d.fixedFoveation; - }), - (this.setFoveation = function (U) { - h !== null && (h.fixedFoveation = U), - d !== null && - d.fixedFoveation !== void 0 && - (d.fixedFoveation = U); - }); - let N = null; - function k(U, X) { - if (((c = X.getViewerPose(l || a)), (f = X), c !== null)) { - const Y = c.views; - d !== null && - (e.setRenderTargetFramebuffer(p, d.framebuffer), - e.setRenderTarget(p)); - let J = !1; - Y.length !== A.cameras.length && - ((A.cameras.length = 0), (J = !0)); - for (let ae = 0; ae < Y.length; ae++) { - const ue = Y[ae]; - let q = null; - if (d !== null) q = d.getViewport(ue); - else { - const me = u.getViewSubImage(h, ue); - (q = me.viewport), - ae === 0 && - (e.setRenderTargetTextures( - p, - me.colorTexture, - h.ignoreDepthValues ? void 0 : me.depthStencilTexture - ), - e.setRenderTarget(p)); - } - let Ie = y[ae]; - Ie === void 0 && - ((Ie = new mt()), - Ie.layers.enable(ae), - (Ie.viewport = new Ue()), - (y[ae] = Ie)), - Ie.matrix.fromArray(ue.transform.matrix), - Ie.projectionMatrix.fromArray(ue.projectionMatrix), - Ie.viewport.set(q.x, q.y, q.width, q.height), - ae === 0 && A.matrix.copy(Ie.matrix), - J === !0 && A.cameras.push(Ie); - } - } - const Z = i.inputSources; - for (let Y = 0; Y < v.length; Y++) { - const J = Z[Y], - ae = M.get(J); - ae !== void 0 && ae.update(J, X, l || a); - } - N && N(U, X), (f = null); - } - const G = new Zc(); - G.setAnimationLoop(k), - (this.setAnimationLoop = function (U) { - N = U; - }), - (this.dispose = function () {}); - } - } - function c0(r, e) { - function t(m, p) { - m.fogColor.value.copy(p.color), - p.isFog - ? ((m.fogNear.value = p.near), (m.fogFar.value = p.far)) - : p.isFogExp2 && (m.fogDensity.value = p.density); - } - function n(m, p, v, M, x) { - p.isMeshBasicMaterial || p.isMeshLambertMaterial - ? i(m, p) - : p.isMeshToonMaterial - ? (i(m, p), u(m, p)) - : p.isMeshPhongMaterial - ? (i(m, p), c(m, p)) - : p.isMeshStandardMaterial - ? (i(m, p), h(m, p), p.isMeshPhysicalMaterial && d(m, p, x)) - : p.isMeshMatcapMaterial - ? (i(m, p), f(m, p)) - : p.isMeshDepthMaterial - ? i(m, p) - : p.isMeshDistanceMaterial - ? (i(m, p), g(m, p)) - : p.isMeshNormalMaterial - ? i(m, p) - : p.isLineBasicMaterial - ? (s(m, p), p.isLineDashedMaterial && a(m, p)) - : p.isPointsMaterial - ? o(m, p, v, M) - : p.isSpriteMaterial - ? l(m, p) - : p.isShadowMaterial - ? (m.color.value.copy(p.color), (m.opacity.value = p.opacity)) - : p.isShaderMaterial && (p.uniformsNeedUpdate = !1); - } - function i(m, p) { - (m.opacity.value = p.opacity), - p.color && m.diffuse.value.copy(p.color), - p.emissive && - m.emissive.value - .copy(p.emissive) - .multiplyScalar(p.emissiveIntensity), - p.map && (m.map.value = p.map), - p.alphaMap && (m.alphaMap.value = p.alphaMap), - p.bumpMap && - ((m.bumpMap.value = p.bumpMap), - (m.bumpScale.value = p.bumpScale), - p.side === qt && (m.bumpScale.value *= -1)), - p.displacementMap && - ((m.displacementMap.value = p.displacementMap), - (m.displacementScale.value = p.displacementScale), - (m.displacementBias.value = p.displacementBias)), - p.emissiveMap && (m.emissiveMap.value = p.emissiveMap), - p.normalMap && - ((m.normalMap.value = p.normalMap), - m.normalScale.value.copy(p.normalScale), - p.side === qt && m.normalScale.value.negate()), - p.specularMap && (m.specularMap.value = p.specularMap), - p.alphaTest > 0 && (m.alphaTest.value = p.alphaTest); - const v = e.get(p).envMap; - if ( - (v && - ((m.envMap.value = v), - (m.flipEnvMap.value = - v.isCubeTexture && v.isRenderTargetTexture === !1 ? -1 : 1), - (m.reflectivity.value = p.reflectivity), - (m.ior.value = p.ior), - (m.refractionRatio.value = p.refractionRatio)), - p.lightMap) - ) { - m.lightMap.value = p.lightMap; - const w = r.physicallyCorrectLights !== !0 ? Math.PI : 1; - m.lightMapIntensity.value = p.lightMapIntensity * w; - } - p.aoMap && - ((m.aoMap.value = p.aoMap), - (m.aoMapIntensity.value = p.aoMapIntensity)); - let M; - p.map - ? (M = p.map) - : p.specularMap - ? (M = p.specularMap) - : p.displacementMap - ? (M = p.displacementMap) - : p.normalMap - ? (M = p.normalMap) - : p.bumpMap - ? (M = p.bumpMap) - : p.roughnessMap - ? (M = p.roughnessMap) - : p.metalnessMap - ? (M = p.metalnessMap) - : p.alphaMap - ? (M = p.alphaMap) - : p.emissiveMap - ? (M = p.emissiveMap) - : p.clearcoatMap - ? (M = p.clearcoatMap) - : p.clearcoatNormalMap - ? (M = p.clearcoatNormalMap) - : p.clearcoatRoughnessMap - ? (M = p.clearcoatRoughnessMap) - : p.iridescenceMap - ? (M = p.iridescenceMap) - : p.iridescenceThicknessMap - ? (M = p.iridescenceThicknessMap) - : p.specularIntensityMap - ? (M = p.specularIntensityMap) - : p.specularColorMap - ? (M = p.specularColorMap) - : p.transmissionMap - ? (M = p.transmissionMap) - : p.thicknessMap - ? (M = p.thicknessMap) - : p.sheenColorMap - ? (M = p.sheenColorMap) - : p.sheenRoughnessMap && (M = p.sheenRoughnessMap), - M !== void 0 && - (M.isWebGLRenderTarget && (M = M.texture), - M.matrixAutoUpdate === !0 && M.updateMatrix(), - m.uvTransform.value.copy(M.matrix)); - let x; - p.aoMap ? (x = p.aoMap) : p.lightMap && (x = p.lightMap), - x !== void 0 && - (x.isWebGLRenderTarget && (x = x.texture), - x.matrixAutoUpdate === !0 && x.updateMatrix(), - m.uv2Transform.value.copy(x.matrix)); - } - function s(m, p) { - m.diffuse.value.copy(p.color), (m.opacity.value = p.opacity); - } - function a(m, p) { - (m.dashSize.value = p.dashSize), - (m.totalSize.value = p.dashSize + p.gapSize), - (m.scale.value = p.scale); - } - function o(m, p, v, M) { - m.diffuse.value.copy(p.color), - (m.opacity.value = p.opacity), - (m.size.value = p.size * v), - (m.scale.value = M * 0.5), - p.map && (m.map.value = p.map), - p.alphaMap && (m.alphaMap.value = p.alphaMap), - p.alphaTest > 0 && (m.alphaTest.value = p.alphaTest); - let x; - p.map ? (x = p.map) : p.alphaMap && (x = p.alphaMap), - x !== void 0 && - (x.matrixAutoUpdate === !0 && x.updateMatrix(), - m.uvTransform.value.copy(x.matrix)); - } - function l(m, p) { - m.diffuse.value.copy(p.color), - (m.opacity.value = p.opacity), - (m.rotation.value = p.rotation), - p.map && (m.map.value = p.map), - p.alphaMap && (m.alphaMap.value = p.alphaMap), - p.alphaTest > 0 && (m.alphaTest.value = p.alphaTest); - let v; - p.map ? (v = p.map) : p.alphaMap && (v = p.alphaMap), - v !== void 0 && - (v.matrixAutoUpdate === !0 && v.updateMatrix(), - m.uvTransform.value.copy(v.matrix)); - } - function c(m, p) { - m.specular.value.copy(p.specular), - (m.shininess.value = Math.max(p.shininess, 1e-4)); - } - function u(m, p) { - p.gradientMap && (m.gradientMap.value = p.gradientMap); - } - function h(m, p) { - (m.roughness.value = p.roughness), - (m.metalness.value = p.metalness), - p.roughnessMap && (m.roughnessMap.value = p.roughnessMap), - p.metalnessMap && (m.metalnessMap.value = p.metalnessMap), - e.get(p).envMap && (m.envMapIntensity.value = p.envMapIntensity); - } - function d(m, p, v) { - (m.ior.value = p.ior), - p.sheen > 0 && - (m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen), - (m.sheenRoughness.value = p.sheenRoughness), - p.sheenColorMap && (m.sheenColorMap.value = p.sheenColorMap), - p.sheenRoughnessMap && - (m.sheenRoughnessMap.value = p.sheenRoughnessMap)), - p.clearcoat > 0 && - ((m.clearcoat.value = p.clearcoat), - (m.clearcoatRoughness.value = p.clearcoatRoughness), - p.clearcoatMap && (m.clearcoatMap.value = p.clearcoatMap), - p.clearcoatRoughnessMap && - (m.clearcoatRoughnessMap.value = p.clearcoatRoughnessMap), - p.clearcoatNormalMap && - (m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale), - (m.clearcoatNormalMap.value = p.clearcoatNormalMap), - p.side === qt && m.clearcoatNormalScale.value.negate())), - p.iridescence > 0 && - ((m.iridescence.value = p.iridescence), - (m.iridescenceIOR.value = p.iridescenceIOR), - (m.iridescenceThicknessMinimum.value = - p.iridescenceThicknessRange[0]), - (m.iridescenceThicknessMaximum.value = - p.iridescenceThicknessRange[1]), - p.iridescenceMap && (m.iridescenceMap.value = p.iridescenceMap), - p.iridescenceThicknessMap && - (m.iridescenceThicknessMap.value = p.iridescenceThicknessMap)), - p.transmission > 0 && - ((m.transmission.value = p.transmission), - (m.transmissionSamplerMap.value = v.texture), - m.transmissionSamplerSize.value.set(v.width, v.height), - p.transmissionMap && - (m.transmissionMap.value = p.transmissionMap), - (m.thickness.value = p.thickness), - p.thicknessMap && (m.thicknessMap.value = p.thicknessMap), - (m.attenuationDistance.value = p.attenuationDistance), - m.attenuationColor.value.copy(p.attenuationColor)), - (m.specularIntensity.value = p.specularIntensity), - m.specularColor.value.copy(p.specularColor), - p.specularIntensityMap && - (m.specularIntensityMap.value = p.specularIntensityMap), - p.specularColorMap && - (m.specularColorMap.value = p.specularColorMap); - } - function f(m, p) { - p.matcap && (m.matcap.value = p.matcap); - } - function g(m, p) { - m.referencePosition.value.copy(p.referencePosition), - (m.nearDistance.value = p.nearDistance), - (m.farDistance.value = p.farDistance); - } - return { refreshFogUniforms: t, refreshMaterialUniforms: n }; - } - function h0() { - const r = Cs("canvas"); - return (r.style.display = "block"), r; - } - function rh(r = {}) { - this.isWebGLRenderer = !0; - const e = r.canvas !== void 0 ? r.canvas : h0(), - t = r.context !== void 0 ? r.context : null, - n = r.depth !== void 0 ? r.depth : !0, - i = r.stencil !== void 0 ? r.stencil : !0, - s = r.antialias !== void 0 ? r.antialias : !1, - a = r.premultipliedAlpha !== void 0 ? r.premultipliedAlpha : !0, - o = r.preserveDrawingBuffer !== void 0 ? r.preserveDrawingBuffer : !1, - l = r.powerPreference !== void 0 ? r.powerPreference : "default", - c = - r.failIfMajorPerformanceCaveat !== void 0 - ? r.failIfMajorPerformanceCaveat - : !1; - let u; - t !== null - ? (u = t.getContextAttributes().alpha) - : (u = r.alpha !== void 0 ? r.alpha : !1); - let h = null, - d = null; - const f = [], - g = []; - (this.domElement = e), - (this.debug = { checkShaderErrors: !0 }), - (this.autoClear = !0), - (this.autoClearColor = !0), - (this.autoClearDepth = !0), - (this.autoClearStencil = !0), - (this.sortObjects = !0), - (this.clippingPlanes = []), - (this.localClippingEnabled = !1), - (this.outputEncoding = Vn), - (this.physicallyCorrectLights = !1), - (this.toneMapping = $t), - (this.toneMappingExposure = 1), - Object.defineProperties(this, { - gammaFactor: { - get: function () { - return ( - console.warn( - "THREE.WebGLRenderer: .gammaFactor has been removed." - ), - 2 - ); - }, - set: function () { - console.warn( - "THREE.WebGLRenderer: .gammaFactor has been removed." - ); - }, - }, - }); - const m = this; - let p = !1, - v = 0, - M = 0, - x = null, - w = -1, - y = null; - const A = new Ue(), - L = new Ue(); - let _ = null, - T = e.width, - I = e.height, - F = 1, - H = null, - B = null; - const D = new Ue(0, 0, T, I), - z = new Ue(0, 0, T, I); - let N = !1; - const k = new ro(); - let G = !1, - U = !1, - X = null; - const Z = new pe(), - Y = new ve(), - J = new P(), - ae = { - background: null, - fog: null, - environment: null, - overrideMaterial: null, - isScene: !0, - }; - function ue() { - return x === null ? F : 1; - } - let q = t; - function Ie(E, O) { - for (let W = 0; W < E.length; W++) { - const V = E[W], - $ = e.getContext(V, O); - if ($ !== null) return $; - } - return null; - } - try { - const E = { - alpha: !0, - depth: n, - stencil: i, - antialias: s, - premultipliedAlpha: a, - preserveDrawingBuffer: o, - powerPreference: l, - failIfMajorPerformanceCaveat: c, - }; - if ( - ("setAttribute" in e && - e.setAttribute("data-engine", `three.js r${to}`), - e.addEventListener("webglcontextlost", R, !1), - e.addEventListener("webglcontextrestored", ne, !1), - e.addEventListener("webglcontextcreationerror", ee, !1), - q === null) - ) { - const O = ["webgl2", "webgl", "experimental-webgl"]; - if ( - (m.isWebGL1Renderer === !0 && O.shift(), - (q = Ie(O, E)), - q === null) - ) - throw Ie(O) - ? new Error( - "Error creating WebGL context with your selected attributes." - ) - : new Error("Error creating WebGL context."); - } - q.getShaderPrecisionFormat === void 0 && - (q.getShaderPrecisionFormat = function () { - return { rangeMin: 1, rangeMax: 1, precision: 1 }; - }); - } catch (E) { - throw (console.error("THREE.WebGLRenderer: " + E.message), E); - } - let me, - xe, - ce, - De, - Se, - Me, - qe, - ot, - ut, - At, - st, - Be, - Rt, - Pt, - C, - b, - j, - Q, - se, - he, - _e, - S, - K; - function re() { - (me = new bm(q)), - (xe = new vm(q, me, r)), - me.init(xe), - (S = new s0(q, me, xe)), - (ce = new n0(q, me, xe)), - (De = new Em()), - (Se = new Wg()), - (Me = new i0(q, me, ce, Se, xe, S, De)), - (qe = new xm(m)), - (ot = new wm(m)), - (ut = new Od(q, xe)), - (K = new mm(q, me, ut, xe)), - (At = new Sm(q, ut, De, K)), - (st = new Rm(q, At, ut, De)), - (se = new Lm(q, xe, Me)), - (b = new _m(Se)), - (Be = new Hg(m, qe, ot, me, xe, K, b)), - (Rt = new c0(m, Se)), - (Pt = new Xg()), - (C = new Jg(me, xe)), - (Q = new pm(m, qe, ce, st, u, a)), - (j = new t0(m, st, xe)), - (he = new gm(q, me, De, xe)), - (_e = new Tm(q, me, De, xe)), - (De.programs = Be.programs), - (m.capabilities = xe), - (m.extensions = me), - (m.properties = Se), - (m.renderLists = Pt), - (m.shadowMap = j), - (m.state = ce), - (m.info = De); - } - re(); - const te = new l0(m, q); - (this.xr = te), - (this.getContext = function () { - return q; - }), - (this.getContextAttributes = function () { - return q.getContextAttributes(); - }), - (this.forceContextLoss = function () { - const E = me.get("WEBGL_lose_context"); - E && E.loseContext(); - }), - (this.forceContextRestore = function () { - const E = me.get("WEBGL_lose_context"); - E && E.restoreContext(); - }), - (this.getPixelRatio = function () { - return F; - }), - (this.setPixelRatio = function (E) { - E !== void 0 && ((F = E), this.setSize(T, I, !1)); - }), - (this.getSize = function (E) { - return E.set(T, I); - }), - (this.setSize = function (E, O, W) { - if (te.isPresenting) { - console.warn( - "THREE.WebGLRenderer: Can't change size while VR device is presenting." - ); - return; - } - (T = E), - (I = O), - (e.width = Math.floor(E * F)), - (e.height = Math.floor(O * F)), - W !== !1 && - ((e.style.width = E + "px"), (e.style.height = O + "px")), - this.setViewport(0, 0, E, O); - }), - (this.getDrawingBufferSize = function (E) { - return E.set(T * F, I * F).floor(); - }), - (this.setDrawingBufferSize = function (E, O, W) { - (T = E), - (I = O), - (F = W), - (e.width = Math.floor(E * W)), - (e.height = Math.floor(O * W)), - this.setViewport(0, 0, E, O); - }), - (this.getCurrentViewport = function (E) { - return E.copy(A); - }), - (this.getViewport = function (E) { - return E.copy(D); - }), - (this.setViewport = function (E, O, W, V) { - E.isVector4 ? D.set(E.x, E.y, E.z, E.w) : D.set(E, O, W, V), - ce.viewport(A.copy(D).multiplyScalar(F).floor()); - }), - (this.getScissor = function (E) { - return E.copy(z); - }), - (this.setScissor = function (E, O, W, V) { - E.isVector4 ? z.set(E.x, E.y, E.z, E.w) : z.set(E, O, W, V), - ce.scissor(L.copy(z).multiplyScalar(F).floor()); - }), - (this.getScissorTest = function () { - return N; - }), - (this.setScissorTest = function (E) { - ce.setScissorTest((N = E)); - }), - (this.setOpaqueSort = function (E) { - H = E; - }), - (this.setTransparentSort = function (E) { - B = E; - }), - (this.getClearColor = function (E) { - return E.copy(Q.getClearColor()); - }), - (this.setClearColor = function () { - Q.setClearColor.apply(Q, arguments); - }), - (this.getClearAlpha = function () { - return Q.getClearAlpha(); - }), - (this.setClearAlpha = function () { - Q.setClearAlpha.apply(Q, arguments); - }), - (this.clear = function (E = !0, O = !0, W = !0) { - let V = 0; - E && (V |= 16384), O && (V |= 256), W && (V |= 1024), q.clear(V); - }), - (this.clearColor = function () { - this.clear(!0, !1, !1); - }), - (this.clearDepth = function () { - this.clear(!1, !0, !1); - }), - (this.clearStencil = function () { - this.clear(!1, !1, !0); - }), - (this.dispose = function () { - e.removeEventListener("webglcontextlost", R, !1), - e.removeEventListener("webglcontextrestored", ne, !1), - e.removeEventListener("webglcontextcreationerror", ee, !1), - Pt.dispose(), - C.dispose(), - Se.dispose(), - qe.dispose(), - ot.dispose(), - st.dispose(), - K.dispose(), - Be.dispose(), - te.dispose(), - te.removeEventListener("sessionstart", Ve), - te.removeEventListener("sessionend", Ge), - X && (X.dispose(), (X = null)), - vt.stop(); - }); - function R(E) { - E.preventDefault(), - console.log("THREE.WebGLRenderer: Context Lost."), - (p = !0); - } - function ne() { - console.log("THREE.WebGLRenderer: Context Restored."), (p = !1); - const E = De.autoReset, - O = j.enabled, - W = j.autoUpdate, - V = j.needsUpdate, - $ = j.type; - re(), - (De.autoReset = E), - (j.enabled = O), - (j.autoUpdate = W), - (j.needsUpdate = V), - (j.type = $); - } - function ee(E) { - console.error( - "THREE.WebGLRenderer: A WebGL context could not be created. Reason: ", - E.statusMessage - ); - } - function ge(E) { - const O = E.target; - O.removeEventListener("dispose", ge), le(O); - } - function le(E) { - fe(E), Se.remove(E); - } - function fe(E) { - const O = Se.get(E).programs; - O !== void 0 && - (O.forEach(function (W) { - Be.releaseProgram(W); - }), - E.isShaderMaterial && Be.releaseShaderCache(E)); - } - (this.renderBufferDirect = function (E, O, W, V, $, ye) { - O === null && (O = ae); - const be = $.isMesh && $.matrixWorld.determinant() < 0, - Ee = ru(E, O, W, V, $); - ce.setMaterial(V, be); - let Te = W.index; - const He = W.attributes.position; - if (Te === null) { - if (He === void 0 || He.count === 0) return; - } else if (Te.count === 0) return; - let Fe = 1; - V.wireframe === !0 && ((Te = At.getWireframeAttribute(W)), (Fe = 2)), - K.setup($, V, Ee, W, Te); - let ze, - Ke = he; - Te !== null && ((ze = ut.get(Te)), (Ke = _e), Ke.setIndex(ze)); - const Yn = Te !== null ? Te.count : He.count, - di = W.drawRange.start * Fe, - fi = W.drawRange.count * Fe, - Qt = ye !== null ? ye.start * Fe : 0, - Oe = ye !== null ? ye.count * Fe : 1 / 0, - pi = Math.max(di, Qt), - et = Math.min(Yn, di + fi, Qt + Oe) - 1, - en = Math.max(0, et - pi + 1); - if (en !== 0) { - if ($.isMesh) - V.wireframe === !0 - ? (ce.setLineWidth(V.wireframeLinewidth * ue()), Ke.setMode(1)) - : Ke.setMode(4); - else if ($.isLine) { - let Ln = V.linewidth; - Ln === void 0 && (Ln = 1), - ce.setLineWidth(Ln * ue()), - $.isLineSegments - ? Ke.setMode(1) - : $.isLineLoop - ? Ke.setMode(2) - : Ke.setMode(3); - } else $.isPoints ? Ke.setMode(0) : $.isSprite && Ke.setMode(4); - if ($.isInstancedMesh) Ke.renderInstances(pi, en, $.count); - else if (W.isInstancedBufferGeometry) { - const Ln = Math.min(W.instanceCount, W._maxInstanceCount); - Ke.renderInstances(pi, en, Ln); - } else Ke.render(pi, en); - } - }), - (this.compile = function (E, O) { - (d = C.get(E)), - d.init(), - g.push(d), - E.traverseVisible(function (W) { - W.isLight && - W.layers.test(O.layers) && - (d.pushLight(W), W.castShadow && d.pushShadow(W)); - }), - d.setupLights(m.physicallyCorrectLights), - E.traverse(function (W) { - const V = W.material; - if (V) - if (Array.isArray(V)) - for (let $ = 0; $ < V.length; $++) { - const ye = V[$]; - Hr(ye, E, W); - } - else Hr(V, E, W); - }), - g.pop(), - (d = null); - }); - let ie = null; - function we(E) { - ie && ie(E); - } - function Ve() { - vt.stop(); - } - function Ge() { - vt.start(); - } - const vt = new Zc(); - vt.setAnimationLoop(we), - typeof self != "undefined" && vt.setContext(self), - (this.setAnimationLoop = function (E) { - (ie = E), - te.setAnimationLoop(E), - E === null ? vt.stop() : vt.start(); - }), - te.addEventListener("sessionstart", Ve), - te.addEventListener("sessionend", Ge), - (this.render = function (E, O) { - if (O !== void 0 && O.isCamera !== !0) { - console.error( - "THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera." - ); - return; - } - if (p === !0) return; - E.autoUpdate === !0 && E.updateMatrixWorld(), - O.parent === null && O.updateMatrixWorld(), - te.enabled === !0 && - te.isPresenting === !0 && - (te.cameraAutoUpdate === !0 && te.updateCamera(O), - (O = te.getCamera())), - E.isScene === !0 && E.onBeforeRender(m, E, O, x), - (d = C.get(E, g.length)), - d.init(), - g.push(d), - Z.multiplyMatrices(O.projectionMatrix, O.matrixWorldInverse), - k.setFromProjectionMatrix(Z), - (U = this.localClippingEnabled), - (G = b.init(this.clippingPlanes, U, O)), - (h = Pt.get(E, f.length)), - h.init(), - f.push(h), - Jt(E, O, 0, m.sortObjects), - h.finish(), - m.sortObjects === !0 && h.sort(H, B), - G === !0 && b.beginShadows(); - const W = d.state.shadowsArray; - if ( - (j.render(W, E, O), - G === !0 && b.endShadows(), - this.info.autoReset === !0 && this.info.reset(), - Q.render(h, E), - d.setupLights(m.physicallyCorrectLights), - O.isArrayCamera) - ) { - const V = O.cameras; - for (let $ = 0, ye = V.length; $ < ye; $++) { - const be = V[$]; - Po(h, E, be, be.viewport); - } - } else Po(h, E, O); - x !== null && - (Me.updateMultisampleRenderTarget(x), - Me.updateRenderTargetMipmap(x)), - E.isScene === !0 && E.onAfterRender(m, E, O), - K.resetDefaultState(), - (w = -1), - (y = null), - g.pop(), - g.length > 0 ? (d = g[g.length - 1]) : (d = null), - f.pop(), - f.length > 0 ? (h = f[f.length - 1]) : (h = null); - }); - function Jt(E, O, W, V) { - if (E.visible === !1) return; - if (E.layers.test(O.layers)) { - if (E.isGroup) W = E.renderOrder; - else if (E.isLOD) E.autoUpdate === !0 && E.update(O); - else if (E.isLight) d.pushLight(E), E.castShadow && d.pushShadow(E); - else if (E.isSprite) { - if (!E.frustumCulled || k.intersectsSprite(E)) { - V && J.setFromMatrixPosition(E.matrixWorld).applyMatrix4(Z); - const be = st.update(E), - Ee = E.material; - Ee.visible && h.push(E, be, Ee, W, J.z, null); - } - } else if ( - (E.isMesh || E.isLine || E.isPoints) && - (E.isSkinnedMesh && - E.skeleton.frame !== De.render.frame && - (E.skeleton.update(), (E.skeleton.frame = De.render.frame)), - !E.frustumCulled || k.intersectsObject(E)) - ) { - V && J.setFromMatrixPosition(E.matrixWorld).applyMatrix4(Z); - const be = st.update(E), - Ee = E.material; - if (Array.isArray(Ee)) { - const Te = be.groups; - for (let He = 0, Fe = Te.length; He < Fe; He++) { - const ze = Te[He], - Ke = Ee[ze.materialIndex]; - Ke && Ke.visible && h.push(E, be, Ke, W, J.z, ze); - } - } else Ee.visible && h.push(E, be, Ee, W, J.z, null); - } - } - const ye = E.children; - for (let be = 0, Ee = ye.length; be < Ee; be++) Jt(ye[be], O, W, V); - } - function Po(E, O, W, V) { - const $ = E.opaque, - ye = E.transmissive, - be = E.transparent; - d.setupLightsView(W), - ye.length > 0 && iu($, O, W), - V && ce.viewport(A.copy(V)), - $.length > 0 && Ws($, O, W), - ye.length > 0 && Ws(ye, O, W), - be.length > 0 && Ws(be, O, W), - ce.buffers.depth.setTest(!0), - ce.buffers.depth.setMask(!0), - ce.buffers.color.setMask(!0), - ce.setPolygonOffset(!1); - } - function iu(E, O, W) { - const V = xe.isWebGL2; - X === null && - (X = new Kt(1, 1, { - generateMipmaps: !0, - type: me.has("EXT_color_buffer_half_float") ? Mn : oi, - minFilter: li, - samples: V && s === !0 ? 4 : 0, - })), - m.getDrawingBufferSize(Y), - V ? X.setSize(Y.x, Y.y) : X.setSize(Ar(Y.x), Ar(Y.y)); - const $ = m.getRenderTarget(); - m.setRenderTarget(X), m.clear(); - const ye = m.toneMapping; - (m.toneMapping = $t), - Ws(E, O, W), - (m.toneMapping = ye), - Me.updateMultisampleRenderTarget(X), - Me.updateRenderTargetMipmap(X), - m.setRenderTarget($); - } - function Ws(E, O, W) { - const V = O.isScene === !0 ? O.overrideMaterial : null; - for (let $ = 0, ye = E.length; $ < ye; $++) { - const be = E[$], - Ee = be.object, - Te = be.geometry, - He = V === null ? be.material : V, - Fe = be.group; - Ee.layers.test(W.layers) && su(Ee, O, W, Te, He, Fe); - } - } - function su(E, O, W, V, $, ye) { - E.onBeforeRender(m, O, W, V, $, ye), - E.modelViewMatrix.multiplyMatrices( - W.matrixWorldInverse, - E.matrixWorld - ), - E.normalMatrix.getNormalMatrix(E.modelViewMatrix), - $.onBeforeRender(m, O, W, V, E, ye), - $.transparent === !0 && $.side === cn - ? (($.side = qt), - ($.needsUpdate = !0), - m.renderBufferDirect(W, O, V, $, E, ye), - ($.side = ki), - ($.needsUpdate = !0), - m.renderBufferDirect(W, O, V, $, E, ye), - ($.side = cn)) - : m.renderBufferDirect(W, O, V, $, E, ye), - E.onAfterRender(m, O, W, V, $, ye); - } - function Hr(E, O, W) { - O.isScene !== !0 && (O = ae); - const V = Se.get(E), - $ = d.state.lights, - ye = d.state.shadowsArray, - be = $.state.version, - Ee = Be.getParameters(E, $.state, ye, O, W), - Te = Be.getProgramCacheKey(Ee); - let He = V.programs; - (V.environment = E.isMeshStandardMaterial ? O.environment : null), - (V.fog = O.fog), - (V.envMap = (E.isMeshStandardMaterial ? ot : qe).get( - E.envMap || V.environment - )), - He === void 0 && - (E.addEventListener("dispose", ge), - (He = new Map()), - (V.programs = He)); - let Fe = He.get(Te); - if (Fe !== void 0) { - if (V.currentProgram === Fe && V.lightsStateVersion === be) - return Do(E, Ee), Fe; - } else - (Ee.uniforms = Be.getUniforms(E)), - E.onBuild(W, Ee, m), - E.onBeforeCompile(Ee, m), - (Fe = Be.acquireProgram(Ee, Te)), - He.set(Te, Fe), - (V.uniforms = Ee.uniforms); - const ze = V.uniforms; - ((!E.isShaderMaterial && !E.isRawShaderMaterial) || - E.clipping === !0) && - (ze.clippingPlanes = b.uniform), - Do(E, Ee), - (V.needsLights = ou(E)), - (V.lightsStateVersion = be), - V.needsLights && - ((ze.ambientLightColor.value = $.state.ambient), - (ze.lightProbe.value = $.state.probe), - (ze.directionalLights.value = $.state.directional), - (ze.directionalLightShadows.value = $.state.directionalShadow), - (ze.spotLights.value = $.state.spot), - (ze.spotLightShadows.value = $.state.spotShadow), - (ze.rectAreaLights.value = $.state.rectArea), - (ze.ltc_1.value = $.state.rectAreaLTC1), - (ze.ltc_2.value = $.state.rectAreaLTC2), - (ze.pointLights.value = $.state.point), - (ze.pointLightShadows.value = $.state.pointShadow), - (ze.hemisphereLights.value = $.state.hemi), - (ze.directionalShadowMap.value = $.state.directionalShadowMap), - (ze.directionalShadowMatrix.value = - $.state.directionalShadowMatrix), - (ze.spotShadowMap.value = $.state.spotShadowMap), - (ze.spotShadowMatrix.value = $.state.spotShadowMatrix), - (ze.pointShadowMap.value = $.state.pointShadowMap), - (ze.pointShadowMatrix.value = $.state.pointShadowMatrix)); - const Ke = Fe.getUniforms(), - Yn = _r.seqWithValue(Ke.seq, ze); - return (V.currentProgram = Fe), (V.uniformsList = Yn), Fe; - } - function Do(E, O) { - const W = Se.get(E); - (W.outputEncoding = O.outputEncoding), - (W.instancing = O.instancing), - (W.skinning = O.skinning), - (W.morphTargets = O.morphTargets), - (W.morphNormals = O.morphNormals), - (W.morphColors = O.morphColors), - (W.morphTargetsCount = O.morphTargetsCount), - (W.numClippingPlanes = O.numClippingPlanes), - (W.numIntersection = O.numClipIntersection), - (W.vertexAlphas = O.vertexAlphas), - (W.vertexTangents = O.vertexTangents), - (W.toneMapping = O.toneMapping); - } - function ru(E, O, W, V, $) { - O.isScene !== !0 && (O = ae), Me.resetTextureUnits(); - const ye = O.fog, - be = V.isMeshStandardMaterial ? O.environment : null, - Ee = - x === null - ? m.outputEncoding - : x.isXRRenderTarget === !0 - ? x.texture.encoding - : Vn, - Te = (V.isMeshStandardMaterial ? ot : qe).get(V.envMap || be), - He = - V.vertexColors === !0 && - !!W.attributes.color && - W.attributes.color.itemSize === 4, - Fe = !!V.normalMap && !!W.attributes.tangent, - ze = !!W.morphAttributes.position, - Ke = !!W.morphAttributes.normal, - Yn = !!W.morphAttributes.color, - di = V.toneMapped ? m.toneMapping : $t, - fi = - W.morphAttributes.position || - W.morphAttributes.normal || - W.morphAttributes.color, - Qt = fi !== void 0 ? fi.length : 0, - Oe = Se.get(V), - pi = d.state.lights; - if (G === !0 && (U === !0 || E !== y)) { - const tn = E === y && V.id === w; - b.setState(V, E, tn); - } - let et = !1; - V.version === Oe.__version - ? ((Oe.needsLights && Oe.lightsStateVersion !== pi.state.version) || - Oe.outputEncoding !== Ee || - ($.isInstancedMesh && Oe.instancing === !1) || - (!$.isInstancedMesh && Oe.instancing === !0) || - ($.isSkinnedMesh && Oe.skinning === !1) || - (!$.isSkinnedMesh && Oe.skinning === !0) || - Oe.envMap !== Te || - (V.fog === !0 && Oe.fog !== ye) || - (Oe.numClippingPlanes !== void 0 && - (Oe.numClippingPlanes !== b.numPlanes || - Oe.numIntersection !== b.numIntersection)) || - Oe.vertexAlphas !== He || - Oe.vertexTangents !== Fe || - Oe.morphTargets !== ze || - Oe.morphNormals !== Ke || - Oe.morphColors !== Yn || - Oe.toneMapping !== di || - (xe.isWebGL2 === !0 && Oe.morphTargetsCount !== Qt)) && - (et = !0) - : ((et = !0), (Oe.__version = V.version)); - let en = Oe.currentProgram; - et === !0 && (en = Hr(V, O, $)); - let Ln = !1, - hs = !1, - Wr = !1; - const _t = en.getUniforms(), - us = Oe.uniforms; - if ( - (ce.useProgram(en.program) && ((Ln = !0), (hs = !0), (Wr = !0)), - V.id !== w && ((w = V.id), (hs = !0)), - Ln || y !== E) - ) { - if ( - (_t.setValue(q, "projectionMatrix", E.projectionMatrix), - xe.logarithmicDepthBuffer && - _t.setValue( - q, - "logDepthBufFC", - 2 / (Math.log(E.far + 1) / Math.LN2) - ), - y !== E && ((y = E), (hs = !0), (Wr = !0)), - V.isShaderMaterial || - V.isMeshPhongMaterial || - V.isMeshToonMaterial || - V.isMeshStandardMaterial || - V.envMap) - ) { - const tn = _t.map.cameraPosition; - tn !== void 0 && - tn.setValue(q, J.setFromMatrixPosition(E.matrixWorld)); - } - (V.isMeshPhongMaterial || - V.isMeshToonMaterial || - V.isMeshLambertMaterial || - V.isMeshBasicMaterial || - V.isMeshStandardMaterial || - V.isShaderMaterial) && - _t.setValue(q, "isOrthographic", E.isOrthographicCamera === !0), - (V.isMeshPhongMaterial || - V.isMeshToonMaterial || - V.isMeshLambertMaterial || - V.isMeshBasicMaterial || - V.isMeshStandardMaterial || - V.isShaderMaterial || - V.isShadowMaterial || - $.isSkinnedMesh) && - _t.setValue(q, "viewMatrix", E.matrixWorldInverse); - } - if ($.isSkinnedMesh) { - _t.setOptional(q, $, "bindMatrix"), - _t.setOptional(q, $, "bindMatrixInverse"); - const tn = $.skeleton; - tn && - (xe.floatVertexTextures - ? (tn.boneTexture === null && tn.computeBoneTexture(), - _t.setValue(q, "boneTexture", tn.boneTexture, Me), - _t.setValue(q, "boneTextureSize", tn.boneTextureSize)) - : console.warn( - "THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required." - )); - } - const jr = W.morphAttributes; - return ( - (jr.position !== void 0 || - jr.normal !== void 0 || - (jr.color !== void 0 && xe.isWebGL2 === !0)) && - se.update($, W, V, en), - (hs || Oe.receiveShadow !== $.receiveShadow) && - ((Oe.receiveShadow = $.receiveShadow), - _t.setValue(q, "receiveShadow", $.receiveShadow)), - hs && - (_t.setValue(q, "toneMappingExposure", m.toneMappingExposure), - Oe.needsLights && au(us, Wr), - ye && V.fog === !0 && Rt.refreshFogUniforms(us, ye), - Rt.refreshMaterialUniforms(us, V, F, I, X), - _r.upload(q, Oe.uniformsList, us, Me)), - V.isShaderMaterial && - V.uniformsNeedUpdate === !0 && - (_r.upload(q, Oe.uniformsList, us, Me), - (V.uniformsNeedUpdate = !1)), - V.isSpriteMaterial && _t.setValue(q, "center", $.center), - _t.setValue(q, "modelViewMatrix", $.modelViewMatrix), - _t.setValue(q, "normalMatrix", $.normalMatrix), - _t.setValue(q, "modelMatrix", $.matrixWorld), - en - ); - } - function au(E, O) { - (E.ambientLightColor.needsUpdate = O), - (E.lightProbe.needsUpdate = O), - (E.directionalLights.needsUpdate = O), - (E.directionalLightShadows.needsUpdate = O), - (E.pointLights.needsUpdate = O), - (E.pointLightShadows.needsUpdate = O), - (E.spotLights.needsUpdate = O), - (E.spotLightShadows.needsUpdate = O), - (E.rectAreaLights.needsUpdate = O), - (E.hemisphereLights.needsUpdate = O); - } - function ou(E) { - return ( - E.isMeshLambertMaterial || - E.isMeshToonMaterial || - E.isMeshPhongMaterial || - E.isMeshStandardMaterial || - E.isShadowMaterial || - (E.isShaderMaterial && E.lights === !0) - ); - } - (this.getActiveCubeFace = function () { - return v; - }), - (this.getActiveMipmapLevel = function () { - return M; - }), - (this.getRenderTarget = function () { - return x; - }), - (this.setRenderTargetTextures = function (E, O, W) { - (Se.get(E.texture).__webglTexture = O), - (Se.get(E.depthTexture).__webglTexture = W); - const V = Se.get(E); - (V.__hasExternalTextures = !0), - V.__hasExternalTextures && - ((V.__autoAllocateDepthBuffer = W === void 0), - V.__autoAllocateDepthBuffer || - (me.has("WEBGL_multisampled_render_to_texture") === !0 && - (console.warn( - "THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided" - ), - (V.__useRenderToTexture = !1)))); - }), - (this.setRenderTargetFramebuffer = function (E, O) { - const W = Se.get(E); - (W.__webglFramebuffer = O), - (W.__useDefaultFramebuffer = O === void 0); - }), - (this.setRenderTarget = function (E, O = 0, W = 0) { - (x = E), (v = O), (M = W); - let V = !0; - if (E) { - const Te = Se.get(E); - Te.__useDefaultFramebuffer !== void 0 - ? (ce.bindFramebuffer(36160, null), (V = !1)) - : Te.__webglFramebuffer === void 0 - ? Me.setupRenderTarget(E) - : Te.__hasExternalTextures && - Me.rebindTextures( - E, - Se.get(E.texture).__webglTexture, - Se.get(E.depthTexture).__webglTexture - ); - } - let $ = null, - ye = !1, - be = !1; - if (E) { - const Te = E.texture; - (Te.isData3DTexture || Te.isDataArrayTexture) && (be = !0); - const He = Se.get(E).__webglFramebuffer; - E.isWebGLCubeRenderTarget - ? (($ = He[O]), (ye = !0)) - : xe.isWebGL2 && - E.samples > 0 && - Me.useMultisampledRTT(E) === !1 - ? ($ = Se.get(E).__webglMultisampledFramebuffer) - : ($ = He), - A.copy(E.viewport), - L.copy(E.scissor), - (_ = E.scissorTest); - } else - A.copy(D).multiplyScalar(F).floor(), - L.copy(z).multiplyScalar(F).floor(), - (_ = N); - if ( - (ce.bindFramebuffer(36160, $) && - xe.drawBuffers && - V && - ce.drawBuffers(E, $), - ce.viewport(A), - ce.scissor(L), - ce.setScissorTest(_), - ye) - ) { - const Te = Se.get(E.texture); - q.framebufferTexture2D( - 36160, - 36064, - 34069 + O, - Te.__webglTexture, - W - ); - } else if (be) { - const Te = Se.get(E.texture), - He = O || 0; - q.framebufferTextureLayer( - 36160, - 36064, - Te.__webglTexture, - W || 0, - He - ); - } - w = -1; - }), - (this.readRenderTargetPixels = function (E, O, W, V, $, ye, be) { - if (!(E && E.isWebGLRenderTarget)) { - console.error( - "THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget." - ); - return; - } - let Ee = Se.get(E).__webglFramebuffer; - if ( - (E.isWebGLCubeRenderTarget && be !== void 0 && (Ee = Ee[be]), Ee) - ) { - ce.bindFramebuffer(36160, Ee); - try { - const Te = E.texture, - He = Te.format, - Fe = Te.type; - if (He !== Nt && S.convert(He) !== q.getParameter(35739)) { - console.error( - "THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format." - ); - return; - } - const ze = - Fe === Mn && - (me.has("EXT_color_buffer_half_float") || - (xe.isWebGL2 && me.has("EXT_color_buffer_float"))); - if ( - Fe !== oi && - S.convert(Fe) !== q.getParameter(35738) && - !( - Fe === Ft && - (xe.isWebGL2 || - me.has("OES_texture_float") || - me.has("WEBGL_color_buffer_float")) - ) && - !ze - ) { - console.error( - "THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type." - ); - return; - } - O >= 0 && - O <= E.width - V && - W >= 0 && - W <= E.height - $ && - q.readPixels(O, W, V, $, S.convert(He), S.convert(Fe), ye); - } finally { - const Te = x !== null ? Se.get(x).__webglFramebuffer : null; - ce.bindFramebuffer(36160, Te); - } - } - }), - (this.copyFramebufferToTexture = function (E, O, W = 0) { - const V = Math.pow(2, -W), - $ = Math.floor(O.image.width * V), - ye = Math.floor(O.image.height * V); - Me.setTexture2D(O, 0), - q.copyTexSubImage2D(3553, W, 0, 0, E.x, E.y, $, ye), - ce.unbindTexture(); - }), - (this.copyTextureToTexture = function (E, O, W, V = 0) { - const $ = O.image.width, - ye = O.image.height, - be = S.convert(W.format), - Ee = S.convert(W.type); - Me.setTexture2D(W, 0), - q.pixelStorei(37440, W.flipY), - q.pixelStorei(37441, W.premultiplyAlpha), - q.pixelStorei(3317, W.unpackAlignment), - O.isDataTexture - ? q.texSubImage2D( - 3553, - V, - E.x, - E.y, - $, - ye, - be, - Ee, - O.image.data - ) - : O.isCompressedTexture - ? q.compressedTexSubImage2D( - 3553, - V, - E.x, - E.y, - O.mipmaps[0].width, - O.mipmaps[0].height, - be, - O.mipmaps[0].data - ) - : q.texSubImage2D(3553, V, E.x, E.y, be, Ee, O.image), - V === 0 && W.generateMipmaps && q.generateMipmap(3553), - ce.unbindTexture(); - }), - (this.copyTextureToTexture3D = function (E, O, W, V, $ = 0) { - if (m.isWebGL1Renderer) { - console.warn( - "THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2." - ); - return; - } - const ye = E.max.x - E.min.x + 1, - be = E.max.y - E.min.y + 1, - Ee = E.max.z - E.min.z + 1, - Te = S.convert(V.format), - He = S.convert(V.type); - let Fe; - if (V.isData3DTexture) Me.setTexture3D(V, 0), (Fe = 32879); - else if (V.isDataArrayTexture) - Me.setTexture2DArray(V, 0), (Fe = 35866); - else { - console.warn( - "THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray." - ); - return; - } - q.pixelStorei(37440, V.flipY), - q.pixelStorei(37441, V.premultiplyAlpha), - q.pixelStorei(3317, V.unpackAlignment); - const ze = q.getParameter(3314), - Ke = q.getParameter(32878), - Yn = q.getParameter(3316), - di = q.getParameter(3315), - fi = q.getParameter(32877), - Qt = W.isCompressedTexture ? W.mipmaps[0] : W.image; - q.pixelStorei(3314, Qt.width), - q.pixelStorei(32878, Qt.height), - q.pixelStorei(3316, E.min.x), - q.pixelStorei(3315, E.min.y), - q.pixelStorei(32877, E.min.z), - W.isDataTexture || W.isData3DTexture - ? q.texSubImage3D( - Fe, - $, - O.x, - O.y, - O.z, - ye, - be, - Ee, - Te, - He, - Qt.data - ) - : W.isCompressedTexture - ? (console.warn( - "THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture." - ), - q.compressedTexSubImage3D( - Fe, - $, - O.x, - O.y, - O.z, - ye, - be, - Ee, - Te, - Qt.data - )) - : q.texSubImage3D(Fe, $, O.x, O.y, O.z, ye, be, Ee, Te, He, Qt), - q.pixelStorei(3314, ze), - q.pixelStorei(32878, Ke), - q.pixelStorei(3316, Yn), - q.pixelStorei(3315, di), - q.pixelStorei(32877, fi), - $ === 0 && V.generateMipmaps && q.generateMipmap(Fe), - ce.unbindTexture(); - }), - (this.initTexture = function (E) { - Me.setTexture2D(E, 0), ce.unbindTexture(); - }), - (this.resetState = function () { - (v = 0), (M = 0), (x = null), ce.reset(), K.reset(); - }), - typeof __THREE_DEVTOOLS__ != "undefined" && - __THREE_DEVTOOLS__.dispatchEvent( - new CustomEvent("observe", { detail: this }) - ); - } - class u0 extends rh {} - u0.prototype.isWebGL1Renderer = !0; - class ws extends Ye { - constructor() { - super(), - (this.isScene = !0), - (this.type = "Scene"), - (this.background = null), - (this.environment = null), - (this.fog = null), - (this.overrideMaterial = null), - (this.autoUpdate = !0), - typeof __THREE_DEVTOOLS__ != "undefined" && - __THREE_DEVTOOLS__.dispatchEvent( - new CustomEvent("observe", { detail: this }) - ); - } - copy(e, t) { - return ( - super.copy(e, t), - e.background !== null && (this.background = e.background.clone()), - e.environment !== null && - (this.environment = e.environment.clone()), - e.fog !== null && (this.fog = e.fog.clone()), - e.overrideMaterial !== null && - (this.overrideMaterial = e.overrideMaterial.clone()), - (this.autoUpdate = e.autoUpdate), - (this.matrixAutoUpdate = e.matrixAutoUpdate), - this - ); - } - toJSON(e) { - const t = super.toJSON(e); - return this.fog !== null && (t.object.fog = this.fog.toJSON()), t; - } - } - class d0 { - constructor(e, t) { - (this.isInterleavedBuffer = !0), - (this.array = e), - (this.stride = t), - (this.count = e !== void 0 ? e.length / t : 0), - (this.usage = ka), - (this.updateRange = { offset: 0, count: -1 }), - (this.version = 0), - (this.uuid = Yt()); - } - onUploadCallback() {} - set needsUpdate(e) { - e === !0 && this.version++; - } - setUsage(e) { - return (this.usage = e), this; - } - copy(e) { - return ( - (this.array = new e.array.constructor(e.array)), - (this.count = e.count), - (this.stride = e.stride), - (this.usage = e.usage), - this - ); - } - copyAt(e, t, n) { - (e *= this.stride), (n *= t.stride); - for (let i = 0, s = this.stride; i < s; i++) - this.array[e + i] = t.array[n + i]; - return this; - } - set(e, t = 0) { - return this.array.set(e, t), this; - } - clone(e) { - e.arrayBuffers === void 0 && (e.arrayBuffers = {}), - this.array.buffer._uuid === void 0 && - (this.array.buffer._uuid = Yt()), - e.arrayBuffers[this.array.buffer._uuid] === void 0 && - (e.arrayBuffers[this.array.buffer._uuid] = - this.array.slice(0).buffer); - const t = new this.array.constructor( - e.arrayBuffers[this.array.buffer._uuid] - ), - n = new this.constructor(t, this.stride); - return n.setUsage(this.usage), n; - } - onUpload(e) { - return (this.onUploadCallback = e), this; - } - toJSON(e) { - return ( - e.arrayBuffers === void 0 && (e.arrayBuffers = {}), - this.array.buffer._uuid === void 0 && - (this.array.buffer._uuid = Yt()), - e.arrayBuffers[this.array.buffer._uuid] === void 0 && - (e.arrayBuffers[this.array.buffer._uuid] = - Array.prototype.slice.call(new Uint32Array(this.array.buffer))), - { - uuid: this.uuid, - buffer: this.array.buffer._uuid, - type: this.array.constructor.name, - stride: this.stride, - } - ); - } - } - const xt = new P(); - class oo { - constructor(e, t, n, i = !1) { - (this.isInterleavedBufferAttribute = !0), - (this.name = ""), - (this.data = e), - (this.itemSize = t), - (this.offset = n), - (this.normalized = i === !0); - } - get count() { - return this.data.count; - } - get array() { - return this.data.array; - } - set needsUpdate(e) { - this.data.needsUpdate = e; - } - applyMatrix4(e) { - for (let t = 0, n = this.data.count; t < n; t++) - xt.fromBufferAttribute(this, t), - xt.applyMatrix4(e), - this.setXYZ(t, xt.x, xt.y, xt.z); - return this; - } - applyNormalMatrix(e) { - for (let t = 0, n = this.count; t < n; t++) - xt.fromBufferAttribute(this, t), - xt.applyNormalMatrix(e), - this.setXYZ(t, xt.x, xt.y, xt.z); - return this; - } - transformDirection(e) { - for (let t = 0, n = this.count; t < n; t++) - xt.fromBufferAttribute(this, t), - xt.transformDirection(e), - this.setXYZ(t, xt.x, xt.y, xt.z); - return this; - } - setX(e, t) { - return ( - (this.data.array[e * this.data.stride + this.offset] = t), this - ); - } - setY(e, t) { - return ( - (this.data.array[e * this.data.stride + this.offset + 1] = t), this - ); - } - setZ(e, t) { - return ( - (this.data.array[e * this.data.stride + this.offset + 2] = t), this - ); - } - setW(e, t) { - return ( - (this.data.array[e * this.data.stride + this.offset + 3] = t), this - ); - } - getX(e) { - return this.data.array[e * this.data.stride + this.offset]; - } - getY(e) { - return this.data.array[e * this.data.stride + this.offset + 1]; - } - getZ(e) { - return this.data.array[e * this.data.stride + this.offset + 2]; - } - getW(e) { - return this.data.array[e * this.data.stride + this.offset + 3]; - } - setXY(e, t, n) { - return ( - (e = e * this.data.stride + this.offset), - (this.data.array[e + 0] = t), - (this.data.array[e + 1] = n), - this - ); - } - setXYZ(e, t, n, i) { - return ( - (e = e * this.data.stride + this.offset), - (this.data.array[e + 0] = t), - (this.data.array[e + 1] = n), - (this.data.array[e + 2] = i), - this - ); - } - setXYZW(e, t, n, i, s) { - return ( - (e = e * this.data.stride + this.offset), - (this.data.array[e + 0] = t), - (this.data.array[e + 1] = n), - (this.data.array[e + 2] = i), - (this.data.array[e + 3] = s), - this - ); - } - clone(e) { - if (e === void 0) { - console.log( - "THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data." - ); - const t = []; - for (let n = 0; n < this.count; n++) { - const i = n * this.data.stride + this.offset; - for (let s = 0; s < this.itemSize; s++) - t.push(this.data.array[i + s]); - } - return new wt( - new this.array.constructor(t), - this.itemSize, - this.normalized - ); - } else - return ( - e.interleavedBuffers === void 0 && (e.interleavedBuffers = {}), - e.interleavedBuffers[this.data.uuid] === void 0 && - (e.interleavedBuffers[this.data.uuid] = this.data.clone(e)), - new oo( - e.interleavedBuffers[this.data.uuid], - this.itemSize, - this.offset, - this.normalized - ) - ); - } - toJSON(e) { - if (e === void 0) { - console.log( - "THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data." - ); - const t = []; - for (let n = 0; n < this.count; n++) { - const i = n * this.data.stride + this.offset; - for (let s = 0; s < this.itemSize; s++) - t.push(this.data.array[i + s]); - } - return { - itemSize: this.itemSize, - type: this.array.constructor.name, - array: t, - normalized: this.normalized, - }; - } else - return ( - e.interleavedBuffers === void 0 && (e.interleavedBuffers = {}), - e.interleavedBuffers[this.data.uuid] === void 0 && - (e.interleavedBuffers[this.data.uuid] = this.data.toJSON(e)), - { - isInterleavedBufferAttribute: !0, - itemSize: this.itemSize, - data: this.data.uuid, - offset: this.offset, - normalized: this.normalized, - } - ); - } - } - class f0 extends it { - constructor(e) { - super(), - (this.isSpriteMaterial = !0), - (this.type = "SpriteMaterial"), - (this.color = new de(16777215)), - (this.map = null), - (this.alphaMap = null), - (this.rotation = 0), - (this.sizeAttenuation = !0), - (this.transparent = !0), - (this.fog = !0), - this.setValues(e); - } - copy(e) { - return ( - super.copy(e), - this.color.copy(e.color), - (this.map = e.map), - (this.alphaMap = e.alphaMap), - (this.rotation = e.rotation), - (this.sizeAttenuation = e.sizeAttenuation), - (this.fog = e.fog), - this - ); - } - } - const Gl = new P(), - Hl = new Ue(), - Wl = new Ue(), - p0 = new P(), - jl = new pe(); - class ah extends Qe { - constructor(e, t) { - super(e, t), - (this.isSkinnedMesh = !0), - (this.type = "SkinnedMesh"), - (this.bindMode = "attached"), - (this.bindMatrix = new pe()), - (this.bindMatrixInverse = new pe()); - } - copy(e, t) { - return ( - super.copy(e, t), - (this.bindMode = e.bindMode), - this.bindMatrix.copy(e.bindMatrix), - this.bindMatrixInverse.copy(e.bindMatrixInverse), - (this.skeleton = e.skeleton), - this - ); - } - bind(e, t) { - (this.skeleton = e), - t === void 0 && - (this.updateMatrixWorld(!0), - this.skeleton.calculateInverses(), - (t = this.matrixWorld)), - this.bindMatrix.copy(t), - this.bindMatrixInverse.copy(t).invert(); - } - pose() { - this.skeleton.pose(); - } - normalizeSkinWeights() { - const e = new Ue(), - t = this.geometry.attributes.skinWeight; - for (let n = 0, i = t.count; n < i; n++) { - e.fromBufferAttribute(t, n); - const s = 1 / e.manhattanLength(); - s !== 1 / 0 ? e.multiplyScalar(s) : e.set(1, 0, 0, 0), - t.setXYZW(n, e.x, e.y, e.z, e.w); - } - } - updateMatrixWorld(e) { - super.updateMatrixWorld(e), - this.bindMode === "attached" - ? this.bindMatrixInverse.copy(this.matrixWorld).invert() - : this.bindMode === "detached" - ? this.bindMatrixInverse.copy(this.bindMatrix).invert() - : console.warn( - "THREE.SkinnedMesh: Unrecognized bindMode: " + this.bindMode - ); - } - boneTransform(e, t) { - const n = this.skeleton, - i = this.geometry; - Hl.fromBufferAttribute(i.attributes.skinIndex, e), - Wl.fromBufferAttribute(i.attributes.skinWeight, e), - Gl.copy(t).applyMatrix4(this.bindMatrix), - t.set(0, 0, 0); - for (let s = 0; s < 4; s++) { - const a = Wl.getComponent(s); - if (a !== 0) { - const o = Hl.getComponent(s); - jl.multiplyMatrices(n.bones[o].matrixWorld, n.boneInverses[o]), - t.addScaledVector(p0.copy(Gl).applyMatrix4(jl), a); - } - } - return t.applyMatrix4(this.bindMatrixInverse); - } - } - class Cr extends Ye { - constructor() { - super(), (this.isBone = !0), (this.type = "Bone"); - } - } - class oh extends nt { - constructor( - e = null, - t = 1, - n = 1, - i, - s, - a, - o, - l, - c = ft, - u = ft, - h, - d - ) { - super(null, a, o, l, c, u, i, s, h, d), - (this.isDataTexture = !0), - (this.image = { data: e, width: t, height: n }), - (this.generateMipmaps = !1), - (this.flipY = !1), - (this.unpackAlignment = 1); - } - } - const Xl = new pe(), - m0 = new pe(); - class Ur { - constructor(e = [], t = []) { - (this.uuid = Yt()), - (this.bones = e.slice(0)), - (this.boneInverses = t), - (this.boneMatrices = null), - (this.boneTexture = null), - (this.boneTextureSize = 0), - (this.frame = -1), - this.init(); - } - init() { - const e = this.bones, - t = this.boneInverses; - if ( - ((this.boneMatrices = new Float32Array(e.length * 16)), - t.length === 0) - ) - this.calculateInverses(); - else if (e.length !== t.length) { - console.warn( - "THREE.Skeleton: Number of inverse bone matrices does not match amount of bones." - ), - (this.boneInverses = []); - for (let n = 0, i = this.bones.length; n < i; n++) - this.boneInverses.push(new pe()); - } - } - calculateInverses() { - this.boneInverses.length = 0; - for (let e = 0, t = this.bones.length; e < t; e++) { - const n = new pe(); - this.bones[e] && n.copy(this.bones[e].matrixWorld).invert(), - this.boneInverses.push(n); - } - } - pose() { - for (let e = 0, t = this.bones.length; e < t; e++) { - const n = this.bones[e]; - n && n.matrixWorld.copy(this.boneInverses[e]).invert(); - } - for (let e = 0, t = this.bones.length; e < t; e++) { - const n = this.bones[e]; - n && - (n.parent && n.parent.isBone - ? (n.matrix.copy(n.parent.matrixWorld).invert(), - n.matrix.multiply(n.matrixWorld)) - : n.matrix.copy(n.matrixWorld), - n.matrix.decompose(n.position, n.quaternion, n.scale)); - } - } - update() { - const e = this.bones, - t = this.boneInverses, - n = this.boneMatrices, - i = this.boneTexture; - for (let s = 0, a = e.length; s < a; s++) { - const o = e[s] ? e[s].matrixWorld : m0; - Xl.multiplyMatrices(o, t[s]), Xl.toArray(n, s * 16); - } - i !== null && (i.needsUpdate = !0); - } - clone() { - return new Ur(this.bones, this.boneInverses); - } - computeBoneTexture() { - let e = Math.sqrt(this.bones.length * 4); - (e = Vc(e)), (e = Math.max(e, 4)); - const t = new Float32Array(e * e * 4); - t.set(this.boneMatrices); - const n = new oh(t, e, e, Nt, Ft); - return ( - (n.needsUpdate = !0), - (this.boneMatrices = t), - (this.boneTexture = n), - (this.boneTextureSize = e), - this - ); - } - getBoneByName(e) { - for (let t = 0, n = this.bones.length; t < n; t++) { - const i = this.bones[t]; - if (i.name === e) return i; - } - } - dispose() { - this.boneTexture !== null && - (this.boneTexture.dispose(), (this.boneTexture = null)); - } - fromJSON(e, t) { - this.uuid = e.uuid; - for (let n = 0, i = e.bones.length; n < i; n++) { - const s = e.bones[n]; - let a = t[s]; - a === void 0 && - (console.warn("THREE.Skeleton: No bone found with UUID:", s), - (a = new Cr())), - this.bones.push(a), - this.boneInverses.push(new pe().fromArray(e.boneInverses[n])); - } - return this.init(), this; - } - toJSON() { - const e = { - metadata: { - version: 4.5, - type: "Skeleton", - generator: "Skeleton.toJSON", - }, - bones: [], - boneInverses: [], - }; - e.uuid = this.uuid; - const t = this.bones, - n = this.boneInverses; - for (let i = 0, s = t.length; i < s; i++) { - const a = t[i]; - e.bones.push(a.uuid); - const o = n[i]; - e.boneInverses.push(o.toArray()); - } - return e; - } - } - class Os extends it { - constructor(e) { - super(), - (this.isLineBasicMaterial = !0), - (this.type = "LineBasicMaterial"), - (this.color = new de(16777215)), - (this.linewidth = 1), - (this.linecap = "round"), - (this.linejoin = "round"), - (this.fog = !0), - this.setValues(e); - } - copy(e) { - return ( - super.copy(e), - this.color.copy(e.color), - (this.linewidth = e.linewidth), - (this.linecap = e.linecap), - (this.linejoin = e.linejoin), - (this.fog = e.fog), - this - ); - } - } - const ql = new P(), - $l = new P(), - Yl = new pe(), - Ta = new io(), - ur = new Zi(); - class Br extends Ye { - constructor(e = new ct(), t = new Os()) { - super(), - (this.isLine = !0), - (this.type = "Line"), - (this.geometry = e), - (this.material = t), - this.updateMorphTargets(); - } - copy(e, t) { - return ( - super.copy(e, t), - (this.material = e.material), - (this.geometry = e.geometry), - this - ); - } - computeLineDistances() { - const e = this.geometry; - if (e.index === null) { - const t = e.attributes.position, - n = [0]; - for (let i = 1, s = t.count; i < s; i++) - ql.fromBufferAttribute(t, i - 1), - $l.fromBufferAttribute(t, i), - (n[i] = n[i - 1]), - (n[i] += ql.distanceTo($l)); - e.setAttribute("lineDistance", new Xe(n, 1)); - } else - console.warn( - "THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry." - ); - return this; - } - raycast(e, t) { - const n = this.geometry, - i = this.matrixWorld, - s = e.params.Line.threshold, - a = n.drawRange; - if ( - (n.boundingSphere === null && n.computeBoundingSphere(), - ur.copy(n.boundingSphere), - ur.applyMatrix4(i), - (ur.radius += s), - e.ray.intersectsSphere(ur) === !1) - ) - return; - Yl.copy(i).invert(), Ta.copy(e.ray).applyMatrix4(Yl); - const o = s / ((this.scale.x + this.scale.y + this.scale.z) / 3), - l = o * o, - c = new P(), - u = new P(), - h = new P(), - d = new P(), - f = this.isLineSegments ? 2 : 1, - g = n.index, - p = n.attributes.position; - if (g !== null) { - const v = Math.max(0, a.start), - M = Math.min(g.count, a.start + a.count); - for (let x = v, w = M - 1; x < w; x += f) { - const y = g.getX(x), - A = g.getX(x + 1); - if ( - (c.fromBufferAttribute(p, y), - u.fromBufferAttribute(p, A), - Ta.distanceSqToSegment(c, u, d, h) > l) - ) - continue; - d.applyMatrix4(this.matrixWorld); - const _ = e.ray.origin.distanceTo(d); - _ < e.near || - _ > e.far || - t.push({ - distance: _, - point: h.clone().applyMatrix4(this.matrixWorld), - index: x, - face: null, - faceIndex: null, - object: this, - }); - } - } else { - const v = Math.max(0, a.start), - M = Math.min(p.count, a.start + a.count); - for (let x = v, w = M - 1; x < w; x += f) { - if ( - (c.fromBufferAttribute(p, x), - u.fromBufferAttribute(p, x + 1), - Ta.distanceSqToSegment(c, u, d, h) > l) - ) - continue; - d.applyMatrix4(this.matrixWorld); - const A = e.ray.origin.distanceTo(d); - A < e.near || - A > e.far || - t.push({ - distance: A, - point: h.clone().applyMatrix4(this.matrixWorld), - index: x, - face: null, - faceIndex: null, - object: this, - }); - } - } - } - updateMorphTargets() { - const t = this.geometry.morphAttributes, - n = Object.keys(t); - if (n.length > 0) { - const i = t[n[0]]; - if (i !== void 0) { - (this.morphTargetInfluences = []), - (this.morphTargetDictionary = {}); - for (let s = 0, a = i.length; s < a; s++) { - const o = i[s].name || String(s); - this.morphTargetInfluences.push(0), - (this.morphTargetDictionary[o] = s); - } - } - } - } - } - const Kl = new P(), - Zl = new P(); - class g0 extends Br { - constructor(e, t) { - super(e, t), (this.isLineSegments = !0), (this.type = "LineSegments"); - } - computeLineDistances() { - const e = this.geometry; - if (e.index === null) { - const t = e.attributes.position, - n = []; - for (let i = 0, s = t.count; i < s; i += 2) - Kl.fromBufferAttribute(t, i), - Zl.fromBufferAttribute(t, i + 1), - (n[i] = i === 0 ? 0 : n[i - 1]), - (n[i + 1] = n[i] + Kl.distanceTo(Zl)); - e.setAttribute("lineDistance", new Xe(n, 1)); - } else - console.warn( - "THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry." - ); - return this; - } - } - class v0 extends Br { - constructor(e, t) { - super(e, t), (this.isLineLoop = !0), (this.type = "LineLoop"); - } - } - class lo extends it { - constructor(e) { - super(), - (this.isPointsMaterial = !0), - (this.type = "PointsMaterial"), - (this.color = new de(16777215)), - (this.map = null), - (this.alphaMap = null), - (this.size = 1), - (this.sizeAttenuation = !0), - (this.fog = !0), - this.setValues(e); - } - copy(e) { - return ( - super.copy(e), - this.color.copy(e.color), - (this.map = e.map), - (this.alphaMap = e.alphaMap), - (this.size = e.size), - (this.sizeAttenuation = e.sizeAttenuation), - (this.fog = e.fog), - this - ); - } - } - const Jl = new pe(), - Ga = new io(), - dr = new Zi(), - fr = new P(); - class co extends Ye { - constructor(e = new ct(), t = new lo()) { - super(), - (this.isPoints = !0), - (this.type = "Points"), - (this.geometry = e), - (this.material = t), - this.updateMorphTargets(); - } - copy(e, t) { - return ( - super.copy(e, t), - (this.material = e.material), - (this.geometry = e.geometry), - this - ); - } - raycast(e, t) { - const n = this.geometry, - i = this.matrixWorld, - s = e.params.Points.threshold, - a = n.drawRange; - if ( - (n.boundingSphere === null && n.computeBoundingSphere(), - dr.copy(n.boundingSphere), - dr.applyMatrix4(i), - (dr.radius += s), - e.ray.intersectsSphere(dr) === !1) - ) - return; - Jl.copy(i).invert(), Ga.copy(e.ray).applyMatrix4(Jl); - const o = s / ((this.scale.x + this.scale.y + this.scale.z) / 3), - l = o * o, - c = n.index, - h = n.attributes.position; - if (c !== null) { - const d = Math.max(0, a.start), - f = Math.min(c.count, a.start + a.count); - for (let g = d, m = f; g < m; g++) { - const p = c.getX(g); - fr.fromBufferAttribute(h, p), Ql(fr, p, l, i, e, t, this); - } - } else { - const d = Math.max(0, a.start), - f = Math.min(h.count, a.start + a.count); - for (let g = d, m = f; g < m; g++) - fr.fromBufferAttribute(h, g), Ql(fr, g, l, i, e, t, this); - } - } - updateMorphTargets() { - const t = this.geometry.morphAttributes, - n = Object.keys(t); - if (n.length > 0) { - const i = t[n[0]]; - if (i !== void 0) { - (this.morphTargetInfluences = []), - (this.morphTargetDictionary = {}); - for (let s = 0, a = i.length; s < a; s++) { - const o = i[s].name || String(s); - this.morphTargetInfluences.push(0), - (this.morphTargetDictionary[o] = s); - } - } - } - } - } - function Ql(r, e, t, n, i, s, a) { - const o = Ga.distanceSqToPoint(r); - if (o < t) { - const l = new P(); - Ga.closestPointToPoint(r, l), l.applyMatrix4(n); - const c = i.ray.origin.distanceTo(l); - if (c < i.near || c > i.far) return; - s.push({ - distance: c, - distanceToRay: Math.sqrt(o), - point: l, - index: e, - face: null, - object: a, - }); - } - } - class _0 { - constructor() { - (this.type = "Curve"), (this.arcLengthDivisions = 200); - } - getPoint() { - return ( - console.warn("THREE.Curve: .getPoint() not implemented."), null - ); - } - getPointAt(e, t) { - const n = this.getUtoTmapping(e); - return this.getPoint(n, t); - } - getPoints(e = 5) { - const t = []; - for (let n = 0; n <= e; n++) t.push(this.getPoint(n / e)); - return t; - } - getSpacedPoints(e = 5) { - const t = []; - for (let n = 0; n <= e; n++) t.push(this.getPointAt(n / e)); - return t; - } - getLength() { - const e = this.getLengths(); - return e[e.length - 1]; - } - getLengths(e = this.arcLengthDivisions) { - if ( - this.cacheArcLengths && - this.cacheArcLengths.length === e + 1 && - !this.needsUpdate - ) - return this.cacheArcLengths; - this.needsUpdate = !1; - const t = []; - let n, - i = this.getPoint(0), - s = 0; - t.push(0); - for (let a = 1; a <= e; a++) - (n = this.getPoint(a / e)), - (s += n.distanceTo(i)), - t.push(s), - (i = n); - return (this.cacheArcLengths = t), t; - } - updateArcLengths() { - (this.needsUpdate = !0), this.getLengths(); - } - getUtoTmapping(e, t) { - const n = this.getLengths(); - let i = 0; - const s = n.length; - let a; - t ? (a = t) : (a = e * n[s - 1]); - let o = 0, - l = s - 1, - c; - for (; o <= l; ) - if (((i = Math.floor(o + (l - o) / 2)), (c = n[i] - a), c < 0)) - o = i + 1; - else if (c > 0) l = i - 1; - else { - l = i; - break; - } - if (((i = l), n[i] === a)) return i / (s - 1); - const u = n[i], - d = n[i + 1] - u, - f = (a - u) / d; - return (i + f) / (s - 1); - } - getTangent(e, t) { - let i = e - 1e-4, - s = e + 1e-4; - i < 0 && (i = 0), s > 1 && (s = 1); - const a = this.getPoint(i), - o = this.getPoint(s), - l = t || (a.isVector2 ? new ve() : new P()); - return l.copy(o).sub(a).normalize(), l; - } - getTangentAt(e, t) { - const n = this.getUtoTmapping(e); - return this.getTangent(n, t); - } - computeFrenetFrames(e, t) { - const n = new P(), - i = [], - s = [], - a = [], - o = new P(), - l = new pe(); - for (let f = 0; f <= e; f++) { - const g = f / e; - i[f] = this.getTangentAt(g, new P()); - } - (s[0] = new P()), (a[0] = new P()); - let c = Number.MAX_VALUE; - const u = Math.abs(i[0].x), - h = Math.abs(i[0].y), - d = Math.abs(i[0].z); - u <= c && ((c = u), n.set(1, 0, 0)), - h <= c && ((c = h), n.set(0, 1, 0)), - d <= c && n.set(0, 0, 1), - o.crossVectors(i[0], n).normalize(), - s[0].crossVectors(i[0], o), - a[0].crossVectors(i[0], s[0]); - for (let f = 1; f <= e; f++) { - if ( - ((s[f] = s[f - 1].clone()), - (a[f] = a[f - 1].clone()), - o.crossVectors(i[f - 1], i[f]), - o.length() > Number.EPSILON) - ) { - o.normalize(); - const g = Math.acos(at(i[f - 1].dot(i[f]), -1, 1)); - s[f].applyMatrix4(l.makeRotationAxis(o, g)); - } - a[f].crossVectors(i[f], s[f]); - } - if (t === !0) { - let f = Math.acos(at(s[0].dot(s[e]), -1, 1)); - (f /= e), i[0].dot(o.crossVectors(s[0], s[e])) > 0 && (f = -f); - for (let g = 1; g <= e; g++) - s[g].applyMatrix4(l.makeRotationAxis(i[g], f * g)), - a[g].crossVectors(i[g], s[g]); - } - return { tangents: i, normals: s, binormals: a }; - } - clone() { - return new this.constructor().copy(this); - } - copy(e) { - return (this.arcLengthDivisions = e.arcLengthDivisions), this; - } - toJSON() { - const e = { - metadata: { - version: 4.5, - type: "Curve", - generator: "Curve.toJSON", - }, - }; - return ( - (e.arcLengthDivisions = this.arcLengthDivisions), - (e.type = this.type), - e - ); - } - fromJSON(e) { - return (this.arcLengthDivisions = e.arcLengthDivisions), this; - } - } - new P(); - class ho extends ct { - constructor( - e = 1, - t = 1, - n = 1, - i = 8, - s = 1, - a = !1, - o = 0, - l = Math.PI * 2 - ) { - super(), - (this.type = "CylinderGeometry"), - (this.parameters = { - radiusTop: e, - radiusBottom: t, - height: n, - radialSegments: i, - heightSegments: s, - openEnded: a, - thetaStart: o, - thetaLength: l, - }); - const c = this; - (i = Math.floor(i)), (s = Math.floor(s)); - const u = [], - h = [], - d = [], - f = []; - let g = 0; - const m = [], - p = n / 2; - let v = 0; - M(), - a === !1 && (e > 0 && x(!0), t > 0 && x(!1)), - this.setIndex(u), - this.setAttribute("position", new Xe(h, 3)), - this.setAttribute("normal", new Xe(d, 3)), - this.setAttribute("uv", new Xe(f, 2)); - function M() { - const w = new P(), - y = new P(); - let A = 0; - const L = (t - e) / n; - for (let _ = 0; _ <= s; _++) { - const T = [], - I = _ / s, - F = I * (t - e) + e; - for (let H = 0; H <= i; H++) { - const B = H / i, - D = B * l + o, - z = Math.sin(D), - N = Math.cos(D); - (y.x = F * z), - (y.y = -I * n + p), - (y.z = F * N), - h.push(y.x, y.y, y.z), - w.set(z, L, N).normalize(), - d.push(w.x, w.y, w.z), - f.push(B, 1 - I), - T.push(g++); - } - m.push(T); - } - for (let _ = 0; _ < i; _++) - for (let T = 0; T < s; T++) { - const I = m[T][_], - F = m[T + 1][_], - H = m[T + 1][_ + 1], - B = m[T][_ + 1]; - u.push(I, F, B), u.push(F, H, B), (A += 6); - } - c.addGroup(v, A, 0), (v += A); - } - function x(w) { - const y = g, - A = new ve(), - L = new P(); - let _ = 0; - const T = w === !0 ? e : t, - I = w === !0 ? 1 : -1; - for (let H = 1; H <= i; H++) - h.push(0, p * I, 0), d.push(0, I, 0), f.push(0.5, 0.5), g++; - const F = g; - for (let H = 0; H <= i; H++) { - const D = (H / i) * l + o, - z = Math.cos(D), - N = Math.sin(D); - (L.x = T * N), - (L.y = p * I), - (L.z = T * z), - h.push(L.x, L.y, L.z), - d.push(0, I, 0), - (A.x = z * 0.5 + 0.5), - (A.y = N * 0.5 * I + 0.5), - f.push(A.x, A.y), - g++; - } - for (let H = 0; H < i; H++) { - const B = y + H, - D = F + H; - w === !0 ? u.push(D, D + 1, B) : u.push(D + 1, D, B), (_ += 3); - } - c.addGroup(v, _, w === !0 ? 1 : 2), (v += _); - } - } - static fromJSON(e) { - return new ho( - e.radiusTop, - e.radiusBottom, - e.height, - e.radialSegments, - e.heightSegments, - e.openEnded, - e.thetaStart, - e.thetaLength - ); - } - } - new P(); - new P(); - new P(); - new rn(); - class x0 extends it { - constructor(e) { - super(), - (this.isShadowMaterial = !0), - (this.type = "ShadowMaterial"), - (this.color = new de(0)), - (this.transparent = !0), - (this.fog = !0), - this.setValues(e); - } - copy(e) { - return ( - super.copy(e), this.color.copy(e.color), (this.fog = e.fog), this - ); - } - } - class jn extends En { - constructor(e) { - super(e), - (this.isRawShaderMaterial = !0), - (this.type = "RawShaderMaterial"); - } - } - class ks extends it { - constructor(e) { - super(), - (this.isMeshStandardMaterial = !0), - (this.defines = { STANDARD: "" }), - (this.type = "MeshStandardMaterial"), - (this.color = new de(16777215)), - (this.roughness = 1), - (this.metalness = 0), - (this.map = null), - (this.lightMap = null), - (this.lightMapIntensity = 1), - (this.aoMap = null), - (this.aoMapIntensity = 1), - (this.emissive = new de(0)), - (this.emissiveIntensity = 1), - (this.emissiveMap = null), - (this.bumpMap = null), - (this.bumpScale = 1), - (this.normalMap = null), - (this.normalMapType = ci), - (this.normalScale = new ve(1, 1)), - (this.displacementMap = null), - (this.displacementScale = 1), - (this.displacementBias = 0), - (this.roughnessMap = null), - (this.metalnessMap = null), - (this.alphaMap = null), - (this.envMap = null), - (this.envMapIntensity = 1), - (this.wireframe = !1), - (this.wireframeLinewidth = 1), - (this.wireframeLinecap = "round"), - (this.wireframeLinejoin = "round"), - (this.flatShading = !1), - (this.fog = !0), - this.setValues(e); - } - copy(e) { - return ( - super.copy(e), - (this.defines = { STANDARD: "" }), - this.color.copy(e.color), - (this.roughness = e.roughness), - (this.metalness = e.metalness), - (this.map = e.map), - (this.lightMap = e.lightMap), - (this.lightMapIntensity = e.lightMapIntensity), - (this.aoMap = e.aoMap), - (this.aoMapIntensity = e.aoMapIntensity), - this.emissive.copy(e.emissive), - (this.emissiveMap = e.emissiveMap), - (this.emissiveIntensity = e.emissiveIntensity), - (this.bumpMap = e.bumpMap), - (this.bumpScale = e.bumpScale), - (this.normalMap = e.normalMap), - (this.normalMapType = e.normalMapType), - this.normalScale.copy(e.normalScale), - (this.displacementMap = e.displacementMap), - (this.displacementScale = e.displacementScale), - (this.displacementBias = e.displacementBias), - (this.roughnessMap = e.roughnessMap), - (this.metalnessMap = e.metalnessMap), - (this.alphaMap = e.alphaMap), - (this.envMap = e.envMap), - (this.envMapIntensity = e.envMapIntensity), - (this.wireframe = e.wireframe), - (this.wireframeLinewidth = e.wireframeLinewidth), - (this.wireframeLinecap = e.wireframeLinecap), - (this.wireframeLinejoin = e.wireframeLinejoin), - (this.flatShading = e.flatShading), - (this.fog = e.fog), - this - ); - } - } - class Xn extends ks { - constructor(e) { - super(), - (this.isMeshPhysicalMaterial = !0), - (this.defines = { STANDARD: "", PHYSICAL: "" }), - (this.type = "MeshPhysicalMaterial"), - (this.clearcoatMap = null), - (this.clearcoatRoughness = 0), - (this.clearcoatRoughnessMap = null), - (this.clearcoatNormalScale = new ve(1, 1)), - (this.clearcoatNormalMap = null), - (this.ior = 1.5), - Object.defineProperty(this, "reflectivity", { - get: function () { - return at((2.5 * (this.ior - 1)) / (this.ior + 1), 0, 1); - }, - set: function (t) { - this.ior = (1 + 0.4 * t) / (1 - 0.4 * t); - }, - }), - (this.iridescenceMap = null), - (this.iridescenceIOR = 1.3), - (this.iridescenceThicknessRange = [100, 400]), - (this.iridescenceThicknessMap = null), - (this.sheenColor = new de(0)), - (this.sheenColorMap = null), - (this.sheenRoughness = 1), - (this.sheenRoughnessMap = null), - (this.transmissionMap = null), - (this.thickness = 0), - (this.thicknessMap = null), - (this.attenuationDistance = 0), - (this.attenuationColor = new de(1, 1, 1)), - (this.specularIntensity = 1), - (this.specularIntensityMap = null), - (this.specularColor = new de(1, 1, 1)), - (this.specularColorMap = null), - (this._sheen = 0), - (this._clearcoat = 0), - (this._iridescence = 0), - (this._transmission = 0), - this.setValues(e); - } - get sheen() { - return this._sheen; - } - set sheen(e) { - this._sheen > 0 != e > 0 && this.version++, (this._sheen = e); - } - get clearcoat() { - return this._clearcoat; - } - set clearcoat(e) { - this._clearcoat > 0 != e > 0 && this.version++, (this._clearcoat = e); - } - get iridescence() { - return this._iridescence; - } - set iridescence(e) { - this._iridescence > 0 != e > 0 && this.version++, - (this._iridescence = e); - } - get transmission() { - return this._transmission; - } - set transmission(e) { - this._transmission > 0 != e > 0 && this.version++, - (this._transmission = e); - } - copy(e) { - return ( - super.copy(e), - (this.defines = { STANDARD: "", PHYSICAL: "" }), - (this.clearcoat = e.clearcoat), - (this.clearcoatMap = e.clearcoatMap), - (this.clearcoatRoughness = e.clearcoatRoughness), - (this.clearcoatRoughnessMap = e.clearcoatRoughnessMap), - (this.clearcoatNormalMap = e.clearcoatNormalMap), - this.clearcoatNormalScale.copy(e.clearcoatNormalScale), - (this.ior = e.ior), - (this.iridescence = e.iridescence), - (this.iridescenceMap = e.iridescenceMap), - (this.iridescenceIOR = e.iridescenceIOR), - (this.iridescenceThicknessRange = [...e.iridescenceThicknessRange]), - (this.iridescenceThicknessMap = e.iridescenceThicknessMap), - (this.sheen = e.sheen), - this.sheenColor.copy(e.sheenColor), - (this.sheenColorMap = e.sheenColorMap), - (this.sheenRoughness = e.sheenRoughness), - (this.sheenRoughnessMap = e.sheenRoughnessMap), - (this.transmission = e.transmission), - (this.transmissionMap = e.transmissionMap), - (this.thickness = e.thickness), - (this.thicknessMap = e.thicknessMap), - (this.attenuationDistance = e.attenuationDistance), - this.attenuationColor.copy(e.attenuationColor), - (this.specularIntensity = e.specularIntensity), - (this.specularIntensityMap = e.specularIntensityMap), - this.specularColor.copy(e.specularColor), - (this.specularColorMap = e.specularColorMap), - this - ); - } - } - class xr extends it { - constructor(e) { - super(), - (this.isMeshPhongMaterial = !0), - (this.type = "MeshPhongMaterial"), - (this.color = new de(16777215)), - (this.specular = new de(1118481)), - (this.shininess = 30), - (this.map = null), - (this.lightMap = null), - (this.lightMapIntensity = 1), - (this.aoMap = null), - (this.aoMapIntensity = 1), - (this.emissive = new de(0)), - (this.emissiveIntensity = 1), - (this.emissiveMap = null), - (this.bumpMap = null), - (this.bumpScale = 1), - (this.normalMap = null), - (this.normalMapType = ci), - (this.normalScale = new ve(1, 1)), - (this.displacementMap = null), - (this.displacementScale = 1), - (this.displacementBias = 0), - (this.specularMap = null), - (this.alphaMap = null), - (this.envMap = null), - (this.combine = zr), - (this.reflectivity = 1), - (this.refractionRatio = 0.98), - (this.wireframe = !1), - (this.wireframeLinewidth = 1), - (this.wireframeLinecap = "round"), - (this.wireframeLinejoin = "round"), - (this.flatShading = !1), - (this.fog = !0), - this.setValues(e); - } - copy(e) { - return ( - super.copy(e), - this.color.copy(e.color), - this.specular.copy(e.specular), - (this.shininess = e.shininess), - (this.map = e.map), - (this.lightMap = e.lightMap), - (this.lightMapIntensity = e.lightMapIntensity), - (this.aoMap = e.aoMap), - (this.aoMapIntensity = e.aoMapIntensity), - this.emissive.copy(e.emissive), - (this.emissiveMap = e.emissiveMap), - (this.emissiveIntensity = e.emissiveIntensity), - (this.bumpMap = e.bumpMap), - (this.bumpScale = e.bumpScale), - (this.normalMap = e.normalMap), - (this.normalMapType = e.normalMapType), - this.normalScale.copy(e.normalScale), - (this.displacementMap = e.displacementMap), - (this.displacementScale = e.displacementScale), - (this.displacementBias = e.displacementBias), - (this.specularMap = e.specularMap), - (this.alphaMap = e.alphaMap), - (this.envMap = e.envMap), - (this.combine = e.combine), - (this.reflectivity = e.reflectivity), - (this.refractionRatio = e.refractionRatio), - (this.wireframe = e.wireframe), - (this.wireframeLinewidth = e.wireframeLinewidth), - (this.wireframeLinecap = e.wireframeLinecap), - (this.wireframeLinejoin = e.wireframeLinejoin), - (this.flatShading = e.flatShading), - (this.fog = e.fog), - this - ); - } - } - class y0 extends it { - constructor(e) { - super(), - (this.isMeshToonMaterial = !0), - (this.defines = { TOON: "" }), - (this.type = "MeshToonMaterial"), - (this.color = new de(16777215)), - (this.map = null), - (this.gradientMap = null), - (this.lightMap = null), - (this.lightMapIntensity = 1), - (this.aoMap = null), - (this.aoMapIntensity = 1), - (this.emissive = new de(0)), - (this.emissiveIntensity = 1), - (this.emissiveMap = null), - (this.bumpMap = null), - (this.bumpScale = 1), - (this.normalMap = null), - (this.normalMapType = ci), - (this.normalScale = new ve(1, 1)), - (this.displacementMap = null), - (this.displacementScale = 1), - (this.displacementBias = 0), - (this.alphaMap = null), - (this.wireframe = !1), - (this.wireframeLinewidth = 1), - (this.wireframeLinecap = "round"), - (this.wireframeLinejoin = "round"), - (this.fog = !0), - this.setValues(e); - } - copy(e) { - return ( - super.copy(e), - this.color.copy(e.color), - (this.map = e.map), - (this.gradientMap = e.gradientMap), - (this.lightMap = e.lightMap), - (this.lightMapIntensity = e.lightMapIntensity), - (this.aoMap = e.aoMap), - (this.aoMapIntensity = e.aoMapIntensity), - this.emissive.copy(e.emissive), - (this.emissiveMap = e.emissiveMap), - (this.emissiveIntensity = e.emissiveIntensity), - (this.bumpMap = e.bumpMap), - (this.bumpScale = e.bumpScale), - (this.normalMap = e.normalMap), - (this.normalMapType = e.normalMapType), - this.normalScale.copy(e.normalScale), - (this.displacementMap = e.displacementMap), - (this.displacementScale = e.displacementScale), - (this.displacementBias = e.displacementBias), - (this.alphaMap = e.alphaMap), - (this.wireframe = e.wireframe), - (this.wireframeLinewidth = e.wireframeLinewidth), - (this.wireframeLinecap = e.wireframeLinecap), - (this.wireframeLinejoin = e.wireframeLinejoin), - (this.fog = e.fog), - this - ); - } - } - class M0 extends it { - constructor(e) { - super(), - (this.isMeshNormalMaterial = !0), - (this.type = "MeshNormalMaterial"), - (this.bumpMap = null), - (this.bumpScale = 1), - (this.normalMap = null), - (this.normalMapType = ci), - (this.normalScale = new ve(1, 1)), - (this.displacementMap = null), - (this.displacementScale = 1), - (this.displacementBias = 0), - (this.wireframe = !1), - (this.wireframeLinewidth = 1), - (this.flatShading = !1), - this.setValues(e); - } - copy(e) { - return ( - super.copy(e), - (this.bumpMap = e.bumpMap), - (this.bumpScale = e.bumpScale), - (this.normalMap = e.normalMap), - (this.normalMapType = e.normalMapType), - this.normalScale.copy(e.normalScale), - (this.displacementMap = e.displacementMap), - (this.displacementScale = e.displacementScale), - (this.displacementBias = e.displacementBias), - (this.wireframe = e.wireframe), - (this.wireframeLinewidth = e.wireframeLinewidth), - (this.flatShading = e.flatShading), - this - ); - } - } - class lh extends it { - constructor(e) { - super(), - (this.isMeshLambertMaterial = !0), - (this.type = "MeshLambertMaterial"), - (this.color = new de(16777215)), - (this.map = null), - (this.lightMap = null), - (this.lightMapIntensity = 1), - (this.aoMap = null), - (this.aoMapIntensity = 1), - (this.emissive = new de(0)), - (this.emissiveIntensity = 1), - (this.emissiveMap = null), - (this.specularMap = null), - (this.alphaMap = null), - (this.envMap = null), - (this.combine = zr), - (this.reflectivity = 1), - (this.refractionRatio = 0.98), - (this.wireframe = !1), - (this.wireframeLinewidth = 1), - (this.wireframeLinecap = "round"), - (this.wireframeLinejoin = "round"), - (this.fog = !0), - this.setValues(e); - } - copy(e) { - return ( - super.copy(e), - this.color.copy(e.color), - (this.map = e.map), - (this.lightMap = e.lightMap), - (this.lightMapIntensity = e.lightMapIntensity), - (this.aoMap = e.aoMap), - (this.aoMapIntensity = e.aoMapIntensity), - this.emissive.copy(e.emissive), - (this.emissiveMap = e.emissiveMap), - (this.emissiveIntensity = e.emissiveIntensity), - (this.specularMap = e.specularMap), - (this.alphaMap = e.alphaMap), - (this.envMap = e.envMap), - (this.combine = e.combine), - (this.reflectivity = e.reflectivity), - (this.refractionRatio = e.refractionRatio), - (this.wireframe = e.wireframe), - (this.wireframeLinewidth = e.wireframeLinewidth), - (this.wireframeLinecap = e.wireframeLinecap), - (this.wireframeLinejoin = e.wireframeLinejoin), - (this.fog = e.fog), - this - ); - } - } - class w0 extends it { - constructor(e) { - super(), - (this.isMeshMatcapMaterial = !0), - (this.defines = { MATCAP: "" }), - (this.type = "MeshMatcapMaterial"), - (this.color = new de(16777215)), - (this.matcap = null), - (this.map = null), - (this.bumpMap = null), - (this.bumpScale = 1), - (this.normalMap = null), - (this.normalMapType = ci), - (this.normalScale = new ve(1, 1)), - (this.displacementMap = null), - (this.displacementScale = 1), - (this.displacementBias = 0), - (this.alphaMap = null), - (this.flatShading = !1), - (this.fog = !0), - this.setValues(e); - } - copy(e) { - return ( - super.copy(e), - (this.defines = { MATCAP: "" }), - this.color.copy(e.color), - (this.matcap = e.matcap), - (this.map = e.map), - (this.bumpMap = e.bumpMap), - (this.bumpScale = e.bumpScale), - (this.normalMap = e.normalMap), - (this.normalMapType = e.normalMapType), - this.normalScale.copy(e.normalScale), - (this.displacementMap = e.displacementMap), - (this.displacementScale = e.displacementScale), - (this.displacementBias = e.displacementBias), - (this.alphaMap = e.alphaMap), - (this.flatShading = e.flatShading), - (this.fog = e.fog), - this - ); - } - } - class b0 extends Os { - constructor(e) { - super(), - (this.isLineDashedMaterial = !0), - (this.type = "LineDashedMaterial"), - (this.scale = 1), - (this.dashSize = 3), - (this.gapSize = 1), - this.setValues(e); - } - copy(e) { - return ( - super.copy(e), - (this.scale = e.scale), - (this.dashSize = e.dashSize), - (this.gapSize = e.gapSize), - this - ); - } - } - const S0 = { - ShadowMaterial: x0, - SpriteMaterial: f0, - RawShaderMaterial: jn, - ShaderMaterial: En, - PointsMaterial: lo, - MeshPhysicalMaterial: Xn, - MeshStandardMaterial: ks, - MeshPhongMaterial: xr, - MeshToonMaterial: y0, - MeshNormalMaterial: M0, - MeshLambertMaterial: lh, - MeshDepthMaterial: ih, - MeshDistanceMaterial: sh, - MeshBasicMaterial: wn, - MeshMatcapMaterial: w0, - LineDashedMaterial: b0, - LineBasicMaterial: Os, - Material: it, - }; - it.fromType = function (r) { - return new S0[r](); - }; - const je = { - arraySlice: function (r, e, t) { - return je.isTypedArray(r) - ? new r.constructor(r.subarray(e, t !== void 0 ? t : r.length)) - : r.slice(e, t); - }, - convertArray: function (r, e, t) { - return !r || (!t && r.constructor === e) - ? r - : typeof e.BYTES_PER_ELEMENT == "number" - ? new e(r) - : Array.prototype.slice.call(r); - }, - isTypedArray: function (r) { - return ArrayBuffer.isView(r) && !(r instanceof DataView); - }, - getKeyframeOrder: function (r) { - function e(i, s) { - return r[i] - r[s]; - } - const t = r.length, - n = new Array(t); - for (let i = 0; i !== t; ++i) n[i] = i; - return n.sort(e), n; - }, - sortedArray: function (r, e, t) { - const n = r.length, - i = new r.constructor(n); - for (let s = 0, a = 0; a !== n; ++s) { - const o = t[s] * e; - for (let l = 0; l !== e; ++l) i[a++] = r[o + l]; - } - return i; - }, - flattenJSON: function (r, e, t, n) { - let i = 1, - s = r[0]; - for (; s !== void 0 && s[n] === void 0; ) s = r[i++]; - if (s === void 0) return; - let a = s[n]; - if (a !== void 0) - if (Array.isArray(a)) - do - (a = s[n]), - a !== void 0 && (e.push(s.time), t.push.apply(t, a)), - (s = r[i++]); - while (s !== void 0); - else if (a.toArray !== void 0) - do - (a = s[n]), - a !== void 0 && (e.push(s.time), a.toArray(t, t.length)), - (s = r[i++]); - while (s !== void 0); - else - do - (a = s[n]), - a !== void 0 && (e.push(s.time), t.push(a)), - (s = r[i++]); - while (s !== void 0); - }, - subclip: function (r, e, t, n, i = 30) { - const s = r.clone(); - s.name = e; - const a = []; - for (let l = 0; l < s.tracks.length; ++l) { - const c = s.tracks[l], - u = c.getValueSize(), - h = [], - d = []; - for (let f = 0; f < c.times.length; ++f) { - const g = c.times[f] * i; - if (!(g < t || g >= n)) { - h.push(c.times[f]); - for (let m = 0; m < u; ++m) d.push(c.values[f * u + m]); - } - } - h.length !== 0 && - ((c.times = je.convertArray(h, c.times.constructor)), - (c.values = je.convertArray(d, c.values.constructor)), - a.push(c)); - } - s.tracks = a; - let o = 1 / 0; - for (let l = 0; l < s.tracks.length; ++l) - o > s.tracks[l].times[0] && (o = s.tracks[l].times[0]); - for (let l = 0; l < s.tracks.length; ++l) s.tracks[l].shift(-1 * o); - return s.resetDuration(), s; - }, - makeClipAdditive: function (r, e = 0, t = r, n = 30) { - n <= 0 && (n = 30); - const i = t.tracks.length, - s = e / n; - for (let a = 0; a < i; ++a) { - const o = t.tracks[a], - l = o.ValueTypeName; - if (l === "bool" || l === "string") continue; - const c = r.tracks.find(function (v) { - return v.name === o.name && v.ValueTypeName === l; - }); - if (c === void 0) continue; - let u = 0; - const h = o.getValueSize(); - o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline && - (u = h / 3); - let d = 0; - const f = c.getValueSize(); - c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline && - (d = f / 3); - const g = o.times.length - 1; - let m; - if (s <= o.times[0]) { - const v = u, - M = h - u; - m = je.arraySlice(o.values, v, M); - } else if (s >= o.times[g]) { - const v = g * h + u, - M = v + h - u; - m = je.arraySlice(o.values, v, M); - } else { - const v = o.createInterpolant(), - M = u, - x = h - u; - v.evaluate(s), (m = je.arraySlice(v.resultBuffer, M, x)); - } - l === "quaternion" && - new Mt().fromArray(m).normalize().conjugate().toArray(m); - const p = c.times.length; - for (let v = 0; v < p; ++v) { - const M = v * f + d; - if (l === "quaternion") - Mt.multiplyQuaternionsFlat(c.values, M, m, 0, c.values, M); - else { - const x = f - d * 2; - for (let w = 0; w < x; ++w) c.values[M + w] -= m[w]; - } - } - } - return (r.blendMode = Zu), r; - }, - }; - class Us { - constructor(e, t, n, i) { - (this.parameterPositions = e), - (this._cachedIndex = 0), - (this.resultBuffer = i !== void 0 ? i : new t.constructor(n)), - (this.sampleValues = t), - (this.valueSize = n), - (this.settings = null), - (this.DefaultSettings_ = {}); - } - evaluate(e) { - const t = this.parameterPositions; - let n = this._cachedIndex, - i = t[n], - s = t[n - 1]; - n: { - e: { - let a; - t: { - i: if (!(e < i)) { - for (let o = n + 2; ; ) { - if (i === void 0) { - if (e < s) break i; - return ( - (n = t.length), - (this._cachedIndex = n), - this.copySampleValue_(n - 1) - ); - } - if (n === o) break; - if (((s = i), (i = t[++n]), e < i)) break e; - } - a = t.length; - break t; - } - if (!(e >= s)) { - const o = t[1]; - e < o && ((n = 2), (s = o)); - for (let l = n - 2; ; ) { - if (s === void 0) - return (this._cachedIndex = 0), this.copySampleValue_(0); - if (n === l) break; - if (((i = s), (s = t[--n - 1]), e >= s)) break e; - } - (a = n), (n = 0); - break t; - } - break n; - } - for (; n < a; ) { - const o = (n + a) >>> 1; - e < t[o] ? (a = o) : (n = o + 1); - } - if (((i = t[n]), (s = t[n - 1]), s === void 0)) - return (this._cachedIndex = 0), this.copySampleValue_(0); - if (i === void 0) - return ( - (n = t.length), - (this._cachedIndex = n), - this.copySampleValue_(n - 1) - ); - } - (this._cachedIndex = n), this.intervalChanged_(n, s, i); - } - return this.interpolate_(n, s, e, i); - } - getSettings_() { - return this.settings || this.DefaultSettings_; - } - copySampleValue_(e) { - const t = this.resultBuffer, - n = this.sampleValues, - i = this.valueSize, - s = e * i; - for (let a = 0; a !== i; ++a) t[a] = n[s + a]; - return t; - } - interpolate_() { - throw new Error("call to abstract method"); - } - intervalChanged_() {} - } - class T0 extends Us { - constructor(e, t, n, i) { - super(e, t, n, i), - (this._weightPrev = -0), - (this._offsetPrev = -0), - (this._weightNext = -0), - (this._offsetNext = -0), - (this.DefaultSettings_ = { endingStart: rl, endingEnd: rl }); - } - intervalChanged_(e, t, n) { - const i = this.parameterPositions; - let s = e - 2, - a = e + 1, - o = i[s], - l = i[a]; - if (o === void 0) - switch (this.getSettings_().endingStart) { - case al: - (s = e), (o = 2 * t - n); - break; - case ol: - (s = i.length - 2), (o = t + i[s] - i[s + 1]); - break; - default: - (s = e), (o = n); - } - if (l === void 0) - switch (this.getSettings_().endingEnd) { - case al: - (a = e), (l = 2 * n - t); - break; - case ol: - (a = 1), (l = n + i[1] - i[0]); - break; - default: - (a = e - 1), (l = t); - } - const c = (n - t) * 0.5, - u = this.valueSize; - (this._weightPrev = c / (t - o)), - (this._weightNext = c / (l - n)), - (this._offsetPrev = s * u), - (this._offsetNext = a * u); - } - interpolate_(e, t, n, i) { - const s = this.resultBuffer, - a = this.sampleValues, - o = this.valueSize, - l = e * o, - c = l - o, - u = this._offsetPrev, - h = this._offsetNext, - d = this._weightPrev, - f = this._weightNext, - g = (n - t) / (i - t), - m = g * g, - p = m * g, - v = -d * p + 2 * d * m - d * g, - M = (1 + d) * p + (-1.5 - 2 * d) * m + (-0.5 + d) * g + 1, - x = (-1 - f) * p + (1.5 + f) * m + 0.5 * g, - w = f * p - f * m; - for (let y = 0; y !== o; ++y) - s[y] = v * a[u + y] + M * a[c + y] + x * a[l + y] + w * a[h + y]; - return s; - } - } - class E0 extends Us { - constructor(e, t, n, i) { - super(e, t, n, i); - } - interpolate_(e, t, n, i) { - const s = this.resultBuffer, - a = this.sampleValues, - o = this.valueSize, - l = e * o, - c = l - o, - u = (n - t) / (i - t), - h = 1 - u; - for (let d = 0; d !== o; ++d) s[d] = a[c + d] * h + a[l + d] * u; - return s; - } - } - class A0 extends Us { - constructor(e, t, n, i) { - super(e, t, n, i); - } - interpolate_(e) { - return this.copySampleValue_(e - 1); - } - } - class dn { - constructor(e, t, n, i) { - if (e === void 0) - throw new Error("THREE.KeyframeTrack: track name is undefined"); - if (t === void 0 || t.length === 0) - throw new Error( - "THREE.KeyframeTrack: no keyframes in track named " + e - ); - (this.name = e), - (this.times = je.convertArray(t, this.TimeBufferType)), - (this.values = je.convertArray(n, this.ValueBufferType)), - this.setInterpolation(i || this.DefaultInterpolation); - } - static toJSON(e) { - const t = e.constructor; - let n; - if (t.toJSON !== this.toJSON) n = t.toJSON(e); - else { - n = { - name: e.name, - times: je.convertArray(e.times, Array), - values: je.convertArray(e.values, Array), - }; - const i = e.getInterpolation(); - i !== e.DefaultInterpolation && (n.interpolation = i); - } - return (n.type = e.ValueTypeName), n; - } - InterpolantFactoryMethodDiscrete(e) { - return new A0(this.times, this.values, this.getValueSize(), e); - } - InterpolantFactoryMethodLinear(e) { - return new E0(this.times, this.values, this.getValueSize(), e); - } - InterpolantFactoryMethodSmooth(e) { - return new T0(this.times, this.values, this.getValueSize(), e); - } - setInterpolation(e) { - let t; - switch (e) { - case Es: - t = this.InterpolantFactoryMethodDiscrete; - break; - case Gi: - t = this.InterpolantFactoryMethodLinear; - break; - case Zr: - t = this.InterpolantFactoryMethodSmooth; - break; - } - if (t === void 0) { - const n = - "unsupported interpolation for " + - this.ValueTypeName + - " keyframe track named " + - this.name; - if (this.createInterpolant === void 0) - if (e !== this.DefaultInterpolation) - this.setInterpolation(this.DefaultInterpolation); - else throw new Error(n); - return console.warn("THREE.KeyframeTrack:", n), this; - } - return (this.createInterpolant = t), this; - } - getInterpolation() { - switch (this.createInterpolant) { - case this.InterpolantFactoryMethodDiscrete: - return Es; - case this.InterpolantFactoryMethodLinear: - return Gi; - case this.InterpolantFactoryMethodSmooth: - return Zr; - } - } - getValueSize() { - return this.values.length / this.times.length; - } - shift(e) { - if (e !== 0) { - const t = this.times; - for (let n = 0, i = t.length; n !== i; ++n) t[n] += e; - } - return this; - } - scale(e) { - if (e !== 1) { - const t = this.times; - for (let n = 0, i = t.length; n !== i; ++n) t[n] *= e; - } - return this; - } - trim(e, t) { - const n = this.times, - i = n.length; - let s = 0, - a = i - 1; - for (; s !== i && n[s] < e; ) ++s; - for (; a !== -1 && n[a] > t; ) --a; - if ((++a, s !== 0 || a !== i)) { - s >= a && ((a = Math.max(a, 1)), (s = a - 1)); - const o = this.getValueSize(); - (this.times = je.arraySlice(n, s, a)), - (this.values = je.arraySlice(this.values, s * o, a * o)); - } - return this; - } - validate() { - let e = !0; - const t = this.getValueSize(); - t - Math.floor(t) !== 0 && - (console.error( - "THREE.KeyframeTrack: Invalid value size in track.", - this - ), - (e = !1)); - const n = this.times, - i = this.values, - s = n.length; - s === 0 && - (console.error("THREE.KeyframeTrack: Track is empty.", this), - (e = !1)); - let a = null; - for (let o = 0; o !== s; o++) { - const l = n[o]; - if (typeof l == "number" && isNaN(l)) { - console.error( - "THREE.KeyframeTrack: Time is not a valid number.", - this, - o, - l - ), - (e = !1); - break; - } - if (a !== null && a > l) { - console.error( - "THREE.KeyframeTrack: Out of order keys.", - this, - o, - l, - a - ), - (e = !1); - break; - } - a = l; - } - if (i !== void 0 && je.isTypedArray(i)) - for (let o = 0, l = i.length; o !== l; ++o) { - const c = i[o]; - if (isNaN(c)) { - console.error( - "THREE.KeyframeTrack: Value is not a valid number.", - this, - o, - c - ), - (e = !1); - break; - } - } - return e; - } - optimize() { - const e = je.arraySlice(this.times), - t = je.arraySlice(this.values), - n = this.getValueSize(), - i = this.getInterpolation() === Zr, - s = e.length - 1; - let a = 1; - for (let o = 1; o < s; ++o) { - let l = !1; - const c = e[o], - u = e[o + 1]; - if (c !== u && (o !== 1 || c !== e[0])) - if (i) l = !0; - else { - const h = o * n, - d = h - n, - f = h + n; - for (let g = 0; g !== n; ++g) { - const m = t[h + g]; - if (m !== t[d + g] || m !== t[f + g]) { - l = !0; - break; - } - } - } - if (l) { - if (o !== a) { - e[a] = e[o]; - const h = o * n, - d = a * n; - for (let f = 0; f !== n; ++f) t[d + f] = t[h + f]; - } - ++a; - } - } - if (s > 0) { - e[a] = e[s]; - for (let o = s * n, l = a * n, c = 0; c !== n; ++c) - t[l + c] = t[o + c]; - ++a; - } - return ( - a !== e.length - ? ((this.times = je.arraySlice(e, 0, a)), - (this.values = je.arraySlice(t, 0, a * n))) - : ((this.times = e), (this.values = t)), - this - ); - } - clone() { - const e = je.arraySlice(this.times, 0), - t = je.arraySlice(this.values, 0), - n = this.constructor, - i = new n(this.name, e, t); - return (i.createInterpolant = this.createInterpolant), i; - } - } - dn.prototype.TimeBufferType = Float32Array; - dn.prototype.ValueBufferType = Float32Array; - dn.prototype.DefaultInterpolation = Gi; - class Qi extends dn {} - Qi.prototype.ValueTypeName = "bool"; - Qi.prototype.ValueBufferType = Array; - Qi.prototype.DefaultInterpolation = Es; - Qi.prototype.InterpolantFactoryMethodLinear = void 0; - Qi.prototype.InterpolantFactoryMethodSmooth = void 0; - class ch extends dn {} - ch.prototype.ValueTypeName = "color"; - class Wi extends dn {} - Wi.prototype.ValueTypeName = "number"; - class C0 extends Us { - constructor(e, t, n, i) { - super(e, t, n, i); - } - interpolate_(e, t, n, i) { - const s = this.resultBuffer, - a = this.sampleValues, - o = this.valueSize, - l = (n - t) / (i - t); - let c = e * o; - for (let u = c + o; c !== u; c += 4) - Mt.slerpFlat(s, 0, a, c - o, a, c, l); - return s; - } - } - class Hn extends dn { - InterpolantFactoryMethodLinear(e) { - return new C0(this.times, this.values, this.getValueSize(), e); - } - } - Hn.prototype.ValueTypeName = "quaternion"; - Hn.prototype.DefaultInterpolation = Gi; - Hn.prototype.InterpolantFactoryMethodSmooth = void 0; - class es extends dn {} - es.prototype.ValueTypeName = "string"; - es.prototype.ValueBufferType = Array; - es.prototype.DefaultInterpolation = Es; - es.prototype.InterpolantFactoryMethodLinear = void 0; - es.prototype.InterpolantFactoryMethodSmooth = void 0; - class ji extends dn {} - ji.prototype.ValueTypeName = "vector"; - class hh { - constructor(e, t = -1, n, i = Ku) { - (this.name = e), - (this.tracks = n), - (this.duration = t), - (this.blendMode = i), - (this.uuid = Yt()), - this.duration < 0 && this.resetDuration(); - } - static parse(e) { - const t = [], - n = e.tracks, - i = 1 / (e.fps || 1); - for (let a = 0, o = n.length; a !== o; ++a) t.push(R0(n[a]).scale(i)); - const s = new this(e.name, e.duration, t, e.blendMode); - return (s.uuid = e.uuid), s; - } - static toJSON(e) { - const t = [], - n = e.tracks, - i = { - name: e.name, - duration: e.duration, - tracks: t, - uuid: e.uuid, - blendMode: e.blendMode, - }; - for (let s = 0, a = n.length; s !== a; ++s) t.push(dn.toJSON(n[s])); - return i; - } - static CreateFromMorphTargetSequence(e, t, n, i) { - const s = t.length, - a = []; - for (let o = 0; o < s; o++) { - let l = [], - c = []; - l.push((o + s - 1) % s, o, (o + 1) % s), c.push(0, 1, 0); - const u = je.getKeyframeOrder(l); - (l = je.sortedArray(l, 1, u)), - (c = je.sortedArray(c, 1, u)), - !i && l[0] === 0 && (l.push(s), c.push(c[0])), - a.push( - new Wi(".morphTargetInfluences[" + t[o].name + "]", l, c).scale( - 1 / n - ) - ); - } - return new this(e, -1, a); - } - static findByName(e, t) { - let n = e; - if (!Array.isArray(e)) { - const i = e; - n = (i.geometry && i.geometry.animations) || i.animations; - } - for (let i = 0; i < n.length; i++) if (n[i].name === t) return n[i]; - return null; - } - static CreateClipsFromMorphTargetSequences(e, t, n) { - const i = {}, - s = /^([\w-]*?)([\d]+)$/; - for (let o = 0, l = e.length; o < l; o++) { - const c = e[o], - u = c.name.match(s); - if (u && u.length > 1) { - const h = u[1]; - let d = i[h]; - d || (i[h] = d = []), d.push(c); - } - } - const a = []; - for (const o in i) - a.push(this.CreateFromMorphTargetSequence(o, i[o], t, n)); - return a; - } - static parseAnimation(e, t) { - if (!e) - return ( - console.error( - "THREE.AnimationClip: No animation in JSONLoader data." - ), - null - ); - const n = function (h, d, f, g, m) { - if (f.length !== 0) { - const p = [], - v = []; - je.flattenJSON(f, p, v, g), - p.length !== 0 && m.push(new h(d, p, v)); - } - }, - i = [], - s = e.name || "default", - a = e.fps || 30, - o = e.blendMode; - let l = e.length || -1; - const c = e.hierarchy || []; - for (let h = 0; h < c.length; h++) { - const d = c[h].keys; - if (!(!d || d.length === 0)) - if (d[0].morphTargets) { - const f = {}; - let g; - for (g = 0; g < d.length; g++) - if (d[g].morphTargets) - for (let m = 0; m < d[g].morphTargets.length; m++) - f[d[g].morphTargets[m]] = -1; - for (const m in f) { - const p = [], - v = []; - for (let M = 0; M !== d[g].morphTargets.length; ++M) { - const x = d[g]; - p.push(x.time), v.push(x.morphTarget === m ? 1 : 0); - } - i.push(new Wi(".morphTargetInfluence[" + m + "]", p, v)); - } - l = f.length * a; - } else { - const f = ".bones[" + t[h].name + "]"; - n(ji, f + ".position", d, "pos", i), - n(Hn, f + ".quaternion", d, "rot", i), - n(ji, f + ".scale", d, "scl", i); - } - } - return i.length === 0 ? null : new this(s, l, i, o); - } - resetDuration() { - const e = this.tracks; - let t = 0; - for (let n = 0, i = e.length; n !== i; ++n) { - const s = this.tracks[n]; - t = Math.max(t, s.times[s.times.length - 1]); - } - return (this.duration = t), this; - } - trim() { - for (let e = 0; e < this.tracks.length; e++) - this.tracks[e].trim(0, this.duration); - return this; - } - validate() { - let e = !0; - for (let t = 0; t < this.tracks.length; t++) - e = e && this.tracks[t].validate(); - return e; - } - optimize() { - for (let e = 0; e < this.tracks.length; e++) - this.tracks[e].optimize(); - return this; - } - clone() { - const e = []; - for (let t = 0; t < this.tracks.length; t++) - e.push(this.tracks[t].clone()); - return new this.constructor( - this.name, - this.duration, - e, - this.blendMode - ); - } - toJSON() { - return this.constructor.toJSON(this); - } - } - function L0(r) { - switch (r.toLowerCase()) { - case "scalar": - case "double": - case "float": - case "number": - case "integer": - return Wi; - case "vector": - case "vector2": - case "vector3": - case "vector4": - return ji; - case "color": - return ch; - case "quaternion": - return Hn; - case "bool": - case "boolean": - return Qi; - case "string": - return es; - } - throw new Error("THREE.KeyframeTrack: Unsupported typeName: " + r); - } - function R0(r) { - if (r.type === void 0) - throw new Error( - "THREE.KeyframeTrack: track type undefined, can not parse" - ); - const e = L0(r.type); - if (r.times === void 0) { - const t = [], - n = []; - je.flattenJSON(r.keys, t, n, "value"), (r.times = t), (r.values = n); - } - return e.parse !== void 0 - ? e.parse(r) - : new e(r.name, r.times, r.values, r.interpolation); - } - const Xi = { - enabled: !1, - files: {}, - add: function (r, e) { - this.enabled !== !1 && (this.files[r] = e); - }, - get: function (r) { - if (this.enabled !== !1) return this.files[r]; - }, - remove: function (r) { - delete this.files[r]; - }, - clear: function () { - this.files = {}; - }, - }; - class P0 { - constructor(e, t, n) { - const i = this; - let s = !1, - a = 0, - o = 0, - l; - const c = []; - (this.onStart = void 0), - (this.onLoad = e), - (this.onProgress = t), - (this.onError = n), - (this.itemStart = function (u) { - o++, - s === !1 && i.onStart !== void 0 && i.onStart(u, a, o), - (s = !0); - }), - (this.itemEnd = function (u) { - a++, - i.onProgress !== void 0 && i.onProgress(u, a, o), - a === o && ((s = !1), i.onLoad !== void 0 && i.onLoad()); - }), - (this.itemError = function (u) { - i.onError !== void 0 && i.onError(u); - }), - (this.resolveURL = function (u) { - return l ? l(u) : u; - }), - (this.setURLModifier = function (u) { - return (l = u), this; - }), - (this.addHandler = function (u, h) { - return c.push(u, h), this; - }), - (this.removeHandler = function (u) { - const h = c.indexOf(u); - return h !== -1 && c.splice(h, 2), this; - }), - (this.getHandler = function (u) { - for (let h = 0, d = c.length; h < d; h += 2) { - const f = c[h], - g = c[h + 1]; - if ((f.global && (f.lastIndex = 0), f.test(u))) return g; - } - return null; - }); - } - } - const D0 = new P0(); - class qn { - constructor(e) { - (this.manager = e !== void 0 ? e : D0), - (this.crossOrigin = "anonymous"), - (this.withCredentials = !1), - (this.path = ""), - (this.resourcePath = ""), - (this.requestHeader = {}); - } - load() {} - loadAsync(e, t) { - const n = this; - return new Promise(function (i, s) { - n.load(e, i, t, s); - }); - } - parse() {} - setCrossOrigin(e) { - return (this.crossOrigin = e), this; - } - setWithCredentials(e) { - return (this.withCredentials = e), this; - } - setPath(e) { - return (this.path = e), this; - } - setResourcePath(e) { - return (this.resourcePath = e), this; - } - setRequestHeader(e) { - return (this.requestHeader = e), this; - } - } - const _n = {}; - class qi extends qn { - constructor(e) { - super(e); - } - load(e, t, n, i) { - e === void 0 && (e = ""), - this.path !== void 0 && (e = this.path + e), - (e = this.manager.resolveURL(e)); - const s = Xi.get(e); - if (s !== void 0) - return ( - this.manager.itemStart(e), - setTimeout(() => { - t && t(s), this.manager.itemEnd(e); - }, 0), - s - ); - if (_n[e] !== void 0) { - _n[e].push({ onLoad: t, onProgress: n, onError: i }); - return; - } - (_n[e] = []), _n[e].push({ onLoad: t, onProgress: n, onError: i }); - const a = new Request(e, { - headers: new Headers(this.requestHeader), - credentials: this.withCredentials ? "include" : "same-origin", - }), - o = this.mimeType, - l = this.responseType; - fetch(a) - .then((c) => { - if (c.status === 200 || c.status === 0) { - if ( - (c.status === 0 && - console.warn("THREE.FileLoader: HTTP Status 0 received."), - typeof ReadableStream == "undefined" || - c.body === void 0 || - c.body.getReader === void 0) - ) - return c; - const u = _n[e], - h = c.body.getReader(), - d = c.headers.get("Content-Length"), - f = d ? parseInt(d) : 0, - g = f !== 0; - let m = 0; - const p = new ReadableStream({ - start(v) { - M(); - function M() { - h.read().then(({ done: x, value: w }) => { - if (x) v.close(); - else { - m += w.byteLength; - const y = new ProgressEvent("progress", { - lengthComputable: g, - loaded: m, - total: f, - }); - for (let A = 0, L = u.length; A < L; A++) { - const _ = u[A]; - _.onProgress && _.onProgress(y); - } - v.enqueue(w), M(); - } - }); - } - }, - }); - return new Response(p); - } else - throw Error( - `fetch for "${c.url}" responded with ${c.status}: ${c.statusText}` - ); - }) - .then((c) => { - switch (l) { - case "arraybuffer": - return c.arrayBuffer(); - case "blob": - return c.blob(); - case "document": - return c - .text() - .then((u) => new DOMParser().parseFromString(u, o)); - case "json": - return c.json(); - default: - if (o === void 0) return c.text(); - { - const h = /charset="?([^;"\s]*)"?/i.exec(o), - d = h && h[1] ? h[1].toLowerCase() : void 0, - f = new TextDecoder(d); - return c.arrayBuffer().then((g) => f.decode(g)); - } - } - }) - .then((c) => { - Xi.add(e, c); - const u = _n[e]; - delete _n[e]; - for (let h = 0, d = u.length; h < d; h++) { - const f = u[h]; - f.onLoad && f.onLoad(c); - } - }) - .catch((c) => { - const u = _n[e]; - if (u === void 0) throw (this.manager.itemError(e), c); - delete _n[e]; - for (let h = 0, d = u.length; h < d; h++) { - const f = u[h]; - f.onError && f.onError(c); - } - this.manager.itemError(e); - }) - .finally(() => { - this.manager.itemEnd(e); - }), - this.manager.itemStart(e); - } - setResponseType(e) { - return (this.responseType = e), this; - } - setMimeType(e) { - return (this.mimeType = e), this; - } - } - class I0 extends qn { - constructor(e) { - super(e); - } - load(e, t, n, i) { - this.path !== void 0 && (e = this.path + e), - (e = this.manager.resolveURL(e)); - const s = this, - a = Xi.get(e); - if (a !== void 0) - return ( - s.manager.itemStart(e), - setTimeout(function () { - t && t(a), s.manager.itemEnd(e); - }, 0), - a - ); - const o = Cs("img"); - function l() { - u(), Xi.add(e, this), t && t(this), s.manager.itemEnd(e); - } - function c(h) { - u(), i && i(h), s.manager.itemError(e), s.manager.itemEnd(e); - } - function u() { - o.removeEventListener("load", l, !1), - o.removeEventListener("error", c, !1); - } - return ( - o.addEventListener("load", l, !1), - o.addEventListener("error", c, !1), - e.slice(0, 5) !== "data:" && - this.crossOrigin !== void 0 && - (o.crossOrigin = this.crossOrigin), - s.manager.itemStart(e), - (o.src = e), - o - ); - } - } - class F0 extends qn { - constructor(e) { - super(e); - } - load(e, t, n, i) { - const s = this, - a = new oh(), - o = new qi(this.manager); - return ( - o.setResponseType("arraybuffer"), - o.setRequestHeader(this.requestHeader), - o.setPath(this.path), - o.setWithCredentials(s.withCredentials), - o.load( - e, - function (l) { - const c = s.parse(l); - !c || - (c.image !== void 0 - ? (a.image = c.image) - : c.data !== void 0 && - ((a.image.width = c.width), - (a.image.height = c.height), - (a.image.data = c.data)), - (a.wrapS = c.wrapS !== void 0 ? c.wrapS : gt), - (a.wrapT = c.wrapT !== void 0 ? c.wrapT : gt), - (a.magFilter = c.magFilter !== void 0 ? c.magFilter : $e), - (a.minFilter = c.minFilter !== void 0 ? c.minFilter : $e), - (a.anisotropy = c.anisotropy !== void 0 ? c.anisotropy : 1), - c.encoding !== void 0 && (a.encoding = c.encoding), - c.flipY !== void 0 && (a.flipY = c.flipY), - c.format !== void 0 && (a.format = c.format), - c.type !== void 0 && (a.type = c.type), - c.mipmaps !== void 0 && - ((a.mipmaps = c.mipmaps), (a.minFilter = li)), - c.mipmapCount === 1 && (a.minFilter = $e), - c.generateMipmaps !== void 0 && - (a.generateMipmaps = c.generateMipmaps), - (a.needsUpdate = !0), - t && t(a, c)); - }, - n, - i - ), - a - ); - } - } - class uh extends qn { - constructor(e) { - super(e); - } - load(e, t, n, i) { - const s = new nt(), - a = new I0(this.manager); - return ( - a.setCrossOrigin(this.crossOrigin), - a.setPath(this.path), - a.load( - e, - function (o) { - (s.image = o), (s.needsUpdate = !0), t !== void 0 && t(s); - }, - n, - i - ), - s - ); - } - } - class Vr extends Ye { - constructor(e, t = 1) { - super(), - (this.isLight = !0), - (this.type = "Light"), - (this.color = new de(e)), - (this.intensity = t); - } - dispose() {} - copy(e, t) { - return ( - super.copy(e, t), - this.color.copy(e.color), - (this.intensity = e.intensity), - this - ); - } - toJSON(e) { - const t = super.toJSON(e); - return ( - (t.object.color = this.color.getHex()), - (t.object.intensity = this.intensity), - this.groundColor !== void 0 && - (t.object.groundColor = this.groundColor.getHex()), - this.distance !== void 0 && (t.object.distance = this.distance), - this.angle !== void 0 && (t.object.angle = this.angle), - this.decay !== void 0 && (t.object.decay = this.decay), - this.penumbra !== void 0 && (t.object.penumbra = this.penumbra), - this.shadow !== void 0 && (t.object.shadow = this.shadow.toJSON()), - t - ); - } - } - const ec = new pe(), - tc = new P(), - nc = new P(); - class uo { - constructor(e) { - (this.camera = e), - (this.bias = 0), - (this.normalBias = 0), - (this.radius = 1), - (this.blurSamples = 8), - (this.mapSize = new ve(512, 512)), - (this.map = null), - (this.mapPass = null), - (this.matrix = new pe()), - (this.autoUpdate = !0), - (this.needsUpdate = !1), - (this._frustum = new ro()), - (this._frameExtents = new ve(1, 1)), - (this._viewportCount = 1), - (this._viewports = [new Ue(0, 0, 1, 1)]); - } - getViewportCount() { - return this._viewportCount; - } - getFrustum() { - return this._frustum; - } - updateMatrices(e) { - const t = this.camera, - n = this.matrix; - tc.setFromMatrixPosition(e.matrixWorld), - t.position.copy(tc), - nc.setFromMatrixPosition(e.target.matrixWorld), - t.lookAt(nc), - t.updateMatrixWorld(), - ec.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse), - this._frustum.setFromProjectionMatrix(ec), - n.set(0.5, 0, 0, 0.5, 0, 0.5, 0, 0.5, 0, 0, 0.5, 0.5, 0, 0, 0, 1), - n.multiply(t.projectionMatrix), - n.multiply(t.matrixWorldInverse); - } - getViewport(e) { - return this._viewports[e]; - } - getFrameExtents() { - return this._frameExtents; - } - dispose() { - this.map && this.map.dispose(), - this.mapPass && this.mapPass.dispose(); - } - copy(e) { - return ( - (this.camera = e.camera.clone()), - (this.bias = e.bias), - (this.radius = e.radius), - this.mapSize.copy(e.mapSize), - this - ); - } - clone() { - return new this.constructor().copy(this); - } - toJSON() { - const e = {}; - return ( - this.bias !== 0 && (e.bias = this.bias), - this.normalBias !== 0 && (e.normalBias = this.normalBias), - this.radius !== 1 && (e.radius = this.radius), - (this.mapSize.x !== 512 || this.mapSize.y !== 512) && - (e.mapSize = this.mapSize.toArray()), - (e.camera = this.camera.toJSON(!1).object), - delete e.camera.matrix, - e - ); - } - } - class N0 extends uo { - constructor() { - super(new mt(50, 1, 0.5, 500)), - (this.isSpotLightShadow = !0), - (this.focus = 1); - } - updateMatrices(e) { - const t = this.camera, - n = As * 2 * e.angle * this.focus, - i = this.mapSize.width / this.mapSize.height, - s = e.distance || t.far; - (n !== t.fov || i !== t.aspect || s !== t.far) && - ((t.fov = n), - (t.aspect = i), - (t.far = s), - t.updateProjectionMatrix()), - super.updateMatrices(e); - } - copy(e) { - return super.copy(e), (this.focus = e.focus), this; - } - } - class dh extends Vr { - constructor(e, t, n = 0, i = Math.PI / 3, s = 0, a = 1) { - super(e, t), - (this.isSpotLight = !0), - (this.type = "SpotLight"), - this.position.copy(Ye.DefaultUp), - this.updateMatrix(), - (this.target = new Ye()), - (this.distance = n), - (this.angle = i), - (this.penumbra = s), - (this.decay = a), - (this.shadow = new N0()); - } - get power() { - return this.intensity * Math.PI; - } - set power(e) { - this.intensity = e / Math.PI; - } - dispose() { - this.shadow.dispose(); - } - copy(e, t) { - return ( - super.copy(e, t), - (this.distance = e.distance), - (this.angle = e.angle), - (this.penumbra = e.penumbra), - (this.decay = e.decay), - (this.target = e.target.clone()), - (this.shadow = e.shadow.clone()), - this - ); - } - } - const ic = new pe(), - ms = new P(), - Ea = new P(); - class z0 extends uo { - constructor() { - super(new mt(90, 1, 0.5, 500)), - (this.isPointLightShadow = !0), - (this._frameExtents = new ve(4, 2)), - (this._viewportCount = 6), - (this._viewports = [ - new Ue(2, 1, 1, 1), - new Ue(0, 1, 1, 1), - new Ue(3, 1, 1, 1), - new Ue(1, 1, 1, 1), - new Ue(3, 0, 1, 1), - new Ue(1, 0, 1, 1), - ]), - (this._cubeDirections = [ - new P(1, 0, 0), - new P(-1, 0, 0), - new P(0, 0, 1), - new P(0, 0, -1), - new P(0, 1, 0), - new P(0, -1, 0), - ]), - (this._cubeUps = [ - new P(0, 1, 0), - new P(0, 1, 0), - new P(0, 1, 0), - new P(0, 1, 0), - new P(0, 0, 1), - new P(0, 0, -1), - ]); - } - updateMatrices(e, t = 0) { - const n = this.camera, - i = this.matrix, - s = e.distance || n.far; - s !== n.far && ((n.far = s), n.updateProjectionMatrix()), - ms.setFromMatrixPosition(e.matrixWorld), - n.position.copy(ms), - Ea.copy(n.position), - Ea.add(this._cubeDirections[t]), - n.up.copy(this._cubeUps[t]), - n.lookAt(Ea), - n.updateMatrixWorld(), - i.makeTranslation(-ms.x, -ms.y, -ms.z), - ic.multiplyMatrices(n.projectionMatrix, n.matrixWorldInverse), - this._frustum.setFromProjectionMatrix(ic); - } - } - class Ha extends Vr { - constructor(e, t, n = 0, i = 1) { - super(e, t), - (this.isPointLight = !0), - (this.type = "PointLight"), - (this.distance = n), - (this.decay = i), - (this.shadow = new z0()); - } - get power() { - return this.intensity * 4 * Math.PI; - } - set power(e) { - this.intensity = e / (4 * Math.PI); - } - dispose() { - this.shadow.dispose(); - } - copy(e, t) { - return ( - super.copy(e, t), - (this.distance = e.distance), - (this.decay = e.decay), - (this.shadow = e.shadow.clone()), - this - ); - } - } - class O0 extends uo { - constructor() { - super(new zs(-5, 5, 5, -5, 0.5, 500)), - (this.isDirectionalLightShadow = !0); - } - } - class fh extends Vr { - constructor(e, t) { - super(e, t), - (this.isDirectionalLight = !0), - (this.type = "DirectionalLight"), - this.position.copy(Ye.DefaultUp), - this.updateMatrix(), - (this.target = new Ye()), - (this.shadow = new O0()); - } - dispose() { - this.shadow.dispose(); - } - copy(e) { - return ( - super.copy(e), - (this.target = e.target.clone()), - (this.shadow = e.shadow.clone()), - this - ); - } - } - class k0 extends Vr { - constructor(e, t) { - super(e, t), (this.isAmbientLight = !0), (this.type = "AmbientLight"); - } - } - class on { - static decodeText(e) { - if (typeof TextDecoder != "undefined") - return new TextDecoder().decode(e); - let t = ""; - for (let n = 0, i = e.length; n < i; n++) - t += String.fromCharCode(e[n]); - try { - return decodeURIComponent(escape(t)); - } catch { - return t; - } - } - static extractUrlBase(e) { - const t = e.lastIndexOf("/"); - return t === -1 ? "./" : e.slice(0, t + 1); - } - static resolveURL(e, t) { - return typeof e != "string" || e === "" - ? "" - : (/^https?:\/\//i.test(t) && - /^\//.test(e) && - (t = t.replace(/(^https?:\/\/[^\/]+).*/i, "$1")), - /^(https?:)?\/\//i.test(e) || - /^data:.*,.*$/i.test(e) || - /^blob:.*$/i.test(e) - ? e - : t + e); - } - } - class U0 extends qn { - constructor(e) { - super(e), - (this.isImageBitmapLoader = !0), - typeof createImageBitmap == "undefined" && - console.warn( - "THREE.ImageBitmapLoader: createImageBitmap() not supported." - ), - typeof fetch == "undefined" && - console.warn("THREE.ImageBitmapLoader: fetch() not supported."), - (this.options = { premultiplyAlpha: "none" }); - } - setOptions(e) { - return (this.options = e), this; - } - load(e, t, n, i) { - e === void 0 && (e = ""), - this.path !== void 0 && (e = this.path + e), - (e = this.manager.resolveURL(e)); - const s = this, - a = Xi.get(e); - if (a !== void 0) - return ( - s.manager.itemStart(e), - setTimeout(function () { - t && t(a), s.manager.itemEnd(e); - }, 0), - a - ); - const o = {}; - (o.credentials = - this.crossOrigin === "anonymous" ? "same-origin" : "include"), - (o.headers = this.requestHeader), - fetch(e, o) - .then(function (l) { - return l.blob(); - }) - .then(function (l) { - return createImageBitmap( - l, - Object.assign(s.options, { colorSpaceConversion: "none" }) - ); - }) - .then(function (l) { - Xi.add(e, l), t && t(l), s.manager.itemEnd(e); - }) - .catch(function (l) { - i && i(l), s.manager.itemError(e), s.manager.itemEnd(e); - }), - s.manager.itemStart(e); - } - } - const fo = "\\[\\]\\.:\\/", - B0 = new RegExp("[" + fo + "]", "g"), - po = "[^" + fo + "]", - V0 = "[^" + fo.replace("\\.", "") + "]", - G0 = /((?:WC+[\/:])*)/.source.replace("WC", po), - H0 = /(WCOD+)?/.source.replace("WCOD", V0), - W0 = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC", po), - j0 = /\.(WC+)(?:\[(.+)\])?/.source.replace("WC", po), - X0 = new RegExp("^" + G0 + H0 + W0 + j0 + "$"), - q0 = ["material", "materials", "bones"]; - class $0 { - constructor(e, t, n) { - const i = n || Ne.parseTrackName(t); - (this._targetGroup = e), (this._bindings = e.subscribe_(t, i)); - } - getValue(e, t) { - this.bind(); - const n = this._targetGroup.nCachedObjects_, - i = this._bindings[n]; - i !== void 0 && i.getValue(e, t); - } - setValue(e, t) { - const n = this._bindings; - for ( - let i = this._targetGroup.nCachedObjects_, s = n.length; - i !== s; - ++i - ) - n[i].setValue(e, t); - } - bind() { - const e = this._bindings; - for ( - let t = this._targetGroup.nCachedObjects_, n = e.length; - t !== n; - ++t - ) - e[t].bind(); - } - unbind() { - const e = this._bindings; - for ( - let t = this._targetGroup.nCachedObjects_, n = e.length; - t !== n; - ++t - ) - e[t].unbind(); - } - } - class Ne { - constructor(e, t, n) { - (this.path = t), - (this.parsedPath = n || Ne.parseTrackName(t)), - (this.node = Ne.findNode(e, this.parsedPath.nodeName) || e), - (this.rootNode = e), - (this.getValue = this._getValue_unbound), - (this.setValue = this._setValue_unbound); - } - static create(e, t, n) { - return e && e.isAnimationObjectGroup - ? new Ne.Composite(e, t, n) - : new Ne(e, t, n); - } - static sanitizeNodeName(e) { - return e.replace(/\s/g, "_").replace(B0, ""); - } - static parseTrackName(e) { - const t = X0.exec(e); - if (t === null) - throw new Error("PropertyBinding: Cannot parse trackName: " + e); - const n = { - nodeName: t[2], - objectName: t[3], - objectIndex: t[4], - propertyName: t[5], - propertyIndex: t[6], - }, - i = n.nodeName && n.nodeName.lastIndexOf("."); - if (i !== void 0 && i !== -1) { - const s = n.nodeName.substring(i + 1); - q0.indexOf(s) !== -1 && - ((n.nodeName = n.nodeName.substring(0, i)), (n.objectName = s)); - } - if (n.propertyName === null || n.propertyName.length === 0) - throw new Error( - "PropertyBinding: can not parse propertyName from trackName: " + e - ); - return n; - } - static findNode(e, t) { - if ( - t === void 0 || - t === "" || - t === "." || - t === -1 || - t === e.name || - t === e.uuid - ) - return e; - if (e.skeleton) { - const n = e.skeleton.getBoneByName(t); - if (n !== void 0) return n; - } - if (e.children) { - const n = function (s) { - for (let a = 0; a < s.length; a++) { - const o = s[a]; - if (o.name === t || o.uuid === t) return o; - const l = n(o.children); - if (l) return l; - } - return null; - }, - i = n(e.children); - if (i) return i; - } - return null; - } - _getValue_unavailable() {} - _setValue_unavailable() {} - _getValue_direct(e, t) { - e[t] = this.targetObject[this.propertyName]; - } - _getValue_array(e, t) { - const n = this.resolvedProperty; - for (let i = 0, s = n.length; i !== s; ++i) e[t++] = n[i]; - } - _getValue_arrayElement(e, t) { - e[t] = this.resolvedProperty[this.propertyIndex]; - } - _getValue_toArray(e, t) { - this.resolvedProperty.toArray(e, t); - } - _setValue_direct(e, t) { - this.targetObject[this.propertyName] = e[t]; - } - _setValue_direct_setNeedsUpdate(e, t) { - (this.targetObject[this.propertyName] = e[t]), - (this.targetObject.needsUpdate = !0); - } - _setValue_direct_setMatrixWorldNeedsUpdate(e, t) { - (this.targetObject[this.propertyName] = e[t]), - (this.targetObject.matrixWorldNeedsUpdate = !0); - } - _setValue_array(e, t) { - const n = this.resolvedProperty; - for (let i = 0, s = n.length; i !== s; ++i) n[i] = e[t++]; - } - _setValue_array_setNeedsUpdate(e, t) { - const n = this.resolvedProperty; - for (let i = 0, s = n.length; i !== s; ++i) n[i] = e[t++]; - this.targetObject.needsUpdate = !0; - } - _setValue_array_setMatrixWorldNeedsUpdate(e, t) { - const n = this.resolvedProperty; - for (let i = 0, s = n.length; i !== s; ++i) n[i] = e[t++]; - this.targetObject.matrixWorldNeedsUpdate = !0; - } - _setValue_arrayElement(e, t) { - this.resolvedProperty[this.propertyIndex] = e[t]; - } - _setValue_arrayElement_setNeedsUpdate(e, t) { - (this.resolvedProperty[this.propertyIndex] = e[t]), - (this.targetObject.needsUpdate = !0); - } - _setValue_arrayElement_setMatrixWorldNeedsUpdate(e, t) { - (this.resolvedProperty[this.propertyIndex] = e[t]), - (this.targetObject.matrixWorldNeedsUpdate = !0); - } - _setValue_fromArray(e, t) { - this.resolvedProperty.fromArray(e, t); - } - _setValue_fromArray_setNeedsUpdate(e, t) { - this.resolvedProperty.fromArray(e, t), - (this.targetObject.needsUpdate = !0); - } - _setValue_fromArray_setMatrixWorldNeedsUpdate(e, t) { - this.resolvedProperty.fromArray(e, t), - (this.targetObject.matrixWorldNeedsUpdate = !0); - } - _getValue_unbound(e, t) { - this.bind(), this.getValue(e, t); - } - _setValue_unbound(e, t) { - this.bind(), this.setValue(e, t); - } - bind() { - let e = this.node; - const t = this.parsedPath, - n = t.objectName, - i = t.propertyName; - let s = t.propertyIndex; - if ( - (e || - ((e = Ne.findNode(this.rootNode, t.nodeName) || this.rootNode), - (this.node = e)), - (this.getValue = this._getValue_unavailable), - (this.setValue = this._setValue_unavailable), - !e) - ) { - console.error( - "THREE.PropertyBinding: Trying to update node for track: " + - this.path + - " but it wasn't found." - ); - return; - } - if (n) { - let c = t.objectIndex; - switch (n) { - case "materials": - if (!e.material) { - console.error( - "THREE.PropertyBinding: Can not bind to material as node does not have a material.", - this - ); - return; - } - if (!e.material.materials) { - console.error( - "THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.", - this - ); - return; - } - e = e.material.materials; - break; - case "bones": - if (!e.skeleton) { - console.error( - "THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.", - this - ); - return; - } - e = e.skeleton.bones; - for (let u = 0; u < e.length; u++) - if (e[u].name === c) { - c = u; - break; - } - break; - default: - if (e[n] === void 0) { - console.error( - "THREE.PropertyBinding: Can not bind to objectName of node undefined.", - this - ); - return; - } - e = e[n]; - } - if (c !== void 0) { - if (e[c] === void 0) { - console.error( - "THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.", - this, - e - ); - return; - } - e = e[c]; - } - } - const a = e[i]; - if (a === void 0) { - const c = t.nodeName; - console.error( - "THREE.PropertyBinding: Trying to update property for track: " + - c + - "." + - i + - " but it wasn't found.", - e - ); - return; - } - let o = this.Versioning.None; - (this.targetObject = e), - e.needsUpdate !== void 0 - ? (o = this.Versioning.NeedsUpdate) - : e.matrixWorldNeedsUpdate !== void 0 && - (o = this.Versioning.MatrixWorldNeedsUpdate); - let l = this.BindingType.Direct; - if (s !== void 0) { - if (i === "morphTargetInfluences") { - if (!e.geometry) { - console.error( - "THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.", - this - ); - return; - } - if (!e.geometry.morphAttributes) { - console.error( - "THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.", - this - ); - return; - } - e.morphTargetDictionary[s] !== void 0 && - (s = e.morphTargetDictionary[s]); - } - (l = this.BindingType.ArrayElement), - (this.resolvedProperty = a), - (this.propertyIndex = s); - } else - a.fromArray !== void 0 && a.toArray !== void 0 - ? ((l = this.BindingType.HasFromToArray), - (this.resolvedProperty = a)) - : Array.isArray(a) - ? ((l = this.BindingType.EntireArray), - (this.resolvedProperty = a)) - : (this.propertyName = i); - (this.getValue = this.GetterByBindingType[l]), - (this.setValue = this.SetterByBindingTypeAndVersioning[l][o]); - } - unbind() { - (this.node = null), - (this.getValue = this._getValue_unbound), - (this.setValue = this._setValue_unbound); - } - } - Ne.Composite = $0; - Ne.prototype.BindingType = { - Direct: 0, - EntireArray: 1, - ArrayElement: 2, - HasFromToArray: 3, - }; - Ne.prototype.Versioning = { - None: 0, - NeedsUpdate: 1, - MatrixWorldNeedsUpdate: 2, - }; - Ne.prototype.GetterByBindingType = [ - Ne.prototype._getValue_direct, - Ne.prototype._getValue_array, - Ne.prototype._getValue_arrayElement, - Ne.prototype._getValue_toArray, - ]; - Ne.prototype.SetterByBindingTypeAndVersioning = [ - [ - Ne.prototype._setValue_direct, - Ne.prototype._setValue_direct_setNeedsUpdate, - Ne.prototype._setValue_direct_setMatrixWorldNeedsUpdate, - ], - [ - Ne.prototype._setValue_array, - Ne.prototype._setValue_array_setNeedsUpdate, - Ne.prototype._setValue_array_setMatrixWorldNeedsUpdate, - ], - [ - Ne.prototype._setValue_arrayElement, - Ne.prototype._setValue_arrayElement_setNeedsUpdate, - Ne.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate, - ], - [ - Ne.prototype._setValue_fromArray, - Ne.prototype._setValue_fromArray_setNeedsUpdate, - Ne.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate, - ], - ]; - class sc { - constructor(e = 1, t = 0, n = 0) { - return (this.radius = e), (this.phi = t), (this.theta = n), this; - } - set(e, t, n) { - return (this.radius = e), (this.phi = t), (this.theta = n), this; - } - copy(e) { - return ( - (this.radius = e.radius), - (this.phi = e.phi), - (this.theta = e.theta), - this - ); - } - makeSafe() { - return ( - (this.phi = Math.max(1e-6, Math.min(Math.PI - 1e-6, this.phi))), - this - ); - } - setFromVector3(e) { - return this.setFromCartesianCoords(e.x, e.y, e.z); - } - setFromCartesianCoords(e, t, n) { - return ( - (this.radius = Math.sqrt(e * e + t * t + n * n)), - this.radius === 0 - ? ((this.theta = 0), (this.phi = 0)) - : ((this.theta = Math.atan2(e, n)), - (this.phi = Math.acos(at(t / this.radius, -1, 1)))), - this - ); - } - clone() { - return new this.constructor().copy(this); - } - } - class pr { - static toHalfFloat(e) { - Math.abs(e) > 65504 && - console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."), - (e = at(e, -65504, 65504)), - (rc[0] = e); - const t = ac[0], - n = (t >> 23) & 511; - return Ht[n] + ((t & 8388607) >> Wt[n]); - } - static fromHalfFloat(e) { - const t = e >> 10; - return (ac[0] = mo[mh[t] + (e & 1023)] + ts[t]), rc[0]; - } - } - const ph = new ArrayBuffer(4), - rc = new Float32Array(ph), - ac = new Uint32Array(ph), - Ht = new Uint32Array(512), - Wt = new Uint32Array(512); - for (let r = 0; r < 256; ++r) { - const e = r - 127; - e < -27 - ? ((Ht[r] = 0), - (Ht[r | 256] = 32768), - (Wt[r] = 24), - (Wt[r | 256] = 24)) - : e < -14 - ? ((Ht[r] = 1024 >> (-e - 14)), - (Ht[r | 256] = (1024 >> (-e - 14)) | 32768), - (Wt[r] = -e - 1), - (Wt[r | 256] = -e - 1)) - : e <= 15 - ? ((Ht[r] = (e + 15) << 10), - (Ht[r | 256] = ((e + 15) << 10) | 32768), - (Wt[r] = 13), - (Wt[r | 256] = 13)) - : e < 128 - ? ((Ht[r] = 31744), - (Ht[r | 256] = 64512), - (Wt[r] = 24), - (Wt[r | 256] = 24)) - : ((Ht[r] = 31744), - (Ht[r | 256] = 64512), - (Wt[r] = 13), - (Wt[r | 256] = 13)); - } - const mo = new Uint32Array(2048), - ts = new Uint32Array(64), - mh = new Uint32Array(64); - for (let r = 1; r < 1024; ++r) { - let e = r << 13, - t = 0; - for (; (e & 8388608) === 0; ) (e <<= 1), (t -= 8388608); - (e &= -8388609), (t += 947912704), (mo[r] = e | t); - } - for (let r = 1024; r < 2048; ++r) mo[r] = 939524096 + ((r - 1024) << 13); - for (let r = 1; r < 31; ++r) ts[r] = r << 23; - ts[31] = 1199570944; - ts[32] = 2147483648; - for (let r = 33; r < 63; ++r) ts[r] = 2147483648 + ((r - 32) << 23); - ts[63] = 3347054592; - for (let r = 1; r < 64; ++r) r !== 32 && (mh[r] = 1024); - typeof __THREE_DEVTOOLS__ != "undefined" && - __THREE_DEVTOOLS__.dispatchEvent( - new CustomEvent("register", { detail: { revision: to } }) - ); - typeof window != "undefined" && - (window.__THREE__ - ? console.warn( - "WARNING: Multiple instances of Three.js being imported." - ) - : (window.__THREE__ = to)); - class Gr { - constructor() { - (this.callbacks = {}), (this.callbacks.base = {}); - } - on(e, t) { - const n = this; - return typeof e == "undefined" || e === "" - ? (console.warn("wrong names"), !1) - : typeof t == "undefined" - ? (console.warn("wrong callback"), !1) - : (this.resolveNames(e).forEach(function (s) { - const a = n.resolveName(s); - n.callbacks[a.namespace] instanceof Object || - (n.callbacks[a.namespace] = {}), - n.callbacks[a.namespace][a.value] instanceof Array || - (n.callbacks[a.namespace][a.value] = []), - n.callbacks[a.namespace][a.value].push(t); - }), - this); - } - off(e) { - const t = this; - return typeof e == "undefined" || e === "" - ? (console.warn("wrong name"), !1) - : (this.resolveNames(e).forEach(function (i) { - const s = t.resolveName(i); - if (s.namespace !== "base" && s.value === "") - delete t.callbacks[s.namespace]; - else if (s.namespace === "base") - for (const a in t.callbacks) - t.callbacks[a] instanceof Object && - t.callbacks[a][s.value] instanceof Array && - (delete t.callbacks[a][s.value], - Object.keys(t.callbacks[a]).length === 0 && - delete t.callbacks[a]); - else - t.callbacks[s.namespace] instanceof Object && - t.callbacks[s.namespace][s.value] instanceof Array && - (delete t.callbacks[s.namespace][s.value], - Object.keys(t.callbacks[s.namespace]).length === 0 && - delete t.callbacks[s.namespace]); - }), - this); - } - trigger(e, t) { - if (typeof e == "undefined" || e === "") - return console.warn("wrong name"), !1; - const n = this; - let i = null; - const s = t instanceof Array ? t : []; - let a = this.resolveNames(e); - if (((a = this.resolveName(a[0])), a.namespace === "base")) - for (const o in n.callbacks) - n.callbacks[o] instanceof Object && - n.callbacks[o][a.value] instanceof Array && - n.callbacks[o][a.value].forEach(function (l) { - l.apply(n, s); - }); - else if (this.callbacks[a.namespace] instanceof Object) { - if (a.value === "") return console.warn("wrong name"), this; - n.callbacks[a.namespace][a.value].forEach(function (o) { - o.apply(n, s); - }); - } - return i; - } - resolveNames(e) { - let t = e; - return ( - (t = t.replace(/[^a-zA-Z0-9 ,/.]/g, "")), - (t = t.replace(/[,/]+/g, " ")), - (t = t.split(" ")), - t - ); - } - resolveName(e) { - const t = {}, - n = e.split("."); - return ( - (t.original = e), - (t.value = n[0]), - (t.namespace = "base"), - n.length > 1 && n[1] !== "" && (t.namespace = n[1]), - t - ); - } - } - class Y0 extends Gr { - constructor() { - super(), - (this.start = Date.now() / 1e3), - (this.current = this.start), - (this.elapsed = 0), - (this.delta = 16), - (this.playing = !0), - (this.tick = this.tick.bind(this)), - this.tick(); - } - play() { - this.playing = !0; - } - pause() { - this.playing = !1; - } - tick() { - this.ticker = window.requestAnimationFrame(this.tick); - const e = Date.now() / 1e3; - (this.delta = e - this.current), - (this.elapsed += this.playing ? this.delta : 0), - (this.current = e), - this.delta > 60 && (this.delta = 60), - this.playing && this.trigger("tick"); - } - stop() { - window.cancelAnimationFrame(this.ticker); - } - } - class K0 extends Gr { - constructor() { - super(), - (this.viewport = {}), - (this.$sizeViewport = document.createElement("div")), - (this.$sizeViewport.style.width = "100vw"), - (this.$sizeViewport.style.height = "100vh"), - (this.$sizeViewport.style.position = "absolute"), - (this.$sizeViewport.style.top = 0), - (this.$sizeViewport.style.left = 0), - (this.$sizeViewport.style.pointerEvents = "none"), - (this.resize = this.resize.bind(this)), - window.addEventListener("resize", this.resize), - this.resize(); - } - resize() { - document.body.appendChild(this.$sizeViewport), - (this.viewport.width = this.$sizeViewport.offsetWidth), - (this.viewport.height = this.$sizeViewport.offsetHeight), - document.body.removeChild(this.$sizeViewport), - (this.width = window.innerWidth), - (this.height = window.innerHeight), - this.trigger("resize"); - } - } - /** - * lil-gui - * https://lil-gui.georgealways.com - * @version 0.16.1 - * @author George Michael Brower - * @license MIT - */ class ln { - constructor(e, t, n, i, s = "div") { - (this.parent = e), - (this.object = t), - (this.property = n), - (this._disabled = !1), - (this.initialValue = this.getValue()), - (this.domElement = document.createElement("div")), - this.domElement.classList.add("controller"), - this.domElement.classList.add(i), - (this.$name = document.createElement("div")), - this.$name.classList.add("name"), - (ln.nextNameID = ln.nextNameID || 0), - (this.$name.id = `lil-gui-name-${++ln.nextNameID}`), - (this.$widget = document.createElement(s)), - this.$widget.classList.add("widget"), - (this.$disable = this.$widget), - this.domElement.appendChild(this.$name), - this.domElement.appendChild(this.$widget), - this.parent.children.push(this), - this.parent.controllers.push(this), - this.parent.$children.appendChild(this.domElement), - (this._listenCallback = this._listenCallback.bind(this)), - this.name(n); - } - name(e) { - return (this._name = e), (this.$name.innerHTML = e), this; - } - onChange(e) { - return (this._onChange = e), this; - } - _callOnChange() { - this.parent._callOnChange(this), - this._onChange !== void 0 && - this._onChange.call(this, this.getValue()), - (this._changed = !0); - } - onFinishChange(e) { - return (this._onFinishChange = e), this; - } - _callOnFinishChange() { - this._changed && - (this.parent._callOnFinishChange(this), - this._onFinishChange !== void 0 && - this._onFinishChange.call(this, this.getValue())), - (this._changed = !1); - } - reset() { - return ( - this.setValue(this.initialValue), this._callOnFinishChange(), this - ); - } - enable(e = !0) { - return this.disable(!e); - } - disable(e = !0) { - return e === this._disabled - ? this - : ((this._disabled = e), - this.domElement.classList.toggle("disabled", e), - this.$disable.toggleAttribute("disabled", e), - this); - } - options(e) { - const t = this.parent.add(this.object, this.property, e); - return t.name(this._name), this.destroy(), t; - } - min(e) { - return this; - } - max(e) { - return this; - } - step(e) { - return this; - } - listen(e = !0) { - return ( - (this._listening = e), - this._listenCallbackID !== void 0 && - (cancelAnimationFrame(this._listenCallbackID), - (this._listenCallbackID = void 0)), - this._listening && this._listenCallback(), - this - ); - } - _listenCallback() { - this._listenCallbackID = requestAnimationFrame(this._listenCallback); - const e = this.save(); - e !== this._listenPrevValue && this.updateDisplay(), - (this._listenPrevValue = e); - } - getValue() { - return this.object[this.property]; - } - setValue(e) { - return ( - (this.object[this.property] = e), - this._callOnChange(), - this.updateDisplay(), - this - ); - } - updateDisplay() { - return this; - } - load(e) { - return this.setValue(e), this._callOnFinishChange(), this; - } - save() { - return this.getValue(); - } - destroy() { - this.listen(!1), - this.parent.children.splice(this.parent.children.indexOf(this), 1), - this.parent.controllers.splice( - this.parent.controllers.indexOf(this), - 1 - ), - this.parent.$children.removeChild(this.domElement); - } - } - class Z0 extends ln { - constructor(e, t, n) { - super(e, t, n, "boolean", "label"), - (this.$input = document.createElement("input")), - this.$input.setAttribute("type", "checkbox"), - this.$input.setAttribute("aria-labelledby", this.$name.id), - this.$widget.appendChild(this.$input), - this.$input.addEventListener("change", () => { - this.setValue(this.$input.checked), this._callOnFinishChange(); - }), - (this.$disable = this.$input), - this.updateDisplay(); - } - updateDisplay() { - return (this.$input.checked = this.getValue()), this; - } - } - function Wa(r) { - let e, t; - return ( - (e = r.match(/(#|0x)?([a-f0-9]{6})/i)) - ? (t = e[2]) - : (e = r.match(/rgb\(\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*)\s*\)/)) - ? (t = - parseInt(e[1]).toString(16).padStart(2, 0) + - parseInt(e[2]).toString(16).padStart(2, 0) + - parseInt(e[3]).toString(16).padStart(2, 0)) - : (e = r.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i)) && - (t = e[1] + e[1] + e[2] + e[2] + e[3] + e[3]), - t ? "#" + t : !1 - ); - } - const J0 = { - isPrimitive: !0, - match: (r) => typeof r == "string", - fromHexString: Wa, - toHexString: Wa, - }, - Ls = { - isPrimitive: !0, - match: (r) => typeof r == "number", - fromHexString: (r) => parseInt(r.substring(1), 16), - toHexString: (r) => "#" + r.toString(16).padStart(6, 0), - }, - Q0 = { - isPrimitive: !1, - match: Array.isArray, - fromHexString(r, e, t = 1) { - const n = Ls.fromHexString(r); - (e[0] = (((n >> 16) & 255) / 255) * t), - (e[1] = (((n >> 8) & 255) / 255) * t), - (e[2] = ((n & 255) / 255) * t); - }, - toHexString([r, e, t], n = 1) { - n = 255 / n; - const i = ((r * n) << 16) ^ ((e * n) << 8) ^ ((t * n) << 0); - return Ls.toHexString(i); - }, - }, - ev = { - isPrimitive: !1, - match: (r) => Object(r) === r, - fromHexString(r, e, t = 1) { - const n = Ls.fromHexString(r); - (e.r = (((n >> 16) & 255) / 255) * t), - (e.g = (((n >> 8) & 255) / 255) * t), - (e.b = ((n & 255) / 255) * t); - }, - toHexString({ r, g: e, b: t }, n = 1) { - n = 255 / n; - const i = ((r * n) << 16) ^ ((e * n) << 8) ^ ((t * n) << 0); - return Ls.toHexString(i); - }, - }, - tv = [J0, Ls, Q0, ev]; - function nv(r) { - return tv.find((e) => e.match(r)); - } - class iv extends ln { - constructor(e, t, n, i) { - super(e, t, n, "color"), - (this.$input = document.createElement("input")), - this.$input.setAttribute("type", "color"), - this.$input.setAttribute("tabindex", -1), - this.$input.setAttribute("aria-labelledby", this.$name.id), - (this.$text = document.createElement("input")), - this.$text.setAttribute("type", "text"), - this.$text.setAttribute("spellcheck", "false"), - this.$text.setAttribute("aria-labelledby", this.$name.id), - (this.$display = document.createElement("div")), - this.$display.classList.add("display"), - this.$display.appendChild(this.$input), - this.$widget.appendChild(this.$display), - this.$widget.appendChild(this.$text), - (this._format = nv(this.initialValue)), - (this._rgbScale = i), - (this._initialValueHexString = this.save()), - (this._textFocused = !1), - this.$input.addEventListener("input", () => { - this._setValueFromHexString(this.$input.value); - }), - this.$input.addEventListener("blur", () => { - this._callOnFinishChange(); - }), - this.$text.addEventListener("input", () => { - const s = Wa(this.$text.value); - s && this._setValueFromHexString(s); - }), - this.$text.addEventListener("focus", () => { - (this._textFocused = !0), this.$text.select(); - }), - this.$text.addEventListener("blur", () => { - (this._textFocused = !1), - this.updateDisplay(), - this._callOnFinishChange(); - }), - (this.$disable = this.$text), - this.updateDisplay(); - } - reset() { - return this._setValueFromHexString(this._initialValueHexString), this; - } - _setValueFromHexString(e) { - if (this._format.isPrimitive) { - const t = this._format.fromHexString(e); - this.setValue(t); - } else - this._format.fromHexString(e, this.getValue(), this._rgbScale), - this._callOnChange(), - this.updateDisplay(); - } - save() { - return this._format.toHexString(this.getValue(), this._rgbScale); - } - load(e) { - return ( - this._setValueFromHexString(e), this._callOnFinishChange(), this - ); - } - updateDisplay() { - return ( - (this.$input.value = this._format.toHexString( - this.getValue(), - this._rgbScale - )), - this._textFocused || - (this.$text.value = this.$input.value.substring(1)), - (this.$display.style.backgroundColor = this.$input.value), - this - ); - } - } - class Aa extends ln { - constructor(e, t, n) { - super(e, t, n, "function"), - (this.$button = document.createElement("button")), - this.$button.appendChild(this.$name), - this.$widget.appendChild(this.$button), - this.$button.addEventListener("click", (i) => { - i.preventDefault(), this.getValue().call(this.object); - }), - this.$button.addEventListener("touchstart", () => {}, { - passive: !0, - }), - (this.$disable = this.$button); - } - } - class sv extends ln { - constructor(e, t, n, i, s, a) { - super(e, t, n, "number"), this._initInput(), this.min(i), this.max(s); - const o = a !== void 0; - this.step(o ? a : this._getImplicitStep(), o), this.updateDisplay(); - } - min(e) { - return (this._min = e), this._onUpdateMinMax(), this; - } - max(e) { - return (this._max = e), this._onUpdateMinMax(), this; - } - step(e, t = !0) { - return (this._step = e), (this._stepExplicit = t), this; - } - updateDisplay() { - const e = this.getValue(); - if (this._hasSlider) { - let t = (e - this._min) / (this._max - this._min); - (t = Math.max(0, Math.min(t, 1))), - (this.$fill.style.width = t * 100 + "%"); - } - return this._inputFocused || (this.$input.value = e), this; - } - _initInput() { - (this.$input = document.createElement("input")), - this.$input.setAttribute("type", "number"), - this.$input.setAttribute("step", "any"), - this.$input.setAttribute("aria-labelledby", this.$name.id), - this.$widget.appendChild(this.$input), - (this.$disable = this.$input); - const e = () => { - const v = parseFloat(this.$input.value); - isNaN(v) || this.setValue(this._clamp(v)); - }, - t = (v) => { - const M = parseFloat(this.$input.value); - isNaN(M) || - (this._snapClampSetValue(M + v), - (this.$input.value = this.getValue())); - }, - n = (v) => { - v.code === "Enter" && this.$input.blur(), - v.code === "ArrowUp" && - (v.preventDefault(), - t(this._step * this._arrowKeyMultiplier(v))), - v.code === "ArrowDown" && - (v.preventDefault(), - t(this._step * this._arrowKeyMultiplier(v) * -1)); - }, - i = (v) => { - this._inputFocused && - (v.preventDefault(), - t(this._step * this._normalizeMouseWheel(v))); - }; - let s = !1, - a, - o, - l, - c, - u; - const h = 5, - d = (v) => { - (a = v.clientX), - (o = l = v.clientY), - (s = !0), - (c = this.getValue()), - (u = 0), - window.addEventListener("mousemove", f), - window.addEventListener("mouseup", g); - }, - f = (v) => { - if (s) { - const M = v.clientX - a, - x = v.clientY - o; - Math.abs(x) > h - ? (v.preventDefault(), - this.$input.blur(), - (s = !1), - this._setDraggingStyle(!0, "vertical")) - : Math.abs(M) > h && g(); - } - s || - ((u -= - (v.clientY - l) * this._step * this._arrowKeyMultiplier(v)), - c + u > this._max - ? (u = this._max - c) - : c + u < this._min && (u = this._min - c), - this._snapClampSetValue(c + u)), - (l = v.clientY); - }, - g = () => { - this._setDraggingStyle(!1, "vertical"), - this._callOnFinishChange(), - window.removeEventListener("mousemove", f), - window.removeEventListener("mouseup", g); - }, - m = () => { - this._inputFocused = !0; - }, - p = () => { - (this._inputFocused = !1), - this.updateDisplay(), - this._callOnFinishChange(); - }; - this.$input.addEventListener("input", e), - this.$input.addEventListener("keydown", n), - this.$input.addEventListener("wheel", i, { passive: !1 }), - this.$input.addEventListener("mousedown", d), - this.$input.addEventListener("focus", m), - this.$input.addEventListener("blur", p); - } - _initSlider() { - (this._hasSlider = !0), - (this.$slider = document.createElement("div")), - this.$slider.classList.add("slider"), - (this.$fill = document.createElement("div")), - this.$fill.classList.add("fill"), - this.$slider.appendChild(this.$fill), - this.$widget.insertBefore(this.$slider, this.$input), - this.domElement.classList.add("hasSlider"); - const e = (v, M, x, w, y) => ((v - M) / (x - M)) * (y - w) + w, - t = (v) => { - const M = this.$slider.getBoundingClientRect(); - let x = e(v, M.left, M.right, this._min, this._max); - this._snapClampSetValue(x); - }, - n = (v) => { - this._setDraggingStyle(!0), - t(v.clientX), - window.addEventListener("mousemove", i), - window.addEventListener("mouseup", s); - }, - i = (v) => { - t(v.clientX); - }, - s = () => { - this._callOnFinishChange(), - this._setDraggingStyle(!1), - window.removeEventListener("mousemove", i), - window.removeEventListener("mouseup", s); - }; - let a = !1, - o, - l; - const c = (v) => { - v.preventDefault(), - this._setDraggingStyle(!0), - t(v.touches[0].clientX), - (a = !1); - }, - u = (v) => { - v.touches.length > 1 || - (this._hasScrollBar - ? ((o = v.touches[0].clientX), - (l = v.touches[0].clientY), - (a = !0)) - : c(v), - window.addEventListener("touchmove", h), - window.addEventListener("touchend", d)); - }, - h = (v) => { - if (a) { - const M = v.touches[0].clientX - o, - x = v.touches[0].clientY - l; - Math.abs(M) > Math.abs(x) - ? c(v) - : (window.removeEventListener("touchmove", h), - window.removeEventListener("touchend", d)); - } else v.preventDefault(), t(v.touches[0].clientX); - }, - d = () => { - this._callOnFinishChange(), - this._setDraggingStyle(!1), - window.removeEventListener("touchmove", h), - window.removeEventListener("touchend", d); - }, - f = this._callOnFinishChange.bind(this), - g = 400; - let m; - const p = (v) => { - if (Math.abs(v.deltaX) < Math.abs(v.deltaY) && this._hasScrollBar) - return; - v.preventDefault(); - const x = this._normalizeMouseWheel(v) * this._step; - this._snapClampSetValue(this.getValue() + x), - (this.$input.value = this.getValue()), - clearTimeout(m), - (m = setTimeout(f, g)); - }; - this.$slider.addEventListener("mousedown", n), - this.$slider.addEventListener("touchstart", u, { passive: !1 }), - this.$slider.addEventListener("wheel", p, { passive: !1 }); - } - _setDraggingStyle(e, t = "horizontal") { - this.$slider && this.$slider.classList.toggle("active", e), - document.body.classList.toggle("lil-gui-dragging", e), - document.body.classList.toggle(`lil-gui-${t}`, e); - } - _getImplicitStep() { - return this._hasMin && this._hasMax - ? (this._max - this._min) / 1e3 - : 0.1; - } - _onUpdateMinMax() { - !this._hasSlider && - this._hasMin && - this._hasMax && - (this._stepExplicit || this.step(this._getImplicitStep(), !1), - this._initSlider(), - this.updateDisplay()); - } - _normalizeMouseWheel(e) { - let { deltaX: t, deltaY: n } = e; - return ( - Math.floor(e.deltaY) !== e.deltaY && - e.wheelDelta && - ((t = 0), - (n = -e.wheelDelta / 120), - (n *= this._stepExplicit ? 1 : 10)), - t + -n - ); - } - _arrowKeyMultiplier(e) { - let t = this._stepExplicit ? 1 : 10; - return e.shiftKey ? (t *= 10) : e.altKey && (t /= 10), t; - } - _snap(e) { - const t = Math.round(e / this._step) * this._step; - return parseFloat(t.toPrecision(15)); - } - _clamp(e) { - return ( - e < this._min && (e = this._min), - e > this._max && (e = this._max), - e - ); - } - _snapClampSetValue(e) { - this.setValue(this._clamp(this._snap(e))); - } - get _hasScrollBar() { - const e = this.parent.root.$children; - return e.scrollHeight > e.clientHeight; - } - get _hasMin() { - return this._min !== void 0; - } - get _hasMax() { - return this._max !== void 0; - } - } - class rv extends ln { - constructor(e, t, n, i) { - super(e, t, n, "option"), - (this.$select = document.createElement("select")), - this.$select.setAttribute("aria-labelledby", this.$name.id), - (this.$display = document.createElement("div")), - this.$display.classList.add("display"), - (this._values = Array.isArray(i) ? i : Object.values(i)), - (this._names = Array.isArray(i) ? i : Object.keys(i)), - this._names.forEach((s) => { - const a = document.createElement("option"); - (a.innerHTML = s), this.$select.appendChild(a); - }), - this.$select.addEventListener("change", () => { - this.setValue(this._values[this.$select.selectedIndex]), - this._callOnFinishChange(); - }), - this.$select.addEventListener("focus", () => { - this.$display.classList.add("focus"); - }), - this.$select.addEventListener("blur", () => { - this.$display.classList.remove("focus"); - }), - this.$widget.appendChild(this.$select), - this.$widget.appendChild(this.$display), - (this.$disable = this.$select), - this.updateDisplay(); - } - updateDisplay() { - const e = this.getValue(), - t = this._values.indexOf(e); - return ( - (this.$select.selectedIndex = t), - (this.$display.innerHTML = t === -1 ? e : this._names[t]), - this - ); - } - } - class av extends ln { - constructor(e, t, n) { - super(e, t, n, "string"), - (this.$input = document.createElement("input")), - this.$input.setAttribute("type", "text"), - this.$input.setAttribute("aria-labelledby", this.$name.id), - this.$input.addEventListener("input", () => { - this.setValue(this.$input.value); - }), - this.$input.addEventListener("keydown", (i) => { - i.code === "Enter" && this.$input.blur(); - }), - this.$input.addEventListener("blur", () => { - this._callOnFinishChange(); - }), - this.$widget.appendChild(this.$input), - (this.$disable = this.$input), - this.updateDisplay(); - } - updateDisplay() { - return (this.$input.value = this.getValue()), this; - } - } - const ov = `.lil-gui { - font-family: var(--font-family); - font-size: var(--font-size); - line-height: 1; - font-weight: normal; - font-style: normal; - text-align: left; - background-color: var(--background-color); - color: var(--text-color); - user-select: none; - -webkit-user-select: none; - touch-action: manipulation; - --background-color: #1f1f1f; - --text-color: #ebebeb; - --title-background-color: #111111; - --title-text-color: #ebebeb; - --widget-color: #424242; - --hover-color: #4f4f4f; - --focus-color: #595959; - --number-color: #2cc9ff; - --string-color: #a2db3c; - --font-size: 11px; - --input-font-size: 11px; - --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; - --font-family-mono: Menlo, Monaco, Consolas, "Droid Sans Mono", monospace; - --padding: 4px; - --spacing: 4px; - --widget-height: 20px; - --name-width: 45%; - --slider-knob-width: 2px; - --slider-input-width: 27%; - --color-input-width: 27%; - --slider-input-min-width: 45px; - --color-input-min-width: 45px; - --folder-indent: 7px; - --widget-padding: 0 0 0 3px; - --widget-border-radius: 2px; - --checkbox-size: calc(0.75 * var(--widget-height)); - --scrollbar-width: 5px; -} -.lil-gui, .lil-gui * { - box-sizing: border-box; - margin: 0; - padding: 0; -} -.lil-gui.root { - width: var(--width, 245px); - display: flex; - flex-direction: column; -} -.lil-gui.root > .title { - background: var(--title-background-color); - color: var(--title-text-color); -} -.lil-gui.root > .children { - overflow-x: hidden; - overflow-y: auto; -} -.lil-gui.root > .children::-webkit-scrollbar { - width: var(--scrollbar-width); - height: var(--scrollbar-width); - background: var(--background-color); -} -.lil-gui.root > .children::-webkit-scrollbar-thumb { - border-radius: var(--scrollbar-width); - background: var(--focus-color); -} -@media (pointer: coarse) { - .lil-gui.allow-touch-styles { - --widget-height: 28px; - --padding: 6px; - --spacing: 6px; - --font-size: 13px; - --input-font-size: 16px; - --folder-indent: 10px; - --scrollbar-width: 7px; - --slider-input-min-width: 50px; - --color-input-min-width: 65px; - } -} -.lil-gui.force-touch-styles { - --widget-height: 28px; - --padding: 6px; - --spacing: 6px; - --font-size: 13px; - --input-font-size: 16px; - --folder-indent: 10px; - --scrollbar-width: 7px; - --slider-input-min-width: 50px; - --color-input-min-width: 65px; -} -.lil-gui.autoPlace { - max-height: 100%; - position: fixed; - top: 0; - right: 15px; - z-index: 1001; -} - -.lil-gui .controller { - display: flex; - align-items: center; - padding: 0 var(--padding); - margin: var(--spacing) 0; -} -.lil-gui .controller.disabled { - opacity: 0.5; -} -.lil-gui .controller.disabled, .lil-gui .controller.disabled * { - pointer-events: none !important; -} -.lil-gui .controller > .name { - min-width: var(--name-width); - flex-shrink: 0; - white-space: pre; - padding-right: var(--spacing); - line-height: var(--widget-height); -} -.lil-gui .controller .widget { - position: relative; - display: flex; - align-items: center; - width: 100%; - min-height: var(--widget-height); -} -.lil-gui .controller.string input { - color: var(--string-color); -} -.lil-gui .controller.boolean .widget { - cursor: pointer; -} -.lil-gui .controller.color .display { - width: 100%; - height: var(--widget-height); - border-radius: var(--widget-border-radius); - position: relative; -} -@media (hover: hover) { - .lil-gui .controller.color .display:hover:before { - content: " "; - display: block; - position: absolute; - border-radius: var(--widget-border-radius); - border: 1px solid #fff9; - top: 0; - right: 0; - bottom: 0; - left: 0; - } -} -.lil-gui .controller.color input[type=color] { - opacity: 0; - width: 100%; - height: 100%; - cursor: pointer; -} -.lil-gui .controller.color input[type=text] { - margin-left: var(--spacing); - font-family: var(--font-family-mono); - min-width: var(--color-input-min-width); - width: var(--color-input-width); - flex-shrink: 0; -} -.lil-gui .controller.option select { - opacity: 0; - position: absolute; - width: 100%; - max-width: 100%; -} -.lil-gui .controller.option .display { - position: relative; - pointer-events: none; - border-radius: var(--widget-border-radius); - height: var(--widget-height); - line-height: var(--widget-height); - max-width: 100%; - overflow: hidden; - word-break: break-all; - padding-left: 0.55em; - padding-right: 1.75em; - background: var(--widget-color); -} -@media (hover: hover) { - .lil-gui .controller.option .display.focus { - background: var(--focus-color); - } -} -.lil-gui .controller.option .display.active { - background: var(--focus-color); -} -.lil-gui .controller.option .display:after { - font-family: "lil-gui"; - content: "\u2195"; - position: absolute; - top: 0; - right: 0; - bottom: 0; - padding-right: 0.375em; -} -.lil-gui .controller.option .widget, -.lil-gui .controller.option select { - cursor: pointer; -} -@media (hover: hover) { - .lil-gui .controller.option .widget:hover .display { - background: var(--hover-color); - } -} -.lil-gui .controller.number input { - color: var(--number-color); -} -.lil-gui .controller.number.hasSlider input { - margin-left: var(--spacing); - width: var(--slider-input-width); - min-width: var(--slider-input-min-width); - flex-shrink: 0; -} -.lil-gui .controller.number .slider { - width: 100%; - height: var(--widget-height); - background-color: var(--widget-color); - border-radius: var(--widget-border-radius); - padding-right: var(--slider-knob-width); - overflow: hidden; - cursor: ew-resize; - touch-action: pan-y; -} -@media (hover: hover) { - .lil-gui .controller.number .slider:hover { - background-color: var(--hover-color); - } -} -.lil-gui .controller.number .slider.active { - background-color: var(--focus-color); -} -.lil-gui .controller.number .slider.active .fill { - opacity: 0.95; -} -.lil-gui .controller.number .fill { - height: 100%; - border-right: var(--slider-knob-width) solid var(--number-color); - box-sizing: content-box; -} - -.lil-gui-dragging .lil-gui { - --hover-color: var(--widget-color); -} -.lil-gui-dragging * { - cursor: ew-resize !important; -} - -.lil-gui-dragging.lil-gui-vertical * { - cursor: ns-resize !important; -} - -.lil-gui .title { - --title-height: calc(var(--widget-height) + var(--spacing) * 1.25); - height: var(--title-height); - line-height: calc(var(--title-height) - 4px); - font-weight: 600; - padding: 0 var(--padding); - -webkit-tap-highlight-color: transparent; - cursor: pointer; - outline: none; - text-decoration-skip: objects; -} -.lil-gui .title:before { - font-family: "lil-gui"; - content: "\u25BE"; - padding-right: 2px; - display: inline-block; -} -.lil-gui .title:active { - background: var(--title-background-color); - opacity: 0.75; -} -@media (hover: hover) { - body:not(.lil-gui-dragging) .lil-gui .title:hover { - background: var(--title-background-color); - opacity: 0.85; - } - .lil-gui .title:focus { - text-decoration: underline var(--focus-color); - } -} -.lil-gui.root > .title:focus { - text-decoration: none !important; -} -.lil-gui.closed > .title:before { - content: "\u25B8"; -} -.lil-gui.closed > .children { - transform: translateY(-7px); - opacity: 0; -} -.lil-gui.closed:not(.transition) > .children { - display: none; -} -.lil-gui.transition > .children { - transition-duration: 300ms; - transition-property: height, opacity, transform; - transition-timing-function: cubic-bezier(0.2, 0.6, 0.35, 1); - overflow: hidden; - pointer-events: none; -} -.lil-gui .children:empty:before { - content: "Empty"; - padding: 0 var(--padding); - margin: var(--spacing) 0; - display: block; - height: var(--widget-height); - font-style: italic; - line-height: var(--widget-height); - opacity: 0.5; -} -.lil-gui.root > .children > .lil-gui > .title { - border: 0 solid var(--widget-color); - border-width: 1px 0; - transition: border-color 300ms; -} -.lil-gui.root > .children > .lil-gui.closed > .title { - border-bottom-color: transparent; -} -.lil-gui + .controller { - border-top: 1px solid var(--widget-color); - margin-top: 0; - padding-top: var(--spacing); -} -.lil-gui .lil-gui .lil-gui > .title { - border: none; -} -.lil-gui .lil-gui .lil-gui > .children { - border: none; - margin-left: var(--folder-indent); - border-left: 2px solid var(--widget-color); -} -.lil-gui .lil-gui .controller { - border: none; -} - -.lil-gui input { - -webkit-tap-highlight-color: transparent; - border: 0; - outline: none; - font-family: var(--font-family); - font-size: var(--input-font-size); - border-radius: var(--widget-border-radius); - height: var(--widget-height); - background: var(--widget-color); - color: var(--text-color); - width: 100%; -} -@media (hover: hover) { - .lil-gui input:hover { - background: var(--hover-color); - } - .lil-gui input:active { - background: var(--focus-color); - } -} -.lil-gui input:disabled { - opacity: 1; -} -.lil-gui input[type=text], -.lil-gui input[type=number] { - padding: var(--widget-padding); -} -.lil-gui input[type=text]:focus, -.lil-gui input[type=number]:focus { - background: var(--focus-color); -} -.lil-gui input::-webkit-outer-spin-button, -.lil-gui input::-webkit-inner-spin-button { - -webkit-appearance: none; - margin: 0; -} -.lil-gui input[type=number] { - -moz-appearance: textfield; -} -.lil-gui input[type=checkbox] { - appearance: none; - -webkit-appearance: none; - height: var(--checkbox-size); - width: var(--checkbox-size); - border-radius: var(--widget-border-radius); - text-align: center; - cursor: pointer; -} -.lil-gui input[type=checkbox]:checked:before { - font-family: "lil-gui"; - content: "\u2713"; - font-size: var(--checkbox-size); - line-height: var(--checkbox-size); -} -@media (hover: hover) { - .lil-gui input[type=checkbox]:focus { - box-shadow: inset 0 0 0 1px var(--focus-color); - } -} -.lil-gui button { - -webkit-tap-highlight-color: transparent; - outline: none; - cursor: pointer; - font-family: var(--font-family); - font-size: var(--font-size); - color: var(--text-color); - width: 100%; - height: var(--widget-height); - text-transform: none; - background: var(--widget-color); - border-radius: var(--widget-border-radius); - border: 1px solid var(--widget-color); - text-align: center; - line-height: calc(var(--widget-height) - 4px); -} -@media (hover: hover) { - .lil-gui button:hover { - background: var(--hover-color); - border-color: var(--hover-color); - } - .lil-gui button:focus { - border-color: var(--focus-color); - } -} -.lil-gui button:active { - background: var(--focus-color); -} - -@font-face { - font-family: "lil-gui"; - src: url("data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJmeB9kwPl+0cf5+uGPZXsqPu4nvZabcSZldZ6kfyWnomFY/eScKqZNWupKJO6kXN3K9uCVoL7iInPr1X5baXs3tjuMqCtzEuagm/AAlzQgPAAB4nGNgYRBlnMDAysDAYM/gBiT5oLQBAwuDJAMDEwMrMwNWEJDmmsJwgCFeXZghBcjlZMgFCzOiKOIFAB71Bb8AeJy1kjFuwkAQRZ+DwRAwBtNQRUGKQ8OdKCAWUhAgKLhIuAsVSpWz5Bbkj3dEgYiUIszqWdpZe+Z7/wB1oCYmIoboiwiLT2WjKl/jscrHfGg/pKdMkyklC5Zs2LEfHYpjcRoPzme9MWWmk3dWbK9ObkWkikOetJ554fWyoEsmdSlt+uR0pCJR34b6t/TVg1SY3sYvdf8vuiKrpyaDXDISiegp17p7579Gp3p++y7HPAiY9pmTibljrr85qSidtlg4+l25GLCaS8e6rRxNBmsnERunKbaOObRz7N72ju5vdAjYpBXHgJylOAVsMseDAPEP8LYoUHicY2BiAAEfhiAGJgZWBgZ7RnFRdnVJELCQlBSRlATJMoLV2DK4glSYs6ubq5vbKrJLSbGrgEmovDuDJVhe3VzcXFwNLCOILB/C4IuQ1xTn5FPilBTj5FPmBAB4WwoqAHicY2BkYGAA4sk1sR/j+W2+MnAzpDBgAyEMQUCSg4EJxAEAwUgFHgB4nGNgZGBgSGFggJMhDIwMqEAYAByHATJ4nGNgAIIUNEwmAABl3AGReJxjYAACIQYlBiMGJ3wQAEcQBEV4nGNgZGBgEGZgY2BiAAEQyQWEDAz/wXwGAAsPATIAAHicXdBNSsNAHAXwl35iA0UQXYnMShfS9GPZA7T7LgIu03SSpkwzYTIt1BN4Ak/gKTyAeCxfw39jZkjymzcvAwmAW/wgwHUEGDb36+jQQ3GXGot79L24jxCP4gHzF/EIr4jEIe7wxhOC3g2TMYy4Q7+Lu/SHuEd/ivt4wJd4wPxbPEKMX3GI5+DJFGaSn4qNzk8mcbKSR6xdXdhSzaOZJGtdapd4vVPbi6rP+cL7TGXOHtXKll4bY1Xl7EGnPtp7Xy2n00zyKLVHfkHBa4IcJ2oD3cgggWvt/V/FbDrUlEUJhTn/0azVWbNTNr0Ens8de1tceK9xZmfB1CPjOmPH4kitmvOubcNpmVTN3oFJyjzCvnmrwhJTzqzVj9jiSX911FjeAAB4nG3HMRKCMBBA0f0giiKi4DU8k0V2GWbIZDOh4PoWWvq6J5V8If9NVNQcaDhyouXMhY4rPTcG7jwYmXhKq8Wz+p762aNaeYXom2n3m2dLTVgsrCgFJ7OTmIkYbwIbC6vIB7WmFfAAAA==") format("woff"); -}`; - function lv(r) { - const e = document.createElement("style"); - e.innerHTML = r; - const t = document.querySelector( - "head link[rel=stylesheet], head style" - ); - t ? document.head.insertBefore(e, t) : document.head.appendChild(e); - } - let oc = !1; - class go { - constructor({ - parent: e, - autoPlace: t = e === void 0, - container: n, - width: i, - title: s = "Controls", - injectStyles: a = !0, - touchStyles: o = !0, - } = {}) { - if ( - ((this.parent = e), - (this.root = e ? e.root : this), - (this.children = []), - (this.controllers = []), - (this.folders = []), - (this._closed = !1), - (this._hidden = !1), - (this.domElement = document.createElement("div")), - this.domElement.classList.add("lil-gui"), - (this.$title = document.createElement("div")), - this.$title.classList.add("title"), - this.$title.setAttribute("role", "button"), - this.$title.setAttribute("aria-expanded", !0), - this.$title.setAttribute("tabindex", 0), - this.$title.addEventListener("click", () => - this.openAnimated(this._closed) - ), - this.$title.addEventListener("keydown", (l) => { - (l.code === "Enter" || l.code === "Space") && - (l.preventDefault(), this.$title.click()); - }), - this.$title.addEventListener("touchstart", () => {}, { - passive: !0, - }), - (this.$children = document.createElement("div")), - this.$children.classList.add("children"), - this.domElement.appendChild(this.$title), - this.domElement.appendChild(this.$children), - this.title(s), - o && this.domElement.classList.add("allow-touch-styles"), - this.parent) - ) { - this.parent.children.push(this), - this.parent.folders.push(this), - this.parent.$children.appendChild(this.domElement); - return; - } - this.domElement.classList.add("root"), - !oc && a && (lv(ov), (oc = !0)), - n - ? n.appendChild(this.domElement) - : t && - (this.domElement.classList.add("autoPlace"), - document.body.appendChild(this.domElement)), - i && this.domElement.style.setProperty("--width", i + "px"), - this.domElement.addEventListener("keydown", (l) => - l.stopPropagation() - ), - this.domElement.addEventListener("keyup", (l) => - l.stopPropagation() - ); - } - add(e, t, n, i, s) { - if (Object(n) === n) return new rv(this, e, t, n); - const a = e[t]; - switch (typeof a) { - case "number": - return new sv(this, e, t, n, i, s); - case "boolean": - return new Z0(this, e, t); - case "string": - return new av(this, e, t); - case "function": - return new Aa(this, e, t); - } - console.error( - `gui.add failed - property:`, - t, - ` - object:`, - e, - ` - value:`, - a - ); - } - addColor(e, t, n = 1) { - return new iv(this, e, t, n); - } - addFolder(e) { - return new go({ parent: this, title: e }); - } - load(e, t = !0) { - return ( - e.controllers && - this.controllers.forEach((n) => { - n instanceof Aa || - (n._name in e.controllers && n.load(e.controllers[n._name])); - }), - t && - e.folders && - this.folders.forEach((n) => { - n._title in e.folders && n.load(e.folders[n._title]); - }), - this - ); - } - save(e = !0) { - const t = { controllers: {}, folders: {} }; - return ( - this.controllers.forEach((n) => { - if (!(n instanceof Aa)) { - if (n._name in t.controllers) - throw new Error( - `Cannot save GUI with duplicate property "${n._name}"` - ); - t.controllers[n._name] = n.save(); - } - }), - e && - this.folders.forEach((n) => { - if (n._title in t.folders) - throw new Error( - `Cannot save GUI with duplicate folder "${n._title}"` - ); - t.folders[n._title] = n.save(); - }), - t - ); - } - open(e = !0) { - return ( - (this._closed = !e), - this.$title.setAttribute("aria-expanded", !this._closed), - this.domElement.classList.toggle("closed", this._closed), - this - ); - } - close() { - return this.open(!1); - } - show(e = !0) { - return ( - (this._hidden = !e), - (this.domElement.style.display = this._hidden ? "none" : ""), - this - ); - } - hide() { - return this.show(!1); - } - openAnimated(e = !0) { - return ( - (this._closed = !e), - this.$title.setAttribute("aria-expanded", !this._closed), - requestAnimationFrame(() => { - const t = this.$children.clientHeight; - (this.$children.style.height = t + "px"), - this.domElement.classList.add("transition"); - const n = (s) => { - s.target === this.$children && - ((this.$children.style.height = ""), - this.domElement.classList.remove("transition"), - this.$children.removeEventListener("transitionend", n)); - }; - this.$children.addEventListener("transitionend", n); - const i = e ? this.$children.scrollHeight : 0; - this.domElement.classList.toggle("closed", !e), - requestAnimationFrame(() => { - this.$children.style.height = i + "px"; - }); - }), - this - ); - } - title(e) { - return (this._title = e), (this.$title.innerHTML = e), this; - } - reset(e = !0) { - return ( - (e ? this.controllersRecursive() : this.controllers).forEach((n) => - n.reset() - ), - this - ); - } - onChange(e) { - return (this._onChange = e), this; - } - _callOnChange(e) { - this.parent && this.parent._callOnChange(e), - this._onChange !== void 0 && - this._onChange.call(this, { - object: e.object, - property: e.property, - value: e.getValue(), - controller: e, - }); - } - onFinishChange(e) { - return (this._onFinishChange = e), this; - } - _callOnFinishChange(e) { - this.parent && this.parent._callOnFinishChange(e), - this._onFinishChange !== void 0 && - this._onFinishChange.call(this, { - object: e.object, - property: e.property, - value: e.getValue(), - controller: e, - }); - } - destroy() { - this.parent && - (this.parent.children.splice(this.parent.children.indexOf(this), 1), - this.parent.folders.splice(this.parent.folders.indexOf(this), 1)), - this.domElement.parentElement && - this.domElement.parentElement.removeChild(this.domElement), - Array.from(this.children).forEach((e) => e.destroy()); - } - controllersRecursive() { - let e = Array.from(this.controllers); - return ( - this.folders.forEach((t) => { - e = e.concat(t.controllersRecursive()); - }), - e - ); - } - foldersRecursive() { - let e = Array.from(this.folders); - return ( - this.folders.forEach((t) => { - e = e.concat(t.foldersRecursive()); - }), - e - ); - } - } - class cv { - constructor() { - this.instance = new go({ width: 320, title: "debug" }); - const e = window.document.styleSheets[0]; - e.insertRule( - ` - .lil-gui .lil-gui > .children - { - border: none; - margin-left: var(--folder-indent); - border-left: 2px solid var(--widget-color); - } - `, - e.cssRules.length - ), - e.insertRule( - ` - .lil-gui.root > .children > .lil-gui > .title - { - border-width: 1px 0 0 0; - } - `, - e.cssRules.length - ), - (this.tree = {}), - (this.tree.folder = this.instance), - (this.tree.children = {}); - } - getFolder(e) { - const t = e.split("/"); - let n = this.tree; - for (const i of t) { - let s = n.children[i]; - s || - ((s = {}), - (s.folder = n.folder.addFolder(i)), - s.folder.close(), - (s.children = {})), - (n.children[i] = s), - (n = s); - } - return n.folder; - } - } - var hv = - typeof globalThis != "undefined" - ? globalThis - : typeof window != "undefined" - ? window - : typeof global != "undefined" - ? global - : typeof self != "undefined" - ? self - : {}, - gh = { exports: {} }; - (function (r, e) { - (function (t, n) { - r.exports = n(); - })(hv, function () { - var t = function () { - function n(f) { - return a.appendChild(f.dom), f; - } - function i(f) { - for (var g = 0; g < a.children.length; g++) - a.children[g].style.display = g === f ? "block" : "none"; - s = f; - } - var s = 0, - a = document.createElement("div"); - (a.style.cssText = - "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000"), - a.addEventListener( - "click", - function (f) { - f.preventDefault(), i(++s % a.children.length); - }, - !1 - ); - var o = (performance || Date).now(), - l = o, - c = 0, - u = n(new t.Panel("FPS", "#0ff", "#002")), - h = n(new t.Panel("MS", "#0f0", "#020")); - if (self.performance && self.performance.memory) - var d = n(new t.Panel("MB", "#f08", "#201")); - return ( - i(0), - { - REVISION: 16, - dom: a, - addPanel: n, - showPanel: i, - begin: function () { - o = (performance || Date).now(); - }, - end: function () { - c++; - var f = (performance || Date).now(); - if ( - (h.update(f - o, 200), - f > l + 1e3 && - (u.update((1e3 * c) / (f - l), 100), (l = f), (c = 0), d)) - ) { - var g = performance.memory; - d.update( - g.usedJSHeapSize / 1048576, - g.jsHeapSizeLimit / 1048576 - ); - } - return f; - }, - update: function () { - o = this.end(); - }, - domElement: a, - setMode: i, - } - ); - }; - return ( - (t.Panel = function (n, i, s) { - var a = 1 / 0, - o = 0, - l = Math.round, - c = l(window.devicePixelRatio || 1), - u = 80 * c, - h = 48 * c, - d = 3 * c, - f = 2 * c, - g = 3 * c, - m = 15 * c, - p = 74 * c, - v = 30 * c, - M = document.createElement("canvas"); - (M.width = u), - (M.height = h), - (M.style.cssText = "width:80px;height:48px"); - var x = M.getContext("2d"); - return ( - (x.font = "bold " + 9 * c + "px Helvetica,Arial,sans-serif"), - (x.textBaseline = "top"), - (x.fillStyle = s), - x.fillRect(0, 0, u, h), - (x.fillStyle = i), - x.fillText(n, d, f), - x.fillRect(g, m, p, v), - (x.fillStyle = s), - (x.globalAlpha = 0.9), - x.fillRect(g, m, p, v), - { - dom: M, - update: function (w, y) { - (a = Math.min(a, w)), - (o = Math.max(o, w)), - (x.fillStyle = s), - (x.globalAlpha = 1), - x.fillRect(0, 0, u, m), - (x.fillStyle = i), - x.fillText( - l(w) + " " + n + " (" + l(a) + "-" + l(o) + ")", - d, - f - ), - x.drawImage(M, g + c, m, p - c, v, g, m, p - c, v), - x.fillRect(g + p - c, m, c, v), - (x.fillStyle = s), - (x.globalAlpha = 0.9), - x.fillRect(g + p - c, m, c, l((1 - w / y) * v)); - }, - } - ); - }), - t - ); - }); - })(gh); - var lc = gh.exports; - class uv { - constructor() { - (this.instance = new lc()), - this.instance.showPanel(3), - (this.active = !1), - (this.max = 120), - (this.ignoreMaxed = !0), - this.activate(); - } - activate() { - (this.active = !0), document.body.appendChild(this.instance.dom); - } - deactivate() { - (this.active = !1), document.body.removeChild(this.instance.dom); - } - setRenderPanel(e) { - (this.render = {}), - (this.render.context = e), - (this.render.extension = this.render.context.getExtension( - "EXT_disjoint_timer_query_webgl2" - )), - (this.render.panel = this.instance.addPanel( - new lc.Panel("Render (ms)", "#f8f", "#212") - )), - (!( - typeof WebGL2RenderingContext != "undefined" && - e instanceof WebGL2RenderingContext - ) || - !this.render.extension) && - this.deactivate(); - } - beforeRender() { - if (!this.active) return; - this.queryCreated = !1; - let e = !1; - if (this.render.query) { - e = this.render.context.getQueryParameter( - this.render.query, - this.render.context.QUERY_RESULT_AVAILABLE - ); - const t = this.render.context.getParameter( - this.render.extension.GPU_DISJOINT_EXT - ); - if (e && !t) { - const n = this.render.context.getQueryParameter( - this.render.query, - this.render.context.QUERY_RESULT - ), - i = Math.min(n / 1e3 / 1e3, this.max); - (i === this.max && this.ignoreMaxed) || - this.render.panel.update(i, this.max); - } - } - (e || !this.render.query) && - ((this.queryCreated = !0), - (this.render.query = this.render.context.createQuery()), - this.render.context.beginQuery( - this.render.extension.TIME_ELAPSED_EXT, - this.render.query - )); - } - afterRender() { - !this.active || - (this.queryCreated && - this.render.context.endQuery( - this.render.extension.TIME_ELAPSED_EXT - )); - } - update() { - !this.active || this.instance.update(); - } - destroy() { - this.deactivate(); - } - } - class dv { - constructor() { - (this.active = window.location.hash === "#debug"), - this.active && ((this.ui = new cv()), (this.stats = new uv())); - } - update() { - !this.active || this.stats.update(); - } - } - class fv extends qn { - constructor(e) { - super(e), - (this.dracoLoader = null), - (this.ktx2Loader = null), - (this.meshoptDecoder = null), - (this.pluginCallbacks = []), - this.register(function (t) { - return new _v(t); - }), - this.register(function (t) { - return new Tv(t); - }), - this.register(function (t) { - return new Ev(t); - }), - this.register(function (t) { - return new yv(t); - }), - this.register(function (t) { - return new Mv(t); - }), - this.register(function (t) { - return new wv(t); - }), - this.register(function (t) { - return new bv(t); - }), - this.register(function (t) { - return new vv(t); - }), - this.register(function (t) { - return new Sv(t); - }), - this.register(function (t) { - return new xv(t); - }), - this.register(function (t) { - return new mv(t); - }), - this.register(function (t) { - return new Av(t); - }); - } - load(e, t, n, i) { - const s = this; - let a; - this.resourcePath !== "" - ? (a = this.resourcePath) - : this.path !== "" - ? (a = this.path) - : (a = on.extractUrlBase(e)), - this.manager.itemStart(e); - const o = function (c) { - i ? i(c) : console.error(c), - s.manager.itemError(e), - s.manager.itemEnd(e); - }, - l = new qi(this.manager); - l.setPath(this.path), - l.setResponseType("arraybuffer"), - l.setRequestHeader(this.requestHeader), - l.setWithCredentials(this.withCredentials), - l.load( - e, - function (c) { - try { - s.parse( - c, - a, - function (u) { - t(u), s.manager.itemEnd(e); - }, - o - ); - } catch (u) { - o(u); - } - }, - n, - o - ); - } - setDRACOLoader(e) { - return (this.dracoLoader = e), this; - } - setDDSLoader() { - throw new Error( - 'THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".' - ); - } - setKTX2Loader(e) { - return (this.ktx2Loader = e), this; - } - setMeshoptDecoder(e) { - return (this.meshoptDecoder = e), this; - } - register(e) { - return ( - this.pluginCallbacks.indexOf(e) === -1 && - this.pluginCallbacks.push(e), - this - ); - } - unregister(e) { - return ( - this.pluginCallbacks.indexOf(e) !== -1 && - this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e), 1), - this - ); - } - parse(e, t, n, i) { - let s; - const a = {}, - o = {}; - if (typeof e == "string") s = e; - else if (on.decodeText(new Uint8Array(e, 0, 4)) === vh) { - try { - a[Le.KHR_BINARY_GLTF] = new Cv(e); - } catch (h) { - i && i(h); - return; - } - s = a[Le.KHR_BINARY_GLTF].content; - } else s = on.decodeText(new Uint8Array(e)); - const l = JSON.parse(s); - if (l.asset === void 0 || l.asset.version[0] < 2) { - i && - i( - new Error( - "THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported." - ) - ); - return; - } - const c = new Vv(l, { - path: t || this.resourcePath || "", - crossOrigin: this.crossOrigin, - requestHeader: this.requestHeader, - manager: this.manager, - ktx2Loader: this.ktx2Loader, - meshoptDecoder: this.meshoptDecoder, - }); - c.fileLoader.setRequestHeader(this.requestHeader); - for (let u = 0; u < this.pluginCallbacks.length; u++) { - const h = this.pluginCallbacks[u](c); - (o[h.name] = h), (a[h.name] = !0); - } - if (l.extensionsUsed) - for (let u = 0; u < l.extensionsUsed.length; ++u) { - const h = l.extensionsUsed[u], - d = l.extensionsRequired || []; - switch (h) { - case Le.KHR_MATERIALS_UNLIT: - a[h] = new gv(); - break; - case Le.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: - a[h] = new Pv(); - break; - case Le.KHR_DRACO_MESH_COMPRESSION: - a[h] = new Lv(l, this.dracoLoader); - break; - case Le.KHR_TEXTURE_TRANSFORM: - a[h] = new Rv(); - break; - case Le.KHR_MESH_QUANTIZATION: - a[h] = new Dv(); - break; - default: - d.indexOf(h) >= 0 && - o[h] === void 0 && - console.warn( - 'THREE.GLTFLoader: Unknown extension "' + h + '".' - ); - } - } - c.setExtensions(a), c.setPlugins(o), c.parse(n, i); - } - parseAsync(e, t) { - const n = this; - return new Promise(function (i, s) { - n.parse(e, t, i, s); - }); - } - } - function pv() { - let r = {}; - return { - get: function (e) { - return r[e]; - }, - add: function (e, t) { - r[e] = t; - }, - remove: function (e) { - delete r[e]; - }, - removeAll: function () { - r = {}; - }, - }; - } - const Le = { - KHR_BINARY_GLTF: "KHR_binary_glTF", - KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression", - KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual", - KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat", - KHR_MATERIALS_IOR: "KHR_materials_ior", - KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: - "KHR_materials_pbrSpecularGlossiness", - KHR_MATERIALS_SHEEN: "KHR_materials_sheen", - KHR_MATERIALS_SPECULAR: "KHR_materials_specular", - KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission", - KHR_MATERIALS_IRIDESCENCE: "KHR_materials_iridescence", - KHR_MATERIALS_UNLIT: "KHR_materials_unlit", - KHR_MATERIALS_VOLUME: "KHR_materials_volume", - KHR_TEXTURE_BASISU: "KHR_texture_basisu", - KHR_TEXTURE_TRANSFORM: "KHR_texture_transform", - KHR_MESH_QUANTIZATION: "KHR_mesh_quantization", - KHR_MATERIALS_EMISSIVE_STRENGTH: "KHR_materials_emissive_strength", - EXT_TEXTURE_WEBP: "EXT_texture_webp", - EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression", - }; - class mv { - constructor(e) { - (this.parser = e), - (this.name = Le.KHR_LIGHTS_PUNCTUAL), - (this.cache = { refs: {}, uses: {} }); - } - _markDefs() { - const e = this.parser, - t = this.parser.json.nodes || []; - for (let n = 0, i = t.length; n < i; n++) { - const s = t[n]; - s.extensions && - s.extensions[this.name] && - s.extensions[this.name].light !== void 0 && - e._addNodeRef(this.cache, s.extensions[this.name].light); - } - } - _loadLight(e) { - const t = this.parser, - n = "light:" + e; - let i = t.cache.get(n); - if (i) return i; - const s = t.json, - l = (((s.extensions && s.extensions[this.name]) || {}).lights || - [])[e]; - let c; - const u = new de(16777215); - l.color !== void 0 && u.fromArray(l.color); - const h = l.range !== void 0 ? l.range : 0; - switch (l.type) { - case "directional": - (c = new fh(u)), c.target.position.set(0, 0, -1), c.add(c.target); - break; - case "point": - (c = new Ha(u)), (c.distance = h); - break; - case "spot": - (c = new dh(u)), - (c.distance = h), - (l.spot = l.spot || {}), - (l.spot.innerConeAngle = - l.spot.innerConeAngle !== void 0 ? l.spot.innerConeAngle : 0), - (l.spot.outerConeAngle = - l.spot.outerConeAngle !== void 0 - ? l.spot.outerConeAngle - : Math.PI / 4), - (c.angle = l.spot.outerConeAngle), - (c.penumbra = - 1 - l.spot.innerConeAngle / l.spot.outerConeAngle), - c.target.position.set(0, 0, -1), - c.add(c.target); - break; - default: - throw new Error( - "THREE.GLTFLoader: Unexpected light type: " + l.type - ); - } - return ( - c.position.set(0, 0, 0), - (c.decay = 2), - l.intensity !== void 0 && (c.intensity = l.intensity), - (c.name = t.createUniqueName(l.name || "light_" + e)), - (i = Promise.resolve(c)), - t.cache.add(n, i), - i - ); - } - createNodeAttachment(e) { - const t = this, - n = this.parser, - s = n.json.nodes[e], - o = ((s.extensions && s.extensions[this.name]) || {}).light; - return o === void 0 - ? null - : this._loadLight(o).then(function (l) { - return n._getNodeRef(t.cache, o, l); - }); - } - } - class gv { - constructor() { - this.name = Le.KHR_MATERIALS_UNLIT; - } - getMaterialType() { - return wn; - } - extendParams(e, t, n) { - const i = []; - (e.color = new de(1, 1, 1)), (e.opacity = 1); - const s = t.pbrMetallicRoughness; - if (s) { - if (Array.isArray(s.baseColorFactor)) { - const a = s.baseColorFactor; - e.color.fromArray(a), (e.opacity = a[3]); - } - s.baseColorTexture !== void 0 && - i.push(n.assignTexture(e, "map", s.baseColorTexture, Pe)); - } - return Promise.all(i); - } - } - class vv { - constructor(e) { - (this.parser = e), (this.name = Le.KHR_MATERIALS_EMISSIVE_STRENGTH); - } - extendMaterialParams(e, t) { - const i = this.parser.json.materials[e]; - if (!i.extensions || !i.extensions[this.name]) - return Promise.resolve(); - const s = i.extensions[this.name].emissiveStrength; - return s !== void 0 && (t.emissiveIntensity = s), Promise.resolve(); - } - } - class _v { - constructor(e) { - (this.parser = e), (this.name = Le.KHR_MATERIALS_CLEARCOAT); - } - getMaterialType(e) { - const n = this.parser.json.materials[e]; - return !n.extensions || !n.extensions[this.name] ? null : Xn; - } - extendMaterialParams(e, t) { - const n = this.parser, - i = n.json.materials[e]; - if (!i.extensions || !i.extensions[this.name]) - return Promise.resolve(); - const s = [], - a = i.extensions[this.name]; - if ( - (a.clearcoatFactor !== void 0 && (t.clearcoat = a.clearcoatFactor), - a.clearcoatTexture !== void 0 && - s.push(n.assignTexture(t, "clearcoatMap", a.clearcoatTexture)), - a.clearcoatRoughnessFactor !== void 0 && - (t.clearcoatRoughness = a.clearcoatRoughnessFactor), - a.clearcoatRoughnessTexture !== void 0 && - s.push( - n.assignTexture( - t, - "clearcoatRoughnessMap", - a.clearcoatRoughnessTexture - ) - ), - a.clearcoatNormalTexture !== void 0 && - (s.push( - n.assignTexture( - t, - "clearcoatNormalMap", - a.clearcoatNormalTexture - ) - ), - a.clearcoatNormalTexture.scale !== void 0)) - ) { - const o = a.clearcoatNormalTexture.scale; - t.clearcoatNormalScale = new ve(o, o); - } - return Promise.all(s); - } - } - class xv { - constructor(e) { - (this.parser = e), (this.name = Le.KHR_MATERIALS_IRIDESCENCE); - } - getMaterialType(e) { - const n = this.parser.json.materials[e]; - return !n.extensions || !n.extensions[this.name] ? null : Xn; - } - extendMaterialParams(e, t) { - const n = this.parser, - i = n.json.materials[e]; - if (!i.extensions || !i.extensions[this.name]) - return Promise.resolve(); - const s = [], - a = i.extensions[this.name]; - return ( - a.iridescenceFactor !== void 0 && - (t.iridescence = a.iridescenceFactor), - a.iridescenceTexture !== void 0 && - s.push( - n.assignTexture(t, "iridescenceMap", a.iridescenceTexture) - ), - a.iridescenceIor !== void 0 && - (t.iridescenceIOR = a.iridescenceIor), - t.iridescenceThicknessRange === void 0 && - (t.iridescenceThicknessRange = [100, 400]), - a.iridescenceThicknessMinimum !== void 0 && - (t.iridescenceThicknessRange[0] = a.iridescenceThicknessMinimum), - a.iridescenceThicknessMaximum !== void 0 && - (t.iridescenceThicknessRange[1] = a.iridescenceThicknessMaximum), - a.iridescenceThicknessTexture !== void 0 && - s.push( - n.assignTexture( - t, - "iridescenceThicknessMap", - a.iridescenceThicknessTexture - ) - ), - Promise.all(s) - ); - } - } - class yv { - constructor(e) { - (this.parser = e), (this.name = Le.KHR_MATERIALS_SHEEN); - } - getMaterialType(e) { - const n = this.parser.json.materials[e]; - return !n.extensions || !n.extensions[this.name] ? null : Xn; - } - extendMaterialParams(e, t) { - const n = this.parser, - i = n.json.materials[e]; - if (!i.extensions || !i.extensions[this.name]) - return Promise.resolve(); - const s = []; - (t.sheenColor = new de(0, 0, 0)), - (t.sheenRoughness = 0), - (t.sheen = 1); - const a = i.extensions[this.name]; - return ( - a.sheenColorFactor !== void 0 && - t.sheenColor.fromArray(a.sheenColorFactor), - a.sheenRoughnessFactor !== void 0 && - (t.sheenRoughness = a.sheenRoughnessFactor), - a.sheenColorTexture !== void 0 && - s.push( - n.assignTexture(t, "sheenColorMap", a.sheenColorTexture, Pe) - ), - a.sheenRoughnessTexture !== void 0 && - s.push( - n.assignTexture(t, "sheenRoughnessMap", a.sheenRoughnessTexture) - ), - Promise.all(s) - ); - } - } - class Mv { - constructor(e) { - (this.parser = e), (this.name = Le.KHR_MATERIALS_TRANSMISSION); - } - getMaterialType(e) { - const n = this.parser.json.materials[e]; - return !n.extensions || !n.extensions[this.name] ? null : Xn; - } - extendMaterialParams(e, t) { - const n = this.parser, - i = n.json.materials[e]; - if (!i.extensions || !i.extensions[this.name]) - return Promise.resolve(); - const s = [], - a = i.extensions[this.name]; - return ( - a.transmissionFactor !== void 0 && - (t.transmission = a.transmissionFactor), - a.transmissionTexture !== void 0 && - s.push( - n.assignTexture(t, "transmissionMap", a.transmissionTexture) - ), - Promise.all(s) - ); - } - } - class wv { - constructor(e) { - (this.parser = e), (this.name = Le.KHR_MATERIALS_VOLUME); - } - getMaterialType(e) { - const n = this.parser.json.materials[e]; - return !n.extensions || !n.extensions[this.name] ? null : Xn; - } - extendMaterialParams(e, t) { - const n = this.parser, - i = n.json.materials[e]; - if (!i.extensions || !i.extensions[this.name]) - return Promise.resolve(); - const s = [], - a = i.extensions[this.name]; - (t.thickness = a.thicknessFactor !== void 0 ? a.thicknessFactor : 0), - a.thicknessTexture !== void 0 && - s.push(n.assignTexture(t, "thicknessMap", a.thicknessTexture)), - (t.attenuationDistance = a.attenuationDistance || 0); - const o = a.attenuationColor || [1, 1, 1]; - return ( - (t.attenuationColor = new de(o[0], o[1], o[2])), Promise.all(s) - ); - } - } - class bv { - constructor(e) { - (this.parser = e), (this.name = Le.KHR_MATERIALS_IOR); - } - getMaterialType(e) { - const n = this.parser.json.materials[e]; - return !n.extensions || !n.extensions[this.name] ? null : Xn; - } - extendMaterialParams(e, t) { - const i = this.parser.json.materials[e]; - if (!i.extensions || !i.extensions[this.name]) - return Promise.resolve(); - const s = i.extensions[this.name]; - return (t.ior = s.ior !== void 0 ? s.ior : 1.5), Promise.resolve(); - } - } - class Sv { - constructor(e) { - (this.parser = e), (this.name = Le.KHR_MATERIALS_SPECULAR); - } - getMaterialType(e) { - const n = this.parser.json.materials[e]; - return !n.extensions || !n.extensions[this.name] ? null : Xn; - } - extendMaterialParams(e, t) { - const n = this.parser, - i = n.json.materials[e]; - if (!i.extensions || !i.extensions[this.name]) - return Promise.resolve(); - const s = [], - a = i.extensions[this.name]; - (t.specularIntensity = - a.specularFactor !== void 0 ? a.specularFactor : 1), - a.specularTexture !== void 0 && - s.push( - n.assignTexture(t, "specularIntensityMap", a.specularTexture) - ); - const o = a.specularColorFactor || [1, 1, 1]; - return ( - (t.specularColor = new de(o[0], o[1], o[2])), - a.specularColorTexture !== void 0 && - s.push( - n.assignTexture( - t, - "specularColorMap", - a.specularColorTexture, - Pe - ) - ), - Promise.all(s) - ); - } - } - class Tv { - constructor(e) { - (this.parser = e), (this.name = Le.KHR_TEXTURE_BASISU); - } - loadTexture(e) { - const t = this.parser, - n = t.json, - i = n.textures[e]; - if (!i.extensions || !i.extensions[this.name]) return null; - const s = i.extensions[this.name], - a = t.options.ktx2Loader; - if (!a) { - if ( - n.extensionsRequired && - n.extensionsRequired.indexOf(this.name) >= 0 - ) - throw new Error( - "THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures" - ); - return null; - } - return t.loadTextureImage(e, s.source, a); - } - } - class Ev { - constructor(e) { - (this.parser = e), - (this.name = Le.EXT_TEXTURE_WEBP), - (this.isSupported = null); - } - loadTexture(e) { - const t = this.name, - n = this.parser, - i = n.json, - s = i.textures[e]; - if (!s.extensions || !s.extensions[t]) return null; - const a = s.extensions[t], - o = i.images[a.source]; - let l = n.textureLoader; - if (o.uri) { - const c = n.options.manager.getHandler(o.uri); - c !== null && (l = c); - } - return this.detectSupport().then(function (c) { - if (c) return n.loadTextureImage(e, a.source, l); - if (i.extensionsRequired && i.extensionsRequired.indexOf(t) >= 0) - throw new Error( - "THREE.GLTFLoader: WebP required by asset but unsupported." - ); - return n.loadTexture(e); - }); - } - detectSupport() { - return ( - this.isSupported || - (this.isSupported = new Promise(function (e) { - const t = new Image(); - (t.src = - "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"), - (t.onload = t.onerror = - function () { - e(t.height === 1); - }); - })), - this.isSupported - ); - } - } - class Av { - constructor(e) { - (this.name = Le.EXT_MESHOPT_COMPRESSION), (this.parser = e); - } - loadBufferView(e) { - const t = this.parser.json, - n = t.bufferViews[e]; - if (n.extensions && n.extensions[this.name]) { - const i = n.extensions[this.name], - s = this.parser.getDependency("buffer", i.buffer), - a = this.parser.options.meshoptDecoder; - if (!a || !a.supported) { - if ( - t.extensionsRequired && - t.extensionsRequired.indexOf(this.name) >= 0 - ) - throw new Error( - "THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files" - ); - return null; - } - return Promise.all([s, a.ready]).then(function (o) { - const l = i.byteOffset || 0, - c = i.byteLength || 0, - u = i.count, - h = i.byteStride, - d = new ArrayBuffer(u * h), - f = new Uint8Array(o[0], l, c); - return ( - a.decodeGltfBuffer( - new Uint8Array(d), - u, - h, - f, - i.mode, - i.filter - ), - d - ); - }); - } else return null; - } - } - const vh = "glTF", - gs = 12, - cc = { JSON: 1313821514, BIN: 5130562 }; - class Cv { - constructor(e) { - (this.name = Le.KHR_BINARY_GLTF), - (this.content = null), - (this.body = null); - const t = new DataView(e, 0, gs); - if ( - ((this.header = { - magic: on.decodeText(new Uint8Array(e.slice(0, 4))), - version: t.getUint32(4, !0), - length: t.getUint32(8, !0), - }), - this.header.magic !== vh) - ) - throw new Error( - "THREE.GLTFLoader: Unsupported glTF-Binary header." - ); - if (this.header.version < 2) - throw new Error("THREE.GLTFLoader: Legacy binary file detected."); - const n = this.header.length - gs, - i = new DataView(e, gs); - let s = 0; - for (; s < n; ) { - const a = i.getUint32(s, !0); - s += 4; - const o = i.getUint32(s, !0); - if (((s += 4), o === cc.JSON)) { - const l = new Uint8Array(e, gs + s, a); - this.content = on.decodeText(l); - } else if (o === cc.BIN) { - const l = gs + s; - this.body = e.slice(l, l + a); - } - s += a; - } - if (this.content === null) - throw new Error("THREE.GLTFLoader: JSON content not found."); - } - } - class Lv { - constructor(e, t) { - if (!t) - throw new Error( - "THREE.GLTFLoader: No DRACOLoader instance provided." - ); - (this.name = Le.KHR_DRACO_MESH_COMPRESSION), - (this.json = e), - (this.dracoLoader = t), - this.dracoLoader.preload(); - } - decodePrimitive(e, t) { - const n = this.json, - i = this.dracoLoader, - s = e.extensions[this.name].bufferView, - a = e.extensions[this.name].attributes, - o = {}, - l = {}, - c = {}; - for (const u in a) { - const h = Xa[u] || u.toLowerCase(); - o[h] = a[u]; - } - for (const u in e.attributes) { - const h = Xa[u] || u.toLowerCase(); - if (a[u] !== void 0) { - const d = n.accessors[e.attributes[u]], - f = Rs[d.componentType]; - (c[h] = f), (l[h] = d.normalized === !0); - } - } - return t.getDependency("bufferView", s).then(function (u) { - return new Promise(function (h) { - i.decodeDracoFile( - u, - function (d) { - for (const f in d.attributes) { - const g = d.attributes[f], - m = l[f]; - m !== void 0 && (g.normalized = m); - } - h(d); - }, - o, - c - ); - }); - }); - } - } - class Rv { - constructor() { - this.name = Le.KHR_TEXTURE_TRANSFORM; - } - extendTexture(e, t) { - return ( - t.texCoord !== void 0 && - console.warn( - 'THREE.GLTFLoader: Custom UV sets in "' + - this.name + - '" extension not yet supported.' - ), - (t.offset === void 0 && - t.rotation === void 0 && - t.scale === void 0) || - ((e = e.clone()), - t.offset !== void 0 && e.offset.fromArray(t.offset), - t.rotation !== void 0 && (e.rotation = t.rotation), - t.scale !== void 0 && e.repeat.fromArray(t.scale), - (e.needsUpdate = !0)), - e - ); - } - } - class ja extends ks { - constructor(e) { - super(), (this.isGLTFSpecularGlossinessMaterial = !0); - const t = [ - "#ifdef USE_SPECULARMAP", - " uniform sampler2D specularMap;", - "#endif", - ].join(` -`), - n = [ - "#ifdef USE_GLOSSINESSMAP", - " uniform sampler2D glossinessMap;", - "#endif", - ].join(` -`), - i = [ - "vec3 specularFactor = specular;", - "#ifdef USE_SPECULARMAP", - " vec4 texelSpecular = texture2D( specularMap, vUv );", - " // reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture", - " specularFactor *= texelSpecular.rgb;", - "#endif", - ].join(` -`), - s = [ - "float glossinessFactor = glossiness;", - "#ifdef USE_GLOSSINESSMAP", - " vec4 texelGlossiness = texture2D( glossinessMap, vUv );", - " // reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture", - " glossinessFactor *= texelGlossiness.a;", - "#endif", - ].join(` -`), - a = [ - "PhysicalMaterial material;", - "material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );", - "vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );", - "float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );", - "material.roughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.", - "material.roughness += geometryRoughness;", - "material.roughness = min( material.roughness, 1.0 );", - "material.specularColor = specularFactor;", - ].join(` -`), - o = { - specular: { value: new de().setHex(16777215) }, - glossiness: { value: 1 }, - specularMap: { value: null }, - glossinessMap: { value: null }, - }; - (this._extraUniforms = o), - (this.onBeforeCompile = function (l) { - for (const c in o) l.uniforms[c] = o[c]; - l.fragmentShader = l.fragmentShader - .replace("uniform float roughness;", "uniform vec3 specular;") - .replace( - "uniform float metalness;", - "uniform float glossiness;" - ) - .replace("#include ", t) - .replace("#include ", n) - .replace("#include ", i) - .replace("#include ", s) - .replace("#include ", a); - }), - Object.defineProperties(this, { - specular: { - get: function () { - return o.specular.value; - }, - set: function (l) { - o.specular.value = l; - }, - }, - specularMap: { - get: function () { - return o.specularMap.value; - }, - set: function (l) { - (o.specularMap.value = l), - l - ? (this.defines.USE_SPECULARMAP = "") - : delete this.defines.USE_SPECULARMAP; - }, - }, - glossiness: { - get: function () { - return o.glossiness.value; - }, - set: function (l) { - o.glossiness.value = l; - }, - }, - glossinessMap: { - get: function () { - return o.glossinessMap.value; - }, - set: function (l) { - (o.glossinessMap.value = l), - l - ? ((this.defines.USE_GLOSSINESSMAP = ""), - (this.defines.USE_UV = "")) - : (delete this.defines.USE_GLOSSINESSMAP, - delete this.defines.USE_UV); - }, - }, - }), - delete this.metalness, - delete this.roughness, - delete this.metalnessMap, - delete this.roughnessMap, - this.setValues(e); - } - copy(e) { - return ( - super.copy(e), - (this.specularMap = e.specularMap), - this.specular.copy(e.specular), - (this.glossinessMap = e.glossinessMap), - (this.glossiness = e.glossiness), - delete this.metalness, - delete this.roughness, - delete this.metalnessMap, - delete this.roughnessMap, - this - ); - } - } - class Pv { - constructor() { - (this.name = Le.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS), - (this.specularGlossinessParams = [ - "color", - "map", - "lightMap", - "lightMapIntensity", - "aoMap", - "aoMapIntensity", - "emissive", - "emissiveIntensity", - "emissiveMap", - "bumpMap", - "bumpScale", - "normalMap", - "normalMapType", - "displacementMap", - "displacementScale", - "displacementBias", - "specularMap", - "specular", - "glossinessMap", - "glossiness", - "alphaMap", - "envMap", - "envMapIntensity", - ]); - } - getMaterialType() { - return ja; - } - extendParams(e, t, n) { - const i = t.extensions[this.name]; - (e.color = new de(1, 1, 1)), (e.opacity = 1); - const s = []; - if (Array.isArray(i.diffuseFactor)) { - const a = i.diffuseFactor; - e.color.fromArray(a), (e.opacity = a[3]); - } - if ( - (i.diffuseTexture !== void 0 && - s.push(n.assignTexture(e, "map", i.diffuseTexture, Pe)), - (e.emissive = new de(0, 0, 0)), - (e.glossiness = - i.glossinessFactor !== void 0 ? i.glossinessFactor : 1), - (e.specular = new de(1, 1, 1)), - Array.isArray(i.specularFactor) && - e.specular.fromArray(i.specularFactor), - i.specularGlossinessTexture !== void 0) - ) { - const a = i.specularGlossinessTexture; - s.push(n.assignTexture(e, "glossinessMap", a)), - s.push(n.assignTexture(e, "specularMap", a, Pe)); - } - return Promise.all(s); - } - createMaterial(e) { - const t = new ja(e); - return ( - (t.fog = !0), - (t.color = e.color), - (t.map = e.map === void 0 ? null : e.map), - (t.lightMap = null), - (t.lightMapIntensity = 1), - (t.aoMap = e.aoMap === void 0 ? null : e.aoMap), - (t.aoMapIntensity = 1), - (t.emissive = e.emissive), - (t.emissiveIntensity = - e.emissiveIntensity === void 0 ? 1 : e.emissiveIntensity), - (t.emissiveMap = e.emissiveMap === void 0 ? null : e.emissiveMap), - (t.bumpMap = e.bumpMap === void 0 ? null : e.bumpMap), - (t.bumpScale = 1), - (t.normalMap = e.normalMap === void 0 ? null : e.normalMap), - (t.normalMapType = ci), - e.normalScale && (t.normalScale = e.normalScale), - (t.displacementMap = null), - (t.displacementScale = 1), - (t.displacementBias = 0), - (t.specularMap = e.specularMap === void 0 ? null : e.specularMap), - (t.specular = e.specular), - (t.glossinessMap = - e.glossinessMap === void 0 ? null : e.glossinessMap), - (t.glossiness = e.glossiness), - (t.alphaMap = null), - (t.envMap = e.envMap === void 0 ? null : e.envMap), - (t.envMapIntensity = 1), - t - ); - } - } - class Dv { - constructor() { - this.name = Le.KHR_MESH_QUANTIZATION; - } - } - class vo extends Us { - constructor(e, t, n, i) { - super(e, t, n, i); - } - copySampleValue_(e) { - const t = this.resultBuffer, - n = this.sampleValues, - i = this.valueSize, - s = e * i * 3 + i; - for (let a = 0; a !== i; a++) t[a] = n[s + a]; - return t; - } - } - vo.prototype.interpolate_ = function (r, e, t, n) { - const i = this.resultBuffer, - s = this.sampleValues, - a = this.valueSize, - o = a * 2, - l = a * 3, - c = n - e, - u = (t - e) / c, - h = u * u, - d = h * u, - f = r * l, - g = f - l, - m = -2 * d + 3 * h, - p = d - h, - v = 1 - m, - M = p - h + u; - for (let x = 0; x !== a; x++) { - const w = s[g + x + a], - y = s[g + x + o] * c, - A = s[f + x + a], - L = s[f + x] * c; - i[x] = v * w + M * y + m * A + p * L; - } - return i; - }; - const Iv = new Mt(); - class Fv extends vo { - interpolate_(e, t, n, i) { - const s = super.interpolate_(e, t, n, i); - return Iv.fromArray(s).normalize().toArray(s), s; - } - } - const xn = { - FLOAT: 5126, - FLOAT_MAT3: 35675, - FLOAT_MAT4: 35676, - FLOAT_VEC2: 35664, - FLOAT_VEC3: 35665, - FLOAT_VEC4: 35666, - LINEAR: 9729, - REPEAT: 10497, - SAMPLER_2D: 35678, - POINTS: 0, - LINES: 1, - LINE_LOOP: 2, - LINE_STRIP: 3, - TRIANGLES: 4, - TRIANGLE_STRIP: 5, - TRIANGLE_FAN: 6, - UNSIGNED_BYTE: 5121, - UNSIGNED_SHORT: 5123, - }, - Rs = { - 5120: Int8Array, - 5121: Uint8Array, - 5122: Int16Array, - 5123: Uint16Array, - 5125: Uint32Array, - 5126: Float32Array, - }, - hc = { 9728: ft, 9729: $e, 9984: za, 9985: Oc, 9986: Oa, 9987: li }, - uc = { 33071: gt, 33648: Er, 10497: hn }, - dc = { - SCALAR: 1, - VEC2: 2, - VEC3: 3, - VEC4: 4, - MAT2: 4, - MAT3: 9, - MAT4: 16, - }, - Xa = { - POSITION: "position", - NORMAL: "normal", - TANGENT: "tangent", - TEXCOORD_0: "uv", - TEXCOORD_1: "uv2", - COLOR_0: "color", - WEIGHTS_0: "skinWeight", - JOINTS_0: "skinIndex", - }, - On = { - scale: "scale", - translation: "position", - rotation: "quaternion", - weights: "morphTargetInfluences", - }, - Nv = { CUBICSPLINE: void 0, LINEAR: Gi, STEP: Es }, - Ca = { OPAQUE: "OPAQUE", MASK: "MASK", BLEND: "BLEND" }; - function zv(r) { - return ( - r.DefaultMaterial === void 0 && - (r.DefaultMaterial = new ks({ - color: 16777215, - emissive: 0, - metalness: 1, - roughness: 1, - transparent: !1, - depthTest: !0, - side: ki, - })), - r.DefaultMaterial - ); - } - function vs(r, e, t) { - for (const n in t.extensions) - r[n] === void 0 && - ((e.userData.gltfExtensions = e.userData.gltfExtensions || {}), - (e.userData.gltfExtensions[n] = t.extensions[n])); - } - function ti(r, e) { - e.extras !== void 0 && - (typeof e.extras == "object" - ? Object.assign(r.userData, e.extras) - : console.warn( - "THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras - )); - } - function Ov(r, e, t) { - let n = !1, - i = !1, - s = !1; - for (let c = 0, u = e.length; c < u; c++) { - const h = e[c]; - if ( - (h.POSITION !== void 0 && (n = !0), - h.NORMAL !== void 0 && (i = !0), - h.COLOR_0 !== void 0 && (s = !0), - n && i && s) - ) - break; - } - if (!n && !i && !s) return Promise.resolve(r); - const a = [], - o = [], - l = []; - for (let c = 0, u = e.length; c < u; c++) { - const h = e[c]; - if (n) { - const d = - h.POSITION !== void 0 - ? t.getDependency("accessor", h.POSITION) - : r.attributes.position; - a.push(d); - } - if (i) { - const d = - h.NORMAL !== void 0 - ? t.getDependency("accessor", h.NORMAL) - : r.attributes.normal; - o.push(d); - } - if (s) { - const d = - h.COLOR_0 !== void 0 - ? t.getDependency("accessor", h.COLOR_0) - : r.attributes.color; - l.push(d); - } - } - return Promise.all([ - Promise.all(a), - Promise.all(o), - Promise.all(l), - ]).then(function (c) { - const u = c[0], - h = c[1], - d = c[2]; - return ( - n && (r.morphAttributes.position = u), - i && (r.morphAttributes.normal = h), - s && (r.morphAttributes.color = d), - (r.morphTargetsRelative = !0), - r - ); - }); - } - function kv(r, e) { - if ((r.updateMorphTargets(), e.weights !== void 0)) - for (let t = 0, n = e.weights.length; t < n; t++) - r.morphTargetInfluences[t] = e.weights[t]; - if (e.extras && Array.isArray(e.extras.targetNames)) { - const t = e.extras.targetNames; - if (r.morphTargetInfluences.length === t.length) { - r.morphTargetDictionary = {}; - for (let n = 0, i = t.length; n < i; n++) - r.morphTargetDictionary[t[n]] = n; - } else - console.warn( - "THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names." - ); - } - } - function Uv(r) { - const e = r.extensions && r.extensions[Le.KHR_DRACO_MESH_COMPRESSION]; - let t; - return ( - e - ? (t = - "draco:" + - e.bufferView + - ":" + - e.indices + - ":" + - fc(e.attributes)) - : (t = r.indices + ":" + fc(r.attributes) + ":" + r.mode), - t - ); - } - function fc(r) { - let e = ""; - const t = Object.keys(r).sort(); - for (let n = 0, i = t.length; n < i; n++) - e += t[n] + ":" + r[t[n]] + ";"; - return e; - } - function qa(r) { - switch (r) { - case Int8Array: - return 1 / 127; - case Uint8Array: - return 1 / 255; - case Int16Array: - return 1 / 32767; - case Uint16Array: - return 1 / 65535; - default: - throw new Error( - "THREE.GLTFLoader: Unsupported normalized accessor component type." - ); - } - } - function Bv(r) { - return r.search(/\.jpe?g($|\?)/i) > 0 || - r.search(/^data\:image\/jpeg/) === 0 - ? "image/jpeg" - : r.search(/\.webp($|\?)/i) > 0 || - r.search(/^data\:image\/webp/) === 0 - ? "image/webp" - : "image/png"; - } - class Vv { - constructor(e = {}, t = {}) { - (this.json = e), - (this.extensions = {}), - (this.plugins = {}), - (this.options = t), - (this.cache = new pv()), - (this.associations = new Map()), - (this.primitiveCache = {}), - (this.meshCache = { refs: {}, uses: {} }), - (this.cameraCache = { refs: {}, uses: {} }), - (this.lightCache = { refs: {}, uses: {} }), - (this.sourceCache = {}), - (this.textureCache = {}), - (this.nodeNamesUsed = {}); - const n = - /^((?!chrome|android).)*safari/i.test(navigator.userAgent) === !0, - i = navigator.userAgent.indexOf("Firefox") > -1, - s = i ? navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1] : -1; - typeof createImageBitmap == "undefined" || n || (i && s < 98) - ? (this.textureLoader = new uh(this.options.manager)) - : (this.textureLoader = new U0(this.options.manager)), - this.textureLoader.setCrossOrigin(this.options.crossOrigin), - this.textureLoader.setRequestHeader(this.options.requestHeader), - (this.fileLoader = new qi(this.options.manager)), - this.fileLoader.setResponseType("arraybuffer"), - this.options.crossOrigin === "use-credentials" && - this.fileLoader.setWithCredentials(!0); - } - setExtensions(e) { - this.extensions = e; - } - setPlugins(e) { - this.plugins = e; - } - parse(e, t) { - const n = this, - i = this.json, - s = this.extensions; - this.cache.removeAll(), - this._invokeAll(function (a) { - return a._markDefs && a._markDefs(); - }), - Promise.all( - this._invokeAll(function (a) { - return a.beforeRoot && a.beforeRoot(); - }) - ) - .then(function () { - return Promise.all([ - n.getDependencies("scene"), - n.getDependencies("animation"), - n.getDependencies("camera"), - ]); - }) - .then(function (a) { - const o = { - scene: a[0][i.scene || 0], - scenes: a[0], - animations: a[1], - cameras: a[2], - asset: i.asset, - parser: n, - userData: {}, - }; - vs(s, o, i), - ti(o, i), - Promise.all( - n._invokeAll(function (l) { - return l.afterRoot && l.afterRoot(o); - }) - ).then(function () { - e(o); - }); - }) - .catch(t); - } - _markDefs() { - const e = this.json.nodes || [], - t = this.json.skins || [], - n = this.json.meshes || []; - for (let i = 0, s = t.length; i < s; i++) { - const a = t[i].joints; - for (let o = 0, l = a.length; o < l; o++) e[a[o]].isBone = !0; - } - for (let i = 0, s = e.length; i < s; i++) { - const a = e[i]; - a.mesh !== void 0 && - (this._addNodeRef(this.meshCache, a.mesh), - a.skin !== void 0 && (n[a.mesh].isSkinnedMesh = !0)), - a.camera !== void 0 && - this._addNodeRef(this.cameraCache, a.camera); - } - } - _addNodeRef(e, t) { - t !== void 0 && - (e.refs[t] === void 0 && (e.refs[t] = e.uses[t] = 0), e.refs[t]++); - } - _getNodeRef(e, t, n) { - if (e.refs[t] <= 1) return n; - const i = n.clone(), - s = (a, o) => { - const l = this.associations.get(a); - l != null && this.associations.set(o, l); - for (const [c, u] of a.children.entries()) s(u, o.children[c]); - }; - return s(n, i), (i.name += "_instance_" + e.uses[t]++), i; - } - _invokeOne(e) { - const t = Object.values(this.plugins); - t.push(this); - for (let n = 0; n < t.length; n++) { - const i = e(t[n]); - if (i) return i; - } - return null; - } - _invokeAll(e) { - const t = Object.values(this.plugins); - t.unshift(this); - const n = []; - for (let i = 0; i < t.length; i++) { - const s = e(t[i]); - s && n.push(s); - } - return n; - } - getDependency(e, t) { - const n = e + ":" + t; - let i = this.cache.get(n); - if (!i) { - switch (e) { - case "scene": - i = this.loadScene(t); - break; - case "node": - i = this.loadNode(t); - break; - case "mesh": - i = this._invokeOne(function (s) { - return s.loadMesh && s.loadMesh(t); - }); - break; - case "accessor": - i = this.loadAccessor(t); - break; - case "bufferView": - i = this._invokeOne(function (s) { - return s.loadBufferView && s.loadBufferView(t); - }); - break; - case "buffer": - i = this.loadBuffer(t); - break; - case "material": - i = this._invokeOne(function (s) { - return s.loadMaterial && s.loadMaterial(t); - }); - break; - case "texture": - i = this._invokeOne(function (s) { - return s.loadTexture && s.loadTexture(t); - }); - break; - case "skin": - i = this.loadSkin(t); - break; - case "animation": - i = this._invokeOne(function (s) { - return s.loadAnimation && s.loadAnimation(t); - }); - break; - case "camera": - i = this.loadCamera(t); - break; - default: - throw new Error("Unknown type: " + e); - } - this.cache.add(n, i); - } - return i; - } - getDependencies(e) { - let t = this.cache.get(e); - if (!t) { - const n = this, - i = this.json[e + (e === "mesh" ? "es" : "s")] || []; - (t = Promise.all( - i.map(function (s, a) { - return n.getDependency(e, a); - }) - )), - this.cache.add(e, t); - } - return t; - } - loadBuffer(e) { - const t = this.json.buffers[e], - n = this.fileLoader; - if (t.type && t.type !== "arraybuffer") - throw new Error( - "THREE.GLTFLoader: " + t.type + " buffer type is not supported." - ); - if (t.uri === void 0 && e === 0) - return Promise.resolve(this.extensions[Le.KHR_BINARY_GLTF].body); - const i = this.options; - return new Promise(function (s, a) { - n.load(on.resolveURL(t.uri, i.path), s, void 0, function () { - a( - new Error( - 'THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".' - ) - ); - }); - }); - } - loadBufferView(e) { - const t = this.json.bufferViews[e]; - return this.getDependency("buffer", t.buffer).then(function (n) { - const i = t.byteLength || 0, - s = t.byteOffset || 0; - return n.slice(s, s + i); - }); - } - loadAccessor(e) { - const t = this, - n = this.json, - i = this.json.accessors[e]; - if (i.bufferView === void 0 && i.sparse === void 0) - return Promise.resolve(null); - const s = []; - return ( - i.bufferView !== void 0 - ? s.push(this.getDependency("bufferView", i.bufferView)) - : s.push(null), - i.sparse !== void 0 && - (s.push( - this.getDependency("bufferView", i.sparse.indices.bufferView) - ), - s.push( - this.getDependency("bufferView", i.sparse.values.bufferView) - )), - Promise.all(s).then(function (a) { - const o = a[0], - l = dc[i.type], - c = Rs[i.componentType], - u = c.BYTES_PER_ELEMENT, - h = u * l, - d = i.byteOffset || 0, - f = - i.bufferView !== void 0 - ? n.bufferViews[i.bufferView].byteStride - : void 0, - g = i.normalized === !0; - let m, p; - if (f && f !== h) { - const v = Math.floor(d / f), - M = - "InterleavedBuffer:" + - i.bufferView + - ":" + - i.componentType + - ":" + - v + - ":" + - i.count; - let x = t.cache.get(M); - x || - ((m = new c(o, v * f, (i.count * f) / u)), - (x = new d0(m, f / u)), - t.cache.add(M, x)), - (p = new oo(x, l, (d % f) / u, g)); - } else o === null ? (m = new c(i.count * l)) : (m = new c(o, d, i.count * l)), (p = new wt(m, l, g)); - if (i.sparse !== void 0) { - const v = dc.SCALAR, - M = Rs[i.sparse.indices.componentType], - x = i.sparse.indices.byteOffset || 0, - w = i.sparse.values.byteOffset || 0, - y = new M(a[1], x, i.sparse.count * v), - A = new c(a[2], w, i.sparse.count * l); - o !== null && - (p = new wt(p.array.slice(), p.itemSize, p.normalized)); - for (let L = 0, _ = y.length; L < _; L++) { - const T = y[L]; - if ( - (p.setX(T, A[L * l]), - l >= 2 && p.setY(T, A[L * l + 1]), - l >= 3 && p.setZ(T, A[L * l + 2]), - l >= 4 && p.setW(T, A[L * l + 3]), - l >= 5) - ) - throw new Error( - "THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute." - ); - } - } - return p; - }) - ); - } - loadTexture(e) { - const t = this.json, - n = this.options, - s = t.textures[e].source, - a = t.images[s]; - let o = this.textureLoader; - if (a.uri) { - const l = n.manager.getHandler(a.uri); - l !== null && (o = l); - } - return this.loadTextureImage(e, s, o); - } - loadTextureImage(e, t, n) { - const i = this, - s = this.json, - a = s.textures[e], - o = s.images[t], - l = (o.uri || o.bufferView) + ":" + a.sampler; - if (this.textureCache[l]) return this.textureCache[l]; - const c = this.loadImageSource(t, n) - .then(function (u) { - (u.flipY = !1), a.name && (u.name = a.name); - const d = (s.samplers || {})[a.sampler] || {}; - return ( - (u.magFilter = hc[d.magFilter] || $e), - (u.minFilter = hc[d.minFilter] || li), - (u.wrapS = uc[d.wrapS] || hn), - (u.wrapT = uc[d.wrapT] || hn), - i.associations.set(u, { textures: e }), - u - ); - }) - .catch(function () { - return null; - }); - return (this.textureCache[l] = c), c; - } - loadImageSource(e, t) { - const n = this, - i = this.json, - s = this.options; - if (this.sourceCache[e] !== void 0) - return this.sourceCache[e].then((h) => h.clone()); - const a = i.images[e], - o = self.URL || self.webkitURL; - let l = a.uri || "", - c = !1; - if (a.bufferView !== void 0) - l = n.getDependency("bufferView", a.bufferView).then(function (h) { - c = !0; - const d = new Blob([h], { type: a.mimeType }); - return (l = o.createObjectURL(d)), l; - }); - else if (a.uri === void 0) - throw new Error( - "THREE.GLTFLoader: Image " + e + " is missing URI and bufferView" - ); - const u = Promise.resolve(l) - .then(function (h) { - return new Promise(function (d, f) { - let g = d; - t.isImageBitmapLoader === !0 && - (g = function (m) { - const p = new nt(m); - (p.needsUpdate = !0), d(p); - }), - t.load(on.resolveURL(h, s.path), g, void 0, f); - }); - }) - .then(function (h) { - return ( - c === !0 && o.revokeObjectURL(l), - (h.userData.mimeType = a.mimeType || Bv(a.uri)), - h - ); - }) - .catch(function (h) { - throw ( - (console.error("THREE.GLTFLoader: Couldn't load texture", l), h) - ); - }); - return (this.sourceCache[e] = u), u; - } - assignTexture(e, t, n, i) { - const s = this; - return this.getDependency("texture", n.index).then(function (a) { - if ( - (n.texCoord !== void 0 && - n.texCoord != 0 && - !(t === "aoMap" && n.texCoord == 1) && - console.warn( - "THREE.GLTFLoader: Custom UV set " + - n.texCoord + - " for texture " + - t + - " not yet supported." - ), - s.extensions[Le.KHR_TEXTURE_TRANSFORM]) - ) { - const o = - n.extensions !== void 0 - ? n.extensions[Le.KHR_TEXTURE_TRANSFORM] - : void 0; - if (o) { - const l = s.associations.get(a); - (a = s.extensions[Le.KHR_TEXTURE_TRANSFORM].extendTexture( - a, - o - )), - s.associations.set(a, l); - } - } - return i !== void 0 && (a.encoding = i), (e[t] = a), a; - }); - } - assignFinalMaterial(e) { - const t = e.geometry; - let n = e.material; - const i = t.attributes.tangent === void 0, - s = t.attributes.color !== void 0, - a = t.attributes.normal === void 0; - if (e.isPoints) { - const o = "PointsMaterial:" + n.uuid; - let l = this.cache.get(o); - l || - ((l = new lo()), - it.prototype.copy.call(l, n), - l.color.copy(n.color), - (l.map = n.map), - (l.sizeAttenuation = !1), - this.cache.add(o, l)), - (n = l); - } else if (e.isLine) { - const o = "LineBasicMaterial:" + n.uuid; - let l = this.cache.get(o); - l || - ((l = new Os()), - it.prototype.copy.call(l, n), - l.color.copy(n.color), - this.cache.add(o, l)), - (n = l); - } - if (i || s || a) { - let o = "ClonedMaterial:" + n.uuid + ":"; - n.isGLTFSpecularGlossinessMaterial && (o += "specular-glossiness:"), - i && (o += "derivative-tangents:"), - s && (o += "vertex-colors:"), - a && (o += "flat-shading:"); - let l = this.cache.get(o); - l || - ((l = n.clone()), - s && (l.vertexColors = !0), - a && (l.flatShading = !0), - i && - (l.normalScale && (l.normalScale.y *= -1), - l.clearcoatNormalScale && (l.clearcoatNormalScale.y *= -1)), - this.cache.add(o, l), - this.associations.set(l, this.associations.get(n))), - (n = l); - } - n.aoMap && - t.attributes.uv2 === void 0 && - t.attributes.uv !== void 0 && - t.setAttribute("uv2", t.attributes.uv), - (e.material = n); - } - getMaterialType() { - return ks; - } - loadMaterial(e) { - const t = this, - n = this.json, - i = this.extensions, - s = n.materials[e]; - let a; - const o = {}, - l = s.extensions || {}, - c = []; - if (l[Le.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]) { - const h = i[Le.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]; - (a = h.getMaterialType()), c.push(h.extendParams(o, s, t)); - } else if (l[Le.KHR_MATERIALS_UNLIT]) { - const h = i[Le.KHR_MATERIALS_UNLIT]; - (a = h.getMaterialType()), c.push(h.extendParams(o, s, t)); - } else { - const h = s.pbrMetallicRoughness || {}; - if ( - ((o.color = new de(1, 1, 1)), - (o.opacity = 1), - Array.isArray(h.baseColorFactor)) - ) { - const d = h.baseColorFactor; - o.color.fromArray(d), (o.opacity = d[3]); - } - h.baseColorTexture !== void 0 && - c.push(t.assignTexture(o, "map", h.baseColorTexture, Pe)), - (o.metalness = - h.metallicFactor !== void 0 ? h.metallicFactor : 1), - (o.roughness = - h.roughnessFactor !== void 0 ? h.roughnessFactor : 1), - h.metallicRoughnessTexture !== void 0 && - (c.push( - t.assignTexture(o, "metalnessMap", h.metallicRoughnessTexture) - ), - c.push( - t.assignTexture(o, "roughnessMap", h.metallicRoughnessTexture) - )), - (a = this._invokeOne(function (d) { - return d.getMaterialType && d.getMaterialType(e); - })), - c.push( - Promise.all( - this._invokeAll(function (d) { - return ( - d.extendMaterialParams && d.extendMaterialParams(e, o) - ); - }) - ) - ); - } - s.doubleSided === !0 && (o.side = cn); - const u = s.alphaMode || Ca.OPAQUE; - if ( - (u === Ca.BLEND - ? ((o.transparent = !0), (o.depthWrite = !1)) - : ((o.transparent = !1), - u === Ca.MASK && - (o.alphaTest = - s.alphaCutoff !== void 0 ? s.alphaCutoff : 0.5)), - s.normalTexture !== void 0 && - a !== wn && - (c.push(t.assignTexture(o, "normalMap", s.normalTexture)), - (o.normalScale = new ve(1, 1)), - s.normalTexture.scale !== void 0)) - ) { - const h = s.normalTexture.scale; - o.normalScale.set(h, h); - } - return ( - s.occlusionTexture !== void 0 && - a !== wn && - (c.push(t.assignTexture(o, "aoMap", s.occlusionTexture)), - s.occlusionTexture.strength !== void 0 && - (o.aoMapIntensity = s.occlusionTexture.strength)), - s.emissiveFactor !== void 0 && - a !== wn && - (o.emissive = new de().fromArray(s.emissiveFactor)), - s.emissiveTexture !== void 0 && - a !== wn && - c.push(t.assignTexture(o, "emissiveMap", s.emissiveTexture, Pe)), - Promise.all(c).then(function () { - let h; - return ( - a === ja - ? (h = - i[ - Le.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS - ].createMaterial(o)) - : (h = new a(o)), - s.name && (h.name = s.name), - ti(h, s), - t.associations.set(h, { materials: e }), - s.extensions && vs(i, h, s), - h - ); - }) - ); - } - createUniqueName(e) { - const t = Ne.sanitizeNodeName(e || ""); - let n = t; - for (let i = 1; this.nodeNamesUsed[n]; ++i) n = t + "_" + i; - return (this.nodeNamesUsed[n] = !0), n; - } - loadGeometries(e) { - const t = this, - n = this.extensions, - i = this.primitiveCache; - function s(o) { - return n[Le.KHR_DRACO_MESH_COMPRESSION] - .decodePrimitive(o, t) - .then(function (l) { - return pc(l, o, t); - }); - } - const a = []; - for (let o = 0, l = e.length; o < l; o++) { - const c = e[o], - u = Uv(c), - h = i[u]; - if (h) a.push(h.promise); - else { - let d; - c.extensions && c.extensions[Le.KHR_DRACO_MESH_COMPRESSION] - ? (d = s(c)) - : (d = pc(new ct(), c, t)), - (i[u] = { primitive: c, promise: d }), - a.push(d); - } - } - return Promise.all(a); - } - loadMesh(e) { - const t = this, - n = this.json, - i = this.extensions, - s = n.meshes[e], - a = s.primitives, - o = []; - for (let l = 0, c = a.length; l < c; l++) { - const u = - a[l].material === void 0 - ? zv(this.cache) - : this.getDependency("material", a[l].material); - o.push(u); - } - return ( - o.push(t.loadGeometries(a)), - Promise.all(o).then(function (l) { - const c = l.slice(0, l.length - 1), - u = l[l.length - 1], - h = []; - for (let f = 0, g = u.length; f < g; f++) { - const m = u[f], - p = a[f]; - let v; - const M = c[f]; - if ( - p.mode === xn.TRIANGLES || - p.mode === xn.TRIANGLE_STRIP || - p.mode === xn.TRIANGLE_FAN || - p.mode === void 0 - ) - (v = s.isSkinnedMesh === !0 ? new ah(m, M) : new Qe(m, M)), - v.isSkinnedMesh === !0 && - !v.geometry.attributes.skinWeight.normalized && - v.normalizeSkinWeights(), - p.mode === xn.TRIANGLE_STRIP - ? (v.geometry = mc(v.geometry, Ju)) - : p.mode === xn.TRIANGLE_FAN && - (v.geometry = mc(v.geometry, Bc)); - else if (p.mode === xn.LINES) v = new g0(m, M); - else if (p.mode === xn.LINE_STRIP) v = new Br(m, M); - else if (p.mode === xn.LINE_LOOP) v = new v0(m, M); - else if (p.mode === xn.POINTS) v = new co(m, M); - else - throw new Error( - "THREE.GLTFLoader: Primitive mode unsupported: " + p.mode - ); - Object.keys(v.geometry.morphAttributes).length > 0 && kv(v, s), - (v.name = t.createUniqueName(s.name || "mesh_" + e)), - ti(v, s), - p.extensions && vs(i, v, p), - t.assignFinalMaterial(v), - h.push(v); - } - for (let f = 0, g = h.length; f < g; f++) - t.associations.set(h[f], { meshes: e, primitives: f }); - if (h.length === 1) return h[0]; - const d = new bn(); - t.associations.set(d, { meshes: e }); - for (let f = 0, g = h.length; f < g; f++) d.add(h[f]); - return d; - }) - ); - } - loadCamera(e) { - let t; - const n = this.json.cameras[e], - i = n[n.type]; - if (!i) { - console.warn("THREE.GLTFLoader: Missing camera parameters."); - return; - } - return ( - n.type === "perspective" - ? (t = new mt( - jt.radToDeg(i.yfov), - i.aspectRatio || 1, - i.znear || 1, - i.zfar || 2e6 - )) - : n.type === "orthographic" && - (t = new zs(-i.xmag, i.xmag, i.ymag, -i.ymag, i.znear, i.zfar)), - n.name && (t.name = this.createUniqueName(n.name)), - ti(t, n), - Promise.resolve(t) - ); - } - loadSkin(e) { - const t = this.json.skins[e], - n = { joints: t.joints }; - return t.inverseBindMatrices === void 0 - ? Promise.resolve(n) - : this.getDependency("accessor", t.inverseBindMatrices).then( - function (i) { - return (n.inverseBindMatrices = i), n; - } - ); - } - loadAnimation(e) { - const n = this.json.animations[e], - i = [], - s = [], - a = [], - o = [], - l = []; - for (let c = 0, u = n.channels.length; c < u; c++) { - const h = n.channels[c], - d = n.samplers[h.sampler], - f = h.target, - g = f.node !== void 0 ? f.node : f.id, - m = n.parameters !== void 0 ? n.parameters[d.input] : d.input, - p = n.parameters !== void 0 ? n.parameters[d.output] : d.output; - i.push(this.getDependency("node", g)), - s.push(this.getDependency("accessor", m)), - a.push(this.getDependency("accessor", p)), - o.push(d), - l.push(f); - } - return Promise.all([ - Promise.all(i), - Promise.all(s), - Promise.all(a), - Promise.all(o), - Promise.all(l), - ]).then(function (c) { - const u = c[0], - h = c[1], - d = c[2], - f = c[3], - g = c[4], - m = []; - for (let v = 0, M = u.length; v < M; v++) { - const x = u[v], - w = h[v], - y = d[v], - A = f[v], - L = g[v]; - if (x === void 0) continue; - x.updateMatrix(), (x.matrixAutoUpdate = !0); - let _; - switch (On[L.path]) { - case On.weights: - _ = Wi; - break; - case On.rotation: - _ = Hn; - break; - case On.position: - case On.scale: - default: - _ = ji; - break; - } - const T = x.name ? x.name : x.uuid, - I = A.interpolation !== void 0 ? Nv[A.interpolation] : Gi, - F = []; - On[L.path] === On.weights - ? x.traverse(function (B) { - B.morphTargetInfluences && F.push(B.name ? B.name : B.uuid); - }) - : F.push(T); - let H = y.array; - if (y.normalized) { - const B = qa(H.constructor), - D = new Float32Array(H.length); - for (let z = 0, N = H.length; z < N; z++) D[z] = H[z] * B; - H = D; - } - for (let B = 0, D = F.length; B < D; B++) { - const z = new _(F[B] + "." + On[L.path], w.array, H, I); - A.interpolation === "CUBICSPLINE" && - ((z.createInterpolant = function (k) { - const G = this instanceof Hn ? Fv : vo; - return new G( - this.times, - this.values, - this.getValueSize() / 3, - k - ); - }), - (z.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = - !0)), - m.push(z); - } - } - const p = n.name ? n.name : "animation_" + e; - return new hh(p, void 0, m); - }); - } - createNodeMesh(e) { - const t = this.json, - n = this, - i = t.nodes[e]; - return i.mesh === void 0 - ? null - : n.getDependency("mesh", i.mesh).then(function (s) { - const a = n._getNodeRef(n.meshCache, i.mesh, s); - return ( - i.weights !== void 0 && - a.traverse(function (o) { - if (!!o.isMesh) - for (let l = 0, c = i.weights.length; l < c; l++) - o.morphTargetInfluences[l] = i.weights[l]; - }), - a - ); - }); - } - loadNode(e) { - const t = this.json, - n = this.extensions, - i = this, - s = t.nodes[e], - a = s.name ? i.createUniqueName(s.name) : ""; - return (function () { - const o = [], - l = i._invokeOne(function (c) { - return c.createNodeMesh && c.createNodeMesh(e); - }); - return ( - l && o.push(l), - s.camera !== void 0 && - o.push( - i.getDependency("camera", s.camera).then(function (c) { - return i._getNodeRef(i.cameraCache, s.camera, c); - }) - ), - i - ._invokeAll(function (c) { - return c.createNodeAttachment && c.createNodeAttachment(e); - }) - .forEach(function (c) { - o.push(c); - }), - Promise.all(o) - ); - })().then(function (o) { - let l; - if ( - (s.isBone === !0 - ? (l = new Cr()) - : o.length > 1 - ? (l = new bn()) - : o.length === 1 - ? (l = o[0]) - : (l = new Ye()), - l !== o[0]) - ) - for (let c = 0, u = o.length; c < u; c++) l.add(o[c]); - if ( - (s.name && ((l.userData.name = s.name), (l.name = a)), - ti(l, s), - s.extensions && vs(n, l, s), - s.matrix !== void 0) - ) { - const c = new pe(); - c.fromArray(s.matrix), l.applyMatrix4(c); - } else s.translation !== void 0 && l.position.fromArray(s.translation), s.rotation !== void 0 && l.quaternion.fromArray(s.rotation), s.scale !== void 0 && l.scale.fromArray(s.scale); - return ( - i.associations.has(l) || i.associations.set(l, {}), - (i.associations.get(l).nodes = e), - l - ); - }); - } - loadScene(e) { - const t = this.json, - n = this.extensions, - i = this.json.scenes[e], - s = this, - a = new bn(); - i.name && (a.name = s.createUniqueName(i.name)), - ti(a, i), - i.extensions && vs(n, a, i); - const o = i.nodes || [], - l = []; - for (let c = 0, u = o.length; c < u; c++) l.push(_h(o[c], a, t, s)); - return Promise.all(l).then(function () { - const c = (u) => { - const h = new Map(); - for (const [d, f] of s.associations) - (d instanceof it || d instanceof nt) && h.set(d, f); - return ( - u.traverse((d) => { - const f = s.associations.get(d); - f != null && h.set(d, f); - }), - h - ); - }; - return (s.associations = c(a)), a; - }); - } - } - function _h(r, e, t, n) { - const i = t.nodes[r]; - return n - .getDependency("node", r) - .then(function (s) { - if (i.skin === void 0) return s; - let a; - return n - .getDependency("skin", i.skin) - .then(function (o) { - a = o; - const l = []; - for (let c = 0, u = a.joints.length; c < u; c++) - l.push(n.getDependency("node", a.joints[c])); - return Promise.all(l); - }) - .then(function (o) { - return ( - s.traverse(function (l) { - if (!l.isMesh) return; - const c = [], - u = []; - for (let h = 0, d = o.length; h < d; h++) { - const f = o[h]; - if (f) { - c.push(f); - const g = new pe(); - a.inverseBindMatrices !== void 0 && - g.fromArray(a.inverseBindMatrices.array, h * 16), - u.push(g); - } else - console.warn( - 'THREE.GLTFLoader: Joint "%s" could not be found.', - a.joints[h] - ); - } - l.bind(new Ur(c, u), l.matrixWorld); - }), - s - ); - }); - }) - .then(function (s) { - e.add(s); - const a = []; - if (i.children) { - const o = i.children; - for (let l = 0, c = o.length; l < c; l++) { - const u = o[l]; - a.push(_h(u, s, t, n)); - } - } - return Promise.all(a); - }); - } - function Gv(r, e, t) { - const n = e.attributes, - i = new Ki(); - if (n.POSITION !== void 0) { - const o = t.json.accessors[n.POSITION], - l = o.min, - c = o.max; - if (l !== void 0 && c !== void 0) { - if ( - (i.set(new P(l[0], l[1], l[2]), new P(c[0], c[1], c[2])), - o.normalized) - ) { - const u = qa(Rs[o.componentType]); - i.min.multiplyScalar(u), i.max.multiplyScalar(u); - } - } else { - console.warn( - "THREE.GLTFLoader: Missing min/max properties for accessor POSITION." - ); - return; - } - } else return; - const s = e.targets; - if (s !== void 0) { - const o = new P(), - l = new P(); - for (let c = 0, u = s.length; c < u; c++) { - const h = s[c]; - if (h.POSITION !== void 0) { - const d = t.json.accessors[h.POSITION], - f = d.min, - g = d.max; - if (f !== void 0 && g !== void 0) { - if ( - (l.setX(Math.max(Math.abs(f[0]), Math.abs(g[0]))), - l.setY(Math.max(Math.abs(f[1]), Math.abs(g[1]))), - l.setZ(Math.max(Math.abs(f[2]), Math.abs(g[2]))), - d.normalized) - ) { - const m = qa(Rs[d.componentType]); - l.multiplyScalar(m); - } - o.max(l); - } else - console.warn( - "THREE.GLTFLoader: Missing min/max properties for accessor POSITION." - ); - } - } - i.expandByVector(o); - } - r.boundingBox = i; - const a = new Zi(); - i.getCenter(a.center), - (a.radius = i.min.distanceTo(i.max) / 2), - (r.boundingSphere = a); - } - function pc(r, e, t) { - const n = e.attributes, - i = []; - function s(a, o) { - return t.getDependency("accessor", a).then(function (l) { - r.setAttribute(o, l); - }); - } - for (const a in n) { - const o = Xa[a] || a.toLowerCase(); - o in r.attributes || i.push(s(n[a], o)); - } - if (e.indices !== void 0 && !r.index) { - const a = t.getDependency("accessor", e.indices).then(function (o) { - r.setIndex(o); - }); - i.push(a); - } - return ( - ti(r, e), - Gv(r, e, t), - Promise.all(i).then(function () { - return e.targets !== void 0 ? Ov(r, e.targets, t) : r; - }) - ); - } - function mc(r, e) { - let t = r.getIndex(); - if (t === null) { - const a = [], - o = r.getAttribute("position"); - if (o !== void 0) { - for (let l = 0; l < o.count; l++) a.push(l); - r.setIndex(a), (t = r.getIndex()); - } else - return ( - console.error( - "THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible." - ), - r - ); - } - const n = t.count - 2, - i = []; - if (e === Bc) - for (let a = 1; a <= n; a++) - i.push(t.getX(0)), i.push(t.getX(a)), i.push(t.getX(a + 1)); - else - for (let a = 0; a < n; a++) - a % 2 === 0 - ? (i.push(t.getX(a)), - i.push(t.getX(a + 1)), - i.push(t.getX(a + 2))) - : (i.push(t.getX(a + 2)), - i.push(t.getX(a + 1)), - i.push(t.getX(a))); - i.length / 3 !== n && - console.error( - "THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles." - ); - const s = r.clone(); - return s.setIndex(i), s; - } - /*! -fflate - fast JavaScript compression/decompression - -Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE -version 0.6.9 -*/ var gc = {}, - $a = function (r) { - return URL.createObjectURL( - new Blob([r], { type: "text/javascript" }) - ); - }, - xh = function (r) { - return new Worker(r); - }; - try { - URL.revokeObjectURL($a("")); - } catch { - ($a = function (e) { - return "data:application/javascript;charset=UTF-8," + encodeURI(e); - }), - (xh = function (e) { - return new Worker(e, { type: "module" }); - }); - } - var Hv = function (r, e, t, n, i) { - var s = xh(gc[e] || (gc[e] = $a(r))); - return ( - (s.onerror = function (a) { - return i(a.error, null); - }), - (s.onmessage = function (a) { - return i(null, a.data); - }), - s.postMessage(t, n), - s - ); - }, - Re = Uint8Array, - ht = Uint16Array, - An = Uint32Array, - ns = new Re([ - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, - 4, 5, 5, 5, 5, 0, 0, 0, 0, - ]), - is = new Re([ - 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, - 10, 11, 11, 12, 12, 13, 13, 0, 0, - ]), - Ps = new Re([ - 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, - ]), - yh = function (r, e) { - for (var t = new ht(31), n = 0; n < 31; ++n) - t[n] = e += 1 << r[n - 1]; - for (var i = new An(t[30]), n = 1; n < 30; ++n) - for (var s = t[n]; s < t[n + 1]; ++s) i[s] = ((s - t[n]) << 5) | n; - return [t, i]; - }, - Mh = yh(ns, 2), - _o = Mh[0], - Lr = Mh[1]; - (_o[28] = 258), (Lr[258] = 28); - var wh = yh(is, 0), - bh = wh[0], - Ya = wh[1], - Ds = new ht(32768); - for (var We = 0; We < 32768; ++We) { - var kn = ((We & 43690) >>> 1) | ((We & 21845) << 1); - (kn = ((kn & 52428) >>> 2) | ((kn & 13107) << 2)), - (kn = ((kn & 61680) >>> 4) | ((kn & 3855) << 4)), - (Ds[We] = (((kn & 65280) >>> 8) | ((kn & 255) << 8)) >>> 1); - } - var zt = function (r, e, t) { - for (var n = r.length, i = 0, s = new ht(e); i < n; ++i) - ++s[r[i] - 1]; - var a = new ht(e); - for (i = 0; i < e; ++i) a[i] = (a[i - 1] + s[i - 1]) << 1; - var o; - if (t) { - o = new ht(1 << e); - var l = 15 - e; - for (i = 0; i < n; ++i) - if (r[i]) - for ( - var c = (i << 4) | r[i], - u = e - r[i], - h = a[r[i] - 1]++ << u, - d = h | ((1 << u) - 1); - h <= d; - ++h - ) - o[Ds[h] >>> l] = c; - } else - for (o = new ht(n), i = 0; i < n; ++i) - r[i] && (o[i] = Ds[a[r[i] - 1]++] >>> (15 - r[i])); - return o; - }, - Cn = new Re(288); - for (var We = 0; We < 144; ++We) Cn[We] = 8; - for (var We = 144; We < 256; ++We) Cn[We] = 9; - for (var We = 256; We < 280; ++We) Cn[We] = 7; - for (var We = 280; We < 288; ++We) Cn[We] = 8; - var $i = new Re(32); - for (var We = 0; We < 32; ++We) $i[We] = 5; - var Sh = zt(Cn, 9, 0), - Th = zt(Cn, 9, 1), - Eh = zt($i, 5, 0), - Ah = zt($i, 5, 1), - yr = function (r) { - for (var e = r[0], t = 1; t < r.length; ++t) r[t] > e && (e = r[t]); - return e; - }, - It = function (r, e, t) { - var n = (e / 8) | 0; - return ((r[n] | (r[n + 1] << 8)) >> (e & 7)) & t; - }, - Mr = function (r, e) { - var t = (e / 8) | 0; - return (r[t] | (r[t + 1] << 8) | (r[t + 2] << 16)) >> (e & 7); - }, - Bs = function (r) { - return ((r / 8) | 0) + (r & 7 && 1); - }, - Ot = function (r, e, t) { - (e == null || e < 0) && (e = 0), - (t == null || t > r.length) && (t = r.length); - var n = new (r instanceof ht ? ht : r instanceof An ? An : Re)(t - e); - return n.set(r.subarray(e, t)), n; - }, - Vs = function (r, e, t) { - var n = r.length; - if (!n || (t && !t.l && n < 5)) return e || new Re(0); - var i = !e || t, - s = !t || t.i; - t || (t = {}), e || (e = new Re(n * 3)); - var a = function (q) { - var Ie = e.length; - if (q > Ie) { - var me = new Re(Math.max(Ie * 2, q)); - me.set(e), (e = me); - } - }, - o = t.f || 0, - l = t.p || 0, - c = t.b || 0, - u = t.l, - h = t.d, - d = t.m, - f = t.n, - g = n * 8; - do { - if (!u) { - t.f = o = It(r, l, 1); - var m = It(r, l + 1, 3); - if (((l += 3), m)) - if (m == 1) (u = Th), (h = Ah), (d = 9), (f = 5); - else if (m == 2) { - var x = It(r, l, 31) + 257, - w = It(r, l + 10, 15) + 4, - y = x + It(r, l + 5, 31) + 1; - l += 14; - for (var A = new Re(y), L = new Re(19), _ = 0; _ < w; ++_) - L[Ps[_]] = It(r, l + _ * 3, 7); - l += w * 3; - for ( - var T = yr(L), I = (1 << T) - 1, F = zt(L, T, 1), _ = 0; - _ < y; - - ) { - var H = F[It(r, l, I)]; - l += H & 15; - var p = H >>> 4; - if (p < 16) A[_++] = p; - else { - var B = 0, - D = 0; - for ( - p == 16 - ? ((D = 3 + It(r, l, 3)), (l += 2), (B = A[_ - 1])) - : p == 17 - ? ((D = 3 + It(r, l, 7)), (l += 3)) - : p == 18 && ((D = 11 + It(r, l, 127)), (l += 7)); - D--; - - ) - A[_++] = B; - } - } - var z = A.subarray(0, x), - N = A.subarray(x); - (d = yr(z)), - (f = yr(N)), - (u = zt(z, d, 1)), - (h = zt(N, f, 1)); - } else throw "invalid block type"; - else { - var p = Bs(l) + 4, - v = r[p - 4] | (r[p - 3] << 8), - M = p + v; - if (M > n) { - if (s) throw "unexpected EOF"; - break; - } - i && a(c + v), - e.set(r.subarray(p, M), c), - (t.b = c += v), - (t.p = l = M * 8); - continue; - } - if (l > g) { - if (s) throw "unexpected EOF"; - break; - } - } - i && a(c + 131072); - for (var k = (1 << d) - 1, G = (1 << f) - 1, U = l; ; U = l) { - var B = u[Mr(r, l) & k], - X = B >>> 4; - if (((l += B & 15), l > g)) { - if (s) throw "unexpected EOF"; - break; - } - if (!B) throw "invalid length/literal"; - if (X < 256) e[c++] = X; - else if (X == 256) { - (U = l), (u = null); - break; - } else { - var Z = X - 254; - if (X > 264) { - var _ = X - 257, - Y = ns[_]; - (Z = It(r, l, (1 << Y) - 1) + _o[_]), (l += Y); - } - var J = h[Mr(r, l) & G], - ae = J >>> 4; - if (!J) throw "invalid distance"; - l += J & 15; - var N = bh[ae]; - if (ae > 3) { - var Y = is[ae]; - (N += Mr(r, l) & ((1 << Y) - 1)), (l += Y); - } - if (l > g) { - if (s) throw "unexpected EOF"; - break; - } - i && a(c + 131072); - for (var ue = c + Z; c < ue; c += 4) - (e[c] = e[c - N]), - (e[c + 1] = e[c + 1 - N]), - (e[c + 2] = e[c + 2 - N]), - (e[c + 3] = e[c + 3 - N]); - c = ue; - } - } - (t.l = u), - (t.p = U), - (t.b = c), - u && ((o = 1), (t.m = d), (t.d = h), (t.n = f)); - } while (!o); - return c == e.length ? e : Ot(e, 0, c); - }, - nn = function (r, e, t) { - t <<= e & 7; - var n = (e / 8) | 0; - (r[n] |= t), (r[n + 1] |= t >>> 8); - }, - Ii = function (r, e, t) { - t <<= e & 7; - var n = (e / 8) | 0; - (r[n] |= t), (r[n + 1] |= t >>> 8), (r[n + 2] |= t >>> 16); - }, - wr = function (r, e) { - for (var t = [], n = 0; n < r.length; ++n) - r[n] && t.push({ s: n, f: r[n] }); - var i = t.length, - s = t.slice(); - if (!i) return [Sn, 0]; - if (i == 1) { - var a = new Re(t[0].s + 1); - return (a[t[0].s] = 1), [a, 1]; - } - t.sort(function (y, A) { - return y.f - A.f; - }), - t.push({ s: -1, f: 25001 }); - var o = t[0], - l = t[1], - c = 0, - u = 1, - h = 2; - for (t[0] = { s: -1, f: o.f + l.f, l: o, r: l }; u != i - 1; ) - (o = t[t[c].f < t[h].f ? c++ : h++]), - (l = t[c != u && t[c].f < t[h].f ? c++ : h++]), - (t[u++] = { s: -1, f: o.f + l.f, l: o, r: l }); - for (var d = s[0].s, n = 1; n < i; ++n) s[n].s > d && (d = s[n].s); - var f = new ht(d + 1), - g = Rr(t[u - 1], f, 0); - if (g > e) { - var n = 0, - m = 0, - p = g - e, - v = 1 << p; - for ( - s.sort(function (A, L) { - return f[L.s] - f[A.s] || A.f - L.f; - }); - n < i; - ++n - ) { - var M = s[n].s; - if (f[M] > e) (m += v - (1 << (g - f[M]))), (f[M] = e); - else break; - } - for (m >>>= p; m > 0; ) { - var x = s[n].s; - f[x] < e ? (m -= 1 << (e - f[x]++ - 1)) : ++n; - } - for (; n >= 0 && m; --n) { - var w = s[n].s; - f[w] == e && (--f[w], ++m); - } - g = e; - } - return [new Re(f), g]; - }, - Rr = function (r, e, t) { - return r.s == -1 - ? Math.max(Rr(r.l, e, t + 1), Rr(r.r, e, t + 1)) - : (e[r.s] = t); - }, - Ka = function (r) { - for (var e = r.length; e && !r[--e]; ); - for ( - var t = new ht(++e), - n = 0, - i = r[0], - s = 1, - a = function (l) { - t[n++] = l; - }, - o = 1; - o <= e; - ++o - ) - if (r[o] == i && o != e) ++s; - else { - if (!i && s > 2) { - for (; s > 138; s -= 138) a(32754); - s > 2 && - (a(s > 10 ? ((s - 11) << 5) | 28690 : ((s - 3) << 5) | 12305), - (s = 0)); - } else if (s > 3) { - for (a(i), --s; s > 6; s -= 6) a(8304); - s > 2 && (a(((s - 3) << 5) | 8208), (s = 0)); - } - for (; s--; ) a(i); - (s = 1), (i = r[o]); - } - return [t.subarray(0, n), e]; - }, - Fi = function (r, e) { - for (var t = 0, n = 0; n < e.length; ++n) t += r[n] * e[n]; - return t; - }, - bs = function (r, e, t) { - var n = t.length, - i = Bs(e + 2); - (r[i] = n & 255), - (r[i + 1] = n >>> 8), - (r[i + 2] = r[i] ^ 255), - (r[i + 3] = r[i + 1] ^ 255); - for (var s = 0; s < n; ++s) r[i + s + 4] = t[s]; - return (i + 4 + n) * 8; - }, - Za = function (r, e, t, n, i, s, a, o, l, c, u) { - nn(e, u++, t), ++i[256]; - for ( - var h = wr(i, 15), - d = h[0], - f = h[1], - g = wr(s, 15), - m = g[0], - p = g[1], - v = Ka(d), - M = v[0], - x = v[1], - w = Ka(m), - y = w[0], - A = w[1], - L = new ht(19), - _ = 0; - _ < M.length; - ++_ - ) - L[M[_] & 31]++; - for (var _ = 0; _ < y.length; ++_) L[y[_] & 31]++; - for ( - var T = wr(L, 7), I = T[0], F = T[1], H = 19; - H > 4 && !I[Ps[H - 1]]; - --H - ); - var B = (c + 5) << 3, - D = Fi(i, Cn) + Fi(s, $i) + a, - z = - Fi(i, d) + - Fi(s, m) + - a + - 14 + - 3 * H + - Fi(L, I) + - (2 * L[16] + 3 * L[17] + 7 * L[18]); - if (B <= D && B <= z) return bs(e, u, r.subarray(l, l + c)); - var N, k, G, U; - if ((nn(e, u, 1 + (z < D)), (u += 2), z < D)) { - (N = zt(d, f, 0)), (k = d), (G = zt(m, p, 0)), (U = m); - var X = zt(I, F, 0); - nn(e, u, x - 257), - nn(e, u + 5, A - 1), - nn(e, u + 10, H - 4), - (u += 14); - for (var _ = 0; _ < H; ++_) nn(e, u + 3 * _, I[Ps[_]]); - u += 3 * H; - for (var Z = [M, y], Y = 0; Y < 2; ++Y) - for (var J = Z[Y], _ = 0; _ < J.length; ++_) { - var ae = J[_] & 31; - nn(e, u, X[ae]), - (u += I[ae]), - ae > 15 && (nn(e, u, (J[_] >>> 5) & 127), (u += J[_] >>> 12)); - } - } else (N = Sh), (k = Cn), (G = Eh), (U = $i); - for (var _ = 0; _ < o; ++_) - if (n[_] > 255) { - var ae = (n[_] >>> 18) & 31; - Ii(e, u, N[ae + 257]), - (u += k[ae + 257]), - ae > 7 && (nn(e, u, (n[_] >>> 23) & 31), (u += ns[ae])); - var ue = n[_] & 31; - Ii(e, u, G[ue]), - (u += U[ue]), - ue > 3 && (Ii(e, u, (n[_] >>> 5) & 8191), (u += is[ue])); - } else Ii(e, u, N[n[_]]), (u += k[n[_]]); - return Ii(e, u, N[256]), u + k[256]; - }, - Ch = new An([ - 65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, - 2117632, - ]), - Sn = new Re(0), - Lh = function (r, e, t, n, i, s) { - var a = r.length, - o = new Re(n + a + 5 * (1 + Math.ceil(a / 7e3)) + i), - l = o.subarray(n, o.length - i), - c = 0; - if (!e || a < 8) - for (var u = 0; u <= a; u += 65535) { - var h = u + 65535; - h < a - ? (c = bs(l, c, r.subarray(u, h))) - : ((l[u] = s), (c = bs(l, c, r.subarray(u, a)))); - } - else { - for ( - var d = Ch[e - 1], - f = d >>> 13, - g = d & 8191, - m = (1 << t) - 1, - p = new ht(32768), - v = new ht(m + 1), - M = Math.ceil(t / 3), - x = 2 * M, - w = function (qe) { - return (r[qe] ^ (r[qe + 1] << M) ^ (r[qe + 2] << x)) & m; - }, - y = new An(25e3), - A = new ht(288), - L = new ht(32), - _ = 0, - T = 0, - u = 0, - I = 0, - F = 0, - H = 0; - u < a; - ++u - ) { - var B = w(u), - D = u & 32767, - z = v[B]; - if (((p[D] = z), (v[B] = D), F <= u)) { - var N = a - u; - if ((_ > 7e3 || I > 24576) && N > 423) { - (c = Za(r, l, 0, y, A, L, T, I, H, u - H, c)), - (I = _ = T = 0), - (H = u); - for (var k = 0; k < 286; ++k) A[k] = 0; - for (var k = 0; k < 30; ++k) L[k] = 0; - } - var G = 2, - U = 0, - X = g, - Z = (D - z) & 32767; - if (N > 2 && B == w(u - Z)) - for ( - var Y = Math.min(f, N) - 1, - J = Math.min(32767, u), - ae = Math.min(258, N); - Z <= J && --X && D != z; - - ) { - if (r[u + G] == r[u + G - Z]) { - for ( - var ue = 0; - ue < ae && r[u + ue] == r[u + ue - Z]; - ++ue - ); - if (ue > G) { - if (((G = ue), (U = Z), ue > Y)) break; - for ( - var q = Math.min(Z, ue - 2), Ie = 0, k = 0; - k < q; - ++k - ) { - var me = (u - Z + k + 32768) & 32767, - xe = p[me], - ce = (me - xe + 32768) & 32767; - ce > Ie && ((Ie = ce), (z = me)); - } - } - } - (D = z), (z = p[D]), (Z += (D - z + 32768) & 32767); - } - if (U) { - y[I++] = 268435456 | (Lr[G] << 18) | Ya[U]; - var De = Lr[G] & 31, - Se = Ya[U] & 31; - (T += ns[De] + is[Se]), - ++A[257 + De], - ++L[Se], - (F = u + G), - ++_; - } else (y[I++] = r[u]), ++A[r[u]]; - } - } - (c = Za(r, l, s, y, A, L, T, I, H, u - H, c)), - !s && c & 7 && (c = bs(l, c + 1, Sn)); - } - return Ot(o, 0, n + Bs(c) + i); - }, - Rh = (function () { - for (var r = new An(256), e = 0; e < 256; ++e) { - for (var t = e, n = 9; --n; ) t = (t & 1 && 3988292384) ^ (t >>> 1); - r[e] = t; - } - return r; - })(), - ss = function () { - var r = -1; - return { - p: function (e) { - for (var t = r, n = 0; n < e.length; ++n) - t = Rh[(t & 255) ^ e[n]] ^ (t >>> 8); - r = t; - }, - d: function () { - return ~r; - }, - }; - }, - xo = function () { - var r = 1, - e = 0; - return { - p: function (t) { - for (var n = r, i = e, s = t.length, a = 0; a != s; ) { - for (var o = Math.min(a + 2655, s); a < o; ++a) i += n += t[a]; - (n = (n & 65535) + 15 * (n >> 16)), - (i = (i & 65535) + 15 * (i >> 16)); - } - (r = n), (e = i); - }, - d: function () { - return ( - (r %= 65521), - (e %= 65521), - ((r & 255) << 24) | - ((r >>> 8) << 16) | - ((e & 255) << 8) | - (e >>> 8) - ); - }, - }; - }, - ui = function (r, e, t, n, i) { - return Lh( - r, - e.level == null ? 6 : e.level, - e.mem == null - ? Math.ceil(Math.max(8, Math.min(13, Math.log(r.length))) * 1.5) - : 12 + e.mem, - t, - n, - !i - ); - }, - Gs = function (r, e) { - var t = {}; - for (var n in r) t[n] = r[n]; - for (var n in e) t[n] = e[n]; - return t; - }, - vc = function (r, e, t) { - for ( - var n = r(), - i = r.toString(), - s = i - .slice(i.indexOf("[") + 1, i.lastIndexOf("]")) - .replace(/ /g, "") - .split(","), - a = 0; - a < n.length; - ++a - ) { - var o = n[a], - l = s[a]; - if (typeof o == "function") { - e += ";" + l + "="; - var c = o.toString(); - if (o.prototype) - if (c.indexOf("[native code]") != -1) { - var u = c.indexOf(" ", 8) + 1; - e += c.slice(u, c.indexOf("(", u)); - } else { - e += c; - for (var h in o.prototype) - e += - ";" + - l + - ".prototype." + - h + - "=" + - o.prototype[h].toString(); - } - else e += c; - } else t[l] = o; - } - return [e, t]; - }, - mr = [], - Wv = function (r) { - var e = []; - for (var t in r) - (r[t] instanceof Re || r[t] instanceof ht || r[t] instanceof An) && - e.push((r[t] = new r[t].constructor(r[t])).buffer); - return e; - }, - Ph = function (r, e, t, n) { - var i; - if (!mr[t]) { - for (var s = "", a = {}, o = r.length - 1, l = 0; l < o; ++l) - (i = vc(r[l], s, a)), (s = i[0]), (a = i[1]); - mr[t] = vc(r[o], s, a); - } - var c = Gs({}, mr[t][1]); - return Hv( - mr[t][0] + - ";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=" + - e.toString() + - "}", - t, - c, - Wv(c), - n - ); - }, - rs = function () { - return [ - Re, - ht, - An, - ns, - is, - Ps, - _o, - bh, - Th, - Ah, - Ds, - zt, - yr, - It, - Mr, - Bs, - Ot, - Vs, - cs, - $n, - yo, - ]; - }, - as = function () { - return [ - Re, - ht, - An, - ns, - is, - Ps, - Lr, - Ya, - Sh, - Cn, - Eh, - $i, - Ds, - Ch, - Sn, - zt, - nn, - Ii, - wr, - Rr, - Ka, - Fi, - bs, - Za, - Bs, - Ot, - Lh, - ui, - Hs, - $n, - ]; - }, - Dh = function () { - return [Mo, bo, ke, ss, Rh]; - }, - Ih = function () { - return [wo, zh]; - }, - Fh = function () { - return [So, ke, xo]; - }, - Nh = function () { - return [Oh]; - }, - $n = function (r) { - return postMessage(r, [r.buffer]); - }, - yo = function (r) { - return r && r.size && new Re(r.size); - }, - os = function (r, e, t, n, i, s) { - var a = Ph(t, n, i, function (o, l) { - a.terminate(), s(o, l); - }); - return ( - a.postMessage([r, e], e.consume ? [r.buffer] : []), - function () { - a.terminate(); - } - ); - }, - kt = function (r) { - return ( - (r.ondata = function (e, t) { - return postMessage([e, t], [e.buffer]); - }), - function (e) { - return r.push(e.data[0], e.data[1]); - } - ); - }, - ls = function (r, e, t, n, i) { - var s, - a = Ph(r, n, i, function (o, l) { - o - ? (a.terminate(), e.ondata.call(e, o)) - : (l[1] && a.terminate(), e.ondata.call(e, o, l[0], l[1])); - }); - a.postMessage(t), - (e.push = function (o, l) { - if (s) throw "stream finished"; - if (!e.ondata) throw "no stream handler"; - a.postMessage([o, (s = l)], [o.buffer]); - }), - (e.terminate = function () { - a.terminate(); - }); - }, - yt = function (r, e) { - return r[e] | (r[e + 1] << 8); - }, - Je = function (r, e) { - return ( - (r[e] | (r[e + 1] << 8) | (r[e + 2] << 16) | (r[e + 3] << 24)) >>> 0 - ); - }, - La = function (r, e) { - return Je(r, e) + Je(r, e + 4) * 4294967296; - }, - ke = function (r, e, t) { - for (; t; ++e) (r[e] = t), (t >>>= 8); - }, - Mo = function (r, e) { - var t = e.filename; - if ( - ((r[0] = 31), - (r[1] = 139), - (r[2] = 8), - (r[8] = e.level < 2 ? 4 : e.level == 9 ? 2 : 0), - (r[9] = 3), - e.mtime != 0 && - ke(r, 4, Math.floor(new Date(e.mtime || Date.now()) / 1e3)), - t) - ) { - r[3] = 8; - for (var n = 0; n <= t.length; ++n) r[n + 10] = t.charCodeAt(n); - } - }, - wo = function (r) { - if (r[0] != 31 || r[1] != 139 || r[2] != 8) throw "invalid gzip data"; - var e = r[3], - t = 10; - e & 4 && (t += r[10] | ((r[11] << 8) + 2)); - for (var n = ((e >> 3) & 1) + ((e >> 4) & 1); n > 0; n -= !r[t++]); - return t + (e & 2); - }, - zh = function (r) { - var e = r.length; - return ( - (r[e - 4] | - (r[e - 3] << 8) | - (r[e - 2] << 16) | - (r[e - 1] << 24)) >>> - 0 - ); - }, - bo = function (r) { - return 10 + ((r.filename && r.filename.length + 1) || 0); - }, - So = function (r, e) { - var t = e.level, - n = t == 0 ? 0 : t < 6 ? 1 : t == 9 ? 3 : 2; - (r[0] = 120), (r[1] = (n << 6) | (n ? 32 - 2 * n : 1)); - }, - Oh = function (r) { - if ((r[0] & 15) != 8 || r[0] >>> 4 > 7 || ((r[0] << 8) | r[1]) % 31) - throw "invalid zlib data"; - if (r[1] & 32) - throw "invalid zlib data: preset dictionaries not supported"; - }; - function To(r, e) { - return ( - !e && typeof r == "function" && ((e = r), (r = {})), - (this.ondata = e), - r - ); - } - var un = (function () { - function r(e, t) { - !t && typeof e == "function" && ((t = e), (e = {})), - (this.ondata = t), - (this.o = e || {}); - } - return ( - (r.prototype.p = function (e, t) { - this.ondata(ui(e, this.o, 0, 0, !t), t); - }), - (r.prototype.push = function (e, t) { - if (this.d) throw "stream finished"; - if (!this.ondata) throw "no stream handler"; - (this.d = t), this.p(e, t || !1); - }), - r - ); - })(), - kh = (function () { - function r(e, t) { - ls( - [ - as, - function () { - return [kt, un]; - }, - ], - this, - To.call(this, e, t), - function (n) { - var i = new un(n.data); - onmessage = kt(i); - }, - 6 - ); - } - return r; - })(); - function Uh(r, e, t) { - if ((t || ((t = e), (e = {})), typeof t != "function")) - throw "no callback"; - return os( - r, - e, - [as], - function (n) { - return $n(Hs(n.data[0], n.data[1])); - }, - 0, - t - ); - } - function Hs(r, e) { - return ui(r, e || {}, 0, 0); - } - var Et = (function () { - function r(e) { - (this.s = {}), (this.p = new Re(0)), (this.ondata = e); - } - return ( - (r.prototype.e = function (e) { - if (this.d) throw "stream finished"; - if (!this.ondata) throw "no stream handler"; - var t = this.p.length, - n = new Re(t + e.length); - n.set(this.p), n.set(e, t), (this.p = n); - }), - (r.prototype.c = function (e) { - this.d = this.s.i = e || !1; - var t = this.s.b, - n = Vs(this.p, this.o, this.s); - this.ondata(Ot(n, t, this.s.b), this.d), - (this.o = Ot(n, this.s.b - 32768)), - (this.s.b = this.o.length), - (this.p = Ot(this.p, (this.s.p / 8) | 0)), - (this.s.p &= 7); - }), - (r.prototype.push = function (e, t) { - this.e(e), this.c(t); - }), - r - ); - })(), - Eo = (function () { - function r(e) { - (this.ondata = e), - ls( - [ - rs, - function () { - return [kt, Et]; - }, - ], - this, - 0, - function () { - var t = new Et(); - onmessage = kt(t); - }, - 7 - ); - } - return r; - })(); - function Ao(r, e, t) { - if ((t || ((t = e), (e = {})), typeof t != "function")) - throw "no callback"; - return os( - r, - e, - [rs], - function (n) { - return $n(cs(n.data[0], yo(n.data[1]))); - }, - 1, - t - ); - } - function cs(r, e) { - return Vs(r, e); - } - var Pr = (function () { - function r(e, t) { - (this.c = ss()), (this.l = 0), (this.v = 1), un.call(this, e, t); - } - return ( - (r.prototype.push = function (e, t) { - un.prototype.push.call(this, e, t); - }), - (r.prototype.p = function (e, t) { - this.c.p(e), (this.l += e.length); - var n = ui(e, this.o, this.v && bo(this.o), t && 8, !t); - this.v && (Mo(n, this.o), (this.v = 0)), - t && - (ke(n, n.length - 8, this.c.d()), - ke(n, n.length - 4, this.l)), - this.ondata(n, t); - }), - r - ); - })(), - _c = (function () { - function r(e, t) { - ls( - [ - as, - Dh, - function () { - return [kt, un, Pr]; - }, - ], - this, - To.call(this, e, t), - function (n) { - var i = new Pr(n.data); - onmessage = kt(i); - }, - 8 - ); - } - return r; - })(); - function xc(r, e, t) { - if ((t || ((t = e), (e = {})), typeof t != "function")) - throw "no callback"; - return os( - r, - e, - [ - as, - Dh, - function () { - return [Dr]; - }, - ], - function (n) { - return $n(Dr(n.data[0], n.data[1])); - }, - 2, - t - ); - } - function Dr(r, e) { - e || (e = {}); - var t = ss(), - n = r.length; - t.p(r); - var i = ui(r, e, bo(e), 8), - s = i.length; - return Mo(i, e), ke(i, s - 8, t.d()), ke(i, s - 4, n), i; - } - var Ir = (function () { - function r(e) { - (this.v = 1), Et.call(this, e); - } - return ( - (r.prototype.push = function (e, t) { - if ((Et.prototype.e.call(this, e), this.v)) { - var n = this.p.length > 3 ? wo(this.p) : 4; - if (n >= this.p.length && !t) return; - (this.p = this.p.subarray(n)), (this.v = 0); - } - if (t) { - if (this.p.length < 8) throw "invalid gzip stream"; - this.p = this.p.subarray(0, -8); - } - Et.prototype.c.call(this, t); - }), - r - ); - })(), - Bh = (function () { - function r(e) { - (this.ondata = e), - ls( - [ - rs, - Ih, - function () { - return [kt, Et, Ir]; - }, - ], - this, - 0, - function () { - var t = new Ir(); - onmessage = kt(t); - }, - 9 - ); - } - return r; - })(); - function Vh(r, e, t) { - if ((t || ((t = e), (e = {})), typeof t != "function")) - throw "no callback"; - return os( - r, - e, - [ - rs, - Ih, - function () { - return [Fr]; - }, - ], - function (n) { - return $n(Fr(n.data[0])); - }, - 3, - t - ); - } - function Fr(r, e) { - return Vs(r.subarray(wo(r), -8), e || new Re(zh(r))); - } - var Ja = (function () { - function r(e, t) { - (this.c = xo()), (this.v = 1), un.call(this, e, t); - } - return ( - (r.prototype.push = function (e, t) { - un.prototype.push.call(this, e, t); - }), - (r.prototype.p = function (e, t) { - this.c.p(e); - var n = ui(e, this.o, this.v && 2, t && 4, !t); - this.v && (So(n, this.o), (this.v = 0)), - t && ke(n, n.length - 4, this.c.d()), - this.ondata(n, t); - }), - r - ); - })(), - jv = (function () { - function r(e, t) { - ls( - [ - as, - Fh, - function () { - return [kt, un, Ja]; - }, - ], - this, - To.call(this, e, t), - function (n) { - var i = new Ja(n.data); - onmessage = kt(i); - }, - 10 - ); - } - return r; - })(); - function Xv(r, e, t) { - if ((t || ((t = e), (e = {})), typeof t != "function")) - throw "no callback"; - return os( - r, - e, - [ - as, - Fh, - function () { - return [Qa]; - }, - ], - function (n) { - return $n(Qa(n.data[0], n.data[1])); - }, - 4, - t - ); - } - function Qa(r, e) { - e || (e = {}); - var t = xo(); - t.p(r); - var n = ui(r, e, 2, 4); - return So(n, e), ke(n, n.length - 4, t.d()), n; - } - var Nr = (function () { - function r(e) { - (this.v = 1), Et.call(this, e); - } - return ( - (r.prototype.push = function (e, t) { - if ((Et.prototype.e.call(this, e), this.v)) { - if (this.p.length < 2 && !t) return; - (this.p = this.p.subarray(2)), (this.v = 0); - } - if (t) { - if (this.p.length < 4) throw "invalid zlib stream"; - this.p = this.p.subarray(0, -4); - } - Et.prototype.c.call(this, t); - }), - r - ); - })(), - Gh = (function () { - function r(e) { - (this.ondata = e), - ls( - [ - rs, - Nh, - function () { - return [kt, Et, Nr]; - }, - ], - this, - 0, - function () { - var t = new Nr(); - onmessage = kt(t); - }, - 11 - ); - } - return r; - })(); - function Hh(r, e, t) { - if ((t || ((t = e), (e = {})), typeof t != "function")) - throw "no callback"; - return os( - r, - e, - [ - rs, - Nh, - function () { - return [Is]; - }, - ], - function (n) { - return $n(Is(n.data[0], yo(n.data[1]))); - }, - 5, - t - ); - } - function Is(r, e) { - return Vs((Oh(r), r.subarray(2, -4)), e); - } - var Wh = (function () { - function r(e) { - (this.G = Ir), (this.I = Et), (this.Z = Nr), (this.ondata = e); - } - return ( - (r.prototype.push = function (e, t) { - if (!this.ondata) throw "no stream handler"; - if (this.s) this.s.push(e, t); - else { - if (this.p && this.p.length) { - var n = new Re(this.p.length + e.length); - n.set(this.p), n.set(e, this.p.length); - } else this.p = e; - if (this.p.length > 2) { - var i = this, - s = function () { - i.ondata.apply(i, arguments); - }; - (this.s = - this.p[0] == 31 && this.p[1] == 139 && this.p[2] == 8 - ? new this.G(s) - : (this.p[0] & 15) != 8 || - this.p[0] >> 4 > 7 || - ((this.p[0] << 8) | this.p[1]) % 31 - ? new this.I(s) - : new this.Z(s)), - this.s.push(this.p, t), - (this.p = null); - } - } - }), - r - ); - })(), - qv = (function () { - function r(e) { - (this.G = Bh), (this.I = Eo), (this.Z = Gh), (this.ondata = e); - } - return ( - (r.prototype.push = function (e, t) { - Wh.prototype.push.call(this, e, t); - }), - r - ); - })(); - function $v(r, e, t) { - if ((t || ((t = e), (e = {})), typeof t != "function")) - throw "no callback"; - return r[0] == 31 && r[1] == 139 && r[2] == 8 - ? Vh(r, e, t) - : (r[0] & 15) != 8 || r[0] >> 4 > 7 || ((r[0] << 8) | r[1]) % 31 - ? Ao(r, e, t) - : Hh(r, e, t); - } - function Yv(r, e) { - return r[0] == 31 && r[1] == 139 && r[2] == 8 - ? Fr(r, e) - : (r[0] & 15) != 8 || r[0] >> 4 > 7 || ((r[0] << 8) | r[1]) % 31 - ? cs(r, e) - : Is(r, e); - } - var Co = function (r, e, t, n) { - for (var i in r) { - var s = r[i], - a = e + i; - s instanceof Re - ? (t[a] = [s, n]) - : Array.isArray(s) - ? (t[a] = [s[0], Gs(n, s[1])]) - : Co(s, a + "/", t, n); - } - }, - yc = typeof TextEncoder != "undefined" && new TextEncoder(), - eo = typeof TextDecoder != "undefined" && new TextDecoder(), - jh = 0; - try { - eo.decode(Sn, { stream: !0 }), (jh = 1); - } catch {} - var Xh = function (r) { - for (var e = "", t = 0; ; ) { - var n = r[t++], - i = (n > 127) + (n > 223) + (n > 239); - if (t + i > r.length) return [e, Ot(r, t - 1)]; - i - ? i == 3 - ? ((n = - (((n & 15) << 18) | - ((r[t++] & 63) << 12) | - ((r[t++] & 63) << 6) | - (r[t++] & 63)) - - 65536), - (e += String.fromCharCode( - 55296 | (n >> 10), - 56320 | (n & 1023) - ))) - : i & 1 - ? (e += String.fromCharCode(((n & 31) << 6) | (r[t++] & 63))) - : (e += String.fromCharCode( - ((n & 15) << 12) | ((r[t++] & 63) << 6) | (r[t++] & 63) - )) - : (e += String.fromCharCode(n)); - } - }, - Kv = (function () { - function r(e) { - (this.ondata = e), - jh ? (this.t = new TextDecoder()) : (this.p = Sn); - } - return ( - (r.prototype.push = function (e, t) { - if (!this.ondata) throw "no callback"; - if (((t = !!t), this.t)) { - if ((this.ondata(this.t.decode(e, { stream: !0 }), t), t)) { - if (this.t.decode().length) throw "invalid utf-8 data"; - this.t = null; - } - return; - } - if (!this.p) throw "stream finished"; - var n = new Re(this.p.length + e.length); - n.set(this.p), n.set(e, this.p.length); - var i = Xh(n), - s = i[0], - a = i[1]; - if (t) { - if (a.length) throw "invalid utf-8 data"; - this.p = null; - } else this.p = a; - this.ondata(s, t); - }), - r - ); - })(), - Zv = (function () { - function r(e) { - this.ondata = e; - } - return ( - (r.prototype.push = function (e, t) { - if (!this.ondata) throw "no callback"; - if (this.d) throw "stream finished"; - this.ondata(Wn(e), (this.d = t || !1)); - }), - r - ); - })(); - function Wn(r, e) { - if (e) { - for (var t = new Re(r.length), n = 0; n < r.length; ++n) - t[n] = r.charCodeAt(n); - return t; - } - if (yc) return yc.encode(r); - for ( - var i = r.length, - s = new Re(r.length + (r.length >> 1)), - a = 0, - o = function (u) { - s[a++] = u; - }, - n = 0; - n < i; - ++n - ) { - if (a + 5 > s.length) { - var l = new Re(a + 8 + ((i - n) << 1)); - l.set(s), (s = l); - } - var c = r.charCodeAt(n); - c < 128 || e - ? o(c) - : c < 2048 - ? (o(192 | (c >> 6)), o(128 | (c & 63))) - : c > 55295 && c < 57344 - ? ((c = (65536 + (c & (1023 << 10))) | (r.charCodeAt(++n) & 1023)), - o(240 | (c >> 18)), - o(128 | ((c >> 12) & 63)), - o(128 | ((c >> 6) & 63)), - o(128 | (c & 63))) - : (o(224 | (c >> 12)), o(128 | ((c >> 6) & 63)), o(128 | (c & 63))); - } - return Ot(s, 0, a); - } - function Lo(r, e) { - if (e) { - for (var t = "", n = 0; n < r.length; n += 16384) - t += String.fromCharCode.apply(null, r.subarray(n, n + 16384)); - return t; - } else { - if (eo) return eo.decode(r); - var i = Xh(r), - s = i[0], - a = i[1]; - if (a.length) throw "invalid utf-8 data"; - return s; - } - } - var qh = function (r) { - return r == 1 ? 3 : r < 6 ? 2 : r == 9 ? 1 : 0; - }, - $h = function (r, e) { - return e + 30 + yt(r, e + 26) + yt(r, e + 28); - }, - Yh = function (r, e, t) { - var n = yt(r, e + 28), - i = Lo(r.subarray(e + 46, e + 46 + n), !(yt(r, e + 8) & 2048)), - s = e + 46 + n, - a = Je(r, e + 20), - o = - t && a == 4294967295 - ? Kh(r, s) - : [a, Je(r, e + 24), Je(r, e + 42)], - l = o[0], - c = o[1], - u = o[2]; - return [yt(r, e + 10), l, c, i, s + yt(r, e + 30) + yt(r, e + 32), u]; - }, - Kh = function (r, e) { - for (; yt(r, e) != 1; e += 4 + yt(r, e + 2)); - return [La(r, e + 12), La(r, e + 4), La(r, e + 20)]; - }, - Bn = function (r) { - var e = 0; - if (r) - for (var t in r) { - var n = r[t].length; - if (n > 65535) throw "extra field too long"; - e += n + 4; - } - return e; - }, - Yi = function (r, e, t, n, i, s, a, o) { - var l = n.length, - c = t.extra, - u = o && o.length, - h = Bn(c); - ke(r, e, a != null ? 33639248 : 67324752), - (e += 4), - a != null && ((r[e++] = 20), (r[e++] = t.os)), - (r[e] = 20), - (e += 2), - (r[e++] = (t.flag << 1) | (s == null && 8)), - (r[e++] = i && 8), - (r[e++] = t.compression & 255), - (r[e++] = t.compression >> 8); - var d = new Date(t.mtime == null ? Date.now() : t.mtime), - f = d.getFullYear() - 1980; - if (f < 0 || f > 119) throw "date not in range 1980-2099"; - if ( - (ke( - r, - e, - (f << 25) | - ((d.getMonth() + 1) << 21) | - (d.getDate() << 16) | - (d.getHours() << 11) | - (d.getMinutes() << 5) | - (d.getSeconds() >>> 1) - ), - (e += 4), - s != null && - (ke(r, e, t.crc), ke(r, e + 4, s), ke(r, e + 8, t.size)), - ke(r, e + 12, l), - ke(r, e + 14, h), - (e += 16), - a != null && - (ke(r, e, u), ke(r, e + 6, t.attrs), ke(r, e + 10, a), (e += 14)), - r.set(n, e), - (e += l), - h) - ) - for (var g in c) { - var m = c[g], - p = m.length; - ke(r, e, +g), ke(r, e + 2, p), r.set(m, e + 4), (e += 4 + p); - } - return u && (r.set(o, e), (e += u)), e; - }, - Ro = function (r, e, t, n, i) { - ke(r, e, 101010256), - ke(r, e + 8, t), - ke(r, e + 10, t), - ke(r, e + 12, n), - ke(r, e + 16, i); - }, - Fs = (function () { - function r(e) { - (this.filename = e), - (this.c = ss()), - (this.size = 0), - (this.compression = 0); - } - return ( - (r.prototype.process = function (e, t) { - this.ondata(null, e, t); - }), - (r.prototype.push = function (e, t) { - if (!this.ondata) - throw "no callback - add to ZIP archive before pushing"; - this.c.p(e), - (this.size += e.length), - t && (this.crc = this.c.d()), - this.process(e, t || !1); - }), - r - ); - })(), - Jv = (function () { - function r(e, t) { - var n = this; - t || (t = {}), - Fs.call(this, e), - (this.d = new un(t, function (i, s) { - n.ondata(null, i, s); - })), - (this.compression = 8), - (this.flag = qh(t.level)); - } - return ( - (r.prototype.process = function (e, t) { - try { - this.d.push(e, t); - } catch (n) { - this.ondata(n, null, t); - } - }), - (r.prototype.push = function (e, t) { - Fs.prototype.push.call(this, e, t); - }), - r - ); - })(), - Qv = (function () { - function r(e, t) { - var n = this; - t || (t = {}), - Fs.call(this, e), - (this.d = new kh(t, function (i, s, a) { - n.ondata(i, s, a); - })), - (this.compression = 8), - (this.flag = qh(t.level)), - (this.terminate = this.d.terminate); - } - return ( - (r.prototype.process = function (e, t) { - this.d.push(e, t); - }), - (r.prototype.push = function (e, t) { - Fs.prototype.push.call(this, e, t); - }), - r - ); - })(), - e_ = (function () { - function r(e) { - (this.ondata = e), (this.u = []), (this.d = 1); - } - return ( - (r.prototype.add = function (e) { - var t = this; - if (this.d & 2) throw "stream finished"; - var n = Wn(e.filename), - i = n.length, - s = e.comment, - a = s && Wn(s), - o = i != e.filename.length || (a && s.length != a.length), - l = i + Bn(e.extra) + 30; - if (i > 65535) throw "filename too long"; - var c = new Re(l); - Yi(c, 0, e, n, o); - var u = [c], - h = function () { - for (var p = 0, v = u; p < v.length; p++) { - var M = v[p]; - t.ondata(null, M, !1); - } - u = []; - }, - d = this.d; - this.d = 0; - var f = this.u.length, - g = Gs(e, { - f: n, - u: o, - o: a, - t: function () { - e.terminate && e.terminate(); - }, - r: function () { - if ((h(), d)) { - var p = t.u[f + 1]; - p ? p.r() : (t.d = 1); - } - d = 1; - }, - }), - m = 0; - (e.ondata = function (p, v, M) { - if (p) t.ondata(p, v, M), t.terminate(); - else if (((m += v.length), u.push(v), M)) { - var x = new Re(16); - ke(x, 0, 134695760), - ke(x, 4, e.crc), - ke(x, 8, m), - ke(x, 12, e.size), - u.push(x), - (g.c = m), - (g.b = l + m + 16), - (g.crc = e.crc), - (g.size = e.size), - d && g.r(), - (d = 1); - } else d && h(); - }), - this.u.push(g); - }), - (r.prototype.end = function () { - var e = this; - if (this.d & 2) - throw this.d & 1 ? "stream finishing" : "stream finished"; - this.d - ? this.e() - : this.u.push({ - r: function () { - !(e.d & 1) || (e.u.splice(-1, 1), e.e()); - }, - t: function () {}, - }), - (this.d = 3); - }), - (r.prototype.e = function () { - for ( - var e = 0, t = 0, n = 0, i = 0, s = this.u; - i < s.length; - i++ - ) { - var a = s[i]; - n += 46 + a.f.length + Bn(a.extra) + (a.o ? a.o.length : 0); - } - for ( - var o = new Re(n + 22), l = 0, c = this.u; - l < c.length; - l++ - ) { - var a = c[l]; - Yi(o, e, a, a.f, a.u, a.c, t, a.o), - (e += 46 + a.f.length + Bn(a.extra) + (a.o ? a.o.length : 0)), - (t += a.b); - } - Ro(o, e, this.u.length, n, t), - this.ondata(null, o, !0), - (this.d = 2); - }), - (r.prototype.terminate = function () { - for (var e = 0, t = this.u; e < t.length; e++) { - var n = t[e]; - n.t(); - } - this.d = 2; - }), - r - ); - })(); - function t_(r, e, t) { - if ((t || ((t = e), (e = {})), typeof t != "function")) - throw "no callback"; - var n = {}; - Co(r, "", n, e); - var i = Object.keys(n), - s = i.length, - a = 0, - o = 0, - l = s, - c = new Array(s), - u = [], - h = function () { - for (var m = 0; m < u.length; ++m) u[m](); - }, - d = function () { - var m = new Re(o + 22), - p = a, - v = o - a; - o = 0; - for (var M = 0; M < l; ++M) { - var x = c[M]; - try { - var w = x.c.length; - Yi(m, o, x, x.f, x.u, w); - var y = 30 + x.f.length + Bn(x.extra), - A = o + y; - m.set(x.c, A), - Yi(m, a, x, x.f, x.u, w, o, x.m), - (a += 16 + y + (x.m ? x.m.length : 0)), - (o = A + w); - } catch (L) { - return t(L, null); - } - } - Ro(m, a, c.length, v, p), t(null, m); - }; - s || d(); - for ( - var f = function (m) { - var p = i[m], - v = n[p], - M = v[0], - x = v[1], - w = ss(), - y = M.length; - w.p(M); - var A = Wn(p), - L = A.length, - _ = x.comment, - T = _ && Wn(_), - I = T && T.length, - F = Bn(x.extra), - H = x.level == 0 ? 0 : 8, - B = function (D, z) { - if (D) h(), t(D, null); - else { - var N = z.length; - (c[m] = Gs(x, { - size: y, - crc: w.d(), - c: z, - f: A, - m: T, - u: L != p.length || (T && _.length != I), - compression: H, - })), - (a += 30 + L + F + N), - (o += 76 + 2 * (L + F) + (I || 0) + N), - --s || d(); - } - }; - if ((L > 65535 && B("filename too long", null), !H)) B(null, M); - else if (y < 16e4) - try { - B(null, Hs(M, x)); - } catch (D) { - B(D, null); - } - else u.push(Uh(M, x, B)); - }, - g = 0; - g < l; - ++g - ) - f(g); - return h; - } - function n_(r, e) { - e || (e = {}); - var t = {}, - n = []; - Co(r, "", t, e); - var i = 0, - s = 0; - for (var a in t) { - var o = t[a], - l = o[0], - c = o[1], - u = c.level == 0 ? 0 : 8, - h = Wn(a), - d = h.length, - f = c.comment, - g = f && Wn(f), - m = g && g.length, - p = Bn(c.extra); - if (d > 65535) throw "filename too long"; - var v = u ? Hs(l, c) : l, - M = v.length, - x = ss(); - x.p(l), - n.push( - Gs(c, { - size: l.length, - crc: x.d(), - c: v, - f: h, - m: g, - u: d != a.length || (g && f.length != m), - o: i, - compression: u, - }) - ), - (i += 30 + d + p + M), - (s += 76 + 2 * (d + p) + (m || 0) + M); - } - for ( - var w = new Re(s + 22), y = i, A = s - i, L = 0; - L < n.length; - ++L - ) { - var h = n[L]; - Yi(w, h.o, h, h.f, h.u, h.c.length); - var _ = 30 + h.f.length + Bn(h.extra); - w.set(h.c, h.o + _), - Yi(w, i, h, h.f, h.u, h.c.length, h.o, h.m), - (i += 16 + _ + (h.m ? h.m.length : 0)); - } - return Ro(w, i, n.length, A, y), w; - } - var Zh = (function () { - function r() {} - return ( - (r.prototype.push = function (e, t) { - this.ondata(null, e, t); - }), - (r.compression = 0), - r - ); - })(), - i_ = (function () { - function r() { - var e = this; - this.i = new Et(function (t, n) { - e.ondata(null, t, n); - }); - } - return ( - (r.prototype.push = function (e, t) { - try { - this.i.push(e, t); - } catch (n) { - this.ondata(n, e, t); - } - }), - (r.compression = 8), - r - ); - })(), - s_ = (function () { - function r(e, t) { - var n = this; - t < 32e4 - ? (this.i = new Et(function (i, s) { - n.ondata(null, i, s); - })) - : ((this.i = new Eo(function (i, s, a) { - n.ondata(i, s, a); - })), - (this.terminate = this.i.terminate)); - } - return ( - (r.prototype.push = function (e, t) { - this.i.terminate && (e = Ot(e, 0)), this.i.push(e, t); - }), - (r.compression = 8), - r - ); - })(), - r_ = (function () { - function r(e) { - (this.onfile = e), - (this.k = []), - (this.o = { 0: Zh }), - (this.p = Sn); - } - return ( - (r.prototype.push = function (e, t) { - var n = this; - if (!this.onfile) throw "no callback"; - if (!this.p) throw "stream finished"; - if (this.c > 0) { - var i = Math.min(this.c, e.length), - s = e.subarray(0, i); - if ( - ((this.c -= i), - this.d ? this.d.push(s, !this.c) : this.k[0].push(s), - (e = e.subarray(i)), - e.length) - ) - return this.push(e, t); - } else { - var a = 0, - o = 0, - l = void 0, - c = void 0; - this.p.length - ? e.length - ? ((c = new Re(this.p.length + e.length)), - c.set(this.p), - c.set(e, this.p.length)) - : (c = this.p) - : (c = e); - for ( - var u = c.length, - h = this.c, - d = h && this.d, - f = function () { - var v, - M = Je(c, o); - if (M == 67324752) { - (a = 1), (l = o), (g.d = null), (g.c = 0); - var x = yt(c, o + 6), - w = yt(c, o + 8), - y = x & 2048, - A = x & 8, - L = yt(c, o + 26), - _ = yt(c, o + 28); - if (u > o + 30 + L + _) { - var T = []; - g.k.unshift(T), (a = 2); - var I = Je(c, o + 18), - F = Je(c, o + 22), - H = Lo(c.subarray(o + 30, (o += 30 + L)), !y); - I == 4294967295 - ? ((v = A ? [-2] : Kh(c, o)), - (I = v[0]), - (F = v[1])) - : A && (I = -1), - (o += _), - (g.c = I); - var B, - D = { - name: H, - compression: w, - start: function () { - if (!D.ondata) throw "no callback"; - if (!I) D.ondata(null, Sn, !0); - else { - var z = n.o[w]; - if (!z) throw "unknown compression type " + w; - (B = I < 0 ? new z(H) : new z(H, I, F)), - (B.ondata = function (U, X, Z) { - D.ondata(U, X, Z); - }); - for (var N = 0, k = T; N < k.length; N++) { - var G = k[N]; - B.push(G, !1); - } - n.k[0] == T && n.c - ? (n.d = B) - : B.push(Sn, !0); - } - }, - terminate: function () { - B && B.terminate && B.terminate(); - }, - }; - I >= 0 && ((D.size = I), (D.originalSize = F)), - g.onfile(D); - } - return "break"; - } else if (h) { - if (M == 134695760) - return ( - (l = o += 12 + (h == -2 && 8)), - (a = 3), - (g.c = 0), - "break" - ); - if (M == 33639248) - return (l = o -= 4), (a = 3), (g.c = 0), "break"; - } - }, - g = this; - o < u - 4; - ++o - ) { - var m = f(); - if (m === "break") break; - } - if (((this.p = Sn), h < 0)) { - var p = a - ? c.subarray( - 0, - l - - 12 - - (h == -2 && 8) - - (Je(c, l - 16) == 134695760 && 4) - ) - : c.subarray(0, o); - d ? d.push(p, !!a) : this.k[+(a == 2)].push(p); - } - if (a & 2) return this.push(c.subarray(o), t); - this.p = c.subarray(o); - } - if (t) { - if (this.c) throw "invalid zip file"; - this.p = null; - } - }), - (r.prototype.register = function (e) { - this.o[e.compression] = e; - }), - r - ); - })(); - function a_(r, e) { - if (typeof e != "function") throw "no callback"; - for ( - var t = [], - n = function () { - for (var d = 0; d < t.length; ++d) t[d](); - }, - i = {}, - s = r.length - 22; - Je(r, s) != 101010256; - --s - ) - if (!s || r.length - s > 65558) { - e("invalid zip file", null); - return; - } - var a = yt(r, s + 8); - a || e(null, {}); - var o = a, - l = Je(r, s + 16), - c = l == 4294967295; - if (c) { - if (((s = Je(r, s - 12)), Je(r, s) != 101075792)) { - e("invalid zip file", null); - return; - } - (o = a = Je(r, s + 32)), (l = Je(r, s + 48)); - } - for ( - var u = function (d) { - var f = Yh(r, l, c), - g = f[0], - m = f[1], - p = f[2], - v = f[3], - M = f[4], - x = f[5], - w = $h(r, x); - l = M; - var y = function (L, _) { - L ? (n(), e(L, null)) : ((i[v] = _), --a || e(null, i)); - }; - if (!g) y(null, Ot(r, w, w + m)); - else if (g == 8) { - var A = r.subarray(w, w + m); - if (m < 32e4) - try { - y(null, cs(A, new Re(p))); - } catch (L) { - y(L, null); - } - else t.push(Ao(A, { size: p }, y)); - } else y("unknown compression type " + g, null); - }, - h = 0; - h < o; - ++h - ) - u(); - return n; - } - function o_(r) { - for (var e = {}, t = r.length - 22; Je(r, t) != 101010256; --t) - if (!t || r.length - t > 65558) throw "invalid zip file"; - var n = yt(r, t + 8); - if (!n) return {}; - var i = Je(r, t + 16), - s = i == 4294967295; - if (s) { - if (((t = Je(r, t - 12)), Je(r, t) != 101075792)) - throw "invalid zip file"; - (n = Je(r, t + 32)), (i = Je(r, t + 48)); - } - for (var a = 0; a < n; ++a) { - var o = Yh(r, i, s), - l = o[0], - c = o[1], - u = o[2], - h = o[3], - d = o[4], - f = o[5], - g = $h(r, f); - if (((i = d), !l)) e[h] = Ot(r, g, g + c); - else if (l == 8) e[h] = cs(r.subarray(g, g + c), new Re(u)); - else throw "unknown compression type " + l; - } - return e; - } - var l_ = Object.freeze( - Object.defineProperty( - { - __proto__: null, - Deflate: un, - AsyncDeflate: kh, - deflate: Uh, - deflateSync: Hs, - Inflate: Et, - AsyncInflate: Eo, - inflate: Ao, - inflateSync: cs, - Gzip: Pr, - AsyncGzip: _c, - gzip: xc, - gzipSync: Dr, - Gunzip: Ir, - AsyncGunzip: Bh, - gunzip: Vh, - gunzipSync: Fr, - Zlib: Ja, - AsyncZlib: jv, - zlib: Xv, - zlibSync: Qa, - Unzlib: Nr, - AsyncUnzlib: Gh, - unzlib: Hh, - unzlibSync: Is, - compress: xc, - AsyncCompress: _c, - compressSync: Dr, - Compress: Pr, - Decompress: Wh, - AsyncDecompress: qv, - decompress: $v, - decompressSync: Yv, - DecodeUTF8: Kv, - EncodeUTF8: Zv, - strToU8: Wn, - strFromU8: Lo, - ZipPassThrough: Fs, - ZipDeflate: Jv, - AsyncZipDeflate: Qv, - Zip: e_, - zip: t_, - zipSync: n_, - UnzipPassThrough: Zh, - UnzipInflate: i_, - AsyncUnzipInflate: s_, - Unzip: r_, - unzip: a_, - unzipSync: o_, - }, - Symbol.toStringTag, - { value: "Module" } - ) - ); - function Jh(r, e, t) { - const n = t.length - r - 1; - if (e >= t[n]) return n - 1; - if (e <= t[r]) return r; - let i = r, - s = n, - a = Math.floor((i + s) / 2); - for (; e < t[a] || e >= t[a + 1]; ) - e < t[a] ? (s = a) : (i = a), (a = Math.floor((i + s) / 2)); - return a; - } - function c_(r, e, t, n) { - const i = [], - s = [], - a = []; - i[0] = 1; - for (let o = 1; o <= t; ++o) { - (s[o] = e - n[r + 1 - o]), (a[o] = n[r + o] - e); - let l = 0; - for (let c = 0; c < o; ++c) { - const u = a[c + 1], - h = s[o - c], - d = i[c] / (u + h); - (i[c] = l + u * d), (l = h * d); - } - i[o] = l; - } - return i; - } - function h_(r, e, t, n) { - const i = Jh(r, n, e), - s = c_(i, n, r, e), - a = new Ue(0, 0, 0, 0); - for (let o = 0; o <= r; ++o) { - const l = t[i - r + o], - c = s[o], - u = l.w * c; - (a.x += l.x * u), - (a.y += l.y * u), - (a.z += l.z * u), - (a.w += l.w * c); - } - return a; - } - function u_(r, e, t, n, i) { - const s = []; - for (let h = 0; h <= t; ++h) s[h] = 0; - const a = []; - for (let h = 0; h <= n; ++h) a[h] = s.slice(0); - const o = []; - for (let h = 0; h <= t; ++h) o[h] = s.slice(0); - o[0][0] = 1; - const l = s.slice(0), - c = s.slice(0); - for (let h = 1; h <= t; ++h) { - (l[h] = e - i[r + 1 - h]), (c[h] = i[r + h] - e); - let d = 0; - for (let f = 0; f < h; ++f) { - const g = c[f + 1], - m = l[h - f]; - o[h][f] = g + m; - const p = o[f][h - 1] / o[h][f]; - (o[f][h] = d + g * p), (d = m * p); - } - o[h][h] = d; - } - for (let h = 0; h <= t; ++h) a[0][h] = o[h][t]; - for (let h = 0; h <= t; ++h) { - let d = 0, - f = 1; - const g = []; - for (let m = 0; m <= t; ++m) g[m] = s.slice(0); - g[0][0] = 1; - for (let m = 1; m <= n; ++m) { - let p = 0; - const v = h - m, - M = t - m; - h >= m && - ((g[f][0] = g[d][0] / o[M + 1][v]), (p = g[f][0] * o[v][M])); - const x = v >= -1 ? 1 : -v, - w = h - 1 <= M ? m - 1 : t - h; - for (let A = x; A <= w; ++A) - (g[f][A] = (g[d][A] - g[d][A - 1]) / o[M + 1][v + A]), - (p += g[f][A] * o[v + A][M]); - h <= M && - ((g[f][m] = -g[d][m - 1] / o[M + 1][h]), - (p += g[f][m] * o[h][M])), - (a[m][h] = p); - const y = d; - (d = f), (f = y); - } - } - let u = t; - for (let h = 1; h <= n; ++h) { - for (let d = 0; d <= t; ++d) a[h][d] *= u; - u *= t - h; - } - return a; - } - function d_(r, e, t, n, i) { - const s = i < r ? i : r, - a = [], - o = Jh(r, n, e), - l = u_(o, n, r, s, e), - c = []; - for (let u = 0; u < t.length; ++u) { - const h = t[u].clone(), - d = h.w; - (h.x *= d), (h.y *= d), (h.z *= d), (c[u] = h); - } - for (let u = 0; u <= s; ++u) { - const h = c[o - r].clone().multiplyScalar(l[u][0]); - for (let d = 1; d <= r; ++d) - h.add(c[o - r + d].clone().multiplyScalar(l[u][d])); - a[u] = h; - } - for (let u = s + 1; u <= i + 1; ++u) a[u] = new Ue(0, 0, 0); - return a; - } - function f_(r, e) { - let t = 1; - for (let i = 2; i <= r; ++i) t *= i; - let n = 1; - for (let i = 2; i <= e; ++i) n *= i; - for (let i = 2; i <= r - e; ++i) n *= i; - return t / n; - } - function p_(r) { - const e = r.length, - t = [], - n = []; - for (let s = 0; s < e; ++s) { - const a = r[s]; - (t[s] = new P(a.x, a.y, a.z)), (n[s] = a.w); - } - const i = []; - for (let s = 0; s < e; ++s) { - const a = t[s].clone(); - for (let o = 1; o <= s; ++o) - a.sub(i[s - o].clone().multiplyScalar(f_(s, o) * n[o])); - i[s] = a.divideScalar(n[0]); - } - return i; - } - function m_(r, e, t, n, i) { - const s = d_(r, e, t, n, i); - return p_(s); - } - class Mc extends _0 { - constructor(e, t, n, i, s) { - super(), - (this.degree = e), - (this.knots = t), - (this.controlPoints = []), - (this.startKnot = i || 0), - (this.endKnot = s || this.knots.length - 1); - for (let a = 0; a < n.length; ++a) { - const o = n[a]; - this.controlPoints[a] = new Ue(o.x, o.y, o.z, o.w); - } - } - getPoint(e, t = new P()) { - const n = t, - i = - this.knots[this.startKnot] + - e * (this.knots[this.endKnot] - this.knots[this.startKnot]), - s = h_(this.degree, this.knots, this.controlPoints, i); - return s.w !== 1 && s.divideScalar(s.w), n.set(s.x, s.y, s.z); - } - getTangent(e, t = new P()) { - const n = t, - i = - this.knots[0] + - e * (this.knots[this.knots.length - 1] - this.knots[0]), - s = m_(this.degree, this.knots, this.controlPoints, i, 1); - return n.copy(s[1]).normalize(), n; - } - } - let Ce, Ze, Tt; - class g_ extends qn { - constructor(e) { - super(e); - } - load(e, t, n, i) { - const s = this, - a = s.path === "" ? on.extractUrlBase(e) : s.path, - o = new qi(this.manager); - o.setPath(s.path), - o.setResponseType("arraybuffer"), - o.setRequestHeader(s.requestHeader), - o.setWithCredentials(s.withCredentials), - o.load( - e, - function (l) { - try { - t(s.parse(l, a)); - } catch (c) { - i ? i(c) : console.error(c), s.manager.itemError(e); - } - }, - n, - i - ); - } - parse(e, t) { - if (w_(e)) Ce = new M_().parse(e); - else { - const i = nu(e); - if (!b_(i)) throw new Error("THREE.FBXLoader: Unknown format."); - if (bc(i) < 7e3) - throw new Error( - "THREE.FBXLoader: FBX version not supported, FileVersion: " + - bc(i) - ); - Ce = new y_().parse(i); - } - const n = new uh(this.manager) - .setPath(this.resourcePath || t) - .setCrossOrigin(this.crossOrigin); - return new v_(n, this.manager).parse(Ce); - } - } - class v_ { - constructor(e, t) { - (this.textureLoader = e), (this.manager = t); - } - parse() { - Ze = this.parseConnections(); - const e = this.parseImages(), - t = this.parseTextures(e), - n = this.parseMaterials(t), - i = this.parseDeformers(), - s = new __().parse(i); - return this.parseScene(i, s, n), Tt; - } - parseConnections() { - const e = new Map(); - return ( - "Connections" in Ce && - Ce.Connections.connections.forEach(function (n) { - const i = n[0], - s = n[1], - a = n[2]; - e.has(i) || e.set(i, { parents: [], children: [] }); - const o = { ID: s, relationship: a }; - e.get(i).parents.push(o), - e.has(s) || e.set(s, { parents: [], children: [] }); - const l = { ID: i, relationship: a }; - e.get(s).children.push(l); - }), - e - ); - } - parseImages() { - const e = {}, - t = {}; - if ("Video" in Ce.Objects) { - const n = Ce.Objects.Video; - for (const i in n) { - const s = n[i], - a = parseInt(i); - if (((e[a] = s.RelativeFilename || s.Filename), "Content" in s)) { - const o = - s.Content instanceof ArrayBuffer && - s.Content.byteLength > 0, - l = typeof s.Content == "string" && s.Content !== ""; - if (o || l) { - const c = this.parseImage(n[i]); - t[s.RelativeFilename || s.Filename] = c; - } - } - } - } - for (const n in e) { - const i = e[n]; - t[i] !== void 0 ? (e[n] = t[i]) : (e[n] = e[n].split("\\").pop()); - } - return e; - } - parseImage(e) { - const t = e.Content, - n = e.RelativeFilename || e.Filename, - i = n.slice(n.lastIndexOf(".") + 1).toLowerCase(); - let s; - switch (i) { - case "bmp": - s = "image/bmp"; - break; - case "jpg": - case "jpeg": - s = "image/jpeg"; - break; - case "png": - s = "image/png"; - break; - case "tif": - s = "image/tiff"; - break; - case "tga": - this.manager.getHandler(".tga") === null && - console.warn("FBXLoader: TGA loader not found, skipping ", n), - (s = "image/tga"); - break; - default: - console.warn( - 'FBXLoader: Image type "' + i + '" is not supported.' - ); - return; - } - if (typeof t == "string") return "data:" + s + ";base64," + t; - { - const a = new Uint8Array(t); - return window.URL.createObjectURL(new Blob([a], { type: s })); - } - } - parseTextures(e) { - const t = new Map(); - if ("Texture" in Ce.Objects) { - const n = Ce.Objects.Texture; - for (const i in n) { - const s = this.parseTexture(n[i], e); - t.set(parseInt(i), s); - } - } - return t; - } - parseTexture(e, t) { - const n = this.loadTexture(e, t); - (n.ID = e.id), (n.name = e.attrName); - const i = e.WrapModeU, - s = e.WrapModeV, - a = i !== void 0 ? i.value : 0, - o = s !== void 0 ? s.value : 0; - if ( - ((n.wrapS = a === 0 ? hn : gt), - (n.wrapT = o === 0 ? hn : gt), - "Scaling" in e) - ) { - const l = e.Scaling.value; - (n.repeat.x = l[0]), (n.repeat.y = l[1]); - } - if ("Translation" in e) { - const l = e.Translation.value; - (n.offset.x = l[0]), (n.offset.y = l[1]); - } - return n; - } - loadTexture(e, t) { - let n; - const i = this.textureLoader.path, - s = Ze.get(e.id).children; - s !== void 0 && - s.length > 0 && - t[s[0].ID] !== void 0 && - ((n = t[s[0].ID]), - (n.indexOf("blob:") === 0 || n.indexOf("data:") === 0) && - this.textureLoader.setPath(void 0)); - let a; - const o = e.FileName.slice(-3).toLowerCase(); - if (o === "tga") { - const l = this.manager.getHandler(".tga"); - l === null - ? (console.warn( - "FBXLoader: TGA loader not found, creating placeholder texture for", - e.RelativeFilename - ), - (a = new nt())) - : (l.setPath(this.textureLoader.path), (a = l.load(n))); - } else - o === "psd" - ? (console.warn( - "FBXLoader: PSD textures are not supported, creating placeholder texture for", - e.RelativeFilename - ), - (a = new nt())) - : (a = this.textureLoader.load(n)); - return this.textureLoader.setPath(i), a; - } - parseMaterials(e) { - const t = new Map(); - if ("Material" in Ce.Objects) { - const n = Ce.Objects.Material; - for (const i in n) { - const s = this.parseMaterial(n[i], e); - s !== null && t.set(parseInt(i), s); - } - } - return t; - } - parseMaterial(e, t) { - const n = e.id, - i = e.attrName; - let s = e.ShadingModel; - if ((typeof s == "object" && (s = s.value), !Ze.has(n))) return null; - const a = this.parseParameters(e, t, n); - let o; - switch (s.toLowerCase()) { - case "phong": - o = new xr(); - break; - case "lambert": - o = new lh(); - break; - default: - console.warn( - 'THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.', - s - ), - (o = new xr()); - break; - } - return o.setValues(a), (o.name = i), o; - } - parseParameters(e, t, n) { - const i = {}; - e.BumpFactor && (i.bumpScale = e.BumpFactor.value), - e.Diffuse - ? (i.color = new de().fromArray(e.Diffuse.value)) - : e.DiffuseColor && - (e.DiffuseColor.type === "Color" || - e.DiffuseColor.type === "ColorRGB") && - (i.color = new de().fromArray(e.DiffuseColor.value)), - e.DisplacementFactor && - (i.displacementScale = e.DisplacementFactor.value), - e.Emissive - ? (i.emissive = new de().fromArray(e.Emissive.value)) - : e.EmissiveColor && - (e.EmissiveColor.type === "Color" || - e.EmissiveColor.type === "ColorRGB") && - (i.emissive = new de().fromArray(e.EmissiveColor.value)), - e.EmissiveFactor && - (i.emissiveIntensity = parseFloat(e.EmissiveFactor.value)), - e.Opacity && (i.opacity = parseFloat(e.Opacity.value)), - i.opacity < 1 && (i.transparent = !0), - e.ReflectionFactor && (i.reflectivity = e.ReflectionFactor.value), - e.Shininess && (i.shininess = e.Shininess.value), - e.Specular - ? (i.specular = new de().fromArray(e.Specular.value)) - : e.SpecularColor && - e.SpecularColor.type === "Color" && - (i.specular = new de().fromArray(e.SpecularColor.value)); - const s = this; - return ( - Ze.get(n).children.forEach(function (a) { - const o = a.relationship; - switch (o) { - case "Bump": - i.bumpMap = s.getTexture(t, a.ID); - break; - case "Maya|TEX_ao_map": - i.aoMap = s.getTexture(t, a.ID); - break; - case "DiffuseColor": - case "Maya|TEX_color_map": - (i.map = s.getTexture(t, a.ID)), - i.map !== void 0 && (i.map.encoding = Pe); - break; - case "DisplacementColor": - i.displacementMap = s.getTexture(t, a.ID); - break; - case "EmissiveColor": - (i.emissiveMap = s.getTexture(t, a.ID)), - i.emissiveMap !== void 0 && (i.emissiveMap.encoding = Pe); - break; - case "NormalMap": - case "Maya|TEX_normal_map": - i.normalMap = s.getTexture(t, a.ID); - break; - case "ReflectionColor": - (i.envMap = s.getTexture(t, a.ID)), - i.envMap !== void 0 && - ((i.envMap.mapping = Tr), (i.envMap.encoding = Pe)); - break; - case "SpecularColor": - (i.specularMap = s.getTexture(t, a.ID)), - i.specularMap !== void 0 && (i.specularMap.encoding = Pe); - break; - case "TransparentColor": - case "TransparencyFactor": - (i.alphaMap = s.getTexture(t, a.ID)), (i.transparent = !0); - break; - case "AmbientColor": - case "ShininessExponent": - case "SpecularFactor": - case "VectorDisplacementColor": - default: - console.warn( - "THREE.FBXLoader: %s map is not supported in three.js, skipping texture.", - o - ); - break; - } - }), - i - ); - } - getTexture(e, t) { - return ( - "LayeredTexture" in Ce.Objects && - t in Ce.Objects.LayeredTexture && - (console.warn( - "THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer." - ), - (t = Ze.get(t).children[0].ID)), - e.get(t) - ); - } - parseDeformers() { - const e = {}, - t = {}; - if ("Deformer" in Ce.Objects) { - const n = Ce.Objects.Deformer; - for (const i in n) { - const s = n[i], - a = Ze.get(parseInt(i)); - if (s.attrType === "Skin") { - const o = this.parseSkeleton(a, n); - (o.ID = i), - a.parents.length > 1 && - console.warn( - "THREE.FBXLoader: skeleton attached to more than one geometry is not supported." - ), - (o.geometryID = a.parents[0].ID), - (e[i] = o); - } else if (s.attrType === "BlendShape") { - const o = { id: i }; - (o.rawTargets = this.parseMorphTargets(a, n)), - (o.id = i), - a.parents.length > 1 && - console.warn( - "THREE.FBXLoader: morph target attached to more than one geometry is not supported." - ), - (t[i] = o); - } - } - } - return { skeletons: e, morphTargets: t }; - } - parseSkeleton(e, t) { - const n = []; - return ( - e.children.forEach(function (i) { - const s = t[i.ID]; - if (s.attrType !== "Cluster") return; - const a = { - ID: i.ID, - indices: [], - weights: [], - transformLink: new pe().fromArray(s.TransformLink.a), - }; - "Indexes" in s && - ((a.indices = s.Indexes.a), (a.weights = s.Weights.a)), - n.push(a); - }), - { rawBones: n, bones: [] } - ); - } - parseMorphTargets(e, t) { - const n = []; - for (let i = 0; i < e.children.length; i++) { - const s = e.children[i], - a = t[s.ID], - o = { - name: a.attrName, - initialWeight: a.DeformPercent, - id: a.id, - fullWeights: a.FullWeights.a, - }; - if (a.attrType !== "BlendShapeChannel") return; - (o.geoID = Ze.get(parseInt(s.ID)).children.filter(function (l) { - return l.relationship === void 0; - })[0].ID), - n.push(o); - } - return n; - } - parseScene(e, t, n) { - Tt = new bn(); - const i = this.parseModels(e.skeletons, t, n), - s = Ce.Objects.Model, - a = this; - i.forEach(function (l) { - const c = s[l.ID]; - a.setLookAtProperties(l, c), - Ze.get(l.ID).parents.forEach(function (h) { - const d = i.get(h.ID); - d !== void 0 && d.add(l); - }), - l.parent === null && Tt.add(l); - }), - this.bindSkeleton(e.skeletons, t, i), - this.createAmbientLight(), - Tt.traverse(function (l) { - if (l.userData.transformData) { - l.parent && - ((l.userData.transformData.parentMatrix = l.parent.matrix), - (l.userData.transformData.parentMatrixWorld = - l.parent.matrixWorld)); - const c = eu(l.userData.transformData); - l.applyMatrix4(c), l.updateWorldMatrix(); - } - }); - const o = new x_().parse(); - Tt.children.length === 1 && - Tt.children[0].isGroup && - ((Tt.children[0].animations = o), (Tt = Tt.children[0])), - (Tt.animations = o); - } - parseModels(e, t, n) { - const i = new Map(), - s = Ce.Objects.Model; - for (const a in s) { - const o = parseInt(a), - l = s[a], - c = Ze.get(o); - let u = this.buildSkeleton(c, e, o, l.attrName); - if (!u) { - switch (l.attrType) { - case "Camera": - u = this.createCamera(c); - break; - case "Light": - u = this.createLight(c); - break; - case "Mesh": - u = this.createMesh(c, t, n); - break; - case "NurbsCurve": - u = this.createCurve(c, t); - break; - case "LimbNode": - case "Root": - u = new Cr(); - break; - case "Null": - default: - u = new bn(); - break; - } - (u.name = l.attrName ? Ne.sanitizeNodeName(l.attrName) : ""), - (u.ID = o); - } - this.getTransformData(u, l), i.set(o, u); - } - return i; - } - buildSkeleton(e, t, n, i) { - let s = null; - return ( - e.parents.forEach(function (a) { - for (const o in t) { - const l = t[o]; - l.rawBones.forEach(function (c, u) { - if (c.ID === a.ID) { - const h = s; - (s = new Cr()), - s.matrixWorld.copy(c.transformLink), - (s.name = i ? Ne.sanitizeNodeName(i) : ""), - (s.ID = n), - (l.bones[u] = s), - h !== null && s.add(h); - } - }); - } - }), - s - ); - } - createCamera(e) { - let t, n; - if ( - (e.children.forEach(function (i) { - const s = Ce.Objects.NodeAttribute[i.ID]; - s !== void 0 && (n = s); - }), - n === void 0) - ) - t = new Ye(); - else { - let i = 0; - n.CameraProjectionType !== void 0 && - n.CameraProjectionType.value === 1 && - (i = 1); - let s = 1; - n.NearPlane !== void 0 && (s = n.NearPlane.value / 1e3); - let a = 1e3; - n.FarPlane !== void 0 && (a = n.FarPlane.value / 1e3); - let o = window.innerWidth, - l = window.innerHeight; - n.AspectWidth !== void 0 && - n.AspectHeight !== void 0 && - ((o = n.AspectWidth.value), (l = n.AspectHeight.value)); - const c = o / l; - let u = 45; - n.FieldOfView !== void 0 && (u = n.FieldOfView.value); - const h = n.FocalLength ? n.FocalLength.value : null; - switch (i) { - case 0: - (t = new mt(u, c, s, a)), h !== null && t.setFocalLength(h); - break; - case 1: - t = new zs(-o / 2, o / 2, l / 2, -l / 2, s, a); - break; - default: - console.warn("THREE.FBXLoader: Unknown camera type " + i + "."), - (t = new Ye()); - break; - } - } - return t; - } - createLight(e) { - let t, n; - if ( - (e.children.forEach(function (i) { - const s = Ce.Objects.NodeAttribute[i.ID]; - s !== void 0 && (n = s); - }), - n === void 0) - ) - t = new Ye(); - else { - let i; - n.LightType === void 0 ? (i = 0) : (i = n.LightType.value); - let s = 16777215; - n.Color !== void 0 && (s = new de().fromArray(n.Color.value)); - let a = n.Intensity === void 0 ? 1 : n.Intensity.value / 100; - n.CastLightOnObject !== void 0 && - n.CastLightOnObject.value === 0 && - (a = 0); - let o = 0; - n.FarAttenuationEnd !== void 0 && - (n.EnableFarAttenuation !== void 0 && - n.EnableFarAttenuation.value === 0 - ? (o = 0) - : (o = n.FarAttenuationEnd.value)); - const l = 1; - switch (i) { - case 0: - t = new Ha(s, a, o, l); - break; - case 1: - t = new fh(s, a); - break; - case 2: - let c = Math.PI / 3; - n.InnerAngle !== void 0 && - (c = jt.degToRad(n.InnerAngle.value)); - let u = 0; - n.OuterAngle !== void 0 && - ((u = jt.degToRad(n.OuterAngle.value)), (u = Math.max(u, 1))), - (t = new dh(s, a, o, c, u, l)); - break; - default: - console.warn( - "THREE.FBXLoader: Unknown light type " + - n.LightType.value + - ", defaulting to a PointLight." - ), - (t = new Ha(s, a)); - break; - } - n.CastShadows !== void 0 && - n.CastShadows.value === 1 && - (t.castShadow = !0); - } - return t; - } - createMesh(e, t, n) { - let i, - s = null, - a = null; - const o = []; - return ( - e.children.forEach(function (l) { - t.has(l.ID) && (s = t.get(l.ID)), - n.has(l.ID) && o.push(n.get(l.ID)); - }), - o.length > 1 - ? (a = o) - : o.length > 0 - ? (a = o[0]) - : ((a = new xr({ color: 13421772 })), o.push(a)), - "color" in s.attributes && - o.forEach(function (l) { - l.vertexColors = !0; - }), - s.FBX_Deformer - ? ((i = new ah(s, a)), i.normalizeSkinWeights()) - : (i = new Qe(s, a)), - i - ); - } - createCurve(e, t) { - const n = e.children.reduce(function (s, a) { - return t.has(a.ID) && (s = t.get(a.ID)), s; - }, null), - i = new Os({ color: 3342591, linewidth: 1 }); - return new Br(n, i); - } - getTransformData(e, t) { - const n = {}; - "InheritType" in t && (n.inheritType = parseInt(t.InheritType.value)), - "RotationOrder" in t - ? (n.eulerOrder = tu(t.RotationOrder.value)) - : (n.eulerOrder = "ZYX"), - "Lcl_Translation" in t && (n.translation = t.Lcl_Translation.value), - "PreRotation" in t && (n.preRotation = t.PreRotation.value), - "Lcl_Rotation" in t && (n.rotation = t.Lcl_Rotation.value), - "PostRotation" in t && (n.postRotation = t.PostRotation.value), - "Lcl_Scaling" in t && (n.scale = t.Lcl_Scaling.value), - "ScalingOffset" in t && (n.scalingOffset = t.ScalingOffset.value), - "ScalingPivot" in t && (n.scalingPivot = t.ScalingPivot.value), - "RotationOffset" in t && - (n.rotationOffset = t.RotationOffset.value), - "RotationPivot" in t && (n.rotationPivot = t.RotationPivot.value), - (e.userData.transformData = n); - } - setLookAtProperties(e, t) { - "LookAtProperty" in t && - Ze.get(e.ID).children.forEach(function (i) { - if (i.relationship === "LookAtProperty") { - const s = Ce.Objects.Model[i.ID]; - if ("Lcl_Translation" in s) { - const a = s.Lcl_Translation.value; - e.target !== void 0 - ? (e.target.position.fromArray(a), Tt.add(e.target)) - : e.lookAt(new P().fromArray(a)); - } - } - }); - } - bindSkeleton(e, t, n) { - const i = this.parsePoseNodes(); - for (const s in e) { - const a = e[s]; - Ze.get(parseInt(a.ID)).parents.forEach(function (l) { - if (t.has(l.ID)) { - const c = l.ID; - Ze.get(c).parents.forEach(function (h) { - n.has(h.ID) && n.get(h.ID).bind(new Ur(a.bones), i[h.ID]); - }); - } - }); - } - } - parsePoseNodes() { - const e = {}; - if ("Pose" in Ce.Objects) { - const t = Ce.Objects.Pose; - for (const n in t) - if (t[n].attrType === "BindPose" && t[n].NbPoseNodes > 0) { - const i = t[n].PoseNode; - Array.isArray(i) - ? i.forEach(function (s) { - e[s.Node] = new pe().fromArray(s.Matrix.a); - }) - : (e[i.Node] = new pe().fromArray(i.Matrix.a)); - } - } - return e; - } - createAmbientLight() { - if ("GlobalSettings" in Ce && "AmbientColor" in Ce.GlobalSettings) { - const e = Ce.GlobalSettings.AmbientColor.value, - t = e[0], - n = e[1], - i = e[2]; - if (t !== 0 || n !== 0 || i !== 0) { - const s = new de(t, n, i); - Tt.add(new k0(s, 1)); - } - } - } - } - class __ { - parse(e) { - const t = new Map(); - if ("Geometry" in Ce.Objects) { - const n = Ce.Objects.Geometry; - for (const i in n) { - const s = Ze.get(parseInt(i)), - a = this.parseGeometry(s, n[i], e); - t.set(parseInt(i), a); - } - } - return t; - } - parseGeometry(e, t, n) { - switch (t.attrType) { - case "Mesh": - return this.parseMeshGeometry(e, t, n); - case "NurbsCurve": - return this.parseNurbsGeometry(t); - } - } - parseMeshGeometry(e, t, n) { - const i = n.skeletons, - s = [], - a = e.parents.map(function (h) { - return Ce.Objects.Model[h.ID]; - }); - if (a.length === 0) return; - const o = e.children.reduce(function (h, d) { - return i[d.ID] !== void 0 && (h = i[d.ID]), h; - }, null); - e.children.forEach(function (h) { - n.morphTargets[h.ID] !== void 0 && s.push(n.morphTargets[h.ID]); - }); - const l = a[0], - c = {}; - "RotationOrder" in l && (c.eulerOrder = tu(l.RotationOrder.value)), - "InheritType" in l && - (c.inheritType = parseInt(l.InheritType.value)), - "GeometricTranslation" in l && - (c.translation = l.GeometricTranslation.value), - "GeometricRotation" in l && - (c.rotation = l.GeometricRotation.value), - "GeometricScaling" in l && (c.scale = l.GeometricScaling.value); - const u = eu(c); - return this.genGeometry(t, o, s, u); - } - genGeometry(e, t, n, i) { - const s = new ct(); - e.attrName && (s.name = e.attrName); - const a = this.parseGeoNode(e, t), - o = this.genBuffers(a), - l = new Xe(o.vertex, 3); - if ( - (l.applyMatrix4(i), - s.setAttribute("position", l), - o.colors.length > 0 && s.setAttribute("color", new Xe(o.colors, 3)), - t && - (s.setAttribute("skinIndex", new so(o.weightsIndices, 4)), - s.setAttribute("skinWeight", new Xe(o.vertexWeights, 4)), - (s.FBX_Deformer = t)), - o.normal.length > 0) - ) { - const c = new Xt().getNormalMatrix(i), - u = new Xe(o.normal, 3); - u.applyNormalMatrix(c), s.setAttribute("normal", u); - } - if ( - (o.uvs.forEach(function (c, u) { - let h = "uv" + (u + 1).toString(); - u === 0 && (h = "uv"), s.setAttribute(h, new Xe(o.uvs[u], 2)); - }), - a.material && a.material.mappingType !== "AllSame") - ) { - let c = o.materialIndex[0], - u = 0; - if ( - (o.materialIndex.forEach(function (h, d) { - h !== c && (s.addGroup(u, d - u, c), (c = h), (u = d)); - }), - s.groups.length > 0) - ) { - const h = s.groups[s.groups.length - 1], - d = h.start + h.count; - d !== o.materialIndex.length && - s.addGroup(d, o.materialIndex.length - d, c); - } - s.groups.length === 0 && - s.addGroup(0, o.materialIndex.length, o.materialIndex[0]); - } - return this.addMorphTargets(s, e, n, i), s; - } - parseGeoNode(e, t) { - const n = {}; - if ( - ((n.vertexPositions = e.Vertices !== void 0 ? e.Vertices.a : []), - (n.vertexIndices = - e.PolygonVertexIndex !== void 0 ? e.PolygonVertexIndex.a : []), - e.LayerElementColor && - (n.color = this.parseVertexColors(e.LayerElementColor[0])), - e.LayerElementMaterial && - (n.material = this.parseMaterialIndices( - e.LayerElementMaterial[0] - )), - e.LayerElementNormal && - (n.normal = this.parseNormals(e.LayerElementNormal[0])), - e.LayerElementUV) - ) { - n.uv = []; - let i = 0; - for (; e.LayerElementUV[i]; ) - e.LayerElementUV[i].UV && - n.uv.push(this.parseUVs(e.LayerElementUV[i])), - i++; - } - return ( - (n.weightTable = {}), - t !== null && - ((n.skeleton = t), - t.rawBones.forEach(function (i, s) { - i.indices.forEach(function (a, o) { - n.weightTable[a] === void 0 && (n.weightTable[a] = []), - n.weightTable[a].push({ id: s, weight: i.weights[o] }); - }); - })), - n - ); - } - genBuffers(e) { - const t = { - vertex: [], - normal: [], - colors: [], - uvs: [], - materialIndex: [], - vertexWeights: [], - weightsIndices: [], - }; - let n = 0, - i = 0, - s = !1, - a = [], - o = [], - l = [], - c = [], - u = [], - h = []; - const d = this; - return ( - e.vertexIndices.forEach(function (f, g) { - let m, - p = !1; - f < 0 && ((f = f ^ -1), (p = !0)); - let v = [], - M = []; - if ((a.push(f * 3, f * 3 + 1, f * 3 + 2), e.color)) { - const x = gr(g, n, f, e.color); - l.push(x[0], x[1], x[2]); - } - if (e.skeleton) { - if ( - (e.weightTable[f] !== void 0 && - e.weightTable[f].forEach(function (x) { - M.push(x.weight), v.push(x.id); - }), - M.length > 4) - ) { - s || - (console.warn( - "THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights." - ), - (s = !0)); - const x = [0, 0, 0, 0], - w = [0, 0, 0, 0]; - M.forEach(function (y, A) { - let L = y, - _ = v[A]; - w.forEach(function (T, I, F) { - if (L > T) { - (F[I] = L), (L = T); - const H = x[I]; - (x[I] = _), (_ = H); - } - }); - }), - (v = x), - (M = w); - } - for (; M.length < 4; ) M.push(0), v.push(0); - for (let x = 0; x < 4; ++x) u.push(M[x]), h.push(v[x]); - } - if (e.normal) { - const x = gr(g, n, f, e.normal); - o.push(x[0], x[1], x[2]); - } - e.material && - e.material.mappingType !== "AllSame" && - (m = gr(g, n, f, e.material)[0]), - e.uv && - e.uv.forEach(function (x, w) { - const y = gr(g, n, f, x); - c[w] === void 0 && (c[w] = []), - c[w].push(y[0]), - c[w].push(y[1]); - }), - i++, - p && - (d.genFace(t, e, a, m, o, l, c, u, h, i), - n++, - (i = 0), - (a = []), - (o = []), - (l = []), - (c = []), - (u = []), - (h = [])); - }), - t - ); - } - genFace(e, t, n, i, s, a, o, l, c, u) { - for (let h = 2; h < u; h++) - e.vertex.push(t.vertexPositions[n[0]]), - e.vertex.push(t.vertexPositions[n[1]]), - e.vertex.push(t.vertexPositions[n[2]]), - e.vertex.push(t.vertexPositions[n[(h - 1) * 3]]), - e.vertex.push(t.vertexPositions[n[(h - 1) * 3 + 1]]), - e.vertex.push(t.vertexPositions[n[(h - 1) * 3 + 2]]), - e.vertex.push(t.vertexPositions[n[h * 3]]), - e.vertex.push(t.vertexPositions[n[h * 3 + 1]]), - e.vertex.push(t.vertexPositions[n[h * 3 + 2]]), - t.skeleton && - (e.vertexWeights.push(l[0]), - e.vertexWeights.push(l[1]), - e.vertexWeights.push(l[2]), - e.vertexWeights.push(l[3]), - e.vertexWeights.push(l[(h - 1) * 4]), - e.vertexWeights.push(l[(h - 1) * 4 + 1]), - e.vertexWeights.push(l[(h - 1) * 4 + 2]), - e.vertexWeights.push(l[(h - 1) * 4 + 3]), - e.vertexWeights.push(l[h * 4]), - e.vertexWeights.push(l[h * 4 + 1]), - e.vertexWeights.push(l[h * 4 + 2]), - e.vertexWeights.push(l[h * 4 + 3]), - e.weightsIndices.push(c[0]), - e.weightsIndices.push(c[1]), - e.weightsIndices.push(c[2]), - e.weightsIndices.push(c[3]), - e.weightsIndices.push(c[(h - 1) * 4]), - e.weightsIndices.push(c[(h - 1) * 4 + 1]), - e.weightsIndices.push(c[(h - 1) * 4 + 2]), - e.weightsIndices.push(c[(h - 1) * 4 + 3]), - e.weightsIndices.push(c[h * 4]), - e.weightsIndices.push(c[h * 4 + 1]), - e.weightsIndices.push(c[h * 4 + 2]), - e.weightsIndices.push(c[h * 4 + 3])), - t.color && - (e.colors.push(a[0]), - e.colors.push(a[1]), - e.colors.push(a[2]), - e.colors.push(a[(h - 1) * 3]), - e.colors.push(a[(h - 1) * 3 + 1]), - e.colors.push(a[(h - 1) * 3 + 2]), - e.colors.push(a[h * 3]), - e.colors.push(a[h * 3 + 1]), - e.colors.push(a[h * 3 + 2])), - t.material && - t.material.mappingType !== "AllSame" && - (e.materialIndex.push(i), - e.materialIndex.push(i), - e.materialIndex.push(i)), - t.normal && - (e.normal.push(s[0]), - e.normal.push(s[1]), - e.normal.push(s[2]), - e.normal.push(s[(h - 1) * 3]), - e.normal.push(s[(h - 1) * 3 + 1]), - e.normal.push(s[(h - 1) * 3 + 2]), - e.normal.push(s[h * 3]), - e.normal.push(s[h * 3 + 1]), - e.normal.push(s[h * 3 + 2])), - t.uv && - t.uv.forEach(function (d, f) { - e.uvs[f] === void 0 && (e.uvs[f] = []), - e.uvs[f].push(o[f][0]), - e.uvs[f].push(o[f][1]), - e.uvs[f].push(o[f][(h - 1) * 2]), - e.uvs[f].push(o[f][(h - 1) * 2 + 1]), - e.uvs[f].push(o[f][h * 2]), - e.uvs[f].push(o[f][h * 2 + 1]); - }); - } - addMorphTargets(e, t, n, i) { - if (n.length === 0) return; - (e.morphTargetsRelative = !0), (e.morphAttributes.position = []); - const s = this; - n.forEach(function (a) { - a.rawTargets.forEach(function (o) { - const l = Ce.Objects.Geometry[o.geoID]; - l !== void 0 && s.genMorphGeometry(e, t, l, i, o.name); - }); - }); - } - genMorphGeometry(e, t, n, i, s) { - const a = - t.PolygonVertexIndex !== void 0 ? t.PolygonVertexIndex.a : [], - o = n.Vertices !== void 0 ? n.Vertices.a : [], - l = n.Indexes !== void 0 ? n.Indexes.a : [], - c = e.attributes.position.count * 3, - u = new Float32Array(c); - for (let g = 0; g < l.length; g++) { - const m = l[g] * 3; - (u[m] = o[g * 3]), - (u[m + 1] = o[g * 3 + 1]), - (u[m + 2] = o[g * 3 + 2]); - } - const h = { vertexIndices: a, vertexPositions: u }, - d = this.genBuffers(h), - f = new Xe(d.vertex, 3); - (f.name = s || n.attrName), - f.applyMatrix4(i), - e.morphAttributes.position.push(f); - } - parseNormals(e) { - const t = e.MappingInformationType, - n = e.ReferenceInformationType, - i = e.Normals.a; - let s = []; - return ( - n === "IndexToDirect" && - ("NormalIndex" in e - ? (s = e.NormalIndex.a) - : "NormalsIndex" in e && (s = e.NormalsIndex.a)), - { - dataSize: 3, - buffer: i, - indices: s, - mappingType: t, - referenceType: n, - } - ); - } - parseUVs(e) { - const t = e.MappingInformationType, - n = e.ReferenceInformationType, - i = e.UV.a; - let s = []; - return ( - n === "IndexToDirect" && (s = e.UVIndex.a), - { - dataSize: 2, - buffer: i, - indices: s, - mappingType: t, - referenceType: n, - } - ); - } - parseVertexColors(e) { - const t = e.MappingInformationType, - n = e.ReferenceInformationType, - i = e.Colors.a; - let s = []; - return ( - n === "IndexToDirect" && (s = e.ColorIndex.a), - { - dataSize: 4, - buffer: i, - indices: s, - mappingType: t, - referenceType: n, - } - ); - } - parseMaterialIndices(e) { - const t = e.MappingInformationType, - n = e.ReferenceInformationType; - if (t === "NoMappingInformation") - return { - dataSize: 1, - buffer: [0], - indices: [0], - mappingType: "AllSame", - referenceType: n, - }; - const i = e.Materials.a, - s = []; - for (let a = 0; a < i.length; ++a) s.push(a); - return { - dataSize: 1, - buffer: i, - indices: s, - mappingType: t, - referenceType: n, - }; - } - parseNurbsGeometry(e) { - if (Mc === void 0) - return ( - console.error( - "THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry." - ), - new ct() - ); - const t = parseInt(e.Order); - if (isNaN(t)) - return ( - console.error( - "THREE.FBXLoader: Invalid Order %s given for geometry ID: %s", - e.Order, - e.id - ), - new ct() - ); - const n = t - 1, - i = e.KnotVector.a, - s = [], - a = e.Points.a; - for (let h = 0, d = a.length; h < d; h += 4) - s.push(new Ue().fromArray(a, h)); - let o, l; - if (e.Form === "Closed") s.push(s[0]); - else if (e.Form === "Periodic") { - (o = n), (l = i.length - 1 - o); - for (let h = 0; h < n; ++h) s.push(s[h]); - } - const u = new Mc(n, i, s, o, l).getPoints(s.length * 12); - return new ct().setFromPoints(u); - } - } - class x_ { - parse() { - const e = [], - t = this.parseClips(); - if (t !== void 0) - for (const n in t) { - const i = t[n], - s = this.addClip(i); - e.push(s); - } - return e; - } - parseClips() { - if (Ce.Objects.AnimationCurve === void 0) return; - const e = this.parseAnimationCurveNodes(); - this.parseAnimationCurves(e); - const t = this.parseAnimationLayers(e); - return this.parseAnimStacks(t); - } - parseAnimationCurveNodes() { - const e = Ce.Objects.AnimationCurveNode, - t = new Map(); - for (const n in e) { - const i = e[n]; - if (i.attrName.match(/S|R|T|DeformPercent/) !== null) { - const s = { id: i.id, attr: i.attrName, curves: {} }; - t.set(s.id, s); - } - } - return t; - } - parseAnimationCurves(e) { - const t = Ce.Objects.AnimationCurve; - for (const n in t) { - const i = { - id: t[n].id, - times: t[n].KeyTime.a.map(S_), - values: t[n].KeyValueFloat.a, - }, - s = Ze.get(i.id); - if (s !== void 0) { - const a = s.parents[0].ID, - o = s.parents[0].relationship; - o.match(/X/) - ? (e.get(a).curves.x = i) - : o.match(/Y/) - ? (e.get(a).curves.y = i) - : o.match(/Z/) - ? (e.get(a).curves.z = i) - : o.match(/d|DeformPercent/) && - e.has(a) && - (e.get(a).curves.morph = i); - } - } - } - parseAnimationLayers(e) { - const t = Ce.Objects.AnimationLayer, - n = new Map(); - for (const i in t) { - const s = [], - a = Ze.get(parseInt(i)); - a !== void 0 && - (a.children.forEach(function (l, c) { - if (e.has(l.ID)) { - const u = e.get(l.ID); - if ( - u.curves.x !== void 0 || - u.curves.y !== void 0 || - u.curves.z !== void 0 - ) { - if (s[c] === void 0) { - const h = Ze.get(l.ID).parents.filter(function (d) { - return d.relationship !== void 0; - })[0].ID; - if (h !== void 0) { - const d = Ce.Objects.Model[h.toString()]; - if (d === void 0) { - console.warn( - "THREE.FBXLoader: Encountered a unused curve.", - l - ); - return; - } - const f = { - modelName: d.attrName - ? Ne.sanitizeNodeName(d.attrName) - : "", - ID: d.id, - initialPosition: [0, 0, 0], - initialRotation: [0, 0, 0], - initialScale: [1, 1, 1], - }; - Tt.traverse(function (g) { - g.ID === d.id && - ((f.transform = g.matrix), - g.userData.transformData && - (f.eulerOrder = - g.userData.transformData.eulerOrder)); - }), - f.transform || (f.transform = new pe()), - "PreRotation" in d && - (f.preRotation = d.PreRotation.value), - "PostRotation" in d && - (f.postRotation = d.PostRotation.value), - (s[c] = f); - } - } - s[c] && (s[c][u.attr] = u); - } else if (u.curves.morph !== void 0) { - if (s[c] === void 0) { - const h = Ze.get(l.ID).parents.filter(function (v) { - return v.relationship !== void 0; - })[0].ID, - d = Ze.get(h).parents[0].ID, - f = Ze.get(d).parents[0].ID, - g = Ze.get(f).parents[0].ID, - m = Ce.Objects.Model[g], - p = { - modelName: m.attrName - ? Ne.sanitizeNodeName(m.attrName) - : "", - morphName: Ce.Objects.Deformer[h].attrName, - }; - s[c] = p; - } - s[c][u.attr] = u; - } - } - }), - n.set(parseInt(i), s)); - } - return n; - } - parseAnimStacks(e) { - const t = Ce.Objects.AnimationStack, - n = {}; - for (const i in t) { - const s = Ze.get(parseInt(i)).children; - s.length > 1 && - console.warn( - "THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers." - ); - const a = e.get(s[0].ID); - n[i] = { name: t[i].attrName, layer: a }; - } - return n; - } - addClip(e) { - let t = []; - const n = this; - return ( - e.layer.forEach(function (i) { - t = t.concat(n.generateTracks(i)); - }), - new hh(e.name, -1, t) - ); - } - generateTracks(e) { - const t = []; - let n = new P(), - i = new Mt(), - s = new P(); - if ( - (e.transform && e.transform.decompose(n, i, s), - (n = n.toArray()), - (i = new an().setFromQuaternion(i, e.eulerOrder).toArray()), - (s = s.toArray()), - e.T !== void 0 && Object.keys(e.T.curves).length > 0) - ) { - const a = this.generateVectorTrack( - e.modelName, - e.T.curves, - n, - "position" - ); - a !== void 0 && t.push(a); - } - if (e.R !== void 0 && Object.keys(e.R.curves).length > 0) { - const a = this.generateRotationTrack( - e.modelName, - e.R.curves, - i, - e.preRotation, - e.postRotation, - e.eulerOrder - ); - a !== void 0 && t.push(a); - } - if (e.S !== void 0 && Object.keys(e.S.curves).length > 0) { - const a = this.generateVectorTrack( - e.modelName, - e.S.curves, - s, - "scale" - ); - a !== void 0 && t.push(a); - } - if (e.DeformPercent !== void 0) { - const a = this.generateMorphTrack(e); - a !== void 0 && t.push(a); - } - return t; - } - generateVectorTrack(e, t, n, i) { - const s = this.getTimesForAllAxes(t), - a = this.getKeyframeTrackValues(s, t, n); - return new ji(e + "." + i, s, a); - } - generateRotationTrack(e, t, n, i, s, a) { - t.x !== void 0 && - (this.interpolateRotations(t.x), - (t.x.values = t.x.values.map(jt.degToRad))), - t.y !== void 0 && - (this.interpolateRotations(t.y), - (t.y.values = t.y.values.map(jt.degToRad))), - t.z !== void 0 && - (this.interpolateRotations(t.z), - (t.z.values = t.z.values.map(jt.degToRad))); - const o = this.getTimesForAllAxes(t), - l = this.getKeyframeTrackValues(o, t, n); - i !== void 0 && - ((i = i.map(jt.degToRad)), - i.push(a), - (i = new an().fromArray(i)), - (i = new Mt().setFromEuler(i))), - s !== void 0 && - ((s = s.map(jt.degToRad)), - s.push(a), - (s = new an().fromArray(s)), - (s = new Mt().setFromEuler(s).invert())); - const c = new Mt(), - u = new an(), - h = []; - for (let d = 0; d < l.length; d += 3) - u.set(l[d], l[d + 1], l[d + 2], a), - c.setFromEuler(u), - i !== void 0 && c.premultiply(i), - s !== void 0 && c.multiply(s), - c.toArray(h, (d / 3) * 4); - return new Hn(e + ".quaternion", o, h); - } - generateMorphTrack(e) { - const t = e.DeformPercent.curves.morph, - n = t.values.map(function (s) { - return s / 100; - }), - i = Tt.getObjectByName(e.modelName).morphTargetDictionary[ - e.morphName - ]; - return new Wi( - e.modelName + ".morphTargetInfluences[" + i + "]", - t.times, - n - ); - } - getTimesForAllAxes(e) { - let t = []; - if ( - (e.x !== void 0 && (t = t.concat(e.x.times)), - e.y !== void 0 && (t = t.concat(e.y.times)), - e.z !== void 0 && (t = t.concat(e.z.times)), - (t = t.sort(function (n, i) { - return n - i; - })), - t.length > 1) - ) { - let n = 1, - i = t[0]; - for (let s = 1; s < t.length; s++) { - const a = t[s]; - a !== i && ((t[n] = a), (i = a), n++); - } - t = t.slice(0, n); - } - return t; - } - getKeyframeTrackValues(e, t, n) { - const i = n, - s = []; - let a = -1, - o = -1, - l = -1; - return ( - e.forEach(function (c) { - if ( - (t.x && (a = t.x.times.indexOf(c)), - t.y && (o = t.y.times.indexOf(c)), - t.z && (l = t.z.times.indexOf(c)), - a !== -1) - ) { - const u = t.x.values[a]; - s.push(u), (i[0] = u); - } else s.push(i[0]); - if (o !== -1) { - const u = t.y.values[o]; - s.push(u), (i[1] = u); - } else s.push(i[1]); - if (l !== -1) { - const u = t.z.values[l]; - s.push(u), (i[2] = u); - } else s.push(i[2]); - }), - s - ); - } - interpolateRotations(e) { - for (let t = 1; t < e.values.length; t++) { - const n = e.values[t - 1], - i = e.values[t] - n, - s = Math.abs(i); - if (s >= 180) { - const a = s / 180, - o = i / a; - let l = n + o; - const c = e.times[t - 1], - h = (e.times[t] - c) / a; - let d = c + h; - const f = [], - g = []; - for (; d < e.times[t]; ) f.push(d), (d += h), g.push(l), (l += o); - (e.times = Sc(e.times, t, f)), (e.values = Sc(e.values, t, g)); - } - } - } - } - class y_ { - getPrevNode() { - return this.nodeStack[this.currentIndent - 2]; - } - getCurrentNode() { - return this.nodeStack[this.currentIndent - 1]; - } - getCurrentProp() { - return this.currentProp; - } - pushStack(e) { - this.nodeStack.push(e), (this.currentIndent += 1); - } - popStack() { - this.nodeStack.pop(), (this.currentIndent -= 1); - } - setCurrentProp(e, t) { - (this.currentProp = e), (this.currentPropName = t); - } - parse(e) { - (this.currentIndent = 0), - (this.allNodes = new Qh()), - (this.nodeStack = []), - (this.currentProp = []), - (this.currentPropName = ""); - const t = this, - n = e.split(/[\r\n]+/); - return ( - n.forEach(function (i, s) { - const a = i.match(/^[\s\t]*;/), - o = i.match(/^[\s\t]*$/); - if (a || o) return; - const l = i.match( - "^\\t{" + t.currentIndent + "}(\\w+):(.*){", - "" - ), - c = i.match( - "^\\t{" + t.currentIndent + "}(\\w+):[\\s\\t\\r\\n](.*)" - ), - u = i.match("^\\t{" + (t.currentIndent - 1) + "}}"); - l - ? t.parseNodeBegin(i, l) - : c - ? t.parseNodeProperty(i, c, n[++s]) - : u - ? t.popStack() - : i.match(/^[^\s\t}]/) && t.parseNodePropertyContinued(i); - }), - this.allNodes - ); - } - parseNodeBegin(e, t) { - const n = t[1].trim().replace(/^"/, "").replace(/"$/, ""), - i = t[2].split(",").map(function (l) { - return l.trim().replace(/^"/, "").replace(/"$/, ""); - }), - s = { name: n }, - a = this.parseNodeAttr(i), - o = this.getCurrentNode(); - this.currentIndent === 0 - ? this.allNodes.add(n, s) - : n in o - ? (n === "PoseNode" - ? o.PoseNode.push(s) - : o[n].id !== void 0 && ((o[n] = {}), (o[n][o[n].id] = o[n])), - a.id !== "" && (o[n][a.id] = s)) - : typeof a.id == "number" - ? ((o[n] = {}), (o[n][a.id] = s)) - : n !== "Properties70" && - (n === "PoseNode" ? (o[n] = [s]) : (o[n] = s)), - typeof a.id == "number" && (s.id = a.id), - a.name !== "" && (s.attrName = a.name), - a.type !== "" && (s.attrType = a.type), - this.pushStack(s); - } - parseNodeAttr(e) { - let t = e[0]; - e[0] !== "" && ((t = parseInt(e[0])), isNaN(t) && (t = e[0])); - let n = "", - i = ""; - return ( - e.length > 1 && ((n = e[1].replace(/^(\w+)::/, "")), (i = e[2])), - { id: t, name: n, type: i } - ); - } - parseNodeProperty(e, t, n) { - let i = t[1].replace(/^"/, "").replace(/"$/, "").trim(), - s = t[2].replace(/^"/, "").replace(/"$/, "").trim(); - i === "Content" && - s === "," && - (s = n.replace(/"/g, "").replace(/,$/, "").trim()); - const a = this.getCurrentNode(); - if (a.name === "Properties70") { - this.parseNodeSpecialProperty(e, i, s); - return; - } - if (i === "C") { - const l = s.split(",").slice(1), - c = parseInt(l[0]), - u = parseInt(l[1]); - let h = s.split(",").slice(3); - (h = h.map(function (d) { - return d.trim().replace(/^"/, ""); - })), - (i = "connections"), - (s = [c, u]), - E_(s, h), - a[i] === void 0 && (a[i] = []); - } - i === "Node" && (a.id = s), - i in a && Array.isArray(a[i]) - ? a[i].push(s) - : i !== "a" - ? (a[i] = s) - : (a.a = s), - this.setCurrentProp(a, i), - i === "a" && s.slice(-1) !== "," && (a.a = Pa(s)); - } - parseNodePropertyContinued(e) { - const t = this.getCurrentNode(); - (t.a += e), e.slice(-1) !== "," && (t.a = Pa(t.a)); - } - parseNodeSpecialProperty(e, t, n) { - const i = n.split('",').map(function (u) { - return u.trim().replace(/^\"/, "").replace(/\s/, "_"); - }), - s = i[0], - a = i[1], - o = i[2], - l = i[3]; - let c = i[4]; - switch (a) { - case "int": - case "enum": - case "bool": - case "ULongLong": - case "double": - case "Number": - case "FieldOfView": - c = parseFloat(c); - break; - case "Color": - case "ColorRGB": - case "Vector3D": - case "Lcl_Translation": - case "Lcl_Rotation": - case "Lcl_Scaling": - c = Pa(c); - break; - } - (this.getPrevNode()[s] = { type: a, type2: o, flag: l, value: c }), - this.setCurrentProp(this.getPrevNode(), s); - } - } - class M_ { - parse(e) { - const t = new wc(e); - t.skip(23); - const n = t.getUint32(); - if (n < 6400) - throw new Error( - "THREE.FBXLoader: FBX version not supported, FileVersion: " + n - ); - const i = new Qh(); - for (; !this.endOfContent(t); ) { - const s = this.parseNode(t, n); - s !== null && i.add(s.name, s); - } - return i; - } - endOfContent(e) { - return e.size() % 16 === 0 - ? ((e.getOffset() + 160 + 16) & -16) >= e.size() - : e.getOffset() + 160 + 16 >= e.size(); - } - parseNode(e, t) { - const n = {}, - i = t >= 7500 ? e.getUint64() : e.getUint32(), - s = t >= 7500 ? e.getUint64() : e.getUint32(); - t >= 7500 ? e.getUint64() : e.getUint32(); - const a = e.getUint8(), - o = e.getString(a); - if (i === 0) return null; - const l = []; - for (let d = 0; d < s; d++) l.push(this.parseProperty(e)); - const c = l.length > 0 ? l[0] : "", - u = l.length > 1 ? l[1] : "", - h = l.length > 2 ? l[2] : ""; - for ( - n.singleProperty = s === 1 && e.getOffset() === i; - i > e.getOffset(); - - ) { - const d = this.parseNode(e, t); - d !== null && this.parseSubNode(o, n, d); - } - return ( - (n.propertyList = l), - typeof c == "number" && (n.id = c), - u !== "" && (n.attrName = u), - h !== "" && (n.attrType = h), - o !== "" && (n.name = o), - n - ); - } - parseSubNode(e, t, n) { - if (n.singleProperty === !0) { - const i = n.propertyList[0]; - Array.isArray(i) ? ((t[n.name] = n), (n.a = i)) : (t[n.name] = i); - } else if (e === "Connections" && n.name === "C") { - const i = []; - n.propertyList.forEach(function (s, a) { - a !== 0 && i.push(s); - }), - t.connections === void 0 && (t.connections = []), - t.connections.push(i); - } else if (n.name === "Properties70") - Object.keys(n).forEach(function (s) { - t[s] = n[s]; - }); - else if (e === "Properties70" && n.name === "P") { - let i = n.propertyList[0], - s = n.propertyList[1]; - const a = n.propertyList[2], - o = n.propertyList[3]; - let l; - i.indexOf("Lcl ") === 0 && (i = i.replace("Lcl ", "Lcl_")), - s.indexOf("Lcl ") === 0 && (s = s.replace("Lcl ", "Lcl_")), - s === "Color" || - s === "ColorRGB" || - s === "Vector" || - s === "Vector3D" || - s.indexOf("Lcl_") === 0 - ? (l = [ - n.propertyList[4], - n.propertyList[5], - n.propertyList[6], - ]) - : (l = n.propertyList[4]), - (t[i] = { type: s, type2: a, flag: o, value: l }); - } else - t[n.name] === void 0 - ? typeof n.id == "number" - ? ((t[n.name] = {}), (t[n.name][n.id] = n)) - : (t[n.name] = n) - : n.name === "PoseNode" - ? (Array.isArray(t[n.name]) || (t[n.name] = [t[n.name]]), - t[n.name].push(n)) - : t[n.name][n.id] === void 0 && (t[n.name][n.id] = n); - } - parseProperty(e) { - const t = e.getString(1); - let n; - switch (t) { - case "C": - return e.getBoolean(); - case "D": - return e.getFloat64(); - case "F": - return e.getFloat32(); - case "I": - return e.getInt32(); - case "L": - return e.getInt64(); - case "R": - return (n = e.getUint32()), e.getArrayBuffer(n); - case "S": - return (n = e.getUint32()), e.getString(n); - case "Y": - return e.getInt16(); - case "b": - case "c": - case "d": - case "f": - case "i": - case "l": - const i = e.getUint32(), - s = e.getUint32(), - a = e.getUint32(); - if (s === 0) - switch (t) { - case "b": - case "c": - return e.getBooleanArray(i); - case "d": - return e.getFloat64Array(i); - case "f": - return e.getFloat32Array(i); - case "i": - return e.getInt32Array(i); - case "l": - return e.getInt64Array(i); - } - typeof l_ == "undefined" && - console.error( - "THREE.FBXLoader: External library fflate.min.js required." - ); - const o = Is(new Uint8Array(e.getArrayBuffer(a))), - l = new wc(o.buffer); - switch (t) { - case "b": - case "c": - return l.getBooleanArray(i); - case "d": - return l.getFloat64Array(i); - case "f": - return l.getFloat32Array(i); - case "i": - return l.getInt32Array(i); - case "l": - return l.getInt64Array(i); - } - break; - default: - throw new Error("THREE.FBXLoader: Unknown property type " + t); - } - } - } - class wc { - constructor(e, t) { - (this.dv = new DataView(e)), - (this.offset = 0), - (this.littleEndian = t !== void 0 ? t : !0); - } - getOffset() { - return this.offset; - } - size() { - return this.dv.buffer.byteLength; - } - skip(e) { - this.offset += e; - } - getBoolean() { - return (this.getUint8() & 1) === 1; - } - getBooleanArray(e) { - const t = []; - for (let n = 0; n < e; n++) t.push(this.getBoolean()); - return t; - } - getUint8() { - const e = this.dv.getUint8(this.offset); - return (this.offset += 1), e; - } - getInt16() { - const e = this.dv.getInt16(this.offset, this.littleEndian); - return (this.offset += 2), e; - } - getInt32() { - const e = this.dv.getInt32(this.offset, this.littleEndian); - return (this.offset += 4), e; - } - getInt32Array(e) { - const t = []; - for (let n = 0; n < e; n++) t.push(this.getInt32()); - return t; - } - getUint32() { - const e = this.dv.getUint32(this.offset, this.littleEndian); - return (this.offset += 4), e; - } - getInt64() { - let e, t; - return ( - this.littleEndian - ? ((e = this.getUint32()), (t = this.getUint32())) - : ((t = this.getUint32()), (e = this.getUint32())), - t & 2147483648 - ? ((t = ~t & 4294967295), - (e = ~e & 4294967295), - e === 4294967295 && (t = (t + 1) & 4294967295), - (e = (e + 1) & 4294967295), - -(t * 4294967296 + e)) - : t * 4294967296 + e - ); - } - getInt64Array(e) { - const t = []; - for (let n = 0; n < e; n++) t.push(this.getInt64()); - return t; - } - getUint64() { - let e, t; - return ( - this.littleEndian - ? ((e = this.getUint32()), (t = this.getUint32())) - : ((t = this.getUint32()), (e = this.getUint32())), - t * 4294967296 + e - ); - } - getFloat32() { - const e = this.dv.getFloat32(this.offset, this.littleEndian); - return (this.offset += 4), e; - } - getFloat32Array(e) { - const t = []; - for (let n = 0; n < e; n++) t.push(this.getFloat32()); - return t; - } - getFloat64() { - const e = this.dv.getFloat64(this.offset, this.littleEndian); - return (this.offset += 8), e; - } - getFloat64Array(e) { - const t = []; - for (let n = 0; n < e; n++) t.push(this.getFloat64()); - return t; - } - getArrayBuffer(e) { - const t = this.dv.buffer.slice(this.offset, this.offset + e); - return (this.offset += e), t; - } - getString(e) { - let t = []; - for (let i = 0; i < e; i++) t[i] = this.getUint8(); - const n = t.indexOf(0); - return ( - n >= 0 && (t = t.slice(0, n)), on.decodeText(new Uint8Array(t)) - ); - } - } - class Qh { - add(e, t) { - this[e] = t; - } - } - function w_(r) { - const e = "Kaydara FBX Binary \0"; - return r.byteLength >= e.length && e === nu(r, 0, e.length); - } - function b_(r) { - const e = [ - "K", - "a", - "y", - "d", - "a", - "r", - "a", - "\\", - "F", - "B", - "X", - "\\", - "B", - "i", - "n", - "a", - "r", - "y", - "\\", - "\\", - ]; - let t = 0; - function n(i) { - const s = r[i - 1]; - return (r = r.slice(t + i)), t++, s; - } - for (let i = 0; i < e.length; ++i) if (n(1) === e[i]) return !1; - return !0; - } - function bc(r) { - const e = /FBXVersion: (\d+)/, - t = r.match(e); - if (t) return parseInt(t[1]); - throw new Error( - "THREE.FBXLoader: Cannot find the version number for the file given." - ); - } - function S_(r) { - return r / 46186158e3; - } - const T_ = []; - function gr(r, e, t, n) { - let i; - switch (n.mappingType) { - case "ByPolygonVertex": - i = r; - break; - case "ByPolygon": - i = e; - break; - case "ByVertice": - i = t; - break; - case "AllSame": - i = n.indices[0]; - break; - default: - console.warn( - "THREE.FBXLoader: unknown attribute mapping type " + n.mappingType - ); - } - n.referenceType === "IndexToDirect" && (i = n.indices[i]); - const s = i * n.dataSize, - a = s + n.dataSize; - return A_(T_, n.buffer, s, a); - } - const Ra = new an(), - Pi = new P(); - function eu(r) { - const e = new pe(), - t = new pe(), - n = new pe(), - i = new pe(), - s = new pe(), - a = new pe(), - o = new pe(), - l = new pe(), - c = new pe(), - u = new pe(), - h = new pe(), - d = new pe(), - f = r.inheritType ? r.inheritType : 0; - if ( - (r.translation && e.setPosition(Pi.fromArray(r.translation)), - r.preRotation) - ) { - const I = r.preRotation.map(jt.degToRad); - I.push(r.eulerOrder), t.makeRotationFromEuler(Ra.fromArray(I)); - } - if (r.rotation) { - const I = r.rotation.map(jt.degToRad); - I.push(r.eulerOrder), n.makeRotationFromEuler(Ra.fromArray(I)); - } - if (r.postRotation) { - const I = r.postRotation.map(jt.degToRad); - I.push(r.eulerOrder), - i.makeRotationFromEuler(Ra.fromArray(I)), - i.invert(); - } - r.scale && s.scale(Pi.fromArray(r.scale)), - r.scalingOffset && o.setPosition(Pi.fromArray(r.scalingOffset)), - r.scalingPivot && a.setPosition(Pi.fromArray(r.scalingPivot)), - r.rotationOffset && l.setPosition(Pi.fromArray(r.rotationOffset)), - r.rotationPivot && c.setPosition(Pi.fromArray(r.rotationPivot)), - r.parentMatrixWorld && - (h.copy(r.parentMatrix), u.copy(r.parentMatrixWorld)); - const g = t.clone().multiply(n).multiply(i), - m = new pe(); - m.extractRotation(u); - const p = new pe(); - p.copyPosition(u); - const v = p.clone().invert().multiply(u), - M = m.clone().invert().multiply(v), - x = s, - w = new pe(); - if (f === 0) w.copy(m).multiply(g).multiply(M).multiply(x); - else if (f === 1) w.copy(m).multiply(M).multiply(g).multiply(x); - else { - const F = new pe() - .scale(new P().setFromMatrixScale(h)) - .clone() - .invert(), - H = M.clone().multiply(F); - w.copy(m).multiply(g).multiply(H).multiply(x); - } - const y = c.clone().invert(), - A = a.clone().invert(); - let L = e - .clone() - .multiply(l) - .multiply(c) - .multiply(t) - .multiply(n) - .multiply(i) - .multiply(y) - .multiply(o) - .multiply(a) - .multiply(s) - .multiply(A); - const _ = new pe().copyPosition(L), - T = u.clone().multiply(_); - return ( - d.copyPosition(T), - (L = d.clone().multiply(w)), - L.premultiply(u.invert()), - L - ); - } - function tu(r) { - r = r || 0; - const e = ["ZYX", "YZX", "XZY", "ZXY", "YXZ", "XYZ"]; - return r === 6 - ? (console.warn( - "THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect." - ), - e[0]) - : e[r]; - } - function Pa(r) { - return r.split(",").map(function (t) { - return parseFloat(t); - }); - } - function nu(r, e, t) { - return ( - e === void 0 && (e = 0), - t === void 0 && (t = r.byteLength), - on.decodeText(new Uint8Array(r, e, t)) - ); - } - function E_(r, e) { - for (let t = 0, n = r.length, i = e.length; t < i; t++, n++) - r[n] = e[t]; - } - function A_(r, e, t, n) { - for (let i = t, s = 0; i < n; i++, s++) r[s] = e[i]; - return r; - } - function Sc(r, e, t) { - return r.slice(0, e).concat(t).concat(r.slice(e)); - } - const Da = new WeakMap(); - class Tc extends qn { - constructor(e) { - super(e), - (this.decoderPath = ""), - (this.decoderConfig = {}), - (this.decoderBinary = null), - (this.decoderPending = null), - (this.workerLimit = 4), - (this.workerPool = []), - (this.workerNextTaskID = 1), - (this.workerSourceURL = ""), - (this.defaultAttributeIDs = { - position: "POSITION", - normal: "NORMAL", - color: "COLOR", - uv: "TEX_COORD", - }), - (this.defaultAttributeTypes = { - position: "Float32Array", - normal: "Float32Array", - color: "Float32Array", - uv: "Float32Array", - }); - } - setDecoderPath(e) { - return (this.decoderPath = e), this; - } - setDecoderConfig(e) { - return (this.decoderConfig = e), this; - } - setWorkerLimit(e) { - return (this.workerLimit = e), this; - } - load(e, t, n, i) { - const s = new qi(this.manager); - s.setPath(this.path), - s.setResponseType("arraybuffer"), - s.setRequestHeader(this.requestHeader), - s.setWithCredentials(this.withCredentials), - s.load( - e, - (a) => { - const o = { - attributeIDs: this.defaultAttributeIDs, - attributeTypes: this.defaultAttributeTypes, - useUniqueIDs: !1, - }; - this.decodeGeometry(a, o).then(t).catch(i); - }, - n, - i - ); - } - decodeDracoFile(e, t, n, i) { - const s = { - attributeIDs: n || this.defaultAttributeIDs, - attributeTypes: i || this.defaultAttributeTypes, - useUniqueIDs: !!n, - }; - this.decodeGeometry(e, s).then(t); - } - decodeGeometry(e, t) { - for (const l in t.attributeTypes) { - const c = t.attributeTypes[l]; - c.BYTES_PER_ELEMENT !== void 0 && (t.attributeTypes[l] = c.name); - } - const n = JSON.stringify(t); - if (Da.has(e)) { - const l = Da.get(e); - if (l.key === n) return l.promise; - if (e.byteLength === 0) - throw new Error( - "THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred." - ); - } - let i; - const s = this.workerNextTaskID++, - a = e.byteLength, - o = this._getWorker(s, a) - .then( - (l) => ( - (i = l), - new Promise((c, u) => { - (i._callbacks[s] = { resolve: c, reject: u }), - i.postMessage( - { type: "decode", id: s, taskConfig: t, buffer: e }, - [e] - ); - }) - ) - ) - .then((l) => this._createGeometry(l.geometry)); - return ( - o - .catch(() => !0) - .then(() => { - i && s && this._releaseTask(i, s); - }), - Da.set(e, { key: n, promise: o }), - o - ); - } - _createGeometry(e) { - const t = new ct(); - e.index && t.setIndex(new wt(e.index.array, 1)); - for (let n = 0; n < e.attributes.length; n++) { - const i = e.attributes[n], - s = i.name, - a = i.array, - o = i.itemSize; - t.setAttribute(s, new wt(a, o)); - } - return t; - } - _loadLibrary(e, t) { - const n = new qi(this.manager); - return ( - n.setPath(this.decoderPath), - n.setResponseType(t), - n.setWithCredentials(this.withCredentials), - new Promise((i, s) => { - n.load(e, i, void 0, s); - }) - ); - } - preload() { - return this._initDecoder(), this; - } - _initDecoder() { - if (this.decoderPending) return this.decoderPending; - const e = - typeof WebAssembly != "object" || - this.decoderConfig.type === "js", - t = []; - return ( - e - ? t.push(this._loadLibrary("draco_decoder.js", "text")) - : (t.push(this._loadLibrary("draco_wasm_wrapper.js", "text")), - t.push(this._loadLibrary("draco_decoder.wasm", "arraybuffer"))), - (this.decoderPending = Promise.all(t).then((n) => { - const i = n[0]; - e || (this.decoderConfig.wasmBinary = n[1]); - const s = C_.toString(), - a = [ - "/* draco decoder */", - i, - "", - "/* worker */", - s.substring(s.indexOf("{") + 1, s.lastIndexOf("}")), - ].join(` -`); - this.workerSourceURL = URL.createObjectURL(new Blob([a])); - })), - this.decoderPending - ); - } - _getWorker(e, t) { - return this._initDecoder().then(() => { - if (this.workerPool.length < this.workerLimit) { - const i = new Worker(this.workerSourceURL); - (i._callbacks = {}), - (i._taskCosts = {}), - (i._taskLoad = 0), - i.postMessage({ - type: "init", - decoderConfig: this.decoderConfig, - }), - (i.onmessage = function (s) { - const a = s.data; - switch (a.type) { - case "decode": - i._callbacks[a.id].resolve(a); - break; - case "error": - i._callbacks[a.id].reject(a); - break; - default: - console.error( - 'THREE.DRACOLoader: Unexpected message, "' + - a.type + - '"' - ); - } - }), - this.workerPool.push(i); - } else - this.workerPool.sort(function (i, s) { - return i._taskLoad > s._taskLoad ? -1 : 1; - }); - const n = this.workerPool[this.workerPool.length - 1]; - return (n._taskCosts[e] = t), (n._taskLoad += t), n; - }); - } - _releaseTask(e, t) { - (e._taskLoad -= e._taskCosts[t]), - delete e._callbacks[t], - delete e._taskCosts[t]; - } - debug() { - console.log( - "Task load: ", - this.workerPool.map((e) => e._taskLoad) - ); - } - dispose() { - for (let e = 0; e < this.workerPool.length; ++e) - this.workerPool[e].terminate(); - return (this.workerPool.length = 0), this; - } - } - function C_() { - let r, e; - onmessage = function (a) { - const o = a.data; - switch (o.type) { - case "init": - (r = o.decoderConfig), - (e = new Promise(function (u) { - (r.onModuleLoaded = function (h) { - u({ draco: h }); - }), - DracoDecoderModule(r); - })); - break; - case "decode": - const l = o.buffer, - c = o.taskConfig; - e.then((u) => { - const h = u.draco, - d = new h.Decoder(), - f = new h.DecoderBuffer(); - f.Init(new Int8Array(l), l.byteLength); - try { - const g = t(h, d, f, c), - m = g.attributes.map((p) => p.array.buffer); - g.index && m.push(g.index.array.buffer), - self.postMessage( - { type: "decode", id: o.id, geometry: g }, - m - ); - } catch (g) { - console.error(g), - self.postMessage({ - type: "error", - id: o.id, - error: g.message, - }); - } finally { - h.destroy(f), h.destroy(d); - } - }); - break; - } - }; - function t(a, o, l, c) { - const u = c.attributeIDs, - h = c.attributeTypes; - let d, f; - const g = o.GetEncodedGeometryType(l); - if (g === a.TRIANGULAR_MESH) - (d = new a.Mesh()), (f = o.DecodeBufferToMesh(l, d)); - else if (g === a.POINT_CLOUD) - (d = new a.PointCloud()), (f = o.DecodeBufferToPointCloud(l, d)); - else throw new Error("THREE.DRACOLoader: Unexpected geometry type."); - if (!f.ok() || d.ptr === 0) - throw new Error( - "THREE.DRACOLoader: Decoding failed: " + f.error_msg() - ); - const m = { index: null, attributes: [] }; - for (const p in u) { - const v = self[h[p]]; - let M, x; - if (c.useUniqueIDs) - (x = u[p]), (M = o.GetAttributeByUniqueId(d, x)); - else { - if (((x = o.GetAttributeId(d, a[u[p]])), x === -1)) continue; - M = o.GetAttribute(d, x); - } - m.attributes.push(i(a, o, d, p, v, M)); - } - return ( - g === a.TRIANGULAR_MESH && (m.index = n(a, o, d)), a.destroy(d), m - ); - } - function n(a, o, l) { - const u = l.num_faces() * 3, - h = u * 4, - d = a._malloc(h); - o.GetTrianglesUInt32Array(l, h, d); - const f = new Uint32Array(a.HEAPF32.buffer, d, u).slice(); - return a._free(d), { array: f, itemSize: 1 }; - } - function i(a, o, l, c, u, h) { - const d = h.num_components(), - g = l.num_points() * d, - m = g * u.BYTES_PER_ELEMENT, - p = s(a, u), - v = a._malloc(m); - o.GetAttributeDataArrayForAllPoints(l, h, p, m, v); - const M = new u(a.HEAPF32.buffer, v, g).slice(); - return a._free(v), { name: c, array: M, itemSize: d }; - } - function s(a, o) { - switch (o) { - case Float32Array: - return a.DT_FLOAT32; - case Int8Array: - return a.DT_INT8; - case Int16Array: - return a.DT_INT16; - case Int32Array: - return a.DT_INT32; - case Uint8Array: - return a.DT_UINT8; - case Uint16Array: - return a.DT_UINT16; - case Uint32Array: - return a.DT_UINT32; - } - } - } - class L_ extends F0 { - constructor(e) { - super(e), (this.type = Mn); - } - parse(e) { - const o = function (x, w) { - switch (x) { - case 1: - console.error("THREE.RGBELoader Read Error: " + (w || "")); - break; - case 2: - console.error("THREE.RGBELoader Write Error: " + (w || "")); - break; - case 3: - console.error( - "THREE.RGBELoader Bad File Format: " + (w || "") - ); - break; - default: - case 4: - console.error("THREE.RGBELoader: Error: " + (w || "")); - } - return -1; - }, - h = ` -`, - d = function (x, w, y) { - w = w || 1024; - let L = x.pos, - _ = -1, - T = 0, - I = "", - F = String.fromCharCode.apply( - null, - new Uint16Array(x.subarray(L, L + 128)) - ); - for (; 0 > (_ = F.indexOf(h)) && T < w && L < x.byteLength; ) - (I += F), - (T += F.length), - (L += 128), - (F += String.fromCharCode.apply( - null, - new Uint16Array(x.subarray(L, L + 128)) - )); - return -1 < _ - ? (y !== !1 && (x.pos += T + _ + 1), I + F.slice(0, _)) - : !1; - }, - f = function (x) { - const w = /^#\?(\S+)/, - y = /^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/, - A = /^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/, - L = /^\s*FORMAT=(\S+)\s*$/, - _ = /^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/, - T = { - valid: 0, - string: "", - comments: "", - programtype: "RGBE", - format: "", - gamma: 1, - exposure: 1, - width: 0, - height: 0, - }; - let I, F; - if (x.pos >= x.byteLength || !(I = d(x))) - return o(1, "no header found"); - if (!(F = I.match(w))) return o(3, "bad initial token"); - for ( - T.valid |= 1, - T.programtype = F[1], - T.string += - I + - ` -`; - (I = d(x)), I !== !1; - - ) { - if ( - ((T.string += - I + - ` -`), - I.charAt(0) === "#") - ) { - T.comments += - I + - ` -`; - continue; - } - if ( - ((F = I.match(y)) && (T.gamma = parseFloat(F[1])), - (F = I.match(A)) && (T.exposure = parseFloat(F[1])), - (F = I.match(L)) && ((T.valid |= 2), (T.format = F[1])), - (F = I.match(_)) && - ((T.valid |= 4), - (T.height = parseInt(F[1], 10)), - (T.width = parseInt(F[2], 10))), - T.valid & 2 && T.valid & 4) - ) - break; - } - return T.valid & 2 - ? T.valid & 4 - ? T - : o(3, "missing image size specifier") - : o(3, "missing format specifier"); - }, - g = function (x, w, y) { - const A = w; - if (A < 8 || A > 32767 || x[0] !== 2 || x[1] !== 2 || x[2] & 128) - return new Uint8Array(x); - if (A !== ((x[2] << 8) | x[3])) - return o(3, "wrong scanline width"); - const L = new Uint8Array(4 * w * y); - if (!L.length) return o(4, "unable to allocate buffer space"); - let _ = 0, - T = 0; - const I = 4 * A, - F = new Uint8Array(4), - H = new Uint8Array(I); - let B = y; - for (; B > 0 && T < x.byteLength; ) { - if (T + 4 > x.byteLength) return o(1); - if ( - ((F[0] = x[T++]), - (F[1] = x[T++]), - (F[2] = x[T++]), - (F[3] = x[T++]), - F[0] != 2 || F[1] != 2 || ((F[2] << 8) | F[3]) != A) - ) - return o(3, "bad rgbe scanline format"); - let D = 0, - z; - for (; D < I && T < x.byteLength; ) { - z = x[T++]; - const k = z > 128; - if ((k && (z -= 128), z === 0 || D + z > I)) - return o(3, "bad scanline data"); - if (k) { - const G = x[T++]; - for (let U = 0; U < z; U++) H[D++] = G; - } else H.set(x.subarray(T, T + z), D), (D += z), (T += z); - } - const N = A; - for (let k = 0; k < N; k++) { - let G = 0; - (L[_] = H[k + G]), - (G += A), - (L[_ + 1] = H[k + G]), - (G += A), - (L[_ + 2] = H[k + G]), - (G += A), - (L[_ + 3] = H[k + G]), - (_ += 4); - } - B--; - } - return L; - }, - m = function (x, w, y, A) { - const L = x[w + 3], - _ = Math.pow(2, L - 128) / 255; - (y[A + 0] = x[w + 0] * _), - (y[A + 1] = x[w + 1] * _), - (y[A + 2] = x[w + 2] * _), - (y[A + 3] = 1); - }, - p = function (x, w, y, A) { - const L = x[w + 3], - _ = Math.pow(2, L - 128) / 255; - (y[A + 0] = pr.toHalfFloat(Math.min(x[w + 0] * _, 65504))), - (y[A + 1] = pr.toHalfFloat(Math.min(x[w + 1] * _, 65504))), - (y[A + 2] = pr.toHalfFloat(Math.min(x[w + 2] * _, 65504))), - (y[A + 3] = pr.toHalfFloat(1)); - }, - v = new Uint8Array(e); - v.pos = 0; - const M = f(v); - if (M !== -1) { - const x = M.width, - w = M.height, - y = g(v.subarray(v.pos), x, w); - if (y !== -1) { - let A, L, _; - switch (this.type) { - case Ft: - _ = y.length / 4; - const T = new Float32Array(_ * 4); - for (let F = 0; F < _; F++) m(y, F * 4, T, F * 4); - (A = T), (L = Ft); - break; - case Mn: - _ = y.length / 4; - const I = new Uint16Array(_ * 4); - for (let F = 0; F < _; F++) p(y, F * 4, I, F * 4); - (A = I), (L = Mn); - break; - default: - console.error( - "THREE.RGBELoader: unsupported type: ", - this.type - ); - break; - } - return { - width: x, - height: w, - data: A, - header: M.string, - gamma: M.gamma, - exposure: M.exposure, - type: L, - }; - } - } - return null; - } - setDataType(e) { - return (this.type = e), this; - } - load(e, t, n, i) { - function s(a, o) { - switch (a.type) { - case Ft: - case Mn: - (a.encoding = Vn), - (a.minFilter = $e), - (a.magFilter = $e), - (a.generateMipmaps = !1), - (a.flipY = !0); - break; - } - t && t(a, o); - } - return super.load(e, s, n, i); - } - } - class R_ extends Gr { - constructor() { - super(), - (this.experience = new Zt()), - (this.renderer = this.experience.renderer.instance), - this.setLoaders(), - (this.toLoad = 0), - (this.loaded = 0), - (this.items = {}); - } - setLoaders() { - (this.loaders = []), - this.loaders.push({ - extensions: ["jpg", "png"], - action: (s) => { - const a = new Image(); - a.addEventListener("load", () => { - this.fileLoadEnd(s, a); - }), - a.addEventListener("error", () => { - this.fileLoadEnd(s, a); - }), - (a.src = s.source); - }, - }); - const e = new Tc(); - e.setDecoderPath("draco/"), - e.setDecoderConfig({ type: "js" }), - this.loaders.push({ - extensions: ["drc"], - action: (s) => { - e.load(s.source, (a) => { - this.fileLoadEnd(s, a), Tc.releaseDecoderModule(); - }); - }, - }); - const t = new fv(); - t.setDRACOLoader(e), - this.loaders.push({ - extensions: ["glb", "gltf"], - action: (s) => { - t.load(s.source, (a) => { - this.fileLoadEnd(s, a); - }); - }, - }); - const n = new g_(); - this.loaders.push({ - extensions: ["fbx"], - action: (s) => { - n.load(s.source, (a) => { - this.fileLoadEnd(s, a); - }); - }, - }); - const i = new L_(); - this.loaders.push({ - extensions: ["hdr"], - action: (s) => { - i.load(s.source, (a) => { - this.fileLoadEnd(s, a); - }); - }, - }); - } - load(e = []) { - for (const t of e) { - this.toLoad++; - const n = t.source.match(/\.([a-z]+)$/); - if (typeof n[1] != "undefined") { - const i = n[1], - s = this.loaders.find((a) => a.extensions.find((o) => o === i)); - s ? s.action(t) : console.warn(`Cannot found loader for ${t}`); - } else console.warn(`Cannot found extension of ${t}`); - } - } - fileLoadEnd(e, t) { - this.loaded++, - (this.items[e.name] = t), - this.trigger("fileEnd", [e, t]), - this.loaded === this.toLoad && this.trigger("end"); - } - } - class P_ extends Gr { - constructor(e) { - super(), - (this.items = {}), - (this.loader = new R_({ renderer: this.renderer })), - (this.groups = {}), - (this.groups.assets = [...e]), - (this.groups.loaded = []), - (this.groups.current = null), - this.loadNextGroup(), - this.loader.on("fileEnd", (t, n) => { - let i = n; - t.type === "texture" && - (i instanceof nt || (i = new nt(n)), (i.needsUpdate = !0)), - (this.items[t.name] = i), - this.groups.current.loaded++, - this.trigger("progress", [this.groups.current, t, i]); - }), - this.loader.on("end", () => { - this.groups.loaded.push(this.groups.current), - this.trigger("groupEnd", [this.groups.current]), - this.groups.assets.length > 0 - ? this.loadNextGroup() - : this.trigger("end"); - }); - } - loadNextGroup() { - (this.groups.current = this.groups.assets.shift()), - (this.groups.current.toLoad = this.groups.current.items.length), - (this.groups.current.loaded = 0), - this.loader.load(this.groups.current.items); - } - createInstancedMeshes(e, t) { - const n = []; - for (const s of t) - n.push({ - name: s.name, - regex: s.regex, - meshesGroups: [], - instancedMeshes: [], - }); - const i = {}; - for (const s of n) i[s.name] = s.instancedMeshes; - return i; - } - destroy() { - for (const e in this.items) { - const t = this.items[e]; - t instanceof nt && t.dispose(); - } - } - } - var D_ = `in vec3 position; -in vec2 uv; - -out vec2 vUv; - -void main() -{ - vUv = uv; - gl_Position = vec4(position, 1.0); -}`, - I_ = `#define PI 3.1415926538 - -precision highp float; -precision highp int; - -in vec2 vUv; - -uniform sampler2D uSpaceTexture; -uniform sampler2D uDistortionTexture; -uniform vec2 uBlackHolePosition; -uniform float uRGBShiftRadius; - -layout(location = 0) out vec4 pc_FragColor; - -vec3 getRGBShiftedColor(sampler2D _texture, vec2 _uv, float _radius) -{ - vec3 angle = vec3( - PI * 2.0 / 3.0, - PI * 4.0 / 3.0, - 0 - ); - vec3 color = vec3(0.0); - color.r = texture(_texture, _uv + vec2(sin(angle.r) * _radius, cos(angle.r) * _radius)).r; - color.g = texture(_texture, _uv + vec2(sin(angle.g) * _radius, cos(angle.g) * _radius)).g; - color.b = texture(_texture, _uv + vec2(sin(angle.b) * _radius, cos(angle.b) * _radius)).b; - - return color; -} - -void main() -{ - vec4 distortionColor = texture(uDistortionTexture, vUv); - float distortionIntensity = distortionColor.r; - - vec2 towardCenter = vUv - uBlackHolePosition; - towardCenter *= - distortionIntensity * 2.0; - - - vec2 distoredUv = vUv + towardCenter; - vec3 outColor = getRGBShiftedColor(uSpaceTexture, distoredUv, uRGBShiftRadius); - - - - - pc_FragColor = vec4(outColor, 1.0); - -}`; - function F_() { - const r = {}, - e = {}; - return ( - (r.uSpaceTexture = { value: null }), - (r.uDistortionTexture = { value: null }), - (r.uBlackHolePosition = { value: new ve() }), - (r.uRGBShiftRadius = { value: 1e-5 }), - new jn({ - glslVersion: Tn, - depthWrite: !1, - depthTest: !1, - uniforms: r, - defines: e, - vertexShader: D_, - fragmentShader: I_, - }) - ); - } - class N_ { - constructor(e = {}) { - (this.experience = new Zt()), - (this.config = this.experience.config), - (this.debug = this.experience.debug), - (this.time = this.experience.time), - (this.sizes = this.experience.sizes), - (this.scenes = this.experience.scenes), - (this.camera = this.experience.camera), - this.setInstance(), - this.setComposition(); - } - setInstance() { - if ( - ((this.clearColor = "#000000"), - (this.instance = new rh({ alpha: !1, antialias: !0 })), - (this.instance.domElement.style.position = "absolute"), - (this.instance.domElement.style.top = 0), - (this.instance.domElement.style.left = 0), - (this.instance.domElement.style.width = "100%"), - (this.instance.domElement.style.height = "100%"), - this.instance.setClearColor(this.clearColor, 1), - this.instance.setSize(this.config.width, this.config.height), - this.instance.setPixelRatio(this.config.pixelRatio), - (this.instance.physicallyCorrectLights = !0), - (this.instance.outputEncoding = Pe), - (this.instance.shadowMap.type = Lc), - (this.instance.shadowMap.enabled = !0), - (this.instance.toneMapping = $t), - (this.instance.toneMappingExposure = 1), - (this.context = this.instance.getContext()), - this.debug.stats && this.debug.stats.setRenderPanel(this.context), - this.debug.active) - ) { - const e = this.debug.ui.getFolder("renderer"); - e.addColor(this, "clearColor").onChange(() => { - this.instance.setClearColor(this.clearColor); - }), - e - .add(this.instance, "toneMapping", { - NoToneMapping: $t, - LinearToneMapping: Dc, - ReinhardToneMapping: Ic, - CineonToneMapping: Fc, - ACESFilmicToneMapping: Nc, - }) - .onChange(() => { - this.scenes.traverse((t) => { - t instanceof Qe && (t.material.needsUpdate = !0); - }); - }), - e.add(this.instance, "toneMappingExposure").min(0).max(10); - } - } - setComposition() { - (this.composition = {}), - (this.composition.space = new Kt( - this.sizes.width * 2, - this.sizes.height * 2, - { magFilter: $e, minFilter: $e } - )), - (this.composition.distortion = new Kt( - this.sizes.width * 0.5, - this.sizes.height * 0.5, - { magFilter: $e, minFilter: $e, format: Uc, type: Ft } - )), - (this.composition.final = {}), - (this.composition.final.material = new F_()), - (this.composition.final.material.uniforms.uSpaceTexture.value = - this.composition.space.texture), - (this.composition.final.material.uniforms.uDistortionTexture.value = - this.composition.distortion.texture), - (this.composition.final.plane = new Qe( - new Gn(2, 2), - this.composition.final.material - )), - (this.composition.final.plane.frustumCulled = !1), - (this.composition.final.scene = new ws()), - this.composition.final.scene.add(this.composition.final.plane); - } - resize() { - this.instance.setSize(this.config.width, this.config.height), - this.instance.setPixelRatio(this.config.pixelRatio), - this.postProcess.composer.setSize( - this.config.width, - this.config.height - ), - this.postProcess.composer.setPixelRatio(this.config.pixelRatio); - } - update() { - this.debug.stats && this.debug.stats.beforeRender(), - (this.instance.autoClearColor = !0), - this.instance.setRenderTarget(this.composition.space), - this.instance.render(this.scenes.space, this.camera.instance), - this.instance.setRenderTarget(this.composition.distortion), - this.instance.render(this.scenes.distortion, this.camera.instance), - this.instance.setRenderTarget(null), - this.instance.render( - this.composition.final.scene, - this.camera.instance - ), - (this.instance.autoClearColor = !1), - this.instance.setRenderTarget(null), - this.instance.render(this.scenes.overlay, this.camera.instance), - this.debug.stats && this.debug.stats.afterRender(); - } - destroy() { - this.instance.renderLists.dispose(), - this.instance.dispose(), - this.renderTarget.dispose(), - this.postProcess.composer.renderTarget1.dispose(), - this.postProcess.composer.renderTarget2.dispose(); - } - } - const Ec = { type: "change" }, - Ia = { type: "start" }, - Ac = { type: "end" }; - class z_ extends hi { - constructor(e, t) { - super(), - t === void 0 && - console.warn( - 'THREE.OrbitControls: The second parameter "domElement" is now mandatory.' - ), - t === document && - console.error( - 'THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.' - ), - (this.object = e), - (this.domElement = t), - (this.domElement.style.touchAction = "none"), - (this.enabled = !0), - (this.target = new P()), - (this.minDistance = 0), - (this.maxDistance = 1 / 0), - (this.minZoom = 0), - (this.maxZoom = 1 / 0), - (this.minPolarAngle = 0), - (this.maxPolarAngle = Math.PI), - (this.minAzimuthAngle = -1 / 0), - (this.maxAzimuthAngle = 1 / 0), - (this.enableDamping = !1), - (this.dampingFactor = 0.05), - (this.enableZoom = !0), - (this.zoomSpeed = 1), - (this.enableRotate = !0), - (this.rotateSpeed = 1), - (this.enablePan = !0), - (this.panSpeed = 1), - (this.screenSpacePanning = !0), - (this.keyPanSpeed = 7), - (this.autoRotate = !1), - (this.autoRotateSpeed = 2), - (this.keys = { - LEFT: "ArrowLeft", - UP: "ArrowUp", - RIGHT: "ArrowRight", - BOTTOM: "ArrowDown", - }), - (this.mouseButtons = { - LEFT: mi.ROTATE, - MIDDLE: mi.DOLLY, - RIGHT: mi.PAN, - }), - (this.touches = { ONE: gi.ROTATE, TWO: gi.DOLLY_PAN }), - (this.target0 = this.target.clone()), - (this.position0 = this.object.position.clone()), - (this.zoom0 = this.object.zoom), - (this._domElementKeyEvents = null), - (this.getPolarAngle = function () { - return o.phi; - }), - (this.getAzimuthalAngle = function () { - return o.theta; - }), - (this.getDistance = function () { - return this.object.position.distanceTo(this.target); - }), - (this.listenToKeyEvents = function (S) { - S.addEventListener("keydown", Pt), - (this._domElementKeyEvents = S); - }), - (this.saveState = function () { - n.target0.copy(n.target), - n.position0.copy(n.object.position), - (n.zoom0 = n.object.zoom); - }), - (this.reset = function () { - n.target.copy(n.target0), - n.object.position.copy(n.position0), - (n.object.zoom = n.zoom0), - n.object.updateProjectionMatrix(), - n.dispatchEvent(Ec), - n.update(), - (s = i.NONE); - }), - (this.update = (function () { - const S = new P(), - K = new Mt().setFromUnitVectors(e.up, new P(0, 1, 0)), - re = K.clone().invert(), - te = new P(), - R = new Mt(), - ne = 2 * Math.PI; - return function () { - const ge = n.object.position; - S.copy(ge).sub(n.target), - S.applyQuaternion(K), - o.setFromVector3(S), - n.autoRotate && s === i.NONE && T(L()), - n.enableDamping - ? ((o.theta += l.theta * n.dampingFactor), - (o.phi += l.phi * n.dampingFactor)) - : ((o.theta += l.theta), (o.phi += l.phi)); - let le = n.minAzimuthAngle, - fe = n.maxAzimuthAngle; - return ( - isFinite(le) && - isFinite(fe) && - (le < -Math.PI ? (le += ne) : le > Math.PI && (le -= ne), - fe < -Math.PI ? (fe += ne) : fe > Math.PI && (fe -= ne), - le <= fe - ? (o.theta = Math.max(le, Math.min(fe, o.theta))) - : (o.theta = - o.theta > (le + fe) / 2 - ? Math.max(le, o.theta) - : Math.min(fe, o.theta))), - (o.phi = Math.max( - n.minPolarAngle, - Math.min(n.maxPolarAngle, o.phi) - )), - o.makeSafe(), - (o.radius *= c), - (o.radius = Math.max( - n.minDistance, - Math.min(n.maxDistance, o.radius) - )), - n.enableDamping === !0 - ? n.target.addScaledVector(u, n.dampingFactor) - : n.target.add(u), - S.setFromSpherical(o), - S.applyQuaternion(re), - ge.copy(n.target).add(S), - n.object.lookAt(n.target), - n.enableDamping === !0 - ? ((l.theta *= 1 - n.dampingFactor), - (l.phi *= 1 - n.dampingFactor), - u.multiplyScalar(1 - n.dampingFactor)) - : (l.set(0, 0, 0), u.set(0, 0, 0)), - (c = 1), - h || - te.distanceToSquared(n.object.position) > a || - 8 * (1 - R.dot(n.object.quaternion)) > a - ? (n.dispatchEvent(Ec), - te.copy(n.object.position), - R.copy(n.object.quaternion), - (h = !1), - !0) - : !1 - ); - }; - })()), - (this.dispose = function () { - n.domElement.removeEventListener("contextmenu", j), - n.domElement.removeEventListener("pointerdown", qe), - n.domElement.removeEventListener("pointercancel", At), - n.domElement.removeEventListener("wheel", Rt), - n.domElement.removeEventListener("pointermove", ot), - n.domElement.removeEventListener("pointerup", ut), - n._domElementKeyEvents !== null && - n._domElementKeyEvents.removeEventListener("keydown", Pt); - }); - const n = this, - i = { - NONE: -1, - ROTATE: 0, - DOLLY: 1, - PAN: 2, - TOUCH_ROTATE: 3, - TOUCH_PAN: 4, - TOUCH_DOLLY_PAN: 5, - TOUCH_DOLLY_ROTATE: 6, - }; - let s = i.NONE; - const a = 1e-6, - o = new sc(), - l = new sc(); - let c = 1; - const u = new P(); - let h = !1; - const d = new ve(), - f = new ve(), - g = new ve(), - m = new ve(), - p = new ve(), - v = new ve(), - M = new ve(), - x = new ve(), - w = new ve(), - y = [], - A = {}; - function L() { - return ((2 * Math.PI) / 60 / 60) * n.autoRotateSpeed; - } - function _() { - return Math.pow(0.95, n.zoomSpeed); - } - function T(S) { - l.theta -= S; - } - function I(S) { - l.phi -= S; - } - const F = (function () { - const S = new P(); - return function (re, te) { - S.setFromMatrixColumn(te, 0), S.multiplyScalar(-re), u.add(S); - }; - })(), - H = (function () { - const S = new P(); - return function (re, te) { - n.screenSpacePanning === !0 - ? S.setFromMatrixColumn(te, 1) - : (S.setFromMatrixColumn(te, 0), - S.crossVectors(n.object.up, S)), - S.multiplyScalar(re), - u.add(S); - }; - })(), - B = (function () { - const S = new P(); - return function (re, te) { - const R = n.domElement; - if (n.object.isPerspectiveCamera) { - const ne = n.object.position; - S.copy(ne).sub(n.target); - let ee = S.length(); - (ee *= Math.tan(((n.object.fov / 2) * Math.PI) / 180)), - F((2 * re * ee) / R.clientHeight, n.object.matrix), - H((2 * te * ee) / R.clientHeight, n.object.matrix); - } else - n.object.isOrthographicCamera - ? (F( - (re * (n.object.right - n.object.left)) / - n.object.zoom / - R.clientWidth, - n.object.matrix - ), - H( - (te * (n.object.top - n.object.bottom)) / - n.object.zoom / - R.clientHeight, - n.object.matrix - )) - : (console.warn( - "WARNING: OrbitControls.js encountered an unknown camera type - pan disabled." - ), - (n.enablePan = !1)); - }; - })(); - function D(S) { - n.object.isPerspectiveCamera - ? (c /= S) - : n.object.isOrthographicCamera - ? ((n.object.zoom = Math.max( - n.minZoom, - Math.min(n.maxZoom, n.object.zoom * S) - )), - n.object.updateProjectionMatrix(), - (h = !0)) - : (console.warn( - "WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled." - ), - (n.enableZoom = !1)); - } - function z(S) { - n.object.isPerspectiveCamera - ? (c *= S) - : n.object.isOrthographicCamera - ? ((n.object.zoom = Math.max( - n.minZoom, - Math.min(n.maxZoom, n.object.zoom / S) - )), - n.object.updateProjectionMatrix(), - (h = !0)) - : (console.warn( - "WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled." - ), - (n.enableZoom = !1)); - } - function N(S) { - d.set(S.clientX, S.clientY); - } - function k(S) { - M.set(S.clientX, S.clientY); - } - function G(S) { - m.set(S.clientX, S.clientY); - } - function U(S) { - f.set(S.clientX, S.clientY), - g.subVectors(f, d).multiplyScalar(n.rotateSpeed); - const K = n.domElement; - T((2 * Math.PI * g.x) / K.clientHeight), - I((2 * Math.PI * g.y) / K.clientHeight), - d.copy(f), - n.update(); - } - function X(S) { - x.set(S.clientX, S.clientY), - w.subVectors(x, M), - w.y > 0 ? D(_()) : w.y < 0 && z(_()), - M.copy(x), - n.update(); - } - function Z(S) { - p.set(S.clientX, S.clientY), - v.subVectors(p, m).multiplyScalar(n.panSpeed), - B(v.x, v.y), - m.copy(p), - n.update(); - } - function Y(S) { - S.deltaY < 0 ? z(_()) : S.deltaY > 0 && D(_()), n.update(); - } - function J(S) { - let K = !1; - switch (S.code) { - case n.keys.UP: - B(0, n.keyPanSpeed), (K = !0); - break; - case n.keys.BOTTOM: - B(0, -n.keyPanSpeed), (K = !0); - break; - case n.keys.LEFT: - B(n.keyPanSpeed, 0), (K = !0); - break; - case n.keys.RIGHT: - B(-n.keyPanSpeed, 0), (K = !0); - break; - } - K && (S.preventDefault(), n.update()); - } - function ae() { - if (y.length === 1) d.set(y[0].pageX, y[0].pageY); - else { - const S = 0.5 * (y[0].pageX + y[1].pageX), - K = 0.5 * (y[0].pageY + y[1].pageY); - d.set(S, K); - } - } - function ue() { - if (y.length === 1) m.set(y[0].pageX, y[0].pageY); - else { - const S = 0.5 * (y[0].pageX + y[1].pageX), - K = 0.5 * (y[0].pageY + y[1].pageY); - m.set(S, K); - } - } - function q() { - const S = y[0].pageX - y[1].pageX, - K = y[0].pageY - y[1].pageY, - re = Math.sqrt(S * S + K * K); - M.set(0, re); - } - function Ie() { - n.enableZoom && q(), n.enablePan && ue(); - } - function me() { - n.enableZoom && q(), n.enableRotate && ae(); - } - function xe(S) { - if (y.length == 1) f.set(S.pageX, S.pageY); - else { - const re = _e(S), - te = 0.5 * (S.pageX + re.x), - R = 0.5 * (S.pageY + re.y); - f.set(te, R); - } - g.subVectors(f, d).multiplyScalar(n.rotateSpeed); - const K = n.domElement; - T((2 * Math.PI * g.x) / K.clientHeight), - I((2 * Math.PI * g.y) / K.clientHeight), - d.copy(f); - } - function ce(S) { - if (y.length === 1) p.set(S.pageX, S.pageY); - else { - const K = _e(S), - re = 0.5 * (S.pageX + K.x), - te = 0.5 * (S.pageY + K.y); - p.set(re, te); - } - v.subVectors(p, m).multiplyScalar(n.panSpeed), - B(v.x, v.y), - m.copy(p); - } - function De(S) { - const K = _e(S), - re = S.pageX - K.x, - te = S.pageY - K.y, - R = Math.sqrt(re * re + te * te); - x.set(0, R), - w.set(0, Math.pow(x.y / M.y, n.zoomSpeed)), - D(w.y), - M.copy(x); - } - function Se(S) { - n.enableZoom && De(S), n.enablePan && ce(S); - } - function Me(S) { - n.enableZoom && De(S), n.enableRotate && xe(S); - } - function qe(S) { - n.enabled !== !1 && - (y.length === 0 && - (n.domElement.setPointerCapture(S.pointerId), - n.domElement.addEventListener("pointermove", ot), - n.domElement.addEventListener("pointerup", ut)), - Q(S), - S.pointerType === "touch" ? C(S) : st(S)); - } - function ot(S) { - n.enabled !== !1 && (S.pointerType === "touch" ? b(S) : Be(S)); - } - function ut(S) { - se(S), - y.length === 0 && - (n.domElement.releasePointerCapture(S.pointerId), - n.domElement.removeEventListener("pointermove", ot), - n.domElement.removeEventListener("pointerup", ut)), - n.dispatchEvent(Ac), - (s = i.NONE); - } - function At(S) { - se(S); - } - function st(S) { - let K; - switch (S.button) { - case 0: - K = n.mouseButtons.LEFT; - break; - case 1: - K = n.mouseButtons.MIDDLE; - break; - case 2: - K = n.mouseButtons.RIGHT; - break; - default: - K = -1; - } - switch (K) { - case mi.DOLLY: - if (n.enableZoom === !1) return; - k(S), (s = i.DOLLY); - break; - case mi.ROTATE: - if (S.ctrlKey || S.metaKey || S.shiftKey) { - if (n.enablePan === !1) return; - G(S), (s = i.PAN); - } else { - if (n.enableRotate === !1) return; - N(S), (s = i.ROTATE); - } - break; - case mi.PAN: - if (S.ctrlKey || S.metaKey || S.shiftKey) { - if (n.enableRotate === !1) return; - N(S), (s = i.ROTATE); - } else { - if (n.enablePan === !1) return; - G(S), (s = i.PAN); - } - break; - default: - s = i.NONE; - } - s !== i.NONE && n.dispatchEvent(Ia); - } - function Be(S) { - if (n.enabled !== !1) - switch (s) { - case i.ROTATE: - if (n.enableRotate === !1) return; - U(S); - break; - case i.DOLLY: - if (n.enableZoom === !1) return; - X(S); - break; - case i.PAN: - if (n.enablePan === !1) return; - Z(S); - break; - } - } - function Rt(S) { - n.enabled === !1 || - n.enableZoom === !1 || - s !== i.NONE || - (S.preventDefault(), - n.dispatchEvent(Ia), - Y(S), - n.dispatchEvent(Ac)); - } - function Pt(S) { - n.enabled === !1 || n.enablePan === !1 || J(S); - } - function C(S) { - switch ((he(S), y.length)) { - case 1: - switch (n.touches.ONE) { - case gi.ROTATE: - if (n.enableRotate === !1) return; - ae(), (s = i.TOUCH_ROTATE); - break; - case gi.PAN: - if (n.enablePan === !1) return; - ue(), (s = i.TOUCH_PAN); - break; - default: - s = i.NONE; - } - break; - case 2: - switch (n.touches.TWO) { - case gi.DOLLY_PAN: - if (n.enableZoom === !1 && n.enablePan === !1) return; - Ie(), (s = i.TOUCH_DOLLY_PAN); - break; - case gi.DOLLY_ROTATE: - if (n.enableZoom === !1 && n.enableRotate === !1) return; - me(), (s = i.TOUCH_DOLLY_ROTATE); - break; - default: - s = i.NONE; - } - break; - default: - s = i.NONE; - } - s !== i.NONE && n.dispatchEvent(Ia); - } - function b(S) { - switch ((he(S), s)) { - case i.TOUCH_ROTATE: - if (n.enableRotate === !1) return; - xe(S), n.update(); - break; - case i.TOUCH_PAN: - if (n.enablePan === !1) return; - ce(S), n.update(); - break; - case i.TOUCH_DOLLY_PAN: - if (n.enableZoom === !1 && n.enablePan === !1) return; - Se(S), n.update(); - break; - case i.TOUCH_DOLLY_ROTATE: - if (n.enableZoom === !1 && n.enableRotate === !1) return; - Me(S), n.update(); - break; - default: - s = i.NONE; - } - } - function j(S) { - n.enabled !== !1 && S.preventDefault(); - } - function Q(S) { - y.push(S); - } - function se(S) { - delete A[S.pointerId]; - for (let K = 0; K < y.length; K++) - if (y[K].pointerId == S.pointerId) { - y.splice(K, 1); - return; - } - } - function he(S) { - let K = A[S.pointerId]; - K === void 0 && ((K = new ve()), (A[S.pointerId] = K)), - K.set(S.pageX, S.pageY); - } - function _e(S) { - const K = S.pointerId === y[0].pointerId ? y[1] : y[0]; - return A[K.pointerId]; - } - n.domElement.addEventListener("contextmenu", j), - n.domElement.addEventListener("pointerdown", qe), - n.domElement.addEventListener("pointercancel", At), - n.domElement.addEventListener("wheel", Rt, { passive: !1 }), - this.update(); - } - } - class O_ { - constructor(e) { - (this.experience = new Zt()), - (this.config = this.experience.config), - (this.debug = this.experience.debug), - (this.time = this.experience.time), - (this.sizes = this.experience.sizes), - (this.targetElement = this.experience.targetElement), - (this.scenes = this.experience.scenes), - (this.mode = "debug"), - this.setInstance(), - this.setModes(), - this.debug.active && - this.debug.ui - .getFolder("camera") - .add(this, "mode", { debug: "debug", default: "default" }); - } - setInstance() { - (this.instance = new mt( - 45, - this.config.width / this.config.height, - 0.1, - 1e3 - )), - this.instance.rotation.reorder("YXZ"), - this.scenes.space.add(this.instance); - } - setModes() { - (this.modes = {}), - (this.modes.default = {}), - (this.modes.default.instance = this.instance.clone()), - this.modes.default.instance.rotation.reorder("YXZ"), - (this.modes.debug = {}), - (this.modes.debug.instance = this.instance.clone()), - this.modes.debug.instance.rotation.reorder("YXZ"), - this.modes.debug.instance.position.set(5, 2, 5), - (this.modes.debug.orbitControls = new z_( - this.modes.debug.instance, - this.targetElement - )), - (this.modes.debug.orbitControls.enabled = this.modes.debug.active), - (this.modes.debug.orbitControls.screenSpacePanning = !0), - (this.modes.debug.orbitControls.enableKeys = !1), - (this.modes.debug.orbitControls.zoomSpeed = 0.25), - (this.modes.debug.orbitControls.enableDamping = !0), - this.modes.debug.orbitControls.update(); - } - resize() { - (this.instance.aspect = this.config.width / this.config.height), - this.instance.updateProjectionMatrix(), - (this.modes.default.instance.aspect = - this.config.width / this.config.height), - this.modes.default.instance.updateProjectionMatrix(), - (this.modes.debug.instance.aspect = - this.config.width / this.config.height), - this.modes.debug.instance.updateProjectionMatrix(); - } - update() { - this.modes.debug.orbitControls.update(); - const e = this.modes[this.mode].instance; - e.updateWorldMatrix(!0, !1), - this.instance.position.set(0, 0, 0), - this.instance.quaternion.set(0, 0, 0, 0), - this.instance.scale.set(1, 1, 1), - this.instance.applyMatrix4(e.matrixWorld), - this.instance.scale.set(1, 1, 1); - } - destroy() { - this.modes.debug.orbitControls.destroy(); - } - } - var k_ = `in vec3 position; -in vec2 uv; - -out vec2 vUv; - -void main() -{ - gl_Position = vec4(position, 1.0); - - vUv = uv; -}`, - U_ = `precision highp float; -precision highp int; - -in vec2 vUv; - -vec3 mod289(vec3 x) -{ - return x - floor(x * (1.0 / 289.0)) * 289.0; -} - -vec4 mod289(vec4 x) -{ - return x - floor(x * (1.0 / 289.0)) * 289.0; -} - -vec4 permute(vec4 x) -{ - return mod289(((x*34.0)+10.0)*x); -} - -vec4 taylorInvSqrt(vec4 r) -{ - return 1.79284291400159 - 0.85373472095314 * r; -} - -vec3 fade(vec3 t) { - return t*t*t*(t*(t*6.0-15.0)+10.0); -} - -float perlin3dPeriodic(vec3 P, vec3 rep) -{ - vec3 Pi0 = mod(floor(P), rep); - vec3 Pi1 = mod(Pi0 + vec3(1.0), rep); - Pi0 = mod289(Pi0); - Pi1 = mod289(Pi1); - vec3 Pf0 = fract(P); - vec3 Pf1 = Pf0 - vec3(1.0); - vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x); - vec4 iy = vec4(Pi0.yy, Pi1.yy); - vec4 iz0 = Pi0.zzzz; - vec4 iz1 = Pi1.zzzz; - - vec4 ixy = permute(permute(ix) + iy); - vec4 ixy0 = permute(ixy + iz0); - vec4 ixy1 = permute(ixy + iz1); - - vec4 gx0 = ixy0 * (1.0 / 7.0); - vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5; - gx0 = fract(gx0); - vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0); - vec4 sz0 = step(gz0, vec4(0.0)); - gx0 -= sz0 * (step(0.0, gx0) - 0.5); - gy0 -= sz0 * (step(0.0, gy0) - 0.5); - - vec4 gx1 = ixy1 * (1.0 / 7.0); - vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5; - gx1 = fract(gx1); - vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1); - vec4 sz1 = step(gz1, vec4(0.0)); - gx1 -= sz1 * (step(0.0, gx1) - 0.5); - gy1 -= sz1 * (step(0.0, gy1) - 0.5); - - vec3 g000 = vec3(gx0.x,gy0.x,gz0.x); - vec3 g100 = vec3(gx0.y,gy0.y,gz0.y); - vec3 g010 = vec3(gx0.z,gy0.z,gz0.z); - vec3 g110 = vec3(gx0.w,gy0.w,gz0.w); - vec3 g001 = vec3(gx1.x,gy1.x,gz1.x); - vec3 g101 = vec3(gx1.y,gy1.y,gz1.y); - vec3 g011 = vec3(gx1.z,gy1.z,gz1.z); - vec3 g111 = vec3(gx1.w,gy1.w,gz1.w); - - vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110))); - g000 *= norm0.x; - g010 *= norm0.y; - g100 *= norm0.z; - g110 *= norm0.w; - vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111))); - g001 *= norm1.x; - g011 *= norm1.y; - g101 *= norm1.z; - g111 *= norm1.w; - - float n000 = dot(g000, Pf0); - float n100 = dot(g100, vec3(Pf1.x, Pf0.yz)); - float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z)); - float n110 = dot(g110, vec3(Pf1.xy, Pf0.z)); - float n001 = dot(g001, vec3(Pf0.xy, Pf1.z)); - float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z)); - float n011 = dot(g011, vec3(Pf0.x, Pf1.yz)); - float n111 = dot(g111, Pf1); - - vec3 fade_xyz = fade(Pf0); - vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z); - vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y); - float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); - return 2.2 * n_xyz; -} - -layout(location = 0) out vec4 pc_FragColor; - -void main() -{ - float uFrequency = 8.0; - - float noiseR = perlin3dPeriodic(vec3(vUv * uFrequency, 123.456), vec3(uFrequency)) * 0.5 + 0.5; - float noiseG = perlin3dPeriodic(vec3(vUv * uFrequency, 456.789), vec3(uFrequency)) * 0.5 + 0.5; - float noiseB = perlin3dPeriodic(vec3(vUv * uFrequency, 789.123), vec3(uFrequency)) * 0.5 + 0.5; - - pc_FragColor = vec4(noiseR, noiseG, noiseB, 1.0); -}`; - function B_() { - return new jn({ - glslVersion: Tn, - uniforms: {}, - vertexShader: k_, - fragmentShader: U_, - }); - } - const Ss = class { - constructor() { - if (Ss.instance) return Ss.instance; - (Ss.instance = this), - (this.experience = new Zt()), - (this.renderer = this.experience.renderer), - (this.scenes = this.experience.scenes), - this.setCustomRender(), - this.setMaterial(), - this.setPlane(); - } - setCustomRender() { - (this.customRender = {}), - (this.customRender.scene = new ws()), - (this.customRender.camera = new zs(-1, 1, 1, -1, 0.1, 10)); - } - setMaterial() { - this.material = new B_(); - } - setPlane() { - (this.plane = new Qe(new Gn(2, 2), this.material)), - (this.plane.frustumCulled = !1), - this.customRender.scene.add(this.plane); - } - setDebugPlane() { - (this.debugPlane = {}), - (this.debugPlane.geometry = new Gn(1, 1)), - (this.debugPlane.material = new wn()); - const e = new Qe(this.debugPlane.geometry, this.debugPlane.material); - (e.position.y = 5 + 1), (e.position.x = -1), e.scale.set(2, 2, 2); - const t = new Qe(this.debugPlane.geometry, this.debugPlane.material); - (t.position.y = 5 + 1), (t.position.x = 1), t.scale.set(2, 2, 2); - const n = new Qe(this.debugPlane.geometry, this.debugPlane.material); - (n.position.y = 5 - 1), (n.position.x = -1), n.scale.set(2, 2, 2); - const i = new Qe(this.debugPlane.geometry, this.debugPlane.material); - (i.position.y = 5 - 1), - (i.position.x = 1), - i.scale.set(2, 2, 2), - window.requestAnimationFrame(() => { - this.scenes.space.add(e); - }); - } - create(e, t) { - const n = new Kt(e, t, { generateMipmaps: !1, wrapS: hn, wrapT: hn }); - this.renderer.instance.setRenderTarget(n), - this.renderer.instance.render( - this.customRender.scene, - this.customRender.camera - ), - this.renderer.instance.setRenderTarget(null); - const i = n.texture; - return this.debugPlane && (this.debugPlane.material.map = i), i; - } - }; - let br = Ss; - Xr(br, "instance"); - var V_ = `uniform mat4 projectionMatrix; -uniform mat4 modelViewMatrix; - -in vec3 position; -in vec2 uv; - -out vec2 vUv; - -void main() -{ - gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); - - vUv = uv; -}`, - G_ = `precision highp float; -precision highp int; - -uniform float uTime; -uniform sampler2D uNoiseTexture; -uniform vec3 uInnerColor; -uniform vec3 uOuterColor; - -in vec2 vUv; - -layout(location = 0) out vec4 pc_FragColor; - -float inverseLerp(float v, float minValue, float maxValue) -{ - return (v - minValue) / (maxValue - minValue); -} - -float remap(float v, float inMin, float inMax, float outMin, float outMax) -{ - float t = inverseLerp(v, inMin, inMax); - return mix(outMin, outMax, t); -} - -float blendAdd(float base, float blend) -{ - return min(base+blend,1.0); -} - -vec3 blendAdd(vec3 base, vec3 blend) -{ - return min(base+blend,vec3(1.0)); -} - -vec3 blendAdd(vec3 base, vec3 blend, float opacity) -{ - return (blendAdd(base, blend) * opacity + base * (1.0 - opacity)); -} - -void main() -{ - - vec4 color = vec4(0.0); - color.a = 1.0; - - float iterations = 3.0; - - for(float i = 0.0; i < iterations; i++) - { - float progress = i / (iterations - 1.0); - - float intensity = 1.0 - ((vUv.y - progress) * iterations) * 0.5; - intensity = smoothstep(0.0, 1.0, intensity); - - vec2 uv = vUv; - uv.y *= 2.0; - uv.x += uTime / ((i * 10.0) + 1.0); - - - - - vec3 ringColor = mix(uInnerColor, uOuterColor, progress); - - float noiseIntensity = texture(uNoiseTexture, uv).r; - - ringColor = mix(vec3(0.0), ringColor.rgb, noiseIntensity * intensity); - - color.rgb = blendAdd(color.rgb, ringColor); - } - - float edgesAttenuation = min(inverseLerp(vUv.y, 0.0, 0.02), inverseLerp(vUv.y, 1.0, 0.5)); - - - color.rgb = mix(vec3(0.0), color.rgb, edgesAttenuation); - - - pc_FragColor = color; -}`; - function H_() { - return new jn({ - glslVersion: Tn, - side: cn, - blending: Sr, - depthWrite: !1, - depthTest: !1, - transparent: !0, - uniforms: { - uTime: { value: 0 }, - uNoiseTexture: { value: null }, - uInnerColor: { value: new de("#ff8080") }, - uOuterColor: { value: new de("#3633ff") }, - }, - vertexShader: V_, - fragmentShader: G_, - }); - } - var W_ = `#define PI 3.1415926538 - -uniform mat4 projectionMatrix; -uniform mat4 modelViewMatrix; -uniform float uTime; -uniform vec3 uInnerColor; -uniform vec3 uOuterColor; -uniform float uViewHeight; -uniform float uSize; - -in float position; -in float aSize; -in float aRandom; - -out vec3 vColor; - -void main() -{ - - float concentration = 0.05; - float outerProgress = smoothstep(0.0, 1.0, position); - outerProgress = mix(concentration, outerProgress, pow(aRandom, 1.7)); - float radius = 1.0 + outerProgress * 5.0; - - float angle = outerProgress - uTime * (1.0 - outerProgress) * 3.0; - vec3 newPosition = vec3( - sin(angle) * radius, - 0.0, - cos(angle) * radius - ); - vec4 modelViewPosition = modelViewMatrix * vec4(newPosition, 1.0); - gl_Position = projectionMatrix * modelViewPosition; - - gl_PointSize = aSize * uSize * uViewHeight; - gl_PointSize *= (1.0 / - modelViewPosition.z); - - vColor = mix(uInnerColor, uOuterColor, outerProgress); -}`, - j_ = `precision highp float; -precision highp int; - -layout(location = 0) out vec4 pc_FragColor; - -in vec3 vColor; - -void main() -{ - - float distanceToCenter = length(gl_PointCoord - vec2(0.5)); - if(distanceToCenter > 0.5) - discard; - - pc_FragColor = vec4(vColor, 0.5); - -}`; - function X_() { - return new jn({ - glslVersion: Tn, - blending: Sr, - depthWrite: !1, - depthTest: !1, - transparent: !0, - uniforms: { - uTime: { value: 0 }, - uInnerColor: { value: new de("#ff8080") }, - uOuterColor: { value: new de("#3633ff") }, - uViewHeight: { value: 1024 }, - uSize: { value: 0.015 }, - }, - vertexShader: W_, - fragmentShader: j_, - }); - } - var q_ = `uniform mat4 projectionMatrix; -uniform mat4 modelViewMatrix; - -in vec3 position; -in vec2 uv; - -out vec2 vUv; - -void main() -{ - gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); - - vUv = uv; -}`, - $_ = `precision highp float; -precision highp int; - -in vec2 vUv; - -layout(location = 0) out vec4 pc_FragColor; - -float inverseLerp(float v, float minValue, float maxValue) -{ - return (v - minValue) / (maxValue - minValue); -} - -float remap(float v, float inMin, float inMax, float outMin, float outMax) -{ - float t = inverseLerp(v, inMin, inMax); - return mix(outMin, outMax, t); -} - -void main() -{ - float distanceToCenter = length(vUv - 0.5); - float radialStrength = remap(distanceToCenter, 0.0, 0.15, 1.0, 0.0); - radialStrength = smoothstep(0.0, 1.0, radialStrength); - - - - - float strength = radialStrength; - - pc_FragColor = vec4(strength, 1.0, 1.0, 1.0); -}`; - function Y_() { - return new jn({ - glslVersion: Tn, - side: cn, - transparent: !0, - uniforms: {}, - vertexShader: q_, - fragmentShader: $_, - }); - } - var K_ = `uniform mat4 projectionMatrix; -uniform mat4 modelViewMatrix; - -in vec3 position; -in vec2 uv; - -out vec2 vUv; - -void main() -{ - gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); - - vUv = uv; -}`, - Z_ = `precision highp float; -precision highp int; - -in vec2 vUv; - -layout(location = 0) out vec4 pc_FragColor; - -float inverseLerp(float v, float minValue, float maxValue) -{ - return (v - minValue) / (maxValue - minValue); -} - -float remap(float v, float inMin, float inMax, float outMin, float outMax) -{ - float t = inverseLerp(v, inMin, inMax); - return mix(outMin, outMax, t); -} - -void main() -{ - float distanceToCenter = length(vUv - 0.5); - float radialStrength = remap(distanceToCenter, 0.0, 0.15, 1.0, 0.0); - radialStrength = smoothstep(0.0, 1.0, radialStrength); - - float alpha = smoothstep(0.0, 1.0, remap(distanceToCenter, 0.4, 0.5, 1.0, 0.0)); - - pc_FragColor = vec4(radialStrength, 0.0, 0.0, alpha); -}`; - function J_() { - return new jn({ - glslVersion: Tn, - side: cn, - transparent: !0, - uniforms: {}, - vertexShader: K_, - fragmentShader: Z_, - }); - } - class Q_ { - constructor() { - (this.experience = new Zt()), - (this.config = this.experience.config), - (this.scenes = this.experience.scenes), - (this.time = this.experience.time), - (this.debug = this.experience.debug), - (this.sizes = this.experience.sizes), - (this.camera = this.experience.camera), - (this.renderer = this.experience.renderer), - (this.noises = new br()), - this.setCommonUniforms(), - this.setParticles(), - this.setDisc(), - this.setDistortion(); - } - setCommonUniforms() { - if ( - ((this.commonUniforms = {}), - (this.commonUniforms.uInnerColor = { value: new de("#ff8080") }), - (this.commonUniforms.uOuterColor = { value: new de("#3633ff") }), - this.debug.active) - ) { - const e = this.debug.ui.getFolder("blackhole"); - e.addColor(this.commonUniforms.uInnerColor, "value"), - e.addColor(this.commonUniforms.uOuterColor, "value"); - } - } - setDisc() { - (this.disc = {}), - (this.disc.geometry = new ho(5, 1, 0, 64, 10, !0)), - (this.disc.noiseTexture = this.noises.create(128, 128)), - (this.disc.material = new H_()), - (this.disc.material.uniforms.uNoiseTexture.value = - this.disc.noiseTexture), - (this.disc.material.uniforms.uInnerColor = - this.commonUniforms.uInnerColor), - (this.disc.material.uniforms.uOuterColor = - this.commonUniforms.uOuterColor), - (this.disc.mesh = new Qe(this.disc.geometry, this.disc.material)), - this.scenes.space.add(this.disc.mesh); - } - setParticles() { - (this.particles = {}), (this.particles.count = 5e4); - const e = new Float32Array(this.particles.count), - t = new Float32Array(this.particles.count), - n = new Float32Array(this.particles.count); - for (let i = 0; i < this.particles.count; i++) - (e[i] = Math.random()), - (t[i] = Math.random()), - (n[i] = Math.random()); - (this.particles.geometry = new ct()), - this.particles.geometry.setAttribute("position", new Xe(e, 1)), - this.particles.geometry.setAttribute("aSize", new Xe(t, 1)), - this.particles.geometry.setAttribute("aRandom", new Xe(n, 1)), - (this.particles.material = new X_()), - (this.particles.material.uniforms.uViewHeight.value = - this.renderer.composition.space.height), - (this.particles.material.uniforms.uInnerColor = - this.commonUniforms.uInnerColor), - (this.particles.material.uniforms.uOuterColor = - this.commonUniforms.uOuterColor), - (this.particles.points = new co( - this.particles.geometry, - this.particles.material - )), - (this.particles.points.frustumCulled = !1), - this.scenes.space.add(this.particles.points); - } - setDistortion() { - (this.distortion = {}), - (this.distortion.active = {}), - (this.distortion.active.geometry = new Gn(1, 1)), - (this.distortion.active.material = new Y_()), - (this.distortion.active.mesh = new Qe( - this.distortion.active.geometry, - this.distortion.active.material - )), - this.distortion.active.mesh.scale.set(10, 10, 10), - this.scenes.distortion.add(this.distortion.active.mesh), - (this.distortion.mask = {}), - (this.distortion.mask.geometry = new Gn(1, 1)), - (this.distortion.mask.material = new J_()), - (this.distortion.mask.mesh = new Qe( - this.distortion.mask.geometry, - this.distortion.mask.material - )), - this.distortion.mask.mesh.scale.set(10, 10, 10), - (this.distortion.mask.mesh.rotation.x = Math.PI * 0.5), - this.scenes.distortion.add(this.distortion.mask.mesh); - } - resize() { - this.particles.material.uniforms.uViewHeight.value = - this.sizes.height; - } - update() { - const e = new P(0, 0, 0); - e.project(this.camera.instance), - (e.x = e.x * 0.5 + 0.5), - (e.y = e.y * 0.5 + 0.5), - (this.disc.material.uniforms.uTime.value = this.time.elapsed), - (this.particles.material.uniforms.uTime.value = - this.time.elapsed + 9999), - this.distortion.active.mesh.lookAt(this.camera.instance.position), - this.renderer.composition.final.material.uniforms.uBlackHolePosition.value.set( - e.x, - e.y - ); - } - } - var ex = `#define PI 3.1415926538 - -uniform mat4 projectionMatrix; -uniform mat4 modelViewMatrix; -uniform float uTime; -uniform vec3 uInnerColor; -uniform vec3 uOuterColor; -uniform float uViewHeight; -uniform float uSize; - -in vec3 position; -in float aSize; -in vec3 aColor; - -out vec3 vColor; - -void main() -{ - vec4 modelViewPosition = modelViewMatrix * vec4(position, 1.0); - gl_Position = projectionMatrix * modelViewPosition; - - gl_PointSize = aSize * uSize * uViewHeight; - - - vColor = aColor; -}`, - tx = `precision highp float; -precision highp int; - -layout(location = 0) out vec4 pc_FragColor; - -in vec3 vColor; - -void main() -{ - - float distanceToCenter = length(gl_PointCoord - vec2(0.5)); - if(distanceToCenter > 0.5) - discard; - - pc_FragColor = vec4(vColor, 1.0); - -}`; - function nx() { - return new jn({ - glslVersion: Tn, - depthWrite: !1, - depthTest: !1, - uniforms: { uViewHeight: { value: 1024 }, uSize: { value: 0.001 } }, - vertexShader: ex, - fragmentShader: tx, - }); - } - class ix { - constructor() { - (this.experience = new Zt()), - (this.config = this.experience.config), - (this.scenes = this.experience.scenes), - (this.time = this.experience.time), - (this.debug = this.experience.debug), - (this.sizes = this.experience.sizes), - (this.camera = this.experience.camera), - (this.renderer = this.experience.renderer), - this.setParticles(); - } - setParticles() { - (this.particles = {}), (this.particles.count = 5e4); - const e = new Float32Array(this.particles.count * 3), - t = new Float32Array(this.particles.count), - n = new Float32Array(this.particles.count * 3); - for (let i = 0; i < this.particles.count; i++) { - const s = i * 3, - a = 2 * Math.PI * Math.random(), - o = Math.acos(2 * Math.random() - 1), - l = Math.cos(a) * Math.sin(o) * 400, - c = Math.sin(a) * Math.sin(o) * 400, - u = Math.cos(o) * 400; - (e[s + 0] = l), - (e[s + 1] = c), - (e[s + 2] = u), - (t[i] = Math.random()); - const h = new de( - `hsl(${Math.round(360 * Math.random())}, 100%, 80%)` - ); - (n[s + 0] = h.r), (n[s + 1] = h.g), (n[s + 2] = h.b); - } - (this.particles.geometry = new ct()), - this.particles.geometry.setAttribute("position", new Xe(e, 3)), - this.particles.geometry.setAttribute("aSize", new Xe(t, 1)), - this.particles.geometry.setAttribute("aColor", new Xe(n, 3)), - (this.particles.material = new nx()), - (this.particles.material.uniforms.uViewHeight.value = - this.renderer.composition.space.height), - (this.particles.points = new co( - this.particles.geometry, - this.particles.material - )), - (this.particles.points.frustumCulled = !1), - this.scenes.space.add(this.particles.points); - } - resize() { - this.particles.material.uniforms.uViewHeight.value = - this.sizes.height; - } - update() {} - } - class sx { - constructor(e) { - (this.experience = new Zt()), - (this.config = this.experience.config), - (this.scenes = this.experience.scenes), - (this.resources = this.experience.resources), - (this.blackHole = new Q_()), - (this.stars = new ix()); - } - resize() { - this.blackHole && this.blackHole.resize(); - } - update() { - this.blackHole && this.blackHole.update(); - } - destroy() {} - } - var rx = [{ name: "base", data: {}, items: [] }]; - const Ts = class { - constructor(e = {}) { - if (Ts.instance) return Ts.instance; - if ( - ((Ts.instance = this), - (this.targetElement = e.targetElement), - !this.targetElement) - ) { - console.warn("Missing 'targetElement' property"); - return; - } - (this.time = new Y0()), - (this.sizes = new K0()), - this.setConfig(), - this.setDebug(), - this.setScenes(), - this.setCamera(), - this.setRenderer(), - this.setResources(), - this.setWorld(), - this.sizes.on("resize", () => { - this.resize(); - }), - this.update(); - } - setConfig() { - (this.config = {}), - (this.config.pixelRatio = Math.min( - Math.max(window.devicePixelRatio, 1), - 2 - )); - const e = this.targetElement.getBoundingClientRect(); - (this.config.width = e.width), - (this.config.height = e.height || window.innerHeight); - } - setDebug() { - this.debug = new dv(); - } - setScenes() { - (this.scenes = {}), - (this.scenes.space = new ws()), - (this.scenes.distortion = new ws()), - (this.scenes.overlay = new ws()); - } - setCamera() { - this.camera = new O_(); - } - setRenderer() { - (this.renderer = new N_({ rendererInstance: this.rendererInstance })), - this.targetElement.appendChild(this.renderer.instance.domElement); - } - setResources() { - this.resources = new P_(rx); - } - setWorld() { - this.world = new sx(); - } - update() { - this.stats && this.stats.update(), - this.world && this.world.update(), - this.camera.update(), - this.renderer && this.renderer.update(), - window.requestAnimationFrame(() => { - this.update(); - }); - } - resize() { - const e = this.targetElement.getBoundingClientRect(); - (this.config.width = e.width), - (this.config.height = e.height), - (this.config.pixelRatio = Math.min( - Math.max(window.devicePixelRatio, 1), - 2 - )), - this.camera && this.camera.resize(), - this.renderer && this.renderer.resize(), - this.world && this.world.resize(); - } - destroy() {} - }; - let Zt = Ts; - Xr(Zt, "instance"); - new Zt({ targetElement: document.querySelector(".experience") }); - //# sourceMappingURL=index.c2b8a264.js.map - }, []); - return
; -} -export { Blackhole }; diff --git a/components/demo_components/counters.module.css b/components/demo_components/counters.module.css deleted file mode 100644 index 4a5d0c84..00000000 --- a/components/demo_components/counters.module.css +++ /dev/null @@ -1,6 +0,0 @@ -.counter { - border: 1px solid #ccc; - border-radius: 5px; - padding: 2px 6px; - margin: 12px 0 0; -} diff --git a/components/demo_components/counters.tsx b/components/demo_components/counters.tsx deleted file mode 100644 index b78f12db..00000000 --- a/components/demo_components/counters.tsx +++ /dev/null @@ -1,24 +0,0 @@ -// Example from https://beta.reactjs.org/learn - -import { useState } from 'react' -import styles from './counters.module.css' - -function MyButton() { - const [count, setCount] = useState(0) - - function handleClick() { - setCount(count + 1) - } - - return ( -
- -
- ) -} - -export default function MyApp() { - return -} diff --git a/components/demo_components/galaxy.js b/components/demo_components/galaxy.js deleted file mode 100644 index e0beba77..00000000 --- a/components/demo_components/galaxy.js +++ /dev/null @@ -1,176 +0,0 @@ -import React, { useEffect } from "react"; -import * as THREE from "three"; -import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js"; -function Galaxy() { - useEffect(() => { - const rootFontSize = 16; - // Convert 16 rem to pixels (assuming 1 rem = 16px by default or based on root font size) - const remInPixels = 16 * rootFontSize; - // Subtract 16rem in pixels from the full width of the window - let w = window.innerWidth - remInPixels; - let h = window.innerHeight; - - const scene = new THREE.Scene(); - - const camera = new THREE.PerspectiveCamera(60, w / h, 0.001, 1000); - camera.position.set(0, 3, 24); - camera.lookAt(scene.position); - - const renderer = new THREE.WebGLRenderer({ - antialias: true, - // alpha: true, - }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(w, h); - renderer.setClearColor(0x160016, 1); - document.getElementById("animation").appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - // controls.enableDamping = true; - // controls.enablePan = false; - - // const geometry = new THREE.SphereGeometry(1, 64, 64); - const count1 = 50000; - const count2 = 100000; - - const geometry = new THREE.BufferGeometry(); - const positions = []; - const sizes = []; - const shifts = []; - for (let i = 0; i < count1 + count2; i++) { - let theta = Math.random() * Math.PI * 2; - // let phi = Math.random() * Math.PI; - let phi = Math.acos(Math.random() * 2 - 1); - let angle = (Math.random() * 0.9 + 0.1) * Math.PI * 0.1; - let strength = Math.random() * 0.9 + 0.1; // 0.1-1.0 - shifts.push(theta, phi, angle, strength); - - let size = Math.random() * 1.5 + 0.5; // 0.5-2.0 - sizes.push(size); - - if (i < count1) { - // 中心球体粒子 - // let r = 10; - let r = Math.random() * 0.5 + 9.5; - // let x = r * Math.sin(phi) * Math.cos(theta); - // let y = r * Math.sin(phi) * Math.sin(theta); - // let z = r * Math.cos(phi); - let { x, y, z } = new THREE.Vector3() - .randomDirection() - .multiplyScalar(r); - positions.push(x, y, z); - } else { - // 外围圆盘粒子 - let r = 10; - let R = 40; - let rand = Math.pow(Math.random(), 1.5); - let radius = Math.sqrt(R * R * rand + (1 - rand) * r * r); // 通过 rand=0-1 数值去线性插值 R^2 和 r^2 大概是按圆圈面积采样粒子分布更均匀 - let { x, y, z } = new THREE.Vector3().setFromCylindricalCoords( - radius, // 半径 - Math.random() * 2 * Math.PI, // 角度 - (Math.random() - 0.5) * 2 // 高度y -1-1 - ); - positions.push(x, y, z); - } - } - - geometry.setAttribute( - "position", - new THREE.Float32BufferAttribute(positions, 3) - ); - geometry.setAttribute("aSize", new THREE.Float32BufferAttribute(sizes, 1)); - geometry.setAttribute( - "aShift", - new THREE.Float32BufferAttribute(shifts, 4) - ); - - const vertexShader = /* GLSL */ ` - attribute float aSize; - attribute vec4 aShift; - - uniform float uTime; - - varying vec3 vColor; - - const float PI = 3.141592653589793238; - - void main() { - // float d = abs(position.y) / 10.0; - float d = length(abs(position) / vec3(40., 10., 40.)); // 中间黄色、外面紫色 - d = clamp(d, 0., 1.); - - // rgb(227, 155, 0) - // rgb(100, 50, 255) - vec3 color1 = vec3(227., 155., 0.); - vec3 color2 = vec3(100., 50., 255.); - - vColor = mix(color1, color2, d) / 255.; - - vec3 transformed = position; - - float theta = mod(aShift.x + aShift.z * uTime, PI * 2.); - float phi = mod(aShift.y + aShift.z * uTime, PI * 2.); - transformed += vec3(sin(phi) * cos(theta), cos(phi), sin(phi) * sin(theta)) * aShift.w; - - vec4 mvPosition = modelViewMatrix * vec4(transformed, 1.0); - gl_PointSize = aSize * 50.0 / -mvPosition.z; - gl_Position = projectionMatrix * mvPosition; - } -`; - - const fragmentShader = /* GLSL */ ` - varying vec3 vColor; - - void main() { - float d = length(gl_PointCoord.xy - 0.5); - if (d > 0.5) discard; - // gl_FragColor = vec4(vColor, step(0.5, 1.0 - d)); - gl_FragColor = vec4(vColor, smoothstep(0.5, 0.1, d)); - } -`; - - const material = new THREE.ShaderMaterial({ - vertexShader, - fragmentShader, - uniforms: { - uTime: { value: 0 }, - }, - transparent: true, - blending: THREE.AdditiveBlending, - depthTest: false, - }); - - // const mesh = new THREE.Mesh(geometry, material); - const mesh = new THREE.Points(geometry, material); - mesh.rotation.order = "ZYX"; - mesh.rotation.z = 0.2; - scene.add(mesh); - - // let time = 0; - let clock = new THREE.Clock(); - function render() { - // time += 0.05; - let time = clock.getElapsedTime(); - mesh.rotation.y = time * 0.01; - material.uniforms.uTime.value = time; - renderer.render(scene, camera); - controls.update(); - - requestAnimationFrame(render); - } - - render(); - - function resize() { - w = window.innerWidth; - h = window.innerHeight; - renderer.setSize(w, h); - camera.aspect = w / h; - camera.updateProjectionMatrix(); - } - - window.addEventListener("resize", resize); - }, []); - return
; -} -export { Galaxy }; diff --git a/components/demo_components/tableofcontents.tsx b/components/demo_components/tableofcontents.tsx deleted file mode 100644 index 6e7b4503..00000000 --- a/components/demo_components/tableofcontents.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import type { NextraThemeLayoutProps } from 'nextra' - -export default function TableOfContents({ pageOpts }: NextraThemeLayoutProps) { - const { title } = pageOpts - console.log("Title:", title); - console.log("pageOpts:", pageOpts); - - return ( -
-

{title}

-
- ) -} - diff --git a/components/hero.js b/components/hero.js deleted file mode 100644 index 767fd574..00000000 --- a/components/hero.js +++ /dev/null @@ -1,57 +0,0 @@ -import React from "react"; -import Image from "next/image"; -import BGImg from "./../assets/dark/1.jpg"; - -function Hero() { - return ( -
- adastack background texture -
-
-
-

Cardano Library

-

- 130+ pages of tools and resources -

-
-
    -
  • - We are an{" "} - - open source - {" "} - ecosystem explorer. -
  • -
  • The website is still in development.
  • -
  • Please vote for us in Catalyst Fund 13! 🙏
  • -
- -
-
- ); -} -export { Hero }; diff --git a/components/tables/OpenSourceBuildersTable.jsx b/components/tables/OpenSourceBuildersTable.jsx index 2a3f192c..42398a41 100644 --- a/components/tables/OpenSourceBuildersTable.jsx +++ b/components/tables/OpenSourceBuildersTable.jsx @@ -1,13 +1,13 @@ import React from "react"; import { Table, Typography, Tooltip, Button, Card } from "antd"; -import { StarIcon } from "../../assets/icons"; -import TeamGithubBadge from "@components/badges/TeamGithubBadge"; -import CodeLanguageShieldIoBadge from "@components/badges/shield_io_badges/CodeLanguageShieldIoBadge"; +import { CopyIcon, CopySuccessIcon } from "../../assets/icons"; +import LanguageShieldIo from "@components/badges/shield_io_badges/LanguageShieldIo"; import Favicon from "@components/badges/Favicon"; import LatestCommitBadge from "@components/badges/LatestCommitBadge"; +import { StarIcon } from "../../assets/icons"; import MostStarredRepoBadge from "@components/badges/MostStarredRepoBadge"; +import TeamGithubBadge from "@components/badges/TeamGithubBadge"; import CategoryTag from "@components/badges/CategoryTag"; -import { CopyIcon, CopySuccessIcon } from "../../assets/icons"; const { Paragraph, Title, Text } = Typography; @@ -51,9 +51,13 @@ const RepoInfoTooltip = ({ repo, children }) => { fontSize: "12px", }} > - Stack:  + Stack: +   - +
)} @@ -61,19 +65,21 @@ const RepoInfoTooltip = ({ repo, children }) => { style={{ fontSize: "12px", display: "block", + marginTop: "4px", }} > - Stars:  + Stars:  {repo?.stars ?? 0} - Last Commit:  + Last Commit: +   {repo?.timeSinceLastCommit || ""} ago @@ -145,12 +151,66 @@ const OpenSourceBuildersTable = ({ data }) => { ), }, + { + title: "Latest Commit", + dataIndex: ["mostRecentRepo", "url"], + key: "url", + width: 276, + sorter: { + compare: (a, b) => { + const dateA = a.mostRecentRepo?.pushedAt + ? new Date(a.mostRecentRepo.pushedAt).getTime() + : 0; + const dateB = b.mostRecentRepo?.pushedAt + ? new Date(b.mostRecentRepo.pushedAt).getTime() + : 0; + return dateB - dateA; + }, + multiple: 3, + }, + render: (url, record) => ( + <> + + + + + +   + + {record.mostRecentRepo?.timeSinceLastCommit || "..."} + + + ), + }, + + { + title: "Most Starred Repo", + dataIndex: ["mostStarredRepo", "pushedAt"], + key: "pushedAt", + width: 280, + sorter: { + compare: (a, b) => + (b.mostStarredRepo?.stars || 0) - (a.mostStarredRepo?.stars || 0), + multiple: 2, + }, + render: (pushedAt, record) => ( +
+ + + + + +
+ ), + }, { title: "Total Stars", dataIndex: "starCount", key: "starCount", width: 100, - defaultSortOrder: "descend", sorter: { compare: (a, b) => (a.starCount ?? 0) - (b.starCount ?? 0), multiple: 2, @@ -181,60 +241,6 @@ const OpenSourceBuildersTable = ({ data }) => { ); }, }, - { - title: "Most Starred Repo", - dataIndex: ["mostStarredRepo", "pushedAt"], - key: "pushedAt", - width: 280, - sorter: { - compare: (a, b) => - (b.mostStarredRepo?.stars || 0) - (a.mostStarredRepo?.stars || 0), - multiple: 2, - }, - render: (pushedAt, record) => ( -
- - - - - -
- ), - }, - { - title: "Latest Commit", - dataIndex: ["mostRecentRepo", "url"], - key: "url", - width: 276, - sorter: { - compare: (a, b) => { - const dateA = a.mostRecentRepo?.pushedAt - ? new Date(a.mostRecentRepo.pushedAt).getTime() - : 0; - const dateB = b.mostRecentRepo?.pushedAt - ? new Date(b.mostRecentRepo.pushedAt).getTime() - : 0; - return dateB - dateA; - }, - multiple: 3, - }, - render: (url, record) => ( - <> - - - - - -   - - {record.mostRecentRepo?.timeSinceLastCommit || "..."} - - - ), - }, { title: "Team GitHub", dataIndex: "teamGithubURL", @@ -382,6 +388,9 @@ const OpenSourceBuildersTable = ({ data }) => { scroll={{ x: 500, }} + rowClassName={(record, index) => + index % 2 === 0 ? "table-row-odd" : "table-row-even" + } /> ); diff --git a/css/styles.css b/css/styles.css index 041c1a8f..81893a5d 100644 --- a/css/styles.css +++ b/css/styles.css @@ -2,6 +2,11 @@ @import "tailwindcss/components"; @import "tailwindcss/utilities"; +/* Set full width even on large screens */ +.nextra-nav-container + .nx-mx-auto.nx-flex { + max-width: 100%; +} + /* Theme */ html[style*="color-scheme: dark;"] body { background-color: #0e121e !important; @@ -27,22 +32,23 @@ input::placeholder, } /* Links */ -a { +a, +li a { text-decoration: none !important; color: #007bff; - transition: color 0.3s ease; } -li a { - color: #007bff; +a:hover, +li a:hover { + color: #0056b3; } html[style*="color-scheme: dark;"] a { color: #b5a4ff; } -a:hover { - color: #0056b3; +html[style*="color-scheme: dark;"] a:not(.nextra-sidebar-container a):hover { + color: #a08bfe; } /* Top Navbar */ @@ -125,7 +131,7 @@ html[style*="color-scheme: light;"] } /* Styles for the surroundings of the sidebar */ -.nextra-scrollbar { +.nextra-sidebar-container .nextra-scrollbar { padding-top: 0.3rem !important; padding-right: 0rem !important; padding-bottom: 1rem !important; @@ -154,6 +160,10 @@ ul.nx-flex.nx-flex-col.nx-gap-1 > li:first-child > a .sidebar-menu-item { padding-top: 2px; } +li:first-of-type a:has(.sidebar-menu-item) { + margin-top: 2px; +} + /* Fix issue causing visual stutter on dropdown */ .nx-transition-opacity.nx-duration-500.nx-ease-in-out.motion-reduce\:nx-transition-none.nx-opacity-0.ltr\:nx-pr-0.rtl\:nx-pl-0.nx-pt-1, .nx-transition-opacity.nx-duration-500.nx-ease-in-out.motion-reduce\:nx-transition-none.nx-opacity-100.ltr\:nx-pr-0.rtl\:nx-pl-0.nx-pt-1 { @@ -550,8 +560,9 @@ footer { transform: translate(-50%, -50%); } -img.shields_io_button { - display: inline; +.code-library-info-bar { + margin-top: 30px; + margin-bottom: 44px; } .shields_io_inline-badge { @@ -559,50 +570,19 @@ img.shields_io_button { margin-bottom: -5px; } -.shields_io_language_badge, -.shields_io_repo_badge { - padding-bottom: 5px; - margin-top: 5px; -} - -.favicon-custom-css { - border-color: #4b5563; - margin-top: 2px; +table .favicon-custom-css { + margin-top: 1px; + margin-right: 2.5px; + margin-left: 4px; } :is(html[class~="dark"]) .badge-button { background-color: transparent !important; } -.github-badge { - display: inline-flex; - align-items: center; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica", - "Arial", sans-serif; - font-size: 13px; - font-weight: 600; - line-height: 14px; - border-radius: 3px; - background-color: #eee; - color: #333; - text-decoration: none; -} - -.github-badge .label { - padding: 2px 5px; - background-color: #555; - color: #fff; - border-top-left-radius: 3px; - border-bottom-left-radius: 3px; -} - -.github-badge .stars { - padding: 2px 5px; -} - -.github-badge:hover { - text-decoration: none; - opacity: 0.8; +.open-source-icon-inline { + padding-top: 2.7px; + margin-left: 4.5px; } .page-in-development { @@ -651,6 +631,17 @@ a[class*="nx-cursor-pointer"]:hover .page-in-development::after { width: 100px; } +.badge-io-custom-shading { + height: 22px; + border: 1px solid #d2d2d2; + border-radius: 3px; + background-color: #f0f0f0; +} + +.code-library-info-bar .shields_io_repo_badge { + height: 22px; +} + /* Ant Design Modifications */ html body .ant-table-cell div a { width: auto !important; @@ -662,6 +653,41 @@ html body .ant-table-cell div a { margin-right: 2px !important; } +/* Light theme badge */ +.shields_io_language_badge.light { + display: inline; +} +html[style*="color-scheme: dark"] .shields_io_language_badge.light { + display: none; +} + +/* Dark theme badge */ +.shields_io_language_badge.dark { + display: none; +} +html[style*="color-scheme: dark"] .shields_io_language_badge.dark { + display: inline; +} + +td.ant-table-cell.ant-table-cell-fix-left.ant-table-cell-fix-left-last { + background-color: inherit; +} + +html[style*="color-scheme: light;"] .table-row-odd { + background-color: #fcfcfc; +} +html[style*="color-scheme: light;"] .table-row-even { + background-color: #f6f6f6; +} + +html[style*="color-scheme: dark;"] .table-row-odd { + background-color: #0d101c; +} + +html[style*="color-scheme: dark;"] .table-row-even { + background-color: #080a15; +} + .last-commit-badge-container .last-commit-badge-content { padding-left: 3px !important; padding-right: 10px; @@ -682,19 +708,12 @@ html[style*="color-scheme: dark;"] .team_table_name:hover { html[style*="color-scheme: light;"] .team_table_name { color: #4b5563; } - html[style*="color-scheme: light;"] .team_table_name:hover { color: black; } - -.team_table_name_container:hover { - /* text-decoration: underline; */ -} - .ant-table-cell div a { width: 100%; } - html[style*="color-scheme: dark;"] .ant-typography-copy svg { margin-bottom: -6px; opacity: 25%; @@ -727,6 +746,15 @@ td.ant-table-cell { padding: 4px 6px !important; } +thead th.ant-table-cell { + padding: 4px 16px !important; +} + +.stars-across-all-repos-badge-content { + outline-offset: 0 !important; + outline: none !important; +} + /* Media Queries */ /* XS Size */ @media (max-width: 544px) { diff --git a/next.config.js b/next.config.js index 0979d496..95b0018d 100644 --- a/next.config.js +++ b/next.config.js @@ -10,6 +10,9 @@ module.exports = withNextra({ eslint: { ignoreDuringBuilds: false, }, + images: { + domains: ["www.google.com"], + }, async redirects() { return [ { @@ -22,6 +25,11 @@ module.exports = withNextra({ destination: "/development/dev_teams", // new URL permanent: true, // permanent 308 }, + { + source: "/sidechains/what_are_sidechains", // old URL + destination: "/partner_chains/what_are_partner_chains", // new URL + permanent: true, // permanent 308 + }, ]; }, diff --git a/pages/_app.js b/pages/_app.js index a3079b10..0d278ed0 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -5,7 +5,11 @@ import { ConfigProvider, theme } from "antd"; import localFont from "next/font/local"; const campton = localFont({ - src: [{ path: "../assets/fonts/3_campton_normal.otf", weight: "400" }], // Loading only the regular font for optimization + src: [ + { path: "../assets/fonts/3_campton_normal.otf", weight: "400" }, + { path: "../assets/fonts/4_campton_medium.otf", weight: "500" }, + { path: "../assets/fonts/5_campton_semi_bold.otf", weight: "600" }, + ], variable: "--font-campton", fallback: [ "Segoe UI", @@ -63,6 +67,7 @@ const ThemeWrapper = ({ children }) => { components: { Table: { colorBgContainer: isDark ? "#0e121e" : "#f7f7f7", + headerBorderRadius: 4, }, }, }; @@ -83,7 +88,11 @@ const LoadingWrapper = ({ children }) => { setIsClient(true); }, []); - return isClient ? children :
{children}
; + return isClient ? ( + children + ) : ( +
{children}
+ ); }; export default function MyApp({ Component, pageProps }) { diff --git a/pages/_meta.json b/pages/_meta.json index ae836824..5c3f5c70 100644 --- a/pages/_meta.json +++ b/pages/_meta.json @@ -63,7 +63,7 @@ } }, "dapps": { - "title": "dApps", + "title": "Dapps", "theme": { "breadcrumb": true, "sidebar": true, @@ -142,8 +142,8 @@ "pagination": false } }, - "sidechains": { - "title": "Sidechains", + "partner_chains": { + "title": "Partner Chains", "theme": { "breadcrumb": true, "sidebar": true, diff --git a/pages/all_pages.mdx b/pages/all_pages.mdx index 34be01e2..c8e9ed71 100644 --- a/pages/all_pages.mdx +++ b/pages/all_pages.mdx @@ -8,83 +8,106 @@ toc: false Explore guides, projects, and tools in the Cardano ecosystem. 🌎🌍🌏 -#### Intro to Cardano +### Intro to Cardano -- [What is Blockchain?](https://www.adastack.io/intro_to_cardano/what_is_blockchain) -- [Why Cardano?](https://www.adastack.io/intro_to_cardano/why_cardano) -- [Learn More](https://www.adastack.io/intro_to_cardano/learn_more) -- [Start Using Cardano](https://www.adastack.io/intro_to_cardano/start_using_cardano) -- [Cardano Vocab](https://www.adastack.io/intro_to_cardano/cardano_vocab) +  •  [What is Blockchain?](https://www.adastack.io/intro_to_cardano/what_is_blockchain) -#### Staking +  •  [Why Cardano?](https://www.adastack.io/intro_to_cardano/why_cardano) -- [What is Staking?](https://www.adastack.io/staking/what_is_staking) -- [Start Staking](https://www.adastack.io/staking/start_staking) -- [Stake Pool Explorers](https://www.adastack.io/staking/stake_pool_explorers) -- [Reward Calculators](https://www.adastack.io/staking/reward_calculators) -- [Reward Calendars](https://www.adastack.io/staking/reward_calendars) -- [Reward Trackers](https://www.adastack.io/staking/reward_trackers) -- [ISPOs](https://www.adastack.io/staking/ispos) -- [Stake Pool Alliances](https://www.adastack.io/staking/stake_pool_alliances) +  •  [Learn More](https://www.adastack.io/intro_to_cardano/learn_more) -#### Community +  •  [Start Using Cardano](https://www.adastack.io/intro_to_cardano/start_using_cardano) -- [Newsletters](https://www.adastack.io/community/newsletters) -- [News and Blogs](https://www.adastack.io/community/news_and_blogs) -- [YouTube](https://www.adastack.io/community/youtube) +  •  [Cardano Vocab](https://www.adastack.io/intro_to_cardano/cardano_vocab) -#### Ecosystem +### Staking -- [Ecosystem Maps](https://www.adastack.io/ecosystem/ecosystem_maps) -- [Blockchain Explorers](https://www.adastack.io/ecosystem/blockchain_explorers) +  •  [What is Staking?](https://www.adastack.io/staking/what_is_staking) -#### dApps +  •  [Start Staking](https://www.adastack.io/staking/start_staking) -- [What is a dApp?](https://www.adastack.io/dapps/what_is_a_dapp) -- [dApp Explorers](https://www.adastack.io/dapps/dapp_explorers) +  •  [Stake Pool Explorers](https://www.adastack.io/staking/stake_pool_explorers) -#### NFTs +  •  [Reward Calculators](https://www.adastack.io/staking/reward_calculators) -- [What are NFTs?](https://www.adastack.io/nfts/what_are_nfts) +  •  [Reward Calendars](https://www.adastack.io/staking/reward_calendars) -#### Gaming +  •  [Reward Trackers](https://www.adastack.io/staking/reward_trackers) -- [What is Web3 Gaming?](https://www.adastack.io/gaming/what_is_web3_gaming) +  •  [Initial Stake Pool Offerings (ISPOs)](https://www.adastack.io/staking/ispos) -#### DAOs +  •  [Stake Pool Alliances](https://www.adastack.io/staking/stake_pool_alliances) -- [What is a DAO?](https://www.adastack.io/daos/what_is_a_dao) +  •  [Pool Monitoring Tools](https://www.adastack.io/staking/pool_monitoring_tools) -#### Catalyst +### Community -- [What is Project Catalyst?](https://www.adastack.io/catalyst/what_is_project_catalyst) +  •  [Newsletters](https://www.adastack.io/community/newsletters) -#### Governance +  •  [News and Blogs](https://www.adastack.io/community/news_and_blogs) -- [What is Governance?](https://www.adastack.io/governance/what_is_governance) +  •  [YouTube](https://www.adastack.io/community/youtube) -#### Development +### Ecosystem -- [Intro to Cardano Development](https://www.adastack.io/development/intro_to_cardano_development) -- [Software Development Firms](https://www.adastack.io/development/dev_teams) -- [Learning Platforms](https://www.adastack.io/development/learning_platforms) -- [Developer Chat](https://www.adastack.io/development/developer_chat) -- [Code Libraries](https://www.adastack.io/development/code_libraries) +  •  [Ecosystem Maps](https://www.adastack.io/ecosystem/ecosystem_maps) -#### On-Chain Metrics +  •  [Blockchain Explorers](https://www.adastack.io/ecosystem/blockchain_explorers) -- [On-Chain Dashboards](https://www.adastack.io/on_chain_metrics/on_chain_dashboards) -- [Network Activity](https://www.adastack.io/on_chain_metrics/network_activity) -- [Decentralization Metrics](https://www.adastack.io/on_chain_metrics/decentralization_metrics) +### dApps -#### Sidechains +  •  [What is a dApp?](https://www.adastack.io/dapps/what_is_a_dapp) -- [What are Sidechains?](https://www.adastack.io/sidechains/what_are_sidechains) +  •  [dApp Explorers](https://www.adastack.io/dapps/dapp_explorers) -#### Layer 2s +### NFTs -- [What are Layer 2s?](https://www.adastack.io/layer_2s/what_are_layer_2s) +  •  [What are NFTs?](https://www.adastack.io/nfts/what_are_nfts) -#### Other Pages +### Gaming -- [About](https://www.adastack.io/about) +  •  [What is Web3 Gaming?](https://www.adastack.io/gaming/what_is_web3_gaming) + +### DAOs + +  •  [What is a DAO?](https://www.adastack.io/daos/what_is_a_dao) + +### Catalyst + +  •  [What is Project Catalyst?](https://www.adastack.io/catalyst/what_is_project_catalyst) + +### Governance + +  •  [What is Governance?](https://www.adastack.io/governance/what_is_governance) + +### Development + +  •  [Intro to Cardano Development](https://www.adastack.io/development/intro_to_cardano_development) + +  •  [Development Companies](https://www.adastack.io/development/dev_teams) + +  •  [Learning Platforms](https://www.adastack.io/development/learning_platforms) + +  •  [Developer Chat](https://www.adastack.io/development/developer_chat) + +  •  [Code Libraries](https://www.adastack.io/development/code_libraries) + +### On-Chain Metrics + +  •  [On-Chain Dashboards](https://www.adastack.io/on_chain_metrics/on_chain_dashboards) + +  •  [Network Activity](https://www.adastack.io/on_chain_metrics/network_activity) + +  •  [Decentralization Metrics](https://www.adastack.io/on_chain_metrics/decentralization_metrics) + +### Partner Chains + +  •  [What are Partner Chains?](https://www.adastack.io/partner_chains/what_are_partner_chains) + +### Layer 2s + +  •  [What are Layer 2s?](https://www.adastack.io/layer_2s/what_are_layer_2s) + +### Other Pages + +  •  [About](https://www.adastack.io/about) diff --git a/pages/api/open_source_builders.ts b/pages/api/open_source_builders.ts index c70f1335..562c0b1e 100644 --- a/pages/api/open_source_builders.ts +++ b/pages/api/open_source_builders.ts @@ -88,7 +88,7 @@ export const openSourceBuildersData = [ { name: "Harmonic Labs", website: "https://www.harmoniclabs.tech/", - teamGithubURL: "https://github.com/HarmonicLabs", + teamGithubURL: "https://github.com/harmoniclabs", tags: ["Dev Company"], }, { @@ -140,7 +140,7 @@ export const openSourceBuildersData = [ tags: ["Organization"], }, { - name: "Space Budz", + name: "SpaceBudz", website: "https://spacebudz.io/", teamGithubURL: "https://github.com/spacebudz", tags: ["dApp"], @@ -1171,12 +1171,6 @@ export const openSourceBuildersData = [ teamGithubURL: "https://github.com/roots-id", tags: ["Tools"], }, - { - name: "Quality Assurance DAO", - website: "https://quality-assurance-dao.github.io/", - teamGithubURL: "https://github.com/Quality-Assurance-DAO", - tags: ["Tools"], - }, { name: "MigaMake", website: "https://migamake.com/", @@ -1201,6 +1195,84 @@ export const openSourceBuildersData = [ teamGithubURL: "https://github.com/cardano-mercury", tags: ["dApp"], }, + { + name: "Paideia", + website: "https://www.paideia.im/", + teamGithubURL: "https://github.com/paideiadao/", + tags: ["Tools"], + }, + { + name: "Drunken Dragon Games", + website: "https://ddu.gg/", + teamGithubURL: "https://github.com/Drunken-Dragon-Games", + tags: ["dApp"], + }, + { + name: "WIMs", + website: "https://cardano.wims.io/", + teamGithubURL: "https://github.com/wimsio", + tags: ["Organization"], + }, + { + name: "Lantr", + website: "https://lantr.io/", + teamGithubURL: "https://github.com/lantr-io", + tags: ["Dev Company"], + }, + { + name: "Filabs", + website: "https://www.filabs.dev/", + teamGithubURL: "https://github.com/filabs-dev", + tags: ["Dev Company"], + }, + { + name: "Andamio", + website: "https://www.andamio.io/", + teamGithubURL: "https://github.com/Andamio-Platform", + tags: ["dApp"], + }, + { + name: "PyCardano", + website: "https://pycardano.readthedocs.io/en/latest/", + teamGithubURL: "https://github.com/Python-Cardano", + tags: ["Tools"], + }, + { + name: "Plutonomicon", + website: "https://github.com/Plutonomicon/plutonomicon/blob/main/README.md", + teamGithubURL: "https://github.com/Plutonomicon", + tags: ["Tools"], + }, + { + name: "Helios", + website: "https://helios-lang.io/", + teamGithubURL: "https://github.com/Plutonomicon", + tags: ["Tools"], + }, + { + name: "Scalus", + website: "https://scalus.org/", + teamGithubURL: "https://github.com/nau", + tags: ["Tools"], + }, + { + name: "Orcfax", + website: "https://orcfax.io/", + teamGithubURL: "https://github.com/orcfax", + tags: ["Tools"], + }, + { + name: "Charli3", + website: "https://charli3.io/", + teamGithubURL: "https://github.com/Charli3-Official", + tags: ["Tools"], + }, + { + name: "Marlowe", + website: "https://marlowe.iohk.io/", + teamGithubURL: "https://github.com/marlowe-lang", + tags: ["Tools"], + }, ]; export default function handler(req: NextApiRequest, res: NextApiResponse) { diff --git a/pages/catalyst/what_is_project_catalyst.mdx b/pages/catalyst/what_is_project_catalyst.mdx index 2b3b7498..bb23bca6 100644 --- a/pages/catalyst/what_is_project_catalyst.mdx +++ b/pages/catalyst/what_is_project_catalyst.mdx @@ -6,6 +6,6 @@ toc: false # What is Project Catalyst? -[Project Catalyst](https://docs.projectcatalyst.io/) is a collective innovation fund for Cardano. The fund holds regular rounds in which projects can apply for funding to build something beneficial on Cardano. Once the proposals submitted, ADA-holders vote on which ones to fund. Catalyst is sustainably funded using the [Cardano treasury](https://cexplorer.io/pot). +[Project Catalyst](https://docs.projectcatalyst.io/) is a collective innovation fund for Cardano. The fund holds regular rounds in which projects can apply for funding to build something beneficial on Cardano. Once the proposals submitted, ADA-holders vote on which ones to fund. Catalyst is sustainably funded using the [Cardano treasury](https://cexplorer.io/pot). Catalyst is very community-driven. Community members give feedback on proposals, vote on proposals, and provide accountability for funded projects by reviewing their milestones. Users that engage in Catalyst are incentivized by ADA rewards from the Cardano treasury. diff --git a/pages/community/_meta.json b/pages/community/_meta.json index a2917906..03e7bd97 100644 --- a/pages/community/_meta.json +++ b/pages/community/_meta.json @@ -10,7 +10,7 @@ } }, "news_and_blogs": { - "title": "News and Blogs", + "title": "News & Blogs", "theme": { "breadcrumb": true, "sidebar": true, @@ -30,7 +30,7 @@ } }, "reddit_and_forums": { - "title": "Reddit and Forums ", + "title": "Reddit & Forums ", "theme": { "breadcrumb": true, "sidebar": true, diff --git a/pages/community/news_and_blogs.mdx b/pages/community/news_and_blogs.mdx index d3c90345..4d66f1b0 100644 --- a/pages/community/news_and_blogs.mdx +++ b/pages/community/news_and_blogs.mdx @@ -6,17 +6,34 @@ toc: true # Cardano News Sites +Get the latest updates from across Cardano. + +## Cardano News + News sites covering Cardano and its ecosystem. - [Adapulse](https://adapulse.io/): Independent digital media that covers projects and news - [Essential Cardano](https://www.essentialcardano.io/content): Articles, videos, resources, and updates -- [Cexplorer Articles](https://cexplorer.io/article) -- [Cardano Spot](https://cardanospot.io/news-feed) +- [Cexplorer Articles](https://cexplorer.io/article) +- [Cardano Spot](https://cardanospot.io/news-feed) +- [GM Cardano](https://gmcardano.com/) - [Ada Plug](https://adaplug.com/blog/): News aggregator - [Cardano Feed](https://cardanofeed.com/): News aggregator - [r/Cardano Reddit](https://www.reddit.com/r/cardano/?f=flair_name%3A%22News%22): Cardano news tag on Reddit -### Cardano Blogs +## Organization Updates + +News and information from organizations in Cardano. + +- [Intersect News](https://www.intersectmbo.org/news) +- [IOHK Blog](https://iohk.io/en/blog/posts/page-1/) +- [Cardano Foundation News](https://cardanofoundation.org/en/news/) +- [Emurgo News](https://www.emurgo.io/press-news/) +- [Cardano.org News](https://cardano.org/news/) +- [Project Catalyst Blog](https://projectcatalyst.io/blog) +- [University of Edinburgh](https://blogs.ed.ac.uk/blockchain/tag/cardano/) + +## Cardano Community Blogs Blogs from the Cardano community. @@ -40,7 +57,7 @@ Blogs from the Cardano community. - [Charles Hoskinson Blog](https://hoskinsoncharles.blogspot.com/?m=1) - [Community Led Growth](https://communityledgrowth.substack.com/): Blog by IOG community director Ben Ohanlon -### Developer Blogs +## Cardano Developer Blogs Blogs from Cardano developers. @@ -53,50 +70,9 @@ Blogs from Cardano developers. - [Pi Lanningham](https://www.314pool.com/) - [Sarmaad](https://sarmaad.com/blog) -### Organizations and Institutions +## Projects Building on Cardano -News and information from organizations in Cardano. - -- [Intersect News](https://www.intersectmbo.org/news) -- [IOHK Blog](https://iohk.io/en/blog/posts/page-1/) -- [Cardano Foundation News](https://cardanofoundation.org/en/news/) -- [Emurgo News](https://www.emurgo.io/press-news/) -- [Cardano.org News](https://cardano.org/news/) -- [Project Catalyst Blog](https://projectcatalyst.io/blog) -- [University of Edinburgh](https://blogs.ed.ac.uk/blockchain/tag/cardano/) - -### International by Language - -Cardano blogs in different languages. - -**Mandarin:** - -- [Purchains](https://news.purchains.com/) - -**Spanish:** - -- [Carnada Revista](https://issuu.com/carnadarevista) - -**French:** - -- [Cardanologie](https://cardanologie.fr/) - -**Greek:** - -- [Odyc](https://odyc.gr/) - -**Vietnamese:** - -- [ADA Bamboo](https://ada-bamboo.com/) -- [Cardano Library](https://cardanolibrary.net/category/news/cardano-news/) - -**Dutch** - -- [Cardano Nederland](https://cardanonederland.nl/) - -### Projects on Cardano - -Blogs from projects building on Cardano. +Get updates from projects building on Cardano. - [SingularityNET](https://blog.singularitynet.io/) - [World Mobile](https://worldmobile.io/blog/) @@ -149,11 +125,31 @@ Blogs from projects building on Cardano. - [Metera](https://meteraprotocol.medium.com/) - [Bodega Market](https://medium.com/@bodegacardano) -### Inactive Blogs +## International News and Blogs + +Cardano news and blogs in various languages. + +### Mandarin + +- [Purchains](https://news.purchains.com/) + +### Spanish + +- [Carnada Revista](https://issuu.com/carnadarevista) + +### French + +- [Cardanologie](https://cardanologie.fr/) + +### Greek + +- [Odyc](https://odyc.gr/) + +### Vietnamese + +- [ADA Bamboo](https://ada-bamboo.com/) +- [Cardano Library](https://cardanolibrary.net/category/news/cardano-news/) -Cardano blogs that are no longer writing. +### Dutch -- [Prime Stakepool](https://www.primestakepool.com/blog-1) -- [Adamant](https://medium.com/@adamantsecurity) -- [Vital Staking](https://vital-responsible-staking.medium.com/) -- [Cardano Tec](https://cardanotec.com/category/cardano/) +- [Cardano Nederland](https://cardanonederland.nl/) diff --git a/pages/community/newsletters.mdx b/pages/community/newsletters.mdx index 9110cc92..d0622b4f 100644 --- a/pages/community/newsletters.mdx +++ b/pages/community/newsletters.mdx @@ -8,21 +8,20 @@ toc: false Newsletters to get the latest Cardano updates by email. -- [ThinkGrowCrypto Media](https://tgcmedia.beehiiv.com/): Weekly community newsletter covering updates in blockchain and Cardano. - -- [Cardano Newsletter](https://cardanonewsletter.com/): Weekly newsletter of top stories on Cardano. +- [Intersect Newsletter](https://www.intersectmbo.org/news): Weekly governance updates from [Intersect](https://www.intersectmbo.org/), the organization coordinating Cardano's future development. -- [Cardano Spotlight](https://cardanospot.io/landing): Weekly rundown newsletter of big topics of the week. +- [Cardano Newsletter](https://www.cardanonewsletter.com/): Weekly newsletter of top stories on Cardano. +- [Cardano Community Digest](https://cardano.org/newsletter/): Every two weeks, receive news and updates from the Cardano Foundation Community Team. -- [Interviewing Cardano Newsletter](https://medium.com/@patryk_karter): Interviews with DeFi projects, NFT projects, and stake pool operators (SPOs). +- [Catalyst Newsletter](https://projectcatalyst.io/news): Weekly updates about the decentralized innovation fund [Project Catalyst](https://projectcatalyst.io/). Newsletter sign up is in footer. -- [Li₿εʁLiøη newsletter](https://liberlion.medium.com/): Newsletter on cryptocurrency theory, strategy, and privacy that often talks about Cardano. +- [Cardano Spotlight](https://cardanospot.io/landing): Weekly rundown newsletter of big topics of the week. -- [Intersect Newsletter](https://www.intersectmbo.org/news): Weekly governance updates from [Intersect](https://www.intersectmbo.org/), the organization coordinating Cardano's future development. +- [Interviewing Cardano Newsletter](https://medium.com/@patryk_karter): Interviews with DeFi projects, NFT projects, and stake pool operators (SPOs). -- [Catalyst Newsletter](https://projectcatalyst.io/news): Weekly updates about the decentralized innovation fund [Project Catalyst](https://projectcatalyst.io/). Newsletter sign up is in footer. +- [ThinkGrowCrypto Media](https://tgcmedia.beehiiv.com/): Weekly community newsletter covering updates in blockchain and Cardano. -- [Cardano Community Digest](https://cardano.org/newsletter/): Every two weeks, receive news and updates from the Cardano Foundation Community Team. +- [Li₿εʁLiøη newsletter](https://liberlion.medium.com/): Newsletter on cryptocurrency theory, strategy, and privacy that often talks about Cardano. - [Frontier Letter](https://frontierletter.substack.com/): Futuristic newsletter that sometimes covers Cardano. diff --git a/pages/daos/_meta.json b/pages/daos/_meta.json index 6a9773e8..e47d06ff 100644 --- a/pages/daos/_meta.json +++ b/pages/daos/_meta.json @@ -28,15 +28,5 @@ "footer": true, "pagination": false } - }, - "multisig": { - "title": "Multisig ", - "theme": { - "breadcrumb": true, - "sidebar": true, - "toc": true, - "footer": true, - "pagination": false - } } } diff --git a/pages/dapps/_meta.json b/pages/dapps/_meta.json index eec93b40..aad665a0 100644 --- a/pages/dapps/_meta.json +++ b/pages/dapps/_meta.json @@ -9,8 +9,8 @@ "pagination": false } }, - "dapp_explorers": { - "title": "dApp Explorers", + "ai": { + "title": "AI ", "theme": { "breadcrumb": true, "sidebar": true, @@ -19,8 +19,8 @@ "pagination": false } }, - "dapp_analysis_tools": { - "title": "dApp Analysis Tools ", + "dapp_analysis_and_risk_rating": { + "title": "Dapp Analysis & Risk Ratings ", "theme": { "breadcrumb": true, "sidebar": true, @@ -29,8 +29,8 @@ "pagination": false } }, - "dexs": { - "title": "DEXs ", + "dapp_explorers": { + "title": "Dapp Explorers", "theme": { "breadcrumb": true, "sidebar": true, @@ -39,8 +39,8 @@ "pagination": false } }, - "defi_dapps": { - "title": "DeFi ", + "data_storage_and_computing": { + "title": "Data Storage & Computing ", "theme": { "breadcrumb": true, "sidebar": true, @@ -49,8 +49,8 @@ "pagination": false } }, - "payments_and_ecommerce_dapps": { - "title": "Payments and E-Commerce ", + "defi": { + "title": "DeFi ", "theme": { "breadcrumb": true, "sidebar": true, @@ -59,8 +59,8 @@ "pagination": false } }, - "data_storage_and_computing_dapps": { - "title": "Data Storage and Computing ", + "dexs": { + "title": "DEXs ", "theme": { "breadcrumb": true, "sidebar": true, @@ -69,8 +69,8 @@ "pagination": false } }, - "ai_dapps": { - "title": "AI ", + "education": { + "title": "Education ", "theme": { "breadcrumb": true, "sidebar": true, @@ -79,8 +79,8 @@ "pagination": false } }, - "social_media_dapps": { - "title": "Social Media ", + "events_and_ticketing": { + "title": "Events & Ticketing ", "theme": { "breadcrumb": true, "sidebar": true, @@ -89,8 +89,8 @@ "pagination": false } }, - "messaging_and_chat_dapps": { - "title": "Messaging and Chat ", + "identity": { + "title": "Identity ", "theme": { "breadcrumb": true, "sidebar": true, @@ -99,8 +99,8 @@ "pagination": false } }, - "identity_dapps": { - "title": "Identity ", + "medical_and_health": { + "title": "Medical & Health ", "theme": { "breadcrumb": true, "sidebar": true, @@ -109,8 +109,8 @@ "pagination": false } }, - "signing_and_verification_dapps": { - "title": "Signing and Verification ", + "messaging_and_chat": { + "title": "Messaging & Chat ", "theme": { "breadcrumb": true, "sidebar": true, @@ -119,8 +119,8 @@ "pagination": false } }, - "education_dapps": { - "title": "Education ", + "payments_and_ecommerce": { + "title": "Payments & E-Commerce ", "theme": { "breadcrumb": true, "sidebar": true, @@ -129,8 +129,8 @@ "pagination": false } }, - "events_and_ticketing_dapps": { - "title": "Events and Ticketing ", + "positive_impact": { + "title": "Positive Impact ", "theme": { "breadcrumb": true, "sidebar": true, @@ -139,8 +139,8 @@ "pagination": false } }, - "supply_chain_dapps": { - "title": "Supply Chain ", + "privacy_and_security": { + "title": "Privacy & Security ", "theme": { "breadcrumb": true, "sidebar": true, @@ -149,7 +149,7 @@ "pagination": false } }, - "real_world_asset_dapps": { + "real_world_assets": { "title": "Real World Assets ", "theme": { "breadcrumb": true, @@ -159,8 +159,8 @@ "pagination": false } }, - "positive_impact_dapps": { - "title": "Positive Impact ", + "reward_distribution": { + "title": "Reward Distribution ", "theme": { "breadcrumb": true, "sidebar": true, @@ -169,8 +169,8 @@ "pagination": false } }, - "privacy_dapps": { - "title": "Privacy ", + "signing_and_verification": { + "title": "Signing & Verification ", "theme": { "breadcrumb": true, "sidebar": true, @@ -179,8 +179,18 @@ "pagination": false } }, - "reward_distribution_dapps": { - "title": "Reward Distribution ", + "social_media": { + "title": "Social Media ", + "theme": { + "breadcrumb": true, + "sidebar": true, + "toc": true, + "footer": true, + "pagination": false + } + }, + "supply_chain": { + "title": "Supply Chain ", "theme": { "breadcrumb": true, "sidebar": true, diff --git a/pages/dapps/ai_dapps.mdx b/pages/dapps/ai.mdx similarity index 96% rename from pages/dapps/ai_dapps.mdx rename to pages/dapps/ai.mdx index 0e169d21..3a22f5ee 100644 --- a/pages/dapps/ai_dapps.mdx +++ b/pages/dapps/ai.mdx @@ -1,5 +1,5 @@ --- -seo_title: AI dApps +seo_title: AI seo_description: toc: false --- diff --git a/pages/dapps/dapp_analysis_and_risk_rating.mdx b/pages/dapps/dapp_analysis_and_risk_rating.mdx new file mode 100644 index 00000000..7a63f5fd --- /dev/null +++ b/pages/dapps/dapp_analysis_and_risk_rating.mdx @@ -0,0 +1,18 @@ +--- +seo_title: Dapp Analysis and Risk Rating +seo_description: +toc: false +--- + +# Dapp Analysis and Risk Ratings + +This content is being peer reviewed & formally verified. Check back soon! + +In the meantime, explore other Cardano collections: + +- [YouTube Channels](https://www.adastack.io/community/youtube) +- [Development Firms](https://www.adastack.io/development/dev_teams) +- [Newsletters](https://www.adastack.io/community/newsletters) +- [News and Blogs](https://www.adastack.io/community/news_and_blogs) + +[Back to Full Library →](https://www.adastack.io/all_pages) diff --git a/pages/dapps/dapp_explorers.mdx b/pages/dapps/dapp_explorers.mdx index e66778e1..39de76af 100644 --- a/pages/dapps/dapp_explorers.mdx +++ b/pages/dapps/dapp_explorers.mdx @@ -1,10 +1,10 @@ --- -seo_title: dApp Explorers +seo_title: Dapp Explorers seo_description: Discover a variety of decentralized applications (dApps) in the Cardano ecosystem, using these explorers. Find the blockchain service for what you need. toc: false --- -# dApp Explorers +# Dapp Explorers Explore the dApps in the Cardano ecosystem. @@ -14,20 +14,20 @@ Explore the dApps in the Cardano ecosystem. - [Built on Cardano](https://builtoncardano.com/) -- [Danogo](https://danogo.io/tvl-report) +- [Danogo](https://danogo.io/tvl-report) -- [Alethea](https://alethea.io/dapps) +- [Alethea](https://alethea.io/dapps) -- [DefiLlama](https://defillama.com/chain/Cardano?currency=ADA) +- [DefiLlama](https://defillama.com/chain/Cardano?currency=ADA) -- [Dapp Radar](https://dappradar.com/rankings/protocol/cardano) +- [Dapp Radar](https://dappradar.com/rankings/protocol/cardano) -- [CardanoSpot Project Library](https://cardanospot.io/project-library/all/) +- [CardanoSpot Project Library](https://cardanospot.io/project-library/all/) - [Adaplug Resource Directory](https://adaplug.com/business-directory) -- [Cardano.org Showcase](https://developers.cardano.org/showcase/) +- [Cardano.org Showcase](https://developers.cardano.org/showcase/) -- [DC One Crypto](https://dconecrypto.finance/#) +- [DC One Crypto](https://dconecrypto.finance/#) -- [Cexplorer Scripts](https://cexplorer.io/dapps): Explore dApps by smart contracts. +- [Cexplorer Scripts](https://cexplorer.io/dapps): Explore dApps by smart contracts. diff --git a/pages/dapps/data_storage_and_computing_dapps.mdx b/pages/dapps/data_storage_and_computing.mdx similarity index 92% rename from pages/dapps/data_storage_and_computing_dapps.mdx rename to pages/dapps/data_storage_and_computing.mdx index bebf26fb..9428cf59 100644 --- a/pages/dapps/data_storage_and_computing_dapps.mdx +++ b/pages/dapps/data_storage_and_computing.mdx @@ -1,5 +1,5 @@ --- -seo_title: Data Storage and Computing dApps +seo_title: Data Storage and Computing seo_description: toc: false --- diff --git a/pages/dapps/defi_dapps.mdx b/pages/dapps/defi.mdx similarity index 95% rename from pages/dapps/defi_dapps.mdx rename to pages/dapps/defi.mdx index 2a3cf18e..b116762b 100644 --- a/pages/dapps/defi_dapps.mdx +++ b/pages/dapps/defi.mdx @@ -1,5 +1,5 @@ --- -seo_title: DeFi dApps +seo_title: DeFi seo_description: toc: false --- diff --git a/pages/dapps/education_dapps.mdx b/pages/dapps/education.mdx similarity index 94% rename from pages/dapps/education_dapps.mdx rename to pages/dapps/education.mdx index ee223b16..010a3963 100644 --- a/pages/dapps/education_dapps.mdx +++ b/pages/dapps/education.mdx @@ -1,5 +1,5 @@ --- -seo_title: Education dApps +seo_title: Education seo_description: toc: false --- diff --git a/pages/dapps/events_and_ticketing_dapps.mdx b/pages/dapps/events_and_ticketing.mdx similarity index 93% rename from pages/dapps/events_and_ticketing_dapps.mdx rename to pages/dapps/events_and_ticketing.mdx index 1ace50f9..c8e9a4e6 100644 --- a/pages/dapps/events_and_ticketing_dapps.mdx +++ b/pages/dapps/events_and_ticketing.mdx @@ -1,5 +1,5 @@ --- -seo_title: Events and Ticketing dApps +seo_title: Events and Ticketing seo_description: toc: false --- diff --git a/pages/dapps/identity_dapps.mdx b/pages/dapps/identity.mdx similarity index 95% rename from pages/dapps/identity_dapps.mdx rename to pages/dapps/identity.mdx index 43a121d1..3d5ac80b 100644 --- a/pages/dapps/identity_dapps.mdx +++ b/pages/dapps/identity.mdx @@ -1,5 +1,5 @@ --- -seo_title: Identity dApps +seo_title: Identity seo_description: toc: false --- diff --git a/pages/dapps/medical_and_health.mdx b/pages/dapps/medical_and_health.mdx new file mode 100644 index 00000000..c19d51b4 --- /dev/null +++ b/pages/dapps/medical_and_health.mdx @@ -0,0 +1,18 @@ +--- +seo_title: Medical and Health +seo_description: +toc: false +--- + +# Medical and Health + +This content is being peer reviewed & formally verified. Check back soon! + +In the meantime, explore other Cardano collections: + +- [YouTube Channels](https://www.adastack.io/community/youtube) +- [Development Firms](https://www.adastack.io/development/dev_teams) +- [Newsletters](https://www.adastack.io/community/newsletters) +- [News and Blogs](https://www.adastack.io/community/news_and_blogs) + +[Back to Full Library →](https://www.adastack.io/all_pages) \ No newline at end of file diff --git a/pages/dapps/messaging_and_chat_dapps.mdx b/pages/dapps/messaging_and_chat.mdx similarity index 93% rename from pages/dapps/messaging_and_chat_dapps.mdx rename to pages/dapps/messaging_and_chat.mdx index ceebfb04..734a5a22 100644 --- a/pages/dapps/messaging_and_chat_dapps.mdx +++ b/pages/dapps/messaging_and_chat.mdx @@ -1,5 +1,5 @@ --- -seo_title: Messaging and Chat dApps +seo_title: Messaging and Chat seo_description: toc: false --- diff --git a/pages/dapps/other_dapps.mdx b/pages/dapps/other_dapps.mdx index 61133bb3..a72e7ef0 100644 --- a/pages/dapps/other_dapps.mdx +++ b/pages/dapps/other_dapps.mdx @@ -1,5 +1,5 @@ --- -seo_title: Other dApps +seo_title: Other Dapps on Cardano seo_description: toc: false --- diff --git a/pages/dapps/payments_and_ecommerce_dapps.mdx b/pages/dapps/payments_and_ecommerce.mdx similarity index 92% rename from pages/dapps/payments_and_ecommerce_dapps.mdx rename to pages/dapps/payments_and_ecommerce.mdx index 15c33784..65fc20ea 100644 --- a/pages/dapps/payments_and_ecommerce_dapps.mdx +++ b/pages/dapps/payments_and_ecommerce.mdx @@ -1,5 +1,5 @@ --- -seo_title: Payments and E-Commerce dApps +seo_title: Payments and E-Commerce seo_description: toc: false --- diff --git a/pages/dapps/positive_impact_dapps.mdx b/pages/dapps/positive_impact.mdx similarity index 93% rename from pages/dapps/positive_impact_dapps.mdx rename to pages/dapps/positive_impact.mdx index c88367fd..3359cbc3 100644 --- a/pages/dapps/positive_impact_dapps.mdx +++ b/pages/dapps/positive_impact.mdx @@ -1,5 +1,5 @@ --- -seo_title: Positive Impact dApps +seo_title: Positive Impact seo_description: toc: false --- diff --git a/pages/dapps/dapp_analysis_tools.mdx b/pages/dapps/privacy_and_security.mdx similarity index 89% rename from pages/dapps/dapp_analysis_tools.mdx rename to pages/dapps/privacy_and_security.mdx index 72201c2c..9632c979 100644 --- a/pages/dapps/dapp_analysis_tools.mdx +++ b/pages/dapps/privacy_and_security.mdx @@ -1,10 +1,10 @@ --- -seo_title: dApp Analysis Tools +seo_title: Privacy and Security seo_description: toc: false --- -# dApp Analysis Tools +# Privacy and Security This content is being peer reviewed & formally verified. Check back soon! diff --git a/pages/dapps/privacy_dapps.mdx b/pages/dapps/privacy_dapps.mdx deleted file mode 100644 index 57d77600..00000000 --- a/pages/dapps/privacy_dapps.mdx +++ /dev/null @@ -1,18 +0,0 @@ ---- -seo_title: Privacy dApps -seo_description: -toc: false ---- - -# Privacy - -This content is being peer reviewed & formally verified. Check back soon! - -In the meantime, explore other Cardano collections: - -- [YouTube Channels](https://www.adastack.io/community/youtube) -- [Development Firms](https://www.adastack.io/development/dev_teams) -- [Newsletters](https://www.adastack.io/community/newsletters) -- [News and Blogs](https://www.adastack.io/community/news_and_blogs) - -[Back to Full Library →](https://www.adastack.io/all_pages) diff --git a/pages/dapps/real_world_asset_dapps.mdx b/pages/dapps/real_world_assets.mdx similarity index 93% rename from pages/dapps/real_world_asset_dapps.mdx rename to pages/dapps/real_world_assets.mdx index 60741724..eec7c822 100644 --- a/pages/dapps/real_world_asset_dapps.mdx +++ b/pages/dapps/real_world_assets.mdx @@ -1,5 +1,5 @@ --- -seo_title: Real World Asset dApps +seo_title: Real World Asset seo_description: toc: false --- diff --git a/pages/dapps/reward_distribution_dapps.mdx b/pages/dapps/reward_distribution.mdx similarity index 93% rename from pages/dapps/reward_distribution_dapps.mdx rename to pages/dapps/reward_distribution.mdx index 8e06941e..93aba142 100644 --- a/pages/dapps/reward_distribution_dapps.mdx +++ b/pages/dapps/reward_distribution.mdx @@ -1,5 +1,5 @@ --- -seo_title: Reward Distribution dApps +seo_title: Reward Distribution seo_description: toc: false --- diff --git a/pages/dapps/signing_and_verification_dapps.mdx b/pages/dapps/signing_and_verification.mdx similarity index 92% rename from pages/dapps/signing_and_verification_dapps.mdx rename to pages/dapps/signing_and_verification.mdx index 73713566..c593a122 100644 --- a/pages/dapps/signing_and_verification_dapps.mdx +++ b/pages/dapps/signing_and_verification.mdx @@ -1,5 +1,5 @@ --- -seo_title: Signing and Verification dApps +seo_title: Signing and Verification seo_description: toc: false --- diff --git a/pages/dapps/social_media_dapps.mdx b/pages/dapps/social_media.mdx similarity index 94% rename from pages/dapps/social_media_dapps.mdx rename to pages/dapps/social_media.mdx index b3af446a..851bb7e5 100644 --- a/pages/dapps/social_media_dapps.mdx +++ b/pages/dapps/social_media.mdx @@ -1,5 +1,5 @@ --- -seo_title: Social Media dApps +seo_title: Social Media seo_description: toc: false --- diff --git a/pages/dapps/supply_chain_dapps.mdx b/pages/dapps/supply_chain.mdx similarity index 94% rename from pages/dapps/supply_chain_dapps.mdx rename to pages/dapps/supply_chain.mdx index 88a9db5f..f1f40fa3 100644 --- a/pages/dapps/supply_chain_dapps.mdx +++ b/pages/dapps/supply_chain.mdx @@ -1,5 +1,5 @@ --- -seo_title: Supply Chain dApps +seo_title: Supply Chain seo_description: toc: false --- diff --git a/pages/dapps/what_is_a_dapp.mdx b/pages/dapps/what_is_a_dapp.mdx index d7447c54..0c2397c0 100644 --- a/pages/dapps/what_is_a_dapp.mdx +++ b/pages/dapps/what_is_a_dapp.mdx @@ -6,9 +6,9 @@ toc: false # What is a dApp? -A decentralized application, or dApp, is any application that runs on a blockchain network. The dApp can execute logic and make transactions on the blockchain using a smart contract. Smart contract are pieces of unchangable code forged the Cardano blockchain that execute once conditions are met. Dapps provide services and utilities within the Cardano economy. Because of open the nature of blockhain, all Cardano users should enjoy equal access when using decentralized applications. +A decentralized application, or dApp, is any application that runs on a blockchain network. The dApp can execute logic and make transactions on the blockchain using a smart contract. Smart contract are pieces of unchangeable code forged the Cardano blockchain that execute once conditions are met. Dapps provide services and utilities within the Cardano economy. Because of open the nature of blockchain, all Cardano users should enjoy equal access when using decentralized applications. -## Common Types of DApps +## Common Types of dApps **Decentralized Exchange (DEX)**: Facilitates peer-to-peer trading of cryptocurrencies, eliminating intermediaries to offer users greater autonomy and transparency in transactions. diff --git a/pages/development/_meta.json b/pages/development/_meta.json index beb89f32..1909827d 100644 --- a/pages/development/_meta.json +++ b/pages/development/_meta.json @@ -1,6 +1,6 @@ { "intro_to_cardano_development": { - "title": "Intro to Cardano Development", + "title": "Intro to Cardano Dev", "theme": { "breadcrumb": true, "sidebar": true, @@ -22,7 +22,7 @@ } }, "dev_teams": { - "title": "Software Development Firms", + "title": "Development Companies", "theme": { "breadcrumb": true, "sidebar": true, @@ -152,16 +152,6 @@ "pagination": false } }, - "developer_tool_explorers": { - "title": "Tool Explorers ", - "theme": { - "breadcrumb": true, - "sidebar": true, - "toc": true, - "footer": true, - "pagination": false - } - }, "developer_jobs": { "title": "Developer Jobs ", "theme": { diff --git a/pages/development/code_libraries.mdx b/pages/development/code_libraries.mdx index a61bc472..f3ccf273 100644 --- a/pages/development/code_libraries.mdx +++ b/pages/development/code_libraries.mdx @@ -4,6 +4,8 @@ seo_description: Find Cardano libraries and frameworks for off-chain transaction toc: true --- +import LibraryInfoBar from "../../components/LibraryInfoBar"; + # Cardano Code Libraries Libraries to connect to the Cardano blockchain and build applications. @@ -12,7 +14,7 @@ Libraries to connect to the Cardano blockchain and build applications. Off-chain libraries provide abstractions for developers to build transactions and submit them on the Cardano blockchain. These libraries enable connecting to a node, querying the blockchain, asset transfer, and interaction with smart contracts. -#### Lucid +#### Lucid [Not Maintained] Lucid is a library to build Cardano transactions and write off-chain code in JavaScript and Typescript. It is designed for simplicity, allowing developers to describe actions at a high level. @@ -21,22 +23,7 @@ Lucid is a library to build Cardano transactions and write off-chain code in Jav - [More Lucid resources](https://lucid.spacebudz.io/docs/resources/) - [Spacebudz Discord](https://discord.gg/nwySKPxSec): Lucid Channel -
-Rust Programming Language Badge - - - GitHub link - -
-
+ #### Mesh @@ -47,48 +34,11 @@ Mesh is a Cardano off-chain framework that provides cardano-cli like transaction - [Mesh Discord](https://meshjs.dev/go/discord) - [TxPipe Discord](https://discord.gg/sJ2D3g33Qp): Mesh channel -
-TypeScript Programming Language Badge - - GitHub link - -
-
- -#### Cardano-js-sdk - -Cardano-js-sdk is a JavaScript toolkit to build applications that interact with the Cardano blockchain. It provides a set of tools and functions for wallets, keys, transactions, and more. - -- [Cardano-js-sdk GitHub](https://github.com/input-output-hk/cardano-js-sdk) -- [Cardano-js-sdk Documentation](https://input-output-hk.github.io/cardano-js-sdk/) -- [Cardano-js-sdk Getting Started](https://github.com/input-output-hk/cardano-js-sdk/blob/master/GETTING_STARTED.md) -- [IOG Technical Community Discord](https://discord.gg/inputoutput) - -
-TypeScript Programming Language Badge - - GitHub link - -
-
- #### PyCardano PyCardano is a lightweight, standalone Cardano client library written in Python. It enables developers to create and sign transactions on the Cardano blockchain without relying on third-party serialization tools. @@ -99,22 +49,24 @@ PyCardano is a lightweight, standalone Cardano client library written in Python. - [PyCardano Discord](https://discord.gg/MazZyMPjC6) - [TxPipe Discord](https://discord.gg/sJ2D3g33Qp): Pycardano channel -
-Python Programming Language Badge - - GitHub link - -
-
+#### Cardano-js-sdk + +Cardano-js-sdk is a JavaScript toolkit to build applications that interact with the Cardano blockchain. It provides a set of tools and functions for wallets, keys, transactions, and more. + +- [Cardano-js-sdk GitHub](https://github.com/input-output-hk/cardano-js-sdk) +- [Cardano-js-sdk Documentation](https://input-output-hk.github.io/cardano-js-sdk/) +- [Cardano-js-sdk Getting Started](https://github.com/input-output-hk/cardano-js-sdk/blob/master/GETTING_STARTED.md) +- [IOG Technical Community Discord](https://discord.gg/inputoutput) + + #### Cardano-CLI JS @@ -123,23 +75,11 @@ Cardano-CLI JS is a TypeScript library that wraps the Cardano-CLI, providing dev - [Cardano-cli JS GitHub](https://github.com/miguelaeh/cardanocli-js) - [Cardano.org Cardano-cli](https://developers.cardano.org/docs/get-started/cardanocli-js/) -
-TypeScript Programming Language Badge - - GitHub link - -
-
- #### Plu-ts Plu-ts is a TypeScript library designed for building Cardano dApps. It can be used for on-chain contracts, and for off-chain functionalities. @@ -149,23 +89,11 @@ Plu-ts is a TypeScript library designed for building Cardano dApps. It can be us - [Plu-ts Off-chain Reference](https://pluts.harmoniclabs.tech/category/offchain) - [Harmonic Labs Discord](https://discord.gg/P6fbZSA85f) -
-TypeScript Programming Language Badge - - GitHub link - -
-
- #### Cardano-client-lib Cardano Client Lib is a Java library that makes it easy to interact with the Cardano blockchain with features for transaction creation, signing, address management, and API integrations. @@ -174,23 +102,11 @@ Cardano Client Lib is a Java library that makes it easy to interact with the Car - [Cardano-client-lib Documentation](https://cardano-client.dev/) - [Roasted Bean Alliance Discord](https://discord.com/invite/JtQ54MSw6p) -
-Java Programming Language Badge - - GitHub link - -
-
- #### CardanoSharp Wallet CardanoSharp Wallet is a .NET library for creating keys and addresses, managing wallets, and building and signing transactions. @@ -199,23 +115,11 @@ CardanoSharp Wallet is a .NET library for creating keys and addresses, managing - [CardanoSharp wallet Documentation](https://cardanosharp.com/) - [CardanoSharp Discord](https://discord.com/invite/WRAySDD2Kk) -
-C# Programming Language Badge - - GitHub link - -
-
- #### Cardano-transaction-lib Cardano-transaction-lib (CTL) is a Purescript library for building smart contract transactions. It allows developers to run Plutus off-chain code in the browser environment. @@ -224,23 +128,11 @@ Cardano-transaction-lib (CTL) is a Purescript library for building smart contrac - [Cardano-transaction-lib Documentation](https://plutonomicon.github.io/cardano-transaction-lib/) - [Plutonomicon Discord](https://discord.gg/JhbexnV9Pc) -
-PureScript Programming Language Badge - - GitHub link - -
-
- #### gOuroboros gOuroboros is a Go library to build applications interacting with the Cardano blockchain. It provides tools to communicate with Cardano nodes, manage transactions, and perform various off-chain operations. @@ -248,23 +140,11 @@ gOuroboros is a Go library to build applications interacting with the Cardano bl - [gOuroboros GitHub](https://github.com/blinklabs-io/gouroboros) - [Blink Labs Discord](https://discord.gg/jx9dxarjyv) -
-Go Programming Language Badge - - GitHub link - -
-
- #### Atlas Atlas is a Haskell library designed to be an application backend for Plutus smart contracts on the Cardano blockchain. It offers a user-friendly API for creating transactions and interacting with smart contracts. @@ -273,23 +153,11 @@ Atlas is a Haskell library designed to be an application backend for Plutus smar - [Atlas Website and Documentation](https://atlas-app.io/) - [GeniusYield Discord](https://discord.gg/TNHf4fs626) -
-Haskell Programming Language Badge - - GitHub link - -
-
- #### TyphonJS TyphonJS is a TypeScript library designed for working with the Cardano blockchain. It allows developers to generate and manage Cardano addresses, build complex transactions, and automatically select UTXOs. @@ -298,23 +166,11 @@ TyphonJS is a TypeScript library designed for working with the Cardano blockchai - [TyphonJS Documentation](https://docs.strica.io/lib/typhonjs/index.html) - [Strica Discord](https://discord.com/invite/WQFPHNXcz8) -
-TypeScript Programming Language Badge - - GitHub link - -
-
- #### Blaze Blaze allows you to create Cardano transactions and off-chain code in TypeScript. The library has few external dependencies and can be used in browser environment. @@ -323,22 +179,22 @@ Blaze allows you to create Cardano transactions and off-chain code in TypeScript - [Blaze Documentation](https://blaze.butane.dev/) - [TxPipe Discord](https://discord.gg/sJ2D3g33Qp): Blaze channel -
-TypeScript Programming Language Badge - - GitHub link - -
-
+#### Lucid Evolution + +Lucid Evolution is a TypeScript library derived from the popular Lucid library. Lucid Evolution is actively maintained with a focus on type safety, scalability, and effective side-effect management. + +- [Lucid Evolution GitHub](https://github.com/Anastasia-Labs/lucid-evolution) +- [Lucid Evolution Documentation](https://anastasia-labs.github.io/lucid-evolution) + + #### Kuber @@ -348,23 +204,11 @@ Kuber is an Haskell library with a user-friendly JSON API to compose transaction - [Kuber Explained by Dquadrant](https://dquadrant.com/blog/kuber-a-new-open-source-library-for-cardano/) - [Kuber Discord](https://discord.gg/xDSmAX6MXC) -
-Haskell Programming Language Badge - - GitHub link - -
-
- #### Cardano Web3.js CardanoWeb3js is a TypeScript library to integrate with the Cardano blockchain. It supports both Node.js and browser environments, transaction creation, smart contract deployment, and data exploration. @@ -374,69 +218,21 @@ CardanoWeb3js is a TypeScript library to integrate with the Cardano blockchain. - [Cardano Web3.js Playground](https://cardano-web3-js.org/playground/) - [Xray Discord](https://discord.gg/zdbYrmxevp) -
-TypeScript Programming Language Badge - - - GitHub link - -
-
- -#### Lucid Evolution - -Lucid Evolution is a TypeScript library derived from the popular Lucid library. Lucid Evolution is actively maintained with a focus on type safety, scalability, and effective side-effect management. - -- [Lucid Evolution GitHub](https://github.com/Anastasia-Labs/lucid-evolution) -- [Lucid Evolution Documentation](https://anastasia-labs.github.io/lucid-evolution) -- [Lucid Evolution Catalyst Proposal](https://www.lidonation.com/index.php/en/proposals/anastasia-labs-lucid-evolution-redefining-off-chain-transactions-in-cardano-f11) - -
-TypeScript Programming Language Badge - - GitHub link - -
-
- #### Cardano-transactions Haskell library utilities for constructing and signing Cardano transactions. The library also includes a small command-line interface for transaction creation in the terminal. - [Cardano-transactions GitHub](https://github.com/IntersectMBO/cardano-transactions) -
-Haskell Programming Language Badge - - GitHub link - -
-
+ #### Apollo @@ -445,21 +241,7 @@ Apollo provides Golang building blocks for Cardano including serialization and t - [Apollo GitHub](https://github.com/Salvionied/apollo) - [Apollo Discord](https://discord.com/invite/MH4CmJcg49) -
-Go Programming Language Badge - - GitHub link - -
-
+ #### Elm Cardano @@ -468,21 +250,10 @@ The elm-cardano library is a tool that allows developers to write off-chain code - [Elm Cardano GitHub](https://github.com/mpizenberg/elm-cardano) - [TxPipe Discord](https://discord.gg/sJ2D3g33Qp): Elm channel -
-Elm Programming Language Badge - - GitHub link - -
-
+ #### Whisky @@ -492,21 +263,7 @@ A Rust library for easy Cardano transaction building and unit testing. It provid - [Whisky Documentation](https://sidan-lab.github.io/whisky/) - [Whisky Course on Andamio](https://www.andamio.io/course/whisky) -
-Rust Programming Language Badge - - GitHub link - -
-
+ #### SC-Tools @@ -515,44 +272,10 @@ SC-Tools is a collection of Haskell libraries for building Cardano applications - [SC-Tools GitHub](https://github.com/j-mueller/sc-tools) - [SC-Tools Documentation](https://j-mueller.github.io/sc-tools/) -
-Haskell Programming Language Badge - - GitHub link - -
-
- -#### CAB - -CAB (Cardano Application Backend) is a TypeScript library with a suite of tools including wallet and account management, custom blockchain data sources, cryptographic utilities, and CIP-30 dApp connector helpers. - -- [CAB GitHub](https://github.com/WingRiders/cab) -- [Wingriders Discord](https://discord.com/invite/t7CdyhK8JA) - -
-TypeScript Programming Language Badge - - GitHub link - -
-
+ #### Cardano-C @@ -561,21 +284,19 @@ Cardano-C is a C library designed for building transactions and interacting with - [Cardano-C GitHub](https://github.com/Biglup/cardano-c) - [Cardano-C Documentation](https://cardano-c.readthedocs.io/en/latest/) -
-C Programming Language Badge - - GitHub link - -
-
+ + +#### CAB + +CAB (Cardano Application Backend) is a TypeScript library with a suite of tools including wallet and account management, custom blockchain data sources, cryptographic utilities, and CIP-30 dApp connector helpers. + +- [CAB GitHub](https://github.com/WingRiders/cab) +- [Wingriders Discord](https://discord.com/invite/t7CdyhK8JA) + + #### LibCardano @@ -584,25 +305,14 @@ This C++ library provide an interfaces to integrate Cardano capabilities into a - [libcardano GitLab](https://gitlab.com/viper-staking/libcardano) - [libcardano Documentation](https://viperscience.gitlab.io/libcardano/) -
-C++ Programming Language Badge - - GitLab link - -
-
-## Website Development Libraries +## Web and Wallet Connector Libraries -Website libraries help connect websites with the Cardano blockchain. These libraries often support website components, wallet integration, API connections, and other web development tools for Cardano-based applications. +Web and wallet libraries help connect websites with the Cardano blockchain. These libraries often support web components, wallet integration, API connections, and other development tools for Cardano web applications. #### Mesh @@ -613,21 +323,10 @@ Mesh is a website framework that allows you to integrate new or existing website - [Mesh Discord](https://meshjs.dev/go/discord) - [TxPipe Discord](https://discord.gg/sJ2D3g33Qp): Mesh channel -
-TypeScript Programming Language Badge - - GitHub link - -
-
+ #### Cardano Connect with Wallet @@ -636,23 +335,11 @@ JavaScript and TypeScript functions to simplify the dApp development. Provides h - [Cardano-connect-with-wallet GitHub](https://github.com/cardano-foundation/cardano-connect-with-wallet) - [Cardano-connect-with-wallet Documentation](https://cardano-foundation.github.io/cardano-connect-with-wallet/react-storybook/) -
-TypeScript Programming Language Badge - - GitHub link - -
-
- #### CardanoPress CardanoPress connects a WordPress website to the Cardano blockchain. Features include token gating, ISPO dashboard, and project governance. @@ -660,23 +347,11 @@ CardanoPress connects a WordPress website to the Cardano blockchain. Features in - [CardanoPress GitHub](https://github.com/CardanoPress/cardanopress) - [CardanoPress Website](https://cardanopress.io/) -
-PHP Programming Language Badge - - GitHub link - -
-
- #### Use Cardano Use-cardano is a react context, hook, and set of components that makes interacting with the Cardano blockchain easy. It allows you to build web3 applications, connect wallets, perform tasks such as signing transactions, and interact with smart contracts. @@ -685,22 +360,21 @@ Use-cardano is a react context, hook, and set of components that makes interacti - [Use Cardano Documentation](https://use-cardano.alangaming.com/) - [Starter Kit Demo](https://cardano-starter-kit.alangaming.com/) -
-TypeScript Programming Language Badge - - GitHub link - -
-
+#### Weld + +Weld is a universal wallet connector library to simplify managing Web3 wallet connections. Weld is framework-agnostic and cross-chain. + +- [Weld GitHub](https://github.com/Cardano-Forge/weld) + + #### CardanoSharp Blazor @@ -708,23 +382,11 @@ CardanoSharp Blazor is a component library for C# devs to develop dApps on Carda - [CardanoSharp Blazor GitHub](https://github.com/CardanoSharp/cardanosharp-blazor) -
-C# Programming Language Badge - - GitHub link - -
-
- #### Cardano-Connect Web component for connecting to Cardano wallets. The component provides a button that drops into a list of browser-based Cardano wallets. @@ -732,23 +394,11 @@ Web component for connecting to Cardano wallets. The component provides a button - [Cardano-connect GitHub](https://github.com/osc707/cardano-connect) - [Cardano-connect Documentation](https://github.com/osc707/cardano-connect/blob/main/custom-elements.md) -
-HTML5 Badge - - GitHub link - -
-
- #### Cardano-Peer-Connect Cardano-peer-connect aims to provide simple interfaces to implement CIP-0045 for dApps and wallets. @@ -756,23 +406,11 @@ Cardano-peer-connect aims to provide simple interfaces to implement CIP-0045 for - [Cardano-peer-connect GitHub](https://github.com/fabianbormann/cardano-peer-connect) - [Cardano-peer-connect Demo Implementation](https://github.com/fabianbormann/cip-0045-demo-implementation) -
-TypeScript Programming Language Badge - - GitHub link - -
-
- #### Cardano-dApp-JS Cardano-dApp-JS is a library that with wallet connection and wallet styling. @@ -780,73 +418,47 @@ Cardano-dApp-JS is a library that with wallet connection and wallet styling. - [Cardano-dApp-JS GitHub](https://github.com/thaddeusdiamond/cardano-dapp-js) - [Wild Tangz Discord](https://discord.com/invite/wildtangz) -
-JavaScript Programming Language Badge - - GitHub link - -
-
- #### Cardano-dApp-Wallet-Connector The Cardano wallet dApp connector library provides components, hooks, and utility functions to simplify utilizing the Cardano wallet object as defined in CIP 30. - [Cardano-dapp-wallet-connector GitHub](https://github.com/projectNEWM/cardano-dapp-wallet-connector) -
-TypeScript Programming Language Badge - - GitHub link - -
-
- #### Cardano-Connect Cardano-connect is a WordPress plugin providing Cardano Web3 wallet connections and wallet detection features via short codes and Gutenberg blocks, supporting all CIP-30 compliant wallets. - [Cardano-connect GitHub](https://github.com/devhalls/cardano-connect) -
-TypeScript Programming Language Badge - - GitHub link - -
-
- ## Command Line (CLI) Tools and Libraries Command Line Interface (CLI) tools provide developers with a powerful means to interact with the Cardano blockchain directly from the terminal. CLI programs can monitor the blockchain, perform utility actions, manage Cardano Node installs, and more. +#### Aiken CLI Utilities + +Aiken CLI provides several key functionalities for working with UPLC (Untyped Plutus Core) programs, allowing developers to evaluate, format, and convert UPLC between human-readable and binary. + +- [Aiken GitHub](https://github.com/aiken-lang) +- [Aiken Website](https://aiken-lang.org/) +- [Aiken Documentation](https://aiken-lang.org/installation-instructions) + + + #### Cardano-addresses Library that provides essential tools for managing Cardano addresses and mnemonics. Features include creating recovery phrases (mnemonics), wallet restoration, and creating addresses from keys. @@ -854,69 +466,45 @@ Library that provides essential tools for managing Cardano addresses and mnemoni - [Cardano-addresses GitHub](https://github.com/IntersectMBO/cardano-addresses) - [Cardano-addresses Documentation](https://intersectmbo.github.io/cardano-addresses/haddock/) -
-Haskell Programming Language Badge - - GitHub link - -
-
- #### Cardano HW CLI Command-line interface tool that extends the official Cardano-CLI, providing the ability to manage keys, sign transactions, and interface with hardware wallets. - [Cardano-hw-cli GitHub](https://github.com/vacuumlabs/cardano-hw-cli) -
-TypeScript Programming Language Badge - - GitHub link - -
-
- -#### Cncli +#### CNCLI CNCLI (Cardano Node CLI) is a community-developed command-line tool that extends the official cardano-cli, providing utilities for stake pool operators and developers. - [Cncli GitHub](https://github.com/cardano-community/cncli) - [Cncli Documentation](https://github.com/cardano-community/cncli/blob/develop/USAGE.md) -
-Rust Programming Language Badge - - GitHub link - -
-
+#### Yaci CLI + +Yaci CLI is part of the Yaci Devkit. The CLI allows you to tream blockchain data from a Cardano node, and create and manage private Cardano networks (devnets). + +- [Yaci CLI GitHub](https://github.com/bloxbean/yaci-devkit/) +- [Yaci CLI Documentation](https://github.com/bloxbean/yaci-devkit/tree/main/applications/cli) + + #### Bech32 @@ -925,23 +513,11 @@ A small CLI program to convert to and from bech32 strings. This can be useful wh - [Bech32 GitHub](https://github.com/IntersectMBO/bech32) - [Bech32 Documentation](https://github.com/IntersectMBO/bech32) -
-Haskell Programming Language Badge - - GitHub link - -
-
- #### Cardano-CLI Cardano-CLI is a core command-line tool for interacting with a Cardano node. It offers many tools such as key management, creating ADA transactions, blockchain queries, and smart contract interactions. @@ -949,46 +525,22 @@ Cardano-CLI is a core command-line tool for interacting with a Cardano node. It - [Cardano-CLI GitHub](https://github.com/IntersectMBO/cardano-cli) - [Cardano-CLI Documentation](https://github.com/IntersectMBO/cardano-cli/blob/main/cardano-cli/test/cardano-cli-golden/files/golden/help.cli) -
-Haskell Programming Language Badge - - GitHub link - -
-
- #### Cardano-signer The Cardano Signer library is a versatile tool for signing and verifying using Cardano keys. It supports various standards like CIP-8, CIP-30, CIP-36. It can be used to sign data with a secret key, and verify data with a public key. - [Cardano-Signer GitHub](https://github.com/gitmachtl/cardano-signer) -
-JavaScript Programming Language Badge - - GitHub link - -
-
- #### Nview Nview is a monitoring tool that gives a view of a running node from the command line. @@ -996,22 +548,7 @@ Nview is a monitoring tool that gives a view of a running node from the command - [Nview GitHub](https://github.com/blinklabs-io/nview) - [Blink Labs Discord](https://discord.gg/jx9dxarjyv): Nview channel -
-Go Programming Language Badge - - - GitHub link - -
-
+ #### Txtop @@ -1020,22 +557,7 @@ Txtop is a tool to inspect the mempool of a Cardano node, which can be useful to - [Txtop GitHub](https://github.com/blinklabs-io/txtop) - [Blink Labs Discord](https://discord.com/invite/5fPRZnX4qW) -
-Go Programming Language Badge - - - GitHub link - -
-
+ #### Cardano-Up @@ -1044,92 +566,44 @@ Cardano-up is a line utility for managing Cardano services. It allows you to ins - [Cardano-up GitHub](https://github.com/blinklabs-io/cardano-up) - [Blink Labs Discord](https://discord.com/invite/5fPRZnX4qW): Cardano-up channel -
-Go Programming Language Badge - - GitHub link - -
-
- #### Hyper Jump Command-line version manager for Cardano. Install, uninstall, and update Cardano services like Cardano-Node and Cardano-CLI. - [Hyper Jump GitHub](https://github.com/falcucci/hyper-jump) -
-Rust Programming Language Badge - - GitHub link - -
-
- #### Gastronomy Gastronomy is a UPLC debugger that allows you to step forward and backward through steps of smart contract execution using the CLI. - [Gastronomy GitHub](https://github.com/SundaeSwap-finance/gastronomy) -
-Rust Programming Language Badge - - GitHub link - -
-
- #### Cardano Skepsis Toolbox Cardano-skepsis-toolbox is a python-based utility designed for interacting with the Cardano blockchain via the cardano-cli. - [Cardano-skepsis-toolbox GitHub](https://github.com/chrispalaskas/cardano-skepsis-toolbox) -
-Python Programming Language Badge - - GitHub link - -
-
- ## Node Libraries Node Libraries are essential libraries that deal with networking, consensus, and settlement. These libraries form the backbone of the Cardano blockchain network, enabling communication and operation between various components. @@ -1141,23 +615,11 @@ The Cardano node is the core component to participate in the Cardano blockchain. - [Cardano Node GitHub](https://github.com/IntersectMBO/cardano-node) - [Intersect Discord](https://discord.gg/7bQtEy3pyG): Node-working-group channel -
-Haskell Programming Language Badge - - GitHub link - -
-
- #### Ogmios A lightweight bridge between the Cardano node and client applications, enabling efficient communication. It allows developers to use JSON and RPC for operations like querying ledger state, submitting transactions, and monitoring the mempool. @@ -1166,22 +628,19 @@ A lightweight bridge between the Cardano node and client applications, enabling - [Ogmios Documentation](https://ogmios.dev/) - [IOG Technical Community Discord](https://discord.gg/inputoutput): Ogmios channel -
-Haskell Programming Language Badge - - GitHub link - -
-
+#### Pallas + +Pallas re-implements common Ouroboros and other Cardano logic in native Rust. It can be useful for building wallets, explorers, or custom node implementations. It is a collection of modules, so developers can use only what they need. + +- [Pallas GitHub](https://github.com/txpipe/pallas) +- [TxPipe Discord](https://discord.gg/sJ2D3g33Qp): Pallas channel + + #### Dolos @@ -1191,22 +650,7 @@ Dolos is a specialized Cardano data node, designed to maintain an up-to-date cop - [Dolos Documentation](https://dolos.txpipe.io/) - [TxPipe Discord](https://discord.gg/sJ2D3g33Qp): Dolos channel -
-Rust Programming Language Badge - - - GitHub link - -
-
+ #### Cardano Node Tests @@ -1215,23 +659,11 @@ Cardano Node Tests is a library provides system and end-to-end (E2E) tests for c - [Cardano-node-tests GitHub](https://github.com/IntersectMBO/cardano-node-tests) - [Cardano-node-tests Documentation](https://tests.cardano.intersectmbo.org/) -
-Python Programming Language Badge - - GitHub link - -
-
- #### Amaru Amaru is a Cardano node client written in Rust. It aims to bring more node diversity to Cardano. It is currently in development. @@ -1240,22 +672,7 @@ Amaru is a Cardano node client written in Rust. It aims to bring more node dive - [Amaru Roadmap](https://pragma.builders/projects/amaru/) - [Pragma Discord](https://discord.gg/M65GBpkGjK): Amaru channel -
-Rust Programming Language Badge - - - GitHub link - -
-
+ #### Yaci @@ -1264,22 +681,7 @@ Yaci allows connection and interaction with Cardano nodes directly. The library - [Yaci GitHub](https://github.com/bloxbean/yaci) - [Roasted Bean Alliance Discord](https://discord.com/invite/JtQ54MSw6p) -
-Java Programming Language Badge - - - GitHub link - -
-
+ ## Indexing Libraries @@ -1294,23 +696,11 @@ Cardano-DB-Sync is a tool that continuously syncs the Cardano blockchain with a - [Tx-Pipe Discord](https://discord.gg/9vJnnW6vDP): DB-Sync channel - [Intersect Discord](https://discord.gg/7bQtEy3pyG): DB-Sync Working Group Channel -
-Haskell Programming Language Badge - - GitHub link - -
-
- #### Oura Oura is CLI tool that monitors the Cardano blockchain in real-time. It allows filtering, saving, and reacting to on-chain events. Oura does not provide chain-indexing directly, but it supports sinks where filtered data can be stored (e.g. Elastic Search or Kafka). @@ -1319,22 +709,7 @@ Oura is CLI tool that monitors the Cardano blockchain in real-time. It allows fi - [Oura Documentation](https://txpipe.github.io/oura/) - [TxPipe Discord](https://discord.gg/9vJnnW6vDP): Oura channel -
-Rust Programming Language Badge - - - GitHub link - -
-
+ #### Kupo @@ -1343,23 +718,11 @@ Kupo is a lightweight chain-indexing tool for the Cardano blockchain. It quickly - [Kupo GitHub](https://github.com/CardanoSolutions/kupo) - [TxPipe Discord](https://discord.gg/9vJnnW6vDP): Kupo channel -
-Haskell Programming Language Badge - - GitHub link - -
-
- #### Carp Carp is an indexer, built in Rust, that syncs blockchain data into a PostgreSQL database. It’s designed for speed and flexibility, making it ideal for production applications like wallets. It has an indexer for storing data and a web server with a REST API for database queries. @@ -1367,46 +730,16 @@ Carp is an indexer, built in Rust, that syncs blockchain data into a PostgreSQL - [Carp GitHub](https://github.com/dcSpark/carp/) - [Carp Documentation](https://dcspark.github.io/carp/docs/intro/) -
-Rust Programming Language Badge - - - GitHub link - -
-
- -#### LedgerSync + -LedgerSync is a Java application for indexing Cardano blockchain data. It reads from the Cardano blockchain and writes it to a PostgreSQL database. There is also a streaming app that publishes events to messaging middleware like Kafka or RabbitMQ. +#### Scrolls -- [LedgerSync GitHub](https://github.com/cardano-foundation/cf-ledger-sync) -- [LedgerSync Documentation](https://cardano-foundation.github.io/cf-ledger-sync) +Scrolls is a Rust-based library designed for building and managing read-optimized collections of Cardano blockchain data. It efficiently crawls the blockchain, aggregates data, and keeps data updated by monitoring the chain tip. -
-Java Programming Language Badge +- [Scrolls GitHub](https://github.com/txpipe/scrolls) +- [TxPipe Discord](https://discord.gg/GgZbKGFeUx) - - GitHub link - -
-
+ #### Adder @@ -1416,22 +749,19 @@ Adder is a tool that monitors the Cardano blockchain and emits events as blocks - [Adder Starter Kit](https://github.com/blinklabs-io/adder-library-starter-kit) - [Blink Labs Discord](https://discord.gg/msgxSvq4Ez): Adder channel -
-Go Programming Language Badge + - - GitHub link - -
-
+#### LedgerSync + +LedgerSync is a Java application for indexing Cardano blockchain data. It reads from the Cardano blockchain and writes it to a PostgreSQL database. There is also a streaming app that publishes events to messaging middleware like Kafka or RabbitMQ. + +- [LedgerSync GitHub](https://github.com/cardano-foundation/cf-ledger-sync) +- [LedgerSync Documentation](https://cardano-foundation.github.io/cf-ledger-sync) + + #### Yaci-store @@ -1441,47 +771,11 @@ Yaci Store is a modular indexer library written in Java for the Cardano blockcha - [Yaci-store Documentation](https://store.yaci.xyz/) - [Roasted Bean Alliance Discord](https://discord.com/invite/JtQ54MSw6p) -
-Java Programming Language Badge - - - GitHub link - -
-
- -#### Scrolls - -Scrolls is a Rust-based library designed for building and managing read-optimized collections of Cardano blockchain data. It efficiently crawls the blockchain, aggregates data, and keeps data updated by monitoring the chain tip. - -- [Scrolls GitHub](https://github.com/txpipe/scrolls) -- [TxPipe Discord](https://discord.gg/GgZbKGFeUx) - -
-Rust Programming Language Badge - - GitHub link - -
-
- #### Marconi Marconi is a lightweight, customizable framework for indexing and querying Cardano blockchain data. It offers flexible data storage options such as SQLite, file-based, and in-memory. @@ -1489,68 +783,29 @@ Marconi is a lightweight, customizable framework for indexing and querying Carda - [Marconi GitHub](https://github.com/input-output-hk/marconi) - [IOG Technical Community Discord](https://discord.gg/inputoutput) -
-Haskell Programming Language Badge - - GitHub link - -
-
- #### Mafoc Mafoc is a Haskell framework for developing custom blockchain indexers, using an SQLite database that can be queried for data. - [Mafoc GitHub](https://github.com/eyeinsky/mafoc/) -
-Haskell Programming Language Badge - - GitHub link - -
-
- #### Argus Argus is a .NET library that simplifies indexing that provides a framework. It processes block data into structured, queryable formats in a PostgreSQL database. It is designed for robust enterprise integration. - [Argus GitHub](https://github.com/SAIB-Inc/Argus) -
-C# Programming Language Badge - - - GitHub link - -
-
+ ## Serialization Libraries @@ -1563,23 +818,11 @@ Cardano Serialization Library, written in Rust, serializes and deserializes data - [Cardano Serialization Lib GitHub](https://github.com/Emurgo/cardano-serialization-lib) - [Cardano Serialization Lib Documentation](https://developers.cardano.org/docs/get-started/cardano-serialization-lib/overview/) -
-Rust Programming Language Badge - - GitHub link - -
-
- #### Cardano Multiplatform Lib (CML) This multi-platform Rust library provides serialization and deserialization of core data structures, along with utility functions for dApps and wallets. @@ -1587,46 +830,22 @@ This multi-platform Rust library provides serialization and deserialization of c - [Cardano-multiplatform Lib GitHub](https://github.com/dcSpark/cardano-multiplatform-lib) - [DcSpark Discord](https://discord.gg/UX62bjCxVg) -
-Rust Programming Language Badge - - GitHub link - -
-
- #### Go Cardano Serialization Golang library for serialization and deserialization of Cardano data structures. - [Go Cardano Serialization GitHub](https://github.com/fivebinaries/go-cardano-serialization) -
-Go Programming Language Badge - - GitHub link - -
-
- ## Testing Libraries Testing libraries are essential tools to ensure top quality throughout the development process. These libraries may involve testing smart contracts, transactions, running simulations, or checking performance. @@ -1638,22 +857,23 @@ Naumachia is a framework for creating and testing smart contracts that offers a - [Naumachia GitHub](https://github.com/free-honey/naumachia) - [TxPipe Discord](https://discord.gg/sJ2D3g33Qp): Naumanchia channel -
-Rust Programming Language Badge - - GitHub link - -
-
+#### Yaci DevKit + +Yaci DevKit is a development toolkit for Cardano that allows developers to create custom devnets in seconds, enabling rapid iteration and experimentation. It includes tools like the Yaci CLI, Yaci Store (a lightweight chain indexer), and Yaci Viewer (a browser-based blockchain data viewer). + +- [Yaci DevKit GitHub](https://github.com/bloxbean/yaci-devkit) +- [Yaci DevKit Documentation](https://devkit.yaci.xyz/) +- [Roasted Bean Alliance Discord](https://discord.com/invite/JtQ54MSw6p) + + #### Quickcheck Dynamic @@ -1661,46 +881,22 @@ QuickCheck-dynamic is a Haskell library designed for testing stateful systems, i - [Quickcheck Dynamic GitHub](https://github.com/input-output-hk/quickcheck-dynamic) -
-Haskell Programming Language Badge - - GitHub link - -
-
- #### Plutus Bench Test and benchmark Plutus Smart Contracts. - [Plutus Bench GitHub](https://github.com/OpShin/plutus-bench) -
-Python Programming Language Badge - - GitHub link - -
-
- #### Vodka Vodka is a Cardano development toolkit designed to use with Aiken. It includes unit test utilities to build transactions for testing purposes. @@ -1708,22 +904,7 @@ Vodka is a Cardano development toolkit designed to use with Aiken. It includes u - [Vodka GitHub](https://github.com/sidan-lab/vodka) - [Vodka Documentation](https://sidan-lab.github.io/vodka/) -
-Gleam Programming Language Badge - - - GitHub link - -
-
+ ## Registries @@ -1736,22 +917,10 @@ The Cardano token registry is where token creators submit verified information a - [Cardano Token Registry GitHub](https://github.com/cardano-foundation/cardano-token-registry) - [Cardano Token Registry Guide and FAQ](https://github.com/cardano-foundation/cardano-token-registry/wiki) -
-Nix Package Manager Badge  - - - GitHub link - -
-
+ #### Offchain Data Registry @@ -1759,22 +928,10 @@ The Offchain Data Registry maps dApps to their script addresses. They also maint - [Offchain Data Registry GitHub](https://github.com/Cardano-Fans/crfa-offchain-data-registry) -
-JSON Data Badge  - - - GitHub link - -
-
+ #### Cardano Contracts Registry @@ -1782,22 +939,23 @@ A registry maintaining information about dApps on the Cardano blockchain, used b - [Cardano Contracts Registry GitHub](https://github.com/StricaHQ/cardano-contracts-registry) -
-JavaScript Programming Language Badge - - GitHub link - -
-
+#### Metadata Registry Testnet + +Metadata Registry Testnet provides a way to register off-chain token metadata that can map to on-chain identifiers (typically hashes representing asset IDs, output locking scripts, or token forging policies). It is intended for use with testnets, use the Cardano Token Registry instead for mainnet. + +- [Metadata Registry Testnet GitHub](https://github.com/input-output-hk/metadata-registry-testnet) +- [Metadata Registry Testnet Wiki](https://github.com/cardano-foundation/cardano-token-registry/wiki) +- [IOG Technical Community Discord](https://discord.gg/inputoutput) + + #### Cardano Shield Registry @@ -1807,23 +965,11 @@ Cardano shield is a registry of known scammers, collected to provide protection - [Cardano Shield Website](https://www.cardanoshield.com/) - [Cardano Shield Blacklist](https://github.com/adabox-aio/cardano-shield/blob/main/config/blacklist.json) -
-Python Programming Language Badge - - GitHub link - -
-
- #### Eternl Guard Registry Eternl Guard is a repository designed to gather domain names and asset of known bad actors. This helps users protect their funds by identifying scams. @@ -1831,22 +977,10 @@ Eternl Guard is a repository designed to gather domain names and asset of known - [Eternl Guard GitHub](https://github.com/Tastenkunst/eternl-guard) - [Eternl Guard Blacklist](https://github.com/Tastenkunst/eternl-guard/tree/main/src/entries) -
-JSON Data Badge  - - - GitHub link - -
-
+ #### Cardano Scam Token Registry @@ -1855,19 +989,7 @@ Cardano Scam Token Registry is a list of scam tokens. To find the scam tokens, - [Cardano Scam Token Registry GitHub](https://github.com/BrockCruess/Cardano-Scam-Token-Registry) - [Cardano Scam Token Registry Blacklist](https://github.com/BrockCruess/Cardano-Scam-Token-Registry/blob/main/scam-token-list) -
-Python Programming Language Badge - - - GitHub link - -
-
+ diff --git a/pages/development/dev_teams.mdx b/pages/development/dev_teams.mdx index 5ed404bc..14f552a8 100644 --- a/pages/development/dev_teams.mdx +++ b/pages/development/dev_teams.mdx @@ -1,66 +1,63 @@ --- -seo_title: Software Development Firms +seo_title: Cardano Development Companies seo_description: Need a dev company to help build your Cardano project? These Pro teams build dApps, write smart contracts, manage projects, and provide code audits. toc: false --- -# Development Firms +# Development Companies Development companies build dApps, write smart contracts, manage projects, and may provide code audits. Reach out to them if you have an idea and need an experienced team to build it. -- [Mlabs](https://mlabs.city/) -- [Anastasia Labs](https://anastasialabs.com/) -- [Dquadrant](https://dquadrant.com/) -- [Five Binaries](https://fivebinaries.com/) -- [TxPipe](https://txpipe.io/) -- [Input Output Global](https://iohk.io/) -- [Strica](https://strica.io/) -- [Ikigai Tech](https://ikigaitech.org/) -- [Obsidian Systems](https://obsidian.systems/) -- [Platonic Systems](https://platonic.systems/) -- [Tweag](https://www.tweag.io/) -- [Kompact](https://kompact.io/) -- [Logical Mechanism](https://www.logicalmechanism.io/) -- [Saturn Labs](https://saturnlabs.org/) -- [Dynamic Strategies](https://dynamicstrategies.io/) -- [Galois](https://galois.com/) -- [Sundae Labs](https://sundae.fi/) -- [ADA Anvil](https://ada-anvil.io/) -- [Kora Labs](https://koralabs.io/) -- [Nucast Labs](https://www.nucastlabs.com/) -- [Awen Online](https://awen.online/) -- [Plank](https://www.joinplank.com/) -- [Bloxico](https://bloxico.com/) -- [Harmonic Labs](https://www.harmoniclabs.tech/) -- [DC Spark](https://www.dcspark.io/) -- [Well Typed](https://www.well-typed.com/) -- [Blink Labs](https://blinklabs.io/) -- [Inversion](https://inversion.dev/) -- [Vacuumlabs](https://vacuumlabs.com/) -- [Mutual Knowledge](https://mukn.com/) -- [Lambdac](https://lambdac.dev/) -- [Filabs](https://www.filabs.dev/) -- [Evolute Software](https://evolute.software/) -- [UpToDate Developers](https://uptodatedevelopers.com/) -- [Gen Lambda](https://www.genlambda.com/) +- [TxPipe](https://txpipe.io/) +- [Mlabs](https://mlabs.city/) +- [Anastasia Labs](https://anastasialabs.com/) +- [Dquadrant](https://dquadrant.com/) +- [Five Binaries](https://fivebinaries.com/) +- [Input Output Global](https://iohk.io/) +- [Strica](https://strica.io/) +- [Saib](https://saib.dev/) +- [Sidan](https://sidan.io/) +- [ZK Fold](https://zkfold.io/) +- [Blink Labs](https://blinklabs.io/) +- [Ikigai Tech](https://ikigaitech.org/) +- [Harmonic Labs](https://www.harmoniclabs.tech/) +- [DC Spark](https://www.dcspark.io/) +- [Well Typed](https://www.well-typed.com/) +- [Vacuumlabs](https://vacuumlabs.com/) +- [Sundae Labs](https://sundae.fi/) +- [ADA Anvil](https://ada-anvil.io/) +- [Protofire](https://protofire.io/) +- [Kora Labs](https://koralabs.io/) +- [Nucast Labs](https://www.nucastlabs.com/) +- [Obsidian Systems](https://obsidian.systems/) +- [Platonic Systems](https://platonic.systems/) +- [Tweag](https://www.tweag.io/) +- [Logical Mechanism](https://www.logicalmechanism.io/) +- [Dynamic Strategies](https://dynamicstrategies.io/) +- [Galois](https://galois.com/) +- [Awen Online](https://awen.online/) +- [Plank](https://www.joinplank.com/) +- [Bloxico](https://bloxico.com/) +- [Mutual Knowledge](https://mukn.com/) +- [Filabs](https://www.filabs.dev/) +- [Evolute Software](https://evolute.software/) +- [UpToDate Developers](https://uptodatedevelopers.com/) +- [Metalamp](https://metalamp.io/) +- [Thespian](https://thespian.eu/) +- [Zw3rk](https://zw3rk.com/) +- [Tastenkunst GmbH](http://www.tastenkunst.com/) +- [Studio Webux](https://webuxlab.com/) +- [Biglup Labs](https://biglup.io/) +- [Big Blymp](https://www.bigblymp.com/) +- [M2Tec](https://www.m2tec.nl/) +- [Saturn Labs](https://saturnlabs.org/) +- [Yaya Labs](https://www.yayalabs.io/) - [Trivolve Tech](https://trivolvetech.com/) -- [Metalamp](https://metalamp.io/) -- [Crystal Software](http://www.crystal.infinityfreeapp.com/?i=2) -- [Devteam](https://www.devteam.inc/) -- [Antier Solutions](https://www.antiersolutions.com/) -- [Thespian](https://thespian.eu/) -- [Saib](https://saib.dev/) -- [Sidan](https://sidan.io/) +- [Gen Lambda](https://www.genlambda.com/) - [We Deliver](https://we-deliver.io/) -- [Adaxon](https://adaxon.io/) -- [ZK Fold](https://zkfold.io/) -- [Zw3rk](https://zw3rk.com/) -- [45b](https://45b.io/) -- [Protofire](https://protofire.io/) -- [Tastenkunst GmbH](http://www.tastenkunst.com/) -- [Studio Webux](https://webuxlab.com/) -- [Biglup Labs](https://biglup.io/) -- [Big Blymp](https://www.bigblymp.com/) +- [Crystal Software](http://www.crystal.infinityfreeapp.com) - [Pendulumdev](https://pendulumdev.co.uk/) -- [Yaya Labs](https://www.yayalabs.io/) -- [M2Tec](https://www.m2tec.nl/) +- [Adaxon](https://adaxon.io/) +- [Antier Solutions](https://www.antiersolutions.com/) +- [Kompact](https://kompact.io/) +- [Inversion](https://inversion.dev/) diff --git a/pages/development/developer_chat.mdx b/pages/development/developer_chat.mdx index 7bfda734..3ce7b602 100644 --- a/pages/development/developer_chat.mdx +++ b/pages/development/developer_chat.mdx @@ -22,42 +22,42 @@ Forums to discuss Cardano development. Discord channels to chat about Cardano development. -- [Input Output Technical Discord](https://discord.com/invite/inputoutput) -- [TxPipe](https://discord.gg/sJ2D3g33Qp) -- [MeshJS](https://discord.gg/R9xFAD9MKG) -- [Blink Labs](https://discord.gg/jx9dxarjyv) -- [SpaceBudz](https://discord.gg/spacebudz) -- [Harmonic Labs](https://discord.gg/P6fbZSA85f) -- [Gimbalabs](https://discord.gg/6qZ7pTAnKB) -- [Pragma](https://discord.gg/M65GBpkGjK) -- [PyCardano](https://discord.gg/MazZyMPjC6) -- [Emurgo Academy Community](https://discord.gg/FdKrMsXuDe) -- [BuildingOnCardano.Dev](https://discord.gg/zgYYbTjfVx) -- [Plutonomicon](https://discord.gg/RrAg4ZEuNp) -- [Roasted Bean Alliance](https://discord.gg/7rWnEvgCg3) -- [Cardano Open Source](https://discord.gg/VvraErKX7p) -- [Lovelace Academy](https://discord.gg/wvjgN5wzMQ) -- [dcSpark](https://discord.gg/UX62bjCxVg) -- [Maestro](https://discord.gg/EWZ2CtFRPJ) -- [CardanoSharp](https://discord.gg/XtFg8v55T9) -- [Helios](https://discord.gg/qtN8AM3WNH) -- [Kuber](https://discord.gg/xDSmAX6MXC) -- [Scalus](https://discord.gg/TPwTDbNNce) -- [Orcfax](https://discord.gg/kePcGwK4Aw) -- [Charli3](https://discord.gg/ayhJQTSGzt) -- [Cardano BSD Alliance](https://discord.gg/Hm7gAJvenP) -- [Cardano Improvement Proposals](https://discord.gg/Upj2ryXf6e) -- [Cardano Community](https://discord.gg/v5AEnHJ6Nx): Dev-general channel -- [Saturn Swap](https://discord.gg/wu5fBxkJpG): Dev-chat channel -- [Wild Tangz](https://discord.com/invite/wildtangz): Coding channel +- [Input Output Technical Discord](https://discord.com/invite/inputoutput) +- [TxPipe](https://discord.gg/sJ2D3g33Qp) +- [MeshJS](https://discord.gg/R9xFAD9MKG) +- [Blink Labs](https://discord.gg/jx9dxarjyv) +- [SpaceBudz](https://discord.gg/spacebudz) +- [Harmonic Labs](https://discord.gg/P6fbZSA85f) +- [Gimbalabs](https://discord.gg/6qZ7pTAnKB) +- [Pragma](https://discord.gg/M65GBpkGjK) +- [PyCardano](https://discord.gg/MazZyMPjC6) +- [Emurgo Academy Community](https://discord.gg/FdKrMsXuDe) +- [BuildingOnCardano.Dev](https://discord.gg/zgYYbTjfVx) +- [Plutonomicon](https://discord.gg/RrAg4ZEuNp) +- [Roasted Bean Alliance](https://discord.gg/7rWnEvgCg3) +- [Cardano Open Source](https://discord.gg/VvraErKX7p) +- [Lovelace Academy](https://discord.gg/wvjgN5wzMQ) +- [dcSpark](https://discord.gg/UX62bjCxVg) +- [Maestro](https://discord.gg/EWZ2CtFRPJ) +- [CardanoSharp](https://discord.gg/XtFg8v55T9) +- [Helios](https://discord.gg/qtN8AM3WNH) +- [Kuber](https://discord.gg/xDSmAX6MXC) +- [Scalus](https://discord.gg/TPwTDbNNce) +- [Orcfax](https://discord.gg/kePcGwK4Aw) +- [Charli3](https://discord.gg/ayhJQTSGzt) +- [Cardano BSD Alliance](https://discord.gg/Hm7gAJvenP) +- [Cardano Improvement Proposals](https://discord.gg/Upj2ryXf6e) +- [Cardano Community](https://discord.gg/v5AEnHJ6Nx): Dev-general channel +- [Saturn Swap](https://discord.gg/wu5fBxkJpG): Dev-chat channel +- [Wild Tangz](https://discord.com/invite/wildtangz): Coding channel ## Telegram Channels Telegram channels for developer chat and announcements. -- [Cardano Announcements](https://t.me/CardanoAnnouncements): General Cardano updates. -- [IOG Dev Announcements](https://t.me/IOdevannouncements) -- [Cardano Developers Official](https://t.me/CardanoDevelopersOfficial) -- [Marlowe Official](https://t.me/IOHK_Marlowe) -- [Developer Ecosystem](https://t.me/DeveloperEcosystem) +- [Cardano Announcements](https://t.me/CardanoAnnouncements): General Cardano updates. +- [IOG Dev Announcements](https://t.me/IOdevannouncements) +- [Cardano Developers Official](https://t.me/CardanoDevelopersOfficial) +- [Marlowe Official](https://t.me/IOHK_Marlowe) +- [Developer Ecosystem](https://t.me/DeveloperEcosystem): Community dev channel. - [Desarrollo Cardano](https://t.me/DesarrolloCardano): Spanish speaking group managed by several Cardano ambassadors. diff --git a/pages/development/developer_tool_explorers.mdx b/pages/development/developer_tool_explorers.mdx deleted file mode 100644 index fbf56c9b..00000000 --- a/pages/development/developer_tool_explorers.mdx +++ /dev/null @@ -1,18 +0,0 @@ ---- -seo_title: Developer Tool Explorers -seo_description: -toc: false ---- - -# Developer Tool Explorers - -This content is being peer reviewed & formally verified. Check back soon! - -In the meantime, explore other Cardano collections: - -- [YouTube Channels](https://www.adastack.io/community/youtube) -- [Development Firms](https://www.adastack.io/development/dev_teams) -- [Newsletters](https://www.adastack.io/community/newsletters) -- [News and Blogs](https://www.adastack.io/community/news_and_blogs) - -[Back to Full Library →](https://www.adastack.io/all_pages) diff --git a/pages/development/learning_platforms.mdx b/pages/development/learning_platforms.mdx index a55e040b..97c3f3b6 100644 --- a/pages/development/learning_platforms.mdx +++ b/pages/development/learning_platforms.mdx @@ -8,15 +8,14 @@ toc: false Platforms to learn Cardano development. -- [Cardano Foundation Academy](https://education.cardanofoundation.org/): Free academy with Cardano blockchain courses. -- [Gimbalabs](https://plutuspbl.io): Free courses on Plutus, Aiken, and more. Catch [live coding sessions](https://www.youtube.com/@gimbalabs/streams). -- [Emurgo Academy](https://education.emurgo.io/): Paid courses on Aiken and Cardano. -- [Work Courses](https://work.courses/): Course platform. +- [Cardano Foundation Academy](https://education.cardanofoundation.org/): Free Cardano academy. +- [Gimbalabs](https://plutuspbl.io): Free courses and [live coding sessions](https://www.youtube.com/@gimbalabs/streams). +- [Emurgo Academy](https://education.emurgo.io/): Paid courses. +- [Work Courses](https://work.courses/): Course platform. - [Olympus Insights](https://olympusinsights.io/): Course platform. -- [Andamio](https://www.andamio.io/courses): Course platform. -- [Mesh JS Guides](https://meshjs.dev/guides): Written guides to set up a dApp. -- [Plutus Pioneers](https://github.com/input-output-hk/plutus-pioneer-program): Free IOG course to write smart contracts in Plutus. -- [Learn Cardano](https://learncardano.io/courses/): Video courses including development. -- [Danolearn](https://danolearn.com/course/): Written and video tutorials on Cardano, Aiken, and more. -- [Lovelace Academy](https://learn.lovelace.academy): Written guides for Cardano programmers. -- [YouTube Channels for Developers](https://www.adastack.io/community/youtube#development): Explore YouTube channels. +- [Andamio](https://www.andamio.io/courses): Course platform. +- [Mesh JS Guides](https://meshjs.dev/guides): Written guides to set up a dApp. +- [Danolearn](https://danolearn.com/course/): Written tutorials and videos. +- [Plutus Pioneers](https://github.com/input-output-hk/plutus-pioneer-program): Free IOG course for smart contracts in Plutus. +- [Lovelace Academy](https://learn.lovelace.academy): Written guides for Cardano programmers. +- [Adastack](https://www.adastack.io/community/youtube#development): Dev YouTube channels. diff --git a/pages/development/open_source_builders.mdx b/pages/development/open_source_builders.mdx index a9092c61..c08cb30b 100644 --- a/pages/development/open_source_builders.mdx +++ b/pages/development/open_source_builders.mdx @@ -11,19 +11,23 @@ import { openSourceBuildersData } from "../api/open_source_builders"; export const getStaticProps = async () => { try { const allRepos = await openSourceBuildersAPI(openSourceBuildersData); - const sortedOSBuilderData = allRepos.sort((a, b) => b.stars - a.stars); + const sortedOSBuilderData = allRepos.sort((a, b) => { + const dateA = new Date(a.mostRecentRepo?.pushedAt || 0).getTime(); + const dateB = new Date(b.mostRecentRepo?.pushedAt || 0).getTime(); + return dateB - dateA; + }); return { props: { sortedOSBuilderData }, revalidate: 600, }; - -} catch (error) { -return { -props: { sortedOSBuilderData: [] }, -notFound: true, -}; -} + } catch (error) { + console.error('Failed to fetch open source builders data:', error); + return { + props: { sortedOSBuilderData: [] }, + notFound: true, + }; + } }; export default function OpenSourceBuilders({ sortedOSBuilderData }) { diff --git a/pages/ecosystem/_meta.json b/pages/ecosystem/_meta.json index 14922fdc..fa6447c5 100644 --- a/pages/ecosystem/_meta.json +++ b/pages/ecosystem/_meta.json @@ -39,8 +39,8 @@ "pagination": false } }, - "cardano_markets": { - "title": "Cardano Markets ", + "price_and_charts": { + "title": "Price & Charts ", "theme": { "breadcrumb": true, "sidebar": true, diff --git a/pages/ecosystem/blockchain_explorers.mdx b/pages/ecosystem/blockchain_explorers.mdx index 92eab39f..213e0ce2 100644 --- a/pages/ecosystem/blockchain_explorers.mdx +++ b/pages/ecosystem/blockchain_explorers.mdx @@ -8,28 +8,26 @@ toc: false Blockchain Explorers allow you to see everything happening on the blockchain. You can search specific transactions, blocks, addresses, stake pools, and more. -- [Cexplorer](https://cexplorer.io/): Explorer with simple-to-use features. +- [Cexplorer](https://cexplorer.io/): Explorer with simple-to-use features. -- [CardanoScan](https://cardanoscan.io/): Fully-featured Cardano explorer. +- [CardanoScan](https://cardanoscan.io/): Fully-featured Cardano explorer. - [Eutxo.org](https://eutxo.org/): Cardano visualizer and search tool to see live blocks. -- [Pool.pm](https://pool.pm/): Visual blockchain explorer to search pools, wallets, NFTs, and more. +- [Pool.pm](https://pool.pm/): Visual blockchain explorer to search pools, wallets, NFTs, and more. -- [Alethea](https://alethea.io/): Explore on-chain activity and track your portfolio. +- [Alethea](https://alethea.io/): Explore on-chain activity and track your portfolio. -- [CF Explorer](https://beta.explorer.cardano.org/en/): Created by the [Cardano Foundation](https://cardanofoundation.org/) for enterprise users. +- [CF Explorer](https://beta.explorer.cardano.org/en/): Block explorer created by the Cardano Foundation. -- [AdaStat](https://adastat.net/): Full features including options to change language and currency. +- [AdaStat](https://adastat.net/): Full features including options to change language and currency. -- [AdaPools](https://adapools.org/): Lightweight version of [Cexplorer](https://cexplorer.io/). - -- [Script Explorer](https://www.script-explorer.com/): Explore visual representations of simple or complex transactions. +- [Script Explorer](https://www.script-explorer.com/): Explore visual representations of simple or complex transactions. - [CardexScan](https://cardexscan.com/): Real-time view of all trades happening on the Cardano blockchain. - [Raw Cardano](https://rawcardano.app/): Made for developers because it returns results in JSON, which is useful in programming. -- [Blockchair](https://blockchair.com/cardano): Universal blockchain search engine that works with many blockchains. +- [Blockchair](https://blockchair.com/cardano): Universal blockchain search engine that works with many blockchains. -- [3xpl](https://3xpl.com/cardano): Multi-blockchain explorer that supports Cardano. +- [3xpl](https://3xpl.com/cardano): Multi-blockchain explorer that supports Cardano. diff --git a/pages/ecosystem/cardano_markets.mdx b/pages/ecosystem/cardano_markets.mdx deleted file mode 100644 index 70b2da9a..00000000 --- a/pages/ecosystem/cardano_markets.mdx +++ /dev/null @@ -1,18 +0,0 @@ ---- -seo_title: Cardano Markets -seo_description: -toc: false ---- - -# Cardano Markets - -This content is being peer reviewed & formally verified. Check back soon! - -In the meantime, explore other Cardano collections: - -- [YouTube Channels](https://www.adastack.io/community/youtube) -- [Development Firms](https://www.adastack.io/development/dev_teams) -- [Newsletters](https://www.adastack.io/community/newsletters) -- [News and Blogs](https://www.adastack.io/community/news_and_blogs) - -[Back to Full Library →](https://www.adastack.io/all_pages) diff --git a/pages/ecosystem/ecosystem_maps.mdx b/pages/ecosystem/ecosystem_maps.mdx index 7b5311e5..a3188c6e 100644 --- a/pages/ecosystem/ecosystem_maps.mdx +++ b/pages/ecosystem/ecosystem_maps.mdx @@ -12,8 +12,8 @@ Ecosystem maps display dApps and projects building on Cardano. Explore wallets, - [Built on Cardano](https://builtoncardano.com/): Organized map of Cardano projects. -- [CardanoSpot Project Library](https://cardanospot.io/project-library/all): Library of dApps building on Cardano. +- [CardanoSpot Project Library](https://cardanospot.io/project-library/all): Library of dApps building on Cardano. -- [Cardano.org Showcase](https://developers.cardano.org/showcase/): An [open-source](https://github.com/cardano-foundation/developer-portal/blob/staging/src/data/showcases.js) collection of projects building on Cardano. +- [Cardano.org Showcase](https://developers.cardano.org/showcase/): Collection of projects building on Cardano. -- [Dapps on Cardano](https://dappsoncardano.com/): Ranking stats for dApps on Cardano, and links to their open-source code and code audits. +- [Dapps on Cardano](https://dappsoncardano.com/): Ranking stats for dApps on Cardano, and links to their open-source code and code audits. diff --git a/pages/daos/multisig.mdx b/pages/ecosystem/price_and_charts.mdx similarity index 91% rename from pages/daos/multisig.mdx rename to pages/ecosystem/price_and_charts.mdx index 7c8c0c72..9de7236f 100644 --- a/pages/daos/multisig.mdx +++ b/pages/ecosystem/price_and_charts.mdx @@ -1,10 +1,10 @@ --- -seo_title: Multisig +seo_title: Price and Charts seo_description: toc: false --- -# Multisig +# Price and Charts This content is being peer reviewed & formally verified. Check back soon! diff --git a/pages/ecosystem/tokens.mdx b/pages/ecosystem/tokens.mdx deleted file mode 100644 index ceb36dbd..00000000 --- a/pages/ecosystem/tokens.mdx +++ /dev/null @@ -1,17 +0,0 @@ ---- -seo_title: Cardano Tokens -seo_description: ---- - -# Cardano Tokens - -This content is being peer reviewed & formally verified. Check back soon! - -In the meantime, explore other Cardano collections: - -- [YouTube Channels](https://www.adastack.io/community/youtube) -- [Development Firms](https://www.adastack.io/development/dev_teams) -- [Newsletters](https://www.adastack.io/community/newsletters) -- [News and Blogs](https://www.adastack.io/community/news_and_blogs) - -[Back to Full Library →](https://www.adastack.io/all_pages) diff --git a/pages/governance/_meta.json b/pages/governance/_meta.json index 172eee2d..ff8036e4 100644 --- a/pages/governance/_meta.json +++ b/pages/governance/_meta.json @@ -10,7 +10,7 @@ } }, "voting_and_dreps": { - "title": "Voting and DReps ", + "title": "Voting & DReps ", "theme": { "breadcrumb": true, "sidebar": true, diff --git a/pages/governance/what_is_governance.mdx b/pages/governance/what_is_governance.mdx index 820c710d..4299a355 100644 --- a/pages/governance/what_is_governance.mdx +++ b/pages/governance/what_is_governance.mdx @@ -11,6 +11,3 @@ Cardano has a system of democratic governance in which ADA holders can propose o Governance also gives the Cardano community control over the Cardano treasury. Voters and decide how to allocate the budget. The treasury is consistently growing because it receives a small portion of every transaction fee. Governance is a key element in the long-term strategy of Cardano because it means that the blockchain can be self-sustaining and and sets a path for continued innovation and community participation. - -Governance is [in the process of being implemented](https://roadmap.cardano.org/en/voltaire/) and should be fully available soon. -Read more about the plan for [Cardano governance here](https://www.1694.io/). diff --git a/pages/intro_to_cardano/learn_more.mdx b/pages/intro_to_cardano/learn_more.mdx index 40287a22..3ec2f32b 100644 --- a/pages/intro_to_cardano/learn_more.mdx +++ b/pages/intro_to_cardano/learn_more.mdx @@ -12,18 +12,18 @@ Resources to learn more about the Cardano network and ecosystem. Get official information about Cardano, the roadmap, and the research behind the project. -- [Cardano.org](https://cardano.org/): Official Cardano website. +- [Cardano.org](https://cardano.org/): Official Cardano website. +- [Intersect](https://www.intersectmbo.org/): Organization coordinating Cardano's roadmap and development. +- [Input Output Global (IOG)](https://iohk.io/): Cardano's primary development company and research organization. +- [The Cardano Foundation](https://cardanofoundation.org/): Non-profit organization focused on development and adoption. - [Cardano Roadmap](https://roadmap.cardano.org/en/): 5-phase roadmap for Cardano's development. -- [Research Library](https://iohk.io/en/research/library/): 200+ research papers behind the Cardano blockchain. Explore the [top papers by era](https://cardano.org/research). -- [Intersect](https://www.intersectmbo.org/): Organization coordinating Cardano's roadmap and development. -- [Input Output Global (IOG)](https://iohk.io/): Cardano's primary development company and research organization. -- [The Cardano Foundation](https://cardanofoundation.org/): Non-profit organization focused on development and adoption. +- [Research Library](https://iohk.io/en/research/library/): 200+ research papers behind the Cardano blockchain. See [top papers by era](https://cardano.org/research). ### Cardano Books Books about the Cardano network. -- [Cardano For the M₳sses: A Financial Operating System for People who don’t have one](https://www.amazon.com/dp/B0B912X5G6) +- [Cardano For the M₳sses: A Financial Operating System for People who don’t have one](https://www.amazon.com/dp/B0B912X5G6) - [Cardano: The Essential Guide](https://www.amazon.com/dp/B0B1DSTS3X) - [Cardano 101: Understanding Cardano and its Financial Opportunities](https://www.amazon.com/dp/B0C524H491) - [Ultimate Cardano Smart Contracts: Unlock the Full Potential of the Cardano Blockchain by Developing Real-World Web 3.0 Projects](https://www.amazon.com/Ultimate-Cardano-Smart-Contracts-Development/dp/8197396531/) @@ -32,29 +32,31 @@ Books about the Cardano network. Full courses to learn about Cardano. -- [Blockchain Education Program by Cardano Foundation](https://academy.cardanofoundation.org/): An official Cardano course. +- [Blockchain Education Program by Cardano Foundation](https://academy.cardanofoundation.org/): An official Cardano course. - [Kaizen Crypto Cardano 101 Course](https://www.youtube.com/playlist?list=PLrbMFdXZnzoAwfxIVo-SQ_qEBCqbwuU6o): A full introduction series. -### Intro Videos +### Cardano Videos Videos that explain the Cardano blockchain and what is being built on it. - [Charles Hoskinson Whiteboard](https://www.youtube.com/watch?v=Ja9D0kpksxw): IOG Founder Charles Hoskinson explains Cardano in this classic video. - [How do you Explain the Mission of Cardano](https://www.youtube.com/watch?v=l_Nv0-PVrnM): Understand the positive impact mission of Cardano. +- [Blockchain & Argentina: Past & present](https://www.youtube.com/watch?v=SkixwjCzQ9c): High level speech about Cardano and its potential going forward. - [Discover Cardano](https://www.youtube.com/watch?v=CYzcvZ2Hf7w): A brief overview of how Cardano empowers individuals in the digital era, created by Stake with Robot. ### Guides and Reports These guides discuss the Cardano network, its ecosystem, and provide links to various useful resources. -- [The Essential Cardano Guide to the Ecosystem](https://services.iohk.io/hubfs/EssentialCardano/PDF/Essential%20Cardano%20Guide%20to%20the%20Ecosystem.pdf?hsLang=en): Guide from the Cardano Foundation about Cardano's ecosystem and initiatives. +- [The Essential Cardano Guide to the Ecosystem](https://services.iohk.io/hubfs/EssentialCardano/PDF/Essential%20Cardano%20Guide%20to%20the%20Ecosystem.pdf?hsLang=en): High-level view of Cardano's ecosystem and initiatives. +- [Messari Cardano](https://messari.io/project/cardano/research): Reports about Cardano from research firm Messari. - [Reddit Guide to Getting Started with Cardano](https://www.reddit.com/r/cardano/comments/lnj5ne/getting_started_guide_a_newbies_guide_to_cardano/): The Cardano subreddit's guide to getting started on Cardano. ### Security Guides Guides with actionable advice to protect crypto accounts and wallets. -- [Digital Defense Open-Source Checklist](https://digital-defense.io/): A thorough open-source collection of items about how to secure your devices, stay safe online, and protect your digital assets. You don't have to do everything here, working on the "essential" items will put your security ahead of most. +- [Digital Defense Open-Source Checklist](https://digital-defense.io/): A thorough open-source collection of items about how to secure your devices, stay safe online, and protect your digital assets. You don't have to do everything here, working on the "essential" items will put your security ahead of most. - [Cardano Ninja](https://cardano.ninja/): Important notices for things to watch out for and how to operate safely. -- [How Secure Your Crypto Life, Avoid Scams & Protect Your Crypto Assets by Learn Cardano](https://www.youtube.com/watch?v=W2YeB5clm0k): Video from Learn Cardano explaining how to store your crypto, avoid scams, and use strong authentication. - [Getting Started: Basic Personal Cybersecurity for Everyone (3 Easy Tips)](https://avoidthehack.com/getting-started-cybersecurity): Overview of the most important considerations when staying safe online. +- [How Secure Your Crypto Life, Avoid Scams & Protect Your Crypto Assets by Learn Cardano](https://www.youtube.com/watch?v=W2YeB5clm0k): Video from Learn Cardano explaining how to store your crypto, avoid scams, and use strong authentication. diff --git a/pages/intro_to_cardano/start_using_cardano.mdx b/pages/intro_to_cardano/start_using_cardano.mdx index 73c77d91..f48b68cf 100644 --- a/pages/intro_to_cardano/start_using_cardano.mdx +++ b/pages/intro_to_cardano/start_using_cardano.mdx @@ -14,25 +14,34 @@ Here is a step-by-step guide: ### Make a Wallet -A wallet allows you to store, manage, and transact with digital assets. We will set this up first so it is ready to receive the ADA once you've purchased it on an exchange. +A digital wallet acts as your personal vault for storing and sending ADA. Creating your wallet first ensures it's ready to receive ADA after your exchange purchase. #### Choose a Wallet The first step is to choose a wallet. -**For desktop:** [Nami](https://www.namiwallet.io/) and [Lace](https://www.lace.io/) are simplified desktop wallets that are perfect for first-time users. [Typhon](https://typhonwallet.io/#/) and [Eternl](https://eternl.io/) are more advanced desktop wallets that offer a number of interesting features. +**Browser Wallets:** -**For mobile:** [Vespr](https://vespr.xyz/), [Begin](https://begin.is/), and [Flint](https://flint-wallet.com/) are some go-to options that are largely adopted by the community. +- [Lace](https://www.lace.io/) and [Nami](https://www.namiwallet.io/) are simplified desktop wallets that are perfect for first-time users. +- [Yoroi](https://yoroi-wallet.com/), [Typhon](https://typhonwallet.io/), and [Eternl](https://eternl.io/) are more advanced browser wallets that offer a number of interesting features. -**For security:** -To hold ADA most securely, it is recommended to use a [hardware wallet](https://builtoncardano.com/ecosystem/hardware-wallet). These physical devices require a pin code on the device to authorize any transaction. They can be used with most Cardano wallets. Well-known options include [Trezor](https://trezor.io/) and [Tangem](https://tangem.com/). +**Mobile Wallets:** -The resources below give further advice for choosing and securing a wallet. Don't worry too much about choosing the perfect wallet because you can switch later, or even use different wallets to manage a single account's assets. +- [Vespr](https://vespr.xyz/), [Begin](https://begin.is/), and [Tokeo](https://tokeopay.io/) are some go-to options that are largely adopted by the community. -- [A Guide on Cardano Wallets](https://medium.com/blockchain-biz/a-guide-on-cardano-wallets-e623bc1175aa): A guide with advice for choosing a Cardano wallet. -- [How to Choose a Web3 Wallet by Essential Cardano](https://www.essentialcardano.io/article/how-to-choose-a-web3-wallet): A guide with considerations for understanding different types of wallets. -- [Top 5 Cardano wallets](https://cardanospot.io/news/how-to-store-your-cardano-ada-5-cardano-wallets-to-check-out-0): 5 popular and well-regarded Cardano wallets. -- [A list of well-known Cardano wallets](https://cardanowallets.io/): Wallet list that also includes some useful security tips. +**Hardware Wallets:** + +The most secure way to hold ADA is a [hardware wallet](https://builtoncardano.com/ecosystem/hardware-wallet), a physical device that require confirmations to authorize transactions. + +- Well-known options include [Trezor](https://trezor.io/) and [Keystone](https://keyst.one/). + +**More Options:** + +The resources below give further advice for choosing a wallet. Don't worry too much about choosing the perfect wallet because you can switch easily import an existing wallet into a new wallet. + +- [Cardano Community Wallet List](https://cardano-community.github.io/support-faq/Wallets/list/): Community wallet list. +- [How to Choose a Web3 Wallet](https://www.essentialcardano.io/article/how-to-choose-a-web3-wallet): Understand types of wallets. +- [Cardanowallets.io](https://cardanowallets.io/): Wallet list and security tips. #### Set up the Wallet diff --git a/pages/nfts/_meta.json b/pages/nfts/_meta.json index 984fe9d3..795a42fa 100644 --- a/pages/nfts/_meta.json +++ b/pages/nfts/_meta.json @@ -40,7 +40,7 @@ } }, "domains_and_handles": { - "title": "Domains and Handles ", + "title": "Domains & Handles ", "theme": { "breadcrumb": true, "sidebar": true, @@ -70,7 +70,7 @@ } }, "nft_lending_and_borrowing": { - "title": "NFT Lending and Borrowing ", + "title": "NFT Lending & Borrowing ", "theme": { "breadcrumb": true, "sidebar": true, diff --git a/pages/on_chain_metrics/_meta.json b/pages/on_chain_metrics/_meta.json index 5e15c939..055a5791 100644 --- a/pages/on_chain_metrics/_meta.json +++ b/pages/on_chain_metrics/_meta.json @@ -29,18 +29,8 @@ "pagination": false } }, - "tokenomics_and_distribution": { - "title": "Tokenomics and Distribution ", - "theme": { - "breadcrumb": true, - "sidebar": true, - "toc": true, - "footer": true, - "pagination": false - } - }, - "monetary_policy": { - "title": "Monetary Policy ", + "staking_metrics": { + "title": "Staking ", "theme": { "breadcrumb": true, "sidebar": true, @@ -49,8 +39,8 @@ "pagination": false } }, - "circulating_supply": { - "title": "Circulating Supply ", + "tokenomics_and_distribution": { + "title": "Tokenomics & Distribution ", "theme": { "breadcrumb": true, "sidebar": true, @@ -59,8 +49,8 @@ "pagination": false } }, - "treasury": { - "title": "Treasury ", + "monetary_policy": { + "title": "Monetary Policy ", "theme": { "breadcrumb": true, "sidebar": true, @@ -69,8 +59,8 @@ "pagination": false } }, - "total_value_locked": { - "title": "Total Value Locked ", + "circulating_supply": { + "title": "Circulating Supply ", "theme": { "breadcrumb": true, "sidebar": true, @@ -79,8 +69,8 @@ "pagination": false } }, - "staking_metrics": { - "title": "Staking Metrics ", + "treasury": { + "title": "Treasury ", "theme": { "breadcrumb": true, "sidebar": true, @@ -89,8 +79,8 @@ "pagination": false } }, - "other_metrics": { - "title": "Other Metrics ", + "other_on_chain_metrics": { + "title": "Other On-Chain Metrics ", "theme": { "breadcrumb": true, "sidebar": true, diff --git a/pages/on_chain_metrics/decentralization_metrics.mdx b/pages/on_chain_metrics/decentralization_metrics.mdx index c04ac240..837ac017 100644 --- a/pages/on_chain_metrics/decentralization_metrics.mdx +++ b/pages/on_chain_metrics/decentralization_metrics.mdx @@ -1,6 +1,6 @@ --- seo_title: Decentralization Metrics -seo_description: Cardano's decentralization metrics for network security. Explore key metrics like MAV, nakamoto coefficient, ISPs, and geographic distribution of nodes. +seo_description: Discover Cardano's robust decentralization and network security through key metrics like node distribution, Nakamoto coefficient (MAV), and ledger size. toc: false --- @@ -8,26 +8,33 @@ toc: false Blockchains rely on decentralization to maintain long-term resilience and security. By distributing block-production and block records across a wide network of nodes, decentralization prevents single points of failure that can compromise the system. -## Decentralization Index +## Decentralization Indexes -Comparison of Cardano's decentralization with other blockchains. +Compare Cardano's decentralization with other blockchains. -- [Edinburgh Decentralization Index](http://blockchainlab.inf.ed.ac.uk/edi-dashboard/) +- [Edinburgh Decentralization Index](http://blockchainlab.inf.ed.ac.uk/edi-dashboard/): University of Edinburgh initiative to objectively measure the decentralization of major cryptocurrencies across various layers. ## Minimum Attack Vector (MAV) -MAV examines how many stake pools would need to be compromised for an attacker to gain a majority of the block production of the network (51% attack). This metric is also known as Nakamoto Coefficient. +MAV measures how many stake pools would need to be compromised for an attacker to gain a majority of the network's block production (51% attack). This metric is also known as Nakamoto Coefficient. -- [Cexplorer Groups](https://cexplorer.io/groups): MAV by stake pool -- [Balance Analytics Cardano Donut Chart](https://www.balanceanalytics.io/chartboards/donut_shop): MAV donut graphs -- [Balance Analytics Cardano Decentralization Metrics](https://www.balanceanalytics.io/chartboards/decentralization): MAV graphs +- [Cexplorer Groups](https://cexplorer.io/groups): MAV by stake pool +- [Balance Analytics Cardano Donut Chart](https://www.balanceanalytics.io/chartboards/donut_shop): MAV donut graphs +- [Balance Analytics Cardano Decentralization Metrics](https://www.balanceanalytics.io/chartboards/decentralization): MAV graphs ## Geographic Node Distribution -Geographic node distribution refers to the global placement of nodes. High distribution improves resiliancy because some nodes are likely to remain operating at any time. +Geographic node distribution refers to the global spread of blockchain nodes, enhancing network resilience by reducing single points of failure. -- [Cexplorer.io Relays](https://cexplorer.io/relays): Country and ISP distribution -- [Pooltool Network Health](https://pooltool.io/networkhealth): Data center distribution +- [Cexplorer.io Relays](https://cexplorer.io/relays): Country and ISP distribution +- [Pooltool Network Health](https://pooltool.io/networkhealth): Data center distribution - [Cardano Blockchain Insights](https://lookerstudio.google.com/s/m24jHTNX1DM): Geographic and ISP distribution - [MonadPool](https://monadpool.com/cardano.html): Relay Map -- [Relay Geolocation](https://relaygeolocatio.netlify.app/): Geolocation Map for Cardano Relays \ No newline at end of file +- [Relay Geolocation](https://relaygeolocatio.netlify.app/): Geolocation Map for Cardano Relays + +## Full Node Size + +The size of a Cardano full node indicates the amount of storage needed to maintain the complete blockchain record. + +- [Cexplorer Storage](https://cexplorer.io/storage) +- [Cardano Blockchain Insights](https://lookerstudio.google.com/s/rkbL4boJKeY) diff --git a/pages/on_chain_metrics/network_activity.mdx b/pages/on_chain_metrics/network_activity.mdx index 03b63eba..d74fe1ab 100644 --- a/pages/on_chain_metrics/network_activity.mdx +++ b/pages/on_chain_metrics/network_activity.mdx @@ -1,38 +1,63 @@ --- -seo_title: Network Activity -seo_description: View transaction activity on Cardano network. See transaction volume, addresses, fees, and block space. Explore real-time metrics and long-term trends. +seo_title: Network Activity Metrics +seo_description: View transaction activity on Cardano network. See transaction volume, addresses, TVL, and block space. Explore real-time metrics and long-term trends. toc: false --- -# Network Activity +# Network Activity Metrics -Network activity metrics give insight into Cardano's usage and network health. See transaction volumes, address growth, and block space. +Network activity metrics give insight into Cardano's usage and network health. See transaction volumes, address growth, TVL, block space usage, and more. -## Transactions +## Transaction Metrics -Transaction metrics including transaction volume, value, and fees. +Transaction metrics including transaction volume, value, and fees. - [Taptools Market Overview](https://www.taptools.io/market-overview): Trading volume by dApp -- [Danogo Active Wallets](https://danogo.io/active-wallet-report): Transaction activity and types of transactions +- [Danogo Active Wallets](https://danogo.io/active-wallet-report): Transaction activity and types of transactions - [Cardano Blockchain Insights](https://lookerstudio.google.com/s/r-x_IbY41mY): Transactions per day - [Cardano Blockchain Insights](https://lookerstudio.google.com/s/i1ovIilH5gY): Transactions per epoch 1 - [Cardano Blockchain Insights](https://lookerstudio.google.com/s/pw0_jGTWlcs): Transactions per epoch 2 - [Cardano Blockchain Insights](https://lookerstudio.google.com/s/l-enmJx8O8c): Transactions per epoch 3 -- [DefiLlama](https://defillama.com/chain/Cardano?currency=USD&volume=true&tvl=false): Transaction volume -- [Messari](https://messari.io/project/cardano/charts/network-activity/transactions): Transaction volume, transaction count, value of transactions +- [DefiLlama](https://defillama.com/chain/Cardano?currency=USD&volume=true&tvl=false): Transaction volume +- [Messari](https://messari.io/project/cardano/charts/network-activity/transactions): Transaction volume, transaction count, value of transactions ## Addresses and Account Activity -Address metrics look at Cardano address growth and activity. +Address metrics look at Cardano address growth and activity. - [Adastats.info](https://adastats.info/addresses): Total addresses, and growth in number of addresses over time -- [Cexplorer Wallets](https://cexplorer.io/wallets): Active addresses -- [DefiLlama Addresses](https://defillama.com/chain/Cardano?addresses=true&tvl=false): Active addresses +- [Cexplorer Wallets](https://cexplorer.io/wallets): Active addresses +- [DefiLlama Addresses](https://defillama.com/chain/Cardano?addresses=true&tvl=false): Active addresses + +## Trading Metrics + +Trading Metrics track trading volumes, price, and liquidity of tokens on Cardano's decentralized exchanges. + +- [DexScreener](https://dexscreener.com/cardano) +- [Coingecko Cardano Ecosystem](https://www.coingecko.com/en/categories/cardano-ecosystem) +- [CoinMarketCap Cardano Ecosystem](https://coinmarketcap.com/view/cardano-ecosystem/) +- [CardexScan](https://cardexscan.com/global-trades) + +## Total Value Locked + +Total Value Locked (TVL) quantifies the total assets deposited in Cardano DeFi protocols. + +- [Cexplorer TVL](https://cexplorer.io/defi/tvl): Total TVL chart +- [DefiLlama TVL](https://defillama.com/chain/Cardano?currency=USD&tvl=tvl): Total TVL +- [Cardano Blockchain Insights](https://lookerstudio.google.com/s/kpmEIAO1Qiw): Value locked per day + +## Dapp TVL Metrics + +Dapp TVL Metrics show information about the assets locked in decentralized applications on Cardano. + +- [Danogo](https://danogo.io/tvl-report): TVL by dApp +- [Cardano Blockchain Insights](https://lookerstudio.google.com/s/kpmEIAO1Qiw): TVL by dApp +- [Taptools Market Overview](https://www.taptools.io/market-overview): TVL by dApp ## Block Space Usage -Block space metrics show how full blocks are on the Cardano network. +Block space metrics show how full blocks are on the Cardano network. -- [Cardano Blockchain Insights](https://lookerstudio.google.com/s/sVOfkq0gl1o): Average blockchain load per day -- [Cexplorer Usage](https://cexplorer.io/usage): Block saturation over time -- [Messari](https://messari.io/project/cardano/charts/network-activity/blocks): Average block size \ No newline at end of file +- [Cardano Blockchain Insights](https://lookerstudio.google.com/s/sVOfkq0gl1o): Average blockchain load per day +- [Cexplorer Usage](https://cexplorer.io/usage): Block saturation over time +- [Messari](https://messari.io/project/cardano/charts/network-activity/blocks): Average block size diff --git a/pages/on_chain_metrics/on_chain_dashboards.mdx b/pages/on_chain_metrics/on_chain_dashboards.mdx index a5ae2f60..6430a0f7 100644 --- a/pages/on_chain_metrics/on_chain_dashboards.mdx +++ b/pages/on_chain_metrics/on_chain_dashboards.mdx @@ -9,10 +9,10 @@ toc: false On-chain dashboards show information about the state of the Cardano network. This can include network activity, decentralization metrics, ADA price, and more. - [Cardano Blockchain Insights](https://lookerstudio.google.com/s/huXqeQmi9qA): Stake pools, smart contracts, distribution, and treasury. -- [Edinburgh Decentralization Index](http://blockchainlab.inf.ed.ac.uk/edi-dashboard/): Compares decentralization across many blockchains. -- [Pooltool Network Health](https://pooltool.io/networkhealth): Block production, stake pool, and decentralization metrics. -- [Balance Analytics](https://www.balanceanalytics.io/): Decentralization, MAV, and UTXO allocation. -- [DefiLlama Cardano Dashboard](https://defillama.com/chain/Cardano): Price, development, and activity metrics. -- [Cexplorer Insights](https://cexplorer.io/insights): Scripts, transactions, minted assets. +- [Edinburgh Decentralization Index](http://blockchainlab.inf.ed.ac.uk/edi-dashboard/): Compares decentralization across many blockchains. +- [Pooltool Network Health](https://pooltool.io/networkhealth): Block production, stake pool, and decentralization metrics. +- [Balance Analytics](https://www.balanceanalytics.io/): Decentralization, MAV, and UTXO allocation. +- [DefiLlama Cardano Dashboard](https://defillama.com/chain/Cardano): Price, development, and activity metrics. +- [Cexplorer Insights](https://cexplorer.io/insights): Scripts, transactions, minted assets. +- [Dapps on Cardano Network Stats](https://dappsoncardano.com/analytics/globalstats): Accounts, fees, and transactions. - [Adastats Dashboard](https://adastats.info/dashboard): State of the network and price. -- [Dapps on Cardano Network Stats](https://dappsoncardano.com/analytics/globalstats): Accounts, fees, and transactions. diff --git a/pages/on_chain_metrics/other_metrics.mdx b/pages/on_chain_metrics/other_metrics.mdx deleted file mode 100644 index 64f32323..00000000 --- a/pages/on_chain_metrics/other_metrics.mdx +++ /dev/null @@ -1,18 +0,0 @@ ---- -seo_title: Other Metrics -seo_description: -toc: false ---- - -# Other Metrics - -This content is being peer reviewed & formally verified. Check back soon! - -In the meantime, explore other Cardano collections: - -- [YouTube Channels](https://www.adastack.io/community/youtube) -- [Development Firms](https://www.adastack.io/development/dev_teams) -- [Newsletters](https://www.adastack.io/community/newsletters) -- [News and Blogs](https://www.adastack.io/community/news_and_blogs) - -[Back to Full Library →](https://www.adastack.io/all_pages) diff --git a/pages/on_chain_metrics/other_on_chain_metrics.mdx b/pages/on_chain_metrics/other_on_chain_metrics.mdx new file mode 100644 index 00000000..69d477c8 --- /dev/null +++ b/pages/on_chain_metrics/other_on_chain_metrics.mdx @@ -0,0 +1,18 @@ +--- +seo_title: Other On-Chain Metrics +seo_description: +toc: false +--- + +# Other On-Chain Metrics + +This content is being peer reviewed & formally verified. Check back soon! + +In the meantime, explore other Cardano collections: + +- [YouTube Channels](https://www.adastack.io/community/youtube) +- [Development Firms](https://www.adastack.io/development/dev_teams) +- [Newsletters](https://www.adastack.io/community/newsletters) +- [News and Blogs](https://www.adastack.io/community/news_and_blogs) + +[Back to Full Library →](https://www.adastack.io/all_pages) diff --git a/pages/on_chain_metrics/total_value_locked.mdx b/pages/on_chain_metrics/total_value_locked.mdx deleted file mode 100644 index c6b5887f..00000000 --- a/pages/on_chain_metrics/total_value_locked.mdx +++ /dev/null @@ -1,18 +0,0 @@ ---- -seo_title: Total Value Locked -seo_description: -toc: false ---- - -# Total Value Locked - -This content is being peer reviewed & formally verified. Check back soon! - -In the meantime, explore other Cardano collections: - -- [YouTube Channels](https://www.adastack.io/community/youtube) -- [Development Firms](https://www.adastack.io/development/dev_teams) -- [Newsletters](https://www.adastack.io/community/newsletters) -- [News and Blogs](https://www.adastack.io/community/news_and_blogs) - -[Back to Full Library →](https://www.adastack.io/all_pages) diff --git a/pages/partner_chains/_meta.json b/pages/partner_chains/_meta.json new file mode 100644 index 00000000..68dab5c0 --- /dev/null +++ b/pages/partner_chains/_meta.json @@ -0,0 +1,32 @@ +{ + "what_are_partner_chains": { + "title": "What are Partner Chains?", + "theme": { + "breadcrumb": true, + "sidebar": true, + "toc": true, + "footer": true, + "pagination": false + } + }, + "partner_chain_explorers": { + "title": "Partner Chain Explorers ", + "theme": { + "breadcrumb": true, + "sidebar": true, + "toc": true, + "footer": true, + "pagination": false + } + }, + "cardano_partner_chains": { + "title": "All Partner Chains ", + "theme": { + "breadcrumb": true, + "sidebar": true, + "toc": true, + "footer": true, + "pagination": false + } + } +} diff --git a/pages/sidechains/other_sidechains.mdx b/pages/partner_chains/cardano_partner_chains.mdx similarity index 100% rename from pages/sidechains/other_sidechains.mdx rename to pages/partner_chains/cardano_partner_chains.mdx diff --git a/pages/partner_chains/partner_chain_explorers.mdx b/pages/partner_chains/partner_chain_explorers.mdx new file mode 100644 index 00000000..7f484be5 --- /dev/null +++ b/pages/partner_chains/partner_chain_explorers.mdx @@ -0,0 +1,18 @@ +--- +seo_title: Partner Chain Explorers +seo_description: +toc: false +--- + +# Partner Chain Explorers + +This content is being peer reviewed & formally verified. Check back soon! + +In the meantime, explore other Cardano collections: + +- [YouTube Channels](https://www.adastack.io/community/youtube) +- [Development Firms](https://www.adastack.io/development/dev_teams) +- [Newsletters](https://www.adastack.io/community/newsletters) +- [News and Blogs](https://www.adastack.io/community/news_and_blogs) + +[Back to Full Library →](https://www.adastack.io/all_pages) diff --git a/pages/sidechains/what_are_sidechains.mdx b/pages/partner_chains/what_are_partner_chains.mdx similarity index 95% rename from pages/sidechains/what_are_sidechains.mdx rename to pages/partner_chains/what_are_partner_chains.mdx index 5548671f..68fab1cf 100644 --- a/pages/sidechains/what_are_sidechains.mdx +++ b/pages/partner_chains/what_are_partner_chains.mdx @@ -1,10 +1,10 @@ --- -seo_title: What are Sidechains? +seo_title: What are Partner Chains? seo_description: Sidechains are separate blockchains that connect to Cardano. They enable fast transactions, low fees, custom features, scalability, and interoperability. toc: false --- -# What are Sidechains? +# What are Partner Chains? Sidechains are separate blockchains that connect with Cardano. They enable unique blockchains to connect together. Users can transfer digital assets securely between these linked networks. diff --git a/pages/sidechains/_meta.json b/pages/sidechains/_meta.json deleted file mode 100644 index 59d5e54b..00000000 --- a/pages/sidechains/_meta.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "what_are_sidechains": { - "title": "What are Sidechains?", - "theme": { - "breadcrumb": true, - "sidebar": true, - "toc": true, - "footer": true, - "pagination": false - } - }, - "midnight": { - "title": "Midnight ", - "theme": { - "breadcrumb": true, - "sidebar": true, - "toc": true, - "footer": true, - "pagination": false - } - }, - "world_mobile": { - "title": "World Mobile ", - "theme": { - "breadcrumb": true, - "sidebar": true, - "toc": true, - "footer": true, - "pagination": false - } - }, - "singularitynet": { - "title": "SingularityNet ", - "theme": { - "breadcrumb": true, - "sidebar": true, - "toc": true, - "footer": true, - "pagination": false - } - }, - "milkomeda": { - "title": "Milkomeda ", - "theme": { - "breadcrumb": true, - "sidebar": true, - "toc": true, - "footer": true, - "pagination": false - } - }, - "other_sidechains": { - "title": "Other Sidechains ", - "theme": { - "breadcrumb": true, - "sidebar": true, - "toc": true, - "footer": true, - "pagination": false - } - } -} diff --git a/pages/sidechains/midnight.mdx b/pages/sidechains/midnight.mdx deleted file mode 100644 index 3389b000..00000000 --- a/pages/sidechains/midnight.mdx +++ /dev/null @@ -1,18 +0,0 @@ ---- -seo_title: Midnight -seo_description: -toc: false ---- - -# Midnight - -This content is being peer reviewed & formally verified. Check back soon! - -In the meantime, explore other Cardano collections: - -- [YouTube Channels](https://www.adastack.io/community/youtube) -- [Development Firms](https://www.adastack.io/development/dev_teams) -- [Newsletters](https://www.adastack.io/community/newsletters) -- [News and Blogs](https://www.adastack.io/community/news_and_blogs) - -[Back to Full Library →](https://www.adastack.io/all_pages) diff --git a/pages/sidechains/milkomeda.mdx b/pages/sidechains/milkomeda.mdx deleted file mode 100644 index efcac58a..00000000 --- a/pages/sidechains/milkomeda.mdx +++ /dev/null @@ -1,18 +0,0 @@ ---- -seo_title: Milkomeda -seo_description: -toc: false ---- - -# Milkomeda - -This content is being peer reviewed & formally verified. Check back soon! - -In the meantime, explore other Cardano collections: - -- [YouTube Channels](https://www.adastack.io/community/youtube) -- [Development Firms](https://www.adastack.io/development/dev_teams) -- [Newsletters](https://www.adastack.io/community/newsletters) -- [News and Blogs](https://www.adastack.io/community/news_and_blogs) - -[Back to Full Library →](https://www.adastack.io/all_pages) diff --git a/pages/sidechains/singularitynet.mdx b/pages/sidechains/singularitynet.mdx deleted file mode 100644 index 494b4c9f..00000000 --- a/pages/sidechains/singularitynet.mdx +++ /dev/null @@ -1,18 +0,0 @@ ---- -seo_title: SingularityNet -seo_description: -toc: false ---- - -# SingularityNet - -This content is being peer reviewed & formally verified. Check back soon! - -In the meantime, explore other Cardano collections: - -- [YouTube Channels](https://www.adastack.io/community/youtube) -- [Development Firms](https://www.adastack.io/development/dev_teams) -- [Newsletters](https://www.adastack.io/community/newsletters) -- [News and Blogs](https://www.adastack.io/community/news_and_blogs) - -[Back to Full Library →](https://www.adastack.io/all_pages) diff --git a/pages/sidechains/world_mobile.mdx b/pages/sidechains/world_mobile.mdx deleted file mode 100644 index 1aad3b7b..00000000 --- a/pages/sidechains/world_mobile.mdx +++ /dev/null @@ -1,18 +0,0 @@ ---- -seo_title: World Mobile -seo_description: -toc: false ---- - -# World Mobile - -This content is being peer reviewed & formally verified. Check back soon! - -In the meantime, explore other Cardano collections: - -- [YouTube Channels](https://www.adastack.io/community/youtube) -- [Development Firms](https://www.adastack.io/development/dev_teams) -- [Newsletters](https://www.adastack.io/community/newsletters) -- [News and Blogs](https://www.adastack.io/community/news_and_blogs) - -[Back to Full Library →](https://www.adastack.io/all_pages) diff --git a/pages/staking/_meta.json b/pages/staking/_meta.json index d97650c9..dd3771ca 100644 --- a/pages/staking/_meta.json +++ b/pages/staking/_meta.json @@ -90,7 +90,7 @@ } }, "pool_monitoring_tools": { - "title": "Pool Monitoring Tools ", + "title": "Pool Monitoring Tools", "theme": { "breadcrumb": true, "sidebar": true, @@ -100,7 +100,7 @@ } }, "spo_chat_groups": { - "title": "SPO Chat Groups ", + "title": "SPO Chat Groups ", "theme": { "breadcrumb": true, "sidebar": true, @@ -110,7 +110,7 @@ } }, "other_staking_tools": { - "title": "Other Tools ", + "title": "Other Staking Tools ", "theme": { "breadcrumb": true, "sidebar": true, diff --git a/pages/staking/ispos.mdx b/pages/staking/ispos.mdx index f14e3185..225c072a 100644 --- a/pages/staking/ispos.mdx +++ b/pages/staking/ispos.mdx @@ -10,13 +10,13 @@ toc: false An initial stake pool offering (ISPO) allows you to collect Cardano tokens besides ADA when staking your ADA. Learn more about ISPOs: -- [Littlefish Foundation](https://vault.littlefish.foundation/F.+Cardano/ISPO+-+What%2C+Why%2C+How%3F): ISPOs - What, Why, How? +- [Littlefish Foundation](https://vault.littlefish.foundation/F.+Cardano/ISPO+-+What%2C+Why%2C+How%3F): ISPOs - What, Why, How? +- [CardanoSpot](https://cardanospot.io/news/initial-stake-pool-offering-ispo-on-cardano-ecosystem-0): ISPOs on Cardano - [Cointelegraph](https://cointelegraph.com/learn/ispo-101-a-beginners-guide-on-initial-stake-pool-offerings): ISPO 101: A beginner’s guide on initial stake pool offerings -- [CardanoSpot](https://cardanospot.io/news/initial-stake-pool-offering-ispo-on-cardano-ecosystem-0): ISPOs on Cardano ### Ongoing ISPOs See ISPOs happening now. -- [Maestro](https://www.gomaestro.org/marketplace): Marketplace of ISPOs +- [Maestro](https://www.gomaestro.org/marketplace): Marketplace of ISPOs - [CardanoCube](https://www.cardanocube.com/categories/ispo): ISPO collection diff --git a/pages/staking/pool_monitoring_tools.mdx b/pages/staking/pool_monitoring_tools.mdx index 5e87dc31..6d458efd 100644 --- a/pages/staking/pool_monitoring_tools.mdx +++ b/pages/staking/pool_monitoring_tools.mdx @@ -1,71 +1,67 @@ --- seo_title: Stake Pool Monitoring Tools -seo_description: +seo_description: Master your Cardano stake pool operations with these powerful monitoring tools. Visualize pool stats, optimize performance, and get notifications. toc: false --- # Stake Pool Monitoring Tools -Stake pools require ongoing monitoring to ensure they are always performing well. These tools help stake pool operators (SPOs) manage, troubleshoot, and optimize their pools on Cardano. -### Monitoring your Stake Pool independently +Monitoring tools help Cardano stake pool operators (SPOs) track and improve their pools' performance. -Although a bit time-consuming to setup initially, an independent solution to monitoring key metrics for your Stake Pool is something to be . Cardano-node outputs a number of useful metrics to Prometheus, and these can be captured and visualized via Grafana. +## Prometheus and Grafana -Both Prometheus and Grafana are very powerful tool stacks in active development, supported by easy-to-follow and up-to-date documentation. +Prometheus and Grafana work together to capture and visualize stake pool metrics on Cardano. This combo is the most common way to monitor Cardano stake pools. Both are in active development and supported by up-to-date documentation. -Note that Grafana Cloud is free to use if the number of metrics is low enough. This is almost always the case for a Cardano Stake Pool. The on-call stack is also very helpful. +[**Prometheus**](https://prometheus.io/) is a data tool that gathers and stores metrics from Cardano nodes including performance, network status, and system resources. + +- [Getting started with Prometheus](https://prometheus.io/docs/prometheus/latest/getting_started/) +- [Installing Prometheus for Cardano](https://cardano-course.gitbook.io/cardano-course/handbook/monitoring-our-nodes) +- [Prometheus Grafana Support](https://prometheus.io/docs/visualization/grafana/) + +[**Grafana**](https://grafana.com/) is a visualization platform that creates interactive dashboards using the data collected by Prometheus. + +- [Install Grafana Locally](https://grafana.com/get/?plcmt=top-nav&cta=downloads&tab=self-managed) +- [Use Grafana from the Cloud](https://grafana.com/get/?plcmt=top-nav&cta=downloads) +- [Improve Grafana Security for Cardano](https://developers.cardano.org/docs/operate-a-stake-pool/improve-grafana-security/) + +Note that Grafana Cloud is free to use if the usage of metrics is low enough (almost always the case for Cardano stake pools). Grafana also provides notification features with their [OnCall service](https://grafana.com/products/cloud/oncall/). + +#### Full Setup Guides + +- [CoinCashew Installing Prometheus and Grafana](https://www.coincashew.com/coins/overview-ada/guide-how-to-build-a-haskell-stakepool-node/part-iii-operation/setting-up-dashboards) +- [Guild Operators Monitoring Guide](https://cardano-community.github.io/guild-operators/Appendix/monitoring/?h=promet) +- [Cardano Dev Docs: Grafana Tutorial](https://developers.cardano.org/docs/operate-a-stake-pool/grafana-dashboard-tutorial/) + +#### Full Setup Videos + +- [EDEN Prometheus and Grafana Video Tutorial](https://youtu.be/oImqk-eubfs) +- [CodiLime Monitoring Node with Prometheus and Grafana Video](https://www.youtube.com/watch?v=opSlGGa6lLg) + +#### Custom Grafana Dashboards for Cardano -* [Prometheus](https://prometheus.io/) - [Getting started with Prometheus](https://prometheus.io/docs/prometheus/latest/getting_started/) - [Sending metrics to Grafana Cloud](https://grafana.com/docs/grafana-cloud/send-data/metrics/metrics-prometheus/) -- [Grafana](https://developers.cardano.org/docs/operate-a-stake-pool/grafana-dashboard-tutorial/) - - [https://github.com/grafana/](https://github.com/grafana/) - - [Grafana Labs](https://grafana.com/) - - [Grafana alert manager and on-call stack](https://grafana.com/products/cloud/oncall/) - [Armada Alliance Grafana Dashboards](https://github.com/armada-alliance/dashboards) - - [https://github.com/armada-alliance](https://github.com/armada-alliance) -### Third Party tools +- [Kirael Grafana Dashboard](https://github.com/Kirael12/Cardano-Grafana-Dashboards) +- [Carpool Grafana Dashboard](https://github.com/CardenPool/Cardano-Stake-Pool-Grafana-Dashboard) + +## Other Stake Pool Monitoring Tools Please note that these tools might no longer be in development. Exposing Stake Pool metrics should be done with care, DYOR. -- [Watchtower Tools](https://watchtower.tools/): Mobile app for SPOs and bring all useful metrics together and has push notifications. - - - [https://github.com/bkvpool](https://github.com/bkvpool) -- [RT View](https://github.com/IntersectMBO/cardano-node/blob/master/cardano-tracer/docs/cardano-rtview.md/) [https://docs.cardano.org/cardano-components/cardano-rtview/](https://docs.cardano.org/cardano-components/cardano-rtview/) - - - [https://github.com/IntersectMBO](https://github.com/IntersectMBO) -- [Jormanager](https://bitbucket.org/muamw10/jormanager/src/develop/) - - - [https://bitbucket.org/muamw10/](https://bitbucket.org/muamw10/) -- [Nview](https://github.com/blinklabs-io/nview) - - - [https://github.com/blinklabs-io](https://github.com/blinklabs-io) -- [CNTools](https://cardano-community.github.io/guild-operators/Scripts/cntools/) - - - [https://github.com/cardano-community](https://github.com/cardano-community) -- [Cardano Light Tools](https://github.com/orpheus-antpool/cardano-light-tools) - - - [https://github.com/orpheus-antpool](https://github.com/orpheus-antpool) -- [gLiveView](https://developers.cardano.org/docs/operate-a-stake-pool/monitoring-gliveview/): A script that displays live information about the node and the network, such as CPU usage, memory usage, slot number, epoch number, block height, and peers. It also shows the status of the stake pool, such as active stake, live stake, rewards, and performance. - - - No Github -- [Cncli](https://github.com/cardano-community/cncli): A community-built command-line tool for interacting with the Cardano node. It provides features such as syncing the ledger state, calculating the leader schedule, sending tip information to pooltool.io, and generating pool reports. - - - [https://github.com/cardano-community](https://github.com/cardano-community) -- [Pool.vet](https://pool.vet/): See if your Cardano stake pool is working or find out why it might not be. - - - No Github -- [Cardano Node Audit](https://github.com/Kirael12/cardano-node-audit) - - - [https://github.com/Kirael12/](https://github.com/Kirael12/) -### More information - -* Get started with CNtools - * [https://developers.cardano.org/docs/operate-a-stake-pool/guild-ops-suite/](https://developers.cardano.org/docs/operate-a-stake-pool/guild-ops-suite/) -* Monitoring your nodes - * [https://docs.cardano.org/development-guidelines/node-monitoring/](https://docs.cardano.org/development-guidelines/node-monitoring/) -* Basic Pool checklists - * [https://blockchainlens.gitbook.io/cardano-spot-check](https://blockchainlens.gitbook.io/cardano-spot-check) -* About Guild Operators - * [https://cardano-community.github.io/guild-operators/build/](https://cardano-community.github.io/guild-operators/build/) -[Back to Full Library →](https://www.adastack.io/all_pages) +- [RT View](https://github.com/IntersectMBO/cardano-node/blob/master/cardano-tracer/docs/cardano-rtview.md/): RTView is a monitoring tool that provides real-time insights into Cardano nodes through an interactive web interface. As part of the cardano-tracer service, it displays vital node information and performance metrics. + +- [Nview](https://github.com/blinklabs-io/nview): Provides a command line TUI (terminal user interface) for a running node. + +- [Koios gLiveView](https://developers.cardano.org/docs/operate-a-stake-pool/monitoring-gliveview/): A script that displays live information about the node and the network, such as CPU usage, memory usage, slot number, epoch number, block height, and peers. It also shows the status of the stake pool, such as active stake, live stake, rewards, and performance. + +- [Cardano Light Tools](https://github.com/orpheus-antpool/cardano-light-tools): Simple monitoring script that logs relevant metrics directly into a text file in human-readable form. + +- [Cardano Node Audit](https://github.com/Kirael12/cardano-node-audit): CLI Tool to check the health of a stake pool. + +- [Pool.vet](https://pool.vet/): Website to check if your Cardano stake pool is working and identify issues. + +## More information + +- [Cardano Spot Check Guide](https://blockchainlens.gitbook.io/cardano-spot-check/basic-checks/advanced) +- [Cardano Docs: Stake Pool Monitoring](https://docs.cardano.org/stake-pool-operators/monitoring/) +- [Cardano Developer Docs: Operator Tools](https://github.com/cardano-foundation/developer-portal) +- [Guild Operators Tools](https://cardano-community.github.io/guild-operators/build/) diff --git a/pages/staking/reward_calculators.mdx b/pages/staking/reward_calculators.mdx index e69d2996..129ce4de 100644 --- a/pages/staking/reward_calculators.mdx +++ b/pages/staking/reward_calculators.mdx @@ -4,12 +4,12 @@ seo_description: Staking reward calculators estimate upcoming gains from staked toc: false --- -# Rewards Calculators +# Reward Calculators Calculators to estimate ADA staking rewards. -- [Antipalos Cardano Calculator](https://antipalos.github.io/cardano-calculator/#calculator): Open-source reward calculator -- [Armada Alliance](https://armada-alliance.com/): Scroll down for calculators: staking rewards, live off rewards, and retirement +- [Antipalos Cardano Calculator](https://antipalos.github.io/cardano-calculator/#calculator): Open-source reward calculator +- [Armada Alliance](https://armada-alliance.com/): Scroll down for staking rewards, live off rewards, and retirement - [Cardano with Paul](https://www.cardanowithpaul.com/calculators/ada-staking-rewards-calculator/): Staking rewards - [Cardano with Paul](https://www.cardanowithpaul.com/calculators/ada-price-needed-to-live-off-rewards/): Live off rewards -- [Cardano with Paul](https://www.cardanowithpaul.com/calculators/how-much-ada-do-you-need-to-retire/): Retirement \ No newline at end of file +- [Cardano with Paul](https://www.cardanowithpaul.com/calculators/how-much-ada-do-you-need-to-retire/): Retirement diff --git a/pages/staking/reward_calendars.mdx b/pages/staking/reward_calendars.mdx index db7ae82c..e1cb2fb1 100644 --- a/pages/staking/reward_calendars.mdx +++ b/pages/staking/reward_calendars.mdx @@ -10,7 +10,7 @@ See ADA your staking rewards on a calendar. View reward history and future payou - [Cardano Date](https://cardano.date/#) - [Cardano-Calendar](https://cardano-calendar.com/month/#) -- [Pool Peek Epoch Calendar](https://poolpeek.com/epochcalendar) -- [Azure ADA Epoch Calendar](https://azureada.com/epoch-calendar/) -- [Cexplorer Calendar](https://cexplorer.io/calendar) -- [Hype Staking](https://hype-staking.com/home) \ No newline at end of file +- [Pool Peek Epoch Calendar](https://poolpeek.com/epochcalendar) +- [Cexplorer Calendar](https://cexplorer.io/calendar) +- [Azure ADA Epoch Calendar](https://azureada.com/epoch-calendar/) +- [Hype Staking](https://hype-staking.com/home) diff --git a/pages/staking/reward_trackers.mdx b/pages/staking/reward_trackers.mdx index 8ded7197..492778d8 100644 --- a/pages/staking/reward_trackers.mdx +++ b/pages/staking/reward_trackers.mdx @@ -8,12 +8,12 @@ toc: false Check your staking rewards. Enter your wallet address to see accumulated rewards and history. -- [Cexplorer](https://cexplorer.io/rewards): Reward history and graph +- [Cexplorer](https://cexplorer.io/rewards): Reward history and graph - [WhenAda](https://www.whenada.com/): Reward history and graph - [Cardano Countdown](https://cardanocountdown.com/Rewards): Reward history -- [Cardano.org Explorer](https://beta.explorer.cardano.org/staking-lifecycle/): Rewards and staking lifecycle +- [Cardano.org Explorer](https://beta.explorer.cardano.org/staking-lifecycle/): Rewards and staking lifecycle -- [CardanoScan](https://cardanoscan.io/): Reward balance +- [CardanoScan](https://cardanoscan.io/): Reward balance diff --git a/pages/staking/stake_pool_alliances.mdx b/pages/staking/stake_pool_alliances.mdx index f2f7a55e..fc3acb63 100644 --- a/pages/staking/stake_pool_alliances.mdx +++ b/pages/staking/stake_pool_alliances.mdx @@ -8,12 +8,12 @@ toc: false Collectives of stake pool operators with a similar missions or goals. By joining an alliance, SPOs can attract delegators and support other pools. -- [Armada Alliance](https://armada-alliance.com/): A community of energy-efficient stake pool operations. -- [Mission Driven Pools](https://missiondrivenpools.org/): A collective of mission-based stake pools. -- [xSPO Alliance](https://www.xspo-alliance.org/): Alliance of small stake pools. -- [Single Pool Alliance](https://singlepoolalliance.net/): Single stake pools promoting diverse decentralization. +- [Armada Alliance](https://armada-alliance.com/): A community of energy-efficient stake pool operations. +- [Mission Driven Pools](https://missiondrivenpools.org/): A collective of mission-based stake pools. +- [xSPO Alliance](https://www.xspo-alliance.org/): Alliance of small stake pools. +- [Single Pool Alliance](https://singlepoolalliance.net/): Single stake pools promoting diverse decentralization. +- [SPO Japan Guild](https://spojapanguild.net/): Japanese Guild supporting the Japanese community. +- [Canadian Cardano Stake Pool Association](https://ccspa.ca/): Coalition of Cardano stake pool operators across Canada. +- [Aldea DAO](https://aldea-dao.org/): A Latin American DAO with 30+ stake pools supporting local projects. +- [StakePool Operator Tools Alliance](https://github.com/gitmachtl/StakePool-Operator-Tools-Alliance): Alliance of stake pool operators developing tools for stake pools. - [Climate Neutral Cardano](https://climateneutralcardano.org/): Stake pools committed to using 100% renewable energy. -- [SPO Japan Guild](https://spojapanguild.net/): Japanese Guild supporting the Japanese community. -- [Canadian Cardano Stake Pool Association](https://ccspa.ca/): Coalition of Cardano stake pool operators across Canada. -- [Aldea DAO](https://aldea-dao.org/): A Latin American DAO with 30+ stake pools supporting local projects. -- [StakePool Operator Tools Alliance](https://github.com/gitmachtl/StakePool-Operator-Tools-Alliance): Alliance of stake pool operators developing tools for stake pools. \ No newline at end of file diff --git a/pages/staking/stake_pool_explorers.mdx b/pages/staking/stake_pool_explorers.mdx index 3f73980c..46cd9200 100644 --- a/pages/staking/stake_pool_explorers.mdx +++ b/pages/staking/stake_pool_explorers.mdx @@ -8,10 +8,10 @@ toc: false Stake Pool Explorers to search and view stake pools. -- [Cexplorer Stake Pools](https://cexplorer.io/pool) -- [AdaStat](https://adastat.net/pools) -- [Alethea](https://alethea.io/pools) +- [Cexplorer Stake Pools](https://cexplorer.io/pool) +- [AdaStat](https://adastat.net/pools) +- [Alethea](https://alethea.io/pools) +- [PoolTool](https://pooltool.io/pools): Pool explorer and pool Telegram bot +- [CardanoScan](https://cardanoscan.io/pools): Pool explorer and pool Telegram bot +- [Stakada.io](https://stakada.io/) - [Upstream](https://upstream.org.uk/cardano-stake-pool-explorer/) -- [PoolTool](https://pooltool.io/pools): Pool explorer and pool Telegram bot -- [CardanoScan](https://cardanoscan.io/pools): Pool explorer and pool Telegram bot -- [Stakada](https://stakada.io/) \ No newline at end of file diff --git a/pages/staking/what_is_staking.mdx b/pages/staking/what_is_staking.mdx index 79ca736c..1b58041e 100644 --- a/pages/staking/what_is_staking.mdx +++ b/pages/staking/what_is_staking.mdx @@ -12,11 +12,16 @@ Users enjoy staking on Cardano because they receive recurring ADA rewards. To st Staking is like a vote of confidence for a stake pool that you trust to operate well and make good decisions for the Cardano network. The more ADA that is delegated to a stake pool, the more frequently they can produce blocks. When a stake pool produces a new block they receive an ADA block reward that is automatically distributed between them and the people that delegate to them. -Cardano's staking mechanism is one of the simplest and safest in cryptocurrency. It has been thourougly researched and tested to ensure high security and 24/7 network operations. You can read more about [staking on Cardano here](https://docs.cardano.org/new-to-cardano/proof-of-stake). +Cardano's staking mechanism is one of the simplest and safest in cryptocurrency. It has been thoroughly researched and tested to ensure high security and 24/7 network operations. You can read more about [staking on Cardano here](https://docs.cardano.org/new-to-cardano/proof-of-stake). -## Cardano Staking Guides +## Staking Guides +- [Cardano.org Staking Guide](https://cardano.org/stake-pool-delegation/) +- [How to Stake your ADA](https://medium.com/@wonge/how-to-stake-your-ada-cardano-3c56b020f91d) - [Staking Infographic by Essential Cardano](https://www.essentialcardano.io/infographic/how-to-stake-your-ada) + +## Staking Video Walkthroughs + +- [Maximizing your Staking Rewards](https://www.youtube.com/watch?v=Nf6D1D5DKKk) - [How to Stake ADA: The Ultimate Guide by Learn Cardano](https://learncardano.io/how-to-easily-stake-ada-cardano-stake-pool/) -- [How to Stake ADA on Cardano by CardanoSpot](https://cardanospot.io/news/how-to-stake-ada-on-cardano-a-guide-0) - [How to Stake ADA Tutorial Video with Crypto Moose](https://www.youtube.com/watch?v=lbsFlyxUE8A) diff --git a/theme.config.tsx b/theme.config.tsx index 8eda794e..9aa2b54c 100644 --- a/theme.config.tsx +++ b/theme.config.tsx @@ -7,6 +7,7 @@ import { } from "./assets/logos"; import { useConfig } from "nextra-theme-docs"; import { useRouter } from "next/router"; +import OS from "./components/badges/OS"; const default_seo_description = "Adastack is an explorer for everything on Cardano. Find community, dApps, games, staking, NFTs, governance, development, DAOs, Layer 2s, and more."; @@ -128,6 +129,9 @@ const config: DocsThemeConfig = { return "https://github.com/adastackio/adastack.io/issues"; }, }, + components: { + OS: OS, + }, docsRepositoryBase: "https://github.com/adastackio/adastack.io/blob/main/", footer: { text: null,