@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,70 +1,70 @@
|
|
|
1
|
-
import { assert } from "../../../../core/assert.js";
|
|
2
|
-
import { BVH2_NODE_STRUCT } from "../../shader/chunk/bvh/BVH2_NODE_STRUCT.js";
|
|
3
|
-
import { BVH_STRUCT } from "../../shader/chunk/bvh/BVH_STRUCT.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* The BVH buffer's byte contract, resolved from the structs the traversal shaders read rather than
|
|
7
|
-
* restated as literals — `.pack()` and WGSL layout rules decide these offsets, and a builder that
|
|
8
|
-
* hard-codes them is one struct edit away from writing trees nothing can traverse.
|
|
9
|
-
*
|
|
10
|
-
* The layout every
|
|
11
|
-
*
|
|
12
|
-
* [u32 root][node 0][node 1] ... where a node is
|
|
13
|
-
* [min.x, min.y, min.z, max.x, max.y, max.z : f32][child_1 : u32][child_2 : u32]
|
|
14
|
-
*
|
|
15
|
-
* A node is a leaf exactly when `child_1 == BVH_NULL_NODE`, and then `child_2` carries the payload
|
|
16
|
-
* (for the
|
|
17
|
-
* real children with meaningful bounds — the distance-ordered point queries dereference both before
|
|
18
|
-
* descending, so a placeholder child is not an option.
|
|
19
|
-
*
|
|
20
|
-
* @see BVH2_NODE_STRUCT
|
|
21
|
-
* @see BVH_STRUCT
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Words per node.
|
|
26
|
-
* @type {number}
|
|
27
|
-
*/
|
|
28
|
-
export const BVH_NODE_STRIDE_WORDS = BVH2_NODE_STRUCT.size / Uint32Array.BYTES_PER_ELEMENT;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Word offset of the node's six bounds floats, within the node.
|
|
32
|
-
* @type {number}
|
|
33
|
-
*/
|
|
34
|
-
export const BVH_NODE_BOUNDS_WORD = BVH2_NODE_STRUCT.get('bounds').offset / Uint32Array.BYTES_PER_ELEMENT;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Word offset of `child_1` within the node — the field whose `BVH_NULL_NODE` value means "leaf".
|
|
38
|
-
* @type {number}
|
|
39
|
-
*/
|
|
40
|
-
export const BVH_NODE_CHILD_1_WORD = BVH2_NODE_STRUCT.get('child_1').offset / Uint32Array.BYTES_PER_ELEMENT;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Word offset of `child_2` within the node — right child, or payload on a leaf.
|
|
44
|
-
* @type {number}
|
|
45
|
-
*/
|
|
46
|
-
export const BVH_NODE_CHILD_2_WORD = BVH2_NODE_STRUCT.get('child_2').offset / Uint32Array.BYTES_PER_ELEMENT;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Words the `root` header occupies in front of node 0. This is the `+ 4` in every sizing expression
|
|
50
|
-
* in the tree.
|
|
51
|
-
* @type {number}
|
|
52
|
-
*/
|
|
53
|
-
export const BVH_HEADER_WORDS = BVH_STRUCT.get('nodes').offset / Uint32Array.BYTES_PER_ELEMENT;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Bytes a complete tree over `leaf_count` leaves occupies, header included.
|
|
57
|
-
*
|
|
58
|
-
* A Karras hierarchy over N leaves is exactly `2N - 1` nodes: `N - 1` internal and `N` leaves. One
|
|
59
|
-
* leaf is the degenerate case — a single leaf node, no internal node at all.
|
|
60
|
-
*
|
|
61
|
-
* @param {number} leaf_count
|
|
62
|
-
* @returns {number}
|
|
63
|
-
*/
|
|
64
|
-
export function bvh_buffer_size(leaf_count) {
|
|
65
|
-
assert.isNonNegativeInteger(leaf_count, 'leaf_count');
|
|
66
|
-
|
|
67
|
-
const node_count = leaf_count === 0 ? 0 : 2 * leaf_count - 1;
|
|
68
|
-
|
|
69
|
-
return BVH_HEADER_WORDS * Uint32Array.BYTES_PER_ELEMENT + node_count * BVH2_NODE_STRUCT.size;
|
|
70
|
-
}
|
|
1
|
+
import { assert } from "../../../../core/assert.js";
|
|
2
|
+
import { BVH2_NODE_STRUCT } from "../../shader/chunk/bvh/BVH2_NODE_STRUCT.js";
|
|
3
|
+
import { BVH_STRUCT } from "../../shader/chunk/bvh/BVH_STRUCT.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The BVH buffer's byte contract, resolved from the structs the traversal shaders read rather than
|
|
7
|
+
* restated as literals — `.pack()` and WGSL layout rules decide these offsets, and a builder that
|
|
8
|
+
* hard-codes them is one struct edit away from writing trees nothing can traverse.
|
|
9
|
+
*
|
|
10
|
+
* The layout every reader of a binary tree depends on:
|
|
11
|
+
*
|
|
12
|
+
* [u32 root][node 0][node 1] ... where a node is
|
|
13
|
+
* [min.x, min.y, min.z, max.x, max.y, max.z : f32][child_1 : u32][child_2 : u32]
|
|
14
|
+
*
|
|
15
|
+
* A node is a leaf exactly when `child_1 == BVH_NULL_NODE`, and then `child_2` carries the payload
|
|
16
|
+
* (for the tree over a scene's instances, a row in the scene database's `meshes` table). An internal node always has two
|
|
17
|
+
* real children with meaningful bounds — the distance-ordered point queries dereference both before
|
|
18
|
+
* descending, so a placeholder child is not an option.
|
|
19
|
+
*
|
|
20
|
+
* @see BVH2_NODE_STRUCT
|
|
21
|
+
* @see BVH_STRUCT
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Words per node.
|
|
26
|
+
* @type {number}
|
|
27
|
+
*/
|
|
28
|
+
export const BVH_NODE_STRIDE_WORDS = BVH2_NODE_STRUCT.size / Uint32Array.BYTES_PER_ELEMENT;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Word offset of the node's six bounds floats, within the node.
|
|
32
|
+
* @type {number}
|
|
33
|
+
*/
|
|
34
|
+
export const BVH_NODE_BOUNDS_WORD = BVH2_NODE_STRUCT.get('bounds').offset / Uint32Array.BYTES_PER_ELEMENT;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Word offset of `child_1` within the node — the field whose `BVH_NULL_NODE` value means "leaf".
|
|
38
|
+
* @type {number}
|
|
39
|
+
*/
|
|
40
|
+
export const BVH_NODE_CHILD_1_WORD = BVH2_NODE_STRUCT.get('child_1').offset / Uint32Array.BYTES_PER_ELEMENT;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Word offset of `child_2` within the node — right child, or payload on a leaf.
|
|
44
|
+
* @type {number}
|
|
45
|
+
*/
|
|
46
|
+
export const BVH_NODE_CHILD_2_WORD = BVH2_NODE_STRUCT.get('child_2').offset / Uint32Array.BYTES_PER_ELEMENT;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Words the `root` header occupies in front of node 0. This is the `+ 4` in every sizing expression
|
|
50
|
+
* in the tree.
|
|
51
|
+
* @type {number}
|
|
52
|
+
*/
|
|
53
|
+
export const BVH_HEADER_WORDS = BVH_STRUCT.get('nodes').offset / Uint32Array.BYTES_PER_ELEMENT;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Bytes a complete tree over `leaf_count` leaves occupies, header included.
|
|
57
|
+
*
|
|
58
|
+
* A Karras hierarchy over N leaves is exactly `2N - 1` nodes: `N - 1` internal and `N` leaves. One
|
|
59
|
+
* leaf is the degenerate case — a single leaf node, no internal node at all.
|
|
60
|
+
*
|
|
61
|
+
* @param {number} leaf_count
|
|
62
|
+
* @returns {number}
|
|
63
|
+
*/
|
|
64
|
+
export function bvh_buffer_size(leaf_count) {
|
|
65
|
+
assert.isNonNegativeInteger(leaf_count, 'leaf_count');
|
|
66
|
+
|
|
67
|
+
const node_count = leaf_count === 0 ? 0 : 2 * leaf_count - 1;
|
|
68
|
+
|
|
69
|
+
return BVH_HEADER_WORDS * Uint32Array.BYTES_PER_ELEMENT + node_count * BVH2_NODE_STRUCT.size;
|
|
70
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `root_word_offset` value meaning "this tree has no root word".
|
|
3
3
|
*
|
|
4
|
-
* A
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* A tree that owns its buffer is `{root: u32, nodes: array<node>}`, and its readers take the root
|
|
5
|
+
* from that first word. A tree laid among others in a shared buffer has no header at all: its root
|
|
6
|
+
* is node 0 by convention. One emission kernel serves both, so "where does the root word go" has to
|
|
7
|
+
* include "nowhere".
|
|
8
8
|
*
|
|
9
9
|
* @type {number}
|
|
10
10
|
*/
|
|
@@ -17,9 +17,8 @@ export const BVH_NO_ROOT_WORD: number;
|
|
|
17
17
|
* local to the tree.
|
|
18
18
|
*
|
|
19
19
|
* `node_word_offset` is where node 0 starts, in u32 words from the beginning of the bound buffer.
|
|
20
|
-
* A
|
|
21
|
-
* at some address inside a shared arena
|
|
22
|
-
* words. Keeping this a parameter rather than a constant is what lets one emission kernel and one
|
|
20
|
+
* A tree that owns its buffer puts node 0 straight after the root word, so it passes 1. One that
|
|
21
|
+
* lives at some address inside a shared arena passes that address in words. Keeping this a parameter rather than a constant is what lets one emission kernel and one
|
|
23
22
|
* refit kernel serve a tree that owns its buffer and a tree that is a tenant in someone else's.
|
|
24
23
|
*
|
|
25
24
|
* `parents_offset` and `leaf_nodes_offset` say the same thing about the other two arrays the refit
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BVH_BUILD_SETTINGS_STRUCT.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/gpu_primitive/bvh/BVH_BUILD_SETTINGS_STRUCT.js"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,+BAFU,MAAM,CAE2B;AAE3C
|
|
1
|
+
{"version":3,"file":"BVH_BUILD_SETTINGS_STRUCT.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/gpu_primitive/bvh/BVH_BUILD_SETTINGS_STRUCT.js"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,+BAFU,MAAM,CAE2B;AAE3C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wCAFU,YAAY,CAQC;6BA1CM,mCAAmC"}
|
|
@@ -4,10 +4,10 @@ import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* `root_word_offset` value meaning "this tree has no root word".
|
|
6
6
|
*
|
|
7
|
-
* A
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* A tree that owns its buffer is `{root: u32, nodes: array<node>}`, and its readers take the root
|
|
8
|
+
* from that first word. A tree laid among others in a shared buffer has no header at all: its root
|
|
9
|
+
* is node 0 by convention. One emission kernel serves both, so "where does the root word go" has to
|
|
10
|
+
* include "nowhere".
|
|
11
11
|
*
|
|
12
12
|
* @type {number}
|
|
13
13
|
*/
|
|
@@ -21,9 +21,8 @@ export const BVH_NO_ROOT_WORD = 0xffffffff;
|
|
|
21
21
|
* local to the tree.
|
|
22
22
|
*
|
|
23
23
|
* `node_word_offset` is where node 0 starts, in u32 words from the beginning of the bound buffer.
|
|
24
|
-
* A
|
|
25
|
-
* at some address inside a shared arena
|
|
26
|
-
* words. Keeping this a parameter rather than a constant is what lets one emission kernel and one
|
|
24
|
+
* A tree that owns its buffer puts node 0 straight after the root word, so it passes 1. One that
|
|
25
|
+
* lives at some address inside a shared arena passes that address in words. Keeping this a parameter rather than a constant is what lets one emission kernel and one
|
|
27
26
|
* refit kernel serve a tree that owns its buffer and a tree that is a tenant in someone else's.
|
|
28
27
|
*
|
|
29
28
|
* `parents_offset` and `leaf_nodes_offset` say the same thing about the other two arrays the refit
|
|
@@ -25,9 +25,9 @@ export function enquire_bvh_build_lbvh_pipelines(enquiry: PipelineEnquiry): void
|
|
|
25
25
|
*
|
|
26
26
|
* The output honours the format in {@link BVH_BUFFER_LAYOUT}: a `u32` root word, then `2N-1` nodes
|
|
27
27
|
* with internal nodes at `[0, N-2]` (root = 0, by Karras's construction) and leaf `j` at `(N-1)+j`.
|
|
28
|
-
* That ordering differs from the CPU path's slot-order-with-holes, which is legal because no
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* That ordering differs from the CPU path's slot-order-with-holes, which is legal because no walk
|
|
29
|
+
* reads node *order* — only the node format and the root word. `graph_bvh8_encode_from_bvh2` does
|
|
30
|
+
* read it: there a node is internal by its index.
|
|
31
31
|
*
|
|
32
32
|
* `element_count` must be at least 1. A single leaf needs no special case on either path: there
|
|
33
33
|
* is nothing to sort, emission skips the internal node and writes leaf 0 at node 0 with
|
|
@@ -48,9 +48,9 @@ export function enquire_bvh_build_lbvh_pipelines(enquiry) {
|
|
|
48
48
|
*
|
|
49
49
|
* The output honours the format in {@link BVH_BUFFER_LAYOUT}: a `u32` root word, then `2N-1` nodes
|
|
50
50
|
* with internal nodes at `[0, N-2]` (root = 0, by Karras's construction) and leaf `j` at `(N-1)+j`.
|
|
51
|
-
* That ordering differs from the CPU path's slot-order-with-holes, which is legal because no
|
|
52
|
-
*
|
|
53
|
-
*
|
|
51
|
+
* That ordering differs from the CPU path's slot-order-with-holes, which is legal because no walk
|
|
52
|
+
* reads node *order* — only the node format and the root word. `graph_bvh8_encode_from_bvh2` does
|
|
53
|
+
* read it: there a node is internal by its index.
|
|
54
54
|
*
|
|
55
55
|
* `element_count` must be at least 1. A single leaf needs no special case on either path: there
|
|
56
56
|
* is nothing to sort, emission skips the internal node and writes leaf 0 at node 0 with
|
|
@@ -133,7 +133,7 @@ fn main(@builtin(local_invocation_index) thread_id: u32) {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
if (thread_id == 0u) {
|
|
136
|
-
// see shader_bvh_emit_hierarchy: a
|
|
136
|
+
// see shader_bvh_emit_hierarchy: a tree with no header says so with NO_ROOT_WORD
|
|
137
137
|
if (settings.root_word_offset != NO_ROOT_WORD) {
|
|
138
138
|
atomicStore(&nodes[settings.root_word_offset], 0u);
|
|
139
139
|
}
|
|
@@ -5,8 +5,8 @@ export const BVH_EMIT_WORKGROUP_SIZE: 64;
|
|
|
5
5
|
* `k` (root = 0), leaf `j` at node `(n-1)+j`, `2n-1` nodes in total.
|
|
6
6
|
*
|
|
7
7
|
* Node indices are local to the tree; where node 0 actually lands is `settings.node_word_offset`,
|
|
8
|
-
* so the same kernel writes a
|
|
9
|
-
* arena. Root-at-node-0 is what both
|
|
8
|
+
* so the same kernel writes a tree that owns its buffer and one that is a tenant in a shared
|
|
9
|
+
* arena. Root-at-node-0 is what both want, which is why one kernel can serve them.
|
|
10
10
|
*
|
|
11
11
|
* One dispatch of `n` threads with a tail `if`, which is the canonical LBVH formulation: thread `i`
|
|
12
12
|
* always writes leaf `(n-1)+i`, and threads below `n-1` additionally wire internal node `i`'s two
|
|
@@ -103,7 +103,7 @@ fn main(@builtin(global_invocation_id) gid: vec3<u32>) {
|
|
|
103
103
|
|
|
104
104
|
if (i == 0u) {
|
|
105
105
|
// Constant by construction, but a tree whose format has a root word has consumers that read
|
|
106
|
-
// it. A
|
|
106
|
+
// it. A tree with no header — its root node 0 by convention — says so with NO_ROOT_WORD.
|
|
107
107
|
if (settings.root_word_offset != NO_ROOT_WORD) {
|
|
108
108
|
nodes[settings.root_word_offset] = 0u;
|
|
109
109
|
}
|
|
@@ -124,8 +124,8 @@ fn main(@builtin(global_invocation_id) gid: vec3<u32>) {
|
|
|
124
124
|
* `k` (root = 0), leaf `j` at node `(n-1)+j`, `2n-1` nodes in total.
|
|
125
125
|
*
|
|
126
126
|
* Node indices are local to the tree; where node 0 actually lands is `settings.node_word_offset`,
|
|
127
|
-
* so the same kernel writes a
|
|
128
|
-
* arena. Root-at-node-0 is what both
|
|
127
|
+
* so the same kernel writes a tree that owns its buffer and one that is a tenant in a shared
|
|
128
|
+
* arena. Root-at-node-0 is what both want, which is why one kernel can serve them.
|
|
129
129
|
*
|
|
130
130
|
* One dispatch of `n` threads with a tail `if`, which is the canonical LBVH formulation: thread `i`
|
|
131
131
|
* always writes leaf `(n-1)+i`, and threads below `n-1` additionally wire internal node `i`'s two
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The most nodes a tree over `leaf_count` leaves can have. A node of the tree stands for an internal
|
|
3
|
+
* node of the binary tree it is encoded from, of which there are one fewer than leaves; a tree of
|
|
4
|
+
* one leaf, or none, is still one node.
|
|
5
|
+
*
|
|
6
|
+
* @param {number} leaf_count
|
|
7
|
+
* @returns {number}
|
|
8
|
+
*/
|
|
9
|
+
export function bvh8_tree_node_capacity(leaf_count: number): number;
|
|
10
|
+
/**
|
|
11
|
+
* Bytes that hold any tree over `leaf_count` leaves: the header, as many nodes as such a tree can
|
|
12
|
+
* have, and a payload a leaf, to a whole `vec4<u32>`.
|
|
13
|
+
*
|
|
14
|
+
* @param {number} leaf_count
|
|
15
|
+
* @returns {number}
|
|
16
|
+
*/
|
|
17
|
+
export function bvh8_tree_buffer_size(leaf_count: number): number;
|
|
18
|
+
/**
|
|
19
|
+
* The byte contract of a BVH8 that owns its buffer: a tree over leaves that each carry a payload,
|
|
20
|
+
* as the top-level structure over a scene's instances is.
|
|
21
|
+
*
|
|
22
|
+
* [low.x, low.y, low.z : f32][leaf_count : u32][high.x, high.y, high.z : f32][order_offset : u32]
|
|
23
|
+
* [node 0][node 1] ... BVH8_INODE_STRUCT each, the root first
|
|
24
|
+
* [payload][payload] ... a u32 a leaf, from word `order_offset`
|
|
25
|
+
*
|
|
26
|
+
* The header's box is the box of everything in the tree. A node keeps its slots' boxes and not its
|
|
27
|
+
* own, so the root's has nowhere else to be.
|
|
28
|
+
*
|
|
29
|
+
* A leaf slot of a node holds one leaf, and names it as a run of one: its payload is at
|
|
30
|
+
* `order_offset + base_index_triangle + offset`, the offset in the slot's meta. The payloads of a
|
|
31
|
+
* node's leaf slots sit together there, in slot order.
|
|
32
|
+
*
|
|
33
|
+
* A tree of no leaves is a header that counts none and one node with every slot empty: a walk
|
|
34
|
+
* starts at node 0 without asking, and finds nothing there.
|
|
35
|
+
*
|
|
36
|
+
* Every part is a whole number of `vec4<u32>`, so the buffer binds as `array<vec4<u32>>`: a node is
|
|
37
|
+
* five of them, and `order_offset` a multiple of four.
|
|
38
|
+
*/
|
|
39
|
+
/**
|
|
40
|
+
* Words of header in front of node 0.
|
|
41
|
+
* @type {number}
|
|
42
|
+
*/
|
|
43
|
+
export const BVH8_TREE_HEADER_WORDS: number;
|
|
44
|
+
/**
|
|
45
|
+
* Word of the header the tree's low corner starts at; three floats.
|
|
46
|
+
* @type {number}
|
|
47
|
+
*/
|
|
48
|
+
export const BVH8_TREE_BOUNDS_LOW_WORD: number;
|
|
49
|
+
/**
|
|
50
|
+
* Word of the header that counts the tree's leaves.
|
|
51
|
+
* @type {number}
|
|
52
|
+
*/
|
|
53
|
+
export const BVH8_TREE_LEAF_COUNT_WORD: number;
|
|
54
|
+
/**
|
|
55
|
+
* Word of the header the tree's high corner starts at; three floats.
|
|
56
|
+
* @type {number}
|
|
57
|
+
*/
|
|
58
|
+
export const BVH8_TREE_BOUNDS_HIGH_WORD: number;
|
|
59
|
+
/**
|
|
60
|
+
* Word of the header that says which word of the buffer the payloads start at.
|
|
61
|
+
* @type {number}
|
|
62
|
+
*/
|
|
63
|
+
export const BVH8_TREE_ORDER_OFFSET_WORD: number;
|
|
64
|
+
/**
|
|
65
|
+
* Words a node takes.
|
|
66
|
+
* @type {number}
|
|
67
|
+
*/
|
|
68
|
+
export const BVH8_TREE_NODE_STRIDE_WORDS: number;
|
|
69
|
+
//# sourceMappingURL=BVH8_TREE_BUFFER_LAYOUT.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BVH8_TREE_BUFFER_LAYOUT.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/gpu_primitive/bvh8/BVH8_TREE_BUFFER_LAYOUT.js"],"names":[],"mappings":"AA6DA;;;;;;;GAOG;AACH,oDAHW,MAAM,GACJ,MAAM,CAMlB;AAED;;;;;;GAMG;AACH,kDAHW,MAAM,GACJ,MAAM,CAQlB;AArFD;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;GAGG;AACH,qCAFU,MAAM,CAEwB;AAExC;;;GAGG;AACH,wCAFU,MAAM,CAE2B;AAE3C;;;GAGG;AACH,wCAFU,MAAM,CAE2B;AAE3C;;;GAGG;AACH,yCAFU,MAAM,CAE4B;AAE5C;;;GAGG;AACH,0CAFU,MAAM,CAE6B;AAE7C;;;GAGG;AACH,0CAFU,MAAM,CAEkF"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { assert } from "../../../../core/assert.js";
|
|
2
|
+
import { BVH8_INODE_STRUCT } from "../../shader/chunk/bvh/bvh8/webgpu/BVH8_INODE_STRUCT.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The byte contract of a BVH8 that owns its buffer: a tree over leaves that each carry a payload,
|
|
6
|
+
* as the top-level structure over a scene's instances is.
|
|
7
|
+
*
|
|
8
|
+
* [low.x, low.y, low.z : f32][leaf_count : u32][high.x, high.y, high.z : f32][order_offset : u32]
|
|
9
|
+
* [node 0][node 1] ... BVH8_INODE_STRUCT each, the root first
|
|
10
|
+
* [payload][payload] ... a u32 a leaf, from word `order_offset`
|
|
11
|
+
*
|
|
12
|
+
* The header's box is the box of everything in the tree. A node keeps its slots' boxes and not its
|
|
13
|
+
* own, so the root's has nowhere else to be.
|
|
14
|
+
*
|
|
15
|
+
* A leaf slot of a node holds one leaf, and names it as a run of one: its payload is at
|
|
16
|
+
* `order_offset + base_index_triangle + offset`, the offset in the slot's meta. The payloads of a
|
|
17
|
+
* node's leaf slots sit together there, in slot order.
|
|
18
|
+
*
|
|
19
|
+
* A tree of no leaves is a header that counts none and one node with every slot empty: a walk
|
|
20
|
+
* starts at node 0 without asking, and finds nothing there.
|
|
21
|
+
*
|
|
22
|
+
* Every part is a whole number of `vec4<u32>`, so the buffer binds as `array<vec4<u32>>`: a node is
|
|
23
|
+
* five of them, and `order_offset` a multiple of four.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Words of header in front of node 0.
|
|
28
|
+
* @type {number}
|
|
29
|
+
*/
|
|
30
|
+
export const BVH8_TREE_HEADER_WORDS = 8;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Word of the header the tree's low corner starts at; three floats.
|
|
34
|
+
* @type {number}
|
|
35
|
+
*/
|
|
36
|
+
export const BVH8_TREE_BOUNDS_LOW_WORD = 0;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Word of the header that counts the tree's leaves.
|
|
40
|
+
* @type {number}
|
|
41
|
+
*/
|
|
42
|
+
export const BVH8_TREE_LEAF_COUNT_WORD = 3;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Word of the header the tree's high corner starts at; three floats.
|
|
46
|
+
* @type {number}
|
|
47
|
+
*/
|
|
48
|
+
export const BVH8_TREE_BOUNDS_HIGH_WORD = 4;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Word of the header that says which word of the buffer the payloads start at.
|
|
52
|
+
* @type {number}
|
|
53
|
+
*/
|
|
54
|
+
export const BVH8_TREE_ORDER_OFFSET_WORD = 7;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Words a node takes.
|
|
58
|
+
* @type {number}
|
|
59
|
+
*/
|
|
60
|
+
export const BVH8_TREE_NODE_STRIDE_WORDS = BVH8_INODE_STRUCT.size / Uint32Array.BYTES_PER_ELEMENT;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The most nodes a tree over `leaf_count` leaves can have. A node of the tree stands for an internal
|
|
64
|
+
* node of the binary tree it is encoded from, of which there are one fewer than leaves; a tree of
|
|
65
|
+
* one leaf, or none, is still one node.
|
|
66
|
+
*
|
|
67
|
+
* @param {number} leaf_count
|
|
68
|
+
* @returns {number}
|
|
69
|
+
*/
|
|
70
|
+
export function bvh8_tree_node_capacity(leaf_count) {
|
|
71
|
+
assert.isNonNegativeInteger(leaf_count, 'leaf_count');
|
|
72
|
+
|
|
73
|
+
return Math.max(1, leaf_count - 1);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Bytes that hold any tree over `leaf_count` leaves: the header, as many nodes as such a tree can
|
|
78
|
+
* have, and a payload a leaf, to a whole `vec4<u32>`.
|
|
79
|
+
*
|
|
80
|
+
* @param {number} leaf_count
|
|
81
|
+
* @returns {number}
|
|
82
|
+
*/
|
|
83
|
+
export function bvh8_tree_buffer_size(leaf_count) {
|
|
84
|
+
const words = BVH8_TREE_HEADER_WORDS
|
|
85
|
+
+ bvh8_tree_node_capacity(leaf_count) * BVH8_TREE_NODE_STRIDE_WORDS
|
|
86
|
+
+ Math.ceil(leaf_count / 4) * 4;
|
|
87
|
+
|
|
88
|
+
return words * Uint32Array.BYTES_PER_ELEMENT;
|
|
89
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encode a binary BVH as a BVH8, three binary levels to a node. The reference for the passes that do
|
|
3
|
+
* it on the GPU: they are held to this, word for word.
|
|
4
|
+
*
|
|
5
|
+
* **Which nodes.** An internal node of the binary tree whose depth is a multiple of three becomes a
|
|
6
|
+
* node of the wide tree; the root is at depth 0. Its children are what lies three levels below it,
|
|
7
|
+
* and the leaves met sooner: at most eight, taken child 1 before child 2 all the way down. One of
|
|
8
|
+
* them that is internal is itself at a depth that is a multiple of three, so it is a node too; one
|
|
9
|
+
* that is a leaf fills a leaf slot. A binary tree that is a single leaf is one node with that leaf
|
|
10
|
+
* in a slot.
|
|
11
|
+
*
|
|
12
|
+
* **Which slots.** A node's children are given its slots by {@link bvh8_assign_slots_greedy}: a
|
|
13
|
+
* child costs a slot the distance its box's centre lies from the node's centre, taken with the
|
|
14
|
+
* slot's signs — the bit of an axis set where the child should lie high on it. The cost is worked
|
|
15
|
+
* in single precision as `(±x + ±y) + ±z`, where an axis's term is the child's `low + high` less the
|
|
16
|
+
* node's. A child whose box is not a number costs nothing a comparison can rank: it takes the lowest
|
|
17
|
+
* slot left once the others have theirs, so that a tree's shape never depends on what its boxes hold.
|
|
18
|
+
*
|
|
19
|
+
* **Where.** Counting a node's child nodes and its leaves, in the order of the binary tree's own
|
|
20
|
+
* node indices: a node's child nodes are the block that starts at one more than the child nodes of
|
|
21
|
+
* every node before it, in slot order; its leaves' payloads are the run that starts at the leaves
|
|
22
|
+
* of every node before it, in slot order. The root is node 0. So a node finds its own place from
|
|
23
|
+
* its parent's block and the slot it has there, with no word from the parent.
|
|
24
|
+
*
|
|
25
|
+
* **Boxes.** A node's box is the binary node's, and its slots are fitted to it by
|
|
26
|
+
* {@link bvh8_node_fit_slots}.
|
|
27
|
+
*
|
|
28
|
+
* @param {Uint32Array} out the BVH8, in the layout of {@link BVH8_TREE_BUFFER_LAYOUT}; at least
|
|
29
|
+
* `bvh8_tree_buffer_size(leaf_count) / 4` words. Words past the tree written are left as they are.
|
|
30
|
+
* @param {Uint32Array} tree the binary tree as u32 words, `[root][node 0][node 1] ...`, in the layout
|
|
31
|
+
* of {@link BVH_BUFFER_LAYOUT}: `2 * leaf_count - 1` nodes, fitted
|
|
32
|
+
* @param {number} leaf_count
|
|
33
|
+
* @returns {number} nodes in the BVH8
|
|
34
|
+
*/
|
|
35
|
+
export function bvh8_encode_from_bvh2(out: Uint32Array, tree: Uint32Array, leaf_count: number): number;
|
|
36
|
+
/**
|
|
37
|
+
* Binary levels a node of the wide tree stands for.
|
|
38
|
+
* @type {number}
|
|
39
|
+
*/
|
|
40
|
+
export const BVH8_ENCODE_LEVELS: number;
|
|
41
|
+
//# sourceMappingURL=bvh8_encode_from_bvh2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bvh8_encode_from_bvh2.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/gpu_primitive/bvh8/bvh8_encode_from_bvh2.js"],"names":[],"mappings":"AAgCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,2CAPW,WAAW,QAEX,WAAW,cAEX,MAAM,GACJ,MAAM,CA2RlB;AAjUD;;;GAGG;AACH,iCAFU,MAAM,CAEoB"}
|