@woosh/meep-engine 2.139.0 → 2.141.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/package.json +1 -1
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_aabb.d.ts +3 -3
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_aabb.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_aabb.js +4 -4
- package/src/{engine/physics/broadphase/aabb_transform_oriented.d.ts → core/geom/3d/aabb/aabb3_transform_oriented.d.ts} +2 -2
- package/src/core/geom/3d/aabb/aabb3_transform_oriented.d.ts.map +1 -0
- package/src/{engine/physics/broadphase/aabb_transform_oriented.js → core/geom/3d/aabb/aabb3_transform_oriented.js} +1 -1
- package/src/core/geom/3d/quaternion/quat3_multiply.d.ts +21 -0
- package/src/core/geom/3d/quaternion/quat3_multiply.d.ts.map +1 -0
- package/src/core/geom/3d/quaternion/quat3_multiply.js +25 -0
- package/src/core/geom/3d/quaternion/quat3_to_matrix3.d.ts +54 -0
- package/src/core/geom/3d/quaternion/quat3_to_matrix3.d.ts.map +1 -0
- package/src/core/geom/3d/quaternion/quat3_to_matrix3.js +69 -0
- package/src/core/geom/3d/shape/AbstractShape3D.d.ts +24 -2
- package/src/core/geom/3d/shape/AbstractShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/AbstractShape3D.js +24 -1
- package/src/core/geom/3d/shape/HeightMapShape3D.d.ts +148 -0
- package/src/core/geom/3d/shape/HeightMapShape3D.d.ts.map +1 -0
- package/src/core/geom/3d/shape/HeightMapShape3D.js +451 -0
- package/src/core/geom/3d/shape/MeshShape3D.d.ts +210 -0
- package/src/core/geom/3d/shape/MeshShape3D.d.ts.map +1 -0
- package/src/core/geom/3d/shape/MeshShape3D.js +593 -0
- package/src/core/geom/3d/shape/TransformedShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/TransformedShape3D.js +46 -2
- package/src/core/geom/3d/shape/Triangle3D.d.ts +95 -0
- package/src/core/geom/3d/shape/Triangle3D.d.ts.map +1 -0
- package/src/core/geom/3d/shape/Triangle3D.js +318 -0
- package/src/core/geom/3d/shape/UnionShape3D.js +13 -0
- package/src/core/geom/3d/shape/shape_mesh_from_geometry.d.ts +30 -0
- package/src/core/geom/3d/shape/shape_mesh_from_geometry.d.ts.map +1 -0
- package/src/core/geom/3d/shape/shape_mesh_from_geometry.js +64 -0
- package/src/core/geom/3d/tetrahedra/prototype_tetrahedrize_mesh.js +9 -11
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_build_vertex_to_tets_map.d.ts +28 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_build_vertex_to_tets_map.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_build_vertex_to_tets_map.js +48 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_improve_quality.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_improve_quality.js +40 -18
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_smooth_vertex.d.ts +9 -5
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_smooth_vertex.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_smooth_vertex.js +38 -10
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_vertex_is_boundary.d.ts +14 -5
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_vertex_is_boundary.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_vertex_is_boundary.js +47 -5
- package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.d.ts +19 -0
- package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.js +75 -13
- package/src/core/geom/3d/triangle/v3_compute_triangle_normal.d.ts +2 -2
- package/src/core/geom/3d/triangle/v3_compute_triangle_normal.d.ts.map +1 -1
- package/src/core/geom/3d/triangle/v3_compute_triangle_normal.js +1 -1
- package/src/core/geom/vec3/v3_dot_array_array.d.ts +3 -3
- package/src/core/geom/vec3/v3_dot_array_array.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_dot_array_array.js +2 -2
- package/src/core/geom/vec3/v3_negate_array.d.ts +3 -3
- package/src/core/geom/vec3/v3_negate_array.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_negate_array.js +2 -2
- package/src/core/geom/vec3/v3_quat3_apply.d.ts +29 -0
- package/src/core/geom/vec3/v3_quat3_apply.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_quat3_apply.js +39 -0
- package/src/core/geom/vec3/v3_quat3_apply_inverse.d.ts +30 -0
- package/src/core/geom/vec3/v3_quat3_apply_inverse.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_quat3_apply_inverse.js +41 -0
- package/src/core/geom/vec3/v3_triple_cross_product.d.ts +32 -0
- package/src/core/geom/vec3/v3_triple_cross_product.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_triple_cross_product.js +45 -0
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts +16 -3
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerController.js +211 -211
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts +72 -8
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.js +37 -5
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts +101 -3
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.js +1789 -1416
- package/src/engine/control/first-person/TODO.md +173 -127
- package/src/engine/control/first-person/abilities/Slide.d.ts.map +1 -1
- package/src/engine/control/first-person/abilities/Slide.js +9 -1
- package/src/engine/control/first-person/prototype_first_person_controller.js +88 -2
- package/src/engine/control/first-person/test/buildTestPlayer.d.ts.map +1 -1
- package/src/engine/control/first-person/test/buildTestPlayer.js +9 -1
- package/src/engine/graphics/geometry/CapsuleGeometry.d.ts +42 -0
- package/src/engine/graphics/geometry/CapsuleGeometry.d.ts.map +1 -0
- package/src/engine/graphics/geometry/CapsuleGeometry.js +171 -0
- package/src/engine/physics/BULLET_REVIEW.md +945 -0
- package/src/engine/physics/CANNON_REVIEW.md +1300 -0
- package/src/engine/physics/JOLT_REVIEW.md +913 -0
- package/src/engine/physics/PLAN.md +578 -236
- package/src/engine/physics/RAPIER_REVIEW.md +934 -0
- package/src/engine/physics/REVIEW_001_ACTION_PLAN.md +642 -0
- package/src/engine/physics/REVIEW_002.md +151 -0
- package/src/engine/physics/broadphase/compute_fat_world_aabb.js +2 -2
- package/src/engine/physics/constraint/DofMode.d.ts +28 -0
- package/src/engine/physics/constraint/DofMode.d.ts.map +1 -0
- package/src/engine/physics/constraint/DofMode.js +35 -0
- package/src/engine/physics/constraint/solve_constraints.d.ts +16 -0
- package/src/engine/physics/constraint/solve_constraints.d.ts.map +1 -0
- package/src/engine/physics/constraint/solve_constraints.js +436 -0
- package/src/engine/physics/contact/ManifoldStore.d.ts +83 -10
- package/src/engine/physics/contact/ManifoldStore.d.ts.map +1 -1
- package/src/engine/physics/contact/ManifoldStore.js +608 -499
- package/src/engine/physics/ecs/ColliderObserverSystem.d.ts +2 -2
- package/src/engine/physics/ecs/ColliderObserverSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/Joint.d.ts +179 -0
- package/src/engine/physics/ecs/Joint.d.ts.map +1 -0
- package/src/engine/physics/ecs/Joint.js +234 -0
- package/src/engine/physics/ecs/PhysicsSystem.d.ts +180 -20
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.js +1423 -1159
- package/src/engine/physics/fluid/FluidField.d.ts +14 -10
- package/src/engine/physics/fluid/FluidField.d.ts.map +1 -1
- package/src/engine/physics/fluid/FluidField.js +14 -10
- package/src/engine/physics/fluid/FluidSimulator.js +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_compute_solid_neighbour_mask.d.ts +17 -10
- package/src/engine/physics/fluid/solver/v3_grid_compute_solid_neighbour_mask.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_compute_solid_neighbour_mask.js +18 -11
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure.d.ts +13 -10
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure.js +18 -13
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_pcg.d.ts +4 -3
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_pcg.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_pcg.js +15 -11
- package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.d.ts +30 -6
- package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.js +44 -18
- package/src/engine/physics/gjk/expanding_polytope_algorithm.d.ts +6 -6
- package/src/engine/physics/gjk/expanding_polytope_algorithm.d.ts.map +1 -1
- package/src/engine/physics/gjk/expanding_polytope_algorithm.js +68 -22
- package/src/engine/physics/gjk/gjk.d.ts +28 -2
- package/src/engine/physics/gjk/gjk.d.ts.map +1 -1
- package/src/engine/physics/gjk/gjk.js +421 -378
- package/src/engine/physics/gjk/minkowski_support.d.ts +37 -0
- package/src/engine/physics/gjk/minkowski_support.d.ts.map +1 -0
- package/src/engine/physics/gjk/minkowski_support.js +75 -0
- package/src/engine/physics/gjk/mpr.d.ts +56 -0
- package/src/engine/physics/gjk/mpr.d.ts.map +1 -0
- package/src/engine/physics/gjk/mpr.js +344 -0
- package/src/engine/physics/inertia/world_inverse_inertia.d.ts +20 -5
- package/src/engine/physics/inertia/world_inverse_inertia.d.ts.map +1 -1
- package/src/engine/physics/inertia/world_inverse_inertia.js +36 -38
- package/src/engine/physics/integration/integrate_position.d.ts +25 -7
- package/src/engine/physics/integration/integrate_position.d.ts.map +1 -1
- package/src/engine/physics/integration/integrate_position.js +43 -12
- package/src/engine/physics/integration/integrate_velocity.d.ts +30 -0
- package/src/engine/physics/integration/integrate_velocity.d.ts.map +1 -1
- package/src/engine/physics/integration/integrate_velocity.js +82 -1
- package/src/engine/physics/island/IslandBuilder.d.ts +4 -1
- package/src/engine/physics/island/IslandBuilder.d.ts.map +1 -1
- package/src/engine/physics/island/IslandBuilder.js +33 -16
- package/src/engine/physics/narrowphase/PosedShape.d.ts +0 -8
- package/src/engine/physics/narrowphase/PosedShape.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/PosedShape.js +28 -30
- package/src/engine/physics/narrowphase/box_box_manifold.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/box_box_manifold.js +140 -18
- package/src/engine/physics/narrowphase/box_triangle_contact.d.ts +30 -0
- package/src/engine/physics/narrowphase/box_triangle_contact.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/box_triangle_contact.js +811 -0
- package/src/engine/physics/narrowphase/capsule_contacts.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/capsule_contacts.js +10 -56
- package/src/engine/physics/narrowphase/capsule_triangle_contact.d.ts +71 -0
- package/src/engine/physics/narrowphase/capsule_triangle_contact.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/capsule_triangle_contact.js +375 -0
- package/src/engine/physics/narrowphase/compute_penetration.d.ts +91 -0
- package/src/engine/physics/narrowphase/compute_penetration.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/compute_penetration.js +396 -0
- package/src/engine/physics/narrowphase/decomposition/aabb_world_to_local.d.ts +35 -0
- package/src/engine/physics/narrowphase/decomposition/aabb_world_to_local.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/aabb_world_to_local.js +80 -0
- package/src/engine/physics/narrowphase/decomposition/decompose_to_triangles.d.ts +31 -0
- package/src/engine/physics/narrowphase/decomposition/decompose_to_triangles.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/decompose_to_triangles.js +55 -0
- package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.d.ts +42 -0
- package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.js +204 -0
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.d.ts +42 -0
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.js +94 -0
- package/src/engine/physics/narrowphase/decomposition/triangle_buffer_layout.d.ts +37 -0
- package/src/engine/physics/narrowphase/decomposition/triangle_buffer_layout.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/triangle_buffer_layout.js +37 -0
- package/src/engine/physics/narrowphase/narrowphase_step.d.ts +41 -2
- package/src/engine/physics/narrowphase/narrowphase_step.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/narrowphase_step.js +1497 -382
- package/src/engine/physics/narrowphase/sphere_box_contact.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/sphere_box_contact.js +16 -23
- package/src/engine/physics/narrowphase/sphere_triangle_contact.d.ts +48 -0
- package/src/engine/physics/narrowphase/sphere_triangle_contact.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/sphere_triangle_contact.js +143 -0
- package/src/engine/physics/queries/overlap_shape.d.ts +51 -0
- package/src/engine/physics/queries/overlap_shape.d.ts.map +1 -0
- package/src/engine/physics/queries/overlap_shape.js +183 -0
- package/src/engine/physics/queries/shape_cast.d.ts +56 -0
- package/src/engine/physics/queries/shape_cast.d.ts.map +1 -0
- package/src/engine/physics/queries/shape_cast.js +387 -0
- package/src/engine/physics/solver/solve_contacts.d.ts +146 -32
- package/src/engine/physics/solver/solve_contacts.d.ts.map +1 -1
- package/src/engine/physics/solver/solve_contacts.js +809 -223
- package/src/engine/physics/broadphase/aabb_transform_oriented.d.ts.map +0 -1
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_unmasked_legacy.d.ts +0 -20
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_unmasked_legacy.d.ts.map +0 -1
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_unmasked_legacy.js +0 -83
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"description": "Pure JavaScript game engine. Fully featured and production ready.",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"author": "Alexander Goldring",
|
|
9
|
-
"version": "2.
|
|
9
|
+
"version": "2.141.0",
|
|
10
10
|
"main": "build/meep.module.js",
|
|
11
11
|
"module": "build/meep.module.js",
|
|
12
12
|
"exports": {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
|
-
* @param {number[]} result
|
|
3
|
+
* @param {number[]|Uint32Array} result
|
|
4
4
|
* @param {number} result_offset
|
|
5
5
|
* @param {BVH} bvh
|
|
6
|
-
* @param {number[]|Float32Array|AABB3} aabb
|
|
6
|
+
* @param {number[]|Float32Array|Float64Array|AABB3} aabb
|
|
7
7
|
*/
|
|
8
|
-
export function bvh_query_user_data_overlaps_aabb(result: number[], result_offset: number, bvh: BVH, aabb: number[] | Float32Array | AABB3): number;
|
|
8
|
+
export function bvh_query_user_data_overlaps_aabb(result: number[] | Uint32Array, result_offset: number, bvh: BVH, aabb: number[] | Float32Array | Float64Array | AABB3): number;
|
|
9
9
|
//# sourceMappingURL=bvh_query_user_data_overlaps_aabb.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bvh_query_user_data_overlaps_aabb.d.ts","sourceRoot":"","sources":["../../../../../../src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_aabb.js"],"names":[],"mappings":"AASA;;;;;;GAMG;AACH,0DALW,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"bvh_query_user_data_overlaps_aabb.d.ts","sourceRoot":"","sources":["../../../../../../src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_aabb.js"],"names":[],"mappings":"AASA;;;;;;GAMG;AACH,0DALW,MAAM,EAAE,GAAC,WAAW,iBACpB,MAAM,kBAEN,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,QAAM,UAoElD"}
|
|
@@ -9,10 +9,10 @@ const scratch_aabb = new Float32Array(6);
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
*
|
|
12
|
-
* @param {number[]} result
|
|
12
|
+
* @param {number[]|Uint32Array} result
|
|
13
13
|
* @param {number} result_offset
|
|
14
14
|
* @param {BVH} bvh
|
|
15
|
-
* @param {number[]|Float32Array|AABB3} aabb
|
|
15
|
+
* @param {number[]|Float32Array|Float64Array|AABB3} aabb
|
|
16
16
|
*/
|
|
17
17
|
export function bvh_query_user_data_overlaps_aabb(
|
|
18
18
|
result,
|
|
@@ -48,7 +48,7 @@ export function bvh_query_user_data_overlaps_aabb(
|
|
|
48
48
|
// test node against the ray
|
|
49
49
|
bvh.node_get_aabb(node, scratch_aabb);
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
const intersection_exists = aabb3_intersects_aabb3(
|
|
52
52
|
scratch_aabb[0], scratch_aabb[1], scratch_aabb[2],
|
|
53
53
|
scratch_aabb[3], scratch_aabb[4], scratch_aabb[5],
|
|
54
54
|
aabb[0], aabb[1], aabb[2],
|
|
@@ -66,7 +66,7 @@ export function bvh_query_user_data_overlaps_aabb(
|
|
|
66
66
|
// leaf node
|
|
67
67
|
result[result_cursor++] = bvh.node_get_user_data(node);
|
|
68
68
|
|
|
69
|
-
}
|
|
69
|
+
} else {
|
|
70
70
|
// read in-order
|
|
71
71
|
const child1 = bvh.node_get_child1(node);
|
|
72
72
|
const child2 = bvh.node_get_child2(node);
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
* @param {number} qz quaternion z
|
|
27
27
|
* @param {number} qw quaternion w
|
|
28
28
|
*/
|
|
29
|
-
export function
|
|
30
|
-
//# sourceMappingURL=
|
|
29
|
+
export function aabb3_transform_oriented(result: number[] | Float32Array | Float64Array, result_offset: number, lx0: number, ly0: number, lz0: number, lx1: number, ly1: number, lz1: number, px: number, py: number, pz: number, qx: number, qy: number, qz: number, qw: number): void;
|
|
30
|
+
//# sourceMappingURL=aabb3_transform_oriented.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aabb3_transform_oriented.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/aabb/aabb3_transform_oriented.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,iDAhBW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,iBAClC,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAkEhB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hamilton product of two unit quaternions: `out = a ⊗ b`.
|
|
3
|
+
*
|
|
4
|
+
* Composition order is the usual rotation convention: the product `a ⊗ b`
|
|
5
|
+
* applies `b` first, then `a` (i.e. `(a⊗b)·v·(a⊗b)* == a·(b·v·b*)·a*`). So to
|
|
6
|
+
* rotate a vector by `q1` and then by `q2`, compose `q2 ⊗ q1`.
|
|
7
|
+
*
|
|
8
|
+
* Sign convention: `(x, y, z, w)` — `w` last, matching {@link Quaternion} and
|
|
9
|
+
* the rest of the `core/geom/3d/quaternion/` family.
|
|
10
|
+
*
|
|
11
|
+
* `out` may alias neither `a` nor `b` component-wise (the result is computed
|
|
12
|
+
* from all eight inputs before any write, so passing the same backing array
|
|
13
|
+
* via different offsets is safe only if the ranges don't overlap).
|
|
14
|
+
*
|
|
15
|
+
* @param {number[]|Float32Array|Float64Array} out
|
|
16
|
+
* @param {number} out_offset offset into `out`; receives 4 floats (x, y, z, w)
|
|
17
|
+
* @param {number} ax @param {number} ay @param {number} az @param {number} aw
|
|
18
|
+
* @param {number} bx @param {number} by @param {number} bz @param {number} bw
|
|
19
|
+
*/
|
|
20
|
+
export function quat3_multiply(out: number[] | Float32Array | Float64Array, out_offset: number, ax: number, ay: number, az: number, aw: number, bx: number, by: number, bz: number, bw: number): void;
|
|
21
|
+
//# sourceMappingURL=quat3_multiply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quat3_multiply.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/quaternion/quat3_multiply.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,oCALW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,cAClC,MAAM,MACN,MAAM,MAAa,MAAM,MAAa,MAAM,MAAa,MAAM,MAC/D,MAAM,MAAa,MAAM,MAAa,MAAM,MAAa,MAAM,QAOzE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hamilton product of two unit quaternions: `out = a ⊗ b`.
|
|
3
|
+
*
|
|
4
|
+
* Composition order is the usual rotation convention: the product `a ⊗ b`
|
|
5
|
+
* applies `b` first, then `a` (i.e. `(a⊗b)·v·(a⊗b)* == a·(b·v·b*)·a*`). So to
|
|
6
|
+
* rotate a vector by `q1` and then by `q2`, compose `q2 ⊗ q1`.
|
|
7
|
+
*
|
|
8
|
+
* Sign convention: `(x, y, z, w)` — `w` last, matching {@link Quaternion} and
|
|
9
|
+
* the rest of the `core/geom/3d/quaternion/` family.
|
|
10
|
+
*
|
|
11
|
+
* `out` may alias neither `a` nor `b` component-wise (the result is computed
|
|
12
|
+
* from all eight inputs before any write, so passing the same backing array
|
|
13
|
+
* via different offsets is safe only if the ranges don't overlap).
|
|
14
|
+
*
|
|
15
|
+
* @param {number[]|Float32Array|Float64Array} out
|
|
16
|
+
* @param {number} out_offset offset into `out`; receives 4 floats (x, y, z, w)
|
|
17
|
+
* @param {number} ax @param {number} ay @param {number} az @param {number} aw
|
|
18
|
+
* @param {number} bx @param {number} by @param {number} bz @param {number} bw
|
|
19
|
+
*/
|
|
20
|
+
export function quat3_multiply(out, out_offset, ax, ay, az, aw, bx, by, bz, bw) {
|
|
21
|
+
out[out_offset] = aw * bx + ax * bw + ay * bz - az * by;
|
|
22
|
+
out[out_offset + 1] = aw * by - ax * bz + ay * bw + az * bx;
|
|
23
|
+
out[out_offset + 2] = aw * bz + ax * by - ay * bx + az * bw;
|
|
24
|
+
out[out_offset + 3] = aw * bw - ax * bx - ay * by - az * bz;
|
|
25
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert a unit quaternion to a 3×3 matrix laid out as
|
|
3
|
+
* "rows-are-world-coords-of-the-local-axes".
|
|
4
|
+
*
|
|
5
|
+
* Writes 9 floats starting at `out[out_offset]`:
|
|
6
|
+
*
|
|
7
|
+
* row 0 (offsets 0..2) — image of body-local +X in world space
|
|
8
|
+
* row 1 (offsets 3..5) — image of body-local +Y in world space
|
|
9
|
+
* row 2 (offsets 6..8) — image of body-local +Z in world space
|
|
10
|
+
*
|
|
11
|
+
* This is the **transpose** of the standard linear-algebra rotation
|
|
12
|
+
* matrix `R(q)` (which is "columns-are-world-coords-of-local-axes" or
|
|
13
|
+
* equivalently rows-are-local-coords-of-world-axes). The layout here
|
|
14
|
+
* matches the existing `quat_to_axes` helpers in
|
|
15
|
+
* `box_box_manifold.js` / `box_triangle_contact.js` — for SAT
|
|
16
|
+
* projection a row dot product against a candidate axis directly
|
|
17
|
+
* yields "extent of the box's local axis i along that direction":
|
|
18
|
+
*
|
|
19
|
+
* project_onto(v) = out[off+0..2] · v // ← local-X extent
|
|
20
|
+
*
|
|
21
|
+
* Computing M(q) once and reusing across many vectors is cheaper
|
|
22
|
+
* than calling {@link v3_quat3_apply} per vector when the same
|
|
23
|
+
* orientation rotates ≥ 4 vectors (box-vs-box SAT projects 8
|
|
24
|
+
* corners; box-vs-triangle clips an incident face). For one-shot
|
|
25
|
+
* rotation use {@link v3_quat3_apply} directly.
|
|
26
|
+
*
|
|
27
|
+
* To rotate a world-space vector `v` into the local frame via the
|
|
28
|
+
* matrix form, the standard `R · v` (rotate local → world) requires
|
|
29
|
+
* a **column-major** read of this storage:
|
|
30
|
+
*
|
|
31
|
+
* (R · v)[i] = out[off + 0 + i] * v[0]
|
|
32
|
+
* + out[off + 3 + i] * v[1]
|
|
33
|
+
* + out[off + 6 + i] * v[2]
|
|
34
|
+
*
|
|
35
|
+
* — equivalent to {@link v3_quat3_apply}(v, q).
|
|
36
|
+
*
|
|
37
|
+
* Sign convention: `(qx, qy, qz, qw)` — `w` last, matching
|
|
38
|
+
* {@link Quaternion} and the rest of the `core/geom/3d/quaternion/`
|
|
39
|
+
* family.
|
|
40
|
+
*
|
|
41
|
+
* Formula (yields R^T of the standard linear-algebra rotation matrix):
|
|
42
|
+
* out[0]=1-2(yy+zz) out[1]=2(xy+wz) out[2]=2(xz-wy)
|
|
43
|
+
* out[3]=2(xy-wz) out[4]=1-2(xx+zz) out[5]=2(yz+wx)
|
|
44
|
+
* out[6]=2(xz+wy) out[7]=2(yz-wx) out[8]=1-2(xx+yy)
|
|
45
|
+
*
|
|
46
|
+
* @param {number[]|Float32Array|Float64Array} out
|
|
47
|
+
* @param {number} out_offset offset into `out`; receives 9 floats
|
|
48
|
+
* @param {number} qx unit quaternion x
|
|
49
|
+
* @param {number} qy
|
|
50
|
+
* @param {number} qz
|
|
51
|
+
* @param {number} qw unit quaternion w (last)
|
|
52
|
+
*/
|
|
53
|
+
export function quat3_to_matrix3(out: number[] | Float32Array | Float64Array, out_offset: number, qx: number, qy: number, qz: number, qw: number): void;
|
|
54
|
+
//# sourceMappingURL=quat3_to_matrix3.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quat3_to_matrix3.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/quaternion/quat3_to_matrix3.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,sCAPW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,cAClC,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAkBhB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert a unit quaternion to a 3×3 matrix laid out as
|
|
3
|
+
* "rows-are-world-coords-of-the-local-axes".
|
|
4
|
+
*
|
|
5
|
+
* Writes 9 floats starting at `out[out_offset]`:
|
|
6
|
+
*
|
|
7
|
+
* row 0 (offsets 0..2) — image of body-local +X in world space
|
|
8
|
+
* row 1 (offsets 3..5) — image of body-local +Y in world space
|
|
9
|
+
* row 2 (offsets 6..8) — image of body-local +Z in world space
|
|
10
|
+
*
|
|
11
|
+
* This is the **transpose** of the standard linear-algebra rotation
|
|
12
|
+
* matrix `R(q)` (which is "columns-are-world-coords-of-local-axes" or
|
|
13
|
+
* equivalently rows-are-local-coords-of-world-axes). The layout here
|
|
14
|
+
* matches the existing `quat_to_axes` helpers in
|
|
15
|
+
* `box_box_manifold.js` / `box_triangle_contact.js` — for SAT
|
|
16
|
+
* projection a row dot product against a candidate axis directly
|
|
17
|
+
* yields "extent of the box's local axis i along that direction":
|
|
18
|
+
*
|
|
19
|
+
* project_onto(v) = out[off+0..2] · v // ← local-X extent
|
|
20
|
+
*
|
|
21
|
+
* Computing M(q) once and reusing across many vectors is cheaper
|
|
22
|
+
* than calling {@link v3_quat3_apply} per vector when the same
|
|
23
|
+
* orientation rotates ≥ 4 vectors (box-vs-box SAT projects 8
|
|
24
|
+
* corners; box-vs-triangle clips an incident face). For one-shot
|
|
25
|
+
* rotation use {@link v3_quat3_apply} directly.
|
|
26
|
+
*
|
|
27
|
+
* To rotate a world-space vector `v` into the local frame via the
|
|
28
|
+
* matrix form, the standard `R · v` (rotate local → world) requires
|
|
29
|
+
* a **column-major** read of this storage:
|
|
30
|
+
*
|
|
31
|
+
* (R · v)[i] = out[off + 0 + i] * v[0]
|
|
32
|
+
* + out[off + 3 + i] * v[1]
|
|
33
|
+
* + out[off + 6 + i] * v[2]
|
|
34
|
+
*
|
|
35
|
+
* — equivalent to {@link v3_quat3_apply}(v, q).
|
|
36
|
+
*
|
|
37
|
+
* Sign convention: `(qx, qy, qz, qw)` — `w` last, matching
|
|
38
|
+
* {@link Quaternion} and the rest of the `core/geom/3d/quaternion/`
|
|
39
|
+
* family.
|
|
40
|
+
*
|
|
41
|
+
* Formula (yields R^T of the standard linear-algebra rotation matrix):
|
|
42
|
+
* out[0]=1-2(yy+zz) out[1]=2(xy+wz) out[2]=2(xz-wy)
|
|
43
|
+
* out[3]=2(xy-wz) out[4]=1-2(xx+zz) out[5]=2(yz+wx)
|
|
44
|
+
* out[6]=2(xz+wy) out[7]=2(yz-wx) out[8]=1-2(xx+yy)
|
|
45
|
+
*
|
|
46
|
+
* @param {number[]|Float32Array|Float64Array} out
|
|
47
|
+
* @param {number} out_offset offset into `out`; receives 9 floats
|
|
48
|
+
* @param {number} qx unit quaternion x
|
|
49
|
+
* @param {number} qy
|
|
50
|
+
* @param {number} qz
|
|
51
|
+
* @param {number} qw unit quaternion w (last)
|
|
52
|
+
*/
|
|
53
|
+
export function quat3_to_matrix3(out, out_offset, qx, qy, qz, qw) {
|
|
54
|
+
const xx = qx * qx, yy = qy * qy, zz = qz * qz;
|
|
55
|
+
const xy = qx * qy, xz = qx * qz, yz = qy * qz;
|
|
56
|
+
const wx = qw * qx, wy = qw * qy, wz = qw * qz;
|
|
57
|
+
|
|
58
|
+
out[out_offset] = 1 - 2 * (yy + zz);
|
|
59
|
+
out[out_offset + 1] = 2 * (xy + wz);
|
|
60
|
+
out[out_offset + 2] = 2 * (xz - wy);
|
|
61
|
+
|
|
62
|
+
out[out_offset + 3] = 2 * (xy - wz);
|
|
63
|
+
out[out_offset + 4] = 1 - 2 * (xx + zz);
|
|
64
|
+
out[out_offset + 5] = 2 * (yz + wx);
|
|
65
|
+
|
|
66
|
+
out[out_offset + 6] = 2 * (xz + wy);
|
|
67
|
+
out[out_offset + 7] = 2 * (yz - wx);
|
|
68
|
+
out[out_offset + 8] = 1 - 2 * (xx + yy);
|
|
69
|
+
}
|
|
@@ -51,14 +51,14 @@ export class AbstractShape3D {
|
|
|
51
51
|
/**
|
|
52
52
|
* Support function, given a direction vector, return point on the shape that's furthest in that direction
|
|
53
53
|
* Assumes direction is a unit vector
|
|
54
|
-
* @param {number[]|Float32Array} result
|
|
54
|
+
* @param {number[]|Float32Array|Float64Array} result
|
|
55
55
|
* @param {number} result_offset
|
|
56
56
|
* @param {number} direction_x
|
|
57
57
|
* @param {number} direction_y
|
|
58
58
|
* @param {number} direction_z
|
|
59
59
|
* @returns {void}
|
|
60
60
|
*/
|
|
61
|
-
support(result: number[] | Float32Array, result_offset: number, direction_x: number, direction_y: number, direction_z: number): void;
|
|
61
|
+
support(result: number[] | Float32Array | Float64Array, result_offset: number, direction_x: number, direction_y: number, direction_z: number): void;
|
|
62
62
|
/**
|
|
63
63
|
* @template {AbstractShape3D} T
|
|
64
64
|
* @param {T} other
|
|
@@ -70,5 +70,27 @@ export class AbstractShape3D {
|
|
|
70
70
|
* @returns {number}
|
|
71
71
|
*/
|
|
72
72
|
hash(): number;
|
|
73
|
+
/**
|
|
74
|
+
* Whether this shape is convex.
|
|
75
|
+
*
|
|
76
|
+
* Convex shapes can be fed directly into GJK/EPA via their {@link support}
|
|
77
|
+
* function — the Minkowski difference of two convex sets is itself convex,
|
|
78
|
+
* which is the precondition GJK relies on. Non-convex shapes (heightmaps,
|
|
79
|
+
* arbitrary meshes, unions of convex shapes) violate that precondition: the
|
|
80
|
+
* support operator is still definable as `argmax (p · d)`, but feeding it to
|
|
81
|
+
* GJK will produce false negatives where the algorithm walks into a
|
|
82
|
+
* concavity and reports "no overlap" between intersecting bodies.
|
|
83
|
+
*
|
|
84
|
+
* The narrowphase reads this flag to gate Minkowski-based pair dispatch.
|
|
85
|
+
* When `false`, a dedicated path is required (grid traversal for heightmaps,
|
|
86
|
+
* per-triangle GJK for meshes, per-child decomposition for unions).
|
|
87
|
+
*
|
|
88
|
+
* Default is `true` — convex is the common case across primitives. Each
|
|
89
|
+
* non-convex subclass overrides this on its own prototype.
|
|
90
|
+
*
|
|
91
|
+
* @readonly
|
|
92
|
+
* @type {boolean}
|
|
93
|
+
*/
|
|
94
|
+
readonly is_convex: boolean;
|
|
73
95
|
}
|
|
74
96
|
//# sourceMappingURL=AbstractShape3D.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractShape3D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/shape/AbstractShape3D.js"],"names":[],"mappings":"AAAA;IACI;;;;OAIG;IACH,gCAHW,MAAM,EAAE,GACN,MAAM,CAIlB;IAED;;;;;OAKG;IACH,0CAJW,MAAM,EAAE,SACR,MAAM,EAAE,GACN,MAAM,CAIlB;IAED;;;;;OAKG;IACH,iCAJW,MAAM,EAAE,aACR,MAAM,EAAE,GACN,IAAI,CAIhB;IAED;;;;;;OAMG;IACH,sCALW,MAAM,EAAE,iBACR,MAAM,qBAEJ,IAAI,CAIhB;IAED;;;;OAIG;IACH,sBAHW,MAAM,EAAE,GACN,OAAO,CAInB;IAED;;;OAGG;IACH,qBAEC;IAED;;OAEG;IACH,2BAEC;IAED;;;;OAIG;IACH,6BAHW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,YAAY,GAAC,YAAY,GAClD,IAAI,CAIhB;IAED;;;;;;;;;OASG;IACH,gBAPW,MAAM,EAAE,GAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"AbstractShape3D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/shape/AbstractShape3D.js"],"names":[],"mappings":"AAAA;IACI;;;;OAIG;IACH,gCAHW,MAAM,EAAE,GACN,MAAM,CAIlB;IAED;;;;;OAKG;IACH,0CAJW,MAAM,EAAE,SACR,MAAM,EAAE,GACN,MAAM,CAIlB;IAED;;;;;OAKG;IACH,iCAJW,MAAM,EAAE,aACR,MAAM,EAAE,GACN,IAAI,CAIhB;IAED;;;;;;OAMG;IACH,sCALW,MAAM,EAAE,iBACR,MAAM,qBAEJ,IAAI,CAIhB;IAED;;;;OAIG;IACH,sBAHW,MAAM,EAAE,GACN,OAAO,CAInB;IAED;;;OAGG;IACH,qBAEC;IAED;;OAEG;IACH,2BAEC;IAED;;;;OAIG;IACH,6BAHW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,YAAY,GAAC,YAAY,GAClD,IAAI,CAIhB;IAED;;;;;;;;;OASG;IACH,gBAPW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,iBAClC,MAAM,eACN,MAAM,eACN,MAAM,eACN,MAAM,GACJ,IAAI,CAIhB;IAED;;;;OAIG;IACH,6CAFa,OAAO,CAInB;IAED;;;OAGG;IACH,QAFa,MAAM,CAIlB;IAGL;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,oBAFU,OAAO,CAEkB;CAvBlC"}
|
|
@@ -75,7 +75,7 @@ export class AbstractShape3D {
|
|
|
75
75
|
/**
|
|
76
76
|
* Support function, given a direction vector, return point on the shape that's furthest in that direction
|
|
77
77
|
* Assumes direction is a unit vector
|
|
78
|
-
* @param {number[]|Float32Array} result
|
|
78
|
+
* @param {number[]|Float32Array|Float64Array} result
|
|
79
79
|
* @param {number} result_offset
|
|
80
80
|
* @param {number} direction_x
|
|
81
81
|
* @param {number} direction_y
|
|
@@ -103,3 +103,26 @@ export class AbstractShape3D {
|
|
|
103
103
|
return 0;
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Whether this shape is convex.
|
|
109
|
+
*
|
|
110
|
+
* Convex shapes can be fed directly into GJK/EPA via their {@link support}
|
|
111
|
+
* function — the Minkowski difference of two convex sets is itself convex,
|
|
112
|
+
* which is the precondition GJK relies on. Non-convex shapes (heightmaps,
|
|
113
|
+
* arbitrary meshes, unions of convex shapes) violate that precondition: the
|
|
114
|
+
* support operator is still definable as `argmax (p · d)`, but feeding it to
|
|
115
|
+
* GJK will produce false negatives where the algorithm walks into a
|
|
116
|
+
* concavity and reports "no overlap" between intersecting bodies.
|
|
117
|
+
*
|
|
118
|
+
* The narrowphase reads this flag to gate Minkowski-based pair dispatch.
|
|
119
|
+
* When `false`, a dedicated path is required (grid traversal for heightmaps,
|
|
120
|
+
* per-triangle GJK for meshes, per-child decomposition for unions).
|
|
121
|
+
*
|
|
122
|
+
* Default is `true` — convex is the common case across primitives. Each
|
|
123
|
+
* non-convex subclass overrides this on its own prototype.
|
|
124
|
+
*
|
|
125
|
+
* @readonly
|
|
126
|
+
* @type {boolean}
|
|
127
|
+
*/
|
|
128
|
+
AbstractShape3D.prototype.is_convex = true;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Heightmap shape, intended primarily for terrain.
|
|
3
|
+
*
|
|
4
|
+
* The shape is a closed solid bounded below by the plane perpendicular to
|
|
5
|
+
* {@link orientation} (the "floor") and above by a height-field surface
|
|
6
|
+
* defined by a {@link Sampler2D}. Heights are sampled with Catmull-Rom
|
|
7
|
+
* filtering ({@link Sampler2D#sampleChannelCatmullRomUV}), matching what
|
|
8
|
+
* the terrain system uses for geometry construction.
|
|
9
|
+
*
|
|
10
|
+
* Local frame layout:
|
|
11
|
+
* - The orientation vector defines the local "up" axis (unit).
|
|
12
|
+
* - An orthonormal basis (u, v, n=orientation) is built from it.
|
|
13
|
+
* - Footprint extends along the basis-u axis over [-size.x/2, +size.x/2]
|
|
14
|
+
* and along the basis-v axis over [-size.z/2, +size.z/2].
|
|
15
|
+
* - The surface height (along orientation) at heightmap-UV (u01, v01) is
|
|
16
|
+
* `sampler.sampleChannelCatmullRomUV(u01, v01, 0)`.
|
|
17
|
+
* - The solid volume occupies `h ∈ [0, sampledHeight(u01, v01)]` along the
|
|
18
|
+
* orientation axis, with `0` being the floor at body-local origin.
|
|
19
|
+
* - `size.y` is the maximum height value of the heightfield (used for the
|
|
20
|
+
* bounding box). Sampler values are NOT clamped to it.
|
|
21
|
+
*
|
|
22
|
+
* NON-CONVEX. {@link support} throws — GJK/EPA cannot be run against a
|
|
23
|
+
* heightmap directly. The physics narrowphase must dispatch a dedicated
|
|
24
|
+
* grid-traversal path when one of the colliders is a heightmap.
|
|
25
|
+
*
|
|
26
|
+
* @author Alex Goldring
|
|
27
|
+
* @copyright Company Named Limited (c) 2026
|
|
28
|
+
*/
|
|
29
|
+
export class HeightMapShape3D extends AbstractShape3D {
|
|
30
|
+
/**
|
|
31
|
+
* Convenience constructor.
|
|
32
|
+
* @param {Sampler2D} sampler
|
|
33
|
+
* @param {number} size_x footprint extent along basis-u
|
|
34
|
+
* @param {number} size_y maximum heightmap height (along orientation)
|
|
35
|
+
* @param {number} size_z footprint extent along basis-v
|
|
36
|
+
* @param {Vector3} [orientation] defaults to +Y
|
|
37
|
+
* @returns {HeightMapShape3D}
|
|
38
|
+
*/
|
|
39
|
+
static from(sampler: Sampler2D, size_x: number, size_y: number, size_z: number, orientation?: Vector3): HeightMapShape3D;
|
|
40
|
+
/**
|
|
41
|
+
* Unit vector defining the local "up" axis (the direction the
|
|
42
|
+
* heightmap's surface faces). Default is +Y.
|
|
43
|
+
* @readonly
|
|
44
|
+
* @type {Vector3}
|
|
45
|
+
*/
|
|
46
|
+
readonly orientation: Vector3;
|
|
47
|
+
/**
|
|
48
|
+
* Bounding-box extents in the heightmap-local (u, height, v) frame.
|
|
49
|
+
* size.x — footprint extent along basis-u (perpendicular to orientation)
|
|
50
|
+
* size.y — maximum heightmap height (extent along orientation)
|
|
51
|
+
* size.z — footprint extent along basis-v (perpendicular to orientation)
|
|
52
|
+
* @readonly
|
|
53
|
+
* @type {Vector3}
|
|
54
|
+
*/
|
|
55
|
+
readonly size: Vector3;
|
|
56
|
+
/**
|
|
57
|
+
* Sampler holding height values. Float32 backing recommended so the
|
|
58
|
+
* Terrain system's height texture plugs in directly. Single-channel
|
|
59
|
+
* sampler is the common case; only channel 0 is read.
|
|
60
|
+
* @type {Sampler2D | null}
|
|
61
|
+
*/
|
|
62
|
+
sampler: Sampler2D | null;
|
|
63
|
+
/**
|
|
64
|
+
* Cached orthonormal basis [u_x,u_y,u_z, v_x,v_y,v_z, n_x,n_y,n_z]
|
|
65
|
+
* built from {@link orientation}. Updated lazily by {@link _ensure_basis}.
|
|
66
|
+
* @private
|
|
67
|
+
* @type {Float64Array}
|
|
68
|
+
*/
|
|
69
|
+
private _basis;
|
|
70
|
+
_basis_orientation_x: number;
|
|
71
|
+
_basis_orientation_y: number;
|
|
72
|
+
_basis_orientation_z: number;
|
|
73
|
+
/**
|
|
74
|
+
* Recompute the orthonormal basis (u, v, n) if {@link orientation} changed.
|
|
75
|
+
*
|
|
76
|
+
* Construction chosen so that the default orientation +Y produces the
|
|
77
|
+
* intuitive mapping `u = +X, v = +Z, n = +Y` — i.e. size.x runs along
|
|
78
|
+
* body X, size.z along body Z. We project body +X onto the plane
|
|
79
|
+
* perpendicular to n (the orientation), with a fall-back to projecting
|
|
80
|
+
* body +Z when n is too close to colinear with +X.
|
|
81
|
+
* @private
|
|
82
|
+
*/
|
|
83
|
+
private _ensure_basis;
|
|
84
|
+
/**
|
|
85
|
+
* Sample the surface height at heightmap UV coordinates.
|
|
86
|
+
* Uses Catmull-Rom filtering to match the terrain system's geometry construction.
|
|
87
|
+
* @param {number} u01 horizontal UV, in [0, 1]
|
|
88
|
+
* @param {number} v01 vertical UV, in [0, 1]
|
|
89
|
+
* @returns {number} height along orientation axis
|
|
90
|
+
*/
|
|
91
|
+
sample_height_at_uv(u01: number, v01: number): number;
|
|
92
|
+
/**
|
|
93
|
+
* Project a body-local position to the surface and sample the height there.
|
|
94
|
+
* The returned height is in the orientation-axis direction.
|
|
95
|
+
* Positions outside the footprint sample the clamped UV (sampler clamps).
|
|
96
|
+
* @param {number} px body-local x
|
|
97
|
+
* @param {number} py body-local y
|
|
98
|
+
* @param {number} pz body-local z
|
|
99
|
+
* @returns {number}
|
|
100
|
+
*/
|
|
101
|
+
sample_height_at_position(px: number, py: number, pz: number): number;
|
|
102
|
+
compute_bounding_box(result: any): void;
|
|
103
|
+
contains_point(point: any): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Approximate signed distance: difference between the point's height
|
|
106
|
+
* (along orientation) and the surface height sampled at the point's
|
|
107
|
+
* footprint UV. POSITIVE = above surface, NEGATIVE = below.
|
|
108
|
+
*
|
|
109
|
+
* Locally correct when the surface is flat; biased when the surface
|
|
110
|
+
* has significant slope. Sufficient for cling/raycast queries that
|
|
111
|
+
* walk down to the surface.
|
|
112
|
+
*/
|
|
113
|
+
signed_distance_at_point(point: any): number;
|
|
114
|
+
/**
|
|
115
|
+
* Project a reference point onto the surface along the orientation axis.
|
|
116
|
+
* The footprint UV is clamped, so points outside the footprint produce
|
|
117
|
+
* the nearest edge-of-footprint surface sample (approximate).
|
|
118
|
+
*/
|
|
119
|
+
nearest_point_on_surface(result: any, reference: any): void;
|
|
120
|
+
/**
|
|
121
|
+
* Heightmaps are non-convex; GJK/EPA cannot work against them directly.
|
|
122
|
+
* The physics narrowphase must dispatch a grid-traversal path that
|
|
123
|
+
* decomposes the heightmap into per-cell triangle pairs and tests each
|
|
124
|
+
* against the other shape (analogous to Bullet's btHeightfieldTerrainShape
|
|
125
|
+
* × btConcaveShape interface).
|
|
126
|
+
*
|
|
127
|
+
* This throws rather than returning a degenerate result so the call
|
|
128
|
+
* site is forced to handle heightmaps explicitly.
|
|
129
|
+
*/
|
|
130
|
+
support(result: any, result_offset: any, direction_x: any, direction_y: any, direction_z: any): void;
|
|
131
|
+
sample_random_point_in_volume(result: any, result_offset: any, random: any): void;
|
|
132
|
+
/**
|
|
133
|
+
* @param {HeightMapShape3D} other
|
|
134
|
+
* @returns {boolean}
|
|
135
|
+
*/
|
|
136
|
+
equals(other: HeightMapShape3D): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Fast type-check marker, matching the pattern on every other concrete
|
|
139
|
+
* AbstractShape3D subclass. The physics narrowphase reads this to dispatch
|
|
140
|
+
* the heightmap-vs-X grid-traversal path.
|
|
141
|
+
* @readonly
|
|
142
|
+
* @type {boolean}
|
|
143
|
+
*/
|
|
144
|
+
readonly isHeightMapShape3D: boolean;
|
|
145
|
+
}
|
|
146
|
+
import { AbstractShape3D } from "./AbstractShape3D.js";
|
|
147
|
+
import { Vector3 } from "../../Vector3.js";
|
|
148
|
+
//# sourceMappingURL=HeightMapShape3D.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeightMapShape3D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/shape/HeightMapShape3D.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH;IA4CI;;;;;;;;OAQG;IACH,wCANW,MAAM,UACN,MAAM,UACN,MAAM,gBACN,OAAO,GACL,gBAAgB,CAmB5B;IAlEG;;;;;OAKG;IACH,sBAFU,OAAO,CAEsB;IAEvC;;;;;;;OAOG;IACH,eAFU,OAAO,CAEe;IAEhC;;;;;OAKG;IACH,SAFU,YAAY,IAAI,CAEP;IAEnB;;;;;OAKG;IACH,eAAiC;IAGjC,6BAA+B;IAC/B,6BAA+B;IAC/B,6BAA+B;IA+BnC;;;;;;;;;OASG;IACH,sBA+CC;IAED;;;;;;OAMG;IACH,yBAJW,MAAM,OACN,MAAM,GACJ,MAAM,CAIlB;IAED;;;;;;;;OAQG;IACH,8BALW,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CAelB;IAED,wCA8BC;IAED,oCA2BC;IAED;;;;;;;;OAQG;IACH,6CAmBC;IAED;;;;OAIG;IACH,4DA2BC;IAED;;;;;;;;;OASG;IACH,qGAEC;IAED,kFAiBC;IA6CD;;;OAGG;IACH,cAHW,gBAAgB,GACd,OAAO,CAgBnB;IAcL;;;;;;OAMG;IACH,6BAFU,OAAO,CAE4B;CAT5C;gCA3a+B,sBAAsB;wBAD9B,kBAAkB"}
|