agentscape3d 1.0.0-beta.1 → 1.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -48
- package/dist/core.d.ts +68 -0
- package/dist/core.js +209 -0
- package/dist/core.js.map +1 -0
- package/dist/index.d.ts +10 -229
- package/dist/index.js +192 -15462
- package/dist/index.js.map +1 -1
- package/package.json +11 -40
- package/cli.mjs +0 -27
- package/dist/AssetCompiler-CDFiElji.js +0 -2451
- package/dist/AssetCompiler-CDFiElji.js.map +0 -1
- package/dist/AssetInputContracts-Dy8iU4eT.js +0 -228
- package/dist/AssetInputContracts-Dy8iU4eT.js.map +0 -1
- package/dist/AssetRecipe-DmFpzxr-.js +0 -55
- package/dist/AssetRecipe-DmFpzxr-.js.map +0 -1
- package/dist/BrowserCodeWorker.js +0 -53615
- package/dist/KinematicHypothesisScreen-D-z6qgMB.js +0 -242
- package/dist/KinematicHypothesisScreen-D-z6qgMB.js.map +0 -1
- package/dist/SceneSerializer-DPVOyeRk.js +0 -353
- package/dist/SceneSerializer-DPVOyeRk.js.map +0 -1
- package/dist/StylePack-DNrdLeGI.js +0 -6314
- package/dist/StylePack-DNrdLeGI.js.map +0 -1
- package/dist/WorldArchive-pSBIGxLa.js +0 -420
- package/dist/WorldArchive-pSBIGxLa.js.map +0 -1
- package/dist/WorldIO-wsDfZGM4.js +0 -150
- package/dist/WorldIO-wsDfZGM4.js.map +0 -1
- package/dist/blankWorld-CBWbwJGj.js +0 -76
- package/dist/blankWorld-CBWbwJGj.js.map +0 -1
- package/dist/disposeObject3D-BQ9TyVC_.js +0 -54
- package/dist/disposeObject3D-BQ9TyVC_.js.map +0 -1
- package/dist/environments-DgH66NqV.js +0 -4220
- package/dist/environments-DgH66NqV.js.map +0 -1
- package/dist/gltfIO-B87nJaat.js +0 -10
- package/dist/gltfIO-B87nJaat.js.map +0 -1
- package/dist/grandUrbanBlock-Ob9pN-CB.js +0 -516
- package/dist/grandUrbanBlock-Ob9pN-CB.js.map +0 -1
- package/dist/magicCabin-D64fD1E2.js +0 -11024
- package/dist/magicCabin-D64fD1E2.js.map +0 -1
- package/dist/mcp.d.ts +0 -2
- package/dist/mcp.js +0 -1
- package/dist/monumentHall-BKbs0UOQ.js +0 -404
- package/dist/monumentHall-BKbs0UOQ.js.map +0 -1
- package/dist/node.d.ts +0 -16
- package/dist/node.js +0 -25
- package/dist/ruinedCourtyard-BoZxHldu.js +0 -697
- package/dist/ruinedCourtyard-BoZxHldu.js.map +0 -1
- package/dist/runtime/application/AgentTools.js +0 -25
- package/dist/runtime/application/README.md +0 -14
- package/dist/runtime/application/buildTaskObservation.js +0 -117
- package/dist/runtime/application/code-execution/AuthoringSandboxEntry.js +0 -46
- package/dist/runtime/application/code-execution/BrowserCodeExecutor.js +0 -35
- package/dist/runtime/application/code-execution/BrowserCodeWorker.js +0 -17
- package/dist/runtime/application/code-execution/RemoteAuthoringDocument.js +0 -72
- package/dist/runtime/application/createSession.js +0 -66
- package/dist/runtime/application/createWorldAuthoringContext.js +0 -400
- package/dist/runtime/application/generation/GenerationOrchestrator.js +0 -629
- package/dist/runtime/application/generation/GenerationRuntime.js +0 -214
- package/dist/runtime/application/generation/PromptHybridWorldOrchestrator.js +0 -285
- package/dist/runtime/application/native-scene/CodeProject.js +0 -119
- package/dist/runtime/application/native-scene/CodeProjectModules.js +0 -128
- package/dist/runtime/application/native-scene/NativeEnvironmentGeometry.js +0 -62
- package/dist/runtime/application/native-scene/NativeOverlayCheckpoint.js +0 -127
- package/dist/runtime/application/native-scene/NativeRenderDiscovery.js +0 -51
- package/dist/runtime/application/native-scene/NativeSceneHost.js +0 -164
- package/dist/runtime/application/native-scene/NativeSceneOverlay.js +0 -116
- package/dist/runtime/application/native-scene/NativeThreeModule.js +0 -16
- package/dist/runtime/application/object-forge/SceneObjectForge.js +0 -232
- package/dist/runtime/application/programmatic-assets/ProgrammaticAssetBuilder.js +0 -54
- package/dist/runtime/application/programmatic-assets/ProgrammaticAssetContract.js +0 -22
- package/dist/runtime/application/programmatic-assets/ThreeCodeAsset.js +0 -40
- package/dist/runtime/application/scene/CapabilityResolver.js +0 -79
- package/dist/runtime/application/scene/RequestWindow.js +0 -54
- package/dist/runtime/application/scene/SceneAgentTools.js +0 -21
- package/dist/runtime/application/scene/SceneContracts.js +0 -45
- package/dist/runtime/application/scene/SceneEditService.js +0 -144
- package/dist/runtime/application/scene/SceneFacade.js +0 -267
- package/dist/runtime/application/scene/SceneInteractionAdapters.js +0 -40
- package/dist/runtime/application/scene/SceneJobController.js +0 -229
- package/dist/runtime/application/scene/ScenePackage.js +0 -162
- package/dist/runtime/application/scene/ScenePersistence.js +0 -50
- package/dist/runtime/application/scene/SceneProject.js +0 -95
- package/dist/runtime/application/scene/SceneSkillNames.js +0 -5
- package/dist/runtime/application/scene/StarterScene.js +0 -56
- package/dist/runtime/application/scene/WorldArchive.js +0 -87
- package/dist/runtime/application/scene/WorldDirectory.js +0 -20
- package/dist/runtime/application/scene/WorldDocument.js +0 -74
- package/dist/runtime/application/scene/WorldIO.js +0 -103
- package/dist/runtime/application/scene/WorldStorage.js +0 -137
- package/dist/runtime/application/skills/SkillRegistry.js +0 -163
- package/dist/runtime/application/skills/packs/acceptanceSkills.js +0 -32
- package/dist/runtime/application/skills/packs/affordanceSkills.js +0 -36
- package/dist/runtime/application/skills/packs/assetSkills.js +0 -46
- package/dist/runtime/application/skills/packs/authoringSkills.js +0 -16
- package/dist/runtime/application/skills/packs/batchSkills.js +0 -22
- package/dist/runtime/application/skills/packs/codeSkills.js +0 -106
- package/dist/runtime/application/skills/packs/generationSkills.js +0 -45
- package/dist/runtime/application/skills/packs/interactionSkills.js +0 -46
- package/dist/runtime/application/skills/packs/recoverySkills.js +0 -80
- package/dist/runtime/application/skills/packs/sceneSkills.js +0 -24
- package/dist/runtime/application/skills/packs/spatialSkills.js +0 -35
- package/dist/runtime/application/skills/packs/verificationSkills.js +0 -14
- package/dist/runtime/application/skills/packs/worldSkills.js +0 -45
- package/dist/runtime/application/skills/registerCoreSkills.js +0 -31
- package/dist/runtime/application/skills/skillPrimitives.js +0 -4
- package/dist/runtime/application/tasks/CabinetCupTask.js +0 -76
- package/dist/runtime/application/tasks.jsonl +0 -67
- package/dist/runtime/application/world-authoring/AuthoringAssetProducer.js +0 -42
- package/dist/runtime/application/world-authoring/AuthoringDiff.js +0 -149
- package/dist/runtime/application/world-authoring/AuthoringDocument.js +0 -825
- package/dist/runtime/application/world-authoring/AuthoringExecutionHost.js +0 -109
- package/dist/runtime/application/world-authoring/AuthoringIdentity.js +0 -17
- package/dist/runtime/application/world-authoring/AuthoringModelResolver.js +0 -29
- package/dist/runtime/application/world-authoring/AuthoringPatch.js +0 -118
- package/dist/runtime/application/world-authoring/AuthoringPromotionController.js +0 -334
- package/dist/runtime/application/world-authoring/AuthoringPromotionSource.js +0 -126
- package/dist/runtime/application/world-authoring/AuthoringRevisionHistory.js +0 -144
- package/dist/runtime/application/world-authoring/HeadlessImageExport.js +0 -174
- package/dist/runtime/application/world-authoring/ModelRef.js +0 -62
- package/dist/runtime/apps/mcp-server/AUTHORING.md +0 -71
- package/dist/runtime/apps/mcp-server/AuthoringSandboxEntry.js +0 -1
- package/dist/runtime/apps/mcp-server/AuthoringSandboxWorker.mjs +0 -30
- package/dist/runtime/apps/mcp-server/BuildEnvironment.js +0 -17
- package/dist/runtime/apps/mcp-server/CodeExecutor.js +0 -71
- package/dist/runtime/apps/mcp-server/DEPLOYMENT-PC2.md +0 -42
- package/dist/runtime/apps/mcp-server/DockerBuildRunner.js +0 -66
- package/dist/runtime/apps/mcp-server/FileAssetRepository.js +0 -159
- package/dist/runtime/apps/mcp-server/HeadlessAssetIO.js +0 -8
- package/dist/runtime/apps/mcp-server/HeadlessGLTFLoader.js +0 -47
- package/dist/runtime/apps/mcp-server/HeadlessWorldHost.js +0 -132
- package/dist/runtime/apps/mcp-server/IsolatedAuthoringExecutor.js +0 -6
- package/dist/runtime/apps/mcp-server/PROGRAMMATIC-ASSETS.md +0 -116
- package/dist/runtime/apps/mcp-server/ProgrammaticAssets.js +0 -60
- package/dist/runtime/apps/mcp-server/README.md +0 -150
- package/dist/runtime/apps/mcp-server/RemoteAuthoringDocument.js +0 -1
- package/dist/runtime/apps/mcp-server/SandboxBundle.js +0 -13
- package/dist/runtime/apps/mcp-server/SessionManager.js +0 -80
- package/dist/runtime/apps/mcp-server/StudioBridgeHttp.js +0 -58
- package/dist/runtime/apps/mcp-server/StudioLiveBridge.js +0 -190
- package/dist/runtime/apps/mcp-server/TrustedAuthoringWorker.mjs +0 -16
- package/dist/runtime/apps/mcp-server/VALIDATION.md +0 -45
- package/dist/runtime/apps/mcp-server/acceptance-evidence.json +0 -332
- package/dist/runtime/apps/mcp-server/errorDiagnostics.js +0 -32
- package/dist/runtime/apps/mcp-server/examples/code-house.js +0 -24
- package/dist/runtime/apps/mcp-server/examples/procedural-assets.js +0 -37
- package/dist/runtime/apps/mcp-server/main.mjs +0 -56
- package/dist/runtime/apps/mcp-server/registerTools.js +0 -215
- package/dist/runtime/apps/mcp-server/sandbox/run.mjs +0 -23
- package/dist/runtime/apps/mcp-server/security.js +0 -21
- package/dist/runtime/apps/mcp-server/tasks.jsonl +0 -9
- package/dist/runtime/apps/server/CapabilityAdapterRegistry.js +0 -157
- package/dist/runtime/apps/server/README.md +0 -7
- package/dist/runtime/apps/server/WorldDiskStorage.js +0 -51
- package/dist/runtime/apps/server/openai-compatible-agent-gateway.mjs +0 -278
- package/dist/runtime/apps/server/tasks.jsonl +0 -10
- package/dist/runtime/foundation/EventBus.js +0 -18
- package/dist/runtime/foundation/JsonGateway.js +0 -47
- package/dist/runtime/foundation/PolicyEngine.js +0 -21
- package/dist/runtime/foundation/README.md +0 -7
- package/dist/runtime/foundation/TraceRecorder.js +0 -76
- package/dist/runtime/foundation/errors.js +0 -8
- package/dist/runtime/foundation/simulation/SimulationProfile.js +0 -143
- package/dist/runtime/foundation/version.js +0 -2
- package/dist/runtime/modules/agent/README.md +0 -11
- package/dist/runtime/modules/agent/ToolCallingAgent.js +0 -19
- package/dist/runtime/modules/agent/bootstrapWorld.js +0 -10
- package/dist/runtime/modules/agent/buildRecoveryProposals.js +0 -533
- package/dist/runtime/modules/agent/execution/AgentExecutionRules.js +0 -127
- package/dist/runtime/modules/agent/execution/AgentRunResults.js +0 -55
- package/dist/runtime/modules/agent/execution/AgentRunSession.js +0 -390
- package/dist/runtime/modules/agent/execution/AgentToolInvoker.js +0 -39
- package/dist/runtime/modules/agent/gateway/HttpLLMGateway.js +0 -19
- package/dist/runtime/modules/agent/prompt/index.js +0 -46
- package/dist/runtime/modules/agent/tasks.jsonl +0 -94
- package/dist/runtime/modules/artifact/ArtifactContentGate.js +0 -144
- package/dist/runtime/modules/artifact/ArtifactDescriptor.js +0 -280
- package/dist/runtime/modules/artifact/ArtifactImporter.js +0 -185
- package/dist/runtime/modules/artifact/ArtifactModule.js +0 -111
- package/dist/runtime/modules/artifact/ArtifactRegistry.js +0 -197
- package/dist/runtime/modules/artifact/IncrementalSha256.js +0 -129
- package/dist/runtime/modules/artifact/MemoryArtifactByteStore.js +0 -115
- package/dist/runtime/modules/artifact/README.md +0 -7
- package/dist/runtime/modules/artifact/storage/IndexedDbArtifactStore.js +0 -67
- package/dist/runtime/modules/artifact/tasks.jsonl +0 -31
- package/dist/runtime/modules/asset/AssetModule.js +0 -399
- package/dist/runtime/modules/asset/README.md +0 -54
- package/dist/runtime/modules/asset/loading/AssetLoader.js +0 -157
- package/dist/runtime/modules/asset/loading/GltfAssetLoader.js +0 -61
- package/dist/runtime/modules/asset/loading/builtins/BuiltinAssets.js +0 -95
- package/dist/runtime/modules/asset/loading/builtins/HouseDoor.js +0 -33
- package/dist/runtime/modules/asset/loading/builtins/IndustrialCabinet.js +0 -103
- package/dist/runtime/modules/asset/model/AssetInputContracts.js +0 -95
- package/dist/runtime/modules/asset/model/AssetRef.js +0 -12
- package/dist/runtime/modules/asset/model/MechanicalAssetDraft.js +0 -172
- package/dist/runtime/modules/asset/model/admission.js +0 -117
- package/dist/runtime/modules/asset/model/errors.js +0 -6
- package/dist/runtime/modules/asset/model/parts.js +0 -27
- package/dist/runtime/modules/asset/model/resourceBudget.js +0 -10
- package/dist/runtime/modules/asset/model/schema.js +0 -150
- package/dist/runtime/modules/asset/persistence/AssetManifestStore.js +0 -78
- package/dist/runtime/modules/asset/persistence/CompiledAssetStore.js +0 -84
- package/dist/runtime/modules/asset/persistence/LocalAssetLibrary.js +0 -86
- package/dist/runtime/modules/asset/persistence/LocalAssetLibraryStore.js +0 -81
- package/dist/runtime/modules/asset/production/AssetProductionPipeline.js +0 -272
- package/dist/runtime/modules/asset/production/AssetRecipe.js +0 -32
- package/dist/runtime/modules/asset/production/adapters/EmbodiedGenAdapter.js +0 -45
- package/dist/runtime/modules/asset/production/adapters/EmbodiedGenBundleAdapter.js +0 -590
- package/dist/runtime/modules/asset/production/compiler/AssetCompiler.js +0 -173
- package/dist/runtime/modules/asset/production/compiler/evidence/AnimationMotionEvidence.js +0 -124
- package/dist/runtime/modules/asset/production/compiler/evidence/StaticPanelEvidence.js +0 -56
- package/dist/runtime/modules/asset/production/compiler/gltfIO.js +0 -6
- package/dist/runtime/modules/asset/production/compiler/partGeometry.js +0 -74
- package/dist/runtime/modules/asset/production/compiler/passes/ArticulatedCollisionPass.js +0 -63
- package/dist/runtime/modules/asset/production/compiler/passes/ArticulationCandidatePass.js +0 -48
- package/dist/runtime/modules/asset/production/compiler/passes/AuthoringIntentPass.js +0 -16
- package/dist/runtime/modules/asset/production/compiler/passes/ColliderFallbackPass.js +0 -30
- package/dist/runtime/modules/asset/production/compiler/passes/CompileQualityPass.js +0 -75
- package/dist/runtime/modules/asset/production/compiler/passes/ExplicitDefinitionPass.js +0 -20
- package/dist/runtime/modules/asset/production/compiler/passes/GLTFInspectPass.js +0 -34
- package/dist/runtime/modules/asset/production/compiler/passes/GeometryPass.js +0 -32
- package/dist/runtime/modules/asset/production/compiler/passes/JointFramePass.js +0 -116
- package/dist/runtime/modules/asset/production/compiler/passes/KinematicEvidencePass.js +0 -84
- package/dist/runtime/modules/asset/production/compiler/passes/ManifestPass.js +0 -63
- package/dist/runtime/modules/asset/production/compiler/passes/NormalizeTransformPass.js +0 -16
- package/dist/runtime/modules/asset/production/compiler/passes/OptimizeGLBPass.js +0 -23
- package/dist/runtime/modules/asset/production/compiler/passes/PartColliderPass.js +0 -50
- package/dist/runtime/modules/asset/production/compiler/passes/PartGeometryEnrichmentPass.js +0 -60
- package/dist/runtime/modules/asset/production/compiler/passes/PartProposalPass.js +0 -93
- package/dist/runtime/modules/asset/production/compiler/passes/RemoteEnrichmentPass.js +0 -32
- package/dist/runtime/modules/asset/production/compiler/passes/ResourceBudgetPass.js +0 -55
- package/dist/runtime/modules/asset/production/compiler/passes/SegmentMaterializePass.js +0 -203
- package/dist/runtime/modules/asset/production/compiler/passes/SegmentationEvidencePass.js +0 -43
- package/dist/runtime/modules/asset/production/compiler/passes/SemanticHeuristicPass.js +0 -33
- package/dist/runtime/modules/asset/production/compiler/passes/StructurePass.js +0 -60
- package/dist/runtime/modules/asset/production/compiler/providers/HttpCompilerProvider.js +0 -23
- package/dist/runtime/modules/asset/production/verification/KinematicHypothesisScreen.js +0 -198
- package/dist/runtime/modules/asset/registry/AssetCatalog.js +0 -72
- package/dist/runtime/modules/asset/registry/AssetRegistry.js +0 -51
- package/dist/runtime/modules/asset/registry/manifests/index.js +0 -173
- package/dist/runtime/modules/asset/tasks.jsonl +0 -87
- package/dist/runtime/modules/generation/README.md +0 -9
- package/dist/runtime/modules/generation/connector/ConnectorArtifactClient.js +0 -45
- package/dist/runtime/modules/generation/connector/ConnectorCapabilityAdapter.js +0 -169
- package/dist/runtime/modules/generation/connector/ConnectorClient.js +0 -192
- package/dist/runtime/modules/generation/connector/ConnectorJobClient.js +0 -167
- package/dist/runtime/modules/generation/connector/ConnectorJobEventClient.js +0 -179
- package/dist/runtime/modules/generation/connector/ConnectorSession.js +0 -202
- package/dist/runtime/modules/generation/jobs/GenerationJobProjection.js +0 -239
- package/dist/runtime/modules/generation/jobs/GenerationJobReconciler.js +0 -99
- package/dist/runtime/modules/generation/jobs/GenerationJobStore.js +0 -91
- package/dist/runtime/modules/generation/jobs/GenerationJobTransportOverlay.js +0 -50
- package/dist/runtime/modules/generation/providers/ProviderRegistry.js +0 -304
- package/dist/runtime/modules/generation/tasks.jsonl +0 -35
- package/dist/runtime/modules/navigation/NavigationBackend.js +0 -17
- package/dist/runtime/modules/navigation/RecastNavigationBackend.js +0 -245
- package/dist/runtime/modules/physics/JoltPhysicsBackend.js +0 -850
- package/dist/runtime/modules/physics/PhysicsApiSurface.js +0 -651
- package/dist/runtime/modules/physics/PhysicsBackend.js +0 -88
- package/dist/runtime/modules/physics/RapierPhysicsBackend.js +0 -410
- package/dist/runtime/modules/rendering/README.md +0 -7
- package/dist/runtime/modules/rendering/RendererProbe.js +0 -153
- package/dist/runtime/modules/rendering/WebGpuPostFxPipeline.js +0 -140
- package/dist/runtime/modules/rendering/createRenderer.js +0 -76
- package/dist/runtime/modules/rendering/disposeObject3D.js +0 -34
- package/dist/runtime/modules/rendering/loadGaussianSplatVisual.js +0 -74
- package/dist/runtime/modules/rendering/style/StylePack.js +0 -34
- package/dist/runtime/modules/rendering/style/StyleSystem.js +0 -173
- package/dist/runtime/modules/rendering/tasks.jsonl +0 -7
- package/dist/runtime/modules/world/README.md +0 -13
- package/dist/runtime/modules/world/build/WorldBuilder.js +0 -170
- package/dist/runtime/modules/world/compiler/PipelineEngine.js +0 -32
- package/dist/runtime/modules/world/compiler/WorldAdmission.js +0 -43
- package/dist/runtime/modules/world/compiler/WorldBehaviorCompiler.js +0 -68
- package/dist/runtime/modules/world/compiler/WorldCompilation.js +0 -157
- package/dist/runtime/modules/world/compiler/WorldComposer.js +0 -201
- package/dist/runtime/modules/world/compiler/WorldPhysicsAdmission.js +0 -76
- package/dist/runtime/modules/world/compiler/WorldRecompiler.js +0 -356
- package/dist/runtime/modules/world/compiler/WorldRetry.js +0 -75
- package/dist/runtime/modules/world/compiler/createWorldPipeline.js +0 -379
- package/dist/runtime/modules/world/content/blankWorld.js +0 -35
- package/dist/runtime/modules/world/content/environments.js +0 -84
- package/dist/runtime/modules/world/content/grandUrbanBlock.js +0 -189
- package/dist/runtime/modules/world/content/magic-cabin/README.md +0 -28
- package/dist/runtime/modules/world/content/magic-cabin/affordances.js +0 -64
- package/dist/runtime/modules/world/content/magic-cabin/cabinContents.js +0 -7078
- package/dist/runtime/modules/world/content/magic-cabin/lighting.js +0 -26
- package/dist/runtime/modules/world/content/magic-cabin/materials.js +0 -20
- package/dist/runtime/modules/world/content/magicCabin.js +0 -190
- package/dist/runtime/modules/world/content/monumentHall.js +0 -154
- package/dist/runtime/modules/world/content/ruinedCourtyard.js +0 -196
- package/dist/runtime/modules/world/content/suzhouGarden/README.md +0 -141
- package/dist/runtime/modules/world/content/suzhouGarden/index.js +0 -137
- package/dist/runtime/modules/world/content/suzhouGarden/src/arch.js +0 -491
- package/dist/runtime/modules/world/content/suzhouGarden/src/buildings.js +0 -670
- package/dist/runtime/modules/world/content/suzhouGarden/src/core.js +0 -578
- package/dist/runtime/modules/world/content/suzhouGarden/src/lod.js +0 -127
- package/dist/runtime/modules/world/content/suzhouGarden/src/main.js +0 -642
- package/dist/runtime/modules/world/content/suzhouGarden/src/nature.js +0 -650
- package/dist/runtime/modules/world/content/suzhouGarden/src/rockery.js +0 -280
- package/dist/runtime/modules/world/content/suzhouGarden/src/sky.js +0 -242
- package/dist/runtime/modules/world/content/suzhouGarden/src/water.js +0 -215
- package/dist/runtime/modules/world/content/woodlandWorkshop.js +0 -192
- package/dist/runtime/modules/world/content/yuanmingyuan/README.md +0 -36
- package/dist/runtime/modules/world/content/yuanmingyuan/arch.js +0 -351
- package/dist/runtime/modules/world/content/yuanmingyuan/buildings.js +0 -490
- package/dist/runtime/modules/world/content/yuanmingyuan/core.js +0 -505
- package/dist/runtime/modules/world/content/yuanmingyuan/index.js +0 -101
- package/dist/runtime/modules/world/content/yuanmingyuan/nature.js +0 -435
- package/dist/runtime/modules/world/content/yuanmingyuan/sky.js +0 -169
- package/dist/runtime/modules/world/content/yuanmingyuan/water.js +0 -245
- package/dist/runtime/modules/world/errors.js +0 -9
- package/dist/runtime/modules/world/generated/GeneratedWorldCoordinates.js +0 -50
- package/dist/runtime/modules/world/generated/GeneratedWorldLoader.js +0 -297
- package/dist/runtime/modules/world/runtime/CommandHistory.js +0 -80
- package/dist/runtime/modules/world/runtime/ObjectStore.js +0 -31
- package/dist/runtime/modules/world/runtime/ObjectTransform.js +0 -62
- package/dist/runtime/modules/world/runtime/ObservedEntity.js +0 -37
- package/dist/runtime/modules/world/runtime/ProjectCapabilities.js +0 -207
- package/dist/runtime/modules/world/runtime/SceneSerializer.js +0 -246
- package/dist/runtime/modules/world/runtime/WorldAuthority.js +0 -41
- package/dist/runtime/modules/world/runtime/WorldCollisionSignature.js +0 -14
- package/dist/runtime/modules/world/runtime/WorldCommands.js +0 -502
- package/dist/runtime/modules/world/runtime/WorldObservation.js +0 -71
- package/dist/runtime/modules/world/runtime/WorldQueries.js +0 -340
- package/dist/runtime/modules/world/runtime/WorldRecovery.js +0 -78
- package/dist/runtime/modules/world/runtime/WorldRuntime.js +0 -649
- package/dist/runtime/modules/world/runtime/affordance/ObjectAffordances.js +0 -107
- package/dist/runtime/modules/world/runtime/affordance/WorldAffordances.js +0 -130
- package/dist/runtime/modules/world/runtime/behavior/BehaviorCompiler.js +0 -79
- package/dist/runtime/modules/world/runtime/behavior/ProjectStateMachine.js +0 -195
- package/dist/runtime/modules/world/runtime/behavior/RuleGraph.js +0 -70
- package/dist/runtime/modules/world/runtime/behavior/RuleRuntime.js +0 -115
- package/dist/runtime/modules/world/runtime/graph/SceneGraph.js +0 -216
- package/dist/runtime/modules/world/runtime/interaction/ArticulationRuntime.js +0 -214
- package/dist/runtime/modules/world/runtime/interaction/CarryCapability.js +0 -65
- package/dist/runtime/modules/world/runtime/interaction/CarryRuntime.js +0 -222
- package/dist/runtime/modules/world/runtime/interaction/InteractionApproach.js +0 -130
- package/dist/runtime/modules/world/runtime/interaction/InteractionContract.js +0 -57
- package/dist/runtime/modules/world/runtime/interaction/RecoveryRuntime.js +0 -123
- package/dist/runtime/modules/world/runtime/interaction/SettleRuntime.js +0 -120
- package/dist/runtime/modules/world/runtime/semantic/SemanticWorldView.js +0 -102
- package/dist/runtime/modules/world/runtime/simulation/SimulationClock.js +0 -89
- package/dist/runtime/modules/world/runtime/simulation/SimulationSession.js +0 -99
- package/dist/runtime/modules/world/runtime/simulation/ThermalSystem.js +0 -269
- package/dist/runtime/modules/world/runtime/spatial/SpatialSnapshot.js +0 -56
- package/dist/runtime/modules/world/runtime/spatial/ThreeBvhRuntime.js +0 -36
- package/dist/runtime/modules/world/runtime/systems/InteractionSystem.js +0 -728
- package/dist/runtime/modules/world/runtime/systems/LocomotionSystem.js +0 -269
- package/dist/runtime/modules/world/runtime/systems/NavigationSystem.js +0 -469
- package/dist/runtime/modules/world/runtime/systems/PhysicsSystem.js +0 -1657
- package/dist/runtime/modules/world/runtime/systems/RenderingSystem.js +0 -457
- package/dist/runtime/modules/world/runtime/systems/SpatialSystem.js +0 -284
- package/dist/runtime/modules/world/spec/WorldIR.js +0 -165
- package/dist/runtime/modules/world/spec/WorldIRToolSchema.js +0 -86
- package/dist/runtime/modules/world/spec/WorldPlannerProposal.js +0 -51
- package/dist/runtime/modules/world/spec/WorldRevision.js +0 -231
- package/dist/runtime/modules/world/spec/WorldSpec.js +0 -86
- package/dist/runtime/modules/world/tasks.jsonl +0 -530
- package/dist/runtime/modules/world/verification/ArticulationVerifier.js +0 -254
- package/dist/runtime/modules/world/verification/Finding.js +0 -105
- package/dist/runtime/modules/world/verification/InteractionEvidence.js +0 -69
- package/dist/runtime/modules/world/verification/RepairEngine.js +0 -49
- package/dist/runtime/modules/world/verification/WorldAcceptance.js +0 -158
- package/dist/runtime/modules/world/verification/WorldValidator.js +0 -65
- package/dist/runtime/package-lock.json +0 -6245
- package/dist/runtime/package.json +0 -91
- package/dist/runtime/public/assets/cabinet.glb +0 -0
- package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_diff_1k.jpg +0 -0
- package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_nor_gl_1k.jpg +0 -0
- package/dist/runtime/public/assets/grand-urban-block/concrete_pavement_diff_1k.jpg +0 -0
- package/dist/runtime/public/assets/grand-urban-block/urban_street_01_1k.hdr +0 -0
- package/dist/runtime/public/assets/monument-hall/marble_diff_1k.jpg +0 -0
- package/dist/runtime/public/assets/monument-hall/marble_nor_gl_1k.jpg +0 -0
- package/dist/runtime/public/assets/monument-hall/marble_rough_1k.jpg +0 -0
- package/dist/runtime/public/assets/monument-hall/solitude_interior_1k.hdr +0 -0
- package/dist/runtime/public/assets/ruined-courtyard/courtyard_1k.hdr +0 -0
- package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_diff_1k.jpg +0 -0
- package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_nor_gl_1k.jpg +0 -0
- package/dist/runtime/public/assets/ruined-courtyard/mossy_sandstone_diff_1k.jpg +0 -0
- package/dist/schema-Dudvovhu.js +0 -364
- package/dist/schema-Dudvovhu.js.map +0 -1
- package/dist/suzhouGarden-BCx_JeV5.js +0 -6159
- package/dist/suzhouGarden-BCx_JeV5.js.map +0 -1
- package/dist/woodlandWorkshop-BGNWPNdK.js +0 -484
- package/dist/woodlandWorkshop-BGNWPNdK.js.map +0 -1
- package/dist/yuanmingyuan-DAIb1msO.js +0 -4962
- package/dist/yuanmingyuan-DAIb1msO.js.map +0 -1
|
@@ -1,670 +0,0 @@
|
|
|
1
|
-
/* 吴苑澄观 · 建筑与景区组装
|
|
2
|
-
* 前朝 190 m 礼序中轴 + 后苑「一池三山」九个园中园景区;
|
|
3
|
-
* 含厅、堂、楼、阁、亭(四角/六角/扇面)、榭、舫、廊(水廊/曲廊/爬山廊)、
|
|
4
|
-
* 桥(九曲/拱桥/廊桥)、门楼、云墙、漏窗、月洞门与园外借景北寺塔。
|
|
5
|
-
*/
|
|
6
|
-
import * as THREE from 'three';
|
|
7
|
-
import {
|
|
8
|
-
boxGeo, transform, tube, lathe, extrudePolygon, clamp, mulberry32, rr,
|
|
9
|
-
WORLD, waterSDF, terrainHeight,
|
|
10
|
-
} from './core.js';
|
|
11
|
-
import {
|
|
12
|
-
put, roofGeo, addHipRoof, addPyramidRoof, addColumn, addDougong, addGeWindow,
|
|
13
|
-
addGualuo, addRailing, addWall, addLeakWindowCore, addMoonGate, addBrickGate,
|
|
14
|
-
addPavingPatch, addLantern, makePlaque, addStoneLantern,
|
|
15
|
-
} from './arch.js';
|
|
16
|
-
|
|
17
|
-
const P = (ctx, geo, mat, pos, rot = [0, 0, 0], lod = 0, opts = {}) => put(ctx.B, geo, mat, pos, rot, lod, opts);
|
|
18
|
-
|
|
19
|
-
function plaque(ctx, text, pos, rotY = 0, w = 2.8, h = 0.72, maxLevel = 1) {
|
|
20
|
-
const m = makePlaque(text, w, h);
|
|
21
|
-
m.position.set(pos[0], pos[1], pos[2]);
|
|
22
|
-
m.rotation.y = rotY;
|
|
23
|
-
ctx.scene.add(m);
|
|
24
|
-
ctx.plaques.push(m);
|
|
25
|
-
if (ctx.lod) ctx.lod.addDetail(m, pos, 0.5, maxLevel);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/* ------------------------------------------------------------------ *
|
|
29
|
-
* 建筑原型
|
|
30
|
-
* ------------------------------------------------------------------ */
|
|
31
|
-
/** 厅堂:台基 + 柱列 + 粉墙 + 格扇 + 斗拱挂落 + 歇山/卷棚顶 + 月台 */
|
|
32
|
-
function hall(ctx, o) {
|
|
33
|
-
const { B, M } = ctx;
|
|
34
|
-
const x = o.x, z = o.z, w = o.w, d = o.d;
|
|
35
|
-
const base = o.base ?? 0.86, colH = o.colH ?? 5.6, eaveY = base + colH;
|
|
36
|
-
const rot = o.rot ?? 0, face = o.face ?? -1; // face=-1 正面朝北(-Z)
|
|
37
|
-
const bays = o.bays ?? 5;
|
|
38
|
-
const cs = Math.cos(rot), sn = Math.sin(rot);
|
|
39
|
-
const G = (g, m, px, py, pz, L = 0, r2 = [0, 0, 0], op = {}) =>
|
|
40
|
-
P(ctx, g, m, [x + px * cs + pz * sn, py, z - px * sn + pz * cs], [r2[0], rot + r2[1], r2[2]], L, op);
|
|
41
|
-
|
|
42
|
-
// 台基与踏跺
|
|
43
|
-
G(boxGeo(w + 1.6, base, d + 1.6, 0.4), M.stone, 0, base / 2, 0);
|
|
44
|
-
G(boxGeo(w + 1.9, 0.12, d + 1.9, 0.4), M.stoneDark, 0, base - 0.04, 0);
|
|
45
|
-
G(boxGeo(w + 2.2, 0.10, d + 2.2, 0.4), M.graybrick, 0, 0.05, 0);
|
|
46
|
-
const steps = 4;
|
|
47
|
-
for (let s = 0; s < steps; s++) {
|
|
48
|
-
G(boxGeo(o.stairW ?? 5.2, 0.16, 0.52), M.stone,
|
|
49
|
-
0, base - (s + 0.5) * base / steps, -face * (d / 2 + 0.85 + s * 0.5));
|
|
50
|
-
}
|
|
51
|
-
// 柱列(前后檐 + 山面)
|
|
52
|
-
const xs = [], zs = [-d / 2, d / 2];
|
|
53
|
-
for (let i = 0; i <= bays; i++) xs.push(-w / 2 + i * w / bays);
|
|
54
|
-
const colAt = (px, pz, r = 0.17) => {
|
|
55
|
-
G(new THREE.CylinderGeometry(r * 0.92, r, colH, 10), M.wood, px, base + colH / 2, pz);
|
|
56
|
-
G(new THREE.CylinderGeometry(r * 1.42, r * 1.55, 0.12, 10), M.stone, px, base + 0.06, pz);
|
|
57
|
-
G(new THREE.CylinderGeometry(r * 1.18, r * 1.05, 0.10, 10), M.darkWood, px, eaveY - 0.05, pz, 1);
|
|
58
|
-
};
|
|
59
|
-
for (const px of xs) for (const pz of zs) colAt(px, pz);
|
|
60
|
-
for (const pz of [-d / 4, d / 4]) for (const px of [-w / 2, w / 2]) colAt(px, pz, 0.15);
|
|
61
|
-
// 檐枋(四周)
|
|
62
|
-
G(boxGeo(w + 0.5, 0.28, 0.24), M.wood, 0, eaveY - 0.22, -d / 2);
|
|
63
|
-
G(boxGeo(w + 0.5, 0.28, 0.24), M.wood, 0, eaveY - 0.22, d / 2);
|
|
64
|
-
G(boxGeo(0.24, 0.28, d + 0.4), M.wood, -w / 2, eaveY - 0.22, 0);
|
|
65
|
-
G(boxGeo(0.24, 0.28, d + 0.4), M.wood, w / 2, eaveY - 0.22, 0);
|
|
66
|
-
// 斗拱(L0 细节)
|
|
67
|
-
if (o.dougong !== false) {
|
|
68
|
-
for (const px of xs) for (const pz of zs) {
|
|
69
|
-
const wx = x + px * cs + pz * sn, wz = z - px * sn + pz * cs;
|
|
70
|
-
addDougong(B, M, wx, eaveY - 0.16, wz, 1, 1);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
// 墙体:两山墙 + 背立面
|
|
74
|
-
G(boxGeo(0.30, colH - 0.3, d - 0.5), M.plaster, -w / 2, base + (colH - 0.3) / 2, 0);
|
|
75
|
-
G(boxGeo(0.30, colH - 0.3, d - 0.5), M.plaster, w / 2, base + (colH - 0.3) / 2, 0);
|
|
76
|
-
G(boxGeo(w - 0.4, colH - 0.3, 0.30), M.plaster, 0, base + (colH - 0.3) / 2, -face * d / 2);
|
|
77
|
-
// 背立面方窗
|
|
78
|
-
for (let i = 1; i < bays; i += 2) {
|
|
79
|
-
const px = -w / 2 + i * w / bays;
|
|
80
|
-
G(boxGeo(1.5, 1.6, 0.12), M.darkWood, px, base + colH * 0.55, -face * d / 2 - 0.02, 2);
|
|
81
|
-
G(boxGeo(1.35, 1.45, 0.06), M.paper, px, base + colH * 0.55, -face * d / 2 - 0.09, 2);
|
|
82
|
-
}
|
|
83
|
-
// 正面整排格扇长窗
|
|
84
|
-
if (o.windows !== false) {
|
|
85
|
-
for (let i = 0; i < bays; i++) {
|
|
86
|
-
const px = -w / 2 + (i + 0.5) * w / bays;
|
|
87
|
-
const wx = x + px * cs + (face * d / 2) * sn;
|
|
88
|
-
const wz = z - px * sn + (face * d / 2) * cs;
|
|
89
|
-
addGeWindow(B, M, {
|
|
90
|
-
x: wx, y: base + colH * 0.50, z: wz,
|
|
91
|
-
w: w / bays - 0.22, h: colH - 0.55, rot,
|
|
92
|
-
pattern: i % 3 === 0 ? 'binglie' : 'jin',
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
// 挂落
|
|
96
|
-
for (let i = 0; i < bays; i++) {
|
|
97
|
-
const px = -w / 2 + (i + 0.5) * w / bays;
|
|
98
|
-
const wx = x + px * cs + (face * d / 2) * sn;
|
|
99
|
-
const wz = z - px * sn + (face * d / 2) * cs;
|
|
100
|
-
addGualuo(B, M, wx, eaveY - 0.52, wz, w / bays - 0.2, rot, 1);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
// 屋顶
|
|
104
|
-
addHipRoof(B, M, {
|
|
105
|
-
cx: x, cz: z, w: w + 1.8, d: d + 1.8, eaveY, rise: o.rise ?? 3.2,
|
|
106
|
-
lift: o.lift ?? 0.70, type: o.type ?? 'xieshan', rot,
|
|
107
|
-
tileMat: o.tileMat || M.tile, nx: o.nx ?? 44, nz: o.nz ?? 28,
|
|
108
|
-
});
|
|
109
|
-
// 匾额与灯笼
|
|
110
|
-
if (o.name) {
|
|
111
|
-
const pz = face * (d / 2 + 0.36);
|
|
112
|
-
plaque(ctx, o.name, [x + pz * sn, eaveY - 0.72, z + pz * cs],
|
|
113
|
-
rot + (face === -1 ? Math.PI : 0), o.plaqueW ?? 2.8, 0.72);
|
|
114
|
-
}
|
|
115
|
-
for (const s of [-1, 1]) {
|
|
116
|
-
const px = s * (w / 2 - 0.8), pz = face * (d / 2 + 0.25);
|
|
117
|
-
addLantern(B, M, x + px * cs + pz * sn, eaveY - 0.72, z - px * sn + pz * cs, 0.9, 1);
|
|
118
|
-
}
|
|
119
|
-
// 月台 / 临水平台
|
|
120
|
-
if (o.terrace) {
|
|
121
|
-
const tz = face * (d / 2 + o.terrace.d / 2 + 0.2);
|
|
122
|
-
G(boxGeo(w + 2.4, 0.24, o.terrace.d, 0.4), M.stone, 0, base - 0.02, tz);
|
|
123
|
-
G(boxGeo(w + 2.4, 0.10, o.terrace.d + 0.2, 0.4), M.paving, 0, base + 0.14, tz, 1);
|
|
124
|
-
const wx1 = x + (-w / 2) * cs + (face * (d / 2 + o.terrace.d)) * sn;
|
|
125
|
-
const wz1 = z - (-w / 2) * sn + (face * (d / 2 + o.terrace.d)) * cs;
|
|
126
|
-
const wx2 = x + (w / 2) * cs + (face * (d / 2 + o.terrace.d)) * sn;
|
|
127
|
-
const wz2 = z - (w / 2) * sn + (face * (d / 2 + o.terrace.d)) * cs;
|
|
128
|
-
addRailing(B, M, { x1: wx1, z1: wz1, x2: wx2, z2: wz2, y: base + 0.14, kind: o.terrace.rail || 'stone' });
|
|
129
|
-
}
|
|
130
|
-
return { x, z, w, d, eaveY, rot, face };
|
|
131
|
-
}
|
|
132
|
-
/** 两层楼阁(见山楼):一层厅 + 二层四周外廊 + 歇山顶 */
|
|
133
|
-
function twoStorey(ctx, o) {
|
|
134
|
-
const { B, M } = ctx;
|
|
135
|
-
const { x, z } = o, rot = o.rot ?? 0, face = o.face ?? -1;
|
|
136
|
-
const w1 = o.w, d1 = o.d, base = 0.9, h1 = o.h1 ?? 5.4, e1 = base + h1;
|
|
137
|
-
const w2 = w1 - 3.2, d2 = d1 - 2.4, h2 = o.h2 ?? 4.2, e2 = e1 + h2;
|
|
138
|
-
const cs = Math.cos(rot), sn = Math.sin(rot);
|
|
139
|
-
const G = (g, m, px, py, pz, L = 0, r2 = [0, 0, 0]) =>
|
|
140
|
-
P(ctx, g, m, [x + px * cs + pz * sn, py, z - px * sn + pz * cs], [r2[0], rot + r2[1], r2[2]], L);
|
|
141
|
-
// 一层
|
|
142
|
-
G(boxGeo(w1 + 1.8, base, d1 + 1.8), M.stone, 0, base / 2, 0);
|
|
143
|
-
G(boxGeo(w1, h1, d1), M.plaster, 0, base + h1 / 2, 0);
|
|
144
|
-
G(boxGeo(w1 + 0.6, 0.30, d1 + 0.6), M.wood, 0, e1 - 0.18, 0);
|
|
145
|
-
for (let i = 0; i <= 5; i++) {
|
|
146
|
-
const px = -w1 / 2 + i * w1 / 5;
|
|
147
|
-
for (const pz of [-d1 / 2, d1 / 2]) addColumn(B, M, x + px * cs + pz * sn, base, z - px * sn + pz * cs, h1, 0.17, M.wood, 0);
|
|
148
|
-
}
|
|
149
|
-
// 一层腰檐(四面披檐)
|
|
150
|
-
G(roofGeo(w1 / 2 + 1.15, d1 / 2 + 1.15, 0, 1.35, { lift: 0.42, eave: 0.5, nx: 40, nz: 26 }), M.tile, 0, e1 - 0.15, 0);
|
|
151
|
-
// 二层
|
|
152
|
-
G(boxGeo(w2, h2, d2), M.plaster, 0, e1 + h2 / 2, 0);
|
|
153
|
-
G(boxGeo(w2 + 0.5, 0.28, d2 + 0.5), M.wood, 0, e2 - 0.18, 0);
|
|
154
|
-
for (let i = 0; i <= 4; i++) {
|
|
155
|
-
const px = -w2 / 2 + i * w2 / 4;
|
|
156
|
-
for (const pz of [-d2 / 2, d2 / 2]) addColumn(B, M, x + px * cs + pz * sn, e1, z - px * sn + pz * cs, h2, 0.15, M.wood, 0);
|
|
157
|
-
addGeWindow(B, M, {
|
|
158
|
-
x: x + px * cs + (-d2 / 2) * sn, y: e1 + h2 * 0.52, z: z - px * sn + (-d2 / 2) * cs,
|
|
159
|
-
w: w2 / 4 - 0.24, h: h2 - 0.6, rot, pattern: 'jin',
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
// 二层外廊与栏杆(制高点俯瞰站位点)
|
|
163
|
-
G(boxGeo(w1 + 1.4, 0.18, d1 + 1.4), M.woodPale, 0, e1 + 0.06, 0);
|
|
164
|
-
const railY = e1 + 0.16;
|
|
165
|
-
for (const [a, b, c, e] of [
|
|
166
|
-
[-w1 / 2 - 0.6, -d1 / 2 - 0.6, w1 / 2 + 0.6, -d1 / 2 - 0.6],
|
|
167
|
-
[-w1 / 2 - 0.6, d1 / 2 + 0.6, w1 / 2 + 0.6, d1 / 2 + 0.6],
|
|
168
|
-
[-w1 / 2 - 0.6, -d1 / 2 - 0.6, -w1 / 2 - 0.6, d1 / 2 + 0.6],
|
|
169
|
-
[w1 / 2 + 0.6, -d1 / 2 - 0.6, w1 / 2 + 0.6, d1 / 2 + 0.6],
|
|
170
|
-
]) {
|
|
171
|
-
addRailing(B, M, {
|
|
172
|
-
x1: x + a * cs + b * sn, z1: z - a * sn + b * cs,
|
|
173
|
-
x2: x + c * cs + e * sn, z2: z - c * sn + e * cs, y: railY, kind: 'mei',
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
// 屋顶
|
|
177
|
-
addHipRoof(B, M, { cx: x, cz: z, w: w2 + 2.2, d: d2 + 2.2, eaveY: e2, rise: o.rise ?? 3.0, lift: 0.66, type: 'xieshan', rot });
|
|
178
|
-
plaque(ctx, o.name || '见山楼',
|
|
179
|
-
[x + (face * (d2 / 2 + 0.4)) * sn, e2 - 0.74, z + (face * (d2 / 2 + 0.4)) * cs],
|
|
180
|
-
rot + (face === -1 ? Math.PI : 0), 3.0, 0.78);
|
|
181
|
-
for (const s of [-1, 1]) {
|
|
182
|
-
const px = s * (w2 / 2 - 0.5), pz = face * (d2 / 2 + 0.2);
|
|
183
|
-
addLantern(B, M, x + px * cs + pz * sn, e2 - 0.7, z - px * sn + pz * cs, 0.85, 1);
|
|
184
|
-
}
|
|
185
|
-
return { e1, e2 };
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/** 亭:四角 / 六角 / 八角攒尖,可带坐凳与美人靠 */
|
|
189
|
-
function pavilion(ctx, o) {
|
|
190
|
-
const { B, M } = ctx;
|
|
191
|
-
const { x, z } = o, sides = o.sides ?? 4, r = o.r ?? 3.2;
|
|
192
|
-
const base = o.base ?? 0.45, colH = o.colH ?? 3.4, eaveY = base + colH;
|
|
193
|
-
const rot = o.rot ?? 0;
|
|
194
|
-
// 台基
|
|
195
|
-
P(ctx, new THREE.CylinderGeometry(r + 0.45, r + 0.55, base, sides === 4 ? 8 : sides), M.stone, [x, base / 2, z], [0, rot, 0]);
|
|
196
|
-
P(ctx, new THREE.CylinderGeometry(r + 0.30, r + 0.36, 0.10, sides === 4 ? 8 : sides), M.stoneDark, [x, base + 0.02, z], [0, rot, 0]);
|
|
197
|
-
// 柱
|
|
198
|
-
for (let i = 0; i < sides; i++) {
|
|
199
|
-
const a = rot + Math.PI / sides + i * Math.PI * 2 / sides;
|
|
200
|
-
addColumn(B, M, x + Math.cos(a) * r * 0.86, base, z + Math.sin(a) * r * 0.86, colH, 0.14, o.woodMat || M.wood, 0);
|
|
201
|
-
}
|
|
202
|
-
// 檐枋 + 斗拱 + 挂落
|
|
203
|
-
for (let i = 0; i < sides; i++) {
|
|
204
|
-
const a0 = rot + Math.PI / sides + i * Math.PI * 2 / sides;
|
|
205
|
-
const a1 = rot + Math.PI / sides + (i + 1) * Math.PI * 2 / sides;
|
|
206
|
-
const p0 = [x + Math.cos(a0) * r * 0.86, z + Math.sin(a0) * r * 0.86];
|
|
207
|
-
const p1 = [x + Math.cos(a1) * r * 0.86, z + Math.sin(a1) * r * 0.86];
|
|
208
|
-
const mx = (p0[0] + p1[0]) / 2, mz = (p0[1] + p1[1]) / 2;
|
|
209
|
-
const len = Math.hypot(p1[0] - p0[0], p1[1] - p0[1]);
|
|
210
|
-
const ang = -Math.atan2(p1[1] - p0[1], p1[0] - p0[0]);
|
|
211
|
-
P(ctx, boxGeo(len, 0.24, 0.20), M.wood, [mx, eaveY - 0.20, mz], [0, ang, 0]);
|
|
212
|
-
addGualuo(B, M, mx, eaveY - 0.48, mz, len - 0.25, ang, 1);
|
|
213
|
-
if (o.rail !== false && i < sides) {
|
|
214
|
-
addRailing(B, M, {
|
|
215
|
-
x1: p0[0], z1: p0[1], x2: p1[0], z2: p1[1], y: base + 0.06,
|
|
216
|
-
kind: 'mei', segments: 3,
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
addDougong(B, M, p0[0], eaveY - 0.12, p0[1], 0.78, 1);
|
|
220
|
-
}
|
|
221
|
-
addPyramidRoof(B, M, { cx: x, cy: eaveY, cz: z, r: r + 0.9, rise: o.rise ?? r * 0.82, lift: o.lift ?? 0.55, sides, rot, rings: 8, steps: 8 });
|
|
222
|
-
if (o.name) {
|
|
223
|
-
const off = r * 0.88;
|
|
224
|
-
plaque(ctx, o.name, [x + Math.sin(rot) * off, eaveY - 0.62, z + Math.cos(rot) * off], rot, 1.9, 0.52);
|
|
225
|
-
}
|
|
226
|
-
return { eaveY };
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/** 水榭:临水低台基 + 卷棚歇山 + 美人靠 */
|
|
230
|
-
function watersideXie(ctx, o) {
|
|
231
|
-
const h = hall(ctx, {
|
|
232
|
-
x: o.x, z: o.z, w: o.w ?? 12, d: o.d ?? 6.4, base: 0.42, colH: 3.7,
|
|
233
|
-
rise: 1.85, lift: 0.42, bays: 3, rot: o.rot ?? 0, face: o.face ?? -1,
|
|
234
|
-
name: o.name, type: 'xieshan', dougong: false, windows: true,
|
|
235
|
-
terrace: { d: 2.6, rail: 'mei' }, nx: 32, nz: 20,
|
|
236
|
-
});
|
|
237
|
-
return h;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/** 石舫「不系舟」:船身石台 + 前舱 / 中舱 / 后舱楼 + 卷棚顶 */
|
|
241
|
-
function stoneBoat(ctx, o) {
|
|
242
|
-
const { B, M } = ctx;
|
|
243
|
-
const x = o.x, z = o.z, rot = o.rot ?? 0;
|
|
244
|
-
const cs = Math.cos(rot), sn = Math.sin(rot);
|
|
245
|
-
const G = (g, m, px, py, pz, L = 0, r2 = [0, 0, 0]) =>
|
|
246
|
-
P(ctx, g, m, [x + px * cs + pz * sn, py, z - px * sn + pz * cs], [r2[0], rot + r2[1], r2[2]], L);
|
|
247
|
-
// 船身:前窄后宽的花岗岩船体
|
|
248
|
-
const hull = extrudePolygon([
|
|
249
|
-
[-9.0, -1.5], [-7.4, -2.35], [5.6, -2.35], [8.8, -1.15],
|
|
250
|
-
[9.4, 0], [8.8, 1.15], [5.6, 2.35], [-7.4, 2.35], [-9.0, 1.5],
|
|
251
|
-
], 0.72);
|
|
252
|
-
G(hull, M.stone, 0, -0.28, 0, 0, [-Math.PI / 2, 0, 0]);
|
|
253
|
-
G(boxGeo(16.5, 0.18, 4.6), M.woodPale, 0, 0.52, 0);
|
|
254
|
-
// 船首石雕与缆桩
|
|
255
|
-
for (const s of [-1, 1]) {
|
|
256
|
-
G(new THREE.CylinderGeometry(0.16, 0.20, 0.85, 8), M.stoneDark, 7.2, 0.85, s * 1.55, 1);
|
|
257
|
-
G(new THREE.SphereGeometry(0.20, 8, 6), M.stoneDark, 7.2, 1.30, s * 1.55, 1);
|
|
258
|
-
}
|
|
259
|
-
// 中舱(低)
|
|
260
|
-
G(boxGeo(7.6, 2.6, 3.8), M.plaster, -0.6, 1.9, 0);
|
|
261
|
-
for (let i = 0; i < 4; i++) {
|
|
262
|
-
G(boxGeo(1.45, 1.7, 0.08), M.darkWood, -3.5 + i * 1.9, 2.0, 1.92, 2);
|
|
263
|
-
G(boxGeo(1.32, 1.55, 0.05), M.paper, -3.5 + i * 1.9, 2.0, 1.97, 2);
|
|
264
|
-
}
|
|
265
|
-
G(roofGeo(4.7, 2.5, 0, 1.25, { lift: 0.34, eave: 0.5, nx: 32, nz: 20 }), M.tile, -0.6, 3.25, 0, 0, [0, 0, 0]);
|
|
266
|
-
// 后舱楼(高)
|
|
267
|
-
G(boxGeo(5.2, 3.3, 3.9), M.plaster, 5.0, 2.25, 0);
|
|
268
|
-
G(roofGeo(3.3, 2.5, 0, 1.55, { lift: 0.40, eave: 0.5, nx: 28, nz: 18 }), M.tile, 5.0, 3.92, 0);
|
|
269
|
-
for (let i = 0; i < 3; i++) {
|
|
270
|
-
G(boxGeo(1.25, 1.9, 0.08), M.darkWood, 3.6 + i * 1.45, 2.35, 1.98, 2);
|
|
271
|
-
G(boxGeo(1.12, 1.75, 0.05), M.paper, 3.6 + i * 1.45, 2.35, 2.03, 2);
|
|
272
|
-
}
|
|
273
|
-
// 舷侧美人靠
|
|
274
|
-
for (const s of [-1, 1]) {
|
|
275
|
-
addRailing(B, M, {
|
|
276
|
-
x1: x + (-6.5) * cs + (s * 2.1) * sn, z1: z - (-6.5) * sn + (s * 2.1) * cs,
|
|
277
|
-
x2: x + (2.6) * cs + (s * 2.1) * sn, z2: z - (2.6) * sn + (s * 2.1) * cs,
|
|
278
|
-
y: 0.62, kind: 'mei',
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
plaque(ctx, o.name || '不系舟', [x + 0 * cs + 2.02 * sn, 2.9, z + 2.02 * cs], rot, 1.9, 0.55);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/** 廊:沿折线生成柱列、铺地、卷棚屋面、挂落与美人靠 */
|
|
285
|
-
function corridor(ctx, points, o = {}) {
|
|
286
|
-
const { B, M } = ctx;
|
|
287
|
-
const width = o.width ?? 2.5, colH = o.colH ?? 2.9, rise = o.rise ?? 0.85;
|
|
288
|
-
for (let s = 0; s < points.length - 1; s++) {
|
|
289
|
-
const [x1, z1] = points[s], [x2, z2] = points[s + 1];
|
|
290
|
-
const dx = x2 - x1, dz = z2 - z1, len = Math.hypot(dx, dz);
|
|
291
|
-
if (len < 0.5) continue;
|
|
292
|
-
const a = Math.atan2(dz, dx), rot = -a;
|
|
293
|
-
const mx = (x1 + x2) / 2, mz = (z1 + z2) / 2;
|
|
294
|
-
const y0 = o.y0 ?? 0.18;
|
|
295
|
-
P(ctx, boxGeo(len + 0.2, 0.14, width + 0.3, 0.45), M.paving, [mx, y0, mz], [0, rot, 0], 0, { noShadow: true });
|
|
296
|
-
P(ctx, boxGeo(len + 0.2, 0.22, width + 0.5), M.graybrick, [mx, y0 - 0.12, mz], [0, rot, 0]);
|
|
297
|
-
// 柱
|
|
298
|
-
const n = Math.max(2, Math.round(len / 2.8));
|
|
299
|
-
for (let i = 0; i <= n; i++) {
|
|
300
|
-
const t = i / n;
|
|
301
|
-
const px = x1 + dx * t, pz = z1 + dz * t;
|
|
302
|
-
for (const side of [-1, 1]) {
|
|
303
|
-
const wx = px - Math.sin(a) * side * width / 2, wz = pz + Math.cos(a) * side * width / 2;
|
|
304
|
-
P(ctx, new THREE.CylinderGeometry(0.11, 0.12, colH, 8), M.wood, [wx, y0 + colH / 2, wz]);
|
|
305
|
-
P(ctx, new THREE.CylinderGeometry(0.19, 0.21, 0.10, 8), M.stone, [wx, y0 + 0.05, wz]);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
P(ctx, boxGeo(len, 0.20, 0.16), M.wood, [mx, y0 + colH - 0.14, mz - Math.cos(a) * width / 2], [0, rot, 0]);
|
|
309
|
-
P(ctx, boxGeo(len, 0.20, 0.16), M.wood, [mx, y0 + colH - 0.14, mz + Math.cos(a) * width / 2], [0, rot, 0]);
|
|
310
|
-
// 美人靠(单侧或双侧)
|
|
311
|
-
const sideList = o.bothRails === false ? [1] : [-1, 1];
|
|
312
|
-
for (const side of sideList) {
|
|
313
|
-
addRailing(B, M, {
|
|
314
|
-
x1: x1 - Math.sin(a) * side * width / 2, z1: z1 + Math.cos(a) * side * width / 2,
|
|
315
|
-
x2: x2 - Math.sin(a) * side * width / 2, z2: z2 + Math.cos(a) * side * width / 2,
|
|
316
|
-
y: y0, kind: 'mei',
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
// 挂落
|
|
320
|
-
for (const side of [-1, 1]) {
|
|
321
|
-
const wx = mx - Math.sin(a) * side * width / 2, wz = mz + Math.cos(a) * side * width / 2;
|
|
322
|
-
addGualuo(B, M, wx, y0 + colH - 0.48, wz, len - 0.2, rot, 1);
|
|
323
|
-
}
|
|
324
|
-
// 卷棚小屋顶
|
|
325
|
-
addHipRoof(B, M, {
|
|
326
|
-
cx: mx, cz: mz, w: len + 0.7, d: width + 0.8, eaveY: y0 + colH,
|
|
327
|
-
rise, lift: 0.22, eave: 0.45, type: 'juanpeng', rot,
|
|
328
|
-
nx: Math.max(12, Math.round(len * 1.4)), nz: 12,
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
/** 九折石桥 */
|
|
334
|
-
function zigzagBridge(ctx, points, o = {}) {
|
|
335
|
-
const { B, M } = ctx;
|
|
336
|
-
const y = o.y ?? 0.38, width = o.width ?? 1.9;
|
|
337
|
-
for (let s = 0; s < points.length - 1; s++) {
|
|
338
|
-
const [x1, z1] = points[s], [x2, z2] = points[s + 1];
|
|
339
|
-
const dx = x2 - x1, dz = z2 - z1, len = Math.hypot(dx, dz);
|
|
340
|
-
const a = Math.atan2(dz, dx), rot = -a;
|
|
341
|
-
const mx = (x1 + x2) / 2, mz = (z1 + z2) / 2;
|
|
342
|
-
P(ctx, boxGeo(len + 0.25, 0.20, width), M.stone, [mx, y, mz], [0, rot, 0]);
|
|
343
|
-
P(ctx, boxGeo(len + 0.25, 0.06, width - 0.16), M.stoneDark, [mx, y + 0.13, mz], [0, rot, 0], 1);
|
|
344
|
-
for (const side of [-1, 1]) {
|
|
345
|
-
addRailing(B, M, {
|
|
346
|
-
x1: x1 - Math.sin(a) * side * width / 2, z1: z1 + Math.cos(a) * side * width / 2,
|
|
347
|
-
x2: x2 - Math.sin(a) * side * width / 2, z2: z2 + Math.cos(a) * side * width / 2,
|
|
348
|
-
y: y + 0.10, kind: 'stone', segments: Math.max(2, Math.round(len / 1.6)),
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
// 桥墩
|
|
352
|
-
for (const t of [0.15, 0.85]) {
|
|
353
|
-
P(ctx, new THREE.CylinderGeometry(0.26, 0.32, y + 0.9, 8), M.stoneDark,
|
|
354
|
-
[x1 + dx * t, (y - 0.9) / 2, z1 + dz * t]);
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
/** 拱桥(半圆券 + 弧面桥身) */
|
|
360
|
-
function archBridge(ctx, o) {
|
|
361
|
-
const { B, M } = ctx;
|
|
362
|
-
const { x, z, len = 12, w = 2.8, rot = 0, rise = 2.0 } = o;
|
|
363
|
-
const cs = Math.cos(rot), sn = Math.sin(rot);
|
|
364
|
-
const G = (g, m, px, py, pz, L = 0, r2 = [0, 0, 0]) =>
|
|
365
|
-
P(ctx, g, m, [x + px * cs + pz * sn, py, z - px * sn + pz * cs], [r2[0], rot + r2[1], r2[2]], L);
|
|
366
|
-
// 桥券(半圆拱石)
|
|
367
|
-
const N = 16;
|
|
368
|
-
for (let i = 0; i < N; i++) {
|
|
369
|
-
const a0 = Math.PI * i / N, a1 = Math.PI * (i + 1) / N;
|
|
370
|
-
const px = ((a0 + a1) / 2 - Math.PI / 2) / (Math.PI / 2) * (len / 2);
|
|
371
|
-
const py = Math.sin((a0 + a1) / 2) * rise * 0.62;
|
|
372
|
-
G(boxGeo(len / N + 0.12, 0.34, w + 0.3), M.stoneDark, px, py - 0.3, 0, 0, [0, 0, -(a0 + a1) / 2 + Math.PI / 2]);
|
|
373
|
-
}
|
|
374
|
-
// 弧面桥面
|
|
375
|
-
const M2 = 14;
|
|
376
|
-
for (let i = 0; i < M2; i++) {
|
|
377
|
-
const t0 = i / M2, t1 = (i + 1) / M2;
|
|
378
|
-
const p0 = (t0 - 0.5) * len, p1 = (t1 - 0.5) * len;
|
|
379
|
-
const y0 = 0.42 + (1 - Math.pow((t0 - 0.5) * 2, 2)) * rise * 0.55;
|
|
380
|
-
const y1 = 0.42 + (1 - Math.pow((t1 - 0.5) * 2, 2)) * rise * 0.55;
|
|
381
|
-
const seg = boxGeo(Math.hypot(p1 - p0, y1 - y0), 0.20, w);
|
|
382
|
-
G(seg, M.stone, (p0 + p1) / 2, (y0 + y1) / 2, 0, 0, [0, 0, Math.atan2(y1 - y0, p1 - p0)]);
|
|
383
|
-
}
|
|
384
|
-
// 栏杆沿弧线
|
|
385
|
-
for (const side of [-1, 1]) {
|
|
386
|
-
const pts = [];
|
|
387
|
-
for (let i = 0; i <= 8; i++) {
|
|
388
|
-
const t = i / 8;
|
|
389
|
-
pts.push([x + ((t - 0.5) * len) * cs + (side * w / 2) * sn,
|
|
390
|
-
0.55 + (1 - Math.pow((t - 0.5) * 2, 2)) * rise * 0.55,
|
|
391
|
-
z - ((t - 0.5) * len) * sn + (side * w / 2) * cs]);
|
|
392
|
-
}
|
|
393
|
-
P(ctx, tube(pts, 0.075, 20, 6), M.marble, [0, 0, 0], [0, 0, 0], 1);
|
|
394
|
-
for (let i = 0; i <= 6; i++) {
|
|
395
|
-
const t = i / 6;
|
|
396
|
-
G(boxGeo(0.10, 0.72, 0.10), M.marble, (t - 0.5) * len, 0.9 + (1 - Math.pow((t - 0.5) * 2, 2)) * rise * 0.55, side * w / 2, 1);
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
/* ------------------------------------------------------------------ *
|
|
402
|
-
* 园外借景:北寺塔(八角九层,76 m)与远村(LOD 三档)
|
|
403
|
-
* ------------------------------------------------------------------ */
|
|
404
|
-
function buildPagoda(ctx) {
|
|
405
|
-
const { M } = ctx;
|
|
406
|
-
const [tx, tz] = WORLD.borrowPagoda;
|
|
407
|
-
const levels = [new THREE.Group(), new THREE.Group(), new THREE.Group()];
|
|
408
|
-
levels.forEach((g, i) => { g.name = 'borrowPagoda_L' + i; ctx.scene.add(g); });
|
|
409
|
-
|
|
410
|
-
const B0 = [], B1 = [];
|
|
411
|
-
const add = (arr, geo, mat, pos, rot = [0, 0, 0]) =>
|
|
412
|
-
arr.push({ geo, mat, matrix: transform([tx + pos[0], pos[1], tz + pos[2]], rot) });
|
|
413
|
-
const R0 = 7.2, floors = 9, floorH = 7.1;
|
|
414
|
-
// 台基
|
|
415
|
-
for (const arr of [B0, B1]) {
|
|
416
|
-
add(arr, new THREE.CylinderGeometry(R0 + 1.6, R0 + 2.0, 1.2, 8), M.stone, [0, 0.6, 0]);
|
|
417
|
-
add(arr, new THREE.CylinderGeometry(R0 + 1.0, R0 + 1.4, 0.7, 8), M.graybrick, [0, 1.55, 0]);
|
|
418
|
-
}
|
|
419
|
-
for (let f = 0; f < floors; f++) {
|
|
420
|
-
const y = 2.0 + f * floorH;
|
|
421
|
-
const r = R0 - f * 0.50;
|
|
422
|
-
const h = 4.9;
|
|
423
|
-
for (const arr of [B0, B1]) {
|
|
424
|
-
add(arr, new THREE.CylinderGeometry(r, r * 1.03, h, 8), M.plasterWarm, [0, y + h / 2, 0], [0, Math.PI / 8, 0]);
|
|
425
|
-
add(arr, new THREE.CylinderGeometry(r + 0.28, r + 0.28, 0.36, 8), M.wood, [0, y + h - 0.1, 0], [0, Math.PI / 8, 0]);
|
|
426
|
-
// 平座与腰檐
|
|
427
|
-
add(arr, new THREE.CylinderGeometry(r + 1.05, r + 0.8, 0.32, 8), M.graybrick, [0, y + h + 0.12, 0], [0, Math.PI / 8, 0]);
|
|
428
|
-
const roof = require_pyramid(r + 1.5, 1.5, 8);
|
|
429
|
-
add(arr, roof, M.tile, [0, y + h + 0.28, 0]);
|
|
430
|
-
}
|
|
431
|
-
// L0 细节:门窗、平座栏杆、角铃、瓦当
|
|
432
|
-
for (let k = 0; k < 8; k++) {
|
|
433
|
-
const a = Math.PI / 8 + k * Math.PI / 4;
|
|
434
|
-
add(B0, boxGeo(1.05, 2.5, 0.14), M.darkWood, [Math.cos(a) * (r + 0.03), y + 2.7, Math.sin(a) * (r + 0.03)], [0, -a + Math.PI / 2, 0]);
|
|
435
|
-
add(B0, boxGeo(0.9, 2.3, 0.08), M.paper, [Math.cos(a) * (r + 0.12), y + 2.7, Math.sin(a) * (r + 0.12)], [0, -a + Math.PI / 2, 0]);
|
|
436
|
-
add(B0, boxGeo(0.10, 0.95, 0.10), M.marble, [Math.cos(a) * (r + 0.9), y + h + 0.62, Math.sin(a) * (r + 0.9)]);
|
|
437
|
-
add(B0, new THREE.SphereGeometry(0.11, 6, 5), M.gold, [Math.cos(a) * (r + 1.42), y + h + 0.38, Math.sin(a) * (r + 1.42)]);
|
|
438
|
-
}
|
|
439
|
-
add(B0, boxGeo((r + 1.0) * 1.7, 0.09, 0.10), M.marble, [0, y + h + 0.82, 0]);
|
|
440
|
-
}
|
|
441
|
-
// 塔刹
|
|
442
|
-
const topY = 2.0 + floors * floorH;
|
|
443
|
-
for (const arr of [B0, B1]) {
|
|
444
|
-
add(arr, new THREE.CylinderGeometry(1.5, 2.4, 1.1, 8), M.graybrick, [0, topY + 0.5, 0]);
|
|
445
|
-
add(arr, lathe([[0.55, 0], [0.85, 1.0], [0.55, 2.0], [0.95, 3.0], [0.4, 4.0], [0.22, 5.4], [0.05, 6.2]], 12), M.gold, [0, topY + 1.1, 0]);
|
|
446
|
-
}
|
|
447
|
-
// L3 剪影
|
|
448
|
-
const B2 = [];
|
|
449
|
-
add(B2, new THREE.CylinderGeometry(4.6, 7.0, topY, 8), M.plasterWarm, [0, topY / 2, 0]);
|
|
450
|
-
for (let f = 0; f < floors; f++) {
|
|
451
|
-
const r = R0 + 1.4 - f * 0.52;
|
|
452
|
-
add(B2, new THREE.ConeGeometry(r, 1.9, 8), M.tile, [0, 2.0 + f * floorH + 5.5, 0], [0, Math.PI / 8, 0]);
|
|
453
|
-
}
|
|
454
|
-
add(B2, lathe([[0.5, 0], [0.8, 1.0], [0.3, 3.0], [0.05, 6.0]], 10), M.gold, [0, topY + 1.0, 0]);
|
|
455
|
-
|
|
456
|
-
[B0, B1, B2].forEach((arr, i) => {
|
|
457
|
-
const batch = new (ctx.BatchClass)(64);
|
|
458
|
-
arr.forEach(e => batch.add(e.geo, e.mat, e.matrix, { noZone: true }));
|
|
459
|
-
const st = batch.build(levels[i]);
|
|
460
|
-
levels[i].userData.stats = st;
|
|
461
|
-
});
|
|
462
|
-
// 塔是核心借景:距离按 0.16 权重折算,使园内 300–420 m 视距仍落在 L2(九层中模)
|
|
463
|
-
if (ctx.lod) ctx.lod.addLevels(levels, [tx, 30, tz], 10, { distanceScale: 0.16 });
|
|
464
|
-
return { levels, height: topY + 7.2 };
|
|
465
|
-
}
|
|
466
|
-
/* 轻量攒尖几何(避免重复 import 造成循环) */
|
|
467
|
-
function require_pyramid(r, rise, sides) {
|
|
468
|
-
return new THREE.CylinderGeometry(0.15, r, rise, sides, 1, false);
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
/** 园外村落剪影(借景层,LOD L2/L3) */
|
|
472
|
-
function buildVillage(ctx) {
|
|
473
|
-
const { M } = ctx;
|
|
474
|
-
const houses = [
|
|
475
|
-
[-170, -210, 12, 7], [-148, -224, 9, 6], [-196, -232, 14, 8],
|
|
476
|
-
[-120, -196, 10, 6], [-215, -258, 11, 7], [-88, -188, 8, 5],
|
|
477
|
-
[128, -206, 12, 6], [152, -224, 9, 6],
|
|
478
|
-
];
|
|
479
|
-
const B = new (ctx.BatchClass)(80);
|
|
480
|
-
houses.forEach(([hx, hz, w, d], i) => {
|
|
481
|
-
const y = terrainHeight(hx, hz);
|
|
482
|
-
B.add(boxGeo(w, 4.2, d, 0.35), M.plasterWarm, transform([hx, y + 2.1, hz]));
|
|
483
|
-
const rg = roofGeo(w / 2 + 0.5, d / 2 + 0.5, 0, 1.5, { lift: 0.25, eave: 0.4, nx: 14, nz: 10 });
|
|
484
|
-
B.add(rg, M.tile, transform([hx, y + 4.2, hz]));
|
|
485
|
-
B.add(boxGeo(1.1, 2.0, 0.10), M.darkWood, transform([hx, y + 1.0, hz + d / 2 + 0.02]), { lod: 2 });
|
|
486
|
-
});
|
|
487
|
-
const g = new THREE.Group(); g.name = 'borrowVillage'; ctx.scene.add(g);
|
|
488
|
-
B.build(g);
|
|
489
|
-
if (ctx.lod) ctx.lod.addDetail(g, [-160, 4, -220], 45, 3);
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
/* ------------------------------------------------------------------ *
|
|
493
|
-
* 景区总装
|
|
494
|
-
* ------------------------------------------------------------------ */
|
|
495
|
-
export function buildBuildings(ctx) {
|
|
496
|
-
const { B, M } = ctx;
|
|
497
|
-
const prog = ctx.onProgress || (() => {});
|
|
498
|
-
|
|
499
|
-
/* —— 景区 1:澄观门庭(前朝礼序中轴,Z 95 → 40) —— */
|
|
500
|
-
prog(0.05, '入口礼序中轴与照壁');
|
|
501
|
-
addPavingPatch(B, M, 0, 104, 30, 18, 0.06);
|
|
502
|
-
// 八字影壁:中轴留通廊,仅以矮石屏作前景障景,保证宫门与礼序纵深可见
|
|
503
|
-
addWall(B, M, { x1: -14, z1: 108, x2: -9, z2: 105, h: 3.8, t: 0.6, mat: M.graybrick });
|
|
504
|
-
addWall(B, M, { x1: 9, z1: 105, x2: 14, z2: 108, h: 3.8, t: 0.6, mat: M.graybrick });
|
|
505
|
-
addWall(B, M, { x1: -4.5, z1: 104, x2: 4.5, z2: 104, h: 0.82, t: 0.7, mat: M.stoneDark });
|
|
506
|
-
P(ctx, boxGeo(7.6, 0.16, 1.1), M.stone, [0, 0.92, 104]);
|
|
507
|
-
for (const s of [-1, 1]) P(ctx, lathe([[0.32, 0], [0.42, 0.22], [0.20, 0.72], [0.06, 1.02]], 12),
|
|
508
|
-
M.stoneDark, [s * 3.0, 0.98, 104], [0, 0, 0], 1);
|
|
509
|
-
addBrickGate(B, M, { x: 0, y: 0, z: 92, w: 14, h: 6.4 });
|
|
510
|
-
plaque(ctx, '吴苑', [0, 5.55, 92.6], 0, 2.2, 0.62);
|
|
511
|
-
addPavingPatch(B, M, 0, 84, 22, 12, 0.06);
|
|
512
|
-
// 轿厅
|
|
513
|
-
hall(ctx, { x: 0, z: 80, w: 20, d: 8, base: 0.6, colH: 4.6, rise: 2.4, bays: 5, face: 1, rot: 0, dougong: false, windows: false, nx: 34, nz: 20 });
|
|
514
|
-
// 前庭
|
|
515
|
-
addPavingPatch(B, M, 0, 68, 30, 16, 0.05);
|
|
516
|
-
for (const s of [-1, 1]) {
|
|
517
|
-
addStoneLantern(B, M, s * 9, 0.1, 68);
|
|
518
|
-
P(ctx, boxGeo(3.2, 0.36, 3.2), M.stoneDark, [s * 9, 0.18, 68]);
|
|
519
|
-
}
|
|
520
|
-
// 东西廊庑
|
|
521
|
-
corridor(ctx, [[-24, 72], [-24, 58]], { width: 2.2, colH: 2.8, bothRails: false });
|
|
522
|
-
corridor(ctx, [[24, 72], [24, 58]], { width: 2.2, colH: 2.8, bothRails: false });
|
|
523
|
-
// 澄观堂(前朝主殿)
|
|
524
|
-
hall(ctx, {
|
|
525
|
-
x: 0, z: 58, w: 28, d: 12, base: 1.12, colH: 6.4, rise: 3.9, lift: 0.85,
|
|
526
|
-
bays: 5, face: 1, name: '澄观堂', plaqueW: 3.4, stairW: 6.4,
|
|
527
|
-
type: 'xieshan', nx: 48, nz: 30,
|
|
528
|
-
});
|
|
529
|
-
addPavingPatch(B, M, 0, 46, 26, 10, 0.05);
|
|
530
|
-
prog(0.20, '远香堂与南岸堂榭');
|
|
531
|
-
|
|
532
|
-
/* —— 景区 2:涵碧堂榭(南岸主体建筑群) —— */
|
|
533
|
-
// 远香堂(全园主体厅堂,正面朝北临水)
|
|
534
|
-
hall(ctx, {
|
|
535
|
-
x: 0, z: 30, w: 24, d: 10.5, base: 0.92, colH: 5.8, rise: 3.5, lift: 0.78,
|
|
536
|
-
bays: 5, face: -1, name: '远香堂', plaqueW: 3.2, type: 'xieshan',
|
|
537
|
-
terrace: { d: 4.2, rail: 'stone' }, nx: 48, nz: 30,
|
|
538
|
-
});
|
|
539
|
-
// 南岸水廊分东西两段,中段 X ∈ [−18, 18] 留空,
|
|
540
|
-
// 保证远香堂临水正面与「一池三山」定点视角的视线通廊不被廊屋遮挡
|
|
541
|
-
corridor(ctx, [[-56, 25], [-34, 24], [-18, 24]],
|
|
542
|
-
{ width: 2.5, colH: 3.0, rise: 0.9, bothRails: false });
|
|
543
|
-
corridor(ctx, [[18, 24], [30, 23], [52, 21]],
|
|
544
|
-
{ width: 2.5, colH: 3.0, rise: 0.9, bothRails: false });
|
|
545
|
-
// 涵碧榭(西南临水水榭)
|
|
546
|
-
watersideXie(ctx, { x: -30, z: 18, w: 11, d: 6, face: -1, name: '涵碧榭' });
|
|
547
|
-
// 东岸小轩
|
|
548
|
-
hall(ctx, { x: 58, z: 26, w: 9, d: 6, base: 0.5, colH: 3.9, rise: 2.0, bays: 3, face: -1, rot: 0, dougong: false, name: '听松轩', nx: 28, nz: 18 });
|
|
549
|
-
prog(0.34, '一池三山:岛屿、曲桥与石舫');
|
|
550
|
-
|
|
551
|
-
/* —— 景区 3:一池三山(核心水景) —— */
|
|
552
|
-
// 三岛岸壁与登岛平台
|
|
553
|
-
const isles = [
|
|
554
|
-
{ x: -8, z: -12, r: 11.0, name: '蓬莱' },
|
|
555
|
-
{ x: -34, z: -24, r: 6.8, name: '方丈' },
|
|
556
|
-
{ x: 28, z: -18, r: 7.0, name: '瀛洲' },
|
|
557
|
-
];
|
|
558
|
-
isles.forEach((is, k) => {
|
|
559
|
-
P(ctx, new THREE.CylinderGeometry(is.r, is.r + 0.5, 1.15, 20), M.huangshi, [is.x, -0.35, is.z]);
|
|
560
|
-
P(ctx, new THREE.CylinderGeometry(is.r - 0.5, is.r - 0.2, 0.25, 20), M.ground, [is.x, 0.30, is.z], [0, 0, 0], 0, {});
|
|
561
|
-
const N = 22;
|
|
562
|
-
for (let i = 0; i < N; i++) {
|
|
563
|
-
const a = i * Math.PI * 2 / N;
|
|
564
|
-
P(ctx, boxGeo(2.1, 0.42 + (i % 3) * 0.07, 0.9), M.stoneDark,
|
|
565
|
-
[is.x + Math.cos(a) * (is.r + 0.15), 0.12, is.z + Math.sin(a) * (is.r + 0.15)], [0, -a, 0]);
|
|
566
|
-
}
|
|
567
|
-
});
|
|
568
|
-
// 蓬莱 · 雪香云蔚亭(六角,对景焦点)
|
|
569
|
-
pavilion(ctx, { x: -8, z: -12, r: 3.5, sides: 6, base: 0.55, colH: 3.7, rise: 3.0, name: '雪香云蔚', lift: 0.62 });
|
|
570
|
-
// 方丈 · 小四角亭
|
|
571
|
-
pavilion(ctx, { x: -34, z: -24, r: 2.3, sides: 4, base: 0.42, colH: 2.9, rise: 2.2, name: '方丈' });
|
|
572
|
-
// 瀛洲 · 石峰与梅(由 rockery/nature 补石与花木)
|
|
573
|
-
// 九曲桥(南岸 → 荷风四面亭)
|
|
574
|
-
zigzagBridge(ctx, [[28, 22], [33, 19], [36, 21], [39, 17], [42, 18], [44, 14], [46, 12], [44, 9]], { y: 0.34, width: 1.8 });
|
|
575
|
-
// 拱桥(蓬莱 → 北岸)
|
|
576
|
-
archBridge(ctx, { x: -8, z: -30, len: 15, w: 2.6, rot: Math.PI / 2, rise: 2.4 });
|
|
577
|
-
// 平桥(南岸 → 蓬莱):略偏东,避免正对水景定点机位形成遮挡
|
|
578
|
-
zigzagBridge(ctx, [[4, 20], [1, 15], [-3, 7], [-8, -2]], { y: 0.40, width: 2.1 });
|
|
579
|
-
// 不系舟石舫
|
|
580
|
-
stoneBoat(ctx, { x: 38, z: -34, rot: -0.22, name: '不系舟' });
|
|
581
|
-
prog(0.48, '北岸见山楼与东北秋色景区');
|
|
582
|
-
|
|
583
|
-
/* —— 景区 9:见山楼(北岸制高点) —— */
|
|
584
|
-
twoStorey(ctx, { x: 20, z: -60, w: 18, d: 10.5, h1: 5.4, h2: 4.2, rise: 3.1, face: -1, name: '见山楼' });
|
|
585
|
-
addPavingPatch(B, M, 20, -52, 24, 8, 0.06);
|
|
586
|
-
// 北岸石栏
|
|
587
|
-
addRailing(B, M, { x1: 4, z1: -49.5, x2: 36, z2: -49.5, y: 0.3, kind: 'stone' });
|
|
588
|
-
// 爬山廊(东北)
|
|
589
|
-
corridor(ctx, [[44, -44], [52, -48], [58, -52], [64, -54]], { width: 2.2, colH: 2.8, rise: 0.8, bothRails: true });
|
|
590
|
-
|
|
591
|
-
/* —— 景区 7:小山丛桂(东北秋色) —— */
|
|
592
|
-
pavilion(ctx, { x: 68, z: -54, r: 3.0, sides: 4, rot: Math.PI / 6, base: 0.5, colH: 3.3, rise: 2.4, name: '与谁同坐' });
|
|
593
|
-
addPavingPatch(B, M, 68, -54, 10, 10, 0.08);
|
|
594
|
-
addWall(B, M, { x1: 52, z1: -74, x2: 92, z2: -74, h: 2.7, wave: { count: 3, amp: 0.35, phase: 0.4 } });
|
|
595
|
-
|
|
596
|
-
/* —— 景区 4/8:云根叠翠(西北假山)与漱石枕流(西南水院) —— */
|
|
597
|
-
prog(0.62, '云墙、漏窗、月洞门与小飞虹廊桥');
|
|
598
|
-
// 山顶壑云亭
|
|
599
|
-
pavilion(ctx, { x: -64, z: -40, r: 2.5, sides: 4, rot: 0.4, base: 0.4, colH: 2.8, rise: 2.1, name: '壑云' });
|
|
600
|
-
// 小飞虹廊桥(跨西水湾)
|
|
601
|
-
zigzagBridge(ctx, [[-56, 16], [-52, 13], [-48, 10], [-44, 6], [-40, 2]], { y: 0.42, width: 2.6 });
|
|
602
|
-
corridor(ctx, [[-56, 16], [-52, 13], [-48, 10], [-44, 6], [-40, 2]], {
|
|
603
|
-
width: 2.5, colH: 3.1, rise: 1.05, y0: 0.52, bothRails: true,
|
|
604
|
-
});
|
|
605
|
-
plaque(ctx, '小飞虹', [-48, 3.42, 11.0], 0, 1.9, 0.52);
|
|
606
|
-
// 西南水院矮墙与石矶
|
|
607
|
-
addWall(B, M, { x1: -98, z1: 16, x2: -70, z2: 16, h: 2.6, wave: { count: 2, amp: 0.4, phase: 1.0 } });
|
|
608
|
-
addStoneLantern(B, M, -70, 0.1, 4);
|
|
609
|
-
|
|
610
|
-
/* —— 景区 5/12:竹里馆(西南竹径院) —— */
|
|
611
|
-
prog(0.74, '竹里馆框景院与园墙');
|
|
612
|
-
// 院墙(带月洞门与漏窗)
|
|
613
|
-
addMoonGate(B, M, { x: -80, z: 44, rot: 0, r: 1.5, h: 3.5, width: 12 });
|
|
614
|
-
plaque(ctx, '延月', [-80, 3.28, 44.35], 0, 1.5, 0.46);
|
|
615
|
-
// 两侧漏窗(在云墙上开窗:用带洞墙段)
|
|
616
|
-
addWall(B, M, {
|
|
617
|
-
x1: -96, z1: 44, x2: -87, z2: 44, h: 3.2,
|
|
618
|
-
holes: [{ type: 'hex', x: 0, y: 1.05, r: 0.85 }],
|
|
619
|
-
});
|
|
620
|
-
addWall(B, M, {
|
|
621
|
-
x1: -73, z1: 44, x2: -64, z2: 44, h: 3.2,
|
|
622
|
-
holes: [{ type: 'rect', x: 0, y: 0.9, w: 1.5, h: 1.5 }],
|
|
623
|
-
});
|
|
624
|
-
addLeakWindowCore(B, M, { x: -91.5, y: 1.9, z: 44, w: 1.5, h: 1.5, kind: 'hex' });
|
|
625
|
-
addLeakWindowCore(B, M, { x: -68.5, y: 1.65, z: 44, w: 1.5, h: 1.5, kind: 'binglie' });
|
|
626
|
-
// 竹径铺地
|
|
627
|
-
addPavingPatch(B, M, -84, 58, 4.2, 34, 0.05);
|
|
628
|
-
for (let i = 0; i < 10; i++) {
|
|
629
|
-
addPavingPatch(B, M, -84 + (i % 2 ? 0.5 : -0.5), 46 + i * 2.6, 3.2, 0.9, 0.055);
|
|
630
|
-
}
|
|
631
|
-
pavilion(ctx, { x: -82, z: 34, r: 2.8, sides: 6, base: 0.4, colH: 3.2, rise: 2.6, name: '听雨' });
|
|
632
|
-
addWall(B, M, { x1: -100, z1: 30, x2: -100, z2: 66, h: 3.0, wave: { count: 2, amp: 0.3, phase: 0 } });
|
|
633
|
-
// 北侧院墙中部留口,保证「延月洞门 → 云根叠翠主峰」的框景视线贯通
|
|
634
|
-
addWall(B, M, { x1: -100, z1: 30, x2: -86, z2: 30, h: 2.8 });
|
|
635
|
-
addWall(B, M, { x1: -72, z1: 30, x2: -66, z2: 30, h: 2.8 });
|
|
636
|
-
|
|
637
|
-
/* —— 景区 6:荷风四面(东南荷池) —— */
|
|
638
|
-
prog(0.84, '荷风四面亭与园墙闭合');
|
|
639
|
-
pavilion(ctx, { x: 44, z: 6, r: 3.4, sides: 4, rot: Math.PI / 4, base: 0.5, colH: 3.5, rise: 2.7, name: '荷风四面' });
|
|
640
|
-
P(ctx, new THREE.CylinderGeometry(4.2, 4.6, 0.95, 12), M.stone, [44, 0.05, 6]);
|
|
641
|
-
// 东南曲墙
|
|
642
|
-
addWall(B, M, { x1: 70, z1: 22, x2: 96, z2: 22, h: 2.8, wave: { count: 2, amp: 0.42, phase: 0.6 } });
|
|
643
|
-
addWall(B, M, {
|
|
644
|
-
x1: 84, z1: -6, x2: 84, z2: 22, h: 3.0,
|
|
645
|
-
holes: [{ type: 'rect', x: 0, y: 0.9, w: 1.6, h: 1.5 }, { type: 'rect', x: 6, y: 0.9, w: 1.6, h: 1.5 }],
|
|
646
|
-
});
|
|
647
|
-
addLeakWindowCore(B, M, { x: 84, y: 1.65, z: 8, w: 1.6, h: 1.5, rot: Math.PI / 2, kind: 'wanzi' });
|
|
648
|
-
addLeakWindowCore(B, M, { x: 84, y: 1.65, z: 14, w: 1.6, h: 1.5, rot: Math.PI / 2, kind: 'haitang' });
|
|
649
|
-
|
|
650
|
-
/* —— 园墙闭合(云墙随地形起伏) —— */
|
|
651
|
-
const wallSeg = (x1, z1, x2, z2, wave) => addWall(B, M, { x1, z1, x2, z2, h: 3.3, wave });
|
|
652
|
-
wallSeg(-110, 95, -18, 95, { count: 2, amp: 0.32, phase: 0 });
|
|
653
|
-
wallSeg(18, 95, 110, 95, { count: 2, amp: 0.32, phase: 1.2 });
|
|
654
|
-
wallSeg(-110, -95, -30, -95, { count: 2, amp: 0.38, phase: 0.5 });
|
|
655
|
-
wallSeg(-30, -95, 110, -95, { count: 3, amp: 0.38, phase: 1.7 });
|
|
656
|
-
wallSeg(-110, -95, -110, 95, { count: 4, amp: 0.30, phase: 0.9 });
|
|
657
|
-
wallSeg(110, -95, 110, 95, { count: 4, amp: 0.30, phase: 2.1 });
|
|
658
|
-
// 园墙漏窗(临园外,形成框景序列)
|
|
659
|
-
for (let i = 0; i < 6; i++) {
|
|
660
|
-
const z = -72 + i * 24;
|
|
661
|
-
addLeakWindowCore(B, M, { x: -110, y: 1.8, z, w: 1.4, h: 1.4, rot: Math.PI / 2, kind: ['binglie', 'wanzi', 'hex', 'haitang'][i % 4] });
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
/* —— 园外借景层:北寺塔与村落 —— */
|
|
665
|
-
prog(0.94, '园外借景:北寺塔与远村');
|
|
666
|
-
buildPagoda(ctx);
|
|
667
|
-
buildVillage(ctx);
|
|
668
|
-
|
|
669
|
-
prog(1.0, '建筑群构建完成');
|
|
670
|
-
}
|