@woosh/meep-engine 2.109.1 → 2.109.2
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 +122 -186
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +122 -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/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/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_overlaps_ray_segment.d.ts +11 -0
- package/src/core/geom/3d/aabb/aabb3_overlaps_ray_segment.d.ts.map +1 -0
- package/src/core/geom/3d/aabb/aabb3_overlaps_ray_segment.js +61 -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_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/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/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 +9 -7
- 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 +58 -147
- 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 +74 -54
- 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 +211 -59
- 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 +24 -18
- 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,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 @@
|
|
|
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"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { SCRATCH_UINT32_TRAVERSAL_STACK } from "../SCRATCH_UINT32_TRAVERSAL_STACK.js";
|
|
2
|
+
|
|
3
|
+
const stack = SCRATCH_UINT32_TRAVERSAL_STACK;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @template T
|
|
7
|
+
* @param {T[]} data
|
|
8
|
+
* @param {Map<T,number>} lookup
|
|
9
|
+
* @param {number} start
|
|
10
|
+
* @param {number} end
|
|
11
|
+
*/
|
|
12
|
+
export function array_quick_sort_by_lookup_map(
|
|
13
|
+
data,
|
|
14
|
+
lookup,
|
|
15
|
+
start, end
|
|
16
|
+
) {
|
|
17
|
+
if (start >= end) {
|
|
18
|
+
// section of 0 size, nothing to sort
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const stack_frame = start.pointer;
|
|
23
|
+
let stackPointer = stack_frame;
|
|
24
|
+
|
|
25
|
+
let i, j;
|
|
26
|
+
|
|
27
|
+
stack[stackPointer++] = start;
|
|
28
|
+
stack[stackPointer++] = end;
|
|
29
|
+
|
|
30
|
+
while (stackPointer > stack_frame) {
|
|
31
|
+
stackPointer -= 2;
|
|
32
|
+
|
|
33
|
+
const right = stack[stackPointer + 1];
|
|
34
|
+
const left = stack[stackPointer];
|
|
35
|
+
|
|
36
|
+
i = left;
|
|
37
|
+
j = right;
|
|
38
|
+
|
|
39
|
+
const pivotIndex = (left + right) >> 1;
|
|
40
|
+
|
|
41
|
+
const pivot = data[pivotIndex];
|
|
42
|
+
const pivot_score = lookup.get(pivot);
|
|
43
|
+
|
|
44
|
+
/* partition */
|
|
45
|
+
while (i <= j) {
|
|
46
|
+
while (lookup.get(data[i]) < pivot_score) {
|
|
47
|
+
i++;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
while (lookup.get(data[j]) > pivot_score) {
|
|
51
|
+
j--;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (i <= j) {
|
|
55
|
+
|
|
56
|
+
if (i !== j) {
|
|
57
|
+
//do swap
|
|
58
|
+
const tmp = data[i];
|
|
59
|
+
data[i] = data[j];
|
|
60
|
+
data[j] = tmp;
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
i++;
|
|
65
|
+
j--;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* recursion */
|
|
70
|
+
if (left < j) {
|
|
71
|
+
stack[stackPointer++] = left;
|
|
72
|
+
stack[stackPointer++] = j;
|
|
73
|
+
}
|
|
74
|
+
if (i < right) {
|
|
75
|
+
stack[stackPointer++] = i;
|
|
76
|
+
stack[stackPointer++] = right;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {number[]|Uint32Array} data
|
|
3
|
+
* @param {number[]|Uint32Array} lookup
|
|
4
|
+
* @param {number} start
|
|
5
|
+
* @param {number} end
|
|
6
|
+
*/
|
|
7
|
+
export function array_quick_sort_by_lookup_uint(data: number[] | Uint32Array, lookup: number[] | Uint32Array, start: number, end: number): void;
|
|
8
|
+
//# sourceMappingURL=array_quick_sort_by_lookup_uint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array_quick_sort_by_lookup_uint.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_quick_sort_by_lookup_uint.js"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,sDALW,MAAM,EAAE,GAAC,WAAW,UACpB,MAAM,EAAE,GAAC,WAAW,SACpB,MAAM,OACN,MAAM,QAqEhB"}
|
|
@@ -10,7 +10,7 @@ import { array_swap_one } from "./array_swap_one.js";
|
|
|
10
10
|
export function array_shuffle(random, array) {
|
|
11
11
|
const n = array.length;
|
|
12
12
|
|
|
13
|
-
for (let source_index = 0; source_index < n; source_index
|
|
13
|
+
for (let source_index = 0; source_index < n; ++source_index) {
|
|
14
14
|
const target_index = randomIntegerBetween(random, 0, n - (source_index + 1));
|
|
15
15
|
|
|
16
16
|
if (target_index === source_index) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array_swap_one.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_swap_one.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"array_swap_one.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_swap_one.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,sDAHW,MAAM,UACN,MAAM,QAWhB"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { assert } from "../../assert.js";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* @template T
|
|
3
5
|
* @param {T[]} array
|
|
@@ -5,6 +7,10 @@
|
|
|
5
7
|
* @param {number} index1
|
|
6
8
|
*/
|
|
7
9
|
export function array_swap_one(array, index0, index1) {
|
|
10
|
+
assert.isArrayLike(array, 'array');
|
|
11
|
+
assert.isNonNegativeInteger(index0, 'index0');
|
|
12
|
+
assert.isNonNegativeInteger(index1, 'index1');
|
|
13
|
+
|
|
8
14
|
const t = array[index0];
|
|
9
15
|
|
|
10
16
|
array[index0] = array[index1];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Signal.d.ts","sourceRoot":"","sources":["../../../../../src/core/events/signal/Signal.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Signal.d.ts","sourceRoot":"","sources":["../../../../../src/core/events/signal/Signal.js"],"names":[],"mappings":"AAglBA;;;;;;GAMG;AACH,yDALW,aAAa,EAAE,+BAGb,MAAM,CAoBlB;AAED;;;;;;GAMG;AACH,mEALW,aAAa,EAAE,0BAGb,MAAM,CAelB;AAuDD;;;;GAIG;AACH,2CAHW,aAAa,EAAE,sBA8BzB;AA1sBD;;;;GAIG;AACH;IACI;;;OAGG;IACH,iBAAc;IAEd;;;;OAIG;IACH,cAAU;IAWV;;;OAGG;IACH,yBAEC;IAfD;;;OAGG;IACH,sBAEC;IAYD;;;;OAIG;IACH,cAHW,MAAM;;KAAY,GAChB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM;;KAAY,GAChB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM;;KAAY,SAClB,OAAO,QAQjB;IAED;;;;OAIG;IACH,cAHW,MAAM;;KAAY,GAChB,OAAO,CAInB;IAGD;;;;;OAKG;IACH,4CAFa,OAAO,CAQnB;IAED,aAEC;IAED,eAEC;IAED;;;OAGG;IACH,eAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,yCAQC;IAED;;;;OAIG;IACH,sCAYC;IAED;;;;;OAKG;IACH,oCAFa,OAAO,CAUnB;IAED;;;;;;OAMG;IACH,kBAGC;IAED;;;OAGG;IACH,+BAQC;IAED;;;OAGG;IACH,cA4CC;IAED;;;;OAIG;IACH,sBA6CC;IAED;;;;OAIG;IACH,4BA4CC;IAED;;;;;OAKG;IACH,oCA4CC;IAED;;;;;;OAMG;IACH,4CA4CC;IAED;;;;;;;;OAQG;IACH,4DA4CC;IAED;;;;;;;;;;OAUG;IACH,4EA4CC;IAED;;;;OAIG;IACH,aAHW,MAAM,GACJ,MAAM,CAalB;IAIL;;;OAGG;IACH,mBAFU,OAAO,CAEQ;CAPxB;;8BArkBiD,oBAAoB"}
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @author Alex Goldring
|
|
4
|
-
* @copyright Alex Goldring 2014
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
1
|
import { assert } from "../../assert.js";
|
|
9
2
|
import { SignalFlags } from "./SignalFlags.js";
|
|
10
3
|
import { SignalHandler, SignalHandlerFlags } from "./SignalHandler.js";
|
|
@@ -635,11 +628,12 @@ export function findSignalHandlerIndexByHandleAndContext(handlers, f, ctx) {
|
|
|
635
628
|
const l = handlers.length;
|
|
636
629
|
|
|
637
630
|
for (let i = 0; i < l; i++) {
|
|
638
|
-
const
|
|
631
|
+
const handler = handlers[i];
|
|
639
632
|
|
|
640
|
-
if (
|
|
633
|
+
if (handler.handle === f && handler.context === ctx) {
|
|
641
634
|
return i;
|
|
642
635
|
}
|
|
636
|
+
|
|
643
637
|
}
|
|
644
638
|
|
|
645
639
|
return -1;
|
|
@@ -672,7 +666,7 @@ function removeHandlerByHandler(signal, h) {
|
|
|
672
666
|
*/
|
|
673
667
|
function removeHandlerByHandlerAndContext(signal, h, ctx) {
|
|
674
668
|
const handlers = signal.handlers;
|
|
675
|
-
|
|
669
|
+
const i = findSignalHandlerIndexByHandleAndContext(handlers, h, ctx);
|
|
676
670
|
|
|
677
671
|
if (i >= 0) {
|
|
678
672
|
handlers.splice(i, 1);
|
|
@@ -682,6 +676,12 @@ function removeHandlerByHandlerAndContext(signal, h, ctx) {
|
|
|
682
676
|
return false;
|
|
683
677
|
}
|
|
684
678
|
|
|
679
|
+
/**
|
|
680
|
+
*
|
|
681
|
+
* @param {function} f
|
|
682
|
+
* @param {*} context
|
|
683
|
+
* @param {Array} args
|
|
684
|
+
*/
|
|
685
685
|
function dispatchCallback(f, context, args) {
|
|
686
686
|
assert.isFunction(f, 'f');
|
|
687
687
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compute_triangle_area_2d.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/2d/compute_triangle_area_2d.js"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,6CARW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,
|
|
1
|
+
{"version":3,"file":"compute_triangle_area_2d.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/2d/compute_triangle_area_2d.js"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,6CARW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CAclB"}
|
|
@@ -14,8 +14,10 @@ export function compute_triangle_area_2d(
|
|
|
14
14
|
x2, y2
|
|
15
15
|
) {
|
|
16
16
|
|
|
17
|
-
return
|
|
18
|
-
(x0 * y1 - y0 * x1)
|
|
19
|
-
|
|
17
|
+
return (
|
|
18
|
+
(x0 * y1 - y0 * x1)
|
|
19
|
+
+ (x1 * y2 - y1 * x2)
|
|
20
|
+
+ (x2 * y0 - y2 * x0)
|
|
21
|
+
) * 0.5;
|
|
20
22
|
|
|
21
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ray3.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/3d/Ray3.js"],"names":[],"mappings":"AAEA;;GAEG;AACH;IACI,gBAAsB;IACtB,mBAAyB;IAEzB;;;OAGG;IACH,iBAFW,MAAM,EAAE,UAAM,YAAY,QAKpC;IAED;;;OAGG;IACH,YAFW,IAAI,QAKd;CACJ;
|
|
1
|
+
{"version":3,"file":"Ray3.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/3d/Ray3.js"],"names":[],"mappings":"AAEA;;GAEG;AACH;IACI,gBAAsB;IACtB,mBAAyB;IAEzB,gBAEC;IAED,gBAEC;IAED,gBAEC;IAED,gBAEC;IAED,gBAEC;IAED,gBAEC;IAED;;;OAGG;IACH,iBAFW,MAAM,EAAE,UAAM,YAAY,QAKpC;IAED;;;OAGG;IACH,YAFW,IAAI,QAKd;CACJ;oBAlDmB,eAAe"}
|
package/src/core/geom/3d/Ray3.js
CHANGED
|
@@ -7,6 +7,30 @@ export class Ray3 {
|
|
|
7
7
|
origin = new Vector3()
|
|
8
8
|
direction = new Vector3()
|
|
9
9
|
|
|
10
|
+
get 0() {
|
|
11
|
+
return this.origin.x
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
get 1() {
|
|
15
|
+
return this.origin.y
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get 2() {
|
|
19
|
+
return this.origin.z
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
get 3() {
|
|
23
|
+
return this.direction.x
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
get 4() {
|
|
27
|
+
return this.direction.y
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
get 5() {
|
|
31
|
+
return this.direction.z
|
|
32
|
+
}
|
|
33
|
+
|
|
10
34
|
/**
|
|
11
35
|
*
|
|
12
36
|
* @param {number[]|mat4|Float32Array} m4
|