agentscape3d-engine 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +19 -2
- package/cli.mjs +53 -0
- package/dist/AssetCompiler-A99wKf7H.js +2424 -0
- package/dist/AssetCompiler-A99wKf7H.js.map +1 -0
- package/dist/AssetInputContracts-uKYeQu-X.js +245 -0
- package/dist/AssetInputContracts-uKYeQu-X.js.map +1 -0
- package/dist/AssetRecipe-DCaLLXvG.js +67 -0
- package/dist/AssetRecipe-DCaLLXvG.js.map +1 -0
- package/dist/BrowserCodeWorker.js +53850 -0
- package/dist/BrowserCodeWorker.js.map +1 -0
- package/dist/KinematicHypothesisScreen-4v7GBwdv.js +241 -0
- package/dist/KinematicHypothesisScreen-4v7GBwdv.js.map +1 -0
- package/dist/SceneSerializer-CLCzQjL_.js +350 -0
- package/dist/SceneSerializer-CLCzQjL_.js.map +1 -0
- package/dist/StylePack-CD_BC-Mv.js +6317 -0
- package/dist/StylePack-CD_BC-Mv.js.map +1 -0
- package/dist/WorldArchive-dYf1OpSe.js +417 -0
- package/dist/WorldArchive-dYf1OpSe.js.map +1 -0
- package/dist/WorldIO-Dqz4MqTQ.js +149 -0
- package/dist/WorldIO-Dqz4MqTQ.js.map +1 -0
- package/dist/blankWorld-OoOvN_IK.js +75 -0
- package/dist/blankWorld-OoOvN_IK.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-B3HCflvO.js +128 -0
- package/dist/disposeObject3D-B3HCflvO.js.map +1 -0
- package/dist/environments-B1WaICAN.js +4197 -0
- package/dist/environments-B1WaICAN.js.map +1 -0
- package/dist/gltfIO-BMK1hc2D.js +9 -0
- package/dist/gltfIO-BMK1hc2D.js.map +1 -0
- package/dist/grandUrbanBlock-Bdjgc6ZT.js +515 -0
- package/dist/grandUrbanBlock-Bdjgc6ZT.js.map +1 -0
- package/dist/index.d.ts +275 -0
- package/dist/index.js +16239 -0
- package/dist/index.js.map +1 -0
- package/dist/magicCabin-DPQi_jh-.js +11019 -0
- package/dist/magicCabin-DPQi_jh-.js.map +1 -0
- package/dist/mcp.d.ts +2 -0
- package/dist/mcp.js +1 -0
- package/dist/monumentHall-IOLbRZQC.js +403 -0
- package/dist/monumentHall-IOLbRZQC.js.map +1 -0
- package/dist/node.d.ts +16 -0
- package/dist/node.js +26 -0
- package/dist/rolldown-runtime-D3KUYPsf.js +12 -0
- package/dist/ruinedCourtyard-BtaF_aOi.js +696 -0
- package/dist/ruinedCourtyard-BtaF_aOi.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 +8 -0
- package/dist/runtime/application/buildTaskObservation.js +117 -0
- package/dist/runtime/application/code-execution/AuthoringSandboxEntry.js +46 -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 +72 -0
- package/dist/runtime/application/createSession.js +66 -0
- package/dist/runtime/application/createWorldAuthoringContext.js +400 -0
- package/dist/runtime/application/generation/GenerationOrchestrator.js +629 -0
- package/dist/runtime/application/generation/GenerationRuntime.js +214 -0
- package/dist/runtime/application/generation/PromptHybridWorldOrchestrator.js +285 -0
- package/dist/runtime/application/native-scene/CodeProject.js +119 -0
- package/dist/runtime/application/native-scene/CodeProjectModules.js +128 -0
- package/dist/runtime/application/native-scene/NativeEnvironmentGeometry.js +62 -0
- package/dist/runtime/application/native-scene/NativeOverlayCheckpoint.js +127 -0
- package/dist/runtime/application/native-scene/NativeRenderDiscovery.js +51 -0
- package/dist/runtime/application/native-scene/NativeSceneHost.js +319 -0
- package/dist/runtime/application/native-scene/NativeSceneOverlay.js +116 -0
- package/dist/runtime/application/native-scene/NativeThreeModule.js +16 -0
- package/dist/runtime/application/object-forge/SceneObjectForge.js +232 -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 +79 -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 +45 -0
- package/dist/runtime/application/scene/SceneEditService.js +144 -0
- package/dist/runtime/application/scene/SceneFacade.js +261 -0
- package/dist/runtime/application/scene/SceneInteractionAdapters.js +40 -0
- package/dist/runtime/application/scene/SceneJobController.js +229 -0
- package/dist/runtime/application/scene/SceneLifecycle.js +57 -0
- package/dist/runtime/application/scene/ScenePackage.js +162 -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 +87 -0
- package/dist/runtime/application/scene/WorldDirectory.js +20 -0
- package/dist/runtime/application/scene/WorldDocument.js +74 -0
- package/dist/runtime/application/scene/WorldIO.js +103 -0
- package/dist/runtime/application/scene/WorldStorage.js +137 -0
- package/dist/runtime/application/skills/SkillRegistry.js +189 -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 +174 -0
- package/dist/runtime/application/world-authoring/ModelRef.js +62 -0
- package/dist/runtime/apps/mcp-server/AUTHORING.md +71 -0
- package/dist/runtime/apps/mcp-server/AgentMcpCompat.js +77 -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 +132 -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 +150 -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 +80 -0
- package/dist/runtime/apps/mcp-server/StudioBridgeHttp.js +58 -0
- package/dist/runtime/apps/mcp-server/StudioLiveBridge.js +190 -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 +65 -0
- package/dist/runtime/apps/mcp-server/registerTools.js +225 -0
- package/dist/runtime/apps/mcp-server/sandbox/run.mjs +23 -0
- package/dist/runtime/apps/mcp-server/security.js +21 -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/WorldDiskStorage.js +51 -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/foundation/EventBus.js +18 -0
- package/dist/runtime/foundation/JsonGateway.js +47 -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 +399 -0
- package/dist/runtime/modules/asset/README.md +54 -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 +100 -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/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 +47 -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 +245 -0
- package/dist/runtime/modules/physics/JoltPhysicsBackend.js +850 -0
- package/dist/runtime/modules/physics/PhysicsApiSurface.js +651 -0
- package/dist/runtime/modules/physics/PhysicsBackend.js +88 -0
- package/dist/runtime/modules/physics/RapierPhysicsBackend.js +410 -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/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 +80 -0
- package/dist/runtime/modules/world/runtime/EntityCapabilityRegistry.js +150 -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 +207 -0
- package/dist/runtime/modules/world/runtime/SceneSerializer.js +246 -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 +502 -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 +665 -0
- package/dist/runtime/modules/world/runtime/affordance/ObjectAffordances.js +107 -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 +305 -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 +222 -0
- package/dist/runtime/modules/world/runtime/interaction/InteractionApproach.js +130 -0
- package/dist/runtime/modules/world/runtime/interaction/InteractionContract.js +57 -0
- package/dist/runtime/modules/world/runtime/interaction/RecoveryRuntime.js +123 -0
- package/dist/runtime/modules/world/runtime/interaction/SettleRuntime.js +120 -0
- package/dist/runtime/modules/world/runtime/semantic/SemanticWorldView.js +102 -0
- package/dist/runtime/modules/world/runtime/simulation/SimulationClock.js +89 -0
- package/dist/runtime/modules/world/runtime/simulation/SimulationSession.js +99 -0
- package/dist/runtime/modules/world/runtime/simulation/ThermalSystem.js +269 -0
- package/dist/runtime/modules/world/runtime/spatial/SpatialSnapshot.js +56 -0
- package/dist/runtime/modules/world/runtime/systems/AudioSystem.js +125 -0
- package/dist/runtime/modules/world/runtime/systems/Instrument.js +38 -0
- package/dist/runtime/modules/world/runtime/systems/InteractionSystem.js +728 -0
- package/dist/runtime/modules/world/runtime/systems/LocomotionSystem.js +269 -0
- package/dist/runtime/modules/world/runtime/systems/NavigationSystem.js +469 -0
- package/dist/runtime/modules/world/runtime/systems/PhysicsSystem.js +1673 -0
- package/dist/runtime/modules/world/runtime/systems/RenderingSystem.js +457 -0
- package/dist/runtime/modules/world/runtime/systems/SpatialSystem.js +284 -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 +69 -0
- package/dist/runtime/modules/world/verification/RepairEngine.js +49 -0
- package/dist/runtime/modules/world/verification/WorldAcceptance.js +158 -0
- package/dist/runtime/modules/world/verification/WorldValidator.js +65 -0
- package/dist/runtime/package-lock.json +16048 -0
- package/dist/runtime/package.json +105 -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-BWpTl0Wj.js +359 -0
- package/dist/schema-BWpTl0Wj.js.map +1 -0
- package/dist/suzhouGarden-H9tiPgxq.js +6150 -0
- package/dist/suzhouGarden-H9tiPgxq.js.map +1 -0
- package/dist/woodlandWorkshop-D6zzSbHr.js +483 -0
- package/dist/woodlandWorkshop-D6zzSbHr.js.map +1 -0
- package/dist/yuanmingyuan-D6IHqjZ-.js +4955 -0
- package/dist/yuanmingyuan-D6IHqjZ-.js.map +1 -0
- package/package.json +70 -4
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/* 吴苑澄观 · 假山与叠石
|
|
2
|
+
* 太湖石以「等值面孔洞 + 多频噪声皴纹」程序化生成,追求皱、漏、瘦、透;
|
|
3
|
+
* 黄石以层理块体拼叠;含主峰群、洞壑、蹬道、峡谷、池岸石矶与庭园特置峰石。
|
|
4
|
+
* 跌水 / 溪流的位置通过 ctx.waterfalls / ctx.streams 交给 water.js 生成水面。
|
|
5
|
+
*/
|
|
6
|
+
import * as THREE from 'three';
|
|
7
|
+
import {
|
|
8
|
+
boxGeo, transform, tube, lathe, clamp, smooth, fbm, mulberry32, rr,
|
|
9
|
+
WORLD, waterSDF, terrainHeight, POOLS, ISLES,
|
|
10
|
+
} from './core.js';
|
|
11
|
+
import { put } from './arch.js';
|
|
12
|
+
|
|
13
|
+
/** 3D 近似噪声:以多组可平铺 2D fbm 组合出三向变化 */
|
|
14
|
+
function n3(x, y, z, s) {
|
|
15
|
+
return fbm(x + s * 0.13, y + s * 0.07, s, 3)
|
|
16
|
+
* 0.5 + fbm(z + s * 0.21, y + s * 0.17, s + 71, 3) * 0.5;
|
|
17
|
+
}
|
|
18
|
+
function gyroid(x, y, z, f, phase) {
|
|
19
|
+
const a = x * f + phase, b = y * f + phase * 0.7, c = z * f + phase * 1.3;
|
|
20
|
+
return Math.sin(a) * Math.cos(b) + Math.sin(b) * Math.cos(c) + Math.sin(c) * Math.cos(a);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** 生成一块太湖石:细分球面 + 噪声位移 + gyroid 孔洞筛选 */
|
|
24
|
+
export function taihuGeo(seed, w, h, d, opts = {}) {
|
|
25
|
+
const rnd = mulberry32(seed);
|
|
26
|
+
const detail = opts.detail ?? 4;
|
|
27
|
+
const base = new THREE.IcosahedronGeometry(1, detail);
|
|
28
|
+
const src = base.index ? base.toNonIndexed() : base;
|
|
29
|
+
const sp = src.getAttribute('position');
|
|
30
|
+
const n = sp.count;
|
|
31
|
+
const pos = new Float32Array(n * 3);
|
|
32
|
+
const phase = rnd() * Math.PI * 2;
|
|
33
|
+
const f = (opts.holeFreq ?? 2.5) / Math.min(w, h, d);
|
|
34
|
+
const amp = opts.amp ?? 0.34;
|
|
35
|
+
const pitF = opts.pitFreq ?? 2.7;
|
|
36
|
+
for (let i = 0; i < n; i++) {
|
|
37
|
+
const nx = sp.getX(i), ny = sp.getY(i), nz = sp.getZ(i);
|
|
38
|
+
const q = n3(nx * 1.7 + seed * 0.01, ny * 1.7, nz * 1.7, seed % 997);
|
|
39
|
+
const ridge = Math.sin(nx * 8.5 + phase) * Math.sin(ny * 7.1 - phase) * Math.sin(nz * 6.3 + phase);
|
|
40
|
+
// gyroid 零等值面处形成深涡孔与沟壑,保持封闭实体(避免碎裂成三角片)
|
|
41
|
+
const g = Math.abs(gyroid(nx * pitF, ny * pitF, nz * pitF, 1, phase));
|
|
42
|
+
const pit = 1 - smooth(0.05, 0.46, g);
|
|
43
|
+
const wrinkle = Math.sin(nx * 13.0 + phase) * Math.sin(ny * 11.0 - phase)
|
|
44
|
+
* Math.sin(nz * 12.0 + phase * 0.6) * 0.07;
|
|
45
|
+
const r = 1 + (q - 0.5) * amp * 2 + ridge * 0.10 + wrinkle - pit * 0.32;
|
|
46
|
+
pos[i * 3] = nx * r * w * 0.5;
|
|
47
|
+
pos[i * 3 + 1] = ny * r * h * 0.5;
|
|
48
|
+
pos[i * 3 + 2] = nz * r * d * 0.5;
|
|
49
|
+
}
|
|
50
|
+
// 仅少量三角面被穿透,形成「漏、透」的零星孔洞,主体仍是完整石体
|
|
51
|
+
const pierce = opts.pierce ?? 0.075;
|
|
52
|
+
const keep = [];
|
|
53
|
+
for (let i = 0; i < n; i += 3) {
|
|
54
|
+
const cx = (pos[i * 3] + pos[(i + 1) * 3] + pos[(i + 2) * 3]) / 3;
|
|
55
|
+
const cy = (pos[i * 3 + 1] + pos[(i + 1) * 3 + 1] + pos[(i + 2) * 3 + 1]) / 3;
|
|
56
|
+
const cz = (pos[i * 3 + 2] + pos[(i + 1) * 3 + 2] + pos[(i + 2) * 3 + 2]) / 3;
|
|
57
|
+
const g = Math.abs(gyroid(cx, cy, cz, f, phase));
|
|
58
|
+
if (g > pierce || rnd() > 0.35) {
|
|
59
|
+
for (let k = 0; k < 3; k++) {
|
|
60
|
+
keep.push(pos[(i + k) * 3], pos[(i + k) * 3 + 1], pos[(i + k) * 3 + 2]);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const out = new THREE.BufferGeometry();
|
|
65
|
+
const arr = new Float32Array(keep);
|
|
66
|
+
out.setAttribute('position', new THREE.Float32BufferAttribute(arr, 3));
|
|
67
|
+
const uv = new Float32Array((arr.length / 3) * 2);
|
|
68
|
+
for (let i = 0; i < arr.length / 3; i++) {
|
|
69
|
+
uv[i * 2] = arr[i * 3] * 0.34 + arr[i * 3 + 2] * 0.12;
|
|
70
|
+
uv[i * 2 + 1] = arr[i * 3 + 1] * 0.34;
|
|
71
|
+
}
|
|
72
|
+
out.setAttribute('uv', new THREE.Float32BufferAttribute(uv, 2));
|
|
73
|
+
out.computeVertexNormals();
|
|
74
|
+
if (src !== base) src.dispose();
|
|
75
|
+
base.dispose();
|
|
76
|
+
return out;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** 黄石层理块体 */
|
|
80
|
+
export function huangshiGeo(seed, w, h, d) {
|
|
81
|
+
const rnd = mulberry32(seed);
|
|
82
|
+
const g = new THREE.BoxGeometry(w, h, d, 5, 5, 4).toNonIndexed();
|
|
83
|
+
const p = g.getAttribute('position');
|
|
84
|
+
const phase = rnd() * 6.28;
|
|
85
|
+
for (let i = 0; i < p.count; i++) {
|
|
86
|
+
const x = p.getX(i), y = p.getY(i), z = p.getZ(i);
|
|
87
|
+
const layer = Math.sin(y * 5.2 + phase) * 0.055;
|
|
88
|
+
const n = n3(x, y, z, seed % 331);
|
|
89
|
+
p.setXYZ(i, x + (n - 0.5) * 0.16 + layer, y + (n - 0.5) * 0.08, z + (n - 0.5) * 0.16 - layer);
|
|
90
|
+
}
|
|
91
|
+
p.needsUpdate = true;
|
|
92
|
+
const uv = g.getAttribute('uv');
|
|
93
|
+
for (let i = 0; i < uv.count; i++) uv.setXY(i, uv.getX(i) * w * 0.32, uv.getY(i) * h * 0.32);
|
|
94
|
+
g.computeVertexNormals();
|
|
95
|
+
return g;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function stone(ctx, geo, mat, x, y, z, rot = [0, 0, 0], lod = 0) {
|
|
99
|
+
put(ctx.B, geo, mat, [x, y, z], rot, lod);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** 主峰群:(-62,-40) 一带,最高 9.6 m */
|
|
103
|
+
function buildMainPeaks(ctx) {
|
|
104
|
+
const { M } = ctx;
|
|
105
|
+
const prog = ctx.onProgress || (() => {});
|
|
106
|
+
const cx = -64, cz = -40;
|
|
107
|
+
// 山体基底:以灰白湖石与条石层叠,避免大面积黄砂岩破坏江南山石灰调
|
|
108
|
+
for (let i = 0; i < 12; i++) {
|
|
109
|
+
const a = i * Math.PI * 2 / 12;
|
|
110
|
+
const r = 12.4 + Math.sin(i * 2.1) * 2.0;
|
|
111
|
+
const x = cx + Math.cos(a) * r, z = cz + Math.sin(a) * r;
|
|
112
|
+
stone(ctx, huangshiGeo(900 + i, 5.2 + (i % 3), 1.6 + (i % 4) * 0.42, 4.2 + (i % 3)),
|
|
113
|
+
i % 3 === 0 ? M.stoneDark : M.taihuDark, x, 0.42, z, [0, a, 0]);
|
|
114
|
+
}
|
|
115
|
+
// 太湖石主峰群(分层堆叠,越高越瘦)
|
|
116
|
+
const peaks = [
|
|
117
|
+
{ x: cx, z: cz, w: 9.5, h: 9.2, d: 8.0, y: 4.4, s: 1 },
|
|
118
|
+
{ x: cx - 5.0, z: cz + 3.0, w: 7.0, h: 7.0, d: 6.2, y: 3.3, s: 2 },
|
|
119
|
+
{ x: cx + 5.2, z: cz + 1.8, w: 6.6, h: 6.4, d: 6.0, y: 3.0, s: 3 },
|
|
120
|
+
{ x: cx + 2.0, z: cz - 5.0, w: 7.4, h: 6.8, d: 6.4, y: 3.2, s: 4 },
|
|
121
|
+
{ x: cx - 4.0, z: cz - 5.4, w: 6.2, h: 5.6, d: 5.4, y: 2.7, s: 5 },
|
|
122
|
+
{ x: cx - 9.0, z: cz - 1.0, w: 5.4, h: 4.8, d: 5.0, y: 2.3, s: 6 },
|
|
123
|
+
{ x: cx + 9.0, z: cz - 3.0, w: 5.0, h: 4.4, d: 4.6, y: 2.1, s: 7 },
|
|
124
|
+
{ x: cx + 1.0, z: cz + 6.5, w: 5.8, h: 4.2, d: 5.0, y: 2.0, s: 8 },
|
|
125
|
+
{ x: cx - 8.0, z: cz + 7.0, w: 4.6, h: 3.6, d: 4.4, y: 1.7, s: 9 },
|
|
126
|
+
];
|
|
127
|
+
peaks.forEach((p, i) => {
|
|
128
|
+
const g = taihuGeo(1100 + p.s * 37, p.w, p.h, p.d, { detail: 4, hole: 0.46, amp: 0.36 });
|
|
129
|
+
stone(ctx, g, i < 3 ? M.taihu : M.taihuDark, p.x, p.y, p.z, [0, p.s * 0.7, p.s * 0.04]);
|
|
130
|
+
prog((i + 1) / (peaks.length + 12), `叠石主峰 ${i + 1}`);
|
|
131
|
+
});
|
|
132
|
+
// 次级配峰与散石(近景细节层,LOD 可剔除)
|
|
133
|
+
const rnd = mulberry32(2024);
|
|
134
|
+
for (let i = 0; i < 26; i++) {
|
|
135
|
+
const a = rnd() * Math.PI * 2, r = 6 + rnd() * 15;
|
|
136
|
+
const x = cx + Math.cos(a) * r, z = cz + Math.sin(a) * r;
|
|
137
|
+
if (waterSDF(x, z) < -0.6) continue;
|
|
138
|
+
const w = 1.2 + rnd() * 3.0, h = 1.0 + rnd() * 2.8;
|
|
139
|
+
const g = taihuGeo(2200 + i * 17, w, h, w * (0.7 + rnd() * 0.5), { detail: 3, hole: 0.58, amp: 0.40 });
|
|
140
|
+
stone(ctx, g, M.taihuDark, x, h * 0.38, z, [rnd() * 0.2, rnd() * 6.28, rnd() * 0.2], i < 10 ? 1 : 2);
|
|
141
|
+
}
|
|
142
|
+
// 崖壁沟壑与皴纹线(苔痕)
|
|
143
|
+
for (let i = 0; i < 18; i++) {
|
|
144
|
+
const a = rnd() * Math.PI * 2, r = 3 + rnd() * 11;
|
|
145
|
+
const x = cx + Math.cos(a) * r, z = cz + Math.sin(a) * r;
|
|
146
|
+
stone(ctx, new THREE.IcosahedronGeometry(0.35 + rnd() * 0.45, 1), M.moss,
|
|
147
|
+
x, 0.8 + rnd() * 2.2, z, [0, rnd() * 6.28, 0], 1);
|
|
148
|
+
}
|
|
149
|
+
// 洞壑:两块巨石之间以暗色内腔与券口石表达
|
|
150
|
+
const caveX = cx - 2.0, caveZ = cz + 8.6;
|
|
151
|
+
stone(ctx, new THREE.SphereGeometry(2.1, 12, 8), M.ink, caveX, 1.55, caveZ);
|
|
152
|
+
for (let i = 0; i < 9; i++) {
|
|
153
|
+
const a = Math.PI * (i + 0.5) / 9;
|
|
154
|
+
stone(ctx, huangshiGeo(3300 + i, 1.0, 0.65, 0.7), M.huangshi,
|
|
155
|
+
caveX - Math.cos(a) * 2.35, 1.3 + Math.sin(a) * 2.1, caveZ + 0.35, [0, 0, -a + Math.PI / 2], 1);
|
|
156
|
+
}
|
|
157
|
+
// 蹬道:从水湾 (-46,-18) 盘旋至山顶 (-64,-40)
|
|
158
|
+
const path = [
|
|
159
|
+
[-46, -18], [-50, -22], [-53, -26], [-55, -30], [-58, -33],
|
|
160
|
+
[-61, -36], [-64, -38], [-67, -40], [-64, -43], [-62, -40],
|
|
161
|
+
];
|
|
162
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
163
|
+
const [x1, z1] = path[i], [x2, z2] = path[i + 1];
|
|
164
|
+
const steps = 5;
|
|
165
|
+
const y0 = 0.35 + i * 0.72, y1 = 0.35 + (i + 1) * 0.72;
|
|
166
|
+
for (let k = 0; k < steps; k++) {
|
|
167
|
+
const t = (k + 0.5) / steps;
|
|
168
|
+
const x = x1 + (x2 - x1) * t, z = z1 + (z2 - z1) * t;
|
|
169
|
+
const y = y0 + (y1 - y0) * t;
|
|
170
|
+
const a = -Math.atan2(z2 - z1, x2 - x1);
|
|
171
|
+
stone(ctx, boxGeo(1.9, 0.16, 0.72, 0.5), M.huangshi, x, y, z, [0, a, 0]);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
// 峡谷两侧岩壁
|
|
175
|
+
for (let i = 0; i < 8; i++) {
|
|
176
|
+
const x = -50 - i * 1.5, z = -22 - i * 1.8;
|
|
177
|
+
const h = 2.4 + i * 0.42;
|
|
178
|
+
const g = taihuGeo(4400 + i, 3.2, h, 2.6, { detail: 3, hole: 0.62, amp: 0.30 });
|
|
179
|
+
stone(ctx, g, M.taihuDark, x - 2.4, h * 0.42, z, [0, i * 0.5, 0]);
|
|
180
|
+
stone(ctx, taihuGeo(4500 + i, 2.8, h * 0.8, 2.4, { detail: 3, hole: 0.62, amp: 0.30 }),
|
|
181
|
+
M.taihuDark, x + 2.4, h * 0.34, z + 1.0, [0, i * 0.6, 0]);
|
|
182
|
+
}
|
|
183
|
+
// 跌水与山涧(位置交给 water.js)
|
|
184
|
+
ctx.waterfalls.push({ x: -53.2, z: -30.5, yTop: 5.8, yBottom: -0.30, width: 2.5, depth: 0.35 });
|
|
185
|
+
ctx.waterfalls.push({ x: -47.5, z: -22.0, yTop: 2.4, yBottom: -0.30, width: 1.5, depth: 0.25 });
|
|
186
|
+
ctx.streams.push({ points: [[-53, -30], [-50, -26], [-47, -22], [-44, -18]], width: 1.8 });
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** 池岸:沿水系等值线布置黄石驳岸、太湖石石矶与湿苔 */
|
|
190
|
+
function buildShore(ctx) {
|
|
191
|
+
const { M } = ctx;
|
|
192
|
+
const rnd = mulberry32(7717);
|
|
193
|
+
// 沿园墙内水岸采样(角度采样 + 椭圆参数)
|
|
194
|
+
const samples = [];
|
|
195
|
+
POOLS.forEach((p, pi) => {
|
|
196
|
+
const N = pi === 0 ? 96 : 40;
|
|
197
|
+
for (let i = 0; i < N; i++) {
|
|
198
|
+
const a = i * Math.PI * 2 / N + rnd() * 0.02;
|
|
199
|
+
const jitter = 1 + (rnd() - 0.5) * 0.10;
|
|
200
|
+
const x = p.x + Math.cos(a) * p.rx * jitter;
|
|
201
|
+
const z = p.z + Math.sin(a) * p.rz * jitter;
|
|
202
|
+
if (waterSDF(x, z) > -1.6 && waterSDF(x, z) < 1.6) samples.push([x, z, a]);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
samples.forEach(([x, z, a], i) => {
|
|
206
|
+
if (rnd() < 0.16) return;
|
|
207
|
+
const w = 1.0 + rnd() * 1.5, h = 0.45 + rnd() * 0.75;
|
|
208
|
+
// 条石驳岸
|
|
209
|
+
stone(ctx, boxGeo(w, h, 0.75, 0.55), i % 3 === 0 ? M.stoneDark : M.huangshi,
|
|
210
|
+
x, h * 0.22 - 0.10, z, [0, -a + Math.PI / 2, 0]);
|
|
211
|
+
if (i % 7 === 0) {
|
|
212
|
+
// 石矶:稍大的太湖石挑出水面
|
|
213
|
+
const g = taihuGeo(6100 + i, 1.6 + rnd() * 1.3, 1.1 + rnd() * 1.2, 1.4 + rnd(),
|
|
214
|
+
{ detail: 3, hole: 0.60, amp: 0.38 });
|
|
215
|
+
stone(ctx, g, M.taihuDark, x + Math.cos(a) * 0.9, 0.42, z + Math.sin(a) * 0.9, [0, rnd() * 6.28, 0], 1);
|
|
216
|
+
}
|
|
217
|
+
if (i % 5 === 0) {
|
|
218
|
+
stone(ctx, new THREE.IcosahedronGeometry(0.24 + rnd() * 0.2, 1), M.moss,
|
|
219
|
+
x, 0.32, z, [0, rnd() * 6.28, 0], 1);
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
// 岛屿岸壁加石
|
|
223
|
+
ISLES.forEach((is, k) => {
|
|
224
|
+
for (let i = 0; i < 16; i++) {
|
|
225
|
+
const a = i * Math.PI * 2 / 16;
|
|
226
|
+
const x = is.x + Math.cos(a) * (is.rx + 0.35), z = is.z + Math.sin(a) * (is.rz + 0.35);
|
|
227
|
+
stone(ctx, huangshiGeo(7000 + k * 20 + i, 1.5, 0.7 + (i % 3) * 0.18, 0.9), M.huangshi,
|
|
228
|
+
x, 0.05, z, [0, -a, 0]);
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/** 庭园特置峰石与小品(冠云峰式立峰、石笋、石桌凳) */
|
|
234
|
+
function buildFeatureStones(ctx) {
|
|
235
|
+
const { B, M } = ctx;
|
|
236
|
+
const features = [
|
|
237
|
+
{ x: -93, z: 52, h: 4.6, w: 2.1, d: 1.7, seed: 801 }, // 竹里馆入口立峰(避开框景视线)
|
|
238
|
+
{ x: -22, z: 42, h: 3.4, w: 1.8, d: 1.5, seed: 802 }, // 前庭东隅
|
|
239
|
+
{ x: 24, z: 44, h: 3.8, w: 2.0, d: 1.6, seed: 803 }, // 前庭西隅
|
|
240
|
+
{ x: 74, z: -40, h: 4.1, w: 2.3, d: 1.9, seed: 804 }, // 小山丛桂
|
|
241
|
+
{ x: 28, z: -18, h: 5.2, w: 2.6, d: 2.1, seed: 805 }, // 瀛洲岛主峰
|
|
242
|
+
{ x: -34, z: -24, h: 3.2, w: 1.6, d: 1.4, seed: 806 }, // 方丈岛
|
|
243
|
+
{ x: 62, z: 18, h: 3.0, w: 1.7, d: 1.4, seed: 807 }, // 荷池东岸
|
|
244
|
+
{ x: -70, z: 8, h: 3.6, w: 2.0, d: 1.6, seed: 808 }, // 漱石枕流
|
|
245
|
+
];
|
|
246
|
+
features.forEach(f => {
|
|
247
|
+
const g = taihuGeo(f.seed, f.w, f.h, f.d, { detail: 4, hole: 0.42, amp: 0.32, holeFreq: 2.1 });
|
|
248
|
+
stone(ctx, g, M.taihu, f.x, f.h * 0.47, f.z, [0, f.seed * 0.01, 0]);
|
|
249
|
+
// 石座
|
|
250
|
+
stone(ctx, new THREE.CylinderGeometry(f.w * 0.72, f.w * 0.85, 0.36, 10), M.stoneDark, f.x, 0.18, f.z);
|
|
251
|
+
for (let i = 0; i < 4; i++) {
|
|
252
|
+
const a = i * Math.PI / 2;
|
|
253
|
+
stone(ctx, new THREE.IcosahedronGeometry(0.30 + i * 0.05, 1), M.moss,
|
|
254
|
+
f.x + Math.cos(a) * f.w * 0.7, 0.30, f.z + Math.sin(a) * f.d * 0.7, [0, a, 0], 1);
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
// 石桌石凳(竹里馆 / 扇面亭旁)
|
|
258
|
+
[[-88, 38], [72, -50], [-40, 16]].forEach(([x, z], i) => {
|
|
259
|
+
stone(ctx, new THREE.CylinderGeometry(0.85, 0.72, 0.16, 12), M.stone, x, 0.76, z, [0, 0, 0], 1);
|
|
260
|
+
stone(ctx, new THREE.CylinderGeometry(0.20, 0.30, 0.70, 8), M.stoneDark, x, 0.36, z, [0, 0, 0], 1);
|
|
261
|
+
for (let k = 0; k < 4; k++) {
|
|
262
|
+
const a = k * Math.PI / 2 + 0.4;
|
|
263
|
+
stone(ctx, new THREE.CylinderGeometry(0.30, 0.32, 0.42, 8), M.stoneDark,
|
|
264
|
+
x + Math.cos(a) * 1.4, 0.21, z + Math.sin(a) * 1.4, [0, 0, 0], 1);
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export function buildRockery(ctx) {
|
|
270
|
+
if (!ctx.waterfalls) ctx.waterfalls = [];
|
|
271
|
+
if (!ctx.streams) ctx.streams = [];
|
|
272
|
+
const prog = ctx.onProgress || (() => {});
|
|
273
|
+
prog(0.02, '太湖石主峰群');
|
|
274
|
+
buildMainPeaks(ctx);
|
|
275
|
+
prog(0.62, '池岸驳岸与石矶');
|
|
276
|
+
buildShore(ctx);
|
|
277
|
+
prog(0.84, '庭园特置峰石');
|
|
278
|
+
buildFeatureStones(ctx);
|
|
279
|
+
prog(1, '假山叠石完成');
|
|
280
|
+
}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/* 吴苑澄观 · 天穹、时辰光照、天气与软阴影
|
|
2
|
+
* 天穹 shader(渐变 + 卷积云 + 日轮 + 地平线散射)、太阳/半球/补光、
|
|
3
|
+
* FogExp2 高度雾、三态天气(晴 / 薄霭 / 细雨)与 GPU 顶点动画雨丝。
|
|
4
|
+
*/
|
|
5
|
+
import * as THREE from 'three';
|
|
6
|
+
import { WORLD, QUALITY, clamp, lerp, mulberry32 } from './core.js';
|
|
7
|
+
|
|
8
|
+
const skyVert = `
|
|
9
|
+
varying vec3 vDir;
|
|
10
|
+
void main(){
|
|
11
|
+
vDir = normalize(position);
|
|
12
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
13
|
+
}`;
|
|
14
|
+
const skyFrag = `
|
|
15
|
+
precision highp float;
|
|
16
|
+
uniform vec3 uTop, uHorizon, uSunDir, uSunColor;
|
|
17
|
+
uniform float uCloud, uTime, uRain, uSunAlt;
|
|
18
|
+
varying vec3 vDir;
|
|
19
|
+
float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
|
|
20
|
+
float noise(vec2 p){
|
|
21
|
+
vec2 i = floor(p), f = fract(p);
|
|
22
|
+
vec2 u = f * f * (3.0 - 2.0 * f);
|
|
23
|
+
return mix(mix(hash(i), hash(i + vec2(1.0,0.0)), u.x),
|
|
24
|
+
mix(hash(i + vec2(0.0,1.0)), hash(i + vec2(1.0,1.0)), u.x), u.y);
|
|
25
|
+
}
|
|
26
|
+
float fbm(vec2 p){
|
|
27
|
+
float a = 0.5, s = 0.0;
|
|
28
|
+
for (int i = 0; i < 5; i++){ s += a * noise(p); p *= 2.03; a *= 0.5; }
|
|
29
|
+
return s;
|
|
30
|
+
}
|
|
31
|
+
void main(){
|
|
32
|
+
vec3 d = normalize(vDir);
|
|
33
|
+
float y = clamp(d.y, -0.12, 1.0);
|
|
34
|
+
vec3 col = mix(uHorizon, uTop, pow(clamp(y * 1.35 + 0.04, 0.0, 1.0), 0.62));
|
|
35
|
+
// 地平线暖散射
|
|
36
|
+
float glow = exp(-abs(y - 0.02) * 9.0);
|
|
37
|
+
col += uSunColor * glow * (0.10 + 0.16 * (1.0 - uSunAlt));
|
|
38
|
+
// 卷积云(沿天穹切平面投影)
|
|
39
|
+
vec2 cp = d.xz / max(0.22, d.y + 0.30);
|
|
40
|
+
float cs = fbm(cp * 1.9 + vec2(uTime * 0.006, uTime * 0.002));
|
|
41
|
+
float cloud = smoothstep(0.46 - uCloud * 0.22, 0.78 - uCloud * 0.14, cs);
|
|
42
|
+
cloud *= smoothstep(0.02, 0.28, y) * (1.0 - smoothstep(0.82, 1.0, y));
|
|
43
|
+
vec3 cloudCol = mix(vec3(0.80, 0.83, 0.84), vec3(0.98, 0.96, 0.92), clamp(uSunAlt, 0.0, 1.0));
|
|
44
|
+
cloudCol = mix(cloudCol * 0.62, cloudCol, uSunAlt);
|
|
45
|
+
col = mix(col, cloudCol, cloud * (0.30 + uCloud * 0.62));
|
|
46
|
+
// 日轮与光晕
|
|
47
|
+
float sd = max(dot(d, normalize(uSunDir)), 0.0);
|
|
48
|
+
col += uSunColor * pow(sd, 1800.0) * 3.2 * (1.0 - uCloud * 0.55);
|
|
49
|
+
col += uSunColor * pow(sd, 42.0) * 0.26 * (1.0 - uRain * 0.6);
|
|
50
|
+
// 雨天压暗与去饱和
|
|
51
|
+
float lum = dot(col, vec3(0.299, 0.587, 0.114));
|
|
52
|
+
col = mix(col, vec3(lum) * vec3(0.88, 0.93, 0.96), uRain * 0.55);
|
|
53
|
+
gl_FragColor = vec4(col, 1.0);
|
|
54
|
+
}`;
|
|
55
|
+
|
|
56
|
+
const rainVert = `
|
|
57
|
+
uniform float uTime;
|
|
58
|
+
varying float vA;
|
|
59
|
+
void main(){
|
|
60
|
+
vec4 base = instanceMatrix * vec4(0.0, 0.0, 0.0, 1.0);
|
|
61
|
+
float y = mod(base.y - uTime * 17.0, 26.0) - 13.0;
|
|
62
|
+
vec3 wp = vec3(base.x + position.x + y * 0.10, y + position.y, base.z + position.z);
|
|
63
|
+
vA = 1.0 - smoothstep(10.0, 13.5, abs(y));
|
|
64
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(wp, 1.0);
|
|
65
|
+
}`;
|
|
66
|
+
const rainFrag = `
|
|
67
|
+
precision highp float;
|
|
68
|
+
uniform float uOpacity;
|
|
69
|
+
varying float vA;
|
|
70
|
+
void main(){ gl_FragColor = vec4(0.78, 0.86, 0.90, vA * uOpacity); }`;
|
|
71
|
+
|
|
72
|
+
const WEATHER = {
|
|
73
|
+
clear: { cloud: 0.22, fog: 0.0019, rain: 0, light: 1.0, exposure: 1.08, sat: 1.0 },
|
|
74
|
+
mist: { cloud: 0.58, fog: 0.0038, rain: 0, light: 0.82, exposure: 1.02, sat: 0.92 },
|
|
75
|
+
rain: { cloud: 0.92, fog: 0.0052, rain: 1, light: 0.62, exposure: 0.94, sat: 0.80 },
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export function createSky(scene, renderer, M) {
|
|
79
|
+
const state = {
|
|
80
|
+
hour: WORLD.sunDefaultHour,
|
|
81
|
+
weather: 'clear',
|
|
82
|
+
skyTop: new THREE.Color(0x4a78a6),
|
|
83
|
+
skyHorizon: new THREE.Color(0xd4cdb4),
|
|
84
|
+
sunDir: new THREE.Vector3(0.6, 0.6, 0.5).normalize(),
|
|
85
|
+
sunColor: new THREE.Color(0xffe0b0),
|
|
86
|
+
fogColor: new THREE.Color(0xb9c2ba),
|
|
87
|
+
fogDensity: 0.0019,
|
|
88
|
+
rain: 0,
|
|
89
|
+
cloud: 0.22,
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
/* 天穹 */
|
|
93
|
+
const skyUniforms = {
|
|
94
|
+
uTop: { value: state.skyTop },
|
|
95
|
+
uHorizon: { value: state.skyHorizon },
|
|
96
|
+
uSunDir: { value: state.sunDir },
|
|
97
|
+
uSunColor: { value: state.sunColor },
|
|
98
|
+
uCloud: { value: state.cloud },
|
|
99
|
+
uTime: { value: 0 },
|
|
100
|
+
uRain: { value: 0 },
|
|
101
|
+
uSunAlt: { value: 0.6 },
|
|
102
|
+
};
|
|
103
|
+
const dome = new THREE.Mesh(
|
|
104
|
+
new THREE.SphereGeometry(1400, 40, 24),
|
|
105
|
+
new THREE.ShaderMaterial({
|
|
106
|
+
uniforms: skyUniforms, vertexShader: skyVert, fragmentShader: skyFrag,
|
|
107
|
+
side: THREE.BackSide, depthWrite: false, fog: false,
|
|
108
|
+
})
|
|
109
|
+
);
|
|
110
|
+
dome.name = '天穹'; dome.frustumCulled = false;
|
|
111
|
+
scene.add(dome);
|
|
112
|
+
|
|
113
|
+
/* 光照 */
|
|
114
|
+
const sun = new THREE.DirectionalLight(0xffe0b0, 2.3);
|
|
115
|
+
sun.castShadow = true;
|
|
116
|
+
sun.shadow.mapSize.set(4096, 4096);
|
|
117
|
+
const sc = sun.shadow.camera;
|
|
118
|
+
sc.left = -180; sc.right = 180; sc.top = 165; sc.bottom = -165; sc.near = 1; sc.far = 900;
|
|
119
|
+
sun.shadow.bias = -0.00035;
|
|
120
|
+
sun.shadow.normalBias = 0.024;
|
|
121
|
+
sun.shadow.radius = 2.2;
|
|
122
|
+
sun.target.position.set(0, 0, -8);
|
|
123
|
+
scene.add(sun, sun.target);
|
|
124
|
+
const hemi = new THREE.HemisphereLight(0x91aec6, 0x77805e, 0.86);
|
|
125
|
+
scene.add(hemi);
|
|
126
|
+
const ambient = new THREE.AmbientLight(0xbfc8c4, 0.26);
|
|
127
|
+
scene.add(ambient);
|
|
128
|
+
const fill = new THREE.DirectionalLight(0xa8c2d8, 0.34);
|
|
129
|
+
fill.position.set(90, 60, 120);
|
|
130
|
+
scene.add(fill);
|
|
131
|
+
|
|
132
|
+
scene.fog = new THREE.FogExp2(state.fogColor.getHex(), state.fogDensity);
|
|
133
|
+
|
|
134
|
+
/* 雨丝:InstancedMesh + 顶点动画,整体跟随相机 */
|
|
135
|
+
let rain = null;
|
|
136
|
+
function buildRain(count) {
|
|
137
|
+
if (rain) { scene.remove(rain); rain.geometry.dispose(); rain.material.dispose(); }
|
|
138
|
+
const geo = new THREE.BoxGeometry(0.012, 0.82, 0.012);
|
|
139
|
+
const mat = new THREE.ShaderMaterial({
|
|
140
|
+
uniforms: { uTime: { value: 0 }, uOpacity: { value: 0.42 } },
|
|
141
|
+
vertexShader: rainVert, fragmentShader: rainFrag,
|
|
142
|
+
transparent: true, depthWrite: false, side: THREE.DoubleSide,
|
|
143
|
+
});
|
|
144
|
+
rain = new THREE.InstancedMesh(geo, mat, count);
|
|
145
|
+
rain.name = '细雨'; rain.frustumCulled = false; rain.visible = false;
|
|
146
|
+
const rnd = mulberry32(1357), m = new THREE.Matrix4();
|
|
147
|
+
for (let i = 0; i < count; i++) {
|
|
148
|
+
m.makeTranslation((rnd() - 0.5) * 76, rnd() * 26, (rnd() - 0.5) * 76);
|
|
149
|
+
rain.setMatrixAt(i, m);
|
|
150
|
+
}
|
|
151
|
+
rain.instanceMatrix.needsUpdate = true;
|
|
152
|
+
rain.userData.mat = mat;
|
|
153
|
+
scene.add(rain);
|
|
154
|
+
}
|
|
155
|
+
buildRain(QUALITY.high.rain);
|
|
156
|
+
|
|
157
|
+
/* 时辰与天气 */
|
|
158
|
+
const tmpTop = new THREE.Color(), tmpHz = new THREE.Color(), tmpSun = new THREE.Color(), tmpFog = new THREE.Color();
|
|
159
|
+
function setHour(h) {
|
|
160
|
+
state.hour = clamp(h, 5.5, 19.5);
|
|
161
|
+
const t = (state.hour - 5.5) / 14;
|
|
162
|
+
const alt = 55 * Math.pow(Math.max(0.02, Math.sin(t * Math.PI)), 1.7) * Math.PI / 180;
|
|
163
|
+
const az = (t - 0.5) * Math.PI; // -π/2 东 → 0 南 → π/2 西
|
|
164
|
+
state.sunDir.set(Math.sin(az) * Math.cos(alt), Math.sin(alt), Math.cos(az) * Math.cos(alt)).normalize();
|
|
165
|
+
skyUniforms.uSunAlt.value = Math.sin(alt);
|
|
166
|
+
const day = clamp(Math.sin(t * Math.PI) * 1.4, 0, 1);
|
|
167
|
+
const golden = 1 - clamp((alt - 0.18) / 0.52, 0, 1); // 低角度暖光权重
|
|
168
|
+
const dusk = 1 - day;
|
|
169
|
+
|
|
170
|
+
// 天空色:日间冷蓝、黄金时刻暖、暮色紫橙
|
|
171
|
+
tmpTop.set(0x3f6fa3).lerp(new THREE.Color(0x2a3a62), dusk * 0.78);
|
|
172
|
+
tmpHz.set(0xc9d4cf).lerp(new THREE.Color(0xe9c79c), golden * 0.72);
|
|
173
|
+
tmpHz.lerp(new THREE.Color(0xc98768), dusk * 0.55);
|
|
174
|
+
tmpSun.set(0xfff4dc).lerp(new THREE.Color(0xffb878), golden * 0.82);
|
|
175
|
+
tmpSun.lerp(new THREE.Color(0xff9a68), dusk * 0.55);
|
|
176
|
+
|
|
177
|
+
const w = WEATHER[state.weather];
|
|
178
|
+
if (state.weather === 'rain') {
|
|
179
|
+
tmpTop.lerp(new THREE.Color(0x596a72), 0.78);
|
|
180
|
+
tmpHz.lerp(new THREE.Color(0x9ba7a6), 0.78);
|
|
181
|
+
tmpSun.lerp(new THREE.Color(0xc9d2d0), 0.72);
|
|
182
|
+
} else if (state.weather === 'mist') {
|
|
183
|
+
tmpTop.lerp(new THREE.Color(0x7190a4), 0.48);
|
|
184
|
+
tmpHz.lerp(new THREE.Color(0xc9cec4), 0.52);
|
|
185
|
+
}
|
|
186
|
+
state.skyTop.copy(tmpTop); state.skyHorizon.copy(tmpHz); state.sunColor.copy(tmpSun);
|
|
187
|
+
tmpFog.copy(tmpHz).lerp(tmpTop, 0.34);
|
|
188
|
+
if (state.weather === 'rain') tmpFog.lerp(new THREE.Color(0x9aa6a6), 0.55);
|
|
189
|
+
state.fogColor.copy(tmpFog);
|
|
190
|
+
state.fogDensity = w.fog;
|
|
191
|
+
scene.fog.color.copy(state.fogColor);
|
|
192
|
+
scene.fog.density = state.fogDensity;
|
|
193
|
+
|
|
194
|
+
sun.color.copy(state.sunColor);
|
|
195
|
+
sun.intensity = (0.42 + day * 2.05) * w.light;
|
|
196
|
+
sun.position.copy(state.sunDir).multiplyScalar(340);
|
|
197
|
+
hemi.color.copy(tmpTop).lerp(new THREE.Color(0xffffff), 0.32);
|
|
198
|
+
hemi.groundColor.set(0x6e7658);
|
|
199
|
+
hemi.intensity = (0.48 + day * 0.46) * (state.weather === 'rain' ? 0.82 : 1);
|
|
200
|
+
ambient.intensity = 0.20 + dusk * 0.16;
|
|
201
|
+
fill.intensity = 0.24 + (1 - day) * 0.16;
|
|
202
|
+
renderer.toneMappingExposure = w.exposure * (0.92 + day * 0.10);
|
|
203
|
+
|
|
204
|
+
// 暮色点亮廊下灯笼
|
|
205
|
+
M.lantern.emissiveIntensity = 0.12 + dusk * 2.1 + (state.weather === 'rain' ? 0.5 : 0);
|
|
206
|
+
renderer.shadowMap.needsUpdate = true;
|
|
207
|
+
return state;
|
|
208
|
+
}
|
|
209
|
+
function setWeather(w) {
|
|
210
|
+
if (!WEATHER[w]) return state;
|
|
211
|
+
state.weather = w;
|
|
212
|
+
const cfg = WEATHER[w];
|
|
213
|
+
state.cloud = cfg.cloud; state.rain = cfg.rain;
|
|
214
|
+
skyUniforms.uCloud.value = cfg.cloud;
|
|
215
|
+
skyUniforms.uRain.value = cfg.rain;
|
|
216
|
+
if (rain) { rain.visible = cfg.rain > 0; rain.userData.mat.uniforms.uOpacity.value = 0.42; }
|
|
217
|
+
setHour(state.hour);
|
|
218
|
+
return state;
|
|
219
|
+
}
|
|
220
|
+
function setQuality(q) {
|
|
221
|
+
sun.shadow.mapSize.set(q.shadow, q.shadow);
|
|
222
|
+
if (sun.shadow.map) { sun.shadow.map.dispose(); sun.shadow.map = null; }
|
|
223
|
+
if (rain) {
|
|
224
|
+
rain.count = Math.min(rain.instanceMatrix.count, Math.round(q.rain));
|
|
225
|
+
}
|
|
226
|
+
renderer.shadowMap.needsUpdate = true;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return {
|
|
230
|
+
dome, sun, hemi, state, rain,
|
|
231
|
+
setHour, setWeather, setQuality,
|
|
232
|
+
getState: () => state,
|
|
233
|
+
update(t, camera) {
|
|
234
|
+
skyUniforms.uTime.value = t;
|
|
235
|
+
dome.position.copy(camera.position);
|
|
236
|
+
if (rain && rain.visible) {
|
|
237
|
+
rain.position.set(camera.position.x, 10, camera.position.z);
|
|
238
|
+
rain.userData.mat.uniforms.uTime.value = t;
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
}
|