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.
Files changed (386) hide show
  1. package/README.md +23 -48
  2. package/dist/core.d.ts +68 -0
  3. package/dist/core.js +209 -0
  4. package/dist/core.js.map +1 -0
  5. package/dist/index.d.ts +10 -229
  6. package/dist/index.js +192 -15462
  7. package/dist/index.js.map +1 -1
  8. package/package.json +11 -40
  9. package/cli.mjs +0 -27
  10. package/dist/AssetCompiler-CDFiElji.js +0 -2451
  11. package/dist/AssetCompiler-CDFiElji.js.map +0 -1
  12. package/dist/AssetInputContracts-Dy8iU4eT.js +0 -228
  13. package/dist/AssetInputContracts-Dy8iU4eT.js.map +0 -1
  14. package/dist/AssetRecipe-DmFpzxr-.js +0 -55
  15. package/dist/AssetRecipe-DmFpzxr-.js.map +0 -1
  16. package/dist/BrowserCodeWorker.js +0 -53615
  17. package/dist/KinematicHypothesisScreen-D-z6qgMB.js +0 -242
  18. package/dist/KinematicHypothesisScreen-D-z6qgMB.js.map +0 -1
  19. package/dist/SceneSerializer-DPVOyeRk.js +0 -353
  20. package/dist/SceneSerializer-DPVOyeRk.js.map +0 -1
  21. package/dist/StylePack-DNrdLeGI.js +0 -6314
  22. package/dist/StylePack-DNrdLeGI.js.map +0 -1
  23. package/dist/WorldArchive-pSBIGxLa.js +0 -420
  24. package/dist/WorldArchive-pSBIGxLa.js.map +0 -1
  25. package/dist/WorldIO-wsDfZGM4.js +0 -150
  26. package/dist/WorldIO-wsDfZGM4.js.map +0 -1
  27. package/dist/blankWorld-CBWbwJGj.js +0 -76
  28. package/dist/blankWorld-CBWbwJGj.js.map +0 -1
  29. package/dist/disposeObject3D-BQ9TyVC_.js +0 -54
  30. package/dist/disposeObject3D-BQ9TyVC_.js.map +0 -1
  31. package/dist/environments-DgH66NqV.js +0 -4220
  32. package/dist/environments-DgH66NqV.js.map +0 -1
  33. package/dist/gltfIO-B87nJaat.js +0 -10
  34. package/dist/gltfIO-B87nJaat.js.map +0 -1
  35. package/dist/grandUrbanBlock-Ob9pN-CB.js +0 -516
  36. package/dist/grandUrbanBlock-Ob9pN-CB.js.map +0 -1
  37. package/dist/magicCabin-D64fD1E2.js +0 -11024
  38. package/dist/magicCabin-D64fD1E2.js.map +0 -1
  39. package/dist/mcp.d.ts +0 -2
  40. package/dist/mcp.js +0 -1
  41. package/dist/monumentHall-BKbs0UOQ.js +0 -404
  42. package/dist/monumentHall-BKbs0UOQ.js.map +0 -1
  43. package/dist/node.d.ts +0 -16
  44. package/dist/node.js +0 -25
  45. package/dist/ruinedCourtyard-BoZxHldu.js +0 -697
  46. package/dist/ruinedCourtyard-BoZxHldu.js.map +0 -1
  47. package/dist/runtime/application/AgentTools.js +0 -25
  48. package/dist/runtime/application/README.md +0 -14
  49. package/dist/runtime/application/buildTaskObservation.js +0 -117
  50. package/dist/runtime/application/code-execution/AuthoringSandboxEntry.js +0 -46
  51. package/dist/runtime/application/code-execution/BrowserCodeExecutor.js +0 -35
  52. package/dist/runtime/application/code-execution/BrowserCodeWorker.js +0 -17
  53. package/dist/runtime/application/code-execution/RemoteAuthoringDocument.js +0 -72
  54. package/dist/runtime/application/createSession.js +0 -66
  55. package/dist/runtime/application/createWorldAuthoringContext.js +0 -400
  56. package/dist/runtime/application/generation/GenerationOrchestrator.js +0 -629
  57. package/dist/runtime/application/generation/GenerationRuntime.js +0 -214
  58. package/dist/runtime/application/generation/PromptHybridWorldOrchestrator.js +0 -285
  59. package/dist/runtime/application/native-scene/CodeProject.js +0 -119
  60. package/dist/runtime/application/native-scene/CodeProjectModules.js +0 -128
  61. package/dist/runtime/application/native-scene/NativeEnvironmentGeometry.js +0 -62
  62. package/dist/runtime/application/native-scene/NativeOverlayCheckpoint.js +0 -127
  63. package/dist/runtime/application/native-scene/NativeRenderDiscovery.js +0 -51
  64. package/dist/runtime/application/native-scene/NativeSceneHost.js +0 -164
  65. package/dist/runtime/application/native-scene/NativeSceneOverlay.js +0 -116
  66. package/dist/runtime/application/native-scene/NativeThreeModule.js +0 -16
  67. package/dist/runtime/application/object-forge/SceneObjectForge.js +0 -232
  68. package/dist/runtime/application/programmatic-assets/ProgrammaticAssetBuilder.js +0 -54
  69. package/dist/runtime/application/programmatic-assets/ProgrammaticAssetContract.js +0 -22
  70. package/dist/runtime/application/programmatic-assets/ThreeCodeAsset.js +0 -40
  71. package/dist/runtime/application/scene/CapabilityResolver.js +0 -79
  72. package/dist/runtime/application/scene/RequestWindow.js +0 -54
  73. package/dist/runtime/application/scene/SceneAgentTools.js +0 -21
  74. package/dist/runtime/application/scene/SceneContracts.js +0 -45
  75. package/dist/runtime/application/scene/SceneEditService.js +0 -144
  76. package/dist/runtime/application/scene/SceneFacade.js +0 -267
  77. package/dist/runtime/application/scene/SceneInteractionAdapters.js +0 -40
  78. package/dist/runtime/application/scene/SceneJobController.js +0 -229
  79. package/dist/runtime/application/scene/ScenePackage.js +0 -162
  80. package/dist/runtime/application/scene/ScenePersistence.js +0 -50
  81. package/dist/runtime/application/scene/SceneProject.js +0 -95
  82. package/dist/runtime/application/scene/SceneSkillNames.js +0 -5
  83. package/dist/runtime/application/scene/StarterScene.js +0 -56
  84. package/dist/runtime/application/scene/WorldArchive.js +0 -87
  85. package/dist/runtime/application/scene/WorldDirectory.js +0 -20
  86. package/dist/runtime/application/scene/WorldDocument.js +0 -74
  87. package/dist/runtime/application/scene/WorldIO.js +0 -103
  88. package/dist/runtime/application/scene/WorldStorage.js +0 -137
  89. package/dist/runtime/application/skills/SkillRegistry.js +0 -163
  90. package/dist/runtime/application/skills/packs/acceptanceSkills.js +0 -32
  91. package/dist/runtime/application/skills/packs/affordanceSkills.js +0 -36
  92. package/dist/runtime/application/skills/packs/assetSkills.js +0 -46
  93. package/dist/runtime/application/skills/packs/authoringSkills.js +0 -16
  94. package/dist/runtime/application/skills/packs/batchSkills.js +0 -22
  95. package/dist/runtime/application/skills/packs/codeSkills.js +0 -106
  96. package/dist/runtime/application/skills/packs/generationSkills.js +0 -45
  97. package/dist/runtime/application/skills/packs/interactionSkills.js +0 -46
  98. package/dist/runtime/application/skills/packs/recoverySkills.js +0 -80
  99. package/dist/runtime/application/skills/packs/sceneSkills.js +0 -24
  100. package/dist/runtime/application/skills/packs/spatialSkills.js +0 -35
  101. package/dist/runtime/application/skills/packs/verificationSkills.js +0 -14
  102. package/dist/runtime/application/skills/packs/worldSkills.js +0 -45
  103. package/dist/runtime/application/skills/registerCoreSkills.js +0 -31
  104. package/dist/runtime/application/skills/skillPrimitives.js +0 -4
  105. package/dist/runtime/application/tasks/CabinetCupTask.js +0 -76
  106. package/dist/runtime/application/tasks.jsonl +0 -67
  107. package/dist/runtime/application/world-authoring/AuthoringAssetProducer.js +0 -42
  108. package/dist/runtime/application/world-authoring/AuthoringDiff.js +0 -149
  109. package/dist/runtime/application/world-authoring/AuthoringDocument.js +0 -825
  110. package/dist/runtime/application/world-authoring/AuthoringExecutionHost.js +0 -109
  111. package/dist/runtime/application/world-authoring/AuthoringIdentity.js +0 -17
  112. package/dist/runtime/application/world-authoring/AuthoringModelResolver.js +0 -29
  113. package/dist/runtime/application/world-authoring/AuthoringPatch.js +0 -118
  114. package/dist/runtime/application/world-authoring/AuthoringPromotionController.js +0 -334
  115. package/dist/runtime/application/world-authoring/AuthoringPromotionSource.js +0 -126
  116. package/dist/runtime/application/world-authoring/AuthoringRevisionHistory.js +0 -144
  117. package/dist/runtime/application/world-authoring/HeadlessImageExport.js +0 -174
  118. package/dist/runtime/application/world-authoring/ModelRef.js +0 -62
  119. package/dist/runtime/apps/mcp-server/AUTHORING.md +0 -71
  120. package/dist/runtime/apps/mcp-server/AuthoringSandboxEntry.js +0 -1
  121. package/dist/runtime/apps/mcp-server/AuthoringSandboxWorker.mjs +0 -30
  122. package/dist/runtime/apps/mcp-server/BuildEnvironment.js +0 -17
  123. package/dist/runtime/apps/mcp-server/CodeExecutor.js +0 -71
  124. package/dist/runtime/apps/mcp-server/DEPLOYMENT-PC2.md +0 -42
  125. package/dist/runtime/apps/mcp-server/DockerBuildRunner.js +0 -66
  126. package/dist/runtime/apps/mcp-server/FileAssetRepository.js +0 -159
  127. package/dist/runtime/apps/mcp-server/HeadlessAssetIO.js +0 -8
  128. package/dist/runtime/apps/mcp-server/HeadlessGLTFLoader.js +0 -47
  129. package/dist/runtime/apps/mcp-server/HeadlessWorldHost.js +0 -132
  130. package/dist/runtime/apps/mcp-server/IsolatedAuthoringExecutor.js +0 -6
  131. package/dist/runtime/apps/mcp-server/PROGRAMMATIC-ASSETS.md +0 -116
  132. package/dist/runtime/apps/mcp-server/ProgrammaticAssets.js +0 -60
  133. package/dist/runtime/apps/mcp-server/README.md +0 -150
  134. package/dist/runtime/apps/mcp-server/RemoteAuthoringDocument.js +0 -1
  135. package/dist/runtime/apps/mcp-server/SandboxBundle.js +0 -13
  136. package/dist/runtime/apps/mcp-server/SessionManager.js +0 -80
  137. package/dist/runtime/apps/mcp-server/StudioBridgeHttp.js +0 -58
  138. package/dist/runtime/apps/mcp-server/StudioLiveBridge.js +0 -190
  139. package/dist/runtime/apps/mcp-server/TrustedAuthoringWorker.mjs +0 -16
  140. package/dist/runtime/apps/mcp-server/VALIDATION.md +0 -45
  141. package/dist/runtime/apps/mcp-server/acceptance-evidence.json +0 -332
  142. package/dist/runtime/apps/mcp-server/errorDiagnostics.js +0 -32
  143. package/dist/runtime/apps/mcp-server/examples/code-house.js +0 -24
  144. package/dist/runtime/apps/mcp-server/examples/procedural-assets.js +0 -37
  145. package/dist/runtime/apps/mcp-server/main.mjs +0 -56
  146. package/dist/runtime/apps/mcp-server/registerTools.js +0 -215
  147. package/dist/runtime/apps/mcp-server/sandbox/run.mjs +0 -23
  148. package/dist/runtime/apps/mcp-server/security.js +0 -21
  149. package/dist/runtime/apps/mcp-server/tasks.jsonl +0 -9
  150. package/dist/runtime/apps/server/CapabilityAdapterRegistry.js +0 -157
  151. package/dist/runtime/apps/server/README.md +0 -7
  152. package/dist/runtime/apps/server/WorldDiskStorage.js +0 -51
  153. package/dist/runtime/apps/server/openai-compatible-agent-gateway.mjs +0 -278
  154. package/dist/runtime/apps/server/tasks.jsonl +0 -10
  155. package/dist/runtime/foundation/EventBus.js +0 -18
  156. package/dist/runtime/foundation/JsonGateway.js +0 -47
  157. package/dist/runtime/foundation/PolicyEngine.js +0 -21
  158. package/dist/runtime/foundation/README.md +0 -7
  159. package/dist/runtime/foundation/TraceRecorder.js +0 -76
  160. package/dist/runtime/foundation/errors.js +0 -8
  161. package/dist/runtime/foundation/simulation/SimulationProfile.js +0 -143
  162. package/dist/runtime/foundation/version.js +0 -2
  163. package/dist/runtime/modules/agent/README.md +0 -11
  164. package/dist/runtime/modules/agent/ToolCallingAgent.js +0 -19
  165. package/dist/runtime/modules/agent/bootstrapWorld.js +0 -10
  166. package/dist/runtime/modules/agent/buildRecoveryProposals.js +0 -533
  167. package/dist/runtime/modules/agent/execution/AgentExecutionRules.js +0 -127
  168. package/dist/runtime/modules/agent/execution/AgentRunResults.js +0 -55
  169. package/dist/runtime/modules/agent/execution/AgentRunSession.js +0 -390
  170. package/dist/runtime/modules/agent/execution/AgentToolInvoker.js +0 -39
  171. package/dist/runtime/modules/agent/gateway/HttpLLMGateway.js +0 -19
  172. package/dist/runtime/modules/agent/prompt/index.js +0 -46
  173. package/dist/runtime/modules/agent/tasks.jsonl +0 -94
  174. package/dist/runtime/modules/artifact/ArtifactContentGate.js +0 -144
  175. package/dist/runtime/modules/artifact/ArtifactDescriptor.js +0 -280
  176. package/dist/runtime/modules/artifact/ArtifactImporter.js +0 -185
  177. package/dist/runtime/modules/artifact/ArtifactModule.js +0 -111
  178. package/dist/runtime/modules/artifact/ArtifactRegistry.js +0 -197
  179. package/dist/runtime/modules/artifact/IncrementalSha256.js +0 -129
  180. package/dist/runtime/modules/artifact/MemoryArtifactByteStore.js +0 -115
  181. package/dist/runtime/modules/artifact/README.md +0 -7
  182. package/dist/runtime/modules/artifact/storage/IndexedDbArtifactStore.js +0 -67
  183. package/dist/runtime/modules/artifact/tasks.jsonl +0 -31
  184. package/dist/runtime/modules/asset/AssetModule.js +0 -399
  185. package/dist/runtime/modules/asset/README.md +0 -54
  186. package/dist/runtime/modules/asset/loading/AssetLoader.js +0 -157
  187. package/dist/runtime/modules/asset/loading/GltfAssetLoader.js +0 -61
  188. package/dist/runtime/modules/asset/loading/builtins/BuiltinAssets.js +0 -95
  189. package/dist/runtime/modules/asset/loading/builtins/HouseDoor.js +0 -33
  190. package/dist/runtime/modules/asset/loading/builtins/IndustrialCabinet.js +0 -103
  191. package/dist/runtime/modules/asset/model/AssetInputContracts.js +0 -95
  192. package/dist/runtime/modules/asset/model/AssetRef.js +0 -12
  193. package/dist/runtime/modules/asset/model/MechanicalAssetDraft.js +0 -172
  194. package/dist/runtime/modules/asset/model/admission.js +0 -117
  195. package/dist/runtime/modules/asset/model/errors.js +0 -6
  196. package/dist/runtime/modules/asset/model/parts.js +0 -27
  197. package/dist/runtime/modules/asset/model/resourceBudget.js +0 -10
  198. package/dist/runtime/modules/asset/model/schema.js +0 -150
  199. package/dist/runtime/modules/asset/persistence/AssetManifestStore.js +0 -78
  200. package/dist/runtime/modules/asset/persistence/CompiledAssetStore.js +0 -84
  201. package/dist/runtime/modules/asset/persistence/LocalAssetLibrary.js +0 -86
  202. package/dist/runtime/modules/asset/persistence/LocalAssetLibraryStore.js +0 -81
  203. package/dist/runtime/modules/asset/production/AssetProductionPipeline.js +0 -272
  204. package/dist/runtime/modules/asset/production/AssetRecipe.js +0 -32
  205. package/dist/runtime/modules/asset/production/adapters/EmbodiedGenAdapter.js +0 -45
  206. package/dist/runtime/modules/asset/production/adapters/EmbodiedGenBundleAdapter.js +0 -590
  207. package/dist/runtime/modules/asset/production/compiler/AssetCompiler.js +0 -173
  208. package/dist/runtime/modules/asset/production/compiler/evidence/AnimationMotionEvidence.js +0 -124
  209. package/dist/runtime/modules/asset/production/compiler/evidence/StaticPanelEvidence.js +0 -56
  210. package/dist/runtime/modules/asset/production/compiler/gltfIO.js +0 -6
  211. package/dist/runtime/modules/asset/production/compiler/partGeometry.js +0 -74
  212. package/dist/runtime/modules/asset/production/compiler/passes/ArticulatedCollisionPass.js +0 -63
  213. package/dist/runtime/modules/asset/production/compiler/passes/ArticulationCandidatePass.js +0 -48
  214. package/dist/runtime/modules/asset/production/compiler/passes/AuthoringIntentPass.js +0 -16
  215. package/dist/runtime/modules/asset/production/compiler/passes/ColliderFallbackPass.js +0 -30
  216. package/dist/runtime/modules/asset/production/compiler/passes/CompileQualityPass.js +0 -75
  217. package/dist/runtime/modules/asset/production/compiler/passes/ExplicitDefinitionPass.js +0 -20
  218. package/dist/runtime/modules/asset/production/compiler/passes/GLTFInspectPass.js +0 -34
  219. package/dist/runtime/modules/asset/production/compiler/passes/GeometryPass.js +0 -32
  220. package/dist/runtime/modules/asset/production/compiler/passes/JointFramePass.js +0 -116
  221. package/dist/runtime/modules/asset/production/compiler/passes/KinematicEvidencePass.js +0 -84
  222. package/dist/runtime/modules/asset/production/compiler/passes/ManifestPass.js +0 -63
  223. package/dist/runtime/modules/asset/production/compiler/passes/NormalizeTransformPass.js +0 -16
  224. package/dist/runtime/modules/asset/production/compiler/passes/OptimizeGLBPass.js +0 -23
  225. package/dist/runtime/modules/asset/production/compiler/passes/PartColliderPass.js +0 -50
  226. package/dist/runtime/modules/asset/production/compiler/passes/PartGeometryEnrichmentPass.js +0 -60
  227. package/dist/runtime/modules/asset/production/compiler/passes/PartProposalPass.js +0 -93
  228. package/dist/runtime/modules/asset/production/compiler/passes/RemoteEnrichmentPass.js +0 -32
  229. package/dist/runtime/modules/asset/production/compiler/passes/ResourceBudgetPass.js +0 -55
  230. package/dist/runtime/modules/asset/production/compiler/passes/SegmentMaterializePass.js +0 -203
  231. package/dist/runtime/modules/asset/production/compiler/passes/SegmentationEvidencePass.js +0 -43
  232. package/dist/runtime/modules/asset/production/compiler/passes/SemanticHeuristicPass.js +0 -33
  233. package/dist/runtime/modules/asset/production/compiler/passes/StructurePass.js +0 -60
  234. package/dist/runtime/modules/asset/production/compiler/providers/HttpCompilerProvider.js +0 -23
  235. package/dist/runtime/modules/asset/production/verification/KinematicHypothesisScreen.js +0 -198
  236. package/dist/runtime/modules/asset/registry/AssetCatalog.js +0 -72
  237. package/dist/runtime/modules/asset/registry/AssetRegistry.js +0 -51
  238. package/dist/runtime/modules/asset/registry/manifests/index.js +0 -173
  239. package/dist/runtime/modules/asset/tasks.jsonl +0 -87
  240. package/dist/runtime/modules/generation/README.md +0 -9
  241. package/dist/runtime/modules/generation/connector/ConnectorArtifactClient.js +0 -45
  242. package/dist/runtime/modules/generation/connector/ConnectorCapabilityAdapter.js +0 -169
  243. package/dist/runtime/modules/generation/connector/ConnectorClient.js +0 -192
  244. package/dist/runtime/modules/generation/connector/ConnectorJobClient.js +0 -167
  245. package/dist/runtime/modules/generation/connector/ConnectorJobEventClient.js +0 -179
  246. package/dist/runtime/modules/generation/connector/ConnectorSession.js +0 -202
  247. package/dist/runtime/modules/generation/jobs/GenerationJobProjection.js +0 -239
  248. package/dist/runtime/modules/generation/jobs/GenerationJobReconciler.js +0 -99
  249. package/dist/runtime/modules/generation/jobs/GenerationJobStore.js +0 -91
  250. package/dist/runtime/modules/generation/jobs/GenerationJobTransportOverlay.js +0 -50
  251. package/dist/runtime/modules/generation/providers/ProviderRegistry.js +0 -304
  252. package/dist/runtime/modules/generation/tasks.jsonl +0 -35
  253. package/dist/runtime/modules/navigation/NavigationBackend.js +0 -17
  254. package/dist/runtime/modules/navigation/RecastNavigationBackend.js +0 -245
  255. package/dist/runtime/modules/physics/JoltPhysicsBackend.js +0 -850
  256. package/dist/runtime/modules/physics/PhysicsApiSurface.js +0 -651
  257. package/dist/runtime/modules/physics/PhysicsBackend.js +0 -88
  258. package/dist/runtime/modules/physics/RapierPhysicsBackend.js +0 -410
  259. package/dist/runtime/modules/rendering/README.md +0 -7
  260. package/dist/runtime/modules/rendering/RendererProbe.js +0 -153
  261. package/dist/runtime/modules/rendering/WebGpuPostFxPipeline.js +0 -140
  262. package/dist/runtime/modules/rendering/createRenderer.js +0 -76
  263. package/dist/runtime/modules/rendering/disposeObject3D.js +0 -34
  264. package/dist/runtime/modules/rendering/loadGaussianSplatVisual.js +0 -74
  265. package/dist/runtime/modules/rendering/style/StylePack.js +0 -34
  266. package/dist/runtime/modules/rendering/style/StyleSystem.js +0 -173
  267. package/dist/runtime/modules/rendering/tasks.jsonl +0 -7
  268. package/dist/runtime/modules/world/README.md +0 -13
  269. package/dist/runtime/modules/world/build/WorldBuilder.js +0 -170
  270. package/dist/runtime/modules/world/compiler/PipelineEngine.js +0 -32
  271. package/dist/runtime/modules/world/compiler/WorldAdmission.js +0 -43
  272. package/dist/runtime/modules/world/compiler/WorldBehaviorCompiler.js +0 -68
  273. package/dist/runtime/modules/world/compiler/WorldCompilation.js +0 -157
  274. package/dist/runtime/modules/world/compiler/WorldComposer.js +0 -201
  275. package/dist/runtime/modules/world/compiler/WorldPhysicsAdmission.js +0 -76
  276. package/dist/runtime/modules/world/compiler/WorldRecompiler.js +0 -356
  277. package/dist/runtime/modules/world/compiler/WorldRetry.js +0 -75
  278. package/dist/runtime/modules/world/compiler/createWorldPipeline.js +0 -379
  279. package/dist/runtime/modules/world/content/blankWorld.js +0 -35
  280. package/dist/runtime/modules/world/content/environments.js +0 -84
  281. package/dist/runtime/modules/world/content/grandUrbanBlock.js +0 -189
  282. package/dist/runtime/modules/world/content/magic-cabin/README.md +0 -28
  283. package/dist/runtime/modules/world/content/magic-cabin/affordances.js +0 -64
  284. package/dist/runtime/modules/world/content/magic-cabin/cabinContents.js +0 -7078
  285. package/dist/runtime/modules/world/content/magic-cabin/lighting.js +0 -26
  286. package/dist/runtime/modules/world/content/magic-cabin/materials.js +0 -20
  287. package/dist/runtime/modules/world/content/magicCabin.js +0 -190
  288. package/dist/runtime/modules/world/content/monumentHall.js +0 -154
  289. package/dist/runtime/modules/world/content/ruinedCourtyard.js +0 -196
  290. package/dist/runtime/modules/world/content/suzhouGarden/README.md +0 -141
  291. package/dist/runtime/modules/world/content/suzhouGarden/index.js +0 -137
  292. package/dist/runtime/modules/world/content/suzhouGarden/src/arch.js +0 -491
  293. package/dist/runtime/modules/world/content/suzhouGarden/src/buildings.js +0 -670
  294. package/dist/runtime/modules/world/content/suzhouGarden/src/core.js +0 -578
  295. package/dist/runtime/modules/world/content/suzhouGarden/src/lod.js +0 -127
  296. package/dist/runtime/modules/world/content/suzhouGarden/src/main.js +0 -642
  297. package/dist/runtime/modules/world/content/suzhouGarden/src/nature.js +0 -650
  298. package/dist/runtime/modules/world/content/suzhouGarden/src/rockery.js +0 -280
  299. package/dist/runtime/modules/world/content/suzhouGarden/src/sky.js +0 -242
  300. package/dist/runtime/modules/world/content/suzhouGarden/src/water.js +0 -215
  301. package/dist/runtime/modules/world/content/woodlandWorkshop.js +0 -192
  302. package/dist/runtime/modules/world/content/yuanmingyuan/README.md +0 -36
  303. package/dist/runtime/modules/world/content/yuanmingyuan/arch.js +0 -351
  304. package/dist/runtime/modules/world/content/yuanmingyuan/buildings.js +0 -490
  305. package/dist/runtime/modules/world/content/yuanmingyuan/core.js +0 -505
  306. package/dist/runtime/modules/world/content/yuanmingyuan/index.js +0 -101
  307. package/dist/runtime/modules/world/content/yuanmingyuan/nature.js +0 -435
  308. package/dist/runtime/modules/world/content/yuanmingyuan/sky.js +0 -169
  309. package/dist/runtime/modules/world/content/yuanmingyuan/water.js +0 -245
  310. package/dist/runtime/modules/world/errors.js +0 -9
  311. package/dist/runtime/modules/world/generated/GeneratedWorldCoordinates.js +0 -50
  312. package/dist/runtime/modules/world/generated/GeneratedWorldLoader.js +0 -297
  313. package/dist/runtime/modules/world/runtime/CommandHistory.js +0 -80
  314. package/dist/runtime/modules/world/runtime/ObjectStore.js +0 -31
  315. package/dist/runtime/modules/world/runtime/ObjectTransform.js +0 -62
  316. package/dist/runtime/modules/world/runtime/ObservedEntity.js +0 -37
  317. package/dist/runtime/modules/world/runtime/ProjectCapabilities.js +0 -207
  318. package/dist/runtime/modules/world/runtime/SceneSerializer.js +0 -246
  319. package/dist/runtime/modules/world/runtime/WorldAuthority.js +0 -41
  320. package/dist/runtime/modules/world/runtime/WorldCollisionSignature.js +0 -14
  321. package/dist/runtime/modules/world/runtime/WorldCommands.js +0 -502
  322. package/dist/runtime/modules/world/runtime/WorldObservation.js +0 -71
  323. package/dist/runtime/modules/world/runtime/WorldQueries.js +0 -340
  324. package/dist/runtime/modules/world/runtime/WorldRecovery.js +0 -78
  325. package/dist/runtime/modules/world/runtime/WorldRuntime.js +0 -649
  326. package/dist/runtime/modules/world/runtime/affordance/ObjectAffordances.js +0 -107
  327. package/dist/runtime/modules/world/runtime/affordance/WorldAffordances.js +0 -130
  328. package/dist/runtime/modules/world/runtime/behavior/BehaviorCompiler.js +0 -79
  329. package/dist/runtime/modules/world/runtime/behavior/ProjectStateMachine.js +0 -195
  330. package/dist/runtime/modules/world/runtime/behavior/RuleGraph.js +0 -70
  331. package/dist/runtime/modules/world/runtime/behavior/RuleRuntime.js +0 -115
  332. package/dist/runtime/modules/world/runtime/graph/SceneGraph.js +0 -216
  333. package/dist/runtime/modules/world/runtime/interaction/ArticulationRuntime.js +0 -214
  334. package/dist/runtime/modules/world/runtime/interaction/CarryCapability.js +0 -65
  335. package/dist/runtime/modules/world/runtime/interaction/CarryRuntime.js +0 -222
  336. package/dist/runtime/modules/world/runtime/interaction/InteractionApproach.js +0 -130
  337. package/dist/runtime/modules/world/runtime/interaction/InteractionContract.js +0 -57
  338. package/dist/runtime/modules/world/runtime/interaction/RecoveryRuntime.js +0 -123
  339. package/dist/runtime/modules/world/runtime/interaction/SettleRuntime.js +0 -120
  340. package/dist/runtime/modules/world/runtime/semantic/SemanticWorldView.js +0 -102
  341. package/dist/runtime/modules/world/runtime/simulation/SimulationClock.js +0 -89
  342. package/dist/runtime/modules/world/runtime/simulation/SimulationSession.js +0 -99
  343. package/dist/runtime/modules/world/runtime/simulation/ThermalSystem.js +0 -269
  344. package/dist/runtime/modules/world/runtime/spatial/SpatialSnapshot.js +0 -56
  345. package/dist/runtime/modules/world/runtime/spatial/ThreeBvhRuntime.js +0 -36
  346. package/dist/runtime/modules/world/runtime/systems/InteractionSystem.js +0 -728
  347. package/dist/runtime/modules/world/runtime/systems/LocomotionSystem.js +0 -269
  348. package/dist/runtime/modules/world/runtime/systems/NavigationSystem.js +0 -469
  349. package/dist/runtime/modules/world/runtime/systems/PhysicsSystem.js +0 -1657
  350. package/dist/runtime/modules/world/runtime/systems/RenderingSystem.js +0 -457
  351. package/dist/runtime/modules/world/runtime/systems/SpatialSystem.js +0 -284
  352. package/dist/runtime/modules/world/spec/WorldIR.js +0 -165
  353. package/dist/runtime/modules/world/spec/WorldIRToolSchema.js +0 -86
  354. package/dist/runtime/modules/world/spec/WorldPlannerProposal.js +0 -51
  355. package/dist/runtime/modules/world/spec/WorldRevision.js +0 -231
  356. package/dist/runtime/modules/world/spec/WorldSpec.js +0 -86
  357. package/dist/runtime/modules/world/tasks.jsonl +0 -530
  358. package/dist/runtime/modules/world/verification/ArticulationVerifier.js +0 -254
  359. package/dist/runtime/modules/world/verification/Finding.js +0 -105
  360. package/dist/runtime/modules/world/verification/InteractionEvidence.js +0 -69
  361. package/dist/runtime/modules/world/verification/RepairEngine.js +0 -49
  362. package/dist/runtime/modules/world/verification/WorldAcceptance.js +0 -158
  363. package/dist/runtime/modules/world/verification/WorldValidator.js +0 -65
  364. package/dist/runtime/package-lock.json +0 -6245
  365. package/dist/runtime/package.json +0 -91
  366. package/dist/runtime/public/assets/cabinet.glb +0 -0
  367. package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_diff_1k.jpg +0 -0
  368. package/dist/runtime/public/assets/grand-urban-block/clean_asphalt_nor_gl_1k.jpg +0 -0
  369. package/dist/runtime/public/assets/grand-urban-block/concrete_pavement_diff_1k.jpg +0 -0
  370. package/dist/runtime/public/assets/grand-urban-block/urban_street_01_1k.hdr +0 -0
  371. package/dist/runtime/public/assets/monument-hall/marble_diff_1k.jpg +0 -0
  372. package/dist/runtime/public/assets/monument-hall/marble_nor_gl_1k.jpg +0 -0
  373. package/dist/runtime/public/assets/monument-hall/marble_rough_1k.jpg +0 -0
  374. package/dist/runtime/public/assets/monument-hall/solitude_interior_1k.hdr +0 -0
  375. package/dist/runtime/public/assets/ruined-courtyard/courtyard_1k.hdr +0 -0
  376. package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_diff_1k.jpg +0 -0
  377. package/dist/runtime/public/assets/ruined-courtyard/mossy_cobblestone_nor_gl_1k.jpg +0 -0
  378. package/dist/runtime/public/assets/ruined-courtyard/mossy_sandstone_diff_1k.jpg +0 -0
  379. package/dist/schema-Dudvovhu.js +0 -364
  380. package/dist/schema-Dudvovhu.js.map +0 -1
  381. package/dist/suzhouGarden-BCx_JeV5.js +0 -6159
  382. package/dist/suzhouGarden-BCx_JeV5.js.map +0 -1
  383. package/dist/woodlandWorkshop-BGNWPNdK.js +0 -484
  384. package/dist/woodlandWorkshop-BGNWPNdK.js.map +0 -1
  385. package/dist/yuanmingyuan-DAIb1msO.js +0 -4962
  386. package/dist/yuanmingyuan-DAIb1msO.js.map +0 -1
