@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
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nearest point of one geometry's surface to a point, through its tree: `primitive` is the
|
|
3
|
+
* `(meshlet << 8) | triangle` id of the nearest triangle within `max_distance`, or all ones when there
|
|
4
|
+
* is none.
|
|
5
|
+
*
|
|
6
|
+
* A node is visited once for its own triangles: those of the slots whose boxes are nearer than the best
|
|
7
|
+
* found, one after another, and each time one of them is nearer still the rest are held to it. Its
|
|
8
|
+
* child nodes are then taken nearest box first, and what is left of them waits on the stack as one
|
|
9
|
+
* entry:
|
|
10
|
+
*
|
|
11
|
+
* - one other child worth a visit waits as itself, and is visited whatever has been found by then;
|
|
12
|
+
* - several wait as their node; on the way back the node is read again and the nearest of those that
|
|
13
|
+
* still beats the best is taken.
|
|
14
|
+
*
|
|
15
|
+
* So the stack is as deep as the tree and no deeper, whatever the fan-out.
|
|
16
|
+
*
|
|
17
|
+
* `stack` is the caller's, used from `stack_top` up and handed back as it was found below that. The
|
|
18
|
+
* walk reads and writes the first word of an entry and nothing else of it: which of a waiting node's
|
|
19
|
+
* slots are still to visit stays with the walk, a byte a level ({@link chunk_bvh8_waiting_slots}).
|
|
20
|
+
*
|
|
21
|
+
* @type {CodeChunk}
|
|
22
|
+
*/
|
|
1
23
|
export const chunk_point_query_blas_nearest: CodeChunk;
|
|
2
24
|
import { CodeChunk } from "../../compiler/CodeChunk.js";
|
|
3
25
|
//# sourceMappingURL=chunk_point_query_blas_nearest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_point_query_blas_nearest.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/sdf/chunk_point_query_blas_nearest.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chunk_point_query_blas_nearest.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/sdf/chunk_point_query_blas_nearest.js"],"names":[],"mappings":"AAmBA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,6CAFU,SAAS,CA8IjB;0BAjLwB,6BAA6B"}
|
|
@@ -1,135 +1,182 @@
|
|
|
1
|
+
import { assert } from "../../../../../core/assert.js";
|
|
1
2
|
import { UINT32_MAX } from "../../../../../core/binary/UINT32_MAX.js";
|
|
3
|
+
import { GEOMETRY_METADATA_STRUCT } from "../../../geometry/GEOMETRY_METADATA_STRUCT.js";
|
|
4
|
+
import { MESHLET_METADATA_STRUCT } from "../../../geometry/meshlet/encoding/MESHLET_METADATA_STRUCT.js";
|
|
2
5
|
import { CodeChunk } from "../../compiler/CodeChunk.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
chunk_aabb3_unsigned_distance_sqr_to_point
|
|
7
|
-
} from "../geometry/aabb3/chunk_aabb3_unsigned_distance_sqr_to_point.js";
|
|
8
|
-
import { chunk_geometry_read_triangle_vertices } from "../geometry/format/chunk_geometry_read_triangle_vertices.js";
|
|
6
|
+
import { chunk_read_meshlet_resolved_index } from "../geometry/meshlet/chunk_read_meshlet_resolved_index.js";
|
|
7
|
+
import { chunk_read_meshlet_vertex_position } from "../geometry/meshlet/chunk_read_meshlet_vertex_position.js";
|
|
9
8
|
import { chunk_compute_triangle_face_normal } from "../geometry/normal/chunk_compute_triangle_face_normal.js";
|
|
10
|
-
import { chunk_f32_array_as_vec3 } from "../geometry/vec3/chunk_f32_array_as_vec3.js";
|
|
11
9
|
import {
|
|
12
10
|
chunk_triangle_closest_point_to_point_barycentric
|
|
13
11
|
} from "./chunk_triangle_closest_point_to_point_barycentric.js";
|
|
14
12
|
import { SURFACE_POINT_3D } from "./SURFACE_POINT_3D.js";
|
|
13
|
+
import { BVH8_INODE_STRUCT } from "../bvh/bvh8/webgpu/BVH8_INODE_STRUCT.js";
|
|
14
|
+
import { BVH8_BLAS_MAX_DEPTH, BVH8_TRAVERSAL_STACK_SIZE } from "../bvh/bvh8/webgpu/BVH8_MAX_DEPTH.js";
|
|
15
|
+
import { chunk_bvh8_node_slot_distances } from "../bvh/bvh8/webgpu/chunk_bvh8_node_slot_distances.js";
|
|
16
|
+
import { BVH8_WAITING_SLOTS_CAPACITY, chunk_bvh8_waiting_slots } from "../bvh/bvh8/webgpu/chunk_bvh8_waiting_slots.js";
|
|
15
17
|
|
|
18
|
+
assert.lessThanOrEqual(BVH8_BLAS_MAX_DEPTH, BVH8_WAITING_SLOTS_CAPACITY, 'a BLAS may be deeper than the walk can keep slots for');
|
|
16
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Nearest point of one geometry's surface to a point, through its tree: `primitive` is the
|
|
22
|
+
* `(meshlet << 8) | triangle` id of the nearest triangle within `max_distance`, or all ones when there
|
|
23
|
+
* is none.
|
|
24
|
+
*
|
|
25
|
+
* A node is visited once for its own triangles: those of the slots whose boxes are nearer than the best
|
|
26
|
+
* found, one after another, and each time one of them is nearer still the rest are held to it. Its
|
|
27
|
+
* child nodes are then taken nearest box first, and what is left of them waits on the stack as one
|
|
28
|
+
* entry:
|
|
29
|
+
*
|
|
30
|
+
* - one other child worth a visit waits as itself, and is visited whatever has been found by then;
|
|
31
|
+
* - several wait as their node; on the way back the node is read again and the nearest of those that
|
|
32
|
+
* still beats the best is taken.
|
|
33
|
+
*
|
|
34
|
+
* So the stack is as deep as the tree and no deeper, whatever the fan-out.
|
|
35
|
+
*
|
|
36
|
+
* `stack` is the caller's, used from `stack_top` up and handed back as it was found below that. The
|
|
37
|
+
* walk reads and writes the first word of an entry and nothing else of it: which of a waiting node's
|
|
38
|
+
* slots are still to visit stays with the walk, a byte a level ({@link chunk_bvh8_waiting_slots}).
|
|
39
|
+
*
|
|
40
|
+
* @type {CodeChunk}
|
|
41
|
+
*/
|
|
17
42
|
export const chunk_point_query_blas_nearest = CodeChunk.from(
|
|
18
43
|
//language=WGSL
|
|
19
44
|
`
|
|
20
|
-
fn point_query_blas_nearest
|
|
21
|
-
position:vec3<f32>,
|
|
45
|
+
fn point_query_blas_nearest(
|
|
46
|
+
position: vec3<f32>,
|
|
22
47
|
max_distance: f32,
|
|
23
|
-
geometry_index:u32,
|
|
24
|
-
stack:ptr<function, array<
|
|
25
|
-
stack_top:u32
|
|
26
|
-
) -> ${SURFACE_POINT_3D.wgsl_ref}{
|
|
27
|
-
|
|
48
|
+
geometry_index: u32,
|
|
49
|
+
stack: ptr<function, array<vec2u, ${BVH8_TRAVERSAL_STACK_SIZE}>>,
|
|
50
|
+
stack_top: u32,
|
|
51
|
+
) -> ${SURFACE_POINT_3D.wgsl_ref} {
|
|
52
|
+
|
|
28
53
|
let geometry = geometries[geometry_index];
|
|
29
|
-
|
|
54
|
+
|
|
30
55
|
let blas_address = blas_lookup[geometry_index];
|
|
31
|
-
|
|
32
|
-
var pointer = stack_top + 1;
|
|
33
|
-
|
|
34
|
-
var node_index = 0u;
|
|
35
|
-
|
|
56
|
+
|
|
36
57
|
var nearest_distance_sqr = max_distance * max_distance;
|
|
37
|
-
|
|
58
|
+
|
|
38
59
|
var out: ${SURFACE_POINT_3D.wgsl_ref};
|
|
39
|
-
out.primitive = ${UINT32_MAX}; //
|
|
40
|
-
|
|
41
|
-
for(;pointer > stack_top && pointer < ${BVH_TRAVERSAL_STACK_SIZE};){
|
|
42
|
-
|
|
43
|
-
let node = blas_data[ blas_address + node_index ];
|
|
44
|
-
|
|
45
|
-
let child_1 = node.child_1;
|
|
46
|
-
let child_2 = node.child_2;
|
|
47
|
-
|
|
48
|
-
if(child_1 != BVH_NULL_NODE){
|
|
49
|
-
// not a leaf node
|
|
50
|
-
let child_1_bounds = blas_data[ blas_address + child_1 ].bounds;
|
|
51
|
-
let distance_sqr_to_child1 = aabb3_unsigned_distance_sqr_to_point(child_1_bounds, position);
|
|
52
|
-
|
|
53
|
-
let child_2_bounds = blas_data[ blas_address + child_2 ].bounds;
|
|
54
|
-
let distance_sqr_to_child2 = aabb3_unsigned_distance_sqr_to_point(child_2_bounds, position);
|
|
55
|
-
|
|
56
|
-
// sort children
|
|
57
|
-
var sorted_children = vec2(child_1, child_2);
|
|
58
|
-
var sorted_distances = vec2(distance_sqr_to_child1, distance_sqr_to_child2);
|
|
59
|
-
|
|
60
|
-
if (distance_sqr_to_child2 < distance_sqr_to_child1) {
|
|
61
|
-
|
|
62
|
-
sorted_children = sorted_children.yx;
|
|
63
|
-
sorted_distances = sorted_distances.yx;
|
|
60
|
+
out.primitive = ${UINT32_MAX}u; // a miss, until something is found
|
|
64
61
|
|
|
62
|
+
// the walk's own part of the stack
|
|
63
|
+
let stack_end = min(stack_top + ${BVH8_WAITING_SLOTS_CAPACITY}u, ${BVH8_TRAVERSAL_STACK_SIZE}u);
|
|
64
|
+
|
|
65
|
+
var pointer = stack_top;
|
|
66
|
+
|
|
67
|
+
// the slots still to visit of each node waiting on the stack; none for a child waiting as itself
|
|
68
|
+
var waiting = vec4<u32>(0u);
|
|
69
|
+
|
|
70
|
+
// the node being looked at, and which of its child slots are still to visit
|
|
71
|
+
var node_index = blas_address;
|
|
72
|
+
var pending = 0u;
|
|
73
|
+
var arriving = true;
|
|
74
|
+
|
|
75
|
+
loop {
|
|
76
|
+
let node: ${BVH8_INODE_STRUCT.wgsl_ref} = blas_data[node_index];
|
|
77
|
+
let distances = bvh8_node_slot_distances_sqr(node, position);
|
|
78
|
+
|
|
79
|
+
let imask = node.data[0].w >> 24u;
|
|
80
|
+
|
|
81
|
+
if (arriving) {
|
|
82
|
+
// this node's own triangles first: what they find prunes its children
|
|
83
|
+
let runs = bvh8_node_slot_runs(node);
|
|
84
|
+
|
|
85
|
+
var run = bvh8_slot_runs_within(runs, distances, nearest_distance_sqr);
|
|
86
|
+
|
|
87
|
+
if (run != 0u) {
|
|
88
|
+
// a node's triangles are one run of one meshlet
|
|
89
|
+
let triangle_base = node.data[1].y;
|
|
90
|
+
|
|
91
|
+
let meshlet_header = meshlet_metadata[geometry.meshlets_address + (triangle_base >> 8u)];
|
|
92
|
+
|
|
93
|
+
while (run != 0u) {
|
|
94
|
+
let encoded_triangle_id = triangle_base + countTrailingZeros(run);
|
|
95
|
+
|
|
96
|
+
run &= run - 1u;
|
|
97
|
+
|
|
98
|
+
let corner = (encoded_triangle_id & 0xffu) * 3u;
|
|
99
|
+
|
|
100
|
+
let a = read_meshlet_vertex_position(meshlet_header, read_meshlet_resolved_index(meshlet_header, corner));
|
|
101
|
+
let b = read_meshlet_vertex_position(meshlet_header, read_meshlet_resolved_index(meshlet_header, corner + 1u));
|
|
102
|
+
let c = read_meshlet_vertex_position(meshlet_header, read_meshlet_resolved_index(meshlet_header, corner + 2u));
|
|
103
|
+
|
|
104
|
+
let barycentric = triangle_closest_point_to_point_barycentric(position, a, b, c);
|
|
105
|
+
|
|
106
|
+
let contact = a * barycentric.x + b * barycentric.y + c * (1.0 - barycentric.x - barycentric.y);
|
|
107
|
+
|
|
108
|
+
let offset = position - contact;
|
|
109
|
+
let distance_sqr = dot(offset, offset);
|
|
110
|
+
|
|
111
|
+
if (distance_sqr < nearest_distance_sqr) {
|
|
112
|
+
nearest_distance_sqr = distance_sqr;
|
|
113
|
+
|
|
114
|
+
out.position = contact;
|
|
115
|
+
out.normal = compute_triangle_face_normal(a, b, c);
|
|
116
|
+
out.primitive = encoded_triangle_id;
|
|
117
|
+
|
|
118
|
+
// slots no nearer than this are done with
|
|
119
|
+
run &= bvh8_slot_runs_within(runs, distances, nearest_distance_sqr);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
65
122
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
pointer --;
|
|
90
|
-
node_index = stack[pointer];
|
|
91
|
-
|
|
92
|
-
let triangle_index = child_2;
|
|
93
|
-
let triangle = geometry_read_triangle_vertices(geometry, child_2);
|
|
94
|
-
|
|
95
|
-
let a = triangle.a.position;
|
|
96
|
-
let b = triangle.b.position;
|
|
97
|
-
let c = triangle.c.position;
|
|
98
|
-
|
|
99
|
-
let barycentric2 = triangle_closest_point_to_point_barycentric(position, a, b, c);
|
|
100
|
-
|
|
101
|
-
let u = barycentric2.x;
|
|
102
|
-
let v = barycentric2.y;
|
|
103
|
-
let w = 1 - u - v;
|
|
104
|
-
|
|
105
|
-
let contact = a*u + b*v + c*w;
|
|
106
|
-
|
|
107
|
-
let distance_to_triangle = distance(position, contact);
|
|
108
|
-
let distance_to_triangle_sqr = distance_to_triangle * distance_to_triangle;
|
|
109
|
-
|
|
110
|
-
if (distance_to_triangle_sqr >= nearest_distance_sqr) {
|
|
111
|
-
continue;
|
|
123
|
+
|
|
124
|
+
pending = imask;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// the children still to visit that are worth one
|
|
128
|
+
let worthwhile = bvh8_slots_within(distances, nearest_distance_sqr) & pending;
|
|
129
|
+
|
|
130
|
+
if (worthwhile != 0u) {
|
|
131
|
+
let nearest_slot = bvh8_nearest_slot_among(distances, worthwhile);
|
|
132
|
+
|
|
133
|
+
// the node's children sit in one block, in slot order
|
|
134
|
+
let child_block = blas_address + node.data[1].x;
|
|
135
|
+
|
|
136
|
+
let later = worthwhile & ~(1u << nearest_slot);
|
|
137
|
+
|
|
138
|
+
if (later != 0u && pointer < stack_end) {
|
|
139
|
+
let lone = (later & (later - 1u)) == 0u;
|
|
140
|
+
|
|
141
|
+
stack[pointer].x = select(node_index, child_block + countOneBits(imask & (later - 1u)), lone);
|
|
142
|
+
|
|
143
|
+
pointer++;
|
|
144
|
+
|
|
145
|
+
waiting = bvh8_waiting_slots_push(waiting, select(later, 0u, lone));
|
|
112
146
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
147
|
+
|
|
148
|
+
node_index = child_block + countOneBits(imask & ((1u << nearest_slot) - 1u));
|
|
149
|
+
arriving = true;
|
|
150
|
+
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// nothing more under this node: back to whatever waits
|
|
155
|
+
if (pointer == stack_top) {
|
|
156
|
+
break;
|
|
120
157
|
}
|
|
121
|
-
|
|
158
|
+
|
|
159
|
+
pointer--;
|
|
160
|
+
|
|
161
|
+
node_index = stack[pointer].x;
|
|
162
|
+
pending = bvh8_waiting_slots_latest(waiting);
|
|
163
|
+
arriving = pending == 0u;
|
|
164
|
+
|
|
165
|
+
waiting = bvh8_waiting_slots_pop(waiting);
|
|
122
166
|
}
|
|
123
|
-
|
|
167
|
+
|
|
124
168
|
return out;
|
|
125
169
|
}
|
|
126
170
|
`, [
|
|
127
|
-
|
|
171
|
+
BVH8_INODE_STRUCT.declaration_chunk,
|
|
172
|
+
GEOMETRY_METADATA_STRUCT.declaration_chunk,
|
|
173
|
+
MESHLET_METADATA_STRUCT.declaration_chunk,
|
|
128
174
|
SURFACE_POINT_3D.declaration_chunk,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
175
|
+
chunk_bvh8_node_slot_distances,
|
|
176
|
+
chunk_bvh8_waiting_slots,
|
|
177
|
+
chunk_read_meshlet_resolved_index,
|
|
178
|
+
chunk_read_meshlet_vertex_position,
|
|
132
179
|
chunk_triangle_closest_point_to_point_barycentric,
|
|
133
180
|
chunk_compute_triangle_face_normal,
|
|
134
181
|
]
|
|
135
|
-
);
|
|
182
|
+
);
|
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The nearest point of any instance's surface to a point in the world, within `max_distance`:
|
|
3
|
+
*
|
|
4
|
+
* ```wgsl
|
|
5
|
+
* fn scene_point_query_nearest(position: vec3<f32>, max_distance: f32) -> SurfacePoint3D
|
|
6
|
+
* ```
|
|
7
|
+
*
|
|
8
|
+
* `primitive` is the `meshes` row of the instance the point lies on, or all ones when there is none;
|
|
9
|
+
* `position` and `normal` are in the world.
|
|
10
|
+
*
|
|
11
|
+
* The TLAS is walked nearest box first: an instance, or a child node, is passed by once the best
|
|
12
|
+
* found is nearer than its box. A node's instances are asked before its children, each in its own
|
|
13
|
+
* space ({@link chunk_point_query_blas_nearest}).
|
|
14
|
+
*
|
|
15
|
+
* One stack serves both levels, a node in the first word of an entry: the BLAS under an instance
|
|
16
|
+
* takes the entries above the TLAS walk's own.
|
|
17
|
+
*
|
|
18
|
+
* The enclosing shader binds `tlas`, `scene_database` and the BLAS buffers.
|
|
19
|
+
*
|
|
20
|
+
* @type {CodeChunk}
|
|
21
|
+
*/
|
|
1
22
|
export const chunk_scene_point_query_nearest: CodeChunk;
|
|
2
23
|
import { CodeChunk } from "../../compiler/CodeChunk.js";
|
|
3
24
|
//# sourceMappingURL=chunk_scene_point_query_nearest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_scene_point_query_nearest.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/sdf/chunk_scene_point_query_nearest.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chunk_scene_point_query_nearest.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/sdf/chunk_scene_point_query_nearest.js"],"names":[],"mappings":"AAiBA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,8CAFU,SAAS,CAyIjB;0BA1KwB,6BAA6B"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { assert } from "../../../../../core/assert.js";
|
|
1
2
|
import { UINT32_MAX } from "../../../../../core/binary/UINT32_MAX.js";
|
|
2
3
|
import { chunk_scene_database_access } from "../../../scene/chunk_scene_database_access.js";
|
|
3
4
|
import { CodeChunk } from "../../compiler/CodeChunk.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
} from "../geometry/aabb3/chunk_aabb3_unsigned_distance_sqr_to_point.js";
|
|
5
|
+
import { BVH8_TLAS_MAX_DEPTH, BVH8_TRAVERSAL_STACK_SIZE } from "../bvh/bvh8/webgpu/BVH8_MAX_DEPTH.js";
|
|
6
|
+
import { chunk_bvh8_node_slot_distances } from "../bvh/bvh8/webgpu/chunk_bvh8_node_slot_distances.js";
|
|
7
|
+
import { chunk_bvh8_tree_read } from "../bvh/bvh8/webgpu/chunk_bvh8_tree_read.js";
|
|
8
|
+
import { BVH8_WAITING_SLOTS_CAPACITY, chunk_bvh8_waiting_slots } from "../bvh/bvh8/webgpu/chunk_bvh8_waiting_slots.js";
|
|
9
9
|
import { chunk_mat4_inverse } from "../geometry/mat4/chunk_mat4_inverse.js";
|
|
10
10
|
import { chunk_v3_matrix4_project } from "../geometry/vec3/chunk_v3_matrix4_project.js";
|
|
11
11
|
import { chunk_v3_matrix4_rotate } from "../geometry/vec3/chunk_v3_matrix4_rotate.js";
|
|
@@ -13,121 +13,162 @@ import { F32_MAX_DEFINITION } from "../math/F32_MAX_DEFINITION.js";
|
|
|
13
13
|
import { chunk_point_query_blas_nearest } from "./chunk_point_query_blas_nearest.js";
|
|
14
14
|
import { SURFACE_POINT_3D } from "./SURFACE_POINT_3D.js";
|
|
15
15
|
|
|
16
|
+
assert.lessThanOrEqual(BVH8_TLAS_MAX_DEPTH, BVH8_WAITING_SLOTS_CAPACITY, 'the TLAS may be deeper than the walk can keep slots for');
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The nearest point of any instance's surface to a point in the world, within `max_distance`:
|
|
20
|
+
*
|
|
21
|
+
* ```wgsl
|
|
22
|
+
* fn scene_point_query_nearest(position: vec3<f32>, max_distance: f32) -> SurfacePoint3D
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* `primitive` is the `meshes` row of the instance the point lies on, or all ones when there is none;
|
|
26
|
+
* `position` and `normal` are in the world.
|
|
27
|
+
*
|
|
28
|
+
* The TLAS is walked nearest box first: an instance, or a child node, is passed by once the best
|
|
29
|
+
* found is nearer than its box. A node's instances are asked before its children, each in its own
|
|
30
|
+
* space ({@link chunk_point_query_blas_nearest}).
|
|
31
|
+
*
|
|
32
|
+
* One stack serves both levels, a node in the first word of an entry: the BLAS under an instance
|
|
33
|
+
* takes the entries above the TLAS walk's own.
|
|
34
|
+
*
|
|
35
|
+
* The enclosing shader binds `tlas`, `scene_database` and the BLAS buffers.
|
|
36
|
+
*
|
|
37
|
+
* @type {CodeChunk}
|
|
38
|
+
*/
|
|
16
39
|
export const chunk_scene_point_query_nearest = CodeChunk.from(
|
|
17
40
|
//language=WGSL
|
|
18
41
|
`
|
|
19
|
-
fn scene_point_query_nearest(position: vec3<f32>, max_distance: f32) -> ${SURFACE_POINT_3D.wgsl_ref}{
|
|
42
|
+
fn scene_point_query_nearest(position: vec3<f32>, max_distance: f32) -> ${SURFACE_POINT_3D.wgsl_ref} {
|
|
43
|
+
var stack: array<vec2u, ${BVH8_TRAVERSAL_STACK_SIZE}>;
|
|
44
|
+
var pointer = 0u;
|
|
45
|
+
|
|
46
|
+
// the slots still to visit of each node waiting on the stack; none for a child waiting as itself
|
|
47
|
+
var waiting = vec4<u32>(0u);
|
|
20
48
|
|
|
21
|
-
var stack = array<u32, ${BVH_TRAVERSAL_STACK_SIZE}>();
|
|
22
|
-
var node_index = tlas.root;
|
|
23
|
-
var pointer = 1u;
|
|
24
|
-
|
|
25
49
|
var nearest_distance_sqr = max_distance * max_distance;
|
|
26
|
-
|
|
50
|
+
|
|
27
51
|
var out: ${SURFACE_POINT_3D.wgsl_ref};
|
|
28
|
-
out.primitive = ${UINT32_MAX}; //
|
|
29
|
-
|
|
52
|
+
out.primitive = ${UINT32_MAX}u; // a miss, until something is found
|
|
30
53
|
|
|
31
|
-
|
|
54
|
+
// the node being looked at, and which of its child slots are still to visit
|
|
55
|
+
var node_index = 0u;
|
|
56
|
+
var pending = 0u;
|
|
57
|
+
var arriving = true;
|
|
32
58
|
|
|
33
|
-
|
|
34
|
-
let
|
|
35
|
-
let
|
|
59
|
+
loop {
|
|
60
|
+
let node = bvh8_tree_read_node(&tlas, node_index);
|
|
61
|
+
let distances = bvh8_node_slot_distances_sqr(node, position);
|
|
36
62
|
|
|
37
|
-
|
|
38
|
-
// not a leaf node
|
|
39
|
-
let child_1_bounds = tlas.nodes[ child_1 ].bounds;
|
|
40
|
-
let distance_sqr_to_child1 = aabb3_unsigned_distance_sqr_to_point(child_1_bounds, position);
|
|
63
|
+
let imask = node.data[0].w >> 24u;
|
|
41
64
|
|
|
42
|
-
|
|
43
|
-
|
|
65
|
+
if (arriving) {
|
|
66
|
+
// this node's own instances first: what they find prunes its children
|
|
67
|
+
let runs = bvh8_node_slot_runs(node);
|
|
44
68
|
|
|
45
|
-
|
|
46
|
-
var sorted_children = vec2(child_1, child_2);
|
|
47
|
-
var sorted_distances = vec2(distance_sqr_to_child1, distance_sqr_to_child2);
|
|
69
|
+
var run = bvh8_slot_runs_within(runs, distances, nearest_distance_sqr);
|
|
48
70
|
|
|
49
|
-
|
|
71
|
+
while (run != 0u) {
|
|
72
|
+
let offset = countTrailingZeros(run);
|
|
50
73
|
|
|
51
|
-
|
|
52
|
-
sorted_distances = sorted_distances.yx;
|
|
74
|
+
run &= run - 1u;
|
|
53
75
|
|
|
54
|
-
|
|
76
|
+
// a leaf's payload is the instance's meshes row
|
|
77
|
+
let mesh_id = bvh8_tree_read_payload(&tlas, node, offset);
|
|
55
78
|
|
|
56
|
-
|
|
57
|
-
|
|
79
|
+
let mesh = scene_read_mesh(&scene_database, mesh_id);
|
|
80
|
+
let placement = scene_read_node(&scene_database, mesh.node);
|
|
58
81
|
|
|
59
|
-
|
|
82
|
+
let geometry_position = v3_matrix4_project(position, mat4_inverse(placement.global));
|
|
60
83
|
|
|
61
|
-
|
|
84
|
+
let geometry_hit = point_query_blas_nearest(
|
|
85
|
+
geometry_position,
|
|
86
|
+
F32_MAX, // TODO consider passing a sensible max-distance
|
|
87
|
+
mesh.geometry,
|
|
88
|
+
&stack,
|
|
89
|
+
pointer
|
|
90
|
+
);
|
|
62
91
|
|
|
63
|
-
|
|
92
|
+
if (geometry_hit.primitive == ${UINT32_MAX}u) {
|
|
93
|
+
// a geometry with no triangles
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
64
96
|
|
|
65
|
-
|
|
97
|
+
let mesh_hit_point = v3_matrix4_project(geometry_hit.position, placement.global);
|
|
66
98
|
|
|
67
|
-
|
|
99
|
+
let offset_to_mesh = mesh_hit_point - position;
|
|
100
|
+
let distance_to_mesh_sqr = dot(offset_to_mesh, offset_to_mesh);
|
|
68
101
|
|
|
69
|
-
|
|
102
|
+
if (distance_to_mesh_sqr >= nearest_distance_sqr) {
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
70
105
|
|
|
71
|
-
|
|
72
|
-
node_index = stack[pointer];
|
|
106
|
+
nearest_distance_sqr = distance_to_mesh_sqr;
|
|
73
107
|
|
|
74
|
-
|
|
108
|
+
out.primitive = mesh_id;
|
|
109
|
+
out.normal = v3_matrix4_rotate(geometry_hit.normal, placement.global);
|
|
110
|
+
out.position = mesh_hit_point;
|
|
75
111
|
|
|
76
|
-
|
|
112
|
+
// slots no nearer than this are done with
|
|
113
|
+
run &= bvh8_slot_runs_within(runs, distances, nearest_distance_sqr);
|
|
114
|
+
}
|
|
77
115
|
|
|
78
|
-
|
|
79
|
-
|
|
116
|
+
pending = imask;
|
|
117
|
+
}
|
|
80
118
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
let node = scene_read_node(&scene_database, mesh.node);
|
|
119
|
+
// the children still to visit that are worth one
|
|
120
|
+
let worthwhile = bvh8_slots_within(distances, nearest_distance_sqr) & pending;
|
|
84
121
|
|
|
85
|
-
|
|
122
|
+
if (worthwhile != 0u) {
|
|
123
|
+
let nearest_slot = bvh8_nearest_slot_among(distances, worthwhile);
|
|
86
124
|
|
|
87
|
-
|
|
125
|
+
// the node's children sit in one block, in slot order
|
|
126
|
+
let child_block = node.data[1].x;
|
|
88
127
|
|
|
89
|
-
let
|
|
90
|
-
geometry_position,
|
|
91
|
-
F32_MAX, // TODO consider passing a sensible max-distance
|
|
92
|
-
geometry_id,
|
|
93
|
-
&stack,
|
|
94
|
-
pointer
|
|
95
|
-
);
|
|
128
|
+
let later = worthwhile & ~(1u << nearest_slot);
|
|
96
129
|
|
|
97
|
-
if(
|
|
98
|
-
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
130
|
+
if (later != 0u && pointer < ${BVH8_TLAS_MAX_DEPTH}u) {
|
|
131
|
+
let lone = (later & (later - 1u)) == 0u;
|
|
101
132
|
|
|
102
|
-
|
|
133
|
+
stack[pointer].x = select(node_index, child_block + countOneBits(imask & (later - 1u)), lone);
|
|
103
134
|
|
|
104
|
-
|
|
105
|
-
let distance_to_mesh2 = distance_to_mesh*distance_to_mesh;
|
|
135
|
+
pointer++;
|
|
106
136
|
|
|
107
|
-
|
|
108
|
-
continue;
|
|
137
|
+
waiting = bvh8_waiting_slots_push(waiting, select(later, 0u, lone));
|
|
109
138
|
}
|
|
110
139
|
|
|
111
|
-
|
|
140
|
+
node_index = child_block + countOneBits(imask & ((1u << nearest_slot) - 1u));
|
|
141
|
+
arriving = true;
|
|
112
142
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
out.position = mesh_hit_point;
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
116
145
|
|
|
146
|
+
// nothing more under this node: back to whatever waits
|
|
147
|
+
if (pointer == 0u) {
|
|
148
|
+
break;
|
|
117
149
|
}
|
|
150
|
+
|
|
151
|
+
pointer--;
|
|
152
|
+
|
|
153
|
+
node_index = stack[pointer].x;
|
|
154
|
+
pending = bvh8_waiting_slots_latest(waiting);
|
|
155
|
+
arriving = pending == 0u;
|
|
156
|
+
|
|
157
|
+
waiting = bvh8_waiting_slots_pop(waiting);
|
|
118
158
|
}
|
|
119
|
-
|
|
159
|
+
|
|
120
160
|
return out;
|
|
121
161
|
}
|
|
122
|
-
`, [
|
|
162
|
+
`, [
|
|
123
163
|
SURFACE_POINT_3D.declaration_chunk,
|
|
124
|
-
BVH_NULL_NODE_DEFINITION,
|
|
125
164
|
F32_MAX_DEFINITION,
|
|
165
|
+
chunk_bvh8_tree_read,
|
|
166
|
+
chunk_bvh8_node_slot_distances,
|
|
167
|
+
chunk_bvh8_waiting_slots,
|
|
126
168
|
chunk_point_query_blas_nearest,
|
|
127
|
-
chunk_aabb3_unsigned_distance_sqr_to_point,
|
|
128
169
|
chunk_v3_matrix4_project,
|
|
129
170
|
chunk_v3_matrix4_rotate,
|
|
130
171
|
chunk_mat4_inverse,
|
|
131
172
|
chunk_scene_database_access,
|
|
132
173
|
]
|
|
133
|
-
);
|
|
174
|
+
);
|
|
@@ -5,8 +5,11 @@
|
|
|
5
5
|
* fn scene_sdf_raymarch_hit(ray: Ray) -> SceneSDFHit // t = F32_MAX for none
|
|
6
6
|
* ```
|
|
7
7
|
*
|
|
8
|
-
* The TLAS is walked
|
|
9
|
-
*
|
|
8
|
+
* The TLAS is walked with the ray, nearer slots first by the ray's octant, and the ray is shortened
|
|
9
|
+
* at every hit; in every instance whose box it still reaches, the ray marches that geometry's sparse
|
|
10
|
+
* field at level 0 in its local space, whose t is the world one.
|
|
11
|
+
*
|
|
12
|
+
* The enclosing shader binds `tlas`, `scene_database` and the mesh SDF buffers.
|
|
10
13
|
*
|
|
11
14
|
* @type {CodeChunk}
|
|
12
15
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_scene_sdf_raymarch.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/sdf/chunk_scene_sdf_raymarch.js"],"names":[],"mappings":"AAeA
|
|
1
|
+
{"version":3,"file":"chunk_scene_sdf_raymarch.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/sdf/chunk_scene_sdf_raymarch.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;GAcG;AACH,2CAFU,SAAS,CAwHjB;AAEF;;;;;;;;GAQG;AACH,uCAFU,SAAS,CAYjB;0BAtKwB,6BAA6B"}
|