@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.
Files changed (256) hide show
  1. package/build/bundle-worker-terrain.js +1 -1
  2. package/package.json +1 -1
  3. package/src/core/binary/BitImage2.d.ts +91 -0
  4. package/src/core/binary/BitImage2.d.ts.map +1 -0
  5. package/src/core/binary/BitImage2.js +242 -0
  6. package/src/core/geom/2d/oriented-box/min_area_rect_2d.d.ts +22 -0
  7. package/src/core/geom/2d/oriented-box/min_area_rect_2d.d.ts.map +1 -0
  8. package/src/core/geom/2d/oriented-box/min_area_rect_2d.js +69 -0
  9. package/src/core/geom/2d/packing/skyline.d.ts +116 -0
  10. package/src/core/geom/2d/packing/skyline.d.ts.map +1 -0
  11. package/src/core/geom/2d/packing/skyline.js +258 -0
  12. package/src/core/geom/2d/triangle/tri2_rasterize_conservative.d.ts +18 -0
  13. package/src/core/geom/2d/triangle/tri2_rasterize_conservative.d.ts.map +1 -0
  14. package/src/core/geom/2d/triangle/tri2_rasterize_conservative.js +86 -0
  15. package/src/core/geom/3d/atlas/ATLAS_PORT_PLAN.md +486 -0
  16. package/src/core/geom/3d/atlas/BFF_PLAN.md +174 -0
  17. package/src/core/geom/3d/atlas/Chart.d.ts +58 -0
  18. package/src/core/geom/3d/atlas/Chart.d.ts.map +1 -0
  19. package/src/core/geom/3d/atlas/Chart.js +77 -0
  20. package/src/core/geom/3d/atlas/REVIEW_02.md +392 -0
  21. package/src/core/geom/3d/atlas/atlas_bench_lib.d.ts +73 -0
  22. package/src/core/geom/3d/atlas/atlas_bench_lib.d.ts.map +1 -0
  23. package/src/core/geom/3d/atlas/atlas_bench_lib.js +315 -0
  24. package/src/core/geom/3d/atlas/atlas_chart_type.d.ts +17 -0
  25. package/src/core/geom/3d/atlas/atlas_chart_type.d.ts.map +1 -0
  26. package/src/core/geom/3d/atlas/atlas_chart_type.js +16 -0
  27. package/src/core/geom/3d/atlas/atlas_compute_charts.d.ts +25 -0
  28. package/src/core/geom/3d/atlas/atlas_compute_charts.d.ts.map +1 -0
  29. package/src/core/geom/3d/atlas/atlas_compute_charts.js +188 -0
  30. package/src/core/geom/3d/atlas/atlas_extract_chart.d.ts +17 -0
  31. package/src/core/geom/3d/atlas/atlas_extract_chart.d.ts.map +1 -0
  32. package/src/core/geom/3d/atlas/atlas_extract_chart.js +107 -0
  33. package/src/core/geom/3d/atlas/atlas_generate.d.ts +39 -0
  34. package/src/core/geom/3d/atlas/atlas_generate.d.ts.map +1 -0
  35. package/src/core/geom/3d/atlas/atlas_generate.js +43 -0
  36. package/src/core/geom/3d/atlas/atlas_test_fixtures.d.ts +84 -0
  37. package/src/core/geom/3d/atlas/atlas_test_fixtures.d.ts.map +1 -0
  38. package/src/core/geom/3d/atlas/atlas_test_fixtures.js +266 -0
  39. package/src/core/geom/3d/atlas/atlas_write_chart_uvs.d.ts +25 -0
  40. package/src/core/geom/3d/atlas/atlas_write_chart_uvs.d.ts.map +1 -0
  41. package/src/core/geom/3d/atlas/atlas_write_chart_uvs.js +36 -0
  42. package/src/core/geom/3d/atlas/data/atlas_build_edge_dihedrals.d.ts +22 -0
  43. package/src/core/geom/3d/atlas/data/atlas_build_edge_dihedrals.d.ts.map +1 -0
  44. package/src/core/geom/3d/atlas/data/atlas_build_edge_dihedrals.js +62 -0
  45. package/src/core/geom/3d/atlas/data/atlas_build_edge_lengths.d.ts +9 -0
  46. package/src/core/geom/3d/atlas/data/atlas_build_edge_lengths.d.ts.map +1 -0
  47. package/src/core/geom/3d/atlas/data/atlas_build_edge_lengths.js +33 -0
  48. package/src/core/geom/3d/atlas/data/atlas_build_face_areas.d.ts +9 -0
  49. package/src/core/geom/3d/atlas/data/atlas_build_face_areas.d.ts.map +1 -0
  50. package/src/core/geom/3d/atlas/data/atlas_build_face_areas.js +50 -0
  51. package/src/core/geom/3d/atlas/io/atlas_mesh_weld_colocals.d.ts +27 -0
  52. package/src/core/geom/3d/atlas/io/atlas_mesh_weld_colocals.d.ts.map +1 -0
  53. package/src/core/geom/3d/atlas/io/atlas_mesh_weld_colocals.js +39 -0
  54. package/src/core/geom/3d/atlas/io/bt_loop_uv.d.ts +22 -0
  55. package/src/core/geom/3d/atlas/io/bt_loop_uv.d.ts.map +1 -0
  56. package/src/core/geom/3d/atlas/io/bt_loop_uv.js +57 -0
  57. package/src/core/geom/3d/atlas/pack/ChartPlacement.d.ts +36 -0
  58. package/src/core/geom/3d/atlas/pack/ChartPlacement.d.ts.map +1 -0
  59. package/src/core/geom/3d/atlas/pack/ChartPlacement.js +46 -0
  60. package/src/core/geom/3d/atlas/pack/atlas_pack_charts.d.ts +62 -0
  61. package/src/core/geom/3d/atlas/pack/atlas_pack_charts.d.ts.map +1 -0
  62. package/src/core/geom/3d/atlas/pack/atlas_pack_charts.js +551 -0
  63. package/src/core/geom/3d/atlas/param/atlas_chart_param_validity.d.ts +22 -0
  64. package/src/core/geom/3d/atlas/param/atlas_chart_param_validity.d.ts.map +1 -0
  65. package/src/core/geom/3d/atlas/param/atlas_chart_param_validity.js +73 -0
  66. package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_bff.d.ts +37 -0
  67. package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_bff.d.ts.map +1 -0
  68. package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_bff.js +270 -0
  69. package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_lscm.d.ts +23 -0
  70. package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_lscm.d.ts.map +1 -0
  71. package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_lscm.js +224 -0
  72. package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_ortho.d.ts +14 -0
  73. package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_ortho.d.ts.map +1 -0
  74. package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_ortho.js +38 -0
  75. package/src/core/geom/3d/atlas/param/atlas_chart_stretch_metric.d.ts +22 -0
  76. package/src/core/geom/3d/atlas/param/atlas_chart_stretch_metric.d.ts.map +1 -0
  77. package/src/core/geom/3d/atlas/param/atlas_chart_stretch_metric.js +86 -0
  78. package/src/core/geom/3d/atlas/param/atlas_piecewise_resegment.d.ts +20 -0
  79. package/src/core/geom/3d/atlas/param/atlas_piecewise_resegment.d.ts.map +1 -0
  80. package/src/core/geom/3d/atlas/param/atlas_piecewise_resegment.js +183 -0
  81. package/src/core/geom/3d/atlas/param/fit_plane_basis.d.ts +27 -0
  82. package/src/core/geom/3d/atlas/param/fit_plane_basis.d.ts.map +1 -0
  83. package/src/core/geom/3d/atlas/param/fit_plane_basis.js +66 -0
  84. package/src/core/geom/3d/atlas/segment/RegionGraph.d.ts +31 -0
  85. package/src/core/geom/3d/atlas/segment/RegionGraph.d.ts.map +1 -0
  86. package/src/core/geom/3d/atlas/segment/RegionGraph.js +40 -0
  87. package/src/core/geom/3d/atlas/segment/atlas_build_region_graph.d.ts +23 -0
  88. package/src/core/geom/3d/atlas/segment/atlas_build_region_graph.d.ts.map +1 -0
  89. package/src/core/geom/3d/atlas/segment/atlas_build_region_graph.js +136 -0
  90. package/src/core/geom/3d/atlas/segment/atlas_compute_planar_regions.d.ts +24 -0
  91. package/src/core/geom/3d/atlas/segment/atlas_compute_planar_regions.d.ts.map +1 -0
  92. package/src/core/geom/3d/atlas/segment/atlas_compute_planar_regions.js +77 -0
  93. package/src/core/geom/3d/atlas/segment/atlas_merge_charts.d.ts +27 -0
  94. package/src/core/geom/3d/atlas/segment/atlas_merge_charts.d.ts.map +1 -0
  95. package/src/core/geom/3d/atlas/segment/atlas_merge_charts.js +113 -0
  96. package/src/core/geom/3d/atlas/segment/atlas_segment_charts.d.ts +44 -0
  97. package/src/core/geom/3d/atlas/segment/atlas_segment_charts.d.ts.map +1 -0
  98. package/src/core/geom/3d/atlas/segment/atlas_segment_charts.js +275 -0
  99. package/src/core/geom/3d/atlas/segment/atlas_segment_charts_atomic.d.ts +22 -0
  100. package/src/core/geom/3d/atlas/segment/atlas_segment_charts_atomic.d.ts.map +1 -0
  101. package/src/core/geom/3d/atlas/segment/atlas_segment_charts_atomic.js +199 -0
  102. package/src/core/geom/3d/line/line3_compute_point_segment_point_distance_unfolded.d.ts +32 -0
  103. package/src/core/geom/3d/line/line3_compute_point_segment_point_distance_unfolded.d.ts.map +1 -0
  104. package/src/core/geom/3d/line/line3_compute_point_segment_point_distance_unfolded.js +64 -0
  105. package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale.d.ts +20 -0
  106. package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale.d.ts.map +1 -0
  107. package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale.js +66 -0
  108. package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.d.ts.map +1 -1
  109. package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js +13 -11
  110. package/src/core/geom/3d/sphere/sphere_compute_bounding_of_2_spheres.d.ts.map +1 -1
  111. package/src/core/geom/3d/sphere/sphere_compute_bounding_of_2_spheres.js +4 -3
  112. package/src/core/geom/3d/topology/simplify/decimate_edge_collapse_snap.d.ts.map +1 -1
  113. package/src/core/geom/3d/topology/simplify/decimate_edge_collapse_snap.js +4 -3
  114. package/src/core/geom/3d/topology/simplify/quadratic/Quadric3.d.ts.map +1 -1
  115. package/src/core/geom/3d/topology/simplify/quadratic/Quadric3.js +4 -3
  116. package/src/core/geom/3d/topology/simplify/quadratic/apply_border_penalty_to_vertex_quadrics.d.ts.map +1 -1
  117. package/src/core/geom/3d/topology/simplify/quadratic/apply_border_penalty_to_vertex_quadrics.js +10 -6
  118. package/src/core/geom/3d/topology/struct/TopoMesh.js +2 -2
  119. package/src/core/geom/3d/topology/struct/TopoTriangle.d.ts +0 -2
  120. package/src/core/geom/3d/topology/struct/TopoTriangle.d.ts.map +1 -1
  121. package/src/core/geom/3d/topology/struct/TopoTriangle.js +2 -2
  122. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.d.ts.map +1 -1
  123. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.js +8 -27
  124. package/src/core/geom/vec3/v3_cotangent.d.ts +20 -0
  125. package/src/core/geom/vec3/v3_cotangent.d.ts.map +1 -0
  126. package/src/core/geom/vec3/v3_cotangent.js +29 -0
  127. package/src/core/geom/vec3/v3_matrix3_multiply.d.ts +19 -0
  128. package/src/core/geom/vec3/v3_matrix3_multiply.d.ts.map +1 -0
  129. package/src/core/geom/vec3/v3_matrix3_multiply.js +30 -0
  130. package/src/core/geom/vec3/v3_multiply.d.ts +16 -0
  131. package/src/core/geom/vec3/v3_multiply.d.ts.map +1 -0
  132. package/src/core/geom/vec3/v3_multiply.js +19 -0
  133. package/src/core/math/linalg/cg/cg_solve.d.ts +24 -0
  134. package/src/core/math/linalg/cg/cg_solve.d.ts.map +1 -0
  135. package/src/core/math/linalg/cg/cg_solve.js +106 -0
  136. package/src/core/math/linalg/cg/cg_solve_normal_equations.d.ts +21 -0
  137. package/src/core/math/linalg/cg/cg_solve_normal_equations.d.ts.map +1 -0
  138. package/src/core/math/linalg/cg/cg_solve_normal_equations.js +59 -0
  139. package/src/core/math/linalg/eigen/matrix_symmetric_3x3_eigen.d.ts +19 -0
  140. package/src/core/math/linalg/eigen/matrix_symmetric_3x3_eigen.d.ts.map +1 -0
  141. package/src/core/math/linalg/eigen/matrix_symmetric_3x3_eigen.js +117 -0
  142. package/src/core/math/linalg/sparse/SparseMatrixCSR.d.ts +50 -0
  143. package/src/core/math/linalg/sparse/SparseMatrixCSR.d.ts.map +1 -0
  144. package/src/core/math/linalg/sparse/SparseMatrixCSR.js +88 -0
  145. package/src/core/math/linalg/sparse/spm_matvec.d.ts +9 -0
  146. package/src/core/math/linalg/sparse/spm_matvec.d.ts.map +1 -0
  147. package/src/core/math/linalg/sparse/spm_matvec.js +22 -0
  148. package/src/core/math/linalg/sparse/spm_matvec_transpose.d.ts +12 -0
  149. package/src/core/math/linalg/sparse/spm_matvec_transpose.d.ts.map +1 -0
  150. package/src/core/math/linalg/sparse/spm_matvec_transpose.js +29 -0
  151. package/src/core/math/physics/mie/MIE_PARTICLES_STANDARD_PRECOMPUTED.d.ts +39 -0
  152. package/src/core/math/physics/mie/MIE_PARTICLES_STANDARD_PRECOMPUTED.js +22 -1
  153. package/src/core/math/physics/mie/compute_mie_particle_properties_rgb.d.ts.map +1 -1
  154. package/src/core/math/physics/mie/compute_mie_particle_properties_rgb.js +32 -9
  155. package/src/core/math/physics/mie/compute_mie_phase.d.ts +2 -3
  156. package/src/core/math/physics/mie/compute_mie_phase.d.ts.map +1 -1
  157. package/src/core/math/physics/mie/compute_mie_phase.js +1 -3
  158. package/src/core/math/physics/mie/lorenz_mie_coefs.d.ts +0 -1
  159. package/src/core/math/physics/mie/lorenz_mie_coefs.d.ts.map +1 -1
  160. package/src/core/math/physics/mie/lorenz_mie_coefs.js +0 -7
  161. package/src/engine/ecs/attachment/TransformAttachmentBinding.js +3 -3
  162. package/src/engine/ecs/gui/hud/HeadsUpDisplaySystem.js +2 -2
  163. package/src/engine/ecs/terrain/ecs/Terrain.d.ts.map +1 -1
  164. package/src/engine/ecs/terrain/ecs/Terrain.js +4 -3
  165. package/src/engine/ecs/terrain/tiles/TerrainTile.js +2 -2
  166. package/src/engine/ecs/terrain/tiles/TerrainTileManager.d.ts.map +1 -1
  167. package/src/engine/ecs/terrain/tiles/TerrainTileManager.js +9 -8
  168. package/src/engine/graphics/GraphicsEngine.d.ts.map +1 -1
  169. package/src/engine/graphics/GraphicsEngine.js +2 -1
  170. package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.js +2 -2
  171. package/src/engine/graphics/ecs/decal/v2/prototypeDecalSystem.js +2 -2
  172. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +2 -2
  173. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.d.ts.map +1 -1
  174. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +0 -1
  175. package/src/engine/graphics/ecs/path/tube/build/computeFrenetFrames.d.ts.map +1 -1
  176. package/src/engine/graphics/ecs/path/tube/build/computeFrenetFrames.js +8 -7
  177. package/src/engine/graphics/geometry/MikkT/AvgTSpace.d.ts.map +1 -1
  178. package/src/engine/graphics/geometry/MikkT/AvgTSpace.js +11 -6
  179. package/src/engine/graphics/geometry/MikkT/BuildNeighborsFast.d.ts.map +1 -1
  180. package/src/engine/graphics/geometry/MikkT/BuildNeighborsFast.js +2 -3
  181. package/src/engine/graphics/geometry/MikkT/CalcTexArea.d.ts.map +1 -1
  182. package/src/engine/graphics/geometry/MikkT/CalcTexArea.js +3 -4
  183. package/src/engine/graphics/geometry/MikkT/DegenEpilogue.js +4 -4
  184. package/src/engine/graphics/geometry/MikkT/EvalTspace.d.ts.map +1 -1
  185. package/src/engine/graphics/geometry/MikkT/EvalTspace.js +11 -8
  186. package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.d.ts.map +1 -1
  187. package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.js +7 -8
  188. package/src/engine/graphics/geometry/MikkT/GenerateTSpaces.js +8 -8
  189. package/src/engine/graphics/geometry/MikkT/InitTriInfo.d.ts.map +1 -1
  190. package/src/engine/graphics/geometry/MikkT/InitTriInfo.js +30 -25
  191. package/src/engine/graphics/geometry/MikkT/MikkTSpace.js +7 -7
  192. package/src/engine/graphics/geometry/MikkT/NormalizeSafe.d.ts +0 -1
  193. package/src/engine/graphics/geometry/MikkT/NormalizeSafe.d.ts.map +1 -1
  194. package/src/engine/graphics/geometry/MikkT/NormalizeSafe.js +6 -4
  195. package/src/engine/graphics/geometry/MikkT/STSpace.d.ts +0 -2
  196. package/src/engine/graphics/geometry/MikkT/STSpace.d.ts.map +1 -1
  197. package/src/engine/graphics/geometry/MikkT/STSpace.js +3 -3
  198. package/src/engine/graphics/geometry/MikkT/v3_scale_dot_sub_normalize.d.ts +0 -2
  199. package/src/engine/graphics/geometry/MikkT/v3_scale_dot_sub_normalize.d.ts.map +1 -1
  200. package/src/engine/graphics/geometry/MikkT/v3_scale_dot_sub_normalize.js +0 -1
  201. package/src/engine/graphics/impostors/octahedral/ImpostorBaker.d.ts +0 -2
  202. package/src/engine/graphics/impostors/octahedral/ImpostorBaker.d.ts.map +1 -1
  203. package/src/engine/graphics/impostors/octahedral/ImpostorBaker.js +4 -3
  204. package/src/engine/graphics/impostors/octahedral/grid/HemiOctahedralUvEncoder.js +2 -2
  205. package/src/engine/graphics/impostors/octahedral/grid/UvEncoder.d.ts +17 -7
  206. package/src/engine/graphics/impostors/voxel/VoxelImpostorBaker.js +2 -2
  207. package/src/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.js +3 -3
  208. package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +4 -3
  209. package/src/engine/graphics/render/forward_plus/LightManager.js +2 -2
  210. package/src/engine/graphics/render/forward_plus/model/Decal.d.ts +0 -2
  211. package/src/engine/graphics/render/forward_plus/model/Decal.d.ts.map +1 -1
  212. package/src/engine/graphics/render/forward_plus/model/Decal.js +3 -3
  213. package/src/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +4 -3
  214. package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +6 -4
  215. package/src/engine/graphics/sh3/lightmap/ARTIFACTS_PLAN.md +146 -0
  216. package/src/engine/graphics/sh3/lightmap/CODE_REVIEW.md +121 -0
  217. package/src/engine/graphics/sh3/lightmap/LIGHTMAPPER_REVIEW.md +183 -0
  218. package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.d.ts +90 -0
  219. package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.d.ts.map +1 -0
  220. package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.js +678 -0
  221. package/src/engine/graphics/sh3/lightmap/lightmap_build_geometry.d.ts +32 -0
  222. package/src/engine/graphics/sh3/lightmap/lightmap_build_geometry.d.ts.map +1 -0
  223. package/src/engine/graphics/sh3/lightmap/lightmap_build_geometry.js +155 -0
  224. package/src/engine/graphics/sh3/lightmap/lightmap_denoise.d.ts +49 -0
  225. package/src/engine/graphics/sh3/lightmap/lightmap_denoise.d.ts.map +1 -0
  226. package/src/engine/graphics/sh3/lightmap/lightmap_denoise.js +136 -0
  227. package/src/engine/graphics/sh3/lightmap/lightmap_dilate.d.ts +19 -0
  228. package/src/engine/graphics/sh3/lightmap/lightmap_dilate.d.ts.map +1 -0
  229. package/src/engine/graphics/sh3/lightmap/lightmap_dilate.js +89 -0
  230. package/src/engine/graphics/sh3/lightmap/lightmap_gather.d.ts +54 -0
  231. package/src/engine/graphics/sh3/lightmap/lightmap_gather.d.ts.map +1 -0
  232. package/src/engine/graphics/sh3/lightmap/lightmap_gather.js +168 -0
  233. package/src/engine/graphics/sh3/lightmap/lightmap_rasterize_triangle.d.ts +30 -0
  234. package/src/engine/graphics/sh3/lightmap/lightmap_rasterize_triangle.d.ts.map +1 -0
  235. package/src/engine/graphics/sh3/lightmap/lightmap_rasterize_triangle.js +145 -0
  236. package/src/engine/graphics/sh3/lightmap/lightmap_seam_fix.d.ts +38 -0
  237. package/src/engine/graphics/sh3/lightmap/lightmap_seam_fix.d.ts.map +1 -0
  238. package/src/engine/graphics/sh3/lightmap/lightmap_seam_fix.js +152 -0
  239. package/src/engine/graphics/sh3/lightmap/prototypeLightmapBaker.d.ts +2 -0
  240. package/src/engine/graphics/sh3/lightmap/prototypeLightmapBaker.d.ts.map +1 -0
  241. package/src/engine/graphics/sh3/lightmap/prototypeLightmapBaker.js +186 -0
  242. package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.d.ts.map +1 -1
  243. package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.js +2 -2
  244. package/src/engine/graphics/sh3/path_tracer/PathTracer.js +2 -2
  245. package/src/engine/graphics/sh3/path_tracer/prepare_scene_gltf.d.ts.map +1 -1
  246. package/src/engine/graphics/sh3/path_tracer/prepare_scene_gltf.js +6 -4
  247. package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +3 -3
  248. package/src/engine/graphics/sh3/path_tracer/texture/sample_material.d.ts.map +1 -1
  249. package/src/engine/graphics/sh3/path_tracer/texture/sample_material.js +5 -4
  250. package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.js +2 -2
  251. package/src/engine/input/devices/KeyboardDevice.d.ts +61 -14
  252. package/src/engine/input/devices/KeyboardDevice.d.ts.map +1 -1
  253. package/src/engine/input/devices/KeyboardDevice.js +41 -15
  254. package/src/engine/input/devices/isHTMLElementFocusable.d.ts.map +1 -1
  255. package/src/engine/input/devices/isHTMLElementFocusable.js +2 -9
  256. package/src/engine/sound/simulation/prototypeAcousticSolver.js +261 -143
