@aura3d/rendering 1.3.3 → 1.4.1

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 (314) hide show
  1. package/dist/ForwardPass.js +7 -1
  2. package/dist/ForwardPass.js.map +1 -1
  3. package/dist/MorphTarget.d.ts +1 -0
  4. package/dist/MorphTarget.d.ts.map +1 -1
  5. package/dist/MorphTarget.js.map +1 -1
  6. package/dist/Renderer.js +7 -1
  7. package/dist/Renderer.js.map +1 -1
  8. package/package.json +38 -4
  9. package/src/ArchitecturalLightingFixtures.ts +0 -241
  10. package/src/ArchitecturalMaterialCatalog.ts +0 -130
  11. package/src/ArchitecturalMeasurementFixtures.ts +0 -155
  12. package/src/BRDFLut.ts +0 -47
  13. package/src/CameraFraming.ts +0 -200
  14. package/src/CanonicalSceneFixtures.ts +0 -95
  15. package/src/CascadedShadowMaps.ts +0 -449
  16. package/src/ColorManagement.ts +0 -127
  17. package/src/CullingFixtures.ts +0 -280
  18. package/src/DecalGeometry.ts +0 -26
  19. package/src/DepthPass.ts +0 -110
  20. package/src/EnvironmentBackgroundPass.ts +0 -194
  21. package/src/EnvironmentBackgroundResources.ts +0 -309
  22. package/src/EnvironmentLighting.ts +0 -96
  23. package/src/EnvironmentMapResources.ts +0 -1026
  24. package/src/EnvironmentPipeline.ts +0 -69
  25. package/src/EnvironmentPlatform.ts +0 -1306
  26. package/src/EnvironmentPreset.ts +0 -155
  27. package/src/Exposure.ts +0 -66
  28. package/src/ExternalParityRenderPreset.ts +0 -725
  29. package/src/ForwardPass.ts +0 -1663
  30. package/src/FrameVisualMetrics.ts +0 -301
  31. package/src/Geometry.ts +0 -461
  32. package/src/GeometryPrimitives.ts +0 -2
  33. package/src/HDRRenderPipeline.ts +0 -94
  34. package/src/IBL.ts +0 -86
  35. package/src/IndexBuffer.ts +0 -57
  36. package/src/InstancedPBRMaterial.ts +0 -186
  37. package/src/InstancedUnlitMaterial.ts +0 -60
  38. package/src/Instancing.ts +0 -19
  39. package/src/LightCollector.ts +0 -82
  40. package/src/LightUniforms.ts +0 -47
  41. package/src/LightingDebug.ts +0 -80
  42. package/src/LightingDefaults.ts +0 -79
  43. package/src/LightingRig.ts +0 -301
  44. package/src/LineGeometry.ts +0 -2
  45. package/src/Material.ts +0 -209
  46. package/src/MaterialBinding.ts +0 -131
  47. package/src/MaterialInstance.ts +0 -59
  48. package/src/MaterialPresets.ts +0 -272
  49. package/src/MorphTarget.ts +0 -123
  50. package/src/MorphTargetPlan.ts +0 -178
  51. package/src/MorphUnlitMaterial.ts +0 -60
  52. package/src/NormalMappedPBRMaterial.ts +0 -188
  53. package/src/OceanFixtures.ts +0 -318
  54. package/src/PBRLightingDefaults.ts +0 -12
  55. package/src/PBRMaterial.ts +0 -442
  56. package/src/PMREM.ts +0 -53
  57. package/src/PbrReference.ts +0 -681
  58. package/src/PostProcessPass.ts +0 -2507
  59. package/src/ProceduralTextureFixtures.ts +0 -393
  60. package/src/ProductTurntableFixtures.ts +0 -815
  61. package/src/Raycaster.ts +0 -21
  62. package/src/ReflectionProbe.ts +0 -13
  63. package/src/ReflectionSurfaces.ts +0 -219
  64. package/src/RenderBackend.ts +0 -43
  65. package/src/RenderDebugViews.ts +0 -138
  66. package/src/RenderDevice.ts +0 -836
  67. package/src/RenderGraph.ts +0 -194
  68. package/src/RenderPass.ts +0 -27
  69. package/src/RenderPipeline.ts +0 -101
  70. package/src/RenderQueue.ts +0 -12
  71. package/src/RenderState.ts +0 -12
  72. package/src/Renderer.ts +0 -2626
  73. package/src/RendererDebugOverlay.ts +0 -80
  74. package/src/RendererFeatureGates.ts +0 -150
  75. package/src/RendererPostprocessPlan.ts +0 -279
  76. package/src/RendererTiming.ts +0 -251
  77. package/src/RendererVisualPipelineReport.ts +0 -836
  78. package/src/ResourceLifecycle.ts +0 -21
  79. package/src/Sampler.ts +0 -37
  80. package/src/SceneOptimization.ts +0 -518
  81. package/src/ShaderChunks.ts +0 -393
  82. package/src/ShaderLibrary.ts +0 -2766
  83. package/src/ShaderModule.ts +0 -36
  84. package/src/ShaderPreprocessor.ts +0 -260
  85. package/src/ShaderReflection.ts +0 -201
  86. package/src/ShadowMap.ts +0 -237
  87. package/src/ShadowPass.ts +0 -198
  88. package/src/ShadowProjection.ts +0 -115
  89. package/src/SkinnedLitMaterial.ts +0 -397
  90. package/src/SkinnedUnlitMaterial.ts +0 -63
  91. package/src/SkinningBounds.ts +0 -131
  92. package/src/SpaceEnvironmentFixtures.ts +0 -200
  93. package/src/SpriteGeometry.ts +0 -21
  94. package/src/StereoCameraRig.ts +0 -127
  95. package/src/StereoEffects.ts +0 -274
  96. package/src/TerrainFixtures.ts +0 -180
  97. package/src/Texture.ts +0 -307
  98. package/src/TextureBinding.ts +0 -91
  99. package/src/TexturedPBRMaterial.ts +0 -1112
  100. package/src/TexturedUnlitMaterial.ts +0 -67
  101. package/src/ToneMapping.ts +0 -105
  102. package/src/UniformBinder.ts +0 -16
  103. package/src/UniformLayout.ts +0 -129
  104. package/src/UnlitMaterial.ts +0 -75
  105. package/src/VegetationFixtures.ts +0 -314
  106. package/src/VertexBuffer.ts +0 -120
  107. package/src/VertexFormat.ts +0 -171
  108. package/src/VoxelWorldFixtures.ts +0 -280
  109. package/src/WeatherFixtures.ts +0 -223
  110. package/src/WebGL2Device.ts +0 -2280
  111. package/src/WebGL2StateCache.ts +0 -330
  112. package/src/WebGPUDevice.ts +0 -2877
  113. package/src/WebGPURenderToTextureProof.ts +0 -139
  114. package/src/advanced-runtime/AdvancedRenderer.ts +0 -73
  115. package/src/advanced-runtime/index.ts +0 -9
  116. package/src/animation/AnimationMaterialStyle.ts +0 -32
  117. package/src/animation/AnimationRenderPreset.ts +0 -45
  118. package/src/animation/AnimationToonMaterial.ts +0 -387
  119. package/src/animation/AnimationVisualQuality.ts +0 -71
  120. package/src/animation/applyAnimationRenderPreset.ts +0 -180
  121. package/src/animation/index.ts +0 -5
  122. package/src/cinematic/BloomPass.ts +0 -26
  123. package/src/cinematic/CinematicDepthComposition.ts +0 -30
  124. package/src/cinematic/CinematicEvidence.ts +0 -123
  125. package/src/cinematic/CinematicLightingRig.ts +0 -144
  126. package/src/cinematic/CinematicMaterialPresets.ts +0 -130
  127. package/src/cinematic/CinematicPostProcess.ts +0 -83
  128. package/src/cinematic/DepthHazePass.ts +0 -30
  129. package/src/cinematic/EmissivePracticalLightSystem.ts +0 -45
  130. package/src/cinematic/FilmGrainPass.ts +0 -24
  131. package/src/cinematic/FogVolumeSystem.ts +0 -30
  132. package/src/cinematic/GlowCardSystem.ts +0 -44
  133. package/src/cinematic/RainParticleSystem.ts +0 -151
  134. package/src/cinematic/VignettePass.ts +0 -25
  135. package/src/cinematic/WetReflectionApproximation.ts +0 -27
  136. package/src/cinematic/index.ts +0 -14
  137. package/src/effects/CollisionModule.ts +0 -64
  138. package/src/effects/ColorModule.ts +0 -60
  139. package/src/effects/ForceModule.ts +0 -25
  140. package/src/effects/GPUParticleBackend.ts +0 -569
  141. package/src/effects/Particle.ts +0 -108
  142. package/src/effects/ParticleDiagnostics.ts +0 -224
  143. package/src/effects/ParticleEffectPresets.ts +0 -147
  144. package/src/effects/ParticleEmitter.ts +0 -326
  145. package/src/effects/ParticleModule.ts +0 -26
  146. package/src/effects/ParticleRenderPass.ts +0 -117
  147. package/src/effects/ParticleRenderer.ts +0 -132
  148. package/src/effects/ParticleSystem.ts +0 -333
  149. package/src/effects/SizeModule.ts +0 -56
  150. package/src/effects/TrailModule.ts +0 -72
  151. package/src/effects/VelocityModule.ts +0 -75
  152. package/src/effects/index.ts +0 -15
  153. package/src/index.ts +0 -925
  154. package/src/materials/AlphaSorting.ts +0 -30
  155. package/src/materials/MaterialExtensions.ts +0 -42
  156. package/src/materials/PhysicalMaterial.ts +0 -133
  157. package/src/materials/TransmissionPass.ts +0 -51
  158. package/src/performance/BVH.ts +0 -18
  159. package/src/performance/Batcher.ts +0 -2
  160. package/src/performance/FrustumCuller.ts +0 -9
  161. package/src/performance/LOD.ts +0 -20
  162. package/src/performance/Octree.ts +0 -10
  163. package/src/performance/RenderItemSorting.ts +0 -170
  164. package/src/performance/RendererStats.ts +0 -43
  165. package/src/performance/ResourceBudget.ts +0 -44
  166. package/src/postprocess/BloomPass.ts +0 -28
  167. package/src/postprocess/CinematicDiagnostics.ts +0 -642
  168. package/src/postprocess/ColorGradingPass.ts +0 -24
  169. package/src/postprocess/DepthOfFieldPass.ts +0 -12
  170. package/src/postprocess/EffectComposer.ts +0 -349
  171. package/src/postprocess/SSAOPass.ts +0 -20
  172. package/src/postprocess/index.ts +0 -34
  173. package/src/production-runtime/AnimationControlsPipeline.ts +0 -77
  174. package/src/production-runtime/PBRHDRPipeline.ts +0 -381
  175. package/src/production-runtime/ProductionEffectsPipeline.ts +0 -85
  176. package/src/production-runtime/ProductionRendererTypes.ts +0 -136
  177. package/src/production-runtime/ProductionRuntimeRenderer.ts +0 -172
  178. package/src/production-runtime/ProductionWebGL2Renderer.ts +0 -313
  179. package/src/production-runtime/ProductionWebGPURenderer.ts +0 -396
  180. package/src/production-runtime/TransmissionBackdropCapture.ts +0 -130
  181. package/src/production-runtime/animation/MorphTargetRenderer.ts +0 -2
  182. package/src/production-runtime/animation/SkinningRenderer.ts +0 -2
  183. package/src/production-runtime/backends/RendererBackend.ts +0 -17
  184. package/src/production-runtime/backends/WebGL2RendererBackend.ts +0 -30
  185. package/src/production-runtime/backends/WebGPURendererBackend.ts +0 -24
  186. package/src/production-runtime/backends/webgl2/WebGL2Buffer.ts +0 -2
  187. package/src/production-runtime/backends/webgl2/WebGL2Capabilities.ts +0 -2
  188. package/src/production-runtime/backends/webgl2/WebGL2RenderTarget.ts +0 -2
  189. package/src/production-runtime/backends/webgl2/WebGL2Shader.ts +0 -2
  190. package/src/production-runtime/backends/webgl2/WebGL2StateCache.ts +0 -1
  191. package/src/production-runtime/backends/webgl2/WebGL2Texture.ts +0 -2
  192. package/src/production-runtime/backends/webgpu/WebGPUBuffer.ts +0 -2
  193. package/src/production-runtime/backends/webgpu/WebGPUCapabilities.ts +0 -2
  194. package/src/production-runtime/backends/webgpu/WebGPURenderTarget.ts +0 -2
  195. package/src/production-runtime/backends/webgpu/WebGPUShader.ts +0 -2
  196. package/src/production-runtime/backends/webgpu/WebGPUTexture.ts +0 -2
  197. package/src/production-runtime/color/ColorManagement.ts +0 -3
  198. package/src/production-runtime/color/ToneMapping.ts +0 -7
  199. package/src/production-runtime/diagnostics/FrameCapture.ts +0 -2
  200. package/src/production-runtime/diagnostics/GPUCapabilities.ts +0 -2
  201. package/src/production-runtime/diagnostics/RendererStats.ts +0 -2
  202. package/src/production-runtime/environment/EnvironmentMap.ts +0 -1
  203. package/src/production-runtime/environment/HDRLoader.ts +0 -57
  204. package/src/production-runtime/environment/PMREMGenerator.ts +0 -713
  205. package/src/production-runtime/framegraph/FrameGraph.ts +0 -18
  206. package/src/production-runtime/framegraph/RenderPass.ts +0 -15
  207. package/src/production-runtime/geometry/ProjectedDecalGeometry.ts +0 -439
  208. package/src/production-runtime/index.ts +0 -127
  209. package/src/production-runtime/lights/LightManager.ts +0 -7
  210. package/src/production-runtime/lights/ShadowMapRenderer.ts +0 -5
  211. package/src/production-runtime/materials/GLTFMaterialAdapter.ts +0 -6
  212. package/src/production-runtime/materials/GLTFPBRMaterialAdapter.ts +0 -2
  213. package/src/production-runtime/materials/MaterialCompiler.ts +0 -7
  214. package/src/production-runtime/materials/MaterialTextureBindings.ts +0 -5
  215. package/src/production-runtime/materials/PBRMaterial.ts +0 -2
  216. package/src/production-runtime/materials/PBRShaderFeatures.ts +0 -2
  217. package/src/production-runtime/passes/ContactShadowPass.ts +0 -184
  218. package/src/production-runtime/passes/DepthPrepass.ts +0 -7
  219. package/src/production-runtime/passes/OpaquePass.ts +0 -7
  220. package/src/production-runtime/passes/ShadowPass.ts +0 -7
  221. package/src/production-runtime/passes/SkyboxPass.ts +0 -7
  222. package/src/production-runtime/passes/ToneMappingPass.ts +0 -7
  223. package/src/production-runtime/passes/TransparentPass.ts +0 -7
  224. package/src/production-runtime/postprocess/BloomPass.ts +0 -51
  225. package/src/production-runtime/postprocess/ColorGradingPass.ts +0 -49
  226. package/src/production-runtime/postprocess/DOFPass.ts +0 -47
  227. package/src/production-runtime/postprocess/FXAAPass.ts +0 -53
  228. package/src/production-runtime/postprocess/ProductionEffectComposer.ts +0 -78
  229. package/src/production-runtime/postprocess/ProductionPostProcessTypes.ts +0 -174
  230. package/src/production-runtime/postprocess/SSAOPass.ts +0 -45
  231. package/src/production-runtime/resources/GPUBuffer.ts +0 -2
  232. package/src/production-runtime/resources/GPUTexture.ts +0 -2
  233. package/src/production-runtime/resources/RenderTarget.ts +0 -3
  234. package/src/production-runtime/resources/ResourceCache.ts +0 -7
  235. package/src/production-runtime/scene/Camera.ts +0 -1
  236. package/src/production-runtime/scene/Lights.ts +0 -2
  237. package/src/production-runtime/scene/RenderableMesh.ts +0 -2
  238. package/src/production-runtime/scene/RenderablePrimitive.ts +0 -1
  239. package/src/production-runtime/scene/RenderableScene.ts +0 -4
  240. package/src/production-runtime/shaders/ShaderProgramLibrary.ts +0 -7
  241. package/src/production-runtime/shaders/chunks/brdf.glsl +0 -2
  242. package/src/production-runtime/shaders/chunks/ibl.glsl +0 -3
  243. package/src/production-runtime/shaders/chunks/pbr.frag.glsl +0 -47
  244. package/src/production-runtime/shaders/chunks/pbr.vert.glsl +0 -8
  245. package/src/production-runtime/shaders/chunks/shadows.glsl +0 -2
  246. package/src/production-runtime/shaders/wgsl/pbr.wgsl +0 -3
  247. package/src/production-runtime/shaders/wgsl/postprocess.wgsl +0 -2
  248. package/src/production-runtime/shaders/wgsl/skybox.wgsl +0 -2
  249. package/src/shaders/depth.frag.glsl +0 -5
  250. package/src/shaders/depth.vert.glsl +0 -8
  251. package/src/shaders/pbr-direct.frag.glsl +0 -687
  252. package/src/shaders/pbr-direct.vert.glsl +0 -18
  253. package/src/shaders/unlit.frag.glsl +0 -18
  254. package/src/shaders/unlit.vert.glsl +0 -13
  255. package/src/shadows/CascadedShadowPipeline.ts +0 -53
  256. package/src/shadows/ContactShadows.ts +0 -106
  257. package/src/shadows/ShadowDebugViews.ts +0 -46
  258. package/src/threejs-compatibility/InstancingSystem.ts +0 -17
  259. package/src/threejs-compatibility/LightingSystem.ts +0 -22
  260. package/src/threejs-compatibility/MaterialSystem.ts +0 -9
  261. package/src/threejs-compatibility/RenderTargetSystem.ts +0 -35
  262. package/src/threejs-compatibility/RendererDiagnostics.ts +0 -61
  263. package/src/threejs-compatibility/SceneRenderer.ts +0 -34
  264. package/src/threejs-compatibility/ShadowSystem.ts +0 -19
  265. package/src/threejs-compatibility/TextureSystem.ts +0 -19
  266. package/src/threejs-compatibility/ThreeCompatRenderer.ts +0 -90
  267. package/src/threejs-compatibility/TransparencySystem.ts +0 -19
  268. package/src/threejs-compatibility/index.ts +0 -29
  269. package/src/threejs-compatibility/performance/BVH.ts +0 -14
  270. package/src/threejs-compatibility/performance/FrustumCulling.ts +0 -10
  271. package/src/threejs-compatibility/performance/Instancing.ts +0 -4
  272. package/src/threejs-compatibility/performance/LODSystem.ts +0 -16
  273. package/src/threejs-compatibility/performance/OcclusionCulling.ts +0 -6
  274. package/src/threejs-compatibility/performance/RaycastAcceleration.ts +0 -12
  275. package/src/threejs-compatibility/performance/RendererProfiler.ts +0 -19
  276. package/src/threejs-compatibility/performance/TextureStreaming.ts +0 -4
  277. package/src/threejs-compatibility/performance/index.ts +0 -12
  278. package/src/threejs-compatibility/postprocess/BloomPass.ts +0 -16
  279. package/src/threejs-compatibility/postprocess/ColorGradingPass.ts +0 -16
  280. package/src/threejs-compatibility/postprocess/DepthOfFieldPass.ts +0 -21
  281. package/src/threejs-compatibility/postprocess/EffectComposer.ts +0 -14
  282. package/src/threejs-compatibility/postprocess/FXAAPass.ts +0 -15
  283. package/src/threejs-compatibility/postprocess/MotionBlurPass.ts +0 -20
  284. package/src/threejs-compatibility/postprocess/OutlinePass.ts +0 -21
  285. package/src/threejs-compatibility/postprocess/PostProcessTypes.ts +0 -169
  286. package/src/threejs-compatibility/postprocess/RenderPass.ts +0 -9
  287. package/src/threejs-compatibility/postprocess/SMAAPass.ts +0 -15
  288. package/src/threejs-compatibility/postprocess/SSAOPass.ts +0 -21
  289. package/src/threejs-compatibility/postprocess/ShaderPass.ts +0 -7
  290. package/src/threejs-compatibility/postprocess/TAAPass.ts +0 -15
  291. package/src/threejs-compatibility/postprocess/VignettePass.ts +0 -16
  292. package/src/threejs-compatibility/postprocess/index.ts +0 -15
  293. package/src/threejs-compatibility/shaders/NodeMaterial.ts +0 -21
  294. package/src/threejs-compatibility/shaders/RawShaderMaterial.ts +0 -6
  295. package/src/threejs-compatibility/shaders/ShaderDiagnostics.ts +0 -17
  296. package/src/threejs-compatibility/shaders/ShaderMaterial.ts +0 -18
  297. package/src/threejs-compatibility/shaders/ThreeCompatShaderChunks.ts +0 -6
  298. package/src/threejs-compatibility/shaders/Uniforms.ts +0 -18
  299. package/src/threejs-compatibility/shaders/index.ts +0 -9
  300. package/src/threejs-compatibility/vfx/GPUPointCloud.ts +0 -7
  301. package/src/threejs-compatibility/vfx/LineRenderer.ts +0 -13
  302. package/src/threejs-compatibility/vfx/ParticleSystem.ts +0 -23
  303. package/src/threejs-compatibility/vfx/SpriteSystem.ts +0 -14
  304. package/src/threejs-compatibility/vfx/TrailRenderer.ts +0 -8
  305. package/src/threejs-compatibility/vfx/VFXDiagnostics.ts +0 -23
  306. package/src/threejs-compatibility/vfx/index.ts +0 -9
  307. package/src/threejs-example-parity/index.ts +0 -205
  308. package/src/webgpu/WebGPUBuffer.ts +0 -1
  309. package/src/webgpu/WebGPUCompute.ts +0 -2
  310. package/src/webgpu/WebGPUPipelineCache.ts +0 -15
  311. package/src/webgpu/WebGPUPostProcess.ts +0 -2
  312. package/src/webgpu/WebGPUTexture.ts +0 -2
  313. package/tsconfig.json +0 -26
  314. package/vitest.config.ts +0 -20
