@woosh/meep-engine 3.64.1 → 3.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +85 -0
- package/build/bundle-worker-image-decoder.js +1 -1
- package/build/bundle-worker-terrain.js +1 -1
- package/package.json +1 -1
- package/src/core/binary/BinaryBuffer.d.ts +5 -0
- package/src/core/binary/BinaryBuffer.d.ts.map +1 -1
- package/src/core/binary/BinaryBuffer.js +39 -5
- package/src/core/geom/3d/topology/struct/binary/io/bt_boundary_loop.d.ts +65 -6
- package/src/core/geom/3d/topology/struct/binary/io/bt_boundary_loop.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_boundary_loop.js +451 -101
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.d.ts +4 -2
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.js +4 -2
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_fill_small_holes.d.ts +8 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_fill_small_holes.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_fill_small_holes.js +45 -10
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.js +237 -119
- package/src/engine/graphics/ecs/grass/GrassSpecies.d.ts +143 -0
- package/src/engine/graphics/ecs/grass/GrassSpecies.d.ts.map +1 -0
- package/src/engine/graphics/ecs/grass/GrassSpecies.js +189 -0
- package/src/engine/graphics/ecs/grass/GrassSurface.d.ts +25 -0
- package/src/engine/graphics/ecs/grass/GrassSurface.d.ts.map +1 -0
- package/src/engine/graphics/ecs/grass/GrassSurface.js +32 -0
- package/src/engine/graphics/ecs/grass/GroundCover.d.ts +68 -0
- package/src/engine/graphics/ecs/grass/GroundCover.d.ts.map +1 -0
- package/src/engine/graphics/ecs/grass/GroundCover.js +85 -0
- package/src/engine/graphics3/GrassSurfaceSystem.d.ts +153 -0
- package/src/engine/graphics3/GrassSurfaceSystem.d.ts.map +1 -0
- package/src/engine/graphics3/GrassSurfaceSystem.js +1076 -0
- package/src/engine/graphics3/GroundCoverSystem.d.ts +33 -0
- package/src/engine/graphics3/GroundCoverSystem.d.ts.map +1 -0
- package/src/engine/graphics3/GroundCoverSystem.js +58 -0
- package/src/engine/network/NetworkSession.d.ts.map +1 -1
- package/src/engine/network/NetworkSession.js +372 -110
- package/src/engine/network/orchestrator/NetworkPeer.d.ts.map +1 -1
- package/src/engine/network/orchestrator/NetworkPeer.js +6 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts.map +1 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeClient.js +9 -2
- package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts.map +1 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeServer.js +325 -140
- package/src/engine/network/sim/SimActionExecutor.d.ts +4 -1
- package/src/engine/network/sim/SimActionExecutor.d.ts.map +1 -1
- package/src/engine/network/sim/SimActionExecutor.js +65 -9
- package/src/engine/network/state/PredictionHistory.d.ts.map +1 -1
- package/src/engine/network/state/PredictionHistory.js +6 -1
- package/src/engine/network/time/AdaptiveRenderDelay.d.ts +25 -14
- package/src/engine/network/time/AdaptiveRenderDelay.d.ts.map +1 -1
- package/src/engine/network/time/AdaptiveRenderDelay.js +38 -20
- package/src/engine/network/time/RenderPlayout.d.ts +23 -3
- package/src/engine/network/time/RenderPlayout.d.ts.map +1 -1
- package/src/engine/network/time/RenderPlayout.js +40 -4
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/engine/physics/fluid/obstacle/chunk_fluid_obstacle_record.d.ts +5 -1
- package/src/engine/physics/fluid/obstacle/chunk_fluid_obstacle_record.d.ts.map +1 -1
- package/src/engine/physics/fluid/obstacle/chunk_fluid_obstacle_record.js +27 -1
- package/src/shade/device/shader/ShaderModuleCompiler.d.ts +2 -0
- package/src/shade/device/shader/ShaderModuleCompiler.d.ts.map +1 -1
- package/src/shade/device/shader/ShaderModuleCompiler.js +25 -2
- package/src/shade/playground/grass_surfaces/index.html +75 -0
- package/src/shade/playground/grass_surfaces/main.d.ts +2 -0
- package/src/shade/playground/grass_surfaces/main.d.ts.map +1 -0
- package/src/shade/playground/grass_surfaces/main.js +593 -0
- package/src/shade/playground/grass_surfaces/read_grass_surfaces.d.ts +62 -0
- package/src/shade/playground/grass_surfaces/read_grass_surfaces.d.ts.map +1 -0
- package/src/shade/playground/grass_surfaces/read_grass_surfaces.js +188 -0
- package/src/shade/playground/probe_clipmap_box/README.md +5 -1
- package/src/shade/playground/probe_clipmap_box/index.html +12 -0
- package/src/shade/playground/probe_clipmap_box/main.d.ts.map +1 -1
- package/src/shade/playground/probe_clipmap_box/main.js +15 -0
- package/src/shade/playground/probe_clipmap_box/scene.d.ts +8 -1
- package/src/shade/playground/probe_clipmap_box/scene.d.ts.map +1 -1
- package/src/shade/playground/probe_clipmap_box/scene.js +74 -6
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +47 -43
- package/src/shade/renderer/extension/ViewTextures.d.ts +12 -5
- package/src/shade/renderer/extension/ViewTextures.d.ts.map +1 -1
- package/src/shade/renderer/extension/ViewTextures.js +19 -5
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +3 -1
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts.map +1 -1
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.js +6 -1
- package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +7 -0
- package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts.map +1 -1
- package/src/shade/renderer/fluid/forcing/GPUFluidForcing.js +10 -0
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts +7 -1
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js +46 -15
- package/src/shade/renderer/geometry/sdf/bundle/ModelCacheBundle.d.ts +3 -2
- package/src/shade/renderer/geometry/sdf/bundle/ModelCacheBundle.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/bundle/ModelCacheBundle.js +3 -2
- package/src/shade/renderer/geometry/sdf/bundle/model_cache_bundle_sort_morton.d.ts +22 -0
- package/src/shade/renderer/geometry/sdf/bundle/model_cache_bundle_sort_morton.d.ts.map +1 -0
- package/src/shade/renderer/geometry/sdf/bundle/model_cache_bundle_sort_morton.js +247 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +50 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +101 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts +2 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.js +2 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts +8 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.js +12 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts +12 -6
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +35 -29
- package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_clipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_clipmap.js +4 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_material.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_material.js +6 -4
- package/src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.js +2 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material.d.ts +6 -5
- package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material.js +15 -14
- package/src/shade/renderer/global_illumination/probe_clipmap/material/shader_brick_material_gather.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/material/shader_brick_material_gather.js +4 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts +19 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.js +128 -10
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts +19 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.js +27 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.d.ts +19 -11
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.js +35 -11
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.js +3 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_box_cages.d.ts +40 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_box_cages.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_box_cages.js +174 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_material.d.ts +4 -4
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_material.js +10 -10
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_parallax.d.ts +31 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_parallax.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_parallax.js +54 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.d.ts +8 -4
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.js +10 -21
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.d.ts +7 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.js +33 -29
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/graph_probe_clipmap_want_meshlets.d.ts +28 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/graph_probe_clipmap_want_meshlets.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/graph_probe_clipmap_want_meshlets.js +138 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts +13 -9
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.js +18 -11
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.js +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.js +4 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_retire.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_retire.js +2 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.d.ts +5 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.js +15 -30
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.js +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.js +4 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.d.ts +11 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.js +29 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_late.d.ts +40 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_late.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_late.js +126 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_meshlets.d.ts +36 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_meshlets.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_meshlets.js +221 -0
- package/src/shade/renderer/gpu_primitive/age_eviction/chunk_age_eviction.d.ts +40 -0
- package/src/shade/renderer/gpu_primitive/age_eviction/chunk_age_eviction.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/age_eviction/chunk_age_eviction.js +86 -0
- package/src/shade/renderer/grass/blade/GPUGrassBlades.d.ts +135 -0
- package/src/shade/renderer/grass/blade/GPUGrassBlades.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/GPUGrassBlades.js +676 -0
- package/src/shade/renderer/grass/blade/GRASS_BLADE.d.ts +145 -0
- package/src/shade/renderer/grass/blade/GRASS_BLADE.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/GRASS_BLADE.js +179 -0
- package/src/shade/renderer/grass/blade/chunk_grass_blade.d.ts +63 -0
- package/src/shade/renderer/grass/blade/chunk_grass_blade.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/chunk_grass_blade.js +244 -0
- package/src/shade/renderer/grass/blade/chunk_grass_blade_wind.d.ts +58 -0
- package/src/shade/renderer/grass/blade/chunk_grass_blade_wind.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/chunk_grass_blade_wind.js +174 -0
- package/src/shade/renderer/grass/blade/grass_blade_id_draw.d.ts +25 -0
- package/src/shade/renderer/grass/blade/grass_blade_id_draw.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/grass_blade_id_draw.js +133 -0
- package/src/shade/renderer/grass/blade/grass_blade_mechanics.d.ts +80 -0
- package/src/shade/renderer/grass/blade/grass_blade_mechanics.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/grass_blade_mechanics.js +92 -0
- package/src/shade/renderer/grass/blade/grass_blade_resolve.d.ts +29 -0
- package/src/shade/renderer/grass/blade/grass_blade_resolve.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/grass_blade_resolve.js +175 -0
- package/src/shade/renderer/grass/blade/shader_grass_blade_draw_args.d.ts +14 -0
- package/src/shade/renderer/grass/blade/shader_grass_blade_draw_args.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/shader_grass_blade_draw_args.js +45 -0
- package/src/shade/renderer/grass/blade/shader_grass_blade_expand.d.ts +61 -0
- package/src/shade/renderer/grass/blade/shader_grass_blade_expand.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/shader_grass_blade_expand.js +340 -0
- package/src/shade/renderer/grass/blade/shader_grass_cell_count.d.ts +46 -0
- package/src/shade/renderer/grass/blade/shader_grass_cell_count.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/shader_grass_cell_count.js +280 -0
- package/src/shade/renderer/grass/population/chunk_grass_population.d.ts +60 -0
- package/src/shade/renderer/grass/population/chunk_grass_population.d.ts.map +1 -0
- package/src/shade/renderer/grass/population/chunk_grass_population.js +171 -0
- package/src/shade/renderer/grass/press/GPUGrassPress.d.ts +99 -0
- package/src/shade/renderer/grass/press/GPUGrassPress.d.ts.map +1 -0
- package/src/shade/renderer/grass/press/GPUGrassPress.js +436 -0
- package/src/shade/renderer/grass/press/GRASS_PRESS.d.ts +179 -0
- package/src/shade/renderer/grass/press/GRASS_PRESS.d.ts.map +1 -0
- package/src/shade/renderer/grass/press/GRASS_PRESS.js +217 -0
- package/src/shade/renderer/grass/press/chunk_grass_press.d.ts +65 -0
- package/src/shade/renderer/grass/press/chunk_grass_press.d.ts.map +1 -0
- package/src/shade/renderer/grass/press/chunk_grass_press.js +296 -0
- package/src/shade/renderer/grass/press/shader_grass_press_mark.d.ts +31 -0
- package/src/shade/renderer/grass/press/shader_grass_press_mark.d.ts.map +1 -0
- package/src/shade/renderer/grass/press/shader_grass_press_mark.js +169 -0
- package/src/shade/renderer/grass/press/shader_grass_press_stamp.d.ts +27 -0
- package/src/shade/renderer/grass/press/shader_grass_press_stamp.d.ts.map +1 -0
- package/src/shade/renderer/grass/press/shader_grass_press_stamp.js +183 -0
- package/src/shade/renderer/grass/surface/GPUGrassSurfaces.d.ts +193 -0
- package/src/shade/renderer/grass/surface/GPUGrassSurfaces.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/GPUGrassSurfaces.js +1253 -0
- package/src/shade/renderer/grass/surface/GRASS_SURFACE.d.ts +211 -0
- package/src/shade/renderer/grass/surface/GRASS_SURFACE.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/GRASS_SURFACE.js +241 -0
- package/src/shade/renderer/grass/surface/GRASS_SURFACE_VIEW.d.ts +82 -0
- package/src/shade/renderer/grass/surface/GRASS_SURFACE_VIEW.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/GRASS_SURFACE_VIEW.js +111 -0
- package/src/shade/renderer/grass/surface/chunk_grass_column_cross.d.ts +39 -0
- package/src/shade/renderer/grass/surface/chunk_grass_column_cross.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/chunk_grass_column_cross.js +85 -0
- package/src/shade/renderer/grass/surface/chunk_grass_directory.d.ts +29 -0
- package/src/shade/renderer/grass/surface/chunk_grass_directory.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/chunk_grass_directory.js +112 -0
- package/src/shade/renderer/grass/surface/chunk_grass_slot.d.ts +27 -0
- package/src/shade/renderer/grass/surface/chunk_grass_slot.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/chunk_grass_slot.js +50 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surface_frame.d.ts +21 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surface_frame.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surface_frame.js +41 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surface_window.d.ts +32 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surface_window.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surface_window.js +136 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surfel.d.ts +37 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surfel.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surfel.js +85 -0
- package/src/shade/renderer/grass/surface/chunk_grass_tile.d.ts +25 -0
- package/src/shade/renderer/grass/surface/chunk_grass_tile.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/chunk_grass_tile.js +52 -0
- package/src/shade/renderer/grass/surface/shader_grass_directory_fill.d.ts +23 -0
- package/src/shade/renderer/grass/surface/shader_grass_directory_fill.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/shader_grass_directory_fill.js +87 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_bake.d.ts +43 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_bake.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_bake.js +265 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_bake_command.d.ts +13 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_bake_command.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_bake_command.js +49 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_invalidate.d.ts +62 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_invalidate.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_invalidate.js +162 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_retire.d.ts +40 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_retire.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_retire.js +155 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_schedule.d.ts +19 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_schedule.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_schedule.js +58 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_want.d.ts +30 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_want.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_want.js +251 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_window_count.d.ts +21 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_window_count.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_window_count.js +75 -0
- package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.js +4 -23
- package/src/shade/renderer/postprocess/velocity/view_velocity_matrices.d.ts +12 -0
- package/src/shade/renderer/postprocess/velocity/view_velocity_matrices.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/velocity/view_velocity_matrices.js +29 -0
- package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.js +22 -0
- package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
- package/src/shade/renderer/scene/GPUSceneContext.js +3 -0
- package/src/shade/renderer/scene/GRASS_SURFACE_PARAMS_STRUCT.d.ts +27 -0
- package/src/shade/renderer/scene/GRASS_SURFACE_PARAMS_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/scene/GRASS_SURFACE_PARAMS_STRUCT.js +38 -0
- package/src/shade/renderer/scene/MESH_GROUND_COVER_STRUCT.d.ts +28 -0
- package/src/shade/renderer/scene/MESH_GROUND_COVER_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/scene/MESH_GROUND_COVER_STRUCT.js +58 -0
- package/src/shade/renderer/scene/SCENE_DATABASE_SPEC.d.ts.map +1 -1
- package/src/shade/renderer/scene/SCENE_DATABASE_SPEC.js +8 -0
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.d.ts +37 -0
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.js +148 -0
- package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_line_span.d.ts +20 -0
- package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_line_span.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_line_span.js +169 -0
- package/src/shade/renderer/texture/atlas/chunk_tile_atlas_slot_origin.d.ts +18 -0
- package/src/shade/renderer/texture/atlas/chunk_tile_atlas_slot_origin.d.ts.map +1 -1
- package/src/shade/renderer/texture/atlas/chunk_tile_atlas_slot_origin.js +28 -0
- package/src/shade/renderer/texture/atlas/tile_atlas_slot_shift.d.ts +13 -0
- package/src/shade/renderer/texture/atlas/tile_atlas_slot_shift.d.ts.map +1 -0
- package/src/shade/renderer/texture/atlas/tile_atlas_slot_shift.js +22 -0
- package/src/shade/renderer/water/GPUWaterRenderer.d.ts.map +1 -1
- package/src/shade/renderer/water/GPUWaterRenderer.js +4 -0
- package/src/shade/renderer/wind/GPUSceneWind.d.ts +52 -5
- package/src/shade/renderer/wind/GPUSceneWind.d.ts.map +1 -1
- package/src/shade/renderer/wind/GPUSceneWind.js +164 -8
- package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.d.ts +3 -1
- package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.d.ts.map +1 -1
- package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.js +3 -1
- package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts +2 -1
- package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts.map +1 -1
- package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.js +18 -13
- package/src/shade/renderer/wind/chunk_wind_field_sample_previous.d.ts +13 -0
- package/src/shade/renderer/wind/chunk_wind_field_sample_previous.d.ts.map +1 -0
- package/src/shade/renderer/wind/chunk_wind_field_sample_previous.js +23 -0
- package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.d.ts +1 -0
- package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.d.ts.map +1 -1
- package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.js +6 -1
- package/src/shade/renderer/wind/wind_field_add_resources.d.ts +11 -0
- package/src/shade/renderer/wind/wind_field_add_resources.d.ts.map +1 -1
- package/src/shade/renderer/wind/wind_field_add_resources.js +15 -0
- package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.js +1 -1
- package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
- package/src/shade/wgsl/emulator/WGSLLanguageCore.js +2 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Grass surfaces on the device: the constants every pass over them shares.
|
|
3
|
+
*
|
|
4
|
+
* A grass surface is a group of mesh instances with one frame (a `transforms` row). Its ground is sampled
|
|
5
|
+
* into **surfels** on a lattice in that frame: columns along the frame's up axis, a spacing apart, each
|
|
6
|
+
* holding the ground the column meets (`chunk_grass_surfel`). A surface has **levels**, level `l` at
|
|
7
|
+
* `2^l` times the finest spacing, and each level is cut into square **tiles** of
|
|
8
|
+
* {@link GRASS_TILE_COLUMNS} columns a side. A column can meet ground more than once (a hilltop over a
|
|
9
|
+
* cave floor), so a tile has **layers**: layer `k` holds each column's `k`-th ground from the top.
|
|
10
|
+
*
|
|
11
|
+
* One layer of one tile is what is baked and kept: {@link GRASS_TILE_SURFELS} surfels in a **slot** of a
|
|
12
|
+
* pool every surface shares. A slot is a tile of the surfel atlas (a `GPUTileAtlas2D` of tiles
|
|
13
|
+
* {@link GRASS_TILE_COLUMNS} texels a side) and a record of {@link GRASS_SLOT_WORDS} words saying which
|
|
14
|
+
* layer of which tile of which surface it holds.
|
|
15
|
+
*
|
|
16
|
+
* **A slot's life.** A view's ask takes a free slot for a layer it wants and finds none for
|
|
17
|
+
* ({@link GRASS_SLOT_STATE_PENDING}), the frame's bake fills it ({@link GRASS_SLOT_STATE_BAKED}), and every
|
|
18
|
+
* later ask stamps it with the frame. Ground that changes under it makes it
|
|
19
|
+
* {@link GRASS_SLOT_STATE_STALE} until it is baked again. A slot no view has asked for since the frame
|
|
20
|
+
* before can be evicted, and is only when the pool is short of free slots, the longest unasked first
|
|
21
|
+
* (`chunk_age_eviction`); where the slots in use fill the pool, an ask starves and the pool grows.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Columns along a side of a tile. A tile's layer is baked by one workgroup, a thread a column, so the
|
|
25
|
+
* square of this is the workgroup's size.
|
|
26
|
+
*
|
|
27
|
+
* @type {number}
|
|
28
|
+
*/
|
|
29
|
+
export const GRASS_TILE_COLUMNS: number;
|
|
30
|
+
/**
|
|
31
|
+
* Surfels in one layer of one tile, and threads in the workgroup that bakes it.
|
|
32
|
+
*
|
|
33
|
+
* @type {number}
|
|
34
|
+
*/
|
|
35
|
+
export const GRASS_TILE_SURFELS: number;
|
|
36
|
+
/**
|
|
37
|
+
* Faces a column's walk crosses before it stops, kept or not. A thread's loop bound: each crossing is one
|
|
38
|
+
* walk of the scene's TLAS and of the geometry it lands in. Ground under more faces than this is not
|
|
39
|
+
* found.
|
|
40
|
+
*
|
|
41
|
+
* @type {number}
|
|
42
|
+
*/
|
|
43
|
+
export const GRASS_COLUMN_CROSSINGS: number;
|
|
44
|
+
/**
|
|
45
|
+
* Words in a slot's record.
|
|
46
|
+
*
|
|
47
|
+
* @type {number}
|
|
48
|
+
*/
|
|
49
|
+
export const GRASS_SLOT_WORDS: number;
|
|
50
|
+
/**
|
|
51
|
+
* Slot record word: the `transforms` row of the surface the slot's tile belongs to.
|
|
52
|
+
*
|
|
53
|
+
* @type {number}
|
|
54
|
+
*/
|
|
55
|
+
export const GRASS_SLOT_SURFACE: number;
|
|
56
|
+
/**
|
|
57
|
+
* Slot record word: the tile's level in the low byte, the layer the slot holds in the next.
|
|
58
|
+
*
|
|
59
|
+
* @type {number}
|
|
60
|
+
*/
|
|
61
|
+
export const GRASS_SLOT_LEVEL_LAYER: number;
|
|
62
|
+
/**
|
|
63
|
+
* Slot record word: the tile's place along the frame's x axis, in tiles of its level; a signed integer's bits.
|
|
64
|
+
*
|
|
65
|
+
* @type {number}
|
|
66
|
+
*/
|
|
67
|
+
export const GRASS_SLOT_TILE_X: number;
|
|
68
|
+
/**
|
|
69
|
+
* Slot record word: the tile's place along the frame's z axis, in tiles of its level; a signed integer's bits.
|
|
70
|
+
*
|
|
71
|
+
* @type {number}
|
|
72
|
+
*/
|
|
73
|
+
export const GRASS_SLOT_TILE_Z: number;
|
|
74
|
+
/**
|
|
75
|
+
* Slot record word: one of the `GRASS_SLOT_STATE_*`.
|
|
76
|
+
*
|
|
77
|
+
* @type {number}
|
|
78
|
+
*/
|
|
79
|
+
export const GRASS_SLOT_STATE: number;
|
|
80
|
+
/**
|
|
81
|
+
* Slot record word: the last frame a view asked for the slot's tile.
|
|
82
|
+
*
|
|
83
|
+
* @type {number}
|
|
84
|
+
*/
|
|
85
|
+
export const GRASS_SLOT_WANTED_FRAME: number;
|
|
86
|
+
/**
|
|
87
|
+
* Slot record word: the most ground any column of the tile met, counted by the bake. A tile has this
|
|
88
|
+
* many layers; ones past the slot's own are other slots.
|
|
89
|
+
*
|
|
90
|
+
* @type {number}
|
|
91
|
+
*/
|
|
92
|
+
export const GRASS_SLOT_LAYER_COUNT: number;
|
|
93
|
+
/**
|
|
94
|
+
* Slot record word: how many of the slot's columns hold a surfel, counted by the bake.
|
|
95
|
+
*
|
|
96
|
+
* @type {number}
|
|
97
|
+
*/
|
|
98
|
+
export const GRASS_SLOT_SURFEL_COUNT: number;
|
|
99
|
+
/**
|
|
100
|
+
* Slot record word: the lowest height of any of the slot's surfels, as `grass_height_key` orders heights
|
|
101
|
+
* (`chunk_grass_slot`); the highest key there is while the slot holds none.
|
|
102
|
+
*
|
|
103
|
+
* @type {number}
|
|
104
|
+
*/
|
|
105
|
+
export const GRASS_SLOT_HEIGHT_MIN: number;
|
|
106
|
+
/**
|
|
107
|
+
* Slot record word: the highest height of any of the slot's surfels, as a `grass_height_key`; zero while
|
|
108
|
+
* the slot holds none.
|
|
109
|
+
*
|
|
110
|
+
* @type {number}
|
|
111
|
+
*/
|
|
112
|
+
export const GRASS_SLOT_HEIGHT_MAX: number;
|
|
113
|
+
/**
|
|
114
|
+
* Slot record word: how far the slot's surfels' normals stray from the frame's up axis, the bits of a
|
|
115
|
+
* `f32`: the greatest length of `normal - up` among them, 0 for level ground and at most 2.
|
|
116
|
+
*
|
|
117
|
+
* @type {number}
|
|
118
|
+
*/
|
|
119
|
+
export const GRASS_SLOT_NORMAL_SPREAD: number;
|
|
120
|
+
/**
|
|
121
|
+
* The slot holds nothing and is on the free stack.
|
|
122
|
+
*
|
|
123
|
+
* @type {number}
|
|
124
|
+
*/
|
|
125
|
+
export const GRASS_SLOT_STATE_FREE: number;
|
|
126
|
+
/**
|
|
127
|
+
* The slot is taken for a tile's layer that is not baked yet: its surfels are not to be read.
|
|
128
|
+
*
|
|
129
|
+
* @type {number}
|
|
130
|
+
*/
|
|
131
|
+
export const GRASS_SLOT_STATE_PENDING: number;
|
|
132
|
+
/**
|
|
133
|
+
* The slot's surfels are its tile's layer.
|
|
134
|
+
*
|
|
135
|
+
* @type {number}
|
|
136
|
+
*/
|
|
137
|
+
export const GRASS_SLOT_STATE_BAKED: number;
|
|
138
|
+
/**
|
|
139
|
+
* The slot was taken for a tile's layer but could not be listed in the directory: nothing finds it, and
|
|
140
|
+
* the next retire puts it back on the free stack.
|
|
141
|
+
*
|
|
142
|
+
* @type {number}
|
|
143
|
+
*/
|
|
144
|
+
export const GRASS_SLOT_STATE_ORPHAN: number;
|
|
145
|
+
/**
|
|
146
|
+
* The slot's surfels are its tile's layer as it was, and can be read, but a member of its surface has
|
|
147
|
+
* come, gone or moved over it since: it is baked again, in place, when a view next asks for it.
|
|
148
|
+
*
|
|
149
|
+
* @type {number}
|
|
150
|
+
*/
|
|
151
|
+
export const GRASS_SLOT_STATE_STALE: number;
|
|
152
|
+
/**
|
|
153
|
+
* Words at the front of the pool's arena, ahead of the slot records: the pool's own counters. Slot `s`'s
|
|
154
|
+
* record starts at word `GRASS_POOL_HEADER_WORDS + s * GRASS_SLOT_WORDS`.
|
|
155
|
+
*
|
|
156
|
+
* @type {number}
|
|
157
|
+
*/
|
|
158
|
+
export const GRASS_POOL_HEADER_WORDS: number;
|
|
159
|
+
/**
|
|
160
|
+
* Pool arena word: how many slots the free stack holds (`chunk_slot_stack`'s count).
|
|
161
|
+
*
|
|
162
|
+
* @type {number}
|
|
163
|
+
*/
|
|
164
|
+
export const GRASS_POOL_FREE_COUNT: number;
|
|
165
|
+
/**
|
|
166
|
+
* Pool arena word: how many asks for a tile's layer have been turned away because no slot was free, since
|
|
167
|
+
* the pool was made. It only rises; a pool grows when it has.
|
|
168
|
+
*
|
|
169
|
+
* @type {number}
|
|
170
|
+
*/
|
|
171
|
+
export const GRASS_POOL_STARVED: number;
|
|
172
|
+
/**
|
|
173
|
+
* Pool arena word: how many layers of tiles have been baked since the pool was made.
|
|
174
|
+
*
|
|
175
|
+
* @type {number}
|
|
176
|
+
*/
|
|
177
|
+
export const GRASS_POOL_BAKED: number;
|
|
178
|
+
/**
|
|
179
|
+
* Pool arena word: how many slots the frame's retire has evicted of the bucket its plan takes some of.
|
|
180
|
+
*
|
|
181
|
+
* @type {number}
|
|
182
|
+
*/
|
|
183
|
+
export const GRASS_POOL_EVICTED: number;
|
|
184
|
+
/**
|
|
185
|
+
* Pool arena word: the eviction plan's whole buckets (`age_eviction_plan`'s x), written by a frame's
|
|
186
|
+
* schedule for the next frame's retire.
|
|
187
|
+
*
|
|
188
|
+
* @type {number}
|
|
189
|
+
*/
|
|
190
|
+
export const GRASS_POOL_EVICT_BUCKETS: number;
|
|
191
|
+
/**
|
|
192
|
+
* Pool arena word: the eviction plan's count of the bucket below the whole ones (`age_eviction_plan`'s y).
|
|
193
|
+
*
|
|
194
|
+
* @type {number}
|
|
195
|
+
*/
|
|
196
|
+
export const GRASS_POOL_EVICT_REMAINING: number;
|
|
197
|
+
/**
|
|
198
|
+
* Pool arena word: how many records have been removed from the directory since the pool was made. It
|
|
199
|
+
* only rises; the directory is rebuilt when enough have gone since its last rebuild.
|
|
200
|
+
*
|
|
201
|
+
* @type {number}
|
|
202
|
+
*/
|
|
203
|
+
export const GRASS_POOL_REMOVED: number;
|
|
204
|
+
/**
|
|
205
|
+
* Pool arena word: the first of `AGE_EVICTION_BUCKETS` counts, the slots the frame's retire kept and
|
|
206
|
+
* could have evicted, by the bucket of the frames since a view last asked for them.
|
|
207
|
+
*
|
|
208
|
+
* @type {number}
|
|
209
|
+
*/
|
|
210
|
+
export const GRASS_POOL_AGES: number;
|
|
211
|
+
//# sourceMappingURL=GRASS_SURFACE.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GRASS_SURFACE.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/grass/surface/GRASS_SURFACE.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;GAKG;AACH,iCAFU,MAAM,CAEqB;AAErC;;;;GAIG;AACH,iCAFU,MAAM,CAE0D;AAE1E;;;;;;GAMG;AACH,qCAFU,MAAM,CAEwB;AAExC;;;;GAIG;AACH,+BAFU,MAAM,CAEmB;AAEnC;;;;GAIG;AACH,iCAFU,MAAM,CAEoB;AAEpC;;;;GAIG;AACH,qCAFU,MAAM,CAEwB;AAExC;;;;GAIG;AACH,gCAFU,MAAM,CAEmB;AAEnC;;;;GAIG;AACH,gCAFU,MAAM,CAEmB;AAEnC;;;;GAIG;AACH,+BAFU,MAAM,CAEkB;AAElC;;;;GAIG;AACH,sCAFU,MAAM,CAEyB;AAEzC;;;;;GAKG;AACH,qCAFU,MAAM,CAEwB;AAExC;;;;GAIG;AACH,sCAFU,MAAM,CAEyB;AAEzC;;;;;GAKG;AACH,oCAFU,MAAM,CAEuB;AAEvC;;;;;GAKG;AACH,oCAFU,MAAM,CAEuB;AAEvC;;;;;GAKG;AACH,uCAFU,MAAM,CAE2B;AAE3C;;;;GAIG;AACH,oCAFU,MAAM,CAEuB;AAEvC;;;;GAIG;AACH,uCAFU,MAAM,CAE0B;AAE1C;;;;GAIG;AACH,qCAFU,MAAM,CAEwB;AAExC;;;;;GAKG;AACH,sCAFU,MAAM,CAEyB;AAEzC;;;;;GAKG;AACH,qCAFU,MAAM,CAEwB;AAExC;;;;;GAKG;AACH,sCAFU,MAAM,CAEgD;AAEhE;;;;GAIG;AACH,oCAFU,MAAM,CAEuB;AAEvC;;;;;GAKG;AACH,iCAFU,MAAM,CAEoB;AAEpC;;;;GAIG;AACH,+BAFU,MAAM,CAEkB;AAElC;;;;GAIG;AACH,iCAFU,MAAM,CAEoB;AAEpC;;;;;GAKG;AACH,uCAFU,MAAM,CAE0B;AAE1C;;;;GAIG;AACH,yCAFU,MAAM,CAE4B;AAE5C;;;;;GAKG;AACH,iCAFU,MAAM,CAEoB;AAEpC;;;;;GAKG;AACH,8BAFU,MAAM,CAEiB"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { AGE_EVICTION_BUCKETS } from "../../gpu_primitive/age_eviction/chunk_age_eviction.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Grass surfaces on the device: the constants every pass over them shares.
|
|
5
|
+
*
|
|
6
|
+
* A grass surface is a group of mesh instances with one frame (a `transforms` row). Its ground is sampled
|
|
7
|
+
* into **surfels** on a lattice in that frame: columns along the frame's up axis, a spacing apart, each
|
|
8
|
+
* holding the ground the column meets (`chunk_grass_surfel`). A surface has **levels**, level `l` at
|
|
9
|
+
* `2^l` times the finest spacing, and each level is cut into square **tiles** of
|
|
10
|
+
* {@link GRASS_TILE_COLUMNS} columns a side. A column can meet ground more than once (a hilltop over a
|
|
11
|
+
* cave floor), so a tile has **layers**: layer `k` holds each column's `k`-th ground from the top.
|
|
12
|
+
*
|
|
13
|
+
* One layer of one tile is what is baked and kept: {@link GRASS_TILE_SURFELS} surfels in a **slot** of a
|
|
14
|
+
* pool every surface shares. A slot is a tile of the surfel atlas (a `GPUTileAtlas2D` of tiles
|
|
15
|
+
* {@link GRASS_TILE_COLUMNS} texels a side) and a record of {@link GRASS_SLOT_WORDS} words saying which
|
|
16
|
+
* layer of which tile of which surface it holds.
|
|
17
|
+
*
|
|
18
|
+
* **A slot's life.** A view's ask takes a free slot for a layer it wants and finds none for
|
|
19
|
+
* ({@link GRASS_SLOT_STATE_PENDING}), the frame's bake fills it ({@link GRASS_SLOT_STATE_BAKED}), and every
|
|
20
|
+
* later ask stamps it with the frame. Ground that changes under it makes it
|
|
21
|
+
* {@link GRASS_SLOT_STATE_STALE} until it is baked again. A slot no view has asked for since the frame
|
|
22
|
+
* before can be evicted, and is only when the pool is short of free slots, the longest unasked first
|
|
23
|
+
* (`chunk_age_eviction`); where the slots in use fill the pool, an ask starves and the pool grows.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Columns along a side of a tile. A tile's layer is baked by one workgroup, a thread a column, so the
|
|
28
|
+
* square of this is the workgroup's size.
|
|
29
|
+
*
|
|
30
|
+
* @type {number}
|
|
31
|
+
*/
|
|
32
|
+
export const GRASS_TILE_COLUMNS = 16;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Surfels in one layer of one tile, and threads in the workgroup that bakes it.
|
|
36
|
+
*
|
|
37
|
+
* @type {number}
|
|
38
|
+
*/
|
|
39
|
+
export const GRASS_TILE_SURFELS = GRASS_TILE_COLUMNS * GRASS_TILE_COLUMNS;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Faces a column's walk crosses before it stops, kept or not. A thread's loop bound: each crossing is one
|
|
43
|
+
* walk of the scene's TLAS and of the geometry it lands in. Ground under more faces than this is not
|
|
44
|
+
* found.
|
|
45
|
+
*
|
|
46
|
+
* @type {number}
|
|
47
|
+
*/
|
|
48
|
+
export const GRASS_COLUMN_CROSSINGS = 8;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Words in a slot's record.
|
|
52
|
+
*
|
|
53
|
+
* @type {number}
|
|
54
|
+
*/
|
|
55
|
+
export const GRASS_SLOT_WORDS = 12;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Slot record word: the `transforms` row of the surface the slot's tile belongs to.
|
|
59
|
+
*
|
|
60
|
+
* @type {number}
|
|
61
|
+
*/
|
|
62
|
+
export const GRASS_SLOT_SURFACE = 0;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Slot record word: the tile's level in the low byte, the layer the slot holds in the next.
|
|
66
|
+
*
|
|
67
|
+
* @type {number}
|
|
68
|
+
*/
|
|
69
|
+
export const GRASS_SLOT_LEVEL_LAYER = 1;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Slot record word: the tile's place along the frame's x axis, in tiles of its level; a signed integer's bits.
|
|
73
|
+
*
|
|
74
|
+
* @type {number}
|
|
75
|
+
*/
|
|
76
|
+
export const GRASS_SLOT_TILE_X = 2;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Slot record word: the tile's place along the frame's z axis, in tiles of its level; a signed integer's bits.
|
|
80
|
+
*
|
|
81
|
+
* @type {number}
|
|
82
|
+
*/
|
|
83
|
+
export const GRASS_SLOT_TILE_Z = 3;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Slot record word: one of the `GRASS_SLOT_STATE_*`.
|
|
87
|
+
*
|
|
88
|
+
* @type {number}
|
|
89
|
+
*/
|
|
90
|
+
export const GRASS_SLOT_STATE = 4;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Slot record word: the last frame a view asked for the slot's tile.
|
|
94
|
+
*
|
|
95
|
+
* @type {number}
|
|
96
|
+
*/
|
|
97
|
+
export const GRASS_SLOT_WANTED_FRAME = 5;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Slot record word: the most ground any column of the tile met, counted by the bake. A tile has this
|
|
101
|
+
* many layers; ones past the slot's own are other slots.
|
|
102
|
+
*
|
|
103
|
+
* @type {number}
|
|
104
|
+
*/
|
|
105
|
+
export const GRASS_SLOT_LAYER_COUNT = 6;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Slot record word: how many of the slot's columns hold a surfel, counted by the bake.
|
|
109
|
+
*
|
|
110
|
+
* @type {number}
|
|
111
|
+
*/
|
|
112
|
+
export const GRASS_SLOT_SURFEL_COUNT = 7;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Slot record word: the lowest height of any of the slot's surfels, as `grass_height_key` orders heights
|
|
116
|
+
* (`chunk_grass_slot`); the highest key there is while the slot holds none.
|
|
117
|
+
*
|
|
118
|
+
* @type {number}
|
|
119
|
+
*/
|
|
120
|
+
export const GRASS_SLOT_HEIGHT_MIN = 8;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Slot record word: the highest height of any of the slot's surfels, as a `grass_height_key`; zero while
|
|
124
|
+
* the slot holds none.
|
|
125
|
+
*
|
|
126
|
+
* @type {number}
|
|
127
|
+
*/
|
|
128
|
+
export const GRASS_SLOT_HEIGHT_MAX = 9;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Slot record word: how far the slot's surfels' normals stray from the frame's up axis, the bits of a
|
|
132
|
+
* `f32`: the greatest length of `normal - up` among them, 0 for level ground and at most 2.
|
|
133
|
+
*
|
|
134
|
+
* @type {number}
|
|
135
|
+
*/
|
|
136
|
+
export const GRASS_SLOT_NORMAL_SPREAD = 10;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* The slot holds nothing and is on the free stack.
|
|
140
|
+
*
|
|
141
|
+
* @type {number}
|
|
142
|
+
*/
|
|
143
|
+
export const GRASS_SLOT_STATE_FREE = 0;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* The slot is taken for a tile's layer that is not baked yet: its surfels are not to be read.
|
|
147
|
+
*
|
|
148
|
+
* @type {number}
|
|
149
|
+
*/
|
|
150
|
+
export const GRASS_SLOT_STATE_PENDING = 1;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* The slot's surfels are its tile's layer.
|
|
154
|
+
*
|
|
155
|
+
* @type {number}
|
|
156
|
+
*/
|
|
157
|
+
export const GRASS_SLOT_STATE_BAKED = 2;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* The slot was taken for a tile's layer but could not be listed in the directory: nothing finds it, and
|
|
161
|
+
* the next retire puts it back on the free stack.
|
|
162
|
+
*
|
|
163
|
+
* @type {number}
|
|
164
|
+
*/
|
|
165
|
+
export const GRASS_SLOT_STATE_ORPHAN = 3;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* The slot's surfels are its tile's layer as it was, and can be read, but a member of its surface has
|
|
169
|
+
* come, gone or moved over it since: it is baked again, in place, when a view next asks for it.
|
|
170
|
+
*
|
|
171
|
+
* @type {number}
|
|
172
|
+
*/
|
|
173
|
+
export const GRASS_SLOT_STATE_STALE = 4;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Words at the front of the pool's arena, ahead of the slot records: the pool's own counters. Slot `s`'s
|
|
177
|
+
* record starts at word `GRASS_POOL_HEADER_WORDS + s * GRASS_SLOT_WORDS`.
|
|
178
|
+
*
|
|
179
|
+
* @type {number}
|
|
180
|
+
*/
|
|
181
|
+
export const GRASS_POOL_HEADER_WORDS = 8 + AGE_EVICTION_BUCKETS;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Pool arena word: how many slots the free stack holds (`chunk_slot_stack`'s count).
|
|
185
|
+
*
|
|
186
|
+
* @type {number}
|
|
187
|
+
*/
|
|
188
|
+
export const GRASS_POOL_FREE_COUNT = 0;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Pool arena word: how many asks for a tile's layer have been turned away because no slot was free, since
|
|
192
|
+
* the pool was made. It only rises; a pool grows when it has.
|
|
193
|
+
*
|
|
194
|
+
* @type {number}
|
|
195
|
+
*/
|
|
196
|
+
export const GRASS_POOL_STARVED = 1;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Pool arena word: how many layers of tiles have been baked since the pool was made.
|
|
200
|
+
*
|
|
201
|
+
* @type {number}
|
|
202
|
+
*/
|
|
203
|
+
export const GRASS_POOL_BAKED = 2;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Pool arena word: how many slots the frame's retire has evicted of the bucket its plan takes some of.
|
|
207
|
+
*
|
|
208
|
+
* @type {number}
|
|
209
|
+
*/
|
|
210
|
+
export const GRASS_POOL_EVICTED = 3;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Pool arena word: the eviction plan's whole buckets (`age_eviction_plan`'s x), written by a frame's
|
|
214
|
+
* schedule for the next frame's retire.
|
|
215
|
+
*
|
|
216
|
+
* @type {number}
|
|
217
|
+
*/
|
|
218
|
+
export const GRASS_POOL_EVICT_BUCKETS = 4;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Pool arena word: the eviction plan's count of the bucket below the whole ones (`age_eviction_plan`'s y).
|
|
222
|
+
*
|
|
223
|
+
* @type {number}
|
|
224
|
+
*/
|
|
225
|
+
export const GRASS_POOL_EVICT_REMAINING = 5;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Pool arena word: how many records have been removed from the directory since the pool was made. It
|
|
229
|
+
* only rises; the directory is rebuilt when enough have gone since its last rebuild.
|
|
230
|
+
*
|
|
231
|
+
* @type {number}
|
|
232
|
+
*/
|
|
233
|
+
export const GRASS_POOL_REMOVED = 6;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Pool arena word: the first of `AGE_EVICTION_BUCKETS` counts, the slots the frame's retire kept and
|
|
237
|
+
* could have evicted, by the bucket of the frames since a view last asked for them.
|
|
238
|
+
*
|
|
239
|
+
* @type {number}
|
|
240
|
+
*/
|
|
241
|
+
export const GRASS_POOL_AGES = 8;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How many levels a view asks a surface for: enough that the coarsest in use reaches the distance where
|
|
3
|
+
* the tallest blade spans `shortest_blade` pixels, each level reaching twice as far as the one below.
|
|
4
|
+
*
|
|
5
|
+
* Level 0 reaches `finest_spacing * focal / narrowest_blade` and a blade is drawn out to
|
|
6
|
+
* `blade_length * focal / shortest_blade`, so the focal length cancels: the count follows the blade, the
|
|
7
|
+
* spacing and the two pixel tolerances alone.
|
|
8
|
+
*
|
|
9
|
+
* @param {number} blade_length the tallest blade of any surface, world units; positive
|
|
10
|
+
* @param {number} finest_spacing positive
|
|
11
|
+
* @param {number} narrowest_blade pixels, positive
|
|
12
|
+
* @param {number} shortest_blade pixels, positive
|
|
13
|
+
* @returns {number} at least 1
|
|
14
|
+
*/
|
|
15
|
+
export function grass_surface_level_count(blade_length: number, finest_spacing: number, narrowest_blade: number, shortest_blade: number): number;
|
|
16
|
+
/**
|
|
17
|
+
* A grass surface as the passes that ask for its tiles read it. Records sit packed from 0 in the
|
|
18
|
+
* `grass_surfaces` buffer, in no order.
|
|
19
|
+
*
|
|
20
|
+
* - `node`: the surface's `transforms` row. Its frame is that row's position and rotation; the row's scale
|
|
21
|
+
* is not part of the frame, so a frame's units are the world's.
|
|
22
|
+
* - `blade_length`: the tallest blade that grows on any of its members, in world units. It sets how far
|
|
23
|
+
* from a view the surface's tiles are wanted.
|
|
24
|
+
* - `low`, `high`: a box in the frame that holds every member.
|
|
25
|
+
*
|
|
26
|
+
* 48 bytes.
|
|
27
|
+
*
|
|
28
|
+
* @type {WebGPUStruct}
|
|
29
|
+
*/
|
|
30
|
+
export const GRASS_SURFACE_RECORD_STRUCT: WebGPUStruct;
|
|
31
|
+
/**
|
|
32
|
+
* Words in a {@link GRASS_SURFACE_RECORD_STRUCT}, and the words its fields start at.
|
|
33
|
+
*/
|
|
34
|
+
export const GRASS_SURFACE_RECORD_WORDS: 12;
|
|
35
|
+
export const GRASS_SURFACE_RECORD_NODE: 0;
|
|
36
|
+
export const GRASS_SURFACE_RECORD_BLADE_LENGTH: 1;
|
|
37
|
+
export const GRASS_SURFACE_RECORD_LOW: 4;
|
|
38
|
+
export const GRASS_SURFACE_RECORD_HIGH: 8;
|
|
39
|
+
/**
|
|
40
|
+
* The `grass_surfaces` buffer, as its readers declare it.
|
|
41
|
+
*
|
|
42
|
+
* @type {ShaderResourceDescriptor}
|
|
43
|
+
*/
|
|
44
|
+
export const GRASS_SURFACES_RESOURCE: ShaderResourceDescriptor;
|
|
45
|
+
/**
|
|
46
|
+
* The pool's arena (`GRASS_SURFACE.js`), as the passes that write it declare it: its counters, then a
|
|
47
|
+
* record a slot.
|
|
48
|
+
*
|
|
49
|
+
* @type {ShaderResourceDescriptor}
|
|
50
|
+
*/
|
|
51
|
+
export const GRASS_POOL_RESOURCE: ShaderResourceDescriptor;
|
|
52
|
+
/**
|
|
53
|
+
* The pool's directory, a `chunk_hash_table_atomic` table at offset 0, as the passes that look tiles up
|
|
54
|
+
* in it declare it.
|
|
55
|
+
*
|
|
56
|
+
* @type {ShaderResourceDescriptor}
|
|
57
|
+
*/
|
|
58
|
+
export const GRASS_DIRECTORY_RESOURCE: ShaderResourceDescriptor;
|
|
59
|
+
/**
|
|
60
|
+
* What a view asks of the grass surfaces, as an immediate of the passes that ask.
|
|
61
|
+
*
|
|
62
|
+
* - `finest_spacing`: the distance between neighbouring columns of level 0, in world units.
|
|
63
|
+
* - `focal`: the view's focal length in pixels of its render resolution: what a unit at a distance of one
|
|
64
|
+
* unit spans.
|
|
65
|
+
* - `narrowest_blade`: the least width a blade is drawn at, in pixels. A level serves the distances at which
|
|
66
|
+
* its spacing spans no more than this.
|
|
67
|
+
* - `shortest_blade`: the least length a blade is drawn at, in pixels. Past the distance where a surface's
|
|
68
|
+
* tallest blade spans less, none of its tiles are wanted.
|
|
69
|
+
* - `frame`: the frame's number, which a wanted tile is stamped with.
|
|
70
|
+
* - `level_count`: how many levels a surface is asked for, 0 the finest.
|
|
71
|
+
* - `surface_count`: how many records `grass_surfaces` holds.
|
|
72
|
+
* - `job_capacity`: how many layers of tiles may be taken for baking this frame.
|
|
73
|
+
* - `slot_capacity`: how many slots the pool has.
|
|
74
|
+
* - `canopy_opacity`: how many blades a view ray may cross before the grass behind them is left out.
|
|
75
|
+
* - `blade_capacity`: how many blades the frame's blade list has room for.
|
|
76
|
+
*
|
|
77
|
+
* @type {WebGPUStruct}
|
|
78
|
+
*/
|
|
79
|
+
export const GRASS_SURFACE_VIEW_SETTINGS: WebGPUStruct;
|
|
80
|
+
import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
|
|
81
|
+
import { ShaderResourceDescriptor } from "../../shader/resource/ShaderResourceDescriptor.js";
|
|
82
|
+
//# sourceMappingURL=GRASS_SURFACE_VIEW.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GRASS_SURFACE_VIEW.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/grass/surface/GRASS_SURFACE_VIEW.js"],"names":[],"mappings":"AA4FA;;;;;;;;;;;;;GAaG;AACH,wDANW,MAAM,kBACN,MAAM,mBACN,MAAM,kBACN,MAAM,GACJ,MAAM,CAMlB;AAzGD;;;;;;;;;;;;;GAaG;AACH,0CAFU,YAAY,CAOG;AAEzB;;GAEG;AACH,4CAA6C;AAC7C,0CAA2C;AAC3C,kDAAmD;AACnD,yCAA0C;AAC1C,0CAA2C;AAE3C;;;;GAIG;AACH,sCAFU,wBAAwB,CAE6G;AAE/I;;;;;GAKG;AACH,kCAFU,wBAAwB,CAE0F;AAE5H;;;;;GAKG;AACH,uCAFU,wBAAwB,CAEoG;AAEtI;;;;;;;;;;;;;;;;;;;GAmBG;AACH,0CAFU,YAAY,CAcS;6BAvFF,mCAAmC;yCAHvB,mDAAmD"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { ShaderResourceDescriptor } from "../../shader/resource/ShaderResourceDescriptor.js";
|
|
2
|
+
import { atomic_u32, f32, u32, vec3f } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
3
|
+
import { WebGPUArray } from "../../shader/type/WebGPUArray.js";
|
|
4
|
+
import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A grass surface as the passes that ask for its tiles read it. Records sit packed from 0 in the
|
|
8
|
+
* `grass_surfaces` buffer, in no order.
|
|
9
|
+
*
|
|
10
|
+
* - `node`: the surface's `transforms` row. Its frame is that row's position and rotation; the row's scale
|
|
11
|
+
* is not part of the frame, so a frame's units are the world's.
|
|
12
|
+
* - `blade_length`: the tallest blade that grows on any of its members, in world units. It sets how far
|
|
13
|
+
* from a view the surface's tiles are wanted.
|
|
14
|
+
* - `low`, `high`: a box in the frame that holds every member.
|
|
15
|
+
*
|
|
16
|
+
* 48 bytes.
|
|
17
|
+
*
|
|
18
|
+
* @type {WebGPUStruct}
|
|
19
|
+
*/
|
|
20
|
+
export const GRASS_SURFACE_RECORD_STRUCT = WebGPUStruct.from({
|
|
21
|
+
node: u32,
|
|
22
|
+
blade_length: f32,
|
|
23
|
+
low: vec3f,
|
|
24
|
+
high: vec3f,
|
|
25
|
+
}, "GrassSurfaceRecord");
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Words in a {@link GRASS_SURFACE_RECORD_STRUCT}, and the words its fields start at.
|
|
29
|
+
*/
|
|
30
|
+
export const GRASS_SURFACE_RECORD_WORDS = 12;
|
|
31
|
+
export const GRASS_SURFACE_RECORD_NODE = 0;
|
|
32
|
+
export const GRASS_SURFACE_RECORD_BLADE_LENGTH = 1;
|
|
33
|
+
export const GRASS_SURFACE_RECORD_LOW = 4;
|
|
34
|
+
export const GRASS_SURFACE_RECORD_HIGH = 8;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The `grass_surfaces` buffer, as its readers declare it.
|
|
38
|
+
*
|
|
39
|
+
* @type {ShaderResourceDescriptor}
|
|
40
|
+
*/
|
|
41
|
+
export const GRASS_SURFACES_RESOURCE = ShaderResourceDescriptor.storageBuffer("grass_surfaces", WebGPUArray.from(GRASS_SURFACE_RECORD_STRUCT));
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The pool's arena (`GRASS_SURFACE.js`), as the passes that write it declare it: its counters, then a
|
|
45
|
+
* record a slot.
|
|
46
|
+
*
|
|
47
|
+
* @type {ShaderResourceDescriptor}
|
|
48
|
+
*/
|
|
49
|
+
export const GRASS_POOL_RESOURCE = ShaderResourceDescriptor.storageBuffer("grass_pool", WebGPUArray.from(atomic_u32), true);
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The pool's directory, a `chunk_hash_table_atomic` table at offset 0, as the passes that look tiles up
|
|
53
|
+
* in it declare it.
|
|
54
|
+
*
|
|
55
|
+
* @type {ShaderResourceDescriptor}
|
|
56
|
+
*/
|
|
57
|
+
export const GRASS_DIRECTORY_RESOURCE = ShaderResourceDescriptor.storageBuffer("grass_directory", WebGPUArray.from(atomic_u32), true);
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* What a view asks of the grass surfaces, as an immediate of the passes that ask.
|
|
61
|
+
*
|
|
62
|
+
* - `finest_spacing`: the distance between neighbouring columns of level 0, in world units.
|
|
63
|
+
* - `focal`: the view's focal length in pixels of its render resolution: what a unit at a distance of one
|
|
64
|
+
* unit spans.
|
|
65
|
+
* - `narrowest_blade`: the least width a blade is drawn at, in pixels. A level serves the distances at which
|
|
66
|
+
* its spacing spans no more than this.
|
|
67
|
+
* - `shortest_blade`: the least length a blade is drawn at, in pixels. Past the distance where a surface's
|
|
68
|
+
* tallest blade spans less, none of its tiles are wanted.
|
|
69
|
+
* - `frame`: the frame's number, which a wanted tile is stamped with.
|
|
70
|
+
* - `level_count`: how many levels a surface is asked for, 0 the finest.
|
|
71
|
+
* - `surface_count`: how many records `grass_surfaces` holds.
|
|
72
|
+
* - `job_capacity`: how many layers of tiles may be taken for baking this frame.
|
|
73
|
+
* - `slot_capacity`: how many slots the pool has.
|
|
74
|
+
* - `canopy_opacity`: how many blades a view ray may cross before the grass behind them is left out.
|
|
75
|
+
* - `blade_capacity`: how many blades the frame's blade list has room for.
|
|
76
|
+
*
|
|
77
|
+
* @type {WebGPUStruct}
|
|
78
|
+
*/
|
|
79
|
+
export const GRASS_SURFACE_VIEW_SETTINGS = WebGPUStruct.from({
|
|
80
|
+
finest_spacing: f32,
|
|
81
|
+
focal: f32,
|
|
82
|
+
narrowest_blade: f32,
|
|
83
|
+
shortest_blade: f32,
|
|
84
|
+
frame: u32,
|
|
85
|
+
level_count: u32,
|
|
86
|
+
surface_count: u32,
|
|
87
|
+
job_capacity: u32,
|
|
88
|
+
slot_capacity: u32,
|
|
89
|
+
canopy_opacity: f32,
|
|
90
|
+
blade_capacity: u32,
|
|
91
|
+
}, "GrassSurfaceViewSettings");
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* How many levels a view asks a surface for: enough that the coarsest in use reaches the distance where
|
|
95
|
+
* the tallest blade spans `shortest_blade` pixels, each level reaching twice as far as the one below.
|
|
96
|
+
*
|
|
97
|
+
* Level 0 reaches `finest_spacing * focal / narrowest_blade` and a blade is drawn out to
|
|
98
|
+
* `blade_length * focal / shortest_blade`, so the focal length cancels: the count follows the blade, the
|
|
99
|
+
* spacing and the two pixel tolerances alone.
|
|
100
|
+
*
|
|
101
|
+
* @param {number} blade_length the tallest blade of any surface, world units; positive
|
|
102
|
+
* @param {number} finest_spacing positive
|
|
103
|
+
* @param {number} narrowest_blade pixels, positive
|
|
104
|
+
* @param {number} shortest_blade pixels, positive
|
|
105
|
+
* @returns {number} at least 1
|
|
106
|
+
*/
|
|
107
|
+
export function grass_surface_level_count(blade_length, finest_spacing, narrowest_blade, shortest_blade) {
|
|
108
|
+
const reach_in_finest_reaches = (blade_length * narrowest_blade) / (shortest_blade * finest_spacing);
|
|
109
|
+
|
|
110
|
+
return Math.max(1, Math.ceil(Math.log2(reach_in_finest_reaches)) + 1);
|
|
111
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clear height of ground under open sky: the largest finite half float, which is how a surfel stores it.
|
|
3
|
+
* Any stored clear height at or above this means nothing stands over the surfel.
|
|
4
|
+
* @type {number}
|
|
5
|
+
*/
|
|
6
|
+
export const GRASS_CLEAR_HEIGHT_OPEN: number;
|
|
7
|
+
/**
|
|
8
|
+
* One step of a walk down a column of a grass surface, from above the surface's members to below them.
|
|
9
|
+
*
|
|
10
|
+
* A column crosses the faces of its surface's members in order of falling height. Each crossing is either
|
|
11
|
+
* an upward face (ground a blade could stand on) or a downward one (an underside: a ceiling, the bottom of
|
|
12
|
+
* something resting there). What the column crossed just before a crossing decides what it is:
|
|
13
|
+
*
|
|
14
|
+
* - nothing: the crossing is under open sky;
|
|
15
|
+
* - a downward face: the crossing is in open air under it, and the gap between them is its clear height;
|
|
16
|
+
* - an upward face: the crossing is inside the member that face tops, where nothing grows.
|
|
17
|
+
*
|
|
18
|
+
* ```wgsl
|
|
19
|
+
* fn grass_column_begin() -> GrassColumnWalk
|
|
20
|
+
* fn grass_column_cross(walk: GrassColumnWalk, height: f32, faces_up: bool) -> GrassColumnCrossing
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* `grass_column_cross` takes the walk as it stood before the crossing and answers with:
|
|
24
|
+
*
|
|
25
|
+
* - `keep`: the crossing is ground to keep, an upward face that is not inside a member;
|
|
26
|
+
* - `clear_height`: for a kept crossing, the height of open air over it, `GRASS_CLEAR_HEIGHT_OPEN` under
|
|
27
|
+
* open sky; never negative;
|
|
28
|
+
* - `walk`: the walk after the crossing, to hand to the next one.
|
|
29
|
+
*
|
|
30
|
+
* Heights are along the surface frame's up axis and must not rise from one crossing to the next.
|
|
31
|
+
*
|
|
32
|
+
* Which way a face points is read from its winding, so ground under a one-sided sheet reads as inside it:
|
|
33
|
+
* a cave needs its ceiling modelled.
|
|
34
|
+
*
|
|
35
|
+
* @type {CodeChunk}
|
|
36
|
+
*/
|
|
37
|
+
export const chunk_grass_column_cross: CodeChunk;
|
|
38
|
+
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
39
|
+
//# sourceMappingURL=chunk_grass_column_cross.d.ts.map
|