@woosh/meep-engine 2.164.0 → 2.165.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bundle-worker-terrain.js +1 -1
- package/package.json +1 -1
- package/src/core/binary/BitImage2.d.ts +91 -0
- package/src/core/binary/BitImage2.d.ts.map +1 -0
- package/src/core/binary/BitImage2.js +242 -0
- package/src/core/geom/2d/oriented-box/min_area_rect_2d.d.ts +22 -0
- package/src/core/geom/2d/oriented-box/min_area_rect_2d.d.ts.map +1 -0
- package/src/core/geom/2d/oriented-box/min_area_rect_2d.js +69 -0
- package/src/core/geom/2d/packing/skyline.d.ts +116 -0
- package/src/core/geom/2d/packing/skyline.d.ts.map +1 -0
- package/src/core/geom/2d/packing/skyline.js +258 -0
- package/src/core/geom/2d/triangle/tri2_rasterize_conservative.d.ts +18 -0
- package/src/core/geom/2d/triangle/tri2_rasterize_conservative.d.ts.map +1 -0
- package/src/core/geom/2d/triangle/tri2_rasterize_conservative.js +86 -0
- package/src/core/geom/3d/atlas/ATLAS_PORT_PLAN.md +486 -0
- package/src/core/geom/3d/atlas/BFF_PLAN.md +174 -0
- package/src/core/geom/3d/atlas/Chart.d.ts +58 -0
- package/src/core/geom/3d/atlas/Chart.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/Chart.js +77 -0
- package/src/core/geom/3d/atlas/REVIEW_02.md +392 -0
- package/src/core/geom/3d/atlas/atlas_bench_lib.d.ts +73 -0
- package/src/core/geom/3d/atlas/atlas_bench_lib.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_bench_lib.js +315 -0
- package/src/core/geom/3d/atlas/atlas_chart_type.d.ts +17 -0
- package/src/core/geom/3d/atlas/atlas_chart_type.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_chart_type.js +16 -0
- package/src/core/geom/3d/atlas/atlas_compute_charts.d.ts +25 -0
- package/src/core/geom/3d/atlas/atlas_compute_charts.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_compute_charts.js +188 -0
- package/src/core/geom/3d/atlas/atlas_extract_chart.d.ts +17 -0
- package/src/core/geom/3d/atlas/atlas_extract_chart.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_extract_chart.js +107 -0
- package/src/core/geom/3d/atlas/atlas_generate.d.ts +39 -0
- package/src/core/geom/3d/atlas/atlas_generate.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_generate.js +43 -0
- package/src/core/geom/3d/atlas/atlas_test_fixtures.d.ts +84 -0
- package/src/core/geom/3d/atlas/atlas_test_fixtures.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_test_fixtures.js +266 -0
- package/src/core/geom/3d/atlas/atlas_write_chart_uvs.d.ts +25 -0
- package/src/core/geom/3d/atlas/atlas_write_chart_uvs.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_write_chart_uvs.js +36 -0
- package/src/core/geom/3d/atlas/data/atlas_build_edge_dihedrals.d.ts +22 -0
- package/src/core/geom/3d/atlas/data/atlas_build_edge_dihedrals.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/data/atlas_build_edge_dihedrals.js +62 -0
- package/src/core/geom/3d/atlas/data/atlas_build_edge_lengths.d.ts +9 -0
- package/src/core/geom/3d/atlas/data/atlas_build_edge_lengths.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/data/atlas_build_edge_lengths.js +33 -0
- package/src/core/geom/3d/atlas/data/atlas_build_face_areas.d.ts +9 -0
- package/src/core/geom/3d/atlas/data/atlas_build_face_areas.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/data/atlas_build_face_areas.js +50 -0
- package/src/core/geom/3d/atlas/io/atlas_mesh_weld_colocals.d.ts +27 -0
- package/src/core/geom/3d/atlas/io/atlas_mesh_weld_colocals.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/io/atlas_mesh_weld_colocals.js +39 -0
- package/src/core/geom/3d/atlas/io/bt_loop_uv.d.ts +22 -0
- package/src/core/geom/3d/atlas/io/bt_loop_uv.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/io/bt_loop_uv.js +57 -0
- package/src/core/geom/3d/atlas/pack/ChartPlacement.d.ts +36 -0
- package/src/core/geom/3d/atlas/pack/ChartPlacement.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/pack/ChartPlacement.js +46 -0
- package/src/core/geom/3d/atlas/pack/atlas_pack_charts.d.ts +62 -0
- package/src/core/geom/3d/atlas/pack/atlas_pack_charts.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/pack/atlas_pack_charts.js +551 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_param_validity.d.ts +22 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_param_validity.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_param_validity.js +73 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_bff.d.ts +37 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_bff.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_bff.js +270 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_lscm.d.ts +23 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_lscm.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_lscm.js +224 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_ortho.d.ts +14 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_ortho.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_ortho.js +38 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_stretch_metric.d.ts +22 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_stretch_metric.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_stretch_metric.js +86 -0
- package/src/core/geom/3d/atlas/param/atlas_piecewise_resegment.d.ts +20 -0
- package/src/core/geom/3d/atlas/param/atlas_piecewise_resegment.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/atlas_piecewise_resegment.js +183 -0
- package/src/core/geom/3d/atlas/param/fit_plane_basis.d.ts +27 -0
- package/src/core/geom/3d/atlas/param/fit_plane_basis.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/fit_plane_basis.js +66 -0
- package/src/core/geom/3d/atlas/segment/RegionGraph.d.ts +31 -0
- package/src/core/geom/3d/atlas/segment/RegionGraph.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/segment/RegionGraph.js +40 -0
- package/src/core/geom/3d/atlas/segment/atlas_build_region_graph.d.ts +23 -0
- package/src/core/geom/3d/atlas/segment/atlas_build_region_graph.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/segment/atlas_build_region_graph.js +136 -0
- package/src/core/geom/3d/atlas/segment/atlas_compute_planar_regions.d.ts +24 -0
- package/src/core/geom/3d/atlas/segment/atlas_compute_planar_regions.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/segment/atlas_compute_planar_regions.js +77 -0
- package/src/core/geom/3d/atlas/segment/atlas_merge_charts.d.ts +27 -0
- package/src/core/geom/3d/atlas/segment/atlas_merge_charts.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/segment/atlas_merge_charts.js +113 -0
- package/src/core/geom/3d/atlas/segment/atlas_segment_charts.d.ts +44 -0
- package/src/core/geom/3d/atlas/segment/atlas_segment_charts.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/segment/atlas_segment_charts.js +275 -0
- package/src/core/geom/3d/atlas/segment/atlas_segment_charts_atomic.d.ts +22 -0
- package/src/core/geom/3d/atlas/segment/atlas_segment_charts_atomic.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/segment/atlas_segment_charts_atomic.js +199 -0
- package/src/core/geom/3d/line/line3_compute_point_segment_point_distance_unfolded.d.ts +32 -0
- package/src/core/geom/3d/line/line3_compute_point_segment_point_distance_unfolded.d.ts.map +1 -0
- package/src/core/geom/3d/line/line3_compute_point_segment_point_distance_unfolded.js +64 -0
- package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale.d.ts +20 -0
- package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale.d.ts.map +1 -0
- package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale.js +66 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.d.ts.map +1 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js +13 -11
- package/src/core/geom/3d/sphere/sphere_compute_bounding_of_2_spheres.d.ts.map +1 -1
- package/src/core/geom/3d/sphere/sphere_compute_bounding_of_2_spheres.js +4 -3
- package/src/core/geom/3d/topology/simplify/decimate_edge_collapse_snap.d.ts.map +1 -1
- package/src/core/geom/3d/topology/simplify/decimate_edge_collapse_snap.js +4 -3
- package/src/core/geom/3d/topology/simplify/quadratic/Quadric3.d.ts.map +1 -1
- package/src/core/geom/3d/topology/simplify/quadratic/Quadric3.js +4 -3
- package/src/core/geom/3d/topology/simplify/quadratic/apply_border_penalty_to_vertex_quadrics.d.ts.map +1 -1
- package/src/core/geom/3d/topology/simplify/quadratic/apply_border_penalty_to_vertex_quadrics.js +10 -6
- package/src/core/geom/3d/topology/struct/TopoMesh.js +2 -2
- package/src/core/geom/3d/topology/struct/TopoTriangle.d.ts +0 -2
- package/src/core/geom/3d/topology/struct/TopoTriangle.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/TopoTriangle.js +2 -2
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.js +8 -27
- package/src/core/geom/vec3/v3_cotangent.d.ts +20 -0
- package/src/core/geom/vec3/v3_cotangent.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_cotangent.js +29 -0
- package/src/core/geom/vec3/v3_matrix3_multiply.d.ts +19 -0
- package/src/core/geom/vec3/v3_matrix3_multiply.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_matrix3_multiply.js +30 -0
- package/src/core/geom/vec3/v3_multiply.d.ts +16 -0
- package/src/core/geom/vec3/v3_multiply.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_multiply.js +19 -0
- package/src/core/math/linalg/cg/cg_solve.d.ts +24 -0
- package/src/core/math/linalg/cg/cg_solve.d.ts.map +1 -0
- package/src/core/math/linalg/cg/cg_solve.js +106 -0
- package/src/core/math/linalg/cg/cg_solve_normal_equations.d.ts +21 -0
- package/src/core/math/linalg/cg/cg_solve_normal_equations.d.ts.map +1 -0
- package/src/core/math/linalg/cg/cg_solve_normal_equations.js +59 -0
- package/src/core/math/linalg/eigen/matrix_symmetric_3x3_eigen.d.ts +19 -0
- package/src/core/math/linalg/eigen/matrix_symmetric_3x3_eigen.d.ts.map +1 -0
- package/src/core/math/linalg/eigen/matrix_symmetric_3x3_eigen.js +117 -0
- package/src/core/math/linalg/sparse/SparseMatrixCSR.d.ts +50 -0
- package/src/core/math/linalg/sparse/SparseMatrixCSR.d.ts.map +1 -0
- package/src/core/math/linalg/sparse/SparseMatrixCSR.js +88 -0
- package/src/core/math/linalg/sparse/spm_matvec.d.ts +9 -0
- package/src/core/math/linalg/sparse/spm_matvec.d.ts.map +1 -0
- package/src/core/math/linalg/sparse/spm_matvec.js +22 -0
- package/src/core/math/linalg/sparse/spm_matvec_transpose.d.ts +12 -0
- package/src/core/math/linalg/sparse/spm_matvec_transpose.d.ts.map +1 -0
- package/src/core/math/linalg/sparse/spm_matvec_transpose.js +29 -0
- package/src/core/math/physics/mie/MIE_PARTICLES_STANDARD_PRECOMPUTED.d.ts +39 -0
- package/src/core/math/physics/mie/MIE_PARTICLES_STANDARD_PRECOMPUTED.js +22 -1
- package/src/core/math/physics/mie/compute_mie_particle_properties_rgb.d.ts.map +1 -1
- package/src/core/math/physics/mie/compute_mie_particle_properties_rgb.js +32 -9
- package/src/core/math/physics/mie/compute_mie_phase.d.ts +2 -3
- package/src/core/math/physics/mie/compute_mie_phase.d.ts.map +1 -1
- package/src/core/math/physics/mie/compute_mie_phase.js +1 -3
- package/src/core/math/physics/mie/lorenz_mie_coefs.d.ts +0 -1
- package/src/core/math/physics/mie/lorenz_mie_coefs.d.ts.map +1 -1
- package/src/core/math/physics/mie/lorenz_mie_coefs.js +0 -7
- package/src/engine/ecs/attachment/TransformAttachmentBinding.js +3 -3
- package/src/engine/ecs/gui/hud/HeadsUpDisplaySystem.js +2 -2
- package/src/engine/ecs/terrain/ecs/Terrain.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/Terrain.js +4 -3
- package/src/engine/ecs/terrain/tiles/TerrainTile.js +2 -2
- package/src/engine/ecs/terrain/tiles/TerrainTileManager.d.ts.map +1 -1
- package/src/engine/ecs/terrain/tiles/TerrainTileManager.js +9 -8
- package/src/engine/graphics/GraphicsEngine.d.ts.map +1 -1
- package/src/engine/graphics/GraphicsEngine.js +2 -1
- package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.js +2 -2
- package/src/engine/graphics/ecs/decal/v2/prototypeDecalSystem.js +2 -2
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +2 -2
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +0 -1
- package/src/engine/graphics/ecs/path/tube/build/computeFrenetFrames.d.ts.map +1 -1
- package/src/engine/graphics/ecs/path/tube/build/computeFrenetFrames.js +8 -7
- package/src/engine/graphics/geometry/MikkT/AvgTSpace.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/AvgTSpace.js +11 -6
- package/src/engine/graphics/geometry/MikkT/BuildNeighborsFast.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/BuildNeighborsFast.js +2 -3
- package/src/engine/graphics/geometry/MikkT/CalcTexArea.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/CalcTexArea.js +3 -4
- package/src/engine/graphics/geometry/MikkT/DegenEpilogue.js +4 -4
- package/src/engine/graphics/geometry/MikkT/EvalTspace.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/EvalTspace.js +11 -8
- package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.js +7 -8
- package/src/engine/graphics/geometry/MikkT/GenerateTSpaces.js +8 -8
- package/src/engine/graphics/geometry/MikkT/InitTriInfo.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/InitTriInfo.js +30 -25
- package/src/engine/graphics/geometry/MikkT/MikkTSpace.js +7 -7
- package/src/engine/graphics/geometry/MikkT/NormalizeSafe.d.ts +0 -1
- package/src/engine/graphics/geometry/MikkT/NormalizeSafe.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/NormalizeSafe.js +6 -4
- package/src/engine/graphics/geometry/MikkT/STSpace.d.ts +0 -2
- package/src/engine/graphics/geometry/MikkT/STSpace.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/STSpace.js +3 -3
- package/src/engine/graphics/geometry/MikkT/v3_scale_dot_sub_normalize.d.ts +0 -2
- package/src/engine/graphics/geometry/MikkT/v3_scale_dot_sub_normalize.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/v3_scale_dot_sub_normalize.js +0 -1
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.d.ts +0 -2
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.js +4 -3
- package/src/engine/graphics/impostors/octahedral/grid/HemiOctahedralUvEncoder.js +2 -2
- package/src/engine/graphics/impostors/octahedral/grid/UvEncoder.d.ts +17 -7
- package/src/engine/graphics/impostors/voxel/VoxelImpostorBaker.js +2 -2
- package/src/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.js +3 -3
- package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +4 -3
- package/src/engine/graphics/render/forward_plus/LightManager.js +2 -2
- package/src/engine/graphics/render/forward_plus/model/Decal.d.ts +0 -2
- package/src/engine/graphics/render/forward_plus/model/Decal.d.ts.map +1 -1
- package/src/engine/graphics/render/forward_plus/model/Decal.js +3 -3
- package/src/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +4 -3
- package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +6 -4
- package/src/engine/graphics/sh3/lightmap/ARTIFACTS_PLAN.md +146 -0
- package/src/engine/graphics/sh3/lightmap/CODE_REVIEW.md +121 -0
- package/src/engine/graphics/sh3/lightmap/LIGHTMAPPER_REVIEW.md +183 -0
- package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.d.ts +90 -0
- package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.js +678 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_build_geometry.d.ts +32 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_build_geometry.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_build_geometry.js +155 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_denoise.d.ts +49 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_denoise.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_denoise.js +136 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_dilate.d.ts +19 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_dilate.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_dilate.js +89 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_gather.d.ts +54 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_gather.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_gather.js +168 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_rasterize_triangle.d.ts +30 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_rasterize_triangle.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_rasterize_triangle.js +145 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_seam_fix.d.ts +38 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_seam_fix.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_seam_fix.js +152 -0
- package/src/engine/graphics/sh3/lightmap/prototypeLightmapBaker.d.ts +2 -0
- package/src/engine/graphics/sh3/lightmap/prototypeLightmapBaker.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/prototypeLightmapBaker.js +186 -0
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.js +2 -2
- package/src/engine/graphics/sh3/path_tracer/PathTracer.js +2 -2
- package/src/engine/graphics/sh3/path_tracer/prepare_scene_gltf.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/prepare_scene_gltf.js +6 -4
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +3 -3
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.js +5 -4
- package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.js +2 -2
- package/src/engine/input/devices/KeyboardDevice.d.ts +61 -14
- package/src/engine/input/devices/KeyboardDevice.d.ts.map +1 -1
- package/src/engine/input/devices/KeyboardDevice.js +41 -15
- package/src/engine/input/devices/isHTMLElementFocusable.d.ts.map +1 -1
- package/src/engine/input/devices/isHTMLElementFocusable.js +2 -9
- package/src/engine/sound/simulation/prototypeAcousticSolver.js +261 -143
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { v3_dot } from "../../../vec3/v3_dot.js";
|
|
2
|
+
import { NULL_POINTER } from "../../topology/struct/binary/BinaryTopology.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Sentinel value for an edge that does not have two adjacent faces (mesh
|
|
6
|
+
* boundary, wire edge, or unallocated). Chosen outside the valid cosine range
|
|
7
|
+
* [-1, 1] so it is unambiguous. xatlas uses FLT_MAX for the same purpose.
|
|
8
|
+
* @type {number}
|
|
9
|
+
*/
|
|
10
|
+
export const EDGE_DIHEDRAL_BOUNDARY = 2;
|
|
11
|
+
|
|
12
|
+
const n1 = new Float32Array(3);
|
|
13
|
+
const n2 = new Float32Array(3);
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Per-edge dihedral measure: the dot product of the two adjacent (unit) face
|
|
17
|
+
* normals. 1 = coplanar/flat, 0 = 90 degree fold, -1 = fully folded back.
|
|
18
|
+
* Boundary/wire/unallocated edges get {@link EDGE_DIHEDRAL_BOUNDARY}.
|
|
19
|
+
*
|
|
20
|
+
* For a non-manifold edge (>2 incident faces) the first radial pair is used.
|
|
21
|
+
*
|
|
22
|
+
* Precondition: face normals are populated (call
|
|
23
|
+
* {@link bt_mesh_compute_face_normals} first).
|
|
24
|
+
*
|
|
25
|
+
* @param {BinaryTopology} mesh
|
|
26
|
+
* @returns {Float32Array} length mesh.edges.size
|
|
27
|
+
*/
|
|
28
|
+
export function atlas_build_edge_dihedrals(mesh) {
|
|
29
|
+
const edges = mesh.edges;
|
|
30
|
+
const edge_count = edges.size;
|
|
31
|
+
const out = new Float32Array(edge_count);
|
|
32
|
+
|
|
33
|
+
for (let e = 0; e < edge_count; e++) {
|
|
34
|
+
if (!edges.is_allocated(e)) {
|
|
35
|
+
out[e] = EDGE_DIHEDRAL_BOUNDARY;
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const l1 = mesh.edge_read_loop(e);
|
|
40
|
+
if (l1 === NULL_POINTER) {
|
|
41
|
+
out[e] = EDGE_DIHEDRAL_BOUNDARY;
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const l2 = mesh.loop_read_radial_next(l1);
|
|
46
|
+
if (l2 === l1) {
|
|
47
|
+
// single radial loop -> boundary edge
|
|
48
|
+
out[e] = EDGE_DIHEDRAL_BOUNDARY;
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
mesh.face_read_normal(n1, 0, mesh.loop_read_face(l1));
|
|
53
|
+
mesh.face_read_normal(n2, 0, mesh.loop_read_face(l2));
|
|
54
|
+
|
|
55
|
+
out[e] = v3_dot(
|
|
56
|
+
n1[0], n1[1], n1[2],
|
|
57
|
+
n2[0], n2[1], n2[2]
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return out;
|
|
62
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-edge length, indexed by edge id. Unallocated edges are left at 0.
|
|
3
|
+
* Mirrors xatlas `AtlasData::edgeLengths`.
|
|
4
|
+
*
|
|
5
|
+
* @param {BinaryTopology} mesh
|
|
6
|
+
* @returns {Float32Array} length mesh.edges.size
|
|
7
|
+
*/
|
|
8
|
+
export function atlas_build_edge_lengths(mesh: BinaryTopology): Float32Array;
|
|
9
|
+
//# sourceMappingURL=atlas_build_edge_lengths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atlas_build_edge_lengths.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/atlas/data/atlas_build_edge_lengths.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,gEAFa,YAAY,CAsBxB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { v3_distance_sqr } from "../../../vec3/v3_distance_sqr.js";
|
|
2
|
+
|
|
3
|
+
const v1 = new Float32Array(3);
|
|
4
|
+
const v2 = new Float32Array(3);
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Per-edge length, indexed by edge id. Unallocated edges are left at 0.
|
|
8
|
+
* Mirrors xatlas `AtlasData::edgeLengths`.
|
|
9
|
+
*
|
|
10
|
+
* @param {BinaryTopology} mesh
|
|
11
|
+
* @returns {Float32Array} length mesh.edges.size
|
|
12
|
+
*/
|
|
13
|
+
export function atlas_build_edge_lengths(mesh) {
|
|
14
|
+
const edges = mesh.edges;
|
|
15
|
+
const edge_count = edges.size;
|
|
16
|
+
const out = new Float32Array(edge_count);
|
|
17
|
+
|
|
18
|
+
for (let e = 0; e < edge_count; e++) {
|
|
19
|
+
if (!edges.is_allocated(e)) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
mesh.vertex_read_coordinate(v1, 0, mesh.edge_read_vertex1(e));
|
|
24
|
+
mesh.vertex_read_coordinate(v2, 0, mesh.edge_read_vertex2(e));
|
|
25
|
+
|
|
26
|
+
out[e] = Math.sqrt(v3_distance_sqr(
|
|
27
|
+
v1[0], v1[1], v1[2],
|
|
28
|
+
v2[0], v2[1], v2[2]
|
|
29
|
+
));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return out;
|
|
33
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-face 3D surface area, indexed by face id. Non-triangular and unallocated
|
|
3
|
+
* faces are left at 0. Mirrors xatlas `AtlasData::faceAreas`.
|
|
4
|
+
*
|
|
5
|
+
* @param {BinaryTopology} mesh
|
|
6
|
+
* @returns {Float32Array} length mesh.faces.size
|
|
7
|
+
*/
|
|
8
|
+
export function atlas_build_face_areas(mesh: BinaryTopology): Float32Array;
|
|
9
|
+
//# sourceMappingURL=atlas_build_face_areas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atlas_build_face_areas.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/atlas/data/atlas_build_face_areas.js"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,8DAFa,YAAY,CAqCxB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { tri3_area } from "../../triangle/tri3_area.js";
|
|
2
|
+
import { NULL_POINTER } from "../../topology/struct/binary/BinaryTopology.js";
|
|
3
|
+
|
|
4
|
+
const a = new Float32Array(3);
|
|
5
|
+
const b = new Float32Array(3);
|
|
6
|
+
const c = new Float32Array(3);
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Per-face 3D surface area, indexed by face id. Non-triangular and unallocated
|
|
10
|
+
* faces are left at 0. Mirrors xatlas `AtlasData::faceAreas`.
|
|
11
|
+
*
|
|
12
|
+
* @param {BinaryTopology} mesh
|
|
13
|
+
* @returns {Float32Array} length mesh.faces.size
|
|
14
|
+
*/
|
|
15
|
+
export function atlas_build_face_areas(mesh) {
|
|
16
|
+
const faces = mesh.faces;
|
|
17
|
+
const face_count = faces.size;
|
|
18
|
+
const out = new Float32Array(face_count);
|
|
19
|
+
|
|
20
|
+
for (let f = 0; f < face_count; f++) {
|
|
21
|
+
if (!faces.is_allocated(f)) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const l0 = mesh.face_read_loop(f);
|
|
26
|
+
if (l0 === NULL_POINTER) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const l1 = mesh.loop_read_next(l0);
|
|
31
|
+
const l2 = mesh.loop_read_next(l1);
|
|
32
|
+
|
|
33
|
+
// triangle only
|
|
34
|
+
if (mesh.loop_read_next(l2) !== l0) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
mesh.vertex_read_coordinate(a, 0, mesh.loop_read_vertex(l0));
|
|
39
|
+
mesh.vertex_read_coordinate(b, 0, mesh.loop_read_vertex(l1));
|
|
40
|
+
mesh.vertex_read_coordinate(c, 0, mesh.loop_read_vertex(l2));
|
|
41
|
+
|
|
42
|
+
out[f] = tri3_area(
|
|
43
|
+
a[0], a[1], a[2],
|
|
44
|
+
b[0], b[1], b[2],
|
|
45
|
+
c[0], c[1], c[2]
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return out;
|
|
50
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Condition a mesh for charting by welding spatially-coincident topology:
|
|
3
|
+
*
|
|
4
|
+
* 1. fuse coincident vertex positions so neighbouring triangles share a vertex
|
|
5
|
+
* id ({@link bt_merge_vertices_by_distance});
|
|
6
|
+
* 2. fuse the resulting duplicate edges so neighbours share an edge id too —
|
|
7
|
+
* this is what radial/loop neighbour queries (segmentation flood-fill,
|
|
8
|
+
* dihedral, boundary detection) rely on ({@link bt_mesh_fuse_duplicate_edges});
|
|
9
|
+
* 3. resolve T-junctions (a face corner landing on another face's edge leaves
|
|
10
|
+
* them touching at a single vertex, invisible to edge-based adjacency), then
|
|
11
|
+
* re-merge/re-fuse.
|
|
12
|
+
*
|
|
13
|
+
* This is the same sequence the navmesh builder uses; xatlas `createColocals` +
|
|
14
|
+
* boundary fixup is the conceptual equivalent. Duplicate vertices left unlinked
|
|
15
|
+
* by the merge are harmless to charting (they are simply unreferenced).
|
|
16
|
+
*
|
|
17
|
+
* @param {BinaryTopology} mesh mutated in place
|
|
18
|
+
* @param {number} [max_distance]
|
|
19
|
+
*/
|
|
20
|
+
export function atlas_mesh_weld_colocals(mesh: BinaryTopology, max_distance?: number): void;
|
|
21
|
+
/**
|
|
22
|
+
* Default colocal-merge distance. Positions closer than this are treated as the
|
|
23
|
+
* same point.
|
|
24
|
+
* @type {number}
|
|
25
|
+
*/
|
|
26
|
+
export const ATLAS_WELD_EPSILON: number;
|
|
27
|
+
//# sourceMappingURL=atlas_mesh_weld_colocals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atlas_mesh_weld_colocals.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/atlas/io/atlas_mesh_weld_colocals.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;GAkBG;AACH,8EAFW,MAAM,QAUhB;AAlCD;;;;GAIG;AACH,iCAFU,MAAM,CAEuB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { bt_mesh_resolve_t_junctions } from "../../topology/struct/binary/io/bt_mesh_resolve_t_junctions.js";
|
|
2
|
+
import { bt_mesh_fuse_duplicate_edges } from "../../topology/struct/binary/io/edge/bt_mesh_fuse_duplicate_edges.js";
|
|
3
|
+
import { bt_merge_vertices_by_distance } from "../../topology/struct/binary/io/vertex/bt_merge_vertices_by_distance.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Default colocal-merge distance. Positions closer than this are treated as the
|
|
7
|
+
* same point.
|
|
8
|
+
* @type {number}
|
|
9
|
+
*/
|
|
10
|
+
export const ATLAS_WELD_EPSILON = 1e-6;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Condition a mesh for charting by welding spatially-coincident topology:
|
|
14
|
+
*
|
|
15
|
+
* 1. fuse coincident vertex positions so neighbouring triangles share a vertex
|
|
16
|
+
* id ({@link bt_merge_vertices_by_distance});
|
|
17
|
+
* 2. fuse the resulting duplicate edges so neighbours share an edge id too —
|
|
18
|
+
* this is what radial/loop neighbour queries (segmentation flood-fill,
|
|
19
|
+
* dihedral, boundary detection) rely on ({@link bt_mesh_fuse_duplicate_edges});
|
|
20
|
+
* 3. resolve T-junctions (a face corner landing on another face's edge leaves
|
|
21
|
+
* them touching at a single vertex, invisible to edge-based adjacency), then
|
|
22
|
+
* re-merge/re-fuse.
|
|
23
|
+
*
|
|
24
|
+
* This is the same sequence the navmesh builder uses; xatlas `createColocals` +
|
|
25
|
+
* boundary fixup is the conceptual equivalent. Duplicate vertices left unlinked
|
|
26
|
+
* by the merge are harmless to charting (they are simply unreferenced).
|
|
27
|
+
*
|
|
28
|
+
* @param {BinaryTopology} mesh mutated in place
|
|
29
|
+
* @param {number} [max_distance]
|
|
30
|
+
*/
|
|
31
|
+
export function atlas_mesh_weld_colocals(mesh, max_distance = ATLAS_WELD_EPSILON) {
|
|
32
|
+
bt_merge_vertices_by_distance(mesh, max_distance);
|
|
33
|
+
bt_mesh_fuse_duplicate_edges(mesh);
|
|
34
|
+
|
|
35
|
+
if (bt_mesh_resolve_t_junctions(mesh, max_distance * 100) > 0) {
|
|
36
|
+
bt_merge_vertices_by_distance(mesh, max_distance);
|
|
37
|
+
bt_mesh_fuse_duplicate_edges(mesh);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ensure the mesh has a loop_data pool sized for UV storage. Idempotent.
|
|
3
|
+
* Call once after the mesh topology is final and before writing UVs.
|
|
4
|
+
*
|
|
5
|
+
* @param {BinaryTopology} mesh
|
|
6
|
+
*/
|
|
7
|
+
export function bt_loop_uv_init(mesh: BinaryTopology): void;
|
|
8
|
+
/**
|
|
9
|
+
* @param {BinaryTopology} mesh must have had {@link bt_loop_uv_init} called
|
|
10
|
+
* @param {number} loop_id
|
|
11
|
+
* @param {number} u
|
|
12
|
+
* @param {number} v
|
|
13
|
+
*/
|
|
14
|
+
export function bt_loop_write_uv(mesh: BinaryTopology, loop_id: number, u: number, v: number): void;
|
|
15
|
+
/**
|
|
16
|
+
* @param {Float32Array|number[]} out
|
|
17
|
+
* @param {number} out_offset
|
|
18
|
+
* @param {BinaryTopology} mesh must have had {@link bt_loop_uv_init} called
|
|
19
|
+
* @param {number} loop_id
|
|
20
|
+
*/
|
|
21
|
+
export function bt_loop_read_uv(out: Float32Array | number[], out_offset: number, mesh: BinaryTopology, loop_id: number): void;
|
|
22
|
+
//# sourceMappingURL=bt_loop_uv.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bt_loop_uv.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/atlas/io/bt_loop_uv.js"],"names":[],"mappings":"AAeA;;;;;GAKG;AACH,4DAOC;AAED;;;;;GAKG;AACH,gEAJW,MAAM,KACN,MAAM,KACN,MAAM,QAQhB;AAED;;;;;GAKG;AACH,qCALW,YAAY,GAAC,MAAM,EAAE,cACrB,MAAM,iCAEN,MAAM,QAQhB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-corner (per-loop) UV storage on a {@link BinaryTopology}, backed by the
|
|
3
|
+
* optional loop_data pool. UVs live on loops (not vertices) so that one
|
|
4
|
+
* geometric vertex shared by several charts carries a distinct UV per chart —
|
|
5
|
+
* which is exactly how a seam is represented. Two floats per loop: (u, v).
|
|
6
|
+
*
|
|
7
|
+
* Related: [[project_xatlas_port]] output channel.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Bytes per loop UV record: two float32 (u, v).
|
|
12
|
+
* @type {number}
|
|
13
|
+
*/
|
|
14
|
+
const UV_ITEM_BYTES = 8;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Ensure the mesh has a loop_data pool sized for UV storage. Idempotent.
|
|
18
|
+
* Call once after the mesh topology is final and before writing UVs.
|
|
19
|
+
*
|
|
20
|
+
* @param {BinaryTopology} mesh
|
|
21
|
+
*/
|
|
22
|
+
export function bt_loop_uv_init(mesh) {
|
|
23
|
+
if (mesh.loop_data === null) {
|
|
24
|
+
mesh.create_loop_data(UV_ITEM_BYTES);
|
|
25
|
+
}
|
|
26
|
+
// Raw addressing (element_word) requires the float buffer to span every
|
|
27
|
+
// loop id; the data pool is not driven through its allocator here.
|
|
28
|
+
mesh.loop_data.ensure_capacity(mesh.loops.capacity);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @param {BinaryTopology} mesh must have had {@link bt_loop_uv_init} called
|
|
33
|
+
* @param {number} loop_id
|
|
34
|
+
* @param {number} u
|
|
35
|
+
* @param {number} v
|
|
36
|
+
*/
|
|
37
|
+
export function bt_loop_write_uv(mesh, loop_id, u, v) {
|
|
38
|
+
const pool = mesh.loop_data;
|
|
39
|
+
const w = pool.element_word(loop_id);
|
|
40
|
+
const f = pool.data_float32;
|
|
41
|
+
f[w] = u;
|
|
42
|
+
f[w + 1] = v;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @param {Float32Array|number[]} out
|
|
47
|
+
* @param {number} out_offset
|
|
48
|
+
* @param {BinaryTopology} mesh must have had {@link bt_loop_uv_init} called
|
|
49
|
+
* @param {number} loop_id
|
|
50
|
+
*/
|
|
51
|
+
export function bt_loop_read_uv(out, out_offset, mesh, loop_id) {
|
|
52
|
+
const pool = mesh.loop_data;
|
|
53
|
+
const w = pool.element_word(loop_id);
|
|
54
|
+
const f = pool.data_float32;
|
|
55
|
+
out[out_offset] = f[w];
|
|
56
|
+
out[out_offset + 1] = f[w + 1];
|
|
57
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One chart's placement record during {@link atlas_pack_charts}: its texel-space
|
|
3
|
+
* transform, its padding-inflated rect size, the coverage masks for the bitmap
|
|
4
|
+
* packer, and the page / position / rotation chosen by the packer. Built per
|
|
5
|
+
* density attempt by `build_packs` and mutated in place by the placement passes.
|
|
6
|
+
*
|
|
7
|
+
* @author Alex Goldring
|
|
8
|
+
* @copyright Company Named Limited (c) 2026
|
|
9
|
+
*/
|
|
10
|
+
export class ChartPlacement {
|
|
11
|
+
/** The chart being placed. @type {Chart} */
|
|
12
|
+
chart: Chart;
|
|
13
|
+
/** Texels per UV unit for this chart. @type {number} */
|
|
14
|
+
scale: number;
|
|
15
|
+
/** Min u of the chart's UV bbox (subtracted before scaling). @type {number} */
|
|
16
|
+
min_u: number;
|
|
17
|
+
/** Min v of the chart's UV bbox. @type {number} */
|
|
18
|
+
min_v: number;
|
|
19
|
+
/** Padding-inflated rect width, texels. @type {number} */
|
|
20
|
+
w: number;
|
|
21
|
+
/** Padding-inflated rect height, texels. @type {number} */
|
|
22
|
+
h: number;
|
|
23
|
+
/** Coverage mask for the bitmap packer; null for the skyline packer. @type {BitImage2|null} */
|
|
24
|
+
mask: BitImage2 | null;
|
|
25
|
+
/** Transposed coverage mask (90-degree orientation); null if rotation off / skyline. @type {BitImage2|null} */
|
|
26
|
+
mask_t: BitImage2 | null;
|
|
27
|
+
/** Atlas page the chart was placed onto. @type {number} */
|
|
28
|
+
page: number;
|
|
29
|
+
/** Placement x within the page, texels. @type {number} */
|
|
30
|
+
x: number;
|
|
31
|
+
/** Placement y within the page, texels. @type {number} */
|
|
32
|
+
y: number;
|
|
33
|
+
/** Placement rotation: 0 = unrotated, 1 = 90 degrees. @type {number} */
|
|
34
|
+
rot: number;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=ChartPlacement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChartPlacement.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/atlas/pack/ChartPlacement.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH;IACI,4CAA4C;IAC5C,aAAa;IAEb,wDAAwD;IACxD,OAD8C,MAAM,CAC1C;IAEV,+EAA+E;IAC/E,OADqE,MAAM,CACjE;IAEV,mDAAmD;IACnD,OADyC,MAAM,CACrC;IAEV,0DAA0D;IAC1D,GADgD,MAAM,CAChD;IAEN,2DAA2D;IAC3D,GADiD,MAAM,CACjD;IAEN,+FAA+F;IAC/F,MAD6E,YAAU,IAAI,CAC/E;IAEZ,+GAA+G;IAC/G,QAD6F,YAAU,IAAI,CAC7F;IAEd,2DAA2D;IAC3D,MADiD,MAAM,CAC9C;IAET,0DAA0D;IAC1D,GADgD,MAAM,CAChD;IAEN,0DAA0D;IAC1D,GADgD,MAAM,CAChD;IAEN,wEAAwE;IACxE,KAD8D,MAAM,CAC5D;CACX"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One chart's placement record during {@link atlas_pack_charts}: its texel-space
|
|
3
|
+
* transform, its padding-inflated rect size, the coverage masks for the bitmap
|
|
4
|
+
* packer, and the page / position / rotation chosen by the packer. Built per
|
|
5
|
+
* density attempt by `build_packs` and mutated in place by the placement passes.
|
|
6
|
+
*
|
|
7
|
+
* @author Alex Goldring
|
|
8
|
+
* @copyright Company Named Limited (c) 2026
|
|
9
|
+
*/
|
|
10
|
+
export class ChartPlacement {
|
|
11
|
+
/** The chart being placed. @type {Chart} */
|
|
12
|
+
chart = null;
|
|
13
|
+
|
|
14
|
+
/** Texels per UV unit for this chart. @type {number} */
|
|
15
|
+
scale = 0;
|
|
16
|
+
|
|
17
|
+
/** Min u of the chart's UV bbox (subtracted before scaling). @type {number} */
|
|
18
|
+
min_u = 0;
|
|
19
|
+
|
|
20
|
+
/** Min v of the chart's UV bbox. @type {number} */
|
|
21
|
+
min_v = 0;
|
|
22
|
+
|
|
23
|
+
/** Padding-inflated rect width, texels. @type {number} */
|
|
24
|
+
w = 0;
|
|
25
|
+
|
|
26
|
+
/** Padding-inflated rect height, texels. @type {number} */
|
|
27
|
+
h = 0;
|
|
28
|
+
|
|
29
|
+
/** Coverage mask for the bitmap packer; null for the skyline packer. @type {BitImage2|null} */
|
|
30
|
+
mask = null;
|
|
31
|
+
|
|
32
|
+
/** Transposed coverage mask (90-degree orientation); null if rotation off / skyline. @type {BitImage2|null} */
|
|
33
|
+
mask_t = null;
|
|
34
|
+
|
|
35
|
+
/** Atlas page the chart was placed onto. @type {number} */
|
|
36
|
+
page = 0;
|
|
37
|
+
|
|
38
|
+
/** Placement x within the page, texels. @type {number} */
|
|
39
|
+
x = 0;
|
|
40
|
+
|
|
41
|
+
/** Placement y within the page, texels. @type {number} */
|
|
42
|
+
y = 0;
|
|
43
|
+
|
|
44
|
+
/** Placement rotation: 0 = unrotated, 1 = 90 degrees. @type {number} */
|
|
45
|
+
rot = 0;
|
|
46
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pack parameterized charts into one or more atlas pages (xatlas `PackCharts`),
|
|
3
|
+
* mutating each chart in place: its `uv` becomes final atlas-space [0,1]
|
|
4
|
+
* coordinates and `atlas_page`/`atlas_x`/`atlas_y`/`atlas_rotated` record its
|
|
5
|
+
* placement. Charts are pre-rotated to their min-area box and may be placed
|
|
6
|
+
* 90-degrees rotated for density.
|
|
7
|
+
*
|
|
8
|
+
* This works purely at the {@link Chart} level — no mesh — so charts from several
|
|
9
|
+
* different meshes can be packed into a single shared atlas. To write the packed
|
|
10
|
+
* UVs back onto a mesh, call {@link atlas_write_chart_uvs} (once per source mesh).
|
|
11
|
+
*
|
|
12
|
+
* Placement strategy is chosen by atlas size: small atlases use the exact
|
|
13
|
+
* bitmap shifted-OR `canBlit` packer (tight, non-rectangular interlocking);
|
|
14
|
+
* large atlases use the fast O(n) skyline rectangle packer (so packing scales).
|
|
15
|
+
* `bruteForce: true` forces the bitmap packer regardless of size.
|
|
16
|
+
*
|
|
17
|
+
* Page modes:
|
|
18
|
+
* - `maxResolution = 0` (default): a single page that grows by powers of two.
|
|
19
|
+
* - `maxResolution > 0`, `maxPages = 1` (default): one fixed-size page with
|
|
20
|
+
* **elastic density** — density shrinks until the charts fit.
|
|
21
|
+
* - `maxResolution > 0`, `maxPages > 1`: spill into up to `maxPages` fixed-size
|
|
22
|
+
* pages at fixed density (`maxPages = Infinity` = pure fixed-density spill).
|
|
23
|
+
*
|
|
24
|
+
* @param {Chart[]} charts from {@link atlas_compute_charts} (mutated: `uv` + placement)
|
|
25
|
+
* @param {object} [options]
|
|
26
|
+
* @param {number} [options.padding] gutter texels (default 1)
|
|
27
|
+
* @param {number} [options.resolution] start/target size for the growing page; 0 = auto
|
|
28
|
+
* @param {number} [options.texelsPerUnit] texel density; 0 = auto
|
|
29
|
+
* @param {number} [options.maxResolution] fixed page size; 0 = unbounded growing page (default 0)
|
|
30
|
+
* @param {number} [options.maxPages] page cap; density is elastic to honour it (default 1)
|
|
31
|
+
* @param {boolean} [options.bruteForce] force the exact bitmap packer (default false)
|
|
32
|
+
* @param {boolean} [options.rotateChartsToAxis] align charts to their OBB (default true)
|
|
33
|
+
* @param {boolean} [options.rotateCharts] allow 90-degree placement (default true)
|
|
34
|
+
* @returns {{pages: Array<{width:number, height:number, occupied_texels:number, utilization:number}>,
|
|
35
|
+
* page_count:number, atlas_width:number, atlas_height:number, utilization:number,
|
|
36
|
+
* occupied_texels:number, mask_texels_total:number, charts:Chart[]}}
|
|
37
|
+
*/
|
|
38
|
+
export function atlas_pack_charts(charts: Chart[], options?: {
|
|
39
|
+
padding?: number;
|
|
40
|
+
resolution?: number;
|
|
41
|
+
texelsPerUnit?: number;
|
|
42
|
+
maxResolution?: number;
|
|
43
|
+
maxPages?: number;
|
|
44
|
+
bruteForce?: boolean;
|
|
45
|
+
rotateChartsToAxis?: boolean;
|
|
46
|
+
rotateCharts?: boolean;
|
|
47
|
+
}): {
|
|
48
|
+
pages: Array<{
|
|
49
|
+
width: number;
|
|
50
|
+
height: number;
|
|
51
|
+
occupied_texels: number;
|
|
52
|
+
utilization: number;
|
|
53
|
+
}>;
|
|
54
|
+
page_count: number;
|
|
55
|
+
atlas_width: number;
|
|
56
|
+
atlas_height: number;
|
|
57
|
+
utilization: number;
|
|
58
|
+
occupied_texels: number;
|
|
59
|
+
mask_texels_total: number;
|
|
60
|
+
charts: Chart[];
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=atlas_pack_charts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atlas_pack_charts.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/atlas/pack/atlas_pack_charts.js"],"names":[],"mappings":"AA4XA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,0CAdW,OAAO;IAEU,OAAO,GAAxB,MAAM;IACW,UAAU,GAA3B,MAAM;IACW,aAAa,GAA9B,MAAM;IACW,aAAa,GAA9B,MAAM;IACW,QAAQ,GAAzB,MAAM;IACY,UAAU,GAA5B,OAAO;IACW,kBAAkB,GAApC,OAAO;IACW,YAAY,GAA9B,OAAO;;WACG,MAAM;QAAC,KAAK,EAAC,MAAM,CAAC;QAAC,MAAM,EAAC,MAAM,CAAC;QAAC,eAAe,EAAC,MAAM,CAAC;QAAC,WAAW,EAAC,MAAM,CAAA;KAAC,CAAC;gBACrF,MAAM;iBAAc,MAAM;kBAAe,MAAM;iBAAc,MAAM;qBAC9D,MAAM;uBAAoB,MAAM;YAAS,OAAO;EAuIpE"}
|