@@ -1,280 +0,0 @@
1
- export type VoxelFixtureBlockType =
2
- | "air"
3
- | "stone"
4
- | "dirt"
5
- | "grass"
6
- | "sand"
7
- | "water"
8
- | "wood"
9
- | "leaves"
10
- | "glass"
11
- | "coal-ore"
12
- | "iron-ore"
13
- | "gold-ore"
14
- | "diamond-ore"
15
- | "bedrock"
16
- | "cobblestone"
17
- | "planks"
18
- | "brick"
19
- | "snow"
20
- | "ice"
21
- | "lava";
22
-
23
- export type VoxelFixtureLod = "near" | "mid" | "far" | "culled";
24
-
25
- export interface VoxelFixtureOptions {
26
- readonly seed?: number;
27
- readonly chunkSize?: number;
28
- readonly viewDistance?: number;
29
- readonly cameraChunkX?: number;
30
- readonly cameraChunkZ?: number;
31
- }
32
-
33
- export interface VoxelBlockDescriptor {
34
- readonly type: VoxelFixtureBlockType;
35
- readonly color: readonly [number, number, number, number];
36
- readonly hardness: number;
37
- readonly toolRequired: string | null;
38
- readonly drops: VoxelFixtureBlockType | null;
39
- readonly sound: string;
40
- readonly animated: boolean;
41
- readonly lightLevel: number;
42
- readonly transparent: boolean;
43
- readonly solid: boolean;
44
- }
45
-
46
- export interface VoxelVisibleBlock {
47
- readonly id: string;
48
- readonly type: VoxelFixtureBlockType;
49
- readonly x: number;
50
- readonly y: number;
51
- readonly z: number;
52
- readonly lod: VoxelFixtureLod;
53
- }
54
-
55
- export interface VoxelWorldFixture {
56
- readonly id: "external-parity-old-branch-voxel-world-fixture";
57
- readonly source: "origin-master-voxel-world-adapted";
58
- readonly seed: number;
59
- readonly chunkSize: number;
60
- readonly viewDistance: number;
61
- readonly registry: readonly VoxelBlockDescriptor[];
62
- readonly blockTypeCount: number;
63
- readonly solidBlockTypes: number;
64
- readonly transparentBlockTypes: number;
65
- readonly animatedBlockTypes: number;
66
- readonly emittingBlockTypes: number;
67
- readonly chunkQueueSize: number;
68
- readonly generatingChunks: number;
69
- readonly meshingChunks: number;
70
- readonly lodCounts: Record<VoxelFixtureLod, number>;
71
- readonly blockCounts: Partial<Record<VoxelFixtureBlockType, number>>;
72
- readonly visibleBlocks: readonly VoxelVisibleBlock[];
73
- readonly visibleFaceEstimate: number;
74
- readonly memoryBytes: number;
75
- readonly hash: string;
76
- readonly claimBoundary: string;
77
- }
78
-
79
- const registry: readonly VoxelBlockDescriptor[] = [
80
- block("air", [0, 0, 0, 0], 0, null, null, "none", false, 0, true, false),
81
- block("stone", [0.5, 0.5, 0.5, 1], 1.5, "pickaxe", "cobblestone", "stone", false, 0, false, true),
82
- block("dirt", [0.4, 0.25, 0.15, 1], 0.5, null, "dirt", "dirt", false, 0, false, true),
83
- block("grass", [0.3, 0.7, 0.3, 1], 0.6, null, "dirt", "grass", false, 0, false, true),
84
- block("sand", [0.9, 0.85, 0.6, 1], 0.5, null, "sand", "sand", false, 0, false, true),
85
- block("water", [0.15, 0.4, 0.8, 0.6], 100, null, null, "water", true, 0, true, false),
86
- block("wood", [0.4, 0.25, 0.1, 1], 2, "axe", "wood", "wood", false, 0, false, true),
87
- block("leaves", [0.2, 0.6, 0.2, 0.9], 0.2, null, null, "grass", false, 0, true, true),
88
- block("glass", [0.7, 0.9, 1, 0.3], 0.3, null, "glass", "glass", false, 0, true, true),
89
- block("coal-ore", [0.12, 0.12, 0.12, 1], 3, "pickaxe", "coal-ore", "stone", false, 0, false, true),
90
- block("iron-ore", [0.72, 0.5, 0.34, 1], 3, "pickaxe", "iron-ore", "stone", false, 0, false, true),
91
- block("gold-ore", [1, 0.78, 0.2, 1], 3, "pickaxe", "gold-ore", "stone", false, 0, false, true),
92
- block("diamond-ore", [0.2, 0.85, 1, 1], 3, "pickaxe", "diamond-ore", "stone", false, 0, false, true),
93
- block("bedrock", [0.05, 0.05, 0.06, 1], 1000, null, null, "stone", false, 0, false, true),
94
- block("cobblestone", [0.38, 0.38, 0.38, 1], 2, "pickaxe", "cobblestone", "stone", false, 0, false, true),
95
- block("planks", [0.64, 0.42, 0.2, 1], 2, "axe", "planks", "wood", false, 0, false, true),
96
- block("brick", [0.62, 0.24, 0.18, 1], 2, "pickaxe", "brick", "stone", false, 0, false, true),
97
- block("snow", [0.92, 0.96, 1, 1], 0.2, null, "snow", "snow", false, 0, false, true),
98
- block("ice", [0.64, 0.88, 1, 0.72], 0.5, null, "ice", "glass", false, 0, true, true),
99
- block("lava", [1, 0.28, 0.02, 0.95], 100, null, null, "lava", true, 12, true, false)
100
- ];
101
-
102
- export function sampleVoxelWorldFixture(options: VoxelFixtureOptions = {}): VoxelWorldFixture {
103
- const seed = integer(options.seed ?? 0x3d2025, "seed");
104
- const chunkSize = integer(options.chunkSize ?? 16, "chunkSize");
105
- if (chunkSize < 8 || chunkSize > 64) throw new RangeError("Voxel fixture chunkSize must be between 8 and 64.");
106
- const viewDistance = integer(options.viewDistance ?? 4, "viewDistance");
107
- if (viewDistance < 1 || viewDistance > 16) throw new RangeError("Voxel fixture viewDistance must be between 1 and 16.");
108
- const cameraChunkX = Math.trunc(options.cameraChunkX ?? 0);
109
- const cameraChunkZ = Math.trunc(options.cameraChunkZ ?? 0);
110
- const blockCounts: Partial<Record<VoxelFixtureBlockType, number>> = {};
111
- const visibleBlocks: VoxelVisibleBlock[] = [];
112
- let visibleFaceEstimate = 0;
113
-
114
- for (let x = 0; x < chunkSize; x += 1) {
115
- for (let z = 0; z < chunkSize; z += 1) {
116
- const worldX = cameraChunkX * chunkSize + x;
117
- const worldZ = cameraChunkZ * chunkSize + z;
118
- const height = terrainHeight(worldX, worldZ, seed, chunkSize);
119
- const surface = surfaceBlock(worldX, worldZ, seed, height, chunkSize);
120
- addCount(blockCounts, "bedrock", 1);
121
- addCount(blockCounts, "stone", Math.max(0, height - 4));
122
- addCount(blockCounts, "dirt", 3);
123
- addCount(blockCounts, surface, 1);
124
- if (height < chunkSize * 0.38) addCount(blockCounts, "water", Math.ceil(chunkSize * 0.38 - height));
125
- if (noise(worldX * 0.19 + 31, worldZ * 0.19 - 17, seed) > 0.9) addCount(blockCounts, oreBlock(height), 1);
126
- if (surface === "grass" && noise(worldX * 0.13 + 1000, worldZ * 0.13 + 1000, seed) > 0.88) {
127
- addCount(blockCounts, "wood", 3);
128
- addCount(blockCounts, "leaves", 6);
129
- }
130
- visibleFaceEstimate += 4 + Math.round(Math.abs(height - chunkSize * 0.5) * 0.8);
131
- if (visibleBlocks.length < 28 && (x + z) % 3 === 0) {
132
- const distance = Math.hypot(x - chunkSize / 2, z - chunkSize / 2) / chunkSize * viewDistance;
133
- visibleBlocks.push({
134
- id: `voxel-${x}-${z}`,
135
- type: surface,
136
- x: Number(((x / chunkSize - 0.5) * 2.3).toFixed(4)),
137
- y: Number(((height / chunkSize) * 0.72 - 0.64).toFixed(4)),
138
- z: Number(((z / chunkSize - 0.5) * 0.44 - 0.22).toFixed(4)),
139
- lod: lodForDistance(distance)
140
- });
141
- }
142
- }
143
- }
144
-
145
- const lodCounts = chunkLodCounts(viewDistance);
146
- const chunkQueueSize = Object.values(lodCounts).reduce((sum, count) => sum + count, 0);
147
- const memoryBytes = chunkQueueSize * chunkSize * chunkSize * chunkSize * 2;
148
- return {
149
- id: "external-parity-old-branch-voxel-world-fixture",
150
- source: "origin-master-voxel-world-adapted",
151
- seed,
152
- chunkSize,
153
- viewDistance,
154
- registry,
155
- blockTypeCount: registry.length,
156
- solidBlockTypes: registry.filter((entry) => entry.solid).length,
157
- transparentBlockTypes: registry.filter((entry) => entry.transparent).length,
158
- animatedBlockTypes: registry.filter((entry) => entry.animated).length,
159
- emittingBlockTypes: registry.filter((entry) => entry.lightLevel > 0).length,
160
- chunkQueueSize,
161
- generatingChunks: Math.min(2, chunkQueueSize),
162
- meshingChunks: Math.min(3, chunkQueueSize),
163
- lodCounts,
164
- blockCounts,
165
- visibleBlocks,
166
- visibleFaceEstimate,
167
- memoryBytes,
168
- hash: hashVoxel(seed, chunkSize, viewDistance, blockCounts, lodCounts, visibleFaceEstimate),
169
- claimBoundary: "Deterministic block registry, chunk queue, terrain columns, LOD buckets, and visible block markers adapted from the old voxel-world example; this is not a production voxel engine, mesh builder, collision system, multiplayer sandbox, or Minecraft parity claim."
170
- };
171
- }
172
-
173
- function block(
174
- type: VoxelFixtureBlockType,
175
- color: readonly [number, number, number, number],
176
- hardness: number,
177
- toolRequired: string | null,
178
- drops: VoxelFixtureBlockType | null,
179
- sound: string,
180
- animated: boolean,
181
- lightLevel: number,
182
- transparent: boolean,
183
- solid: boolean
184
- ): VoxelBlockDescriptor {
185
- return { type, color, hardness, toolRequired, drops, sound, animated, lightLevel, transparent, solid };
186
- }
187
-
188
- function terrainHeight(x: number, z: number, seed: number, chunkSize: number): number {
189
- const base = noise(x * 0.08, z * 0.08, seed);
190
- const detail = noise(x * 0.21 + 11, z * 0.21 - 7, seed) * 0.32;
191
- return Math.max(3, Math.min(chunkSize - 2, Math.round(chunkSize * (0.34 + base * 0.34 + detail))));
192
- }
193
-
194
- function surfaceBlock(x: number, z: number, seed: number, height: number, chunkSize: number): VoxelFixtureBlockType {
195
- if (height < chunkSize * 0.38) return "sand";
196
- if (height > chunkSize * 0.78) return noise(x * 0.13, z * 0.13, seed) > 0.45 ? "snow" : "stone";
197
- const biome = noise(x * 0.05 - 20, z * 0.05 + 30, seed);
198
- if (biome < 0.18) return "sand";
199
- if (biome > 0.82) return "stone";
200
- return "grass";
201
- }
202
-
203
- function oreBlock(height: number): VoxelFixtureBlockType {
204
- if (height < 6) return "diamond-ore";
205
- if (height < 9) return "gold-ore";
206
- if (height < 12) return "iron-ore";
207
- return "coal-ore";
208
- }
209
-
210
- function lodForDistance(distance: number): VoxelFixtureLod {
211
- if (distance <= 1.25) return "near";
212
- if (distance <= 2.5) return "mid";
213
- if (distance <= 4) return "far";
214
- return "culled";
215
- }
216
-
217
- function chunkLodCounts(viewDistance: number): Record<VoxelFixtureLod, number> {
218
- const counts: Record<VoxelFixtureLod, number> = { near: 0, mid: 0, far: 0, culled: 0 };
219
- const unloadDistance = viewDistance * 1.5;
220
- for (let x = -viewDistance; x <= viewDistance; x += 1) {
221
- for (let z = -viewDistance; z <= viewDistance; z += 1) {
222
- const distance = Math.hypot(x, z);
223
- if (distance <= viewDistance) counts[lodForDistance(distance)] += 1;
224
- else if (distance <= unloadDistance) counts.culled += 1;
225
- }
226
- }
227
- return counts;
228
- }
229
-
230
- function addCount(counts: Partial<Record<VoxelFixtureBlockType, number>>, type: VoxelFixtureBlockType, count: number): void {
231
- counts[type] = (counts[type] ?? 0) + count;
232
- }
233
-
234
- function noise(x: number, z: number, seed: number): number {
235
- const xi = Math.floor(x);
236
- const zi = Math.floor(z);
237
- const xf = x - xi;
238
- const zf = z - zi;
239
- const top = lerp(hash(xi, zi, seed), hash(xi + 1, zi, seed), smoothstep(xf));
240
- const bottom = lerp(hash(xi, zi + 1, seed), hash(xi + 1, zi + 1, seed), smoothstep(xf));
241
- return lerp(top, bottom, smoothstep(zf));
242
- }
243
-
244
- function hash(x: number, z: number, seed: number): number {
245
- let value = Math.imul(x, 374761393) + Math.imul(z, 668265263) + seed;
246
- value = Math.imul(value ^ (value >>> 13), 1274126177);
247
- return ((value ^ (value >>> 16)) >>> 0) / 4294967296;
248
- }
249
-
250
- function hashVoxel(
251
- seed: number,
252
- chunkSize: number,
253
- viewDistance: number,
254
- blockCounts: Partial<Record<VoxelFixtureBlockType, number>>,
255
- lodCounts: Record<VoxelFixtureLod, number>,
256
- visibleFaceEstimate: number
257
- ): string {
258
- let value = 0x811c9dc5;
259
- for (const entry of [seed, chunkSize, viewDistance, visibleFaceEstimate, ...Object.values(blockCounts), ...Object.values(lodCounts)]) {
260
- const scaled = Math.round((entry ?? 0) * 10);
261
- value ^= scaled & 0xff;
262
- value = Math.imul(value, 0x01000193) >>> 0;
263
- value ^= (scaled >>> 8) & 0xff;
264
- value = Math.imul(value, 0x01000193) >>> 0;
265
- }
266
- return value.toString(16).padStart(8, "0");
267
- }
268
-
269
- function integer(value: number, label: string): number {
270
- if (!Number.isInteger(value)) throw new RangeError(`Voxel fixture ${label} must be an integer.`);
271
- return value;
272
- }
273
-
274
- function lerp(left: number, right: number, t: number): number {
275
- return left + (right - left) * t;
276
- }
277
-
278
- function smoothstep(value: number): number {
279
- return value * value * (3 - 2 * value);
280
- }
@@ -1,223 +0,0 @@
1
- export type WeatherFixtureType = "clear" | "cloudy" | "rain" | "heavy-rain" | "thunderstorm" | "snow";
2
-
3
- export interface WeatherFixtureOptions {
4
- readonly type?: WeatherFixtureType;
5
- readonly elapsedSeconds?: number;
6
- readonly seed?: number;
7
- readonly cameraX?: number;
8
- readonly cameraZ?: number;
9
- readonly maxVisualDrops?: number;
10
- }
11
-
12
- export interface WeatherVisualDrop {
13
- readonly x: number;
14
- readonly y: number;
15
- readonly z: number;
16
- readonly length: number;
17
- readonly alpha: number;
18
- }
19
-
20
- export interface WeatherPuddlePatch {
21
- readonly x: number;
22
- readonly z: number;
23
- readonly radius: number;
24
- readonly depth: number;
25
- }
26
-
27
- export interface WeatherFixtureSample {
28
- readonly type: WeatherFixtureType;
29
- readonly cloudCoverage: number;
30
- readonly fogDensity: number;
31
- readonly rainIntensity: number;
32
- readonly snowIntensity: number;
33
- readonly windSpeed: number;
34
- readonly windDirectionX: number;
35
- readonly windDirectionZ: number;
36
- readonly lightningFrequency: number;
37
- readonly visibleDropCount: number;
38
- readonly splashCount: number;
39
- readonly puddleDepth: number;
40
- readonly wetness: number;
41
- readonly ambientIntensity: number;
42
- readonly visibilityMeters: number;
43
- readonly visualDrops: readonly WeatherVisualDrop[];
44
- readonly puddlePatches: readonly WeatherPuddlePatch[];
45
- readonly hash: string;
46
- readonly source: "origin-master-weather-system-adapted";
47
- readonly claimBoundary: string;
48
- }
49
-
50
- export function sampleWeatherFixture(options: WeatherFixtureOptions = {}): WeatherFixtureSample {
51
- const type = options.type ?? "rain";
52
- const preset = weatherPreset(type);
53
- const elapsedSeconds = Math.max(0, finite(options.elapsedSeconds ?? 1, "elapsedSeconds"));
54
- const seed = Math.floor(options.seed ?? 0x5ea50a);
55
- if (!Number.isInteger(seed)) {
56
- throw new RangeError("Weather fixture seed must be an integer.");
57
- }
58
- const cameraX = finite(options.cameraX ?? 0, "cameraX");
59
- const cameraZ = finite(options.cameraZ ?? 0, "cameraZ");
60
- const windGust = (seeded01(seed + Math.floor(elapsedSeconds * 17)) * 2 - 1) * preset.windGustiness;
61
- const windSpeed = Math.max(0, preset.windSpeed * (1 + windGust));
62
- const weatherLoad = preset.rainIntensity + preset.snowIntensity;
63
- const visibleDropCount = Math.round(weatherLoad * 420 + windSpeed * 8 + Math.abs(cameraX + cameraZ) * 3);
64
- const splashCount = Math.round(preset.rainIntensity * elapsedSeconds * 180);
65
- const puddleDepth = clamp(preset.rainIntensity * elapsedSeconds * 0.018 + preset.wetnessRate * 0.08, 0, 1);
66
- const wetness = clamp(preset.wetnessRate + puddleDepth * 0.45, 0, 1);
67
- const visualDrops = sampleVisualDrops({
68
- count: Math.min(Math.max(0, Math.floor(options.maxVisualDrops ?? 36)), visibleDropCount),
69
- seed,
70
- elapsedSeconds,
71
- cameraX,
72
- cameraZ,
73
- intensity: weatherLoad,
74
- windSpeed
75
- });
76
- const puddlePatches = samplePuddlePatches({
77
- count: preset.rainIntensity > 0 ? Math.max(1, Math.min(8, Math.round(preset.rainIntensity * 8))) : 0,
78
- seed,
79
- cameraX,
80
- cameraZ,
81
- depth: puddleDepth
82
- });
83
- const hash = hashWeather([
84
- preset.cloudCoverage,
85
- preset.fogDensity,
86
- preset.rainIntensity,
87
- preset.snowIntensity,
88
- windSpeed,
89
- visibleDropCount,
90
- splashCount,
91
- puddleDepth,
92
- wetness,
93
- preset.visibility,
94
- visualDrops.length,
95
- puddlePatches.length
96
- ]);
97
- return {
98
- type,
99
- cloudCoverage: preset.cloudCoverage,
100
- fogDensity: preset.fogDensity,
101
- rainIntensity: preset.rainIntensity,
102
- snowIntensity: preset.snowIntensity,
103
- windSpeed: Number(windSpeed.toFixed(4)),
104
- windDirectionX: preset.windDirectionX,
105
- windDirectionZ: preset.windDirectionZ,
106
- lightningFrequency: preset.lightningFrequency,
107
- visibleDropCount,
108
- splashCount,
109
- puddleDepth: Number(puddleDepth.toFixed(4)),
110
- wetness: Number(wetness.toFixed(4)),
111
- ambientIntensity: preset.ambientIntensity,
112
- visibilityMeters: preset.visibility,
113
- visualDrops,
114
- puddlePatches,
115
- hash,
116
- source: "origin-master-weather-system-adapted",
117
- claimBoundary: "Deterministic weather, wind, rain/snow particle-count, splash, puddle, wetness, fog, and cloud telemetry adapted from the old weather system; this is bounded scene evidence, not volumetric clouds, full precipitation rendering, atmospheric scattering, or weather simulation parity."
118
- };
119
- }
120
-
121
- function weatherPreset(type: WeatherFixtureType): {
122
- readonly cloudCoverage: number;
123
- readonly fogDensity: number;
124
- readonly rainIntensity: number;
125
- readonly snowIntensity: number;
126
- readonly windSpeed: number;
127
- readonly windDirectionX: number;
128
- readonly windDirectionZ: number;
129
- readonly windGustiness: number;
130
- readonly lightningFrequency: number;
131
- readonly ambientIntensity: number;
132
- readonly wetnessRate: number;
133
- readonly visibility: number;
134
- } {
135
- switch (type) {
136
- case "clear":
137
- return { cloudCoverage: 0.1, fogDensity: 0, rainIntensity: 0, snowIntensity: 0, windSpeed: 2, windDirectionX: 1, windDirectionZ: 0, windGustiness: 0.1, lightningFrequency: 0, ambientIntensity: 0.8, wetnessRate: 0, visibility: 50_000 };
138
- case "cloudy":
139
- return { cloudCoverage: 0.85, fogDensity: 0.1, rainIntensity: 0, snowIntensity: 0, windSpeed: 5, windDirectionX: 1, windDirectionZ: 0, windGustiness: 0.3, lightningFrequency: 0, ambientIntensity: 0.6, wetnessRate: 0, visibility: 20_000 };
140
- case "heavy-rain":
141
- return { cloudCoverage: 1, fogDensity: 0.3, rainIntensity: 0.9, snowIntensity: 0, windSpeed: 9, windDirectionX: 1, windDirectionZ: 0, windGustiness: 0.5, lightningFrequency: 1.5, ambientIntensity: 0.4, wetnessRate: 0.9, visibility: 5_000 };
142
- case "thunderstorm":
143
- return { cloudCoverage: 1, fogDensity: 0.35, rainIntensity: 1, snowIntensity: 0, windSpeed: 12, windDirectionX: 1, windDirectionZ: 0, windGustiness: 0.7, lightningFrequency: 3, ambientIntensity: 0.35, wetnessRate: 1, visibility: 3_000 };
144
- case "snow":
145
- return { cloudCoverage: 0.95, fogDensity: 0.2, rainIntensity: 0, snowIntensity: 0.6, windSpeed: 5.5, windDirectionX: 1, windDirectionZ: 0, windGustiness: 0.35, lightningFrequency: 0, ambientIntensity: 0.6, wetnessRate: 0.2, visibility: 8_000 };
146
- case "rain":
147
- return { cloudCoverage: 0.9, fogDensity: 0.2, rainIntensity: 0.6, snowIntensity: 0, windSpeed: 6.5, windDirectionX: 1, windDirectionZ: 0, windGustiness: 0.4, lightningFrequency: 0.5, ambientIntensity: 0.5, wetnessRate: 0.6, visibility: 10_000 };
148
- }
149
- }
150
-
151
- function hashWeather(values: readonly number[]): string {
152
- let hash = 0x811c9dc5;
153
- for (const value of values) {
154
- const scaled = Math.round(value * 10_000);
155
- hash ^= scaled & 0xff;
156
- hash = Math.imul(hash, 0x01000193) >>> 0;
157
- hash ^= (scaled >>> 8) & 0xff;
158
- hash = Math.imul(hash, 0x01000193) >>> 0;
159
- }
160
- return hash.toString(16).padStart(8, "0");
161
- }
162
-
163
- function sampleVisualDrops(options: {
164
- readonly count: number;
165
- readonly seed: number;
166
- readonly elapsedSeconds: number;
167
- readonly cameraX: number;
168
- readonly cameraZ: number;
169
- readonly intensity: number;
170
- readonly windSpeed: number;
171
- }): readonly WeatherVisualDrop[] {
172
- return Array.from({ length: options.count }, (_, index): WeatherVisualDrop => {
173
- const lane = seeded01(options.seed + index * 97);
174
- const fall = (seeded01(options.seed ^ (index * 131)) + options.elapsedSeconds * (0.42 + options.intensity * 0.18)) % 1;
175
- const x = options.cameraX - 1.25 + lane * 2.5 + Math.sin(options.elapsedSeconds * 1.7 + index) * 0.025;
176
- const z = options.cameraZ - 0.38 + seeded01(options.seed + index * 53) * 0.76;
177
- const y = 0.78 - fall * 1.38;
178
- return {
179
- x: Number(x.toFixed(4)),
180
- y: Number(y.toFixed(4)),
181
- z: Number(z.toFixed(4)),
182
- length: Number((0.055 + options.intensity * 0.055 + options.windSpeed * 0.003).toFixed(4)),
183
- alpha: Number((0.28 + options.intensity * 0.36).toFixed(4))
184
- };
185
- });
186
- }
187
-
188
- function samplePuddlePatches(options: {
189
- readonly count: number;
190
- readonly seed: number;
191
- readonly cameraX: number;
192
- readonly cameraZ: number;
193
- readonly depth: number;
194
- }): readonly WeatherPuddlePatch[] {
195
- return Array.from({ length: options.count }, (_, index): WeatherPuddlePatch => {
196
- const x = options.cameraX - 1.08 + seeded01(options.seed + index * 19) * 2.16;
197
- const z = options.cameraZ - 0.32 + seeded01(options.seed + index * 47) * 0.64;
198
- const radius = 0.035 + seeded01(options.seed ^ (index * 83)) * 0.05 + options.depth * 0.08;
199
- return {
200
- x: Number(x.toFixed(4)),
201
- z: Number(z.toFixed(4)),
202
- radius: Number(radius.toFixed(4)),
203
- depth: Number(options.depth.toFixed(4))
204
- };
205
- });
206
- }
207
-
208
- function seeded01(seed: number): number {
209
- let value = seed >>> 0;
210
- value ^= value << 13;
211
- value ^= value >>> 17;
212
- value ^= value << 5;
213
- return ((value >>> 0) % 10_000) / 10_000;
214
- }
215
-
216
- function finite(value: number, label: string): number {
217
- if (!Number.isFinite(value)) throw new RangeError(`Weather fixture ${label} must be finite.`);
218
- return value;
219
- }
220
-
221
- function clamp(value: number, min: number, max: number): number {
222
- return Math.max(min, Math.min(max, value));
223
- }