@@ -0,0 +1,107 @@
1
+ import { Chart } from "./Chart.js";
2
+
3
+ // Module-static, version-stamped vertex -> chart-local map, reused across calls
4
+ // so each extraction is O(its faces) with no per-chart O(vertices)
5
+ // allocation/fill. `_stamp[v] === _generation` means v is already mapped this
6
+ // call, and `_local[v]` is its chart-local index. Not re-entrant — one
7
+ // extraction at a time (the multi-chart driver calls these sequentially).
8
+ let _stamp = new Int32Array(0);
9
+ let _local = new Int32Array(0);
10
+ let _generation = 0;
11
+
12
+ /**
13
+ * Extract a single chart from a segmented mesh into a {@link Chart} for
14
+ * parameterization and packing (xatlas chart construction). `boundary_edges` is
15
+ * flat pairs of chart-local vertex indices forming the chart outline; `uv` is
16
+ * zero-filled for the solver.
17
+ *
18
+ * @param {BinaryTopology} mesh
19
+ * @param {Int32Array} face_chart from atlas_segment_charts (face -> chart id, -1 if none)
20
+ * @param {number} chart_id
21
+ * @param {number[]} [face_list] the chart's face ids; when omitted they are found
22
+ * by scanning the whole mesh. The multi-chart driver precomputes one bucket per
23
+ * chart so it does not re-scan all faces once per chart (O(charts × faces)).
24
+ * @returns {Chart}
25
+ */
26
+ export function atlas_extract_chart(mesh, face_chart, chart_id, face_list) {
27
+ const faces = mesh.faces;
28
+
29
+ if (face_list === undefined) {
30
+ face_list = [];
31
+ const face_count = faces.size;
32
+ for (let f = 0; f < face_count; f++) {
33
+ if (faces.is_allocated(f) && face_chart[f] === chart_id) {
34
+ face_list.push(f);
35
+ }
36
+ }
37
+ }
38
+
39
+ const vsize = mesh.vertices.size;
40
+ if (_stamp.length < vsize) {
41
+ _stamp = new Int32Array(vsize);
42
+ _local = new Int32Array(vsize);
43
+ }
44
+ _generation++;
45
+ const gen = _generation;
46
+
47
+ const vertex_of_local = [];
48
+ const positions = [];
49
+ const tri_local = [];
50
+ const tri_loops = [];
51
+ const tri_face = [];
52
+ const boundary_edges = [];
53
+
54
+ const scratch = [0, 0, 0];
55
+
56
+ for (const f of face_list) {
57
+ const corners = [0, 0, 0];
58
+ const loops = [0, 0, 0];
59
+
60
+ let l = mesh.face_read_loop(f);
61
+ for (let i = 0; i < 3; i++) {
62
+ const v = mesh.loop_read_vertex(l);
63
+ let lv;
64
+ if (_stamp[v] === gen) {
65
+ lv = _local[v];
66
+ } else {
67
+ lv = vertex_of_local.length;
68
+ _stamp[v] = gen;
69
+ _local[v] = lv;
70
+ vertex_of_local.push(v);
71
+ mesh.vertex_read_coordinate(scratch, 0, v);
72
+ positions.push(scratch[0], scratch[1], scratch[2]);
73
+ }
74
+ corners[i] = lv;
75
+ loops[i] = l;
76
+ l = mesh.loop_read_next(l);
77
+ }
78
+
79
+ tri_local.push(corners[0], corners[1], corners[2]);
80
+ tri_loops.push(loops[0], loops[1], loops[2]);
81
+ tri_face.push(f);
82
+
83
+ // a loop's edge is a chart boundary if its radial neighbour leaves the chart
84
+ for (let i = 0; i < 3; i++) {
85
+ const li = loops[i];
86
+ const opp = mesh.loop_read_radial_next(li);
87
+ const is_boundary = opp === li || face_chart[mesh.loop_read_face(opp)] !== chart_id;
88
+ if (is_boundary) {
89
+ boundary_edges.push(corners[i], corners[(i + 1) % 3]);
90
+ }
91
+ }
92
+ }
93
+
94
+ const vertex_count = vertex_of_local.length;
95
+
96
+ const chart = new Chart();
97
+ chart.vertex_count = vertex_count;
98
+ chart.vertex_of_local = Uint32Array.from(vertex_of_local);
99
+ chart.positions = Float64Array.from(positions);
100
+ chart.triangle_count = tri_face.length;
101
+ chart.tri_local = Uint32Array.from(tri_local);
102
+ chart.tri_loops = Uint32Array.from(tri_loops);
103
+ chart.tri_face = Uint32Array.from(tri_face);
104
+ chart.boundary_edges = Uint32Array.from(boundary_edges);
105
+ chart.uv = new Float64Array(vertex_count * 2);
106
+ return chart;
107
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * One-call UV atlas generation for a single mesh: segment it into charts,
3
+ * parameterize each, pack them into one atlas, then actualize the packed
4
+ * per-corner UVs onto the mesh via {@link atlas_write_chart_uvs} — the meep
5
+ * equivalent of running xatlas `ComputeCharts` then `PackCharts`. Neither
6
+ * {@link atlas_compute_charts} nor {@link atlas_pack_charts} touches the mesh's
7
+ * loop UVs; this convenience entry point performs that final write itself, so the
8
+ * UVs land in the loop_data channel ({@link bt_loop_read_uv}). The returned charts
9
+ * also carry their final atlas-space UVs and placement.
10
+ *
11
+ * To atlas several meshes into one shared atlas, drive the steps directly:
12
+ * {@link atlas_compute_charts} per mesh, {@link atlas_pack_charts} on the
13
+ * combined charts, then {@link atlas_write_chart_uvs} once per source mesh.
14
+ *
15
+ * @param {BinaryTopology} mesh mutated in place (weld, normals, loop UVs)
16
+ * @param {object} [options]
17
+ * @param {boolean} [options.weld] colocal-weld first (default true)
18
+ * @param {object} [options.segment] atlas_segment_charts overrides
19
+ * @param {object} [options.lscm] atlas_chart_parameterize_lscm overrides
20
+ * @param {object} [options.pack] atlas_pack_charts overrides (padding, resolution, texelsPerUnit)
21
+ * @returns {{charts:Chart[], chart_count:number, atlas_width:number,
22
+ * atlas_height:number, utilization:number, occupied_texels:number,
23
+ * mask_texels_total:number}}
24
+ */
25
+ export function atlas_generate(mesh: BinaryTopology, options?: {
26
+ weld?: boolean;
27
+ segment?: object;
28
+ lscm?: object;
29
+ pack?: object;
30
+ }): {
31
+ charts: Chart[];
32
+ chart_count: number;
33
+ atlas_width: number;
34
+ atlas_height: number;
35
+ utilization: number;
36
+ occupied_texels: number;
37
+ mask_texels_total: number;
38
+ };
39
+ //# sourceMappingURL=atlas_generate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"atlas_generate.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/atlas/atlas_generate.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;IAR6B,IAAI,GAAtB,OAAO;IACU,OAAO,GAAxB,MAAM;IACW,IAAI,GAArB,MAAM;IACW,IAAI,GAArB,MAAM;IACJ;IAAC,MAAM,EAAC,OAAO,CAAC;IAAC,WAAW,EAAC,MAAM,CAAC;IAAC,WAAW,EAAC,MAAM,CAAC;IACpE,YAAgB,EAAC,MAAM,CAAC;IAAC,WAAW,EAAC,MAAM,CAAC;IAAC,eAAe,EAAC,MAAM,CAAC;IACpE,iBAAqB,EAAC,MAAM,CAAA;CAAC,CAgB7B"}
@@ -0,0 +1,43 @@
1
+ import { atlas_compute_charts } from "./atlas_compute_charts.js";
2
+ import { atlas_write_chart_uvs } from "./atlas_write_chart_uvs.js";
3
+ import { atlas_pack_charts } from "./pack/atlas_pack_charts.js";
4
+
5
+ /**
6
+ * One-call UV atlas generation for a single mesh: segment it into charts,
7
+ * parameterize each, pack them into one atlas, then actualize the packed
8
+ * per-corner UVs onto the mesh via {@link atlas_write_chart_uvs} — the meep
9
+ * equivalent of running xatlas `ComputeCharts` then `PackCharts`. Neither
10
+ * {@link atlas_compute_charts} nor {@link atlas_pack_charts} touches the mesh's
11
+ * loop UVs; this convenience entry point performs that final write itself, so the
12
+ * UVs land in the loop_data channel ({@link bt_loop_read_uv}). The returned charts
13
+ * also carry their final atlas-space UVs and placement.
14
+ *
15
+ * To atlas several meshes into one shared atlas, drive the steps directly:
16
+ * {@link atlas_compute_charts} per mesh, {@link atlas_pack_charts} on the
17
+ * combined charts, then {@link atlas_write_chart_uvs} once per source mesh.
18
+ *
19
+ * @param {BinaryTopology} mesh mutated in place (weld, normals, loop UVs)
20
+ * @param {object} [options]
21
+ * @param {boolean} [options.weld] colocal-weld first (default true)
22
+ * @param {object} [options.segment] atlas_segment_charts overrides
23
+ * @param {object} [options.lscm] atlas_chart_parameterize_lscm overrides
24
+ * @param {object} [options.pack] atlas_pack_charts overrides (padding, resolution, texelsPerUnit)
25
+ * @returns {{charts:Chart[], chart_count:number, atlas_width:number,
26
+ * atlas_height:number, utilization:number, occupied_texels:number,
27
+ * mask_texels_total:number}}
28
+ */
29
+ export function atlas_generate(mesh, options = {}) {
30
+ const computed = atlas_compute_charts(mesh, options);
31
+ const packed = atlas_pack_charts(computed.charts, options.pack);
32
+ atlas_write_chart_uvs(mesh, computed.charts);
33
+
34
+ return {
35
+ charts: computed.charts,
36
+ chart_count: computed.chart_count,
37
+ atlas_width: packed.atlas_width,
38
+ atlas_height: packed.atlas_height,
39
+ utilization: packed.utilization,
40
+ occupied_texels: packed.occupied_texels,
41
+ mask_texels_total: packed.mask_texels_total,
42
+ };
43
+ }
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Shared inline mesh fixtures for the atlas test suites. Each builder returns a
3
+ * fresh {@link BinaryTopology} with face normals computed. Test-only — not
4
+ * imported by production code.
5
+ */
6
+ /**
7
+ * @param {number[]} indices
8
+ * @param {number[]} positions flat xyz
9
+ * @returns {BinaryTopology}
10
+ */
11
+ export function atlas_make_mesh(indices: number[], positions: number[]): BinaryTopology;
12
+ /**
13
+ * Unit square in the z=0 plane, two triangles sharing the 0-2 diagonal.
14
+ *
15
+ * @returns {BinaryTopology}
16
+ */
17
+ export function atlas_build_unit_quad(): BinaryTopology;
18
+ /**
19
+ * Two triangles sharing edge (0,1), folded to a 90 degree dihedral.
20
+ *
21
+ * @returns {BinaryTopology}
22
+ */
23
+ export function atlas_build_folded_pair(): BinaryTopology;
24
+ /**
25
+ * The unit quad, but the two triangles use SEPARATE vertex indices at the
26
+ * shared diagonal (coincident positions, distinct ids). Before welding the two
27
+ * triangles are two islands; after welding they share the diagonal edge.
28
+ *
29
+ * @returns {BinaryTopology}
30
+ */
31
+ export function atlas_build_split_quad(): BinaryTopology;
32
+ /**
33
+ * An open ribbon of `segments` quads bent around an arc of `total_angle`
34
+ * radians, so face normals fan out radially. Drives curvature-based chart
35
+ * splitting. Connected, single island, boundary on all four sides.
36
+ *
37
+ * @param {number} segments
38
+ * @param {number} total_angle radians swept across the ribbon
39
+ * @returns {BinaryTopology}
40
+ */
41
+ export function atlas_build_curved_ribbon(segments: number, total_angle: number): BinaryTopology;
42
+ /**
43
+ * Flat n×n grid of quads in the z=0 plane (2·n·n coplanar triangles). All faces
44
+ * share one normal, so they collapse to a single planar region — the canonical
45
+ * region-atomic case.
46
+ *
47
+ * @param {number} n cells per side
48
+ * @returns {BinaryTopology}
49
+ */
50
+ export function atlas_build_grid_plane(n: number): BinaryTopology;
51
+ /**
52
+ * A good quad plus three deliberately degenerate triangles (each its own
53
+ * island): a collinear zero-area triangle, a coincident-vertex "needle" (two
54
+ * vertices at the same position), and a near-collinear sliver. Real exported /
55
+ * scanned meshes contain these; the pipeline must stay finite and not crash.
56
+ * Use with `weld: false` so the needle's coincident vertices stay distinct.
57
+ *
58
+ * @returns {BinaryTopology}
59
+ */
60
+ export function atlas_build_degenerate_mix(): BinaryTopology;
61
+ /**
62
+ * Unit UV sphere with `rings` latitude bands and `sectors` longitude segments,
63
+ * shared vertices (pole fans + modulo longitude wrap), consistent winding. A
64
+ * smooth closed surface for testing curvature-driven segmentation.
65
+ *
66
+ * @param {number} rings latitude bands (>= 2)
67
+ * @param {number} sectors longitude segments (>= 3)
68
+ * @returns {BinaryTopology}
69
+ */
70
+ export function atlas_build_uv_sphere(rings: number, sectors: number): BinaryTopology;
71
+ /**
72
+ * Regular octahedron: a closed surface of 8 triangles, outward winding.
73
+ *
74
+ * @returns {BinaryTopology}
75
+ */
76
+ export function atlas_build_octahedron(): BinaryTopology;
77
+ /**
78
+ * Axis-aligned unit cube, 12 triangles, consistent outward winding.
79
+ *
80
+ * @returns {BinaryTopology}
81
+ */
82
+ export function atlas_build_unit_cube(): BinaryTopology;
83
+ import { BinaryTopology } from "../topology/struct/binary/BinaryTopology.js";
84
+ //# sourceMappingURL=atlas_test_fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"atlas_test_fixtures.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/atlas/atlas_test_fixtures.js"],"names":[],"mappings":"AAIA;;;;GAIG;AAEH;;;;GAIG;AACH,yCAJW,MAAM,EAAE,aACR,MAAM,EAAE,GACN,cAAc,CAO1B;AAED;;;;GAIG;AACH,yCAFa,cAAc,CAY1B;AAED;;;;GAIG;AACH,2CAFa,cAAc,CAY1B;AAED;;;;;;GAMG;AACH,0CAFa,cAAc,CAc1B;AAED;;;;;;;;GAQG;AACH,oDAJW,MAAM,eACN,MAAM,GACJ,cAAc,CAsB1B;AAED;;;;;;;GAOG;AACH,0CAHW,MAAM,GACJ,cAAc,CAuB1B;AAED;;;;;;;;GAQG;AACH,8CAFa,cAAc,CA0B1B;AAED;;;;;;;;GAQG;AACH,6CAJW,MAAM,WACN,MAAM,GACJ,cAAc,CAkC1B;AAED;;;;GAIG;AACH,0CAFa,cAAc,CAiB1B;AAED;;;;GAIG;AACH,yCAFa,cAAc,CAuB1B;+BAzQ8B,6CAA6C"}
@@ -0,0 +1,266 @@
1
+ import { BinaryTopology } from "../topology/struct/binary/BinaryTopology.js";
2
+ import { bt_mesh_compute_face_normals } from "../topology/struct/binary/io/bt_mesh_compute_face_normals.js";
3
+ import { bt_mesh_from_indexed_geometry } from "../topology/struct/binary/io/bt_mesh_from_indexed_geometry.js";
4
+
5
+ /**
6
+ * Shared inline mesh fixtures for the atlas test suites. Each builder returns a
7
+ * fresh {@link BinaryTopology} with face normals computed. Test-only — not
8
+ * imported by production code.
9
+ */
10
+
11
+ /**
12
+ * @param {number[]} indices
13
+ * @param {number[]} positions flat xyz
14
+ * @returns {BinaryTopology}
15
+ */
16
+ export function atlas_make_mesh(indices, positions) {
17
+ const mesh = new BinaryTopology();
18
+ bt_mesh_from_indexed_geometry(mesh, indices, positions);
19
+ bt_mesh_compute_face_normals(mesh);
20
+ return mesh;
21
+ }
22
+
23
+ /**
24
+ * Unit square in the z=0 plane, two triangles sharing the 0-2 diagonal.
25
+ *
26
+ * @returns {BinaryTopology}
27
+ */
28
+ export function atlas_build_unit_quad() {
29
+ return atlas_make_mesh(
30
+ [0, 1, 2, 0, 2, 3],
31
+ [
32
+ 0, 0, 0,
33
+ 1, 0, 0,
34
+ 1, 1, 0,
35
+ 0, 1, 0,
36
+ ]
37
+ );
38
+ }
39
+
40
+ /**
41
+ * Two triangles sharing edge (0,1), folded to a 90 degree dihedral.
42
+ *
43
+ * @returns {BinaryTopology}
44
+ */
45
+ export function atlas_build_folded_pair() {
46
+ return atlas_make_mesh(
47
+ [0, 1, 2, 0, 3, 1],
48
+ [
49
+ 0, 0, 0,
50
+ 1, 0, 0,
51
+ 0, 1, 0,
52
+ 0, 0, 1,
53
+ ]
54
+ );
55
+ }
56
+
57
+ /**
58
+ * The unit quad, but the two triangles use SEPARATE vertex indices at the
59
+ * shared diagonal (coincident positions, distinct ids). Before welding the two
60
+ * triangles are two islands; after welding they share the diagonal edge.
61
+ *
62
+ * @returns {BinaryTopology}
63
+ */
64
+ export function atlas_build_split_quad() {
65
+ return atlas_make_mesh(
66
+ [0, 1, 2, 3, 4, 5],
67
+ [
68
+ 0, 0, 0,
69
+ 1, 0, 0,
70
+ 1, 1, 0,
71
+ 0, 0, 0, // duplicate of vertex 0
72
+ 1, 1, 0, // duplicate of vertex 2
73
+ 0, 1, 0,
74
+ ]
75
+ );
76
+ }
77
+
78
+ /**
79
+ * An open ribbon of `segments` quads bent around an arc of `total_angle`
80
+ * radians, so face normals fan out radially. Drives curvature-based chart
81
+ * splitting. Connected, single island, boundary on all four sides.
82
+ *
83
+ * @param {number} segments
84
+ * @param {number} total_angle radians swept across the ribbon
85
+ * @returns {BinaryTopology}
86
+ */
87
+ export function atlas_build_curved_ribbon(segments, total_angle) {
88
+ const positions = [];
89
+ const N = segments;
90
+ // bottom ring at z=0 (indices 0..N), top ring at z=1 (indices N+1..2N+1)
91
+ for (let j = 0; j <= N; j++) {
92
+ const a = (j / N) * total_angle;
93
+ positions.push(Math.cos(a), Math.sin(a), 0);
94
+ }
95
+ for (let j = 0; j <= N; j++) {
96
+ const a = (j / N) * total_angle;
97
+ positions.push(Math.cos(a), Math.sin(a), 1);
98
+ }
99
+
100
+ const top = N + 1;
101
+ const indices = [];
102
+ for (let j = 0; j < N; j++) {
103
+ indices.push(j, j + 1, top + j + 1);
104
+ indices.push(j, top + j + 1, top + j);
105
+ }
106
+ return atlas_make_mesh(indices, positions);
107
+ }
108
+
109
+ /**
110
+ * Flat n×n grid of quads in the z=0 plane (2·n·n coplanar triangles). All faces
111
+ * share one normal, so they collapse to a single planar region — the canonical
112
+ * region-atomic case.
113
+ *
114
+ * @param {number} n cells per side
115
+ * @returns {BinaryTopology}
116
+ */
117
+ export function atlas_build_grid_plane(n) {
118
+ const positions = [];
119
+ for (let j = 0; j <= n; j++) {
120
+ for (let i = 0; i <= n; i++) {
121
+ positions.push(i / n, j / n, 0);
122
+ }
123
+ }
124
+ /**
125
+ * @param {number} i column index
126
+ * @param {number} j row index
127
+ * @returns {number} flat vertex id in the (n+1)×(n+1) grid
128
+ */
129
+ const idx = (i, j) => j * (n + 1) + i;
130
+ const indices = [];
131
+ for (let j = 0; j < n; j++) {
132
+ for (let i = 0; i < n; i++) {
133
+ const a = idx(i, j), b = idx(i + 1, j), c = idx(i + 1, j + 1), d = idx(i, j + 1);
134
+ indices.push(a, b, c, a, c, d);
135
+ }
136
+ }
137
+ return atlas_make_mesh(indices, positions);
138
+ }
139
+
140
+ /**
141
+ * A good quad plus three deliberately degenerate triangles (each its own
142
+ * island): a collinear zero-area triangle, a coincident-vertex "needle" (two
143
+ * vertices at the same position), and a near-collinear sliver. Real exported /
144
+ * scanned meshes contain these; the pipeline must stay finite and not crash.
145
+ * Use with `weld: false` so the needle's coincident vertices stay distinct.
146
+ *
147
+ * @returns {BinaryTopology}
148
+ */
149
+ export function atlas_build_degenerate_mix() {
150
+ return atlas_make_mesh(
151
+ [
152
+ 0, 1, 2, 0, 2, 3, // good unit quad
153
+ 4, 5, 6, // collinear -> exactly zero area
154
+ 7, 8, 9, // needle: vertices 7 and 8 coincide -> zero area
155
+ 10, 11, 12, // near-collinear -> tiny-area sliver
156
+ ],
157
+ [
158
+ 0, 0, 0, // 0
159
+ 1, 0, 0, // 1
160
+ 1, 1, 0, // 2
161
+ 0, 1, 0, // 3
162
+ 2, 0, 0, // 4
163
+ 3, 0, 0, // 5 (4,5,6 collinear on y=0)
164
+ 4, 0, 0, // 6
165
+ 2, 2, 0, // 7
166
+ 2, 2, 0, // 8 coincident with 7
167
+ 3, 2, 0, // 9
168
+ 2, 3, 0, // 10
169
+ 4, 3, 0, // 11
170
+ 3, 3.0001, 0, // 12 just off the 10-11 line -> sliver
171
+ ]
172
+ );
173
+ }
174
+
175
+ /**
176
+ * Unit UV sphere with `rings` latitude bands and `sectors` longitude segments,
177
+ * shared vertices (pole fans + modulo longitude wrap), consistent winding. A
178
+ * smooth closed surface for testing curvature-driven segmentation.
179
+ *
180
+ * @param {number} rings latitude bands (>= 2)
181
+ * @param {number} sectors longitude segments (>= 3)
182
+ * @returns {BinaryTopology}
183
+ */
184
+ export function atlas_build_uv_sphere(rings, sectors) {
185
+ const positions = [];
186
+ positions.push(0, 1, 0); // 0: north pole (latitude band 0)
187
+ positions.push(0, -1, 0); // 1: south pole (latitude band `rings`)
188
+ for (let i = 1; i < rings; i++) {
189
+ const phi = (i / rings) * Math.PI;
190
+ const y = Math.cos(phi);
191
+ const r = Math.sin(phi);
192
+ for (let s = 0; s < sectors; s++) {
193
+ const theta = (s / sectors) * 2 * Math.PI;
194
+ positions.push(r * Math.cos(theta), y, r * Math.sin(theta));
195
+ }
196
+ }
197
+
198
+ const vid = (i, s) => {
199
+ if (i === 0) return 0;
200
+ if (i === rings) return 1;
201
+ return 2 + (i - 1) * sectors + (s % sectors);
202
+ };
203
+
204
+ const indices = [];
205
+ const tri = (a, b, c) => {
206
+ if (a !== b && b !== c && a !== c) indices.push(a, b, c);
207
+ };
208
+ for (let i = 0; i < rings; i++) {
209
+ for (let s = 0; s < sectors; s++) {
210
+ const v00 = vid(i, s), v01 = vid(i, s + 1), v10 = vid(i + 1, s), v11 = vid(i + 1, s + 1);
211
+ tri(v00, v10, v11);
212
+ tri(v00, v11, v01);
213
+ }
214
+ }
215
+ return atlas_make_mesh(indices, positions);
216
+ }
217
+
218
+ /**
219
+ * Regular octahedron: a closed surface of 8 triangles, outward winding.
220
+ *
221
+ * @returns {BinaryTopology}
222
+ */
223
+ export function atlas_build_octahedron() {
224
+ return atlas_make_mesh(
225
+ [
226
+ 4, 0, 2, 4, 2, 1, 4, 1, 3, 4, 3, 0, // top (+z apex)
227
+ 5, 2, 0, 5, 1, 2, 5, 3, 1, 5, 0, 3, // bottom (-z apex)
228
+ ],
229
+ [
230
+ 1, 0, 0,
231
+ -1, 0, 0,
232
+ 0, 1, 0,
233
+ 0, -1, 0,
234
+ 0, 0, 1,
235
+ 0, 0, -1,
236
+ ]
237
+ );
238
+ }
239
+
240
+ /**
241
+ * Axis-aligned unit cube, 12 triangles, consistent outward winding.
242
+ *
243
+ * @returns {BinaryTopology}
244
+ */
245
+ export function atlas_build_unit_cube() {
246
+ return atlas_make_mesh(
247
+ [
248
+ 0, 1, 5, 0, 5, 4, // front (-y)
249
+ 1, 2, 6, 1, 6, 5, // right (+x)
250
+ 2, 3, 7, 2, 7, 6, // back (+y)
251
+ 3, 0, 4, 3, 4, 7, // left (-x)
252
+ 3, 2, 1, 3, 1, 0, // bottom (-z)
253
+ 4, 5, 6, 4, 6, 7, // top (+z)
254
+ ],
255
+ [
256
+ 0, 0, 0,
257
+ 1, 0, 0,
258
+ 1, 1, 0,
259
+ 0, 1, 0,
260
+ 0, 0, 1,
261
+ 1, 0, 1,
262
+ 1, 1, 1,
263
+ 0, 1, 1,
264
+ ]
265
+ );
266
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Actualize chart UVs into a mesh's per-corner loop_data channel — the final,
3
+ * explicit step of the atlas pipeline.
4
+ *
5
+ * The pipeline works at the {@link Chart} level: {@link atlas_compute_charts}
6
+ * produces charts and {@link atlas_pack_charts} mutates each chart's `uv` in
7
+ * place (to packed atlas-space coordinates). Writing those UVs back onto a mesh
8
+ * is deliberately a separate call the caller controls, so charts from several
9
+ * meshes can be packed into one atlas and then actualized independently — invoke
10
+ * this once per source mesh with that mesh's own charts.
11
+ *
12
+ * `chart.tri_loops` index loops in `mesh`, so every chart passed here must have
13
+ * been computed from `mesh` (via {@link atlas_compute_charts} on it). Whatever is
14
+ * currently in each `chart.uv` is written, so call this after packing for final
15
+ * atlas UVs (or after compute alone for the unpacked, per-chart UVs).
16
+ *
17
+ * Note: the loop_data channel is float32, so `chart.uv` (f64) is quantized to f32
18
+ * precision on write.
19
+ *
20
+ * @param {BinaryTopology} mesh receives the per-corner UVs (loop_data is initialized if absent)
21
+ * @param {Chart[]} charts charts originating from `mesh`
22
+ * @returns {void}
23
+ */
24
+ export function atlas_write_chart_uvs(mesh: BinaryTopology, charts: Chart[]): void;
25
+ //# sourceMappingURL=atlas_write_chart_uvs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"atlas_write_chart_uvs.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/atlas/atlas_write_chart_uvs.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,oEAHW,OAAO,GACL,IAAI,CAYhB"}
@@ -0,0 +1,36 @@
1
+ import { bt_loop_uv_init, bt_loop_write_uv } from "./io/bt_loop_uv.js";
2
+
3
+ /**
4
+ * Actualize chart UVs into a mesh's per-corner loop_data channel — the final,
5
+ * explicit step of the atlas pipeline.
6
+ *
7
+ * The pipeline works at the {@link Chart} level: {@link atlas_compute_charts}
8
+ * produces charts and {@link atlas_pack_charts} mutates each chart's `uv` in
9
+ * place (to packed atlas-space coordinates). Writing those UVs back onto a mesh
10
+ * is deliberately a separate call the caller controls, so charts from several
11
+ * meshes can be packed into one atlas and then actualized independently — invoke
12
+ * this once per source mesh with that mesh's own charts.
13
+ *
14
+ * `chart.tri_loops` index loops in `mesh`, so every chart passed here must have
15
+ * been computed from `mesh` (via {@link atlas_compute_charts} on it). Whatever is
16
+ * currently in each `chart.uv` is written, so call this after packing for final
17
+ * atlas UVs (or after compute alone for the unpacked, per-chart UVs).
18
+ *
19
+ * Note: the loop_data channel is float32, so `chart.uv` (f64) is quantized to f32
20
+ * precision on write.
21
+ *
22
+ * @param {BinaryTopology} mesh receives the per-corner UVs (loop_data is initialized if absent)
23
+ * @param {Chart[]} charts charts originating from `mesh`
24
+ * @returns {void}
25
+ */
26
+ export function atlas_write_chart_uvs(mesh, charts) {
27
+ bt_loop_uv_init(mesh);
28
+ for (const chart of charts) {
29
+ for (let t = 0; t < chart.triangle_count; t++) {
30
+ for (let i = 0; i < 3; i++) {
31
+ const lv = chart.tri_local[t * 3 + i];
32
+ bt_loop_write_uv(mesh, chart.tri_loops[t * 3 + i], chart.uv[lv * 2], chart.uv[lv * 2 + 1]);
33
+ }
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Per-edge dihedral measure: the dot product of the two adjacent (unit) face
3
+ * normals. 1 = coplanar/flat, 0 = 90 degree fold, -1 = fully folded back.
4
+ * Boundary/wire/unallocated edges get {@link EDGE_DIHEDRAL_BOUNDARY}.
5
+ *
6
+ * For a non-manifold edge (>2 incident faces) the first radial pair is used.
7
+ *
8
+ * Precondition: face normals are populated (call
9
+ * {@link bt_mesh_compute_face_normals} first).
10
+ *
11
+ * @param {BinaryTopology} mesh
12
+ * @returns {Float32Array} length mesh.edges.size
13
+ */
14
+ export function atlas_build_edge_dihedrals(mesh: BinaryTopology): Float32Array;
15
+ /**
16
+ * Sentinel value for an edge that does not have two adjacent faces (mesh
17
+ * boundary, wire edge, or unallocated). Chosen outside the valid cosine range
18
+ * [-1, 1] so it is unambiguous. xatlas uses FLT_MAX for the same purpose.
19
+ * @type {number}
20
+ */
21
+ export const EDGE_DIHEDRAL_BOUNDARY: number;
22
+ //# sourceMappingURL=atlas_build_edge_dihedrals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"atlas_build_edge_dihedrals.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/atlas/data/atlas_build_edge_dihedrals.js"],"names":[],"mappings":"AAcA;;;;;;;;;;;;GAYG;AACH,kEAFa,YAAY,CAoCxB;AA1DD;;;;;GAKG;AACH,qCAFU,MAAM,CAEwB"}