@woosh/meep-engine 3.38.0 → 3.39.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/build/bundle-worker-image-decoder.js +1 -1
- package/build/bundle-worker-terrain.js +1 -1
- package/package.json +1 -1
- package/src/core/binary/BinaryBuffer.d.ts +11 -0
- package/src/core/binary/BinaryBuffer.d.ts.map +1 -1
- package/src/core/binary/BinaryBuffer.js +30 -0
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_intersects_aabb.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_intersects_aabb.js +28 -7
- package/src/core/geom/3d/aabb/aabb3_transform_oriented.d.ts +15 -0
- package/src/core/geom/3d/aabb/aabb3_transform_oriented.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_transform_oriented.js +41 -0
- package/src/core/geom/3d/aabb/aabb3_transform_oriented_inverse.d.ts +12 -0
- package/src/core/geom/3d/aabb/aabb3_transform_oriented_inverse.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_transform_oriented_inverse.js +27 -0
- package/src/core/geom/3d/gjk/gjk.js +3 -3
- package/src/core/geom/3d/gjk/gjk_distance.d.ts +94 -0
- package/src/core/geom/3d/gjk/gjk_distance.d.ts.map +1 -0
- package/src/core/geom/3d/gjk/gjk_distance.js +782 -0
- package/src/core/geom/3d/gjk/gjk_epa_penetration.d.ts +5 -4
- package/src/core/geom/3d/gjk/gjk_epa_penetration.d.ts.map +1 -1
- package/src/core/geom/3d/gjk/gjk_epa_penetration.js +14 -9
- package/src/core/geom/3d/gjk/minkowski_support.d.ts +11 -7
- package/src/core/geom/3d/gjk/minkowski_support.d.ts.map +1 -1
- package/src/core/geom/3d/gjk/minkowski_support.js +33 -9
- package/src/core/geom/3d/gjk/mpr.d.ts.map +1 -1
- package/src/core/geom/3d/gjk/mpr.js +26 -5
- package/src/core/geom/3d/line/line3_compute_segment_closest_point_to_aabb3_t.d.ts +15 -0
- package/src/core/geom/3d/line/line3_compute_segment_closest_point_to_aabb3_t.d.ts.map +1 -1
- package/src/core/geom/3d/line/line3_compute_segment_closest_point_to_aabb3_t.js +106 -33
- package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale.d.ts +2 -1
- package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale.d.ts.map +1 -1
- package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale.js +4 -8
- package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale_array.d.ts +32 -0
- package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale_array.d.ts.map +1 -0
- package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale_array.js +85 -0
- package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale_scalar.d.ts +3 -3
- package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale_scalar.d.ts.map +1 -1
- package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale_scalar.js +24 -34
- package/src/core/geom/3d/quaternion/quat3_integrate.d.ts +17 -0
- package/src/core/geom/3d/quaternion/quat3_integrate.d.ts.map +1 -1
- package/src/core/geom/3d/quaternion/quat3_integrate.js +45 -4
- package/src/core/geom/3d/quaternion/quat3_multiply.d.ts +16 -0
- package/src/core/geom/3d/quaternion/quat3_multiply.d.ts.map +1 -1
- package/src/core/geom/3d/quaternion/quat3_multiply.js +25 -0
- package/src/core/geom/3d/quaternion/quat3_nlerp.d.ts +18 -0
- package/src/core/geom/3d/quaternion/quat3_nlerp.d.ts.map +1 -1
- package/src/core/geom/3d/quaternion/quat3_nlerp.js +45 -0
- package/src/core/geom/3d/quaternion/quat3_shortest_arc.d.ts +17 -0
- package/src/core/geom/3d/quaternion/quat3_shortest_arc.d.ts.map +1 -1
- package/src/core/geom/3d/quaternion/quat3_shortest_arc.js +155 -94
- package/src/core/geom/3d/quaternion/quat3_to_matrix3.d.ts +12 -0
- package/src/core/geom/3d/quaternion/quat3_to_matrix3.d.ts.map +1 -1
- package/src/core/geom/3d/quaternion/quat3_to_matrix3.js +31 -0
- package/src/core/geom/3d/shape/AbstractShape3D.d.ts +20 -6
- package/src/core/geom/3d/shape/AbstractShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/AbstractShape3D.js +20 -6
- package/src/core/geom/3d/shape/BoxShape3D.d.ts +1 -1
- package/src/core/geom/3d/shape/BoxShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/BoxShape3D.js +5 -1
- package/src/core/geom/3d/shape/CapsuleShape3D.d.ts +1 -1
- package/src/core/geom/3d/shape/CapsuleShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/CapsuleShape3D.js +5 -1
- package/src/core/geom/3d/shape/ConvexHullShape3D.d.ts +25 -11
- package/src/core/geom/3d/shape/ConvexHullShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/ConvexHullShape3D.js +392 -22
- package/src/core/geom/3d/shape/CylinderShape3D.d.ts +8 -7
- package/src/core/geom/3d/shape/CylinderShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/CylinderShape3D.js +12 -7
- package/src/core/geom/3d/shape/HeightMapShape3D.d.ts +51 -8
- package/src/core/geom/3d/shape/HeightMapShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/HeightMapShape3D.js +260 -14
- package/src/core/geom/3d/shape/MeshShape3D.d.ts +61 -7
- package/src/core/geom/3d/shape/MeshShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/MeshShape3D.js +111 -20
- package/src/core/geom/3d/shape/PointShape3D.d.ts +1 -1
- package/src/core/geom/3d/shape/PointShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/PointShape3D.js +1 -1
- package/src/core/geom/3d/shape/PosedShape3D.d.ts +9 -0
- package/src/core/geom/3d/shape/PosedShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/PosedShape3D.js +36 -6
- package/src/core/geom/3d/shape/SphereShape3D.d.ts +1 -1
- package/src/core/geom/3d/shape/SphereShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/SphereShape3D.js +5 -1
- package/src/core/geom/3d/shape/TransformedShape3D.d.ts +12 -10
- package/src/core/geom/3d/shape/TransformedShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/TransformedShape3D.js +53 -19
- package/src/core/geom/3d/shape/Triangle3D.d.ts +1 -1
- package/src/core/geom/3d/shape/Triangle3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/Triangle3D.js +5 -1
- package/src/core/geom/3d/shape/UnionShape3D.d.ts +1 -1
- package/src/core/geom/3d/shape/UnionShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/UnionShape3D.js +19 -2
- package/src/core/geom/3d/shape/sdf/sdf3_box.d.ts +14 -0
- package/src/core/geom/3d/shape/sdf/sdf3_box.d.ts.map +1 -1
- package/src/core/geom/3d/shape/sdf/sdf3_box.js +67 -5
- package/src/core/geom/3d/shape/sdf/sdf3_capsule.d.ts +14 -0
- package/src/core/geom/3d/shape/sdf/sdf3_capsule.d.ts.map +1 -1
- package/src/core/geom/3d/shape/sdf/sdf3_capsule.js +61 -3
- package/src/core/geom/3d/shape/sdf/sdf3_cylinder.d.ts +14 -0
- package/src/core/geom/3d/shape/sdf/sdf3_cylinder.d.ts.map +1 -1
- package/src/core/geom/3d/shape/sdf/sdf3_cylinder.js +63 -4
- package/src/core/geom/3d/shape/sdf/sdf3_plane.d.ts +15 -0
- package/src/core/geom/3d/shape/sdf/sdf3_plane.d.ts.map +1 -1
- package/src/core/geom/3d/shape/sdf/sdf3_plane.js +64 -2
- package/src/core/geom/3d/shape/sdf/sdf3_sphere.d.ts +21 -0
- package/src/core/geom/3d/shape/sdf/sdf3_sphere.d.ts.map +1 -1
- package/src/core/geom/3d/shape/sdf/sdf3_sphere.js +66 -3
- package/src/core/geom/3d/shape/shape3_mesh_from_geometry.d.ts +2 -0
- package/src/core/geom/3d/shape/shape3_mesh_from_geometry.d.ts.map +1 -1
- package/src/core/geom/3d/shape/shape3_mesh_from_geometry.js +7 -0
- package/src/core/geom/3d/shape/util/mesh_compute_triangle_edge_flags.d.ts +41 -0
- package/src/core/geom/3d/shape/util/mesh_compute_triangle_edge_flags.d.ts.map +1 -0
- package/src/core/geom/3d/shape/util/mesh_compute_triangle_edge_flags.js +538 -0
- package/src/core/geom/3d/sphere/harmonics/sh_basis_at.d.ts +31 -0
- package/src/core/geom/3d/sphere/harmonics/sh_basis_at.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/sh_basis_at.js +85 -0
- package/src/core/geom/3d/sphere/harmonics/sh_vmf_window.d.ts +18 -0
- package/src/core/geom/3d/sphere/harmonics/sh_vmf_window.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/sh_vmf_window.js +19 -0
- package/src/core/geom/3d/triangle/TriangleEdgeFlags.d.ts +49 -0
- package/src/core/geom/3d/triangle/TriangleEdgeFlags.d.ts.map +1 -0
- package/src/core/geom/3d/triangle/TriangleEdgeFlags.js +55 -0
- package/src/core/geom/3d/triangle/tri3_classify_shared_edge.d.ts +42 -0
- package/src/core/geom/3d/triangle/tri3_classify_shared_edge.d.ts.map +1 -0
- package/src/core/geom/3d/triangle/tri3_classify_shared_edge.js +85 -0
- package/src/core/geom/3d/triangle/tri3_closest_point.d.ts +13 -0
- package/src/core/geom/3d/triangle/tri3_closest_point.d.ts.map +1 -1
- package/src/core/geom/3d/triangle/tri3_closest_point.js +36 -1
- package/src/core/geom/3d/triangle/tri3_closest_point_barycentric.d.ts +14 -0
- package/src/core/geom/3d/triangle/tri3_closest_point_barycentric.d.ts.map +1 -1
- package/src/core/geom/3d/triangle/tri3_closest_point_barycentric.js +40 -0
- package/src/core/geom/vec3/v3_quaternion_apply.d.ts +19 -0
- package/src/core/geom/vec3/v3_quaternion_apply.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_quaternion_apply.js +32 -0
- package/src/core/geom/vec3/v3_quaternion_apply_inverse.d.ts +19 -0
- package/src/core/geom/vec3/v3_quaternion_apply_inverse.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_quaternion_apply_inverse.js +32 -0
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts +135 -10
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.js +338 -105
- package/src/engine/control/first-person/abilities/Ability.d.ts +14 -5
- package/src/engine/control/first-person/abilities/Ability.d.ts.map +1 -1
- package/src/engine/control/first-person/abilities/Ability.js +14 -5
- package/src/engine/control/first-person/abilities/LedgeGrab.d.ts.map +1 -1
- package/src/engine/control/first-person/abilities/LedgeGrab.js +16 -12
- package/src/engine/control/first-person/abilities/Mantle.d.ts.map +1 -1
- package/src/engine/control/first-person/abilities/Mantle.js +5 -1
- package/src/engine/control/first-person/abilities/Slide.js +1 -1
- package/src/engine/control/first-person/collision/KinematicMover.d.ts +92 -14
- package/src/engine/control/first-person/collision/KinematicMover.d.ts.map +1 -1
- package/src/engine/control/first-person/collision/KinematicMover.js +218 -37
- package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.d.ts +5 -0
- package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.d.ts.map +1 -1
- package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.js +17 -10
- package/src/engine/ecs/EntityComponentDataset.d.ts.map +1 -1
- package/src/engine/ecs/EntityComponentDataset.js +27 -13
- package/src/engine/ecs/storage/populateEngineSerializationRegistry.d.ts.map +1 -1
- package/src/engine/ecs/storage/populateEngineSerializationRegistry.js +4 -0
- package/src/engine/ecs/transform/Transform64.d.ts +4 -2
- package/src/engine/ecs/transform/Transform64.d.ts.map +1 -1
- package/src/engine/ecs/transform/Transform64.js +10 -16
- package/src/engine/graphics/ecs/water/Water.d.ts +25 -63
- package/src/engine/graphics/ecs/water/Water.d.ts.map +1 -1
- package/src/engine/graphics/ecs/water/Water.js +110 -125
- package/src/engine/graphics/ecs/water/WaterSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/ecs/water/WaterSerializationAdapter.js +38 -74
- package/src/engine/graphics/ecs/water/WaterSerializationUpgrader_1_2.d.ts +1 -1
- package/src/engine/graphics/ecs/water/WaterSerializationUpgrader_1_2.d.ts.map +1 -1
- package/src/engine/graphics/ecs/water/WaterSerializationUpgrader_1_2.js +27 -18
- package/src/engine/graphics/ecs/water/WaterSerializationUpgrader_2_3.d.ts +12 -0
- package/src/engine/graphics/ecs/water/WaterSerializationUpgrader_2_3.d.ts.map +1 -0
- package/src/engine/graphics/ecs/water/WaterSerializationUpgrader_2_3.js +45 -0
- package/src/engine/graphics/ecs/water/WaterWaves.d.ts +33 -0
- package/src/engine/graphics/ecs/water/WaterWaves.d.ts.map +1 -0
- package/src/engine/graphics/ecs/water/WaterWaves.js +46 -0
- package/src/engine/graphics/ecs/water/WaterWavesSerializationAdapter.d.ts +17 -0
- package/src/engine/graphics/ecs/water/WaterWavesSerializationAdapter.d.ts.map +1 -0
- package/src/engine/graphics/ecs/water/WaterWavesSerializationAdapter.js +26 -0
- package/src/engine/graphics/texture/3d/scs3d_sample_linear.d.ts +22 -0
- package/src/engine/graphics/texture/3d/scs3d_sample_linear.d.ts.map +1 -1
- package/src/engine/graphics/texture/3d/scs3d_sample_linear.js +43 -1
- package/src/engine/graphics/texture/sampler/Sampler2D.d.ts +29 -3
- package/src/engine/graphics/texture/sampler/Sampler2D.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/Sampler2D.js +102 -14
- package/src/engine/graphics3/WaterSystem.d.ts +39 -3
- package/src/engine/graphics3/WaterSystem.d.ts.map +1 -1
- package/src/engine/graphics3/WaterSystem.js +134 -25
- package/src/engine/interpolation/BinaryInterpolationAdapter.d.ts +10 -4
- package/src/engine/interpolation/BinaryInterpolationAdapter.d.ts.map +1 -1
- package/src/engine/interpolation/BinaryInterpolationAdapter.js +11 -5
- package/src/engine/interpolation/InterpolationLog.d.ts +11 -5
- package/src/engine/interpolation/InterpolationLog.d.ts.map +1 -1
- package/src/engine/interpolation/InterpolationLog.js +12 -6
- package/src/engine/interpolation/InterpolationSystem.d.ts.map +1 -1
- package/src/engine/interpolation/InterpolationSystem.js +39 -8
- package/src/engine/interpolation/PoseInterpolationAdapter.d.ts +1 -1
- package/src/engine/interpolation/PoseInterpolationAdapter.d.ts.map +1 -1
- package/src/engine/interpolation/PoseInterpolationAdapter.js +51 -22
- package/src/engine/interpolation/TransformPoseSerializationAdapter.d.ts.map +1 -1
- package/src/engine/interpolation/TransformPoseSerializationAdapter.js +18 -23
- package/src/engine/network/adapters/QuaternionInterpolationAdapter.d.ts +1 -1
- package/src/engine/network/adapters/QuaternionInterpolationAdapter.d.ts.map +1 -1
- package/src/engine/network/adapters/QuaternionInterpolationAdapter.js +3 -1
- package/src/engine/network/adapters/TransformInterpolationAdapter.d.ts +1 -1
- package/src/engine/network/adapters/TransformInterpolationAdapter.d.ts.map +1 -1
- package/src/engine/network/adapters/TransformInterpolationAdapter.js +3 -1
- package/src/engine/network/adapters/Vector3InterpolationAdapter.d.ts.map +1 -1
- package/src/engine/network/adapters/Vector3InterpolationAdapter.js +5 -2
- package/src/engine/physics/body/SolverBodyState.d.ts.map +1 -1
- package/src/engine/physics/body/SolverBodyState.js +4 -5
- package/src/engine/physics/broadphase/compute_fat_world_aabb.d.ts +12 -0
- package/src/engine/physics/broadphase/compute_fat_world_aabb.d.ts.map +1 -1
- package/src/engine/physics/broadphase/compute_fat_world_aabb.js +28 -3
- package/src/engine/physics/ccd/linear_sweep.d.ts +42 -12
- package/src/engine/physics/ccd/linear_sweep.d.ts.map +1 -1
- package/src/engine/physics/ccd/linear_sweep.js +1131 -97
- package/src/engine/physics/cloth/collider/ClothColliderIndex.d.ts +13 -0
- package/src/engine/physics/cloth/collider/ClothColliderIndex.d.ts.map +1 -1
- package/src/engine/physics/cloth/collider/ClothColliderIndex.js +90 -22
- package/src/engine/physics/cloth/collider/cloth_collider_bounds.js +84 -24
- package/src/engine/physics/cloth/collider/cloth_collider_sdf.d.ts +46 -3
- package/src/engine/physics/cloth/collider/cloth_collider_sdf.d.ts.map +1 -1
- package/src/engine/physics/cloth/collider/cloth_collider_sdf.js +116 -68
- package/src/engine/physics/cloth/ecs/ClothWorld.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/ClothWorld.js +59 -47
- package/src/engine/physics/cloth/ecs/cloth_gather_colliders.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_gather_colliders.js +62 -55
- package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.js +46 -39
- package/src/engine/physics/cloth/ecs/cloth_write_back.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_write_back.js +41 -36
- package/src/engine/physics/cloth/playground/garment_build.js +6 -6
- package/src/engine/physics/cloth/playground/garment_main.js +18 -14
- package/src/engine/physics/cloth/solver/cloth_contact_find.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_contact_find.js +8 -5
- package/src/engine/physics/cloth/solver/cloth_solve_vertex.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_solve_vertex.js +8 -5
- package/src/engine/physics/cloth/solver/constraint/cloth_contact_row.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/constraint/cloth_contact_row.js +15 -15
- package/src/engine/physics/cloth/solver/find_non_finite_cloth_state.d.ts +5 -0
- package/src/engine/physics/cloth/solver/find_non_finite_cloth_state.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/find_non_finite_cloth_state.js +32 -9
- package/src/engine/physics/constraint/solve_constraints.d.ts +50 -8
- package/src/engine/physics/constraint/solve_constraints.d.ts.map +1 -1
- package/src/engine/physics/constraint/solve_constraints.js +703 -429
- package/src/engine/physics/contact/ManifoldStore.d.ts +12 -0
- package/src/engine/physics/contact/ManifoldStore.d.ts.map +1 -1
- package/src/engine/physics/contact/ManifoldStore.js +32 -0
- package/src/engine/physics/ecs/BodyKind.d.ts +16 -8
- package/src/engine/physics/ecs/BodyKind.d.ts.map +1 -1
- package/src/engine/physics/ecs/BodyKind.js +16 -8
- package/src/engine/physics/ecs/Collider.d.ts +7 -2
- package/src/engine/physics/ecs/Collider.d.ts.map +1 -1
- package/src/engine/physics/ecs/Collider.js +7 -2
- package/src/engine/physics/ecs/PhysicsEvents.d.ts +13 -0
- package/src/engine/physics/ecs/PhysicsEvents.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsEvents.js +13 -0
- package/src/engine/physics/ecs/PhysicsSystem.d.ts +320 -36
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.js +779 -81
- package/src/engine/physics/fluid/FluidField.d.ts.map +1 -1
- package/src/engine/physics/fluid/FluidField.js +5 -1
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +11 -9
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts.map +1 -1
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.js +7 -5
- package/src/engine/physics/fluid/ecs/fluid_reanchor_field.d.ts.map +1 -1
- package/src/engine/physics/fluid/ecs/fluid_reanchor_field.js +9 -7
- package/src/engine/physics/fluid/effector/ImpulseFluidEffector.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/ImpulseFluidEffector.js +3 -4
- package/src/engine/physics/fluid/effector/WakeFluidEffector.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/WakeFluidEffector.js +9 -7
- package/src/engine/physics/fluid/solver/v3_mac_advect_maccormack_velocity.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_mac_advect_maccormack_velocity.js +65 -43
- package/src/engine/physics/inertia/MASS_PROPERTIES_SIZE.d.ts +23 -0
- package/src/engine/physics/inertia/MASS_PROPERTIES_SIZE.d.ts.map +1 -0
- package/src/engine/physics/inertia/MASS_PROPERTIES_SIZE.js +22 -0
- package/src/engine/physics/inertia/convex_hull_mass_properties.d.ts +29 -0
- package/src/engine/physics/inertia/convex_hull_mass_properties.d.ts.map +1 -0
- package/src/engine/physics/inertia/convex_hull_mass_properties.js +117 -0
- package/src/engine/physics/inertia/mass_properties_accumulate.d.ts +24 -0
- package/src/engine/physics/inertia/mass_properties_accumulate.d.ts.map +1 -0
- package/src/engine/physics/inertia/mass_properties_accumulate.js +93 -0
- package/src/engine/physics/inertia/primitive_mass_properties.d.ts +46 -0
- package/src/engine/physics/inertia/primitive_mass_properties.d.ts.map +1 -0
- package/src/engine/physics/inertia/primitive_mass_properties.js +118 -0
- package/src/engine/physics/inertia/rigid_body_set_mass_properties.d.ts +27 -0
- package/src/engine/physics/inertia/rigid_body_set_mass_properties.d.ts.map +1 -0
- package/src/engine/physics/inertia/rigid_body_set_mass_properties.js +62 -0
- package/src/engine/physics/inertia/world_inverse_inertia.d.ts +67 -25
- package/src/engine/physics/inertia/world_inverse_inertia.d.ts.map +1 -1
- package/src/engine/physics/inertia/world_inverse_inertia.js +149 -26
- package/src/engine/physics/integration/integrate_position.d.ts +18 -19
- package/src/engine/physics/integration/integrate_position.d.ts.map +1 -1
- package/src/engine/physics/integration/integrate_position.js +40 -37
- package/src/engine/physics/integration/integrate_velocity.d.ts.map +1 -1
- package/src/engine/physics/integration/integrate_velocity.js +13 -4
- package/src/engine/physics/island/IslandBuilder.d.ts +124 -6
- package/src/engine/physics/island/IslandBuilder.d.ts.map +1 -1
- package/src/engine/physics/island/IslandBuilder.js +322 -19
- package/src/engine/physics/narrowphase/box_box_manifold.d.ts +13 -0
- package/src/engine/physics/narrowphase/box_box_manifold.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/box_box_manifold.js +95 -39
- package/src/engine/physics/narrowphase/box_triangle_contact.d.ts +40 -0
- package/src/engine/physics/narrowphase/box_triangle_contact.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/box_triangle_contact.js +415 -120
- package/src/engine/physics/narrowphase/capsule_contacts.d.ts +63 -0
- package/src/engine/physics/narrowphase/capsule_contacts.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/capsule_contacts.js +234 -46
- package/src/engine/physics/narrowphase/capsule_triangle_contact.d.ts +13 -0
- package/src/engine/physics/narrowphase/capsule_triangle_contact.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/capsule_triangle_contact.js +141 -93
- package/src/engine/physics/narrowphase/compute_penetration.d.ts +29 -11
- package/src/engine/physics/narrowphase/compute_penetration.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/compute_penetration.js +157 -34
- package/src/engine/physics/narrowphase/convex_convex_manifold.d.ts +76 -0
- package/src/engine/physics/narrowphase/convex_convex_manifold.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/convex_convex_manifold.js +243 -48
- package/src/engine/physics/narrowphase/decomposition/decompose_to_triangles.d.ts +13 -0
- package/src/engine/physics/narrowphase/decomposition/decompose_to_triangles.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/decomposition/decompose_to_triangles.js +28 -12
- package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.d.ts +13 -0
- package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.js +27 -0
- package/src/engine/physics/narrowphase/decomposition/heightmap_triangle_edge_flags.d.ts +42 -0
- package/src/engine/physics/narrowphase/decomposition/heightmap_triangle_edge_flags.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/heightmap_triangle_edge_flags.js +250 -0
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.d.ts +27 -11
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.js +291 -12
- package/src/engine/physics/narrowphase/decomposition/triangle_buffer_layout.d.ts +7 -1
- package/src/engine/physics/narrowphase/decomposition/triangle_buffer_layout.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/decomposition/triangle_buffer_layout.js +7 -1
- package/src/engine/physics/narrowphase/decomposition/triangle_edge_flags.d.ts +35 -0
- package/src/engine/physics/narrowphase/decomposition/triangle_edge_flags.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/triangle_edge_flags.js +61 -0
- package/src/engine/physics/narrowphase/hull_sphere_contact.d.ts +54 -0
- package/src/engine/physics/narrowphase/hull_sphere_contact.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/hull_sphere_contact.js +244 -0
- package/src/engine/physics/narrowphase/mesh_convex_hull.js +5 -1
- package/src/engine/physics/narrowphase/mesh_mesh_tet_manifold.d.ts +2 -0
- package/src/engine/physics/narrowphase/mesh_mesh_tet_manifold.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/mesh_mesh_tet_manifold.js +56 -31
- package/src/engine/physics/narrowphase/narrowphase_step.d.ts +6 -5
- package/src/engine/physics/narrowphase/narrowphase_step.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/narrowphase_step.js +2185 -483
- package/src/engine/physics/narrowphase/reduce_manifold_contacts.d.ts +56 -5
- package/src/engine/physics/narrowphase/reduce_manifold_contacts.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/reduce_manifold_contacts.js +546 -5
- package/src/engine/physics/narrowphase/refine_ray_concave.d.ts +29 -2
- package/src/engine/physics/narrowphase/refine_ray_concave.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/refine_ray_concave.js +628 -75
- package/src/engine/physics/narrowphase/refine_ray_hit.d.ts +3 -2
- package/src/engine/physics/narrowphase/refine_ray_hit.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/refine_ray_hit.js +3 -2
- package/src/engine/physics/narrowphase/rigid_subject_pose.d.ts +27 -0
- package/src/engine/physics/narrowphase/rigid_subject_pose.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/rigid_subject_pose.js +96 -0
- package/src/engine/physics/narrowphase/sphere_box_contact.d.ts +14 -0
- package/src/engine/physics/narrowphase/sphere_box_contact.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/sphere_box_contact.js +51 -5
- package/src/engine/physics/narrowphase/sphere_sphere_contact.d.ts +12 -0
- package/src/engine/physics/narrowphase/sphere_sphere_contact.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/sphere_sphere_contact.js +30 -0
- package/src/engine/physics/narrowphase/sphere_triangle_contact.d.ts +12 -0
- package/src/engine/physics/narrowphase/sphere_triangle_contact.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/sphere_triangle_contact.js +37 -8
- package/src/engine/physics/narrowphase/support_feature_manifold.d.ts +139 -0
- package/src/engine/physics/narrowphase/support_feature_manifold.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/support_feature_manifold.js +949 -0
- package/src/engine/physics/queries/PhysicsSurfacePoint.d.ts +32 -13
- package/src/engine/physics/queries/PhysicsSurfacePoint.d.ts.map +1 -1
- package/src/engine/physics/queries/PhysicsSurfacePoint.js +36 -13
- package/src/engine/physics/queries/convex_overlaps_shape.d.ts +27 -0
- package/src/engine/physics/queries/convex_overlaps_shape.d.ts.map +1 -0
- package/src/engine/physics/queries/convex_overlaps_shape.js +169 -0
- package/src/engine/physics/queries/overlap_shape.d.ts.map +1 -1
- package/src/engine/physics/queries/overlap_shape.js +57 -79
- package/src/engine/physics/queries/raycast.d.ts +10 -4
- package/src/engine/physics/queries/raycast.d.ts.map +1 -1
- package/src/engine/physics/queries/raycast.js +133 -9
- package/src/engine/physics/queries/shape_cast.d.ts +55 -24
- package/src/engine/physics/queries/shape_cast.d.ts.map +1 -1
- package/src/engine/physics/queries/shape_cast.js +2061 -245
- package/src/engine/physics/solver/apply_impulse_to_body.d.ts +32 -10
- package/src/engine/physics/solver/apply_impulse_to_body.d.ts.map +1 -1
- package/src/engine/physics/solver/apply_impulse_to_body.js +69 -28
- package/src/engine/physics/solver/solve_contacts.d.ts +65 -18
- package/src/engine/physics/solver/solve_contacts.d.ts.map +1 -1
- package/src/engine/physics/solver/solve_contacts.js +458 -234
- package/src/engine/physics/vehicle/RaycastVehicle.d.ts.map +1 -1
- package/src/engine/physics/vehicle/RaycastVehicle.js +5 -6
- package/src/shade/assets/textures/split_sum.bin +0 -0
- package/src/shade/device/mock/SoftwareGPUQueue.d.ts.map +1 -1
- package/src/shade/device/mock/SoftwareGPUQueue.js +2 -1
- package/src/shade/playground/path_traced_media/README.md +78 -0
- package/src/shade/playground/path_traced_media/capture_radiance.d.ts +33 -0
- package/src/shade/playground/path_traced_media/capture_radiance.d.ts.map +1 -0
- package/src/shade/playground/path_traced_media/capture_radiance.js +174 -0
- package/src/shade/playground/path_traced_media/checks.d.ts +160 -0
- package/src/shade/playground/path_traced_media/checks.d.ts.map +1 -0
- package/src/shade/playground/path_traced_media/checks.js +921 -0
- package/src/shade/playground/path_traced_media/index.html +71 -0
- package/src/shade/playground/path_traced_media/main.d.ts +2 -0
- package/src/shade/playground/path_traced_media/main.d.ts.map +1 -0
- package/src/shade/playground/path_traced_media/main.js +440 -0
- package/src/shade/playground/path_traced_media/make_wave_pool_geometry.d.ts +26 -0
- package/src/shade/playground/path_traced_media/make_wave_pool_geometry.d.ts.map +1 -0
- package/src/shade/playground/path_traced_media/make_wave_pool_geometry.js +117 -0
- package/src/shade/playground/path_traced_media/views.d.ts +21 -0
- package/src/shade/playground/path_traced_media/views.d.ts.map +1 -0
- package/src/shade/playground/path_traced_media/views.js +161 -0
- package/src/shade/playground/sh_exponential/README.md +43 -0
- package/src/shade/playground/sh_exponential/index.html +59 -0
- package/src/shade/playground/sh_exponential/main.d.ts +2 -0
- package/src/shade/playground/sh_exponential/main.d.ts.map +1 -0
- package/src/shade/playground/sh_exponential/main.js +571 -0
- package/src/shade/playground/sh_exponential/sh_exp_playground_shaders.d.ts +46 -0
- package/src/shade/playground/sh_exponential/sh_exp_playground_shaders.d.ts.map +1 -0
- package/src/shade/playground/sh_exponential/sh_exp_playground_shaders.js +270 -0
- package/src/shade/playground/water_refraction/README.md +24 -15
- package/src/shade/playground/water_refraction/index.html +6 -8
- package/src/shade/playground/water_refraction/main.js +12 -11
- package/src/shade/playground/water_refraction/world.d.ts +2 -0
- package/src/shade/playground/water_refraction/world.d.ts.map +1 -1
- package/src/shade/playground/water_refraction/world.js +8 -4
- package/src/shade/renderer/Renderer.d.ts +2 -0
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +23 -0
- package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_draw.d.ts.map +1 -1
- package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_draw.js +9 -1
- package/src/shade/renderer/geometry/sdf/chunk_scene_point_query_volume_sign.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/chunk_scene_point_query_volume_sign.js +6 -4
- package/src/shade/renderer/global_illumination/brick4/gpu/bake/brick4_bake_basic.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/brick4/gpu/bake/brick4_bake_basic.js +1 -0
- package/src/shade/renderer/global_illumination/brick4/gpu/bake/sampling/chunk_direction_by_index_rand1.d.ts +7 -0
- package/src/shade/renderer/global_illumination/brick4/gpu/bake/sampling/chunk_direction_by_index_rand1.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/brick4/gpu/bake/sampling/chunk_direction_by_index_rand1.js +12 -12
- package/src/shade/renderer/global_illumination/brick4/gpu/bake/sampling/chunk_direction_by_index_spherical.d.ts +4 -0
- package/src/shade/renderer/global_illumination/brick4/gpu/bake/sampling/chunk_direction_by_index_spherical.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/brick4/gpu/bake/sampling/chunk_direction_by_index_spherical.js +13 -9
- package/src/shade/renderer/global_illumination/brick4/gpu/bake/shader_brick4_bake_probes.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/brick4/gpu/bake/shader_brick4_bake_probes.js +2 -0
- package/src/shade/renderer/global_illumination/lpv/bake/GPULightProbeVolumeRenderer.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/lpv/bake/GPULightProbeVolumeRenderer.js +3 -0
- package/src/shade/renderer/global_illumination/lpv/deprecated/probe_trace_compute_shader_code.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/lpv/deprecated/probe_trace_compute_shader_code.js +4 -9
- package/src/shade/renderer/light/LIGHT_DATABASE_SPEC.d.ts.map +1 -1
- package/src/shade/renderer/light/LIGHT_DATABASE_SPEC.js +20 -10
- package/src/shade/renderer/light/environment/rgbe/load_environment_map.d.ts +2 -1
- package/src/shade/renderer/light/environment/rgbe/load_environment_map.d.ts.map +1 -1
- package/src/shade/renderer/light/environment/rgbe/load_environment_map.js +2 -1
- package/src/shade/renderer/light/environment/sh_exponential/README.md +171 -0
- package/src/shade/renderer/light/environment/sh_exponential/SHExpEncoder.d.ts +170 -0
- package/src/shade/renderer/light/environment/sh_exponential/SHExpEncoder.d.ts.map +1 -0
- package/src/shade/renderer/light/environment/sh_exponential/SHExpEncoder.js +377 -0
- package/src/shade/renderer/light/environment/sh_exponential/SH_EXP_ENCODE_PARAMETERS_STRUCT.d.ts +16 -0
- package/src/shade/renderer/light/environment/sh_exponential/SH_EXP_ENCODE_PARAMETERS_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/light/environment/sh_exponential/SH_EXP_ENCODE_PARAMETERS_STRUCT.js +27 -0
- package/src/shade/renderer/light/environment/sh_exponential/chunk_sh_exp_workgroup_sum.d.ts +21 -0
- package/src/shade/renderer/light/environment/sh_exponential/chunk_sh_exp_workgroup_sum.d.ts.map +1 -0
- package/src/shade/renderer/light/environment/sh_exponential/chunk_sh_exp_workgroup_sum.js +53 -0
- package/src/shade/renderer/light/environment/sh_exponential/sh_exp_design_row.d.ts +33 -0
- package/src/shade/renderer/light/environment/sh_exponential/sh_exp_design_row.d.ts.map +1 -0
- package/src/shade/renderer/light/environment/sh_exponential/sh_exp_design_row.js +90 -0
- package/src/shade/renderer/light/environment/sh_exponential/sh_exp_fit_samples.d.ts +28 -0
- package/src/shade/renderer/light/environment/sh_exponential/sh_exp_fit_samples.d.ts.map +1 -0
- package/src/shade/renderer/light/environment/sh_exponential/sh_exp_fit_samples.js +92 -0
- package/src/shade/renderer/light/environment/sh_exponential/sh_exp_layout.d.ts +39 -0
- package/src/shade/renderer/light/environment/sh_exponential/sh_exp_layout.d.ts.map +1 -0
- package/src/shade/renderer/light/environment/sh_exponential/sh_exp_layout.js +44 -0
- package/src/shade/renderer/light/environment/sh_exponential/sh_exp_solve_matrix.d.ts +42 -0
- package/src/shade/renderer/light/environment/sh_exponential/sh_exp_solve_matrix.d.ts.map +1 -0
- package/src/shade/renderer/light/environment/sh_exponential/sh_exp_solve_matrix.js +123 -0
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_environment_cells.d.ts +30 -0
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_environment_cells.d.ts.map +1 -0
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_environment_cells.js +147 -0
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_log_floor.d.ts +24 -0
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_log_floor.d.ts.map +1 -0
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_log_floor.js +79 -0
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_project.d.ts +17 -0
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_project.d.ts.map +1 -0
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_project.js +99 -0
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_reference_reflectance.d.ts +24 -0
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_reference_reflectance.d.ts.map +1 -0
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_reference_reflectance.js +104 -0
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_solve.d.ts +12 -0
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_solve.d.ts.map +1 -0
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_solve.js +93 -0
- package/src/shade/renderer/lightmap/GPULightMap.d.ts.map +1 -1
- package/src/shade/renderer/lightmap/GPULightMap.js +1 -0
- package/src/shade/renderer/lightmap/bake/shader_lightmap_viz_to_irradiance_flat.d.ts.map +1 -1
- package/src/shade/renderer/lightmap/bake/shader_lightmap_viz_to_irradiance_flat.js +4 -0
- package/src/shade/renderer/lightmap/bake/shader_lightmap_viz_to_sh.d.ts.map +1 -1
- package/src/shade/renderer/lightmap/bake/shader_lightmap_viz_to_sh.js +4 -0
- package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
- package/src/shade/renderer/material/PIXEL_TEXTURE_ORM.d.ts +1 -1
- package/src/shade/renderer/material/PIXEL_TEXTURE_ORM.d.ts.map +1 -1
- package/src/shade/renderer/material/StandardShadeMaterial.d.ts +15 -0
- package/src/shade/renderer/material/StandardShadeMaterial.d.ts.map +1 -1
- package/src/shade/renderer/material/StandardShadeMaterial.js +17 -0
- package/src/shade/renderer/material/resident/GPUResidentMaterialContext.d.ts +36 -2
- package/src/shade/renderer/material/resident/GPUResidentMaterialContext.d.ts.map +1 -1
- package/src/shade/renderer/material/resident/GPUResidentMaterialContext.js +218 -18
- package/src/shade/renderer/material/resident/INDIRECT_MATERIAL_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/material/resident/INDIRECT_MATERIAL_STRUCT.js +10 -0
- package/src/shade/renderer/medium/MEDIA_TABLE_STRUCT.d.ts +17 -0
- package/src/shade/renderer/medium/MEDIA_TABLE_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/medium/MEDIA_TABLE_STRUCT.js +24 -0
- package/src/shade/renderer/medium/MEDIUM_PHASE_LOBE_KIND.d.ts +24 -0
- package/src/shade/renderer/medium/MEDIUM_PHASE_LOBE_KIND.d.ts.map +1 -0
- package/src/shade/renderer/medium/MEDIUM_PHASE_LOBE_KIND.js +18 -0
- package/src/shade/renderer/medium/MEDIUM_STRUCT.d.ts +20 -0
- package/src/shade/renderer/medium/MEDIUM_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/medium/MEDIUM_STRUCT.js +43 -0
- package/src/shade/renderer/medium/ParticipatingMedium.d.ts +108 -0
- package/src/shade/renderer/medium/ParticipatingMedium.d.ts.map +1 -0
- package/src/shade/renderer/medium/ParticipatingMedium.js +204 -0
- package/src/shade/renderer/medium/chunk_medium_lobe_phase.d.ts +13 -0
- package/src/shade/renderer/medium/chunk_medium_lobe_phase.d.ts.map +1 -0
- package/src/shade/renderer/medium/chunk_medium_lobe_phase.js +33 -0
- package/src/shade/renderer/medium/participating_medium_serialization.d.ts +32 -0
- package/src/shade/renderer/medium/participating_medium_serialization.d.ts.map +1 -0
- package/src/shade/renderer/medium/participating_medium_serialization.js +181 -0
- package/src/shade/renderer/medium/phase/MediumPhaseFunction.d.ts +48 -0
- package/src/shade/renderer/medium/phase/MediumPhaseFunction.d.ts.map +1 -0
- package/src/shade/renderer/medium/phase/MediumPhaseFunction.js +42 -0
- package/src/shade/renderer/medium/phase/PhaseCornetteShanks.d.ts +23 -0
- package/src/shade/renderer/medium/phase/PhaseCornetteShanks.d.ts.map +1 -0
- package/src/shade/renderer/medium/phase/PhaseCornetteShanks.js +45 -0
- package/src/shade/renderer/medium/phase/PhaseDraine.d.ts +30 -0
- package/src/shade/renderer/medium/phase/PhaseDraine.d.ts.map +1 -0
- package/src/shade/renderer/medium/phase/PhaseDraine.js +58 -0
- package/src/shade/renderer/medium/phase/PhaseFournierForand.d.ts +24 -0
- package/src/shade/renderer/medium/phase/PhaseFournierForand.d.ts.map +1 -0
- package/src/shade/renderer/medium/phase/PhaseFournierForand.js +53 -0
- package/src/shade/renderer/medium/phase/PhaseHenyeyGreenstein.d.ts +21 -0
- package/src/shade/renderer/medium/phase/PhaseHenyeyGreenstein.d.ts.map +1 -0
- package/src/shade/renderer/medium/phase/PhaseHenyeyGreenstein.js +43 -0
- package/src/shade/renderer/medium/phase/PhaseJendersieDeon.d.ts +25 -0
- package/src/shade/renderer/medium/phase/PhaseJendersieDeon.d.ts.map +1 -0
- package/src/shade/renderer/medium/phase/PhaseJendersieDeon.js +66 -0
- package/src/shade/renderer/medium/phase/PhaseRayleigh.d.ts +9 -0
- package/src/shade/renderer/medium/phase/PhaseRayleigh.d.ts.map +1 -0
- package/src/shade/renderer/medium/phase/PhaseRayleigh.js +21 -0
- package/src/shade/renderer/medium/phase/PhaseWaterMolecular.d.ts +28 -0
- package/src/shade/renderer/medium/phase/PhaseWaterMolecular.d.ts.map +1 -0
- package/src/shade/renderer/medium/phase/PhaseWaterMolecular.js +49 -0
- package/src/shade/renderer/medium/water/WATER_DEFAULT_PATH_LENGTHS.d.ts +10 -0
- package/src/shade/renderer/medium/water/WATER_DEFAULT_PATH_LENGTHS.d.ts.map +1 -0
- package/src/shade/renderer/medium/water/WATER_DEFAULT_PATH_LENGTHS.js +25 -0
- package/src/shade/renderer/medium/water/water_iop_from_appearance.d.ts +47 -0
- package/src/shade/renderer/medium/water/water_iop_from_appearance.d.ts.map +1 -0
- package/src/shade/renderer/medium/water/water_iop_from_appearance.js +174 -0
- package/src/shade/renderer/medium/water/water_iop_from_constituents.d.ts +57 -0
- package/src/shade/renderer/medium/water/water_iop_from_constituents.d.ts.map +1 -0
- package/src/shade/renderer/medium/water/water_iop_from_constituents.js +242 -0
- package/src/shade/renderer/medium/water/water_iop_jerlov.d.ts +41 -0
- package/src/shade/renderer/medium/water/water_iop_jerlov.d.ts.map +1 -0
- package/src/shade/renderer/medium/water/water_iop_jerlov.js +231 -0
- package/src/shade/renderer/medium/water/water_iop_spectral_reference.d.ts +66 -0
- package/src/shade/renderer/medium/water/water_iop_spectral_reference.d.ts.map +1 -0
- package/src/shade/renderer/medium/water/water_iop_spectral_reference.js +223 -0
- package/src/shade/renderer/medium/water/water_medium_from_iop.d.ts +96 -0
- package/src/shade/renderer/medium/water/water_medium_from_iop.d.ts.map +1 -0
- package/src/shade/renderer/medium/water/water_medium_from_iop.js +145 -0
- package/src/shade/renderer/medium/water/water_presets.d.ts +69 -0
- package/src/shade/renderer/medium/water/water_presets.d.ts.map +1 -0
- package/src/shade/renderer/medium/water/water_presets.js +119 -0
- package/src/shade/renderer/medium/water/water_rgb_from_spectral.d.ts +69 -0
- package/src/shade/renderer/medium/water/water_rgb_from_spectral.d.ts.map +1 -0
- package/src/shade/renderer/medium/water/water_rgb_from_spectral.js +341 -0
- package/src/shade/renderer/particles/DESIGN.md +4 -2
- package/src/shade/renderer/particles/shaders/chunk_particle_avboit_voxel_fade.d.ts +26 -0
- package/src/shade/renderer/particles/shaders/chunk_particle_avboit_voxel_fade.d.ts.map +1 -0
- package/src/shade/renderer/particles/shaders/chunk_particle_avboit_voxel_fade.js +71 -0
- package/src/shade/renderer/particles/shaders/shader_particle_avboit_draw.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_avboit_draw.js +16 -1
- package/src/shade/renderer/particles/shaders/shader_particle_avboit_splat.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_avboit_splat.js +6 -13
- package/src/shade/renderer/path_tracer/PATH_TRACED_MEDIA_PLAN_2026_10_02.md +520 -0
- package/src/shade/renderer/path_tracer/accumulating/AccumulatingPathTracer.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/accumulating/AccumulatingPathTracer.js +1 -0
- package/src/shade/renderer/path_tracer/accumulating/shader_accumulating_path_tracer.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/accumulating/shader_accumulating_path_tracer.js +2 -0
- package/src/shade/renderer/path_tracer/graph_path_trace_scene.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/graph_path_trace_scene.js +188 -185
- package/src/shade/renderer/path_tracer/shader/STANDARD_MATERIAL_DATA_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/shader/STANDARD_MATERIAL_DATA_STRUCT.js +4 -1
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_tangent_normal.d.ts +13 -0
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_tangent_normal.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_tangent_normal.js +29 -0
- package/src/shade/renderer/path_tracer/shader/chunk_render_trace_path.d.ts +79 -0
- package/src/shade/renderer/path_tracer/shader/chunk_render_trace_path.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/shader/chunk_render_trace_path.js +360 -70
- package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.js +4 -3
- package/src/shade/renderer/path_tracer/shader/manifold/chunk_manifold_beam.d.ts +24 -0
- package/src/shade/renderer/path_tracer/shader/manifold/chunk_manifold_beam.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/manifold/chunk_manifold_beam.js +99 -0
- package/src/shade/renderer/path_tracer/shader/manifold/chunk_manifold_connect.d.ts +68 -0
- package/src/shade/renderer/path_tracer/shader/manifold/chunk_manifold_connect.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/manifold/chunk_manifold_connect.js +263 -0
- package/src/shade/renderer/path_tracer/shader/manifold/chunk_manifold_constraint.d.ts +55 -0
- package/src/shade/renderer/path_tracer/shader/manifold/chunk_manifold_constraint.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/manifold/chunk_manifold_constraint.js +148 -0
- package/src/shade/renderer/path_tracer/shader/manifold/chunk_manifold_light.d.ts +17 -0
- package/src/shade/renderer/path_tracer/shader/manifold/chunk_manifold_light.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/manifold/chunk_manifold_light.js +41 -0
- package/src/shade/renderer/path_tracer/shader/manifold/chunk_manifold_light_sample.d.ts +20 -0
- package/src/shade/renderer/path_tracer/shader/manifold/chunk_manifold_light_sample.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/manifold/chunk_manifold_light_sample.js +105 -0
- package/src/shade/renderer/path_tracer/shader/manifold/chunk_manifold_triangle.d.ts +28 -0
- package/src/shade/renderer/path_tracer/shader/manifold/chunk_manifold_triangle.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/manifold/chunk_manifold_triangle.js +97 -0
- package/src/shade/renderer/path_tracer/shader/manifold/chunk_manifold_triangle_of_hit.d.ts +12 -0
- package/src/shade/renderer/path_tracer/shader/manifold/chunk_manifold_triangle_of_hit.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/manifold/chunk_manifold_triangle_of_hit.js +46 -0
- package/src/shade/renderer/path_tracer/shader/media/chunk_medium_interface.d.ts +25 -0
- package/src/shade/renderer/path_tracer/shader/media/chunk_medium_interface.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/media/chunk_medium_interface.js +75 -0
- package/src/shade/renderer/path_tracer/shader/media/chunk_medium_path.d.ts +54 -0
- package/src/shade/renderer/path_tracer/shader/media/chunk_medium_path.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/media/chunk_medium_path.js +245 -0
- package/src/shade/renderer/path_tracer/shader/media/chunk_medium_phase.d.ts +42 -0
- package/src/shade/renderer/path_tracer/shader/media/chunk_medium_phase.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/media/chunk_medium_phase.js +236 -0
- package/src/shade/renderer/path_tracer/shader/media/chunk_medium_scatter_nee.d.ts +24 -0
- package/src/shade/renderer/path_tracer/shader/media/chunk_medium_scatter_nee.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/media/chunk_medium_scatter_nee.js +97 -0
- package/src/shade/renderer/path_tracer/shader/media/chunk_medium_stack.d.ts +57 -0
- package/src/shade/renderer/path_tracer/shader/media/chunk_medium_stack.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/media/chunk_medium_stack.js +222 -0
- package/src/shade/renderer/path_tracer/shader/media/chunk_medium_transport.d.ts +88 -0
- package/src/shade/renderer/path_tracer/shader/media/chunk_medium_transport.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/media/chunk_medium_transport.js +304 -0
- package/src/shade/renderer/path_tracer/shader/media/chunk_medium_volumes.d.ts +35 -0
- package/src/shade/renderer/path_tracer/shader/media/chunk_medium_volumes.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/media/chunk_medium_volumes.js +137 -0
- package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_sample_history.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_sample_history.js +85 -84
- package/src/shade/renderer/rasterize/native/avboit/AVBOITSettings.d.ts +8 -0
- package/src/shade/renderer/rasterize/native/avboit/AVBOITSettings.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/AVBOITSettings.js +9 -0
- package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.d.ts +12 -2
- package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.js +12 -3
- package/src/shade/renderer/rasterize/native/avboit/AVBOIT_CONSTANTS.d.ts +13 -7
- package/src/shade/renderer/rasterize/native/avboit/AVBOIT_CONSTANTS.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/AVBOIT_CONSTANTS.js +13 -7
- package/src/shade/renderer/rasterize/native/avboit/AVBOIT_LEDGER.md +309 -0
- package/src/shade/renderer/rasterize/native/avboit/AVBOIT_PLAN_2026_09_03.md +54 -9
- package/src/shade/renderer/rasterize/native/avboit/avboit_draw_fragment_body.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/avboit_draw_fragment_body.js +9 -1
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_footprint_bias.d.ts +33 -0
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_footprint_bias.d.ts.map +1 -0
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_footprint_bias.js +45 -0
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_integral_depth_coordinate.d.ts +4 -0
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_integral_depth_coordinate.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_integral_depth_coordinate.js +6 -2
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_sample_transmittance.d.ts +2 -1
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_sample_transmittance.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_sample_transmittance.js +4 -2
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_warp_level_word.d.ts +14 -0
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_warp_level_word.d.ts.map +1 -0
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_warp_level_word.js +28 -0
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_warp_lut_entry.d.ts +10 -0
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_warp_lut_entry.d.ts.map +1 -0
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_warp_lut_entry.js +18 -0
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_warp_marks.d.ts +19 -0
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_warp_marks.d.ts.map +1 -0
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_warp_marks.js +44 -0
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_warp_step_count.d.ts +10 -0
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_warp_step_count.d.ts.map +1 -0
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_warp_step_count.js +17 -0
- package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.js +3 -1
- package/src/shade/renderer/rasterize/native/avboit/shader_avboit_build_warp.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/shader_avboit_build_warp.js +163 -64
- package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
- package/src/shade/renderer/scene/GPUSceneContext.js +4 -1
- package/src/shade/renderer/scene/SCENE_DATABASE_SPEC.d.ts.map +1 -1
- package/src/shade/renderer/scene/SCENE_DATABASE_SPEC.js +5 -0
- package/src/shade/renderer/shader/chunk/atmosphere/C_MIE_SCATTERING_DECLARATION.d.ts +12 -1
- package/src/shade/renderer/shader/chunk/atmosphere/C_MIE_SCATTERING_DECLARATION.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/atmosphere/C_MIE_SCATTERING_DECLARATION.js +22 -3
- package/src/shade/renderer/shader/chunk/atmosphere/phase/chunk_sample_henyey_greenstein_cos.d.ts +18 -0
- package/src/shade/renderer/shader/chunk/atmosphere/phase/chunk_sample_henyey_greenstein_cos.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/atmosphere/phase/chunk_sample_henyey_greenstein_cos.js +31 -0
- package/src/shade/renderer/shader/chunk/atmosphere/phase/ff/chunk_phase_fournier_forand.d.ts +43 -0
- package/src/shade/renderer/shader/chunk/atmosphere/phase/ff/chunk_phase_fournier_forand.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/atmosphere/phase/ff/chunk_phase_fournier_forand.js +153 -0
- package/src/shade/renderer/shader/chunk/atmosphere/phase/ff/chunk_sample_fournier_forand.d.ts +13 -0
- package/src/shade/renderer/shader/chunk/atmosphere/phase/ff/chunk_sample_fournier_forand.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/atmosphere/phase/ff/chunk_sample_fournier_forand.js +57 -0
- package/src/shade/renderer/shader/chunk/atmosphere/phase/ff/fournier_forand_parameters_from_backscatter.d.ts +45 -0
- package/src/shade/renderer/shader/chunk/atmosphere/phase/ff/fournier_forand_parameters_from_backscatter.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/atmosphere/phase/ff/fournier_forand_parameters_from_backscatter.js +109 -0
- package/src/shade/renderer/shader/chunk/atmosphere/phase/jd/chunk_phase_draine.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/atmosphere/phase/jd/chunk_phase_draine.js +6 -3
- package/src/shade/renderer/shader/chunk/atmosphere/phase/jd/chunk_sample_draine.d.ts +24 -0
- package/src/shade/renderer/shader/chunk/atmosphere/phase/jd/chunk_sample_draine.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/atmosphere/phase/jd/chunk_sample_draine.js +49 -0
- package/src/shade/renderer/shader/chunk/atmosphere/phase/jd/chunk_sample_draine_cos.d.ts +18 -0
- package/src/shade/renderer/shader/chunk/atmosphere/phase/jd/chunk_sample_draine_cos.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/atmosphere/phase/jd/chunk_sample_draine_cos.js +18 -0
- package/src/shade/renderer/shader/chunk/brdf/dfg/chunk_integrate_brdf.d.ts +3 -0
- package/src/shade/renderer/shader/chunk/brdf/dfg/chunk_integrate_brdf.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/brdf/dfg/chunk_integrate_brdf.js +3 -0
- package/src/shade/renderer/shader/chunk/brdf/dfg/shader_split_sum_dgf_lut.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/brdf/dfg/shader_split_sum_dgf_lut.js +3 -1
- package/src/shade/renderer/shader/chunk/brdf/fresnel/chunk_F_dielectric.d.ts +24 -0
- package/src/shade/renderer/shader/chunk/brdf/fresnel/chunk_F_dielectric.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/brdf/fresnel/chunk_F_dielectric.js +53 -0
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_scene_point_query_is_inside_geometry.d.ts +7 -1
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_scene_point_query_is_inside_geometry.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_scene_point_query_is_inside_geometry.js +12 -60
- package/src/shade/renderer/shader/chunk/geometry/sphere/chunk_compute_spherical_excess.d.ts +26 -6
- package/src/shade/renderer/shader/chunk/geometry/sphere/chunk_compute_spherical_excess.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/geometry/sphere/chunk_compute_spherical_excess.js +30 -20
- package/src/shade/renderer/shader/chunk/light/sample/chunk_light_importance_directional.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/light/sample/chunk_light_importance_directional.js +3 -1
- package/src/shade/renderer/shader/chunk/light/sample/chunk_light_importance_point.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/light/sample/chunk_light_importance_point.js +3 -1
- package/src/shade/renderer/shader/chunk/light/sample/chunk_light_importance_spot.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/light/sample/chunk_light_importance_spot.js +3 -1
- package/src/shade/renderer/shader/chunk/light/sample/chunk_light_receiver_cosine.d.ts +14 -0
- package/src/shade/renderer/shader/chunk/light/sample/chunk_light_receiver_cosine.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/light/sample/chunk_light_receiver_cosine.js +25 -0
- package/src/shade/renderer/shader/chunk/light/sample/chunk_select_light_importance.d.ts +9 -2
- package/src/shade/renderer/shader/chunk/light/sample/chunk_select_light_importance.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/light/sample/chunk_select_light_importance.js +33 -10
- package/src/shade/renderer/shader/chunk/screen_space/chunk_screen_space_newton_ray.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/screen_space/chunk_screen_space_newton_ray.js +71 -37
- package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh_band_of_index.d.ts +14 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh_band_of_index.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh_band_of_index.js +30 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh_basis_function.d.ts +19 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh_basis_function.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh_basis_function.js +73 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh_vmf_window.d.ts +19 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh_vmf_window.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh_vmf_window.js +25 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/exponential/SH_EXP_P4Q2_PROBE_STRUCT.d.ts +17 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/exponential/SH_EXP_P4Q2_PROBE_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/exponential/SH_EXP_P4Q2_PROBE_STRUCT.js +23 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/exponential/chunk_sh_exp_p4q2_base_reflectance.d.ts +26 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/exponential/chunk_sh_exp_p4q2_base_reflectance.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/exponential/chunk_sh_exp_p4q2_base_reflectance.js +55 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/exponential/chunk_sh_exp_split_sum.d.ts +52 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/exponential/chunk_sh_exp_split_sum.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/exponential/chunk_sh_exp_split_sum.js +65 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh10_basis_at.d.ts +13 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh10_basis_at.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh10_basis_at.js +229 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh10_color_evaluate_vmf.d.ts +23 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh10_color_evaluate_vmf.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh10_color_evaluate_vmf.js +278 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh2_color_evaluate_vmf.d.ts +23 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh2_color_evaluate_vmf.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh2_color_evaluate_vmf.js +58 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh3_color_evaluate_vmf.d.ts +23 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh3_color_evaluate_vmf.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh3_color_evaluate_vmf.js +75 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh4_basis_at.d.ts +13 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh4_basis_at.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh4_basis_at.js +70 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh4_color_evaluate_vmf.d.ts +23 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh4_color_evaluate_vmf.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh4_color_evaluate_vmf.js +95 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh5_basis_at.d.ts +13 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh5_basis_at.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh5_basis_at.js +89 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh5_color_evaluate_vmf.d.ts +23 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh5_color_evaluate_vmf.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh5_color_evaluate_vmf.js +118 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh6_basis_at.d.ts +13 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh6_basis_at.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh6_basis_at.js +111 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh6_color_evaluate_vmf.d.ts +23 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh6_color_evaluate_vmf.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh6_color_evaluate_vmf.js +144 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh7_basis_at.d.ts +13 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh7_basis_at.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh7_basis_at.js +136 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh7_color_evaluate_vmf.d.ts +23 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh7_color_evaluate_vmf.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh7_color_evaluate_vmf.js +173 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh8_basis_at.d.ts +13 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh8_basis_at.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh8_basis_at.js +164 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh8_color_evaluate_vmf.d.ts +23 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh8_color_evaluate_vmf.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh8_color_evaluate_vmf.js +205 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh9_basis_at.d.ts +13 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh9_basis_at.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh9_basis_at.js +195 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh9_color_evaluate_vmf.d.ts +23 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh9_color_evaluate_vmf.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/spherical_harmonics/generated/chunk_sh9_color_evaluate_vmf.js +240 -0
- package/src/shade/renderer/shader/resource/ShaderResourceGroupDescriptor.d.ts +0 -6
- package/src/shade/renderer/shader/resource/ShaderResourceGroupDescriptor.d.ts.map +1 -1
- package/src/shade/renderer/shader/resource/ShaderResourceGroupDescriptor.js +46 -1
- package/src/shade/renderer/shadow/map/DEFAULT_SHADOWMAP_UPDATE_BUDGET.d.ts +7 -7
- package/src/shade/renderer/shadow/map/DEFAULT_SHADOWMAP_UPDATE_BUDGET.js +7 -7
- package/src/shade/renderer/shadow/map/DirectionalLightShadowmap.d.ts +42 -10
- package/src/shade/renderer/shadow/map/DirectionalLightShadowmap.d.ts.map +1 -1
- package/src/shade/renderer/shadow/map/DirectionalLightShadowmap.js +104 -48
- package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts +20 -4
- package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts.map +1 -1
- package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.js +186 -74
- package/src/shade/renderer/shadow/map/Shadowmap.d.ts +2 -1
- package/src/shade/renderer/shadow/map/Shadowmap.d.ts.map +1 -1
- package/src/shade/renderer/shadow/map/Shadowmap.js +2 -1
- package/src/shade/renderer/shadow/map/csm/CSM_CASCADE_STRUCT.d.ts +30 -0
- package/src/shade/renderer/shadow/map/csm/CSM_CASCADE_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/shadow/map/csm/CSM_CASCADE_STRUCT.js +52 -0
- package/src/shade/renderer/shadow/map/csm/CSM_SHADOWMAP_STRUCT.d.ts +14 -0
- package/src/shade/renderer/shadow/map/csm/CSM_SHADOWMAP_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/shadow/map/csm/CSM_SHADOWMAP_STRUCT.js +20 -0
- package/src/shade/renderer/shadow/map/csm/SHADOWMAP_CSM_DEFAULT_CASCADE_COUNT.d.ts +8 -0
- package/src/shade/renderer/shadow/map/csm/SHADOWMAP_CSM_DEFAULT_CASCADE_COUNT.d.ts.map +1 -0
- package/src/shade/renderer/shadow/map/csm/SHADOWMAP_CSM_DEFAULT_CASCADE_COUNT.js +7 -0
- package/src/shade/renderer/shadow/map/csm/shader/shader_csm_caster_range.d.ts +8 -6
- package/src/shade/renderer/shadow/map/csm/shader/shader_csm_caster_range.d.ts.map +1 -1
- package/src/shade/renderer/shadow/map/csm/shader/shader_csm_caster_range.js +28 -34
- package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_csm_compute_cascade_blended.d.ts +3 -2
- package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_csm_compute_cascade_blended.d.ts.map +1 -1
- package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_csm_compute_cascade_blended.js +19 -14
- package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_directional.d.ts +4 -3
- package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_directional.d.ts.map +1 -1
- package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_directional.js +12 -7
- package/src/shade/renderer/shadow/map/shadowmap_budget_carry_over.d.ts +4 -4
- package/src/shade/renderer/shadow/map/shadowmap_budget_carry_over.js +4 -4
- package/src/shade/renderer/shadow/vsm/GPUViewShadowMaps.d.ts.map +1 -1
- package/src/shade/renderer/shadow/vsm/GPUViewShadowMaps.js +39 -17
- package/src/shade/renderer/shadow/vsm/GPUVirtualShadowTextureResidence.d.ts.map +1 -1
- package/src/shade/renderer/shadow/vsm/GPUVirtualShadowTextureResidence.js +5 -36
- package/src/shade/renderer/shadow/vsm/VSM_UNIFORMS_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/shadow/vsm/VSM_UNIFORMS_STRUCT.js +3 -2
- package/src/shade/renderer/shadow/vsm/VirtualShadowMap.d.ts +1 -1
- package/src/shade/renderer/shadow/vsm/VirtualShadowMap.d.ts.map +1 -1
- package/src/shade/renderer/shadow/vsm/VirtualShadowMap.js +49 -35
- package/src/shade/renderer/shadow/vsm/VirtualShadowmapRenderer.d.ts +4 -1
- package/src/shade/renderer/shadow/vsm/VirtualShadowmapRenderer.d.ts.map +1 -1
- package/src/shade/renderer/shadow/vsm/VirtualShadowmapRenderer.js +8 -9
- package/src/shade/renderer/shadow/vsm/debug_inspect_residence_buffer.js +2 -2
- package/src/shade/renderer/shadow/vsm/decode_tile_address.d.ts.map +1 -1
- package/src/shade/renderer/shadow/vsm/decode_tile_address.js +15 -23
- package/src/shade/renderer/shadow/vsm/vms_pipeline_compute_coarse_bounds.d.ts.map +1 -1
- package/src/shade/renderer/shadow/vsm/vms_pipeline_compute_coarse_bounds.js +6 -9
- package/src/shade/renderer/shadow/vsm/vsm_residence_pipeline.d.ts.map +1 -1
- package/src/shade/renderer/shadow/vsm/vsm_residence_pipeline.js +19 -9
- package/src/shade/renderer/shadow/vsm/vsm_tile_allocation_pipeline.d.ts.map +1 -1
- package/src/shade/renderer/shadow/vsm/vsm_tile_allocation_pipeline.js +18 -6
- package/src/shade/renderer/texture/util/BLACK_PIXEL_TEXTURE.d.ts +1 -1
- package/src/shade/renderer/texture/util/BLACK_PIXEL_TEXTURE.d.ts.map +1 -1
- package/src/shade/renderer/texture/util/PIXEL_TEXTURE_NORMAL.d.ts +18 -1
- package/src/shade/renderer/texture/util/PIXEL_TEXTURE_NORMAL.d.ts.map +1 -1
- package/src/shade/renderer/texture/util/PIXEL_TEXTURE_NORMAL.js +24 -3
- package/src/shade/renderer/texture/util/WHITE_PIXEL_TEXTURE.d.ts +1 -1
- package/src/shade/renderer/texture/util/WHITE_PIXEL_TEXTURE.d.ts.map +1 -1
- package/src/shade/renderer/texture/util/get_single_pixel_texture.d.ts +0 -1
- package/src/shade/renderer/texture/util/get_single_pixel_texture.d.ts.map +1 -1
- package/src/shade/renderer/texture/util/get_single_pixel_texture.js +2 -23
- package/src/shade/renderer/texture/util/single_pixel_texture_from_sampler.d.ts +11 -0
- package/src/shade/renderer/texture/util/single_pixel_texture_from_sampler.d.ts.map +1 -0
- package/src/shade/renderer/texture/util/single_pixel_texture_from_sampler.js +34 -0
- package/src/shade/renderer/volumetrics/GPUSceneVolumetrics.d.ts +17 -8
- package/src/shade/renderer/volumetrics/GPUSceneVolumetrics.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/GPUSceneVolumetrics.js +35 -64
- package/src/shade/renderer/volumetrics/chunk_participating_media_volume_sample.d.ts +21 -0
- package/src/shade/renderer/volumetrics/chunk_participating_media_volume_sample.d.ts.map +1 -0
- package/src/shade/renderer/volumetrics/chunk_participating_media_volume_sample.js +70 -0
- package/src/shade/renderer/volumetrics/chunk_participating_media_volumes_iterate.d.ts +31 -0
- package/src/shade/renderer/volumetrics/chunk_participating_media_volumes_iterate.d.ts.map +1 -0
- package/src/shade/renderer/volumetrics/chunk_participating_media_volumes_iterate.js +86 -0
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +2 -4
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_participating_media.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_participating_media.js +6 -7
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_scattering_lut.js +7 -7
- package/src/shade/renderer/water/GPUWaterRenderer.d.ts +13 -1
- package/src/shade/renderer/water/GPUWaterRenderer.d.ts.map +1 -1
- package/src/shade/renderer/water/GPUWaterRenderer.js +74 -25
- package/src/shade/renderer/water/chunk_water_gi.d.ts +14 -0
- package/src/shade/renderer/water/chunk_water_gi.d.ts.map +1 -0
- package/src/shade/renderer/water/chunk_water_gi.js +56 -0
- package/src/shade/renderer/water/chunk_water_transport.d.ts +2 -0
- package/src/shade/renderer/water/chunk_water_transport.d.ts.map +1 -1
- package/src/shade/renderer/water/chunk_water_transport.js +51 -40
- package/src/shade/renderer/water/medium/GPUWaterBodies.d.ts +29 -0
- package/src/shade/renderer/water/medium/GPUWaterBodies.d.ts.map +1 -0
- package/src/shade/renderer/water/medium/GPUWaterBodies.js +116 -0
- package/src/shade/renderer/water/medium/WATER_BODIES_STRUCT.d.ts +23 -0
- package/src/shade/renderer/water/medium/WATER_BODIES_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/water/medium/WATER_BODIES_STRUCT.js +42 -0
- package/src/shade/renderer/water/medium/chunk_water_medium_derived.d.ts +9 -0
- package/src/shade/renderer/water/medium/chunk_water_medium_derived.d.ts.map +1 -0
- package/src/shade/renderer/water/medium/chunk_water_medium_derived.js +55 -0
- package/src/shade/renderer/water/medium/chunk_water_medium_scattering.d.ts +8 -0
- package/src/shade/renderer/water/medium/chunk_water_medium_scattering.d.ts.map +1 -0
- package/src/shade/renderer/water/medium/chunk_water_medium_scattering.js +17 -0
- package/src/shade/renderer/water/medium/shader_water_bodies_derive.d.ts +8 -0
- package/src/shade/renderer/water/medium/shader_water_bodies_derive.d.ts.map +1 -0
- package/src/shade/renderer/water/medium/shader_water_bodies_derive.js +30 -0
- package/src/shade/renderer/water/optics/chunk_water_inscatter.d.ts +28 -0
- package/src/shade/renderer/water/optics/chunk_water_inscatter.d.ts.map +1 -0
- package/src/shade/renderer/water/optics/chunk_water_inscatter.js +123 -0
- package/src/shade/renderer/water/optics/chunk_water_light_transmittance.d.ts +23 -0
- package/src/shade/renderer/water/optics/chunk_water_light_transmittance.d.ts.map +1 -0
- package/src/shade/renderer/water/optics/chunk_water_light_transmittance_dry.d.ts +18 -0
- package/src/shade/renderer/water/optics/chunk_water_light_transmittance_dry.d.ts.map +1 -0
- package/src/shade/renderer/water/optics/chunk_water_optics.d.ts +12 -0
- package/src/shade/renderer/water/optics/chunk_water_optics.d.ts.map +1 -0
- package/src/shade/renderer/water/optics/chunk_water_optics.js +75 -0
- package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.d.ts +27 -0
- package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.d.ts.map +1 -0
- package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.js +74 -0
- package/src/shade/renderer/water/shader_water.d.ts +10 -4
- package/src/shade/renderer/water/shader_water.d.ts.map +1 -1
- package/src/shade/renderer/water/shader_water.js +406 -384
- package/src/shade/renderer/water/shader_water_avboit.d.ts.map +1 -1
- package/src/shade/renderer/water/shader_water_avboit.js +19 -9
- package/src/shade/renderer/water/surface/GPUWaterWaveSimulation.d.ts +98 -0
- package/src/shade/renderer/water/surface/GPUWaterWaveSimulation.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/GPUWaterWaveSimulation.js +408 -0
- package/src/shade/renderer/water/surface/WATER_SURFACE_VERTEX_STRUCT.d.ts +12 -0
- package/src/shade/renderer/water/surface/WATER_SURFACE_VERTEX_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/WATER_SURFACE_VERTEX_STRUCT.js +27 -0
- package/src/shade/renderer/water/surface/WATER_WAVE_PARAMETERS_STRUCT.d.ts +14 -0
- package/src/shade/renderer/water/surface/WATER_WAVE_PARAMETERS_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/WATER_WAVE_PARAMETERS_STRUCT.js +49 -0
- package/src/shade/renderer/water/surface/chunk_water_wave.d.ts +15 -0
- package/src/shade/renderer/water/surface/chunk_water_wave.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/chunk_water_wave.js +48 -0
- package/src/shade/renderer/water/surface/chunk_water_wave_grid.d.ts +9 -0
- package/src/shade/renderer/water/surface/chunk_water_wave_grid.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/chunk_water_wave_grid.js +47 -0
- package/src/shade/renderer/water/surface/shader_water_surface_write.d.ts +10 -0
- package/src/shade/renderer/water/surface/shader_water_surface_write.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/shader_water_surface_write.js +51 -0
- package/src/shade/renderer/water/surface/shader_water_wave_step.d.ts +12 -0
- package/src/shade/renderer/water/surface/shader_water_wave_step.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/shader_water_wave_step.js +54 -0
- package/src/shade/renderer/water/surface/water_surface_grid_indices.d.ts +13 -0
- package/src/shade/renderer/water/surface/water_surface_grid_indices.d.ts.map +1 -0
- package/src/shade/renderer/water/surface/water_surface_grid_indices.js +39 -0
- package/src/shade/renderer/water/water_missing_receiver_path.d.ts +17 -0
- package/src/shade/renderer/water/water_missing_receiver_path.d.ts.map +1 -0
- package/src/shade/renderer/water/water_missing_receiver_path.js +40 -0
- package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.d.ts.map +1 -1
- package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.js +247 -23
- package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts +18 -14
- package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
- package/src/shade/wgsl/emulator/WGSLLanguageCore.js +48 -6
- package/src/shade/renderer/shadow/map/csm/CSM_CASTER_RANGE_STRUCT.d.ts +0 -29
- package/src/shade/renderer/shadow/map/csm/CSM_CASTER_RANGE_STRUCT.d.ts.map +0 -1
- package/src/shade/renderer/shadow/map/csm/CSM_CASTER_RANGE_STRUCT.js +0 -43
- package/src/shade/renderer/shadow/map/csm/SHADOWMAP_CSM_CASCADE_COUNT.d.ts +0 -7
- package/src/shade/renderer/shadow/map/csm/SHADOWMAP_CSM_CASCADE_COUNT.d.ts.map +0 -1
- package/src/shade/renderer/shadow/map/csm/SHADOWMAP_CSM_CASCADE_COUNT.js +0 -6
|
@@ -5,28 +5,38 @@ import {
|
|
|
5
5
|
bvh_query_user_data_intersects_aabb
|
|
6
6
|
} from "../../../core/bvh2/bvh3/query/bvh_query_user_data_intersects_aabb.js";
|
|
7
7
|
import { returnTrue } from "../../../core/function/returnTrue.js";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
aabb3_transform_oriented,
|
|
10
|
+
aabb3_transform_oriented_array
|
|
11
|
+
} from "../../../core/geom/3d/aabb/aabb3_transform_oriented.js";
|
|
12
|
+
import { quat3_multiply_array } from "../../../core/geom/3d/quaternion/quat3_multiply.js";
|
|
9
13
|
import Vector3 from "../../../core/geom/Vector3.js";
|
|
14
|
+
import { f32_next_down } from "../../../core/math/f32_next_down.js";
|
|
15
|
+
import { f32_next_up } from "../../../core/math/f32_next_up.js";
|
|
10
16
|
import { ResourceAccessKind } from "../../../core/model/ResourceAccessKind.js";
|
|
11
17
|
import { ResourceAccessSpecification } from "../../../core/model/ResourceAccessSpecification.js";
|
|
12
18
|
import { System } from "../../ecs/System.js";
|
|
13
19
|
import { t64_announce_change } from "../../ecs/transform/t64_announce_change.js";
|
|
14
20
|
import { TRANSFORM64_EVENT_PLACED } from "../../ecs/transform/TRANSFORM64_EVENT_PLACED.js";
|
|
15
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
Transform64,
|
|
23
|
+
TRANSFORM64_ROTATION_OFFSET,
|
|
24
|
+
TRANSFORM64_TRANSLATION_OFFSET
|
|
25
|
+
} from "../../ecs/transform/Transform64.js";
|
|
16
26
|
import { Interpolated } from "../../interpolation/Interpolated.js";
|
|
17
27
|
import { body_id_index, BodyStorage } from "../body/BodyStorage.js";
|
|
18
28
|
import { SBS_STRIDE, SolverBodyState } from "../body/SolverBodyState.js";
|
|
19
|
-
import { compute_world_aabb,
|
|
29
|
+
import { compute_world_aabb, fatten_world_aabb_array } from "../broadphase/compute_fat_world_aabb.js";
|
|
20
30
|
import { generate_pairs } from "../broadphase/generate_pairs.js";
|
|
21
31
|
import { PairList } from "../broadphase/PairList.js";
|
|
22
|
-
import { ccd_release_contacts, ccd_resolve } from "../ccd/linear_sweep.js";
|
|
23
|
-
import { solve_joints } from "../constraint/solve_constraints.js";
|
|
32
|
+
import { ccd_clamped_bodies, ccd_release_contacts, ccd_resolve } from "../ccd/linear_sweep.js";
|
|
33
|
+
import { relax_joints, solve_joints } from "../constraint/solve_constraints.js";
|
|
24
34
|
import { ManifoldStore } from "../contact/ManifoldStore.js";
|
|
25
35
|
import { ContactEventBuffer, ContactEventKind } from "../events/ContactEventBuffer.js";
|
|
26
36
|
import { diff_manifolds } from "../events/diff_manifolds.js";
|
|
27
37
|
import { v3_add } from "../../../core/geom/vec3/v3_add.js";
|
|
28
38
|
import { v3_set } from "../../../core/geom/vec3/v3_set.js";
|
|
29
|
-
import {
|
|
39
|
+
import { world_inverse_inertia_apply_raw } from "../inertia/world_inverse_inertia.js";
|
|
30
40
|
import { integrate_position } from "../integration/integrate_position.js";
|
|
31
41
|
import { integrate_velocity_forces, integrate_velocity_gravity } from "../integration/integrate_velocity.js";
|
|
32
42
|
import { IslandBuilder } from "../island/IslandBuilder.js";
|
|
@@ -39,6 +49,7 @@ import {
|
|
|
39
49
|
prepare_contacts,
|
|
40
50
|
redetect_concave_contacts,
|
|
41
51
|
refresh_contacts,
|
|
52
|
+
RESTITUTION_VELOCITY_THRESHOLD,
|
|
42
53
|
solve_position,
|
|
43
54
|
solve_velocity,
|
|
44
55
|
warm_start_contacts,
|
|
@@ -95,6 +106,12 @@ let scratch_wake_candidates = new Uint32Array(64);
|
|
|
95
106
|
*/
|
|
96
107
|
const scratch_stored_aabb = new Float64Array(6);
|
|
97
108
|
|
|
109
|
+
/**
|
|
110
|
+
* A collider's pose, `[px, py, pz, qx, qy, qz, qw]`, for the broadphase refit's box transform.
|
|
111
|
+
* @type {Float64Array}
|
|
112
|
+
*/
|
|
113
|
+
const scratch_refit_pose = new Float64Array(7);
|
|
114
|
+
|
|
98
115
|
/**
|
|
99
116
|
* Scratch boxes for {@link PhysicsSystem#__swept_proximity} — the mover's
|
|
100
117
|
* velocity-swept tight AABB and the sleeper's tight AABB.
|
|
@@ -103,12 +120,65 @@ const scratch_stored_aabb = new Float64Array(6);
|
|
|
103
120
|
const scratch_prox_mover = new Float64Array(6);
|
|
104
121
|
const scratch_prox_sleeper = new Float64Array(6);
|
|
105
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Doubles per body slot in {@link PhysicsSystem#__target_poses}: the packed id of the body that set
|
|
125
|
+
* the target, then position `[x, y, z]` and rotation `[x, y, z, w]`.
|
|
126
|
+
* @type {number}
|
|
127
|
+
*/
|
|
128
|
+
const TARGET_POSE_STRIDE = 8;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Scratch for {@link PhysicsSystem#__derive_target_velocities}' rotation from the current
|
|
132
|
+
* orientation to the target, as `[x, y, z, w]`.
|
|
133
|
+
* @type {Float64Array}
|
|
134
|
+
*/
|
|
135
|
+
const scratch_target_dq = new Float64Array(4);
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Scratch for {@link PhysicsSystem#__derive_target_velocities}: the conjugate of the body's current
|
|
139
|
+
* orientation, `[x, y, z, w]`, the second operand of that rotation.
|
|
140
|
+
* @type {Float64Array}
|
|
141
|
+
*/
|
|
142
|
+
const scratch_target_conjugate = new Float64Array(4);
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* What {@link PhysicsSystem#collidersOf} answers for a body that has none: one shared, frozen
|
|
146
|
+
* empty list.
|
|
147
|
+
* @type {ReadonlyArray<{collider: Collider, transform: Transform64, entity: number}>}
|
|
148
|
+
*/
|
|
149
|
+
const NO_COLLIDERS = Object.freeze([]);
|
|
150
|
+
|
|
106
151
|
/**
|
|
107
152
|
* {@link PhysicsSystem#interpolationLog} warns once per process, not once per system.
|
|
108
153
|
* @type {boolean}
|
|
109
154
|
*/
|
|
110
155
|
let interpolation_log_deprecation_warned = false;
|
|
111
156
|
|
|
157
|
+
/**
|
|
158
|
+
* Round a world box outward to float32, in place: each lower bound down and each upper bound up
|
|
159
|
+
* to a float32 value, so the box keeps containing what it bounded once the broadphase stores it.
|
|
160
|
+
*
|
|
161
|
+
* The BVHs store float32, and a plain write rounds to the NEAREST float32 — inward on any side
|
|
162
|
+
* that rounds that way, by up to half a float32 step: 3 cm at 1e6 m. A static leaf is its body's
|
|
163
|
+
* tight box, so a query reaching the body through its leaf missed whatever of the body lay
|
|
164
|
+
* outside it. A ray dropped onto a 2 mm plate 1e6 m out missed it; so did rays a millimetre inside
|
|
165
|
+
* a 1 m crate's faces 1e5 m out. The refit skip in stage 2 also leans on it: a stationary body's
|
|
166
|
+
* box is contained by its own stored leaf only if that leaf did not shrink.
|
|
167
|
+
*
|
|
168
|
+
* @param {Float64Array} aabb `[x0, y0, z0, x1, y1, z1]`
|
|
169
|
+
*/
|
|
170
|
+
function aabb3_round_outward_f32(aabb) {
|
|
171
|
+
for (let i = 0; i < 3; i++) {
|
|
172
|
+
const lower = aabb[i];
|
|
173
|
+
const lower_f32 = Math.fround(lower);
|
|
174
|
+
aabb[i] = lower_f32 > lower ? f32_next_down(lower_f32) : lower_f32;
|
|
175
|
+
|
|
176
|
+
const upper = aabb[i + 3];
|
|
177
|
+
const upper_f32 = Math.fround(upper);
|
|
178
|
+
aabb[i + 3] = upper_f32 < upper ? f32_next_up(upper_f32) : upper_f32;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
112
182
|
/**
|
|
113
183
|
* Rigid-body physics system.
|
|
114
184
|
*
|
|
@@ -202,10 +272,20 @@ export class PhysicsSystem extends System {
|
|
|
202
272
|
__solver_state = new SolverBodyState();
|
|
203
273
|
|
|
204
274
|
/**
|
|
205
|
-
*
|
|
206
|
-
* accumulating sleep time.
|
|
207
|
-
*
|
|
208
|
-
*
|
|
275
|
+
* Speed-squared threshold, (m/s)², below which a body is eligible to start
|
|
276
|
+
* accumulating sleep time. The speed measured is that of the body's far
|
|
277
|
+
* end, `|v|² + |ω|²·R²`, where `R` is the body's extent
|
|
278
|
+
* ({@link __body_extent}: a bound on how far its colliders reach from its
|
|
279
|
+
* centre, from their local bounding boxes) floored at 1 m. Default 0.01
|
|
280
|
+
* corresponds to ~0.1 m/s linear; for a body whose extent is no more than
|
|
281
|
+
* a metre, ~0.1 rad/s angular, exactly as before the extent was counted;
|
|
282
|
+
* for a larger one, ~0.1 m/s at its far end (a 100 m rod turning at
|
|
283
|
+
* 0.05 rad/s is moving 5 m/s at the tip, and stays awake).
|
|
284
|
+
*
|
|
285
|
+
* The far end of a long body magnifies any wobble of its contacts, and the
|
|
286
|
+
* test sees it at full size: a long plank resting on a bumpy mesh or
|
|
287
|
+
* heightmap floor whose contacts jitter can stay awake where a short body
|
|
288
|
+
* would sleep.
|
|
209
289
|
* @type {number}
|
|
210
290
|
*/
|
|
211
291
|
sleepVelocitySqrThreshold = 0.01;
|
|
@@ -240,6 +320,48 @@ export class PhysicsSystem extends System {
|
|
|
240
320
|
*/
|
|
241
321
|
positionIterations = 1;
|
|
242
322
|
|
|
323
|
+
/**
|
|
324
|
+
* Restitution passes per step, after the substep loop: Gauss-Seidel sweeps
|
|
325
|
+
* over the contacts with non-zero restitution, each driving a bouncing
|
|
326
|
+
* contact's normal velocity toward `-e` times its approach. A body that
|
|
327
|
+
* strikes at several points at once needs more than one: after a single
|
|
328
|
+
* pass, a cube dropped flat at e = 0.8 left the ground spinning at 5 rad/s
|
|
329
|
+
* and rebounded at 0.77 of its impact speed instead of 0.8. Two (Box3D's
|
|
330
|
+
* default) bring it within half a percent of 0.8, all but without spin.
|
|
331
|
+
* Each contact's bounce is capped at `e` times the impulse it took, which
|
|
332
|
+
* stops an unconverged pass overshooting: in zero gravity, uncapped, one
|
|
333
|
+
* pass sent a cube tumbling onto frictionless ground at e = 1 off with up
|
|
334
|
+
* to 7% more kinetic energy than it struck with; capped, 0.2% at worst.
|
|
335
|
+
* More passes still change the result, not just the cost: they converge
|
|
336
|
+
* contacts that load each other further — an e = 1 stack of four boxes
|
|
337
|
+
* struck by a ball keeps 201 J of its 309 J after 10 s at 2 passes, 88 J
|
|
338
|
+
* at 8. `0` turns restitution off.
|
|
339
|
+
*
|
|
340
|
+
* Under gravity a bounce can still gain energy, mostly not from these
|
|
341
|
+
* passes: a landing body is corrected out of the depth it sank into the
|
|
342
|
+
* ground — by the penetration bias with soft contacts, by the position pass
|
|
343
|
+
* with hard ones — and that lift is potential energy, while restitution
|
|
344
|
+
* still returns the full approach speed. Tumbling cubes landing on
|
|
345
|
+
* frictionless ground at e = 1, 60 drops of 5 s: no drop gains at all at
|
|
346
|
+
* the defaults (soft contacts, 2 passes, 4 substeps); 22 gain over 0.1%
|
|
347
|
+
* at 8 substeps
|
|
348
|
+
* (worst +0.64%: the contact is stiffer against the shorter substep and
|
|
349
|
+
* recovers more depth); with hard contacts 53 (+2.2%), and +6.4% at 8
|
|
350
|
+
* substeps. At 2 passes, turning off the bias, the position pass or
|
|
351
|
+
* restitution leaves none gaining. At 1 pass 8 gain (+2.2%), and the pass
|
|
352
|
+
* itself is part of it: with the bias off, 4 still gain (+0.8%).
|
|
353
|
+
* @type {number}
|
|
354
|
+
*/
|
|
355
|
+
restitutionIterations = 2;
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Approach speed, m/s, below which a contact does not bounce whatever its
|
|
359
|
+
* restitution, so resting and slowly settling bodies do not buzz. The
|
|
360
|
+
* discrete solver and the CCD pass apply the same rule.
|
|
361
|
+
* @type {number}
|
|
362
|
+
*/
|
|
363
|
+
restitutionThreshold = RESTITUTION_VELOCITY_THRESHOLD;
|
|
364
|
+
|
|
243
365
|
/**
|
|
244
366
|
* Contact softness frequency, Hz. Softening is what lets resting stacks
|
|
245
367
|
* settle instead of ringing just above the sleep threshold; `0` gives
|
|
@@ -349,10 +471,14 @@ export class PhysicsSystem extends System {
|
|
|
349
471
|
__joints_sorted = [];
|
|
350
472
|
|
|
351
473
|
/**
|
|
352
|
-
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
474
|
+
* Joint solver passes per substep. Each pass is one Gauss-Seidel sweep over
|
|
475
|
+
* every joint, so joints that load each other — a chain, a ragdoll limb, a
|
|
476
|
+
* heavy body on a light rope — converge together: more passes, tighter
|
|
477
|
+
* joints under load. The first pass also warm-starts each joint; a relax
|
|
478
|
+
* pass over the limit / motor / spring rows after the position integrate
|
|
479
|
+
* comes on top. Cost is passes × joints; cheap because joints are far fewer
|
|
480
|
+
* than contacts. 0 turns the joint solver off, relax included: the joints
|
|
481
|
+
* still tie their bodies' islands together, but push on nothing.
|
|
356
482
|
* @type {number}
|
|
357
483
|
*/
|
|
358
484
|
jointIterations = 8;
|
|
@@ -361,13 +487,13 @@ export class PhysicsSystem extends System {
|
|
|
361
487
|
* Per-body pseudo-velocity for the Catto split-impulse position
|
|
362
488
|
* pass (TGS Phase 1). Flat layout, 6 doubles per body slot index:
|
|
363
489
|
* `[lin.x, lin.y, lin.z, ang.x, ang.y, ang.z]`. Sized to
|
|
364
|
-
* `storage.high_water_mark * 6` at the top of each fixedUpdate
|
|
365
|
-
*
|
|
366
|
-
*
|
|
490
|
+
* `storage.high_water_mark * 6` at the top of each fixedUpdate, and
|
|
491
|
+
* zero wherever `integrate_position` reads it unless a position pass
|
|
492
|
+
* wrote it this substep, so unwritten slots contribute nothing.
|
|
367
493
|
*
|
|
368
494
|
* The solver writes during its position pass; `integrate_position`
|
|
369
|
-
* reads and folds into the pose update on the same
|
|
370
|
-
*
|
|
495
|
+
* reads and folds into the pose update on the same substep, and the
|
|
496
|
+
* next substep wipes it first. It NEVER lands in
|
|
371
497
|
* `linearVelocity` / `angularVelocity` — that's the point of
|
|
372
498
|
* split impulse: depth correction does not contaminate persistent
|
|
373
499
|
* velocity (so a `restitution = 0` impact stops cleanly).
|
|
@@ -376,6 +502,21 @@ export class PhysicsSystem extends System {
|
|
|
376
502
|
*/
|
|
377
503
|
__pseudo_velocity = new Float64Array(0);
|
|
378
504
|
|
|
505
|
+
/**
|
|
506
|
+
* Length of the prefix of {@link __pseudo_velocity} that a position pass
|
|
507
|
+
* may have written since it was last zeroed; everything past it is zero.
|
|
508
|
+
* Set by the hard-contact position pass of {@link fixedUpdate} and of the
|
|
509
|
+
* `solve_contacts` driver. `0` when the whole buffer is zero — always,
|
|
510
|
+
* with soft contacts (the default), which run no position pass. The wipes
|
|
511
|
+
* zero this prefix only, and only when it is non-empty: zeroing the whole
|
|
512
|
+
* buffer every substep cost work proportional to the body-slot
|
|
513
|
+
* high-water mark, not to the bodies awake — most of a 0.6 ms step at
|
|
514
|
+
* 100k slots with ten awake.
|
|
515
|
+
* @private
|
|
516
|
+
* @type {number}
|
|
517
|
+
*/
|
|
518
|
+
__pseudo_velocity_dirty = 0;
|
|
519
|
+
|
|
379
520
|
/**
|
|
380
521
|
* Master switch for the continuous-collision pass. When false the
|
|
381
522
|
* {@link RigidBodyFlags.CCD} flag is ignored and no swept queries run.
|
|
@@ -393,6 +534,85 @@ export class PhysicsSystem extends System {
|
|
|
393
534
|
*/
|
|
394
535
|
__ccd_start_pos = new Float64Array(0);
|
|
395
536
|
|
|
537
|
+
/**
|
|
538
|
+
* Start-of-step linear velocities of the awake DYNAMIC bodies — every one,
|
|
539
|
+
* not only the CCD-flagged — captured with {@link __ccd_start_pos} (after
|
|
540
|
+
* forces, before the substep loop) in any step with a flagged body awake;
|
|
541
|
+
* 3 doubles per body slot index. The CCD pass replaces each with the
|
|
542
|
+
* body's velocity change through the solve, which tells it how a body it
|
|
543
|
+
* struck fell through the step.
|
|
544
|
+
* @type {Float64Array}
|
|
545
|
+
*/
|
|
546
|
+
__ccd_start_vel = new Float64Array(0);
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* The CCD movers of the current step: storage indices of the bodies whose
|
|
550
|
+
* start pose {@link __ccd_start_pos} took this step, the first
|
|
551
|
+
* {@link __ccd_mover_count} of them. The CCD pass sweeps these and no
|
|
552
|
+
* others — a body made a mover after the capture, by a listener on an
|
|
553
|
+
* announcement, has no start pose this step. Grows by doubling.
|
|
554
|
+
* @type {Uint32Array}
|
|
555
|
+
*/
|
|
556
|
+
__ccd_movers = new Uint32Array(16);
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* Beside each of {@link __ccd_movers}, the collider its start pose was
|
|
560
|
+
* taken from, its body's primary at the time; a mover whose primary
|
|
561
|
+
* collider has changed since is not swept this step.
|
|
562
|
+
* @type {Array<Collider|null>}
|
|
563
|
+
*/
|
|
564
|
+
__ccd_mover_colliders = [];
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* Number of live entries in {@link __ccd_movers}.
|
|
568
|
+
* @type {number}
|
|
569
|
+
*/
|
|
570
|
+
__ccd_mover_count = 0;
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* Per-body extent, metres, indexed by body slot: a bound on the distance
|
|
574
|
+
* from the body's centre to any point of its colliders — the largest, over
|
|
575
|
+
* its colliders, of the local bounding box's corner radius plus the
|
|
576
|
+
* collider's offset from the body. Exact for a box centred on its body;
|
|
577
|
+
* larger than the body for other shapes (a sphere of radius r reads
|
|
578
|
+
* r·√3). Written for every awake body in stage 2 of each
|
|
579
|
+
* step, from the step's starting poses, and read by the sleep test to
|
|
580
|
+
* turn angular velocity into the speed of the body's far end. Rotation
|
|
581
|
+
* invariant (local boxes, not world ones), so a body's orientation does
|
|
582
|
+
* not change when it may sleep. Derived state: recomputed each step,
|
|
583
|
+
* never serialized. Grows to `storage.high_water_mark`.
|
|
584
|
+
* @type {Float64Array}
|
|
585
|
+
*/
|
|
586
|
+
__body_extent = new Float64Array(0);
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* Pending {@link setTargetPose} targets, {@link TARGET_POSE_STRIDE} doubles per body slot
|
|
590
|
+
* index: the packed id of the body that set the target ({@link RIGID_BODY_UNALLOCATED} for
|
|
591
|
+
* none), then position `[x, y, z]` and rotation `[x, y, z, w]`. Keyed by the packed id rather
|
|
592
|
+
* than a flag, so a slot freed and reused by another body before the step never inherits a
|
|
593
|
+
* target. Grows to cover the slots targets are set on; never shrinks.
|
|
594
|
+
* @private
|
|
595
|
+
* @type {Float64Array}
|
|
596
|
+
*/
|
|
597
|
+
__target_poses = new Float64Array(0);
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Packed ids of the bodies holding a pending target in {@link __target_poses}, in call order:
|
|
601
|
+
* the first {@link __target_pose_count}. Consumed and emptied by the next {@link fixedUpdate},
|
|
602
|
+
* which resets the count and keeps the array's storage — truncating it gave the storage up, and
|
|
603
|
+
* the next step's first target allocated it again.
|
|
604
|
+
* @private
|
|
605
|
+
* @type {number[]}
|
|
606
|
+
*/
|
|
607
|
+
__target_pose_bodies = [];
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* How many of {@link __target_pose_bodies} are pending.
|
|
611
|
+
* @private
|
|
612
|
+
* @type {number}
|
|
613
|
+
*/
|
|
614
|
+
__target_pose_count = 0;
|
|
615
|
+
|
|
396
616
|
/**
|
|
397
617
|
* @type {InterpolationLog|null}
|
|
398
618
|
*/
|
|
@@ -501,10 +721,12 @@ export class PhysicsSystem extends System {
|
|
|
501
721
|
|
|
502
722
|
/**
|
|
503
723
|
* Resize {@link __pseudo_velocity} to cover every live body slot and
|
|
504
|
-
*
|
|
505
|
-
*
|
|
506
|
-
* solver doesn't touch contribute zero pseudo-velocity to
|
|
507
|
-
* {@link integrate_position}.
|
|
724
|
+
* bring it to all-zero, zeroing only what a position pass may have
|
|
725
|
+
* written since it last was ({@link __pseudo_velocity_dirty}), so bodies
|
|
726
|
+
* the solver doesn't touch contribute zero pseudo-velocity to
|
|
727
|
+
* {@link integrate_position}. Called at the top of each fixedUpdate, and
|
|
728
|
+
* by a caller of the `solve_contacts` driver whose buffer may hold a
|
|
729
|
+
* hard-contact step's last correction.
|
|
508
730
|
*
|
|
509
731
|
* Doubles on growth like the other physics scratches; never shrinks.
|
|
510
732
|
*
|
|
@@ -514,8 +736,22 @@ export class PhysicsSystem extends System {
|
|
|
514
736
|
const required = this.storage.high_water_mark * 6;
|
|
515
737
|
if (this.__pseudo_velocity.length < required) {
|
|
516
738
|
this.__pseudo_velocity = new Float64Array(required * 2);
|
|
517
|
-
|
|
518
|
-
|
|
739
|
+
this.__pseudo_velocity_dirty = 0;
|
|
740
|
+
} else {
|
|
741
|
+
this.__clear_pseudo_velocity();
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* Zero what a position pass may have written to {@link __pseudo_velocity}
|
|
747
|
+
* since it was last zeroed; nothing if none has run.
|
|
748
|
+
* @private
|
|
749
|
+
*/
|
|
750
|
+
__clear_pseudo_velocity() {
|
|
751
|
+
const dirty = this.__pseudo_velocity_dirty;
|
|
752
|
+
if (dirty > 0) {
|
|
753
|
+
this.__pseudo_velocity.fill(0, 0, dirty);
|
|
754
|
+
this.__pseudo_velocity_dirty = 0;
|
|
519
755
|
}
|
|
520
756
|
}
|
|
521
757
|
|
|
@@ -534,6 +770,14 @@ export class PhysicsSystem extends System {
|
|
|
534
770
|
|
|
535
771
|
/**
|
|
536
772
|
* Install (or remove with `null`) the contact filter callback.
|
|
773
|
+
*
|
|
774
|
+
* It is asked during the step, and also from inside the CCD pass's sweep — a
|
|
775
|
+
* {@link shapeCast} — so it may run a {@link raycast} or an {@link overlap},
|
|
776
|
+
* but not a {@link shapeCast} (refused by an assert: a cast cannot run
|
|
777
|
+
* inside another). A production build strips asserts, and there nothing
|
|
778
|
+
* refuses it: the sweep's own cast is overwritten and CCD tunnels without a
|
|
779
|
+
* word — 200 of 200 fast spheres fired at a 2 cm wall went through it.
|
|
780
|
+
*
|
|
537
781
|
* @param {((entityA:number, entityB:number, colliderA:Collider, colliderB:Collider) => boolean) | null} fn
|
|
538
782
|
*/
|
|
539
783
|
setContactFilter(fn) {
|
|
@@ -571,6 +815,8 @@ export class PhysicsSystem extends System {
|
|
|
571
815
|
transform.rotation_x, transform.rotation_y, transform.rotation_z, transform.rotation_w
|
|
572
816
|
);
|
|
573
817
|
|
|
818
|
+
aabb3_round_outward_f32(scratch_world_aabb);
|
|
819
|
+
|
|
574
820
|
const bvh = rb.kind === BodyKind.Static ? this.staticBvh : this.dynamicBvh;
|
|
575
821
|
const node = bvh.allocate_node();
|
|
576
822
|
|
|
@@ -645,6 +891,13 @@ export class PhysicsSystem extends System {
|
|
|
645
891
|
* @param {number} entity
|
|
646
892
|
*/
|
|
647
893
|
link(rigidBody, transform, entity) {
|
|
894
|
+
// Every kind test in the engine is an identity comparison, so a value that is none of the
|
|
895
|
+
// kinds is taken for "not Static, not Dynamic" everywhere, silently.
|
|
896
|
+
const kind = rigidBody.kind;
|
|
897
|
+
assert.ok(kind === BodyKind.Static || kind === BodyKind.Dynamic
|
|
898
|
+
|| kind === BodyKind.KinematicVelocity || kind === BodyKind.KinematicPosition,
|
|
899
|
+
`link: RigidBody.kind must be a BodyKind, was ${kind}`);
|
|
900
|
+
|
|
648
901
|
const packed = this.storage.allocate(entity);
|
|
649
902
|
rigidBody._bodyId = packed;
|
|
650
903
|
|
|
@@ -908,6 +1161,47 @@ export class PhysicsSystem extends System {
|
|
|
908
1161
|
return this.storage.entity_at(body_id_index(packed_body_id));
|
|
909
1162
|
}
|
|
910
1163
|
|
|
1164
|
+
/**
|
|
1165
|
+
* Resolve a packed body id to the {@link RigidBody} linked under it, or `undefined` if the id
|
|
1166
|
+
* is stale. The id a query reports names a body; this is how its flags, kind and velocity are
|
|
1167
|
+
* read without the dataset.
|
|
1168
|
+
*
|
|
1169
|
+
* @param {number} packed_body_id as a query reports it
|
|
1170
|
+
* @returns {RigidBody|undefined}
|
|
1171
|
+
*/
|
|
1172
|
+
bodyOf(packed_body_id) {
|
|
1173
|
+
if (!this.storage.is_valid(packed_body_id)) return undefined;
|
|
1174
|
+
return this.__bodies[body_id_index(packed_body_id)];
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
/**
|
|
1178
|
+
* The colliders attached to a body, in attach order. Each entry gives the `collider`, the world
|
|
1179
|
+
* `transform` it is posed at — the body's own Transform64 for a collider on the body entity, the
|
|
1180
|
+
* child entity's for a compound body's child — and the `entity` that owns the collider. These are
|
|
1181
|
+
* the colliders a query tests when it reaches the body, each at its own transform, in this
|
|
1182
|
+
* order; an overlap query reports the body on the first of them that overlaps.
|
|
1183
|
+
*
|
|
1184
|
+
* **This is the system's live list, not a copy: never write to it.** The array and its entries
|
|
1185
|
+
* are what the broadphase, the narrowphase and every query read, so a `push`, `pop` or `splice`,
|
|
1186
|
+
* or an edit to an entry, changes what the body collides with everywhere — a caller's `pop()`
|
|
1187
|
+
* drops a collider from every query. Attach and detach colliders through
|
|
1188
|
+
* {@link attach_collider} / {@link detach_collider}. The list changes in place on the body's
|
|
1189
|
+
* next attach, detach or unlink; copy what must outlive that. A stale id has no colliders: the
|
|
1190
|
+
* result is one shared, frozen empty array.
|
|
1191
|
+
*
|
|
1192
|
+
* A read-only view is not offered because it is not free: a Proxy that refuses writes made a
|
|
1193
|
+
* walk of an 8-entry list 8.5x as slow to read, and a frozen copy per body would allocate on
|
|
1194
|
+
* every attach and detach and still hand out the live entries.
|
|
1195
|
+
*
|
|
1196
|
+
* @param {number} packed_body_id as a query reports it
|
|
1197
|
+
* @returns {ReadonlyArray<{collider: Collider, transform: Transform64, entity: number}>}
|
|
1198
|
+
*/
|
|
1199
|
+
collidersOf(packed_body_id) {
|
|
1200
|
+
if (!this.storage.is_valid(packed_body_id)) return NO_COLLIDERS;
|
|
1201
|
+
const list = this.__body_collider_lists[body_id_index(packed_body_id)];
|
|
1202
|
+
return list === undefined ? NO_COLLIDERS : list;
|
|
1203
|
+
}
|
|
1204
|
+
|
|
911
1205
|
/**
|
|
912
1206
|
* Number of live bodies (regardless of awake/sleeping state).
|
|
913
1207
|
* @returns {number}
|
|
@@ -1000,7 +1294,12 @@ export class PhysicsSystem extends System {
|
|
|
1000
1294
|
scratch_locked_inertia[0] = (flags & RigidBodyFlags.LockRotX) !== 0 ? 0 : ii[0];
|
|
1001
1295
|
scratch_locked_inertia[1] = (flags & RigidBodyFlags.LockRotY) !== 0 ? 0 : ii[1];
|
|
1002
1296
|
scratch_locked_inertia[2] = (flags & RigidBodyFlags.LockRotZ) !== 0 ? 0 : ii[2];
|
|
1003
|
-
|
|
1297
|
+
world_inverse_inertia_apply_raw(
|
|
1298
|
+
scratch_angular_delta, 0,
|
|
1299
|
+
scratch_locked_inertia[0], scratch_locked_inertia[1], scratch_locked_inertia[2],
|
|
1300
|
+
transform.rotation_x, transform.rotation_y, transform.rotation_z, transform.rotation_w,
|
|
1301
|
+
tx, ty, tz
|
|
1302
|
+
);
|
|
1004
1303
|
|
|
1005
1304
|
v3_add(
|
|
1006
1305
|
rigidBody.angularVelocity, 0,
|
|
@@ -1011,8 +1310,11 @@ export class PhysicsSystem extends System {
|
|
|
1011
1310
|
}
|
|
1012
1311
|
|
|
1013
1312
|
/**
|
|
1014
|
-
* Accumulate a
|
|
1015
|
-
*
|
|
1313
|
+
* Accumulate a torque (world-space, N·m) for the next fixedUpdate. Pairs
|
|
1314
|
+
* with {@link applyForce} for the rotational case, and is spent the same
|
|
1315
|
+
* way: once, as the angular impulse `τ·dt` over the whole step, before the
|
|
1316
|
+
* substeps — a per-step budget, to be applied again every step it should
|
|
1317
|
+
* last.
|
|
1016
1318
|
*
|
|
1017
1319
|
* Wakes the body if asleep.
|
|
1018
1320
|
*
|
|
@@ -1033,9 +1335,12 @@ export class PhysicsSystem extends System {
|
|
|
1033
1335
|
}
|
|
1034
1336
|
|
|
1035
1337
|
/**
|
|
1036
|
-
*
|
|
1037
|
-
* generates both a linear acceleration (F/m) and a
|
|
1038
|
-
* the body's centre of mass
|
|
1338
|
+
* Accumulate a force at a specific world-space point for the next
|
|
1339
|
+
* fixedUpdate. The force generates both a linear acceleration (F/m) and a
|
|
1340
|
+
* torque (r × F) about the body's centre of mass, `r` taken from
|
|
1341
|
+
* `transform` now. Both are spent like {@link applyForce}'s: once, as
|
|
1342
|
+
* `F·dt` and `(r × F)·dt` over the whole step, before the substeps — a
|
|
1343
|
+
* per-step budget, to be applied again every step it should last.
|
|
1039
1344
|
*
|
|
1040
1345
|
* Wakes the body if asleep.
|
|
1041
1346
|
*
|
|
@@ -1076,7 +1381,17 @@ export class PhysicsSystem extends System {
|
|
|
1076
1381
|
}
|
|
1077
1382
|
|
|
1078
1383
|
/**
|
|
1079
|
-
* Accumulate a
|
|
1384
|
+
* Accumulate a force (world-space, newtons) for the next fixedUpdate.
|
|
1385
|
+
*
|
|
1386
|
+
* The step spends the accumulated force once: as the impulse `F·dt`, `dt`
|
|
1387
|
+
* the whole step, added to the body's velocity before the substeps run,
|
|
1388
|
+
* after which the accumulator is empty. It is not re-applied at each
|
|
1389
|
+
* substep the way gravity is. So a force is a per-step budget — the same
|
|
1390
|
+
* change of momentum whatever {@link substeps} is — and one that should
|
|
1391
|
+
* last must be applied again every step. A force worked out from the
|
|
1392
|
+
* body's state (a spring's pull, a drag) is evaluated at the pose and
|
|
1393
|
+
* velocity it was computed from and acts unchanged through the step.
|
|
1394
|
+
*
|
|
1080
1395
|
* Wakes the body if asleep.
|
|
1081
1396
|
*
|
|
1082
1397
|
* @param {RigidBody} rigidBody
|
|
@@ -1148,6 +1463,9 @@ export class PhysicsSystem extends System {
|
|
|
1148
1463
|
* as-is; zero it via {@link setLinearVelocity} if the teleport should also stop
|
|
1149
1464
|
* the body.
|
|
1150
1465
|
*
|
|
1466
|
+
* Cancels a {@link setTargetPose} target set for the body earlier in the step, so the
|
|
1467
|
+
* teleport is where the step finds it.
|
|
1468
|
+
*
|
|
1151
1469
|
* Works for STATIC bodies too: their broadphase leaves are re-homed to
|
|
1152
1470
|
* the new pose, and sleepers at both the old and the new location are
|
|
1153
1471
|
* woken — a moved support drops what rested on it, and whatever it moved
|
|
@@ -1178,6 +1496,14 @@ export class PhysicsSystem extends System {
|
|
|
1178
1496
|
return;
|
|
1179
1497
|
}
|
|
1180
1498
|
|
|
1499
|
+
// A teleport supersedes a target set earlier in the step - the last call wins, as between
|
|
1500
|
+
// two targets. Left pending, the target would be reached from the teleported pose, at the
|
|
1501
|
+
// velocity that takes the body straight back.
|
|
1502
|
+
const target_base = idx * TARGET_POSE_STRIDE;
|
|
1503
|
+
if (target_base < this.__target_poses.length && this.__target_poses[target_base] === body_id) {
|
|
1504
|
+
this.__target_poses[target_base] = RIGID_BODY_UNALLOCATED;
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1181
1507
|
transform.setTranslation(position[0], position[1], position[2]);
|
|
1182
1508
|
transform.setRotation(rotation[0], rotation[1], rotation[2], rotation[3]);
|
|
1183
1509
|
|
|
@@ -1236,6 +1562,214 @@ export class PhysicsSystem extends System {
|
|
|
1236
1562
|
}
|
|
1237
1563
|
}
|
|
1238
1564
|
|
|
1565
|
+
/**
|
|
1566
|
+
* Move a {@link BodyKind.KinematicPosition} body to a pose over the next {@link fixedUpdate},
|
|
1567
|
+
* as a motion rather than a teleport: a moving platform, a door, an animated collider.
|
|
1568
|
+
*
|
|
1569
|
+
* The target is consumed by the next `fixedUpdate(dt)`. Before anything in that step reads
|
|
1570
|
+
* velocity, the step sets the body's {@link RigidBody#linearVelocity} to the displacement from
|
|
1571
|
+
* its current position over `dt`, and its {@link RigidBody#angularVelocity} to the shortest-arc
|
|
1572
|
+
* rotation from its current orientation to the target's, as axis × angle over `dt`. Those are
|
|
1573
|
+
* the velocities the contact solver sees, so a body resting on it is carried by friction
|
|
1574
|
+
* (along, and round when it turns), and a body in its way is pushed. The step integrates them
|
|
1575
|
+
* like any velocity and then writes the target pose exactly, so the body ends the step on the
|
|
1576
|
+
* target to the last bit, whatever the substep count does to the rotation's integration.
|
|
1577
|
+
*
|
|
1578
|
+
* - Calling it again before the step replaces the target; the last call wins.
|
|
1579
|
+
* - The velocities stay on the body after the step, as Box3D's `b3Body_SetTargetTransform`
|
|
1580
|
+
* leaves them: a step with no new target integrates them like any kinematic velocity, so the
|
|
1581
|
+
* body keeps moving at the same rate. To stop it, target the pose it is at (zero velocity),
|
|
1582
|
+
* or set its velocities to zero.
|
|
1583
|
+
* - It is a motion from the pose the body has when the step begins. {@link setPose} is the
|
|
1584
|
+
* teleport — it moves the body with no velocity, so nothing riding it is carried. The later
|
|
1585
|
+
* of the two calls wins: a setPose after this one cancels the target, and this one after a
|
|
1586
|
+
* setPose is a motion from the teleported pose.
|
|
1587
|
+
* - Only a KinematicPosition body takes a target. A Dynamic body's motion is the solver's; a
|
|
1588
|
+
* KinematicVelocity body is driven by the velocity written to it; a Static one never moves.
|
|
1589
|
+
* - Unlike Box3D, which takes the time step with the target and derives the velocity at the
|
|
1590
|
+
* call, the velocity is derived from the step's own `dt` when the step runs, so the two
|
|
1591
|
+
* cannot disagree. Kinematic bodies never sleep here, so there is no sleep-threshold skip.
|
|
1592
|
+
*
|
|
1593
|
+
* @param {RigidBody} rigidBody a linked {@link BodyKind.KinematicPosition} body
|
|
1594
|
+
* @param {Vector3|ArrayLike<number>} position world position to reach, indexed as [x, y, z]
|
|
1595
|
+
* @param {Quaternion|ArrayLike<number>} rotation world unit-quaternion rotation to reach,
|
|
1596
|
+
* indexed as [x, y, z, w]; asserted unit (squared length within 1e-6 of 1), since it is
|
|
1597
|
+
* written into the transform as given
|
|
1598
|
+
*/
|
|
1599
|
+
setTargetPose(rigidBody, position, rotation) {
|
|
1600
|
+
assert.defined(position, 'position');
|
|
1601
|
+
assert.isNumber(position[0], 'position[0]');
|
|
1602
|
+
assert.isNumber(position[1], 'position[1]');
|
|
1603
|
+
assert.isNumber(position[2], 'position[2]');
|
|
1604
|
+
|
|
1605
|
+
assert.defined(rotation, 'rotation');
|
|
1606
|
+
assert.isNumber(rotation[0], 'rotation[0]');
|
|
1607
|
+
assert.isNumber(rotation[1], 'rotation[1]');
|
|
1608
|
+
assert.isNumber(rotation[2], 'rotation[2]');
|
|
1609
|
+
assert.isNumber(rotation[3], 'rotation[3]');
|
|
1610
|
+
|
|
1611
|
+
// The pose is written verbatim at the end of the step, so a non-unit rotation would land
|
|
1612
|
+
// in the transform as a scale.
|
|
1613
|
+
const rotation_length_sqr = rotation[0] * rotation[0] + rotation[1] * rotation[1]
|
|
1614
|
+
+ rotation[2] * rotation[2] + rotation[3] * rotation[3];
|
|
1615
|
+
|
|
1616
|
+
// the message is built only when the check fails: as an argument it was a string per call
|
|
1617
|
+
if (!(Math.abs(rotation_length_sqr - 1) <= 1e-6)) {
|
|
1618
|
+
assert.ok(false, `setTargetPose: rotation must be a unit quaternion, its squared length is ${rotation_length_sqr}`);
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
assert.equal(rigidBody.kind, BodyKind.KinematicPosition, 'setTargetPose: the body must be BodyKind.KinematicPosition');
|
|
1622
|
+
|
|
1623
|
+
const body_id = rigidBody._bodyId;
|
|
1624
|
+
if (!this.storage.is_valid(body_id)) return;
|
|
1625
|
+
|
|
1626
|
+
const idx = body_id_index(body_id);
|
|
1627
|
+
if (this.__bodies[idx] !== rigidBody) return;
|
|
1628
|
+
|
|
1629
|
+
const base = idx * TARGET_POSE_STRIDE;
|
|
1630
|
+
|
|
1631
|
+
let poses = this.__target_poses;
|
|
1632
|
+
if (poses.length < base + TARGET_POSE_STRIDE) {
|
|
1633
|
+
const grown = new Float64Array(Math.max(base + TARGET_POSE_STRIDE, poses.length * 2));
|
|
1634
|
+
grown.set(poses);
|
|
1635
|
+
for (let i = poses.length; i < grown.length; i += TARGET_POSE_STRIDE) {
|
|
1636
|
+
grown[i] = RIGID_BODY_UNALLOCATED;
|
|
1637
|
+
}
|
|
1638
|
+
this.__target_poses = poses = grown;
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
if (poses[base] !== body_id) {
|
|
1642
|
+
poses[base] = body_id;
|
|
1643
|
+
this.__target_pose_bodies[this.__target_pose_count++] = body_id;
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
poses[base + 1] = position[0];
|
|
1647
|
+
poses[base + 2] = position[1];
|
|
1648
|
+
poses[base + 3] = position[2];
|
|
1649
|
+
poses[base + 4] = rotation[0];
|
|
1650
|
+
poses[base + 5] = rotation[1];
|
|
1651
|
+
poses[base + 6] = rotation[2];
|
|
1652
|
+
poses[base + 7] = rotation[3];
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
/**
|
|
1656
|
+
* Start of {@link fixedUpdate}: give every body with a pending {@link setTargetPose} target the
|
|
1657
|
+
* velocity that reaches it over `dt`. A step of no duration reaches nothing; its targets stay
|
|
1658
|
+
* pending for the next one.
|
|
1659
|
+
*
|
|
1660
|
+
* @private
|
|
1661
|
+
* @param {number} dt
|
|
1662
|
+
*/
|
|
1663
|
+
__derive_target_velocities(dt) {
|
|
1664
|
+
const pending = this.__target_pose_bodies;
|
|
1665
|
+
const pending_count = this.__target_pose_count;
|
|
1666
|
+
if (pending_count === 0 || !(dt > 0)) return;
|
|
1667
|
+
|
|
1668
|
+
const poses = this.__target_poses;
|
|
1669
|
+
const inv_dt = 1 / dt;
|
|
1670
|
+
|
|
1671
|
+
for (let i = 0; i < pending_count; i++) {
|
|
1672
|
+
const body_id = pending[i];
|
|
1673
|
+
if (!this.storage.is_valid(body_id)) continue;
|
|
1674
|
+
|
|
1675
|
+
const idx = body_id_index(body_id);
|
|
1676
|
+
const base = idx * TARGET_POSE_STRIDE;
|
|
1677
|
+
if (poses[base] !== body_id) continue;
|
|
1678
|
+
|
|
1679
|
+
const rb = this.__bodies[idx];
|
|
1680
|
+
if (rb.kind !== BodyKind.KinematicPosition) continue;
|
|
1681
|
+
|
|
1682
|
+
const tr = this.__transforms[idx];
|
|
1683
|
+
|
|
1684
|
+
// the transform's lanes, read in place: a component getter V8 leaves out of line hands
|
|
1685
|
+
// its number back boxed
|
|
1686
|
+
v3_set(rb.linearVelocity, 0,
|
|
1687
|
+
(poses[base + 1] - tr[TRANSFORM64_TRANSLATION_OFFSET]) * inv_dt,
|
|
1688
|
+
(poses[base + 2] - tr[TRANSFORM64_TRANSLATION_OFFSET + 1]) * inv_dt,
|
|
1689
|
+
(poses[base + 3] - tr[TRANSFORM64_TRANSLATION_OFFSET + 2]) * inv_dt
|
|
1690
|
+
);
|
|
1691
|
+
|
|
1692
|
+
// World-frame rotation from the current orientation to the target: dq = q_target ⊗ q⁻¹,
|
|
1693
|
+
// the one a world angular velocity integrates (dq/dt = ½ ω ⊗ q). Its axis × angle over
|
|
1694
|
+
// dt is the angular velocity; the shorter of the two arcs a quaternion pair describes.
|
|
1695
|
+
// Both operands go in as arrays, the target straight from its slot.
|
|
1696
|
+
scratch_target_conjugate[0] = -tr[TRANSFORM64_ROTATION_OFFSET];
|
|
1697
|
+
scratch_target_conjugate[1] = -tr[TRANSFORM64_ROTATION_OFFSET + 1];
|
|
1698
|
+
scratch_target_conjugate[2] = -tr[TRANSFORM64_ROTATION_OFFSET + 2];
|
|
1699
|
+
scratch_target_conjugate[3] = tr[TRANSFORM64_ROTATION_OFFSET + 3];
|
|
1700
|
+
|
|
1701
|
+
quat3_multiply_array(scratch_target_dq, 0, poses, base + 4, scratch_target_conjugate, 0);
|
|
1702
|
+
|
|
1703
|
+
let dx = scratch_target_dq[0];
|
|
1704
|
+
let dy = scratch_target_dq[1];
|
|
1705
|
+
let dz = scratch_target_dq[2];
|
|
1706
|
+
let dw = scratch_target_dq[3];
|
|
1707
|
+
|
|
1708
|
+
if (dw < 0) {
|
|
1709
|
+
dx = -dx;
|
|
1710
|
+
dy = -dy;
|
|
1711
|
+
dz = -dz;
|
|
1712
|
+
dw = -dw;
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
const sin_half = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
1716
|
+
|
|
1717
|
+
if (sin_half > 0) {
|
|
1718
|
+
const k = 2 * Math.atan2(sin_half, dw) / sin_half * inv_dt;
|
|
1719
|
+
v3_set(rb.angularVelocity, 0, dx * k, dy * k, dz * k);
|
|
1720
|
+
} else {
|
|
1721
|
+
v3_set(rb.angularVelocity, 0, 0, 0, 0);
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
/**
|
|
1727
|
+
* After the substep loop of {@link fixedUpdate}: write every body driven by
|
|
1728
|
+
* {@link setTargetPose} onto its target exactly, and empty the pending list. Skipped, like
|
|
1729
|
+
* {@link __derive_target_velocities}, by a step of no duration.
|
|
1730
|
+
*
|
|
1731
|
+
* @private
|
|
1732
|
+
* @param {number} dt
|
|
1733
|
+
*/
|
|
1734
|
+
__land_target_poses(dt) {
|
|
1735
|
+
const pending = this.__target_pose_bodies;
|
|
1736
|
+
const pending_count = this.__target_pose_count;
|
|
1737
|
+
if (pending_count === 0 || !(dt > 0)) return;
|
|
1738
|
+
|
|
1739
|
+
const poses = this.__target_poses;
|
|
1740
|
+
|
|
1741
|
+
for (let i = 0; i < pending_count; i++) {
|
|
1742
|
+
const body_id = pending[i];
|
|
1743
|
+
const idx = body_id_index(body_id);
|
|
1744
|
+
const base = idx * TARGET_POSE_STRIDE;
|
|
1745
|
+
|
|
1746
|
+
if (poses[base] !== body_id) continue;
|
|
1747
|
+
poses[base] = RIGID_BODY_UNALLOCATED;
|
|
1748
|
+
|
|
1749
|
+
if (!this.storage.is_valid(body_id)) continue;
|
|
1750
|
+
|
|
1751
|
+
const rb = this.__bodies[idx];
|
|
1752
|
+
if (rb.kind !== BodyKind.KinematicPosition) continue;
|
|
1753
|
+
|
|
1754
|
+
const tr = this.__transforms[idx];
|
|
1755
|
+
|
|
1756
|
+
// slot to lanes, no number handed to a call: V8 left setRotation out of line here, and a
|
|
1757
|
+
// call that is not inlined boxes the numbers it is passed
|
|
1758
|
+
tr[TRANSFORM64_TRANSLATION_OFFSET] = poses[base + 1];
|
|
1759
|
+
tr[TRANSFORM64_TRANSLATION_OFFSET + 1] = poses[base + 2];
|
|
1760
|
+
tr[TRANSFORM64_TRANSLATION_OFFSET + 2] = poses[base + 3];
|
|
1761
|
+
tr[TRANSFORM64_ROTATION_OFFSET] = poses[base + 4];
|
|
1762
|
+
tr[TRANSFORM64_ROTATION_OFFSET + 1] = poses[base + 5];
|
|
1763
|
+
tr[TRANSFORM64_ROTATION_OFFSET + 2] = poses[base + 6];
|
|
1764
|
+
tr[TRANSFORM64_ROTATION_OFFSET + 3] = poses[base + 7];
|
|
1765
|
+
|
|
1766
|
+
// the orientation was written, so the matrix is behind the components
|
|
1767
|
+
tr.updateMatrix();
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
this.__target_pose_count = 0;
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1239
1773
|
/**
|
|
1240
1774
|
* Force the body awake. Static bodies are ignored.
|
|
1241
1775
|
* @param {RigidBody} rigidBody
|
|
@@ -1395,10 +1929,18 @@ export class PhysicsSystem extends System {
|
|
|
1395
1929
|
* Raycast against both broadphase trees. Fills `result` with the nearest
|
|
1396
1930
|
* hit and returns `true` on hit, `false` on miss.
|
|
1397
1931
|
*
|
|
1398
|
-
* Resolves
|
|
1399
|
-
*
|
|
1400
|
-
*
|
|
1401
|
-
*
|
|
1932
|
+
* Resolves against the real shapes: `result.t` is the distance to the
|
|
1933
|
+
* struck surface and `result.normal` its normal there, for every shape the
|
|
1934
|
+
* engine defines (a shape from outside it falls back to its tight bounding
|
|
1935
|
+
* box). Every collider of a compound body is tested; `result.collider_entity`
|
|
1936
|
+
* names the one struck, and `result.triangle` the triangle of a mesh or
|
|
1937
|
+
* heightmap collider. Sensors are passed through.
|
|
1938
|
+
*
|
|
1939
|
+
* The filter may run a {@link shapeCast} or an {@link overlap} of its own,
|
|
1940
|
+
* but not another raycast (refused by an assert: queries of one kind share
|
|
1941
|
+
* their working state). A production build strips asserts, and there
|
|
1942
|
+
* nothing refuses it: the answer is silently wrong — a ray whose filter cast
|
|
1943
|
+
* another ray named entity 8 at t 1.5, where the truth is entity 1 at 2.5.
|
|
1402
1944
|
*
|
|
1403
1945
|
* @param {Ray3} ray origin + unit direction + `tMax`
|
|
1404
1946
|
* @param {PhysicsSurfacePoint} result populated on hit; untouched on miss
|
|
@@ -1415,15 +1957,23 @@ export class PhysicsSystem extends System {
|
|
|
1415
1957
|
* The shape starts at `ray.origin` oriented by `rotation` and translates
|
|
1416
1958
|
* along `ray.direction` for up to `ray.tMax` units.
|
|
1417
1959
|
*
|
|
1418
|
-
*
|
|
1419
|
-
*
|
|
1960
|
+
* `t` is the time of impact — the swept shape at `t` is just apart from
|
|
1961
|
+
* what it struck — and `result.position` the swept shape's centre there,
|
|
1962
|
+
* not a point on the surface. `result.collider_entity` names the struck
|
|
1963
|
+
* collider and `result.triangle` the triangle of a mesh or heightmap one.
|
|
1964
|
+
*
|
|
1965
|
+
* The filter may run a {@link raycast} or an {@link overlap} of its own,
|
|
1966
|
+
* but not another shapeCast (refused by an assert: queries of one kind
|
|
1967
|
+
* share their working state). A production build strips asserts, and there
|
|
1968
|
+
* nothing refuses it: the outer cast silently misses what it should hit.
|
|
1420
1969
|
*
|
|
1421
1970
|
* @param {Ray3} ray origin + unit direction + `tMax`
|
|
1422
1971
|
* @param {AbstractShape3D} shape
|
|
1423
1972
|
* @param {ArrayLike<number>} rotation fixed orientation of the swept shape
|
|
1424
|
-
* as `[x, y, z, w]`, a unit quaternion
|
|
1425
|
-
*
|
|
1426
|
-
*
|
|
1973
|
+
* as `[x, y, z, w]`, a unit quaternion, in an array the caller retains —
|
|
1974
|
+
* not a Transform64's `rotation`, which allocates a view on every read.
|
|
1975
|
+
* Read by index, so an `{x, y, z, w}` object silently misses everything
|
|
1976
|
+
* rather than throwing
|
|
1427
1977
|
* @param {PhysicsSurfacePoint} result populated on hit; untouched on miss
|
|
1428
1978
|
* @param {(entity:number, collider:Collider)=>boolean} [filter]
|
|
1429
1979
|
* @returns {boolean}
|
|
@@ -1444,13 +1994,17 @@ export class PhysicsSystem extends System {
|
|
|
1444
1994
|
* available.
|
|
1445
1995
|
*
|
|
1446
1996
|
* `filter` runs before the shape test, which is the expensive part — use
|
|
1447
|
-
* it to skip the caller's own body, allies, sensors.
|
|
1997
|
+
* it to skip the caller's own body, allies, sensors. It may run a
|
|
1998
|
+
* {@link raycast} or a {@link shapeCast} of its own, but not another overlap
|
|
1999
|
+
* (refused by an assert: queries of one kind share their working state). A
|
|
2000
|
+
* production build strips asserts, and there nothing refuses it: the outer
|
|
2001
|
+
* overlap silently comes back short — 0 of the 8 bodies it overlapped.
|
|
1448
2002
|
*
|
|
1449
2003
|
* The query shape must be convex; a concave one throws.
|
|
1450
2004
|
*
|
|
1451
2005
|
* @param {AbstractShape3D} shape convex query shape, in its local frame
|
|
1452
|
-
* @param {ArrayLike<number>} position world position of the query shape, as `[x, y, z]
|
|
1453
|
-
*
|
|
2006
|
+
* @param {ArrayLike<number>} position world position of the query shape, as `[x, y, z]`, in an
|
|
2007
|
+
* array the caller retains - not a Transform64's `translation`, which allocates a view per read
|
|
1454
2008
|
* @param {ArrayLike<number>} rotation world rotation as `[x, y, z, w]`, a unit quaternion
|
|
1455
2009
|
* @param {Uint32Array|number[]} output buffer to receive body_ids
|
|
1456
2010
|
* @param {number} output_offset starting index in output
|
|
@@ -1690,7 +2244,8 @@ export class PhysicsSystem extends System {
|
|
|
1690
2244
|
*
|
|
1691
2245
|
* - If any member carries {@link RigidBodyFlags.DisableSleep}, the
|
|
1692
2246
|
* entire island is exempt; every member's sleep_timer is reset.
|
|
1693
|
-
* - If `max(|v|² +
|
|
2247
|
+
* - If `max(|v|² + |ω|²·max(R, 1)²)` across all members (`R` the
|
|
2248
|
+
* member's extent, {@link __body_extent}) is below
|
|
1694
2249
|
* {@link sleepVelocitySqrThreshold}, every member's sleep_timer is
|
|
1695
2250
|
* incremented by `dt`. When the smallest member's timer crosses
|
|
1696
2251
|
* {@link sleepTimeThreshold}, the whole island sleeps atomically in
|
|
@@ -1715,6 +2270,8 @@ export class PhysicsSystem extends System {
|
|
|
1715
2270
|
const island_count = islands.island_count;
|
|
1716
2271
|
const body_offsets = islands.body_offsets;
|
|
1717
2272
|
const body_data = islands.body_data;
|
|
2273
|
+
// Every island member was awake at stage 2, which wrote its extent.
|
|
2274
|
+
const body_extent = this.__body_extent;
|
|
1718
2275
|
|
|
1719
2276
|
for (let isl = 0; isl < island_count; isl++) {
|
|
1720
2277
|
const start = body_offsets[isl];
|
|
@@ -1732,10 +2289,20 @@ export class PhysicsSystem extends System {
|
|
|
1732
2289
|
any_disable_sleep = true;
|
|
1733
2290
|
break;
|
|
1734
2291
|
}
|
|
2292
|
+
// Speed of the body's far end: angular velocity times the
|
|
2293
|
+
// body's extent, floored at a metre — so a body whose extent is
|
|
2294
|
+
// at most a metre is judged on |v|² + |ω|² exactly as it always
|
|
2295
|
+
// was, and a 100 m rod turning at 0.05 rad/s, its tip moving at
|
|
2296
|
+
// 5 m/s, is not at rest (Box3D: |v| + |ω × maxExtent|).
|
|
2297
|
+
const extent = body_extent[idx];
|
|
2298
|
+
const reach = extent > 1 ? extent : 1;
|
|
1735
2299
|
const lv = rb.linearVelocity;
|
|
1736
2300
|
const av = rb.angularVelocity;
|
|
2301
|
+
const wx = av[0] * reach;
|
|
2302
|
+
const wy = av[1] * reach;
|
|
2303
|
+
const wz = av[2] * reach;
|
|
1737
2304
|
const v_sqr = lv[0] * lv[0] + lv[1] * lv[1] + lv[2] * lv[2]
|
|
1738
|
-
+
|
|
2305
|
+
+ wx * wx + wy * wy + wz * wz;
|
|
1739
2306
|
if (v_sqr > max_v_sqr) max_v_sqr = v_sqr;
|
|
1740
2307
|
}
|
|
1741
2308
|
|
|
@@ -1896,6 +2463,11 @@ export class PhysicsSystem extends System {
|
|
|
1896
2463
|
const joints = this.__joints;
|
|
1897
2464
|
const manifolds = this.manifolds;
|
|
1898
2465
|
|
|
2466
|
+
// Stage -1: turn each pending setTargetPose target into the velocity that reaches it over
|
|
2467
|
+
// this step, before anything reads velocity — the parked-platform test in the wake
|
|
2468
|
+
// propagation below, the broadphase pad, the solver.
|
|
2469
|
+
this.__derive_target_velocities(dt);
|
|
2470
|
+
|
|
1899
2471
|
// Stage 0: wake propagation — through the persistent manifolds
|
|
1900
2472
|
// (last frame's broadphase-touched pairs), then through joints.
|
|
1901
2473
|
// Runs before everything else so a just-woken body is part of this
|
|
@@ -1930,6 +2502,13 @@ export class PhysicsSystem extends System {
|
|
|
1930
2502
|
// pose, padded by the swept extent for the body's velocity. The fat
|
|
1931
2503
|
// margin uses the post-force velocity; this frame's gravity increment
|
|
1932
2504
|
// is a sub-millimetre slack difference, safely inside the margin.
|
|
2505
|
+
// Records each awake body's extent for the sleep test on the way, from
|
|
2506
|
+
// the same local boxes.
|
|
2507
|
+
if (this.__body_extent.length < storage.high_water_mark) {
|
|
2508
|
+
this.__body_extent = new Float64Array(storage.high_water_mark * 2);
|
|
2509
|
+
}
|
|
2510
|
+
|
|
2511
|
+
const body_extent = this.__body_extent;
|
|
1933
2512
|
const lists = this.__body_collider_lists;
|
|
1934
2513
|
for (let i = 0; i < count; i++) {
|
|
1935
2514
|
|
|
@@ -1937,17 +2516,58 @@ export class PhysicsSystem extends System {
|
|
|
1937
2516
|
const rb = bodies[idx];
|
|
1938
2517
|
const list = lists[idx];
|
|
1939
2518
|
|
|
2519
|
+
body_extent[idx] = 0;
|
|
2520
|
+
|
|
1940
2521
|
if (list === undefined) {
|
|
1941
2522
|
continue;
|
|
1942
2523
|
}
|
|
1943
2524
|
|
|
1944
2525
|
const lv = rb.linearVelocity;
|
|
2526
|
+
const body_transform = transforms[idx];
|
|
1945
2527
|
|
|
1946
2528
|
const list_length = list.length;
|
|
1947
2529
|
|
|
2530
|
+
let extent = 0;
|
|
2531
|
+
|
|
1948
2532
|
for (let k = 0; k < list_length; k++) {
|
|
1949
2533
|
|
|
1950
2534
|
const entry = list[k];
|
|
2535
|
+
const collider_transform = entry.transform;
|
|
2536
|
+
|
|
2537
|
+
// The tight world box, as compute_world_aabb builds it, from a
|
|
2538
|
+
// local box this loop keeps for the extent below.
|
|
2539
|
+
entry.collider.shape.compute_bounding_box(scratch_local_aabb);
|
|
2540
|
+
|
|
2541
|
+
// The pose goes in an array: handed to aabb3_transform_oriented as seven numbers
|
|
2542
|
+
// (it is not inlined into this step), each would be boxed, per collider per step.
|
|
2543
|
+
// It, and the offset below, are read off the transforms' lanes rather than through
|
|
2544
|
+
// their accessors, which this step does not inline either and which return their
|
|
2545
|
+
// numbers boxed.
|
|
2546
|
+
const pose = scratch_refit_pose;
|
|
2547
|
+
pose[0] = collider_transform[TRANSFORM64_TRANSLATION_OFFSET];
|
|
2548
|
+
pose[1] = collider_transform[TRANSFORM64_TRANSLATION_OFFSET + 1];
|
|
2549
|
+
pose[2] = collider_transform[TRANSFORM64_TRANSLATION_OFFSET + 2];
|
|
2550
|
+
pose[3] = collider_transform[TRANSFORM64_ROTATION_OFFSET];
|
|
2551
|
+
pose[4] = collider_transform[TRANSFORM64_ROTATION_OFFSET + 1];
|
|
2552
|
+
pose[5] = collider_transform[TRANSFORM64_ROTATION_OFFSET + 2];
|
|
2553
|
+
pose[6] = collider_transform[TRANSFORM64_ROTATION_OFFSET + 3];
|
|
2554
|
+
|
|
2555
|
+
aabb3_transform_oriented_array(scratch_world_aabb, 0, scratch_local_aabb, 0, pose, 0);
|
|
2556
|
+
|
|
2557
|
+
// Farthest corner of the local box from the collider's origin,
|
|
2558
|
+
// plus the collider's offset from the body's centre: no point
|
|
2559
|
+
// of the collider lies farther from the body's centre.
|
|
2560
|
+
const ex = Math.max(-scratch_local_aabb[0], scratch_local_aabb[3]);
|
|
2561
|
+
const ey = Math.max(-scratch_local_aabb[1], scratch_local_aabb[4]);
|
|
2562
|
+
const ez = Math.max(-scratch_local_aabb[2], scratch_local_aabb[5]);
|
|
2563
|
+
const ox = pose[0] - body_transform[TRANSFORM64_TRANSLATION_OFFSET];
|
|
2564
|
+
const oy = pose[1] - body_transform[TRANSFORM64_TRANSLATION_OFFSET + 1];
|
|
2565
|
+
const oz = pose[2] - body_transform[TRANSFORM64_TRANSLATION_OFFSET + 2];
|
|
2566
|
+
const reach = Math.sqrt(ex * ex + ey * ey + ez * ez) + Math.sqrt(ox * ox + oy * oy + oz * oz);
|
|
2567
|
+
|
|
2568
|
+
if (reach > extent) {
|
|
2569
|
+
extent = reach;
|
|
2570
|
+
}
|
|
1951
2571
|
|
|
1952
2572
|
// Refit skip — the fat margin's whole purpose: while the
|
|
1953
2573
|
// body's FATTENED box (tight + velocity pad) stays inside the
|
|
@@ -1965,8 +2585,7 @@ export class PhysicsSystem extends System {
|
|
|
1965
2585
|
// otherwise keep a leaf covering none of the path it travels
|
|
1966
2586
|
// this step — invisible to pair generation and to other
|
|
1967
2587
|
// bodies' CCD sweeps for the whole step.
|
|
1968
|
-
|
|
1969
|
-
fatten_world_aabb(scratch_world_aabb, 0, lv[0], lv[1], lv[2], dt);
|
|
2588
|
+
fatten_world_aabb_array(scratch_world_aabb, 0, lv, 0, dt);
|
|
1970
2589
|
const node = entry.bvhNode;
|
|
1971
2590
|
this.dynamicBvh.node_get_aabb(node, scratch_stored_aabb);
|
|
1972
2591
|
if (scratch_world_aabb[0] >= scratch_stored_aabb[0]
|
|
@@ -1978,8 +2597,14 @@ export class PhysicsSystem extends System {
|
|
|
1978
2597
|
continue;
|
|
1979
2598
|
}
|
|
1980
2599
|
|
|
2600
|
+
// Outward, so the stored leaf still contains this fat box: the
|
|
2601
|
+
// next step's skip test is then exact for a body that has not
|
|
2602
|
+
// moved, as well as conservative for every query in between.
|
|
2603
|
+
aabb3_round_outward_f32(scratch_world_aabb);
|
|
1981
2604
|
this.dynamicBvh.node_move_aabb(node, scratch_world_aabb);
|
|
1982
2605
|
}
|
|
2606
|
+
|
|
2607
|
+
body_extent[idx] = extent;
|
|
1983
2608
|
}
|
|
1984
2609
|
|
|
1985
2610
|
// Stage 3: broadphase pair generation. The fat AABBs cover the full
|
|
@@ -2016,8 +2641,8 @@ export class PhysicsSystem extends System {
|
|
|
2016
2641
|
// at a resting contact (each cancels `h` of the other), so stacks hold
|
|
2017
2642
|
// at zero velocity and sleep; the position correction adapts as bodies
|
|
2018
2643
|
// separate between substeps — the TGS stack-stability mechanism —
|
|
2019
|
-
// without re-running narrowphase. Restitution is applied
|
|
2020
|
-
//
|
|
2644
|
+
// without re-running narrowphase. Restitution is applied after the
|
|
2645
|
+
// loop.
|
|
2021
2646
|
// Clamp the substep count: 0 (or a negative / fractional value) would
|
|
2022
2647
|
// feed h = dt / N = Infinity into prepare_contacts and a broken loop
|
|
2023
2648
|
// bound into the solver.
|
|
@@ -2029,8 +2654,10 @@ export class PhysicsSystem extends System {
|
|
|
2029
2654
|
// post-wake awake set (poses are unchanged until the substep loop below
|
|
2030
2655
|
// integrates them). The CCD pass after the solver sweeps from here to
|
|
2031
2656
|
// each body's final pose. Reads the primary collider's transform so the
|
|
2032
|
-
// start matches the end the resolve pass reads.
|
|
2033
|
-
//
|
|
2657
|
+
// start matches the end the resolve pass reads. When any body is
|
|
2658
|
+
// flagged, also the start-of-step velocity of every awake dynamic
|
|
2659
|
+
// body, any of which a sweep can strike. Costs nothing more than the
|
|
2660
|
+
// walk when no body is flagged.
|
|
2034
2661
|
const ccd_on = this.ccdEnabled;
|
|
2035
2662
|
|
|
2036
2663
|
if (ccd_on) {
|
|
@@ -2039,9 +2666,12 @@ export class PhysicsSystem extends System {
|
|
|
2039
2666
|
|
|
2040
2667
|
if (this.__ccd_start_pos.length < ccd_need) {
|
|
2041
2668
|
this.__ccd_start_pos = new Float64Array(ccd_need);
|
|
2669
|
+
this.__ccd_start_vel = new Float64Array(ccd_need);
|
|
2042
2670
|
}
|
|
2043
2671
|
|
|
2044
2672
|
const ccd_start = this.__ccd_start_pos;
|
|
2673
|
+
const ccd_movers_before = this.__ccd_mover_count;
|
|
2674
|
+
let ccd_count = 0;
|
|
2045
2675
|
|
|
2046
2676
|
for (let i = 0; i < count_after_wake; i++) {
|
|
2047
2677
|
const idx = storage.awake_at(i);
|
|
@@ -2066,12 +2696,47 @@ export class PhysicsSystem extends System {
|
|
|
2066
2696
|
ccd_start[cb] = cp.translation_x;
|
|
2067
2697
|
ccd_start[cb + 1] = cp.translation_y;
|
|
2068
2698
|
ccd_start[cb + 2] = cp.translation_z;
|
|
2699
|
+
|
|
2700
|
+
if (ccd_count === this.__ccd_movers.length) {
|
|
2701
|
+
const grown = new Uint32Array(this.__ccd_movers.length * 2);
|
|
2702
|
+
grown.set(this.__ccd_movers);
|
|
2703
|
+
this.__ccd_movers = grown;
|
|
2704
|
+
}
|
|
2705
|
+
this.__ccd_movers[ccd_count] = idx;
|
|
2706
|
+
this.__ccd_mover_colliders[ccd_count] = list[0].collider;
|
|
2707
|
+
ccd_count++;
|
|
2708
|
+
}
|
|
2709
|
+
|
|
2710
|
+
// Let go of last step's colliders past this step's count.
|
|
2711
|
+
for (let k = ccd_count; k < ccd_movers_before; k++) {
|
|
2712
|
+
this.__ccd_mover_colliders[k] = null;
|
|
2713
|
+
}
|
|
2714
|
+
this.__ccd_mover_count = ccd_count;
|
|
2715
|
+
|
|
2716
|
+
if (ccd_count > 0) {
|
|
2717
|
+
const ccd_start_vel = this.__ccd_start_vel;
|
|
2718
|
+
|
|
2719
|
+
for (let i = 0; i < count_after_wake; i++) {
|
|
2720
|
+
const idx = storage.awake_at(i);
|
|
2721
|
+
const rb = bodies[idx];
|
|
2722
|
+
|
|
2723
|
+
if (rb.kind !== BodyKind.Dynamic) {
|
|
2724
|
+
continue;
|
|
2725
|
+
}
|
|
2726
|
+
|
|
2727
|
+
const lv = rb.linearVelocity;
|
|
2728
|
+
const cb = idx * 3;
|
|
2729
|
+
|
|
2730
|
+
ccd_start_vel[cb] = lv[0];
|
|
2731
|
+
ccd_start_vel[cb + 1] = lv[1];
|
|
2732
|
+
ccd_start_vel[cb + 2] = lv[2];
|
|
2733
|
+
}
|
|
2069
2734
|
}
|
|
2070
2735
|
}
|
|
2071
2736
|
|
|
2072
2737
|
// Size the pseudo-velocity buffer ONCE (it may reallocate on growth),
|
|
2073
|
-
// then capture the reference. Inside the loop we only zero
|
|
2074
|
-
//
|
|
2738
|
+
// then capture the reference. Inside the loop we only zero what a
|
|
2739
|
+
// position pass wrote — re-capturing is unnecessary since it won't
|
|
2075
2740
|
// reallocate again this step.
|
|
2076
2741
|
this.__reset_pseudo_velocity();
|
|
2077
2742
|
const pseudoVel = this.__pseudo_velocity;
|
|
@@ -2154,15 +2819,17 @@ export class PhysicsSystem extends System {
|
|
|
2154
2819
|
// Joints share the substep: warm-start + velocity-solve the 6-DOF
|
|
2155
2820
|
// constraints on real velocity, coupled with the contacts above
|
|
2156
2821
|
// (a body touched by both sees one substep of Gauss-Seidel across
|
|
2157
|
-
// contacts then joints)
|
|
2158
|
-
// SPOOK bias inside this solve, so
|
|
2159
|
-
//
|
|
2160
|
-
//
|
|
2822
|
+
// contacts then joints), in jointIterations passes over all the
|
|
2823
|
+
// joints. Position correction is a SPOOK bias inside this solve, so
|
|
2824
|
+
// no separate joint position pass (the relax below takes the limits'
|
|
2825
|
+
// push back out). Solved in the entity-canonical order (NOT joint-id
|
|
2826
|
+
// order, which encodes link/unlink history) — see __joints_sorted.
|
|
2827
|
+
const joints_reverse = (s & 1) === 1;
|
|
2161
2828
|
if (this.__joints_sorted.length > 0) {
|
|
2162
2829
|
// Alternate the joint sweep direction on odd substeps so the chain
|
|
2163
2830
|
// is solved root→tip and tip→root across the step (symmetric
|
|
2164
2831
|
// Gauss-Seidel), cancelling the one-direction propagation bias.
|
|
2165
|
-
solve_joints(this.__joints_sorted, this, h, this.jointIterations,
|
|
2832
|
+
solve_joints(this.__joints_sorted, this, h, this.jointIterations, joints_reverse);
|
|
2166
2833
|
}
|
|
2167
2834
|
|
|
2168
2835
|
// Position correction writes pseudo-velocity (zeroed first so it
|
|
@@ -2170,21 +2837,20 @@ export class PhysicsSystem extends System {
|
|
|
2170
2837
|
// position integrate and then discarded. SOFT contacts skip it:
|
|
2171
2838
|
// their penetration recovery is the velocity-bias term, and the
|
|
2172
2839
|
// relax pass below strips the momentum that bias injected
|
|
2173
|
-
// (Box2D-v3 substep order).
|
|
2840
|
+
// (Box2D-v3 substep order). Zeroing is a no-op unless a position
|
|
2841
|
+
// pass has written since, so soft steps never pay for it.
|
|
2174
2842
|
const contacts_soft = this.contactHertz > 0;
|
|
2175
|
-
|
|
2843
|
+
this.__clear_pseudo_velocity();
|
|
2176
2844
|
if (!contacts_soft) {
|
|
2177
2845
|
solve_position(manifolds, this, this.positionIterations);
|
|
2846
|
+
this.__pseudo_velocity_dirty = pseudo_len;
|
|
2178
2847
|
}
|
|
2179
2848
|
|
|
2180
2849
|
for (let i = 0; i < count_after_wake; i++) {
|
|
2181
2850
|
const idx = storage.awake_at(i);
|
|
2182
2851
|
const rb = bodies[idx];
|
|
2183
2852
|
const tr = transforms[idx];
|
|
2184
|
-
|
|
2185
|
-
integrate_position(ss_data, idx * SBS_STRIDE, rb, tr, h,
|
|
2186
|
-
pseudoVel[base], pseudoVel[base + 1], pseudoVel[base + 2],
|
|
2187
|
-
pseudoVel[base + 3], pseudoVel[base + 4], pseudoVel[base + 5]);
|
|
2853
|
+
integrate_position(ss_data, idx * SBS_STRIDE, rb, tr, h, pseudoVel, idx * 6);
|
|
2188
2854
|
}
|
|
2189
2855
|
|
|
2190
2856
|
// Relax pass (soft contacts only): one biasless sweep over the
|
|
@@ -2194,11 +2860,21 @@ export class PhysicsSystem extends System {
|
|
|
2194
2860
|
if (contacts_soft) {
|
|
2195
2861
|
solve_velocity(manifolds, this, 1, false);
|
|
2196
2862
|
}
|
|
2863
|
+
|
|
2864
|
+
// Joint relax, whatever the contact mode: one pass over the limit,
|
|
2865
|
+
// motor and spring rows without their position-correction bias,
|
|
2866
|
+
// removing the velocity a limit pushed its DOF out of violation with
|
|
2867
|
+
// — the joints have no pseudo-velocity channel, and a one-sided row
|
|
2868
|
+
// cannot take its push back, so it would carry the DOF onto its far
|
|
2869
|
+
// stop.
|
|
2870
|
+
if (this.__joints_sorted.length > 0) {
|
|
2871
|
+
relax_joints(this.__joints_sorted, this, joints_reverse);
|
|
2872
|
+
}
|
|
2197
2873
|
}
|
|
2198
2874
|
|
|
2199
|
-
// Stage 8:
|
|
2200
|
-
//
|
|
2201
|
-
apply_restitution(manifolds, this);
|
|
2875
|
+
// Stage 8: restitution, after the substep loop, keyed off the approach
|
|
2876
|
+
// velocity captured at prepare time.
|
|
2877
|
+
apply_restitution(manifolds, this, this.restitutionIterations);
|
|
2202
2878
|
|
|
2203
2879
|
// Scatter the solved persistent linear / angular velocity back onto the
|
|
2204
2880
|
// RigidBody components (pose was written through to the transforms each
|
|
@@ -2206,25 +2882,28 @@ export class PhysicsSystem extends System {
|
|
|
2206
2882
|
// interpolation recording, and the sleep test below.
|
|
2207
2883
|
solver_state.scatter(bodies);
|
|
2208
2884
|
|
|
2885
|
+
// Bodies driven by setTargetPose end the step exactly on their targets, before the move is
|
|
2886
|
+
// announced. The substeps put them there to rounding in translation; the rotation's
|
|
2887
|
+
// first-order integration falls short by O(angle³).
|
|
2888
|
+
this.__land_target_poses(dt);
|
|
2889
|
+
|
|
2209
2890
|
// The transforms moved and carry no signals of their own, so the move is announced here:
|
|
2210
2891
|
// once per awake body per step, rather than once per substep write. Everything that used to
|
|
2211
2892
|
// wake on position.onChanged - the render placement, the parent/child sync, fog-of-war -
|
|
2212
2893
|
// wakes on this instead.
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
: null;
|
|
2894
|
+
const ecd = (this.entityManager !== null && this.entityManager !== undefined)
|
|
2895
|
+
? this.entityManager.dataset
|
|
2896
|
+
: null;
|
|
2217
2897
|
|
|
2218
|
-
|
|
2219
|
-
|
|
2898
|
+
if (ecd !== null) {
|
|
2899
|
+
const awake_count = storage.awake_count;
|
|
2220
2900
|
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2901
|
+
for (let i = 0; i < awake_count; i++) {
|
|
2902
|
+
const idx = storage.awake_at(i);
|
|
2903
|
+
const entity = storage.entity_at(idx);
|
|
2224
2904
|
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
}
|
|
2905
|
+
if (entity >= 0) {
|
|
2906
|
+
t64_announce_change(ecd, entity);
|
|
2228
2907
|
}
|
|
2229
2908
|
}
|
|
2230
2909
|
}
|
|
@@ -2234,8 +2913,27 @@ export class PhysicsSystem extends System {
|
|
|
2234
2913
|
// can't tunnel through thin geometry between discrete steps. Runs on the
|
|
2235
2914
|
// final post-solve poses, before the sleep test sees the clamped
|
|
2236
2915
|
// velocities. No-op when no awake body is flagged.
|
|
2916
|
+
//
|
|
2917
|
+
// It has to run AFTER the announcement above, which is what composes a
|
|
2918
|
+
// compound body's child colliders: the sweep reads its end pose from the
|
|
2919
|
+
// primary collider's transform. So a body it clamps was announced at the
|
|
2920
|
+
// pose it would have TUNNELLED to, and everything composed from that
|
|
2921
|
+
// pose synchronously — attached children, child colliders, listeners —
|
|
2922
|
+
// is stale. Announce those bodies again, now at their final pose.
|
|
2237
2923
|
if (ccd_on) {
|
|
2238
|
-
ccd_resolve(this);
|
|
2924
|
+
const clamped = ccd_resolve(this, dt, h, count_after_wake);
|
|
2925
|
+
|
|
2926
|
+
if (clamped > 0 && ecd !== null) {
|
|
2927
|
+
const clamped_bodies = ccd_clamped_bodies();
|
|
2928
|
+
|
|
2929
|
+
for (let i = 0; i < clamped; i++) {
|
|
2930
|
+
const entity = storage.entity_at(clamped_bodies[i]);
|
|
2931
|
+
|
|
2932
|
+
if (entity >= 0) {
|
|
2933
|
+
t64_announce_change(ecd, entity);
|
|
2934
|
+
}
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2239
2937
|
}
|
|
2240
2938
|
|
|
2241
2939
|
// Stage 9: sleep test.
|