@elizaos/app-core 2.0.0-alpha.74 → 2.0.0-alpha.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App.d.ts.map +1 -0
- package/{dist/App.js → App.js} +3 -3
- package/{dist/components → components}/AdvancedPageView.d.ts.map +1 -1
- package/{dist/components → components}/AdvancedPageView.js +0 -10
- package/{dist/components → components}/CharacterView.d.ts.map +1 -1
- package/components/CharacterView.js +685 -0
- package/{dist/components → components}/ChatComposer.d.ts.map +1 -1
- package/{dist/components → components}/ChatComposer.js +4 -4
- package/{dist/components → components}/ChatView.d.ts.map +1 -1
- package/{dist/components → components}/ChatView.js +15 -0
- package/{dist/components → components}/CompanionView.js +1 -1
- package/{dist/components → components}/ConfigPageView.js +1 -1
- package/{dist/components → components}/ElizaCloudDashboard.js +1 -1
- package/{dist/components → components}/FlaminaGuide.js +1 -1
- package/{dist/components → components}/OnboardingWizard.d.ts.map +1 -1
- package/{dist/components → components}/OnboardingWizard.js +3 -2
- package/{dist/components → components}/PluginsView.d.ts.map +1 -1
- package/{dist/components → components}/PluginsView.js +1 -5
- package/{dist/components → components}/avatar/VrmEngine.d.ts +13 -0
- package/{dist/components → components}/avatar/VrmEngine.d.ts.map +1 -1
- package/{dist/components → components}/avatar/VrmEngine.js +66 -0
- package/{dist/components → components}/avatar/VrmViewer.d.ts +15 -0
- package/{dist/components → components}/avatar/VrmViewer.d.ts.map +1 -1
- package/{dist/components → components}/avatar/VrmViewer.js +56 -1
- package/{src/components/index.ts → components/index.d.ts} +1 -1
- package/{dist/components → components}/index.d.ts.map +1 -1
- package/{dist/components → components}/index.js +0 -1
- package/{dist/components → components}/onboarding/ConnectionStep.d.ts.map +1 -1
- package/{dist/components → components}/onboarding/ConnectionStep.js +12 -7
- package/{dist/components → components}/permissions/StreamingPermissions.d.ts.map +1 -1
- package/{dist/components → components}/permissions/StreamingPermissions.js +1 -1
- package/{dist/components → components}/ui-switch.js +4 -4
- package/{dist/i18n → i18n}/locales/en.json +45 -1
- package/{src/i18n → i18n}/locales/es.json +41 -0
- package/{dist/i18n → i18n}/locales/ko.json +41 -0
- package/{dist/i18n → i18n}/locales/pt.json +41 -0
- package/{dist/i18n → i18n}/locales/zh-CN.json +41 -0
- package/package.json +143 -53
- package/{dist/state → state}/AppContext.d.ts.map +1 -1
- package/{dist/state → state}/AppContext.js +38 -16
- package/{dist/styles → styles}/anime.css +1 -4
- package/{dist/styles → styles}/onboarding-game.css +125 -9
- package/.turbo/turbo-build.log +0 -2
- package/.turbo/turbo-lint$colon$check.log +0 -2
- package/.turbo/turbo-typecheck.log +0 -1
- package/dist/App.d.ts.map +0 -1
- package/dist/components/CharacterView.js +0 -719
- package/dist/components/MiladyBar.d.ts +0 -2
- package/dist/components/MiladyBar.d.ts.map +0 -1
- package/dist/components/MiladyBar.js +0 -50
- package/dist/components/MiladyBarSettings.d.ts +0 -2
- package/dist/components/MiladyBarSettings.d.ts.map +0 -1
- package/dist/components/MiladyBarSettings.js +0 -513
- package/dist/components/SecurityPageView.d.ts +0 -2
- package/dist/components/SecurityPageView.d.ts.map +0 -1
- package/dist/components/SecurityPageView.js +0 -81
- package/dist/components/index.d.ts +0 -97
- package/dist/components/milady-bar/CloudCreditsChip.d.ts +0 -2
- package/dist/components/milady-bar/CloudCreditsChip.d.ts.map +0 -1
- package/dist/components/milady-bar/CloudCreditsChip.js +0 -25
- package/dist/components/milady-bar/ProviderDropdown.d.ts +0 -13
- package/dist/components/milady-bar/ProviderDropdown.d.ts.map +0 -1
- package/dist/components/milady-bar/ProviderDropdown.js +0 -68
- package/dist/components/milady-bar/WalletSummary.d.ts +0 -2
- package/dist/components/milady-bar/WalletSummary.d.ts.map +0 -1
- package/dist/components/milady-bar/WalletSummary.js +0 -37
- package/dist/components/milady-bar/index.d.ts +0 -4
- package/dist/components/milady-bar/index.d.ts.map +0 -1
- package/dist/components/milady-bar/index.js +0 -3
- package/dist/hooks/useMiladyBar.d.ts +0 -2
- package/dist/hooks/useMiladyBar.d.ts.map +0 -1
- package/dist/hooks/useMiladyBar.js +0 -472
- package/dist/i18n/locales/es.json +0 -1195
- package/dist/package.json +0 -180
- package/src/App.tsx +0 -504
- package/src/actions/character.test.ts +0 -139
- package/src/actions/character.ts +0 -334
- package/src/actions/chat-helpers.ts +0 -100
- package/src/actions/cloud.ts +0 -59
- package/src/actions/index.ts +0 -12
- package/src/actions/lifecycle.ts +0 -175
- package/src/actions/onboarding.ts +0 -38
- package/src/actions/triggers.ts +0 -190
- package/src/ambient.d.ts +0 -33
- package/src/api/client.ts +0 -5659
- package/src/api/index.ts +0 -1
- package/src/autonomy/index.ts +0 -477
- package/src/bridge/capacitor-bridge.ts +0 -295
- package/src/bridge/electrobun-rpc.ts +0 -78
- package/src/bridge/electrobun-runtime.ts +0 -28
- package/src/bridge/index.ts +0 -5
- package/src/bridge/native-plugins.ts +0 -138
- package/src/bridge/plugin-bridge.ts +0 -352
- package/src/bridge/storage-bridge.ts +0 -162
- package/src/chat/index.ts +0 -250
- package/src/coding/index.ts +0 -43
- package/src/components/AdvancedPageView.tsx +0 -382
- package/src/components/AgentActivityBox.tsx +0 -49
- package/src/components/ApiKeyConfig.tsx +0 -222
- package/src/components/AppsPageView.tsx +0 -52
- package/src/components/AppsView.tsx +0 -293
- package/src/components/AvatarLoader.tsx +0 -104
- package/src/components/AvatarSelector.tsx +0 -223
- package/src/components/BscTradePanel.tsx +0 -549
- package/src/components/BugReportModal.tsx +0 -499
- package/src/components/CharacterRoster.tsx +0 -143
- package/src/components/CharacterView.tsx +0 -1575
- package/src/components/ChatAvatar.test.ts +0 -97
- package/src/components/ChatAvatar.tsx +0 -147
- package/src/components/ChatComposer.tsx +0 -330
- package/src/components/ChatMessage.tsx +0 -448
- package/src/components/ChatModalView.test.tsx +0 -118
- package/src/components/ChatModalView.tsx +0 -125
- package/src/components/ChatView.tsx +0 -992
- package/src/components/CloudOnboarding.tsx +0 -81
- package/src/components/CloudSourceControls.tsx +0 -85
- package/src/components/CodingAgentSettingsSection.tsx +0 -537
- package/src/components/CommandPalette.tsx +0 -284
- package/src/components/CompanionSceneHost.tsx +0 -517
- package/src/components/CompanionShell.tsx +0 -31
- package/src/components/CompanionView.tsx +0 -110
- package/src/components/ConfigPageView.tsx +0 -763
- package/src/components/ConfigSaveFooter.tsx +0 -41
- package/src/components/ConfirmModal.tsx +0 -379
- package/src/components/ConnectionFailedBanner.tsx +0 -91
- package/src/components/ConnectorsPageView.tsx +0 -13
- package/src/components/ConversationsSidebar.tsx +0 -279
- package/src/components/CustomActionEditor.tsx +0 -1127
- package/src/components/CustomActionsPanel.tsx +0 -288
- package/src/components/CustomActionsView.tsx +0 -325
- package/src/components/DatabasePageView.tsx +0 -55
- package/src/components/DatabaseView.tsx +0 -814
- package/src/components/ElizaCloudDashboard.tsx +0 -1696
- package/src/components/EmotePicker.tsx +0 -529
- package/src/components/ErrorBoundary.tsx +0 -76
- package/src/components/FineTuningView.tsx +0 -1080
- package/src/components/FlaminaGuide.test.tsx +0 -61
- package/src/components/FlaminaGuide.tsx +0 -212
- package/src/components/GameView.tsx +0 -551
- package/src/components/GameViewOverlay.tsx +0 -133
- package/src/components/GlobalEmoteOverlay.tsx +0 -152
- package/src/components/Header.test.tsx +0 -413
- package/src/components/Header.tsx +0 -400
- package/src/components/HeartbeatsView.tsx +0 -1003
- package/src/components/InventoryView.tsx +0 -393
- package/src/components/KnowledgeView.tsx +0 -1128
- package/src/components/LanguageDropdown.tsx +0 -192
- package/src/components/LifoMonitorPanel.tsx +0 -196
- package/src/components/LifoSandboxView.tsx +0 -499
- package/src/components/LoadingScreen.tsx +0 -112
- package/src/components/LogsPageView.tsx +0 -17
- package/src/components/LogsView.tsx +0 -239
- package/src/components/MediaGalleryView.tsx +0 -431
- package/src/components/MediaSettingsSection.tsx +0 -893
- package/src/components/MessageContent.tsx +0 -815
- package/src/components/MiladyBar.tsx +0 -103
- package/src/components/MiladyBarSettings.tsx +0 -872
- package/src/components/OnboardingWizard.test.tsx +0 -104
- package/src/components/OnboardingWizard.tsx +0 -249
- package/src/components/PairingView.tsx +0 -109
- package/src/components/PermissionsSection.tsx +0 -1184
- package/src/components/PluginsPageView.tsx +0 -9
- package/src/components/PluginsView.tsx +0 -3129
- package/src/components/ProviderSwitcher.tsx +0 -903
- package/src/components/RestartBanner.tsx +0 -76
- package/src/components/RuntimeView.tsx +0 -460
- package/src/components/SaveCommandModal.tsx +0 -211
- package/src/components/SecretsView.tsx +0 -569
- package/src/components/SecurityPageView.tsx +0 -242
- package/src/components/SettingsView.tsx +0 -825
- package/src/components/ShellOverlays.tsx +0 -41
- package/src/components/ShortcutsOverlay.tsx +0 -155
- package/src/components/SkillsView.tsx +0 -1435
- package/src/components/StartupFailureView.tsx +0 -63
- package/src/components/StreamView.tsx +0 -481
- package/src/components/StripeEmbeddedCheckout.tsx +0 -155
- package/src/components/SubscriptionStatus.tsx +0 -640
- package/src/components/SystemWarningBanner.tsx +0 -71
- package/src/components/ThemeToggle.tsx +0 -103
- package/src/components/TrajectoriesView.tsx +0 -526
- package/src/components/TrajectoryDetailView.tsx +0 -426
- package/src/components/TriggersView.tsx +0 -1
- package/src/components/VectorBrowserView.tsx +0 -1633
- package/src/components/VoiceConfigView.tsx +0 -674
- package/src/components/VrmStage.test.ts +0 -176
- package/src/components/VrmStage.tsx +0 -309
- package/src/components/WhatsAppQrOverlay.tsx +0 -230
- package/src/components/__tests__/chainConfig.test.ts +0 -220
- package/src/components/apps/AppDetailPane.tsx +0 -242
- package/src/components/apps/AppsCatalogGrid.tsx +0 -137
- package/src/components/apps/extensions/registry.ts +0 -13
- package/src/components/apps/extensions/types.ts +0 -9
- package/src/components/apps/helpers.ts +0 -43
- package/src/components/avatar/VrmAnimationLoader.test.ts +0 -164
- package/src/components/avatar/VrmAnimationLoader.ts +0 -151
- package/src/components/avatar/VrmBlinkController.ts +0 -118
- package/src/components/avatar/VrmCameraManager.ts +0 -407
- package/src/components/avatar/VrmEngine.ts +0 -2767
- package/src/components/avatar/VrmFootShadow.ts +0 -96
- package/src/components/avatar/VrmViewer.tsx +0 -421
- package/src/components/avatar/__tests__/VrmCameraManager.test.ts +0 -168
- package/src/components/avatar/__tests__/VrmEngine.test.ts +0 -1574
- package/src/components/avatar/mixamoVRMRigMap.ts +0 -62
- package/src/components/avatar/retargetMixamoFbxToVrm.ts +0 -144
- package/src/components/avatar/retargetMixamoGltfToVrm.ts +0 -119
- package/src/components/chainConfig.ts +0 -400
- package/src/components/companion/CompanionHeader.tsx +0 -50
- package/src/components/companion/CompanionSceneHost.tsx +0 -5
- package/src/components/companion/VrmStage.tsx +0 -2
- package/src/components/companion/__tests__/walletUtils.test.ts +0 -742
- package/src/components/companion/index.ts +0 -18
- package/src/components/companion/walletUtils.ts +0 -290
- package/src/components/companion-shell-styles.test.ts +0 -142
- package/src/components/companion-shell-styles.ts +0 -270
- package/src/components/confirm-delete-control.tsx +0 -69
- package/src/components/conversations/ConversationListItem.tsx +0 -185
- package/src/components/conversations/conversation-utils.ts +0 -151
- package/src/components/format.ts +0 -131
- package/src/components/inventory/CopyableAddress.tsx +0 -41
- package/src/components/inventory/InventoryToolbar.tsx +0 -142
- package/src/components/inventory/NftGrid.tsx +0 -99
- package/src/components/inventory/TokenLogo.tsx +0 -71
- package/src/components/inventory/TokensTable.tsx +0 -216
- package/src/components/inventory/constants.ts +0 -170
- package/src/components/inventory/index.ts +0 -29
- package/src/components/inventory/media-url.test.ts +0 -38
- package/src/components/inventory/media-url.ts +0 -36
- package/src/components/inventory/useInventoryData.ts +0 -460
- package/src/components/knowledge-upload-image.ts +0 -215
- package/src/components/labels.ts +0 -46
- package/src/components/milady-bar/CloudCreditsChip.tsx +0 -61
- package/src/components/milady-bar/ProviderDropdown.tsx +0 -166
- package/src/components/milady-bar/WalletSummary.tsx +0 -61
- package/src/components/milady-bar/index.ts +0 -3
- package/src/components/onboarding/ActivateStep.tsx +0 -34
- package/src/components/onboarding/ConnectionStep.tsx +0 -1590
- package/src/components/onboarding/IdentityStep.tsx +0 -251
- package/src/components/onboarding/OnboardingPanel.tsx +0 -39
- package/src/components/onboarding/OnboardingStepNav.tsx +0 -41
- package/src/components/onboarding/PermissionsStep.tsx +0 -20
- package/src/components/onboarding/RpcStep.tsx +0 -402
- package/src/components/permissions/PermissionIcon.tsx +0 -25
- package/src/components/permissions/StreamingPermissions.tsx +0 -413
- package/src/components/plugins/showcase-data.ts +0 -481
- package/src/components/shared/ShellHeaderControls.tsx +0 -198
- package/src/components/shared-companion-scene-context.ts +0 -15
- package/src/components/skeletons.tsx +0 -88
- package/src/components/stream/ActivityFeed.tsx +0 -113
- package/src/components/stream/AvatarPip.tsx +0 -10
- package/src/components/stream/ChatContent.tsx +0 -126
- package/src/components/stream/ChatTicker.tsx +0 -55
- package/src/components/stream/IdleContent.tsx +0 -73
- package/src/components/stream/StatusBar.tsx +0 -463
- package/src/components/stream/StreamSettings.tsx +0 -506
- package/src/components/stream/StreamTerminal.tsx +0 -94
- package/src/components/stream/StreamVoiceConfig.tsx +0 -160
- package/src/components/stream/helpers.ts +0 -134
- package/src/components/stream/overlays/OverlayLayer.tsx +0 -75
- package/src/components/stream/overlays/built-in/ActionTickerWidget.tsx +0 -64
- package/src/components/stream/overlays/built-in/AlertPopupWidget.tsx +0 -87
- package/src/components/stream/overlays/built-in/BrandingWidget.tsx +0 -51
- package/src/components/stream/overlays/built-in/CustomHtmlWidget.tsx +0 -105
- package/src/components/stream/overlays/built-in/PeonGlassWidget.tsx +0 -265
- package/src/components/stream/overlays/built-in/PeonHudWidget.tsx +0 -247
- package/src/components/stream/overlays/built-in/PeonSakuraWidget.tsx +0 -278
- package/src/components/stream/overlays/built-in/ThoughtBubbleWidget.tsx +0 -77
- package/src/components/stream/overlays/built-in/ViewerCountWidget.tsx +0 -46
- package/src/components/stream/overlays/built-in/index.ts +0 -13
- package/src/components/stream/overlays/registry.ts +0 -22
- package/src/components/stream/overlays/types.ts +0 -90
- package/src/components/stream/overlays/useOverlayLayout.ts +0 -218
- package/src/components/trajectory-format.ts +0 -50
- package/src/components/ui-badges.tsx +0 -109
- package/src/components/ui-switch.tsx +0 -57
- package/src/components/vector-browser-three.ts +0 -29
- package/src/config/branding.ts +0 -67
- package/src/config/config-catalog.ts +0 -1092
- package/src/config/config-field.tsx +0 -1924
- package/src/config/config-renderer.tsx +0 -734
- package/src/config/index.ts +0 -12
- package/src/config/ui-renderer.tsx +0 -1751
- package/src/config/ui-spec.ts +0 -256
- package/src/events/index.ts +0 -96
- package/src/hooks/index.ts +0 -14
- package/src/hooks/useBugReport.tsx +0 -43
- package/src/hooks/useCanvasWindow.ts +0 -372
- package/src/hooks/useChatAvatarVoice.ts +0 -111
- package/src/hooks/useClickOutside.ts +0 -31
- package/src/hooks/useContextMenu.ts +0 -127
- package/src/hooks/useKeyboardShortcuts.ts +0 -86
- package/src/hooks/useLifoSync.ts +0 -143
- package/src/hooks/useMemoryMonitor.ts +0 -334
- package/src/hooks/useMiladyBar.ts +0 -594
- package/src/hooks/useRenderGuard.ts +0 -43
- package/src/hooks/useRetakeCapture.ts +0 -68
- package/src/hooks/useStreamPopoutNavigation.ts +0 -27
- package/src/hooks/useTimeout.ts +0 -37
- package/src/hooks/useVoiceChat.ts +0 -1442
- package/src/hooks/useWhatsAppPairing.ts +0 -123
- package/src/i18n/index.ts +0 -76
- package/src/i18n/locales/en.json +0 -1195
- package/src/i18n/locales/ko.json +0 -1195
- package/src/i18n/locales/pt.json +0 -1195
- package/src/i18n/locales/zh-CN.json +0 -1195
- package/src/i18n/messages.ts +0 -21
- package/src/index.ts +0 -6
- package/src/navigation/index.ts +0 -286
- package/src/navigation.test.ts +0 -189
- package/src/onboarding-config.test.ts +0 -104
- package/src/onboarding-config.ts +0 -122
- package/src/platform/browser-launch.test.ts +0 -94
- package/src/platform/browser-launch.ts +0 -149
- package/src/platform/index.ts +0 -58
- package/src/platform/init.ts +0 -238
- package/src/platform/lifo.ts +0 -225
- package/src/providers/index.ts +0 -108
- package/src/shell-params.test.ts +0 -48
- package/src/shell-params.ts +0 -36
- package/src/state/AppContext.tsx +0 -6415
- package/src/state/index.ts +0 -6
- package/src/state/internal.ts +0 -91
- package/src/state/onboarding-resume.test.ts +0 -135
- package/src/state/onboarding-resume.ts +0 -263
- package/src/state/parsers.test.ts +0 -124
- package/src/state/parsers.ts +0 -309
- package/src/state/persistence.ts +0 -379
- package/src/state/shell-routing.ts +0 -39
- package/src/state/types.ts +0 -724
- package/src/state/ui-preferences.ts +0 -3
- package/src/state/useApp.ts +0 -23
- package/src/state/vrm.ts +0 -108
- package/src/styles/anime.css +0 -6324
- package/src/styles/base.css +0 -213
- package/src/styles/onboarding-game.css +0 -976
- package/src/styles/styles.css +0 -2087
- package/src/styles/xterm.css +0 -241
- package/src/types/index.ts +0 -715
- package/src/types/react-test-renderer.d.ts +0 -45
- package/src/utils/asset-url.ts +0 -110
- package/src/utils/assistant-text.ts +0 -172
- package/src/utils/clipboard.ts +0 -41
- package/src/utils/desktop-dialogs.ts +0 -80
- package/src/utils/eliza-globals.ts +0 -44
- package/src/utils/index.ts +0 -7
- package/src/utils/number-parsing.ts +0 -125
- package/src/utils/openExternalUrl.ts +0 -20
- package/src/utils/spoken-text.ts +0 -65
- package/src/utils/streaming-text.ts +0 -120
- package/src/voice/index.ts +0 -1
- package/src/voice/types.ts +0 -197
- package/src/wallet-rpc.ts +0 -176
- package/test/app/AppContext.pty-sessions.test.tsx +0 -143
- package/test/app/MessageContent.test.tsx +0 -366
- package/test/app/PermissionsOnboarding.test.tsx +0 -358
- package/test/app/PermissionsSection.test.tsx +0 -575
- package/test/app/advanced-trajectory-fine-tuning.e2e.test.ts +0 -396
- package/test/app/agent-activity-box.test.tsx +0 -132
- package/test/app/agent-transfer-lock.test.ts +0 -279
- package/test/app/api-client-electrobun-fallback.test.ts +0 -139
- package/test/app/api-client-electron-fallback.test.ts +0 -139
- package/test/app/api-client-timeout.test.ts +0 -75
- package/test/app/api-client-ws.test.ts +0 -98
- package/test/app/api-client.ws-max-reconnect.test.ts +0 -139
- package/test/app/api-client.ws-reconnect.test.ts +0 -157
- package/test/app/app-context-autonomy-events.test.ts +0 -559
- package/test/app/apps-page-view.test.ts +0 -114
- package/test/app/apps-view.test.ts +0 -768
- package/test/app/autonomous-workflows.e2e.test.ts +0 -765
- package/test/app/autonomy-events.test.ts +0 -150
- package/test/app/avatar-selector.test.tsx +0 -52
- package/test/app/bsc-trade-panel.test.tsx +0 -134
- package/test/app/bug-report-modal.test.tsx +0 -353
- package/test/app/character-action-bar-visibility.test.ts +0 -70
- package/test/app/character-customization.e2e.test.ts +0 -1384
- package/test/app/character-save-journey.test.ts +0 -1245
- package/test/app/chat-advanced-features.e2e.test.ts +0 -706
- package/test/app/chat-composer.test.tsx +0 -181
- package/test/app/chat-journey.test.ts +0 -1075
- package/test/app/chat-language-header.test.ts +0 -64
- package/test/app/chat-message.test.tsx +0 -222
- package/test/app/chat-modal-view.test.tsx +0 -191
- package/test/app/chat-routine-filter.test.ts +0 -96
- package/test/app/chat-send-lock.test.ts +0 -1465
- package/test/app/chat-stream-api-client.test.tsx +0 -390
- package/test/app/chat-view-game-modal.test.tsx +0 -661
- package/test/app/chat-view.test.tsx +0 -877
- package/test/app/cloud-api.e2e.test.ts +0 -258
- package/test/app/cloud-login-flow.e2e.test.ts +0 -494
- package/test/app/cloud-login-lock.test.ts +0 -416
- package/test/app/command-palette.test.tsx +0 -184
- package/test/app/command-registry.test.ts +0 -75
- package/test/app/companion-greeting-wave.test.tsx +0 -431
- package/test/app/companion-scene-host.test.tsx +0 -85
- package/test/app/companion-stale-conversation.test.tsx +0 -447
- package/test/app/companion-view.test.tsx +0 -690
- package/test/app/confirm-delete-control.test.ts +0 -79
- package/test/app/confirm-modal.test.tsx +0 -219
- package/test/app/connection-mode-persistence.test.ts +0 -411
- package/test/app/connectors-ui.e2e.test.ts +0 -508
- package/test/app/conversations-sidebar-game-modal.test.tsx +0 -265
- package/test/app/conversations-sidebar.test.tsx +0 -185
- package/test/app/custom-actions-smoke.test.ts +0 -387
- package/test/app/custom-avatar-api-client.test.ts +0 -207
- package/test/app/desktop-utils.test.ts +0 -145
- package/test/app/electrobun-rpc-bridge.test.ts +0 -83
- package/test/app/events.test.ts +0 -88
- package/test/app/export-import-flows.e2e.test.ts +0 -700
- package/test/app/fine-tuning-view.test.ts +0 -471
- package/test/app/game-view-auth-session.test.tsx +0 -187
- package/test/app/game-view.test.ts +0 -444
- package/test/app/global-emote-overlay.test.tsx +0 -106
- package/test/app/header-status.test.tsx +0 -149
- package/test/app/i18n.test.ts +0 -152
- package/test/app/inventory-bsc-view.test.ts +0 -940
- package/test/app/knowledge-ui.e2e.test.ts +0 -762
- package/test/app/knowledge-upload-helpers.test.ts +0 -124
- package/test/app/lifecycle-lock.test.ts +0 -267
- package/test/app/lifo-popout-utils.test.ts +0 -208
- package/test/app/lifo-safe-endpoint.test.ts +0 -34
- package/test/app/loading-screen.test.tsx +0 -45
- package/test/app/memory-monitor.test.ts +0 -331
- package/test/app/milady-bar-regression.test.tsx +0 -519
- package/test/app/milady-bar-settings.test.tsx +0 -1056
- package/test/app/milady-bar.test.tsx +0 -583
- package/test/app/navigation.test.tsx +0 -22
- package/test/app/onboarding-e2e-journey.test.ts +0 -1391
- package/test/app/onboarding-finish-lock.test.ts +0 -676
- package/test/app/onboarding-language.test.tsx +0 -160
- package/test/app/onboarding-steps.test.tsx +0 -376
- package/test/app/open-external-url.test.ts +0 -65
- package/test/app/pages-navigation-smoke.e2e.test.ts +0 -646
- package/test/app/pairing-lock.test.ts +0 -260
- package/test/app/pairing-view.test.tsx +0 -74
- package/test/app/permissions-section.test.ts +0 -432
- package/test/app/plugin-bridge.test.ts +0 -109
- package/test/app/plugins-ui.e2e.test.ts +0 -605
- package/test/app/plugins-view-game-modal.test.tsx +0 -686
- package/test/app/plugins-view-toggle-restart.test.ts +0 -129
- package/test/app/provider-dropdown-default.test.tsx +0 -300
- package/test/app/restart-banner.test.tsx +0 -205
- package/test/app/retake-capture.test.ts +0 -84
- package/test/app/sandbox-api-client.test.ts +0 -108
- package/test/app/save-command-modal.test.tsx +0 -109
- package/test/app/secrets-view.test.tsx +0 -92
- package/test/app/settings-control-styles.test.tsx +0 -142
- package/test/app/settings-reset.e2e.test.ts +0 -726
- package/test/app/settings-sections.e2e.test.ts +0 -614
- package/test/app/shared-format.test.ts +0 -44
- package/test/app/shared-switch.test.ts +0 -69
- package/test/app/shell-mode-switching.e2e.test.ts +0 -841
- package/test/app/shell-mode-tab-memory.test.tsx +0 -58
- package/test/app/shell-overlays.test.tsx +0 -50
- package/test/app/shortcuts-overlay.test.tsx +0 -111
- package/test/app/sse-interruption.test.ts +0 -122
- package/test/app/startup-asset-missing.e2e.test.ts +0 -126
- package/test/app/startup-backend-missing.e2e.test.ts +0 -126
- package/test/app/startup-chat.e2e.test.ts +0 -323
- package/test/app/startup-conversation-restore.test.tsx +0 -381
- package/test/app/startup-failure-view.test.tsx +0 -103
- package/test/app/startup-onboarding.e2e.test.ts +0 -712
- package/test/app/startup-timeout.test.tsx +0 -80
- package/test/app/startup-token-401.e2e.test.ts +0 -103
- package/test/app/stream-helpers.test.ts +0 -46
- package/test/app/stream-popout-navigation.test.tsx +0 -41
- package/test/app/stream-status-bar.test.tsx +0 -89
- package/test/app/theme-toggle.test.tsx +0 -40
- package/test/app/training-api-client.test.ts +0 -128
- package/test/app/trajectories-view.test.tsx +0 -220
- package/test/app/triggers-api-client.test.ts +0 -77
- package/test/app/triggers-navigation.test.ts +0 -113
- package/test/app/triggers-view.e2e.test.ts +0 -675
- package/test/app/update-channel-lock.test.ts +0 -259
- package/test/app/vector-browser.async-cleanup.test.tsx +0 -367
- package/test/app/vector-browser.e2e.test.ts +0 -653
- package/test/app/vrm-stage.test.tsx +0 -351
- package/test/app/vrm-viewer.test.tsx +0 -298
- package/test/app/wallet-api-save-lock.test.ts +0 -299
- package/test/app/wallet-hooks.test.ts +0 -405
- package/test/app/wallet-ui-flows.e2e.test.ts +0 -556
- package/test/avatar/asset-url.test.ts +0 -90
- package/test/avatar/avatar-selector.test.ts +0 -173
- package/test/avatar/mixamo-vrm-rig-map.test.ts +0 -111
- package/test/avatar/voice-chat-streaming-text.test.ts +0 -96
- package/test/avatar/voice-chat.test.ts +0 -391
- package/test/browser-extension/README.md +0 -138
- package/test/browser-extension/test-harness.ts +0 -499
- package/test/capacitor-plugins.e2e.test.ts +0 -168
- package/test/test-types.ts +0 -5
- package/test/ui/command-palette-commands.test.ts +0 -57
- package/test/ui/ui-renderer.test.ts +0 -39
- package/test/utils/assistant-text.test.ts +0 -68
- package/test/utils/eliza-globals.test.ts +0 -59
- package/test/utils/package-exports.test.ts +0 -70
- package/test/utils/streaming-text.test.ts +0 -89
- package/tsconfig.build.json +0 -19
- package/tsconfig.json +0 -20
- package/tsconfig.typecheck.json +0 -12
- /package/{dist/App.d.ts → App.d.ts} +0 -0
- /package/{dist/actions → actions}/character.d.ts +0 -0
- /package/{dist/actions → actions}/character.d.ts.map +0 -0
- /package/{dist/actions → actions}/character.js +0 -0
- /package/{dist/actions → actions}/chat-helpers.d.ts +0 -0
- /package/{dist/actions → actions}/chat-helpers.d.ts.map +0 -0
- /package/{dist/actions → actions}/chat-helpers.js +0 -0
- /package/{dist/actions → actions}/cloud.d.ts +0 -0
- /package/{dist/actions → actions}/cloud.d.ts.map +0 -0
- /package/{dist/actions → actions}/cloud.js +0 -0
- /package/{dist/actions → actions}/index.d.ts +0 -0
- /package/{dist/actions → actions}/index.d.ts.map +0 -0
- /package/{dist/actions → actions}/index.js +0 -0
- /package/{dist/actions → actions}/lifecycle.d.ts +0 -0
- /package/{dist/actions → actions}/lifecycle.d.ts.map +0 -0
- /package/{dist/actions → actions}/lifecycle.js +0 -0
- /package/{dist/actions → actions}/onboarding.d.ts +0 -0
- /package/{dist/actions → actions}/onboarding.d.ts.map +0 -0
- /package/{dist/actions → actions}/onboarding.js +0 -0
- /package/{dist/actions → actions}/triggers.d.ts +0 -0
- /package/{dist/actions → actions}/triggers.d.ts.map +0 -0
- /package/{dist/actions → actions}/triggers.js +0 -0
- /package/{dist/api → api}/client.d.ts +0 -0
- /package/{dist/api → api}/client.d.ts.map +0 -0
- /package/{dist/api → api}/client.js +0 -0
- /package/{dist/api → api}/index.d.ts +0 -0
- /package/{dist/api → api}/index.d.ts.map +0 -0
- /package/{dist/api → api}/index.js +0 -0
- /package/{dist/autonomy → autonomy}/index.d.ts +0 -0
- /package/{dist/autonomy → autonomy}/index.d.ts.map +0 -0
- /package/{dist/autonomy → autonomy}/index.js +0 -0
- /package/{dist/bridge → bridge}/capacitor-bridge.d.ts +0 -0
- /package/{dist/bridge → bridge}/capacitor-bridge.d.ts.map +0 -0
- /package/{dist/bridge → bridge}/capacitor-bridge.js +0 -0
- /package/{dist/bridge → bridge}/electrobun-rpc.d.ts +0 -0
- /package/{dist/bridge → bridge}/electrobun-rpc.d.ts.map +0 -0
- /package/{dist/bridge → bridge}/electrobun-rpc.js +0 -0
- /package/{dist/bridge → bridge}/electrobun-runtime.d.ts +0 -0
- /package/{dist/bridge → bridge}/electrobun-runtime.d.ts.map +0 -0
- /package/{dist/bridge → bridge}/electrobun-runtime.js +0 -0
- /package/{dist/bridge → bridge}/index.d.ts +0 -0
- /package/{dist/bridge → bridge}/index.d.ts.map +0 -0
- /package/{dist/bridge → bridge}/index.js +0 -0
- /package/{dist/bridge → bridge}/native-plugins.d.ts +0 -0
- /package/{dist/bridge → bridge}/native-plugins.d.ts.map +0 -0
- /package/{dist/bridge → bridge}/native-plugins.js +0 -0
- /package/{dist/bridge → bridge}/plugin-bridge.d.ts +0 -0
- /package/{dist/bridge → bridge}/plugin-bridge.d.ts.map +0 -0
- /package/{dist/bridge → bridge}/plugin-bridge.js +0 -0
- /package/{dist/bridge → bridge}/storage-bridge.d.ts +0 -0
- /package/{dist/bridge → bridge}/storage-bridge.d.ts.map +0 -0
- /package/{dist/bridge → bridge}/storage-bridge.js +0 -0
- /package/{dist/chat → chat}/index.d.ts +0 -0
- /package/{dist/chat → chat}/index.d.ts.map +0 -0
- /package/{dist/chat → chat}/index.js +0 -0
- /package/{dist/coding → coding}/index.d.ts +0 -0
- /package/{dist/coding → coding}/index.d.ts.map +0 -0
- /package/{dist/coding → coding}/index.js +0 -0
- /package/{dist/components → components}/AdvancedPageView.d.ts +0 -0
- /package/{dist/components → components}/AgentActivityBox.d.ts +0 -0
- /package/{dist/components → components}/AgentActivityBox.d.ts.map +0 -0
- /package/{dist/components → components}/AgentActivityBox.js +0 -0
- /package/{dist/components → components}/ApiKeyConfig.d.ts +0 -0
- /package/{dist/components → components}/ApiKeyConfig.d.ts.map +0 -0
- /package/{dist/components → components}/ApiKeyConfig.js +0 -0
- /package/{dist/components → components}/AppsPageView.d.ts +0 -0
- /package/{dist/components → components}/AppsPageView.d.ts.map +0 -0
- /package/{dist/components → components}/AppsPageView.js +0 -0
- /package/{dist/components → components}/AppsView.d.ts +0 -0
- /package/{dist/components → components}/AppsView.d.ts.map +0 -0
- /package/{dist/components → components}/AppsView.js +0 -0
- /package/{dist/components → components}/AvatarLoader.d.ts +0 -0
- /package/{dist/components → components}/AvatarLoader.d.ts.map +0 -0
- /package/{dist/components → components}/AvatarLoader.js +0 -0
- /package/{dist/components → components}/AvatarSelector.d.ts +0 -0
- /package/{dist/components → components}/AvatarSelector.d.ts.map +0 -0
- /package/{dist/components → components}/AvatarSelector.js +0 -0
- /package/{dist/components → components}/BscTradePanel.d.ts +0 -0
- /package/{dist/components → components}/BscTradePanel.d.ts.map +0 -0
- /package/{dist/components → components}/BscTradePanel.js +0 -0
- /package/{dist/components → components}/BugReportModal.d.ts +0 -0
- /package/{dist/components → components}/BugReportModal.d.ts.map +0 -0
- /package/{dist/components → components}/BugReportModal.js +0 -0
- /package/{dist/components → components}/CharacterRoster.d.ts +0 -0
- /package/{dist/components → components}/CharacterRoster.d.ts.map +0 -0
- /package/{dist/components → components}/CharacterRoster.js +0 -0
- /package/{dist/components → components}/CharacterView.d.ts +0 -0
- /package/{dist/components → components}/ChatAvatar.d.ts +0 -0
- /package/{dist/components → components}/ChatAvatar.d.ts.map +0 -0
- /package/{dist/components → components}/ChatAvatar.js +0 -0
- /package/{dist/components → components}/ChatComposer.d.ts +0 -0
- /package/{dist/components → components}/ChatMessage.d.ts +0 -0
- /package/{dist/components → components}/ChatMessage.d.ts.map +0 -0
- /package/{dist/components → components}/ChatMessage.js +0 -0
- /package/{dist/components → components}/ChatModalView.d.ts +0 -0
- /package/{dist/components → components}/ChatModalView.d.ts.map +0 -0
- /package/{dist/components → components}/ChatModalView.js +0 -0
- /package/{dist/components → components}/ChatView.d.ts +0 -0
- /package/{dist/components → components}/CloudOnboarding.d.ts +0 -0
- /package/{dist/components → components}/CloudOnboarding.d.ts.map +0 -0
- /package/{dist/components → components}/CloudOnboarding.js +0 -0
- /package/{dist/components → components}/CloudSourceControls.d.ts +0 -0
- /package/{dist/components → components}/CloudSourceControls.d.ts.map +0 -0
- /package/{dist/components → components}/CloudSourceControls.js +0 -0
- /package/{dist/components → components}/CodingAgentSettingsSection.d.ts +0 -0
- /package/{dist/components → components}/CodingAgentSettingsSection.d.ts.map +0 -0
- /package/{dist/components → components}/CodingAgentSettingsSection.js +0 -0
- /package/{dist/components → components}/CommandPalette.d.ts +0 -0
- /package/{dist/components → components}/CommandPalette.d.ts.map +0 -0
- /package/{dist/components → components}/CommandPalette.js +0 -0
- /package/{dist/components → components}/CompanionSceneHost.d.ts +0 -0
- /package/{dist/components → components}/CompanionSceneHost.d.ts.map +0 -0
- /package/{dist/components → components}/CompanionSceneHost.js +0 -0
- /package/{dist/components → components}/CompanionShell.d.ts +0 -0
- /package/{dist/components → components}/CompanionShell.d.ts.map +0 -0
- /package/{dist/components → components}/CompanionShell.js +0 -0
- /package/{dist/components → components}/CompanionView.d.ts +0 -0
- /package/{dist/components → components}/CompanionView.d.ts.map +0 -0
- /package/{dist/components → components}/ConfigPageView.d.ts +0 -0
- /package/{dist/components → components}/ConfigPageView.d.ts.map +0 -0
- /package/{dist/components → components}/ConfigSaveFooter.d.ts +0 -0
- /package/{dist/components → components}/ConfigSaveFooter.d.ts.map +0 -0
- /package/{dist/components → components}/ConfigSaveFooter.js +0 -0
- /package/{dist/components → components}/ConfirmModal.d.ts +0 -0
- /package/{dist/components → components}/ConfirmModal.d.ts.map +0 -0
- /package/{dist/components → components}/ConfirmModal.js +0 -0
- /package/{dist/components → components}/ConnectionFailedBanner.d.ts +0 -0
- /package/{dist/components → components}/ConnectionFailedBanner.d.ts.map +0 -0
- /package/{dist/components → components}/ConnectionFailedBanner.js +0 -0
- /package/{dist/components → components}/ConnectorsPageView.d.ts +0 -0
- /package/{dist/components → components}/ConnectorsPageView.d.ts.map +0 -0
- /package/{dist/components → components}/ConnectorsPageView.js +0 -0
- /package/{dist/components → components}/ConversationsSidebar.d.ts +0 -0
- /package/{dist/components → components}/ConversationsSidebar.d.ts.map +0 -0
- /package/{dist/components → components}/ConversationsSidebar.js +0 -0
- /package/{dist/components → components}/CustomActionEditor.d.ts +0 -0
- /package/{dist/components → components}/CustomActionEditor.d.ts.map +0 -0
- /package/{dist/components → components}/CustomActionEditor.js +0 -0
- /package/{dist/components → components}/CustomActionsPanel.d.ts +0 -0
- /package/{dist/components → components}/CustomActionsPanel.d.ts.map +0 -0
- /package/{dist/components → components}/CustomActionsPanel.js +0 -0
- /package/{dist/components → components}/CustomActionsView.d.ts +0 -0
- /package/{dist/components → components}/CustomActionsView.d.ts.map +0 -0
- /package/{dist/components → components}/CustomActionsView.js +0 -0
- /package/{dist/components → components}/DatabasePageView.d.ts +0 -0
- /package/{dist/components → components}/DatabasePageView.d.ts.map +0 -0
- /package/{dist/components → components}/DatabasePageView.js +0 -0
- /package/{dist/components → components}/DatabaseView.d.ts +0 -0
- /package/{dist/components → components}/DatabaseView.d.ts.map +0 -0
- /package/{dist/components → components}/DatabaseView.js +0 -0
- /package/{dist/components → components}/ElizaCloudDashboard.d.ts +0 -0
- /package/{dist/components → components}/ElizaCloudDashboard.d.ts.map +0 -0
- /package/{dist/components → components}/EmotePicker.d.ts +0 -0
- /package/{dist/components → components}/EmotePicker.d.ts.map +0 -0
- /package/{dist/components → components}/EmotePicker.js +0 -0
- /package/{dist/components → components}/ErrorBoundary.d.ts +0 -0
- /package/{dist/components → components}/ErrorBoundary.d.ts.map +0 -0
- /package/{dist/components → components}/ErrorBoundary.js +0 -0
- /package/{dist/components → components}/FineTuningView.d.ts +0 -0
- /package/{dist/components → components}/FineTuningView.d.ts.map +0 -0
- /package/{dist/components → components}/FineTuningView.js +0 -0
- /package/{dist/components → components}/FlaminaGuide.d.ts +0 -0
- /package/{dist/components → components}/FlaminaGuide.d.ts.map +0 -0
- /package/{dist/components → components}/GameView.d.ts +0 -0
- /package/{dist/components → components}/GameView.d.ts.map +0 -0
- /package/{dist/components → components}/GameView.js +0 -0
- /package/{dist/components → components}/GameViewOverlay.d.ts +0 -0
- /package/{dist/components → components}/GameViewOverlay.d.ts.map +0 -0
- /package/{dist/components → components}/GameViewOverlay.js +0 -0
- /package/{dist/components → components}/GlobalEmoteOverlay.d.ts +0 -0
- /package/{dist/components → components}/GlobalEmoteOverlay.d.ts.map +0 -0
- /package/{dist/components → components}/GlobalEmoteOverlay.js +0 -0
- /package/{dist/components → components}/Header.d.ts +0 -0
- /package/{dist/components → components}/Header.d.ts.map +0 -0
- /package/{dist/components → components}/Header.js +0 -0
- /package/{dist/components → components}/HeartbeatsView.d.ts +0 -0
- /package/{dist/components → components}/HeartbeatsView.d.ts.map +0 -0
- /package/{dist/components → components}/HeartbeatsView.js +0 -0
- /package/{dist/components → components}/InventoryView.d.ts +0 -0
- /package/{dist/components → components}/InventoryView.d.ts.map +0 -0
- /package/{dist/components → components}/InventoryView.js +0 -0
- /package/{dist/components → components}/KnowledgeView.d.ts +0 -0
- /package/{dist/components → components}/KnowledgeView.d.ts.map +0 -0
- /package/{dist/components → components}/KnowledgeView.js +0 -0
- /package/{dist/components → components}/LanguageDropdown.d.ts +0 -0
- /package/{dist/components → components}/LanguageDropdown.d.ts.map +0 -0
- /package/{dist/components → components}/LanguageDropdown.js +0 -0
- /package/{dist/components → components}/LifoMonitorPanel.d.ts +0 -0
- /package/{dist/components → components}/LifoMonitorPanel.d.ts.map +0 -0
- /package/{dist/components → components}/LifoMonitorPanel.js +0 -0
- /package/{dist/components → components}/LifoSandboxView.d.ts +0 -0
- /package/{dist/components → components}/LifoSandboxView.d.ts.map +0 -0
- /package/{dist/components → components}/LifoSandboxView.js +0 -0
- /package/{dist/components → components}/LoadingScreen.d.ts +0 -0
- /package/{dist/components → components}/LoadingScreen.d.ts.map +0 -0
- /package/{dist/components → components}/LoadingScreen.js +0 -0
- /package/{dist/components → components}/LogsPageView.d.ts +0 -0
- /package/{dist/components → components}/LogsPageView.d.ts.map +0 -0
- /package/{dist/components → components}/LogsPageView.js +0 -0
- /package/{dist/components → components}/LogsView.d.ts +0 -0
- /package/{dist/components → components}/LogsView.d.ts.map +0 -0
- /package/{dist/components → components}/LogsView.js +0 -0
- /package/{dist/components → components}/MediaGalleryView.d.ts +0 -0
- /package/{dist/components → components}/MediaGalleryView.d.ts.map +0 -0
- /package/{dist/components → components}/MediaGalleryView.js +0 -0
- /package/{dist/components → components}/MediaSettingsSection.d.ts +0 -0
- /package/{dist/components → components}/MediaSettingsSection.d.ts.map +0 -0
- /package/{dist/components → components}/MediaSettingsSection.js +0 -0
- /package/{dist/components → components}/MessageContent.d.ts +0 -0
- /package/{dist/components → components}/MessageContent.d.ts.map +0 -0
- /package/{dist/components → components}/MessageContent.js +0 -0
- /package/{dist/components → components}/OnboardingWizard.d.ts +0 -0
- /package/{dist/components → components}/PairingView.d.ts +0 -0
- /package/{dist/components → components}/PairingView.d.ts.map +0 -0
- /package/{dist/components → components}/PairingView.js +0 -0
- /package/{dist/components → components}/PermissionsSection.d.ts +0 -0
- /package/{dist/components → components}/PermissionsSection.d.ts.map +0 -0
- /package/{dist/components → components}/PermissionsSection.js +0 -0
- /package/{dist/components → components}/PluginsPageView.d.ts +0 -0
- /package/{dist/components → components}/PluginsPageView.d.ts.map +0 -0
- /package/{dist/components → components}/PluginsPageView.js +0 -0
- /package/{dist/components → components}/PluginsView.d.ts +0 -0
- /package/{dist/components → components}/ProviderSwitcher.d.ts +0 -0
- /package/{dist/components → components}/ProviderSwitcher.d.ts.map +0 -0
- /package/{dist/components → components}/ProviderSwitcher.js +0 -0
- /package/{dist/components → components}/RestartBanner.d.ts +0 -0
- /package/{dist/components → components}/RestartBanner.d.ts.map +0 -0
- /package/{dist/components → components}/RestartBanner.js +0 -0
- /package/{dist/components → components}/RuntimeView.d.ts +0 -0
- /package/{dist/components → components}/RuntimeView.d.ts.map +0 -0
- /package/{dist/components → components}/RuntimeView.js +0 -0
- /package/{dist/components → components}/SaveCommandModal.d.ts +0 -0
- /package/{dist/components → components}/SaveCommandModal.d.ts.map +0 -0
- /package/{dist/components → components}/SaveCommandModal.js +0 -0
- /package/{dist/components → components}/SecretsView.d.ts +0 -0
- /package/{dist/components → components}/SecretsView.d.ts.map +0 -0
- /package/{dist/components → components}/SecretsView.js +0 -0
- /package/{dist/components → components}/SettingsView.d.ts +0 -0
- /package/{dist/components → components}/SettingsView.d.ts.map +0 -0
- /package/{dist/components → components}/SettingsView.js +0 -0
- /package/{dist/components → components}/ShellOverlays.d.ts +0 -0
- /package/{dist/components → components}/ShellOverlays.d.ts.map +0 -0
- /package/{dist/components → components}/ShellOverlays.js +0 -0
- /package/{dist/components → components}/ShortcutsOverlay.d.ts +0 -0
- /package/{dist/components → components}/ShortcutsOverlay.d.ts.map +0 -0
- /package/{dist/components → components}/ShortcutsOverlay.js +0 -0
- /package/{dist/components → components}/SkillsView.d.ts +0 -0
- /package/{dist/components → components}/SkillsView.d.ts.map +0 -0
- /package/{dist/components → components}/SkillsView.js +0 -0
- /package/{dist/components → components}/StartupFailureView.d.ts +0 -0
- /package/{dist/components → components}/StartupFailureView.d.ts.map +0 -0
- /package/{dist/components → components}/StartupFailureView.js +0 -0
- /package/{dist/components → components}/StreamView.d.ts +0 -0
- /package/{dist/components → components}/StreamView.d.ts.map +0 -0
- /package/{dist/components → components}/StreamView.js +0 -0
- /package/{dist/components → components}/StripeEmbeddedCheckout.d.ts +0 -0
- /package/{dist/components → components}/StripeEmbeddedCheckout.d.ts.map +0 -0
- /package/{dist/components → components}/StripeEmbeddedCheckout.js +0 -0
- /package/{dist/components → components}/SubscriptionStatus.d.ts +0 -0
- /package/{dist/components → components}/SubscriptionStatus.d.ts.map +0 -0
- /package/{dist/components → components}/SubscriptionStatus.js +0 -0
- /package/{dist/components → components}/SystemWarningBanner.d.ts +0 -0
- /package/{dist/components → components}/SystemWarningBanner.d.ts.map +0 -0
- /package/{dist/components → components}/SystemWarningBanner.js +0 -0
- /package/{dist/components → components}/ThemeToggle.d.ts +0 -0
- /package/{dist/components → components}/ThemeToggle.d.ts.map +0 -0
- /package/{dist/components → components}/ThemeToggle.js +0 -0
- /package/{dist/components → components}/TrajectoriesView.d.ts +0 -0
- /package/{dist/components → components}/TrajectoriesView.d.ts.map +0 -0
- /package/{dist/components → components}/TrajectoriesView.js +0 -0
- /package/{dist/components → components}/TrajectoryDetailView.d.ts +0 -0
- /package/{dist/components → components}/TrajectoryDetailView.d.ts.map +0 -0
- /package/{dist/components → components}/TrajectoryDetailView.js +0 -0
- /package/{dist/components → components}/TriggersView.d.ts +0 -0
- /package/{dist/components → components}/TriggersView.d.ts.map +0 -0
- /package/{dist/components → components}/TriggersView.js +0 -0
- /package/{dist/components → components}/VectorBrowserView.d.ts +0 -0
- /package/{dist/components → components}/VectorBrowserView.d.ts.map +0 -0
- /package/{dist/components → components}/VectorBrowserView.js +0 -0
- /package/{dist/components → components}/VoiceConfigView.d.ts +0 -0
- /package/{dist/components → components}/VoiceConfigView.d.ts.map +0 -0
- /package/{dist/components → components}/VoiceConfigView.js +0 -0
- /package/{dist/components → components}/VrmStage.d.ts +0 -0
- /package/{dist/components → components}/VrmStage.d.ts.map +0 -0
- /package/{dist/components → components}/VrmStage.js +0 -0
- /package/{dist/components → components}/WhatsAppQrOverlay.d.ts +0 -0
- /package/{dist/components → components}/WhatsAppQrOverlay.d.ts.map +0 -0
- /package/{dist/components → components}/WhatsAppQrOverlay.js +0 -0
- /package/{dist/components → components}/apps/AppDetailPane.d.ts +0 -0
- /package/{dist/components → components}/apps/AppDetailPane.d.ts.map +0 -0
- /package/{dist/components → components}/apps/AppDetailPane.js +0 -0
- /package/{dist/components → components}/apps/AppsCatalogGrid.d.ts +0 -0
- /package/{dist/components → components}/apps/AppsCatalogGrid.d.ts.map +0 -0
- /package/{dist/components → components}/apps/AppsCatalogGrid.js +0 -0
- /package/{dist/components → components}/apps/extensions/registry.d.ts +0 -0
- /package/{dist/components → components}/apps/extensions/registry.d.ts.map +0 -0
- /package/{dist/components → components}/apps/extensions/registry.js +0 -0
- /package/{dist/components → components}/apps/extensions/types.d.ts +0 -0
- /package/{dist/components → components}/apps/extensions/types.d.ts.map +0 -0
- /package/{dist/components → components}/apps/extensions/types.js +0 -0
- /package/{dist/components → components}/apps/helpers.d.ts +0 -0
- /package/{dist/components → components}/apps/helpers.d.ts.map +0 -0
- /package/{dist/components → components}/apps/helpers.js +0 -0
- /package/{dist/components → components}/avatar/VrmAnimationLoader.d.ts +0 -0
- /package/{dist/components → components}/avatar/VrmAnimationLoader.d.ts.map +0 -0
- /package/{dist/components → components}/avatar/VrmAnimationLoader.js +0 -0
- /package/{dist/components → components}/avatar/VrmBlinkController.d.ts +0 -0
- /package/{dist/components → components}/avatar/VrmBlinkController.d.ts.map +0 -0
- /package/{dist/components → components}/avatar/VrmBlinkController.js +0 -0
- /package/{dist/components → components}/avatar/VrmCameraManager.d.ts +0 -0
- /package/{dist/components → components}/avatar/VrmCameraManager.d.ts.map +0 -0
- /package/{dist/components → components}/avatar/VrmCameraManager.js +0 -0
- /package/{dist/components → components}/avatar/VrmFootShadow.d.ts +0 -0
- /package/{dist/components → components}/avatar/VrmFootShadow.d.ts.map +0 -0
- /package/{dist/components → components}/avatar/VrmFootShadow.js +0 -0
- /package/{dist/components → components}/avatar/mixamoVRMRigMap.d.ts +0 -0
- /package/{dist/components → components}/avatar/mixamoVRMRigMap.d.ts.map +0 -0
- /package/{dist/components → components}/avatar/mixamoVRMRigMap.js +0 -0
- /package/{dist/components → components}/avatar/retargetMixamoFbxToVrm.d.ts +0 -0
- /package/{dist/components → components}/avatar/retargetMixamoFbxToVrm.d.ts.map +0 -0
- /package/{dist/components → components}/avatar/retargetMixamoFbxToVrm.js +0 -0
- /package/{dist/components → components}/avatar/retargetMixamoGltfToVrm.d.ts +0 -0
- /package/{dist/components → components}/avatar/retargetMixamoGltfToVrm.d.ts.map +0 -0
- /package/{dist/components → components}/avatar/retargetMixamoGltfToVrm.js +0 -0
- /package/{dist/components → components}/chainConfig.d.ts +0 -0
- /package/{dist/components → components}/chainConfig.d.ts.map +0 -0
- /package/{dist/components → components}/chainConfig.js +0 -0
- /package/{dist/components → components}/companion/CompanionHeader.d.ts +0 -0
- /package/{dist/components → components}/companion/CompanionHeader.d.ts.map +0 -0
- /package/{dist/components → components}/companion/CompanionHeader.js +0 -0
- /package/{dist/components → components}/companion/CompanionSceneHost.d.ts +0 -0
- /package/{dist/components → components}/companion/CompanionSceneHost.d.ts.map +0 -0
- /package/{dist/components → components}/companion/CompanionSceneHost.js +0 -0
- /package/{dist/components → components}/companion/VrmStage.d.ts +0 -0
- /package/{dist/components → components}/companion/VrmStage.d.ts.map +0 -0
- /package/{dist/components → components}/companion/VrmStage.js +0 -0
- /package/{dist/components → components}/companion/index.d.ts +0 -0
- /package/{dist/components → components}/companion/index.d.ts.map +0 -0
- /package/{dist/components → components}/companion/index.js +0 -0
- /package/{dist/components → components}/companion/walletUtils.d.ts +0 -0
- /package/{dist/components → components}/companion/walletUtils.d.ts.map +0 -0
- /package/{dist/components → components}/companion/walletUtils.js +0 -0
- /package/{dist/components → components}/companion-shell-styles.d.ts +0 -0
- /package/{dist/components → components}/companion-shell-styles.d.ts.map +0 -0
- /package/{dist/components → components}/companion-shell-styles.js +0 -0
- /package/{dist/components → components}/confirm-delete-control.d.ts +0 -0
- /package/{dist/components → components}/confirm-delete-control.d.ts.map +0 -0
- /package/{dist/components → components}/confirm-delete-control.js +0 -0
- /package/{dist/components → components}/conversations/ConversationListItem.d.ts +0 -0
- /package/{dist/components → components}/conversations/ConversationListItem.d.ts.map +0 -0
- /package/{dist/components → components}/conversations/ConversationListItem.js +0 -0
- /package/{dist/components → components}/conversations/conversation-utils.d.ts +0 -0
- /package/{dist/components → components}/conversations/conversation-utils.d.ts.map +0 -0
- /package/{dist/components → components}/conversations/conversation-utils.js +0 -0
- /package/{dist/components → components}/format.d.ts +0 -0
- /package/{dist/components → components}/format.d.ts.map +0 -0
- /package/{dist/components → components}/format.js +0 -0
- /package/{dist/components → components}/inventory/CopyableAddress.d.ts +0 -0
- /package/{dist/components → components}/inventory/CopyableAddress.d.ts.map +0 -0
- /package/{dist/components → components}/inventory/CopyableAddress.js +0 -0
- /package/{dist/components → components}/inventory/InventoryToolbar.d.ts +0 -0
- /package/{dist/components → components}/inventory/InventoryToolbar.d.ts.map +0 -0
- /package/{dist/components → components}/inventory/InventoryToolbar.js +0 -0
- /package/{dist/components → components}/inventory/NftGrid.d.ts +0 -0
- /package/{dist/components → components}/inventory/NftGrid.d.ts.map +0 -0
- /package/{dist/components → components}/inventory/NftGrid.js +0 -0
- /package/{dist/components → components}/inventory/TokenLogo.d.ts +0 -0
- /package/{dist/components → components}/inventory/TokenLogo.d.ts.map +0 -0
- /package/{dist/components → components}/inventory/TokenLogo.js +0 -0
- /package/{dist/components → components}/inventory/TokensTable.d.ts +0 -0
- /package/{dist/components → components}/inventory/TokensTable.d.ts.map +0 -0
- /package/{dist/components → components}/inventory/TokensTable.js +0 -0
- /package/{dist/components → components}/inventory/constants.d.ts +0 -0
- /package/{dist/components → components}/inventory/constants.d.ts.map +0 -0
- /package/{dist/components → components}/inventory/constants.js +0 -0
- /package/{dist/components → components}/inventory/index.d.ts +0 -0
- /package/{dist/components → components}/inventory/index.d.ts.map +0 -0
- /package/{dist/components → components}/inventory/index.js +0 -0
- /package/{dist/components → components}/inventory/media-url.d.ts +0 -0
- /package/{dist/components → components}/inventory/media-url.d.ts.map +0 -0
- /package/{dist/components → components}/inventory/media-url.js +0 -0
- /package/{dist/components → components}/inventory/useInventoryData.d.ts +0 -0
- /package/{dist/components → components}/inventory/useInventoryData.d.ts.map +0 -0
- /package/{dist/components → components}/inventory/useInventoryData.js +0 -0
- /package/{dist/components → components}/knowledge-upload-image.d.ts +0 -0
- /package/{dist/components → components}/knowledge-upload-image.d.ts.map +0 -0
- /package/{dist/components → components}/knowledge-upload-image.js +0 -0
- /package/{dist/components → components}/labels.d.ts +0 -0
- /package/{dist/components → components}/labels.d.ts.map +0 -0
- /package/{dist/components → components}/labels.js +0 -0
- /package/{dist/components → components}/onboarding/ActivateStep.d.ts +0 -0
- /package/{dist/components → components}/onboarding/ActivateStep.d.ts.map +0 -0
- /package/{dist/components → components}/onboarding/ActivateStep.js +0 -0
- /package/{dist/components → components}/onboarding/ConnectionStep.d.ts +0 -0
- /package/{dist/components → components}/onboarding/IdentityStep.d.ts +0 -0
- /package/{dist/components → components}/onboarding/IdentityStep.d.ts.map +0 -0
- /package/{dist/components → components}/onboarding/IdentityStep.js +0 -0
- /package/{dist/components → components}/onboarding/OnboardingPanel.d.ts +0 -0
- /package/{dist/components → components}/onboarding/OnboardingPanel.d.ts.map +0 -0
- /package/{dist/components → components}/onboarding/OnboardingPanel.js +0 -0
- /package/{dist/components → components}/onboarding/OnboardingStepNav.d.ts +0 -0
- /package/{dist/components → components}/onboarding/OnboardingStepNav.d.ts.map +0 -0
- /package/{dist/components → components}/onboarding/OnboardingStepNav.js +0 -0
- /package/{dist/components → components}/onboarding/PermissionsStep.d.ts +0 -0
- /package/{dist/components → components}/onboarding/PermissionsStep.d.ts.map +0 -0
- /package/{dist/components → components}/onboarding/PermissionsStep.js +0 -0
- /package/{dist/components → components}/onboarding/RpcStep.d.ts +0 -0
- /package/{dist/components → components}/onboarding/RpcStep.d.ts.map +0 -0
- /package/{dist/components → components}/onboarding/RpcStep.js +0 -0
- /package/{dist/components → components}/permissions/PermissionIcon.d.ts +0 -0
- /package/{dist/components → components}/permissions/PermissionIcon.d.ts.map +0 -0
- /package/{dist/components → components}/permissions/PermissionIcon.js +0 -0
- /package/{dist/components → components}/permissions/StreamingPermissions.d.ts +0 -0
- /package/{dist/components → components}/plugins/showcase-data.d.ts +0 -0
- /package/{dist/components → components}/plugins/showcase-data.d.ts.map +0 -0
- /package/{dist/components → components}/plugins/showcase-data.js +0 -0
- /package/{dist/components → components}/shared/ShellHeaderControls.d.ts +0 -0
- /package/{dist/components → components}/shared/ShellHeaderControls.d.ts.map +0 -0
- /package/{dist/components → components}/shared/ShellHeaderControls.js +0 -0
- /package/{dist/components → components}/shared-companion-scene-context.d.ts +0 -0
- /package/{dist/components → components}/shared-companion-scene-context.d.ts.map +0 -0
- /package/{dist/components → components}/shared-companion-scene-context.js +0 -0
- /package/{dist/components → components}/skeletons.d.ts +0 -0
- /package/{dist/components → components}/skeletons.d.ts.map +0 -0
- /package/{dist/components → components}/skeletons.js +0 -0
- /package/{dist/components → components}/stream/ActivityFeed.d.ts +0 -0
- /package/{dist/components → components}/stream/ActivityFeed.d.ts.map +0 -0
- /package/{dist/components → components}/stream/ActivityFeed.js +0 -0
- /package/{dist/components → components}/stream/AvatarPip.d.ts +0 -0
- /package/{dist/components → components}/stream/AvatarPip.d.ts.map +0 -0
- /package/{dist/components → components}/stream/AvatarPip.js +0 -0
- /package/{dist/components → components}/stream/ChatContent.d.ts +0 -0
- /package/{dist/components → components}/stream/ChatContent.d.ts.map +0 -0
- /package/{dist/components → components}/stream/ChatContent.js +0 -0
- /package/{dist/components → components}/stream/ChatTicker.d.ts +0 -0
- /package/{dist/components → components}/stream/ChatTicker.d.ts.map +0 -0
- /package/{dist/components → components}/stream/ChatTicker.js +0 -0
- /package/{dist/components → components}/stream/IdleContent.d.ts +0 -0
- /package/{dist/components → components}/stream/IdleContent.d.ts.map +0 -0
- /package/{dist/components → components}/stream/IdleContent.js +0 -0
- /package/{dist/components → components}/stream/StatusBar.d.ts +0 -0
- /package/{dist/components → components}/stream/StatusBar.d.ts.map +0 -0
- /package/{dist/components → components}/stream/StatusBar.js +0 -0
- /package/{dist/components → components}/stream/StreamSettings.d.ts +0 -0
- /package/{dist/components → components}/stream/StreamSettings.d.ts.map +0 -0
- /package/{dist/components → components}/stream/StreamSettings.js +0 -0
- /package/{dist/components → components}/stream/StreamTerminal.d.ts +0 -0
- /package/{dist/components → components}/stream/StreamTerminal.d.ts.map +0 -0
- /package/{dist/components → components}/stream/StreamTerminal.js +0 -0
- /package/{dist/components → components}/stream/StreamVoiceConfig.d.ts +0 -0
- /package/{dist/components → components}/stream/StreamVoiceConfig.d.ts.map +0 -0
- /package/{dist/components → components}/stream/StreamVoiceConfig.js +0 -0
- /package/{dist/components → components}/stream/helpers.d.ts +0 -0
- /package/{dist/components → components}/stream/helpers.d.ts.map +0 -0
- /package/{dist/components → components}/stream/helpers.js +0 -0
- /package/{dist/components → components}/stream/overlays/OverlayLayer.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/OverlayLayer.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/OverlayLayer.js +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/ActionTickerWidget.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/ActionTickerWidget.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/ActionTickerWidget.js +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/AlertPopupWidget.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/AlertPopupWidget.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/AlertPopupWidget.js +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/BrandingWidget.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/BrandingWidget.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/BrandingWidget.js +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/CustomHtmlWidget.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/CustomHtmlWidget.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/CustomHtmlWidget.js +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/PeonGlassWidget.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/PeonGlassWidget.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/PeonGlassWidget.js +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/PeonHudWidget.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/PeonHudWidget.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/PeonHudWidget.js +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/PeonSakuraWidget.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/PeonSakuraWidget.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/PeonSakuraWidget.js +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/ThoughtBubbleWidget.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/ThoughtBubbleWidget.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/ThoughtBubbleWidget.js +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/ViewerCountWidget.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/ViewerCountWidget.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/ViewerCountWidget.js +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/index.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/index.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/index.js +0 -0
- /package/{dist/components → components}/stream/overlays/registry.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/registry.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/registry.js +0 -0
- /package/{dist/components → components}/stream/overlays/types.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/types.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/types.js +0 -0
- /package/{dist/components → components}/stream/overlays/useOverlayLayout.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/useOverlayLayout.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/useOverlayLayout.js +0 -0
- /package/{dist/components → components}/trajectory-format.d.ts +0 -0
- /package/{dist/components → components}/trajectory-format.d.ts.map +0 -0
- /package/{dist/components → components}/trajectory-format.js +0 -0
- /package/{dist/components → components}/ui-badges.d.ts +0 -0
- /package/{dist/components → components}/ui-badges.d.ts.map +0 -0
- /package/{dist/components → components}/ui-badges.js +0 -0
- /package/{dist/components → components}/ui-switch.d.ts +0 -0
- /package/{dist/components → components}/ui-switch.d.ts.map +0 -0
- /package/{dist/components → components}/vector-browser-three.d.ts +0 -0
- /package/{dist/components → components}/vector-browser-three.d.ts.map +0 -0
- /package/{dist/components → components}/vector-browser-three.js +0 -0
- /package/{dist/config → config}/branding.d.ts +0 -0
- /package/{dist/config → config}/branding.d.ts.map +0 -0
- /package/{dist/config → config}/branding.js +0 -0
- /package/{dist/config → config}/config-catalog.d.ts +0 -0
- /package/{dist/config → config}/config-catalog.d.ts.map +0 -0
- /package/{dist/config → config}/config-catalog.js +0 -0
- /package/{dist/config → config}/config-field.d.ts +0 -0
- /package/{dist/config → config}/config-field.d.ts.map +0 -0
- /package/{dist/config → config}/config-field.js +0 -0
- /package/{dist/config → config}/config-renderer.d.ts +0 -0
- /package/{dist/config → config}/config-renderer.d.ts.map +0 -0
- /package/{dist/config → config}/config-renderer.js +0 -0
- /package/{dist/config → config}/index.d.ts +0 -0
- /package/{dist/config → config}/index.d.ts.map +0 -0
- /package/{dist/config → config}/index.js +0 -0
- /package/{dist/config → config}/ui-renderer.d.ts +0 -0
- /package/{dist/config → config}/ui-renderer.d.ts.map +0 -0
- /package/{dist/config → config}/ui-renderer.js +0 -0
- /package/{dist/config → config}/ui-spec.d.ts +0 -0
- /package/{dist/config → config}/ui-spec.d.ts.map +0 -0
- /package/{dist/config → config}/ui-spec.js +0 -0
- /package/{dist/events → events}/index.d.ts +0 -0
- /package/{dist/events → events}/index.d.ts.map +0 -0
- /package/{dist/events → events}/index.js +0 -0
- /package/{dist/hooks → hooks}/index.d.ts +0 -0
- /package/{dist/hooks → hooks}/index.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/index.js +0 -0
- /package/{dist/hooks → hooks}/useBugReport.d.ts +0 -0
- /package/{dist/hooks → hooks}/useBugReport.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useBugReport.js +0 -0
- /package/{dist/hooks → hooks}/useCanvasWindow.d.ts +0 -0
- /package/{dist/hooks → hooks}/useCanvasWindow.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useCanvasWindow.js +0 -0
- /package/{dist/hooks → hooks}/useChatAvatarVoice.d.ts +0 -0
- /package/{dist/hooks → hooks}/useChatAvatarVoice.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useChatAvatarVoice.js +0 -0
- /package/{dist/hooks → hooks}/useClickOutside.d.ts +0 -0
- /package/{dist/hooks → hooks}/useClickOutside.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useClickOutside.js +0 -0
- /package/{dist/hooks → hooks}/useContextMenu.d.ts +0 -0
- /package/{dist/hooks → hooks}/useContextMenu.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useContextMenu.js +0 -0
- /package/{dist/hooks → hooks}/useKeyboardShortcuts.d.ts +0 -0
- /package/{dist/hooks → hooks}/useKeyboardShortcuts.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useKeyboardShortcuts.js +0 -0
- /package/{dist/hooks → hooks}/useLifoSync.d.ts +0 -0
- /package/{dist/hooks → hooks}/useLifoSync.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useLifoSync.js +0 -0
- /package/{dist/hooks → hooks}/useMemoryMonitor.d.ts +0 -0
- /package/{dist/hooks → hooks}/useMemoryMonitor.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useMemoryMonitor.js +0 -0
- /package/{dist/hooks → hooks}/useRenderGuard.d.ts +0 -0
- /package/{dist/hooks → hooks}/useRenderGuard.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useRenderGuard.js +0 -0
- /package/{dist/hooks → hooks}/useRetakeCapture.d.ts +0 -0
- /package/{dist/hooks → hooks}/useRetakeCapture.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useRetakeCapture.js +0 -0
- /package/{dist/hooks → hooks}/useStreamPopoutNavigation.d.ts +0 -0
- /package/{dist/hooks → hooks}/useStreamPopoutNavigation.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useStreamPopoutNavigation.js +0 -0
- /package/{dist/hooks → hooks}/useTimeout.d.ts +0 -0
- /package/{dist/hooks → hooks}/useTimeout.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useTimeout.js +0 -0
- /package/{dist/hooks → hooks}/useVoiceChat.d.ts +0 -0
- /package/{dist/hooks → hooks}/useVoiceChat.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useVoiceChat.js +0 -0
- /package/{dist/hooks → hooks}/useWhatsAppPairing.d.ts +0 -0
- /package/{dist/hooks → hooks}/useWhatsAppPairing.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useWhatsAppPairing.js +0 -0
- /package/{dist/i18n → i18n}/index.d.ts +0 -0
- /package/{dist/i18n → i18n}/index.d.ts.map +0 -0
- /package/{dist/i18n → i18n}/index.js +0 -0
- /package/{dist/i18n → i18n}/messages.d.ts +0 -0
- /package/{dist/i18n → i18n}/messages.d.ts.map +0 -0
- /package/{dist/i18n → i18n}/messages.js +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
- /package/{dist/index.d.ts.map → index.d.ts.map} +0 -0
- /package/{dist/index.js → index.js} +0 -0
- /package/{dist/navigation → navigation}/index.d.ts +0 -0
- /package/{dist/navigation → navigation}/index.d.ts.map +0 -0
- /package/{dist/navigation → navigation}/index.js +0 -0
- /package/{dist/onboarding-config.d.ts → onboarding-config.d.ts} +0 -0
- /package/{dist/onboarding-config.d.ts.map → onboarding-config.d.ts.map} +0 -0
- /package/{dist/onboarding-config.js → onboarding-config.js} +0 -0
- /package/{dist/platform → platform}/browser-launch.d.ts +0 -0
- /package/{dist/platform → platform}/browser-launch.d.ts.map +0 -0
- /package/{dist/platform → platform}/browser-launch.js +0 -0
- /package/{dist/platform → platform}/index.d.ts +0 -0
- /package/{dist/platform → platform}/index.d.ts.map +0 -0
- /package/{dist/platform → platform}/index.js +0 -0
- /package/{dist/platform → platform}/init.d.ts +0 -0
- /package/{dist/platform → platform}/init.d.ts.map +0 -0
- /package/{dist/platform → platform}/init.js +0 -0
- /package/{dist/platform → platform}/lifo.d.ts +0 -0
- /package/{dist/platform → platform}/lifo.d.ts.map +0 -0
- /package/{dist/platform → platform}/lifo.js +0 -0
- /package/{dist/providers → providers}/index.d.ts +0 -0
- /package/{dist/providers → providers}/index.d.ts.map +0 -0
- /package/{dist/providers → providers}/index.js +0 -0
- /package/{dist/shell-params.d.ts → shell-params.d.ts} +0 -0
- /package/{dist/shell-params.d.ts.map → shell-params.d.ts.map} +0 -0
- /package/{dist/shell-params.js → shell-params.js} +0 -0
- /package/{dist/state → state}/AppContext.d.ts +0 -0
- /package/{dist/state → state}/index.d.ts +0 -0
- /package/{dist/state → state}/index.d.ts.map +0 -0
- /package/{dist/state → state}/index.js +0 -0
- /package/{dist/state → state}/internal.d.ts +0 -0
- /package/{dist/state → state}/internal.d.ts.map +0 -0
- /package/{dist/state → state}/internal.js +0 -0
- /package/{dist/state → state}/onboarding-resume.d.ts +0 -0
- /package/{dist/state → state}/onboarding-resume.d.ts.map +0 -0
- /package/{dist/state → state}/onboarding-resume.js +0 -0
- /package/{dist/state → state}/parsers.d.ts +0 -0
- /package/{dist/state → state}/parsers.d.ts.map +0 -0
- /package/{dist/state → state}/parsers.js +0 -0
- /package/{dist/state → state}/persistence.d.ts +0 -0
- /package/{dist/state → state}/persistence.d.ts.map +0 -0
- /package/{dist/state → state}/persistence.js +0 -0
- /package/{dist/state → state}/shell-routing.d.ts +0 -0
- /package/{dist/state → state}/shell-routing.d.ts.map +0 -0
- /package/{dist/state → state}/shell-routing.js +0 -0
- /package/{dist/state → state}/types.d.ts +0 -0
- /package/{dist/state → state}/types.d.ts.map +0 -0
- /package/{dist/state → state}/types.js +0 -0
- /package/{dist/state → state}/ui-preferences.d.ts +0 -0
- /package/{dist/state → state}/ui-preferences.d.ts.map +0 -0
- /package/{dist/state → state}/ui-preferences.js +0 -0
- /package/{dist/state → state}/useApp.d.ts +0 -0
- /package/{dist/state → state}/useApp.d.ts.map +0 -0
- /package/{dist/state → state}/useApp.js +0 -0
- /package/{dist/state → state}/vrm.d.ts +0 -0
- /package/{dist/state → state}/vrm.d.ts.map +0 -0
- /package/{dist/state → state}/vrm.js +0 -0
- /package/{dist/styles → styles}/base.css +0 -0
- /package/{dist/styles → styles}/styles.css +0 -0
- /package/{dist/styles → styles}/xterm.css +0 -0
- /package/{dist/types → types}/index.d.ts +0 -0
- /package/{dist/types → types}/index.d.ts.map +0 -0
- /package/{dist/types → types}/index.js +0 -0
- /package/{dist/utils → utils}/asset-url.d.ts +0 -0
- /package/{dist/utils → utils}/asset-url.d.ts.map +0 -0
- /package/{dist/utils → utils}/asset-url.js +0 -0
- /package/{dist/utils → utils}/assistant-text.d.ts +0 -0
- /package/{dist/utils → utils}/assistant-text.d.ts.map +0 -0
- /package/{dist/utils → utils}/assistant-text.js +0 -0
- /package/{dist/utils → utils}/clipboard.d.ts +0 -0
- /package/{dist/utils → utils}/clipboard.d.ts.map +0 -0
- /package/{dist/utils → utils}/clipboard.js +0 -0
- /package/{dist/utils → utils}/desktop-dialogs.d.ts +0 -0
- /package/{dist/utils → utils}/desktop-dialogs.d.ts.map +0 -0
- /package/{dist/utils → utils}/desktop-dialogs.js +0 -0
- /package/{dist/utils → utils}/eliza-globals.d.ts +0 -0
- /package/{dist/utils → utils}/eliza-globals.d.ts.map +0 -0
- /package/{dist/utils → utils}/eliza-globals.js +0 -0
- /package/{dist/utils → utils}/index.d.ts +0 -0
- /package/{dist/utils → utils}/index.d.ts.map +0 -0
- /package/{dist/utils → utils}/index.js +0 -0
- /package/{dist/utils → utils}/number-parsing.d.ts +0 -0
- /package/{dist/utils → utils}/number-parsing.d.ts.map +0 -0
- /package/{dist/utils → utils}/number-parsing.js +0 -0
- /package/{dist/utils → utils}/openExternalUrl.d.ts +0 -0
- /package/{dist/utils → utils}/openExternalUrl.d.ts.map +0 -0
- /package/{dist/utils → utils}/openExternalUrl.js +0 -0
- /package/{dist/utils → utils}/spoken-text.d.ts +0 -0
- /package/{dist/utils → utils}/spoken-text.d.ts.map +0 -0
- /package/{dist/utils → utils}/spoken-text.js +0 -0
- /package/{dist/utils → utils}/streaming-text.d.ts +0 -0
- /package/{dist/utils → utils}/streaming-text.d.ts.map +0 -0
- /package/{dist/utils → utils}/streaming-text.js +0 -0
- /package/{dist/voice → voice}/index.d.ts +0 -0
- /package/{dist/voice → voice}/index.d.ts.map +0 -0
- /package/{dist/voice → voice}/index.js +0 -0
- /package/{dist/voice → voice}/types.d.ts +0 -0
- /package/{dist/voice → voice}/types.d.ts.map +0 -0
- /package/{dist/voice → voice}/types.js +0 -0
- /package/{dist/wallet-rpc.d.ts → wallet-rpc.d.ts} +0 -0
- /package/{dist/wallet-rpc.d.ts.map → wallet-rpc.d.ts.map} +0 -0
- /package/{dist/wallet-rpc.js → wallet-rpc.js} +0 -0
|
@@ -1,2767 +0,0 @@
|
|
|
1
|
-
import { resolveAppAssetUrl } from "@elizaos/app-core/utils";
|
|
2
|
-
import {
|
|
3
|
-
MToonMaterialLoaderPlugin,
|
|
4
|
-
type VRM,
|
|
5
|
-
VRMLoaderPlugin,
|
|
6
|
-
VRMUtils,
|
|
7
|
-
} from "@pixiv/three-vrm";
|
|
8
|
-
import type {
|
|
9
|
-
SparkRenderer as SparkRendererType,
|
|
10
|
-
SplatMesh as SparkSplatMesh,
|
|
11
|
-
} from "@sparkjsdev/spark";
|
|
12
|
-
import * as THREE from "three";
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* TSL node for MeshStandardMaterial - not in public @types/three.
|
|
16
|
-
* Used for emissiveNode/opacityNode in NodeMaterial (three/tsl).
|
|
17
|
-
*/
|
|
18
|
-
interface TslMaterialNode {
|
|
19
|
-
mul?(v: unknown): unknown;
|
|
20
|
-
add?(v: unknown): unknown;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/** Three.js NodeMaterial exposes emissiveNode/opacityNode but they are not in public MeshStandardMaterial types. */
|
|
24
|
-
interface MeshStandardMaterialWithNodeProps {
|
|
25
|
-
emissiveNode?: TslMaterialNode | null;
|
|
26
|
-
opacityNode?: TslMaterialNode | null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js";
|
|
30
|
-
import { MeshoptDecoder } from "three/examples/jsm/libs/meshopt_decoder.module.js";
|
|
31
|
-
import { DRACOLoader } from "three/examples/jsm/loaders/DRACOLoader.js";
|
|
32
|
-
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
33
|
-
import {
|
|
34
|
-
type AnimationLoaderContext,
|
|
35
|
-
loadEmoteClip,
|
|
36
|
-
loadIdleClip,
|
|
37
|
-
} from "./VrmAnimationLoader";
|
|
38
|
-
import { VrmBlinkController } from "./VrmBlinkController";
|
|
39
|
-
import {
|
|
40
|
-
type CameraAnimationConfig,
|
|
41
|
-
type CameraProfile,
|
|
42
|
-
type InteractionMode,
|
|
43
|
-
VrmCameraManager,
|
|
44
|
-
} from "./VrmCameraManager";
|
|
45
|
-
|
|
46
|
-
export type { CameraAnimationConfig, CameraProfile, InteractionMode };
|
|
47
|
-
|
|
48
|
-
export type VrmEngineState = {
|
|
49
|
-
vrmLoaded: boolean;
|
|
50
|
-
vrmName: string | null;
|
|
51
|
-
loadError: string | null;
|
|
52
|
-
idlePlaying: boolean;
|
|
53
|
-
idleTime: number;
|
|
54
|
-
idleTracks: number;
|
|
55
|
-
revealStarted: boolean;
|
|
56
|
-
loadingProgress?: number;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
type DebugVector3 = {
|
|
60
|
-
x: number;
|
|
61
|
-
y: number;
|
|
62
|
-
z: number;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
type DebugBounds = {
|
|
66
|
-
min: DebugVector3;
|
|
67
|
-
max: DebugVector3;
|
|
68
|
-
center: DebugVector3;
|
|
69
|
-
size: DebugVector3;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export type VrmEngineDebugInfo = {
|
|
73
|
-
initialized: boolean;
|
|
74
|
-
rendererBackend: RendererBackend;
|
|
75
|
-
cameraProfile: CameraProfile;
|
|
76
|
-
worldUrl: string | null;
|
|
77
|
-
sceneChildren: string[];
|
|
78
|
-
camera: {
|
|
79
|
-
parentName: string | null;
|
|
80
|
-
position: DebugVector3 | null;
|
|
81
|
-
rotation: DebugVector3 | null;
|
|
82
|
-
fov: number | null;
|
|
83
|
-
lookAtTarget: DebugVector3;
|
|
84
|
-
};
|
|
85
|
-
avatar: {
|
|
86
|
-
loaded: boolean;
|
|
87
|
-
ready: boolean;
|
|
88
|
-
parentName: string | null;
|
|
89
|
-
position: DebugVector3 | null;
|
|
90
|
-
scale: DebugVector3 | null;
|
|
91
|
-
bounds: DebugBounds | null;
|
|
92
|
-
};
|
|
93
|
-
world: {
|
|
94
|
-
loaded: boolean;
|
|
95
|
-
parentName: string | null;
|
|
96
|
-
position: DebugVector3 | null;
|
|
97
|
-
scale: DebugVector3 | null;
|
|
98
|
-
bounds: DebugBounds | null;
|
|
99
|
-
rawBounds: DebugBounds | null;
|
|
100
|
-
};
|
|
101
|
-
spark: {
|
|
102
|
-
attached: boolean;
|
|
103
|
-
parentName: string | null;
|
|
104
|
-
renderOrder: number | null;
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
type UpdateCallback = () => void;
|
|
109
|
-
type RendererBackend = "webgl" | "webgpu";
|
|
110
|
-
type RendererPreference = "auto" | "webgl";
|
|
111
|
-
type AnimationMixerFinishedEvent = {
|
|
112
|
-
type: "finished";
|
|
113
|
-
action: THREE.AnimationAction;
|
|
114
|
-
direction: number;
|
|
115
|
-
};
|
|
116
|
-
type ElectrobunRuntimeWindow = Window & {
|
|
117
|
-
__electrobunWindowId?: number;
|
|
118
|
-
__electrobunWebviewId?: number;
|
|
119
|
-
};
|
|
120
|
-
type RendererLike = Pick<
|
|
121
|
-
THREE.WebGLRenderer,
|
|
122
|
-
| "dispose"
|
|
123
|
-
| "domElement"
|
|
124
|
-
| "render"
|
|
125
|
-
| "setClearColor"
|
|
126
|
-
| "setPixelRatio"
|
|
127
|
-
| "setSize"
|
|
128
|
-
> & {
|
|
129
|
-
forceContextLoss?: () => void;
|
|
130
|
-
outputColorSpace?: string;
|
|
131
|
-
shadowMap?: {
|
|
132
|
-
enabled: boolean;
|
|
133
|
-
type: THREE.ShadowMapType;
|
|
134
|
-
};
|
|
135
|
-
toneMapping?: THREE.ToneMapping;
|
|
136
|
-
toneMappingExposure?: number;
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
type TeleportFallbackShader = {
|
|
140
|
-
uniforms: {
|
|
141
|
-
uTeleportProgress: { value: number };
|
|
142
|
-
};
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
type WorldRevealController = {
|
|
146
|
-
mesh: SparkSplatMesh;
|
|
147
|
-
progressUniform: { value: number };
|
|
148
|
-
mode: "reveal" | "hide";
|
|
149
|
-
radius: number;
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
type WorldRevealState = {
|
|
153
|
-
controller: WorldRevealController;
|
|
154
|
-
incoming: WorldRevealController;
|
|
155
|
-
outgoing: WorldRevealController | null;
|
|
156
|
-
progress: number;
|
|
157
|
-
duration: number;
|
|
158
|
-
waitingForVrm: boolean;
|
|
159
|
-
syncToTeleport: boolean;
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
type TeleportSparkleParticle = {
|
|
163
|
-
sprite: THREE.Sprite;
|
|
164
|
-
material: THREE.SpriteMaterial;
|
|
165
|
-
baseAngle: number;
|
|
166
|
-
baseRadius: number;
|
|
167
|
-
height: number;
|
|
168
|
-
start: number;
|
|
169
|
-
duration: number;
|
|
170
|
-
spin: number;
|
|
171
|
-
wobble: number;
|
|
172
|
-
wobbleSpeed: number;
|
|
173
|
-
baseSize: number;
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
type TeleportSparkleSystem = {
|
|
177
|
-
group: THREE.Group;
|
|
178
|
-
particles: TeleportSparkleParticle[];
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
const DEFAULT_CAMERA_ANIMATION: CameraAnimationConfig = {
|
|
182
|
-
enabled: false,
|
|
183
|
-
swayAmplitude: 0.06,
|
|
184
|
-
bobAmplitude: 0.03,
|
|
185
|
-
rotationAmplitude: 0.01,
|
|
186
|
-
speed: 0.8,
|
|
187
|
-
};
|
|
188
|
-
const CAMERA_PROFILE_TRANSITION_DURATION_SECONDS = 0.8;
|
|
189
|
-
const AVATAR_SWITCH_CAMERA_TRANSITION_DURATION_SECONDS = 3;
|
|
190
|
-
const COMPANION_WORLD_SCALE = 2.5;
|
|
191
|
-
const COMPANION_DARK_WORLD_FLOOR_OFFSET_Y = -0.95;
|
|
192
|
-
const COMPANION_LIGHT_WORLD_FLOOR_OFFSET_Y = -0.35;
|
|
193
|
-
const COMPANION_WORLD_REVEAL_DURATION = 5.4;
|
|
194
|
-
const COMPANION_WORLD_REVEAL_EDGE = 0.28;
|
|
195
|
-
const COMPANION_WORLD_REVEAL_EASE_EXPONENT = 2;
|
|
196
|
-
const COMPANION_WORLD_REVEAL_START_OFFSET = 0.7;
|
|
197
|
-
const TELEPORT_DISSOLVE_START_Y = -1.2;
|
|
198
|
-
const TELEPORT_DISSOLVE_END_Y = 1.0;
|
|
199
|
-
const TELEPORT_SPARKLE_PARTICLE_COUNT = 28;
|
|
200
|
-
const TELEPORT_SPARKLE_RING_RADIUS = 0.52;
|
|
201
|
-
const TELEPORT_SPARKLE_MIN_SIZE = 0.055;
|
|
202
|
-
const TELEPORT_SPARKLE_MAX_SIZE = 0.13;
|
|
203
|
-
const COMPANION_DOF_APERTURE_SIZE = 0.028;
|
|
204
|
-
const COMPANION_DOF_NEAR_ZOOM_APERTURE_FACTOR = 0.4;
|
|
205
|
-
const COMPANION_ZOOM_NEAR_FACTOR = 0.25;
|
|
206
|
-
const COMPANION_ZOOM_MIN_RADIUS = 1.2;
|
|
207
|
-
const SPARK_CLIP_XY = 1.08;
|
|
208
|
-
const SPARK_MAX_STD_DEV = 2.35;
|
|
209
|
-
const SPARK_MAX_STD_DEV_NEAR = 1.9;
|
|
210
|
-
const SPARK_MIN_ALPHA = 0.0016;
|
|
211
|
-
const SPARK_MIN_ALPHA_NEAR = 0.0024;
|
|
212
|
-
const SPARK_SORT_DISTANCE = 0.035;
|
|
213
|
-
const SPARK_SORT_DISTANCE_NEAR = 0.05;
|
|
214
|
-
const SPARK_MAX_PIXEL_RADIUS = 96;
|
|
215
|
-
const SPARK_MAX_PIXEL_RADIUS_NEAR = 28;
|
|
216
|
-
const MAX_RENDERER_PIXEL_RATIO = 2;
|
|
217
|
-
const AVATAR_RENDERER_OVERRIDE_KEY = "eliza.avatarRenderer";
|
|
218
|
-
const KNOWN_VRM_WEBGPU_WARNING =
|
|
219
|
-
'TSL: "transformedNormalView" is deprecated. Use "normalView" instead.';
|
|
220
|
-
|
|
221
|
-
let knownVrmWebGpuWarningFilterRefs = 0;
|
|
222
|
-
let releaseKnownVrmWebGpuWarningFilterGlobal: (() => void) | null = null;
|
|
223
|
-
let sharedDracoLoader: DRACOLoader | null = null;
|
|
224
|
-
let teleportSparkleTexture: THREE.CanvasTexture | null = null;
|
|
225
|
-
const DRACO_DECODER_PATH = resolveAppAssetUrl("vrm-decoders/draco/");
|
|
226
|
-
|
|
227
|
-
function getRendererPixelRatio(sparkOptimized = false): number {
|
|
228
|
-
if (typeof window === "undefined") return 1;
|
|
229
|
-
if (sparkOptimized) return 1;
|
|
230
|
-
return Math.min(
|
|
231
|
-
Math.max(window.devicePixelRatio || 1, 1),
|
|
232
|
-
MAX_RENDERER_PIXEL_RATIO,
|
|
233
|
-
);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
function isElectrobunAvatarRuntime(): boolean {
|
|
237
|
-
if (typeof window === "undefined") return false;
|
|
238
|
-
const runtimeWindow = window as ElectrobunRuntimeWindow;
|
|
239
|
-
return (
|
|
240
|
-
typeof runtimeWindow.__electrobunWindowId === "number" ||
|
|
241
|
-
typeof runtimeWindow.__electrobunWebviewId === "number"
|
|
242
|
-
);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
function getPreferredAvatarRendererBackend(): RendererBackend {
|
|
246
|
-
if (typeof window === "undefined") return "webgl";
|
|
247
|
-
const override = (() => {
|
|
248
|
-
try {
|
|
249
|
-
return window.localStorage.getItem(AVATAR_RENDERER_OVERRIDE_KEY);
|
|
250
|
-
} catch {
|
|
251
|
-
return null;
|
|
252
|
-
}
|
|
253
|
-
})();
|
|
254
|
-
const normalizedOverride = override?.trim().toLowerCase();
|
|
255
|
-
if (normalizedOverride === "webgpu" || normalizedOverride === "webgl") {
|
|
256
|
-
return normalizedOverride;
|
|
257
|
-
}
|
|
258
|
-
return isElectrobunAvatarRuntime() ? "webgpu" : "webgl";
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
function installKnownVrmWebGpuWarningFilter(): () => void {
|
|
262
|
-
knownVrmWebGpuWarningFilterRefs += 1;
|
|
263
|
-
|
|
264
|
-
if (!releaseKnownVrmWebGpuWarningFilterGlobal) {
|
|
265
|
-
const originalWarn = console.warn.bind(console);
|
|
266
|
-
console.warn = (...args: Parameters<typeof console.warn>) => {
|
|
267
|
-
if (
|
|
268
|
-
typeof args[0] === "string" &&
|
|
269
|
-
args[0].includes(KNOWN_VRM_WEBGPU_WARNING)
|
|
270
|
-
) {
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
originalWarn(...args);
|
|
274
|
-
};
|
|
275
|
-
releaseKnownVrmWebGpuWarningFilterGlobal = () => {
|
|
276
|
-
knownVrmWebGpuWarningFilterRefs = Math.max(
|
|
277
|
-
0,
|
|
278
|
-
knownVrmWebGpuWarningFilterRefs - 1,
|
|
279
|
-
);
|
|
280
|
-
if (knownVrmWebGpuWarningFilterRefs === 0) {
|
|
281
|
-
console.warn = originalWarn;
|
|
282
|
-
releaseKnownVrmWebGpuWarningFilterGlobal = null;
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
return () => {
|
|
288
|
-
releaseKnownVrmWebGpuWarningFilterGlobal?.();
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
function getSharedDracoLoader(): DRACOLoader {
|
|
293
|
-
if (!sharedDracoLoader) {
|
|
294
|
-
sharedDracoLoader = new DRACOLoader();
|
|
295
|
-
sharedDracoLoader.setDecoderConfig({ type: "wasm" });
|
|
296
|
-
sharedDracoLoader.setDecoderPath(DRACO_DECODER_PATH);
|
|
297
|
-
sharedDracoLoader.preload();
|
|
298
|
-
}
|
|
299
|
-
return sharedDracoLoader;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
function configureVrmGltfLoader(loader: GLTFLoader): void {
|
|
303
|
-
loader.setMeshoptDecoder(MeshoptDecoder);
|
|
304
|
-
loader.setDRACOLoader(getSharedDracoLoader());
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
function getTeleportSparkleTexture(): THREE.CanvasTexture {
|
|
308
|
-
if (teleportSparkleTexture) return teleportSparkleTexture;
|
|
309
|
-
const canvas = document.createElement("canvas");
|
|
310
|
-
canvas.width = 128;
|
|
311
|
-
canvas.height = 128;
|
|
312
|
-
const context = canvas.getContext("2d");
|
|
313
|
-
if (!context) {
|
|
314
|
-
teleportSparkleTexture = new THREE.CanvasTexture(canvas);
|
|
315
|
-
return teleportSparkleTexture;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
const gradient = context.createRadialGradient(64, 64, 6, 64, 64, 64);
|
|
319
|
-
gradient.addColorStop(0.0, "rgba(255,255,255,1)");
|
|
320
|
-
gradient.addColorStop(0.2, "rgba(190,245,255,0.95)");
|
|
321
|
-
gradient.addColorStop(0.55, "rgba(112,214,255,0.48)");
|
|
322
|
-
gradient.addColorStop(1.0, "rgba(112,214,255,0)");
|
|
323
|
-
context.fillStyle = gradient;
|
|
324
|
-
context.fillRect(0, 0, 128, 128);
|
|
325
|
-
|
|
326
|
-
teleportSparkleTexture = new THREE.CanvasTexture(canvas);
|
|
327
|
-
teleportSparkleTexture.needsUpdate = true;
|
|
328
|
-
return teleportSparkleTexture;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
function quantileSorted(values: number[], percentile: number): number {
|
|
332
|
-
if (values.length === 0) return 0;
|
|
333
|
-
const index = Math.min(
|
|
334
|
-
values.length - 1,
|
|
335
|
-
Math.max(0, Math.floor((values.length - 1) * percentile)),
|
|
336
|
-
);
|
|
337
|
-
return values[index] ?? 0;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
function getRobustPackedSplatAnchor(splatSource: {
|
|
341
|
-
numSplats?: number;
|
|
342
|
-
forEachSplat: SparkSplatMesh["forEachSplat"];
|
|
343
|
-
}): THREE.Vector3 {
|
|
344
|
-
const maxSamples = 4096;
|
|
345
|
-
const xSamples: number[] = [];
|
|
346
|
-
const ySamples: number[] = [];
|
|
347
|
-
const zSamples: number[] = [];
|
|
348
|
-
const splatCount = splatSource.numSplats ?? maxSamples;
|
|
349
|
-
const sampleStep =
|
|
350
|
-
splatCount > maxSamples
|
|
351
|
-
? Math.max(1, Math.floor(splatCount / maxSamples))
|
|
352
|
-
: 1;
|
|
353
|
-
|
|
354
|
-
splatSource.forEachSplat((index, center) => {
|
|
355
|
-
if (sampleStep > 1 && index % sampleStep !== 0) return;
|
|
356
|
-
xSamples.push(center.x);
|
|
357
|
-
ySamples.push(center.y);
|
|
358
|
-
zSamples.push(center.z);
|
|
359
|
-
});
|
|
360
|
-
|
|
361
|
-
if (xSamples.length === 0) {
|
|
362
|
-
return new THREE.Vector3(0, 0, 0);
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
xSamples.sort((a, b) => a - b);
|
|
366
|
-
ySamples.sort((a, b) => a - b);
|
|
367
|
-
zSamples.sort((a, b) => a - b);
|
|
368
|
-
|
|
369
|
-
return new THREE.Vector3(
|
|
370
|
-
quantileSorted(xSamples, 0.5),
|
|
371
|
-
quantileSorted(ySamples, 0.05),
|
|
372
|
-
quantileSorted(zSamples, 0.5),
|
|
373
|
-
);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
/** SparkSplatMesh may have packedSplats; types not fully exported from @sparkjsdev/spark. */
|
|
377
|
-
interface SparkSplatWithPacked {
|
|
378
|
-
packedSplats?: { numSplats?: number };
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
function getRobustSplatAnchor(splat: SparkSplatMesh): THREE.Vector3 {
|
|
382
|
-
return getRobustPackedSplatAnchor({
|
|
383
|
-
numSplats: (splat as SparkSplatWithPacked).packedSplats?.numSplats,
|
|
384
|
-
forEachSplat: splat.forEachSplat.bind(splat),
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
function getRobustPackedSplatRadialExtent(
|
|
389
|
-
splatSource: {
|
|
390
|
-
numSplats?: number;
|
|
391
|
-
forEachSplat: SparkSplatMesh["forEachSplat"];
|
|
392
|
-
},
|
|
393
|
-
anchor: THREE.Vector3,
|
|
394
|
-
): number {
|
|
395
|
-
const maxSamples = 4096;
|
|
396
|
-
const radialSamples: number[] = [];
|
|
397
|
-
const splatCount = splatSource.numSplats ?? maxSamples;
|
|
398
|
-
const sampleStep =
|
|
399
|
-
splatCount > maxSamples
|
|
400
|
-
? Math.max(1, Math.floor(splatCount / maxSamples))
|
|
401
|
-
: 1;
|
|
402
|
-
|
|
403
|
-
splatSource.forEachSplat((index, center) => {
|
|
404
|
-
if (sampleStep > 1 && index % sampleStep !== 0) return;
|
|
405
|
-
radialSamples.push(Math.hypot(center.x - anchor.x, center.z - anchor.z));
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
if (radialSamples.length === 0) {
|
|
409
|
-
return 1;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
radialSamples.sort((a, b) => a - b);
|
|
413
|
-
return Math.max(1, quantileSorted(radialSamples, 0.985));
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
function getRobustSplatRadialExtent(
|
|
417
|
-
splat: SparkSplatMesh,
|
|
418
|
-
anchor: THREE.Vector3,
|
|
419
|
-
): number {
|
|
420
|
-
return getRobustPackedSplatRadialExtent(
|
|
421
|
-
{
|
|
422
|
-
numSplats: (splat as SparkSplatWithPacked).packedSplats?.numSplats,
|
|
423
|
-
forEachSplat: splat.forEachSplat.bind(splat),
|
|
424
|
-
},
|
|
425
|
-
anchor,
|
|
426
|
-
);
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
function getCompanionWorldFloorOffsetY(url: string): number {
|
|
430
|
-
const normalizedUrl = url.toLowerCase();
|
|
431
|
-
return normalizedUrl.includes("night") ||
|
|
432
|
-
normalizedUrl.includes("dark") ||
|
|
433
|
-
normalizedUrl.includes("lunarpunk")
|
|
434
|
-
? COMPANION_DARK_WORLD_FLOOR_OFFSET_Y
|
|
435
|
-
: COMPANION_LIGHT_WORLD_FLOOR_OFFSET_Y;
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
function isGzipBuffer(buffer: ArrayBuffer): boolean {
|
|
439
|
-
if (buffer.byteLength < 2) return false;
|
|
440
|
-
const bytes = new Uint8Array(buffer, 0, 2);
|
|
441
|
-
return bytes[0] === 0x1f && bytes[1] === 0x8b;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
async function decompressGzipBuffer(buffer: ArrayBuffer): Promise<ArrayBuffer> {
|
|
445
|
-
if (typeof DecompressionStream !== "function") {
|
|
446
|
-
throw new Error(
|
|
447
|
-
"This runtime does not support gzip-compressed VRM assets.",
|
|
448
|
-
);
|
|
449
|
-
}
|
|
450
|
-
const stream = new Blob([buffer])
|
|
451
|
-
.stream()
|
|
452
|
-
.pipeThrough(new DecompressionStream("gzip"));
|
|
453
|
-
return await new Response(stream).arrayBuffer();
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
async function loadGltfAsset(
|
|
457
|
-
loader: GLTFLoader,
|
|
458
|
-
url: string,
|
|
459
|
-
onProgress?: (progress: number) => void,
|
|
460
|
-
): Promise<Awaited<ReturnType<GLTFLoader["loadAsync"]>>> {
|
|
461
|
-
const response = await fetch(url);
|
|
462
|
-
if (!response.ok) {
|
|
463
|
-
throw new Error(`Failed to fetch VRM asset: ${response.status}`);
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
const contentLength = Number(response.headers.get("content-length") || 0);
|
|
467
|
-
|
|
468
|
-
let buffer: ArrayBuffer;
|
|
469
|
-
if (!contentLength || !response.body || !onProgress) {
|
|
470
|
-
buffer = await response.arrayBuffer();
|
|
471
|
-
onProgress?.(1);
|
|
472
|
-
} else {
|
|
473
|
-
const reader = response.body.getReader();
|
|
474
|
-
let received = 0;
|
|
475
|
-
const chunks: Uint8Array[] = [];
|
|
476
|
-
for (;;) {
|
|
477
|
-
const { done, value } = await reader.read();
|
|
478
|
-
if (done) break;
|
|
479
|
-
if (value) {
|
|
480
|
-
chunks.push(value);
|
|
481
|
-
received += value.length;
|
|
482
|
-
onProgress(Math.min(received / contentLength, 1));
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
const combined = new Uint8Array(received);
|
|
486
|
-
let offset = 0;
|
|
487
|
-
for (const chunk of chunks) {
|
|
488
|
-
combined.set(chunk, offset);
|
|
489
|
-
offset += chunk.length;
|
|
490
|
-
}
|
|
491
|
-
buffer = combined.buffer;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
if (!isGzipBuffer(buffer)) {
|
|
495
|
-
const objectUrl = URL.createObjectURL(
|
|
496
|
-
new Blob([buffer], { type: "model/gltf-binary" }),
|
|
497
|
-
);
|
|
498
|
-
try {
|
|
499
|
-
return await loader.loadAsync(objectUrl);
|
|
500
|
-
} finally {
|
|
501
|
-
URL.revokeObjectURL(objectUrl);
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
buffer = await decompressGzipBuffer(buffer);
|
|
506
|
-
const objectUrl = URL.createObjectURL(
|
|
507
|
-
new Blob([buffer], { type: "model/gltf-binary" }),
|
|
508
|
-
);
|
|
509
|
-
try {
|
|
510
|
-
return await loader.loadAsync(objectUrl);
|
|
511
|
-
} finally {
|
|
512
|
-
URL.revokeObjectURL(objectUrl);
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
/**
|
|
517
|
-
* Create the best available renderer for the current platform.
|
|
518
|
-
* Electrobun's CEF desktop shell expects WebGPU for the avatar stage, while the
|
|
519
|
-
* browser dev shell stays on WebGL by default to avoid upstream TSL noise.
|
|
520
|
-
* A localStorage override can force either backend for debugging.
|
|
521
|
-
* THREE.WebGPURenderer is async-init and requires await renderer.init().
|
|
522
|
-
*/
|
|
523
|
-
async function createRenderer(
|
|
524
|
-
canvas: HTMLCanvasElement,
|
|
525
|
-
preference: RendererPreference = "auto",
|
|
526
|
-
sparkOptimized = false,
|
|
527
|
-
): Promise<{ backend: RendererBackend; renderer: RendererLike }> {
|
|
528
|
-
if (
|
|
529
|
-
preference !== "webgl" &&
|
|
530
|
-
getPreferredAvatarRendererBackend() === "webgpu" &&
|
|
531
|
-
typeof navigator !== "undefined" &&
|
|
532
|
-
navigator.gpu
|
|
533
|
-
) {
|
|
534
|
-
try {
|
|
535
|
-
const { WebGPURenderer } = await import("three/webgpu");
|
|
536
|
-
const renderer = new WebGPURenderer({
|
|
537
|
-
canvas,
|
|
538
|
-
alpha: true,
|
|
539
|
-
antialias: !sparkOptimized,
|
|
540
|
-
}) as RendererLike & { init?: () => Promise<unknown> };
|
|
541
|
-
await renderer.init?.();
|
|
542
|
-
console.info("[VrmEngine] Using WebGPURenderer");
|
|
543
|
-
return { backend: "webgpu", renderer };
|
|
544
|
-
} catch (err) {
|
|
545
|
-
console.warn(
|
|
546
|
-
"[VrmEngine] WebGPURenderer failed, falling back to WebGL:",
|
|
547
|
-
err,
|
|
548
|
-
);
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
const renderer = new THREE.WebGLRenderer({
|
|
552
|
-
canvas,
|
|
553
|
-
alpha: true,
|
|
554
|
-
antialias: !sparkOptimized,
|
|
555
|
-
powerPreference: sparkOptimized ? "high-performance" : "default",
|
|
556
|
-
}) as RendererLike;
|
|
557
|
-
console.info("[VrmEngine] Using WebGLRenderer");
|
|
558
|
-
return { backend: "webgl", renderer };
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
export class VrmEngine {
|
|
562
|
-
private static sparkModulePromise: Promise<
|
|
563
|
-
typeof import("@sparkjsdev/spark")
|
|
564
|
-
> | null = null;
|
|
565
|
-
private renderer: RendererLike | null = null;
|
|
566
|
-
private rendererBackend: RendererBackend = "webgl";
|
|
567
|
-
private rendererPreference: RendererPreference = "auto";
|
|
568
|
-
private scene: THREE.Scene | null = null;
|
|
569
|
-
private avatarRoot: THREE.Group | null = null;
|
|
570
|
-
private camera: THREE.PerspectiveCamera | null = null;
|
|
571
|
-
private clock = new THREE.Clock();
|
|
572
|
-
private vrm: VRM | null = null;
|
|
573
|
-
private mixer: THREE.AnimationMixer | null = null;
|
|
574
|
-
private idleAction: THREE.AnimationAction | null = null;
|
|
575
|
-
private idleLoadPromise: Promise<THREE.AnimationAction | null> | null = null;
|
|
576
|
-
private animationFrameId: number | null = null;
|
|
577
|
-
private onUpdate: UpdateCallback | null = null;
|
|
578
|
-
private initialized = false;
|
|
579
|
-
private loadingAborted = false;
|
|
580
|
-
private vrmLoadRequestId = 0;
|
|
581
|
-
private vrmReady = false;
|
|
582
|
-
private lastLoadError: string | null = null;
|
|
583
|
-
private teleportProgress = 1.0;
|
|
584
|
-
private loadingProgress = 0;
|
|
585
|
-
private teleportProgressUniform: { value: number } | null = null;
|
|
586
|
-
private teleportDissolvedMaterials: THREE.Material[] = [];
|
|
587
|
-
private teleportFallbackShaders: TeleportFallbackShader[] = [];
|
|
588
|
-
private teleportSparkles: TeleportSparkleSystem | null = null;
|
|
589
|
-
private revealStarted = false;
|
|
590
|
-
private mouthValue = 0;
|
|
591
|
-
private mouthSmoothed = 0;
|
|
592
|
-
private vrmName: string | null = null;
|
|
593
|
-
private lookAtTarget = new THREE.Vector3(0, 0.5, 0);
|
|
594
|
-
private readonly idleGlbUrl = resolveAppAssetUrl("animations/idle.glb.gz");
|
|
595
|
-
private cameraAnimation: CameraAnimationConfig = {
|
|
596
|
-
...DEFAULT_CAMERA_ANIMATION,
|
|
597
|
-
};
|
|
598
|
-
private baseCameraPosition = new THREE.Vector3();
|
|
599
|
-
private elapsedTime = 0;
|
|
600
|
-
private speaking = false;
|
|
601
|
-
private speakingStartTime = 0;
|
|
602
|
-
private readonly blinkController = new VrmBlinkController();
|
|
603
|
-
private readonly cameraManager = new VrmCameraManager();
|
|
604
|
-
private emoteAction: THREE.AnimationAction | null = null;
|
|
605
|
-
private emoteTimeout: ReturnType<typeof setTimeout> | null = null;
|
|
606
|
-
private emoteCompletionCleanup: (() => void) | null = null;
|
|
607
|
-
private emoteClipCache = new Map<string, THREE.AnimationClip>();
|
|
608
|
-
private emoteRequestId = 0;
|
|
609
|
-
private controls: OrbitControls | null = null;
|
|
610
|
-
private paused = false;
|
|
611
|
-
private interactionEnabled = false;
|
|
612
|
-
private interactionMode: InteractionMode = "free";
|
|
613
|
-
private cameraProfile: CameraProfile = "chat";
|
|
614
|
-
private worldUrl: string | null = null;
|
|
615
|
-
private worldMesh: SparkSplatMesh | null = null;
|
|
616
|
-
private worldReveal: WorldRevealState | null = null;
|
|
617
|
-
private sparkRenderer: SparkRendererType | null = null;
|
|
618
|
-
private worldLoadRequestId = 0;
|
|
619
|
-
private pointerParallaxEnabled = false;
|
|
620
|
-
private pointerParallaxTarget = new THREE.Vector2();
|
|
621
|
-
private pointerParallaxCurrent = new THREE.Vector2();
|
|
622
|
-
private pointerParallaxPosition = new THREE.Vector3();
|
|
623
|
-
private pointerParallaxLookAt = new THREE.Vector3();
|
|
624
|
-
private dragOrbitTarget = new THREE.Vector2();
|
|
625
|
-
private dragOrbitCurrent = new THREE.Vector2();
|
|
626
|
-
private companionZoomTarget = 0;
|
|
627
|
-
private companionZoomCurrent = 0;
|
|
628
|
-
private avatarLookTarget: THREE.Group | null = null;
|
|
629
|
-
private headLookTarget = new THREE.Vector2();
|
|
630
|
-
private headLookCurrent = new THREE.Vector2();
|
|
631
|
-
|
|
632
|
-
private clearEmoteTimeout(): void {
|
|
633
|
-
if (this.emoteTimeout !== null) {
|
|
634
|
-
clearTimeout(this.emoteTimeout);
|
|
635
|
-
this.emoteTimeout = null;
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
private clearEmoteCompletionCleanup(): void {
|
|
640
|
-
this.emoteCompletionCleanup?.();
|
|
641
|
-
this.emoteCompletionCleanup = null;
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
private clearPendingEmoteCompletion(): void {
|
|
645
|
-
this.clearEmoteTimeout();
|
|
646
|
-
this.clearEmoteCompletionCleanup();
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
private watchOneShotEmoteCompletion(
|
|
650
|
-
mixer: THREE.AnimationMixer,
|
|
651
|
-
action: THREE.AnimationAction,
|
|
652
|
-
requestId: number,
|
|
653
|
-
fallbackDurationSeconds: number,
|
|
654
|
-
): void {
|
|
655
|
-
const handleFinished = (event: AnimationMixerFinishedEvent): void => {
|
|
656
|
-
if (event.action !== action) return;
|
|
657
|
-
if (this.emoteRequestId !== requestId || this.emoteAction !== action) {
|
|
658
|
-
return;
|
|
659
|
-
}
|
|
660
|
-
this.stopEmote();
|
|
661
|
-
};
|
|
662
|
-
|
|
663
|
-
mixer.addEventListener("finished", handleFinished);
|
|
664
|
-
this.emoteCompletionCleanup = () => {
|
|
665
|
-
mixer.removeEventListener("finished", handleFinished);
|
|
666
|
-
};
|
|
667
|
-
|
|
668
|
-
const safeDuration =
|
|
669
|
-
Number.isFinite(fallbackDurationSeconds) && fallbackDurationSeconds > 0
|
|
670
|
-
? fallbackDurationSeconds
|
|
671
|
-
: 3;
|
|
672
|
-
|
|
673
|
-
// Keep a timer fallback in case the mixer completion event is missed.
|
|
674
|
-
this.emoteTimeout = setTimeout(
|
|
675
|
-
() => {
|
|
676
|
-
if (this.emoteRequestId !== requestId || this.emoteAction !== action) {
|
|
677
|
-
return;
|
|
678
|
-
}
|
|
679
|
-
this.stopEmote();
|
|
680
|
-
},
|
|
681
|
-
Math.max(0.25, safeDuration + 0.1) * 1000,
|
|
682
|
-
);
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
private activateAction(action: THREE.AnimationAction): void {
|
|
686
|
-
action.enabled = true;
|
|
687
|
-
action.paused = false;
|
|
688
|
-
action.setEffectiveTimeScale(1);
|
|
689
|
-
action.setEffectiveWeight(1);
|
|
690
|
-
action.play();
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
private playActionWithBlend(
|
|
694
|
-
action: THREE.AnimationAction,
|
|
695
|
-
fromAction: THREE.AnimationAction | null,
|
|
696
|
-
fadeDuration: number,
|
|
697
|
-
): void {
|
|
698
|
-
action.reset();
|
|
699
|
-
this.activateAction(action);
|
|
700
|
-
if (fromAction && fromAction !== action) {
|
|
701
|
-
this.activateAction(fromAction);
|
|
702
|
-
action.crossFadeFrom(fromAction, fadeDuration, false);
|
|
703
|
-
return;
|
|
704
|
-
}
|
|
705
|
-
action.fadeIn(fadeDuration);
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
private async ensureIdleAction(
|
|
709
|
-
vrm: VRM,
|
|
710
|
-
mixer: THREE.AnimationMixer,
|
|
711
|
-
): Promise<THREE.AnimationAction | null> {
|
|
712
|
-
if (this.idleAction) return this.idleAction;
|
|
713
|
-
if (this.idleLoadPromise) return this.idleLoadPromise;
|
|
714
|
-
|
|
715
|
-
this.idleLoadPromise = (async () => {
|
|
716
|
-
const clip = await loadIdleClip(
|
|
717
|
-
vrm,
|
|
718
|
-
this.idleGlbUrl,
|
|
719
|
-
this.animationLoaderContext,
|
|
720
|
-
);
|
|
721
|
-
if (!clip || this.loadingAborted || this.vrm !== vrm) {
|
|
722
|
-
return null;
|
|
723
|
-
}
|
|
724
|
-
const activeMixer = this.mixer ?? mixer;
|
|
725
|
-
if (!activeMixer || this.vrm !== vrm) {
|
|
726
|
-
return null;
|
|
727
|
-
}
|
|
728
|
-
const action = activeMixer.clipAction(clip);
|
|
729
|
-
action.reset();
|
|
730
|
-
action.setLoop(THREE.LoopRepeat, Infinity);
|
|
731
|
-
action.timeScale = 1.0;
|
|
732
|
-
this.idleAction = action;
|
|
733
|
-
activeMixer.update(1 / 60);
|
|
734
|
-
return action;
|
|
735
|
-
})().finally(() => {
|
|
736
|
-
this.idleLoadPromise = null;
|
|
737
|
-
});
|
|
738
|
-
|
|
739
|
-
return this.idleLoadPromise;
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
private restoreIdleAfterEmote(
|
|
743
|
-
activeEmote: THREE.AnimationAction | null,
|
|
744
|
-
fadeDuration: number,
|
|
745
|
-
vrm: VRM,
|
|
746
|
-
mixer: THREE.AnimationMixer,
|
|
747
|
-
): void {
|
|
748
|
-
void this.ensureIdleAction(vrm, mixer).then((idleAction) => {
|
|
749
|
-
if (!idleAction || this.loadingAborted || this.vrm !== vrm) {
|
|
750
|
-
activeEmote?.fadeOut(fadeDuration);
|
|
751
|
-
return;
|
|
752
|
-
}
|
|
753
|
-
this.activateAction(idleAction);
|
|
754
|
-
if (activeEmote && activeEmote !== idleAction) {
|
|
755
|
-
idleAction.crossFadeFrom(activeEmote, fadeDuration, false);
|
|
756
|
-
} else {
|
|
757
|
-
idleAction.fadeIn(fadeDuration);
|
|
758
|
-
}
|
|
759
|
-
});
|
|
760
|
-
}
|
|
761
|
-
private avatarLookRig: {
|
|
762
|
-
headBone: THREE.Object3D | null;
|
|
763
|
-
neckBone: THREE.Object3D | null;
|
|
764
|
-
spineBone: THREE.Object3D | null;
|
|
765
|
-
} = {
|
|
766
|
-
headBone: null,
|
|
767
|
-
neckBone: null,
|
|
768
|
-
spineBone: null,
|
|
769
|
-
};
|
|
770
|
-
private readonly tempCameraOrbitOffset = new THREE.Vector3();
|
|
771
|
-
private readonly tempCameraSpherical = new THREE.Spherical();
|
|
772
|
-
private readonly tempAvatarLookTarget = new THREE.Vector3();
|
|
773
|
-
private readonly tempAvatarLocalTarget = new THREE.Vector3();
|
|
774
|
-
private readonly tempAvatarLocalAnchor = new THREE.Vector3();
|
|
775
|
-
private readonly tempAvatarHeadWorld = new THREE.Vector3();
|
|
776
|
-
private readyPromise: Promise<void> = Promise.resolve();
|
|
777
|
-
private resolveReady: (() => void) | null = null;
|
|
778
|
-
private rejectReady: ((error?: unknown) => void) | null = null;
|
|
779
|
-
private releaseKnownWebGpuWarningFilter: (() => void) | null = null;
|
|
780
|
-
|
|
781
|
-
// Transition state
|
|
782
|
-
private isCameraTransitioning = false;
|
|
783
|
-
private transitionStartFov = 0;
|
|
784
|
-
private transitionTargetFov = 0;
|
|
785
|
-
private transitionStartPos = new THREE.Vector3();
|
|
786
|
-
private transitionTargetPos = new THREE.Vector3();
|
|
787
|
-
private transitionStartLookAt = new THREE.Vector3();
|
|
788
|
-
private transitionTargetLookAt = new THREE.Vector3();
|
|
789
|
-
private transitionProgress = 0;
|
|
790
|
-
private transitionDuration = CAMERA_PROFILE_TRANSITION_DURATION_SECONDS;
|
|
791
|
-
|
|
792
|
-
private handleControlStart = (): void => {
|
|
793
|
-
if (!this.interactionEnabled) return;
|
|
794
|
-
};
|
|
795
|
-
private handleControlEnd = (): void => {
|
|
796
|
-
if (!this.interactionEnabled) return;
|
|
797
|
-
if (this.camera) {
|
|
798
|
-
this.baseCameraPosition.copy(this.camera.position);
|
|
799
|
-
}
|
|
800
|
-
if (this.controls) {
|
|
801
|
-
this.lookAtTarget.copy(this.controls.target);
|
|
802
|
-
}
|
|
803
|
-
};
|
|
804
|
-
|
|
805
|
-
private scheduleNextFrame(): void {
|
|
806
|
-
if (!this.initialized || this.paused || this.animationFrameId !== null) {
|
|
807
|
-
return;
|
|
808
|
-
}
|
|
809
|
-
this.animationFrameId = requestAnimationFrame(() => {
|
|
810
|
-
this.animationFrameId = null;
|
|
811
|
-
this.loop();
|
|
812
|
-
});
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
private stopLoop(): void {
|
|
816
|
-
if (this.animationFrameId !== null) {
|
|
817
|
-
cancelAnimationFrame(this.animationFrameId);
|
|
818
|
-
this.animationFrameId = null;
|
|
819
|
-
}
|
|
820
|
-
this.clock.stop();
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
private resumeLoop(): void {
|
|
824
|
-
if (!this.initialized || this.paused) return;
|
|
825
|
-
this.clock.start();
|
|
826
|
-
this.scheduleNextFrame();
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
private async loadSparkModule(): Promise<typeof import("@sparkjsdev/spark")> {
|
|
830
|
-
if (!VrmEngine.sparkModulePromise) {
|
|
831
|
-
VrmEngine.sparkModulePromise = import("@sparkjsdev/spark");
|
|
832
|
-
}
|
|
833
|
-
return VrmEngine.sparkModulePromise;
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
private async ensureSparkRenderer(): Promise<void> {
|
|
837
|
-
if (this.sparkRenderer || this.rendererBackend !== "webgl") return;
|
|
838
|
-
if (!this.scene || !this.renderer) return;
|
|
839
|
-
|
|
840
|
-
const { SparkRenderer } = await this.loadSparkModule();
|
|
841
|
-
// Re-check after async import — the engine may have been disposed during
|
|
842
|
-
// the await (e.g. React StrictMode double-mount).
|
|
843
|
-
if (!this.scene || !this.renderer) return;
|
|
844
|
-
const sparkRenderer = new SparkRenderer({
|
|
845
|
-
renderer: this.renderer as THREE.WebGLRenderer,
|
|
846
|
-
apertureAngle: 0.0,
|
|
847
|
-
focalDistance: 5.0,
|
|
848
|
-
originDistance: 1,
|
|
849
|
-
clipXY: SPARK_CLIP_XY,
|
|
850
|
-
maxStdDev: SPARK_MAX_STD_DEV,
|
|
851
|
-
maxPixelRadius: SPARK_MAX_PIXEL_RADIUS,
|
|
852
|
-
minAlpha: SPARK_MIN_ALPHA,
|
|
853
|
-
view: {
|
|
854
|
-
depthBias: 1,
|
|
855
|
-
sortDistance: SPARK_SORT_DISTANCE,
|
|
856
|
-
sortRadial: true,
|
|
857
|
-
sort360: false,
|
|
858
|
-
},
|
|
859
|
-
});
|
|
860
|
-
sparkRenderer.renderOrder = 9998;
|
|
861
|
-
this.scene.add(sparkRenderer);
|
|
862
|
-
this.sparkRenderer = sparkRenderer;
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
private updateSparkPerformanceProfile(): void {
|
|
866
|
-
const sparkRenderer = this.sparkRenderer;
|
|
867
|
-
if (!sparkRenderer) return;
|
|
868
|
-
if (!this.worldMesh) {
|
|
869
|
-
sparkRenderer.maxPixelRadius = SPARK_MAX_PIXEL_RADIUS;
|
|
870
|
-
sparkRenderer.maxStdDev = SPARK_MAX_STD_DEV;
|
|
871
|
-
sparkRenderer.minAlpha = SPARK_MIN_ALPHA;
|
|
872
|
-
sparkRenderer.clipXY = SPARK_CLIP_XY;
|
|
873
|
-
sparkRenderer.defaultView.sortDistance = SPARK_SORT_DISTANCE;
|
|
874
|
-
return;
|
|
875
|
-
}
|
|
876
|
-
const isCompanionProfile =
|
|
877
|
-
this.cameraProfile === "companion" ||
|
|
878
|
-
this.cameraProfile === "companion_close";
|
|
879
|
-
const closeZoomFactor = isCompanionProfile
|
|
880
|
-
? THREE.MathUtils.smoothstep(this.companionZoomCurrent, 0.3, 1)
|
|
881
|
-
: 0;
|
|
882
|
-
|
|
883
|
-
sparkRenderer.maxPixelRadius = THREE.MathUtils.lerp(
|
|
884
|
-
SPARK_MAX_PIXEL_RADIUS,
|
|
885
|
-
SPARK_MAX_PIXEL_RADIUS_NEAR,
|
|
886
|
-
closeZoomFactor,
|
|
887
|
-
);
|
|
888
|
-
sparkRenderer.maxStdDev = THREE.MathUtils.lerp(
|
|
889
|
-
SPARK_MAX_STD_DEV,
|
|
890
|
-
SPARK_MAX_STD_DEV_NEAR,
|
|
891
|
-
closeZoomFactor,
|
|
892
|
-
);
|
|
893
|
-
sparkRenderer.minAlpha = THREE.MathUtils.lerp(
|
|
894
|
-
SPARK_MIN_ALPHA,
|
|
895
|
-
SPARK_MIN_ALPHA_NEAR,
|
|
896
|
-
closeZoomFactor,
|
|
897
|
-
);
|
|
898
|
-
sparkRenderer.clipXY = THREE.MathUtils.lerp(
|
|
899
|
-
SPARK_CLIP_XY,
|
|
900
|
-
1.03,
|
|
901
|
-
closeZoomFactor,
|
|
902
|
-
);
|
|
903
|
-
sparkRenderer.defaultView.sortDistance = THREE.MathUtils.lerp(
|
|
904
|
-
SPARK_SORT_DISTANCE,
|
|
905
|
-
SPARK_SORT_DISTANCE_NEAR,
|
|
906
|
-
closeZoomFactor,
|
|
907
|
-
);
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
private createWorldRevealController(
|
|
911
|
-
spark: typeof import("@sparkjsdev/spark"),
|
|
912
|
-
mesh: SparkSplatMesh,
|
|
913
|
-
reveal: { origin: THREE.Vector3; radius: number },
|
|
914
|
-
mode: "reveal" | "hide",
|
|
915
|
-
): WorldRevealController | null {
|
|
916
|
-
const dyno = (
|
|
917
|
-
"dyno" in spark ? Reflect.get(spark as object, "dyno") : undefined
|
|
918
|
-
) as
|
|
919
|
-
| {
|
|
920
|
-
Gsplat: unknown;
|
|
921
|
-
dynoBlock: (
|
|
922
|
-
inTypes: Record<string, unknown>,
|
|
923
|
-
outTypes: Record<string, unknown>,
|
|
924
|
-
construct: (
|
|
925
|
-
inputs: Record<string, unknown>,
|
|
926
|
-
) => Record<string, unknown>,
|
|
927
|
-
) => unknown;
|
|
928
|
-
dynoFloat: (value?: number, key?: string) => { value: number };
|
|
929
|
-
dynoVec3: (
|
|
930
|
-
value?: THREE.Vector3,
|
|
931
|
-
key?: string,
|
|
932
|
-
) => { value: THREE.Vector3 };
|
|
933
|
-
dynoConst: (type: string, value: number) => unknown;
|
|
934
|
-
splitGsplat: (gsplat: unknown) => {
|
|
935
|
-
outputs: {
|
|
936
|
-
center: unknown;
|
|
937
|
-
scales: unknown;
|
|
938
|
-
rgb: unknown;
|
|
939
|
-
opacity: unknown;
|
|
940
|
-
};
|
|
941
|
-
};
|
|
942
|
-
combineGsplat: (value: Record<string, unknown>) => unknown;
|
|
943
|
-
add: (a: unknown, b: unknown) => unknown;
|
|
944
|
-
sub: (a: unknown, b: unknown) => unknown;
|
|
945
|
-
mul: (a: unknown, b: unknown) => unknown;
|
|
946
|
-
div: (a: unknown, b: unknown) => unknown;
|
|
947
|
-
abs: (a: unknown) => unknown;
|
|
948
|
-
clamp: (a: unknown, min: unknown, max: unknown) => unknown;
|
|
949
|
-
max: (a: unknown, b: unknown) => unknown;
|
|
950
|
-
mix: (a: unknown, b: unknown, t: unknown) => unknown;
|
|
951
|
-
smoothstep: (edge0: unknown, edge1: unknown, x: unknown) => unknown;
|
|
952
|
-
pow: (a: unknown, b: unknown) => unknown;
|
|
953
|
-
length: (a: unknown) => unknown;
|
|
954
|
-
swizzle: (a: unknown, select: string) => unknown;
|
|
955
|
-
}
|
|
956
|
-
| undefined;
|
|
957
|
-
if (
|
|
958
|
-
!dyno?.Gsplat ||
|
|
959
|
-
!dyno.dynoBlock ||
|
|
960
|
-
!dyno.dynoFloat ||
|
|
961
|
-
!dyno.dynoVec3 ||
|
|
962
|
-
!dyno.dynoConst ||
|
|
963
|
-
!dyno.splitGsplat ||
|
|
964
|
-
!dyno.combineGsplat ||
|
|
965
|
-
!dyno.add ||
|
|
966
|
-
!dyno.sub ||
|
|
967
|
-
!dyno.mul ||
|
|
968
|
-
!dyno.div ||
|
|
969
|
-
!dyno.abs ||
|
|
970
|
-
!dyno.clamp ||
|
|
971
|
-
!dyno.max ||
|
|
972
|
-
!dyno.mix ||
|
|
973
|
-
!dyno.smoothstep ||
|
|
974
|
-
!dyno.pow ||
|
|
975
|
-
!dyno.length ||
|
|
976
|
-
!dyno.swizzle
|
|
977
|
-
) {
|
|
978
|
-
return null;
|
|
979
|
-
}
|
|
980
|
-
|
|
981
|
-
const originUniform = dyno.dynoVec3(reveal.origin, "uWorldRevealOrigin");
|
|
982
|
-
const resolvedRadius = Math.max(
|
|
983
|
-
reveal.radius,
|
|
984
|
-
COMPANION_WORLD_REVEAL_EDGE * 2,
|
|
985
|
-
);
|
|
986
|
-
const radiusUniform = dyno.dynoFloat(resolvedRadius, "uWorldRevealRadius");
|
|
987
|
-
const edgeUniform = dyno.dynoFloat(
|
|
988
|
-
COMPANION_WORLD_REVEAL_EDGE,
|
|
989
|
-
"uWorldRevealEdge",
|
|
990
|
-
);
|
|
991
|
-
const progressUniform = dyno.dynoFloat(0, "uWorldRevealProgress");
|
|
992
|
-
const wireScaleUniform = dyno.dynoVec3(
|
|
993
|
-
new THREE.Vector3(0.004, 0.004, 0.004),
|
|
994
|
-
"uWorldRevealWireScale",
|
|
995
|
-
);
|
|
996
|
-
const wireAlphaUniform = dyno.dynoFloat(0.42, "uWorldRevealWireAlpha");
|
|
997
|
-
const wireBoostUniform = dyno.dynoFloat(0.3, "uWorldRevealWireBoost");
|
|
998
|
-
const zero = dyno.dynoConst("float", 0);
|
|
999
|
-
const one = dyno.dynoConst("float", 1);
|
|
1000
|
-
const two = dyno.dynoConst("float", 2);
|
|
1001
|
-
const startOffset = dyno.dynoConst(
|
|
1002
|
-
"float",
|
|
1003
|
-
-COMPANION_WORLD_REVEAL_START_OFFSET,
|
|
1004
|
-
);
|
|
1005
|
-
|
|
1006
|
-
const modifier = dyno.dynoBlock(
|
|
1007
|
-
{ gsplat: dyno.Gsplat },
|
|
1008
|
-
{ gsplat: dyno.Gsplat },
|
|
1009
|
-
({ gsplat }) => {
|
|
1010
|
-
if (!gsplat) {
|
|
1011
|
-
throw new Error("Missing gsplat input for world reveal");
|
|
1012
|
-
}
|
|
1013
|
-
const { center, scales, rgb, opacity } =
|
|
1014
|
-
dyno.splitGsplat(gsplat).outputs;
|
|
1015
|
-
const radialDistance = dyno.length(
|
|
1016
|
-
dyno.swizzle(dyno.sub(center, originUniform), "xz"),
|
|
1017
|
-
);
|
|
1018
|
-
const currentRadius = dyno.add(
|
|
1019
|
-
dyno.mul(radiusUniform, progressUniform),
|
|
1020
|
-
startOffset,
|
|
1021
|
-
);
|
|
1022
|
-
const bodyMask = dyno.sub(
|
|
1023
|
-
one,
|
|
1024
|
-
dyno.smoothstep(
|
|
1025
|
-
dyno.sub(currentRadius, edgeUniform),
|
|
1026
|
-
dyno.add(currentRadius, edgeUniform),
|
|
1027
|
-
radialDistance,
|
|
1028
|
-
),
|
|
1029
|
-
);
|
|
1030
|
-
const ringDistance = dyno.abs(dyno.sub(radialDistance, currentRadius));
|
|
1031
|
-
const ringMask = dyno.pow(
|
|
1032
|
-
dyno.sub(
|
|
1033
|
-
one,
|
|
1034
|
-
dyno.smoothstep(zero, dyno.mul(edgeUniform, two), ringDistance),
|
|
1035
|
-
),
|
|
1036
|
-
two,
|
|
1037
|
-
);
|
|
1038
|
-
const visibleMask =
|
|
1039
|
-
mode === "hide" ? dyno.sub(one, bodyMask) : bodyMask;
|
|
1040
|
-
const wireFactor = dyno.clamp(
|
|
1041
|
-
dyno.max(visibleMask, dyno.mul(ringMask, wireAlphaUniform)),
|
|
1042
|
-
zero,
|
|
1043
|
-
one,
|
|
1044
|
-
);
|
|
1045
|
-
const brightenedRgb = dyno.mul(
|
|
1046
|
-
rgb,
|
|
1047
|
-
dyno.add(one, dyno.mul(ringMask, wireBoostUniform)),
|
|
1048
|
-
);
|
|
1049
|
-
return {
|
|
1050
|
-
gsplat: dyno.combineGsplat({
|
|
1051
|
-
gsplat,
|
|
1052
|
-
scales: dyno.mix(wireScaleUniform, scales, wireFactor),
|
|
1053
|
-
rgb: dyno.mix(brightenedRgb, rgb, visibleMask),
|
|
1054
|
-
opacity: dyno.mul(opacity, wireFactor),
|
|
1055
|
-
}),
|
|
1056
|
-
};
|
|
1057
|
-
},
|
|
1058
|
-
);
|
|
1059
|
-
|
|
1060
|
-
mesh.objectModifier = modifier as SparkSplatMesh["objectModifier"];
|
|
1061
|
-
this.refreshSplatMesh(mesh);
|
|
1062
|
-
|
|
1063
|
-
return {
|
|
1064
|
-
mesh,
|
|
1065
|
-
progressUniform,
|
|
1066
|
-
mode,
|
|
1067
|
-
radius: resolvedRadius,
|
|
1068
|
-
};
|
|
1069
|
-
}
|
|
1070
|
-
|
|
1071
|
-
private refreshSplatMesh(mesh: SparkSplatMesh): void {
|
|
1072
|
-
mesh.updateGenerator();
|
|
1073
|
-
const refreshableMesh = mesh as SparkSplatMesh & {
|
|
1074
|
-
updateVersion?: () => void;
|
|
1075
|
-
};
|
|
1076
|
-
refreshableMesh.updateVersion?.();
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
private setWorldRevealProgress(
|
|
1080
|
-
controller: WorldRevealController,
|
|
1081
|
-
progress: number,
|
|
1082
|
-
): void {
|
|
1083
|
-
controller.progressUniform.value = THREE.MathUtils.clamp(progress, 0, 1);
|
|
1084
|
-
const refreshableMesh = controller.mesh as SparkSplatMesh & {
|
|
1085
|
-
updateVersion?: () => void;
|
|
1086
|
-
};
|
|
1087
|
-
refreshableMesh.updateVersion?.();
|
|
1088
|
-
}
|
|
1089
|
-
|
|
1090
|
-
private queueWorldReveal(
|
|
1091
|
-
incoming: WorldRevealController,
|
|
1092
|
-
options: {
|
|
1093
|
-
outgoing?: WorldRevealController | null;
|
|
1094
|
-
duration?: number;
|
|
1095
|
-
waitingForVrm?: boolean;
|
|
1096
|
-
syncToTeleport?: boolean;
|
|
1097
|
-
initialProgress?: number;
|
|
1098
|
-
} = {},
|
|
1099
|
-
): void {
|
|
1100
|
-
const reveal: WorldRevealState = {
|
|
1101
|
-
controller: incoming,
|
|
1102
|
-
incoming,
|
|
1103
|
-
outgoing: options.outgoing ?? null,
|
|
1104
|
-
progress: THREE.MathUtils.clamp(options.initialProgress ?? 0, 0, 1),
|
|
1105
|
-
duration: options.duration ?? COMPANION_WORLD_REVEAL_DURATION,
|
|
1106
|
-
waitingForVrm: options.waitingForVrm ?? false,
|
|
1107
|
-
syncToTeleport: options.syncToTeleport ?? false,
|
|
1108
|
-
};
|
|
1109
|
-
incoming.mesh.opacity = 1;
|
|
1110
|
-
if (reveal.outgoing) {
|
|
1111
|
-
reveal.outgoing.mesh.opacity = 1;
|
|
1112
|
-
}
|
|
1113
|
-
this.worldReveal = reveal;
|
|
1114
|
-
this.setWorldRevealProgress(incoming, reveal.progress);
|
|
1115
|
-
if (reveal.outgoing) {
|
|
1116
|
-
this.setWorldRevealProgress(reveal.outgoing, reveal.progress);
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
private disposeSplatMesh(mesh: SparkSplatMesh | null): void {
|
|
1121
|
-
if (!mesh) return;
|
|
1122
|
-
mesh.parent?.remove(mesh);
|
|
1123
|
-
mesh.dispose();
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
private completeWorldReveal(reveal: WorldRevealState): void {
|
|
1127
|
-
this.setWorldRevealProgress(reveal.incoming, 1);
|
|
1128
|
-
reveal.incoming.mesh.opacity = 1;
|
|
1129
|
-
reveal.incoming.mesh.objectModifier = undefined;
|
|
1130
|
-
this.refreshSplatMesh(reveal.incoming.mesh);
|
|
1131
|
-
if (reveal.outgoing) {
|
|
1132
|
-
reveal.outgoing.mesh.objectModifier = undefined;
|
|
1133
|
-
this.disposeSplatMesh(reveal.outgoing.mesh);
|
|
1134
|
-
}
|
|
1135
|
-
if (this.worldReveal === reveal) {
|
|
1136
|
-
this.worldReveal = null;
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1139
|
-
|
|
1140
|
-
private cancelWorldReveal(): void {
|
|
1141
|
-
if (!this.worldReveal) return;
|
|
1142
|
-
this.completeWorldReveal(this.worldReveal);
|
|
1143
|
-
}
|
|
1144
|
-
|
|
1145
|
-
private startPendingWorldReveal(syncToTeleport: boolean): void {
|
|
1146
|
-
const reveal = this.worldReveal;
|
|
1147
|
-
if (!reveal || !reveal.waitingForVrm) return;
|
|
1148
|
-
reveal.waitingForVrm = false;
|
|
1149
|
-
reveal.syncToTeleport = syncToTeleport;
|
|
1150
|
-
reveal.progress = syncToTeleport ? this.teleportProgress : 0;
|
|
1151
|
-
this.setWorldRevealProgress(reveal.incoming, reveal.progress);
|
|
1152
|
-
if (reveal.outgoing) {
|
|
1153
|
-
this.setWorldRevealProgress(reveal.outgoing, reveal.progress);
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
|
-
private updateWorldReveal(stableDelta: number): void {
|
|
1158
|
-
const reveal = this.worldReveal;
|
|
1159
|
-
if (!reveal || reveal.waitingForVrm) return;
|
|
1160
|
-
const avatarRevealActive =
|
|
1161
|
-
this.revealStarted && this.teleportProgress < 0.999;
|
|
1162
|
-
|
|
1163
|
-
const nextProgress =
|
|
1164
|
-
reveal.syncToTeleport && avatarRevealActive
|
|
1165
|
-
? this.teleportProgress
|
|
1166
|
-
: Math.min(1, reveal.progress + stableDelta / reveal.duration);
|
|
1167
|
-
const appliedProgress =
|
|
1168
|
-
reveal.syncToTeleport && avatarRevealActive
|
|
1169
|
-
? nextProgress
|
|
1170
|
-
: nextProgress ** COMPANION_WORLD_REVEAL_EASE_EXPONENT;
|
|
1171
|
-
|
|
1172
|
-
reveal.progress = nextProgress;
|
|
1173
|
-
this.setWorldRevealProgress(reveal.incoming, appliedProgress);
|
|
1174
|
-
if (reveal.outgoing) {
|
|
1175
|
-
this.setWorldRevealProgress(reveal.outgoing, appliedProgress);
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
if (nextProgress >= 1) {
|
|
1179
|
-
this.completeWorldReveal(reveal);
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
private updateSparkDepthOfField(camera: THREE.PerspectiveCamera): void {
|
|
1184
|
-
const sparkRenderer = this.sparkRenderer;
|
|
1185
|
-
if (!sparkRenderer) return;
|
|
1186
|
-
if (!this.worldMesh) {
|
|
1187
|
-
sparkRenderer.apertureAngle = 0;
|
|
1188
|
-
return;
|
|
1189
|
-
}
|
|
1190
|
-
|
|
1191
|
-
const focalDistance = Math.max(
|
|
1192
|
-
0.5,
|
|
1193
|
-
camera.position.distanceTo(this.pointerParallaxLookAt),
|
|
1194
|
-
);
|
|
1195
|
-
const isCompanionProfile =
|
|
1196
|
-
this.cameraProfile === "companion" ||
|
|
1197
|
-
this.cameraProfile === "companion_close";
|
|
1198
|
-
const closeZoomFactor = isCompanionProfile
|
|
1199
|
-
? THREE.MathUtils.smoothstep(this.companionZoomCurrent, 0.3, 1)
|
|
1200
|
-
: 0;
|
|
1201
|
-
const apertureSize = THREE.MathUtils.lerp(
|
|
1202
|
-
COMPANION_DOF_APERTURE_SIZE,
|
|
1203
|
-
COMPANION_DOF_APERTURE_SIZE * COMPANION_DOF_NEAR_ZOOM_APERTURE_FACTOR,
|
|
1204
|
-
closeZoomFactor,
|
|
1205
|
-
);
|
|
1206
|
-
sparkRenderer.focalDistance = focalDistance;
|
|
1207
|
-
sparkRenderer.apertureAngle =
|
|
1208
|
-
2 * Math.atan((0.5 * apertureSize) / sparkRenderer.focalDistance);
|
|
1209
|
-
}
|
|
1210
|
-
|
|
1211
|
-
private applyCompanionZoom(
|
|
1212
|
-
camera: THREE.PerspectiveCamera,
|
|
1213
|
-
stableDelta: number,
|
|
1214
|
-
): void {
|
|
1215
|
-
const isCompanionProfile =
|
|
1216
|
-
this.cameraProfile === "companion" ||
|
|
1217
|
-
this.cameraProfile === "companion_close";
|
|
1218
|
-
const follow = Math.min(1, stableDelta * 10);
|
|
1219
|
-
const targetZoom = isCompanionProfile ? this.companionZoomTarget : 0;
|
|
1220
|
-
this.companionZoomCurrent = THREE.MathUtils.lerp(
|
|
1221
|
-
this.companionZoomCurrent,
|
|
1222
|
-
targetZoom,
|
|
1223
|
-
follow,
|
|
1224
|
-
);
|
|
1225
|
-
if (this.companionZoomCurrent < 1e-4) return;
|
|
1226
|
-
|
|
1227
|
-
const baseRadius = this.baseCameraPosition.distanceTo(this.lookAtTarget);
|
|
1228
|
-
if (!Number.isFinite(baseRadius) || baseRadius < 1e-4) return;
|
|
1229
|
-
|
|
1230
|
-
const orbitOffset = this.tempCameraOrbitOffset
|
|
1231
|
-
.copy(camera.position)
|
|
1232
|
-
.sub(this.lookAtTarget);
|
|
1233
|
-
if (orbitOffset.lengthSq() < 1e-6) return;
|
|
1234
|
-
|
|
1235
|
-
const spherical = this.tempCameraSpherical.setFromVector3(orbitOffset);
|
|
1236
|
-
const nearRadius = Math.max(
|
|
1237
|
-
COMPANION_ZOOM_MIN_RADIUS,
|
|
1238
|
-
baseRadius * COMPANION_ZOOM_NEAR_FACTOR,
|
|
1239
|
-
);
|
|
1240
|
-
spherical.radius = THREE.MathUtils.lerp(
|
|
1241
|
-
baseRadius,
|
|
1242
|
-
nearRadius,
|
|
1243
|
-
this.companionZoomCurrent,
|
|
1244
|
-
);
|
|
1245
|
-
camera.position
|
|
1246
|
-
.copy(this.lookAtTarget)
|
|
1247
|
-
.add(orbitOffset.setFromSpherical(spherical));
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1250
|
-
private configureAvatarLookTracking(vrm: VRM): void {
|
|
1251
|
-
const target = this.avatarLookTarget;
|
|
1252
|
-
if (target) {
|
|
1253
|
-
target.position.set(0, 1.5, 2);
|
|
1254
|
-
target.updateMatrixWorld(true);
|
|
1255
|
-
}
|
|
1256
|
-
if (vrm.lookAt && target) {
|
|
1257
|
-
vrm.lookAt.autoUpdate = true;
|
|
1258
|
-
vrm.lookAt.target = target;
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
|
-
const headBone = vrm.humanoid?.getRawBoneNode("head") ?? null;
|
|
1262
|
-
const neckBone = vrm.humanoid?.getRawBoneNode("neck") ?? null;
|
|
1263
|
-
const spineBone =
|
|
1264
|
-
vrm.humanoid?.getRawBoneNode("upperChest") ??
|
|
1265
|
-
vrm.humanoid?.getRawBoneNode("chest") ??
|
|
1266
|
-
vrm.humanoid?.getRawBoneNode("spine") ??
|
|
1267
|
-
null;
|
|
1268
|
-
|
|
1269
|
-
this.avatarLookRig = {
|
|
1270
|
-
headBone,
|
|
1271
|
-
neckBone,
|
|
1272
|
-
spineBone,
|
|
1273
|
-
};
|
|
1274
|
-
this.headLookTarget.set(0, 0);
|
|
1275
|
-
this.headLookCurrent.set(0, 0);
|
|
1276
|
-
}
|
|
1277
|
-
|
|
1278
|
-
private updateAvatarLookTarget(
|
|
1279
|
-
camera: THREE.PerspectiveCamera,
|
|
1280
|
-
stableDelta: number,
|
|
1281
|
-
): void {
|
|
1282
|
-
const target = this.avatarLookTarget;
|
|
1283
|
-
if (!target) return;
|
|
1284
|
-
this.tempAvatarLookTarget.copy(camera.position);
|
|
1285
|
-
const follow = Math.min(1, stableDelta * 24);
|
|
1286
|
-
target.position.lerp(this.tempAvatarLookTarget, follow);
|
|
1287
|
-
target.updateMatrixWorld(true);
|
|
1288
|
-
}
|
|
1289
|
-
|
|
1290
|
-
private refreshAvatarEyeTracking(): void {
|
|
1291
|
-
const vrm = this.vrm;
|
|
1292
|
-
if (!vrm?.lookAt || !this.avatarLookTarget) return;
|
|
1293
|
-
vrm.lookAt.update(0);
|
|
1294
|
-
vrm.expressionManager?.update();
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
private applyAvatarHeadTracking(
|
|
1298
|
-
camera: THREE.PerspectiveCamera,
|
|
1299
|
-
stableDelta: number,
|
|
1300
|
-
): void {
|
|
1301
|
-
const vrm = this.vrm;
|
|
1302
|
-
const { headBone, neckBone, spineBone } = this.avatarLookRig;
|
|
1303
|
-
if (!vrm || !headBone) return;
|
|
1304
|
-
const headParent = headBone.parent;
|
|
1305
|
-
if (!headParent || typeof headParent.worldToLocal !== "function") return;
|
|
1306
|
-
if (
|
|
1307
|
-
typeof THREE.Euler !== "function" ||
|
|
1308
|
-
typeof THREE.Quaternion !== "function" ||
|
|
1309
|
-
typeof headBone.quaternion.clone !== "function"
|
|
1310
|
-
) {
|
|
1311
|
-
return;
|
|
1312
|
-
}
|
|
1313
|
-
const lookAtState = vrm.lookAt as
|
|
1314
|
-
| ({ _yaw?: number; _pitch?: number } & object)
|
|
1315
|
-
| null
|
|
1316
|
-
| undefined;
|
|
1317
|
-
const lookAtYawDegrees = lookAtState?._yaw;
|
|
1318
|
-
const lookAtPitchDegrees = lookAtState?._pitch;
|
|
1319
|
-
|
|
1320
|
-
if (
|
|
1321
|
-
Number.isFinite(lookAtYawDegrees) &&
|
|
1322
|
-
Number.isFinite(lookAtPitchDegrees)
|
|
1323
|
-
) {
|
|
1324
|
-
this.headLookTarget.set(
|
|
1325
|
-
THREE.MathUtils.clamp(
|
|
1326
|
-
THREE.MathUtils.degToRad(lookAtYawDegrees || 0),
|
|
1327
|
-
-0.55,
|
|
1328
|
-
0.55,
|
|
1329
|
-
),
|
|
1330
|
-
THREE.MathUtils.clamp(
|
|
1331
|
-
THREE.MathUtils.degToRad(lookAtPitchDegrees || 0),
|
|
1332
|
-
-0.3,
|
|
1333
|
-
0.24,
|
|
1334
|
-
),
|
|
1335
|
-
);
|
|
1336
|
-
} else {
|
|
1337
|
-
headBone.getWorldPosition(this.tempAvatarHeadWorld);
|
|
1338
|
-
this.tempAvatarLocalTarget.copy(camera.position);
|
|
1339
|
-
this.tempAvatarLocalTarget.y -= 0.04;
|
|
1340
|
-
headParent.worldToLocal(this.tempAvatarLocalTarget);
|
|
1341
|
-
headParent.worldToLocal(
|
|
1342
|
-
this.tempAvatarLocalAnchor.copy(this.tempAvatarHeadWorld),
|
|
1343
|
-
);
|
|
1344
|
-
this.tempAvatarLocalTarget.sub(this.tempAvatarLocalAnchor);
|
|
1345
|
-
|
|
1346
|
-
const planarDistance = Math.max(
|
|
1347
|
-
1e-4,
|
|
1348
|
-
Math.hypot(this.tempAvatarLocalTarget.x, this.tempAvatarLocalTarget.z),
|
|
1349
|
-
);
|
|
1350
|
-
this.headLookTarget.set(
|
|
1351
|
-
THREE.MathUtils.clamp(
|
|
1352
|
-
Math.atan2(
|
|
1353
|
-
-this.tempAvatarLocalTarget.x,
|
|
1354
|
-
Math.max(-this.tempAvatarLocalTarget.z, 1e-4),
|
|
1355
|
-
),
|
|
1356
|
-
-0.55,
|
|
1357
|
-
0.55,
|
|
1358
|
-
),
|
|
1359
|
-
THREE.MathUtils.clamp(
|
|
1360
|
-
Math.atan2(this.tempAvatarLocalTarget.y, planarDistance),
|
|
1361
|
-
-0.3,
|
|
1362
|
-
0.24,
|
|
1363
|
-
),
|
|
1364
|
-
);
|
|
1365
|
-
}
|
|
1366
|
-
this.headLookCurrent.lerp(
|
|
1367
|
-
this.headLookTarget,
|
|
1368
|
-
Math.min(1, stableDelta * 4.5),
|
|
1369
|
-
);
|
|
1370
|
-
|
|
1371
|
-
const applyTrackedBone = (
|
|
1372
|
-
bone: THREE.Object3D | null,
|
|
1373
|
-
yawWeight: number,
|
|
1374
|
-
pitchWeight: number,
|
|
1375
|
-
) => {
|
|
1376
|
-
if (
|
|
1377
|
-
!bone ||
|
|
1378
|
-
!bone.quaternion ||
|
|
1379
|
-
typeof bone.quaternion.clone !== "function"
|
|
1380
|
-
) {
|
|
1381
|
-
return;
|
|
1382
|
-
}
|
|
1383
|
-
const offsetEuler = new THREE.Euler(
|
|
1384
|
-
this.headLookCurrent.y * pitchWeight,
|
|
1385
|
-
this.headLookCurrent.x * yawWeight,
|
|
1386
|
-
0,
|
|
1387
|
-
"YXZ",
|
|
1388
|
-
);
|
|
1389
|
-
const offsetQuaternion = new THREE.Quaternion().setFromEuler(offsetEuler);
|
|
1390
|
-
const animatedPose = bone.quaternion.clone();
|
|
1391
|
-
bone.quaternion.copy(animatedPose).multiply(offsetQuaternion);
|
|
1392
|
-
};
|
|
1393
|
-
|
|
1394
|
-
applyTrackedBone(spineBone, 0.12, 0.06);
|
|
1395
|
-
applyTrackedBone(neckBone, 0.3, 0.18);
|
|
1396
|
-
applyTrackedBone(headBone, 0.52, 0.28);
|
|
1397
|
-
}
|
|
1398
|
-
|
|
1399
|
-
private toDebugVector3(vector: THREE.Vector3 | null): DebugVector3 | null {
|
|
1400
|
-
if (!vector) return null;
|
|
1401
|
-
return {
|
|
1402
|
-
x: Number(vector.x.toFixed(4)),
|
|
1403
|
-
y: Number(vector.y.toFixed(4)),
|
|
1404
|
-
z: Number(vector.z.toFixed(4)),
|
|
1405
|
-
};
|
|
1406
|
-
}
|
|
1407
|
-
|
|
1408
|
-
private toDebugBounds(object: THREE.Object3D | null): DebugBounds | null {
|
|
1409
|
-
if (!object) return null;
|
|
1410
|
-
const bounds = new THREE.Box3().setFromObject(object);
|
|
1411
|
-
if (bounds.isEmpty()) return null;
|
|
1412
|
-
return this.toDebugBoundsFromBox(bounds);
|
|
1413
|
-
}
|
|
1414
|
-
|
|
1415
|
-
private toDebugBoundsFromBox(bounds: THREE.Box3 | null): DebugBounds | null {
|
|
1416
|
-
if (!bounds || bounds.isEmpty()) return null;
|
|
1417
|
-
const center = bounds.getCenter(new THREE.Vector3());
|
|
1418
|
-
const size = bounds.getSize(new THREE.Vector3());
|
|
1419
|
-
const min = this.toDebugVector3(bounds.min.clone());
|
|
1420
|
-
const max = this.toDebugVector3(bounds.max.clone());
|
|
1421
|
-
const centerVector = this.toDebugVector3(center);
|
|
1422
|
-
const sizeVector = this.toDebugVector3(size);
|
|
1423
|
-
if (!min || !max || !centerVector || !sizeVector) return null;
|
|
1424
|
-
return {
|
|
1425
|
-
min,
|
|
1426
|
-
max,
|
|
1427
|
-
center: centerVector,
|
|
1428
|
-
size: sizeVector,
|
|
1429
|
-
};
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1432
|
-
getDebugInfo(): VrmEngineDebugInfo {
|
|
1433
|
-
this.scene?.updateMatrixWorld(true);
|
|
1434
|
-
this.vrm?.scene.updateMatrixWorld(true);
|
|
1435
|
-
this.worldMesh?.updateMatrixWorld(true);
|
|
1436
|
-
|
|
1437
|
-
const cameraRotation = this.camera
|
|
1438
|
-
? new THREE.Vector3(
|
|
1439
|
-
this.camera.rotation.x,
|
|
1440
|
-
this.camera.rotation.y,
|
|
1441
|
-
this.camera.rotation.z,
|
|
1442
|
-
)
|
|
1443
|
-
: null;
|
|
1444
|
-
const lookAtTarget =
|
|
1445
|
-
this.toDebugVector3(this.lookAtTarget) ??
|
|
1446
|
-
({ x: 0, y: 0, z: 0 } satisfies DebugVector3);
|
|
1447
|
-
|
|
1448
|
-
return {
|
|
1449
|
-
initialized: this.initialized,
|
|
1450
|
-
rendererBackend: this.rendererBackend,
|
|
1451
|
-
cameraProfile: this.cameraProfile,
|
|
1452
|
-
worldUrl: this.worldUrl,
|
|
1453
|
-
sceneChildren:
|
|
1454
|
-
this.scene?.children.map((child) => child.name || child.type) ?? [],
|
|
1455
|
-
camera: {
|
|
1456
|
-
parentName: this.camera?.parent?.name ?? null,
|
|
1457
|
-
position: this.toDebugVector3(this.camera?.position ?? null),
|
|
1458
|
-
rotation: this.toDebugVector3(cameraRotation),
|
|
1459
|
-
fov: this.camera?.fov ?? null,
|
|
1460
|
-
lookAtTarget,
|
|
1461
|
-
},
|
|
1462
|
-
avatar: {
|
|
1463
|
-
loaded: this.vrm !== null,
|
|
1464
|
-
ready: this.vrmReady,
|
|
1465
|
-
parentName: this.vrm?.scene.parent?.name ?? null,
|
|
1466
|
-
position: this.toDebugVector3(this.vrm?.scene.position ?? null),
|
|
1467
|
-
scale: this.toDebugVector3(this.vrm?.scene.scale ?? null),
|
|
1468
|
-
bounds: this.toDebugBounds(this.vrm?.scene ?? null),
|
|
1469
|
-
},
|
|
1470
|
-
world: {
|
|
1471
|
-
loaded: this.worldMesh !== null,
|
|
1472
|
-
parentName: this.worldMesh?.parent?.name ?? null,
|
|
1473
|
-
position: this.toDebugVector3(this.worldMesh?.position ?? null),
|
|
1474
|
-
scale: this.toDebugVector3(this.worldMesh?.scale ?? null),
|
|
1475
|
-
bounds: this.toDebugBounds(this.worldMesh ?? null),
|
|
1476
|
-
rawBounds: this.worldMesh
|
|
1477
|
-
? this.toDebugBoundsFromBox(this.worldMesh.getBoundingBox(true))
|
|
1478
|
-
: null,
|
|
1479
|
-
},
|
|
1480
|
-
spark: {
|
|
1481
|
-
attached: this.sparkRenderer !== null,
|
|
1482
|
-
parentName: this.sparkRenderer?.parent?.name ?? null,
|
|
1483
|
-
renderOrder: this.sparkRenderer?.renderOrder ?? null,
|
|
1484
|
-
},
|
|
1485
|
-
};
|
|
1486
|
-
}
|
|
1487
|
-
|
|
1488
|
-
setDebugAvatarVisible(visible: boolean): void {
|
|
1489
|
-
if (!this.vrm) return;
|
|
1490
|
-
this.vrm.scene.visible = visible;
|
|
1491
|
-
}
|
|
1492
|
-
|
|
1493
|
-
setDebugWorldPosition(x: number, y: number, z: number): void {
|
|
1494
|
-
if (!this.worldMesh) return;
|
|
1495
|
-
this.worldMesh.position.set(x, y, z);
|
|
1496
|
-
}
|
|
1497
|
-
|
|
1498
|
-
setDebugWorldQuaternion(x: number, y: number, z: number, w: number): void {
|
|
1499
|
-
if (!this.worldMesh) return;
|
|
1500
|
-
this.worldMesh.quaternion.set(x, y, z, w);
|
|
1501
|
-
}
|
|
1502
|
-
|
|
1503
|
-
setDebugCamera(position: THREE.Vector3, target: THREE.Vector3): void {
|
|
1504
|
-
if (!this.camera) return;
|
|
1505
|
-
this.isCameraTransitioning = false;
|
|
1506
|
-
this.camera.position.copy(position);
|
|
1507
|
-
this.baseCameraPosition.copy(position);
|
|
1508
|
-
this.lookAtTarget.copy(target);
|
|
1509
|
-
this.controls?.target.copy(target);
|
|
1510
|
-
this.controls?.update();
|
|
1511
|
-
this.camera.lookAt(target);
|
|
1512
|
-
}
|
|
1513
|
-
|
|
1514
|
-
private startCameraTransition(
|
|
1515
|
-
startPos: THREE.Vector3,
|
|
1516
|
-
startLookAt: THREE.Vector3,
|
|
1517
|
-
startFov: number,
|
|
1518
|
-
targetPos: THREE.Vector3,
|
|
1519
|
-
targetLookAt: THREE.Vector3,
|
|
1520
|
-
targetFov: number,
|
|
1521
|
-
durationSeconds: number,
|
|
1522
|
-
): void {
|
|
1523
|
-
if (!this.camera) return;
|
|
1524
|
-
|
|
1525
|
-
this.transitionStartFov = startFov;
|
|
1526
|
-
this.transitionTargetFov = targetFov;
|
|
1527
|
-
this.transitionStartPos.copy(startPos);
|
|
1528
|
-
this.transitionTargetPos.copy(targetPos);
|
|
1529
|
-
this.transitionStartLookAt.copy(startLookAt);
|
|
1530
|
-
this.transitionTargetLookAt.copy(targetLookAt);
|
|
1531
|
-
this.transitionDuration = Math.max(0.01, durationSeconds);
|
|
1532
|
-
|
|
1533
|
-
this.camera.fov = startFov;
|
|
1534
|
-
this.camera.position.copy(startPos);
|
|
1535
|
-
this.camera.updateProjectionMatrix();
|
|
1536
|
-
this.baseCameraPosition.copy(startPos);
|
|
1537
|
-
this.lookAtTarget.copy(startLookAt);
|
|
1538
|
-
if (this.controls) {
|
|
1539
|
-
this.controls.target.copy(startLookAt);
|
|
1540
|
-
this.controls.update();
|
|
1541
|
-
}
|
|
1542
|
-
this.camera.lookAt(startLookAt);
|
|
1543
|
-
this.isCameraTransitioning = true;
|
|
1544
|
-
this.transitionProgress = 0;
|
|
1545
|
-
}
|
|
1546
|
-
|
|
1547
|
-
private transitionCameraToFramedAvatar(
|
|
1548
|
-
vrm: VRM,
|
|
1549
|
-
durationSeconds: number,
|
|
1550
|
-
): void {
|
|
1551
|
-
if (!this.camera) return;
|
|
1552
|
-
|
|
1553
|
-
const startPos = new THREE.Vector3().copy(this.camera.position);
|
|
1554
|
-
const startLookAt = new THREE.Vector3().copy(this.lookAtTarget);
|
|
1555
|
-
const startFov = this.camera.fov;
|
|
1556
|
-
const targetLookAt = new THREE.Vector3();
|
|
1557
|
-
const targetPos = new THREE.Vector3();
|
|
1558
|
-
|
|
1559
|
-
this.cameraManager.centerAndFrame(
|
|
1560
|
-
vrm,
|
|
1561
|
-
this.camera,
|
|
1562
|
-
this.controls,
|
|
1563
|
-
this.cameraProfile,
|
|
1564
|
-
targetLookAt,
|
|
1565
|
-
targetPos,
|
|
1566
|
-
(c) => this.cameraManager.applyInteractionMode(c, this.interactionMode),
|
|
1567
|
-
);
|
|
1568
|
-
|
|
1569
|
-
this.startCameraTransition(
|
|
1570
|
-
startPos,
|
|
1571
|
-
startLookAt,
|
|
1572
|
-
startFov,
|
|
1573
|
-
targetPos,
|
|
1574
|
-
targetLookAt,
|
|
1575
|
-
this.camera.fov,
|
|
1576
|
-
durationSeconds,
|
|
1577
|
-
);
|
|
1578
|
-
}
|
|
1579
|
-
|
|
1580
|
-
whenReady(): Promise<void> {
|
|
1581
|
-
return this.readyPromise;
|
|
1582
|
-
}
|
|
1583
|
-
|
|
1584
|
-
private resetReadyPromise(): void {
|
|
1585
|
-
this.readyPromise = new Promise<void>((resolve, reject) => {
|
|
1586
|
-
this.resolveReady = resolve;
|
|
1587
|
-
this.rejectReady = reject;
|
|
1588
|
-
});
|
|
1589
|
-
}
|
|
1590
|
-
|
|
1591
|
-
private settleReady(error?: unknown): void {
|
|
1592
|
-
if (error) {
|
|
1593
|
-
this.rejectReady?.(error);
|
|
1594
|
-
} else {
|
|
1595
|
-
this.resolveReady?.();
|
|
1596
|
-
}
|
|
1597
|
-
this.resolveReady = null;
|
|
1598
|
-
this.rejectReady = null;
|
|
1599
|
-
}
|
|
1600
|
-
|
|
1601
|
-
setup(
|
|
1602
|
-
canvas: HTMLCanvasElement,
|
|
1603
|
-
onUpdate: UpdateCallback,
|
|
1604
|
-
options?: {
|
|
1605
|
-
rendererPreference?: RendererPreference;
|
|
1606
|
-
sparkOptimized?: boolean;
|
|
1607
|
-
},
|
|
1608
|
-
): void {
|
|
1609
|
-
if (this.initialized && this.renderer?.domElement === canvas) {
|
|
1610
|
-
this.onUpdate = onUpdate;
|
|
1611
|
-
return;
|
|
1612
|
-
}
|
|
1613
|
-
if (this.initialized) this.dispose();
|
|
1614
|
-
this.onUpdate = onUpdate;
|
|
1615
|
-
this.loadingAborted = false;
|
|
1616
|
-
this.rendererPreference = options?.rendererPreference ?? "auto";
|
|
1617
|
-
this.resetReadyPromise();
|
|
1618
|
-
// Async renderer creation: tries WebGPU, falls back to WebGL.
|
|
1619
|
-
// setup() remains synchronous for callers; the loop starts after init resolves.
|
|
1620
|
-
void (async () => {
|
|
1621
|
-
try {
|
|
1622
|
-
const { backend, renderer } = await createRenderer(
|
|
1623
|
-
canvas,
|
|
1624
|
-
this.rendererPreference,
|
|
1625
|
-
options?.sparkOptimized ?? false,
|
|
1626
|
-
);
|
|
1627
|
-
const releaseKnownWebGpuWarningFilter =
|
|
1628
|
-
backend === "webgpu" ? installKnownVrmWebGpuWarningFilter() : null;
|
|
1629
|
-
// Guard: if dispose() was called while we were awaiting, abort.
|
|
1630
|
-
if (this.loadingAborted) {
|
|
1631
|
-
releaseKnownWebGpuWarningFilter?.();
|
|
1632
|
-
renderer.dispose();
|
|
1633
|
-
this.settleReady();
|
|
1634
|
-
return;
|
|
1635
|
-
}
|
|
1636
|
-
this.releaseKnownWebGpuWarningFilter = releaseKnownWebGpuWarningFilter;
|
|
1637
|
-
renderer.setPixelRatio(
|
|
1638
|
-
getRendererPixelRatio(options?.sparkOptimized ?? false),
|
|
1639
|
-
);
|
|
1640
|
-
renderer.setClearColor(0x000000, 0);
|
|
1641
|
-
if (backend === "webgl") {
|
|
1642
|
-
const webglRenderer = renderer as THREE.WebGLRenderer;
|
|
1643
|
-
webglRenderer.shadowMap.enabled = true;
|
|
1644
|
-
webglRenderer.shadowMap.type = THREE.PCFSoftShadowMap;
|
|
1645
|
-
webglRenderer.toneMapping = THREE.NoToneMapping;
|
|
1646
|
-
webglRenderer.toneMappingExposure = 1.0;
|
|
1647
|
-
webglRenderer.outputColorSpace = THREE.SRGBColorSpace;
|
|
1648
|
-
}
|
|
1649
|
-
this.renderer = renderer;
|
|
1650
|
-
this.rendererBackend = backend;
|
|
1651
|
-
const scene = new THREE.Scene();
|
|
1652
|
-
this.scene = scene;
|
|
1653
|
-
const avatarRoot = new THREE.Group();
|
|
1654
|
-
avatarRoot.name = "AvatarRoot";
|
|
1655
|
-
scene.add(avatarRoot);
|
|
1656
|
-
this.avatarRoot = avatarRoot;
|
|
1657
|
-
const avatarLookTarget = new THREE.Group();
|
|
1658
|
-
avatarLookTarget.name = "AvatarLookTarget";
|
|
1659
|
-
scene.add(avatarLookTarget);
|
|
1660
|
-
this.avatarLookTarget = avatarLookTarget;
|
|
1661
|
-
const cameraRig = new THREE.Group();
|
|
1662
|
-
cameraRig.name = "AvatarCameraRig";
|
|
1663
|
-
scene.add(cameraRig);
|
|
1664
|
-
const camera = new THREE.PerspectiveCamera(30, 1, 0.1, 20);
|
|
1665
|
-
camera.position.set(0, 1.2, 5.0);
|
|
1666
|
-
cameraRig.add(camera);
|
|
1667
|
-
this.camera = camera;
|
|
1668
|
-
const controls = new OrbitControls(camera, renderer.domElement);
|
|
1669
|
-
controls.enableDamping = false;
|
|
1670
|
-
controls.target.copy(this.lookAtTarget);
|
|
1671
|
-
controls.addEventListener("start", this.handleControlStart);
|
|
1672
|
-
controls.addEventListener("end", this.handleControlEnd);
|
|
1673
|
-
this.cameraManager.applyInteractionMode(controls, this.interactionMode);
|
|
1674
|
-
controls.update();
|
|
1675
|
-
this.controls = controls;
|
|
1676
|
-
this.setInteractionEnabled(this.interactionEnabled);
|
|
1677
|
-
const ambient = new THREE.AmbientLight(0xffffff, 0.8);
|
|
1678
|
-
scene.add(ambient);
|
|
1679
|
-
const keyLight = new THREE.DirectionalLight(0xffffff, 1.2);
|
|
1680
|
-
keyLight.position.set(1, 1, 1).normalize();
|
|
1681
|
-
keyLight.castShadow = true;
|
|
1682
|
-
keyLight.shadow.mapSize.setScalar(1024);
|
|
1683
|
-
scene.add(keyLight);
|
|
1684
|
-
const fillLight = new THREE.DirectionalLight(0xffffff, 0.4);
|
|
1685
|
-
fillLight.position.set(-1, 0.5, -1).normalize();
|
|
1686
|
-
scene.add(fillLight);
|
|
1687
|
-
this.resize(canvas.clientWidth, canvas.clientHeight);
|
|
1688
|
-
this.initialized = true;
|
|
1689
|
-
this.resumeLoop();
|
|
1690
|
-
this.settleReady();
|
|
1691
|
-
} catch (error) {
|
|
1692
|
-
this.initialized = false;
|
|
1693
|
-
this.releaseKnownWebGpuWarningFilter?.();
|
|
1694
|
-
this.releaseKnownWebGpuWarningFilter = null;
|
|
1695
|
-
this.renderer = null;
|
|
1696
|
-
this.rendererBackend = "webgl";
|
|
1697
|
-
this.scene = null;
|
|
1698
|
-
this.camera = null;
|
|
1699
|
-
this.controls = null;
|
|
1700
|
-
console.error("[VrmEngine] Failed to initialize renderer:", error);
|
|
1701
|
-
this.settleReady(error);
|
|
1702
|
-
}
|
|
1703
|
-
})();
|
|
1704
|
-
}
|
|
1705
|
-
|
|
1706
|
-
isInitialized(): boolean {
|
|
1707
|
-
return this.initialized && this.renderer !== null;
|
|
1708
|
-
}
|
|
1709
|
-
dispose(): void {
|
|
1710
|
-
this.loadingAborted = true;
|
|
1711
|
-
this.initialized = false;
|
|
1712
|
-
this.settleReady();
|
|
1713
|
-
this.releaseKnownWebGpuWarningFilter?.();
|
|
1714
|
-
this.releaseKnownWebGpuWarningFilter = null;
|
|
1715
|
-
if (this.animationFrameId !== null) {
|
|
1716
|
-
cancelAnimationFrame(this.animationFrameId);
|
|
1717
|
-
this.animationFrameId = null;
|
|
1718
|
-
}
|
|
1719
|
-
if (this.vrm?.scene.parent) {
|
|
1720
|
-
this.vrm.scene.parent.remove(this.vrm.scene);
|
|
1721
|
-
VRMUtils.deepDispose(this.vrm.scene);
|
|
1722
|
-
}
|
|
1723
|
-
if (this.controls) {
|
|
1724
|
-
this.controls.removeEventListener("start", this.handleControlStart);
|
|
1725
|
-
this.controls.removeEventListener("end", this.handleControlEnd);
|
|
1726
|
-
this.controls.dispose();
|
|
1727
|
-
this.controls = null;
|
|
1728
|
-
}
|
|
1729
|
-
this.vrm = null;
|
|
1730
|
-
this.vrmReady = false;
|
|
1731
|
-
this.vrmName = null;
|
|
1732
|
-
this.lastLoadError = null;
|
|
1733
|
-
this.mixer = null;
|
|
1734
|
-
this.idleAction = null;
|
|
1735
|
-
this.idleLoadPromise = null;
|
|
1736
|
-
this.clearPendingEmoteCompletion();
|
|
1737
|
-
this.emoteAction = null;
|
|
1738
|
-
this.emoteClipCache.clear();
|
|
1739
|
-
this.teleportProgress = 1.0;
|
|
1740
|
-
this.cleanupTeleportDissolve();
|
|
1741
|
-
this.cleanupTeleportSparkles();
|
|
1742
|
-
this.disposeWorld();
|
|
1743
|
-
this.avatarLookTarget?.parent?.remove(this.avatarLookTarget);
|
|
1744
|
-
this.avatarLookTarget = null;
|
|
1745
|
-
this.avatarLookRig = {
|
|
1746
|
-
headBone: null,
|
|
1747
|
-
neckBone: null,
|
|
1748
|
-
spineBone: null,
|
|
1749
|
-
};
|
|
1750
|
-
this.headLookTarget.set(0, 0);
|
|
1751
|
-
this.headLookCurrent.set(0, 0);
|
|
1752
|
-
if (this.sparkRenderer) {
|
|
1753
|
-
this.sparkRenderer.apertureAngle = 0;
|
|
1754
|
-
this.sparkRenderer.removeFromParent();
|
|
1755
|
-
this.sparkRenderer = null;
|
|
1756
|
-
}
|
|
1757
|
-
if (this.renderer) {
|
|
1758
|
-
this.renderer.dispose();
|
|
1759
|
-
}
|
|
1760
|
-
this.renderer = null;
|
|
1761
|
-
this.rendererBackend = "webgl";
|
|
1762
|
-
this.scene = null;
|
|
1763
|
-
this.avatarRoot = null;
|
|
1764
|
-
this.camera = null;
|
|
1765
|
-
this.onUpdate = null;
|
|
1766
|
-
this.paused = false;
|
|
1767
|
-
}
|
|
1768
|
-
setPaused(paused: boolean): void {
|
|
1769
|
-
if (this.paused === paused) return;
|
|
1770
|
-
this.paused = paused;
|
|
1771
|
-
if (paused) {
|
|
1772
|
-
this.stopLoop();
|
|
1773
|
-
return;
|
|
1774
|
-
}
|
|
1775
|
-
this.resumeLoop();
|
|
1776
|
-
}
|
|
1777
|
-
setInteractionEnabled(enabled: boolean): void {
|
|
1778
|
-
this.interactionEnabled = enabled;
|
|
1779
|
-
if (this.controls) {
|
|
1780
|
-
this.controls.enabled = enabled;
|
|
1781
|
-
}
|
|
1782
|
-
}
|
|
1783
|
-
setInteractionMode(mode: InteractionMode): void {
|
|
1784
|
-
this.interactionMode = mode;
|
|
1785
|
-
if (this.controls) {
|
|
1786
|
-
this.cameraManager.applyInteractionMode(this.controls, mode);
|
|
1787
|
-
this.controls.update();
|
|
1788
|
-
}
|
|
1789
|
-
}
|
|
1790
|
-
setCameraProfile(profile: CameraProfile): void {
|
|
1791
|
-
if (this.cameraProfile === profile) return;
|
|
1792
|
-
|
|
1793
|
-
if (this.camera) {
|
|
1794
|
-
const startFov = this.camera.fov;
|
|
1795
|
-
const startPos = new THREE.Vector3().copy(this.camera.position);
|
|
1796
|
-
const startLookAt = new THREE.Vector3().copy(this.lookAtTarget);
|
|
1797
|
-
|
|
1798
|
-
this.cameraProfile = profile;
|
|
1799
|
-
|
|
1800
|
-
const targetLookAt = new THREE.Vector3().copy(this.lookAtTarget);
|
|
1801
|
-
const targetPos = new THREE.Vector3().copy(this.camera.position);
|
|
1802
|
-
|
|
1803
|
-
if (this.vrm) {
|
|
1804
|
-
this.cameraManager.centerAndFrame(
|
|
1805
|
-
this.vrm,
|
|
1806
|
-
this.camera,
|
|
1807
|
-
this.controls,
|
|
1808
|
-
this.cameraProfile,
|
|
1809
|
-
targetLookAt,
|
|
1810
|
-
targetPos,
|
|
1811
|
-
(c) =>
|
|
1812
|
-
this.cameraManager.applyInteractionMode(c, this.interactionMode),
|
|
1813
|
-
);
|
|
1814
|
-
} else {
|
|
1815
|
-
this.cameraManager.applyCameraProfileToCamera(
|
|
1816
|
-
this.camera,
|
|
1817
|
-
this.controls,
|
|
1818
|
-
this.cameraProfile,
|
|
1819
|
-
);
|
|
1820
|
-
targetPos.copy(this.camera.position);
|
|
1821
|
-
if (this.controls) {
|
|
1822
|
-
targetLookAt.copy(this.controls.target);
|
|
1823
|
-
}
|
|
1824
|
-
}
|
|
1825
|
-
|
|
1826
|
-
this.startCameraTransition(
|
|
1827
|
-
startPos,
|
|
1828
|
-
startLookAt,
|
|
1829
|
-
startFov,
|
|
1830
|
-
targetPos,
|
|
1831
|
-
targetLookAt,
|
|
1832
|
-
this.camera.fov,
|
|
1833
|
-
CAMERA_PROFILE_TRANSITION_DURATION_SECONDS,
|
|
1834
|
-
);
|
|
1835
|
-
} else {
|
|
1836
|
-
this.cameraProfile = profile;
|
|
1837
|
-
}
|
|
1838
|
-
}
|
|
1839
|
-
resize(width: number, height: number): void {
|
|
1840
|
-
if (!this.renderer || !this.camera) return;
|
|
1841
|
-
if (width <= 0 || height <= 0) return;
|
|
1842
|
-
const aspect = width / height;
|
|
1843
|
-
if (!Number.isFinite(aspect) || aspect <= 0) return;
|
|
1844
|
-
this.renderer.setSize(width, height, false);
|
|
1845
|
-
this.camera.aspect = aspect;
|
|
1846
|
-
this.camera.updateProjectionMatrix();
|
|
1847
|
-
}
|
|
1848
|
-
getState(): VrmEngineState {
|
|
1849
|
-
const idlePlaying = this.idleAction?.isRunning() ?? false;
|
|
1850
|
-
return {
|
|
1851
|
-
vrmLoaded: this.vrm !== null && this.vrmReady,
|
|
1852
|
-
vrmName: this.vrmName,
|
|
1853
|
-
loadError: this.lastLoadError,
|
|
1854
|
-
idlePlaying,
|
|
1855
|
-
idleTime: this.idleAction?.time ?? 0,
|
|
1856
|
-
idleTracks: this.idleAction?.getClip()?.tracks.length ?? 0,
|
|
1857
|
-
revealStarted: this.revealStarted,
|
|
1858
|
-
loadingProgress: this.loadingProgress,
|
|
1859
|
-
};
|
|
1860
|
-
}
|
|
1861
|
-
setMouthOpen(value: number): void {
|
|
1862
|
-
this.mouthValue = Math.max(0, Math.min(1, value));
|
|
1863
|
-
}
|
|
1864
|
-
setSpeaking(speaking: boolean): void {
|
|
1865
|
-
if (speaking && !this.speaking) {
|
|
1866
|
-
this.speakingStartTime = this.elapsedTime;
|
|
1867
|
-
}
|
|
1868
|
-
this.speaking = speaking;
|
|
1869
|
-
}
|
|
1870
|
-
setCameraAnimation(config: Partial<CameraAnimationConfig>): void {
|
|
1871
|
-
this.cameraAnimation = { ...this.cameraAnimation, ...config };
|
|
1872
|
-
}
|
|
1873
|
-
setPointerParallaxEnabled(enabled: boolean): void {
|
|
1874
|
-
this.pointerParallaxEnabled = enabled;
|
|
1875
|
-
if (!enabled) {
|
|
1876
|
-
this.pointerParallaxTarget.set(0, 0);
|
|
1877
|
-
}
|
|
1878
|
-
}
|
|
1879
|
-
setPointerParallaxTarget(x: number, y: number): void {
|
|
1880
|
-
this.pointerParallaxTarget.set(
|
|
1881
|
-
THREE.MathUtils.clamp(x, -1, 1),
|
|
1882
|
-
THREE.MathUtils.clamp(y, -1, 1),
|
|
1883
|
-
);
|
|
1884
|
-
}
|
|
1885
|
-
resetPointerParallax(): void {
|
|
1886
|
-
this.pointerParallaxTarget.set(0, 0);
|
|
1887
|
-
}
|
|
1888
|
-
setDragOrbitTarget(yaw: number, pitch: number): void {
|
|
1889
|
-
this.dragOrbitTarget.set(
|
|
1890
|
-
THREE.MathUtils.clamp(yaw, -0.6, 0.6),
|
|
1891
|
-
THREE.MathUtils.clamp(pitch, -0.35, 0.35),
|
|
1892
|
-
);
|
|
1893
|
-
}
|
|
1894
|
-
resetDragOrbit(): void {
|
|
1895
|
-
this.dragOrbitTarget.set(0, 0);
|
|
1896
|
-
}
|
|
1897
|
-
setCompanionZoomNormalized(value: number): void {
|
|
1898
|
-
this.companionZoomTarget = THREE.MathUtils.clamp(value, 0, 1);
|
|
1899
|
-
}
|
|
1900
|
-
|
|
1901
|
-
async setWorldUrl(url: string | null): Promise<void> {
|
|
1902
|
-
await this.whenReady();
|
|
1903
|
-
if (!this.scene) return;
|
|
1904
|
-
const normalizedUrl = url?.trim() ? url : null;
|
|
1905
|
-
if (this.worldUrl === normalizedUrl && this.worldMesh) return;
|
|
1906
|
-
|
|
1907
|
-
const requestId = ++this.worldLoadRequestId;
|
|
1908
|
-
this.worldUrl = normalizedUrl;
|
|
1909
|
-
this.cancelWorldReveal();
|
|
1910
|
-
const outgoingWorld = this.worldMesh;
|
|
1911
|
-
if (!normalizedUrl) {
|
|
1912
|
-
this.disposeWorld();
|
|
1913
|
-
return;
|
|
1914
|
-
}
|
|
1915
|
-
|
|
1916
|
-
await this.ensureSparkRenderer();
|
|
1917
|
-
// Re-check after async — the engine may have been disposed during the
|
|
1918
|
-
// await (e.g. React StrictMode double-mount or rapid navigation).
|
|
1919
|
-
if (!this.scene || this.loadingAborted || requestId !== this.worldLoadRequestId) return;
|
|
1920
|
-
const spark = await this.loadSparkModule();
|
|
1921
|
-
if (!this.scene || this.loadingAborted || requestId !== this.worldLoadRequestId) return;
|
|
1922
|
-
const { SplatMesh } = spark;
|
|
1923
|
-
let worldAnchor = new THREE.Vector3(0, 0, 0);
|
|
1924
|
-
let worldRevealRadius = 1;
|
|
1925
|
-
const splat = new SplatMesh({
|
|
1926
|
-
url: normalizedUrl,
|
|
1927
|
-
constructSplats: (packedSplats) => {
|
|
1928
|
-
worldAnchor = getRobustPackedSplatAnchor(packedSplats);
|
|
1929
|
-
worldRevealRadius = getRobustPackedSplatRadialExtent(
|
|
1930
|
-
packedSplats,
|
|
1931
|
-
worldAnchor,
|
|
1932
|
-
);
|
|
1933
|
-
},
|
|
1934
|
-
});
|
|
1935
|
-
splat.frustumCulled = false;
|
|
1936
|
-
splat.quaternion.identity();
|
|
1937
|
-
splat.position.set(0, 0, 0);
|
|
1938
|
-
splat.scale.setScalar(COMPANION_WORLD_SCALE);
|
|
1939
|
-
this.scene.add(splat);
|
|
1940
|
-
|
|
1941
|
-
await splat.initialized;
|
|
1942
|
-
|
|
1943
|
-
if (
|
|
1944
|
-
this.loadingAborted ||
|
|
1945
|
-
!this.scene ||
|
|
1946
|
-
requestId !== this.worldLoadRequestId
|
|
1947
|
-
) {
|
|
1948
|
-
splat.parent?.remove(splat);
|
|
1949
|
-
splat.dispose();
|
|
1950
|
-
return;
|
|
1951
|
-
}
|
|
1952
|
-
|
|
1953
|
-
const worldCenterBottom =
|
|
1954
|
-
worldAnchor.lengthSq() > 0 ? worldAnchor : getRobustSplatAnchor(splat);
|
|
1955
|
-
const worldFloorOffsetY = getCompanionWorldFloorOffsetY(normalizedUrl);
|
|
1956
|
-
splat.position.set(
|
|
1957
|
-
-worldCenterBottom.x * COMPANION_WORLD_SCALE,
|
|
1958
|
-
-worldCenterBottom.y * COMPANION_WORLD_SCALE + worldFloorOffsetY,
|
|
1959
|
-
-worldCenterBottom.z * COMPANION_WORLD_SCALE,
|
|
1960
|
-
);
|
|
1961
|
-
const syncToTeleport = this.revealStarted && this.teleportProgress < 0.999;
|
|
1962
|
-
const waitingForVrm = !outgoingWorld && !this.vrmReady;
|
|
1963
|
-
const incomingRevealRadius = Math.max(
|
|
1964
|
-
worldRevealRadius * COMPANION_WORLD_SCALE,
|
|
1965
|
-
getRobustSplatRadialExtent(splat, worldCenterBottom) *
|
|
1966
|
-
COMPANION_WORLD_SCALE,
|
|
1967
|
-
);
|
|
1968
|
-
let outgoingAnchor: THREE.Vector3 | null = null;
|
|
1969
|
-
let sharedRevealRadius = incomingRevealRadius;
|
|
1970
|
-
if (outgoingWorld && !waitingForVrm) {
|
|
1971
|
-
outgoingAnchor = getRobustSplatAnchor(outgoingWorld);
|
|
1972
|
-
sharedRevealRadius = Math.max(
|
|
1973
|
-
sharedRevealRadius,
|
|
1974
|
-
getRobustSplatRadialExtent(outgoingWorld, outgoingAnchor) *
|
|
1975
|
-
COMPANION_WORLD_SCALE,
|
|
1976
|
-
);
|
|
1977
|
-
}
|
|
1978
|
-
|
|
1979
|
-
const worldReveal = this.createWorldRevealController(
|
|
1980
|
-
spark,
|
|
1981
|
-
splat,
|
|
1982
|
-
{
|
|
1983
|
-
origin: worldCenterBottom,
|
|
1984
|
-
radius: sharedRevealRadius,
|
|
1985
|
-
},
|
|
1986
|
-
"reveal",
|
|
1987
|
-
);
|
|
1988
|
-
this.worldMesh = splat;
|
|
1989
|
-
if (worldReveal) {
|
|
1990
|
-
let outgoingReveal: WorldRevealController | null = null;
|
|
1991
|
-
if (outgoingWorld && outgoingAnchor && !waitingForVrm) {
|
|
1992
|
-
outgoingReveal = this.createWorldRevealController(
|
|
1993
|
-
spark,
|
|
1994
|
-
outgoingWorld,
|
|
1995
|
-
{
|
|
1996
|
-
origin: outgoingAnchor,
|
|
1997
|
-
radius: sharedRevealRadius,
|
|
1998
|
-
},
|
|
1999
|
-
"hide",
|
|
2000
|
-
);
|
|
2001
|
-
if (!outgoingReveal) {
|
|
2002
|
-
this.disposeSplatMesh(outgoingWorld);
|
|
2003
|
-
}
|
|
2004
|
-
}
|
|
2005
|
-
this.queueWorldReveal(worldReveal, {
|
|
2006
|
-
outgoing: outgoingReveal,
|
|
2007
|
-
duration: COMPANION_WORLD_REVEAL_DURATION,
|
|
2008
|
-
waitingForVrm,
|
|
2009
|
-
syncToTeleport,
|
|
2010
|
-
initialProgress: syncToTeleport ? this.teleportProgress : 0,
|
|
2011
|
-
});
|
|
2012
|
-
} else {
|
|
2013
|
-
this.disposeSplatMesh(outgoingWorld);
|
|
2014
|
-
}
|
|
2015
|
-
}
|
|
2016
|
-
async playEmote(
|
|
2017
|
-
path: string,
|
|
2018
|
-
duration: number,
|
|
2019
|
-
loop: boolean,
|
|
2020
|
-
): Promise<void> {
|
|
2021
|
-
const vrm = this.vrm;
|
|
2022
|
-
const mixer = this.mixer;
|
|
2023
|
-
if (!vrm || !mixer) return;
|
|
2024
|
-
this.clearPendingEmoteCompletion();
|
|
2025
|
-
this.emoteRequestId++;
|
|
2026
|
-
const requestId = this.emoteRequestId;
|
|
2027
|
-
const currentAction = this.emoteAction;
|
|
2028
|
-
const blendSource = currentAction ?? this.idleAction;
|
|
2029
|
-
const clip = await this.loadEmoteClipCached(path, vrm);
|
|
2030
|
-
if (!clip || this.vrm !== vrm || this.mixer !== mixer) return;
|
|
2031
|
-
if (this.emoteRequestId !== requestId) return;
|
|
2032
|
-
const action = mixer.clipAction(clip);
|
|
2033
|
-
action.setLoop(
|
|
2034
|
-
loop ? THREE.LoopRepeat : THREE.LoopOnce,
|
|
2035
|
-
loop ? Infinity : 1,
|
|
2036
|
-
);
|
|
2037
|
-
action.clampWhenFinished = !loop;
|
|
2038
|
-
const fadeDuration = 0.4;
|
|
2039
|
-
this.playActionWithBlend(action, blendSource, fadeDuration);
|
|
2040
|
-
this.emoteAction = action;
|
|
2041
|
-
if (!loop) {
|
|
2042
|
-
const clipDuration =
|
|
2043
|
-
Number.isFinite(duration) && duration > 0 ? duration : clip.duration;
|
|
2044
|
-
this.watchOneShotEmoteCompletion(mixer, action, requestId, clipDuration);
|
|
2045
|
-
}
|
|
2046
|
-
}
|
|
2047
|
-
stopEmote(): void {
|
|
2048
|
-
this.clearPendingEmoteCompletion();
|
|
2049
|
-
const fadeDuration = 0.4;
|
|
2050
|
-
const activeEmote = this.emoteAction;
|
|
2051
|
-
this.emoteAction = null;
|
|
2052
|
-
if (this.idleAction) {
|
|
2053
|
-
this.activateAction(this.idleAction);
|
|
2054
|
-
if (activeEmote && activeEmote !== this.idleAction) {
|
|
2055
|
-
this.idleAction.crossFadeFrom(activeEmote, fadeDuration, false);
|
|
2056
|
-
} else {
|
|
2057
|
-
this.idleAction.fadeIn(fadeDuration);
|
|
2058
|
-
}
|
|
2059
|
-
return;
|
|
2060
|
-
}
|
|
2061
|
-
if (this.vrm && this.mixer) {
|
|
2062
|
-
this.restoreIdleAfterEmote(
|
|
2063
|
-
activeEmote,
|
|
2064
|
-
fadeDuration,
|
|
2065
|
-
this.vrm,
|
|
2066
|
-
this.mixer,
|
|
2067
|
-
);
|
|
2068
|
-
return;
|
|
2069
|
-
}
|
|
2070
|
-
activeEmote?.fadeOut(fadeDuration);
|
|
2071
|
-
}
|
|
2072
|
-
|
|
2073
|
-
/** Play a one-shot wave greeting after the VRM becomes visible. */
|
|
2074
|
-
playWaveGreeting(): void {
|
|
2075
|
-
this.playEmote("animations/emotes/waving-both-hands.glb.gz", 3, false);
|
|
2076
|
-
}
|
|
2077
|
-
|
|
2078
|
-
async loadVrmFromUrl(url: string, name?: string): Promise<void> {
|
|
2079
|
-
await this.whenReady();
|
|
2080
|
-
if (!this.scene) throw new Error("VrmEngine not initialized");
|
|
2081
|
-
if (!this.camera) throw new Error("VrmEngine not initialized");
|
|
2082
|
-
if (this.loadingAborted) return;
|
|
2083
|
-
const requestId = ++this.vrmLoadRequestId;
|
|
2084
|
-
const hadPreviousVrm = this.vrm !== null;
|
|
2085
|
-
if (this.vrm) {
|
|
2086
|
-
this.vrm.scene.parent?.remove(this.vrm.scene);
|
|
2087
|
-
VRMUtils.deepDispose(this.vrm.scene);
|
|
2088
|
-
this.vrm = null;
|
|
2089
|
-
this.vrmReady = false;
|
|
2090
|
-
this.vrmName = null;
|
|
2091
|
-
this.mixer = null;
|
|
2092
|
-
this.idleAction = null;
|
|
2093
|
-
this.idleLoadPromise = null;
|
|
2094
|
-
this.revealStarted = false;
|
|
2095
|
-
this.cleanupTeleportSparkles();
|
|
2096
|
-
this.stopEmote();
|
|
2097
|
-
this.emoteClipCache.clear();
|
|
2098
|
-
}
|
|
2099
|
-
this.lastLoadError = null;
|
|
2100
|
-
this.loadingProgress = 0;
|
|
2101
|
-
this.onUpdate?.();
|
|
2102
|
-
const loader = new GLTFLoader();
|
|
2103
|
-
configureVrmGltfLoader(loader);
|
|
2104
|
-
const webGpuNodes =
|
|
2105
|
-
this.rendererBackend === "webgpu"
|
|
2106
|
-
? await import("@pixiv/three-vrm/nodes")
|
|
2107
|
-
: null;
|
|
2108
|
-
loader.register((parser) => {
|
|
2109
|
-
if (webGpuNodes) {
|
|
2110
|
-
const mtoonMaterialPlugin = new MToonMaterialLoaderPlugin(parser, {
|
|
2111
|
-
materialType: webGpuNodes.MToonNodeMaterial,
|
|
2112
|
-
});
|
|
2113
|
-
return new VRMLoaderPlugin(parser, { mtoonMaterialPlugin });
|
|
2114
|
-
}
|
|
2115
|
-
return new VRMLoaderPlugin(parser);
|
|
2116
|
-
});
|
|
2117
|
-
let gltf: Awaited<ReturnType<GLTFLoader["loadAsync"]>>;
|
|
2118
|
-
try {
|
|
2119
|
-
gltf = await loadGltfAsset(loader, url, (progress) => {
|
|
2120
|
-
if (this.vrmLoadRequestId === requestId && !this.loadingAborted) {
|
|
2121
|
-
this.loadingProgress = progress;
|
|
2122
|
-
this.onUpdate?.();
|
|
2123
|
-
}
|
|
2124
|
-
});
|
|
2125
|
-
} catch (error) {
|
|
2126
|
-
if (!this.loadingAborted && requestId === this.vrmLoadRequestId) {
|
|
2127
|
-
this.lastLoadError =
|
|
2128
|
-
error instanceof Error ? error.message : String(error);
|
|
2129
|
-
this.onUpdate?.();
|
|
2130
|
-
}
|
|
2131
|
-
throw error;
|
|
2132
|
-
}
|
|
2133
|
-
if (
|
|
2134
|
-
this.loadingAborted ||
|
|
2135
|
-
!this.scene ||
|
|
2136
|
-
requestId !== this.vrmLoadRequestId
|
|
2137
|
-
) {
|
|
2138
|
-
const staleVrm = gltf.userData.vrm as VRM | undefined;
|
|
2139
|
-
if (staleVrm) VRMUtils.deepDispose(staleVrm.scene);
|
|
2140
|
-
return;
|
|
2141
|
-
}
|
|
2142
|
-
const vrm = gltf.userData.vrm as VRM | undefined;
|
|
2143
|
-
if (!vrm) throw new Error("Loaded asset is not a VRM");
|
|
2144
|
-
VRMUtils.removeUnnecessaryVertices(vrm.scene);
|
|
2145
|
-
if (this.camera) {
|
|
2146
|
-
if (hadPreviousVrm) {
|
|
2147
|
-
this.transitionCameraToFramedAvatar(
|
|
2148
|
-
vrm,
|
|
2149
|
-
AVATAR_SWITCH_CAMERA_TRANSITION_DURATION_SECONDS,
|
|
2150
|
-
);
|
|
2151
|
-
} else {
|
|
2152
|
-
this.cameraManager.centerAndFrame(
|
|
2153
|
-
vrm,
|
|
2154
|
-
this.camera,
|
|
2155
|
-
this.controls,
|
|
2156
|
-
this.cameraProfile,
|
|
2157
|
-
this.lookAtTarget,
|
|
2158
|
-
this.baseCameraPosition,
|
|
2159
|
-
(c) =>
|
|
2160
|
-
this.cameraManager.applyInteractionMode(c, this.interactionMode),
|
|
2161
|
-
);
|
|
2162
|
-
}
|
|
2163
|
-
}
|
|
2164
|
-
try {
|
|
2165
|
-
VRMUtils.rotateVRM0(vrm);
|
|
2166
|
-
} catch {
|
|
2167
|
-
/* optional in some versions */
|
|
2168
|
-
}
|
|
2169
|
-
this.cameraManager.ensureFacingCamera(vrm, this.camera);
|
|
2170
|
-
this.configureAvatarLookTracking(vrm);
|
|
2171
|
-
if (
|
|
2172
|
-
this.loadingAborted ||
|
|
2173
|
-
!this.scene ||
|
|
2174
|
-
requestId !== this.vrmLoadRequestId
|
|
2175
|
-
) {
|
|
2176
|
-
VRMUtils.deepDispose(vrm.scene);
|
|
2177
|
-
return;
|
|
2178
|
-
}
|
|
2179
|
-
vrm.scene.visible = false;
|
|
2180
|
-
vrm.scene.traverse((obj) => {
|
|
2181
|
-
obj.frustumCulled = false;
|
|
2182
|
-
});
|
|
2183
|
-
const avatarParent = this.avatarRoot ?? this.scene;
|
|
2184
|
-
avatarParent.add(vrm.scene);
|
|
2185
|
-
this.vrm = vrm;
|
|
2186
|
-
this.vrmName = name ?? null;
|
|
2187
|
-
this.lastLoadError = null;
|
|
2188
|
-
vrm.springBoneManager?.reset?.();
|
|
2189
|
-
this.blinkController.reset();
|
|
2190
|
-
|
|
2191
|
-
try {
|
|
2192
|
-
await this.loadAndPlayIdle(vrm);
|
|
2193
|
-
if (!this.loadingAborted && this.vrm === vrm) {
|
|
2194
|
-
this.vrmReady = true;
|
|
2195
|
-
// Let the idle animation settle into a natural pose before revealing
|
|
2196
|
-
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
2197
|
-
if (this.loadingAborted || this.vrm !== vrm) return;
|
|
2198
|
-
await this.playTeleportReveal(vrm);
|
|
2199
|
-
vrm.scene.visible = true;
|
|
2200
|
-
this.startPendingWorldReveal(true);
|
|
2201
|
-
this.playWaveGreeting();
|
|
2202
|
-
}
|
|
2203
|
-
} catch {
|
|
2204
|
-
if (!this.loadingAborted && this.vrm === vrm) {
|
|
2205
|
-
this.vrmReady = true;
|
|
2206
|
-
vrm.scene.visible = true;
|
|
2207
|
-
this.startPendingWorldReveal(false);
|
|
2208
|
-
}
|
|
2209
|
-
}
|
|
2210
|
-
}
|
|
2211
|
-
|
|
2212
|
-
private async playTeleportReveal(vrm: VRM): Promise<void> {
|
|
2213
|
-
this.teleportProgress = 0.0;
|
|
2214
|
-
this.revealStarted = true;
|
|
2215
|
-
this.cleanupTeleportDissolve();
|
|
2216
|
-
this.startTeleportSparkles(vrm);
|
|
2217
|
-
let appliedNodeDissolve = false;
|
|
2218
|
-
|
|
2219
|
-
try {
|
|
2220
|
-
const tsl = await import("three/tsl");
|
|
2221
|
-
|
|
2222
|
-
const uProgress = tsl.uniform(0.0);
|
|
2223
|
-
this.teleportProgressUniform = uProgress;
|
|
2224
|
-
|
|
2225
|
-
vrm.scene.traverse((obj: THREE.Object3D) => {
|
|
2226
|
-
if (!(obj instanceof THREE.Mesh)) return;
|
|
2227
|
-
const mats = Array.isArray(obj.material)
|
|
2228
|
-
? obj.material
|
|
2229
|
-
: [obj.material];
|
|
2230
|
-
for (const mat of mats) {
|
|
2231
|
-
if (!mat.isNodeMaterial || mat.userData._dissolveApplied) continue;
|
|
2232
|
-
appliedNodeDissolve = true;
|
|
2233
|
-
mat.userData._dissolveApplied = true;
|
|
2234
|
-
mat.userData._origOpacityNode = mat.opacityNode ?? null;
|
|
2235
|
-
mat.userData._origEmissiveNode =
|
|
2236
|
-
(mat as MeshStandardMaterialWithNodeProps).emissiveNode ?? null;
|
|
2237
|
-
mat.userData._origAlphaTest = mat.alphaTest;
|
|
2238
|
-
|
|
2239
|
-
// World-space Y from TSL
|
|
2240
|
-
const worldY = tsl.positionWorld.y;
|
|
2241
|
-
|
|
2242
|
-
// Sweep threshold starts 1m lower than before.
|
|
2243
|
-
const threshold = uProgress
|
|
2244
|
-
.mul(TELEPORT_DISSOLVE_END_Y - TELEPORT_DISSOLVE_START_Y)
|
|
2245
|
-
.add(TELEPORT_DISSOLVE_START_Y);
|
|
2246
|
-
|
|
2247
|
-
// Distance above dissolve line
|
|
2248
|
-
const diff = worldY.sub(threshold);
|
|
2249
|
-
|
|
2250
|
-
// Dither noise using a hash of world position
|
|
2251
|
-
const noiseCoord = tsl.vec2(
|
|
2252
|
-
worldY.mul(40.0),
|
|
2253
|
-
tsl.positionWorld.x.add(tsl.positionWorld.z).mul(30.0),
|
|
2254
|
-
);
|
|
2255
|
-
const noise = tsl.fract(
|
|
2256
|
-
tsl
|
|
2257
|
-
.sin(tsl.dot(noiseCoord, tsl.vec2(12.9898, 78.233)))
|
|
2258
|
-
.mul(43758.5453),
|
|
2259
|
-
);
|
|
2260
|
-
|
|
2261
|
-
// Ratio: 0 = fully visible, 1 = fully hidden (wider zone = 0.3)
|
|
2262
|
-
const ratio = diff.div(0.3).clamp(0.0, 1.0);
|
|
2263
|
-
|
|
2264
|
-
// Dithered alpha: visible when noise >= ratio
|
|
2265
|
-
const dissolveAlpha = tsl.step(ratio, noise);
|
|
2266
|
-
|
|
2267
|
-
// --- Holographic glow at the dissolve edge ---
|
|
2268
|
-
// Glow is strongest right at the dissolve boundary
|
|
2269
|
-
const edgeDist = diff.abs();
|
|
2270
|
-
const glowWidth = tsl.float(0.15);
|
|
2271
|
-
const glowIntensity = tsl
|
|
2272
|
-
.float(1.0)
|
|
2273
|
-
.sub(edgeDist.div(glowWidth).clamp(0.0, 1.0));
|
|
2274
|
-
// Holographic color: cyan-magenta shift based on world position
|
|
2275
|
-
const hueShift = tsl.fract(worldY.mul(3.0).add(uProgress.mul(2.0)));
|
|
2276
|
-
const holoR = tsl
|
|
2277
|
-
.smoothstep(tsl.float(0.3), tsl.float(0.7), hueShift)
|
|
2278
|
-
.mul(0.8)
|
|
2279
|
-
.add(0.2);
|
|
2280
|
-
const holoG = tsl.float(0.9);
|
|
2281
|
-
const holoB = tsl
|
|
2282
|
-
.smoothstep(tsl.float(0.7), tsl.float(0.3), hueShift)
|
|
2283
|
-
.mul(0.8)
|
|
2284
|
-
.add(0.2);
|
|
2285
|
-
const holoColor = tsl.vec3(holoR, holoG, holoB);
|
|
2286
|
-
|
|
2287
|
-
// Only show glow when dissolve is active and fragment is visible
|
|
2288
|
-
const glowActive = tsl
|
|
2289
|
-
.step(tsl.float(0.001), uProgress)
|
|
2290
|
-
.mul(tsl.float(1.0).sub(tsl.step(tsl.float(0.999), uProgress)));
|
|
2291
|
-
const emissiveBoost = holoColor.mul(
|
|
2292
|
-
glowIntensity.mul(3.0).mul(glowActive).mul(dissolveAlpha),
|
|
2293
|
-
);
|
|
2294
|
-
|
|
2295
|
-
// Compose with existing nodes
|
|
2296
|
-
const origOpacity = mat.opacityNode as
|
|
2297
|
-
| TslMaterialNode
|
|
2298
|
-
| null
|
|
2299
|
-
| undefined;
|
|
2300
|
-
mat.opacityNode = origOpacity
|
|
2301
|
-
? (((origOpacity as { mul: (value: unknown) => unknown }).mul(
|
|
2302
|
-
dissolveAlpha,
|
|
2303
|
-
) as unknown as TslMaterialNode) ?? dissolveAlpha)
|
|
2304
|
-
: dissolveAlpha;
|
|
2305
|
-
|
|
2306
|
-
const matWithEmissive = mat as MeshStandardMaterialWithNodeProps;
|
|
2307
|
-
const origEmissive = matWithEmissive.emissiveNode as
|
|
2308
|
-
| TslMaterialNode
|
|
2309
|
-
| null
|
|
2310
|
-
| undefined;
|
|
2311
|
-
matWithEmissive.emissiveNode = origEmissive
|
|
2312
|
-
? ((origEmissive as { add: (value: unknown) => unknown }).add(
|
|
2313
|
-
emissiveBoost,
|
|
2314
|
-
) as unknown as TslMaterialNode)
|
|
2315
|
-
: (emissiveBoost as TslMaterialNode);
|
|
2316
|
-
|
|
2317
|
-
mat.alphaTest = 0.01;
|
|
2318
|
-
mat.transparent = true;
|
|
2319
|
-
mat.needsUpdate = true;
|
|
2320
|
-
this.teleportDissolvedMaterials.push(mat);
|
|
2321
|
-
}
|
|
2322
|
-
});
|
|
2323
|
-
} catch (err) {
|
|
2324
|
-
console.warn(
|
|
2325
|
-
"[VrmEngine] TSL dissolve unavailable, showing instantly:",
|
|
2326
|
-
err,
|
|
2327
|
-
);
|
|
2328
|
-
}
|
|
2329
|
-
|
|
2330
|
-
if (!appliedNodeDissolve) {
|
|
2331
|
-
this.applyTeleportFallbackDissolve(vrm);
|
|
2332
|
-
}
|
|
2333
|
-
}
|
|
2334
|
-
|
|
2335
|
-
private applyTeleportFallbackDissolve(vrm: VRM): void {
|
|
2336
|
-
vrm.scene.traverse((obj: THREE.Object3D) => {
|
|
2337
|
-
if (!(obj instanceof THREE.Mesh)) return;
|
|
2338
|
-
const mats = Array.isArray(obj.material) ? obj.material : [obj.material];
|
|
2339
|
-
for (const mat of mats) {
|
|
2340
|
-
if (mat.userData._dissolveApplied) continue;
|
|
2341
|
-
mat.userData._dissolveApplied = true;
|
|
2342
|
-
mat.userData._origTransparent = mat.transparent;
|
|
2343
|
-
mat.userData._origAlphaTest = mat.alphaTest;
|
|
2344
|
-
mat.userData._origOnBeforeCompile = mat.onBeforeCompile;
|
|
2345
|
-
mat.userData._origCustomProgramCacheKey = mat.customProgramCacheKey;
|
|
2346
|
-
|
|
2347
|
-
const shaderRef: TeleportFallbackShader = {
|
|
2348
|
-
uniforms: { uTeleportProgress: { value: this.teleportProgress } },
|
|
2349
|
-
};
|
|
2350
|
-
this.teleportFallbackShaders.push(shaderRef);
|
|
2351
|
-
|
|
2352
|
-
mat.transparent = true;
|
|
2353
|
-
mat.alphaTest = Math.max(mat.alphaTest ?? 0, 0.01);
|
|
2354
|
-
mat.onBeforeCompile = (
|
|
2355
|
-
shader: Parameters<THREE.Material["onBeforeCompile"]>[0],
|
|
2356
|
-
) => {
|
|
2357
|
-
shader.uniforms.uTeleportProgress =
|
|
2358
|
-
shaderRef.uniforms.uTeleportProgress;
|
|
2359
|
-
shader.vertexShader = `
|
|
2360
|
-
varying vec3 vTeleportWorldPosition;
|
|
2361
|
-
${shader.vertexShader}
|
|
2362
|
-
`.replace(
|
|
2363
|
-
"#include <worldpos_vertex>",
|
|
2364
|
-
`#include <worldpos_vertex>
|
|
2365
|
-
vTeleportWorldPosition = worldPosition.xyz;`,
|
|
2366
|
-
);
|
|
2367
|
-
shader.fragmentShader = `
|
|
2368
|
-
uniform float uTeleportProgress;
|
|
2369
|
-
varying vec3 vTeleportWorldPosition;
|
|
2370
|
-
float teleportNoiseHash(vec2 p) {
|
|
2371
|
-
return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453);
|
|
2372
|
-
}
|
|
2373
|
-
${shader.fragmentShader}
|
|
2374
|
-
`.replace(
|
|
2375
|
-
"#include <alphatest_fragment>",
|
|
2376
|
-
`float teleportThreshold = mix(${TELEPORT_DISSOLVE_START_Y.toFixed(1)}, ${TELEPORT_DISSOLVE_END_Y.toFixed(1)}, uTeleportProgress);
|
|
2377
|
-
float teleportDiff = vTeleportWorldPosition.y - teleportThreshold;
|
|
2378
|
-
float teleportRatio = clamp(teleportDiff / 0.3, 0.0, 1.0);
|
|
2379
|
-
float teleportNoise = teleportNoiseHash(vec2(
|
|
2380
|
-
vTeleportWorldPosition.y * 40.0,
|
|
2381
|
-
(vTeleportWorldPosition.x + vTeleportWorldPosition.z) * 30.0
|
|
2382
|
-
));
|
|
2383
|
-
if (teleportNoise < teleportRatio) discard;
|
|
2384
|
-
#include <alphatest_fragment>`,
|
|
2385
|
-
);
|
|
2386
|
-
|
|
2387
|
-
const originalOnBeforeCompile = mat.userData._origOnBeforeCompile;
|
|
2388
|
-
if (typeof originalOnBeforeCompile === "function") {
|
|
2389
|
-
originalOnBeforeCompile(
|
|
2390
|
-
shader,
|
|
2391
|
-
this.renderer as THREE.WebGLRenderer,
|
|
2392
|
-
);
|
|
2393
|
-
}
|
|
2394
|
-
};
|
|
2395
|
-
mat.customProgramCacheKey = () =>
|
|
2396
|
-
`${mat.type}:teleport-dissolve-fallback`;
|
|
2397
|
-
mat.needsUpdate = true;
|
|
2398
|
-
this.teleportDissolvedMaterials.push(mat);
|
|
2399
|
-
}
|
|
2400
|
-
});
|
|
2401
|
-
}
|
|
2402
|
-
|
|
2403
|
-
private startTeleportSparkles(vrm: VRM): void {
|
|
2404
|
-
const parent = this.avatarRoot ?? this.scene;
|
|
2405
|
-
if (!parent) return;
|
|
2406
|
-
|
|
2407
|
-
this.cleanupTeleportSparkles();
|
|
2408
|
-
|
|
2409
|
-
const bounds = new THREE.Box3().setFromObject(vrm.scene);
|
|
2410
|
-
const center = bounds.getCenter(new THREE.Vector3());
|
|
2411
|
-
const size = bounds.getSize(new THREE.Vector3());
|
|
2412
|
-
const sparkleGroup = new THREE.Group();
|
|
2413
|
-
sparkleGroup.position.set(center.x, bounds.min.y + 0.06, center.z);
|
|
2414
|
-
parent.add(sparkleGroup);
|
|
2415
|
-
|
|
2416
|
-
const texture = getTeleportSparkleTexture();
|
|
2417
|
-
const particleHeight = THREE.MathUtils.clamp(size.y * 0.82, 0.95, 1.75);
|
|
2418
|
-
const particles: TeleportSparkleParticle[] = [];
|
|
2419
|
-
|
|
2420
|
-
for (let index = 0; index < TELEPORT_SPARKLE_PARTICLE_COUNT; index += 1) {
|
|
2421
|
-
const hue = 0.52 + Math.random() * 0.08;
|
|
2422
|
-
const material = new THREE.SpriteMaterial({
|
|
2423
|
-
map: texture,
|
|
2424
|
-
color: new THREE.Color().setHSL(hue, 0.85, 0.72),
|
|
2425
|
-
transparent: true,
|
|
2426
|
-
opacity: 0,
|
|
2427
|
-
depthWrite: false,
|
|
2428
|
-
blending: THREE.AdditiveBlending,
|
|
2429
|
-
});
|
|
2430
|
-
const sprite = new THREE.Sprite(material);
|
|
2431
|
-
sprite.visible = false;
|
|
2432
|
-
sparkleGroup.add(sprite);
|
|
2433
|
-
|
|
2434
|
-
const duration = 0.3 + Math.random() * 0.32;
|
|
2435
|
-
const maxStart = Math.max(0.02, 0.92 - duration);
|
|
2436
|
-
particles.push({
|
|
2437
|
-
sprite,
|
|
2438
|
-
material,
|
|
2439
|
-
baseAngle:
|
|
2440
|
-
(index / TELEPORT_SPARKLE_PARTICLE_COUNT) * Math.PI * 2 +
|
|
2441
|
-
(Math.random() - 0.5) * 0.55,
|
|
2442
|
-
baseRadius:
|
|
2443
|
-
(0.18 + Math.random() * 0.82) * TELEPORT_SPARKLE_RING_RADIUS,
|
|
2444
|
-
height: particleHeight * (0.55 + Math.random() * 0.55),
|
|
2445
|
-
start: Math.random() * maxStart,
|
|
2446
|
-
duration,
|
|
2447
|
-
spin: (1.8 + Math.random() * 3.6) * (Math.random() > 0.5 ? 1 : -1),
|
|
2448
|
-
wobble: 0.02 + Math.random() * 0.08,
|
|
2449
|
-
wobbleSpeed: 8 + Math.random() * 12,
|
|
2450
|
-
baseSize:
|
|
2451
|
-
TELEPORT_SPARKLE_MIN_SIZE +
|
|
2452
|
-
Math.random() *
|
|
2453
|
-
(TELEPORT_SPARKLE_MAX_SIZE - TELEPORT_SPARKLE_MIN_SIZE),
|
|
2454
|
-
});
|
|
2455
|
-
}
|
|
2456
|
-
|
|
2457
|
-
this.teleportSparkles = {
|
|
2458
|
-
group: sparkleGroup,
|
|
2459
|
-
particles,
|
|
2460
|
-
};
|
|
2461
|
-
this.updateTeleportSparkles();
|
|
2462
|
-
}
|
|
2463
|
-
|
|
2464
|
-
private updateTeleportSparkles(): void {
|
|
2465
|
-
const system = this.teleportSparkles;
|
|
2466
|
-
if (!system) return;
|
|
2467
|
-
|
|
2468
|
-
const progress = THREE.MathUtils.clamp(this.teleportProgress, 0, 1);
|
|
2469
|
-
let anyVisible = false;
|
|
2470
|
-
|
|
2471
|
-
for (const particle of system.particles) {
|
|
2472
|
-
const localProgress = THREE.MathUtils.clamp(
|
|
2473
|
-
(progress - particle.start) / particle.duration,
|
|
2474
|
-
0,
|
|
2475
|
-
1,
|
|
2476
|
-
);
|
|
2477
|
-
|
|
2478
|
-
if (localProgress <= 0 || localProgress >= 1) {
|
|
2479
|
-
particle.material.opacity = 0;
|
|
2480
|
-
particle.sprite.visible = false;
|
|
2481
|
-
continue;
|
|
2482
|
-
}
|
|
2483
|
-
|
|
2484
|
-
anyVisible = true;
|
|
2485
|
-
const rise = 1 - (1 - localProgress) ** 2;
|
|
2486
|
-
const angle = particle.baseAngle + progress * Math.PI * 2 * particle.spin;
|
|
2487
|
-
const wobblePhase = progress * particle.wobbleSpeed + particle.baseAngle;
|
|
2488
|
-
const wobbleOffset = Math.sin(wobblePhase) * particle.wobble;
|
|
2489
|
-
const radial = particle.baseRadius * (1 - 0.48 * rise);
|
|
2490
|
-
const x = Math.cos(angle) * radial + wobbleOffset;
|
|
2491
|
-
const z =
|
|
2492
|
-
Math.sin(angle) * radial + Math.cos(wobblePhase) * particle.wobble;
|
|
2493
|
-
const y =
|
|
2494
|
-
0.08 +
|
|
2495
|
-
particle.height * rise +
|
|
2496
|
-
Math.sin(progress * 10 + particle.baseAngle * 3) * 0.04;
|
|
2497
|
-
const opacity =
|
|
2498
|
-
Math.sin(localProgress * Math.PI) *
|
|
2499
|
-
(0.72 + 0.28 * Math.sin(progress * 22 + particle.baseAngle * 5));
|
|
2500
|
-
const scale = particle.baseSize * (0.7 + (1 - localProgress) * 1.15);
|
|
2501
|
-
|
|
2502
|
-
particle.sprite.visible = opacity > 0.01;
|
|
2503
|
-
particle.sprite.position.set(x, y, z);
|
|
2504
|
-
particle.sprite.scale.setScalar(scale);
|
|
2505
|
-
particle.material.opacity = opacity;
|
|
2506
|
-
}
|
|
2507
|
-
|
|
2508
|
-
if (!anyVisible && progress >= 1) {
|
|
2509
|
-
this.cleanupTeleportSparkles();
|
|
2510
|
-
}
|
|
2511
|
-
}
|
|
2512
|
-
|
|
2513
|
-
private cleanupTeleportDissolve(): void {
|
|
2514
|
-
for (const mat of this.teleportDissolvedMaterials) {
|
|
2515
|
-
if (mat.userData._dissolveApplied) {
|
|
2516
|
-
if (mat.userData._origOpacityNode !== undefined) {
|
|
2517
|
-
(mat as MeshStandardMaterialWithNodeProps).opacityNode =
|
|
2518
|
-
mat.userData._origOpacityNode ?? null;
|
|
2519
|
-
}
|
|
2520
|
-
if (mat.userData._origEmissiveNode !== undefined) {
|
|
2521
|
-
(mat as MeshStandardMaterialWithNodeProps).emissiveNode =
|
|
2522
|
-
mat.userData._origEmissiveNode ?? null;
|
|
2523
|
-
}
|
|
2524
|
-
mat.alphaTest = mat.userData._origAlphaTest ?? 0;
|
|
2525
|
-
mat.transparent = mat.userData._origTransparent ?? mat.transparent;
|
|
2526
|
-
mat.onBeforeCompile =
|
|
2527
|
-
mat.userData._origOnBeforeCompile ?? mat.onBeforeCompile;
|
|
2528
|
-
mat.customProgramCacheKey =
|
|
2529
|
-
mat.userData._origCustomProgramCacheKey ?? mat.customProgramCacheKey;
|
|
2530
|
-
delete mat.userData._dissolveApplied;
|
|
2531
|
-
delete mat.userData._origOpacityNode;
|
|
2532
|
-
delete mat.userData._origEmissiveNode;
|
|
2533
|
-
delete mat.userData._origAlphaTest;
|
|
2534
|
-
delete mat.userData._origTransparent;
|
|
2535
|
-
delete mat.userData._origOnBeforeCompile;
|
|
2536
|
-
delete mat.userData._origCustomProgramCacheKey;
|
|
2537
|
-
mat.needsUpdate = true;
|
|
2538
|
-
}
|
|
2539
|
-
}
|
|
2540
|
-
this.teleportDissolvedMaterials = [];
|
|
2541
|
-
this.teleportProgressUniform = null;
|
|
2542
|
-
this.teleportFallbackShaders = [];
|
|
2543
|
-
}
|
|
2544
|
-
|
|
2545
|
-
private cleanupTeleportSparkles(): void {
|
|
2546
|
-
if (!this.teleportSparkles) return;
|
|
2547
|
-
for (const particle of this.teleportSparkles.particles) {
|
|
2548
|
-
particle.sprite.parent?.remove(particle.sprite);
|
|
2549
|
-
particle.material.dispose();
|
|
2550
|
-
}
|
|
2551
|
-
this.teleportSparkles.group.parent?.remove(this.teleportSparkles.group);
|
|
2552
|
-
this.teleportSparkles = null;
|
|
2553
|
-
}
|
|
2554
|
-
private get animationLoaderContext(): AnimationLoaderContext {
|
|
2555
|
-
return {
|
|
2556
|
-
isAborted: () => this.loadingAborted,
|
|
2557
|
-
isCurrentVrm: (vrm: VRM) => this.vrm === vrm,
|
|
2558
|
-
};
|
|
2559
|
-
}
|
|
2560
|
-
private loop(): void {
|
|
2561
|
-
if (this.paused) return;
|
|
2562
|
-
this.scheduleNextFrame();
|
|
2563
|
-
const renderer = this.renderer;
|
|
2564
|
-
const scene = this.scene;
|
|
2565
|
-
const camera = this.camera;
|
|
2566
|
-
if (!renderer || !scene || !camera) return;
|
|
2567
|
-
const rawDelta = this.clock.getDelta();
|
|
2568
|
-
const stableDelta = Math.min(rawDelta, 1 / 30);
|
|
2569
|
-
this.elapsedTime += rawDelta;
|
|
2570
|
-
this.mixer?.update(rawDelta);
|
|
2571
|
-
if (this.vrm) {
|
|
2572
|
-
if (this.teleportProgress < 1.0) {
|
|
2573
|
-
this.teleportProgress += stableDelta * 2.0; // ~0.5 seconds duration
|
|
2574
|
-
if (this.teleportProgress > 1.0) this.teleportProgress = 1.0;
|
|
2575
|
-
|
|
2576
|
-
if (this.teleportProgressUniform) {
|
|
2577
|
-
this.teleportProgressUniform.value = this.teleportProgress;
|
|
2578
|
-
}
|
|
2579
|
-
for (const shader of this.teleportFallbackShaders) {
|
|
2580
|
-
shader.uniforms.uTeleportProgress.value = this.teleportProgress;
|
|
2581
|
-
}
|
|
2582
|
-
|
|
2583
|
-
if (this.teleportProgress >= 1.0) {
|
|
2584
|
-
this.cleanupTeleportDissolve();
|
|
2585
|
-
this.cleanupTeleportSparkles();
|
|
2586
|
-
}
|
|
2587
|
-
}
|
|
2588
|
-
this.updateTeleportSparkles();
|
|
2589
|
-
|
|
2590
|
-
this.applyMouthToVrm(this.vrm);
|
|
2591
|
-
const blinkValue = this.blinkController.update(rawDelta);
|
|
2592
|
-
this.vrm.expressionManager?.setValue("blink", blinkValue);
|
|
2593
|
-
}
|
|
2594
|
-
this.updateWorldReveal(stableDelta);
|
|
2595
|
-
|
|
2596
|
-
// Process camera transition
|
|
2597
|
-
if (this.isCameraTransitioning) {
|
|
2598
|
-
this.transitionProgress += stableDelta / this.transitionDuration;
|
|
2599
|
-
let finished = false;
|
|
2600
|
-
if (this.transitionProgress >= 1.0) {
|
|
2601
|
-
this.transitionProgress = 1.0;
|
|
2602
|
-
this.isCameraTransitioning = false;
|
|
2603
|
-
finished = true;
|
|
2604
|
-
}
|
|
2605
|
-
|
|
2606
|
-
// Smooth step easing
|
|
2607
|
-
const t = this.transitionProgress;
|
|
2608
|
-
const ease = t * t * (3.0 - 2.0 * t);
|
|
2609
|
-
|
|
2610
|
-
camera.position.lerpVectors(
|
|
2611
|
-
this.transitionStartPos,
|
|
2612
|
-
this.transitionTargetPos,
|
|
2613
|
-
ease,
|
|
2614
|
-
);
|
|
2615
|
-
this.baseCameraPosition.copy(camera.position);
|
|
2616
|
-
|
|
2617
|
-
this.lookAtTarget.lerpVectors(
|
|
2618
|
-
this.transitionStartLookAt,
|
|
2619
|
-
this.transitionTargetLookAt,
|
|
2620
|
-
ease,
|
|
2621
|
-
);
|
|
2622
|
-
|
|
2623
|
-
camera.fov = THREE.MathUtils.lerp(
|
|
2624
|
-
this.transitionStartFov,
|
|
2625
|
-
this.transitionTargetFov,
|
|
2626
|
-
ease,
|
|
2627
|
-
);
|
|
2628
|
-
camera.updateProjectionMatrix();
|
|
2629
|
-
|
|
2630
|
-
if (this.controls) {
|
|
2631
|
-
this.controls.target.copy(this.lookAtTarget);
|
|
2632
|
-
if (finished) {
|
|
2633
|
-
this.controls.update(); // Sync once at the very end when bounds match
|
|
2634
|
-
}
|
|
2635
|
-
}
|
|
2636
|
-
}
|
|
2637
|
-
|
|
2638
|
-
const manualCameraActive = this.interactionEnabled;
|
|
2639
|
-
if (
|
|
2640
|
-
!manualCameraActive &&
|
|
2641
|
-
this.cameraAnimation.enabled &&
|
|
2642
|
-
this.baseCameraPosition.length() > 0 &&
|
|
2643
|
-
!this.isCameraTransitioning
|
|
2644
|
-
) {
|
|
2645
|
-
this.cameraManager.applyCameraMotion(
|
|
2646
|
-
camera,
|
|
2647
|
-
this.baseCameraPosition,
|
|
2648
|
-
this.lookAtTarget,
|
|
2649
|
-
this.cameraAnimation,
|
|
2650
|
-
this.elapsedTime,
|
|
2651
|
-
);
|
|
2652
|
-
}
|
|
2653
|
-
const dragOrbitFollow = Math.min(1, stableDelta * 9);
|
|
2654
|
-
this.dragOrbitCurrent.lerp(this.dragOrbitTarget, dragOrbitFollow);
|
|
2655
|
-
if (
|
|
2656
|
-
this.dragOrbitCurrent.lengthSq() > 1e-6 &&
|
|
2657
|
-
this.baseCameraPosition.lengthSq() > 1e-6
|
|
2658
|
-
) {
|
|
2659
|
-
const orbitOffset = this.tempCameraOrbitOffset
|
|
2660
|
-
.copy(camera.position)
|
|
2661
|
-
.sub(this.lookAtTarget);
|
|
2662
|
-
if (orbitOffset.lengthSq() > 1e-6) {
|
|
2663
|
-
const spherical = this.tempCameraSpherical.setFromVector3(orbitOffset);
|
|
2664
|
-
spherical.theta += this.dragOrbitCurrent.x;
|
|
2665
|
-
spherical.phi = THREE.MathUtils.clamp(
|
|
2666
|
-
spherical.phi + this.dragOrbitCurrent.y,
|
|
2667
|
-
0.2,
|
|
2668
|
-
Math.PI - 0.2,
|
|
2669
|
-
);
|
|
2670
|
-
orbitOffset.setFromSpherical(spherical);
|
|
2671
|
-
camera.position.copy(this.lookAtTarget).add(orbitOffset);
|
|
2672
|
-
}
|
|
2673
|
-
}
|
|
2674
|
-
this.applyCompanionZoom(camera, stableDelta);
|
|
2675
|
-
this.updateSparkPerformanceProfile();
|
|
2676
|
-
if (this.pointerParallaxEnabled) {
|
|
2677
|
-
const follow = Math.min(1, stableDelta * 7.5);
|
|
2678
|
-
this.pointerParallaxCurrent.lerp(this.pointerParallaxTarget, follow);
|
|
2679
|
-
this.pointerParallaxPosition.set(
|
|
2680
|
-
this.pointerParallaxCurrent.x * 0.18,
|
|
2681
|
-
this.pointerParallaxCurrent.y * 0.12,
|
|
2682
|
-
0,
|
|
2683
|
-
);
|
|
2684
|
-
camera.position.add(this.pointerParallaxPosition);
|
|
2685
|
-
this.pointerParallaxLookAt
|
|
2686
|
-
.copy(this.lookAtTarget)
|
|
2687
|
-
.add(
|
|
2688
|
-
new THREE.Vector3(
|
|
2689
|
-
this.pointerParallaxCurrent.x * 0.08,
|
|
2690
|
-
this.pointerParallaxCurrent.y * 0.05,
|
|
2691
|
-
0,
|
|
2692
|
-
),
|
|
2693
|
-
);
|
|
2694
|
-
} else {
|
|
2695
|
-
this.pointerParallaxCurrent.lerp(this.pointerParallaxTarget, 0.12);
|
|
2696
|
-
this.pointerParallaxLookAt.copy(this.lookAtTarget);
|
|
2697
|
-
}
|
|
2698
|
-
if (this.controls) {
|
|
2699
|
-
if (manualCameraActive && !this.isCameraTransitioning) {
|
|
2700
|
-
this.controls.update();
|
|
2701
|
-
this.lookAtTarget.copy(this.controls.target);
|
|
2702
|
-
} else if (!this.isCameraTransitioning) {
|
|
2703
|
-
this.controls.target.copy(this.lookAtTarget);
|
|
2704
|
-
}
|
|
2705
|
-
}
|
|
2706
|
-
if (!manualCameraActive || this.isCameraTransitioning) {
|
|
2707
|
-
camera.lookAt(this.pointerParallaxLookAt);
|
|
2708
|
-
}
|
|
2709
|
-
if (this.vrm) {
|
|
2710
|
-
this.updateAvatarLookTarget(camera, stableDelta);
|
|
2711
|
-
this.vrm.update(stableDelta);
|
|
2712
|
-
this.applyAvatarHeadTracking(camera, stableDelta);
|
|
2713
|
-
this.refreshAvatarEyeTracking();
|
|
2714
|
-
}
|
|
2715
|
-
this.updateSparkDepthOfField(camera);
|
|
2716
|
-
renderer.render(scene, camera);
|
|
2717
|
-
this.onUpdate?.();
|
|
2718
|
-
}
|
|
2719
|
-
private disposeWorld(): void {
|
|
2720
|
-
if (this.sparkRenderer) {
|
|
2721
|
-
this.sparkRenderer.apertureAngle = 0;
|
|
2722
|
-
}
|
|
2723
|
-
this.cancelWorldReveal();
|
|
2724
|
-
this.disposeSplatMesh(this.worldMesh);
|
|
2725
|
-
this.worldMesh = null;
|
|
2726
|
-
}
|
|
2727
|
-
private async loadAndPlayIdle(vrm: VRM): Promise<void> {
|
|
2728
|
-
if (this.loadingAborted) return;
|
|
2729
|
-
const mixer = this.mixer ?? new THREE.AnimationMixer(vrm.scene);
|
|
2730
|
-
this.mixer = mixer;
|
|
2731
|
-
const action = await this.ensureIdleAction(vrm, mixer);
|
|
2732
|
-
if (!action) return;
|
|
2733
|
-
action.fadeIn(0.25);
|
|
2734
|
-
action.play();
|
|
2735
|
-
mixer.update(1 / 60);
|
|
2736
|
-
}
|
|
2737
|
-
private async loadEmoteClipCached(
|
|
2738
|
-
path: string,
|
|
2739
|
-
vrm: VRM,
|
|
2740
|
-
): Promise<THREE.AnimationClip | null> {
|
|
2741
|
-
const cached = this.emoteClipCache.get(path);
|
|
2742
|
-
if (cached) return cached;
|
|
2743
|
-
const clip = await loadEmoteClip(path, vrm, this.animationLoaderContext);
|
|
2744
|
-
if (clip) {
|
|
2745
|
-
this.emoteClipCache.set(path, clip);
|
|
2746
|
-
}
|
|
2747
|
-
return clip;
|
|
2748
|
-
}
|
|
2749
|
-
private applyMouthToVrm(vrm: VRM): void {
|
|
2750
|
-
const manager = vrm.expressionManager;
|
|
2751
|
-
if (!manager) return;
|
|
2752
|
-
let target: number;
|
|
2753
|
-
if (this.speaking) {
|
|
2754
|
-
const elapsed = this.elapsedTime - this.speakingStartTime;
|
|
2755
|
-
const base = Math.sin(elapsed * 12) * 0.3 + 0.4;
|
|
2756
|
-
const detail = Math.sin(elapsed * 18.7) * 0.15;
|
|
2757
|
-
const slow = Math.sin(elapsed * 4.2) * 0.1;
|
|
2758
|
-
target = Math.max(0, Math.min(1, base + detail + slow));
|
|
2759
|
-
} else {
|
|
2760
|
-
target = this.mouthValue;
|
|
2761
|
-
}
|
|
2762
|
-
const next = Math.max(0, Math.min(1, target));
|
|
2763
|
-
const alpha = next > this.mouthSmoothed ? 0.3 : 0.2;
|
|
2764
|
-
this.mouthSmoothed = this.mouthSmoothed * (1 - alpha) + next * alpha;
|
|
2765
|
-
manager.setValue("aa", this.mouthSmoothed);
|
|
2766
|
-
}
|
|
2767
|
-
}
|