@@ -1,650 +0,0 @@
1
- /* 吴苑澄观 · 地形、园路、植被花木与远景借景
2
- * 高度场地形(顶点色草土湿岸)、花街园路、松柳竹桂银杏玉兰梅枫芭蕉、
3
- * 荷叶荷花芦苇书带草苔、远景林带与灵岩山山脊。植被全部 GPU Instancing。
4
- */
5
- import * as THREE from 'three';
6
- import {
7
- boxGeo, transform, tube, clamp, smooth, fbm, mulberry32, rr,
8
- WORLD, QUALITY, waterSDF, terrainHeight, POOLS, ISLES,
9
- } from './core.js';
10
- import { put, addPavingPatch } from './arch.js';
11
-
12
- /* 建筑占地避让(与 buildings.js 布点一致) */
13
- const FOOTPRINTS = [
14
- [0, 104, 34, 20], [0, 92, 18, 6], [0, 80, 23, 11], [0, 68, 32, 18],
15
- [0, 58, 31, 15], [0, 46, 28, 12], [0, 30, 27, 13], [0, 22, 26, 7],
16
- [-30, 18, 14, 9], [58, 26, 12, 9], [20, -60, 22, 14], [68, -54, 10, 10],
17
- [-82, 34, 9, 9], [44, 6, 10, 10], [38, -34, 21, 7], [-64, -40, 34, 30],
18
- [-48, 10, 18, 18], [-80, 44, 14, 5], [-84, 58, 8, 36], [-100, 48, 6, 40],
19
- [44, 12, 22, 22], [0, -12, 26, 18], [-34, -24, 16, 13], [28, -18, 16, 13],
20
- ];
21
- function freeLand(x, z, pad = 1.2) {
22
- if (Math.abs(x) > 106 || Math.abs(z) > 91) return false;
23
- if (waterSDF(x, z) < pad) return false;
24
- for (const [bx, bz, bw, bd] of FOOTPRINTS) {
25
- if (Math.abs(x - bx) < bw / 2 + pad && Math.abs(z - bz) < bd / 2 + pad) return false;
26
- }
27
- return true;
28
- }
29
-
30
- /* ------------------------------------------------------------------ *
31
- * 1. 地形(高度场 + 顶点色)
32
- * ------------------------------------------------------------------ */
33
- function buildTerrain(scene, M) {
34
- const [W, D] = WORLD.ground;
35
- const segX = 168, segZ = 148;
36
- const geo = new THREE.PlaneGeometry(W, D, segX, segZ);
37
- geo.rotateX(-Math.PI / 2);
38
- const p = geo.getAttribute('position');
39
- const colors = new Float32Array(p.count * 3);
40
- const grass = new THREE.Color(0x6d7c4c), dry = new THREE.Color(0x9a9464);
41
- const moss = new THREE.Color(0x4c6840), wet = new THREE.Color(0x5c6046);
42
- const outer = new THREE.Color(0x71805a);
43
- const c = new THREE.Color();
44
- for (let i = 0; i < p.count; i++) {
45
- const x = p.getX(i), z = p.getZ(i);
46
- p.setY(i, terrainHeight(x, z));
47
- const n = fbm(x * 0.02 + 5, z * 0.02 + 9, 61, 4);
48
- const w = waterSDF(x, z);
49
- c.copy(grass).lerp(dry, clamp((n - 0.42) * 1.5, 0, 0.55));
50
- c.lerp(moss, smooth(0.58, 0.82, fbm(x * 0.05, z * 0.05, 73, 3)) * 0.45);
51
- if (w < 2.6) c.lerp(wet, 1 - smooth(-0.4, 2.6, w));
52
- // 西北叠石山地:混入石灰/苔色,避免大片土黄与湖石脱节
53
- const rocky = Math.exp(-((x + 64) ** 2 / 1900 + (z + 40) ** 2 / 1500));
54
- if (rocky > 0.02) c.lerp(new THREE.Color(0x7f8776), rocky * 0.62);
55
- const inGarden = Math.abs(x) < 112 && Math.abs(z) < 97;
56
- if (!inGarden) c.lerp(outer, 0.42);
57
- const shade = 0.88 + n * 0.24;
58
- colors[i * 3] = c.r * shade; colors[i * 3 + 1] = c.g * shade; colors[i * 3 + 2] = c.b * shade;
59
- }
60
- p.needsUpdate = true;
61
- geo.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3));
62
- geo.computeVertexNormals();
63
- const uv = geo.getAttribute('uv');
64
- for (let i = 0; i < uv.count; i++) uv.setXY(i, uv.getX(i) * 26, uv.getY(i) * 23);
65
- const mesh = new THREE.Mesh(geo, M.ground);
66
- mesh.name = '地形';
67
- mesh.receiveShadow = true;
68
- mesh.castShadow = false;
69
- scene.add(mesh);
70
- return mesh;
71
- }
72
-
73
- /* ------------------------------------------------------------------ *
74
- * 2. 园路网(花街铺地贴片)
75
- * ------------------------------------------------------------------ */
76
- function buildPathPatches(scene, M, BatchClass) {
77
- const B = new BatchClass(40);
78
- const paths = [
79
- [[0, 94], [0, 84], [0, 74], [0, 64]], // 中轴
80
- [[-18, 68], [-18, 46], [-18, 38], [-16, 30]], // 西侧游廊路
81
- [[18, 68], [18, 46], [18, 38], [16, 30]], // 东侧游廊路
82
- [[-18, 46], [-40, 42], [-62, 44], [-80, 50], [-84, 64]], // 通往竹里馆
83
- [[18, 46], [40, 42], [60, 38], [70, 30]], // 通往荷池
84
- [[-56, 25], [-70, 22], [-84, 16], [-92, 6]], // 西岸
85
- [[52, 21], [64, 20], [78, 16], [88, 6]], // 东岸
86
- [[4, -50], [20, -50], [36, -50], [52, -56], [66, -60]], // 北岸
87
- [[-30, -48], [-16, -50], [4, -50]], // 北岸西段
88
- [[-70, -18], [-78, -30], [-86, -44], [-90, -62]], // 山后小径
89
- ];
90
- paths.forEach((pts, pi) => {
91
- for (let i = 0; i < pts.length - 1; i++) {
92
- const [x1, z1] = pts[i], [x2, z2] = pts[i + 1];
93
- const len = Math.hypot(x2 - x1, z2 - z1);
94
- const steps = Math.max(1, Math.round(len / 2.4));
95
- for (let k = 0; k < steps; k++) {
96
- const t = (k + 0.5) / steps;
97
- const x = x1 + (x2 - x1) * t, z = z1 + (z2 - z1) * t;
98
- if (waterSDF(x, z) < 0.5) continue;
99
- const y = terrainHeight(x, z) + 0.055;
100
- addPavingPatch(B, M, x, z, len / steps + 0.12, pi === 0 ? 4.2 : 2.4, y,
101
- -Math.atan2(z2 - z1, x2 - x1), 0);
102
- }
103
- }
104
- });
105
- const g = new THREE.Group(); g.name = '花街园路'; scene.add(g);
106
- B.build(g);
107
- return g;
108
- }
109
-
110
- /* ------------------------------------------------------------------ *
111
- * 3. 植被几何与实例收集器
112
- * ------------------------------------------------------------------ */
113
- function tuftGeo() {
114
- const g = new THREE.IcosahedronGeometry(1, 1);
115
- const p = g.getAttribute('position');
116
- const rnd = mulberry32(8821);
117
- for (let i = 0; i < p.count; i++) {
118
- const k = 0.82 + rnd() * 0.34;
119
- p.setXYZ(i, p.getX(i) * k, p.getY(i) * k * 0.86, p.getZ(i) * k);
120
- }
121
- p.needsUpdate = true; g.computeVertexNormals();
122
- return g;
123
- }
124
- function bladeGeo() {
125
- // 两片交叉草叶,带根深尖浅的顶点色
126
- const pos = [], col = [], idx = [];
127
- const add = (x0, z0, ang) => {
128
- const ca = Math.cos(ang), sa = Math.sin(ang);
129
- const b = pos.length / 3;
130
- const w = 0.075, h = 0.62;
131
- pos.push(-w * ca, 0, -w * sa, w * ca, 0, w * sa, -w * 0.30 * ca, h, -w * 0.30 * sa,
132
- w * 0.30 * ca, h, w * 0.30 * sa);
133
- col.push(0.24, 0.34, 0.16, 0.24, 0.34, 0.16, 0.52, 0.66, 0.30, 0.52, 0.66, 0.30);
134
- idx.push(b, b + 1, b + 2, b + 1, b + 3, b + 2);
135
- };
136
- add(0, 0, 0); add(0, 0, Math.PI / 2);
137
- const g = new THREE.BufferGeometry();
138
- g.setAttribute('position', new THREE.Float32BufferAttribute(pos, 3));
139
- g.setAttribute('color', new THREE.Float32BufferAttribute(col, 3));
140
- g.setIndex(idx); g.computeVertexNormals();
141
- return g;
142
- }
143
- function lotusLeafGeo() {
144
- const N = 20, pos = [0, 0.02, 0], col = [0.30, 0.52, 0.24], idx = [];
145
- for (let i = 0; i <= N; i++) {
146
- const a = i * Math.PI * 2 / N;
147
- const notch = (i === 0 || i === N) ? 0.18 : 1;
148
- const r = (0.46 + Math.sin(a * 5) * 0.012) * notch;
149
- pos.push(Math.cos(a) * r, 0.035 + Math.sin(a * 7) * 0.012, Math.sin(a) * r);
150
- col.push(0.30 + (i % 3) * 0.02, 0.50 + (i % 4) * 0.018, 0.24);
151
- }
152
- for (let i = 1; i <= N; i++) idx.push(0, i, i + 1);
153
- const g = new THREE.BufferGeometry();
154
- g.setAttribute('position', new THREE.Float32BufferAttribute(pos, 3));
155
- g.setAttribute('color', new THREE.Float32BufferAttribute(col, 3));
156
- g.setIndex(idx); g.computeVertexNormals();
157
- return g;
158
- }
159
- function petalGeo() {
160
- const s = new THREE.Shape();
161
- s.moveTo(0, 0);
162
- s.bezierCurveTo(0.14, 0.12, 0.16, 0.34, 0, 0.46);
163
- s.bezierCurveTo(-0.16, 0.34, -0.14, 0.12, 0, 0);
164
- const g = new THREE.ExtrudeGeometry(s, { depth: 0.012, bevelEnabled: false, curveSegments: 5 });
165
- g.rotateX(-Math.PI / 2 + 0.42);
166
- return g;
167
- }
168
-
169
- const GRASS_VERT = `
170
- uniform vec3 uCam; uniform float uTime; uniform float uNear; uniform float uFar;
171
- attribute vec3 color;
172
- varying vec3 vCol; varying float vFog;
173
- void main(){
174
- vec4 base = modelMatrix * instanceMatrix * vec4(0.0, 0.0, 0.0, 1.0);
175
- float d = distance(uCam, base.xyz);
176
- float k = 1.0 - smoothstep(uNear, uFar, d);
177
- vec3 p = position * k;
178
- p.x += sin(uTime * 1.3 + base.x * 0.35 + base.z * 0.2) * 0.07 * p.y;
179
- vec4 wp = modelMatrix * instanceMatrix * vec4(p, 1.0);
180
- vCol = color;
181
- vFog = clamp(1.0 - exp(-0.0020 * d), 0.0, 1.0);
182
- gl_Position = projectionMatrix * viewMatrix * wp;
183
- }`;
184
- const GRASS_FRAG = `
185
- precision highp float;
186
- uniform vec3 uFogColor; uniform float uWet;
187
- varying vec3 vCol; varying float vFog;
188
- void main(){
189
- vec3 c = vCol * mix(1.0, 0.72, uWet);
190
- c = mix(c, uFogColor, vFog * 0.85);
191
- gl_FragColor = vec4(c, 1.0);
192
- }`;
193
-
194
- class InstCollector {
195
- constructor(geo, mat, name) { this.geo = geo; this.mat = mat; this.name = name; this.list = []; }
196
- add(pos, rot, scale, color) {
197
- this.list.push({ pos, rot, scale, color });
198
- }
199
- build(scene, opts = {}) {
200
- if (!this.list.length) return null;
201
- const im = new THREE.InstancedMesh(this.geo, this.mat, this.list.length);
202
- im.name = this.name;
203
- im.castShadow = !!opts.castShadow;
204
- im.receiveShadow = !!opts.receiveShadow;
205
- im.frustumCulled = !!opts.frustumCulled;
206
- const m = new THREE.Matrix4(), q = new THREE.Quaternion(), e = new THREE.Euler();
207
- const c = new THREE.Color();
208
- this.list.forEach((it, i) => {
209
- e.set(it.rot[0], it.rot[1], it.rot[2]);
210
- q.setFromEuler(e);
211
- m.compose(new THREE.Vector3(...it.pos), q, new THREE.Vector3(...it.scale));
212
- im.setMatrixAt(i, m);
213
- if (it.color !== undefined) im.setColorAt(i, c.set(it.color));
214
- });
215
- im.instanceMatrix.needsUpdate = true;
216
- if (im.instanceColor) im.instanceColor.needsUpdate = true;
217
- scene.add(im);
218
- return im;
219
- }
220
- }
221
-
222
- /* ------------------------------------------------------------------ *
223
- * 4. 树木:主干(合批)+ 叶簇(Instancing)
224
- * ------------------------------------------------------------------ */
225
- const SPECIES = {
226
- pine: { leaf: 0x35543a, scale: [1.0, 0.42, 1.0], clusters: 5, trunk: 0x4a3a2a, h: 7.5 },
227
- willow: { leaf: 0x7c9a52, scale: [0.62, 0.36, 0.62], clusters: 9, trunk: 0x5a4a34, h: 8.5 },
228
- osmanthus: { leaf: 0x456b3c, scale: [1.0, 0.78, 1.0], clusters: 8, trunk: 0x55452f, h: 6.2 },
229
- gingko: { leaf: 0x9aa548, scale: [0.85, 1.10, 0.85], clusters: 7, trunk: 0x615540, h: 9.0 },
230
- magnolia: { leaf: 0x548044, scale: [0.85, 0.95, 0.85], clusters: 7, trunk: 0x5b4c38, h: 7.0 },
231
- plum: { leaf: 0x6b7a48, scale: [0.72, 0.60, 0.72], clusters: 6, trunk: 0x41372c, h: 5.2 },
232
- maple: { leaf: 0x9b5138, scale: [0.92, 0.84, 0.92], clusters: 7, trunk: 0x4d4030, h: 6.4 },
233
- peach: { leaf: 0xc48a92, scale: [0.80, 0.66, 0.80], clusters: 7, trunk: 0x55402f, h: 5.4 },
234
- };
235
- function addTree(ctx, sp, x, z, s, seed, collectors, trunkBatch, M) {
236
- const cfg = SPECIES[sp];
237
- const rnd = mulberry32(seed);
238
- const y = terrainHeight(x, z);
239
- const H = cfg.h * s;
240
- const lean = (rnd() - 0.5) * 0.5;
241
- // 主干:三段渐细圆柱
242
- const seg = 3;
243
- for (let i = 0; i < seg; i++) {
244
- const t0 = i / seg, t1 = (i + 1) / seg;
245
- const r0 = 0.30 * s * (1 - t0 * 0.55), r1 = 0.30 * s * (1 - t1 * 0.55);
246
- const g = new THREE.CylinderGeometry(r1, r0, H * (t1 - t0) + 0.06, 8);
247
- put(trunkBatch, g, M.bark,
248
- [x + lean * t0 * s, y + H * (t0 + t1) / 2, z + lean * t0 * s * 0.4],
249
- [(rnd() - 0.5) * 0.06, rnd() * 6.28, lean * 0.35]);
250
- }
251
- // 分枝
252
- for (let k = 0; k < 3; k++) {
253
- const a = rnd() * Math.PI * 2;
254
- const L = H * (0.22 + rnd() * 0.18);
255
- const g = new THREE.CylinderGeometry(0.045 * s, 0.10 * s, L, 6);
256
- put(trunkBatch, g, M.bark,
257
- [x + Math.cos(a) * L * 0.35, y + H * (0.58 + k * 0.10), z + Math.sin(a) * L * 0.35],
258
- [Math.sin(a) * 0.7, 0, -Math.cos(a) * 0.7]);
259
- }
260
- // 叶簇
261
- const leaf = collectors[sp];
262
- const n = Math.round(cfg.clusters * (0.8 + rnd() * 0.5));
263
- for (let i = 0; i < n; i++) {
264
- const a = rnd() * Math.PI * 2;
265
- const r = (sp === 'pine' || sp === 'willow' ? 1.0 : 0.75) * (0.35 + rnd() * 0.72) * H * 0.42;
266
- const hy = sp === 'pine' ? H * (0.52 + (i % 3) * 0.16) : H * (0.62 + (rnd() - 0.5) * 0.42);
267
- const sz = (0.62 + rnd() * 0.62) * s * (sp === 'pine' ? 1.45 : 1.0);
268
- const col = new THREE.Color(cfg.leaf);
269
- col.offsetHSL((rnd() - 0.5) * 0.035, (rnd() - 0.5) * 0.10, (rnd() - 0.5) * 0.12);
270
- leaf.add([x + Math.cos(a) * r + lean * s, y + hy, z + Math.sin(a) * r],
271
- [rnd() * 0.4, rnd() * 6.28, rnd() * 0.4],
272
- [cfg.scale[0] * sz, cfg.scale[1] * sz, cfg.scale[2] * sz], col);
273
- if (sp === 'willow') {
274
- // 下垂柳条
275
- for (let k = 0; k < 3; k++) {
276
- const t = (k + 1) / 4;
277
- leaf.add([x + Math.cos(a) * r * 1.15, y + hy - t * H * 0.40, z + Math.sin(a) * r * 1.15],
278
- [0, rnd() * 6.28, 0], [0.22 * s, (0.42 + rnd() * 0.3) * s, 0.22 * s], col);
279
- }
280
- }
281
- }
282
- // 玉兰 / 梅 / 桃花:点缀花簇
283
- if (sp === 'magnolia' || sp === 'plum' || sp === 'peach') {
284
- const flower = collectors.flower;
285
- const fc = sp === 'magnolia' ? 0xf3ece0 : sp === 'plum' ? 0xe9c9cf : 0xe8a3ab;
286
- for (let i = 0; i < 9; i++) {
287
- const a = rnd() * Math.PI * 2, r = rnd() * H * 0.32;
288
- flower.add([x + Math.cos(a) * r, y + H * (0.60 + rnd() * 0.34), z + Math.sin(a) * r],
289
- [0, rnd() * 6.28, 0], [0.16 * s, 0.16 * s, 0.16 * s], new THREE.Color(fc));
290
- }
291
- }
292
- return { x, z, y, H };
293
- }
294
-
295
- /* ------------------------------------------------------------------ *
296
- * 5. 竹、芭蕉、荷、芦苇、草、苔
297
- * ------------------------------------------------------------------ */
298
- function buildBamboo(scene, M, ctx, collectors, count) {
299
- const rnd = mulberry32(3301);
300
- const cane = collectors.bambooCane, leaf = collectors.bambooLeaf;
301
- const regions = [
302
- { x: -84, z: 40, rx: 14, rz: 24, n: Math.round(count * 0.36) },
303
- { x: -94, z: -8, rx: 12, rz: 22, n: Math.round(count * 0.20) },
304
- { x: 76, z: -66, rx: 16, rz: 16, n: Math.round(count * 0.16) },
305
- { x: -34, z: -24, rx: 6, rz: 5, n: Math.round(count * 0.10) }, // 方丈岛
306
- { x: 42, z: -62, rx: 14, rz: 10, n: Math.round(count * 0.18) },
307
- ];
308
- regions.forEach(rg => {
309
- for (let i = 0; i < rg.n; i++) {
310
- let x = rg.x + (rnd() - 0.5) * rg.rx * 2, z = rg.z + (rnd() - 0.5) * rg.rz * 2;
311
- if (waterSDF(x, z) < 0.1) continue;
312
- // 月洞门 → 假山主峰的框景视线通廊:把竹子推到通廊两侧,避免竹竿贴脸遮挡画面
313
- if (Math.abs(x + 79) < 9 && z > 14 && z < 62) x += (x > -79 ? 11 : -11) + (rnd() - 0.5) * 2;
314
- if (waterSDF(x, z) < 0.1) continue;
315
- for (const [bx, bz, bw, bd] of FOOTPRINTS) {
316
- if (Math.abs(x - bx) < bw / 2 && Math.abs(z - bz) < bd / 2) { x += 3; break; }
317
- }
318
- const y = terrainHeight(x, z);
319
- const h = 4.4 + rnd() * 3.8;
320
- cane.add([x, y + h / 2, z], [(rnd() - 0.5) * 0.06, rnd() * 6.28, (rnd() - 0.5) * 0.06],
321
- [1, h / 6, 1], new THREE.Color().setHSL(0.24 + rnd() * 0.05, 0.30, 0.34 + rnd() * 0.14));
322
- for (let k = 0; k < 5; k++) {
323
- const a = rnd() * Math.PI * 2;
324
- leaf.add([x + Math.cos(a) * (0.5 + rnd()), y + h * (0.62 + k * 0.075), z + Math.sin(a) * (0.5 + rnd())],
325
- [rnd() * 0.5, rnd() * 6.28, rnd() * 0.4],
326
- [0.55 + rnd() * 0.35, 0.12, 0.55 + rnd() * 0.35],
327
- new THREE.Color().setHSL(0.25 + rnd() * 0.06, 0.34, 0.30 + rnd() * 0.16));
328
- }
329
- }
330
- });
331
- }
332
- function buildBanana(scene, M, ctx, BatchClass) {
333
- const B = new BatchClass(40);
334
- const rnd = mulberry32(4411);
335
- const leafMat = new THREE.MeshStandardMaterial({ color: 0x67924a, roughness: 0.88, side: THREE.DoubleSide });
336
- leafMat.name = 'bananaLeaf';
337
- const spots = [[-93, 36], [-95, 28], [-88, 20], [-68, 54], [62, 20], [70, 14], [26, 40], [-26, 40], [80, -32]];
338
- spots.forEach(([x, z], i) => {
339
- const y = terrainHeight(x, z);
340
- put(B, new THREE.CylinderGeometry(0.10, 0.16, 1.5, 7), M.bark, [x, y + 0.75, z]);
341
- for (let k = 0; k < 6; k++) {
342
- const a = k * Math.PI / 3 + rnd() * 0.4;
343
- const len = 1.5 + rnd() * 0.9;
344
- const shape = new THREE.Shape();
345
- shape.moveTo(0, 0);
346
- shape.bezierCurveTo(0.26, len * 0.25, 0.30, len * 0.7, 0, len);
347
- shape.bezierCurveTo(-0.30, len * 0.7, -0.26, len * 0.25, 0, 0);
348
- const g = new THREE.ExtrudeGeometry(shape, { depth: 0.02, bevelEnabled: false, curveSegments: 5 });
349
- g.rotateX(-Math.PI / 2 + 0.55);
350
- put(B, g, leafMat, [x, y + 1.45, z], [0, a, 0], 0, { noShadow: true });
351
- }
352
- });
353
- const g = new THREE.Group(); g.name = '芭蕉'; scene.add(g); B.build(g);
354
- return g;
355
- }
356
- function buildLotus(scene, collectors, quality) {
357
- const rnd = mulberry32(5511);
358
- const leaf = collectors.lotus, flower = collectors.lotusFlower, reed = collectors.reed;
359
- const beds = [
360
- { x: 46, z: 8, n: 260 }, { x: 12, z: 4, n: 180 }, { x: -20, z: 2, n: 170 },
361
- { x: 34, z: -26, n: 140 }, { x: -46, z: -36, n: 120 }, { x: 8, z: -38, n: 110 },
362
- ];
363
- const total = Math.round(beds.reduce((a, b) => a + b.n, 0) * (0.45 + quality.leaves * 0.55));
364
- let made = 0;
365
- beds.forEach(b => {
366
- const n = Math.round(b.n * (0.45 + quality.leaves * 0.55));
367
- for (let i = 0; i < n; i++) {
368
- const a = rnd() * Math.PI * 2, r = Math.sqrt(rnd()) * 13;
369
- const x = b.x + Math.cos(a) * r, z = b.z + Math.sin(a) * r;
370
- if (waterSDF(x, z) > -0.35) continue;
371
- const s = 0.55 + rnd() * 0.95;
372
- const y = WORLD.waterY + 0.03 + rnd() * 0.06;
373
- const col = new THREE.Color().setHSL(0.27 + rnd() * 0.05, 0.34, 0.30 + rnd() * 0.14);
374
- leaf.add([x, y, z], [0, rnd() * 6.28, (rnd() - 0.5) * 0.10], [s, s, s], col);
375
- if (rnd() < 0.14) {
376
- flower.add([x, y + 0.16, z], [0, rnd() * 6.28, 0], [s * 0.8, s * 0.8, s * 0.8],
377
- new THREE.Color(rnd() < 0.7 ? 0xf2d2d8 : 0xf6ece0));
378
- }
379
- made++;
380
- }
381
- });
382
- // 芦苇与菖蒲(岸边)
383
- for (let i = 0; i < 220; i++) {
384
- const x = (rnd() - 0.5) * 180, z = (rnd() - 0.5) * 100;
385
- const d = waterSDF(x, z);
386
- if (d > -0.15 || d < -2.6) continue;
387
- const s = 0.8 + rnd() * 1.2;
388
- reed.add([x, WORLD.waterY + 0.4 * s, z], [0, rnd() * 6.28, 0], [s, s, s],
389
- new THREE.Color().setHSL(0.19 + rnd() * 0.08, 0.30, 0.32 + rnd() * 0.16));
390
- }
391
- return made;
392
- }
393
- function buildGrass(scene, M, quality, fogColor) {
394
- const rnd = mulberry32(6611);
395
- const count = quality.grass;
396
- const geo = bladeGeo();
397
- const mat = new THREE.ShaderMaterial({
398
- uniforms: {
399
- uCam: { value: new THREE.Vector3() },
400
- uTime: { value: 0 },
401
- uNear: { value: 26 * quality.lodScale },
402
- uFar: { value: 62 * quality.lodScale },
403
- uFogColor: { value: fogColor.clone() },
404
- uWet: { value: 0 },
405
- },
406
- vertexShader: GRASS_VERT, fragmentShader: GRASS_FRAG,
407
- side: THREE.DoubleSide, vertexColors: false,
408
- });
409
- const im = new THREE.InstancedMesh(geo, mat, count);
410
- im.name = '书带草';
411
- im.frustumCulled = false;
412
- const m = new THREE.Matrix4(), q = new THREE.Quaternion(), e = new THREE.Euler();
413
- let used = 0;
414
- for (let i = 0; i < count * 3 && used < count; i++) {
415
- const x = (rnd() - 0.5) * 216, z = (rnd() - 0.5) * 186;
416
- if (waterSDF(x, z) < 0.3) continue;
417
- let blocked = false;
418
- for (const [bx, bz, bw, bd] of FOOTPRINTS) {
419
- if (Math.abs(x - bx) < bw / 2 + 0.4 && Math.abs(z - bz) < bd / 2 + 0.4) { blocked = true; break; }
420
- }
421
- if (blocked) continue;
422
- const y = terrainHeight(x, z);
423
- const s = 0.55 + rnd() * 1.15;
424
- e.set(0, rnd() * 6.28, (rnd() - 0.5) * 0.2);
425
- q.setFromEuler(e);
426
- m.compose(new THREE.Vector3(x, y, z), q, new THREE.Vector3(s, s, s));
427
- im.setMatrixAt(used, m);
428
- used++;
429
- }
430
- im.count = used;
431
- im.userData.maxCount = used;
432
- im.instanceMatrix.needsUpdate = true;
433
- scene.add(im);
434
- return im;
435
- }
436
-
437
- /* ------------------------------------------------------------------ *
438
- * 6. 远景林带与借景远山
439
- * ------------------------------------------------------------------ */
440
- function buildDistantForest(scene, M, quality) {
441
- const rnd = mulberry32(7711);
442
- // 低模树:不规则双团树冠 + 细干,合并为单几何(远景剪影比纯圆锥自然)
443
- const parts = [];
444
- const trunk = new THREE.CylinderGeometry(0.30, 0.52, 2.6, 5);
445
- trunk.translate(0, 1.3, 0); parts.push(trunk);
446
- const crown = new THREE.IcosahedronGeometry(1, 0);
447
- crown.scale(2.05, 2.55, 1.95); crown.translate(0, 4.1, 0); parts.push(crown);
448
- const crown2 = new THREE.IcosahedronGeometry(1, 0);
449
- crown2.scale(1.30, 1.45, 1.28); crown2.translate(0.55, 5.9, -0.30); parts.push(crown2);
450
- // 简易合并(都用同样属性)
451
- const pos = [], nrm = [], uv = [], idx = [];
452
- parts.forEach(p => {
453
- const g = p.index ? p.toNonIndexed() : p;
454
- const pp = g.getAttribute('position'), nn = g.getAttribute('normal'), uu = g.getAttribute('uv');
455
- const off = pos.length / 3;
456
- for (let i = 0; i < pp.count; i++) {
457
- pos.push(pp.getX(i), pp.getY(i), pp.getZ(i));
458
- nrm.push(nn.getX(i), nn.getY(i), nn.getZ(i));
459
- uv.push(uu ? uu.getX(i) : 0, uu ? uu.getY(i) : 0);
460
- idx.push(off + i);
461
- }
462
- if (g !== p) g.dispose();
463
- });
464
- const geo = new THREE.BufferGeometry();
465
- geo.setAttribute('position', new THREE.Float32BufferAttribute(pos, 3));
466
- geo.setAttribute('normal', new THREE.Float32BufferAttribute(nrm, 3));
467
- geo.setAttribute('uv', new THREE.Float32BufferAttribute(uv, 2));
468
- geo.setIndex(idx);
469
- const mat = new THREE.MeshLambertMaterial({ color: 0x72836a });
470
- const n = Math.round(640 * quality.trees);
471
- const im = new THREE.InstancedMesh(geo, mat, n);
472
- im.name = '远景林带(L3 低模)';
473
- im.frustumCulled = false;
474
- const m = new THREE.Matrix4(), q = new THREE.Quaternion(), e = new THREE.Euler();
475
- const c = new THREE.Color();
476
- for (let i = 0; i < n; i++) {
477
- const a = rnd() * Math.PI * 2;
478
- const r = 145 + rnd() * 105; // 全部落在 640×560 地形范围内
479
- let x = Math.cos(a) * r, z = Math.sin(a) * r * 0.92;
480
- // 北寺塔方向留出视线通廊:把树推离视廊而不是跳过(避免留下单位矩阵实例)
481
- if (x < -120 && z < -120 && Math.abs(x - z * 0.78) < 55) x -= 95;
482
- const y = terrainHeight(x, z);
483
- const s = 0.70 + rnd() * 0.85;
484
- e.set(0, rnd() * 6.28, 0); q.setFromEuler(e);
485
- m.compose(new THREE.Vector3(x, y - 0.4, z), q, new THREE.Vector3(s, s * (0.82 + rnd() * 0.5), s));
486
- im.setMatrixAt(i, m);
487
- // 低饱和灰绿,随大气雾自然消隐
488
- im.setColorAt(i, c.setHSL(0.26 + rnd() * 0.07, 0.12 + rnd() * 0.16, 0.34 + rnd() * 0.18));
489
- }
490
- im.instanceMatrix.needsUpdate = true;
491
- im.userData.maxCount = n;
492
- if (im.instanceColor) im.instanceColor.needsUpdate = true;
493
- scene.add(im);
494
- return im;
495
- }
496
- function buildMountains(scene) {
497
- const group = new THREE.Group(); group.name = '借景远山 · 灵岩山脊';
498
- // 山脊全部落在地形网格内(z ≥ −280),避免地形边缘出现硬切直线
499
- const layers = [
500
- { z: -212, h: 18, color: 0x778b88, amp: 1.0 },
501
- { z: -246, h: 28, color: 0x8b9c9b, amp: 1.4 },
502
- { z: -276, h: 40, color: 0xa3b1ae, amp: 1.8 },
503
- ];
504
- layers.forEach((L, li) => {
505
- const N = 90, pos = [], col = [], idx = [];
506
- const c = new THREE.Color(L.color);
507
- for (let i = 0; i <= N; i++) {
508
- const x = -310 + i * 620 / N;
509
- const ridge = (Math.sin(x * 0.011 + li * 1.7) * 0.5 + Math.sin(x * 0.027 + li * 2.3) * 0.28
510
- + Math.sin(x * 0.005 + 1.1) * 0.42 + 0.8) * L.h * L.amp;
511
- const baseY = terrainHeight(x, L.z) - 4;
512
- pos.push(x, baseY, L.z, x, baseY + ridge, L.z + Math.sin(x * 0.01) * 8);
513
- col.push(c.r * 0.72, c.g * 0.72, c.b * 0.72, c.r, c.g, c.b);
514
- }
515
- for (let i = 0; i < N; i++) {
516
- const a = i * 2;
517
- idx.push(a, a + 1, a + 2, a + 1, a + 3, a + 2);
518
- }
519
- const g = new THREE.BufferGeometry();
520
- g.setAttribute('position', new THREE.Float32BufferAttribute(pos, 3));
521
- g.setAttribute('color', new THREE.Float32BufferAttribute(col, 3));
522
- g.setIndex(idx); g.computeVertexNormals();
523
- const m = new THREE.MeshBasicMaterial({ vertexColors: true, side: THREE.DoubleSide, fog: true });
524
- const mesh = new THREE.Mesh(g, m);
525
- mesh.name = '山脊层' + li;
526
- group.add(mesh);
527
- });
528
- scene.add(group);
529
- return group;
530
- }
531
-
532
- /* ------------------------------------------------------------------ *
533
- * 7. 主入口
534
- * ------------------------------------------------------------------ */
535
- export function createNature(scene, M, ctx) {
536
- const quality = ctx.quality;
537
- const BatchClass = ctx.BatchClass;
538
- const terrain = buildTerrain(scene, M);
539
- const pathGroup = buildPathPatches(scene, M, BatchClass);
540
-
541
- // 收集器
542
- const leafGeo = tuftGeo();
543
- const collectors = {};
544
- Object.keys(SPECIES).forEach(k => {
545
- const mat = new THREE.MeshStandardMaterial({
546
- color: SPECIES[k].leaf, roughness: 0.92, flatShading: true, side: THREE.DoubleSide,
547
- });
548
- mat.name = 'leaf_' + k;
549
- collectors[k] = new InstCollector(leafGeo, mat, '叶簇_' + k);
550
- });
551
- collectors.flower = new InstCollector(new THREE.IcosahedronGeometry(1, 0),
552
- new THREE.MeshStandardMaterial({ color: 0xffffff, roughness: 0.85, flatShading: true }), '花簇');
553
- const bambooMat = new THREE.MeshStandardMaterial({ color: 0x8aa264, roughness: 0.78 });
554
- collectors.bambooCane = new InstCollector(new THREE.CylinderGeometry(0.055, 0.065, 6, 6, 1), bambooMat, '竹竿');
555
- collectors.bambooLeaf = new InstCollector(new THREE.PlaneGeometry(1, 0.26),
556
- new THREE.MeshStandardMaterial({ color: 0x6e924c, roughness: 0.9, side: THREE.DoubleSide }), '竹叶');
557
- const lotusMat = new THREE.MeshStandardMaterial({ color: 0xffffff, roughness: 0.86, side: THREE.DoubleSide, vertexColors: true });
558
- collectors.lotus = new InstCollector(lotusLeafGeo(), lotusMat, '荷叶');
559
- collectors.lotusFlower = new InstCollector(petalGeo(), new THREE.MeshStandardMaterial({
560
- color: 0xffffff, roughness: 0.82, side: THREE.DoubleSide }), '荷花');
561
- collectors.reed = new InstCollector(new THREE.ConeGeometry(0.10, 1.4, 4), new THREE.MeshStandardMaterial({
562
- color: 0x7d8c52, roughness: 0.9 }), '芦苇');
563
-
564
- // 树干合批
565
- const trunkBatch = new BatchClass(40);
566
- // 景区化植物配置
567
- const regions = [
568
- { x0: -102, x1: -44, z0: -74, z1: -12, sp: ['pine', 'plum', 'pine', 'maple'], n: 34, s: [0.8, 1.3] }, // 云根叠翠
569
- { x0: -104, x1: -66, z0: 22, z1: 76, sp: ['plum', 'osmanthus'], n: 22, s: [0.7, 1.0] }, // 竹里馆
570
- { x0: 30, x1: 100, z0: 6, z1: 34, sp: ['willow', 'peach', 'magnolia'], n: 24, s: [0.85, 1.2] }, // 荷风
571
- { x0: 48, x1: 100, z0: -84, z1: -36, sp: ['osmanthus', 'gingko', 'maple'], n: 26, s: [0.8, 1.2] }, // 小山丛桂
572
- { x0: -30, x1: 34, z0: 34, z1: 74, sp: ['magnolia', 'osmanthus'], n: 18, s: [0.8, 1.1] }, // 前庭
573
- { x0: -100, x1: -32, z0: -8, z1: 24, sp: ['willow', 'plum', 'pine'], n: 20, s: [0.8, 1.1] },// 漱石枕流
574
- { x0: -20, x1: 60, z0: -88, z1: -56, sp: ['pine', 'osmanthus', 'gingko'], n: 22, s: [0.8, 1.15] }, // 北岸
575
- { x0: 66, x1: 104, z0: -30, z1: 4, sp: ['willow', 'peach'], n: 14, s: [0.8, 1.1] }, // 东岸
576
- ];
577
- const rnd = mulberry32(9911);
578
- let treeCount = 0;
579
- regions.forEach((rg, ri) => {
580
- const n = Math.round(rg.n * (0.55 + quality.trees * 0.45));
581
- let local = 0;
582
- for (let i = 0; i < n * 10 && local < n; i++) {
583
- const x = rg.x0 + rnd() * (rg.x1 - rg.x0), z = rg.z0 + rnd() * (rg.z1 - rg.z0);
584
- if (!freeLand(x, z, 2.4)) continue;
585
- const ft = clamp((51 - z) / 91, 0, 1);
586
- if (ft > 0.02 && ft < 1 && Math.abs(x + 81.3 - 17.3 * ft) < 6) continue;
587
- const sp = rg.sp[Math.floor(rnd() * rg.sp.length)];
588
- const s = rg.s[0] + rnd() * (rg.s[1] - rg.s[0]);
589
- addTree(ctx, sp, x, z, s, 10000 + ri * 1000 + i, collectors, trunkBatch, M);
590
- treeCount++; local++;
591
- }
592
- });
593
- // 中轴对植玉兰(对称礼序)
594
- [[-9, 68], [9, 68], [-9, 48], [9, 48], [-11, 40], [11, 40]].forEach(([x, z], i) => {
595
- addTree(ctx, 'magnolia', x, z, 0.95, 20000 + i, collectors, trunkBatch, M);
596
- });
597
- // 水边垂柳(对景构图)
598
- [[-24, 20], [-16, 20], [22, 20], [34, 18], [52, 14], [-58, 2], [8, -46], [-20, -46], [60, -20]].forEach(([x, z], i) => {
599
- if (freeLand(x, z, 0.6) || waterSDF(x, z) > -1.2)
600
- addTree(ctx, 'willow', x, z, 1.05, 21000 + i, collectors, trunkBatch, M);
601
- });
602
-
603
- const trunkGroup = new THREE.Group(); trunkGroup.name = '树干与枝'; scene.add(trunkGroup);
604
- const trunkStats = trunkBatch.build(trunkGroup);
605
-
606
- // 竹、荷、芦苇先填充实例数据,再统一创建 InstancedMesh(一次性成型)
607
- buildBamboo(scene, M, ctx, collectors, Math.round(520 * quality.trees));
608
- buildLotus(scene, collectors, quality);
609
- const instances = [];
610
- Object.values(collectors).forEach(c => {
611
- const im = c.build(scene, { castShadow: c.name.startsWith('叶簇'), receiveShadow: false, frustumCulled: false });
612
- if (im) instances.push(im);
613
- });
614
-
615
- const banana = buildBanana(scene, M, ctx, BatchClass);
616
- const grassMat = new THREE.Color(0xb9c2ba);
617
- // 始终按最高档容量分配实例缓冲,画质切换只改 count,避免重建几何
618
- const grass = buildGrass(scene, M, QUALITY.high, grassMat);
619
- const forest = buildDistantForest(scene, M, QUALITY.high);
620
- const mountains = buildMountains(scene);
621
-
622
- const api = {
623
- terrain, pathGroup, trunkGroup, trunkStats, instances, grass, forest, mountains, treeCount,
624
- applyQuality(q) {
625
- grass.material.uniforms.uNear.value = 26 * q.lodScale;
626
- grass.material.uniforms.uFar.value = 62 * q.lodScale;
627
- const target = Math.round(q.grass);
628
- grass.count = Math.min(grass.userData.maxCount, target);
629
- const ft = Math.round(640 * q.trees);
630
- forest.count = Math.min(forest.userData.maxCount, ft);
631
- grass.material.uniforms.uWet.value = api._wet || 0;
632
- },
633
- setWeather(w, sky) {
634
- api._wet = w === 'rain' ? 1 : 0;
635
- grass.material.uniforms.uWet.value = api._wet;
636
- if (grass.material.uniforms.uFogColor) grass.material.uniforms.uFogColor.value.copy(sky.fogColor);
637
- const k = w === 'rain' ? 0.76 : w === 'mist' ? 0.90 : 1.0;
638
- Object.keys(SPECIES).forEach(key => {
639
- const c = collectors[key];
640
- if (c.mat) { c.mat.color.set(SPECIES[key].leaf).multiplyScalar(k); }
641
- });
642
- },
643
- update(t, camera) {
644
- grass.material.uniforms.uTime.value = t;
645
- grass.material.uniforms.uCam.value.copy(camera.position);
646
- },
647
- };
648
- api.applyQuality(quality);
649
- return api;
650
- }