@woosh/meep-engine 2.155.0 → 2.156.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/build/bundle-worker-image-decoder.js +1 -1
- package/build/bundle-worker-terrain.js +1 -1
- package/editor/view/ecs/ComponentControlView.d.ts +0 -9
- package/editor/view/ecs/ComponentControlView.js +2 -98
- package/package.json +1 -1
- package/src/core/binary/32BitEncoder.js +1 -1
- package/src/core/binary/to_half_float_uint16.js +3 -3
- package/src/core/bvh2/bvh3/ebvh_build_hierarchy_radix.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_hierarchy_radix.js +275 -253
- package/src/core/cache/Cache.d.ts.map +1 -1
- package/src/core/cache/Cache.js +7 -0
- package/src/core/cache/FrequencySketch.d.ts.map +1 -1
- package/src/core/cache/FrequencySketch.js +8 -4
- package/src/core/clipboard/obtainClipBoard.d.ts +6 -0
- package/src/core/clipboard/obtainClipBoard.d.ts.map +1 -0
- package/src/core/clipboard/obtainClipBoard.js +29 -0
- package/src/core/clipboard/safeClipboardReadText.d.ts +6 -0
- package/src/core/clipboard/safeClipboardReadText.d.ts.map +1 -0
- package/src/core/clipboard/safeClipboardReadText.js +55 -0
- package/src/core/clipboard/safeClipboardWriteText.d.ts +8 -0
- package/src/core/clipboard/safeClipboardWriteText.d.ts.map +1 -0
- package/src/core/clipboard/safeClipboardWriteText.js +23 -0
- package/src/core/collection/array/array_quick_sort_by_lookup_map.js +1 -1
- package/src/core/collection/array/array_set_diff_sorting.d.ts.map +1 -1
- package/src/core/collection/array/array_set_diff_sorting.js +4 -1
- package/src/core/collection/array/array_shuffle.d.ts.map +1 -1
- package/src/core/collection/array/array_shuffle.js +30 -27
- package/src/core/collection/array/binarySearchLowIndex.d.ts.map +1 -1
- package/src/core/collection/array/binarySearchLowIndex.js +4 -3
- package/src/core/collection/array/typed/array_buffer_hash.js +1 -1
- package/src/core/collection/array/typed/is_typed_array_equals.d.ts.map +1 -1
- package/src/core/collection/array/typed/is_typed_array_equals.js +12 -2
- package/src/core/collection/heap/BinaryHeap.d.ts.map +1 -1
- package/src/core/collection/heap/BinaryHeap.js +12 -2
- package/src/core/collection/queue/Deque.d.ts.map +1 -1
- package/src/core/collection/queue/Deque.js +10 -8
- package/src/core/collection/table/RowFirstTable.d.ts.map +1 -1
- package/src/core/collection/table/RowFirstTable.js +4 -2
- package/src/core/collection/table/RowFirstTableSpec.js +2 -2
- package/src/core/color/operations/color_lerp.d.ts.map +1 -1
- package/src/core/color/operations/color_lerp.js +10 -3
- package/src/core/color/rgb2uint32.js +1 -1
- package/src/core/color/rgbe9995_to_rgb.js +1 -1
- package/src/core/function/objectsEqual.d.ts.map +1 -1
- package/src/core/function/objectsEqual.js +2 -1
- package/src/core/geom/2d/aabb/AABB2.d.ts.map +1 -1
- package/src/core/geom/2d/aabb/AABB2.js +12 -11
- package/src/core/geom/2d/convex-hull/convex_hull_jarvis_2d.d.ts.map +1 -1
- package/src/core/geom/2d/convex-hull/convex_hull_jarvis_2d.js +30 -4
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_relaxation.d.ts.map +1 -1
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_relaxation.js +6 -2
- package/src/core/geom/2d/hash-grid/SpatialHashGrid.d.ts.map +1 -1
- package/src/core/geom/2d/hash-grid/SpatialHashGrid.js +388 -386
- package/src/core/geom/2d/hash-grid/shg_query_elements_line.d.ts.map +1 -1
- package/src/core/geom/2d/hash-grid/shg_query_elements_line.js +8 -3
- package/src/core/geom/2d/quad-tree/QuadTreeDatum.d.ts.map +1 -1
- package/src/core/geom/2d/quad-tree/QuadTreeDatum.js +9 -1
- package/src/core/geom/2d/quad-tree/qt_query_data_nearest_to_point.d.ts +3 -1
- package/src/core/geom/2d/quad-tree/qt_query_data_nearest_to_point.d.ts.map +1 -1
- package/src/core/geom/2d/quad-tree/qt_query_data_nearest_to_point.js +3 -1
- package/src/core/geom/2d/quad-tree-binary/QuadTree.js +714 -714
- package/src/core/geom/2d/r-tree/StaticR2Tree.d.ts.map +1 -1
- package/src/core/geom/2d/r-tree/StaticR2Tree.js +5 -4
- package/src/core/geom/3d/aabb/aabb3_detailed_volume_intersection.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_detailed_volume_intersection.js +33 -29
- package/src/core/geom/3d/aabb/aabb3_near_distance_to_intersection_ray_segment.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_near_distance_to_intersection_ray_segment.js +3 -1
- package/src/core/geom/3d/aabb/aabb3_signed_distance_to_aabb3.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_signed_distance_to_aabb3.js +10 -7
- package/src/core/geom/3d/aabb/aabb3_transformed_compute_plane_side.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_transformed_compute_plane_side.js +30 -9
- package/src/core/geom/3d/aabb/compute_aabb_from_points.js +3 -3
- package/src/core/geom/3d/box/box3_raycast.d.ts +37 -0
- package/src/core/geom/3d/box/box3_raycast.d.ts.map +1 -0
- package/src/core/geom/3d/box/box3_raycast.js +81 -0
- package/src/core/geom/3d/capsule/capsule_raycast.d.ts +35 -0
- package/src/core/geom/3d/capsule/capsule_raycast.d.ts.map +1 -0
- package/src/core/geom/3d/capsule/capsule_raycast.js +93 -0
- package/src/core/geom/3d/cone/compute_bounding_cone_of_2_cones.d.ts.map +1 -1
- package/src/core/geom/3d/cone/compute_bounding_cone_of_2_cones.js +4 -0
- package/src/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js +1 -1
- package/src/core/geom/3d/line/line3_compute_segment_point_distance_eikonal.d.ts.map +1 -1
- package/src/core/geom/3d/line/line3_compute_segment_point_distance_eikonal.js +3 -2
- package/src/core/geom/3d/mat4/decompose_matrix_4_array.d.ts.map +1 -1
- package/src/core/geom/3d/mat4/decompose_matrix_4_array.js +12 -2
- package/src/core/geom/3d/mat4/eulerAnglesFromMatrix.js +2 -2
- package/src/core/geom/3d/mat4/m4_multiply_alphatensor.d.ts +1 -1
- package/src/core/geom/3d/mat4/m4_multiply_alphatensor.d.ts.map +1 -1
- package/src/core/geom/3d/mat4/m4_multiply_alphatensor.js +19 -13
- package/src/core/geom/3d/octahedra/octahedral_direction_to_uv.d.ts.map +1 -1
- package/src/core/geom/3d/octahedra/octahedral_direction_to_uv.js +3 -2
- package/src/core/geom/3d/plane/plane3_compute_plane_intersection.js +3 -2
- package/src/core/geom/3d/shape/MeshShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/MeshShape3D.js +7 -0
- package/src/core/geom/3d/shape/UnionShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/UnionShape3D.js +3 -2
- package/src/core/geom/3d/shape/util/shape3d_voxelize_to_grid.d.ts.map +1 -1
- package/src/core/geom/3d/shape/util/shape3d_voxelize_to_grid.js +153 -148
- package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.d.ts.map +1 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js +7 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_sample_by_direction.d.ts.map +1 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_sample_by_direction.js +13 -10
- package/src/core/geom/3d/sphere/sphere_projected_sphere_radius_sqr.d.ts +1 -1
- package/src/core/geom/3d/sphere/sphere_projected_sphere_radius_sqr.js +2 -2
- package/src/core/geom/3d/sphere/sphere_raycast.d.ts +33 -0
- package/src/core/geom/3d/sphere/sphere_raycast.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/sphere_raycast.js +47 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_tet_get_neighbours.d.ts +24 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_tet_get_neighbours.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_tet_get_neighbours.js +39 -0
- package/src/core/geom/3d/tetrahedra/triangle/trace_triangular_depth_map.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/triangle/trace_triangular_depth_map.js +4 -2
- package/src/core/geom/3d/topology/bounds/computeTriangleClusterNormalBoundingCone.js +3 -3
- package/src/core/geom/3d/topology/simplify/decimate_edge_collapse_snap.js +1 -1
- package/src/core/geom/3d/topology/tm_vertex_compute_normal.d.ts.map +1 -1
- package/src/core/geom/3d/topology/tm_vertex_compute_normal.js +4 -2
- package/src/core/geom/3d/util/make_justified_point_grid.d.ts.map +1 -1
- package/src/core/geom/3d/util/make_justified_point_grid.js +18 -10
- package/src/core/geom/ConicRay.d.ts.map +1 -1
- package/src/core/geom/ConicRay.js +11 -13
- package/src/core/geom/packing/max-rect/removeRedundantBoxes.d.ts.map +1 -1
- package/src/core/geom/packing/max-rect/removeRedundantBoxes.js +19 -4
- package/src/core/geom/vec3/v3_orthonormal_matrix_from_normal.d.ts.map +1 -0
- package/src/{engine/graphics/sh3/path_tracer/sampling → core/geom/vec3}/v3_orthonormal_matrix_from_normal.js +1 -1
- package/src/core/graph/coloring/colorizeGraph.js +2 -2
- package/src/core/graph/csr/CSRGraph.d.ts.map +1 -1
- package/src/core/graph/csr/CSRGraph.js +325 -319
- package/src/core/graph/layout/CircleLayout.d.ts.map +1 -1
- package/src/core/graph/layout/CircleLayout.js +8 -6
- package/src/core/graph/metis/native/refine/compute_kway_params.d.ts.map +1 -1
- package/src/core/graph/metis/native/refine/compute_kway_params.js +139 -138
- package/src/core/graph/mn_graph_coarsen.d.ts.map +1 -1
- package/src/core/graph/mn_graph_coarsen.js +4 -2
- package/src/core/graph/v2/NodeContainer.js +7 -7
- package/src/core/localization/LocalizationEngine.js +1 -1
- package/src/core/math/bell_membership_function.d.ts.map +1 -1
- package/src/core/math/bell_membership_function.js +3 -1
- package/src/core/math/complex/complex_add.d.ts +4 -4
- package/src/core/math/complex/complex_add.d.ts.map +1 -1
- package/src/core/math/complex/complex_add.js +3 -3
- package/src/core/math/complex/complex_div.d.ts +4 -4
- package/src/core/math/complex/complex_div.d.ts.map +1 -1
- package/src/core/math/complex/complex_div.js +3 -3
- package/src/core/math/complex/complex_mul.d.ts +4 -4
- package/src/core/math/complex/complex_mul.d.ts.map +1 -1
- package/src/core/math/complex/complex_mul.js +3 -3
- package/src/core/math/complex/complex_sub.d.ts +4 -4
- package/src/core/math/complex/complex_sub.d.ts.map +1 -1
- package/src/core/math/complex/complex_sub.js +3 -3
- package/src/core/math/idct_1d.d.ts +4 -4
- package/src/core/math/idct_1d.d.ts.map +1 -1
- package/src/core/math/idct_1d.js +3 -3
- package/src/core/math/noise/create_simplex_noise_2d.d.ts.map +1 -1
- package/src/core/math/noise/create_simplex_noise_2d.js +4 -2
- package/src/core/math/noise/sdnoise.d.ts.map +1 -1
- package/src/core/math/noise/sdnoise.js +12 -9
- package/src/core/math/physics/mie/compute_bhmie_optical_properties.d.ts.map +1 -1
- package/src/core/math/physics/mie/compute_bhmie_optical_properties.js +94 -50
- package/src/core/math/physics/mie/lorenz_mie_coefs.d.ts +3 -6
- package/src/core/math/physics/mie/lorenz_mie_coefs.d.ts.map +1 -1
- package/src/core/math/physics/mie/lorenz_mie_coefs.js +180 -157
- package/src/core/math/physics/mie/mie_ab_to_optical_properties.d.ts +3 -4
- package/src/core/math/physics/mie/mie_ab_to_optical_properties.d.ts.map +1 -1
- package/src/core/math/physics/mie/mie_ab_to_optical_properties.js +47 -21
- package/src/core/math/random/randomIntegerBetween.d.ts.map +1 -1
- package/src/core/math/random/randomIntegerBetween.js +4 -1
- package/src/core/math/solveCubic.d.ts.map +1 -1
- package/src/core/math/solveCubic.js +95 -82
- package/src/core/math/spline/computeCatmullRomSplineUniformDistance.d.ts.map +1 -1
- package/src/core/math/spline/computeCatmullRomSplineUniformDistance.js +13 -0
- package/src/core/math/statistics/softmax.js +1 -1
- package/src/core/model/node-graph/visual/NodeGraphVisualData.d.ts +1 -0
- package/src/core/model/node-graph/visual/NodeGraphVisualData.d.ts.map +1 -1
- package/src/core/model/node-graph/visual/NodeGraphVisualData.js +2 -1
- package/src/core/model/node-graph/visual/NodeVisualData.js +1 -1
- package/src/core/model/object/ImmutableObjectPool.d.ts +7 -0
- package/src/core/model/object/ImmutableObjectPool.d.ts.map +1 -1
- package/src/core/model/object/ImmutableObjectPool.js +20 -10
- package/src/core/model/reactive/evaluation/MultiPredicateEvaluator.d.ts.map +1 -1
- package/src/core/model/reactive/evaluation/MultiPredicateEvaluator.js +39 -2
- package/src/core/model/reactive/model/terminal/ReactiveReference.d.ts.map +1 -1
- package/src/core/model/reactive/model/terminal/ReactiveReference.js +2 -0
- package/src/core/parser/simple/readHexToken.d.ts.map +1 -1
- package/src/core/parser/simple/readHexToken.js +6 -0
- package/src/core/primitives/numbers/number_pretty_print.d.ts.map +1 -1
- package/src/core/primitives/numbers/number_pretty_print.js +4 -1
- package/src/core/primitives/strings/string_jaro_winkler.js +1 -1
- package/src/core/process/CompositeProcess.js +1 -1
- package/src/core/process/action/AsynchronousDelayAction.d.ts.map +1 -1
- package/src/core/process/action/AsynchronousDelayAction.js +3 -0
- package/src/core/process/executor/ConcurrentExecutor.d.ts.map +1 -1
- package/src/core/process/executor/ConcurrentExecutor.js +3 -2
- package/src/core/process/task/util/randomCountTask.d.ts.map +1 -1
- package/src/core/process/task/util/randomCountTask.js +3 -1
- package/src/core/process/undo/ActionProcessor.d.ts.map +1 -1
- package/src/core/process/undo/ActionProcessor.js +5 -3
- package/src/core/process/worker/WorkerBuilder.js +3 -3
- package/src/engine/animation/curve/AnimationCurve.d.ts.map +1 -1
- package/src/engine/animation/curve/AnimationCurve.js +4 -2
- package/src/engine/control/first-person/DESIGN.md +1 -1
- package/src/engine/control/first-person/FirstPersonMotionPhase.d.ts +55 -0
- package/src/engine/control/first-person/FirstPersonMotionPhase.d.ts.map +1 -0
- package/src/engine/control/first-person/FirstPersonMotionPhase.js +134 -0
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts +23 -2
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerController.js +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts +168 -0
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.js +115 -0
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts +71 -0
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.js +255 -55
- package/src/engine/control/first-person/abilities/LedgeGrab.d.ts +82 -43
- package/src/engine/control/first-person/abilities/LedgeGrab.d.ts.map +1 -1
- package/src/engine/control/first-person/abilities/LedgeGrab.js +405 -213
- package/src/engine/control/first-person/abilities/Mantle.d.ts +6 -0
- package/src/engine/control/first-person/abilities/Mantle.d.ts.map +1 -1
- package/src/engine/control/first-person/abilities/Mantle.js +104 -45
- package/src/engine/control/first-person/abilities/ScrambleUp.d.ts +61 -0
- package/src/engine/control/first-person/abilities/ScrambleUp.d.ts.map +1 -0
- package/src/engine/control/first-person/abilities/ScrambleUp.js +182 -0
- package/src/engine/control/first-person/math/jumpDynamics.d.ts +84 -0
- package/src/engine/control/first-person/math/jumpDynamics.d.ts.map +1 -0
- package/src/engine/control/first-person/math/jumpDynamics.js +108 -0
- package/src/engine/control/first-person/prototype_first_person_controller.js +45 -1
- package/src/engine/graphics/camera/testClippingPlaneComputation.js +1 -1
- package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +1 -1
- package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +1 -1
- package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +1 -1
- package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +1 -1
- package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.js +1 -1
- package/src/engine/graphics/shadows/testShadowMapRendering.js +1 -1
- package/src/engine/physics/CONSTRAINT_SOLVER_BENCH_LOG.md +208 -0
- package/src/engine/physics/CONSTRAINT_SOLVER_IMPROVEMENTS_PLAN.md +364 -0
- package/src/engine/physics/PLAN.md +6 -5
- package/src/engine/physics/constraint/solve_constraints.d.ts +4 -1
- package/src/engine/physics/constraint/solve_constraints.d.ts.map +1 -1
- package/src/engine/physics/constraint/solve_constraints.js +147 -33
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.js +1750 -1747
- package/src/engine/physics/fluid/ecs/FluidSystem.d.ts +3 -3
- package/src/engine/physics/gjk/gjk_epa_penetration.d.ts.map +1 -1
- package/src/engine/physics/gjk/gjk_epa_penetration.js +5 -9
- package/src/engine/physics/narrowphase/convex_convex_manifold.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/convex_convex_manifold.js +22 -25
- package/src/engine/physics/narrowphase/convex_decomposition.d.ts +32 -13
- package/src/engine/physics/narrowphase/convex_decomposition.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/convex_decomposition.js +61 -65
- package/src/engine/physics/narrowphase/mesh_convex_hull.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/mesh_convex_hull.js +13 -8
- package/src/engine/physics/narrowphase/refine_ray_concave.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/refine_ray_concave.js +5 -3
- package/src/engine/physics/narrowphase/refine_ray_hit.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/refine_ray_hit.js +81 -78
- package/src/engine/sound/SoundEngine.d.ts.map +1 -1
- package/src/engine/sound/SoundEngine.js +28 -0
- package/src/engine/sound/dB2Volume.d.ts +1 -1
- package/src/engine/sound/dB2Volume.d.ts.map +1 -1
- package/src/engine/sound/dB2Volume.js +1 -1
- package/src/engine/sound/ecs/SoundController.d.ts +4 -0
- package/src/engine/sound/ecs/SoundController.d.ts.map +1 -1
- package/src/engine/sound/ecs/SoundController.js +4 -0
- package/src/engine/sound/ecs/SoundControllerSystem.d.ts +5 -0
- package/src/engine/sound/ecs/SoundControllerSystem.d.ts.map +1 -1
- package/src/engine/sound/ecs/SoundControllerSystem.js +5 -0
- package/src/engine/sound/ecs/audio/AudioEmitter.d.ts +69 -0
- package/src/engine/sound/ecs/audio/AudioEmitter.d.ts.map +1 -0
- package/src/engine/sound/ecs/audio/AudioEmitter.js +83 -0
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts +97 -0
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts.map +1 -0
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.js +238 -0
- package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts +90 -0
- package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts.map +1 -0
- package/src/engine/sound/ecs/audio/LiveEmitterSet.js +324 -0
- package/src/engine/sound/ecs/audio/SpatialAudioIndex.d.ts +59 -0
- package/src/engine/sound/ecs/audio/SpatialAudioIndex.d.ts.map +1 -0
- package/src/engine/sound/ecs/audio/SpatialAudioIndex.js +140 -0
- package/src/engine/sound/ecs/emitter/SoundEmitter.d.ts +16 -65
- package/src/engine/sound/ecs/emitter/SoundEmitter.d.ts.map +1 -1
- package/src/engine/sound/ecs/emitter/SoundEmitter.js +19 -224
- package/src/engine/sound/ecs/emitter/SoundEmitterComponentContext.d.ts +26 -29
- package/src/engine/sound/ecs/emitter/SoundEmitterComponentContext.d.ts.map +1 -1
- package/src/engine/sound/ecs/emitter/SoundEmitterComponentContext.js +168 -135
- package/src/engine/sound/ecs/emitter/SoundEmitterSystem.d.ts +36 -59
- package/src/engine/sound/ecs/emitter/SoundEmitterSystem.d.ts.map +1 -1
- package/src/engine/sound/ecs/emitter/SoundEmitterSystem.js +154 -390
- package/src/engine/sound/ecs/emitter/SoundTrack.d.ts +20 -23
- package/src/engine/sound/ecs/emitter/SoundTrack.d.ts.map +1 -1
- package/src/engine/sound/ecs/emitter/SoundTrack.js +34 -152
- package/src/engine/sound/sopra/IMPLEMENTATION_PLAN.md +993 -0
- package/src/engine/sound/sopra/README.md +643 -7
- package/src/engine/sound/sopra/SopraEngine.d.ts +229 -0
- package/src/engine/sound/sopra/SopraEngine.d.ts.map +1 -0
- package/src/engine/sound/sopra/SopraEngine.js +423 -0
- package/src/engine/sound/sopra/asset/AssetManagerBufferProvider.d.ts +26 -0
- package/src/engine/sound/sopra/asset/AssetManagerBufferProvider.d.ts.map +1 -0
- package/src/engine/sound/sopra/asset/AssetManagerBufferProvider.js +71 -0
- package/src/engine/sound/sopra/asset/BufferProvider.d.ts +24 -0
- package/src/engine/sound/sopra/asset/BufferProvider.d.ts.map +1 -0
- package/src/engine/sound/sopra/asset/BufferProvider.js +29 -0
- package/src/engine/sound/sopra/asset/StubBufferProvider.d.ts +31 -0
- package/src/engine/sound/sopra/asset/StubBufferProvider.d.ts.map +1 -0
- package/src/engine/sound/sopra/asset/StubBufferProvider.js +58 -0
- package/src/engine/sound/sopra/definition/BusDefinition.d.ts +83 -0
- package/src/engine/sound/sopra/definition/BusDefinition.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/BusDefinition.js +142 -0
- package/src/engine/sound/sopra/definition/BusDefinitionSerializationAdapter.d.ts +17 -0
- package/src/engine/sound/sopra/definition/BusDefinitionSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/BusDefinitionSerializationAdapter.js +54 -0
- package/src/engine/sound/sopra/definition/DuckingRule.d.ts +71 -0
- package/src/engine/sound/sopra/definition/DuckingRule.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/DuckingRule.js +106 -0
- package/src/engine/sound/sopra/definition/DuckingRuleSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/DuckingRuleSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/DuckingRuleSerializationAdapter.js +31 -0
- package/src/engine/sound/sopra/definition/EventDescription.d.ts +132 -0
- package/src/engine/sound/sopra/definition/EventDescription.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/EventDescription.js +259 -0
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.d.ts +17 -0
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.js +71 -0
- package/src/engine/sound/sopra/definition/MixerSnapshot.d.ts +51 -0
- package/src/engine/sound/sopra/definition/MixerSnapshot.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/MixerSnapshot.js +83 -0
- package/src/engine/sound/sopra/definition/MixerSnapshotSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/MixerSnapshotSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/MixerSnapshotSerializationAdapter.js +39 -0
- package/src/engine/sound/sopra/definition/ParameterDefinition.d.ts +72 -0
- package/src/engine/sound/sopra/definition/ParameterDefinition.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/ParameterDefinition.js +117 -0
- package/src/engine/sound/sopra/definition/ParameterDefinitionSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/ParameterDefinitionSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/ParameterDefinitionSerializationAdapter.js +31 -0
- package/src/engine/sound/sopra/definition/SopraPanningModel.d.ts +14 -0
- package/src/engine/sound/sopra/definition/SopraPanningModel.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/SopraPanningModel.js +20 -0
- package/src/engine/sound/sopra/definition/VoiceStealMode.d.ts +10 -0
- package/src/engine/sound/sopra/definition/VoiceStealMode.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/VoiceStealMode.js +18 -0
- package/src/engine/sound/sopra/definition/clip/AbstractAudioClip.d.ts +93 -0
- package/src/engine/sound/sopra/definition/clip/AbstractAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/AbstractAudioClip.js +109 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.d.ts +80 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.js +181 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClipSerializationAdapter.d.ts +17 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClipSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClipSerializationAdapter.js +74 -0
- package/src/engine/sound/sopra/definition/clip/ContainerAudioClip.d.ts +34 -0
- package/src/engine/sound/sopra/definition/clip/ContainerAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/ContainerAudioClip.js +100 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.d.ts +101 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.js +230 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClipSerializationAdapter.d.ts +17 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClipSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClipSerializationAdapter.js +54 -0
- package/src/engine/sound/sopra/definition/clip/SampleAudioClip.d.ts +103 -0
- package/src/engine/sound/sopra/definition/clip/SampleAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SampleAudioClip.js +191 -0
- package/src/engine/sound/sopra/definition/clip/SampleAudioClipSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/clip/SampleAudioClipSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SampleAudioClipSerializationAdapter.js +39 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClip.d.ts +40 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClip.js +91 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClipSerializationAdapter.d.ts +17 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClipSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClipSerializationAdapter.js +42 -0
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClip.d.ts +44 -0
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClip.js +77 -0
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClipSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClipSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClipSerializationAdapter.js +27 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts +65 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.js +131 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClipSerializationAdapter.d.ts +17 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClipSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClipSerializationAdapter.js +41 -0
- package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.d.ts +24 -0
- package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.js +24 -0
- package/src/engine/sound/sopra/definition/effect/CompressorEffect.d.ts +70 -0
- package/src/engine/sound/sopra/definition/effect/CompressorEffect.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/CompressorEffect.js +120 -0
- package/src/engine/sound/sopra/definition/effect/CompressorEffectSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/effect/CompressorEffectSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/CompressorEffectSerializationAdapter.js +31 -0
- package/src/engine/sound/sopra/definition/effect/EqEffect.d.ts +74 -0
- package/src/engine/sound/sopra/definition/effect/EqEffect.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/EqEffect.js +128 -0
- package/src/engine/sound/sopra/definition/effect/EqEffectSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/effect/EqEffectSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/EqEffectSerializationAdapter.js +29 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffect.d.ts +49 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffect.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffect.js +101 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffectSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffectSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffectSerializationAdapter.js +25 -0
- package/src/engine/sound/sopra/legacy/soundEmitterToEventDescription.d.ts +31 -0
- package/src/engine/sound/sopra/legacy/soundEmitterToEventDescription.d.ts.map +1 -0
- package/src/engine/sound/sopra/legacy/soundEmitterToEventDescription.js +106 -0
- package/src/engine/sound/sopra/runtime/BusGraph.d.ts +79 -0
- package/src/engine/sound/sopra/runtime/BusGraph.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/BusGraph.js +227 -0
- package/src/engine/sound/sopra/runtime/EventInstance.d.ts +144 -0
- package/src/engine/sound/sopra/runtime/EventInstance.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/EventInstance.js +579 -0
- package/src/engine/sound/sopra/runtime/ParameterStore.d.ts +42 -0
- package/src/engine/sound/sopra/runtime/ParameterStore.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/ParameterStore.js +98 -0
- package/src/engine/sound/sopra/runtime/SopraPlaybackContext.d.ts +42 -0
- package/src/engine/sound/sopra/runtime/SopraPlaybackContext.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/SopraPlaybackContext.js +68 -0
- package/src/engine/sound/sopra/runtime/Voice.d.ts +67 -0
- package/src/engine/sound/sopra/runtime/Voice.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/Voice.js +145 -0
- package/src/engine/sound/sopra/runtime/VoiceManager.d.ts +38 -0
- package/src/engine/sound/sopra/runtime/VoiceManager.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/VoiceManager.js +136 -0
- package/src/engine/sound/sopra/runtime/VoicePool.d.ts +12 -0
- package/src/engine/sound/sopra/runtime/VoicePool.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/VoicePool.js +17 -0
- package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.d.ts +11 -0
- package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.d.ts.map +1 -0
- package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.js +42 -0
- package/src/engine/sound/sopra/serialization/sopraJSON.d.ts +33 -0
- package/src/engine/sound/sopra/serialization/sopraJSON.d.ts.map +1 -0
- package/src/engine/sound/sopra/serialization/sopraJSON.js +99 -0
- package/src/engine/sound/sopra/serialization/sopraSerializationHarness.d.ts +27 -0
- package/src/engine/sound/sopra/serialization/sopraSerializationHarness.d.ts.map +1 -0
- package/src/engine/sound/sopra/serialization/sopraSerializationHarness.js +49 -0
- package/src/engine/sound/sopra/util/MockAudioContext.d.ts +74 -0
- package/src/engine/sound/sopra/util/MockAudioContext.d.ts.map +1 -0
- package/src/engine/sound/sopra/util/MockAudioContext.js +215 -0
- package/src/engine/sound/sopra/util/buildAttenuationCurve.d.ts +15 -0
- package/src/engine/sound/sopra/util/buildAttenuationCurve.d.ts.map +1 -0
- package/src/engine/sound/sopra/util/buildAttenuationCurve.js +40 -0
- package/src/engine/sound/sopra/util/fadeOutAndStop.d.ts +34 -0
- package/src/engine/sound/sopra/util/fadeOutAndStop.d.ts.map +1 -0
- package/src/engine/sound/sopra/util/fadeOutAndStop.js +60 -0
- package/src/engine/sound/volume2dB.d.ts +1 -1
- package/src/engine/sound/volume2dB.d.ts.map +1 -1
- package/src/engine/sound/volume2dB.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/sampling/v3_orthonormal_matrix_from_normal.d.ts.map +0 -1
- package/src/engine/physics/narrowphase/ray_shapes.d.ts +0 -66
- package/src/engine/physics/narrowphase/ray_shapes.d.ts.map +0 -1
- package/src/engine/physics/narrowphase/ray_shapes.js +0 -187
- package/src/engine/sound/ecs/emitter/SoundEmitterChannel.d.ts +0 -23
- package/src/engine/sound/ecs/emitter/SoundEmitterChannel.d.ts.map +0 -1
- package/src/engine/sound/ecs/emitter/SoundEmitterChannel.js +0 -32
- package/src/engine/sound/ecs/emitter/SoundTrackNodes.d.ts +0 -18
- package/src/engine/sound/ecs/emitter/SoundTrackNodes.d.ts.map +0 -1
- package/src/engine/sound/ecs/emitter/SoundTrackNodes.js +0 -18
- package/src/engine/sound/sopra/AbstractAudioClip.d.ts +0 -26
- package/src/engine/sound/sopra/AbstractAudioClip.d.ts.map +0 -1
- package/src/engine/sound/sopra/AbstractAudioClip.js +0 -29
- package/src/engine/sound/sopra/ContainerAudioClip.d.ts +0 -12
- package/src/engine/sound/sopra/ContainerAudioClip.d.ts.map +0 -1
- package/src/engine/sound/sopra/ContainerAudioClip.js +0 -13
- package/src/engine/sound/sopra/RandomContainerAudioClip.d.ts +0 -12
- package/src/engine/sound/sopra/RandomContainerAudioClip.d.ts.map +0 -1
- package/src/engine/sound/sopra/RandomContainerAudioClip.js +0 -15
- package/src/engine/sound/sopra/SequenceContainerAudioClip.d.ts +0 -7
- package/src/engine/sound/sopra/SequenceContainerAudioClip.d.ts.map +0 -1
- package/src/engine/sound/sopra/SequenceContainerAudioClip.js +0 -8
- package/src/engine/sound/sopra/SilenceAudioClip.d.ts +0 -13
- package/src/engine/sound/sopra/SilenceAudioClip.d.ts.map +0 -1
- package/src/engine/sound/sopra/SilenceAudioClip.js +0 -15
- /package/src/{engine/graphics/sh3/path_tracer/sampling → core/geom/vec3}/v3_orthonormal_matrix_from_normal.d.ts +0 -0
|
@@ -38,7 +38,7 @@ export class FluidSystem extends System<any, any, any, any, any> {
|
|
|
38
38
|
* @param {FluidEffectorsComponent} effectors_component
|
|
39
39
|
* @param {Transform} transform
|
|
40
40
|
*/
|
|
41
|
-
static "__#
|
|
41
|
+
static "__#139@#sync_effectors_from_transform"(effectors_component: FluidEffectorsComponent, transform: Transform): void;
|
|
42
42
|
/**
|
|
43
43
|
* Visitor for the (FluidComponent, Transform) traversal — keeps the field's
|
|
44
44
|
* grid origin locked to a cell-aligned position near the transform.
|
|
@@ -61,7 +61,7 @@ export class FluidSystem extends System<any, any, any, any, any> {
|
|
|
61
61
|
* @param {FluidComponent} component
|
|
62
62
|
* @param {Transform} transform
|
|
63
63
|
*/
|
|
64
|
-
static "__#
|
|
64
|
+
static "__#139@#reanchor_field"(component: FluidComponent, transform: Transform): void;
|
|
65
65
|
/**
|
|
66
66
|
* Write the world-to-grid affine for a FluidComponent into `out`. Axis-aligned,
|
|
67
67
|
* uniform-scale, so the matrix is sparse:
|
|
@@ -76,7 +76,7 @@ export class FluidSystem extends System<any, any, any, any, any> {
|
|
|
76
76
|
* @param {Float32Array} out length-16
|
|
77
77
|
* @param {FluidComponent} component
|
|
78
78
|
*/
|
|
79
|
-
static "__#
|
|
79
|
+
static "__#139@#build_world_to_grid"(out: Float32Array, component: FluidComponent): void;
|
|
80
80
|
constructor();
|
|
81
81
|
dependencies: (typeof FluidComponent)[];
|
|
82
82
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gjk_epa_penetration.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/gjk/gjk_epa_penetration.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gjk_epa_penetration.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/gjk/gjk_epa_penetration.js"],"names":[],"mappings":"AA+gBA;;;;;;;;;GASG;AACH,yCALW,YAAY,GAAC,MAAM,EAAE,KACrB,eAAe,KACf,eAAe,GACb,MAAM,CAQlB;;;;;;8BA9cY;IAAE,OAAO,SAAW,YAAY,QAAE,MAAM,QAAE,MAAM,QAAE,MAAM,QAAE,MAAM,KAAG,IAAI,CAAA;CAAE"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { v3_compute_triangle_normal } from "../../../core/geom/3d/triangle/v3_compute_triangle_normal.js";
|
|
1
2
|
import { v3_array_copy } from "../../../core/geom/vec3/v3_array_copy.js";
|
|
2
3
|
import { v3_cross } from "../../../core/geom/vec3/v3_cross.js";
|
|
3
4
|
import { v3_dot } from "../../../core/geom/vec3/v3_dot.js";
|
|
@@ -344,16 +345,11 @@ function tetra_case() {
|
|
|
344
345
|
*/
|
|
345
346
|
function add_face(i, j, k, face_count) {
|
|
346
347
|
const ax = VERTS[i * 3], ay = VERTS[i * 3 + 1], az = VERTS[i * 3 + 2];
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
348
|
+
const bx = VERTS[j * 3], by = VERTS[j * 3 + 1], bz = VERTS[j * 3 + 2];
|
|
349
|
+
const cx = VERTS[k * 3], cy = VERTS[k * 3 + 1], cz = VERTS[k * 3 + 2];
|
|
350
|
+
// (b−a)×(c−a), normalised (degenerate → (0,1,0)); see v3_compute_triangle_normal
|
|
351
|
+
v3_compute_triangle_normal(_t, 0, ax, ay, az, bx, by, bz, cx, cy, cz);
|
|
351
352
|
let nx = _t[0], ny = _t[1], nz = _t[2];
|
|
352
|
-
const len = Math.sqrt(nx * nx + ny * ny + nz * nz) || 1;
|
|
353
|
-
const inv = 1 / len;
|
|
354
|
-
nx *= inv;
|
|
355
|
-
ny *= inv;
|
|
356
|
-
nz *= inv;
|
|
357
353
|
|
|
358
354
|
// orient outward: the normal must point away from the interior (centroid)
|
|
359
355
|
if (v3_dot(nx, ny, nz, ax - CEN[0], ay - CEN[1], az - CEN[2]) < 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convex_convex_manifold.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/narrowphase/convex_convex_manifold.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"convex_convex_manifold.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/narrowphase/convex_convex_manifold.js"],"names":[],"mappings":"AAiJA;;;;;;;;;;GAUG;AACH,4CAPW,YAAY,GAAC,MAAM,EAAE,KACrB;IAAC,QAAQ,EAAC,YAAY,CAAC;IAAC,YAAY,EAAC,WAAW,CAAC;IAAC,UAAU,EAAC,WAAW,CAAA;CAAC,QACzE;IAAC,CAAC,CAAC;IAAA,CAAC,CAAC;IAAA,CAAC,CAAA;CAAC,QAAe;IAAC,CAAC,CAAC;IAAA,CAAC,CAAC;IAAA,CAAC,CAAC;IAAA,CAAC,CAAA;CAAC,KAC/B;IAAC,QAAQ,EAAC,YAAY,CAAC;IAAC,YAAY,EAAC,WAAW,CAAC;IAAC,UAAU,EAAC,WAAW,CAAA;CAAC,QACzE;IAAC,CAAC,CAAC;IAAA,CAAC,CAAC;IAAA,CAAC,CAAA;CAAC,QAAe;IAAC,CAAC,CAAC;IAAA,CAAC,CAAC;IAAA,CAAC,CAAC;IAAA,CAAC,CAAA;CAAC,GAC7B,OAAO,CAsDnB;AAED;;;;;;;;;;;;;;;GAeG;AACH,sCANW,YAAY,GAAC,MAAM,EAAE,KACrB;IAAC,QAAQ,CAAC;IAAA,YAAY,CAAC;IAAA,UAAU,CAAA;CAAC,QAAY;IAAC,CAAC,CAAC;IAAA,CAAC,CAAC;IAAA,CAAC,CAAA;CAAC,QAAe;IAAC,CAAC,CAAC;IAAA,CAAC,CAAC;IAAA,CAAC,CAAC;IAAA,CAAC,CAAA;CAAC,KAC7E;IAAC,QAAQ,CAAC;IAAA,YAAY,CAAC;IAAA,UAAU,CAAA;CAAC,QAAY;IAAC,CAAC,CAAC;IAAA,CAAC,CAAC;IAAA,CAAC,CAAA;CAAC,QAAe;IAAC,CAAC,CAAC;IAAA,CAAC,CAAC;IAAA,CAAC,CAAC;IAAA,CAAC,CAAA;CAAC,MAC7E,MAAM,MAAa,MAAM,MAAa,MAAM,GAC1C,OAAO,CA+CnB;AAxND,8CAA0E"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { v3_array_centroid } from "../../../core/geom/vec3/v3_array_centroid.js";
|
|
2
|
+
import { v3_dot } from "../../../core/geom/vec3/v3_dot.js";
|
|
3
|
+
import { v3_length } from "../../../core/geom/vec3/v3_length.js";
|
|
1
4
|
import { v3_quat3_apply } from "../../../core/geom/vec3/v3_quat3_apply.js";
|
|
2
5
|
import { reduce_manifold_contacts } from "./reduce_manifold_contacts.js";
|
|
3
6
|
|
|
@@ -95,12 +98,6 @@ function load_world(out, verts, n, p, q) {
|
|
|
95
98
|
}
|
|
96
99
|
}
|
|
97
100
|
|
|
98
|
-
function centroid(out, wv, n) {
|
|
99
|
-
let cx = 0, cy = 0, cz = 0;
|
|
100
|
-
for (let i = 0; i < n; i++) { cx += wv[i * 3]; cy += wv[i * 3 + 1]; cz += wv[i * 3 + 2]; }
|
|
101
|
-
out[0] = cx / n; out[1] = cy / n; out[2] = cz / n;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
101
|
/**
|
|
105
102
|
* Outward normal of a polygon face (Newell's method over the whole loop, world).
|
|
106
103
|
* Robust against collinear consecutive vertices, unlike a first-three cross.
|
|
@@ -125,12 +122,12 @@ function test_axis(ux, uy, uz, nA, nB, kind, face) {
|
|
|
125
122
|
|
|
126
123
|
let minA = Infinity, maxA = -Infinity;
|
|
127
124
|
for (let i = 0; i < nA; i++) {
|
|
128
|
-
const d = ux
|
|
125
|
+
const d = v3_dot(ux, uy, uz, wvA[i * 3], wvA[i * 3 + 1], wvA[i * 3 + 2]);
|
|
129
126
|
if (d < minA) minA = d; if (d > maxA) maxA = d;
|
|
130
127
|
}
|
|
131
128
|
let minB = Infinity, maxB = -Infinity;
|
|
132
129
|
for (let i = 0; i < nB; i++) {
|
|
133
|
-
const d = ux
|
|
130
|
+
const d = v3_dot(ux, uy, uz, wvB[i * 3], wvB[i * 3 + 1], wvB[i * 3 + 2]);
|
|
134
131
|
if (d < minB) minB = d; if (d > maxB) maxB = d;
|
|
135
132
|
}
|
|
136
133
|
if (maxA < minB || maxB < minA) return true;
|
|
@@ -139,7 +136,7 @@ function test_axis(ux, uy, uz, nA, nB, kind, face) {
|
|
|
139
136
|
if (sat.kind === -1 || overlap < sat.overlap - (sat.overlap * TIE_REL + TIE_ABS)) {
|
|
140
137
|
sat.overlap = overlap;
|
|
141
138
|
const dcx = cenA[0] - cenB[0], dcy = cenA[1] - cenB[1], dcz = cenA[2] - cenB[2];
|
|
142
|
-
const sign = (ux
|
|
139
|
+
const sign = v3_dot(ux, uy, uz, dcx, dcy, dcz) >= 0 ? 1 : -1;
|
|
143
140
|
sat.nx = ux * sign; sat.ny = uy * sign; sat.nz = uz * sign;
|
|
144
141
|
sat.kind = kind; sat.face = face;
|
|
145
142
|
}
|
|
@@ -162,8 +159,8 @@ export function convex_convex_manifold(out, A, posA, rotA, B, posB, rotB) {
|
|
|
162
159
|
|
|
163
160
|
load_world(wvA, A.vertices, g_nA, posA, rotA);
|
|
164
161
|
load_world(wvB, B.vertices, g_nB, posB, rotB);
|
|
165
|
-
|
|
166
|
-
|
|
162
|
+
v3_array_centroid(cenA, 0, wvA, 0, g_nA);
|
|
163
|
+
v3_array_centroid(cenB, 0, wvB, 0, g_nB);
|
|
167
164
|
|
|
168
165
|
sat.kind = -1; sat.overlap = Infinity;
|
|
169
166
|
|
|
@@ -237,8 +234,8 @@ export function convex_hull_clip(out, A, posA, rotA, B, posB, rotB, nx, ny, nz)
|
|
|
237
234
|
// guard (transform positions) degenerates when the two origins nearly
|
|
238
235
|
// coincide — e.g. a tet resting base-to-base on another, both transforms at
|
|
239
236
|
// the contact plane — leaving the normal mis-oriented and the stack tunnels.
|
|
240
|
-
|
|
241
|
-
|
|
237
|
+
v3_array_centroid(cenA, 0, wvA, 0, g_nA);
|
|
238
|
+
v3_array_centroid(cenB, 0, wvB, 0, g_nB);
|
|
242
239
|
if (nx * (cenA[0] - cenB[0]) + ny * (cenA[1] - cenB[1]) + nz * (cenA[2] - cenB[2]) < 0) {
|
|
243
240
|
nx = -nx; ny = -ny; nz = -nz;
|
|
244
241
|
}
|
|
@@ -252,15 +249,15 @@ export function convex_hull_clip(out, A, posA, rotA, B, posB, rotB, nx, ny, nz)
|
|
|
252
249
|
let bestA = -Infinity, faceA = 0;
|
|
253
250
|
for (let f = 0; f < g_fA; f++) {
|
|
254
251
|
face_normal(tmp_n, wvA, g_flA, g_foA[f], g_foA[f + 1]);
|
|
255
|
-
const l =
|
|
256
|
-
const d = (tmp_n[0]
|
|
252
|
+
const l = v3_length(tmp_n[0], tmp_n[1], tmp_n[2]) || 1;
|
|
253
|
+
const d = v3_dot(tmp_n[0], tmp_n[1], tmp_n[2], -nx, -ny, -nz) / l;
|
|
257
254
|
if (d > bestA) { bestA = d; faceA = f; }
|
|
258
255
|
}
|
|
259
256
|
let bestB = -Infinity, faceB = 0;
|
|
260
257
|
for (let f = 0; f < g_fB; f++) {
|
|
261
258
|
face_normal(tmp_n, wvB, g_flB, g_foB[f], g_foB[f + 1]);
|
|
262
|
-
const l =
|
|
263
|
-
const d = (tmp_n[0]
|
|
259
|
+
const l = v3_length(tmp_n[0], tmp_n[1], tmp_n[2]) || 1;
|
|
260
|
+
const d = v3_dot(tmp_n[0], tmp_n[1], tmp_n[2], nx, ny, nz) / l;
|
|
264
261
|
if (d > bestB) { bestB = d; faceB = f; }
|
|
265
262
|
}
|
|
266
263
|
|
|
@@ -278,11 +275,11 @@ export function convex_hull_clip(out, A, posA, rotA, B, posB, rotB, nx, ny, nz)
|
|
|
278
275
|
function projection_overlap(nx, ny, nz) {
|
|
279
276
|
let minA = Infinity, maxB = -Infinity;
|
|
280
277
|
for (let i = 0; i < g_nA; i++) {
|
|
281
|
-
const d = nx
|
|
278
|
+
const d = v3_dot(nx, ny, nz, wvA[i * 3], wvA[i * 3 + 1], wvA[i * 3 + 2]);
|
|
282
279
|
if (d < minA) minA = d;
|
|
283
280
|
}
|
|
284
281
|
for (let i = 0; i < g_nB; i++) {
|
|
285
|
-
const d = nx
|
|
282
|
+
const d = v3_dot(nx, ny, nz, wvB[i * 3], wvB[i * 3 + 1], wvB[i * 3 + 2]);
|
|
286
283
|
if (d > maxB) maxB = d;
|
|
287
284
|
}
|
|
288
285
|
return maxB - minA;
|
|
@@ -292,12 +289,12 @@ function projection_overlap(nx, ny, nz) {
|
|
|
292
289
|
function emit_single_contact(out, nx, ny, nz, depth) {
|
|
293
290
|
let sa = -Infinity, ai = 0;
|
|
294
291
|
for (let i = 0; i < g_nA; i++) {
|
|
295
|
-
const d = -(nx
|
|
292
|
+
const d = -v3_dot(nx, ny, nz, wvA[i * 3], wvA[i * 3 + 1], wvA[i * 3 + 2]);
|
|
296
293
|
if (d > sa) { sa = d; ai = i; }
|
|
297
294
|
}
|
|
298
295
|
let sb = -Infinity, bi = 0;
|
|
299
296
|
for (let i = 0; i < g_nB; i++) {
|
|
300
|
-
const d = nx
|
|
297
|
+
const d = v3_dot(nx, ny, nz, wvB[i * 3], wvB[i * 3 + 1], wvB[i * 3 + 2]);
|
|
301
298
|
if (d > sb) { sb = d; bi = i; }
|
|
302
299
|
}
|
|
303
300
|
out[3] = 1;
|
|
@@ -335,8 +332,8 @@ function emit_face_manifold(out, ref_is_A, ref_face, nx, ny, nz) {
|
|
|
335
332
|
let inc_face = 0, most_anti = Infinity;
|
|
336
333
|
for (let f = 0; f < inc_fcount; f++) {
|
|
337
334
|
face_normal(tmp_n, inc_wv, inc_fl, inc_fo[f], inc_fo[f + 1]);
|
|
338
|
-
const l =
|
|
339
|
-
const dot = (tmp_n[0]
|
|
335
|
+
const l = v3_length(tmp_n[0], tmp_n[1], tmp_n[2]) || 1;
|
|
336
|
+
const dot = v3_dot(tmp_n[0], tmp_n[1], tmp_n[2], rmx, rmy, rmz) / l;
|
|
340
337
|
if (dot < most_anti) { most_anti = dot; inc_face = f; }
|
|
341
338
|
}
|
|
342
339
|
|
|
@@ -405,8 +402,8 @@ function clip_poly(src, n, dst, sx, sy, sz, ax, ay, az) {
|
|
|
405
402
|
const j = (i + 1) % n;
|
|
406
403
|
const px = src[i * 3], py = src[i * 3 + 1], pz = src[i * 3 + 2];
|
|
407
404
|
const qx = src[j * 3], qy = src[j * 3 + 1], qz = src[j * 3 + 2];
|
|
408
|
-
const dp = (px - ax
|
|
409
|
-
const dq = (qx - ax
|
|
405
|
+
const dp = v3_dot(px - ax, py - ay, pz - az, sx, sy, sz);
|
|
406
|
+
const dq = v3_dot(qx - ax, qy - ay, qz - az, sx, sy, sz);
|
|
410
407
|
const p_in = dp <= 0, q_in = dq <= 0;
|
|
411
408
|
if (p_in) { dst[m * 3] = px; dst[m * 3 + 1] = py; dst[m * 3 + 2] = pz; m++; }
|
|
412
409
|
if (p_in !== q_in) {
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
export function face_key(a: any, b: any, c: any): string;
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
2
|
+
* Exact, collision-free, order-independent key for a triangle's vertex triple:
|
|
3
|
+
* the three indices sorted ascending and joined with commas, so two faces with
|
|
4
|
+
* the same vertex set (any winding) map to the same key.
|
|
5
|
+
*
|
|
6
|
+
* @param {number} a first vertex index
|
|
7
|
+
* @param {number} b second vertex index
|
|
8
|
+
* @param {number} c third vertex index
|
|
9
|
+
* @returns {string} canonical `"x,y,z"` key with x ≤ y ≤ z
|
|
10
|
+
*/
|
|
11
|
+
export function face_key(a: number, b: number, c: number): string;
|
|
12
|
+
/**
|
|
13
|
+
* @param {MeshShape3D} meshShape
|
|
4
14
|
* @returns {{pieces: Array<{vertices:Float32Array, face_offsets:Uint32Array, face_loops:Uint32Array, aabb:Float64Array}>, bvh: BVH}}
|
|
5
15
|
*/
|
|
6
|
-
export function build_convex_decomposition(meshShape: {
|
|
7
|
-
tet_mesh;
|
|
8
|
-
tet_positions;
|
|
9
|
-
compute_bounding_box;
|
|
10
|
-
}): {
|
|
16
|
+
export function build_convex_decomposition(meshShape: MeshShape3D): {
|
|
11
17
|
pieces: Array<{
|
|
12
18
|
vertices: Float32Array;
|
|
13
19
|
face_offsets: Uint32Array;
|
|
@@ -16,12 +22,25 @@ export function build_convex_decomposition(meshShape: {
|
|
|
16
22
|
}>;
|
|
17
23
|
bvh: BVH;
|
|
18
24
|
};
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Build a clippable piece from its boundary triangles: coplanar-merge them into
|
|
27
|
+
* polygon faces and localise the vertex indices. Orientation is re-derived from
|
|
28
|
+
* the piece centroid, so the `boundary` triples may have any winding. Exported
|
|
29
|
+
* so the convex-mesh fast path ({@link mesh_convex_hull}) can build a single
|
|
30
|
+
* coplanar-merged hull from a whole mesh's boundary.
|
|
31
|
+
*
|
|
32
|
+
* @param {Float32Array|Float64Array|number[]} tp tet positions: flat `(x, y, z)`
|
|
33
|
+
* per vertex, indexed by global vertex index
|
|
34
|
+
* @param {Map<string, {a:number, b:number, c:number}>} boundary boundary faces
|
|
35
|
+
* keyed by {@link face_key}; each value is a vertex triple (any winding)
|
|
36
|
+
* @returns {{vertices: Float32Array, face_offsets: Uint32Array, face_loops: Uint32Array, aabb: Float64Array}}
|
|
37
|
+
* a clippable convex piece — local vertices, CSR polygon-face loops, and local AABB
|
|
38
|
+
*/
|
|
39
|
+
export function build_piece(tp: Float32Array | Float64Array | number[], boundary: Map<string, {
|
|
40
|
+
a: number;
|
|
41
|
+
b: number;
|
|
42
|
+
c: number;
|
|
43
|
+
}>): {
|
|
25
44
|
vertices: Float32Array;
|
|
26
45
|
face_offsets: Uint32Array;
|
|
27
46
|
face_loops: Uint32Array;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convex_decomposition.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/narrowphase/convex_decomposition.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"convex_decomposition.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/narrowphase/convex_decomposition.js"],"names":[],"mappings":"AA4CA;;;;;;;;;GASG;AACH,4BALW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CAQlB;AAED;;;GAGG;AACH;YAFsB,MAAM;QAAC,QAAQ,EAAC,YAAY,CAAC;QAAC,YAAY,EAAC,WAAW,CAAC;QAAC,UAAU,EAAC,WAAW,CAAC;QAAC,IAAI,EAAC,YAAY,CAAA;KAAC,CAAC;SAAO,GAAG;EAmHlI;AAED;;;;;;;;;;;;;GAaG;AACH,gCAPW,YAAY,GAAC,YAAY,GAAC,MAAM,EAAE,YAElC,IAAI,MAAM,EAAE;IAAC,CAAC,EAAC,MAAM,CAAC;IAAC,CAAC,EAAC,MAAM,CAAC;IAAC,CAAC,EAAC,MAAM,CAAA;CAAC,CAAC;cAE9B,YAAY;kBAAgB,WAAW;gBAAc,WAAW;UAAQ,YAAY;EAgG3G;AAzPD,kCAAiF;oBAvC7D,gCAAgC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { BVH } from "../../../core/bvh2/bvh3/BVH.js";
|
|
2
|
+
import { v3_compute_triangle_normal } from "../../../core/geom/3d/triangle/v3_compute_triangle_normal.js";
|
|
3
|
+
import { tetrahedral_mesh_tet_get_neighbours } from "../../../core/geom/3d/tetrahedra/tetrahedral_mesh_tet_get_neighbours.js";
|
|
4
|
+
import { v3_dot } from "../../../core/geom/vec3/v3_dot.js";
|
|
2
5
|
|
|
3
6
|
/**
|
|
4
7
|
* Greedy convex decomposition of a tetrahedralised mesh into a small set of
|
|
@@ -36,8 +39,20 @@ const PLANE_OFFSET_TOL = 1e-4;
|
|
|
36
39
|
// tet-face convention rather than keeping a parallel copy.
|
|
37
40
|
export const FACE_OPP = [[1, 2, 3, 0], [0, 2, 3, 1], [0, 1, 3, 2], [0, 1, 2, 3]];
|
|
38
41
|
|
|
42
|
+
// Reusable scratch for v3_compute_triangle_normal (writes a unit normal as 3 floats).
|
|
43
|
+
const _face_normal = new Float64Array(3);
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Exact, collision-free, order-independent key for a triangle's vertex triple:
|
|
47
|
+
* the three indices sorted ascending and joined with commas, so two faces with
|
|
48
|
+
* the same vertex set (any winding) map to the same key.
|
|
49
|
+
*
|
|
50
|
+
* @param {number} a first vertex index
|
|
51
|
+
* @param {number} b second vertex index
|
|
52
|
+
* @param {number} c third vertex index
|
|
53
|
+
* @returns {string} canonical `"x,y,z"` key with x ≤ y ≤ z
|
|
54
|
+
*/
|
|
39
55
|
export function face_key(a, b, c) {
|
|
40
|
-
// Exact, collision-free order-independent key for a triangle's vertex triple.
|
|
41
56
|
let x = a, y = b, z = c, t;
|
|
42
57
|
if (x > y) { t = x; x = y; y = t; }
|
|
43
58
|
if (y > z) { t = y; y = z; z = t; }
|
|
@@ -46,7 +61,7 @@ export function face_key(a, b, c) {
|
|
|
46
61
|
}
|
|
47
62
|
|
|
48
63
|
/**
|
|
49
|
-
* @param {
|
|
64
|
+
* @param {MeshShape3D} meshShape
|
|
50
65
|
* @returns {{pieces: Array<{vertices:Float32Array, face_offsets:Uint32Array, face_loops:Uint32Array, aabb:Float64Array}>, bvh: BVH}}
|
|
51
66
|
*/
|
|
52
67
|
export function build_convex_decomposition(meshShape) {
|
|
@@ -60,49 +75,20 @@ export function build_convex_decomposition(meshShape) {
|
|
|
60
75
|
const diag = Math.hypot(bb[3] - bb[0], bb[4] - bb[1], bb[5] - bb[2]) || 1;
|
|
61
76
|
const EPS = 1e-6 * diag;
|
|
62
77
|
|
|
63
|
-
// Tet vertices (global indices) and the 4 faces (each: 3 face verts + the
|
|
64
|
-
// opposite vertex, for outward orientation).
|
|
65
|
-
const tetV = new Int32Array(N * 4);
|
|
66
|
-
for (let t = 0; t < N; t++) {
|
|
67
|
-
for (let i = 0; i < 4; i++) tetV[t * 4 + i] = tm.getVertexIndex(t, i);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Adjacency: face-key → list of (tet) owners. Two tets sharing a face are
|
|
71
|
-
// neighbours. Exact triple stored alongside to resolve hash collisions.
|
|
72
|
-
const faceOwners = new Map(); // key → array of { tet, fi }
|
|
73
|
-
for (let t = 0; t < N; t++) {
|
|
74
|
-
for (let f = 0; f < 4; f++) {
|
|
75
|
-
const o = FACE_OPP[f];
|
|
76
|
-
const a = tetV[t * 4 + o[0]], b = tetV[t * 4 + o[1]], c = tetV[t * 4 + o[2]];
|
|
77
|
-
const k = face_key(a, b, c);
|
|
78
|
-
let arr = faceOwners.get(k);
|
|
79
|
-
if (arr === undefined) { arr = []; faceOwners.set(k, arr); }
|
|
80
|
-
arr.push({ tet: t, fi: f, a, b, c });
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
// tet → neighbour tets (sharing a face).
|
|
84
|
-
const neighbours = (t) => {
|
|
85
|
-
const out = [];
|
|
86
|
-
for (let f = 0; f < 4; f++) {
|
|
87
|
-
const o = FACE_OPP[f];
|
|
88
|
-
const a = tetV[t * 4 + o[0]], b = tetV[t * 4 + o[1]], c = tetV[t * 4 + o[2]];
|
|
89
|
-
const arr = faceOwners.get(face_key(a, b, c));
|
|
90
|
-
if (arr === undefined) continue;
|
|
91
|
-
for (const e of arr) if (e.tet !== t) out.push(e.tet);
|
|
92
|
-
}
|
|
93
|
-
return out;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
78
|
const visited = new Uint8Array(N);
|
|
97
79
|
const pieces = [];
|
|
98
80
|
|
|
81
|
+
// Per-tet face neighbours are read straight from the mesh's stored adjacency
|
|
82
|
+
// via tetrahedral_mesh_tet_get_neighbours; this is its reusable output scratch
|
|
83
|
+
// (a tet has at most 4 face neighbours).
|
|
84
|
+
const tet_neighbours = new Int32Array(4);
|
|
85
|
+
|
|
99
86
|
// Reusable boundary structure for the growing piece: key → oriented face.
|
|
100
87
|
for (let seed = 0; seed < N; seed++) {
|
|
101
88
|
if (visited[seed]) continue;
|
|
102
89
|
|
|
103
90
|
const boundary = new Map(); // key → {a,b,c (oriented), nx,ny,nz}
|
|
104
91
|
const pieceVerts = new Set();
|
|
105
|
-
const pieceTets = [];
|
|
106
92
|
|
|
107
93
|
// Toggle a tet's 4 faces against the boundary (its own inverse): a face
|
|
108
94
|
// shared with a piece tet cancels (becomes interior). Store just the
|
|
@@ -110,13 +96,13 @@ export function build_convex_decomposition(meshShape) {
|
|
|
110
96
|
const toggle_tet_faces = (t) => {
|
|
111
97
|
for (let f = 0; f < 4; f++) {
|
|
112
98
|
const o = FACE_OPP[f];
|
|
113
|
-
const a =
|
|
99
|
+
const a = tm.getVertexIndex(t, o[0]), b = tm.getVertexIndex(t, o[1]), c = tm.getVertexIndex(t, o[2]);
|
|
114
100
|
const k = face_key(a, b, c);
|
|
115
101
|
if (boundary.has(k)) boundary.delete(k);
|
|
116
102
|
else boundary.set(k, { a, b, c });
|
|
117
103
|
}
|
|
118
104
|
};
|
|
119
|
-
const add_verts = (t) => { for (let i = 0; i < 4; i++) pieceVerts.add(
|
|
105
|
+
const add_verts = (t) => { for (let i = 0; i < 4; i++) pieceVerts.add(tm.getVertexIndex(t, i)); };
|
|
120
106
|
|
|
121
107
|
// Convex iff every boundary-face PLANE is supporting: all vertices lie
|
|
122
108
|
// on one side of it. Orientation-free — no need to know which side is
|
|
@@ -124,20 +110,20 @@ export function build_convex_decomposition(meshShape) {
|
|
|
124
110
|
const convex_with = (candVerts) => {
|
|
125
111
|
for (const [, fc] of boundary) {
|
|
126
112
|
const ax = tp[fc.a * 3], ay = tp[fc.a * 3 + 1], az = tp[fc.a * 3 + 2];
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
nx
|
|
113
|
+
v3_compute_triangle_normal(_face_normal, 0,
|
|
114
|
+
ax, ay, az,
|
|
115
|
+
tp[fc.b * 3], tp[fc.b * 3 + 1], tp[fc.b * 3 + 2],
|
|
116
|
+
tp[fc.c * 3], tp[fc.c * 3 + 1], tp[fc.c * 3 + 2]);
|
|
117
|
+
const nx = _face_normal[0], ny = _face_normal[1], nz = _face_normal[2];
|
|
132
118
|
let pos = false, neg = false;
|
|
133
119
|
for (const v of pieceVerts) {
|
|
134
|
-
const d = nx
|
|
120
|
+
const d = v3_dot(nx, ny, nz, tp[v * 3] - ax, tp[v * 3 + 1] - ay, tp[v * 3 + 2] - az);
|
|
135
121
|
if (d > EPS) pos = true; else if (d < -EPS) neg = true;
|
|
136
122
|
if (pos && neg) return false;
|
|
137
123
|
}
|
|
138
124
|
for (let i = 0; i < 4; i++) {
|
|
139
125
|
const v = candVerts[i];
|
|
140
|
-
const d = nx
|
|
126
|
+
const d = v3_dot(nx, ny, nz, tp[v * 3] - ax, tp[v * 3 + 1] - ay, tp[v * 3 + 2] - az);
|
|
141
127
|
if (d > EPS) pos = true; else if (d < -EPS) neg = true;
|
|
142
128
|
if (pos && neg) return false;
|
|
143
129
|
}
|
|
@@ -146,13 +132,13 @@ export function build_convex_decomposition(meshShape) {
|
|
|
146
132
|
};
|
|
147
133
|
|
|
148
134
|
visited[seed] = 1;
|
|
149
|
-
pieceTets.push(seed);
|
|
150
135
|
toggle_tet_faces(seed);
|
|
151
136
|
add_verts(seed);
|
|
152
137
|
|
|
153
138
|
const tried = new Set([seed]);
|
|
154
|
-
const frontier =
|
|
155
|
-
|
|
139
|
+
const frontier = [];
|
|
140
|
+
const seed_nbr_count = tetrahedral_mesh_tet_get_neighbours(tm, tet_neighbours, 0, seed);
|
|
141
|
+
for (let i = 0; i < seed_nbr_count; i++) { frontier.push(tet_neighbours[i]); tried.add(tet_neighbours[i]); }
|
|
156
142
|
|
|
157
143
|
while (frontier.length > 0) {
|
|
158
144
|
const t = frontier.pop();
|
|
@@ -160,13 +146,14 @@ export function build_convex_decomposition(meshShape) {
|
|
|
160
146
|
|
|
161
147
|
// Tentatively add t: toggle its faces into the boundary, test
|
|
162
148
|
// convexity, then commit or revert (toggle is its own inverse).
|
|
163
|
-
const cand = [
|
|
149
|
+
const cand = [tm.getVertexIndex(t, 0), tm.getVertexIndex(t, 1), tm.getVertexIndex(t, 2), tm.getVertexIndex(t, 3)];
|
|
164
150
|
toggle_tet_faces(t);
|
|
165
151
|
if (convex_with(cand)) {
|
|
166
152
|
visited[t] = 1;
|
|
167
|
-
pieceTets.push(t);
|
|
168
153
|
add_verts(t);
|
|
169
|
-
|
|
154
|
+
const nbr_count = tetrahedral_mesh_tet_get_neighbours(tm, tet_neighbours, 0, t);
|
|
155
|
+
for (let i = 0; i < nbr_count; i++) {
|
|
156
|
+
const n = tet_neighbours[i];
|
|
170
157
|
if (!visited[n] && !tried.has(n)) { tried.add(n); frontier.push(n); }
|
|
171
158
|
}
|
|
172
159
|
} else {
|
|
@@ -192,11 +179,20 @@ export function build_convex_decomposition(meshShape) {
|
|
|
192
179
|
return { pieces, bvh };
|
|
193
180
|
}
|
|
194
181
|
|
|
195
|
-
/**
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
182
|
+
/**
|
|
183
|
+
* Build a clippable piece from its boundary triangles: coplanar-merge them into
|
|
184
|
+
* polygon faces and localise the vertex indices. Orientation is re-derived from
|
|
185
|
+
* the piece centroid, so the `boundary` triples may have any winding. Exported
|
|
186
|
+
* so the convex-mesh fast path ({@link mesh_convex_hull}) can build a single
|
|
187
|
+
* coplanar-merged hull from a whole mesh's boundary.
|
|
188
|
+
*
|
|
189
|
+
* @param {Float32Array|Float64Array|number[]} tp tet positions: flat `(x, y, z)`
|
|
190
|
+
* per vertex, indexed by global vertex index
|
|
191
|
+
* @param {Map<string, {a:number, b:number, c:number}>} boundary boundary faces
|
|
192
|
+
* keyed by {@link face_key}; each value is a vertex triple (any winding)
|
|
193
|
+
* @returns {{vertices: Float32Array, face_offsets: Uint32Array, face_loops: Uint32Array, aabb: Float64Array}}
|
|
194
|
+
* a clippable convex piece — local vertices, CSR polygon-face loops, and local AABB
|
|
195
|
+
*/
|
|
200
196
|
export function build_piece(tp, boundary) {
|
|
201
197
|
// Piece centroid (from boundary vertices) — strictly interior for a convex
|
|
202
198
|
// piece, so it orients every face normal outward unambiguously.
|
|
@@ -210,16 +206,16 @@ export function build_piece(tp, boundary) {
|
|
|
210
206
|
const groups = []; // { nx,ny,nz, off, tris: [[a,b,c], ...] }
|
|
211
207
|
for (const [, fc] of boundary) {
|
|
212
208
|
const ax = tp[fc.a * 3], ay = tp[fc.a * 3 + 1], az = tp[fc.a * 3 + 2];
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
nx
|
|
218
|
-
if (nx
|
|
219
|
-
const off = nx
|
|
209
|
+
v3_compute_triangle_normal(_face_normal, 0,
|
|
210
|
+
ax, ay, az,
|
|
211
|
+
tp[fc.b * 3], tp[fc.b * 3 + 1], tp[fc.b * 3 + 2],
|
|
212
|
+
tp[fc.c * 3], tp[fc.c * 3 + 1], tp[fc.c * 3 + 2]);
|
|
213
|
+
let nx = _face_normal[0], ny = _face_normal[1], nz = _face_normal[2];
|
|
214
|
+
if (v3_dot(nx, ny, nz, ax - pcx, ay - pcy, az - pcz) < 0) { nx = -nx; ny = -ny; nz = -nz; }
|
|
215
|
+
const off = v3_dot(nx, ny, nz, ax, ay, az);
|
|
220
216
|
let g = null;
|
|
221
217
|
for (const cand of groups) {
|
|
222
|
-
if (Math.abs(cand.nx
|
|
218
|
+
if (Math.abs(v3_dot(cand.nx, cand.ny, cand.nz, nx, ny, nz) - 1) < PLANE_NORMAL_TOL
|
|
223
219
|
&& Math.abs(cand.off - off) < PLANE_OFFSET_TOL) { g = cand; break; }
|
|
224
220
|
}
|
|
225
221
|
if (g === null) { g = { nx, ny, nz, off, tris: [] }; groups.push(g); }
|
|
@@ -252,7 +248,7 @@ export function build_piece(tp, boundary) {
|
|
|
252
248
|
|
|
253
249
|
const items = varr.map((gv) => {
|
|
254
250
|
const dx = tp[gv * 3] - cx, dy = tp[gv * 3 + 1] - cy, dz = tp[gv * 3 + 2] - cz;
|
|
255
|
-
return { gv, ang: Math.atan2(dx
|
|
251
|
+
return { gv, ang: Math.atan2(v3_dot(dx, dy, dz, vx, vy, vz), v3_dot(dx, dy, dz, ux, uy, uz)) };
|
|
256
252
|
});
|
|
257
253
|
items.sort((p, q) => p.ang - q.ang);
|
|
258
254
|
loops.push(items.map((it) => it.gv));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mesh_convex_hull.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/narrowphase/mesh_convex_hull.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mesh_convex_hull.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/narrowphase/mesh_convex_hull.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;;;GAIG;AACH,gDAJW;IAAC,QAAQ,CAAC;IAAC,aAAa,CAAC;IAAC,oBAAoB,CAAA;CAAC,GAC7C;IAAC,QAAQ,EAAC,YAAY,CAAC;IAAC,YAAY,EAAC,WAAW,CAAC;IAAC,UAAU,EAAC,WAAW,CAAC;IAAC,IAAI,EAAC,YAAY,CAAC;IAAC,OAAO,WAAS;CAAC,GAAC,IAAI,CAQ/H"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import { v3_compute_triangle_normal } from "../../../core/geom/3d/triangle/v3_compute_triangle_normal.js";
|
|
2
|
+
import { v3_dot } from "../../../core/geom/vec3/v3_dot.js";
|
|
1
3
|
import { build_piece, face_key, FACE_OPP } from "./convex_decomposition.js";
|
|
2
4
|
|
|
5
|
+
// Reusable scratch for v3_compute_triangle_normal (writes a unit normal as 3 floats).
|
|
6
|
+
const _face_normal = new Float64Array(3);
|
|
7
|
+
|
|
3
8
|
/**
|
|
4
9
|
* Convex fast path for a triangulated {@link MeshShape3D}: if the whole mesh is
|
|
5
10
|
* convex, represent it as a single coplanar-merged convex piece so it collides
|
|
@@ -73,15 +78,15 @@ function build_if_convex(meshShape) {
|
|
|
73
78
|
if (fc.count !== 1) continue;
|
|
74
79
|
boundaryCount++;
|
|
75
80
|
const ax = tp[fc.a * 3], ay = tp[fc.a * 3 + 1], az = tp[fc.a * 3 + 2];
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
v3_compute_triangle_normal(_face_normal, 0,
|
|
82
|
+
ax, ay, az,
|
|
83
|
+
tp[fc.b * 3], tp[fc.b * 3 + 1], tp[fc.b * 3 + 2],
|
|
84
|
+
tp[fc.c * 3], tp[fc.c * 3 + 1], tp[fc.c * 3 + 2]);
|
|
85
|
+
let ix = _face_normal[0], iy = _face_normal[1], iz = _face_normal[2];
|
|
79
86
|
const ox = tp[fc.opp * 3] - ax, oy = tp[fc.opp * 3 + 1] - ay, oz = tp[fc.opp * 3 + 2] - az;
|
|
80
|
-
if (
|
|
81
|
-
const len = Math.sqrt(nx * nx + ny * ny + nz * nz) || 1;
|
|
82
|
-
const ix = nx / len, iy = ny / len, iz = nz / len;
|
|
87
|
+
if (v3_dot(ix, iy, iz, ox, oy, oz) > 0) { ix = -ix; iy = -iy; iz = -iz; } // outward
|
|
83
88
|
for (let v = 0; v < nVerts; v++) {
|
|
84
|
-
const d = ix
|
|
89
|
+
const d = v3_dot(ix, iy, iz, tp[v * 3] - ax, tp[v * 3 + 1] - ay, tp[v * 3 + 2] - az);
|
|
85
90
|
if (d > EPS) return null; // a vertex in front of a face → concave
|
|
86
91
|
}
|
|
87
92
|
boundary.set(k, { a: fc.a, b: fc.b, c: fc.c });
|
|
@@ -95,7 +100,7 @@ function build_if_convex(meshShape) {
|
|
|
95
100
|
piece.support = function (result, result_offset, dx, dy, dz) {
|
|
96
101
|
let bi = 0, best = -Infinity;
|
|
97
102
|
for (let i = 0; i < vc; i++) {
|
|
98
|
-
const d = dx
|
|
103
|
+
const d = v3_dot(dx, dy, dz, v[i * 3], v[i * 3 + 1], v[i * 3 + 2]);
|
|
99
104
|
if (d > best) { best = d; bi = i; }
|
|
100
105
|
}
|
|
101
106
|
result[result_offset] = v[bi * 3];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refine_ray_concave.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/narrowphase/refine_ray_concave.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"refine_ray_concave.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/narrowphase/refine_ray_concave.js"],"names":[],"mappings":"AAwCA;;;;;;;;;GASG;AACH,qEARW;IAAC,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAA;CAAC,YAC5B,UAAU,MAAM,CAAC,MACjB,MAAM,MAAa,MAAM,MAAa,MAAM,MAC5C,MAAM,MAAa,MAAM,MAAa,MAAM,QAC5C,MAAM,aACN,YAAY,UAAQ,GAClB,MAAM,CAyGlB"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { v3_length } from "../../../core/geom/vec3/v3_length.js";
|
|
1
2
|
import { v3_quat3_apply } from "../../../core/geom/vec3/v3_quat3_apply.js";
|
|
3
|
+
import { v3_quat3_apply_inverse } from "../../../core/geom/vec3/v3_quat3_apply_inverse.js";
|
|
2
4
|
import { TRIANGLE_FLOAT_STRIDE } from "./decomposition/triangle_buffer_layout.js";
|
|
3
5
|
import { mesh_enumerate_triangles } from "./decomposition/mesh_enumerate_triangles.js";
|
|
4
6
|
import { heightmap_enumerate_triangles } from "./decomposition/heightmap_enumerate_triangles.js";
|
|
@@ -49,8 +51,8 @@ const AABB_FATTEN = 1e-5; // guards triangles whose AABB just abuts the segment
|
|
|
49
51
|
export function refine_ray_concave(shape, position, rotation, ox, oy, oz, dx, dy, dz, tMax, outNormal) {
|
|
50
52
|
const qx = rotation[0], qy = rotation[1], qz = rotation[2], qw = rotation[3];
|
|
51
53
|
// World → local (inverse body rotation; unit dir stays unit → t preserved).
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
v3_quat3_apply_inverse(lo, 0, ox - position.x, oy - position.y, oz - position.z, qx, qy, qz, qw);
|
|
55
|
+
v3_quat3_apply_inverse(ld, 0, dx, dy, dz, qx, qy, qz, qw);
|
|
54
56
|
const lox = lo[0], loy = lo[1], loz = lo[2];
|
|
55
57
|
const ldx = ld[0], ldy = ld[1], ldz = ld[2];
|
|
56
58
|
|
|
@@ -143,7 +145,7 @@ export function refine_ray_concave(shape, position, rotation, ox, oy, oz, dx, dy
|
|
|
143
145
|
if (!found) return Infinity;
|
|
144
146
|
|
|
145
147
|
// Normalise, orient to face the ray, then rotate the local normal to world.
|
|
146
|
-
let nl =
|
|
148
|
+
let nl = v3_length(nx, ny, nz);
|
|
147
149
|
if (nl === 0) nl = 1;
|
|
148
150
|
nx /= nl; ny /= nl; nz /= nl;
|
|
149
151
|
if (nx * ldx + ny * ldy + nz * ldz > 0) { nx = -nx; ny = -ny; nz = -nz; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refine_ray_hit.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/narrowphase/refine_ray_hit.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"refine_ray_hit.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/narrowphase/refine_ray_hit.js"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,iEAVW;IAAC,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAA;CAAC,YAC5B,UAAU,MAAM,CAAC,MACjB,MAAM,MAAa,MAAM,MAAa,MAAM,MAC5C,MAAM,MAAa,MAAM,MAAa,MAAM,QAC5C,MAAM,aACN,YAAY,UAAQ,GAElB,MAAM,CAsClB;AAzED;;;;;;GAMG;AACH,qCAFU,MAAM,CAEyB"}
|