@scenoco-three/editor 0.5.4 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/README.md +31 -93
  2. package/dist/cli/index.js +49 -115
  3. package/dist-app/assets/EffectComposer-lekj9UUq.js +1 -0
  4. package/dist-app/assets/GLTFLoader-C2lUhzim.js +1 -0
  5. package/dist-app/assets/OutputPass-DZtd342R.js +72 -0
  6. package/dist-app/assets/Pass-BP3b3hlf.js +1 -0
  7. package/dist-app/assets/RenderPass-BjVchlYg.js +1 -0
  8. package/dist-app/assets/ShaderPass-DMXLcV9X.js +24 -0
  9. package/dist-app/assets/SkeletonUtils-Cxy_owx9.js +1 -0
  10. package/dist-app/assets/index-AxOpglZ-.css +1 -0
  11. package/dist-app/assets/index-D-Iq7tix.js +4135 -0
  12. package/dist-app/assets/inter-CaiW00F8.js +1 -0
  13. package/dist-app/assets/registry-BOM35tSr.js +1433 -0
  14. package/dist-app/assets/worker-_Lh8Vt-i.js +1270 -0
  15. package/dist-app/examples/breakout/assets/geometry/ball.geometry.xml +1 -0
  16. package/dist-app/examples/breakout/assets/geometry/brick.geometry.xml +1 -0
  17. package/dist-app/examples/breakout/assets/geometry/floor-sensor.geometry.xml +1 -0
  18. package/dist-app/examples/breakout/assets/geometry/paddle.geometry.xml +1 -0
  19. package/dist-app/examples/breakout/assets/geometry/wall-side.geometry.xml +1 -0
  20. package/dist-app/examples/breakout/assets/geometry/wall-top.geometry.xml +1 -0
  21. package/dist-app/examples/breakout/assets/materials/ball.material.xml +1 -0
  22. package/dist-app/examples/breakout/assets/materials/brick-firm.material.xml +1 -0
  23. package/dist-app/examples/breakout/assets/materials/brick-hard.material.xml +1 -0
  24. package/dist-app/examples/breakout/assets/materials/brick-soft.material.xml +1 -0
  25. package/dist-app/examples/breakout/assets/materials/paddle.material.xml +10 -0
  26. package/dist-app/examples/breakout/assets/materials/wall.material.xml +1 -0
  27. package/dist-app/examples/breakout/assets/render/neon.render.xml +14 -0
  28. package/dist-app/examples/breakout/assets/scenes/arena.prefab.xml +68 -0
  29. package/dist-app/examples/breakout/assets/scenes/brick.prefab.xml +15 -0
  30. package/dist-app/examples/breakout/assets/scenes/hud.scene.xml +56 -0
  31. package/dist-app/examples/breakout/assets/scenes/level-1.scene.xml +36 -0
  32. package/dist-app/examples/breakout/assets/scenes/level-2.scene.xml +36 -0
  33. package/dist-app/examples/breakout/assets/scenes/level-3.scene.xml +36 -0
  34. package/dist-app/examples/castle/assets/geometry/capsule.geometry.xml +3 -0
  35. package/dist-app/examples/castle/assets/geometry/cone.geometry.xml +2 -0
  36. package/dist-app/examples/castle/assets/geometry/cube.geometry.xml +3 -0
  37. package/dist-app/examples/castle/assets/geometry/cylinder.geometry.xml +3 -0
  38. package/dist-app/examples/castle/assets/geometry/plane.geometry.xml +4 -0
  39. package/dist-app/examples/castle/assets/geometry/quad.geometry.xml +3 -0
  40. package/dist-app/examples/castle/assets/geometry/sphere.geometry.xml +2 -0
  41. package/dist-app/examples/castle/assets/materials/grass.material.xml +1 -0
  42. package/dist-app/examples/castle/assets/materials/roof.material.xml +1 -0
  43. package/dist-app/examples/castle/assets/materials/stone.material.xml +1 -0
  44. package/dist-app/examples/castle/assets/materials/wood.material.xml +1 -0
  45. package/dist-app/examples/castle/assets/scenes/main.scene.xml +25 -0
  46. package/dist-app/examples/collector/assets/geometry/capsule.geometry.xml +3 -0
  47. package/dist-app/examples/collector/assets/geometry/cone.geometry.xml +2 -0
  48. package/dist-app/examples/collector/assets/geometry/cube.geometry.xml +3 -0
  49. package/dist-app/examples/collector/assets/geometry/cylinder.geometry.xml +3 -0
  50. package/dist-app/examples/collector/assets/geometry/plane.geometry.xml +4 -0
  51. package/dist-app/examples/collector/assets/geometry/quad.geometry.xml +3 -0
  52. package/dist-app/examples/collector/assets/geometry/sphere.geometry.xml +2 -0
  53. package/dist-app/examples/collector/assets/materials/crate.material.xml +1 -0
  54. package/dist-app/examples/collector/assets/materials/depot.material.xml +1 -0
  55. package/dist-app/examples/collector/assets/materials/ground.material.xml +1 -0
  56. package/dist-app/examples/collector/assets/materials/player.material.xml +1 -0
  57. package/dist-app/examples/collector/assets/scenes/crate.prefab.xml +9 -0
  58. package/dist-app/examples/collector/assets/scenes/main.scene.xml +83 -0
  59. package/dist-app/examples/playable/assets/geometry/capsule.geometry.xml +3 -0
  60. package/dist-app/examples/playable/assets/geometry/cone.geometry.xml +2 -0
  61. package/dist-app/examples/playable/assets/geometry/cube.geometry.xml +3 -0
  62. package/dist-app/examples/playable/assets/geometry/cylinder.geometry.xml +3 -0
  63. package/dist-app/examples/playable/assets/geometry/plane.geometry.xml +4 -0
  64. package/dist-app/examples/playable/assets/geometry/quad.geometry.xml +3 -0
  65. package/dist-app/examples/playable/assets/geometry/sphere.geometry.xml +2 -0
  66. package/dist-app/examples/playable/assets/materials/ground.material.xml +1 -0
  67. package/dist-app/examples/playable/assets/materials/target.material.xml +2 -0
  68. package/dist-app/examples/playable/assets/scenes/main.scene.xml +53 -0
  69. package/dist-app/examples/playable/assets/scenes/target.prefab.xml +9 -0
  70. package/dist-app/examples.json +68 -0
  71. package/{app → dist-app}/index.html +2 -2
  72. package/dist-app/model.json +1 -0
  73. package/package.json +25 -29
  74. package/app/cameraRig.ts +0 -118
  75. package/app/commands.ts +0 -78
  76. package/app/desktopControls.ts +0 -47
  77. package/app/document.ts +0 -547
  78. package/app/editLog.ts +0 -127
  79. package/app/editor.css +0 -51
  80. package/app/gizmo.ts +0 -169
  81. package/app/globals.d.ts +0 -9
  82. package/app/main.ts +0 -546
  83. package/app/meta.ts +0 -24
  84. package/app/picking.ts +0 -47
  85. package/app/session.ts +0 -612
  86. package/app/touchControls.ts +0 -127
  87. package/app/ui-react/AddMemberPopup.tsx +0 -114
  88. package/app/ui-react/BottomLauncher.tsx +0 -15
  89. package/app/ui-react/EditorUI.tsx +0 -22
  90. package/app/ui-react/FilePicker.tsx +0 -80
  91. package/app/ui-react/HeadBtn.tsx +0 -21
  92. package/app/ui-react/InspectorSheet.tsx +0 -475
  93. package/app/ui-react/NodeListSheet.tsx +0 -56
  94. package/app/ui-react/TopBar.tsx +0 -137
  95. package/app/ui-react/Tree.tsx +0 -106
  96. package/app/ui-react/cx.ts +0 -4
  97. package/app/ui-react/fields.tsx +0 -407
  98. package/app/ui-react/format.ts +0 -30
  99. package/app/ui-react/mount.tsx +0 -31
  100. package/app/ui-react/store.ts +0 -80
  101. package/app/ui-react/types.ts +0 -88
  102. package/app/ui-react/ui.module.css +0 -250
  103. package/app/ui-react/useSize.ts +0 -20
  104. package/app/values.ts +0 -137
  105. package/app/vite-env.d.ts +0 -7
  106. package/dist/index.d.ts +0 -10
  107. package/dist/index.js +0 -10
  108. package/dist/mcp.d.ts +0 -32
  109. package/dist/mcp.js +0 -191
  110. package/dist/protocol.d.ts +0 -170
  111. package/dist/protocol.js +0 -22
  112. package/dist/server.d.ts +0 -124
  113. package/dist/server.js +0 -440
package/README.md CHANGED
@@ -1,112 +1,50 @@
1
1
  # @scenoco-three/editor
2
2
 
