@woosh/meep-engine 3.69.0 → 3.70.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 +30 -1
- package/build/bundle-worker-terrain.js +1 -1
- package/package.json +1 -1
- package/src/core/bvh8/build/BVH8Converter.d.ts +16 -0
- package/src/core/bvh8/build/BVH8Converter.d.ts.map +1 -1
- package/src/core/bvh8/build/BVH8Converter.js +64 -37
- package/src/core/bvh8/build/bvh8_assign_slots_greedy.d.ts +25 -0
- package/src/core/bvh8/build/bvh8_assign_slots_greedy.d.ts.map +1 -0
- package/src/core/bvh8/build/bvh8_assign_slots_greedy.js +68 -0
- package/src/core/bvh8/build/bvh8_from_proxy.d.ts.map +1 -1
- package/src/core/bvh8/build/bvh8_from_proxy.js +2 -33
- package/src/core/bvh8/build/bvh8_node_fit_slots.d.ts +22 -0
- package/src/core/bvh8/build/bvh8_node_fit_slots.d.ts.map +1 -0
- package/src/core/bvh8/build/bvh8_node_fit_slots.js +115 -0
- package/src/core/bvh8/bvh8_depth.d.ts +8 -0
- package/src/core/bvh8/bvh8_depth.d.ts.map +1 -0
- package/src/core/bvh8/bvh8_depth.js +39 -0
- package/src/core/math/complex/complex_fft_radix2.d.ts +19 -0
- package/src/core/math/complex/complex_fft_radix2.d.ts.map +1 -0
- package/src/core/math/complex/complex_fft_radix2.js +71 -0
- package/src/engine/graphics3/GPUFluidSystem.d.ts +17 -4
- package/src/engine/graphics3/GPUFluidSystem.d.ts.map +1 -1
- package/src/engine/graphics3/GPUFluidSystem.js +113 -16
- package/src/engine/physics/cloth/playground/wind_main.js +7 -6
- package/src/engine/physics/cloth/wind/AbstractClothWind.d.ts +2 -2
- package/src/engine/physics/cloth/wind/AbstractClothWind.js +2 -2
- package/src/engine/physics/cloth/wind/ClothFluidWind.d.ts +3 -3
- package/src/engine/physics/cloth/wind/ClothFluidWind.d.ts.map +1 -1
- package/src/engine/physics/cloth/wind/ClothFluidWind.js +7 -9
- package/src/engine/physics/cloth/wind/ClothGPUFluidWind.d.ts +10 -10
- package/src/engine/physics/cloth/wind/ClothGPUFluidWind.d.ts.map +1 -1
- package/src/engine/physics/cloth/wind/ClothGPUFluidWind.js +14 -22
- package/src/engine/physics/fluid/FluidAtmosphere.d.ts +16 -2
- package/src/engine/physics/fluid/FluidAtmosphere.d.ts.map +1 -1
- package/src/engine/physics/fluid/FluidAtmosphere.js +17 -3
- package/src/engine/physics/fluid/ecs/FluidEffectorsComponentSerializationAdapter.d.ts +1 -2
- package/src/engine/physics/fluid/ecs/FluidEffectorsComponentSerializationAdapter.d.ts.map +1 -1
- package/src/engine/physics/fluid/ecs/FluidEffectorsComponentSerializationAdapter.js +1 -2
- package/src/engine/physics/fluid/ecs/FluidEffectorsSystem.d.ts +8 -5
- package/src/engine/physics/fluid/ecs/FluidEffectorsSystem.d.ts.map +1 -1
- package/src/engine/physics/fluid/ecs/FluidEffectorsSystem.js +60 -17
- package/src/engine/physics/fluid/effector/AbstractFluidEffector.d.ts +1 -1
- package/src/engine/physics/fluid/effector/AbstractFluidEffector.js +1 -1
- package/src/engine/physics/fluid/effector/GlobalFluidEffector.d.ts +33 -47
- package/src/engine/physics/fluid/effector/GlobalFluidEffector.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/GlobalFluidEffector.js +38 -176
- package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationAdapter.d.ts +8 -11
- package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationAdapter.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationAdapter.js +13 -24
- package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationUpgrader_0_1.d.ts +16 -0
- package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationUpgrader_0_1.d.ts.map +1 -0
- package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationUpgrader_0_1.js +35 -0
- package/src/engine/physics/fluid/fluid_apply_atmosphere.d.ts +1 -1
- package/src/engine/physics/fluid/fluid_apply_atmosphere.js +1 -1
- package/src/engine/physics/fluid/turbulence/FLUID_TURBULENCE_TILE.d.ts +28 -0
- package/src/engine/physics/fluid/turbulence/FLUID_TURBULENCE_TILE.d.ts.map +1 -0
- package/src/engine/physics/fluid/turbulence/FLUID_TURBULENCE_TILE.js +29 -0
- package/src/engine/physics/fluid/turbulence/fluid_atmosphere_velocity_at.d.ts +16 -0
- package/src/engine/physics/fluid/turbulence/fluid_atmosphere_velocity_at.d.ts.map +1 -0
- package/src/engine/physics/fluid/turbulence/fluid_atmosphere_velocity_at.js +49 -0
- package/src/engine/physics/fluid/turbulence/fluid_turbulence_inverse_tile_size.d.ts +11 -0
- package/src/engine/physics/fluid/turbulence/fluid_turbulence_inverse_tile_size.d.ts.map +1 -0
- package/src/engine/physics/fluid/turbulence/fluid_turbulence_inverse_tile_size.js +18 -0
- package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_data.d.ts +25 -0
- package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_data.d.ts.map +1 -0
- package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_data.js +65 -0
- package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_generate.d.ts +56 -0
- package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_generate.d.ts.map +1 -0
- package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_generate.js +313 -0
- package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_sample.d.ts +16 -0
- package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_sample.d.ts.map +1 -0
- package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_sample.js +69 -0
- package/src/generation/foliage/mesh/branch_ring_triangulate.d.ts +1 -1
- package/src/generation/foliage/mesh/branch_ring_triangulate.js +1 -1
- package/src/shade/playground/bvh_repro/README.md +8 -6
- package/src/shade/playground/bvh_repro/index.html +125 -124
- package/src/shade/playground/bvh_repro/main.js +259 -254
- package/src/shade/playground/foliage_wind/foliage_world.d.ts.map +1 -1
- package/src/shade/playground/foliage_wind/foliage_world.js +7 -4
- package/src/shade/playground/grass_surfaces/main.js +3 -2
- package/src/shade/playground/particle_ecs/bonfire_wind.d.ts +23 -13
- package/src/shade/playground/particle_ecs/bonfire_wind.d.ts.map +1 -1
- package/src/shade/playground/particle_ecs/bonfire_wind.js +30 -33
- package/src/shade/playground/skinned_blas_refit/README.md +26 -14
- package/src/shade/playground/skinned_blas_refit/shader_blas_audit_leaf_triangles.d.ts +14 -9
- package/src/shade/playground/skinned_blas_refit/shader_blas_audit_leaf_triangles.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/shader_blas_audit_leaf_triangles.js +126 -127
- package/src/shade/playground/skinned_blas_refit/shader_blas_audit_points.js +95 -95
- package/src/shade/playground/skinned_blas_refit/shader_blas_audit_visibility.d.ts +9 -1
- package/src/shade/playground/skinned_blas_refit/shader_blas_audit_visibility.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/shader_blas_audit_visibility.js +146 -135
- package/src/shade/playground/skinned_blas_refit/verify_clone_leaves.d.ts +6 -6
- package/src/shade/playground/skinned_blas_refit/verify_clone_leaves.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/verify_clone_leaves.js +148 -134
- package/src/shade/playground/skinned_blas_refit/verify_leaf_triangles.d.ts +11 -8
- package/src/shade/playground/skinned_blas_refit/verify_leaf_triangles.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/verify_leaf_triangles.js +342 -202
- package/src/shade/playground/skinned_blas_refit/verify_skinned_blas_refit.d.ts +12 -13
- package/src/shade/playground/skinned_blas_refit/verify_skinned_blas_refit.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/verify_skinned_blas_refit.js +136 -116
- package/src/shade/playground/skinned_blas_refit/verify_traversal_reachability.d.ts +4 -4
- package/src/shade/playground/skinned_blas_refit/verify_traversal_reachability.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/verify_traversal_reachability.js +255 -249
- package/src/shade/playground/water_surface/main.js +6 -3
- package/src/shade/renderer/animation/GPUAnimationManager.js +2 -2
- package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +1 -1
- package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +7 -8
- package/src/shade/renderer/fluid/FLUID_FAR_FIELD_STRUCT.d.ts +111 -0
- package/src/shade/renderer/fluid/FLUID_FAR_FIELD_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/fluid/FLUID_FAR_FIELD_STRUCT.js +162 -0
- package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +37 -8
- package/src/shade/renderer/fluid/GPUFluidCascade.d.ts.map +1 -1
- package/src/shade/renderer/fluid/GPUFluidCascade.js +149 -47
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +10 -3
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts.map +1 -1
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.js +69 -10
- package/src/shade/renderer/fluid/chunk_fluid_far_field.d.ts +19 -0
- package/src/shade/renderer/fluid/chunk_fluid_far_field.d.ts.map +1 -0
- package/src/shade/renderer/fluid/chunk_fluid_far_field.js +43 -0
- package/src/shade/renderer/fluid/coupling/FLUID_CASCADE_PARENT_STRUCT.d.ts +10 -9
- package/src/shade/renderer/fluid/coupling/FLUID_CASCADE_PARENT_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/fluid/coupling/FLUID_CASCADE_PARENT_STRUCT.js +14 -12
- package/src/shade/renderer/fluid/coupling/FLUID_CASCADE_RESTRICT_STRUCT.d.ts +3 -2
- package/src/shade/renderer/fluid/coupling/FLUID_CASCADE_RESTRICT_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/fluid/coupling/FLUID_CASCADE_RESTRICT_STRUCT.js +7 -5
- package/src/shade/renderer/fluid/coupling/chunk_fluid_cascade_epilogue.d.ts +17 -9
- package/src/shade/renderer/fluid/coupling/chunk_fluid_cascade_epilogue.d.ts.map +1 -1
- package/src/shade/renderer/fluid/coupling/chunk_fluid_cascade_epilogue.js +58 -18
- package/src/shade/renderer/fluid/coupling/chunk_fluid_cascade_parent.d.ts +23 -11
- package/src/shade/renderer/fluid/coupling/chunk_fluid_cascade_parent.d.ts.map +1 -1
- package/src/shade/renderer/fluid/coupling/chunk_fluid_cascade_parent.js +371 -335
- package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_fill.d.ts.map +1 -1
- package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_fill.js +2 -1
- package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_ghosts.d.ts.map +1 -1
- package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_ghosts.js +109 -108
- package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_restrict.d.ts +5 -3
- package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_restrict.d.ts.map +1 -1
- package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_restrict.js +24 -12
- package/src/shade/renderer/fluid/mac/FLUID_MAC_STEP_STRUCT.d.ts +6 -2
- package/src/shade/renderer/fluid/mac/FLUID_MAC_STEP_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/fluid/mac/FLUID_MAC_STEP_STRUCT.js +10 -5
- package/src/shade/renderer/fluid/mac/FluidMacPasses.d.ts +20 -21
- package/src/shade/renderer/fluid/mac/FluidMacPasses.d.ts.map +1 -1
- package/src/shade/renderer/fluid/mac/FluidMacPasses.js +453 -427
- package/src/shade/renderer/fluid/mac/shader_fluid_mac_advect_correct.d.ts.map +1 -1
- package/src/shade/renderer/fluid/mac/shader_fluid_mac_advect_correct.js +2 -1
- package/src/shade/renderer/fluid/publish/FluidWindPublish.d.ts +13 -5
- package/src/shade/renderer/fluid/publish/FluidWindPublish.d.ts.map +1 -1
- package/src/shade/renderer/fluid/publish/FluidWindPublish.js +20 -10
- package/src/shade/renderer/fluid/publish/chunk_fluid_wind_publish_cell.d.ts +2 -2
- package/src/shade/renderer/fluid/publish/chunk_fluid_wind_publish_cell.js +2 -2
- package/src/shade/renderer/fluid/publish/shader_fluid_wind_publish.d.ts +5 -3
- package/src/shade/renderer/fluid/publish/shader_fluid_wind_publish.d.ts.map +1 -1
- package/src/shade/renderer/fluid/publish/shader_fluid_wind_publish.js +147 -142
- package/src/shade/renderer/fluid/query/GPUFluidQueries.js +2 -2
- package/src/shade/renderer/geometry/GPUGeometryManager.d.ts.map +1 -1
- package/src/shade/renderer/geometry/GPUGeometryManager.js +5 -7
- package/src/shade/renderer/geometry/MeshletGeometry.d.ts +4 -1
- package/src/shade/renderer/geometry/MeshletGeometry.d.ts.map +1 -1
- package/src/shade/renderer/geometry/MeshletGeometry.js +4 -1
- package/src/shade/renderer/geometry/MeshletGeometrySerializationAdapter.d.ts +20 -0
- package/src/shade/renderer/geometry/MeshletGeometrySerializationAdapter.d.ts.map +1 -1
- package/src/shade/renderer/geometry/MeshletGeometrySerializationAdapter.js +35 -3
- package/src/shade/renderer/geometry/blas_from_meshlets.d.ts +9 -3
- package/src/shade/renderer/geometry/blas_from_meshlets.d.ts.map +1 -1
- package/src/shade/renderer/geometry/blas_from_meshlets.js +16 -30
- package/src/shade/renderer/geometry/bvh/BLAS8_REFIT_TARGET_STRUCT.d.ts +14 -0
- package/src/shade/renderer/geometry/bvh/BLAS8_REFIT_TARGET_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/geometry/bvh/BLAS8_REFIT_TARGET_STRUCT.js +33 -0
- package/src/shade/renderer/geometry/bvh/GPUBLASRefitBatch.d.ts +18 -21
- package/src/shade/renderer/geometry/bvh/GPUBLASRefitBatch.d.ts.map +1 -1
- package/src/shade/renderer/geometry/bvh/GPUBLASRefitBatch.js +78 -158
- package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.d.ts +18 -39
- package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.d.ts.map +1 -1
- package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.js +39 -398
- package/src/shade/renderer/geometry/bvh/GPUGeometryMeshletsBVH.d.ts +6 -7
- package/src/shade/renderer/geometry/bvh/GPUGeometryMeshletsBVH.d.ts.map +1 -1
- package/src/shade/renderer/geometry/bvh/GPUGeometryMeshletsBVH.js +5 -7
- package/src/shade/renderer/geometry/bvh/bvh8_build_for_meshlets.d.ts +36 -0
- package/src/shade/renderer/geometry/bvh/bvh8_build_for_meshlets.d.ts.map +1 -0
- package/src/shade/renderer/geometry/bvh/bvh8_build_for_meshlets.js +179 -0
- package/src/shade/renderer/geometry/bvh/meshlet_batch_to_clustered_bvh.d.ts +30 -0
- package/src/shade/renderer/geometry/bvh/meshlet_batch_to_clustered_bvh.d.ts.map +1 -0
- package/src/shade/renderer/geometry/bvh/meshlet_batch_to_clustered_bvh.js +207 -0
- package/src/shade/renderer/geometry/bvh/shader_blas8_refit_batch.d.ts +52 -0
- package/src/shade/renderer/geometry/bvh/shader_blas8_refit_batch.d.ts.map +1 -0
- package/src/shade/renderer/geometry/bvh/shader_blas8_refit_batch.js +464 -0
- package/src/shade/renderer/geometry/meshlet/MeshletBatch.d.ts +12 -0
- package/src/shade/renderer/geometry/meshlet/MeshletBatch.d.ts.map +1 -1
- package/src/shade/renderer/geometry/meshlet/MeshletBatch.js +37 -0
- package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_classify.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_classify.js +4 -4
- package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_evaluate.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_evaluate.js +2 -2
- package/src/shade/renderer/geometry/sdf/chunk_blas_query_band_sdf.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/chunk_blas_query_band_sdf.js +2 -2
- package/src/shade/renderer/geometry/sdf/shader_sdf_visualize.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/shader_sdf_visualize.js +4 -4
- package/src/shade/renderer/geometry/sdf/surface/shader_mesh_surface_trace.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/surface/shader_mesh_surface_trace.js +2 -2
- package/src/shade/renderer/geometry/sr_create_group_RTX.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sr_create_group_RTX.js +4 -4
- package/src/shade/renderer/global_illumination/brick4/gpu/bake/brick4_bake_basic.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/brick4/gpu/bake/brick4_bake_basic.js +1 -0
- package/src/shade/renderer/global_illumination/lpv/bake/GPULightProbeVolumeRenderer.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/lpv/bake/GPULightProbeVolumeRenderer.js +1 -0
- package/src/shade/renderer/global_illumination/lpv/placement/graph_generate_probe_locations.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/lpv/placement/graph_generate_probe_locations.js +372 -376
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.d.ts +9 -10
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.js +10 -11
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.d.ts +2 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.js +2 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.d.ts +12 -8
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.js +109 -60
- package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_mesh_sdf.js +2 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_mesh_surfaces.js +2 -2
- package/src/shade/renderer/gpu_primitive/bvh/BVH_BUFFER_LAYOUT.d.ts +2 -2
- package/src/shade/renderer/gpu_primitive/bvh/BVH_BUFFER_LAYOUT.js +70 -70
- package/src/shade/renderer/gpu_primitive/bvh/BVH_BUILD_SETTINGS_STRUCT.d.ts +6 -7
- package/src/shade/renderer/gpu_primitive/bvh/BVH_BUILD_SETTINGS_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/bvh/BVH_BUILD_SETTINGS_STRUCT.js +6 -7
- package/src/shade/renderer/gpu_primitive/bvh/graph_bvh_build_lbvh.d.ts +3 -3
- package/src/shade/renderer/gpu_primitive/bvh/graph_bvh_build_lbvh.js +3 -3
- package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_build_single_workgroup.js +1 -1
- package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_emit_hierarchy.d.ts +2 -2
- package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_emit_hierarchy.js +3 -3
- package/src/shade/renderer/gpu_primitive/bvh8/BVH8_TREE_BUFFER_LAYOUT.d.ts +69 -0
- package/src/shade/renderer/gpu_primitive/bvh8/BVH8_TREE_BUFFER_LAYOUT.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/BVH8_TREE_BUFFER_LAYOUT.js +89 -0
- package/src/shade/renderer/gpu_primitive/bvh8/bvh8_encode_from_bvh2.d.ts +41 -0
- package/src/shade/renderer/gpu_primitive/bvh8/bvh8_encode_from_bvh2.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/bvh8_encode_from_bvh2.js +348 -0
- package/src/shade/renderer/gpu_primitive/bvh8/check_bvh8_tree.d.ts +34 -0
- package/src/shade/renderer/gpu_primitive/bvh8/check_bvh8_tree.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/check_bvh8_tree.js +291 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_assign.d.ts +31 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_assign.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_assign.js +175 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_depth.d.ts +27 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_depth.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_depth.js +48 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_gather.d.ts +26 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_gather.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_gather.js +118 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_node.d.ts +22 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_node.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_node.js +143 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_sums.d.ts +36 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_sums.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_sums.js +97 -0
- package/src/shade/renderer/gpu_primitive/bvh8/graph_bvh8_encode_from_bvh2.d.ts +49 -0
- package/src/shade/renderer/gpu_primitive/bvh8/graph_bvh8_encode_from_bvh2.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/graph_bvh8_encode_from_bvh2.js +265 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_assign.d.ts +37 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_assign.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_assign.js +109 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_count.d.ts +15 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_count.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_count.js +85 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_count_single_workgroup.d.ts +26 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_count_single_workgroup.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_count_single_workgroup.js +200 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_parents.d.ts +19 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_parents.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_parents.js +81 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_write.d.ts +14 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_write.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_write.js +101 -0
- package/src/shade/renderer/gpu_primitive/bvh8/verify_gpu_bvh8_encode.d.ts +19 -0
- package/src/shade/renderer/gpu_primitive/bvh8/verify_gpu_bvh8_encode.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/verify_gpu_bvh8_encode.js +361 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_bake.d.ts.map +1 -1
- package/src/shade/renderer/grass/surface/shader_grass_surface_bake.js +5 -6
- package/src/shade/renderer/lightmap/GPULightMap.d.ts.map +1 -1
- package/src/shade/renderer/lightmap/GPULightMap.js +1 -0
- package/src/shade/renderer/path_tracer/accumulating/AccumulatingPathTracer.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/accumulating/AccumulatingPathTracer.js +1 -0
- package/src/shade/renderer/path_tracer/graph_path_trace_scene.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/graph_path_trace_scene.js +1 -0
- package/src/shade/renderer/scene/GPUInstancesAccelerationStructure.d.ts +8 -4
- package/src/shade/renderer/scene/GPUInstancesAccelerationStructure.d.ts.map +1 -1
- package/src/shade/renderer/scene/GPUInstancesAccelerationStructure.js +60 -33
- package/src/shade/renderer/scene/verify_gpu_tlas_build.d.ts +6 -6
- package/src/shade/renderer/scene/verify_gpu_tlas_build.d.ts.map +1 -1
- package/src/shade/renderer/scene/verify_gpu_tlas_build.js +23 -53
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/BVH8_INODE_STRUCT.d.ts +3 -1
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/BVH8_INODE_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/BVH8_INODE_STRUCT.js +5 -3
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/BVH8_MAX_DEPTH.d.ts +28 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/BVH8_MAX_DEPTH.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/BVH8_MAX_DEPTH.js +29 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_grid.d.ts +25 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_grid.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_grid.js +97 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_intersect.d.ts +8 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_intersect.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_intersect.js +23 -14
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_slot_distances.d.ts +36 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_slot_distances.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_slot_distances.js +222 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_ray_direction_rcp.d.ts +20 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_ray_direction_rcp.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_ray_direction_rcp.js +30 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_tree_read.d.ts +30 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_tree_read.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_tree_read.js +91 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_waiting_slots.d.ts +23 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_waiting_slots.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_waiting_slots.js +40 -0
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_blas_nearest.d.ts +22 -0
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_blas_nearest.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_blas_nearest.js +121 -70
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_blas_occluded.d.ts +13 -1
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_blas_occluded.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_blas_occluded.js +117 -61
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest.d.ts +21 -0
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest.js +111 -72
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.d.ts +1 -2
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.js +83 -54
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_occluded.d.ts +14 -0
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_occluded.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_occluded.js +92 -60
- package/src/shade/renderer/shader/chunk/sdf/chunk_point_query_blas_nearest.d.ts +22 -0
- package/src/shade/renderer/shader/chunk/sdf/chunk_point_query_blas_nearest.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/sdf/chunk_point_query_blas_nearest.js +153 -106
- package/src/shade/renderer/shader/chunk/sdf/chunk_scene_point_query_nearest.d.ts +21 -0
- package/src/shade/renderer/shader/chunk/sdf/chunk_scene_point_query_nearest.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/sdf/chunk_scene_point_query_nearest.js +115 -74
- package/src/shade/renderer/shader/chunk/sdf/chunk_scene_sdf_raymarch.d.ts +5 -2
- package/src/shade/renderer/shader/chunk/sdf/chunk_scene_sdf_raymarch.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/sdf/chunk_scene_sdf_raymarch.js +89 -63
- package/src/shade/renderer/shader/chunk/sdf/chunk_sdf_query_distance.d.ts +15 -0
- package/src/shade/renderer/shader/chunk/sdf/chunk_sdf_query_distance.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/sdf/chunk_sdf_query_distance.js +108 -63
- package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_raycast.d.ts +14 -0
- package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_raycast.d.ts.map +1 -1
- package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_raycast.js +94 -60
- package/src/shade/renderer/shadow/sdf/graph_draw_sdf_shadows.d.ts.map +1 -1
- package/src/shade/renderer/shadow/sdf/graph_draw_sdf_shadows.js +4 -4
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +2 -2
- package/src/shade/renderer/water/query/shader_water_surface_query.d.ts.map +1 -1
- package/src/shade/renderer/water/query/shader_water_surface_query.js +227 -227
- package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.js +7 -4
- package/src/shade/renderer/water/surface/particles/shader_water_particles.js +2 -2
- package/src/shade/renderer/wind/GPUSceneWind.d.ts +36 -4
- package/src/shade/renderer/wind/GPUSceneWind.d.ts.map +1 -1
- package/src/shade/renderer/wind/GPUSceneWind.js +150 -4
- package/src/shade/renderer/wind/WIND_FIELD_STRUCT.d.ts +9 -3
- package/src/shade/renderer/wind/WIND_FIELD_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/wind/WIND_FIELD_STRUCT.js +13 -3
- package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.d.ts +6 -6
- package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.js +6 -6
- package/src/shade/renderer/wind/chunk_fluid_turbulence.d.ts +39 -0
- package/src/shade/renderer/wind/chunk_fluid_turbulence.d.ts.map +1 -0
- package/src/shade/renderer/wind/chunk_fluid_turbulence.js +63 -0
- package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts +10 -7
- 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 +34 -11
- package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.d.ts +2 -2
- package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.js +2 -2
- package/src/shade/renderer/wind/wind_field_add_resources.d.ts +6 -4
- package/src/shade/renderer/wind/wind_field_add_resources.d.ts.map +1 -1
- package/src/shade/renderer/wind/wind_field_add_resources.js +9 -6
- package/src/shade/renderer/geometry/bvh/BLAS_REFIT_TARGET_STRUCT.d.ts +0 -18
- package/src/shade/renderer/geometry/bvh/BLAS_REFIT_TARGET_STRUCT.d.ts.map +0 -1
- package/src/shade/renderer/geometry/bvh/BLAS_REFIT_TARGET_STRUCT.js +0 -50
- package/src/shade/renderer/geometry/bvh/bvh2_derive_topology.d.ts +0 -23
- package/src/shade/renderer/geometry/bvh/bvh2_derive_topology.d.ts.map +0 -1
- package/src/shade/renderer/geometry/bvh/bvh2_derive_topology.js +0 -87
- package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch.d.ts +0 -42
- package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch.d.ts.map +0 -1
- package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch.js +0 -141
- package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch_seed.d.ts +0 -21
- package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch_seed.d.ts.map +0 -1
- package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch_seed.js +0 -75
- package/src/shade/renderer/geometry/meshlet_batch_to_bvh.d.ts +0 -17
- package/src/shade/renderer/geometry/meshlet_batch_to_bvh.d.ts.map +0 -1
- package/src/shade/renderer/geometry/meshlet_batch_to_bvh.js +0 -247
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_ray_query_blas_occlusion.d.ts +0 -7
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_ray_query_blas_occlusion.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_ray_query_blas_occlusion.js +0 -226
- package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mask_visibility_via_rays.d.ts +0 -8
- package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mask_visibility_via_rays.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mask_visibility_via_rays.js +0 -45
- package/src/shade/renderer/shader/chunk/light/sample/chunk_ray_sample_light.d.ts +0 -3
- package/src/shade/renderer/shader/chunk/light/sample/chunk_ray_sample_light.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/light/sample/chunk_ray_sample_light.js +0 -105
- package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_distance.d.ts +0 -6
- package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_distance.d.ts.map +0 -1
- package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_distance.js +0 -86
- package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_raycast_traversal_count.d.ts +0 -2
- package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_raycast_traversal_count.d.ts.map +0 -1
- package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_raycast_traversal_count.js +0 -136
|
@@ -8,7 +8,7 @@ import { AbstractFluidEffector } from "./AbstractFluidEffector.js";
|
|
|
8
8
|
*
|
|
9
9
|
* dv/dt = force + drag · (wind − v)
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* with turbulence carried on top of the wind.
|
|
12
12
|
*
|
|
13
13
|
* One effector covers the whole family of "push everything" behaviours —
|
|
14
14
|
* pick the regime by which fields you set:
|
|
@@ -32,9 +32,9 @@ import { AbstractFluidEffector } from "./AbstractFluidEffector.js";
|
|
|
32
32
|
* is the solver-level stability knob that exists even when no effectors
|
|
33
33
|
* are wired.)
|
|
34
34
|
*
|
|
35
|
-
* - **`
|
|
36
|
-
*
|
|
37
|
-
* {@link
|
|
35
|
+
* - **`turbulence_intensity`** — weather on top of the wind: a field of eddies, the
|
|
36
|
+
* wind's speed times the intensity in rms, carried along by the wind. See
|
|
37
|
+
* {@link turbulence_intensity}.
|
|
38
38
|
*
|
|
39
39
|
* `wind` only enters through the drag term — with `drag = 0` it is inert by
|
|
40
40
|
* construction (the model degenerates to dv/dt = force).
|
|
@@ -42,20 +42,21 @@ import { AbstractFluidEffector } from "./AbstractFluidEffector.js";
|
|
|
42
42
|
* ## The far field
|
|
43
43
|
*
|
|
44
44
|
* In a scene, globals act through {@link FluidEffectorsSystem}: once a tick it folds
|
|
45
|
-
* every global into one far field — `D = Σ drag`, the drag-weighted
|
|
46
|
-
* winds, the
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
45
|
+
* every global into one far field — `D = Σ drag`, the drag-weighted means of the
|
|
46
|
+
* winds, of the turbulence intensities and of the length scales, and the sum of the
|
|
47
|
+
* forces — and integrates `u`, the far field's mean, toward the mean wind at `D`. The
|
|
48
|
+
* far field is `u` plus its turbulence, `σ = intensity · |u|` in rms, carried by `u`.
|
|
49
|
+
* {@link FluidSystem} and {@link WorkerFluidSystem} then bring every field to the mean
|
|
50
|
+
* once a step through the atmosphere identity (`fluid_apply_atmosphere`); the GPU fluid
|
|
51
|
+
* brings every cascade to the whole far field, turbulence and all. Several globals act
|
|
52
|
+
* as one, whatever order they are in. A global has no `apply` of its own: it acts only through the far field, and
|
|
52
53
|
* `FluidSimulator#step` refuses one handed to it in its effector list.
|
|
53
54
|
*
|
|
54
55
|
* `force` is not part of the far field: it is a term inside CPU fields, applied exactly
|
|
55
56
|
* in the same step.
|
|
56
57
|
*
|
|
57
|
-
* All quantities are WORLD-space: `force` in units/s², `wind`
|
|
58
|
-
* `
|
|
58
|
+
* All quantities are WORLD-space: `force` in units/s², `wind` in units/s, `drag` in
|
|
59
|
+
* 1/s, `turbulence_length` in units. The `world_to_grid` matrix's linear part converts the vectors per
|
|
59
60
|
* field, so one instance produces the same world-space atmosphere on fields of any
|
|
60
61
|
* `cell_size` — gravity stays gravity.
|
|
61
62
|
*
|
|
@@ -92,110 +93,38 @@ export class GlobalFluidEffector extends AbstractFluidEffector {
|
|
|
92
93
|
drag = 0;
|
|
93
94
|
|
|
94
95
|
/**
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
96
|
+
* Turbulence intensity, `σ_u / |U|`: the rms of the far field's eddies on each axis, as a share
|
|
97
|
+
* of the far field's mean speed `|U|`. 0, the default, is no turbulence. Over grass and crops
|
|
98
|
+
* the near-ground wind measures 0.15 to 0.2; MIL-F-8785C's low-altitude model gives 0.19 at
|
|
99
|
+
* 20 ft.
|
|
99
100
|
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* g_axis = gust · Σ_k a_k · sin(2π·phase_k + (k+1)·φ_axis)
|
|
105
|
-
*
|
|
106
|
-
* The air carries the gust; it does not relax toward it, so `drag` does not filter
|
|
107
|
-
* it. `0` (default) is no gust.
|
|
101
|
+
* The eddies are isotropic von Kármán turbulence, frozen and carried by the mean wind
|
|
102
|
+
* (Taylor's hypothesis), from one repeating tile (`FLUID_TURBULENCE_TILE_RESOLUTION`). The
|
|
103
|
+
* fluid then shapes them: the ground's shear stretches them into streaks, a canopy's drag
|
|
104
|
+
* rolls them up. Read through `GPUFluidSystem#far_field_at`; `far_field` is the mean.
|
|
108
105
|
*
|
|
109
106
|
* @type {number}
|
|
110
107
|
*/
|
|
111
|
-
|
|
108
|
+
turbulence_intensity = 0;
|
|
112
109
|
|
|
113
110
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
111
|
+
* The turbulence's length scale `L`, WORLD units, > 0: the von Kármán spectrum's, whose most
|
|
112
|
+
* energetic wavelength is about `4.05·L` and whose longitudinal integral scale is `0.747·L`.
|
|
113
|
+
* The tile repeats every `16·L` across and `4·L` up, and holds wavelengths down to `L/4`.
|
|
117
114
|
*
|
|
118
|
-
* The
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* @type {number}
|
|
123
|
-
*/
|
|
124
|
-
gust_period = 4;
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* The gust's three phases, in turns, each in `[0, 1)`: state, advanced once a tick
|
|
128
|
-
* by {@link advance}. Written by hand only to restore a saved gust.
|
|
115
|
+
* The default, 58.6 m, is MIL-F-8785C's low-altitude integral scale at 20 ft (43.8 m),
|
|
116
|
+
* divided by 0.747. Smaller scales reach down to a canopy's own eddies at the cost of a
|
|
117
|
+
* shorter repeat.
|
|
129
118
|
*
|
|
130
|
-
*
|
|
131
|
-
|
|
132
|
-
gust_phase = new Float64Array(3);
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Advance the gust's phases by `dt`: `phase_k ← frac(phase_k + dt·rate_k / gust_period)`.
|
|
136
|
-
* {@link FluidEffectorsSystem} calls it exactly once a tick.
|
|
119
|
+
* Changing it rescales the eddies about the world's origin, so the air there jumps; it is a
|
|
120
|
+
* property of a scene's weather, set once.
|
|
137
121
|
*
|
|
138
|
-
* @
|
|
139
|
-
*/
|
|
140
|
-
advance(dt) {
|
|
141
|
-
const period = this.gust_period > 0 ? this.gust_period : 1;
|
|
142
|
-
|
|
143
|
-
const phase = this.gust_phase;
|
|
144
|
-
|
|
145
|
-
const p0 = phase[0] + dt * RATE_0 / period;
|
|
146
|
-
const p1 = phase[1] + dt * RATE_1 / period;
|
|
147
|
-
const p2 = phase[2] + dt * RATE_2 / period;
|
|
148
|
-
|
|
149
|
-
phase[0] = p0 - Math.floor(p0);
|
|
150
|
-
phase[1] = p1 - Math.floor(p1);
|
|
151
|
-
phase[2] = p2 - Math.floor(p2);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* The gust at the current phases, WORLD units per second.
|
|
156
|
-
*
|
|
157
|
-
* @param {Float64Array|number[]} out written at 0..2
|
|
158
|
-
* @returns {Float64Array|number[]} `out`
|
|
122
|
+
* @type {number}
|
|
159
123
|
*/
|
|
160
|
-
|
|
161
|
-
const gust = this.gust;
|
|
162
|
-
|
|
163
|
-
if (gust === 0) {
|
|
164
|
-
out[0] = 0;
|
|
165
|
-
out[1] = 0;
|
|
166
|
-
out[2] = 0;
|
|
167
|
-
|
|
168
|
-
return out;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const phase = this.gust_phase;
|
|
172
|
-
|
|
173
|
-
const a0 = TAU * phase[0];
|
|
174
|
-
const a1 = TAU * phase[1];
|
|
175
|
-
const a2 = TAU * phase[2];
|
|
176
|
-
|
|
177
|
-
out[0] = gust * (
|
|
178
|
-
AMPLITUDE_0 * Math.sin(a0 + AXIS_PHASE_X)
|
|
179
|
-
+ AMPLITUDE_1 * Math.sin(a1 + AXIS_PHASE_X * 2)
|
|
180
|
-
+ AMPLITUDE_2 * Math.sin(a2 + AXIS_PHASE_X * 3)
|
|
181
|
-
);
|
|
182
|
-
out[1] = gust * (
|
|
183
|
-
AMPLITUDE_0 * Math.sin(a0 + AXIS_PHASE_Y)
|
|
184
|
-
+ AMPLITUDE_1 * Math.sin(a1 + AXIS_PHASE_Y * 2)
|
|
185
|
-
+ AMPLITUDE_2 * Math.sin(a2 + AXIS_PHASE_Y * 3)
|
|
186
|
-
);
|
|
187
|
-
out[2] = gust * (
|
|
188
|
-
AMPLITUDE_0 * Math.sin(a0 + AXIS_PHASE_Z)
|
|
189
|
-
+ AMPLITUDE_1 * Math.sin(a1 + AXIS_PHASE_Z * 2)
|
|
190
|
-
+ AMPLITUDE_2 * Math.sin(a2 + AXIS_PHASE_Z * 3)
|
|
191
|
-
);
|
|
192
|
-
|
|
193
|
-
return out;
|
|
194
|
-
}
|
|
124
|
+
turbulence_length = 58.6;
|
|
195
125
|
|
|
196
126
|
/**
|
|
197
|
-
* Every field
|
|
198
|
-
* same air from now on.
|
|
127
|
+
* Every field: two globals are equal when they make the same air.
|
|
199
128
|
*
|
|
200
129
|
* @param {AbstractFluidEffector} other
|
|
201
130
|
* @return {boolean}
|
|
@@ -214,11 +143,8 @@ export class GlobalFluidEffector extends AbstractFluidEffector {
|
|
|
214
143
|
&& this.wind[0] === other.wind[0]
|
|
215
144
|
&& this.wind[1] === other.wind[1]
|
|
216
145
|
&& this.wind[2] === other.wind[2]
|
|
217
|
-
&& this.
|
|
218
|
-
&& this.
|
|
219
|
-
&& this.gust_phase[0] === other.gust_phase[0]
|
|
220
|
-
&& this.gust_phase[1] === other.gust_phase[1]
|
|
221
|
-
&& this.gust_phase[2] === other.gust_phase[2];
|
|
146
|
+
&& this.turbulence_intensity === other.turbulence_intensity
|
|
147
|
+
&& this.turbulence_length === other.turbulence_length;
|
|
222
148
|
}
|
|
223
149
|
|
|
224
150
|
/**
|
|
@@ -238,17 +164,9 @@ export class GlobalFluidEffector extends AbstractFluidEffector {
|
|
|
238
164
|
hash_mix3(
|
|
239
165
|
computeHashFloat(this.wind[2]),
|
|
240
166
|
computeHashFloat(this.drag),
|
|
241
|
-
computeHashFloat(this.
|
|
167
|
+
computeHashFloat(this.turbulence_intensity)
|
|
242
168
|
),
|
|
243
|
-
|
|
244
|
-
computeHashFloat(this.gust_period),
|
|
245
|
-
computeHashFloat(this.gust_phase[0]),
|
|
246
|
-
hash_mix3(
|
|
247
|
-
computeHashFloat(this.gust_phase[1]),
|
|
248
|
-
computeHashFloat(this.gust_phase[2]),
|
|
249
|
-
0
|
|
250
|
-
)
|
|
251
|
-
)
|
|
169
|
+
computeHashFloat(this.turbulence_length)
|
|
252
170
|
);
|
|
253
171
|
}
|
|
254
172
|
|
|
@@ -267,59 +185,3 @@ export class GlobalFluidEffector extends AbstractFluidEffector {
|
|
|
267
185
|
* @type {string}
|
|
268
186
|
*/
|
|
269
187
|
GlobalFluidEffector.typeName = "GlobalFluidEffector";
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* @type {number}
|
|
273
|
-
*/
|
|
274
|
-
const TAU = 2 * Math.PI;
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Component rates, as multiples of the base frequency `1 / gust_period`: mutually
|
|
278
|
-
* irrational enough that the sum does not visibly repeat.
|
|
279
|
-
* @type {number}
|
|
280
|
-
*/
|
|
281
|
-
const RATE_0 = 1;
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* @type {number}
|
|
285
|
-
*/
|
|
286
|
-
const RATE_1 = 2.41;
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* @type {number}
|
|
290
|
-
*/
|
|
291
|
-
const RATE_2 = 5.83;
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Component amplitudes. They sum to exactly one, which is what makes
|
|
295
|
-
* {@link GlobalFluidEffector#gust} a bound rather than a scale.
|
|
296
|
-
* @type {number}
|
|
297
|
-
*/
|
|
298
|
-
const AMPLITUDE_0 = 4 / 7;
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* @type {number}
|
|
302
|
-
*/
|
|
303
|
-
const AMPLITUDE_1 = 2 / 7;
|
|
304
|
-
|
|
305
|
-
/**
|
|
306
|
-
* @type {number}
|
|
307
|
-
*/
|
|
308
|
-
const AMPLITUDE_2 = 1 / 7;
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* Per-axis phase offsets φ_axis, thirds of a turn; component k takes `(k+1)·φ_axis`,
|
|
312
|
-
* so the axes stay apart at every rate.
|
|
313
|
-
* @type {number}
|
|
314
|
-
*/
|
|
315
|
-
const AXIS_PHASE_X = 0;
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* @type {number}
|
|
319
|
-
*/
|
|
320
|
-
const AXIS_PHASE_Y = 2 * Math.PI / 3;
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* @type {number}
|
|
324
|
-
*/
|
|
325
|
-
const AXIS_PHASE_Z = 4 * Math.PI / 3;
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Binary serialization for {@link GlobalFluidEffector}: `force`, `wind`, `drag`,
|
|
3
|
-
* `
|
|
2
|
+
* Binary serialization for {@link GlobalFluidEffector}: `force`, `wind`, `drag`,
|
|
3
|
+
* `turbulence_intensity` and `turbulence_length`, every one an f64.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* a loaded global advanced from the load makes the same air, to the bit, as the saved one
|
|
7
|
-
* advanced from the save. Written as f64 for that reason; a phase rounded to f32 would put the
|
|
8
|
-
* gust a 1e-7 turn off.
|
|
5
|
+
* ## Version 1
|
|
9
6
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
7
|
+
* Version 0 carried a gust (`gust`, `gust_period` and three phases) where version 1 carries the
|
|
8
|
+
* turbulence; {@link GlobalFluidEffectorSerializationUpgrader_0_1} reads a version-0 stream as
|
|
9
|
+
* version 1, the gust dropped (it has no turbulence equivalent) and no turbulence. A host that
|
|
10
|
+
* loads version-0 saves registers it beside this adapter. The spec's exact byte count is what makes
|
|
11
|
+
* a field added without a bump fail rather than shift every component after this one.
|
|
15
12
|
*
|
|
16
13
|
* @author Alex Goldring
|
|
17
14
|
* @copyright Company Named Limited (c) 2026
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalFluidEffectorSerializationAdapter.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationAdapter.js"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"GlobalFluidEffectorSerializationAdapter.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationAdapter.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH;;IAEI,kCAA4B;IAG5B;;;OAGG;IACH,uCAFW,mBAAmB,QAe7B;IAED;;;OAGG;IACH,yCAFW,mBAAmB,QAe7B;CACJ;gDA5D+C,gEAAgE;oCAC5E,0BAA0B"}
|
|
@@ -2,19 +2,16 @@ import { BinaryClassSerializationAdapter } from "../../../ecs/storage/binary/Bin
|
|
|
2
2
|
import { GlobalFluidEffector } from "./GlobalFluidEffector.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Binary serialization for {@link GlobalFluidEffector}: `force`, `wind`, `drag`,
|
|
6
|
-
* `
|
|
5
|
+
* Binary serialization for {@link GlobalFluidEffector}: `force`, `wind`, `drag`,
|
|
6
|
+
* `turbulence_intensity` and `turbulence_length`, every one an f64.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* a loaded global advanced from the load makes the same air, to the bit, as the saved one
|
|
10
|
-
* advanced from the save. Written as f64 for that reason; a phase rounded to f32 would put the
|
|
11
|
-
* gust a 1e-7 turn off.
|
|
8
|
+
* ## Version 1
|
|
12
9
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
10
|
+
* Version 0 carried a gust (`gust`, `gust_period` and three phases) where version 1 carries the
|
|
11
|
+
* turbulence; {@link GlobalFluidEffectorSerializationUpgrader_0_1} reads a version-0 stream as
|
|
12
|
+
* version 1, the gust dropped (it has no turbulence equivalent) and no turbulence. A host that
|
|
13
|
+
* loads version-0 saves registers it beside this adapter. The spec's exact byte count is what makes
|
|
14
|
+
* a field added without a bump fail rather than shift every component after this one.
|
|
18
15
|
*
|
|
19
16
|
* @author Alex Goldring
|
|
20
17
|
* @copyright Company Named Limited (c) 2026
|
|
@@ -22,7 +19,7 @@ import { GlobalFluidEffector } from "./GlobalFluidEffector.js";
|
|
|
22
19
|
export class GlobalFluidEffectorSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
23
20
|
|
|
24
21
|
klass = GlobalFluidEffector;
|
|
25
|
-
version =
|
|
22
|
+
version = 1;
|
|
26
23
|
|
|
27
24
|
/**
|
|
28
25
|
* @param {BinaryBuffer} buffer
|
|
@@ -39,12 +36,8 @@ export class GlobalFluidEffectorSerializationAdapter extends BinaryClassSerializ
|
|
|
39
36
|
|
|
40
37
|
buffer.writeFloat64(value.drag);
|
|
41
38
|
|
|
42
|
-
buffer.writeFloat64(value.
|
|
43
|
-
buffer.writeFloat64(value.
|
|
44
|
-
|
|
45
|
-
buffer.writeFloat64(value.gust_phase[0]);
|
|
46
|
-
buffer.writeFloat64(value.gust_phase[1]);
|
|
47
|
-
buffer.writeFloat64(value.gust_phase[2]);
|
|
39
|
+
buffer.writeFloat64(value.turbulence_intensity);
|
|
40
|
+
buffer.writeFloat64(value.turbulence_length);
|
|
48
41
|
}
|
|
49
42
|
|
|
50
43
|
/**
|
|
@@ -62,11 +55,7 @@ export class GlobalFluidEffectorSerializationAdapter extends BinaryClassSerializ
|
|
|
62
55
|
|
|
63
56
|
value.drag = buffer.readFloat64();
|
|
64
57
|
|
|
65
|
-
value.
|
|
66
|
-
value.
|
|
67
|
-
|
|
68
|
-
value.gust_phase[0] = buffer.readFloat64();
|
|
69
|
-
value.gust_phase[1] = buffer.readFloat64();
|
|
70
|
-
value.gust_phase[2] = buffer.readFloat64();
|
|
58
|
+
value.turbulence_intensity = buffer.readFloat64();
|
|
59
|
+
value.turbulence_length = buffer.readFloat64();
|
|
71
60
|
}
|
|
72
61
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads a version-0 {@link GlobalFluidEffector} stream as version 1: `force`, `wind` and `drag` as
|
|
3
|
+
* they were; the gust (`gust`, `gust_period`, three phases), which version 1 no longer has, dropped;
|
|
4
|
+
* then no turbulence, at the default length scale.
|
|
5
|
+
*
|
|
6
|
+
* Every value an f64, in and out.
|
|
7
|
+
*/
|
|
8
|
+
export class GlobalFluidEffectorSerializationUpgrader_0_1 extends BinaryClassUpgrader {
|
|
9
|
+
/**
|
|
10
|
+
* @param {BinaryBuffer} source
|
|
11
|
+
* @param {BinaryBuffer} target
|
|
12
|
+
*/
|
|
13
|
+
upgrade(source: BinaryBuffer, target: BinaryBuffer): void;
|
|
14
|
+
}
|
|
15
|
+
import { BinaryClassUpgrader } from "../../../ecs/storage/binary/BinaryClassUpgrader.js";
|
|
16
|
+
//# sourceMappingURL=GlobalFluidEffectorSerializationUpgrader_0_1.d.ts.map
|
package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationUpgrader_0_1.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GlobalFluidEffectorSerializationUpgrader_0_1.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationUpgrader_0_1.js"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH;IAII;;;OAGG;IACH,0DAeC;CACJ;oCAlCmC,oDAAoD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { BinaryClassUpgrader } from "../../../ecs/storage/binary/BinaryClassUpgrader.js";
|
|
2
|
+
import { GlobalFluidEffector } from "./GlobalFluidEffector.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Reads a version-0 {@link GlobalFluidEffector} stream as version 1: `force`, `wind` and `drag` as
|
|
6
|
+
* they were; the gust (`gust`, `gust_period`, three phases), which version 1 no longer has, dropped;
|
|
7
|
+
* then no turbulence, at the default length scale.
|
|
8
|
+
*
|
|
9
|
+
* Every value an f64, in and out.
|
|
10
|
+
*/
|
|
11
|
+
export class GlobalFluidEffectorSerializationUpgrader_0_1 extends BinaryClassUpgrader {
|
|
12
|
+
__startVersion = 0;
|
|
13
|
+
__targetVersion = 1;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {BinaryBuffer} source
|
|
17
|
+
* @param {BinaryBuffer} target
|
|
18
|
+
*/
|
|
19
|
+
upgrade(source, target) {
|
|
20
|
+
// force, wind, drag
|
|
21
|
+
for (let i = 0; i < 7; i++) {
|
|
22
|
+
target.writeFloat64(source.readFloat64());
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// the gust, its period and its three phases
|
|
26
|
+
for (let i = 0; i < 5; i++) {
|
|
27
|
+
source.readFloat64();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const defaults = new GlobalFluidEffector();
|
|
31
|
+
|
|
32
|
+
target.writeFloat64(defaults.turbulence_intensity);
|
|
33
|
+
target.writeFloat64(defaults.turbulence_length);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Air the atmosphere alone acts on relaxes toward the far field at `D` while carrying the
|
|
9
9
|
* far field's own changes, so its deviation `e = v − v_far` obeys `de/dt = −D·e` whatever
|
|
10
|
-
* the
|
|
10
|
+
* the mean does and however `D` varied: the step is exact over any interval, one tick or
|
|
11
11
|
* many, and a face equal to the far field stays equal to it.
|
|
12
12
|
*
|
|
13
13
|
* The body force is applied exactly in the same linear step, through the forced response
|
|
@@ -9,7 +9,7 @@ import { FluidAtmosphere, FluidFieldAtmosphere } from "./FluidAtmosphere.js";
|
|
|
9
9
|
*
|
|
10
10
|
* Air the atmosphere alone acts on relaxes toward the far field at `D` while carrying the
|
|
11
11
|
* far field's own changes, so its deviation `e = v − v_far` obeys `de/dt = −D·e` whatever
|
|
12
|
-
* the
|
|
12
|
+
* the mean does and however `D` varied: the step is exact over any interval, one tick or
|
|
13
13
|
* many, and a face equal to the far field stays equal to it.
|
|
14
14
|
*
|
|
15
15
|
* The body force is applied exactly in the same linear step, through the forced response
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Texels of the far field's turbulence tile on x, y and z: 128 × 32 × 128, y up.
|
|
3
|
+
*
|
|
4
|
+
* The tile repeats, so the far field's turbulence repeats every `16·L` across the wind and `4·L`
|
|
5
|
+
* up, `L` the length scale: four of the spectrum's most energetic wavelength (`≈ 4.05·L`) across,
|
|
6
|
+
* one up. 4 MiB as `rgba16float`.
|
|
7
|
+
*
|
|
8
|
+
* @type {ReadonlyArray<number>}
|
|
9
|
+
*/
|
|
10
|
+
export const FLUID_TURBULENCE_TILE_RESOLUTION: ReadonlyArray<number>;
|
|
11
|
+
/**
|
|
12
|
+
* Texels of the turbulence tile per length scale `L`: the tile's spacing is `L/8`.
|
|
13
|
+
*
|
|
14
|
+
* The von Kármán spectrum is a function of `k·L` alone, so a tile laid out in units of `L` is the same
|
|
15
|
+
* tile for every `L`: the length scale is only how far apart its texels are in the world, and changing
|
|
16
|
+
* it regenerates nothing. Eight a length keeps the spectrum's peak (`≈ 4·L`) at 32 texels and resolves
|
|
17
|
+
* wavelengths down to `L` at 8 texels each, the fewest a trilinear read and the solver's advection
|
|
18
|
+
* carry without visible loss; shorter ones, down to the tile's Nyquist `L/4`, are in it too.
|
|
19
|
+
*
|
|
20
|
+
* @type {number}
|
|
21
|
+
*/
|
|
22
|
+
export const FLUID_TURBULENCE_TEXELS_PER_LENGTH: number;
|
|
23
|
+
/**
|
|
24
|
+
* The seed the engine's turbulence tile is generated from: one tile, the same on every machine.
|
|
25
|
+
* @type {number}
|
|
26
|
+
*/
|
|
27
|
+
export const FLUID_TURBULENCE_TILE_SEED: number;
|
|
28
|
+
//# sourceMappingURL=FLUID_TURBULENCE_TILE.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FLUID_TURBULENCE_TILE.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/fluid/turbulence/FLUID_TURBULENCE_TILE.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,+CAFU,cAAc,MAAM,CAAC,CAE+C;AAE9E;;;;;;;;;;GAUG;AACH,iDAFU,MAAM,CAEoC;AAEpD;;;GAGG;AACH,yCAFU,MAAM,CAEmC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Texels of the far field's turbulence tile on x, y and z: 128 × 32 × 128, y up.
|
|
3
|
+
*
|
|
4
|
+
* The tile repeats, so the far field's turbulence repeats every `16·L` across the wind and `4·L`
|
|
5
|
+
* up, `L` the length scale: four of the spectrum's most energetic wavelength (`≈ 4.05·L`) across,
|
|
6
|
+
* one up. 4 MiB as `rgba16float`.
|
|
7
|
+
*
|
|
8
|
+
* @type {ReadonlyArray<number>}
|
|
9
|
+
*/
|
|
10
|
+
export const FLUID_TURBULENCE_TILE_RESOLUTION = Object.freeze([128, 32, 128]);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Texels of the turbulence tile per length scale `L`: the tile's spacing is `L/8`.
|
|
14
|
+
*
|
|
15
|
+
* The von Kármán spectrum is a function of `k·L` alone, so a tile laid out in units of `L` is the same
|
|
16
|
+
* tile for every `L`: the length scale is only how far apart its texels are in the world, and changing
|
|
17
|
+
* it regenerates nothing. Eight a length keeps the spectrum's peak (`≈ 4·L`) at 32 texels and resolves
|
|
18
|
+
* wavelengths down to `L` at 8 texels each, the fewest a trilinear read and the solver's advection
|
|
19
|
+
* carry without visible loss; shorter ones, down to the tile's Nyquist `L/4`, are in it too.
|
|
20
|
+
*
|
|
21
|
+
* @type {number}
|
|
22
|
+
*/
|
|
23
|
+
export const FLUID_TURBULENCE_TEXELS_PER_LENGTH = 8;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The seed the engine's turbulence tile is generated from: one tile, the same on every machine.
|
|
27
|
+
* @type {number}
|
|
28
|
+
*/
|
|
29
|
+
export const FLUID_TURBULENCE_TILE_SEED = 0x6b6172;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The far field a {@link FluidAtmosphere} record describes, at a WORLD point: its mean `u`, plus
|
|
3
|
+
* `σ·T((x − o) ⊙ S⁻¹)` when it has turbulence, `T` the engine's tile read trilinearly
|
|
4
|
+
* ({@link fluid_turbulence_tile_sample}), as every GPU reader of the far field reads it.
|
|
5
|
+
*
|
|
6
|
+
* With `σ = 0` it is `u`, and the tile is never made. Allocates nothing once the tile exists.
|
|
7
|
+
*
|
|
8
|
+
* @param {Float64Array|Float32Array|number[]} out receives `[x, y, z]`, WORLD units per second
|
|
9
|
+
* @param {Float64Array|number[]} atmosphere
|
|
10
|
+
* @param {number} offset where the record starts
|
|
11
|
+
* @param {number} x
|
|
12
|
+
* @param {number} y
|
|
13
|
+
* @param {number} z
|
|
14
|
+
*/
|
|
15
|
+
export function fluid_atmosphere_velocity_at(out: Float64Array | Float32Array | number[], atmosphere: Float64Array | number[], offset: number, x: number, y: number, z: number): void;
|
|
16
|
+
//# sourceMappingURL=fluid_atmosphere_velocity_at.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fluid_atmosphere_velocity_at.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/fluid/turbulence/fluid_atmosphere_velocity_at.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;GAaG;AACH,kDAPW,YAAY,GAAC,YAAY,GAAC,MAAM,EAAE,cAClC,YAAY,GAAC,MAAM,EAAE,UACrB,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,QA4BhB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { FluidAtmosphere } from "../FluidAtmosphere.js";
|
|
2
|
+
import { fluid_turbulence_inverse_tile_size } from "./fluid_turbulence_inverse_tile_size.js";
|
|
3
|
+
import { fluid_turbulence_tile_data } from "./fluid_turbulence_tile_data.js";
|
|
4
|
+
import { fluid_turbulence_tile_sample } from "./fluid_turbulence_tile_sample.js";
|
|
5
|
+
|
|
6
|
+
const inverse_size = new Float64Array(3);
|
|
7
|
+
const coordinate = new Float64Array(3);
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The far field a {@link FluidAtmosphere} record describes, at a WORLD point: its mean `u`, plus
|
|
11
|
+
* `σ·T((x − o) ⊙ S⁻¹)` when it has turbulence, `T` the engine's tile read trilinearly
|
|
12
|
+
* ({@link fluid_turbulence_tile_sample}), as every GPU reader of the far field reads it.
|
|
13
|
+
*
|
|
14
|
+
* With `σ = 0` it is `u`, and the tile is never made. Allocates nothing once the tile exists.
|
|
15
|
+
*
|
|
16
|
+
* @param {Float64Array|Float32Array|number[]} out receives `[x, y, z]`, WORLD units per second
|
|
17
|
+
* @param {Float64Array|number[]} atmosphere
|
|
18
|
+
* @param {number} offset where the record starts
|
|
19
|
+
* @param {number} x
|
|
20
|
+
* @param {number} y
|
|
21
|
+
* @param {number} z
|
|
22
|
+
*/
|
|
23
|
+
export function fluid_atmosphere_velocity_at(out, atmosphere, offset, x, y, z) {
|
|
24
|
+
const sigma = atmosphere[offset + FluidAtmosphere.TURBULENCE_SIGMA];
|
|
25
|
+
|
|
26
|
+
const ux = atmosphere[offset + FluidAtmosphere.VELOCITY_X];
|
|
27
|
+
const uy = atmosphere[offset + FluidAtmosphere.VELOCITY_Y];
|
|
28
|
+
const uz = atmosphere[offset + FluidAtmosphere.VELOCITY_Z];
|
|
29
|
+
|
|
30
|
+
if (sigma === 0) {
|
|
31
|
+
out[0] = ux;
|
|
32
|
+
out[1] = uy;
|
|
33
|
+
out[2] = uz;
|
|
34
|
+
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
fluid_turbulence_inverse_tile_size(inverse_size, atmosphere[offset + FluidAtmosphere.TURBULENCE_LENGTH]);
|
|
39
|
+
|
|
40
|
+
coordinate[0] = (x - atmosphere[offset + FluidAtmosphere.TURBULENCE_OFFSET_X]) * inverse_size[0];
|
|
41
|
+
coordinate[1] = (y - atmosphere[offset + FluidAtmosphere.TURBULENCE_OFFSET_Y]) * inverse_size[1];
|
|
42
|
+
coordinate[2] = (z - atmosphere[offset + FluidAtmosphere.TURBULENCE_OFFSET_Z]) * inverse_size[2];
|
|
43
|
+
|
|
44
|
+
fluid_turbulence_tile_sample(out, fluid_turbulence_tile_data(), coordinate);
|
|
45
|
+
|
|
46
|
+
out[0] = ux + sigma * out[0];
|
|
47
|
+
out[1] = uy + sigma * out[1];
|
|
48
|
+
out[2] = uz + sigma * out[2];
|
|
49
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One over the turbulence tile's size in the world on each axis, for a length scale `L`: a world
|
|
3
|
+
* distance times it is a distance in tiles. The tile is `n·L / FLUID_TURBULENCE_TEXELS_PER_LENGTH`
|
|
4
|
+
* on an axis of `n` texels.
|
|
5
|
+
*
|
|
6
|
+
* @param {Float64Array|Float32Array|number[]} out receives x, y, z
|
|
7
|
+
* @param {number} length `L`, WORLD units, > 0
|
|
8
|
+
* @returns {Float64Array|Float32Array|number[]} `out`
|
|
9
|
+
*/
|
|
10
|
+
export function fluid_turbulence_inverse_tile_size(out: Float64Array | Float32Array | number[], length: number): Float64Array | Float32Array | number[];
|
|
11
|
+
//# sourceMappingURL=fluid_turbulence_inverse_tile_size.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fluid_turbulence_inverse_tile_size.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/fluid/turbulence/fluid_turbulence_inverse_tile_size.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,wDAJW,YAAY,GAAC,YAAY,GAAC,MAAM,EAAE,UAClC,MAAM,GACJ,YAAY,GAAC,YAAY,GAAC,MAAM,EAAE,CAQ9C"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FLUID_TURBULENCE_TEXELS_PER_LENGTH, FLUID_TURBULENCE_TILE_RESOLUTION } from "./FLUID_TURBULENCE_TILE.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* One over the turbulence tile's size in the world on each axis, for a length scale `L`: a world
|
|
5
|
+
* distance times it is a distance in tiles. The tile is `n·L / FLUID_TURBULENCE_TEXELS_PER_LENGTH`
|
|
6
|
+
* on an axis of `n` texels.
|
|
7
|
+
*
|
|
8
|
+
* @param {Float64Array|Float32Array|number[]} out receives x, y, z
|
|
9
|
+
* @param {number} length `L`, WORLD units, > 0
|
|
10
|
+
* @returns {Float64Array|Float32Array|number[]} `out`
|
|
11
|
+
*/
|
|
12
|
+
export function fluid_turbulence_inverse_tile_size(out, length) {
|
|
13
|
+
for (let axis = 0; axis < 3; axis++) {
|
|
14
|
+
out[axis] = FLUID_TURBULENCE_TEXELS_PER_LENGTH / (FLUID_TURBULENCE_TILE_RESOLUTION[axis] * length);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return out;
|
|
18
|
+
}
|