@woosh/meep-engine 2.109.1 → 2.109.3
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/build/meep.cjs +126 -186
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +126 -186
- package/package.json +1 -1
- package/src/core/binary/ctz32.d.ts.map +1 -1
- package/src/core/binary/ctz32.js +12 -11
- package/src/core/binary/reinterpret_int32_as_float32.d.ts +7 -0
- package/src/core/binary/reinterpret_int32_as_float32.d.ts.map +1 -0
- package/src/core/binary/reinterpret_int32_as_float32.js +14 -0
- package/src/core/binary/reverse_bits_uint32.d.ts +8 -0
- package/src/core/binary/reverse_bits_uint32.d.ts.map +1 -0
- package/src/core/binary/reverse_bits_uint32.js +17 -0
- package/src/core/binary/reverse_bits_uint32.spec.d.ts +2 -0
- package/src/core/binary/reverse_bits_uint32.spec.d.ts.map +1 -0
- package/src/core/binary/reverse_bits_uint32.spec.js +18 -0
- package/src/core/bvh2/bvh3/BVH.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/BVH.js +13 -18
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_incremental.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_incremental.js +3 -1
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js +6 -7
- package/src/core/bvh2/bvh3/ebvh_build_hierarchy.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_hierarchy.js +4 -0
- package/src/core/bvh2/bvh3/query/backtracking/bvh_backtracking_query_leaves_ray.d.ts +16 -0
- package/src/core/bvh2/bvh3/query/backtracking/bvh_backtracking_query_leaves_ray.d.ts.map +1 -0
- package/src/core/bvh2/bvh3/query/backtracking/bvh_backtracking_query_leaves_ray.js +130 -0
- package/src/core/bvh2/bvh3/query/bvh_query_leaves_ray_segment.d.ts +18 -0
- package/src/core/bvh2/bvh3/query/bvh_query_leaves_ray_segment.d.ts.map +1 -0
- package/src/core/bvh2/bvh3/query/bvh_query_leaves_ray_segment.js +94 -0
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray_segment.d.ts +18 -0
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray_segment.d.ts.map +1 -0
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray_segment.js +100 -0
- package/src/core/bvh2/bvh3/query/cache/BVH_QUERY_CACHE_SIZE.d.ts +2 -0
- package/src/core/bvh2/bvh3/query/cache/BVH_QUERY_CACHE_SIZE.d.ts.map +1 -0
- package/src/core/bvh2/bvh3/query/cache/BVH_QUERY_CACHE_SIZE.js +1 -0
- package/src/core/bvh2/bvh3/query/cache/bvh_query_cache_hash_v3.d.ts +9 -0
- package/src/core/bvh2/bvh3/query/cache/bvh_query_cache_hash_v3.d.ts.map +1 -0
- package/src/core/bvh2/bvh3/query/cache/bvh_query_cache_hash_v3.js +31 -0
- package/src/core/collection/array/array_quick_sort_by_lookup_map.d.ts +9 -0
- package/src/core/collection/array/array_quick_sort_by_lookup_map.d.ts.map +1 -0
- package/src/core/collection/array/array_quick_sort_by_lookup_map.js +79 -0
- package/src/core/collection/array/array_quick_sort_by_lookup_uint.d.ts +8 -0
- package/src/core/collection/array/array_quick_sort_by_lookup_uint.d.ts.map +1 -0
- package/src/core/collection/array/{array_quick_sort_by_lookup.js → array_quick_sort_by_lookup_uint.js} +1 -1
- package/src/core/collection/array/array_shuffle.js +1 -1
- package/src/core/collection/array/array_swap_one.d.ts.map +1 -1
- package/src/core/collection/array/array_swap_one.js +6 -0
- package/src/core/collection/map/HashMap.js +2 -2
- package/src/core/events/signal/Signal.d.ts.map +1 -1
- package/src/core/events/signal/Signal.js +10 -10
- package/src/core/geom/2d/compute_triangle_area_2d.d.ts.map +1 -1
- package/src/core/geom/2d/compute_triangle_area_2d.js +5 -3
- package/src/core/geom/3d/Ray3.d.ts +6 -0
- package/src/core/geom/3d/Ray3.d.ts.map +1 -1
- package/src/core/geom/3d/Ray3.js +24 -0
- package/src/core/geom/3d/aabb/aabb3_compute_distance_above_plane_min.d.ts +16 -0
- package/src/core/geom/3d/aabb/aabb3_compute_distance_above_plane_min.d.ts.map +1 -0
- package/src/core/geom/3d/aabb/aabb3_compute_distance_above_plane_min.js +29 -0
- package/src/core/geom/3d/aabb/aabb3_from_v3_array_transformed.d.ts +2 -2
- package/src/core/geom/3d/aabb/aabb3_from_v3_array_transformed.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_from_v3_array_transformed.js +6 -6
- package/src/core/geom/3d/aabb/aabb3_intersects_ray_segment.d.ts +21 -0
- package/src/core/geom/3d/aabb/aabb3_intersects_ray_segment.d.ts.map +1 -0
- package/src/core/geom/3d/aabb/aabb3_intersects_ray_segment.js +67 -0
- package/src/core/geom/3d/eulerAnglesFromMatrix.d.ts +2 -2
- package/src/core/geom/3d/eulerAnglesFromMatrix.d.ts.map +1 -1
- package/src/core/geom/3d/eulerAnglesFromMatrix.js +28 -25
- package/src/core/geom/3d/morton/v3_morton_encode_bounded.d.ts +2 -2
- package/src/core/geom/3d/morton/v3_morton_encode_bounded.d.ts.map +1 -1
- package/src/core/geom/3d/morton/v3_morton_encode_bounded.js +1 -1
- package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.d.ts +2 -2
- package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.d.ts.map +1 -1
- package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.js +1 -1
- package/src/core/geom/3d/ray/ray3_interval_array_apply_matrix4.d.ts +11 -0
- package/src/core/geom/3d/ray/ray3_interval_array_apply_matrix4.d.ts.map +1 -0
- package/src/core/geom/3d/ray/ray3_interval_array_apply_matrix4.js +61 -0
- package/src/core/geom/3d/ray/ray3_shift_origin_along_direction.js +2 -2
- package/src/core/geom/3d/sphere/sphere_intersects_ray.js +1 -1
- package/src/core/geom/3d/tetrahedra/tetrahedron_compute_circumsphere.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/tetrahedron_compute_circumsphere.js +24 -188
- package/src/core/geom/3d/tetrahedra/triangle/prototype.js +1 -1
- package/src/core/geom/3d/tetrahedra/visualize_tetrahedral_mesh.d.ts +11 -0
- package/src/core/geom/3d/tetrahedra/visualize_tetrahedral_mesh.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/visualize_tetrahedral_mesh.js +42 -0
- package/src/core/geom/3d/topology/samples/sampleFloodFill.js +2 -2
- package/src/core/geom/3d/topology/tm_face_area.js +2 -2
- package/src/core/geom/3d/triangle/{computeTriangleSurfaceArea.d.ts → compute_triangle_area_3d.d.ts} +2 -2
- package/src/core/geom/3d/triangle/compute_triangle_area_3d.d.ts.map +1 -0
- package/src/core/geom/3d/triangle/{computeTriangleSurfaceArea.js → compute_triangle_area_3d.js} +2 -4
- package/src/core/geom/Quaternion.d.ts.map +1 -1
- package/src/core/geom/Quaternion.js +13 -102
- package/src/core/geom/Quaternion.spec.js +2 -2
- package/src/core/geom/Vector1.d.ts.map +1 -1
- package/src/core/geom/Vector1.js +14 -6
- package/src/core/geom/vec3/v3_array_displace_in_direction.d.ts +14 -0
- package/src/core/geom/vec3/v3_array_displace_in_direction.d.ts.map +1 -0
- package/src/core/geom/vec3/{v3_shift_along_direction.js → v3_array_displace_in_direction.js} +1 -1
- package/src/core/geom/vec3/v3_displace_in_direction.d.ts +7 -7
- package/src/core/geom/vec3/v3_displace_in_direction.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_displace_in_direction.js +20 -17
- package/src/core/geom/vec3/v3_displace_in_direction.spec.d.ts +2 -0
- package/src/core/geom/vec3/v3_displace_in_direction.spec.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_displace_in_direction.spec.js +80 -0
- package/src/core/geom/vec4/v4_length.d.ts +10 -0
- package/src/core/geom/vec4/v4_length.d.ts.map +1 -0
- package/src/core/geom/vec4/v4_length.js +13 -0
- package/src/core/geom/vec4/v4_length_sqr.js +2 -1
- package/src/core/graph/eigen/matrix_eigenvalues_in_place.spec.js +31 -1
- package/src/core/math/FLT_EPSILON_64.d.ts +6 -0
- package/src/core/math/FLT_EPSILON_64.d.ts.map +1 -0
- package/src/core/math/FLT_EPSILON_64.js +5 -0
- package/src/core/math/gaussian.d.ts +2 -2
- package/src/core/math/gaussian.js +2 -2
- package/src/core/math/linalg/README.md +1 -0
- package/src/core/math/linalg/lu_factor_linear_system.d.ts +13 -0
- package/src/core/math/linalg/lu_factor_linear_system.d.ts.map +1 -0
- package/src/core/math/linalg/lu_factor_linear_system.js +112 -0
- package/src/core/math/linalg/lu_solve_linear_system.d.ts +14 -0
- package/src/core/math/linalg/lu_solve_linear_system.d.ts.map +1 -0
- package/src/core/math/linalg/lu_solve_linear_system.js +51 -0
- package/src/core/math/linalg/solve_linear_system.d.ts +14 -0
- package/src/core/math/linalg/solve_linear_system.d.ts.map +1 -0
- package/src/core/math/linalg/solve_linear_system.js +52 -0
- package/src/core/math/linalg/solve_linear_system.spec.d.ts +2 -0
- package/src/core/math/linalg/solve_linear_system.spec.d.ts.map +1 -0
- package/src/core/math/linalg/solve_linear_system.spec.js +70 -0
- package/src/core/math/linalg/solve_linear_system_GEPP_2x2.d.ts +10 -0
- package/src/core/math/linalg/solve_linear_system_GEPP_2x2.d.ts.map +1 -0
- package/src/core/math/linalg/solve_linear_system_GEPP_2x2.js +91 -0
- package/src/core/math/max4.d.ts +10 -0
- package/src/core/math/max4.d.ts.map +1 -0
- package/src/core/math/max4.js +24 -0
- package/src/core/math/min4.d.ts +10 -0
- package/src/core/math/min4.d.ts.map +1 -0
- package/src/core/math/min4.js +23 -0
- package/src/core/math/solveQuadratic.d.ts.map +1 -1
- package/src/core/math/solveQuadratic.js +2 -0
- package/src/core/math/statistics/gaussian_amplitude.d.ts +8 -0
- package/src/core/math/statistics/gaussian_amplitude.d.ts.map +1 -0
- package/src/core/math/statistics/gaussian_amplitude.js +13 -0
- package/src/core/math/statistics/halton_sequence.js +3 -3
- package/src/core/math/statistics/halton_sequence.spec.js +18 -0
- package/src/core/math/statistics/hammersley_sequence.d.ts +9 -0
- package/src/core/math/statistics/hammersley_sequence.d.ts.map +1 -0
- package/src/core/math/statistics/hammersley_sequence.js +25 -0
- package/src/core/math/statistics/hammersley_sequence_2d.d.ts +9 -0
- package/src/core/math/statistics/hammersley_sequence_2d.d.ts.map +1 -0
- package/src/core/math/statistics/hammersley_sequence_2d.js +17 -0
- package/src/core/math/statistics/radical_inverse_VdC_base_2.d.ts +8 -0
- package/src/core/math/statistics/radical_inverse_VdC_base_2.d.ts.map +1 -0
- package/src/core/math/statistics/radical_inverse_VdC_base_2.js +15 -0
- package/src/core/math/statistics/radical_inverse_VdC_base_2.spec.d.ts +2 -0
- package/src/core/math/statistics/radical_inverse_VdC_base_2.spec.d.ts.map +1 -0
- package/src/core/math/statistics/radical_inverse_VdC_base_2.spec.js +9 -0
- package/src/core/model/node-graph/node/NodeInstance.d.ts.map +1 -1
- package/src/core/model/node-graph/node/NodeInstance.js +26 -12
- package/src/core/model/node-graph/node/NodeInstance.spec.d.ts +2 -0
- package/src/core/model/node-graph/node/NodeInstance.spec.d.ts.map +1 -0
- package/src/core/model/node-graph/node/NodeInstance.spec.js +82 -0
- package/src/core/model/node-graph/node/NodeInstancePortReference.d.ts.map +1 -1
- package/src/core/model/node-graph/node/NodeInstancePortReference.js +9 -0
- package/src/core/model/node-graph/node/NodeInstancePortReference.spec.js +20 -0
- package/src/core/model/node-graph/node/Port.d.ts.map +1 -1
- package/src/core/model/node-graph/node/Port.js +5 -12
- package/src/core/model/node-graph/node/PortDirection.d.ts.map +1 -1
- package/src/core/model/node-graph/node/PortDirection.js +7 -1
- package/src/engine/asset/CORS/CrossOriginConfig.d.ts.map +1 -1
- package/src/engine/asset/CORS/CrossOriginConfig.js +6 -4
- package/src/engine/graphics/geometry/buffered/computeBufferAttributeHash.d.ts.map +1 -1
- package/src/engine/graphics/geometry/buffered/computeBufferAttributeHash.js +9 -5
- package/src/engine/graphics/geometry/computeMeshSurfaceArea.js +2 -2
- package/src/engine/graphics/impostors/octahedral/grid/OctahedralUvEncoder.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/grid/OctahedralUvEncoder.js +33 -3
- package/src/engine/graphics/impostors/octahedral/prototypeBaker.js +12 -9
- package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_INFERNO.d.ts +6 -0
- package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_INFERNO.d.ts.map +1 -0
- package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_INFERNO.js +18 -0
- package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_TURBO.d.ts +6 -0
- package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_TURBO.d.ts.map +1 -0
- package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_TURBO.js +266 -0
- package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_VIRIDIS.d.ts +7 -0
- package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_VIRIDIS.d.ts.map +1 -0
- package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_VIRIDIS.js +19 -0
- package/src/engine/graphics/sh3/SH3VisualisationMaterial.js +9 -9
- package/src/engine/graphics/sh3/gi/material/MaterialTransformer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/gi/material/MaterialTransformer.js +0 -2
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts +4 -27
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +36 -158
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.d.ts +13 -0
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.js +63 -0
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts +1 -0
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +25 -1
- package/src/engine/graphics/sh3/lpv/build_probes_for_scene.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/build_probes_for_scene.js +4 -29
- package/src/engine/graphics/sh3/lpv/{LightProbeVolumeSerializationAdapter.d.ts → serialization/LightProbeVolumeSerializationAdapter.d.ts} +2 -2
- package/src/engine/graphics/sh3/lpv/serialization/LightProbeVolumeSerializationAdapter.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/{LightProbeVolumeSerializationAdapter.js → serialization/LightProbeVolumeSerializationAdapter.js} +2 -2
- package/src/engine/graphics/sh3/lpv/sh3_bake_depth.d.ts +13 -0
- package/src/engine/graphics/sh3/lpv/sh3_bake_depth.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/sh3_bake_depth.js +71 -0
- package/src/engine/graphics/sh3/lpv/worker/lpv_build_worker.d.ts +2 -0
- package/src/engine/graphics/sh3/lpv/worker/lpv_build_worker.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/worker/lpv_build_worker.js +38 -0
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.d.ts +1 -7
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.js +34 -148
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.d.ts +13 -9
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.js +75 -55
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts +23 -5
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.js +201 -72
- package/src/engine/graphics/sh3/path_tracer/PathTracer.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_along_ray.d.ts +15 -0
- package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_along_ray.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_along_ray.js +46 -0
- package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_sqr_to_point.d.ts +14 -0
- package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_sqr_to_point.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_sqr_to_point.js +43 -0
- package/src/engine/graphics/sh3/path_tracer/geometry/compute_triangle_group_aabb3.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/{compute_triangle_group_aabb3.js → geometry/compute_triangle_group_aabb3.js} +2 -2
- package/src/engine/graphics/sh3/path_tracer/geometry/construct_ray_hit_from_geometry.d.ts +12 -0
- package/src/engine/graphics/sh3/path_tracer/geometry/construct_ray_hit_from_geometry.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/geometry/construct_ray_hit_from_geometry.js +72 -0
- package/src/engine/graphics/sh3/path_tracer/geometry/sample_triangle_attribute.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/geometry/sort_triangles_by_distance_to_point.d.ts +13 -0
- package/src/engine/graphics/sh3/path_tracer/geometry/sort_triangles_by_distance_to_point.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/geometry/sort_triangles_by_distance_to_point.js +48 -0
- package/src/engine/graphics/sh3/path_tracer/material/StandardMaterial.d.ts +1 -0
- package/src/engine/graphics/sh3/path_tracer/material/StandardMaterial.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/material/StandardMaterial.js +4 -0
- package/src/engine/graphics/sh3/path_tracer/material/StandardTexture.d.ts +1 -0
- package/src/engine/graphics/sh3/path_tracer/material/StandardTexture.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/material/StandardTexture.js +8 -5
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +27 -21
- package/src/engine/graphics/sh3/path_tracer/ray_hit_apply_transform.d.ts +2 -2
- package/src/engine/graphics/sh3/path_tracer/ray_hit_apply_transform.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/ray_hit_apply_transform.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/sampling/getBiasedNormalSample.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/{getBiasedNormalSample.js → sampling/getBiasedNormalSample.js} +1 -1
- package/src/engine/graphics/sh3/path_tracer/sampling/random_in_hemisphere.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/{random_in_hemisphere.js → sampling/random_in_hemisphere.js} +1 -1
- package/src/engine/graphics/sh3/path_tracer/sort_bvh_nodes_by_distance_to_point.d.ts +12 -0
- package/src/engine/graphics/sh3/path_tracer/sort_bvh_nodes_by_distance_to_point.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/sort_bvh_nodes_by_distance_to_point.js +46 -0
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.js +2 -2
- package/src/engine/graphics/sh3/path_tracer/three_object_to_path_traced_scene.d.ts +7 -0
- package/src/engine/graphics/sh3/path_tracer/three_object_to_path_traced_scene.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/three_object_to_path_traced_scene.js +69 -0
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +29 -7
- package/src/engine/graphics/texture/formatToChannelCount.d.ts.map +1 -1
- package/src/engine/graphics/texture/formatToChannelCount.js +14 -1
- package/src/engine/graphics/three/three_object_replace_materials.d.ts +7 -0
- package/src/engine/graphics/three/three_object_replace_materials.d.ts.map +1 -0
- package/src/engine/graphics/three/three_object_replace_materials.js +13 -0
- package/src/core/collection/array/array_quick_sort_by_lookup.d.ts +0 -8
- package/src/core/collection/array/array_quick_sort_by_lookup.d.ts.map +0 -1
- package/src/core/geom/3d/triangle/computeTriangleSurfaceArea.d.ts.map +0 -1
- package/src/core/geom/vec3/v3_shift_along_direction.d.ts +0 -14
- package/src/core/geom/vec3/v3_shift_along_direction.d.ts.map +0 -1
- package/src/engine/graphics/filter/FlipArrayViaCanvas.d.ts +0 -2
- package/src/engine/graphics/filter/FlipArrayViaCanvas.d.ts.map +0 -1
- package/src/engine/graphics/filter/FlipArrayViaCanvas.js +0 -13
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeSerializationAdapter.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/compute_triangle_group_aabb3.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/getBiasedNormalSample.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/random_in_hemisphere.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/sample_triangle_attribute.d.ts.map +0 -1
- /package/src/engine/graphics/sh3/path_tracer/{compute_triangle_group_aabb3.d.ts → geometry/compute_triangle_group_aabb3.d.ts} +0 -0
- /package/src/engine/graphics/sh3/path_tracer/{sample_triangle_attribute.d.ts → geometry/sample_triangle_attribute.d.ts} +0 -0
- /package/src/engine/graphics/sh3/path_tracer/{sample_triangle_attribute.js → geometry/sample_triangle_attribute.js} +0 -0
- /package/src/engine/graphics/sh3/path_tracer/{getBiasedNormalSample.d.ts → sampling/getBiasedNormalSample.d.ts} +0 -0
- /package/src/engine/graphics/sh3/path_tracer/{random_in_hemisphere.d.ts → sampling/random_in_hemisphere.d.ts} +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reverses order of bits in an unsigned 32bit integer
|
|
3
|
+
* @example 1110 would become 0111
|
|
4
|
+
* @param {number} input
|
|
5
|
+
* @returns {number}
|
|
6
|
+
*/
|
|
7
|
+
export function reverse_bits_uint32(input) {
|
|
8
|
+
let x = input;
|
|
9
|
+
|
|
10
|
+
x = ((x << 16) | (x >>> 16))
|
|
11
|
+
x = ((x & 0x55555555) << 1) | ((x & 0xAAAAAAAA) >>> 1)
|
|
12
|
+
x = ((x & 0x33333333) << 2) | ((x & 0xCCCCCCCC) >>> 2)
|
|
13
|
+
x = ((x & 0x0F0F0F0F) << 4) | ((x & 0xF0F0F0F0) >>> 4)
|
|
14
|
+
x = ((x & 0x00FF00FF) << 8) | ((x & 0xFF00FF00) >>> 8)
|
|
15
|
+
|
|
16
|
+
return x
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reverse_bits_uint32.spec.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/reverse_bits_uint32.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { reverse_bits_uint32 } from "./reverse_bits_uint32.js";
|
|
2
|
+
|
|
3
|
+
test("basics", () => {
|
|
4
|
+
|
|
5
|
+
expect(reverse_bits_uint32(1 << 31)).toEqual(1);
|
|
6
|
+
expect(reverse_bits_uint32(1)).toEqual(1 << 31);
|
|
7
|
+
|
|
8
|
+
expect(reverse_bits_uint32(2)).toEqual(1 << 30);
|
|
9
|
+
expect(reverse_bits_uint32(1 << 30)).toEqual(2);
|
|
10
|
+
|
|
11
|
+
expect(reverse_bits_uint32(0b1111)).toEqual(
|
|
12
|
+
(1 << 31) | (1 << 30) | (1 << 29) | (1 << 28)
|
|
13
|
+
);
|
|
14
|
+
expect(reverse_bits_uint32(
|
|
15
|
+
(1 << 31) | (1 << 30) | (1 << 29) | (1 << 28)
|
|
16
|
+
)).toEqual(0b1111);
|
|
17
|
+
|
|
18
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BVH.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/BVH.js"],"names":[],"mappings":"AAQA,8BAA+B;AAC/B,+BAAgC;AAChC,+BAAgC;AAChC,8BAA+B;AAE/B;;;;;GAKG;AACH,+BAFU,MAAM,CAE+B;AAE/C;;;GAGG;AACH,wBAFU,MAAM,CAEoB;AAcpC;;;;;GAKG;AACH,iCAFU,MAAM,CAEqB;AAgBrC;;;;;;GAMG;AACH;IAEI;;;;OAIG;IACH,sBAA2E;IAE3E;;;;OAIG;IACH,uBAAsD;IAEtD;;;;OAIG;IACH,sBAAoD;IAEpD;;;;OAIG;IACH,mBAA8B;IAE9B;;;;OAIG;IACH,eAAW;IAEX;;;;OAIG;IACH,eAAY;IAEZ;;;;OAIG;IACH,uBAAmB;IAEnB;;;;OAIG;IACH,eAAmB;IAEnB;;;OAGG;IACH,mBAEC;IAUD;;;OAGG;IACH,+BAMC;IAlBD;;;OAGG;IACH,4BAEC;IAcD,wBAgBC;IAED;;;;OAIG;IACH,uBAqBC;IAED;;OAEG;IACH,aAIC;IAED;;;OAGG;IACH,iBAFa,MAAM,CAqDlB;IAED;;;;OAIG;IACH,iBAFW,MAAM,QAMhB;IAED;;;;OAIG;IACH,iBAHW,MAAM,GACJ,OAAO,CAOnB;IAED;;;;OAIG;IACH,uBAHW,MAAM,GACJ,MAAM,CAKlB;IAED;;;;OAIG;IACH,uBAHW,MAAM,SACN,MAAM,QAOhB;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CAKlB;IAED;;;;OAIG;IACH,sBAHW,MAAM,UACN,MAAM,QAIhB;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CAKlB;IAED;;;;OAIG;IACH,sBAHW,MAAM,UACN,MAAM,QAIhB;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CAKlB;IAED;;;;OAIG;IACH,sBAHW,MAAM,UACN,MAAM,QAIhB;IAGD;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CAKlB;IAED;;;;OAIG;IACH,oBAHW,MAAM,UACN,MAAM,QAKhB;IAED;;;;OAIG;IACH,kBAHW,MAAM,UACN,MAAM,EAAE,GAAC,YAAY,QAe/B;IAED;;;;OAIG;IACH,kBAHW,MAAM,QACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"BVH.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/BVH.js"],"names":[],"mappings":"AAQA,8BAA+B;AAC/B,+BAAgC;AAChC,+BAAgC;AAChC,8BAA+B;AAE/B;;;;;GAKG;AACH,+BAFU,MAAM,CAE+B;AAE/C;;;GAGG;AACH,wBAFU,MAAM,CAEoB;AAcpC;;;;;GAKG;AACH,iCAFU,MAAM,CAEqB;AAgBrC;;;;;;GAMG;AACH;IAEI;;;;OAIG;IACH,sBAA2E;IAE3E;;;;OAIG;IACH,uBAAsD;IAEtD;;;;OAIG;IACH,sBAAoD;IAEpD;;;;OAIG;IACH,mBAA8B;IAE9B;;;;OAIG;IACH,eAAW;IAEX;;;;OAIG;IACH,eAAY;IAEZ;;;;OAIG;IACH,uBAAmB;IAEnB;;;;OAIG;IACH,eAAmB;IAEnB;;;OAGG;IACH,mBAEC;IAUD;;;OAGG;IACH,+BAMC;IAlBD;;;OAGG;IACH,4BAEC;IAcD,wBAgBC;IAED;;;;OAIG;IACH,uBAqBC;IAED;;OAEG;IACH,aAIC;IAED;;;OAGG;IACH,iBAFa,MAAM,CAqDlB;IAED;;;;OAIG;IACH,iBAFW,MAAM,QAMhB;IAED;;;;OAIG;IACH,iBAHW,MAAM,GACJ,OAAO,CAOnB;IAED;;;;OAIG;IACH,uBAHW,MAAM,GACJ,MAAM,CAKlB;IAED;;;;OAIG;IACH,uBAHW,MAAM,SACN,MAAM,QAOhB;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CAKlB;IAED;;;;OAIG;IACH,sBAHW,MAAM,UACN,MAAM,QAIhB;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CAKlB;IAED;;;;OAIG;IACH,sBAHW,MAAM,UACN,MAAM,QAIhB;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CAKlB;IAED;;;;OAIG;IACH,sBAHW,MAAM,UACN,MAAM,QAIhB;IAGD;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CAKlB;IAED;;;;OAIG;IACH,oBAHW,MAAM,UACN,MAAM,QAKhB;IAED;;;;OAIG;IACH,kBAHW,MAAM,UACN,MAAM,EAAE,GAAC,YAAY,QAe/B;IAED;;;;OAIG;IACH,kBAHW,MAAM,QACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,QAAM,QAsB1C;IAED;;;;OAIG;IACH,mBAHW,MAAM,QACN,MAAM,EAAE,QAWlB;IAED;;;;;;;;;OASG;IACH,4BARW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAmBhB;IAED;;;;OAIG;IACH,0BAHW,MAAM,GACJ,MAAM,CAoBlB;IAED;;;;;OAKG;IACH,wCAJW,MAAM,WACN,MAAM,GACJ,MAAM,CAoClB;IAED;;;;;OAKG;IACH,oCAJW,MAAM,WACN,MAAM,WACN,MAAM,QAwChB;IAED;;;;OAIG;IACH,kBAHW,MAAM,GACJ,IAAI,CA0GhB;IAED;;;;;OAKG;IACH,wBAqBC;IAED;;;;OAIG;IACH,yBA4BC;IAED;;;;OAIG;IACH,kBAHW,MAAM,GACJ,IAAI,CA6ChB;IAED;;;;;;OAMG;IACH,gBAoMC;IAED;;;OAGG;IACH,oBAIC;IAED;;;;OAIG;IACH,yCA8BC;IAED;;;;;OAKG;IACH,+BAJW,MAAM,EAAE,sBACR,MAAM,GACJ,MAAM,CAWlB;IAED;;;;;OAKG;IACH,0BA6BC;IAED;;;;;OAKG;IACH,cAJW,MAAM,KACN,MAAM,GACJ,OAAO,CAsCnB;CACJ"}
|
|
@@ -410,7 +410,7 @@ export class BVH {
|
|
|
410
410
|
/**
|
|
411
411
|
*
|
|
412
412
|
* @param {number} id
|
|
413
|
-
* @param {number[]|ArrayLike<number
|
|
413
|
+
* @param {number[]|ArrayLike<number>|AABB3} aabb
|
|
414
414
|
*/
|
|
415
415
|
node_set_aabb(id, aabb) {
|
|
416
416
|
assert.isNonNegativeInteger(id, 'id');
|
|
@@ -562,27 +562,24 @@ export class BVH {
|
|
|
562
562
|
const float32 = this.__data_float32;
|
|
563
563
|
|
|
564
564
|
const a_x0 = float32[address_a];
|
|
565
|
-
const b_x0 = float32[address_b];
|
|
566
|
-
const x0 = min2(a_x0, b_x0);
|
|
567
|
-
|
|
568
565
|
const a_y0 = float32[address_a + 1];
|
|
569
|
-
const b_y0 = float32[address_b + 1];
|
|
570
|
-
const y0 = min2(a_y0, b_y0);
|
|
571
|
-
|
|
572
566
|
const a_z0 = float32[address_a + 2];
|
|
573
|
-
const b_z0 = float32[address_b + 2];
|
|
574
|
-
const z0 = min2(a_z0, b_z0);
|
|
575
|
-
|
|
576
567
|
const a_x1 = float32[address_a + 3];
|
|
577
|
-
const b_x1 = float32[address_b + 3];
|
|
578
|
-
const x1 = max2(a_x1, b_x1);
|
|
579
|
-
|
|
580
568
|
const a_y1 = float32[address_a + 4];
|
|
581
|
-
const b_y1 = float32[address_b + 4];
|
|
582
|
-
const y1 = max2(a_y1, b_y1);
|
|
583
|
-
|
|
584
569
|
const a_z1 = float32[address_a + 5];
|
|
570
|
+
|
|
571
|
+
const b_x0 = float32[address_b];
|
|
572
|
+
const b_y0 = float32[address_b + 1];
|
|
573
|
+
const b_z0 = float32[address_b + 2];
|
|
574
|
+
const b_x1 = float32[address_b + 3];
|
|
575
|
+
const b_y1 = float32[address_b + 4];
|
|
585
576
|
const b_z1 = float32[address_b + 5];
|
|
577
|
+
|
|
578
|
+
const x0 = min2(a_x0, b_x0);
|
|
579
|
+
const y0 = min2(a_y0, b_y0);
|
|
580
|
+
const z0 = min2(a_z0, b_z0);
|
|
581
|
+
const x1 = max2(a_x1, b_x1);
|
|
582
|
+
const y1 = max2(a_y1, b_y1);
|
|
586
583
|
const z1 = max2(a_z1, b_z1);
|
|
587
584
|
|
|
588
585
|
|
|
@@ -718,8 +715,6 @@ export class BVH {
|
|
|
718
715
|
const uint32 = this.__data_uint32;
|
|
719
716
|
|
|
720
717
|
do {
|
|
721
|
-
index = this.balance(index);
|
|
722
|
-
|
|
723
718
|
const address = index * ELEMENT_WORD_COUNT;
|
|
724
719
|
|
|
725
720
|
const child1 = uint32[address + COLUMN_CHILD_1];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ebvh_build_for_geometry_incremental.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/ebvh_build_for_geometry_incremental.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ebvh_build_for_geometry_incremental.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/ebvh_build_for_geometry_incremental.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,2EAJW,MAAM,EAAE,GAAC,YAAY,mBACrB,MAAM,EAAE,GAAC,YAAY,eACrB,MAAM,QA8BhB"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
compute_triangle_group_aabb3
|
|
3
|
+
} from "../../../engine/graphics/sh3/path_tracer/geometry/compute_triangle_group_aabb3.js";
|
|
2
4
|
import { min2 } from "../../math/min2.js";
|
|
3
5
|
|
|
4
6
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ebvh_build_for_geometry_morton.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js"],"names":[],"mappings":"AAWA;;;;;;;;GAQG;AACH,sEALW,MAAM,EAAE,GAAC,YAAY,kBACrB,MAAM,EAAE,GAAC,YAAY,iBACrB,WAAW,WACX,KAAK,
|
|
1
|
+
{"version":3,"file":"ebvh_build_for_geometry_morton.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js"],"names":[],"mappings":"AAWA;;;;;;;;GAQG;AACH,sEALW,MAAM,EAAE,GAAC,YAAY,kBACrB,MAAM,EAAE,GAAC,YAAY,iBACrB,WAAW,WACX,KAAK,QA0Ff;sBAzGqB,6BAA6B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assert } from "../../assert.js";
|
|
2
2
|
import { array_copy } from "../../collection/array/array_copy.js";
|
|
3
|
-
import {
|
|
3
|
+
import { array_quick_sort_by_lookup_uint } from "../../collection/array/array_quick_sort_by_lookup_uint.js";
|
|
4
4
|
import { AABB3 } from "../../geom/3d/aabb/AABB3.js";
|
|
5
5
|
import { aabb3_from_v3_array } from "../../geom/3d/aabb/aabb3_from_v3_array.js";
|
|
6
6
|
import { aabb3_compute_from_triangle } from "../../geom/3d/aabb3_compute_from_triangle.js";
|
|
@@ -73,7 +73,7 @@ export function ebvh_build_for_geometry_morton(
|
|
|
73
73
|
build_triangle_morton_codes(morton_codes, tri_count, index_array, position_array, bounds.x0, bounds.y0, bounds.z0, bounds.x1, bounds.y1, bounds.z1);
|
|
74
74
|
|
|
75
75
|
// sort leaves by morton codes
|
|
76
|
-
|
|
76
|
+
array_quick_sort_by_lookup_uint(sorted_triangle_order, morton_codes, 0, tri_count - 1);
|
|
77
77
|
|
|
78
78
|
// assign leaves
|
|
79
79
|
for (let i = 0; i < tri_count; i++) {
|
|
@@ -81,11 +81,6 @@ export function ebvh_build_for_geometry_morton(
|
|
|
81
81
|
|
|
82
82
|
const triangle_index = sorted_triangle_order[i];
|
|
83
83
|
|
|
84
|
-
bvh.node_set_child1(node, NULL_NODE); //mark node as a leaf
|
|
85
|
-
bvh.node_set_user_data(node, triangle_index);
|
|
86
|
-
|
|
87
|
-
bvh.node_set_height(node, 0);
|
|
88
|
-
|
|
89
84
|
const triangle_index3 = triangle_index * 3;
|
|
90
85
|
|
|
91
86
|
const a_index = index_array[triangle_index3];
|
|
@@ -99,6 +94,10 @@ export function ebvh_build_for_geometry_morton(
|
|
|
99
94
|
position_array, a_index, b_index, c_index
|
|
100
95
|
);
|
|
101
96
|
|
|
97
|
+
bvh.node_set_child1(node, NULL_NODE); //mark node as a leaf
|
|
98
|
+
bvh.node_set_user_data(node, triangle_index);
|
|
99
|
+
|
|
100
|
+
bvh.node_set_height(node, 0);
|
|
102
101
|
}
|
|
103
102
|
|
|
104
103
|
// record newly generated nodes as "unprocessed"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ebvh_build_hierarchy.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/ebvh_build_hierarchy.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ebvh_build_hierarchy.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/ebvh_build_hierarchy.js"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AACH,kEANW,MAAM,EAAE,GAAC,WAAW,oBACpB,MAAM,aACN,MAAM,EAAE,GAAC,WAAW,oBACpB,MAAM,GACJ,MAAM,CA4DlB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { assert } from "../../assert.js";
|
|
2
2
|
import { max2 } from "../../math/max2.js";
|
|
3
|
+
import { NULL_NODE } from "./BVH.js";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Given a set of leaves, build intermediate node hierarchy on top, all the way up to the root
|
|
@@ -66,5 +67,8 @@ export function ebvh_build_hierarchy(
|
|
|
66
67
|
unprocessed_node_count = added_nodes;
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
// set the root to have no parent
|
|
71
|
+
bvh.node_set_parent(unprocessed_nodes[0], NULL_NODE);
|
|
72
|
+
|
|
69
73
|
return unprocessed_nodes[0];
|
|
70
74
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Traverses bvh starting from a given node, but can back-track all the way up to the root
|
|
3
|
+
* @param {BVH} bvh
|
|
4
|
+
* @param {number} starting_node
|
|
5
|
+
* @param {number[]} result
|
|
6
|
+
* @param {number} result_offset
|
|
7
|
+
* @param {number} origin_x
|
|
8
|
+
* @param {number} origin_y
|
|
9
|
+
* @param {number} origin_z
|
|
10
|
+
* @param {number} direction_x
|
|
11
|
+
* @param {number} direction_y
|
|
12
|
+
* @param {number} direction_z
|
|
13
|
+
* @returns {number}
|
|
14
|
+
*/
|
|
15
|
+
export function bvh_backtracking_query_leaves_ray(bvh: BVH, starting_node: number, result: number[], result_offset: number, origin_x: number, origin_y: number, origin_z: number, direction_x: number, direction_y: number, direction_z: number): number;
|
|
16
|
+
//# sourceMappingURL=bvh_backtracking_query_leaves_ray.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bvh_backtracking_query_leaves_ray.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/bvh2/bvh3/query/backtracking/bvh_backtracking_query_leaves_ray.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;GAaG;AACH,2EAXW,MAAM,UACN,MAAM,EAAE,iBACR,MAAM,YACN,MAAM,YACN,MAAM,YACN,MAAM,eACN,MAAM,eACN,MAAM,eACN,MAAM,GACJ,MAAM,CA6GlB"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { assert } from "../../../../assert.js";
|
|
2
|
+
import { SCRATCH_UINT32_TRAVERSAL_STACK } from "../../../../collection/SCRATCH_UINT32_TRAVERSAL_STACK.js";
|
|
3
|
+
import { aabb3_intersects_ray } from "../../../../geom/3d/aabb/aabb3_intersects_ray.js";
|
|
4
|
+
import { COLUMN_CHILD_1, COLUMN_CHILD_2, ELEMENT_WORD_COUNT, NULL_NODE } from "../../BVH.js";
|
|
5
|
+
|
|
6
|
+
const stack = SCRATCH_UINT32_TRAVERSAL_STACK;
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Traverses bvh starting from a given node, but can back-track all the way up to the root
|
|
11
|
+
* @param {BVH} bvh
|
|
12
|
+
* @param {number} starting_node
|
|
13
|
+
* @param {number[]} result
|
|
14
|
+
* @param {number} result_offset
|
|
15
|
+
* @param {number} origin_x
|
|
16
|
+
* @param {number} origin_y
|
|
17
|
+
* @param {number} origin_z
|
|
18
|
+
* @param {number} direction_x
|
|
19
|
+
* @param {number} direction_y
|
|
20
|
+
* @param {number} direction_z
|
|
21
|
+
* @returns {number}
|
|
22
|
+
*/
|
|
23
|
+
export function bvh_backtracking_query_leaves_ray(
|
|
24
|
+
bvh, starting_node,
|
|
25
|
+
result, result_offset,
|
|
26
|
+
origin_x, origin_y, origin_z,
|
|
27
|
+
direction_x, direction_y, direction_z
|
|
28
|
+
) {
|
|
29
|
+
|
|
30
|
+
assert.isNonNegativeInteger(starting_node, 'starting_node');
|
|
31
|
+
|
|
32
|
+
/*
|
|
33
|
+
For performance, we bind data directly to avoid extra copies required to read out AABB
|
|
34
|
+
*/
|
|
35
|
+
const float32 = bvh.__data_float32;
|
|
36
|
+
const uint32 = bvh.__data_uint32;
|
|
37
|
+
|
|
38
|
+
let result_cursor = result_offset;
|
|
39
|
+
|
|
40
|
+
let came_from = NULL_NODE;
|
|
41
|
+
|
|
42
|
+
// starting point
|
|
43
|
+
let entry = starting_node;
|
|
44
|
+
|
|
45
|
+
do {
|
|
46
|
+
|
|
47
|
+
const address = entry * ELEMENT_WORD_COUNT;
|
|
48
|
+
|
|
49
|
+
const intersects = aabb3_intersects_ray(
|
|
50
|
+
float32[address], float32[address + 1], float32[address + 2],
|
|
51
|
+
float32[address + 3], float32[address + 4], float32[address + 5],
|
|
52
|
+
origin_x, origin_y, origin_z,
|
|
53
|
+
direction_x, direction_y, direction_z
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
*
|
|
58
|
+
* @type {number}
|
|
59
|
+
*/
|
|
60
|
+
const stack_top = stack.pointer;
|
|
61
|
+
|
|
62
|
+
if (intersects) {
|
|
63
|
+
const child1 = bvh.node_get_child1(entry);
|
|
64
|
+
|
|
65
|
+
if (child1 === NULL_NODE) {
|
|
66
|
+
// leaf node
|
|
67
|
+
result[result_cursor++] = entry;
|
|
68
|
+
} else {
|
|
69
|
+
|
|
70
|
+
const child2 = bvh.node_get_child2(entry);
|
|
71
|
+
|
|
72
|
+
if (came_from !== child2) {
|
|
73
|
+
stack[stack.pointer++] = child2;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (came_from !== child1) {
|
|
77
|
+
stack[stack.pointer++] = child1;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
while (stack.pointer > stack_top) {
|
|
85
|
+
stack.pointer--;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
*
|
|
89
|
+
* @type {number}
|
|
90
|
+
*/
|
|
91
|
+
const node = stack[stack.pointer];
|
|
92
|
+
|
|
93
|
+
const address = node * ELEMENT_WORD_COUNT;
|
|
94
|
+
|
|
95
|
+
// test node against the ray
|
|
96
|
+
const intersects = aabb3_intersects_ray(
|
|
97
|
+
float32[address], float32[address + 1], float32[address + 2],
|
|
98
|
+
float32[address + 3], float32[address + 4], float32[address + 5],
|
|
99
|
+
origin_x, origin_y, origin_z,
|
|
100
|
+
direction_x, direction_y, direction_z
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
if (!intersects) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// get fist child to check if this is a leaf node or not
|
|
108
|
+
const child_1 = uint32[address + COLUMN_CHILD_1];
|
|
109
|
+
|
|
110
|
+
if (child_1 !== NULL_NODE) {
|
|
111
|
+
|
|
112
|
+
// this is not a leaf node, push children onto traversal stack
|
|
113
|
+
stack[stack.pointer++] = uint32[address + COLUMN_CHILD_2];
|
|
114
|
+
stack[stack.pointer++] = child_1;
|
|
115
|
+
|
|
116
|
+
} else {
|
|
117
|
+
// leaf node
|
|
118
|
+
|
|
119
|
+
result[result_cursor++] = node;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// backtrack
|
|
124
|
+
came_from = entry;
|
|
125
|
+
entry = bvh.node_get_parent(entry);
|
|
126
|
+
|
|
127
|
+
} while (entry !== NULL_NODE);
|
|
128
|
+
|
|
129
|
+
return result_cursor - result_offset;
|
|
130
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {BVH} bvh
|
|
4
|
+
* @param {number} root
|
|
5
|
+
* @param {number[]} result
|
|
6
|
+
* @param {number} result_offset
|
|
7
|
+
* @param {number} origin_x
|
|
8
|
+
* @param {number} origin_y
|
|
9
|
+
* @param {number} origin_z
|
|
10
|
+
* @param {number} direction_x
|
|
11
|
+
* @param {number} direction_y
|
|
12
|
+
* @param {number} direction_z
|
|
13
|
+
* @param {number} t_min
|
|
14
|
+
* @param {number} t_max
|
|
15
|
+
* @returns {number}
|
|
16
|
+
*/
|
|
17
|
+
export function bvh_query_leaves_ray_segment(bvh: BVH, root: number, result: number[], result_offset: number, origin_x: number, origin_y: number, origin_z: number, direction_x: number, direction_y: number, direction_z: number, t_min: number, t_max: number): number;
|
|
18
|
+
//# sourceMappingURL=bvh_query_leaves_ray_segment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bvh_query_leaves_ray_segment.d.ts","sourceRoot":"","sources":["../../../../../../src/core/bvh2/bvh3/query/bvh_query_leaves_ray_segment.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;GAeG;AACH,6DAbW,MAAM,UACN,MAAM,EAAE,iBACR,MAAM,YACN,MAAM,YACN,MAAM,YACN,MAAM,eACN,MAAM,eACN,MAAM,eACN,MAAM,SACN,MAAM,SACN,MAAM,GACJ,MAAM,CAwElB"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { SCRATCH_UINT32_TRAVERSAL_STACK } from "../../../collection/SCRATCH_UINT32_TRAVERSAL_STACK.js";
|
|
2
|
+
import { aabb3_intersects_ray_segment } from "../../../geom/3d/aabb/aabb3_intersects_ray_segment.js";
|
|
3
|
+
import { COLUMN_CHILD_1, COLUMN_CHILD_2, ELEMENT_WORD_COUNT, NULL_NODE } from "../BVH.js";
|
|
4
|
+
|
|
5
|
+
const stack = SCRATCH_UINT32_TRAVERSAL_STACK;
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param {BVH} bvh
|
|
11
|
+
* @param {number} root
|
|
12
|
+
* @param {number[]} result
|
|
13
|
+
* @param {number} result_offset
|
|
14
|
+
* @param {number} origin_x
|
|
15
|
+
* @param {number} origin_y
|
|
16
|
+
* @param {number} origin_z
|
|
17
|
+
* @param {number} direction_x
|
|
18
|
+
* @param {number} direction_y
|
|
19
|
+
* @param {number} direction_z
|
|
20
|
+
* @param {number} t_min
|
|
21
|
+
* @param {number} t_max
|
|
22
|
+
* @returns {number}
|
|
23
|
+
*/
|
|
24
|
+
export function bvh_query_leaves_ray_segment(
|
|
25
|
+
bvh, root,
|
|
26
|
+
result, result_offset,
|
|
27
|
+
origin_x, origin_y, origin_z,
|
|
28
|
+
direction_x, direction_y, direction_z,
|
|
29
|
+
t_min, t_max
|
|
30
|
+
) {
|
|
31
|
+
|
|
32
|
+
if (root === NULL_NODE) {
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @type {number}
|
|
40
|
+
*/
|
|
41
|
+
const stack_top = stack.pointer++;
|
|
42
|
+
|
|
43
|
+
stack[stack_top] = root;
|
|
44
|
+
|
|
45
|
+
let result_cursor = result_offset;
|
|
46
|
+
|
|
47
|
+
/*
|
|
48
|
+
For performance, we bind data directly to avoid extra copies required to read out AABB
|
|
49
|
+
*/
|
|
50
|
+
const float32 = bvh.__data_float32;
|
|
51
|
+
const uint32 = bvh.__data_uint32;
|
|
52
|
+
|
|
53
|
+
do {
|
|
54
|
+
stack.pointer--;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
*
|
|
58
|
+
* @type {number}
|
|
59
|
+
*/
|
|
60
|
+
const node = stack[stack.pointer];
|
|
61
|
+
|
|
62
|
+
const address = node * ELEMENT_WORD_COUNT;
|
|
63
|
+
|
|
64
|
+
// test node against the ray
|
|
65
|
+
const intersects = aabb3_intersects_ray_segment(
|
|
66
|
+
float32[address], float32[address + 1], float32[address + 2],
|
|
67
|
+
float32[address + 3], float32[address + 4], float32[address + 5],
|
|
68
|
+
origin_x, origin_y, origin_z,
|
|
69
|
+
direction_x, direction_y, direction_z,
|
|
70
|
+
t_min, t_max
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
if (!intersects) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// get fist child to check if this is a leaf node or not
|
|
78
|
+
const child_1 = uint32[address + COLUMN_CHILD_1];
|
|
79
|
+
|
|
80
|
+
if (child_1 !== NULL_NODE) {
|
|
81
|
+
|
|
82
|
+
// this is not a leaf node, push children onto traversal stack
|
|
83
|
+
stack[stack.pointer++] = uint32[address + COLUMN_CHILD_2];
|
|
84
|
+
stack[stack.pointer++] = child_1;
|
|
85
|
+
|
|
86
|
+
} else {
|
|
87
|
+
// leaf node
|
|
88
|
+
|
|
89
|
+
result[result_cursor++] = node;
|
|
90
|
+
}
|
|
91
|
+
} while (stack.pointer > stack_top);
|
|
92
|
+
|
|
93
|
+
return result_cursor - result_offset;
|
|
94
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {BVH} bvh
|
|
4
|
+
* @param {number} root
|
|
5
|
+
* @param {number[]} result
|
|
6
|
+
* @param {number} result_offset
|
|
7
|
+
* @param {number} origin_x
|
|
8
|
+
* @param {number} origin_y
|
|
9
|
+
* @param {number} origin_z
|
|
10
|
+
* @param {number} direction_x
|
|
11
|
+
* @param {number} direction_y
|
|
12
|
+
* @param {number} direction_z
|
|
13
|
+
* @param {number} t_min
|
|
14
|
+
* @param {number} t_max
|
|
15
|
+
* @returns {number}
|
|
16
|
+
*/
|
|
17
|
+
export function bvh_query_user_data_ray_segment(bvh: BVH, root: number, result: number[], result_offset: number, origin_x: number, origin_y: number, origin_z: number, direction_x: number, direction_y: number, direction_z: number, t_min: number, t_max: number): number;
|
|
18
|
+
//# sourceMappingURL=bvh_query_user_data_ray_segment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bvh_query_user_data_ray_segment.d.ts","sourceRoot":"","sources":["../../../../../../src/core/bvh2/bvh3/query/bvh_query_user_data_ray_segment.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;GAeG;AACH,gEAbW,MAAM,UACN,MAAM,EAAE,iBACR,MAAM,YACN,MAAM,YACN,MAAM,YACN,MAAM,eACN,MAAM,eACN,MAAM,eACN,MAAM,SACN,MAAM,SACN,MAAM,GACJ,MAAM,CA+ElB"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { SCRATCH_UINT32_TRAVERSAL_STACK } from "../../../collection/SCRATCH_UINT32_TRAVERSAL_STACK.js";
|
|
2
|
+
import { aabb3_intersects_ray_segment } from "../../../geom/3d/aabb/aabb3_intersects_ray_segment.js";
|
|
3
|
+
import { COLUMN_CHILD_1, COLUMN_CHILD_2, COLUMN_USER_DATA, ELEMENT_WORD_COUNT, NULL_NODE } from "../BVH.js";
|
|
4
|
+
|
|
5
|
+
const stack = SCRATCH_UINT32_TRAVERSAL_STACK;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {BVH} bvh
|
|
10
|
+
* @param {number} root
|
|
11
|
+
* @param {number[]} result
|
|
12
|
+
* @param {number} result_offset
|
|
13
|
+
* @param {number} origin_x
|
|
14
|
+
* @param {number} origin_y
|
|
15
|
+
* @param {number} origin_z
|
|
16
|
+
* @param {number} direction_x
|
|
17
|
+
* @param {number} direction_y
|
|
18
|
+
* @param {number} direction_z
|
|
19
|
+
* @param {number} t_min
|
|
20
|
+
* @param {number} t_max
|
|
21
|
+
* @returns {number}
|
|
22
|
+
*/
|
|
23
|
+
export function bvh_query_user_data_ray_segment(
|
|
24
|
+
bvh, root,
|
|
25
|
+
result, result_offset,
|
|
26
|
+
origin_x, origin_y, origin_z,
|
|
27
|
+
direction_x, direction_y, direction_z,
|
|
28
|
+
t_min, t_max
|
|
29
|
+
) {
|
|
30
|
+
|
|
31
|
+
if (root === NULL_NODE) {
|
|
32
|
+
return 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Move stack pointer to local variable scope to avoid de-referencing inside the loop
|
|
37
|
+
* @type {number}
|
|
38
|
+
*/
|
|
39
|
+
let pointer = stack.pointer;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* @type {number}
|
|
44
|
+
*/
|
|
45
|
+
const stack_top = pointer;
|
|
46
|
+
|
|
47
|
+
stack[pointer++] = root;
|
|
48
|
+
|
|
49
|
+
let result_cursor = result_offset;
|
|
50
|
+
|
|
51
|
+
/*
|
|
52
|
+
For performance, we bind data directly to avoid extra copies required to read out AABB
|
|
53
|
+
*/
|
|
54
|
+
const float32 = bvh.__data_float32;
|
|
55
|
+
const uint32 = bvh.__data_uint32;
|
|
56
|
+
|
|
57
|
+
do {
|
|
58
|
+
--pointer;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
* @type {number}
|
|
63
|
+
*/
|
|
64
|
+
const node = stack[pointer];
|
|
65
|
+
|
|
66
|
+
const address = node * ELEMENT_WORD_COUNT;
|
|
67
|
+
|
|
68
|
+
// test node against the ray
|
|
69
|
+
const intersects = aabb3_intersects_ray_segment(
|
|
70
|
+
float32[address], float32[address + 1], float32[address + 2],
|
|
71
|
+
float32[address + 3], float32[address + 4], float32[address + 5],
|
|
72
|
+
origin_x, origin_y, origin_z,
|
|
73
|
+
direction_x, direction_y, direction_z,
|
|
74
|
+
t_min, t_max
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
if (!intersects) {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// get fist child to check if this is a leaf node or not
|
|
82
|
+
const child_1 = uint32[address + COLUMN_CHILD_1];
|
|
83
|
+
|
|
84
|
+
if (child_1 !== NULL_NODE) {
|
|
85
|
+
|
|
86
|
+
// this is not a leaf node, push children onto traversal stack
|
|
87
|
+
const child_2 = uint32[address + COLUMN_CHILD_2];
|
|
88
|
+
|
|
89
|
+
stack[pointer++] = child_2;
|
|
90
|
+
stack[pointer++] = child_1;
|
|
91
|
+
|
|
92
|
+
} else {
|
|
93
|
+
// leaf node
|
|
94
|
+
|
|
95
|
+
result[result_cursor++] = uint32[address + COLUMN_USER_DATA];
|
|
96
|
+
}
|
|
97
|
+
} while (pointer > stack_top);
|
|
98
|
+
|
|
99
|
+
return result_cursor - result_offset;
|
|
100
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BVH_QUERY_CACHE_SIZE.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/bvh2/bvh3/query/cache/BVH_QUERY_CACHE_SIZE.js"],"names":[],"mappings":"AAAA,0CAA0C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const BVH_QUERY_CACHE_SIZE = 2**12;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bvh_query_cache_hash_v3.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/bvh2/bvh3/query/cache/bvh_query_cache_hash_v3.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,2CALW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CAuBlB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BVH_QUERY_CACHE_SIZE } from "./BVH_QUERY_CACHE_SIZE.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {number} x
|
|
6
|
+
* @param {number} y
|
|
7
|
+
* @param {number} z
|
|
8
|
+
* @returns {number}
|
|
9
|
+
*/
|
|
10
|
+
export function bvh_query_cache_hash_v3(x, y, z) {
|
|
11
|
+
|
|
12
|
+
//
|
|
13
|
+
// const i0 = computeHashFloat(x);
|
|
14
|
+
// const i1 = computeHashFloat(y);
|
|
15
|
+
// const i2 = computeHashFloat(z);
|
|
16
|
+
//
|
|
17
|
+
// const key = ((i0 * 0xB5297A4D) ^ (i1 * 0x68E31DA4) ^ (i2 * 0x1B56C4E9))
|
|
18
|
+
// & (BVH_QUERY_CACHE_SIZE - 1);
|
|
19
|
+
|
|
20
|
+
const s = 16;
|
|
21
|
+
|
|
22
|
+
const i0 = x*s;
|
|
23
|
+
const i1 = y*s;
|
|
24
|
+
const i2 = z*s;
|
|
25
|
+
|
|
26
|
+
const key = ((i0 * 73856093) ^ (i1 * 19349663) ^ (i2 * 83492791))
|
|
27
|
+
& (BVH_QUERY_CACHE_SIZE - 1);
|
|
28
|
+
|
|
29
|
+
// convert to unsigned
|
|
30
|
+
return key >>> 0;
|
|
31
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @template T
|
|
3
|
+
* @param {T[]} data
|
|
4
|
+
* @param {Map<T,number>} lookup
|
|
5
|
+
* @param {number} start
|
|
6
|
+
* @param {number} end
|
|
7
|
+
*/
|
|
8
|
+
export function array_quick_sort_by_lookup_map<T>(data: T[], lookup: Map<T, number>, start: number, end: number): void;
|
|
9
|
+
//# sourceMappingURL=array_quick_sort_by_lookup_map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array_quick_sort_by_lookup_map.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_quick_sort_by_lookup_map.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,4FAHW,MAAM,OACN,MAAM,QAqEhB"}
|