agentscape3d 1.0.0-beta.1 → 1.0.0-beta.2
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/README.md +23 -48
- package/dist/core.d.ts +68 -0
- package/dist/core.js +209 -0
- package/dist/core.js.map +1 -0
- package/dist/index.d.ts +10 -229
- package/dist/index.js +192 -15462
- package/dist/index.js.map +1 -1
- package/package.json +11 -40
- package/cli.mjs +0 -27
- package/dist/AssetCompiler-CDFiElji.js +0 -2451
- package/dist/AssetCompiler-CDFiElji.js.map +0 -1
- package/dist/AssetInputContracts-Dy8iU4eT.js +0 -228
- package/dist/AssetInputContracts-Dy8iU4eT.js.map +0 -1
- package/dist/AssetRecipe-DmFpzxr-.js +0 -55
- package/dist/AssetRecipe-DmFpzxr-.js.map +0 -1
- package/dist/BrowserCodeWorker.js +0 -53615
- package/dist/KinematicHypothesisScreen-D-z6qgMB.js +0 -242
- package/dist/KinematicHypothesisScreen-D-z6qgMB.js.map +0 -1
- package/dist/SceneSerializer-DPVOyeRk.js +0 -353
- package/dist/SceneSerializer-DPVOyeRk.js.map +0 -1
- package/dist/StylePack-DNrdLeGI.js +0 -6314
- package/dist/StylePack-DNrdLeGI.js.map +0 -1
- package/dist/WorldArchive-pSBIGxLa.js +0 -420
- package/dist/WorldArchive-pSBIGxLa.js.map +0 -1
- package/dist/WorldIO-wsDfZGM4.js +0 -150
- package/dist/WorldIO-wsDfZGM4.js.map +0 -1
- package/dist/blankWorld-CBWbwJGj.js +0 -76
- package/dist/blankWorld-CBWbwJGj.js.map +0 -1
- package/dist/disposeObject3D-BQ9TyVC_.js +0 -54
- package/dist/disposeObject3D-BQ9TyVC_.js.map +0 -1
- package/dist/environments-DgH66NqV.js +0 -4220
- package/dist/environments-DgH66NqV.js.map +0 -1
- package/dist/gltfIO-B87nJaat.js +0 -10
- package/dist/gltfIO-B87nJaat.js.map +0 -1
- package/dist/grandUrbanBlock-Ob9pN-CB.js +0 -516
- package/dist/grandUrbanBlock-Ob9pN-CB.js.map +0 -1
- package/dist/magicCabin-D64fD1E2.js +0 -11024
- package/dist/magicCabin-D64fD1E2.js.map +0 -1
- package/dist/mcp.d.ts +0 -2
- package/dist/mcp.js +0 -1
- package/dist/monumentHall-BKbs0UOQ.js +0 -404
- package/dist/monumentHall-BKbs0UOQ.js.map +0 -1
- package/dist/node.d.ts +0 -16
- package/dist/node.js +0 -25
- package/dist/ruinedCourtyard-BoZxHldu.js +0 -697
- package/dist/ruinedCourtyard-BoZxHldu.js.map +0 -1
- package/dist/runtime/application/AgentTools.js +0 -25
- package/dist/runtime/application/README.md +0 -14
- package/dist/runtime/application/buildTaskObservation.js +0 -117
- package/dist/runtime/application/code-execution/AuthoringSandboxEntry.js +0 -46
- package/dist/runtime/application/code-execution/BrowserCodeExecutor.js +0 -35
- package/dist/runtime/application/code-execution/BrowserCodeWorker.js +0 -17
- package/dist/runtime/application/code-execution/RemoteAuthoringDocument.js +0 -72
- package/dist/runtime/application/createSession.js +0 -66
- package/dist/runtime/application/createWorldAuthoringContext.js +0 -400
- package/dist/runtime/application/generation/GenerationOrchestrator.js +0 -629
- package/dist/runtime/application/generation/GenerationRuntime.js +0 -214
- package/dist/runtime/application/generation/PromptHybridWorldOrchestrator.js +0 -285
- package/dist/runtime/application/native-scene/CodeProject.js +0 -119
- package/dist/runtime/application/native-scene/CodeProjectModules.js +0 -128
- package/dist/runtime/application/native-scene/NativeEnvironmentGeometry.js +0 -62
- package/dist/runtime/application/native-scene/NativeOverlayCheckpoint.js +0 -127
- package/dist/runtime/application/native-scene/NativeRenderDiscovery.js +0 -51
- package/dist/runtime/application/native-scene/NativeSceneHost.js +0 -164
- package/dist/runtime/application/native-scene/NativeSceneOverlay.js +0 -116
- package/dist/runtime/application/native-scene/NativeThreeModule.js +0 -16
- package/dist/runtime/application/object-forge/SceneObjectForge.js +0 -232
- package/dist/runtime/application/programmatic-assets/ProgrammaticAssetBuilder.js +0 -54
- package/dist/runtime/application/programmatic-assets/ProgrammaticAssetContract.js +0 -22
- package/dist/runtime/application/programmatic-assets/ThreeCodeAsset.js +0 -40
- package/dist/runtime/application/scene/CapabilityResolver.js +0 -79
- package/dist/runtime/application/scene/RequestWindow.js +0 -54
- package/dist/runtime/application/scene/SceneAgentTools.js +0 -21
- package/dist/runtime/application/scene/SceneContracts.js +0 -45
- package/dist/runtime/application/scene/SceneEditService.js +0 -144
- package/dist/runtime/application/scene/SceneFacade.js +0 -267
- package/dist/runtime/application/scene/SceneInteractionAdapters.js +0 -40
- package/dist/runtime/application/scene/SceneJobController.js +0 -229
- package/dist/runtime/application/scene/ScenePackage.js +0 -162
- package/dist/runtime/application/scene/ScenePersistence.js +0 -50
- package/dist/runtime/application/scene/SceneProject.js +0 -95
- package/dist/runtime/application/scene/SceneSkillNames.js +0 -5
- package/dist/runtime/application/scene/StarterScene.js +0 -56
- package/dist/runtime/application/scene/WorldArchive.js +0 -87
- package/dist/runtime/application/scene/WorldDirectory.js +0 -20
- package/dist/runtime/application/scene/WorldDocument.js +0 -74
- package/dist/runtime/application/scene/WorldIO.js +0 -103
- package/dist/runtime/application/scene/WorldStorage.js +0 -137
- package/dist/runtime/application/skills/SkillRegistry.js +0 -163
- package/dist/runtime/application/skills/packs/acceptanceSkills.js +0 -32
- package/dist/runtime/application/skills/packs/affordanceSkills.js +0 -36
- package/dist/runtime/application/skills/packs/assetSkills.js +0 -46
- package/dist/runtime/application/skills/packs/authoringSkills.js +0 -16
- package/dist/runtime/application/skills/packs/batchSkills.js +0 -22
- package/dist/runtime/application/skills/packs/codeSkills.js +0 -106
- package/dist/runtime/application/skills/packs/generationSkills.js +0 -45
- package/dist/runtime/application/skills/packs/interactionSkills.js +0 -46
- package/dist/runtime/application/skills/packs/recoverySkills.js +0 -80
- package/dist/runtime/application/skills/packs/sceneSkills.js +0 -24
- package/dist/runtime/application/skills/packs/spatialSkills.js +0 -35
- package/dist/runtime/application/skills/packs/verificationSkills.js +0 -14
- package/dist/runtime/application/skills/packs/worldSkills.js +0 -45
- package/dist/runtime/application/skills/registerCoreSkills.js +0 -31
- package/dist/runtime/application/skills/skillPrimitives.js +0 -4
- package/dist/runtime/application/tasks/CabinetCupTask.js +0 -76
- package/dist/runtime/application/tasks.jsonl +0 -67
- package/dist/runtime/application/world-authoring/AuthoringAssetProducer.js +0 -42
- package/dist/runtime/application/world-authoring/AuthoringDiff.js +0 -149
- package/dist/runtime/application/world-authoring/AuthoringDocument.js +0 -825
- package/dist/runtime/application/world-authoring/AuthoringExecutionHost.js +0 -109
- package/dist/runtime/application/world-authoring/AuthoringIdentity.js +0 -17
- package/dist/runtime/application/world-authoring/AuthoringModelResolver.js +0 -29
- package/dist/runtime/application/world-authoring/AuthoringPatch.js +0 -118
- package/dist/runtime/application/world-authoring/AuthoringPromotionController.js +0 -334
- package/dist/runtime/application/world-authoring/AuthoringPromotionSource.js +0 -126
- package/dist/runtime/application/world-authoring/AuthoringRevisionHistory.js +0 -144
- package/dist/runtime/application/world-authoring/HeadlessImageExport.js +0 -174
- package/dist/runtime/application/world-authoring/ModelRef.js +0 -62
- package/dist/runtime/apps/mcp-server/AUTHORING.md +0 -71
- package/dist/runtime/apps/mcp-server/AuthoringSandboxEntry.js +0 -1
- package/dist/runtime/apps/mcp-server/AuthoringSandboxWorker.mjs +0 -30
- package/dist/runtime/apps/mcp-server/BuildEnvironment.js +0 -17
- package/dist/runtime/apps/mcp-server/CodeExecutor.js +0 -71
- package/dist/runtime/apps/mcp-server/DEPLOYMENT-PC2.md +0 -42
- package/dist/runtime/apps/mcp-server/DockerBuildRunner.js +0 -66
- package/dist/runtime/apps/mcp-server/FileAssetRepository.js +0 -159
- package/dist/runtime/apps/mcp-server/HeadlessAssetIO.js +0 -8
- package/dist/runtime/apps/mcp-server/HeadlessGLTFLoader.js +0 -47
- package/dist/runtime/apps/mcp-server/HeadlessWorldHost.js +0 -132
- package/dist/runtime/apps/mcp-server/IsolatedAuthoringExecutor.js +0 -6
- package/dist/runtime/apps/mcp-server/PROGRAMMATIC-ASSETS.md +0 -116
- package/dist/runtime/apps/mcp-server/ProgrammaticAssets.js +0 -60
- package/dist/runtime/apps/mcp-server/README.md +0 -150
- package/dist/runtime/apps/mcp-server/RemoteAuthoringDocument.js +0 -1
- package/dist/runtime/apps/mcp-server/SandboxBundle.js +0 -13
- package/dist/runtime/apps/mcp-server/SessionManager.js +0 -80
- package/dist/runtime/apps/mcp-server/StudioBridgeHttp.js +0 -58
- package/dist/runtime/apps/mcp-server/StudioLiveBridge.js +0 -190
- package/dist/runtime/apps/mcp-server/TrustedAuthoringWorker.mjs +0 -16
- package/dist/runtime/apps/mcp-server/VALIDATION.md +0 -45
- package/dist/runtime/apps/mcp-server/acceptance-evidence.json +0 -332
- package/dist/runtime/apps/mcp-server/errorDiagnostics.js +0 -32
- package/dist/runtime/apps/mcp-server/examples/code-house.js +0 -24
- package/dist/runtime/apps/mcp-server/examples/procedural-assets.js +0 -37
- package/dist/runtime/apps/mcp-server/main.mjs +0 -56
- package/dist/runtime/apps/mcp-server/registerTools.js +0 -215
- package/dist/runtime/apps/mcp-server/sandbox/run.mjs +0 -23
- package/dist/runtime/apps/mcp-server/security.js +0 -21
- package/dist/runtime/apps/mcp-server/tasks.jsonl +0 -9
- package/dist/runtime/apps/server/CapabilityAdapterRegistry.js +0 -157
- package/dist/runtime/apps/server/README.md +0 -7
- package/dist/runtime/apps/server/WorldDiskStorage.js +0 -51
- package/dist/runtime/apps/server/openai-compatible-agent-gateway.mjs +0 -278
- package/dist/runtime/apps/server/tasks.jsonl +0 -10
- package/dist/runtime/foundation/EventBus.js +0 -18
- package/dist/runtime/foundation/JsonGateway.js +0 -47
- package/dist/runtime/foundation/PolicyEngine.js +0 -21
- package/dist/runtime/foundation/README.md +0 -7
- package/dist/runtime/foundation/TraceRecorder.js +0 -76
- package/dist/runtime/foundation/errors.js +0 -8
- package/dist/runtime/foundation/simulation/SimulationProfile.js +0 -143
- package/dist/runtime/foundation/version.js +0 -2
- package/dist/runtime/modules/agent/README.md +0 -11
- package/dist/runtime/modules/agent/ToolCallingAgent.js +0 -19
- package/dist/runtime/modules/agent/bootstrapWorld.js +0 -10
- package/dist/runtime/modules/agent/buildRecoveryProposals.js +0 -533
- package/dist/runtime/modules/agent/execution/AgentExecutionRules.js +0 -127
- package/dist/runtime/modules/agent/execution/AgentRunResults.js +0 -55
- package/dist/runtime/modules/agent/execution/AgentRunSession.js +0 -390
- package/dist/runtime/modules/agent/execution/AgentToolInvoker.js +0 -39
- package/dist/runtime/modules/agent/gateway/HttpLLMGateway.js +0 -19
- package/dist/runtime/modules/agent/prompt/index.js +0 -46
- package/dist/runtime/modules/agent/tasks.jsonl +0 -94
- package/dist/runtime/modules/artifact/ArtifactContentGate.js +0 -144
- package/dist/runtime/modules/artifact/ArtifactDescriptor.js +0 -280
- package/dist/runtime/modules/artifact/ArtifactImporter.js +0 -185
- package/dist/runtime/modules/artifact/ArtifactModule.js +0 -111
- package/dist/runtime/modules/artifact/ArtifactRegistry.js +0 -197
- package/dist/runtime/modules/artifact/IncrementalSha256.js +0 -129
- package/dist/runtime/modules/artifact/MemoryArtifactByteStore.js +0 -115
- package/dist/runtime/modules/artifact/README.md +0 -7
- package/dist/runtime/modules/artifact/storage/IndexedDbArtifactStore.js +0 -67
- package/dist/runtime/modules/artifact/tasks.jsonl +0 -31
- package/dist/runtime/modules/asset/AssetModule.js +0 -399
- package/dist/runtime/modules/asset/README.md +0 -54
- package/dist/runtime/modules/asset/loading/AssetLoader.js +0 -157
- package/dist/runtime/modules/asset/loading/GltfAssetLoader.js +0 -61
- package/dist/runtime/modules/asset/loading/builtins/BuiltinAssets.js +0 -95
- package/dist/runtime/modules/asset/loading/builtins/HouseDoor.js +0 -33
- package/dist/runtime/modules/asset/loading/builtins/IndustrialCabinet.js +0 -103
- package/dist/runtime/modules/asset/model/AssetInputContracts.js +0 -95
- package/dist/runtime/modules/asset/model/AssetRef.js +0 -12
- package/dist/runtime/modules/asset/model/MechanicalAssetDraft.js +0 -172
- package/dist/runtime/modules/asset/model/admission.js +0 -117
- package/dist/runtime/modules/asset/model/errors.js +0 -6
- package/dist/runtime/modules/asset/model/parts.js +0 -27
- package/dist/runtime/modules/asset/model/resourceBudget.js +0 -10
- package/dist/runtime/modules/asset/model/schema.js +0 -150
- package/dist/runtime/modules/asset/persistence/AssetManifestStore.js +0 -78
- package/dist/runtime/modules/asset/persistence/CompiledAssetStore.js +0 -84
- package/dist/runtime/modules/asset/persistence/LocalAssetLibrary.js +0 -86
- package/dist/runtime/modules/asset/persistence/LocalAssetLibraryStore.js +0 -81
- package/dist/runtime/modules/asset/production/AssetProductionPipeline.js +0 -272
- package/dist/runtime/modules/asset/production/AssetRecipe.js +0 -32
- package/dist/runtime/modules/asset/production/adapters/EmbodiedGenAdapter.js +0 -45
- package/dist/runtime/modules/asset/production/adapters/EmbodiedGenBundleAdapter.js +0 -590
- package/dist/runtime/modules/asset/production/compiler/AssetCompiler.js +0 -173
- package/dist/runtime/modules/asset/production/compiler/evidence/AnimationMotionEvidence.js +0 -124
- package/dist/runtime/modules/asset/production/compiler/evidence/StaticPanelEvidence.js +0 -56
- package/dist/runtime/modules/asset/production/compiler/gltfIO.js +0 -6
- package/dist/runtime/modules/asset/production/compiler/partGeometry.js +0 -74
- package/dist/runtime/modules/asset/production/compiler/passes/ArticulatedCollisionPass.js +0 -63
- package/dist/runtime/modules/asset/production/compiler/passes/ArticulationCandidatePass.js +0 -48
- package/dist/runtime/modules/asset/production/compiler/passes/AuthoringIntentPass.js +0 -16
- package/dist/runtime/modules/asset/production/compiler/passes/ColliderFallbackPass.js +0 -30
- package/dist/runtime/modules/asset/production/compiler/passes/CompileQualityPass.js +0 -75
- package/dist/runtime/modules/asset/production/compiler/passes/ExplicitDefinitionPass.js +0 -20
- package/dist/runtime/modules/asset/production/compiler/passes/GLTFInspectPass.js +0 -34
- package/dist/runtime/modules/asset/production/compiler/passes/GeometryPass.js +0 -32
- package/dist/runtime/modules/asset/production/compiler/passes/JointFramePass.js +0 -116
- package/dist/runtime/modules/asset/production/compiler/passes/KinematicEvidencePass.js +0 -84
- package/dist/runtime/modules/asset/production/compiler/passes/ManifestPass.js +0 -63
- package/dist/runtime/modules/asset/production/compiler/passes/NormalizeTransformPass.js +0 -16
- package/dist/runtime/modules/asset/production/compiler/passes/OptimizeGLBPass.js +0 -23
- package/dist/runtime/modules/asset/production/compiler/passes/PartColliderPass.js +0 -50
- package/dist/runtime/modules/asset/production/compiler/passes/PartGeometryEnrichmentPass.js +0 -60
- package/dist/runtime/modules/asset/production/compiler/passes/PartProposalPass.js +0 -93
- package/dist/runtime/modules/asset/production/compiler/passes/RemoteEnrichmentPass.js +0 -32
- package/dist/runtime/modules/asset/production/compiler/passes/ResourceBudgetPass.js +0 -55
- package/dist/runtime/modules/asset/production/compiler/passes/SegmentMaterializePass.js +0 -203
- package/dist/runtime/modules/asset/production/compiler/passes/SegmentationEvidencePass.js +0 -43
- package/dist/runtime/modules/asset/production/compiler/passes/SemanticHeuristicPass.js +0 -33
- package/dist/runtime/modules/asset/production/compiler/passes/StructurePass.js +0 -60
- package/dist/runtime/modules/asset/production/compiler/providers/HttpCompilerProvider.js +0 -23
- package/dist/runtime/modules/asset/production/verification/KinematicHypothesisScreen.js +0 -198
- package/dist/runtime/modules/asset/registry/AssetCatalog.js +0 -72
- package/dist/runtime/modules/asset/registry/AssetRegistry.js +0 -51
- package/dist/runtime/modules/asset/registry/manifests/index.js +0 -173
- package/dist/runtime/modules/asset/tasks.jsonl +0 -87
- package/dist/runtime/modules/generation/README.md +0 -9
- package/dist/runtime/modules/generation/connector/ConnectorArtifactClient.js +0 -45
- package/dist/runtime/modules/generation/connector/ConnectorCapabilityAdapter.js +0 -169
- package/dist/runtime/modules/generation/connector/ConnectorClient.js +0 -192
- package/dist/runtime/modules/generation/connector/ConnectorJobClient.js +0 -167
- package/dist/runtime/modules/generation/connector/ConnectorJobEventClient.js +0 -179
- package/dist/runtime/modules/generation/connector/ConnectorSession.js +0 -202
- package/dist/runtime/modules/generation/jobs/GenerationJobProjection.js +0 -239
- package/dist/runtime/modules/generation/jobs/GenerationJobReconciler.js +0 -99
- package/dist/runtime/modules/generation/jobs/GenerationJobStore.js +0 -91
- package/dist/runtime/modules/generation/jobs/GenerationJobTransportOverlay.js +0 -50
- package/dist/runtime/modules/generation/providers/ProviderRegistry.js +0 -304
- package/dist/runtime/modules/generation/tasks.jsonl +0 -35
- package/dist/runtime/modules/navigation/NavigationBackend.js +0 -17
- package/dist/runtime/modules/navigation/RecastNavigationBackend.js +0 -245
- package/dist/runtime/modules/physics/JoltPhysicsBackend.js +0 -850
- package/dist/runtime/modules/physics/PhysicsApiSurface.js +0 -651
- package/dist/runtime/modules/physics/PhysicsBackend.js +0 -88
- package/dist/runtime/modules/physics/RapierPhysicsBackend.js +0 -410
- package/dist/runtime/modules/rendering/README.md +0 -7
- package/dist/runtime/modules/rendering/RendererProbe.js +0 -153
- package/dist/runtime/modules/rendering/WebGpuPostFxPipeline.js +0 -140
- package/dist/runtime/modules/rendering/createRenderer.js +0 -76
- package/dist/runtime/modules/rendering/disposeObject3D.js +0 -34
- package/dist/runtime/modules/rendering/loadGaussianSplatVisual.js +0 -74
- package/dist/runtime/modules/rendering/style/StylePack.js +0 -34
- package/dist/runtime/modules/rendering/style/StyleSystem.js +0 -173
- package/dist/runtime/modules/rendering/tasks.jsonl +0 -7
- package/dist/runtime/modules/world/README.md +0 -13
- package/dist/runtime/modules/world/build/WorldBuilder.js +0 -170
- package/dist/runtime/modules/world/compiler/PipelineEngine.js +0 -32
- package/dist/runtime/modules/world/compiler/WorldAdmission.js +0 -43
- package/dist/runtime/modules/world/compiler/WorldBehaviorCompiler.js +0 -68
- package/dist/runtime/modules/world/compiler/WorldCompilation.js +0 -157
- package/dist/runtime/modules/world/compiler/WorldComposer.js +0 -201
- package/dist/runtime/modules/world/compiler/WorldPhysicsAdmission.js +0 -76
- package/dist/runtime/modules/world/compiler/WorldRecompiler.js +0 -356
- package/dist/runtime/modules/world/compiler/WorldRetry.js +0 -75
- package/dist/runtime/modules/world/compiler/createWorldPipeline.js +0 -379
- package/dist/runtime/modules/world/content/blankWorld.js +0 -35
- package/dist/runtime/modules/world/content/environments.js +0 -84
- package/dist/runtime/modules/world/content/grandUrbanBlock.js +0 -189
- package/dist/runtime/modules/world/content/magic-cabin/README.md +0 -28
- package/dist/runtime/modules/world/content/magic-cabin/affordances.js +0 -64
- package/dist/runtime/modules/world/content/magic-cabin/cabinContents.js +0 -7078
- package/dist/runtime/modules/world/content/magic-cabin/lighting.js +0 -26
- package/dist/runtime/modules/world/content/magic-cabin/materials.js +0 -20
- package/dist/runtime/modules/world/content/magicCabin.js +0 -190
- package/dist/runtime/modules/world/content/monumentHall.js +0 -154
- package/dist/runtime/modules/world/content/ruinedCourtyard.js +0 -196
- package/dist/runtime/modules/world/content/suzhouGarden/README.md +0 -141
- package/dist/runtime/modules/world/content/suzhouGarden/index.js +0 -137
- package/dist/runtime/modules/world/content/suzhouGarden/src/arch.js +0 -491
- package/dist/runtime/modules/world/content/suzhouGarden/src/buildings.js +0 -670
- package/dist/runtime/modules/world/content/suzhouGarden/src/core.js +0 -578
- package/dist/runtime/modules/world/content/suzhouGarden/src/lod.js +0 -127
- package/dist/runtime/modules/world/content/suzhouGarden/src/main.js +0 -642
- package/dist/runtime/modules/world/content/suzhouGarden/src/nature.js +0 -650
- package/dist/runtime/modules/world/content/suzhouGarden/src/rockery.js +0 -280
- package/dist/runtime/modules/world/content/suzhouGarden/src/sky.js +0 -242
- package/dist/runtime/modules/world/content/suzhouGarden/src/water.js +0 -215
- package/dist/runtime/modules/world/content/woodlandWorkshop.js +0 -192
- package/dist/runtime/modules/world/content/yuanmingyuan/README.md +0 -36
- package/dist/runtime/modules/world/content/yuanmingyuan/arch.js +0 -351
- package/dist/runtime/modules/world/content/yuanmingyuan/buildings.js +0 -490
- package/dist/runtime/modules/world/content/yuanmingyuan/core.js +0 -505
- package/dist/runtime/modules/world/content/yuanmingyuan/index.js +0 -101
- package/dist/runtime/modules/world/content/yuanmingyuan/nature.js +0 -435
- package/dist/runtime/modules/world/content/yuanmingyuan/sky.js +0 -169
- package/dist/runtime/modules/world/content/yuanmingyuan/water.js +0 -245
- package/dist/runtime/modules/world/errors.js +0 -9
- package/dist/runtime/modules/world/generated/GeneratedWorldCoordinates.js +0 -50
- package/dist/runtime/modules/world/generated/GeneratedWorldLoader.js +0 -297
- package/dist/runtime/modules/world/runtime/CommandHistory.js +0 -80
- package/dist/runtime/modules/world/runtime/ObjectStore.js +0 -31
- package/dist/runtime/modules/world/runtime/ObjectTransform.js +0 -62
- package/dist/runtime/modules/world/runtime/ObservedEntity.js +0 -37
- package/dist/runtime/modules/world/runtime/ProjectCapabilities.js +0 -207
- package/dist/runtime/modules/world/runtime/SceneSerializer.js +0 -246
- package/dist/runtime/modules/world/runtime/WorldAuthority.js +0 -41
- package/dist/runtime/modules/world/runtime/WorldCollisionSignature.js +0 -14
- package/dist/runtime/modules/world/runtime/WorldCommands.js +0 -502
- package/dist/runtime/modules/world/runtime/WorldObservation.js +0 -71
- package/dist/runtime/modules/world/runtime/WorldQueries.js +0 -340
- package/dist/runtime/modules/world/runtime/WorldRecovery.js +0 -78
- package/dist/runtime/modules/world/runtime/WorldRuntime.js +0 -649
- package/dist/runtime/modules/world/runtime/affordance/ObjectAffordances.js +0 -107
- package/dist/runtime/modules/world/runtime/affordance/WorldAffordances.js +0 -130
- package/dist/runtime/modules/world/runtime/behavior/BehaviorCompiler.js +0 -79
- package/dist/runtime/modules/world/runtime/behavior/ProjectStateMachine.js +0 -195
- package/dist/runtime/modules/world/runtime/behavior/RuleGraph.js +0 -70
- package/dist/runtime/modules/world/runtime/behavior/RuleRuntime.js +0 -115
- package/dist/runtime/modules/world/runtime/graph/SceneGraph.js +0 -216
- package/dist/runtime/modules/world/runtime/interaction/ArticulationRuntime.js +0 -214
- package/dist/runtime/modules/world/runtime/interaction/CarryCapability.js +0 -65
- package/dist/runtime/modules/world/runtime/interaction/CarryRuntime.js +0 -222
- package/dist/runtime/modules/world/runtime/interaction/InteractionApproach.js +0 -130
- package/dist/runtime/modules/world/runtime/interaction/InteractionContract.js +0 -57
- package/dist/runtime/modules/world/runtime/interaction/RecoveryRuntime.js +0 -123
- package/dist/runtime/modules/world/runtime/interaction/SettleRuntime.js +0 -120
- package/dist/runtime/modules/world/runtime/semantic/SemanticWorldView.js +0 -102
- package/dist/runtime/modules/world/runtime/simulation/SimulationClock.js +0 -89
- package/dist/runtime/modules/world/runtime/simulation/SimulationSession.js +0 -99
- package/dist/runtime/modules/world/runtime/simulation/ThermalSystem.js +0 -269
- package/dist/runtime/modules/world/runtime/spatial/SpatialSnapshot.js +0 -56
- package/dist/runtime/modules/world/runtime/spatial/ThreeBvhRuntime.js +0 -36
- package/dist/runtime/modules/world/runtime/systems/InteractionSystem.js +0 -728
- package/dist/runtime/modules/world/runtime/systems/LocomotionSystem.js +0 -269
- package/dist/runtime/modules/world/runtime/systems/NavigationSystem.js +0 -469
- package/dist/runtime/modules/world/runtime/systems/PhysicsSystem.js +0 -1657
- package/dist/runtime/modules/world/runtime/systems/RenderingSystem.js +0 -457
- package/dist/runtime/modules/world/runtime/systems/SpatialSystem.js +0 -284
- package/dist/runtime/modules/world/spec/WorldIR.js +0 -165
- package/dist/runtime/modules/world/spec/WorldIRToolSchema.js +0 -86
- package/dist/runtime/modules/world/spec/WorldPlannerProposal.js +0 -51
- package/dist/runtime/modules/world/spec/WorldRevision.js +0 -231
- package/dist/runtime/modules/world/spec/WorldSpec.js +0 -86
- package/dist/runtime/modules/world/tasks.jsonl +0 -530
- package/dist/runtime/modules/world/verification/ArticulationVerifier.js +0 -254
- package/dist/runtime/modules/world/verification/Finding.js +0 -105
- package/dist/runtime/modules/world/verification/InteractionEvidence.js +0 -69
- package/dist/runtime/modules/world/verification/RepairEngine.js +0 -49
- package/dist/runtime/modules/world/verification/WorldAcceptance.js +0 -158
- package/dist/runtime/modules/world/verification/WorldValidator.js +0 -65
- package/dist/runtime/package-lock.json +0 -6245
- package/dist/runtime/package.json +0 -91
- package/dist/runtime/public/assets/cabinet.glb +0 -0
- package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_diff_1k.jpg +0 -0
- package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_nor_gl_1k.jpg +0 -0
- package/dist/runtime/public/assets/grand-urban-block/concrete_pavement_diff_1k.jpg +0 -0
- package/dist/runtime/public/assets/grand-urban-block/urban_street_01_1k.hdr +0 -0
- package/dist/runtime/public/assets/monument-hall/marble_diff_1k.jpg +0 -0
- package/dist/runtime/public/assets/monument-hall/marble_nor_gl_1k.jpg +0 -0
- package/dist/runtime/public/assets/monument-hall/marble_rough_1k.jpg +0 -0
- package/dist/runtime/public/assets/monument-hall/solitude_interior_1k.hdr +0 -0
- package/dist/runtime/public/assets/ruined-courtyard/courtyard_1k.hdr +0 -0
- package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_diff_1k.jpg +0 -0
- package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_nor_gl_1k.jpg +0 -0
- package/dist/runtime/public/assets/ruined-courtyard/mossy_sandstone_diff_1k.jpg +0 -0
- package/dist/schema-Dudvovhu.js +0 -364
- package/dist/schema-Dudvovhu.js.map +0 -1
- package/dist/suzhouGarden-BCx_JeV5.js +0 -6159
- package/dist/suzhouGarden-BCx_JeV5.js.map +0 -1
- package/dist/woodlandWorkshop-BGNWPNdK.js +0 -484
- package/dist/woodlandWorkshop-BGNWPNdK.js.map +0 -1
- package/dist/yuanmingyuan-DAIb1msO.js +0 -4962
- package/dist/yuanmingyuan-DAIb1msO.js.map +0 -1
|
@@ -1,649 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import { installThreeBvhRuntime, ensureBoundsTrees } from './spatial/ThreeBvhRuntime.js';
|
|
3
|
-
import { EventBus } from '../../../foundation/EventBus.js';
|
|
4
|
-
import { ObjectStore } from './ObjectStore.js';
|
|
5
|
-
import { PhysicsSystem } from './systems/PhysicsSystem.js';
|
|
6
|
-
import { RapierPhysicsBackend } from '../../physics/RapierPhysicsBackend.js';
|
|
7
|
-
import { InteractionSystem } from './systems/InteractionSystem.js';
|
|
8
|
-
import { SpatialSystem } from './systems/SpatialSystem.js';
|
|
9
|
-
import { NavigationSystem } from './systems/NavigationSystem.js';
|
|
10
|
-
import { RecastNavigationBackend } from '../../navigation/RecastNavigationBackend.js';
|
|
11
|
-
import { LocomotionSystem } from './systems/LocomotionSystem.js';
|
|
12
|
-
import { SceneSerializer } from './SceneSerializer.js';
|
|
13
|
-
import { CommandHistory } from './CommandHistory.js';
|
|
14
|
-
import { SceneGraph } from './graph/SceneGraph.js';
|
|
15
|
-
import { PolicyEngine } from '../../../foundation/PolicyEngine.js';
|
|
16
|
-
import { TraceRecorder } from '../../../foundation/TraceRecorder.js';
|
|
17
|
-
import { WorldValidator } from '../verification/WorldValidator.js';
|
|
18
|
-
import { RepairEngine } from '../verification/RepairEngine.js';
|
|
19
|
-
import { disposeObject3D } from '../../rendering/disposeObject3D.js';
|
|
20
|
-
import { RuleRuntime } from './behavior/RuleRuntime.js';
|
|
21
|
-
import { clearInteractionEvidenceForTarget } from '../verification/InteractionEvidence.js';
|
|
22
|
-
import { captureWorldAuthority, restoreWorldAuthority } from './WorldAuthority.js';
|
|
23
|
-
import { SimulationSession } from './simulation/SimulationSession.js';
|
|
24
|
-
import { ThermalSystem } from './simulation/ThermalSystem.js';
|
|
25
|
-
import { WorldAffordances } from './affordance/WorldAffordances.js';
|
|
26
|
-
import { physicsManifestForUniformScale, scalesEqual, uniformScaleValue } from './ObjectTransform.js';
|
|
27
|
-
import { WorldObservation } from './WorldObservation.js';
|
|
28
|
-
import { WorldQueries } from './WorldQueries.js';
|
|
29
|
-
import { WorldCommands } from './WorldCommands.js';
|
|
30
|
-
import { WorldRecovery } from './WorldRecovery.js';
|
|
31
|
-
import { ProjectCapabilities } from './ProjectCapabilities.js';
|
|
32
|
-
import { SemanticWorldView } from './semantic/SemanticWorldView.js';
|
|
33
|
-
import { RUNTIME_VERSION } from '../../../foundation/version.js';
|
|
34
|
-
installThreeBvhRuntime();
|
|
35
|
-
|
|
36
|
-
const mutationResultCommitted=(result)=>!(
|
|
37
|
-
result?.committed===false ||
|
|
38
|
-
result?.rolledBack===true ||
|
|
39
|
-
result?.recompile?.committed===false
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
const sameSnapshot = (left, right) => JSON.stringify(left) === JSON.stringify(right);
|
|
43
|
-
|
|
44
|
-
function beginWorldWrite(runtime, label, ruleCascadeDepth = 0) {
|
|
45
|
-
if (runtime.mutationOwner || runtime.history?.suspended || runtime.history?.pending) {
|
|
46
|
-
const error = new Error(`World mutation already in progress: ${runtime.mutationOwner || 'history'}`);
|
|
47
|
-
error.code = 'WORLD_MUTATION_BUSY';
|
|
48
|
-
throw error;
|
|
49
|
-
}
|
|
50
|
-
runtime.mutationOwner = label;
|
|
51
|
-
runtime.ruleRuntime?.beginTransaction(ruleCascadeDepth);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function endWorldWrite(runtime, committed) {
|
|
55
|
-
runtime.mutationOwner = null;
|
|
56
|
-
runtime.ruleRuntime?.endTransaction(committed);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
async function rollbackMutation(runtime, before, authority, physics) {
|
|
60
|
-
// A failed validation must not destroy an unchanged simulation.
|
|
61
|
-
let changed = true;
|
|
62
|
-
try { changed = !sameSnapshot(runtime.snapshot(), before); } catch { /* Restore an unreadable world. */ }
|
|
63
|
-
if (changed) await runtime.restoreSnapshot(before);
|
|
64
|
-
if (physics && (changed || !sameSnapshot(runtime.physics.captureState(), physics))) {
|
|
65
|
-
runtime.physics.restoreState(physics);
|
|
66
|
-
runtime.sceneGraph?.invalidate();
|
|
67
|
-
}
|
|
68
|
-
if (!sameSnapshot(captureWorldAuthority(runtime), authority)) restoreWorldAuthority(runtime, authority);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export class WorldRuntime {
|
|
72
|
-
constructor({ environmentFactory, assetModule, physicsFactory = () => new PhysicsSystem({ backend:new RapierPhysicsBackend() }), navigationBackendFactory = () => new RecastNavigationBackend() } = {}) {
|
|
73
|
-
const assetMethods=['getManifest','hasAsset','assertCompatibleManifest','instantiate'];
|
|
74
|
-
if (
|
|
75
|
-
!assetModule?.registry || !assetModule?.loader || !assetModule?.catalog || !assetModule?.compiledStore ||
|
|
76
|
-
assetMethods.some((name)=>typeof assetModule[name]!=='function')
|
|
77
|
-
) {
|
|
78
|
-
throw new TypeError('WorldRuntime requires a complete AssetModule boundary');
|
|
79
|
-
}
|
|
80
|
-
if (typeof physicsFactory !== 'function') throw new TypeError('WorldRuntime physicsFactory must be a function');
|
|
81
|
-
if (typeof navigationBackendFactory !== 'function') throw new TypeError('WorldRuntime navigationBackendFactory must be a function');
|
|
82
|
-
this.version = RUNTIME_VERSION;
|
|
83
|
-
this.ready = false;
|
|
84
|
-
this.restoring = false;
|
|
85
|
-
this.affordances = new WorldAffordances(this);
|
|
86
|
-
this.environmentFactory = environmentFactory; this.events = new EventBus(); this.mutationOwner = null;
|
|
87
|
-
this.policy = new PolicyEngine(); this.trace = new TraceRecorder({ events: this.events });
|
|
88
|
-
this.assetModule = assetModule;
|
|
89
|
-
this.observation = new WorldObservation(this);
|
|
90
|
-
this.queries = new WorldQueries(this);
|
|
91
|
-
this.commands = new WorldCommands(this);
|
|
92
|
-
this.recovery = new WorldRecovery(this);
|
|
93
|
-
this.physicsFactory = physicsFactory;
|
|
94
|
-
this.navigationBackendFactory = navigationBackendFactory;
|
|
95
|
-
this.scene = new THREE.Scene();
|
|
96
|
-
this.rendering = null;
|
|
97
|
-
this.ruleRuntime = new RuleRuntime(this); this.serializer = new SceneSerializer(); this.store = new ObjectStore(); this.physics = physicsFactory(); this.navigation = null;
|
|
98
|
-
this.projectCapabilities = new ProjectCapabilities(this);
|
|
99
|
-
this.semantic = new SemanticWorldView(this);
|
|
100
|
-
this.thermal = new ThermalSystem({physics:this.physics,
|
|
101
|
-
isActive:id=>this.store.has(id) && this.store.get(id).active!==false});
|
|
102
|
-
this.simulation = new SimulationSession({
|
|
103
|
-
fixedDt:1/60,
|
|
104
|
-
executeStep:(dt)=>this.stepSimulation(dt),
|
|
105
|
-
snapshotWorld:()=>this.snapshot(),
|
|
106
|
-
restoreWorld:(scene)=>this.restore(scene),
|
|
107
|
-
events:this.events
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
attachRendering(rendering) {
|
|
111
|
-
if (!rendering || typeof rendering.init !== 'function' || typeof rendering.dispose !== 'function') {
|
|
112
|
-
throw new TypeError('WorldRuntime rendering must provide init() and dispose()');
|
|
113
|
-
}
|
|
114
|
-
if (rendering.scene && rendering.scene !== this.scene) {
|
|
115
|
-
throw new TypeError('WorldRuntime rendering must use the Runtime scene');
|
|
116
|
-
}
|
|
117
|
-
if (this.rendering && this.rendering !== rendering) {
|
|
118
|
-
const error = new Error('WorldRuntime rendering is already attached');
|
|
119
|
-
error.code = 'WORLD_RENDERING_ALREADY_ATTACHED';
|
|
120
|
-
throw error;
|
|
121
|
-
}
|
|
122
|
-
this.rendering = rendering;
|
|
123
|
-
return rendering;
|
|
124
|
-
}
|
|
125
|
-
async init() {
|
|
126
|
-
await this.assetModule.hydrate?.();
|
|
127
|
-
await this.physics.init();
|
|
128
|
-
if (this.rendering) {
|
|
129
|
-
await this.rendering.init();
|
|
130
|
-
if (this.rendering.renderer) this.assetModule.configureRenderer?.(this.rendering.renderer);
|
|
131
|
-
}
|
|
132
|
-
this.spatial = new SpatialSystem({ store: this.store });
|
|
133
|
-
this.sceneGraph = new SceneGraph({ store: this.store, spatial: this.spatial, events: this.events });
|
|
134
|
-
this.history = new CommandHistory({
|
|
135
|
-
apply: (scene) => this.restoreSnapshot(scene),
|
|
136
|
-
runExclusive: (operation) => this.exclusiveMutation('history:restore', operation),
|
|
137
|
-
events: this.events
|
|
138
|
-
});
|
|
139
|
-
this.validator = new WorldValidator(this); this.repair = new RepairEngine(this);
|
|
140
|
-
await this.addEnvironment();
|
|
141
|
-
this.createEnvironmentSystems();
|
|
142
|
-
this.ruleRuntime.start();
|
|
143
|
-
this.ready = true;
|
|
144
|
-
const rendering=this.rendering?.diagnostics?.() || null; this.trace.emit('runtime.ready', { version: this.version, rendering }); this.events.emit('runtime.ready', { rendering }); return this;
|
|
145
|
-
}
|
|
146
|
-
async addEnvironment() {
|
|
147
|
-
if (!this.environmentFactory) throw new Error('WorldRuntime requires an environmentFactory');
|
|
148
|
-
const environment = await this.environmentFactory({ scene:this.scene, renderer:this.rendering?.renderer || null });
|
|
149
|
-
this.installEnvironment(environment);
|
|
150
|
-
return environment;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
installEnvironment(environment) {
|
|
154
|
-
if (!environment?.root?.isObject3D || !Array.isArray(environment.colliders)) {
|
|
155
|
-
const error=new TypeError('Runtime environment requires root Object3D and colliders');
|
|
156
|
-
error.code='ENVIRONMENT_INVALID';
|
|
157
|
-
throw error;
|
|
158
|
-
}
|
|
159
|
-
this.environment = environment;
|
|
160
|
-
this.environmentFloor = environment.floor || null;
|
|
161
|
-
this.sceneGraph?.setEnvironmentSemantics(environment.id, environment.semantics);
|
|
162
|
-
this.scene.add(environment.root);
|
|
163
|
-
this.rendering?.applyEnvironment(environment);
|
|
164
|
-
this.physics.addEnvironment(environment.colliders,{id:environment.id});
|
|
165
|
-
const characterOptions = environment.physics?.characterController || environment.characterController || null;
|
|
166
|
-
if (characterOptions && typeof this.physics.setCharacterControllerOptions === 'function') {
|
|
167
|
-
this.physics.setCharacterControllerOptions(characterOptions);
|
|
168
|
-
}
|
|
169
|
-
return environment;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
invalidateNavigationForObject(id, reason = 'object-transformed') {
|
|
173
|
-
if (!this.navigation || !id || !this.store.has(id)) return false;
|
|
174
|
-
return this.navigation.invalidateIfStatic(this.store.get(id), reason);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
createEnvironmentSystems() {
|
|
178
|
-
const environmentNavConfig = this.environment?.navigation || this.environment?.navigationConfig || {};
|
|
179
|
-
this.navigation = new NavigationSystem({
|
|
180
|
-
store:this.store,physics:this.physics,environmentRoots:[this.environment.navigationRoot || this.environment.root],
|
|
181
|
-
backend:this.navigationBackendFactory(),
|
|
182
|
-
config: environmentNavConfig
|
|
183
|
-
});
|
|
184
|
-
this.locomotion = new LocomotionSystem({ store:this.store, physics:this.physics, navigation:this.navigation, events:this.events });
|
|
185
|
-
this.interactions = new InteractionSystem({
|
|
186
|
-
store:this.store,physics:this.physics,spatial:this.spatial,navigation:this.navigation,locomotion:this.locomotion,events:this.events,
|
|
187
|
-
onObjectTransform:(id,reason)=>this.invalidateNavigationForObject(id,reason)
|
|
188
|
-
});
|
|
189
|
-
return this.navigation;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
teardownEnvironmentSystems(reason='ENVIRONMENT_REPLACED') {
|
|
193
|
-
this.affordances?.cancel(reason);
|
|
194
|
-
this.interactions?.cancelPending(reason);
|
|
195
|
-
this.locomotion?.cancelAll(reason);
|
|
196
|
-
this.navigation?.dispose();
|
|
197
|
-
this.interactions=null;
|
|
198
|
-
this.locomotion=null;
|
|
199
|
-
this.navigation=null;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
async replaceEnvironment(environment,{disposePrevious=true,reason='environment-replaced'}={}) {
|
|
203
|
-
if (this.store.size) {
|
|
204
|
-
const error=new Error('Environment replacement requires an empty ObjectStore');
|
|
205
|
-
error.code='ENVIRONMENT_REPLACE_REQUIRES_EMPTY_WORLD';
|
|
206
|
-
throw error;
|
|
207
|
-
}
|
|
208
|
-
if (!environment?.root?.isObject3D || !Array.isArray(environment.colliders)) {
|
|
209
|
-
const error=new TypeError('Runtime environment requires root Object3D and colliders');
|
|
210
|
-
error.code='ENVIRONMENT_INVALID';
|
|
211
|
-
throw error;
|
|
212
|
-
}
|
|
213
|
-
const previous=this.environment || null;
|
|
214
|
-
if (previous===environment) return {status:'environment-ready',environmentId:environment.id || null,previousEnvironmentId:previous?.id || null,reused:true};
|
|
215
|
-
this.teardownEnvironmentSystems('ENVIRONMENT_REPLACED');
|
|
216
|
-
if (previous?.root?.parent===this.scene) this.scene.remove(previous.root);
|
|
217
|
-
this.physics.resetWorld();
|
|
218
|
-
try {
|
|
219
|
-
this.installEnvironment(environment);
|
|
220
|
-
this.createEnvironmentSystems();
|
|
221
|
-
this.sceneGraph?.changed();
|
|
222
|
-
this.events?.emit('environment.replaced',{id:environment.id || null,previousId:previous?.id || null,reason});
|
|
223
|
-
if (disposePrevious) previous?.dispose?.();
|
|
224
|
-
return {status:'environment-ready',environmentId:environment.id || null,previousEnvironmentId:previous?.id || null,reused:false};
|
|
225
|
-
} catch (error) {
|
|
226
|
-
let rollbackError=null;
|
|
227
|
-
try {
|
|
228
|
-
if (environment.root?.parent===this.scene) this.scene.remove(environment.root);
|
|
229
|
-
this.teardownEnvironmentSystems('ENVIRONMENT_REPLACE_ROLLBACK');
|
|
230
|
-
this.physics.resetWorld();
|
|
231
|
-
if (previous) {
|
|
232
|
-
this.installEnvironment(previous);
|
|
233
|
-
this.createEnvironmentSystems();
|
|
234
|
-
this.sceneGraph?.changed();
|
|
235
|
-
} else {
|
|
236
|
-
this.environment=null;
|
|
237
|
-
this.environmentFloor=null;
|
|
238
|
-
this.sceneGraph?.setEnvironmentSemantics('environment',null);
|
|
239
|
-
}
|
|
240
|
-
} catch (cause) { rollbackError=cause; }
|
|
241
|
-
if (rollbackError) {
|
|
242
|
-
const failure=new AggregateError([error,rollbackError],'Environment replacement rollback failed',{cause:error});
|
|
243
|
-
failure.code='ENVIRONMENT_REPLACE_ROLLBACK_FAILED';
|
|
244
|
-
failure.rollbackError=rollbackError;
|
|
245
|
-
throw failure;
|
|
246
|
-
}
|
|
247
|
-
throw error;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
async spawn(assetId, { position = [0, 0, 0], quaternion = [0, 0, 0, 1], scale = 1, id = `${assetId}_${crypto.randomUUID()}`, initialState = null, active = true, signal } = {}) {
|
|
251
|
-
if (this.store.has(id)) throw new Error('Duplicate object id: ' + id);
|
|
252
|
-
const { object, manifest } = active ? await this.assetModule.instantiate(assetId, { signal })
|
|
253
|
-
: { object: new THREE.Object3D(), manifest: this.assetModule.getManifest(assetId) };
|
|
254
|
-
const uniformScale = uniformScaleValue(scale);
|
|
255
|
-
if (!Array.isArray(position) || position.length !== 3 || !position.every(Number.isFinite)) {
|
|
256
|
-
const error=new TypeError('Object position requires finite vec3'); error.code='OBJECT_POSITION_INVALID'; throw error;
|
|
257
|
-
}
|
|
258
|
-
if (!Array.isArray(quaternion) || quaternion.length !== 4 || !quaternion.every(Number.isFinite)) {
|
|
259
|
-
const error=new TypeError('Object quaternion requires finite vec4'); error.code='OBJECT_ROTATION_INVALID'; throw error;
|
|
260
|
-
}
|
|
261
|
-
let physicsManifest;
|
|
262
|
-
try { physicsManifest = physicsManifestForUniformScale(manifest,uniformScale); }
|
|
263
|
-
catch (error) { disposeObject3D(object); throw error; }
|
|
264
|
-
object.position.fromArray(position);
|
|
265
|
-
object.quaternion.fromArray(quaternion).normalize();
|
|
266
|
-
object.scale.setScalar(uniformScale);
|
|
267
|
-
object.userData.instanceId = id;
|
|
268
|
-
ensureBoundsTrees(object);
|
|
269
|
-
let stored = false;
|
|
270
|
-
let attached = false;
|
|
271
|
-
try {
|
|
272
|
-
this.scene.add(object);
|
|
273
|
-
this.store.add(id, { id, assetId, object, manifest, state: {}, physicsScale:uniformScale, active });
|
|
274
|
-
stored = true;
|
|
275
|
-
if (active && manifest.capabilityLevel !== 'visual') {
|
|
276
|
-
this.physics.addObject(id, physicsManifest, object);
|
|
277
|
-
attached = true;
|
|
278
|
-
}
|
|
279
|
-
this.thermal?.register?.(id,manifest.simulation,{scale:uniformScale});
|
|
280
|
-
clearInteractionEvidenceForTarget(this,id);
|
|
281
|
-
if (initialState && Object.keys(initialState).length) this.restoreObjectState(id, initialState);
|
|
282
|
-
this.invalidateNavigationForObject(id, 'object.spawned');
|
|
283
|
-
if (active) this.sceneGraph?.changed(); else this.sceneGraph?.invalidate();
|
|
284
|
-
this.events.emit('object.spawned', { id, assetId, position });
|
|
285
|
-
return id;
|
|
286
|
-
} catch (error) {
|
|
287
|
-
// 只撤销本次调用取得的资源:attach 未成功时不得触碰同名旧对象的物理实体。
|
|
288
|
-
if (attached) this.physics.removeObject(id);
|
|
289
|
-
this.thermal?.remove?.(id);
|
|
290
|
-
if (stored) this.store.delete(id);
|
|
291
|
-
this.scene.remove(object);
|
|
292
|
-
disposeObject3D(object);
|
|
293
|
-
throw error;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
async setObjectActive(id, active, { signal } = {}) {
|
|
297
|
-
const record = this.store.get(id);
|
|
298
|
-
if ((record.active !== false) === active) return;
|
|
299
|
-
if (record.state?.heldBy || this.interactions?.isHeld?.(id)) throw new Error('OBJECT_HELD');
|
|
300
|
-
const old = record.object;
|
|
301
|
-
if (!active) {
|
|
302
|
-
record.dormantArticulation = this.physics.captureArticulationPose(id);
|
|
303
|
-
this.locomotion?.cancel(id, 'OBJECT_DEACTIVATED');
|
|
304
|
-
this.physics.removeObject(id);
|
|
305
|
-
this.scene.remove(old);
|
|
306
|
-
const placeholder = new THREE.Object3D();
|
|
307
|
-
placeholder.position.copy(old.position); placeholder.quaternion.copy(old.quaternion); placeholder.scale.copy(old.scale);
|
|
308
|
-
record.object = placeholder; record.active = false;
|
|
309
|
-
disposeObject3D(old);
|
|
310
|
-
} else {
|
|
311
|
-
const { object } = await this.assetModule.instantiate(record.assetId, { signal });
|
|
312
|
-
try {
|
|
313
|
-
if (signal?.aborted) throw new Error('ASSET_CANCELLED');
|
|
314
|
-
object.position.copy(old.position); object.quaternion.copy(old.quaternion); object.scale.copy(old.scale);
|
|
315
|
-
object.userData.instanceId = id; ensureBoundsTrees(object); this.scene.add(object);
|
|
316
|
-
if (record.manifest.capabilityLevel !== 'visual') this.physics.addObject(id, physicsManifestForUniformScale(record.manifest, old.scale.x), object);
|
|
317
|
-
record.object = object; record.active = true;
|
|
318
|
-
this.restoreObjectState(id, record.state);
|
|
319
|
-
if (record.dormantArticulation?.length) this.physics.restoreArticulationPose(id, record.dormantArticulation);
|
|
320
|
-
this.scene.remove(old);
|
|
321
|
-
} catch (error) {
|
|
322
|
-
this.physics.removeObject(id); this.scene.remove(object); disposeObject3D(object);
|
|
323
|
-
record.object = old; record.active = false; throw error;
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
this.navigation?.invalidate('entity-activation'); this.sceneGraph?.invalidate();
|
|
327
|
-
this.events.emit('object.activation', { id, active });
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
applyObjectTransform(id,{position=null,quaternion=null,rotationDegrees=null,scale=null}={}, {source='runtime'}={}) {
|
|
331
|
-
const record=this.store.get(id);
|
|
332
|
-
const object=record.object;
|
|
333
|
-
const previous={
|
|
334
|
-
position:object.position.toArray(),
|
|
335
|
-
quaternion:object.quaternion.toArray(),
|
|
336
|
-
scale:uniformScaleValue(object.scale.toArray()),
|
|
337
|
-
physicsScale:Number.isFinite(record.physicsScale)?record.physicsScale:1
|
|
338
|
-
};
|
|
339
|
-
if (position!=null && (!Array.isArray(position) || position.length!==3 || !position.every(Number.isFinite))) {
|
|
340
|
-
const error=new TypeError('Object position requires finite vec3'); error.code='OBJECT_POSITION_INVALID'; throw error;
|
|
341
|
-
}
|
|
342
|
-
const nextPosition=position==null?previous.position:[...position];
|
|
343
|
-
if (quaternion!=null && (!Array.isArray(quaternion) || quaternion.length!==4 || !quaternion.every(Number.isFinite))) {
|
|
344
|
-
const error=new TypeError('Object quaternion requires finite vec4'); error.code='OBJECT_ROTATION_INVALID'; throw error;
|
|
345
|
-
}
|
|
346
|
-
let nextQuaternion=quaternion==null?[...previous.quaternion]:[...quaternion];
|
|
347
|
-
if (rotationDegrees!=null) {
|
|
348
|
-
if (!Array.isArray(rotationDegrees) || rotationDegrees.length!==3 || !rotationDegrees.every(Number.isFinite)) {
|
|
349
|
-
const error=new TypeError('Object rotation requires finite degree vec3'); error.code='OBJECT_ROTATION_INVALID'; throw error;
|
|
350
|
-
}
|
|
351
|
-
const euler=new THREE.Euler(...rotationDegrees.map(THREE.MathUtils.degToRad),'XYZ');
|
|
352
|
-
nextQuaternion=new THREE.Quaternion().setFromEuler(euler).toArray();
|
|
353
|
-
}
|
|
354
|
-
const nextScale=scale==null?previous.scale:uniformScaleValue(scale);
|
|
355
|
-
this.thermal?.assertScale?.(id,nextScale);
|
|
356
|
-
const scaleChanged=record.manifest.capabilityLevel !== 'visual' && !scalesEqual(nextScale,previous.physicsScale);
|
|
357
|
-
if (scaleChanged && record.state?.heldBy) {
|
|
358
|
-
const error=new Error(`Cannot scale held object: ${id}`); error.code='OBJECT_SCALE_HELD_UNSUPPORTED'; throw error;
|
|
359
|
-
}
|
|
360
|
-
const nextPhysicsManifest=scaleChanged?physicsManifestForUniformScale(record.manifest,nextScale):null;
|
|
361
|
-
const previousPhysicsManifest=scaleChanged?physicsManifestForUniformScale(record.manifest,previous.physicsScale):null;
|
|
362
|
-
|
|
363
|
-
object.position.fromArray(nextPosition);
|
|
364
|
-
object.quaternion.fromArray(nextQuaternion).normalize();
|
|
365
|
-
object.scale.setScalar(nextScale);
|
|
366
|
-
object.updateMatrixWorld(true);
|
|
367
|
-
try {
|
|
368
|
-
if (record.active === false) { record.physicsScale = nextScale; }
|
|
369
|
-
else if (scaleChanged) {
|
|
370
|
-
this.physics.removeObject(id);
|
|
371
|
-
this.physics.addObject(id,nextPhysicsManifest,object);
|
|
372
|
-
record.physicsScale=nextScale;
|
|
373
|
-
} else this.physics.syncTransform(id,object);
|
|
374
|
-
} catch (error) {
|
|
375
|
-
object.position.fromArray(previous.position);
|
|
376
|
-
object.quaternion.fromArray(previous.quaternion);
|
|
377
|
-
object.scale.setScalar(previous.scale);
|
|
378
|
-
object.updateMatrixWorld(true);
|
|
379
|
-
if (scaleChanged) {
|
|
380
|
-
try { this.physics.removeObject(id); } catch {}
|
|
381
|
-
this.physics.addObject(id,previousPhysicsManifest,object);
|
|
382
|
-
record.physicsScale=previous.physicsScale;
|
|
383
|
-
} else this.physics.syncTransform(id,object);
|
|
384
|
-
throw error;
|
|
385
|
-
}
|
|
386
|
-
this.thermal?.setScale?.(id,nextScale);
|
|
387
|
-
this.invalidateNavigationForObject(id,'object.transformed');
|
|
388
|
-
this.sceneGraph?.invalidate?.();
|
|
389
|
-
this.events.emit('object.transformed',{
|
|
390
|
-
id,source,position:[...nextPosition],quaternion:[...nextQuaternion],scale:nextScale,physicsRebuilt:scaleChanged
|
|
391
|
-
});
|
|
392
|
-
return {status:'object-transformed',id,position:[...nextPosition],quaternion:[...nextQuaternion],scale:nextScale,physicsRebuilt:scaleChanged};
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
snapshot() {
|
|
396
|
-
const scene = this.serialize({ name: 'History Snapshot', includeRelations: false });
|
|
397
|
-
delete scene.metadata.savedAt;
|
|
398
|
-
return scene;
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
async exclusiveMutation(label, operation) {
|
|
402
|
-
beginWorldWrite(this, label);
|
|
403
|
-
let committed = false;
|
|
404
|
-
try {
|
|
405
|
-
const result = await operation();
|
|
406
|
-
committed = mutationResultCommitted(result);
|
|
407
|
-
return result;
|
|
408
|
-
} finally { endWorldWrite(this, committed); }
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
async mutate(label, operation, meta = {}, { beforeSnapshot = null, onSnapshot = null } = {}) {
|
|
412
|
-
beginWorldWrite(this, label, meta.ruleCascadeDepth);
|
|
413
|
-
let committed = false;
|
|
414
|
-
try {
|
|
415
|
-
const authorityBefore = captureWorldAuthority(this);
|
|
416
|
-
// Sequential batches may reuse a committed after-snapshot as the next before-state.
|
|
417
|
-
const before = beforeSnapshot ?? this.snapshot();
|
|
418
|
-
const physicsBefore = this.physics?.captureState?.();
|
|
419
|
-
if (!this.history.begin(label, before)) {
|
|
420
|
-
const error = new Error('World history transaction unavailable');
|
|
421
|
-
error.code = 'WORLD_MUTATION_BUSY';
|
|
422
|
-
throw error;
|
|
423
|
-
}
|
|
424
|
-
try {
|
|
425
|
-
let result;
|
|
426
|
-
await this.sceneGraph.batch(async () => {
|
|
427
|
-
result = await operation();
|
|
428
|
-
if (mutationResultCommitted(result)) this.sceneGraph.changed();
|
|
429
|
-
});
|
|
430
|
-
if (!mutationResultCommitted(result)) {
|
|
431
|
-
this.history.cancel();
|
|
432
|
-
await rollbackMutation(this, before, authorityBefore, physicsBefore);
|
|
433
|
-
return result;
|
|
434
|
-
}
|
|
435
|
-
const after = this.snapshot();
|
|
436
|
-
this.history.commit(after, meta);
|
|
437
|
-
committed = true;
|
|
438
|
-
// Cache updates are advisory. Once committed, a cache callback error
|
|
439
|
-
// must never invoke rollback against an already recorded history entry.
|
|
440
|
-
try { onSnapshot?.(after); }
|
|
441
|
-
catch { /* The next mutation will take a fresh snapshot. */ }
|
|
442
|
-
return result;
|
|
443
|
-
} catch (error) {
|
|
444
|
-
this.history.cancel();
|
|
445
|
-
try {
|
|
446
|
-
await rollbackMutation(this, before, authorityBefore, physicsBefore);
|
|
447
|
-
} catch (rollbackError) {
|
|
448
|
-
const failure = new AggregateError([error, rollbackError],
|
|
449
|
-
`World mutation rollback failed: ${label}`, { cause:error });
|
|
450
|
-
failure.code = 'WORLD_MUTATION_ROLLBACK_FAILED';
|
|
451
|
-
failure.rollbackError = rollbackError;
|
|
452
|
-
throw failure;
|
|
453
|
-
}
|
|
454
|
-
throw error;
|
|
455
|
-
}
|
|
456
|
-
} finally { endWorldWrite(this, committed); }
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
beginMutation(label) {
|
|
460
|
-
if (this.history?.suspended || this.history?.pending || this.mutationOwner) return false;
|
|
461
|
-
beginWorldWrite(this, 'editor');
|
|
462
|
-
try {
|
|
463
|
-
if (this.history.begin(label, this.snapshot())) return true;
|
|
464
|
-
endWorldWrite(this, false);
|
|
465
|
-
return false;
|
|
466
|
-
} catch (error) {
|
|
467
|
-
endWorldWrite(this, false);
|
|
468
|
-
throw error;
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
commitMutation(meta = {}) {
|
|
473
|
-
if (this.history?.suspended || (this.mutationOwner && this.mutationOwner !== 'editor')) return false;
|
|
474
|
-
let committed = false;
|
|
475
|
-
try {
|
|
476
|
-
this.sceneGraph?.changed();
|
|
477
|
-
if (meta.id) this.invalidateNavigationForObject(meta.id, 'editor.transform');
|
|
478
|
-
const recorded = this.history.commit(this.snapshot(), meta);
|
|
479
|
-
committed = true;
|
|
480
|
-
return recorded;
|
|
481
|
-
} finally {
|
|
482
|
-
if (this.mutationOwner === 'editor') endWorldWrite(this, committed);
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
async clearObjects({silent=false}={}) {
|
|
487
|
-
const ids = this.store.list().map(([id]) => id);
|
|
488
|
-
await this.sceneGraph.batch(async () => {
|
|
489
|
-
for (const id of ids) this.remove(id,{silent});
|
|
490
|
-
this.sceneGraph.changed();
|
|
491
|
-
});
|
|
492
|
-
if(!silent) this.events.emit('scene.cleared', { count: ids.length });
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
serialize(options) { return this.serializer.serialize(this, options); }
|
|
496
|
-
async installWorld({ snapshot, assetModule, environment }) {
|
|
497
|
-
this.serializer.validate(snapshot);
|
|
498
|
-
return this.exclusiveMutation('world:commit', async () => {
|
|
499
|
-
const previous = this.snapshot(), oldAssets = this.assetModule, oldEnvironment = this.environment;
|
|
500
|
-
const authority = captureWorldAuthority(this), physics = this.physics.captureState();
|
|
501
|
-
const running = this.simulation.running;
|
|
502
|
-
this.simulation.pause(); this.restoring = true; this.ruleRuntime.suspendEvents();
|
|
503
|
-
try {
|
|
504
|
-
await this.clearObjects({ silent: true });
|
|
505
|
-
await this.replaceEnvironment(environment, { disposePrevious: false });
|
|
506
|
-
this.assetModule = assetModule;
|
|
507
|
-
await this.serializer.applyScene(this, snapshot);
|
|
508
|
-
this.history.clear();
|
|
509
|
-
} catch (error) {
|
|
510
|
-
try {
|
|
511
|
-
await this.clearObjects({ silent: true }); this.assetModule = oldAssets;
|
|
512
|
-
if (this.environment !== oldEnvironment) await this.replaceEnvironment(oldEnvironment, { disposePrevious: false });
|
|
513
|
-
await this.serializer.applyScene(this, previous); this.physics.restoreState(physics); restoreWorldAuthority(this, authority);
|
|
514
|
-
} catch (rollbackError) {
|
|
515
|
-
throw Object.assign(new AggregateError([error, rollbackError], 'World commit rollback failed'), { code: 'WORLD_COMMIT_ROLLBACK_FAILED' });
|
|
516
|
-
}
|
|
517
|
-
throw error;
|
|
518
|
-
} finally {
|
|
519
|
-
this.restoring = false; this.ruleRuntime.resumeEvents(); if (running) this.simulation.play();
|
|
520
|
-
}
|
|
521
|
-
if (oldEnvironment !== environment) oldEnvironment.dispose?.();
|
|
522
|
-
this.events.emit('world.committed', { entities: this.store.size });
|
|
523
|
-
});
|
|
524
|
-
}
|
|
525
|
-
async restore(scene) {
|
|
526
|
-
return this.exclusiveMutation('scene:restore', () => this.restoreSnapshot(scene));
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
// Trusted rollback/history primitive. External imports must use restore().
|
|
530
|
-
async restoreSnapshot(scene) {
|
|
531
|
-
if (!this.mutationOwner) return this.restore(scene);
|
|
532
|
-
if (this.restoring) {
|
|
533
|
-
const error = new Error('World restore already in progress');
|
|
534
|
-
error.code = 'WORLD_MUTATION_BUSY';
|
|
535
|
-
throw error;
|
|
536
|
-
}
|
|
537
|
-
const wasRunning = this.simulation?.running;
|
|
538
|
-
this.restoring = true;
|
|
539
|
-
this.simulation?.pause();
|
|
540
|
-
this.ruleRuntime?.suspendEvents();
|
|
541
|
-
try { return await this.serializer.restore(this, scene); }
|
|
542
|
-
finally {
|
|
543
|
-
this.restoring = false;
|
|
544
|
-
this.ruleRuntime?.resumeEvents();
|
|
545
|
-
if (wasRunning) this.simulation.play();
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
loadRuleGraph(graph) { return this.ruleRuntime.load(graph); }
|
|
550
|
-
|
|
551
|
-
applyStateTransition(id, stateKey, value, meta = {}) {
|
|
552
|
-
const record=this.store.get(id);
|
|
553
|
-
if(!record) { const error=new Error(`State target not found: ${id}`); error.code='STATE_TARGET_NOT_FOUND'; throw error; }
|
|
554
|
-
const key=String(stateKey||'').trim();
|
|
555
|
-
if(!key || key.includes('.') || key.startsWith('__')) { const error=new Error('Invalid state key'); error.code='STATE_KEY_INVALID'; throw error; }
|
|
556
|
-
if(value!==null && !['string','number','boolean'].includes(typeof value)) { const error=new TypeError('State value must be a JSON scalar'); error.code='STATE_VALUE_INVALID'; throw error; }
|
|
557
|
-
record.state ||= {};
|
|
558
|
-
if (Object.is(record.state[key], value)) {
|
|
559
|
-
return {status:'state-transition-applied',targetId:id,stateKey:key,value,changed:false};
|
|
560
|
-
}
|
|
561
|
-
record.state[key]=value;
|
|
562
|
-
this.sceneGraph?.changed();
|
|
563
|
-
this.events.emit('world.state-transition',{id,stateKey:key,value,meta});
|
|
564
|
-
return {status:'state-transition-applied',targetId:id,stateKey:key,value};
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
restoreObjectState(id, state = {}) {
|
|
568
|
-
const record = this.store.get(id);
|
|
569
|
-
record.state = structuredClone(state);
|
|
570
|
-
if (record.active === false) return;
|
|
571
|
-
if (record.state.navigation?.status === 'moving') record.state.navigation.status = 'interrupted';
|
|
572
|
-
const articulationTargets = Object.keys(state.partTargets || {}).length ? state.partTargets : (state.parts || {});
|
|
573
|
-
for (const [partName, action] of Object.entries(articulationTargets)) {
|
|
574
|
-
if (record.manifest.actions.includes(action)) this.interactions.setArticulationAction(id, action, { partName });
|
|
575
|
-
}
|
|
576
|
-
// 兼容 1.1.8 以前的 cabinet 状态。
|
|
577
|
-
if (state.door === 'open') this.interactions.setArticulationAction(id, 'open');
|
|
578
|
-
else if (state.door === 'closed') this.interactions.setArticulationAction(id, 'close');
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
remove(id,{silent=false}={}) {
|
|
582
|
-
const record = this.store.get(id);
|
|
583
|
-
this.events.emit('object.removing', { id });
|
|
584
|
-
this.locomotion?.cancel(id, 'OBJECT_REMOVED');
|
|
585
|
-
this.interactions?.beforeRemove(id,{silent});
|
|
586
|
-
this.invalidateNavigationForObject(id, 'object.removed');
|
|
587
|
-
this.thermal?.remove?.(id);
|
|
588
|
-
this.physics.removeObject(id);
|
|
589
|
-
this.scene.remove(record.object);
|
|
590
|
-
disposeObject3D(record.object);
|
|
591
|
-
this.store.delete(id);
|
|
592
|
-
clearInteractionEvidenceForTarget(this,id);
|
|
593
|
-
this.sceneGraph?.removeObject(id); this.sceneGraph?.changed();
|
|
594
|
-
if(!silent) this.events.emit('object.removed', { id, assetId: record.assetId });
|
|
595
|
-
return true;
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
async duplicate(id) {
|
|
599
|
-
const record = this.store.get(id);
|
|
600
|
-
const p = record.object.position;
|
|
601
|
-
const duplicateId = `${record.assetId}_${crypto.randomUUID()}`;
|
|
602
|
-
await this.spawn(record.assetId, {
|
|
603
|
-
position:[p.x + 0.6,p.y,p.z + 0.6],
|
|
604
|
-
quaternion:record.object.quaternion.toArray(),
|
|
605
|
-
scale:uniformScaleValue(record.object.scale.toArray()),
|
|
606
|
-
id:duplicateId
|
|
607
|
-
});
|
|
608
|
-
this.events.emit('object.duplicated', { sourceId: id, id: duplicateId });
|
|
609
|
-
return duplicateId;
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
stepSimulation(dt) {
|
|
613
|
-
if (this.restoring) return false;
|
|
614
|
-
this.environment?.step?.(dt,{physics:this.physics,navigation:this.navigation});
|
|
615
|
-
this.affordances?.update(dt);
|
|
616
|
-
this.locomotion?.update(dt);
|
|
617
|
-
if (this.physics.step(dt, this.store)) this.sceneGraph.invalidate();
|
|
618
|
-
this.thermal?.step?.(dt);
|
|
619
|
-
this.interactions?.update(dt);
|
|
620
|
-
}
|
|
621
|
-
dispose() {
|
|
622
|
-
this.ready = false;
|
|
623
|
-
this.events?.emit?.('world.disposing');
|
|
624
|
-
this.projectCapabilities?.dispose();
|
|
625
|
-
this.thermal?.clear?.();
|
|
626
|
-
this.ruleRuntime?.stop();
|
|
627
|
-
this.affordances?.cancel('RUNTIME_DISPOSED');
|
|
628
|
-
this.interactions?.cancelPending('RUNTIME_DISPOSED');
|
|
629
|
-
for (const [id, record] of this.store.list()) {
|
|
630
|
-
this.physics.removeObject(id);
|
|
631
|
-
this.scene.remove(record.object);
|
|
632
|
-
disposeObject3D(record.object);
|
|
633
|
-
this.store.delete(id);
|
|
634
|
-
}
|
|
635
|
-
this.sceneGraph.reset();
|
|
636
|
-
this.locomotion?.cancelAll();
|
|
637
|
-
this.locomotion = null;
|
|
638
|
-
this.environment?.dispose();
|
|
639
|
-
this.environment = null;
|
|
640
|
-
disposeObject3D(this.scene);
|
|
641
|
-
this.navigation?.dispose();
|
|
642
|
-
this.navigation = null;
|
|
643
|
-
this.physics.dispose();
|
|
644
|
-
this.simulation?.pause();
|
|
645
|
-
this.rendering?.dispose?.();
|
|
646
|
-
this.rendering = null;
|
|
647
|
-
this.events.clear();
|
|
648
|
-
}
|
|
649
|
-
}
|