3
- A local **visual editor** for [SceNoCo](https://github.com/) scenes and prefabs, with an
4
- **MCP server** so a (multimodal) LLM can open a scene, render frames, drive gameplay, and
5
- read back telemetry — the "eyes and hands" for an agent that authors scenes with
6
- `@scenoco-three/compiler`. Humans and agents share the **same live browser tab**: the MCP
7
- tools drive it over a WebSocket bridge, there's no separate headless render path.
3
+ The **standalone editor** for [SceNoCo](https://github.com/RomaRogov/scenoco-three) scenes: a
4
+ static site with a tree, an inspector, transform gizmos and comment-preserving saves. It needs
5
+ nothing from a project and nothing from a server: it opens a scene from a folder on your machine
6
+ or from a URL, builds it live in the page, and writes your changes back into the XML.
8
7
 
9
- ```bash
10
- npm i -D @scenoco-three/editor
11
- ```
12
-
13
- ## CLI
14
-
15
- ```
16
- scenoco-editor [scene|prefab] [options] Omit the file to choose from a start-up picker
17
- --components <dirs> Comma-separated component dirs (default: "assets")
18
- --packages <pkgs> Comma-separated tag packages (default: every @scenoco-three/*
19
- dependency in the project's package.json)
20
- --port <n> Fixed MCP port — pin it so your MCP client survives restarts
21
- (the HTTP editor server always takes a free port and prints its URL)
22
- ```
8
+ It is what the repository publishes to GitHub Pages, and what `npx scenoco-editor` serves locally.
23
9
 
24
- ```bash
25
- scenoco-editor # zero-config: file picker, auto-detected packages
26
- scenoco-editor assets/scenes/level.scene.xml --port 55470
27
- # editor: http://localhost:HTTP_PORT?file=… ← opens in your browser
28
- # mcp: http://localhost:55470/mcp ← add to your MCP client (transport: http)
29
- ```
10
+ ## Opening a scene
30
11
 
31
- It serves the editor app through Vite + `@scenoco-three/vite` (so the open scene compiles
32
- exactly like production), bridges that browser session to an MCP server over a WebSocket, and
33
- watches the scene's source dependencies for **live reload** (with an unsaved-changes conflict
34
- prompt).
12
+ **A folder.** A scene is never one file — its geometry, materials and prefabs are files beside it
13
+ — so the editor opens a folder (Chrome and Edge, through the File System Access API), lists every
14
+ scene and prefab in it, and saves back to disk.
35
15
 
36
- ## MCP tools
16
+ **A URL.** Any `.scene.xml` or `.prefab.xml` on the web; what it refers to is fetched relative to
17
+ it. Read-only, since the web is.
37
18
 
38
- | Tool | Args | Returns |
39
- | --- | --- | --- |
40
- | `open_file` | `path` | Opens a `.scene.xml` / `.prefab.xml` in edit mode. |
41
- | `screenshot` | `camera`, `lookAt?`, `width`, `height`, `fit`, `ui` | A **PNG** of the current view, at exactly the size and camera fit you state, with or without the HUD. |
42
- | `playback` | `state` | `play` / `pause` / `stop` — enter play mode (components, systems, physics) / freeze / return to the authored scene. |
43
- | `inspect` | `id` | **JSON** of current property values at a scene `id` — a **node** (its transform + every component on it) or a **component** (its authored field values + its host node's transform). Nodes and components share one id namespace. |
19
+ The examples the site carries are offered underneath either way.
44
20
 
45
- Values read back in the same vocabulary the scene XML is written in: vectors are
46
- named by axis (`{"x": 0, "y": 1.5, "z": 0}`), eulers are **degrees**, colours are
47
- `"#rrggbb"`, and a reference is `"#id"`. Points you pass *in* (`camera`, `lookAt`)
48
- take the DSL's own vector grammar — `"y: 6; z: 12"`, an omitted axis being 0, with
49
- the positional `"0 6 12"` still accepted.
50
- | `simulate` | `commands: SimStep[]` + the same `width`/`height`/`fit`/`ui` | Ordered **images + JSON** — the workhorse below. The capture format is stated once for the batch, not per shot. |
21
+ ## What it builds, and what it cannot
51
22
 
52
- ### `simulate` — closed-loop driving
23
+ The page parses the document with the compiler's own parser (`@scenoco-three/compiler/browser`)
24
+ and builds the scene from the same vocabulary the compiler uses: three's classes and the tag
25
+ packages the site carries (collision, ui, postfx, audio, particles, box2d). Nodes, assets,
26
+ references, placement, prefabs and overrides are all live, stamped with the parser's positions,
27
+ so the tree, the inspector and the gizmos find every element.
53
28
 
54
- One call injects input, steps the sim, and captures — *see a game move, not a static scene*.
55
- Each command is a self-contained verb `{ do, … }`:
29
+ It does not run anything, and has no Play. A component or a system is a project's own
30
+ TypeScript, and there is no TypeScript in a static page — so this is an editor of documents:
31
+ move things, arrange the hierarchy, set attributes, save. What it could not build it says rather
32
+ than drops. To see a scene *run*, an agent uses the observer, and a person runs the game.
56
33
 
57
- ```ts
58
- type SimStep =
59
- | { do: 'play' | 'pause' | 'stop' }
60
- | { do: 'step'; frames?: number; dt?: number } // advance `frames` ticks (default 1)
61
- | { do: 'press'; key: string } // key press + release
62
- | { do: 'keyDown'; key: string }
63
- | { do: 'keyUp'; key: string }
64
- | { do: 'click'; x?: number; y?: number; button?: 'left' | 'right' | 'middle' }
65
- | { do: 'move'; x?: number; y?: number; dx?: number; dy?: number }
66
- | { do: 'gamepad'; index?: number; buttons?: boolean[]; axes?: number[] }
67
- | { do: 'preview'; camera: string; lookAt?: string } // size/fit/ui come from the call
68
- | { do: 'telemetry'; id: string };
69
- ```
34
+ ## CLI
70
35
 
71
- ```jsonc
72
- // "press Space, advance 90 frames, read the ball, screenshot" — in one tool call
73
- { "width": 960, "height": 540, "fit": "contain", "ui": true,
74
- "commands": [ { "do": "play" },
75
- { "do": "press", "key": "Space" },
76
- { "do": "step", "frames": 90 },
77
- { "do": "telemetry", "id": "ball" },
78
- { "do": "preview", "camera": "fit" } ] }
36
+ ```bash
37
+ npx scenoco-editor # serve the site locally and open it
38
+ npx scenoco-editor --port 5177 --no-open
79
39
  ```
80
40
 
81
- The result is a `multi` payload: each capture's image/JSON in step order.
82
-
83
- ## Programmatic API
41
+ ## Building the site
84
42
 
85
- ```ts
86
- import { startEditorServer, startMcpServer } from '@scenoco-three/editor';
87
-
88
- const editor = await startEditorServer({ cwd }); // defaults: assets/ roots, packages from package.json
89
- const mcp = await startMcpServer(editor.bridge, { port: 55470 }); // editor.bridge.send(EditorCommand)
90
- console.log(editor.url, mcp.url);
91
- // … later
92
- await mcp.close(); await editor.close();
43
+ ```bash
44
+ npm run build:app # static/public (the vocabulary, the examples) + dist-app/
45
+ npm run preview:app
93
46
  ```
94
47
 
95
- Also exported: `buildMcpServer`, the WebSocket `protocol` types (`EditorCommand`,
96
- `EditorResponse`, `EditorResult`, `WS_PATH`, `commandId`).
97
-
98
- ## Standalone & dependencies
99
-
100
- Build-time / Node-side tool — **not** part of the browser runtime; nothing here ships to
101
- production. It depends on `@scenoco-three/compiler` and `@scenoco-three/vite` (compile +
102
- serve) and the MCP SDK; `@scenoco-three/core`, `three`, and `vite` are **peers** (the editor
103
- renders your scene with the same runtime your app uses). You can run it purely for the **human
104
- browser UI** without ever touching MCP, or wire **only** the MCP server to an agent — the two
105
- share one live session but neither requires the other.
106
-
107
- See the [repository](../../README.md), [ARCHITECTURE.md](../../ARCHITECTURE.md), and the
108
- [measurements](../../bench/README.md).
109
-
110
48
  ## License
111
49
 
112
- [MIT](./LICENSE)
50
+ MIT
package/dist/cli/index.js CHANGED
@@ -1,122 +1,56 @@
1
1
  #!/usr/bin/env node
2
- import { spawn } from 'node:child_process';
3
- import { existsSync } from 'node:fs';
4
- import { dirname, join, resolve } from 'node:path';
5
- import { startEditorServer } from '../server.js';
6
- import { createMcpServer, startMcpHttp } from '../mcp.js';
7
- const USAGE = `scenoco-editor — open a scene and drive it from an MCP client
8
-
9
- Usage:
10
- scenoco-editor [document] [options]
11
-
12
- With no document, the editor opens a picker listing the project's scenes and
13
- prefabs. Tag packages are read from the project's package.json, so --modules is
14
- only for compiling against something other than what the project depends on.
15
-
16
- Options:
17
- --root <dir> Project root (default: the nearest one at or above the
18
- current directory)
19
- --modules a,b Packages whose tags the documents use, beyond three
20
- --mcp-port <n> Fixed MCP port (default 55470) — an MCP client is configured
21
- once with a URL, so this must not move between restarts
22
-
23
- The editor serves its own page and imports the project's generated modules, so
24
- what you see is the same scene the game loads. Its MCP tools **observe**: open,
25
- screenshot, telemetry, play/pause/stop, simulate. Documents are changed by
26
- editing the XML — in the editor, or in your own editor — and the watcher rebuilds.`;
27
- const DEFAULT_MCP_PORT = 55470;
28
- async function main(argv) {
29
- if (argv.includes('-h') || argv.includes('--help')) {
30
- console.log(USAGE);
31
- return 0;
32
- }
33
- const flag = (name) => {
34
- const i = argv.indexOf(`--${name}`);
35
- return i === -1 ? undefined : argv[i + 1];
36
- };
37
- const document = argv.find((a) => !a.startsWith('--') && argv[argv.indexOf(a) - 1]?.startsWith('--') !== true);
38
- const modules = flag('modules')?.split(',').filter(Boolean);
39
- // npm and npx rewrite `cwd` to the nearest enclosing package.json when run from inside a
40
- // workspace package; `INIT_CWD` still holds the directory the shell was actually in.
41
- const from = flag('root') ?? process.env.INIT_CWD ?? process.cwd();
42
- const root = flag('root') ? resolve(from) : projectRootAt(from);
43
- let closing = false;
44
- const editor = await startEditorServer({
45
- root,
46
- ...(modules ? { modules: ['three', ...modules] } : {}),
47
- // Self-halt once every tab is closed, so a spawned editor never lingers holding its ports.
48
- onIdle: () => {
49
- if (closing)
50
- return;
51
- console.error('\n no editor connected — shutting down so no stale process is left behind\n');
52
- void shutdown();
53
- },
54
- });
55
- const mcpPort = Number(flag('mcp-port') ?? DEFAULT_MCP_PORT);
56
- // A server per session: an MCP client that reconnects gets a fresh one rather than a 400.
57
- const mcp = await startMcpHttp(() => createMcpServer(editor.bridge, () => editor.url), mcpPort);
58
- const query = document ? `?path=${encodeURIComponent(document)}` : '';
59
- const url = `${editor.url}${query}`;
60
- console.log(`\n editor: ${url}`);
61
- // The address to type into a phone on the same Wi-Fi — the touch controls only mean anything
62
- // on a device with fingers.
63
- if (editor.networkUrl)
64
- console.log(` wi-fi: ${editor.networkUrl}${query}`);
65
- console.log(` mcp: http://localhost:${mcpPort} ← add this to your MCP client (transport: http)`);
66
- console.log('\n press Ctrl+C to stop\n');
67
- const shutdown = async () => {
68
- if (closing)
69
- return;
70
- closing = true;
71
- // A connected browser holds WebSocket and HMR sockets open, so `close()` can stall waiting
72
- // for them to drain. Cap it, so Ctrl+C always exits promptly.
73
- const deadline = new Promise((done) => setTimeout(done, 1500).unref());
74
- await Promise.race([
75
- Promise.all([mcp.close().catch(() => { }), editor.close().catch(() => { })]),
76
- deadline,
77
- ]);
78
- process.exit(0);
79
- };
80
- process.on('SIGINT', () => void shutdown());
81
- process.on('SIGTERM', () => void shutdown());
82
- // Having reclaimed the previous session's port, give any tab left behind by an ungraceful exit
83
- // a moment to reattach on its own retry loop — a restart should land in the tab that is
84
- // already open rather than stack a second one beside it. On a fresh port nothing is waiting.
85
- const reattached = editor.reusedPort && (await editor.bridge.waitForConnection(1500));
86
- if (reattached) {
87
- console.log(' reattached the editor tab already open — no new tab\n');
88
- // That tab is still showing whatever it had open, so a named document has to be asked for.
89
- if (document)
90
- await editor.bridge.send({ id: 'cli-open', type: 'open', path: document }).catch(() => { });
91
- }
92
- else {
93
- openBrowser(url);
94
- }
95
- return new Promise(() => { }); // runs until interrupted
96
- }
97
2
  /**
98
- * The project a bare `scenoco-editor` means: the nearest directory at or above `from` that holds
99
- * a `tsconfig.json`.
3
+ * `scenoco-editor` — the standalone editor, served from this package.
100
4
  *
101
- * Running it from `src/` or `assets/scenes/` is the normal way to reach for an editor, and
102
- * "no tsconfig.json here" is a poor answer when the project is one directory up. Falls back to
103
- * `from` unchanged, so the error still names the place the person actually was.
5
+ * The editor is a static site: it needs nothing from a project, and it is the same site the
6
+ * repository publishes to GitHub Pages. This serves that site from `dist-app/` on a local port
7
+ * and opens it, for whoever would rather not use the hosted one. There is no other mode.
104
8
  */
105
- function projectRootAt(from) {
106
- for (let dir = resolve(from);; dir = dirname(dir)) {
107
- if (existsSync(join(dir, 'tsconfig.json')))
108
- return dir;
109
- if (dirname(dir) === dir)
110
- return resolve(from);
111
- }
9
+ import { spawn } from 'node:child_process';
10
+ import { createReadStream, existsSync, statSync } from 'node:fs';
11
+ import { createServer } from 'node:http';
12
+ import { extname, join, normalize } from 'node:path';
13
+ import { fileURLToPath } from 'node:url';
14
+ const site = fileURLToPath(new URL('../../dist-app', import.meta.url));
15
+ const TYPES = {
16
+ '.html': 'text/html; charset=utf-8',
17
+ '.js': 'text/javascript',
18
+ '.css': 'text/css',
19
+ '.json': 'application/json',
20
+ '.xml': 'application/xml',
21
+ '.png': 'image/png',
22
+ '.jpg': 'image/jpeg',
23
+ '.svg': 'image/svg+xml',
24
+ '.woff2': 'font/woff2',
25
+ '.wasm': 'application/wasm',
26
+ };
27
+ const argv = process.argv.slice(2);
28
+ if (argv.includes('-h') || argv.includes('--help')) {
29
+ console.log('scenoco-editor [--port <n>] [--no-open]\n\nServes the standalone editor and opens it.');
30
+ process.exit(0);
112
31
  }
113
- function openBrowser(url) {
114
- const command = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open';
115
- spawn(command, [url], { stdio: 'ignore', detached: true, shell: process.platform === 'win32' }).unref();
32
+ const port = Number(argv[argv.indexOf('--port') + 1] || 0) || 5177;
33
+ if (!existsSync(join(site, 'index.html'))) {
34
+ console.error('scenoco-editor: this package has no dist-app/ — run `npm run build:app` in packages/editor');
35
+ process.exit(1);
116
36
  }
117
- main(process.argv.slice(2)).then((code) => {
118
- process.exitCode = code;
119
- }, (error) => {
120
- console.error(error instanceof Error ? error.message : String(error));
121
- process.exitCode = 1;
37
+ const server = createServer((req, res) => {
38
+ const path = normalize(decodeURIComponent(new URL(req.url ?? '/', 'http://x').pathname));
39
+ let file = join(site, path === '/' ? 'index.html' : path);
40
+ if (!file.startsWith(site)) {
41
+ res.statusCode = 403;
42
+ return res.end();
43
+ }
44
+ if (!existsSync(file) || statSync(file).isDirectory())
45
+ file = join(site, 'index.html');
46
+ res.setHeader('Content-Type', TYPES[extname(file)] ?? 'application/octet-stream');
47
+ createReadStream(file).pipe(res);
48
+ });
49
+ server.listen(port, () => {
50
+ const url = `http://localhost:${port}/`;
51
+ console.log(`\n editor: ${url}\n\n press Ctrl+C to stop\n`);
52
+ if (!argv.includes('--no-open')) {
53
+ const command = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open';
54
+ spawn(command, [url], { stdio: 'ignore', detached: true, shell: process.platform === 'win32' }).unref();
55
+ }
122
56
  });
@@ -0,0 +1 @@
1
+ import{M as e,Ut as t,Xt as n,qt as r}from"./index-D-Iq7tix.js";import{n as i,t as a}from"./ShaderPass-DMXLcV9X.js";import{n as o}from"./Pass-BP3b3hlf.js";var s=class extends o{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){let r=e.getContext(),i=e.state;i.buffers.color.setMask(!1),i.buffers.depth.setMask(!1),i.buffers.color.setLocked(!0),i.buffers.depth.setLocked(!0);let a,o;this.inverse?(a=0,o=1):(a=1,o=0),i.buffers.stencil.setTest(!0),i.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),i.buffers.stencil.setFunc(r.ALWAYS,a,4294967295),i.buffers.stencil.setClear(o),i.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),i.buffers.color.setLocked(!1),i.buffers.depth.setLocked(!1),i.buffers.color.setMask(!0),i.buffers.depth.setMask(!0),i.buffers.stencil.setLocked(!1),i.buffers.stencil.setFunc(r.EQUAL,1,4294967295),i.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),i.buffers.stencil.setLocked(!0)}},c=class extends o{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}},l=class{constructor(o,s){if(this.renderer=o,this._pixelRatio=o.getPixelRatio(),s===void 0){let t=o.getSize(new r);this._width=t.width,this._height=t.height,s=new n(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:e}),s.texture.name=`EffectComposer.rt1`}else this._width=s.width,this._height=s.height;this.renderTarget1=s,this.renderTarget2=s.clone(),this.renderTarget2.texture.name=`EffectComposer.rt2`,this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new a(i),this.copyPass.material.blending=0,this.timer=new t}swapBuffers(){let e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){let t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){this.timer.update(),e===void 0&&(e=this.timer.getDelta());let t=this.renderer.getRenderTarget(),n=!1;for(let t=0,r=this.passes.length;t<r;t++){let r=this.passes[t];if(r.enabled!==!1){if(r.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(t),r.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),r.needsSwap){if(n){let t=this.renderer.getContext(),n=this.renderer.state.buffers.stencil;n.setFunc(t.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),n.setFunc(t.EQUAL,1,4294967295)}this.swapBuffers()}s!==void 0&&(r instanceof s?n=!0:r instanceof c&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){let t=this.renderer.getSize(new r);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;let n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget1.setSize(n,r),this.renderTarget2.setSize(n,r);for(let e=0;e<this.passes.length;e++)this.passes[e].setSize(n,r)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}};export{l as EffectComposer};
@@ -0,0 +1 @@
1
+ import{$ as e,B as t,Bt as n,C as r,E as i,Et as a,Ft as o,G as s,Ht as c,I as l,J as u,Jt as d,K as f,L as p,Lt as m,Mt as h,N as g,P as ee,Q as te,R as ne,Rt as re,St as ie,T as _,Tt as v,U as ae,V as y,Vt as b,X as oe,Y as se,Yt as ce,Z as x,_t as le,b as ue,bt as de,ct as S,d as fe,dt as pe,et as C,ft as me,g as he,gt as ge,ht as w,it as T,j as E,jt as _e,k as D,lt as O,mt as k,nt as A,pt as ve,q as ye,qt as j,rt as be,tt as xe,ut as Se,v as Ce,w as M,wt as we,xt as Te,y as N,z as Ee}from"./index-D-Iq7tix.js";import{clone as De}from"./SkeletonUtils-Cxy_owx9.js";function P(e,t){if(t===0)return console.warn(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.`),e;if(t===2||t===1){let n=e.getIndex();if(n===null){let t=[],r=e.getAttribute(`position`);if(r!==void 0){for(let e=0;e<r.count;e++)t.push(e);e.setIndex(t),n=e.getIndex()}else return console.error(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.`),e}let r=n.count-2,i=[];if(t===2)for(let e=1;e<=r;e++)i.push(n.getX(0)),i.push(n.getX(e)),i.push(n.getX(e+1));else for(let e=0;e<r;e++)e%2==0?(i.push(n.getX(e)),i.push(n.getX(e+1)),i.push(n.getX(e+2))):(i.push(n.getX(e+2)),i.push(n.getX(e+1)),i.push(n.getX(e)));i.length/3!==r&&console.error(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.`);let a=e.clone();return a.setIndex(i),a.clearGroups(),a}else return console.error(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:`,t),e}var Oe=class extends te{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new Ne(e)}),this.register(function(e){return new Pe(e)}),this.register(function(e){return new Ue(e)}),this.register(function(e){return new We(e)}),this.register(function(e){return new Ge(e)}),this.register(function(e){return new Ie(e)}),this.register(function(e){return new Le(e)}),this.register(function(e){return new Re(e)}),this.register(function(e){return new ze(e)}),this.register(function(e){return new Me(e)}),this.register(function(e){return new Be(e)}),this.register(function(e){return new Fe(e)}),this.register(function(e){return new He(e)}),this.register(function(e){return new Ve(e)}),this.register(function(e){return new Ae(e)}),this.register(function(e){return new L(e,I.EXT_MESHOPT_COMPRESSION)}),this.register(function(e){return new L(e,I.KHR_MESHOPT_COMPRESSION)}),this.register(function(e){return new Ke(e)})}load(t,n,r,i){let a=this,o;if(this.resourcePath!==``)o=this.resourcePath;else if(this.path!==``){let n=e.extractUrlBase(t);o=e.resolveURL(n,this.path)}else o=e.extractUrlBase(t);this.manager.itemStart(t);let s=function(e){i?i(e):console.error(e),a.manager.itemError(t),a.manager.itemEnd(t)},c=new D(this.manager);c.setPath(this.path),c.setResponseType(`arraybuffer`),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(t,function(e){try{a.parse(e,o,function(e){n(e),a.manager.itemEnd(t)},s)}catch(e){s(e)}},r,s)}setDRACOLoader(e){return this.dracoLoader=e,this}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,r){let i,a={},o={},s=new TextDecoder;if(typeof e==`string`)i=JSON.parse(e);else if(e instanceof ArrayBuffer)if(s.decode(new Uint8Array(e,0,4))===R){try{a[I.KHR_BINARY_GLTF]=new qe(e)}catch(e){r&&r(e);return}i=JSON.parse(a[I.KHR_BINARY_GLTF].content)}else i=JSON.parse(s.decode(e));else i=e;if(i.asset===void 0||i.asset.version[0]<2){r&&r(Error(`THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.`));return}let c=new st(i,{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 e=0;e<this.pluginCallbacks.length;e++){let t=this.pluginCallbacks[e](c);t.name||console.error(`THREE.GLTFLoader: Invalid plugin found: missing name`),o[t.name]=t,a[t.name]=!0}if(i.extensionsUsed)for(let e=0;e<i.extensionsUsed.length;++e){let t=i.extensionsUsed[e],n=i.extensionsRequired||[];switch(t){case I.KHR_MATERIALS_UNLIT:a[t]=new je;break;case I.KHR_DRACO_MESH_COMPRESSION:a[t]=new Je(i,this.dracoLoader);break;case I.KHR_TEXTURE_TRANSFORM:a[t]=new Ye;break;case I.KHR_MESH_QUANTIZATION:a[t]=new Xe;break;default:n.indexOf(t)>=0&&o[t]===void 0&&console.warn(`THREE.GLTFLoader: Unknown extension "`+t+`".`)}}c.setExtensions(a),c.setPlugins(o),c.parse(n,r)}parseAsync(e,t){let n=this;return new Promise(function(r,i){n.parse(e,t,r,i)})}};function ke(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}function F(e,t,n){let r=e.json.materials[t];return r.extensions&&r.extensions[n]?r.extensions[n]:null}var I={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_DISPERSION:`KHR_materials_dispersion`,KHR_MATERIALS_IOR:`KHR_materials_ior`,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_ANISOTROPY:`KHR_materials_anisotropy`,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_MATERIALS_BUMP:`EXT_materials_bump`,EXT_TEXTURE_WEBP:`EXT_texture_webp`,EXT_TEXTURE_AVIF:`EXT_texture_avif`,EXT_MESHOPT_COMPRESSION:`EXT_meshopt_compression`,KHR_MESHOPT_COMPRESSION:`KHR_meshopt_compression`,EXT_MESH_GPU_INSTANCING:`EXT_mesh_gpu_instancing`},Ae=class{constructor(e){this.parser=e,this.name=I.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,r=t.length;n<r;n++){let r=t[n];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){let t=this.parser,r=`light:`+e,a=t.cache.get(r);if(a)return a;let o=t.json,s=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e],c,l=new M(16777215);s.color!==void 0&&l.setRGB(s.color[0],s.color[1],s.color[2],x);let u=s.range===void 0?0:s.range;switch(s.type){case`directional`:c=new i(l),c.target.position.set(0,0,-1),c.add(c.target);break;case`point`:c=new de(l),c.distance=u;break;case`spot`:c=new n(l),c.distance=u,s.spot=s.spot||{},s.spot.innerConeAngle=s.spot.innerConeAngle===void 0?0:s.spot.innerConeAngle,s.spot.outerConeAngle=s.spot.outerConeAngle===void 0?Math.PI/4:s.spot.outerConeAngle,c.angle=s.spot.outerConeAngle,c.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw Error(`THREE.GLTFLoader: Unexpected light type: `+s.type)}return c.position.set(0,0,0),X(c,s),s.intensity!==void 0&&(c.intensity=s.intensity),c.name=t.createUniqueName(s.name||`light_`+e),a=Promise.resolve(c),t.cache.add(r,a),a}getDependency(e,t){if(e===`light`)return this._loadLight(t)}createNodeAttachment(e){let t=this,n=this.parser,r=n.json.nodes[e],i=(r.extensions&&r.extensions[this.name]||{}).light;return i===void 0?null:this._loadLight(i).then(function(e){return n._getNodeRef(t.cache,i,e)})}},je=class{constructor(){this.name=I.KHR_MATERIALS_UNLIT}getMaterialType(){return T}extendParams(e,t,n){let r=[];e.color=new M(1,1,1),e.opacity=1;let i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){let t=i.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],x),e.opacity=t[3]}i.baseColorTexture!==void 0&&r.push(n.assignTexture(e,`map`,i.baseColorTexture,h))}return Promise.all(r)}},Me=class{constructor(e){this.parser=e,this.name=I.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let n=F(this.parser,e,this.name);return n===null||n.emissiveStrength!==void 0&&(t.emissiveIntensity=n.emissiveStrength),Promise.resolve()}},Ne=class{constructor(e){this.parser=e,this.name=I.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return F(this.parser,e,this.name)===null?null:S}extendMaterialParams(e,t){let n=F(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];if(n.clearcoatFactor!==void 0&&(t.clearcoat=n.clearcoatFactor),n.clearcoatTexture!==void 0&&r.push(this.parser.assignTexture(t,`clearcoatMap`,n.clearcoatTexture)),n.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=n.clearcoatRoughnessFactor),n.clearcoatRoughnessTexture!==void 0&&r.push(this.parser.assignTexture(t,`clearcoatRoughnessMap`,n.clearcoatRoughnessTexture)),n.clearcoatNormalTexture!==void 0&&(r.push(this.parser.assignTexture(t,`clearcoatNormalMap`,n.clearcoatNormalTexture)),n.clearcoatNormalTexture.scale!==void 0)){let e=n.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new j(e,e)}return Promise.all(r)}},Pe=class{constructor(e){this.parser=e,this.name=I.KHR_MATERIALS_DISPERSION}getMaterialType(e){return F(this.parser,e,this.name)===null?null:S}extendMaterialParams(e,t){let n=F(this.parser,e,this.name);return n===null||(t.dispersion=n.dispersion===void 0?0:n.dispersion),Promise.resolve()}},Fe=class{constructor(e){this.parser=e,this.name=I.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return F(this.parser,e,this.name)===null?null:S}extendMaterialParams(e,t){let n=F(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return n.iridescenceFactor!==void 0&&(t.iridescence=n.iridescenceFactor),n.iridescenceTexture!==void 0&&r.push(this.parser.assignTexture(t,`iridescenceMap`,n.iridescenceTexture)),n.iridescenceIor!==void 0&&(t.iridescenceIOR=n.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),n.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=n.iridescenceThicknessMinimum),n.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=n.iridescenceThicknessMaximum),n.iridescenceThicknessTexture!==void 0&&r.push(this.parser.assignTexture(t,`iridescenceThicknessMap`,n.iridescenceThicknessTexture)),Promise.all(r)}},Ie=class{constructor(e){this.parser=e,this.name=I.KHR_MATERIALS_SHEEN}getMaterialType(e){return F(this.parser,e,this.name)===null?null:S}extendMaterialParams(e,t){let n=F(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];if(t.sheenColor=new M(0,0,0),t.sheenRoughness=0,t.sheen=1,n.sheenColorFactor!==void 0){let e=n.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],x)}return n.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=n.sheenRoughnessFactor),n.sheenColorTexture!==void 0&&r.push(this.parser.assignTexture(t,`sheenColorMap`,n.sheenColorTexture,h)),n.sheenRoughnessTexture!==void 0&&r.push(this.parser.assignTexture(t,`sheenRoughnessMap`,n.sheenRoughnessTexture)),Promise.all(r)}},Le=class{constructor(e){this.parser=e,this.name=I.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return F(this.parser,e,this.name)===null?null:S}extendMaterialParams(e,t){let n=F(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return n.transmissionFactor!==void 0&&(t.transmission=n.transmissionFactor),n.transmissionTexture!==void 0&&r.push(this.parser.assignTexture(t,`transmissionMap`,n.transmissionTexture)),Promise.all(r)}},Re=class{constructor(e){this.parser=e,this.name=I.KHR_MATERIALS_VOLUME}getMaterialType(e){return F(this.parser,e,this.name)===null?null:S}extendMaterialParams(e,t){let n=F(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];t.thickness=n.thicknessFactor===void 0?0:n.thicknessFactor,n.thicknessTexture!==void 0&&r.push(this.parser.assignTexture(t,`thicknessMap`,n.thicknessTexture)),t.attenuationDistance=n.attenuationDistance||1/0;let i=n.attenuationColor||[1,1,1];return t.attenuationColor=new M().setRGB(i[0],i[1],i[2],x),Promise.all(r)}},ze=class{constructor(e){this.parser=e,this.name=I.KHR_MATERIALS_IOR}getMaterialType(e){return F(this.parser,e,this.name)===null?null:S}extendMaterialParams(e,t){let n=F(this.parser,e,this.name);return n===null?Promise.resolve():(t.ior=n.ior===void 0?1.5:n.ior,t.ior===0&&(t.ior=1e3),Promise.resolve())}},Be=class{constructor(e){this.parser=e,this.name=I.KHR_MATERIALS_SPECULAR}getMaterialType(e){return F(this.parser,e,this.name)===null?null:S}extendMaterialParams(e,t){let n=F(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];t.specularIntensity=n.specularFactor===void 0?1:n.specularFactor,n.specularTexture!==void 0&&r.push(this.parser.assignTexture(t,`specularIntensityMap`,n.specularTexture));let i=n.specularColorFactor||[1,1,1];return t.specularColor=new M().setRGB(i[0],i[1],i[2],x),n.specularColorTexture!==void 0&&r.push(this.parser.assignTexture(t,`specularColorMap`,n.specularColorTexture,h)),Promise.all(r)}},Ve=class{constructor(e){this.parser=e,this.name=I.EXT_MATERIALS_BUMP}getMaterialType(e){return F(this.parser,e,this.name)===null?null:S}extendMaterialParams(e,t){let n=F(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return t.bumpScale=n.bumpFactor===void 0?1:n.bumpFactor,n.bumpTexture!==void 0&&r.push(this.parser.assignTexture(t,`bumpMap`,n.bumpTexture)),Promise.all(r)}},He=class{constructor(e){this.parser=e,this.name=I.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return F(this.parser,e,this.name)===null?null:S}extendMaterialParams(e,t){let n=F(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return n.anisotropyStrength!==void 0&&(t.anisotropy=n.anisotropyStrength),n.anisotropyRotation!==void 0&&(t.anisotropyRotation=n.anisotropyRotation),n.anisotropyTexture!==void 0&&r.push(this.parser.assignTexture(t,`anisotropyMap`,n.anisotropyTexture)),Promise.all(r)}},Ue=class{constructor(e){this.parser=e,this.name=I.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,n=t.json,r=n.textures[e];if(!r.extensions||!r.extensions[this.name])return null;let i=r.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw Error(`THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures`);return null}return t.loadTextureImage(e,i.source,a)}},We=class{constructor(e){this.parser=e,this.name=I.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},Ge=class{constructor(e){this.parser=e,this.name=I.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},L=class{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let e=n.extensions[this.name],r=this.parser.getDependency(`buffer`,e.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw Error(`THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files`);return null}return r.then(function(t){let n=e.byteOffset||0,r=e.byteLength||0,a=e.count,o=e.byteStride,s=new Uint8Array(t,n,r);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(a,o,s,e.mode,e.filter).then(function(e){return e.buffer}):i.ready.then(function(){let t=new ArrayBuffer(a*o);return i.decodeGltfBuffer(new Uint8Array(t),a,o,s,e.mode,e.filter),t})})}else return null}},Ke=class{constructor(e){this.name=I.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let r=t.meshes[n.mesh];for(let e of r.primitives)if(e.mode!==H.TRIANGLES&&e.mode!==H.TRIANGLE_STRIP&&e.mode!==H.TRIANGLE_FAN&&e.mode!==void 0)return null;let i=n.extensions[this.name].attributes,a=[],o={};for(let e in i)a.push(this.parser.getDependency(`accessor`,i[e]).then(t=>(o[e]=t,o[e])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(e=>{let t=e.pop(),n=t.isGroup?t.children:[t],r=e[0].count,i=[];for(let e of n){let t=new A,n=new d,a=new v,s=new d(1,1,1),c=new l(e.geometry,e.material,r);for(let e=0;e<r;e++)o.TRANSLATION&&n.fromBufferAttribute(o.TRANSLATION,e),o.ROTATION&&a.fromBufferAttribute(o.ROTATION,e),o.SCALE&&s.fromBufferAttribute(o.SCALE,e),c.setMatrixAt(e,t.compose(n,a,s));for(let t in o)if(t===`_COLOR_0`){let e=o[t];c.instanceColor=new ee(e.array,e.itemSize,e.normalized)}else t!==`TRANSLATION`&&t!==`ROTATION`&&t!==`SCALE`&&e.geometry.setAttribute(t,o[t]);w.prototype.copy.call(c,e),this.parser.assignFinalMaterial(c),i.push(c)}return t.isGroup?(t.clear(),t.add(...i),t):i[0]}))}},R=`glTF`,z=12,B={JSON:1313821514,BIN:5130562},qe=class{constructor(e){this.name=I.KHR_BINARY_GLTF,this.content=null,this.body=null;let t=new DataView(e,0,z),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==R)throw Error(`THREE.GLTFLoader: Unsupported glTF-Binary header.`);if(this.header.version<2)throw Error(`THREE.GLTFLoader: Legacy binary file detected.`);let r=this.header.length-z,i=new DataView(e,z),a=0;for(;a<r;){let t=i.getUint32(a,!0);a+=4;let r=i.getUint32(a,!0);if(a+=4,r===B.JSON){let r=new Uint8Array(e,z+a,t);this.content=n.decode(r)}else if(r===B.BIN){let n=z+a;this.body=e.slice(n,n+t)}a+=t}if(this.content===null)throw Error(`THREE.GLTFLoader: JSON content not found.`)}},Je=class{constructor(e,t){if(!t)throw Error(`THREE.GLTFLoader: No DRACOLoader instance provided.`);this.name=I.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let n=this.json,r=this.dracoLoader,i=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},c={};for(let e in a){let t=K[e]||e.toLowerCase();o[t]=a[e]}for(let t in e.attributes){let r=K[t]||t.toLowerCase();if(a[t]!==void 0){let i=n.accessors[e.attributes[t]];c[r]=U[i.componentType].name,s[r]=i.normalized===!0}}return t.getDependency(`bufferView`,i).then(function(e){return new Promise(function(t,n){r.decodeDracoFile(e,function(e){for(let t in e.attributes){let n=e.attributes[t],r=s[t];r!==void 0&&(n.normalized=r)}t(e)},o,c,x,n)})})}},Ye=class{constructor(){this.name=I.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0?e:(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),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)}},Xe=class{constructor(){this.name=I.KHR_MESH_QUANTIZATION}},V=class extends Ee{constructor(e,t,n,r){super(e,t,n,r)}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r;for(let e=0;e!==r;e++)t[e]=n[i+e];return t}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=o*2,c=o*3,l=r-t,u=(n-t)/l,d=u*u,f=d*u,p=e*c,m=p-c,h=-2*f+3*d,g=f-d,ee=1-h,te=g-d+u;for(let e=0;e!==o;e++){let t=a[m+e+o],n=a[m+e+s]*l,r=a[p+e+o],c=a[p+e]*l;i[e]=ee*t+te*n+h*r+g*c}return i}},Ze=new v,Qe=class extends V{interpolate_(e,t,n,r){let i=super.interpolate_(e,t,n,r);return Ze.fromArray(i).normalize().toArray(i),i}},H={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},U={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},$e={9728:pe,9729:u,9984:ve,9985:oe,9986:me,9987:se},W={33071:r,33648:Se,10497:_e},G={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},K={POSITION:`position`,NORMAL:`normal`,TANGENT:`tangent`,TEXCOORD_0:`uv`,TEXCOORD_1:`uv1`,TEXCOORD_2:`uv2`,TEXCOORD_3:`uv3`,COLOR_0:`color`,WEIGHTS_0:`skinWeight`,JOINTS_0:`skinIndex`},q={scale:`scale`,translation:`position`,rotation:`quaternion`,weights:`morphTargetInfluences`},et={CUBICSPLINE:void 0,LINEAR:y,STEP:t},J={OPAQUE:`OPAQUE`,MASK:`MASK`,BLEND:`BLEND`};function tt(e){return e.DefaultMaterial===void 0&&(e.DefaultMaterial=new O({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),e.DefaultMaterial}function Y(e,t,n){for(let r in n.extensions)e[r]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=n.extensions[r])}function X(e,t){t.extras!==void 0&&(typeof t.extras==`object`?Object.assign(e.userData,t.extras):console.warn(`THREE.GLTFLoader: Ignoring primitive type .extras, `+t.extras))}function nt(e,t,n){let r=!1,i=!1,a=!1;for(let e=0,n=t.length;e<n;e++){let n=t[e];if(n.POSITION!==void 0&&(r=!0),n.NORMAL!==void 0&&(i=!0),n.COLOR_0!==void 0&&(a=!0),r&&i&&a)break}if(!r&&!i&&!a)return Promise.resolve(e);let o=[],s=[],c=[];for(let l=0,u=t.length;l<u;l++){let u=t[l];if(r){let t=u.POSITION===void 0?e.attributes.position:n.getDependency(`accessor`,u.POSITION);o.push(t)}if(i){let t=u.NORMAL===void 0?e.attributes.normal:n.getDependency(`accessor`,u.NORMAL);s.push(t)}if(a){let t=u.COLOR_0===void 0?e.attributes.color:n.getDependency(`accessor`,u.COLOR_0);c.push(t)}}return Promise.all([Promise.all(o),Promise.all(s),Promise.all(c)]).then(function(t){let n=t[0],o=t[1],s=t[2];return r&&(e.morphAttributes.position=n),i&&(e.morphAttributes.normal=o),a&&(e.morphAttributes.color=s),e.morphTargetsRelative=!0,e})}function rt(e,t){if(e.updateMorphTargets(),t.weights!==void 0)for(let n=0,r=t.weights.length;n<r;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){let n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let t=0,r=n.length;t<r;t++)e.morphTargetDictionary[n[t]]=t}else console.warn(`THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.`)}}function it(e){let t,n=e.extensions&&e.extensions[I.KHR_DRACO_MESH_COMPRESSION];if(t=n?`draco:`+n.bufferView+`:`+n.indices+`:`+Z(n.attributes):e.indices+`:`+Z(e.attributes)+`:`+e.mode,e.targets!==void 0)for(let n=0,r=e.targets.length;n<r;n++)t+=`:`+Z(e.targets[n]);return t}function Z(e){let t=``,n=Object.keys(e).sort();for(let r=0,i=n.length;r<i;r++)t+=n[r]+`:`+e[n[r]]+`;`;return t}function Q(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw Error(`THREE.GLTFLoader: Unsupported normalized accessor component type.`)}}function at(e){return e.search(/\.jpe?g($|\?)/i)>0||e.search(/^data\:image\/jpeg/)===0?`image/jpeg`:e.search(/\.webp($|\?)/i)>0||e.search(/^data\:image\/webp/)===0?`image/webp`:e.search(/\.ktx2($|\?)/i)>0||e.search(/^data\:image\/ktx2/)===0?`image/ktx2`:`image/png`}var ot=new A,st=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new ke,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,r=-1,i=!1,a=-1;if(typeof navigator<`u`&&navigator.userAgent!==void 0){let e=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(e)===!0;let t=e.match(/Version\/(\d+)/);r=n&&t?parseInt(t[1],10):-1,i=e.indexOf(`Firefox`)>-1,a=i?e.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>`u`||n&&r<17||i&&a<98?this.textureLoader=new c(this.options.manager):this.textureLoader=new g(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new D(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){let n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([n.getDependencies(`scene`),n.getDependencies(`animation`),n.getDependencies(`camera`)])}).then(function(t){let a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};return Y(i,a,r),X(a,r),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(let e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=t.length;n<r;n++){let r=t[n].joints;for(let t=0,n=r.length;t<n;t++)e[r[t]].isBone=!0}for(let t=0,r=e.length;t<r;t++){let r=e[t];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(n[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.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;let r=n.clone(),i=(e,t)=>{let n=this.associations.get(e);n!=null&&this.associations.set(t,n);for(let[n,r]of e.children.entries())i(r,t.children[n])};return i(n,r),r.name+=`_instance_`+ e.uses[t]++,r}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){let r=e(t[n]);if(r)return r}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let n=[];for(let r=0;r<t.length;r++){let i=e(t[r]);i&&n.push(i)}return n}getDependency(e,t){let n=e+`:`+t,r=this.cache.get(n);if(!r){switch(e){case`scene`:r=this.loadScene(t);break;case`node`:r=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case`mesh`:r=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case`accessor`:r=this.loadAccessor(t);break;case`bufferView`:r=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case`buffer`:r=this.loadBuffer(t);break;case`material`:r=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case`texture`:r=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case`skin`:r=this.loadSkin(t);break;case`animation`:r=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case`camera`:r=this.loadCamera(t);break;default:if(r=this._invokeOne(function(n){return n!=this&&n.getDependency&&n.getDependency(e,t)}),!r)throw Error(`Unknown type: `+e);break}this.cache.add(n,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){let n=this,r=this.json[e+(e===`mesh`?`es`:`s`)]||[];t=Promise.all(r.map(function(t,r){return n.getDependency(e,r)})),this.cache.add(e,t)}return t}loadBuffer(t){let n=this.json.buffers[t],r=this.fileLoader;if(n.type&&n.type!==`arraybuffer`)throw Error(`THREE.GLTFLoader: `+n.type+` buffer type is not supported.`);if(n.uri===void 0&&t===0)return Promise.resolve(this.extensions[I.KHR_BINARY_GLTF].body);let i=this.options;return new Promise(function(t,a){r.load(e.resolveURL(n.uri,i.path),t,void 0,function(){a(Error(`THREE.GLTFLoader: Failed to load buffer "`+n.uri+`".`))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency(`buffer`,t.buffer).then(function(e){let n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)})}loadAccessor(e){let t=this,n=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0){let e=G[r.type],t=U[r.componentType],n=r.normalized===!0,i=new t(r.count*e);return Promise.resolve(new N(i,e,n))}let i=[];return r.bufferView===void 0?i.push(null):i.push(this.getDependency(`bufferView`,r.bufferView)),r.sparse!==void 0&&(i.push(this.getDependency(`bufferView`,r.sparse.indices.bufferView)),i.push(this.getDependency(`bufferView`,r.sparse.values.bufferView))),Promise.all(i).then(function(e){let i=e[0],a=G[r.type],o=U[r.componentType],s=o.BYTES_PER_ELEMENT,c=s*a,l=r.byteOffset||0,u=r.bufferView===void 0?void 0:n.bufferViews[r.bufferView].byteStride,d=r.normalized===!0,f,m;if(u&&u!==c){let e=Math.floor(l/u),n=`InterleavedBuffer:`+r.bufferView+`:`+r.componentType+`:`+e+`:`+r.count,c=t.cache.get(n);c||(f=new o(i,e*u,r.count*u/s),c=new p(f,u/s),t.cache.add(n,c)),m=new ne(c,a,l%u/s,d)}else f=i===null?new o(r.count*a):new o(i,l,r.count*a),m=new N(f,a,d);if(r.sparse!==void 0){let t=G.SCALAR,n=U[r.sparse.indices.componentType],s=r.sparse.indices.byteOffset||0,c=r.sparse.values.byteOffset||0,l=new n(e[1],s,r.sparse.count*t),u=new o(e[2],c,r.sparse.count*a);i!==null&&(m=new N(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let e=0,t=l.length;e<t;e++){let t=l[e];if(m.setX(t,u[e*a]),a>=2&&m.setY(t,u[e*a+1]),a>=3&&m.setZ(t,u[e*a+2]),a>=4&&m.setW(t,u[e*a+3]),a>=5)throw Error(`THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.`)}m.normalized=d}return m})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e].source,i=t.images[r],a=this.textureLoader;if(i.uri){let e=n.manager.getHandler(i.uri);e!==null&&(a=e)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,n){let r=this,i=this.json,a=i.textures[e],o=i.images[t],s=(o.uri||o.bufferView)+`:`+a.sampler;if(this.textureCache[s])return this.textureCache[s];let c=this.loadImageSource(t,n).then(function(t){t.flipY=!1,t.name=a.name||o.name||``,t.name===``&&typeof o.uri==`string`&&o.uri.startsWith(`data:image/`)===!1&&(t.name=o.uri);let n=(i.samplers||{})[a.sampler]||{};return t.magFilter=$e[n.magFilter]||1006,t.minFilter=$e[n.minFilter]||1008,t.wrapS=W[n.wrapS]||1e3,t.wrapT=W[n.wrapT]||1e3,t.generateMipmaps=!t.isCompressedTexture&&t.minFilter!==1003&&t.minFilter!==1006,r.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[s]=c,c}loadImageSource(t,n){let r=this,i=this.json,a=this.options;if(this.sourceCache[t]!==void 0)return this.sourceCache[t].then(e=>e.clone());let o=i.images[t],s=self.URL||self.webkitURL,c=o.uri||``,l=!1;if(o.bufferView!==void 0)c=r.getDependency(`bufferView`,o.bufferView).then(function(e){l=!0;let t=new Blob([e],{type:o.mimeType});return c=s.createObjectURL(t),c});else if(o.uri===void 0)throw Error(`THREE.GLTFLoader: Image `+t+` is missing URI and bufferView`);let u=Promise.resolve(c).then(function(t){return new Promise(function(r,i){let o=r;n.isImageBitmapLoader===!0&&(o=function(e){let t=new b(e);t.needsUpdate=!0,r(t)}),n.load(e.resolveURL(t,a.path),o,void 0,i)})}).then(function(e){return l===!0&&s.revokeObjectURL(c),X(e,o),e.userData.mimeType=o.mimeType||at(o.uri),e}).catch(function(e){throw console.error(`THREE.GLTFLoader: Couldn't load texture`,c),e});return this.sourceCache[t]=u,u}assignTexture(e,t,n,r){let i=this;return this.getDependency(`texture`,n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),i.extensions[I.KHR_TEXTURE_TRANSFORM]){let e=n.extensions===void 0?void 0:n.extensions[I.KHR_TEXTURE_TRANSFORM];if(e){let t=i.associations.get(a);a=i.extensions[I.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),i.associations.set(a,t)}}return r!==void 0&&(a.colorSpace=r),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,n=e.material,r=t.attributes.tangent===void 0,i=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){let e=`PointsMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new ie,C.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){let e=`LineBasicMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new s,C.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(r||i||a){let e=`ClonedMaterial:`+n.uuid+`:`;r&&(e+=`derivative-tangents:`),i&&(e+=`vertex-colors:`),a&&(e+=`flat-shading:`);let t=this.cache.get(e);t||(t=n.clone(),i&&(t.vertexColors=!0),a&&(t.flatShading=!0),r&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return O}loadMaterial(e){let t=this,n=this.json,r=this.extensions,i=n.materials[e],a,o={},s=i.extensions||{},c=[];if(s[I.KHR_MATERIALS_UNLIT]){let e=r[I.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),c.push(e.extendParams(o,i,t))}else{let n=i.pbrMetallicRoughness||{};if(o.color=new M(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],x),o.opacity=e[3]}n.baseColorTexture!==void 0&&c.push(t.assignTexture(o,`map`,n.baseColorTexture,h)),o.metalness=n.metallicFactor===void 0?1:n.metallicFactor,o.roughness=n.roughnessFactor===void 0?1:n.roughnessFactor,n.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(o,`metalnessMap`,n.metallicRoughnessTexture)),c.push(t.assignTexture(o,`roughnessMap`,n.metallicRoughnessTexture))),a=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}i.doubleSided===!0&&(o.side=2);let l=i.alphaMode||J.OPAQUE;if(l===J.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,l===J.MASK&&(o.alphaTest=i.alphaCutoff===void 0?.5:i.alphaCutoff)),i.normalTexture!==void 0&&a!==T&&(c.push(t.assignTexture(o,`normalMap`,i.normalTexture)),o.normalScale=new j(1,1),i.normalTexture.scale!==void 0)){let e=i.normalTexture.scale;o.normalScale.set(e,e)}if(i.occlusionTexture!==void 0&&a!==T&&(c.push(t.assignTexture(o,`aoMap`,i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&a!==T){let e=i.emissiveFactor;o.emissive=new M().setRGB(e[0],e[1],e[2],x)}return i.emissiveTexture!==void 0&&a!==T&&c.push(t.assignTexture(o,`emissiveMap`,i.emissiveTexture,h)),Promise.all(c).then(function(){let n=new a(o);return i.name&&(n.name=i.name),X(n,i),t.associations.set(n,{materials:e}),i.extensions&&Y(r,n,i),n})}createUniqueName(e){let t=we.sanitizeNodeName(e||``);return t in this.nodeNamesUsed?t+`_`+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,n=this.extensions,r=this.primitiveCache;function i(e){return n[I.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return $(n,e,t)})}let a=[];for(let n=0,o=e.length;n<o;n++){let o=e[n],s=it(o),c=r[s];if(c)a.push(c.promise);else{let e;e=o.extensions&&o.extensions[I.KHR_DRACO_MESH_COMPRESSION]?i(o):$(new ue,o,t),r[s]={primitive:o,promise:e},a.push(e)}}return Promise.all(a)}loadMesh(e){let t=this,n=this.json,r=this.extensions,i=n.meshes[e],a=i.primitives,o=[];for(let e=0,t=a.length;e<t;e++){let t=a[e].material===void 0?tt(this.cache):this.getDependency(`material`,a[e].material);o.push(t)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(n){let o=n.slice(0,n.length-1),s=n[n.length-1],c=[];for(let n=0,l=s.length;n<l;n++){let l=s[n],u=a[n],d,p=o[n];if(u.mode===H.TRIANGLES||u.mode===H.TRIANGLE_STRIP||u.mode===H.TRIANGLE_FAN||u.mode===void 0)d=i.isSkinnedMesh===!0?new m(l,p):new be(l,p),d.isSkinnedMesh===!0&&d.normalizeSkinWeights(),u.mode===H.TRIANGLE_STRIP?d.geometry=P(d.geometry,1):u.mode===H.TRIANGLE_FAN&&(d.geometry=P(d.geometry,2));else if(u.mode===H.LINES)d=new ye(l,p);else if(u.mode===H.LINE_STRIP)d=new ae(l,p);else if(u.mode===H.LINE_LOOP)d=new f(l,p);else if(u.mode===H.POINTS)d=new Te(l,p);else throw Error(`THREE.GLTFLoader: Primitive mode unsupported: `+u.mode);Object.keys(d.geometry.morphAttributes).length>0&&rt(d,i),d.name=t.createUniqueName(i.name||`mesh_`+e),X(d,i),u.extensions&&Y(r,d,u),t.assignFinalMaterial(d),c.push(d)}for(let n=0,r=c.length;n<r;n++)t.associations.set(c[n],{meshes:e,primitives:n});if(c.length===1)return i.extensions&&Y(r,c[0],i),c[0];let l=new E;i.extensions&&Y(r,l,i),t.associations.set(l,{meshes:e});for(let e=0,t=c.length;e<t;e++)l.add(c[e]);return l})}loadCamera(e){let t,n=this.json.cameras[e],r=n[n.type];if(!r){console.warn(`THREE.GLTFLoader: Missing camera parameters.`);return}return n.type===`perspective`?t=new le(xe.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):n.type===`orthographic`&&(t=new ge(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),X(t,n),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],n=[];for(let e=0,r=t.joints.length;e<r;e++)n.push(this._loadNodeShallow(t.joints[e]));return t.inverseBindMatrices===void 0?n.push(null):n.push(this.getDependency(`accessor`,t.inverseBindMatrices)),Promise.all(n).then(function(e){let n=e.pop(),r=e,i=[],a=[];for(let e=0,o=r.length;e<o;e++){let o=r[e];if(o){i.push(o);let t=new A;n!==null&&t.fromArray(n.array,e*16),a.push(t)}else console.warn(`THREE.GLTFLoader: Joint "%s" could not be found.`,t.joints[e])}return new o(i,a)})}loadAnimation(e){let t=this.json,n=this,r=t.animations[e],i=r.name?r.name:`animation_`+e,a=[],o=[],s=[],c=[],l=[];for(let e=0,t=r.channels.length;e<t;e++){let t=r.channels[e],n=r.samplers[t.sampler],i=t.target,u=i.node,d=r.parameters===void 0?n.input:r.parameters[n.input],f=r.parameters===void 0?n.output:r.parameters[n.output];i.node!==void 0&&(a.push(this.getDependency(`node`,u)),o.push(this.getDependency(`accessor`,d)),s.push(this.getDependency(`accessor`,f)),c.push(n),l.push(i))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(s),Promise.all(c),Promise.all(l)]).then(function(e){let t=e[0],a=e[1],o=e[2],s=e[3],c=e[4],l=[];for(let e=0,r=t.length;e<r;e++){let r=t[e],i=a[e],u=o[e],d=s[e],f=c[e];if(r===void 0)continue;r.updateMatrix&&r.updateMatrix();let p=n._createAnimationTracks(r,i,u,d,f);if(p)for(let e=0;e<p.length;e++)l.push(p[e])}let u=new fe(i,void 0,l);return X(u,r),u})}createNodeMesh(e){let t=this.json,n=this,r=t.nodes[e];return r.mesh===void 0?null:n.getDependency(`mesh`,r.mesh).then(function(e){let t=n._getNodeRef(n.meshCache,r.mesh,e);return r.weights!==void 0&&t.traverse(function(e){if(e.isMesh)for(let t=0,n=r.weights.length;t<n;t++)e.morphTargetInfluences[t]=r.weights[t]}),t})}loadNode(e){let t=this.json,n=this,r=t.nodes[e],i=n._loadNodeShallow(e),a=[],o=r.children||[];for(let e=0,t=o.length;e<t;e++)a.push(n.getDependency(`node`,o[e]));let s=r.skin===void 0?Promise.resolve(null):n.getDependency(`skin`,r.skin);return Promise.all([i,Promise.all(a),s]).then(function(e){let t=e[0],n=e[1],r=e[2];r!==null&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(r,ot)});for(let e=0,r=n.length;e<r;e++)t.add(n[e]);if(t.userData.pivot!==void 0&&n.length>0){let e=t.userData.pivot,r=n[0];t.pivot=new d().fromArray(e),t.position.x-=e[0],t.position.y-=e[1],t.position.z-=e[2],r.position.set(0,0,0),delete t.userData.pivot}return t})}_loadNodeShallow(e){let t=this.json,n=this.extensions,r=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];let i=t.nodes[e],a=i.name?r.createUniqueName(i.name):``,o=[],s=r._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return s&&o.push(s),i.camera!==void 0&&o.push(r.getDependency(`camera`,i.camera).then(function(e){return r._getNodeRef(r.cameraCache,i.camera,e)})),r._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){o.push(e)}),this.nodeCache[e]=Promise.all(o).then(function(t){let o;if(o=i.isBone===!0?new he:t.length>1?new E:t.length===1?t[0]:new w,o!==t[0])for(let e=0,n=t.length;e<n;e++)o.add(t[e]);if(i.name&&(o.userData.name=i.name,o.name=a),X(o,i),i.extensions&&Y(n,o,i),i.matrix!==void 0){let e=new A;e.fromArray(i.matrix),o.applyMatrix4(e)}else i.translation!==void 0&&o.position.fromArray(i.translation),i.rotation!==void 0&&o.quaternion.fromArray(i.rotation),i.scale!==void 0&&o.scale.fromArray(i.scale);if(!r.associations.has(o))r.associations.set(o,{});else if(i.mesh!==void 0&&r.meshCache.refs[i.mesh]>1){let e=r.associations.get(o);r.associations.set(o,{...e})}return r.associations.get(o).nodes=e,o}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],r=this,i=new E;n.name&&(i.name=r.createUniqueName(n.name)),X(i,n),n.extensions&&Y(t,i,n);let a=n.nodes||[],o=[];for(let e=0,t=a.length;e<t;e++)o.push(r.getDependency(`node`,a[e]));return Promise.all(o).then(function(e){for(let t=0,n=e.length;t<n;t++){let n=e[t];n.parent===null?i.add(n):i.add(De(n))}return r.associations=(e=>{let t=new Map;for(let[e,n]of r.associations)(e instanceof C||e instanceof b)&&t.set(e,n);return e.traverse(e=>{let n=r.associations.get(e);n!=null&&t.set(e,n)}),t})(i),i})}_createAnimationTracks(e,t,n,r,i){let o=[],s=e.name?e.name:e.uuid,c=[];function l(e){e.morphTargetInfluences&&c.push(e.name?e.name:e.uuid)}q[i.path]===q.weights?(l(e),e.isGroup&&e.children.forEach(l)):c.push(s);let u;switch(q[i.path]){case q.weights:u=k;break;case q.rotation:u=a;break;case q.translation:case q.scale:u=ce;break;default:switch(n.itemSize){case 1:u=k;break;default:u=ce;break}break}let d=r.interpolation===void 0?y:et[r.interpolation],f=this._getArrayFromAccessor(n);for(let e=0,n=c.length;e<n;e++){let n=new u(c[e]+`.`+q[i.path],t.array,f,d);r.interpolation===`CUBICSPLINE`&&this._createCubicSplineTrackInterpolant(n),o.push(n)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let e=Q(t.constructor),n=new Float32Array(t.length);for(let r=0,i=t.length;r<i;r++)n[r]=t[r]*e;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof a?Qe:V)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}};function ct(e,t,n){let r=t.attributes,i=new Ce;if(r.POSITION!==void 0){let e=n.json.accessors[r.POSITION],t=e.min,a=e.max;if(t!==void 0&&a!==void 0){if(i.set(new d(t[0],t[1],t[2]),new d(a[0],a[1],a[2])),e.normalized){let t=Q(U[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}else{console.warn(`THREE.GLTFLoader: Missing min/max properties for accessor POSITION.`);return}}else return;let a=t.targets;if(a!==void 0){let e=new d,t=new d;for(let r=0,i=a.length;r<i;r++){let i=a[r];if(i.POSITION!==void 0){let r=n.json.accessors[i.POSITION],a=r.min,o=r.max;if(a!==void 0&&o!==void 0){if(t.setX(Math.max(Math.abs(a[0]),Math.abs(o[0]))),t.setY(Math.max(Math.abs(a[1]),Math.abs(o[1]))),t.setZ(Math.max(Math.abs(a[2]),Math.abs(o[2]))),r.normalized){let e=Q(U[r.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn(`THREE.GLTFLoader: Missing min/max properties for accessor POSITION.`)}}i.expandByVector(e)}e.boundingBox=i;let o=new re;i.getCenter(o.center),o.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=o}function $(e,t,n){let r=t.attributes,i=[];function a(t,r){return n.getDependency(`accessor`,t).then(function(t){e.setAttribute(r,t)})}for(let t in r){let n=K[t]||t.toLowerCase();n in e.attributes||i.push(a(r[t],n))}if(t.indices!==void 0&&!e.index){let r=n.getDependency(`accessor`,t.indices).then(function(t){e.setIndex(t)});i.push(r)}return _.workingColorSpace!==`srgb-linear`&&`COLOR_0`in r&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${_.workingColorSpace}" not supported.`),X(e,t),ct(e,t,n),Promise.all(i).then(function(){return t.targets===void 0?e:nt(e,t.targets,n)})}export{Oe as GLTFLoader};
@@ -0,0 +1,72 @@
1
+ import{Kt as e,Ot as t,T as n}from"./index-D-Iq7tix.js";import{n as r,t as i}from"./Pass-BP3b3hlf.js";var a={name:`OutputShader`,uniforms:{tDiffuse:{value:null},toneMappingExposure:{value:1}},vertexShader:`
2
+ precision highp float;
3
+
4
+ uniform mat4 modelViewMatrix;
5
+ uniform mat4 projectionMatrix;
6
+
7
+ attribute vec3 position;
8
+ attribute vec2 uv;
9
+
10
+ varying vec2 vUv;
11
+
12
+ void main() {
13
+
14
+ vUv = uv;
15
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
16
+
17
+ }`,fragmentShader:`
18
+
19
+ precision highp float;
20
+
21
+ uniform sampler2D tDiffuse;
22
+
23
+ #include <tonemapping_pars_fragment>
24
+ #include <colorspace_pars_fragment>
25
+
26
+ varying vec2 vUv;
27
+
28
+ void main() {
29
+
30
+ gl_FragColor = texture2D( tDiffuse, vUv );
31
+
32
+ // tone mapping
33
+
34
+ #ifdef LINEAR_TONE_MAPPING
35
+
36
+ gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
37
+
38
+ #elif defined( REINHARD_TONE_MAPPING )
39
+
40
+ gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
41
+
42
+ #elif defined( CINEON_TONE_MAPPING )
43
+
44
+ gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
45
+
46
+ #elif defined( ACES_FILMIC_TONE_MAPPING )
47
+
48
+ gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
49
+
50
+ #elif defined( AGX_TONE_MAPPING )
51
+
52
+ gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
53
+
54
+ #elif defined( NEUTRAL_TONE_MAPPING )
55
+
56
+ gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
57
+
58
+ #elif defined( CUSTOM_TONE_MAPPING )
59
+
60
+ gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
61
+
62
+ #endif
63
+
64
+ // color space
65
+
66
+ #ifdef SRGB_TRANSFER
67
+
68
+ gl_FragColor = sRGBTransferOETF( gl_FragColor );
69
+
70
+ #endif
71
+
72
+ }`},o=class extends r{constructor(){super(),this.isOutputPass=!0,this.uniforms=e.clone(a.uniforms),this.material=new t({name:a.name,uniforms:this.uniforms,vertexShader:a.vertexShader,fragmentShader:a.fragmentShader}),this._fsQuad=new i(this.material),this._outputColorSpace=null,this._toneMapping=null}render(e,t,r){this.uniforms.tDiffuse.value=r.texture,this.uniforms.toneMappingExposure.value=e.toneMappingExposure,(this._outputColorSpace!==e.outputColorSpace||this._toneMapping!==e.toneMapping)&&(this._outputColorSpace=e.outputColorSpace,this._toneMapping=e.toneMapping,this.material.defines={},n.getTransfer(this._outputColorSpace)===`srgb`&&(this.material.defines.SRGB_TRANSFER=``),this._toneMapping===1?this.material.defines.LINEAR_TONE_MAPPING=``:this._toneMapping===2?this.material.defines.REINHARD_TONE_MAPPING=``:this._toneMapping===3?this.material.defines.CINEON_TONE_MAPPING=``:this._toneMapping===4?this.material.defines.ACES_FILMIC_TONE_MAPPING=``:this._toneMapping===6?this.material.defines.AGX_TONE_MAPPING=``:this._toneMapping===7?this.material.defines.NEUTRAL_TONE_MAPPING=``:this._toneMapping===5&&(this.material.defines.CUSTOM_TONE_MAPPING=``),this.material.needsUpdate=!0),this.renderToScreen===!0?(e.setRenderTarget(null),this._fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this._fsQuad.render(e))}dispose(){this.material.dispose(),this._fsQuad.dispose()}};export{o as OutputPass};
@@ -0,0 +1 @@
1
+ import{A as e,b as t,gt as n,rt as r}from"./index-D-Iq7tix.js";var i=class{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error(`THREE.Pass: .render() must be implemented in derived pass.`)}dispose(){}},a=new n(-1,1,1,-1,0,1),o=new class extends t{constructor(){super(),this.setAttribute(`position`,new e([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute(`uv`,new e([0,2,0,0,2,0],2))}},s=class{constructor(e){this._mesh=new r(o,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,a)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}};export{i as n,s as t};
@@ -0,0 +1 @@
1
+ import{w as e}from"./index-D-Iq7tix.js";import{n as t}from"./Pass-BP3b3hlf.js";var n=class extends t{constructor(t,n,r=null,i=null,a=null){super(),this.scene=t,this.camera=n,this.overrideMaterial=r,this.clearColor=i,this.clearAlpha=a,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.isRenderPass=!0,this._oldClearColor=new e}render(e,t,n){let r=e.autoClear;e.autoClear=!1;let i,a;this.overrideMaterial!==null&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor!==null&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor,e.getClearAlpha())),this.clearAlpha!==null&&(i=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),this.clearDepth==1&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear===!0&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor!==null&&e.setClearColor(this._oldClearColor),this.clearAlpha!==null&&e.setClearAlpha(i),this.overrideMaterial!==null&&(this.scene.overrideMaterial=a),e.autoClear=r}};export{n as RenderPass};
@@ -0,0 +1,24 @@
1
+ import{Kt as e,Pt as t}from"./index-D-Iq7tix.js";import{n,t as r}from"./Pass-BP3b3hlf.js";var i={name:`CopyShader`,uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
2
+
3
+ varying vec2 vUv;
4
+
5
+ void main() {
6
+
7
+ vUv = uv;
8
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
9
+
10
+ }`,fragmentShader:`
11
+
12
+ uniform float opacity;
13
+
14
+ uniform sampler2D tDiffuse;
15
+
16
+ varying vec2 vUv;
17
+
18
+ void main() {
19
+
20
+ vec4 texel = texture2D( tDiffuse, vUv );
21
+ gl_FragColor = opacity * texel;
22
+
23
+
24
+ }`},a=class extends n{constructor(n,i=`tDiffuse`){super(),this.textureID=i,this.uniforms=null,this.material=null,n instanceof t?(this.uniforms=n.uniforms,this.material=n):n&&(this.uniforms=e.clone(n.uniforms),this.material=new t({name:n.name===void 0?`unspecified`:n.name,defines:Object.assign({},n.defines),uniforms:this.uniforms,vertexShader:n.vertexShader,fragmentShader:n.fragmentShader})),this._fsQuad=new r(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this._fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this._fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this._fsQuad.render(e))}dispose(){this.material.dispose(),this._fsQuad.dispose()}};export{i as n,a as t};
@@ -0,0 +1 @@
1
+ import{Et as e,It as t,Jt as n,Tt as r,Yt as i,d as a,f as o,nt as s}from"./index-D-Iq7tix.js";function c(e,t){return t.getBoneName===void 0?t.names[e.name]:t.getBoneName(e)}function l(e,t,i={}){let a=new r,o=new n,l=new s,u=new s;i.preserveBoneMatrix=i.preserveBoneMatrix===void 0?!0:i.preserveBoneMatrix,i.preserveBonePositions=i.preserveBonePositions===void 0?!0:i.preserveBonePositions,i.useTargetMatrix=i.useTargetMatrix===void 0?!1:i.useTargetMatrix,i.hip=i.hip===void 0?`hip`:i.hip,i.hipInfluence=i.hipInfluence===void 0?new n(1,1,1):i.hipInfluence,i.scale=i.scale===void 0?1:i.scale,i.names=i.names||{};let d=t.isObject3D?t.skeleton.bones:p(t),m=e.isObject3D?e.skeleton.bones:p(e),h,g,_,v;if(e.isObject3D?e.skeleton.pose():(i.useTargetMatrix=!0,i.preserveBoneMatrix=!1),i.preserveBonePositions){v=[];for(let e=0;e<m.length;e++)v.push(m[e].position.clone())}if(i.preserveBoneMatrix){e.updateMatrixWorld(),e.matrixWorld.identity();for(let t=0;t<e.children.length;++t)e.children[t].updateMatrixWorld(!0)}for(let t=0;t<m.length;++t)h=m[t],g=c(h,i),_=f(g,d),u.copy(h.matrixWorld),_&&(_.updateMatrixWorld(),i.useTargetMatrix?l.copy(_.matrixWorld):(l.copy(e.matrixWorld).invert(),l.multiply(_.matrixWorld)),o.setFromMatrixScale(l),l.scale(o.set(1/o.x,1/o.y,1/o.z)),u.makeRotationFromQuaternion(a.setFromRotationMatrix(l)),e.isObject3D&&i.localOffsets&&i.localOffsets[h.name]&&u.multiply(i.localOffsets[h.name]),u.copyPosition(l)),g===i.hip&&(u.elements[12]*=i.scale*i.hipInfluence.x,u.elements[13]*=i.scale*i.hipInfluence.y,u.elements[14]*=i.scale*i.hipInfluence.z,i.hipPosition!==void 0&&(u.elements[12]+=i.hipPosition.x*i.scale,u.elements[13]+=i.hipPosition.y*i.scale,u.elements[14]+=i.hipPosition.z*i.scale)),h.parent?(h.matrix.copy(h.parent.matrixWorld).invert(),h.matrix.multiply(u)):h.matrix.copy(u),h.matrix.decompose(h.position,h.quaternion,h.scale),h.updateMatrixWorld();if(i.preserveBonePositions)for(let e=0;e<m.length;++e)h=m[e],g=c(h,i)||h.name,g!==i.hip&&h.position.copy(v[e]);i.preserveBoneMatrix&&e.updateMatrixWorld(!0)}function u(t,n,r,s={}){s.useFirstFramePosition=s.useFirstFramePosition===void 0?!1:s.useFirstFramePosition,s.fps=s.fps===void 0?Math.max(...r.tracks.map(e=>e.times.length))/r.duration:s.fps,s.names=s.names||[],n.isObject3D||(n=m(n));let u=Math.round(r.duration*(s.fps/1e3)*1e3),d=r.duration/(u-1),h=[],g=new o(n),_=p(t.skeleton),v=[],y,b,x,S,C;g.clipAction(r).play();let w=0,T=u;s.trim===void 0?g.update(0):(w=Math.round(s.trim[0]*s.fps),T=Math.min(Math.round(s.trim[1]*s.fps),u)-w,g.update(s.trim[0])),n.updateMatrixWorld();for(let e=0;e<T;++e){let r=e*d;l(t,n,s);for(let t=0;t<_.length;++t)b=_[t],C=c(b,s)||b.name,x=f(C,n.skeleton),x&&(S=v[t]=v[t]||{bone:b},s.hip===C&&(S.pos||={times:new Float32Array(T),values:new Float32Array(T*3)},s.useFirstFramePosition&&(e===0&&(y=b.position.clone()),b.position.sub(y)),S.pos.times[e]=r,b.position.toArray(S.pos.values,e*3)),S.quat||={times:new Float32Array(T),values:new Float32Array(T*4)},S.quat.times[e]=r,b.quaternion.toArray(S.quat.values,e*4));e===T-2?g.update(d-1e-7):g.update(d),n.updateMatrixWorld()}for(let t=0;t<v.length;++t)S=v[t],S&&(S.pos&&h.push(new i(`.bones[`+S.bone.name+`].position`,S.pos.times,S.pos.values)),h.push(new e(`.bones[`+S.bone.name+`].quaternion`,S.quat.times,S.quat.values)));return g.uncacheAction(r),new a(r.name,-1,h)}function d(e){let t=new Map,n=new Map,r=e.clone();return h(e,r,function(e,r){t.set(r,e),n.set(e,r)}),r.traverse(function(e){if(!e.isSkinnedMesh)return;let r=e,i=t.get(e),a=i.skeleton.bones;r.skeleton=i.skeleton.clone(),r.bindMatrix.copy(i.bindMatrix),r.skeleton.bones=a.map(function(e){return n.get(e)}),r.bind(r.skeleton,r.bindMatrix)}),r}function f(e,t){for(let n=0,r=p(t);n<r.length;n++)if(e===r[n].name)return r[n]}function p(e){return Array.isArray(e)?e:e.bones}function m(e){let n=new t(e.bones[0]);return n.skeleton=e,n}function h(e,t,n){n(e,t);for(let r=0;r<e.children.length;r++)h(e.children[r],t.children[r],n)}export{d as clone,l as retarget,u as retargetClip};
@@ -0,0 +1 @@
1
+ :root{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--panel:#141820eb;--line:#2a3344;--edge:#3d4b64;--accent:#4af0e0}*{box-sizing:border-box}html,body{color:#d6e2f0;background:#15181f;height:100%;margin:0;font:13px/1.5 ui-sans-serif,system-ui,-apple-system,Segoe UI,sans-serif;overflow:hidden}#viewport{touch-action:none;width:100%;height:100%;display:block;position:fixed;inset:0}#sc-ui{z-index:5;pointer-events:none;position:fixed;inset:0}._topbar_1wpzc_5{background:var(--panel);border:1px solid var(--edge);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);pointer-events:auto;scrollbar-width:thin;-webkit-overflow-scrolling:touch;border-radius:12px;align-items:center;gap:2px;width:max-content;max-width:calc(100% - 16px);margin:0 auto;padding:5px;display:flex;position:fixed;top:8px;left:8px;right:8px;overflow:auto hidden;box-shadow:0 6px 24px #00000073}._topbar_1wpzc_5::-webkit-scrollbar{height:0}._tbtn_1wpzc_18{color:#cfe0f2;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:9px;flex:none;justify-content:center;align-items:center;width:40px;height:40px;padding:0;display:flex;position:relative}._tbtn_1wpzc_18 svg{width:21px;height:21px;display:block}._tbtn_1wpzc_18:hover:not(:disabled){color:#eafdff;background:#4af0e01f}._tbtn_1wpzc_18._active_1wpzc_26{border-color:var(--accent);color:#eafdff;background:#4af0e033}._tbtn_1wpzc_18:disabled{opacity:.3;cursor:default}._tbtn_1wpzc_18._save_1wpzc_28._dirty_1wpzc_28{color:var(--accent)}._tbtn_1wpzc_18._save_1wpzc_28._dirty_1wpzc_28:after{content:"";background:var(--accent);border-radius:50%;width:7px;height:7px;position:absolute;top:7px;right:7px}._tbtn_1wpzc_18._save_1wpzc_28._saving_1wpzc_33{opacity:.5}._sep_1wpzc_34{background:var(--line);flex:none;width:1px;height:24px;margin:0 3px}._launcher_1wpzc_37{z-index:6;cursor:pointer;pointer-events:auto;background:var(--panel);border:1px solid var(--edge);color:#cfe0f2;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);border-radius:14px;justify-content:center;align-items:center;width:48px;height:48px;padding:0;display:flex;position:fixed;bottom:12px;left:12px;box-shadow:0 6px 22px #00000073}._launcher_1wpzc_37:hover{color:#eafdff;border-color:var(--accent)}._launcher_1wpzc_37 svg{width:24px;height:24px}._sheet_1wpzc_49{z-index:7;background:var(--panel);border:1px solid var(--edge);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);pointer-events:auto;flex-direction:column;animation:.18s _sheet-in_1wpzc_1;display:flex;position:fixed;box-shadow:0 -8px 40px #0000008c}@keyframes _sheet-in_1wpzc_1{0%{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}._sheet_1wpzc_49{height:min(50vh,460px);padding-bottom:env(safe-area-inset-bottom,0);border-radius:16px 16px 0 0;bottom:0;left:0;right:0}@media (orientation:landscape){._sheet_1wpzc_49{border-radius:16px;width:min(400px,44vw);height:auto;top:12px;bottom:12px}._sheetNodes_1wpzc_70{left:12px;right:auto}._sheetInspector_1wpzc_71{left:auto;right:12px}}._head_1wpzc_74{border-bottom:1px solid var(--line);flex:none;align-items:center;gap:8px;padding:9px 10px 9px 14px;display:flex}._title_1wpzc_78{color:#9fe7ff;letter-spacing:.08em;text-transform:uppercase;text-overflow:ellipsis;white-space:nowrap;flex:0 auto;min-width:0;font:700 11px/1 ui-monospace,monospace;overflow:hidden}._actions_1wpzc_86{scrollbar-width:none;align-items:center;gap:2px;min-width:0;margin-left:auto;display:flex;overflow-x:auto}._actions_1wpzc_86::-webkit-scrollbar{display:none}._headBtn_1wpzc_88{color:#cfe0f2;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:8px;flex:none;justify-content:center;align-items:center;width:34px;height:34px;padding:0;display:flex}._headBtn_1wpzc_88 svg{width:18px;height:18px}._headBtn_1wpzc_88:hover:not(:disabled){color:#eafdff;background:#4af0e01f}._headBtn_1wpzc_88:disabled{opacity:.32;cursor:default}._body_1wpzc_97{-webkit-overflow-scrolling:touch;flex:auto;overflow:auto}._tree_1wpzc_100{padding:4px 0}._node_1wpzc_101{cursor:pointer;white-space:nowrap;color:#d6e2f0;border-radius:6px;align-items:center;gap:4px;height:100%;padding-right:8px;font:12px/1.4 ui-monospace,monospace;display:flex}._node_1wpzc_101:hover{background:#4af0e014}._node_1wpzc_101._sel_1wpzc_107{color:#eafdff;background:#4af0e02e}._node_1wpzc_101._drop_1wpzc_108{box-shadow:inset 0 0 0 1px var(--accent);background:#4af0e024}._caret_1wpzc_109{color:#6f93b8;-webkit-user-select:none;user-select:none;flex:0 0 18px;justify-content:center;align-items:center;width:18px;height:100%;display:flex}._caret_1wpzc_109 svg{width:14px;height:14px}._nodeName_1wpzc_114{text-overflow:ellipsis;overflow:hidden}._nodeType_1wpzc_115{color:#6f93b8;margin-left:6px}._inspector_1wpzc_118{padding:6px 12px 16px;font:12px/1.5 ui-monospace,monospace}._section_1wpzc_119{margin-top:4px}._secHead_1wpzc_120{color:#9fe7ff;border-bottom:1px solid var(--line);cursor:pointer;-webkit-user-select:none;user-select:none;text-transform:uppercase;letter-spacing:.04em;flex-wrap:wrap;align-items:center;gap:4px;margin:10px 0 4px;padding-bottom:3px;font-size:11px;font-weight:700;display:flex}._secHeadPlain_1wpzc_126{cursor:default}._secDesc_1wpzc_130{color:#8a9db5;text-transform:none;letter-spacing:0;white-space:normal;overflow-wrap:anywhere;flex:1 0 100%;margin:2px 0 1px 20px;font-size:10px;font-weight:400;line-height:1.45}._secCaret_1wpzc_138{color:#6f93b8;flex:0 0 14px;align-items:center;width:14px;display:inline-flex}._secCaret_1wpzc_138 svg{width:13px;height:13px}._secBody_1wpzc_140{padding:1px 0 2px}._secActions_1wpzc_145{align-items:center;gap:1px;margin-left:auto;display:inline-flex}._memberBtn_1wpzc_146{color:#7d90a8;cursor:pointer;background:0 0;border:0;border-radius:5px;justify-content:center;align-items:center;width:22px;height:22px;padding:0;display:inline-flex}._memberBtn_1wpzc_146:hover:not(:disabled){color:#eafdff;background:#4af0e024}._memberBtn_1wpzc_146:disabled{opacity:.28;cursor:default}._memberDelete_1wpzc_153:hover:not(:disabled){color:#ff9b9b;background:#ff787829}._memberBtn_1wpzc_146 svg{width:13px;height:13px}._identity_1wpzc_156{align-items:center;gap:8px;padding:6px 0 8px;display:flex}._identityId_1wpzc_157{text-align:left;color:#eafdff;flex:auto;min-width:0;font-weight:700}._row_1wpzc_159{justify-content:space-between;align-items:center;gap:10px;min-height:30px;padding:2px 0;display:flex}._k_1wpzc_160{color:#8fa6c4;flex:none}._v_1wpzc_161{color:#e7f0fb;text-align:right;word-break:break-word;justify-content:flex-end;align-items:center;gap:4px;display:flex}._empty_1wpzc_162{color:#6f8099;padding:16px 4px}._unsetRow_1wpzc_167 ._k_1wpzc_160{color:#61708a}._unsetRow_1wpzc_167 ._input_1wpzc_168,._unsetRow_1wpzc_167 ._swatch_1wpzc_168,._unsetRow_1wpzc_167 ._toggle_1wpzc_168{opacity:.45}._unsetRow_1wpzc_167:focus-within ._input_1wpzc_168,._unsetRow_1wpzc_167:focus-within ._swatch_1wpzc_168,._unsetRow_1wpzc_167:focus-within ._toggle_1wpzc_168{opacity:1}._clearBtn_1wpzc_172{color:#6f8099;cursor:pointer;background:0 0;border:0;border-radius:5px;flex:none;justify-content:center;align-items:center;width:20px;height:20px;margin-left:2px;padding:0;display:inline-flex}._clearBtn_1wpzc_172:hover{color:#ff9b9b;background:#ff787824}._clearBtn_1wpzc_172 svg{width:12px;height:12px}._locked_1wpzc_182{cursor:help}._locked_1wpzc_182 ._k_1wpzc_160{color:#6f8099}._locked_1wpzc_182 ._lockVal_1wpzc_184{color:#7c8ba3}._lockIcon_1wpzc_185{color:#6f8099;opacity:.85;flex:none;width:12px;height:12px}._input_1wpzc_168{color:#e7f0fb;border:1px solid var(--line);background:#0e1219;border-radius:5px;min-height:28px;padding:4px 6px;font:16px ui-monospace,monospace}._input_1wpzc_168:focus{border-color:var(--accent);outline:none}._num_1wpzc_193{text-align:right;width:64px}._axes_1wpzc_194{flex-wrap:wrap;justify-content:flex-end;gap:4px;display:flex}._axis_1wpzc_195{align-items:center;gap:2px;display:flex}._axisK_1wpzc_196{color:#6f93b8;text-align:center;width:12px;font-size:11px}._scrub_1wpzc_197{cursor:ew-resize;touch-action:none}._toggle_1wpzc_168{width:22px;height:22px;accent-color:var(--accent)}._color_1wpzc_199{align-items:center;gap:5px;display:flex}._swatch_1wpzc_168{border:1px solid var(--line);cursor:pointer;background:0 0;border-radius:5px;width:30px;height:28px;padding:0}._hex_1wpzc_201{width:78px}._select_1wpzc_202{cursor:pointer;min-width:96px}._modalBackdrop_1wpzc_207{z-index:9;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);pointer-events:auto;background:#04080e8c;justify-content:center;align-items:center;display:flex;position:fixed;inset:0}._modal_1wpzc_207{background:var(--panel);border:1px solid var(--edge);border-radius:12px;flex-direction:column;width:min(460px,100vw - 32px);max-height:min(70vh,560px);display:flex;overflow:hidden;box-shadow:0 18px 60px #0009}._modalHead_1wpzc_220{border-bottom:1px solid var(--line);flex:none;align-items:center;gap:8px;padding:10px 10px 10px 14px;display:flex}._modalHead_1wpzc_220 ._clearBtn_1wpzc_172{margin-left:auto}._modalFilter_1wpzc_225{flex:none;margin:10px 12px 6px}._modalList_1wpzc_226{flex:auto;padding:2px 6px 8px;overflow-y:auto}._modalItem_1wpzc_227{color:#e7f0fb;text-align:left;cursor:pointer;width:100%;font:inherit;background:0 0;border:0;border-radius:6px;flex-direction:column;align-items:flex-start;gap:2px;padding:7px 8px;display:flex}._modalItem_1wpzc_227:hover{background:#4af0e01f}._modalItemTag_1wpzc_234{color:#9fe7ff;font-weight:700}._modalItemDesc_1wpzc_235{color:#8a9db5;font-size:10px;line-height:1.45}._pickKind_1wpzc_237{color:#7fd8cf;text-transform:uppercase;letter-spacing:.04em;background:#4af0e01f;border-radius:999px;margin-left:8px;padding:1px 6px;font-size:9px;font-weight:600}._addRow_1wpzc_244{border:1px dashed var(--line);color:#7d90a8;cursor:pointer;width:100%;font:inherit;background:0 0;border-radius:6px;justify-content:center;align-items:center;gap:6px;margin:6px 0 2px;padding:5px 0;font-size:11px;display:flex}._addRow_1wpzc_244:hover{border-color:var(--accent);color:#eafdff}._addRow_1wpzc_244 svg{width:13px;height:13px}