@woosh/meep-engine 3.64.1 → 3.67.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/format/lut/cube/CubeLut.d.ts +38 -0
- package/src/format/lut/cube/CubeLut.d.ts.map +1 -0
- package/src/format/lut/cube/CubeLut.js +23 -0
- package/src/format/lut/cube/cube_read.d.ts +23 -0
- package/src/format/lut/cube/cube_read.d.ts.map +1 -0
- package/src/format/lut/cube/cube_read.js +199 -0
- package/src/format/lut/cube/cube_write.d.ts +15 -0
- package/src/format/lut/cube/cube_write.d.ts.map +1 -0
- package/src/format/lut/cube/cube_write.js +90 -0
- 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/README.md +1 -0
- package/src/shade/playground/probe_clipmap/index.html +5 -0
- package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
- package/src/shade/playground/probe_clipmap/main.js +7 -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 +59 -55
- package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts +73 -4
- package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts.map +1 -1
- package/src/shade/renderer/deferred/tonemap/ColorGrade.js +113 -7
- package/src/shade/renderer/deferred/tonemap/TONEMAP_PURKINJE_SHIFT.d.ts +12 -0
- package/src/shade/renderer/deferred/tonemap/TONEMAP_PURKINJE_SHIFT.d.ts.map +1 -0
- package/src/shade/renderer/deferred/tonemap/TONEMAP_PURKINJE_SHIFT.js +12 -0
- package/src/shade/renderer/deferred/tonemap/ToneMapper.d.ts +15 -1
- package/src/shade/renderer/deferred/tonemap/ToneMapper.d.ts.map +1 -1
- package/src/shade/renderer/deferred/tonemap/ToneMapper.js +31 -3
- package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.d.ts +25 -0
- package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.d.ts.map +1 -0
- package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.js +51 -0
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.d.ts +2 -2
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.d.ts.map +1 -1
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.js +6 -3
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.d.ts +3 -2
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.d.ts.map +1 -1
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.js +7 -3
- 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/eye/GPUCameraExposureManager.d.ts +35 -9
- package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.js +81 -11
- package/src/shade/renderer/postprocess/eye/shader_autoexposure_adapt.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/eye/shader_autoexposure_adapt.js +4 -1
- 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/color/conversion/chunk_CRM_REC709_AP1.d.ts +6 -0
- package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.js +7 -0
- package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.d.ts +4 -4
- package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.js +86 -5
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.d.ts +65 -0
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.js +136 -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
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinjie/chunk_apply_purkinjie_shift.d.ts +0 -11
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinjie/chunk_apply_purkinjie_shift.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinjie/chunk_apply_purkinjie_shift.js +0 -56
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The scene's clock as the blades' pass reads it, at this frame and at the frame before: whole seconds,
|
|
3
|
+
* and the rest of a second in [0, 1). Kept apart so that a blade's sway is formed exactly however long the
|
|
4
|
+
* scene has run.
|
|
5
|
+
*
|
|
6
|
+
* @type {WebGPUStruct}
|
|
7
|
+
*/
|
|
8
|
+
export const GRASS_BLADE_CLOCK_STRUCT: WebGPUStruct;
|
|
9
|
+
/**
|
|
10
|
+
* How a blade of grass stands in a wind: the arc `chunk_grass_blade` draws, bent.
|
|
11
|
+
*
|
|
12
|
+
* ```wgsl
|
|
13
|
+
* struct GrassBladeBend {
|
|
14
|
+
* facing: f32, // the way the blade leans, as GrassBlade's
|
|
15
|
+
* lean: f32, // signed: a blade can lean back from the way its tip has gone
|
|
16
|
+
* curl: f32,
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
19
|
+
* fn grass_blade_sway(frequency: f32, whole: u32, fraction: f32) -> f32
|
|
20
|
+
* fn grass_blade_bend(rest: GrassBladeBend, blade_length: f32, wind: vec3<f32>, species_wind: vec4<f32>, sway: f32, offsets: vec2<f32>, pushed: vec3<f32>) -> GrassBladeBend
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* **The bend** is the tree rig's drag law (`chunk_foliage_wind_step`) on a blade that stands upright in
|
|
24
|
+
* its surface's frame. `wind` is the air's velocity in that frame, m/s. The blade's tip turns towards
|
|
25
|
+
* where the wind goes over the ground by half the blade's compliance times the wind's speed times its
|
|
26
|
+
* speed across the blade; the compliance is `species_wind.x` times the blade's length cubed
|
|
27
|
+
* (`grass_blade_compliance`). The turn is held under a quarter turn the way the rig holds a joint under
|
|
28
|
+
* its limit, `θ m / (m + θ)`: a blade lying along the wind is pushed no further.
|
|
29
|
+
*
|
|
30
|
+
* The turn is shared between the blade's lean and its curl as a loaded beam shares it
|
|
31
|
+
* (`GRASS_BLADE_WIND_LEAN_SHARE`, `GRASS_BLADE_WIND_CURL_SHARE`), each added to the blade's own in still
|
|
32
|
+
* air as a direction over the ground. A blade is one flat arc, so the two are then read along the way its
|
|
33
|
+
* tip has gone: that way is the bent blade's `facing`. In still air, with nothing pushing, the answer is
|
|
34
|
+
* `rest`, bit for bit.
|
|
35
|
+
*
|
|
36
|
+
* **A push** is something that leaves the blade no room to stand (`chunk_grass_press`): `pushed.z` is
|
|
37
|
+
* the angle from upright the line from the blade's root to its tip is held at, at least, and
|
|
38
|
+
* `pushed.xy` the velocity over the ground, in the surface's frame, of what holds it. A blade its own
|
|
39
|
+
* lean and the wind already have that far over, whichever way, is not moved. One that is not is leant
|
|
40
|
+
* further until it is: the way its tip has gone already, or the way it faces if it has gone nowhere, when
|
|
41
|
+
* what holds it stands still; the way that goes when it slides; and between the two by their speeds, the
|
|
42
|
+
* blade's tip's as it sways, its length times its frequency, against the other's. Zero for no push.
|
|
43
|
+
*
|
|
44
|
+
* **The sway** stands in for the ringing a blade with no memory cannot have. The wind a blade feels is
|
|
45
|
+
* unsteadier than the scene's wind resolves, by `species_wind.z` of its speed: along the wind and across
|
|
46
|
+
* it, each a sine at the blade's own frequency, `species_wind.y` over its length squared
|
|
47
|
+
* (`grass_blade_frequency`), from where in a turn `offsets` start it. That unsteadiness is added to the
|
|
48
|
+
* wind before the law above, so it bends the blade as wind does: twice as much along the wind as across.
|
|
49
|
+
* `sway` is how far through a turn the blade is, [0, 1), which `grass_blade_sway` gives for a clock: the
|
|
50
|
+
* frequency is held to 2⁻¹⁶ Hz and multiplied by the whole seconds in integers, so the turn is exact at
|
|
51
|
+
* any age of the scene.
|
|
52
|
+
*
|
|
53
|
+
* @type {CodeChunk}
|
|
54
|
+
*/
|
|
55
|
+
export const chunk_grass_blade_wind: CodeChunk;
|
|
56
|
+
import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
|
|
57
|
+
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
58
|
+
//# sourceMappingURL=chunk_grass_blade_wind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk_grass_blade_wind.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/grass/blade/chunk_grass_blade_wind.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,uCAFU,YAAY,CAOA;AAEtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,qCAFU,SAAS,CA8GjB;6BA3K2B,mCAAmC;0BAFtC,oCAAoC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
2
|
+
import { f32, u32 } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
3
|
+
import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
|
|
4
|
+
import { GRASS_BLADE_WIND_CURL_SHARE, GRASS_BLADE_WIND_LEAN_SHARE } from "./grass_blade_mechanics.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The scene's clock as the blades' pass reads it, at this frame and at the frame before: whole seconds,
|
|
8
|
+
* and the rest of a second in [0, 1). Kept apart so that a blade's sway is formed exactly however long the
|
|
9
|
+
* scene has run.
|
|
10
|
+
*
|
|
11
|
+
* @type {WebGPUStruct}
|
|
12
|
+
*/
|
|
13
|
+
export const GRASS_BLADE_CLOCK_STRUCT = WebGPUStruct.from({
|
|
14
|
+
whole: u32,
|
|
15
|
+
fraction: f32,
|
|
16
|
+
previous_whole: u32,
|
|
17
|
+
previous_fraction: f32,
|
|
18
|
+
}, "GrassBladeClock");
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* How a blade of grass stands in a wind: the arc `chunk_grass_blade` draws, bent.
|
|
22
|
+
*
|
|
23
|
+
* ```wgsl
|
|
24
|
+
* struct GrassBladeBend {
|
|
25
|
+
* facing: f32, // the way the blade leans, as GrassBlade's
|
|
26
|
+
* lean: f32, // signed: a blade can lean back from the way its tip has gone
|
|
27
|
+
* curl: f32,
|
|
28
|
+
* }
|
|
29
|
+
*
|
|
30
|
+
* fn grass_blade_sway(frequency: f32, whole: u32, fraction: f32) -> f32
|
|
31
|
+
* fn grass_blade_bend(rest: GrassBladeBend, blade_length: f32, wind: vec3<f32>, species_wind: vec4<f32>, sway: f32, offsets: vec2<f32>, pushed: vec3<f32>) -> GrassBladeBend
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* **The bend** is the tree rig's drag law (`chunk_foliage_wind_step`) on a blade that stands upright in
|
|
35
|
+
* its surface's frame. `wind` is the air's velocity in that frame, m/s. The blade's tip turns towards
|
|
36
|
+
* where the wind goes over the ground by half the blade's compliance times the wind's speed times its
|
|
37
|
+
* speed across the blade; the compliance is `species_wind.x` times the blade's length cubed
|
|
38
|
+
* (`grass_blade_compliance`). The turn is held under a quarter turn the way the rig holds a joint under
|
|
39
|
+
* its limit, `θ m / (m + θ)`: a blade lying along the wind is pushed no further.
|
|
40
|
+
*
|
|
41
|
+
* The turn is shared between the blade's lean and its curl as a loaded beam shares it
|
|
42
|
+
* (`GRASS_BLADE_WIND_LEAN_SHARE`, `GRASS_BLADE_WIND_CURL_SHARE`), each added to the blade's own in still
|
|
43
|
+
* air as a direction over the ground. A blade is one flat arc, so the two are then read along the way its
|
|
44
|
+
* tip has gone: that way is the bent blade's `facing`. In still air, with nothing pushing, the answer is
|
|
45
|
+
* `rest`, bit for bit.
|
|
46
|
+
*
|
|
47
|
+
* **A push** is something that leaves the blade no room to stand (`chunk_grass_press`): `pushed.z` is
|
|
48
|
+
* the angle from upright the line from the blade's root to its tip is held at, at least, and
|
|
49
|
+
* `pushed.xy` the velocity over the ground, in the surface's frame, of what holds it. A blade its own
|
|
50
|
+
* lean and the wind already have that far over, whichever way, is not moved. One that is not is leant
|
|
51
|
+
* further until it is: the way its tip has gone already, or the way it faces if it has gone nowhere, when
|
|
52
|
+
* what holds it stands still; the way that goes when it slides; and between the two by their speeds, the
|
|
53
|
+
* blade's tip's as it sways, its length times its frequency, against the other's. Zero for no push.
|
|
54
|
+
*
|
|
55
|
+
* **The sway** stands in for the ringing a blade with no memory cannot have. The wind a blade feels is
|
|
56
|
+
* unsteadier than the scene's wind resolves, by `species_wind.z` of its speed: along the wind and across
|
|
57
|
+
* it, each a sine at the blade's own frequency, `species_wind.y` over its length squared
|
|
58
|
+
* (`grass_blade_frequency`), from where in a turn `offsets` start it. That unsteadiness is added to the
|
|
59
|
+
* wind before the law above, so it bends the blade as wind does: twice as much along the wind as across.
|
|
60
|
+
* `sway` is how far through a turn the blade is, [0, 1), which `grass_blade_sway` gives for a clock: the
|
|
61
|
+
* frequency is held to 2⁻¹⁶ Hz and multiplied by the whole seconds in integers, so the turn is exact at
|
|
62
|
+
* any age of the scene.
|
|
63
|
+
*
|
|
64
|
+
* @type {CodeChunk}
|
|
65
|
+
*/
|
|
66
|
+
export const chunk_grass_blade_wind = CodeChunk.from(
|
|
67
|
+
//language=WGSL
|
|
68
|
+
`
|
|
69
|
+
struct GrassBladeBend {
|
|
70
|
+
facing: f32,
|
|
71
|
+
lean: f32,
|
|
72
|
+
curl: f32,
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const GRASS_BLADE_WIND_TAU = 6.283185307179586;
|
|
76
|
+
|
|
77
|
+
// a quarter turn: a blade lying along the wind
|
|
78
|
+
const GRASS_BLADE_WIND_LIMIT = 1.5707963267948966;
|
|
79
|
+
|
|
80
|
+
const GRASS_BLADE_WIND_LEAN_SHARE: f32 = ${GRASS_BLADE_WIND_LEAN_SHARE};
|
|
81
|
+
const GRASS_BLADE_WIND_CURL_SHARE: f32 = ${GRASS_BLADE_WIND_CURL_SHARE};
|
|
82
|
+
|
|
83
|
+
fn grass_blade_sway(frequency: f32, whole: u32, fraction: f32) -> f32 {
|
|
84
|
+
// sixteen bits below a hertz
|
|
85
|
+
let steps = u32(frequency / GRASS_BLADE_WIND_TAU * 65536.0 + 0.5);
|
|
86
|
+
|
|
87
|
+
// turns over the whole seconds, of which only the part of a turn is kept: exact in integers
|
|
88
|
+
let turned = (steps * whole) & 0xFFFFu;
|
|
89
|
+
|
|
90
|
+
return fract((f32(turned) + f32(steps) * fraction) / 65536.0);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
fn grass_blade_bend(
|
|
94
|
+
rest: GrassBladeBend,
|
|
95
|
+
blade_length: f32,
|
|
96
|
+
wind: vec3<f32>,
|
|
97
|
+
species_wind: vec4<f32>,
|
|
98
|
+
sway: f32,
|
|
99
|
+
offsets: vec2<f32>,
|
|
100
|
+
pushed: vec3<f32>,
|
|
101
|
+
) -> GrassBladeBend {
|
|
102
|
+
// the unsteadiness the blade's own sway stands for, along the wind over the ground and across it
|
|
103
|
+
let along = sin((sway + offsets.x) * GRASS_BLADE_WIND_TAU) * species_wind.z;
|
|
104
|
+
let across = sin((sway + offsets.y) * GRASS_BLADE_WIND_TAU) * species_wind.z;
|
|
105
|
+
|
|
106
|
+
let level = wind.xz * (1.0 + along) + vec2<f32>(-wind.z, wind.x) * across;
|
|
107
|
+
|
|
108
|
+
let across_speed = length(level);
|
|
109
|
+
let speed = length(vec3<f32>(level.x, wind.y, level.y));
|
|
110
|
+
|
|
111
|
+
let raw = 0.5 * species_wind.x * blade_length * blade_length * blade_length * speed * across_speed;
|
|
112
|
+
|
|
113
|
+
let held = pushed.z;
|
|
114
|
+
|
|
115
|
+
if (raw <= 0.0 && held <= 0.0) {
|
|
116
|
+
return rest;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
let facing = vec2<f32>(cos(rest.facing), sin(rest.facing));
|
|
120
|
+
|
|
121
|
+
var lean = facing * rest.lean;
|
|
122
|
+
var curl = facing * rest.curl;
|
|
123
|
+
|
|
124
|
+
if (raw > 0.0) {
|
|
125
|
+
let turn = raw * GRASS_BLADE_WIND_LIMIT / (GRASS_BLADE_WIND_LIMIT + raw);
|
|
126
|
+
|
|
127
|
+
let downwind = level / across_speed;
|
|
128
|
+
|
|
129
|
+
lean = facing * rest.lean + downwind * (turn * GRASS_BLADE_WIND_LEAN_SHARE);
|
|
130
|
+
curl = facing * rest.curl + downwind * (turn * GRASS_BLADE_WIND_CURL_SHARE);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (held > 0.0) {
|
|
134
|
+
// the line from root to tip is half the curl past the lean
|
|
135
|
+
let line = lean + 0.5 * curl;
|
|
136
|
+
let over = dot(line, line);
|
|
137
|
+
|
|
138
|
+
if (over < held * held) {
|
|
139
|
+
// the blade's own way, at the speed of its tip, against the way of what holds it
|
|
140
|
+
let reach = sqrt(over);
|
|
141
|
+
let own_way = select(facing, line * (1.0 / max(reach, 1e-12)), reach > 1e-6);
|
|
142
|
+
|
|
143
|
+
let going = own_way * (species_wind.y / max(blade_length, 1e-6)) + pushed.xy;
|
|
144
|
+
let speed = length(going);
|
|
145
|
+
let push_way = select(own_way, going * (1.0 / max(speed, 1e-12)), speed > 1e-6);
|
|
146
|
+
|
|
147
|
+
// leant on that way until the line is as far over as it is held
|
|
148
|
+
let along = dot(line, push_way);
|
|
149
|
+
|
|
150
|
+
lean += push_way * (sqrt(along * along + held * held - over) - along);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// where the tip has gone over the ground, to first order: the one way a flat arc can face
|
|
155
|
+
let tip = lean + 0.5 * curl;
|
|
156
|
+
let reach = length(tip);
|
|
157
|
+
|
|
158
|
+
if (reach <= 1e-6) {
|
|
159
|
+
return rest;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
let way = tip / reach;
|
|
163
|
+
|
|
164
|
+
var bent: GrassBladeBend;
|
|
165
|
+
|
|
166
|
+
bent.facing = atan2(way.y, way.x);
|
|
167
|
+
bent.facing += select(0.0, GRASS_BLADE_WIND_TAU, bent.facing < 0.0);
|
|
168
|
+
bent.lean = dot(lean, way);
|
|
169
|
+
bent.curl = dot(curl, way);
|
|
170
|
+
|
|
171
|
+
return bent;
|
|
172
|
+
}
|
|
173
|
+
`
|
|
174
|
+
);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bindings of {@link GRASS_BLADE_ID_PIPELINE}: `camera`, `scene_database`, and `grass_blades`, a blade
|
|
3
|
+
* list closed by `shader_grass_blade_draw_args`.
|
|
4
|
+
*
|
|
5
|
+
* @type {ShaderResourceSetDescriptor}
|
|
6
|
+
*/
|
|
7
|
+
export const GRASS_BLADE_ID_RESOURCES: ShaderResourceSetDescriptor;
|
|
8
|
+
/**
|
|
9
|
+
* Draws a blade list into the blade id target, under the scene's depth, which it writes.
|
|
10
|
+
*
|
|
11
|
+
* An instance is a blade and its vertices a strip along it (`GRASS_BLADE_VERTICES`): the arc of
|
|
12
|
+
* `chunk_grass_blade` in `GRASS_BLADE_SEGMENTS` segments, as wide as the blade tapers, and never drawn
|
|
13
|
+
* narrower at its root than the view's least width in pixels. A blade seen edge on is drawn at that least
|
|
14
|
+
* width. Both faces are drawn.
|
|
15
|
+
*
|
|
16
|
+
* A covered pixel's id is the blade's place in the list plus one, above `GRASS_BLADE_ID_ALONG_BITS` bits
|
|
17
|
+
* of how far along the blade the pixel is and `GRASS_BLADE_ID_ACROSS_BITS` of how far across, each from 0
|
|
18
|
+
* to all ones. Draw with the indirect arguments `shader_grass_blade_draw_args` wrote.
|
|
19
|
+
*
|
|
20
|
+
* @type {RenderPipelineDescriptor}
|
|
21
|
+
*/
|
|
22
|
+
export const GRASS_BLADE_ID_PIPELINE: RenderPipelineDescriptor;
|
|
23
|
+
import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
|
|
24
|
+
import { RenderPipelineDescriptor } from "../../../descriptor/pipeline/render/RenderPipelineDescriptor.js";
|
|
25
|
+
//# sourceMappingURL=grass_blade_id_draw.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grass_blade_id_draw.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/grass/blade/grass_blade_id_draw.js"],"names":[],"mappings":"AA+FA;;;;;GAKG;AACH,uCAFU,2BAA2B,CAEa;AAElD;;;;;;;;;;;;;GAaG;AACH,sCAFU,wBAAwB,CAiB/B;4CA7HyC,sDAAsD;yCALzD,iEAAiE"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { ColorTargetState } from "../../../descriptor/pipeline/render/ColorTargetState.js";
|
|
2
|
+
import { DepthStencilState } from "../../../descriptor/pipeline/render/DepthStencilState.js";
|
|
3
|
+
import { RenderPipelineDescriptor } from "../../../descriptor/pipeline/render/RenderPipelineDescriptor.js";
|
|
4
|
+
import { CAMERA_RESOURCE } from "../../camera/CAMERA_RESOURCE.js";
|
|
5
|
+
import { TRANSFORMS_TABLE } from "../../scene/chunk_scene_database_access.js";
|
|
6
|
+
import { SCENE_DATABASE_RESOURCE } from "../../scene/SCENE_DATABASE_RESOURCE.js";
|
|
7
|
+
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
8
|
+
import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
|
|
9
|
+
import { ShaderDescriptor } from "../../shader/ShaderDescriptor.js";
|
|
10
|
+
import { chunk_grass_surface_frame } from "../surface/chunk_grass_surface_frame.js";
|
|
11
|
+
import { chunk_grass_blade } from "./chunk_grass_blade.js";
|
|
12
|
+
import {
|
|
13
|
+
GRASS_BLADE_ID_ACROSS_BITS,
|
|
14
|
+
GRASS_BLADE_ID_ALONG_BITS,
|
|
15
|
+
GRASS_BLADE_ID_FORMAT,
|
|
16
|
+
GRASS_BLADE_SEGMENTS
|
|
17
|
+
} from "./GRASS_BLADE.js";
|
|
18
|
+
import { GRASS_BLADE_LIST_STRUCT_READ } from "./shader_grass_blade_expand.js";
|
|
19
|
+
|
|
20
|
+
const resources = new ShaderResourceSetDescriptor();
|
|
21
|
+
|
|
22
|
+
resources.createGroup()
|
|
23
|
+
.add(CAMERA_RESOURCE)
|
|
24
|
+
.add(SCENE_DATABASE_RESOURCE)
|
|
25
|
+
.addStorageBuffer("grass_blades", GRASS_BLADE_LIST_STRUCT_READ);
|
|
26
|
+
|
|
27
|
+
const ALONG_STEPS = 2 ** GRASS_BLADE_ID_ALONG_BITS - 1;
|
|
28
|
+
const ACROSS_STEPS = 2 ** GRASS_BLADE_ID_ACROSS_BITS - 1;
|
|
29
|
+
|
|
30
|
+
const body = CodeChunk.from(
|
|
31
|
+
//language=WGSL
|
|
32
|
+
`
|
|
33
|
+
struct GrassBladeVertex {
|
|
34
|
+
@builtin(position) position: vec4<f32>,
|
|
35
|
+
@location(0) @interpolate(flat) blade: u32,
|
|
36
|
+
@location(1) along: f32,
|
|
37
|
+
@location(2) across: f32,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@vertex
|
|
41
|
+
fn vs_main(@builtin(vertex_index) vertex: u32, @builtin(instance_index) instance: u32) -> GrassBladeVertex {
|
|
42
|
+
let blade = grass_blade_unpack(grass_blades.records[instance]);
|
|
43
|
+
|
|
44
|
+
let frame = grass_surface_frame(${TRANSFORMS_TABLE.marshalling_method_read_field('global')}(&scene_database, blade.surface));
|
|
45
|
+
|
|
46
|
+
// a pair of vertices an end of a segment, and one at the tip
|
|
47
|
+
let step = min(vertex >> 1u, ${GRASS_BLADE_SEGMENTS}u);
|
|
48
|
+
let along = f32(step) / ${GRASS_BLADE_SEGMENTS}.0;
|
|
49
|
+
let side = select(f32(vertex & 1u) * 2.0 - 1.0, 0.0, step == ${GRASS_BLADE_SEGMENTS}u);
|
|
50
|
+
|
|
51
|
+
let centre = (frame * vec4<f32>(grass_blade_point(blade, along), 1.0)).xyz;
|
|
52
|
+
let across = (frame * vec4<f32>(grass_blade_across(blade), 0.0)).xyz;
|
|
53
|
+
|
|
54
|
+
let clip = camera.view_projection_matrix * vec4<f32>(centre, 1.0);
|
|
55
|
+
let edge = camera.view_projection_matrix * vec4<f32>(centre + across * (0.5 * blade.width), 1.0);
|
|
56
|
+
|
|
57
|
+
// pixels a unit of normalised device coordinates spans along x and along y
|
|
58
|
+
let focal = bitcast<f32>(grass_blades.focal);
|
|
59
|
+
let pixels = vec2<f32>(focal / camera.projection_matrix[0][0], focal / camera.projection_matrix[1][1]);
|
|
60
|
+
|
|
61
|
+
// half the blade's width on screen as it is, in pixels, and the way it runs
|
|
62
|
+
let offset = (edge.xy / max(abs(edge.w), 1e-6) - clip.xy / max(abs(clip.w), 1e-6)) * pixels;
|
|
63
|
+
let real = length(offset);
|
|
64
|
+
|
|
65
|
+
// seen edge on, any way will do: the width is all floor
|
|
66
|
+
let way = select(vec2<f32>(1.0, 0.0), offset / max(real, 1e-12), real >= 1e-4);
|
|
67
|
+
|
|
68
|
+
// never narrower than the least a blade is drawn at
|
|
69
|
+
let drawn = max(real, 0.5 * bitcast<f32>(grass_blades.narrowest)) * grass_blade_taper(along);
|
|
70
|
+
|
|
71
|
+
var out: GrassBladeVertex;
|
|
72
|
+
|
|
73
|
+
out.position = clip + vec4<f32>(way * (drawn * side) / pixels * clip.w, 0.0, 0.0);
|
|
74
|
+
out.blade = instance;
|
|
75
|
+
out.along = along;
|
|
76
|
+
out.across = side;
|
|
77
|
+
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@fragment
|
|
82
|
+
fn fs_main(in: GrassBladeVertex) -> @location(0) u32 {
|
|
83
|
+
let along = u32(saturate(in.along) * ${ALONG_STEPS}.0 + 0.5);
|
|
84
|
+
let across = u32(saturate(in.across * 0.5 + 0.5) * ${ACROSS_STEPS}.0 + 0.5);
|
|
85
|
+
|
|
86
|
+
return ((in.blade + 1u) << ${GRASS_BLADE_ID_ALONG_BITS + GRASS_BLADE_ID_ACROSS_BITS}u) | (along << ${GRASS_BLADE_ID_ACROSS_BITS}u) | across;
|
|
87
|
+
}
|
|
88
|
+
`, [
|
|
89
|
+
chunk_grass_surface_frame,
|
|
90
|
+
chunk_grass_blade,
|
|
91
|
+
TRANSFORMS_TABLE.chunk_read_field('global'),
|
|
92
|
+
]);
|
|
93
|
+
|
|
94
|
+
const descriptor = ShaderDescriptor.from({ label: "Grass Blade Ids", body, resources });
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The bindings of {@link GRASS_BLADE_ID_PIPELINE}: `camera`, `scene_database`, and `grass_blades`, a blade
|
|
98
|
+
* list closed by `shader_grass_blade_draw_args`.
|
|
99
|
+
*
|
|
100
|
+
* @type {ShaderResourceSetDescriptor}
|
|
101
|
+
*/
|
|
102
|
+
export const GRASS_BLADE_ID_RESOURCES = resources;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Draws a blade list into the blade id target, under the scene's depth, which it writes.
|
|
106
|
+
*
|
|
107
|
+
* An instance is a blade and its vertices a strip along it (`GRASS_BLADE_VERTICES`): the arc of
|
|
108
|
+
* `chunk_grass_blade` in `GRASS_BLADE_SEGMENTS` segments, as wide as the blade tapers, and never drawn
|
|
109
|
+
* narrower at its root than the view's least width in pixels. A blade seen edge on is drawn at that least
|
|
110
|
+
* width. Both faces are drawn.
|
|
111
|
+
*
|
|
112
|
+
* A covered pixel's id is the blade's place in the list plus one, above `GRASS_BLADE_ID_ALONG_BITS` bits
|
|
113
|
+
* of how far along the blade the pixel is and `GRASS_BLADE_ID_ACROSS_BITS` of how far across, each from 0
|
|
114
|
+
* to all ones. Draw with the indirect arguments `shader_grass_blade_draw_args` wrote.
|
|
115
|
+
*
|
|
116
|
+
* @type {RenderPipelineDescriptor}
|
|
117
|
+
*/
|
|
118
|
+
export const GRASS_BLADE_ID_PIPELINE = RenderPipelineDescriptor.from({
|
|
119
|
+
label: "Grass Blade Ids",
|
|
120
|
+
layout: resources.generatePipelineLayout(GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT),
|
|
121
|
+
vertex: { module: { code: descriptor.source }, entryPoint: "vs_main" },
|
|
122
|
+
fragment: {
|
|
123
|
+
module: { code: descriptor.source },
|
|
124
|
+
entryPoint: "fs_main",
|
|
125
|
+
targets: [ColorTargetState.from({ format: GRASS_BLADE_ID_FORMAT })],
|
|
126
|
+
},
|
|
127
|
+
depthStencil: DepthStencilState.from({
|
|
128
|
+
format: "depth32float",
|
|
129
|
+
depthWriteEnabled: true,
|
|
130
|
+
depthCompare: "greater",
|
|
131
|
+
}),
|
|
132
|
+
primitive: { topology: "triangle-strip", cullMode: "none" },
|
|
133
|
+
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A species' wind compliance per blade length cubed, rad / (m/s)² / m³: a blade `L` long turns its tip by
|
|
3
|
+
* `0.5 · compliance · L³ · v²` in a wind of speed `v` across it, while the turn is small.
|
|
4
|
+
*
|
|
5
|
+
* @param {number} elastic_modulus Pa
|
|
6
|
+
* @param {number} depth of the blade's section, metres
|
|
7
|
+
* @returns {number}
|
|
8
|
+
*/
|
|
9
|
+
export function grass_blade_compliance(elastic_modulus: number, depth: number): number;
|
|
10
|
+
/**
|
|
11
|
+
* A species' first-mode frequency times blade length squared, rad m² / s: a blade `L` long sways at
|
|
12
|
+
* `frequency / L²`. The single-degree-of-freedom estimate the tree rig takes for a branch
|
|
13
|
+
* (`tree_skeleton_compute_branch_frequency`), `sqrt(K / J)`: the blade's stiffness against turning under
|
|
14
|
+
* its own weight's moments, over its moment of inertia about its root. For this blade the moment of its
|
|
15
|
+
* weight about the root is `ρ t w L² / 4`, its turn under its weight per unit gravity `ρ L³ T / (E t²)`
|
|
16
|
+
* with `T` {@link GRASS_BLADE_TIP_TURN}, and its inertia `2 ρ t w L³ / 15`.
|
|
17
|
+
*
|
|
18
|
+
* @param {number} elastic_modulus Pa
|
|
19
|
+
* @param {number} depth of the blade's section, metres
|
|
20
|
+
* @returns {number}
|
|
21
|
+
*/
|
|
22
|
+
export function grass_blade_frequency(elastic_modulus: number, depth: number): number;
|
|
23
|
+
/**
|
|
24
|
+
* How a blade of grass bends in wind, from what it is made of: the numbers `chunk_grass_blade_wind` bends
|
|
25
|
+
* a blade by, derived here once a species.
|
|
26
|
+
*
|
|
27
|
+
* A blade is a cantilever, clamped at its root: a flat strip of the species' section depth whose width
|
|
28
|
+
* tapers as `grass_blade_taper` does, `1 − u²` at the share `u` of its length. Wind loads it by drag on its
|
|
29
|
+
* own width, so the width cancels and what is left is the taper's shape:
|
|
30
|
+
*
|
|
31
|
+
* - bending moment at `u`, per unit of dynamic pressure, drag coefficient, root width and length squared:
|
|
32
|
+
* `∫ᵤ¹ (1 − x²)(x − u) dx = (1 − u)³(3 + u) / 12`;
|
|
33
|
+
* - curvature there, per `q C_d L² / (E t³)`: that over the section's `(1 − u²) / 12`, which is
|
|
34
|
+
* `(1 − u)²(3 + u) / (1 + u)`;
|
|
35
|
+
* - the tip's turn is the curvature summed along the blade, and the tip's sideways reach the curvature
|
|
36
|
+
* times the length left past it, summed: {@link GRASS_BLADE_TIP_TURN} and {@link GRASS_BLADE_TIP_REACH}.
|
|
37
|
+
*
|
|
38
|
+
* It is the tree rig's drag law (`chunk_foliage_wind_step`): a deflection of half a compliance times the
|
|
39
|
+
* wind speed squared, the compliance carrying air density, drag coefficient and the beam's flexibility.
|
|
40
|
+
*/
|
|
41
|
+
/**
|
|
42
|
+
* Density of air at sea level, 15 C, kg/m³: the tree rig's.
|
|
43
|
+
* @type {number}
|
|
44
|
+
*/
|
|
45
|
+
export const GRASS_BLADE_AIR_DENSITY: number;
|
|
46
|
+
/**
|
|
47
|
+
* Drag coefficient of a leaf, which folds and streamlines in wind (Vogel 1989): the tree rig's for foliage.
|
|
48
|
+
* @type {number}
|
|
49
|
+
*/
|
|
50
|
+
export const GRASS_BLADE_DRAG_COEFFICIENT: number;
|
|
51
|
+
/**
|
|
52
|
+
* Density of fresh plant tissue, kg/m³: the tree rig's for green wood.
|
|
53
|
+
* @type {number}
|
|
54
|
+
*/
|
|
55
|
+
export const GRASS_BLADE_TISSUE_DENSITY: number;
|
|
56
|
+
/**
|
|
57
|
+
* `∫₀¹ (1 − u)²(3 + u) / (1 + u) du`: the angle a blade's tip turns by, per `q C_d L³ / (E t³)`.
|
|
58
|
+
* @type {number}
|
|
59
|
+
*/
|
|
60
|
+
export const GRASS_BLADE_TIP_TURN: number;
|
|
61
|
+
/**
|
|
62
|
+
* `∫₀¹ (1 − u)³(3 + u) / (1 + u) du`: how far a blade's tip moves sideways, per `q C_d L⁴ / (E t³)`.
|
|
63
|
+
* @type {number}
|
|
64
|
+
*/
|
|
65
|
+
export const GRASS_BLADE_TIP_REACH: number;
|
|
66
|
+
/**
|
|
67
|
+
* The share of the tip's turn a blade shows as curl. A blade is drawn as an arc: a lean at its root and a
|
|
68
|
+
* curl spread evenly along it (`chunk_grass_blade`), whose tip turns by `lean + curl` and reaches
|
|
69
|
+
* `lean + curl / 2` lengths sideways. The two shares put the arc's tip where the beam's is and turn it as
|
|
70
|
+
* the beam's is turned.
|
|
71
|
+
*
|
|
72
|
+
* @type {number}
|
|
73
|
+
*/
|
|
74
|
+
export const GRASS_BLADE_WIND_CURL_SHARE: number;
|
|
75
|
+
/**
|
|
76
|
+
* The share of the tip's turn a blade shows as lean at its root: the rest of it.
|
|
77
|
+
* @type {number}
|
|
78
|
+
*/
|
|
79
|
+
export const GRASS_BLADE_WIND_LEAN_SHARE: number;
|
|
80
|
+
//# sourceMappingURL=grass_blade_mechanics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grass_blade_mechanics.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/grass/blade/grass_blade_mechanics.js"],"names":[],"mappings":"AAiEA;;;;;;;GAOG;AACH,wDAJW,MAAM,SACN,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;;;;;;;GAWG;AACH,uDAJW,MAAM,SACN,MAAM,GACJ,MAAM,CAIlB;AA3FD;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;GAGG;AACH,sCAFU,MAAM,CAE6B;AAE7C;;;GAGG;AACH,2CAFU,MAAM,CAEgC;AAEhD;;;GAGG;AACH,yCAFU,MAAM,CAE8B;AAE9C;;;GAGG;AACH,mCAFU,MAAM,CAE0C;AAE1D;;;GAGG;AACH,oCAFU,MAAM,CAE8C;AAE9D;;;;;;;GAOG;AACH,0CAFU,MAAM,CAEkF;AAElG;;;GAGG;AACH,0CAFU,MAAM,CAE2D"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a blade of grass bends in wind, from what it is made of: the numbers `chunk_grass_blade_wind` bends
|
|
3
|
+
* a blade by, derived here once a species.
|
|
4
|
+
*
|
|
5
|
+
* A blade is a cantilever, clamped at its root: a flat strip of the species' section depth whose width
|
|
6
|
+
* tapers as `grass_blade_taper` does, `1 − u²` at the share `u` of its length. Wind loads it by drag on its
|
|
7
|
+
* own width, so the width cancels and what is left is the taper's shape:
|
|
8
|
+
*
|
|
9
|
+
* - bending moment at `u`, per unit of dynamic pressure, drag coefficient, root width and length squared:
|
|
10
|
+
* `∫ᵤ¹ (1 − x²)(x − u) dx = (1 − u)³(3 + u) / 12`;
|
|
11
|
+
* - curvature there, per `q C_d L² / (E t³)`: that over the section's `(1 − u²) / 12`, which is
|
|
12
|
+
* `(1 − u)²(3 + u) / (1 + u)`;
|
|
13
|
+
* - the tip's turn is the curvature summed along the blade, and the tip's sideways reach the curvature
|
|
14
|
+
* times the length left past it, summed: {@link GRASS_BLADE_TIP_TURN} and {@link GRASS_BLADE_TIP_REACH}.
|
|
15
|
+
*
|
|
16
|
+
* It is the tree rig's drag law (`chunk_foliage_wind_step`): a deflection of half a compliance times the
|
|
17
|
+
* wind speed squared, the compliance carrying air density, drag coefficient and the beam's flexibility.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Density of air at sea level, 15 C, kg/m³: the tree rig's.
|
|
22
|
+
* @type {number}
|
|
23
|
+
*/
|
|
24
|
+
export const GRASS_BLADE_AIR_DENSITY = 1.225;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Drag coefficient of a leaf, which folds and streamlines in wind (Vogel 1989): the tree rig's for foliage.
|
|
28
|
+
* @type {number}
|
|
29
|
+
*/
|
|
30
|
+
export const GRASS_BLADE_DRAG_COEFFICIENT = 0.4;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Density of fresh plant tissue, kg/m³: the tree rig's for green wood.
|
|
34
|
+
* @type {number}
|
|
35
|
+
*/
|
|
36
|
+
export const GRASS_BLADE_TISSUE_DENSITY = 900;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* `∫₀¹ (1 − u)²(3 + u) / (1 + u) du`: the angle a blade's tip turns by, per `q C_d L³ / (E t³)`.
|
|
40
|
+
* @type {number}
|
|
41
|
+
*/
|
|
42
|
+
export const GRASS_BLADE_TIP_TURN = 8 * Math.LN2 - 14 / 3;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* `∫₀¹ (1 − u)³(3 + u) / (1 + u) du`: how far a blade's tip moves sideways, per `q C_d L⁴ / (E t³)`.
|
|
46
|
+
* @type {number}
|
|
47
|
+
*/
|
|
48
|
+
export const GRASS_BLADE_TIP_REACH = 16 * Math.LN2 - 125 / 12;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The share of the tip's turn a blade shows as curl. A blade is drawn as an arc: a lean at its root and a
|
|
52
|
+
* curl spread evenly along it (`chunk_grass_blade`), whose tip turns by `lean + curl` and reaches
|
|
53
|
+
* `lean + curl / 2` lengths sideways. The two shares put the arc's tip where the beam's is and turn it as
|
|
54
|
+
* the beam's is turned.
|
|
55
|
+
*
|
|
56
|
+
* @type {number}
|
|
57
|
+
*/
|
|
58
|
+
export const GRASS_BLADE_WIND_CURL_SHARE = 2 * (1 - GRASS_BLADE_TIP_REACH / GRASS_BLADE_TIP_TURN);
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The share of the tip's turn a blade shows as lean at its root: the rest of it.
|
|
62
|
+
* @type {number}
|
|
63
|
+
*/
|
|
64
|
+
export const GRASS_BLADE_WIND_LEAN_SHARE = 1 - GRASS_BLADE_WIND_CURL_SHARE;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* A species' wind compliance per blade length cubed, rad / (m/s)² / m³: a blade `L` long turns its tip by
|
|
68
|
+
* `0.5 · compliance · L³ · v²` in a wind of speed `v` across it, while the turn is small.
|
|
69
|
+
*
|
|
70
|
+
* @param {number} elastic_modulus Pa
|
|
71
|
+
* @param {number} depth of the blade's section, metres
|
|
72
|
+
* @returns {number}
|
|
73
|
+
*/
|
|
74
|
+
export function grass_blade_compliance(elastic_modulus, depth) {
|
|
75
|
+
return GRASS_BLADE_TIP_TURN * GRASS_BLADE_AIR_DENSITY * GRASS_BLADE_DRAG_COEFFICIENT / (elastic_modulus * depth * depth * depth);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* A species' first-mode frequency times blade length squared, rad m² / s: a blade `L` long sways at
|
|
80
|
+
* `frequency / L²`. The single-degree-of-freedom estimate the tree rig takes for a branch
|
|
81
|
+
* (`tree_skeleton_compute_branch_frequency`), `sqrt(K / J)`: the blade's stiffness against turning under
|
|
82
|
+
* its own weight's moments, over its moment of inertia about its root. For this blade the moment of its
|
|
83
|
+
* weight about the root is `ρ t w L² / 4`, its turn under its weight per unit gravity `ρ L³ T / (E t²)`
|
|
84
|
+
* with `T` {@link GRASS_BLADE_TIP_TURN}, and its inertia `2 ρ t w L³ / 15`.
|
|
85
|
+
*
|
|
86
|
+
* @param {number} elastic_modulus Pa
|
|
87
|
+
* @param {number} depth of the blade's section, metres
|
|
88
|
+
* @returns {number}
|
|
89
|
+
*/
|
|
90
|
+
export function grass_blade_frequency(elastic_modulus, depth) {
|
|
91
|
+
return depth * Math.sqrt(elastic_modulus / GRASS_BLADE_TISSUE_DENSITY) * Math.sqrt(15 / (8 * GRASS_BLADE_TIP_TURN));
|
|
92
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bindings of {@link GRASS_BLADE_RESOLVE_PIPELINE}: `camera`, `scene_database`, `grass_blades` (the
|
|
3
|
+
* list the ids were drawn from), `grass_species`, `grass_ids` (the blade id target), `scene_depth` (the
|
|
4
|
+
* depth the blades were drawn into), and the two matrices of `view_velocity_matrices`.
|
|
5
|
+
*
|
|
6
|
+
* @type {ShaderResourceSetDescriptor}
|
|
7
|
+
*/
|
|
8
|
+
export const GRASS_BLADE_RESOLVE_RESOURCES: ShaderResourceSetDescriptor;
|
|
9
|
+
/**
|
|
10
|
+
* Turns the blade id target into the G-buffer's surface under every pixel a blade covers, and leaves every
|
|
11
|
+
* other pixel as it was: a full-screen triangle (three vertices) over six targets, loaded: the four
|
|
12
|
+
* G-buffer targets in `G_BUFFER_COLOR_TARGETS`' order, then the visibility buffer and the velocity buffer.
|
|
13
|
+
*
|
|
14
|
+
* A blade's pixel takes its species' colour from root to tip, tinted by the blade's own seed; the normal
|
|
15
|
+
* of the blade's face on the view's side, turned towards the edge the pixel is nearer; no metalness, no
|
|
16
|
+
* emission, and an occlusion of one. A blade drawn in place of many (`thinning` under one) moves its
|
|
17
|
+
* normal towards the ground's and its roughness towards one by as much.
|
|
18
|
+
*
|
|
19
|
+
* The pixel's visibility word becomes `VISIBILITY_NONE`: no meshlet is the surface there, and a reader that
|
|
20
|
+
* decoded the word would find the ground under the blade. Its velocity is the blade point's own, in the
|
|
21
|
+
* velocity buffer's units: where the point was a frame ago, on the blade as it was bent then
|
|
22
|
+
* (`grass_blade_previous`) and on its surface where that was.
|
|
23
|
+
*
|
|
24
|
+
* @type {RenderPipelineDescriptor}
|
|
25
|
+
*/
|
|
26
|
+
export const GRASS_BLADE_RESOLVE_PIPELINE: RenderPipelineDescriptor;
|
|
27
|
+
import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
|
|
28
|
+
import { RenderPipelineDescriptor } from "../../../descriptor/pipeline/render/RenderPipelineDescriptor.js";
|
|
29
|
+
//# sourceMappingURL=grass_blade_resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grass_blade_resolve.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/grass/blade/grass_blade_resolve.js"],"names":[],"mappings":"AAsIA;;;;;;GAMG;AACH,4CAFU,2BAA2B,CAEkB;AAEvD;;;;;;;;;;;;;;;;GAgBG;AACH,2CAFU,wBAAwB,CAgB/B;4CAjKyC,sDAAsD;yCAZzD,iEAAiE"}
|