@woosh/meep-engine 2.131.47 → 2.132.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/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/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/plane/plane3_matrix4_project.d.ts.map +1 -1
- package/src/core/geom/3d/plane/plane3_matrix4_project.js +0 -1
- 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/geom/3d/triangle/triangle_compute_plane_side.d.ts +24 -0
- package/src/core/geom/3d/triangle/triangle_compute_plane_side.d.ts.map +1 -0
- package/src/core/geom/3d/triangle/{computeTrianglePlaneSide.js → triangle_compute_plane_side.js} +9 -5
- package/src/core/geom/3d/triangle/triangle_intersects_clipping_volume.js +2 -2
- 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/core/geom/3d/triangle/computeTrianglePlaneSide.d.ts +0 -20
- package/src/core/geom/3d/triangle/computeTrianglePlaneSide.d.ts.map +0 -1
- 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
|
@@ -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"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { assert } from "../../../../core/assert.js";
|
|
2
|
+
import { Ray3 } from "../../../../core/geom/3d/ray/Ray3.js";
|
|
3
|
+
import { compute_triangle_area_3d } from "../../../../core/geom/3d/triangle/compute_triangle_area_3d.js";
|
|
4
|
+
import { v3_compute_triangle_normal } from "../../../../core/geom/3d/triangle/v3_compute_triangle_normal.js";
|
|
5
|
+
import { clamp } from "../../../../core/math/clamp.js";
|
|
6
|
+
import { roundFair } from "../../../../core/math/random/roundFair.js";
|
|
7
|
+
|
|
8
|
+
function generate_hole_shapes_barycentric(
|
|
9
|
+
holes_positions,
|
|
10
|
+
hole_size,
|
|
11
|
+
ax, ay, az,
|
|
12
|
+
bx, by, bz,
|
|
13
|
+
cx, cy, cz,
|
|
14
|
+
) {
|
|
15
|
+
throw new Error('Not implemented');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param {number[]} output where to write new triangles
|
|
21
|
+
* @param {number} output_offset
|
|
22
|
+
* @param {number[][]} hole_shapes
|
|
23
|
+
* @param {number} ax
|
|
24
|
+
* @param {number} ay
|
|
25
|
+
* @param {number} az
|
|
26
|
+
* @param {number} bx
|
|
27
|
+
* @param {number} by
|
|
28
|
+
* @param {number} bz
|
|
29
|
+
* @param {number} cx
|
|
30
|
+
* @param {number} cy
|
|
31
|
+
* @param {number} cz
|
|
32
|
+
* @returns {number} new triangles added to the output
|
|
33
|
+
*/
|
|
34
|
+
function triangle_punch_holes(
|
|
35
|
+
output,
|
|
36
|
+
output_offset,
|
|
37
|
+
hole_shapes,
|
|
38
|
+
ax, ay, az,
|
|
39
|
+
bx, by, bz,
|
|
40
|
+
cx, cy, cz,
|
|
41
|
+
) {
|
|
42
|
+
throw new Error('Not implemented');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @param {BVH} bvh
|
|
48
|
+
* @param {number} agent_height
|
|
49
|
+
* @param {number} agent_radius
|
|
50
|
+
* @param {number} triangle_count
|
|
51
|
+
* @param {number[]} triangles
|
|
52
|
+
* @param {function():number} random
|
|
53
|
+
* @returns {number} new triangle count
|
|
54
|
+
*/
|
|
55
|
+
export function enforce_agent_height_clearance({
|
|
56
|
+
bvh,
|
|
57
|
+
agent_height,
|
|
58
|
+
agent_radius,
|
|
59
|
+
triangle_count,
|
|
60
|
+
triangles,
|
|
61
|
+
random
|
|
62
|
+
}) {
|
|
63
|
+
console.warn('enforce_agent_height_clearance() is not implemented');
|
|
64
|
+
|
|
65
|
+
return triangle_count;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Spatial resolution for performing clearance checks
|
|
69
|
+
* @type {number}
|
|
70
|
+
*/
|
|
71
|
+
const sampling_resolution = Math.min(
|
|
72
|
+
agent_height / 4,
|
|
73
|
+
Math.max(agent_radius / 2, 0.001)
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
assert.notNaN(sampling_resolution, 'sampling_resolution');
|
|
77
|
+
assert.isFinite(sampling_resolution, 'sampling_resolution');
|
|
78
|
+
|
|
79
|
+
const sample_area = sampling_resolution * sampling_resolution;
|
|
80
|
+
|
|
81
|
+
const triangle_normal = new Float32Array(3);
|
|
82
|
+
const ray = new Ray3();
|
|
83
|
+
ray.tMax = agent_height;
|
|
84
|
+
|
|
85
|
+
let current_triangle_count = triangle_count;
|
|
86
|
+
|
|
87
|
+
for (let i = 0; i < current_triangle_count; i++) {
|
|
88
|
+
const triangle_address = i * 9;
|
|
89
|
+
|
|
90
|
+
const ax = triangles[triangle_address];
|
|
91
|
+
const ay = triangles[triangle_address + 1];
|
|
92
|
+
const az = triangles[triangle_address + 2];
|
|
93
|
+
|
|
94
|
+
const bx = triangles[triangle_address + 3];
|
|
95
|
+
const by = triangles[triangle_address + 4];
|
|
96
|
+
const bz = triangles[triangle_address + 5];
|
|
97
|
+
|
|
98
|
+
const cx = triangles[triangle_address + 6];
|
|
99
|
+
const cy = triangles[triangle_address + 7];
|
|
100
|
+
const cz = triangles[triangle_address + 8];
|
|
101
|
+
|
|
102
|
+
// TODO we can accelerate this by performing a clipping volume query first instead
|
|
103
|
+
// majority of the triangles are expected to fully pass clearance, and a single clipping volume test will be able to give us "Not obstructed" answer.
|
|
104
|
+
|
|
105
|
+
const triangle_area = compute_triangle_area_3d(
|
|
106
|
+
ax, ay, az,
|
|
107
|
+
bx, by, bz,
|
|
108
|
+
cx, cy, cz
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
if (triangle_area === 0) {
|
|
112
|
+
// a degenerate triangle, should not happen but no point in sampling
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// construct normal
|
|
117
|
+
v3_compute_triangle_normal(
|
|
118
|
+
triangle_normal, 0,
|
|
119
|
+
ax, ay, az,
|
|
120
|
+
bx, by, bz,
|
|
121
|
+
cx, cy, cz
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
const sample_count_desired = triangle_area / sample_area;
|
|
125
|
+
const sample_count_rounded = roundFair(sample_count_desired, random);
|
|
126
|
+
|
|
127
|
+
// Guard against degenerate cases
|
|
128
|
+
const SAMPLE_COUNT_MAX = 32000;
|
|
129
|
+
|
|
130
|
+
const sample_count = clamp(sample_count_rounded, 1, SAMPLE_COUNT_MAX);
|
|
131
|
+
|
|
132
|
+
// perform sampling
|
|
133
|
+
const normal_x = triangle_normal[0];
|
|
134
|
+
const normal_y = triangle_normal[1];
|
|
135
|
+
const normal_z = triangle_normal[2];
|
|
136
|
+
|
|
137
|
+
ray.setDirection(normal_x, normal_y, normal_z);
|
|
138
|
+
|
|
139
|
+
// construct edges for sampling
|
|
140
|
+
const e0x = bx - ax;
|
|
141
|
+
const e0y = by - ay;
|
|
142
|
+
const e0z = bz - az;
|
|
143
|
+
|
|
144
|
+
const e1x = cx - bx;
|
|
145
|
+
const e1y = cy - by;
|
|
146
|
+
const e1z = cz - bz;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Barycentric coordinates of where the holes are
|
|
150
|
+
* @type {number[]}
|
|
151
|
+
*/
|
|
152
|
+
const holes = [];
|
|
153
|
+
|
|
154
|
+
for (let j = 0; j < sample_count; j++) {
|
|
155
|
+
|
|
156
|
+
// perform initial sample
|
|
157
|
+
const r0 = random();
|
|
158
|
+
const r1 = random() * (1 - r0);
|
|
159
|
+
|
|
160
|
+
const x = ax + r0 * e0x + r1 * e1x;
|
|
161
|
+
const y = ay + r0 * e0y + r1 * e1y;
|
|
162
|
+
const z = az + r0 * e0z + r1 * e1z;
|
|
163
|
+
|
|
164
|
+
ray.setOrigin(x, y, z);
|
|
165
|
+
|
|
166
|
+
// tiny offset to avoid self-occlusion
|
|
167
|
+
ray.shiftForward(1e-7);
|
|
168
|
+
|
|
169
|
+
// TODO actual raycast
|
|
170
|
+
|
|
171
|
+
// if we got a hit - create a hole triangle, if no hit - continue
|
|
172
|
+
holes.push(r0, r1);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (holes.length === 0) {
|
|
176
|
+
// clearance OK
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const hole_shapes = generate_hole_shapes_barycentric(
|
|
181
|
+
holes,
|
|
182
|
+
sampling_resolution,
|
|
183
|
+
ax, ay, az,
|
|
184
|
+
bx, by, bz,
|
|
185
|
+
cx, cy, cz
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
const added_triangle_count = triangle_punch_holes(
|
|
189
|
+
triangles,
|
|
190
|
+
triangle_count,
|
|
191
|
+
hole_shapes,
|
|
192
|
+
ax, ay, az,
|
|
193
|
+
bx, by, bz,
|
|
194
|
+
cx, cy, cz
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
triangle_count += added_triangle_count;
|
|
198
|
+
|
|
199
|
+
// TODO remove the original triangle, cut out the holes and add new triangles back
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
//
|
|
203
|
+
return current_triangle_count;
|
|
204
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build from given scene geometry
|
|
3
|
+
* @param {BinaryTopology} destination
|
|
4
|
+
* @param {BinaryTopology} source Must be triangulated. Use {@link bt_mesh_triangulate} if needed.
|
|
5
|
+
* @param {number} [agent_radius]
|
|
6
|
+
* @param {number} [agent_height]
|
|
7
|
+
* @param {number} [agent_max_step_height] agent can bridge vertical gaps in topology, such as stepping up a stair
|
|
8
|
+
* @param {number} [agent_max_step_distance] agent can bridge lateral gaps in topology, such as stepping over a hole in the floor
|
|
9
|
+
* @param {number} [agent_max_climb_angle] In radians, how steep of an angle can the agent go up by
|
|
10
|
+
* @param {Vector3} [up] Defines world's "UP" direction, this is what the agent will respect for climbing constraint
|
|
11
|
+
*/
|
|
12
|
+
export function navmesh_build_topology({ destination, source, agent_radius, agent_height, agent_max_step_height, agent_max_step_distance, agent_max_climb_angle, up, }: BinaryTopology): void;
|
|
13
|
+
import { BinaryTopology } from "../../../../core/geom/3d/topology/struct/binary/BinaryTopology.js";
|
|
14
|
+
//# sourceMappingURL=navmesh_build_topology.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navmesh_build_topology.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/navigation/mesh/build/navmesh_build_topology.js"],"names":[],"mappings":"AAgCA;;;;;;;;;;GAUG;AACH,wKATW,cAAc,QAoJxB;+BApL8B,mEAAmE"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { assert } from "../../../../core/assert.js";
|
|
2
|
+
import { BVH } from "../../../../core/bvh2/bvh3/BVH.js";
|
|
3
|
+
import { BinaryTopology } from "../../../../core/geom/3d/topology/struct/binary/BinaryTopology.js";
|
|
4
|
+
import {
|
|
5
|
+
bt_mesh_cleanup_faceless_references
|
|
6
|
+
} from "../../../../core/geom/3d/topology/struct/binary/io/bt_mesh_cleanup_faceless_references.js";
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
bt_mesh_face_decouple_islands
|
|
10
|
+
} from "../../../../core/geom/3d/topology/struct/binary/io/bt_mesh_face_decouple_islands.js";
|
|
11
|
+
import {
|
|
12
|
+
bt_mesh_face_island_erode
|
|
13
|
+
} from "../../../../core/geom/3d/topology/struct/binary/io/bt_mesh_face_island_erode.js";
|
|
14
|
+
import {
|
|
15
|
+
bt_mesh_from_unindexed_geometry
|
|
16
|
+
} from "../../../../core/geom/3d/topology/struct/binary/io/bt_mesh_from_unindexed_geometry.js";
|
|
17
|
+
import { bt_mesh_triangulate } from "../../../../core/geom/3d/topology/struct/binary/io/bt_mesh_triangulate.js";
|
|
18
|
+
import {
|
|
19
|
+
bt_merge_verts_by_distance
|
|
20
|
+
} from "../../../../core/geom/3d/topology/struct/binary/io/vertex/bt_merge_verts_by_distance.js";
|
|
21
|
+
import { bt_face_is_degenerate } from "../../../../core/geom/3d/topology/struct/binary/query/bt_face_is_degenerate.js";
|
|
22
|
+
import {
|
|
23
|
+
bt_mesh_compute_face_islands
|
|
24
|
+
} from "../../../../core/geom/3d/topology/struct/binary/query/bt_mesh_compute_face_islands.js";
|
|
25
|
+
import { v3_angle_between } from "../../../../core/geom/vec3/v3_angle_between.js";
|
|
26
|
+
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
27
|
+
import { seededRandom } from "../../../../core/math/random/seededRandom.js";
|
|
28
|
+
import { bvh_build_from_bt_mesh } from "../bvh_build_from_bt_mesh.js";
|
|
29
|
+
import { bvh_build_from_unindexed_triangles } from "./bvh_build_from_unindexed_triangles.js";
|
|
30
|
+
import { enforce_agent_height_clearance } from "./enforce_agent_height_clearance.js";
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Build from given scene geometry
|
|
35
|
+
* @param {BinaryTopology} destination
|
|
36
|
+
* @param {BinaryTopology} source Must be triangulated. Use {@link bt_mesh_triangulate} if needed.
|
|
37
|
+
* @param {number} [agent_radius]
|
|
38
|
+
* @param {number} [agent_height]
|
|
39
|
+
* @param {number} [agent_max_step_height] agent can bridge vertical gaps in topology, such as stepping up a stair
|
|
40
|
+
* @param {number} [agent_max_step_distance] agent can bridge lateral gaps in topology, such as stepping over a hole in the floor
|
|
41
|
+
* @param {number} [agent_max_climb_angle] In radians, how steep of an angle can the agent go up by
|
|
42
|
+
* @param {Vector3} [up] Defines world's "UP" direction, this is what the agent will respect for climbing constraint
|
|
43
|
+
*/
|
|
44
|
+
export function navmesh_build_topology({
|
|
45
|
+
destination,
|
|
46
|
+
source,
|
|
47
|
+
agent_radius = 0,
|
|
48
|
+
agent_height = 2,
|
|
49
|
+
agent_max_step_height = 0,
|
|
50
|
+
agent_max_step_distance = 0,
|
|
51
|
+
agent_max_climb_angle = Math.PI / 4,
|
|
52
|
+
up = Vector3.up,
|
|
53
|
+
}) {
|
|
54
|
+
|
|
55
|
+
assert.defined(destination, 'destination');
|
|
56
|
+
assert.defined(source, 'source');
|
|
57
|
+
|
|
58
|
+
assert.greaterThanOrEqual(agent_radius, 0, 'agent_radius');
|
|
59
|
+
assert.greaterThanOrEqual(agent_height, 0, 'agent_height');
|
|
60
|
+
assert.greaterThanOrEqual(agent_max_climb_angle, 0, 'agent_max_climb_angle');
|
|
61
|
+
assert.greaterThanOrEqual(agent_max_step_height, 0, 'agent_max_step_height');
|
|
62
|
+
assert.greaterThanOrEqual(agent_max_step_distance, 0, 'agent_max_step_distance');
|
|
63
|
+
|
|
64
|
+
const random = seededRandom();
|
|
65
|
+
|
|
66
|
+
const source_bvh = new BVH();
|
|
67
|
+
|
|
68
|
+
// prepare a BVH, we'll need it for height queries later on
|
|
69
|
+
bvh_build_from_bt_mesh(source_bvh, source);
|
|
70
|
+
|
|
71
|
+
const scratch_normal = new Float32Array(3);
|
|
72
|
+
|
|
73
|
+
// unpack topology into triangle soup
|
|
74
|
+
const source_face_count = source.faces.size;
|
|
75
|
+
|
|
76
|
+
// TODO add cleanup phase
|
|
77
|
+
// - fuse vertices of tiny triangles eliminating them
|
|
78
|
+
// - identify flat areas and re-triangulate them to remove unnecessary triangles
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
*
|
|
82
|
+
* @type {number[]}
|
|
83
|
+
*/
|
|
84
|
+
const raw_triangles = [];
|
|
85
|
+
let triangle_count = 0;
|
|
86
|
+
|
|
87
|
+
for (let face_id = 0; face_id < source_face_count; face_id++) {
|
|
88
|
+
|
|
89
|
+
source.face_read_normal(scratch_normal, 0, face_id);
|
|
90
|
+
|
|
91
|
+
const angle = v3_angle_between(up.x, up.y, up.z, scratch_normal[0], scratch_normal[1], scratch_normal[2]);
|
|
92
|
+
|
|
93
|
+
if (angle > agent_max_climb_angle) {
|
|
94
|
+
// discard
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (bt_face_is_degenerate(source, face_id)) {
|
|
99
|
+
// discard
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
let loop = source.face_read_loop(face_id);
|
|
104
|
+
const loop_start = loop;
|
|
105
|
+
|
|
106
|
+
let face_vertex_count = 0;
|
|
107
|
+
|
|
108
|
+
do {
|
|
109
|
+
|
|
110
|
+
assert.lessThan(face_vertex_count, 3, 'not a triangle');
|
|
111
|
+
|
|
112
|
+
const vertex = source.loop_read_vertex(loop);
|
|
113
|
+
|
|
114
|
+
const triangle_offset = triangle_count * 9;
|
|
115
|
+
|
|
116
|
+
source.vertex_read_coordinate(raw_triangles, triangle_offset + face_vertex_count * 3, vertex);
|
|
117
|
+
|
|
118
|
+
face_vertex_count++;
|
|
119
|
+
|
|
120
|
+
loop = source.loop_read_next(loop);
|
|
121
|
+
|
|
122
|
+
} while (loop !== loop_start)
|
|
123
|
+
|
|
124
|
+
triangle_count++;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// knock out holes in triangles based on agent's height
|
|
128
|
+
if (agent_height > 0) {
|
|
129
|
+
|
|
130
|
+
triangle_count = enforce_agent_height_clearance({
|
|
131
|
+
bvh: source_bvh,
|
|
132
|
+
agent_height: agent_height,
|
|
133
|
+
agent_radius: agent_radius,
|
|
134
|
+
triangle_count: triangle_count,
|
|
135
|
+
triangles: raw_triangles,
|
|
136
|
+
random: random
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
{
|
|
142
|
+
const bvh = new BVH();
|
|
143
|
+
|
|
144
|
+
// first dump all triangles into a BVH for speed of access
|
|
145
|
+
bvh_build_from_unindexed_triangles(bvh, raw_triangles, triangle_count);
|
|
146
|
+
|
|
147
|
+
// find possible triangle edge connections, that is - where edges of 2 triangles touch, but don't match exactly.
|
|
148
|
+
// the touching edges will need to be cut and affected triangles split accordingly
|
|
149
|
+
|
|
150
|
+
const mesh = new BinaryTopology();
|
|
151
|
+
|
|
152
|
+
// build topology
|
|
153
|
+
bt_mesh_from_unindexed_geometry(mesh, raw_triangles);
|
|
154
|
+
|
|
155
|
+
const mesh_bounds = new Float32Array(6);
|
|
156
|
+
bvh.node_get_aabb(bvh.root, mesh_bounds);
|
|
157
|
+
|
|
158
|
+
// dedupe vertices
|
|
159
|
+
bt_merge_verts_by_distance(
|
|
160
|
+
mesh,
|
|
161
|
+
1e-6
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
const islands = bt_mesh_compute_face_islands(mesh);
|
|
165
|
+
|
|
166
|
+
// enabled us to modify islands independently
|
|
167
|
+
bt_mesh_face_decouple_islands(mesh, islands);
|
|
168
|
+
|
|
169
|
+
// shrink islands to agent_radius
|
|
170
|
+
for (const island of islands) {
|
|
171
|
+
bt_mesh_face_island_erode(mesh, island, agent_radius);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// TODO attempt to reduce mesh complexity by re-triangulating flat areas or running a very constrained decimation
|
|
175
|
+
|
|
176
|
+
// remove dangling references
|
|
177
|
+
bt_mesh_cleanup_faceless_references(mesh);
|
|
178
|
+
|
|
179
|
+
// write out to destination
|
|
180
|
+
destination.copy(mesh);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BVH leaves will contain `face_id` and their bounds will be set from the corresponding face bounds.
|
|
3
|
+
* @param {BVH} bvh
|
|
4
|
+
* @param {BinaryTopology} mesh
|
|
5
|
+
*/
|
|
6
|
+
export function bvh_build_from_bt_mesh(bvh: BVH, mesh: BinaryTopology): void;
|
|
7
|
+
//# sourceMappingURL=bvh_build_from_bt_mesh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bvh_build_from_bt_mesh.d.ts","sourceRoot":"","sources":["../../../../../src/engine/navigation/mesh/bvh_build_from_bt_mesh.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,6EAwDC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { assert } from "../../../core/assert.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* BVH leaves will contain `face_id` and their bounds will be set from the corresponding face bounds.
|
|
5
|
+
* @param {BVH} bvh
|
|
6
|
+
* @param {BinaryTopology} mesh
|
|
7
|
+
*/
|
|
8
|
+
export function bvh_build_from_bt_mesh(bvh, mesh) {
|
|
9
|
+
assert.defined(bvh, 'bvh');
|
|
10
|
+
assert.defined(mesh, 'mesh');
|
|
11
|
+
assert.equal(mesh.isBinaryTopology, true, 'mesh.isBinaryTopology !== true');
|
|
12
|
+
|
|
13
|
+
// clear out the BVH
|
|
14
|
+
bvh.release_all();
|
|
15
|
+
|
|
16
|
+
// NOTE: we assume there are no holes in the allocation, data must be packed
|
|
17
|
+
const face_count = mesh.faces.size;
|
|
18
|
+
|
|
19
|
+
const vertex_position = new Float32Array(3);
|
|
20
|
+
|
|
21
|
+
for (let face_id = 0; face_id < face_count; face_id++) {
|
|
22
|
+
let bounds_x0 = Infinity;
|
|
23
|
+
let bounds_y0 = Infinity;
|
|
24
|
+
let bounds_z0 = Infinity;
|
|
25
|
+
|
|
26
|
+
let bounds_x1 = -Infinity;
|
|
27
|
+
let bounds_y1 = -Infinity;
|
|
28
|
+
let bounds_z1 = -Infinity;
|
|
29
|
+
|
|
30
|
+
let loop = mesh.face_read_loop(face_id);
|
|
31
|
+
const loop_start = loop;
|
|
32
|
+
|
|
33
|
+
do {
|
|
34
|
+
const vertex = mesh.loop_read_vertex(loop);
|
|
35
|
+
|
|
36
|
+
mesh.vertex_read_coordinate(vertex_position, 0, vertex);
|
|
37
|
+
|
|
38
|
+
const px = vertex_position[0];
|
|
39
|
+
const py = vertex_position[1];
|
|
40
|
+
const pz = vertex_position[2];
|
|
41
|
+
|
|
42
|
+
bounds_x0 = Math.min(bounds_x0, px);
|
|
43
|
+
bounds_y0 = Math.min(bounds_y0, py);
|
|
44
|
+
bounds_z0 = Math.min(bounds_z0, pz);
|
|
45
|
+
|
|
46
|
+
bounds_x1 = Math.max(bounds_x1, px);
|
|
47
|
+
bounds_y1 = Math.max(bounds_y1, py);
|
|
48
|
+
bounds_z1 = Math.max(bounds_z1, pz);
|
|
49
|
+
|
|
50
|
+
loop = mesh.loop_read_next(loop);
|
|
51
|
+
|
|
52
|
+
} while (loop !== loop_start)
|
|
53
|
+
|
|
54
|
+
const node = bvh.allocate_node();
|
|
55
|
+
|
|
56
|
+
bvh.node_set_user_data(node, face_id);
|
|
57
|
+
bvh.node_set_aabb_primitive(node,
|
|
58
|
+
bounds_x0, bounds_y0, bounds_z0,
|
|
59
|
+
bounds_x1, bounds_y1, bounds_z1
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
bvh.insert_leaf(node);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implementation of the string-pulling algorithm for funnel path refinement.
|
|
3
|
+
* Does not allocate memory.
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* @param {Uint32Array|number[]|ArrayLike<number>} output Indices of vertices are written here
|
|
7
|
+
* @param {number} output_offset where to start writing into the output, typically you want to pass 0 here.
|
|
8
|
+
* @param {Uint32Array|Uint16Array|Uint8Array|number[]} portal_vertices Flat array of vertex index pairs [left0,right0, left1, right1 ... leftN, rightN]
|
|
9
|
+
* @param {Float32Array|number[]|ArrayLike<number>} portal_normals Normal vectors for each portal. Should be set to the triangle normal, which we exit through this portal. can be filled with [up, up, up... ] if your portals lay in the horizontal plane mostly.
|
|
10
|
+
* @param {number} portal_count how many portals do we have to work with
|
|
11
|
+
* @param {Float32Array|number[]} vertex_data actual vertex positions
|
|
12
|
+
* @returns number of vertices written to the output
|
|
13
|
+
*/
|
|
14
|
+
export function funnel_string_pull(output: Uint32Array | number[] | ArrayLike<number>, output_offset: number, portal_vertices: Uint32Array | Uint16Array | Uint8Array | number[], portal_normals: Float32Array | number[] | ArrayLike<number>, portal_count: number, vertex_data: Float32Array | number[]): number;
|
|
15
|
+
//# sourceMappingURL=funnel_string_pull.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"funnel_string_pull.d.ts","sourceRoot":"","sources":["../../../../../src/engine/navigation/mesh/funnel_string_pull.js"],"names":[],"mappings":"AAkGA;;;;;;;;;;;;GAYG;AACH,2CARW,WAAW,GAAC,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,iBACtC,MAAM,mBACN,WAAW,GAAC,WAAW,GAAC,UAAU,GAAC,MAAM,EAAE,kBAC3C,YAAY,GAAC,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,gBACvC,MAAM,eACN,YAAY,GAAC,MAAM,EAAE,UAoH/B"}
|