@woosh/meep-engine 2.131.48 → 2.132.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/core/bvh2/bvh3/ebvh_optimize_treelet.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_optimize_treelet.js +4 -3
- package/src/core/codegen/LineBuilder.js +3 -3
- package/src/core/collection/heap/Uint32Heap.d.ts +14 -0
- package/src/core/collection/heap/Uint32Heap.d.ts.map +1 -1
- package/src/core/collection/heap/Uint32Heap.js +18 -0
- package/src/core/collection/map/HashMap.d.ts.map +1 -1
- package/src/core/collection/map/HashMap.js +4 -22
- package/src/core/collection/map/generate_next_linear_congruential_index.d.ts +15 -0
- package/src/core/collection/map/generate_next_linear_congruential_index.d.ts.map +1 -0
- package/src/core/collection/map/generate_next_linear_congruential_index.js +18 -0
- package/src/core/geom/3d/aabb/AABB3.js +1 -1
- package/src/core/geom/3d/line/line3_compute_nearest_point_to_point.d.ts.map +1 -1
- package/src/core/geom/3d/line/line3_compute_nearest_point_to_point.js +10 -26
- package/src/core/geom/3d/line/line3_compute_segment_nearest_point_to_point_t.d.ts +19 -0
- package/src/core/geom/3d/line/line3_compute_segment_nearest_point_to_point_t.d.ts.map +1 -0
- package/src/core/geom/3d/line/line3_compute_segment_nearest_point_to_point_t.js +48 -0
- package/src/core/geom/3d/line/line3_compute_segment_point_distance.d.ts +15 -0
- package/src/core/geom/3d/line/line3_compute_segment_point_distance.d.ts.map +1 -0
- package/src/core/geom/3d/line/line3_compute_segment_point_distance.js +24 -0
- package/src/core/geom/3d/line/line3_compute_segment_point_distance_eikonal.d.ts +17 -0
- package/src/core/geom/3d/line/line3_compute_segment_point_distance_eikonal.d.ts.map +1 -0
- package/src/core/geom/3d/line/line3_compute_segment_point_distance_eikonal.js +95 -0
- package/src/core/geom/3d/line/line3_compute_segment_point_distance_sqr.d.ts +16 -0
- package/src/core/geom/3d/line/line3_compute_segment_point_distance_sqr.d.ts.map +1 -0
- package/src/core/geom/3d/line/{line3_computeSegmentPointDistance_sqr.js → line3_compute_segment_point_distance_sqr.js} +16 -3
- package/src/core/geom/3d/topology/struct/TopoMesh.d.ts +4 -0
- package/src/core/geom/3d/topology/struct/TopoMesh.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/TopoMesh.js +4 -0
- package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.d.ts +18 -1
- package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.js +56 -0
- package/src/core/geom/3d/topology/struct/binary/BinaryTopology.d.ts +46 -16
- package/src/core/geom/3d/topology/struct/binary/BinaryTopology.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/BinaryTopology.js +85 -15
- package/src/core/geom/3d/topology/struct/binary/io/bt_disk_edge_add.d.ts +9 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_disk_edge_add.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_disk_edge_add.js +43 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_disk_edge_remove.d.ts +4 -3
- package/src/core/geom/3d/topology/struct/binary/io/bt_disk_edge_remove.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_disk_edge_remove.js +38 -4
- package/src/core/geom/3d/topology/struct/binary/io/bt_loop_kill.d.ts +8 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_loop_kill.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_loop_kill.js +36 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_cleanup_faceless_references.d.ts +10 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_cleanup_faceless_references.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_cleanup_faceless_references.js +62 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_face_decouple.d.ts +13 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_face_decouple.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_face_decouple.js +145 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_face_decouple_islands.d.ts +12 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_face_decouple_islands.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_face_decouple_islands.js +111 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_face_island_erode.d.ts +15 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_face_island_erode.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_face_island_erode.js +290 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_from_indexed_geometry.d.ts +11 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_from_indexed_geometry.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/{bt_index_geometry_to_topology.js → bt_mesh_from_indexed_geometry.js} +6 -7
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_from_unindexed_geometry.d.ts +8 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_from_unindexed_geometry.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_from_unindexed_geometry.js +31 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_triangulate.d.ts +7 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_triangulate.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_triangulate.js +22 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_radial_loop_add.d.ts +8 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_radial_loop_add.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_radial_loop_add.js +32 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_radial_loop_remove.d.ts +8 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_radial_loop_remove.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_radial_loop_remove.js +26 -0
- package/src/core/geom/3d/topology/struct/binary/io/edge/OrderedEdge.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/{OrderedEdge.js → edge/OrderedEdge.js} +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_create.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/{bt_edge_create.js → edge/bt_edge_create.js} +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_get_or_create.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/{bt_edge_get_or_create.js → edge/bt_edge_get_or_create.js} +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_kill.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/{bt_edge_kill.js → edge/bt_edge_kill.js} +6 -3
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_split.d.ts +13 -0
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_split.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_split.js +180 -0
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_kill_only_edge.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_calc_edges.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/{bt_mesh_calc_edges.js → edge/bt_mesh_calc_edges.js} +10 -7
- package/src/core/geom/3d/topology/struct/binary/io/edge/get_or_create_edge_map.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/face/bt_face_kill.d.ts +8 -0
- package/src/core/geom/3d/topology/struct/binary/io/face/bt_face_kill.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/face/bt_face_kill.js +26 -0
- package/src/core/geom/3d/topology/struct/binary/io/face/bt_face_poke.d.ts +15 -0
- package/src/core/geom/3d/topology/struct/binary/io/face/bt_face_poke.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/face/bt_face_poke.js +152 -0
- package/src/core/geom/3d/topology/struct/binary/io/face/bt_face_triangulate.d.ts +13 -0
- package/src/core/geom/3d/topology/struct/binary/io/face/bt_face_triangulate.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/face/bt_face_triangulate.js +124 -0
- package/src/core/geom/3d/topology/struct/binary/io/face/bt_kill_only_face.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/vertex/bt_kill_only_vert.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/vertex/bt_merge_verts_by_distance.d.ts +10 -0
- package/src/core/geom/3d/topology/struct/binary/io/vertex/bt_merge_verts_by_distance.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/vertex/bt_merge_verts_by_distance.js +165 -0
- package/src/core/geom/3d/topology/struct/binary/io/vertex/bt_vert_kill.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/{bt_vert_kill.js → vertex/bt_vert_kill.js} +5 -2
- package/src/core/geom/3d/topology/struct/binary/io/vertex/bt_vertex_replace.d.ts +13 -0
- package/src/core/geom/3d/topology/struct/binary/io/vertex/bt_vertex_replace.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/vertex/bt_vertex_replace.js +125 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_edge_has_vertex.d.ts +9 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_edge_has_vertex.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/{bt_mesh_edge_has_vertex.js → bt_edge_has_vertex.js} +1 -1
- package/src/core/geom/3d/topology/struct/binary/query/{bt_mesh_edge_other_vertex.d.ts → bt_edge_other_vertex.d.ts} +2 -2
- package/src/core/geom/3d/topology/struct/binary/query/bt_edge_other_vertex.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/{bt_mesh_edge_other_vertex.js → bt_edge_other_vertex.js} +1 -1
- package/src/core/geom/3d/topology/struct/binary/query/bt_face_get_attached_faces.d.ts +12 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_face_get_attached_faces.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_face_get_attached_faces.js +96 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_face_get_centroid.d.ts +10 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_face_get_centroid.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_face_get_centroid.js +75 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_face_get_incenter.d.ts +10 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_face_get_incenter.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_face_get_incenter.js +85 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_face_get_neighbour_faces.d.ts +12 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_face_get_neighbour_faces.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_face_get_neighbour_faces.js +74 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_face_is_degenerate.d.ts +9 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_face_is_degenerate.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_face_is_degenerate.js +78 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_build_boundary_distance_field.d.ts +15 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_build_boundary_distance_field.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_build_boundary_distance_field.js +151 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_compute_edge_distance_eikonal.d.ts +13 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_compute_edge_distance_eikonal.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_compute_edge_distance_eikonal.js +46 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_compute_face_islands.d.ts +9 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_compute_face_islands.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_compute_face_islands.js +78 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_vertex_distance_to_edge.d.ts +10 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_vertex_distance_to_edge.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_vertex_distance_to_edge.js +48 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_vertex_distance_to_vertex.d.ts +9 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_vertex_distance_to_vertex.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_vertex_distance_to_vertex.js +31 -0
- package/src/core/geom/3d/topology/struct/prototypeBinaryTopology.js +2 -2
- package/src/core/geom/3d/triangle/triangle3_incenter.d.ts +19 -0
- package/src/core/geom/3d/triangle/triangle3_incenter.d.ts.map +1 -0
- package/src/core/geom/3d/triangle/triangle3_incenter.js +60 -0
- package/src/core/math/hash/lowbias32.d.ts +9 -0
- package/src/core/math/hash/lowbias32.d.ts.map +1 -0
- package/src/core/math/hash/lowbias32.js +20 -0
- package/src/core/process/task/util/iteratorTask.d.ts +2 -2
- package/src/core/process/task/util/iteratorTask.d.ts.map +1 -1
- package/src/core/process/task/util/iteratorTask.js +3 -3
- package/src/engine/graphics/particles/particular/engine/utils/distrubuteParticlesOnMesh.d.ts.map +1 -1
- package/src/engine/graphics/particles/particular/engine/utils/distrubuteParticlesOnMesh.js +4 -4
- package/src/engine/graphics/render/forward_plus/query/detailed_sphere_frustum_intersection_test.js +4 -4
- package/src/engine/navigation/ecs/components/Path.js +3 -3
- package/src/engine/navigation/grid/find_path_on_grid_astar.d.ts +4 -4
- package/src/engine/navigation/grid/find_path_on_grid_astar.d.ts.map +1 -1
- package/src/engine/navigation/grid/find_path_on_grid_astar.js +5 -4
- package/src/engine/navigation/mesh/NavigationMesh.d.ts +32 -0
- package/src/engine/navigation/mesh/NavigationMesh.d.ts.map +1 -0
- package/src/engine/navigation/mesh/NavigationMesh.js +190 -0
- package/src/engine/navigation/mesh/NavigationMeshAgent.d.ts +9 -0
- package/src/engine/navigation/mesh/NavigationMeshAgent.d.ts.map +1 -0
- package/src/engine/navigation/mesh/NavigationMeshAgent.js +11 -0
- package/src/engine/navigation/mesh/README.md +3 -0
- package/src/engine/navigation/mesh/bt_mesh_face_find_path.d.ts +14 -0
- package/src/engine/navigation/mesh/bt_mesh_face_find_path.d.ts.map +1 -0
- package/src/engine/navigation/mesh/bt_mesh_face_find_path.js +203 -0
- package/src/engine/navigation/mesh/build/bvh_build_from_unindexed_triangles.d.ts +8 -0
- package/src/engine/navigation/mesh/build/bvh_build_from_unindexed_triangles.d.ts.map +1 -0
- package/src/engine/navigation/mesh/build/bvh_build_from_unindexed_triangles.js +46 -0
- package/src/engine/navigation/mesh/build/enforce_agent_height_clearance.d.ts +12 -0
- package/src/engine/navigation/mesh/build/enforce_agent_height_clearance.d.ts.map +1 -0
- package/src/engine/navigation/mesh/build/enforce_agent_height_clearance.js +204 -0
- package/src/engine/navigation/mesh/build/navmesh_build_topology.d.ts +14 -0
- package/src/engine/navigation/mesh/build/navmesh_build_topology.d.ts.map +1 -0
- package/src/engine/navigation/mesh/build/navmesh_build_topology.js +183 -0
- package/src/engine/navigation/mesh/bvh_build_from_bt_mesh.d.ts +7 -0
- package/src/engine/navigation/mesh/bvh_build_from_bt_mesh.d.ts.map +1 -0
- package/src/engine/navigation/mesh/bvh_build_from_bt_mesh.js +64 -0
- package/src/engine/navigation/mesh/funnel_string_pull.d.ts +15 -0
- package/src/engine/navigation/mesh/funnel_string_pull.d.ts.map +1 -0
- package/src/engine/navigation/mesh/funnel_string_pull.js +225 -0
- package/src/core/geom/3d/line/line3_computeSegmentPointDistance_sqr.d.ts +0 -14
- package/src/core/geom/3d/line/line3_computeSegmentPointDistance_sqr.d.ts.map +0 -1
- package/src/core/geom/3d/topology/struct/binary/io/OrderedEdge.d.ts.map +0 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_edge_create.d.ts.map +0 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_edge_get_or_create.d.ts.map +0 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_edge_kill.d.ts.map +0 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_face_kill.d.ts +0 -7
- package/src/core/geom/3d/topology/struct/binary/io/bt_face_kill.d.ts.map +0 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_face_kill.js +0 -8
- package/src/core/geom/3d/topology/struct/binary/io/bt_index_geometry_to_topology.d.ts +0 -11
- package/src/core/geom/3d/topology/struct/binary/io/bt_index_geometry_to_topology.d.ts.map +0 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_kill_only_edge.d.ts.map +0 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_kill_only_face.d.ts.map +0 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_kill_only_vert.d.ts.map +0 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_merge_verts_by_distance.d.ts +0 -18
- package/src/core/geom/3d/topology/struct/binary/io/bt_merge_verts_by_distance.d.ts.map +0 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_merge_verts_by_distance.js +0 -83
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_calc_edges.d.ts.map +0 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_vert_kill.d.ts.map +0 -1
- package/src/core/geom/3d/topology/struct/binary/io/get_or_create_edge_map.d.ts.map +0 -1
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_edge_has_vertex.d.ts +0 -9
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_edge_has_vertex.d.ts.map +0 -1
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_edge_other_vertex.d.ts.map +0 -1
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_get_neighbour_faces.d.ts +0 -10
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_get_neighbour_faces.d.ts.map +0 -1
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_get_neighbour_faces.js +0 -44
- package/src/engine/navigation/__module.d.ts +0 -2
- package/src/engine/navigation/__module.d.ts.map +0 -1
- package/src/engine/navigation/__module.js +0 -1
- /package/src/core/geom/3d/topology/struct/binary/io/{OrderedEdge.d.ts → edge/OrderedEdge.d.ts} +0 -0
- /package/src/core/geom/3d/topology/struct/binary/io/{bt_edge_create.d.ts → edge/bt_edge_create.d.ts} +0 -0
- /package/src/core/geom/3d/topology/struct/binary/io/{bt_edge_get_or_create.d.ts → edge/bt_edge_get_or_create.d.ts} +0 -0
- /package/src/core/geom/3d/topology/struct/binary/io/{bt_edge_kill.d.ts → edge/bt_edge_kill.d.ts} +0 -0
- /package/src/core/geom/3d/topology/struct/binary/io/{bt_kill_only_edge.d.ts → edge/bt_kill_only_edge.d.ts} +0 -0
- /package/src/core/geom/3d/topology/struct/binary/io/{bt_kill_only_edge.js → edge/bt_kill_only_edge.js} +0 -0
- /package/src/core/geom/3d/topology/struct/binary/io/{bt_mesh_calc_edges.d.ts → edge/bt_mesh_calc_edges.d.ts} +0 -0
- /package/src/core/geom/3d/topology/struct/binary/io/{get_or_create_edge_map.d.ts → edge/get_or_create_edge_map.d.ts} +0 -0
- /package/src/core/geom/3d/topology/struct/binary/io/{get_or_create_edge_map.js → edge/get_or_create_edge_map.js} +0 -0
- /package/src/core/geom/3d/topology/struct/binary/io/{bt_kill_only_face.d.ts → face/bt_kill_only_face.d.ts} +0 -0
- /package/src/core/geom/3d/topology/struct/binary/io/{bt_kill_only_face.js → face/bt_kill_only_face.js} +0 -0
- /package/src/core/geom/3d/topology/struct/binary/io/{bt_kill_only_vert.d.ts → vertex/bt_kill_only_vert.d.ts} +0 -0
- /package/src/core/geom/3d/topology/struct/binary/io/{bt_kill_only_vert.js → vertex/bt_kill_only_vert.js} +0 -0
- /package/src/core/geom/3d/topology/struct/binary/io/{bt_vert_kill.d.ts → vertex/bt_vert_kill.d.ts} +0 -0
|
@@ -3,8 +3,8 @@ import { BinaryDataType } from "../../../../core/binary/type/BinaryDataType.js";
|
|
|
3
3
|
import { RowFirstTable } from "../../../../core/collection/table/RowFirstTable.js";
|
|
4
4
|
import { RowFirstTableSpec } from "../../../../core/collection/table/RowFirstTableSpec.js";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
} from "../../../../core/geom/3d/line/
|
|
6
|
+
line3_compute_segment_point_distance_sqr
|
|
7
|
+
} from "../../../../core/geom/3d/line/line3_compute_segment_point_distance_sqr.js";
|
|
8
8
|
import { v3_distance } from "../../../../core/geom/vec3/v3_distance.js";
|
|
9
9
|
import { clamp } from "../../../../core/math/clamp.js";
|
|
10
10
|
import { lerp } from "../../../../core/math/lerp.js";
|
|
@@ -318,7 +318,7 @@ class Path {
|
|
|
318
318
|
this.readPositionToArray(i, p1, 0);
|
|
319
319
|
|
|
320
320
|
//
|
|
321
|
-
const distance_sqr =
|
|
321
|
+
const distance_sqr = line3_compute_segment_point_distance_sqr(
|
|
322
322
|
p0[0], p0[1], p0[2],
|
|
323
323
|
p1[0], p1[1], p1[2],
|
|
324
324
|
reference.x, reference.y, reference.z
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
3
|
* @param {number[]|Uint8Array|Uint16Array|Float32Array} field
|
|
4
|
-
* @param {number} width
|
|
5
|
-
* @param {number} height
|
|
6
|
-
* @param {number} start
|
|
7
|
-
* @param {number} goal
|
|
4
|
+
* @param {number} width X resolution of the search grid
|
|
5
|
+
* @param {number} height Y resolution of the search grid
|
|
6
|
+
* @param {number} start index of the starting position
|
|
7
|
+
* @param {number} goal index of the destination position
|
|
8
8
|
* @param {number} block_value value in the field that signifies impassible obstacle
|
|
9
9
|
* @returns {Array.<number>} array of indices representing path from start to end
|
|
10
10
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find_path_on_grid_astar.d.ts","sourceRoot":"","sources":["../../../../../src/engine/navigation/grid/find_path_on_grid_astar.js"],"names":[],"mappings":"AAoMA;;;;;;;;;GASG;AACH,+CARW,MAAM,EAAE,GAAC,UAAU,GAAC,WAAW,GAAC,YAAY,SAC5C,MAAM,UACN,MAAM,SACN,MAAM,QACN,MAAM,eACN,MAAM,GACJ,MAAO,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"find_path_on_grid_astar.d.ts","sourceRoot":"","sources":["../../../../../src/engine/navigation/grid/find_path_on_grid_astar.js"],"names":[],"mappings":"AAoMA;;;;;;;;;GASG;AACH,+CARW,MAAM,EAAE,GAAC,UAAU,GAAC,WAAW,GAAC,YAAY,SAC5C,MAAM,UACN,MAAM,SACN,MAAM,QACN,MAAM,eACN,MAAM,GACJ,MAAO,MAAM,CAAC,CA4F1B"}
|
|
@@ -197,10 +197,10 @@ let g_score = new Float32Array(1024);
|
|
|
197
197
|
/**
|
|
198
198
|
*
|
|
199
199
|
* @param {number[]|Uint8Array|Uint16Array|Float32Array} field
|
|
200
|
-
* @param {number} width
|
|
201
|
-
* @param {number} height
|
|
202
|
-
* @param {number} start
|
|
203
|
-
* @param {number} goal
|
|
200
|
+
* @param {number} width X resolution of the search grid
|
|
201
|
+
* @param {number} height Y resolution of the search grid
|
|
202
|
+
* @param {number} start index of the starting position
|
|
203
|
+
* @param {number} goal index of the destination position
|
|
204
204
|
* @param {number} block_value value in the field that signifies impassible obstacle
|
|
205
205
|
* @returns {Array.<number>} array of indices representing path from start to end
|
|
206
206
|
*/
|
|
@@ -226,6 +226,7 @@ export function find_path_on_grid_astar(
|
|
|
226
226
|
const cell_count = width * height;
|
|
227
227
|
|
|
228
228
|
if (g_score.length < cell_count) {
|
|
229
|
+
// resize scratch
|
|
229
230
|
g_score = new Float32Array(cell_count);
|
|
230
231
|
}
|
|
231
232
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export class NavigationMesh {
|
|
2
|
+
topology: BinaryTopology;
|
|
3
|
+
/**
|
|
4
|
+
* Used for raycasts and neighborhood search.
|
|
5
|
+
* @type {BVH}
|
|
6
|
+
*/
|
|
7
|
+
bvh: BVH;
|
|
8
|
+
/**
|
|
9
|
+
* Build from given scene geometry
|
|
10
|
+
* @param {BinaryTopology} source
|
|
11
|
+
* @param {number} [agent_radius]
|
|
12
|
+
* @param {number} [agent_height]
|
|
13
|
+
* @param {number} [agent_max_climb] In radians, how steep of an angle can the agent go up by
|
|
14
|
+
* @param {Vector3} [up] Defines world's "UP" direction, this is what the agent will respect for climbing constraint
|
|
15
|
+
*/
|
|
16
|
+
build({ source, agent_radius, agent_height, agent_max_climb, up, }: BinaryTopology): void;
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @param {Float32Array} output
|
|
20
|
+
* @param {number} start_x
|
|
21
|
+
* @param {number} start_y
|
|
22
|
+
* @param {number} start_z
|
|
23
|
+
* @param {number} goal_x
|
|
24
|
+
* @param {number} goal_y
|
|
25
|
+
* @param {number} goal_z
|
|
26
|
+
* @returns {number}
|
|
27
|
+
*/
|
|
28
|
+
find_path(output: Float32Array, start_x: number, start_y: number, start_z: number, goal_x: number, goal_y: number, goal_z: number): number;
|
|
29
|
+
}
|
|
30
|
+
import { BinaryTopology } from "../../../core/geom/3d/topology/struct/binary/BinaryTopology.js";
|
|
31
|
+
import { BVH } from "../../../core/bvh2/bvh3/BVH.js";
|
|
32
|
+
//# sourceMappingURL=NavigationMesh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationMesh.d.ts","sourceRoot":"","sources":["../../../../../src/engine/navigation/mesh/NavigationMesh.js"],"names":[],"mappings":"AAmCA;IAEI,yBAAgC;IAEhC;;;OAGG;IACH,KAFU,GAAG,CAEG;IAEhB;;;;;;;OAOG;IACH,oEANW,cAAc,QAwBxB;IAGD;;;;;;;;;;OAUG;IACH,kBATW,YAAY,WACZ,MAAM,WACN,MAAM,WACN,MAAM,UACN,MAAM,UACN,MAAM,UACN,MAAM,GACJ,MAAM,CAwGlB;CAEJ;+BA3L4C,gEAAgE;oBAFzF,gCAAgC"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { BVH } from "../../../core/bvh2/bvh3/BVH.js";
|
|
2
|
+
import { array_copy } from "../../../core/collection/array/array_copy.js";
|
|
3
|
+
import { BinaryTopology, NULL_POINTER } from "../../../core/geom/3d/topology/struct/binary/BinaryTopology.js";
|
|
4
|
+
import Vector3 from "../../../core/geom/Vector3.js";
|
|
5
|
+
import { bt_mesh_face_find_path } from "./bt_mesh_face_find_path.js";
|
|
6
|
+
import { navmesh_build_topology } from "./build/navmesh_build_topology.js";
|
|
7
|
+
import { bvh_build_from_bt_mesh } from "./bvh_build_from_bt_mesh.js";
|
|
8
|
+
import { funnel_string_pull } from "./funnel_string_pull.js";
|
|
9
|
+
|
|
10
|
+
const scratch_array_u32 = new Uint32Array(1024);
|
|
11
|
+
|
|
12
|
+
const scratch_portal_vertices = new Uint32Array(1024 * 2);
|
|
13
|
+
|
|
14
|
+
const scratch_portal_normals = new Float32Array(1024 * 3);
|
|
15
|
+
|
|
16
|
+
const scratch_vertices = new Float32Array(1024 * 3 * 3);
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param {number} x
|
|
21
|
+
* @param {number} y
|
|
22
|
+
* @param {number} z
|
|
23
|
+
* @param {BinaryTopology} topology
|
|
24
|
+
* @param {BVH} bvh
|
|
25
|
+
* @returns {number} face id, or {@link NULL_POINTER} if not found
|
|
26
|
+
*/
|
|
27
|
+
function query_nearest_face(
|
|
28
|
+
x, y, z,
|
|
29
|
+
topology,
|
|
30
|
+
bvh,
|
|
31
|
+
) {
|
|
32
|
+
|
|
33
|
+
throw new Error('Not implemented');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export class NavigationMesh {
|
|
37
|
+
|
|
38
|
+
topology = new BinaryTopology();
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Used for raycasts and neighborhood search.
|
|
42
|
+
* @type {BVH}
|
|
43
|
+
*/
|
|
44
|
+
bvh = new BVH();
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Build from given scene geometry
|
|
48
|
+
* @param {BinaryTopology} source
|
|
49
|
+
* @param {number} [agent_radius]
|
|
50
|
+
* @param {number} [agent_height]
|
|
51
|
+
* @param {number} [agent_max_climb] In radians, how steep of an angle can the agent go up by
|
|
52
|
+
* @param {Vector3} [up] Defines world's "UP" direction, this is what the agent will respect for climbing constraint
|
|
53
|
+
*/
|
|
54
|
+
build({
|
|
55
|
+
source,
|
|
56
|
+
agent_radius = 0,
|
|
57
|
+
agent_height = 0,
|
|
58
|
+
agent_max_climb = Math.PI / 4,
|
|
59
|
+
up = Vector3.up,
|
|
60
|
+
}) {
|
|
61
|
+
|
|
62
|
+
navmesh_build_topology({
|
|
63
|
+
destination: this.topology,
|
|
64
|
+
source,
|
|
65
|
+
agent_radius,
|
|
66
|
+
agent_height,
|
|
67
|
+
agent_max_climb,
|
|
68
|
+
up,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
bvh_build_from_bt_mesh(this.bvh, this.topology);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
*
|
|
77
|
+
* @param {Float32Array} output
|
|
78
|
+
* @param {number} start_x
|
|
79
|
+
* @param {number} start_y
|
|
80
|
+
* @param {number} start_z
|
|
81
|
+
* @param {number} goal_x
|
|
82
|
+
* @param {number} goal_y
|
|
83
|
+
* @param {number} goal_z
|
|
84
|
+
* @returns {number}
|
|
85
|
+
*/
|
|
86
|
+
find_path(
|
|
87
|
+
output,
|
|
88
|
+
start_x, start_y, start_z,
|
|
89
|
+
goal_x, goal_y, goal_z
|
|
90
|
+
) {
|
|
91
|
+
|
|
92
|
+
const mesh = this.topology;
|
|
93
|
+
|
|
94
|
+
const start_face_id = query_nearest_face(start_x, start_y, start_z, mesh, this.bvh);
|
|
95
|
+
|
|
96
|
+
if (start_face_id === NULL_POINTER) {
|
|
97
|
+
// probably topology is empty
|
|
98
|
+
return 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const goal_face_id = query_nearest_face(goal_x, goal_y, goal_z, mesh, this.bvh);
|
|
102
|
+
|
|
103
|
+
if (goal_face_id === NULL_POINTER) {
|
|
104
|
+
// should never happen
|
|
105
|
+
return 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (goal_face_id === start_face_id) {
|
|
109
|
+
// path within the same triangle
|
|
110
|
+
|
|
111
|
+
output[0] = start_x;
|
|
112
|
+
output[1] = start_y;
|
|
113
|
+
output[2] = start_z;
|
|
114
|
+
|
|
115
|
+
output[3] = goal_x;
|
|
116
|
+
output[4] = goal_y;
|
|
117
|
+
output[5] = goal_z;
|
|
118
|
+
|
|
119
|
+
return 2;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const face_path_length = bt_mesh_face_find_path(scratch_array_u32, start_face_id, goal_face_id, mesh);
|
|
123
|
+
|
|
124
|
+
// build portals
|
|
125
|
+
// ==================
|
|
126
|
+
|
|
127
|
+
// initialize vertex data pool
|
|
128
|
+
scratch_vertices[0] = start_x;
|
|
129
|
+
scratch_vertices[1] = start_y;
|
|
130
|
+
scratch_vertices[2] = start_z;
|
|
131
|
+
|
|
132
|
+
scratch_vertices[3] = goal_x;
|
|
133
|
+
scratch_vertices[4] = goal_y;
|
|
134
|
+
scratch_vertices[5] = goal_z;
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
// add start portal
|
|
138
|
+
scratch_portal_vertices[0] = 0;
|
|
139
|
+
scratch_portal_vertices[1] = 0;
|
|
140
|
+
|
|
141
|
+
mesh.face_read_normal(scratch_portal_normals, 0, start_face_id);
|
|
142
|
+
|
|
143
|
+
let portal_index = 1;
|
|
144
|
+
|
|
145
|
+
for (let i = 0; i < face_path_length; i++) {
|
|
146
|
+
|
|
147
|
+
const face_id = scratch_array_u32[i];
|
|
148
|
+
|
|
149
|
+
// TODO IMPLEMENTATION OF PORTAL SEQUENCE GOES HERE
|
|
150
|
+
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// add goal portal
|
|
154
|
+
scratch_portal_vertices[portal_index] = 1;
|
|
155
|
+
scratch_portal_vertices[portal_index + 1] = 0;
|
|
156
|
+
|
|
157
|
+
// copy last portal normal
|
|
158
|
+
array_copy(
|
|
159
|
+
scratch_portal_normals, (portal_index - 1) * 2,
|
|
160
|
+
scratch_portal_normals, portal_index * 2,
|
|
161
|
+
3
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
portal_index++;
|
|
165
|
+
|
|
166
|
+
// execute string pulling
|
|
167
|
+
const path_vertex_count = funnel_string_pull(
|
|
168
|
+
scratch_array_u32,
|
|
169
|
+
0,
|
|
170
|
+
scratch_portal_vertices,
|
|
171
|
+
scratch_portal_normals,
|
|
172
|
+
portal_index,
|
|
173
|
+
scratch_vertices,
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
// build the final path
|
|
177
|
+
for (let i = 0; i < path_vertex_count; i++) {
|
|
178
|
+
const vertex_index = scratch_array_u32[i];
|
|
179
|
+
|
|
180
|
+
output[i * 3] = scratch_vertices[vertex_index * 3];
|
|
181
|
+
output[i * 3 + 1] = scratch_vertices[vertex_index * 3 + 1];
|
|
182
|
+
output[i * 3 + 2] = scratch_vertices[vertex_index * 3 + 2];
|
|
183
|
+
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return path_vertex_count;
|
|
187
|
+
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationMeshAgent.d.ts","sourceRoot":"","sources":["../../../../../src/engine/navigation/mesh/NavigationMeshAgent.js"],"names":[],"mappings":"AAAA;IAEI;;;;OAIG;IACH,QAFU,MAAM,CAEL;CAGd"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find a path through topology faces.
|
|
3
|
+
* If a path is found - the result will contain start and goal faces.
|
|
4
|
+
*
|
|
5
|
+
* NOTE: if either start or goal faces are not part of the topology - an empty path will be produced.
|
|
6
|
+
*
|
|
7
|
+
* @param {number[]|Uint32Array} output path will be written here as a sequence of face IDs
|
|
8
|
+
* @param {number} start_face_id
|
|
9
|
+
* @param {number} goal_face_id
|
|
10
|
+
* @param {BinaryTopology} topology
|
|
11
|
+
* @returns {number} number of faces that make up the path. This will be 0 if no path is found.
|
|
12
|
+
*/
|
|
13
|
+
export function bt_mesh_face_find_path(output: number[] | Uint32Array, start_face_id: number, goal_face_id: number, topology: BinaryTopology): number;
|
|
14
|
+
//# sourceMappingURL=bt_mesh_face_find_path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bt_mesh_face_find_path.d.ts","sourceRoot":"","sources":["../../../../../src/engine/navigation/mesh/bt_mesh_face_find_path.js"],"names":[],"mappings":"AAsHA;;;;;;;;;;;GAWG;AACH,+CANW,MAAM,EAAE,GAAC,WAAW,iBACpB,MAAM,gBACN,MAAM,6BAEJ,MAAM,CA0ElB"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { assert } from "../../../core/assert.js";
|
|
2
|
+
import { Uint32Heap } from "../../../core/collection/heap/Uint32Heap.js";
|
|
3
|
+
import { bt_face_get_centroid } from "../../../core/geom/3d/topology/struct/binary/query/bt_face_get_centroid.js";
|
|
4
|
+
import {
|
|
5
|
+
bt_face_get_neighbour_faces
|
|
6
|
+
} from "../../../core/geom/3d/topology/struct/binary/query/bt_face_get_neighbour_faces.js";
|
|
7
|
+
|
|
8
|
+
const open = new Uint32Heap();
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @type {Set<number>}
|
|
13
|
+
*/
|
|
14
|
+
const closed = new Set();
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @type {Map<number, number>}
|
|
19
|
+
*/
|
|
20
|
+
const g_score = new Map();
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Note that we limit the supported number of neighbors, a reasonable meshes will fit this criteria
|
|
24
|
+
* @type {Uint32Array}
|
|
25
|
+
*/
|
|
26
|
+
const neighbors = new Uint32Array(256);
|
|
27
|
+
|
|
28
|
+
const scratch_array_f32 = new Float32Array(6);
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @param {number} a
|
|
33
|
+
* @param {number} b
|
|
34
|
+
* @param {BinaryTopology} topology
|
|
35
|
+
* @returns {number}
|
|
36
|
+
*/
|
|
37
|
+
function heuristic(a, b, topology) {
|
|
38
|
+
// compare centroid distances
|
|
39
|
+
bt_face_get_centroid(scratch_array_f32, 0, topology, a);
|
|
40
|
+
bt_face_get_centroid(scratch_array_f32, 3, topology, b);
|
|
41
|
+
|
|
42
|
+
// delta
|
|
43
|
+
const dx = scratch_array_f32[0] - scratch_array_f32[3];
|
|
44
|
+
const dy = scratch_array_f32[1] - scratch_array_f32[4];
|
|
45
|
+
const dz = scratch_array_f32[2] - scratch_array_f32[5];
|
|
46
|
+
|
|
47
|
+
// distance
|
|
48
|
+
return dx * dx + dy * dy + dz * dz;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @param {number[]|Uint32Array} output
|
|
54
|
+
* @param {number} goal
|
|
55
|
+
* @param {Map<number, number>} g_score
|
|
56
|
+
* @param {BinaryTopology} topology
|
|
57
|
+
* @returns {number}
|
|
58
|
+
*/
|
|
59
|
+
function construct_path(output, goal, g_score, topology) {
|
|
60
|
+
|
|
61
|
+
let current = goal;
|
|
62
|
+
let path_length = 0;
|
|
63
|
+
|
|
64
|
+
// 1. Walk back via lowest g-score path until we get to 0 (start)
|
|
65
|
+
while (true) {
|
|
66
|
+
output[path_length++] = current;
|
|
67
|
+
|
|
68
|
+
const current_g = g_score.get(current);
|
|
69
|
+
|
|
70
|
+
// If we reached the start node (g_score === 0), we're done traversing
|
|
71
|
+
if (current_g === 0) {
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const neighbor_count = bt_face_get_neighbour_faces(neighbors, 0, topology, current);
|
|
76
|
+
|
|
77
|
+
let best_neighbor = -1;
|
|
78
|
+
let lowest_g = Infinity;
|
|
79
|
+
|
|
80
|
+
// Find the neighbor with the lowest g_score
|
|
81
|
+
for (let i = 0; i < neighbor_count; i++) {
|
|
82
|
+
const neighbor = neighbors[i];
|
|
83
|
+
|
|
84
|
+
if (g_score.has(neighbor)) {
|
|
85
|
+
const g = g_score.get(neighbor);
|
|
86
|
+
|
|
87
|
+
if (g < lowest_g) {
|
|
88
|
+
lowest_g = g;
|
|
89
|
+
best_neighbor = neighbor;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Safeguard: Break if no valid neighbor is found or if we aren't strictly descending.
|
|
96
|
+
// (Since your traversal_cost is currently 1.0, lowest_g should be current_g - 1.0)
|
|
97
|
+
if (best_neighbor === -1 || lowest_g >= current_g) {
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
current = best_neighbor;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// 2. Reverse the path in-place to get START -> GOAL order
|
|
105
|
+
const half_length = Math.floor(path_length / 2);
|
|
106
|
+
|
|
107
|
+
for (let i = 0; i < half_length; i++) {
|
|
108
|
+
const mirror_i = path_length - 1 - i;
|
|
109
|
+
const temp = output[i];
|
|
110
|
+
|
|
111
|
+
output[i] = output[mirror_i];
|
|
112
|
+
output[mirror_i] = temp;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return path_length;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Find a path through topology faces.
|
|
121
|
+
* If a path is found - the result will contain start and goal faces.
|
|
122
|
+
*
|
|
123
|
+
* NOTE: if either start or goal faces are not part of the topology - an empty path will be produced.
|
|
124
|
+
*
|
|
125
|
+
* @param {number[]|Uint32Array} output path will be written here as a sequence of face IDs
|
|
126
|
+
* @param {number} start_face_id
|
|
127
|
+
* @param {number} goal_face_id
|
|
128
|
+
* @param {BinaryTopology} topology
|
|
129
|
+
* @returns {number} number of faces that make up the path. This will be 0 if no path is found.
|
|
130
|
+
*/
|
|
131
|
+
export function bt_mesh_face_find_path(
|
|
132
|
+
output,
|
|
133
|
+
start_face_id,
|
|
134
|
+
goal_face_id,
|
|
135
|
+
topology,
|
|
136
|
+
) {
|
|
137
|
+
assert.isArrayLike(output, 'output');
|
|
138
|
+
assert.isNonNegativeInteger(start_face_id, 'start_face_id');
|
|
139
|
+
assert.isNonNegativeInteger(goal_face_id, 'goal_face_id');
|
|
140
|
+
assert.notNull(topology, 'topology');
|
|
141
|
+
assert.defined(topology, 'topology');
|
|
142
|
+
assert.equal(topology.isBinaryTopology, true, 'topology.isBinaryTopology !== true');
|
|
143
|
+
|
|
144
|
+
// TODO we can switch traversal to edges instead, that way we can get much better distance heuristics
|
|
145
|
+
// we don't know where exactly we're going to cross through the triangle, but we know we're going to cross the edge at least, which narrows the domain
|
|
146
|
+
|
|
147
|
+
open.clear();
|
|
148
|
+
closed.clear();
|
|
149
|
+
g_score.clear();
|
|
150
|
+
|
|
151
|
+
g_score.set(start_face_id, 0);
|
|
152
|
+
|
|
153
|
+
open.insert(start_face_id, heuristic(start_face_id, goal_face_id, topology));
|
|
154
|
+
|
|
155
|
+
while (!open.is_empty()) {
|
|
156
|
+
|
|
157
|
+
const current_node = open.pop_min();
|
|
158
|
+
|
|
159
|
+
if (current_node === goal_face_id) {
|
|
160
|
+
// Reached the goal
|
|
161
|
+
return construct_path(output, goal_face_id, g_score, topology);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
closed.add(current_node);
|
|
165
|
+
|
|
166
|
+
const neighbor_count = bt_face_get_neighbour_faces(neighbors, 0, topology, current_node);
|
|
167
|
+
|
|
168
|
+
for (let i = 0; i < neighbor_count; i++) {
|
|
169
|
+
|
|
170
|
+
const neighbor = neighbors[i];
|
|
171
|
+
|
|
172
|
+
if (closed.has(neighbor)) {
|
|
173
|
+
// already closed
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// TODO compute correct traversal cost based on triangle size
|
|
178
|
+
const traversal_cost = 1.0;
|
|
179
|
+
|
|
180
|
+
const current_g_score = g_score.get(current_node);
|
|
181
|
+
|
|
182
|
+
const cost_so_far = current_g_score + traversal_cost;
|
|
183
|
+
|
|
184
|
+
if (!g_score.has(neighbor) || cost_so_far < g_score.get(neighbor)) {
|
|
185
|
+
// better path
|
|
186
|
+
|
|
187
|
+
g_score.set(neighbor, cost_so_far);
|
|
188
|
+
|
|
189
|
+
const remaining_heuristic = heuristic(neighbor, goal_face_id, topology);
|
|
190
|
+
|
|
191
|
+
const refined_heuristic = cost_so_far + remaining_heuristic;
|
|
192
|
+
|
|
193
|
+
open.insert_or_update(neighbor, refined_heuristic);
|
|
194
|
+
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// No result found
|
|
202
|
+
return 0;
|
|
203
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {BVH} bvh
|
|
4
|
+
* @param {number[]|Float32Array} triangles
|
|
5
|
+
* @param {number} triangle_count
|
|
6
|
+
*/
|
|
7
|
+
export function bvh_build_from_unindexed_triangles(bvh: BVH, triangles: number[] | Float32Array, triangle_count: number): void;
|
|
8
|
+
//# sourceMappingURL=bvh_build_from_unindexed_triangles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bvh_build_from_unindexed_triangles.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/navigation/mesh/build/bvh_build_from_unindexed_triangles.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wEAHW,MAAM,EAAE,GAAC,YAAY,kBACrB,MAAM,QAyChB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {BVH} bvh
|
|
4
|
+
* @param {number[]|Float32Array} triangles
|
|
5
|
+
* @param {number} triangle_count
|
|
6
|
+
*/
|
|
7
|
+
export function bvh_build_from_unindexed_triangles(
|
|
8
|
+
bvh,
|
|
9
|
+
triangles,
|
|
10
|
+
triangle_count,
|
|
11
|
+
) {
|
|
12
|
+
|
|
13
|
+
for (let i = 0; i < triangle_count; i++) {
|
|
14
|
+
const triangle_address = i * 9;
|
|
15
|
+
|
|
16
|
+
const ax = triangles[triangle_address];
|
|
17
|
+
const ay = triangles[triangle_address + 1];
|
|
18
|
+
const az = triangles[triangle_address + 2];
|
|
19
|
+
|
|
20
|
+
const bx = triangles[triangle_address + 3];
|
|
21
|
+
const by = triangles[triangle_address + 4];
|
|
22
|
+
const bz = triangles[triangle_address + 5];
|
|
23
|
+
|
|
24
|
+
const cx = triangles[triangle_address + 6];
|
|
25
|
+
const cy = triangles[triangle_address + 7];
|
|
26
|
+
const cz = triangles[triangle_address + 8];
|
|
27
|
+
|
|
28
|
+
const bounds_x0 = Math.min(ax, bx, cx);
|
|
29
|
+
const bounds_x1 = Math.max(ax, bx, cx);
|
|
30
|
+
const bounds_z0 = Math.min(az, bz, cz);
|
|
31
|
+
|
|
32
|
+
const bounds_y0 = Math.min(ay, by, cy);
|
|
33
|
+
const bounds_y1 = Math.max(ay, by, cy);
|
|
34
|
+
const bounds_z1 = Math.max(az, bz, cz);
|
|
35
|
+
|
|
36
|
+
const node = bvh.allocate_node();
|
|
37
|
+
|
|
38
|
+
bvh.node_set_user_data(node, i);
|
|
39
|
+
bvh.node_set_aabb_primitive(node,
|
|
40
|
+
bounds_x0, bounds_y0, bounds_z0,
|
|
41
|
+
bounds_x1, bounds_y1, bounds_z1
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
bvh.insert_leaf(node);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {BVH} bvh
|
|
4
|
+
* @param {number} agent_height
|
|
5
|
+
* @param {number} agent_radius
|
|
6
|
+
* @param {number} triangle_count
|
|
7
|
+
* @param {number[]} triangles
|
|
8
|
+
* @param {function():number} random
|
|
9
|
+
* @returns {number} new triangle count
|
|
10
|
+
*/
|
|
11
|
+
export function enforce_agent_height_clearance({ bvh, agent_height, agent_radius, triangle_count, triangles, random }: BVH): number;
|
|
12
|
+
//# sourceMappingURL=enforce_agent_height_clearance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enforce_agent_height_clearance.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/navigation/mesh/build/enforce_agent_height_clearance.js"],"names":[],"mappings":"AA4CA;;;;;;;;;GASG;AACH,6HAFa,MAAM,CAuJlB"}
|