diff --git a/.cursor/rules/bim/RULE.md b/.cursor/rules/bim/RULE.md
new file mode 100644
index 0000000..3387317
--- /dev/null
+++ b/.cursor/rules/bim/RULE.md
@@ -0,0 +1,4 @@
+---
+alwaysApply: true
+---
+你是一个资深的前端工程师,我这个项目需要你每次都看下AI_COLLABORATION.md,文件里面有项目的所有信息
\ No newline at end of file
diff --git a/.recycle/2025-12-15/src/managers/tree-manager.ts b/.recycle/2025-12-15/src/managers/tree-manager.ts
new file mode 100644
index 0000000..eef8c2d
--- /dev/null
+++ b/.recycle/2025-12-15/src/managers/tree-manager.ts
@@ -0,0 +1,57 @@
+import { BimComponent } from '../core/component';
+import { BimTree } from '../components/tree/index';
+import { TreeOptions } from '../components/tree/types';
+import type { BimEngine } from '../bim-engine';
+
+/**
+ * 树组件管理器
+ * 负责创建和管理 BimTree 实例
+ */
+export class TreeManager extends BimComponent {
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ constructor(engine: BimEngine, _container: HTMLElement) {
+ super(engine);
+ }
+
+ /**
+ * 创建一个新的树组件实例
+ * @param options 配置选项
+ */
+ public create(options: TreeOptions): BimTree {
+ const tree = new BimTree(options);
+
+ // 绑定事件桥接
+ tree.onNodeCheck = (node) => {
+ this.emit('ui:tree-node-check', {
+ id: node.config.id,
+ checked: node.config.checked || false,
+ node: node.config
+ });
+ };
+
+ tree.onNodeSelect = (node) => {
+ this.emit('ui:tree-node-select', {
+ id: node.config.id,
+ selected: true,
+ node: node.config
+ });
+ };
+
+ tree.onNodeExpand = (node) => {
+ this.emit('ui:tree-node-expand', {
+ id: node.config.id,
+ expanded: node.config.expanded || false
+ });
+ };
+
+ tree.init();
+ return tree;
+ }
+
+ public destroy(): void {
+ // TreeManager 本身不持有 Tree 实例的强引用列表
+ // 实例通常由调用者(如 Dialog)持有并销毁
+ // 这里可以做一些全局清理工作
+ }
+}
diff --git a/AI_COLLABORATION.md b/AI_COLLABORATION.md
index a5e02a8..f8d4424 100644
--- a/AI_COLLABORATION.md
+++ b/AI_COLLABORATION.md
@@ -461,28 +461,19 @@ interface IBimComponent {
- **BimEngine**: 总控制器,通过 Manager 统一管理所有组件
#### 为什么必须通过 Manager?
-1. **统一管理**: Manager 负责组件的生命周期管理,确保资源正确释放
+1. **强制统一管理**: SDK 入口不再导出组件类(如 `BimDialog`),物理上切断了直接实例化的可能。
2. **主题和语言**: Manager 统一应用主题和国际化,保证一致性
3. **事件总线**: Manager 可以监听和发送事件,实现组件间解耦通信
- - 简单场景:直接调用 Manager 方法
- - 复杂场景:通过事件总线进行发布订阅
4. **容器管理**: Manager 管理组件的挂载容器,避免冲突
5. **API 封装**: Manager 提供统一的公共 API,隐藏组件实现细节
#### 使用示例
-**❌ 错误方式 - 直接使用组件:**
+**❌ 错误方式 - 尝试直接导入组件:**
```typescript
-// 错误:直接创建和使用组件
-import { BimDialog } from 'bim-engine-sdk';
-
-const dialog = new BimDialog({
- container: document.getElementById('container'),
- title: '测试弹窗',
- content: '这是内容'
-});
-dialog.init();
-// 问题:没有通过 Manager 管理,无法统一应用主题、语言等
+// 错误:BimDialog 类未导出,会导致编译错误
+import { BimDialog } from 'bim-engine-sdk';
+// Error: Module 'bim-engine-sdk' has no exported member 'BimDialog'.
```
**✅ 正确方式 - 通过 Manager 使用:**
@@ -500,41 +491,15 @@ const dialog = engine.dialog.create({
title: '测试弹窗',
content: '这是内容'
});
-// 优势:
-// 1. 自动应用当前主题
-// 2. 自动应用当前语言
-// 3. 统一管理弹窗实例
-// 4. 可以监听事件总线
-```
-
-**✅ 另一个正确示例 - 工具栏按钮:**
-```typescript
-// 正确:通过 ToolbarManager 操作工具栏
-import { BimEngine } from 'bim-engine-sdk';
-
-const engine = new BimEngine('container');
-
-// 通过 ToolbarManager 添加按钮
-engine.toolbar.addButton({
- id: 'my-button',
- groupId: 'group-1',
- type: 'button',
- label: 'toolbar.myButton',
- icon: '... ',
- onClick: (button) => {
- console.log('按钮被点击');
- }
-});
-
-// 通过 ToolbarManager 控制可见性
-engine.toolbar.setButtonVisibility('my-button', false);
```
#### 组件导出说明
-虽然 `src/index.ts` 中导出了 `BimButtonGroup` 和 `Toolbar` 组件,但这是为了:
-- 高级用户需要完全自定义的场景
-- 内部 Manager 的实现需要
-- **不推荐** 外部用户直接使用,应该通过 Manager
+`src/index.ts` **仅导出** `BimEngine` 主类和必要的类型定义(如 `DialogOptions`)。
+所有具体的组件类(如 `BimDialog`、`Toolbar`)均视为**内部实现细节**,不对外暴露。这意味着:
+- 用户不能继承这些组件类进行扩展。
+- 用户必须依赖 SDK 提供的 Manager API。
+- 这保证了 SDK 内部架构的封闭性和稳定性。
+
### 4.1 Manager 类清单
@@ -545,7 +510,8 @@ engine.toolbar.setButtonVisibility('my-button', false);
| `ButtonGroupManager` | `src/managers/button-group-manager.ts` | 管理通用按钮组 | `BimComponent` |
| `EngineManager` | `src/managers/engine-manager.ts` | 管理 3D 引擎 | `BimComponent` |
| `RightKeyManager` | `src/managers/right-key-manager.ts` | 管理右键菜单 (Context Menu) | `BimComponent` |
-| `ModelTreeManager` | `src/managers/model-tree-manager.ts` | 模型树业务管理器 (组合 Dialog 和 Tree),管理 Tree 实例 | `BimComponent` |
+| `ModelTreeManager` | `src/managers/model-tree-manager.ts` | 模型树业务管理器 | `BimComponent` |
+| `PropertyPanelManager` | `src/managers/property-panel-manager.ts` | 属性面板业务管理器 (演示 Collapse) | `BimComponent` |
### 4.2 组件类清单
@@ -559,7 +525,8 @@ engine.toolbar.setButtonVisibility('my-button', false);
| `BimRightKey` | `src/components/right-key/index.ts` | 右键浮层容器 | `IBimComponent` |
| `BimMenu` | `src/components/menu/index.ts` | 通用菜单列表 | `IBimComponent` |
| `BimTree` | `src/components/tree/index.ts` | 通用树形组件 | `IBimComponent` |
-| `BimTab` | `src/components/tab/index.ts` | 固定标签页组件(无运行时增删,当前在 ConstructTreeManagerBtn 内直接使用) | `IBimComponent` |
+| `BimTab` | `src/components/tab/index.ts` | 固定标签页组件 | `IBimComponent` |
+| `BimCollapse` | `src/components/collapse/index.ts` | 折叠面板组件 | `IBimComponent` |
### 4.3 服务类清单
diff --git a/Untitled b/Untitled
new file mode 100644
index 0000000..1ef2e32
--- /dev/null
+++ b/Untitled
@@ -0,0 +1 @@
+AI_COLLABORATION.md
\ No newline at end of file
diff --git a/demo/index.html b/demo/index.html
index 4364a64..950683b 100644
--- a/demo/index.html
+++ b/demo/index.html
@@ -159,6 +159,14 @@
+
+
🎮 3D 引擎 (Engine3D)
@@ -386,6 +394,17 @@
}
}
+ /**
+ * 打开属性面板
+ */
+ function openPropertyPanel() {
+ if (!engine || !engine.propertyPanel) {
+ console.error('Property panel not available');
+ return;
+ }
+ engine.propertyPanel.show();
+ }
+
/**
* 更新引擎状态显示
*/
diff --git a/dist/bim-engine-sdk.es.js b/dist/bim-engine-sdk.es.js
index fa4b002..7b322c5 100644
--- a/dist/bim-engine-sdk.es.js
+++ b/dist/bim-engine-sdk.es.js
@@ -1,4 +1,4 @@
-(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.bim-engine-wrapper{position:relative;width:100%;height:100%;font-family:sans-serif;color:#bf1d1d;box-sizing:border-box;overflow:hidden}.bim-engine-opt-btn-container{position:absolute;bottom:20px;left:50%;transform:translate(-50%);z-index:100}.bim-construct-tree-btn{position:absolute;top:20px;left:20px!important;z-index:100}.bim-btn-group-root{display:flex;gap:8px;z-index:1000;position:absolute;pointer-events:auto}.bim-btn-group-root.static{position:relative;inset:auto;transform:none}.bim-btn-group-root.dir-row{flex-direction:row;align-items:center}.bim-btn-group-root.dir-column{flex-direction:column;align-items:stretch}.bim-btn-group-section{display:flex;gap:4px;background-color:var(--bim-btn-group-section-bg, rgba(17, 17, 17, .88));border-radius:6px;padding:4px;box-shadow:0 2px 8px #0000004d,0 1px 3px #0003}.bim-btn-group-root.dir-row .bim-btn-group-section{flex-direction:row;align-items:center}.bim-btn-group-root.dir-column .bim-btn-group-section{flex-direction:column}.opt-btn-wrapper{position:relative}.opt-btn{display:flex;cursor:pointer;border-radius:4px;transition:background-color .2s,color .2s;color:var(--bim-btn-text-color, #ccc);background-color:var(--bim-btn-bg, transparent);padding:6px;align-items:center;position:relative;justify-content:center}.opt-btn:hover{background-color:var(--bim-btn-hover-bg, #444)}.opt-btn.active{background-color:var(--bim-btn-active-bg, rgba(255, 255, 255, .15));color:var(--bim-btn-text-active-color, #fff)}.opt-btn.active .opt-btn-icon{color:var(--bim-icon-active-color, #fff)}.opt-btn.disabled{opacity:.5;cursor:not-allowed}.opt-btn-icon{width:var(--bim-icon-size, 24px);height:var(--bim-icon-size, 24px);display:flex;align-items:center;justify-content:center;color:var(--bim-icon-color, #ccc);flex-shrink:0}.opt-btn-icon svg{width:100%;height:100%;fill:currentColor}.opt-btn-arrow{font-size:10px;opacity:.6;transition:transform .2s;display:inline-block;margin-left:4px}.opt-btn-arrow.rotated{transform:rotate(180deg)}.opt-btn-text-wrapper{display:flex;align-items:center;justify-content:center;pointer-events:none}.opt-btn-label{display:inline}.opt-btn.no-label .opt-btn-label{display:none}.opt-btn.align-vertical:not(.no-label){flex-direction:column;text-align:center}.opt-btn.align-vertical:not(.no-label) .opt-btn-text-wrapper{margin-top:4px}.opt-btn.align-vertical:not(.no-label) .opt-btn-label{font-size:12px;line-height:1.2}.opt-btn.align-horizontal:not(.no-label){flex-direction:row}.opt-btn.align-horizontal:not(.no-label) .opt-btn-text-wrapper{margin-left:8px}.opt-btn.align-horizontal:not(.no-label) .opt-btn-label{font-size:14px}.opt-btn.no-label .opt-btn-text-wrapper{width:0;height:0;margin:0;padding:0;overflow:visible;position:absolute;top:0;right:0}.opt-btn.no-label .opt-btn-arrow{position:absolute;top:2px;right:2px;margin:0;font-size:8px}.opt-btn-dropdown{position:absolute;background-color:var(--bim-toolbar-bg, rgba(17, 17, 17, .95));border-radius:4px;padding:4px;box-shadow:0 4px 12px #0003;z-index:1001;display:flex;flex-direction:column;border:1px solid rgba(255,255,255,.1);opacity:0;visibility:hidden;transform:translateY(-10px);transition:opacity .2s ease,transform .2s cubic-bezier(.2,0,.2,1),visibility .2s}@keyframes dropdown-fade-in{0%{opacity:0;transform:translateY(-8px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}.opt-btn-dropdown{animation:dropdown-fade-in .2s cubic-bezier(.2,0,.2,1) forwards;opacity:1;visibility:visible;transform:none}.opt-btn-dropdown-item{display:flex;align-items:center;padding:8px 12px;cursor:pointer;border-radius:4px;color:var(--bim-btn-text-color, #ccc);transition:background .2s;box-sizing:border-box}.opt-btn-dropdown-item:hover{background-color:var(--bim-btn-hover-bg, #444);color:#fff}.opt-btn-dropdown-item.align-horizontal{flex-direction:row}.opt-btn-dropdown-item.align-horizontal .opt-btn-icon{width:18px;height:18px;margin-right:8px}.opt-btn-dropdown-item.align-vertical{flex-direction:column;text-align:center}.opt-btn-dropdown-item.align-vertical .opt-btn-icon{width:24px;height:24px;margin-bottom:4px}.opt-btn-dropdown-item.align-vertical .opt-btn-dropdown-label{font-size:12px}.bim-btn-group-root.is-bottom-toolbar .opt-btn-icon{width:32px;height:32px}.bim-btn-group-root.is-bottom-toolbar .opt-btn{padding:8px}:root{--bim-dialog-bg: rgba(17, 17, 17, .95);--bim-dialog-header-bg: #2a2a2a;--bim-dialog-title-color: #fff;--bim-dialog-text-color: #ccc;--bim-dialog-border-color: #444}.bim-dialog{position:absolute;background-color:var(--bim-dialog-bg);border:1px solid var(--bim-dialog-border-color);border-radius:6px;box-shadow:0 4px 12px #0000004d;display:flex;flex-direction:column;z-index:10001;color:var(--bim-dialog-title-color);overflow:hidden;min-width:200px;min-height:100px;pointer-events:auto}.bim-dialog-header{height:32px;background-color:var(--bim-dialog-header-bg);display:flex;align-items:center;justify-content:space-between;padding:0 10px;cursor:default;-webkit-user-select:none;user-select:none;border-bottom:1px solid var(--bim-dialog-border-color);flex-shrink:0}.bim-dialog-header.draggable{cursor:move}.bim-dialog-title{font-size:14px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--bim-dialog-title-color)}.bim-dialog-close{cursor:pointer;font-size:18px;color:#999;line-height:1;margin-left:8px}.bim-dialog-close:hover{color:#fff}.bim-dialog-content{flex:1;padding:10px;overflow:auto;font-size:14px;color:var(--bim-dialog-text-color)}.bim-dialog-resize-handle{position:absolute;width:10px;height:10px;bottom:0;right:0;cursor:se-resize;z-index:10}.bim-dialog-resize-handle:after{content:"";position:absolute;bottom:3px;right:3px;width:6px;height:6px;border-right:2px solid #666;border-bottom:2px solid #666}.bim-dialog-resize-handle:hover:after{border-color:#fff}.bim-info-dialog-content{padding:16px;font-family:sans-serif;color:#333}.bim-info-dialog-content h3{margin-top:0;margin-bottom:12px;border-bottom:1px solid #eee;padding-bottom:8px;color:#0078d4}.bim-info-dialog-content ul{list-style:none;padding:0;margin:0}.bim-info-dialog-content li{margin-bottom:8px;font-size:14px;display:flex}.bim-info-dialog-content li strong{width:80px;color:#555}.bim-right-key{position:fixed;z-index:10000;display:none;background:transparent}.bim-right-key.visible{display:block}.bim-menu{display:flex;flex-direction:column;background:var(--bim-ui_bg_color, #2b2d30);border-radius:4px;padding:4px 0;margin:0;list-style:none;min-width:160px;box-shadow:0 4px 12px #0003;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;-webkit-user-select:none;user-select:none;color:var(--bim-ui_text_primary, #ffffff)}.bim-menu-group{display:flex;flex-direction:column}.bim-menu-divider{height:1px;background-color:var(--bim-ui_border_color, #3e4145);margin:4px 0}.bim-menu-item{display:flex;align-items:center;padding:6px 12px;cursor:pointer;transition:background-color .2s;font-size:13px;position:relative;color:var(--bim-ui_text_primary, #ffffff)}.bim-menu-item:hover{background-color:var(--bim-ui_bg_hover, #3e4145)}.bim-menu-item.disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.bim-menu-item-icon{width:16px;height:16px;margin-right:8px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.bim-menu-item-icon svg{width:100%;height:100%;fill:currentColor}.bim-menu-item-label{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.bim-menu-item-arrow{width:12px;height:12px;margin-left:8px;display:flex;align-items:center;justify-content:center;opacity:.7}.bim-menu-item-arrow svg{width:100%;height:100%;fill:currentColor}.bim-tree{width:100%;height:100%;display:flex;flex-direction:column;overflow:hidden;font-size:14px;color:var(--bim-ui_text_primary, #333);-webkit-user-select:none;user-select:none;position:relative;background:transparent}.bim-tree-search{padding:6px;background-color:transparent;flex-shrink:0;position:relative}.bim-tree-search-wrapper{position:relative;width:100%;display:flex;align-items:center}.bim-tree-search-icon{position:absolute;left:8px;width:16px;height:16px;color:var(--bim-ui_text_secondary, #999);pointer-events:none;display:flex;align-items:center;justify-content:center}.bim-tree-search-icon svg{width:100%;height:100%}.bim-tree-search-input{width:100%;height:30px;padding:4px 8px 4px 30px;border:1px solid var(--bim-ui_border_color, #d9d9d9);border-radius:4px;outline:none;font-size:13px;color:inherit;background-color:var(--bim-ui_bg_color, #fff);transition:all .2s;box-sizing:border-box}.bim-tree-search-input:focus{border-color:var(--bim-primary_color, #1890ff);box-shadow:0 0 0 2px #1890ff33}.bim-tree-search-results{position:absolute;top:100%;left:8px;right:8px;background-color:var(--bim-ui_bg_color, #fff);border:1px solid var(--bim-ui_border_color, #eee);box-shadow:0 4px 12px #00000026;border-radius:4px;max-height:200px;overflow-y:auto;z-index:10;display:none}.bim-tree-search-results.is-visible{display:block}.bim-tree-search-item{padding:8px 12px;cursor:pointer;border-bottom:1px solid rgba(0,0,0,.03)}.bim-tree-search-item:last-child{border-bottom:none}.bim-tree-search-item:hover{background-color:var(--bim-ui_bg_hover, #f5f5f5)}.bim-tree-search-item-title{font-weight:500;display:block}.bim-tree-search-item-path{font-size:12px;color:var(--bim-ui_text_secondary, #999);margin-top:2px;display:block}.bim-tree-content{flex:1;overflow-y:auto;padding:2px 0;min-height:0}.bim-tree-node{display:flex;flex-direction:column}.bim-tree-node-content{display:flex;align-items:center;height:32px;cursor:pointer;transition:background-color .2s;border-radius:4px;padding-right:8px}.bim-tree-node-content:hover{background-color:var(--bim-ui_bg_hover, rgba(0, 0, 0, .05))}.bim-tree-switcher{width:24px;height:32px;display:flex;align-items:center;justify-content:center;cursor:pointer;color:var(--bim-ui_text_secondary, #999);transition:transform .2s;flex-shrink:0}.bim-tree-switcher svg{width:12px;height:12px;fill:currentColor;transition:transform .2s}.bim-tree-switcher.is-expanded svg{transform:rotate(90deg)}.bim-tree-switcher.is-hidden{visibility:hidden}.bim-tree-checkbox{width:16px;height:16px;border:1px solid var(--bim-ui_border_color, #d9d9d9);border-radius:2px;margin-right:8px;background-color:var(--bim-ui_bg_color, #fff);position:relative;cursor:pointer;flex-shrink:0;transition:all .2s}.bim-tree-checkbox:hover{border-color:var(--bim-primary_color, #1890ff)}.bim-tree-checkbox.is-checked{background-color:var(--bim-primary_color, #1890ff);border-color:var(--bim-primary_color, #1890ff)}.bim-tree-checkbox.is-checked:after{content:"";position:absolute;top:1px;left:4px;width:5px;height:9px;border:2px solid #fff;border-top:0;border-left:0;transform:rotate(45deg)}.bim-tree-checkbox.is-indeterminate{background-color:var(--bim-ui_bg_color, #fff);border-color:var(--bim-primary_color, #1890ff)}.bim-tree-checkbox.is-indeterminate:after{content:"";position:absolute;top:6px;left:3px;width:8px;height:2px;background-color:var(--bim-primary_color, #1890ff)}.bim-tree-node.is-disabled .bim-tree-checkbox{background-color:#f5f5f5;border-color:#d9d9d9;cursor:not-allowed}.bim-tree-node.is-disabled .bim-tree-checkbox.is-checked{background-color:#d9d9d9}.bim-tree-node.is-disabled .bim-tree-node-content{color:var(--bim-ui_text_disabled, #ccc);cursor:not-allowed}.bim-tree-icon{width:16px;height:16px;margin-right:6px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.bim-tree-icon img,.bim-tree-icon svg{width:100%;height:100%}.bim-tree-title{flex:1;white-space:nowrap}.bim-tree-children{display:none;overflow:visible}.bim-tree-children.is-visible{display:block}.bim-tree-node-content.is-selected{background-color:var(--bim-ui_bg_selected, rgba(24, 144, 255, .2));color:var(--bim-primary_color, #1890ff)}.bim-tree-node-actions{display:none;align-items:center;margin-left:8px;flex-shrink:0}.bim-tree-node-content.is-selected .bim-tree-node-actions{display:flex}.bim-tree-content{flex:1;overflow:auto;padding:2px 0;min-height:0}.bim-tree-node{display:flex;flex-direction:column;width:fit-content;min-width:100%}.bim-tree-node-content{display:flex;align-items:center;height:32px;cursor:pointer;transition:background-color .2s;border-radius:4px;padding-right:8px;width:fit-content;min-width:100%;box-sizing:border-box}.bim-tab{display:flex;flex-direction:column;width:100%;height:100%;background:transparent;color:var(--bim-tab-text, #e6e6e6)}.bim-tab__nav{display:flex;align-items:center;justify-content:center;gap:10px;padding:4px 0;background:transparent}.bim-tab__item{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:4px 0;border:none;border-radius:0;background:transparent;color:var(--bim-tab-text, #e6e6e6);cursor:pointer;transition:color .2s ease,border-color .2s ease;font-size:14px;border-bottom:2px solid transparent}.bim-tab__item:hover:not(.is-disabled):not(.is-active){color:var(--bim-tab-text, #e6e6e6);border-bottom-color:var(--bim-tab-border, rgba(255, 255, 255, .15))}.bim-tab__item.is-active{color:var(--bim-tab-text-active, #4da3ff);border-bottom-color:var(--bim-tab-text-active, #4da3ff)}.bim-tab__item.is-disabled{opacity:.5;cursor:not-allowed}.bim-tab__icon{width:16px;height:16px;display:inline-flex;align-items:center;justify-content:center;color:var(--bim-tab-icon, currentColor)}.bim-tab__icon svg{width:100%;height:100%;fill:currentColor}.bim-tab__title{white-space:nowrap}.bim-tab__content{flex:1;display:flex;position:relative;min-height:0;overflow:hidden}.bim-tab__panel{display:none;width:100%;height:100%;flex:1}.bim-tab__panel.is-active{display:flex;flex-direction:column;height:100%}.construct-tab__container{height:100%;display:flex;flex-direction:column}.construct-tab__panel-content{flex:1;display:flex;flex-direction:column;min-height:0;overflow:hidden}.construct-tab__panel-content .bim-tree{flex:1}')),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
+(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode('.bim-engine-wrapper{position:relative;width:100%;height:100%;font-family:sans-serif;color:#bf1d1d;box-sizing:border-box;overflow:hidden}.bim-engine-opt-btn-container{position:absolute;bottom:20px;left:50%;transform:translate(-50%);z-index:100}.bim-construct-tree-btn{position:absolute;top:20px;left:20px!important;z-index:100}.bim-btn-group-root{display:flex;gap:8px;z-index:1000;position:absolute;pointer-events:auto}.bim-btn-group-root.static{position:relative;inset:auto;transform:none}.bim-btn-group-root.dir-row{flex-direction:row;align-items:center}.bim-btn-group-root.dir-column{flex-direction:column;align-items:stretch}.bim-btn-group-section{display:flex;gap:4px;background-color:var(--bim-btn-group-section-bg, rgba(17, 17, 17, .88));border-radius:6px;padding:4px;box-shadow:0 2px 8px #0000004d,0 1px 3px #0003}.bim-btn-group-root.dir-row .bim-btn-group-section{flex-direction:row;align-items:center}.bim-btn-group-root.dir-column .bim-btn-group-section{flex-direction:column}.opt-btn-wrapper{position:relative}.opt-btn{display:flex;cursor:pointer;border-radius:4px;transition:background-color .2s,color .2s;color:var(--bim-btn-text-color, #ccc);background-color:var(--bim-btn-bg, transparent);padding:6px;align-items:center;position:relative;justify-content:center}.opt-btn:hover{background-color:var(--bim-btn-hover-bg, #444)}.opt-btn.active{background-color:var(--bim-btn-active-bg, rgba(255, 255, 255, .15));color:var(--bim-btn-text-active-color, #fff)}.opt-btn.active .opt-btn-icon{color:var(--bim-icon-active-color, #fff)}.opt-btn.disabled{opacity:.5;cursor:not-allowed}.opt-btn-icon{width:var(--bim-icon-size, 24px);height:var(--bim-icon-size, 24px);display:flex;align-items:center;justify-content:center;color:var(--bim-icon-color, #ccc);flex-shrink:0}.opt-btn-icon svg{width:100%;height:100%;fill:currentColor}.opt-btn-arrow{font-size:10px;opacity:.6;transition:transform .2s;display:inline-block;margin-left:4px}.opt-btn-arrow.rotated{transform:rotate(180deg)}.opt-btn-text-wrapper{display:flex;align-items:center;justify-content:center;pointer-events:none}.opt-btn-label{display:inline}.opt-btn.no-label .opt-btn-label{display:none}.opt-btn.align-vertical:not(.no-label){flex-direction:column;text-align:center}.opt-btn.align-vertical:not(.no-label) .opt-btn-text-wrapper{margin-top:4px}.opt-btn.align-vertical:not(.no-label) .opt-btn-label{font-size:12px;line-height:1.2}.opt-btn.align-horizontal:not(.no-label){flex-direction:row}.opt-btn.align-horizontal:not(.no-label) .opt-btn-text-wrapper{margin-left:8px}.opt-btn.align-horizontal:not(.no-label) .opt-btn-label{font-size:14px}.opt-btn.no-label .opt-btn-text-wrapper{width:0;height:0;margin:0;padding:0;overflow:visible;position:absolute;top:0;right:0}.opt-btn.no-label .opt-btn-arrow{position:absolute;top:2px;right:2px;margin:0;font-size:8px}.opt-btn-dropdown{position:absolute;background-color:var(--bim-toolbar-bg, rgba(17, 17, 17, .95));border-radius:4px;padding:4px;box-shadow:0 4px 12px #0003;z-index:1001;display:flex;flex-direction:column;border:1px solid rgba(255,255,255,.1);opacity:0;visibility:hidden;transform:translateY(-10px);transition:opacity .2s ease,transform .2s cubic-bezier(.2,0,.2,1),visibility .2s}@keyframes dropdown-fade-in{0%{opacity:0;transform:translateY(-8px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}.opt-btn-dropdown{animation:dropdown-fade-in .2s cubic-bezier(.2,0,.2,1) forwards;opacity:1;visibility:visible;transform:none}.opt-btn-dropdown-item{display:flex;align-items:center;padding:8px 12px;cursor:pointer;border-radius:4px;color:var(--bim-btn-text-color, #ccc);transition:background .2s;box-sizing:border-box}.opt-btn-dropdown-item:hover{background-color:var(--bim-btn-hover-bg, #444);color:#fff}.opt-btn-dropdown-item.align-horizontal{flex-direction:row}.opt-btn-dropdown-item.align-horizontal .opt-btn-icon{width:18px;height:18px;margin-right:8px}.opt-btn-dropdown-item.align-vertical{flex-direction:column;text-align:center}.opt-btn-dropdown-item.align-vertical .opt-btn-icon{width:24px;height:24px;margin-bottom:4px}.opt-btn-dropdown-item.align-vertical .opt-btn-dropdown-label{font-size:12px}.bim-btn-group-root.is-bottom-toolbar .opt-btn-icon{width:32px;height:32px}.bim-btn-group-root.is-bottom-toolbar .opt-btn{padding:8px}:root{--bim-dialog-bg: rgba(17, 17, 17, .95);--bim-dialog-header-bg: #2a2a2a;--bim-dialog-title-color: #fff;--bim-dialog-text-color: #ccc;--bim-dialog-border-color: #444}.bim-dialog{position:absolute;background-color:var(--bim-dialog-bg);border:1px solid var(--bim-dialog-border-color);border-radius:6px;box-shadow:0 4px 12px #0000004d;display:flex;flex-direction:column;z-index:10001;color:var(--bim-dialog-title-color);overflow:hidden;min-width:200px;min-height:100px;pointer-events:auto}.bim-dialog-header{height:32px;background-color:var(--bim-dialog-header-bg);display:flex;align-items:center;justify-content:space-between;padding:0 10px;cursor:default;-webkit-user-select:none;user-select:none;border-bottom:1px solid var(--bim-dialog-border-color);flex-shrink:0}.bim-dialog-header.draggable{cursor:move}.bim-dialog-title{font-size:14px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--bim-dialog-title-color)}.bim-dialog-close{cursor:pointer;font-size:18px;color:#999;line-height:1;margin-left:8px}.bim-dialog-close:hover{color:#fff}.bim-dialog-content{flex:1;overflow:auto;font-size:14px;color:var(--bim-dialog-text-color)}.bim-dialog-resize-handle{position:absolute;width:10px;height:10px;bottom:0;right:0;cursor:se-resize;z-index:10}.bim-dialog-resize-handle:after{content:"";position:absolute;bottom:3px;right:3px;width:6px;height:6px;border-right:2px solid #666;border-bottom:2px solid #666}.bim-dialog-resize-handle:hover:after{border-color:#fff}.bim-info-dialog-content{padding:16px;font-family:sans-serif;color:#333}.bim-info-dialog-content h3{margin-top:0;margin-bottom:12px;border-bottom:1px solid #eee;padding-bottom:8px;color:#0078d4}.bim-info-dialog-content ul{list-style:none;padding:0;margin:0}.bim-info-dialog-content li{margin-bottom:8px;font-size:14px;display:flex}.bim-info-dialog-content li strong{width:80px;color:#555}.bim-right-key{position:fixed;z-index:10000;display:none;background:transparent}.bim-right-key.visible{display:block}.bim-menu{display:flex;flex-direction:column;background:var(--bim-ui_bg_color, #2b2d30);border-radius:4px;padding:4px 0;margin:0;list-style:none;min-width:160px;box-shadow:0 4px 12px #0003;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;-webkit-user-select:none;user-select:none;color:var(--bim-ui_text_primary, #ffffff)}.bim-menu-group{display:flex;flex-direction:column}.bim-menu-divider{height:1px;background-color:var(--bim-ui_border_color, #3e4145);margin:4px 0}.bim-menu-item{display:flex;align-items:center;padding:6px 12px;cursor:pointer;transition:background-color .2s;font-size:13px;position:relative;color:var(--bim-ui_text_primary, #ffffff)}.bim-menu-item:hover{background-color:var(--bim-ui_bg_hover, #3e4145)}.bim-menu-item.disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.bim-menu-item-icon{width:16px;height:16px;margin-right:8px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.bim-menu-item-icon svg{width:100%;height:100%;fill:currentColor}.bim-menu-item-label{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.bim-menu-item-arrow{width:12px;height:12px;margin-left:8px;display:flex;align-items:center;justify-content:center;opacity:.7}.bim-menu-item-arrow svg{width:100%;height:100%;fill:currentColor}.bim-tree{width:100%;height:100%;display:flex;flex-direction:column;overflow:hidden;font-size:14px;color:var(--bim-ui_text_primary, #333);-webkit-user-select:none;user-select:none;position:relative;background:transparent}.bim-tree-search{padding:6px;background-color:transparent;flex-shrink:0;position:relative}.bim-tree-search-wrapper{position:relative;width:100%;display:flex;align-items:center}.bim-tree-search-icon{position:absolute;left:8px;width:16px;height:16px;color:var(--bim-ui_text_secondary, #999);pointer-events:none;display:flex;align-items:center;justify-content:center}.bim-tree-search-icon svg{width:100%;height:100%}.bim-tree-search-input{width:100%;height:30px;padding:4px 8px 4px 30px;border:1px solid var(--bim-ui_border_color, #d9d9d9);border-radius:4px;outline:none;font-size:13px;color:inherit;background-color:var(--bim-ui_bg_color, #fff);transition:all .2s;box-sizing:border-box}.bim-tree-search-input:focus{border-color:var(--bim-primary_color, #1890ff);box-shadow:0 0 0 2px #1890ff33}.bim-tree-search-results{position:absolute;top:100%;left:8px;right:8px;background-color:var(--bim-ui_bg_color, #fff);border:1px solid var(--bim-ui_border_color, #eee);box-shadow:0 4px 12px #00000026;border-radius:4px;max-height:200px;overflow-y:auto;z-index:10;display:none}.bim-tree-search-results.is-visible{display:block}.bim-tree-search-item{padding:8px 12px;cursor:pointer;border-bottom:1px solid rgba(0,0,0,.03)}.bim-tree-search-item:last-child{border-bottom:none}.bim-tree-search-item:hover{background-color:var(--bim-ui_bg_hover, #f5f5f5)}.bim-tree-search-item-title{font-weight:500;display:block}.bim-tree-search-item-path{font-size:12px;color:var(--bim-ui_text_secondary, #999);margin-top:2px;display:block}.bim-tree-content{flex:1;overflow-y:auto;padding:2px 0;min-height:0}.bim-tree-node{display:flex;flex-direction:column}.bim-tree-node-content{display:flex;align-items:center;height:32px;cursor:pointer;transition:background-color .2s;border-radius:4px;padding-right:8px}.bim-tree-node-content:hover{background-color:var(--bim-ui_bg_hover, rgba(0, 0, 0, .05))}.bim-tree-switcher{width:24px;height:32px;display:flex;align-items:center;justify-content:center;cursor:pointer;color:var(--bim-ui_text_secondary, #999);transition:transform .2s;flex-shrink:0}.bim-tree-switcher svg{width:12px;height:12px;fill:currentColor;transition:transform .2s}.bim-tree-switcher.is-expanded svg{transform:rotate(90deg)}.bim-tree-switcher.is-hidden{visibility:hidden}.bim-tree-checkbox{width:16px;height:16px;border:1px solid var(--bim-ui_border_color, #d9d9d9);border-radius:2px;margin-right:8px;background-color:var(--bim-ui_bg_color, #fff);position:relative;cursor:pointer;flex-shrink:0;transition:all .2s}.bim-tree-checkbox:hover{border-color:var(--bim-primary_color, #1890ff)}.bim-tree-checkbox.is-checked{background-color:var(--bim-primary_color, #1890ff);border-color:var(--bim-primary_color, #1890ff)}.bim-tree-checkbox.is-checked:after{content:"";position:absolute;top:1px;left:4px;width:5px;height:9px;border:2px solid #fff;border-top:0;border-left:0;transform:rotate(45deg)}.bim-tree-checkbox.is-indeterminate{background-color:var(--bim-ui_bg_color, #fff);border-color:var(--bim-primary_color, #1890ff)}.bim-tree-checkbox.is-indeterminate:after{content:"";position:absolute;top:6px;left:3px;width:8px;height:2px;background-color:var(--bim-primary_color, #1890ff)}.bim-tree-node.is-disabled .bim-tree-checkbox{background-color:#f5f5f5;border-color:#d9d9d9;cursor:not-allowed}.bim-tree-node.is-disabled .bim-tree-checkbox.is-checked{background-color:#d9d9d9}.bim-tree-node.is-disabled .bim-tree-node-content{color:var(--bim-ui_text_disabled, #ccc);cursor:not-allowed}.bim-tree-icon{width:16px;height:16px;margin-right:6px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.bim-tree-icon img,.bim-tree-icon svg{width:100%;height:100%}.bim-tree-title{flex:1;white-space:nowrap}.bim-tree-children{display:none;overflow:visible}.bim-tree-children.is-visible{display:block}.bim-tree-node-content.is-selected{background-color:var(--bim-ui_bg_selected, rgba(24, 144, 255, .2));color:var(--bim-primary_color, #1890ff)}.bim-tree-node-actions{display:none;align-items:center;margin-left:8px;flex-shrink:0}.bim-tree-node-content.is-selected .bim-tree-node-actions{display:flex}.bim-tree-content{flex:1;overflow:auto;padding:2px 0;min-height:0}.bim-tree-node{display:flex;flex-direction:column;width:fit-content;min-width:100%}.bim-tree-node-content{display:flex;align-items:center;height:32px;cursor:pointer;transition:background-color .2s;border-radius:4px;padding-right:8px;width:fit-content;min-width:100%;box-sizing:border-box}.bim-tab{display:flex;flex-direction:column;width:100%;height:100%;background:transparent;color:var(--bim-tab-text, #e6e6e6)}.bim-tab__nav{display:flex;align-items:center;justify-content:center;gap:10px;padding:4px 0;background:transparent}.bim-tab__item{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:4px 0;border:none;border-radius:0;background:transparent;color:var(--bim-tab-text, #e6e6e6);cursor:pointer;transition:color .2s ease,border-color .2s ease;font-size:14px;border-bottom:2px solid transparent}.bim-tab__item:hover:not(.is-disabled):not(.is-active){color:var(--bim-tab-text, #e6e6e6);border-bottom-color:var(--bim-tab-border, rgba(255, 255, 255, .15))}.bim-tab__item.is-active{color:var(--bim-tab-text-active, #4da3ff);border-bottom-color:var(--bim-tab-text-active, #4da3ff)}.bim-tab__item.is-disabled{opacity:.5;cursor:not-allowed}.bim-tab__icon{width:16px;height:16px;display:inline-flex;align-items:center;justify-content:center;color:var(--bim-tab-icon, currentColor)}.bim-tab__icon svg{width:100%;height:100%;fill:currentColor}.bim-tab__title{white-space:nowrap}.bim-tab__content{flex:1;display:flex;position:relative;min-height:0;overflow:hidden}.bim-tab__panel{display:none;width:100%;height:100%;flex:1}.bim-tab__panel.is-active{display:flex;flex-direction:column;height:100%}.construct-tab__container{height:100%;display:flex;flex-direction:column}.construct-tab__panel-content{flex:1;display:flex;flex-direction:column;min-height:0;overflow:hidden}.construct-tab__panel-content .bim-tree{flex:1}.bim-collapse{background-color:var(--bim-bg-color, #ffffff);border:1px solid var(--bim-border-color, #d9d9d9);border-radius:4px;font-size:14px;color:var(--bim-text-color, rgba(0, 0, 0, .88))}.bim-collapse.is-ghost{background-color:transparent;border:none}.bim-collapse.is-ghost .bim-collapse-item{border-bottom:none}.bim-collapse.is-ghost .bim-collapse-header{background-color:transparent;padding-left:0;padding-right:0}.bim-collapse.is-ghost .bim-collapse-content{background-color:transparent;border-top:none}.bim-collapse-item{border-bottom:1px solid var(--bim-border-color, #d9d9d9)}.bim-collapse-item:last-child{border-bottom:none}.bim-collapse-item.is-disabled .bim-collapse-header{color:var(--bim-disabled-color, rgba(0, 0, 0, .25));cursor:not-allowed}.bim-collapse-header{display:flex;align-items:center;padding:12px 16px;background-color:var(--bim-header-bg-color, rgba(0, 0, 0, .02));cursor:pointer;transition:all .3s;position:relative}.bim-collapse-header:hover{background-color:var(--bim-header-hover-bg-color, rgba(0, 0, 0, .05))}.bim-collapse-arrow{margin-right:12px;font-size:12px;width:12px;height:12px;transition:transform .24s;display:inline-flex;align-items:center;justify-content:center}.bim-collapse-arrow svg{width:100%;height:100%;fill:currentColor}.bim-collapse-item.is-active .bim-collapse-arrow{transform:rotate(90deg)}.bim-collapse-icon{margin-right:8px;display:inline-flex;align-items:center}.bim-collapse-icon svg{width:16px;height:16px;fill:currentColor}.bim-collapse-title{flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.bim-collapse-extra{margin-left:auto}.bim-collapse-content{overflow:hidden;background-color:var(--bim-content-bg-color, #ffffff);border-top:1px solid var(--bim-border-color, #d9d9d9);transition:height .2s ease-in-out,opacity .2s ease-in-out}.bim-collapse-content.is-hidden{display:none}.bim-collapse-content-box{padding:16px}')),document.head.appendChild(o)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
const jh = {
common: {
title: "BimEngine",
@@ -12,9 +12,10 @@ const jh = {
location: "定位",
setting: "设置",
walk: "漫游",
- walkPerson: "人视",
- walkBird: "鸟瞰",
- walkMenu: "菜单"
+ walkMenu: "漫游菜单",
+ walkPerson: "第一人称",
+ walkBird: "第三人称",
+ tree: "模型树"
},
dialog: {
testTitle: "测试弹窗",
@@ -34,6 +35,14 @@ const jh = {
component: "构件",
system: "系统",
space: "空间"
+ },
+ panel: {
+ property: {
+ title: "属性面板",
+ base: "基本属性",
+ material: "材质信息",
+ advanced: "高级设置"
+ }
}
}, Xh = {
common: {
@@ -50,7 +59,8 @@ const jh = {
walk: "Walk",
walkPerson: "Person",
walkBird: "Bird Eye",
- walkMenu: "Menu"
+ walkMenu: "Menu",
+ tree: "Tree"
},
dialog: {
testTitle: "Test Dialog",
@@ -70,6 +80,14 @@ const jh = {
component: "Component",
system: "System",
space: "Space"
+ },
+ panel: {
+ property: {
+ title: "Property Panel",
+ base: "Basic Info",
+ material: "Material",
+ advanced: "Advanced"
+ }
}
};
class qh {
@@ -119,7 +137,7 @@ class qh {
this.listeners.forEach((e) => e(this.currentLocale));
}
}
-const Vi = new qh(), ir = (s) => Vi.t(s), ll = {
+const Ei = new qh(), wi = (s) => Ei.t(s), ll = {
name: "dark",
primary: "#0078d4",
primaryHover: "#0063b1",
@@ -193,7 +211,7 @@ class Kh {
this.listeners.forEach((e) => e(this.currentTheme));
}
}
-const Ft = new Kh();
+const Lt = new Kh();
class wo {
container;
options;
@@ -352,9 +370,9 @@ class wo {
}), this.applyStyles();
}
async init() {
- this.render(), this.unsubscribeLocale = Vi.subscribe(() => {
+ this.render(), this.unsubscribeLocale = Ei.subscribe(() => {
this.setLocales();
- }), this.unsubscribeTheme = Ft.subscribe((e) => {
+ }), this.unsubscribeTheme = Lt.subscribe((e) => {
this.setTheme(e);
});
}
@@ -416,7 +434,7 @@ class wo {
const c = document.createElement("div");
if (c.className = "opt-btn-text-wrapper", this.options.showLabel && e.label) {
const h = document.createElement("span");
- h.className = "opt-btn-label", h.textContent = ir(e.label), c.appendChild(h);
+ h.className = "opt-btn-label", h.textContent = wi(e.label), c.appendChild(h);
}
if (e.children && e.children.length > 0) {
const h = document.createElement("span");
@@ -457,7 +475,7 @@ class wo {
const a = document.createElement("div");
if (a.className = "opt-btn-icon", a.style.width = `${r}px`, a.style.height = `${r}px`, a.innerHTML = this.getIcon(e.icon), t.appendChild(a), this.options.showLabel && e.label) {
const o = document.createElement("span");
- o.className = "opt-btn-dropdown-label", o.textContent = ir(e.label), t.appendChild(o);
+ o.className = "opt-btn-dropdown-label", o.textContent = wi(e.label), t.appendChild(o);
}
return t.addEventListener("click", (o) => {
o.stopPropagation(), this.handleClick(e);
@@ -511,11 +529,11 @@ class Zh extends wo {
*/
async init() {
await super.init();
- const { createHomeButton: e } = await import("./index-omAK6EVd.mjs"), { locationButton: t } = await import("./index-Cadgm6mg.mjs"), { walkMenuButton: i } = await import("./index-BzDQeHxh.mjs"), { walkPersonButton: r } = await import("./index-CIgUZcJM.mjs"), { walkBirdButton: n } = await import("./index-psziCat8.mjs"), { settingButton: a } = await import("./index-DSz8VpYf.mjs"), { infoButton: o } = await import("./index-C4v-Lg_Y.mjs");
+ const { createHomeButton: e } = await import("./index-omAK6EVd.mjs"), { locationButton: t } = await import("./index-Cadgm6mg.mjs"), { walkMenuButton: i } = await import("./index-BzDQeHxh.mjs"), { walkPersonButton: r } = await import("./index-CIgUZcJM.mjs"), { walkBirdButton: n } = await import("./index-psziCat8.mjs"), { settingButton: a } = await import("./index-DSz8VpYf.mjs"), { infoButton: o } = await import("./index-CTr2kkHr.mjs");
this.addGroup("group-1"), this.engine ? this.addButton(e(this.engine)) : console.warn("[Toolbar] Engine not available when creating buttons."), this.addButton(i), this.addButton(r), this.addButton(n), this.addButton(t), this.addGroup("group-2"), this.addButton(a), this.addButton(o), this.render();
}
}
-class ts {
+class _r {
engine;
constructor(e) {
this.engine = e;
@@ -534,7 +552,7 @@ class ts {
return this.engine.on(e, t);
}
}
-class $h extends ts {
+class $h extends _r {
toolbar = null;
toolbarContainer = null;
container;
@@ -586,7 +604,7 @@ class $h extends ts {
this.toolbar?.setColors(e);
}
}
-class Jh extends ts {
+class Jh extends _r {
groups = /* @__PURE__ */ new Map();
container;
constructor(e, t) {
@@ -650,16 +668,16 @@ class kc {
* 初始化组件功能 (接口实现)
*/
init() {
- this._isInitialized || (this.container.appendChild(this.element), this.initPosition(), this.options.draggable && this.initDrag(), this.options.resizable && this.initResize(), this._isInitialized = !0, this.options.onOpen && this.options.onOpen(), this.unsubscribeTheme = Ft.subscribe((e) => {
+ this._isInitialized || (this.container.appendChild(this.element), this.initPosition(), this.options.draggable && this.initDrag(), this.options.resizable && this.initResize(), this._isInitialized = !0, this.options.onOpen && this.options.onOpen(), this.unsubscribeTheme = Lt.subscribe((e) => {
this.setTheme(e);
- }), this.unsubscribeLocale = Vi.subscribe(() => {
+ }), this.unsubscribeLocale = Ei.subscribe(() => {
this.setLocales();
}));
}
setLocales() {
if (this.options.title) {
const e = this.header.querySelector(".bim-dialog-title");
- e && (e.textContent = ir(this.options.title));
+ e && (e.textContent = wi(this.options.title));
}
}
/**
@@ -673,7 +691,7 @@ class kc {
const i = document.createElement("div");
i.className = "bim-dialog-header", this.options.draggable && i.classList.add("draggable");
const r = document.createElement("span");
- r.className = "bim-dialog-title", r.textContent = this.options.title ? ir(this.options.title) : "";
+ r.className = "bim-dialog-title", r.textContent = this.options.title ? wi(this.options.title) : "";
const n = document.createElement("span");
n.className = "bim-dialog-close", n.innerHTML = "×", n.onclick = () => {
this.close();
@@ -863,7 +881,7 @@ class Qh extends kc {
// 不需要再手动实现 setTheme, destroy, close, init
// 它们都已从 BimDialog 继承
}
-class eu extends ts {
+class eu extends _r {
/** 弹窗挂载的父容器 */
container;
/** 活跃的弹窗实例列表 */
@@ -891,7 +909,7 @@ class eu extends ts {
this.activeDialogs = this.activeDialogs.filter((i) => i !== t), e.onClose && e.onClose();
}
});
- return t.setTheme(Ft.getTheme()), this.activeDialogs.push(t), t;
+ return t.setTheme(Lt.getTheme()), this.activeDialogs.push(t), t;
}
/**
* 显示二次封装的模型信息弹窗
@@ -913,7 +931,7 @@ class eu extends ts {
this.activeDialogs.forEach((e) => e.destroy()), this.activeDialogs = [];
}
}
-const Fr = { ROTATE: 0, DOLLY: 1, PAN: 2 }, Or = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }, tu = 0, cl = 1, iu = 2, zc = 1, Hc = 2, Fi = 3, Ei = 0, zt = 1, Wt = 2, _t = 0, kr = 1, bn = 2, hl = 3, ul = 4, Vc = 5, ci = 100, ru = 101, su = 102, nu = 103, au = 104, _s = 200, ou = 201, lu = 202, cu = 203, wa = 204, Ca = 205, Ra = 206, hu = 207, Aa = 208, uu = 209, du = 210, pu = 211, fu = 212, mu = 213, gu = 214, Pa = 0, Da = 1, La = 2, Wr = 3, Ia = 4, Ua = 5, Na = 6, Oa = 7, Co = 0, vu = 1, _u = 2, er = 0, Gc = 1, Wc = 2, jc = 3, Ro = 4, Xc = 5, qc = 6, Yc = 7, dl = "attached", xu = "detached", Kc = 300, jr = 301, Xr = 302, Tn = 303, Ba = 304, Ln = 306, wi = 1e3, Qt = 1001, Sn = 1002, Lt = 1003, Zc = 1004, xs = 1005, yt = 1006, gn = 1007, Ti = 1008, mi = 1009, $c = 1010, Jc = 1011, Es = 1012, Ao = 1013, mr = 1014, jt = 1015, mt = 1016, Po = 1017, Do = 1018, qr = 1020, Qc = 35902, eh = 35899, th = 1021, ih = 1022, Kt = 1023, ws = 1026, Yr = 1027, Lo = 1028, Io = 1029, Uo = 1030, No = 1031, Oo = 1033, vn = 33776, _n = 33777, xn = 33778, yn = 33779, Fa = 35840, ka = 35841, za = 35842, Ha = 35843, Va = 36196, Ga = 37492, Wa = 37496, ja = 37808, Xa = 37809, qa = 37810, Ya = 37811, Ka = 37812, Za = 37813, $a = 37814, Ja = 37815, Qa = 37816, eo = 37817, to = 37818, io = 37819, ro = 37820, so = 37821, no = 36492, ao = 36494, oo = 36495, lo = 36283, co = 36284, ho = 36285, uo = 36286, Cs = 2300, Rs = 2301, Fn = 2302, pl = 2400, fl = 2401, ml = 2402, yu = 2500, Mu = 0, rh = 1, po = 2, bu = 3200, sh = 3201, In = 0, Tu = 1, $i = "", Ct = "srgb", Nt = "srgb-linear", En = "linear", et = "srgb", yr = 7680, kn = 34055, zn = 34056, Su = 517, fo = 519, Eu = 512, wu = 513, Cu = 514, nh = 515, Ru = 516, Au = 517, Pu = 518, Du = 519, mo = 35044, gl = "300 es", Si = 2e3, wn = 2001;
+const kr = { ROTATE: 0, DOLLY: 1, PAN: 2 }, Br = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }, tu = 0, cl = 1, iu = 2, zc = 1, Hc = 2, zi = 3, Ci = 0, zt = 1, Wt = 2, _t = 0, zr = 1, Mn = 2, hl = 3, ul = 4, Vc = 5, ci = 100, ru = 101, su = 102, nu = 103, au = 104, _s = 200, ou = 201, lu = 202, cu = 203, wa = 204, Ca = 205, Ra = 206, hu = 207, Aa = 208, uu = 209, du = 210, pu = 211, fu = 212, mu = 213, gu = 214, Pa = 0, Da = 1, La = 2, jr = 3, Ia = 4, Ua = 5, Na = 6, Oa = 7, Co = 0, vu = 1, _u = 2, tr = 0, Gc = 1, Wc = 2, jc = 3, Ro = 4, Xc = 5, qc = 6, Yc = 7, dl = "attached", xu = "detached", Kc = 300, Xr = 301, qr = 302, Tn = 303, Ba = 304, Ln = 306, Ri = 1e3, Qt = 1001, Sn = 1002, It = 1003, Zc = 1004, xs = 1005, yt = 1006, gn = 1007, Ti = 1008, mi = 1009, $c = 1010, Jc = 1011, Es = 1012, Ao = 1013, mr = 1014, jt = 1015, mt = 1016, Po = 1017, Do = 1018, Yr = 1020, Qc = 35902, eh = 35899, th = 1021, ih = 1022, Kt = 1023, ws = 1026, Kr = 1027, Lo = 1028, Io = 1029, Uo = 1030, No = 1031, Oo = 1033, vn = 33776, _n = 33777, xn = 33778, yn = 33779, Fa = 35840, ka = 35841, za = 35842, Ha = 35843, Va = 36196, Ga = 37492, Wa = 37496, ja = 37808, Xa = 37809, qa = 37810, Ya = 37811, Ka = 37812, Za = 37813, $a = 37814, Ja = 37815, Qa = 37816, eo = 37817, to = 37818, io = 37819, ro = 37820, so = 37821, no = 36492, ao = 36494, oo = 36495, lo = 36283, co = 36284, ho = 36285, uo = 36286, Cs = 2300, Rs = 2301, Fn = 2302, pl = 2400, fl = 2401, ml = 2402, yu = 2500, bu = 0, rh = 1, po = 2, Mu = 3200, sh = 3201, In = 0, Tu = 1, Ji = "", Ct = "srgb", Ot = "srgb-linear", En = "linear", et = "srgb", br = 7680, kn = 34055, zn = 34056, Su = 517, fo = 519, Eu = 512, wu = 513, Cu = 514, nh = 515, Ru = 516, Au = 517, Pu = 518, Du = 519, mo = 35044, gl = "300 es", Si = 2e3, wn = 2001;
function ah(s) {
for (let e = s.length - 1; e >= 0; --e)
if (s[e] >= 65535) return !0;
@@ -931,7 +949,7 @@ function Cn(...s) {
const e = "THREE." + s.shift();
console.log(e, ...s);
}
-function be(...s) {
+function Me(...s) {
const e = "THREE." + s.shift();
console.warn(e, ...s);
}
@@ -941,7 +959,7 @@ function He(...s) {
}
function Ps(...s) {
const e = s.join(" ");
- e in vl || (vl[e] = !0, be(...s));
+ e in vl || (vl[e] = !0, Me(...s));
}
function Iu(s, e, t) {
return new Promise(function(i, r) {
@@ -960,7 +978,7 @@ function Iu(s, e, t) {
setTimeout(n, t);
});
}
-class _r {
+class xr {
/**
* Adds the given event listener to the given event type.
*
@@ -1016,12 +1034,12 @@ class _r {
}
}
}
-const It = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0a", "0b", "0c", "0d", "0e", "0f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2a", "2b", "2c", "2d", "2e", "2f", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3a", "3b", "3c", "3d", "3e", "3f", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4a", "4b", "4c", "4d", "4e", "4f", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5a", "5b", "5c", "5d", "5e", "5f", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6a", "6b", "6c", "6d", "6e", "6f", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7a", "7b", "7c", "7d", "7e", "7f", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8a", "8b", "8c", "8d", "8e", "8f", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9a", "9b", "9c", "9d", "9e", "9f", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "aa", "ab", "ac", "ad", "ae", "af", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "ba", "bb", "bc", "bd", "be", "bf", "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "ca", "cb", "cc", "cd", "ce", "cf", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "da", "db", "dc", "dd", "de", "df", "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff"];
+const Ut = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0a", "0b", "0c", "0d", "0e", "0f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2a", "2b", "2c", "2d", "2e", "2f", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3a", "3b", "3c", "3d", "3e", "3f", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4a", "4b", "4c", "4d", "4e", "4f", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5a", "5b", "5c", "5d", "5e", "5f", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6a", "6b", "6c", "6d", "6e", "6f", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7a", "7b", "7c", "7d", "7e", "7f", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8a", "8b", "8c", "8d", "8e", "8f", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9a", "9b", "9c", "9d", "9e", "9f", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "aa", "ab", "ac", "ad", "ae", "af", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "ba", "bb", "bc", "bd", "be", "bf", "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "ca", "cb", "cc", "cd", "ce", "cf", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "da", "db", "dc", "dd", "de", "df", "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff"];
let _l = 1234567;
-const bs = Math.PI / 180, Kr = 180 / Math.PI;
+const Ms = Math.PI / 180, Zr = 180 / Math.PI;
function pi() {
const s = Math.random() * 4294967295 | 0, e = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, i = Math.random() * 4294967295 | 0;
- return (It[s & 255] + It[s >> 8 & 255] + It[s >> 16 & 255] + It[s >> 24 & 255] + "-" + It[e & 255] + It[e >> 8 & 255] + "-" + It[e >> 16 & 15 | 64] + It[e >> 24 & 255] + "-" + It[t & 63 | 128] + It[t >> 8 & 255] + "-" + It[t >> 16 & 255] + It[t >> 24 & 255] + It[i & 255] + It[i >> 8 & 255] + It[i >> 16 & 255] + It[i >> 24 & 255]).toLowerCase();
+ return (Ut[s & 255] + Ut[s >> 8 & 255] + Ut[s >> 16 & 255] + Ut[s >> 24 & 255] + "-" + Ut[e & 255] + Ut[e >> 8 & 255] + "-" + Ut[e >> 16 & 15 | 64] + Ut[e >> 24 & 255] + "-" + Ut[t & 63 | 128] + Ut[t >> 8 & 255] + "-" + Ut[t >> 16 & 255] + Ut[t >> 24 & 255] + Ut[i & 255] + Ut[i >> 8 & 255] + Ut[i >> 16 & 255] + Ut[i >> 24 & 255]).toLowerCase();
}
function ke(s, e, t) {
return Math.max(e, Math.min(t, s));
@@ -1065,10 +1083,10 @@ function Gu(s) {
return e = Math.imul(e ^ e >>> 15, e | 1), e ^= e + Math.imul(e ^ e >>> 7, e | 61), ((e ^ e >>> 14) >>> 0) / 4294967296;
}
function Wu(s) {
- return s * bs;
+ return s * Ms;
}
function ju(s) {
- return s * Kr;
+ return s * Zr;
}
function Xu(s) {
return (s & s - 1) === 0 && s !== 0;
@@ -1101,7 +1119,7 @@ function Ku(s, e, t, i, r) {
s.set(l * g, l * f, o * h, o * c);
break;
default:
- be("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: " + r);
+ Me("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: " + r);
}
}
function hi(s, e) {
@@ -1145,8 +1163,8 @@ function tt(s, e) {
}
}
const Fo = {
- DEG2RAD: bs,
- RAD2DEG: Kr,
+ DEG2RAD: Ms,
+ RAD2DEG: Zr,
/**
* Generate a [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier)
* (universally unique identifier).
@@ -2101,7 +2119,7 @@ class gi {
this._x = d * h * u - c * f * g, this._y = c * f * u - d * h * g, this._z = c * h * g + d * f * u, this._w = c * h * u + d * f * g;
break;
default:
- be("Quaternion: .setFromEuler() encountered an unknown order: " + a);
+ Me("Quaternion: .setFromEuler() encountered an unknown order: " + a);
}
return t === !0 && this._onChangeCallback(), this;
}
@@ -3514,7 +3532,7 @@ const Vn = /* @__PURE__ */ new Be(), yl = /* @__PURE__ */ new Be().set(
0.0193308,
0.1191948,
0.9505322
-), Ml = /* @__PURE__ */ new Be().set(
+), bl = /* @__PURE__ */ new Be().set(
3.2409699,
-1.5373832,
-0.4986108,
@@ -3528,7 +3546,7 @@ const Vn = /* @__PURE__ */ new Be(), yl = /* @__PURE__ */ new Be().set(
function Zu() {
const s = {
enabled: !0,
- workingColorSpace: Nt,
+ workingColorSpace: Ot,
/**
* Implementations of supported color spaces.
*
@@ -3549,7 +3567,7 @@ function Zu() {
*/
spaces: {},
convert: function(r, n, a) {
- return this.enabled === !1 || n === a || !n || !a || (this.spaces[n].transfer === et && (r.r = Gi(r.r), r.g = Gi(r.g), r.b = Gi(r.b)), this.spaces[n].primaries !== this.spaces[a].primaries && (r.applyMatrix3(this.spaces[n].toXYZ), r.applyMatrix3(this.spaces[a].fromXYZ)), this.spaces[a].transfer === et && (r.r = zr(r.r), r.g = zr(r.g), r.b = zr(r.b))), r;
+ return this.enabled === !1 || n === a || !n || !a || (this.spaces[n].transfer === et && (r.r = Wi(r.r), r.g = Wi(r.g), r.b = Wi(r.b)), this.spaces[n].primaries !== this.spaces[a].primaries && (r.applyMatrix3(this.spaces[n].toXYZ), r.applyMatrix3(this.spaces[a].fromXYZ)), this.spaces[a].transfer === et && (r.r = Hr(r.r), r.g = Hr(r.g), r.b = Hr(r.b))), r;
},
workingToColorSpace: function(r, n) {
return this.convert(r, this.workingColorSpace, n);
@@ -3561,7 +3579,7 @@ function Zu() {
return this.spaces[r].primaries;
},
getTransfer: function(r) {
- return r === $i ? En : this.spaces[r].transfer;
+ return r === Ji ? En : this.spaces[r].transfer;
},
getToneMappingMode: function(r) {
return this.spaces[r].outputColorSpaceConfig.toneMappingMode || "standard";
@@ -3591,12 +3609,12 @@ function Zu() {
}
}, e = [0.64, 0.33, 0.3, 0.6, 0.15, 0.06], t = [0.2126, 0.7152, 0.0722], i = [0.3127, 0.329];
return s.define({
- [Nt]: {
+ [Ot]: {
primaries: e,
whitePoint: i,
transfer: En,
toXYZ: yl,
- fromXYZ: Ml,
+ fromXYZ: bl,
luminanceCoefficients: t,
workingColorSpaceConfig: { unpackColorSpace: Ct },
outputColorSpaceConfig: { drawingBufferColorSpace: Ct }
@@ -3606,17 +3624,17 @@ function Zu() {
whitePoint: i,
transfer: et,
toXYZ: yl,
- fromXYZ: Ml,
+ fromXYZ: bl,
luminanceCoefficients: t,
outputColorSpaceConfig: { drawingBufferColorSpace: Ct }
}
}), s;
}
const Xe = /* @__PURE__ */ Zu();
-function Gi(s) {
+function Wi(s) {
return s < 0.04045 ? s * 0.0773993808 : Math.pow(s * 0.9478672986 + 0.0521327014, 2.4);
}
-function zr(s) {
+function Hr(s) {
return s < 31308e-7 ? s * 12.92 : 1.055 * Math.pow(s, 0.41666) - 0.055;
}
let Mr;
@@ -3655,19 +3673,19 @@ class $u {
i.drawImage(e, 0, 0, e.width, e.height);
const r = i.getImageData(0, 0, e.width, e.height), n = r.data;
for (let a = 0; a < n.length; a++)
- n[a] = Gi(n[a] / 255) * 255;
+ n[a] = Wi(n[a] / 255) * 255;
return i.putImageData(r, 0, 0), t;
} else if (e.data) {
const t = e.data.slice(0);
for (let i = 0; i < t.length; i++)
- t instanceof Uint8Array || t instanceof Uint8ClampedArray ? t[i] = Math.floor(Gi(t[i] / 255) * 255) : t[i] = Gi(t[i]);
+ t instanceof Uint8Array || t instanceof Uint8ClampedArray ? t[i] = Math.floor(Wi(t[i] / 255) * 255) : t[i] = Wi(t[i]);
return {
data: t,
width: e.width,
height: e.height
};
} else
- return be("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."), e;
+ return Me("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."), e;
}
}
let Ju = 0;
@@ -3736,11 +3754,11 @@ function Gn(s) {
width: s.width,
height: s.height,
type: s.data.constructor.name
- } : (be("Texture: Unable to serialize Texture."), {});
+ } : (Me("Texture: Unable to serialize Texture."), {});
}
let Qu = 0;
const Wn = /* @__PURE__ */ new w();
-class Rt extends _r {
+class Rt extends xr {
/**
* Constructs a new texture.
*
@@ -3755,7 +3773,7 @@ class Rt extends _r {
* @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.
* @param {string} [colorSpace=NoColorSpace] - The color space.
*/
- constructor(e = Rt.DEFAULT_IMAGE, t = Rt.DEFAULT_MAPPING, i = Qt, r = Qt, n = yt, a = Ti, o = Kt, l = mi, c = Rt.DEFAULT_ANISOTROPY, h = $i) {
+ constructor(e = Rt.DEFAULT_IMAGE, t = Rt.DEFAULT_MAPPING, i = Qt, r = Qt, n = yt, a = Ti, o = Kt, l = mi, c = Rt.DEFAULT_ANISOTROPY, h = Ji) {
super(), this.isTexture = !0, Object.defineProperty(this, "id", { value: Qu++ }), this.uuid = pi(), this.name = "", this.source = new ko(e), this.mipmaps = [], this.mapping = t, this.channel = 0, this.wrapS = i, this.wrapT = r, this.magFilter = n, this.minFilter = a, this.anisotropy = c, this.format = o, this.internalFormat = null, this.type = l, this.offset = new oe(0, 0), this.repeat = new oe(1, 1), this.center = new oe(0, 0), this.rotation = 0, this.matrixAutoUpdate = !0, this.matrix = new Be(), this.generateMipmaps = !0, this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.colorSpace = h, this.userData = {}, this.updateRanges = [], this.version = 0, this.onUpdate = null, this.renderTarget = null, this.isRenderTargetTexture = !1, this.isArrayTexture = !!(e && e.depth && e.depth > 1), this.pmremVersion = 0;
}
/**
@@ -3834,12 +3852,12 @@ class Rt extends _r {
for (const t in e) {
const i = e[t];
if (i === void 0) {
- be(`Texture.setValues(): parameter '${t}' has value of undefined.`);
+ Me(`Texture.setValues(): parameter '${t}' has value of undefined.`);
continue;
}
const r = this[t];
if (r === void 0) {
- be(`Texture.setValues(): property '${t}' does not exist.`);
+ Me(`Texture.setValues(): property '${t}' does not exist.`);
continue;
}
r && i && r.isVector2 && i.isVector2 || r && i && r.isVector3 && i.isVector3 || r && i && r.isMatrix3 && i.isMatrix3 ? r.copy(i) : this[t] = i;
@@ -3905,7 +3923,7 @@ class Rt extends _r {
if (this.mapping !== Kc) return e;
if (e.applyMatrix3(this.matrix), e.x < 0 || e.x > 1)
switch (this.wrapS) {
- case wi:
+ case Ri:
e.x = e.x - Math.floor(e.x);
break;
case Qt:
@@ -3917,7 +3935,7 @@ class Rt extends _r {
}
if (e.y < 0 || e.y > 1)
switch (this.wrapT) {
- case wi:
+ case Ri:
e.y = e.y - Math.floor(e.y);
break;
case Qt:
@@ -4501,7 +4519,7 @@ class $e {
yield this.x, yield this.y, yield this.z, yield this.w;
}
}
-class ed extends _r {
+class ed extends xr {
/**
* Render target options.
*
@@ -4664,7 +4682,7 @@ class oh extends Rt {
* @param {number} [depth=1] - The depth of the texture.
*/
constructor(e = null, t = 1, i = 1, r = 1) {
- super(null), this.isDataArrayTexture = !0, this.image = { data: e, width: t, height: i, depth: r }, this.magFilter = Lt, this.minFilter = Lt, this.wrapR = Qt, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1, this.layerUpdates = /* @__PURE__ */ new Set();
+ super(null), this.isDataArrayTexture = !0, this.image = { data: e, width: t, height: i, depth: r }, this.magFilter = It, this.minFilter = It, this.wrapR = Qt, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1, this.layerUpdates = /* @__PURE__ */ new Set();
}
/**
* Describes that a specific layer of the texture needs to be updated.
@@ -4695,7 +4713,7 @@ class td extends Rt {
* @param {number} [depth=1] - The depth of the texture.
*/
constructor(e = null, t = 1, i = 1, r = 1) {
- super(null), this.isData3DTexture = !0, this.image = { data: e, width: t, height: i, depth: r }, this.magFilter = Lt, this.minFilter = Lt, this.wrapR = Qt, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1;
+ super(null), this.isData3DTexture = !0, this.image = { data: e, width: t, height: i, depth: r }, this.magFilter = It, this.minFilter = It, this.wrapR = Qt, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1;
}
}
class At {
@@ -4965,37 +4983,37 @@ class At {
intersectsTriangle(e) {
if (this.isEmpty())
return !1;
- this.getCenter(ls), Fs.subVectors(this.max, ls), br.subVectors(e.a, ls), Tr.subVectors(e.b, ls), Sr.subVectors(e.c, ls), Wi.subVectors(Tr, br), ji.subVectors(Sr, Tr), or.subVectors(br, Sr);
+ this.getCenter(ls), Fs.subVectors(this.max, ls), Tr.subVectors(e.a, ls), Sr.subVectors(e.b, ls), Er.subVectors(e.c, ls), ji.subVectors(Sr, Tr), Xi.subVectors(Er, Sr), or.subVectors(Tr, Er);
let t = [
- 0,
- -Wi.z,
- Wi.y,
0,
-ji.z,
ji.y,
0,
+ -Xi.z,
+ Xi.y,
+ 0,
-or.z,
or.y,
- Wi.z,
- 0,
- -Wi.x,
ji.z,
0,
-ji.x,
+ Xi.z,
+ 0,
+ -Xi.x,
or.z,
0,
-or.x,
- -Wi.y,
- Wi.x,
- 0,
-ji.y,
ji.x,
0,
+ -Xi.y,
+ Xi.x,
+ 0,
-or.y,
or.x,
0
];
- return !jn(t, br, Tr, Sr, Fs) || (t = [1, 0, 0, 0, 1, 0, 0, 0, 1], !jn(t, br, Tr, Sr, Fs)) ? !1 : (ks.crossVectors(Wi, ji), t = [ks.x, ks.y, ks.z], jn(t, br, Tr, Sr, Fs));
+ return !jn(t, Tr, Sr, Er, Fs) || (t = [1, 0, 0, 0, 1, 0, 0, 0, 1], !jn(t, Tr, Sr, Er, Fs)) ? !1 : (ks.crossVectors(ji, Xi), t = [ks.x, ks.y, ks.z], jn(t, Tr, Sr, Er, Fs));
}
/**
* Clamps the given point within the bounds of this box.
@@ -5056,7 +5074,7 @@ class At {
* @return {Box3} A reference to this bounding box.
*/
applyMatrix4(e) {
- return this.isEmpty() ? this : (Di[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(e), Di[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(e), Di[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(e), Di[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(e), Di[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(e), Di[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(e), Di[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(e), Di[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(e), this.setFromPoints(Di), this);
+ return this.isEmpty() ? this : (Ii[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(e), Ii[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(e), Ii[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(e), Ii[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(e), Ii[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(e), Ii[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(e), Ii[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(e), Ii[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(e), this.setFromPoints(Ii), this);
}
/**
* Adds the given offset to both the upper and lower bounds of this bounding box,
@@ -5098,7 +5116,7 @@ class At {
return this.min.fromArray(e.min), this.max.fromArray(e.max), this;
}
}
-const Di = [
+const Ii = [
/* @__PURE__ */ new w(),
/* @__PURE__ */ new w(),
/* @__PURE__ */ new w(),
@@ -5107,7 +5125,7 @@ const Di = [
/* @__PURE__ */ new w(),
/* @__PURE__ */ new w(),
/* @__PURE__ */ new w()
-], ni = /* @__PURE__ */ new w(), Bs = /* @__PURE__ */ new At(), br = /* @__PURE__ */ new w(), Tr = /* @__PURE__ */ new w(), Sr = /* @__PURE__ */ new w(), Wi = /* @__PURE__ */ new w(), ji = /* @__PURE__ */ new w(), or = /* @__PURE__ */ new w(), ls = /* @__PURE__ */ new w(), Fs = /* @__PURE__ */ new w(), ks = /* @__PURE__ */ new w(), lr = /* @__PURE__ */ new w();
+], ni = /* @__PURE__ */ new w(), Bs = /* @__PURE__ */ new At(), Tr = /* @__PURE__ */ new w(), Sr = /* @__PURE__ */ new w(), Er = /* @__PURE__ */ new w(), ji = /* @__PURE__ */ new w(), Xi = /* @__PURE__ */ new w(), or = /* @__PURE__ */ new w(), ls = /* @__PURE__ */ new w(), Fs = /* @__PURE__ */ new w(), ks = /* @__PURE__ */ new w(), lr = /* @__PURE__ */ new w();
function jn(s, e, t, i, r) {
for (let n = 0, a = s.length - 3; n <= a; n += 3) {
lr.fromArray(s, n);
@@ -5118,7 +5136,7 @@ function jn(s, e, t, i, r) {
return !0;
}
const id = /* @__PURE__ */ new At(), cs = /* @__PURE__ */ new w(), Xn = /* @__PURE__ */ new w();
-class Ri {
+class Pi {
/**
* Constructs a new sphere.
*
@@ -5337,7 +5355,7 @@ class Ri {
return this.radius = e.radius, this.center.fromArray(e.center), this;
}
}
-const Li = /* @__PURE__ */ new w(), qn = /* @__PURE__ */ new w(), zs = /* @__PURE__ */ new w(), Xi = /* @__PURE__ */ new w(), Yn = /* @__PURE__ */ new w(), Hs = /* @__PURE__ */ new w(), Kn = /* @__PURE__ */ new w();
+const Ui = /* @__PURE__ */ new w(), qn = /* @__PURE__ */ new w(), zs = /* @__PURE__ */ new w(), qi = /* @__PURE__ */ new w(), Yn = /* @__PURE__ */ new w(), Hs = /* @__PURE__ */ new w(), Kn = /* @__PURE__ */ new w();
class is {
/**
* Constructs a new ray.
@@ -5393,7 +5411,7 @@ class is {
* @return {Ray} A reference to this ray.
*/
recast(e) {
- return this.origin.copy(this.at(e, Li)), this;
+ return this.origin.copy(this.at(e, Ui)), this;
}
/**
* Returns the point along this ray that is closest to the given point.
@@ -5423,8 +5441,8 @@ class is {
* @return {number} The squared distance.
*/
distanceSqToPoint(e) {
- const t = Li.subVectors(e, this.origin).dot(this.direction);
- return t < 0 ? this.origin.distanceToSquared(e) : (Li.copy(this.origin).addScaledVector(this.direction, t), Li.distanceToSquared(e));
+ const t = Ui.subVectors(e, this.origin).dot(this.direction);
+ return t < 0 ? this.origin.distanceToSquared(e) : (Ui.copy(this.origin).addScaledVector(this.direction, t), Ui.distanceToSquared(e));
}
/**
* Returns the squared distance between this ray and the given line segment.
@@ -5436,8 +5454,8 @@ class is {
* @return {number} The squared distance.
*/
distanceSqToSegment(e, t, i, r) {
- qn.copy(e).add(t).multiplyScalar(0.5), zs.copy(t).sub(e).normalize(), Xi.copy(this.origin).sub(qn);
- const n = e.distanceTo(t) * 0.5, a = -this.direction.dot(zs), o = Xi.dot(this.direction), l = -Xi.dot(zs), c = Xi.lengthSq(), h = Math.abs(1 - a * a);
+ qn.copy(e).add(t).multiplyScalar(0.5), zs.copy(t).sub(e).normalize(), qi.copy(this.origin).sub(qn);
+ const n = e.distanceTo(t) * 0.5, a = -this.direction.dot(zs), o = qi.dot(this.direction), l = -qi.dot(zs), c = qi.lengthSq(), h = Math.abs(1 - a * a);
let u, d, f, g;
if (h > 0)
if (u = a * l - o, d = a * o - l, g = n * h, u >= 0)
@@ -5464,8 +5482,8 @@ class is {
* @return {?Vector3} The intersection point.
*/
intersectSphere(e, t) {
- Li.subVectors(e.center, this.origin);
- const i = Li.dot(this.direction), r = Li.dot(Li) - i * i, n = e.radius * e.radius;
+ Ui.subVectors(e.center, this.origin);
+ const i = Ui.dot(this.direction), r = Ui.dot(Ui) - i * i, n = e.radius * e.radius;
if (r > n) return null;
const a = Math.sqrt(n - r), o = i - a, l = i + a;
return l < 0 ? null : o < 0 ? this.at(l, t) : this.at(o, t);
@@ -5535,7 +5553,7 @@ class is {
* @return {boolean} Whether this ray intersects with the given box or not.
*/
intersectsBox(e) {
- return this.intersectBox(e, Li) !== null;
+ return this.intersectBox(e, Ui) !== null;
}
/**
* Intersects this ray with the given triangle, returning the intersection
@@ -5558,14 +5576,14 @@ class is {
o = -1, a = -a;
else
return null;
- Xi.subVectors(this.origin, e);
- const l = o * this.direction.dot(Hs.crossVectors(Xi, Hs));
+ qi.subVectors(this.origin, e);
+ const l = o * this.direction.dot(Hs.crossVectors(qi, Hs));
if (l < 0)
return null;
- const c = o * this.direction.dot(Yn.cross(Xi));
+ const c = o * this.direction.dot(Yn.cross(qi));
if (c < 0 || l + c > a)
return null;
- const h = -o * Xi.dot(Kn);
+ const h = -o * qi.dot(Kn);
return h < 0 ? null : this.at(h / a, n);
}
/**
@@ -5794,7 +5812,7 @@ class Ue {
* @return {Matrix4} A reference to this matrix.
*/
extractRotation(e) {
- const t = this.elements, i = e.elements, r = 1 / Er.setFromMatrixColumn(e, 0).length(), n = 1 / Er.setFromMatrixColumn(e, 1).length(), a = 1 / Er.setFromMatrixColumn(e, 2).length();
+ const t = this.elements, i = e.elements, r = 1 / wr.setFromMatrixColumn(e, 0).length(), n = 1 / wr.setFromMatrixColumn(e, 1).length(), a = 1 / wr.setFromMatrixColumn(e, 2).length();
return t[0] = i[0] * r, t[1] = i[1] * r, t[2] = i[2] * r, t[3] = 0, t[4] = i[4] * n, t[5] = i[5] * n, t[6] = i[6] * n, t[7] = 0, t[8] = i[8] * a, t[9] = i[9] * a, t[10] = i[10] * a, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, this;
}
/**
@@ -5852,7 +5870,7 @@ class Ue {
*/
lookAt(e, t, i) {
const r = this.elements;
- return qt.subVectors(e, t), qt.lengthSq() === 0 && (qt.z = 1), qt.normalize(), qi.crossVectors(i, qt), qi.lengthSq() === 0 && (Math.abs(i.z) === 1 ? qt.x += 1e-4 : qt.z += 1e-4, qt.normalize(), qi.crossVectors(i, qt)), qi.normalize(), Vs.crossVectors(qt, qi), r[0] = qi.x, r[4] = Vs.x, r[8] = qt.x, r[1] = qi.y, r[5] = Vs.y, r[9] = qt.y, r[2] = qi.z, r[6] = Vs.z, r[10] = qt.z, this;
+ return qt.subVectors(e, t), qt.lengthSq() === 0 && (qt.z = 1), qt.normalize(), Yi.crossVectors(i, qt), Yi.lengthSq() === 0 && (Math.abs(i.z) === 1 ? qt.x += 1e-4 : qt.z += 1e-4, qt.normalize(), Yi.crossVectors(i, qt)), Yi.normalize(), Vs.crossVectors(qt, Yi), r[0] = Yi.x, r[4] = Vs.x, r[8] = qt.x, r[1] = Yi.y, r[5] = Vs.y, r[9] = qt.y, r[2] = Yi.z, r[6] = Vs.z, r[10] = qt.z, this;
}
/**
* Post-multiplies this matrix by the given 4x4 matrix.
@@ -5881,8 +5899,8 @@ class Ue {
* @return {Matrix4} A reference to this matrix.
*/
multiplyMatrices(e, t) {
- const i = e.elements, r = t.elements, n = this.elements, a = i[0], o = i[4], l = i[8], c = i[12], h = i[1], u = i[5], d = i[9], f = i[13], g = i[2], v = i[6], m = i[10], p = i[14], y = i[3], _ = i[7], E = i[11], A = i[15], S = r[0], R = r[4], I = r[8], T = r[12], b = r[1], D = r[5], N = r[9], z = r[13], H = r[2], j = r[6], q = r[10], te = r[14], G = r[3], Z = r[7], se = r[11], Pe = r[15];
- return n[0] = a * S + o * b + l * H + c * G, n[4] = a * R + o * D + l * j + c * Z, n[8] = a * I + o * N + l * q + c * se, n[12] = a * T + o * z + l * te + c * Pe, n[1] = h * S + u * b + d * H + f * G, n[5] = h * R + u * D + d * j + f * Z, n[9] = h * I + u * N + d * q + f * se, n[13] = h * T + u * z + d * te + f * Pe, n[2] = g * S + v * b + m * H + p * G, n[6] = g * R + v * D + m * j + p * Z, n[10] = g * I + v * N + m * q + p * se, n[14] = g * T + v * z + m * te + p * Pe, n[3] = y * S + _ * b + E * H + A * G, n[7] = y * R + _ * D + E * j + A * Z, n[11] = y * I + _ * N + E * q + A * se, n[15] = y * T + _ * z + E * te + A * Pe, this;
+ const i = e.elements, r = t.elements, n = this.elements, a = i[0], o = i[4], l = i[8], c = i[12], h = i[1], u = i[5], d = i[9], f = i[13], g = i[2], v = i[6], m = i[10], p = i[14], y = i[3], _ = i[7], E = i[11], A = i[15], S = r[0], R = r[4], I = r[8], T = r[12], M = r[1], D = r[5], N = r[9], z = r[13], H = r[2], j = r[6], q = r[10], te = r[14], G = r[3], Z = r[7], se = r[11], Pe = r[15];
+ return n[0] = a * S + o * M + l * H + c * G, n[4] = a * R + o * D + l * j + c * Z, n[8] = a * I + o * N + l * q + c * se, n[12] = a * T + o * z + l * te + c * Pe, n[1] = h * S + u * M + d * H + f * G, n[5] = h * R + u * D + d * j + f * Z, n[9] = h * I + u * N + d * q + f * se, n[13] = h * T + u * z + d * te + f * Pe, n[2] = g * S + v * M + m * H + p * G, n[6] = g * R + v * D + m * j + p * Z, n[10] = g * I + v * N + m * q + p * se, n[14] = g * T + v * z + m * te + p * Pe, n[3] = y * S + _ * M + E * H + A * G, n[7] = y * R + _ * D + E * j + A * Z, n[11] = y * I + _ * N + E * q + A * se, n[15] = y * T + _ * z + E * te + A * Pe, this;
}
/**
* Multiplies every component of the matrix by the given scalar.
@@ -6208,8 +6226,8 @@ class Ue {
*/
decompose(e, t, i) {
const r = this.elements;
- let n = Er.set(r[0], r[1], r[2]).length();
- const a = Er.set(r[4], r[5], r[6]).length(), o = Er.set(r[8], r[9], r[10]).length();
+ let n = wr.set(r[0], r[1], r[2]).length();
+ const a = wr.set(r[4], r[5], r[6]).length(), o = wr.set(r[8], r[9], r[10]).length();
this.determinant() < 0 && (n = -n), e.x = r[12], e.y = r[13], e.z = r[14], ai.copy(this);
const l = 1 / n, c = 1 / a, h = 1 / o;
return ai.elements[0] *= l, ai.elements[1] *= l, ai.elements[2] *= l, ai.elements[4] *= c, ai.elements[5] *= c, ai.elements[6] *= c, ai.elements[8] *= h, ai.elements[9] *= h, ai.elements[10] *= h, t.setFromRotationMatrix(ai), i.x = n, i.y = a, i.z = o, this;
@@ -6305,7 +6323,7 @@ class Ue {
return e[t] = i[0], e[t + 1] = i[1], e[t + 2] = i[2], e[t + 3] = i[3], e[t + 4] = i[4], e[t + 5] = i[5], e[t + 6] = i[6], e[t + 7] = i[7], e[t + 8] = i[8], e[t + 9] = i[9], e[t + 10] = i[10], e[t + 11] = i[11], e[t + 12] = i[12], e[t + 13] = i[13], e[t + 14] = i[14], e[t + 15] = i[15], e;
}
}
-const Er = /* @__PURE__ */ new w(), ai = /* @__PURE__ */ new Ue(), rd = /* @__PURE__ */ new w(0, 0, 0), sd = /* @__PURE__ */ new w(1, 1, 1), qi = /* @__PURE__ */ new w(), Vs = /* @__PURE__ */ new w(), qt = /* @__PURE__ */ new w(), bl = /* @__PURE__ */ new Ue(), Tl = /* @__PURE__ */ new gi();
+const wr = /* @__PURE__ */ new w(), ai = /* @__PURE__ */ new Ue(), rd = /* @__PURE__ */ new w(0, 0, 0), sd = /* @__PURE__ */ new w(1, 1, 1), Yi = /* @__PURE__ */ new w(), Vs = /* @__PURE__ */ new w(), qt = /* @__PURE__ */ new w(), Ml = /* @__PURE__ */ new Ue(), Tl = /* @__PURE__ */ new gi();
class vi {
/**
* Constructs a new euler instance.
@@ -6425,7 +6443,7 @@ class vi {
this._z = Math.asin(-ke(a, -1, 1)), Math.abs(a) < 0.9999999 ? (this._x = Math.atan2(d, c), this._y = Math.atan2(o, n)) : (this._x = Math.atan2(-h, f), this._y = 0);
break;
default:
- be("Euler: .setFromRotationMatrix() encountered an unknown order: " + t);
+ Me("Euler: .setFromRotationMatrix() encountered an unknown order: " + t);
}
return this._order = t, i === !0 && this._onChangeCallback(), this;
}
@@ -6438,7 +6456,7 @@ class vi {
* @return {Euler} A reference to this Euler instance.
*/
setFromQuaternion(e, t, i) {
- return bl.makeRotationFromQuaternion(e), this.setFromRotationMatrix(bl, t, i);
+ return Ml.makeRotationFromQuaternion(e), this.setFromRotationMatrix(Ml, t, i);
}
/**
* Sets the angles of this Euler instance from the given vector.
@@ -6577,8 +6595,8 @@ class zo {
}
}
let nd = 0;
-const Sl = /* @__PURE__ */ new w(), wr = /* @__PURE__ */ new gi(), Ii = /* @__PURE__ */ new Ue(), Gs = /* @__PURE__ */ new w(), hs = /* @__PURE__ */ new w(), ad = /* @__PURE__ */ new w(), od = /* @__PURE__ */ new gi(), El = /* @__PURE__ */ new w(1, 0, 0), wl = /* @__PURE__ */ new w(0, 1, 0), Cl = /* @__PURE__ */ new w(0, 0, 1), Rl = { type: "added" }, ld = { type: "removed" }, Cr = { type: "childadded", child: null }, Zn = { type: "childremoved", child: null };
-class dt extends _r {
+const Sl = /* @__PURE__ */ new w(), Cr = /* @__PURE__ */ new gi(), Ni = /* @__PURE__ */ new Ue(), Gs = /* @__PURE__ */ new w(), hs = /* @__PURE__ */ new w(), ad = /* @__PURE__ */ new w(), od = /* @__PURE__ */ new gi(), El = /* @__PURE__ */ new w(1, 0, 0), wl = /* @__PURE__ */ new w(0, 1, 0), Cl = /* @__PURE__ */ new w(0, 0, 1), Rl = { type: "added" }, ld = { type: "removed" }, Rr = { type: "childadded", child: null }, Zn = { type: "childremoved", child: null };
+class dt extends xr {
/**
* Constructs a new 3D object.
*/
@@ -6769,7 +6787,7 @@ class dt extends _r {
* @return {Object3D} A reference to this instance.
*/
rotateOnAxis(e, t) {
- return wr.setFromAxisAngle(e, t), this.quaternion.multiply(wr), this;
+ return Cr.setFromAxisAngle(e, t), this.quaternion.multiply(Cr), this;
}
/**
* Rotates the 3D object along an axis in world space.
@@ -6779,7 +6797,7 @@ class dt extends _r {
* @return {Object3D} A reference to this instance.
*/
rotateOnWorldAxis(e, t) {
- return wr.setFromAxisAngle(e, t), this.quaternion.premultiply(wr), this;
+ return Cr.setFromAxisAngle(e, t), this.quaternion.premultiply(Cr), this;
}
/**
* Rotates the 3D object around its X axis in local space.
@@ -6861,7 +6879,7 @@ class dt extends _r {
* @return {Vector3} The converted vector.
*/
worldToLocal(e) {
- return this.updateWorldMatrix(!0, !1), e.applyMatrix4(Ii.copy(this.matrixWorld).invert());
+ return this.updateWorldMatrix(!0, !1), e.applyMatrix4(Ni.copy(this.matrixWorld).invert());
}
/**
* Rotates the object to face a point in world space.
@@ -6875,7 +6893,7 @@ class dt extends _r {
lookAt(e, t, i) {
e.isVector3 ? Gs.copy(e) : Gs.set(e, t, i);
const r = this.parent;
- this.updateWorldMatrix(!0, !1), hs.setFromMatrixPosition(this.matrixWorld), this.isCamera || this.isLight ? Ii.lookAt(hs, Gs, this.up) : Ii.lookAt(Gs, hs, this.up), this.quaternion.setFromRotationMatrix(Ii), r && (Ii.extractRotation(r.matrixWorld), wr.setFromRotationMatrix(Ii), this.quaternion.premultiply(wr.invert()));
+ this.updateWorldMatrix(!0, !1), hs.setFromMatrixPosition(this.matrixWorld), this.isCamera || this.isLight ? Ni.lookAt(hs, Gs, this.up) : Ni.lookAt(Gs, hs, this.up), this.quaternion.setFromRotationMatrix(Ni), r && (Ni.extractRotation(r.matrixWorld), Cr.setFromRotationMatrix(Ni), this.quaternion.premultiply(Cr.invert()));
}
/**
* Adds the given 3D object as a child to this 3D object. An arbitrary number of
@@ -6893,7 +6911,7 @@ class dt extends _r {
this.add(arguments[t]);
return this;
}
- return e === this ? (He("Object3D.add: object can't be added as a child of itself.", e), this) : (e && e.isObject3D ? (e.removeFromParent(), e.parent = this, this.children.push(e), e.dispatchEvent(Rl), Cr.child = e, this.dispatchEvent(Cr), Cr.child = null) : He("Object3D.add: object not an instance of THREE.Object3D.", e), this);
+ return e === this ? (He("Object3D.add: object can't be added as a child of itself.", e), this) : (e && e.isObject3D ? (e.removeFromParent(), e.parent = this, this.children.push(e), e.dispatchEvent(Rl), Rr.child = e, this.dispatchEvent(Rr), Rr.child = null) : He("Object3D.add: object not an instance of THREE.Object3D.", e), this);
}
/**
* Removes the given 3D object as child from this 3D object.
@@ -6944,7 +6962,7 @@ class dt extends _r {
* @return {Object3D} A reference to this instance.
*/
attach(e) {
- return this.updateWorldMatrix(!0, !1), Ii.copy(this.matrixWorld).invert(), e.parent !== null && (e.parent.updateWorldMatrix(!0, !1), Ii.multiply(e.parent.matrixWorld)), e.applyMatrix4(Ii), e.removeFromParent(), e.parent = this, this.children.push(e), e.updateWorldMatrix(!1, !0), e.dispatchEvent(Rl), Cr.child = e, this.dispatchEvent(Cr), Cr.child = null, this;
+ return this.updateWorldMatrix(!0, !1), Ni.copy(this.matrixWorld).invert(), e.parent !== null && (e.parent.updateWorldMatrix(!0, !1), Ni.multiply(e.parent.matrixWorld)), e.applyMatrix4(Ni), e.removeFromParent(), e.parent = this, this.children.push(e), e.updateWorldMatrix(!1, !0), e.dispatchEvent(Rl), Rr.child = e, this.dispatchEvent(Rr), Rr.child = null, this;
}
/**
* Searches through the 3D object and its children, starting with the 3D object
@@ -7235,7 +7253,7 @@ class dt extends _r {
dt.DEFAULT_UP = /* @__PURE__ */ new w(0, 1, 0);
dt.DEFAULT_MATRIX_AUTO_UPDATE = !0;
dt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = !0;
-const oi = /* @__PURE__ */ new w(), Ui = /* @__PURE__ */ new w(), $n = /* @__PURE__ */ new w(), Ni = /* @__PURE__ */ new w(), Rr = /* @__PURE__ */ new w(), Ar = /* @__PURE__ */ new w(), Al = /* @__PURE__ */ new w(), Jn = /* @__PURE__ */ new w(), Qn = /* @__PURE__ */ new w(), ea = /* @__PURE__ */ new w(), ta = /* @__PURE__ */ new $e(), ia = /* @__PURE__ */ new $e(), ra = /* @__PURE__ */ new $e();
+const oi = /* @__PURE__ */ new w(), Oi = /* @__PURE__ */ new w(), $n = /* @__PURE__ */ new w(), Bi = /* @__PURE__ */ new w(), Ar = /* @__PURE__ */ new w(), Pr = /* @__PURE__ */ new w(), Al = /* @__PURE__ */ new w(), Jn = /* @__PURE__ */ new w(), Qn = /* @__PURE__ */ new w(), ea = /* @__PURE__ */ new w(), ta = /* @__PURE__ */ new $e(), ia = /* @__PURE__ */ new $e(), ra = /* @__PURE__ */ new $e();
class ui {
/**
* Constructs a new triangle.
@@ -7273,8 +7291,8 @@ class ui {
* @return {?Vector3} The barycentric coordinates for the given point
*/
static getBarycoord(e, t, i, r, n) {
- oi.subVectors(r, t), Ui.subVectors(i, t), $n.subVectors(e, t);
- const a = oi.dot(oi), o = oi.dot(Ui), l = oi.dot($n), c = Ui.dot(Ui), h = Ui.dot($n), u = a * c - o * o;
+ oi.subVectors(r, t), Oi.subVectors(i, t), $n.subVectors(e, t);
+ const a = oi.dot(oi), o = oi.dot(Oi), l = oi.dot($n), c = Oi.dot(Oi), h = Oi.dot($n), u = a * c - o * o;
if (u === 0)
return n.set(0, 0, 0), null;
const d = 1 / u, f = (c * l - o * h) * d, g = (a * h - o * l) * d;
@@ -7292,7 +7310,7 @@ class ui {
* triangle, lies within the triangle or not.
*/
static containsPoint(e, t, i, r) {
- return this.getBarycoord(e, t, i, r, Ni) === null ? !1 : Ni.x >= 0 && Ni.y >= 0 && Ni.x + Ni.y <= 1;
+ return this.getBarycoord(e, t, i, r, Bi) === null ? !1 : Bi.x >= 0 && Bi.y >= 0 && Bi.x + Bi.y <= 1;
}
/**
* Computes the value barycentrically interpolated for the given point on the
@@ -7309,7 +7327,7 @@ class ui {
* @return {?Vector3} The interpolated value.
*/
static getInterpolation(e, t, i, r, n, a, o, l) {
- return this.getBarycoord(e, t, i, r, Ni) === null ? (l.x = 0, l.y = 0, "z" in l && (l.z = 0), "w" in l && (l.w = 0), null) : (l.setScalar(0), l.addScaledVector(n, Ni.x), l.addScaledVector(a, Ni.y), l.addScaledVector(o, Ni.z), l);
+ return this.getBarycoord(e, t, i, r, Bi) === null ? (l.x = 0, l.y = 0, "z" in l && (l.z = 0), "w" in l && (l.w = 0), null) : (l.setScalar(0), l.addScaledVector(n, Bi.x), l.addScaledVector(a, Bi.y), l.addScaledVector(o, Bi.z), l);
}
/**
* Computes the value barycentrically interpolated for the given attribute and indices.
@@ -7335,7 +7353,7 @@ class ui {
* @return {boolean} Whether the triangle is oriented towards the given direction or not.
*/
static isFrontFacing(e, t, i, r) {
- return oi.subVectors(i, t), Ui.subVectors(e, t), oi.cross(Ui).dot(r) < 0;
+ return oi.subVectors(i, t), Oi.subVectors(e, t), oi.cross(Oi).dot(r) < 0;
}
/**
* Sets the triangle's vertices by copying the given values.
@@ -7395,7 +7413,7 @@ class ui {
* @return {number} The triangle's area.
*/
getArea() {
- return oi.subVectors(this.c, this.b), Ui.subVectors(this.a, this.b), oi.cross(Ui).length() * 0.5;
+ return oi.subVectors(this.c, this.b), Oi.subVectors(this.a, this.b), oi.cross(Oi).length() * 0.5;
}
/**
* Computes the midpoint of the triangle.
@@ -7488,29 +7506,29 @@ class ui {
closestPointToPoint(e, t) {
const i = this.a, r = this.b, n = this.c;
let a, o;
- Rr.subVectors(r, i), Ar.subVectors(n, i), Jn.subVectors(e, i);
- const l = Rr.dot(Jn), c = Ar.dot(Jn);
+ Ar.subVectors(r, i), Pr.subVectors(n, i), Jn.subVectors(e, i);
+ const l = Ar.dot(Jn), c = Pr.dot(Jn);
if (l <= 0 && c <= 0)
return t.copy(i);
Qn.subVectors(e, r);
- const h = Rr.dot(Qn), u = Ar.dot(Qn);
+ const h = Ar.dot(Qn), u = Pr.dot(Qn);
if (h >= 0 && u <= h)
return t.copy(r);
const d = l * u - h * c;
if (d <= 0 && l >= 0 && h <= 0)
- return a = l / (l - h), t.copy(i).addScaledVector(Rr, a);
+ return a = l / (l - h), t.copy(i).addScaledVector(Ar, a);
ea.subVectors(e, n);
- const f = Rr.dot(ea), g = Ar.dot(ea);
+ const f = Ar.dot(ea), g = Pr.dot(ea);
if (g >= 0 && f <= g)
return t.copy(n);
const v = f * c - l * g;
if (v <= 0 && c >= 0 && g <= 0)
- return o = c / (c - g), t.copy(i).addScaledVector(Ar, o);
+ return o = c / (c - g), t.copy(i).addScaledVector(Pr, o);
const m = h * g - f * u;
if (m <= 0 && u - h >= 0 && f - g >= 0)
return Al.subVectors(n, r), o = (u - h) / (u - h + (f - g)), t.copy(r).addScaledVector(Al, o);
const p = 1 / (m + v + d);
- return a = v * p, o = d * p, t.copy(i).addScaledVector(Rr, a).addScaledVector(Ar, o);
+ return a = v * p, o = d * p, t.copy(i).addScaledVector(Ar, a).addScaledVector(Pr, o);
}
/**
* Returns `true` if this triangle is equal with the given one.
@@ -7671,7 +7689,7 @@ const lh = {
whitesmoke: 16119285,
yellow: 16776960,
yellowgreen: 10145074
-}, Yi = { h: 0, s: 0, l: 0 }, Ws = { h: 0, s: 0, l: 0 };
+}, Ki = { h: 0, s: 0, l: 0 }, Ws = { h: 0, s: 0, l: 0 };
function sa(s, e, t) {
return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? s + (e - s) * 6 * t : t < 1 / 2 ? e : t < 2 / 3 ? s + (e - s) * 6 * (2 / 3 - t) : s;
}
@@ -7768,7 +7786,7 @@ class _e {
*/
setStyle(e, t = Ct) {
function i(n) {
- n !== void 0 && parseFloat(n) < 1 && be("Color: Alpha component of " + e + " will be ignored.");
+ n !== void 0 && parseFloat(n) < 1 && Me("Color: Alpha component of " + e + " will be ignored.");
}
let r;
if (r = /^(\w+)\(([^\)]*)\)/.exec(e)) {
@@ -7803,7 +7821,7 @@ class _e {
);
break;
default:
- be("Color: Unknown color model " + e);
+ Me("Color: Unknown color model " + e);
}
} else if (r = /^\#([A-Fa-f\d]+)$/.exec(e)) {
const n = r[1], a = n.length;
@@ -7816,7 +7834,7 @@ class _e {
);
if (a === 6)
return this.setHex(parseInt(n, 16), t);
- be("Color: Invalid hex color " + e);
+ Me("Color: Invalid hex color " + e);
} else if (e && e.length > 0)
return this.setColorName(e, t);
return this;
@@ -7836,7 +7854,7 @@ class _e {
*/
setColorName(e, t = Ct) {
const i = lh[e.toLowerCase()];
- return i !== void 0 ? this.setHex(i, t) : be("Color: Unknown color " + e), this;
+ return i !== void 0 ? this.setHex(i, t) : Me("Color: Unknown color " + e), this;
}
/**
* Returns a new color with copied values from this instance.
@@ -7863,7 +7881,7 @@ class _e {
* @return {Color} A reference to this color.
*/
copySRGBToLinear(e) {
- return this.r = Gi(e.r), this.g = Gi(e.g), this.b = Gi(e.b), this;
+ return this.r = Wi(e.r), this.g = Wi(e.g), this.b = Wi(e.b), this;
}
/**
* Copies the given color into this color, and then converts this color from
@@ -7873,7 +7891,7 @@ class _e {
* @return {Color} A reference to this color.
*/
copyLinearToSRGB(e) {
- return this.r = zr(e.r), this.g = zr(e.g), this.b = zr(e.b), this;
+ return this.r = Hr(e.r), this.g = Hr(e.g), this.b = Hr(e.b), this;
}
/**
* Converts this color from `SRGBColorSpace` to `LinearSRGBColorSpace`.
@@ -7898,7 +7916,7 @@ class _e {
* @return {number} The hexadecimal value.
*/
getHex(e = Ct) {
- return Xe.workingToColorSpace(Ut.copy(this), e), Math.round(ke(Ut.r * 255, 0, 255)) * 65536 + Math.round(ke(Ut.g * 255, 0, 255)) * 256 + Math.round(ke(Ut.b * 255, 0, 255));
+ return Xe.workingToColorSpace(Nt.copy(this), e), Math.round(ke(Nt.r * 255, 0, 255)) * 65536 + Math.round(ke(Nt.g * 255, 0, 255)) * 256 + Math.round(ke(Nt.b * 255, 0, 255));
}
/**
* Returns the hexadecimal value of this color as a string (for example, 'FFFFFF').
@@ -7918,8 +7936,8 @@ class _e {
* @return {{h:number,s:number,l:number}} The HSL representation of this color.
*/
getHSL(e, t = Xe.workingColorSpace) {
- Xe.workingToColorSpace(Ut.copy(this), t);
- const i = Ut.r, r = Ut.g, n = Ut.b, a = Math.max(i, r, n), o = Math.min(i, r, n);
+ Xe.workingToColorSpace(Nt.copy(this), t);
+ const i = Nt.r, r = Nt.g, n = Nt.b, a = Math.max(i, r, n), o = Math.min(i, r, n);
let l, c;
const h = (o + a) / 2;
if (o === a)
@@ -7949,7 +7967,7 @@ class _e {
* @return {Color} The RGB representation of this color.
*/
getRGB(e, t = Xe.workingColorSpace) {
- return Xe.workingToColorSpace(Ut.copy(this), t), e.r = Ut.r, e.g = Ut.g, e.b = Ut.b, e;
+ return Xe.workingToColorSpace(Nt.copy(this), t), e.r = Nt.r, e.g = Nt.g, e.b = Nt.b, e;
}
/**
* Returns the value of this color as a CSS style string. Example: `rgb(255,0,0)`.
@@ -7958,8 +7976,8 @@ class _e {
* @return {string} The CSS representation of this color.
*/
getStyle(e = Ct) {
- Xe.workingToColorSpace(Ut.copy(this), e);
- const t = Ut.r, i = Ut.g, r = Ut.b;
+ Xe.workingToColorSpace(Nt.copy(this), e);
+ const t = Nt.r, i = Nt.g, r = Nt.b;
return e !== Ct ? `color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})` : `rgb(${Math.round(t * 255)},${Math.round(i * 255)},${Math.round(r * 255)})`;
}
/**
@@ -7973,7 +7991,7 @@ class _e {
* @return {Color} A reference to this color.
*/
offsetHSL(e, t, i) {
- return this.getHSL(Yi), this.setHSL(Yi.h + e, Yi.s + t, Yi.l + i);
+ return this.getHSL(Ki), this.setHSL(Ki.h + e, Ki.s + t, Ki.l + i);
}
/**
* Adds the RGB values of the given color to the RGB values of this color.
@@ -8067,8 +8085,8 @@ class _e {
* @return {Color} A reference to this color.
*/
lerpHSL(e, t) {
- this.getHSL(Yi), e.getHSL(Ws);
- const i = Ts(Yi.h, Ws.h, t), r = Ts(Yi.s, Ws.s, t), n = Ts(Yi.l, Ws.l, t);
+ this.getHSL(Ki), e.getHSL(Ws);
+ const i = Ts(Ki.h, Ws.h, t), r = Ts(Ki.s, Ws.s, t), n = Ts(Ki.l, Ws.l, t);
return this.setHSL(i, r, n), this;
}
/**
@@ -8143,15 +8161,15 @@ class _e {
yield this.r, yield this.g, yield this.b;
}
}
-const Ut = /* @__PURE__ */ new _e();
+const Nt = /* @__PURE__ */ new _e();
_e.NAMES = lh;
let cd = 0;
-class ei extends _r {
+class ei extends xr {
/**
* Constructs a new material.
*/
constructor() {
- super(), this.isMaterial = !0, Object.defineProperty(this, "id", { value: cd++ }), this.uuid = pi(), this.name = "", this.type = "Material", this.blending = kr, this.side = Ei, this.vertexColors = !1, this.opacity = 1, this.transparent = !1, this.alphaHash = !1, this.blendSrc = wa, this.blendDst = Ca, this.blendEquation = ci, this.blendSrcAlpha = null, this.blendDstAlpha = null, this.blendEquationAlpha = null, this.blendColor = new _e(0, 0, 0), this.blendAlpha = 0, this.depthFunc = Wr, this.depthTest = !0, this.depthWrite = !0, this.stencilWriteMask = 255, this.stencilFunc = fo, this.stencilRef = 0, this.stencilFuncMask = 255, this.stencilFail = yr, this.stencilZFail = yr, this.stencilZPass = yr, this.stencilWrite = !1, this.clippingPlanes = null, this.clipIntersection = !1, this.clipShadows = !1, this.shadowSide = null, this.colorWrite = !0, this.precision = null, this.polygonOffset = !1, this.polygonOffsetFactor = 0, this.polygonOffsetUnits = 0, this.dithering = !1, this.alphaToCoverage = !1, this.premultipliedAlpha = !1, this.forceSinglePass = !1, this.allowOverride = !0, this.visible = !0, this.toneMapped = !0, this.userData = {}, this.version = 0, this._alphaTest = 0;
+ super(), this.isMaterial = !0, Object.defineProperty(this, "id", { value: cd++ }), this.uuid = pi(), this.name = "", this.type = "Material", this.blending = zr, this.side = Ci, this.vertexColors = !1, this.opacity = 1, this.transparent = !1, this.alphaHash = !1, this.blendSrc = wa, this.blendDst = Ca, this.blendEquation = ci, this.blendSrcAlpha = null, this.blendDstAlpha = null, this.blendEquationAlpha = null, this.blendColor = new _e(0, 0, 0), this.blendAlpha = 0, this.depthFunc = jr, this.depthTest = !0, this.depthWrite = !0, this.stencilWriteMask = 255, this.stencilFunc = fo, this.stencilRef = 0, this.stencilFuncMask = 255, this.stencilFail = br, this.stencilZFail = br, this.stencilZPass = br, this.stencilWrite = !1, this.clippingPlanes = null, this.clipIntersection = !1, this.clipShadows = !1, this.shadowSide = null, this.colorWrite = !0, this.precision = null, this.polygonOffset = !1, this.polygonOffsetFactor = 0, this.polygonOffsetUnits = 0, this.dithering = !1, this.alphaToCoverage = !1, this.premultipliedAlpha = !1, this.forceSinglePass = !1, this.allowOverride = !0, this.visible = !0, this.toneMapped = !0, this.userData = {}, this.version = 0, this._alphaTest = 0;
}
/**
* Sets the alpha value to be used when running an alpha test. The material
@@ -8219,12 +8237,12 @@ class ei extends _r {
for (const t in e) {
const i = e[t];
if (i === void 0) {
- be(`Material: parameter '${t}' has value of undefined.`);
+ Me(`Material: parameter '${t}' has value of undefined.`);
continue;
}
const r = this[t];
if (r === void 0) {
- be(`Material: '${t}' is not a property of THREE.${this.type}.`);
+ Me(`Material: '${t}' is not a property of THREE.${this.type}.`);
continue;
}
r && r.isColor ? r.set(i) : r && r.isVector3 && i && i.isVector3 ? r.copy(i) : this[t] = i;
@@ -8250,7 +8268,7 @@ class ei extends _r {
generator: "Material.toJSON"
}
};
- i.uuid = this.uuid, i.type = this.type, this.name !== "" && (i.name = this.name), this.color && this.color.isColor && (i.color = this.color.getHex()), this.roughness !== void 0 && (i.roughness = this.roughness), this.metalness !== void 0 && (i.metalness = this.metalness), this.sheen !== void 0 && (i.sheen = this.sheen), this.sheenColor && this.sheenColor.isColor && (i.sheenColor = this.sheenColor.getHex()), this.sheenRoughness !== void 0 && (i.sheenRoughness = this.sheenRoughness), this.emissive && this.emissive.isColor && (i.emissive = this.emissive.getHex()), this.emissiveIntensity !== void 0 && this.emissiveIntensity !== 1 && (i.emissiveIntensity = this.emissiveIntensity), this.specular && this.specular.isColor && (i.specular = this.specular.getHex()), this.specularIntensity !== void 0 && (i.specularIntensity = this.specularIntensity), this.specularColor && this.specularColor.isColor && (i.specularColor = this.specularColor.getHex()), this.shininess !== void 0 && (i.shininess = this.shininess), this.clearcoat !== void 0 && (i.clearcoat = this.clearcoat), this.clearcoatRoughness !== void 0 && (i.clearcoatRoughness = this.clearcoatRoughness), this.clearcoatMap && this.clearcoatMap.isTexture && (i.clearcoatMap = this.clearcoatMap.toJSON(e).uuid), this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture && (i.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(e).uuid), this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture && (i.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(e).uuid, i.clearcoatNormalScale = this.clearcoatNormalScale.toArray()), this.sheenColorMap && this.sheenColorMap.isTexture && (i.sheenColorMap = this.sheenColorMap.toJSON(e).uuid), this.sheenRoughnessMap && this.sheenRoughnessMap.isTexture && (i.sheenRoughnessMap = this.sheenRoughnessMap.toJSON(e).uuid), this.dispersion !== void 0 && (i.dispersion = this.dispersion), this.iridescence !== void 0 && (i.iridescence = this.iridescence), this.iridescenceIOR !== void 0 && (i.iridescenceIOR = this.iridescenceIOR), this.iridescenceThicknessRange !== void 0 && (i.iridescenceThicknessRange = this.iridescenceThicknessRange), this.iridescenceMap && this.iridescenceMap.isTexture && (i.iridescenceMap = this.iridescenceMap.toJSON(e).uuid), this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture && (i.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON(e).uuid), this.anisotropy !== void 0 && (i.anisotropy = this.anisotropy), this.anisotropyRotation !== void 0 && (i.anisotropyRotation = this.anisotropyRotation), this.anisotropyMap && this.anisotropyMap.isTexture && (i.anisotropyMap = this.anisotropyMap.toJSON(e).uuid), this.map && this.map.isTexture && (i.map = this.map.toJSON(e).uuid), this.matcap && this.matcap.isTexture && (i.matcap = this.matcap.toJSON(e).uuid), this.alphaMap && this.alphaMap.isTexture && (i.alphaMap = this.alphaMap.toJSON(e).uuid), this.lightMap && this.lightMap.isTexture && (i.lightMap = this.lightMap.toJSON(e).uuid, i.lightMapIntensity = this.lightMapIntensity), this.aoMap && this.aoMap.isTexture && (i.aoMap = this.aoMap.toJSON(e).uuid, i.aoMapIntensity = this.aoMapIntensity), this.bumpMap && this.bumpMap.isTexture && (i.bumpMap = this.bumpMap.toJSON(e).uuid, i.bumpScale = this.bumpScale), this.normalMap && this.normalMap.isTexture && (i.normalMap = this.normalMap.toJSON(e).uuid, i.normalMapType = this.normalMapType, i.normalScale = this.normalScale.toArray()), this.displacementMap && this.displacementMap.isTexture && (i.displacementMap = this.displacementMap.toJSON(e).uuid, i.displacementScale = this.displacementScale, i.displacementBias = this.displacementBias), this.roughnessMap && this.roughnessMap.isTexture && (i.roughnessMap = this.roughnessMap.toJSON(e).uuid), this.metalnessMap && this.metalnessMap.isTexture && (i.metalnessMap = this.metalnessMap.toJSON(e).uuid), this.emissiveMap && this.emissiveMap.isTexture && (i.emissiveMap = this.emissiveMap.toJSON(e).uuid), this.specularMap && this.specularMap.isTexture && (i.specularMap = this.specularMap.toJSON(e).uuid), this.specularIntensityMap && this.specularIntensityMap.isTexture && (i.specularIntensityMap = this.specularIntensityMap.toJSON(e).uuid), this.specularColorMap && this.specularColorMap.isTexture && (i.specularColorMap = this.specularColorMap.toJSON(e).uuid), this.envMap && this.envMap.isTexture && (i.envMap = this.envMap.toJSON(e).uuid, this.combine !== void 0 && (i.combine = this.combine)), this.envMapRotation !== void 0 && (i.envMapRotation = this.envMapRotation.toArray()), this.envMapIntensity !== void 0 && (i.envMapIntensity = this.envMapIntensity), this.reflectivity !== void 0 && (i.reflectivity = this.reflectivity), this.refractionRatio !== void 0 && (i.refractionRatio = this.refractionRatio), this.gradientMap && this.gradientMap.isTexture && (i.gradientMap = this.gradientMap.toJSON(e).uuid), this.transmission !== void 0 && (i.transmission = this.transmission), this.transmissionMap && this.transmissionMap.isTexture && (i.transmissionMap = this.transmissionMap.toJSON(e).uuid), this.thickness !== void 0 && (i.thickness = this.thickness), this.thicknessMap && this.thicknessMap.isTexture && (i.thicknessMap = this.thicknessMap.toJSON(e).uuid), this.attenuationDistance !== void 0 && this.attenuationDistance !== 1 / 0 && (i.attenuationDistance = this.attenuationDistance), this.attenuationColor !== void 0 && (i.attenuationColor = this.attenuationColor.getHex()), this.size !== void 0 && (i.size = this.size), this.shadowSide !== null && (i.shadowSide = this.shadowSide), this.sizeAttenuation !== void 0 && (i.sizeAttenuation = this.sizeAttenuation), this.blending !== kr && (i.blending = this.blending), this.side !== Ei && (i.side = this.side), this.vertexColors === !0 && (i.vertexColors = !0), this.opacity < 1 && (i.opacity = this.opacity), this.transparent === !0 && (i.transparent = !0), this.blendSrc !== wa && (i.blendSrc = this.blendSrc), this.blendDst !== Ca && (i.blendDst = this.blendDst), this.blendEquation !== ci && (i.blendEquation = this.blendEquation), this.blendSrcAlpha !== null && (i.blendSrcAlpha = this.blendSrcAlpha), this.blendDstAlpha !== null && (i.blendDstAlpha = this.blendDstAlpha), this.blendEquationAlpha !== null && (i.blendEquationAlpha = this.blendEquationAlpha), this.blendColor && this.blendColor.isColor && (i.blendColor = this.blendColor.getHex()), this.blendAlpha !== 0 && (i.blendAlpha = this.blendAlpha), this.depthFunc !== Wr && (i.depthFunc = this.depthFunc), this.depthTest === !1 && (i.depthTest = this.depthTest), this.depthWrite === !1 && (i.depthWrite = this.depthWrite), this.colorWrite === !1 && (i.colorWrite = this.colorWrite), this.stencilWriteMask !== 255 && (i.stencilWriteMask = this.stencilWriteMask), this.stencilFunc !== fo && (i.stencilFunc = this.stencilFunc), this.stencilRef !== 0 && (i.stencilRef = this.stencilRef), this.stencilFuncMask !== 255 && (i.stencilFuncMask = this.stencilFuncMask), this.stencilFail !== yr && (i.stencilFail = this.stencilFail), this.stencilZFail !== yr && (i.stencilZFail = this.stencilZFail), this.stencilZPass !== yr && (i.stencilZPass = this.stencilZPass), this.stencilWrite === !0 && (i.stencilWrite = this.stencilWrite), this.rotation !== void 0 && this.rotation !== 0 && (i.rotation = this.rotation), this.polygonOffset === !0 && (i.polygonOffset = !0), this.polygonOffsetFactor !== 0 && (i.polygonOffsetFactor = this.polygonOffsetFactor), this.polygonOffsetUnits !== 0 && (i.polygonOffsetUnits = this.polygonOffsetUnits), this.linewidth !== void 0 && this.linewidth !== 1 && (i.linewidth = this.linewidth), this.dashSize !== void 0 && (i.dashSize = this.dashSize), this.gapSize !== void 0 && (i.gapSize = this.gapSize), this.scale !== void 0 && (i.scale = this.scale), this.dithering === !0 && (i.dithering = !0), this.alphaTest > 0 && (i.alphaTest = this.alphaTest), this.alphaHash === !0 && (i.alphaHash = !0), this.alphaToCoverage === !0 && (i.alphaToCoverage = !0), this.premultipliedAlpha === !0 && (i.premultipliedAlpha = !0), this.forceSinglePass === !0 && (i.forceSinglePass = !0), this.wireframe === !0 && (i.wireframe = !0), this.wireframeLinewidth > 1 && (i.wireframeLinewidth = this.wireframeLinewidth), this.wireframeLinecap !== "round" && (i.wireframeLinecap = this.wireframeLinecap), this.wireframeLinejoin !== "round" && (i.wireframeLinejoin = this.wireframeLinejoin), this.flatShading === !0 && (i.flatShading = !0), this.visible === !1 && (i.visible = !1), this.toneMapped === !1 && (i.toneMapped = !1), this.fog === !1 && (i.fog = !1), Object.keys(this.userData).length > 0 && (i.userData = this.userData);
+ i.uuid = this.uuid, i.type = this.type, this.name !== "" && (i.name = this.name), this.color && this.color.isColor && (i.color = this.color.getHex()), this.roughness !== void 0 && (i.roughness = this.roughness), this.metalness !== void 0 && (i.metalness = this.metalness), this.sheen !== void 0 && (i.sheen = this.sheen), this.sheenColor && this.sheenColor.isColor && (i.sheenColor = this.sheenColor.getHex()), this.sheenRoughness !== void 0 && (i.sheenRoughness = this.sheenRoughness), this.emissive && this.emissive.isColor && (i.emissive = this.emissive.getHex()), this.emissiveIntensity !== void 0 && this.emissiveIntensity !== 1 && (i.emissiveIntensity = this.emissiveIntensity), this.specular && this.specular.isColor && (i.specular = this.specular.getHex()), this.specularIntensity !== void 0 && (i.specularIntensity = this.specularIntensity), this.specularColor && this.specularColor.isColor && (i.specularColor = this.specularColor.getHex()), this.shininess !== void 0 && (i.shininess = this.shininess), this.clearcoat !== void 0 && (i.clearcoat = this.clearcoat), this.clearcoatRoughness !== void 0 && (i.clearcoatRoughness = this.clearcoatRoughness), this.clearcoatMap && this.clearcoatMap.isTexture && (i.clearcoatMap = this.clearcoatMap.toJSON(e).uuid), this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture && (i.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(e).uuid), this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture && (i.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(e).uuid, i.clearcoatNormalScale = this.clearcoatNormalScale.toArray()), this.sheenColorMap && this.sheenColorMap.isTexture && (i.sheenColorMap = this.sheenColorMap.toJSON(e).uuid), this.sheenRoughnessMap && this.sheenRoughnessMap.isTexture && (i.sheenRoughnessMap = this.sheenRoughnessMap.toJSON(e).uuid), this.dispersion !== void 0 && (i.dispersion = this.dispersion), this.iridescence !== void 0 && (i.iridescence = this.iridescence), this.iridescenceIOR !== void 0 && (i.iridescenceIOR = this.iridescenceIOR), this.iridescenceThicknessRange !== void 0 && (i.iridescenceThicknessRange = this.iridescenceThicknessRange), this.iridescenceMap && this.iridescenceMap.isTexture && (i.iridescenceMap = this.iridescenceMap.toJSON(e).uuid), this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture && (i.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON(e).uuid), this.anisotropy !== void 0 && (i.anisotropy = this.anisotropy), this.anisotropyRotation !== void 0 && (i.anisotropyRotation = this.anisotropyRotation), this.anisotropyMap && this.anisotropyMap.isTexture && (i.anisotropyMap = this.anisotropyMap.toJSON(e).uuid), this.map && this.map.isTexture && (i.map = this.map.toJSON(e).uuid), this.matcap && this.matcap.isTexture && (i.matcap = this.matcap.toJSON(e).uuid), this.alphaMap && this.alphaMap.isTexture && (i.alphaMap = this.alphaMap.toJSON(e).uuid), this.lightMap && this.lightMap.isTexture && (i.lightMap = this.lightMap.toJSON(e).uuid, i.lightMapIntensity = this.lightMapIntensity), this.aoMap && this.aoMap.isTexture && (i.aoMap = this.aoMap.toJSON(e).uuid, i.aoMapIntensity = this.aoMapIntensity), this.bumpMap && this.bumpMap.isTexture && (i.bumpMap = this.bumpMap.toJSON(e).uuid, i.bumpScale = this.bumpScale), this.normalMap && this.normalMap.isTexture && (i.normalMap = this.normalMap.toJSON(e).uuid, i.normalMapType = this.normalMapType, i.normalScale = this.normalScale.toArray()), this.displacementMap && this.displacementMap.isTexture && (i.displacementMap = this.displacementMap.toJSON(e).uuid, i.displacementScale = this.displacementScale, i.displacementBias = this.displacementBias), this.roughnessMap && this.roughnessMap.isTexture && (i.roughnessMap = this.roughnessMap.toJSON(e).uuid), this.metalnessMap && this.metalnessMap.isTexture && (i.metalnessMap = this.metalnessMap.toJSON(e).uuid), this.emissiveMap && this.emissiveMap.isTexture && (i.emissiveMap = this.emissiveMap.toJSON(e).uuid), this.specularMap && this.specularMap.isTexture && (i.specularMap = this.specularMap.toJSON(e).uuid), this.specularIntensityMap && this.specularIntensityMap.isTexture && (i.specularIntensityMap = this.specularIntensityMap.toJSON(e).uuid), this.specularColorMap && this.specularColorMap.isTexture && (i.specularColorMap = this.specularColorMap.toJSON(e).uuid), this.envMap && this.envMap.isTexture && (i.envMap = this.envMap.toJSON(e).uuid, this.combine !== void 0 && (i.combine = this.combine)), this.envMapRotation !== void 0 && (i.envMapRotation = this.envMapRotation.toArray()), this.envMapIntensity !== void 0 && (i.envMapIntensity = this.envMapIntensity), this.reflectivity !== void 0 && (i.reflectivity = this.reflectivity), this.refractionRatio !== void 0 && (i.refractionRatio = this.refractionRatio), this.gradientMap && this.gradientMap.isTexture && (i.gradientMap = this.gradientMap.toJSON(e).uuid), this.transmission !== void 0 && (i.transmission = this.transmission), this.transmissionMap && this.transmissionMap.isTexture && (i.transmissionMap = this.transmissionMap.toJSON(e).uuid), this.thickness !== void 0 && (i.thickness = this.thickness), this.thicknessMap && this.thicknessMap.isTexture && (i.thicknessMap = this.thicknessMap.toJSON(e).uuid), this.attenuationDistance !== void 0 && this.attenuationDistance !== 1 / 0 && (i.attenuationDistance = this.attenuationDistance), this.attenuationColor !== void 0 && (i.attenuationColor = this.attenuationColor.getHex()), this.size !== void 0 && (i.size = this.size), this.shadowSide !== null && (i.shadowSide = this.shadowSide), this.sizeAttenuation !== void 0 && (i.sizeAttenuation = this.sizeAttenuation), this.blending !== zr && (i.blending = this.blending), this.side !== Ci && (i.side = this.side), this.vertexColors === !0 && (i.vertexColors = !0), this.opacity < 1 && (i.opacity = this.opacity), this.transparent === !0 && (i.transparent = !0), this.blendSrc !== wa && (i.blendSrc = this.blendSrc), this.blendDst !== Ca && (i.blendDst = this.blendDst), this.blendEquation !== ci && (i.blendEquation = this.blendEquation), this.blendSrcAlpha !== null && (i.blendSrcAlpha = this.blendSrcAlpha), this.blendDstAlpha !== null && (i.blendDstAlpha = this.blendDstAlpha), this.blendEquationAlpha !== null && (i.blendEquationAlpha = this.blendEquationAlpha), this.blendColor && this.blendColor.isColor && (i.blendColor = this.blendColor.getHex()), this.blendAlpha !== 0 && (i.blendAlpha = this.blendAlpha), this.depthFunc !== jr && (i.depthFunc = this.depthFunc), this.depthTest === !1 && (i.depthTest = this.depthTest), this.depthWrite === !1 && (i.depthWrite = this.depthWrite), this.colorWrite === !1 && (i.colorWrite = this.colorWrite), this.stencilWriteMask !== 255 && (i.stencilWriteMask = this.stencilWriteMask), this.stencilFunc !== fo && (i.stencilFunc = this.stencilFunc), this.stencilRef !== 0 && (i.stencilRef = this.stencilRef), this.stencilFuncMask !== 255 && (i.stencilFuncMask = this.stencilFuncMask), this.stencilFail !== br && (i.stencilFail = this.stencilFail), this.stencilZFail !== br && (i.stencilZFail = this.stencilZFail), this.stencilZPass !== br && (i.stencilZPass = this.stencilZPass), this.stencilWrite === !0 && (i.stencilWrite = this.stencilWrite), this.rotation !== void 0 && this.rotation !== 0 && (i.rotation = this.rotation), this.polygonOffset === !0 && (i.polygonOffset = !0), this.polygonOffsetFactor !== 0 && (i.polygonOffsetFactor = this.polygonOffsetFactor), this.polygonOffsetUnits !== 0 && (i.polygonOffsetUnits = this.polygonOffsetUnits), this.linewidth !== void 0 && this.linewidth !== 1 && (i.linewidth = this.linewidth), this.dashSize !== void 0 && (i.dashSize = this.dashSize), this.gapSize !== void 0 && (i.gapSize = this.gapSize), this.scale !== void 0 && (i.scale = this.scale), this.dithering === !0 && (i.dithering = !0), this.alphaTest > 0 && (i.alphaTest = this.alphaTest), this.alphaHash === !0 && (i.alphaHash = !0), this.alphaToCoverage === !0 && (i.alphaToCoverage = !0), this.premultipliedAlpha === !0 && (i.premultipliedAlpha = !0), this.forceSinglePass === !0 && (i.forceSinglePass = !0), this.wireframe === !0 && (i.wireframe = !0), this.wireframeLinewidth > 1 && (i.wireframeLinewidth = this.wireframeLinewidth), this.wireframeLinecap !== "round" && (i.wireframeLinecap = this.wireframeLinecap), this.wireframeLinejoin !== "round" && (i.wireframeLinejoin = this.wireframeLinejoin), this.flatShading === !0 && (i.flatShading = !0), this.visible === !1 && (i.visible = !1), this.toneMapped === !1 && (i.toneMapped = !1), this.fog === !1 && (i.fog = !1), Object.keys(this.userData).length > 0 && (i.userData = this.userData);
function r(n) {
const a = [];
for (const o in n) {
@@ -8329,7 +8347,7 @@ class kt extends ei {
return super.copy(e), this.color.copy(e.color), this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.specularMap = e.specularMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.envMapRotation.copy(e.envMapRotation), this.combine = e.combine, this.reflectivity = e.reflectivity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.fog = e.fog, this;
}
}
-const ki = /* @__PURE__ */ hd();
+const Hi = /* @__PURE__ */ hd();
function hd() {
const s = new ArrayBuffer(4), e = new Float32Array(s), t = new Uint32Array(s), i = new Uint32Array(512), r = new Uint32Array(512);
for (let l = 0; l < 256; ++l) {
@@ -8364,13 +8382,13 @@ function hd() {
};
}
function ud(s) {
- Math.abs(s) > 65504 && be("DataUtils.toHalfFloat(): Value out of range."), s = ke(s, -65504, 65504), ki.floatView[0] = s;
- const e = ki.uint32View[0], t = e >> 23 & 511;
- return ki.baseTable[t] + ((e & 8388607) >> ki.shiftTable[t]);
+ Math.abs(s) > 65504 && Me("DataUtils.toHalfFloat(): Value out of range."), s = ke(s, -65504, 65504), Hi.floatView[0] = s;
+ const e = Hi.uint32View[0], t = e >> 23 & 511;
+ return Hi.baseTable[t] + ((e & 8388607) >> Hi.shiftTable[t]);
}
function dd(s) {
const e = s >> 10;
- return ki.uint32View[0] = ki.mantissaTable[ki.offsetTable[e] + (s & 1023)] + ki.exponentTable[e], ki.floatView[0];
+ return Hi.uint32View[0] = Hi.mantissaTable[Hi.offsetTable[e] + (s & 1023)] + Hi.exponentTable[e], Hi.floatView[0];
}
class js {
/**
@@ -8755,8 +8773,8 @@ class fi extends Ht {
}
}
let fd = 0;
-const $t = /* @__PURE__ */ new Ue(), na = /* @__PURE__ */ new dt(), Pr = /* @__PURE__ */ new w(), Yt = /* @__PURE__ */ new At(), us = /* @__PURE__ */ new At(), wt = /* @__PURE__ */ new w();
-class ti extends _r {
+const $t = /* @__PURE__ */ new Ue(), na = /* @__PURE__ */ new dt(), Dr = /* @__PURE__ */ new w(), Yt = /* @__PURE__ */ new At(), us = /* @__PURE__ */ new At(), wt = /* @__PURE__ */ new w();
+class ti extends xr {
/**
* Constructs a new geometry.
*/
@@ -8968,7 +8986,7 @@ class ti extends _r {
* @return {BufferGeometry} A reference to this instance.
*/
center() {
- return this.computeBoundingBox(), this.boundingBox.getCenter(Pr).negate(), this.translate(Pr.x, Pr.y, Pr.z), this;
+ return this.computeBoundingBox(), this.boundingBox.getCenter(Dr).negate(), this.translate(Dr.x, Dr.y, Dr.z), this;
}
/**
* Defines a geometry by creating a `position` attribute based on the given array of points. The array
@@ -8996,7 +9014,7 @@ class ti extends _r {
const n = e[r];
t.setXYZ(r, n.x, n.y, n.z || 0);
}
- e.length > t.count && be("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."), t.needsUpdate = !0;
+ e.length > t.count && Me("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."), t.needsUpdate = !0;
}
return this;
}
@@ -9031,7 +9049,7 @@ class ti extends _r {
* You may need to recompute the bounding sphere if the geometry vertices are modified.
*/
computeBoundingSphere() {
- this.boundingSphere === null && (this.boundingSphere = new Ri());
+ this.boundingSphere === null && (this.boundingSphere = new Pi());
const e = this.attributes.position, t = this.morphAttributes.position;
if (e && e.isGLBufferAttribute) {
He("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.", this), this.boundingSphere.set(new w(), 1 / 0);
@@ -9052,7 +9070,7 @@ class ti extends _r {
for (let n = 0, a = t.length; n < a; n++) {
const o = t[n], l = this.morphTargetsRelative;
for (let c = 0, h = o.count; c < h; c++)
- wt.fromBufferAttribute(o, c), l && (Pr.fromBufferAttribute(e, c), wt.add(Pr)), r = Math.max(r, i.distanceToSquared(wt));
+ wt.fromBufferAttribute(o, c), l && (Dr.fromBufferAttribute(e, c), wt.add(Dr)), r = Math.max(r, i.distanceToSquared(wt));
}
this.boundingSphere.radius = Math.sqrt(r), isNaN(this.boundingSphere.radius) && He('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this);
}
@@ -9076,10 +9094,10 @@ class ti extends _r {
for (let I = 0; I < i.count; I++)
o[I] = new w(), l[I] = new w();
const c = new w(), h = new w(), u = new w(), d = new oe(), f = new oe(), g = new oe(), v = new w(), m = new w();
- function p(I, T, b) {
- c.fromBufferAttribute(i, I), h.fromBufferAttribute(i, T), u.fromBufferAttribute(i, b), d.fromBufferAttribute(n, I), f.fromBufferAttribute(n, T), g.fromBufferAttribute(n, b), h.sub(c), u.sub(c), f.sub(d), g.sub(d);
+ function p(I, T, M) {
+ c.fromBufferAttribute(i, I), h.fromBufferAttribute(i, T), u.fromBufferAttribute(i, M), d.fromBufferAttribute(n, I), f.fromBufferAttribute(n, T), g.fromBufferAttribute(n, M), h.sub(c), u.sub(c), f.sub(d), g.sub(d);
const D = 1 / (f.x * g.y - g.x * f.y);
- isFinite(D) && (v.copy(h).multiplyScalar(g.y).addScaledVector(u, -f.y).multiplyScalar(D), m.copy(u).multiplyScalar(f.x).addScaledVector(h, -g.x).multiplyScalar(D), o[I].add(v), o[T].add(v), o[b].add(v), l[I].add(m), l[T].add(m), l[b].add(m));
+ isFinite(D) && (v.copy(h).multiplyScalar(g.y).addScaledVector(u, -f.y).multiplyScalar(D), m.copy(u).multiplyScalar(f.x).addScaledVector(h, -g.x).multiplyScalar(D), o[I].add(v), o[T].add(v), o[M].add(v), l[I].add(m), l[T].add(m), l[M].add(m));
}
let y = this.groups;
y.length === 0 && (y = [{
@@ -9087,7 +9105,7 @@ class ti extends _r {
count: e.count
}]);
for (let I = 0, T = y.length; I < T; ++I) {
- const b = y[I], D = b.start, N = b.count;
+ const M = y[I], D = M.start, N = M.count;
for (let z = D, H = D + N; z < H; z += 3)
p(
e.getX(z + 0),
@@ -9100,11 +9118,11 @@ class ti extends _r {
A.fromBufferAttribute(r, I), S.copy(A);
const T = o[I];
_.copy(T), _.sub(A.multiplyScalar(A.dot(T))).normalize(), E.crossVectors(S, T);
- const b = E.dot(l[I]) < 0 ? -1 : 1;
- a.setXYZW(I, _.x, _.y, _.z, b);
+ const M = E.dot(l[I]) < 0 ? -1 : 1;
+ a.setXYZW(I, _.x, _.y, _.z, M);
}
for (let I = 0, T = y.length; I < T; ++I) {
- const b = y[I], D = b.start, N = b.count;
+ const M = y[I], D = M.start, N = M.count;
for (let z = D, H = D + N; z < H; z += 3)
R(e.getX(z + 0)), R(e.getX(z + 1)), R(e.getX(z + 2));
}
@@ -9163,7 +9181,7 @@ class ti extends _r {
return new Ht(d, h, u);
}
if (this.index === null)
- return be("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."), this;
+ return Me("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."), this;
const t = new ti(), i = this.index.array, r = this.attributes;
for (const o in r) {
const l = r[o], c = e(l, i);
@@ -9285,7 +9303,7 @@ class ti extends _r {
this.dispatchEvent({ type: "dispose" });
}
}
-const Pl = /* @__PURE__ */ new Ue(), cr = /* @__PURE__ */ new is(), qs = /* @__PURE__ */ new Ri(), Dl = /* @__PURE__ */ new w(), Ys = /* @__PURE__ */ new w(), Ks = /* @__PURE__ */ new w(), Zs = /* @__PURE__ */ new w(), aa = /* @__PURE__ */ new w(), $s = /* @__PURE__ */ new w(), Ll = /* @__PURE__ */ new w(), Js = /* @__PURE__ */ new w();
+const Pl = /* @__PURE__ */ new Ue(), cr = /* @__PURE__ */ new is(), qs = /* @__PURE__ */ new Pi(), Dl = /* @__PURE__ */ new w(), Ys = /* @__PURE__ */ new w(), Ks = /* @__PURE__ */ new w(), Zs = /* @__PURE__ */ new w(), aa = /* @__PURE__ */ new w(), $s = /* @__PURE__ */ new w(), Ll = /* @__PURE__ */ new w(), Js = /* @__PURE__ */ new w();
class nt extends dt {
/**
* Constructs a new mesh.
@@ -9387,7 +9405,7 @@ class nt extends dt {
}
function md(s, e, t, i, r, n, a, o) {
let l;
- if (e.side === zt ? l = i.intersectTriangle(a, n, r, !0, o) : l = i.intersectTriangle(r, n, a, e.side === Ei, o), l === null) return null;
+ if (e.side === zt ? l = i.intersectTriangle(a, n, r, !0, o) : l = i.intersectTriangle(r, n, a, e.side === Ci, o), l === null) return null;
Js.copy(o), Js.applyMatrix4(s.matrixWorld);
const c = t.ray.origin.distanceTo(Js);
return c < t.near || c > t.far ? null : {
@@ -9439,13 +9457,13 @@ class gr extends ti {
let d = 0, f = 0;
g("z", "y", "x", -1, -1, i, t, e, a, n, 0), g("z", "y", "x", 1, -1, i, t, -e, a, n, 1), g("x", "z", "y", 1, 1, e, i, t, r, a, 2), g("x", "z", "y", 1, -1, e, i, -t, r, a, 3), g("x", "y", "z", 1, -1, e, t, i, r, n, 4), g("x", "y", "z", -1, -1, e, t, -i, r, n, 5), this.setIndex(l), this.setAttribute("position", new fi(c, 3)), this.setAttribute("normal", new fi(h, 3)), this.setAttribute("uv", new fi(u, 2));
function g(v, m, p, y, _, E, A, S, R, I, T) {
- const b = E / R, D = A / I, N = E / 2, z = A / 2, H = S / 2, j = R + 1, q = I + 1;
+ const M = E / R, D = A / I, N = E / 2, z = A / 2, H = S / 2, j = R + 1, q = I + 1;
let te = 0, G = 0;
const Z = new w();
for (let se = 0; se < q; se++) {
const Pe = se * D - z;
for (let ze = 0; ze < j; ze++) {
- const qe = ze * b - N;
+ const qe = ze * M - N;
Z[v] = qe * y, Z[m] = Pe * _, Z[p] = H, c.push(Z.x, Z.y, Z.z), Z[v] = 0, Z[m] = 0, Z[p] = S > 0 ? 1 : -1, h.push(Z.x, Z.y, Z.z), u.push(ze / R), u.push(1 - se / I), te += 1;
}
}
@@ -9471,21 +9489,21 @@ class gr extends ti {
return new gr(e.width, e.height, e.depth, e.widthSegments, e.heightSegments, e.depthSegments);
}
}
-function Zr(s) {
+function $r(s) {
const e = {};
for (const t in s) {
e[t] = {};
for (const i in s[t]) {
const r = s[t][i];
- r && (r.isColor || r.isMatrix3 || r.isMatrix4 || r.isVector2 || r.isVector3 || r.isVector4 || r.isTexture || r.isQuaternion) ? r.isRenderTargetTexture ? (be("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."), e[t][i] = null) : e[t][i] = r.clone() : Array.isArray(r) ? e[t][i] = r.slice() : e[t][i] = r;
+ r && (r.isColor || r.isMatrix3 || r.isMatrix4 || r.isVector2 || r.isVector3 || r.isVector4 || r.isTexture || r.isQuaternion) ? r.isRenderTargetTexture ? (Me("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."), e[t][i] = null) : e[t][i] = r.clone() : Array.isArray(r) ? e[t][i] = r.slice() : e[t][i] = r;
}
}
return e;
}
-function Bt(s) {
+function Ft(s) {
const e = {};
for (let t = 0; t < s.length; t++) {
- const i = Zr(s[t]);
+ const i = $r(s[t]);
for (const r in i)
e[r] = i[r];
}
@@ -9501,7 +9519,7 @@ function uh(s) {
const e = s.getRenderTarget();
return e === null ? s.outputColorSpace : e.isXRRenderTarget === !0 ? e.texture.colorSpace : Xe.workingColorSpace;
}
-const di = { clone: Zr, merge: Bt };
+const di = { clone: $r, merge: Ft };
var vd = `void main() {
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`, _d = `void main() {
@@ -9530,7 +9548,7 @@ class ct extends ei {
}, this.index0AttributeName = void 0, this.uniformsNeedUpdate = !1, this.glslVersion = null, e !== void 0 && this.setValues(e);
}
copy(e) {
- return super.copy(e), this.fragmentShader = e.fragmentShader, this.vertexShader = e.vertexShader, this.uniforms = Zr(e.uniforms), this.uniformsGroups = gd(e.uniformsGroups), this.defines = Object.assign({}, e.defines), this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.fog = e.fog, this.lights = e.lights, this.clipping = e.clipping, this.extensions = Object.assign({}, e.extensions), this.glslVersion = e.glslVersion, this;
+ return super.copy(e), this.fragmentShader = e.fragmentShader, this.vertexShader = e.vertexShader, this.uniforms = $r(e.uniforms), this.uniformsGroups = gd(e.uniformsGroups), this.defines = Object.assign({}, e.defines), this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.fog = e.fog, this.lights = e.lights, this.clipping = e.clipping, this.extensions = Object.assign({}, e.extensions), this.glslVersion = e.glslVersion, this;
}
toJSON(e) {
const t = super.toJSON(e);
@@ -9610,8 +9628,8 @@ class dh extends dt {
return new this.constructor().copy(this);
}
}
-const Ki = /* @__PURE__ */ new w(), Il = /* @__PURE__ */ new oe(), Ul = /* @__PURE__ */ new oe();
-class bt extends dh {
+const Zi = /* @__PURE__ */ new w(), Il = /* @__PURE__ */ new oe(), Ul = /* @__PURE__ */ new oe();
+class Mt extends dh {
/**
* Constructs a new perspective camera.
*
@@ -9636,7 +9654,7 @@ class bt extends dh {
*/
setFocalLength(e) {
const t = 0.5 * this.getFilmHeight() / e;
- this.fov = Kr * 2 * Math.atan(t), this.updateProjectionMatrix();
+ this.fov = Zr * 2 * Math.atan(t), this.updateProjectionMatrix();
}
/**
* Returns the focal length from the current {@link PerspectiveCamera#fov} and
@@ -9645,7 +9663,7 @@ class bt extends dh {
* @return {number} The computed focal length.
*/
getFocalLength() {
- const e = Math.tan(bs * 0.5 * this.fov);
+ const e = Math.tan(Ms * 0.5 * this.fov);
return 0.5 * this.getFilmHeight() / e;
}
/**
@@ -9654,8 +9672,8 @@ class bt extends dh {
* @return {number} The effective FOV.
*/
getEffectiveFOV() {
- return Kr * 2 * Math.atan(
- Math.tan(bs * 0.5 * this.fov) / this.zoom
+ return Zr * 2 * Math.atan(
+ Math.tan(Ms * 0.5 * this.fov) / this.zoom
);
}
/**
@@ -9685,7 +9703,7 @@ class bt extends dh {
* @param {Vector2} maxTarget - The upper-right corner of the view rectangle is written into this vector.
*/
getViewBounds(e, t, i) {
- Ki.set(-1, -1, 0.5).applyMatrix4(this.projectionMatrixInverse), t.set(Ki.x, Ki.y).multiplyScalar(-e / Ki.z), Ki.set(1, 1, 0.5).applyMatrix4(this.projectionMatrixInverse), i.set(Ki.x, Ki.y).multiplyScalar(-e / Ki.z);
+ Zi.set(-1, -1, 0.5).applyMatrix4(this.projectionMatrixInverse), t.set(Zi.x, Zi.y).multiplyScalar(-e / Zi.z), Zi.set(1, 1, 0.5).applyMatrix4(this.projectionMatrixInverse), i.set(Zi.x, Zi.y).multiplyScalar(-e / Zi.z);
}
/**
* Computes the width and height of the camera's viewable rectangle at a given distance along the viewing direction.
@@ -9763,7 +9781,7 @@ class bt extends dh {
*/
updateProjectionMatrix() {
const e = this.near;
- let t = e * Math.tan(bs * 0.5 * this.fov) / this.zoom, i = 2 * t, r = this.aspect * i, n = -0.5 * r;
+ let t = e * Math.tan(Ms * 0.5 * this.fov) / this.zoom, i = 2 * t, r = this.aspect * i, n = -0.5 * r;
const a = this.view;
if (this.view !== null && this.view.enabled) {
const l = a.fullWidth, c = a.fullHeight;
@@ -9777,7 +9795,7 @@ class bt extends dh {
return t.object.fov = this.fov, t.object.zoom = this.zoom, t.object.near = this.near, t.object.far = this.far, t.object.focus = this.focus, t.object.aspect = this.aspect, this.view !== null && (t.object.view = Object.assign({}, this.view)), t.object.filmGauge = this.filmGauge, t.object.filmOffset = this.filmOffset, t;
}
}
-const Dr = -90, Lr = 1;
+const Lr = -90, Ir = 1;
class xd extends dt {
/**
* Constructs a new cube camera.
@@ -9788,17 +9806,17 @@ class xd extends dt {
*/
constructor(e, t, i) {
super(), this.type = "CubeCamera", this.renderTarget = i, this.coordinateSystem = null, this.activeMipmapLevel = 0;
- const r = new bt(Dr, Lr, e, t);
+ const r = new Mt(Lr, Ir, e, t);
r.layers = this.layers, this.add(r);
- const n = new bt(Dr, Lr, e, t);
+ const n = new Mt(Lr, Ir, e, t);
n.layers = this.layers, this.add(n);
- const a = new bt(Dr, Lr, e, t);
+ const a = new Mt(Lr, Ir, e, t);
a.layers = this.layers, this.add(a);
- const o = new bt(Dr, Lr, e, t);
+ const o = new Mt(Lr, Ir, e, t);
o.layers = this.layers, this.add(o);
- const l = new bt(Dr, Lr, e, t);
+ const l = new Mt(Lr, Ir, e, t);
l.layers = this.layers, this.add(l);
- const c = new bt(Dr, Lr, e, t);
+ const c = new Mt(Lr, Ir, e, t);
c.layers = this.layers, this.add(c);
}
/**
@@ -9848,7 +9866,7 @@ class Ho extends Rt {
* @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.
* @param {string} [colorSpace=NoColorSpace] - The color space value.
*/
- constructor(e = [], t = jr, i, r, n, a, o, l, c, h) {
+ constructor(e = [], t = Xr, i, r, n, a, o, l, c, h) {
super(e, t, i, r, n, a, o, l, c, h), this.isCubeTexture = !0, this.flipY = !1;
}
/**
@@ -9933,7 +9951,7 @@ class yd extends xt {
)
}, r = new gr(5, 5, 5), n = new ct({
name: "CubemapFromEquirect",
- uniforms: Zr(i.uniforms),
+ uniforms: $r(i.uniforms),
vertexShader: i.vertexShader,
fragmentShader: i.fragmentShader,
side: zt,
@@ -9958,12 +9976,12 @@ class yd extends xt {
e.setRenderTarget(n);
}
}
-let zi = class extends dt {
+let Vi = class extends dt {
constructor() {
super(), this.isGroup = !0, this.type = "Group";
}
};
-const Md = { type: "move" };
+const bd = { type: "move" };
class oa {
/**
* Constructs a new XR controller.
@@ -9977,7 +9995,7 @@ class oa {
* @return {Group} A group representing the hand space of the XR controller.
*/
getHandSpace() {
- return this._hand === null && (this._hand = new zi(), this._hand.matrixAutoUpdate = !1, this._hand.visible = !1, this._hand.joints = {}, this._hand.inputState = { pinching: !1 }), this._hand;
+ return this._hand === null && (this._hand = new Vi(), this._hand.matrixAutoUpdate = !1, this._hand.visible = !1, this._hand.joints = {}, this._hand.inputState = { pinching: !1 }), this._hand;
}
/**
* Returns a group representing the target ray space of the XR controller.
@@ -9985,7 +10003,7 @@ class oa {
* @return {Group} A group representing the target ray space of the XR controller.
*/
getTargetRaySpace() {
- return this._targetRay === null && (this._targetRay = new zi(), this._targetRay.matrixAutoUpdate = !1, this._targetRay.visible = !1, this._targetRay.hasLinearVelocity = !1, this._targetRay.linearVelocity = new w(), this._targetRay.hasAngularVelocity = !1, this._targetRay.angularVelocity = new w()), this._targetRay;
+ return this._targetRay === null && (this._targetRay = new Vi(), this._targetRay.matrixAutoUpdate = !1, this._targetRay.visible = !1, this._targetRay.hasLinearVelocity = !1, this._targetRay.linearVelocity = new w(), this._targetRay.hasAngularVelocity = !1, this._targetRay.angularVelocity = new w()), this._targetRay;
}
/**
* Returns a group representing the grip space of the XR controller.
@@ -9993,7 +10011,7 @@ class oa {
* @return {Group} A group representing the grip space of the XR controller.
*/
getGripSpace() {
- return this._grip === null && (this._grip = new zi(), this._grip.matrixAutoUpdate = !1, this._grip.visible = !1, this._grip.hasLinearVelocity = !1, this._grip.linearVelocity = new w(), this._grip.hasAngularVelocity = !1, this._grip.angularVelocity = new w()), this._grip;
+ return this._grip === null && (this._grip = new Vi(), this._grip.matrixAutoUpdate = !1, this._grip.visible = !1, this._grip.hasLinearVelocity = !1, this._grip.linearVelocity = new w(), this._grip.hasAngularVelocity = !1, this._grip.angularVelocity = new w()), this._grip;
}
/**
* Dispatches the given event to the groups representing
@@ -10061,7 +10079,7 @@ class oa {
}));
} else
l !== null && e.gripSpace && (n = t.getPose(e.gripSpace, i), n !== null && (l.matrix.fromArray(n.transform.matrix), l.matrix.decompose(l.position, l.rotation, l.scale), l.matrixWorldNeedsUpdate = !0, n.linearVelocity ? (l.hasLinearVelocity = !0, l.linearVelocity.copy(n.linearVelocity)) : l.hasLinearVelocity = !1, n.angularVelocity ? (l.hasAngularVelocity = !0, l.angularVelocity.copy(n.angularVelocity)) : l.hasAngularVelocity = !1));
- o !== null && (r = t.getPose(e.targetRaySpace, i), r === null && n !== null && (r = n), r !== null && (o.matrix.fromArray(r.transform.matrix), o.matrix.decompose(o.position, o.rotation, o.scale), o.matrixWorldNeedsUpdate = !0, r.linearVelocity ? (o.hasLinearVelocity = !0, o.linearVelocity.copy(r.linearVelocity)) : o.hasLinearVelocity = !1, r.angularVelocity ? (o.hasAngularVelocity = !0, o.angularVelocity.copy(r.angularVelocity)) : o.hasAngularVelocity = !1, this.dispatchEvent(Md)));
+ o !== null && (r = t.getPose(e.targetRaySpace, i), r === null && n !== null && (r = n), r !== null && (o.matrix.fromArray(r.transform.matrix), o.matrix.decompose(o.position, o.rotation, o.scale), o.matrixWorldNeedsUpdate = !0, r.linearVelocity ? (o.hasLinearVelocity = !0, o.linearVelocity.copy(r.linearVelocity)) : o.hasLinearVelocity = !1, r.angularVelocity ? (o.hasAngularVelocity = !0, o.angularVelocity.copy(r.angularVelocity)) : o.hasAngularVelocity = !1, this.dispatchEvent(bd)));
}
return o !== null && (o.visible = r !== null), l !== null && (l.visible = n !== null), c !== null && (c.visible = a !== null), this;
}
@@ -10075,7 +10093,7 @@ class oa {
*/
_getHandJoint(e, t) {
if (e.joints[t.jointName] === void 0) {
- const i = new zi();
+ const i = new Vi();
i.matrixAutoUpdate = !1, i.visible = !1, e.joints[t.jointName] = i, e.add(i);
}
return e.joints[t.jointName];
@@ -10096,7 +10114,7 @@ class Vo extends dt {
return this.fog !== null && (t.object.fog = this.fog.toJSON()), this.backgroundBlurriness > 0 && (t.object.backgroundBlurriness = this.backgroundBlurriness), this.backgroundIntensity !== 1 && (t.object.backgroundIntensity = this.backgroundIntensity), t.object.backgroundRotation = this.backgroundRotation.toArray(), this.environmentIntensity !== 1 && (t.object.environmentIntensity = this.environmentIntensity), t.object.environmentRotation = this.environmentRotation.toArray(), t;
}
}
-class bd {
+class Md {
/**
* Constructs a new interleaved buffer.
*
@@ -10219,7 +10237,7 @@ class bd {
};
}
}
-const Ot = /* @__PURE__ */ new w();
+const Bt = /* @__PURE__ */ new w();
class Go {
/**
* Constructs a new interleaved buffer attribute.
@@ -10269,7 +10287,7 @@ class Go {
*/
applyMatrix4(e) {
for (let t = 0, i = this.data.count; t < i; t++)
- Ot.fromBufferAttribute(this, t), Ot.applyMatrix4(e), this.setXYZ(t, Ot.x, Ot.y, Ot.z);
+ Bt.fromBufferAttribute(this, t), Bt.applyMatrix4(e), this.setXYZ(t, Bt.x, Bt.y, Bt.z);
return this;
}
/**
@@ -10281,7 +10299,7 @@ class Go {
*/
applyNormalMatrix(e) {
for (let t = 0, i = this.count; t < i; t++)
- Ot.fromBufferAttribute(this, t), Ot.applyNormalMatrix(e), this.setXYZ(t, Ot.x, Ot.y, Ot.z);
+ Bt.fromBufferAttribute(this, t), Bt.applyNormalMatrix(e), this.setXYZ(t, Bt.x, Bt.y, Bt.z);
return this;
}
/**
@@ -10293,7 +10311,7 @@ class Go {
*/
transformDirection(e) {
for (let t = 0, i = this.count; t < i; t++)
- Ot.fromBufferAttribute(this, t), Ot.transformDirection(e), this.setXYZ(t, Ot.x, Ot.y, Ot.z);
+ Bt.fromBufferAttribute(this, t), Bt.transformDirection(e), this.setXYZ(t, Bt.x, Bt.y, Bt.z);
return this;
}
/**
@@ -10488,7 +10506,7 @@ class Go {
};
}
}
-const Nl = /* @__PURE__ */ new w(), Ol = /* @__PURE__ */ new $e(), Bl = /* @__PURE__ */ new $e(), Td = /* @__PURE__ */ new w(), Fl = /* @__PURE__ */ new Ue(), en = /* @__PURE__ */ new w(), la = /* @__PURE__ */ new Ri(), kl = /* @__PURE__ */ new Ue(), ca = /* @__PURE__ */ new is();
+const Nl = /* @__PURE__ */ new w(), Ol = /* @__PURE__ */ new $e(), Bl = /* @__PURE__ */ new $e(), Td = /* @__PURE__ */ new w(), Fl = /* @__PURE__ */ new Ue(), en = /* @__PURE__ */ new w(), la = /* @__PURE__ */ new Pi(), kl = /* @__PURE__ */ new Ue(), ca = /* @__PURE__ */ new is();
class Sd extends nt {
/**
* Constructs a new skinned mesh.
@@ -10520,7 +10538,7 @@ class Sd extends nt {
*/
computeBoundingSphere() {
const e = this.geometry;
- this.boundingSphere === null && (this.boundingSphere = new Ri()), this.boundingSphere.makeEmpty();
+ this.boundingSphere === null && (this.boundingSphere = new Pi()), this.boundingSphere.makeEmpty();
const t = e.getAttribute("position");
for (let i = 0; i < t.count; i++)
this.getVertexPosition(i, en), this.boundingSphere.expandByPoint(en);
@@ -10564,7 +10582,7 @@ class Sd extends nt {
}
}
updateMatrixWorld(e) {
- super.updateMatrixWorld(e), this.bindMode === dl ? this.bindMatrixInverse.copy(this.matrixWorld).invert() : this.bindMode === xu ? this.bindMatrixInverse.copy(this.bindMatrix).invert() : be("SkinnedMesh: Unrecognized bindMode: " + this.bindMode);
+ super.updateMatrixWorld(e), this.bindMode === dl ? this.bindMatrixInverse.copy(this.matrixWorld).invert() : this.bindMode === xu ? this.bindMatrixInverse.copy(this.bindMatrix).invert() : Me("SkinnedMesh: Unrecognized bindMode: " + this.bindMode);
}
/**
* Applies the bone transform associated with the given index to the given
@@ -10613,7 +10631,7 @@ class rs extends Rt {
* @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.
* @param {string} [colorSpace=NoColorSpace] - The color space.
*/
- constructor(e = null, t = 1, i = 1, r, n, a, o, l, c = Lt, h = Lt, u, d) {
+ constructor(e = null, t = 1, i = 1, r, n, a, o, l, c = It, h = It, u, d) {
super(null, a, o, l, c, h, r, n, u, d), this.isDataTexture = !0, this.image = { data: e, width: t, height: i }, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1;
}
}
@@ -10639,7 +10657,7 @@ class Wo {
if (this.boneMatrices = new Float32Array(e.length * 16), t.length === 0)
this.calculateInverses();
else if (e.length !== t.length) {
- be("Skeleton: Number of inverse bone matrices does not match amount of bones."), this.boneInverses = [];
+ Me("Skeleton: Number of inverse bone matrices does not match amount of bones."), this.boneInverses = [];
for (let i = 0, r = this.bones.length; i < r; i++)
this.boneInverses.push(new Ue());
}
@@ -10733,7 +10751,7 @@ class Wo {
for (let i = 0, r = e.bones.length; i < r; i++) {
const n = e.bones[i];
let a = t[n];
- a === void 0 && (be("Skeleton: No bone found with UUID:", n), a = new ph()), this.bones.push(a), this.boneInverses.push(new Ue().fromArray(e.boneInverses[i]));
+ a === void 0 && (Me("Skeleton: No bone found with UUID:", n), a = new ph()), this.bones.push(a), this.boneInverses.push(new Ue().fromArray(e.boneInverses[i]));
}
return this.init(), this;
}
@@ -10784,7 +10802,7 @@ class go extends Ht {
return e.meshPerAttribute = this.meshPerAttribute, e.isInstancedBufferAttribute = !0, e;
}
}
-const Ir = /* @__PURE__ */ new Ue(), Hl = /* @__PURE__ */ new Ue(), tn = [], Vl = /* @__PURE__ */ new At(), wd = /* @__PURE__ */ new Ue(), ds = /* @__PURE__ */ new nt(), ps = /* @__PURE__ */ new Ri();
+const Ur = /* @__PURE__ */ new Ue(), Hl = /* @__PURE__ */ new Ue(), tn = [], Vl = /* @__PURE__ */ new At(), wd = /* @__PURE__ */ new Ue(), ds = /* @__PURE__ */ new nt(), ps = /* @__PURE__ */ new Pi();
class Cd extends nt {
/**
* Constructs a new instanced mesh.
@@ -10807,7 +10825,7 @@ class Cd extends nt {
const e = this.geometry, t = this.count;
this.boundingBox === null && (this.boundingBox = new At()), e.boundingBox === null && e.computeBoundingBox(), this.boundingBox.makeEmpty();
for (let i = 0; i < t; i++)
- this.getMatrixAt(i, Ir), Vl.copy(e.boundingBox).applyMatrix4(Ir), this.boundingBox.union(Vl);
+ this.getMatrixAt(i, Ur), Vl.copy(e.boundingBox).applyMatrix4(Ur), this.boundingBox.union(Vl);
}
/**
* Computes the bounding sphere of the instanced mesh, and updates {@link InstancedMesh#boundingSphere}
@@ -10816,9 +10834,9 @@ class Cd extends nt {
*/
computeBoundingSphere() {
const e = this.geometry, t = this.count;
- this.boundingSphere === null && (this.boundingSphere = new Ri()), e.boundingSphere === null && e.computeBoundingSphere(), this.boundingSphere.makeEmpty();
+ this.boundingSphere === null && (this.boundingSphere = new Pi()), e.boundingSphere === null && e.computeBoundingSphere(), this.boundingSphere.makeEmpty();
for (let i = 0; i < t; i++)
- this.getMatrixAt(i, Ir), ps.copy(e.boundingSphere).applyMatrix4(Ir), this.boundingSphere.union(ps);
+ this.getMatrixAt(i, Ur), ps.copy(e.boundingSphere).applyMatrix4(Ur), this.boundingSphere.union(ps);
}
copy(e, t) {
return super.copy(e, t), this.instanceMatrix.copy(e.instanceMatrix), e.morphTexture !== null && (this.morphTexture = e.morphTexture.clone()), e.instanceColor !== null && (this.instanceColor = e.instanceColor.clone()), this.count = e.count, e.boundingBox !== null && (this.boundingBox = e.boundingBox.clone()), e.boundingSphere !== null && (this.boundingSphere = e.boundingSphere.clone()), this;
@@ -10856,7 +10874,7 @@ class Cd extends nt {
const i = this.matrixWorld, r = this.count;
if (ds.geometry = this.geometry, ds.material = this.material, ds.material !== void 0 && (this.boundingSphere === null && this.computeBoundingSphere(), ps.copy(this.boundingSphere), ps.applyMatrix4(i), e.ray.intersectsSphere(ps) !== !1))
for (let n = 0; n < r; n++) {
- this.getMatrixAt(n, Ir), Hl.multiplyMatrices(i, Ir), ds.matrixWorld = Hl, ds.raycast(e, tn);
+ this.getMatrixAt(n, Ur), Hl.multiplyMatrices(i, Ur), ds.matrixWorld = Hl, ds.raycast(e, tn);
for (let a = 0, o = tn.length; a < o; a++) {
const l = tn[a];
l.instanceId = n, l.object = this, t.push(l);
@@ -10913,7 +10931,7 @@ class Cd extends nt {
}
}
const ha = /* @__PURE__ */ new w(), Rd = /* @__PURE__ */ new w(), Ad = /* @__PURE__ */ new Be();
-class Mi {
+class bi {
/**
* Constructs a new plane.
*
@@ -11123,7 +11141,7 @@ class Mi {
return new this.constructor().copy(this);
}
}
-const hr = /* @__PURE__ */ new Ri(), Pd = /* @__PURE__ */ new oe(0.5, 0.5), rn = /* @__PURE__ */ new w();
+const hr = /* @__PURE__ */ new Pi(), Pd = /* @__PURE__ */ new oe(0.5, 0.5), rn = /* @__PURE__ */ new w();
class jo {
/**
* Constructs a new frustum.
@@ -11135,7 +11153,7 @@ class jo {
* @param {Plane} [p4] - The fifth plane that encloses the frustum.
* @param {Plane} [p5] - The sixth plane that encloses the frustum.
*/
- constructor(e = new Mi(), t = new Mi(), i = new Mi(), r = new Mi(), n = new Mi(), a = new Mi()) {
+ constructor(e = new bi(), t = new bi(), i = new bi(), r = new bi(), n = new bi(), a = new bi()) {
this.planes = [e, t, i, r, n, a];
}
/**
@@ -11280,7 +11298,7 @@ class fh extends ei {
return super.copy(e), this.color.copy(e.color), this.map = e.map, this.linewidth = e.linewidth, this.linecap = e.linecap, this.linejoin = e.linejoin, this.fog = e.fog, this;
}
}
-const Rn = /* @__PURE__ */ new w(), An = /* @__PURE__ */ new w(), Gl = /* @__PURE__ */ new Ue(), fs = /* @__PURE__ */ new is(), sn = /* @__PURE__ */ new Ri(), ua = /* @__PURE__ */ new w(), Wl = /* @__PURE__ */ new w();
+const Rn = /* @__PURE__ */ new w(), An = /* @__PURE__ */ new w(), Gl = /* @__PURE__ */ new Ue(), fs = /* @__PURE__ */ new is(), sn = /* @__PURE__ */ new Pi(), ua = /* @__PURE__ */ new w(), Wl = /* @__PURE__ */ new w();
class Xo extends dt {
/**
* Constructs a new line.
@@ -11309,7 +11327,7 @@ class Xo extends dt {
Rn.fromBufferAttribute(t, r - 1), An.fromBufferAttribute(t, r), i[r] = i[r - 1], i[r] += Rn.distanceTo(An);
e.setAttribute("lineDistance", new fi(i, 1));
} else
- be("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
+ Me("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
return this;
}
/**
@@ -11400,7 +11418,7 @@ class Dd extends Xo {
jl.fromBufferAttribute(t, r), Xl.fromBufferAttribute(t, r + 1), i[r] = r === 0 ? 0 : i[r - 1], i[r + 1] = i[r] + jl.distanceTo(Xl);
e.setAttribute("lineDistance", new fi(i, 1));
} else
- be("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
+ Me("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
return this;
}
}
@@ -11432,7 +11450,7 @@ class mh extends ei {
return super.copy(e), this.color.copy(e.color), this.map = e.map, this.alphaMap = e.alphaMap, this.size = e.size, this.sizeAttenuation = e.sizeAttenuation, this.fog = e.fog, this;
}
}
-const ql = /* @__PURE__ */ new Ue(), vo = /* @__PURE__ */ new is(), an = /* @__PURE__ */ new Ri(), on = /* @__PURE__ */ new w();
+const ql = /* @__PURE__ */ new Ue(), vo = /* @__PURE__ */ new is(), an = /* @__PURE__ */ new Pi(), on = /* @__PURE__ */ new w();
class Id extends dt {
/**
* Constructs a new point cloud.
@@ -11522,8 +11540,8 @@ class qo extends Rt {
* @param {number} [format=DepthFormat] - The texture format.
* @param {number} [depth=1] - The depth of the texture.
*/
- constructor(e, t, i = mr, r, n, a, o = Lt, l = Lt, c, h = ws, u = 1) {
- if (h !== ws && h !== Yr)
+ constructor(e, t, i = mr, r, n, a, o = It, l = It, c, h = ws, u = 1) {
+ if (h !== ws && h !== Kr)
throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");
const d = { width: e, height: t, depth: u };
super(d, r, n, a, o, l, h, i, c), this.isDepthTexture = !0, this.flipY = !1, this.generateMipmaps = !1, this.compareFunction = null;
@@ -11625,7 +11643,7 @@ class Yo extends ei {
return super.copy(e), this.defines = { STANDARD: "" }, this.color.copy(e.color), this.roughness = e.roughness, this.metalness = e.metalness, this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.roughnessMap = e.roughnessMap, this.metalnessMap = e.metalnessMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.envMapRotation.copy(e.envMapRotation), this.envMapIntensity = e.envMapIntensity, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.flatShading = e.flatShading, this.fog = e.fog, this;
}
}
-class Ai extends Yo {
+class Di extends Yo {
/**
* Constructs a new mesh physical material.
*
@@ -11783,7 +11801,7 @@ class vh extends ei {
* by {@link Color#set}.
*/
constructor(e) {
- super(), this.isMeshDepthMaterial = !0, this.type = "MeshDepthMaterial", this.depthPacking = bu, this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = !1, this.wireframeLinewidth = 1, this.setValues(e);
+ super(), this.isMeshDepthMaterial = !0, this.type = "MeshDepthMaterial", this.depthPacking = Mu, this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = !1, this.wireframeLinewidth = 1, this.setValues(e);
}
copy(e) {
return super.copy(e), this.depthPacking = e.depthPacking, this.map = e.map, this.alphaMap = e.alphaMap, this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this;
@@ -12136,7 +12154,7 @@ class _i {
this.setInterpolation(this.DefaultInterpolation);
else
throw new Error(i);
- return be("KeyframeTrack:", i), this;
+ return Me("KeyframeTrack:", i), this;
}
return this.createInterpolant = t, this;
}
@@ -12341,7 +12359,7 @@ class xh extends _i {
}
}
xh.prototype.ValueTypeName = "color";
-class $r extends _i {
+class Jr extends _i {
/**
* Constructs a new number keyframe track.
*
@@ -12354,7 +12372,7 @@ class $r extends _i {
super(e, t, i, r);
}
}
-$r.prototype.ValueTypeName = "number";
+Jr.prototype.ValueTypeName = "number";
class Gd extends Ls {
/**
* Constructs a new SLERP interpolant.
@@ -12375,7 +12393,7 @@ class Gd extends Ls {
return n;
}
}
-class Jr extends _i {
+class Qr extends _i {
/**
* Constructs a new Quaternion keyframe track.
*
@@ -12398,8 +12416,8 @@ class Jr extends _i {
return new Gd(this.times, this.values, this.getValueSize(), e);
}
}
-Jr.prototype.ValueTypeName = "quaternion";
-Jr.prototype.InterpolantFactoryMethodSmooth = void 0;
+Qr.prototype.ValueTypeName = "quaternion";
+Qr.prototype.InterpolantFactoryMethodSmooth = void 0;
class ns extends _i {
/**
* Constructs a new string keyframe track.
@@ -12420,7 +12438,7 @@ ns.prototype.ValueBufferType = Array;
ns.prototype.DefaultInterpolation = Cs;
ns.prototype.InterpolantFactoryMethodLinear = void 0;
ns.prototype.InterpolantFactoryMethodSmooth = void 0;
-class Qr extends _i {
+class es extends _i {
/**
* Constructs a new vector keyframe track.
*
@@ -12433,7 +12451,7 @@ class Qr extends _i {
super(e, t, i, r);
}
}
-Qr.prototype.ValueTypeName = "vector";
+es.prototype.ValueTypeName = "vector";
class Wd {
/**
* Constructs a new animation clip.
@@ -12511,7 +12529,7 @@ class Wd {
), c.push(0, 1, 0);
const h = kd(l);
l = Kl(l, 1, h), c = Kl(c, 1, h), !r && l[0] === 0 && (l.push(n), c.push(c[0])), a.push(
- new $r(
+ new Jr(
".morphTargetInfluences[" + t[o].name + "]",
l,
c
@@ -12579,7 +12597,7 @@ class Wd {
* @return {?AnimationClip} The new animation clip.
*/
static parseAnimation(e, t) {
- if (be("AnimationClip: parseAnimation() is deprecated and will be removed with r185"), !e)
+ if (Me("AnimationClip: parseAnimation() is deprecated and will be removed with r185"), !e)
return He("AnimationClip: No animation in JSONLoader data."), null;
const i = function(h, u, d, f, g) {
if (d.length !== 0) {
@@ -12605,25 +12623,25 @@ class Wd {
const y = u[f];
v.push(y.time), m.push(y.morphTarget === g ? 1 : 0);
}
- r.push(new $r(".morphTargetInfluence[" + g + "]", v, m));
+ r.push(new Jr(".morphTargetInfluence[" + g + "]", v, m));
}
l = d.length * a;
} else {
const d = ".bones[" + t[h].name + "]";
i(
- Qr,
+ es,
d + ".position",
u,
"pos",
r
), i(
- Jr,
+ Qr,
d + ".quaternion",
u,
"rot",
r
), i(
- Qr,
+ es,
d + ".scale",
u,
"scl",
@@ -12708,16 +12726,16 @@ function jd(s) {
case "float":
case "number":
case "integer":
- return $r;
+ return Jr;
case "vector":
case "vector2":
case "vector3":
case "vector4":
- return Qr;
+ return es;
case "color":
return xh;
case "quaternion":
- return Jr;
+ return Qr;
case "bool":
case "boolean":
return ss;
@@ -12736,7 +12754,7 @@ function Xd(s) {
}
return e.parse !== void 0 ? e.parse(s) : new e(s.name, s.times, s.values, s.interpolation);
}
-const Hi = {
+const Gi = {
/**
* Whether caching is enabled or not.
*
@@ -12946,7 +12964,7 @@ class rr {
}
}
rr.DEFAULT_MATERIAL_NAME = "__DEFAULT";
-const Oi = {};
+const Fi = {};
class Kd extends Error {
constructor(e, t) {
super(e), this.response = t;
@@ -12972,20 +12990,20 @@ class Ko extends rr {
*/
load(e, t, i, r) {
e === void 0 && (e = ""), this.path !== void 0 && (e = this.path + e), e = this.manager.resolveURL(e);
- const n = Hi.get(`file:${e}`);
+ const n = Gi.get(`file:${e}`);
if (n !== void 0)
return this.manager.itemStart(e), setTimeout(() => {
t && t(n), this.manager.itemEnd(e);
}, 0), n;
- if (Oi[e] !== void 0) {
- Oi[e].push({
+ if (Fi[e] !== void 0) {
+ Fi[e].push({
onLoad: t,
onProgress: i,
onError: r
});
return;
}
- Oi[e] = [], Oi[e].push({
+ Fi[e] = [], Fi[e].push({
onLoad: t,
onProgress: i,
onError: r
@@ -12997,9 +13015,9 @@ class Ko extends rr {
}), o = this.mimeType, l = this.responseType;
fetch(a).then((c) => {
if (c.status === 200 || c.status === 0) {
- if (c.status === 0 && be("FileLoader: HTTP Status 0 received."), typeof ReadableStream > "u" || c.body === void 0 || c.body.getReader === void 0)
+ if (c.status === 0 && Me("FileLoader: HTTP Status 0 received."), typeof ReadableStream > "u" || c.body === void 0 || c.body.getReader === void 0)
return c;
- const h = Oi[e], u = c.body.getReader(), d = c.headers.get("X-File-Size") || c.headers.get("Content-Length"), f = d ? parseInt(d) : 0, g = f !== 0;
+ const h = Fi[e], u = c.body.getReader(), d = c.headers.get("X-File-Size") || c.headers.get("Content-Length"), f = d ? parseInt(d) : 0, g = f !== 0;
let v = 0;
const m = new ReadableStream({
start(p) {
@@ -13045,18 +13063,18 @@ class Ko extends rr {
}
}
}).then((c) => {
- Hi.add(`file:${e}`, c);
- const h = Oi[e];
- delete Oi[e];
+ Gi.add(`file:${e}`, c);
+ const h = Fi[e];
+ delete Fi[e];
for (let u = 0, d = h.length; u < d; u++) {
const f = h[u];
f.onLoad && f.onLoad(c);
}
}).catch((c) => {
- const h = Oi[e];
+ const h = Fi[e];
if (h === void 0)
throw this.manager.itemError(e), c;
- delete Oi[e];
+ delete Fi[e];
for (let u = 0, d = h.length; u < d; u++) {
const f = h[u];
f.onError && f.onError(c);
@@ -13093,7 +13111,7 @@ class Ko extends rr {
return this._abortController.abort(), this._abortController = new AbortController(), this;
}
}
-const Ur = /* @__PURE__ */ new WeakMap();
+const Nr = /* @__PURE__ */ new WeakMap();
class yh extends rr {
/**
* Constructs a new image loader.
@@ -13117,44 +13135,44 @@ class yh extends rr {
*/
load(e, t, i, r) {
this.path !== void 0 && (e = this.path + e), e = this.manager.resolveURL(e);
- const n = this, a = Hi.get(`image:${e}`);
+ const n = this, a = Gi.get(`image:${e}`);
if (a !== void 0) {
if (a.complete === !0)
n.manager.itemStart(e), setTimeout(function() {
t && t(a), n.manager.itemEnd(e);
}, 0);
else {
- let u = Ur.get(a);
- u === void 0 && (u = [], Ur.set(a, u)), u.push({ onLoad: t, onError: r });
+ let u = Nr.get(a);
+ u === void 0 && (u = [], Nr.set(a, u)), u.push({ onLoad: t, onError: r });
}
return a;
}
const o = As("img");
function l() {
h(), t && t(this);
- const u = Ur.get(this) || [];
+ const u = Nr.get(this) || [];
for (let d = 0; d < u.length; d++) {
const f = u[d];
f.onLoad && f.onLoad(this);
}
- Ur.delete(this), n.manager.itemEnd(e);
+ Nr.delete(this), n.manager.itemEnd(e);
}
function c(u) {
- h(), r && r(u), Hi.remove(`image:${e}`);
- const d = Ur.get(this) || [];
+ h(), r && r(u), Gi.remove(`image:${e}`);
+ const d = Nr.get(this) || [];
for (let f = 0; f < d.length; f++) {
const g = d[f];
g.onError && g.onError(u);
}
- Ur.delete(this), n.manager.itemError(e), n.manager.itemEnd(e);
+ Nr.delete(this), n.manager.itemError(e), n.manager.itemEnd(e);
}
function h() {
o.removeEventListener("load", l, !1), o.removeEventListener("error", c, !1);
}
- return o.addEventListener("load", l, !1), o.addEventListener("error", c, !1), e.slice(0, 5) !== "data:" && this.crossOrigin !== void 0 && (o.crossOrigin = this.crossOrigin), Hi.add(`image:${e}`, o), n.manager.itemStart(e), o.src = e, o;
+ return o.addEventListener("load", l, !1), o.addEventListener("error", c, !1), e.slice(0, 5) !== "data:" && this.crossOrigin !== void 0 && (o.crossOrigin = this.crossOrigin), Gi.add(`image:${e}`, o), n.manager.itemStart(e), o.src = e, o;
}
}
-class Mh extends rr {
+class bh extends rr {
/**
* Constructs a new cube texture loader.
*
@@ -13232,7 +13250,7 @@ class Zd extends rr {
}, i, r), a;
}
}
-class bh extends rr {
+class Mh extends rr {
/**
* Constructs a new texture loader.
*
@@ -13413,10 +13431,10 @@ class $d extends Zo {
* Constructs a new spot light shadow.
*/
constructor() {
- super(new bt(50, 1, 0.5, 500)), this.isSpotLightShadow = !0, this.focus = 1, this.aspect = 1;
+ super(new Mt(50, 1, 0.5, 500)), this.isSpotLightShadow = !0, this.focus = 1, this.aspect = 1;
}
updateMatrices(e) {
- const t = this.camera, i = Kr * 2 * e.angle * this.focus, r = this.mapSize.width / this.mapSize.height * this.aspect, n = e.distance || t.far;
+ const t = this.camera, i = Zr * 2 * e.angle * this.focus, r = this.mapSize.width / this.mapSize.height * this.aspect, n = e.distance || t.far;
(i !== t.fov || r !== t.aspect || n !== t.far) && (t.fov = i, t.aspect = r, t.far = n, t.updateProjectionMatrix()), super.updateMatrices(e);
}
copy(e) {
@@ -13462,7 +13480,7 @@ class Qd extends Zo {
* Constructs a new point light shadow.
*/
constructor() {
- super(new bt(90, 1, 0.5, 500)), this.isPointLightShadow = !0, this._frameExtents = new oe(4, 2), this._viewportCount = 6, this._viewports = [
+ super(new Mt(90, 1, 0.5, 500)), this.isPointLightShadow = !0, this._frameExtents = new oe(4, 2), this._viewportCount = 6, this._viewports = [
// These viewports map a cube-map onto a 2D texture with the
// following orientation:
//
@@ -13677,7 +13695,7 @@ class ip extends rr {
* @param {LoadingManager} [manager] - The loading manager.
*/
constructor(e) {
- super(e), this.isImageBitmapLoader = !0, typeof createImageBitmap > "u" && be("ImageBitmapLoader: createImageBitmap() not supported."), typeof fetch > "u" && be("ImageBitmapLoader: fetch() not supported."), this.options = { premultiplyAlpha: "none" }, this._abortController = new AbortController();
+ super(e), this.isImageBitmapLoader = !0, typeof createImageBitmap > "u" && Me("ImageBitmapLoader: createImageBitmap() not supported."), typeof fetch > "u" && Me("ImageBitmapLoader: fetch() not supported."), this.options = { premultiplyAlpha: "none" }, this._abortController = new AbortController();
}
/**
* Sets the given loader options. The structure of the object must match the `options` parameter of
@@ -13700,7 +13718,7 @@ class ip extends rr {
*/
load(e, t, i, r) {
e === void 0 && (e = ""), this.path !== void 0 && (e = this.path + e), e = this.manager.resolveURL(e);
- const n = this, a = Hi.get(`image-bitmap:${e}`);
+ const n = this, a = Gi.get(`image-bitmap:${e}`);
if (a !== void 0) {
if (n.manager.itemStart(e), a.then) {
a.then((c) => {
@@ -13722,11 +13740,11 @@ class ip extends rr {
}).then(function(c) {
return createImageBitmap(c, Object.assign(n.options, { colorSpaceConversion: "none" }));
}).then(function(c) {
- return Hi.add(`image-bitmap:${e}`, c), t && t(c), n.manager.itemEnd(e), c;
+ return Gi.add(`image-bitmap:${e}`, c), t && t(c), n.manager.itemEnd(e), c;
}).catch(function(c) {
- r && r(c), fa.set(l, c), Hi.remove(`image-bitmap:${e}`), n.manager.itemError(e), n.manager.itemEnd(e);
+ r && r(c), fa.set(l, c), Gi.remove(`image-bitmap:${e}`), n.manager.itemError(e), n.manager.itemEnd(e);
});
- Hi.add(`image-bitmap:${e}`, l), n.manager.itemStart(e);
+ Gi.add(`image-bitmap:${e}`, l), n.manager.itemStart(e);
}
/**
* Aborts ongoing fetch requests.
@@ -13737,7 +13755,7 @@ class ip extends rr {
return this._abortController.abort(), this._abortController = new AbortController(), this;
}
}
-class rp extends bt {
+class rp extends Mt {
/**
* Constructs a new array camera.
*
@@ -14010,7 +14028,7 @@ class it {
const t = this.parsedPath, i = t.objectName, r = t.propertyName;
let n = t.propertyIndex;
if (e || (e = it.findNode(this.rootNode, t.nodeName), this.node = e), this.getValue = this._getValue_unavailable, this.setValue = this._setValue_unavailable, !e) {
- be("PropertyBinding: No target node found for track: " + this.path + ".");
+ Me("PropertyBinding: No target node found for track: " + this.path + ".");
return;
}
if (i) {
@@ -14327,7 +14345,7 @@ class ic {
return new this.constructor().copy(this);
}
}
-class fp extends _r {
+class fp extends xr {
/**
* Constructs a new controls instance.
*
@@ -14345,7 +14363,7 @@ class fp extends _r {
*/
connect(e) {
if (e === void 0) {
- be("Controls: connect() now requires an element.");
+ Me("Controls: connect() now requires an element.");
return;
}
this.domElement !== null && this.disconnect(), this.domElement = e;
@@ -14481,7 +14499,7 @@ function mp(s) {
typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register", { detail: {
revision: "181"
} }));
-typeof window < "u" && (window.__THREE__ ? be("WARNING: Multiple instances of Three.js being imported.") : window.__THREE__ = "181");
+typeof window < "u" && (window.__THREE__ ? Me("WARNING: Multiple instances of Three.js being imported.") : window.__THREE__ = "181");
function Eh() {
let s = null, e = !1, t = null, i = null;
function r(n, a) {
@@ -14640,14 +14658,14 @@ var vp = `#ifdef USE_ALPHAHASH
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`, yp = `#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
-#endif`, Mp = `#ifdef USE_ALPHATEST
+#endif`, bp = `#ifdef USE_ALPHATEST
#ifdef ALPHA_TO_COVERAGE
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
if ( diffuseColor.a == 0.0 ) discard;
#else
if ( diffuseColor.a < alphaTest ) discard;
#endif
-#endif`, bp = `#ifdef USE_ALPHATEST
+#endif`, Mp = `#ifdef USE_ALPHATEST
uniform float alphaTest;
#endif`, Tp = `#ifdef USE_AOMAP
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
@@ -15949,11 +15967,11 @@ IncidentLight directLight;
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif`, yf = `#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
-#endif`, Mf = `#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
+#endif`, bf = `#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
uniform float logDepthBufFC;
varying float vFragDepth;
varying float vIsPerspective;
-#endif`, bf = `#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
+#endif`, Mf = `#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
varying float vFragDepth;
varying float vIsPerspective;
#endif`, Tf = `#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
@@ -17137,14 +17155,14 @@ void main() {
gl_FragColor = texColor;
#include
#include
-}`, Mm = `varying vec3 vWorldDirection;
+}`, bm = `varying vec3 vWorldDirection;
#include
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include
#include
gl_Position.z = gl_Position.w;
-}`, bm = `uniform samplerCube tCube;
+}`, Mm = `uniform samplerCube tCube;
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
@@ -18151,8 +18169,8 @@ void main() {
alphahash_pars_fragment: _p,
alphamap_fragment: xp,
alphamap_pars_fragment: yp,
- alphatest_fragment: Mp,
- alphatest_pars_fragment: bp,
+ alphatest_fragment: bp,
+ alphatest_pars_fragment: Mp,
aomap_fragment: Tp,
aomap_pars_fragment: Sp,
batching_pars_vertex: Ep,
@@ -18204,8 +18222,8 @@ void main() {
lights_fragment_maps: _f,
lights_fragment_end: xf,
logdepthbuf_fragment: yf,
- logdepthbuf_pars_fragment: Mf,
- logdepthbuf_pars_vertex: bf,
+ logdepthbuf_pars_fragment: bf,
+ logdepthbuf_pars_vertex: Mf,
logdepthbuf_vertex: Tf,
map_fragment: Sf,
map_pars_fragment: Ef,
@@ -18258,8 +18276,8 @@ void main() {
background_frag: _m,
backgroundCube_vert: xm,
backgroundCube_frag: ym,
- cube_vert: Mm,
- cube_frag: bm,
+ cube_vert: bm,
+ cube_frag: Mm,
depth_vert: Tm,
depth_frag: Sm,
distanceRGBA_vert: Em,
@@ -18451,9 +18469,9 @@ void main() {
alphaMapTransform: { value: /* @__PURE__ */ new Be() },
alphaTest: { value: 0 }
}
-}, bi = {
+}, Mi = {
basic: {
- uniforms: /* @__PURE__ */ Bt([
+ uniforms: /* @__PURE__ */ Ft([
ce.common,
ce.specularmap,
ce.envmap,
@@ -18465,7 +18483,7 @@ void main() {
fragmentShader: Fe.meshbasic_frag
},
lambert: {
- uniforms: /* @__PURE__ */ Bt([
+ uniforms: /* @__PURE__ */ Ft([
ce.common,
ce.specularmap,
ce.envmap,
@@ -18485,7 +18503,7 @@ void main() {
fragmentShader: Fe.meshlambert_frag
},
phong: {
- uniforms: /* @__PURE__ */ Bt([
+ uniforms: /* @__PURE__ */ Ft([
ce.common,
ce.specularmap,
ce.envmap,
@@ -18507,7 +18525,7 @@ void main() {
fragmentShader: Fe.meshphong_frag
},
standard: {
- uniforms: /* @__PURE__ */ Bt([
+ uniforms: /* @__PURE__ */ Ft([
ce.common,
ce.envmap,
ce.aomap,
@@ -18531,7 +18549,7 @@ void main() {
fragmentShader: Fe.meshphysical_frag
},
toon: {
- uniforms: /* @__PURE__ */ Bt([
+ uniforms: /* @__PURE__ */ Ft([
ce.common,
ce.aomap,
ce.lightmap,
@@ -18550,7 +18568,7 @@ void main() {
fragmentShader: Fe.meshtoon_frag
},
matcap: {
- uniforms: /* @__PURE__ */ Bt([
+ uniforms: /* @__PURE__ */ Ft([
ce.common,
ce.bumpmap,
ce.normalmap,
@@ -18564,7 +18582,7 @@ void main() {
fragmentShader: Fe.meshmatcap_frag
},
points: {
- uniforms: /* @__PURE__ */ Bt([
+ uniforms: /* @__PURE__ */ Ft([
ce.points,
ce.fog
]),
@@ -18572,7 +18590,7 @@ void main() {
fragmentShader: Fe.points_frag
},
dashed: {
- uniforms: /* @__PURE__ */ Bt([
+ uniforms: /* @__PURE__ */ Ft([
ce.common,
ce.fog,
{
@@ -18585,7 +18603,7 @@ void main() {
fragmentShader: Fe.linedashed_frag
},
depth: {
- uniforms: /* @__PURE__ */ Bt([
+ uniforms: /* @__PURE__ */ Ft([
ce.common,
ce.displacementmap
]),
@@ -18593,7 +18611,7 @@ void main() {
fragmentShader: Fe.depth_frag
},
normal: {
- uniforms: /* @__PURE__ */ Bt([
+ uniforms: /* @__PURE__ */ Ft([
ce.common,
ce.bumpmap,
ce.normalmap,
@@ -18606,7 +18624,7 @@ void main() {
fragmentShader: Fe.meshnormal_frag
},
sprite: {
- uniforms: /* @__PURE__ */ Bt([
+ uniforms: /* @__PURE__ */ Ft([
ce.sprite,
ce.fog
]),
@@ -18650,7 +18668,7 @@ void main() {
fragmentShader: Fe.equirect_frag
},
distanceRGBA: {
- uniforms: /* @__PURE__ */ Bt([
+ uniforms: /* @__PURE__ */ Ft([
ce.common,
ce.displacementmap,
{
@@ -18663,7 +18681,7 @@ void main() {
fragmentShader: Fe.distanceRGBA_frag
},
shadow: {
- uniforms: /* @__PURE__ */ Bt([
+ uniforms: /* @__PURE__ */ Ft([
ce.lights,
ce.fog,
{
@@ -18675,9 +18693,9 @@ void main() {
fragmentShader: Fe.shadow_frag
}
};
-bi.physical = {
- uniforms: /* @__PURE__ */ Bt([
- bi.standard.uniforms,
+Mi.physical = {
+ uniforms: /* @__PURE__ */ Ft([
+ Mi.standard.uniforms,
{
clearcoat: { value: 0 },
clearcoatMap: { value: null },
@@ -18749,9 +18767,9 @@ function Jm(s, e, t, i, r, n, a) {
new gr(1, 1, 1),
new ct({
name: "BackgroundCubeMaterial",
- uniforms: Zr(bi.backgroundCube.uniforms),
- vertexShader: bi.backgroundCube.vertexShader,
- fragmentShader: bi.backgroundCube.fragmentShader,
+ uniforms: $r(Mi.backgroundCube.uniforms),
+ vertexShader: Mi.backgroundCube.vertexShader,
+ fragmentShader: Mi.backgroundCube.fragmentShader,
side: zt,
depthTest: !1,
depthWrite: !1,
@@ -18768,10 +18786,10 @@ function Jm(s, e, t, i, r, n, a) {
new Ds(2, 2),
new ct({
name: "BackgroundMaterial",
- uniforms: Zr(bi.background.uniforms),
- vertexShader: bi.background.vertexShader,
- fragmentShader: bi.background.fragmentShader,
- side: Ei,
+ uniforms: $r(Mi.background.uniforms),
+ vertexShader: Mi.background.vertexShader,
+ fragmentShader: Mi.background.fragmentShader,
+ side: Ci,
depthTest: !1,
depthWrite: !1,
fog: !1,
@@ -18810,30 +18828,30 @@ function Jm(s, e, t, i, r, n, a) {
function Qm(s, e) {
const t = s.getParameter(s.MAX_VERTEX_ATTRIBS), i = {}, r = d(null);
let n = r, a = !1;
- function o(b, D, N, z, H) {
+ function o(M, D, N, z, H) {
let j = !1;
const q = u(z, N, D);
- n !== q && (n = q, c(n.object)), j = f(b, z, N, H), j && g(b, z, N, H), H !== null && e.update(H, s.ELEMENT_ARRAY_BUFFER), (j || a) && (a = !1, E(b, D, N, z), H !== null && s.bindBuffer(s.ELEMENT_ARRAY_BUFFER, e.get(H).buffer));
+ n !== q && (n = q, c(n.object)), j = f(M, z, N, H), j && g(M, z, N, H), H !== null && e.update(H, s.ELEMENT_ARRAY_BUFFER), (j || a) && (a = !1, E(M, D, N, z), H !== null && s.bindBuffer(s.ELEMENT_ARRAY_BUFFER, e.get(H).buffer));
}
function l() {
return s.createVertexArray();
}
- function c(b) {
- return s.bindVertexArray(b);
+ function c(M) {
+ return s.bindVertexArray(M);
}
- function h(b) {
- return s.deleteVertexArray(b);
+ function h(M) {
+ return s.deleteVertexArray(M);
}
- function u(b, D, N) {
+ function u(M, D, N) {
const z = N.wireframe === !0;
- let H = i[b.id];
- H === void 0 && (H = {}, i[b.id] = H);
+ let H = i[M.id];
+ H === void 0 && (H = {}, i[M.id] = H);
let j = H[D.id];
j === void 0 && (j = {}, H[D.id] = j);
let q = j[z];
return q === void 0 && (q = d(l()), j[z] = q), q;
}
- function d(b) {
+ function d(M) {
const D = [], N = [], z = [];
for (let H = 0; H < t; H++)
D[H] = 0, N[H] = 0, z[H] = 0;
@@ -18845,12 +18863,12 @@ function Qm(s, e) {
newAttributes: D,
enabledAttributes: N,
attributeDivisors: z,
- object: b,
+ object: M,
attributes: {},
index: null
};
}
- function f(b, D, N, z) {
+ function f(M, D, N, z) {
const H = n.attributes, j = D.attributes;
let q = 0;
const te = N.getAttributes();
@@ -18858,52 +18876,52 @@ function Qm(s, e) {
if (te[G].location >= 0) {
const Z = H[G];
let se = j[G];
- if (se === void 0 && (G === "instanceMatrix" && b.instanceMatrix && (se = b.instanceMatrix), G === "instanceColor" && b.instanceColor && (se = b.instanceColor)), Z === void 0 || Z.attribute !== se || se && Z.data !== se.data) return !0;
+ if (se === void 0 && (G === "instanceMatrix" && M.instanceMatrix && (se = M.instanceMatrix), G === "instanceColor" && M.instanceColor && (se = M.instanceColor)), Z === void 0 || Z.attribute !== se || se && Z.data !== se.data) return !0;
q++;
}
return n.attributesNum !== q || n.index !== z;
}
- function g(b, D, N, z) {
+ function g(M, D, N, z) {
const H = {}, j = D.attributes;
let q = 0;
const te = N.getAttributes();
for (const G in te)
if (te[G].location >= 0) {
let Z = j[G];
- Z === void 0 && (G === "instanceMatrix" && b.instanceMatrix && (Z = b.instanceMatrix), G === "instanceColor" && b.instanceColor && (Z = b.instanceColor));
+ Z === void 0 && (G === "instanceMatrix" && M.instanceMatrix && (Z = M.instanceMatrix), G === "instanceColor" && M.instanceColor && (Z = M.instanceColor));
const se = {};
se.attribute = Z, Z && Z.data && (se.data = Z.data), H[G] = se, q++;
}
n.attributes = H, n.attributesNum = q, n.index = z;
}
function v() {
- const b = n.newAttributes;
- for (let D = 0, N = b.length; D < N; D++)
- b[D] = 0;
+ const M = n.newAttributes;
+ for (let D = 0, N = M.length; D < N; D++)
+ M[D] = 0;
}
- function m(b) {
- p(b, 0);
+ function m(M) {
+ p(M, 0);
}
- function p(b, D) {
+ function p(M, D) {
const N = n.newAttributes, z = n.enabledAttributes, H = n.attributeDivisors;
- N[b] = 1, z[b] === 0 && (s.enableVertexAttribArray(b), z[b] = 1), H[b] !== D && (s.vertexAttribDivisor(b, D), H[b] = D);
+ N[M] = 1, z[M] === 0 && (s.enableVertexAttribArray(M), z[M] = 1), H[M] !== D && (s.vertexAttribDivisor(M, D), H[M] = D);
}
function y() {
- const b = n.newAttributes, D = n.enabledAttributes;
+ const M = n.newAttributes, D = n.enabledAttributes;
for (let N = 0, z = D.length; N < z; N++)
- D[N] !== b[N] && (s.disableVertexAttribArray(N), D[N] = 0);
+ D[N] !== M[N] && (s.disableVertexAttribArray(N), D[N] = 0);
}
- function _(b, D, N, z, H, j, q) {
- q === !0 ? s.vertexAttribIPointer(b, D, N, H, j) : s.vertexAttribPointer(b, D, N, z, H, j);
+ function _(M, D, N, z, H, j, q) {
+ q === !0 ? s.vertexAttribIPointer(M, D, N, H, j) : s.vertexAttribPointer(M, D, N, z, H, j);
}
- function E(b, D, N, z) {
+ function E(M, D, N, z) {
v();
const H = z.attributes, j = N.getAttributes(), q = D.defaultAttributeValues;
for (const te in j) {
const G = j[te];
if (G.location >= 0) {
let Z = H[te];
- if (Z === void 0 && (te === "instanceMatrix" && b.instanceMatrix && (Z = b.instanceMatrix), te === "instanceColor" && b.instanceColor && (Z = b.instanceColor)), Z !== void 0) {
+ if (Z === void 0 && (te === "instanceMatrix" && M.instanceMatrix && (Z = M.instanceMatrix), te === "instanceColor" && M.instanceColor && (Z = M.instanceColor)), Z !== void 0) {
const se = Z.normalized, Pe = Z.itemSize, ze = e.get(Z);
if (ze === void 0) continue;
const qe = ze.buffer, Ke = ze.type, Ze = ze.bytesPerElement, W = Ke === s.INT || Ke === s.UNSIGNED_INT || Z.gpuType === Ao;
@@ -18912,7 +18930,7 @@ function Qm(s, e) {
if (Y.isInstancedInterleavedBuffer) {
for (let Te = 0; Te < G.locationSize; Te++)
p(G.location + Te, Y.meshPerAttribute);
- b.isInstancedMesh !== !0 && z._maxInstanceCount === void 0 && (z._maxInstanceCount = Y.meshPerAttribute * Y.count);
+ M.isInstancedMesh !== !0 && z._maxInstanceCount === void 0 && (z._maxInstanceCount = Y.meshPerAttribute * Y.count);
} else
for (let Te = 0; Te < G.locationSize; Te++)
m(G.location + Te);
@@ -18931,7 +18949,7 @@ function Qm(s, e) {
if (Z.isInstancedBufferAttribute) {
for (let Y = 0; Y < G.locationSize; Y++)
p(G.location + Y, Z.meshPerAttribute);
- b.isInstancedMesh !== !0 && z._maxInstanceCount === void 0 && (z._maxInstanceCount = Z.meshPerAttribute * Z.count);
+ M.isInstancedMesh !== !0 && z._maxInstanceCount === void 0 && (z._maxInstanceCount = Z.meshPerAttribute * Z.count);
} else
for (let Y = 0; Y < G.locationSize; Y++)
m(G.location + Y);
@@ -18970,36 +18988,36 @@ function Qm(s, e) {
}
function A() {
I();
- for (const b in i) {
- const D = i[b];
+ for (const M in i) {
+ const D = i[M];
for (const N in D) {
const z = D[N];
for (const H in z)
h(z[H].object), delete z[H];
delete D[N];
}
- delete i[b];
+ delete i[M];
}
}
- function S(b) {
- if (i[b.id] === void 0) return;
- const D = i[b.id];
+ function S(M) {
+ if (i[M.id] === void 0) return;
+ const D = i[M.id];
for (const N in D) {
const z = D[N];
for (const H in z)
h(z[H].object), delete z[H];
delete D[N];
}
- delete i[b.id];
+ delete i[M.id];
}
- function R(b) {
+ function R(M) {
for (const D in i) {
const N = i[D];
- if (N[b.id] === void 0) continue;
- const z = N[b.id];
+ if (N[M.id] === void 0) continue;
+ const z = N[M.id];
for (const H in z)
h(z[H].object), delete z[H];
- delete N[b.id];
+ delete N[M.id];
}
}
function I() {
@@ -19084,7 +19102,7 @@ function tg(s, e, t, i) {
}
let c = t.precision !== void 0 ? t.precision : "highp";
const h = l(c);
- h !== c && (be("WebGLRenderer:", c, "not supported, using", h, "instead."), c = h);
+ h !== c && (Me("WebGLRenderer:", c, "not supported, using", h, "instead."), c = h);
const u = t.logarithmicDepthBuffer === !0, d = t.reversedDepthBuffer === !0 && e.has("EXT_clip_control"), f = s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS), g = s.getParameter(s.MAX_VERTEX_TEXTURE_IMAGE_UNITS), v = s.getParameter(s.MAX_TEXTURE_SIZE), m = s.getParameter(s.MAX_CUBE_MAP_TEXTURE_SIZE), p = s.getParameter(s.MAX_VERTEX_ATTRIBS), y = s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS), _ = s.getParameter(s.MAX_VARYING_VECTORS), E = s.getParameter(s.MAX_FRAGMENT_UNIFORM_VECTORS), A = g > 0, S = s.getParameter(s.MAX_SAMPLES);
return {
isWebGL2: !0,
@@ -19111,7 +19129,7 @@ function tg(s, e, t, i) {
function ig(s) {
const e = this;
let t = null, i = 0, r = !1, n = !1;
- const a = new Mi(), o = new Be(), l = { value: null, needsUpdate: !1 };
+ const a = new bi(), o = new Be(), l = { value: null, needsUpdate: !1 };
this.uniform = l, this.numPlanes = 0, this.numIntersection = 0, this.init = function(u, d) {
const f = u.length !== 0 || d || // enable state of previous frame - the clipping code has to
// run another frame in order to reset the state:
@@ -19157,7 +19175,7 @@ function ig(s) {
function rg(s) {
let e = /* @__PURE__ */ new WeakMap();
function t(a, o) {
- return o === Tn ? a.mapping = jr : o === Ba && (a.mapping = Xr), a;
+ return o === Tn ? a.mapping = Xr : o === Ba && (a.mapping = qr), a;
}
function i(a) {
if (a && a.isTexture) {
@@ -19191,7 +19209,7 @@ function rg(s) {
dispose: n
};
}
-const Ji = 4, sc = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582], fr = 20, sg = 256, gs = /* @__PURE__ */ new vr(), nc = /* @__PURE__ */ new _e();
+const Qi = 4, sc = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582], fr = 20, sg = 256, gs = /* @__PURE__ */ new vr(), nc = /* @__PURE__ */ new _e();
let ma = null, ga = 0, va = 0, _a = !1;
const ng = /* @__PURE__ */ new w();
class ac {
@@ -19283,10 +19301,10 @@ class ac {
this._lodMeshes[e].geometry.dispose();
}
_cleanup(e) {
- this._renderer.setRenderTarget(ma, ga, va), this._renderer.xr.enabled = _a, e.scissorTest = !1, Nr(e, 0, 0, e.width, e.height);
+ this._renderer.setRenderTarget(ma, ga, va), this._renderer.xr.enabled = _a, e.scissorTest = !1, Or(e, 0, 0, e.width, e.height);
}
_fromTexture(e, t) {
- e.mapping === jr || e.mapping === Xr ? this._setSize(e.image.length === 0 ? 16 : e.image[0].width || e.image[0].image.width) : this._setSize(e.image.width / 4), ma = this._renderer.getRenderTarget(), ga = this._renderer.getActiveCubeFace(), va = this._renderer.getActiveMipmapLevel(), _a = this._renderer.xr.enabled, this._renderer.xr.enabled = !1;
+ e.mapping === Xr || e.mapping === qr ? this._setSize(e.image.length === 0 ? 16 : e.image[0].width || e.image[0].image.width) : this._setSize(e.image.width / 4), ma = this._renderer.getRenderTarget(), ga = this._renderer.getActiveCubeFace(), va = this._renderer.getActiveMipmapLevel(), _a = this._renderer.xr.enabled, this._renderer.xr.enabled = !1;
const i = t || this._allocateTargets();
return this._textureToCubeUV(e, i), this._applyPMREM(i), this._cleanup(i), i;
}
@@ -19297,7 +19315,7 @@ class ac {
generateMipmaps: !1,
type: mt,
format: Kt,
- colorSpace: Nt,
+ colorSpace: Ot,
depthBuffer: !1
}, r = oc(e, t, i);
if (this._pingPongRenderTarget === null || this._pingPongRenderTarget.width !== e || this._pingPongRenderTarget.height !== t) {
@@ -19312,8 +19330,8 @@ class ac {
this._renderer.compile(t, gs);
}
_sceneToCubeUV(e, t, i, r, n) {
- const a = new bt(90, 1, t, i), o = [1, -1, 1, 1, 1, 1], l = [1, 1, 1, -1, -1, -1], c = this._renderer, h = c.autoClear, u = c.toneMapping;
- c.getClearColor(nc), c.toneMapping = er, c.autoClear = !1, c.state.buffers.depth.getReversed() && (c.setRenderTarget(r), c.clearDepth(), c.setRenderTarget(null)), this._backgroundBox === null && (this._backgroundBox = new nt(
+ const a = new Mt(90, 1, t, i), o = [1, -1, 1, 1, 1, 1], l = [1, 1, 1, -1, -1, -1], c = this._renderer, h = c.autoClear, u = c.toneMapping;
+ c.getClearColor(nc), c.toneMapping = tr, c.autoClear = !1, c.state.buffers.depth.getReversed() && (c.setRenderTarget(r), c.clearDepth(), c.setRenderTarget(null)), this._backgroundBox === null && (this._backgroundBox = new nt(
new gr(),
new kt({
name: "PMREM.Background",
@@ -19330,19 +19348,19 @@ class ac {
const p = m % 3;
p === 0 ? (a.up.set(0, o[m], 0), a.position.set(n.x, n.y, n.z), a.lookAt(n.x + l[m], n.y, n.z)) : p === 1 ? (a.up.set(0, 0, o[m]), a.position.set(n.x, n.y, n.z), a.lookAt(n.x, n.y + l[m], n.z)) : (a.up.set(0, o[m], 0), a.position.set(n.x, n.y, n.z), a.lookAt(n.x, n.y, n.z + l[m]));
const y = this._cubeSize;
- Nr(r, p * y, m > 2 ? y : 0, y, y), c.setRenderTarget(r), g && c.render(d, a), c.render(e, a);
+ Or(r, p * y, m > 2 ? y : 0, y, y), c.setRenderTarget(r), g && c.render(d, a), c.render(e, a);
}
c.toneMapping = u, c.autoClear = h, e.background = v;
}
_textureToCubeUV(e, t) {
- const i = this._renderer, r = e.mapping === jr || e.mapping === Xr;
+ const i = this._renderer, r = e.mapping === Xr || e.mapping === qr;
r ? (this._cubemapMaterial === null && (this._cubemapMaterial = cc()), this._cubemapMaterial.uniforms.flipEnvMap.value = e.isRenderTargetTexture === !1 ? -1 : 1) : this._equirectMaterial === null && (this._equirectMaterial = lc());
const n = r ? this._cubemapMaterial : this._equirectMaterial, a = this._lodMeshes[0];
a.material = n;
const o = n.uniforms;
o.envMap.value = e;
const l = this._cubeSize;
- Nr(t, 0, 0, 3 * l, 2 * l), i.setRenderTarget(t), i.render(a, gs);
+ Or(t, 0, 0, 3 * l, 2 * l), i.setRenderTarget(t), i.render(a, gs);
}
_applyPMREM(e) {
const t = this._renderer, i = t.autoClear;
@@ -19366,8 +19384,8 @@ class ac {
_applyGGXFilter(e, t, i) {
const r = this._renderer, n = this._pingPongRenderTarget, a = this._ggxMaterial, o = this._lodMeshes[i];
o.material = a;
- const l = a.uniforms, c = i / (this._lodMeshes.length - 1), h = t / (this._lodMeshes.length - 1), u = Math.sqrt(c * c - h * h), d = 0.05 + c * 0.95, f = u * d, { _lodMax: g } = this, v = this._sizeLods[i], m = 3 * v * (i > g - Ji ? i - g + Ji : 0), p = 4 * (this._cubeSize - v);
- l.envMap.value = e.texture, l.roughness.value = f, l.mipInt.value = g - t, Nr(n, m, p, 3 * v, 2 * v), r.setRenderTarget(n), r.render(o, gs), l.envMap.value = n.texture, l.roughness.value = 0, l.mipInt.value = g - i, Nr(e, m, p, 3 * v, 2 * v), r.setRenderTarget(e), r.render(o, gs);
+ const l = a.uniforms, c = i / (this._lodMeshes.length - 1), h = t / (this._lodMeshes.length - 1), u = Math.sqrt(c * c - h * h), d = 0.05 + c * 0.95, f = u * d, { _lodMax: g } = this, v = this._sizeLods[i], m = 3 * v * (i > g - Qi ? i - g + Qi : 0), p = 4 * (this._cubeSize - v);
+ l.envMap.value = e.texture, l.roughness.value = f, l.mipInt.value = g - t, Or(n, m, p, 3 * v, 2 * v), r.setRenderTarget(n), r.render(o, gs), l.envMap.value = n.texture, l.roughness.value = 0, l.mipInt.value = g - i, Or(e, m, p, 3 * v, 2 * v), r.setRenderTarget(e), r.render(o, gs);
}
/**
* This is a two-pass Gaussian blur for a cubemap. Normally this is done
@@ -19413,7 +19431,7 @@ class ac {
const h = 3, u = this._lodMeshes[r];
u.material = c;
const d = c.uniforms, f = this._sizeLods[i] - 1, g = isFinite(n) ? Math.PI / (2 * f) : 2 * Math.PI / (2 * fr - 1), v = n / g, m = isFinite(n) ? 1 + Math.floor(h * v) : fr;
- m > fr && be(`sigmaRadians, ${n}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${fr}`);
+ m > fr && Me(`sigmaRadians, ${n}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${fr}`);
const p = [];
let y = 0;
for (let R = 0; R < fr; ++R) {
@@ -19425,19 +19443,19 @@ class ac {
d.envMap.value = e.texture, d.samples.value = m, d.weights.value = p, d.latitudinal.value = a === "latitudinal", o && (d.poleAxis.value = o);
const { _lodMax: _ } = this;
d.dTheta.value = g, d.mipInt.value = _ - i;
- const E = this._sizeLods[r], A = 3 * E * (r > _ - Ji ? r - _ + Ji : 0), S = 4 * (this._cubeSize - E);
- Nr(t, A, S, 3 * E, 2 * E), l.setRenderTarget(t), l.render(u, gs);
+ const E = this._sizeLods[r], A = 3 * E * (r > _ - Qi ? r - _ + Qi : 0), S = 4 * (this._cubeSize - E);
+ Or(t, A, S, 3 * E, 2 * E), l.setRenderTarget(t), l.render(u, gs);
}
}
function ag(s) {
const e = [], t = [], i = [];
let r = s;
- const n = s - Ji + 1 + sc.length;
+ const n = s - Qi + 1 + sc.length;
for (let a = 0; a < n; a++) {
const o = Math.pow(2, r);
e.push(o);
let l = 1 / o;
- a > s - Ji ? l = sc[a - s + Ji - 1] : a === 0 && (l = 0), t.push(l);
+ a > s - Qi ? l = sc[a - s + Qi - 1] : a === 0 && (l = 0), t.push(l);
const c = 1 / (o - 2), h = -c, u = 1 + c, d = [h, h, u, h, u, u, h, h, u, u, h, u], f = 6, g = 6, v = 3, m = 2, p = 1, y = new Float32Array(v * g * f), _ = new Float32Array(m * g * f), E = new Float32Array(p * g * f);
for (let S = 0; S < f; S++) {
const R = S % 3 * 2 / 3 - 1, I = S > 2 ? 0 : -1, T = [
@@ -19461,11 +19479,11 @@ function ag(s) {
0
];
y.set(T, v * g * S), _.set(d, m * g * S);
- const b = [S, S, S, S, S, S];
- E.set(b, p * g * S);
+ const M = [S, S, S, S, S, S];
+ E.set(M, p * g * S);
}
const A = new ti();
- A.setAttribute("position", new Ht(y, v)), A.setAttribute("uv", new Ht(_, m)), A.setAttribute("faceIndex", new Ht(E, p)), i.push(new nt(A, null)), r > Ji && r--;
+ A.setAttribute("position", new Ht(y, v)), A.setAttribute("uv", new Ht(_, m)), A.setAttribute("faceIndex", new Ht(E, p)), i.push(new nt(A, null)), r > Qi && r--;
}
return { lodMeshes: i, sizeLods: e, sigmas: t };
}
@@ -19473,7 +19491,7 @@ function oc(s, e, t) {
const i = new xt(s, e, t);
return i.texture.mapping = Ln, i.texture.name = "PMREM.cubeUv", i.scissorTest = !0, i;
}
-function Nr(s, e, t, i, r) {
+function Or(s, e, t, i, r) {
s.viewport.set(e, t, i, r), s.scissor.set(e, t, i, r);
}
function og(s, e, t) {
@@ -19830,7 +19848,7 @@ function cg(s) {
let e = /* @__PURE__ */ new WeakMap(), t = null;
function i(o) {
if (o && o.isTexture) {
- const l = o.mapping, c = l === Tn || l === Ba, h = l === jr || l === Xr;
+ const l = o.mapping, c = l === Tn || l === Ba, h = l === Xr || l === qr;
if (c || h) {
let u = e.get(o);
const d = u !== void 0 ? u.texture.pmremVersion : 0;
@@ -20048,8 +20066,8 @@ function fg(s, e, t) {
const R = new Float32Array(A * S * 4 * u), I = new oh(R, A, S, u);
I.type = jt, I.needsUpdate = !0;
const T = E * 4;
- for (let b = 0; b < u; b++) {
- const D = p[b], N = y[b], z = _[b], H = A * S * 4 * b;
+ for (let M = 0; M < u; M++) {
+ const D = p[M], N = y[M], z = _[M], H = A * S * 4 * M;
for (let j = 0; j < D.count; j++) {
const q = j * T;
g === !0 && (r.fromBufferAttribute(D, j), R[H + q + 0] = r.x, R[H + q + 1] = r.y, R[H + q + 2] = r.z, R[H + q + 3] = 0), v === !0 && (r.fromBufferAttribute(N, j), R[H + q + 4] = r.x, R[H + q + 5] = r.y, R[H + q + 6] = r.z, R[H + q + 7] = 0), m === !0 && (r.fromBufferAttribute(z, j), R[H + q + 8] = r.x, R[H + q + 9] = r.y, R[H + q + 10] = r.z, R[H + q + 11] = z.itemSize === 4 ? r.w : 1);
@@ -20171,7 +20189,7 @@ function yg(s, e) {
mc.set(i), s.uniformMatrix2fv(this.addr, !1, mc), St(t, i);
}
}
-function Mg(s, e) {
+function bg(s, e) {
const t = this.cache, i = e.elements;
if (i === void 0) {
if (Tt(t, e)) return;
@@ -20181,7 +20199,7 @@ function Mg(s, e) {
fc.set(i), s.uniformMatrix3fv(this.addr, !1, fc), St(t, i);
}
}
-function bg(s, e) {
+function Mg(s, e) {
const t = this.cache, i = e.elements;
if (i === void 0) {
if (Tt(t, e)) return;
@@ -20289,10 +20307,10 @@ function Ng(s) {
return yg;
// _MAT2
case 35675:
- return Mg;
+ return bg;
// _MAT3
case 35676:
- return bg;
+ return Mg;
// _MAT4
case 5124:
case 35670:
@@ -20557,7 +20575,7 @@ function nv(s, e, t) {
}
}
}
-class Mn {
+class bn {
constructor(e, t) {
this.seq = [], this.map = {};
const i = e.getProgramParameter(t, e.ACTIVE_UNIFORMS);
@@ -20615,7 +20633,7 @@ function cv(s) {
case et:
return [e, "sRGBTransferOETF"];
default:
- return be("WebGLProgram: Unsupported color space: ", s), [e, "LinearTransferOETF"];
+ return Me("WebGLProgram: Unsupported color space: ", s), [e, "LinearTransferOETF"];
}
}
function xc(s, e, t) {
@@ -20666,7 +20684,7 @@ function uv(s, e) {
t = "Custom";
break;
default:
- be("WebGLProgram: Unsupported toneMapping:", e), t = "Linear";
+ Me("WebGLProgram: Unsupported toneMapping:", e), t = "Linear";
}
return "vec3 " + s + "( vec3 color ) { return " + t + "ToneMapping( color ); }";
}
@@ -20718,7 +20736,7 @@ function yc(s, e) {
const t = e.numSpotLightShadows + e.numSpotLightMaps - e.numSpotLightShadowsWithMaps;
return s.replace(/NUM_DIR_LIGHTS/g, e.numDirLights).replace(/NUM_SPOT_LIGHTS/g, e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g, e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g, t).replace(/NUM_RECT_AREA_LIGHTS/g, e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, e.numPointLights).replace(/NUM_HEMI_LIGHTS/g, e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g, e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g, e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g, e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g, e.numPointLightShadows);
}
-function Mc(s, e) {
+function bc(s, e) {
return s.replace(/NUM_CLIPPING_PLANES/g, e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, e.numClippingPlanes - e.numClipIntersection);
}
const gv = /^[ \t]*#include +<([\w\d./]+)>/gm;
@@ -20731,14 +20749,14 @@ function _v(s, e) {
if (t === void 0) {
const i = vv.get(e);
if (i !== void 0)
- t = Fe[i], be('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.', e, i);
+ t = Fe[i], Me('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.', e, i);
else
throw new Error("Can not resolve #include <" + e + ">");
}
return xo(t);
}
const xv = /#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;
-function bc(s) {
+function Mc(s) {
return s.replace(xv, yv);
}
function yv(s, e, t, i) {
@@ -20771,16 +20789,16 @@ function Tc(s) {
#define MEDIUM_PRECISION` : s.precision === "lowp" && (e += `
#define LOW_PRECISION`), e;
}
-function Mv(s) {
- let e = "SHADOWMAP_TYPE_BASIC";
- return s.shadowMapType === zc ? e = "SHADOWMAP_TYPE_PCF" : s.shadowMapType === Hc ? e = "SHADOWMAP_TYPE_PCF_SOFT" : s.shadowMapType === Fi && (e = "SHADOWMAP_TYPE_VSM"), e;
-}
function bv(s) {
+ let e = "SHADOWMAP_TYPE_BASIC";
+ return s.shadowMapType === zc ? e = "SHADOWMAP_TYPE_PCF" : s.shadowMapType === Hc ? e = "SHADOWMAP_TYPE_PCF_SOFT" : s.shadowMapType === zi && (e = "SHADOWMAP_TYPE_VSM"), e;
+}
+function Mv(s) {
let e = "ENVMAP_TYPE_CUBE";
if (s.envMap)
switch (s.envMapMode) {
- case jr:
case Xr:
+ case qr:
e = "ENVMAP_TYPE_CUBE";
break;
case Ln:
@@ -20793,7 +20811,7 @@ function Tv(s) {
let e = "ENVMAP_MODE_REFLECTION";
if (s.envMap)
switch (s.envMapMode) {
- case Xr:
+ case qr:
e = "ENVMAP_MODE_REFRACTION";
break;
}
@@ -20824,7 +20842,7 @@ function Ev(s) {
function wv(s, e, t, i) {
const r = s.getContext(), n = t.defines;
let a = t.vertexShader, o = t.fragmentShader;
- const l = Mv(t), c = bv(t), h = Tv(t), u = Sv(t), d = Ev(t), f = pv(t), g = fv(n), v = r.createProgram();
+ const l = bv(t), c = Mv(t), h = Tv(t), u = Sv(t), d = Ev(t), f = pv(t), g = fv(n), v = r.createProgram();
let m, p, y = t.glslVersion ? "#version " + t.glslVersion + `
` : "";
t.isRawShaderMaterial ? (m = [
@@ -21042,10 +21060,10 @@ function wv(s, e, t, i) {
"uniform mat4 viewMatrix;",
"uniform vec3 cameraPosition;",
"uniform bool isOrthographic;",
- t.toneMapping !== er ? "#define TONE_MAPPING" : "",
- t.toneMapping !== er ? Fe.tonemapping_pars_fragment : "",
+ t.toneMapping !== tr ? "#define TONE_MAPPING" : "",
+ t.toneMapping !== tr ? Fe.tonemapping_pars_fragment : "",
// this code is required here because it is used by the toneMapping() function defined below
- t.toneMapping !== er ? uv("toneMapping", t.toneMapping) : "",
+ t.toneMapping !== tr ? uv("toneMapping", t.toneMapping) : "",
t.dithering ? "#define DITHERING" : "",
t.opaque ? "#define OPAQUE" : "",
Fe.colorspace_pars_fragment,
@@ -21056,7 +21074,7 @@ function wv(s, e, t, i) {
`
`
].filter(ys).join(`
-`)), a = xo(a), a = yc(a, t), a = Mc(a, t), o = xo(o), o = yc(o, t), o = Mc(o, t), a = bc(a), o = bc(o), t.isRawShaderMaterial !== !0 && (y = `#version 300 es
+`)), a = xo(a), a = yc(a, t), a = bc(a, t), o = xo(o), o = yc(o, t), o = bc(o, t), a = Mc(a), o = Mc(o), t.isRawShaderMaterial !== !0 && (y = `#version 300 es
`, m = [
f,
"#define attribute in",
@@ -21103,7 +21121,7 @@ Program Info Log: ` + j + `
` + Pe
);
}
- else j !== "" ? be("WebGLProgram: Program Info Log:", j) : (q === "" || te === "") && (Z = !1);
+ else j !== "" ? Me("WebGLProgram: Program Info Log:", j) : (q === "" || te === "") && (Z = !1);
Z && (D.diagnostics = {
runnable: G,
programLog: j,
@@ -21117,7 +21135,7 @@ Program Info Log: ` + j + `
}
});
}
- r.deleteShader(A), r.deleteShader(S), I = new Mn(r, v), T = mv(r, v);
+ r.deleteShader(A), r.deleteShader(S), I = new bn(r, v), T = mv(r, v);
}
let I;
this.getUniforms = function() {
@@ -21127,9 +21145,9 @@ Program Info Log: ` + j + `
this.getAttributes = function() {
return T === void 0 && R(this), T;
};
- let b = t.rendererExtensionParallelShaderCompile === !1;
+ let M = t.rendererExtensionParallelShaderCompile === !1;
return this.isReady = function() {
- return b === !1 && (b = r.getProgramParameter(v, av)), b;
+ return M === !1 && (M = r.getProgramParameter(v, av)), M;
}, this.destroy = function() {
i.releaseStatesOfProgram(this), r.deleteProgram(v), this.program = void 0;
}, this.type = t.shaderType, this.name = t.shaderName, this.id = ov++, this.cacheKey = e, this.usedTimes = 1, this.program = v, this.vertexShader = A, this.fragmentShader = S, this;
@@ -21197,20 +21215,20 @@ function Pv(s, e, t, i, r, n, a) {
function v(T) {
return c.add(T), T === 0 ? "uv" : `uv${T}`;
}
- function m(T, b, D, N, z) {
+ function m(T, M, D, N, z) {
const H = N.fog, j = z.geometry, q = T.isMeshStandardMaterial ? N.environment : null, te = (T.isMeshStandardMaterial ? t : e).get(T.envMap || q), G = te && te.mapping === Ln ? te.image.height : null, Z = g[T.type];
- T.precision !== null && (f = r.getMaxPrecision(T.precision), f !== T.precision && be("WebGLProgram.getParameters:", T.precision, "not supported, using", f, "instead."));
+ T.precision !== null && (f = r.getMaxPrecision(T.precision), f !== T.precision && Me("WebGLProgram.getParameters:", T.precision, "not supported, using", f, "instead."));
const se = j.morphAttributes.position || j.morphAttributes.normal || j.morphAttributes.color, Pe = se !== void 0 ? se.length : 0;
let ze = 0;
j.morphAttributes.position !== void 0 && (ze = 1), j.morphAttributes.normal !== void 0 && (ze = 2), j.morphAttributes.color !== void 0 && (ze = 3);
let qe, Ke, Ze, W;
if (Z) {
- const rt = bi[Z];
+ const rt = Mi[Z];
qe = rt.vertexShader, Ke = rt.fragmentShader;
} else
qe = T.vertexShader, Ke = T.fragmentShader, l.update(T), Ze = l.getVertexShaderID(T), W = l.getFragmentShaderID(T);
- const Y = s.getRenderTarget(), ue = s.state.buffers.depth.getReversed(), Ce = z.isInstancedMesh === !0, Te = z.isBatchedMesh === !0, Ee = !!T.map, Je = !!T.matcap, je = !!te, Ve = !!T.aoMap, L = !!T.lightMap, gt = !!T.bumpMap, We = !!T.normalMap, Qe = !!T.displacementMap, fe = !!T.emissiveMap, at = !!T.metalnessMap, Me = !!T.roughnessMap, De = T.anisotropy > 0, C = T.clearcoat > 0, x = T.dispersion > 0, B = T.iridescence > 0, X = T.sheen > 0, K = T.transmission > 0, V = De && !!T.anisotropyMap, xe = C && !!T.clearcoatMap, ne = C && !!T.clearcoatNormalMap, Se = C && !!T.clearcoatRoughnessMap, de = B && !!T.iridescenceMap, J = B && !!T.iridescenceThicknessMap, re = X && !!T.sheenColorMap, Oe = X && !!T.sheenRoughnessMap, we = !!T.specularMap, he = !!T.specularColorMap, Re = !!T.specularIntensityMap, P = K && !!T.transmissionMap, ae = K && !!T.thicknessMap, ie = !!T.gradientMap, le = !!T.alphaMap, Q = T.alphaTest > 0, $ = !!T.alphaHash, ve = !!T.extensions;
- let Ae = er;
+ const Y = s.getRenderTarget(), ue = s.state.buffers.depth.getReversed(), Ce = z.isInstancedMesh === !0, Te = z.isBatchedMesh === !0, Ee = !!T.map, Je = !!T.matcap, je = !!te, Ve = !!T.aoMap, L = !!T.lightMap, gt = !!T.bumpMap, We = !!T.normalMap, Qe = !!T.displacementMap, fe = !!T.emissiveMap, at = !!T.metalnessMap, be = !!T.roughnessMap, De = T.anisotropy > 0, C = T.clearcoat > 0, x = T.dispersion > 0, B = T.iridescence > 0, X = T.sheen > 0, K = T.transmission > 0, V = De && !!T.anisotropyMap, xe = C && !!T.clearcoatMap, ne = C && !!T.clearcoatNormalMap, Se = C && !!T.clearcoatRoughnessMap, de = B && !!T.iridescenceMap, J = B && !!T.iridescenceThicknessMap, re = X && !!T.sheenColorMap, Oe = X && !!T.sheenRoughnessMap, we = !!T.specularMap, he = !!T.specularColorMap, Re = !!T.specularIntensityMap, P = K && !!T.transmissionMap, ae = K && !!T.thicknessMap, ie = !!T.gradientMap, le = !!T.alphaMap, Q = T.alphaTest > 0, $ = !!T.alphaHash, ve = !!T.extensions;
+ let Ae = tr;
T.toneMapped && (Y === null || Y.isXRRenderTarget === !0) && (Ae = s.toneMapping);
const Et = {
shaderID: Z,
@@ -21230,7 +21248,7 @@ function Pv(s, e, t, i, r, n, a) {
instancingColor: Ce && z.instanceColor !== null,
instancingMorph: Ce && z.morphTexture !== null,
supportsVertexTextures: d,
- outputColorSpace: Y === null ? s.outputColorSpace : Y.isXRRenderTarget === !0 ? Y.texture.colorSpace : Nt,
+ outputColorSpace: Y === null ? s.outputColorSpace : Y.isXRRenderTarget === !0 ? Y.texture.colorSpace : Ot,
alphaToCoverage: !!T.alphaToCoverage,
map: Ee,
matcap: Je,
@@ -21246,7 +21264,7 @@ function Pv(s, e, t, i, r, n, a) {
normalMapObjectSpace: We && T.normalMapType === Tu,
normalMapTangentSpace: We && T.normalMapType === In,
metalnessMap: at,
- roughnessMap: Me,
+ roughnessMap: be,
anisotropy: De,
anisotropyMap: V,
clearcoat: C,
@@ -21267,7 +21285,7 @@ function Pv(s, e, t, i, r, n, a) {
transmissionMap: P,
thicknessMap: ae,
gradientMap: ie,
- opaque: T.transparent === !1 && T.blending === kr && T.alphaToCoverage === !1,
+ opaque: T.transparent === !1 && T.blending === zr && T.alphaToCoverage === !1,
alphaMap: le,
alphaTest: Q,
alphaHash: $,
@@ -21281,7 +21299,7 @@ function Pv(s, e, t, i, r, n, a) {
displacementMapUv: Qe && v(T.displacementMap.channel),
emissiveMapUv: fe && v(T.emissiveMap.channel),
metalnessMapUv: at && v(T.metalnessMap.channel),
- roughnessMapUv: Me && v(T.roughnessMap.channel),
+ roughnessMapUv: be && v(T.roughnessMap.channel),
anisotropyMapUv: V && v(T.anisotropyMap.channel),
clearcoatMapUv: xe && v(T.clearcoatMap.channel),
clearcoatNormalMapUv: ne && v(T.clearcoatNormalMap.channel),
@@ -21314,17 +21332,17 @@ function Pv(s, e, t, i, r, n, a) {
morphColors: j.morphAttributes.color !== void 0,
morphTargetsCount: Pe,
morphTextureStride: ze,
- numDirLights: b.directional.length,
- numPointLights: b.point.length,
- numSpotLights: b.spot.length,
- numSpotLightMaps: b.spotLightMap.length,
- numRectAreaLights: b.rectArea.length,
- numHemiLights: b.hemi.length,
- numDirLightShadows: b.directionalShadowMap.length,
- numPointLightShadows: b.pointShadowMap.length,
- numSpotLightShadows: b.spotShadowMap.length,
- numSpotLightShadowsWithMaps: b.numSpotLightShadowsWithMaps,
- numLightProbes: b.numLightProbes,
+ numDirLights: M.directional.length,
+ numPointLights: M.point.length,
+ numSpotLights: M.spot.length,
+ numSpotLightMaps: M.spotLightMap.length,
+ numRectAreaLights: M.rectArea.length,
+ numHemiLights: M.hemi.length,
+ numDirLightShadows: M.directionalShadowMap.length,
+ numPointLightShadows: M.pointShadowMap.length,
+ numSpotLightShadows: M.spotShadowMap.length,
+ numSpotLightShadowsWithMaps: M.numSpotLightShadowsWithMaps,
+ numLightProbes: M.numLightProbes,
numClippingPlanes: a.numPlanes,
numClipIntersection: a.numIntersection,
dithering: T.dithering,
@@ -21347,43 +21365,43 @@ function Pv(s, e, t, i, r, n, a) {
return Et.vertexUv1s = c.has(1), Et.vertexUv2s = c.has(2), Et.vertexUv3s = c.has(3), c.clear(), Et;
}
function p(T) {
- const b = [];
- if (T.shaderID ? b.push(T.shaderID) : (b.push(T.customVertexShaderID), b.push(T.customFragmentShaderID)), T.defines !== void 0)
+ const M = [];
+ if (T.shaderID ? M.push(T.shaderID) : (M.push(T.customVertexShaderID), M.push(T.customFragmentShaderID)), T.defines !== void 0)
for (const D in T.defines)
- b.push(D), b.push(T.defines[D]);
- return T.isRawShaderMaterial === !1 && (y(b, T), _(b, T), b.push(s.outputColorSpace)), b.push(T.customProgramCacheKey), b.join();
+ M.push(D), M.push(T.defines[D]);
+ return T.isRawShaderMaterial === !1 && (y(M, T), _(M, T), M.push(s.outputColorSpace)), M.push(T.customProgramCacheKey), M.join();
}
- function y(T, b) {
- T.push(b.precision), T.push(b.outputColorSpace), T.push(b.envMapMode), T.push(b.envMapCubeUVHeight), T.push(b.mapUv), T.push(b.alphaMapUv), T.push(b.lightMapUv), T.push(b.aoMapUv), T.push(b.bumpMapUv), T.push(b.normalMapUv), T.push(b.displacementMapUv), T.push(b.emissiveMapUv), T.push(b.metalnessMapUv), T.push(b.roughnessMapUv), T.push(b.anisotropyMapUv), T.push(b.clearcoatMapUv), T.push(b.clearcoatNormalMapUv), T.push(b.clearcoatRoughnessMapUv), T.push(b.iridescenceMapUv), T.push(b.iridescenceThicknessMapUv), T.push(b.sheenColorMapUv), T.push(b.sheenRoughnessMapUv), T.push(b.specularMapUv), T.push(b.specularColorMapUv), T.push(b.specularIntensityMapUv), T.push(b.transmissionMapUv), T.push(b.thicknessMapUv), T.push(b.combine), T.push(b.fogExp2), T.push(b.sizeAttenuation), T.push(b.morphTargetsCount), T.push(b.morphAttributeCount), T.push(b.numDirLights), T.push(b.numPointLights), T.push(b.numSpotLights), T.push(b.numSpotLightMaps), T.push(b.numHemiLights), T.push(b.numRectAreaLights), T.push(b.numDirLightShadows), T.push(b.numPointLightShadows), T.push(b.numSpotLightShadows), T.push(b.numSpotLightShadowsWithMaps), T.push(b.numLightProbes), T.push(b.shadowMapType), T.push(b.toneMapping), T.push(b.numClippingPlanes), T.push(b.numClipIntersection), T.push(b.depthPacking);
+ function y(T, M) {
+ T.push(M.precision), T.push(M.outputColorSpace), T.push(M.envMapMode), T.push(M.envMapCubeUVHeight), T.push(M.mapUv), T.push(M.alphaMapUv), T.push(M.lightMapUv), T.push(M.aoMapUv), T.push(M.bumpMapUv), T.push(M.normalMapUv), T.push(M.displacementMapUv), T.push(M.emissiveMapUv), T.push(M.metalnessMapUv), T.push(M.roughnessMapUv), T.push(M.anisotropyMapUv), T.push(M.clearcoatMapUv), T.push(M.clearcoatNormalMapUv), T.push(M.clearcoatRoughnessMapUv), T.push(M.iridescenceMapUv), T.push(M.iridescenceThicknessMapUv), T.push(M.sheenColorMapUv), T.push(M.sheenRoughnessMapUv), T.push(M.specularMapUv), T.push(M.specularColorMapUv), T.push(M.specularIntensityMapUv), T.push(M.transmissionMapUv), T.push(M.thicknessMapUv), T.push(M.combine), T.push(M.fogExp2), T.push(M.sizeAttenuation), T.push(M.morphTargetsCount), T.push(M.morphAttributeCount), T.push(M.numDirLights), T.push(M.numPointLights), T.push(M.numSpotLights), T.push(M.numSpotLightMaps), T.push(M.numHemiLights), T.push(M.numRectAreaLights), T.push(M.numDirLightShadows), T.push(M.numPointLightShadows), T.push(M.numSpotLightShadows), T.push(M.numSpotLightShadowsWithMaps), T.push(M.numLightProbes), T.push(M.shadowMapType), T.push(M.toneMapping), T.push(M.numClippingPlanes), T.push(M.numClipIntersection), T.push(M.depthPacking);
}
- function _(T, b) {
- o.disableAll(), b.supportsVertexTextures && o.enable(0), b.instancing && o.enable(1), b.instancingColor && o.enable(2), b.instancingMorph && o.enable(3), b.matcap && o.enable(4), b.envMap && o.enable(5), b.normalMapObjectSpace && o.enable(6), b.normalMapTangentSpace && o.enable(7), b.clearcoat && o.enable(8), b.iridescence && o.enable(9), b.alphaTest && o.enable(10), b.vertexColors && o.enable(11), b.vertexAlphas && o.enable(12), b.vertexUv1s && o.enable(13), b.vertexUv2s && o.enable(14), b.vertexUv3s && o.enable(15), b.vertexTangents && o.enable(16), b.anisotropy && o.enable(17), b.alphaHash && o.enable(18), b.batching && o.enable(19), b.dispersion && o.enable(20), b.batchingColor && o.enable(21), b.gradientMap && o.enable(22), T.push(o.mask), o.disableAll(), b.fog && o.enable(0), b.useFog && o.enable(1), b.flatShading && o.enable(2), b.logarithmicDepthBuffer && o.enable(3), b.reversedDepthBuffer && o.enable(4), b.skinning && o.enable(5), b.morphTargets && o.enable(6), b.morphNormals && o.enable(7), b.morphColors && o.enable(8), b.premultipliedAlpha && o.enable(9), b.shadowMapEnabled && o.enable(10), b.doubleSided && o.enable(11), b.flipSided && o.enable(12), b.useDepthPacking && o.enable(13), b.dithering && o.enable(14), b.transmission && o.enable(15), b.sheen && o.enable(16), b.opaque && o.enable(17), b.pointsUvs && o.enable(18), b.decodeVideoTexture && o.enable(19), b.decodeVideoTextureEmissive && o.enable(20), b.alphaToCoverage && o.enable(21), T.push(o.mask);
+ function _(T, M) {
+ o.disableAll(), M.supportsVertexTextures && o.enable(0), M.instancing && o.enable(1), M.instancingColor && o.enable(2), M.instancingMorph && o.enable(3), M.matcap && o.enable(4), M.envMap && o.enable(5), M.normalMapObjectSpace && o.enable(6), M.normalMapTangentSpace && o.enable(7), M.clearcoat && o.enable(8), M.iridescence && o.enable(9), M.alphaTest && o.enable(10), M.vertexColors && o.enable(11), M.vertexAlphas && o.enable(12), M.vertexUv1s && o.enable(13), M.vertexUv2s && o.enable(14), M.vertexUv3s && o.enable(15), M.vertexTangents && o.enable(16), M.anisotropy && o.enable(17), M.alphaHash && o.enable(18), M.batching && o.enable(19), M.dispersion && o.enable(20), M.batchingColor && o.enable(21), M.gradientMap && o.enable(22), T.push(o.mask), o.disableAll(), M.fog && o.enable(0), M.useFog && o.enable(1), M.flatShading && o.enable(2), M.logarithmicDepthBuffer && o.enable(3), M.reversedDepthBuffer && o.enable(4), M.skinning && o.enable(5), M.morphTargets && o.enable(6), M.morphNormals && o.enable(7), M.morphColors && o.enable(8), M.premultipliedAlpha && o.enable(9), M.shadowMapEnabled && o.enable(10), M.doubleSided && o.enable(11), M.flipSided && o.enable(12), M.useDepthPacking && o.enable(13), M.dithering && o.enable(14), M.transmission && o.enable(15), M.sheen && o.enable(16), M.opaque && o.enable(17), M.pointsUvs && o.enable(18), M.decodeVideoTexture && o.enable(19), M.decodeVideoTextureEmissive && o.enable(20), M.alphaToCoverage && o.enable(21), T.push(o.mask);
}
function E(T) {
- const b = g[T.type];
+ const M = g[T.type];
let D;
- if (b) {
- const N = bi[b];
+ if (M) {
+ const N = Mi[M];
D = di.clone(N.uniforms);
} else
D = T.uniforms;
return D;
}
- function A(T, b) {
+ function A(T, M) {
let D;
for (let N = 0, z = h.length; N < z; N++) {
const H = h[N];
- if (H.cacheKey === b) {
+ if (H.cacheKey === M) {
D = H, ++D.usedTimes;
break;
}
}
- return D === void 0 && (D = new wv(s, b, T, n), h.push(D)), D;
+ return D === void 0 && (D = new wv(s, M, T, n), h.push(D)), D;
}
function S(T) {
if (--T.usedTimes === 0) {
- const b = h.indexOf(T);
- h[b] = h[h.length - 1], h.pop(), T.destroy();
+ const M = h.indexOf(T);
+ h[M] = h[h.length - 1], h.pop(), T.destroy();
}
}
function R(T) {
@@ -21643,7 +21661,7 @@ function Fv(s) {
for (let T = 0; T < 9; T++) i.probe[T].set(0, 0, 0);
let f = 0, g = 0, v = 0, m = 0, p = 0, y = 0, _ = 0, E = 0, A = 0, S = 0, R = 0;
c.sort(Bv);
- for (let T = 0, b = c.length; T < b; T++) {
+ for (let T = 0, M = c.length; T < M; T++) {
const D = c[T], N = D.color, z = D.intensity, H = D.distance, j = D.shadow && D.shadow.map ? D.shadow.map.texture : null;
if (D.isAmbientLight)
h += N.r * z, u += N.g * z, d += N.b * z;
@@ -21794,7 +21812,7 @@ void main() {
}`;
function Vv(s, e, t) {
let i = new jo();
- const r = new oe(), n = new oe(), a = new $e(), o = new vh({ depthPacking: sh }), l = new Bd(), c = {}, h = t.maxTextureSize, u = { [Ei]: zt, [zt]: Ei, [Wt]: Wt }, d = new ct({
+ const r = new oe(), n = new oe(), a = new $e(), o = new vh({ depthPacking: sh }), l = new Bd(), c = {}, h = t.maxTextureSize, u = { [Ci]: zt, [zt]: Ci, [Wt]: Wt }, d = new ct({
defines: {
VSM_SAMPLES: 8
},
@@ -21820,20 +21838,20 @@ function Vv(s, e, t) {
let p = this.type;
this.render = function(S, R, I) {
if (m.enabled === !1 || m.autoUpdate === !1 && m.needsUpdate === !1 || S.length === 0) return;
- const T = s.getRenderTarget(), b = s.getActiveCubeFace(), D = s.getActiveMipmapLevel(), N = s.state;
+ const T = s.getRenderTarget(), M = s.getActiveCubeFace(), D = s.getActiveMipmapLevel(), N = s.state;
N.setBlending(_t), N.buffers.depth.getReversed() === !0 ? N.buffers.color.setClear(0, 0, 0, 0) : N.buffers.color.setClear(1, 1, 1, 1), N.buffers.depth.setTest(!0), N.setScissorTest(!1);
- const z = p !== Fi && this.type === Fi, H = p === Fi && this.type !== Fi;
+ const z = p !== zi && this.type === zi, H = p === zi && this.type !== zi;
for (let j = 0, q = S.length; j < q; j++) {
const te = S[j], G = te.shadow;
if (G === void 0) {
- be("WebGLShadowMap:", te, "has no shadow.");
+ Me("WebGLShadowMap:", te, "has no shadow.");
continue;
}
if (G.autoUpdate === !1 && G.needsUpdate === !1) continue;
r.copy(G.mapSize);
const Z = G.getFrameExtents();
if (r.multiply(Z), n.copy(G.mapSize), (r.x > h || r.y > h) && (r.x > h && (n.x = Math.floor(h / Z.x), r.x = n.x * Z.x, G.mapSize.x = n.x), r.y > h && (n.y = Math.floor(h / Z.y), r.y = n.y * Z.y, G.mapSize.y = n.y)), G.map === null || z === !0 || H === !0) {
- const Pe = this.type !== Fi ? { minFilter: Lt, magFilter: Lt } : {};
+ const Pe = this.type !== zi ? { minFilter: It, magFilter: It } : {};
G.map !== null && G.map.dispose(), G.map = new xt(r.x, r.y, Pe), G.map.texture.name = te.name + ".shadowMap", G.camera.updateProjectionMatrix();
}
s.setRenderTarget(G.map), s.clear();
@@ -21847,35 +21865,35 @@ function Vv(s, e, t) {
n.y * ze.w
), N.viewport(a), G.updateMatrices(te, Pe), i = G.getFrustum(), E(R, I, G.camera, te, this.type);
}
- G.isPointLightShadow !== !0 && this.type === Fi && y(G, I), G.needsUpdate = !1;
+ G.isPointLightShadow !== !0 && this.type === zi && y(G, I), G.needsUpdate = !1;
}
- p = this.type, m.needsUpdate = !1, s.setRenderTarget(T, b, D);
+ p = this.type, m.needsUpdate = !1, s.setRenderTarget(T, M, D);
};
function y(S, R) {
const I = e.update(v);
d.defines.VSM_SAMPLES !== S.blurSamples && (d.defines.VSM_SAMPLES = S.blurSamples, f.defines.VSM_SAMPLES = S.blurSamples, d.needsUpdate = !0, f.needsUpdate = !0), S.mapPass === null && (S.mapPass = new xt(r.x, r.y)), d.uniforms.shadow_pass.value = S.map.texture, d.uniforms.resolution.value = S.mapSize, d.uniforms.radius.value = S.radius, s.setRenderTarget(S.mapPass), s.clear(), s.renderBufferDirect(R, null, I, d, v, null), f.uniforms.shadow_pass.value = S.mapPass.texture, f.uniforms.resolution.value = S.mapSize, f.uniforms.radius.value = S.radius, s.setRenderTarget(S.map), s.clear(), s.renderBufferDirect(R, null, I, f, v, null);
}
function _(S, R, I, T) {
- let b = null;
+ let M = null;
const D = I.isPointLight === !0 ? S.customDistanceMaterial : S.customDepthMaterial;
if (D !== void 0)
- b = D;
- else if (b = I.isPointLight === !0 ? l : o, s.localClippingEnabled && R.clipShadows === !0 && Array.isArray(R.clippingPlanes) && R.clippingPlanes.length !== 0 || R.displacementMap && R.displacementScale !== 0 || R.alphaMap && R.alphaTest > 0 || R.map && R.alphaTest > 0 || R.alphaToCoverage === !0) {
- const N = b.uuid, z = R.uuid;
+ M = D;
+ else if (M = I.isPointLight === !0 ? l : o, s.localClippingEnabled && R.clipShadows === !0 && Array.isArray(R.clippingPlanes) && R.clippingPlanes.length !== 0 || R.displacementMap && R.displacementScale !== 0 || R.alphaMap && R.alphaTest > 0 || R.map && R.alphaTest > 0 || R.alphaToCoverage === !0) {
+ const N = M.uuid, z = R.uuid;
let H = c[N];
H === void 0 && (H = {}, c[N] = H);
let j = H[z];
- j === void 0 && (j = b.clone(), H[z] = j, R.addEventListener("dispose", A)), b = j;
+ j === void 0 && (j = M.clone(), H[z] = j, R.addEventListener("dispose", A)), M = j;
}
- if (b.visible = R.visible, b.wireframe = R.wireframe, T === Fi ? b.side = R.shadowSide !== null ? R.shadowSide : R.side : b.side = R.shadowSide !== null ? R.shadowSide : u[R.side], b.alphaMap = R.alphaMap, b.alphaTest = R.alphaToCoverage === !0 ? 0.5 : R.alphaTest, b.map = R.map, b.clipShadows = R.clipShadows, b.clippingPlanes = R.clippingPlanes, b.clipIntersection = R.clipIntersection, b.displacementMap = R.displacementMap, b.displacementScale = R.displacementScale, b.displacementBias = R.displacementBias, b.wireframeLinewidth = R.wireframeLinewidth, b.linewidth = R.linewidth, I.isPointLight === !0 && b.isMeshDistanceMaterial === !0) {
- const N = s.properties.get(b);
+ if (M.visible = R.visible, M.wireframe = R.wireframe, T === zi ? M.side = R.shadowSide !== null ? R.shadowSide : R.side : M.side = R.shadowSide !== null ? R.shadowSide : u[R.side], M.alphaMap = R.alphaMap, M.alphaTest = R.alphaToCoverage === !0 ? 0.5 : R.alphaTest, M.map = R.map, M.clipShadows = R.clipShadows, M.clippingPlanes = R.clippingPlanes, M.clipIntersection = R.clipIntersection, M.displacementMap = R.displacementMap, M.displacementScale = R.displacementScale, M.displacementBias = R.displacementBias, M.wireframeLinewidth = R.wireframeLinewidth, M.linewidth = R.linewidth, I.isPointLight === !0 && M.isMeshDistanceMaterial === !0) {
+ const N = s.properties.get(M);
N.light = I;
}
- return b;
+ return M;
}
- function E(S, R, I, T, b) {
+ function E(S, R, I, T, M) {
if (S.visible === !1) return;
- if (S.layers.test(R.layers) && (S.isMesh || S.isLine || S.isPoints) && (S.castShadow || S.receiveShadow && b === Fi) && (!S.frustumCulled || i.intersectsObject(S))) {
+ if (S.layers.test(R.layers) && (S.isMesh || S.isLine || S.isPoints) && (S.castShadow || S.receiveShadow && M === zi) && (!S.frustumCulled || i.intersectsObject(S))) {
S.modelViewMatrix.multiplyMatrices(I.matrixWorldInverse, S.matrixWorld);
const N = e.update(S), z = S.material;
if (Array.isArray(z)) {
@@ -21883,18 +21901,18 @@ function Vv(s, e, t) {
for (let j = 0, q = H.length; j < q; j++) {
const te = H[j], G = z[te.materialIndex];
if (G && G.visible) {
- const Z = _(S, G, T, b);
+ const Z = _(S, G, T, M);
S.onBeforeShadow(s, S, R, I, N, Z, te), s.renderBufferDirect(I, null, N, Z, S, te), S.onAfterShadow(s, S, R, I, N, Z, te);
}
}
} else if (z.visible) {
- const H = _(S, z, T, b);
+ const H = _(S, z, T, M);
S.onBeforeShadow(s, S, R, I, N, H, null), s.renderBufferDirect(I, null, N, H, S, null), S.onAfterShadow(s, S, R, I, N, H, null);
}
}
const D = S.children;
for (let N = 0, z = D.length; N < z; N++)
- E(D[N], R, I, T, b);
+ E(D[N], R, I, T, M);
}
function A(S) {
S.target.removeEventListener("dispose", A);
@@ -21908,11 +21926,11 @@ const Gv = {
[Pa]: Da,
[La]: Na,
[Ia]: Oa,
- [Wr]: Ua,
+ [jr]: Ua,
[Da]: Pa,
[Na]: La,
[Oa]: Ia,
- [Ua]: Wr
+ [Ua]: jr
};
function Wv(s, e) {
function t() {
@@ -21967,7 +21985,7 @@ function Wv(s, e) {
case La:
s.depthFunc(s.LESS);
break;
- case Wr:
+ case jr:
s.depthFunc(s.LEQUAL);
break;
case Ia:
@@ -22026,7 +22044,7 @@ function Wv(s, e) {
};
}
const n = new t(), a = new i(), o = new r(), l = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap();
- let h = {}, u = {}, d = /* @__PURE__ */ new WeakMap(), f = [], g = null, v = !1, m = null, p = null, y = null, _ = null, E = null, A = null, S = null, R = new _e(0, 0, 0), I = 0, T = !1, b = null, D = null, N = null, z = null, H = null;
+ let h = {}, u = {}, d = /* @__PURE__ */ new WeakMap(), f = [], g = null, v = !1, m = null, p = null, y = null, _ = null, E = null, A = null, S = null, R = new _e(0, 0, 0), I = 0, T = !1, M = null, D = null, N = null, z = null, H = null;
const j = s.getParameter(s.MAX_COMBINED_TEXTURE_IMAGE_UNITS);
let q = !1, te = 0;
const G = s.getParameter(s.VERSION);
@@ -22041,7 +22059,7 @@ function Wv(s, e) {
return $;
}
const W = {};
- W[s.TEXTURE_2D] = Ze(s.TEXTURE_2D, s.TEXTURE_2D, 1), W[s.TEXTURE_CUBE_MAP] = Ze(s.TEXTURE_CUBE_MAP, s.TEXTURE_CUBE_MAP_POSITIVE_X, 6), W[s.TEXTURE_2D_ARRAY] = Ze(s.TEXTURE_2D_ARRAY, s.TEXTURE_2D_ARRAY, 1, 1), W[s.TEXTURE_3D] = Ze(s.TEXTURE_3D, s.TEXTURE_3D, 1, 1), n.setClear(0, 0, 0, 1), a.setClear(1), o.setClear(0), Y(s.DEPTH_TEST), a.setFunc(Wr), gt(!1), We(cl), Y(s.CULL_FACE), Ve(_t);
+ W[s.TEXTURE_2D] = Ze(s.TEXTURE_2D, s.TEXTURE_2D, 1), W[s.TEXTURE_CUBE_MAP] = Ze(s.TEXTURE_CUBE_MAP, s.TEXTURE_CUBE_MAP_POSITIVE_X, 6), W[s.TEXTURE_2D_ARRAY] = Ze(s.TEXTURE_2D_ARRAY, s.TEXTURE_2D_ARRAY, 1, 1), W[s.TEXTURE_3D] = Ze(s.TEXTURE_3D, s.TEXTURE_3D, 1, 1), n.setClear(0, 0, 0, 1), a.setClear(1), o.setClear(0), Y(s.DEPTH_TEST), a.setFunc(jr), gt(!1), We(cl), Y(s.CULL_FACE), Ve(_t);
function Y(P) {
h[P] !== !0 && (s.enable(P), h[P] = !0);
}
@@ -22100,10 +22118,10 @@ function Wv(s, e) {
if (P !== m || rt !== T) {
if ((p !== ci || E !== ci) && (s.blendEquation(s.FUNC_ADD), p = ci, E = ci), rt)
switch (P) {
- case kr:
+ case zr:
s.blendFuncSeparate(s.ONE, s.ONE_MINUS_SRC_ALPHA, s.ONE, s.ONE_MINUS_SRC_ALPHA);
break;
- case bn:
+ case Mn:
s.blendFunc(s.ONE, s.ONE);
break;
case hl:
@@ -22118,10 +22136,10 @@ function Wv(s, e) {
}
else
switch (P) {
- case kr:
+ case zr:
s.blendFuncSeparate(s.SRC_ALPHA, s.ONE_MINUS_SRC_ALPHA, s.ONE, s.ONE_MINUS_SRC_ALPHA);
break;
- case bn:
+ case Mn:
s.blendFuncSeparate(s.SRC_ALPHA, s.ONE, s.ONE, s.ONE);
break;
case hl:
@@ -22143,12 +22161,12 @@ function Wv(s, e) {
function L(P, ae) {
P.side === Wt ? ue(s.CULL_FACE) : Y(s.CULL_FACE);
let ie = P.side === zt;
- ae && (ie = !ie), gt(ie), P.blending === kr && P.transparent === !1 ? Ve(_t) : Ve(P.blending, P.blendEquation, P.blendSrc, P.blendDst, P.blendEquationAlpha, P.blendSrcAlpha, P.blendDstAlpha, P.blendColor, P.blendAlpha, P.premultipliedAlpha), a.setFunc(P.depthFunc), a.setTest(P.depthTest), a.setMask(P.depthWrite), n.setMask(P.colorWrite);
+ ae && (ie = !ie), gt(ie), P.blending === zr && P.transparent === !1 ? Ve(_t) : Ve(P.blending, P.blendEquation, P.blendSrc, P.blendDst, P.blendEquationAlpha, P.blendSrcAlpha, P.blendDstAlpha, P.blendColor, P.blendAlpha, P.premultipliedAlpha), a.setFunc(P.depthFunc), a.setTest(P.depthTest), a.setMask(P.depthWrite), n.setMask(P.colorWrite);
const le = P.stencilWrite;
o.setTest(le), le && (o.setMask(P.stencilWriteMask), o.setFunc(P.stencilFunc, P.stencilRef, P.stencilFuncMask), o.setOp(P.stencilFail, P.stencilZFail, P.stencilZPass)), fe(P.polygonOffset, P.polygonOffsetFactor, P.polygonOffsetUnits), P.alphaToCoverage === !0 ? Y(s.SAMPLE_ALPHA_TO_COVERAGE) : ue(s.SAMPLE_ALPHA_TO_COVERAGE);
}
function gt(P) {
- b !== P && (P ? s.frontFace(s.CW) : s.frontFace(s.CCW), b = P);
+ M !== P && (P ? s.frontFace(s.CW) : s.frontFace(s.CCW), M = P);
}
function We(P) {
P !== tu ? (Y(s.CULL_FACE), P !== D && (P === cl ? s.cullFace(s.BACK) : P === iu ? s.cullFace(s.FRONT) : s.cullFace(s.FRONT_AND_BACK))) : ue(s.CULL_FACE), D = P;
@@ -22162,7 +22180,7 @@ function Wv(s, e) {
function at(P) {
P ? Y(s.SCISSOR_TEST) : ue(s.SCISSOR_TEST);
}
- function Me(P) {
+ function be(P) {
P === void 0 && (P = s.TEXTURE0 + j - 1), Z !== P && (s.activeTexture(P), Z = P);
}
function De(P, ae, ie) {
@@ -22261,7 +22279,7 @@ function Wv(s, e) {
l.get(ae) !== ie && (s.uniformBlockBinding(ae, ie, P.__bindingPointIndex), l.set(ae, ie));
}
function Re() {
- s.disable(s.BLEND), s.disable(s.CULL_FACE), s.disable(s.DEPTH_TEST), s.disable(s.POLYGON_OFFSET_FILL), s.disable(s.SCISSOR_TEST), s.disable(s.STENCIL_TEST), s.disable(s.SAMPLE_ALPHA_TO_COVERAGE), s.blendEquation(s.FUNC_ADD), s.blendFunc(s.ONE, s.ZERO), s.blendFuncSeparate(s.ONE, s.ZERO, s.ONE, s.ZERO), s.blendColor(0, 0, 0, 0), s.colorMask(!0, !0, !0, !0), s.clearColor(0, 0, 0, 0), s.depthMask(!0), s.depthFunc(s.LESS), a.setReversed(!1), s.clearDepth(1), s.stencilMask(4294967295), s.stencilFunc(s.ALWAYS, 0, 4294967295), s.stencilOp(s.KEEP, s.KEEP, s.KEEP), s.clearStencil(0), s.cullFace(s.BACK), s.frontFace(s.CCW), s.polygonOffset(0, 0), s.activeTexture(s.TEXTURE0), s.bindFramebuffer(s.FRAMEBUFFER, null), s.bindFramebuffer(s.DRAW_FRAMEBUFFER, null), s.bindFramebuffer(s.READ_FRAMEBUFFER, null), s.useProgram(null), s.lineWidth(1), s.scissor(0, 0, s.canvas.width, s.canvas.height), s.viewport(0, 0, s.canvas.width, s.canvas.height), h = {}, Z = null, se = {}, u = {}, d = /* @__PURE__ */ new WeakMap(), f = [], g = null, v = !1, m = null, p = null, y = null, _ = null, E = null, A = null, S = null, R = new _e(0, 0, 0), I = 0, T = !1, b = null, D = null, N = null, z = null, H = null, qe.set(0, 0, s.canvas.width, s.canvas.height), Ke.set(0, 0, s.canvas.width, s.canvas.height), n.reset(), a.reset(), o.reset();
+ s.disable(s.BLEND), s.disable(s.CULL_FACE), s.disable(s.DEPTH_TEST), s.disable(s.POLYGON_OFFSET_FILL), s.disable(s.SCISSOR_TEST), s.disable(s.STENCIL_TEST), s.disable(s.SAMPLE_ALPHA_TO_COVERAGE), s.blendEquation(s.FUNC_ADD), s.blendFunc(s.ONE, s.ZERO), s.blendFuncSeparate(s.ONE, s.ZERO, s.ONE, s.ZERO), s.blendColor(0, 0, 0, 0), s.colorMask(!0, !0, !0, !0), s.clearColor(0, 0, 0, 0), s.depthMask(!0), s.depthFunc(s.LESS), a.setReversed(!1), s.clearDepth(1), s.stencilMask(4294967295), s.stencilFunc(s.ALWAYS, 0, 4294967295), s.stencilOp(s.KEEP, s.KEEP, s.KEEP), s.clearStencil(0), s.cullFace(s.BACK), s.frontFace(s.CCW), s.polygonOffset(0, 0), s.activeTexture(s.TEXTURE0), s.bindFramebuffer(s.FRAMEBUFFER, null), s.bindFramebuffer(s.DRAW_FRAMEBUFFER, null), s.bindFramebuffer(s.READ_FRAMEBUFFER, null), s.useProgram(null), s.lineWidth(1), s.scissor(0, 0, s.canvas.width, s.canvas.height), s.viewport(0, 0, s.canvas.width, s.canvas.height), h = {}, Z = null, se = {}, u = {}, d = /* @__PURE__ */ new WeakMap(), f = [], g = null, v = !1, m = null, p = null, y = null, _ = null, E = null, A = null, S = null, R = new _e(0, 0, 0), I = 0, T = !1, M = null, D = null, N = null, z = null, H = null, qe.set(0, 0, s.canvas.width, s.canvas.height), Ke.set(0, 0, s.canvas.width, s.canvas.height), n.reset(), a.reset(), o.reset();
}
return {
buffers: {
@@ -22281,7 +22299,7 @@ function Wv(s, e) {
setLineWidth: Qe,
setPolygonOffset: fe,
setScissorTest: at,
- activeTexture: Me,
+ activeTexture: be,
bindTexture: De,
unbindTexture: C,
compressedTexImage2D: x,
@@ -22324,9 +22342,9 @@ function jv(s, e, t, i, r, n, a) {
const V = Math.floor(X * K.width), xe = Math.floor(X * K.height);
u === void 0 && (u = g(V, xe));
const ne = x ? g(V, xe) : u;
- return ne.width = V, ne.height = xe, ne.getContext("2d").drawImage(C, 0, 0, V, xe), be("WebGLRenderer: Texture has been resized from (" + K.width + "x" + K.height + ") to (" + V + "x" + xe + ")."), ne;
+ return ne.width = V, ne.height = xe, ne.getContext("2d").drawImage(C, 0, 0, V, xe), Me("WebGLRenderer: Texture has been resized from (" + K.width + "x" + K.height + ") to (" + V + "x" + xe + ")."), ne;
} else
- return "data" in C && be("WebGLRenderer: Image in DataTexture is too big (" + K.width + "x" + K.height + ")."), C;
+ return "data" in C && Me("WebGLRenderer: Image in DataTexture is too big (" + K.width + "x" + K.height + ")."), C;
return C;
}
function m(C) {
@@ -22341,7 +22359,7 @@ function jv(s, e, t, i, r, n, a) {
function _(C, x, B, X, K = !1) {
if (C !== null) {
if (s[C] !== void 0) return s[C];
- be("WebGLRenderer: Attempt to use non-existing WebGL internal format '" + C + "'");
+ Me("WebGLRenderer: Attempt to use non-existing WebGL internal format '" + C + "'");
}
let V = x;
if (x === s.RED && (B === s.FLOAT && (V = s.R32F), B === s.HALF_FLOAT && (V = s.R16F), B === s.UNSIGNED_BYTE && (V = s.R8)), x === s.RED_INTEGER && (B === s.UNSIGNED_BYTE && (V = s.R8UI), B === s.UNSIGNED_SHORT && (V = s.R16UI), B === s.UNSIGNED_INT && (V = s.R32UI), B === s.BYTE && (V = s.R8I), B === s.SHORT && (V = s.R16I), B === s.INT && (V = s.R32I)), x === s.RG && (B === s.FLOAT && (V = s.RG32F), B === s.HALF_FLOAT && (V = s.RG16F), B === s.UNSIGNED_BYTE && (V = s.RG8)), x === s.RG_INTEGER && (B === s.UNSIGNED_BYTE && (V = s.RG8UI), B === s.UNSIGNED_SHORT && (V = s.RG16UI), B === s.UNSIGNED_INT && (V = s.RG32UI), B === s.BYTE && (V = s.RG8I), B === s.SHORT && (V = s.RG16I), B === s.INT && (V = s.RG32I)), x === s.RGB_INTEGER && (B === s.UNSIGNED_BYTE && (V = s.RGB8UI), B === s.UNSIGNED_SHORT && (V = s.RGB16UI), B === s.UNSIGNED_INT && (V = s.RGB32UI), B === s.BYTE && (V = s.RGB8I), B === s.SHORT && (V = s.RGB16I), B === s.INT && (V = s.RGB32I)), x === s.RGBA_INTEGER && (B === s.UNSIGNED_BYTE && (V = s.RGBA8UI), B === s.UNSIGNED_SHORT && (V = s.RGBA16UI), B === s.UNSIGNED_INT && (V = s.RGBA32UI), B === s.BYTE && (V = s.RGBA8I), B === s.SHORT && (V = s.RGBA16I), B === s.INT && (V = s.RGBA32I)), x === s.RGB && (B === s.UNSIGNED_INT_5_9_9_9_REV && (V = s.RGB9_E5), B === s.UNSIGNED_INT_10F_11F_11F_REV && (V = s.R11F_G11F_B10F)), x === s.RGBA) {
@@ -22352,10 +22370,10 @@ function jv(s, e, t, i, r, n, a) {
}
function E(C, x) {
let B;
- return C ? x === null || x === mr || x === qr ? B = s.DEPTH24_STENCIL8 : x === jt ? B = s.DEPTH32F_STENCIL8 : x === Es && (B = s.DEPTH24_STENCIL8, be("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")) : x === null || x === mr || x === qr ? B = s.DEPTH_COMPONENT24 : x === jt ? B = s.DEPTH_COMPONENT32F : x === Es && (B = s.DEPTH_COMPONENT16), B;
+ return C ? x === null || x === mr || x === Yr ? B = s.DEPTH24_STENCIL8 : x === jt ? B = s.DEPTH32F_STENCIL8 : x === Es && (B = s.DEPTH24_STENCIL8, Me("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")) : x === null || x === mr || x === Yr ? B = s.DEPTH_COMPONENT24 : x === jt ? B = s.DEPTH_COMPONENT32F : x === Es && (B = s.DEPTH_COMPONENT16), B;
}
function A(C, x) {
- return m(C) === !0 || C.isFramebufferTexture && C.minFilter !== Lt && C.minFilter !== yt ? Math.log2(Math.max(x.width, x.height)) + 1 : C.mipmaps !== void 0 && C.mipmaps.length > 0 ? C.mipmaps.length : C.isCompressedTexture && Array.isArray(C.image) ? x.mipmaps.length : 1;
+ return m(C) === !0 || C.isFramebufferTexture && C.minFilter !== It && C.minFilter !== yt ? Math.log2(Math.max(x.width, x.height)) + 1 : C.mipmaps !== void 0 && C.mipmaps.length > 0 ? C.mipmaps.length : C.isCompressedTexture && Array.isArray(C.image) ? x.mipmaps.length : 1;
}
function S(C) {
const x = C.target;
@@ -22363,7 +22381,7 @@ function jv(s, e, t, i, r, n, a) {
}
function R(C) {
const x = C.target;
- x.removeEventListener("dispose", R), b(x);
+ x.removeEventListener("dispose", R), M(x);
}
function I(C) {
const x = i.get(C);
@@ -22381,7 +22399,7 @@ function jv(s, e, t, i, r, n, a) {
const B = C.source, X = d.get(B);
delete X[x.__cacheKey], a.memory.textures--;
}
- function b(C) {
+ function M(C) {
const x = i.get(C);
if (C.depthTexture && (C.depthTexture.dispose(), i.remove(C.depthTexture)), C.isWebGLCubeRenderTarget)
for (let X = 0; X < 6; X++) {
@@ -22414,7 +22432,7 @@ function jv(s, e, t, i, r, n, a) {
}
function z() {
const C = D;
- return C >= r.maxTextures && be("WebGLTextures: Trying to use " + C + " texture units while this GPU supports only " + r.maxTextures), D += 1, C;
+ return C >= r.maxTextures && Me("WebGLTextures: Trying to use " + C + " texture units while this GPU supports only " + r.maxTextures), D += 1, C;
}
function H(C) {
const x = [];
@@ -22425,9 +22443,9 @@ function jv(s, e, t, i, r, n, a) {
if (C.isVideoTexture && at(C), C.isRenderTargetTexture === !1 && C.isExternalTexture !== !0 && C.version > 0 && B.__version !== C.version) {
const X = C.image;
if (X === null)
- be("WebGLRenderer: Texture marked for update but no image data found.");
+ Me("WebGLRenderer: Texture marked for update but no image data found.");
else if (X.complete === !1)
- be("WebGLRenderer: Texture marked for update but image is incomplete");
+ Me("WebGLRenderer: Texture marked for update but image is incomplete");
else {
W(B, C, x);
return;
@@ -22460,11 +22478,11 @@ function jv(s, e, t, i, r, n, a) {
t.bindTexture(s.TEXTURE_CUBE_MAP, B.__webglTexture, s.TEXTURE0 + x);
}
const Z = {
- [wi]: s.REPEAT,
+ [Ri]: s.REPEAT,
[Qt]: s.CLAMP_TO_EDGE,
[Sn]: s.MIRRORED_REPEAT
}, se = {
- [Lt]: s.NEAREST,
+ [It]: s.NEAREST,
[Zc]: s.NEAREST_MIPMAP_NEAREST,
[xs]: s.NEAREST_MIPMAP_LINEAR,
[yt]: s.LINEAR,
@@ -22481,8 +22499,8 @@ function jv(s, e, t, i, r, n, a) {
[Au]: s.NOTEQUAL
};
function ze(C, x) {
- if (x.type === jt && e.has("OES_texture_float_linear") === !1 && (x.magFilter === yt || x.magFilter === gn || x.magFilter === xs || x.magFilter === Ti || x.minFilter === yt || x.minFilter === gn || x.minFilter === xs || x.minFilter === Ti) && be("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."), s.texParameteri(C, s.TEXTURE_WRAP_S, Z[x.wrapS]), s.texParameteri(C, s.TEXTURE_WRAP_T, Z[x.wrapT]), (C === s.TEXTURE_3D || C === s.TEXTURE_2D_ARRAY) && s.texParameteri(C, s.TEXTURE_WRAP_R, Z[x.wrapR]), s.texParameteri(C, s.TEXTURE_MAG_FILTER, se[x.magFilter]), s.texParameteri(C, s.TEXTURE_MIN_FILTER, se[x.minFilter]), x.compareFunction && (s.texParameteri(C, s.TEXTURE_COMPARE_MODE, s.COMPARE_REF_TO_TEXTURE), s.texParameteri(C, s.TEXTURE_COMPARE_FUNC, Pe[x.compareFunction])), e.has("EXT_texture_filter_anisotropic") === !0) {
- if (x.magFilter === Lt || x.minFilter !== xs && x.minFilter !== Ti || x.type === jt && e.has("OES_texture_float_linear") === !1) return;
+ if (x.type === jt && e.has("OES_texture_float_linear") === !1 && (x.magFilter === yt || x.magFilter === gn || x.magFilter === xs || x.magFilter === Ti || x.minFilter === yt || x.minFilter === gn || x.minFilter === xs || x.minFilter === Ti) && Me("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."), s.texParameteri(C, s.TEXTURE_WRAP_S, Z[x.wrapS]), s.texParameteri(C, s.TEXTURE_WRAP_T, Z[x.wrapT]), (C === s.TEXTURE_3D || C === s.TEXTURE_2D_ARRAY) && s.texParameteri(C, s.TEXTURE_WRAP_R, Z[x.wrapR]), s.texParameteri(C, s.TEXTURE_MAG_FILTER, se[x.magFilter]), s.texParameteri(C, s.TEXTURE_MIN_FILTER, se[x.minFilter]), x.compareFunction && (s.texParameteri(C, s.TEXTURE_COMPARE_MODE, s.COMPARE_REF_TO_TEXTURE), s.texParameteri(C, s.TEXTURE_COMPARE_FUNC, Pe[x.compareFunction])), e.has("EXT_texture_filter_anisotropic") === !0) {
+ if (x.magFilter === It || x.minFilter !== xs && x.minFilter !== Ti || x.type === jt && e.has("OES_texture_float_linear") === !1) return;
if (x.anisotropy > 1 || i.get(x).__currentAnisotropy) {
const B = e.get("EXT_texture_filter_anisotropic");
s.texParameterf(C, B.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(x.anisotropy, r.getMaxAnisotropy())), i.get(x).__currentAnisotropy = x.anisotropy;
@@ -22541,17 +22559,17 @@ function jv(s, e, t, i, r, n, a) {
const xe = i.get(V);
if (V.version !== xe.__version || K === !0) {
t.activeTexture(s.TEXTURE0 + B);
- const ne = Xe.getPrimaries(Xe.workingColorSpace), Se = x.colorSpace === $i ? null : Xe.getPrimaries(x.colorSpace), de = x.colorSpace === $i || ne === Se ? s.NONE : s.BROWSER_DEFAULT_WEBGL;
+ const ne = Xe.getPrimaries(Xe.workingColorSpace), Se = x.colorSpace === Ji ? null : Xe.getPrimaries(x.colorSpace), de = x.colorSpace === Ji || ne === Se ? s.NONE : s.BROWSER_DEFAULT_WEBGL;
s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL, x.flipY), s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL, x.premultiplyAlpha), s.pixelStorei(s.UNPACK_ALIGNMENT, x.unpackAlignment), s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL, de);
let J = v(x.image, !1, r.maxTextureSize);
- J = Me(x, J);
+ J = be(x, J);
const re = n.convert(x.format, x.colorSpace), Oe = n.convert(x.type);
let we = _(x.internalFormat, re, Oe, x.colorSpace, x.isVideoTexture);
ze(X, x);
let he;
const Re = x.mipmaps, P = x.isVideoTexture !== !0, ae = xe.__version === void 0 || K === !0, ie = V.dataReady, le = A(x, J);
if (x.isDepthTexture)
- we = E(x.format === Yr, x.type), ae && (P ? t.texStorage2D(s.TEXTURE_2D, 1, we, J.width, J.height) : t.texImage2D(s.TEXTURE_2D, 0, we, J.width, J.height, 0, re, Oe, null));
+ we = E(x.format === Kr, x.type), ae && (P ? t.texStorage2D(s.TEXTURE_2D, 1, we, J.width, J.height) : t.texImage2D(s.TEXTURE_2D, 0, we, J.width, J.height, 0, re, Oe, null));
else if (x.isDataTexture)
if (Re.length > 0) {
P && ae && t.texStorage2D(s.TEXTURE_2D, le, we, Re[0].width, Re[0].height);
@@ -22583,13 +22601,13 @@ function jv(s, e, t, i, r, n, a) {
} else
t.compressedTexImage3D(s.TEXTURE_2D_ARRAY, Q, we, he.width, he.height, J.depth, 0, he.data, 0, 0);
else
- be("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");
+ Me("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");
else
P ? ie && t.texSubImage3D(s.TEXTURE_2D_ARRAY, Q, 0, 0, 0, he.width, he.height, J.depth, re, Oe, he.data) : t.texImage3D(s.TEXTURE_2D_ARRAY, Q, we, he.width, he.height, J.depth, 0, re, Oe, he.data);
} else {
P && ae && t.texStorage2D(s.TEXTURE_2D, le, we, Re[0].width, Re[0].height);
for (let Q = 0, $ = Re.length; Q < $; Q++)
- he = Re[Q], x.format !== Kt ? re !== null ? P ? ie && t.compressedTexSubImage2D(s.TEXTURE_2D, Q, 0, 0, he.width, he.height, re, he.data) : t.compressedTexImage2D(s.TEXTURE_2D, Q, we, he.width, he.height, 0, he.data) : be("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()") : P ? ie && t.texSubImage2D(s.TEXTURE_2D, Q, 0, 0, he.width, he.height, re, Oe, he.data) : t.texImage2D(s.TEXTURE_2D, Q, we, he.width, he.height, 0, re, Oe, he.data);
+ he = Re[Q], x.format !== Kt ? re !== null ? P ? ie && t.compressedTexSubImage2D(s.TEXTURE_2D, Q, 0, 0, he.width, he.height, re, he.data) : t.compressedTexImage2D(s.TEXTURE_2D, Q, we, he.width, he.height, 0, he.data) : Me("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()") : P ? ie && t.texSubImage2D(s.TEXTURE_2D, Q, 0, 0, he.width, he.height, re, Oe, he.data) : t.texImage2D(s.TEXTURE_2D, Q, we, he.width, he.height, 0, re, Oe, he.data);
}
else if (x.isDataArrayTexture)
if (P) {
@@ -22646,11 +22664,11 @@ function jv(s, e, t, i, r, n, a) {
const V = i.get(K);
if (K.version !== V.__version || X === !0) {
t.activeTexture(s.TEXTURE0 + B);
- const xe = Xe.getPrimaries(Xe.workingColorSpace), ne = x.colorSpace === $i ? null : Xe.getPrimaries(x.colorSpace), Se = x.colorSpace === $i || xe === ne ? s.NONE : s.BROWSER_DEFAULT_WEBGL;
+ const xe = Xe.getPrimaries(Xe.workingColorSpace), ne = x.colorSpace === Ji ? null : Xe.getPrimaries(x.colorSpace), Se = x.colorSpace === Ji || xe === ne ? s.NONE : s.BROWSER_DEFAULT_WEBGL;
s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL, x.flipY), s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL, x.premultiplyAlpha), s.pixelStorei(s.UNPACK_ALIGNMENT, x.unpackAlignment), s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL, Se);
const de = x.isCompressedTexture || x.image[0].isCompressedTexture, J = x.image[0] && x.image[0].isDataTexture, re = [];
for (let $ = 0; $ < 6; $++)
- !de && !J ? re[$] = v(x.image[$], !0, r.maxCubemapSize) : re[$] = J ? x.image[$].image : x.image[$], re[$] = Me(x, re[$]);
+ !de && !J ? re[$] = v(x.image[$], !0, r.maxCubemapSize) : re[$] = J ? x.image[$].image : x.image[$], re[$] = be(x, re[$]);
const Oe = re[0], we = n.convert(x.format, x.colorSpace), he = n.convert(x.type), Re = _(x.internalFormat, we, he, x.colorSpace), P = x.isVideoTexture !== !0, ae = V.__version === void 0 || X === !0, ie = K.dataReady;
let le = A(x, Oe);
ze(s.TEXTURE_CUBE_MAP, x);
@@ -22661,7 +22679,7 @@ function jv(s, e, t, i, r, n, a) {
Q = re[$].mipmaps;
for (let ve = 0; ve < Q.length; ve++) {
const Ae = Q[ve];
- x.format !== Kt ? we !== null ? P ? ie && t.compressedTexSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X + $, ve, 0, 0, Ae.width, Ae.height, we, Ae.data) : t.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X + $, ve, Re, Ae.width, Ae.height, 0, Ae.data) : be("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()") : P ? ie && t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X + $, ve, 0, 0, Ae.width, Ae.height, we, he, Ae.data) : t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X + $, ve, Re, Ae.width, Ae.height, 0, we, he, Ae.data);
+ x.format !== Kt ? we !== null ? P ? ie && t.compressedTexSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X + $, ve, 0, 0, Ae.width, Ae.height, we, Ae.data) : t.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X + $, ve, Re, Ae.width, Ae.height, 0, Ae.data) : Me("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()") : P ? ie && t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X + $, ve, 0, 0, Ae.width, Ae.height, we, he, Ae.data) : t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X + $, ve, Re, Ae.width, Ae.height, 0, we, he, Ae.data);
}
}
} else {
@@ -22719,7 +22737,7 @@ function jv(s, e, t, i, r, n, a) {
const X = B.__webglTexture, K = Qe(x);
if (x.depthTexture.format === ws)
fe(x) ? o.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER, s.DEPTH_ATTACHMENT, s.TEXTURE_2D, X, 0, K) : s.framebufferTexture2D(s.FRAMEBUFFER, s.DEPTH_ATTACHMENT, s.TEXTURE_2D, X, 0);
- else if (x.depthTexture.format === Yr)
+ else if (x.depthTexture.format === Kr)
fe(x) ? o.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER, s.DEPTH_STENCIL_ATTACHMENT, s.TEXTURE_2D, X, 0, K) : s.framebufferTexture2D(s.FRAMEBUFFER, s.DEPTH_STENCIL_ATTACHMENT, s.TEXTURE_2D, X, 0);
else
throw new Error("Unknown depthTexture format");
@@ -22882,9 +22900,9 @@ function jv(s, e, t, i, r, n, a) {
const x = a.render.frame;
h.get(C) !== x && (h.set(C, x), C.update());
}
- function Me(C, x) {
+ function be(C, x) {
const B = C.colorSpace, X = C.format, K = C.type;
- return C.isCompressedTexture === !0 || C.isVideoTexture === !0 || B !== Nt && B !== $i && (Xe.getTransfer(B) === et ? (X !== Kt || K !== mi) && be("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.") : He("WebGLTextures: Unsupported texture color space:", B)), x;
+ return C.isCompressedTexture === !0 || C.isVideoTexture === !0 || B !== Ot && B !== Ji && (Xe.getTransfer(B) === et ? (X !== Kt || K !== mi) && Me("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.") : He("WebGLTextures: Unsupported texture color space:", B)), x;
}
function De(C) {
return typeof HTMLImageElement < "u" && C instanceof HTMLImageElement ? (c.width = C.naturalWidth || C.width, c.height = C.naturalHeight || C.height) : typeof VideoFrame < "u" && C instanceof VideoFrame ? (c.width = C.displayWidth, c.height = C.displayHeight) : (c.width = C.width, c.height = C.height), c;
@@ -22892,7 +22910,7 @@ function jv(s, e, t, i, r, n, a) {
this.allocateTextureUnit = z, this.resetTextureUnits = N, this.setTexture2D = j, this.setTexture2DArray = q, this.setTexture3D = te, this.setTextureCube = G, this.rebindTextures = Je, this.setupRenderTarget = je, this.updateRenderTargetMipmap = Ve, this.updateMultisampleRenderTarget = We, this.setupDepthRenderbuffer = Ee, this.setupFrameBufferTexture = ue, this.useMultisampledRTT = fe;
}
function Xv(s, e) {
- function t(i, r = $i) {
+ function t(i, r = Ji) {
let n;
const a = Xe.getTransfer(r);
if (i === mi) return s.UNSIGNED_BYTE;
@@ -22911,7 +22929,7 @@ function Xv(s, e) {
if (i === ih) return s.RGB;
if (i === Kt) return s.RGBA;
if (i === ws) return s.DEPTH_COMPONENT;
- if (i === Yr) return s.DEPTH_STENCIL;
+ if (i === Kr) return s.DEPTH_STENCIL;
if (i === Lo) return s.RED;
if (i === Io) return s.RED_INTEGER;
if (i === Uo) return s.RG;
@@ -22980,7 +22998,7 @@ function Xv(s, e) {
if (i === uo) return n.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;
} else
return null;
- return i === qr ? s.UNSIGNED_INT_24_8 : s[i] !== void 0 ? s[i] : null;
+ return i === Yr ? s.UNSIGNED_INT_24_8 : s[i] !== void 0 ? s[i] : null;
}
return { convert: t };
}
@@ -23064,7 +23082,7 @@ class Kv {
return this.texture;
}
}
-class Zv extends _r {
+class Zv extends xr {
/**
* Constructs a new WebGL renderer.
*
@@ -23079,11 +23097,11 @@ class Zv extends _r {
let _ = null, E = null;
const A = [], S = [], R = new oe();
let I = null;
- const T = new bt();
+ const T = new Mt();
T.viewport = new $e();
- const b = new bt();
- b.viewport = new $e();
- const D = [T, b], N = new rp();
+ const M = new Mt();
+ M.viewport = new $e();
+ const D = [T, M], N = new rp();
let z = null, H = null;
this.cameraAutoUpdate = !0, this.enabled = !1, this.isPresenting = !1, this.getController = function(W) {
let Y = A[W];
@@ -23114,9 +23132,9 @@ class Zv extends _r {
e.setRenderTarget(_), f = null, d = null, u = null, r = null, E = null, Ze.stop(), i.isPresenting = !1, e.setPixelRatio(I), e.setSize(R.width, R.height, !1), i.dispatchEvent({ type: "sessionend" });
}
this.setFramebufferScaleFactor = function(W) {
- n = W, i.isPresenting === !0 && be("WebXRManager: Cannot change framebuffer scale while presenting.");
+ n = W, i.isPresenting === !0 && Me("WebXRManager: Cannot change framebuffer scale while presenting.");
}, this.setReferenceSpaceType = function(W) {
- o = W, i.isPresenting === !0 && be("WebXRManager: Cannot change reference space type while presenting.");
+ o = W, i.isPresenting === !0 && Me("WebXRManager: Cannot change reference space type while presenting.");
}, this.getReferenceSpace = function() {
return c || a;
}, this.setReferenceSpace = function(W) {
@@ -23133,7 +23151,7 @@ class Zv extends _r {
if (r = W, r !== null) {
if (_ = e.getRenderTarget(), r.addEventListener("select", j), r.addEventListener("selectstart", j), r.addEventListener("selectend", j), r.addEventListener("squeeze", j), r.addEventListener("squeezestart", j), r.addEventListener("squeezeend", j), r.addEventListener("end", q), r.addEventListener("inputsourceschange", te), y.xrCompatible !== !0 && await t.makeXRCompatible(), I = e.getPixelRatio(), e.getSize(R), v && "createProjectionLayer" in XRWebGLBinding.prototype) {
let Y = null, ue = null, Ce = null;
- y.depth && (Ce = y.stencil ? t.DEPTH24_STENCIL8 : t.DEPTH_COMPONENT24, Y = y.stencil ? Yr : ws, ue = y.stencil ? qr : mr);
+ y.depth && (Ce = y.stencil ? t.DEPTH24_STENCIL8 : t.DEPTH_COMPONENT24, Y = y.stencil ? Kr : ws, ue = y.stencil ? Yr : mr);
const Te = {
colorFormat: t.RGBA8,
depthFormat: Ce,
@@ -23208,11 +23226,11 @@ class Zv extends _r {
const G = new w(), Z = new w();
function se(W, Y, ue) {
G.setFromMatrixPosition(Y.matrixWorld), Z.setFromMatrixPosition(ue.matrixWorld);
- const Ce = G.distanceTo(Z), Te = Y.projectionMatrix.elements, Ee = ue.projectionMatrix.elements, Je = Te[14] / (Te[10] - 1), je = Te[14] / (Te[10] + 1), Ve = (Te[9] + 1) / Te[5], L = (Te[9] - 1) / Te[5], gt = (Te[8] - 1) / Te[0], We = (Ee[8] + 1) / Ee[0], Qe = Je * gt, fe = Je * We, at = Ce / (-gt + We), Me = at * -gt;
- if (Y.matrixWorld.decompose(W.position, W.quaternion, W.scale), W.translateX(Me), W.translateZ(at), W.matrixWorld.compose(W.position, W.quaternion, W.scale), W.matrixWorldInverse.copy(W.matrixWorld).invert(), Te[10] === -1)
+ const Ce = G.distanceTo(Z), Te = Y.projectionMatrix.elements, Ee = ue.projectionMatrix.elements, Je = Te[14] / (Te[10] - 1), je = Te[14] / (Te[10] + 1), Ve = (Te[9] + 1) / Te[5], L = (Te[9] - 1) / Te[5], gt = (Te[8] - 1) / Te[0], We = (Ee[8] + 1) / Ee[0], Qe = Je * gt, fe = Je * We, at = Ce / (-gt + We), be = at * -gt;
+ if (Y.matrixWorld.decompose(W.position, W.quaternion, W.scale), W.translateX(be), W.translateZ(at), W.matrixWorld.compose(W.position, W.quaternion, W.scale), W.matrixWorldInverse.copy(W.matrixWorld).invert(), Te[10] === -1)
W.projectionMatrix.copy(Y.projectionMatrix), W.projectionMatrixInverse.copy(Y.projectionMatrixInverse);
else {
- const De = Je + at, C = je + at, x = Qe - Me, B = fe + (Ce - Me), X = Ve * je / C * De, K = L * je / C * De;
+ const De = Je + at, C = je + at, x = Qe - be, B = fe + (Ce - be), X = Ve * je / C * De, K = L * je / C * De;
W.projectionMatrix.makePerspective(x, B, X, K, De, C), W.projectionMatrixInverse.copy(W.projectionMatrix).invert();
}
}
@@ -23222,18 +23240,18 @@ class Zv extends _r {
this.updateCamera = function(W) {
if (r === null) return;
let Y = W.near, ue = W.far;
- m.texture !== null && (m.depthNear > 0 && (Y = m.depthNear), m.depthFar > 0 && (ue = m.depthFar)), N.near = b.near = T.near = Y, N.far = b.far = T.far = ue, (z !== N.near || H !== N.far) && (r.updateRenderState({
+ m.texture !== null && (m.depthNear > 0 && (Y = m.depthNear), m.depthFar > 0 && (ue = m.depthFar)), N.near = M.near = T.near = Y, N.far = M.far = T.far = ue, (z !== N.near || H !== N.far) && (r.updateRenderState({
depthNear: N.near,
depthFar: N.far
- }), z = N.near, H = N.far), N.layers.mask = W.layers.mask | 6, T.layers.mask = N.layers.mask & 3, b.layers.mask = N.layers.mask & 5;
+ }), z = N.near, H = N.far), N.layers.mask = W.layers.mask | 6, T.layers.mask = N.layers.mask & 3, M.layers.mask = N.layers.mask & 5;
const Ce = W.parent, Te = N.cameras;
Pe(N, Ce);
for (let Ee = 0; Ee < Te.length; Ee++)
Pe(Te[Ee], Ce);
- Te.length === 2 ? se(N, T, b) : N.projectionMatrix.copy(T.projectionMatrix), ze(W, N, Ce);
+ Te.length === 2 ? se(N, T, M) : N.projectionMatrix.copy(T.projectionMatrix), ze(W, N, Ce);
};
function ze(W, Y, ue) {
- ue === null ? W.matrix.copy(Y.matrixWorld) : (W.matrix.copy(ue.matrixWorld), W.matrix.invert(), W.matrix.multiply(Y.matrixWorld)), W.matrix.decompose(W.position, W.quaternion, W.scale), W.updateMatrixWorld(!0), W.projectionMatrix.copy(Y.projectionMatrix), W.projectionMatrixInverse.copy(Y.projectionMatrixInverse), W.isPerspectiveCamera && (W.fov = Kr * 2 * Math.atan(1 / W.projectionMatrix.elements[5]), W.zoom = 1);
+ ue === null ? W.matrix.copy(Y.matrixWorld) : (W.matrix.copy(ue.matrixWorld), W.matrix.invert(), W.matrix.multiply(Y.matrixWorld)), W.matrix.decompose(W.position, W.quaternion, W.scale), W.updateMatrixWorld(!0), W.projectionMatrix.copy(Y.projectionMatrix), W.projectionMatrixInverse.copy(Y.projectionMatrixInverse), W.isPerspectiveCamera && (W.fov = Zr * 2 * Math.atan(1 / W.projectionMatrix.elements[5]), W.zoom = 1);
}
this.getCamera = function() {
return N;
@@ -23270,7 +23288,7 @@ class Zv extends _r {
), e.setRenderTarget(E));
}
let Ve = D[Ee];
- Ve === void 0 && (Ve = new bt(), Ve.layers.enable(Ee), Ve.viewport = new $e(), D[Ee] = Ve), Ve.matrix.fromArray(Je.transform.matrix), Ve.matrix.decompose(Ve.position, Ve.quaternion, Ve.scale), Ve.projectionMatrix.fromArray(Je.projectionMatrix), Ve.projectionMatrixInverse.copy(Ve.projectionMatrix).invert(), Ve.viewport.set(je.x, je.y, je.width, je.height), Ee === 0 && (N.matrix.copy(Ve.matrix), N.matrix.decompose(N.position, N.quaternion, N.scale)), Ce === !0 && N.cameras.push(Ve);
+ Ve === void 0 && (Ve = new Mt(), Ve.layers.enable(Ee), Ve.viewport = new $e(), D[Ee] = Ve), Ve.matrix.fromArray(Je.transform.matrix), Ve.matrix.decompose(Ve.position, Ve.quaternion, Ve.scale), Ve.projectionMatrix.fromArray(Je.projectionMatrix), Ve.projectionMatrixInverse.copy(Ve.projectionMatrix).invert(), Ve.viewport.set(je.x, je.y, je.width, je.height), Ee === 0 && (N.matrix.copy(Ve.matrix), N.matrix.decompose(N.position, N.quaternion, N.scale)), Ce === !0 && N.cameras.push(Ve);
}
const Te = r.enabledFeatures;
if (Te && Te.includes("depth-sensing") && r.depthUsage == "gpu-optimized" && v) {
@@ -23388,7 +23406,7 @@ function Qv(s, e, t, i) {
s.bindBuffer(s.UNIFORM_BUFFER, _);
for (let S = 0, R = E.length; S < R; S++) {
const I = Array.isArray(E[S]) ? E[S] : [E[S]];
- for (let T = 0, b = I.length; T < b; T++) {
+ for (let T = 0, M = I.length; T < M; T++) {
const D = I[T];
if (f(D, S, T, A) === !0) {
const N = D.__offset, z = Array.isArray(D.value) ? D.value : [D.value];
@@ -23423,8 +23441,8 @@ function Qv(s, e, t, i) {
const A = 16;
for (let R = 0, I = _.length; R < I; R++) {
const T = Array.isArray(_[R]) ? _[R] : [_[R]];
- for (let b = 0, D = T.length; b < D; b++) {
- const N = T[b], z = Array.isArray(N.value) ? N.value : [N.value];
+ for (let M = 0, D = T.length; M < D; M++) {
+ const N = T[M], z = Array.isArray(N.value) ? N.value : [N.value];
for (let H = 0, j = z.length; H < j; H++) {
const q = z[H], te = v(q), G = E % A, Z = G % te.boundary, se = G + Z;
E += Z, se !== 0 && A - se < te.storage && (E += A - se), N.__data = new Float32Array(te.storage / Float32Array.BYTES_PER_ELEMENT), N.__offset = E, E += te.storage;
@@ -23441,7 +23459,7 @@ function Qv(s, e, t, i) {
storage: 0
// bytes
};
- return typeof y == "number" || typeof y == "boolean" ? (_.boundary = 4, _.storage = 4) : y.isVector2 ? (_.boundary = 8, _.storage = 8) : y.isVector3 || y.isColor ? (_.boundary = 16, _.storage = 12) : y.isVector4 ? (_.boundary = 16, _.storage = 16) : y.isMatrix3 ? (_.boundary = 48, _.storage = 48) : y.isMatrix4 ? (_.boundary = 64, _.storage = 64) : y.isTexture ? be("WebGLRenderer: Texture samplers can not be part of an uniforms group.") : be("WebGLRenderer: Unsupported uniform value type.", y), _;
+ return typeof y == "number" || typeof y == "boolean" ? (_.boundary = 4, _.storage = 4) : y.isVector2 ? (_.boundary = 8, _.storage = 8) : y.isVector3 || y.isColor ? (_.boundary = 16, _.storage = 12) : y.isVector4 ? (_.boundary = 16, _.storage = 16) : y.isMatrix3 ? (_.boundary = 48, _.storage = 48) : y.isMatrix4 ? (_.boundary = 64, _.storage = 64) : y.isTexture ? Me("WebGLRenderer: Texture samplers can not be part of an uniforms group.") : Me("WebGLRenderer: Unsupported uniform value type.", y), _;
}
function m(y) {
const _ = y.target;
@@ -25510,9 +25528,9 @@ const e0 = new Uint16Array([
13623,
839
]);
-let Bi = null;
+let ki = null;
function t0() {
- return Bi === null && (Bi = new rs(e0, 32, 32, Uo, mt), Bi.minFilter = yt, Bi.magFilter = yt, Bi.wrapS = Qt, Bi.wrapT = Qt, Bi.generateMipmaps = !1, Bi.needsUpdate = !0), Bi;
+ return ki === null && (ki = new rs(e0, 32, 32, Uo, mt), ki.minFilter = yt, ki.magFilter = yt, ki.wrapS = Qt, ki.wrapT = Qt, ki.generateMipmaps = !1, ki.needsUpdate = !0), ki;
}
class Pn {
/**
@@ -25550,7 +25568,7 @@ class Pn {
mi,
mr,
Es,
- qr,
+ Yr,
Po,
Do
]), m = new Uint32Array(4), p = new Int32Array(4);
@@ -25567,11 +25585,11 @@ class Pn {
* @type {?Function}
*/
onShaderError: null
- }, this.autoClear = !0, this.autoClearColor = !0, this.autoClearDepth = !0, this.autoClearStencil = !0, this.sortObjects = !0, this.clippingPlanes = [], this.localClippingEnabled = !1, this.toneMapping = er, this.toneMappingExposure = 1, this.transmissionResolutionScale = 1;
+ }, this.autoClear = !0, this.autoClearColor = !0, this.autoClearDepth = !0, this.autoClearStencil = !0, this.sortObjects = !0, this.clippingPlanes = [], this.localClippingEnabled = !1, this.toneMapping = tr, this.toneMappingExposure = 1, this.transmissionResolutionScale = 1;
const S = this;
let R = !1;
this._outputColorSpace = Ct;
- let I = 0, T = 0, b = null, D = -1, N = null;
+ let I = 0, T = 0, M = null, D = -1, N = null;
const z = new $e(), H = new $e();
let j = null;
const q = new _e(0);
@@ -25583,14 +25601,14 @@ class Pn {
const Ce = new Ue(), Te = new w(), Ee = new $e(), Je = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: !0 };
let je = !1;
function Ve() {
- return b === null ? se : 1;
+ return M === null ? se : 1;
}
let L = i;
- function gt(M, O) {
- return t.getContext(M, O);
+ function gt(b, O) {
+ return t.getContext(b, O);
}
try {
- const M = {
+ const b = {
alpha: !0,
depth: r,
stencil: n,
@@ -25602,15 +25620,15 @@ class Pn {
};
if ("setAttribute" in t && t.setAttribute("data-engine", "three.js r181"), t.addEventListener("webglcontextlost", Q, !1), t.addEventListener("webglcontextrestored", $, !1), t.addEventListener("webglcontextcreationerror", ve, !1), L === null) {
const O = "webgl2";
- if (L = gt(O, M), L === null)
+ if (L = gt(O, b), L === null)
throw gt(O) ? new Error("Error creating WebGL context with your selected attributes.") : new Error("Error creating WebGL context.");
}
- } catch (M) {
- throw M("WebGLRenderer: " + M.message), M;
+ } catch (b) {
+ throw b("WebGLRenderer: " + b.message), b;
}
- let We, Qe, fe, at, Me, De, C, x, B, X, K, V, xe, ne, Se, de, J, re, Oe, we, he, Re, P, ae;
+ let We, Qe, fe, at, be, De, C, x, B, X, K, V, xe, ne, Se, de, J, re, Oe, we, he, Re, P, ae;
function ie() {
- We = new hg(L), We.init(), Re = new Xv(L, We), Qe = new tg(L, We, e, Re), fe = new Wv(L, We), Qe.reversedDepthBuffer && d && fe.buffers.depth.setReversed(!0), at = new pg(L), Me = new Dv(), De = new jv(L, We, fe, Me, Qe, Re, at), C = new rg(S), x = new cg(S), B = new gp(L), P = new Qm(L, B), X = new ug(L, B, at, P), K = new mg(L, X, B, at), Oe = new fg(L, Qe, De), de = new ig(Me), V = new Pv(S, C, x, We, Qe, P, de), xe = new Jv(S, Me), ne = new Iv(), Se = new kv(We), re = new Jm(S, C, x, fe, K, f, l), J = new Vv(S, K, Qe), ae = new Qv(L, at, Qe, fe), we = new eg(L, We, at), he = new dg(L, We, at), at.programs = V.programs, S.capabilities = Qe, S.extensions = We, S.properties = Me, S.renderLists = ne, S.shadowMap = J, S.state = fe, S.info = at;
+ We = new hg(L), We.init(), Re = new Xv(L, We), Qe = new tg(L, We, e, Re), fe = new Wv(L, We), Qe.reversedDepthBuffer && d && fe.buffers.depth.setReversed(!0), at = new pg(L), be = new Dv(), De = new jv(L, We, fe, be, Qe, Re, at), C = new rg(S), x = new cg(S), B = new gp(L), P = new Qm(L, B), X = new ug(L, B, at, P), K = new mg(L, X, B, at), Oe = new fg(L, Qe, De), de = new ig(be), V = new Pv(S, C, x, We, Qe, P, de), xe = new Jv(S, be), ne = new Iv(), Se = new kv(We), re = new Jm(S, C, x, fe, K, f, l), J = new Vv(S, K, Qe), ae = new Qv(L, at, Qe, fe), we = new eg(L, We, at), he = new dg(L, We, at), at.programs = V.programs, S.capabilities = Qe, S.extensions = We, S.properties = be, S.renderLists = ne, S.shadowMap = J, S.state = fe, S.info = at;
}
ie();
const le = new Zv(S, L);
@@ -25619,63 +25637,63 @@ class Pn {
}, this.getContextAttributes = function() {
return L.getContextAttributes();
}, this.forceContextLoss = function() {
- const M = We.get("WEBGL_lose_context");
- M && M.loseContext();
+ const b = We.get("WEBGL_lose_context");
+ b && b.loseContext();
}, this.forceContextRestore = function() {
- const M = We.get("WEBGL_lose_context");
- M && M.restoreContext();
+ const b = We.get("WEBGL_lose_context");
+ b && b.restoreContext();
}, this.getPixelRatio = function() {
return se;
- }, this.setPixelRatio = function(M) {
- M !== void 0 && (se = M, this.setSize(G, Z, !1));
- }, this.getSize = function(M) {
- return M.set(G, Z);
- }, this.setSize = function(M, O, F = !0) {
+ }, this.setPixelRatio = function(b) {
+ b !== void 0 && (se = b, this.setSize(G, Z, !1));
+ }, this.getSize = function(b) {
+ return b.set(G, Z);
+ }, this.setSize = function(b, O, F = !0) {
if (le.isPresenting) {
- be("WebGLRenderer: Can't change size while VR device is presenting.");
+ Me("WebGLRenderer: Can't change size while VR device is presenting.");
return;
}
- G = M, Z = O, t.width = Math.floor(M * se), t.height = Math.floor(O * se), F === !0 && (t.style.width = M + "px", t.style.height = O + "px"), this.setViewport(0, 0, M, O);
- }, this.getDrawingBufferSize = function(M) {
- return M.set(G * se, Z * se).floor();
- }, this.setDrawingBufferSize = function(M, O, F) {
- G = M, Z = O, se = F, t.width = Math.floor(M * F), t.height = Math.floor(O * F), this.setViewport(0, 0, M, O);
- }, this.getCurrentViewport = function(M) {
- return M.copy(z);
- }, this.getViewport = function(M) {
- return M.copy(qe);
- }, this.setViewport = function(M, O, F, k) {
- M.isVector4 ? qe.set(M.x, M.y, M.z, M.w) : qe.set(M, O, F, k), fe.viewport(z.copy(qe).multiplyScalar(se).round());
- }, this.getScissor = function(M) {
- return M.copy(Ke);
- }, this.setScissor = function(M, O, F, k) {
- M.isVector4 ? Ke.set(M.x, M.y, M.z, M.w) : Ke.set(M, O, F, k), fe.scissor(H.copy(Ke).multiplyScalar(se).round());
+ G = b, Z = O, t.width = Math.floor(b * se), t.height = Math.floor(O * se), F === !0 && (t.style.width = b + "px", t.style.height = O + "px"), this.setViewport(0, 0, b, O);
+ }, this.getDrawingBufferSize = function(b) {
+ return b.set(G * se, Z * se).floor();
+ }, this.setDrawingBufferSize = function(b, O, F) {
+ G = b, Z = O, se = F, t.width = Math.floor(b * F), t.height = Math.floor(O * F), this.setViewport(0, 0, b, O);
+ }, this.getCurrentViewport = function(b) {
+ return b.copy(z);
+ }, this.getViewport = function(b) {
+ return b.copy(qe);
+ }, this.setViewport = function(b, O, F, k) {
+ b.isVector4 ? qe.set(b.x, b.y, b.z, b.w) : qe.set(b, O, F, k), fe.viewport(z.copy(qe).multiplyScalar(se).round());
+ }, this.getScissor = function(b) {
+ return b.copy(Ke);
+ }, this.setScissor = function(b, O, F, k) {
+ b.isVector4 ? Ke.set(b.x, b.y, b.z, b.w) : Ke.set(b, O, F, k), fe.scissor(H.copy(Ke).multiplyScalar(se).round());
}, this.getScissorTest = function() {
return Ze;
- }, this.setScissorTest = function(M) {
- fe.setScissorTest(Ze = M);
- }, this.setOpaqueSort = function(M) {
- Pe = M;
- }, this.setTransparentSort = function(M) {
- ze = M;
- }, this.getClearColor = function(M) {
- return M.copy(re.getClearColor());
+ }, this.setScissorTest = function(b) {
+ fe.setScissorTest(Ze = b);
+ }, this.setOpaqueSort = function(b) {
+ Pe = b;
+ }, this.setTransparentSort = function(b) {
+ ze = b;
+ }, this.getClearColor = function(b) {
+ return b.copy(re.getClearColor());
}, this.setClearColor = function() {
re.setClearColor(...arguments);
}, this.getClearAlpha = function() {
return re.getClearAlpha();
}, this.setClearAlpha = function() {
re.setClearAlpha(...arguments);
- }, this.clear = function(M = !0, O = !0, F = !0) {
+ }, this.clear = function(b = !0, O = !0, F = !0) {
let k = 0;
- if (M) {
+ if (b) {
let U = !1;
- if (b !== null) {
- const ee = b.texture.format;
+ if (M !== null) {
+ const ee = M.texture.format;
U = g.has(ee);
}
if (U) {
- const ee = b.texture.type, pe = v.has(ee), me = re.getClearColor(), ge = re.getClearAlpha(), Le = me.r, Ne = me.g, Ie = me.b;
+ const ee = M.texture.type, pe = v.has(ee), me = re.getClearColor(), ge = re.getClearAlpha(), Le = me.r, Ne = me.g, Ie = me.b;
pe ? (m[0] = Le, m[1] = Ne, m[2] = Ie, m[3] = ge, L.clearBufferuiv(L.COLOR, 0, m)) : (p[0] = Le, p[1] = Ne, p[2] = Ie, p[3] = ge, L.clearBufferiv(L.COLOR, 0, p));
} else
k |= L.COLOR_BUFFER_BIT;
@@ -25688,35 +25706,35 @@ class Pn {
}, this.clearStencil = function() {
this.clear(!1, !1, !0);
}, this.dispose = function() {
- t.removeEventListener("webglcontextlost", Q, !1), t.removeEventListener("webglcontextrestored", $, !1), t.removeEventListener("webglcontextcreationerror", ve, !1), re.dispose(), ne.dispose(), Se.dispose(), Me.dispose(), C.dispose(), x.dispose(), K.dispose(), P.dispose(), ae.dispose(), V.dispose(), le.dispose(), le.removeEventListener("sessionstart", tl), le.removeEventListener("sessionend", il), nr.stop();
+ t.removeEventListener("webglcontextlost", Q, !1), t.removeEventListener("webglcontextrestored", $, !1), t.removeEventListener("webglcontextcreationerror", ve, !1), re.dispose(), ne.dispose(), Se.dispose(), be.dispose(), C.dispose(), x.dispose(), K.dispose(), P.dispose(), ae.dispose(), V.dispose(), le.dispose(), le.removeEventListener("sessionstart", tl), le.removeEventListener("sessionend", il), nr.stop();
};
- function Q(M) {
- M.preventDefault(), Cn("WebGLRenderer: Context Lost."), R = !0;
+ function Q(b) {
+ b.preventDefault(), Cn("WebGLRenderer: Context Lost."), R = !0;
}
function $() {
Cn("WebGLRenderer: Context Restored."), R = !1;
- const M = at.autoReset, O = J.enabled, F = J.autoUpdate, k = J.needsUpdate, U = J.type;
- ie(), at.autoReset = M, J.enabled = O, J.autoUpdate = F, J.needsUpdate = k, J.type = U;
+ const b = at.autoReset, O = J.enabled, F = J.autoUpdate, k = J.needsUpdate, U = J.type;
+ ie(), at.autoReset = b, J.enabled = O, J.autoUpdate = F, J.needsUpdate = k, J.type = U;
}
- function ve(M) {
- He("WebGLRenderer: A WebGL context could not be created. Reason: ", M.statusMessage);
+ function ve(b) {
+ He("WebGLRenderer: A WebGL context could not be created. Reason: ", b.statusMessage);
}
- function Ae(M) {
- const O = M.target;
+ function Ae(b) {
+ const O = b.target;
O.removeEventListener("dispose", Ae), Et(O);
}
- function Et(M) {
- rt(M), Me.remove(M);
+ function Et(b) {
+ rt(b), be.remove(b);
}
- function rt(M) {
- const O = Me.get(M).programs;
+ function rt(b) {
+ const O = be.get(b).programs;
O !== void 0 && (O.forEach(function(F) {
V.releaseProgram(F);
- }), M.isShaderMaterial && V.releaseShaderCache(M));
+ }), b.isShaderMaterial && V.releaseShaderCache(b));
}
- this.renderBufferDirect = function(M, O, F, k, U, ee) {
+ this.renderBufferDirect = function(b, O, F, k, U, ee) {
O === null && (O = Je);
- const pe = U.isMesh && U.matrixWorld.determinant() < 0, me = kh(M, O, F, k, U);
+ const pe = U.isMesh && U.matrixWorld.determinant() < 0, me = kh(b, O, F, k, U);
fe.setMaterial(k, pe);
let ge = F.index, Le = 1;
if (k.wireframe === !0) {
@@ -25742,9 +25760,9 @@ class Pn {
else if (We.get("WEBGL_multi_draw"))
lt.renderMultiDraw(U._multiDrawStarts, U._multiDrawCounts, U._multiDrawCount);
else {
- const ye = U._multiDrawStarts, Pt = U._multiDrawCounts, Pi = U._multiDrawCount, ri = ge ? B.get(ge).bytesPerElement : 1, xr = Me.get(k).currentProgram.getUniforms();
- for (let Xt = 0; Xt < Pi; Xt++)
- xr.setValue(L, "_gl_DrawID", Xt), lt.render(ye[Xt] / ri, Pt[Xt]);
+ const ye = U._multiDrawStarts, Pt = U._multiDrawCounts, Li = U._multiDrawCount, ri = ge ? B.get(ge).bytesPerElement : 1, yr = be.get(k).currentProgram.getUniforms();
+ for (let Xt = 0; Xt < Li; Xt++)
+ yr.setValue(L, "_gl_DrawID", Xt), lt.render(ye[Xt] / ri, Pt[Xt]);
}
else if (U.isInstancedMesh)
lt.renderInstances(Ye, pt, U.count);
@@ -25754,17 +25772,17 @@ class Pn {
} else
lt.render(Ye, pt);
};
- function xi(M, O, F) {
- M.transparent === !0 && M.side === Wt && M.forceSinglePass === !1 ? (M.side = zt, M.needsUpdate = !0, Os(M, O, F), M.side = Ei, M.needsUpdate = !0, Os(M, O, F), M.side = Wt) : Os(M, O, F);
+ function xi(b, O, F) {
+ b.transparent === !0 && b.side === Wt && b.forceSinglePass === !1 ? (b.side = zt, b.needsUpdate = !0, Os(b, O, F), b.side = Ci, b.needsUpdate = !0, Os(b, O, F), b.side = Wt) : Os(b, O, F);
}
- this.compile = function(M, O, F = null) {
- F === null && (F = M), _ = Se.get(F), _.init(O), A.push(_), F.traverseVisible(function(U) {
+ this.compile = function(b, O, F = null) {
+ F === null && (F = b), _ = Se.get(F), _.init(O), A.push(_), F.traverseVisible(function(U) {
U.isLight && U.layers.test(O.layers) && (_.pushLight(U), U.castShadow && _.pushShadow(U));
- }), M !== F && M.traverseVisible(function(U) {
+ }), b !== F && b.traverseVisible(function(U) {
U.isLight && U.layers.test(O.layers) && (_.pushLight(U), U.castShadow && _.pushShadow(U));
}), _.setupLights();
const k = /* @__PURE__ */ new Set();
- return M.traverse(function(U) {
+ return b.traverse(function(U) {
if (!(U.isMesh || U.isPoints || U.isLine || U.isSprite))
return;
const ee = U.material;
@@ -25777,14 +25795,14 @@ class Pn {
else
xi(ee, F, U), k.add(ee);
}), _ = A.pop(), k;
- }, this.compileAsync = function(M, O, F = null) {
- const k = this.compile(M, O, F);
+ }, this.compileAsync = function(b, O, F = null) {
+ const k = this.compile(b, O, F);
return new Promise((U) => {
function ee() {
if (k.forEach(function(pe) {
- Me.get(pe).currentProgram.isReady() && k.delete(pe);
+ be.get(pe).currentProgram.isReady() && k.delete(pe);
}), k.size === 0) {
- U(M);
+ U(b);
return;
}
setTimeout(ee, 10);
@@ -25793,8 +25811,8 @@ class Pn {
});
};
let ii = null;
- function Fh(M) {
- ii && ii(M);
+ function Fh(b) {
+ ii && ii(b);
}
function tl() {
nr.stop();
@@ -25803,73 +25821,73 @@ class Pn {
nr.start();
}
const nr = new Eh();
- nr.setAnimationLoop(Fh), typeof self < "u" && nr.setContext(self), this.setAnimationLoop = function(M) {
- ii = M, le.setAnimationLoop(M), M === null ? nr.stop() : nr.start();
- }, le.addEventListener("sessionstart", tl), le.addEventListener("sessionend", il), this.render = function(M, O) {
+ nr.setAnimationLoop(Fh), typeof self < "u" && nr.setContext(self), this.setAnimationLoop = function(b) {
+ ii = b, le.setAnimationLoop(b), b === null ? nr.stop() : nr.start();
+ }, le.addEventListener("sessionstart", tl), le.addEventListener("sessionend", il), this.render = function(b, O) {
if (O !== void 0 && O.isCamera !== !0) {
He("WebGLRenderer.render: camera is not an instance of THREE.Camera.");
return;
}
if (R === !0) return;
- if (M.matrixWorldAutoUpdate === !0 && M.updateMatrixWorld(), O.parent === null && O.matrixWorldAutoUpdate === !0 && O.updateMatrixWorld(), le.enabled === !0 && le.isPresenting === !0 && (le.cameraAutoUpdate === !0 && le.updateCamera(O), O = le.getCamera()), M.isScene === !0 && M.onBeforeRender(S, M, O, b), _ = Se.get(M, A.length), _.init(O), A.push(_), Ce.multiplyMatrices(O.projectionMatrix, O.matrixWorldInverse), W.setFromProjectionMatrix(Ce, Si, O.reversedDepth), ue = this.localClippingEnabled, Y = de.init(this.clippingPlanes, ue), y = ne.get(M, E.length), y.init(), E.push(y), le.enabled === !0 && le.isPresenting === !0) {
+ if (b.matrixWorldAutoUpdate === !0 && b.updateMatrixWorld(), O.parent === null && O.matrixWorldAutoUpdate === !0 && O.updateMatrixWorld(), le.enabled === !0 && le.isPresenting === !0 && (le.cameraAutoUpdate === !0 && le.updateCamera(O), O = le.getCamera()), b.isScene === !0 && b.onBeforeRender(S, b, O, M), _ = Se.get(b, A.length), _.init(O), A.push(_), Ce.multiplyMatrices(O.projectionMatrix, O.matrixWorldInverse), W.setFromProjectionMatrix(Ce, Si, O.reversedDepth), ue = this.localClippingEnabled, Y = de.init(this.clippingPlanes, ue), y = ne.get(b, E.length), y.init(), E.push(y), le.enabled === !0 && le.isPresenting === !0) {
const ee = S.xr.getDepthSensingMesh();
ee !== null && On(ee, O, -1 / 0, S.sortObjects);
}
- On(M, O, 0, S.sortObjects), y.finish(), S.sortObjects === !0 && y.sort(Pe, ze), je = le.enabled === !1 || le.isPresenting === !1 || le.hasDepthSensing() === !1, je && re.addToRenderList(y, M), this.info.render.frame++, Y === !0 && de.beginShadows();
+ On(b, O, 0, S.sortObjects), y.finish(), S.sortObjects === !0 && y.sort(Pe, ze), je = le.enabled === !1 || le.isPresenting === !1 || le.hasDepthSensing() === !1, je && re.addToRenderList(y, b), this.info.render.frame++, Y === !0 && de.beginShadows();
const F = _.state.shadowsArray;
- J.render(F, M, O), Y === !0 && de.endShadows(), this.info.autoReset === !0 && this.info.reset();
+ J.render(F, b, O), Y === !0 && de.endShadows(), this.info.autoReset === !0 && this.info.reset();
const k = y.opaque, U = y.transmissive;
if (_.setupLights(), O.isArrayCamera) {
const ee = O.cameras;
if (U.length > 0)
for (let pe = 0, me = ee.length; pe < me; pe++) {
const ge = ee[pe];
- sl(k, U, M, ge);
+ sl(k, U, b, ge);
}
- je && re.render(M);
+ je && re.render(b);
for (let pe = 0, me = ee.length; pe < me; pe++) {
const ge = ee[pe];
- rl(y, M, ge, ge.viewport);
+ rl(y, b, ge, ge.viewport);
}
} else
- U.length > 0 && sl(k, U, M, O), je && re.render(M), rl(y, M, O);
- b !== null && T === 0 && (De.updateMultisampleRenderTarget(b), De.updateRenderTargetMipmap(b)), M.isScene === !0 && M.onAfterRender(S, M, O), P.resetDefaultState(), D = -1, N = null, A.pop(), A.length > 0 ? (_ = A[A.length - 1], Y === !0 && de.setGlobalState(S.clippingPlanes, _.state.camera)) : _ = null, E.pop(), E.length > 0 ? y = E[E.length - 1] : y = null;
+ U.length > 0 && sl(k, U, b, O), je && re.render(b), rl(y, b, O);
+ M !== null && T === 0 && (De.updateMultisampleRenderTarget(M), De.updateRenderTargetMipmap(M)), b.isScene === !0 && b.onAfterRender(S, b, O), P.resetDefaultState(), D = -1, N = null, A.pop(), A.length > 0 ? (_ = A[A.length - 1], Y === !0 && de.setGlobalState(S.clippingPlanes, _.state.camera)) : _ = null, E.pop(), E.length > 0 ? y = E[E.length - 1] : y = null;
};
- function On(M, O, F, k) {
- if (M.visible === !1) return;
- if (M.layers.test(O.layers)) {
- if (M.isGroup)
- F = M.renderOrder;
- else if (M.isLOD)
- M.autoUpdate === !0 && M.update(O);
- else if (M.isLight)
- _.pushLight(M), M.castShadow && _.pushShadow(M);
- else if (M.isSprite) {
- if (!M.frustumCulled || W.intersectsSprite(M)) {
- k && Ee.setFromMatrixPosition(M.matrixWorld).applyMatrix4(Ce);
- const ee = K.update(M), pe = M.material;
- pe.visible && y.push(M, ee, pe, F, Ee.z, null);
+ function On(b, O, F, k) {
+ if (b.visible === !1) return;
+ if (b.layers.test(O.layers)) {
+ if (b.isGroup)
+ F = b.renderOrder;
+ else if (b.isLOD)
+ b.autoUpdate === !0 && b.update(O);
+ else if (b.isLight)
+ _.pushLight(b), b.castShadow && _.pushShadow(b);
+ else if (b.isSprite) {
+ if (!b.frustumCulled || W.intersectsSprite(b)) {
+ k && Ee.setFromMatrixPosition(b.matrixWorld).applyMatrix4(Ce);
+ const ee = K.update(b), pe = b.material;
+ pe.visible && y.push(b, ee, pe, F, Ee.z, null);
}
- } else if ((M.isMesh || M.isLine || M.isPoints) && (!M.frustumCulled || W.intersectsObject(M))) {
- const ee = K.update(M), pe = M.material;
- if (k && (M.boundingSphere !== void 0 ? (M.boundingSphere === null && M.computeBoundingSphere(), Ee.copy(M.boundingSphere.center)) : (ee.boundingSphere === null && ee.computeBoundingSphere(), Ee.copy(ee.boundingSphere.center)), Ee.applyMatrix4(M.matrixWorld).applyMatrix4(Ce)), Array.isArray(pe)) {
+ } else if ((b.isMesh || b.isLine || b.isPoints) && (!b.frustumCulled || W.intersectsObject(b))) {
+ const ee = K.update(b), pe = b.material;
+ if (k && (b.boundingSphere !== void 0 ? (b.boundingSphere === null && b.computeBoundingSphere(), Ee.copy(b.boundingSphere.center)) : (ee.boundingSphere === null && ee.computeBoundingSphere(), Ee.copy(ee.boundingSphere.center)), Ee.applyMatrix4(b.matrixWorld).applyMatrix4(Ce)), Array.isArray(pe)) {
const me = ee.groups;
for (let ge = 0, Le = me.length; ge < Le; ge++) {
const Ne = me[ge], Ie = pe[Ne.materialIndex];
- Ie && Ie.visible && y.push(M, ee, Ie, F, Ee.z, Ne);
+ Ie && Ie.visible && y.push(b, ee, Ie, F, Ee.z, Ne);
}
- } else pe.visible && y.push(M, ee, pe, F, Ee.z, null);
+ } else pe.visible && y.push(b, ee, pe, F, Ee.z, null);
}
}
- const U = M.children;
+ const U = b.children;
for (let ee = 0, pe = U.length; ee < pe; ee++)
On(U[ee], O, F, k);
}
- function rl(M, O, F, k) {
- const { opaque: U, transmissive: ee, transparent: pe } = M;
+ function rl(b, O, F, k) {
+ const { opaque: U, transmissive: ee, transparent: pe } = b;
_.setupLightsView(F), Y === !0 && de.setGlobalState(S.clippingPlanes, F), k && fe.viewport(z.copy(k)), U.length > 0 && Ns(U, O, F), ee.length > 0 && Ns(ee, O, F), pe.length > 0 && Ns(pe, O, F), fe.buffers.depth.setTest(!0), fe.buffers.depth.setMask(!0), fe.buffers.color.setMask(!0), fe.setPolygonOffset(!1);
}
- function sl(M, O, F, k) {
+ function sl(b, O, F, k) {
if ((F.isScene === !0 ? F.overrideMaterial : null) !== null)
return;
_.state.transmissionRenderTarget[k.id] === void 0 && (_.state.transmissionRenderTarget[k.id] = new xt(1, 1, {
@@ -25887,81 +25905,81 @@ class Pn {
const pe = S.getRenderTarget(), me = S.getActiveCubeFace(), ge = S.getActiveMipmapLevel();
S.setRenderTarget(U), S.getClearColor(q), te = S.getClearAlpha(), te < 1 && S.setClearColor(16777215, 0.5), S.clear(), je && re.render(F);
const Le = S.toneMapping;
- S.toneMapping = er;
+ S.toneMapping = tr;
const Ne = k.viewport;
- if (k.viewport !== void 0 && (k.viewport = void 0), _.setupLightsView(k), Y === !0 && de.setGlobalState(S.clippingPlanes, k), Ns(M, F, k), De.updateMultisampleRenderTarget(U), De.updateRenderTargetMipmap(U), We.has("WEBGL_multisampled_render_to_texture") === !1) {
+ if (k.viewport !== void 0 && (k.viewport = void 0), _.setupLightsView(k), Y === !0 && de.setGlobalState(S.clippingPlanes, k), Ns(b, F, k), De.updateMultisampleRenderTarget(U), De.updateRenderTargetMipmap(U), We.has("WEBGL_multisampled_render_to_texture") === !1) {
let Ie = !1;
for (let Ye = 0, ot = O.length; Ye < ot; Ye++) {
const pt = O[Ye], { object: ht, geometry: lt, material: ye, group: Pt } = pt;
if (ye.side === Wt && ht.layers.test(k.layers)) {
- const Pi = ye.side;
- ye.side = zt, ye.needsUpdate = !0, nl(ht, F, k, lt, ye, Pt), ye.side = Pi, ye.needsUpdate = !0, Ie = !0;
+ const Li = ye.side;
+ ye.side = zt, ye.needsUpdate = !0, nl(ht, F, k, lt, ye, Pt), ye.side = Li, ye.needsUpdate = !0, Ie = !0;
}
}
Ie === !0 && (De.updateMultisampleRenderTarget(U), De.updateRenderTargetMipmap(U));
}
S.setRenderTarget(pe, me, ge), S.setClearColor(q, te), Ne !== void 0 && (k.viewport = Ne), S.toneMapping = Le;
}
- function Ns(M, O, F) {
+ function Ns(b, O, F) {
const k = O.isScene === !0 ? O.overrideMaterial : null;
- for (let U = 0, ee = M.length; U < ee; U++) {
- const pe = M[U], { object: me, geometry: ge, group: Le } = pe;
+ for (let U = 0, ee = b.length; U < ee; U++) {
+ const pe = b[U], { object: me, geometry: ge, group: Le } = pe;
let Ne = pe.material;
Ne.allowOverride === !0 && k !== null && (Ne = k), me.layers.test(F.layers) && nl(me, O, F, ge, Ne, Le);
}
}
- function nl(M, O, F, k, U, ee) {
- M.onBeforeRender(S, O, F, k, U, ee), M.modelViewMatrix.multiplyMatrices(F.matrixWorldInverse, M.matrixWorld), M.normalMatrix.getNormalMatrix(M.modelViewMatrix), U.onBeforeRender(S, O, F, k, M, ee), U.transparent === !0 && U.side === Wt && U.forceSinglePass === !1 ? (U.side = zt, U.needsUpdate = !0, S.renderBufferDirect(F, O, k, U, M, ee), U.side = Ei, U.needsUpdate = !0, S.renderBufferDirect(F, O, k, U, M, ee), U.side = Wt) : S.renderBufferDirect(F, O, k, U, M, ee), M.onAfterRender(S, O, F, k, U, ee);
+ function nl(b, O, F, k, U, ee) {
+ b.onBeforeRender(S, O, F, k, U, ee), b.modelViewMatrix.multiplyMatrices(F.matrixWorldInverse, b.matrixWorld), b.normalMatrix.getNormalMatrix(b.modelViewMatrix), U.onBeforeRender(S, O, F, k, b, ee), U.transparent === !0 && U.side === Wt && U.forceSinglePass === !1 ? (U.side = zt, U.needsUpdate = !0, S.renderBufferDirect(F, O, k, U, b, ee), U.side = Ci, U.needsUpdate = !0, S.renderBufferDirect(F, O, k, U, b, ee), U.side = Wt) : S.renderBufferDirect(F, O, k, U, b, ee), b.onAfterRender(S, O, F, k, U, ee);
}
- function Os(M, O, F) {
+ function Os(b, O, F) {
O.isScene !== !0 && (O = Je);
- const k = Me.get(M), U = _.state.lights, ee = _.state.shadowsArray, pe = U.state.version, me = V.getParameters(M, U.state, ee, O, F), ge = V.getProgramCacheKey(me);
+ const k = be.get(b), U = _.state.lights, ee = _.state.shadowsArray, pe = U.state.version, me = V.getParameters(b, U.state, ee, O, F), ge = V.getProgramCacheKey(me);
let Le = k.programs;
- k.environment = M.isMeshStandardMaterial ? O.environment : null, k.fog = O.fog, k.envMap = (M.isMeshStandardMaterial ? x : C).get(M.envMap || k.environment), k.envMapRotation = k.environment !== null && M.envMap === null ? O.environmentRotation : M.envMapRotation, Le === void 0 && (M.addEventListener("dispose", Ae), Le = /* @__PURE__ */ new Map(), k.programs = Le);
+ k.environment = b.isMeshStandardMaterial ? O.environment : null, k.fog = O.fog, k.envMap = (b.isMeshStandardMaterial ? x : C).get(b.envMap || k.environment), k.envMapRotation = k.environment !== null && b.envMap === null ? O.environmentRotation : b.envMapRotation, Le === void 0 && (b.addEventListener("dispose", Ae), Le = /* @__PURE__ */ new Map(), k.programs = Le);
let Ne = Le.get(ge);
if (Ne !== void 0) {
if (k.currentProgram === Ne && k.lightsStateVersion === pe)
- return ol(M, me), Ne;
+ return ol(b, me), Ne;
} else
- me.uniforms = V.getUniforms(M), M.onBeforeCompile(me, S), Ne = V.acquireProgram(me, ge), Le.set(ge, Ne), k.uniforms = me.uniforms;
+ me.uniforms = V.getUniforms(b), b.onBeforeCompile(me, S), Ne = V.acquireProgram(me, ge), Le.set(ge, Ne), k.uniforms = me.uniforms;
const Ie = k.uniforms;
- return (!M.isShaderMaterial && !M.isRawShaderMaterial || M.clipping === !0) && (Ie.clippingPlanes = de.uniform), ol(M, me), k.needsLights = Hh(M), k.lightsStateVersion = pe, k.needsLights && (Ie.ambientLightColor.value = U.state.ambient, Ie.lightProbe.value = U.state.probe, Ie.directionalLights.value = U.state.directional, Ie.directionalLightShadows.value = U.state.directionalShadow, Ie.spotLights.value = U.state.spot, Ie.spotLightShadows.value = U.state.spotShadow, Ie.rectAreaLights.value = U.state.rectArea, Ie.ltc_1.value = U.state.rectAreaLTC1, Ie.ltc_2.value = U.state.rectAreaLTC2, Ie.pointLights.value = U.state.point, Ie.pointLightShadows.value = U.state.pointShadow, Ie.hemisphereLights.value = U.state.hemi, Ie.directionalShadowMap.value = U.state.directionalShadowMap, Ie.directionalShadowMatrix.value = U.state.directionalShadowMatrix, Ie.spotShadowMap.value = U.state.spotShadowMap, Ie.spotLightMatrix.value = U.state.spotLightMatrix, Ie.spotLightMap.value = U.state.spotLightMap, Ie.pointShadowMap.value = U.state.pointShadowMap, Ie.pointShadowMatrix.value = U.state.pointShadowMatrix), k.currentProgram = Ne, k.uniformsList = null, Ne;
+ return (!b.isShaderMaterial && !b.isRawShaderMaterial || b.clipping === !0) && (Ie.clippingPlanes = de.uniform), ol(b, me), k.needsLights = Hh(b), k.lightsStateVersion = pe, k.needsLights && (Ie.ambientLightColor.value = U.state.ambient, Ie.lightProbe.value = U.state.probe, Ie.directionalLights.value = U.state.directional, Ie.directionalLightShadows.value = U.state.directionalShadow, Ie.spotLights.value = U.state.spot, Ie.spotLightShadows.value = U.state.spotShadow, Ie.rectAreaLights.value = U.state.rectArea, Ie.ltc_1.value = U.state.rectAreaLTC1, Ie.ltc_2.value = U.state.rectAreaLTC2, Ie.pointLights.value = U.state.point, Ie.pointLightShadows.value = U.state.pointShadow, Ie.hemisphereLights.value = U.state.hemi, Ie.directionalShadowMap.value = U.state.directionalShadowMap, Ie.directionalShadowMatrix.value = U.state.directionalShadowMatrix, Ie.spotShadowMap.value = U.state.spotShadowMap, Ie.spotLightMatrix.value = U.state.spotLightMatrix, Ie.spotLightMap.value = U.state.spotLightMap, Ie.pointShadowMap.value = U.state.pointShadowMap, Ie.pointShadowMatrix.value = U.state.pointShadowMatrix), k.currentProgram = Ne, k.uniformsList = null, Ne;
}
- function al(M) {
- if (M.uniformsList === null) {
- const O = M.currentProgram.getUniforms();
- M.uniformsList = Mn.seqWithValue(O.seq, M.uniforms);
+ function al(b) {
+ if (b.uniformsList === null) {
+ const O = b.currentProgram.getUniforms();
+ b.uniformsList = bn.seqWithValue(O.seq, b.uniforms);
}
- return M.uniformsList;
+ return b.uniformsList;
}
- function ol(M, O) {
- const F = Me.get(M);
+ function ol(b, O) {
+ const F = be.get(b);
F.outputColorSpace = O.outputColorSpace, F.batching = O.batching, F.batchingColor = O.batchingColor, F.instancing = O.instancing, F.instancingColor = O.instancingColor, F.instancingMorph = O.instancingMorph, F.skinning = O.skinning, F.morphTargets = O.morphTargets, F.morphNormals = O.morphNormals, F.morphColors = O.morphColors, F.morphTargetsCount = O.morphTargetsCount, F.numClippingPlanes = O.numClippingPlanes, F.numIntersection = O.numClipIntersection, F.vertexAlphas = O.vertexAlphas, F.vertexTangents = O.vertexTangents, F.toneMapping = O.toneMapping;
}
- function kh(M, O, F, k, U) {
+ function kh(b, O, F, k, U) {
O.isScene !== !0 && (O = Je), De.resetTextureUnits();
- const ee = O.fog, pe = k.isMeshStandardMaterial ? O.environment : null, me = b === null ? S.outputColorSpace : b.isXRRenderTarget === !0 ? b.texture.colorSpace : Nt, ge = (k.isMeshStandardMaterial ? x : C).get(k.envMap || pe), Le = k.vertexColors === !0 && !!F.attributes.color && F.attributes.color.itemSize === 4, Ne = !!F.attributes.tangent && (!!k.normalMap || k.anisotropy > 0), Ie = !!F.morphAttributes.position, Ye = !!F.morphAttributes.normal, ot = !!F.morphAttributes.color;
- let pt = er;
- k.toneMapped && (b === null || b.isXRRenderTarget === !0) && (pt = S.toneMapping);
- const ht = F.morphAttributes.position || F.morphAttributes.normal || F.morphAttributes.color, lt = ht !== void 0 ? ht.length : 0, ye = Me.get(k), Pt = _.state.lights;
- if (Y === !0 && (ue === !0 || M !== N)) {
- const Dt = M === N && k.id === D;
- de.setState(k, M, Dt);
+ const ee = O.fog, pe = k.isMeshStandardMaterial ? O.environment : null, me = M === null ? S.outputColorSpace : M.isXRRenderTarget === !0 ? M.texture.colorSpace : Ot, ge = (k.isMeshStandardMaterial ? x : C).get(k.envMap || pe), Le = k.vertexColors === !0 && !!F.attributes.color && F.attributes.color.itemSize === 4, Ne = !!F.attributes.tangent && (!!k.normalMap || k.anisotropy > 0), Ie = !!F.morphAttributes.position, Ye = !!F.morphAttributes.normal, ot = !!F.morphAttributes.color;
+ let pt = tr;
+ k.toneMapped && (M === null || M.isXRRenderTarget === !0) && (pt = S.toneMapping);
+ const ht = F.morphAttributes.position || F.morphAttributes.normal || F.morphAttributes.color, lt = ht !== void 0 ? ht.length : 0, ye = be.get(k), Pt = _.state.lights;
+ if (Y === !0 && (ue === !0 || b !== N)) {
+ const Dt = b === N && k.id === D;
+ de.setState(k, b, Dt);
}
- let Pi = !1;
- k.version === ye.__version ? (ye.needsLights && ye.lightsStateVersion !== Pt.state.version || ye.outputColorSpace !== me || U.isBatchedMesh && ye.batching === !1 || !U.isBatchedMesh && ye.batching === !0 || U.isBatchedMesh && ye.batchingColor === !0 && U.colorTexture === null || U.isBatchedMesh && ye.batchingColor === !1 && U.colorTexture !== null || U.isInstancedMesh && ye.instancing === !1 || !U.isInstancedMesh && ye.instancing === !0 || U.isSkinnedMesh && ye.skinning === !1 || !U.isSkinnedMesh && ye.skinning === !0 || U.isInstancedMesh && ye.instancingColor === !0 && U.instanceColor === null || U.isInstancedMesh && ye.instancingColor === !1 && U.instanceColor !== null || U.isInstancedMesh && ye.instancingMorph === !0 && U.morphTexture === null || U.isInstancedMesh && ye.instancingMorph === !1 && U.morphTexture !== null || ye.envMap !== ge || k.fog === !0 && ye.fog !== ee || ye.numClippingPlanes !== void 0 && (ye.numClippingPlanes !== de.numPlanes || ye.numIntersection !== de.numIntersection) || ye.vertexAlphas !== Le || ye.vertexTangents !== Ne || ye.morphTargets !== Ie || ye.morphNormals !== Ye || ye.morphColors !== ot || ye.toneMapping !== pt || ye.morphTargetsCount !== lt) && (Pi = !0) : (Pi = !0, ye.__version = k.version);
+ let Li = !1;
+ k.version === ye.__version ? (ye.needsLights && ye.lightsStateVersion !== Pt.state.version || ye.outputColorSpace !== me || U.isBatchedMesh && ye.batching === !1 || !U.isBatchedMesh && ye.batching === !0 || U.isBatchedMesh && ye.batchingColor === !0 && U.colorTexture === null || U.isBatchedMesh && ye.batchingColor === !1 && U.colorTexture !== null || U.isInstancedMesh && ye.instancing === !1 || !U.isInstancedMesh && ye.instancing === !0 || U.isSkinnedMesh && ye.skinning === !1 || !U.isSkinnedMesh && ye.skinning === !0 || U.isInstancedMesh && ye.instancingColor === !0 && U.instanceColor === null || U.isInstancedMesh && ye.instancingColor === !1 && U.instanceColor !== null || U.isInstancedMesh && ye.instancingMorph === !0 && U.morphTexture === null || U.isInstancedMesh && ye.instancingMorph === !1 && U.morphTexture !== null || ye.envMap !== ge || k.fog === !0 && ye.fog !== ee || ye.numClippingPlanes !== void 0 && (ye.numClippingPlanes !== de.numPlanes || ye.numIntersection !== de.numIntersection) || ye.vertexAlphas !== Le || ye.vertexTangents !== Ne || ye.morphTargets !== Ie || ye.morphNormals !== Ye || ye.morphColors !== ot || ye.toneMapping !== pt || ye.morphTargetsCount !== lt) && (Li = !0) : (Li = !0, ye.__version = k.version);
let ri = ye.currentProgram;
- Pi === !0 && (ri = Os(k, O, U));
- let xr = !1, Xt = !1, os = !1;
+ Li === !0 && (ri = Os(k, O, U));
+ let yr = !1, Xt = !1, os = !1;
const ut = ri.getUniforms(), Vt = ye.uniforms;
- if (fe.useProgram(ri.program) && (xr = !0, Xt = !0, os = !0), k.id !== D && (D = k.id, Xt = !0), xr || N !== M) {
- fe.buffers.depth.getReversed() && M.reversedDepth !== !0 && (M._reversedDepth = !0, M.updateProjectionMatrix()), ut.setValue(L, "projectionMatrix", M.projectionMatrix), ut.setValue(L, "viewMatrix", M.matrixWorldInverse);
+ if (fe.useProgram(ri.program) && (yr = !0, Xt = !0, os = !0), k.id !== D && (D = k.id, Xt = !0), yr || N !== b) {
+ fe.buffers.depth.getReversed() && b.reversedDepth !== !0 && (b._reversedDepth = !0, b.updateProjectionMatrix()), ut.setValue(L, "projectionMatrix", b.projectionMatrix), ut.setValue(L, "viewMatrix", b.matrixWorldInverse);
const Dt = ut.map.cameraPosition;
- Dt !== void 0 && Dt.setValue(L, Te.setFromMatrixPosition(M.matrixWorld)), Qe.logarithmicDepthBuffer && ut.setValue(
+ Dt !== void 0 && Dt.setValue(L, Te.setFromMatrixPosition(b.matrixWorld)), Qe.logarithmicDepthBuffer && ut.setValue(
L,
"logDepthBufFC",
- 2 / (Math.log(M.far + 1) / Math.LN2)
- ), (k.isMeshPhongMaterial || k.isMeshToonMaterial || k.isMeshLambertMaterial || k.isMeshBasicMaterial || k.isMeshStandardMaterial || k.isShaderMaterial) && ut.setValue(L, "isOrthographic", M.isOrthographicCamera === !0), N !== M && (N = M, Xt = !0, os = !0);
+ 2 / (Math.log(b.far + 1) / Math.LN2)
+ ), (k.isMeshPhongMaterial || k.isMeshToonMaterial || k.isMeshLambertMaterial || k.isMeshBasicMaterial || k.isMeshStandardMaterial || k.isShaderMaterial) && ut.setValue(L, "isOrthographic", b.isOrthographicCamera === !0), N !== b && (N = b, Xt = !0, os = !0);
}
if (U.isSkinnedMesh) {
ut.setOptional(L, U, "bindMatrix"), ut.setOptional(L, U, "bindMatrixInverse");
@@ -25970,7 +25988,7 @@ class Pn {
}
U.isBatchedMesh && (ut.setOptional(L, U, "batchingTexture"), ut.setValue(L, "batchingTexture", U._matricesTexture, De), ut.setOptional(L, U, "batchingIdTexture"), ut.setValue(L, "batchingIdTexture", U._indirectTexture, De), ut.setOptional(L, U, "batchingColorTexture"), U._colorsTexture !== null && ut.setValue(L, "batchingColorTexture", U._colorsTexture, De));
const Zt = F.morphAttributes;
- if ((Zt.position !== void 0 || Zt.normal !== void 0 || Zt.color !== void 0) && Oe.update(U, F, ri), (Xt || ye.receiveShadow !== U.receiveShadow) && (ye.receiveShadow = U.receiveShadow, ut.setValue(L, "receiveShadow", U.receiveShadow)), k.isMeshGouraudMaterial && k.envMap !== null && (Vt.envMap.value = ge, Vt.flipEnvMap.value = ge.isCubeTexture && ge.isRenderTargetTexture === !1 ? -1 : 1), k.isMeshStandardMaterial && k.envMap === null && O.environment !== null && (Vt.envMapIntensity.value = O.environmentIntensity), Vt.dfgLUT !== void 0 && (Vt.dfgLUT.value = t0()), Xt && (ut.setValue(L, "toneMappingExposure", S.toneMappingExposure), ye.needsLights && zh(Vt, os), ee && k.fog === !0 && xe.refreshFogUniforms(Vt, ee), xe.refreshMaterialUniforms(Vt, k, se, Z, _.state.transmissionRenderTarget[M.id]), Mn.upload(L, al(ye), Vt, De)), k.isShaderMaterial && k.uniformsNeedUpdate === !0 && (Mn.upload(L, al(ye), Vt, De), k.uniformsNeedUpdate = !1), k.isSpriteMaterial && ut.setValue(L, "center", U.center), ut.setValue(L, "modelViewMatrix", U.modelViewMatrix), ut.setValue(L, "normalMatrix", U.normalMatrix), ut.setValue(L, "modelMatrix", U.matrixWorld), k.isShaderMaterial || k.isRawShaderMaterial) {
+ if ((Zt.position !== void 0 || Zt.normal !== void 0 || Zt.color !== void 0) && Oe.update(U, F, ri), (Xt || ye.receiveShadow !== U.receiveShadow) && (ye.receiveShadow = U.receiveShadow, ut.setValue(L, "receiveShadow", U.receiveShadow)), k.isMeshGouraudMaterial && k.envMap !== null && (Vt.envMap.value = ge, Vt.flipEnvMap.value = ge.isCubeTexture && ge.isRenderTargetTexture === !1 ? -1 : 1), k.isMeshStandardMaterial && k.envMap === null && O.environment !== null && (Vt.envMapIntensity.value = O.environmentIntensity), Vt.dfgLUT !== void 0 && (Vt.dfgLUT.value = t0()), Xt && (ut.setValue(L, "toneMappingExposure", S.toneMappingExposure), ye.needsLights && zh(Vt, os), ee && k.fog === !0 && xe.refreshFogUniforms(Vt, ee), xe.refreshMaterialUniforms(Vt, k, se, Z, _.state.transmissionRenderTarget[b.id]), bn.upload(L, al(ye), Vt, De)), k.isShaderMaterial && k.uniformsNeedUpdate === !0 && (bn.upload(L, al(ye), Vt, De), k.uniformsNeedUpdate = !1), k.isSpriteMaterial && ut.setValue(L, "center", U.center), ut.setValue(L, "modelViewMatrix", U.modelViewMatrix), ut.setValue(L, "normalMatrix", U.normalMatrix), ut.setValue(L, "modelMatrix", U.matrixWorld), k.isShaderMaterial || k.isRawShaderMaterial) {
const Dt = k.uniformsGroups;
for (let si = 0, Bn = Dt.length; si < Bn; si++) {
const ar = Dt[si];
@@ -25979,75 +25997,75 @@ class Pn {
}
return ri;
}
- function zh(M, O) {
- M.ambientLightColor.needsUpdate = O, M.lightProbe.needsUpdate = O, M.directionalLights.needsUpdate = O, M.directionalLightShadows.needsUpdate = O, M.pointLights.needsUpdate = O, M.pointLightShadows.needsUpdate = O, M.spotLights.needsUpdate = O, M.spotLightShadows.needsUpdate = O, M.rectAreaLights.needsUpdate = O, M.hemisphereLights.needsUpdate = O;
+ function zh(b, O) {
+ b.ambientLightColor.needsUpdate = O, b.lightProbe.needsUpdate = O, b.directionalLights.needsUpdate = O, b.directionalLightShadows.needsUpdate = O, b.pointLights.needsUpdate = O, b.pointLightShadows.needsUpdate = O, b.spotLights.needsUpdate = O, b.spotLightShadows.needsUpdate = O, b.rectAreaLights.needsUpdate = O, b.hemisphereLights.needsUpdate = O;
}
- function Hh(M) {
- return M.isMeshLambertMaterial || M.isMeshToonMaterial || M.isMeshPhongMaterial || M.isMeshStandardMaterial || M.isShadowMaterial || M.isShaderMaterial && M.lights === !0;
+ function Hh(b) {
+ return b.isMeshLambertMaterial || b.isMeshToonMaterial || b.isMeshPhongMaterial || b.isMeshStandardMaterial || b.isShadowMaterial || b.isShaderMaterial && b.lights === !0;
}
this.getActiveCubeFace = function() {
return I;
}, this.getActiveMipmapLevel = function() {
return T;
}, this.getRenderTarget = function() {
- return b;
- }, this.setRenderTargetTextures = function(M, O, F) {
- const k = Me.get(M);
- k.__autoAllocateDepthBuffer = M.resolveDepthBuffer === !1, k.__autoAllocateDepthBuffer === !1 && (k.__useRenderToTexture = !1), Me.get(M.texture).__webglTexture = O, Me.get(M.depthTexture).__webglTexture = k.__autoAllocateDepthBuffer ? void 0 : F, k.__hasExternalTextures = !0;
- }, this.setRenderTargetFramebuffer = function(M, O) {
- const F = Me.get(M);
+ return M;
+ }, this.setRenderTargetTextures = function(b, O, F) {
+ const k = be.get(b);
+ k.__autoAllocateDepthBuffer = b.resolveDepthBuffer === !1, k.__autoAllocateDepthBuffer === !1 && (k.__useRenderToTexture = !1), be.get(b.texture).__webglTexture = O, be.get(b.depthTexture).__webglTexture = k.__autoAllocateDepthBuffer ? void 0 : F, k.__hasExternalTextures = !0;
+ }, this.setRenderTargetFramebuffer = function(b, O) {
+ const F = be.get(b);
F.__webglFramebuffer = O, F.__useDefaultFramebuffer = O === void 0;
};
const Vh = L.createFramebuffer();
- this.setRenderTarget = function(M, O = 0, F = 0) {
- b = M, I = O, T = F;
+ this.setRenderTarget = function(b, O = 0, F = 0) {
+ M = b, I = O, T = F;
let k = !0, U = null, ee = !1, pe = !1;
- if (M) {
- const me = Me.get(M);
+ if (b) {
+ const me = be.get(b);
if (me.__useDefaultFramebuffer !== void 0)
fe.bindFramebuffer(L.FRAMEBUFFER, null), k = !1;
else if (me.__webglFramebuffer === void 0)
- De.setupRenderTarget(M);
+ De.setupRenderTarget(b);
else if (me.__hasExternalTextures)
- De.rebindTextures(M, Me.get(M.texture).__webglTexture, Me.get(M.depthTexture).__webglTexture);
- else if (M.depthBuffer) {
- const Ne = M.depthTexture;
+ De.rebindTextures(b, be.get(b.texture).__webglTexture, be.get(b.depthTexture).__webglTexture);
+ else if (b.depthBuffer) {
+ const Ne = b.depthTexture;
if (me.__boundDepthTexture !== Ne) {
- if (Ne !== null && Me.has(Ne) && (M.width !== Ne.image.width || M.height !== Ne.image.height))
+ if (Ne !== null && be.has(Ne) && (b.width !== Ne.image.width || b.height !== Ne.image.height))
throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");
- De.setupDepthRenderbuffer(M);
+ De.setupDepthRenderbuffer(b);
}
}
- const ge = M.texture;
+ const ge = b.texture;
(ge.isData3DTexture || ge.isDataArrayTexture || ge.isCompressedArrayTexture) && (pe = !0);
- const Le = Me.get(M).__webglFramebuffer;
- M.isWebGLCubeRenderTarget ? (Array.isArray(Le[O]) ? U = Le[O][F] : U = Le[O], ee = !0) : M.samples > 0 && De.useMultisampledRTT(M) === !1 ? U = Me.get(M).__webglMultisampledFramebuffer : Array.isArray(Le) ? U = Le[F] : U = Le, z.copy(M.viewport), H.copy(M.scissor), j = M.scissorTest;
+ const Le = be.get(b).__webglFramebuffer;
+ b.isWebGLCubeRenderTarget ? (Array.isArray(Le[O]) ? U = Le[O][F] : U = Le[O], ee = !0) : b.samples > 0 && De.useMultisampledRTT(b) === !1 ? U = be.get(b).__webglMultisampledFramebuffer : Array.isArray(Le) ? U = Le[F] : U = Le, z.copy(b.viewport), H.copy(b.scissor), j = b.scissorTest;
} else
z.copy(qe).multiplyScalar(se).floor(), H.copy(Ke).multiplyScalar(se).floor(), j = Ze;
- if (F !== 0 && (U = Vh), fe.bindFramebuffer(L.FRAMEBUFFER, U) && k && fe.drawBuffers(M, U), fe.viewport(z), fe.scissor(H), fe.setScissorTest(j), ee) {
- const me = Me.get(M.texture);
+ if (F !== 0 && (U = Vh), fe.bindFramebuffer(L.FRAMEBUFFER, U) && k && fe.drawBuffers(b, U), fe.viewport(z), fe.scissor(H), fe.setScissorTest(j), ee) {
+ const me = be.get(b.texture);
L.framebufferTexture2D(L.FRAMEBUFFER, L.COLOR_ATTACHMENT0, L.TEXTURE_CUBE_MAP_POSITIVE_X + O, me.__webglTexture, F);
} else if (pe) {
const me = O;
- for (let ge = 0; ge < M.textures.length; ge++) {
- const Le = Me.get(M.textures[ge]);
+ for (let ge = 0; ge < b.textures.length; ge++) {
+ const Le = be.get(b.textures[ge]);
L.framebufferTextureLayer(L.FRAMEBUFFER, L.COLOR_ATTACHMENT0 + ge, Le.__webglTexture, F, me);
}
- } else if (M !== null && F !== 0) {
- const me = Me.get(M.texture);
+ } else if (b !== null && F !== 0) {
+ const me = be.get(b.texture);
L.framebufferTexture2D(L.FRAMEBUFFER, L.COLOR_ATTACHMENT0, L.TEXTURE_2D, me.__webglTexture, F);
}
D = -1;
- }, this.readRenderTargetPixels = function(M, O, F, k, U, ee, pe, me = 0) {
- if (!(M && M.isWebGLRenderTarget)) {
+ }, this.readRenderTargetPixels = function(b, O, F, k, U, ee, pe, me = 0) {
+ if (!(b && b.isWebGLRenderTarget)) {
He("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");
return;
}
- let ge = Me.get(M).__webglFramebuffer;
- if (M.isWebGLCubeRenderTarget && pe !== void 0 && (ge = ge[pe]), ge) {
+ let ge = be.get(b).__webglFramebuffer;
+ if (b.isWebGLCubeRenderTarget && pe !== void 0 && (ge = ge[pe]), ge) {
fe.bindFramebuffer(L.FRAMEBUFFER, ge);
try {
- const Le = M.textures[me], Ne = Le.format, Ie = Le.type;
+ const Le = b.textures[me], Ne = Le.format, Ie = Le.type;
if (!Qe.textureFormatReadable(Ne)) {
He("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");
return;
@@ -26056,75 +26074,75 @@ class Pn {
He("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");
return;
}
- O >= 0 && O <= M.width - k && F >= 0 && F <= M.height - U && (M.textures.length > 1 && L.readBuffer(L.COLOR_ATTACHMENT0 + me), L.readPixels(O, F, k, U, Re.convert(Ne), Re.convert(Ie), ee));
+ O >= 0 && O <= b.width - k && F >= 0 && F <= b.height - U && (b.textures.length > 1 && L.readBuffer(L.COLOR_ATTACHMENT0 + me), L.readPixels(O, F, k, U, Re.convert(Ne), Re.convert(Ie), ee));
} finally {
- const Le = b !== null ? Me.get(b).__webglFramebuffer : null;
+ const Le = M !== null ? be.get(M).__webglFramebuffer : null;
fe.bindFramebuffer(L.FRAMEBUFFER, Le);
}
}
- }, this.readRenderTargetPixelsAsync = async function(M, O, F, k, U, ee, pe, me = 0) {
- if (!(M && M.isWebGLRenderTarget))
+ }, this.readRenderTargetPixelsAsync = async function(b, O, F, k, U, ee, pe, me = 0) {
+ if (!(b && b.isWebGLRenderTarget))
throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");
- let ge = Me.get(M).__webglFramebuffer;
- if (M.isWebGLCubeRenderTarget && pe !== void 0 && (ge = ge[pe]), ge)
- if (O >= 0 && O <= M.width - k && F >= 0 && F <= M.height - U) {
+ let ge = be.get(b).__webglFramebuffer;
+ if (b.isWebGLCubeRenderTarget && pe !== void 0 && (ge = ge[pe]), ge)
+ if (O >= 0 && O <= b.width - k && F >= 0 && F <= b.height - U) {
fe.bindFramebuffer(L.FRAMEBUFFER, ge);
- const Le = M.textures[me], Ne = Le.format, Ie = Le.type;
+ const Le = b.textures[me], Ne = Le.format, Ie = Le.type;
if (!Qe.textureFormatReadable(Ne))
throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");
if (!Qe.textureTypeReadable(Ie))
throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");
const Ye = L.createBuffer();
- L.bindBuffer(L.PIXEL_PACK_BUFFER, Ye), L.bufferData(L.PIXEL_PACK_BUFFER, ee.byteLength, L.STREAM_READ), M.textures.length > 1 && L.readBuffer(L.COLOR_ATTACHMENT0 + me), L.readPixels(O, F, k, U, Re.convert(Ne), Re.convert(Ie), 0);
- const ot = b !== null ? Me.get(b).__webglFramebuffer : null;
+ L.bindBuffer(L.PIXEL_PACK_BUFFER, Ye), L.bufferData(L.PIXEL_PACK_BUFFER, ee.byteLength, L.STREAM_READ), b.textures.length > 1 && L.readBuffer(L.COLOR_ATTACHMENT0 + me), L.readPixels(O, F, k, U, Re.convert(Ne), Re.convert(Ie), 0);
+ const ot = M !== null ? be.get(M).__webglFramebuffer : null;
fe.bindFramebuffer(L.FRAMEBUFFER, ot);
const pt = L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE, 0);
return L.flush(), await Iu(L, pt, 4), L.bindBuffer(L.PIXEL_PACK_BUFFER, Ye), L.getBufferSubData(L.PIXEL_PACK_BUFFER, 0, ee), L.deleteBuffer(Ye), L.deleteSync(pt), ee;
} else
throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.");
- }, this.copyFramebufferToTexture = function(M, O = null, F = 0) {
- const k = Math.pow(2, -F), U = Math.floor(M.image.width * k), ee = Math.floor(M.image.height * k), pe = O !== null ? O.x : 0, me = O !== null ? O.y : 0;
- De.setTexture2D(M, 0), L.copyTexSubImage2D(L.TEXTURE_2D, F, 0, 0, pe, me, U, ee), fe.unbindTexture();
+ }, this.copyFramebufferToTexture = function(b, O = null, F = 0) {
+ const k = Math.pow(2, -F), U = Math.floor(b.image.width * k), ee = Math.floor(b.image.height * k), pe = O !== null ? O.x : 0, me = O !== null ? O.y : 0;
+ De.setTexture2D(b, 0), L.copyTexSubImage2D(L.TEXTURE_2D, F, 0, 0, pe, me, U, ee), fe.unbindTexture();
};
const Gh = L.createFramebuffer(), Wh = L.createFramebuffer();
- this.copyTextureToTexture = function(M, O, F = null, k = null, U = 0, ee = null) {
+ this.copyTextureToTexture = function(b, O, F = null, k = null, U = 0, ee = null) {
ee === null && (U !== 0 ? (Ps("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."), ee = U, U = 0) : ee = 0);
let pe, me, ge, Le, Ne, Ie, Ye, ot, pt;
- const ht = M.isCompressedTexture ? M.mipmaps[ee] : M.image;
+ const ht = b.isCompressedTexture ? b.mipmaps[ee] : b.image;
if (F !== null)
pe = F.max.x - F.min.x, me = F.max.y - F.min.y, ge = F.isBox3 ? F.max.z - F.min.z : 1, Le = F.min.x, Ne = F.min.y, Ie = F.isBox3 ? F.min.z : 0;
else {
const Zt = Math.pow(2, -U);
- pe = Math.floor(ht.width * Zt), me = Math.floor(ht.height * Zt), M.isDataArrayTexture ? ge = ht.depth : M.isData3DTexture ? ge = Math.floor(ht.depth * Zt) : ge = 1, Le = 0, Ne = 0, Ie = 0;
+ pe = Math.floor(ht.width * Zt), me = Math.floor(ht.height * Zt), b.isDataArrayTexture ? ge = ht.depth : b.isData3DTexture ? ge = Math.floor(ht.depth * Zt) : ge = 1, Le = 0, Ne = 0, Ie = 0;
}
k !== null ? (Ye = k.x, ot = k.y, pt = k.z) : (Ye = 0, ot = 0, pt = 0);
const lt = Re.convert(O.format), ye = Re.convert(O.type);
let Pt;
O.isData3DTexture ? (De.setTexture3D(O, 0), Pt = L.TEXTURE_3D) : O.isDataArrayTexture || O.isCompressedArrayTexture ? (De.setTexture2DArray(O, 0), Pt = L.TEXTURE_2D_ARRAY) : (De.setTexture2D(O, 0), Pt = L.TEXTURE_2D), L.pixelStorei(L.UNPACK_FLIP_Y_WEBGL, O.flipY), L.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL, O.premultiplyAlpha), L.pixelStorei(L.UNPACK_ALIGNMENT, O.unpackAlignment);
- const Pi = L.getParameter(L.UNPACK_ROW_LENGTH), ri = L.getParameter(L.UNPACK_IMAGE_HEIGHT), xr = L.getParameter(L.UNPACK_SKIP_PIXELS), Xt = L.getParameter(L.UNPACK_SKIP_ROWS), os = L.getParameter(L.UNPACK_SKIP_IMAGES);
+ const Li = L.getParameter(L.UNPACK_ROW_LENGTH), ri = L.getParameter(L.UNPACK_IMAGE_HEIGHT), yr = L.getParameter(L.UNPACK_SKIP_PIXELS), Xt = L.getParameter(L.UNPACK_SKIP_ROWS), os = L.getParameter(L.UNPACK_SKIP_IMAGES);
L.pixelStorei(L.UNPACK_ROW_LENGTH, ht.width), L.pixelStorei(L.UNPACK_IMAGE_HEIGHT, ht.height), L.pixelStorei(L.UNPACK_SKIP_PIXELS, Le), L.pixelStorei(L.UNPACK_SKIP_ROWS, Ne), L.pixelStorei(L.UNPACK_SKIP_IMAGES, Ie);
- const ut = M.isDataArrayTexture || M.isData3DTexture, Vt = O.isDataArrayTexture || O.isData3DTexture;
- if (M.isDepthTexture) {
- const Zt = Me.get(M), Dt = Me.get(O), si = Me.get(Zt.__renderTarget), Bn = Me.get(Dt.__renderTarget);
+ const ut = b.isDataArrayTexture || b.isData3DTexture, Vt = O.isDataArrayTexture || O.isData3DTexture;
+ if (b.isDepthTexture) {
+ const Zt = be.get(b), Dt = be.get(O), si = be.get(Zt.__renderTarget), Bn = be.get(Dt.__renderTarget);
fe.bindFramebuffer(L.READ_FRAMEBUFFER, si.__webglFramebuffer), fe.bindFramebuffer(L.DRAW_FRAMEBUFFER, Bn.__webglFramebuffer);
for (let ar = 0; ar < ge; ar++)
- ut && (L.framebufferTextureLayer(L.READ_FRAMEBUFFER, L.COLOR_ATTACHMENT0, Me.get(M).__webglTexture, U, Ie + ar), L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER, L.COLOR_ATTACHMENT0, Me.get(O).__webglTexture, ee, pt + ar)), L.blitFramebuffer(Le, Ne, pe, me, Ye, ot, pe, me, L.DEPTH_BUFFER_BIT, L.NEAREST);
+ ut && (L.framebufferTextureLayer(L.READ_FRAMEBUFFER, L.COLOR_ATTACHMENT0, be.get(b).__webglTexture, U, Ie + ar), L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER, L.COLOR_ATTACHMENT0, be.get(O).__webglTexture, ee, pt + ar)), L.blitFramebuffer(Le, Ne, pe, me, Ye, ot, pe, me, L.DEPTH_BUFFER_BIT, L.NEAREST);
fe.bindFramebuffer(L.READ_FRAMEBUFFER, null), fe.bindFramebuffer(L.DRAW_FRAMEBUFFER, null);
- } else if (U !== 0 || M.isRenderTargetTexture || Me.has(M)) {
- const Zt = Me.get(M), Dt = Me.get(O);
+ } else if (U !== 0 || b.isRenderTargetTexture || be.has(b)) {
+ const Zt = be.get(b), Dt = be.get(O);
fe.bindFramebuffer(L.READ_FRAMEBUFFER, Gh), fe.bindFramebuffer(L.DRAW_FRAMEBUFFER, Wh);
for (let si = 0; si < ge; si++)
ut ? L.framebufferTextureLayer(L.READ_FRAMEBUFFER, L.COLOR_ATTACHMENT0, Zt.__webglTexture, U, Ie + si) : L.framebufferTexture2D(L.READ_FRAMEBUFFER, L.COLOR_ATTACHMENT0, L.TEXTURE_2D, Zt.__webglTexture, U), Vt ? L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER, L.COLOR_ATTACHMENT0, Dt.__webglTexture, ee, pt + si) : L.framebufferTexture2D(L.DRAW_FRAMEBUFFER, L.COLOR_ATTACHMENT0, L.TEXTURE_2D, Dt.__webglTexture, ee), U !== 0 ? L.blitFramebuffer(Le, Ne, pe, me, Ye, ot, pe, me, L.COLOR_BUFFER_BIT, L.NEAREST) : Vt ? L.copyTexSubImage3D(Pt, ee, Ye, ot, pt + si, Le, Ne, pe, me) : L.copyTexSubImage2D(Pt, ee, Ye, ot, Le, Ne, pe, me);
fe.bindFramebuffer(L.READ_FRAMEBUFFER, null), fe.bindFramebuffer(L.DRAW_FRAMEBUFFER, null);
} else
- Vt ? M.isDataTexture || M.isData3DTexture ? L.texSubImage3D(Pt, ee, Ye, ot, pt, pe, me, ge, lt, ye, ht.data) : O.isCompressedArrayTexture ? L.compressedTexSubImage3D(Pt, ee, Ye, ot, pt, pe, me, ge, lt, ht.data) : L.texSubImage3D(Pt, ee, Ye, ot, pt, pe, me, ge, lt, ye, ht) : M.isDataTexture ? L.texSubImage2D(L.TEXTURE_2D, ee, Ye, ot, pe, me, lt, ye, ht.data) : M.isCompressedTexture ? L.compressedTexSubImage2D(L.TEXTURE_2D, ee, Ye, ot, ht.width, ht.height, lt, ht.data) : L.texSubImage2D(L.TEXTURE_2D, ee, Ye, ot, pe, me, lt, ye, ht);
- L.pixelStorei(L.UNPACK_ROW_LENGTH, Pi), L.pixelStorei(L.UNPACK_IMAGE_HEIGHT, ri), L.pixelStorei(L.UNPACK_SKIP_PIXELS, xr), L.pixelStorei(L.UNPACK_SKIP_ROWS, Xt), L.pixelStorei(L.UNPACK_SKIP_IMAGES, os), ee === 0 && O.generateMipmaps && L.generateMipmap(Pt), fe.unbindTexture();
- }, this.initRenderTarget = function(M) {
- Me.get(M).__webglFramebuffer === void 0 && De.setupRenderTarget(M);
- }, this.initTexture = function(M) {
- M.isCubeTexture ? De.setTextureCube(M, 0) : M.isData3DTexture ? De.setTexture3D(M, 0) : M.isDataArrayTexture || M.isCompressedArrayTexture ? De.setTexture2DArray(M, 0) : De.setTexture2D(M, 0), fe.unbindTexture();
+ Vt ? b.isDataTexture || b.isData3DTexture ? L.texSubImage3D(Pt, ee, Ye, ot, pt, pe, me, ge, lt, ye, ht.data) : O.isCompressedArrayTexture ? L.compressedTexSubImage3D(Pt, ee, Ye, ot, pt, pe, me, ge, lt, ht.data) : L.texSubImage3D(Pt, ee, Ye, ot, pt, pe, me, ge, lt, ye, ht) : b.isDataTexture ? L.texSubImage2D(L.TEXTURE_2D, ee, Ye, ot, pe, me, lt, ye, ht.data) : b.isCompressedTexture ? L.compressedTexSubImage2D(L.TEXTURE_2D, ee, Ye, ot, ht.width, ht.height, lt, ht.data) : L.texSubImage2D(L.TEXTURE_2D, ee, Ye, ot, pe, me, lt, ye, ht);
+ L.pixelStorei(L.UNPACK_ROW_LENGTH, Li), L.pixelStorei(L.UNPACK_IMAGE_HEIGHT, ri), L.pixelStorei(L.UNPACK_SKIP_PIXELS, yr), L.pixelStorei(L.UNPACK_SKIP_ROWS, Xt), L.pixelStorei(L.UNPACK_SKIP_IMAGES, os), ee === 0 && O.generateMipmaps && L.generateMipmap(Pt), fe.unbindTexture();
+ }, this.initRenderTarget = function(b) {
+ be.get(b).__webglFramebuffer === void 0 && De.setupRenderTarget(b);
+ }, this.initTexture = function(b) {
+ b.isCubeTexture ? De.setTextureCube(b, 0) : b.isData3DTexture ? De.setTexture3D(b, 0) : b.isDataArrayTexture || b.isCompressedArrayTexture ? De.setTexture2DArray(b, 0) : De.setTexture2D(b, 0), fe.unbindTexture();
}, this.resetState = function() {
- I = 0, T = 0, b = null, fe.reset(), P.reset();
+ I = 0, T = 0, M = null, fe.reset(), P.reset();
}, typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", { detail: this }));
}
/**
@@ -26234,8 +26252,8 @@ class i0 extends Zd {
E.length || t(4, "unable to allocate buffer space");
let A = 0, S = 0;
const R = 4 * _, I = new Uint8Array(4), T = new Uint8Array(R);
- let b = y;
- for (; b > 0 && S < m.byteLength; ) {
+ let M = y;
+ for (; M > 0 && S < m.byteLength; ) {
S + 4 > m.byteLength && t(1), I[0] = m[S++], I[1] = m[S++], I[2] = m[S++], I[3] = m[S++], (I[0] != 2 || I[1] != 2 || (I[2] << 8 | I[3]) != _) && t(3, "bad rgbe scanline format");
let D = 0, N;
for (; D < R && S < m.byteLength; ) {
@@ -26253,7 +26271,7 @@ class i0 extends Zd {
let j = 0;
E[A] = T[H + j], j += _, E[A + 1] = T[H + j], j += _, E[A + 2] = T[H + j], j += _, E[A + 3] = T[H + j], A += 4;
}
- b--;
+ M--;
}
return E;
}, a = function(m, p, y, _) {
@@ -26308,7 +26326,7 @@ class i0 extends Zd {
switch (a.type) {
case jt:
case mt:
- a.colorSpace = Nt, a.minFilter = yt, a.magFilter = yt, a.generateMipmaps = !1, a.flipY = !0;
+ a.colorSpace = Ot, a.minFilter = yt, a.magFilter = yt, a.generateMipmaps = !1, a.flipY = !0;
break;
}
t && t(a, o);
@@ -26321,7 +26339,7 @@ class r0 extends i0 {
console.warn("RGBELoader has been deprecated. Please use HDRLoader instead."), super(e);
}
}
-const tr = {
+const ir = {
name: "CopyShader",
uniforms: {
tDiffuse: { value: null },
@@ -26547,7 +26565,7 @@ class l0 {
this._width = i.width, this._height = i.height, t = new xt(this._width * this._pixelRatio, this._height * this._pixelRatio, { type: mt }), t.texture.name = "EffectComposer.rt1";
} else
this._width = t.width, this._height = t.height;
- this.renderTarget1 = t, this.renderTarget2 = t.clone(), this.renderTarget2.texture.name = "EffectComposer.rt2", this.writeBuffer = this.renderTarget1, this.readBuffer = this.renderTarget2, this.renderToScreen = !0, this.passes = [], this.copyPass = new yo(tr), this.copyPass.material.blending = _t, this.clock = new sp();
+ this.renderTarget1 = t, this.renderTarget2 = t.clone(), this.renderTarget2.texture.name = "EffectComposer.rt2", this.writeBuffer = this.renderTarget1, this.readBuffer = this.renderTarget2, this.renderToScreen = !0, this.passes = [], this.copyPass = new yo(ir), this.copyPass.material.blending = _t, this.clock = new sp();
}
/**
* Swaps the internal read/write buffers.
@@ -26998,7 +27016,7 @@ function h0(s = 5) {
r[a * 4] = (c.x * 0.5 + 0.5) * 255, r[a * 4 + 1] = (c.y * 0.5 + 0.5) * 255, r[a * 4 + 2] = 127, r[a * 4 + 3] = 255;
}
const n = new rs(r, e, e);
- return n.wrapS = wi, n.wrapT = wi, n.needsUpdate = !0, n;
+ return n.wrapS = Ri, n.wrapT = Ri, n.needsUpdate = !0, n;
}
function u0(s) {
const e = Math.floor(s) % 2 === 0 ? Math.floor(s) + 1 : Math.floor(s), t = e * e, i = Array(t).fill(0);
@@ -27347,13 +27365,13 @@ class p0 {
const a = 0.5 * (Math.sqrt(3) - 1), o = (e + t) * a, l = Math.floor(e + o), c = Math.floor(t + o), h = (3 - Math.sqrt(3)) / 6, u = (l + c) * h, d = l - u, f = c - u, g = e - d, v = t - f;
let m, p;
g > v ? (m = 1, p = 0) : (m = 0, p = 1);
- const y = g - m + h, _ = v - p + h, E = g - 1 + 2 * h, A = v - 1 + 2 * h, S = l & 255, R = c & 255, I = this.perm[S + this.perm[R]] % 12, T = this.perm[S + m + this.perm[R + p]] % 12, b = this.perm[S + 1 + this.perm[R + 1]] % 12;
+ const y = g - m + h, _ = v - p + h, E = g - 1 + 2 * h, A = v - 1 + 2 * h, S = l & 255, R = c & 255, I = this.perm[S + this.perm[R]] % 12, T = this.perm[S + m + this.perm[R + p]] % 12, M = this.perm[S + 1 + this.perm[R + 1]] % 12;
let D = 0.5 - g * g - v * v;
D < 0 ? i = 0 : (D *= D, i = D * D * this._dot(this.grad3[I], g, v));
let N = 0.5 - y * y - _ * _;
N < 0 ? r = 0 : (N *= N, r = N * N * this._dot(this.grad3[T], y, _));
let z = 0.5 - E * E - A * A;
- return z < 0 ? n = 0 : (z *= z, n = z * z * this._dot(this.grad3[b], E, A)), 70 * (i + r + n);
+ return z < 0 ? n = 0 : (z *= z, n = z * z * this._dot(this.grad3[M], E, A)), 70 * (i + r + n);
}
/**
* A 3D simplex noise method.
@@ -27368,11 +27386,11 @@ class p0 {
const l = (e + t + i) * 0.3333333333333333, c = Math.floor(e + l), h = Math.floor(t + l), u = Math.floor(i + l), d = 1 / 6, f = (c + h + u) * d, g = c - f, v = h - f, m = u - f, p = e - g, y = t - v, _ = i - m;
let E, A, S, R, I, T;
p >= y ? y >= _ ? (E = 1, A = 0, S = 0, R = 1, I = 1, T = 0) : p >= _ ? (E = 1, A = 0, S = 0, R = 1, I = 0, T = 1) : (E = 0, A = 0, S = 1, R = 1, I = 0, T = 1) : y < _ ? (E = 0, A = 0, S = 1, R = 0, I = 1, T = 1) : p < _ ? (E = 0, A = 1, S = 0, R = 0, I = 1, T = 1) : (E = 0, A = 1, S = 0, R = 1, I = 1, T = 0);
- const b = p - E + d, D = y - A + d, N = _ - S + d, z = p - R + 2 * d, H = y - I + 2 * d, j = _ - T + 2 * d, q = p - 1 + 3 * d, te = y - 1 + 3 * d, G = _ - 1 + 3 * d, Z = c & 255, se = h & 255, Pe = u & 255, ze = this.perm[Z + this.perm[se + this.perm[Pe]]] % 12, qe = this.perm[Z + E + this.perm[se + A + this.perm[Pe + S]]] % 12, Ke = this.perm[Z + R + this.perm[se + I + this.perm[Pe + T]]] % 12, Ze = this.perm[Z + 1 + this.perm[se + 1 + this.perm[Pe + 1]]] % 12;
+ const M = p - E + d, D = y - A + d, N = _ - S + d, z = p - R + 2 * d, H = y - I + 2 * d, j = _ - T + 2 * d, q = p - 1 + 3 * d, te = y - 1 + 3 * d, G = _ - 1 + 3 * d, Z = c & 255, se = h & 255, Pe = u & 255, ze = this.perm[Z + this.perm[se + this.perm[Pe]]] % 12, qe = this.perm[Z + E + this.perm[se + A + this.perm[Pe + S]]] % 12, Ke = this.perm[Z + R + this.perm[se + I + this.perm[Pe + T]]] % 12, Ze = this.perm[Z + 1 + this.perm[se + 1 + this.perm[Pe + 1]]] % 12;
let W = 0.6 - p * p - y * y - _ * _;
W < 0 ? r = 0 : (W *= W, r = W * W * this._dot3(this.grad3[ze], p, y, _));
- let Y = 0.6 - b * b - D * D - N * N;
- Y < 0 ? n = 0 : (Y *= Y, n = Y * Y * this._dot3(this.grad3[qe], b, D, N));
+ let Y = 0.6 - M * M - D * D - N * N;
+ Y < 0 ? n = 0 : (Y *= Y, n = Y * Y * this._dot3(this.grad3[qe], M, D, N));
let ue = 0.6 - z * z - H * H - j * j;
ue < 0 ? a = 0 : (ue *= ue, a = ue * ue * this._dot3(this.grad3[Ke], z, H, j));
let Ce = 0.6 - q * q - te * te - G * G;
@@ -27390,15 +27408,15 @@ class p0 {
noise4d(e, t, i, r) {
const n = this.grad4, a = this.simplex, o = this.perm, l = (Math.sqrt(5) - 1) / 4, c = (5 - Math.sqrt(5)) / 20;
let h, u, d, f, g;
- const v = (e + t + i + r) * l, m = Math.floor(e + v), p = Math.floor(t + v), y = Math.floor(i + v), _ = Math.floor(r + v), E = (m + p + y + _) * c, A = m - E, S = p - E, R = y - E, I = _ - E, T = e - A, b = t - S, D = i - R, N = r - I, z = T > b ? 32 : 0, H = T > D ? 16 : 0, j = b > D ? 8 : 0, q = T > N ? 4 : 0, te = b > N ? 2 : 0, G = D > N ? 1 : 0, Z = z + H + j + q + te + G, se = a[Z][0] >= 3 ? 1 : 0, Pe = a[Z][1] >= 3 ? 1 : 0, ze = a[Z][2] >= 3 ? 1 : 0, qe = a[Z][3] >= 3 ? 1 : 0, Ke = a[Z][0] >= 2 ? 1 : 0, Ze = a[Z][1] >= 2 ? 1 : 0, W = a[Z][2] >= 2 ? 1 : 0, Y = a[Z][3] >= 2 ? 1 : 0, ue = a[Z][0] >= 1 ? 1 : 0, Ce = a[Z][1] >= 1 ? 1 : 0, Te = a[Z][2] >= 1 ? 1 : 0, Ee = a[Z][3] >= 1 ? 1 : 0, Je = T - se + c, je = b - Pe + c, Ve = D - ze + c, L = N - qe + c, gt = T - Ke + 2 * c, We = b - Ze + 2 * c, Qe = D - W + 2 * c, fe = N - Y + 2 * c, at = T - ue + 3 * c, Me = b - Ce + 3 * c, De = D - Te + 3 * c, C = N - Ee + 3 * c, x = T - 1 + 4 * c, B = b - 1 + 4 * c, X = D - 1 + 4 * c, K = N - 1 + 4 * c, V = m & 255, xe = p & 255, ne = y & 255, Se = _ & 255, de = o[V + o[xe + o[ne + o[Se]]]] % 32, J = o[V + se + o[xe + Pe + o[ne + ze + o[Se + qe]]]] % 32, re = o[V + Ke + o[xe + Ze + o[ne + W + o[Se + Y]]]] % 32, Oe = o[V + ue + o[xe + Ce + o[ne + Te + o[Se + Ee]]]] % 32, we = o[V + 1 + o[xe + 1 + o[ne + 1 + o[Se + 1]]]] % 32;
- let he = 0.6 - T * T - b * b - D * D - N * N;
- he < 0 ? h = 0 : (he *= he, h = he * he * this._dot4(n[de], T, b, D, N));
+ const v = (e + t + i + r) * l, m = Math.floor(e + v), p = Math.floor(t + v), y = Math.floor(i + v), _ = Math.floor(r + v), E = (m + p + y + _) * c, A = m - E, S = p - E, R = y - E, I = _ - E, T = e - A, M = t - S, D = i - R, N = r - I, z = T > M ? 32 : 0, H = T > D ? 16 : 0, j = M > D ? 8 : 0, q = T > N ? 4 : 0, te = M > N ? 2 : 0, G = D > N ? 1 : 0, Z = z + H + j + q + te + G, se = a[Z][0] >= 3 ? 1 : 0, Pe = a[Z][1] >= 3 ? 1 : 0, ze = a[Z][2] >= 3 ? 1 : 0, qe = a[Z][3] >= 3 ? 1 : 0, Ke = a[Z][0] >= 2 ? 1 : 0, Ze = a[Z][1] >= 2 ? 1 : 0, W = a[Z][2] >= 2 ? 1 : 0, Y = a[Z][3] >= 2 ? 1 : 0, ue = a[Z][0] >= 1 ? 1 : 0, Ce = a[Z][1] >= 1 ? 1 : 0, Te = a[Z][2] >= 1 ? 1 : 0, Ee = a[Z][3] >= 1 ? 1 : 0, Je = T - se + c, je = M - Pe + c, Ve = D - ze + c, L = N - qe + c, gt = T - Ke + 2 * c, We = M - Ze + 2 * c, Qe = D - W + 2 * c, fe = N - Y + 2 * c, at = T - ue + 3 * c, be = M - Ce + 3 * c, De = D - Te + 3 * c, C = N - Ee + 3 * c, x = T - 1 + 4 * c, B = M - 1 + 4 * c, X = D - 1 + 4 * c, K = N - 1 + 4 * c, V = m & 255, xe = p & 255, ne = y & 255, Se = _ & 255, de = o[V + o[xe + o[ne + o[Se]]]] % 32, J = o[V + se + o[xe + Pe + o[ne + ze + o[Se + qe]]]] % 32, re = o[V + Ke + o[xe + Ze + o[ne + W + o[Se + Y]]]] % 32, Oe = o[V + ue + o[xe + Ce + o[ne + Te + o[Se + Ee]]]] % 32, we = o[V + 1 + o[xe + 1 + o[ne + 1 + o[Se + 1]]]] % 32;
+ let he = 0.6 - T * T - M * M - D * D - N * N;
+ he < 0 ? h = 0 : (he *= he, h = he * he * this._dot4(n[de], T, M, D, N));
let Re = 0.6 - Je * Je - je * je - Ve * Ve - L * L;
Re < 0 ? u = 0 : (Re *= Re, u = Re * Re * this._dot4(n[J], Je, je, Ve, L));
let P = 0.6 - gt * gt - We * We - Qe * Qe - fe * fe;
P < 0 ? d = 0 : (P *= P, d = P * P * this._dot4(n[re], gt, We, Qe, fe));
- let ae = 0.6 - at * at - Me * Me - De * De - C * C;
- ae < 0 ? f = 0 : (ae *= ae, f = ae * ae * this._dot4(n[Oe], at, Me, De, C));
+ let ae = 0.6 - at * at - be * be - De * De - C * C;
+ ae < 0 ? f = 0 : (ae *= ae, f = ae * ae * this._dot4(n[Oe], at, be, De, C));
let ie = 0.6 - x * x - B * B - X * X - K * K;
return ie < 0 ? g = 0 : (ie *= ie, g = ie * ie * this._dot4(n[we], x, B, X, K)), 27 * (h + u + d + f + g);
}
@@ -27448,9 +27466,9 @@ class li extends sr {
fragmentShader: dn.fragmentShader,
blending: _t
}), this.depthRenderMaterial.uniforms.cameraNear.value = this.camera.near, this.depthRenderMaterial.uniforms.cameraFar.value = this.camera.far, this.copyMaterial = new ct({
- uniforms: di.clone(tr.uniforms),
- vertexShader: tr.vertexShader,
- fragmentShader: tr.fragmentShader,
+ uniforms: di.clone(ir.uniforms),
+ vertexShader: ir.vertexShader,
+ fragmentShader: ir.fragmentShader,
transparent: !0,
depthTest: !1,
depthWrite: !1,
@@ -27510,9 +27528,9 @@ class li extends sr {
* @param {DepthTexture} [normalTexture] - The normal texture.
*/
setGBuffer(e, t) {
- e !== void 0 ? (this.depthTexture = e, this.normalTexture = t, this._renderGBuffer = !1) : (this.depthTexture = new qo(), this.depthTexture.format = Yr, this.depthTexture.type = qr, this.normalRenderTarget = new xt(this.width, this.height, {
- minFilter: Lt,
- magFilter: Lt,
+ e !== void 0 ? (this.depthTexture = e, this.normalTexture = t, this._renderGBuffer = !1) : (this.depthTexture = new qo(), this.depthTexture.format = Kr, this.depthTexture.type = Yr, this.normalRenderTarget = new xt(this.width, this.height, {
+ minFilter: It,
+ magFilter: It,
type: mt,
depthTexture: this.depthTexture
}), this.normalTexture = this.normalRenderTarget.texture, this._renderGBuffer = !0);
@@ -27613,7 +27631,7 @@ class li extends sr {
r[(a * e + o) * 4] = (t.noise(l, c) * 0.5 + 0.5) * 255, r[(a * e + o) * 4 + 1] = (t.noise(l + e, c) * 0.5 + 0.5) * 255, r[(a * e + o) * 4 + 2] = (t.noise(l, c + e) * 0.5 + 0.5) * 255, r[(a * e + o) * 4 + 3] = (t.noise(l + e, c + e) * 0.5 + 0.5) * 255;
}
const n = new rs(r, e, e, Kt, mi);
- return n.wrapS = wi, n.wrapT = wi, n.needsUpdate = !0, n;
+ return n.wrapS = Ri, n.wrapT = Ri, n.needsUpdate = !0, n;
}
}
li.OUTPUT = {
@@ -27674,7 +27692,7 @@ const f0 = {
}`
)
};
-class es extends sr {
+class ts extends sr {
/**
* Constructs a new Unreal Bloom pass.
*
@@ -27705,11 +27723,11 @@ class es extends sr {
this.separableBlurMaterials.push(this._getSeparableBlurMaterial(l[h])), this.separableBlurMaterials[h].uniforms.invSize.value = new oe(1 / n, 1 / a), n = Math.round(n / 2), a = Math.round(a / 2);
this.compositeMaterial = this._getCompositeMaterial(this.nMips), this.compositeMaterial.uniforms.blurTexture1.value = this.renderTargetsVertical[0].texture, this.compositeMaterial.uniforms.blurTexture2.value = this.renderTargetsVertical[1].texture, this.compositeMaterial.uniforms.blurTexture3.value = this.renderTargetsVertical[2].texture, this.compositeMaterial.uniforms.blurTexture4.value = this.renderTargetsVertical[3].texture, this.compositeMaterial.uniforms.blurTexture5.value = this.renderTargetsVertical[4].texture, this.compositeMaterial.uniforms.bloomStrength.value = t, this.compositeMaterial.uniforms.bloomRadius.value = 0.1;
const c = [1, 0.8, 0.6, 0.4, 0.2];
- this.compositeMaterial.uniforms.bloomFactors.value = c, this.bloomTintColors = [new w(1, 1, 1), new w(1, 1, 1), new w(1, 1, 1), new w(1, 1, 1), new w(1, 1, 1)], this.compositeMaterial.uniforms.bloomTintColors.value = this.bloomTintColors, this.copyUniforms = di.clone(tr.uniforms), this.blendMaterial = new ct({
+ this.compositeMaterial.uniforms.bloomFactors.value = c, this.bloomTintColors = [new w(1, 1, 1), new w(1, 1, 1), new w(1, 1, 1), new w(1, 1, 1), new w(1, 1, 1)], this.compositeMaterial.uniforms.bloomTintColors.value = this.bloomTintColors, this.copyUniforms = di.clone(ir.uniforms), this.blendMaterial = new ct({
uniforms: this.copyUniforms,
- vertexShader: tr.vertexShader,
- fragmentShader: tr.fragmentShader,
- blending: bn,
+ vertexShader: ir.vertexShader,
+ fragmentShader: ir.fragmentShader,
+ blending: Mn,
depthTest: !1,
depthWrite: !1,
transparent: !0
@@ -27758,7 +27776,7 @@ class es extends sr {
e.autoClear = !1, e.setClearColor(this.clearColor, 0), n && e.state.buffers.stencil.setTest(!1), this.renderToScreen && (this._fsQuad.material = this._basic, this._basic.map = i.texture, e.setRenderTarget(null), e.clear(), this._fsQuad.render(e)), this.highPassUniforms.tDiffuse.value = i.texture, this.highPassUniforms.luminosityThreshold.value = this.threshold, this._fsQuad.material = this.materialHighPassFilter, e.setRenderTarget(this.renderTargetBright), e.clear(), this._fsQuad.render(e);
let o = this.renderTargetBright;
for (let l = 0; l < this.nMips; l++)
- this._fsQuad.material = this.separableBlurMaterials[l], this.separableBlurMaterials[l].uniforms.colorTexture.value = o.texture, this.separableBlurMaterials[l].uniforms.direction.value = es.BlurDirectionX, e.setRenderTarget(this.renderTargetsHorizontal[l]), e.clear(), this._fsQuad.render(e), this.separableBlurMaterials[l].uniforms.colorTexture.value = this.renderTargetsHorizontal[l].texture, this.separableBlurMaterials[l].uniforms.direction.value = es.BlurDirectionY, e.setRenderTarget(this.renderTargetsVertical[l]), e.clear(), this._fsQuad.render(e), o = this.renderTargetsVertical[l];
+ this._fsQuad.material = this.separableBlurMaterials[l], this.separableBlurMaterials[l].uniforms.colorTexture.value = o.texture, this.separableBlurMaterials[l].uniforms.direction.value = ts.BlurDirectionX, e.setRenderTarget(this.renderTargetsHorizontal[l]), e.clear(), this._fsQuad.render(e), this.separableBlurMaterials[l].uniforms.colorTexture.value = this.renderTargetsHorizontal[l].texture, this.separableBlurMaterials[l].uniforms.direction.value = ts.BlurDirectionY, e.setRenderTarget(this.renderTargetsVertical[l]), e.clear(), this._fsQuad.render(e), o = this.renderTargetsVertical[l];
this._fsQuad.material = this.compositeMaterial, this.compositeMaterial.uniforms.bloomStrength.value = this.strength, this.compositeMaterial.uniforms.bloomRadius.value = this.radius, this.compositeMaterial.uniforms.bloomTintColors.value = this.bloomTintColors, e.setRenderTarget(this.renderTargetsHorizontal[0]), e.clear(), this._fsQuad.render(e), this._fsQuad.material = this.blendMaterial, this.copyUniforms.tDiffuse.value = this.renderTargetsHorizontal[0].texture, n && e.state.buffers.stencil.setTest(!0), this.renderToScreen ? (e.setRenderTarget(null), this._fsQuad.render(e)) : (e.setRenderTarget(i), this._fsQuad.render(e)), e.setClearColor(this._oldClearColor, this._oldClearAlpha), e.autoClear = a;
}
// internals
@@ -27852,8 +27870,8 @@ class es extends sr {
});
}
}
-es.BlurDirectionX = new oe(1, 0);
-es.BlurDirectionY = new oe(0, 1);
+ts.BlurDirectionX = new oe(1, 0);
+ts.BlurDirectionY = new oe(0, 1);
const fn = {
name: "OutputShader",
uniforms: {
@@ -28253,7 +28271,7 @@ const g0 = {
function v0(s) {
return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
}
-var Mo = { exports: {} }, _0 = Mo.exports, Rc;
+var bo = { exports: {} }, _0 = bo.exports, Rc;
function x0() {
return Rc || (Rc = 1, (function(s, e) {
(function(t, i) {
@@ -28296,11 +28314,11 @@ function x0() {
} };
}, t;
});
- })(Mo)), Mo.exports;
+ })(bo)), bo.exports;
}
var y0 = x0();
-const M0 = /* @__PURE__ */ v0(y0);
-class b0 {
+const b0 = /* @__PURE__ */ v0(y0);
+class M0 {
scene;
constructor(e) {
this.scene = new Vo(), this.setupEnvironment(e.backgroundColor), this.setupLights();
@@ -28316,7 +28334,7 @@ class b0 {
getBoundingBox() {
const e = new At();
return this.scene.traverse((t) => {
- if (t instanceof nt || t instanceof zi) {
+ if (t instanceof nt || t instanceof Vi) {
const i = new At().setFromObject(t);
e.union(i);
}
@@ -28326,7 +28344,7 @@ class b0 {
), e;
}
}
-const Ac = { type: "change" }, Qo = { type: "start" }, Dh = { type: "end" }, mn = new is(), Pc = new Mi(), T0 = Math.cos(70 * Fo.DEG2RAD), Mt = new w(), Gt = 2 * Math.PI, st = {
+const Ac = { type: "change" }, Qo = { type: "start" }, Dh = { type: "end" }, mn = new is(), Pc = new bi(), T0 = Math.cos(70 * Fo.DEG2RAD), bt = new w(), Gt = 2 * Math.PI, st = {
NONE: -1,
ROTATE: 0,
DOLLY: 1,
@@ -28335,7 +28353,7 @@ const Ac = { type: "change" }, Qo = { type: "start" }, Dh = { type: "end" }, mn
TOUCH_PAN: 4,
TOUCH_DOLLY_PAN: 5,
TOUCH_DOLLY_ROTATE: 6
-}, Ma = 1e-6;
+}, ba = 1e-6;
class Lh extends fp {
/**
* Constructs a new controls instance.
@@ -28344,7 +28362,7 @@ class Lh extends fp {
* @param {?HTMLElement} domElement - The HTML element used for event listeners.
*/
constructor(e, t = null) {
- super(e, t), this.state = st.NONE, this.target = new w(), this.cursor = new w(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: Fr.ROTATE, MIDDLE: Fr.DOLLY, RIGHT: Fr.PAN }, this.touches = { ONE: Or.ROTATE, TWO: Or.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new w(), this._lastQuaternion = new gi(), this._lastTargetPosition = new w(), this._quat = new gi().setFromUnitVectors(e.up, new w(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new ic(), this._sphericalDelta = new ic(), this._scale = 1, this._panOffset = new w(), this._rotateStart = new oe(), this._rotateEnd = new oe(), this._rotateDelta = new oe(), this._panStart = new oe(), this._panEnd = new oe(), this._panDelta = new oe(), this._dollyStart = new oe(), this._dollyEnd = new oe(), this._dollyDelta = new oe(), this._dollyDirection = new w(), this._mouse = new oe(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = E0.bind(this), this._onPointerDown = S0.bind(this), this._onPointerUp = w0.bind(this), this._onContextMenu = I0.bind(this), this._onMouseWheel = A0.bind(this), this._onKeyDown = P0.bind(this), this._onTouchStart = D0.bind(this), this._onTouchMove = L0.bind(this), this._onMouseDown = C0.bind(this), this._onMouseMove = R0.bind(this), this._interceptControlDown = U0.bind(this), this._interceptControlUp = N0.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
+ super(e, t), this.state = st.NONE, this.target = new w(), this.cursor = new w(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: kr.ROTATE, MIDDLE: kr.DOLLY, RIGHT: kr.PAN }, this.touches = { ONE: Br.ROTATE, TWO: Br.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new w(), this._lastQuaternion = new gi(), this._lastTargetPosition = new w(), this._quat = new gi().setFromUnitVectors(e.up, new w(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new ic(), this._sphericalDelta = new ic(), this._scale = 1, this._panOffset = new w(), this._rotateStart = new oe(), this._rotateEnd = new oe(), this._rotateDelta = new oe(), this._panStart = new oe(), this._panEnd = new oe(), this._panDelta = new oe(), this._dollyStart = new oe(), this._dollyEnd = new oe(), this._dollyDelta = new oe(), this._dollyDirection = new w(), this._mouse = new oe(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = E0.bind(this), this._onPointerDown = S0.bind(this), this._onPointerUp = w0.bind(this), this._onContextMenu = I0.bind(this), this._onMouseWheel = A0.bind(this), this._onKeyDown = P0.bind(this), this._onTouchStart = D0.bind(this), this._onTouchMove = L0.bind(this), this._onMouseDown = C0.bind(this), this._onMouseMove = R0.bind(this), this._interceptControlDown = U0.bind(this), this._interceptControlUp = N0.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
}
connect(e) {
super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, { passive: !0, capture: !0 }), this.domElement.style.touchAction = "none";
@@ -28409,7 +28427,7 @@ class Lh extends fp {
}
update(e = null) {
const t = this.object.position;
- Mt.copy(t).sub(this.target), Mt.applyQuaternion(this._quat), this._spherical.setFromVector3(Mt), this.autoRotate && this.state === st.NONE && this._rotateLeft(this._getAutoRotationAngle(e)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
+ bt.copy(t).sub(this.target), bt.applyQuaternion(this._quat), this._spherical.setFromVector3(bt), this.autoRotate && this.state === st.NONE && this._rotateLeft(this._getAutoRotationAngle(e)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
let i = this.minAzimuthAngle, r = this.maxAzimuthAngle;
isFinite(i) && isFinite(r) && (i < -Math.PI ? i += Gt : i > Math.PI && (i -= Gt), r < -Math.PI ? r += Gt : r > Math.PI && (r -= Gt), i <= r ? this._spherical.theta = Math.max(i, Math.min(r, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (i + r) / 2 ? Math.max(i, this._spherical.theta) : Math.min(r, this._spherical.theta)), this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)), this._spherical.makeSafe(), this.enableDamping === !0 ? this.target.addScaledVector(this._panOffset, this.dampingFactor) : this.target.add(this._panOffset), this.target.sub(this.cursor), this.target.clampLength(this.minTargetRadius, this.maxTargetRadius), this.target.add(this.cursor);
let n = !1;
@@ -28419,10 +28437,10 @@ class Lh extends fp {
const a = this._spherical.radius;
this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), n = a != this._spherical.radius;
}
- if (Mt.setFromSpherical(this._spherical), Mt.applyQuaternion(this._quatInverse), t.copy(this.target).add(Mt), this.object.lookAt(this.target), this.enableDamping === !0 ? (this._sphericalDelta.theta *= 1 - this.dampingFactor, this._sphericalDelta.phi *= 1 - this.dampingFactor, this._panOffset.multiplyScalar(1 - this.dampingFactor)) : (this._sphericalDelta.set(0, 0, 0), this._panOffset.set(0, 0, 0)), this.zoomToCursor && this._performCursorZoom) {
+ if (bt.setFromSpherical(this._spherical), bt.applyQuaternion(this._quatInverse), t.copy(this.target).add(bt), this.object.lookAt(this.target), this.enableDamping === !0 ? (this._sphericalDelta.theta *= 1 - this.dampingFactor, this._sphericalDelta.phi *= 1 - this.dampingFactor, this._panOffset.multiplyScalar(1 - this.dampingFactor)) : (this._sphericalDelta.set(0, 0, 0), this._panOffset.set(0, 0, 0)), this.zoomToCursor && this._performCursorZoom) {
let a = null;
if (this.object.isPerspectiveCamera) {
- const o = Mt.length();
+ const o = bt.length();
a = this._clampDistance(o * this._scale);
const l = o - a;
this.object.position.addScaledVector(this._dollyDirection, l), this.object.updateMatrixWorld(), n = !!l;
@@ -28432,7 +28450,7 @@ class Lh extends fp {
const l = this.object.zoom;
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), n = l !== this.object.zoom;
const c = new w(this._mouse.x, this._mouse.y, 0);
- c.unproject(this.object), this.object.position.sub(c).add(o), this.object.updateMatrixWorld(), a = Mt.length();
+ c.unproject(this.object), this.object.position.sub(c).add(o), this.object.updateMatrixWorld(), a = bt.length();
} else
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
a !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position) : (mn.origin.copy(this.object.position), mn.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(mn.direction)) < T0 ? this.object.lookAt(this.target) : (Pc.setFromNormalAndCoplanarPoint(this.object.up, this.target), mn.intersectPlane(Pc, this.target))));
@@ -28440,7 +28458,7 @@ class Lh extends fp {
const a = this.object.zoom;
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), a !== this.object.zoom && (this.object.updateProjectionMatrix(), n = !0);
}
- return this._scale = 1, this._performCursorZoom = !1, n || this._lastPosition.distanceToSquared(this.object.position) > Ma || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > Ma || this._lastTargetPosition.distanceToSquared(this.target) > Ma ? (this.dispatchEvent(Ac), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
+ return this._scale = 1, this._performCursorZoom = !1, n || this._lastPosition.distanceToSquared(this.object.position) > ba || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > ba || this._lastTargetPosition.distanceToSquared(this.target) > ba ? (this.dispatchEvent(Ac), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
}
_getAutoRotationAngle(e) {
return e !== null ? Gt / 60 * this.autoRotateSpeed * e : Gt / 60 / 60 * this.autoRotateSpeed;
@@ -28456,18 +28474,18 @@ class Lh extends fp {
this._sphericalDelta.phi -= e;
}
_panLeft(e, t) {
- Mt.setFromMatrixColumn(t, 0), Mt.multiplyScalar(-e), this._panOffset.add(Mt);
+ bt.setFromMatrixColumn(t, 0), bt.multiplyScalar(-e), this._panOffset.add(bt);
}
_panUp(e, t) {
- this.screenSpacePanning === !0 ? Mt.setFromMatrixColumn(t, 1) : (Mt.setFromMatrixColumn(t, 0), Mt.crossVectors(this.object.up, Mt)), Mt.multiplyScalar(e), this._panOffset.add(Mt);
+ this.screenSpacePanning === !0 ? bt.setFromMatrixColumn(t, 1) : (bt.setFromMatrixColumn(t, 0), bt.crossVectors(this.object.up, bt)), bt.multiplyScalar(e), this._panOffset.add(bt);
}
// deltaX and deltaY are in pixels; right and down are positive
_pan(e, t) {
const i = this.domElement;
if (this.object.isPerspectiveCamera) {
const r = this.object.position;
- Mt.copy(r).sub(this.target);
- let n = Mt.length();
+ bt.copy(r).sub(this.target);
+ let n = bt.length();
n *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * e * n / i.clientHeight, this.object.matrix), this._panUp(2 * t * n / i.clientHeight, this.object.matrix);
} else this.object.isOrthographicCamera ? (this._panLeft(e * (this.object.right - this.object.left) / this.object.zoom / i.clientWidth, this.object.matrix), this._panUp(t * (this.object.top - this.object.bottom) / this.object.zoom / i.clientHeight, this.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), this.enablePan = !1);
}
@@ -28665,11 +28683,11 @@ function C0(s) {
e = -1;
}
switch (e) {
- case Fr.DOLLY:
+ case kr.DOLLY:
if (this.enableZoom === !1) return;
this._handleMouseDownDolly(s), this.state = st.DOLLY;
break;
- case Fr.ROTATE:
+ case kr.ROTATE:
if (s.ctrlKey || s.metaKey || s.shiftKey) {
if (this.enablePan === !1) return;
this._handleMouseDownPan(s), this.state = st.PAN;
@@ -28678,7 +28696,7 @@ function C0(s) {
this._handleMouseDownRotate(s), this.state = st.ROTATE;
}
break;
- case Fr.PAN:
+ case kr.PAN:
if (s.ctrlKey || s.metaKey || s.shiftKey) {
if (this.enableRotate === !1) return;
this._handleMouseDownRotate(s), this.state = st.ROTATE;
@@ -28718,11 +28736,11 @@ function D0(s) {
switch (this._trackPointer(s), this._pointers.length) {
case 1:
switch (this.touches.ONE) {
- case Or.ROTATE:
+ case Br.ROTATE:
if (this.enableRotate === !1) return;
this._handleTouchStartRotate(s), this.state = st.TOUCH_ROTATE;
break;
- case Or.PAN:
+ case Br.PAN:
if (this.enablePan === !1) return;
this._handleTouchStartPan(s), this.state = st.TOUCH_PAN;
break;
@@ -28732,11 +28750,11 @@ function D0(s) {
break;
case 2:
switch (this.touches.TWO) {
- case Or.DOLLY_PAN:
+ case Br.DOLLY_PAN:
if (this.enableZoom === !1 && this.enablePan === !1) return;
this._handleTouchStartDollyPan(s), this.state = st.TOUCH_DOLLY_PAN;
break;
- case Or.DOLLY_ROTATE:
+ case Br.DOLLY_ROTATE:
if (this.enableZoom === !1 && this.enableRotate === !1) return;
this._handleTouchStartDollyRotate(s), this.state = st.TOUCH_DOLLY_ROTATE;
break;
@@ -28780,13 +28798,13 @@ function U0(s) {
function N0(s) {
s.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
}
-var Hr = /* @__PURE__ */ ((s) => (s.Top = "top", s.Bottom = "bottom", s.Left = "left", s.Right = "right", s.Front = "front", s.Back = "back", s.Iso = "iso", s))(Hr || {}), Br = /* @__PURE__ */ ((s) => (s.Perspective = "perspective", s.Orthographic = "orthographic", s))(Br || {}), Dn = /* @__PURE__ */ ((s) => (s.Orbit = "orbit", s.FirstPerson = "walk", s.PanOnly = "pan_only", s))(Dn || {});
+var Vr = /* @__PURE__ */ ((s) => (s.Top = "top", s.Bottom = "bottom", s.Left = "left", s.Right = "right", s.Front = "front", s.Back = "back", s.Iso = "iso", s))(Vr || {}), Fr = /* @__PURE__ */ ((s) => (s.Perspective = "perspective", s.Orthographic = "orthographic", s))(Fr || {}), Dn = /* @__PURE__ */ ((s) => (s.Orbit = "orbit", s.FirstPerson = "walk", s.PanOnly = "pan_only", s))(Dn || {});
class O0 {
camera;
controls;
engineState;
constructor(e, t, i, r) {
- this.engineState = r, this.camera = new bt(45, t / i, 0.1, 1e4), this.camera.position.set(20, 20, 20), this.controls = new Lh(this.camera, e, this.engineState), this.controls.enableDamping = !0, this.controls.dampingFactor = 0.05;
+ this.engineState = r, this.camera = new Mt(45, t / i, 0.1, 1e4), this.camera.position.set(20, 20, 20), this.controls = new Lh(this.camera, e, this.engineState), this.controls.enableDamping = !0, this.controls.dampingFactor = 0.05;
}
updateAspect(e, t) {
this.camera.aspect = e / t, this.camera.updateProjectionMatrix();
@@ -28797,15 +28815,15 @@ class O0 {
setView(e) {
const t = this.camera.position.length();
switch (e) {
- case Hr.Top:
+ case Vr.Top:
case "top":
this.camera.position.set(0, t, 0);
break;
- case Hr.Front:
+ case Vr.Front:
case "front":
this.camera.position.set(0, 0, t);
break;
- case Hr.Iso:
+ case Vr.Iso:
case "iso":
this.camera.position.set(t / Math.sqrt(3), t / Math.sqrt(3), t / Math.sqrt(3));
break;
@@ -28814,7 +28832,7 @@ class O0 {
}
}
function Dc(s, e) {
- if (e === Mu)
+ if (e === bu)
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), s;
if (e === po || e === rh) {
let t = s.getIndex();
@@ -29105,7 +29123,7 @@ class F0 {
const n = t.json, a = ((n.extensions && n.extensions[this.name] || {}).lights || [])[e];
let o;
const l = new _e(16777215);
- a.color !== void 0 && l.setRGB(a.color[0], a.color[1], a.color[2], Nt);
+ a.color !== void 0 && l.setRGB(a.color[0], a.color[1], a.color[2], Ot);
const c = a.range !== void 0 ? a.range : 0;
switch (a.type) {
case "directional":
@@ -29147,7 +29165,7 @@ class k0 {
if (n) {
if (Array.isArray(n.baseColorFactor)) {
const a = n.baseColorFactor;
- e.color.setRGB(a[0], a[1], a[2], Nt), e.opacity = a[3];
+ e.color.setRGB(a[0], a[1], a[2], Ot), e.opacity = a[3];
}
n.baseColorTexture !== void 0 && r.push(i.assignTexture(e, "map", n.baseColorTexture, Ct));
}
@@ -29172,7 +29190,7 @@ class H0 {
}
getMaterialType(e) {
const t = this.parser.json.materials[e];
- return !t.extensions || !t.extensions[this.name] ? null : Ai;
+ return !t.extensions || !t.extensions[this.name] ? null : Di;
}
extendMaterialParams(e, t) {
const i = this.parser, r = i.json.materials[e];
@@ -29192,7 +29210,7 @@ class V0 {
}
getMaterialType(e) {
const t = this.parser.json.materials[e];
- return !t.extensions || !t.extensions[this.name] ? null : Ai;
+ return !t.extensions || !t.extensions[this.name] ? null : Di;
}
extendMaterialParams(e, t) {
const i = this.parser.json.materials[e];
@@ -29208,7 +29226,7 @@ class G0 {
}
getMaterialType(e) {
const t = this.parser.json.materials[e];
- return !t.extensions || !t.extensions[this.name] ? null : Ai;
+ return !t.extensions || !t.extensions[this.name] ? null : Di;
}
extendMaterialParams(e, t) {
const i = this.parser, r = i.json.materials[e];
@@ -29224,7 +29242,7 @@ class W0 {
}
getMaterialType(e) {
const t = this.parser.json.materials[e];
- return !t.extensions || !t.extensions[this.name] ? null : Ai;
+ return !t.extensions || !t.extensions[this.name] ? null : Di;
}
extendMaterialParams(e, t) {
const i = this.parser, r = i.json.materials[e];
@@ -29235,7 +29253,7 @@ class W0 {
const a = r.extensions[this.name];
if (a.sheenColorFactor !== void 0) {
const o = a.sheenColorFactor;
- t.sheenColor.setRGB(o[0], o[1], o[2], Nt);
+ t.sheenColor.setRGB(o[0], o[1], o[2], Ot);
}
return a.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = a.sheenRoughnessFactor), a.sheenColorTexture !== void 0 && n.push(i.assignTexture(t, "sheenColorMap", a.sheenColorTexture, Ct)), a.sheenRoughnessTexture !== void 0 && n.push(i.assignTexture(t, "sheenRoughnessMap", a.sheenRoughnessTexture)), Promise.all(n);
}
@@ -29246,7 +29264,7 @@ class j0 {
}
getMaterialType(e) {
const t = this.parser.json.materials[e];
- return !t.extensions || !t.extensions[this.name] ? null : Ai;
+ return !t.extensions || !t.extensions[this.name] ? null : Di;
}
extendMaterialParams(e, t) {
const i = this.parser, r = i.json.materials[e];
@@ -29262,7 +29280,7 @@ class X0 {
}
getMaterialType(e) {
const t = this.parser.json.materials[e];
- return !t.extensions || !t.extensions[this.name] ? null : Ai;
+ return !t.extensions || !t.extensions[this.name] ? null : Di;
}
extendMaterialParams(e, t) {
const i = this.parser, r = i.json.materials[e];
@@ -29271,7 +29289,7 @@ class X0 {
const n = [], a = r.extensions[this.name];
t.thickness = a.thicknessFactor !== void 0 ? a.thicknessFactor : 0, a.thicknessTexture !== void 0 && n.push(i.assignTexture(t, "thicknessMap", a.thicknessTexture)), t.attenuationDistance = a.attenuationDistance || 1 / 0;
const o = a.attenuationColor || [1, 1, 1];
- return t.attenuationColor = new _e().setRGB(o[0], o[1], o[2], Nt), Promise.all(n);
+ return t.attenuationColor = new _e().setRGB(o[0], o[1], o[2], Ot), Promise.all(n);
}
}
class q0 {
@@ -29280,7 +29298,7 @@ class q0 {
}
getMaterialType(e) {
const t = this.parser.json.materials[e];
- return !t.extensions || !t.extensions[this.name] ? null : Ai;
+ return !t.extensions || !t.extensions[this.name] ? null : Di;
}
extendMaterialParams(e, t) {
const i = this.parser.json.materials[e];
@@ -29296,7 +29314,7 @@ class Y0 {
}
getMaterialType(e) {
const t = this.parser.json.materials[e];
- return !t.extensions || !t.extensions[this.name] ? null : Ai;
+ return !t.extensions || !t.extensions[this.name] ? null : Di;
}
extendMaterialParams(e, t) {
const i = this.parser, r = i.json.materials[e];
@@ -29305,7 +29323,7 @@ class Y0 {
const n = [], a = r.extensions[this.name];
t.specularIntensity = a.specularFactor !== void 0 ? a.specularFactor : 1, a.specularTexture !== void 0 && n.push(i.assignTexture(t, "specularIntensityMap", a.specularTexture));
const o = a.specularColorFactor || [1, 1, 1];
- return t.specularColor = new _e().setRGB(o[0], o[1], o[2], Nt), a.specularColorTexture !== void 0 && n.push(i.assignTexture(t, "specularColorMap", a.specularColorTexture, Ct)), Promise.all(n);
+ return t.specularColor = new _e().setRGB(o[0], o[1], o[2], Ot), a.specularColorTexture !== void 0 && n.push(i.assignTexture(t, "specularColorMap", a.specularColorTexture, Ct)), Promise.all(n);
}
}
class K0 {
@@ -29314,7 +29332,7 @@ class K0 {
}
getMaterialType(e) {
const t = this.parser.json.materials[e];
- return !t.extensions || !t.extensions[this.name] ? null : Ai;
+ return !t.extensions || !t.extensions[this.name] ? null : Di;
}
extendMaterialParams(e, t) {
const i = this.parser, r = i.json.materials[e];
@@ -29330,7 +29348,7 @@ class Z0 {
}
getMaterialType(e) {
const t = this.parser.json.materials[e];
- return !t.extensions || !t.extensions[this.name] ? null : Ai;
+ return !t.extensions || !t.extensions[this.name] ? null : Di;
}
extendMaterialParams(e, t) {
const i = this.parser, r = i.json.materials[e];
@@ -29490,13 +29508,13 @@ class r_ {
decodePrimitive(e, t) {
const i = this.json, r = this.dracoLoader, n = e.extensions[this.name].bufferView, a = e.extensions[this.name].attributes, o = {}, l = {}, c = {};
for (const h in a) {
- const u = bo[h] || h.toLowerCase();
+ const u = Mo[h] || h.toLowerCase();
o[u] = a[h];
}
for (const h in e.attributes) {
- const u = bo[h] || h.toLowerCase();
+ const u = Mo[h] || h.toLowerCase();
if (a[h] !== void 0) {
- const d = i.accessors[e.attributes[h]], f = Vr[d.componentType];
+ const d = i.accessors[e.attributes[h]], f = Gr[d.componentType];
c[u] = f.name, l[u] = d.normalized === !0;
}
}
@@ -29508,7 +29526,7 @@ class r_ {
m !== void 0 && (v.normalized = m);
}
u(f);
- }, o, c, Nt, d);
+ }, o, c, Ot, d);
});
});
}
@@ -29560,7 +29578,7 @@ const Jt = {
TRIANGLES: 4,
TRIANGLE_STRIP: 5,
TRIANGLE_FAN: 6
-}, Vr = {
+}, Gr = {
5120: Int8Array,
5121: Uint8Array,
5122: Int16Array,
@@ -29568,7 +29586,7 @@ const Jt = {
5125: Uint32Array,
5126: Float32Array
}, Ic = {
- 9728: Lt,
+ 9728: It,
9729: yt,
9984: Zc,
9985: gn,
@@ -29577,8 +29595,8 @@ const Jt = {
}, Uc = {
33071: Qt,
33648: Sn,
- 10497: wi
-}, ba = {
+ 10497: Ri
+}, Ma = {
SCALAR: 1,
VEC2: 2,
VEC3: 3,
@@ -29586,7 +29604,7 @@ const Jt = {
MAT2: 4,
MAT3: 9,
MAT4: 16
-}, bo = {
+}, Mo = {
POSITION: "position",
NORMAL: "normal",
TANGENT: "tangent",
@@ -29597,7 +29615,7 @@ const Jt = {
COLOR_0: "color",
WEIGHTS_0: "skinWeight",
JOINTS_0: "skinIndex"
-}, Zi = {
+}, $i = {
scale: "scale",
translation: "position",
rotation: "quaternion",
@@ -29621,7 +29639,7 @@ function c_(s) {
roughness: 1,
transparent: !1,
depthTest: !0,
- side: Ei
+ side: Ci
})), s.DefaultMaterial;
}
function pr(s, e, t) {
@@ -29720,7 +29738,7 @@ class m_ {
const l = o.match(/Version\/(\d+)/);
r = i && l ? parseInt(l[1], 10) : -1, n = o.indexOf("Firefox") > -1, a = n ? o.match(/Firefox\/([0-9]+)\./)[1] : -1;
}
- typeof createImageBitmap > "u" || i && r < 17 || n && a < 98 ? this.textureLoader = new bh(this.options.manager) : this.textureLoader = new ip(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new Ko(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
+ typeof createImageBitmap > "u" || i && r < 17 || n && a < 98 ? this.textureLoader = new Mh(this.options.manager) : this.textureLoader = new ip(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new Ko(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
}
setExtensions(e) {
this.extensions = e;
@@ -29960,21 +29978,21 @@ class m_ {
loadAccessor(e) {
const t = this, i = this.json, r = this.json.accessors[e];
if (r.bufferView === void 0 && r.sparse === void 0) {
- const a = ba[r.type], o = Vr[r.componentType], l = r.normalized === !0, c = new o(r.count * a);
+ const a = Ma[r.type], o = Gr[r.componentType], l = r.normalized === !0, c = new o(r.count * a);
return Promise.resolve(new Ht(c, a, l));
}
const n = [];
return r.bufferView !== void 0 ? n.push(this.getDependency("bufferView", r.bufferView)) : n.push(null), r.sparse !== void 0 && (n.push(this.getDependency("bufferView", r.sparse.indices.bufferView)), n.push(this.getDependency("bufferView", r.sparse.values.bufferView))), Promise.all(n).then(function(a) {
- const o = a[0], l = ba[r.type], c = Vr[r.componentType], h = c.BYTES_PER_ELEMENT, u = h * l, d = r.byteOffset || 0, f = r.bufferView !== void 0 ? i.bufferViews[r.bufferView].byteStride : void 0, g = r.normalized === !0;
+ const o = a[0], l = Ma[r.type], c = Gr[r.componentType], h = c.BYTES_PER_ELEMENT, u = h * l, d = r.byteOffset || 0, f = r.bufferView !== void 0 ? i.bufferViews[r.bufferView].byteStride : void 0, g = r.normalized === !0;
let v, m;
if (f && f !== u) {
const p = Math.floor(d / f), y = "InterleavedBuffer:" + r.bufferView + ":" + r.componentType + ":" + p + ":" + r.count;
let _ = t.cache.get(y);
- _ || (v = new c(o, p * f, r.count * f / h), _ = new bd(v, f / h), t.cache.add(y, _)), m = new Go(_, l, d % f / h, g);
+ _ || (v = new c(o, p * f, r.count * f / h), _ = new Md(v, f / h), t.cache.add(y, _)), m = new Go(_, l, d % f / h, g);
} else
o === null ? v = new c(r.count * l) : v = new c(o, d, r.count * l), m = new Ht(v, l, g);
if (r.sparse !== void 0) {
- const p = ba.SCALAR, y = Vr[r.sparse.indices.componentType], _ = r.sparse.indices.byteOffset || 0, E = r.sparse.values.byteOffset || 0, A = new y(a[1], _, r.sparse.count * p), S = new c(a[2], E, r.sparse.count * l);
+ const p = Ma.SCALAR, y = Gr[r.sparse.indices.componentType], _ = r.sparse.indices.byteOffset || 0, E = r.sparse.values.byteOffset || 0, A = new y(a[1], _, r.sparse.count * p), S = new c(a[2], E, r.sparse.count * l);
o !== null && (m = new Ht(m.array.slice(), m.itemSize, m.normalized)), m.normalized = !1;
for (let R = 0, I = A.length; R < I; R++) {
const T = A[R];
@@ -30008,7 +30026,7 @@ class m_ {
const c = this.loadImageSource(t, i).then(function(h) {
h.flipY = !1, h.name = a.name || o.name || "", h.name === "" && typeof o.uri == "string" && o.uri.startsWith("data:image/") === !1 && (h.name = o.uri);
const u = (n.samplers || {})[a.sampler] || {};
- return h.magFilter = Ic[u.magFilter] || yt, h.minFilter = Ic[u.minFilter] || Ti, h.wrapS = Uc[u.wrapS] || wi, h.wrapT = Uc[u.wrapT] || wi, h.generateMipmaps = !h.isCompressedTexture && h.minFilter !== Lt && h.minFilter !== yt, r.associations.set(h, { textures: e }), h;
+ return h.magFilter = Ic[u.magFilter] || yt, h.minFilter = Ic[u.minFilter] || Ti, h.wrapS = Uc[u.wrapS] || Ri, h.wrapT = Uc[u.wrapT] || Ri, h.generateMipmaps = !h.isCompressedTexture && h.minFilter !== It && h.minFilter !== yt, r.associations.set(h, { textures: e }), h;
}).catch(function() {
return null;
});
@@ -30119,7 +30137,7 @@ class m_ {
const u = n.pbrMetallicRoughness || {};
if (o.color = new _e(1, 1, 1), o.opacity = 1, Array.isArray(u.baseColorFactor)) {
const d = u.baseColorFactor;
- o.color.setRGB(d[0], d[1], d[2], Nt), o.opacity = d[3];
+ o.color.setRGB(d[0], d[1], d[2], Ot), o.opacity = d[3];
}
u.baseColorTexture !== void 0 && c.push(t.assignTexture(o, "map", u.baseColorTexture, Ct)), o.metalness = u.metallicFactor !== void 0 ? u.metallicFactor : 1, o.roughness = u.roughnessFactor !== void 0 ? u.roughnessFactor : 1, u.metallicRoughnessTexture !== void 0 && (c.push(t.assignTexture(o, "metalnessMap", u.metallicRoughnessTexture)), c.push(t.assignTexture(o, "roughnessMap", u.metallicRoughnessTexture))), a = this._invokeOne(function(d) {
return d.getMaterialType && d.getMaterialType(e);
@@ -30135,7 +30153,7 @@ class m_ {
}
if (n.occlusionTexture !== void 0 && a !== kt && (c.push(t.assignTexture(o, "aoMap", n.occlusionTexture)), n.occlusionTexture.strength !== void 0 && (o.aoMapIntensity = n.occlusionTexture.strength)), n.emissiveFactor !== void 0 && a !== kt) {
const u = n.emissiveFactor;
- o.emissive = new _e().setRGB(u[0], u[1], u[2], Nt);
+ o.emissive = new _e().setRGB(u[0], u[1], u[2], Ot);
}
return n.emissiveTexture !== void 0 && a !== kt && c.push(t.assignTexture(o, "emissiveMap", n.emissiveTexture, Ct)), Promise.all(c).then(function() {
const u = new a(o);
@@ -30221,7 +30239,7 @@ class m_ {
});
if (u.length === 1)
return n.extensions && pr(r, u[0], n), u[0];
- const d = new zi();
+ const d = new Vi();
n.extensions && pr(r, d, n), t.associations.set(d, { meshes: e });
for (let f = 0, g = u.length; f < g; f++)
d.add(u[f]);
@@ -30242,7 +30260,7 @@ class m_ {
console.warn("THREE.GLTFLoader: Missing camera parameters.");
return;
}
- return i.type === "perspective" ? t = new bt(Fo.radToDeg(r.yfov), r.aspectRatio || 1, r.znear || 1, r.zfar || 2e6) : i.type === "orthographic" && (t = new vr(-r.xmag, r.xmag, r.ymag, -r.ymag, r.znear, r.zfar)), i.name && (t.name = this.createUniqueName(i.name)), yi(t, i), Promise.resolve(t);
+ return i.type === "perspective" ? t = new Mt(Fo.radToDeg(r.yfov), r.aspectRatio || 1, r.znear || 1, r.zfar || 2e6) : i.type === "orthographic" && (t = new vr(-r.xmag, r.xmag, r.ymag, -r.ymag, r.znear, r.zfar)), i.name && (t.name = this.createUniqueName(i.name)), yi(t, i), Promise.resolve(t);
}
/**
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
@@ -30294,10 +30312,10 @@ class m_ {
const A = d[_], S = f[_], R = g[_], I = v[_], T = m[_];
if (A === void 0) continue;
A.updateMatrix && A.updateMatrix();
- const b = i._createAnimationTracks(A, S, R, I, T);
- if (b)
- for (let D = 0; D < b.length; D++)
- p.push(b[D]);
+ const M = i._createAnimationTracks(A, S, R, I, T);
+ if (M)
+ for (let D = 0; D < M.length; D++)
+ p.push(M[D]);
}
const y = new Wd(n, void 0, p);
return yi(y, r), y;
@@ -30357,7 +30375,7 @@ class m_ {
o.push(c);
}), this.nodeCache[e] = Promise.all(o).then(function(c) {
let h;
- if (n.isBone === !0 ? h = new ph() : c.length > 1 ? h = new zi() : c.length === 1 ? h = c[0] : h = new dt(), h !== c[0])
+ if (n.isBone === !0 ? h = new ph() : c.length > 1 ? h = new Vi() : c.length === 1 ? h = c[0] : h = new dt(), h !== c[0])
for (let u = 0, d = c.length; u < d; u++)
h.add(c[u]);
if (n.name && (h.userData.name = n.name, h.name = a), yi(h, n), n.extensions && pr(i, h, n), n.matrix !== void 0) {
@@ -30382,7 +30400,7 @@ class m_ {
* @return {Promise}
*/
loadScene(e) {
- const t = this.extensions, i = this.json.scenes[e], r = this, n = new zi();
+ const t = this.extensions, i = this.json.scenes[e], r = this, n = new Vi();
i.name && (n.name = r.createUniqueName(i.name)), yi(n, i), i.extensions && pr(t, n, i);
const a = i.nodes || [], o = [];
for (let l = 0, c = a.length; l < c; l++)
@@ -30404,30 +30422,30 @@ class m_ {
}
_createAnimationTracks(e, t, i, r, n) {
const a = [], o = e.name ? e.name : e.uuid, l = [];
- Zi[n.path] === Zi.weights ? e.traverse(function(d) {
+ $i[n.path] === $i.weights ? e.traverse(function(d) {
d.morphTargetInfluences && l.push(d.name ? d.name : d.uuid);
}) : l.push(o);
let c;
- switch (Zi[n.path]) {
- case Zi.weights:
- c = $r;
- break;
- case Zi.rotation:
+ switch ($i[n.path]) {
+ case $i.weights:
c = Jr;
break;
- case Zi.translation:
- case Zi.scale:
+ case $i.rotation:
c = Qr;
break;
+ case $i.translation:
+ case $i.scale:
+ c = es;
+ break;
default:
switch (i.itemSize) {
case 1:
- c = $r;
+ c = Jr;
break;
case 2:
case 3:
default:
- c = Qr;
+ c = es;
break;
}
break;
@@ -30435,7 +30453,7 @@ class m_ {
const h = r.interpolation !== void 0 ? l_[r.interpolation] : Rs, u = this._getArrayFromAccessor(i);
for (let d = 0, f = l.length; d < f; d++) {
const g = new c(
- l[d] + "." + Zi[n.path],
+ l[d] + "." + $i[n.path],
t.array,
u,
h
@@ -30456,7 +30474,7 @@ class m_ {
}
_createCubicSplineTrackInterpolant(e) {
e.createInterpolant = function(t) {
- const i = this instanceof Jr ? o_ : Nh;
+ const i = this instanceof Qr ? o_ : Nh;
return new i(this.times, this.values, this.getValueSize() / 3, t);
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
}
@@ -30470,7 +30488,7 @@ function g_(s, e, t) {
new w(l[0], l[1], l[2]),
new w(c[0], c[1], c[2])
), o.normalized) {
- const h = To(Vr[o.componentType]);
+ const h = To(Gr[o.componentType]);
r.min.multiplyScalar(h), r.max.multiplyScalar(h);
}
} else {
@@ -30488,7 +30506,7 @@ function g_(s, e, t) {
const d = t.json.accessors[u.POSITION], f = d.min, g = d.max;
if (f !== void 0 && g !== void 0) {
if (l.setX(Math.max(Math.abs(f[0]), Math.abs(g[0]))), l.setY(Math.max(Math.abs(f[1]), Math.abs(g[1]))), l.setZ(Math.max(Math.abs(f[2]), Math.abs(g[2]))), d.normalized) {
- const v = To(Vr[d.componentType]);
+ const v = To(Gr[d.componentType]);
l.multiplyScalar(v);
}
o.max(l);
@@ -30499,7 +30517,7 @@ function g_(s, e, t) {
r.expandByVector(o);
}
s.boundingBox = r;
- const a = new Ri();
+ const a = new Pi();
r.getCenter(a.center), a.radius = r.min.distanceTo(r.max) / 2, s.boundingSphere = a;
}
function Nc(s, e, t) {
@@ -30510,7 +30528,7 @@ function Nc(s, e, t) {
});
}
for (const a in i) {
- const o = bo[a] || a.toLowerCase();
+ const o = Mo[a] || a.toLowerCase();
o in s.attributes || r.push(n(i[a], o));
}
if (e.indices !== void 0 && !s.index) {
@@ -30519,7 +30537,7 @@ function Nc(s, e, t) {
});
r.push(a);
}
- return Xe.workingColorSpace !== Nt && "COLOR_0" in i && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Xe.workingColorSpace}" not supported.`), yi(s, e), g_(s, e, t), Promise.all(r).then(function() {
+ return Xe.workingColorSpace !== Ot && "COLOR_0" in i && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Xe.workingColorSpace}" not supported.`), yi(s, e), g_(s, e, t), Promise.all(r).then(function() {
return e.targets !== void 0 ? h_(s, e.targets, t) : s;
});
}
@@ -30778,7 +30796,7 @@ class __ {
});
}
}
-class Qi extends sr {
+class er extends sr {
/**
* Constructs a new outline pass.
*
@@ -30794,7 +30812,7 @@ class Qi extends sr {
this.renderTargetMaskBuffer = new xt(this.resolution.x, this.resolution.y), this.renderTargetMaskBuffer.texture.name = "OutlinePass.mask", this.renderTargetMaskBuffer.texture.generateMipmaps = !1, this.depthMaterial = new vh(), this.depthMaterial.side = Wt, this.depthMaterial.depthPacking = sh, this.depthMaterial.blending = _t, this.prepareMaskMaterial = this._getPrepareMaskMaterial(), this.prepareMaskMaterial.side = Wt, this.prepareMaskMaterial.fragmentShader = h(this.prepareMaskMaterial.fragmentShader, this.renderCamera), this.renderTargetDepthBuffer = new xt(this.resolution.x, this.resolution.y, { type: mt }), this.renderTargetDepthBuffer.texture.name = "OutlinePass.depth", this.renderTargetDepthBuffer.texture.generateMipmaps = !1, this.renderTargetMaskDownSampleBuffer = new xt(n, a, { type: mt }), this.renderTargetMaskDownSampleBuffer.texture.name = "OutlinePass.depthDownSample", this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps = !1, this.renderTargetBlurBuffer1 = new xt(n, a, { type: mt }), this.renderTargetBlurBuffer1.texture.name = "OutlinePass.blur1", this.renderTargetBlurBuffer1.texture.generateMipmaps = !1, this.renderTargetBlurBuffer2 = new xt(Math.round(n / 2), Math.round(a / 2), { type: mt }), this.renderTargetBlurBuffer2.texture.name = "OutlinePass.blur2", this.renderTargetBlurBuffer2.texture.generateMipmaps = !1, this.edgeDetectionMaterial = this._getEdgeDetectionMaterial(), this.renderTargetEdgeBuffer1 = new xt(n, a, { type: mt }), this.renderTargetEdgeBuffer1.texture.name = "OutlinePass.edge1", this.renderTargetEdgeBuffer1.texture.generateMipmaps = !1, this.renderTargetEdgeBuffer2 = new xt(Math.round(n / 2), Math.round(a / 2), { type: mt }), this.renderTargetEdgeBuffer2.texture.name = "OutlinePass.edge2", this.renderTargetEdgeBuffer2.texture.generateMipmaps = !1;
const o = 4, l = 4;
this.separableBlurMaterial1 = this._getSeparableBlurMaterial(o), this.separableBlurMaterial1.uniforms.texSize.value.set(n, a), this.separableBlurMaterial1.uniforms.kernelRadius.value = 1, this.separableBlurMaterial2 = this._getSeparableBlurMaterial(l), this.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(n / 2), Math.round(a / 2)), this.separableBlurMaterial2.uniforms.kernelRadius.value = l, this.overlayMaterial = this._getOverlayMaterial();
- const c = tr;
+ const c = ir;
this.copyUniforms = di.clone(c.uniforms), this.materialCopy = new ct({
uniforms: this.copyUniforms,
vertexShader: c.vertexShader,
@@ -30847,7 +30865,7 @@ class Qi extends sr {
const c = 0.625 + Math.cos(performance.now() * 0.01 / this.pulsePeriod) * 0.75 / 2;
this.tempPulseColor1.multiplyScalar(c), this.tempPulseColor2.multiplyScalar(c);
}
- this._fsQuad.material = this.edgeDetectionMaterial, this.edgeDetectionMaterial.uniforms.maskTexture.value = this.renderTargetMaskDownSampleBuffer.texture, this.edgeDetectionMaterial.uniforms.texSize.value.set(this.renderTargetMaskDownSampleBuffer.width, this.renderTargetMaskDownSampleBuffer.height), this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value = this.tempPulseColor1, this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value = this.tempPulseColor2, e.setRenderTarget(this.renderTargetEdgeBuffer1), e.clear(), this._fsQuad.render(e), this._fsQuad.material = this.separableBlurMaterial1, this.separableBlurMaterial1.uniforms.colorTexture.value = this.renderTargetEdgeBuffer1.texture, this.separableBlurMaterial1.uniforms.direction.value = Qi.BlurDirectionX, this.separableBlurMaterial1.uniforms.kernelRadius.value = this.edgeThickness, e.setRenderTarget(this.renderTargetBlurBuffer1), e.clear(), this._fsQuad.render(e), this.separableBlurMaterial1.uniforms.colorTexture.value = this.renderTargetBlurBuffer1.texture, this.separableBlurMaterial1.uniforms.direction.value = Qi.BlurDirectionY, e.setRenderTarget(this.renderTargetEdgeBuffer1), e.clear(), this._fsQuad.render(e), this._fsQuad.material = this.separableBlurMaterial2, this.separableBlurMaterial2.uniforms.colorTexture.value = this.renderTargetEdgeBuffer1.texture, this.separableBlurMaterial2.uniforms.direction.value = Qi.BlurDirectionX, e.setRenderTarget(this.renderTargetBlurBuffer2), e.clear(), this._fsQuad.render(e), this.separableBlurMaterial2.uniforms.colorTexture.value = this.renderTargetBlurBuffer2.texture, this.separableBlurMaterial2.uniforms.direction.value = Qi.BlurDirectionY, e.setRenderTarget(this.renderTargetEdgeBuffer2), e.clear(), this._fsQuad.render(e), this._fsQuad.material = this.overlayMaterial, this.overlayMaterial.uniforms.maskTexture.value = this.renderTargetMaskBuffer.texture, this.overlayMaterial.uniforms.edgeTexture1.value = this.renderTargetEdgeBuffer1.texture, this.overlayMaterial.uniforms.edgeTexture2.value = this.renderTargetEdgeBuffer2.texture, this.overlayMaterial.uniforms.patternTexture.value = this.patternTexture, this.overlayMaterial.uniforms.edgeStrength.value = this.edgeStrength, this.overlayMaterial.uniforms.edgeGlow.value = this.edgeGlow, this.overlayMaterial.uniforms.usePatternTexture.value = this.usePatternTexture, n && e.state.buffers.stencil.setTest(!0), e.setRenderTarget(i), this._fsQuad.render(e), e.setClearColor(this._oldClearColor, this.oldClearAlpha), e.autoClear = a;
+ this._fsQuad.material = this.edgeDetectionMaterial, this.edgeDetectionMaterial.uniforms.maskTexture.value = this.renderTargetMaskDownSampleBuffer.texture, this.edgeDetectionMaterial.uniforms.texSize.value.set(this.renderTargetMaskDownSampleBuffer.width, this.renderTargetMaskDownSampleBuffer.height), this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value = this.tempPulseColor1, this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value = this.tempPulseColor2, e.setRenderTarget(this.renderTargetEdgeBuffer1), e.clear(), this._fsQuad.render(e), this._fsQuad.material = this.separableBlurMaterial1, this.separableBlurMaterial1.uniforms.colorTexture.value = this.renderTargetEdgeBuffer1.texture, this.separableBlurMaterial1.uniforms.direction.value = er.BlurDirectionX, this.separableBlurMaterial1.uniforms.kernelRadius.value = this.edgeThickness, e.setRenderTarget(this.renderTargetBlurBuffer1), e.clear(), this._fsQuad.render(e), this.separableBlurMaterial1.uniforms.colorTexture.value = this.renderTargetBlurBuffer1.texture, this.separableBlurMaterial1.uniforms.direction.value = er.BlurDirectionY, e.setRenderTarget(this.renderTargetEdgeBuffer1), e.clear(), this._fsQuad.render(e), this._fsQuad.material = this.separableBlurMaterial2, this.separableBlurMaterial2.uniforms.colorTexture.value = this.renderTargetEdgeBuffer1.texture, this.separableBlurMaterial2.uniforms.direction.value = er.BlurDirectionX, e.setRenderTarget(this.renderTargetBlurBuffer2), e.clear(), this._fsQuad.render(e), this.separableBlurMaterial2.uniforms.colorTexture.value = this.renderTargetBlurBuffer2.texture, this.separableBlurMaterial2.uniforms.direction.value = er.BlurDirectionY, e.setRenderTarget(this.renderTargetEdgeBuffer2), e.clear(), this._fsQuad.render(e), this._fsQuad.material = this.overlayMaterial, this.overlayMaterial.uniforms.maskTexture.value = this.renderTargetMaskBuffer.texture, this.overlayMaterial.uniforms.edgeTexture1.value = this.renderTargetEdgeBuffer1.texture, this.overlayMaterial.uniforms.edgeTexture2.value = this.renderTargetEdgeBuffer2.texture, this.overlayMaterial.uniforms.patternTexture.value = this.patternTexture, this.overlayMaterial.uniforms.edgeStrength.value = this.edgeStrength, this.overlayMaterial.uniforms.edgeGlow.value = this.edgeGlow, this.overlayMaterial.uniforms.usePatternTexture.value = this.usePatternTexture, n && e.state.buffers.stencil.setTest(!0), e.setRenderTarget(i), this._fsQuad.render(e), e.setClearColor(this._oldClearColor, this.oldClearAlpha), e.autoClear = a;
}
this.renderToScreen && (this._fsQuad.material = this.materialCopy, this.copyUniforms.tDiffuse.value = i.texture, e.setRenderTarget(null), this._fsQuad.render(e));
}
@@ -31079,21 +31097,21 @@ class Qi extends sr {
finalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);
gl_FragColor = finalColor;
}`,
- blending: bn,
+ blending: Mn,
depthTest: !1,
depthWrite: !1,
transparent: !0
});
}
}
-Qi.BlurDirectionX = new oe(1, 0);
-Qi.BlurDirectionY = new oe(0, 1);
+er.BlurDirectionX = new oe(1, 0);
+er.BlurDirectionY = new oe(0, 1);
class x_ {
outlinePass;
hoveredObjects = [];
selectedObjects = [];
constructor(e, t, i, r) {
- this.outlinePass = new Qi(
+ this.outlinePass = new er(
new oe(i, r),
e,
t
@@ -31321,7 +31339,7 @@ class y_ {
window.removeEventListener("keydown", this.onKeyDown.bind(this)), window.removeEventListener("keyup", this.onKeyUp.bind(this)), this.canvas.removeEventListener("mousedown", this.onMouseDown.bind(this)), this.canvas.removeEventListener("mousemove", this.onMouseMove.bind(this)), this.canvas.removeEventListener("mouseup", this.onMouseUp.bind(this)), this.selectionBox && this.selectionBox.parentElement && this.selectionBox.parentElement.removeChild(this.selectionBox), this.clearSelection();
}
}
-class M_ {
+class b_ {
scene;
clippingPlane;
stencilGroup = null;
@@ -31333,7 +31351,7 @@ class M_ {
// 截面颜色 (主要颜色)
capColor = new _e(16711680);
constructor(e) {
- this.scene = e, this.clippingPlane = new Mi(new w(0, -1, 0), 0);
+ this.scene = e, this.clippingPlane = new bi(new w(0, -1, 0), 0);
}
/**
* 启用剖切功能
@@ -31391,7 +31409,7 @@ class M_ {
* 创建模板缓冲组
*/
createStencilGroup() {
- this.stencilGroup = new zi(), this.stencilGroup.name = "ClippingStencilGroup", this.scene.add(this.stencilGroup);
+ this.stencilGroup = new Vi(), this.stencilGroup.name = "ClippingStencilGroup", this.scene.add(this.stencilGroup);
let e = 0;
this.scene.traverse((t) => {
if (t instanceof nt && t.visible && !t.userData.isStencilCap) {
@@ -31415,7 +31433,7 @@ class M_ {
const a = new nt(t, n);
a.applyMatrix4(i), a.matrixAutoUpdate = !1, a.userData.isStencilCap = !0, a.renderOrder = 1, this.stencilGroup.add(a);
const o = r.clone();
- o.side = Ei, o.stencilFail = zn, o.stencilZFail = zn, o.stencilZPass = zn;
+ o.side = Ci, o.stencilFail = zn, o.stencilZFail = zn, o.stencilZPass = zn;
const l = new nt(t, o);
l.applyMatrix4(i), l.matrixAutoUpdate = !1, l.userData.isStencilCap = !0, l.renderOrder = 1, this.stencilGroup.add(l);
}
@@ -31459,7 +31477,7 @@ class M_ {
this.clippingPlane.constant = -e.dot(this.tempCenter), this.planeInitialized = !0, this.updateCapPlane();
}
}
-class b_ {
+class M_ {
// 用户最后一次左键点击的世界坐标(用作相机旋转中心)
_lastClickWorldPosition = null;
// 用户最后一次左键点击的屏幕坐标
@@ -31665,7 +31683,7 @@ function T_(s) {
};
}, e;
}
-var Gr = Object.freeze({
+var Wr = Object.freeze({
Linear: Object.freeze({
None: function(s) {
return s;
@@ -31784,13 +31802,13 @@ var Gr = Object.freeze({
}),
Bounce: Object.freeze({
In: function(s) {
- return 1 - Gr.Bounce.Out(1 - s);
+ return 1 - Wr.Bounce.Out(1 - s);
},
Out: function(s) {
return s < 1 / 2.75 ? 7.5625 * s * s : s < 2 / 2.75 ? 7.5625 * (s -= 1.5 / 2.75) * s + 0.75 : s < 2.5 / 2.75 ? 7.5625 * (s -= 2.25 / 2.75) * s + 0.9375 : 7.5625 * (s -= 2.625 / 2.75) * s + 0.984375;
},
InOut: function(s) {
- return s < 0.5 ? Gr.Bounce.In(s * 2) * 0.5 : Gr.Bounce.Out(s * 2 - 1) * 0.5 + 0.5;
+ return s < 0.5 ? Wr.Bounce.In(s * 2) * 0.5 : Wr.Bounce.Out(s * 2 - 1) * 0.5 + 0.5;
}
}),
generatePow: function(s) {
@@ -31806,7 +31824,7 @@ var Gr = Object.freeze({
}
};
}
-}), Ms = function() {
+}), bs = function() {
return performance.now();
}, S_ = (
/** @class */
@@ -31826,7 +31844,7 @@ var Gr = Object.freeze({
}, s.prototype.remove = function(e) {
delete this._tweens[e.getId()], delete this._tweensAddedDuringUpdate[e.getId()];
}, s.prototype.update = function(e, t) {
- e === void 0 && (e = Ms()), t === void 0 && (t = !1);
+ e === void 0 && (e = bs()), t === void 0 && (t = !1);
var i = Object.keys(this._tweens);
if (i.length === 0)
return !1;
@@ -31864,7 +31882,7 @@ var Gr = Object.freeze({
/** @class */
(function() {
function s(e, t) {
- t === void 0 && (t = Eo), this._object = e, this._group = t, this._isPaused = !1, this._pauseStart = 0, this._valuesStart = {}, this._valuesEnd = {}, this._valuesStartRepeat = {}, this._duration = 1e3, this._isDynamic = !1, this._initialRepeat = 0, this._repeat = 0, this._yoyo = !1, this._isPlaying = !1, this._reversed = !1, this._delayTime = 0, this._startTime = 0, this._easingFunction = Gr.Linear.None, this._interpolationFunction = So.Linear, this._chainedTweens = [], this._onStartCallbackFired = !1, this._onEveryStartCallbackFired = !1, this._id = Oh.nextId(), this._isChainStopped = !1, this._propertiesAreSetUp = !1, this._goToEnd = !1;
+ t === void 0 && (t = Eo), this._object = e, this._group = t, this._isPaused = !1, this._pauseStart = 0, this._valuesStart = {}, this._valuesEnd = {}, this._valuesStartRepeat = {}, this._duration = 1e3, this._isDynamic = !1, this._initialRepeat = 0, this._repeat = 0, this._yoyo = !1, this._isPlaying = !1, this._reversed = !1, this._delayTime = 0, this._startTime = 0, this._easingFunction = Wr.Linear.None, this._interpolationFunction = So.Linear, this._chainedTweens = [], this._onStartCallbackFired = !1, this._onEveryStartCallbackFired = !1, this._id = Oh.nextId(), this._isChainStopped = !1, this._propertiesAreSetUp = !1, this._goToEnd = !1;
}
return s.prototype.getId = function() {
return this._id;
@@ -31883,7 +31901,7 @@ var Gr = Object.freeze({
}, s.prototype.dynamic = function(e) {
return e === void 0 && (e = !1), this._isDynamic = e, this;
}, s.prototype.start = function(e, t) {
- if (e === void 0 && (e = Ms()), t === void 0 && (t = !1), this._isPlaying)
+ if (e === void 0 && (e = bs()), t === void 0 && (t = !1), this._isPlaying)
return this;
if (this._group && this._group.add(this), this._repeat = this._initialRepeat, this._reversed) {
this._reversed = !1;
@@ -31943,9 +31961,9 @@ var Gr = Object.freeze({
}, s.prototype.end = function() {
return this._goToEnd = !0, this.update(1 / 0), this;
}, s.prototype.pause = function(e) {
- return e === void 0 && (e = Ms()), this._isPaused || !this._isPlaying ? this : (this._isPaused = !0, this._pauseStart = e, this._group && this._group.remove(this), this);
+ return e === void 0 && (e = bs()), this._isPaused || !this._isPlaying ? this : (this._isPaused = !0, this._pauseStart = e, this._group && this._group.remove(this), this);
}, s.prototype.resume = function(e) {
- return e === void 0 && (e = Ms()), !this._isPaused || !this._isPlaying ? this : (this._isPaused = !1, this._startTime += e - this._pauseStart, this._pauseStart = 0, this._group && this._group.add(this), this);
+ return e === void 0 && (e = bs()), !this._isPaused || !this._isPlaying ? this : (this._isPaused = !1, this._startTime += e - this._pauseStart, this._pauseStart = 0, this._group && this._group.add(this), this);
}, s.prototype.stopChainedTweens = function() {
for (var e = 0, t = this._chainedTweens.length; e < t; e++)
this._chainedTweens[e].stop();
@@ -31961,7 +31979,7 @@ var Gr = Object.freeze({
}, s.prototype.yoyo = function(e) {
return e === void 0 && (e = !1), this._yoyo = e, this;
}, s.prototype.easing = function(e) {
- return e === void 0 && (e = Gr.Linear.None), this._easingFunction = e, this;
+ return e === void 0 && (e = Wr.Linear.None), this._easingFunction = e, this;
}, s.prototype.interpolation = function(e) {
return e === void 0 && (e = So.Linear), this._interpolationFunction = e, this;
}, s.prototype.chain = function() {
@@ -31982,7 +32000,7 @@ var Gr = Object.freeze({
return this._onStopCallback = e, this;
}, s.prototype.update = function(e, t) {
var i = this, r;
- if (e === void 0 && (e = Ms()), t === void 0 && (t = !0), this._isPaused)
+ if (e === void 0 && (e = bs()), t === void 0 && (t = !0), this._isPaused)
return !0;
var n, a = this._startTime + this._duration;
if (!this._goToEnd && !this._isPlaying) {
@@ -32030,14 +32048,14 @@ var Gr = Object.freeze({
})()
);
Oh.nextId;
-var Ci = Eo;
-Ci.getAll.bind(Ci);
-Ci.removeAll.bind(Ci);
-Ci.add.bind(Ci);
-Ci.remove.bind(Ci);
-Ci.update.bind(Ci);
+var Ai = Eo;
+Ai.getAll.bind(Ai);
+Ai.removeAll.bind(Ai);
+Ai.add.bind(Ai);
+Ai.remove.bind(Ai);
+Ai.update.bind(Ai);
var Ea = {
- Easing: Gr,
+ Easing: Wr,
Tween: E_
};
function w_() {
@@ -32240,7 +32258,7 @@ function R_(s, e, t) {
v.push(
new kt({
color: 16777215,
- map: new bh().load(p.icon)
+ map: new Mh().load(p.icon)
})
);
new Od({
@@ -32541,7 +32559,7 @@ let A_ = class {
position: this.manager.camera.position.toArray(),
target: this.manager.controls.target.toArray(),
up: this.manager.camera.up.toArray(),
- projection: Br.Perspective
+ projection: Fr.Perspective
};
}
restoreState(s, e) {
@@ -32616,7 +32634,7 @@ let A_ = class {
this.sceneManager.setBackground(s);
}
setSkybox(s) {
- const e = new Mh().load(s);
+ const e = new bh().load(s);
this.sceneManager.scene.background = e;
}
enableShadows(s) {
@@ -32755,7 +32773,7 @@ let A_ = class {
constructor(s) {
const e = document.getElementById(s.containerId);
if (!e) throw new Error(`Container ${s.containerId} not found`);
- this.container = e, this.models = [], this.engineState = new b_(), this.sceneManager = new b0(s);
+ this.container = e, this.models = [], this.engineState = new M_(), this.sceneManager = new M0(s);
const { width: t, height: i } = this.getContainerSize();
this.cameraManager = new O0(this.container, t, i, this.engineState);
try {
@@ -32779,12 +32797,12 @@ let A_ = class {
this.renderer.domElement,
this.cameraManager.controls,
this.outlineManager
- ), this.clippingManager = new M_(this.sceneManager.scene), setTimeout(() => {
+ ), this.clippingManager = new b_(this.sceneManager.scene), setTimeout(() => {
this.clippingManager.enable();
}, 1e3), this.events = new N_(), this.interactionManager.setEventModule(this.events), this.loader = new A_(this.loaderManager, this.sceneManager.scene, this.clippingManager), this.cameraTool = new P_(this.cameraManager), this.components = new D_(this.interactionManager, this.sceneManager.scene), this.viewer = new L_(this.sceneManager, this.renderer), this.data = new I_(), this.tools = new U_(), this.scene = this.sceneManager.scene, this.scene.camera = this.cameraManager.camera, this.camera = this.cameraManager.camera, this.controls = this.cameraManager.controls, this.octreeBox = T_(this), this.viewCube = R_(this, this.scene, this.container), this.viewCube.init(), this.setupVisuals(), this.setupPostProcessing(), s.showStats !== !1 && this.initStats(), this.setupResizeObserver(), this.animate();
}
initStats() {
- this.stats = new M0(), this.stats.showPanel(0), this.stats.dom.style.position = "absolute", this.stats.dom.style.top = "0px", this.stats.dom.style.left = "0px", this.stats.dom.style.zIndex = "1000", this.container.appendChild(this.stats.dom);
+ this.stats = new b0(), this.stats.showPanel(0), this.stats.dom.style.position = "absolute", this.stats.dom.style.top = "0px", this.stats.dom.style.left = "0px", this.stats.dom.style.zIndex = "1000", this.container.appendChild(this.stats.dom);
}
toggleStats(s) {
s && !this.stats ? this.initStats() : !s && this.stats && (this.container.removeChild(this.stats.dom), this.stats = null);
@@ -32826,7 +32844,7 @@ let A_ = class {
}), this.composer.addPass(a);
const o = this.outlineManager.getPass();
this.composer.addPass(o);
- const l = new es(
+ const l = new ts(
new oe(s, e),
0.05,
// 强度
@@ -32931,7 +32949,7 @@ class F_ {
controls;
container;
constructor(e, t, i) {
- this.container = e, this.camera = new bt(75, t / i, 0.1, 1e3), this.camera.position.set(10, 10, 10), this.camera.lookAt(0, 0, 0), this.controls = new Lh(this.camera, this.container), this.controls.enableDamping = !0;
+ this.container = e, this.camera = new Mt(75, t / i, 0.1, 1e3), this.camera.position.set(10, 10, 10), this.camera.lookAt(0, 0, 0), this.controls = new Lh(this.camera, this.container), this.controls.enableDamping = !0;
}
// Used by EngineKernel to update/render
getCamera() {
@@ -32941,7 +32959,7 @@ class F_ {
this.controls.update();
}
updateAspect(e, t) {
- if (this.camera instanceof bt)
+ if (this.camera instanceof Mt)
this.camera.aspect = e / t, this.camera.updateProjectionMatrix();
else if (this.camera instanceof vr) {
const i = e / t, r = 20;
@@ -32950,10 +32968,10 @@ class F_ {
}
setView(e, t) {
switch (e) {
- case Hr.Top:
+ case Vr.Top:
this.camera.position.set(0, 20, 0);
break;
- case Hr.Front:
+ case Vr.Front:
this.camera.position.set(0, 0, 20);
break;
// ... handle others
@@ -32968,7 +32986,7 @@ class F_ {
this.camera.position.set(10, 10, 10), this.camera.lookAt(0, 0, 0), this.controls.update();
}
setProjection(e) {
- e === Br.Perspective && !(this.camera instanceof bt) || e === Br.Orthographic && this.camera instanceof vr;
+ e === Fr.Perspective && !(this.camera instanceof Mt) || e === Fr.Orthographic && this.camera instanceof vr;
}
setNavigationMode(e) {
e === Dn.Orbit ? (this.controls.enabled = !0, this.controls.enableRotate = !0) : e === Dn.PanOnly && (this.controls.enableRotate = !1);
@@ -32979,7 +32997,7 @@ class F_ {
position: this.camera.position.toArray(),
target: e.toArray(),
up: this.camera.up.toArray(),
- projection: this.camera instanceof bt ? Br.Perspective : Br.Orthographic
+ projection: this.camera instanceof Mt ? Fr.Perspective : Fr.Orthographic
};
}
restoreState(e, t) {
@@ -33117,7 +33135,7 @@ class H_ {
this.scene.background = new _e(e);
}
setSkybox(e) {
- const t = new Mh().load(e);
+ const t = new bh().load(e);
this.scene.background = t;
}
enableShadows(e) {
@@ -33132,7 +33150,7 @@ class H_ {
this._aoEnabled = e, console.log("AO enabled:", e, "(Requires PostProcessing pass - not implemented in this basic kernel)");
}
addSectionPlane(e, t) {
- const i = new Mi(new w(...e), t);
+ const i = new bi(new w(...e), t);
return this.renderer.clippingPlanes.push(i), "plane-" + (this.renderer.clippingPlanes.length - 1);
}
removeSectionPlane(e) {
@@ -33322,9 +33340,9 @@ class j_ {
};
if (this.engine = W_(e), !this.engine)
throw new Error("Failed to create engine instance");
- this._isInitialized = !0, this.unsubscribeTheme = Ft.subscribe((t) => {
+ this._isInitialized = !0, this.unsubscribeTheme = Lt.subscribe((t) => {
this.setTheme(t);
- }), this.setTheme(Ft.getTheme());
+ }), this.setTheme(Lt.getTheme());
} catch (e) {
throw console.error("[Engine] Failed to initialize engine:", e), this._isInitialized = !1, e;
}
@@ -33475,9 +33493,9 @@ class el {
* 渲染 DOM 结构并订阅语言变更
*/
init() {
- this.render(), this.unsubscribeLocale = Vi.subscribe(() => {
+ this.render(), this.unsubscribeLocale = Ei.subscribe(() => {
this.setLocales();
- }), this.unsubscribeTheme = Ft.subscribe((e) => {
+ }), this.unsubscribeTheme = Lt.subscribe((e) => {
this.setTheme(e);
});
}
@@ -33547,7 +33565,7 @@ class el {
const r = document.createElement("div");
r.className = "bim-menu-item-icon", e.icon && (r.innerHTML = e.icon), t.appendChild(r);
const n = document.createElement("div");
- n.className = "bim-menu-item-label", n.textContent = ir(e.label), t.appendChild(n);
+ n.className = "bim-menu-item-label", n.textContent = wi(e.label), t.appendChild(n);
const a = e.children, o = a && a.length > 0;
if (o) {
const l = document.createElement("div");
@@ -33583,7 +33601,7 @@ class el {
this.activeSubMenu && (this.activeSubMenu.menu.destroy(), this.activeSubMenu.container.remove(), this.activeSubMenu = null);
}
}
-class Bh extends ts {
+class Bh extends _r {
container;
rightKeyPanel;
// 存储注册的上下文处理器
@@ -33670,7 +33688,7 @@ const q_ = (s) => ({
s.dialog?.showInfoDialog(), s.engine?.rightKey?.hide();
}
});
-class $_ extends ts {
+class $_ extends _r {
/** 3D 引擎挂载的父容器 */
container;
/** 3D 引擎组件实例 */
@@ -33880,7 +33898,7 @@ class Q_ {
const t = document.createElement("div");
t.className = "bim-tree-search-wrapper";
const i = document.createElement("span");
- i.className = "bim-tree-search-icon", i.innerHTML = ' ', t.appendChild(i), this.searchInput = document.createElement("input"), this.searchInput.className = "bim-tree-search-input", this.searchInput.type = "text", this.searchInput.placeholder = ir(this.options.searchPlaceholder || "搜索..."), this.searchInput.addEventListener("input", (r) => {
+ i.className = "bim-tree-search-icon", i.innerHTML = ' ', t.appendChild(i), this.searchInput = document.createElement("input"), this.searchInput.className = "bim-tree-search-input", this.searchInput.type = "text", this.searchInput.placeholder = wi(this.options.searchPlaceholder || "搜索..."), this.searchInput.addEventListener("input", (r) => {
const n = r.target.value;
this.handleSearch(n);
}), t.appendChild(this.searchInput), e.appendChild(t), this.searchResults = document.createElement("div"), this.searchResults.className = "bim-tree-search-results", e.appendChild(this.searchResults), this.element.appendChild(e), this.clickOutsideHandler = (r) => {
@@ -33888,7 +33906,7 @@ class Q_ {
}, document.addEventListener("click", this.clickOutsideHandler);
}
init() {
- this.render(), this.unsubscribeLocale = Vi.subscribe(() => this.setLocales()), this.unsubscribeTheme = Ft.subscribe((e) => this.setTheme(e)), this.setTheme(Ft.getTheme());
+ this.render(), this.unsubscribeLocale = Ei.subscribe(() => this.setLocales()), this.unsubscribeTheme = Lt.subscribe((e) => this.setTheme(e)), this.setTheme(Lt.getTheme());
}
/**
* 处理搜索逻辑
@@ -33964,7 +33982,7 @@ class Q_ {
* 响应语言变更
*/
setLocales() {
- this.nodeMap.forEach((e) => e.updateLabel()), this.searchInput && (this.searchInput.placeholder = ir(this.options.searchPlaceholder || "tree.searchPlaceholder"));
+ this.nodeMap.forEach((e) => e.updateLabel()), this.searchInput && (this.searchInput.placeholder = wi(this.options.searchPlaceholder || "tree.searchPlaceholder"));
}
destroy() {
this.unsubscribeLocale && (this.unsubscribeLocale(), this.unsubscribeLocale = null), this.unsubscribeTheme && (this.unsubscribeTheme(), this.unsubscribeTheme = null), this.clickOutsideHandler && (document.removeEventListener("click", this.clickOutsideHandler), this.clickOutsideHandler = null), this.rootNodes.forEach((e) => e.destroy()), this.rootNodes = [], this.nodeMap.clear(), this.element.remove(), this.selectedNode = null;
@@ -34066,7 +34084,7 @@ class e1 {
* 初始化组件
*/
init() {
- this.renderNav(), this.renderPanels(), this.setLocales(), this.setTheme(Ft.getTheme()), this.unsubscribeLocale = Vi.subscribe(() => this.setLocales()), this.unsubscribeTheme = Ft.subscribe((e) => this.setTheme(e));
+ this.renderNav(), this.renderPanels(), this.setLocales(), this.setTheme(Lt.getTheme()), this.unsubscribeLocale = Ei.subscribe(() => this.setLocales()), this.unsubscribeTheme = Lt.subscribe((e) => this.setTheme(e));
}
/**
* 渲染头部标签
@@ -34117,7 +34135,7 @@ class e1 {
*/
setTheme(e) {
const t = this.element.style;
- t.setProperty("--bim-tab-bg", e.panelBackground), t.setProperty("--bim-tab-nav-bg", e.panelBackground), t.setProperty("--bim-tab-text", e.textPrimary), t.setProperty("--bim-tab-text-secondary", e.textSecondary), t.setProperty("--bim-tab-text-active", e.primary), t.setProperty("--bim-tab-border", e.border), t.setProperty("--bim-tab-hover-bg", e.primaryHover), t.setProperty("--bim-tab-active-bg", e.componentActive), t.setProperty("--bim-tab-icon", e.icon);
+ t.setProperty("--bim-tab-bg", e.panelBackground), t.setProperty("--bim-tab-nav-bg", e.panelBackground), t.setProperty("--bim-tab-text", e.textPrimary), t.setProperty("--bim-tab-text-secondary", e.textSecondary), t.setProperty("--bim-tab-text-active", e.primary), t.setProperty("--bim-tab-border", e.border), t.setProperty("--bim-tab-hover-bg", e.componentHover), t.setProperty("--bim-tab-active-bg", e.componentActive), t.setProperty("--bim-tab-icon", e.icon);
}
/**
* 应用当前语言文案
@@ -34143,7 +34161,7 @@ class e1 {
*/
resolveTitle(e) {
try {
- return ir(e) || e;
+ return wi(e) || e;
} catch {
return e;
}
@@ -34213,7 +34231,7 @@ const t1 = [
]
}
];
-class i1 extends ts {
+class i1 extends _r {
toolbar = null;
toolbarContainer = null;
container;
@@ -34326,6 +34344,158 @@ class i1 extends ts {
}
}
class r1 {
+ element;
+ headerEl;
+ contentEl;
+ contentBoxEl;
+ arrowEl;
+ titleEl;
+ config;
+ parent;
+ constructor(e, t) {
+ this.config = e, this.parent = t, this.element = this.createDom();
+ }
+ createDom() {
+ const e = document.createElement("div");
+ if (e.className = `bim-collapse-item ${this.config.className || ""}`, this.config.disabled && e.classList.add("is-disabled"), e.dataset.id = this.config.id, this.headerEl = document.createElement("div"), this.headerEl.className = "bim-collapse-header", this.arrowEl = document.createElement("span"), this.arrowEl.className = "bim-collapse-arrow", this.arrowEl.innerHTML = ' ', this.headerEl.appendChild(this.arrowEl), this.config.icon) {
+ const t = document.createElement("span");
+ t.className = "bim-collapse-icon", t.innerHTML = this.config.icon, this.headerEl.appendChild(t);
+ }
+ if (this.titleEl = document.createElement("span"), this.titleEl.className = "bim-collapse-title", this.titleEl.textContent = wi(this.config.title), this.headerEl.appendChild(this.titleEl), this.config.extra) {
+ const t = document.createElement("div");
+ t.className = "bim-collapse-extra", typeof this.config.extra == "string" ? t.innerHTML = this.config.extra : t.appendChild(this.config.extra), this.headerEl.appendChild(t);
+ }
+ return this.headerEl.addEventListener("click", () => {
+ this.config.disabled || this.parent.toggleItem(this.config.id);
+ }), e.appendChild(this.headerEl), this.contentEl = document.createElement("div"), this.contentEl.className = "bim-collapse-content is-hidden", this.contentBoxEl = document.createElement("div"), this.contentBoxEl.className = "bim-collapse-content-box", typeof this.config.content == "string" ? this.contentBoxEl.innerHTML = this.config.content : this.contentBoxEl.appendChild(this.config.content), this.contentEl.appendChild(this.contentBoxEl), e.appendChild(this.contentEl), e;
+ }
+ updateLocale() {
+ this.titleEl && (this.titleEl.textContent = wi(this.config.title));
+ }
+ setActive(e) {
+ e ? (this.element.classList.add("is-active"), this.contentEl.classList.remove("is-hidden")) : (this.element.classList.remove("is-active"), this.contentEl.classList.add("is-hidden"));
+ }
+}
+class s1 {
+ element;
+ options;
+ items = /* @__PURE__ */ new Map();
+ activeIds = /* @__PURE__ */ new Set();
+ unsubscribeLocale = null;
+ unsubscribeTheme = null;
+ constructor(e) {
+ this.options = {
+ bordered: !0,
+ accordion: !1,
+ ...e
+ }, this.element = document.createElement("div"), this.element.className = `bim-collapse ${this.options.className || ""}`, this.options.bordered || (this.element.style.border = "none"), this.options.ghost && this.element.classList.add("is-ghost");
+ const t = typeof this.options.container == "string" ? document.getElementById(this.options.container) : this.options.container;
+ t && t.appendChild(this.element), this.options.activeIds && this.options.activeIds.forEach((i) => this.activeIds.add(i)), this.init();
+ }
+ init() {
+ this.options.items.forEach((e) => {
+ const t = new r1(e, this);
+ this.items.set(e.id, t), this.element.appendChild(t.element), this.activeIds.has(e.id) && t.setActive(!0);
+ }), this.unsubscribeLocale = Ei.subscribe(() => {
+ this.setLocales();
+ }), this.unsubscribeTheme = Lt.subscribe((e) => {
+ this.setTheme(e);
+ }), this.setTheme(Lt.getTheme());
+ }
+ toggleItem(e) {
+ const t = this.activeIds.has(e);
+ this.options.accordion ? (this.activeIds.clear(), t || this.activeIds.add(e)) : t ? this.activeIds.delete(e) : this.activeIds.add(e), this.refreshState(), this.options.onChange && this.options.onChange(Array.from(this.activeIds));
+ }
+ refreshState() {
+ this.items.forEach((e, t) => {
+ e.setActive(this.activeIds.has(t));
+ });
+ }
+ setTheme(e) {
+ const t = this.element.style;
+ t.setProperty("--bim-bg-color", e.panelBackground), t.setProperty("--bim-border-color", e.border), t.setProperty("--bim-text-color", e.textPrimary), t.setProperty("--bim-header-bg-color", e.componentHover), t.setProperty("--bim-header-hover-bg-color", e.componentHover), t.setProperty("--bim-content-bg-color", e.panelBackground), t.setProperty("--bim-disabled-color", e.textSecondary);
+ }
+ setLocales() {
+ this.items.forEach((e) => e.updateLocale());
+ }
+ destroy() {
+ this.unsubscribeLocale && (this.unsubscribeLocale(), this.unsubscribeLocale = null), this.unsubscribeTheme && (this.unsubscribeTheme(), this.unsubscribeTheme = null), this.element.remove(), this.items.clear();
+ }
+}
+class n1 extends _r {
+ constructor(e) {
+ super(e);
+ }
+ init() {
+ document.addEventListener("bim-demo:open-property-panel", () => {
+ this.show();
+ });
+ }
+ show() {
+ if (!this.engine.dialog) {
+ console.warn("Dialog manager is not initialized");
+ return;
+ }
+ const e = this.engine.dialog.create({
+ title: "panel.property.title",
+ // '属性面板'
+ minWidth: 320,
+ height: 420,
+ position: "top-right",
+ resizable: !1
+ }), t = document.createElement("div");
+ t.style.height = "100%", t.style.overflowY = "auto", e.setContent(t), new s1({
+ container: t,
+ accordion: !0,
+ activeIds: ["base"],
+ items: [
+ {
+ id: "base",
+ title: "panel.property.base",
+ // '基本属性'
+ content: this.createBaseInfoContent(),
+ icon: ' '
+ },
+ {
+ id: "material",
+ title: "panel.property.material",
+ // '材质信息'
+ content: this.createMaterialContent(),
+ icon: ' '
+ },
+ {
+ id: "advanced",
+ title: "panel.property.advanced",
+ // '高级设置'
+ content: "Loading...
",
+ // Placeholder
+ disabled: !0
+ }
+ ]
+ });
+ }
+ createBaseInfoContent() {
+ const e = document.createElement("div");
+ return e.style.padding = "8px 0", e.innerHTML = `
+ ID: E-2023001
+ Name: Wall-01
+ Level: F1
+ `, e;
+ }
+ createMaterialContent() {
+ const e = document.createElement("div");
+ return e.innerHTML = `
+
+ Density: 2400 kg/m³
+ `, e;
+ }
+ destroy() {
+ }
+}
+class a1 {
events = /* @__PURE__ */ new Map();
on(e, t) {
return this.events.has(e) || this.events.set(e, []), this.events.get(e).push(t), () => this.off(e, t);
@@ -34350,7 +34520,7 @@ class r1 {
this.events.clear();
}
}
-class s1 extends r1 {
+class o1 extends a1 {
container;
wrapper = null;
toolbar = null;
@@ -34364,11 +34534,13 @@ class s1 extends r1 {
// 3D 引擎管理器
rightKey = null;
// 右键菜单管理器
+ propertyPanel = null;
+ // 属性面板 (演示 Collapse)
constructor(e, t) {
super();
const i = typeof e == "string" ? document.getElementById(e) : e;
if (!i) throw new Error("Container not found");
- this.container = i, t?.locale && Vi.setLocale(t.locale), t?.theme && (t.theme === "custom" ? console.warn("Custom theme should be set via setCustomTheme().") : Ft.setTheme(t.theme)), this.init();
+ this.container = i, t?.locale && Ei.setLocale(t.locale), t?.theme && (t.theme === "custom" ? console.warn("Custom theme should be set via setCustomTheme().") : Lt.setTheme(t.theme)), this.init();
}
// Typed wrappers for events
emit(e, t) {
@@ -34378,19 +34550,19 @@ class s1 extends r1 {
return super.on(e, t);
}
setLocale(e) {
- Vi.setLocale(e);
+ Ei.setLocale(e);
}
getLocale() {
- return Vi.getLocale();
+ return Ei.getLocale();
}
setTheme(e) {
- Ft.setTheme(e);
+ Lt.setTheme(e);
}
setCustomTheme(e) {
- Ft.setCustomTheme(e);
+ Lt.setCustomTheme(e);
}
init() {
- this.container.innerHTML = "", this.wrapper = document.createElement("div"), this.wrapper.className = "bim-engine-wrapper", this.container.appendChild(this.wrapper), this.engine = new $_(this, this.wrapper), this.dialog = new eu(this, this.wrapper), this.toolbar = new $h(this, this.wrapper), this.buttonGroup = new Jh(this, this.wrapper), this.rightKey = new Bh(this, this.wrapper), this.constructTreeBtn = new i1(this, this.wrapper), this.updateTheme(Ft.getTheme()), Ft.subscribe((e) => {
+ this.container.innerHTML = "", this.wrapper = document.createElement("div"), this.wrapper.className = "bim-engine-wrapper", this.container.appendChild(this.wrapper), this.engine = new $_(this, this.wrapper), this.dialog = new eu(this, this.wrapper), this.toolbar = new $h(this, this.wrapper), this.buttonGroup = new Jh(this, this.wrapper), this.rightKey = new Bh(this, this.wrapper), this.constructTreeBtn = new i1(this, this.wrapper), this.propertyPanel = new n1(this), this.updateTheme(Lt.getTheme()), Lt.subscribe((e) => {
this.updateTheme(e);
});
}
@@ -34398,15 +34570,10 @@ class s1 extends r1 {
this.wrapper && (this.wrapper.style.backgroundColor = e.background, this.wrapper.style.color = e.textPrimary);
}
destroy() {
- this.toolbar?.destroy(), this.buttonGroup?.destroy(), this.engine?.destroy(), this.dialog?.destroy(), this.rightKey?.destroy(), this.container.innerHTML = "", this.clear();
+ this.toolbar?.destroy(), this.buttonGroup?.destroy(), this.engine?.destroy(), this.dialog?.destroy(), this.rightKey?.destroy(), this.propertyPanel?.destroy(), this.container.innerHTML = "", this.clear();
}
}
export {
- wo as BimButtonGroup,
- s1 as BimEngine,
- el as BimMenu,
- X_ as BimRightKey,
- Zh as Toolbar,
- W_ as createEngine
+ o1 as BimEngine
};
//# sourceMappingURL=bim-engine-sdk.es.js.map
diff --git a/dist/bim-engine-sdk.es.js.map b/dist/bim-engine-sdk.es.js.map
index c44795f..1f01baf 100644
--- a/dist/bim-engine-sdk.es.js.map
+++ b/dist/bim-engine-sdk.es.js.map
@@ -1 +1 @@
-{"version":3,"file":"bim-engine-sdk.es.js","sources":["../src/locales/zh-CN.ts","../src/locales/en-US.ts","../src/services/locale.ts","../src/themes/presets.ts","../src/services/theme.ts","../src/components/button-group/index.ts","../src/components/button-group/toolbar/index.ts","../src/core/component.ts","../src/managers/toolbar-manager.ts","../src/managers/button-group-manager.ts","../src/components/dialog/index.ts","../src/components/dialog/bimInfoDialog/index.ts","../src/managers/dialog-manager.ts","../src/bim-engine-sdk.es.js","../src/components/engine/index.ts","../src/components/right-key/index.ts","../src/components/menu/index.ts","../src/managers/right-key-manager.ts","../src/components/menu/buttons/info.ts","../src/components/menu/buttons/four.ts","../src/components/menu/buttons/second.ts","../src/components/menu/buttons/home.ts","../src/managers/engine-manager.ts","../src/components/tree/types.ts","../src/components/tree/tree-node.ts","../src/components/tree/index.ts","../src/components/tab/index.ts","../src/managers/construct-tree-manager-btn.ts","../src/core/event-emitter.ts","../src/bim-engine.ts"],"sourcesContent":["import {TranslationDictionary} from './types';\n\nexport const zhCN: TranslationDictionary = {\n common: {\n title: 'BimEngine',\n description: '这是一个使用 BIM-ENGINE。',\n openTestDialog: '打开测试弹窗',\n openInfoDialog: '打开信息弹窗 (封装版)',\n },\n toolbar: {\n home: '首页',\n info: '信息',\n location: '定位',\n setting: '设置',\n walk: '漫游',\n walkPerson: '人视',\n walkBird: '鸟瞰',\n walkMenu: '菜单',\n },\n dialog: {\n testTitle: '测试弹窗',\n testContent: '这是一个 可拖拽 且 可缩放 的弹窗。 你可以尝试拖动标题栏,或者拖动右下角改变大小。
',\n },\n menu: {\n info: '信息',\n home: '首页',\n },\n tree: {\n searchPlaceholder: '请输入要搜索的内容',\n },\n constructTree: {\n title: '目录树',\n },\n tab: {\n component: '构件',\n system: '系统',\n space: '空间',\n }\n};\n","import { TranslationDictionary } from './types';\n\nexport const enUS: TranslationDictionary = {\n common: {\n title: 'BimEngine',\n description: 'This is a BIM-ENGINE demo.',\n openTestDialog: 'Open Test Dialog',\n openInfoDialog: 'Open Info Dialog (Wrapped)',\n },\n toolbar: {\n home: 'Home',\n info: 'Info',\n location: 'Location',\n setting: 'Settings',\n walk: 'Walk',\n walkPerson: 'Person',\n walkBird: 'Bird Eye',\n walkMenu: 'Menu',\n },\n dialog: {\n testTitle: 'Test Dialog',\n testContent: 'This is a draggable and resizable dialog. Try dragging the title bar or resizing from the bottom-right corner.
',\n },\n menu: {\n info: 'Info',\n home: 'Home',\n },\n tree: {\n searchPlaceholder: 'Please enter content to search',\n },\n constructTree: {\n title: 'Construct Tree',\n },\n tab: {\n component: 'Component',\n system: 'System',\n space: 'Space',\n }\n};\n","import { LocaleType, TranslationDictionary } from '../locales/types';\nimport { zhCN } from '../locales/zh-CN';\nimport { enUS } from '../locales/en-US';\n\ntype LocaleChangeListener = (locale: LocaleType) => void;\n\n/**\n * 语言管理器类\n */\nexport class LocaleManager {\n private currentLocale: LocaleType = 'zh-CN';\n private messages: Record = {\n 'zh-CN': zhCN,\n 'en-US': enUS,\n };\n private listeners: LocaleChangeListener[] = [];\n\n constructor() {\n // 默认初始化\n }\n\n /**\n * 获取当前语言\n */\n public getLocale(): LocaleType {\n return this.currentLocale;\n }\n\n /**\n * 切换语言\n */\n public setLocale(locale: LocaleType) {\n if (this.currentLocale === locale) return;\n this.currentLocale = locale;\n this.notifyListeners();\n }\n\n /**\n * 翻译核心方法\n */\n public t(key: string): string {\n if (!key) return '';\n \n const keys = key.split('.');\n let value: any = this.messages[this.currentLocale];\n \n for (const k of keys) {\n if (value && typeof value === 'object' && k in value) {\n value = value[k];\n } else {\n return key;\n }\n }\n return value as string;\n }\n\n /**\n * 订阅变更\n */\n public subscribe(listener: LocaleChangeListener): () => void {\n this.listeners.push(listener);\n return () => {\n this.listeners = this.listeners.filter(l => l !== listener);\n };\n }\n\n private notifyListeners() {\n this.listeners.forEach(listener => listener(this.currentLocale));\n }\n}\n\n// --- 导出单例 ---\nexport const localeManager = new LocaleManager();\n\n// --- 导出便捷方法 ---\n/**\n * 全局翻译函数\n * @param key 键路径 (如 'toolbar.home')\n */\nexport const t = (key: string): string => localeManager.t(key);\n","import { ThemeConfig } from './types';\n\n/**\n * 深色主题 (默认)\n */\nexport const darkTheme: ThemeConfig = {\n name: 'dark',\n primary: '#0078d4',\n primaryHover: '#0063b1',\n\n // 修改:背景色统一为浅灰,不再跟随深色模式变黑\n background: '#f5f5f5',\n panelBackground: 'rgba(30, 30, 30, 0.9)',\n\n textPrimary: '#ffffff',\n textSecondary: '#cccccc',\n\n border: '#444444',\n\n icon: '#cccccc',\n iconActive: '#ffffff',\n\n componentBackground: 'transparent',\n componentHover: '#4e4d4dff',\n componentActive: 'rgba(255, 255, 255, 0.1)'\n};\n\n/**\n * 浅色主题\n */\nexport const lightTheme: ThemeConfig = {\n name: 'light',\n primary: '#0078d4',\n primaryHover: '#106ebe',\n\n // 统一为浅灰\n background: '#f5f5f5',\n panelBackground: '#ffffff',\n\n textPrimary: '#333333',\n textSecondary: '#666666',\n\n border: '#e0e0e0',\n\n icon: '#555555',\n iconActive: '#0078d4',\n\n componentBackground: 'transparent',\n componentHover: '#f0f0f0',\n componentActive: '#e0e0e0'\n};","import { ThemeConfig } from '../themes/types';\nimport { darkTheme, lightTheme } from '../themes/presets';\n\ntype ThemeChangeListener = (theme: ThemeConfig) => void;\n\n/**\n * 主题管理器 (单例)\n */\nexport class ThemeManager {\n private currentTheme: ThemeConfig = darkTheme;\n private listeners: ThemeChangeListener[] = [];\n\n constructor() {\n // 默认初始化\n }\n\n /**\n * 获取当前主题配置\n */\n public getTheme(): ThemeConfig {\n return this.currentTheme;\n }\n\n /**\n * 切换预设主题\n * @param themeName 'dark' | 'light'\n */\n public setTheme(themeName: 'dark' | 'light') {\n if (themeName === 'light') {\n this.applyTheme(lightTheme);\n } else {\n this.applyTheme(darkTheme);\n }\n }\n\n /**\n * 应用自定义主题配置\n * @param theme 配置对象\n */\n public setCustomTheme(theme: ThemeConfig) {\n this.applyTheme(theme);\n }\n\n /**\n * 内部应用主题逻辑\n */\n private applyTheme(theme: ThemeConfig) {\n this.currentTheme = theme;\n this.notifyListeners();\n }\n\n /**\n * 订阅主题变更\n */\n public subscribe(listener: ThemeChangeListener): () => void {\n this.listeners.push(listener);\n // 立即回调一次当前状态\n listener(this.currentTheme);\n return () => {\n this.listeners = this.listeners.filter(l => l !== listener);\n };\n }\n\n private notifyListeners() {\n this.listeners.forEach(listener => listener(this.currentTheme));\n }\n}\n\n// 导出单例\nexport const themeManager = new ThemeManager();","import './index.css';\nimport type {\n OptButton,\n ButtonGroup,\n ButtonGroupOptions,\n ButtonConfig,\n ButtonGroupColors\n} from './index.type';\nimport { t, localeManager } from '../../services/locale';\nimport { themeManager } from '../../services/theme';\nimport type { ThemeConfig } from '../../themes/types';\nimport { IBimComponent } from '../../types/component';\nimport type { BimEngine } from '../../bim-engine';\nimport { EngineEvents } from '../../types/events';\n\n/**\n * 通用按钮组组件 (BimButtonGroup)\n */\nexport class BimButtonGroup implements IBimComponent {\n private container: HTMLElement;\n private options: ButtonGroupOptions;\n private groups: ButtonGroup[] = [];\n private activeBtnIds: Set = new Set();\n private btnRefs: Map = new Map();\n private dropdownElement: HTMLElement | null = null;\n private hoverTimeout: number | null = null;\n private customColors: Set = new Set(); // 记录用户自定义的颜色属性\n private unsubscribeLocale: (() => void) | null = null;\n private unsubscribeTheme: (() => void) | null = null;\n\n protected engine: BimEngine | null = null;\n\n private readonly DEFAULT_ICON = ' ';\n\n constructor(options: ButtonGroupOptions) {\n const el = typeof options.container === 'string'\n ? document.getElementById(options.container)\n : options.container;\n\n if (!el) throw new Error('Container not found');\n\n this.container = el;\n // 合并默认配置\n this.options = {\n showLabel: true,\n visibility: {},\n direction: 'row', // 默认横向\n position: 'static', // 默认静态定位\n align: 'vertical', // 默认图标在上\n expand: 'down', // 默认向下展开\n ...options\n };\n\n // 记录初始传入的自定义颜色\n const colorKeys: (keyof ButtonGroupColors)[] = [\n 'backgroundColor', 'btnBackgroundColor', 'btnHoverColor',\n 'btnActiveColor', 'iconColor', 'iconActiveColor',\n 'textColor', 'textActiveColor'\n ];\n colorKeys.forEach(key => {\n if (options[key]) {\n this.customColors.add(key);\n }\n });\n\n this.initContainer();\n this.applyStyles();\n }\n\n public setEngine(engine: BimEngine) {\n this.engine = engine;\n }\n\n protected emit(event: K, payload: EngineEvents[K]) {\n if (this.engine) {\n this.engine.emit(event, payload);\n } else {\n console.warn('[BimButtonGroup] Engine not set, cannot emit event:', event);\n }\n }\n\n private initContainer(): void {\n this.container.innerHTML = '';\n this.container.classList.add('bim-btn-group-root');\n\n if (this.options.direction === 'column') {\n this.container.classList.add('dir-column');\n } else {\n this.container.classList.add('dir-row');\n }\n\n if (this.options.className) {\n this.container.classList.add(this.options.className);\n }\n\n this.updatePosition();\n \n // 添加事件拦截,防止点击穿透到 3D 引擎\n this.setupEventInterception(this.container);\n }\n\n /**\n * 设置事件拦截,防止事件��泡到下层元素(如 3D 引擎)\n */\n private setupEventInterception(el: HTMLElement): void {\n const stopPropagation = (e: Event) => {\n e.stopPropagation();\n };\n\n const events = [\n 'click', 'dblclick', 'contextmenu', 'wheel',\n 'mousedown', 'mouseup', 'mousemove',\n 'touchstart', 'touchend', 'touchmove',\n 'pointerdown', 'pointerup', 'pointermove', 'pointerenter', 'pointerleave', 'pointerover', 'pointerout'\n ];\n\n events.forEach(eventType => {\n el.addEventListener(eventType, stopPropagation, { passive: false });\n });\n }\n\n private updatePosition() {\n const pos = this.options.position;\n const style = this.container.style;\n\n style.top = ''; style.bottom = ''; style.left = ''; style.right = ''; style.transform = '';\n\n if (pos === 'static') {\n this.container.classList.add('static');\n return;\n }\n\n this.container.classList.remove('static');\n this.container.style.position = 'absolute';\n\n if (typeof pos === 'object' && 'x' in pos) {\n style.left = `${pos.x}px`;\n style.top = `${pos.y}px`;\n } else {\n const margin = '20px';\n switch (pos) {\n case 'top-left':\n style.top = margin; style.left = margin;\n break;\n case 'top-center':\n style.top = margin; style.left = '50%'; style.transform = 'translateX(-50%)';\n break;\n case 'top-right':\n style.top = margin; style.right = margin;\n break;\n case 'bottom-left':\n style.bottom = margin; style.left = margin;\n break;\n case 'bottom-center':\n style.bottom = margin; style.left = '50%'; style.transform = 'translateX(-50%)';\n break;\n case 'bottom-right':\n style.bottom = margin; style.right = margin;\n break;\n case 'left-center':\n style.left = margin; style.top = '50%'; style.transform = 'translateY(-50%)';\n break;\n case 'right-center':\n style.right = margin; style.top = '50%'; style.transform = 'translateY(-50%)';\n break;\n case 'center':\n style.top = '50%'; style.left = '50%'; style.transform = 'translate(-50%, -50%)';\n break;\n }\n }\n }\n\n /**\n * 应用样式到容器\n */\n private applyStyles(): void {\n const style = this.container.style;\n if (this.options.backgroundColor) style.setProperty('--bim-btn-group-section-bg', this.options.backgroundColor);\n if (this.options.btnBackgroundColor) style.setProperty('--bim-btn-bg', this.options.btnBackgroundColor);\n if (this.options.btnHoverColor) style.setProperty('--bim-btn-hover-bg', this.options.btnHoverColor);\n if (this.options.btnActiveColor) style.setProperty('--bim-btn-active-bg', this.options.btnActiveColor);\n if (this.options.iconColor) style.setProperty('--bim-icon-color', this.options.iconColor);\n if (this.options.iconActiveColor) style.setProperty('--bim-icon-active-color', this.options.iconActiveColor);\n if (this.options.textColor) style.setProperty('--bim-btn-text-color', this.options.textColor);\n if (this.options.textActiveColor) style.setProperty('--bim-btn-text-active-color', this.options.textActiveColor);\n }\n\n /**\n * 设置主题颜色\n * 只会应用到没有被用户自定义的颜色属性上\n */\n public setTheme(theme: ThemeConfig): void {\n const themeColors: ButtonGroupColors = {\n backgroundColor: theme.panelBackground,\n btnBackgroundColor: theme.componentBackground,\n btnHoverColor: theme.componentHover,\n btnActiveColor: theme.componentActive,\n iconColor: theme.icon,\n iconActiveColor: theme.iconActive,\n textColor: theme.textSecondary,\n textActiveColor: theme.textPrimary\n };\n\n // 只应用没有被自定义的颜色\n Object.entries(themeColors).forEach(([key, value]) => {\n const colorKey = key as keyof ButtonGroupColors;\n if (!this.customColors.has(colorKey)) {\n this.options[colorKey] = value;\n }\n });\n\n this.applyStyles();\n }\n\n /**\n * 直接设置颜色(强制覆盖)\n * 设置的颜色会被标记为自定义,后续的 setTheme 不会覆盖它们\n */\n public setColors(colors: ButtonGroupColors): void {\n // 更新 options\n this.options = { ...this.options, ...colors };\n\n // 标记这些颜色为自定义\n Object.keys(colors).forEach(key => {\n this.customColors.add(key as keyof ButtonGroupColors);\n });\n\n this.applyStyles();\n }\n\n public async init(): Promise {\n this.render();\n\n // 自动订阅语言变更\n this.unsubscribeLocale = localeManager.subscribe(() => {\n this.setLocales();\n });\n\n // 自动订阅主题变更\n this.unsubscribeTheme = themeManager.subscribe((theme) => {\n this.setTheme(theme);\n });\n }\n\n public setLocales(): void {\n this.render();\n }\n\n public addGroup(groupId: string, beforeGroupId?: string): void {\n if (this.groups.some(g => g.id === groupId)) return;\n const newGroup: ButtonGroup = { id: groupId, buttons: [] };\n if (beforeGroupId) {\n const index = this.groups.findIndex(g => g.id === beforeGroupId);\n index !== -1 ? this.groups.splice(index, 0, newGroup) : this.groups.push(newGroup);\n } else {\n this.groups.push(newGroup);\n }\n }\n\n public addButton(config: ButtonConfig): void {\n const { groupId, parentId } = config;\n const group = this.groups.find(g => g.id === groupId);\n if (!group) return;\n\n const button: OptButton = { ...config, children: config.children || [] };\n if (parentId) {\n const parentBtn = this.findButton(group.buttons, parentId);\n if (parentBtn) {\n if (!parentBtn.children) parentBtn.children = [];\n parentBtn.children.push(button);\n }\n } else {\n group.buttons.push(button);\n }\n }\n\n private findButton(buttons: OptButton[], id: string): OptButton | undefined {\n for (const btn of buttons) {\n if (btn.id === id) return btn;\n if (btn.children) {\n const found = this.findButton(btn.children, id);\n if (found) return found;\n }\n }\n return undefined;\n }\n\n public render(): void {\n this.container.innerHTML = '';\n this.btnRefs.clear();\n\n this.groups.forEach((group, index) => {\n const groupElement = this.renderGroup(group, index, this.groups.length);\n this.container.appendChild(groupElement);\n });\n }\n\n private renderGroup(group: ButtonGroup, index: number, total: number): HTMLElement {\n const groupEl = document.createElement('div');\n groupEl.className = 'bim-btn-group-section';\n\n if (index < total - 1) {\n groupEl.classList.add('has-divider');\n }\n\n group.buttons.forEach(button => {\n if (this.isVisible(button.id)) {\n const btnWrapper = this.renderButton(button);\n groupEl.appendChild(btnWrapper);\n }\n });\n return groupEl;\n }\n\n private renderButton(button: OptButton): HTMLElement {\n const wrapper = document.createElement('div');\n wrapper.className = 'opt-btn-wrapper';\n\n const btnEl = document.createElement('div');\n btnEl.className = 'opt-btn';\n\n // 按钮优先使用自己的 align,否则使用全局配置,默认为 vertical\n const align = button.align || this.options.align || 'vertical';\n if (align === 'horizontal') {\n btnEl.classList.add('align-horizontal');\n } else {\n btnEl.classList.add('align-vertical');\n }\n\n if (this.activeBtnIds.has(button.id)) btnEl.classList.add('active');\n if (button.disabled) btnEl.classList.add('disabled');\n\n // 判断是否显示 label\n const hasLabel = this.options.showLabel && button.label;\n if (!hasLabel) {\n btnEl.classList.add('no-label');\n }\n\n // 应用按钮的自定义样式\n const iconSize = button.iconSize || 32;\n const minWidth = button.minWidth || 50;\n btnEl.style.minWidth = `${minWidth}px`;\n\n const icon = document.createElement('div');\n icon.className = 'opt-btn-icon';\n icon.style.width = `${iconSize}px`;\n icon.style.height = `${iconSize}px`;\n icon.innerHTML = this.getIcon(button.icon);\n btnEl.appendChild(icon);\n\n // 创建文字和箭头的容器,确保它们始终在一起(无论主轴是横是竖)\n const textWrapper = document.createElement('div');\n textWrapper.className = 'opt-btn-text-wrapper';\n\n if (this.options.showLabel && button.label) {\n const label = document.createElement('span');\n label.className = 'opt-btn-label';\n label.textContent = t(button.label);\n textWrapper.appendChild(label);\n }\n\n if (button.children && button.children.length > 0) {\n const arrow = document.createElement('span');\n arrow.className = 'opt-btn-arrow';\n arrow.textContent = '▼';\n textWrapper.appendChild(arrow);\n }\n\n // 只有当有内容时才添加 wrapper\n if (textWrapper.hasChildNodes()) {\n btnEl.appendChild(textWrapper);\n }\n\n btnEl.addEventListener('click', () => this.handleClick(button));\n btnEl.addEventListener('mouseenter', () => this.handleMouseEnter(button, btnEl));\n btnEl.addEventListener('mouseleave', () => this.handleMouseLeave());\n\n this.btnRefs.set(button.id, btnEl);\n wrapper.appendChild(btnEl);\n return wrapper;\n }\n\n private handleClick(button: OptButton): void {\n if (button.disabled) return;\n if (!button.children || button.children.length === 0) {\n if (button.keepActive) {\n const wasActive = this.activeBtnIds.has(button.id);\n if (wasActive) this.activeBtnIds.delete(button.id);\n else this.activeBtnIds.add(button.id);\n this.updateButtonState(button.id);\n }\n this.closeDropdown();\n if (button.onClick) button.onClick(button);\n }\n }\n\n private handleMouseEnter(button: OptButton, btnEl: HTMLElement): void {\n if (this.hoverTimeout) clearTimeout(this.hoverTimeout);\n if (button.children && button.children.length > 0) {\n this.showDropdown(button, btnEl);\n } else {\n this.closeDropdown();\n }\n }\n\n private handleMouseLeave(): void {\n this.hoverTimeout = window.setTimeout(() => this.closeDropdown(), 200);\n }\n\n private showDropdown(button: OptButton, btnEl: HTMLElement): void {\n this.closeDropdown();\n if (!button.children) return;\n\n const dropdown = document.createElement('div');\n dropdown.className = 'opt-btn-dropdown';\n if (this.options.backgroundColor) dropdown.style.setProperty('--bim-toolbar-bg', this.options.backgroundColor);\n\n // 获取按钮的位置信息\n const btnRect = btnEl.getBoundingClientRect();\n const expand = this.options.expand || 'down';\n\n // 根据主按钮组的方向设置下拉菜单的布局方向\n if (this.options.direction === 'row') {\n dropdown.style.flexDirection = 'column'; // 横向按钮组,菜单纵向排列\n } else {\n dropdown.style.flexDirection = 'row'; // 纵向按钮组,菜单横向排列\n }\n\n // 先添加到 DOM 以便计算尺寸\n document.body.appendChild(dropdown);\n \n // 添加事件拦截\n this.setupEventInterception(dropdown);\n\n // 添加菜单项\n button.children.forEach(subBtn => {\n if (this.isVisible(subBtn.id)) {\n const item = this.renderDropdownItem(subBtn);\n dropdown.appendChild(item);\n }\n });\n\n // 获取下拉菜单的实际尺寸\n const dropdownRect = dropdown.getBoundingClientRect();\n\n if (expand === 'up') {\n // 向上展开,与按钮水平居中对齐\n dropdown.style.bottom = (window.innerHeight - btnRect.top + 8) + 'px';\n dropdown.style.left = (btnRect.left + (btnRect.width - dropdownRect.width) / 2) + 'px';\n } else if (expand === 'down') {\n // 向下展开,与按钮水平居中对齐\n dropdown.style.top = (btnRect.bottom + 8) + 'px';\n dropdown.style.left = (btnRect.left + (btnRect.width - dropdownRect.width) / 2) + 'px';\n } else if (expand === 'right') {\n // 向右展开,与按钮垂直居中对齐\n dropdown.style.top = (btnRect.top + (btnRect.height - dropdownRect.height) / 2) + 'px';\n dropdown.style.left = (btnRect.right + 8) + 'px';\n } else if (expand === 'left') {\n // 向左展开,与按钮垂直居中对齐\n dropdown.style.top = (btnRect.top + (btnRect.height - dropdownRect.height) / 2) + 'px';\n dropdown.style.right = (window.innerWidth - btnRect.left + 8) + 'px';\n }\n\n dropdown.addEventListener('mouseenter', () => { if (this.hoverTimeout) clearTimeout(this.hoverTimeout); });\n dropdown.addEventListener('mouseleave', () => this.handleMouseLeave());\n this.dropdownElement = dropdown;\n }\n\n private renderDropdownItem(button: OptButton): HTMLElement {\n const item = document.createElement('div');\n item.className = 'opt-btn-dropdown-item';\n\n // 应用按钮的 align 设置,默认为 horizontal(图标在左)\n const align = button.align || 'horizontal';\n if (align === 'horizontal') {\n item.classList.add('align-horizontal');\n } else {\n item.classList.add('align-vertical');\n }\n\n // 应用按钮的自定义样式\n const iconSize = button.iconSize || 32; // 二级菜单默认图标更小\n const minWidth = button.minWidth; // 不设置默认值,让下拉菜单项保持紧凑\n if (minWidth) {\n item.style.minWidth = `${minWidth}px`;\n }\n\n const icon = document.createElement('div');\n icon.className = 'opt-btn-icon';\n icon.style.width = `${iconSize}px`;\n icon.style.height = `${iconSize}px`;\n icon.innerHTML = this.getIcon(button.icon);\n item.appendChild(icon);\n\n // 只有在 showLabel 为 true 时才显示 label\n if (this.options.showLabel && button.label) {\n const label = document.createElement('span');\n label.className = 'opt-btn-dropdown-label';\n label.textContent = t(button.label);\n item.appendChild(label);\n }\n\n item.addEventListener('click', (e) => { e.stopPropagation(); this.handleClick(button); });\n return item;\n }\n\n private closeDropdown(): void {\n if (this.dropdownElement) {\n this.dropdownElement.remove();\n this.dropdownElement = null;\n }\n this.btnRefs.forEach(btnEl => {\n const arrow = btnEl.querySelector('.opt-btn-arrow');\n if (arrow) arrow.classList.remove('rotated');\n });\n }\n\n private updateButtonState(buttonId: string): void {\n const btnEl = this.btnRefs.get(buttonId);\n if (btnEl) {\n this.activeBtnIds.has(buttonId) ? btnEl.classList.add('active') : btnEl.classList.remove('active');\n }\n }\n\n private getIcon(icon?: string): string { return icon || this.DEFAULT_ICON; }\n public updateButtonVisibility(id: string, visible: boolean): void {\n if (!this.options.visibility) this.options.visibility = {};\n this.options.visibility[id] = visible;\n this.render();\n }\n public setShowLabel(show: boolean): void {\n this.options.showLabel = show;\n this.updateLabelsVisibility();\n }\n\n private updateLabelsVisibility(): void {\n this.btnRefs.forEach((btnEl, buttonId) => {\n // 查找按钮配置\n const button = this.findButtonById(buttonId);\n if (!button) return;\n\n const hasLabel = this.options.showLabel && button.label;\n\n // 只需要更新 no-label 类,CSS 会处理显示/隐藏\n if (hasLabel) {\n btnEl.classList.remove('no-label');\n } else {\n btnEl.classList.add('no-label');\n }\n });\n }\n\n private findButtonById(id: string): OptButton | undefined {\n for (const group of this.groups) {\n const found = this.findButton(group.buttons, id);\n if (found) return found;\n }\n return undefined;\n }\n public setBackgroundColor(color: string): void { this.setColors({ backgroundColor: color }); }\n private isVisible(id: string): boolean { return this.options.visibility?.[id] !== false; }\n public destroy(): void {\n if (this.unsubscribeLocale) {\n this.unsubscribeLocale();\n this.unsubscribeLocale = null;\n }\n if (this.unsubscribeTheme) {\n this.unsubscribeTheme();\n this.unsubscribeTheme = null;\n }\n this.closeDropdown();\n this.container.innerHTML = '';\n this.btnRefs.clear();\n }\n}\n","import { BimButtonGroup } from '../index';\n\n/**\n * 底部工具栏 (Toolbar)\n * BimButtonGroup 的子类,专门用于加载工具栏默认按钮。\n */\nexport class Toolbar extends BimButtonGroup {\n /**\n * 重写初始化,加载默认按钮\n */\n public async init(): Promise {\n await super.init();\n\n // 动态加载默认按钮配置\n const { createHomeButton } = await import('./buttons/home');\n const { locationButton } = await import('./buttons/location');\n const { walkMenuButton } = await import('./buttons/walk/walk-menu');\n const { walkPersonButton } = await import('./buttons/walk/walk-person');\n const { walkBirdButton } = await import('./buttons/walk/walk-bird');\n const { settingButton } = await import('./buttons/setting');\n const { infoButton } = await import('./buttons/info');\n\n this.addGroup('group-1');\n\n // 使用工厂函数创建按钮,并注入 engine\n if (this.engine) {\n this.addButton(createHomeButton(this.engine));\n } else {\n console.warn('[Toolbar] Engine not available when creating buttons.');\n }\n\n this.addButton(walkMenuButton);\n this.addButton(walkPersonButton);\n this.addButton(walkBirdButton);\n this.addButton(locationButton);\n this.addGroup('group-2');\n this.addButton(settingButton);\n this.addButton(infoButton);\n\n this.render();\n }\n}\n","import { BimEngine } from '../bim-engine';\nimport { EngineEvents } from '../types/events';\n\nexport abstract class BimComponent {\n protected engine: BimEngine;\n\n constructor(engine: BimEngine) {\n this.engine = engine;\n }\n\n /**\n * Helper to send events easily\n */\n protected emit(event: K, payload: EngineEvents[K]): void {\n this.engine.emit(event, payload);\n }\n\n /**\n * Helper to listen to events easily\n * Returns an unsubscribe function\n */\n protected on(event: K, listener: (payload: EngineEvents[K]) => void): () => void {\n return this.engine.on(event, listener);\n }\n\n abstract destroy(): void;\n}\n","import type { ButtonGroupColors, ButtonConfig } from '../components/button-group/index.type';\nimport { Toolbar } from '../components/button-group/toolbar';\nimport type { ThemeConfig } from '../themes/types';\nimport { BimComponent } from '../core/component';\nimport type { BimEngine } from '../bim-engine';\n\n/**\n * 底部工具栏管理器 (ToolbarManager)\n * 仅负责管理底部工具栏实例。\n */\nexport class ToolbarManager extends BimComponent {\n private toolbar: Toolbar | null = null;\n private toolbarContainer: HTMLElement | null = null;\n private container: HTMLElement;\n\n constructor(engine: BimEngine, container: HTMLElement) {\n super(engine);\n this.container = container;\n this.init();\n }\n\n private init() {\n // 创建底部工具栏专用容器\n this.toolbarContainer = document.createElement('div');\n this.toolbarContainer.id = 'opt-btn-groups';\n this.toolbarContainer.className = 'bim-engine-opt-btn-container is-bottom-toolbar';\n this.container.appendChild(this.toolbarContainer);\n\n this.toolbar = new Toolbar({\n container: this.toolbarContainer,\n showLabel: true,\n direction: 'row',\n position: 'bottom-center', // 底部居中\n align: 'vertical', // 图标在上\n expand: 'up' // 向上展开\n });\n\n // 注入 engine 到 Toolbar\n // @ts-ignore - Toolbar 还没更新类型,暂时忽略\n this.toolbar.setEngine(this.engine);\n\n this.toolbar.init();\n }\n\n public updateTheme(theme: ThemeConfig) {\n this.toolbar?.setTheme(theme);\n }\n\n public refresh() {\n this.toolbar?.render();\n }\n\n public destroy() {\n this.toolbar?.destroy();\n this.toolbar = null;\n }\n\n // --- 转发 API ---\n public addGroup(groupId: string, beforeGroupId?: string) { this.toolbar?.addGroup(groupId, beforeGroupId); this.toolbar?.render(); }\n public addButton(config: ButtonConfig) { this.toolbar?.addButton(config); this.toolbar?.render(); }\n public setButtonVisibility(id: string, v: boolean) { this.toolbar?.updateButtonVisibility(id, v); }\n public setShowLabel(show: boolean) { this.toolbar?.setShowLabel(show); }\n public setVisible(visible: boolean) {\n if (this.toolbarContainer) {\n this.toolbarContainer.style.visibility = visible ? 'visible' : 'hidden';\n }\n }\n public setBackgroundColor(color: string) { this.toolbar?.setBackgroundColor(color); }\n public setColors(colors: ButtonGroupColors) { this.toolbar?.setColors(colors); }\n}\n","import { BimButtonGroup } from '../components/button-group';\nimport type { ButtonGroupOptions } from '../components/button-group/index.type';\nimport type { ThemeConfig } from '../themes/types';\nimport { BimComponent } from '../core/component';\nimport type { BimEngine } from '../bim-engine';\n\n/**\n * 通用按钮组管理器 (ButtonGroupManager)\n * 负责创建和管理通用的按钮组实例。\n */\nexport class ButtonGroupManager extends BimComponent {\n private groups: Map = new Map();\n private container: HTMLElement;\n\n constructor(engine: BimEngine, container: HTMLElement) {\n super(engine);\n this.container = container;\n }\n\n public create(id: string, options: Omit): BimButtonGroup {\n const group = new BimButtonGroup({\n container: this.container,\n ...options\n });\n\n // @ts-ignore\n group.setEngine(this.engine);\n\n group.init();\n this.groups.set(id, group);\n return group;\n }\n\n public get(id: string): BimButtonGroup | undefined {\n return this.groups.get(id);\n }\n\n public updateTheme(theme: ThemeConfig) {\n this.groups.forEach(group => group.setTheme(theme));\n }\n\n public destroy() {\n this.groups.forEach(group => group.destroy());\n this.groups.clear();\n }\n}\n","import './index.css';\nimport type { DialogOptions } from './index.type';\nimport type { ThemeConfig } from '../../themes/types';\nimport { IBimComponent } from '../../types/component';\nimport { themeManager } from '../../services/theme';\nimport { t, localeManager } from '../../services/locale';\n\n/**\n * 通用弹窗组件类\n * 支持拖拽、缩放、自定义内容和位置。\n */\nexport class BimDialog implements IBimComponent {\n private element: HTMLElement;\n private options: DialogOptions;\n private container: HTMLElement;\n private header: HTMLElement;\n private contentArea: HTMLElement;\n private _isDestroyed = false;\n private _isInitialized = false;\n private unsubscribeTheme: (() => void) | null = null;\n private unsubscribeLocale: (() => void) | null = null;\n\n // 性能优化:用于存储 requestAnimationFrame 的 ID\n private rafId: number | null = null;\n\n /**\n * 构造函数\n * @param options 弹窗配置选项\n */\n constructor(options: DialogOptions) {\n // 合并默认配置\n this.options = {\n title: 'Dialog',\n width: 300,\n height: 'auto',\n position: 'center',\n draggable: true,\n resizable: false,\n minWidth: 200,\n minHeight: 100,\n ...options\n };\n this.container = options.container;\n\n // 创建 DOM 结构\n this.element = this.createDom();\n this.header = this.element.querySelector('.bim-dialog-header') as HTMLElement;\n this.contentArea = this.element.querySelector('.bim-dialog-content') as HTMLElement;\n\n // 自动初始化 (为了兼容现有逻辑)\n this.init();\n }\n\n /**\n * 设置主题\n * @param theme 全局主题配置\n */\n public setTheme(theme: ThemeConfig) {\n const style = this.element.style;\n if (!this.options.backgroundColor) style.setProperty('--bim-dialog-bg', theme.panelBackground);\n if (!this.options.headerBackgroundColor) style.setProperty('--bim-dialog-header-bg', theme.componentHover);\n if (!this.options.titleColor) style.setProperty('--bim-dialog-title-color', theme.textPrimary);\n if (!this.options.textColor) style.setProperty('--bim-dialog-text-color', theme.textPrimary);\n if (!this.options.borderColor) style.setProperty('--bim-dialog-border-color', theme.border);\n }\n\n /**\n * 初始化组件功能 (接口实现)\n */\n public init() {\n if (this._isInitialized) return;\n\n this.container.appendChild(this.element);\n\n // 必须先挂载才能计算尺寸进行定位\n this.initPosition();\n\n if (this.options.draggable) {\n this.initDrag();\n }\n\n if (this.options.resizable) {\n this.initResize();\n }\n\n this._isInitialized = true;\n\n // 调用弹窗开启后回调\n if (this.options.onOpen) {\n this.options.onOpen();\n }\n\n // 自动订阅主题变更\n this.unsubscribeTheme = themeManager.subscribe((theme) => {\n this.setTheme(theme);\n });\n\n // 自动订阅语言变更\n this.unsubscribeLocale = localeManager.subscribe(() => {\n this.setLocales();\n });\n }\n\n public setLocales(): void {\n if (this.options.title) {\n const titleEl = this.header.querySelector('.bim-dialog-title');\n if (titleEl) {\n titleEl.textContent = t(this.options.title);\n }\n }\n }\n\n /**\n * 创建弹窗的 DOM 结构\n */\n private createDom(): HTMLElement {\n const el = document.createElement('div');\n el.className = 'bim-dialog';\n\n if (this.options.id) el.id = this.options.id;\n\n // 应用颜色配置到 CSS 变量\n const style = el.style;\n if (this.options.backgroundColor) style.setProperty('--bim-dialog-bg', this.options.backgroundColor);\n if (this.options.headerBackgroundColor) style.setProperty('--bim-dialog-header-bg', this.options.headerBackgroundColor);\n if (this.options.titleColor) style.setProperty('--bim-dialog-title-color', this.options.titleColor);\n if (this.options.textColor) style.setProperty('--bim-dialog-text-color', this.options.textColor);\n if (this.options.borderColor) style.setProperty('--bim-dialog-border-color', this.options.borderColor);\n\n // 设置初始尺寸\n this.setSize(el, this.options.width, this.options.height);\n // 确保最小尺寸生效\n if (this.options.minWidth) el.style.minWidth = `${this.options.minWidth}px`;\n\n // 创建标题栏 (Header)\n const header = document.createElement('div');\n header.className = 'bim-dialog-header';\n if (this.options.draggable) header.classList.add('draggable');\n\n const title = document.createElement('span');\n title.className = 'bim-dialog-title';\n title.textContent = this.options.title ? t(this.options.title) : '';\n\n const closeBtn = document.createElement('span');\n closeBtn.className = 'bim-dialog-close';\n closeBtn.innerHTML = '×';\n // 修复 TS 报错:去掉未使用的参数 e\n closeBtn.onclick = () => {\n this.close();\n };\n\n header.appendChild(title);\n header.appendChild(closeBtn);\n\n // 创建内容区域 (Content)\n const content = document.createElement('div');\n content.className = 'bim-dialog-content';\n if (typeof this.options.content === 'string') {\n content.innerHTML = this.options.content;\n } else if (this.options.content instanceof HTMLElement) {\n content.appendChild(this.options.content);\n }\n\n el.appendChild(header);\n el.appendChild(content);\n\n // 如果允许缩放,创建缩放手柄\n if (this.options.resizable) {\n const resizeHandle = document.createElement('div');\n resizeHandle.className = 'bim-dialog-resize-handle';\n el.appendChild(resizeHandle);\n }\n\n // ==================== 事件拦截核心逻辑 ====================\n // 定义阻断逻辑:只阻止冒泡,不阻止捕获,也不阻止默认行为(除非显式阻止)\n const stopPropagation = (e: Event) => {\n e.stopPropagation();\n };\n\n // 现代浏览器和 3D 引擎 (Three.js/Cesium) 交互事件\n const events = [\n 'click', 'dblclick', 'contextmenu', 'wheel',\n 'mousedown', 'mouseup', 'mousemove',\n 'touchstart', 'touchend', 'touchmove',\n 'pointerdown', 'pointerup', 'pointermove', 'pointerenter', 'pointerleave', 'pointerover', 'pointerout'\n ];\n\n // 绑定监听器 (默认冒泡阶段)\n // 这样内部元素(如关闭按钮)先触发,然后冒泡到这里被拦截,不再传给地图\n events.forEach(eventType => {\n el.addEventListener(eventType, stopPropagation, { passive: false });\n });\n\n return el;\n }\n\n /**\n * 设置元素尺寸\n */\n private setSize(el: HTMLElement, width?: number | string, height?: number | string) {\n if (width !== undefined) {\n if (width === 'auto' || width === 'fit-content') {\n el.style.width = width;\n } else {\n el.style.width = typeof width === 'number' ? `${width}px` : width;\n }\n }\n if (height !== undefined) {\n if (height === 'auto' || height === 'fit-content') {\n el.style.height = height;\n } else {\n el.style.height = typeof height === 'number' ? `${height}px` : height;\n }\n }\n }\n\n /**\n * 根据内容自动调整弹窗宽度\n * @param recenter 是否重新计算定位(例如保持居中),默认 true\n */\n public fitWidth(recenter: boolean = false) {\n // 1. 设置为 fit-content 以获取自然宽度,高度保持不变\n this.element.style.width = 'fit-content';\n\n // 2. 如果需要重新定位\n if (recenter) {\n this.initPosition();\n }\n }\n\n /**\n * 初始化弹窗位置\n */\n private initPosition() {\n const pos = this.options.position;\n const elRect = this.element.getBoundingClientRect();\n\n // 计算相对父容器的定位\n let left = 0;\n let top = 0;\n\n const pW = this.container.clientWidth;\n const pH = this.container.clientHeight;\n const elW = elRect.width;\n const elH = elRect.height;\n\n if (typeof pos === 'object' && 'x' in pos) {\n left = pos.x;\n top = pos.y;\n } else {\n switch (pos) {\n case 'center':\n left = (pW - elW) / 2;\n top = (pH - elH) / 2;\n break;\n case 'top-left': left = 0; top = 0; break;\n case 'top-center': left = (pW - elW) / 2; top = 0; break;\n case 'top-right': left = pW - elW; top = 0; break;\n case 'left-center': left = 0; top = (pH - elH) / 2; break;\n case 'right-center': left = pW - elW; top = (pH - elH) / 2; break;\n case 'bottom-left': left = 0; top = pH - elH; break;\n case 'bottom-center': left = (pW - elW) / 2; top = pH - elH; break;\n case 'bottom-right': left = pW - elW; top = pH - elH; break;\n default:\n left = (pW - elW) / 2;\n top = (pH - elH) / 2;\n }\n }\n\n left = Math.max(0, Math.min(left, pW - elW));\n top = Math.max(0, Math.min(top, pH - elH));\n\n this.element.style.left = `${left}px`;\n this.element.style.top = `${top}px`;\n }\n\n /**\n * 初始化拖拽功能 (性能优化 + 解决粘手)\n */\n private initDrag() {\n let startX = 0;\n let startY = 0;\n let startLeft = 0;\n let startTop = 0;\n let containerW = 0;\n let containerH = 0;\n let elW = 0;\n let elH = 0;\n\n const onMouseDown = (e: MouseEvent) => {\n e.preventDefault(); // 阻止默认行为(如选中文本),非常重要,防止卡顿\n e.stopPropagation(); // 阻止传递给 Three.js\n\n startX = e.clientX;\n startY = e.clientY;\n startLeft = this.element.offsetLeft;\n startTop = this.element.offsetTop;\n\n // 缓存尺寸,减少 reflow\n containerW = this.container.clientWidth;\n containerH = this.container.clientHeight;\n elW = this.element.offsetWidth;\n elH = this.element.offsetHeight;\n\n // 关键:使用 capture: true\n // 确保即使 createDom 阻止了冒泡,document 也能在捕获阶段收到事件\n document.addEventListener('mousemove', onMouseMove, { capture: true });\n document.addEventListener('mouseup', onMouseUp, { capture: true });\n };\n\n const onMouseMove = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n // 节流优化:使用 requestAnimationFrame\n if (this.rafId) return;\n\n this.rafId = requestAnimationFrame(() => {\n const dx = e.clientX - startX;\n const dy = e.clientY - startY;\n\n let newLeft = startLeft + dx;\n let newTop = startTop + dy;\n\n const maxLeft = containerW - elW;\n const maxTop = containerH - elH;\n\n newLeft = Math.max(0, Math.min(newLeft, maxLeft));\n newTop = Math.max(0, Math.min(newTop, maxTop));\n\n this.element.style.left = `${newLeft}px`;\n this.element.style.top = `${newTop}px`;\n\n this.rafId = null;\n });\n };\n\n const onMouseUp = () => {\n if (this.rafId) {\n cancelAnimationFrame(this.rafId);\n this.rafId = null;\n }\n // 移除监听\n document.removeEventListener('mousemove', onMouseMove, { capture: true });\n document.removeEventListener('mouseup', onMouseUp, { capture: true });\n };\n\n this.header.addEventListener('mousedown', onMouseDown);\n }\n\n /**\n * 初始化缩放功能 (性能优化 + 解决粘手)\n */\n private initResize() {\n const handle = this.element.querySelector('.bim-dialog-resize-handle') as HTMLElement;\n if (!handle) return;\n\n let startX = 0;\n let startY = 0;\n let startW = 0;\n let startH = 0;\n\n const onMouseDown = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n startX = e.clientX;\n startY = e.clientY;\n startW = this.element.offsetWidth;\n startH = this.element.offsetHeight;\n\n // 关键:使用 capture: true\n document.addEventListener('mousemove', onMouseMove, { capture: true });\n document.addEventListener('mouseup', onMouseUp, { capture: true });\n };\n\n const onMouseMove = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n if (this.rafId) return;\n\n this.rafId = requestAnimationFrame(() => {\n const dx = e.clientX - startX;\n const dy = e.clientY - startY;\n\n const newW = Math.max(this.options.minWidth || 100, startW + dx);\n const newH = Math.max(this.options.minHeight || 50, startH + dy);\n\n this.element.style.width = `${newW}px`;\n this.element.style.height = `${newH}px`;\n\n this.rafId = null;\n });\n };\n\n const onMouseUp = () => {\n if (this.rafId) {\n cancelAnimationFrame(this.rafId);\n this.rafId = null;\n }\n document.removeEventListener('mousemove', onMouseMove, { capture: true });\n document.removeEventListener('mouseup', onMouseUp, { capture: true });\n };\n\n handle.addEventListener('mousedown', onMouseDown);\n }\n\n /**\n * 动态设置内容\n * @param content 内容元素或 HTML 字符串\n */\n public setContent(content: HTMLElement | string) {\n this.contentArea.innerHTML = '';\n if (typeof content === 'string') {\n this.contentArea.innerHTML = content;\n } else {\n this.contentArea.appendChild(content);\n }\n }\n\n /**\n * 关闭弹窗并销毁\n */\n public close() {\n if (this._isDestroyed) return;\n\n // 清理可能存在的动画帧,防止报错\n if (this.rafId) {\n cancelAnimationFrame(this.rafId);\n this.rafId = null;\n }\n\n if (this.unsubscribeTheme) {\n this.unsubscribeTheme();\n this.unsubscribeTheme = null;\n }\n if (this.unsubscribeLocale) {\n this.unsubscribeLocale();\n this.unsubscribeLocale = null;\n }\n this.element.remove();\n this._isDestroyed = true;\n if (this.options.onClose) {\n this.options.onClose();\n }\n }\n\n /**\n * 销毁组件 (接口实现)\n */\n public destroy() {\n this.close();\n }\n}\n","import './index.css';\nimport { BimDialog } from '../index';\n\n/**\n * BimInfoDialog (继承版)\n * 这是一个展示项目信息的业务弹窗组件,直接继承自 BimDialog。\n */\nexport class BimInfoDialog extends BimDialog {\n /**\n * 构造函数\n * @param container 父容器\n */\n constructor(container: HTMLElement) {\n // 1. 准备内容 DOM\n const contentEl = document.createElement('div');\n contentEl.className = 'bim-info-dialog-content';\n\n const infoTitle = document.createElement('h3');\n infoTitle.textContent = 'Model Information';\n\n const infoList = document.createElement('ul');\n infoList.innerHTML = `\n Name: Sample Project \n Version: 1.0.0 \n Date: ${new Date().toLocaleDateString()} \n Status: Active \n `;\n\n const actionBtn = document.createElement('button');\n actionBtn.textContent = 'Update Status';\n actionBtn.style.marginTop = '10px';\n actionBtn.onclick = () => {\n alert('Status updated!');\n };\n\n contentEl.appendChild(infoTitle);\n contentEl.appendChild(infoList);\n contentEl.appendChild(actionBtn);\n\n // 2. 调用父类构造函数,传入特定的配置\n super({\n container: container,\n title: 'dialog.testTitle',\n content: contentEl,\n width: 320,\n height: 'auto',\n position: 'center',\n resizable: true,\n draggable: true,\n // 可以在这里添加特定的 onClose 逻辑\n onClose: () => {\n console.log('Info dialog closed');\n },\n onOpen: () => {\n console.log('Info dialog opened');\n }\n });\n\n // 3. 如果有特定于子类的初始化逻辑,可以在 super() 之后执行\n // 例如:this.element.classList.add('my-special-class');\n }\n\n // 不需要再手动实现 setTheme, destroy, close, init\n // 它们都已从 BimDialog 继承\n}","import { BimDialog } from '../components/dialog';\nimport { BimInfoDialog } from '../components/dialog/bimInfoDialog';\nimport type { DialogOptions } from '../components/dialog/index.type';\nimport type { ThemeConfig } from '../themes/types';\nimport { themeManager } from '../services/theme';\nimport { BimComponent } from '../core/component';\nimport type { BimEngine } from '../bim-engine';\n\n/**\n * 弹窗管理器\n * 负责创建和管理应用中的各类弹窗。\n */\nexport class DialogManager extends BimComponent {\n /** 弹窗挂载的父容器 */\n private container: HTMLElement;\n /** 活跃的弹窗实例列表 */\n private activeDialogs: BimDialog[] = [];\n\n /**\n * 构造函数\n * @param engine 引擎实例\n * @param container 弹窗挂载的目标容器\n */\n constructor(engine: BimEngine, container: HTMLElement) {\n super(engine);\n this.container = container;\n\n // 监听打开弹窗事件\n this.on('ui:open-dialog', (payload) => {\n // 这里可以根据 payload.id 做更复杂的逻辑,目前简单演示\n console.log('[DialogManager] Received open-dialog event:', payload);\n // 示例:如果 payload.id 是 'info',则打开 info dialog\n if (payload.id === 'info') {\n this.showInfoDialog();\n }\n });\n }\n\n /**\n * 创建一个通用弹窗\n * @param options 弹窗配置选项(不需要传 container,自动使用管理器绑定的容器)\n * @returns BimDialog 实例\n */\n public create(options: Omit): BimDialog {\n const dialog = new BimDialog({\n container: this.container,\n ...options,\n onClose: () => {\n // 从活跃列表中移除\n this.activeDialogs = this.activeDialogs.filter(d => d !== dialog);\n if (options.onClose) options.onClose();\n }\n });\n\n // 应用当前主题\n dialog.setTheme(themeManager.getTheme());\n\n this.activeDialogs.push(dialog);\n return dialog;\n }\n\n /**\n * 显示二次封装的模型信息弹窗\n * 演示如何调用特定的业务弹窗组件\n */\n public showInfoDialog() {\n // 最佳实践:所有弹窗应通过 create 统一管理,或者手动加入管理。\n new BimInfoDialog(this.container);\n // 暂时不做主题追踪,作为遗留逻辑保留\n }\n\n /**\n * 响应全局主题变更\n * @param theme 全局主题配置\n */\n public updateTheme(theme: ThemeConfig) {\n this.activeDialogs.forEach(dialog => {\n if (dialog.setTheme) {\n dialog.setTheme(theme);\n }\n });\n }\n\n public destroy() {\n this.activeDialogs.forEach(d => d.destroy());\n this.activeDialogs = [];\n }\n}","const Ni = { ROTATE: 0, DOLLY: 1, PAN: 2 }, Ii = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }, Nh = 0, tl = 1, Fh = 2, Dc = 1, Lc = 2, On = 3, En = 0, zt = 1, Wt = 2, Mt = 0, Fi = 1, _r = 2, nl = 3, il = 4, Ic = 5, cn = 100, Oh = 101, Bh = 102, zh = 103, kh = 104, ps = 200, Vh = 201, Gh = 202, Hh = 203, ba = 204, ya = 205, Ta = 206, Wh = 207, Ea = 208, Xh = 209, jh = 210, qh = 211, Yh = 212, Kh = 213, Zh = 214, wa = 0, Aa = 1, Ra = 2, Vi = 3, Ca = 4, Pa = 5, Da = 6, La = 7, So = 0, $h = 1, Jh = 2, Jn = 0, Uc = 1, Nc = 2, Fc = 3, bo = 4, Oc = 5, Bc = 6, zc = 7, sl = \"attached\", Qh = \"detached\", kc = 300, Gi = 301, Hi = 302, vr = 303, Ia = 304, Rr = 306, wn = 1e3, en = 1001, Mr = 1002, Dt = 1003, Vc = 1004, ms = 1005, bt = 1006, ur = 1007, yn = 1008, mn = 1009, Gc = 1010, Hc = 1011, Ss = 1012, yo = 1013, di = 1014, Xt = 1015, xt = 1016, To = 1017, Eo = 1018, Wi = 1020, Wc = 35902, Xc = 35899, jc = 1021, qc = 1022, Zt = 1023, bs = 1026, Xi = 1027, wo = 1028, Ao = 1029, Ro = 1030, Co = 1031, Po = 1033, dr = 33776, fr = 33777, pr = 33778, mr = 33779, Ua = 35840, Na = 35841, Fa = 35842, Oa = 35843, Ba = 36196, za = 37492, ka = 37496, Va = 37808, Ga = 37809, Ha = 37810, Wa = 37811, Xa = 37812, ja = 37813, qa = 37814, Ya = 37815, Ka = 37816, Za = 37817, $a = 37818, Ja = 37819, Qa = 37820, eo = 37821, to = 36492, no = 36494, io = 36495, so = 36283, ro = 36284, ao = 36285, oo = 36286, ys = 2300, Ts = 2301, Ur = 2302, rl = 2400, al = 2401, ol = 2402, eu = 2500, tu = 0, Yc = 1, lo = 2, nu = 3200, Kc = 3201, Cr = 0, iu = 1, Kn = \"\", Rt = \"srgb\", Ut = \"srgb-linear\", Sr = \"linear\", et = \"srgb\", xi = 7680, Nr = 34055, Fr = 34056, su = 517, co = 519, ru = 512, au = 513, ou = 514, Zc = 515, lu = 516, cu = 517, hu = 518, uu = 519, ho = 35044, ll = \"300 es\", Tn = 2e3, br = 2001;\nfunction $c(i) {\n for (let e = i.length - 1; e >= 0; --e)\n if (i[e] >= 65535) return !0;\n return !1;\n}\nfunction Es(i) {\n return document.createElementNS(\"http://www.w3.org/1999/xhtml\", i);\n}\nfunction du() {\n const i = Es(\"canvas\");\n return i.style.display = \"block\", i;\n}\nconst cl = {};\nfunction yr(...i) {\n const e = \"THREE.\" + i.shift();\n console.log(e, ...i);\n}\nfunction Te(...i) {\n const e = \"THREE.\" + i.shift();\n console.warn(e, ...i);\n}\nfunction Xe(...i) {\n const e = \"THREE.\" + i.shift();\n console.error(e, ...i);\n}\nfunction ws(...i) {\n const e = i.join(\" \");\n e in cl || (cl[e] = !0, Te(...i));\n}\nfunction fu(i, e, t) {\n return new Promise(function(n, s) {\n function r() {\n switch (i.clientWaitSync(e, i.SYNC_FLUSH_COMMANDS_BIT, 0)) {\n case i.WAIT_FAILED:\n s();\n break;\n case i.TIMEOUT_EXPIRED:\n setTimeout(r, t);\n break;\n default:\n n();\n }\n }\n setTimeout(r, t);\n });\n}\nclass mi {\n /**\n * Adds the given event listener to the given event type.\n *\n * @param {string} type - The type of event to listen to.\n * @param {Function} listener - The function that gets called when the event is fired.\n */\n addEventListener(e, t) {\n this._listeners === void 0 && (this._listeners = {});\n const n = this._listeners;\n n[e] === void 0 && (n[e] = []), n[e].indexOf(t) === -1 && n[e].push(t);\n }\n /**\n * Returns `true` if the given event listener has been added to the given event type.\n *\n * @param {string} type - The type of event.\n * @param {Function} listener - The listener to check.\n * @return {boolean} Whether the given event listener has been added to the given event type.\n */\n hasEventListener(e, t) {\n const n = this._listeners;\n return n === void 0 ? !1 : n[e] !== void 0 && n[e].indexOf(t) !== -1;\n }\n /**\n * Removes the given event listener from the given event type.\n *\n * @param {string} type - The type of event.\n * @param {Function} listener - The listener to remove.\n */\n removeEventListener(e, t) {\n const n = this._listeners;\n if (n === void 0) return;\n const s = n[e];\n if (s !== void 0) {\n const r = s.indexOf(t);\n r !== -1 && s.splice(r, 1);\n }\n }\n /**\n * Dispatches an event object.\n *\n * @param {Object} event - The event that gets fired.\n */\n dispatchEvent(e) {\n const t = this._listeners;\n if (t === void 0) return;\n const n = t[e.type];\n if (n !== void 0) {\n e.target = this;\n const s = n.slice(0);\n for (let r = 0, a = s.length; r < a; r++)\n s[r].call(this, e);\n e.target = null;\n }\n }\n}\nconst Lt = [\"00\", \"01\", \"02\", \"03\", \"04\", \"05\", \"06\", \"07\", \"08\", \"09\", \"0a\", \"0b\", \"0c\", \"0d\", \"0e\", \"0f\", \"10\", \"11\", \"12\", \"13\", \"14\", \"15\", \"16\", \"17\", \"18\", \"19\", \"1a\", \"1b\", \"1c\", \"1d\", \"1e\", \"1f\", \"20\", \"21\", \"22\", \"23\", \"24\", \"25\", \"26\", \"27\", \"28\", \"29\", \"2a\", \"2b\", \"2c\", \"2d\", \"2e\", \"2f\", \"30\", \"31\", \"32\", \"33\", \"34\", \"35\", \"36\", \"37\", \"38\", \"39\", \"3a\", \"3b\", \"3c\", \"3d\", \"3e\", \"3f\", \"40\", \"41\", \"42\", \"43\", \"44\", \"45\", \"46\", \"47\", \"48\", \"49\", \"4a\", \"4b\", \"4c\", \"4d\", \"4e\", \"4f\", \"50\", \"51\", \"52\", \"53\", \"54\", \"55\", \"56\", \"57\", \"58\", \"59\", \"5a\", \"5b\", \"5c\", \"5d\", \"5e\", \"5f\", \"60\", \"61\", \"62\", \"63\", \"64\", \"65\", \"66\", \"67\", \"68\", \"69\", \"6a\", \"6b\", \"6c\", \"6d\", \"6e\", \"6f\", \"70\", \"71\", \"72\", \"73\", \"74\", \"75\", \"76\", \"77\", \"78\", \"79\", \"7a\", \"7b\", \"7c\", \"7d\", \"7e\", \"7f\", \"80\", \"81\", \"82\", \"83\", \"84\", \"85\", \"86\", \"87\", \"88\", \"89\", \"8a\", \"8b\", \"8c\", \"8d\", \"8e\", \"8f\", \"90\", \"91\", \"92\", \"93\", \"94\", \"95\", \"96\", \"97\", \"98\", \"99\", \"9a\", \"9b\", \"9c\", \"9d\", \"9e\", \"9f\", \"a0\", \"a1\", \"a2\", \"a3\", \"a4\", \"a5\", \"a6\", \"a7\", \"a8\", \"a9\", \"aa\", \"ab\", \"ac\", \"ad\", \"ae\", \"af\", \"b0\", \"b1\", \"b2\", \"b3\", \"b4\", \"b5\", \"b6\", \"b7\", \"b8\", \"b9\", \"ba\", \"bb\", \"bc\", \"bd\", \"be\", \"bf\", \"c0\", \"c1\", \"c2\", \"c3\", \"c4\", \"c5\", \"c6\", \"c7\", \"c8\", \"c9\", \"ca\", \"cb\", \"cc\", \"cd\", \"ce\", \"cf\", \"d0\", \"d1\", \"d2\", \"d3\", \"d4\", \"d5\", \"d6\", \"d7\", \"d8\", \"d9\", \"da\", \"db\", \"dc\", \"dd\", \"de\", \"df\", \"e0\", \"e1\", \"e2\", \"e3\", \"e4\", \"e5\", \"e6\", \"e7\", \"e8\", \"e9\", \"ea\", \"eb\", \"ec\", \"ed\", \"ee\", \"ef\", \"f0\", \"f1\", \"f2\", \"f3\", \"f4\", \"f5\", \"f6\", \"f7\", \"f8\", \"f9\", \"fa\", \"fb\", \"fc\", \"fd\", \"fe\", \"ff\"];\nlet hl = 1234567;\nconst _s = Math.PI / 180, ji = 180 / Math.PI;\nfunction fn() {\n const i = Math.random() * 4294967295 | 0, e = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, n = Math.random() * 4294967295 | 0;\n return (Lt[i & 255] + Lt[i >> 8 & 255] + Lt[i >> 16 & 255] + Lt[i >> 24 & 255] + \"-\" + Lt[e & 255] + Lt[e >> 8 & 255] + \"-\" + Lt[e >> 16 & 15 | 64] + Lt[e >> 24 & 255] + \"-\" + Lt[t & 63 | 128] + Lt[t >> 8 & 255] + \"-\" + Lt[t >> 16 & 255] + Lt[t >> 24 & 255] + Lt[n & 255] + Lt[n >> 8 & 255] + Lt[n >> 16 & 255] + Lt[n >> 24 & 255]).toLowerCase();\n}\nfunction He(i, e, t) {\n return Math.max(e, Math.min(t, i));\n}\nfunction Do(i, e) {\n return (i % e + e) % e;\n}\nfunction pu(i, e, t, n, s) {\n return n + (i - e) * (s - n) / (t - e);\n}\nfunction mu(i, e, t) {\n return i !== e ? (t - i) / (e - i) : 0;\n}\nfunction vs(i, e, t) {\n return (1 - t) * i + t * e;\n}\nfunction gu(i, e, t, n) {\n return vs(i, e, 1 - Math.exp(-t * n));\n}\nfunction xu(i, e = 1) {\n return e - Math.abs(Do(i, e * 2) - e);\n}\nfunction _u(i, e, t) {\n return i <= e ? 0 : i >= t ? 1 : (i = (i - e) / (t - e), i * i * (3 - 2 * i));\n}\nfunction vu(i, e, t) {\n return i <= e ? 0 : i >= t ? 1 : (i = (i - e) / (t - e), i * i * i * (i * (i * 6 - 15) + 10));\n}\nfunction Mu(i, e) {\n return i + Math.floor(Math.random() * (e - i + 1));\n}\nfunction Su(i, e) {\n return i + Math.random() * (e - i);\n}\nfunction bu(i) {\n return i * (0.5 - Math.random());\n}\nfunction yu(i) {\n i !== void 0 && (hl = i);\n let e = hl += 1831565813;\n return e = Math.imul(e ^ e >>> 15, e | 1), e ^= e + Math.imul(e ^ e >>> 7, e | 61), ((e ^ e >>> 14) >>> 0) / 4294967296;\n}\nfunction Tu(i) {\n return i * _s;\n}\nfunction Eu(i) {\n return i * ji;\n}\nfunction wu(i) {\n return (i & i - 1) === 0 && i !== 0;\n}\nfunction Au(i) {\n return Math.pow(2, Math.ceil(Math.log(i) / Math.LN2));\n}\nfunction Ru(i) {\n return Math.pow(2, Math.floor(Math.log(i) / Math.LN2));\n}\nfunction Cu(i, e, t, n, s) {\n const r = Math.cos, a = Math.sin, o = r(t / 2), l = a(t / 2), c = r((e + n) / 2), h = a((e + n) / 2), u = r((e - n) / 2), d = a((e - n) / 2), p = r((n - e) / 2), g = a((n - e) / 2);\n switch (s) {\n case \"XYX\":\n i.set(o * h, l * u, l * d, o * c);\n break;\n case \"YZY\":\n i.set(l * d, o * h, l * u, o * c);\n break;\n case \"ZXZ\":\n i.set(l * u, l * d, o * h, o * c);\n break;\n case \"XZX\":\n i.set(o * h, l * g, l * p, o * c);\n break;\n case \"YXY\":\n i.set(l * p, o * h, l * g, o * c);\n break;\n case \"ZYZ\":\n i.set(l * g, l * p, o * h, o * c);\n break;\n default:\n Te(\"MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: \" + s);\n }\n}\nfunction hn(i, e) {\n switch (e.constructor) {\n case Float32Array:\n return i;\n case Uint32Array:\n return i / 4294967295;\n case Uint16Array:\n return i / 65535;\n case Uint8Array:\n return i / 255;\n case Int32Array:\n return Math.max(i / 2147483647, -1);\n case Int16Array:\n return Math.max(i / 32767, -1);\n case Int8Array:\n return Math.max(i / 127, -1);\n default:\n throw new Error(\"Invalid component type.\");\n }\n}\nfunction tt(i, e) {\n switch (e.constructor) {\n case Float32Array:\n return i;\n case Uint32Array:\n return Math.round(i * 4294967295);\n case Uint16Array:\n return Math.round(i * 65535);\n case Uint8Array:\n return Math.round(i * 255);\n case Int32Array:\n return Math.round(i * 2147483647);\n case Int16Array:\n return Math.round(i * 32767);\n case Int8Array:\n return Math.round(i * 127);\n default:\n throw new Error(\"Invalid component type.\");\n }\n}\nconst Lo = {\n DEG2RAD: _s,\n RAD2DEG: ji,\n /**\n * Generate a [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier)\n * (universally unique identifier).\n *\n * @static\n * @method\n * @return {string} The UUID.\n */\n generateUUID: fn,\n /**\n * Clamps the given value between min and max.\n *\n * @static\n * @method\n * @param {number} value - The value to clamp.\n * @param {number} min - The min value.\n * @param {number} max - The max value.\n * @return {number} The clamped value.\n */\n clamp: He,\n /**\n * Computes the Euclidean modulo of the given parameters that\n * is `( ( n % m ) + m ) % m`.\n *\n * @static\n * @method\n * @param {number} n - The first parameter.\n * @param {number} m - The second parameter.\n * @return {number} The Euclidean modulo.\n */\n euclideanModulo: Do,\n /**\n * Performs a linear mapping from range `` to range ``\n * for the given value.\n *\n * @static\n * @method\n * @param {number} x - The value to be mapped.\n * @param {number} a1 - Minimum value for range A.\n * @param {number} a2 - Maximum value for range A.\n * @param {number} b1 - Minimum value for range B.\n * @param {number} b2 - Maximum value for range B.\n * @return {number} The mapped value.\n */\n mapLinear: pu,\n /**\n * Returns the percentage in the closed interval `[0, 1]` of the given value\n * between the start and end point.\n *\n * @static\n * @method\n * @param {number} x - The start point\n * @param {number} y - The end point.\n * @param {number} value - A value between start and end.\n * @return {number} The interpolation factor.\n */\n inverseLerp: mu,\n /**\n * Returns a value linearly interpolated from two known points based on the given interval -\n * `t = 0` will return `x` and `t = 1` will return `y`.\n *\n * @static\n * @method\n * @param {number} x - The start point\n * @param {number} y - The end point.\n * @param {number} t - The interpolation factor in the closed interval `[0, 1]`.\n * @return {number} The interpolated value.\n */\n lerp: vs,\n /**\n * Smoothly interpolate a number from `x` to `y` in a spring-like manner using a delta\n * time to maintain frame rate independent movement. For details, see\n * [Frame rate independent damping using lerp](http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/).\n *\n * @static\n * @method\n * @param {number} x - The current point.\n * @param {number} y - The target point.\n * @param {number} lambda - A higher lambda value will make the movement more sudden,\n * and a lower value will make the movement more gradual.\n * @param {number} dt - Delta time in seconds.\n * @return {number} The interpolated value.\n */\n damp: gu,\n /**\n * Returns a value that alternates between `0` and the given `length` parameter.\n *\n * @static\n * @method\n * @param {number} x - The value to pingpong.\n * @param {number} [length=1] - The positive value the function will pingpong to.\n * @return {number} The alternated value.\n */\n pingpong: xu,\n /**\n * Returns a value in the range `[0,1]` that represents the percentage that `x` has\n * moved between `min` and `max`, but smoothed or slowed down the closer `x` is to\n * the `min` and `max`.\n *\n * See [Smoothstep](http://en.wikipedia.org/wiki/Smoothstep) for more details.\n *\n * @static\n * @method\n * @param {number} x - The value to evaluate based on its position between min and max.\n * @param {number} min - The min value. Any x value below min will be `0`.\n * @param {number} max - The max value. Any x value above max will be `1`.\n * @return {number} The alternated value.\n */\n smoothstep: _u,\n /**\n * A [variation on smoothstep](https://en.wikipedia.org/wiki/Smoothstep#Variations)\n * that has zero 1st and 2nd order derivatives at x=0 and x=1.\n *\n * @static\n * @method\n * @param {number} x - The value to evaluate based on its position between min and max.\n * @param {number} min - The min value. Any x value below min will be `0`.\n * @param {number} max - The max value. Any x value above max will be `1`.\n * @return {number} The alternated value.\n */\n smootherstep: vu,\n /**\n * Returns a random integer from `` interval.\n *\n * @static\n * @method\n * @param {number} low - The lower value boundary.\n * @param {number} high - The upper value boundary\n * @return {number} A random integer.\n */\n randInt: Mu,\n /**\n * Returns a random float from `` interval.\n *\n * @static\n * @method\n * @param {number} low - The lower value boundary.\n * @param {number} high - The upper value boundary\n * @return {number} A random float.\n */\n randFloat: Su,\n /**\n * Returns a random integer from `<-range/2, range/2>` interval.\n *\n * @static\n * @method\n * @param {number} range - Defines the value range.\n * @return {number} A random float.\n */\n randFloatSpread: bu,\n /**\n * Returns a deterministic pseudo-random float in the interval `[0, 1]`.\n *\n * @static\n * @method\n * @param {number} [s] - The integer seed.\n * @return {number} A random float.\n */\n seededRandom: yu,\n /**\n * Converts degrees to radians.\n *\n * @static\n * @method\n * @param {number} degrees - A value in degrees.\n * @return {number} The converted value in radians.\n */\n degToRad: Tu,\n /**\n * Converts radians to degrees.\n *\n * @static\n * @method\n * @param {number} radians - A value in radians.\n * @return {number} The converted value in degrees.\n */\n radToDeg: Eu,\n /**\n * Returns `true` if the given number is a power of two.\n *\n * @static\n * @method\n * @param {number} value - The value to check.\n * @return {boolean} Whether the given number is a power of two or not.\n */\n isPowerOfTwo: wu,\n /**\n * Returns the smallest power of two that is greater than or equal to the given number.\n *\n * @static\n * @method\n * @param {number} value - The value to find a POT for.\n * @return {number} The smallest power of two that is greater than or equal to the given number.\n */\n ceilPowerOfTwo: Au,\n /**\n * Returns the largest power of two that is less than or equal to the given number.\n *\n * @static\n * @method\n * @param {number} value - The value to find a POT for.\n * @return {number} The largest power of two that is less than or equal to the given number.\n */\n floorPowerOfTwo: Ru,\n /**\n * Sets the given quaternion from the [Intrinsic Proper Euler Angles](https://en.wikipedia.org/wiki/Euler_angles)\n * defined by the given angles and order.\n *\n * Rotations are applied to the axes in the order specified by order:\n * rotation by angle `a` is applied first, then by angle `b`, then by angle `c`.\n *\n * @static\n * @method\n * @param {Quaternion} q - The quaternion to set.\n * @param {number} a - The rotation applied to the first axis, in radians.\n * @param {number} b - The rotation applied to the second axis, in radians.\n * @param {number} c - The rotation applied to the third axis, in radians.\n * @param {('XYX'|'XZX'|'YXY'|'YZY'|'ZXZ'|'ZYZ')} order - A string specifying the axes order.\n */\n setQuaternionFromProperEuler: Cu,\n /**\n * Normalizes the given value according to the given typed array.\n *\n * @static\n * @method\n * @param {number} value - The float value in the range `[0,1]` to normalize.\n * @param {TypedArray} array - The typed array that defines the data type of the value.\n * @return {number} The normalize value.\n */\n normalize: tt,\n /**\n * Denormalizes the given value according to the given typed array.\n *\n * @static\n * @method\n * @param {number} value - The value to denormalize.\n * @param {TypedArray} array - The typed array that defines the data type of the value.\n * @return {number} The denormalize (float) value in the range `[0,1]`.\n */\n denormalize: hn\n};\nclass le {\n /**\n * Constructs a new 2D vector.\n *\n * @param {number} [x=0] - The x value of this vector.\n * @param {number} [y=0] - The y value of this vector.\n */\n constructor(e = 0, t = 0) {\n le.prototype.isVector2 = !0, this.x = e, this.y = t;\n }\n /**\n * Alias for {@link Vector2#x}.\n *\n * @type {number}\n */\n get width() {\n return this.x;\n }\n set width(e) {\n this.x = e;\n }\n /**\n * Alias for {@link Vector2#y}.\n *\n * @type {number}\n */\n get height() {\n return this.y;\n }\n set height(e) {\n this.y = e;\n }\n /**\n * Sets the vector components.\n *\n * @param {number} x - The value of the x component.\n * @param {number} y - The value of the y component.\n * @return {Vector2} A reference to this vector.\n */\n set(e, t) {\n return this.x = e, this.y = t, this;\n }\n /**\n * Sets the vector components to the same value.\n *\n * @param {number} scalar - The value to set for all vector components.\n * @return {Vector2} A reference to this vector.\n */\n setScalar(e) {\n return this.x = e, this.y = e, this;\n }\n /**\n * Sets the vector's x component to the given value\n *\n * @param {number} x - The value to set.\n * @return {Vector2} A reference to this vector.\n */\n setX(e) {\n return this.x = e, this;\n }\n /**\n * Sets the vector's y component to the given value\n *\n * @param {number} y - The value to set.\n * @return {Vector2} A reference to this vector.\n */\n setY(e) {\n return this.y = e, this;\n }\n /**\n * Allows to set a vector component with an index.\n *\n * @param {number} index - The component index. `0` equals to x, `1` equals to y.\n * @param {number} value - The value to set.\n * @return {Vector2} A reference to this vector.\n */\n setComponent(e, t) {\n switch (e) {\n case 0:\n this.x = t;\n break;\n case 1:\n this.y = t;\n break;\n default:\n throw new Error(\"index is out of range: \" + e);\n }\n return this;\n }\n /**\n * Returns the value of the vector component which matches the given index.\n *\n * @param {number} index - The component index. `0` equals to x, `1` equals to y.\n * @return {number} A vector component value.\n */\n getComponent(e) {\n switch (e) {\n case 0:\n return this.x;\n case 1:\n return this.y;\n default:\n throw new Error(\"index is out of range: \" + e);\n }\n }\n /**\n * Returns a new vector with copied values from this instance.\n *\n * @return {Vector2} A clone of this instance.\n */\n clone() {\n return new this.constructor(this.x, this.y);\n }\n /**\n * Copies the values of the given vector to this instance.\n *\n * @param {Vector2} v - The vector to copy.\n * @return {Vector2} A reference to this vector.\n */\n copy(e) {\n return this.x = e.x, this.y = e.y, this;\n }\n /**\n * Adds the given vector to this instance.\n *\n * @param {Vector2} v - The vector to add.\n * @return {Vector2} A reference to this vector.\n */\n add(e) {\n return this.x += e.x, this.y += e.y, this;\n }\n /**\n * Adds the given scalar value to all components of this instance.\n *\n * @param {number} s - The scalar to add.\n * @return {Vector2} A reference to this vector.\n */\n addScalar(e) {\n return this.x += e, this.y += e, this;\n }\n /**\n * Adds the given vectors and stores the result in this instance.\n *\n * @param {Vector2} a - The first vector.\n * @param {Vector2} b - The second vector.\n * @return {Vector2} A reference to this vector.\n */\n addVectors(e, t) {\n return this.x = e.x + t.x, this.y = e.y + t.y, this;\n }\n /**\n * Adds the given vector scaled by the given factor to this instance.\n *\n * @param {Vector2} v - The vector.\n * @param {number} s - The factor that scales `v`.\n * @return {Vector2} A reference to this vector.\n */\n addScaledVector(e, t) {\n return this.x += e.x * t, this.y += e.y * t, this;\n }\n /**\n * Subtracts the given vector from this instance.\n *\n * @param {Vector2} v - The vector to subtract.\n * @return {Vector2} A reference to this vector.\n */\n sub(e) {\n return this.x -= e.x, this.y -= e.y, this;\n }\n /**\n * Subtracts the given scalar value from all components of this instance.\n *\n * @param {number} s - The scalar to subtract.\n * @return {Vector2} A reference to this vector.\n */\n subScalar(e) {\n return this.x -= e, this.y -= e, this;\n }\n /**\n * Subtracts the given vectors and stores the result in this instance.\n *\n * @param {Vector2} a - The first vector.\n * @param {Vector2} b - The second vector.\n * @return {Vector2} A reference to this vector.\n */\n subVectors(e, t) {\n return this.x = e.x - t.x, this.y = e.y - t.y, this;\n }\n /**\n * Multiplies the given vector with this instance.\n *\n * @param {Vector2} v - The vector to multiply.\n * @return {Vector2} A reference to this vector.\n */\n multiply(e) {\n return this.x *= e.x, this.y *= e.y, this;\n }\n /**\n * Multiplies the given scalar value with all components of this instance.\n *\n * @param {number} scalar - The scalar to multiply.\n * @return {Vector2} A reference to this vector.\n */\n multiplyScalar(e) {\n return this.x *= e, this.y *= e, this;\n }\n /**\n * Divides this instance by the given vector.\n *\n * @param {Vector2} v - The vector to divide.\n * @return {Vector2} A reference to this vector.\n */\n divide(e) {\n return this.x /= e.x, this.y /= e.y, this;\n }\n /**\n * Divides this vector by the given scalar.\n *\n * @param {number} scalar - The scalar to divide.\n * @return {Vector2} A reference to this vector.\n */\n divideScalar(e) {\n return this.multiplyScalar(1 / e);\n }\n /**\n * Multiplies this vector (with an implicit 1 as the 3rd component) by\n * the given 3x3 matrix.\n *\n * @param {Matrix3} m - The matrix to apply.\n * @return {Vector2} A reference to this vector.\n */\n applyMatrix3(e) {\n const t = this.x, n = this.y, s = e.elements;\n return this.x = s[0] * t + s[3] * n + s[6], this.y = s[1] * t + s[4] * n + s[7], this;\n }\n /**\n * If this vector's x or y value is greater than the given vector's x or y\n * value, replace that value with the corresponding min value.\n *\n * @param {Vector2} v - The vector.\n * @return {Vector2} A reference to this vector.\n */\n min(e) {\n return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this;\n }\n /**\n * If this vector's x or y value is less than the given vector's x or y\n * value, replace that value with the corresponding max value.\n *\n * @param {Vector2} v - The vector.\n * @return {Vector2} A reference to this vector.\n */\n max(e) {\n return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this;\n }\n /**\n * If this vector's x or y value is greater than the max vector's x or y\n * value, it is replaced by the corresponding value.\n * If this vector's x or y value is less than the min vector's x or y value,\n * it is replaced by the corresponding value.\n *\n * @param {Vector2} min - The minimum x and y values.\n * @param {Vector2} max - The maximum x and y values in the desired range.\n * @return {Vector2} A reference to this vector.\n */\n clamp(e, t) {\n return this.x = He(this.x, e.x, t.x), this.y = He(this.y, e.y, t.y), this;\n }\n /**\n * If this vector's x or y values are greater than the max value, they are\n * replaced by the max value.\n * If this vector's x or y values are less than the min value, they are\n * replaced by the min value.\n *\n * @param {number} minVal - The minimum value the components will be clamped to.\n * @param {number} maxVal - The maximum value the components will be clamped to.\n * @return {Vector2} A reference to this vector.\n */\n clampScalar(e, t) {\n return this.x = He(this.x, e, t), this.y = He(this.y, e, t), this;\n }\n /**\n * If this vector's length is greater than the max value, it is replaced by\n * the max value.\n * If this vector's length is less than the min value, it is replaced by the\n * min value.\n *\n * @param {number} min - The minimum value the vector length will be clamped to.\n * @param {number} max - The maximum value the vector length will be clamped to.\n * @return {Vector2} A reference to this vector.\n */\n clampLength(e, t) {\n const n = this.length();\n return this.divideScalar(n || 1).multiplyScalar(He(n, e, t));\n }\n /**\n * The components of this vector are rounded down to the nearest integer value.\n *\n * @return {Vector2} A reference to this vector.\n */\n floor() {\n return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this;\n }\n /**\n * The components of this vector are rounded up to the nearest integer value.\n *\n * @return {Vector2} A reference to this vector.\n */\n ceil() {\n return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this;\n }\n /**\n * The components of this vector are rounded to the nearest integer value\n *\n * @return {Vector2} A reference to this vector.\n */\n round() {\n return this.x = Math.round(this.x), this.y = Math.round(this.y), this;\n }\n /**\n * The components of this vector are rounded towards zero (up if negative,\n * down if positive) to an integer value.\n *\n * @return {Vector2} A reference to this vector.\n */\n roundToZero() {\n return this.x = Math.trunc(this.x), this.y = Math.trunc(this.y), this;\n }\n /**\n * Inverts this vector - i.e. sets x = -x and y = -y.\n *\n * @return {Vector2} A reference to this vector.\n */\n negate() {\n return this.x = -this.x, this.y = -this.y, this;\n }\n /**\n * Calculates the dot product of the given vector with this instance.\n *\n * @param {Vector2} v - The vector to compute the dot product with.\n * @return {number} The result of the dot product.\n */\n dot(e) {\n return this.x * e.x + this.y * e.y;\n }\n /**\n * Calculates the cross product of the given vector with this instance.\n *\n * @param {Vector2} v - The vector to compute the cross product with.\n * @return {number} The result of the cross product.\n */\n cross(e) {\n return this.x * e.y - this.y * e.x;\n }\n /**\n * Computes the square of the Euclidean length (straight-line length) from\n * (0, 0) to (x, y). If you are comparing the lengths of vectors, you should\n * compare the length squared instead as it is slightly more efficient to calculate.\n *\n * @return {number} The square length of this vector.\n */\n lengthSq() {\n return this.x * this.x + this.y * this.y;\n }\n /**\n * Computes the Euclidean length (straight-line length) from (0, 0) to (x, y).\n *\n * @return {number} The length of this vector.\n */\n length() {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n }\n /**\n * Computes the Manhattan length of this vector.\n *\n * @return {number} The length of this vector.\n */\n manhattanLength() {\n return Math.abs(this.x) + Math.abs(this.y);\n }\n /**\n * Converts this vector to a unit vector - that is, sets it equal to a vector\n * with the same direction as this one, but with a vector length of `1`.\n *\n * @return {Vector2} A reference to this vector.\n */\n normalize() {\n return this.divideScalar(this.length() || 1);\n }\n /**\n * Computes the angle in radians of this vector with respect to the positive x-axis.\n *\n * @return {number} The angle in radians.\n */\n angle() {\n return Math.atan2(-this.y, -this.x) + Math.PI;\n }\n /**\n * Returns the angle between the given vector and this instance in radians.\n *\n * @param {Vector2} v - The vector to compute the angle with.\n * @return {number} The angle in radians.\n */\n angleTo(e) {\n const t = Math.sqrt(this.lengthSq() * e.lengthSq());\n if (t === 0) return Math.PI / 2;\n const n = this.dot(e) / t;\n return Math.acos(He(n, -1, 1));\n }\n /**\n * Computes the distance from the given vector to this instance.\n *\n * @param {Vector2} v - The vector to compute the distance to.\n * @return {number} The distance.\n */\n distanceTo(e) {\n return Math.sqrt(this.distanceToSquared(e));\n }\n /**\n * Computes the squared distance from the given vector to this instance.\n * If you are just comparing the distance with another distance, you should compare\n * the distance squared instead as it is slightly more efficient to calculate.\n *\n * @param {Vector2} v - The vector to compute the squared distance to.\n * @return {number} The squared distance.\n */\n distanceToSquared(e) {\n const t = this.x - e.x, n = this.y - e.y;\n return t * t + n * n;\n }\n /**\n * Computes the Manhattan distance from the given vector to this instance.\n *\n * @param {Vector2} v - The vector to compute the Manhattan distance to.\n * @return {number} The Manhattan distance.\n */\n manhattanDistanceTo(e) {\n return Math.abs(this.x - e.x) + Math.abs(this.y - e.y);\n }\n /**\n * Sets this vector to a vector with the same direction as this one, but\n * with the specified length.\n *\n * @param {number} length - The new length of this vector.\n * @return {Vector2} A reference to this vector.\n */\n setLength(e) {\n return this.normalize().multiplyScalar(e);\n }\n /**\n * Linearly interpolates between the given vector and this instance, where\n * alpha is the percent distance along the line - alpha = 0 will be this\n * vector, and alpha = 1 will be the given one.\n *\n * @param {Vector2} v - The vector to interpolate towards.\n * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`.\n * @return {Vector2} A reference to this vector.\n */\n lerp(e, t) {\n return this.x += (e.x - this.x) * t, this.y += (e.y - this.y) * t, this;\n }\n /**\n * Linearly interpolates between the given vectors, where alpha is the percent\n * distance along the line - alpha = 0 will be first vector, and alpha = 1 will\n * be the second one. The result is stored in this instance.\n *\n * @param {Vector2} v1 - The first vector.\n * @param {Vector2} v2 - The second vector.\n * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`.\n * @return {Vector2} A reference to this vector.\n */\n lerpVectors(e, t, n) {\n return this.x = e.x + (t.x - e.x) * n, this.y = e.y + (t.y - e.y) * n, this;\n }\n /**\n * Returns `true` if this vector is equal with the given one.\n *\n * @param {Vector2} v - The vector to test for equality.\n * @return {boolean} Whether this vector is equal with the given one.\n */\n equals(e) {\n return e.x === this.x && e.y === this.y;\n }\n /**\n * Sets this vector's x value to be `array[ offset ]` and y\n * value to be `array[ offset + 1 ]`.\n *\n * @param {Array} array - An array holding the vector component values.\n * @param {number} [offset=0] - The offset into the array.\n * @return {Vector2} A reference to this vector.\n */\n fromArray(e, t = 0) {\n return this.x = e[t], this.y = e[t + 1], this;\n }\n /**\n * Writes the components of this vector to the given array. If no array is provided,\n * the method returns a new instance.\n *\n * @param {Array} [array=[]] - The target array holding the vector components.\n * @param {number} [offset=0] - Index of the first element in the array.\n * @return {Array} The vector components.\n */\n toArray(e = [], t = 0) {\n return e[t] = this.x, e[t + 1] = this.y, e;\n }\n /**\n * Sets the components of this vector from the given buffer attribute.\n *\n * @param {BufferAttribute} attribute - The buffer attribute holding vector data.\n * @param {number} index - The index into the attribute.\n * @return {Vector2} A reference to this vector.\n */\n fromBufferAttribute(e, t) {\n return this.x = e.getX(t), this.y = e.getY(t), this;\n }\n /**\n * Rotates this vector around the given center by the given angle.\n *\n * @param {Vector2} center - The point around which to rotate.\n * @param {number} angle - The angle to rotate, in radians.\n * @return {Vector2} A reference to this vector.\n */\n rotateAround(e, t) {\n const n = Math.cos(t), s = Math.sin(t), r = this.x - e.x, a = this.y - e.y;\n return this.x = r * n - a * s + e.x, this.y = r * s + a * n + e.y, this;\n }\n /**\n * Sets each component of this vector to a pseudo-random value between `0` and\n * `1`, excluding `1`.\n *\n * @return {Vector2} A reference to this vector.\n */\n random() {\n return this.x = Math.random(), this.y = Math.random(), this;\n }\n *[Symbol.iterator]() {\n yield this.x, yield this.y;\n }\n}\nclass gn {\n /**\n * Constructs a new quaternion.\n *\n * @param {number} [x=0] - The x value of this quaternion.\n * @param {number} [y=0] - The y value of this quaternion.\n * @param {number} [z=0] - The z value of this quaternion.\n * @param {number} [w=1] - The w value of this quaternion.\n */\n constructor(e = 0, t = 0, n = 0, s = 1) {\n this.isQuaternion = !0, this._x = e, this._y = t, this._z = n, this._w = s;\n }\n /**\n * Interpolates between two quaternions via SLERP. This implementation assumes the\n * quaternion data are managed in flat arrays.\n *\n * @param {Array} dst - The destination array.\n * @param {number} dstOffset - An offset into the destination array.\n * @param {Array} src0 - The source array of the first quaternion.\n * @param {number} srcOffset0 - An offset into the first source array.\n * @param {Array} src1 - The source array of the second quaternion.\n * @param {number} srcOffset1 - An offset into the second source array.\n * @param {number} t - The interpolation factor in the range `[0,1]`.\n * @see {@link Quaternion#slerp}\n */\n static slerpFlat(e, t, n, s, r, a, o) {\n let l = n[s + 0], c = n[s + 1], h = n[s + 2], u = n[s + 3], d = r[a + 0], p = r[a + 1], g = r[a + 2], x = r[a + 3];\n if (o <= 0) {\n e[t + 0] = l, e[t + 1] = c, e[t + 2] = h, e[t + 3] = u;\n return;\n }\n if (o >= 1) {\n e[t + 0] = d, e[t + 1] = p, e[t + 2] = g, e[t + 3] = x;\n return;\n }\n if (u !== x || l !== d || c !== p || h !== g) {\n let m = l * d + c * p + h * g + u * x;\n m < 0 && (d = -d, p = -p, g = -g, x = -x, m = -m);\n let f = 1 - o;\n if (m < 0.9995) {\n const y = Math.acos(m), v = Math.sin(y);\n f = Math.sin(f * y) / v, o = Math.sin(o * y) / v, l = l * f + d * o, c = c * f + p * o, h = h * f + g * o, u = u * f + x * o;\n } else {\n l = l * f + d * o, c = c * f + p * o, h = h * f + g * o, u = u * f + x * o;\n const y = 1 / Math.sqrt(l * l + c * c + h * h + u * u);\n l *= y, c *= y, h *= y, u *= y;\n }\n }\n e[t] = l, e[t + 1] = c, e[t + 2] = h, e[t + 3] = u;\n }\n /**\n * Multiplies two quaternions. This implementation assumes the quaternion data are managed\n * in flat arrays.\n *\n * @param {Array} dst - The destination array.\n * @param {number} dstOffset - An offset into the destination array.\n * @param {Array} src0 - The source array of the first quaternion.\n * @param {number} srcOffset0 - An offset into the first source array.\n * @param {Array} src1 - The source array of the second quaternion.\n * @param {number} srcOffset1 - An offset into the second source array.\n * @return {Array} The destination array.\n * @see {@link Quaternion#multiplyQuaternions}.\n */\n static multiplyQuaternionsFlat(e, t, n, s, r, a) {\n const o = n[s], l = n[s + 1], c = n[s + 2], h = n[s + 3], u = r[a], d = r[a + 1], p = r[a + 2], g = r[a + 3];\n return e[t] = o * g + h * u + l * p - c * d, e[t + 1] = l * g + h * d + c * u - o * p, e[t + 2] = c * g + h * p + o * d - l * u, e[t + 3] = h * g - o * u - l * d - c * p, e;\n }\n /**\n * The x value of this quaternion.\n *\n * @type {number}\n * @default 0\n */\n get x() {\n return this._x;\n }\n set x(e) {\n this._x = e, this._onChangeCallback();\n }\n /**\n * The y value of this quaternion.\n *\n * @type {number}\n * @default 0\n */\n get y() {\n return this._y;\n }\n set y(e) {\n this._y = e, this._onChangeCallback();\n }\n /**\n * The z value of this quaternion.\n *\n * @type {number}\n * @default 0\n */\n get z() {\n return this._z;\n }\n set z(e) {\n this._z = e, this._onChangeCallback();\n }\n /**\n * The w value of this quaternion.\n *\n * @type {number}\n * @default 1\n */\n get w() {\n return this._w;\n }\n set w(e) {\n this._w = e, this._onChangeCallback();\n }\n /**\n * Sets the quaternion components.\n *\n * @param {number} x - The x value of this quaternion.\n * @param {number} y - The y value of this quaternion.\n * @param {number} z - The z value of this quaternion.\n * @param {number} w - The w value of this quaternion.\n * @return {Quaternion} A reference to this quaternion.\n */\n set(e, t, n, s) {\n return this._x = e, this._y = t, this._z = n, this._w = s, this._onChangeCallback(), this;\n }\n /**\n * Returns a new quaternion with copied values from this instance.\n *\n * @return {Quaternion} A clone of this instance.\n */\n clone() {\n return new this.constructor(this._x, this._y, this._z, this._w);\n }\n /**\n * Copies the values of the given quaternion to this instance.\n *\n * @param {Quaternion} quaternion - The quaternion to copy.\n * @return {Quaternion} A reference to this quaternion.\n */\n copy(e) {\n return this._x = e.x, this._y = e.y, this._z = e.z, this._w = e.w, this._onChangeCallback(), this;\n }\n /**\n * Sets this quaternion from the rotation specified by the given\n * Euler angles.\n *\n * @param {Euler} euler - The Euler angles.\n * @param {boolean} [update=true] - Whether the internal `onChange` callback should be executed or not.\n * @return {Quaternion} A reference to this quaternion.\n */\n setFromEuler(e, t = !0) {\n const n = e._x, s = e._y, r = e._z, a = e._order, o = Math.cos, l = Math.sin, c = o(n / 2), h = o(s / 2), u = o(r / 2), d = l(n / 2), p = l(s / 2), g = l(r / 2);\n switch (a) {\n case \"XYZ\":\n this._x = d * h * u + c * p * g, this._y = c * p * u - d * h * g, this._z = c * h * g + d * p * u, this._w = c * h * u - d * p * g;\n break;\n case \"YXZ\":\n this._x = d * h * u + c * p * g, this._y = c * p * u - d * h * g, this._z = c * h * g - d * p * u, this._w = c * h * u + d * p * g;\n break;\n case \"ZXY\":\n this._x = d * h * u - c * p * g, this._y = c * p * u + d * h * g, this._z = c * h * g + d * p * u, this._w = c * h * u - d * p * g;\n break;\n case \"ZYX\":\n this._x = d * h * u - c * p * g, this._y = c * p * u + d * h * g, this._z = c * h * g - d * p * u, this._w = c * h * u + d * p * g;\n break;\n case \"YZX\":\n this._x = d * h * u + c * p * g, this._y = c * p * u + d * h * g, this._z = c * h * g - d * p * u, this._w = c * h * u - d * p * g;\n break;\n case \"XZY\":\n this._x = d * h * u - c * p * g, this._y = c * p * u - d * h * g, this._z = c * h * g + d * p * u, this._w = c * h * u + d * p * g;\n break;\n default:\n Te(\"Quaternion: .setFromEuler() encountered an unknown order: \" + a);\n }\n return t === !0 && this._onChangeCallback(), this;\n }\n /**\n * Sets this quaternion from the given axis and angle.\n *\n * @param {Vector3} axis - The normalized axis.\n * @param {number} angle - The angle in radians.\n * @return {Quaternion} A reference to this quaternion.\n */\n setFromAxisAngle(e, t) {\n const n = t / 2, s = Math.sin(n);\n return this._x = e.x * s, this._y = e.y * s, this._z = e.z * s, this._w = Math.cos(n), this._onChangeCallback(), this;\n }\n /**\n * Sets this quaternion from the given rotation matrix.\n *\n * @param {Matrix4} m - A 4x4 matrix of which the upper 3x3 of matrix is a pure rotation matrix (i.e. unscaled).\n * @return {Quaternion} A reference to this quaternion.\n */\n setFromRotationMatrix(e) {\n const t = e.elements, n = t[0], s = t[4], r = t[8], a = t[1], o = t[5], l = t[9], c = t[2], h = t[6], u = t[10], d = n + o + u;\n if (d > 0) {\n const p = 0.5 / Math.sqrt(d + 1);\n this._w = 0.25 / p, this._x = (h - l) * p, this._y = (r - c) * p, this._z = (a - s) * p;\n } else if (n > o && n > u) {\n const p = 2 * Math.sqrt(1 + n - o - u);\n this._w = (h - l) / p, this._x = 0.25 * p, this._y = (s + a) / p, this._z = (r + c) / p;\n } else if (o > u) {\n const p = 2 * Math.sqrt(1 + o - n - u);\n this._w = (r - c) / p, this._x = (s + a) / p, this._y = 0.25 * p, this._z = (l + h) / p;\n } else {\n const p = 2 * Math.sqrt(1 + u - n - o);\n this._w = (a - s) / p, this._x = (r + c) / p, this._y = (l + h) / p, this._z = 0.25 * p;\n }\n return this._onChangeCallback(), this;\n }\n /**\n * Sets this quaternion to the rotation required to rotate the direction vector\n * `vFrom` to the direction vector `vTo`.\n *\n * @param {Vector3} vFrom - The first (normalized) direction vector.\n * @param {Vector3} vTo - The second (normalized) direction vector.\n * @return {Quaternion} A reference to this quaternion.\n */\n setFromUnitVectors(e, t) {\n let n = e.dot(t) + 1;\n return n < 1e-8 ? (n = 0, Math.abs(e.x) > Math.abs(e.z) ? (this._x = -e.y, this._y = e.x, this._z = 0, this._w = n) : (this._x = 0, this._y = -e.z, this._z = e.y, this._w = n)) : (this._x = e.y * t.z - e.z * t.y, this._y = e.z * t.x - e.x * t.z, this._z = e.x * t.y - e.y * t.x, this._w = n), this.normalize();\n }\n /**\n * Returns the angle between this quaternion and the given one in radians.\n *\n * @param {Quaternion} q - The quaternion to compute the angle with.\n * @return {number} The angle in radians.\n */\n angleTo(e) {\n return 2 * Math.acos(Math.abs(He(this.dot(e), -1, 1)));\n }\n /**\n * Rotates this quaternion by a given angular step to the given quaternion.\n * The method ensures that the final quaternion will not overshoot `q`.\n *\n * @param {Quaternion} q - The target quaternion.\n * @param {number} step - The angular step in radians.\n * @return {Quaternion} A reference to this quaternion.\n */\n rotateTowards(e, t) {\n const n = this.angleTo(e);\n if (n === 0) return this;\n const s = Math.min(1, t / n);\n return this.slerp(e, s), this;\n }\n /**\n * Sets this quaternion to the identity quaternion; that is, to the\n * quaternion that represents \"no rotation\".\n *\n * @return {Quaternion} A reference to this quaternion.\n */\n identity() {\n return this.set(0, 0, 0, 1);\n }\n /**\n * Inverts this quaternion via {@link Quaternion#conjugate}. The\n * quaternion is assumed to have unit length.\n *\n * @return {Quaternion} A reference to this quaternion.\n */\n invert() {\n return this.conjugate();\n }\n /**\n * Returns the rotational conjugate of this quaternion. The conjugate of a\n * quaternion represents the same rotation in the opposite direction about\n * the rotational axis.\n *\n * @return {Quaternion} A reference to this quaternion.\n */\n conjugate() {\n return this._x *= -1, this._y *= -1, this._z *= -1, this._onChangeCallback(), this;\n }\n /**\n * Calculates the dot product of this quaternion and the given one.\n *\n * @param {Quaternion} v - The quaternion to compute the dot product with.\n * @return {number} The result of the dot product.\n */\n dot(e) {\n return this._x * e._x + this._y * e._y + this._z * e._z + this._w * e._w;\n }\n /**\n * Computes the squared Euclidean length (straight-line length) of this quaternion,\n * considered as a 4 dimensional vector. This can be useful if you are comparing the\n * lengths of two quaternions, as this is a slightly more efficient calculation than\n * {@link Quaternion#length}.\n *\n * @return {number} The squared Euclidean length.\n */\n lengthSq() {\n return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;\n }\n /**\n * Computes the Euclidean length (straight-line length) of this quaternion,\n * considered as a 4 dimensional vector.\n *\n * @return {number} The Euclidean length.\n */\n length() {\n return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w);\n }\n /**\n * Normalizes this quaternion - that is, calculated the quaternion that performs\n * the same rotation as this one, but has a length equal to `1`.\n *\n * @return {Quaternion} A reference to this quaternion.\n */\n normalize() {\n let e = this.length();\n return e === 0 ? (this._x = 0, this._y = 0, this._z = 0, this._w = 1) : (e = 1 / e, this._x = this._x * e, this._y = this._y * e, this._z = this._z * e, this._w = this._w * e), this._onChangeCallback(), this;\n }\n /**\n * Multiplies this quaternion by the given one.\n *\n * @param {Quaternion} q - The quaternion.\n * @return {Quaternion} A reference to this quaternion.\n */\n multiply(e) {\n return this.multiplyQuaternions(this, e);\n }\n /**\n * Pre-multiplies this quaternion by the given one.\n *\n * @param {Quaternion} q - The quaternion.\n * @return {Quaternion} A reference to this quaternion.\n */\n premultiply(e) {\n return this.multiplyQuaternions(e, this);\n }\n /**\n * Multiplies the given quaternions and stores the result in this instance.\n *\n * @param {Quaternion} a - The first quaternion.\n * @param {Quaternion} b - The second quaternion.\n * @return {Quaternion} A reference to this quaternion.\n */\n multiplyQuaternions(e, t) {\n const n = e._x, s = e._y, r = e._z, a = e._w, o = t._x, l = t._y, c = t._z, h = t._w;\n return this._x = n * h + a * o + s * c - r * l, this._y = s * h + a * l + r * o - n * c, this._z = r * h + a * c + n * l - s * o, this._w = a * h - n * o - s * l - r * c, this._onChangeCallback(), this;\n }\n /**\n * Performs a spherical linear interpolation between quaternions.\n *\n * @param {Quaternion} qb - The target quaternion.\n * @param {number} t - The interpolation factor in the closed interval `[0, 1]`.\n * @return {Quaternion} A reference to this quaternion.\n */\n slerp(e, t) {\n if (t <= 0) return this;\n if (t >= 1) return this.copy(e);\n let n = e._x, s = e._y, r = e._z, a = e._w, o = this.dot(e);\n o < 0 && (n = -n, s = -s, r = -r, a = -a, o = -o);\n let l = 1 - t;\n if (o < 0.9995) {\n const c = Math.acos(o), h = Math.sin(c);\n l = Math.sin(l * c) / h, t = Math.sin(t * c) / h, this._x = this._x * l + n * t, this._y = this._y * l + s * t, this._z = this._z * l + r * t, this._w = this._w * l + a * t, this._onChangeCallback();\n } else\n this._x = this._x * l + n * t, this._y = this._y * l + s * t, this._z = this._z * l + r * t, this._w = this._w * l + a * t, this.normalize();\n return this;\n }\n /**\n * Performs a spherical linear interpolation between the given quaternions\n * and stores the result in this quaternion.\n *\n * @param {Quaternion} qa - The source quaternion.\n * @param {Quaternion} qb - The target quaternion.\n * @param {number} t - The interpolation factor in the closed interval `[0, 1]`.\n * @return {Quaternion} A reference to this quaternion.\n */\n slerpQuaternions(e, t, n) {\n return this.copy(e).slerp(t, n);\n }\n /**\n * Sets this quaternion to a uniformly random, normalized quaternion.\n *\n * @return {Quaternion} A reference to this quaternion.\n */\n random() {\n const e = 2 * Math.PI * Math.random(), t = 2 * Math.PI * Math.random(), n = Math.random(), s = Math.sqrt(1 - n), r = Math.sqrt(n);\n return this.set(\n s * Math.sin(e),\n s * Math.cos(e),\n r * Math.sin(t),\n r * Math.cos(t)\n );\n }\n /**\n * Returns `true` if this quaternion is equal with the given one.\n *\n * @param {Quaternion} quaternion - The quaternion to test for equality.\n * @return {boolean} Whether this quaternion is equal with the given one.\n */\n equals(e) {\n return e._x === this._x && e._y === this._y && e._z === this._z && e._w === this._w;\n }\n /**\n * Sets this quaternion's components from the given array.\n *\n * @param {Array} array - An array holding the quaternion component values.\n * @param {number} [offset=0] - The offset into the array.\n * @return {Quaternion} A reference to this quaternion.\n */\n fromArray(e, t = 0) {\n return this._x = e[t], this._y = e[t + 1], this._z = e[t + 2], this._w = e[t + 3], this._onChangeCallback(), this;\n }\n /**\n * Writes the components of this quaternion to the given array. If no array is provided,\n * the method returns a new instance.\n *\n * @param {Array} [array=[]] - The target array holding the quaternion components.\n * @param {number} [offset=0] - Index of the first element in the array.\n * @return {Array} The quaternion components.\n */\n toArray(e = [], t = 0) {\n return e[t] = this._x, e[t + 1] = this._y, e[t + 2] = this._z, e[t + 3] = this._w, e;\n }\n /**\n * Sets the components of this quaternion from the given buffer attribute.\n *\n * @param {BufferAttribute} attribute - The buffer attribute holding quaternion data.\n * @param {number} index - The index into the attribute.\n * @return {Quaternion} A reference to this quaternion.\n */\n fromBufferAttribute(e, t) {\n return this._x = e.getX(t), this._y = e.getY(t), this._z = e.getZ(t), this._w = e.getW(t), this._onChangeCallback(), this;\n }\n /**\n * This methods defines the serialization result of this class. Returns the\n * numerical elements of this quaternion in an array of format `[x, y, z, w]`.\n *\n * @return {Array} The serialized quaternion.\n */\n toJSON() {\n return this.toArray();\n }\n _onChange(e) {\n return this._onChangeCallback = e, this;\n }\n _onChangeCallback() {\n }\n *[Symbol.iterator]() {\n yield this._x, yield this._y, yield this._z, yield this._w;\n }\n}\nclass w {\n /**\n * Constructs a new 3D vector.\n *\n * @param {number} [x=0] - The x value of this vector.\n * @param {number} [y=0] - The y value of this vector.\n * @param {number} [z=0] - The z value of this vector.\n */\n constructor(e = 0, t = 0, n = 0) {\n w.prototype.isVector3 = !0, this.x = e, this.y = t, this.z = n;\n }\n /**\n * Sets the vector components.\n *\n * @param {number} x - The value of the x component.\n * @param {number} y - The value of the y component.\n * @param {number} z - The value of the z component.\n * @return {Vector3} A reference to this vector.\n */\n set(e, t, n) {\n return n === void 0 && (n = this.z), this.x = e, this.y = t, this.z = n, this;\n }\n /**\n * Sets the vector components to the same value.\n *\n * @param {number} scalar - The value to set for all vector components.\n * @return {Vector3} A reference to this vector.\n */\n setScalar(e) {\n return this.x = e, this.y = e, this.z = e, this;\n }\n /**\n * Sets the vector's x component to the given value\n *\n * @param {number} x - The value to set.\n * @return {Vector3} A reference to this vector.\n */\n setX(e) {\n return this.x = e, this;\n }\n /**\n * Sets the vector's y component to the given value\n *\n * @param {number} y - The value to set.\n * @return {Vector3} A reference to this vector.\n */\n setY(e) {\n return this.y = e, this;\n }\n /**\n * Sets the vector's z component to the given value\n *\n * @param {number} z - The value to set.\n * @return {Vector3} A reference to this vector.\n */\n setZ(e) {\n return this.z = e, this;\n }\n /**\n * Allows to set a vector component with an index.\n *\n * @param {number} index - The component index. `0` equals to x, `1` equals to y, `2` equals to z.\n * @param {number} value - The value to set.\n * @return {Vector3} A reference to this vector.\n */\n setComponent(e, t) {\n switch (e) {\n case 0:\n this.x = t;\n break;\n case 1:\n this.y = t;\n break;\n case 2:\n this.z = t;\n break;\n default:\n throw new Error(\"index is out of range: \" + e);\n }\n return this;\n }\n /**\n * Returns the value of the vector component which matches the given index.\n *\n * @param {number} index - The component index. `0` equals to x, `1` equals to y, `2` equals to z.\n * @return {number} A vector component value.\n */\n getComponent(e) {\n switch (e) {\n case 0:\n return this.x;\n case 1:\n return this.y;\n case 2:\n return this.z;\n default:\n throw new Error(\"index is out of range: \" + e);\n }\n }\n /**\n * Returns a new vector with copied values from this instance.\n *\n * @return {Vector3} A clone of this instance.\n */\n clone() {\n return new this.constructor(this.x, this.y, this.z);\n }\n /**\n * Copies the values of the given vector to this instance.\n *\n * @param {Vector3} v - The vector to copy.\n * @return {Vector3} A reference to this vector.\n */\n copy(e) {\n return this.x = e.x, this.y = e.y, this.z = e.z, this;\n }\n /**\n * Adds the given vector to this instance.\n *\n * @param {Vector3} v - The vector to add.\n * @return {Vector3} A reference to this vector.\n */\n add(e) {\n return this.x += e.x, this.y += e.y, this.z += e.z, this;\n }\n /**\n * Adds the given scalar value to all components of this instance.\n *\n * @param {number} s - The scalar to add.\n * @return {Vector3} A reference to this vector.\n */\n addScalar(e) {\n return this.x += e, this.y += e, this.z += e, this;\n }\n /**\n * Adds the given vectors and stores the result in this instance.\n *\n * @param {Vector3} a - The first vector.\n * @param {Vector3} b - The second vector.\n * @return {Vector3} A reference to this vector.\n */\n addVectors(e, t) {\n return this.x = e.x + t.x, this.y = e.y + t.y, this.z = e.z + t.z, this;\n }\n /**\n * Adds the given vector scaled by the given factor to this instance.\n *\n * @param {Vector3|Vector4} v - The vector.\n * @param {number} s - The factor that scales `v`.\n * @return {Vector3} A reference to this vector.\n */\n addScaledVector(e, t) {\n return this.x += e.x * t, this.y += e.y * t, this.z += e.z * t, this;\n }\n /**\n * Subtracts the given vector from this instance.\n *\n * @param {Vector3} v - The vector to subtract.\n * @return {Vector3} A reference to this vector.\n */\n sub(e) {\n return this.x -= e.x, this.y -= e.y, this.z -= e.z, this;\n }\n /**\n * Subtracts the given scalar value from all components of this instance.\n *\n * @param {number} s - The scalar to subtract.\n * @return {Vector3} A reference to this vector.\n */\n subScalar(e) {\n return this.x -= e, this.y -= e, this.z -= e, this;\n }\n /**\n * Subtracts the given vectors and stores the result in this instance.\n *\n * @param {Vector3} a - The first vector.\n * @param {Vector3} b - The second vector.\n * @return {Vector3} A reference to this vector.\n */\n subVectors(e, t) {\n return this.x = e.x - t.x, this.y = e.y - t.y, this.z = e.z - t.z, this;\n }\n /**\n * Multiplies the given vector with this instance.\n *\n * @param {Vector3} v - The vector to multiply.\n * @return {Vector3} A reference to this vector.\n */\n multiply(e) {\n return this.x *= e.x, this.y *= e.y, this.z *= e.z, this;\n }\n /**\n * Multiplies the given scalar value with all components of this instance.\n *\n * @param {number} scalar - The scalar to multiply.\n * @return {Vector3} A reference to this vector.\n */\n multiplyScalar(e) {\n return this.x *= e, this.y *= e, this.z *= e, this;\n }\n /**\n * Multiplies the given vectors and stores the result in this instance.\n *\n * @param {Vector3} a - The first vector.\n * @param {Vector3} b - The second vector.\n * @return {Vector3} A reference to this vector.\n */\n multiplyVectors(e, t) {\n return this.x = e.x * t.x, this.y = e.y * t.y, this.z = e.z * t.z, this;\n }\n /**\n * Applies the given Euler rotation to this vector.\n *\n * @param {Euler} euler - The Euler angles.\n * @return {Vector3} A reference to this vector.\n */\n applyEuler(e) {\n return this.applyQuaternion(ul.setFromEuler(e));\n }\n /**\n * Applies a rotation specified by an axis and an angle to this vector.\n *\n * @param {Vector3} axis - A normalized vector representing the rotation axis.\n * @param {number} angle - The angle in radians.\n * @return {Vector3} A reference to this vector.\n */\n applyAxisAngle(e, t) {\n return this.applyQuaternion(ul.setFromAxisAngle(e, t));\n }\n /**\n * Multiplies this vector with the given 3x3 matrix.\n *\n * @param {Matrix3} m - The 3x3 matrix.\n * @return {Vector3} A reference to this vector.\n */\n applyMatrix3(e) {\n const t = this.x, n = this.y, s = this.z, r = e.elements;\n return this.x = r[0] * t + r[3] * n + r[6] * s, this.y = r[1] * t + r[4] * n + r[7] * s, this.z = r[2] * t + r[5] * n + r[8] * s, this;\n }\n /**\n * Multiplies this vector by the given normal matrix and normalizes\n * the result.\n *\n * @param {Matrix3} m - The normal matrix.\n * @return {Vector3} A reference to this vector.\n */\n applyNormalMatrix(e) {\n return this.applyMatrix3(e).normalize();\n }\n /**\n * Multiplies this vector (with an implicit 1 in the 4th dimension) by m, and\n * divides by perspective.\n *\n * @param {Matrix4} m - The matrix to apply.\n * @return {Vector3} A reference to this vector.\n */\n applyMatrix4(e) {\n const t = this.x, n = this.y, s = this.z, r = e.elements, a = 1 / (r[3] * t + r[7] * n + r[11] * s + r[15]);\n return this.x = (r[0] * t + r[4] * n + r[8] * s + r[12]) * a, this.y = (r[1] * t + r[5] * n + r[9] * s + r[13]) * a, this.z = (r[2] * t + r[6] * n + r[10] * s + r[14]) * a, this;\n }\n /**\n * Applies the given Quaternion to this vector.\n *\n * @param {Quaternion} q - The Quaternion.\n * @return {Vector3} A reference to this vector.\n */\n applyQuaternion(e) {\n const t = this.x, n = this.y, s = this.z, r = e.x, a = e.y, o = e.z, l = e.w, c = 2 * (a * s - o * n), h = 2 * (o * t - r * s), u = 2 * (r * n - a * t);\n return this.x = t + l * c + a * u - o * h, this.y = n + l * h + o * c - r * u, this.z = s + l * u + r * h - a * c, this;\n }\n /**\n * Projects this vector from world space into the camera's normalized\n * device coordinate (NDC) space.\n *\n * @param {Camera} camera - The camera.\n * @return {Vector3} A reference to this vector.\n */\n project(e) {\n return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix);\n }\n /**\n * Unprojects this vector from the camera's normalized device coordinate (NDC)\n * space into world space.\n *\n * @param {Camera} camera - The camera.\n * @return {Vector3} A reference to this vector.\n */\n unproject(e) {\n return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld);\n }\n /**\n * Transforms the direction of this vector by a matrix (the upper left 3 x 3\n * subset of the given 4x4 matrix and then normalizes the result.\n *\n * @param {Matrix4} m - The matrix.\n * @return {Vector3} A reference to this vector.\n */\n transformDirection(e) {\n const t = this.x, n = this.y, s = this.z, r = e.elements;\n return this.x = r[0] * t + r[4] * n + r[8] * s, this.y = r[1] * t + r[5] * n + r[9] * s, this.z = r[2] * t + r[6] * n + r[10] * s, this.normalize();\n }\n /**\n * Divides this instance by the given vector.\n *\n * @param {Vector3} v - The vector to divide.\n * @return {Vector3} A reference to this vector.\n */\n divide(e) {\n return this.x /= e.x, this.y /= e.y, this.z /= e.z, this;\n }\n /**\n * Divides this vector by the given scalar.\n *\n * @param {number} scalar - The scalar to divide.\n * @return {Vector3} A reference to this vector.\n */\n divideScalar(e) {\n return this.multiplyScalar(1 / e);\n }\n /**\n * If this vector's x, y or z value is greater than the given vector's x, y or z\n * value, replace that value with the corresponding min value.\n *\n * @param {Vector3} v - The vector.\n * @return {Vector3} A reference to this vector.\n */\n min(e) {\n return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this.z = Math.min(this.z, e.z), this;\n }\n /**\n * If this vector's x, y or z value is less than the given vector's x, y or z\n * value, replace that value with the corresponding max value.\n *\n * @param {Vector3} v - The vector.\n * @return {Vector3} A reference to this vector.\n */\n max(e) {\n return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this.z = Math.max(this.z, e.z), this;\n }\n /**\n * If this vector's x, y or z value is greater than the max vector's x, y or z\n * value, it is replaced by the corresponding value.\n * If this vector's x, y or z value is less than the min vector's x, y or z value,\n * it is replaced by the corresponding value.\n *\n * @param {Vector3} min - The minimum x, y and z values.\n * @param {Vector3} max - The maximum x, y and z values in the desired range.\n * @return {Vector3} A reference to this vector.\n */\n clamp(e, t) {\n return this.x = He(this.x, e.x, t.x), this.y = He(this.y, e.y, t.y), this.z = He(this.z, e.z, t.z), this;\n }\n /**\n * If this vector's x, y or z values are greater than the max value, they are\n * replaced by the max value.\n * If this vector's x, y or z values are less than the min value, they are\n * replaced by the min value.\n *\n * @param {number} minVal - The minimum value the components will be clamped to.\n * @param {number} maxVal - The maximum value the components will be clamped to.\n * @return {Vector3} A reference to this vector.\n */\n clampScalar(e, t) {\n return this.x = He(this.x, e, t), this.y = He(this.y, e, t), this.z = He(this.z, e, t), this;\n }\n /**\n * If this vector's length is greater than the max value, it is replaced by\n * the max value.\n * If this vector's length is less than the min value, it is replaced by the\n * min value.\n *\n * @param {number} min - The minimum value the vector length will be clamped to.\n * @param {number} max - The maximum value the vector length will be clamped to.\n * @return {Vector3} A reference to this vector.\n */\n clampLength(e, t) {\n const n = this.length();\n return this.divideScalar(n || 1).multiplyScalar(He(n, e, t));\n }\n /**\n * The components of this vector are rounded down to the nearest integer value.\n *\n * @return {Vector3} A reference to this vector.\n */\n floor() {\n return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this.z = Math.floor(this.z), this;\n }\n /**\n * The components of this vector are rounded up to the nearest integer value.\n *\n * @return {Vector3} A reference to this vector.\n */\n ceil() {\n return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this.z = Math.ceil(this.z), this;\n }\n /**\n * The components of this vector are rounded to the nearest integer value\n *\n * @return {Vector3} A reference to this vector.\n */\n round() {\n return this.x = Math.round(this.x), this.y = Math.round(this.y), this.z = Math.round(this.z), this;\n }\n /**\n * The components of this vector are rounded towards zero (up if negative,\n * down if positive) to an integer value.\n *\n * @return {Vector3} A reference to this vector.\n */\n roundToZero() {\n return this.x = Math.trunc(this.x), this.y = Math.trunc(this.y), this.z = Math.trunc(this.z), this;\n }\n /**\n * Inverts this vector - i.e. sets x = -x, y = -y and z = -z.\n *\n * @return {Vector3} A reference to this vector.\n */\n negate() {\n return this.x = -this.x, this.y = -this.y, this.z = -this.z, this;\n }\n /**\n * Calculates the dot product of the given vector with this instance.\n *\n * @param {Vector3} v - The vector to compute the dot product with.\n * @return {number} The result of the dot product.\n */\n dot(e) {\n return this.x * e.x + this.y * e.y + this.z * e.z;\n }\n // TODO lengthSquared?\n /**\n * Computes the square of the Euclidean length (straight-line length) from\n * (0, 0, 0) to (x, y, z). If you are comparing the lengths of vectors, you should\n * compare the length squared instead as it is slightly more efficient to calculate.\n *\n * @return {number} The square length of this vector.\n */\n lengthSq() {\n return this.x * this.x + this.y * this.y + this.z * this.z;\n }\n /**\n * Computes the Euclidean length (straight-line length) from (0, 0, 0) to (x, y, z).\n *\n * @return {number} The length of this vector.\n */\n length() {\n return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);\n }\n /**\n * Computes the Manhattan length of this vector.\n *\n * @return {number} The length of this vector.\n */\n manhattanLength() {\n return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z);\n }\n /**\n * Converts this vector to a unit vector - that is, sets it equal to a vector\n * with the same direction as this one, but with a vector length of `1`.\n *\n * @return {Vector3} A reference to this vector.\n */\n normalize() {\n return this.divideScalar(this.length() || 1);\n }\n /**\n * Sets this vector to a vector with the same direction as this one, but\n * with the specified length.\n *\n * @param {number} length - The new length of this vector.\n * @return {Vector3} A reference to this vector.\n */\n setLength(e) {\n return this.normalize().multiplyScalar(e);\n }\n /**\n * Linearly interpolates between the given vector and this instance, where\n * alpha is the percent distance along the line - alpha = 0 will be this\n * vector, and alpha = 1 will be the given one.\n *\n * @param {Vector3} v - The vector to interpolate towards.\n * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`.\n * @return {Vector3} A reference to this vector.\n */\n lerp(e, t) {\n return this.x += (e.x - this.x) * t, this.y += (e.y - this.y) * t, this.z += (e.z - this.z) * t, this;\n }\n /**\n * Linearly interpolates between the given vectors, where alpha is the percent\n * distance along the line - alpha = 0 will be first vector, and alpha = 1 will\n * be the second one. The result is stored in this instance.\n *\n * @param {Vector3} v1 - The first vector.\n * @param {Vector3} v2 - The second vector.\n * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`.\n * @return {Vector3} A reference to this vector.\n */\n lerpVectors(e, t, n) {\n return this.x = e.x + (t.x - e.x) * n, this.y = e.y + (t.y - e.y) * n, this.z = e.z + (t.z - e.z) * n, this;\n }\n /**\n * Calculates the cross product of the given vector with this instance.\n *\n * @param {Vector3} v - The vector to compute the cross product with.\n * @return {Vector3} The result of the cross product.\n */\n cross(e) {\n return this.crossVectors(this, e);\n }\n /**\n * Calculates the cross product of the given vectors and stores the result\n * in this instance.\n *\n * @param {Vector3} a - The first vector.\n * @param {Vector3} b - The second vector.\n * @return {Vector3} A reference to this vector.\n */\n crossVectors(e, t) {\n const n = e.x, s = e.y, r = e.z, a = t.x, o = t.y, l = t.z;\n return this.x = s * l - r * o, this.y = r * a - n * l, this.z = n * o - s * a, this;\n }\n /**\n * Projects this vector onto the given one.\n *\n * @param {Vector3} v - The vector to project to.\n * @return {Vector3} A reference to this vector.\n */\n projectOnVector(e) {\n const t = e.lengthSq();\n if (t === 0) return this.set(0, 0, 0);\n const n = e.dot(this) / t;\n return this.copy(e).multiplyScalar(n);\n }\n /**\n * Projects this vector onto a plane by subtracting this\n * vector projected onto the plane's normal from this vector.\n *\n * @param {Vector3} planeNormal - The plane normal.\n * @return {Vector3} A reference to this vector.\n */\n projectOnPlane(e) {\n return Or.copy(this).projectOnVector(e), this.sub(Or);\n }\n /**\n * Reflects this vector off a plane orthogonal to the given normal vector.\n *\n * @param {Vector3} normal - The (normalized) normal vector.\n * @return {Vector3} A reference to this vector.\n */\n reflect(e) {\n return this.sub(Or.copy(e).multiplyScalar(2 * this.dot(e)));\n }\n /**\n * Returns the angle between the given vector and this instance in radians.\n *\n * @param {Vector3} v - The vector to compute the angle with.\n * @return {number} The angle in radians.\n */\n angleTo(e) {\n const t = Math.sqrt(this.lengthSq() * e.lengthSq());\n if (t === 0) return Math.PI / 2;\n const n = this.dot(e) / t;\n return Math.acos(He(n, -1, 1));\n }\n /**\n * Computes the distance from the given vector to this instance.\n *\n * @param {Vector3} v - The vector to compute the distance to.\n * @return {number} The distance.\n */\n distanceTo(e) {\n return Math.sqrt(this.distanceToSquared(e));\n }\n /**\n * Computes the squared distance from the given vector to this instance.\n * If you are just comparing the distance with another distance, you should compare\n * the distance squared instead as it is slightly more efficient to calculate.\n *\n * @param {Vector3} v - The vector to compute the squared distance to.\n * @return {number} The squared distance.\n */\n distanceToSquared(e) {\n const t = this.x - e.x, n = this.y - e.y, s = this.z - e.z;\n return t * t + n * n + s * s;\n }\n /**\n * Computes the Manhattan distance from the given vector to this instance.\n *\n * @param {Vector3} v - The vector to compute the Manhattan distance to.\n * @return {number} The Manhattan distance.\n */\n manhattanDistanceTo(e) {\n return Math.abs(this.x - e.x) + Math.abs(this.y - e.y) + Math.abs(this.z - e.z);\n }\n /**\n * Sets the vector components from the given spherical coordinates.\n *\n * @param {Spherical} s - The spherical coordinates.\n * @return {Vector3} A reference to this vector.\n */\n setFromSpherical(e) {\n return this.setFromSphericalCoords(e.radius, e.phi, e.theta);\n }\n /**\n * Sets the vector components from the given spherical coordinates.\n *\n * @param {number} radius - The radius.\n * @param {number} phi - The phi angle in radians.\n * @param {number} theta - The theta angle in radians.\n * @return {Vector3} A reference to this vector.\n */\n setFromSphericalCoords(e, t, n) {\n const s = Math.sin(t) * e;\n return this.x = s * Math.sin(n), this.y = Math.cos(t) * e, this.z = s * Math.cos(n), this;\n }\n /**\n * Sets the vector components from the given cylindrical coordinates.\n *\n * @param {Cylindrical} c - The cylindrical coordinates.\n * @return {Vector3} A reference to this vector.\n */\n setFromCylindrical(e) {\n return this.setFromCylindricalCoords(e.radius, e.theta, e.y);\n }\n /**\n * Sets the vector components from the given cylindrical coordinates.\n *\n * @param {number} radius - The radius.\n * @param {number} theta - The theta angle in radians.\n * @param {number} y - The y value.\n * @return {Vector3} A reference to this vector.\n */\n setFromCylindricalCoords(e, t, n) {\n return this.x = e * Math.sin(t), this.y = n, this.z = e * Math.cos(t), this;\n }\n /**\n * Sets the vector components to the position elements of the\n * given transformation matrix.\n *\n * @param {Matrix4} m - The 4x4 matrix.\n * @return {Vector3} A reference to this vector.\n */\n setFromMatrixPosition(e) {\n const t = e.elements;\n return this.x = t[12], this.y = t[13], this.z = t[14], this;\n }\n /**\n * Sets the vector components to the scale elements of the\n * given transformation matrix.\n *\n * @param {Matrix4} m - The 4x4 matrix.\n * @return {Vector3} A reference to this vector.\n */\n setFromMatrixScale(e) {\n const t = this.setFromMatrixColumn(e, 0).length(), n = this.setFromMatrixColumn(e, 1).length(), s = this.setFromMatrixColumn(e, 2).length();\n return this.x = t, this.y = n, this.z = s, this;\n }\n /**\n * Sets the vector components from the specified matrix column.\n *\n * @param {Matrix4} m - The 4x4 matrix.\n * @param {number} index - The column index.\n * @return {Vector3} A reference to this vector.\n */\n setFromMatrixColumn(e, t) {\n return this.fromArray(e.elements, t * 4);\n }\n /**\n * Sets the vector components from the specified matrix column.\n *\n * @param {Matrix3} m - The 3x3 matrix.\n * @param {number} index - The column index.\n * @return {Vector3} A reference to this vector.\n */\n setFromMatrix3Column(e, t) {\n return this.fromArray(e.elements, t * 3);\n }\n /**\n * Sets the vector components from the given Euler angles.\n *\n * @param {Euler} e - The Euler angles to set.\n * @return {Vector3} A reference to this vector.\n */\n setFromEuler(e) {\n return this.x = e._x, this.y = e._y, this.z = e._z, this;\n }\n /**\n * Sets the vector components from the RGB components of the\n * given color.\n *\n * @param {Color} c - The color to set.\n * @return {Vector3} A reference to this vector.\n */\n setFromColor(e) {\n return this.x = e.r, this.y = e.g, this.z = e.b, this;\n }\n /**\n * Returns `true` if this vector is equal with the given one.\n *\n * @param {Vector3} v - The vector to test for equality.\n * @return {boolean} Whether this vector is equal with the given one.\n */\n equals(e) {\n return e.x === this.x && e.y === this.y && e.z === this.z;\n }\n /**\n * Sets this vector's x value to be `array[ offset ]`, y value to be `array[ offset + 1 ]`\n * and z value to be `array[ offset + 2 ]`.\n *\n * @param {Array} array - An array holding the vector component values.\n * @param {number} [offset=0] - The offset into the array.\n * @return {Vector3} A reference to this vector.\n */\n fromArray(e, t = 0) {\n return this.x = e[t], this.y = e[t + 1], this.z = e[t + 2], this;\n }\n /**\n * Writes the components of this vector to the given array. If no array is provided,\n * the method returns a new instance.\n *\n * @param {Array} [array=[]] - The target array holding the vector components.\n * @param {number} [offset=0] - Index of the first element in the array.\n * @return {Array} The vector components.\n */\n toArray(e = [], t = 0) {\n return e[t] = this.x, e[t + 1] = this.y, e[t + 2] = this.z, e;\n }\n /**\n * Sets the components of this vector from the given buffer attribute.\n *\n * @param {BufferAttribute} attribute - The buffer attribute holding vector data.\n * @param {number} index - The index into the attribute.\n * @return {Vector3} A reference to this vector.\n */\n fromBufferAttribute(e, t) {\n return this.x = e.getX(t), this.y = e.getY(t), this.z = e.getZ(t), this;\n }\n /**\n * Sets each component of this vector to a pseudo-random value between `0` and\n * `1`, excluding `1`.\n *\n * @return {Vector3} A reference to this vector.\n */\n random() {\n return this.x = Math.random(), this.y = Math.random(), this.z = Math.random(), this;\n }\n /**\n * Sets this vector to a uniformly random point on a unit sphere.\n *\n * @return {Vector3} A reference to this vector.\n */\n randomDirection() {\n const e = Math.random() * Math.PI * 2, t = Math.random() * 2 - 1, n = Math.sqrt(1 - t * t);\n return this.x = n * Math.cos(e), this.y = t, this.z = n * Math.sin(e), this;\n }\n *[Symbol.iterator]() {\n yield this.x, yield this.y, yield this.z;\n }\n}\nconst Or = /* @__PURE__ */ new w(), ul = /* @__PURE__ */ new gn();\nclass ze {\n /**\n * Constructs a new 3x3 matrix. The arguments are supposed to be\n * in row-major order. If no arguments are provided, the constructor\n * initializes the matrix as an identity matrix.\n *\n * @param {number} [n11] - 1-1 matrix element.\n * @param {number} [n12] - 1-2 matrix element.\n * @param {number} [n13] - 1-3 matrix element.\n * @param {number} [n21] - 2-1 matrix element.\n * @param {number} [n22] - 2-2 matrix element.\n * @param {number} [n23] - 2-3 matrix element.\n * @param {number} [n31] - 3-1 matrix element.\n * @param {number} [n32] - 3-2 matrix element.\n * @param {number} [n33] - 3-3 matrix element.\n */\n constructor(e, t, n, s, r, a, o, l, c) {\n ze.prototype.isMatrix3 = !0, this.elements = [\n 1,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 1\n ], e !== void 0 && this.set(e, t, n, s, r, a, o, l, c);\n }\n /**\n * Sets the elements of the matrix.The arguments are supposed to be\n * in row-major order.\n *\n * @param {number} [n11] - 1-1 matrix element.\n * @param {number} [n12] - 1-2 matrix element.\n * @param {number} [n13] - 1-3 matrix element.\n * @param {number} [n21] - 2-1 matrix element.\n * @param {number} [n22] - 2-2 matrix element.\n * @param {number} [n23] - 2-3 matrix element.\n * @param {number} [n31] - 3-1 matrix element.\n * @param {number} [n32] - 3-2 matrix element.\n * @param {number} [n33] - 3-3 matrix element.\n * @return {Matrix3} A reference to this matrix.\n */\n set(e, t, n, s, r, a, o, l, c) {\n const h = this.elements;\n return h[0] = e, h[1] = s, h[2] = o, h[3] = t, h[4] = r, h[5] = l, h[6] = n, h[7] = a, h[8] = c, this;\n }\n /**\n * Sets this matrix to the 3x3 identity matrix.\n *\n * @return {Matrix3} A reference to this matrix.\n */\n identity() {\n return this.set(\n 1,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 1\n ), this;\n }\n /**\n * Copies the values of the given matrix to this instance.\n *\n * @param {Matrix3} m - The matrix to copy.\n * @return {Matrix3} A reference to this matrix.\n */\n copy(e) {\n const t = this.elements, n = e.elements;\n return t[0] = n[0], t[1] = n[1], t[2] = n[2], t[3] = n[3], t[4] = n[4], t[5] = n[5], t[6] = n[6], t[7] = n[7], t[8] = n[8], this;\n }\n /**\n * Extracts the basis of this matrix into the three axis vectors provided.\n *\n * @param {Vector3} xAxis - The basis's x axis.\n * @param {Vector3} yAxis - The basis's y axis.\n * @param {Vector3} zAxis - The basis's z axis.\n * @return {Matrix3} A reference to this matrix.\n */\n extractBasis(e, t, n) {\n return e.setFromMatrix3Column(this, 0), t.setFromMatrix3Column(this, 1), n.setFromMatrix3Column(this, 2), this;\n }\n /**\n * Set this matrix to the upper 3x3 matrix of the given 4x4 matrix.\n *\n * @param {Matrix4} m - The 4x4 matrix.\n * @return {Matrix3} A reference to this matrix.\n */\n setFromMatrix4(e) {\n const t = e.elements;\n return this.set(\n t[0],\n t[4],\n t[8],\n t[1],\n t[5],\n t[9],\n t[2],\n t[6],\n t[10]\n ), this;\n }\n /**\n * Post-multiplies this matrix by the given 3x3 matrix.\n *\n * @param {Matrix3} m - The matrix to multiply with.\n * @return {Matrix3} A reference to this matrix.\n */\n multiply(e) {\n return this.multiplyMatrices(this, e);\n }\n /**\n * Pre-multiplies this matrix by the given 3x3 matrix.\n *\n * @param {Matrix3} m - The matrix to multiply with.\n * @return {Matrix3} A reference to this matrix.\n */\n premultiply(e) {\n return this.multiplyMatrices(e, this);\n }\n /**\n * Multiples the given 3x3 matrices and stores the result\n * in this matrix.\n *\n * @param {Matrix3} a - The first matrix.\n * @param {Matrix3} b - The second matrix.\n * @return {Matrix3} A reference to this matrix.\n */\n multiplyMatrices(e, t) {\n const n = e.elements, s = t.elements, r = this.elements, a = n[0], o = n[3], l = n[6], c = n[1], h = n[4], u = n[7], d = n[2], p = n[5], g = n[8], x = s[0], m = s[3], f = s[6], y = s[1], v = s[4], T = s[7], R = s[2], E = s[5], P = s[8];\n return r[0] = a * x + o * y + l * R, r[3] = a * m + o * v + l * E, r[6] = a * f + o * T + l * P, r[1] = c * x + h * y + u * R, r[4] = c * m + h * v + u * E, r[7] = c * f + h * T + u * P, r[2] = d * x + p * y + g * R, r[5] = d * m + p * v + g * E, r[8] = d * f + p * T + g * P, this;\n }\n /**\n * Multiplies every component of the matrix by the given scalar.\n *\n * @param {number} s - The scalar.\n * @return {Matrix3} A reference to this matrix.\n */\n multiplyScalar(e) {\n const t = this.elements;\n return t[0] *= e, t[3] *= e, t[6] *= e, t[1] *= e, t[4] *= e, t[7] *= e, t[2] *= e, t[5] *= e, t[8] *= e, this;\n }\n /**\n * Computes and returns the determinant of this matrix.\n *\n * @return {number} The determinant.\n */\n determinant() {\n const e = this.elements, t = e[0], n = e[1], s = e[2], r = e[3], a = e[4], o = e[5], l = e[6], c = e[7], h = e[8];\n return t * a * h - t * o * c - n * r * h + n * o * l + s * r * c - s * a * l;\n }\n /**\n * Inverts this matrix, using the [analytic method](https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution).\n * You can not invert with a determinant of zero. If you attempt this, the method produces\n * a zero matrix instead.\n *\n * @return {Matrix3} A reference to this matrix.\n */\n invert() {\n const e = this.elements, t = e[0], n = e[1], s = e[2], r = e[3], a = e[4], o = e[5], l = e[6], c = e[7], h = e[8], u = h * a - o * c, d = o * l - h * r, p = c * r - a * l, g = t * u + n * d + s * p;\n if (g === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);\n const x = 1 / g;\n return e[0] = u * x, e[1] = (s * c - h * n) * x, e[2] = (o * n - s * a) * x, e[3] = d * x, e[4] = (h * t - s * l) * x, e[5] = (s * r - o * t) * x, e[6] = p * x, e[7] = (n * l - c * t) * x, e[8] = (a * t - n * r) * x, this;\n }\n /**\n * Transposes this matrix in place.\n *\n * @return {Matrix3} A reference to this matrix.\n */\n transpose() {\n let e;\n const t = this.elements;\n return e = t[1], t[1] = t[3], t[3] = e, e = t[2], t[2] = t[6], t[6] = e, e = t[5], t[5] = t[7], t[7] = e, this;\n }\n /**\n * Computes the normal matrix which is the inverse transpose of the upper\n * left 3x3 portion of the given 4x4 matrix.\n *\n * @param {Matrix4} matrix4 - The 4x4 matrix.\n * @return {Matrix3} A reference to this matrix.\n */\n getNormalMatrix(e) {\n return this.setFromMatrix4(e).invert().transpose();\n }\n /**\n * Transposes this matrix into the supplied array, and returns itself unchanged.\n *\n * @param {Array} r - An array to store the transposed matrix elements.\n * @return {Matrix3} A reference to this matrix.\n */\n transposeIntoArray(e) {\n const t = this.elements;\n return e[0] = t[0], e[1] = t[3], e[2] = t[6], e[3] = t[1], e[4] = t[4], e[5] = t[7], e[6] = t[2], e[7] = t[5], e[8] = t[8], this;\n }\n /**\n * Sets the UV transform matrix from offset, repeat, rotation, and center.\n *\n * @param {number} tx - Offset x.\n * @param {number} ty - Offset y.\n * @param {number} sx - Repeat x.\n * @param {number} sy - Repeat y.\n * @param {number} rotation - Rotation, in radians. Positive values rotate counterclockwise.\n * @param {number} cx - Center x of rotation.\n * @param {number} cy - Center y of rotation\n * @return {Matrix3} A reference to this matrix.\n */\n setUvTransform(e, t, n, s, r, a, o) {\n const l = Math.cos(r), c = Math.sin(r);\n return this.set(\n n * l,\n n * c,\n -n * (l * a + c * o) + a + e,\n -s * c,\n s * l,\n -s * (-c * a + l * o) + o + t,\n 0,\n 0,\n 1\n ), this;\n }\n /**\n * Scales this matrix with the given scalar values.\n *\n * @param {number} sx - The amount to scale in the X axis.\n * @param {number} sy - The amount to scale in the Y axis.\n * @return {Matrix3} A reference to this matrix.\n */\n scale(e, t) {\n return this.premultiply(Br.makeScale(e, t)), this;\n }\n /**\n * Rotates this matrix by the given angle.\n *\n * @param {number} theta - The rotation in radians.\n * @return {Matrix3} A reference to this matrix.\n */\n rotate(e) {\n return this.premultiply(Br.makeRotation(-e)), this;\n }\n /**\n * Translates this matrix by the given scalar values.\n *\n * @param {number} tx - The amount to translate in the X axis.\n * @param {number} ty - The amount to translate in the Y axis.\n * @return {Matrix3} A reference to this matrix.\n */\n translate(e, t) {\n return this.premultiply(Br.makeTranslation(e, t)), this;\n }\n // for 2D Transforms\n /**\n * Sets this matrix as a 2D translation transform.\n *\n * @param {number|Vector2} x - The amount to translate in the X axis or alternatively a translation vector.\n * @param {number} y - The amount to translate in the Y axis.\n * @return {Matrix3} A reference to this matrix.\n */\n makeTranslation(e, t) {\n return e.isVector2 ? this.set(\n 1,\n 0,\n e.x,\n 0,\n 1,\n e.y,\n 0,\n 0,\n 1\n ) : this.set(\n 1,\n 0,\n e,\n 0,\n 1,\n t,\n 0,\n 0,\n 1\n ), this;\n }\n /**\n * Sets this matrix as a 2D rotational transformation.\n *\n * @param {number} theta - The rotation in radians.\n * @return {Matrix3} A reference to this matrix.\n */\n makeRotation(e) {\n const t = Math.cos(e), n = Math.sin(e);\n return this.set(\n t,\n -n,\n 0,\n n,\n t,\n 0,\n 0,\n 0,\n 1\n ), this;\n }\n /**\n * Sets this matrix as a 2D scale transform.\n *\n * @param {number} x - The amount to scale in the X axis.\n * @param {number} y - The amount to scale in the Y axis.\n * @return {Matrix3} A reference to this matrix.\n */\n makeScale(e, t) {\n return this.set(\n e,\n 0,\n 0,\n 0,\n t,\n 0,\n 0,\n 0,\n 1\n ), this;\n }\n /**\n * Returns `true` if this matrix is equal with the given one.\n *\n * @param {Matrix3} matrix - The matrix to test for equality.\n * @return {boolean} Whether this matrix is equal with the given one.\n */\n equals(e) {\n const t = this.elements, n = e.elements;\n for (let s = 0; s < 9; s++)\n if (t[s] !== n[s]) return !1;\n return !0;\n }\n /**\n * Sets the elements of the matrix from the given array.\n *\n * @param {Array} array - The matrix elements in column-major order.\n * @param {number} [offset=0] - Index of the first element in the array.\n * @return {Matrix3} A reference to this matrix.\n */\n fromArray(e, t = 0) {\n for (let n = 0; n < 9; n++)\n this.elements[n] = e[n + t];\n return this;\n }\n /**\n * Writes the elements of this matrix to the given array. If no array is provided,\n * the method returns a new instance.\n *\n * @param {Array} [array=[]] - The target array holding the matrix elements in column-major order.\n * @param {number} [offset=0] - Index of the first element in the array.\n * @return {Array} The matrix elements in column-major order.\n */\n toArray(e = [], t = 0) {\n const n = this.elements;\n return e[t] = n[0], e[t + 1] = n[1], e[t + 2] = n[2], e[t + 3] = n[3], e[t + 4] = n[4], e[t + 5] = n[5], e[t + 6] = n[6], e[t + 7] = n[7], e[t + 8] = n[8], e;\n }\n /**\n * Returns a matrix with copied values from this instance.\n *\n * @return {Matrix3} A clone of this instance.\n */\n clone() {\n return new this.constructor().fromArray(this.elements);\n }\n}\nconst Br = /* @__PURE__ */ new ze(), dl = /* @__PURE__ */ new ze().set(\n 0.4123908,\n 0.3575843,\n 0.1804808,\n 0.212639,\n 0.7151687,\n 0.0721923,\n 0.0193308,\n 0.1191948,\n 0.9505322\n), fl = /* @__PURE__ */ new ze().set(\n 3.2409699,\n -1.5373832,\n -0.4986108,\n -0.9692436,\n 1.8759675,\n 0.0415551,\n 0.0556301,\n -0.203977,\n 1.0569715\n);\nfunction Pu() {\n const i = {\n enabled: !0,\n workingColorSpace: Ut,\n /**\n * Implementations of supported color spaces.\n *\n * Required:\n *\t- primaries: chromaticity coordinates [ rx ry gx gy bx by ]\n *\t- whitePoint: reference white [ x y ]\n *\t- transfer: transfer function (pre-defined)\n *\t- toXYZ: Matrix3 RGB to XYZ transform\n *\t- fromXYZ: Matrix3 XYZ to RGB transform\n *\t- luminanceCoefficients: RGB luminance coefficients\n *\n * Optional:\n * - outputColorSpaceConfig: { drawingBufferColorSpace: ColorSpace, toneMappingMode: 'extended' | 'standard' }\n * - workingColorSpaceConfig: { unpackColorSpace: ColorSpace }\n *\n * Reference:\n * - https://www.russellcottrell.com/photo/matrixCalculator.htm\n */\n spaces: {},\n convert: function(s, r, a) {\n return this.enabled === !1 || r === a || !r || !a || (this.spaces[r].transfer === et && (s.r = Vn(s.r), s.g = Vn(s.g), s.b = Vn(s.b)), this.spaces[r].primaries !== this.spaces[a].primaries && (s.applyMatrix3(this.spaces[r].toXYZ), s.applyMatrix3(this.spaces[a].fromXYZ)), this.spaces[a].transfer === et && (s.r = Oi(s.r), s.g = Oi(s.g), s.b = Oi(s.b))), s;\n },\n workingToColorSpace: function(s, r) {\n return this.convert(s, this.workingColorSpace, r);\n },\n colorSpaceToWorking: function(s, r) {\n return this.convert(s, r, this.workingColorSpace);\n },\n getPrimaries: function(s) {\n return this.spaces[s].primaries;\n },\n getTransfer: function(s) {\n return s === Kn ? Sr : this.spaces[s].transfer;\n },\n getToneMappingMode: function(s) {\n return this.spaces[s].outputColorSpaceConfig.toneMappingMode || \"standard\";\n },\n getLuminanceCoefficients: function(s, r = this.workingColorSpace) {\n return s.fromArray(this.spaces[r].luminanceCoefficients);\n },\n define: function(s) {\n Object.assign(this.spaces, s);\n },\n // Internal APIs\n _getMatrix: function(s, r, a) {\n return s.copy(this.spaces[r].toXYZ).multiply(this.spaces[a].fromXYZ);\n },\n _getDrawingBufferColorSpace: function(s) {\n return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace;\n },\n _getUnpackColorSpace: function(s = this.workingColorSpace) {\n return this.spaces[s].workingColorSpaceConfig.unpackColorSpace;\n },\n // Deprecated\n fromWorkingColorSpace: function(s, r) {\n return ws(\"ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().\"), i.workingToColorSpace(s, r);\n },\n toWorkingColorSpace: function(s, r) {\n return ws(\"ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().\"), i.colorSpaceToWorking(s, r);\n }\n }, e = [0.64, 0.33, 0.3, 0.6, 0.15, 0.06], t = [0.2126, 0.7152, 0.0722], n = [0.3127, 0.329];\n return i.define({\n [Ut]: {\n primaries: e,\n whitePoint: n,\n transfer: Sr,\n toXYZ: dl,\n fromXYZ: fl,\n luminanceCoefficients: t,\n workingColorSpaceConfig: { unpackColorSpace: Rt },\n outputColorSpaceConfig: { drawingBufferColorSpace: Rt }\n },\n [Rt]: {\n primaries: e,\n whitePoint: n,\n transfer: et,\n toXYZ: dl,\n fromXYZ: fl,\n luminanceCoefficients: t,\n outputColorSpaceConfig: { drawingBufferColorSpace: Rt }\n }\n }), i;\n}\nconst Ye = /* @__PURE__ */ Pu();\nfunction Vn(i) {\n return i < 0.04045 ? i * 0.0773993808 : Math.pow(i * 0.9478672986 + 0.0521327014, 2.4);\n}\nfunction Oi(i) {\n return i < 31308e-7 ? i * 12.92 : 1.055 * Math.pow(i, 0.41666) - 0.055;\n}\nlet _i;\nclass Du {\n /**\n * Returns a data URI containing a representation of the given image.\n *\n * @param {(HTMLImageElement|HTMLCanvasElement)} image - The image object.\n * @param {string} [type='image/png'] - Indicates the image format.\n * @return {string} The data URI.\n */\n static getDataURL(e, t = \"image/png\") {\n if (/^data:/i.test(e.src) || typeof HTMLCanvasElement > \"u\")\n return e.src;\n let n;\n if (e instanceof HTMLCanvasElement)\n n = e;\n else {\n _i === void 0 && (_i = Es(\"canvas\")), _i.width = e.width, _i.height = e.height;\n const s = _i.getContext(\"2d\");\n e instanceof ImageData ? s.putImageData(e, 0, 0) : s.drawImage(e, 0, 0, e.width, e.height), n = _i;\n }\n return n.toDataURL(t);\n }\n /**\n * Converts the given sRGB image data to linear color space.\n *\n * @param {(HTMLImageElement|HTMLCanvasElement|ImageBitmap|Object)} image - The image object.\n * @return {HTMLCanvasElement|Object} The converted image.\n */\n static sRGBToLinear(e) {\n if (typeof HTMLImageElement < \"u\" && e instanceof HTMLImageElement || typeof HTMLCanvasElement < \"u\" && e instanceof HTMLCanvasElement || typeof ImageBitmap < \"u\" && e instanceof ImageBitmap) {\n const t = Es(\"canvas\");\n t.width = e.width, t.height = e.height;\n const n = t.getContext(\"2d\");\n n.drawImage(e, 0, 0, e.width, e.height);\n const s = n.getImageData(0, 0, e.width, e.height), r = s.data;\n for (let a = 0; a < r.length; a++)\n r[a] = Vn(r[a] / 255) * 255;\n return n.putImageData(s, 0, 0), t;\n } else if (e.data) {\n const t = e.data.slice(0);\n for (let n = 0; n < t.length; n++)\n t instanceof Uint8Array || t instanceof Uint8ClampedArray ? t[n] = Math.floor(Vn(t[n] / 255) * 255) : t[n] = Vn(t[n]);\n return {\n data: t,\n width: e.width,\n height: e.height\n };\n } else\n return Te(\"ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.\"), e;\n }\n}\nlet Lu = 0;\nclass Io {\n /**\n * Constructs a new video texture.\n *\n * @param {any} [data=null] - The data definition of a texture.\n */\n constructor(e = null) {\n this.isSource = !0, Object.defineProperty(this, \"id\", { value: Lu++ }), this.uuid = fn(), this.data = e, this.dataReady = !0, this.version = 0;\n }\n /**\n * Returns the dimensions of the source into the given target vector.\n *\n * @param {(Vector2|Vector3)} target - The target object the result is written into.\n * @return {(Vector2|Vector3)} The dimensions of the source.\n */\n getSize(e) {\n const t = this.data;\n return typeof HTMLVideoElement < \"u\" && t instanceof HTMLVideoElement ? e.set(t.videoWidth, t.videoHeight, 0) : t instanceof VideoFrame ? e.set(t.displayHeight, t.displayWidth, 0) : t !== null ? e.set(t.width, t.height, t.depth || 0) : e.set(0, 0, 0), e;\n }\n /**\n * When the property is set to `true`, the engine allocates the memory\n * for the texture (if necessary) and triggers the actual texture upload\n * to the GPU next time the source is used.\n *\n * @type {boolean}\n * @default false\n * @param {boolean} value\n */\n set needsUpdate(e) {\n e === !0 && this.version++;\n }\n /**\n * Serializes the source into JSON.\n *\n * @param {?(Object|string)} meta - An optional value holding meta information about the serialization.\n * @return {Object} A JSON object representing the serialized source.\n * @see {@link ObjectLoader#parse}\n */\n toJSON(e) {\n const t = e === void 0 || typeof e == \"string\";\n if (!t && e.images[this.uuid] !== void 0)\n return e.images[this.uuid];\n const n = {\n uuid: this.uuid,\n url: \"\"\n }, s = this.data;\n if (s !== null) {\n let r;\n if (Array.isArray(s)) {\n r = [];\n for (let a = 0, o = s.length; a < o; a++)\n s[a].isDataTexture ? r.push(zr(s[a].image)) : r.push(zr(s[a]));\n } else\n r = zr(s);\n n.url = r;\n }\n return t || (e.images[this.uuid] = n), n;\n }\n}\nfunction zr(i) {\n return typeof HTMLImageElement < \"u\" && i instanceof HTMLImageElement || typeof HTMLCanvasElement < \"u\" && i instanceof HTMLCanvasElement || typeof ImageBitmap < \"u\" && i instanceof ImageBitmap ? Du.getDataURL(i) : i.data ? {\n data: Array.from(i.data),\n width: i.width,\n height: i.height,\n type: i.data.constructor.name\n } : (Te(\"Texture: Unable to serialize Texture.\"), {});\n}\nlet Iu = 0;\nconst kr = /* @__PURE__ */ new w();\nclass Ct extends mi {\n /**\n * Constructs a new texture.\n *\n * @param {?Object} [image=Texture.DEFAULT_IMAGE] - The image holding the texture data.\n * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping.\n * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value.\n * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value.\n * @param {number} [magFilter=LinearFilter] - The mag filter value.\n * @param {number} [minFilter=LinearMipmapLinearFilter] - The min filter value.\n * @param {number} [format=RGBAFormat] - The texture format.\n * @param {number} [type=UnsignedByteType] - The texture type.\n * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.\n * @param {string} [colorSpace=NoColorSpace] - The color space.\n */\n constructor(e = Ct.DEFAULT_IMAGE, t = Ct.DEFAULT_MAPPING, n = en, s = en, r = bt, a = yn, o = Zt, l = mn, c = Ct.DEFAULT_ANISOTROPY, h = Kn) {\n super(), this.isTexture = !0, Object.defineProperty(this, \"id\", { value: Iu++ }), this.uuid = fn(), this.name = \"\", this.source = new Io(e), this.mipmaps = [], this.mapping = t, this.channel = 0, this.wrapS = n, this.wrapT = s, this.magFilter = r, this.minFilter = a, this.anisotropy = c, this.format = o, this.internalFormat = null, this.type = l, this.offset = new le(0, 0), this.repeat = new le(1, 1), this.center = new le(0, 0), this.rotation = 0, this.matrixAutoUpdate = !0, this.matrix = new ze(), this.generateMipmaps = !0, this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.colorSpace = h, this.userData = {}, this.updateRanges = [], this.version = 0, this.onUpdate = null, this.renderTarget = null, this.isRenderTargetTexture = !1, this.isArrayTexture = !!(e && e.depth && e.depth > 1), this.pmremVersion = 0;\n }\n /**\n * The width of the texture in pixels.\n */\n get width() {\n return this.source.getSize(kr).x;\n }\n /**\n * The height of the texture in pixels.\n */\n get height() {\n return this.source.getSize(kr).y;\n }\n /**\n * The depth of the texture in pixels.\n */\n get depth() {\n return this.source.getSize(kr).z;\n }\n /**\n * The image object holding the texture data.\n *\n * @type {?Object}\n */\n get image() {\n return this.source.data;\n }\n set image(e = null) {\n this.source.data = e;\n }\n /**\n * Updates the texture transformation matrix from the from the properties {@link Texture#offset},\n * {@link Texture#repeat}, {@link Texture#rotation}, and {@link Texture#center}.\n */\n updateMatrix() {\n this.matrix.setUvTransform(this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y);\n }\n /**\n * Adds a range of data in the data texture to be updated on the GPU.\n *\n * @param {number} start - Position at which to start update.\n * @param {number} count - The number of components to update.\n */\n addUpdateRange(e, t) {\n this.updateRanges.push({ start: e, count: t });\n }\n /**\n * Clears the update ranges.\n */\n clearUpdateRanges() {\n this.updateRanges.length = 0;\n }\n /**\n * Returns a new texture with copied values from this instance.\n *\n * @return {Texture} A clone of this instance.\n */\n clone() {\n return new this.constructor().copy(this);\n }\n /**\n * Copies the values of the given texture to this instance.\n *\n * @param {Texture} source - The texture to copy.\n * @return {Texture} A reference to this instance.\n */\n copy(e) {\n return this.name = e.name, this.source = e.source, this.mipmaps = e.mipmaps.slice(0), this.mapping = e.mapping, this.channel = e.channel, this.wrapS = e.wrapS, this.wrapT = e.wrapT, this.magFilter = e.magFilter, this.minFilter = e.minFilter, this.anisotropy = e.anisotropy, this.format = e.format, this.internalFormat = e.internalFormat, this.type = e.type, this.offset.copy(e.offset), this.repeat.copy(e.repeat), this.center.copy(e.center), this.rotation = e.rotation, this.matrixAutoUpdate = e.matrixAutoUpdate, this.matrix.copy(e.matrix), this.generateMipmaps = e.generateMipmaps, this.premultiplyAlpha = e.premultiplyAlpha, this.flipY = e.flipY, this.unpackAlignment = e.unpackAlignment, this.colorSpace = e.colorSpace, this.renderTarget = e.renderTarget, this.isRenderTargetTexture = e.isRenderTargetTexture, this.isArrayTexture = e.isArrayTexture, this.userData = JSON.parse(JSON.stringify(e.userData)), this.needsUpdate = !0, this;\n }\n /**\n * Sets this texture's properties based on `values`.\n * @param {Object} values - A container with texture parameters.\n */\n setValues(e) {\n for (const t in e) {\n const n = e[t];\n if (n === void 0) {\n Te(`Texture.setValues(): parameter '${t}' has value of undefined.`);\n continue;\n }\n const s = this[t];\n if (s === void 0) {\n Te(`Texture.setValues(): property '${t}' does not exist.`);\n continue;\n }\n s && n && s.isVector2 && n.isVector2 || s && n && s.isVector3 && n.isVector3 || s && n && s.isMatrix3 && n.isMatrix3 ? s.copy(n) : this[t] = n;\n }\n }\n /**\n * Serializes the texture into JSON.\n *\n * @param {?(Object|string)} meta - An optional value holding meta information about the serialization.\n * @return {Object} A JSON object representing the serialized texture.\n * @see {@link ObjectLoader#parse}\n */\n toJSON(e) {\n const t = e === void 0 || typeof e == \"string\";\n if (!t && e.textures[this.uuid] !== void 0)\n return e.textures[this.uuid];\n const n = {\n metadata: {\n version: 4.7,\n type: \"Texture\",\n generator: \"Texture.toJSON\"\n },\n uuid: this.uuid,\n name: this.name,\n image: this.source.toJSON(e).uuid,\n mapping: this.mapping,\n channel: this.channel,\n repeat: [this.repeat.x, this.repeat.y],\n offset: [this.offset.x, this.offset.y],\n center: [this.center.x, this.center.y],\n rotation: this.rotation,\n wrap: [this.wrapS, this.wrapT],\n format: this.format,\n internalFormat: this.internalFormat,\n type: this.type,\n colorSpace: this.colorSpace,\n minFilter: this.minFilter,\n magFilter: this.magFilter,\n anisotropy: this.anisotropy,\n flipY: this.flipY,\n generateMipmaps: this.generateMipmaps,\n premultiplyAlpha: this.premultiplyAlpha,\n unpackAlignment: this.unpackAlignment\n };\n return Object.keys(this.userData).length > 0 && (n.userData = this.userData), t || (e.textures[this.uuid] = n), n;\n }\n /**\n * Frees the GPU-related resources allocated by this instance. Call this\n * method whenever this instance is no longer used in your app.\n *\n * @fires Texture#dispose\n */\n dispose() {\n this.dispatchEvent({ type: \"dispose\" });\n }\n /**\n * Transforms the given uv vector with the textures uv transformation matrix.\n *\n * @param {Vector2} uv - The uv vector.\n * @return {Vector2} The transformed uv vector.\n */\n transformUv(e) {\n if (this.mapping !== kc) return e;\n if (e.applyMatrix3(this.matrix), e.x < 0 || e.x > 1)\n switch (this.wrapS) {\n case wn:\n e.x = e.x - Math.floor(e.x);\n break;\n case en:\n e.x = e.x < 0 ? 0 : 1;\n break;\n case Mr:\n Math.abs(Math.floor(e.x) % 2) === 1 ? e.x = Math.ceil(e.x) - e.x : e.x = e.x - Math.floor(e.x);\n break;\n }\n if (e.y < 0 || e.y > 1)\n switch (this.wrapT) {\n case wn:\n e.y = e.y - Math.floor(e.y);\n break;\n case en:\n e.y = e.y < 0 ? 0 : 1;\n break;\n case Mr:\n Math.abs(Math.floor(e.y) % 2) === 1 ? e.y = Math.ceil(e.y) - e.y : e.y = e.y - Math.floor(e.y);\n break;\n }\n return this.flipY && (e.y = 1 - e.y), e;\n }\n /**\n * Setting this property to `true` indicates the engine the texture\n * must be updated in the next render. This triggers a texture upload\n * to the GPU and ensures correct texture parameter configuration.\n *\n * @type {boolean}\n * @default false\n * @param {boolean} value\n */\n set needsUpdate(e) {\n e === !0 && (this.version++, this.source.needsUpdate = !0);\n }\n /**\n * Setting this property to `true` indicates the engine the PMREM\n * must be regenerated.\n *\n * @type {boolean}\n * @default false\n * @param {boolean} value\n */\n set needsPMREMUpdate(e) {\n e === !0 && this.pmremVersion++;\n }\n}\nCt.DEFAULT_IMAGE = null;\nCt.DEFAULT_MAPPING = kc;\nCt.DEFAULT_ANISOTROPY = 1;\nclass Je {\n /**\n * Constructs a new 4D vector.\n *\n * @param {number} [x=0] - The x value of this vector.\n * @param {number} [y=0] - The y value of this vector.\n * @param {number} [z=0] - The z value of this vector.\n * @param {number} [w=1] - The w value of this vector.\n */\n constructor(e = 0, t = 0, n = 0, s = 1) {\n Je.prototype.isVector4 = !0, this.x = e, this.y = t, this.z = n, this.w = s;\n }\n /**\n * Alias for {@link Vector4#z}.\n *\n * @type {number}\n */\n get width() {\n return this.z;\n }\n set width(e) {\n this.z = e;\n }\n /**\n * Alias for {@link Vector4#w}.\n *\n * @type {number}\n */\n get height() {\n return this.w;\n }\n set height(e) {\n this.w = e;\n }\n /**\n * Sets the vector components.\n *\n * @param {number} x - The value of the x component.\n * @param {number} y - The value of the y component.\n * @param {number} z - The value of the z component.\n * @param {number} w - The value of the w component.\n * @return {Vector4} A reference to this vector.\n */\n set(e, t, n, s) {\n return this.x = e, this.y = t, this.z = n, this.w = s, this;\n }\n /**\n * Sets the vector components to the same value.\n *\n * @param {number} scalar - The value to set for all vector components.\n * @return {Vector4} A reference to this vector.\n */\n setScalar(e) {\n return this.x = e, this.y = e, this.z = e, this.w = e, this;\n }\n /**\n * Sets the vector's x component to the given value\n *\n * @param {number} x - The value to set.\n * @return {Vector4} A reference to this vector.\n */\n setX(e) {\n return this.x = e, this;\n }\n /**\n * Sets the vector's y component to the given value\n *\n * @param {number} y - The value to set.\n * @return {Vector4} A reference to this vector.\n */\n setY(e) {\n return this.y = e, this;\n }\n /**\n * Sets the vector's z component to the given value\n *\n * @param {number} z - The value to set.\n * @return {Vector4} A reference to this vector.\n */\n setZ(e) {\n return this.z = e, this;\n }\n /**\n * Sets the vector's w component to the given value\n *\n * @param {number} w - The value to set.\n * @return {Vector4} A reference to this vector.\n */\n setW(e) {\n return this.w = e, this;\n }\n /**\n * Allows to set a vector component with an index.\n *\n * @param {number} index - The component index. `0` equals to x, `1` equals to y,\n * `2` equals to z, `3` equals to w.\n * @param {number} value - The value to set.\n * @return {Vector4} A reference to this vector.\n */\n setComponent(e, t) {\n switch (e) {\n case 0:\n this.x = t;\n break;\n case 1:\n this.y = t;\n break;\n case 2:\n this.z = t;\n break;\n case 3:\n this.w = t;\n break;\n default:\n throw new Error(\"index is out of range: \" + e);\n }\n return this;\n }\n /**\n * Returns the value of the vector component which matches the given index.\n *\n * @param {number} index - The component index. `0` equals to x, `1` equals to y,\n * `2` equals to z, `3` equals to w.\n * @return {number} A vector component value.\n */\n getComponent(e) {\n switch (e) {\n case 0:\n return this.x;\n case 1:\n return this.y;\n case 2:\n return this.z;\n case 3:\n return this.w;\n default:\n throw new Error(\"index is out of range: \" + e);\n }\n }\n /**\n * Returns a new vector with copied values from this instance.\n *\n * @return {Vector4} A clone of this instance.\n */\n clone() {\n return new this.constructor(this.x, this.y, this.z, this.w);\n }\n /**\n * Copies the values of the given vector to this instance.\n *\n * @param {Vector3|Vector4} v - The vector to copy.\n * @return {Vector4} A reference to this vector.\n */\n copy(e) {\n return this.x = e.x, this.y = e.y, this.z = e.z, this.w = e.w !== void 0 ? e.w : 1, this;\n }\n /**\n * Adds the given vector to this instance.\n *\n * @param {Vector4} v - The vector to add.\n * @return {Vector4} A reference to this vector.\n */\n add(e) {\n return this.x += e.x, this.y += e.y, this.z += e.z, this.w += e.w, this;\n }\n /**\n * Adds the given scalar value to all components of this instance.\n *\n * @param {number} s - The scalar to add.\n * @return {Vector4} A reference to this vector.\n */\n addScalar(e) {\n return this.x += e, this.y += e, this.z += e, this.w += e, this;\n }\n /**\n * Adds the given vectors and stores the result in this instance.\n *\n * @param {Vector4} a - The first vector.\n * @param {Vector4} b - The second vector.\n * @return {Vector4} A reference to this vector.\n */\n addVectors(e, t) {\n return this.x = e.x + t.x, this.y = e.y + t.y, this.z = e.z + t.z, this.w = e.w + t.w, this;\n }\n /**\n * Adds the given vector scaled by the given factor to this instance.\n *\n * @param {Vector4} v - The vector.\n * @param {number} s - The factor that scales `v`.\n * @return {Vector4} A reference to this vector.\n */\n addScaledVector(e, t) {\n return this.x += e.x * t, this.y += e.y * t, this.z += e.z * t, this.w += e.w * t, this;\n }\n /**\n * Subtracts the given vector from this instance.\n *\n * @param {Vector4} v - The vector to subtract.\n * @return {Vector4} A reference to this vector.\n */\n sub(e) {\n return this.x -= e.x, this.y -= e.y, this.z -= e.z, this.w -= e.w, this;\n }\n /**\n * Subtracts the given scalar value from all components of this instance.\n *\n * @param {number} s - The scalar to subtract.\n * @return {Vector4} A reference to this vector.\n */\n subScalar(e) {\n return this.x -= e, this.y -= e, this.z -= e, this.w -= e, this;\n }\n /**\n * Subtracts the given vectors and stores the result in this instance.\n *\n * @param {Vector4} a - The first vector.\n * @param {Vector4} b - The second vector.\n * @return {Vector4} A reference to this vector.\n */\n subVectors(e, t) {\n return this.x = e.x - t.x, this.y = e.y - t.y, this.z = e.z - t.z, this.w = e.w - t.w, this;\n }\n /**\n * Multiplies the given vector with this instance.\n *\n * @param {Vector4} v - The vector to multiply.\n * @return {Vector4} A reference to this vector.\n */\n multiply(e) {\n return this.x *= e.x, this.y *= e.y, this.z *= e.z, this.w *= e.w, this;\n }\n /**\n * Multiplies the given scalar value with all components of this instance.\n *\n * @param {number} scalar - The scalar to multiply.\n * @return {Vector4} A reference to this vector.\n */\n multiplyScalar(e) {\n return this.x *= e, this.y *= e, this.z *= e, this.w *= e, this;\n }\n /**\n * Multiplies this vector with the given 4x4 matrix.\n *\n * @param {Matrix4} m - The 4x4 matrix.\n * @return {Vector4} A reference to this vector.\n */\n applyMatrix4(e) {\n const t = this.x, n = this.y, s = this.z, r = this.w, a = e.elements;\n return this.x = a[0] * t + a[4] * n + a[8] * s + a[12] * r, this.y = a[1] * t + a[5] * n + a[9] * s + a[13] * r, this.z = a[2] * t + a[6] * n + a[10] * s + a[14] * r, this.w = a[3] * t + a[7] * n + a[11] * s + a[15] * r, this;\n }\n /**\n * Divides this instance by the given vector.\n *\n * @param {Vector4} v - The vector to divide.\n * @return {Vector4} A reference to this vector.\n */\n divide(e) {\n return this.x /= e.x, this.y /= e.y, this.z /= e.z, this.w /= e.w, this;\n }\n /**\n * Divides this vector by the given scalar.\n *\n * @param {number} scalar - The scalar to divide.\n * @return {Vector4} A reference to this vector.\n */\n divideScalar(e) {\n return this.multiplyScalar(1 / e);\n }\n /**\n * Sets the x, y and z components of this\n * vector to the quaternion's axis and w to the angle.\n *\n * @param {Quaternion} q - The Quaternion to set.\n * @return {Vector4} A reference to this vector.\n */\n setAxisAngleFromQuaternion(e) {\n this.w = 2 * Math.acos(e.w);\n const t = Math.sqrt(1 - e.w * e.w);\n return t < 1e-4 ? (this.x = 1, this.y = 0, this.z = 0) : (this.x = e.x / t, this.y = e.y / t, this.z = e.z / t), this;\n }\n /**\n * Sets the x, y and z components of this\n * vector to the axis of rotation and w to the angle.\n *\n * @param {Matrix4} m - A 4x4 matrix of which the upper left 3x3 matrix is a pure rotation matrix.\n * @return {Vector4} A reference to this vector.\n */\n setAxisAngleFromRotationMatrix(e) {\n let t, n, s, r;\n const l = e.elements, c = l[0], h = l[4], u = l[8], d = l[1], p = l[5], g = l[9], x = l[2], m = l[6], f = l[10];\n if (Math.abs(h - d) < 0.01 && Math.abs(u - x) < 0.01 && Math.abs(g - m) < 0.01) {\n if (Math.abs(h + d) < 0.1 && Math.abs(u + x) < 0.1 && Math.abs(g + m) < 0.1 && Math.abs(c + p + f - 3) < 0.1)\n return this.set(1, 0, 0, 0), this;\n t = Math.PI;\n const v = (c + 1) / 2, T = (p + 1) / 2, R = (f + 1) / 2, E = (h + d) / 4, P = (u + x) / 4, I = (g + m) / 4;\n return v > T && v > R ? v < 0.01 ? (n = 0, s = 0.707106781, r = 0.707106781) : (n = Math.sqrt(v), s = E / n, r = P / n) : T > R ? T < 0.01 ? (n = 0.707106781, s = 0, r = 0.707106781) : (s = Math.sqrt(T), n = E / s, r = I / s) : R < 0.01 ? (n = 0.707106781, s = 0.707106781, r = 0) : (r = Math.sqrt(R), n = P / r, s = I / r), this.set(n, s, r, t), this;\n }\n let y = Math.sqrt((m - g) * (m - g) + (u - x) * (u - x) + (d - h) * (d - h));\n return Math.abs(y) < 1e-3 && (y = 1), this.x = (m - g) / y, this.y = (u - x) / y, this.z = (d - h) / y, this.w = Math.acos((c + p + f - 1) / 2), this;\n }\n /**\n * Sets the vector components to the position elements of the\n * given transformation matrix.\n *\n * @param {Matrix4} m - The 4x4 matrix.\n * @return {Vector4} A reference to this vector.\n */\n setFromMatrixPosition(e) {\n const t = e.elements;\n return this.x = t[12], this.y = t[13], this.z = t[14], this.w = t[15], this;\n }\n /**\n * If this vector's x, y, z or w value is greater than the given vector's x, y, z or w\n * value, replace that value with the corresponding min value.\n *\n * @param {Vector4} v - The vector.\n * @return {Vector4} A reference to this vector.\n */\n min(e) {\n return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this.z = Math.min(this.z, e.z), this.w = Math.min(this.w, e.w), this;\n }\n /**\n * If this vector's x, y, z or w value is less than the given vector's x, y, z or w\n * value, replace that value with the corresponding max value.\n *\n * @param {Vector4} v - The vector.\n * @return {Vector4} A reference to this vector.\n */\n max(e) {\n return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this.z = Math.max(this.z, e.z), this.w = Math.max(this.w, e.w), this;\n }\n /**\n * If this vector's x, y, z or w value is greater than the max vector's x, y, z or w\n * value, it is replaced by the corresponding value.\n * If this vector's x, y, z or w value is less than the min vector's x, y, z or w value,\n * it is replaced by the corresponding value.\n *\n * @param {Vector4} min - The minimum x, y and z values.\n * @param {Vector4} max - The maximum x, y and z values in the desired range.\n * @return {Vector4} A reference to this vector.\n */\n clamp(e, t) {\n return this.x = He(this.x, e.x, t.x), this.y = He(this.y, e.y, t.y), this.z = He(this.z, e.z, t.z), this.w = He(this.w, e.w, t.w), this;\n }\n /**\n * If this vector's x, y, z or w values are greater than the max value, they are\n * replaced by the max value.\n * If this vector's x, y, z or w values are less than the min value, they are\n * replaced by the min value.\n *\n * @param {number} minVal - The minimum value the components will be clamped to.\n * @param {number} maxVal - The maximum value the components will be clamped to.\n * @return {Vector4} A reference to this vector.\n */\n clampScalar(e, t) {\n return this.x = He(this.x, e, t), this.y = He(this.y, e, t), this.z = He(this.z, e, t), this.w = He(this.w, e, t), this;\n }\n /**\n * If this vector's length is greater than the max value, it is replaced by\n * the max value.\n * If this vector's length is less than the min value, it is replaced by the\n * min value.\n *\n * @param {number} min - The minimum value the vector length will be clamped to.\n * @param {number} max - The maximum value the vector length will be clamped to.\n * @return {Vector4} A reference to this vector.\n */\n clampLength(e, t) {\n const n = this.length();\n return this.divideScalar(n || 1).multiplyScalar(He(n, e, t));\n }\n /**\n * The components of this vector are rounded down to the nearest integer value.\n *\n * @return {Vector4} A reference to this vector.\n */\n floor() {\n return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this.z = Math.floor(this.z), this.w = Math.floor(this.w), this;\n }\n /**\n * The components of this vector are rounded up to the nearest integer value.\n *\n * @return {Vector4} A reference to this vector.\n */\n ceil() {\n return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this.z = Math.ceil(this.z), this.w = Math.ceil(this.w), this;\n }\n /**\n * The components of this vector are rounded to the nearest integer value\n *\n * @return {Vector4} A reference to this vector.\n */\n round() {\n return this.x = Math.round(this.x), this.y = Math.round(this.y), this.z = Math.round(this.z), this.w = Math.round(this.w), this;\n }\n /**\n * The components of this vector are rounded towards zero (up if negative,\n * down if positive) to an integer value.\n *\n * @return {Vector4} A reference to this vector.\n */\n roundToZero() {\n return this.x = Math.trunc(this.x), this.y = Math.trunc(this.y), this.z = Math.trunc(this.z), this.w = Math.trunc(this.w), this;\n }\n /**\n * Inverts this vector - i.e. sets x = -x, y = -y, z = -z, w = -w.\n *\n * @return {Vector4} A reference to this vector.\n */\n negate() {\n return this.x = -this.x, this.y = -this.y, this.z = -this.z, this.w = -this.w, this;\n }\n /**\n * Calculates the dot product of the given vector with this instance.\n *\n * @param {Vector4} v - The vector to compute the dot product with.\n * @return {number} The result of the dot product.\n */\n dot(e) {\n return this.x * e.x + this.y * e.y + this.z * e.z + this.w * e.w;\n }\n /**\n * Computes the square of the Euclidean length (straight-line length) from\n * (0, 0, 0, 0) to (x, y, z, w). If you are comparing the lengths of vectors, you should\n * compare the length squared instead as it is slightly more efficient to calculate.\n *\n * @return {number} The square length of this vector.\n */\n lengthSq() {\n return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;\n }\n /**\n * Computes the Euclidean length (straight-line length) from (0, 0, 0, 0) to (x, y, z, w).\n *\n * @return {number} The length of this vector.\n */\n length() {\n return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);\n }\n /**\n * Computes the Manhattan length of this vector.\n *\n * @return {number} The length of this vector.\n */\n manhattanLength() {\n return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z) + Math.abs(this.w);\n }\n /**\n * Converts this vector to a unit vector - that is, sets it equal to a vector\n * with the same direction as this one, but with a vector length of `1`.\n *\n * @return {Vector4} A reference to this vector.\n */\n normalize() {\n return this.divideScalar(this.length() || 1);\n }\n /**\n * Sets this vector to a vector with the same direction as this one, but\n * with the specified length.\n *\n * @param {number} length - The new length of this vector.\n * @return {Vector4} A reference to this vector.\n */\n setLength(e) {\n return this.normalize().multiplyScalar(e);\n }\n /**\n * Linearly interpolates between the given vector and this instance, where\n * alpha is the percent distance along the line - alpha = 0 will be this\n * vector, and alpha = 1 will be the given one.\n *\n * @param {Vector4} v - The vector to interpolate towards.\n * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`.\n * @return {Vector4} A reference to this vector.\n */\n lerp(e, t) {\n return this.x += (e.x - this.x) * t, this.y += (e.y - this.y) * t, this.z += (e.z - this.z) * t, this.w += (e.w - this.w) * t, this;\n }\n /**\n * Linearly interpolates between the given vectors, where alpha is the percent\n * distance along the line - alpha = 0 will be first vector, and alpha = 1 will\n * be the second one. The result is stored in this instance.\n *\n * @param {Vector4} v1 - The first vector.\n * @param {Vector4} v2 - The second vector.\n * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`.\n * @return {Vector4} A reference to this vector.\n */\n lerpVectors(e, t, n) {\n return this.x = e.x + (t.x - e.x) * n, this.y = e.y + (t.y - e.y) * n, this.z = e.z + (t.z - e.z) * n, this.w = e.w + (t.w - e.w) * n, this;\n }\n /**\n * Returns `true` if this vector is equal with the given one.\n *\n * @param {Vector4} v - The vector to test for equality.\n * @return {boolean} Whether this vector is equal with the given one.\n */\n equals(e) {\n return e.x === this.x && e.y === this.y && e.z === this.z && e.w === this.w;\n }\n /**\n * Sets this vector's x value to be `array[ offset ]`, y value to be `array[ offset + 1 ]`,\n * z value to be `array[ offset + 2 ]`, w value to be `array[ offset + 3 ]`.\n *\n * @param {Array} array - An array holding the vector component values.\n * @param {number} [offset=0] - The offset into the array.\n * @return {Vector4} A reference to this vector.\n */\n fromArray(e, t = 0) {\n return this.x = e[t], this.y = e[t + 1], this.z = e[t + 2], this.w = e[t + 3], this;\n }\n /**\n * Writes the components of this vector to the given array. If no array is provided,\n * the method returns a new instance.\n *\n * @param {Array} [array=[]] - The target array holding the vector components.\n * @param {number} [offset=0] - Index of the first element in the array.\n * @return {Array} The vector components.\n */\n toArray(e = [], t = 0) {\n return e[t] = this.x, e[t + 1] = this.y, e[t + 2] = this.z, e[t + 3] = this.w, e;\n }\n /**\n * Sets the components of this vector from the given buffer attribute.\n *\n * @param {BufferAttribute} attribute - The buffer attribute holding vector data.\n * @param {number} index - The index into the attribute.\n * @return {Vector4} A reference to this vector.\n */\n fromBufferAttribute(e, t) {\n return this.x = e.getX(t), this.y = e.getY(t), this.z = e.getZ(t), this.w = e.getW(t), this;\n }\n /**\n * Sets each component of this vector to a pseudo-random value between `0` and\n * `1`, excluding `1`.\n *\n * @return {Vector4} A reference to this vector.\n */\n random() {\n return this.x = Math.random(), this.y = Math.random(), this.z = Math.random(), this.w = Math.random(), this;\n }\n *[Symbol.iterator]() {\n yield this.x, yield this.y, yield this.z, yield this.w;\n }\n}\nclass Uu extends mi {\n /**\n * Render target options.\n *\n * @typedef {Object} RenderTarget~Options\n * @property {boolean} [generateMipmaps=false] - Whether to generate mipmaps or not.\n * @property {number} [magFilter=LinearFilter] - The mag filter.\n * @property {number} [minFilter=LinearFilter] - The min filter.\n * @property {number} [format=RGBAFormat] - The texture format.\n * @property {number} [type=UnsignedByteType] - The texture type.\n * @property {?string} [internalFormat=null] - The texture's internal format.\n * @property {number} [wrapS=ClampToEdgeWrapping] - The texture's uv wrapping mode.\n * @property {number} [wrapT=ClampToEdgeWrapping] - The texture's uv wrapping mode.\n * @property {number} [anisotropy=1] - The texture's anisotropy value.\n * @property {string} [colorSpace=NoColorSpace] - The texture's color space.\n * @property {boolean} [depthBuffer=true] - Whether to allocate a depth buffer or not.\n * @property {boolean} [stencilBuffer=false] - Whether to allocate a stencil buffer or not.\n * @property {boolean} [resolveDepthBuffer=true] - Whether to resolve the depth buffer or not.\n * @property {boolean} [resolveStencilBuffer=true] - Whether to resolve the stencil buffer or not.\n * @property {?Texture} [depthTexture=null] - Reference to a depth texture.\n * @property {number} [samples=0] - The MSAA samples count.\n * @property {number} [count=1] - Defines the number of color attachments . Must be at least `1`.\n * @property {number} [depth=1] - The texture depth.\n * @property {boolean} [multiview=false] - Whether this target is used for multiview rendering.\n */\n /**\n * Constructs a new render target.\n *\n * @param {number} [width=1] - The width of the render target.\n * @param {number} [height=1] - The height of the render target.\n * @param {RenderTarget~Options} [options] - The configuration object.\n */\n constructor(e = 1, t = 1, n = {}) {\n super(), n = Object.assign({\n generateMipmaps: !1,\n internalFormat: null,\n minFilter: bt,\n depthBuffer: !0,\n stencilBuffer: !1,\n resolveDepthBuffer: !0,\n resolveStencilBuffer: !0,\n depthTexture: null,\n samples: 0,\n count: 1,\n depth: 1,\n multiview: !1\n }, n), this.isRenderTarget = !0, this.width = e, this.height = t, this.depth = n.depth, this.scissor = new Je(0, 0, e, t), this.scissorTest = !1, this.viewport = new Je(0, 0, e, t);\n const s = { width: e, height: t, depth: n.depth }, r = new Ct(s);\n this.textures = [];\n const a = n.count;\n for (let o = 0; o < a; o++)\n this.textures[o] = r.clone(), this.textures[o].isRenderTargetTexture = !0, this.textures[o].renderTarget = this;\n this._setTextureOptions(n), this.depthBuffer = n.depthBuffer, this.stencilBuffer = n.stencilBuffer, this.resolveDepthBuffer = n.resolveDepthBuffer, this.resolveStencilBuffer = n.resolveStencilBuffer, this._depthTexture = null, this.depthTexture = n.depthTexture, this.samples = n.samples, this.multiview = n.multiview;\n }\n _setTextureOptions(e = {}) {\n const t = {\n minFilter: bt,\n generateMipmaps: !1,\n flipY: !1,\n internalFormat: null\n };\n e.mapping !== void 0 && (t.mapping = e.mapping), e.wrapS !== void 0 && (t.wrapS = e.wrapS), e.wrapT !== void 0 && (t.wrapT = e.wrapT), e.wrapR !== void 0 && (t.wrapR = e.wrapR), e.magFilter !== void 0 && (t.magFilter = e.magFilter), e.minFilter !== void 0 && (t.minFilter = e.minFilter), e.format !== void 0 && (t.format = e.format), e.type !== void 0 && (t.type = e.type), e.anisotropy !== void 0 && (t.anisotropy = e.anisotropy), e.colorSpace !== void 0 && (t.colorSpace = e.colorSpace), e.flipY !== void 0 && (t.flipY = e.flipY), e.generateMipmaps !== void 0 && (t.generateMipmaps = e.generateMipmaps), e.internalFormat !== void 0 && (t.internalFormat = e.internalFormat);\n for (let n = 0; n < this.textures.length; n++)\n this.textures[n].setValues(t);\n }\n /**\n * The texture representing the default color attachment.\n *\n * @type {Texture}\n */\n get texture() {\n return this.textures[0];\n }\n set texture(e) {\n this.textures[0] = e;\n }\n set depthTexture(e) {\n this._depthTexture !== null && (this._depthTexture.renderTarget = null), e !== null && (e.renderTarget = this), this._depthTexture = e;\n }\n /**\n * Instead of saving the depth in a renderbuffer, a texture\n * can be used instead which is useful for further processing\n * e.g. in context of post-processing.\n *\n * @type {?DepthTexture}\n * @default null\n */\n get depthTexture() {\n return this._depthTexture;\n }\n /**\n * Sets the size of this render target.\n *\n * @param {number} width - The width.\n * @param {number} height - The height.\n * @param {number} [depth=1] - The depth.\n */\n setSize(e, t, n = 1) {\n if (this.width !== e || this.height !== t || this.depth !== n) {\n this.width = e, this.height = t, this.depth = n;\n for (let s = 0, r = this.textures.length; s < r; s++)\n this.textures[s].image.width = e, this.textures[s].image.height = t, this.textures[s].image.depth = n, this.textures[s].isData3DTexture !== !0 && (this.textures[s].isArrayTexture = this.textures[s].image.depth > 1);\n this.dispose();\n }\n this.viewport.set(0, 0, e, t), this.scissor.set(0, 0, e, t);\n }\n /**\n * Returns a new render target with copied values from this instance.\n *\n * @return {RenderTarget} A clone of this instance.\n */\n clone() {\n return new this.constructor().copy(this);\n }\n /**\n * Copies the settings of the given render target. This is a structural copy so\n * no resources are shared between render targets after the copy. That includes\n * all MRT textures and the depth texture.\n *\n * @param {RenderTarget} source - The render target to copy.\n * @return {RenderTarget} A reference to this instance.\n */\n copy(e) {\n this.width = e.width, this.height = e.height, this.depth = e.depth, this.scissor.copy(e.scissor), this.scissorTest = e.scissorTest, this.viewport.copy(e.viewport), this.textures.length = 0;\n for (let t = 0, n = e.textures.length; t < n; t++) {\n this.textures[t] = e.textures[t].clone(), this.textures[t].isRenderTargetTexture = !0, this.textures[t].renderTarget = this;\n const s = Object.assign({}, e.textures[t].image);\n this.textures[t].source = new Io(s);\n }\n return this.depthBuffer = e.depthBuffer, this.stencilBuffer = e.stencilBuffer, this.resolveDepthBuffer = e.resolveDepthBuffer, this.resolveStencilBuffer = e.resolveStencilBuffer, e.depthTexture !== null && (this.depthTexture = e.depthTexture.clone()), this.samples = e.samples, this;\n }\n /**\n * Frees the GPU-related resources allocated by this instance. Call this\n * method whenever this instance is no longer used in your app.\n *\n * @fires RenderTarget#dispose\n */\n dispose() {\n this.dispatchEvent({ type: \"dispose\" });\n }\n}\nclass St extends Uu {\n /**\n * Constructs a new 3D render target.\n *\n * @param {number} [width=1] - The width of the render target.\n * @param {number} [height=1] - The height of the render target.\n * @param {RenderTarget~Options} [options] - The configuration object.\n */\n constructor(e = 1, t = 1, n = {}) {\n super(e, t, n), this.isWebGLRenderTarget = !0;\n }\n}\nclass Jc extends Ct {\n /**\n * Constructs a new data array texture.\n *\n * @param {?TypedArray} [data=null] - The buffer data.\n * @param {number} [width=1] - The width of the texture.\n * @param {number} [height=1] - The height of the texture.\n * @param {number} [depth=1] - The depth of the texture.\n */\n constructor(e = null, t = 1, n = 1, s = 1) {\n super(null), this.isDataArrayTexture = !0, this.image = { data: e, width: t, height: n, depth: s }, this.magFilter = Dt, this.minFilter = Dt, this.wrapR = en, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1, this.layerUpdates = /* @__PURE__ */ new Set();\n }\n /**\n * Describes that a specific layer of the texture needs to be updated.\n * Normally when {@link Texture#needsUpdate} is set to `true`, the\n * entire data texture array is sent to the GPU. Marking specific\n * layers will only transmit subsets of all mipmaps associated with a\n * specific depth in the array which is often much more performant.\n *\n * @param {number} layerIndex - The layer index that should be updated.\n */\n addLayerUpdate(e) {\n this.layerUpdates.add(e);\n }\n /**\n * Resets the layer updates registry.\n */\n clearLayerUpdates() {\n this.layerUpdates.clear();\n }\n}\nclass Nu extends Ct {\n /**\n * Constructs a new data array texture.\n *\n * @param {?TypedArray} [data=null] - The buffer data.\n * @param {number} [width=1] - The width of the texture.\n * @param {number} [height=1] - The height of the texture.\n * @param {number} [depth=1] - The depth of the texture.\n */\n constructor(e = null, t = 1, n = 1, s = 1) {\n super(null), this.isData3DTexture = !0, this.image = { data: e, width: t, height: n, depth: s }, this.magFilter = Dt, this.minFilter = Dt, this.wrapR = en, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1;\n }\n}\nclass Pt {\n /**\n * Constructs a new bounding box.\n *\n * @param {Vector3} [min=(Infinity,Infinity,Infinity)] - A vector representing the lower boundary of the box.\n * @param {Vector3} [max=(-Infinity,-Infinity,-Infinity)] - A vector representing the upper boundary of the box.\n */\n constructor(e = new w(1 / 0, 1 / 0, 1 / 0), t = new w(-1 / 0, -1 / 0, -1 / 0)) {\n this.isBox3 = !0, this.min = e, this.max = t;\n }\n /**\n * Sets the lower and upper boundaries of this box.\n * Please note that this method only copies the values from the given objects.\n *\n * @param {Vector3} min - The lower boundary of the box.\n * @param {Vector3} max - The upper boundary of the box.\n * @return {Box3} A reference to this bounding box.\n */\n set(e, t) {\n return this.min.copy(e), this.max.copy(t), this;\n }\n /**\n * Sets the upper and lower bounds of this box so it encloses the position data\n * in the given array.\n *\n * @param {Array} array - An array holding 3D position data.\n * @return {Box3} A reference to this bounding box.\n */\n setFromArray(e) {\n this.makeEmpty();\n for (let t = 0, n = e.length; t < n; t += 3)\n this.expandByPoint(rn.fromArray(e, t));\n return this;\n }\n /**\n * Sets the upper and lower bounds of this box so it encloses the position data\n * in the given buffer attribute.\n *\n * @param {BufferAttribute} attribute - A buffer attribute holding 3D position data.\n * @return {Box3} A reference to this bounding box.\n */\n setFromBufferAttribute(e) {\n this.makeEmpty();\n for (let t = 0, n = e.count; t < n; t++)\n this.expandByPoint(rn.fromBufferAttribute(e, t));\n return this;\n }\n /**\n * Sets the upper and lower bounds of this box so it encloses the position data\n * in the given array.\n *\n * @param {Array} points - An array holding 3D position data as instances of {@link Vector3}.\n * @return {Box3} A reference to this bounding box.\n */\n setFromPoints(e) {\n this.makeEmpty();\n for (let t = 0, n = e.length; t < n; t++)\n this.expandByPoint(e[t]);\n return this;\n }\n /**\n * Centers this box on the given center vector and sets this box's width, height and\n * depth to the given size values.\n *\n * @param {Vector3} center - The center of the box.\n * @param {Vector3} size - The x, y and z dimensions of the box.\n * @return {Box3} A reference to this bounding box.\n */\n setFromCenterAndSize(e, t) {\n const n = rn.copy(t).multiplyScalar(0.5);\n return this.min.copy(e).sub(n), this.max.copy(e).add(n), this;\n }\n /**\n * Computes the world-axis-aligned bounding box for the given 3D object\n * (including its children), accounting for the object's, and children's,\n * world transforms. The function may result in a larger box than strictly necessary.\n *\n * @param {Object3D} object - The 3D object to compute the bounding box for.\n * @param {boolean} [precise=false] - If set to `true`, the method computes the smallest\n * world-axis-aligned bounding box at the expense of more computation.\n * @return {Box3} A reference to this bounding box.\n */\n setFromObject(e, t = !1) {\n return this.makeEmpty(), this.expandByObject(e, t);\n }\n /**\n * Returns a new box with copied values from this instance.\n *\n * @return {Box3} A clone of this instance.\n */\n clone() {\n return new this.constructor().copy(this);\n }\n /**\n * Copies the values of the given box to this instance.\n *\n * @param {Box3} box - The box to copy.\n * @return {Box3} A reference to this bounding box.\n */\n copy(e) {\n return this.min.copy(e.min), this.max.copy(e.max), this;\n }\n /**\n * Makes this box empty which means in encloses a zero space in 3D.\n *\n * @return {Box3} A reference to this bounding box.\n */\n makeEmpty() {\n return this.min.x = this.min.y = this.min.z = 1 / 0, this.max.x = this.max.y = this.max.z = -1 / 0, this;\n }\n /**\n * Returns true if this box includes zero points within its bounds.\n * Note that a box with equal lower and upper bounds still includes one\n * point, the one both bounds share.\n *\n * @return {boolean} Whether this box is empty or not.\n */\n isEmpty() {\n return this.max.x < this.min.x || this.max.y < this.min.y || this.max.z < this.min.z;\n }\n /**\n * Returns the center point of this box.\n *\n * @param {Vector3} target - The target vector that is used to store the method's result.\n * @return {Vector3} The center point.\n */\n getCenter(e) {\n return this.isEmpty() ? e.set(0, 0, 0) : e.addVectors(this.min, this.max).multiplyScalar(0.5);\n }\n /**\n * Returns the dimensions of this box.\n *\n * @param {Vector3} target - The target vector that is used to store the method's result.\n * @return {Vector3} The size.\n */\n getSize(e) {\n return this.isEmpty() ? e.set(0, 0, 0) : e.subVectors(this.max, this.min);\n }\n /**\n * Expands the boundaries of this box to include the given point.\n *\n * @param {Vector3} point - The point that should be included by the bounding box.\n * @return {Box3} A reference to this bounding box.\n */\n expandByPoint(e) {\n return this.min.min(e), this.max.max(e), this;\n }\n /**\n * Expands this box equilaterally by the given vector. The width of this\n * box will be expanded by the x component of the vector in both\n * directions. The height of this box will be expanded by the y component of\n * the vector in both directions. The depth of this box will be\n * expanded by the z component of the vector in both directions.\n *\n * @param {Vector3} vector - The vector that should expand the bounding box.\n * @return {Box3} A reference to this bounding box.\n */\n expandByVector(e) {\n return this.min.sub(e), this.max.add(e), this;\n }\n /**\n * Expands each dimension of the box by the given scalar. If negative, the\n * dimensions of the box will be contracted.\n *\n * @param {number} scalar - The scalar value that should expand the bounding box.\n * @return {Box3} A reference to this bounding box.\n */\n expandByScalar(e) {\n return this.min.addScalar(-e), this.max.addScalar(e), this;\n }\n /**\n * Expands the boundaries of this box to include the given 3D object and\n * its children, accounting for the object's, and children's, world\n * transforms. The function may result in a larger box than strictly\n * necessary (unless the precise parameter is set to true).\n *\n * @param {Object3D} object - The 3D object that should expand the bounding box.\n * @param {boolean} precise - If set to `true`, the method expands the bounding box\n * as little as necessary at the expense of more computation.\n * @return {Box3} A reference to this bounding box.\n */\n expandByObject(e, t = !1) {\n e.updateWorldMatrix(!1, !1);\n const n = e.geometry;\n if (n !== void 0) {\n const r = n.getAttribute(\"position\");\n if (t === !0 && r !== void 0 && e.isInstancedMesh !== !0)\n for (let a = 0, o = r.count; a < o; a++)\n e.isMesh === !0 ? e.getVertexPosition(a, rn) : rn.fromBufferAttribute(r, a), rn.applyMatrix4(e.matrixWorld), this.expandByPoint(rn);\n else\n e.boundingBox !== void 0 ? (e.boundingBox === null && e.computeBoundingBox(), Is.copy(e.boundingBox)) : (n.boundingBox === null && n.computeBoundingBox(), Is.copy(n.boundingBox)), Is.applyMatrix4(e.matrixWorld), this.union(Is);\n }\n const s = e.children;\n for (let r = 0, a = s.length; r < a; r++)\n this.expandByObject(s[r], t);\n return this;\n }\n /**\n * Returns `true` if the given point lies within or on the boundaries of this box.\n *\n * @param {Vector3} point - The point to test.\n * @return {boolean} Whether the bounding box contains the given point or not.\n */\n containsPoint(e) {\n return e.x >= this.min.x && e.x <= this.max.x && e.y >= this.min.y && e.y <= this.max.y && e.z >= this.min.z && e.z <= this.max.z;\n }\n /**\n * Returns `true` if this bounding box includes the entirety of the given bounding box.\n * If this box and the given one are identical, this function also returns `true`.\n *\n * @param {Box3} box - The bounding box to test.\n * @return {boolean} Whether the bounding box contains the given bounding box or not.\n */\n containsBox(e) {\n return this.min.x <= e.min.x && e.max.x <= this.max.x && this.min.y <= e.min.y && e.max.y <= this.max.y && this.min.z <= e.min.z && e.max.z <= this.max.z;\n }\n /**\n * Returns a point as a proportion of this box's width, height and depth.\n *\n * @param {Vector3} point - A point in 3D space.\n * @param {Vector3} target - The target vector that is used to store the method's result.\n * @return {Vector3} A point as a proportion of this box's width, height and depth.\n */\n getParameter(e, t) {\n return t.set(\n (e.x - this.min.x) / (this.max.x - this.min.x),\n (e.y - this.min.y) / (this.max.y - this.min.y),\n (e.z - this.min.z) / (this.max.z - this.min.z)\n );\n }\n /**\n * Returns `true` if the given bounding box intersects with this bounding box.\n *\n * @param {Box3} box - The bounding box to test.\n * @return {boolean} Whether the given bounding box intersects with this bounding box.\n */\n intersectsBox(e) {\n return e.max.x >= this.min.x && e.min.x <= this.max.x && e.max.y >= this.min.y && e.min.y <= this.max.y && e.max.z >= this.min.z && e.min.z <= this.max.z;\n }\n /**\n * Returns `true` if the given bounding sphere intersects with this bounding box.\n *\n * @param {Sphere} sphere - The bounding sphere to test.\n * @return {boolean} Whether the given bounding sphere intersects with this bounding box.\n */\n intersectsSphere(e) {\n return this.clampPoint(e.center, rn), rn.distanceToSquared(e.center) <= e.radius * e.radius;\n }\n /**\n * Returns `true` if the given plane intersects with this bounding box.\n *\n * @param {Plane} plane - The plane to test.\n * @return {boolean} Whether the given plane intersects with this bounding box.\n */\n intersectsPlane(e) {\n let t, n;\n return e.normal.x > 0 ? (t = e.normal.x * this.min.x, n = e.normal.x * this.max.x) : (t = e.normal.x * this.max.x, n = e.normal.x * this.min.x), e.normal.y > 0 ? (t += e.normal.y * this.min.y, n += e.normal.y * this.max.y) : (t += e.normal.y * this.max.y, n += e.normal.y * this.min.y), e.normal.z > 0 ? (t += e.normal.z * this.min.z, n += e.normal.z * this.max.z) : (t += e.normal.z * this.max.z, n += e.normal.z * this.min.z), t <= -e.constant && n >= -e.constant;\n }\n /**\n * Returns `true` if the given triangle intersects with this bounding box.\n *\n * @param {Triangle} triangle - The triangle to test.\n * @return {boolean} Whether the given triangle intersects with this bounding box.\n */\n intersectsTriangle(e) {\n if (this.isEmpty())\n return !1;\n this.getCenter(ss), Us.subVectors(this.max, ss), vi.subVectors(e.a, ss), Mi.subVectors(e.b, ss), Si.subVectors(e.c, ss), Gn.subVectors(Mi, vi), Hn.subVectors(Si, Mi), si.subVectors(vi, Si);\n let t = [\n 0,\n -Gn.z,\n Gn.y,\n 0,\n -Hn.z,\n Hn.y,\n 0,\n -si.z,\n si.y,\n Gn.z,\n 0,\n -Gn.x,\n Hn.z,\n 0,\n -Hn.x,\n si.z,\n 0,\n -si.x,\n -Gn.y,\n Gn.x,\n 0,\n -Hn.y,\n Hn.x,\n 0,\n -si.y,\n si.x,\n 0\n ];\n return !Vr(t, vi, Mi, Si, Us) || (t = [1, 0, 0, 0, 1, 0, 0, 0, 1], !Vr(t, vi, Mi, Si, Us)) ? !1 : (Ns.crossVectors(Gn, Hn), t = [Ns.x, Ns.y, Ns.z], Vr(t, vi, Mi, Si, Us));\n }\n /**\n * Clamps the given point within the bounds of this box.\n *\n * @param {Vector3} point - The point to clamp.\n * @param {Vector3} target - The target vector that is used to store the method's result.\n * @return {Vector3} The clamped point.\n */\n clampPoint(e, t) {\n return t.copy(e).clamp(this.min, this.max);\n }\n /**\n * Returns the euclidean distance from any edge of this box to the specified point. If\n * the given point lies inside of this box, the distance will be `0`.\n *\n * @param {Vector3} point - The point to compute the distance to.\n * @return {number} The euclidean distance.\n */\n distanceToPoint(e) {\n return this.clampPoint(e, rn).distanceTo(e);\n }\n /**\n * Returns a bounding sphere that encloses this bounding box.\n *\n * @param {Sphere} target - The target sphere that is used to store the method's result.\n * @return {Sphere} The bounding sphere that encloses this bounding box.\n */\n getBoundingSphere(e) {\n return this.isEmpty() ? e.makeEmpty() : (this.getCenter(e.center), e.radius = this.getSize(rn).length() * 0.5), e;\n }\n /**\n * Computes the intersection of this bounding box and the given one, setting the upper\n * bound of this box to the lesser of the two boxes' upper bounds and the\n * lower bound of this box to the greater of the two boxes' lower bounds. If\n * there's no overlap, makes this box empty.\n *\n * @param {Box3} box - The bounding box to intersect with.\n * @return {Box3} A reference to this bounding box.\n */\n intersect(e) {\n return this.min.max(e.min), this.max.min(e.max), this.isEmpty() && this.makeEmpty(), this;\n }\n /**\n * Computes the union of this box and another and the given one, setting the upper\n * bound of this box to the greater of the two boxes' upper bounds and the\n * lower bound of this box to the lesser of the two boxes' lower bounds.\n *\n * @param {Box3} box - The bounding box that will be unioned with this instance.\n * @return {Box3} A reference to this bounding box.\n */\n union(e) {\n return this.min.min(e.min), this.max.max(e.max), this;\n }\n /**\n * Transforms this bounding box by the given 4x4 transformation matrix.\n *\n * @param {Matrix4} matrix - The transformation matrix.\n * @return {Box3} A reference to this bounding box.\n */\n applyMatrix4(e) {\n return this.isEmpty() ? this : (Pn[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(e), Pn[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(e), Pn[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(e), Pn[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(e), Pn[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(e), Pn[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(e), Pn[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(e), Pn[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(e), this.setFromPoints(Pn), this);\n }\n /**\n * Adds the given offset to both the upper and lower bounds of this bounding box,\n * effectively moving it in 3D space.\n *\n * @param {Vector3} offset - The offset that should be used to translate the bounding box.\n * @return {Box3} A reference to this bounding box.\n */\n translate(e) {\n return this.min.add(e), this.max.add(e), this;\n }\n /**\n * Returns `true` if this bounding box is equal with the given one.\n *\n * @param {Box3} box - The box to test for equality.\n * @return {boolean} Whether this bounding box is equal with the given one.\n */\n equals(e) {\n return e.min.equals(this.min) && e.max.equals(this.max);\n }\n /**\n * Returns a serialized structure of the bounding box.\n *\n * @return {Object} Serialized structure with fields representing the object state.\n */\n toJSON() {\n return {\n min: this.min.toArray(),\n max: this.max.toArray()\n };\n }\n /**\n * Returns a serialized structure of the bounding box.\n *\n * @param {Object} json - The serialized json to set the box from.\n * @return {Box3} A reference to this bounding box.\n */\n fromJSON(e) {\n return this.min.fromArray(e.min), this.max.fromArray(e.max), this;\n }\n}\nconst Pn = [\n /* @__PURE__ */ new w(),\n /* @__PURE__ */ new w(),\n /* @__PURE__ */ new w(),\n /* @__PURE__ */ new w(),\n /* @__PURE__ */ new w(),\n /* @__PURE__ */ new w(),\n /* @__PURE__ */ new w(),\n /* @__PURE__ */ new w()\n], rn = /* @__PURE__ */ new w(), Is = /* @__PURE__ */ new Pt(), vi = /* @__PURE__ */ new w(), Mi = /* @__PURE__ */ new w(), Si = /* @__PURE__ */ new w(), Gn = /* @__PURE__ */ new w(), Hn = /* @__PURE__ */ new w(), si = /* @__PURE__ */ new w(), ss = /* @__PURE__ */ new w(), Us = /* @__PURE__ */ new w(), Ns = /* @__PURE__ */ new w(), ri = /* @__PURE__ */ new w();\nfunction Vr(i, e, t, n, s) {\n for (let r = 0, a = i.length - 3; r <= a; r += 3) {\n ri.fromArray(i, r);\n const o = s.x * Math.abs(ri.x) + s.y * Math.abs(ri.y) + s.z * Math.abs(ri.z), l = e.dot(ri), c = t.dot(ri), h = n.dot(ri);\n if (Math.max(-Math.max(l, c, h), Math.min(l, c, h)) > o)\n return !1;\n }\n return !0;\n}\nconst Fu = /* @__PURE__ */ new Pt(), rs = /* @__PURE__ */ new w(), Gr = /* @__PURE__ */ new w();\nclass Rn {\n /**\n * Constructs a new sphere.\n *\n * @param {Vector3} [center=(0,0,0)] - The center of the sphere\n * @param {number} [radius=-1] - The radius of the sphere.\n */\n constructor(e = new w(), t = -1) {\n this.isSphere = !0, this.center = e, this.radius = t;\n }\n /**\n * Sets the sphere's components by copying the given values.\n *\n * @param {Vector3} center - The center.\n * @param {number} radius - The radius.\n * @return {Sphere} A reference to this sphere.\n */\n set(e, t) {\n return this.center.copy(e), this.radius = t, this;\n }\n /**\n * Computes the minimum bounding sphere for list of points.\n * If the optional center point is given, it is used as the sphere's\n * center. Otherwise, the center of the axis-aligned bounding box\n * encompassing the points is calculated.\n *\n * @param {Array} points - A list of points in 3D space.\n * @param {Vector3} [optionalCenter] - The center of the sphere.\n * @return {Sphere} A reference to this sphere.\n */\n setFromPoints(e, t) {\n const n = this.center;\n t !== void 0 ? n.copy(t) : Fu.setFromPoints(e).getCenter(n);\n let s = 0;\n for (let r = 0, a = e.length; r < a; r++)\n s = Math.max(s, n.distanceToSquared(e[r]));\n return this.radius = Math.sqrt(s), this;\n }\n /**\n * Copies the values of the given sphere to this instance.\n *\n * @param {Sphere} sphere - The sphere to copy.\n * @return {Sphere} A reference to this sphere.\n */\n copy(e) {\n return this.center.copy(e.center), this.radius = e.radius, this;\n }\n /**\n * Returns `true` if the sphere is empty (the radius set to a negative number).\n *\n * Spheres with a radius of `0` contain only their center point and are not\n * considered to be empty.\n *\n * @return {boolean} Whether this sphere is empty or not.\n */\n isEmpty() {\n return this.radius < 0;\n }\n /**\n * Makes this sphere empty which means in encloses a zero space in 3D.\n *\n * @return {Sphere} A reference to this sphere.\n */\n makeEmpty() {\n return this.center.set(0, 0, 0), this.radius = -1, this;\n }\n /**\n * Returns `true` if this sphere contains the given point inclusive of\n * the surface of the sphere.\n *\n * @param {Vector3} point - The point to check.\n * @return {boolean} Whether this sphere contains the given point or not.\n */\n containsPoint(e) {\n return e.distanceToSquared(this.center) <= this.radius * this.radius;\n }\n /**\n * Returns the closest distance from the boundary of the sphere to the\n * given point. If the sphere contains the point, the distance will\n * be negative.\n *\n * @param {Vector3} point - The point to compute the distance to.\n * @return {number} The distance to the point.\n */\n distanceToPoint(e) {\n return e.distanceTo(this.center) - this.radius;\n }\n /**\n * Returns `true` if this sphere intersects with the given one.\n *\n * @param {Sphere} sphere - The sphere to test.\n * @return {boolean} Whether this sphere intersects with the given one or not.\n */\n intersectsSphere(e) {\n const t = this.radius + e.radius;\n return e.center.distanceToSquared(this.center) <= t * t;\n }\n /**\n * Returns `true` if this sphere intersects with the given box.\n *\n * @param {Box3} box - The box to test.\n * @return {boolean} Whether this sphere intersects with the given box or not.\n */\n intersectsBox(e) {\n return e.intersectsSphere(this);\n }\n /**\n * Returns `true` if this sphere intersects with the given plane.\n *\n * @param {Plane} plane - The plane to test.\n * @return {boolean} Whether this sphere intersects with the given plane or not.\n */\n intersectsPlane(e) {\n return Math.abs(e.distanceToPoint(this.center)) <= this.radius;\n }\n /**\n * Clamps a point within the sphere. If the point is outside the sphere, it\n * will clamp it to the closest point on the edge of the sphere. Points\n * already inside the sphere will not be affected.\n *\n * @param {Vector3} point - The plane to clamp.\n * @param {Vector3} target - The target vector that is used to store the method's result.\n * @return {Vector3} The clamped point.\n */\n clampPoint(e, t) {\n const n = this.center.distanceToSquared(e);\n return t.copy(e), n > this.radius * this.radius && (t.sub(this.center).normalize(), t.multiplyScalar(this.radius).add(this.center)), t;\n }\n /**\n * Returns a bounding box that encloses this sphere.\n *\n * @param {Box3} target - The target box that is used to store the method's result.\n * @return {Box3} The bounding box that encloses this sphere.\n */\n getBoundingBox(e) {\n return this.isEmpty() ? (e.makeEmpty(), e) : (e.set(this.center, this.center), e.expandByScalar(this.radius), e);\n }\n /**\n * Transforms this sphere with the given 4x4 transformation matrix.\n *\n * @param {Matrix4} matrix - The transformation matrix.\n * @return {Sphere} A reference to this sphere.\n */\n applyMatrix4(e) {\n return this.center.applyMatrix4(e), this.radius = this.radius * e.getMaxScaleOnAxis(), this;\n }\n /**\n * Translates the sphere's center by the given offset.\n *\n * @param {Vector3} offset - The offset.\n * @return {Sphere} A reference to this sphere.\n */\n translate(e) {\n return this.center.add(e), this;\n }\n /**\n * Expands the boundaries of this sphere to include the given point.\n *\n * @param {Vector3} point - The point to include.\n * @return {Sphere} A reference to this sphere.\n */\n expandByPoint(e) {\n if (this.isEmpty())\n return this.center.copy(e), this.radius = 0, this;\n rs.subVectors(e, this.center);\n const t = rs.lengthSq();\n if (t > this.radius * this.radius) {\n const n = Math.sqrt(t), s = (n - this.radius) * 0.5;\n this.center.addScaledVector(rs, s / n), this.radius += s;\n }\n return this;\n }\n /**\n * Expands this sphere to enclose both the original sphere and the given sphere.\n *\n * @param {Sphere} sphere - The sphere to include.\n * @return {Sphere} A reference to this sphere.\n */\n union(e) {\n return e.isEmpty() ? this : this.isEmpty() ? (this.copy(e), this) : (this.center.equals(e.center) === !0 ? this.radius = Math.max(this.radius, e.radius) : (Gr.subVectors(e.center, this.center).setLength(e.radius), this.expandByPoint(rs.copy(e.center).add(Gr)), this.expandByPoint(rs.copy(e.center).sub(Gr))), this);\n }\n /**\n * Returns `true` if this sphere is equal with the given one.\n *\n * @param {Sphere} sphere - The sphere to test for equality.\n * @return {boolean} Whether this bounding sphere is equal with the given one.\n */\n equals(e) {\n return e.center.equals(this.center) && e.radius === this.radius;\n }\n /**\n * Returns a new sphere with copied values from this instance.\n *\n * @return {Sphere} A clone of this instance.\n */\n clone() {\n return new this.constructor().copy(this);\n }\n /**\n * Returns a serialized structure of the bounding sphere.\n *\n * @return {Object} Serialized structure with fields representing the object state.\n */\n toJSON() {\n return {\n radius: this.radius,\n center: this.center.toArray()\n };\n }\n /**\n * Returns a serialized structure of the bounding sphere.\n *\n * @param {Object} json - The serialized json to set the sphere from.\n * @return {Box3} A reference to this bounding sphere.\n */\n fromJSON(e) {\n return this.radius = e.radius, this.center.fromArray(e.center), this;\n }\n}\nconst Dn = /* @__PURE__ */ new w(), Hr = /* @__PURE__ */ new w(), Fs = /* @__PURE__ */ new w(), Wn = /* @__PURE__ */ new w(), Wr = /* @__PURE__ */ new w(), Os = /* @__PURE__ */ new w(), Xr = /* @__PURE__ */ new w();\nclass Ji {\n /**\n * Constructs a new ray.\n *\n * @param {Vector3} [origin=(0,0,0)] - The origin of the ray.\n * @param {Vector3} [direction=(0,0,-1)] - The (normalized) direction of the ray.\n */\n constructor(e = new w(), t = new w(0, 0, -1)) {\n this.origin = e, this.direction = t;\n }\n /**\n * Sets the ray's components by copying the given values.\n *\n * @param {Vector3} origin - The origin.\n * @param {Vector3} direction - The direction.\n * @return {Ray} A reference to this ray.\n */\n set(e, t) {\n return this.origin.copy(e), this.direction.copy(t), this;\n }\n /**\n * Copies the values of the given ray to this instance.\n *\n * @param {Ray} ray - The ray to copy.\n * @return {Ray} A reference to this ray.\n */\n copy(e) {\n return this.origin.copy(e.origin), this.direction.copy(e.direction), this;\n }\n /**\n * Returns a vector that is located at a given distance along this ray.\n *\n * @param {number} t - The distance along the ray to retrieve a position for.\n * @param {Vector3} target - The target vector that is used to store the method's result.\n * @return {Vector3} A position on the ray.\n */\n at(e, t) {\n return t.copy(this.origin).addScaledVector(this.direction, e);\n }\n /**\n * Adjusts the direction of the ray to point at the given vector in world space.\n *\n * @param {Vector3} v - The target position.\n * @return {Ray} A reference to this ray.\n */\n lookAt(e) {\n return this.direction.copy(e).sub(this.origin).normalize(), this;\n }\n /**\n * Shift the origin of this ray along its direction by the given distance.\n *\n * @param {number} t - The distance along the ray to interpolate.\n * @return {Ray} A reference to this ray.\n */\n recast(e) {\n return this.origin.copy(this.at(e, Dn)), this;\n }\n /**\n * Returns the point along this ray that is closest to the given point.\n *\n * @param {Vector3} point - A point in 3D space to get the closet location on the ray for.\n * @param {Vector3} target - The target vector that is used to store the method's result.\n * @return {Vector3} The closest point on this ray.\n */\n closestPointToPoint(e, t) {\n t.subVectors(e, this.origin);\n const n = t.dot(this.direction);\n return n < 0 ? t.copy(this.origin) : t.copy(this.origin).addScaledVector(this.direction, n);\n }\n /**\n * Returns the distance of the closest approach between this ray and the given point.\n *\n * @param {Vector3} point - A point in 3D space to compute the distance to.\n * @return {number} The distance.\n */\n distanceToPoint(e) {\n return Math.sqrt(this.distanceSqToPoint(e));\n }\n /**\n * Returns the squared distance of the closest approach between this ray and the given point.\n *\n * @param {Vector3} point - A point in 3D space to compute the distance to.\n * @return {number} The squared distance.\n */\n distanceSqToPoint(e) {\n const t = Dn.subVectors(e, this.origin).dot(this.direction);\n return t < 0 ? this.origin.distanceToSquared(e) : (Dn.copy(this.origin).addScaledVector(this.direction, t), Dn.distanceToSquared(e));\n }\n /**\n * Returns the squared distance between this ray and the given line segment.\n *\n * @param {Vector3} v0 - The start point of the line segment.\n * @param {Vector3} v1 - The end point of the line segment.\n * @param {Vector3} [optionalPointOnRay] - When provided, it receives the point on this ray that is closest to the segment.\n * @param {Vector3} [optionalPointOnSegment] - When provided, it receives the point on the line segment that is closest to this ray.\n * @return {number} The squared distance.\n */\n distanceSqToSegment(e, t, n, s) {\n Hr.copy(e).add(t).multiplyScalar(0.5), Fs.copy(t).sub(e).normalize(), Wn.copy(this.origin).sub(Hr);\n const r = e.distanceTo(t) * 0.5, a = -this.direction.dot(Fs), o = Wn.dot(this.direction), l = -Wn.dot(Fs), c = Wn.lengthSq(), h = Math.abs(1 - a * a);\n let u, d, p, g;\n if (h > 0)\n if (u = a * l - o, d = a * o - l, g = r * h, u >= 0)\n if (d >= -g)\n if (d <= g) {\n const x = 1 / h;\n u *= x, d *= x, p = u * (u + a * d + 2 * o) + d * (a * u + d + 2 * l) + c;\n } else\n d = r, u = Math.max(0, -(a * d + o)), p = -u * u + d * (d + 2 * l) + c;\n else\n d = -r, u = Math.max(0, -(a * d + o)), p = -u * u + d * (d + 2 * l) + c;\n else\n d <= -g ? (u = Math.max(0, -(-a * r + o)), d = u > 0 ? -r : Math.min(Math.max(-r, -l), r), p = -u * u + d * (d + 2 * l) + c) : d <= g ? (u = 0, d = Math.min(Math.max(-r, -l), r), p = d * (d + 2 * l) + c) : (u = Math.max(0, -(a * r + o)), d = u > 0 ? r : Math.min(Math.max(-r, -l), r), p = -u * u + d * (d + 2 * l) + c);\n else\n d = a > 0 ? -r : r, u = Math.max(0, -(a * d + o)), p = -u * u + d * (d + 2 * l) + c;\n return n && n.copy(this.origin).addScaledVector(this.direction, u), s && s.copy(Hr).addScaledVector(Fs, d), p;\n }\n /**\n * Intersects this ray with the given sphere, returning the intersection\n * point or `null` if there is no intersection.\n *\n * @param {Sphere} sphere - The sphere to intersect.\n * @param {Vector3} target - The target vector that is used to store the method's result.\n * @return {?Vector3} The intersection point.\n */\n intersectSphere(e, t) {\n Dn.subVectors(e.center, this.origin);\n const n = Dn.dot(this.direction), s = Dn.dot(Dn) - n * n, r = e.radius * e.radius;\n if (s > r) return null;\n const a = Math.sqrt(r - s), o = n - a, l = n + a;\n return l < 0 ? null : o < 0 ? this.at(l, t) : this.at(o, t);\n }\n /**\n * Returns `true` if this ray intersects with the given sphere.\n *\n * @param {Sphere} sphere - The sphere to intersect.\n * @return {boolean} Whether this ray intersects with the given sphere or not.\n */\n intersectsSphere(e) {\n return e.radius < 0 ? !1 : this.distanceSqToPoint(e.center) <= e.radius * e.radius;\n }\n /**\n * Computes the distance from the ray's origin to the given plane. Returns `null` if the ray\n * does not intersect with the plane.\n *\n * @param {Plane} plane - The plane to compute the distance to.\n * @return {?number} Whether this ray intersects with the given sphere or not.\n */\n distanceToPlane(e) {\n const t = e.normal.dot(this.direction);\n if (t === 0)\n return e.distanceToPoint(this.origin) === 0 ? 0 : null;\n const n = -(this.origin.dot(e.normal) + e.constant) / t;\n return n >= 0 ? n : null;\n }\n /**\n * Intersects this ray with the given plane, returning the intersection\n * point or `null` if there is no intersection.\n *\n * @param {Plane} plane - The plane to intersect.\n * @param {Vector3} target - The target vector that is used to store the method's result.\n * @return {?Vector3} The intersection point.\n */\n intersectPlane(e, t) {\n const n = this.distanceToPlane(e);\n return n === null ? null : this.at(n, t);\n }\n /**\n * Returns `true` if this ray intersects with the given plane.\n *\n * @param {Plane} plane - The plane to intersect.\n * @return {boolean} Whether this ray intersects with the given plane or not.\n */\n intersectsPlane(e) {\n const t = e.distanceToPoint(this.origin);\n return t === 0 || e.normal.dot(this.direction) * t < 0;\n }\n /**\n * Intersects this ray with the given bounding box, returning the intersection\n * point or `null` if there is no intersection.\n *\n * @param {Box3} box - The box to intersect.\n * @param {Vector3} target - The target vector that is used to store the method's result.\n * @return {?Vector3} The intersection point.\n */\n intersectBox(e, t) {\n let n, s, r, a, o, l;\n const c = 1 / this.direction.x, h = 1 / this.direction.y, u = 1 / this.direction.z, d = this.origin;\n return c >= 0 ? (n = (e.min.x - d.x) * c, s = (e.max.x - d.x) * c) : (n = (e.max.x - d.x) * c, s = (e.min.x - d.x) * c), h >= 0 ? (r = (e.min.y - d.y) * h, a = (e.max.y - d.y) * h) : (r = (e.max.y - d.y) * h, a = (e.min.y - d.y) * h), n > a || r > s || ((r > n || isNaN(n)) && (n = r), (a < s || isNaN(s)) && (s = a), u >= 0 ? (o = (e.min.z - d.z) * u, l = (e.max.z - d.z) * u) : (o = (e.max.z - d.z) * u, l = (e.min.z - d.z) * u), n > l || o > s) || ((o > n || n !== n) && (n = o), (l < s || s !== s) && (s = l), s < 0) ? null : this.at(n >= 0 ? n : s, t);\n }\n /**\n * Returns `true` if this ray intersects with the given box.\n *\n * @param {Box3} box - The box to intersect.\n * @return {boolean} Whether this ray intersects with the given box or not.\n */\n intersectsBox(e) {\n return this.intersectBox(e, Dn) !== null;\n }\n /**\n * Intersects this ray with the given triangle, returning the intersection\n * point or `null` if there is no intersection.\n *\n * @param {Vector3} a - The first vertex of the triangle.\n * @param {Vector3} b - The second vertex of the triangle.\n * @param {Vector3} c - The third vertex of the triangle.\n * @param {boolean} backfaceCulling - Whether to use backface culling or not.\n * @param {Vector3} target - The target vector that is used to store the method's result.\n * @return {?Vector3} The intersection point.\n */\n intersectTriangle(e, t, n, s, r) {\n Wr.subVectors(t, e), Os.subVectors(n, e), Xr.crossVectors(Wr, Os);\n let a = this.direction.dot(Xr), o;\n if (a > 0) {\n if (s) return null;\n o = 1;\n } else if (a < 0)\n o = -1, a = -a;\n else\n return null;\n Wn.subVectors(this.origin, e);\n const l = o * this.direction.dot(Os.crossVectors(Wn, Os));\n if (l < 0)\n return null;\n const c = o * this.direction.dot(Wr.cross(Wn));\n if (c < 0 || l + c > a)\n return null;\n const h = -o * Wn.dot(Xr);\n return h < 0 ? null : this.at(h / a, r);\n }\n /**\n * Transforms this ray with the given 4x4 transformation matrix.\n *\n * @param {Matrix4} matrix4 - The transformation matrix.\n * @return {Ray} A reference to this ray.\n */\n applyMatrix4(e) {\n return this.origin.applyMatrix4(e), this.direction.transformDirection(e), this;\n }\n /**\n * Returns `true` if this ray is equal with the given one.\n *\n * @param {Ray} ray - The ray to test for equality.\n * @return {boolean} Whether this ray is equal with the given one.\n */\n equals(e) {\n return e.origin.equals(this.origin) && e.direction.equals(this.direction);\n }\n /**\n * Returns a new ray with copied values from this instance.\n *\n * @return {Ray} A clone of this instance.\n */\n clone() {\n return new this.constructor().copy(this);\n }\n}\nclass Ne {\n /**\n * Constructs a new 4x4 matrix. The arguments are supposed to be\n * in row-major order. If no arguments are provided, the constructor\n * initializes the matrix as an identity matrix.\n *\n * @param {number} [n11] - 1-1 matrix element.\n * @param {number} [n12] - 1-2 matrix element.\n * @param {number} [n13] - 1-3 matrix element.\n * @param {number} [n14] - 1-4 matrix element.\n * @param {number} [n21] - 2-1 matrix element.\n * @param {number} [n22] - 2-2 matrix element.\n * @param {number} [n23] - 2-3 matrix element.\n * @param {number} [n24] - 2-4 matrix element.\n * @param {number} [n31] - 3-1 matrix element.\n * @param {number} [n32] - 3-2 matrix element.\n * @param {number} [n33] - 3-3 matrix element.\n * @param {number} [n34] - 3-4 matrix element.\n * @param {number} [n41] - 4-1 matrix element.\n * @param {number} [n42] - 4-2 matrix element.\n * @param {number} [n43] - 4-3 matrix element.\n * @param {number} [n44] - 4-4 matrix element.\n */\n constructor(e, t, n, s, r, a, o, l, c, h, u, d, p, g, x, m) {\n Ne.prototype.isMatrix4 = !0, this.elements = [\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1\n ], e !== void 0 && this.set(e, t, n, s, r, a, o, l, c, h, u, d, p, g, x, m);\n }\n /**\n * Sets the elements of the matrix.The arguments are supposed to be\n * in row-major order.\n *\n * @param {number} [n11] - 1-1 matrix element.\n * @param {number} [n12] - 1-2 matrix element.\n * @param {number} [n13] - 1-3 matrix element.\n * @param {number} [n14] - 1-4 matrix element.\n * @param {number} [n21] - 2-1 matrix element.\n * @param {number} [n22] - 2-2 matrix element.\n * @param {number} [n23] - 2-3 matrix element.\n * @param {number} [n24] - 2-4 matrix element.\n * @param {number} [n31] - 3-1 matrix element.\n * @param {number} [n32] - 3-2 matrix element.\n * @param {number} [n33] - 3-3 matrix element.\n * @param {number} [n34] - 3-4 matrix element.\n * @param {number} [n41] - 4-1 matrix element.\n * @param {number} [n42] - 4-2 matrix element.\n * @param {number} [n43] - 4-3 matrix element.\n * @param {number} [n44] - 4-4 matrix element.\n * @return {Matrix4} A reference to this matrix.\n */\n set(e, t, n, s, r, a, o, l, c, h, u, d, p, g, x, m) {\n const f = this.elements;\n return f[0] = e, f[4] = t, f[8] = n, f[12] = s, f[1] = r, f[5] = a, f[9] = o, f[13] = l, f[2] = c, f[6] = h, f[10] = u, f[14] = d, f[3] = p, f[7] = g, f[11] = x, f[15] = m, this;\n }\n /**\n * Sets this matrix to the 4x4 identity matrix.\n *\n * @return {Matrix4} A reference to this matrix.\n */\n identity() {\n return this.set(\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1\n ), this;\n }\n /**\n * Returns a matrix with copied values from this instance.\n *\n * @return {Matrix4} A clone of this instance.\n */\n clone() {\n return new Ne().fromArray(this.elements);\n }\n /**\n * Copies the values of the given matrix to this instance.\n *\n * @param {Matrix4} m - The matrix to copy.\n * @return {Matrix4} A reference to this matrix.\n */\n copy(e) {\n const t = this.elements, n = e.elements;\n return t[0] = n[0], t[1] = n[1], t[2] = n[2], t[3] = n[3], t[4] = n[4], t[5] = n[5], t[6] = n[6], t[7] = n[7], t[8] = n[8], t[9] = n[9], t[10] = n[10], t[11] = n[11], t[12] = n[12], t[13] = n[13], t[14] = n[14], t[15] = n[15], this;\n }\n /**\n * Copies the translation component of the given matrix\n * into this matrix's translation component.\n *\n * @param {Matrix4} m - The matrix to copy the translation component.\n * @return {Matrix4} A reference to this matrix.\n */\n copyPosition(e) {\n const t = this.elements, n = e.elements;\n return t[12] = n[12], t[13] = n[13], t[14] = n[14], this;\n }\n /**\n * Set the upper 3x3 elements of this matrix to the values of given 3x3 matrix.\n *\n * @param {Matrix3} m - The 3x3 matrix.\n * @return {Matrix4} A reference to this matrix.\n */\n setFromMatrix3(e) {\n const t = e.elements;\n return this.set(\n t[0],\n t[3],\n t[6],\n 0,\n t[1],\n t[4],\n t[7],\n 0,\n t[2],\n t[5],\n t[8],\n 0,\n 0,\n 0,\n 0,\n 1\n ), this;\n }\n /**\n * Extracts the basis of this matrix into the three axis vectors provided.\n *\n * @param {Vector3} xAxis - The basis's x axis.\n * @param {Vector3} yAxis - The basis's y axis.\n * @param {Vector3} zAxis - The basis's z axis.\n * @return {Matrix4} A reference to this matrix.\n */\n extractBasis(e, t, n) {\n return e.setFromMatrixColumn(this, 0), t.setFromMatrixColumn(this, 1), n.setFromMatrixColumn(this, 2), this;\n }\n /**\n * Sets the given basis vectors to this matrix.\n *\n * @param {Vector3} xAxis - The basis's x axis.\n * @param {Vector3} yAxis - The basis's y axis.\n * @param {Vector3} zAxis - The basis's z axis.\n * @return {Matrix4} A reference to this matrix.\n */\n makeBasis(e, t, n) {\n return this.set(\n e.x,\n t.x,\n n.x,\n 0,\n e.y,\n t.y,\n n.y,\n 0,\n e.z,\n t.z,\n n.z,\n 0,\n 0,\n 0,\n 0,\n 1\n ), this;\n }\n /**\n * Extracts the rotation component of the given matrix\n * into this matrix's rotation component.\n *\n * Note: This method does not support reflection matrices.\n *\n * @param {Matrix4} m - The matrix.\n * @return {Matrix4} A reference to this matrix.\n */\n extractRotation(e) {\n const t = this.elements, n = e.elements, s = 1 / bi.setFromMatrixColumn(e, 0).length(), r = 1 / bi.setFromMatrixColumn(e, 1).length(), a = 1 / bi.setFromMatrixColumn(e, 2).length();\n return t[0] = n[0] * s, t[1] = n[1] * s, t[2] = n[2] * s, t[3] = 0, t[4] = n[4] * r, t[5] = n[5] * r, t[6] = n[6] * r, t[7] = 0, t[8] = n[8] * a, t[9] = n[9] * a, t[10] = n[10] * a, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, this;\n }\n /**\n * Sets the rotation component (the upper left 3x3 matrix) of this matrix to\n * the rotation specified by the given Euler angles. The rest of\n * the matrix is set to the identity. Depending on the {@link Euler#order},\n * there are six possible outcomes. See [this page](https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix)\n * for a complete list.\n *\n * @param {Euler} euler - The Euler angles.\n * @return {Matrix4} A reference to this matrix.\n */\n makeRotationFromEuler(e) {\n const t = this.elements, n = e.x, s = e.y, r = e.z, a = Math.cos(n), o = Math.sin(n), l = Math.cos(s), c = Math.sin(s), h = Math.cos(r), u = Math.sin(r);\n if (e.order === \"XYZ\") {\n const d = a * h, p = a * u, g = o * h, x = o * u;\n t[0] = l * h, t[4] = -l * u, t[8] = c, t[1] = p + g * c, t[5] = d - x * c, t[9] = -o * l, t[2] = x - d * c, t[6] = g + p * c, t[10] = a * l;\n } else if (e.order === \"YXZ\") {\n const d = l * h, p = l * u, g = c * h, x = c * u;\n t[0] = d + x * o, t[4] = g * o - p, t[8] = a * c, t[1] = a * u, t[5] = a * h, t[9] = -o, t[2] = p * o - g, t[6] = x + d * o, t[10] = a * l;\n } else if (e.order === \"ZXY\") {\n const d = l * h, p = l * u, g = c * h, x = c * u;\n t[0] = d - x * o, t[4] = -a * u, t[8] = g + p * o, t[1] = p + g * o, t[5] = a * h, t[9] = x - d * o, t[2] = -a * c, t[6] = o, t[10] = a * l;\n } else if (e.order === \"ZYX\") {\n const d = a * h, p = a * u, g = o * h, x = o * u;\n t[0] = l * h, t[4] = g * c - p, t[8] = d * c + x, t[1] = l * u, t[5] = x * c + d, t[9] = p * c - g, t[2] = -c, t[6] = o * l, t[10] = a * l;\n } else if (e.order === \"YZX\") {\n const d = a * l, p = a * c, g = o * l, x = o * c;\n t[0] = l * h, t[4] = x - d * u, t[8] = g * u + p, t[1] = u, t[5] = a * h, t[9] = -o * h, t[2] = -c * h, t[6] = p * u + g, t[10] = d - x * u;\n } else if (e.order === \"XZY\") {\n const d = a * l, p = a * c, g = o * l, x = o * c;\n t[0] = l * h, t[4] = -u, t[8] = c * h, t[1] = d * u + x, t[5] = a * h, t[9] = p * u - g, t[2] = g * u - p, t[6] = o * h, t[10] = x * u + d;\n }\n return t[3] = 0, t[7] = 0, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, this;\n }\n /**\n * Sets the rotation component of this matrix to the rotation specified by\n * the given Quaternion as outlined [here](https://en.wikipedia.org/wiki/Rotation_matrix#Quaternion)\n * The rest of the matrix is set to the identity.\n *\n * @param {Quaternion} q - The Quaternion.\n * @return {Matrix4} A reference to this matrix.\n */\n makeRotationFromQuaternion(e) {\n return this.compose(Ou, e, Bu);\n }\n /**\n * Sets the rotation component of the transformation matrix, looking from `eye` towards\n * `target`, and oriented by the up-direction.\n *\n * @param {Vector3} eye - The eye vector.\n * @param {Vector3} target - The target vector.\n * @param {Vector3} up - The up vector.\n * @return {Matrix4} A reference to this matrix.\n */\n lookAt(e, t, n) {\n const s = this.elements;\n return Yt.subVectors(e, t), Yt.lengthSq() === 0 && (Yt.z = 1), Yt.normalize(), Xn.crossVectors(n, Yt), Xn.lengthSq() === 0 && (Math.abs(n.z) === 1 ? Yt.x += 1e-4 : Yt.z += 1e-4, Yt.normalize(), Xn.crossVectors(n, Yt)), Xn.normalize(), Bs.crossVectors(Yt, Xn), s[0] = Xn.x, s[4] = Bs.x, s[8] = Yt.x, s[1] = Xn.y, s[5] = Bs.y, s[9] = Yt.y, s[2] = Xn.z, s[6] = Bs.z, s[10] = Yt.z, this;\n }\n /**\n * Post-multiplies this matrix by the given 4x4 matrix.\n *\n * @param {Matrix4} m - The matrix to multiply with.\n * @return {Matrix4} A reference to this matrix.\n */\n multiply(e) {\n return this.multiplyMatrices(this, e);\n }\n /**\n * Pre-multiplies this matrix by the given 4x4 matrix.\n *\n * @param {Matrix4} m - The matrix to multiply with.\n * @return {Matrix4} A reference to this matrix.\n */\n premultiply(e) {\n return this.multiplyMatrices(e, this);\n }\n /**\n * Multiples the given 4x4 matrices and stores the result\n * in this matrix.\n *\n * @param {Matrix4} a - The first matrix.\n * @param {Matrix4} b - The second matrix.\n * @return {Matrix4} A reference to this matrix.\n */\n multiplyMatrices(e, t) {\n const n = e.elements, s = t.elements, r = this.elements, a = n[0], o = n[4], l = n[8], c = n[12], h = n[1], u = n[5], d = n[9], p = n[13], g = n[2], x = n[6], m = n[10], f = n[14], y = n[3], v = n[7], T = n[11], R = n[15], E = s[0], P = s[4], I = s[8], S = s[12], M = s[1], C = s[5], U = s[9], B = s[13], z = s[2], W = s[6], k = s[10], ee = s[14], X = s[3], $ = s[7], Q = s[11], ge = s[15];\n return r[0] = a * E + o * M + l * z + c * X, r[4] = a * P + o * C + l * W + c * $, r[8] = a * I + o * U + l * k + c * Q, r[12] = a * S + o * B + l * ee + c * ge, r[1] = h * E + u * M + d * z + p * X, r[5] = h * P + u * C + d * W + p * $, r[9] = h * I + u * U + d * k + p * Q, r[13] = h * S + u * B + d * ee + p * ge, r[2] = g * E + x * M + m * z + f * X, r[6] = g * P + x * C + m * W + f * $, r[10] = g * I + x * U + m * k + f * Q, r[14] = g * S + x * B + m * ee + f * ge, r[3] = y * E + v * M + T * z + R * X, r[7] = y * P + v * C + T * W + R * $, r[11] = y * I + v * U + T * k + R * Q, r[15] = y * S + v * B + T * ee + R * ge, this;\n }\n /**\n * Multiplies every component of the matrix by the given scalar.\n *\n * @param {number} s - The scalar.\n * @return {Matrix4} A reference to this matrix.\n */\n multiplyScalar(e) {\n const t = this.elements;\n return t[0] *= e, t[4] *= e, t[8] *= e, t[12] *= e, t[1] *= e, t[5] *= e, t[9] *= e, t[13] *= e, t[2] *= e, t[6] *= e, t[10] *= e, t[14] *= e, t[3] *= e, t[7] *= e, t[11] *= e, t[15] *= e, this;\n }\n /**\n * Computes and returns the determinant of this matrix.\n *\n * Based on the method outlined [here](http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.html).\n *\n * @return {number} The determinant.\n */\n determinant() {\n const e = this.elements, t = e[0], n = e[4], s = e[8], r = e[12], a = e[1], o = e[5], l = e[9], c = e[13], h = e[2], u = e[6], d = e[10], p = e[14], g = e[3], x = e[7], m = e[11], f = e[15];\n return g * (+r * l * u - s * c * u - r * o * d + n * c * d + s * o * p - n * l * p) + x * (+t * l * p - t * c * d + r * a * d - s * a * p + s * c * h - r * l * h) + m * (+t * c * u - t * o * p - r * a * u + n * a * p + r * o * h - n * c * h) + f * (-s * o * h - t * l * u + t * o * d + s * a * u - n * a * d + n * l * h);\n }\n /**\n * Transposes this matrix in place.\n *\n * @return {Matrix4} A reference to this matrix.\n */\n transpose() {\n const e = this.elements;\n let t;\n return t = e[1], e[1] = e[4], e[4] = t, t = e[2], e[2] = e[8], e[8] = t, t = e[6], e[6] = e[9], e[9] = t, t = e[3], e[3] = e[12], e[12] = t, t = e[7], e[7] = e[13], e[13] = t, t = e[11], e[11] = e[14], e[14] = t, this;\n }\n /**\n * Sets the position component for this matrix from the given vector,\n * without affecting the rest of the matrix.\n *\n * @param {number|Vector3} x - The x component of the vector or alternatively the vector object.\n * @param {number} y - The y component of the vector.\n * @param {number} z - The z component of the vector.\n * @return {Matrix4} A reference to this matrix.\n */\n setPosition(e, t, n) {\n const s = this.elements;\n return e.isVector3 ? (s[12] = e.x, s[13] = e.y, s[14] = e.z) : (s[12] = e, s[13] = t, s[14] = n), this;\n }\n /**\n * Inverts this matrix, using the [analytic method](https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution).\n * You can not invert with a determinant of zero. If you attempt this, the method produces\n * a zero matrix instead.\n *\n * @return {Matrix4} A reference to this matrix.\n */\n invert() {\n const e = this.elements, t = e[0], n = e[1], s = e[2], r = e[3], a = e[4], o = e[5], l = e[6], c = e[7], h = e[8], u = e[9], d = e[10], p = e[11], g = e[12], x = e[13], m = e[14], f = e[15], y = u * m * c - x * d * c + x * l * p - o * m * p - u * l * f + o * d * f, v = g * d * c - h * m * c - g * l * p + a * m * p + h * l * f - a * d * f, T = h * x * c - g * u * c + g * o * p - a * x * p - h * o * f + a * u * f, R = g * u * l - h * x * l - g * o * d + a * x * d + h * o * m - a * u * m, E = t * y + n * v + s * T + r * R;\n if (E === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n const P = 1 / E;\n return e[0] = y * P, e[1] = (x * d * r - u * m * r - x * s * p + n * m * p + u * s * f - n * d * f) * P, e[2] = (o * m * r - x * l * r + x * s * c - n * m * c - o * s * f + n * l * f) * P, e[3] = (u * l * r - o * d * r - u * s * c + n * d * c + o * s * p - n * l * p) * P, e[4] = v * P, e[5] = (h * m * r - g * d * r + g * s * p - t * m * p - h * s * f + t * d * f) * P, e[6] = (g * l * r - a * m * r - g * s * c + t * m * c + a * s * f - t * l * f) * P, e[7] = (a * d * r - h * l * r + h * s * c - t * d * c - a * s * p + t * l * p) * P, e[8] = T * P, e[9] = (g * u * r - h * x * r - g * n * p + t * x * p + h * n * f - t * u * f) * P, e[10] = (a * x * r - g * o * r + g * n * c - t * x * c - a * n * f + t * o * f) * P, e[11] = (h * o * r - a * u * r - h * n * c + t * u * c + a * n * p - t * o * p) * P, e[12] = R * P, e[13] = (h * x * s - g * u * s + g * n * d - t * x * d - h * n * m + t * u * m) * P, e[14] = (g * o * s - a * x * s - g * n * l + t * x * l + a * n * m - t * o * m) * P, e[15] = (a * u * s - h * o * s + h * n * l - t * u * l - a * n * d + t * o * d) * P, this;\n }\n /**\n * Multiplies the columns of this matrix by the given vector.\n *\n * @param {Vector3} v - The scale vector.\n * @return {Matrix4} A reference to this matrix.\n */\n scale(e) {\n const t = this.elements, n = e.x, s = e.y, r = e.z;\n return t[0] *= n, t[4] *= s, t[8] *= r, t[1] *= n, t[5] *= s, t[9] *= r, t[2] *= n, t[6] *= s, t[10] *= r, t[3] *= n, t[7] *= s, t[11] *= r, this;\n }\n /**\n * Gets the maximum scale value of the three axes.\n *\n * @return {number} The maximum scale.\n */\n getMaxScaleOnAxis() {\n const e = this.elements, t = e[0] * e[0] + e[1] * e[1] + e[2] * e[2], n = e[4] * e[4] + e[5] * e[5] + e[6] * e[6], s = e[8] * e[8] + e[9] * e[9] + e[10] * e[10];\n return Math.sqrt(Math.max(t, n, s));\n }\n /**\n * Sets this matrix as a translation transform from the given vector.\n *\n * @param {number|Vector3} x - The amount to translate in the X axis or alternatively a translation vector.\n * @param {number} y - The amount to translate in the Y axis.\n * @param {number} z - The amount to translate in the z axis.\n * @return {Matrix4} A reference to this matrix.\n */\n makeTranslation(e, t, n) {\n return e.isVector3 ? this.set(\n 1,\n 0,\n 0,\n e.x,\n 0,\n 1,\n 0,\n e.y,\n 0,\n 0,\n 1,\n e.z,\n 0,\n 0,\n 0,\n 1\n ) : this.set(\n 1,\n 0,\n 0,\n e,\n 0,\n 1,\n 0,\n t,\n 0,\n 0,\n 1,\n n,\n 0,\n 0,\n 0,\n 1\n ), this;\n }\n /**\n * Sets this matrix as a rotational transformation around the X axis by\n * the given angle.\n *\n * @param {number} theta - The rotation in radians.\n * @return {Matrix4} A reference to this matrix.\n */\n makeRotationX(e) {\n const t = Math.cos(e), n = Math.sin(e);\n return this.set(\n 1,\n 0,\n 0,\n 0,\n 0,\n t,\n -n,\n 0,\n 0,\n n,\n t,\n 0,\n 0,\n 0,\n 0,\n 1\n ), this;\n }\n /**\n * Sets this matrix as a rotational transformation around the Y axis by\n * the given angle.\n *\n * @param {number} theta - The rotation in radians.\n * @return {Matrix4} A reference to this matrix.\n */\n makeRotationY(e) {\n const t = Math.cos(e), n = Math.sin(e);\n return this.set(\n t,\n 0,\n n,\n 0,\n 0,\n 1,\n 0,\n 0,\n -n,\n 0,\n t,\n 0,\n 0,\n 0,\n 0,\n 1\n ), this;\n }\n /**\n * Sets this matrix as a rotational transformation around the Z axis by\n * the given angle.\n *\n * @param {number} theta - The rotation in radians.\n * @return {Matrix4} A reference to this matrix.\n */\n makeRotationZ(e) {\n const t = Math.cos(e), n = Math.sin(e);\n return this.set(\n t,\n -n,\n 0,\n 0,\n n,\n t,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1\n ), this;\n }\n /**\n * Sets this matrix as a rotational transformation around the given axis by\n * the given angle.\n *\n * This is a somewhat controversial but mathematically sound alternative to\n * rotating via Quaternions. See the discussion [here](https://www.gamedev.net/articles/programming/math-and-physics/do-we-really-need-quaternions-r1199).\n *\n * @param {Vector3} axis - The normalized rotation axis.\n * @param {number} angle - The rotation in radians.\n * @return {Matrix4} A reference to this matrix.\n */\n makeRotationAxis(e, t) {\n const n = Math.cos(t), s = Math.sin(t), r = 1 - n, a = e.x, o = e.y, l = e.z, c = r * a, h = r * o;\n return this.set(\n c * a + n,\n c * o - s * l,\n c * l + s * o,\n 0,\n c * o + s * l,\n h * o + n,\n h * l - s * a,\n 0,\n c * l - s * o,\n h * l + s * a,\n r * l * l + n,\n 0,\n 0,\n 0,\n 0,\n 1\n ), this;\n }\n /**\n * Sets this matrix as a scale transformation.\n *\n * @param {number} x - The amount to scale in the X axis.\n * @param {number} y - The amount to scale in the Y axis.\n * @param {number} z - The amount to scale in the Z axis.\n * @return {Matrix4} A reference to this matrix.\n */\n makeScale(e, t, n) {\n return this.set(\n e,\n 0,\n 0,\n 0,\n 0,\n t,\n 0,\n 0,\n 0,\n 0,\n n,\n 0,\n 0,\n 0,\n 0,\n 1\n ), this;\n }\n /**\n * Sets this matrix as a shear transformation.\n *\n * @param {number} xy - The amount to shear X by Y.\n * @param {number} xz - The amount to shear X by Z.\n * @param {number} yx - The amount to shear Y by X.\n * @param {number} yz - The amount to shear Y by Z.\n * @param {number} zx - The amount to shear Z by X.\n * @param {number} zy - The amount to shear Z by Y.\n * @return {Matrix4} A reference to this matrix.\n */\n makeShear(e, t, n, s, r, a) {\n return this.set(\n 1,\n n,\n r,\n 0,\n e,\n 1,\n a,\n 0,\n t,\n s,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1\n ), this;\n }\n /**\n * Sets this matrix to the transformation composed of the given position,\n * rotation (Quaternion) and scale.\n *\n * @param {Vector3} position - The position vector.\n * @param {Quaternion} quaternion - The rotation as a Quaternion.\n * @param {Vector3} scale - The scale vector.\n * @return {Matrix4} A reference to this matrix.\n */\n compose(e, t, n) {\n const s = this.elements, r = t._x, a = t._y, o = t._z, l = t._w, c = r + r, h = a + a, u = o + o, d = r * c, p = r * h, g = r * u, x = a * h, m = a * u, f = o * u, y = l * c, v = l * h, T = l * u, R = n.x, E = n.y, P = n.z;\n return s[0] = (1 - (x + f)) * R, s[1] = (p + T) * R, s[2] = (g - v) * R, s[3] = 0, s[4] = (p - T) * E, s[5] = (1 - (d + f)) * E, s[6] = (m + y) * E, s[7] = 0, s[8] = (g + v) * P, s[9] = (m - y) * P, s[10] = (1 - (d + x)) * P, s[11] = 0, s[12] = e.x, s[13] = e.y, s[14] = e.z, s[15] = 1, this;\n }\n /**\n * Decomposes this matrix into its position, rotation and scale components\n * and provides the result in the given objects.\n *\n * Note: Not all matrices are decomposable in this way. For example, if an\n * object has a non-uniformly scaled parent, then the object's world matrix\n * may not be decomposable, and this method may not be appropriate.\n *\n * @param {Vector3} position - The position vector.\n * @param {Quaternion} quaternion - The rotation as a Quaternion.\n * @param {Vector3} scale - The scale vector.\n * @return {Matrix4} A reference to this matrix.\n */\n decompose(e, t, n) {\n const s = this.elements;\n let r = bi.set(s[0], s[1], s[2]).length();\n const a = bi.set(s[4], s[5], s[6]).length(), o = bi.set(s[8], s[9], s[10]).length();\n this.determinant() < 0 && (r = -r), e.x = s[12], e.y = s[13], e.z = s[14], an.copy(this);\n const c = 1 / r, h = 1 / a, u = 1 / o;\n return an.elements[0] *= c, an.elements[1] *= c, an.elements[2] *= c, an.elements[4] *= h, an.elements[5] *= h, an.elements[6] *= h, an.elements[8] *= u, an.elements[9] *= u, an.elements[10] *= u, t.setFromRotationMatrix(an), n.x = r, n.y = a, n.z = o, this;\n }\n /**\n \t * Creates a perspective projection matrix. This is used internally by\n \t * {@link PerspectiveCamera#updateProjectionMatrix}.\n \n \t * @param {number} left - Left boundary of the viewing frustum at the near plane.\n \t * @param {number} right - Right boundary of the viewing frustum at the near plane.\n \t * @param {number} top - Top boundary of the viewing frustum at the near plane.\n \t * @param {number} bottom - Bottom boundary of the viewing frustum at the near plane.\n \t * @param {number} near - The distance from the camera to the near plane.\n \t * @param {number} far - The distance from the camera to the far plane.\n \t * @param {(WebGLCoordinateSystem|WebGPUCoordinateSystem)} [coordinateSystem=WebGLCoordinateSystem] - The coordinate system.\n \t * @param {boolean} [reversedDepth=false] - Whether to use a reversed depth.\n \t * @return {Matrix4} A reference to this matrix.\n \t */\n makePerspective(e, t, n, s, r, a, o = Tn, l = !1) {\n const c = this.elements, h = 2 * r / (t - e), u = 2 * r / (n - s), d = (t + e) / (t - e), p = (n + s) / (n - s);\n let g, x;\n if (l)\n g = r / (a - r), x = a * r / (a - r);\n else if (o === Tn)\n g = -(a + r) / (a - r), x = -2 * a * r / (a - r);\n else if (o === br)\n g = -a / (a - r), x = -a * r / (a - r);\n else\n throw new Error(\"THREE.Matrix4.makePerspective(): Invalid coordinate system: \" + o);\n return c[0] = h, c[4] = 0, c[8] = d, c[12] = 0, c[1] = 0, c[5] = u, c[9] = p, c[13] = 0, c[2] = 0, c[6] = 0, c[10] = g, c[14] = x, c[3] = 0, c[7] = 0, c[11] = -1, c[15] = 0, this;\n }\n /**\n \t * Creates a orthographic projection matrix. This is used internally by\n \t * {@link OrthographicCamera#updateProjectionMatrix}.\n \n \t * @param {number} left - Left boundary of the viewing frustum at the near plane.\n \t * @param {number} right - Right boundary of the viewing frustum at the near plane.\n \t * @param {number} top - Top boundary of the viewing frustum at the near plane.\n \t * @param {number} bottom - Bottom boundary of the viewing frustum at the near plane.\n \t * @param {number} near - The distance from the camera to the near plane.\n \t * @param {number} far - The distance from the camera to the far plane.\n \t * @param {(WebGLCoordinateSystem|WebGPUCoordinateSystem)} [coordinateSystem=WebGLCoordinateSystem] - The coordinate system.\n \t * @param {boolean} [reversedDepth=false] - Whether to use a reversed depth.\n \t * @return {Matrix4} A reference to this matrix.\n \t */\n makeOrthographic(e, t, n, s, r, a, o = Tn, l = !1) {\n const c = this.elements, h = 2 / (t - e), u = 2 / (n - s), d = -(t + e) / (t - e), p = -(n + s) / (n - s);\n let g, x;\n if (l)\n g = 1 / (a - r), x = a / (a - r);\n else if (o === Tn)\n g = -2 / (a - r), x = -(a + r) / (a - r);\n else if (o === br)\n g = -1 / (a - r), x = -r / (a - r);\n else\n throw new Error(\"THREE.Matrix4.makeOrthographic(): Invalid coordinate system: \" + o);\n return c[0] = h, c[4] = 0, c[8] = 0, c[12] = d, c[1] = 0, c[5] = u, c[9] = 0, c[13] = p, c[2] = 0, c[6] = 0, c[10] = g, c[14] = x, c[3] = 0, c[7] = 0, c[11] = 0, c[15] = 1, this;\n }\n /**\n * Returns `true` if this matrix is equal with the given one.\n *\n * @param {Matrix4} matrix - The matrix to test for equality.\n * @return {boolean} Whether this matrix is equal with the given one.\n */\n equals(e) {\n const t = this.elements, n = e.elements;\n for (let s = 0; s < 16; s++)\n if (t[s] !== n[s]) return !1;\n return !0;\n }\n /**\n * Sets the elements of the matrix from the given array.\n *\n * @param {Array} array - The matrix elements in column-major order.\n * @param {number} [offset=0] - Index of the first element in the array.\n * @return {Matrix4} A reference to this matrix.\n */\n fromArray(e, t = 0) {\n for (let n = 0; n < 16; n++)\n this.elements[n] = e[n + t];\n return this;\n }\n /**\n * Writes the elements of this matrix to the given array. If no array is provided,\n * the method returns a new instance.\n *\n * @param {Array} [array=[]] - The target array holding the matrix elements in column-major order.\n * @param {number} [offset=0] - Index of the first element in the array.\n * @return {Array} The matrix elements in column-major order.\n */\n toArray(e = [], t = 0) {\n const n = this.elements;\n return e[t] = n[0], e[t + 1] = n[1], e[t + 2] = n[2], e[t + 3] = n[3], e[t + 4] = n[4], e[t + 5] = n[5], e[t + 6] = n[6], e[t + 7] = n[7], e[t + 8] = n[8], e[t + 9] = n[9], e[t + 10] = n[10], e[t + 11] = n[11], e[t + 12] = n[12], e[t + 13] = n[13], e[t + 14] = n[14], e[t + 15] = n[15], e;\n }\n}\nconst bi = /* @__PURE__ */ new w(), an = /* @__PURE__ */ new Ne(), Ou = /* @__PURE__ */ new w(0, 0, 0), Bu = /* @__PURE__ */ new w(1, 1, 1), Xn = /* @__PURE__ */ new w(), Bs = /* @__PURE__ */ new w(), Yt = /* @__PURE__ */ new w(), pl = /* @__PURE__ */ new Ne(), ml = /* @__PURE__ */ new gn();\nclass xn {\n /**\n * Constructs a new euler instance.\n *\n * @param {number} [x=0] - The angle of the x axis in radians.\n * @param {number} [y=0] - The angle of the y axis in radians.\n * @param {number} [z=0] - The angle of the z axis in radians.\n * @param {string} [order=Euler.DEFAULT_ORDER] - A string representing the order that the rotations are applied.\n */\n constructor(e = 0, t = 0, n = 0, s = xn.DEFAULT_ORDER) {\n this.isEuler = !0, this._x = e, this._y = t, this._z = n, this._order = s;\n }\n /**\n * The angle of the x axis in radians.\n *\n * @type {number}\n * @default 0\n */\n get x() {\n return this._x;\n }\n set x(e) {\n this._x = e, this._onChangeCallback();\n }\n /**\n * The angle of the y axis in radians.\n *\n * @type {number}\n * @default 0\n */\n get y() {\n return this._y;\n }\n set y(e) {\n this._y = e, this._onChangeCallback();\n }\n /**\n * The angle of the z axis in radians.\n *\n * @type {number}\n * @default 0\n */\n get z() {\n return this._z;\n }\n set z(e) {\n this._z = e, this._onChangeCallback();\n }\n /**\n * A string representing the order that the rotations are applied.\n *\n * @type {string}\n * @default 'XYZ'\n */\n get order() {\n return this._order;\n }\n set order(e) {\n this._order = e, this._onChangeCallback();\n }\n /**\n * Sets the Euler components.\n *\n * @param {number} x - The angle of the x axis in radians.\n * @param {number} y - The angle of the y axis in radians.\n * @param {number} z - The angle of the z axis in radians.\n * @param {string} [order] - A string representing the order that the rotations are applied.\n * @return {Euler} A reference to this Euler instance.\n */\n set(e, t, n, s = this._order) {\n return this._x = e, this._y = t, this._z = n, this._order = s, this._onChangeCallback(), this;\n }\n /**\n * Returns a new Euler instance with copied values from this instance.\n *\n * @return {Euler} A clone of this instance.\n */\n clone() {\n return new this.constructor(this._x, this._y, this._z, this._order);\n }\n /**\n * Copies the values of the given Euler instance to this instance.\n *\n * @param {Euler} euler - The Euler instance to copy.\n * @return {Euler} A reference to this Euler instance.\n */\n copy(e) {\n return this._x = e._x, this._y = e._y, this._z = e._z, this._order = e._order, this._onChangeCallback(), this;\n }\n /**\n * Sets the angles of this Euler instance from a pure rotation matrix.\n *\n * @param {Matrix4} m - A 4x4 matrix of which the upper 3x3 of matrix is a pure rotation matrix (i.e. unscaled).\n * @param {string} [order] - A string representing the order that the rotations are applied.\n * @param {boolean} [update=true] - Whether the internal `onChange` callback should be executed or not.\n * @return {Euler} A reference to this Euler instance.\n */\n setFromRotationMatrix(e, t = this._order, n = !0) {\n const s = e.elements, r = s[0], a = s[4], o = s[8], l = s[1], c = s[5], h = s[9], u = s[2], d = s[6], p = s[10];\n switch (t) {\n case \"XYZ\":\n this._y = Math.asin(He(o, -1, 1)), Math.abs(o) < 0.9999999 ? (this._x = Math.atan2(-h, p), this._z = Math.atan2(-a, r)) : (this._x = Math.atan2(d, c), this._z = 0);\n break;\n case \"YXZ\":\n this._x = Math.asin(-He(h, -1, 1)), Math.abs(h) < 0.9999999 ? (this._y = Math.atan2(o, p), this._z = Math.atan2(l, c)) : (this._y = Math.atan2(-u, r), this._z = 0);\n break;\n case \"ZXY\":\n this._x = Math.asin(He(d, -1, 1)), Math.abs(d) < 0.9999999 ? (this._y = Math.atan2(-u, p), this._z = Math.atan2(-a, c)) : (this._y = 0, this._z = Math.atan2(l, r));\n break;\n case \"ZYX\":\n this._y = Math.asin(-He(u, -1, 1)), Math.abs(u) < 0.9999999 ? (this._x = Math.atan2(d, p), this._z = Math.atan2(l, r)) : (this._x = 0, this._z = Math.atan2(-a, c));\n break;\n case \"YZX\":\n this._z = Math.asin(He(l, -1, 1)), Math.abs(l) < 0.9999999 ? (this._x = Math.atan2(-h, c), this._y = Math.atan2(-u, r)) : (this._x = 0, this._y = Math.atan2(o, p));\n break;\n case \"XZY\":\n this._z = Math.asin(-He(a, -1, 1)), Math.abs(a) < 0.9999999 ? (this._x = Math.atan2(d, c), this._y = Math.atan2(o, r)) : (this._x = Math.atan2(-h, p), this._y = 0);\n break;\n default:\n Te(\"Euler: .setFromRotationMatrix() encountered an unknown order: \" + t);\n }\n return this._order = t, n === !0 && this._onChangeCallback(), this;\n }\n /**\n * Sets the angles of this Euler instance from a normalized quaternion.\n *\n * @param {Quaternion} q - A normalized Quaternion.\n * @param {string} [order] - A string representing the order that the rotations are applied.\n * @param {boolean} [update=true] - Whether the internal `onChange` callback should be executed or not.\n * @return {Euler} A reference to this Euler instance.\n */\n setFromQuaternion(e, t, n) {\n return pl.makeRotationFromQuaternion(e), this.setFromRotationMatrix(pl, t, n);\n }\n /**\n * Sets the angles of this Euler instance from the given vector.\n *\n * @param {Vector3} v - The vector.\n * @param {string} [order] - A string representing the order that the rotations are applied.\n * @return {Euler} A reference to this Euler instance.\n */\n setFromVector3(e, t = this._order) {\n return this.set(e.x, e.y, e.z, t);\n }\n /**\n * Resets the euler angle with a new order by creating a quaternion from this\n * euler angle and then setting this euler angle with the quaternion and the\n * new order.\n *\n * Warning: This discards revolution information.\n *\n * @param {string} [newOrder] - A string representing the new order that the rotations are applied.\n * @return {Euler} A reference to this Euler instance.\n */\n reorder(e) {\n return ml.setFromEuler(this), this.setFromQuaternion(ml, e);\n }\n /**\n * Returns `true` if this Euler instance is equal with the given one.\n *\n * @param {Euler} euler - The Euler instance to test for equality.\n * @return {boolean} Whether this Euler instance is equal with the given one.\n */\n equals(e) {\n return e._x === this._x && e._y === this._y && e._z === this._z && e._order === this._order;\n }\n /**\n * Sets this Euler instance's components to values from the given array. The first three\n * entries of the array are assign to the x,y and z components. An optional fourth entry\n * defines the Euler order.\n *\n * @param {Array} array - An array holding the Euler component values.\n * @return {Euler} A reference to this Euler instance.\n */\n fromArray(e) {\n return this._x = e[0], this._y = e[1], this._z = e[2], e[3] !== void 0 && (this._order = e[3]), this._onChangeCallback(), this;\n }\n /**\n * Writes the components of this Euler instance to the given array. If no array is provided,\n * the method returns a new instance.\n *\n * @param {Array} [array=[]] - The target array holding the Euler components.\n * @param {number} [offset=0] - Index of the first element in the array.\n * @return {Array} The Euler components.\n */\n toArray(e = [], t = 0) {\n return e[t] = this._x, e[t + 1] = this._y, e[t + 2] = this._z, e[t + 3] = this._order, e;\n }\n _onChange(e) {\n return this._onChangeCallback = e, this;\n }\n _onChangeCallback() {\n }\n *[Symbol.iterator]() {\n yield this._x, yield this._y, yield this._z, yield this._order;\n }\n}\nxn.DEFAULT_ORDER = \"XYZ\";\nclass Uo {\n /**\n * Constructs a new layers instance, with membership\n * initially set to layer `0`.\n */\n constructor() {\n this.mask = 1;\n }\n /**\n * Sets membership to the given layer, and remove membership all other layers.\n *\n * @param {number} layer - The layer to set.\n */\n set(e) {\n this.mask = (1 << e | 0) >>> 0;\n }\n /**\n * Adds membership of the given layer.\n *\n * @param {number} layer - The layer to enable.\n */\n enable(e) {\n this.mask |= 1 << e | 0;\n }\n /**\n * Adds membership to all layers.\n */\n enableAll() {\n this.mask = -1;\n }\n /**\n * Toggles the membership of the given layer.\n *\n * @param {number} layer - The layer to toggle.\n */\n toggle(e) {\n this.mask ^= 1 << e | 0;\n }\n /**\n * Removes membership of the given layer.\n *\n * @param {number} layer - The layer to enable.\n */\n disable(e) {\n this.mask &= ~(1 << e | 0);\n }\n /**\n * Removes the membership from all layers.\n */\n disableAll() {\n this.mask = 0;\n }\n /**\n * Returns `true` if this and the given layers object have at least one\n * layer in common.\n *\n * @param {Layers} layers - The layers to test.\n * @return {boolean } Whether this and the given layers object have at least one layer in common or not.\n */\n test(e) {\n return (this.mask & e.mask) !== 0;\n }\n /**\n * Returns `true` if the given layer is enabled.\n *\n * @param {number} layer - The layer to test.\n * @return {boolean } Whether the given layer is enabled or not.\n */\n isEnabled(e) {\n return (this.mask & (1 << e | 0)) !== 0;\n }\n}\nlet zu = 0;\nconst gl = /* @__PURE__ */ new w(), yi = /* @__PURE__ */ new gn(), Ln = /* @__PURE__ */ new Ne(), zs = /* @__PURE__ */ new w(), as = /* @__PURE__ */ new w(), ku = /* @__PURE__ */ new w(), Vu = /* @__PURE__ */ new gn(), xl = /* @__PURE__ */ new w(1, 0, 0), _l = /* @__PURE__ */ new w(0, 1, 0), vl = /* @__PURE__ */ new w(0, 0, 1), Ml = { type: \"added\" }, Gu = { type: \"removed\" }, Ti = { type: \"childadded\", child: null }, jr = { type: \"childremoved\", child: null };\nclass pt extends mi {\n /**\n * Constructs a new 3D object.\n */\n constructor() {\n super(), this.isObject3D = !0, Object.defineProperty(this, \"id\", { value: zu++ }), this.uuid = fn(), this.name = \"\", this.type = \"Object3D\", this.parent = null, this.children = [], this.up = pt.DEFAULT_UP.clone();\n const e = new w(), t = new xn(), n = new gn(), s = new w(1, 1, 1);\n function r() {\n n.setFromEuler(t, !1);\n }\n function a() {\n t.setFromQuaternion(n, void 0, !1);\n }\n t._onChange(r), n._onChange(a), Object.defineProperties(this, {\n /**\n * Represents the object's local position.\n *\n * @name Object3D#position\n * @type {Vector3}\n * @default (0,0,0)\n */\n position: {\n configurable: !0,\n enumerable: !0,\n value: e\n },\n /**\n * Represents the object's local rotation as Euler angles, in radians.\n *\n * @name Object3D#rotation\n * @type {Euler}\n * @default (0,0,0)\n */\n rotation: {\n configurable: !0,\n enumerable: !0,\n value: t\n },\n /**\n * Represents the object's local rotation as Quaternions.\n *\n * @name Object3D#quaternion\n * @type {Quaternion}\n */\n quaternion: {\n configurable: !0,\n enumerable: !0,\n value: n\n },\n /**\n * Represents the object's local scale.\n *\n * @name Object3D#scale\n * @type {Vector3}\n * @default (1,1,1)\n */\n scale: {\n configurable: !0,\n enumerable: !0,\n value: s\n },\n /**\n * Represents the object's model-view matrix.\n *\n * @name Object3D#modelViewMatrix\n * @type {Matrix4}\n */\n modelViewMatrix: {\n value: new Ne()\n },\n /**\n * Represents the object's normal matrix.\n *\n * @name Object3D#normalMatrix\n * @type {Matrix3}\n */\n normalMatrix: {\n value: new ze()\n }\n }), this.matrix = new Ne(), this.matrixWorld = new Ne(), this.matrixAutoUpdate = pt.DEFAULT_MATRIX_AUTO_UPDATE, this.matrixWorldAutoUpdate = pt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE, this.matrixWorldNeedsUpdate = !1, this.layers = new Uo(), this.visible = !0, this.castShadow = !1, this.receiveShadow = !1, this.frustumCulled = !0, this.renderOrder = 0, this.animations = [], this.customDepthMaterial = void 0, this.customDistanceMaterial = void 0, this.userData = {};\n }\n /**\n * A callback that is executed immediately before a 3D object is rendered to a shadow map.\n *\n * @param {Renderer|WebGLRenderer} renderer - The renderer.\n * @param {Object3D} object - The 3D object.\n * @param {Camera} camera - The camera that is used to render the scene.\n * @param {Camera} shadowCamera - The shadow camera.\n * @param {BufferGeometry} geometry - The 3D object's geometry.\n * @param {Material} depthMaterial - The depth material.\n * @param {Object} group - The geometry group data.\n */\n onBeforeShadow() {\n }\n /**\n * A callback that is executed immediately after a 3D object is rendered to a shadow map.\n *\n * @param {Renderer|WebGLRenderer} renderer - The renderer.\n * @param {Object3D} object - The 3D object.\n * @param {Camera} camera - The camera that is used to render the scene.\n * @param {Camera} shadowCamera - The shadow camera.\n * @param {BufferGeometry} geometry - The 3D object's geometry.\n * @param {Material} depthMaterial - The depth material.\n * @param {Object} group - The geometry group data.\n */\n onAfterShadow() {\n }\n /**\n * A callback that is executed immediately before a 3D object is rendered.\n *\n * @param {Renderer|WebGLRenderer} renderer - The renderer.\n * @param {Object3D} object - The 3D object.\n * @param {Camera} camera - The camera that is used to render the scene.\n * @param {BufferGeometry} geometry - The 3D object's geometry.\n * @param {Material} material - The 3D object's material.\n * @param {Object} group - The geometry group data.\n */\n onBeforeRender() {\n }\n /**\n * A callback that is executed immediately after a 3D object is rendered.\n *\n * @param {Renderer|WebGLRenderer} renderer - The renderer.\n * @param {Object3D} object - The 3D object.\n * @param {Camera} camera - The camera that is used to render the scene.\n * @param {BufferGeometry} geometry - The 3D object's geometry.\n * @param {Material} material - The 3D object's material.\n * @param {Object} group - The geometry group data.\n */\n onAfterRender() {\n }\n /**\n * Applies the given transformation matrix to the object and updates the object's position,\n * rotation and scale.\n *\n * @param {Matrix4} matrix - The transformation matrix.\n */\n applyMatrix4(e) {\n this.matrixAutoUpdate && this.updateMatrix(), this.matrix.premultiply(e), this.matrix.decompose(this.position, this.quaternion, this.scale);\n }\n /**\n * Applies a rotation represented by given the quaternion to the 3D object.\n *\n * @param {Quaternion} q - The quaternion.\n * @return {Object3D} A reference to this instance.\n */\n applyQuaternion(e) {\n return this.quaternion.premultiply(e), this;\n }\n /**\n * Sets the given rotation represented as an axis/angle couple to the 3D object.\n *\n * @param {Vector3} axis - The (normalized) axis vector.\n * @param {number} angle - The angle in radians.\n */\n setRotationFromAxisAngle(e, t) {\n this.quaternion.setFromAxisAngle(e, t);\n }\n /**\n * Sets the given rotation represented as Euler angles to the 3D object.\n *\n * @param {Euler} euler - The Euler angles.\n */\n setRotationFromEuler(e) {\n this.quaternion.setFromEuler(e, !0);\n }\n /**\n * Sets the given rotation represented as rotation matrix to the 3D object.\n *\n * @param {Matrix4} m - Although a 4x4 matrix is expected, the upper 3x3 portion must be\n * a pure rotation matrix (i.e, unscaled).\n */\n setRotationFromMatrix(e) {\n this.quaternion.setFromRotationMatrix(e);\n }\n /**\n * Sets the given rotation represented as a Quaternion to the 3D object.\n *\n * @param {Quaternion} q - The Quaternion\n */\n setRotationFromQuaternion(e) {\n this.quaternion.copy(e);\n }\n /**\n * Rotates the 3D object along an axis in local space.\n *\n * @param {Vector3} axis - The (normalized) axis vector.\n * @param {number} angle - The angle in radians.\n * @return {Object3D} A reference to this instance.\n */\n rotateOnAxis(e, t) {\n return yi.setFromAxisAngle(e, t), this.quaternion.multiply(yi), this;\n }\n /**\n * Rotates the 3D object along an axis in world space.\n *\n * @param {Vector3} axis - The (normalized) axis vector.\n * @param {number} angle - The angle in radians.\n * @return {Object3D} A reference to this instance.\n */\n rotateOnWorldAxis(e, t) {\n return yi.setFromAxisAngle(e, t), this.quaternion.premultiply(yi), this;\n }\n /**\n * Rotates the 3D object around its X axis in local space.\n *\n * @param {number} angle - The angle in radians.\n * @return {Object3D} A reference to this instance.\n */\n rotateX(e) {\n return this.rotateOnAxis(xl, e);\n }\n /**\n * Rotates the 3D object around its Y axis in local space.\n *\n * @param {number} angle - The angle in radians.\n * @return {Object3D} A reference to this instance.\n */\n rotateY(e) {\n return this.rotateOnAxis(_l, e);\n }\n /**\n * Rotates the 3D object around its Z axis in local space.\n *\n * @param {number} angle - The angle in radians.\n * @return {Object3D} A reference to this instance.\n */\n rotateZ(e) {\n return this.rotateOnAxis(vl, e);\n }\n /**\n * Translate the 3D object by a distance along the given axis in local space.\n *\n * @param {Vector3} axis - The (normalized) axis vector.\n * @param {number} distance - The distance in world units.\n * @return {Object3D} A reference to this instance.\n */\n translateOnAxis(e, t) {\n return gl.copy(e).applyQuaternion(this.quaternion), this.position.add(gl.multiplyScalar(t)), this;\n }\n /**\n * Translate the 3D object by a distance along its X-axis in local space.\n *\n * @param {number} distance - The distance in world units.\n * @return {Object3D} A reference to this instance.\n */\n translateX(e) {\n return this.translateOnAxis(xl, e);\n }\n /**\n * Translate the 3D object by a distance along its Y-axis in local space.\n *\n * @param {number} distance - The distance in world units.\n * @return {Object3D} A reference to this instance.\n */\n translateY(e) {\n return this.translateOnAxis(_l, e);\n }\n /**\n * Translate the 3D object by a distance along its Z-axis in local space.\n *\n * @param {number} distance - The distance in world units.\n * @return {Object3D} A reference to this instance.\n */\n translateZ(e) {\n return this.translateOnAxis(vl, e);\n }\n /**\n * Converts the given vector from this 3D object's local space to world space.\n *\n * @param {Vector3} vector - The vector to convert.\n * @return {Vector3} The converted vector.\n */\n localToWorld(e) {\n return this.updateWorldMatrix(!0, !1), e.applyMatrix4(this.matrixWorld);\n }\n /**\n * Converts the given vector from this 3D object's word space to local space.\n *\n * @param {Vector3} vector - The vector to convert.\n * @return {Vector3} The converted vector.\n */\n worldToLocal(e) {\n return this.updateWorldMatrix(!0, !1), e.applyMatrix4(Ln.copy(this.matrixWorld).invert());\n }\n /**\n * Rotates the object to face a point in world space.\n *\n * This method does not support objects having non-uniformly-scaled parent(s).\n *\n * @param {number|Vector3} x - The x coordinate in world space. Alternatively, a vector representing a position in world space\n * @param {number} [y] - The y coordinate in world space.\n * @param {number} [z] - The z coordinate in world space.\n */\n lookAt(e, t, n) {\n e.isVector3 ? zs.copy(e) : zs.set(e, t, n);\n const s = this.parent;\n this.updateWorldMatrix(!0, !1), as.setFromMatrixPosition(this.matrixWorld), this.isCamera || this.isLight ? Ln.lookAt(as, zs, this.up) : Ln.lookAt(zs, as, this.up), this.quaternion.setFromRotationMatrix(Ln), s && (Ln.extractRotation(s.matrixWorld), yi.setFromRotationMatrix(Ln), this.quaternion.premultiply(yi.invert()));\n }\n /**\n * Adds the given 3D object as a child to this 3D object. An arbitrary number of\n * objects may be added. Any current parent on an object passed in here will be\n * removed, since an object can have at most one parent.\n *\n * @fires Object3D#added\n * @fires Object3D#childadded\n * @param {Object3D} object - The 3D object to add.\n * @return {Object3D} A reference to this instance.\n */\n add(e) {\n if (arguments.length > 1) {\n for (let t = 0; t < arguments.length; t++)\n this.add(arguments[t]);\n return this;\n }\n return e === this ? (Xe(\"Object3D.add: object can't be added as a child of itself.\", e), this) : (e && e.isObject3D ? (e.removeFromParent(), e.parent = this, this.children.push(e), e.dispatchEvent(Ml), Ti.child = e, this.dispatchEvent(Ti), Ti.child = null) : Xe(\"Object3D.add: object not an instance of THREE.Object3D.\", e), this);\n }\n /**\n * Removes the given 3D object as child from this 3D object.\n * An arbitrary number of objects may be removed.\n *\n * @fires Object3D#removed\n * @fires Object3D#childremoved\n * @param {Object3D} object - The 3D object to remove.\n * @return {Object3D} A reference to this instance.\n */\n remove(e) {\n if (arguments.length > 1) {\n for (let n = 0; n < arguments.length; n++)\n this.remove(arguments[n]);\n return this;\n }\n const t = this.children.indexOf(e);\n return t !== -1 && (e.parent = null, this.children.splice(t, 1), e.dispatchEvent(Gu), jr.child = e, this.dispatchEvent(jr), jr.child = null), this;\n }\n /**\n * Removes this 3D object from its current parent.\n *\n * @fires Object3D#removed\n * @fires Object3D#childremoved\n * @return {Object3D} A reference to this instance.\n */\n removeFromParent() {\n const e = this.parent;\n return e !== null && e.remove(this), this;\n }\n /**\n * Removes all child objects.\n *\n * @fires Object3D#removed\n * @fires Object3D#childremoved\n * @return {Object3D} A reference to this instance.\n */\n clear() {\n return this.remove(...this.children);\n }\n /**\n * Adds the given 3D object as a child of this 3D object, while maintaining the object's world\n * transform. This method does not support scene graphs having non-uniformly-scaled nodes(s).\n *\n * @fires Object3D#added\n * @fires Object3D#childadded\n * @param {Object3D} object - The 3D object to attach.\n * @return {Object3D} A reference to this instance.\n */\n attach(e) {\n return this.updateWorldMatrix(!0, !1), Ln.copy(this.matrixWorld).invert(), e.parent !== null && (e.parent.updateWorldMatrix(!0, !1), Ln.multiply(e.parent.matrixWorld)), e.applyMatrix4(Ln), e.removeFromParent(), e.parent = this, this.children.push(e), e.updateWorldMatrix(!1, !0), e.dispatchEvent(Ml), Ti.child = e, this.dispatchEvent(Ti), Ti.child = null, this;\n }\n /**\n * Searches through the 3D object and its children, starting with the 3D object\n * itself, and returns the first with a matching ID.\n *\n * @param {number} id - The id.\n * @return {Object3D|undefined} The found 3D object. Returns `undefined` if no 3D object has been found.\n */\n getObjectById(e) {\n return this.getObjectByProperty(\"id\", e);\n }\n /**\n * Searches through the 3D object and its children, starting with the 3D object\n * itself, and returns the first with a matching name.\n *\n * @param {string} name - The name.\n * @return {Object3D|undefined} The found 3D object. Returns `undefined` if no 3D object has been found.\n */\n getObjectByName(e) {\n return this.getObjectByProperty(\"name\", e);\n }\n /**\n * Searches through the 3D object and its children, starting with the 3D object\n * itself, and returns the first with a matching property value.\n *\n * @param {string} name - The name of the property.\n * @param {any} value - The value.\n * @return {Object3D|undefined} The found 3D object. Returns `undefined` if no 3D object has been found.\n */\n getObjectByProperty(e, t) {\n if (this[e] === t) return this;\n for (let n = 0, s = this.children.length; n < s; n++) {\n const a = this.children[n].getObjectByProperty(e, t);\n if (a !== void 0)\n return a;\n }\n }\n /**\n * Searches through the 3D object and its children, starting with the 3D object\n * itself, and returns all 3D objects with a matching property value.\n *\n * @param {string} name - The name of the property.\n * @param {any} value - The value.\n * @param {Array} result - The method stores the result in this array.\n * @return {Array} The found 3D objects.\n */\n getObjectsByProperty(e, t, n = []) {\n this[e] === t && n.push(this);\n const s = this.children;\n for (let r = 0, a = s.length; r < a; r++)\n s[r].getObjectsByProperty(e, t, n);\n return n;\n }\n /**\n * Returns a vector representing the position of the 3D object in world space.\n *\n * @param {Vector3} target - The target vector the result is stored to.\n * @return {Vector3} The 3D object's position in world space.\n */\n getWorldPosition(e) {\n return this.updateWorldMatrix(!0, !1), e.setFromMatrixPosition(this.matrixWorld);\n }\n /**\n * Returns a Quaternion representing the position of the 3D object in world space.\n *\n * @param {Quaternion} target - The target Quaternion the result is stored to.\n * @return {Quaternion} The 3D object's rotation in world space.\n */\n getWorldQuaternion(e) {\n return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(as, e, ku), e;\n }\n /**\n * Returns a vector representing the scale of the 3D object in world space.\n *\n * @param {Vector3} target - The target vector the result is stored to.\n * @return {Vector3} The 3D object's scale in world space.\n */\n getWorldScale(e) {\n return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(as, Vu, e), e;\n }\n /**\n * Returns a vector representing the (\"look\") direction of the 3D object in world space.\n *\n * @param {Vector3} target - The target vector the result is stored to.\n * @return {Vector3} The 3D object's direction in world space.\n */\n getWorldDirection(e) {\n this.updateWorldMatrix(!0, !1);\n const t = this.matrixWorld.elements;\n return e.set(t[8], t[9], t[10]).normalize();\n }\n /**\n * Abstract method to get intersections between a casted ray and this\n * 3D object. Renderable 3D objects such as {@link Mesh}, {@link Line} or {@link Points}\n * implement this method in order to use raycasting.\n *\n * @abstract\n * @param {Raycaster} raycaster - The raycaster.\n * @param {Array} intersects - An array holding the result of the method.\n */\n raycast() {\n }\n /**\n * Executes the callback on this 3D object and all descendants.\n *\n * Note: Modifying the scene graph inside the callback is discouraged.\n *\n * @param {Function} callback - A callback function that allows to process the current 3D object.\n */\n traverse(e) {\n e(this);\n const t = this.children;\n for (let n = 0, s = t.length; n < s; n++)\n t[n].traverse(e);\n }\n /**\n * Like {@link Object3D#traverse}, but the callback will only be executed for visible 3D objects.\n * Descendants of invisible 3D objects are not traversed.\n *\n * Note: Modifying the scene graph inside the callback is discouraged.\n *\n * @param {Function} callback - A callback function that allows to process the current 3D object.\n */\n traverseVisible(e) {\n if (this.visible === !1) return;\n e(this);\n const t = this.children;\n for (let n = 0, s = t.length; n < s; n++)\n t[n].traverseVisible(e);\n }\n /**\n * Like {@link Object3D#traverse}, but the callback will only be executed for all ancestors.\n *\n * Note: Modifying the scene graph inside the callback is discouraged.\n *\n * @param {Function} callback - A callback function that allows to process the current 3D object.\n */\n traverseAncestors(e) {\n const t = this.parent;\n t !== null && (e(t), t.traverseAncestors(e));\n }\n /**\n * Updates the transformation matrix in local space by computing it from the current\n * position, rotation and scale values.\n */\n updateMatrix() {\n this.matrix.compose(this.position, this.quaternion, this.scale), this.matrixWorldNeedsUpdate = !0;\n }\n /**\n * Updates the transformation matrix in world space of this 3D objects and its descendants.\n *\n * To ensure correct results, this method also recomputes the 3D object's transformation matrix in\n * local space. The computation of the local and world matrix can be controlled with the\n * {@link Object3D#matrixAutoUpdate} and {@link Object3D#matrixWorldAutoUpdate} flags which are both\n * `true` by default. Set these flags to `false` if you need more control over the update matrix process.\n *\n * @param {boolean} [force=false] - When set to `true`, a recomputation of world matrices is forced even\n * when {@link Object3D#matrixWorldAutoUpdate} is set to `false`.\n */\n updateMatrixWorld(e) {\n this.matrixAutoUpdate && this.updateMatrix(), (this.matrixWorldNeedsUpdate || e) && (this.matrixWorldAutoUpdate === !0 && (this.parent === null ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix)), this.matrixWorldNeedsUpdate = !1, e = !0);\n const t = this.children;\n for (let n = 0, s = t.length; n < s; n++)\n t[n].updateMatrixWorld(e);\n }\n /**\n * An alternative version of {@link Object3D#updateMatrixWorld} with more control over the\n * update of ancestor and descendant nodes.\n *\n * @param {boolean} [updateParents=false] Whether ancestor nodes should be updated or not.\n * @param {boolean} [updateChildren=false] Whether descendant nodes should be updated or not.\n */\n updateWorldMatrix(e, t) {\n const n = this.parent;\n if (e === !0 && n !== null && n.updateWorldMatrix(!0, !1), this.matrixAutoUpdate && this.updateMatrix(), this.matrixWorldAutoUpdate === !0 && (this.parent === null ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix)), t === !0) {\n const s = this.children;\n for (let r = 0, a = s.length; r < a; r++)\n s[r].updateWorldMatrix(!1, !0);\n }\n }\n /**\n * Serializes the 3D object into JSON.\n *\n * @param {?(Object|string)} meta - An optional value holding meta information about the serialization.\n * @return {Object} A JSON object representing the serialized 3D object.\n * @see {@link ObjectLoader#parse}\n */\n toJSON(e) {\n const t = e === void 0 || typeof e == \"string\", n = {};\n t && (e = {\n geometries: {},\n materials: {},\n textures: {},\n images: {},\n shapes: {},\n skeletons: {},\n animations: {},\n nodes: {}\n }, n.metadata = {\n version: 4.7,\n type: \"Object\",\n generator: \"Object3D.toJSON\"\n });\n const s = {};\n s.uuid = this.uuid, s.type = this.type, this.name !== \"\" && (s.name = this.name), this.castShadow === !0 && (s.castShadow = !0), this.receiveShadow === !0 && (s.receiveShadow = !0), this.visible === !1 && (s.visible = !1), this.frustumCulled === !1 && (s.frustumCulled = !1), this.renderOrder !== 0 && (s.renderOrder = this.renderOrder), Object.keys(this.userData).length > 0 && (s.userData = this.userData), s.layers = this.layers.mask, s.matrix = this.matrix.toArray(), s.up = this.up.toArray(), this.matrixAutoUpdate === !1 && (s.matrixAutoUpdate = !1), this.isInstancedMesh && (s.type = \"InstancedMesh\", s.count = this.count, s.instanceMatrix = this.instanceMatrix.toJSON(), this.instanceColor !== null && (s.instanceColor = this.instanceColor.toJSON())), this.isBatchedMesh && (s.type = \"BatchedMesh\", s.perObjectFrustumCulled = this.perObjectFrustumCulled, s.sortObjects = this.sortObjects, s.drawRanges = this._drawRanges, s.reservedRanges = this._reservedRanges, s.geometryInfo = this._geometryInfo.map((o) => ({\n ...o,\n boundingBox: o.boundingBox ? o.boundingBox.toJSON() : void 0,\n boundingSphere: o.boundingSphere ? o.boundingSphere.toJSON() : void 0\n })), s.instanceInfo = this._instanceInfo.map((o) => ({ ...o })), s.availableInstanceIds = this._availableInstanceIds.slice(), s.availableGeometryIds = this._availableGeometryIds.slice(), s.nextIndexStart = this._nextIndexStart, s.nextVertexStart = this._nextVertexStart, s.geometryCount = this._geometryCount, s.maxInstanceCount = this._maxInstanceCount, s.maxVertexCount = this._maxVertexCount, s.maxIndexCount = this._maxIndexCount, s.geometryInitialized = this._geometryInitialized, s.matricesTexture = this._matricesTexture.toJSON(e), s.indirectTexture = this._indirectTexture.toJSON(e), this._colorsTexture !== null && (s.colorsTexture = this._colorsTexture.toJSON(e)), this.boundingSphere !== null && (s.boundingSphere = this.boundingSphere.toJSON()), this.boundingBox !== null && (s.boundingBox = this.boundingBox.toJSON()));\n function r(o, l) {\n return o[l.uuid] === void 0 && (o[l.uuid] = l.toJSON(e)), l.uuid;\n }\n if (this.isScene)\n this.background && (this.background.isColor ? s.background = this.background.toJSON() : this.background.isTexture && (s.background = this.background.toJSON(e).uuid)), this.environment && this.environment.isTexture && this.environment.isRenderTargetTexture !== !0 && (s.environment = this.environment.toJSON(e).uuid);\n else if (this.isMesh || this.isLine || this.isPoints) {\n s.geometry = r(e.geometries, this.geometry);\n const o = this.geometry.parameters;\n if (o !== void 0 && o.shapes !== void 0) {\n const l = o.shapes;\n if (Array.isArray(l))\n for (let c = 0, h = l.length; c < h; c++) {\n const u = l[c];\n r(e.shapes, u);\n }\n else\n r(e.shapes, l);\n }\n }\n if (this.isSkinnedMesh && (s.bindMode = this.bindMode, s.bindMatrix = this.bindMatrix.toArray(), this.skeleton !== void 0 && (r(e.skeletons, this.skeleton), s.skeleton = this.skeleton.uuid)), this.material !== void 0)\n if (Array.isArray(this.material)) {\n const o = [];\n for (let l = 0, c = this.material.length; l < c; l++)\n o.push(r(e.materials, this.material[l]));\n s.material = o;\n } else\n s.material = r(e.materials, this.material);\n if (this.children.length > 0) {\n s.children = [];\n for (let o = 0; o < this.children.length; o++)\n s.children.push(this.children[o].toJSON(e).object);\n }\n if (this.animations.length > 0) {\n s.animations = [];\n for (let o = 0; o < this.animations.length; o++) {\n const l = this.animations[o];\n s.animations.push(r(e.animations, l));\n }\n }\n if (t) {\n const o = a(e.geometries), l = a(e.materials), c = a(e.textures), h = a(e.images), u = a(e.shapes), d = a(e.skeletons), p = a(e.animations), g = a(e.nodes);\n o.length > 0 && (n.geometries = o), l.length > 0 && (n.materials = l), c.length > 0 && (n.textures = c), h.length > 0 && (n.images = h), u.length > 0 && (n.shapes = u), d.length > 0 && (n.skeletons = d), p.length > 0 && (n.animations = p), g.length > 0 && (n.nodes = g);\n }\n return n.object = s, n;\n function a(o) {\n const l = [];\n for (const c in o) {\n const h = o[c];\n delete h.metadata, l.push(h);\n }\n return l;\n }\n }\n /**\n * Returns a new 3D object with copied values from this instance.\n *\n * @param {boolean} [recursive=true] - When set to `true`, descendants of the 3D object are also cloned.\n * @return {Object3D} A clone of this instance.\n */\n clone(e) {\n return new this.constructor().copy(this, e);\n }\n /**\n * Copies the values of the given 3D object to this instance.\n *\n * @param {Object3D} source - The 3D object to copy.\n * @param {boolean} [recursive=true] - When set to `true`, descendants of the 3D object are cloned.\n * @return {Object3D} A reference to this instance.\n */\n copy(e, t = !0) {\n if (this.name = e.name, this.up.copy(e.up), this.position.copy(e.position), this.rotation.order = e.rotation.order, this.quaternion.copy(e.quaternion), this.scale.copy(e.scale), this.matrix.copy(e.matrix), this.matrixWorld.copy(e.matrixWorld), this.matrixAutoUpdate = e.matrixAutoUpdate, this.matrixWorldAutoUpdate = e.matrixWorldAutoUpdate, this.matrixWorldNeedsUpdate = e.matrixWorldNeedsUpdate, this.layers.mask = e.layers.mask, this.visible = e.visible, this.castShadow = e.castShadow, this.receiveShadow = e.receiveShadow, this.frustumCulled = e.frustumCulled, this.renderOrder = e.renderOrder, this.animations = e.animations.slice(), this.userData = JSON.parse(JSON.stringify(e.userData)), t === !0)\n for (let n = 0; n < e.children.length; n++) {\n const s = e.children[n];\n this.add(s.clone());\n }\n return this;\n }\n}\npt.DEFAULT_UP = /* @__PURE__ */ new w(0, 1, 0);\npt.DEFAULT_MATRIX_AUTO_UPDATE = !0;\npt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = !0;\nconst on = /* @__PURE__ */ new w(), In = /* @__PURE__ */ new w(), qr = /* @__PURE__ */ new w(), Un = /* @__PURE__ */ new w(), Ei = /* @__PURE__ */ new w(), wi = /* @__PURE__ */ new w(), Sl = /* @__PURE__ */ new w(), Yr = /* @__PURE__ */ new w(), Kr = /* @__PURE__ */ new w(), Zr = /* @__PURE__ */ new w(), $r = /* @__PURE__ */ new Je(), Jr = /* @__PURE__ */ new Je(), Qr = /* @__PURE__ */ new Je();\nclass un {\n /**\n * Constructs a new triangle.\n *\n * @param {Vector3} [a=(0,0,0)] - The first corner of the triangle.\n * @param {Vector3} [b=(0,0,0)] - The second corner of the triangle.\n * @param {Vector3} [c=(0,0,0)] - The third corner of the triangle.\n */\n constructor(e = new w(), t = new w(), n = new w()) {\n this.a = e, this.b = t, this.c = n;\n }\n /**\n * Computes the normal vector of a triangle.\n *\n * @param {Vector3} a - The first corner of the triangle.\n * @param {Vector3} b - The second corner of the triangle.\n * @param {Vector3} c - The third corner of the triangle.\n * @param {Vector3} target - The target vector that is used to store the method's result.\n * @return {Vector3} The triangle's normal.\n */\n static getNormal(e, t, n, s) {\n s.subVectors(n, t), on.subVectors(e, t), s.cross(on);\n const r = s.lengthSq();\n return r > 0 ? s.multiplyScalar(1 / Math.sqrt(r)) : s.set(0, 0, 0);\n }\n /**\n * Computes a barycentric coordinates from the given vector.\n * Returns `null` if the triangle is degenerate.\n *\n * @param {Vector3} point - A point in 3D space.\n * @param {Vector3} a - The first corner of the triangle.\n * @param {Vector3} b - The second corner of the triangle.\n * @param {Vector3} c - The third corner of the triangle.\n * @param {Vector3} target - The target vector that is used to store the method's result.\n * @return {?Vector3} The barycentric coordinates for the given point\n */\n static getBarycoord(e, t, n, s, r) {\n on.subVectors(s, t), In.subVectors(n, t), qr.subVectors(e, t);\n const a = on.dot(on), o = on.dot(In), l = on.dot(qr), c = In.dot(In), h = In.dot(qr), u = a * c - o * o;\n if (u === 0)\n return r.set(0, 0, 0), null;\n const d = 1 / u, p = (c * l - o * h) * d, g = (a * h - o * l) * d;\n return r.set(1 - p - g, g, p);\n }\n /**\n * Returns `true` if the given point, when projected onto the plane of the\n * triangle, lies within the triangle.\n *\n * @param {Vector3} point - The point in 3D space to test.\n * @param {Vector3} a - The first corner of the triangle.\n * @param {Vector3} b - The second corner of the triangle.\n * @param {Vector3} c - The third corner of the triangle.\n * @return {boolean} Whether the given point, when projected onto the plane of the\n * triangle, lies within the triangle or not.\n */\n static containsPoint(e, t, n, s) {\n return this.getBarycoord(e, t, n, s, Un) === null ? !1 : Un.x >= 0 && Un.y >= 0 && Un.x + Un.y <= 1;\n }\n /**\n * Computes the value barycentrically interpolated for the given point on the\n * triangle. Returns `null` if the triangle is degenerate.\n *\n * @param {Vector3} point - Position of interpolated point.\n * @param {Vector3} p1 - The first corner of the triangle.\n * @param {Vector3} p2 - The second corner of the triangle.\n * @param {Vector3} p3 - The third corner of the triangle.\n * @param {Vector3} v1 - Value to interpolate of first vertex.\n * @param {Vector3} v2 - Value to interpolate of second vertex.\n * @param {Vector3} v3 - Value to interpolate of third vertex.\n * @param {Vector3} target - The target vector that is used to store the method's result.\n * @return {?Vector3} The interpolated value.\n */\n static getInterpolation(e, t, n, s, r, a, o, l) {\n return this.getBarycoord(e, t, n, s, Un) === null ? (l.x = 0, l.y = 0, \"z\" in l && (l.z = 0), \"w\" in l && (l.w = 0), null) : (l.setScalar(0), l.addScaledVector(r, Un.x), l.addScaledVector(a, Un.y), l.addScaledVector(o, Un.z), l);\n }\n /**\n * Computes the value barycentrically interpolated for the given attribute and indices.\n *\n * @param {BufferAttribute} attr - The attribute to interpolate.\n * @param {number} i1 - Index of first vertex.\n * @param {number} i2 - Index of second vertex.\n * @param {number} i3 - Index of third vertex.\n * @param {Vector3} barycoord - The barycoordinate value to use to interpolate.\n * @param {Vector3} target - The target vector that is used to store the method's result.\n * @return {Vector3} The interpolated attribute value.\n */\n static getInterpolatedAttribute(e, t, n, s, r, a) {\n return $r.setScalar(0), Jr.setScalar(0), Qr.setScalar(0), $r.fromBufferAttribute(e, t), Jr.fromBufferAttribute(e, n), Qr.fromBufferAttribute(e, s), a.setScalar(0), a.addScaledVector($r, r.x), a.addScaledVector(Jr, r.y), a.addScaledVector(Qr, r.z), a;\n }\n /**\n * Returns `true` if the triangle is oriented towards the given direction.\n *\n * @param {Vector3} a - The first corner of the triangle.\n * @param {Vector3} b - The second corner of the triangle.\n * @param {Vector3} c - The third corner of the triangle.\n * @param {Vector3} direction - The (normalized) direction vector.\n * @return {boolean} Whether the triangle is oriented towards the given direction or not.\n */\n static isFrontFacing(e, t, n, s) {\n return on.subVectors(n, t), In.subVectors(e, t), on.cross(In).dot(s) < 0;\n }\n /**\n * Sets the triangle's vertices by copying the given values.\n *\n * @param {Vector3} a - The first corner of the triangle.\n * @param {Vector3} b - The second corner of the triangle.\n * @param {Vector3} c - The third corner of the triangle.\n * @return {Triangle} A reference to this triangle.\n */\n set(e, t, n) {\n return this.a.copy(e), this.b.copy(t), this.c.copy(n), this;\n }\n /**\n * Sets the triangle's vertices by copying the given array values.\n *\n * @param {Array} points - An array with 3D points.\n * @param {number} i0 - The array index representing the first corner of the triangle.\n * @param {number} i1 - The array index representing the second corner of the triangle.\n * @param {number} i2 - The array index representing the third corner of the triangle.\n * @return {Triangle} A reference to this triangle.\n */\n setFromPointsAndIndices(e, t, n, s) {\n return this.a.copy(e[t]), this.b.copy(e[n]), this.c.copy(e[s]), this;\n }\n /**\n * Sets the triangle's vertices by copying the given attribute values.\n *\n * @param {BufferAttribute} attribute - A buffer attribute with 3D points data.\n * @param {number} i0 - The attribute index representing the first corner of the triangle.\n * @param {number} i1 - The attribute index representing the second corner of the triangle.\n * @param {number} i2 - The attribute index representing the third corner of the triangle.\n * @return {Triangle} A reference to this triangle.\n */\n setFromAttributeAndIndices(e, t, n, s) {\n return this.a.fromBufferAttribute(e, t), this.b.fromBufferAttribute(e, n), this.c.fromBufferAttribute(e, s), this;\n }\n /**\n * Returns a new triangle with copied values from this instance.\n *\n * @return {Triangle} A clone of this instance.\n */\n clone() {\n return new this.constructor().copy(this);\n }\n /**\n * Copies the values of the given triangle to this instance.\n *\n * @param {Triangle} triangle - The triangle to copy.\n * @return {Triangle} A reference to this triangle.\n */\n copy(e) {\n return this.a.copy(e.a), this.b.copy(e.b), this.c.copy(e.c), this;\n }\n /**\n * Computes the area of the triangle.\n *\n * @return {number} The triangle's area.\n */\n getArea() {\n return on.subVectors(this.c, this.b), In.subVectors(this.a, this.b), on.cross(In).length() * 0.5;\n }\n /**\n * Computes the midpoint of the triangle.\n *\n * @param {Vector3} target - The target vector that is used to store the method's result.\n * @return {Vector3} The triangle's midpoint.\n */\n getMidpoint(e) {\n return e.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3);\n }\n /**\n * Computes the normal of the triangle.\n *\n * @param {Vector3} target - The target vector that is used to store the method's result.\n * @return {Vector3} The triangle's normal.\n */\n getNormal(e) {\n return un.getNormal(this.a, this.b, this.c, e);\n }\n /**\n * Computes a plane the triangle lies within.\n *\n * @param {Plane} target - The target vector that is used to store the method's result.\n * @return {Plane} The plane the triangle lies within.\n */\n getPlane(e) {\n return e.setFromCoplanarPoints(this.a, this.b, this.c);\n }\n /**\n * Computes a barycentric coordinates from the given vector.\n * Returns `null` if the triangle is degenerate.\n *\n * @param {Vector3} point - A point in 3D space.\n * @param {Vector3} target - The target vector that is used to store the method's result.\n * @return {?Vector3} The barycentric coordinates for the given point\n */\n getBarycoord(e, t) {\n return un.getBarycoord(e, this.a, this.b, this.c, t);\n }\n /**\n * Computes the value barycentrically interpolated for the given point on the\n * triangle. Returns `null` if the triangle is degenerate.\n *\n * @param {Vector3} point - Position of interpolated point.\n * @param {Vector3} v1 - Value to interpolate of first vertex.\n * @param {Vector3} v2 - Value to interpolate of second vertex.\n * @param {Vector3} v3 - Value to interpolate of third vertex.\n * @param {Vector3} target - The target vector that is used to store the method's result.\n * @return {?Vector3} The interpolated value.\n */\n getInterpolation(e, t, n, s, r) {\n return un.getInterpolation(e, this.a, this.b, this.c, t, n, s, r);\n }\n /**\n * Returns `true` if the given point, when projected onto the plane of the\n * triangle, lies within the triangle.\n *\n * @param {Vector3} point - The point in 3D space to test.\n * @return {boolean} Whether the given point, when projected onto the plane of the\n * triangle, lies within the triangle or not.\n */\n containsPoint(e) {\n return un.containsPoint(e, this.a, this.b, this.c);\n }\n /**\n * Returns `true` if the triangle is oriented towards the given direction.\n *\n * @param {Vector3} direction - The (normalized) direction vector.\n * @return {boolean} Whether the triangle is oriented towards the given direction or not.\n */\n isFrontFacing(e) {\n return un.isFrontFacing(this.a, this.b, this.c, e);\n }\n /**\n * Returns `true` if this triangle intersects with the given box.\n *\n * @param {Box3} box - The box to intersect.\n * @return {boolean} Whether this triangle intersects with the given box or not.\n */\n intersectsBox(e) {\n return e.intersectsTriangle(this);\n }\n /**\n * Returns the closest point on the triangle to the given point.\n *\n * @param {Vector3} p - The point to compute the closest point for.\n * @param {Vector3} target - The target vector that is used to store the method's result.\n * @return {Vector3} The closest point on the triangle.\n */\n closestPointToPoint(e, t) {\n const n = this.a, s = this.b, r = this.c;\n let a, o;\n Ei.subVectors(s, n), wi.subVectors(r, n), Yr.subVectors(e, n);\n const l = Ei.dot(Yr), c = wi.dot(Yr);\n if (l <= 0 && c <= 0)\n return t.copy(n);\n Kr.subVectors(e, s);\n const h = Ei.dot(Kr), u = wi.dot(Kr);\n if (h >= 0 && u <= h)\n return t.copy(s);\n const d = l * u - h * c;\n if (d <= 0 && l >= 0 && h <= 0)\n return a = l / (l - h), t.copy(n).addScaledVector(Ei, a);\n Zr.subVectors(e, r);\n const p = Ei.dot(Zr), g = wi.dot(Zr);\n if (g >= 0 && p <= g)\n return t.copy(r);\n const x = p * c - l * g;\n if (x <= 0 && c >= 0 && g <= 0)\n return o = c / (c - g), t.copy(n).addScaledVector(wi, o);\n const m = h * g - p * u;\n if (m <= 0 && u - h >= 0 && p - g >= 0)\n return Sl.subVectors(r, s), o = (u - h) / (u - h + (p - g)), t.copy(s).addScaledVector(Sl, o);\n const f = 1 / (m + x + d);\n return a = x * f, o = d * f, t.copy(n).addScaledVector(Ei, a).addScaledVector(wi, o);\n }\n /**\n * Returns `true` if this triangle is equal with the given one.\n *\n * @param {Triangle} triangle - The triangle to test for equality.\n * @return {boolean} Whether this triangle is equal with the given one.\n */\n equals(e) {\n return e.a.equals(this.a) && e.b.equals(this.b) && e.c.equals(this.c);\n }\n}\nconst Qc = {\n aliceblue: 15792383,\n antiquewhite: 16444375,\n aqua: 65535,\n aquamarine: 8388564,\n azure: 15794175,\n beige: 16119260,\n bisque: 16770244,\n black: 0,\n blanchedalmond: 16772045,\n blue: 255,\n blueviolet: 9055202,\n brown: 10824234,\n burlywood: 14596231,\n cadetblue: 6266528,\n chartreuse: 8388352,\n chocolate: 13789470,\n coral: 16744272,\n cornflowerblue: 6591981,\n cornsilk: 16775388,\n crimson: 14423100,\n cyan: 65535,\n darkblue: 139,\n darkcyan: 35723,\n darkgoldenrod: 12092939,\n darkgray: 11119017,\n darkgreen: 25600,\n darkgrey: 11119017,\n darkkhaki: 12433259,\n darkmagenta: 9109643,\n darkolivegreen: 5597999,\n darkorange: 16747520,\n darkorchid: 10040012,\n darkred: 9109504,\n darksalmon: 15308410,\n darkseagreen: 9419919,\n darkslateblue: 4734347,\n darkslategray: 3100495,\n darkslategrey: 3100495,\n darkturquoise: 52945,\n darkviolet: 9699539,\n deeppink: 16716947,\n deepskyblue: 49151,\n dimgray: 6908265,\n dimgrey: 6908265,\n dodgerblue: 2003199,\n firebrick: 11674146,\n floralwhite: 16775920,\n forestgreen: 2263842,\n fuchsia: 16711935,\n gainsboro: 14474460,\n ghostwhite: 16316671,\n gold: 16766720,\n goldenrod: 14329120,\n gray: 8421504,\n green: 32768,\n greenyellow: 11403055,\n grey: 8421504,\n honeydew: 15794160,\n hotpink: 16738740,\n indianred: 13458524,\n indigo: 4915330,\n ivory: 16777200,\n khaki: 15787660,\n lavender: 15132410,\n lavenderblush: 16773365,\n lawngreen: 8190976,\n lemonchiffon: 16775885,\n lightblue: 11393254,\n lightcoral: 15761536,\n lightcyan: 14745599,\n lightgoldenrodyellow: 16448210,\n lightgray: 13882323,\n lightgreen: 9498256,\n lightgrey: 13882323,\n lightpink: 16758465,\n lightsalmon: 16752762,\n lightseagreen: 2142890,\n lightskyblue: 8900346,\n lightslategray: 7833753,\n lightslategrey: 7833753,\n lightsteelblue: 11584734,\n lightyellow: 16777184,\n lime: 65280,\n limegreen: 3329330,\n linen: 16445670,\n magenta: 16711935,\n maroon: 8388608,\n mediumaquamarine: 6737322,\n mediumblue: 205,\n mediumorchid: 12211667,\n mediumpurple: 9662683,\n mediumseagreen: 3978097,\n mediumslateblue: 8087790,\n mediumspringgreen: 64154,\n mediumturquoise: 4772300,\n mediumvioletred: 13047173,\n midnightblue: 1644912,\n mintcream: 16121850,\n mistyrose: 16770273,\n moccasin: 16770229,\n navajowhite: 16768685,\n navy: 128,\n oldlace: 16643558,\n olive: 8421376,\n olivedrab: 7048739,\n orange: 16753920,\n orangered: 16729344,\n orchid: 14315734,\n palegoldenrod: 15657130,\n palegreen: 10025880,\n paleturquoise: 11529966,\n palevioletred: 14381203,\n papayawhip: 16773077,\n peachpuff: 16767673,\n peru: 13468991,\n pink: 16761035,\n plum: 14524637,\n powderblue: 11591910,\n purple: 8388736,\n rebeccapurple: 6697881,\n red: 16711680,\n rosybrown: 12357519,\n royalblue: 4286945,\n saddlebrown: 9127187,\n salmon: 16416882,\n sandybrown: 16032864,\n seagreen: 3050327,\n seashell: 16774638,\n sienna: 10506797,\n silver: 12632256,\n skyblue: 8900331,\n slateblue: 6970061,\n slategray: 7372944,\n slategrey: 7372944,\n snow: 16775930,\n springgreen: 65407,\n steelblue: 4620980,\n tan: 13808780,\n teal: 32896,\n thistle: 14204888,\n tomato: 16737095,\n turquoise: 4251856,\n violet: 15631086,\n wheat: 16113331,\n white: 16777215,\n whitesmoke: 16119285,\n yellow: 16776960,\n yellowgreen: 10145074\n}, jn = { h: 0, s: 0, l: 0 }, ks = { h: 0, s: 0, l: 0 };\nfunction ea(i, e, t) {\n return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? i + (e - i) * 6 * t : t < 1 / 2 ? e : t < 2 / 3 ? i + (e - i) * 6 * (2 / 3 - t) : i;\n}\nclass Se {\n /**\n * Constructs a new color.\n *\n * Note that standard method of specifying color in three.js is with a hexadecimal triplet,\n * and that method is used throughout the rest of the documentation.\n *\n * @param {(number|string|Color)} [r] - The red component of the color. If `g` and `b` are\n * not provided, it can be hexadecimal triplet, a CSS-style string or another `Color` instance.\n * @param {number} [g] - The green component.\n * @param {number} [b] - The blue component.\n */\n constructor(e, t, n) {\n return this.isColor = !0, this.r = 1, this.g = 1, this.b = 1, this.set(e, t, n);\n }\n /**\n * Sets the colors's components from the given values.\n *\n * @param {(number|string|Color)} [r] - The red component of the color. If `g` and `b` are\n * not provided, it can be hexadecimal triplet, a CSS-style string or another `Color` instance.\n * @param {number} [g] - The green component.\n * @param {number} [b] - The blue component.\n * @return {Color} A reference to this color.\n */\n set(e, t, n) {\n if (t === void 0 && n === void 0) {\n const s = e;\n s && s.isColor ? this.copy(s) : typeof s == \"number\" ? this.setHex(s) : typeof s == \"string\" && this.setStyle(s);\n } else\n this.setRGB(e, t, n);\n return this;\n }\n /**\n * Sets the colors's components to the given scalar value.\n *\n * @param {number} scalar - The scalar value.\n * @return {Color} A reference to this color.\n */\n setScalar(e) {\n return this.r = e, this.g = e, this.b = e, this;\n }\n /**\n * Sets this color from a hexadecimal value.\n *\n * @param {number} hex - The hexadecimal value.\n * @param {string} [colorSpace=SRGBColorSpace] - The color space.\n * @return {Color} A reference to this color.\n */\n setHex(e, t = Rt) {\n return e = Math.floor(e), this.r = (e >> 16 & 255) / 255, this.g = (e >> 8 & 255) / 255, this.b = (e & 255) / 255, Ye.colorSpaceToWorking(this, t), this;\n }\n /**\n * Sets this color from RGB values.\n *\n * @param {number} r - Red channel value between `0.0` and `1.0`.\n * @param {number} g - Green channel value between `0.0` and `1.0`.\n * @param {number} b - Blue channel value between `0.0` and `1.0`.\n * @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space.\n * @return {Color} A reference to this color.\n */\n setRGB(e, t, n, s = Ye.workingColorSpace) {\n return this.r = e, this.g = t, this.b = n, Ye.colorSpaceToWorking(this, s), this;\n }\n /**\n * Sets this color from RGB values.\n *\n * @param {number} h - Hue value between `0.0` and `1.0`.\n * @param {number} s - Saturation value between `0.0` and `1.0`.\n * @param {number} l - Lightness value between `0.0` and `1.0`.\n * @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space.\n * @return {Color} A reference to this color.\n */\n setHSL(e, t, n, s = Ye.workingColorSpace) {\n if (e = Do(e, 1), t = He(t, 0, 1), n = He(n, 0, 1), t === 0)\n this.r = this.g = this.b = n;\n else {\n const r = n <= 0.5 ? n * (1 + t) : n + t - n * t, a = 2 * n - r;\n this.r = ea(a, r, e + 1 / 3), this.g = ea(a, r, e), this.b = ea(a, r, e - 1 / 3);\n }\n return Ye.colorSpaceToWorking(this, s), this;\n }\n /**\n * Sets this color from a CSS-style string. For example, `rgb(250, 0,0)`,\n * `rgb(100%, 0%, 0%)`, `hsl(0, 100%, 50%)`, `#ff0000`, `#f00`, or `red` ( or\n * any [X11 color name](https://en.wikipedia.org/wiki/X11_color_names#Color_name_chart) -\n * all 140 color names are supported).\n *\n * @param {string} style - Color as a CSS-style string.\n * @param {string} [colorSpace=SRGBColorSpace] - The color space.\n * @return {Color} A reference to this color.\n */\n setStyle(e, t = Rt) {\n function n(r) {\n r !== void 0 && parseFloat(r) < 1 && Te(\"Color: Alpha component of \" + e + \" will be ignored.\");\n }\n let s;\n if (s = /^(\\w+)\\(([^\\)]*)\\)/.exec(e)) {\n let r;\n const a = s[1], o = s[2];\n switch (a) {\n case \"rgb\":\n case \"rgba\":\n if (r = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(o))\n return n(r[4]), this.setRGB(\n Math.min(255, parseInt(r[1], 10)) / 255,\n Math.min(255, parseInt(r[2], 10)) / 255,\n Math.min(255, parseInt(r[3], 10)) / 255,\n t\n );\n if (r = /^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(o))\n return n(r[4]), this.setRGB(\n Math.min(100, parseInt(r[1], 10)) / 100,\n Math.min(100, parseInt(r[2], 10)) / 100,\n Math.min(100, parseInt(r[3], 10)) / 100,\n t\n );\n break;\n case \"hsl\":\n case \"hsla\":\n if (r = /^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(o))\n return n(r[4]), this.setHSL(\n parseFloat(r[1]) / 360,\n parseFloat(r[2]) / 100,\n parseFloat(r[3]) / 100,\n t\n );\n break;\n default:\n Te(\"Color: Unknown color model \" + e);\n }\n } else if (s = /^\\#([A-Fa-f\\d]+)$/.exec(e)) {\n const r = s[1], a = r.length;\n if (a === 3)\n return this.setRGB(\n parseInt(r.charAt(0), 16) / 15,\n parseInt(r.charAt(1), 16) / 15,\n parseInt(r.charAt(2), 16) / 15,\n t\n );\n if (a === 6)\n return this.setHex(parseInt(r, 16), t);\n Te(\"Color: Invalid hex color \" + e);\n } else if (e && e.length > 0)\n return this.setColorName(e, t);\n return this;\n }\n /**\n * Sets this color from a color name. Faster than {@link Color#setStyle} if\n * you don't need the other CSS-style formats.\n *\n * For convenience, the list of names is exposed in `Color.NAMES` as a hash.\n * ```js\n * Color.NAMES.aliceblue // returns 0xF0F8FF\n * ```\n *\n * @param {string} style - The color name.\n * @param {string} [colorSpace=SRGBColorSpace] - The color space.\n * @return {Color} A reference to this color.\n */\n setColorName(e, t = Rt) {\n const n = Qc[e.toLowerCase()];\n return n !== void 0 ? this.setHex(n, t) : Te(\"Color: Unknown color \" + e), this;\n }\n /**\n * Returns a new color with copied values from this instance.\n *\n * @return {Color} A clone of this instance.\n */\n clone() {\n return new this.constructor(this.r, this.g, this.b);\n }\n /**\n * Copies the values of the given color to this instance.\n *\n * @param {Color} color - The color to copy.\n * @return {Color} A reference to this color.\n */\n copy(e) {\n return this.r = e.r, this.g = e.g, this.b = e.b, this;\n }\n /**\n * Copies the given color into this color, and then converts this color from\n * `SRGBColorSpace` to `LinearSRGBColorSpace`.\n *\n * @param {Color} color - The color to copy/convert.\n * @return {Color} A reference to this color.\n */\n copySRGBToLinear(e) {\n return this.r = Vn(e.r), this.g = Vn(e.g), this.b = Vn(e.b), this;\n }\n /**\n * Copies the given color into this color, and then converts this color from\n * `LinearSRGBColorSpace` to `SRGBColorSpace`.\n *\n * @param {Color} color - The color to copy/convert.\n * @return {Color} A reference to this color.\n */\n copyLinearToSRGB(e) {\n return this.r = Oi(e.r), this.g = Oi(e.g), this.b = Oi(e.b), this;\n }\n /**\n * Converts this color from `SRGBColorSpace` to `LinearSRGBColorSpace`.\n *\n * @return {Color} A reference to this color.\n */\n convertSRGBToLinear() {\n return this.copySRGBToLinear(this), this;\n }\n /**\n * Converts this color from `LinearSRGBColorSpace` to `SRGBColorSpace`.\n *\n * @return {Color} A reference to this color.\n */\n convertLinearToSRGB() {\n return this.copyLinearToSRGB(this), this;\n }\n /**\n * Returns the hexadecimal value of this color.\n *\n * @param {string} [colorSpace=SRGBColorSpace] - The color space.\n * @return {number} The hexadecimal value.\n */\n getHex(e = Rt) {\n return Ye.workingToColorSpace(It.copy(this), e), Math.round(He(It.r * 255, 0, 255)) * 65536 + Math.round(He(It.g * 255, 0, 255)) * 256 + Math.round(He(It.b * 255, 0, 255));\n }\n /**\n * Returns the hexadecimal value of this color as a string (for example, 'FFFFFF').\n *\n * @param {string} [colorSpace=SRGBColorSpace] - The color space.\n * @return {string} The hexadecimal value as a string.\n */\n getHexString(e = Rt) {\n return (\"000000\" + this.getHex(e).toString(16)).slice(-6);\n }\n /**\n * Converts the colors RGB values into the HSL format and stores them into the\n * given target object.\n *\n * @param {{h:number,s:number,l:number}} target - The target object that is used to store the method's result.\n * @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space.\n * @return {{h:number,s:number,l:number}} The HSL representation of this color.\n */\n getHSL(e, t = Ye.workingColorSpace) {\n Ye.workingToColorSpace(It.copy(this), t);\n const n = It.r, s = It.g, r = It.b, a = Math.max(n, s, r), o = Math.min(n, s, r);\n let l, c;\n const h = (o + a) / 2;\n if (o === a)\n l = 0, c = 0;\n else {\n const u = a - o;\n switch (c = h <= 0.5 ? u / (a + o) : u / (2 - a - o), a) {\n case n:\n l = (s - r) / u + (s < r ? 6 : 0);\n break;\n case s:\n l = (r - n) / u + 2;\n break;\n case r:\n l = (n - s) / u + 4;\n break;\n }\n l /= 6;\n }\n return e.h = l, e.s = c, e.l = h, e;\n }\n /**\n * Returns the RGB values of this color and stores them into the given target object.\n *\n * @param {Color} target - The target color that is used to store the method's result.\n * @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space.\n * @return {Color} The RGB representation of this color.\n */\n getRGB(e, t = Ye.workingColorSpace) {\n return Ye.workingToColorSpace(It.copy(this), t), e.r = It.r, e.g = It.g, e.b = It.b, e;\n }\n /**\n * Returns the value of this color as a CSS style string. Example: `rgb(255,0,0)`.\n *\n * @param {string} [colorSpace=SRGBColorSpace] - The color space.\n * @return {string} The CSS representation of this color.\n */\n getStyle(e = Rt) {\n Ye.workingToColorSpace(It.copy(this), e);\n const t = It.r, n = It.g, s = It.b;\n return e !== Rt ? `color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${s.toFixed(3)})` : `rgb(${Math.round(t * 255)},${Math.round(n * 255)},${Math.round(s * 255)})`;\n }\n /**\n * Adds the given HSL values to this color's values.\n * Internally, this converts the color's RGB values to HSL, adds HSL\n * and then converts the color back to RGB.\n *\n * @param {number} h - Hue value between `0.0` and `1.0`.\n * @param {number} s - Saturation value between `0.0` and `1.0`.\n * @param {number} l - Lightness value between `0.0` and `1.0`.\n * @return {Color} A reference to this color.\n */\n offsetHSL(e, t, n) {\n return this.getHSL(jn), this.setHSL(jn.h + e, jn.s + t, jn.l + n);\n }\n /**\n * Adds the RGB values of the given color to the RGB values of this color.\n *\n * @param {Color} color - The color to add.\n * @return {Color} A reference to this color.\n */\n add(e) {\n return this.r += e.r, this.g += e.g, this.b += e.b, this;\n }\n /**\n * Adds the RGB values of the given colors and stores the result in this instance.\n *\n * @param {Color} color1 - The first color.\n * @param {Color} color2 - The second color.\n * @return {Color} A reference to this color.\n */\n addColors(e, t) {\n return this.r = e.r + t.r, this.g = e.g + t.g, this.b = e.b + t.b, this;\n }\n /**\n * Adds the given scalar value to the RGB values of this color.\n *\n * @param {number} s - The scalar to add.\n * @return {Color} A reference to this color.\n */\n addScalar(e) {\n return this.r += e, this.g += e, this.b += e, this;\n }\n /**\n * Subtracts the RGB values of the given color from the RGB values of this color.\n *\n * @param {Color} color - The color to subtract.\n * @return {Color} A reference to this color.\n */\n sub(e) {\n return this.r = Math.max(0, this.r - e.r), this.g = Math.max(0, this.g - e.g), this.b = Math.max(0, this.b - e.b), this;\n }\n /**\n * Multiplies the RGB values of the given color with the RGB values of this color.\n *\n * @param {Color} color - The color to multiply.\n * @return {Color} A reference to this color.\n */\n multiply(e) {\n return this.r *= e.r, this.g *= e.g, this.b *= e.b, this;\n }\n /**\n * Multiplies the given scalar value with the RGB values of this color.\n *\n * @param {number} s - The scalar to multiply.\n * @return {Color} A reference to this color.\n */\n multiplyScalar(e) {\n return this.r *= e, this.g *= e, this.b *= e, this;\n }\n /**\n * Linearly interpolates this color's RGB values toward the RGB values of the\n * given color. The alpha argument can be thought of as the ratio between\n * the two colors, where `0.0` is this color and `1.0` is the first argument.\n *\n * @param {Color} color - The color to converge on.\n * @param {number} alpha - The interpolation factor in the closed interval `[0,1]`.\n * @return {Color} A reference to this color.\n */\n lerp(e, t) {\n return this.r += (e.r - this.r) * t, this.g += (e.g - this.g) * t, this.b += (e.b - this.b) * t, this;\n }\n /**\n * Linearly interpolates between the given colors and stores the result in this instance.\n * The alpha argument can be thought of as the ratio between the two colors, where `0.0`\n * is the first and `1.0` is the second color.\n *\n * @param {Color} color1 - The first color.\n * @param {Color} color2 - The second color.\n * @param {number} alpha - The interpolation factor in the closed interval `[0,1]`.\n * @return {Color} A reference to this color.\n */\n lerpColors(e, t, n) {\n return this.r = e.r + (t.r - e.r) * n, this.g = e.g + (t.g - e.g) * n, this.b = e.b + (t.b - e.b) * n, this;\n }\n /**\n * Linearly interpolates this color's HSL values toward the HSL values of the\n * given color. It differs from {@link Color#lerp} by not interpolating straight\n * from one color to the other, but instead going through all the hues in between\n * those two colors. The alpha argument can be thought of as the ratio between\n * the two colors, where 0.0 is this color and 1.0 is the first argument.\n *\n * @param {Color} color - The color to converge on.\n * @param {number} alpha - The interpolation factor in the closed interval `[0,1]`.\n * @return {Color} A reference to this color.\n */\n lerpHSL(e, t) {\n this.getHSL(jn), e.getHSL(ks);\n const n = vs(jn.h, ks.h, t), s = vs(jn.s, ks.s, t), r = vs(jn.l, ks.l, t);\n return this.setHSL(n, s, r), this;\n }\n /**\n * Sets the color's RGB components from the given 3D vector.\n *\n * @param {Vector3} v - The vector to set.\n * @return {Color} A reference to this color.\n */\n setFromVector3(e) {\n return this.r = e.x, this.g = e.y, this.b = e.z, this;\n }\n /**\n * Transforms this color with the given 3x3 matrix.\n *\n * @param {Matrix3} m - The matrix.\n * @return {Color} A reference to this color.\n */\n applyMatrix3(e) {\n const t = this.r, n = this.g, s = this.b, r = e.elements;\n return this.r = r[0] * t + r[3] * n + r[6] * s, this.g = r[1] * t + r[4] * n + r[7] * s, this.b = r[2] * t + r[5] * n + r[8] * s, this;\n }\n /**\n * Returns `true` if this color is equal with the given one.\n *\n * @param {Color} c - The color to test for equality.\n * @return {boolean} Whether this bounding color is equal with the given one.\n */\n equals(e) {\n return e.r === this.r && e.g === this.g && e.b === this.b;\n }\n /**\n * Sets this color's RGB components from the given array.\n *\n * @param {Array} array - An array holding the RGB values.\n * @param {number} [offset=0] - The offset into the array.\n * @return {Color} A reference to this color.\n */\n fromArray(e, t = 0) {\n return this.r = e[t], this.g = e[t + 1], this.b = e[t + 2], this;\n }\n /**\n * Writes the RGB components of this color to the given array. If no array is provided,\n * the method returns a new instance.\n *\n * @param {Array} [array=[]] - The target array holding the color components.\n * @param {number} [offset=0] - Index of the first element in the array.\n * @return {Array} The color components.\n */\n toArray(e = [], t = 0) {\n return e[t] = this.r, e[t + 1] = this.g, e[t + 2] = this.b, e;\n }\n /**\n * Sets the components of this color from the given buffer attribute.\n *\n * @param {BufferAttribute} attribute - The buffer attribute holding color data.\n * @param {number} index - The index into the attribute.\n * @return {Color} A reference to this color.\n */\n fromBufferAttribute(e, t) {\n return this.r = e.getX(t), this.g = e.getY(t), this.b = e.getZ(t), this;\n }\n /**\n * This methods defines the serialization result of this class. Returns the color\n * as a hexadecimal value.\n *\n * @return {number} The hexadecimal value.\n */\n toJSON() {\n return this.getHex();\n }\n *[Symbol.iterator]() {\n yield this.r, yield this.g, yield this.b;\n }\n}\nconst It = /* @__PURE__ */ new Se();\nSe.NAMES = Qc;\nlet Hu = 0;\nclass tn extends mi {\n /**\n * Constructs a new material.\n */\n constructor() {\n super(), this.isMaterial = !0, Object.defineProperty(this, \"id\", { value: Hu++ }), this.uuid = fn(), this.name = \"\", this.type = \"Material\", this.blending = Fi, this.side = En, this.vertexColors = !1, this.opacity = 1, this.transparent = !1, this.alphaHash = !1, this.blendSrc = ba, this.blendDst = ya, this.blendEquation = cn, this.blendSrcAlpha = null, this.blendDstAlpha = null, this.blendEquationAlpha = null, this.blendColor = new Se(0, 0, 0), this.blendAlpha = 0, this.depthFunc = Vi, this.depthTest = !0, this.depthWrite = !0, this.stencilWriteMask = 255, this.stencilFunc = co, this.stencilRef = 0, this.stencilFuncMask = 255, this.stencilFail = xi, this.stencilZFail = xi, this.stencilZPass = xi, this.stencilWrite = !1, this.clippingPlanes = null, this.clipIntersection = !1, this.clipShadows = !1, this.shadowSide = null, this.colorWrite = !0, this.precision = null, this.polygonOffset = !1, this.polygonOffsetFactor = 0, this.polygonOffsetUnits = 0, this.dithering = !1, this.alphaToCoverage = !1, this.premultipliedAlpha = !1, this.forceSinglePass = !1, this.allowOverride = !0, this.visible = !0, this.toneMapped = !0, this.userData = {}, this.version = 0, this._alphaTest = 0;\n }\n /**\n * Sets the alpha value to be used when running an alpha test. The material\n * will not be rendered if the opacity is lower than this value.\n *\n * @type {number}\n * @readonly\n * @default 0\n */\n get alphaTest() {\n return this._alphaTest;\n }\n set alphaTest(e) {\n this._alphaTest > 0 != e > 0 && this.version++, this._alphaTest = e;\n }\n /**\n * An optional callback that is executed immediately before the material is used to render a 3D object.\n *\n * This method can only be used when rendering with {@link WebGLRenderer}.\n *\n * @param {WebGLRenderer} renderer - The renderer.\n * @param {Scene} scene - The scene.\n * @param {Camera} camera - The camera that is used to render the scene.\n * @param {BufferGeometry} geometry - The 3D object's geometry.\n * @param {Object3D} object - The 3D object.\n * @param {Object} group - The geometry group data.\n */\n onBeforeRender() {\n }\n /**\n * An optional callback that is executed immediately before the shader\n * program is compiled. This function is called with the shader source code\n * as a parameter. Useful for the modification of built-in materials.\n *\n * This method can only be used when rendering with {@link WebGLRenderer}. The\n * recommended approach when customizing materials is to use `WebGPURenderer` with the new\n * Node Material system and [TSL](https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language).\n *\n * @param {{vertexShader:string,fragmentShader:string,uniforms:Object}} shaderobject - The object holds the uniforms and the vertex and fragment shader source.\n * @param {WebGLRenderer} renderer - A reference to the renderer.\n */\n onBeforeCompile() {\n }\n /**\n * In case {@link Material#onBeforeCompile} is used, this callback can be used to identify\n * values of settings used in `onBeforeCompile()`, so three.js can reuse a cached\n * shader or recompile the shader for this material as needed.\n *\n * This method can only be used when rendering with {@link WebGLRenderer}.\n *\n * @return {string} The custom program cache key.\n */\n customProgramCacheKey() {\n return this.onBeforeCompile.toString();\n }\n /**\n * This method can be used to set default values from parameter objects.\n * It is a generic implementation so it can be used with different types\n * of materials.\n *\n * @param {Object} [values] - The material values to set.\n */\n setValues(e) {\n if (e !== void 0)\n for (const t in e) {\n const n = e[t];\n if (n === void 0) {\n Te(`Material: parameter '${t}' has value of undefined.`);\n continue;\n }\n const s = this[t];\n if (s === void 0) {\n Te(`Material: '${t}' is not a property of THREE.${this.type}.`);\n continue;\n }\n s && s.isColor ? s.set(n) : s && s.isVector3 && n && n.isVector3 ? s.copy(n) : this[t] = n;\n }\n }\n /**\n * Serializes the material into JSON.\n *\n * @param {?(Object|string)} meta - An optional value holding meta information about the serialization.\n * @return {Object} A JSON object representing the serialized material.\n * @see {@link ObjectLoader#parse}\n */\n toJSON(e) {\n const t = e === void 0 || typeof e == \"string\";\n t && (e = {\n textures: {},\n images: {}\n });\n const n = {\n metadata: {\n version: 4.7,\n type: \"Material\",\n generator: \"Material.toJSON\"\n }\n };\n n.uuid = this.uuid, n.type = this.type, this.name !== \"\" && (n.name = this.name), this.color && this.color.isColor && (n.color = this.color.getHex()), this.roughness !== void 0 && (n.roughness = this.roughness), this.metalness !== void 0 && (n.metalness = this.metalness), this.sheen !== void 0 && (n.sheen = this.sheen), this.sheenColor && this.sheenColor.isColor && (n.sheenColor = this.sheenColor.getHex()), this.sheenRoughness !== void 0 && (n.sheenRoughness = this.sheenRoughness), this.emissive && this.emissive.isColor && (n.emissive = this.emissive.getHex()), this.emissiveIntensity !== void 0 && this.emissiveIntensity !== 1 && (n.emissiveIntensity = this.emissiveIntensity), this.specular && this.specular.isColor && (n.specular = this.specular.getHex()), this.specularIntensity !== void 0 && (n.specularIntensity = this.specularIntensity), this.specularColor && this.specularColor.isColor && (n.specularColor = this.specularColor.getHex()), this.shininess !== void 0 && (n.shininess = this.shininess), this.clearcoat !== void 0 && (n.clearcoat = this.clearcoat), this.clearcoatRoughness !== void 0 && (n.clearcoatRoughness = this.clearcoatRoughness), this.clearcoatMap && this.clearcoatMap.isTexture && (n.clearcoatMap = this.clearcoatMap.toJSON(e).uuid), this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture && (n.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(e).uuid), this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture && (n.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(e).uuid, n.clearcoatNormalScale = this.clearcoatNormalScale.toArray()), this.sheenColorMap && this.sheenColorMap.isTexture && (n.sheenColorMap = this.sheenColorMap.toJSON(e).uuid), this.sheenRoughnessMap && this.sheenRoughnessMap.isTexture && (n.sheenRoughnessMap = this.sheenRoughnessMap.toJSON(e).uuid), this.dispersion !== void 0 && (n.dispersion = this.dispersion), this.iridescence !== void 0 && (n.iridescence = this.iridescence), this.iridescenceIOR !== void 0 && (n.iridescenceIOR = this.iridescenceIOR), this.iridescenceThicknessRange !== void 0 && (n.iridescenceThicknessRange = this.iridescenceThicknessRange), this.iridescenceMap && this.iridescenceMap.isTexture && (n.iridescenceMap = this.iridescenceMap.toJSON(e).uuid), this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture && (n.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON(e).uuid), this.anisotropy !== void 0 && (n.anisotropy = this.anisotropy), this.anisotropyRotation !== void 0 && (n.anisotropyRotation = this.anisotropyRotation), this.anisotropyMap && this.anisotropyMap.isTexture && (n.anisotropyMap = this.anisotropyMap.toJSON(e).uuid), this.map && this.map.isTexture && (n.map = this.map.toJSON(e).uuid), this.matcap && this.matcap.isTexture && (n.matcap = this.matcap.toJSON(e).uuid), this.alphaMap && this.alphaMap.isTexture && (n.alphaMap = this.alphaMap.toJSON(e).uuid), this.lightMap && this.lightMap.isTexture && (n.lightMap = this.lightMap.toJSON(e).uuid, n.lightMapIntensity = this.lightMapIntensity), this.aoMap && this.aoMap.isTexture && (n.aoMap = this.aoMap.toJSON(e).uuid, n.aoMapIntensity = this.aoMapIntensity), this.bumpMap && this.bumpMap.isTexture && (n.bumpMap = this.bumpMap.toJSON(e).uuid, n.bumpScale = this.bumpScale), this.normalMap && this.normalMap.isTexture && (n.normalMap = this.normalMap.toJSON(e).uuid, n.normalMapType = this.normalMapType, n.normalScale = this.normalScale.toArray()), this.displacementMap && this.displacementMap.isTexture && (n.displacementMap = this.displacementMap.toJSON(e).uuid, n.displacementScale = this.displacementScale, n.displacementBias = this.displacementBias), this.roughnessMap && this.roughnessMap.isTexture && (n.roughnessMap = this.roughnessMap.toJSON(e).uuid), this.metalnessMap && this.metalnessMap.isTexture && (n.metalnessMap = this.metalnessMap.toJSON(e).uuid), this.emissiveMap && this.emissiveMap.isTexture && (n.emissiveMap = this.emissiveMap.toJSON(e).uuid), this.specularMap && this.specularMap.isTexture && (n.specularMap = this.specularMap.toJSON(e).uuid), this.specularIntensityMap && this.specularIntensityMap.isTexture && (n.specularIntensityMap = this.specularIntensityMap.toJSON(e).uuid), this.specularColorMap && this.specularColorMap.isTexture && (n.specularColorMap = this.specularColorMap.toJSON(e).uuid), this.envMap && this.envMap.isTexture && (n.envMap = this.envMap.toJSON(e).uuid, this.combine !== void 0 && (n.combine = this.combine)), this.envMapRotation !== void 0 && (n.envMapRotation = this.envMapRotation.toArray()), this.envMapIntensity !== void 0 && (n.envMapIntensity = this.envMapIntensity), this.reflectivity !== void 0 && (n.reflectivity = this.reflectivity), this.refractionRatio !== void 0 && (n.refractionRatio = this.refractionRatio), this.gradientMap && this.gradientMap.isTexture && (n.gradientMap = this.gradientMap.toJSON(e).uuid), this.transmission !== void 0 && (n.transmission = this.transmission), this.transmissionMap && this.transmissionMap.isTexture && (n.transmissionMap = this.transmissionMap.toJSON(e).uuid), this.thickness !== void 0 && (n.thickness = this.thickness), this.thicknessMap && this.thicknessMap.isTexture && (n.thicknessMap = this.thicknessMap.toJSON(e).uuid), this.attenuationDistance !== void 0 && this.attenuationDistance !== 1 / 0 && (n.attenuationDistance = this.attenuationDistance), this.attenuationColor !== void 0 && (n.attenuationColor = this.attenuationColor.getHex()), this.size !== void 0 && (n.size = this.size), this.shadowSide !== null && (n.shadowSide = this.shadowSide), this.sizeAttenuation !== void 0 && (n.sizeAttenuation = this.sizeAttenuation), this.blending !== Fi && (n.blending = this.blending), this.side !== En && (n.side = this.side), this.vertexColors === !0 && (n.vertexColors = !0), this.opacity < 1 && (n.opacity = this.opacity), this.transparent === !0 && (n.transparent = !0), this.blendSrc !== ba && (n.blendSrc = this.blendSrc), this.blendDst !== ya && (n.blendDst = this.blendDst), this.blendEquation !== cn && (n.blendEquation = this.blendEquation), this.blendSrcAlpha !== null && (n.blendSrcAlpha = this.blendSrcAlpha), this.blendDstAlpha !== null && (n.blendDstAlpha = this.blendDstAlpha), this.blendEquationAlpha !== null && (n.blendEquationAlpha = this.blendEquationAlpha), this.blendColor && this.blendColor.isColor && (n.blendColor = this.blendColor.getHex()), this.blendAlpha !== 0 && (n.blendAlpha = this.blendAlpha), this.depthFunc !== Vi && (n.depthFunc = this.depthFunc), this.depthTest === !1 && (n.depthTest = this.depthTest), this.depthWrite === !1 && (n.depthWrite = this.depthWrite), this.colorWrite === !1 && (n.colorWrite = this.colorWrite), this.stencilWriteMask !== 255 && (n.stencilWriteMask = this.stencilWriteMask), this.stencilFunc !== co && (n.stencilFunc = this.stencilFunc), this.stencilRef !== 0 && (n.stencilRef = this.stencilRef), this.stencilFuncMask !== 255 && (n.stencilFuncMask = this.stencilFuncMask), this.stencilFail !== xi && (n.stencilFail = this.stencilFail), this.stencilZFail !== xi && (n.stencilZFail = this.stencilZFail), this.stencilZPass !== xi && (n.stencilZPass = this.stencilZPass), this.stencilWrite === !0 && (n.stencilWrite = this.stencilWrite), this.rotation !== void 0 && this.rotation !== 0 && (n.rotation = this.rotation), this.polygonOffset === !0 && (n.polygonOffset = !0), this.polygonOffsetFactor !== 0 && (n.polygonOffsetFactor = this.polygonOffsetFactor), this.polygonOffsetUnits !== 0 && (n.polygonOffsetUnits = this.polygonOffsetUnits), this.linewidth !== void 0 && this.linewidth !== 1 && (n.linewidth = this.linewidth), this.dashSize !== void 0 && (n.dashSize = this.dashSize), this.gapSize !== void 0 && (n.gapSize = this.gapSize), this.scale !== void 0 && (n.scale = this.scale), this.dithering === !0 && (n.dithering = !0), this.alphaTest > 0 && (n.alphaTest = this.alphaTest), this.alphaHash === !0 && (n.alphaHash = !0), this.alphaToCoverage === !0 && (n.alphaToCoverage = !0), this.premultipliedAlpha === !0 && (n.premultipliedAlpha = !0), this.forceSinglePass === !0 && (n.forceSinglePass = !0), this.wireframe === !0 && (n.wireframe = !0), this.wireframeLinewidth > 1 && (n.wireframeLinewidth = this.wireframeLinewidth), this.wireframeLinecap !== \"round\" && (n.wireframeLinecap = this.wireframeLinecap), this.wireframeLinejoin !== \"round\" && (n.wireframeLinejoin = this.wireframeLinejoin), this.flatShading === !0 && (n.flatShading = !0), this.visible === !1 && (n.visible = !1), this.toneMapped === !1 && (n.toneMapped = !1), this.fog === !1 && (n.fog = !1), Object.keys(this.userData).length > 0 && (n.userData = this.userData);\n function s(r) {\n const a = [];\n for (const o in r) {\n const l = r[o];\n delete l.metadata, a.push(l);\n }\n return a;\n }\n if (t) {\n const r = s(e.textures), a = s(e.images);\n r.length > 0 && (n.textures = r), a.length > 0 && (n.images = a);\n }\n return n;\n }\n /**\n * Returns a new material with copied values from this instance.\n *\n * @return {Material} A clone of this instance.\n */\n clone() {\n return new this.constructor().copy(this);\n }\n /**\n * Copies the values of the given material to this instance.\n *\n * @param {Material} source - The material to copy.\n * @return {Material} A reference to this instance.\n */\n copy(e) {\n this.name = e.name, this.blending = e.blending, this.side = e.side, this.vertexColors = e.vertexColors, this.opacity = e.opacity, this.transparent = e.transparent, this.blendSrc = e.blendSrc, this.blendDst = e.blendDst, this.blendEquation = e.blendEquation, this.blendSrcAlpha = e.blendSrcAlpha, this.blendDstAlpha = e.blendDstAlpha, this.blendEquationAlpha = e.blendEquationAlpha, this.blendColor.copy(e.blendColor), this.blendAlpha = e.blendAlpha, this.depthFunc = e.depthFunc, this.depthTest = e.depthTest, this.depthWrite = e.depthWrite, this.stencilWriteMask = e.stencilWriteMask, this.stencilFunc = e.stencilFunc, this.stencilRef = e.stencilRef, this.stencilFuncMask = e.stencilFuncMask, this.stencilFail = e.stencilFail, this.stencilZFail = e.stencilZFail, this.stencilZPass = e.stencilZPass, this.stencilWrite = e.stencilWrite;\n const t = e.clippingPlanes;\n let n = null;\n if (t !== null) {\n const s = t.length;\n n = new Array(s);\n for (let r = 0; r !== s; ++r)\n n[r] = t[r].clone();\n }\n return this.clippingPlanes = n, this.clipIntersection = e.clipIntersection, this.clipShadows = e.clipShadows, this.shadowSide = e.shadowSide, this.colorWrite = e.colorWrite, this.precision = e.precision, this.polygonOffset = e.polygonOffset, this.polygonOffsetFactor = e.polygonOffsetFactor, this.polygonOffsetUnits = e.polygonOffsetUnits, this.dithering = e.dithering, this.alphaTest = e.alphaTest, this.alphaHash = e.alphaHash, this.alphaToCoverage = e.alphaToCoverage, this.premultipliedAlpha = e.premultipliedAlpha, this.forceSinglePass = e.forceSinglePass, this.visible = e.visible, this.toneMapped = e.toneMapped, this.userData = JSON.parse(JSON.stringify(e.userData)), this;\n }\n /**\n * Frees the GPU-related resources allocated by this instance. Call this\n * method whenever this instance is no longer used in your app.\n *\n * @fires Material#dispose\n */\n dispose() {\n this.dispatchEvent({ type: \"dispose\" });\n }\n /**\n * Setting this property to `true` indicates the engine the material\n * needs to be recompiled.\n *\n * @type {boolean}\n * @default false\n * @param {boolean} value\n */\n set needsUpdate(e) {\n e === !0 && this.version++;\n }\n}\nclass Bt extends tn {\n /**\n * Constructs a new mesh basic material.\n *\n * @param {Object} [parameters] - An object with one or more properties\n * defining the material's appearance. Any property of the material\n * (including any property from inherited materials) can be passed\n * in here. Color values can be passed any type of value accepted\n * by {@link Color#set}.\n */\n constructor(e) {\n super(), this.isMeshBasicMaterial = !0, this.type = \"MeshBasicMaterial\", this.color = new Se(16777215), this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.envMapRotation = new xn(), this.combine = So, this.reflectivity = 1, this.refractionRatio = 0.98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = \"round\", this.wireframeLinejoin = \"round\", this.fog = !0, this.setValues(e);\n }\n copy(e) {\n return super.copy(e), this.color.copy(e.color), this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.specularMap = e.specularMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.envMapRotation.copy(e.envMapRotation), this.combine = e.combine, this.reflectivity = e.reflectivity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.fog = e.fog, this;\n }\n}\nconst Bn = /* @__PURE__ */ Wu();\nfunction Wu() {\n const i = new ArrayBuffer(4), e = new Float32Array(i), t = new Uint32Array(i), n = new Uint32Array(512), s = new Uint32Array(512);\n for (let l = 0; l < 256; ++l) {\n const c = l - 127;\n c < -27 ? (n[l] = 0, n[l | 256] = 32768, s[l] = 24, s[l | 256] = 24) : c < -14 ? (n[l] = 1024 >> -c - 14, n[l | 256] = 1024 >> -c - 14 | 32768, s[l] = -c - 1, s[l | 256] = -c - 1) : c <= 15 ? (n[l] = c + 15 << 10, n[l | 256] = c + 15 << 10 | 32768, s[l] = 13, s[l | 256] = 13) : c < 128 ? (n[l] = 31744, n[l | 256] = 64512, s[l] = 24, s[l | 256] = 24) : (n[l] = 31744, n[l | 256] = 64512, s[l] = 13, s[l | 256] = 13);\n }\n const r = new Uint32Array(2048), a = new Uint32Array(64), o = new Uint32Array(64);\n for (let l = 1; l < 1024; ++l) {\n let c = l << 13, h = 0;\n for (; (c & 8388608) === 0; )\n c <<= 1, h -= 8388608;\n c &= -8388609, h += 947912704, r[l] = c | h;\n }\n for (let l = 1024; l < 2048; ++l)\n r[l] = 939524096 + (l - 1024 << 13);\n for (let l = 1; l < 31; ++l)\n a[l] = l << 23;\n a[31] = 1199570944, a[32] = 2147483648;\n for (let l = 33; l < 63; ++l)\n a[l] = 2147483648 + (l - 32 << 23);\n a[63] = 3347054592;\n for (let l = 1; l < 64; ++l)\n l !== 32 && (o[l] = 1024);\n return {\n floatView: e,\n uint32View: t,\n baseTable: n,\n shiftTable: s,\n mantissaTable: r,\n exponentTable: a,\n offsetTable: o\n };\n}\nfunction Xu(i) {\n Math.abs(i) > 65504 && Te(\"DataUtils.toHalfFloat(): Value out of range.\"), i = He(i, -65504, 65504), Bn.floatView[0] = i;\n const e = Bn.uint32View[0], t = e >> 23 & 511;\n return Bn.baseTable[t] + ((e & 8388607) >> Bn.shiftTable[t]);\n}\nfunction ju(i) {\n const e = i >> 10;\n return Bn.uint32View[0] = Bn.mantissaTable[Bn.offsetTable[e] + (i & 1023)] + Bn.exponentTable[e], Bn.floatView[0];\n}\nclass Vs {\n /**\n * Returns a half precision floating point value (FP16) from the given single\n * precision floating point value (FP32).\n *\n * @param {number} val - A single precision floating point value.\n * @return {number} The FP16 value.\n */\n static toHalfFloat(e) {\n return Xu(e);\n }\n /**\n * Returns a single precision floating point value (FP32) from the given half\n * precision floating point value (FP16).\n *\n * @param {number} val - A half precision floating point value.\n * @return {number} The FP32 value.\n */\n static fromHalfFloat(e) {\n return ju(e);\n }\n}\nconst vt = /* @__PURE__ */ new w(), Gs = /* @__PURE__ */ new le();\nlet qu = 0;\nclass kt {\n /**\n * Constructs a new buffer attribute.\n *\n * @param {TypedArray} array - The array holding the attribute data.\n * @param {number} itemSize - The item size.\n * @param {boolean} [normalized=false] - Whether the data are normalized or not.\n */\n constructor(e, t, n = !1) {\n if (Array.isArray(e))\n throw new TypeError(\"THREE.BufferAttribute: array should be a Typed Array.\");\n this.isBufferAttribute = !0, Object.defineProperty(this, \"id\", { value: qu++ }), this.name = \"\", this.array = e, this.itemSize = t, this.count = e !== void 0 ? e.length / t : 0, this.normalized = n, this.usage = ho, this.updateRanges = [], this.gpuType = Xt, this.version = 0;\n }\n /**\n * A callback function that is executed after the renderer has transferred the attribute\n * array data to the GPU.\n */\n onUploadCallback() {\n }\n /**\n * Flag to indicate that this attribute has changed and should be re-sent to\n * the GPU. Set this to `true` when you modify the value of the array.\n *\n * @type {number}\n * @default false\n * @param {boolean} value\n */\n set needsUpdate(e) {\n e === !0 && this.version++;\n }\n /**\n * Sets the usage of this buffer attribute.\n *\n * @param {(StaticDrawUsage|DynamicDrawUsage|StreamDrawUsage|StaticReadUsage|DynamicReadUsage|StreamReadUsage|StaticCopyUsage|DynamicCopyUsage|StreamCopyUsage)} value - The usage to set.\n * @return {BufferAttribute} A reference to this buffer attribute.\n */\n setUsage(e) {\n return this.usage = e, this;\n }\n /**\n * Adds a range of data in the data array to be updated on the GPU.\n *\n * @param {number} start - Position at which to start update.\n * @param {number} count - The number of components to update.\n */\n addUpdateRange(e, t) {\n this.updateRanges.push({ start: e, count: t });\n }\n /**\n * Clears the update ranges.\n */\n clearUpdateRanges() {\n this.updateRanges.length = 0;\n }\n /**\n * Copies the values of the given buffer attribute to this instance.\n *\n * @param {BufferAttribute} source - The buffer attribute to copy.\n * @return {BufferAttribute} A reference to this instance.\n */\n copy(e) {\n return this.name = e.name, this.array = new e.array.constructor(e.array), this.itemSize = e.itemSize, this.count = e.count, this.normalized = e.normalized, this.usage = e.usage, this.gpuType = e.gpuType, this;\n }\n /**\n * Copies a vector from the given buffer attribute to this one. The start\n * and destination position in the attribute buffers are represented by the\n * given indices.\n *\n * @param {number} index1 - The destination index into this buffer attribute.\n * @param {BufferAttribute} attribute - The buffer attribute to copy from.\n * @param {number} index2 - The source index into the given buffer attribute.\n * @return {BufferAttribute} A reference to this instance.\n */\n copyAt(e, t, n) {\n e *= this.itemSize, n *= t.itemSize;\n for (let s = 0, r = this.itemSize; s < r; s++)\n this.array[e + s] = t.array[n + s];\n return this;\n }\n /**\n * Copies the given array data into this buffer attribute.\n *\n * @param {(TypedArray|Array)} array - The array to copy.\n * @return {BufferAttribute} A reference to this instance.\n */\n copyArray(e) {\n return this.array.set(e), this;\n }\n /**\n * Applies the given 3x3 matrix to the given attribute. Works with\n * item size `2` and `3`.\n *\n * @param {Matrix3} m - The matrix to apply.\n * @return {BufferAttribute} A reference to this instance.\n */\n applyMatrix3(e) {\n if (this.itemSize === 2)\n for (let t = 0, n = this.count; t < n; t++)\n Gs.fromBufferAttribute(this, t), Gs.applyMatrix3(e), this.setXY(t, Gs.x, Gs.y);\n else if (this.itemSize === 3)\n for (let t = 0, n = this.count; t < n; t++)\n vt.fromBufferAttribute(this, t), vt.applyMatrix3(e), this.setXYZ(t, vt.x, vt.y, vt.z);\n return this;\n }\n /**\n * Applies the given 4x4 matrix to the given attribute. Only works with\n * item size `3`.\n *\n * @param {Matrix4} m - The matrix to apply.\n * @return {BufferAttribute} A reference to this instance.\n */\n applyMatrix4(e) {\n for (let t = 0, n = this.count; t < n; t++)\n vt.fromBufferAttribute(this, t), vt.applyMatrix4(e), this.setXYZ(t, vt.x, vt.y, vt.z);\n return this;\n }\n /**\n * Applies the given 3x3 normal matrix to the given attribute. Only works with\n * item size `3`.\n *\n * @param {Matrix3} m - The normal matrix to apply.\n * @return {BufferAttribute} A reference to this instance.\n */\n applyNormalMatrix(e) {\n for (let t = 0, n = this.count; t < n; t++)\n vt.fromBufferAttribute(this, t), vt.applyNormalMatrix(e), this.setXYZ(t, vt.x, vt.y, vt.z);\n return this;\n }\n /**\n * Applies the given 4x4 matrix to the given attribute. Only works with\n * item size `3` and with direction vectors.\n *\n * @param {Matrix4} m - The matrix to apply.\n * @return {BufferAttribute} A reference to this instance.\n */\n transformDirection(e) {\n for (let t = 0, n = this.count; t < n; t++)\n vt.fromBufferAttribute(this, t), vt.transformDirection(e), this.setXYZ(t, vt.x, vt.y, vt.z);\n return this;\n }\n /**\n * Sets the given array data in the buffer attribute.\n *\n * @param {(TypedArray|Array)} value - The array data to set.\n * @param {number} [offset=0] - The offset in this buffer attribute's array.\n * @return {BufferAttribute} A reference to this instance.\n */\n set(e, t = 0) {\n return this.array.set(e, t), this;\n }\n /**\n * Returns the given component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @param {number} component - The component index.\n * @return {number} The returned value.\n */\n getComponent(e, t) {\n let n = this.array[e * this.itemSize + t];\n return this.normalized && (n = hn(n, this.array)), n;\n }\n /**\n * Sets the given value to the given component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @param {number} component - The component index.\n * @param {number} value - The value to set.\n * @return {BufferAttribute} A reference to this instance.\n */\n setComponent(e, t, n) {\n return this.normalized && (n = tt(n, this.array)), this.array[e * this.itemSize + t] = n, this;\n }\n /**\n * Returns the x component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @return {number} The x component.\n */\n getX(e) {\n let t = this.array[e * this.itemSize];\n return this.normalized && (t = hn(t, this.array)), t;\n }\n /**\n * Sets the x component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @param {number} x - The value to set.\n * @return {BufferAttribute} A reference to this instance.\n */\n setX(e, t) {\n return this.normalized && (t = tt(t, this.array)), this.array[e * this.itemSize] = t, this;\n }\n /**\n * Returns the y component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @return {number} The y component.\n */\n getY(e) {\n let t = this.array[e * this.itemSize + 1];\n return this.normalized && (t = hn(t, this.array)), t;\n }\n /**\n * Sets the y component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @param {number} y - The value to set.\n * @return {BufferAttribute} A reference to this instance.\n */\n setY(e, t) {\n return this.normalized && (t = tt(t, this.array)), this.array[e * this.itemSize + 1] = t, this;\n }\n /**\n * Returns the z component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @return {number} The z component.\n */\n getZ(e) {\n let t = this.array[e * this.itemSize + 2];\n return this.normalized && (t = hn(t, this.array)), t;\n }\n /**\n * Sets the z component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @param {number} z - The value to set.\n * @return {BufferAttribute} A reference to this instance.\n */\n setZ(e, t) {\n return this.normalized && (t = tt(t, this.array)), this.array[e * this.itemSize + 2] = t, this;\n }\n /**\n * Returns the w component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @return {number} The w component.\n */\n getW(e) {\n let t = this.array[e * this.itemSize + 3];\n return this.normalized && (t = hn(t, this.array)), t;\n }\n /**\n * Sets the w component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @param {number} w - The value to set.\n * @return {BufferAttribute} A reference to this instance.\n */\n setW(e, t) {\n return this.normalized && (t = tt(t, this.array)), this.array[e * this.itemSize + 3] = t, this;\n }\n /**\n * Sets the x and y component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @param {number} x - The value for the x component to set.\n * @param {number} y - The value for the y component to set.\n * @return {BufferAttribute} A reference to this instance.\n */\n setXY(e, t, n) {\n return e *= this.itemSize, this.normalized && (t = tt(t, this.array), n = tt(n, this.array)), this.array[e + 0] = t, this.array[e + 1] = n, this;\n }\n /**\n * Sets the x, y and z component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @param {number} x - The value for the x component to set.\n * @param {number} y - The value for the y component to set.\n * @param {number} z - The value for the z component to set.\n * @return {BufferAttribute} A reference to this instance.\n */\n setXYZ(e, t, n, s) {\n return e *= this.itemSize, this.normalized && (t = tt(t, this.array), n = tt(n, this.array), s = tt(s, this.array)), this.array[e + 0] = t, this.array[e + 1] = n, this.array[e + 2] = s, this;\n }\n /**\n * Sets the x, y, z and w component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @param {number} x - The value for the x component to set.\n * @param {number} y - The value for the y component to set.\n * @param {number} z - The value for the z component to set.\n * @param {number} w - The value for the w component to set.\n * @return {BufferAttribute} A reference to this instance.\n */\n setXYZW(e, t, n, s, r) {\n return e *= this.itemSize, this.normalized && (t = tt(t, this.array), n = tt(n, this.array), s = tt(s, this.array), r = tt(r, this.array)), this.array[e + 0] = t, this.array[e + 1] = n, this.array[e + 2] = s, this.array[e + 3] = r, this;\n }\n /**\n * Sets the given callback function that is executed after the Renderer has transferred\n * the attribute array data to the GPU. Can be used to perform clean-up operations after\n * the upload when attribute data are not needed anymore on the CPU side.\n *\n * @param {Function} callback - The `onUpload()` callback.\n * @return {BufferAttribute} A reference to this instance.\n */\n onUpload(e) {\n return this.onUploadCallback = e, this;\n }\n /**\n * Returns a new buffer attribute with copied values from this instance.\n *\n * @return {BufferAttribute} A clone of this instance.\n */\n clone() {\n return new this.constructor(this.array, this.itemSize).copy(this);\n }\n /**\n * Serializes the buffer attribute into JSON.\n *\n * @return {Object} A JSON object representing the serialized buffer attribute.\n */\n toJSON() {\n const e = {\n itemSize: this.itemSize,\n type: this.array.constructor.name,\n array: Array.from(this.array),\n normalized: this.normalized\n };\n return this.name !== \"\" && (e.name = this.name), this.usage !== ho && (e.usage = this.usage), e;\n }\n}\nclass eh extends kt {\n /**\n * Constructs a new buffer attribute.\n *\n * @param {(Array|Uint16Array)} array - The array holding the attribute data.\n * @param {number} itemSize - The item size.\n * @param {boolean} [normalized=false] - Whether the data are normalized or not.\n */\n constructor(e, t, n) {\n super(new Uint16Array(e), t, n);\n }\n}\nclass th extends kt {\n /**\n * Constructs a new buffer attribute.\n *\n * @param {(Array|Uint32Array)} array - The array holding the attribute data.\n * @param {number} itemSize - The item size.\n * @param {boolean} [normalized=false] - Whether the data are normalized or not.\n */\n constructor(e, t, n) {\n super(new Uint32Array(e), t, n);\n }\n}\nclass pn extends kt {\n /**\n * Constructs a new buffer attribute.\n *\n * @param {(Array|Float32Array)} array - The array holding the attribute data.\n * @param {number} itemSize - The item size.\n * @param {boolean} [normalized=false] - Whether the data are normalized or not.\n */\n constructor(e, t, n) {\n super(new Float32Array(e), t, n);\n }\n}\nlet Yu = 0;\nconst Jt = /* @__PURE__ */ new Ne(), ta = /* @__PURE__ */ new pt(), Ai = /* @__PURE__ */ new w(), Kt = /* @__PURE__ */ new Pt(), os = /* @__PURE__ */ new Pt(), At = /* @__PURE__ */ new w();\nclass nn extends mi {\n /**\n * Constructs a new geometry.\n */\n constructor() {\n super(), this.isBufferGeometry = !0, Object.defineProperty(this, \"id\", { value: Yu++ }), this.uuid = fn(), this.name = \"\", this.type = \"BufferGeometry\", this.index = null, this.indirect = null, this.attributes = {}, this.morphAttributes = {}, this.morphTargetsRelative = !1, this.groups = [], this.boundingBox = null, this.boundingSphere = null, this.drawRange = { start: 0, count: 1 / 0 }, this.userData = {};\n }\n /**\n * Returns the index of this geometry.\n *\n * @return {?BufferAttribute} The index. Returns `null` if no index is defined.\n */\n getIndex() {\n return this.index;\n }\n /**\n * Sets the given index to this geometry.\n *\n * @param {Array|BufferAttribute} index - The index to set.\n * @return {BufferGeometry} A reference to this instance.\n */\n setIndex(e) {\n return Array.isArray(e) ? this.index = new ($c(e) ? th : eh)(e, 1) : this.index = e, this;\n }\n /**\n * Sets the given indirect attribute to this geometry.\n *\n * @param {BufferAttribute} indirect - The attribute holding indirect draw calls.\n * @return {BufferGeometry} A reference to this instance.\n */\n setIndirect(e) {\n return this.indirect = e, this;\n }\n /**\n * Returns the indirect attribute of this geometry.\n *\n * @return {?BufferAttribute} The indirect attribute. Returns `null` if no indirect attribute is defined.\n */\n getIndirect() {\n return this.indirect;\n }\n /**\n * Returns the buffer attribute for the given name.\n *\n * @param {string} name - The attribute name.\n * @return {BufferAttribute|InterleavedBufferAttribute|undefined} The buffer attribute.\n * Returns `undefined` if not attribute has been found.\n */\n getAttribute(e) {\n return this.attributes[e];\n }\n /**\n * Sets the given attribute for the given name.\n *\n * @param {string} name - The attribute name.\n * @param {BufferAttribute|InterleavedBufferAttribute} attribute - The attribute to set.\n * @return {BufferGeometry} A reference to this instance.\n */\n setAttribute(e, t) {\n return this.attributes[e] = t, this;\n }\n /**\n * Deletes the attribute for the given name.\n *\n * @param {string} name - The attribute name to delete.\n * @return {BufferGeometry} A reference to this instance.\n */\n deleteAttribute(e) {\n return delete this.attributes[e], this;\n }\n /**\n * Returns `true` if this geometry has an attribute for the given name.\n *\n * @param {string} name - The attribute name.\n * @return {boolean} Whether this geometry has an attribute for the given name or not.\n */\n hasAttribute(e) {\n return this.attributes[e] !== void 0;\n }\n /**\n * Adds a group to this geometry.\n *\n * @param {number} start - The first element in this draw call. That is the first\n * vertex for non-indexed geometry, otherwise the first triangle index.\n * @param {number} count - Specifies how many vertices (or indices) are part of this group.\n * @param {number} [materialIndex=0] - The material array index to use.\n */\n addGroup(e, t, n = 0) {\n this.groups.push({\n start: e,\n count: t,\n materialIndex: n\n });\n }\n /**\n * Clears all groups.\n */\n clearGroups() {\n this.groups = [];\n }\n /**\n * Sets the draw range for this geometry.\n *\n * @param {number} start - The first vertex for non-indexed geometry, otherwise the first triangle index.\n * @param {number} count - For non-indexed BufferGeometry, `count` is the number of vertices to render.\n * For indexed BufferGeometry, `count` is the number of indices to render.\n */\n setDrawRange(e, t) {\n this.drawRange.start = e, this.drawRange.count = t;\n }\n /**\n * Applies the given 4x4 transformation matrix to the geometry.\n *\n * @param {Matrix4} matrix - The matrix to apply.\n * @return {BufferGeometry} A reference to this instance.\n */\n applyMatrix4(e) {\n const t = this.attributes.position;\n t !== void 0 && (t.applyMatrix4(e), t.needsUpdate = !0);\n const n = this.attributes.normal;\n if (n !== void 0) {\n const r = new ze().getNormalMatrix(e);\n n.applyNormalMatrix(r), n.needsUpdate = !0;\n }\n const s = this.attributes.tangent;\n return s !== void 0 && (s.transformDirection(e), s.needsUpdate = !0), this.boundingBox !== null && this.computeBoundingBox(), this.boundingSphere !== null && this.computeBoundingSphere(), this;\n }\n /**\n * Applies the rotation represented by the Quaternion to the geometry.\n *\n * @param {Quaternion} q - The Quaternion to apply.\n * @return {BufferGeometry} A reference to this instance.\n */\n applyQuaternion(e) {\n return Jt.makeRotationFromQuaternion(e), this.applyMatrix4(Jt), this;\n }\n /**\n * Rotates the geometry about the X axis. This is typically done as a one time\n * operation, and not during a loop. Use {@link Object3D#rotation} for typical\n * real-time mesh rotation.\n *\n * @param {number} angle - The angle in radians.\n * @return {BufferGeometry} A reference to this instance.\n */\n rotateX(e) {\n return Jt.makeRotationX(e), this.applyMatrix4(Jt), this;\n }\n /**\n * Rotates the geometry about the Y axis. This is typically done as a one time\n * operation, and not during a loop. Use {@link Object3D#rotation} for typical\n * real-time mesh rotation.\n *\n * @param {number} angle - The angle in radians.\n * @return {BufferGeometry} A reference to this instance.\n */\n rotateY(e) {\n return Jt.makeRotationY(e), this.applyMatrix4(Jt), this;\n }\n /**\n * Rotates the geometry about the Z axis. This is typically done as a one time\n * operation, and not during a loop. Use {@link Object3D#rotation} for typical\n * real-time mesh rotation.\n *\n * @param {number} angle - The angle in radians.\n * @return {BufferGeometry} A reference to this instance.\n */\n rotateZ(e) {\n return Jt.makeRotationZ(e), this.applyMatrix4(Jt), this;\n }\n /**\n * Translates the geometry. This is typically done as a one time\n * operation, and not during a loop. Use {@link Object3D#position} for typical\n * real-time mesh rotation.\n *\n * @param {number} x - The x offset.\n * @param {number} y - The y offset.\n * @param {number} z - The z offset.\n * @return {BufferGeometry} A reference to this instance.\n */\n translate(e, t, n) {\n return Jt.makeTranslation(e, t, n), this.applyMatrix4(Jt), this;\n }\n /**\n * Scales the geometry. This is typically done as a one time\n * operation, and not during a loop. Use {@link Object3D#scale} for typical\n * real-time mesh rotation.\n *\n * @param {number} x - The x scale.\n * @param {number} y - The y scale.\n * @param {number} z - The z scale.\n * @return {BufferGeometry} A reference to this instance.\n */\n scale(e, t, n) {\n return Jt.makeScale(e, t, n), this.applyMatrix4(Jt), this;\n }\n /**\n * Rotates the geometry to face a point in 3D space. This is typically done as a one time\n * operation, and not during a loop. Use {@link Object3D#lookAt} for typical\n * real-time mesh rotation.\n *\n * @param {Vector3} vector - The target point.\n * @return {BufferGeometry} A reference to this instance.\n */\n lookAt(e) {\n return ta.lookAt(e), ta.updateMatrix(), this.applyMatrix4(ta.matrix), this;\n }\n /**\n * Center the geometry based on its bounding box.\n *\n * @return {BufferGeometry} A reference to this instance.\n */\n center() {\n return this.computeBoundingBox(), this.boundingBox.getCenter(Ai).negate(), this.translate(Ai.x, Ai.y, Ai.z), this;\n }\n /**\n * Defines a geometry by creating a `position` attribute based on the given array of points. The array\n * can hold 2D or 3D vectors. When using two-dimensional data, the `z` coordinate for all vertices is\n * set to `0`.\n *\n * If the method is used with an existing `position` attribute, the vertex data are overwritten with the\n * data from the array. The length of the array must match the vertex count.\n *\n * @param {Array|Array} points - The points.\n * @return {BufferGeometry} A reference to this instance.\n */\n setFromPoints(e) {\n const t = this.getAttribute(\"position\");\n if (t === void 0) {\n const n = [];\n for (let s = 0, r = e.length; s < r; s++) {\n const a = e[s];\n n.push(a.x, a.y, a.z || 0);\n }\n this.setAttribute(\"position\", new pn(n, 3));\n } else {\n const n = Math.min(e.length, t.count);\n for (let s = 0; s < n; s++) {\n const r = e[s];\n t.setXYZ(s, r.x, r.y, r.z || 0);\n }\n e.length > t.count && Te(\"BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.\"), t.needsUpdate = !0;\n }\n return this;\n }\n /**\n * Computes the bounding box of the geometry, and updates the `boundingBox` member.\n * The bounding box is not computed by the engine; it must be computed by your app.\n * You may need to recompute the bounding box if the geometry vertices are modified.\n */\n computeBoundingBox() {\n this.boundingBox === null && (this.boundingBox = new Pt());\n const e = this.attributes.position, t = this.morphAttributes.position;\n if (e && e.isGLBufferAttribute) {\n Xe(\"BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.\", this), this.boundingBox.set(\n new w(-1 / 0, -1 / 0, -1 / 0),\n new w(1 / 0, 1 / 0, 1 / 0)\n );\n return;\n }\n if (e !== void 0) {\n if (this.boundingBox.setFromBufferAttribute(e), t)\n for (let n = 0, s = t.length; n < s; n++) {\n const r = t[n];\n Kt.setFromBufferAttribute(r), this.morphTargetsRelative ? (At.addVectors(this.boundingBox.min, Kt.min), this.boundingBox.expandByPoint(At), At.addVectors(this.boundingBox.max, Kt.max), this.boundingBox.expandByPoint(At)) : (this.boundingBox.expandByPoint(Kt.min), this.boundingBox.expandByPoint(Kt.max));\n }\n } else\n this.boundingBox.makeEmpty();\n (isNaN(this.boundingBox.min.x) || isNaN(this.boundingBox.min.y) || isNaN(this.boundingBox.min.z)) && Xe('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The \"position\" attribute is likely to have NaN values.', this);\n }\n /**\n * Computes the bounding sphere of the geometry, and updates the `boundingSphere` member.\n * The engine automatically computes the bounding sphere when it is needed, e.g., for ray casting or view frustum culling.\n * You may need to recompute the bounding sphere if the geometry vertices are modified.\n */\n computeBoundingSphere() {\n this.boundingSphere === null && (this.boundingSphere = new Rn());\n const e = this.attributes.position, t = this.morphAttributes.position;\n if (e && e.isGLBufferAttribute) {\n Xe(\"BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.\", this), this.boundingSphere.set(new w(), 1 / 0);\n return;\n }\n if (e) {\n const n = this.boundingSphere.center;\n if (Kt.setFromBufferAttribute(e), t)\n for (let r = 0, a = t.length; r < a; r++) {\n const o = t[r];\n os.setFromBufferAttribute(o), this.morphTargetsRelative ? (At.addVectors(Kt.min, os.min), Kt.expandByPoint(At), At.addVectors(Kt.max, os.max), Kt.expandByPoint(At)) : (Kt.expandByPoint(os.min), Kt.expandByPoint(os.max));\n }\n Kt.getCenter(n);\n let s = 0;\n for (let r = 0, a = e.count; r < a; r++)\n At.fromBufferAttribute(e, r), s = Math.max(s, n.distanceToSquared(At));\n if (t)\n for (let r = 0, a = t.length; r < a; r++) {\n const o = t[r], l = this.morphTargetsRelative;\n for (let c = 0, h = o.count; c < h; c++)\n At.fromBufferAttribute(o, c), l && (Ai.fromBufferAttribute(e, c), At.add(Ai)), s = Math.max(s, n.distanceToSquared(At));\n }\n this.boundingSphere.radius = Math.sqrt(s), isNaN(this.boundingSphere.radius) && Xe('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The \"position\" attribute is likely to have NaN values.', this);\n }\n }\n /**\n * Calculates and adds a tangent attribute to this geometry.\n *\n * The computation is only supported for indexed geometries and if position, normal, and uv attributes\n * are defined. When using a tangent space normal map, prefer the MikkTSpace algorithm provided by\n * {@link BufferGeometryUtils#computeMikkTSpaceTangents} instead.\n */\n computeTangents() {\n const e = this.index, t = this.attributes;\n if (e === null || t.position === void 0 || t.normal === void 0 || t.uv === void 0) {\n Xe(\"BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)\");\n return;\n }\n const n = t.position, s = t.normal, r = t.uv;\n this.hasAttribute(\"tangent\") === !1 && this.setAttribute(\"tangent\", new kt(new Float32Array(4 * n.count), 4));\n const a = this.getAttribute(\"tangent\"), o = [], l = [];\n for (let I = 0; I < n.count; I++)\n o[I] = new w(), l[I] = new w();\n const c = new w(), h = new w(), u = new w(), d = new le(), p = new le(), g = new le(), x = new w(), m = new w();\n function f(I, S, M) {\n c.fromBufferAttribute(n, I), h.fromBufferAttribute(n, S), u.fromBufferAttribute(n, M), d.fromBufferAttribute(r, I), p.fromBufferAttribute(r, S), g.fromBufferAttribute(r, M), h.sub(c), u.sub(c), p.sub(d), g.sub(d);\n const C = 1 / (p.x * g.y - g.x * p.y);\n isFinite(C) && (x.copy(h).multiplyScalar(g.y).addScaledVector(u, -p.y).multiplyScalar(C), m.copy(u).multiplyScalar(p.x).addScaledVector(h, -g.x).multiplyScalar(C), o[I].add(x), o[S].add(x), o[M].add(x), l[I].add(m), l[S].add(m), l[M].add(m));\n }\n let y = this.groups;\n y.length === 0 && (y = [{\n start: 0,\n count: e.count\n }]);\n for (let I = 0, S = y.length; I < S; ++I) {\n const M = y[I], C = M.start, U = M.count;\n for (let B = C, z = C + U; B < z; B += 3)\n f(\n e.getX(B + 0),\n e.getX(B + 1),\n e.getX(B + 2)\n );\n }\n const v = new w(), T = new w(), R = new w(), E = new w();\n function P(I) {\n R.fromBufferAttribute(s, I), E.copy(R);\n const S = o[I];\n v.copy(S), v.sub(R.multiplyScalar(R.dot(S))).normalize(), T.crossVectors(E, S);\n const C = T.dot(l[I]) < 0 ? -1 : 1;\n a.setXYZW(I, v.x, v.y, v.z, C);\n }\n for (let I = 0, S = y.length; I < S; ++I) {\n const M = y[I], C = M.start, U = M.count;\n for (let B = C, z = C + U; B < z; B += 3)\n P(e.getX(B + 0)), P(e.getX(B + 1)), P(e.getX(B + 2));\n }\n }\n /**\n * Computes vertex normals for the given vertex data. For indexed geometries, the method sets\n * each vertex normal to be the average of the face normals of the faces that share that vertex.\n * For non-indexed geometries, vertices are not shared, and the method sets each vertex normal\n * to be the same as the face normal.\n */\n computeVertexNormals() {\n const e = this.index, t = this.getAttribute(\"position\");\n if (t !== void 0) {\n let n = this.getAttribute(\"normal\");\n if (n === void 0)\n n = new kt(new Float32Array(t.count * 3), 3), this.setAttribute(\"normal\", n);\n else\n for (let d = 0, p = n.count; d < p; d++)\n n.setXYZ(d, 0, 0, 0);\n const s = new w(), r = new w(), a = new w(), o = new w(), l = new w(), c = new w(), h = new w(), u = new w();\n if (e)\n for (let d = 0, p = e.count; d < p; d += 3) {\n const g = e.getX(d + 0), x = e.getX(d + 1), m = e.getX(d + 2);\n s.fromBufferAttribute(t, g), r.fromBufferAttribute(t, x), a.fromBufferAttribute(t, m), h.subVectors(a, r), u.subVectors(s, r), h.cross(u), o.fromBufferAttribute(n, g), l.fromBufferAttribute(n, x), c.fromBufferAttribute(n, m), o.add(h), l.add(h), c.add(h), n.setXYZ(g, o.x, o.y, o.z), n.setXYZ(x, l.x, l.y, l.z), n.setXYZ(m, c.x, c.y, c.z);\n }\n else\n for (let d = 0, p = t.count; d < p; d += 3)\n s.fromBufferAttribute(t, d + 0), r.fromBufferAttribute(t, d + 1), a.fromBufferAttribute(t, d + 2), h.subVectors(a, r), u.subVectors(s, r), h.cross(u), n.setXYZ(d + 0, h.x, h.y, h.z), n.setXYZ(d + 1, h.x, h.y, h.z), n.setXYZ(d + 2, h.x, h.y, h.z);\n this.normalizeNormals(), n.needsUpdate = !0;\n }\n }\n /**\n * Ensures every normal vector in a geometry will have a magnitude of `1`. This will\n * correct lighting on the geometry surfaces.\n */\n normalizeNormals() {\n const e = this.attributes.normal;\n for (let t = 0, n = e.count; t < n; t++)\n At.fromBufferAttribute(e, t), At.normalize(), e.setXYZ(t, At.x, At.y, At.z);\n }\n /**\n * Return a new non-index version of this indexed geometry. If the geometry\n * is already non-indexed, the method is a NOOP.\n *\n * @return {BufferGeometry} The non-indexed version of this indexed geometry.\n */\n toNonIndexed() {\n function e(o, l) {\n const c = o.array, h = o.itemSize, u = o.normalized, d = new c.constructor(l.length * h);\n let p = 0, g = 0;\n for (let x = 0, m = l.length; x < m; x++) {\n o.isInterleavedBufferAttribute ? p = l[x] * o.data.stride + o.offset : p = l[x] * h;\n for (let f = 0; f < h; f++)\n d[g++] = c[p++];\n }\n return new kt(d, h, u);\n }\n if (this.index === null)\n return Te(\"BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.\"), this;\n const t = new nn(), n = this.index.array, s = this.attributes;\n for (const o in s) {\n const l = s[o], c = e(l, n);\n t.setAttribute(o, c);\n }\n const r = this.morphAttributes;\n for (const o in r) {\n const l = [], c = r[o];\n for (let h = 0, u = c.length; h < u; h++) {\n const d = c[h], p = e(d, n);\n l.push(p);\n }\n t.morphAttributes[o] = l;\n }\n t.morphTargetsRelative = this.morphTargetsRelative;\n const a = this.groups;\n for (let o = 0, l = a.length; o < l; o++) {\n const c = a[o];\n t.addGroup(c.start, c.count, c.materialIndex);\n }\n return t;\n }\n /**\n * Serializes the geometry into JSON.\n *\n * @return {Object} A JSON object representing the serialized geometry.\n */\n toJSON() {\n const e = {\n metadata: {\n version: 4.7,\n type: \"BufferGeometry\",\n generator: \"BufferGeometry.toJSON\"\n }\n };\n if (e.uuid = this.uuid, e.type = this.type, this.name !== \"\" && (e.name = this.name), Object.keys(this.userData).length > 0 && (e.userData = this.userData), this.parameters !== void 0) {\n const l = this.parameters;\n for (const c in l)\n l[c] !== void 0 && (e[c] = l[c]);\n return e;\n }\n e.data = { attributes: {} };\n const t = this.index;\n t !== null && (e.data.index = {\n type: t.array.constructor.name,\n array: Array.prototype.slice.call(t.array)\n });\n const n = this.attributes;\n for (const l in n) {\n const c = n[l];\n e.data.attributes[l] = c.toJSON(e.data);\n }\n const s = {};\n let r = !1;\n for (const l in this.morphAttributes) {\n const c = this.morphAttributes[l], h = [];\n for (let u = 0, d = c.length; u < d; u++) {\n const p = c[u];\n h.push(p.toJSON(e.data));\n }\n h.length > 0 && (s[l] = h, r = !0);\n }\n r && (e.data.morphAttributes = s, e.data.morphTargetsRelative = this.morphTargetsRelative);\n const a = this.groups;\n a.length > 0 && (e.data.groups = JSON.parse(JSON.stringify(a)));\n const o = this.boundingSphere;\n return o !== null && (e.data.boundingSphere = o.toJSON()), e;\n }\n /**\n * Returns a new geometry with copied values from this instance.\n *\n * @return {BufferGeometry} A clone of this instance.\n */\n clone() {\n return new this.constructor().copy(this);\n }\n /**\n * Copies the values of the given geometry to this instance.\n *\n * @param {BufferGeometry} source - The geometry to copy.\n * @return {BufferGeometry} A reference to this instance.\n */\n copy(e) {\n this.index = null, this.attributes = {}, this.morphAttributes = {}, this.groups = [], this.boundingBox = null, this.boundingSphere = null;\n const t = {};\n this.name = e.name;\n const n = e.index;\n n !== null && this.setIndex(n.clone());\n const s = e.attributes;\n for (const c in s) {\n const h = s[c];\n this.setAttribute(c, h.clone(t));\n }\n const r = e.morphAttributes;\n for (const c in r) {\n const h = [], u = r[c];\n for (let d = 0, p = u.length; d < p; d++)\n h.push(u[d].clone(t));\n this.morphAttributes[c] = h;\n }\n this.morphTargetsRelative = e.morphTargetsRelative;\n const a = e.groups;\n for (let c = 0, h = a.length; c < h; c++) {\n const u = a[c];\n this.addGroup(u.start, u.count, u.materialIndex);\n }\n const o = e.boundingBox;\n o !== null && (this.boundingBox = o.clone());\n const l = e.boundingSphere;\n return l !== null && (this.boundingSphere = l.clone()), this.drawRange.start = e.drawRange.start, this.drawRange.count = e.drawRange.count, this.userData = e.userData, this;\n }\n /**\n * Frees the GPU-related resources allocated by this instance. Call this\n * method whenever this instance is no longer used in your app.\n *\n * @fires BufferGeometry#dispose\n */\n dispose() {\n this.dispatchEvent({ type: \"dispose\" });\n }\n}\nconst bl = /* @__PURE__ */ new Ne(), ai = /* @__PURE__ */ new Ji(), Hs = /* @__PURE__ */ new Rn(), yl = /* @__PURE__ */ new w(), Ws = /* @__PURE__ */ new w(), Xs = /* @__PURE__ */ new w(), js = /* @__PURE__ */ new w(), na = /* @__PURE__ */ new w(), qs = /* @__PURE__ */ new w(), Tl = /* @__PURE__ */ new w(), Ys = /* @__PURE__ */ new w();\nclass ot extends pt {\n /**\n * Constructs a new mesh.\n *\n * @param {BufferGeometry} [geometry] - The mesh geometry.\n * @param {Material|Array} [material] - The mesh material.\n */\n constructor(e = new nn(), t = new Bt()) {\n super(), this.isMesh = !0, this.type = \"Mesh\", this.geometry = e, this.material = t, this.morphTargetDictionary = void 0, this.morphTargetInfluences = void 0, this.count = 1, this.updateMorphTargets();\n }\n copy(e, t) {\n return super.copy(e, t), e.morphTargetInfluences !== void 0 && (this.morphTargetInfluences = e.morphTargetInfluences.slice()), e.morphTargetDictionary !== void 0 && (this.morphTargetDictionary = Object.assign({}, e.morphTargetDictionary)), this.material = Array.isArray(e.material) ? e.material.slice() : e.material, this.geometry = e.geometry, this;\n }\n /**\n * Sets the values of {@link Mesh#morphTargetDictionary} and {@link Mesh#morphTargetInfluences}\n * to make sure existing morph targets can influence this 3D object.\n */\n updateMorphTargets() {\n const t = this.geometry.morphAttributes, n = Object.keys(t);\n if (n.length > 0) {\n const s = t[n[0]];\n if (s !== void 0) {\n this.morphTargetInfluences = [], this.morphTargetDictionary = {};\n for (let r = 0, a = s.length; r < a; r++) {\n const o = s[r].name || String(r);\n this.morphTargetInfluences.push(0), this.morphTargetDictionary[o] = r;\n }\n }\n }\n }\n /**\n * Returns the local-space position of the vertex at the given index, taking into\n * account the current animation state of both morph targets and skinning.\n *\n * @param {number} index - The vertex index.\n * @param {Vector3} target - The target object that is used to store the method's result.\n * @return {Vector3} The vertex position in local space.\n */\n getVertexPosition(e, t) {\n const n = this.geometry, s = n.attributes.position, r = n.morphAttributes.position, a = n.morphTargetsRelative;\n t.fromBufferAttribute(s, e);\n const o = this.morphTargetInfluences;\n if (r && o) {\n qs.set(0, 0, 0);\n for (let l = 0, c = r.length; l < c; l++) {\n const h = o[l], u = r[l];\n h !== 0 && (na.fromBufferAttribute(u, e), a ? qs.addScaledVector(na, h) : qs.addScaledVector(na.sub(t), h));\n }\n t.add(qs);\n }\n return t;\n }\n /**\n * Computes intersection points between a casted ray and this line.\n *\n * @param {Raycaster} raycaster - The raycaster.\n * @param {Array} intersects - The target array that holds the intersection points.\n */\n raycast(e, t) {\n const n = this.geometry, s = this.material, r = this.matrixWorld;\n s !== void 0 && (n.boundingSphere === null && n.computeBoundingSphere(), Hs.copy(n.boundingSphere), Hs.applyMatrix4(r), ai.copy(e.ray).recast(e.near), !(Hs.containsPoint(ai.origin) === !1 && (ai.intersectSphere(Hs, yl) === null || ai.origin.distanceToSquared(yl) > (e.far - e.near) ** 2)) && (bl.copy(r).invert(), ai.copy(e.ray).applyMatrix4(bl), !(n.boundingBox !== null && ai.intersectsBox(n.boundingBox) === !1) && this._computeIntersections(e, t, ai)));\n }\n _computeIntersections(e, t, n) {\n let s;\n const r = this.geometry, a = this.material, o = r.index, l = r.attributes.position, c = r.attributes.uv, h = r.attributes.uv1, u = r.attributes.normal, d = r.groups, p = r.drawRange;\n if (o !== null)\n if (Array.isArray(a))\n for (let g = 0, x = d.length; g < x; g++) {\n const m = d[g], f = a[m.materialIndex], y = Math.max(m.start, p.start), v = Math.min(o.count, Math.min(m.start + m.count, p.start + p.count));\n for (let T = y, R = v; T < R; T += 3) {\n const E = o.getX(T), P = o.getX(T + 1), I = o.getX(T + 2);\n s = Ks(this, f, e, n, c, h, u, E, P, I), s && (s.faceIndex = Math.floor(T / 3), s.face.materialIndex = m.materialIndex, t.push(s));\n }\n }\n else {\n const g = Math.max(0, p.start), x = Math.min(o.count, p.start + p.count);\n for (let m = g, f = x; m < f; m += 3) {\n const y = o.getX(m), v = o.getX(m + 1), T = o.getX(m + 2);\n s = Ks(this, a, e, n, c, h, u, y, v, T), s && (s.faceIndex = Math.floor(m / 3), t.push(s));\n }\n }\n else if (l !== void 0)\n if (Array.isArray(a))\n for (let g = 0, x = d.length; g < x; g++) {\n const m = d[g], f = a[m.materialIndex], y = Math.max(m.start, p.start), v = Math.min(l.count, Math.min(m.start + m.count, p.start + p.count));\n for (let T = y, R = v; T < R; T += 3) {\n const E = T, P = T + 1, I = T + 2;\n s = Ks(this, f, e, n, c, h, u, E, P, I), s && (s.faceIndex = Math.floor(T / 3), s.face.materialIndex = m.materialIndex, t.push(s));\n }\n }\n else {\n const g = Math.max(0, p.start), x = Math.min(l.count, p.start + p.count);\n for (let m = g, f = x; m < f; m += 3) {\n const y = m, v = m + 1, T = m + 2;\n s = Ks(this, a, e, n, c, h, u, y, v, T), s && (s.faceIndex = Math.floor(m / 3), t.push(s));\n }\n }\n }\n}\nfunction Ku(i, e, t, n, s, r, a, o) {\n let l;\n if (e.side === zt ? l = n.intersectTriangle(a, r, s, !0, o) : l = n.intersectTriangle(s, r, a, e.side === En, o), l === null) return null;\n Ys.copy(o), Ys.applyMatrix4(i.matrixWorld);\n const c = t.ray.origin.distanceTo(Ys);\n return c < t.near || c > t.far ? null : {\n distance: c,\n point: Ys.clone(),\n object: i\n };\n}\nfunction Ks(i, e, t, n, s, r, a, o, l, c) {\n i.getVertexPosition(o, Ws), i.getVertexPosition(l, Xs), i.getVertexPosition(c, js);\n const h = Ku(i, e, t, n, Ws, Xs, js, Tl);\n if (h) {\n const u = new w();\n un.getBarycoord(Tl, Ws, Xs, js, u), s && (h.uv = un.getInterpolatedAttribute(s, o, l, c, u, new le())), r && (h.uv1 = un.getInterpolatedAttribute(r, o, l, c, u, new le())), a && (h.normal = un.getInterpolatedAttribute(a, o, l, c, u, new w()), h.normal.dot(n.direction) > 0 && h.normal.multiplyScalar(-1));\n const d = {\n a: o,\n b: l,\n c,\n normal: new w(),\n materialIndex: 0\n };\n un.getNormal(Ws, Xs, js, d.normal), h.face = d, h.barycoord = u;\n }\n return h;\n}\nclass fi extends nn {\n /**\n * Constructs a new box geometry.\n *\n * @param {number} [width=1] - The width. That is, the length of the edges parallel to the X axis.\n * @param {number} [height=1] - The height. That is, the length of the edges parallel to the Y axis.\n * @param {number} [depth=1] - The depth. That is, the length of the edges parallel to the Z axis.\n * @param {number} [widthSegments=1] - Number of segmented rectangular faces along the width of the sides.\n * @param {number} [heightSegments=1] - Number of segmented rectangular faces along the height of the sides.\n * @param {number} [depthSegments=1] - Number of segmented rectangular faces along the depth of the sides.\n */\n constructor(e = 1, t = 1, n = 1, s = 1, r = 1, a = 1) {\n super(), this.type = \"BoxGeometry\", this.parameters = {\n width: e,\n height: t,\n depth: n,\n widthSegments: s,\n heightSegments: r,\n depthSegments: a\n };\n const o = this;\n s = Math.floor(s), r = Math.floor(r), a = Math.floor(a);\n const l = [], c = [], h = [], u = [];\n let d = 0, p = 0;\n g(\"z\", \"y\", \"x\", -1, -1, n, t, e, a, r, 0), g(\"z\", \"y\", \"x\", 1, -1, n, t, -e, a, r, 1), g(\"x\", \"z\", \"y\", 1, 1, e, n, t, s, a, 2), g(\"x\", \"z\", \"y\", 1, -1, e, n, -t, s, a, 3), g(\"x\", \"y\", \"z\", 1, -1, e, t, n, s, r, 4), g(\"x\", \"y\", \"z\", -1, -1, e, t, -n, s, r, 5), this.setIndex(l), this.setAttribute(\"position\", new pn(c, 3)), this.setAttribute(\"normal\", new pn(h, 3)), this.setAttribute(\"uv\", new pn(u, 2));\n function g(x, m, f, y, v, T, R, E, P, I, S) {\n const M = T / P, C = R / I, U = T / 2, B = R / 2, z = E / 2, W = P + 1, k = I + 1;\n let ee = 0, X = 0;\n const $ = new w();\n for (let Q = 0; Q < k; Q++) {\n const ge = Q * C - B;\n for (let we = 0; we < W; we++) {\n const Oe = we * M - U;\n $[x] = Oe * y, $[m] = ge * v, $[f] = z, c.push($.x, $.y, $.z), $[x] = 0, $[m] = 0, $[f] = E > 0 ? 1 : -1, h.push($.x, $.y, $.z), u.push(we / P), u.push(1 - Q / I), ee += 1;\n }\n }\n for (let Q = 0; Q < I; Q++)\n for (let ge = 0; ge < P; ge++) {\n const we = d + ge + W * Q, Oe = d + ge + W * (Q + 1), Ke = d + (ge + 1) + W * (Q + 1), $e = d + (ge + 1) + W * Q;\n l.push(we, Oe, $e), l.push(Oe, Ke, $e), X += 6;\n }\n o.addGroup(p, X, S), p += X, d += ee;\n }\n }\n copy(e) {\n return super.copy(e), this.parameters = Object.assign({}, e.parameters), this;\n }\n /**\n * Factory method for creating an instance of this class from the given\n * JSON object.\n *\n * @param {Object} data - A JSON object representing the serialized geometry.\n * @return {BoxGeometry} A new instance.\n */\n static fromJSON(e) {\n return new fi(e.width, e.height, e.depth, e.widthSegments, e.heightSegments, e.depthSegments);\n }\n}\nfunction qi(i) {\n const e = {};\n for (const t in i) {\n e[t] = {};\n for (const n in i[t]) {\n const s = i[t][n];\n s && (s.isColor || s.isMatrix3 || s.isMatrix4 || s.isVector2 || s.isVector3 || s.isVector4 || s.isTexture || s.isQuaternion) ? s.isRenderTargetTexture ? (Te(\"UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().\"), e[t][n] = null) : e[t][n] = s.clone() : Array.isArray(s) ? e[t][n] = s.slice() : e[t][n] = s;\n }\n }\n return e;\n}\nfunction Ot(i) {\n const e = {};\n for (let t = 0; t < i.length; t++) {\n const n = qi(i[t]);\n for (const s in n)\n e[s] = n[s];\n }\n return e;\n}\nfunction Zu(i) {\n const e = [];\n for (let t = 0; t < i.length; t++)\n e.push(i[t].clone());\n return e;\n}\nfunction nh(i) {\n const e = i.getRenderTarget();\n return e === null ? i.outputColorSpace : e.isXRRenderTarget === !0 ? e.texture.colorSpace : Ye.workingColorSpace;\n}\nconst dn = { clone: qi, merge: Ot };\nvar $u = `void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}`, Ju = `void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}`;\nclass ht extends tn {\n /**\n * Constructs a new shader material.\n *\n * @param {Object} [parameters] - An object with one or more properties\n * defining the material's appearance. Any property of the material\n * (including any property from inherited materials) can be passed\n * in here. Color values can be passed any type of value accepted\n * by {@link Color#set}.\n */\n constructor(e) {\n super(), this.isShaderMaterial = !0, this.type = \"ShaderMaterial\", this.defines = {}, this.uniforms = {}, this.uniformsGroups = [], this.vertexShader = $u, this.fragmentShader = Ju, this.linewidth = 1, this.wireframe = !1, this.wireframeLinewidth = 1, this.fog = !1, this.lights = !1, this.clipping = !1, this.forceSinglePass = !0, this.extensions = {\n clipCullDistance: !1,\n // set to use vertex shader clipping\n multiDraw: !1\n // set to use vertex shader multi_draw / enable gl_DrawID\n }, this.defaultAttributeValues = {\n color: [1, 1, 1],\n uv: [0, 0],\n uv1: [0, 0]\n }, this.index0AttributeName = void 0, this.uniformsNeedUpdate = !1, this.glslVersion = null, e !== void 0 && this.setValues(e);\n }\n copy(e) {\n return super.copy(e), this.fragmentShader = e.fragmentShader, this.vertexShader = e.vertexShader, this.uniforms = qi(e.uniforms), this.uniformsGroups = Zu(e.uniformsGroups), this.defines = Object.assign({}, e.defines), this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.fog = e.fog, this.lights = e.lights, this.clipping = e.clipping, this.extensions = Object.assign({}, e.extensions), this.glslVersion = e.glslVersion, this;\n }\n toJSON(e) {\n const t = super.toJSON(e);\n t.glslVersion = this.glslVersion, t.uniforms = {};\n for (const s in this.uniforms) {\n const a = this.uniforms[s].value;\n a && a.isTexture ? t.uniforms[s] = {\n type: \"t\",\n value: a.toJSON(e).uuid\n } : a && a.isColor ? t.uniforms[s] = {\n type: \"c\",\n value: a.getHex()\n } : a && a.isVector2 ? t.uniforms[s] = {\n type: \"v2\",\n value: a.toArray()\n } : a && a.isVector3 ? t.uniforms[s] = {\n type: \"v3\",\n value: a.toArray()\n } : a && a.isVector4 ? t.uniforms[s] = {\n type: \"v4\",\n value: a.toArray()\n } : a && a.isMatrix3 ? t.uniforms[s] = {\n type: \"m3\",\n value: a.toArray()\n } : a && a.isMatrix4 ? t.uniforms[s] = {\n type: \"m4\",\n value: a.toArray()\n } : t.uniforms[s] = {\n value: a\n };\n }\n Object.keys(this.defines).length > 0 && (t.defines = this.defines), t.vertexShader = this.vertexShader, t.fragmentShader = this.fragmentShader, t.lights = this.lights, t.clipping = this.clipping;\n const n = {};\n for (const s in this.extensions)\n this.extensions[s] === !0 && (n[s] = !0);\n return Object.keys(n).length > 0 && (t.extensions = n), t;\n }\n}\nclass ih extends pt {\n /**\n * Constructs a new camera.\n */\n constructor() {\n super(), this.isCamera = !0, this.type = \"Camera\", this.matrixWorldInverse = new Ne(), this.projectionMatrix = new Ne(), this.projectionMatrixInverse = new Ne(), this.coordinateSystem = Tn, this._reversedDepth = !1;\n }\n /**\n * The flag that indicates whether the camera uses a reversed depth buffer.\n *\n * @type {boolean}\n * @default false\n */\n get reversedDepth() {\n return this._reversedDepth;\n }\n copy(e, t) {\n return super.copy(e, t), this.matrixWorldInverse.copy(e.matrixWorldInverse), this.projectionMatrix.copy(e.projectionMatrix), this.projectionMatrixInverse.copy(e.projectionMatrixInverse), this.coordinateSystem = e.coordinateSystem, this;\n }\n /**\n * Returns a vector representing the (\"look\") direction of the 3D object in world space.\n *\n * This method is overwritten since cameras have a different forward vector compared to other\n * 3D objects. A camera looks down its local, negative z-axis by default.\n *\n * @param {Vector3} target - The target vector the result is stored to.\n * @return {Vector3} The 3D object's direction in world space.\n */\n getWorldDirection(e) {\n return super.getWorldDirection(e).negate();\n }\n updateMatrixWorld(e) {\n super.updateMatrixWorld(e), this.matrixWorldInverse.copy(this.matrixWorld).invert();\n }\n updateWorldMatrix(e, t) {\n super.updateWorldMatrix(e, t), this.matrixWorldInverse.copy(this.matrixWorld).invert();\n }\n clone() {\n return new this.constructor().copy(this);\n }\n}\nconst qn = /* @__PURE__ */ new w(), El = /* @__PURE__ */ new le(), wl = /* @__PURE__ */ new le();\nclass Tt extends ih {\n /**\n * Constructs a new perspective camera.\n *\n * @param {number} [fov=50] - The vertical field of view.\n * @param {number} [aspect=1] - The aspect ratio.\n * @param {number} [near=0.1] - The camera's near plane.\n * @param {number} [far=2000] - The camera's far plane.\n */\n constructor(e = 50, t = 1, n = 0.1, s = 2e3) {\n super(), this.isPerspectiveCamera = !0, this.type = \"PerspectiveCamera\", this.fov = e, this.zoom = 1, this.near = n, this.far = s, this.focus = 10, this.aspect = t, this.view = null, this.filmGauge = 35, this.filmOffset = 0, this.updateProjectionMatrix();\n }\n copy(e, t) {\n return super.copy(e, t), this.fov = e.fov, this.zoom = e.zoom, this.near = e.near, this.far = e.far, this.focus = e.focus, this.aspect = e.aspect, this.view = e.view === null ? null : Object.assign({}, e.view), this.filmGauge = e.filmGauge, this.filmOffset = e.filmOffset, this;\n }\n /**\n * Sets the FOV by focal length in respect to the current {@link PerspectiveCamera#filmGauge}.\n *\n * The default film gauge is 35, so that the focal length can be specified for\n * a 35mm (full frame) camera.\n *\n * @param {number} focalLength - Values for focal length and film gauge must have the same unit.\n */\n setFocalLength(e) {\n const t = 0.5 * this.getFilmHeight() / e;\n this.fov = ji * 2 * Math.atan(t), this.updateProjectionMatrix();\n }\n /**\n * Returns the focal length from the current {@link PerspectiveCamera#fov} and\n * {@link PerspectiveCamera#filmGauge}.\n *\n * @return {number} The computed focal length.\n */\n getFocalLength() {\n const e = Math.tan(_s * 0.5 * this.fov);\n return 0.5 * this.getFilmHeight() / e;\n }\n /**\n * Returns the current vertical field of view angle in degrees considering {@link PerspectiveCamera#zoom}.\n *\n * @return {number} The effective FOV.\n */\n getEffectiveFOV() {\n return ji * 2 * Math.atan(\n Math.tan(_s * 0.5 * this.fov) / this.zoom\n );\n }\n /**\n * Returns the width of the image on the film. If {@link PerspectiveCamera#aspect} is greater than or\n * equal to one (landscape format), the result equals {@link PerspectiveCamera#filmGauge}.\n *\n * @return {number} The film width.\n */\n getFilmWidth() {\n return this.filmGauge * Math.min(this.aspect, 1);\n }\n /**\n * Returns the height of the image on the film. If {@link PerspectiveCamera#aspect} is greater than or\n * equal to one (landscape format), the result equals {@link PerspectiveCamera#filmGauge}.\n *\n * @return {number} The film width.\n */\n getFilmHeight() {\n return this.filmGauge / Math.max(this.aspect, 1);\n }\n /**\n * Computes the 2D bounds of the camera's viewable rectangle at a given distance along the viewing direction.\n * Sets `minTarget` and `maxTarget` to the coordinates of the lower-left and upper-right corners of the view rectangle.\n *\n * @param {number} distance - The viewing distance.\n * @param {Vector2} minTarget - The lower-left corner of the view rectangle is written into this vector.\n * @param {Vector2} maxTarget - The upper-right corner of the view rectangle is written into this vector.\n */\n getViewBounds(e, t, n) {\n qn.set(-1, -1, 0.5).applyMatrix4(this.projectionMatrixInverse), t.set(qn.x, qn.y).multiplyScalar(-e / qn.z), qn.set(1, 1, 0.5).applyMatrix4(this.projectionMatrixInverse), n.set(qn.x, qn.y).multiplyScalar(-e / qn.z);\n }\n /**\n * Computes the width and height of the camera's viewable rectangle at a given distance along the viewing direction.\n *\n * @param {number} distance - The viewing distance.\n * @param {Vector2} target - The target vector that is used to store result where x is width and y is height.\n * @returns {Vector2} The view size.\n */\n getViewSize(e, t) {\n return this.getViewBounds(e, El, wl), t.subVectors(wl, El);\n }\n /**\n * Sets an offset in a larger frustum. This is useful for multi-window or\n * multi-monitor/multi-machine setups.\n *\n * For example, if you have 3x2 monitors and each monitor is 1920x1080 and\n * the monitors are in grid like this\n *```\n * +---+---+---+\n * | A | B | C |\n * +---+---+---+\n * | D | E | F |\n * +---+---+---+\n *```\n * then for each monitor you would call it like this:\n *```js\n * const w = 1920;\n * const h = 1080;\n * const fullWidth = w * 3;\n * const fullHeight = h * 2;\n *\n * // --A--\n * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );\n * // --B--\n * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );\n * // --C--\n * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );\n * // --D--\n * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );\n * // --E--\n * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );\n * // --F--\n * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );\n * ```\n *\n * Note there is no reason monitors have to be the same size or in a grid.\n *\n * @param {number} fullWidth - The full width of multiview setup.\n * @param {number} fullHeight - The full height of multiview setup.\n * @param {number} x - The horizontal offset of the subcamera.\n * @param {number} y - The vertical offset of the subcamera.\n * @param {number} width - The width of subcamera.\n * @param {number} height - The height of subcamera.\n */\n setViewOffset(e, t, n, s, r, a) {\n this.aspect = e / t, this.view === null && (this.view = {\n enabled: !0,\n fullWidth: 1,\n fullHeight: 1,\n offsetX: 0,\n offsetY: 0,\n width: 1,\n height: 1\n }), this.view.enabled = !0, this.view.fullWidth = e, this.view.fullHeight = t, this.view.offsetX = n, this.view.offsetY = s, this.view.width = r, this.view.height = a, this.updateProjectionMatrix();\n }\n /**\n * Removes the view offset from the projection matrix.\n */\n clearViewOffset() {\n this.view !== null && (this.view.enabled = !1), this.updateProjectionMatrix();\n }\n /**\n * Updates the camera's projection matrix. Must be called after any change of\n * camera properties.\n */\n updateProjectionMatrix() {\n const e = this.near;\n let t = e * Math.tan(_s * 0.5 * this.fov) / this.zoom, n = 2 * t, s = this.aspect * n, r = -0.5 * s;\n const a = this.view;\n if (this.view !== null && this.view.enabled) {\n const l = a.fullWidth, c = a.fullHeight;\n r += a.offsetX * s / l, t -= a.offsetY * n / c, s *= a.width / l, n *= a.height / c;\n }\n const o = this.filmOffset;\n o !== 0 && (r += e * o / this.getFilmWidth()), this.projectionMatrix.makePerspective(r, r + s, t, t - n, e, this.far, this.coordinateSystem, this.reversedDepth), this.projectionMatrixInverse.copy(this.projectionMatrix).invert();\n }\n toJSON(e) {\n const t = super.toJSON(e);\n return t.object.fov = this.fov, t.object.zoom = this.zoom, t.object.near = this.near, t.object.far = this.far, t.object.focus = this.focus, t.object.aspect = this.aspect, this.view !== null && (t.object.view = Object.assign({}, this.view)), t.object.filmGauge = this.filmGauge, t.object.filmOffset = this.filmOffset, t;\n }\n}\nconst Ri = -90, Ci = 1;\nclass Qu extends pt {\n /**\n * Constructs a new cube camera.\n *\n * @param {number} near - The camera's near plane.\n * @param {number} far - The camera's far plane.\n * @param {WebGLCubeRenderTarget} renderTarget - The cube render target.\n */\n constructor(e, t, n) {\n super(), this.type = \"CubeCamera\", this.renderTarget = n, this.coordinateSystem = null, this.activeMipmapLevel = 0;\n const s = new Tt(Ri, Ci, e, t);\n s.layers = this.layers, this.add(s);\n const r = new Tt(Ri, Ci, e, t);\n r.layers = this.layers, this.add(r);\n const a = new Tt(Ri, Ci, e, t);\n a.layers = this.layers, this.add(a);\n const o = new Tt(Ri, Ci, e, t);\n o.layers = this.layers, this.add(o);\n const l = new Tt(Ri, Ci, e, t);\n l.layers = this.layers, this.add(l);\n const c = new Tt(Ri, Ci, e, t);\n c.layers = this.layers, this.add(c);\n }\n /**\n * Must be called when the coordinate system of the cube camera is changed.\n */\n updateCoordinateSystem() {\n const e = this.coordinateSystem, t = this.children.concat(), [n, s, r, a, o, l] = t;\n for (const c of t) this.remove(c);\n if (e === Tn)\n n.up.set(0, 1, 0), n.lookAt(1, 0, 0), s.up.set(0, 1, 0), s.lookAt(-1, 0, 0), r.up.set(0, 0, -1), r.lookAt(0, 1, 0), a.up.set(0, 0, 1), a.lookAt(0, -1, 0), o.up.set(0, 1, 0), o.lookAt(0, 0, 1), l.up.set(0, 1, 0), l.lookAt(0, 0, -1);\n else if (e === br)\n n.up.set(0, -1, 0), n.lookAt(-1, 0, 0), s.up.set(0, -1, 0), s.lookAt(1, 0, 0), r.up.set(0, 0, 1), r.lookAt(0, 1, 0), a.up.set(0, 0, -1), a.lookAt(0, -1, 0), o.up.set(0, -1, 0), o.lookAt(0, 0, 1), l.up.set(0, -1, 0), l.lookAt(0, 0, -1);\n else\n throw new Error(\"THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: \" + e);\n for (const c of t)\n this.add(c), c.updateMatrixWorld();\n }\n /**\n * Calling this method will render the given scene with the given renderer\n * into the cube render target of the camera.\n *\n * @param {(Renderer|WebGLRenderer)} renderer - The renderer.\n * @param {Scene} scene - The scene to render.\n */\n update(e, t) {\n this.parent === null && this.updateMatrixWorld();\n const { renderTarget: n, activeMipmapLevel: s } = this;\n this.coordinateSystem !== e.coordinateSystem && (this.coordinateSystem = e.coordinateSystem, this.updateCoordinateSystem());\n const [r, a, o, l, c, h] = this.children, u = e.getRenderTarget(), d = e.getActiveCubeFace(), p = e.getActiveMipmapLevel(), g = e.xr.enabled;\n e.xr.enabled = !1;\n const x = n.texture.generateMipmaps;\n n.texture.generateMipmaps = !1, e.setRenderTarget(n, 0, s), e.render(t, r), e.setRenderTarget(n, 1, s), e.render(t, a), e.setRenderTarget(n, 2, s), e.render(t, o), e.setRenderTarget(n, 3, s), e.render(t, l), e.setRenderTarget(n, 4, s), e.render(t, c), n.texture.generateMipmaps = x, e.setRenderTarget(n, 5, s), e.render(t, h), e.setRenderTarget(u, d, p), e.xr.enabled = g, n.texture.needsPMREMUpdate = !0;\n }\n}\nclass No extends Ct {\n /**\n * Constructs a new cube texture.\n *\n * @param {Array} [images=[]] - An array holding a image for each side of a cube.\n * @param {number} [mapping=CubeReflectionMapping] - The texture mapping.\n * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value.\n * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value.\n * @param {number} [magFilter=LinearFilter] - The mag filter value.\n * @param {number} [minFilter=LinearMipmapLinearFilter] - The min filter value.\n * @param {number} [format=RGBAFormat] - The texture format.\n * @param {number} [type=UnsignedByteType] - The texture type.\n * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.\n * @param {string} [colorSpace=NoColorSpace] - The color space value.\n */\n constructor(e = [], t = Gi, n, s, r, a, o, l, c, h) {\n super(e, t, n, s, r, a, o, l, c, h), this.isCubeTexture = !0, this.flipY = !1;\n }\n /**\n * Alias for {@link CubeTexture#image}.\n *\n * @type {Array}\n */\n get images() {\n return this.image;\n }\n set images(e) {\n this.image = e;\n }\n}\nclass ed extends St {\n /**\n * Constructs a new cube render target.\n *\n * @param {number} [size=1] - The size of the render target.\n * @param {RenderTarget~Options} [options] - The configuration object.\n */\n constructor(e = 1, t = {}) {\n super(e, e, t), this.isWebGLCubeRenderTarget = !0;\n const n = { width: e, height: e, depth: 1 }, s = [n, n, n, n, n, n];\n this.texture = new No(s), this._setTextureOptions(t), this.texture.isRenderTargetTexture = !0;\n }\n /**\n * Converts the given equirectangular texture to a cube map.\n *\n * @param {WebGLRenderer} renderer - The renderer.\n * @param {Texture} texture - The equirectangular texture.\n * @return {WebGLCubeRenderTarget} A reference to this cube render target.\n */\n fromEquirectangularTexture(e, t) {\n this.texture.type = t.type, this.texture.colorSpace = t.colorSpace, this.texture.generateMipmaps = t.generateMipmaps, this.texture.minFilter = t.minFilter, this.texture.magFilter = t.magFilter;\n const n = {\n uniforms: {\n tEquirect: { value: null }\n },\n vertexShader: (\n /* glsl */\n `\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t`\n ),\n fragmentShader: (\n /* glsl */\n `\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t`\n )\n }, s = new fi(5, 5, 5), r = new ht({\n name: \"CubemapFromEquirect\",\n uniforms: qi(n.uniforms),\n vertexShader: n.vertexShader,\n fragmentShader: n.fragmentShader,\n side: zt,\n blending: Mt\n });\n r.uniforms.tEquirect.value = t;\n const a = new ot(s, r), o = t.minFilter;\n return t.minFilter === yn && (t.minFilter = bt), new Qu(1, 10, this).update(e, a), t.minFilter = o, a.geometry.dispose(), a.material.dispose(), this;\n }\n /**\n * Clears this cube render target.\n *\n * @param {WebGLRenderer} renderer - The renderer.\n * @param {boolean} [color=true] - Whether the color buffer should be cleared or not.\n * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not.\n * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not.\n */\n clear(e, t = !0, n = !0, s = !0) {\n const r = e.getRenderTarget();\n for (let a = 0; a < 6; a++)\n e.setRenderTarget(this, a), e.clear(t, n, s);\n e.setRenderTarget(r);\n }\n}\nlet zn = class extends pt {\n constructor() {\n super(), this.isGroup = !0, this.type = \"Group\";\n }\n};\nconst td = { type: \"move\" };\nclass ia {\n /**\n * Constructs a new XR controller.\n */\n constructor() {\n this._targetRay = null, this._grip = null, this._hand = null;\n }\n /**\n * Returns a group representing the hand space of the XR controller.\n *\n * @return {Group} A group representing the hand space of the XR controller.\n */\n getHandSpace() {\n return this._hand === null && (this._hand = new zn(), this._hand.matrixAutoUpdate = !1, this._hand.visible = !1, this._hand.joints = {}, this._hand.inputState = { pinching: !1 }), this._hand;\n }\n /**\n * Returns a group representing the target ray space of the XR controller.\n *\n * @return {Group} A group representing the target ray space of the XR controller.\n */\n getTargetRaySpace() {\n return this._targetRay === null && (this._targetRay = new zn(), this._targetRay.matrixAutoUpdate = !1, this._targetRay.visible = !1, this._targetRay.hasLinearVelocity = !1, this._targetRay.linearVelocity = new w(), this._targetRay.hasAngularVelocity = !1, this._targetRay.angularVelocity = new w()), this._targetRay;\n }\n /**\n * Returns a group representing the grip space of the XR controller.\n *\n * @return {Group} A group representing the grip space of the XR controller.\n */\n getGripSpace() {\n return this._grip === null && (this._grip = new zn(), this._grip.matrixAutoUpdate = !1, this._grip.visible = !1, this._grip.hasLinearVelocity = !1, this._grip.linearVelocity = new w(), this._grip.hasAngularVelocity = !1, this._grip.angularVelocity = new w()), this._grip;\n }\n /**\n * Dispatches the given event to the groups representing\n * the different coordinate spaces of the XR controller.\n *\n * @param {Object} event - The event to dispatch.\n * @return {WebXRController} A reference to this instance.\n */\n dispatchEvent(e) {\n return this._targetRay !== null && this._targetRay.dispatchEvent(e), this._grip !== null && this._grip.dispatchEvent(e), this._hand !== null && this._hand.dispatchEvent(e), this;\n }\n /**\n * Connects the controller with the given XR input source.\n *\n * @param {XRInputSource} inputSource - The input source.\n * @return {WebXRController} A reference to this instance.\n */\n connect(e) {\n if (e && e.hand) {\n const t = this._hand;\n if (t)\n for (const n of e.hand.values())\n this._getHandJoint(t, n);\n }\n return this.dispatchEvent({ type: \"connected\", data: e }), this;\n }\n /**\n * Disconnects the controller from the given XR input source.\n *\n * @param {XRInputSource} inputSource - The input source.\n * @return {WebXRController} A reference to this instance.\n */\n disconnect(e) {\n return this.dispatchEvent({ type: \"disconnected\", data: e }), this._targetRay !== null && (this._targetRay.visible = !1), this._grip !== null && (this._grip.visible = !1), this._hand !== null && (this._hand.visible = !1), this;\n }\n /**\n * Updates the controller with the given input source, XR frame and reference space.\n * This updates the transformations of the groups that represent the different\n * coordinate systems of the controller.\n *\n * @param {XRInputSource} inputSource - The input source.\n * @param {XRFrame} frame - The XR frame.\n * @param {XRReferenceSpace} referenceSpace - The reference space.\n * @return {WebXRController} A reference to this instance.\n */\n update(e, t, n) {\n let s = null, r = null, a = null;\n const o = this._targetRay, l = this._grip, c = this._hand;\n if (e && t.session.visibilityState !== \"visible-blurred\") {\n if (c && e.hand) {\n a = !0;\n for (const x of e.hand.values()) {\n const m = t.getJointPose(x, n), f = this._getHandJoint(c, x);\n m !== null && (f.matrix.fromArray(m.transform.matrix), f.matrix.decompose(f.position, f.rotation, f.scale), f.matrixWorldNeedsUpdate = !0, f.jointRadius = m.radius), f.visible = m !== null;\n }\n const h = c.joints[\"index-finger-tip\"], u = c.joints[\"thumb-tip\"], d = h.position.distanceTo(u.position), p = 0.02, g = 5e-3;\n c.inputState.pinching && d > p + g ? (c.inputState.pinching = !1, this.dispatchEvent({\n type: \"pinchend\",\n handedness: e.handedness,\n target: this\n })) : !c.inputState.pinching && d <= p - g && (c.inputState.pinching = !0, this.dispatchEvent({\n type: \"pinchstart\",\n handedness: e.handedness,\n target: this\n }));\n } else\n l !== null && e.gripSpace && (r = t.getPose(e.gripSpace, n), r !== null && (l.matrix.fromArray(r.transform.matrix), l.matrix.decompose(l.position, l.rotation, l.scale), l.matrixWorldNeedsUpdate = !0, r.linearVelocity ? (l.hasLinearVelocity = !0, l.linearVelocity.copy(r.linearVelocity)) : l.hasLinearVelocity = !1, r.angularVelocity ? (l.hasAngularVelocity = !0, l.angularVelocity.copy(r.angularVelocity)) : l.hasAngularVelocity = !1));\n o !== null && (s = t.getPose(e.targetRaySpace, n), s === null && r !== null && (s = r), s !== null && (o.matrix.fromArray(s.transform.matrix), o.matrix.decompose(o.position, o.rotation, o.scale), o.matrixWorldNeedsUpdate = !0, s.linearVelocity ? (o.hasLinearVelocity = !0, o.linearVelocity.copy(s.linearVelocity)) : o.hasLinearVelocity = !1, s.angularVelocity ? (o.hasAngularVelocity = !0, o.angularVelocity.copy(s.angularVelocity)) : o.hasAngularVelocity = !1, this.dispatchEvent(td)));\n }\n return o !== null && (o.visible = s !== null), l !== null && (l.visible = r !== null), c !== null && (c.visible = a !== null), this;\n }\n /**\n * Returns a group representing the hand joint for the given input joint.\n *\n * @private\n * @param {Group} hand - The group representing the hand space.\n * @param {XRJointSpace} inputjoint - The hand joint data.\n * @return {Group} A group representing the hand joint for the given input joint.\n */\n _getHandJoint(e, t) {\n if (e.joints[t.jointName] === void 0) {\n const n = new zn();\n n.matrixAutoUpdate = !1, n.visible = !1, e.joints[t.jointName] = n, e.add(n);\n }\n return e.joints[t.jointName];\n }\n}\nclass Fo extends pt {\n /**\n * Constructs a new scene.\n */\n constructor() {\n super(), this.isScene = !0, this.type = \"Scene\", this.background = null, this.environment = null, this.fog = null, this.backgroundBlurriness = 0, this.backgroundIntensity = 1, this.backgroundRotation = new xn(), this.environmentIntensity = 1, this.environmentRotation = new xn(), this.overrideMaterial = null, typeof __THREE_DEVTOOLS__ < \"u\" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(\"observe\", { detail: this }));\n }\n copy(e, t) {\n return super.copy(e, t), e.background !== null && (this.background = e.background.clone()), e.environment !== null && (this.environment = e.environment.clone()), e.fog !== null && (this.fog = e.fog.clone()), this.backgroundBlurriness = e.backgroundBlurriness, this.backgroundIntensity = e.backgroundIntensity, this.backgroundRotation.copy(e.backgroundRotation), this.environmentIntensity = e.environmentIntensity, this.environmentRotation.copy(e.environmentRotation), e.overrideMaterial !== null && (this.overrideMaterial = e.overrideMaterial.clone()), this.matrixAutoUpdate = e.matrixAutoUpdate, this;\n }\n toJSON(e) {\n const t = super.toJSON(e);\n return this.fog !== null && (t.object.fog = this.fog.toJSON()), this.backgroundBlurriness > 0 && (t.object.backgroundBlurriness = this.backgroundBlurriness), this.backgroundIntensity !== 1 && (t.object.backgroundIntensity = this.backgroundIntensity), t.object.backgroundRotation = this.backgroundRotation.toArray(), this.environmentIntensity !== 1 && (t.object.environmentIntensity = this.environmentIntensity), t.object.environmentRotation = this.environmentRotation.toArray(), t;\n }\n}\nclass nd {\n /**\n * Constructs a new interleaved buffer.\n *\n * @param {TypedArray} array - A typed array with a shared buffer storing attribute data.\n * @param {number} stride - The number of typed-array elements per vertex.\n */\n constructor(e, t) {\n this.isInterleavedBuffer = !0, this.array = e, this.stride = t, this.count = e !== void 0 ? e.length / t : 0, this.usage = ho, this.updateRanges = [], this.version = 0, this.uuid = fn();\n }\n /**\n * A callback function that is executed after the renderer has transferred the attribute array\n * data to the GPU.\n */\n onUploadCallback() {\n }\n /**\n * Flag to indicate that this attribute has changed and should be re-sent to\n * the GPU. Set this to `true` when you modify the value of the array.\n *\n * @type {number}\n * @default false\n * @param {boolean} value\n */\n set needsUpdate(e) {\n e === !0 && this.version++;\n }\n /**\n * Sets the usage of this interleaved buffer.\n *\n * @param {(StaticDrawUsage|DynamicDrawUsage|StreamDrawUsage|StaticReadUsage|DynamicReadUsage|StreamReadUsage|StaticCopyUsage|DynamicCopyUsage|StreamCopyUsage)} value - The usage to set.\n * @return {InterleavedBuffer} A reference to this interleaved buffer.\n */\n setUsage(e) {\n return this.usage = e, this;\n }\n /**\n * Adds a range of data in the data array to be updated on the GPU.\n *\n * @param {number} start - Position at which to start update.\n * @param {number} count - The number of components to update.\n */\n addUpdateRange(e, t) {\n this.updateRanges.push({ start: e, count: t });\n }\n /**\n * Clears the update ranges.\n */\n clearUpdateRanges() {\n this.updateRanges.length = 0;\n }\n /**\n * Copies the values of the given interleaved buffer to this instance.\n *\n * @param {InterleavedBuffer} source - The interleaved buffer to copy.\n * @return {InterleavedBuffer} A reference to this instance.\n */\n copy(e) {\n return this.array = new e.array.constructor(e.array), this.count = e.count, this.stride = e.stride, this.usage = e.usage, this;\n }\n /**\n * Copies a vector from the given interleaved buffer to this one. The start\n * and destination position in the attribute buffers are represented by the\n * given indices.\n *\n * @param {number} index1 - The destination index into this interleaved buffer.\n * @param {InterleavedBuffer} interleavedBuffer - The interleaved buffer to copy from.\n * @param {number} index2 - The source index into the given interleaved buffer.\n * @return {InterleavedBuffer} A reference to this instance.\n */\n copyAt(e, t, n) {\n e *= this.stride, n *= t.stride;\n for (let s = 0, r = this.stride; s < r; s++)\n this.array[e + s] = t.array[n + s];\n return this;\n }\n /**\n * Sets the given array data in the interleaved buffer.\n *\n * @param {(TypedArray|Array)} value - The array data to set.\n * @param {number} [offset=0] - The offset in this interleaved buffer's array.\n * @return {InterleavedBuffer} A reference to this instance.\n */\n set(e, t = 0) {\n return this.array.set(e, t), this;\n }\n /**\n * Returns a new interleaved buffer with copied values from this instance.\n *\n * @param {Object} [data] - An object with shared array buffers that allows to retain shared structures.\n * @return {InterleavedBuffer} A clone of this instance.\n */\n clone(e) {\n e.arrayBuffers === void 0 && (e.arrayBuffers = {}), this.array.buffer._uuid === void 0 && (this.array.buffer._uuid = fn()), e.arrayBuffers[this.array.buffer._uuid] === void 0 && (e.arrayBuffers[this.array.buffer._uuid] = this.array.slice(0).buffer);\n const t = new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]), n = new this.constructor(t, this.stride);\n return n.setUsage(this.usage), n;\n }\n /**\n * Sets the given callback function that is executed after the Renderer has transferred\n * the array data to the GPU. Can be used to perform clean-up operations after\n * the upload when data are not needed anymore on the CPU side.\n *\n * @param {Function} callback - The `onUpload()` callback.\n * @return {InterleavedBuffer} A reference to this instance.\n */\n onUpload(e) {\n return this.onUploadCallback = e, this;\n }\n /**\n * Serializes the interleaved buffer into JSON.\n *\n * @param {Object} [data] - An optional value holding meta information about the serialization.\n * @return {Object} A JSON object representing the serialized interleaved buffer.\n */\n toJSON(e) {\n return e.arrayBuffers === void 0 && (e.arrayBuffers = {}), this.array.buffer._uuid === void 0 && (this.array.buffer._uuid = fn()), e.arrayBuffers[this.array.buffer._uuid] === void 0 && (e.arrayBuffers[this.array.buffer._uuid] = Array.from(new Uint32Array(this.array.buffer))), {\n uuid: this.uuid,\n buffer: this.array.buffer._uuid,\n type: this.array.constructor.name,\n stride: this.stride\n };\n }\n}\nconst Ft = /* @__PURE__ */ new w();\nclass Oo {\n /**\n * Constructs a new interleaved buffer attribute.\n *\n * @param {InterleavedBuffer} interleavedBuffer - The buffer holding the interleaved data.\n * @param {number} itemSize - The item size.\n * @param {number} offset - The attribute offset into the buffer.\n * @param {boolean} [normalized=false] - Whether the data are normalized or not.\n */\n constructor(e, t, n, s = !1) {\n this.isInterleavedBufferAttribute = !0, this.name = \"\", this.data = e, this.itemSize = t, this.offset = n, this.normalized = s;\n }\n /**\n * The item count of this buffer attribute.\n *\n * @type {number}\n * @readonly\n */\n get count() {\n return this.data.count;\n }\n /**\n * The array holding the interleaved buffer attribute data.\n *\n * @type {TypedArray}\n */\n get array() {\n return this.data.array;\n }\n /**\n * Flag to indicate that this attribute has changed and should be re-sent to\n * the GPU. Set this to `true` when you modify the value of the array.\n *\n * @type {number}\n * @default false\n * @param {boolean} value\n */\n set needsUpdate(e) {\n this.data.needsUpdate = e;\n }\n /**\n * Applies the given 4x4 matrix to the given attribute. Only works with\n * item size `3`.\n *\n * @param {Matrix4} m - The matrix to apply.\n * @return {InterleavedBufferAttribute} A reference to this instance.\n */\n applyMatrix4(e) {\n for (let t = 0, n = this.data.count; t < n; t++)\n Ft.fromBufferAttribute(this, t), Ft.applyMatrix4(e), this.setXYZ(t, Ft.x, Ft.y, Ft.z);\n return this;\n }\n /**\n * Applies the given 3x3 normal matrix to the given attribute. Only works with\n * item size `3`.\n *\n * @param {Matrix3} m - The normal matrix to apply.\n * @return {InterleavedBufferAttribute} A reference to this instance.\n */\n applyNormalMatrix(e) {\n for (let t = 0, n = this.count; t < n; t++)\n Ft.fromBufferAttribute(this, t), Ft.applyNormalMatrix(e), this.setXYZ(t, Ft.x, Ft.y, Ft.z);\n return this;\n }\n /**\n * Applies the given 4x4 matrix to the given attribute. Only works with\n * item size `3` and with direction vectors.\n *\n * @param {Matrix4} m - The matrix to apply.\n * @return {InterleavedBufferAttribute} A reference to this instance.\n */\n transformDirection(e) {\n for (let t = 0, n = this.count; t < n; t++)\n Ft.fromBufferAttribute(this, t), Ft.transformDirection(e), this.setXYZ(t, Ft.x, Ft.y, Ft.z);\n return this;\n }\n /**\n * Returns the given component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @param {number} component - The component index.\n * @return {number} The returned value.\n */\n getComponent(e, t) {\n let n = this.array[e * this.data.stride + this.offset + t];\n return this.normalized && (n = hn(n, this.array)), n;\n }\n /**\n * Sets the given value to the given component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @param {number} component - The component index.\n * @param {number} value - The value to set.\n * @return {InterleavedBufferAttribute} A reference to this instance.\n */\n setComponent(e, t, n) {\n return this.normalized && (n = tt(n, this.array)), this.data.array[e * this.data.stride + this.offset + t] = n, this;\n }\n /**\n * Sets the x component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @param {number} x - The value to set.\n * @return {InterleavedBufferAttribute} A reference to this instance.\n */\n setX(e, t) {\n return this.normalized && (t = tt(t, this.array)), this.data.array[e * this.data.stride + this.offset] = t, this;\n }\n /**\n * Sets the y component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @param {number} y - The value to set.\n * @return {InterleavedBufferAttribute} A reference to this instance.\n */\n setY(e, t) {\n return this.normalized && (t = tt(t, this.array)), this.data.array[e * this.data.stride + this.offset + 1] = t, this;\n }\n /**\n * Sets the z component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @param {number} z - The value to set.\n * @return {InterleavedBufferAttribute} A reference to this instance.\n */\n setZ(e, t) {\n return this.normalized && (t = tt(t, this.array)), this.data.array[e * this.data.stride + this.offset + 2] = t, this;\n }\n /**\n * Sets the w component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @param {number} w - The value to set.\n * @return {InterleavedBufferAttribute} A reference to this instance.\n */\n setW(e, t) {\n return this.normalized && (t = tt(t, this.array)), this.data.array[e * this.data.stride + this.offset + 3] = t, this;\n }\n /**\n * Returns the x component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @return {number} The x component.\n */\n getX(e) {\n let t = this.data.array[e * this.data.stride + this.offset];\n return this.normalized && (t = hn(t, this.array)), t;\n }\n /**\n * Returns the y component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @return {number} The y component.\n */\n getY(e) {\n let t = this.data.array[e * this.data.stride + this.offset + 1];\n return this.normalized && (t = hn(t, this.array)), t;\n }\n /**\n * Returns the z component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @return {number} The z component.\n */\n getZ(e) {\n let t = this.data.array[e * this.data.stride + this.offset + 2];\n return this.normalized && (t = hn(t, this.array)), t;\n }\n /**\n * Returns the w component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @return {number} The w component.\n */\n getW(e) {\n let t = this.data.array[e * this.data.stride + this.offset + 3];\n return this.normalized && (t = hn(t, this.array)), t;\n }\n /**\n * Sets the x and y component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @param {number} x - The value for the x component to set.\n * @param {number} y - The value for the y component to set.\n * @return {InterleavedBufferAttribute} A reference to this instance.\n */\n setXY(e, t, n) {\n return e = e * this.data.stride + this.offset, this.normalized && (t = tt(t, this.array), n = tt(n, this.array)), this.data.array[e + 0] = t, this.data.array[e + 1] = n, this;\n }\n /**\n * Sets the x, y and z component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @param {number} x - The value for the x component to set.\n * @param {number} y - The value for the y component to set.\n * @param {number} z - The value for the z component to set.\n * @return {InterleavedBufferAttribute} A reference to this instance.\n */\n setXYZ(e, t, n, s) {\n return e = e * this.data.stride + this.offset, this.normalized && (t = tt(t, this.array), n = tt(n, this.array), s = tt(s, this.array)), this.data.array[e + 0] = t, this.data.array[e + 1] = n, this.data.array[e + 2] = s, this;\n }\n /**\n * Sets the x, y, z and w component of the vector at the given index.\n *\n * @param {number} index - The index into the buffer attribute.\n * @param {number} x - The value for the x component to set.\n * @param {number} y - The value for the y component to set.\n * @param {number} z - The value for the z component to set.\n * @param {number} w - The value for the w component to set.\n * @return {InterleavedBufferAttribute} A reference to this instance.\n */\n setXYZW(e, t, n, s, r) {\n return e = e * this.data.stride + this.offset, this.normalized && (t = tt(t, this.array), n = tt(n, this.array), s = tt(s, this.array), r = tt(r, this.array)), this.data.array[e + 0] = t, this.data.array[e + 1] = n, this.data.array[e + 2] = s, this.data.array[e + 3] = r, this;\n }\n /**\n * Returns a new buffer attribute with copied values from this instance.\n *\n * If no parameter is provided, cloning an interleaved buffer attribute will de-interleave buffer data.\n *\n * @param {Object} [data] - An object with interleaved buffers that allows to retain the interleaved property.\n * @return {BufferAttribute|InterleavedBufferAttribute} A clone of this instance.\n */\n clone(e) {\n if (e === void 0) {\n yr(\"InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.\");\n const t = [];\n for (let n = 0; n < this.count; n++) {\n const s = n * this.data.stride + this.offset;\n for (let r = 0; r < this.itemSize; r++)\n t.push(this.data.array[s + r]);\n }\n return new kt(new this.array.constructor(t), this.itemSize, this.normalized);\n } else\n return e.interleavedBuffers === void 0 && (e.interleavedBuffers = {}), e.interleavedBuffers[this.data.uuid] === void 0 && (e.interleavedBuffers[this.data.uuid] = this.data.clone(e)), new Oo(e.interleavedBuffers[this.data.uuid], this.itemSize, this.offset, this.normalized);\n }\n /**\n * Serializes the buffer attribute into JSON.\n *\n * If no parameter is provided, cloning an interleaved buffer attribute will de-interleave buffer data.\n *\n * @param {Object} [data] - An optional value holding meta information about the serialization.\n * @return {Object} A JSON object representing the serialized buffer attribute.\n */\n toJSON(e) {\n if (e === void 0) {\n yr(\"InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.\");\n const t = [];\n for (let n = 0; n < this.count; n++) {\n const s = n * this.data.stride + this.offset;\n for (let r = 0; r < this.itemSize; r++)\n t.push(this.data.array[s + r]);\n }\n return {\n itemSize: this.itemSize,\n type: this.array.constructor.name,\n array: t,\n normalized: this.normalized\n };\n } else\n return e.interleavedBuffers === void 0 && (e.interleavedBuffers = {}), e.interleavedBuffers[this.data.uuid] === void 0 && (e.interleavedBuffers[this.data.uuid] = this.data.toJSON(e)), {\n isInterleavedBufferAttribute: !0,\n itemSize: this.itemSize,\n data: this.data.uuid,\n offset: this.offset,\n normalized: this.normalized\n };\n }\n}\nconst Al = /* @__PURE__ */ new w(), Rl = /* @__PURE__ */ new Je(), Cl = /* @__PURE__ */ new Je(), id = /* @__PURE__ */ new w(), Pl = /* @__PURE__ */ new Ne(), Zs = /* @__PURE__ */ new w(), sa = /* @__PURE__ */ new Rn(), Dl = /* @__PURE__ */ new Ne(), ra = /* @__PURE__ */ new Ji();\nclass sd extends ot {\n /**\n * Constructs a new skinned mesh.\n *\n * @param {BufferGeometry} [geometry] - The mesh geometry.\n * @param {Material|Array} [material] - The mesh material.\n */\n constructor(e, t) {\n super(e, t), this.isSkinnedMesh = !0, this.type = \"SkinnedMesh\", this.bindMode = sl, this.bindMatrix = new Ne(), this.bindMatrixInverse = new Ne(), this.boundingBox = null, this.boundingSphere = null;\n }\n /**\n * Computes the bounding box of the skinned mesh, and updates {@link SkinnedMesh#boundingBox}.\n * The bounding box is not automatically computed by the engine; this method must be called by your app.\n * If the skinned mesh is animated, the bounding box should be recomputed per frame in order to reflect\n * the current animation state.\n */\n computeBoundingBox() {\n const e = this.geometry;\n this.boundingBox === null && (this.boundingBox = new Pt()), this.boundingBox.makeEmpty();\n const t = e.getAttribute(\"position\");\n for (let n = 0; n < t.count; n++)\n this.getVertexPosition(n, Zs), this.boundingBox.expandByPoint(Zs);\n }\n /**\n * Computes the bounding sphere of the skinned mesh, and updates {@link SkinnedMesh#boundingSphere}.\n * The bounding sphere is automatically computed by the engine once when it is needed, e.g., for ray casting\n * and view frustum culling. If the skinned mesh is animated, the bounding sphere should be recomputed\n * per frame in order to reflect the current animation state.\n */\n computeBoundingSphere() {\n const e = this.geometry;\n this.boundingSphere === null && (this.boundingSphere = new Rn()), this.boundingSphere.makeEmpty();\n const t = e.getAttribute(\"position\");\n for (let n = 0; n < t.count; n++)\n this.getVertexPosition(n, Zs), this.boundingSphere.expandByPoint(Zs);\n }\n copy(e, t) {\n return super.copy(e, t), this.bindMode = e.bindMode, this.bindMatrix.copy(e.bindMatrix), this.bindMatrixInverse.copy(e.bindMatrixInverse), this.skeleton = e.skeleton, e.boundingBox !== null && (this.boundingBox = e.boundingBox.clone()), e.boundingSphere !== null && (this.boundingSphere = e.boundingSphere.clone()), this;\n }\n raycast(e, t) {\n const n = this.material, s = this.matrixWorld;\n n !== void 0 && (this.boundingSphere === null && this.computeBoundingSphere(), sa.copy(this.boundingSphere), sa.applyMatrix4(s), e.ray.intersectsSphere(sa) !== !1 && (Dl.copy(s).invert(), ra.copy(e.ray).applyMatrix4(Dl), !(this.boundingBox !== null && ra.intersectsBox(this.boundingBox) === !1) && this._computeIntersections(e, t, ra)));\n }\n getVertexPosition(e, t) {\n return super.getVertexPosition(e, t), this.applyBoneTransform(e, t), t;\n }\n /**\n * Binds the given skeleton to the skinned mesh.\n *\n * @param {Skeleton} skeleton - The skeleton to bind.\n * @param {Matrix4} [bindMatrix] - The bind matrix. If no bind matrix is provided,\n * the skinned mesh's world matrix will be used instead.\n */\n bind(e, t) {\n this.skeleton = e, t === void 0 && (this.updateMatrixWorld(!0), this.skeleton.calculateInverses(), t = this.matrixWorld), this.bindMatrix.copy(t), this.bindMatrixInverse.copy(t).invert();\n }\n /**\n * This method sets the skinned mesh in the rest pose).\n */\n pose() {\n this.skeleton.pose();\n }\n /**\n * Normalizes the skin weights which are defined as a buffer attribute\n * in the skinned mesh's geometry.\n */\n normalizeSkinWeights() {\n const e = new Je(), t = this.geometry.attributes.skinWeight;\n for (let n = 0, s = t.count; n < s; n++) {\n e.fromBufferAttribute(t, n);\n const r = 1 / e.manhattanLength();\n r !== 1 / 0 ? e.multiplyScalar(r) : e.set(1, 0, 0, 0), t.setXYZW(n, e.x, e.y, e.z, e.w);\n }\n }\n updateMatrixWorld(e) {\n super.updateMatrixWorld(e), this.bindMode === sl ? this.bindMatrixInverse.copy(this.matrixWorld).invert() : this.bindMode === Qh ? this.bindMatrixInverse.copy(this.bindMatrix).invert() : Te(\"SkinnedMesh: Unrecognized bindMode: \" + this.bindMode);\n }\n /**\n * Applies the bone transform associated with the given index to the given\n * vertex position. Returns the updated vector.\n *\n * @param {number} index - The vertex index.\n * @param {Vector3} target - The target object that is used to store the method's result.\n * the skinned mesh's world matrix will be used instead.\n * @return {Vector3} The updated vertex position.\n */\n applyBoneTransform(e, t) {\n const n = this.skeleton, s = this.geometry;\n Rl.fromBufferAttribute(s.attributes.skinIndex, e), Cl.fromBufferAttribute(s.attributes.skinWeight, e), Al.copy(t).applyMatrix4(this.bindMatrix), t.set(0, 0, 0);\n for (let r = 0; r < 4; r++) {\n const a = Cl.getComponent(r);\n if (a !== 0) {\n const o = Rl.getComponent(r);\n Pl.multiplyMatrices(n.bones[o].matrixWorld, n.boneInverses[o]), t.addScaledVector(id.copy(Al).applyMatrix4(Pl), a);\n }\n }\n return t.applyMatrix4(this.bindMatrixInverse);\n }\n}\nclass sh extends pt {\n /**\n * Constructs a new bone.\n */\n constructor() {\n super(), this.isBone = !0, this.type = \"Bone\";\n }\n}\nclass Qi extends Ct {\n /**\n * Constructs a new data texture.\n *\n * @param {?TypedArray} [data=null] - The buffer data.\n * @param {number} [width=1] - The width of the texture.\n * @param {number} [height=1] - The height of the texture.\n * @param {number} [format=RGBAFormat] - The texture format.\n * @param {number} [type=UnsignedByteType] - The texture type.\n * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping.\n * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value.\n * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value.\n * @param {number} [magFilter=NearestFilter] - The mag filter value.\n * @param {number} [minFilter=NearestFilter] - The min filter value.\n * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.\n * @param {string} [colorSpace=NoColorSpace] - The color space.\n */\n constructor(e = null, t = 1, n = 1, s, r, a, o, l, c = Dt, h = Dt, u, d) {\n super(null, a, o, l, c, h, s, r, u, d), this.isDataTexture = !0, this.image = { data: e, width: t, height: n }, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1;\n }\n}\nconst Ll = /* @__PURE__ */ new Ne(), rd = /* @__PURE__ */ new Ne();\nclass Bo {\n /**\n * Constructs a new skeleton.\n *\n * @param {Array} [bones] - An array of bones.\n * @param {Array} [boneInverses] - An array of bone inverse matrices.\n * If not provided, these matrices will be computed automatically via {@link Skeleton#calculateInverses}.\n */\n constructor(e = [], t = []) {\n this.uuid = fn(), this.bones = e.slice(0), this.boneInverses = t, this.boneMatrices = null, this.boneTexture = null, this.init();\n }\n /**\n * Initializes the skeleton. This method gets automatically called by the constructor\n * but depending on how the skeleton is created it might be necessary to call this method\n * manually.\n */\n init() {\n const e = this.bones, t = this.boneInverses;\n if (this.boneMatrices = new Float32Array(e.length * 16), t.length === 0)\n this.calculateInverses();\n else if (e.length !== t.length) {\n Te(\"Skeleton: Number of inverse bone matrices does not match amount of bones.\"), this.boneInverses = [];\n for (let n = 0, s = this.bones.length; n < s; n++)\n this.boneInverses.push(new Ne());\n }\n }\n /**\n * Computes the bone inverse matrices. This method resets {@link Skeleton#boneInverses}\n * and fills it with new matrices.\n */\n calculateInverses() {\n this.boneInverses.length = 0;\n for (let e = 0, t = this.bones.length; e < t; e++) {\n const n = new Ne();\n this.bones[e] && n.copy(this.bones[e].matrixWorld).invert(), this.boneInverses.push(n);\n }\n }\n /**\n * Resets the skeleton to the base pose.\n */\n pose() {\n for (let e = 0, t = this.bones.length; e < t; e++) {\n const n = this.bones[e];\n n && n.matrixWorld.copy(this.boneInverses[e]).invert();\n }\n for (let e = 0, t = this.bones.length; e < t; e++) {\n const n = this.bones[e];\n n && (n.parent && n.parent.isBone ? (n.matrix.copy(n.parent.matrixWorld).invert(), n.matrix.multiply(n.matrixWorld)) : n.matrix.copy(n.matrixWorld), n.matrix.decompose(n.position, n.quaternion, n.scale));\n }\n }\n /**\n * Resets the skeleton to the base pose.\n */\n update() {\n const e = this.bones, t = this.boneInverses, n = this.boneMatrices, s = this.boneTexture;\n for (let r = 0, a = e.length; r < a; r++) {\n const o = e[r] ? e[r].matrixWorld : rd;\n Ll.multiplyMatrices(o, t[r]), Ll.toArray(n, r * 16);\n }\n s !== null && (s.needsUpdate = !0);\n }\n /**\n * Returns a new skeleton with copied values from this instance.\n *\n * @return {Skeleton} A clone of this instance.\n */\n clone() {\n return new Bo(this.bones, this.boneInverses);\n }\n /**\n * Computes a data texture for passing bone data to the vertex shader.\n *\n * @return {Skeleton} A reference of this instance.\n */\n computeBoneTexture() {\n let e = Math.sqrt(this.bones.length * 4);\n e = Math.ceil(e / 4) * 4, e = Math.max(e, 4);\n const t = new Float32Array(e * e * 4);\n t.set(this.boneMatrices);\n const n = new Qi(t, e, e, Zt, Xt);\n return n.needsUpdate = !0, this.boneMatrices = t, this.boneTexture = n, this;\n }\n /**\n * Searches through the skeleton's bone array and returns the first with a\n * matching name.\n *\n * @param {string} name - The name of the bone.\n * @return {Bone|undefined} The found bone. `undefined` if no bone has been found.\n */\n getBoneByName(e) {\n for (let t = 0, n = this.bones.length; t < n; t++) {\n const s = this.bones[t];\n if (s.name === e)\n return s;\n }\n }\n /**\n * Frees the GPU-related resources allocated by this instance. Call this\n * method whenever this instance is no longer used in your app.\n */\n dispose() {\n this.boneTexture !== null && (this.boneTexture.dispose(), this.boneTexture = null);\n }\n /**\n * Setups the skeleton by the given JSON and bones.\n *\n * @param {Object} json - The skeleton as serialized JSON.\n * @param {Object} bones - An array of bones.\n * @return {Skeleton} A reference of this instance.\n */\n fromJSON(e, t) {\n this.uuid = e.uuid;\n for (let n = 0, s = e.bones.length; n < s; n++) {\n const r = e.bones[n];\n let a = t[r];\n a === void 0 && (Te(\"Skeleton: No bone found with UUID:\", r), a = new sh()), this.bones.push(a), this.boneInverses.push(new Ne().fromArray(e.boneInverses[n]));\n }\n return this.init(), this;\n }\n /**\n * Serializes the skeleton into JSON.\n *\n * @return {Object} A JSON object representing the serialized skeleton.\n * @see {@link ObjectLoader#parse}\n */\n toJSON() {\n const e = {\n metadata: {\n version: 4.7,\n type: \"Skeleton\",\n generator: \"Skeleton.toJSON\"\n },\n bones: [],\n boneInverses: []\n };\n e.uuid = this.uuid;\n const t = this.bones, n = this.boneInverses;\n for (let s = 0, r = t.length; s < r; s++) {\n const a = t[s];\n e.bones.push(a.uuid);\n const o = n[s];\n e.boneInverses.push(o.toArray());\n }\n return e;\n }\n}\nclass uo extends kt {\n /**\n * Constructs a new instanced buffer attribute.\n *\n * @param {TypedArray} array - The array holding the attribute data.\n * @param {number} itemSize - The item size.\n * @param {boolean} [normalized=false] - Whether the data are normalized or not.\n * @param {number} [meshPerAttribute=1] - How often a value of this buffer attribute should be repeated.\n */\n constructor(e, t, n, s = 1) {\n super(e, t, n), this.isInstancedBufferAttribute = !0, this.meshPerAttribute = s;\n }\n copy(e) {\n return super.copy(e), this.meshPerAttribute = e.meshPerAttribute, this;\n }\n toJSON() {\n const e = super.toJSON();\n return e.meshPerAttribute = this.meshPerAttribute, e.isInstancedBufferAttribute = !0, e;\n }\n}\nconst Pi = /* @__PURE__ */ new Ne(), Il = /* @__PURE__ */ new Ne(), $s = [], Ul = /* @__PURE__ */ new Pt(), ad = /* @__PURE__ */ new Ne(), ls = /* @__PURE__ */ new ot(), cs = /* @__PURE__ */ new Rn();\nclass od extends ot {\n /**\n * Constructs a new instanced mesh.\n *\n * @param {BufferGeometry} [geometry] - The mesh geometry.\n * @param {Material|Array} [material] - The mesh material.\n * @param {number} count - The number of instances.\n */\n constructor(e, t, n) {\n super(e, t), this.isInstancedMesh = !0, this.instanceMatrix = new uo(new Float32Array(n * 16), 16), this.instanceColor = null, this.morphTexture = null, this.count = n, this.boundingBox = null, this.boundingSphere = null;\n for (let s = 0; s < n; s++)\n this.setMatrixAt(s, ad);\n }\n /**\n * Computes the bounding box of the instanced mesh, and updates {@link InstancedMesh#boundingBox}.\n * The bounding box is not automatically computed by the engine; this method must be called by your app.\n * You may need to recompute the bounding box if an instance is transformed via {@link InstancedMesh#setMatrixAt}.\n */\n computeBoundingBox() {\n const e = this.geometry, t = this.count;\n this.boundingBox === null && (this.boundingBox = new Pt()), e.boundingBox === null && e.computeBoundingBox(), this.boundingBox.makeEmpty();\n for (let n = 0; n < t; n++)\n this.getMatrixAt(n, Pi), Ul.copy(e.boundingBox).applyMatrix4(Pi), this.boundingBox.union(Ul);\n }\n /**\n * Computes the bounding sphere of the instanced mesh, and updates {@link InstancedMesh#boundingSphere}\n * The engine automatically computes the bounding sphere when it is needed, e.g., for ray casting or view frustum culling.\n * You may need to recompute the bounding sphere if an instance is transformed via {@link InstancedMesh#setMatrixAt}.\n */\n computeBoundingSphere() {\n const e = this.geometry, t = this.count;\n this.boundingSphere === null && (this.boundingSphere = new Rn()), e.boundingSphere === null && e.computeBoundingSphere(), this.boundingSphere.makeEmpty();\n for (let n = 0; n < t; n++)\n this.getMatrixAt(n, Pi), cs.copy(e.boundingSphere).applyMatrix4(Pi), this.boundingSphere.union(cs);\n }\n copy(e, t) {\n return super.copy(e, t), this.instanceMatrix.copy(e.instanceMatrix), e.morphTexture !== null && (this.morphTexture = e.morphTexture.clone()), e.instanceColor !== null && (this.instanceColor = e.instanceColor.clone()), this.count = e.count, e.boundingBox !== null && (this.boundingBox = e.boundingBox.clone()), e.boundingSphere !== null && (this.boundingSphere = e.boundingSphere.clone()), this;\n }\n /**\n * Gets the color of the defined instance.\n *\n * @param {number} index - The instance index.\n * @param {Color} color - The target object that is used to store the method's result.\n */\n getColorAt(e, t) {\n t.fromArray(this.instanceColor.array, e * 3);\n }\n /**\n * Gets the local transformation matrix of the defined instance.\n *\n * @param {number} index - The instance index.\n * @param {Matrix4} matrix - The target object that is used to store the method's result.\n */\n getMatrixAt(e, t) {\n t.fromArray(this.instanceMatrix.array, e * 16);\n }\n /**\n * Gets the morph target weights of the defined instance.\n *\n * @param {number} index - The instance index.\n * @param {Mesh} object - The target object that is used to store the method's result.\n */\n getMorphAt(e, t) {\n const n = t.morphTargetInfluences, s = this.morphTexture.source.data.data, r = n.length + 1, a = e * r + 1;\n for (let o = 0; o < n.length; o++)\n n[o] = s[a + o];\n }\n raycast(e, t) {\n const n = this.matrixWorld, s = this.count;\n if (ls.geometry = this.geometry, ls.material = this.material, ls.material !== void 0 && (this.boundingSphere === null && this.computeBoundingSphere(), cs.copy(this.boundingSphere), cs.applyMatrix4(n), e.ray.intersectsSphere(cs) !== !1))\n for (let r = 0; r < s; r++) {\n this.getMatrixAt(r, Pi), Il.multiplyMatrices(n, Pi), ls.matrixWorld = Il, ls.raycast(e, $s);\n for (let a = 0, o = $s.length; a < o; a++) {\n const l = $s[a];\n l.instanceId = r, l.object = this, t.push(l);\n }\n $s.length = 0;\n }\n }\n /**\n * Sets the given color to the defined instance. Make sure you set the `needsUpdate` flag of\n * {@link InstancedMesh#instanceColor} to `true` after updating all the colors.\n *\n * @param {number} index - The instance index.\n * @param {Color} color - The instance color.\n */\n setColorAt(e, t) {\n this.instanceColor === null && (this.instanceColor = new uo(new Float32Array(this.instanceMatrix.count * 3).fill(1), 3)), t.toArray(this.instanceColor.array, e * 3);\n }\n /**\n * Sets the given local transformation matrix to the defined instance. Make sure you set the `needsUpdate` flag of\n * {@link InstancedMesh#instanceMatrix} to `true` after updating all the colors.\n *\n * @param {number} index - The instance index.\n * @param {Matrix4} matrix - The local transformation.\n */\n setMatrixAt(e, t) {\n t.toArray(this.instanceMatrix.array, e * 16);\n }\n /**\n * Sets the morph target weights to the defined instance. Make sure you set the `needsUpdate` flag of\n * {@link InstancedMesh#morphTexture} to `true` after updating all the influences.\n *\n * @param {number} index - The instance index.\n * @param {Mesh} object - A mesh which `morphTargetInfluences` property containing the morph target weights\n * of a single instance.\n */\n setMorphAt(e, t) {\n const n = t.morphTargetInfluences, s = n.length + 1;\n this.morphTexture === null && (this.morphTexture = new Qi(new Float32Array(s * this.count), s, this.count, wo, Xt));\n const r = this.morphTexture.source.data.data;\n let a = 0;\n for (let c = 0; c < n.length; c++)\n a += n[c];\n const o = this.geometry.morphTargetsRelative ? 1 : 1 - a, l = s * e;\n r[l] = o, r.set(n, l + 1);\n }\n updateMorphTargets() {\n }\n /**\n * Frees the GPU-related resources allocated by this instance. Call this\n * method whenever this instance is no longer used in your app.\n */\n dispose() {\n this.dispatchEvent({ type: \"dispose\" }), this.morphTexture !== null && (this.morphTexture.dispose(), this.morphTexture = null);\n }\n}\nconst aa = /* @__PURE__ */ new w(), ld = /* @__PURE__ */ new w(), cd = /* @__PURE__ */ new ze();\nclass Sn {\n /**\n * Constructs a new plane.\n *\n * @param {Vector3} [normal=(1,0,0)] - A unit length vector defining the normal of the plane.\n * @param {number} [constant=0] - The signed distance from the origin to the plane.\n */\n constructor(e = new w(1, 0, 0), t = 0) {\n this.isPlane = !0, this.normal = e, this.constant = t;\n }\n /**\n * Sets the plane components by copying the given values.\n *\n * @param {Vector3} normal - The normal.\n * @param {number} constant - The constant.\n * @return {Plane} A reference to this plane.\n */\n set(e, t) {\n return this.normal.copy(e), this.constant = t, this;\n }\n /**\n * Sets the plane components by defining `x`, `y`, `z` as the\n * plane normal and `w` as the constant.\n *\n * @param {number} x - The value for the normal's x component.\n * @param {number} y - The value for the normal's y component.\n * @param {number} z - The value for the normal's z component.\n * @param {number} w - The constant value.\n * @return {Plane} A reference to this plane.\n */\n setComponents(e, t, n, s) {\n return this.normal.set(e, t, n), this.constant = s, this;\n }\n /**\n * Sets the plane from the given normal and coplanar point (that is a point\n * that lies onto the plane).\n *\n * @param {Vector3} normal - The normal.\n * @param {Vector3} point - A coplanar point.\n * @return {Plane} A reference to this plane.\n */\n setFromNormalAndCoplanarPoint(e, t) {\n return this.normal.copy(e), this.constant = -t.dot(this.normal), this;\n }\n /**\n * Sets the plane from three coplanar points. The winding order is\n * assumed to be counter-clockwise, and determines the direction of\n * the plane normal.\n *\n * @param {Vector3} a - The first coplanar point.\n * @param {Vector3} b - The second coplanar point.\n * @param {Vector3} c - The third coplanar point.\n * @return {Plane} A reference to this plane.\n */\n setFromCoplanarPoints(e, t, n) {\n const s = aa.subVectors(n, t).cross(ld.subVectors(e, t)).normalize();\n return this.setFromNormalAndCoplanarPoint(s, e), this;\n }\n /**\n * Copies the values of the given plane to this instance.\n *\n * @param {Plane} plane - The plane to copy.\n * @return {Plane} A reference to this plane.\n */\n copy(e) {\n return this.normal.copy(e.normal), this.constant = e.constant, this;\n }\n /**\n * Normalizes the plane normal and adjusts the constant accordingly.\n *\n * @return {Plane} A reference to this plane.\n */\n normalize() {\n const e = 1 / this.normal.length();\n return this.normal.multiplyScalar(e), this.constant *= e, this;\n }\n /**\n * Negates both the plane normal and the constant.\n *\n * @return {Plane} A reference to this plane.\n */\n negate() {\n return this.constant *= -1, this.normal.negate(), this;\n }\n /**\n * Returns the signed distance from the given point to this plane.\n *\n * @param {Vector3} point - The point to compute the distance for.\n * @return {number} The signed distance.\n */\n distanceToPoint(e) {\n return this.normal.dot(e) + this.constant;\n }\n /**\n * Returns the signed distance from the given sphere to this plane.\n *\n * @param {Sphere} sphere - The sphere to compute the distance for.\n * @return {number} The signed distance.\n */\n distanceToSphere(e) {\n return this.distanceToPoint(e.center) - e.radius;\n }\n /**\n * Projects a the given point onto the plane.\n *\n * @param {Vector3} point - The point to project.\n * @param {Vector3} target - The target vector that is used to store the method's result.\n * @return {Vector3} The projected point on the plane.\n */\n projectPoint(e, t) {\n return t.copy(e).addScaledVector(this.normal, -this.distanceToPoint(e));\n }\n /**\n * Returns the intersection point of the passed line and the plane. Returns\n * `null` if the line does not intersect. Returns the line's starting point if\n * the line is coplanar with the plane.\n *\n * @param {Line3} line - The line to compute the intersection for.\n * @param {Vector3} target - The target vector that is used to store the method's result.\n * @return {?Vector3} The intersection point.\n */\n intersectLine(e, t) {\n const n = e.delta(aa), s = this.normal.dot(n);\n if (s === 0)\n return this.distanceToPoint(e.start) === 0 ? t.copy(e.start) : null;\n const r = -(e.start.dot(this.normal) + this.constant) / s;\n return r < 0 || r > 1 ? null : t.copy(e.start).addScaledVector(n, r);\n }\n /**\n * Returns `true` if the given line segment intersects with (passes through) the plane.\n *\n * @param {Line3} line - The line to test.\n * @return {boolean} Whether the given line segment intersects with the plane or not.\n */\n intersectsLine(e) {\n const t = this.distanceToPoint(e.start), n = this.distanceToPoint(e.end);\n return t < 0 && n > 0 || n < 0 && t > 0;\n }\n /**\n * Returns `true` if the given bounding box intersects with the plane.\n *\n * @param {Box3} box - The bounding box to test.\n * @return {boolean} Whether the given bounding box intersects with the plane or not.\n */\n intersectsBox(e) {\n return e.intersectsPlane(this);\n }\n /**\n * Returns `true` if the given bounding sphere intersects with the plane.\n *\n * @param {Sphere} sphere - The bounding sphere to test.\n * @return {boolean} Whether the given bounding sphere intersects with the plane or not.\n */\n intersectsSphere(e) {\n return e.intersectsPlane(this);\n }\n /**\n * Returns a coplanar vector to the plane, by calculating the\n * projection of the normal at the origin onto the plane.\n *\n * @param {Vector3} target - The target vector that is used to store the method's result.\n * @return {Vector3} The coplanar point.\n */\n coplanarPoint(e) {\n return e.copy(this.normal).multiplyScalar(-this.constant);\n }\n /**\n * Apply a 4x4 matrix to the plane. The matrix must be an affine, homogeneous transform.\n *\n * The optional normal matrix can be pre-computed like so:\n * ```js\n * const optionalNormalMatrix = new THREE.Matrix3().getNormalMatrix( matrix );\n * ```\n *\n * @param {Matrix4} matrix - The transformation matrix.\n * @param {Matrix4} [optionalNormalMatrix] - A pre-computed normal matrix.\n * @return {Plane} A reference to this plane.\n */\n applyMatrix4(e, t) {\n const n = t || cd.getNormalMatrix(e), s = this.coplanarPoint(aa).applyMatrix4(e), r = this.normal.applyMatrix3(n).normalize();\n return this.constant = -s.dot(r), this;\n }\n /**\n * Translates the plane by the distance defined by the given offset vector.\n * Note that this only affects the plane constant and will not affect the normal vector.\n *\n * @param {Vector3} offset - The offset vector.\n * @return {Plane} A reference to this plane.\n */\n translate(e) {\n return this.constant -= e.dot(this.normal), this;\n }\n /**\n * Returns `true` if this plane is equal with the given one.\n *\n * @param {Plane} plane - The plane to test for equality.\n * @return {boolean} Whether this plane is equal with the given one.\n */\n equals(e) {\n return e.normal.equals(this.normal) && e.constant === this.constant;\n }\n /**\n * Returns a new plane with copied values from this instance.\n *\n * @return {Plane} A clone of this instance.\n */\n clone() {\n return new this.constructor().copy(this);\n }\n}\nconst oi = /* @__PURE__ */ new Rn(), hd = /* @__PURE__ */ new le(0.5, 0.5), Js = /* @__PURE__ */ new w();\nclass zo {\n /**\n * Constructs a new frustum.\n *\n * @param {Plane} [p0] - The first plane that encloses the frustum.\n * @param {Plane} [p1] - The second plane that encloses the frustum.\n * @param {Plane} [p2] - The third plane that encloses the frustum.\n * @param {Plane} [p3] - The fourth plane that encloses the frustum.\n * @param {Plane} [p4] - The fifth plane that encloses the frustum.\n * @param {Plane} [p5] - The sixth plane that encloses the frustum.\n */\n constructor(e = new Sn(), t = new Sn(), n = new Sn(), s = new Sn(), r = new Sn(), a = new Sn()) {\n this.planes = [e, t, n, s, r, a];\n }\n /**\n * Sets the frustum planes by copying the given planes.\n *\n * @param {Plane} [p0] - The first plane that encloses the frustum.\n * @param {Plane} [p1] - The second plane that encloses the frustum.\n * @param {Plane} [p2] - The third plane that encloses the frustum.\n * @param {Plane} [p3] - The fourth plane that encloses the frustum.\n * @param {Plane} [p4] - The fifth plane that encloses the frustum.\n * @param {Plane} [p5] - The sixth plane that encloses the frustum.\n * @return {Frustum} A reference to this frustum.\n */\n set(e, t, n, s, r, a) {\n const o = this.planes;\n return o[0].copy(e), o[1].copy(t), o[2].copy(n), o[3].copy(s), o[4].copy(r), o[5].copy(a), this;\n }\n /**\n * Copies the values of the given frustum to this instance.\n *\n * @param {Frustum} frustum - The frustum to copy.\n * @return {Frustum} A reference to this frustum.\n */\n copy(e) {\n const t = this.planes;\n for (let n = 0; n < 6; n++)\n t[n].copy(e.planes[n]);\n return this;\n }\n /**\n * Sets the frustum planes from the given projection matrix.\n *\n * @param {Matrix4} m - The projection matrix.\n * @param {(WebGLCoordinateSystem|WebGPUCoordinateSystem)} coordinateSystem - The coordinate system.\n * @param {boolean} [reversedDepth=false] - Whether to use a reversed depth.\n * @return {Frustum} A reference to this frustum.\n */\n setFromProjectionMatrix(e, t = Tn, n = !1) {\n const s = this.planes, r = e.elements, a = r[0], o = r[1], l = r[2], c = r[3], h = r[4], u = r[5], d = r[6], p = r[7], g = r[8], x = r[9], m = r[10], f = r[11], y = r[12], v = r[13], T = r[14], R = r[15];\n if (s[0].setComponents(c - a, p - h, f - g, R - y).normalize(), s[1].setComponents(c + a, p + h, f + g, R + y).normalize(), s[2].setComponents(c + o, p + u, f + x, R + v).normalize(), s[3].setComponents(c - o, p - u, f - x, R - v).normalize(), n)\n s[4].setComponents(l, d, m, T).normalize(), s[5].setComponents(c - l, p - d, f - m, R - T).normalize();\n else if (s[4].setComponents(c - l, p - d, f - m, R - T).normalize(), t === Tn)\n s[5].setComponents(c + l, p + d, f + m, R + T).normalize();\n else if (t === br)\n s[5].setComponents(l, d, m, T).normalize();\n else\n throw new Error(\"THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: \" + t);\n return this;\n }\n /**\n * Returns `true` if the 3D object's bounding sphere is intersecting this frustum.\n *\n * Note that the 3D object must have a geometry so that the bounding sphere can be calculated.\n *\n * @param {Object3D} object - The 3D object to test.\n * @return {boolean} Whether the 3D object's bounding sphere is intersecting this frustum or not.\n */\n intersectsObject(e) {\n if (e.boundingSphere !== void 0)\n e.boundingSphere === null && e.computeBoundingSphere(), oi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);\n else {\n const t = e.geometry;\n t.boundingSphere === null && t.computeBoundingSphere(), oi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld);\n }\n return this.intersectsSphere(oi);\n }\n /**\n * Returns `true` if the given sprite is intersecting this frustum.\n *\n * @param {Sprite} sprite - The sprite to test.\n * @return {boolean} Whether the sprite is intersecting this frustum or not.\n */\n intersectsSprite(e) {\n oi.center.set(0, 0, 0);\n const t = hd.distanceTo(e.center);\n return oi.radius = 0.7071067811865476 + t, oi.applyMatrix4(e.matrixWorld), this.intersectsSphere(oi);\n }\n /**\n * Returns `true` if the given bounding sphere is intersecting this frustum.\n *\n * @param {Sphere} sphere - The bounding sphere to test.\n * @return {boolean} Whether the bounding sphere is intersecting this frustum or not.\n */\n intersectsSphere(e) {\n const t = this.planes, n = e.center, s = -e.radius;\n for (let r = 0; r < 6; r++)\n if (t[r].distanceToPoint(n) < s)\n return !1;\n return !0;\n }\n /**\n * Returns `true` if the given bounding box is intersecting this frustum.\n *\n * @param {Box3} box - The bounding box to test.\n * @return {boolean} Whether the bounding box is intersecting this frustum or not.\n */\n intersectsBox(e) {\n const t = this.planes;\n for (let n = 0; n < 6; n++) {\n const s = t[n];\n if (Js.x = s.normal.x > 0 ? e.max.x : e.min.x, Js.y = s.normal.y > 0 ? e.max.y : e.min.y, Js.z = s.normal.z > 0 ? e.max.z : e.min.z, s.distanceToPoint(Js) < 0)\n return !1;\n }\n return !0;\n }\n /**\n * Returns `true` if the given point lies within the frustum.\n *\n * @param {Vector3} point - The point to test.\n * @return {boolean} Whether the point lies within this frustum or not.\n */\n containsPoint(e) {\n const t = this.planes;\n for (let n = 0; n < 6; n++)\n if (t[n].distanceToPoint(e) < 0)\n return !1;\n return !0;\n }\n /**\n * Returns a new frustum with copied values from this instance.\n *\n * @return {Frustum} A clone of this instance.\n */\n clone() {\n return new this.constructor().copy(this);\n }\n}\nclass rh extends tn {\n /**\n * Constructs a new line basic material.\n *\n * @param {Object} [parameters] - An object with one or more properties\n * defining the material's appearance. Any property of the material\n * (including any property from inherited materials) can be passed\n * in here. Color values can be passed any type of value accepted\n * by {@link Color#set}.\n */\n constructor(e) {\n super(), this.isLineBasicMaterial = !0, this.type = \"LineBasicMaterial\", this.color = new Se(16777215), this.map = null, this.linewidth = 1, this.linecap = \"round\", this.linejoin = \"round\", this.fog = !0, this.setValues(e);\n }\n copy(e) {\n return super.copy(e), this.color.copy(e.color), this.map = e.map, this.linewidth = e.linewidth, this.linecap = e.linecap, this.linejoin = e.linejoin, this.fog = e.fog, this;\n }\n}\nconst Tr = /* @__PURE__ */ new w(), Er = /* @__PURE__ */ new w(), Nl = /* @__PURE__ */ new Ne(), hs = /* @__PURE__ */ new Ji(), Qs = /* @__PURE__ */ new Rn(), oa = /* @__PURE__ */ new w(), Fl = /* @__PURE__ */ new w();\nclass ko extends pt {\n /**\n * Constructs a new line.\n *\n * @param {BufferGeometry} [geometry] - The line geometry.\n * @param {Material|Array} [material] - The line material.\n */\n constructor(e = new nn(), t = new rh()) {\n super(), this.isLine = !0, this.type = \"Line\", this.geometry = e, this.material = t, this.morphTargetDictionary = void 0, this.morphTargetInfluences = void 0, this.updateMorphTargets();\n }\n copy(e, t) {\n return super.copy(e, t), this.material = Array.isArray(e.material) ? e.material.slice() : e.material, this.geometry = e.geometry, this;\n }\n /**\n * Computes an array of distance values which are necessary for rendering dashed lines.\n * For each vertex in the geometry, the method calculates the cumulative length from the\n * current point to the very beginning of the line.\n *\n * @return {Line} A reference to this line.\n */\n computeLineDistances() {\n const e = this.geometry;\n if (e.index === null) {\n const t = e.attributes.position, n = [0];\n for (let s = 1, r = t.count; s < r; s++)\n Tr.fromBufferAttribute(t, s - 1), Er.fromBufferAttribute(t, s), n[s] = n[s - 1], n[s] += Tr.distanceTo(Er);\n e.setAttribute(\"lineDistance\", new pn(n, 1));\n } else\n Te(\"Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.\");\n return this;\n }\n /**\n * Computes intersection points between a casted ray and this line.\n *\n * @param {Raycaster} raycaster - The raycaster.\n * @param {Array} intersects - The target array that holds the intersection points.\n */\n raycast(e, t) {\n const n = this.geometry, s = this.matrixWorld, r = e.params.Line.threshold, a = n.drawRange;\n if (n.boundingSphere === null && n.computeBoundingSphere(), Qs.copy(n.boundingSphere), Qs.applyMatrix4(s), Qs.radius += r, e.ray.intersectsSphere(Qs) === !1) return;\n Nl.copy(s).invert(), hs.copy(e.ray).applyMatrix4(Nl);\n const o = r / ((this.scale.x + this.scale.y + this.scale.z) / 3), l = o * o, c = this.isLineSegments ? 2 : 1, h = n.index, d = n.attributes.position;\n if (h !== null) {\n const p = Math.max(0, a.start), g = Math.min(h.count, a.start + a.count);\n for (let x = p, m = g - 1; x < m; x += c) {\n const f = h.getX(x), y = h.getX(x + 1), v = er(this, e, hs, l, f, y, x);\n v && t.push(v);\n }\n if (this.isLineLoop) {\n const x = h.getX(g - 1), m = h.getX(p), f = er(this, e, hs, l, x, m, g - 1);\n f && t.push(f);\n }\n } else {\n const p = Math.max(0, a.start), g = Math.min(d.count, a.start + a.count);\n for (let x = p, m = g - 1; x < m; x += c) {\n const f = er(this, e, hs, l, x, x + 1, x);\n f && t.push(f);\n }\n if (this.isLineLoop) {\n const x = er(this, e, hs, l, g - 1, p, g - 1);\n x && t.push(x);\n }\n }\n }\n /**\n * Sets the values of {@link Line#morphTargetDictionary} and {@link Line#morphTargetInfluences}\n * to make sure existing morph targets can influence this 3D object.\n */\n updateMorphTargets() {\n const t = this.geometry.morphAttributes, n = Object.keys(t);\n if (n.length > 0) {\n const s = t[n[0]];\n if (s !== void 0) {\n this.morphTargetInfluences = [], this.morphTargetDictionary = {};\n for (let r = 0, a = s.length; r < a; r++) {\n const o = s[r].name || String(r);\n this.morphTargetInfluences.push(0), this.morphTargetDictionary[o] = r;\n }\n }\n }\n }\n}\nfunction er(i, e, t, n, s, r, a) {\n const o = i.geometry.attributes.position;\n if (Tr.fromBufferAttribute(o, s), Er.fromBufferAttribute(o, r), t.distanceSqToSegment(Tr, Er, oa, Fl) > n) return;\n oa.applyMatrix4(i.matrixWorld);\n const c = e.ray.origin.distanceTo(oa);\n if (!(c < e.near || c > e.far))\n return {\n distance: c,\n // What do we want? intersection point on the ray or on the segment??\n // point: raycaster.ray.at( distance ),\n point: Fl.clone().applyMatrix4(i.matrixWorld),\n index: a,\n face: null,\n faceIndex: null,\n barycoord: null,\n object: i\n };\n}\nconst Ol = /* @__PURE__ */ new w(), Bl = /* @__PURE__ */ new w();\nclass ud extends ko {\n /**\n * Constructs a new line segments.\n *\n * @param {BufferGeometry} [geometry] - The line geometry.\n * @param {Material|Array} [material] - The line material.\n */\n constructor(e, t) {\n super(e, t), this.isLineSegments = !0, this.type = \"LineSegments\";\n }\n computeLineDistances() {\n const e = this.geometry;\n if (e.index === null) {\n const t = e.attributes.position, n = [];\n for (let s = 0, r = t.count; s < r; s += 2)\n Ol.fromBufferAttribute(t, s), Bl.fromBufferAttribute(t, s + 1), n[s] = s === 0 ? 0 : n[s - 1], n[s + 1] = n[s] + Ol.distanceTo(Bl);\n e.setAttribute(\"lineDistance\", new pn(n, 1));\n } else\n Te(\"LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.\");\n return this;\n }\n}\nclass dd extends ko {\n /**\n * Constructs a new line loop.\n *\n * @param {BufferGeometry} [geometry] - The line geometry.\n * @param {Material|Array} [material] - The line material.\n */\n constructor(e, t) {\n super(e, t), this.isLineLoop = !0, this.type = \"LineLoop\";\n }\n}\nclass ah extends tn {\n /**\n * Constructs a new points material.\n *\n * @param {Object} [parameters] - An object with one or more properties\n * defining the material's appearance. Any property of the material\n * (including any property from inherited materials) can be passed\n * in here. Color values can be passed any type of value accepted\n * by {@link Color#set}.\n */\n constructor(e) {\n super(), this.isPointsMaterial = !0, this.type = \"PointsMaterial\", this.color = new Se(16777215), this.map = null, this.alphaMap = null, this.size = 1, this.sizeAttenuation = !0, this.fog = !0, this.setValues(e);\n }\n copy(e) {\n return super.copy(e), this.color.copy(e.color), this.map = e.map, this.alphaMap = e.alphaMap, this.size = e.size, this.sizeAttenuation = e.sizeAttenuation, this.fog = e.fog, this;\n }\n}\nconst zl = /* @__PURE__ */ new Ne(), fo = /* @__PURE__ */ new Ji(), tr = /* @__PURE__ */ new Rn(), nr = /* @__PURE__ */ new w();\nclass fd extends pt {\n /**\n * Constructs a new point cloud.\n *\n * @param {BufferGeometry} [geometry] - The points geometry.\n * @param {Material|Array} [material] - The points material.\n */\n constructor(e = new nn(), t = new ah()) {\n super(), this.isPoints = !0, this.type = \"Points\", this.geometry = e, this.material = t, this.morphTargetDictionary = void 0, this.morphTargetInfluences = void 0, this.updateMorphTargets();\n }\n copy(e, t) {\n return super.copy(e, t), this.material = Array.isArray(e.material) ? e.material.slice() : e.material, this.geometry = e.geometry, this;\n }\n /**\n * Computes intersection points between a casted ray and this point cloud.\n *\n * @param {Raycaster} raycaster - The raycaster.\n * @param {Array} intersects - The target array that holds the intersection points.\n */\n raycast(e, t) {\n const n = this.geometry, s = this.matrixWorld, r = e.params.Points.threshold, a = n.drawRange;\n if (n.boundingSphere === null && n.computeBoundingSphere(), tr.copy(n.boundingSphere), tr.applyMatrix4(s), tr.radius += r, e.ray.intersectsSphere(tr) === !1) return;\n zl.copy(s).invert(), fo.copy(e.ray).applyMatrix4(zl);\n const o = r / ((this.scale.x + this.scale.y + this.scale.z) / 3), l = o * o, c = n.index, u = n.attributes.position;\n if (c !== null) {\n const d = Math.max(0, a.start), p = Math.min(c.count, a.start + a.count);\n for (let g = d, x = p; g < x; g++) {\n const m = c.getX(g);\n nr.fromBufferAttribute(u, m), kl(nr, m, l, s, e, t, this);\n }\n } else {\n const d = Math.max(0, a.start), p = Math.min(u.count, a.start + a.count);\n for (let g = d, x = p; g < x; g++)\n nr.fromBufferAttribute(u, g), kl(nr, g, l, s, e, t, this);\n }\n }\n /**\n * Sets the values of {@link Points#morphTargetDictionary} and {@link Points#morphTargetInfluences}\n * to make sure existing morph targets can influence this 3D object.\n */\n updateMorphTargets() {\n const t = this.geometry.morphAttributes, n = Object.keys(t);\n if (n.length > 0) {\n const s = t[n[0]];\n if (s !== void 0) {\n this.morphTargetInfluences = [], this.morphTargetDictionary = {};\n for (let r = 0, a = s.length; r < a; r++) {\n const o = s[r].name || String(r);\n this.morphTargetInfluences.push(0), this.morphTargetDictionary[o] = r;\n }\n }\n }\n }\n}\nfunction kl(i, e, t, n, s, r, a) {\n const o = fo.distanceSqToPoint(i);\n if (o < t) {\n const l = new w();\n fo.closestPointToPoint(i, l), l.applyMatrix4(n);\n const c = s.ray.origin.distanceTo(l);\n if (c < s.near || c > s.far) return;\n r.push({\n distance: c,\n distanceToRay: Math.sqrt(o),\n point: l,\n index: e,\n face: null,\n faceIndex: null,\n barycoord: null,\n object: a\n });\n }\n}\nclass Vo extends Ct {\n /**\n * Constructs a new depth texture.\n *\n * @param {number} width - The width of the texture.\n * @param {number} height - The height of the texture.\n * @param {number} [type=UnsignedIntType] - The texture type.\n * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping.\n * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value.\n * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value.\n * @param {number} [magFilter=LinearFilter] - The mag filter value.\n * @param {number} [minFilter=LinearFilter] - The min filter value.\n * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.\n * @param {number} [format=DepthFormat] - The texture format.\n * @param {number} [depth=1] - The depth of the texture.\n */\n constructor(e, t, n = di, s, r, a, o = Dt, l = Dt, c, h = bs, u = 1) {\n if (h !== bs && h !== Xi)\n throw new Error(\"DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat\");\n const d = { width: e, height: t, depth: u };\n super(d, s, r, a, o, l, h, n, c), this.isDepthTexture = !0, this.flipY = !1, this.generateMipmaps = !1, this.compareFunction = null;\n }\n copy(e) {\n return super.copy(e), this.source = new Io(Object.assign({}, e.image)), this.compareFunction = e.compareFunction, this;\n }\n toJSON(e) {\n const t = super.toJSON(e);\n return this.compareFunction !== null && (t.compareFunction = this.compareFunction), t;\n }\n}\nclass oh extends Ct {\n /**\n * Creates a new raw texture.\n *\n * @param {?(WebGLTexture|GPUTexture)} [sourceTexture=null] - The external texture.\n */\n constructor(e = null) {\n super(), this.sourceTexture = e, this.isExternalTexture = !0;\n }\n copy(e) {\n return super.copy(e), this.sourceTexture = e.sourceTexture, this;\n }\n}\nclass As extends nn {\n /**\n * Constructs a new plane geometry.\n *\n * @param {number} [width=1] - The width along the X axis.\n * @param {number} [height=1] - The height along the Y axis\n * @param {number} [widthSegments=1] - The number of segments along the X axis.\n * @param {number} [heightSegments=1] - The number of segments along the Y axis.\n */\n constructor(e = 1, t = 1, n = 1, s = 1) {\n super(), this.type = \"PlaneGeometry\", this.parameters = {\n width: e,\n height: t,\n widthSegments: n,\n heightSegments: s\n };\n const r = e / 2, a = t / 2, o = Math.floor(n), l = Math.floor(s), c = o + 1, h = l + 1, u = e / o, d = t / l, p = [], g = [], x = [], m = [];\n for (let f = 0; f < h; f++) {\n const y = f * d - a;\n for (let v = 0; v < c; v++) {\n const T = v * u - r;\n g.push(T, -y, 0), x.push(0, 0, 1), m.push(v / o), m.push(1 - f / l);\n }\n }\n for (let f = 0; f < l; f++)\n for (let y = 0; y < o; y++) {\n const v = y + c * f, T = y + c * (f + 1), R = y + 1 + c * (f + 1), E = y + 1 + c * f;\n p.push(v, T, E), p.push(T, R, E);\n }\n this.setIndex(p), this.setAttribute(\"position\", new pn(g, 3)), this.setAttribute(\"normal\", new pn(x, 3)), this.setAttribute(\"uv\", new pn(m, 2));\n }\n copy(e) {\n return super.copy(e), this.parameters = Object.assign({}, e.parameters), this;\n }\n /**\n * Factory method for creating an instance of this class from the given\n * JSON object.\n *\n * @param {Object} data - A JSON object representing the serialized geometry.\n * @return {PlaneGeometry} A new instance.\n */\n static fromJSON(e) {\n return new As(e.width, e.height, e.widthSegments, e.heightSegments);\n }\n}\nclass pd extends ht {\n /**\n * Constructs a new raw shader material.\n *\n * @param {Object} [parameters] - An object with one or more properties\n * defining the material's appearance. Any property of the material\n * (including any property from inherited materials) can be passed\n * in here. Color values can be passed any type of value accepted\n * by {@link Color#set}.\n */\n constructor(e) {\n super(e), this.isRawShaderMaterial = !0, this.type = \"RawShaderMaterial\";\n }\n}\nclass Go extends tn {\n /**\n * Constructs a new mesh standard material.\n *\n * @param {Object} [parameters] - An object with one or more properties\n * defining the material's appearance. Any property of the material\n * (including any property from inherited materials) can be passed\n * in here. Color values can be passed any type of value accepted\n * by {@link Color#set}.\n */\n constructor(e) {\n super(), this.isMeshStandardMaterial = !0, this.type = \"MeshStandardMaterial\", this.defines = { STANDARD: \"\" }, this.color = new Se(16777215), this.roughness = 1, this.metalness = 0, this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Se(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = Cr, this.normalScale = new le(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.roughnessMap = null, this.metalnessMap = null, this.alphaMap = null, this.envMap = null, this.envMapRotation = new xn(), this.envMapIntensity = 1, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = \"round\", this.wireframeLinejoin = \"round\", this.flatShading = !1, this.fog = !0, this.setValues(e);\n }\n copy(e) {\n return super.copy(e), this.defines = { STANDARD: \"\" }, this.color.copy(e.color), this.roughness = e.roughness, this.metalness = e.metalness, this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.roughnessMap = e.roughnessMap, this.metalnessMap = e.metalnessMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.envMapRotation.copy(e.envMapRotation), this.envMapIntensity = e.envMapIntensity, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.flatShading = e.flatShading, this.fog = e.fog, this;\n }\n}\nclass Cn extends Go {\n /**\n * Constructs a new mesh physical material.\n *\n * @param {Object} [parameters] - An object with one or more properties\n * defining the material's appearance. Any property of the material\n * (including any property from inherited materials) can be passed\n * in here. Color values can be passed any type of value accepted\n * by {@link Color#set}.\n */\n constructor(e) {\n super(), this.isMeshPhysicalMaterial = !0, this.defines = {\n STANDARD: \"\",\n PHYSICAL: \"\"\n }, this.type = \"MeshPhysicalMaterial\", this.anisotropyRotation = 0, this.anisotropyMap = null, this.clearcoatMap = null, this.clearcoatRoughness = 0, this.clearcoatRoughnessMap = null, this.clearcoatNormalScale = new le(1, 1), this.clearcoatNormalMap = null, this.ior = 1.5, Object.defineProperty(this, \"reflectivity\", {\n get: function() {\n return He(2.5 * (this.ior - 1) / (this.ior + 1), 0, 1);\n },\n set: function(t) {\n this.ior = (1 + 0.4 * t) / (1 - 0.4 * t);\n }\n }), this.iridescenceMap = null, this.iridescenceIOR = 1.3, this.iridescenceThicknessRange = [100, 400], this.iridescenceThicknessMap = null, this.sheenColor = new Se(0), this.sheenColorMap = null, this.sheenRoughness = 1, this.sheenRoughnessMap = null, this.transmissionMap = null, this.thickness = 0, this.thicknessMap = null, this.attenuationDistance = 1 / 0, this.attenuationColor = new Se(1, 1, 1), this.specularIntensity = 1, this.specularIntensityMap = null, this.specularColor = new Se(1, 1, 1), this.specularColorMap = null, this._anisotropy = 0, this._clearcoat = 0, this._dispersion = 0, this._iridescence = 0, this._sheen = 0, this._transmission = 0, this.setValues(e);\n }\n /**\n * The anisotropy strength, from `0.0` to `1.0`.\n *\n * @type {number}\n * @default 0\n */\n get anisotropy() {\n return this._anisotropy;\n }\n set anisotropy(e) {\n this._anisotropy > 0 != e > 0 && this.version++, this._anisotropy = e;\n }\n /**\n * Represents the intensity of the clear coat layer, from `0.0` to `1.0`. Use\n * clear coat related properties to enable multilayer materials that have a\n * thin translucent layer over the base layer.\n *\n * @type {number}\n * @default 0\n */\n get clearcoat() {\n return this._clearcoat;\n }\n set clearcoat(e) {\n this._clearcoat > 0 != e > 0 && this.version++, this._clearcoat = e;\n }\n /**\n * The intensity of the iridescence layer, simulating RGB color shift based on the angle between\n * the surface and the viewer, from `0.0` to `1.0`.\n *\n * @type {number}\n * @default 0\n */\n get iridescence() {\n return this._iridescence;\n }\n set iridescence(e) {\n this._iridescence > 0 != e > 0 && this.version++, this._iridescence = e;\n }\n /**\n * Defines the strength of the angular separation of colors (chromatic aberration) transmitting\n * through a relatively clear volume. Any value zero or larger is valid, the typical range of\n * realistic values is `[0, 1]`. This property can be only be used with transmissive objects.\n *\n * @type {number}\n * @default 0\n */\n get dispersion() {\n return this._dispersion;\n }\n set dispersion(e) {\n this._dispersion > 0 != e > 0 && this.version++, this._dispersion = e;\n }\n /**\n * The intensity of the sheen layer, from `0.0` to `1.0`.\n *\n * @type {number}\n * @default 0\n */\n get sheen() {\n return this._sheen;\n }\n set sheen(e) {\n this._sheen > 0 != e > 0 && this.version++, this._sheen = e;\n }\n /**\n * Degree of transmission (or optical transparency), from `0.0` to `1.0`.\n *\n * Thin, transparent or semitransparent, plastic or glass materials remain\n * largely reflective even if they are fully transmissive. The transmission\n * property can be used to model these materials.\n *\n * When transmission is non-zero, `opacity` should be set to `1`.\n *\n * @type {number}\n * @default 0\n */\n get transmission() {\n return this._transmission;\n }\n set transmission(e) {\n this._transmission > 0 != e > 0 && this.version++, this._transmission = e;\n }\n copy(e) {\n return super.copy(e), this.defines = {\n STANDARD: \"\",\n PHYSICAL: \"\"\n }, this.anisotropy = e.anisotropy, this.anisotropyRotation = e.anisotropyRotation, this.anisotropyMap = e.anisotropyMap, this.clearcoat = e.clearcoat, this.clearcoatMap = e.clearcoatMap, this.clearcoatRoughness = e.clearcoatRoughness, this.clearcoatRoughnessMap = e.clearcoatRoughnessMap, this.clearcoatNormalMap = e.clearcoatNormalMap, this.clearcoatNormalScale.copy(e.clearcoatNormalScale), this.dispersion = e.dispersion, this.ior = e.ior, this.iridescence = e.iridescence, this.iridescenceMap = e.iridescenceMap, this.iridescenceIOR = e.iridescenceIOR, this.iridescenceThicknessRange = [...e.iridescenceThicknessRange], this.iridescenceThicknessMap = e.iridescenceThicknessMap, this.sheen = e.sheen, this.sheenColor.copy(e.sheenColor), this.sheenColorMap = e.sheenColorMap, this.sheenRoughness = e.sheenRoughness, this.sheenRoughnessMap = e.sheenRoughnessMap, this.transmission = e.transmission, this.transmissionMap = e.transmissionMap, this.thickness = e.thickness, this.thicknessMap = e.thicknessMap, this.attenuationDistance = e.attenuationDistance, this.attenuationColor.copy(e.attenuationColor), this.specularIntensity = e.specularIntensity, this.specularIntensityMap = e.specularIntensityMap, this.specularColor.copy(e.specularColor), this.specularColorMap = e.specularColorMap, this;\n }\n}\nclass md extends tn {\n /**\n * Constructs a new mesh normal material.\n *\n * @param {Object} [parameters] - An object with one or more properties\n * defining the material's appearance. Any property of the material\n * (including any property from inherited materials) can be passed\n * in here. Color values can be passed any type of value accepted\n * by {@link Color#set}.\n */\n constructor(e) {\n super(), this.isMeshNormalMaterial = !0, this.type = \"MeshNormalMaterial\", this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = Cr, this.normalScale = new le(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = !1, this.wireframeLinewidth = 1, this.flatShading = !1, this.setValues(e);\n }\n copy(e) {\n return super.copy(e), this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.flatShading = e.flatShading, this;\n }\n}\nclass gd extends tn {\n /**\n * Constructs a new mesh lambert material.\n *\n * @param {Object} [parameters] - An object with one or more properties\n * defining the material's appearance. Any property of the material\n * (including any property from inherited materials) can be passed\n * in here. Color values can be passed any type of value accepted\n * by {@link Color#set}.\n */\n constructor(e) {\n super(), this.isMeshLambertMaterial = !0, this.type = \"MeshLambertMaterial\", this.color = new Se(16777215), this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Se(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = Cr, this.normalScale = new le(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.envMapRotation = new xn(), this.combine = So, this.reflectivity = 1, this.refractionRatio = 0.98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = \"round\", this.wireframeLinejoin = \"round\", this.flatShading = !1, this.fog = !0, this.setValues(e);\n }\n copy(e) {\n return super.copy(e), this.color.copy(e.color), this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.specularMap = e.specularMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.envMapRotation.copy(e.envMapRotation), this.combine = e.combine, this.reflectivity = e.reflectivity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.flatShading = e.flatShading, this.fog = e.fog, this;\n }\n}\nclass lh extends tn {\n /**\n * Constructs a new mesh depth material.\n *\n * @param {Object} [parameters] - An object with one or more properties\n * defining the material's appearance. Any property of the material\n * (including any property from inherited materials) can be passed\n * in here. Color values can be passed any type of value accepted\n * by {@link Color#set}.\n */\n constructor(e) {\n super(), this.isMeshDepthMaterial = !0, this.type = \"MeshDepthMaterial\", this.depthPacking = nu, this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = !1, this.wireframeLinewidth = 1, this.setValues(e);\n }\n copy(e) {\n return super.copy(e), this.depthPacking = e.depthPacking, this.map = e.map, this.alphaMap = e.alphaMap, this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this;\n }\n}\nclass xd extends tn {\n /**\n * Constructs a new mesh distance material.\n *\n * @param {Object} [parameters] - An object with one or more properties\n * defining the material's appearance. Any property of the material\n * (including any property from inherited materials) can be passed\n * in here. Color values can be passed any type of value accepted\n * by {@link Color#set}.\n */\n constructor(e) {\n super(), this.isMeshDistanceMaterial = !0, this.type = \"MeshDistanceMaterial\", this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.setValues(e);\n }\n copy(e) {\n return super.copy(e), this.map = e.map, this.alphaMap = e.alphaMap, this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this;\n }\n}\nfunction ir(i, e) {\n return !i || i.constructor === e ? i : typeof e.BYTES_PER_ELEMENT == \"number\" ? new e(i) : Array.prototype.slice.call(i);\n}\nfunction _d(i) {\n return ArrayBuffer.isView(i) && !(i instanceof DataView);\n}\nfunction vd(i) {\n function e(s, r) {\n return i[s] - i[r];\n }\n const t = i.length, n = new Array(t);\n for (let s = 0; s !== t; ++s) n[s] = s;\n return n.sort(e), n;\n}\nfunction Vl(i, e, t) {\n const n = i.length, s = new i.constructor(n);\n for (let r = 0, a = 0; a !== n; ++r) {\n const o = t[r] * e;\n for (let l = 0; l !== e; ++l)\n s[a++] = i[o + l];\n }\n return s;\n}\nfunction ch(i, e, t, n) {\n let s = 1, r = i[0];\n for (; r !== void 0 && r[n] === void 0; )\n r = i[s++];\n if (r === void 0) return;\n let a = r[n];\n if (a !== void 0)\n if (Array.isArray(a))\n do\n a = r[n], a !== void 0 && (e.push(r.time), t.push(...a)), r = i[s++];\n while (r !== void 0);\n else if (a.toArray !== void 0)\n do\n a = r[n], a !== void 0 && (e.push(r.time), a.toArray(t, t.length)), r = i[s++];\n while (r !== void 0);\n else\n do\n a = r[n], a !== void 0 && (e.push(r.time), t.push(a)), r = i[s++];\n while (r !== void 0);\n}\nclass Rs {\n /**\n * Constructs a new interpolant.\n *\n * @param {TypedArray} parameterPositions - The parameter positions hold the interpolation factors.\n * @param {TypedArray} sampleValues - The sample values.\n * @param {number} sampleSize - The sample size\n * @param {TypedArray} [resultBuffer] - The result buffer.\n */\n constructor(e, t, n, s) {\n this.parameterPositions = e, this._cachedIndex = 0, this.resultBuffer = s !== void 0 ? s : new t.constructor(n), this.sampleValues = t, this.valueSize = n, this.settings = null, this.DefaultSettings_ = {};\n }\n /**\n * Evaluate the interpolant at position `t`.\n *\n * @param {number} t - The interpolation factor.\n * @return {TypedArray} The result buffer.\n */\n evaluate(e) {\n const t = this.parameterPositions;\n let n = this._cachedIndex, s = t[n], r = t[n - 1];\n n: {\n e: {\n let a;\n t: {\n i: if (!(e < s)) {\n for (let o = n + 2; ; ) {\n if (s === void 0) {\n if (e < r) break i;\n return n = t.length, this._cachedIndex = n, this.copySampleValue_(n - 1);\n }\n if (n === o) break;\n if (r = s, s = t[++n], e < s)\n break e;\n }\n a = t.length;\n break t;\n }\n if (!(e >= r)) {\n const o = t[1];\n e < o && (n = 2, r = o);\n for (let l = n - 2; ; ) {\n if (r === void 0)\n return this._cachedIndex = 0, this.copySampleValue_(0);\n if (n === l) break;\n if (s = r, r = t[--n - 1], e >= r)\n break e;\n }\n a = n, n = 0;\n break t;\n }\n break n;\n }\n for (; n < a; ) {\n const o = n + a >>> 1;\n e < t[o] ? a = o : n = o + 1;\n }\n if (s = t[n], r = t[n - 1], r === void 0)\n return this._cachedIndex = 0, this.copySampleValue_(0);\n if (s === void 0)\n return n = t.length, this._cachedIndex = n, this.copySampleValue_(n - 1);\n }\n this._cachedIndex = n, this.intervalChanged_(n, r, s);\n }\n return this.interpolate_(n, r, e, s);\n }\n /**\n * Returns the interpolation settings.\n *\n * @return {Object} The interpolation settings.\n */\n getSettings_() {\n return this.settings || this.DefaultSettings_;\n }\n /**\n * Copies a sample value to the result buffer.\n *\n * @param {number} index - An index into the sample value buffer.\n * @return {TypedArray} The result buffer.\n */\n copySampleValue_(e) {\n const t = this.resultBuffer, n = this.sampleValues, s = this.valueSize, r = e * s;\n for (let a = 0; a !== s; ++a)\n t[a] = n[r + a];\n return t;\n }\n /**\n * Copies a sample value to the result buffer.\n *\n * @abstract\n * @param {number} i1 - An index into the sample value buffer.\n * @param {number} t0 - The previous interpolation factor.\n * @param {number} t - The current interpolation factor.\n * @param {number} t1 - The next interpolation factor.\n * @return {TypedArray} The result buffer.\n */\n interpolate_() {\n throw new Error(\"call to abstract method\");\n }\n /**\n * Optional method that is executed when the interval has changed.\n *\n * @param {number} i1 - An index into the sample value buffer.\n * @param {number} t0 - The previous interpolation factor.\n * @param {number} t - The current interpolation factor.\n */\n intervalChanged_() {\n }\n}\nclass Md extends Rs {\n /**\n * Constructs a new cubic interpolant.\n *\n * @param {TypedArray} parameterPositions - The parameter positions hold the interpolation factors.\n * @param {TypedArray} sampleValues - The sample values.\n * @param {number} sampleSize - The sample size\n * @param {TypedArray} [resultBuffer] - The result buffer.\n */\n constructor(e, t, n, s) {\n super(e, t, n, s), this._weightPrev = -0, this._offsetPrev = -0, this._weightNext = -0, this._offsetNext = -0, this.DefaultSettings_ = {\n endingStart: rl,\n endingEnd: rl\n };\n }\n intervalChanged_(e, t, n) {\n const s = this.parameterPositions;\n let r = e - 2, a = e + 1, o = s[r], l = s[a];\n if (o === void 0)\n switch (this.getSettings_().endingStart) {\n case al:\n r = e, o = 2 * t - n;\n break;\n case ol:\n r = s.length - 2, o = t + s[r] - s[r + 1];\n break;\n default:\n r = e, o = n;\n }\n if (l === void 0)\n switch (this.getSettings_().endingEnd) {\n case al:\n a = e, l = 2 * n - t;\n break;\n case ol:\n a = 1, l = n + s[1] - s[0];\n break;\n default:\n a = e - 1, l = t;\n }\n const c = (n - t) * 0.5, h = this.valueSize;\n this._weightPrev = c / (t - o), this._weightNext = c / (l - n), this._offsetPrev = r * h, this._offsetNext = a * h;\n }\n interpolate_(e, t, n, s) {\n const r = this.resultBuffer, a = this.sampleValues, o = this.valueSize, l = e * o, c = l - o, h = this._offsetPrev, u = this._offsetNext, d = this._weightPrev, p = this._weightNext, g = (n - t) / (s - t), x = g * g, m = x * g, f = -d * m + 2 * d * x - d * g, y = (1 + d) * m + (-1.5 - 2 * d) * x + (-0.5 + d) * g + 1, v = (-1 - p) * m + (1.5 + p) * x + 0.5 * g, T = p * m - p * x;\n for (let R = 0; R !== o; ++R)\n r[R] = f * a[h + R] + y * a[c + R] + v * a[l + R] + T * a[u + R];\n return r;\n }\n}\nclass Sd extends Rs {\n /**\n * Constructs a new linear interpolant.\n *\n * @param {TypedArray} parameterPositions - The parameter positions hold the interpolation factors.\n * @param {TypedArray} sampleValues - The sample values.\n * @param {number} sampleSize - The sample size\n * @param {TypedArray} [resultBuffer] - The result buffer.\n */\n constructor(e, t, n, s) {\n super(e, t, n, s);\n }\n interpolate_(e, t, n, s) {\n const r = this.resultBuffer, a = this.sampleValues, o = this.valueSize, l = e * o, c = l - o, h = (n - t) / (s - t), u = 1 - h;\n for (let d = 0; d !== o; ++d)\n r[d] = a[c + d] * u + a[l + d] * h;\n return r;\n }\n}\nclass bd extends Rs {\n /**\n * Constructs a new discrete interpolant.\n *\n * @param {TypedArray} parameterPositions - The parameter positions hold the interpolation factors.\n * @param {TypedArray} sampleValues - The sample values.\n * @param {number} sampleSize - The sample size\n * @param {TypedArray} [resultBuffer] - The result buffer.\n */\n constructor(e, t, n, s) {\n super(e, t, n, s);\n }\n interpolate_(e) {\n return this.copySampleValue_(e - 1);\n }\n}\nclass _n {\n /**\n * Constructs a new keyframe track.\n *\n * @param {string} name - The keyframe track's name.\n * @param {Array} times - A list of keyframe times.\n * @param {Array} values - A list of keyframe values.\n * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type.\n */\n constructor(e, t, n, s) {\n if (e === void 0) throw new Error(\"THREE.KeyframeTrack: track name is undefined\");\n if (t === void 0 || t.length === 0) throw new Error(\"THREE.KeyframeTrack: no keyframes in track named \" + e);\n this.name = e, this.times = ir(t, this.TimeBufferType), this.values = ir(n, this.ValueBufferType), this.setInterpolation(s || this.DefaultInterpolation);\n }\n /**\n * Converts the keyframe track to JSON.\n *\n * @static\n * @param {KeyframeTrack} track - The keyframe track to serialize.\n * @return {Object} The serialized keyframe track as JSON.\n */\n static toJSON(e) {\n const t = e.constructor;\n let n;\n if (t.toJSON !== this.toJSON)\n n = t.toJSON(e);\n else {\n n = {\n name: e.name,\n times: ir(e.times, Array),\n values: ir(e.values, Array)\n };\n const s = e.getInterpolation();\n s !== e.DefaultInterpolation && (n.interpolation = s);\n }\n return n.type = e.ValueTypeName, n;\n }\n /**\n * Factory method for creating a new discrete interpolant.\n *\n * @static\n * @param {TypedArray} [result] - The result buffer.\n * @return {DiscreteInterpolant} The new interpolant.\n */\n InterpolantFactoryMethodDiscrete(e) {\n return new bd(this.times, this.values, this.getValueSize(), e);\n }\n /**\n * Factory method for creating a new linear interpolant.\n *\n * @static\n * @param {TypedArray} [result] - The result buffer.\n * @return {LinearInterpolant} The new interpolant.\n */\n InterpolantFactoryMethodLinear(e) {\n return new Sd(this.times, this.values, this.getValueSize(), e);\n }\n /**\n * Factory method for creating a new smooth interpolant.\n *\n * @static\n * @param {TypedArray} [result] - The result buffer.\n * @return {CubicInterpolant} The new interpolant.\n */\n InterpolantFactoryMethodSmooth(e) {\n return new Md(this.times, this.values, this.getValueSize(), e);\n }\n /**\n * Defines the interpolation factor method for this keyframe track.\n *\n * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} interpolation - The interpolation type.\n * @return {KeyframeTrack} A reference to this keyframe track.\n */\n setInterpolation(e) {\n let t;\n switch (e) {\n case ys:\n t = this.InterpolantFactoryMethodDiscrete;\n break;\n case Ts:\n t = this.InterpolantFactoryMethodLinear;\n break;\n case Ur:\n t = this.InterpolantFactoryMethodSmooth;\n break;\n }\n if (t === void 0) {\n const n = \"unsupported interpolation for \" + this.ValueTypeName + \" keyframe track named \" + this.name;\n if (this.createInterpolant === void 0)\n if (e !== this.DefaultInterpolation)\n this.setInterpolation(this.DefaultInterpolation);\n else\n throw new Error(n);\n return Te(\"KeyframeTrack:\", n), this;\n }\n return this.createInterpolant = t, this;\n }\n /**\n * Returns the current interpolation type.\n *\n * @return {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} The interpolation type.\n */\n getInterpolation() {\n switch (this.createInterpolant) {\n case this.InterpolantFactoryMethodDiscrete:\n return ys;\n case this.InterpolantFactoryMethodLinear:\n return Ts;\n case this.InterpolantFactoryMethodSmooth:\n return Ur;\n }\n }\n /**\n * Returns the value size.\n *\n * @return {number} The value size.\n */\n getValueSize() {\n return this.values.length / this.times.length;\n }\n /**\n * Moves all keyframes either forward or backward in time.\n *\n * @param {number} timeOffset - The offset to move the time values.\n * @return {KeyframeTrack} A reference to this keyframe track.\n */\n shift(e) {\n if (e !== 0) {\n const t = this.times;\n for (let n = 0, s = t.length; n !== s; ++n)\n t[n] += e;\n }\n return this;\n }\n /**\n * Scale all keyframe times by a factor (useful for frame - seconds conversions).\n *\n * @param {number} timeScale - The time scale.\n * @return {KeyframeTrack} A reference to this keyframe track.\n */\n scale(e) {\n if (e !== 1) {\n const t = this.times;\n for (let n = 0, s = t.length; n !== s; ++n)\n t[n] *= e;\n }\n return this;\n }\n /**\n * Removes keyframes before and after animation without changing any values within the defined time range.\n *\n * Note: The method does not shift around keys to the start of the track time, because for interpolated\n * keys this will change their values\n *\n * @param {number} startTime - The start time.\n * @param {number} endTime - The end time.\n * @return {KeyframeTrack} A reference to this keyframe track.\n */\n trim(e, t) {\n const n = this.times, s = n.length;\n let r = 0, a = s - 1;\n for (; r !== s && n[r] < e; )\n ++r;\n for (; a !== -1 && n[a] > t; )\n --a;\n if (++a, r !== 0 || a !== s) {\n r >= a && (a = Math.max(a, 1), r = a - 1);\n const o = this.getValueSize();\n this.times = n.slice(r, a), this.values = this.values.slice(r * o, a * o);\n }\n return this;\n }\n /**\n * Performs minimal validation on the keyframe track. Returns `true` if the values\n * are valid.\n *\n * @return {boolean} Whether the keyframes are valid or not.\n */\n validate() {\n let e = !0;\n const t = this.getValueSize();\n t - Math.floor(t) !== 0 && (Xe(\"KeyframeTrack: Invalid value size in track.\", this), e = !1);\n const n = this.times, s = this.values, r = n.length;\n r === 0 && (Xe(\"KeyframeTrack: Track is empty.\", this), e = !1);\n let a = null;\n for (let o = 0; o !== r; o++) {\n const l = n[o];\n if (typeof l == \"number\" && isNaN(l)) {\n Xe(\"KeyframeTrack: Time is not a valid number.\", this, o, l), e = !1;\n break;\n }\n if (a !== null && a > l) {\n Xe(\"KeyframeTrack: Out of order keys.\", this, o, l, a), e = !1;\n break;\n }\n a = l;\n }\n if (s !== void 0 && _d(s))\n for (let o = 0, l = s.length; o !== l; ++o) {\n const c = s[o];\n if (isNaN(c)) {\n Xe(\"KeyframeTrack: Value is not a valid number.\", this, o, c), e = !1;\n break;\n }\n }\n return e;\n }\n /**\n * Optimizes this keyframe track by removing equivalent sequential keys (which are\n * common in morph target sequences).\n *\n * @return {AnimationClip} A reference to this animation clip.\n */\n optimize() {\n const e = this.times.slice(), t = this.values.slice(), n = this.getValueSize(), s = this.getInterpolation() === Ur, r = e.length - 1;\n let a = 1;\n for (let o = 1; o < r; ++o) {\n let l = !1;\n const c = e[o], h = e[o + 1];\n if (c !== h && (o !== 1 || c !== e[0]))\n if (s)\n l = !0;\n else {\n const u = o * n, d = u - n, p = u + n;\n for (let g = 0; g !== n; ++g) {\n const x = t[u + g];\n if (x !== t[d + g] || x !== t[p + g]) {\n l = !0;\n break;\n }\n }\n }\n if (l) {\n if (o !== a) {\n e[a] = e[o];\n const u = o * n, d = a * n;\n for (let p = 0; p !== n; ++p)\n t[d + p] = t[u + p];\n }\n ++a;\n }\n }\n if (r > 0) {\n e[a] = e[r];\n for (let o = r * n, l = a * n, c = 0; c !== n; ++c)\n t[l + c] = t[o + c];\n ++a;\n }\n return a !== e.length ? (this.times = e.slice(0, a), this.values = t.slice(0, a * n)) : (this.times = e, this.values = t), this;\n }\n /**\n * Returns a new keyframe track with copied values from this instance.\n *\n * @return {KeyframeTrack} A clone of this instance.\n */\n clone() {\n const e = this.times.slice(), t = this.values.slice(), n = this.constructor, s = new n(this.name, e, t);\n return s.createInterpolant = this.createInterpolant, s;\n }\n}\n_n.prototype.ValueTypeName = \"\";\n_n.prototype.TimeBufferType = Float32Array;\n_n.prototype.ValueBufferType = Float32Array;\n_n.prototype.DefaultInterpolation = Ts;\nclass es extends _n {\n /**\n * Constructs a new boolean keyframe track.\n *\n * This keyframe track type has no `interpolation` parameter because the\n * interpolation is always discrete.\n *\n * @param {string} name - The keyframe track's name.\n * @param {Array} times - A list of keyframe times.\n * @param {Array} values - A list of keyframe values.\n */\n constructor(e, t, n) {\n super(e, t, n);\n }\n}\nes.prototype.ValueTypeName = \"bool\";\nes.prototype.ValueBufferType = Array;\nes.prototype.DefaultInterpolation = ys;\nes.prototype.InterpolantFactoryMethodLinear = void 0;\nes.prototype.InterpolantFactoryMethodSmooth = void 0;\nclass hh extends _n {\n /**\n * Constructs a new color keyframe track.\n *\n * @param {string} name - The keyframe track's name.\n * @param {Array} times - A list of keyframe times.\n * @param {Array} values - A list of keyframe values.\n * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type.\n */\n constructor(e, t, n, s) {\n super(e, t, n, s);\n }\n}\nhh.prototype.ValueTypeName = \"color\";\nclass Yi extends _n {\n /**\n * Constructs a new number keyframe track.\n *\n * @param {string} name - The keyframe track's name.\n * @param {Array} times - A list of keyframe times.\n * @param {Array} values - A list of keyframe values.\n * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type.\n */\n constructor(e, t, n, s) {\n super(e, t, n, s);\n }\n}\nYi.prototype.ValueTypeName = \"number\";\nclass yd extends Rs {\n /**\n * Constructs a new SLERP interpolant.\n *\n * @param {TypedArray} parameterPositions - The parameter positions hold the interpolation factors.\n * @param {TypedArray} sampleValues - The sample values.\n * @param {number} sampleSize - The sample size\n * @param {TypedArray} [resultBuffer] - The result buffer.\n */\n constructor(e, t, n, s) {\n super(e, t, n, s);\n }\n interpolate_(e, t, n, s) {\n const r = this.resultBuffer, a = this.sampleValues, o = this.valueSize, l = (n - t) / (s - t);\n let c = e * o;\n for (let h = c + o; c !== h; c += 4)\n gn.slerpFlat(r, 0, a, c - o, a, c, l);\n return r;\n }\n}\nclass Ki extends _n {\n /**\n * Constructs a new Quaternion keyframe track.\n *\n * @param {string} name - The keyframe track's name.\n * @param {Array} times - A list of keyframe times.\n * @param {Array} values - A list of keyframe values.\n * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type.\n */\n constructor(e, t, n, s) {\n super(e, t, n, s);\n }\n /**\n * Overwritten so the method returns Quaternion based interpolant.\n *\n * @static\n * @param {TypedArray} [result] - The result buffer.\n * @return {QuaternionLinearInterpolant} The new interpolant.\n */\n InterpolantFactoryMethodLinear(e) {\n return new yd(this.times, this.values, this.getValueSize(), e);\n }\n}\nKi.prototype.ValueTypeName = \"quaternion\";\nKi.prototype.InterpolantFactoryMethodSmooth = void 0;\nclass ts extends _n {\n /**\n * Constructs a new string keyframe track.\n *\n * This keyframe track type has no `interpolation` parameter because the\n * interpolation is always discrete.\n *\n * @param {string} name - The keyframe track's name.\n * @param {Array} times - A list of keyframe times.\n * @param {Array} values - A list of keyframe values.\n */\n constructor(e, t, n) {\n super(e, t, n);\n }\n}\nts.prototype.ValueTypeName = \"string\";\nts.prototype.ValueBufferType = Array;\nts.prototype.DefaultInterpolation = ys;\nts.prototype.InterpolantFactoryMethodLinear = void 0;\nts.prototype.InterpolantFactoryMethodSmooth = void 0;\nclass Zi extends _n {\n /**\n * Constructs a new vector keyframe track.\n *\n * @param {string} name - The keyframe track's name.\n * @param {Array} times - A list of keyframe times.\n * @param {Array} values - A list of keyframe values.\n * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type.\n */\n constructor(e, t, n, s) {\n super(e, t, n, s);\n }\n}\nZi.prototype.ValueTypeName = \"vector\";\nclass Td {\n /**\n * Constructs a new animation clip.\n *\n * Note: Instead of instantiating an AnimationClip directly with the constructor, you can\n * use the static interface of this class for creating clips. In most cases though, animation clips\n * will automatically be created by loaders when importing animated 3D assets.\n *\n * @param {string} [name=''] - The clip's name.\n * @param {number} [duration=-1] - The clip's duration in seconds. If a negative value is passed,\n * the duration will be calculated from the passed keyframes.\n * @param {Array} tracks - An array of keyframe tracks.\n * @param {(NormalAnimationBlendMode|AdditiveAnimationBlendMode)} [blendMode=NormalAnimationBlendMode] - Defines how the animation\n * is blended/combined when two or more animations are simultaneously played.\n */\n constructor(e = \"\", t = -1, n = [], s = eu) {\n this.name = e, this.tracks = n, this.duration = t, this.blendMode = s, this.uuid = fn(), this.userData = {}, this.duration < 0 && this.resetDuration();\n }\n /**\n * Factory method for creating an animation clip from the given JSON.\n *\n * @static\n * @param {Object} json - The serialized animation clip.\n * @return {AnimationClip} The new animation clip.\n */\n static parse(e) {\n const t = [], n = e.tracks, s = 1 / (e.fps || 1);\n for (let a = 0, o = n.length; a !== o; ++a)\n t.push(wd(n[a]).scale(s));\n const r = new this(e.name, e.duration, t, e.blendMode);\n return r.uuid = e.uuid, r.userData = JSON.parse(e.userData || \"{}\"), r;\n }\n /**\n * Serializes the given animation clip into JSON.\n *\n * @static\n * @param {AnimationClip} clip - The animation clip to serialize.\n * @return {Object} The JSON object.\n */\n static toJSON(e) {\n const t = [], n = e.tracks, s = {\n name: e.name,\n duration: e.duration,\n tracks: t,\n uuid: e.uuid,\n blendMode: e.blendMode,\n userData: JSON.stringify(e.userData)\n };\n for (let r = 0, a = n.length; r !== a; ++r)\n t.push(_n.toJSON(n[r]));\n return s;\n }\n /**\n * Returns a new animation clip from the passed morph targets array of a\n * geometry, taking a name and the number of frames per second.\n *\n * Note: The fps parameter is required, but the animation speed can be\n * overridden via {@link AnimationAction#setDuration}.\n *\n * @static\n * @param {string} name - The name of the animation clip.\n * @param {Array} morphTargetSequence - A sequence of morph targets.\n * @param {number} fps - The Frames-Per-Second value.\n * @param {boolean} noLoop - Whether the clip should be no loop or not.\n * @return {AnimationClip} The new animation clip.\n */\n static CreateFromMorphTargetSequence(e, t, n, s) {\n const r = t.length, a = [];\n for (let o = 0; o < r; o++) {\n let l = [], c = [];\n l.push(\n (o + r - 1) % r,\n o,\n (o + 1) % r\n ), c.push(0, 1, 0);\n const h = vd(l);\n l = Vl(l, 1, h), c = Vl(c, 1, h), !s && l[0] === 0 && (l.push(r), c.push(c[0])), a.push(\n new Yi(\n \".morphTargetInfluences[\" + t[o].name + \"]\",\n l,\n c\n ).scale(1 / n)\n );\n }\n return new this(e, -1, a);\n }\n /**\n * Searches for an animation clip by name, taking as its first parameter\n * either an array of clips, or a mesh or geometry that contains an\n * array named \"animations\" property.\n *\n * @static\n * @param {(Array|Object3D)} objectOrClipArray - The array or object to search through.\n * @param {string} name - The name to search for.\n * @return {?AnimationClip} The found animation clip. Returns `null` if no clip has been found.\n */\n static findByName(e, t) {\n let n = e;\n if (!Array.isArray(e)) {\n const s = e;\n n = s.geometry && s.geometry.animations || s.animations;\n }\n for (let s = 0; s < n.length; s++)\n if (n[s].name === t)\n return n[s];\n return null;\n }\n /**\n * Returns an array of new AnimationClips created from the morph target\n * sequences of a geometry, trying to sort morph target names into\n * animation-group-based patterns like \"Walk_001, Walk_002, Run_001, Run_002...\".\n *\n * See {@link MD2Loader#parse} as an example for how the method should be used.\n *\n * @static\n * @param {Array} morphTargets - A sequence of morph targets.\n * @param {number} fps - The Frames-Per-Second value.\n * @param {boolean} noLoop - Whether the clip should be no loop or not.\n * @return {Array} An array of new animation clips.\n */\n static CreateClipsFromMorphTargetSequences(e, t, n) {\n const s = {}, r = /^([\\w-]*?)([\\d]+)$/;\n for (let o = 0, l = e.length; o < l; o++) {\n const c = e[o], h = c.name.match(r);\n if (h && h.length > 1) {\n const u = h[1];\n let d = s[u];\n d || (s[u] = d = []), d.push(c);\n }\n }\n const a = [];\n for (const o in s)\n a.push(this.CreateFromMorphTargetSequence(o, s[o], t, n));\n return a;\n }\n /**\n * Parses the `animation.hierarchy` format and returns a new animation clip.\n *\n * @static\n * @deprecated since r175.\n * @param {Object} animation - A serialized animation clip as JSON.\n * @param {Array} bones - An array of bones.\n * @return {?AnimationClip} The new animation clip.\n */\n static parseAnimation(e, t) {\n if (Te(\"AnimationClip: parseAnimation() is deprecated and will be removed with r185\"), !e)\n return Xe(\"AnimationClip: No animation in JSONLoader data.\"), null;\n const n = function(u, d, p, g, x) {\n if (p.length !== 0) {\n const m = [], f = [];\n ch(p, m, f, g), m.length !== 0 && x.push(new u(d, m, f));\n }\n }, s = [], r = e.name || \"default\", a = e.fps || 30, o = e.blendMode;\n let l = e.length || -1;\n const c = e.hierarchy || [];\n for (let u = 0; u < c.length; u++) {\n const d = c[u].keys;\n if (!(!d || d.length === 0))\n if (d[0].morphTargets) {\n const p = {};\n let g;\n for (g = 0; g < d.length; g++)\n if (d[g].morphTargets)\n for (let x = 0; x < d[g].morphTargets.length; x++)\n p[d[g].morphTargets[x]] = -1;\n for (const x in p) {\n const m = [], f = [];\n for (let y = 0; y !== d[g].morphTargets.length; ++y) {\n const v = d[g];\n m.push(v.time), f.push(v.morphTarget === x ? 1 : 0);\n }\n s.push(new Yi(\".morphTargetInfluence[\" + x + \"]\", m, f));\n }\n l = p.length * a;\n } else {\n const p = \".bones[\" + t[u].name + \"]\";\n n(\n Zi,\n p + \".position\",\n d,\n \"pos\",\n s\n ), n(\n Ki,\n p + \".quaternion\",\n d,\n \"rot\",\n s\n ), n(\n Zi,\n p + \".scale\",\n d,\n \"scl\",\n s\n );\n }\n }\n return s.length === 0 ? null : new this(r, l, s, o);\n }\n /**\n * Sets the duration of this clip to the duration of its longest keyframe track.\n *\n * @return {AnimationClip} A reference to this animation clip.\n */\n resetDuration() {\n const e = this.tracks;\n let t = 0;\n for (let n = 0, s = e.length; n !== s; ++n) {\n const r = this.tracks[n];\n t = Math.max(t, r.times[r.times.length - 1]);\n }\n return this.duration = t, this;\n }\n /**\n * Trims all tracks to the clip's duration.\n *\n * @return {AnimationClip} A reference to this animation clip.\n */\n trim() {\n for (let e = 0; e < this.tracks.length; e++)\n this.tracks[e].trim(0, this.duration);\n return this;\n }\n /**\n * Performs minimal validation on each track in the clip. Returns `true` if all\n * tracks are valid.\n *\n * @return {boolean} Whether the clip's keyframes are valid or not.\n */\n validate() {\n let e = !0;\n for (let t = 0; t < this.tracks.length; t++)\n e = e && this.tracks[t].validate();\n return e;\n }\n /**\n * Optimizes each track by removing equivalent sequential keys (which are\n * common in morph target sequences).\n *\n * @return {AnimationClip} A reference to this animation clip.\n */\n optimize() {\n for (let e = 0; e < this.tracks.length; e++)\n this.tracks[e].optimize();\n return this;\n }\n /**\n * Returns a new animation clip with copied values from this instance.\n *\n * @return {AnimationClip} A clone of this instance.\n */\n clone() {\n const e = [];\n for (let n = 0; n < this.tracks.length; n++)\n e.push(this.tracks[n].clone());\n const t = new this.constructor(this.name, this.duration, e, this.blendMode);\n return t.userData = JSON.parse(JSON.stringify(this.userData)), t;\n }\n /**\n * Serializes this animation clip into JSON.\n *\n * @return {Object} The JSON object.\n */\n toJSON() {\n return this.constructor.toJSON(this);\n }\n}\nfunction Ed(i) {\n switch (i.toLowerCase()) {\n case \"scalar\":\n case \"double\":\n case \"float\":\n case \"number\":\n case \"integer\":\n return Yi;\n case \"vector\":\n case \"vector2\":\n case \"vector3\":\n case \"vector4\":\n return Zi;\n case \"color\":\n return hh;\n case \"quaternion\":\n return Ki;\n case \"bool\":\n case \"boolean\":\n return es;\n case \"string\":\n return ts;\n }\n throw new Error(\"THREE.KeyframeTrack: Unsupported typeName: \" + i);\n}\nfunction wd(i) {\n if (i.type === void 0)\n throw new Error(\"THREE.KeyframeTrack: track type undefined, can not parse\");\n const e = Ed(i.type);\n if (i.times === void 0) {\n const t = [], n = [];\n ch(i.keys, t, n, \"value\"), i.times = t, i.values = n;\n }\n return e.parse !== void 0 ? e.parse(i) : new e(i.name, i.times, i.values, i.interpolation);\n}\nconst kn = {\n /**\n * Whether caching is enabled or not.\n *\n * @static\n * @type {boolean}\n * @default false\n */\n enabled: !1,\n /**\n * A dictionary that holds cached files.\n *\n * @static\n * @type {Object}\n */\n files: {},\n /**\n * Adds a cache entry with a key to reference the file. If this key already\n * holds a file, it is overwritten.\n *\n * @static\n * @param {string} key - The key to reference the cached file.\n * @param {Object} file - The file to be cached.\n */\n add: function(i, e) {\n this.enabled !== !1 && (this.files[i] = e);\n },\n /**\n * Gets the cached value for the given key.\n *\n * @static\n * @param {string} key - The key to reference the cached file.\n * @return {Object|undefined} The cached file. If the key does not exist `undefined` is returned.\n */\n get: function(i) {\n if (this.enabled !== !1)\n return this.files[i];\n },\n /**\n * Removes the cached file associated with the given key.\n *\n * @static\n * @param {string} key - The key to reference the cached file.\n */\n remove: function(i) {\n delete this.files[i];\n },\n /**\n * Remove all values from the cache.\n *\n * @static\n */\n clear: function() {\n this.files = {};\n }\n};\nclass Ad {\n /**\n * Constructs a new loading manager.\n *\n * @param {Function} [onLoad] - Executes when all items have been loaded.\n * @param {Function} [onProgress] - Executes when single items have been loaded.\n * @param {Function} [onError] - Executes when an error occurs.\n */\n constructor(e, t, n) {\n const s = this;\n let r = !1, a = 0, o = 0, l;\n const c = [];\n this.onStart = void 0, this.onLoad = e, this.onProgress = t, this.onError = n, this._abortController = null, this.itemStart = function(h) {\n o++, r === !1 && s.onStart !== void 0 && s.onStart(h, a, o), r = !0;\n }, this.itemEnd = function(h) {\n a++, s.onProgress !== void 0 && s.onProgress(h, a, o), a === o && (r = !1, s.onLoad !== void 0 && s.onLoad());\n }, this.itemError = function(h) {\n s.onError !== void 0 && s.onError(h);\n }, this.resolveURL = function(h) {\n return l ? l(h) : h;\n }, this.setURLModifier = function(h) {\n return l = h, this;\n }, this.addHandler = function(h, u) {\n return c.push(h, u), this;\n }, this.removeHandler = function(h) {\n const u = c.indexOf(h);\n return u !== -1 && c.splice(u, 2), this;\n }, this.getHandler = function(h) {\n for (let u = 0, d = c.length; u < d; u += 2) {\n const p = c[u], g = c[u + 1];\n if (p.global && (p.lastIndex = 0), p.test(h))\n return g;\n }\n return null;\n }, this.abort = function() {\n return this.abortController.abort(), this._abortController = null, this;\n };\n }\n // TODO: Revert this back to a single member variable once this issue has been fixed\n // https://github.com/cloudflare/workerd/issues/3657\n /**\n * Used for aborting ongoing requests in loaders using this manager.\n *\n * @type {AbortController}\n */\n get abortController() {\n return this._abortController || (this._abortController = new AbortController()), this._abortController;\n }\n}\nconst Rd = /* @__PURE__ */ new Ad();\nclass ei {\n /**\n * Constructs a new loader.\n *\n * @param {LoadingManager} [manager] - The loading manager.\n */\n constructor(e) {\n this.manager = e !== void 0 ? e : Rd, this.crossOrigin = \"anonymous\", this.withCredentials = !1, this.path = \"\", this.resourcePath = \"\", this.requestHeader = {};\n }\n /**\n * This method needs to be implemented by all concrete loaders. It holds the\n * logic for loading assets from the backend.\n *\n * @abstract\n * @param {string} url - The path/URL of the file to be loaded.\n * @param {Function} onLoad - Executed when the loading process has been finished.\n * @param {onProgressCallback} [onProgress] - Executed while the loading is in progress.\n * @param {onErrorCallback} [onError] - Executed when errors occur.\n */\n load() {\n }\n /**\n * A async version of {@link Loader#load}.\n *\n * @param {string} url - The path/URL of the file to be loaded.\n * @param {onProgressCallback} [onProgress] - Executed while the loading is in progress.\n * @return {Promise} A Promise that resolves when the asset has been loaded.\n */\n loadAsync(e, t) {\n const n = this;\n return new Promise(function(s, r) {\n n.load(e, s, t, r);\n });\n }\n /**\n * This method needs to be implemented by all concrete loaders. It holds the\n * logic for parsing the asset into three.js entities.\n *\n * @abstract\n * @param {any} data - The data to parse.\n */\n parse() {\n }\n /**\n * Sets the `crossOrigin` String to implement CORS for loading the URL\n * from a different domain that allows CORS.\n *\n * @param {string} crossOrigin - The `crossOrigin` value.\n * @return {Loader} A reference to this instance.\n */\n setCrossOrigin(e) {\n return this.crossOrigin = e, this;\n }\n /**\n * Whether the XMLHttpRequest uses credentials such as cookies, authorization\n * headers or TLS client certificates, see [XMLHttpRequest.withCredentials](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials).\n *\n * Note: This setting has no effect if you are loading files locally or from the same domain.\n *\n * @param {boolean} value - The `withCredentials` value.\n * @return {Loader} A reference to this instance.\n */\n setWithCredentials(e) {\n return this.withCredentials = e, this;\n }\n /**\n * Sets the base path for the asset.\n *\n * @param {string} path - The base path.\n * @return {Loader} A reference to this instance.\n */\n setPath(e) {\n return this.path = e, this;\n }\n /**\n * Sets the base path for dependent resources like textures.\n *\n * @param {string} resourcePath - The resource path.\n * @return {Loader} A reference to this instance.\n */\n setResourcePath(e) {\n return this.resourcePath = e, this;\n }\n /**\n * Sets the given request header.\n *\n * @param {Object} requestHeader - A [request header](https://developer.mozilla.org/en-US/docs/Glossary/Request_header)\n * for configuring the HTTP request.\n * @return {Loader} A reference to this instance.\n */\n setRequestHeader(e) {\n return this.requestHeader = e, this;\n }\n /**\n * This method can be implemented in loaders for aborting ongoing requests.\n *\n * @abstract\n * @return {Loader} A reference to this instance.\n */\n abort() {\n return this;\n }\n}\nei.DEFAULT_MATERIAL_NAME = \"__DEFAULT\";\nconst Nn = {};\nclass Cd extends Error {\n constructor(e, t) {\n super(e), this.response = t;\n }\n}\nclass Ho extends ei {\n /**\n * Constructs a new file loader.\n *\n * @param {LoadingManager} [manager] - The loading manager.\n */\n constructor(e) {\n super(e), this.mimeType = \"\", this.responseType = \"\", this._abortController = new AbortController();\n }\n /**\n * Starts loading from the given URL and pass the loaded response to the `onLoad()` callback.\n *\n * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.\n * @param {function(any)} onLoad - Executed when the loading process has been finished.\n * @param {onProgressCallback} [onProgress] - Executed while the loading is in progress.\n * @param {onErrorCallback} [onError] - Executed when errors occur.\n * @return {any|undefined} The cached resource if available.\n */\n load(e, t, n, s) {\n e === void 0 && (e = \"\"), this.path !== void 0 && (e = this.path + e), e = this.manager.resolveURL(e);\n const r = kn.get(`file:${e}`);\n if (r !== void 0)\n return this.manager.itemStart(e), setTimeout(() => {\n t && t(r), this.manager.itemEnd(e);\n }, 0), r;\n if (Nn[e] !== void 0) {\n Nn[e].push({\n onLoad: t,\n onProgress: n,\n onError: s\n });\n return;\n }\n Nn[e] = [], Nn[e].push({\n onLoad: t,\n onProgress: n,\n onError: s\n });\n const a = new Request(e, {\n headers: new Headers(this.requestHeader),\n credentials: this.withCredentials ? \"include\" : \"same-origin\",\n signal: typeof AbortSignal.any == \"function\" ? AbortSignal.any([this._abortController.signal, this.manager.abortController.signal]) : this._abortController.signal\n }), o = this.mimeType, l = this.responseType;\n fetch(a).then((c) => {\n if (c.status === 200 || c.status === 0) {\n if (c.status === 0 && Te(\"FileLoader: HTTP Status 0 received.\"), typeof ReadableStream > \"u\" || c.body === void 0 || c.body.getReader === void 0)\n return c;\n const h = Nn[e], u = c.body.getReader(), d = c.headers.get(\"X-File-Size\") || c.headers.get(\"Content-Length\"), p = d ? parseInt(d) : 0, g = p !== 0;\n let x = 0;\n const m = new ReadableStream({\n start(f) {\n y();\n function y() {\n u.read().then(({ done: v, value: T }) => {\n if (v)\n f.close();\n else {\n x += T.byteLength;\n const R = new ProgressEvent(\"progress\", { lengthComputable: g, loaded: x, total: p });\n for (let E = 0, P = h.length; E < P; E++) {\n const I = h[E];\n I.onProgress && I.onProgress(R);\n }\n f.enqueue(T), y();\n }\n }, (v) => {\n f.error(v);\n });\n }\n }\n });\n return new Response(m);\n } else\n throw new Cd(`fetch for \"${c.url}\" responded with ${c.status}: ${c.statusText}`, c);\n }).then((c) => {\n switch (l) {\n case \"arraybuffer\":\n return c.arrayBuffer();\n case \"blob\":\n return c.blob();\n case \"document\":\n return c.text().then((h) => new DOMParser().parseFromString(h, o));\n case \"json\":\n return c.json();\n default:\n if (o === \"\")\n return c.text();\n {\n const u = /charset=\"?([^;\"\\s]*)\"?/i.exec(o), d = u && u[1] ? u[1].toLowerCase() : void 0, p = new TextDecoder(d);\n return c.arrayBuffer().then((g) => p.decode(g));\n }\n }\n }).then((c) => {\n kn.add(`file:${e}`, c);\n const h = Nn[e];\n delete Nn[e];\n for (let u = 0, d = h.length; u < d; u++) {\n const p = h[u];\n p.onLoad && p.onLoad(c);\n }\n }).catch((c) => {\n const h = Nn[e];\n if (h === void 0)\n throw this.manager.itemError(e), c;\n delete Nn[e];\n for (let u = 0, d = h.length; u < d; u++) {\n const p = h[u];\n p.onError && p.onError(c);\n }\n this.manager.itemError(e);\n }).finally(() => {\n this.manager.itemEnd(e);\n }), this.manager.itemStart(e);\n }\n /**\n * Sets the expected response type.\n *\n * @param {('arraybuffer'|'blob'|'document'|'json'|'')} value - The response type.\n * @return {FileLoader} A reference to this file loader.\n */\n setResponseType(e) {\n return this.responseType = e, this;\n }\n /**\n * Sets the expected mime type of the loaded file.\n *\n * @param {string} value - The mime type.\n * @return {FileLoader} A reference to this file loader.\n */\n setMimeType(e) {\n return this.mimeType = e, this;\n }\n /**\n * Aborts ongoing fetch requests.\n *\n * @return {FileLoader} A reference to this instance.\n */\n abort() {\n return this._abortController.abort(), this._abortController = new AbortController(), this;\n }\n}\nconst Di = /* @__PURE__ */ new WeakMap();\nclass uh extends ei {\n /**\n * Constructs a new image loader.\n *\n * @param {LoadingManager} [manager] - The loading manager.\n */\n constructor(e) {\n super(e);\n }\n /**\n * Starts loading from the given URL and passes the loaded image\n * to the `onLoad()` callback. The method also returns a new `Image` object which can\n * directly be used for texture creation. If you do it this way, the texture\n * may pop up in your scene once the respective loading process is finished.\n *\n * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.\n * @param {function(Image)} onLoad - Executed when the loading process has been finished.\n * @param {onProgressCallback} onProgress - Unsupported in this loader.\n * @param {onErrorCallback} onError - Executed when errors occur.\n * @return {Image} The image.\n */\n load(e, t, n, s) {\n this.path !== void 0 && (e = this.path + e), e = this.manager.resolveURL(e);\n const r = this, a = kn.get(`image:${e}`);\n if (a !== void 0) {\n if (a.complete === !0)\n r.manager.itemStart(e), setTimeout(function() {\n t && t(a), r.manager.itemEnd(e);\n }, 0);\n else {\n let u = Di.get(a);\n u === void 0 && (u = [], Di.set(a, u)), u.push({ onLoad: t, onError: s });\n }\n return a;\n }\n const o = Es(\"img\");\n function l() {\n h(), t && t(this);\n const u = Di.get(this) || [];\n for (let d = 0; d < u.length; d++) {\n const p = u[d];\n p.onLoad && p.onLoad(this);\n }\n Di.delete(this), r.manager.itemEnd(e);\n }\n function c(u) {\n h(), s && s(u), kn.remove(`image:${e}`);\n const d = Di.get(this) || [];\n for (let p = 0; p < d.length; p++) {\n const g = d[p];\n g.onError && g.onError(u);\n }\n Di.delete(this), r.manager.itemError(e), r.manager.itemEnd(e);\n }\n function h() {\n o.removeEventListener(\"load\", l, !1), o.removeEventListener(\"error\", c, !1);\n }\n return o.addEventListener(\"load\", l, !1), o.addEventListener(\"error\", c, !1), e.slice(0, 5) !== \"data:\" && this.crossOrigin !== void 0 && (o.crossOrigin = this.crossOrigin), kn.add(`image:${e}`, o), r.manager.itemStart(e), o.src = e, o;\n }\n}\nclass dh extends ei {\n /**\n * Constructs a new cube texture loader.\n *\n * @param {LoadingManager} [manager] - The loading manager.\n */\n constructor(e) {\n super(e);\n }\n /**\n * Starts loading from the given URL and pass the fully loaded cube texture\n * to the `onLoad()` callback. The method also returns a new cube texture object which can\n * directly be used for material creation. If you do it this way, the cube texture\n * may pop up in your scene once the respective loading process is finished.\n *\n * @param {Array} urls - Array of 6 URLs to images, one for each side of the\n * cube texture. The urls should be specified in the following order: pos-x,\n * neg-x, pos-y, neg-y, pos-z, neg-z. An array of data URIs are allowed as well.\n * @param {function(CubeTexture)} onLoad - Executed when the loading process has been finished.\n * @param {onProgressCallback} onProgress - Unsupported in this loader.\n * @param {onErrorCallback} onError - Executed when errors occur.\n * @return {CubeTexture} The cube texture.\n */\n load(e, t, n, s) {\n const r = new No();\n r.colorSpace = Rt;\n const a = new uh(this.manager);\n a.setCrossOrigin(this.crossOrigin), a.setPath(this.path);\n let o = 0;\n function l(c) {\n a.load(e[c], function(h) {\n r.images[c] = h, o++, o === 6 && (r.needsUpdate = !0, t && t(r));\n }, void 0, s);\n }\n for (let c = 0; c < e.length; ++c)\n l(c);\n return r;\n }\n}\nclass Pd extends ei {\n /**\n * Constructs a new data texture loader.\n *\n * @param {LoadingManager} [manager] - The loading manager.\n */\n constructor(e) {\n super(e);\n }\n /**\n * Starts loading from the given URL and passes the loaded data texture\n * to the `onLoad()` callback. The method also returns a new texture object which can\n * directly be used for material creation. If you do it this way, the texture\n * may pop up in your scene once the respective loading process is finished.\n *\n * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.\n * @param {function(DataTexture)} onLoad - Executed when the loading process has been finished.\n * @param {onProgressCallback} onProgress - Executed while the loading is in progress.\n * @param {onErrorCallback} onError - Executed when errors occur.\n * @return {DataTexture} The data texture.\n */\n load(e, t, n, s) {\n const r = this, a = new Qi(), o = new Ho(this.manager);\n return o.setResponseType(\"arraybuffer\"), o.setRequestHeader(this.requestHeader), o.setPath(this.path), o.setWithCredentials(r.withCredentials), o.load(e, function(l) {\n let c;\n try {\n c = r.parse(l);\n } catch (h) {\n if (s !== void 0)\n s(h);\n else {\n h(h);\n return;\n }\n }\n c.image !== void 0 ? a.image = c.image : c.data !== void 0 && (a.image.width = c.width, a.image.height = c.height, a.image.data = c.data), a.wrapS = c.wrapS !== void 0 ? c.wrapS : en, a.wrapT = c.wrapT !== void 0 ? c.wrapT : en, a.magFilter = c.magFilter !== void 0 ? c.magFilter : bt, a.minFilter = c.minFilter !== void 0 ? c.minFilter : bt, a.anisotropy = c.anisotropy !== void 0 ? c.anisotropy : 1, c.colorSpace !== void 0 && (a.colorSpace = c.colorSpace), c.flipY !== void 0 && (a.flipY = c.flipY), c.format !== void 0 && (a.format = c.format), c.type !== void 0 && (a.type = c.type), c.mipmaps !== void 0 && (a.mipmaps = c.mipmaps, a.minFilter = yn), c.mipmapCount === 1 && (a.minFilter = bt), c.generateMipmaps !== void 0 && (a.generateMipmaps = c.generateMipmaps), a.needsUpdate = !0, t && t(a, c);\n }, n, s), a;\n }\n}\nclass fh extends ei {\n /**\n * Constructs a new texture loader.\n *\n * @param {LoadingManager} [manager] - The loading manager.\n */\n constructor(e) {\n super(e);\n }\n /**\n * Starts loading from the given URL and pass the fully loaded texture\n * to the `onLoad()` callback. The method also returns a new texture object which can\n * directly be used for material creation. If you do it this way, the texture\n * may pop up in your scene once the respective loading process is finished.\n *\n * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.\n * @param {function(Texture)} onLoad - Executed when the loading process has been finished.\n * @param {onProgressCallback} onProgress - Unsupported in this loader.\n * @param {onErrorCallback} onError - Executed when errors occur.\n * @return {Texture} The texture.\n */\n load(e, t, n, s) {\n const r = new Ct(), a = new uh(this.manager);\n return a.setCrossOrigin(this.crossOrigin), a.setPath(this.path), a.load(e, function(o) {\n r.image = o, r.needsUpdate = !0, t !== void 0 && t(r);\n }, n, s), r;\n }\n}\nclass Cs extends pt {\n /**\n * Constructs a new light.\n *\n * @param {(number|Color|string)} [color=0xffffff] - The light's color.\n * @param {number} [intensity=1] - The light's strength/intensity.\n */\n constructor(e, t = 1) {\n super(), this.isLight = !0, this.type = \"Light\", this.color = new Se(e), this.intensity = t;\n }\n /**\n * Frees the GPU-related resources allocated by this instance. Call this\n * method whenever this instance is no longer used in your app.\n */\n dispose() {\n }\n copy(e, t) {\n return super.copy(e, t), this.color.copy(e.color), this.intensity = e.intensity, this;\n }\n toJSON(e) {\n const t = super.toJSON(e);\n return t.object.color = this.color.getHex(), t.object.intensity = this.intensity, this.groundColor !== void 0 && (t.object.groundColor = this.groundColor.getHex()), this.distance !== void 0 && (t.object.distance = this.distance), this.angle !== void 0 && (t.object.angle = this.angle), this.decay !== void 0 && (t.object.decay = this.decay), this.penumbra !== void 0 && (t.object.penumbra = this.penumbra), this.shadow !== void 0 && (t.object.shadow = this.shadow.toJSON()), this.target !== void 0 && (t.object.target = this.target.uuid), t;\n }\n}\nconst la = /* @__PURE__ */ new Ne(), Gl = /* @__PURE__ */ new w(), Hl = /* @__PURE__ */ new w();\nclass Wo {\n /**\n * Constructs a new light shadow.\n *\n * @param {Camera} camera - The light's view of the world.\n */\n constructor(e) {\n this.camera = e, this.intensity = 1, this.bias = 0, this.normalBias = 0, this.radius = 1, this.blurSamples = 8, this.mapSize = new le(512, 512), this.mapType = mn, this.map = null, this.mapPass = null, this.matrix = new Ne(), this.autoUpdate = !0, this.needsUpdate = !1, this._frustum = new zo(), this._frameExtents = new le(1, 1), this._viewportCount = 1, this._viewports = [\n new Je(0, 0, 1, 1)\n ];\n }\n /**\n * Used internally by the renderer to get the number of viewports that need\n * to be rendered for this shadow.\n *\n * @return {number} The viewport count.\n */\n getViewportCount() {\n return this._viewportCount;\n }\n /**\n * Gets the shadow cameras frustum. Used internally by the renderer to cull objects.\n *\n * @return {Frustum} The shadow camera frustum.\n */\n getFrustum() {\n return this._frustum;\n }\n /**\n * Update the matrices for the camera and shadow, used internally by the renderer.\n *\n * @param {Light} light - The light for which the shadow is being rendered.\n */\n updateMatrices(e) {\n const t = this.camera, n = this.matrix;\n Gl.setFromMatrixPosition(e.matrixWorld), t.position.copy(Gl), Hl.setFromMatrixPosition(e.target.matrixWorld), t.lookAt(Hl), t.updateMatrixWorld(), la.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse), this._frustum.setFromProjectionMatrix(la, t.coordinateSystem, t.reversedDepth), t.reversedDepth ? n.set(\n 0.5,\n 0,\n 0,\n 0.5,\n 0,\n 0.5,\n 0,\n 0.5,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1\n ) : n.set(\n 0.5,\n 0,\n 0,\n 0.5,\n 0,\n 0.5,\n 0,\n 0.5,\n 0,\n 0,\n 0.5,\n 0.5,\n 0,\n 0,\n 0,\n 1\n ), n.multiply(la);\n }\n /**\n * Returns a viewport definition for the given viewport index.\n *\n * @param {number} viewportIndex - The viewport index.\n * @return {Vector4} The viewport.\n */\n getViewport(e) {\n return this._viewports[e];\n }\n /**\n * Returns the frame extends.\n *\n * @return {Vector2} The frame extends.\n */\n getFrameExtents() {\n return this._frameExtents;\n }\n /**\n * Frees the GPU-related resources allocated by this instance. Call this\n * method whenever this instance is no longer used in your app.\n */\n dispose() {\n this.map && this.map.dispose(), this.mapPass && this.mapPass.dispose();\n }\n /**\n * Copies the values of the given light shadow instance to this instance.\n *\n * @param {LightShadow} source - The light shadow to copy.\n * @return {LightShadow} A reference to this light shadow instance.\n */\n copy(e) {\n return this.camera = e.camera.clone(), this.intensity = e.intensity, this.bias = e.bias, this.radius = e.radius, this.autoUpdate = e.autoUpdate, this.needsUpdate = e.needsUpdate, this.normalBias = e.normalBias, this.blurSamples = e.blurSamples, this.mapSize.copy(e.mapSize), this;\n }\n /**\n * Returns a new light shadow instance with copied values from this instance.\n *\n * @return {LightShadow} A clone of this instance.\n */\n clone() {\n return new this.constructor().copy(this);\n }\n /**\n * Serializes the light shadow into JSON.\n *\n * @return {Object} A JSON object representing the serialized light shadow.\n * @see {@link ObjectLoader#parse}\n */\n toJSON() {\n const e = {};\n return this.intensity !== 1 && (e.intensity = this.intensity), this.bias !== 0 && (e.bias = this.bias), this.normalBias !== 0 && (e.normalBias = this.normalBias), this.radius !== 1 && (e.radius = this.radius), (this.mapSize.x !== 512 || this.mapSize.y !== 512) && (e.mapSize = this.mapSize.toArray()), e.camera = this.camera.toJSON(!1).object, delete e.camera.matrix, e;\n }\n}\nclass Dd extends Wo {\n /**\n * Constructs a new spot light shadow.\n */\n constructor() {\n super(new Tt(50, 1, 0.5, 500)), this.isSpotLightShadow = !0, this.focus = 1, this.aspect = 1;\n }\n updateMatrices(e) {\n const t = this.camera, n = ji * 2 * e.angle * this.focus, s = this.mapSize.width / this.mapSize.height * this.aspect, r = e.distance || t.far;\n (n !== t.fov || s !== t.aspect || r !== t.far) && (t.fov = n, t.aspect = s, t.far = r, t.updateProjectionMatrix()), super.updateMatrices(e);\n }\n copy(e) {\n return super.copy(e), this.focus = e.focus, this;\n }\n}\nclass Ld extends Cs {\n /**\n * Constructs a new spot light.\n *\n * @param {(number|Color|string)} [color=0xffffff] - The light's color.\n * @param {number} [intensity=1] - The light's strength/intensity measured in candela (cd).\n * @param {number} [distance=0] - Maximum range of the light. `0` means no limit.\n * @param {number} [angle=Math.PI/3] - Maximum angle of light dispersion from its direction whose upper bound is `Math.PI/2`.\n * @param {number} [penumbra=0] - Percent of the spotlight cone that is attenuated due to penumbra. Value range is `[0,1]`.\n * @param {number} [decay=2] - The amount the light dims along the distance of the light.\n */\n constructor(e, t, n = 0, s = Math.PI / 3, r = 0, a = 2) {\n super(e, t), this.isSpotLight = !0, this.type = \"SpotLight\", this.position.copy(pt.DEFAULT_UP), this.updateMatrix(), this.target = new pt(), this.distance = n, this.angle = s, this.penumbra = r, this.decay = a, this.map = null, this.shadow = new Dd();\n }\n /**\n * The light's power. Power is the luminous power of the light measured in lumens (lm).\n * Changing the power will also change the light's intensity.\n *\n * @type {number}\n */\n get power() {\n return this.intensity * Math.PI;\n }\n set power(e) {\n this.intensity = e / Math.PI;\n }\n dispose() {\n this.shadow.dispose();\n }\n copy(e, t) {\n return super.copy(e, t), this.distance = e.distance, this.angle = e.angle, this.penumbra = e.penumbra, this.decay = e.decay, this.target = e.target.clone(), this.shadow = e.shadow.clone(), this;\n }\n}\nconst Wl = /* @__PURE__ */ new Ne(), us = /* @__PURE__ */ new w(), ca = /* @__PURE__ */ new w();\nclass Id extends Wo {\n /**\n * Constructs a new point light shadow.\n */\n constructor() {\n super(new Tt(90, 1, 0.5, 500)), this.isPointLightShadow = !0, this._frameExtents = new le(4, 2), this._viewportCount = 6, this._viewports = [\n // These viewports map a cube-map onto a 2D texture with the\n // following orientation:\n //\n // xzXZ\n // y Y\n //\n // X - Positive x direction\n // x - Negative x direction\n // Y - Positive y direction\n // y - Negative y direction\n // Z - Positive z direction\n // z - Negative z direction\n // positive X\n new Je(2, 1, 1, 1),\n // negative X\n new Je(0, 1, 1, 1),\n // positive Z\n new Je(3, 1, 1, 1),\n // negative Z\n new Je(1, 1, 1, 1),\n // positive Y\n new Je(3, 0, 1, 1),\n // negative Y\n new Je(1, 0, 1, 1)\n ], this._cubeDirections = [\n new w(1, 0, 0),\n new w(-1, 0, 0),\n new w(0, 0, 1),\n new w(0, 0, -1),\n new w(0, 1, 0),\n new w(0, -1, 0)\n ], this._cubeUps = [\n new w(0, 1, 0),\n new w(0, 1, 0),\n new w(0, 1, 0),\n new w(0, 1, 0),\n new w(0, 0, 1),\n new w(0, 0, -1)\n ];\n }\n /**\n * Update the matrices for the camera and shadow, used internally by the renderer.\n *\n * @param {Light} light - The light for which the shadow is being rendered.\n * @param {number} [viewportIndex=0] - The viewport index.\n */\n updateMatrices(e, t = 0) {\n const n = this.camera, s = this.matrix, r = e.distance || n.far;\n r !== n.far && (n.far = r, n.updateProjectionMatrix()), us.setFromMatrixPosition(e.matrixWorld), n.position.copy(us), ca.copy(n.position), ca.add(this._cubeDirections[t]), n.up.copy(this._cubeUps[t]), n.lookAt(ca), n.updateMatrixWorld(), s.makeTranslation(-us.x, -us.y, -us.z), Wl.multiplyMatrices(n.projectionMatrix, n.matrixWorldInverse), this._frustum.setFromProjectionMatrix(Wl, n.coordinateSystem, n.reversedDepth);\n }\n}\nclass Ud extends Cs {\n /**\n * Constructs a new point light.\n *\n * @param {(number|Color|string)} [color=0xffffff] - The light's color.\n * @param {number} [intensity=1] - The light's strength/intensity measured in candela (cd).\n * @param {number} [distance=0] - Maximum range of the light. `0` means no limit.\n * @param {number} [decay=2] - The amount the light dims along the distance of the light.\n */\n constructor(e, t, n = 0, s = 2) {\n super(e, t), this.isPointLight = !0, this.type = \"PointLight\", this.distance = n, this.decay = s, this.shadow = new Id();\n }\n /**\n * The light's power. Power is the luminous power of the light measured in lumens (lm).\n * Changing the power will also change the light's intensity.\n *\n * @type {number}\n */\n get power() {\n return this.intensity * 4 * Math.PI;\n }\n set power(e) {\n this.intensity = e / (4 * Math.PI);\n }\n dispose() {\n this.shadow.dispose();\n }\n copy(e, t) {\n return super.copy(e, t), this.distance = e.distance, this.decay = e.decay, this.shadow = e.shadow.clone(), this;\n }\n}\nclass pi extends ih {\n /**\n * Constructs a new orthographic camera.\n *\n * @param {number} [left=-1] - The left plane of the camera's frustum.\n * @param {number} [right=1] - The right plane of the camera's frustum.\n * @param {number} [top=1] - The top plane of the camera's frustum.\n * @param {number} [bottom=-1] - The bottom plane of the camera's frustum.\n * @param {number} [near=0.1] - The camera's near plane.\n * @param {number} [far=2000] - The camera's far plane.\n */\n constructor(e = -1, t = 1, n = 1, s = -1, r = 0.1, a = 2e3) {\n super(), this.isOrthographicCamera = !0, this.type = \"OrthographicCamera\", this.zoom = 1, this.view = null, this.left = e, this.right = t, this.top = n, this.bottom = s, this.near = r, this.far = a, this.updateProjectionMatrix();\n }\n copy(e, t) {\n return super.copy(e, t), this.left = e.left, this.right = e.right, this.top = e.top, this.bottom = e.bottom, this.near = e.near, this.far = e.far, this.zoom = e.zoom, this.view = e.view === null ? null : Object.assign({}, e.view), this;\n }\n /**\n * Sets an offset in a larger frustum. This is useful for multi-window or\n * multi-monitor/multi-machine setups.\n *\n * @param {number} fullWidth - The full width of multiview setup.\n * @param {number} fullHeight - The full height of multiview setup.\n * @param {number} x - The horizontal offset of the subcamera.\n * @param {number} y - The vertical offset of the subcamera.\n * @param {number} width - The width of subcamera.\n * @param {number} height - The height of subcamera.\n * @see {@link PerspectiveCamera#setViewOffset}\n */\n setViewOffset(e, t, n, s, r, a) {\n this.view === null && (this.view = {\n enabled: !0,\n fullWidth: 1,\n fullHeight: 1,\n offsetX: 0,\n offsetY: 0,\n width: 1,\n height: 1\n }), this.view.enabled = !0, this.view.fullWidth = e, this.view.fullHeight = t, this.view.offsetX = n, this.view.offsetY = s, this.view.width = r, this.view.height = a, this.updateProjectionMatrix();\n }\n /**\n * Removes the view offset from the projection matrix.\n */\n clearViewOffset() {\n this.view !== null && (this.view.enabled = !1), this.updateProjectionMatrix();\n }\n /**\n * Updates the camera's projection matrix. Must be called after any change of\n * camera properties.\n */\n updateProjectionMatrix() {\n const e = (this.right - this.left) / (2 * this.zoom), t = (this.top - this.bottom) / (2 * this.zoom), n = (this.right + this.left) / 2, s = (this.top + this.bottom) / 2;\n let r = n - e, a = n + e, o = s + t, l = s - t;\n if (this.view !== null && this.view.enabled) {\n const c = (this.right - this.left) / this.view.fullWidth / this.zoom, h = (this.top - this.bottom) / this.view.fullHeight / this.zoom;\n r += c * this.view.offsetX, a = r + c * this.view.width, o -= h * this.view.offsetY, l = o - h * this.view.height;\n }\n this.projectionMatrix.makeOrthographic(r, a, o, l, this.near, this.far, this.coordinateSystem, this.reversedDepth), this.projectionMatrixInverse.copy(this.projectionMatrix).invert();\n }\n toJSON(e) {\n const t = super.toJSON(e);\n return t.object.zoom = this.zoom, t.object.left = this.left, t.object.right = this.right, t.object.top = this.top, t.object.bottom = this.bottom, t.object.near = this.near, t.object.far = this.far, this.view !== null && (t.object.view = Object.assign({}, this.view)), t;\n }\n}\nclass Nd extends Wo {\n /**\n * Constructs a new directional light shadow.\n */\n constructor() {\n super(new pi(-5, 5, 5, -5, 0.5, 500)), this.isDirectionalLightShadow = !0;\n }\n}\nclass ph extends Cs {\n /**\n * Constructs a new directional light.\n *\n * @param {(number|Color|string)} [color=0xffffff] - The light's color.\n * @param {number} [intensity=1] - The light's strength/intensity.\n */\n constructor(e, t) {\n super(e, t), this.isDirectionalLight = !0, this.type = \"DirectionalLight\", this.position.copy(pt.DEFAULT_UP), this.updateMatrix(), this.target = new pt(), this.shadow = new Nd();\n }\n dispose() {\n this.shadow.dispose();\n }\n copy(e) {\n return super.copy(e), this.target = e.target.clone(), this.shadow = e.shadow.clone(), this;\n }\n}\nclass mh extends Cs {\n /**\n * Constructs a new ambient light.\n *\n * @param {(number|Color|string)} [color=0xffffff] - The light's color.\n * @param {number} [intensity=1] - The light's strength/intensity.\n */\n constructor(e, t) {\n super(e, t), this.isAmbientLight = !0, this.type = \"AmbientLight\";\n }\n}\nclass Ms {\n /**\n * Extracts the base URL from the given URL.\n *\n * @param {string} url -The URL to extract the base URL from.\n * @return {string} The extracted base URL.\n */\n static extractUrlBase(e) {\n const t = e.lastIndexOf(\"/\");\n return t === -1 ? \"./\" : e.slice(0, t + 1);\n }\n /**\n * Resolves relative URLs against the given path. Absolute paths, data urls,\n * and blob URLs will be returned as is. Invalid URLs will return an empty\n * string.\n *\n * @param {string} url -The URL to resolve.\n * @param {string} path - The base path for relative URLs to be resolved against.\n * @return {string} The resolved URL.\n */\n static resolveURL(e, t) {\n return typeof e != \"string\" || e === \"\" ? \"\" : (/^https?:\\/\\//i.test(t) && /^\\//.test(e) && (t = t.replace(/(^https?:\\/\\/[^\\/]+).*/i, \"$1\")), /^(https?:)?\\/\\//i.test(e) || /^data:.*,.*$/i.test(e) || /^blob:.*$/i.test(e) ? e : t + e);\n }\n}\nconst ha = /* @__PURE__ */ new WeakMap();\nclass Fd extends ei {\n /**\n * Constructs a new image bitmap loader.\n *\n * @param {LoadingManager} [manager] - The loading manager.\n */\n constructor(e) {\n super(e), this.isImageBitmapLoader = !0, typeof createImageBitmap > \"u\" && Te(\"ImageBitmapLoader: createImageBitmap() not supported.\"), typeof fetch > \"u\" && Te(\"ImageBitmapLoader: fetch() not supported.\"), this.options = { premultiplyAlpha: \"none\" }, this._abortController = new AbortController();\n }\n /**\n * Sets the given loader options. The structure of the object must match the `options` parameter of\n * [createImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap).\n *\n * @param {Object} options - The loader options to set.\n * @return {ImageBitmapLoader} A reference to this image bitmap loader.\n */\n setOptions(e) {\n return this.options = e, this;\n }\n /**\n * Starts loading from the given URL and pass the loaded image bitmap to the `onLoad()` callback.\n *\n * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.\n * @param {function(ImageBitmap)} onLoad - Executed when the loading process has been finished.\n * @param {onProgressCallback} onProgress - Unsupported in this loader.\n * @param {onErrorCallback} onError - Executed when errors occur.\n * @return {ImageBitmap|undefined} The image bitmap.\n */\n load(e, t, n, s) {\n e === void 0 && (e = \"\"), this.path !== void 0 && (e = this.path + e), e = this.manager.resolveURL(e);\n const r = this, a = kn.get(`image-bitmap:${e}`);\n if (a !== void 0) {\n if (r.manager.itemStart(e), a.then) {\n a.then((c) => {\n if (ha.has(a) === !0)\n s && s(ha.get(a)), r.manager.itemError(e), r.manager.itemEnd(e);\n else\n return t && t(c), r.manager.itemEnd(e), c;\n });\n return;\n }\n return setTimeout(function() {\n t && t(a), r.manager.itemEnd(e);\n }, 0), a;\n }\n const o = {};\n o.credentials = this.crossOrigin === \"anonymous\" ? \"same-origin\" : \"include\", o.headers = this.requestHeader, o.signal = typeof AbortSignal.any == \"function\" ? AbortSignal.any([this._abortController.signal, this.manager.abortController.signal]) : this._abortController.signal;\n const l = fetch(e, o).then(function(c) {\n return c.blob();\n }).then(function(c) {\n return createImageBitmap(c, Object.assign(r.options, { colorSpaceConversion: \"none\" }));\n }).then(function(c) {\n return kn.add(`image-bitmap:${e}`, c), t && t(c), r.manager.itemEnd(e), c;\n }).catch(function(c) {\n s && s(c), ha.set(l, c), kn.remove(`image-bitmap:${e}`), r.manager.itemError(e), r.manager.itemEnd(e);\n });\n kn.add(`image-bitmap:${e}`, l), r.manager.itemStart(e);\n }\n /**\n * Aborts ongoing fetch requests.\n *\n * @return {ImageBitmapLoader} A reference to this instance.\n */\n abort() {\n return this._abortController.abort(), this._abortController = new AbortController(), this;\n }\n}\nclass Od extends Tt {\n /**\n * Constructs a new array camera.\n *\n * @param {Array} [array=[]] - An array of perspective sub cameras.\n */\n constructor(e = []) {\n super(), this.isArrayCamera = !0, this.isMultiViewCamera = !1, this.cameras = e;\n }\n}\nclass Bd {\n /**\n * Constructs a new clock.\n *\n * @param {boolean} [autoStart=true] - Whether to automatically start the clock when\n * `getDelta()` is called for the first time.\n */\n constructor(e = !0) {\n this.autoStart = e, this.startTime = 0, this.oldTime = 0, this.elapsedTime = 0, this.running = !1;\n }\n /**\n * Starts the clock. When `autoStart` is set to `true`, the method is automatically\n * called by the class.\n */\n start() {\n this.startTime = performance.now(), this.oldTime = this.startTime, this.elapsedTime = 0, this.running = !0;\n }\n /**\n * Stops the clock.\n */\n stop() {\n this.getElapsedTime(), this.running = !1, this.autoStart = !1;\n }\n /**\n * Returns the elapsed time in seconds.\n *\n * @return {number} The elapsed time.\n */\n getElapsedTime() {\n return this.getDelta(), this.elapsedTime;\n }\n /**\n * Returns the delta time in seconds.\n *\n * @return {number} The delta time.\n */\n getDelta() {\n let e = 0;\n if (this.autoStart && !this.running)\n return this.start(), 0;\n if (this.running) {\n const t = performance.now();\n e = (t - this.oldTime) / 1e3, this.oldTime = t, this.elapsedTime += e;\n }\n return e;\n }\n}\nconst Xo = \"\\\\[\\\\]\\\\.:\\\\/\", zd = new RegExp(\"[\" + Xo + \"]\", \"g\"), jo = \"[^\" + Xo + \"]\", kd = \"[^\" + Xo.replace(\"\\\\.\", \"\") + \"]\", Vd = /* @__PURE__ */ /((?:WC+[\\/:])*)/.source.replace(\"WC\", jo), Gd = /* @__PURE__ */ /(WCOD+)?/.source.replace(\"WCOD\", kd), Hd = /* @__PURE__ */ /(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace(\"WC\", jo), Wd = /* @__PURE__ */ /\\.(WC+)(?:\\[(.+)\\])?/.source.replace(\"WC\", jo), Xd = new RegExp(\n \"^\" + Vd + Gd + Hd + Wd + \"$\"\n), jd = [\"material\", \"materials\", \"bones\", \"map\"];\nclass qd {\n constructor(e, t, n) {\n const s = n || nt.parseTrackName(t);\n this._targetGroup = e, this._bindings = e.subscribe_(t, s);\n }\n getValue(e, t) {\n this.bind();\n const n = this._targetGroup.nCachedObjects_, s = this._bindings[n];\n s !== void 0 && s.getValue(e, t);\n }\n setValue(e, t) {\n const n = this._bindings;\n for (let s = this._targetGroup.nCachedObjects_, r = n.length; s !== r; ++s)\n n[s].setValue(e, t);\n }\n bind() {\n const e = this._bindings;\n for (let t = this._targetGroup.nCachedObjects_, n = e.length; t !== n; ++t)\n e[t].bind();\n }\n unbind() {\n const e = this._bindings;\n for (let t = this._targetGroup.nCachedObjects_, n = e.length; t !== n; ++t)\n e[t].unbind();\n }\n}\nclass nt {\n /**\n * Constructs a new property binding.\n *\n * @param {Object} rootNode - The root node.\n * @param {string} path - The path.\n * @param {?Object} [parsedPath] - The parsed path.\n */\n constructor(e, t, n) {\n this.path = t, this.parsedPath = n || nt.parseTrackName(t), this.node = nt.findNode(e, this.parsedPath.nodeName), this.rootNode = e, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound;\n }\n /**\n * Factory method for creating a property binding from the given parameters.\n *\n * @static\n * @param {Object} root - The root node.\n * @param {string} path - The path.\n * @param {?Object} [parsedPath] - The parsed path.\n * @return {PropertyBinding|Composite} The created property binding or composite.\n */\n static create(e, t, n) {\n return e && e.isAnimationObjectGroup ? new nt.Composite(e, t, n) : new nt(e, t, n);\n }\n /**\n * Replaces spaces with underscores and removes unsupported characters from\n * node names, to ensure compatibility with parseTrackName().\n *\n * @param {string} name - Node name to be sanitized.\n * @return {string} The sanitized node name.\n */\n static sanitizeNodeName(e) {\n return e.replace(/\\s/g, \"_\").replace(zd, \"\");\n }\n /**\n * Parses the given track name (an object path to an animated property) and\n * returns an object with information about the path. Matches strings in the following forms:\n *\n * - nodeName.property\n * - nodeName.property[accessor]\n * - nodeName.material.property[accessor]\n * - uuid.property[accessor]\n * - uuid.objectName[objectIndex].propertyName[propertyIndex]\n * - parentName/nodeName.property\n * - parentName/parentName/nodeName.property[index]\n * - .bone[Armature.DEF_cog].position\n * - scene:helium_balloon_model:helium_balloon_model.position\n *\n * @static\n * @param {string} trackName - The track name to parse.\n * @return {Object} The parsed track name as an object.\n */\n static parseTrackName(e) {\n const t = Xd.exec(e);\n if (t === null)\n throw new Error(\"PropertyBinding: Cannot parse trackName: \" + e);\n const n = {\n // directoryName: matches[ 1 ], // (tschw) currently unused\n nodeName: t[2],\n objectName: t[3],\n objectIndex: t[4],\n propertyName: t[5],\n // required\n propertyIndex: t[6]\n }, s = n.nodeName && n.nodeName.lastIndexOf(\".\");\n if (s !== void 0 && s !== -1) {\n const r = n.nodeName.substring(s + 1);\n jd.indexOf(r) !== -1 && (n.nodeName = n.nodeName.substring(0, s), n.objectName = r);\n }\n if (n.propertyName === null || n.propertyName.length === 0)\n throw new Error(\"PropertyBinding: can not parse propertyName from trackName: \" + e);\n return n;\n }\n /**\n * Searches for a node in the hierarchy of the given root object by the given\n * node name.\n *\n * @static\n * @param {Object} root - The root object.\n * @param {string|number} nodeName - The name of the node.\n * @return {?Object} The found node. Returns `null` if no object was found.\n */\n static findNode(e, t) {\n if (t === void 0 || t === \"\" || t === \".\" || t === -1 || t === e.name || t === e.uuid)\n return e;\n if (e.skeleton) {\n const n = e.skeleton.getBoneByName(t);\n if (n !== void 0)\n return n;\n }\n if (e.children) {\n const n = function(r) {\n for (let a = 0; a < r.length; a++) {\n const o = r[a];\n if (o.name === t || o.uuid === t)\n return o;\n const l = n(o.children);\n if (l) return l;\n }\n return null;\n }, s = n(e.children);\n if (s)\n return s;\n }\n return null;\n }\n // these are used to \"bind\" a nonexistent property\n _getValue_unavailable() {\n }\n _setValue_unavailable() {\n }\n // Getters\n _getValue_direct(e, t) {\n e[t] = this.targetObject[this.propertyName];\n }\n _getValue_array(e, t) {\n const n = this.resolvedProperty;\n for (let s = 0, r = n.length; s !== r; ++s)\n e[t++] = n[s];\n }\n _getValue_arrayElement(e, t) {\n e[t] = this.resolvedProperty[this.propertyIndex];\n }\n _getValue_toArray(e, t) {\n this.resolvedProperty.toArray(e, t);\n }\n // Direct\n _setValue_direct(e, t) {\n this.targetObject[this.propertyName] = e[t];\n }\n _setValue_direct_setNeedsUpdate(e, t) {\n this.targetObject[this.propertyName] = e[t], this.targetObject.needsUpdate = !0;\n }\n _setValue_direct_setMatrixWorldNeedsUpdate(e, t) {\n this.targetObject[this.propertyName] = e[t], this.targetObject.matrixWorldNeedsUpdate = !0;\n }\n // EntireArray\n _setValue_array(e, t) {\n const n = this.resolvedProperty;\n for (let s = 0, r = n.length; s !== r; ++s)\n n[s] = e[t++];\n }\n _setValue_array_setNeedsUpdate(e, t) {\n const n = this.resolvedProperty;\n for (let s = 0, r = n.length; s !== r; ++s)\n n[s] = e[t++];\n this.targetObject.needsUpdate = !0;\n }\n _setValue_array_setMatrixWorldNeedsUpdate(e, t) {\n const n = this.resolvedProperty;\n for (let s = 0, r = n.length; s !== r; ++s)\n n[s] = e[t++];\n this.targetObject.matrixWorldNeedsUpdate = !0;\n }\n // ArrayElement\n _setValue_arrayElement(e, t) {\n this.resolvedProperty[this.propertyIndex] = e[t];\n }\n _setValue_arrayElement_setNeedsUpdate(e, t) {\n this.resolvedProperty[this.propertyIndex] = e[t], this.targetObject.needsUpdate = !0;\n }\n _setValue_arrayElement_setMatrixWorldNeedsUpdate(e, t) {\n this.resolvedProperty[this.propertyIndex] = e[t], this.targetObject.matrixWorldNeedsUpdate = !0;\n }\n // HasToFromArray\n _setValue_fromArray(e, t) {\n this.resolvedProperty.fromArray(e, t);\n }\n _setValue_fromArray_setNeedsUpdate(e, t) {\n this.resolvedProperty.fromArray(e, t), this.targetObject.needsUpdate = !0;\n }\n _setValue_fromArray_setMatrixWorldNeedsUpdate(e, t) {\n this.resolvedProperty.fromArray(e, t), this.targetObject.matrixWorldNeedsUpdate = !0;\n }\n _getValue_unbound(e, t) {\n this.bind(), this.getValue(e, t);\n }\n _setValue_unbound(e, t) {\n this.bind(), this.setValue(e, t);\n }\n /**\n * Creates a getter / setter pair for the property tracked by this binding.\n */\n bind() {\n let e = this.node;\n const t = this.parsedPath, n = t.objectName, s = t.propertyName;\n let r = t.propertyIndex;\n if (e || (e = nt.findNode(this.rootNode, t.nodeName), this.node = e), this.getValue = this._getValue_unavailable, this.setValue = this._setValue_unavailable, !e) {\n Te(\"PropertyBinding: No target node found for track: \" + this.path + \".\");\n return;\n }\n if (n) {\n let c = t.objectIndex;\n switch (n) {\n case \"materials\":\n if (!e.material) {\n Xe(\"PropertyBinding: Can not bind to material as node does not have a material.\", this);\n return;\n }\n if (!e.material.materials) {\n Xe(\"PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.\", this);\n return;\n }\n e = e.material.materials;\n break;\n case \"bones\":\n if (!e.skeleton) {\n Xe(\"PropertyBinding: Can not bind to bones as node does not have a skeleton.\", this);\n return;\n }\n e = e.skeleton.bones;\n for (let h = 0; h < e.length; h++)\n if (e[h].name === c) {\n c = h;\n break;\n }\n break;\n case \"map\":\n if (\"map\" in e) {\n e = e.map;\n break;\n }\n if (!e.material) {\n Xe(\"PropertyBinding: Can not bind to material as node does not have a material.\", this);\n return;\n }\n if (!e.material.map) {\n Xe(\"PropertyBinding: Can not bind to material.map as node.material does not have a map.\", this);\n return;\n }\n e = e.material.map;\n break;\n default:\n if (e[n] === void 0) {\n Xe(\"PropertyBinding: Can not bind to objectName of node undefined.\", this);\n return;\n }\n e = e[n];\n }\n if (c !== void 0) {\n if (e[c] === void 0) {\n Xe(\"PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.\", this, e);\n return;\n }\n e = e[c];\n }\n }\n const a = e[s];\n if (a === void 0) {\n const c = t.nodeName;\n Xe(\"PropertyBinding: Trying to update property for track: \" + c + \".\" + s + \" but it wasn't found.\", e);\n return;\n }\n let o = this.Versioning.None;\n this.targetObject = e, e.isMaterial === !0 ? o = this.Versioning.NeedsUpdate : e.isObject3D === !0 && (o = this.Versioning.MatrixWorldNeedsUpdate);\n let l = this.BindingType.Direct;\n if (r !== void 0) {\n if (s === \"morphTargetInfluences\") {\n if (!e.geometry) {\n Xe(\"PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.\", this);\n return;\n }\n if (!e.geometry.morphAttributes) {\n Xe(\"PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.\", this);\n return;\n }\n e.morphTargetDictionary[r] !== void 0 && (r = e.morphTargetDictionary[r]);\n }\n l = this.BindingType.ArrayElement, this.resolvedProperty = a, this.propertyIndex = r;\n } else a.fromArray !== void 0 && a.toArray !== void 0 ? (l = this.BindingType.HasFromToArray, this.resolvedProperty = a) : Array.isArray(a) ? (l = this.BindingType.EntireArray, this.resolvedProperty = a) : this.propertyName = s;\n this.getValue = this.GetterByBindingType[l], this.setValue = this.SetterByBindingTypeAndVersioning[l][o];\n }\n /**\n * Unbinds the property.\n */\n unbind() {\n this.node = null, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound;\n }\n}\nnt.Composite = qd;\nnt.prototype.BindingType = {\n Direct: 0,\n EntireArray: 1,\n ArrayElement: 2,\n HasFromToArray: 3\n};\nnt.prototype.Versioning = {\n None: 0,\n NeedsUpdate: 1,\n MatrixWorldNeedsUpdate: 2\n};\nnt.prototype.GetterByBindingType = [\n nt.prototype._getValue_direct,\n nt.prototype._getValue_array,\n nt.prototype._getValue_arrayElement,\n nt.prototype._getValue_toArray\n];\nnt.prototype.SetterByBindingTypeAndVersioning = [\n [\n // Direct\n nt.prototype._setValue_direct,\n nt.prototype._setValue_direct_setNeedsUpdate,\n nt.prototype._setValue_direct_setMatrixWorldNeedsUpdate\n ],\n [\n // EntireArray\n nt.prototype._setValue_array,\n nt.prototype._setValue_array_setNeedsUpdate,\n nt.prototype._setValue_array_setMatrixWorldNeedsUpdate\n ],\n [\n // ArrayElement\n nt.prototype._setValue_arrayElement,\n nt.prototype._setValue_arrayElement_setNeedsUpdate,\n nt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate\n ],\n [\n // HasToFromArray\n nt.prototype._setValue_fromArray,\n nt.prototype._setValue_fromArray_setNeedsUpdate,\n nt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate\n ]\n];\nconst Xl = /* @__PURE__ */ new Ne();\nclass jl {\n /**\n * Constructs a new raycaster.\n *\n * @param {Vector3} origin - The origin vector where the ray casts from.\n * @param {Vector3} direction - The (normalized) direction vector that gives direction to the ray.\n * @param {number} [near=0] - All results returned are further away than near. Near can't be negative.\n * @param {number} [far=Infinity] - All results returned are closer than far. Far can't be lower than near.\n */\n constructor(e, t, n = 0, s = 1 / 0) {\n this.ray = new Ji(e, t), this.near = n, this.far = s, this.camera = null, this.layers = new Uo(), this.params = {\n Mesh: {},\n Line: { threshold: 1 },\n LOD: {},\n Points: { threshold: 1 },\n Sprite: {}\n };\n }\n /**\n * Updates the ray with a new origin and direction by copying the values from the arguments.\n *\n * @param {Vector3} origin - The origin vector where the ray casts from.\n * @param {Vector3} direction - The (normalized) direction vector that gives direction to the ray.\n */\n set(e, t) {\n this.ray.set(e, t);\n }\n /**\n * Uses the given coordinates and camera to compute a new origin and direction for the internal ray.\n *\n * @param {Vector2} coords - 2D coordinates of the mouse, in normalized device coordinates (NDC).\n * X and Y components should be between `-1` and `1`.\n * @param {Camera} camera - The camera from which the ray should originate.\n */\n setFromCamera(e, t) {\n t.isPerspectiveCamera ? (this.ray.origin.setFromMatrixPosition(t.matrixWorld), this.ray.direction.set(e.x, e.y, 0.5).unproject(t).sub(this.ray.origin).normalize(), this.camera = t) : t.isOrthographicCamera ? (this.ray.origin.set(e.x, e.y, (t.near + t.far) / (t.near - t.far)).unproject(t), this.ray.direction.set(0, 0, -1).transformDirection(t.matrixWorld), this.camera = t) : Xe(\"Raycaster: Unsupported camera type: \" + t.type);\n }\n /**\n * Uses the given WebXR controller to compute a new origin and direction for the internal ray.\n *\n * @param {WebXRController} controller - The controller to copy the position and direction from.\n * @return {Raycaster} A reference to this raycaster.\n */\n setFromXRController(e) {\n return Xl.identity().extractRotation(e.matrixWorld), this.ray.origin.setFromMatrixPosition(e.matrixWorld), this.ray.direction.set(0, 0, -1).applyMatrix4(Xl), this;\n }\n /**\n * The intersection point of a raycaster intersection test.\n * @typedef {Object} Raycaster~Intersection\n * @property {number} distance - The distance from the ray's origin to the intersection point.\n * @property {number} distanceToRay - Some 3D objects e.g. {@link Points} provide the distance of the\n * intersection to the nearest point on the ray. For other objects it will be `undefined`.\n * @property {Vector3} point - The intersection point, in world coordinates.\n * @property {Object} face - The face that has been intersected.\n * @property {number} faceIndex - The face index.\n * @property {Object3D} object - The 3D object that has been intersected.\n * @property {Vector2} uv - U,V coordinates at point of intersection.\n * @property {Vector2} uv1 - Second set of U,V coordinates at point of intersection.\n * @property {Vector3} uv1 - Interpolated normal vector at point of intersection.\n * @property {number} instanceId - The index number of the instance where the ray\n * intersects the {@link InstancedMesh}.\n */\n /**\n * Checks all intersection between the ray and the object with or without the\n * descendants. Intersections are returned sorted by distance, closest first.\n *\n * `Raycaster` delegates to the `raycast()` method of the passed 3D object, when\n * evaluating whether the ray intersects the object or not. This allows meshes to respond\n * differently to ray casting than lines or points.\n *\n * Note that for meshes, faces must be pointed towards the origin of the ray in order\n * to be detected; intersections of the ray passing through the back of a face will not\n * be detected. To raycast against both faces of an object, you'll want to set {@link Material#side}\n * to `THREE.DoubleSide`.\n *\n * @param {Object3D} object - The 3D object to check for intersection with the ray.\n * @param {boolean} [recursive=true] - If set to `true`, it also checks all descendants.\n * Otherwise it only checks intersection with the object.\n * @param {Array} [intersects=[]] The target array that holds the result of the method.\n * @return {Array} An array holding the intersection points.\n */\n intersectObject(e, t = !0, n = []) {\n return po(e, this, n, t), n.sort(ql), n;\n }\n /**\n * Checks all intersection between the ray and the objects with or without\n * the descendants. Intersections are returned sorted by distance, closest first.\n *\n * @param {Array} objects - The 3D objects to check for intersection with the ray.\n * @param {boolean} [recursive=true] - If set to `true`, it also checks all descendants.\n * Otherwise it only checks intersection with the object.\n * @param {Array} [intersects=[]] The target array that holds the result of the method.\n * @return {Array} An array holding the intersection points.\n */\n intersectObjects(e, t = !0, n = []) {\n for (let s = 0, r = e.length; s < r; s++)\n po(e[s], this, n, t);\n return n.sort(ql), n;\n }\n}\nfunction ql(i, e) {\n return i.distance - e.distance;\n}\nfunction po(i, e, t, n) {\n let s = !0;\n if (i.layers.test(e.layers) && i.raycast(e, t) === !1 && (s = !1), s === !0 && n === !0) {\n const r = i.children;\n for (let a = 0, o = r.length; a < o; a++)\n po(r[a], e, t, !0);\n }\n}\nclass Yl {\n /**\n * Constructs a new spherical.\n *\n * @param {number} [radius=1] - The radius, or the Euclidean distance (straight-line distance) from the point to the origin.\n * @param {number} [phi=0] - The polar angle in radians from the y (up) axis.\n * @param {number} [theta=0] - The equator/azimuthal angle in radians around the y (up) axis.\n */\n constructor(e = 1, t = 0, n = 0) {\n this.radius = e, this.phi = t, this.theta = n;\n }\n /**\n * Sets the spherical components by copying the given values.\n *\n * @param {number} radius - The radius.\n * @param {number} phi - The polar angle.\n * @param {number} theta - The azimuthal angle.\n * @return {Spherical} A reference to this spherical.\n */\n set(e, t, n) {\n return this.radius = e, this.phi = t, this.theta = n, this;\n }\n /**\n * Copies the values of the given spherical to this instance.\n *\n * @param {Spherical} other - The spherical to copy.\n * @return {Spherical} A reference to this spherical.\n */\n copy(e) {\n return this.radius = e.radius, this.phi = e.phi, this.theta = e.theta, this;\n }\n /**\n * Restricts the polar angle [page:.phi phi] to be between `0.000001` and pi -\n * `0.000001`.\n *\n * @return {Spherical} A reference to this spherical.\n */\n makeSafe() {\n return this.phi = He(this.phi, 1e-6, Math.PI - 1e-6), this;\n }\n /**\n * Sets the spherical components from the given vector which is assumed to hold\n * Cartesian coordinates.\n *\n * @param {Vector3} v - The vector to set.\n * @return {Spherical} A reference to this spherical.\n */\n setFromVector3(e) {\n return this.setFromCartesianCoords(e.x, e.y, e.z);\n }\n /**\n * Sets the spherical components from the given Cartesian coordinates.\n *\n * @param {number} x - The x value.\n * @param {number} y - The y value.\n * @param {number} z - The z value.\n * @return {Spherical} A reference to this spherical.\n */\n setFromCartesianCoords(e, t, n) {\n return this.radius = Math.sqrt(e * e + t * t + n * n), this.radius === 0 ? (this.theta = 0, this.phi = 0) : (this.theta = Math.atan2(e, n), this.phi = Math.acos(He(t / this.radius, -1, 1))), this;\n }\n /**\n * Returns a new spherical with copied values from this instance.\n *\n * @return {Spherical} A clone of this instance.\n */\n clone() {\n return new this.constructor().copy(this);\n }\n}\nclass Yd extends mi {\n /**\n * Constructs a new controls instance.\n *\n * @param {Object3D} object - The object that is managed by the controls.\n * @param {?HTMLElement} domElement - The HTML element used for event listeners.\n */\n constructor(e, t = null) {\n super(), this.object = e, this.domElement = t, this.enabled = !0, this.state = -1, this.keys = {}, this.mouseButtons = { LEFT: null, MIDDLE: null, RIGHT: null }, this.touches = { ONE: null, TWO: null };\n }\n /**\n * Connects the controls to the DOM. This method has so called \"side effects\" since\n * it adds the module's event listeners to the DOM.\n *\n * @param {HTMLElement} element - The DOM element to connect to.\n */\n connect(e) {\n if (e === void 0) {\n Te(\"Controls: connect() now requires an element.\");\n return;\n }\n this.domElement !== null && this.disconnect(), this.domElement = e;\n }\n /**\n * Disconnects the controls from the DOM.\n */\n disconnect() {\n }\n /**\n * Call this method if you no longer want use to the controls. It frees all internal\n * resources and removes all event listeners.\n */\n dispose() {\n }\n /**\n * Controls should implement this method if they have to update their internal state\n * per simulation step.\n *\n * @param {number} [delta] - The time delta in seconds.\n */\n update() {\n }\n}\nfunction Kl(i, e, t, n) {\n const s = Kd(n);\n switch (t) {\n // https://registry.khronos.org/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml\n case jc:\n return i * e;\n case wo:\n return i * e / s.components * s.byteLength;\n case Ao:\n return i * e / s.components * s.byteLength;\n case Ro:\n return i * e * 2 / s.components * s.byteLength;\n case Co:\n return i * e * 2 / s.components * s.byteLength;\n case qc:\n return i * e * 3 / s.components * s.byteLength;\n case Zt:\n return i * e * 4 / s.components * s.byteLength;\n case Po:\n return i * e * 4 / s.components * s.byteLength;\n // https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_s3tc_srgb/\n case dr:\n case fr:\n return Math.floor((i + 3) / 4) * Math.floor((e + 3) / 4) * 8;\n case pr:\n case mr:\n return Math.floor((i + 3) / 4) * Math.floor((e + 3) / 4) * 16;\n // https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_pvrtc/\n case Na:\n case Oa:\n return Math.max(i, 16) * Math.max(e, 8) / 4;\n case Ua:\n case Fa:\n return Math.max(i, 8) * Math.max(e, 8) / 2;\n // https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_etc/\n case Ba:\n case za:\n return Math.floor((i + 3) / 4) * Math.floor((e + 3) / 4) * 8;\n case ka:\n return Math.floor((i + 3) / 4) * Math.floor((e + 3) / 4) * 16;\n // https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_astc/\n case Va:\n return Math.floor((i + 3) / 4) * Math.floor((e + 3) / 4) * 16;\n case Ga:\n return Math.floor((i + 4) / 5) * Math.floor((e + 3) / 4) * 16;\n case Ha:\n return Math.floor((i + 4) / 5) * Math.floor((e + 4) / 5) * 16;\n case Wa:\n return Math.floor((i + 5) / 6) * Math.floor((e + 4) / 5) * 16;\n case Xa:\n return Math.floor((i + 5) / 6) * Math.floor((e + 5) / 6) * 16;\n case ja:\n return Math.floor((i + 7) / 8) * Math.floor((e + 4) / 5) * 16;\n case qa:\n return Math.floor((i + 7) / 8) * Math.floor((e + 5) / 6) * 16;\n case Ya:\n return Math.floor((i + 7) / 8) * Math.floor((e + 7) / 8) * 16;\n case Ka:\n return Math.floor((i + 9) / 10) * Math.floor((e + 4) / 5) * 16;\n case Za:\n return Math.floor((i + 9) / 10) * Math.floor((e + 5) / 6) * 16;\n case $a:\n return Math.floor((i + 9) / 10) * Math.floor((e + 7) / 8) * 16;\n case Ja:\n return Math.floor((i + 9) / 10) * Math.floor((e + 9) / 10) * 16;\n case Qa:\n return Math.floor((i + 11) / 12) * Math.floor((e + 9) / 10) * 16;\n case eo:\n return Math.floor((i + 11) / 12) * Math.floor((e + 11) / 12) * 16;\n // https://registry.khronos.org/webgl/extensions/EXT_texture_compression_bptc/\n case to:\n case no:\n case io:\n return Math.ceil(i / 4) * Math.ceil(e / 4) * 16;\n // https://registry.khronos.org/webgl/extensions/EXT_texture_compression_rgtc/\n case so:\n case ro:\n return Math.ceil(i / 4) * Math.ceil(e / 4) * 8;\n case ao:\n case oo:\n return Math.ceil(i / 4) * Math.ceil(e / 4) * 16;\n }\n throw new Error(\n `Unable to determine texture byte length for ${t} format.`\n );\n}\nfunction Kd(i) {\n switch (i) {\n case mn:\n case Gc:\n return { byteLength: 1, components: 1 };\n case Ss:\n case Hc:\n case xt:\n return { byteLength: 2, components: 1 };\n case To:\n case Eo:\n return { byteLength: 2, components: 4 };\n case di:\n case yo:\n case Xt:\n return { byteLength: 4, components: 1 };\n case Wc:\n case Xc:\n return { byteLength: 4, components: 3 };\n }\n throw new Error(`Unknown texture type ${i}.`);\n}\ntypeof __THREE_DEVTOOLS__ < \"u\" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(\"register\", { detail: {\n revision: \"181\"\n} }));\ntypeof window < \"u\" && (window.__THREE__ ? Te(\"WARNING: Multiple instances of Three.js being imported.\") : window.__THREE__ = \"181\");\nfunction gh() {\n let i = null, e = !1, t = null, n = null;\n function s(r, a) {\n t(r, a), n = i.requestAnimationFrame(s);\n }\n return {\n start: function() {\n e !== !0 && t !== null && (n = i.requestAnimationFrame(s), e = !0);\n },\n stop: function() {\n i.cancelAnimationFrame(n), e = !1;\n },\n setAnimationLoop: function(r) {\n t = r;\n },\n setContext: function(r) {\n i = r;\n }\n };\n}\nfunction Zd(i) {\n const e = /* @__PURE__ */ new WeakMap();\n function t(o, l) {\n const c = o.array, h = o.usage, u = c.byteLength, d = i.createBuffer();\n i.bindBuffer(l, d), i.bufferData(l, c, h), o.onUploadCallback();\n let p;\n if (c instanceof Float32Array)\n p = i.FLOAT;\n else if (typeof Float16Array < \"u\" && c instanceof Float16Array)\n p = i.HALF_FLOAT;\n else if (c instanceof Uint16Array)\n o.isFloat16BufferAttribute ? p = i.HALF_FLOAT : p = i.UNSIGNED_SHORT;\n else if (c instanceof Int16Array)\n p = i.SHORT;\n else if (c instanceof Uint32Array)\n p = i.UNSIGNED_INT;\n else if (c instanceof Int32Array)\n p = i.INT;\n else if (c instanceof Int8Array)\n p = i.BYTE;\n else if (c instanceof Uint8Array)\n p = i.UNSIGNED_BYTE;\n else if (c instanceof Uint8ClampedArray)\n p = i.UNSIGNED_BYTE;\n else\n throw new Error(\"THREE.WebGLAttributes: Unsupported buffer data format: \" + c);\n return {\n buffer: d,\n type: p,\n bytesPerElement: c.BYTES_PER_ELEMENT,\n version: o.version,\n size: u\n };\n }\n function n(o, l, c) {\n const h = l.array, u = l.updateRanges;\n if (i.bindBuffer(c, o), u.length === 0)\n i.bufferSubData(c, 0, h);\n else {\n u.sort((p, g) => p.start - g.start);\n let d = 0;\n for (let p = 1; p < u.length; p++) {\n const g = u[d], x = u[p];\n x.start <= g.start + g.count + 1 ? g.count = Math.max(\n g.count,\n x.start + x.count - g.start\n ) : (++d, u[d] = x);\n }\n u.length = d + 1;\n for (let p = 0, g = u.length; p < g; p++) {\n const x = u[p];\n i.bufferSubData(\n c,\n x.start * h.BYTES_PER_ELEMENT,\n h,\n x.start,\n x.count\n );\n }\n l.clearUpdateRanges();\n }\n l.onUploadCallback();\n }\n function s(o) {\n return o.isInterleavedBufferAttribute && (o = o.data), e.get(o);\n }\n function r(o) {\n o.isInterleavedBufferAttribute && (o = o.data);\n const l = e.get(o);\n l && (i.deleteBuffer(l.buffer), e.delete(o));\n }\n function a(o, l) {\n if (o.isInterleavedBufferAttribute && (o = o.data), o.isGLBufferAttribute) {\n const h = e.get(o);\n (!h || h.version < o.version) && e.set(o, {\n buffer: o.buffer,\n type: o.type,\n bytesPerElement: o.elementSize,\n version: o.version\n });\n return;\n }\n const c = e.get(o);\n if (c === void 0)\n e.set(o, t(o, l));\n else if (c.version < o.version) {\n if (c.size !== o.array.byteLength)\n throw new Error(\"THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.\");\n n(c.buffer, o, l), c.version = o.version;\n }\n }\n return {\n get: s,\n remove: r,\n update: a\n };\n}\nvar $d = `#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif`, Jd = `#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif`, Qd = `#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif`, ef = `#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif`, tf = `#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif`, nf = `#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif`, sf = `#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif`, rf = `#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif`, af = `#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif`, of = `#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif`, lf = `vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif`, cf = `vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif`, hf = `float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated`, uf = `#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif`, df = `#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif`, ff = `#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif`, pf = `#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif`, mf = `#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif`, gf = `#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif`, xf = `#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif`, _f = `#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif`, vf = `#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif`, Mf = `#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif`, Sf = `#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated`, bf = `#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif`, yf = `vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif`, Tf = `#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif`, Ef = `#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif`, wf = `#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\t#endif\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif`, Af = `#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif`, Rf = \"gl_FragColor = linearToOutputTexel( gl_FragColor );\", Cf = `vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}`, Pf = `#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif`, Df = `#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n#endif`, Lf = `#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif`, If = `#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif`, Uf = `#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif`, Nf = `#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif`, Ff = `#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif`, Of = `#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif`, Bf = `#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif`, zf = `#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}`, kf = `#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif`, Vf = `LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;`, Gf = `varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert`, Hf = `uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif`, Wf = `#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif`, Xf = `ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;`, jf = `varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon`, qf = `BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;`, Yf = `varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong`, Kf = `PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif`, Zf = `uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 uv = vec2( roughness, dotNV );\n\treturn texture2D( dfgLUT, uv ).rg;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 dfgV = DFGApprox( vec3(0.0, 0.0, 1.0), vec3(sqrt(1.0 - dotNV * dotNV), 0.0, dotNV), material.roughness );\n\tvec2 dfgL = DFGApprox( vec3(0.0, 0.0, 1.0), vec3(sqrt(1.0 - dotNL * dotNL), 0.0, dotNL), material.roughness );\n\tvec3 FssEss_V = material.specularColor * dfgV.x + material.specularF90 * dfgV.y;\n\tvec3 FssEss_L = material.specularColor * dfgL.x + material.specularF90 * dfgL.y;\n\tfloat Ess_V = dfgV.x + dfgV.y;\n\tfloat Ess_L = dfgL.x + dfgL.y;\n\tfloat Ems_V = 1.0 - Ess_V;\n\tfloat Ems_L = 1.0 - Ess_L;\n\tvec3 Favg = material.specularColor + ( 1.0 - material.specularColor ) * 0.047619;\n\tvec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg * Favg + EPSILON );\n\tfloat compensationFactor = Ems_V * Ems_L;\n\tvec3 multiScatter = Fms * compensationFactor;\n\treturn singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}`, $f = `\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif`, Jf = `#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif`, Qf = `#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif`, ep = `#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif`, tp = `#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif`, np = `#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif`, ip = `#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif`, sp = `#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif`, rp = `#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif`, ap = `#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif`, op = `#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif`, lp = `float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif`, cp = `#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif`, hp = `#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif`, up = `#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif`, dp = `#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif`, fp = `#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif`, pp = `#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif`, mp = `float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;`, gp = `#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif`, xp = `#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif`, _p = `#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif`, vp = `#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif`, Mp = `#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif`, Sp = `#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif`, bp = `#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif`, yp = `#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif`, Tp = `#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif`, Ep = `#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );`, wp = `vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}`, Ap = `#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif`, Rp = `vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;`, Cp = `#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif`, Pp = `#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif`, Dp = `float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif`, Lp = `#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif`, Ip = `#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\tfloat depth = unpackRGBAToDepth( texture2D( depths, uv ) );\n\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\treturn step( depth, compare );\n\t\t#else\n\t\t\treturn step( compare, depth );\n\t\t#endif\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow( sampler2D shadow, vec2 uv, float compare ) {\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\tfloat hard_shadow = step( distribution.x, compare );\n\t\t#else\n\t\t\tfloat hard_shadow = step( compare, distribution.x );\n\t\t#endif\n\t\tif ( hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif`, Up = `#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif`, Np = `#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif`, Fp = `float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}`, Op = `#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif`, Bp = `#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif`, zp = `#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif`, kp = `#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif`, Vp = `float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif`, Gp = `#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif`, Hp = `#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif`, Wp = `#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }`, Xp = `#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif`, jp = `#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t#else\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif`, qp = `#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif`, Yp = `#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif`, Kp = `#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif`, Zp = `#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif`;\nconst $p = `varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}`, Jp = `uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}`, Qp = `varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}`, em = `#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}`, tm = `varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}`, nm = `uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}`, im = `#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}`, sm = `#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\tfloat fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n\t#else\n\t\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n\t#endif\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}`, rm = `#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}`, am = `#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}`, om = `varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}`, lm = `uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}`, cm = `uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}`, hm = `uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}`, um = `#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include