agentscape3d-engine 0.0.0-stage → 1.0.0-beta.3
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/LICENSE +21 -0
- package/README.md +19 -2
- package/cli.mjs +53 -0
- package/dist/ArticulationVerifier-BfGxXY8V.js +337 -0
- package/dist/ArticulationVerifier-BfGxXY8V.js.map +1 -0
- package/dist/AssetCompiler-BLj09iu1.js +2424 -0
- package/dist/AssetCompiler-BLj09iu1.js.map +1 -0
- package/dist/AssetModule-DME-XaFS.js +2637 -0
- package/dist/AssetModule-DME-XaFS.js.map +1 -0
- package/dist/AssetRecipe-g8dZBhgJ.js +298 -0
- package/dist/AssetRecipe-g8dZBhgJ.js.map +1 -0
- package/dist/BrowserCodeWorker.js +53856 -0
- package/dist/BrowserCodeWorker.js.map +1 -0
- package/dist/CarryCapability-CXwHU5ay.js +104 -0
- package/dist/CarryCapability-CXwHU5ay.js.map +1 -0
- package/dist/KinematicHypothesisScreen-C3TKiuYR.js +241 -0
- package/dist/KinematicHypothesisScreen-C3TKiuYR.js.map +1 -0
- package/dist/ObjectTransform-BlQUNK7c.js +61 -0
- package/dist/ObjectTransform-BlQUNK7c.js.map +1 -0
- package/dist/RapierPhysicsBackend-B2wQe_Vl.js +3259 -0
- package/dist/RapierPhysicsBackend-B2wQe_Vl.js.map +1 -0
- package/dist/RenderingSystem-WIr1ZuGu.js +1042 -0
- package/dist/RenderingSystem-WIr1ZuGu.js.map +1 -0
- package/dist/ScenePresentation-LsYiDxbm.js +152 -0
- package/dist/ScenePresentation-LsYiDxbm.js.map +1 -0
- package/dist/SceneProject-K7HH1s8o.js +2687 -0
- package/dist/SceneProject-K7HH1s8o.js.map +1 -0
- package/dist/SceneSerializer-zOzbX4jZ.js +932 -0
- package/dist/SceneSerializer-zOzbX4jZ.js.map +1 -0
- package/dist/SimulationProfile-DSYZbBLQ.js +165 -0
- package/dist/SimulationProfile-DSYZbBLQ.js.map +1 -0
- package/dist/StylePack-DcRa_kU0.js +88 -0
- package/dist/StylePack-DcRa_kU0.js.map +1 -0
- package/dist/WorldArchive-BiFGLt--.js +451 -0
- package/dist/WorldArchive-BiFGLt--.js.map +1 -0
- package/dist/WorldCommands-Debj7V4L.js +2207 -0
- package/dist/WorldCommands-Debj7V4L.js.map +1 -0
- package/dist/WorldIO-Ch8QBfKY.js +151 -0
- package/dist/WorldIO-Ch8QBfKY.js.map +1 -0
- package/dist/admission-CVEvsrdz.js +121 -0
- package/dist/admission-CVEvsrdz.js.map +1 -0
- package/dist/blankWorld-B0MW6g7q.js +75 -0
- package/dist/blankWorld-B0MW6g7q.js.map +1 -0
- package/dist/core.d.ts +68 -0
- package/dist/core.js +209 -0
- package/dist/core.js.map +1 -0
- package/dist/disposeObject3D-DIMzy0FA.js +128 -0
- package/dist/disposeObject3D-DIMzy0FA.js.map +1 -0
- package/dist/environments-HOe3sJXH.js +567 -0
- package/dist/environments-HOe3sJXH.js.map +1 -0
- package/dist/gltfIO-BzVKLyaL.js +339 -0
- package/dist/gltfIO-BzVKLyaL.js.map +1 -0
- package/dist/grandUrbanBlock-DRndRZjF.js +515 -0
- package/dist/grandUrbanBlock-DRndRZjF.js.map +1 -0
- package/dist/index.d.ts +345 -0
- package/dist/index.js +16952 -0
- package/dist/index.js.map +1 -0
- package/dist/magicCabin-CfBZjx2Q.js +11019 -0
- package/dist/magicCabin-CfBZjx2Q.js.map +1 -0
- package/dist/manifests-D0LwbJ36.js +866 -0
- package/dist/manifests-D0LwbJ36.js.map +1 -0
- package/dist/mcp.d.ts +2 -0
- package/dist/mcp.js +1 -0
- package/dist/monumentHall-awZiGtda.js +403 -0
- package/dist/monumentHall-awZiGtda.js.map +1 -0
- package/dist/node.d.ts +16 -0
- package/dist/node.js +26 -0
- package/dist/parts-DrEcfJRl.js +37 -0
- package/dist/parts-DrEcfJRl.js.map +1 -0
- package/dist/rolldown-runtime-D3KUYPsf.js +12 -0
- package/dist/ruinedCourtyard-DuF7NmUU.js +696 -0
- package/dist/ruinedCourtyard-DuF7NmUU.js.map +1 -0
- package/dist/runtime/application/AgentTools.js +28 -0
- package/dist/runtime/application/README.md +14 -0
- package/dist/runtime/application/agent/ProgressiveAgentTools.js +92 -0
- package/dist/runtime/application/agent/StudioMcpAllowlist.js +10 -0
- package/dist/runtime/application/agent/StudioProjectTools.js +18 -0
- package/dist/runtime/application/agent/TaskEvidence.js +199 -0
- package/dist/runtime/application/buildTaskObservation.js +117 -0
- package/dist/runtime/application/code-execution/AuthoringSandboxEntry.js +50 -0
- package/dist/runtime/application/code-execution/BrowserCodeExecutor.js +35 -0
- package/dist/runtime/application/code-execution/BrowserCodeWorker.js +17 -0
- package/dist/runtime/application/code-execution/RemoteAuthoringDocument.js +82 -0
- package/dist/runtime/application/createSession.js +66 -0
- package/dist/runtime/application/createWorldAuthoringContext.js +400 -0
- package/dist/runtime/application/generation/GenerationOrchestrator.js +630 -0
- package/dist/runtime/application/generation/GenerationRuntime.js +215 -0
- package/dist/runtime/application/generation/PromptHybridWorldOrchestrator.js +289 -0
- package/dist/runtime/application/native-scene/CodeProject.js +215 -0
- package/dist/runtime/application/native-scene/CodeProjectModules.js +143 -0
- package/dist/runtime/application/native-scene/ExampleWorldCatalog.js +35 -0
- package/dist/runtime/application/native-scene/NativeArticulation.js +53 -0
- package/dist/runtime/application/native-scene/NativeEditableRegistry.js +150 -0
- package/dist/runtime/application/native-scene/NativeEnvironmentGeometry.js +85 -0
- package/dist/runtime/application/native-scene/NativeLightingInspection.js +33 -0
- package/dist/runtime/application/native-scene/NativeMaterialInspection.js +52 -0
- package/dist/runtime/application/native-scene/NativeOverlayCheckpoint.js +127 -0
- package/dist/runtime/application/native-scene/NativePhysicsGeometry.js +64 -0
- package/dist/runtime/application/native-scene/NativeRenderDiscovery.js +51 -0
- package/dist/runtime/application/native-scene/NativeSceneHost.js +406 -0
- package/dist/runtime/application/native-scene/NativeSceneInspection.js +203 -0
- package/dist/runtime/application/native-scene/NativeSceneOverlay.js +116 -0
- package/dist/runtime/application/native-scene/NativeSceneQuery.js +123 -0
- package/dist/runtime/application/native-scene/NativeSceneReview.js +132 -0
- package/dist/runtime/application/native-scene/NativeThreeModule.js +16 -0
- package/dist/runtime/application/native-scene/SceneObserver.js +97 -0
- package/dist/runtime/application/native-scene/VisualCapturePolicy.js +4 -0
- package/dist/runtime/application/object-forge/SceneObjectForge.js +263 -0
- package/dist/runtime/application/programmatic-assets/ProgrammaticAssetBuilder.js +59 -0
- package/dist/runtime/application/programmatic-assets/ProgrammaticAssetContract.js +22 -0
- package/dist/runtime/application/programmatic-assets/ThreeCodeAsset.js +40 -0
- package/dist/runtime/application/scene/CapabilityResolver.js +90 -0
- package/dist/runtime/application/scene/NativeEditableContracts.js +18 -0
- package/dist/runtime/application/scene/RequestWindow.js +54 -0
- package/dist/runtime/application/scene/SceneAgentTools.js +21 -0
- package/dist/runtime/application/scene/SceneContracts.js +49 -0
- package/dist/runtime/application/scene/SceneEditService.js +154 -0
- package/dist/runtime/application/scene/SceneFacade.js +356 -0
- package/dist/runtime/application/scene/SceneInteractionAdapters.js +41 -0
- package/dist/runtime/application/scene/SceneJobController.js +320 -0
- package/dist/runtime/application/scene/SceneLifecycle.js +57 -0
- package/dist/runtime/application/scene/ScenePackage.js +173 -0
- package/dist/runtime/application/scene/ScenePersistence.js +50 -0
- package/dist/runtime/application/scene/SceneProject.js +95 -0
- package/dist/runtime/application/scene/SceneSkillNames.js +5 -0
- package/dist/runtime/application/scene/StarterScene.js +56 -0
- package/dist/runtime/application/scene/WorldArchive.js +89 -0
- package/dist/runtime/application/scene/WorldDirectory.js +20 -0
- package/dist/runtime/application/scene/WorldDocument.js +76 -0
- package/dist/runtime/application/scene/WorldIO.js +103 -0
- package/dist/runtime/application/scene/WorldStorage.js +155 -0
- package/dist/runtime/application/skills/SkillRegistry.js +193 -0
- package/dist/runtime/application/skills/packs/acceptanceSkills.js +32 -0
- package/dist/runtime/application/skills/packs/affordanceSkills.js +36 -0
- package/dist/runtime/application/skills/packs/assetSkills.js +46 -0
- package/dist/runtime/application/skills/packs/authoringSkills.js +16 -0
- package/dist/runtime/application/skills/packs/batchSkills.js +22 -0
- package/dist/runtime/application/skills/packs/codeSkills.js +106 -0
- package/dist/runtime/application/skills/packs/generationSkills.js +45 -0
- package/dist/runtime/application/skills/packs/interactionSkills.js +46 -0
- package/dist/runtime/application/skills/packs/recoverySkills.js +80 -0
- package/dist/runtime/application/skills/packs/sceneSkills.js +24 -0
- package/dist/runtime/application/skills/packs/spatialSkills.js +35 -0
- package/dist/runtime/application/skills/packs/verificationSkills.js +14 -0
- package/dist/runtime/application/skills/packs/worldSkills.js +45 -0
- package/dist/runtime/application/skills/registerCoreSkills.js +31 -0
- package/dist/runtime/application/skills/skillPrimitives.js +4 -0
- package/dist/runtime/application/tasks/CabinetCupTask.js +76 -0
- package/dist/runtime/application/tasks.jsonl +67 -0
- package/dist/runtime/application/world-authoring/AuthoringAssetProducer.js +42 -0
- package/dist/runtime/application/world-authoring/AuthoringDiff.js +149 -0
- package/dist/runtime/application/world-authoring/AuthoringDocument.js +825 -0
- package/dist/runtime/application/world-authoring/AuthoringExecutionHost.js +109 -0
- package/dist/runtime/application/world-authoring/AuthoringIdentity.js +17 -0
- package/dist/runtime/application/world-authoring/AuthoringModelResolver.js +29 -0
- package/dist/runtime/application/world-authoring/AuthoringPatch.js +118 -0
- package/dist/runtime/application/world-authoring/AuthoringPromotionController.js +334 -0
- package/dist/runtime/application/world-authoring/AuthoringPromotionSource.js +126 -0
- package/dist/runtime/application/world-authoring/AuthoringRevisionHistory.js +144 -0
- package/dist/runtime/application/world-authoring/HeadlessImageExport.js +92 -0
- package/dist/runtime/application/world-authoring/ModelRef.js +62 -0
- package/dist/runtime/application/world-authoring/SceneGLBExport.js +88 -0
- package/dist/runtime/apps/mcp-server/AUTHORING.md +71 -0
- package/dist/runtime/apps/mcp-server/AgentMcpCompat.js +68 -0
- package/dist/runtime/apps/mcp-server/AuthoringSandboxEntry.js +1 -0
- package/dist/runtime/apps/mcp-server/AuthoringSandboxWorker.mjs +30 -0
- package/dist/runtime/apps/mcp-server/BuildEnvironment.js +17 -0
- package/dist/runtime/apps/mcp-server/CodeExecutor.js +71 -0
- package/dist/runtime/apps/mcp-server/DEPLOYMENT-PC2.md +42 -0
- package/dist/runtime/apps/mcp-server/DockerBuildRunner.js +66 -0
- package/dist/runtime/apps/mcp-server/FileAssetRepository.js +159 -0
- package/dist/runtime/apps/mcp-server/HeadlessAssetIO.js +8 -0
- package/dist/runtime/apps/mcp-server/HeadlessGLTFLoader.js +47 -0
- package/dist/runtime/apps/mcp-server/HeadlessWorldHost.js +157 -0
- package/dist/runtime/apps/mcp-server/IsolatedAuthoringExecutor.js +6 -0
- package/dist/runtime/apps/mcp-server/PROGRAMMATIC-ASSETS.md +116 -0
- package/dist/runtime/apps/mcp-server/ProgrammaticAssets.js +60 -0
- package/dist/runtime/apps/mcp-server/README.md +269 -0
- package/dist/runtime/apps/mcp-server/RemoteAuthoringDocument.js +1 -0
- package/dist/runtime/apps/mcp-server/SandboxBundle.js +13 -0
- package/dist/runtime/apps/mcp-server/SessionManager.js +148 -0
- package/dist/runtime/apps/mcp-server/StudioBridgeHttp.js +75 -0
- package/dist/runtime/apps/mcp-server/StudioLiveBridge.js +246 -0
- package/dist/runtime/apps/mcp-server/StudioProjectToolContracts.js +58 -0
- package/dist/runtime/apps/mcp-server/TransferHttp.js +47 -0
- package/dist/runtime/apps/mcp-server/TransferLimits.js +6 -0
- package/dist/runtime/apps/mcp-server/TransferStore.js +134 -0
- package/dist/runtime/apps/mcp-server/TrustedAuthoringWorker.mjs +16 -0
- package/dist/runtime/apps/mcp-server/VALIDATION.md +45 -0
- package/dist/runtime/apps/mcp-server/acceptance-evidence.json +332 -0
- package/dist/runtime/apps/mcp-server/errorDiagnostics.js +32 -0
- package/dist/runtime/apps/mcp-server/examples/code-house.js +24 -0
- package/dist/runtime/apps/mcp-server/examples/procedural-assets.js +85 -0
- package/dist/runtime/apps/mcp-server/main.mjs +82 -0
- package/dist/runtime/apps/mcp-server/registerTools.js +274 -0
- package/dist/runtime/apps/mcp-server/sandbox/run.mjs +23 -0
- package/dist/runtime/apps/mcp-server/security.js +23 -0
- package/dist/runtime/apps/mcp-server/tasks.jsonl +9 -0
- package/dist/runtime/apps/server/CapabilityAdapterRegistry.js +157 -0
- package/dist/runtime/apps/server/README.md +7 -0
- package/dist/runtime/apps/server/WorldRepository.js +338 -0
- package/dist/runtime/apps/server/WorldRepositoryHttp.js +96 -0
- package/dist/runtime/apps/server/openai-compatible-agent-gateway.mjs +278 -0
- package/dist/runtime/apps/server/tasks.jsonl +10 -0
- package/dist/runtime/apps/shared/node/WorldDiskStorage.js +62 -0
- package/dist/runtime/foundation/EventBus.js +26 -0
- package/dist/runtime/foundation/JsonGateway.js +47 -0
- package/dist/runtime/foundation/PngRgba.js +99 -0
- package/dist/runtime/foundation/PolicyEngine.js +21 -0
- package/dist/runtime/foundation/README.md +7 -0
- package/dist/runtime/foundation/TraceRecorder.js +76 -0
- package/dist/runtime/foundation/errors.js +8 -0
- package/dist/runtime/foundation/simulation/SimulationProfile.js +143 -0
- package/dist/runtime/foundation/version.js +2 -0
- package/dist/runtime/modules/agent/README.md +11 -0
- package/dist/runtime/modules/agent/ToolCallingAgent.js +19 -0
- package/dist/runtime/modules/agent/bootstrapWorld.js +10 -0
- package/dist/runtime/modules/agent/buildRecoveryProposals.js +533 -0
- package/dist/runtime/modules/agent/execution/AgentExecutionRules.js +128 -0
- package/dist/runtime/modules/agent/execution/AgentRunResults.js +55 -0
- package/dist/runtime/modules/agent/execution/AgentRunSession.js +393 -0
- package/dist/runtime/modules/agent/execution/AgentToolInvoker.js +40 -0
- package/dist/runtime/modules/agent/gateway/HttpLLMGateway.js +19 -0
- package/dist/runtime/modules/agent/prompt/index.js +52 -0
- package/dist/runtime/modules/agent/tasks.jsonl +94 -0
- package/dist/runtime/modules/artifact/ArtifactContentGate.js +144 -0
- package/dist/runtime/modules/artifact/ArtifactDescriptor.js +280 -0
- package/dist/runtime/modules/artifact/ArtifactImporter.js +185 -0
- package/dist/runtime/modules/artifact/ArtifactModule.js +111 -0
- package/dist/runtime/modules/artifact/ArtifactRegistry.js +197 -0
- package/dist/runtime/modules/artifact/IncrementalSha256.js +129 -0
- package/dist/runtime/modules/artifact/MemoryArtifactByteStore.js +115 -0
- package/dist/runtime/modules/artifact/README.md +7 -0
- package/dist/runtime/modules/artifact/storage/IndexedDbArtifactStore.js +67 -0
- package/dist/runtime/modules/artifact/tasks.jsonl +31 -0
- package/dist/runtime/modules/asset/AssetModule.js +416 -0
- package/dist/runtime/modules/asset/README.md +67 -0
- package/dist/runtime/modules/asset/loading/AssetLoader.js +157 -0
- package/dist/runtime/modules/asset/loading/GltfAssetLoader.js +61 -0
- package/dist/runtime/modules/asset/loading/builtins/BuiltinAssets.js +95 -0
- package/dist/runtime/modules/asset/loading/builtins/HouseDoor.js +33 -0
- package/dist/runtime/modules/asset/loading/builtins/IndustrialCabinet.js +103 -0
- package/dist/runtime/modules/asset/model/AssetInputContracts.js +139 -0
- package/dist/runtime/modules/asset/model/AssetRef.js +12 -0
- package/dist/runtime/modules/asset/model/MechanicalAssetDraft.js +172 -0
- package/dist/runtime/modules/asset/model/ProceduralTextureContract.js +24 -0
- package/dist/runtime/modules/asset/model/admission.js +117 -0
- package/dist/runtime/modules/asset/model/errors.js +6 -0
- package/dist/runtime/modules/asset/model/parts.js +27 -0
- package/dist/runtime/modules/asset/model/resourceBudget.js +10 -0
- package/dist/runtime/modules/asset/model/schema.js +150 -0
- package/dist/runtime/modules/asset/persistence/AssetManifestStore.js +78 -0
- package/dist/runtime/modules/asset/persistence/CompiledAssetStore.js +84 -0
- package/dist/runtime/modules/asset/persistence/LocalAssetLibrary.js +86 -0
- package/dist/runtime/modules/asset/persistence/LocalAssetLibraryStore.js +81 -0
- package/dist/runtime/modules/asset/production/AssetProductionPipeline.js +272 -0
- package/dist/runtime/modules/asset/production/AssetRecipe.js +91 -0
- package/dist/runtime/modules/asset/production/ProceduralTexture.js +85 -0
- package/dist/runtime/modules/asset/production/adapters/EmbodiedGenAdapter.js +45 -0
- package/dist/runtime/modules/asset/production/adapters/EmbodiedGenBundleAdapter.js +590 -0
- package/dist/runtime/modules/asset/production/compiler/AssetCompiler.js +173 -0
- package/dist/runtime/modules/asset/production/compiler/evidence/AnimationMotionEvidence.js +124 -0
- package/dist/runtime/modules/asset/production/compiler/evidence/StaticPanelEvidence.js +56 -0
- package/dist/runtime/modules/asset/production/compiler/gltfIO.js +6 -0
- package/dist/runtime/modules/asset/production/compiler/partGeometry.js +74 -0
- package/dist/runtime/modules/asset/production/compiler/passes/ArticulatedCollisionPass.js +63 -0
- package/dist/runtime/modules/asset/production/compiler/passes/ArticulationCandidatePass.js +48 -0
- package/dist/runtime/modules/asset/production/compiler/passes/AuthoringIntentPass.js +16 -0
- package/dist/runtime/modules/asset/production/compiler/passes/ColliderFallbackPass.js +30 -0
- package/dist/runtime/modules/asset/production/compiler/passes/CompileQualityPass.js +75 -0
- package/dist/runtime/modules/asset/production/compiler/passes/ExplicitDefinitionPass.js +20 -0
- package/dist/runtime/modules/asset/production/compiler/passes/GLTFInspectPass.js +34 -0
- package/dist/runtime/modules/asset/production/compiler/passes/GeometryPass.js +32 -0
- package/dist/runtime/modules/asset/production/compiler/passes/JointFramePass.js +116 -0
- package/dist/runtime/modules/asset/production/compiler/passes/KinematicEvidencePass.js +84 -0
- package/dist/runtime/modules/asset/production/compiler/passes/ManifestPass.js +63 -0
- package/dist/runtime/modules/asset/production/compiler/passes/NormalizeTransformPass.js +16 -0
- package/dist/runtime/modules/asset/production/compiler/passes/OptimizeGLBPass.js +23 -0
- package/dist/runtime/modules/asset/production/compiler/passes/PartColliderPass.js +50 -0
- package/dist/runtime/modules/asset/production/compiler/passes/PartGeometryEnrichmentPass.js +60 -0
- package/dist/runtime/modules/asset/production/compiler/passes/PartProposalPass.js +93 -0
- package/dist/runtime/modules/asset/production/compiler/passes/RemoteEnrichmentPass.js +32 -0
- package/dist/runtime/modules/asset/production/compiler/passes/ResourceBudgetPass.js +55 -0
- package/dist/runtime/modules/asset/production/compiler/passes/SegmentMaterializePass.js +203 -0
- package/dist/runtime/modules/asset/production/compiler/passes/SegmentationEvidencePass.js +43 -0
- package/dist/runtime/modules/asset/production/compiler/passes/SemanticHeuristicPass.js +33 -0
- package/dist/runtime/modules/asset/production/compiler/passes/StructurePass.js +60 -0
- package/dist/runtime/modules/asset/production/compiler/providers/HttpCompilerProvider.js +23 -0
- package/dist/runtime/modules/asset/production/verification/KinematicHypothesisScreen.js +198 -0
- package/dist/runtime/modules/asset/registry/AssetCatalog.js +72 -0
- package/dist/runtime/modules/asset/registry/AssetRegistry.js +51 -0
- package/dist/runtime/modules/asset/registry/manifests/index.js +173 -0
- package/dist/runtime/modules/asset/tasks.jsonl +87 -0
- package/dist/runtime/modules/generation/README.md +9 -0
- package/dist/runtime/modules/generation/connector/ConnectorArtifactClient.js +45 -0
- package/dist/runtime/modules/generation/connector/ConnectorCapabilityAdapter.js +169 -0
- package/dist/runtime/modules/generation/connector/ConnectorClient.js +192 -0
- package/dist/runtime/modules/generation/connector/ConnectorJobClient.js +167 -0
- package/dist/runtime/modules/generation/connector/ConnectorJobEventClient.js +179 -0
- package/dist/runtime/modules/generation/connector/ConnectorSession.js +202 -0
- package/dist/runtime/modules/generation/jobs/GenerationJobProjection.js +239 -0
- package/dist/runtime/modules/generation/jobs/GenerationJobReconciler.js +99 -0
- package/dist/runtime/modules/generation/jobs/GenerationJobStore.js +91 -0
- package/dist/runtime/modules/generation/jobs/GenerationJobTransportOverlay.js +50 -0
- package/dist/runtime/modules/generation/providers/ProviderRegistry.js +304 -0
- package/dist/runtime/modules/generation/tasks.jsonl +35 -0
- package/dist/runtime/modules/navigation/NavigationBackend.js +17 -0
- package/dist/runtime/modules/navigation/RecastNavigationBackend.js +263 -0
- package/dist/runtime/modules/physics/JoltPhysicsBackend.js +850 -0
- package/dist/runtime/modules/physics/PhysicsApiSurface.js +660 -0
- package/dist/runtime/modules/physics/PhysicsBackend.js +88 -0
- package/dist/runtime/modules/physics/RapierPhysicsBackend.js +414 -0
- package/dist/runtime/modules/rendering/README.md +7 -0
- package/dist/runtime/modules/rendering/RendererProbe.js +153 -0
- package/dist/runtime/modules/rendering/WebGpuPostFxPipeline.js +140 -0
- package/dist/runtime/modules/rendering/captureStill.js +54 -0
- package/dist/runtime/modules/rendering/createRenderer.js +76 -0
- package/dist/runtime/modules/rendering/disposeObject3D.js +37 -0
- package/dist/runtime/modules/rendering/loadGaussianSplatVisual.js +74 -0
- package/dist/runtime/modules/rendering/spatial/ThreeBvhRuntime.js +107 -0
- package/dist/runtime/modules/rendering/style/StylePack.js +34 -0
- package/dist/runtime/modules/rendering/style/StyleSystem.js +173 -0
- package/dist/runtime/modules/rendering/tasks.jsonl +7 -0
- package/dist/runtime/modules/world/README.md +13 -0
- package/dist/runtime/modules/world/build/WorldBuilder.js +170 -0
- package/dist/runtime/modules/world/compiler/PipelineEngine.js +32 -0
- package/dist/runtime/modules/world/compiler/WorldAdmission.js +43 -0
- package/dist/runtime/modules/world/compiler/WorldBehaviorCompiler.js +68 -0
- package/dist/runtime/modules/world/compiler/WorldCompilation.js +157 -0
- package/dist/runtime/modules/world/compiler/WorldComposer.js +201 -0
- package/dist/runtime/modules/world/compiler/WorldPhysicsAdmission.js +76 -0
- package/dist/runtime/modules/world/compiler/WorldRecompiler.js +356 -0
- package/dist/runtime/modules/world/compiler/WorldRetry.js +75 -0
- package/dist/runtime/modules/world/compiler/createWorldPipeline.js +379 -0
- package/dist/runtime/modules/world/content/blankWorld.js +35 -0
- package/dist/runtime/modules/world/content/environments.js +84 -0
- package/dist/runtime/modules/world/content/grandUrbanBlock.js +189 -0
- package/dist/runtime/modules/world/content/magic-cabin/README.md +28 -0
- package/dist/runtime/modules/world/content/magic-cabin/affordances.js +64 -0
- package/dist/runtime/modules/world/content/magic-cabin/cabinContents.js +7078 -0
- package/dist/runtime/modules/world/content/magic-cabin/lighting.js +26 -0
- package/dist/runtime/modules/world/content/magic-cabin/materials.js +20 -0
- package/dist/runtime/modules/world/content/magicCabin.js +190 -0
- package/dist/runtime/modules/world/content/monumentHall.js +154 -0
- package/dist/runtime/modules/world/content/ruinedCourtyard.js +196 -0
- package/dist/runtime/modules/world/content/suzhouGarden/README.md +141 -0
- package/dist/runtime/modules/world/content/suzhouGarden/index.js +137 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/arch.js +491 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/buildings.js +670 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/core.js +578 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/lod.js +127 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/main.js +642 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/nature.js +650 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/rockery.js +280 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/sky.js +242 -0
- package/dist/runtime/modules/world/content/suzhouGarden/src/water.js +215 -0
- package/dist/runtime/modules/world/content/woodlandWorkshop.js +192 -0
- package/dist/runtime/modules/world/content/yuanmingyuan/README.md +36 -0
- package/dist/runtime/modules/world/content/yuanmingyuan/arch.js +351 -0
- package/dist/runtime/modules/world/content/yuanmingyuan/buildings.js +490 -0
- package/dist/runtime/modules/world/content/yuanmingyuan/core.js +505 -0
- package/dist/runtime/modules/world/content/yuanmingyuan/index.js +101 -0
- package/dist/runtime/modules/world/content/yuanmingyuan/nature.js +435 -0
- package/dist/runtime/modules/world/content/yuanmingyuan/sky.js +169 -0
- package/dist/runtime/modules/world/content/yuanmingyuan/water.js +245 -0
- package/dist/runtime/modules/world/errors.js +9 -0
- package/dist/runtime/modules/world/generated/GeneratedWorldCoordinates.js +50 -0
- package/dist/runtime/modules/world/generated/GeneratedWorldLoader.js +297 -0
- package/dist/runtime/modules/world/runtime/CommandHistory.js +111 -0
- package/dist/runtime/modules/world/runtime/EntityCapabilityRegistry.js +165 -0
- package/dist/runtime/modules/world/runtime/NativeNavigationGeometry.js +84 -0
- package/dist/runtime/modules/world/runtime/NativePhysicsSnapshot.js +245 -0
- package/dist/runtime/modules/world/runtime/ObjectStore.js +31 -0
- package/dist/runtime/modules/world/runtime/ObjectTransform.js +62 -0
- package/dist/runtime/modules/world/runtime/ObservedEntity.js +37 -0
- package/dist/runtime/modules/world/runtime/ProjectCapabilities.js +240 -0
- package/dist/runtime/modules/world/runtime/SceneExtensions.js +36 -0
- package/dist/runtime/modules/world/runtime/ScenePresentation.js +101 -0
- package/dist/runtime/modules/world/runtime/SceneSerializer.js +281 -0
- package/dist/runtime/modules/world/runtime/WorldAuthority.js +41 -0
- package/dist/runtime/modules/world/runtime/WorldCollisionSignature.js +14 -0
- package/dist/runtime/modules/world/runtime/WorldCommands.js +503 -0
- package/dist/runtime/modules/world/runtime/WorldObservation.js +71 -0
- package/dist/runtime/modules/world/runtime/WorldQueries.js +340 -0
- package/dist/runtime/modules/world/runtime/WorldRecovery.js +78 -0
- package/dist/runtime/modules/world/runtime/WorldRuntime.js +806 -0
- package/dist/runtime/modules/world/runtime/affordance/ObjectAffordances.js +110 -0
- package/dist/runtime/modules/world/runtime/affordance/WorldAffordances.js +130 -0
- package/dist/runtime/modules/world/runtime/behavior/BehaviorCompiler.js +79 -0
- package/dist/runtime/modules/world/runtime/behavior/ProjectStateMachine.js +195 -0
- package/dist/runtime/modules/world/runtime/behavior/RuleGraph.js +70 -0
- package/dist/runtime/modules/world/runtime/behavior/RuleRuntime.js +115 -0
- package/dist/runtime/modules/world/runtime/graph/SceneGraph.js +390 -0
- package/dist/runtime/modules/world/runtime/interaction/ArticulationRuntime.js +214 -0
- package/dist/runtime/modules/world/runtime/interaction/CarryCapability.js +65 -0
- package/dist/runtime/modules/world/runtime/interaction/CarryRuntime.js +244 -0
- package/dist/runtime/modules/world/runtime/interaction/InteractionApproach.js +147 -0
- package/dist/runtime/modules/world/runtime/interaction/InteractionContract.js +57 -0
- package/dist/runtime/modules/world/runtime/interaction/ManipulationActions.js +7 -0
- package/dist/runtime/modules/world/runtime/interaction/NativePhysicalTarget.js +31 -0
- package/dist/runtime/modules/world/runtime/interaction/RecoveryRuntime.js +123 -0
- package/dist/runtime/modules/world/runtime/interaction/SettleRuntime.js +134 -0
- package/dist/runtime/modules/world/runtime/semantic/NativePhysicsState.js +89 -0
- package/dist/runtime/modules/world/runtime/semantic/SemanticWorldView.js +129 -0
- package/dist/runtime/modules/world/runtime/simulation/SimulationClock.js +89 -0
- package/dist/runtime/modules/world/runtime/simulation/SimulationSession.js +104 -0
- package/dist/runtime/modules/world/runtime/simulation/ThermalSystem.js +269 -0
- package/dist/runtime/modules/world/runtime/simulation/WorldTimeline.js +110 -0
- package/dist/runtime/modules/world/runtime/spatial/SpatialSnapshot.js +56 -0
- package/dist/runtime/modules/world/runtime/spatial/VisualMeshBounds.js +41 -0
- package/dist/runtime/modules/world/runtime/systems/AudioSystem.js +306 -0
- package/dist/runtime/modules/world/runtime/systems/Instrument.js +39 -0
- package/dist/runtime/modules/world/runtime/systems/InteractionSystem.js +806 -0
- package/dist/runtime/modules/world/runtime/systems/LocomotionSystem.js +281 -0
- package/dist/runtime/modules/world/runtime/systems/NavigationSystem.js +561 -0
- package/dist/runtime/modules/world/runtime/systems/PhysicsSystem.js +1752 -0
- package/dist/runtime/modules/world/runtime/systems/RenderingSystem.js +527 -0
- package/dist/runtime/modules/world/runtime/systems/SpatialSystem.js +402 -0
- package/dist/runtime/modules/world/spec/WorldIR.js +165 -0
- package/dist/runtime/modules/world/spec/WorldIRToolSchema.js +86 -0
- package/dist/runtime/modules/world/spec/WorldPlannerProposal.js +51 -0
- package/dist/runtime/modules/world/spec/WorldRevision.js +231 -0
- package/dist/runtime/modules/world/spec/WorldSpec.js +86 -0
- package/dist/runtime/modules/world/tasks.jsonl +530 -0
- package/dist/runtime/modules/world/verification/ArticulationVerifier.js +254 -0
- package/dist/runtime/modules/world/verification/Finding.js +105 -0
- package/dist/runtime/modules/world/verification/InteractionEvidence.js +73 -0
- package/dist/runtime/modules/world/verification/RepairEngine.js +49 -0
- package/dist/runtime/modules/world/verification/VisualLayoutAcceptance.js +58 -0
- package/dist/runtime/modules/world/verification/WorldAcceptance.js +176 -0
- package/dist/runtime/modules/world/verification/WorldValidator.js +67 -0
- package/dist/runtime/package-lock.json +16071 -0
- package/dist/runtime/package.json +106 -0
- 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-DT7K9NjP.js +165 -0
- package/dist/schema-DT7K9NjP.js.map +1 -0
- package/dist/suzhouGarden-Y3hny8j6.js +6150 -0
- package/dist/suzhouGarden-Y3hny8j6.js.map +1 -0
- package/dist/version-CHc-i8ch.js +5 -0
- package/dist/version-CHc-i8ch.js.map +1 -0
- package/dist/woodlandWorkshop-DsScU-cx.js +483 -0
- package/dist/woodlandWorkshop-DsScU-cx.js.map +1 -0
- package/dist/yuanmingyuan-DsFnPzzR.js +4955 -0
- package/dist/yuanmingyuan-DsFnPzzR.js.map +1 -0
- package/package.json +75 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RenderingSystem-WIr1ZuGu.js","names":[],"sources":["../../../modules/rendering/captureStill.js","../../../modules/rendering/createRenderer.js","../../../modules/rendering/RendererProbe.js","../../../modules/rendering/WebGpuPostFxPipeline.js","../../../modules/rendering/loadGaussianSplatVisual.js","../../../modules/world/generated/GeneratedWorldCoordinates.js","../../../modules/world/runtime/systems/RenderingSystem.js"],"sourcesContent":["import * as THREE from 'three';\n\n/** A bounded raster still rendered in an isolated WebGL context, not a\n * viewport screenshot. The scene's authoritative camera and shadow maps stay\n * owned by the live renderer. This is not a path tracer. */\nexport async function captureStill({scene,camera,decoration,excludedRoot,exposure=1,longEdge=1920}){\n if(![1920,3840].includes(longEdge)||!camera?.isPerspectiveCamera)throw new Error('STILL_OPTIONS_INVALID');\n const aspect=camera.aspect;\n if(!Number.isFinite(aspect)||aspect<=0||aspect>10)throw new Error('STILL_CAMERA_ASPECT_INVALID');\n const width=Math.max(1,Math.round(aspect>=1?longEdge:longEdge*aspect));\n const height=Math.max(1,Math.round(aspect>=1?longEdge/aspect:longEdge));\n if(width*height>16_000_000)throw new Error('STILL_PIXEL_LIMIT');\n const shadows=[];\n scene.traverse(node=>{\n if([].concat(node.material||[]).some(material=>material?.isNodeMaterial))throw new Error('STILL_NODE_MATERIAL_UNSUPPORTED');\n if(node.isLight&&node.shadow)shadows.push([node,node.shadow]);\n });\n // Limit shadow atlas allocations, particularly point lights with six faces.\n const shadowWeight=shadows.reduce((sum,[light])=>sum+(light.castShadow?(light.isPointLight?8:1):0),0);\n const shadowSize=shadowWeight>8?512:shadowWeight>2?1024:2048;\n const renderer=new THREE.WebGLRenderer({antialias:true,preserveDrawingBuffer:true});\n const shot=camera.clone();shot.aspect=width/height;shot.updateProjectionMatrix();\n const visible=decoration?.visible;\n const excludedVisible=excludedRoot?.visible;\n let restoreNeeded=false;\n const restore=()=>{\n if(!restoreNeeded)return;\n restoreNeeded=false;\n if(decoration)decoration.visible=visible;\n if(excludedRoot)excludedRoot.visible=excludedVisible;\n for(const [light,shadow] of shadows){if(light.shadow!==shadow)light.shadow.dispose();light.shadow=shadow;}\n };\n try{\n renderer.setPixelRatio(1);renderer.setSize(width,height,false);\n renderer.outputColorSpace=THREE.SRGBColorSpace;\n renderer.toneMapping=THREE.ACESFilmicToneMapping;renderer.toneMappingExposure=exposure;\n renderer.shadowMap.enabled=true;renderer.shadowMap.type=THREE.PCFSoftShadowMap;\n if(width>renderer.capabilities.maxTextureSize||height>renderer.capabilities.maxTextureSize)throw new Error('STILL_GPU_LIMIT');\n restoreNeeded=true;\n if(decoration)decoration.visible=false;\n if(excludedRoot)excludedRoot.visible=false;\n for(const [light,shadow] of shadows){\n light.shadow=shadow.clone();\n if(light.castShadow){const size=light.isPointLight?Math.min(512,shadowSize):shadowSize;light.shadow.mapSize.set(size,size);}\n }\n try{renderer.render(scene,shot);}\n finally{restore();}\n const blob=await new Promise((resolve,reject)=>renderer.domElement.toBlob(value=>value?resolve(value):reject(new Error('STILL_ENCODE_FAILED')),'image/png'));\n return {blob,width,height};\n }finally{\n restore();\n renderer.dispose();renderer.forceContextLoss();\n }\n}\n","import { WebGPURenderer } from 'three/webgpu';\nimport { WebGLRenderer } from 'three';\n\nexport const RENDERER_MODE = Object.freeze({\n AUTO: 'auto',\n WEBGPU: 'webgpu',\n WEBGL2: 'webgl2',\n WEBGL_LEGACY: 'webgl-legacy'\n});\n\nconst VALID_MODES = new Set(Object.values(RENDERER_MODE));\n\nexport function normalizeRendererMode(value = RENDERER_MODE.AUTO) {\n const text = String(value ?? '').trim().toLowerCase();\n const mode = text === '' ? RENDERER_MODE.AUTO : (text === 'webgl' ? RENDERER_MODE.WEBGL2 : text);\n if (!VALID_MODES.has(mode)) {\n const error = new RangeError(`Unsupported renderer mode: ${value}`);\n error.code = 'RENDERER_MODE_INVALID';\n throw error;\n }\n return mode;\n}\n\nexport function rendererBackend(renderer) {\n if (renderer?.backend?.isWebGPUBackend === true) return RENDERER_MODE.WEBGPU;\n if (renderer?.backend?.isWebGLBackend === true || renderer?.isWebGLRenderer === true) return RENDERER_MODE.WEBGL2;\n return 'unknown';\n}\n\nexport function rendererDiagnostics(renderer, requestedMode = RENDERER_MODE.AUTO) {\n const mode = normalizeRendererMode(requestedMode);\n const backend = rendererBackend(renderer);\n return Object.freeze({\n renderer: renderer?.isWebGPURenderer === true ? 'WebGPURenderer' : renderer?.constructor?.name || 'unknown',\n requestedMode: mode,\n backend,\n fallback: mode === RENDERER_MODE.AUTO && backend === RENDERER_MODE.WEBGL2\n });\n}\n\nexport async function createRenderer({\n mode = RENDERER_MODE.AUTO,\n antialias = true,\n alpha = false,\n trackTimestamp = false,\n RendererClass = WebGPURenderer\n} = {}) {\n const requestedMode = normalizeRendererMode(mode);\n const Renderer = requestedMode === RENDERER_MODE.WEBGL_LEGACY ? WebGLRenderer : RendererClass;\n const renderer = new Renderer({\n antialias: Boolean(antialias),\n alpha: Boolean(alpha),\n trackTimestamp: Boolean(trackTimestamp),\n forceWebGL: requestedMode === RENDERER_MODE.WEBGL2\n });\n\n await renderer.init?.();\n const info = rendererDiagnostics(renderer, requestedMode);\n\n if (info.backend === 'unknown') {\n renderer.dispose?.();\n const error = new Error('Renderer initialized without a recognized WebGPU/WebGL2 backend');\n error.code = 'RENDERER_BACKEND_UNKNOWN';\n throw error;\n }\n\n if (requestedMode === RENDERER_MODE.WEBGPU && info.backend !== RENDERER_MODE.WEBGPU) {\n renderer.dispose?.();\n const error = new Error('WebGPU renderer mode was required but Three.js fell back to WebGL2');\n error.code = 'RENDERER_WEBGPU_REQUIRED';\n error.backend = info.backend;\n throw error;\n }\n\n return { renderer, info };\n}","import { rendererDiagnostics } from './createRenderer.js';\n\nconst WEBGPU_LIMIT_KEYS = Object.freeze([\n 'maxTextureDimension2D',\n 'maxBindGroups',\n 'maxBufferSize',\n 'maxUniformBufferBindingSize',\n 'maxStorageBufferBindingSize',\n 'maxComputeWorkgroupStorageSize',\n 'maxComputeInvocationsPerWorkgroup',\n 'maxStorageBuffersPerShaderStage',\n 'maxComputeWorkgroupSizeX',\n 'maxComputeWorkgroupSizeY',\n 'maxComputeWorkgroupSizeZ',\n 'maxComputeWorkgroupsPerDimension'\n]);\n\nconst scalar = (value) => typeof value === 'bigint'\n ? (value <= BigInt(Number.MAX_SAFE_INTEGER) ? Number(value) : value.toString())\n : value;\n\nfunction deviceDiagnostics(renderer) {\n const backend = renderer?.backend;\n if (backend?.isWebGPUBackend !== true) {\n return {\n compatibilityMode: null,\n timestampSupported: Boolean(backend?.disjoint),\n features: [],\n limits: {}\n };\n }\n\n const device = backend.device;\n const limits = {};\n for (const key of WEBGPU_LIMIT_KEYS) {\n const value = device?.limits?.[key];\n if (value != null) limits[key] = scalar(value);\n }\n\n return {\n compatibilityMode: backend.compatibilityMode === true,\n timestampSupported: Boolean(device?.features?.has?.('timestamp-query')),\n features: device?.features ? [...device.features].map(String).sort() : [],\n limits\n };\n}\n\nexport class RendererProbe {\n constructor(renderer, {\n requestedMode = 'auto',\n timingIntervalMs = 1000,\n onDeviceLost = null,\n onError = null\n } = {}) {\n if (!renderer) throw new TypeError('RendererProbe requires a renderer');\n this.renderer = renderer;\n this.info = rendererDiagnostics(renderer, requestedMode);\n this.device = deviceDiagnostics(renderer);\n this.health = 'ready';\n this.lastError = null;\n this.gpuTimeMs = null;\n this.frameIntervals=[];\n this.lastFrameAt=null;\n this.renderCpuMs=[];\n this.timingIntervalMs = Math.max(250, Number(timingIntervalMs) || 1000);\n this.nextTimingAt = 0;\n this.timingPromise = null;\n this.onDeviceLost = typeof onDeviceLost === 'function' ? onDeviceLost : null;\n this.onError = typeof onError === 'function' ? onError : null;\n this.previousDeviceLost = renderer.onDeviceLost;\n this.previousError = renderer.onError;\n\n renderer.onDeviceLost = (detail) => {\n this.previousDeviceLost?.call(renderer, detail);\n this.health = 'lost';\n this.lastError = normalizeRendererError(detail, 'device-lost');\n this.onDeviceLost?.(this.lastError);\n };\n renderer.onError = (detail) => {\n this.previousError?.call(renderer, detail);\n if (this.health !== 'lost') this.health = 'degraded';\n this.lastError = normalizeRendererError(detail, 'backend-error');\n this.onError?.(this.lastError);\n };\n }\n\n afterRender(timestamp = 0, renderCpuMs = null) {\n if(Number.isFinite(timestamp)) {\n const interval=this.lastFrameAt==null?null:timestamp-this.lastFrameAt;\n // Background-tab suspension starts a fresh window instead of inflating frame percentiles.\n if(interval>1000){this.frameIntervals.length=0;this.renderCpuMs.length=0;}\n else if(interval>0)pushSample(this.frameIntervals,interval);\n this.lastFrameAt=timestamp;\n }\n if(Number.isFinite(renderCpuMs) && renderCpuMs>=0)pushSample(this.renderCpuMs,renderCpuMs);\n if (!this.renderer?.backend?.trackTimestamp || this.health === 'lost') return;\n if (this.timingPromise || timestamp < this.nextTimingAt) return;\n this.nextTimingAt = timestamp + this.timingIntervalMs;\n this.timingPromise = Promise.resolve(this.renderer.resolveTimestampsAsync?.('render'))\n .then((value) => {\n if (Number.isFinite(value)) this.gpuTimeMs = value;\n })\n .catch((error) => {\n this.lastError = normalizeRendererError(error, 'timestamp-error');\n })\n .finally(() => { this.timingPromise = null; });\n }\n\n snapshot() {\n return Object.freeze({\n ...this.info,\n health: this.health,\n gpuTiming: Boolean(this.renderer?.backend?.trackTimestamp),\n gpuTimeMs: this.gpuTimeMs,\n frameIntervalMs:percentiles(this.frameIntervals),\n renderCpuMs:percentiles(this.renderCpuMs),\n workload:{\n drawCalls:this.renderer?.info?.render?.drawCalls ?? this.renderer?.info?.render?.calls ?? null,\n triangles:this.renderer?.info?.render?.triangles ?? null,\n geometries:this.renderer?.info?.memory?.geometries ?? null,\n textures:this.renderer?.info?.memory?.textures ?? null\n },\n compatibilityMode: this.device.compatibilityMode,\n timestampSupported: this.device.timestampSupported,\n features: [...this.device.features],\n limits: { ...this.device.limits },\n lastError: this.lastError ? { ...this.lastError } : null\n });\n }\n\n dispose() {\n if (!this.renderer) return;\n this.renderer.onDeviceLost = this.previousDeviceLost;\n this.renderer.onError = this.previousError;\n this.renderer = null;\n }\n}\n\nfunction pushSample(samples,value) {if(samples.length===240)samples.shift();samples.push(value);}\nfunction percentiles(samples) {\n if(!samples.length)return {samples:0,p50:null,p95:null};\n const sorted=[...samples].sort((a,b)=>a-b);\n return {samples:sorted.length,p50:sorted[Math.ceil(sorted.length*.5)-1],p95:sorted[Math.ceil(sorted.length*.95)-1]};\n}\n\nfunction normalizeRendererError(detail, fallbackType) {\n return Object.freeze({\n type: String(detail?.type || fallbackType),\n api: detail?.api ? String(detail.api) : null,\n reason: detail?.reason ? String(detail.reason) : null,\n message: String(detail?.message || detail?.error?.message || detail || 'Unknown renderer error')\n });\n}\n","import { RenderPipeline } from 'three/webgpu';\nimport { mrt, normalView, output, pass, renderOutput, vec3, vec4 } from 'three/tsl';\nimport { bloom } from 'three/examples/jsm/tsl/display/BloomNode.js';\nimport { fxaa } from 'three/examples/jsm/tsl/display/FXAANode.js';\nimport { ao } from 'three/examples/jsm/tsl/display/GTAONode.js';\n\nconst DEFAULT_OPTIONS = Object.freeze({\n ao: Object.freeze({\n enabled: true,\n resolutionScale: 0.5,\n radius: 0.45,\n thickness: 1,\n distanceExponent: 1,\n distanceFallOff: 1,\n scale: 1,\n samples: 12\n }),\n bloom: Object.freeze({\n enabled: true,\n strength: 0.18,\n radius: 0.25,\n threshold: 1.05\n }),\n fxaa: Object.freeze({ enabled: true })\n});\n\nconst effectOptions = (defaults, value) => {\n if (value === false) return { ...defaults, enabled: false };\n if (value === true || value == null) return { ...defaults };\n const merged = { ...defaults, ...value, enabled: value.enabled !== false };\n for (const [key, fallback] of Object.entries(defaults)) {\n if (typeof fallback === 'number' && (typeof merged[key] !== 'number' || !Number.isFinite(merged[key]))) {\n merged[key] = fallback;\n }\n }\n return merged;\n};\n\nexport function normalizeWebGpuPostFxOptions(options = {}) {\n return {\n ao: effectOptions(DEFAULT_OPTIONS.ao, options.ao),\n bloom: effectOptions(DEFAULT_OPTIONS.bloom, options.bloom),\n fxaa: effectOptions(DEFAULT_OPTIONS.fxaa, options.fxaa)\n };\n}\n\nexport function supportsWebGpuPostFx(renderer) {\n return renderer?.backend?.isWebGPUBackend === true;\n}\n\nexport class WebGpuPostFxPipeline {\n constructor({ renderer, scene, camera, options = {} } = {}) {\n if (!renderer) throw new TypeError('WebGpuPostFxPipeline requires a renderer');\n if (!scene) throw new TypeError('WebGpuPostFxPipeline requires a scene');\n if (!camera) throw new TypeError('WebGpuPostFxPipeline requires a camera');\n\n this.renderer = renderer;\n this.scene = scene;\n this.camera = camera;\n this.options = normalizeWebGpuPostFxOptions(options);\n this.enabled = supportsWebGpuPostFx(renderer);\n this.pipeline = null;\n this.scenePass = null;\n this.aoNode = null;\n this.bloomNode = null;\n\n if (this.enabled) this.build();\n }\n\n build() {\n const scenePass = pass(this.scene, this.camera, { samples:0 });\n scenePass.setMRT(mrt({ output, normal: normalView }));\n\n const sceneColor = scenePass.getTextureNode('output');\n const sceneNormal = scenePass.getTextureNode('normal');\n const sceneDepth = scenePass.getTextureNode('depth');\n let composite = sceneColor;\n\n if (this.options.ao.enabled) {\n const settings = this.options.ao;\n const aoNode = ao(sceneDepth, sceneNormal, this.camera);\n aoNode.resolutionScale = settings.resolutionScale;\n aoNode.radius.value = settings.radius;\n aoNode.thickness.value = settings.thickness;\n aoNode.distanceExponent.value = settings.distanceExponent;\n aoNode.distanceFallOff.value = settings.distanceFallOff;\n aoNode.scale.value = settings.scale;\n aoNode.samples.value = settings.samples;\n const visibility = aoNode.getTextureNode().r;\n composite = composite.mul(vec4(vec3(visibility), 1));\n this.aoNode = aoNode;\n }\n\n if (this.options.bloom.enabled) {\n const settings = this.options.bloom;\n this.bloomNode = bloom(sceneColor, settings.strength, settings.radius, settings.threshold);\n composite = composite.add(this.bloomNode);\n }\n\n const pipeline = new RenderPipeline(this.renderer);\n if (this.options.fxaa.enabled) {\n pipeline.outputColorTransform = false;\n composite = fxaa(renderOutput(composite));\n }\n pipeline.outputNode = composite;\n\n this.scenePass = scenePass;\n this.pipeline = pipeline;\n }\n\n render() {\n if (!this.enabled || !this.pipeline) return false;\n this.pipeline.render();\n return true;\n }\n\n diagnostics() {\n return Object.freeze({\n enabled: this.enabled,\n backend: this.enabled ? 'webgpu' : 'unsupported',\n effects: [\n this.options.ao.enabled ? 'gtao' : null,\n this.options.bloom.enabled ? 'bloom' : null,\n this.options.fxaa.enabled ? 'fxaa' : null\n ].filter(Boolean)\n });\n }\n\n dispose() {\n this.scenePass?.dispose?.();\n this.scenePass = null;\n this.aoNode?.dispose?.();\n this.aoNode = null;\n this.bloomNode?.dispose?.();\n this.bloomNode = null;\n this.pipeline?.dispose?.();\n this.pipeline = null;\n this.enabled = false;\n }\n}\n","import { disposeObject3D } from './disposeObject3D.js';\n\nconst asArrayBuffer=(bytes)=>bytes.buffer.slice(bytes.byteOffset,bytes.byteOffset+bytes.byteLength);\nexport const DEFAULT_RUNTIME_SPLAT_BUDGET=500_000;\n\nconst sampleTypedArray=(input,stride,sourceCount,targetCount)=>{\n if(!input || targetCount>=sourceCount)return input;\n const output=new input.constructor(targetCount*stride);\n for(let index=0;index<targetCount;index+=1){\n const sourceIndex=Math.min(sourceCount-1,Math.floor(index*sourceCount/targetCount));\n output.set(input.subarray(sourceIndex*stride,sourceIndex*stride+stride),index*stride);\n }\n return output;\n};\n\nexport function budgetGaussianData(data,maxSplats=DEFAULT_RUNTIME_SPLAT_BUDGET){\n const sourceSplatCount=Math.floor((data?.position?.length||0)/4);\n if(!sourceSplatCount)return {data,sourceSplatCount:0,splatCount:0,sampled:false};\n const budget=Number.isFinite(maxSplats)&&maxSplats>0?Math.floor(maxSplats):DEFAULT_RUNTIME_SPLAT_BUDGET;\n const splatCount=Math.min(sourceSplatCount,budget);\n if(splatCount===sourceSplatCount)return {data,sourceSplatCount,splatCount,sampled:false};\n const extra=data.extra||{};\n return {\n data:{\n ...data,\n position:sampleTypedArray(data.position,4,sourceSplatCount,splatCount),\n color:sampleTypedArray(data.color,4,sourceSplatCount,splatCount),\n covariance:sampleTypedArray(data.covariance,8,sourceSplatCount,splatCount),\n extra:{\n ...extra,\n ...(extra.sh1?{sh1:sampleTypedArray(extra.sh1,2,sourceSplatCount,splatCount)}:{}),\n ...(extra.sh2?{sh2:sampleTypedArray(extra.sh2,4,sourceSplatCount,splatCount)}:{}),\n ...(extra.sh3?{sh3:sampleTypedArray(extra.sh3,4,sourceSplatCount,splatCount)}:{})\n }\n },\n sourceSplatCount,\n splatCount,\n sampled:true\n };\n}\n\nexport async function loadGaussianSplatVisual({source,maxSplats=DEFAULT_RUNTIME_SPLAT_BUDGET}={}) {\n if(!source) throw new TypeError('Gaussian splat visual source is required');\n const format=String(source.format||source.url?.split(/[?#]/,1)[0]?.split('.').at(-1)||'').toLowerCase();\n if(format!=='spz') throw new TypeError(`Unsupported generated visual format: ${format||'unknown'}`);\n const bytes=source.data instanceof Uint8Array\n ? source.data\n : source.data instanceof ArrayBuffer\n ? new Uint8Array(source.data)\n : null;\n let buffer;\n if(bytes) buffer=asArrayBuffer(bytes);\n else {\n if(typeof source.url!=='string'||!source.url) throw new TypeError('Gaussian splat visual requires url or data');\n const response=await fetch(source.url);\n if(!response.ok) throw new Error(`Failed to load generated SPZ visual: ${response.status}`);\n buffer=await response.arrayBuffer();\n }\n\n const {GSMesh,SpzLoader}=await import('three-gsmesh');\n const parsed=await new SpzLoader({includeSH:true}).parseData(buffer);\n const budgeted=budgetGaussianData(parsed,maxSplats);\n if(!budgeted.splatCount) throw new Error('Generated SPZ visual contains no splats');\n const object=new GSMesh(budgeted.data,{sortIntervalFrames:3});\n object.name='GaussianSplatVisual';\n return {\n object,\n format:'spz',\n splatCount:budgeted.splatCount,\n sourceSplatCount:budgeted.sourceSplatCount,\n sampled:budgeted.sampled,\n dispose(){ disposeObject3D(object); }\n };\n}\n","import * as THREE from 'three';\n\nconst SUPPORTED_GENERATED_WORLD_COORDINATES = new Set(['y-up', 'z-up']);\n\nexport function validateGeneratedWorldCoordinates(coordinateSystem = 'y-up', metersPerUnit = 1) {\n if (!SUPPORTED_GENERATED_WORLD_COORDINATES.has(coordinateSystem)) {\n throw new TypeError('coordinateSystem must be y-up or z-up');\n }\n if (!Number.isFinite(metersPerUnit) || metersPerUnit <= 0) {\n throw new TypeError('metersPerUnit must be a positive finite number');\n }\n return { coordinateSystem, metersPerUnit };\n}\n\nexport function generatedWorldTransformMatrix(coordinateSystem = 'y-up', metersPerUnit = 1) {\n validateGeneratedWorldCoordinates(coordinateSystem, metersPerUnit);\n const matrix = new THREE.Matrix4();\n if (coordinateSystem === 'z-up') matrix.makeRotationX(-Math.PI / 2);\n if (metersPerUnit !== 1) matrix.premultiply(new THREE.Matrix4().makeScale(metersPerUnit, metersPerUnit, metersPerUnit));\n return matrix;\n}\n\nexport function applyGeneratedWorldGeometryTransform(geometry, coordinateSystem = 'y-up', metersPerUnit = 1) {\n if (!geometry?.applyMatrix4) throw new TypeError('Generated world geometry must support applyMatrix4');\n geometry.applyMatrix4(generatedWorldTransformMatrix(coordinateSystem, metersPerUnit));\n return geometry;\n}\n\nexport function applyGeneratedWorldObjectTransform(object, coordinateSystem = 'y-up', metersPerUnit = 1) {\n if (!object?.applyMatrix4) throw new TypeError('Generated world visual must be an Object3D');\n object.applyMatrix4(generatedWorldTransformMatrix(coordinateSystem, metersPerUnit));\n object.updateMatrixWorld?.(true);\n return object;\n}\nexport function transformGeneratedWorldPoint(point, coordinateSystem = 'y-up', metersPerUnit = 1) {\n if (!Array.isArray(point) || point.length !== 3 || !point.every(Number.isFinite)) {\n throw new TypeError('Generated world point must contain 3 finite numbers');\n }\n return new THREE.Vector3(...point).applyMatrix4(generatedWorldTransformMatrix(coordinateSystem, metersPerUnit)).toArray();\n}\n\nexport function transformGeneratedWorldBounds(bounds, coordinateSystem = 'y-up', metersPerUnit = 1) {\n if (!bounds || !Array.isArray(bounds.min) || !Array.isArray(bounds.max) || bounds.min.length !== 3 || bounds.max.length !== 3\n || !bounds.min.every(Number.isFinite) || !bounds.max.every(Number.isFinite)) {\n throw new TypeError('Generated world bounds require finite min/max vec3 values');\n }\n const box = new THREE.Box3(new THREE.Vector3(...bounds.min), new THREE.Vector3(...bounds.max));\n box.applyMatrix4(generatedWorldTransformMatrix(coordinateSystem, metersPerUnit));\n return { min:box.min.toArray(), max:box.max.toArray() };\n}\n","import * as THREE from 'three';\nimport { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';\nimport { HDRLoader } from 'three/examples/jsm/loaders/HDRLoader.js';\nimport { captureStill } from '../../../rendering/captureStill.js';\nimport { createRenderer } from '../../../rendering/createRenderer.js';\nimport { RendererProbe } from '../../../rendering/RendererProbe.js';\nimport { WebGpuPostFxPipeline } from '../../../rendering/WebGpuPostFxPipeline.js';\nimport { loadGaussianSplatVisual } from '../../../rendering/loadGaussianSplatVisual.js';\nimport { applyGeneratedWorldObjectTransform } from '../../generated/GeneratedWorldCoordinates.js';\nimport { PRESENTATION_HDRI_PRESETS } from '../ScenePresentation.js';\nimport { resolveStylePack } from '../../../rendering/style/StylePack.js';\n\nexport class RenderingSystem {\n attachStyleSystem(styles) { this.styleSystem = styles; }\n serializeStyle() { return this.styleSystem?.export() || null; }\n validateStyle(input) { return input == null ? null : resolveStylePack(input); }\n async restoreStyle(input) {\n if (!this.styleSystem) { if (input) throw new Error('STYLE_UNAVAILABLE'); return; }\n if (input) return this.styleSystem.set(input);\n this.styleSystem.clear();\n }\n constructor({\n container,\n scene,\n events = null,\n rendererFactory = createRenderer,\n rendererMode = 'auto',\n rendererTiming = false,\n pixelRatioScale = 1,\n ResizeObserverClass = globalThis.ResizeObserver,\n controlsFactory = (camera, domElement) => new OrbitControls(camera, domElement),\n environmentLoader = new HDRLoader(),\n postFxFactory = (options) => new WebGpuPostFxPipeline(options),\n postFxOptions = {},\n generatedVisualLoader = loadGaussianSplatVisual,\n onDeviceLost = null,\n onError = null,\n authoringStage = true\n } = {}) {\n if (!container) throw new TypeError('RenderingSystem requires a container');\n if (!scene) throw new TypeError('RenderingSystem requires a scene');\n if (typeof rendererFactory !== 'function') throw new TypeError('RenderingSystem rendererFactory must be a function');\n if (typeof controlsFactory !== 'function') throw new TypeError('RenderingSystem controlsFactory must be a function');\n if (!environmentLoader || typeof environmentLoader.loadAsync !== 'function') throw new TypeError('RenderingSystem requires an environment loader');\n if (typeof postFxFactory !== 'function') throw new TypeError('RenderingSystem postFxFactory must be a function');\n if (typeof generatedVisualLoader !== 'function') throw new TypeError('RenderingSystem generatedVisualLoader must be a function');\n if (!Number.isFinite(pixelRatioScale) || pixelRatioScale < 0.5 || pixelRatioScale > 1)\n throw new RangeError('RenderingSystem pixelRatioScale must be between 0.5 and 1');\n\n this.container = container;\n this.scene = scene;\n this.events = events;\n this.rendererFactory = rendererFactory;\n this.rendererMode = rendererMode;\n this.rendererTiming = Boolean(rendererTiming);\n this.pixelRatioScale = pixelRatioScale;\n this.ResizeObserverClass = ResizeObserverClass;\n this.controlsFactory = controlsFactory;\n this.environmentLoader = environmentLoader;\n this.postFxFactory = postFxFactory;\n this.postFxOptions = postFxOptions;\n this.generatedVisualLoader = generatedVisualLoader;\n this.onDeviceLost = typeof onDeviceLost === 'function' ? onDeviceLost : null;\n this.onError = typeof onError === 'function' ? onError : null;\n this.camera = null;\n this.renderer = null;\n this.controls = null;\n this.info = null;\n this.probe = null;\n this.environmentTexture = null;\n this.environmentVersion = 0;\n this.lightingVersion = 0;\n this.baseLighting = null;\n this.presentationLighting = null;\n this.lightingStatus = \"none\";\n this.creativeCamera = null;\n this.creativeView = false;\n this.environmentTask = Promise.resolve(false);\n this.postFx = null;\n this.generatedVisual = null;\n this.generatedVisualState = { status:'none', format:null, splatCount:0 };\n this.resizeObserver = null;\n this.resizeWidth = 0;\n this.resizeHeight = 0;\n this.visualTask = Promise.resolve(false);\n this.decorationRoot = new THREE.Group();\n this.decorationRoot.name = '$visual-decorations';\n this.decorationRoot.userData.visualDecorationRoot = true;\n this.authoringScenes = new Map();\n this.authoringStageEnabled = authoringStage !== false;\n this.authoringStage = null;\n }\n\n // A tiny editor-like ground reference for empty draft worlds. Rendered only\n // while a replacement authoring scene is active and has no content yet, so a\n // brand-new draft does not read as a broken black viewport. Never enters the\n // authoring document (it lives in its own Scene).\n ensureAuthoringStage() {\n if (this.authoringStage) return this.authoringStage;\n const stage = new THREE.Scene();\n stage.name = '$authoring-stage';\n stage.add(new THREE.GridHelper(24, 24, 0x8e909b, 0x303446));\n this.authoringStage = stage;\n return stage;\n }\n\n addDecoration(object) {\n if (!object?.isObject3D) throw new TypeError('Visual decoration must be an Object3D');\n if (object.userData?.instanceId) {\n const error = new TypeError('World Entity cannot be attached as Visual Decoration');\n error.code = 'WORLD_ENTITY_AS_DECORATION';\n throw error;\n }\n object.userData ||= {};\n object.userData.visualDecoration = true;\n if (this.decorationRoot.parent !== this.scene) this.scene.add(this.decorationRoot);\n this.decorationRoot.add(object);\n return object;\n }\n\n removeDecoration(object) {\n if (!object?.isObject3D || object.parent !== this.decorationRoot) return false;\n this.decorationRoot.remove(object);\n return true;\n }\n\n addAuthoringScene(scene, { mode = 'overlay' } = {}) {\n if (!scene?.isScene) throw new TypeError('Authoring presentation requires a THREE.Scene');\n if (!['hidden', 'overlay', 'replace'].includes(mode)) throw new TypeError(`Unsupported authoring scene mode: ${mode}`);\n this.authoringScenes.set(scene, mode);\n return scene;\n }\n\n setAuthoringSceneMode(scene, mode = 'overlay') {\n if (!this.authoringScenes.has(scene)) return false;\n if (!['hidden', 'overlay', 'replace'].includes(mode)) throw new TypeError(`Unsupported authoring scene mode: ${mode}`);\n this.authoringScenes.set(scene, mode);\n return true;\n }\n\n removeAuthoringScene(scene) {\n return this.authoringScenes.delete(scene);\n }\n\n async init() {\n this.camera = new THREE.PerspectiveCamera(45, 1, 0.05, 120);\n const result = await this.rendererFactory({\n mode: this.rendererMode,\n antialias: true,\n alpha: false,\n trackTimestamp: this.rendererTiming\n });\n\n this.renderer = result.renderer;\n this.info = result.info;\n this.probe = new RendererProbe(this.renderer, {\n requestedMode: this.rendererMode,\n onDeviceLost: (detail) => {\n this.onDeviceLost?.(detail);\n this.events?.emit?.('renderer.device-lost', detail);\n },\n onError: (detail) => {\n this.onError?.(detail);\n this.events?.emit?.('renderer.error', detail);\n }\n });\n\n const pixelRatio = typeof devicePixelRatio === 'number' ? devicePixelRatio : 1;\n this.renderer.setPixelRatio(Math.min(pixelRatio, 2) * this.pixelRatioScale);\n this.renderer.outputColorSpace = THREE.SRGBColorSpace;\n this.renderer.toneMapping = THREE.ACESFilmicToneMapping;\n this.renderer.toneMappingExposure = 1.15;\n this.renderer.shadowMap.enabled = true;\n this.renderer.shadowMap.type = THREE.PCFShadowMap;\n this.container.appendChild(this.renderer.domElement);\n\n this.postFx = this.postFxFactory({\n renderer: this.renderer,\n scene: this.scene,\n camera: this.camera,\n options: this.postFxOptions\n });\n\n this.controls = this.controlsFactory(this.camera, this.renderer.domElement);\n this.controls.enableDamping = true;\n this.resize();\n if (typeof this.ResizeObserverClass === 'function') {\n this.resizeObserver = new this.ResizeObserverClass(() => this.resize());\n this.resizeObserver.observe(this.container);\n }\n return this;\n }\n\n applyEnvironment(environment = {}) {\n const version = ++this.environmentVersion;\n this.releaseEnvironmentTexture();\n this.releaseGeneratedVisual();\n\n const rendering = environment.rendering || {};\n const background = rendering.background ?? 0x080b10;\n this.scene.background = new THREE.Color(background);\n const fog = rendering.fog || { color: background, near: 22, far: 58 };\n this.scene.fog = fog.isFogExp2 ? fog : fog.type === 'exp2' ? new THREE.FogExp2(fog.color, fog.density) : new THREE.Fog(fog.color, fog.near, fog.far);\n this.renderer.toneMappingExposure = rendering.exposure ?? 1.1;\n\n const camera = environment.camera || {};\n if (Number.isFinite(camera.far)) {\n this.camera.far = camera.far;\n this.camera.updateProjectionMatrix();\n }\n if (Array.isArray(camera.position)) this.camera.position.fromArray(camera.position);\n if (Array.isArray(camera.target)) this.controls.target.fromArray(camera.target);\n this.controls.update();\n\n this.baseLighting={ibl:rendering.ibl,background};\n this.refreshEnvironmentLighting();\n this.visualTask = environment.generated?.visual\n ? this.loadGeneratedVisual(environment, version)\n : Promise.resolve(false);\n return true;\n }\n\n async loadGeneratedVisual(environment, version) {\n const visual = environment.generated?.visual;\n if (!visual) return false;\n const format = String(visual.format || visual.source?.format || '').toLowerCase();\n if (format !== 'spz') return false;\n if (this.renderer?.backend?.isWebGPUBackend !== true) {\n visual.status = 'unsupported-backend';\n this.generatedVisualState = { status:'unsupported-backend', format, splatCount:0 };\n return false;\n }\n\n visual.status = 'loading';\n this.generatedVisualState = { status:'loading', format, splatCount:0 };\n try {\n const loaded = await this.generatedVisualLoader({ source:visual.source || visual });\n if (version !== this.environmentVersion || !this.renderer) {\n loaded?.dispose?.();\n return false;\n }\n if (!loaded?.object?.isObject3D) throw new TypeError('Generated visual loader must return an Object3D');\n applyGeneratedWorldObjectTransform(\n loaded.object,\n environment.generated.coordinateSystem || 'y-up',\n environment.generated.metersPerUnit ?? 1\n );\n environment.root?.add?.(loaded.object);\n const fallbackMaterial = environment.floor?.material || null;\n if (fallbackMaterial) fallbackMaterial.visible = false;\n this.generatedVisual = { ...loaded, root:environment.root || null, fallbackMaterial };\n visual.status = 'ready';\n this.generatedVisualState = {\n status:'ready',\n format:loaded.format || format,\n splatCount:loaded.splatCount || 0,\n sourceSplatCount:loaded.sourceSplatCount || loaded.splatCount || 0,\n sampled:Boolean(loaded.sampled)\n };\n this.events?.emit?.('renderer.generated-visual-ready', {\n format:this.generatedVisualState.format,\n splatCount:this.generatedVisualState.splatCount,\n sourceSplatCount:this.generatedVisualState.sourceSplatCount,\n sampled:this.generatedVisualState.sampled\n });\n return true;\n } catch (error) {\n if (version === this.environmentVersion && this.renderer) {\n visual.status = 'failed';\n const message=error instanceof Error ? error.message : String(error);\n this.generatedVisualState = { status:'failed', format, splatCount:0, message };\n this.events?.emit?.('renderer.generated-visual-error', { format, message });\n }\n return false;\n }\n }\n\n releaseGeneratedVisual() {\n const visual = this.generatedVisual;\n if (visual?.object?.parent) visual.object.parent.remove(visual.object);\n visual?.dispose?.();\n if (visual?.fallbackMaterial) visual.fallbackMaterial.visible = true;\n this.generatedVisual = null;\n this.generatedVisualState = { status:'none', format:null, splatCount:0 };\n }\n\n setPresentation(state,camera) {\n this.creativeCamera=camera;\n this.previewCamera=camera?.clone()??null;\n if(!camera)this.creativeView=false;\n const next=state?.environment??null;\n if(JSON.stringify(next)!==JSON.stringify(this.presentationLighting)){\n this.presentationLighting=next;\n if(this.renderer&&this.baseLighting)this.refreshEnvironmentLighting();\n }\n }\n\n refreshEnvironmentLighting(){\n const version=++this.lightingVersion;\n this.releaseEnvironmentTexture();\n const base=this.baseLighting||{};\n this.scene.background=new THREE.Color(base.background??0x080b10);\n this.scene.backgroundIntensity=1;\n this.scene.environmentIntensity=1;\n const selected=this.presentationLighting;\n const ibl=selected?(selected.preset==='none'?null:{\n url:PRESENTATION_HDRI_PRESETS[selected.preset],intensity:selected.intensity,\n background:selected.background\n }):base.ibl;\n this.setLightingStatus(ibl?.url?'loading':'none');\n this.environmentTask=ibl?.url?this.loadEnvironmentTexture(ibl,version):Promise.resolve(false);\n return this.environmentTask;\n }\n\n setLightingStatus(status){\n this.lightingStatus=status;\n this.events?.emit?.('renderer.environment-status',{status});\n }\n\n setCreativeView(enabled){\n this.creativeView=Boolean(enabled&&this.creativeCamera);\n return this.creativeView;\n }\n\n async captureStill(longEdge=1920,{excludedRoot}={}){\n const version=this.lightingVersion;\n await this.environmentTask;\n if(version!==this.lightingVersion)throw new Error(\"STILL_LIGHTING_CHANGED\");\n if(this.lightingStatus===\"failed\"&&this.presentationLighting)throw new Error(\"STILL_HDRI_LOAD_FAILED\");\n if(!this.renderer)throw new Error('RENDERER_UNAVAILABLE');\n if(this.generatedVisual)throw new Error('STILL_GENERATED_VISUAL_UNSUPPORTED');\n if([...this.authoringScenes.values()].includes('replace')||[...this.authoringScenes].some(([scene,mode])=>mode==='overlay'&&scene.children.length))\n throw new Error('STILL_AUTHORING_SCENE_UNSUPPORTED');\n return captureStill({scene:this.scene,camera:this.creativeCamera||this.camera,\n decoration:this.decorationRoot,excludedRoot,exposure:this.renderer.toneMappingExposure,longEdge});\n }\n\n async loadEnvironmentTexture(ibl, version) {\n try {\n const texture = await this.environmentLoader.loadAsync(ibl.url);\n if (version !== this.lightingVersion || !this.renderer) {\n texture.dispose?.();\n return false;\n }\n texture.mapping = THREE.EquirectangularReflectionMapping;\n this.environmentTexture = texture;\n this.scene.environment = texture;\n this.scene.environmentIntensity = Number.isFinite(ibl.intensity) ? ibl.intensity : 1;\n if (ibl.background === true) {\n this.scene.background = texture;\n if (Number.isFinite(ibl.backgroundIntensity)) this.scene.backgroundIntensity = ibl.backgroundIntensity;\n }\n this.setLightingStatus(\"ready\");\n return true;\n } catch (error) {\n if (version === this.lightingVersion && this.renderer) {\n this.setLightingStatus('failed');\n this.events?.emit?.('renderer.environment-error', {\n url: ibl.url,\n message: error instanceof Error ? error.message : String(error)\n });\n }\n return false;\n }\n }\n releaseEnvironmentTexture() {\n const texture = this.environmentTexture;\n if (!texture) return;\n if (this.scene.environment === texture) this.scene.environment = null;\n if (this.scene.background === texture) this.scene.background = null;\n texture.dispose?.();\n this.environmentTexture = null;\n }\n\n viewport() {\n if (!this.camera || !this.renderer || !this.controls) return null;\n return { camera:this.camera, element:this.renderer.domElement, controls:this.controls };\n }\n\n viewPose() {\n if (!this.camera) return null;\n this.viewPoseState ||= { position:[0,0,0], rotation:[0,0,0,1] };\n this.camera.position.toArray(this.viewPoseState.position);\n this.camera.quaternion.toArray(this.viewPoseState.rotation);\n return this.viewPoseState;\n }\n\n cameraState() {\n if (!this.camera || !this.controls) return null;\n return { position:this.camera.position.toArray(), target:this.controls.target.toArray() };\n }\n\n applyCameraState(state = {}) {\n if (!this.camera || !this.controls) return false;\n if (Array.isArray(state.position) && state.position.length === 3) this.camera.position.fromArray(state.position);\n if (Array.isArray(state.target) && state.target.length === 3) this.controls.target.fromArray(state.target);\n this.controls.update();\n return true;\n }\n\n update() {\n // A disabled control rig must not overwrite a camera pose owned by another controller.\n if (this.controls?.enabled === false) return;\n this.controls?.update();\n }\n\n render(timestamp = performance.now()) {\n const started=performance.now();\n if(this.creativeView&&this.creativeCamera){\n // Never write the saved camera aspect or the navigation camera pose.\n const camera=this.previewCamera;\n if(camera.aspect!==this.camera.aspect){camera.aspect=this.camera.aspect;camera.updateProjectionMatrix();}\n const visible=this.decorationRoot.visible;this.decorationRoot.visible=false;\n try{this.renderer.render(this.scene,camera);}\n finally{this.decorationRoot.visible=visible;}\n this.probe?.afterRender(timestamp,performance.now()-started);\n return;\n }\n const entries = [...this.authoringScenes.entries()];\n const overlays = entries.filter(([scene, mode]) => mode === 'overlay' && scene.children.length > 0);\n const replacement = entries.findLast?.(([, mode]) => mode === 'replace')\n || [...entries].reverse().find(([, mode]) => mode === 'replace');\n if (replacement) {\n this.renderer.render(replacement[0], this.camera);\n if (this.authoringStageEnabled && replacement[0].children.length === 0) {\n const stageAutoClear = this.renderer.autoClear;\n this.renderer.autoClear = false;\n try {\n this.renderer.render(this.ensureAuthoringStage(), this.camera);\n } finally {\n this.renderer.autoClear = stageAutoClear;\n }\n }\n } else if (this.postFx?.enabled && overlays.length === 0) {\n try {\n this.postFx.render();\n } catch (error) {\n this.disablePostFx(error);\n this.renderer.render(this.scene, this.camera);\n }\n } else {\n this.renderer.render(this.scene, this.camera);\n }\n // RenderPipeline presents its own target to the canvas. A subsequent direct\n // render uses a different intermediate target and overwrites that output,\n // even with autoClear=false. Empty authoring scenes must not render at all;\n // populated overlays share the world's direct render path and depth buffer.\n if (!replacement && overlays.length > 0) {\n const autoClear = this.renderer.autoClear;\n this.renderer.autoClear = false;\n try {\n for (const [scene] of overlays) {\n this.renderer.render(scene, this.camera);\n }\n } finally {\n this.renderer.autoClear = autoClear;\n }\n }\n this.probe?.afterRender(timestamp,performance.now()-started);\n }\n\n disablePostFx(error) {\n const diagnostics = this.postFx?.diagnostics?.() || null;\n this.postFx?.dispose?.();\n this.postFx = null;\n this.events?.emit?.('renderer.postfx-error', {\n message: error instanceof Error ? error.message : String(error),\n postfx: diagnostics\n });\n }\n\n resize() {\n const width = this.container.clientWidth;\n const height = this.container.clientHeight;\n if (!width || !height || !this.camera || !this.renderer) return false;\n if (width === this.resizeWidth && height === this.resizeHeight) return false;\n this.resizeWidth = width;\n this.resizeHeight = height;\n this.camera.aspect = width / height;\n this.camera.updateProjectionMatrix();\n this.renderer.setSize(width, height, false);\n return true;\n }\n\n diagnostics() {\n const base = this.probe?.snapshot?.() || this.info;\n if (!base) return base;\n return {\n ...base,\n postfx:this.postFx?.diagnostics?.() || { enabled:false, effects:[] },\n generatedVisual:{...this.generatedVisualState}\n };\n }\n\n dispose() {\n this.styleSystem?.dispose();\n this.styleSystem = null;\n this.resizeObserver?.disconnect?.();\n this.resizeObserver = null;\n this.environmentVersion += 1;\n this.lightingVersion += 1;\n this.releaseEnvironmentTexture();\n this.releaseGeneratedVisual();\n this.postFx?.dispose?.();\n this.postFx = null;\n this.controls?.dispose?.();\n this.controls = null;\n if (this.authoringStage) {\n for (const child of this.authoringStage.children) child.geometry?.dispose?.();\n this.authoringStage = null;\n }\n this.probe?.dispose?.();\n this.probe = null;\n // A removed canvas can retain its WebGL context and driver allocations.\n // Release the owned context after Three's asynchronous backend cleanup.\n const context = this.renderer?.backend?.isWebGLBackend ? this.renderer.backend.gl : null;\n const disposal = this.renderer?.dispose?.();\n this.disposal = Promise.resolve(disposal).then(() => {\n context?.getExtension?.('WEBGL_lose_context')?.loseContext();\n }).catch(error => this.onError?.(error));\n this.renderer?.domElement?.remove?.();\n this.renderer = null;\n this.camera = null;\n this.info = null;\n this.authoringScenes.clear();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAKA,eAAsB,aAAa,EAAC,OAAM,QAAO,YAAW,cAAa,WAAS,GAAE,WAAS,QAAM;CACjG,IAAG,CAAC,CAAC,MAAK,IAAI,CAAC,CAAC,SAAS,QAAQ,KAAG,CAAC,QAAQ,qBAAoB,MAAM,IAAI,MAA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M,UAAU,UAAU;GAC5E,KAAK,iBAAiB;EACxB;EACA,KAAK,OAAO,UAAU;EACtB,KAAK,QAAQ;EAGb,MAAM,UAAU,KAAK,UAAU,SAAS,iBAAiB,KAAK,SAAS,QAAQ,KAAK;EACpF,MAAM,WAAW,KAAK,UAAU,UAAU;EAC1C,KAAK,WAAW,QAAQ,QAAQ,QAAQ,CAAC,CAAC,WAAW;GACnD,SAAS,eAAe,oBAAoB,CAAC,EAAE,YAAY;EAC7D,CAAC,CAAC,CAAC,OAAM,UAAS,KAAK,UAAU,KAAK,CAAC;EACvC,KAAK,UAAU,YAAY,SAAS;EACpC,KAAK,WAAW;EAChB,KAAK,SAAS;EACd,KAAK,OAAO;EACZ,KAAK,gBAAgB,MAAM;CAC7B;AACF"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
// modules/world/runtime/ScenePresentation.js
|
|
4
|
+
const vector = z.tuple([
|
|
5
|
+
z.number().finite().min(-1e5).max(1e5),
|
|
6
|
+
z.number().finite().min(-1e5).max(1e5),
|
|
7
|
+
z.number().finite().min(-1e5).max(1e5)
|
|
8
|
+
]);
|
|
9
|
+
const name = z.string().trim().min(1).max(100);
|
|
10
|
+
const color = z.string().regex(/^#[a-fA-F0-9]{6}$/);
|
|
11
|
+
const lightBase = {
|
|
12
|
+
name: name.optional(),
|
|
13
|
+
color: color.default("#ffffff"),
|
|
14
|
+
intensity: z.number().finite().min(0).max(1e5),
|
|
15
|
+
position: vector,
|
|
16
|
+
castShadow: z.boolean().optional()
|
|
17
|
+
};
|
|
18
|
+
const directed = { target: vector };
|
|
19
|
+
const lightSchema = z.discriminatedUnion("type", [
|
|
20
|
+
z.object({
|
|
21
|
+
...lightBase,
|
|
22
|
+
...directed,
|
|
23
|
+
type: z.literal("directional")
|
|
24
|
+
}).strict(),
|
|
25
|
+
z.object({
|
|
26
|
+
...lightBase,
|
|
27
|
+
type: z.literal("point"),
|
|
28
|
+
distance: z.number().finite().min(0).default(0)
|
|
29
|
+
}).strict(),
|
|
30
|
+
z.object({
|
|
31
|
+
...lightBase,
|
|
32
|
+
...directed,
|
|
33
|
+
type: z.literal("spot"),
|
|
34
|
+
distance: z.number().finite().min(0).default(0),
|
|
35
|
+
angle: z.number().positive().max(Math.PI / 2).default(Math.PI / 4),
|
|
36
|
+
penumbra: z.number().min(0).max(1).default(0)
|
|
37
|
+
}).strict()
|
|
38
|
+
]);
|
|
39
|
+
const presentationCameraSchema = z.object({
|
|
40
|
+
name: name.default("Camera"),
|
|
41
|
+
position: vector,
|
|
42
|
+
target: vector,
|
|
43
|
+
fov: z.number().min(10).max(110).default(45),
|
|
44
|
+
aspect: z.number().positive().max(10).default(16 / 9),
|
|
45
|
+
near: z.number().positive().default(.1),
|
|
46
|
+
far: z.number().positive().default(1e3)
|
|
47
|
+
}).strict();
|
|
48
|
+
const presentationLightsSchema = z.array(lightSchema).max(16);
|
|
49
|
+
const PRESENTATION_HDRI_PRESETS = Object.freeze({
|
|
50
|
+
interior: "/assets/monument-hall/solitude_interior_1k.hdr",
|
|
51
|
+
courtyard: "/assets/ruined-courtyard/courtyard_1k.hdr",
|
|
52
|
+
street: "/assets/grand-urban-block/urban_street_01_1k.hdr"
|
|
53
|
+
});
|
|
54
|
+
const presentationEnvironmentSchema = z.object({
|
|
55
|
+
preset: z.enum([
|
|
56
|
+
"interior",
|
|
57
|
+
"courtyard",
|
|
58
|
+
"street",
|
|
59
|
+
"none"
|
|
60
|
+
]),
|
|
61
|
+
intensity: z.number().finite().min(0).max(5).default(1),
|
|
62
|
+
background: z.boolean().default(false)
|
|
63
|
+
}).strict();
|
|
64
|
+
const scenePresentationSchema = z.object({
|
|
65
|
+
camera: presentationCameraSchema.nullable().default(null),
|
|
66
|
+
lights: presentationLightsSchema.default([]),
|
|
67
|
+
environment: presentationEnvironmentSchema.nullable().optional()
|
|
68
|
+
}).strict();
|
|
69
|
+
const fail = (code) => Object.assign(new Error(code), { code });
|
|
70
|
+
const coincident = (a, b) => Math.hypot(...a.map((v, i) => v - b[i])) < 1e-6;
|
|
71
|
+
function parseScenePresentation(input = {}) {
|
|
72
|
+
const state = scenePresentationSchema.parse(input);
|
|
73
|
+
if (state.camera) {
|
|
74
|
+
if (state.camera.far <= state.camera.near) throw fail("SCENE_EXPORT_CAMERA_INVALID");
|
|
75
|
+
if (coincident(state.camera.position, state.camera.target)) throw fail("SCENE_EXPORT_DIRECTION_INVALID");
|
|
76
|
+
}
|
|
77
|
+
for (const light of state.lights) if (light.target && coincident(light.position, light.target)) throw fail("SCENE_EXPORT_DIRECTION_INVALID");
|
|
78
|
+
return state;
|
|
79
|
+
}
|
|
80
|
+
function aim(object, target) {
|
|
81
|
+
object.lookAt(new THREE.Vector3(...target));
|
|
82
|
+
if (object.target) {
|
|
83
|
+
object.target.position.set(0, 0, -1);
|
|
84
|
+
object.add(object.target);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/** Same construction for a live world and its detached visual export. */
|
|
88
|
+
function buildPresentationGroup(input) {
|
|
89
|
+
const state = parseScenePresentation(input);
|
|
90
|
+
const root = new THREE.Group();
|
|
91
|
+
root.name = "AgentScapePresentation";
|
|
92
|
+
if (state.camera) {
|
|
93
|
+
const c = state.camera;
|
|
94
|
+
const camera = new THREE.PerspectiveCamera(c.fov, c.aspect, c.near, c.far);
|
|
95
|
+
camera.name = c.name;
|
|
96
|
+
camera.position.fromArray(c.position);
|
|
97
|
+
aim(camera, c.target);
|
|
98
|
+
root.add(camera);
|
|
99
|
+
}
|
|
100
|
+
for (const l of state.lights) {
|
|
101
|
+
const light = l.type === "directional" ? new THREE.DirectionalLight(l.color, l.intensity) : l.type === "point" ? new THREE.PointLight(l.color, l.intensity, l.distance, 2) : new THREE.SpotLight(l.color, l.intensity, l.distance, l.angle, l.penumbra, 2);
|
|
102
|
+
light.name = l.name ?? l.type;
|
|
103
|
+
light.position.fromArray(l.position);
|
|
104
|
+
light.castShadow = l.castShadow === true;
|
|
105
|
+
if (light.castShadow) light.shadow.mapSize.set(1024, 1024);
|
|
106
|
+
if (l.target) aim(light, l.target);
|
|
107
|
+
root.add(light);
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
state,
|
|
111
|
+
root
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/** World-owned rig, independent of navigation cameras and environment-owned lighting.
|
|
115
|
+
* Data is authoritative; Three objects are a replaceable projection of that data. */
|
|
116
|
+
var ScenePresentation = class {
|
|
117
|
+
#state = null;
|
|
118
|
+
#root = null;
|
|
119
|
+
constructor(scene, onChange = () => {}) {
|
|
120
|
+
this.scene = scene;
|
|
121
|
+
this.onChange = onChange;
|
|
122
|
+
}
|
|
123
|
+
get camera() {
|
|
124
|
+
return this.#root?.children.find((node) => node.isCamera) ?? null;
|
|
125
|
+
}
|
|
126
|
+
snapshot() {
|
|
127
|
+
return this.#state ? structuredClone(this.#state) : null;
|
|
128
|
+
}
|
|
129
|
+
replace(input = {}) {
|
|
130
|
+
const { state, root } = buildPresentationGroup(input);
|
|
131
|
+
this.releaseRoot();
|
|
132
|
+
this.#root = root.children.length ? root : null;
|
|
133
|
+
this.#state = this.#root || state.environment ? state : null;
|
|
134
|
+
if (this.#root) this.scene.add(this.#root);
|
|
135
|
+
this.onChange(this.snapshot(), this.camera);
|
|
136
|
+
return this.snapshot();
|
|
137
|
+
}
|
|
138
|
+
releaseRoot() {
|
|
139
|
+
this.#root?.traverse((node) => {
|
|
140
|
+
if (node.isLight) node.shadow?.dispose?.();
|
|
141
|
+
});
|
|
142
|
+
this.#root?.removeFromParent();
|
|
143
|
+
}
|
|
144
|
+
dispose() {
|
|
145
|
+
this.releaseRoot();
|
|
146
|
+
this.#root = null;
|
|
147
|
+
this.#state = null;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
export { scenePresentationSchema as i, ScenePresentation as n, parseScenePresentation as r, PRESENTATION_HDRI_PRESETS as t };
|
|
151
|
+
|
|
152
|
+
//# sourceMappingURL=ScenePresentation-LsYiDxbm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScenePresentation-LsYiDxbm.js","names":[],"sources":["../../../modules/world/runtime/ScenePresentation.js"],"sourcesContent":["import * as THREE from 'three';\nimport * as z from 'zod/v4';\n\nconst vector=z.tuple([z.number().finite().min(-100000).max(100000),z.number().finite().min(-100000).max(100000),z.number().finite().min(-100000).max(100000)]);\nconst name=z.string().trim().min(1).max(100);\nconst color=z.string().regex(/^#[a-fA-F0-9]{6}$/);\nconst lightBase={name:name.optional(),color:color.default('#ffffff'),intensity:z.number().finite().min(0).max(100000),position:vector,castShadow:z.boolean().optional()};\nconst directed={target:vector};\nconst lightSchema=z.discriminatedUnion('type',[\n z.object({...lightBase,...directed,type:z.literal('directional')}).strict(),\n z.object({...lightBase,type:z.literal('point'),distance:z.number().finite().min(0).default(0)}).strict(),\n z.object({...lightBase,...directed,type:z.literal('spot'),distance:z.number().finite().min(0).default(0),\n angle:z.number().positive().max(Math.PI/2).default(Math.PI/4),penumbra:z.number().min(0).max(1).default(0)}).strict()\n]);\nexport const presentationCameraSchema=z.object({\n name:name.default('Camera'),position:vector,target:vector,fov:z.number().min(10).max(110).default(45),\n aspect:z.number().positive().max(10).default(16/9),near:z.number().positive().default(.1),far:z.number().positive().default(1000)\n}).strict();\nexport const presentationLightsSchema=z.array(lightSchema).max(16);\nexport const PRESENTATION_HDRI_PRESETS=Object.freeze({\n interior:'/assets/monument-hall/solitude_interior_1k.hdr',\n courtyard:'/assets/ruined-courtyard/courtyard_1k.hdr',\n street:'/assets/grand-urban-block/urban_street_01_1k.hdr'\n});\nexport const presentationEnvironmentSchema=z.object({\n preset:z.enum(['interior','courtyard','street','none']),\n intensity:z.number().finite().min(0).max(5).default(1),\n background:z.boolean().default(false)\n}).strict();\nexport const scenePresentationSchema=z.object({\n camera:presentationCameraSchema.nullable().default(null),\n lights:presentationLightsSchema.default([]),\n environment:presentationEnvironmentSchema.nullable().optional()\n}).strict();\n\nconst fail=code=>Object.assign(new Error(code),{code});\nconst coincident=(a,b)=>Math.hypot(...a.map((v,i)=>v-b[i]))<1e-6;\nexport function parseScenePresentation(input={}){\n const state=scenePresentationSchema.parse(input);\n if(state.camera){\n if(state.camera.far<=state.camera.near)throw fail('SCENE_EXPORT_CAMERA_INVALID');\n if(coincident(state.camera.position,state.camera.target))throw fail('SCENE_EXPORT_DIRECTION_INVALID');\n }\n for(const light of state.lights)\n if(light.target&&coincident(light.position,light.target))throw fail('SCENE_EXPORT_DIRECTION_INVALID');\n return state;\n}\n\nfunction aim(object,target){\n object.lookAt(new THREE.Vector3(...target));\n if(object.target){object.target.position.set(0,0,-1);object.add(object.target);}\n}\n\n/** Same construction for a live world and its detached visual export. */\nexport function buildPresentationGroup(input){\n const state=parseScenePresentation(input);\n const root=new THREE.Group();\n root.name='AgentScapePresentation';\n if(state.camera){\n const c=state.camera;\n const camera=new THREE.PerspectiveCamera(c.fov,c.aspect,c.near,c.far);\n camera.name=c.name;camera.position.fromArray(c.position);aim(camera,c.target);root.add(camera);\n }\n for(const l of state.lights){\n const light=l.type==='directional'?new THREE.DirectionalLight(l.color,l.intensity):\n l.type==='point'?new THREE.PointLight(l.color,l.intensity,l.distance,2):\n new THREE.SpotLight(l.color,l.intensity,l.distance,l.angle,l.penumbra,2);\n light.name=l.name??l.type;light.position.fromArray(l.position);\n light.castShadow=l.castShadow===true;\n if(light.castShadow)light.shadow.mapSize.set(1024,1024);\n if(l.target)aim(light,l.target);\n root.add(light);\n }\n return {state,root};\n}\n\n/** World-owned rig, independent of navigation cameras and environment-owned lighting.\n * Data is authoritative; Three objects are a replaceable projection of that data. */\nexport class ScenePresentation {\n #state=null;\n #root=null;\n constructor(scene,onChange=()=>{}){this.scene=scene;this.onChange=onChange;}\n get camera(){return this.#root?.children.find(node=>node.isCamera)??null;}\n snapshot(){return this.#state?structuredClone(this.#state):null;}\n replace(input={}){\n const {state,root}=buildPresentationGroup(input);\n this.releaseRoot();\n this.#root=root.children.length?root:null;\n this.#state=this.#root||state.environment?state:null;\n if(this.#root)this.scene.add(this.#root);\n this.onChange(this.snapshot(),this.camera);\n return this.snapshot();\n }\n releaseRoot(){\n this.#root?.traverse(node=>{if(node.isLight)node.shadow?.dispose?.();});\n this.#root?.removeFromParent();\n }\n dispose(){\n this.releaseRoot();this.#root=null;this.#state=null;\n }\n}\n"],"mappings":";;;AAGA,MAAM,SAAO,EAAE,MAAM;CAAC,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,IAAO,CAAC,CAAC,IAAI,GAAM;CAAE,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,IAAO,CAAC,CAAC,IAAI,GAAM;CAAE,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,IAAO,CAAC,CAAC,IAAI,GAAM;AAAC,CAAC;AAC7J,MAAM,OAAK,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;AAC3C,MAAM,QAAM,EAAE,OAAO,CAAC,CAAC,MAAM,mBAAmB;AAChD,MAAM,YAAU;CAAC,MAAK,KAAK,SAAS;CAAE,OAAM,MAAM,QAAQ,SAAS;CAAE,WAAU,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAM;CAAE,UAAS;CAAO,YAAW,EAAE,QAAQ,CAAC,CAAC,SAAS;AAAC;AACvK,MAAM,WAAS,EAAC,QAAO,OAAM;AAC7B,MAAM,cAAY,EAAE,mBAAmB,QAAO;CAC5C,EAAE,OAAO;EAAC,GAAG;EAAU,GAAG;EAAS,MAAK,EAAE,QAAQ,aAAa;CAAC,CAAC,CAAC,CAAC,OAAO;CAC1E,EAAE,OAAO;EAAC,GAAG;EAAU,MAAK,EAAE,QAAQ,OAAO;EAAE,UAAS,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,CAA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