@woosh/meep-engine 2.164.0 → 2.165.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (451) hide show
  1. package/README.md +137 -108
  2. package/build/bundle-worker-image-decoder.js +1 -1
  3. package/build/bundle-worker-terrain.js +1 -1
  4. package/package.json +1 -1
  5. package/samples/generation/SampleGenerator0.js +3 -3
  6. package/samples/generation/filters/SampleGroundMoistureFilter.js +63 -56
  7. package/samples/generation/filters/SampleNoise20_0.js +6 -1
  8. package/samples/generation/themes/SampleTheme0.js +47 -47
  9. package/src/core/binary/BitImage2.d.ts +91 -0
  10. package/src/core/binary/BitImage2.d.ts.map +1 -0
  11. package/src/core/binary/BitImage2.js +242 -0
  12. package/src/core/color/YCoCg/rgb_to_ycocg.d.ts +17 -0
  13. package/src/core/color/YCoCg/rgb_to_ycocg.d.ts.map +1 -0
  14. package/src/core/color/YCoCg/rgb_to_ycocg.js +20 -0
  15. package/src/core/color/YCoCg/ycocg_to_rgb.d.ts +14 -0
  16. package/src/core/color/YCoCg/ycocg_to_rgb.d.ts.map +1 -0
  17. package/src/core/color/YCoCg/ycocg_to_rgb.js +17 -0
  18. package/src/core/geom/2d/oriented-box/min_area_rect_2d.d.ts +22 -0
  19. package/src/core/geom/2d/oriented-box/min_area_rect_2d.d.ts.map +1 -0
  20. package/src/core/geom/2d/oriented-box/min_area_rect_2d.js +69 -0
  21. package/src/core/geom/2d/packing/skyline.d.ts +116 -0
  22. package/src/core/geom/2d/packing/skyline.d.ts.map +1 -0
  23. package/src/core/geom/2d/packing/skyline.js +258 -0
  24. package/src/core/geom/2d/triangle/tri2_rasterize_conservative.d.ts +18 -0
  25. package/src/core/geom/2d/triangle/tri2_rasterize_conservative.d.ts.map +1 -0
  26. package/src/core/geom/2d/triangle/tri2_rasterize_conservative.js +86 -0
  27. package/src/core/geom/3d/atlas/ATLAS_PORT_PLAN.md +486 -0
  28. package/src/core/geom/3d/atlas/BFF_PLAN.md +174 -0
  29. package/src/core/geom/3d/atlas/Chart.d.ts +58 -0
  30. package/src/core/geom/3d/atlas/Chart.d.ts.map +1 -0
  31. package/src/core/geom/3d/atlas/Chart.js +77 -0
  32. package/src/core/geom/3d/atlas/REVIEW_02.md +392 -0
  33. package/src/core/geom/3d/atlas/atlas_bench_lib.d.ts +73 -0
  34. package/src/core/geom/3d/atlas/atlas_bench_lib.d.ts.map +1 -0
  35. package/src/core/geom/3d/atlas/atlas_bench_lib.js +315 -0
  36. package/src/core/geom/3d/atlas/atlas_chart_type.d.ts +17 -0
  37. package/src/core/geom/3d/atlas/atlas_chart_type.d.ts.map +1 -0
  38. package/src/core/geom/3d/atlas/atlas_chart_type.js +16 -0
  39. package/src/core/geom/3d/atlas/atlas_compute_charts.d.ts +25 -0
  40. package/src/core/geom/3d/atlas/atlas_compute_charts.d.ts.map +1 -0
  41. package/src/core/geom/3d/atlas/atlas_compute_charts.js +188 -0
  42. package/src/core/geom/3d/atlas/atlas_extract_chart.d.ts +17 -0
  43. package/src/core/geom/3d/atlas/atlas_extract_chart.d.ts.map +1 -0
  44. package/src/core/geom/3d/atlas/atlas_extract_chart.js +107 -0
  45. package/src/core/geom/3d/atlas/atlas_generate.d.ts +39 -0
  46. package/src/core/geom/3d/atlas/atlas_generate.d.ts.map +1 -0
  47. package/src/core/geom/3d/atlas/atlas_generate.js +43 -0
  48. package/src/core/geom/3d/atlas/atlas_test_fixtures.d.ts +84 -0
  49. package/src/core/geom/3d/atlas/atlas_test_fixtures.d.ts.map +1 -0
  50. package/src/core/geom/3d/atlas/atlas_test_fixtures.js +266 -0
  51. package/src/core/geom/3d/atlas/atlas_write_chart_uvs.d.ts +25 -0
  52. package/src/core/geom/3d/atlas/atlas_write_chart_uvs.d.ts.map +1 -0
  53. package/src/core/geom/3d/atlas/atlas_write_chart_uvs.js +36 -0
  54. package/src/core/geom/3d/atlas/data/atlas_build_edge_dihedrals.d.ts +22 -0
  55. package/src/core/geom/3d/atlas/data/atlas_build_edge_dihedrals.d.ts.map +1 -0
  56. package/src/core/geom/3d/atlas/data/atlas_build_edge_dihedrals.js +62 -0
  57. package/src/core/geom/3d/atlas/data/atlas_build_edge_lengths.d.ts +9 -0
  58. package/src/core/geom/3d/atlas/data/atlas_build_edge_lengths.d.ts.map +1 -0
  59. package/src/core/geom/3d/atlas/data/atlas_build_edge_lengths.js +33 -0
  60. package/src/core/geom/3d/atlas/data/atlas_build_face_areas.d.ts +9 -0
  61. package/src/core/geom/3d/atlas/data/atlas_build_face_areas.d.ts.map +1 -0
  62. package/src/core/geom/3d/atlas/data/atlas_build_face_areas.js +50 -0
  63. package/src/core/geom/3d/atlas/io/atlas_mesh_weld_colocals.d.ts +27 -0
  64. package/src/core/geom/3d/atlas/io/atlas_mesh_weld_colocals.d.ts.map +1 -0
  65. package/src/core/geom/3d/atlas/io/atlas_mesh_weld_colocals.js +39 -0
  66. package/src/core/geom/3d/atlas/io/bt_loop_uv.d.ts +22 -0
  67. package/src/core/geom/3d/atlas/io/bt_loop_uv.d.ts.map +1 -0
  68. package/src/core/geom/3d/atlas/io/bt_loop_uv.js +57 -0
  69. package/src/core/geom/3d/atlas/pack/ChartPlacement.d.ts +36 -0
  70. package/src/core/geom/3d/atlas/pack/ChartPlacement.d.ts.map +1 -0
  71. package/src/core/geom/3d/atlas/pack/ChartPlacement.js +46 -0
  72. package/src/core/geom/3d/atlas/pack/atlas_pack_charts.d.ts +62 -0
  73. package/src/core/geom/3d/atlas/pack/atlas_pack_charts.d.ts.map +1 -0
  74. package/src/core/geom/3d/atlas/pack/atlas_pack_charts.js +551 -0
  75. package/src/core/geom/3d/atlas/param/atlas_chart_param_validity.d.ts +22 -0
  76. package/src/core/geom/3d/atlas/param/atlas_chart_param_validity.d.ts.map +1 -0
  77. package/src/core/geom/3d/atlas/param/atlas_chart_param_validity.js +73 -0
  78. package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_bff.d.ts +37 -0
  79. package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_bff.d.ts.map +1 -0
  80. package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_bff.js +270 -0
  81. package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_lscm.d.ts +23 -0
  82. package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_lscm.d.ts.map +1 -0
  83. package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_lscm.js +224 -0
  84. package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_ortho.d.ts +14 -0
  85. package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_ortho.d.ts.map +1 -0
  86. package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_ortho.js +38 -0
  87. package/src/core/geom/3d/atlas/param/atlas_chart_stretch_metric.d.ts +22 -0
  88. package/src/core/geom/3d/atlas/param/atlas_chart_stretch_metric.d.ts.map +1 -0
  89. package/src/core/geom/3d/atlas/param/atlas_chart_stretch_metric.js +86 -0
  90. package/src/core/geom/3d/atlas/param/atlas_piecewise_resegment.d.ts +20 -0
  91. package/src/core/geom/3d/atlas/param/atlas_piecewise_resegment.d.ts.map +1 -0
  92. package/src/core/geom/3d/atlas/param/atlas_piecewise_resegment.js +183 -0
  93. package/src/core/geom/3d/atlas/param/fit_plane_basis.d.ts +27 -0
  94. package/src/core/geom/3d/atlas/param/fit_plane_basis.d.ts.map +1 -0
  95. package/src/core/geom/3d/atlas/param/fit_plane_basis.js +66 -0
  96. package/src/core/geom/3d/atlas/segment/RegionGraph.d.ts +31 -0
  97. package/src/core/geom/3d/atlas/segment/RegionGraph.d.ts.map +1 -0
  98. package/src/core/geom/3d/atlas/segment/RegionGraph.js +40 -0
  99. package/src/core/geom/3d/atlas/segment/atlas_build_region_graph.d.ts +23 -0
  100. package/src/core/geom/3d/atlas/segment/atlas_build_region_graph.d.ts.map +1 -0
  101. package/src/core/geom/3d/atlas/segment/atlas_build_region_graph.js +136 -0
  102. package/src/core/geom/3d/atlas/segment/atlas_compute_planar_regions.d.ts +24 -0
  103. package/src/core/geom/3d/atlas/segment/atlas_compute_planar_regions.d.ts.map +1 -0
  104. package/src/core/geom/3d/atlas/segment/atlas_compute_planar_regions.js +77 -0
  105. package/src/core/geom/3d/atlas/segment/atlas_merge_charts.d.ts +27 -0
  106. package/src/core/geom/3d/atlas/segment/atlas_merge_charts.d.ts.map +1 -0
  107. package/src/core/geom/3d/atlas/segment/atlas_merge_charts.js +113 -0
  108. package/src/core/geom/3d/atlas/segment/atlas_segment_charts.d.ts +44 -0
  109. package/src/core/geom/3d/atlas/segment/atlas_segment_charts.d.ts.map +1 -0
  110. package/src/core/geom/3d/atlas/segment/atlas_segment_charts.js +275 -0
  111. package/src/core/geom/3d/atlas/segment/atlas_segment_charts_atomic.d.ts +22 -0
  112. package/src/core/geom/3d/atlas/segment/atlas_segment_charts_atomic.d.ts.map +1 -0
  113. package/src/core/geom/3d/atlas/segment/atlas_segment_charts_atomic.js +199 -0
  114. package/src/core/geom/3d/line/line3_compute_point_segment_point_distance_unfolded.d.ts +32 -0
  115. package/src/core/geom/3d/line/line3_compute_point_segment_point_distance_unfolded.d.ts.map +1 -0
  116. package/src/core/geom/3d/line/line3_compute_point_segment_point_distance_unfolded.js +64 -0
  117. package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale.d.ts +20 -0
  118. package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale.d.ts.map +1 -0
  119. package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale.js +66 -0
  120. package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.d.ts.map +1 -1
  121. package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js +13 -11
  122. package/src/core/geom/3d/sphere/sphere_compute_bounding_of_2_spheres.d.ts.map +1 -1
  123. package/src/core/geom/3d/sphere/sphere_compute_bounding_of_2_spheres.js +4 -3
  124. package/src/core/geom/3d/topology/simplify/decimate_edge_collapse_snap.d.ts.map +1 -1
  125. package/src/core/geom/3d/topology/simplify/decimate_edge_collapse_snap.js +4 -3
  126. package/src/core/geom/3d/topology/simplify/quadratic/Quadric3.d.ts.map +1 -1
  127. package/src/core/geom/3d/topology/simplify/quadratic/Quadric3.js +4 -3
  128. package/src/core/geom/3d/topology/simplify/quadratic/apply_border_penalty_to_vertex_quadrics.d.ts.map +1 -1
  129. package/src/core/geom/3d/topology/simplify/quadratic/apply_border_penalty_to_vertex_quadrics.js +10 -6
  130. package/src/core/geom/3d/topology/struct/TopoMesh.js +2 -2
  131. package/src/core/geom/3d/topology/struct/TopoTriangle.d.ts +0 -2
  132. package/src/core/geom/3d/topology/struct/TopoTriangle.d.ts.map +1 -1
  133. package/src/core/geom/3d/topology/struct/TopoTriangle.js +2 -2
  134. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.d.ts.map +1 -1
  135. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.js +8 -27
  136. package/src/core/geom/vec3/v3_cotangent.d.ts +20 -0
  137. package/src/core/geom/vec3/v3_cotangent.d.ts.map +1 -0
  138. package/src/core/geom/vec3/v3_cotangent.js +29 -0
  139. package/src/core/geom/vec3/v3_matrix3_multiply.d.ts +19 -0
  140. package/src/core/geom/vec3/v3_matrix3_multiply.d.ts.map +1 -0
  141. package/src/core/geom/vec3/v3_matrix3_multiply.js +30 -0
  142. package/src/core/geom/vec3/v3_multiply.d.ts +16 -0
  143. package/src/core/geom/vec3/v3_multiply.d.ts.map +1 -0
  144. package/src/core/geom/vec3/v3_multiply.js +19 -0
  145. package/src/core/math/linalg/cg/cg_solve.d.ts +24 -0
  146. package/src/core/math/linalg/cg/cg_solve.d.ts.map +1 -0
  147. package/src/core/math/linalg/cg/cg_solve.js +106 -0
  148. package/src/core/math/linalg/cg/cg_solve_normal_equations.d.ts +21 -0
  149. package/src/core/math/linalg/cg/cg_solve_normal_equations.d.ts.map +1 -0
  150. package/src/core/math/linalg/cg/cg_solve_normal_equations.js +59 -0
  151. package/src/core/math/linalg/eigen/matrix_symmetric_3x3_eigen.d.ts +19 -0
  152. package/src/core/math/linalg/eigen/matrix_symmetric_3x3_eigen.d.ts.map +1 -0
  153. package/src/core/math/linalg/eigen/matrix_symmetric_3x3_eigen.js +117 -0
  154. package/src/core/math/linalg/sparse/SparseMatrixCSR.d.ts +50 -0
  155. package/src/core/math/linalg/sparse/SparseMatrixCSR.d.ts.map +1 -0
  156. package/src/core/math/linalg/sparse/SparseMatrixCSR.js +88 -0
  157. package/src/core/math/linalg/sparse/spm_matvec.d.ts +9 -0
  158. package/src/core/math/linalg/sparse/spm_matvec.d.ts.map +1 -0
  159. package/src/core/math/linalg/sparse/spm_matvec.js +22 -0
  160. package/src/core/math/linalg/sparse/spm_matvec_transpose.d.ts +12 -0
  161. package/src/core/math/linalg/sparse/spm_matvec_transpose.d.ts.map +1 -0
  162. package/src/core/math/linalg/sparse/spm_matvec_transpose.js +29 -0
  163. package/src/core/math/physics/mie/MIE_PARTICLES_STANDARD_PRECOMPUTED.d.ts +39 -0
  164. package/src/core/math/physics/mie/MIE_PARTICLES_STANDARD_PRECOMPUTED.js +22 -1
  165. package/src/core/math/physics/mie/compute_mie_particle_properties_rgb.d.ts.map +1 -1
  166. package/src/core/math/physics/mie/compute_mie_particle_properties_rgb.js +32 -9
  167. package/src/core/math/physics/mie/compute_mie_phase.d.ts +2 -3
  168. package/src/core/math/physics/mie/compute_mie_phase.d.ts.map +1 -1
  169. package/src/core/math/physics/mie/compute_mie_phase.js +1 -3
  170. package/src/core/math/physics/mie/lorenz_mie_coefs.d.ts +0 -1
  171. package/src/core/math/physics/mie/lorenz_mie_coefs.d.ts.map +1 -1
  172. package/src/core/math/physics/mie/lorenz_mie_coefs.js +0 -7
  173. package/src/engine/REVIEW_2026_07_03.md +211 -0
  174. package/src/engine/animation/curve/actionProcessorOperations/curveActions.d.ts.map +1 -1
  175. package/src/engine/animation/curve/actionProcessorOperations/curveActions.js +3 -2
  176. package/src/engine/animation/curve/compression/sample_animation_curve_to_float_array.js +1 -1
  177. package/src/engine/animation/keyed2/AnimationTrackPlayback.d.ts.map +1 -1
  178. package/src/engine/animation/keyed2/AnimationTrackPlayback.js +3 -1
  179. package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterNone.js +2 -2
  180. package/src/engine/asset/preloader/AssetPreloader.d.ts.map +1 -1
  181. package/src/engine/asset/preloader/AssetPreloader.js +6 -0
  182. package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.d.ts.map +1 -1
  183. package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.js +5 -2
  184. package/src/engine/ecs/Entity.js +1 -1
  185. package/src/engine/ecs/EntityComponentDataset.d.ts.map +1 -1
  186. package/src/engine/ecs/EntityComponentDataset.js +1 -0
  187. package/src/engine/ecs/EntityManager.js +1 -1
  188. package/src/engine/ecs/EntityObserver.js +1 -1
  189. package/src/engine/ecs/animation/AnimationClip.js +1 -1
  190. package/src/engine/ecs/attachment/AttachmentSystem.js +2 -2
  191. package/src/engine/ecs/attachment/TransformAttachmentBinding.d.ts.map +1 -1
  192. package/src/engine/ecs/attachment/TransformAttachmentBinding.js +14 -3
  193. package/src/engine/ecs/fow/FogOfWar.js +2 -2
  194. package/src/engine/ecs/fow/shader/screenSpaceFogOfWarShader.d.ts.map +1 -1
  195. package/src/engine/ecs/fow/shader/screenSpaceFogOfWarShader.js +8 -0
  196. package/src/engine/ecs/gui/hud/HeadsUpDisplaySystem.js +3 -3
  197. package/src/engine/ecs/gui/position/ViewportPosition.d.ts +3 -1
  198. package/src/engine/ecs/gui/position/ViewportPosition.d.ts.map +1 -1
  199. package/src/engine/ecs/gui/position/ViewportPosition.js +4 -1
  200. package/src/engine/ecs/storage/binary/BinarySerializationRegistry.d.ts +10 -0
  201. package/src/engine/ecs/storage/binary/BinarySerializationRegistry.d.ts.map +1 -1
  202. package/src/engine/ecs/storage/binary/BinarySerializationRegistry.js +43 -0
  203. package/src/engine/ecs/storage/binary/object-v2/BinaryObjectDeSerializer.d.ts +93 -0
  204. package/src/engine/ecs/storage/binary/object-v2/BinaryObjectDeSerializer.d.ts.map +1 -0
  205. package/src/engine/ecs/storage/binary/object-v2/BinaryObjectDeSerializer.js +315 -0
  206. package/src/engine/ecs/storage/binary/object-v2/BinaryObjectSerializer.d.ts +48 -0
  207. package/src/engine/ecs/storage/binary/object-v2/BinaryObjectSerializer.d.ts.map +1 -0
  208. package/src/engine/ecs/storage/binary/object-v2/BinaryObjectSerializer.js +331 -0
  209. package/src/engine/ecs/storage/binary/object-v2/DESIGN.md +199 -0
  210. package/src/engine/ecs/storage/binary/object-v2/ObjectBinaryFormat.d.ts +53 -0
  211. package/src/engine/ecs/storage/binary/object-v2/ObjectBinaryFormat.d.ts.map +1 -0
  212. package/src/engine/ecs/storage/binary/object-v2/ObjectBinaryFormat.js +57 -0
  213. package/src/engine/ecs/storage/binary/object-v2/ObjectSerializationAdapter.d.ts +53 -0
  214. package/src/engine/ecs/storage/binary/object-v2/ObjectSerializationAdapter.d.ts.map +1 -0
  215. package/src/engine/ecs/storage/binary/object-v2/ObjectSerializationAdapter.js +56 -0
  216. package/src/engine/ecs/storage/binary/object-v2/README.md +110 -0
  217. package/src/engine/ecs/storage/binary/object-v2/objectStringCodec.d.ts +13 -0
  218. package/src/engine/ecs/storage/binary/object-v2/objectStringCodec.d.ts.map +1 -0
  219. package/src/engine/ecs/storage/binary/object-v2/objectStringCodec.js +48 -0
  220. package/src/engine/ecs/storage/binary/object-v2/serializerTestHarness.d.ts +29 -0
  221. package/src/engine/ecs/storage/binary/object-v2/serializerTestHarness.d.ts.map +1 -0
  222. package/src/engine/ecs/storage/binary/object-v2/serializerTestHarness.js +44 -0
  223. package/src/engine/ecs/terrain/ecs/Terrain.d.ts.map +1 -1
  224. package/src/engine/ecs/terrain/ecs/Terrain.js +4 -3
  225. package/src/engine/ecs/terrain/tiles/TerrainTile.js +2 -2
  226. package/src/engine/ecs/terrain/tiles/TerrainTileManager.d.ts.map +1 -1
  227. package/src/engine/ecs/terrain/tiles/TerrainTileManager.js +9 -8
  228. package/src/engine/graphics/GraphicsEngine.d.ts.map +1 -1
  229. package/src/engine/graphics/GraphicsEngine.js +2 -1
  230. package/src/engine/graphics/camera/makeScreenScissorFrustum.d.ts.map +1 -1
  231. package/src/engine/graphics/camera/makeScreenScissorFrustum.js +11 -10
  232. package/src/engine/graphics/canvas/canvas2d_draw_linear_scale.d.ts.map +1 -1
  233. package/src/engine/graphics/canvas/canvas2d_draw_linear_scale.js +3 -1
  234. package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/readAnimationGraphDefinitionFromJSON.d.ts +1 -1
  235. package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/readAnimationGraphDefinitionFromJSON.d.ts.map +1 -1
  236. package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/readAnimationGraphDefinitionFromJSON.js +2 -2
  237. package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/writeAnimationGraphDefinitionToJSON.d.ts.map +1 -1
  238. package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/writeAnimationGraphDefinitionToJSON.js +2 -0
  239. package/src/engine/graphics/ecs/camera/Camera.d.ts.map +1 -1
  240. package/src/engine/graphics/ecs/camera/Camera.js +4 -0
  241. package/src/engine/graphics/ecs/camera/auto_set_camera_clipping_planes.d.ts.map +1 -1
  242. package/src/engine/graphics/ecs/camera/auto_set_camera_clipping_planes.js +7 -2
  243. package/src/engine/graphics/ecs/camera/set_camera_aspect_ratio.js +1 -1
  244. package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.js +2 -2
  245. package/src/engine/graphics/ecs/decal/v2/prototypeDecalSystem.js +2 -2
  246. package/src/engine/graphics/ecs/highlight/system/ShadedGeometryHighlightSystem.d.ts.map +1 -1
  247. package/src/engine/graphics/ecs/highlight/system/ShadedGeometryHighlightSystem.js +4 -1
  248. package/src/engine/graphics/ecs/light/binding/LightBinding.js +2 -2
  249. package/src/engine/graphics/ecs/mesh/MeshSystem.js +1 -1
  250. package/src/engine/graphics/ecs/mesh/SkeletonUtils.js +1 -1
  251. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +2 -2
  252. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.d.ts.map +1 -1
  253. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +0 -1
  254. package/src/engine/graphics/ecs/mesh-v2/sg_hierarchy_compute_bounding_box_via_parent_entity.js +1 -1
  255. package/src/engine/graphics/ecs/path/tube/build/computeFrenetFrames.d.ts.map +1 -1
  256. package/src/engine/graphics/ecs/path/tube/build/computeFrenetFrames.js +8 -7
  257. package/src/engine/graphics/ecs/water/WaterSystem.d.ts +6 -0
  258. package/src/engine/graphics/ecs/water/WaterSystem.d.ts.map +1 -1
  259. package/src/engine/graphics/ecs/water/WaterSystem.js +12 -1
  260. package/src/engine/graphics/geometry/MikkT/AvgTSpace.d.ts.map +1 -1
  261. package/src/engine/graphics/geometry/MikkT/AvgTSpace.js +11 -6
  262. package/src/engine/graphics/geometry/MikkT/BuildNeighborsFast.d.ts.map +1 -1
  263. package/src/engine/graphics/geometry/MikkT/BuildNeighborsFast.js +2 -3
  264. package/src/engine/graphics/geometry/MikkT/CalcTexArea.d.ts.map +1 -1
  265. package/src/engine/graphics/geometry/MikkT/CalcTexArea.js +3 -4
  266. package/src/engine/graphics/geometry/MikkT/DegenEpilogue.js +4 -4
  267. package/src/engine/graphics/geometry/MikkT/EvalTspace.d.ts.map +1 -1
  268. package/src/engine/graphics/geometry/MikkT/EvalTspace.js +11 -8
  269. package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.d.ts.map +1 -1
  270. package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.js +7 -8
  271. package/src/engine/graphics/geometry/MikkT/GenerateTSpaces.js +8 -8
  272. package/src/engine/graphics/geometry/MikkT/InitTriInfo.d.ts.map +1 -1
  273. package/src/engine/graphics/geometry/MikkT/InitTriInfo.js +30 -25
  274. package/src/engine/graphics/geometry/MikkT/MikkTSpace.js +7 -7
  275. package/src/engine/graphics/geometry/MikkT/NormalizeSafe.d.ts +0 -1
  276. package/src/engine/graphics/geometry/MikkT/NormalizeSafe.d.ts.map +1 -1
  277. package/src/engine/graphics/geometry/MikkT/NormalizeSafe.js +6 -4
  278. package/src/engine/graphics/geometry/MikkT/STSpace.d.ts +0 -2
  279. package/src/engine/graphics/geometry/MikkT/STSpace.d.ts.map +1 -1
  280. package/src/engine/graphics/geometry/MikkT/STSpace.js +3 -3
  281. package/src/engine/graphics/geometry/MikkT/v3_scale_dot_sub_normalize.d.ts +0 -2
  282. package/src/engine/graphics/geometry/MikkT/v3_scale_dot_sub_normalize.d.ts.map +1 -1
  283. package/src/engine/graphics/geometry/MikkT/v3_scale_dot_sub_normalize.js +0 -1
  284. package/src/engine/graphics/geometry/buffered/ensureGeometryBoundingSphere.js +1 -1
  285. package/src/engine/graphics/geometry/buffered/query/bvh32_geometry_nearest.d.ts.map +1 -1
  286. package/src/engine/graphics/geometry/buffered/query/bvh32_geometry_nearest.js +0 -15
  287. package/src/engine/graphics/geometry/instancing/InstancedMeshGroup.js +10 -10
  288. package/src/engine/graphics/geometry/optimization/merge/merge_geometry_hierarchy.js +1 -1
  289. package/src/engine/graphics/impostors/octahedral/ImpostorBaker.d.ts +0 -2
  290. package/src/engine/graphics/impostors/octahedral/ImpostorBaker.d.ts.map +1 -1
  291. package/src/engine/graphics/impostors/octahedral/ImpostorBaker.js +4 -3
  292. package/src/engine/graphics/impostors/octahedral/grid/HemiOctahedralUvEncoder.js +2 -2
  293. package/src/engine/graphics/impostors/octahedral/grid/UvEncoder.d.ts +17 -7
  294. package/src/engine/graphics/impostors/voxel/VoxelImpostorBaker.js +2 -2
  295. package/src/engine/graphics/material/SplatMaterial.js +1 -1
  296. package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.d.ts.map +1 -1
  297. package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +3 -2
  298. package/src/engine/graphics/particles/particular/engine/emitter/ParticlePool.js +1 -1
  299. package/src/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.js +3 -3
  300. package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +4 -3
  301. package/src/engine/graphics/particles/particular/group/ParticleGroup.d.ts.map +1 -1
  302. package/src/engine/graphics/particles/particular/group/ParticleGroup.js +3 -2
  303. package/src/engine/graphics/render/forward_plus/LightManager.js +2 -2
  304. package/src/engine/graphics/render/forward_plus/model/Decal.d.ts +0 -2
  305. package/src/engine/graphics/render/forward_plus/model/Decal.d.ts.map +1 -1
  306. package/src/engine/graphics/render/forward_plus/model/Decal.js +3 -3
  307. package/src/engine/graphics/render/forward_plus/plugin/ForwardPlusRenderingPlugin.js +1 -1
  308. package/src/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +4 -3
  309. package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +6 -4
  310. package/src/engine/graphics/sh3/gi/material/MaterialTransformer.d.ts +1 -8
  311. package/src/engine/graphics/sh3/gi/material/MaterialTransformer.d.ts.map +1 -1
  312. package/src/engine/graphics/sh3/gi/material/MaterialTransformer.js +2 -14
  313. package/src/engine/graphics/sh3/gi/material/ProbeResolutionStage.d.ts +9 -0
  314. package/src/engine/graphics/sh3/gi/material/ProbeResolutionStage.d.ts.map +1 -0
  315. package/src/engine/graphics/sh3/gi/material/ProbeResolutionStage.js +14 -0
  316. package/src/engine/graphics/sh3/lightmap/ARTIFACTS_PLAN.md +146 -0
  317. package/src/engine/graphics/sh3/lightmap/CODE_REVIEW.md +121 -0
  318. package/src/engine/graphics/sh3/lightmap/LIGHTMAPPER_REVIEW.md +183 -0
  319. package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.d.ts +90 -0
  320. package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.d.ts.map +1 -0
  321. package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.js +681 -0
  322. package/src/engine/graphics/sh3/lightmap/lightmap_build_geometry.d.ts +32 -0
  323. package/src/engine/graphics/sh3/lightmap/lightmap_build_geometry.d.ts.map +1 -0
  324. package/src/engine/graphics/sh3/lightmap/lightmap_build_geometry.js +155 -0
  325. package/src/engine/graphics/sh3/lightmap/lightmap_denoise.d.ts +49 -0
  326. package/src/engine/graphics/sh3/lightmap/lightmap_denoise.d.ts.map +1 -0
  327. package/src/engine/graphics/sh3/lightmap/lightmap_denoise.js +136 -0
  328. package/src/engine/graphics/sh3/lightmap/lightmap_dilate.d.ts +19 -0
  329. package/src/engine/graphics/sh3/lightmap/lightmap_dilate.d.ts.map +1 -0
  330. package/src/engine/graphics/sh3/lightmap/lightmap_dilate.js +89 -0
  331. package/src/engine/graphics/sh3/lightmap/lightmap_gather.d.ts +54 -0
  332. package/src/engine/graphics/sh3/lightmap/lightmap_gather.d.ts.map +1 -0
  333. package/src/engine/graphics/sh3/lightmap/lightmap_gather.js +168 -0
  334. package/src/engine/graphics/sh3/lightmap/lightmap_rasterize_triangle.d.ts +30 -0
  335. package/src/engine/graphics/sh3/lightmap/lightmap_rasterize_triangle.d.ts.map +1 -0
  336. package/src/engine/graphics/sh3/lightmap/lightmap_rasterize_triangle.js +145 -0
  337. package/src/engine/graphics/sh3/lightmap/lightmap_seam_fix.d.ts +38 -0
  338. package/src/engine/graphics/sh3/lightmap/lightmap_seam_fix.d.ts.map +1 -0
  339. package/src/engine/graphics/sh3/lightmap/lightmap_seam_fix.js +152 -0
  340. package/src/engine/graphics/sh3/lightmap/prototypeLightmapBaker.d.ts +2 -0
  341. package/src/engine/graphics/sh3/lightmap/prototypeLightmapBaker.d.ts.map +1 -0
  342. package/src/engine/graphics/sh3/lightmap/prototypeLightmapBaker.js +186 -0
  343. package/src/engine/graphics/sh3/lpg/LightProbeGrid.d.ts +69 -0
  344. package/src/engine/graphics/sh3/lpg/LightProbeGrid.d.ts.map +1 -0
  345. package/src/engine/graphics/sh3/lpg/LightProbeGrid.js +173 -0
  346. package/src/engine/graphics/sh3/lpg/LightProbeGridBaker.d.ts +24 -0
  347. package/src/engine/graphics/sh3/lpg/LightProbeGridBaker.d.ts.map +1 -0
  348. package/src/engine/graphics/sh3/lpg/LightProbeGridBaker.js +88 -0
  349. package/src/engine/graphics/sh3/lpg/build_light_probe_grid_for_scene.d.ts +20 -0
  350. package/src/engine/graphics/sh3/lpg/build_light_probe_grid_for_scene.d.ts.map +1 -0
  351. package/src/engine/graphics/sh3/lpg/build_light_probe_grid_for_scene.js +79 -0
  352. package/src/engine/graphics/sh3/lpg/light_probe_grid_obtain_storage_cached.d.ts +11 -0
  353. package/src/engine/graphics/sh3/lpg/light_probe_grid_obtain_storage_cached.d.ts.map +1 -0
  354. package/src/engine/graphics/sh3/lpg/light_probe_grid_obtain_storage_cached.js +84 -0
  355. package/src/engine/graphics/sh3/lpg/light_probe_grid_textures.d.ts +29 -0
  356. package/src/engine/graphics/sh3/lpg/light_probe_grid_textures.d.ts.map +1 -0
  357. package/src/engine/graphics/sh3/lpg/light_probe_grid_textures.js +160 -0
  358. package/src/engine/graphics/sh3/lpg/material/LightProbeGridMaterialTransformer.d.ts +23 -0
  359. package/src/engine/graphics/sh3/lpg/material/LightProbeGridMaterialTransformer.d.ts.map +1 -0
  360. package/src/engine/graphics/sh3/lpg/material/LightProbeGridMaterialTransformer.js +228 -0
  361. package/src/engine/graphics/sh3/lpg/material/chunk_lpg_get_irradiance_at.d.ts +2 -0
  362. package/src/engine/graphics/sh3/lpg/material/chunk_lpg_get_irradiance_at.d.ts.map +1 -0
  363. package/src/engine/graphics/sh3/lpg/material/chunk_lpg_get_irradiance_at.js +24 -0
  364. package/src/engine/graphics/sh3/lpg/material/common.d.ts +3 -0
  365. package/src/engine/graphics/sh3/lpg/material/common.d.ts.map +1 -0
  366. package/src/engine/graphics/sh3/lpg/material/common.js +73 -0
  367. package/src/engine/graphics/sh3/lpg/material/space_fragment/build_fragment_shader.d.ts +6 -0
  368. package/src/engine/graphics/sh3/lpg/material/space_fragment/build_fragment_shader.d.ts.map +1 -0
  369. package/src/engine/graphics/sh3/lpg/material/space_fragment/build_fragment_shader.js +42 -0
  370. package/src/engine/graphics/sh3/lpg/material/space_fragment/build_vertex_shader.d.ts +6 -0
  371. package/src/engine/graphics/sh3/lpg/material/space_fragment/build_vertex_shader.d.ts.map +1 -0
  372. package/src/engine/graphics/sh3/lpg/material/space_fragment/build_vertex_shader.js +49 -0
  373. package/src/engine/graphics/sh3/lpg/material/space_fragment/space_fragment_transform_shader.d.ts +9 -0
  374. package/src/engine/graphics/sh3/lpg/material/space_fragment/space_fragment_transform_shader.d.ts.map +1 -0
  375. package/src/engine/graphics/sh3/lpg/material/space_fragment/space_fragment_transform_shader.js +12 -0
  376. package/src/engine/graphics/sh3/lpg/material/space_vertex/build_fragment_shader.d.ts +6 -0
  377. package/src/engine/graphics/sh3/lpg/material/space_vertex/build_fragment_shader.d.ts.map +1 -0
  378. package/src/engine/graphics/sh3/lpg/material/space_vertex/build_fragment_shader.js +30 -0
  379. package/src/engine/graphics/sh3/lpg/material/space_vertex/build_vertex_shader.d.ts +6 -0
  380. package/src/engine/graphics/sh3/lpg/material/space_vertex/build_vertex_shader.d.ts.map +1 -0
  381. package/src/engine/graphics/sh3/lpg/material/space_vertex/build_vertex_shader.js +41 -0
  382. package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.frag.d.ts +3 -0
  383. package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.frag.d.ts.map +1 -0
  384. package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.frag.js +15 -0
  385. package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.vert.d.ts +3 -0
  386. package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.vert.d.ts.map +1 -0
  387. package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.vert.js +9 -0
  388. package/src/engine/graphics/sh3/lpg/material/space_vertex/space_vertex_transform_shader.d.ts +9 -0
  389. package/src/engine/graphics/sh3/lpg/material/space_vertex/space_vertex_transform_shader.d.ts.map +1 -0
  390. package/src/engine/graphics/sh3/lpg/material/space_vertex/space_vertex_transform_shader.js +12 -0
  391. package/src/engine/graphics/sh3/lpg/serialization/LightProbeGridSerializationAdapter.d.ts +20 -0
  392. package/src/engine/graphics/sh3/lpg/serialization/LightProbeGridSerializationAdapter.d.ts.map +1 -0
  393. package/src/engine/graphics/sh3/lpg/serialization/LightProbeGridSerializationAdapter.js +59 -0
  394. package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.d.ts.map +1 -1
  395. package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.js +2 -2
  396. package/src/engine/graphics/sh3/path_tracer/PathTracer.js +2 -2
  397. package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.d.ts.map +1 -1
  398. package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.js +8 -0
  399. package/src/engine/graphics/sh3/path_tracer/prepare_scene_gltf.d.ts.map +1 -1
  400. package/src/engine/graphics/sh3/path_tracer/prepare_scene_gltf.js +6 -4
  401. package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +3 -3
  402. package/src/engine/graphics/sh3/path_tracer/texture/sample_material.d.ts.map +1 -1
  403. package/src/engine/graphics/sh3/path_tracer/texture/sample_material.js +5 -4
  404. package/src/engine/graphics/sh3/prototypeLightProbeGrid.d.ts +2 -0
  405. package/src/engine/graphics/sh3/prototypeLightProbeGrid.d.ts.map +1 -0
  406. package/src/engine/graphics/sh3/prototypeLightProbeGrid.js +170 -0
  407. package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.js +2 -2
  408. package/src/engine/graphics/texture/atlas/AtlasLookupTexture.js +1 -1
  409. package/src/engine/graphics/texture/atlas/CachingTextureAtlas.js +1 -1
  410. package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_lanczos.js +1 -1
  411. package/src/engine/graphics/texture/sampler/sampler2d_copy_with_margins.js +3 -3
  412. package/src/engine/graphics/util/build_max_height_pyramid.d.ts.map +1 -1
  413. package/src/engine/graphics/util/build_max_height_pyramid.js +5 -2
  414. package/src/engine/grid/transform2grid/Transform2GridPositionSystem.js +1 -1
  415. package/src/engine/input/devices/KeyboardDevice.d.ts +61 -14
  416. package/src/engine/input/devices/KeyboardDevice.d.ts.map +1 -1
  417. package/src/engine/input/devices/KeyboardDevice.js +41 -15
  418. package/src/engine/input/devices/isHTMLElementFocusable.d.ts.map +1 -1
  419. package/src/engine/input/devices/isHTMLElementFocusable.js +2 -9
  420. package/src/engine/input/ecs/components/InputBinding.d.ts +7 -1
  421. package/src/engine/input/ecs/components/InputBinding.d.ts.map +1 -1
  422. package/src/engine/input/ecs/components/InputBinding.js +8 -1
  423. package/src/engine/input/ecs/systems/InputControllerSystem.js +1 -1
  424. package/src/engine/intelligence/behavior/decorator/OverrideContextBehavior.d.ts +2 -1
  425. package/src/engine/intelligence/behavior/decorator/OverrideContextBehavior.d.ts.map +1 -1
  426. package/src/engine/intelligence/behavior/decorator/OverrideContextBehavior.js +6 -2
  427. package/src/engine/intelligence/behavior/selector/WeightedElement.js +1 -1
  428. package/src/engine/knowledge/database/StaticKnowledgeDatabase.d.ts.map +1 -1
  429. package/src/engine/knowledge/database/StaticKnowledgeDatabase.js +2 -4
  430. package/src/engine/logging/elastic/ElasticSearchLogger.d.ts +1 -2
  431. package/src/engine/logging/elastic/ElasticSearchLogger.d.ts.map +1 -1
  432. package/src/engine/logging/elastic/ElasticSearchLogger.js +14 -10
  433. package/src/engine/navigation/ecs/path_following/PathFollower.js +1 -1
  434. package/src/engine/navigation/grid/find_path_on_grid_astar.d.ts.map +1 -1
  435. package/src/engine/navigation/grid/find_path_on_grid_astar.js +5 -2
  436. package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts +1 -1
  437. package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts.map +1 -1
  438. package/src/engine/network/orchestrator/ServerAuthoritativeServer.js +17 -0
  439. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  440. package/src/engine/physics/fluid/ecs/FluidSystem.d.ts +3 -3
  441. package/src/engine/scene/SceneManager.d.ts.map +1 -1
  442. package/src/engine/scene/SceneManager.js +4 -2
  443. package/src/engine/simulation/Ticker.d.ts.map +1 -1
  444. package/src/engine/simulation/Ticker.js +9 -0
  445. package/src/engine/sound/ecs/emitter/SoundEmitterSystem.d.ts.map +1 -1
  446. package/src/engine/sound/ecs/emitter/SoundEmitterSystem.js +6 -1
  447. package/src/engine/sound/material/concrete/json/serializeSoundMaterialToJSON.js +1 -1
  448. package/src/engine/sound/simulation/prototypeAcousticSolver.js +261 -143
  449. package/src/generation/theme/ThemeEngine.d.ts +9 -0
  450. package/src/generation/theme/ThemeEngine.d.ts.map +1 -1
  451. package/src/generation/theme/ThemeEngine.js +37 -2
@@ -1,75 +1,82 @@
1
- import { CellFilterMultiply } from "../../../src/generation/filtering/numeric/math/algebra/CellFilterMultiply.js";
2
- import { CellFilterSimplexNoise } from "../../../src/generation/filtering/numeric/complex/CellFilterSimplexNoise.js";
1
+ import { MohGridLayers } from "../../../../../generator/MohGridLayers.js";
2
+ import { DEG_TO_RAD } from "../../../src/core/math/DEG_TO_RAD.js";
3
+ import { CellFilterCache } from "../../../src/generation/filtering/numeric/CellFilterCache.js";
3
4
  import { CellFilterLiteralFloat } from "../../../src/generation/filtering/numeric/CellFilterLiteralFloat.js";
5
+ import { CellFilterDilate } from "../../../src/generation/filtering/numeric/complex/CellFilterDilate.js";
4
6
  import { CellFilterGaussianBlur } from "../../../src/generation/filtering/numeric/complex/CellFilterGaussianBlur.js";
7
+ import { CellFilterSimplexNoise } from "../../../src/generation/filtering/numeric/complex/CellFilterSimplexNoise.js";
8
+ import { CellFilterMultiply } from "../../../src/generation/filtering/numeric/math/algebra/CellFilterMultiply.js";
9
+ import { CellFilterMax2 } from "../../../src/generation/filtering/numeric/math/CellFilterMax2.js";
10
+ import { CellFilterSmoothStep } from "../../../src/generation/filtering/numeric/math/CellFilterSmoothStep.js";
5
11
  import { CellFilterStep } from "../../../src/generation/filtering/numeric/math/CellFilterStep.js";
6
12
  import {
7
13
  CellFilterSampleLayerLinear
8
14
  } from "../../../src/generation/filtering/numeric/sampling/CellFilterSampleLayerLinear.js";
9
15
  import { MirGridLayers } from "../grid/MirGridLayers.js";
10
- import { CellFilterMax2 } from "../../../src/generation/filtering/numeric/math/CellFilterMax2.js";
11
- import { CellFilterSmoothStep } from "../../../src/generation/filtering/numeric/math/CellFilterSmoothStep.js";
12
- import { MohGridLayers } from "../../../../../generator/MohGridLayers.js";
13
- import { CellFilterDilate } from "../../../src/generation/filtering/numeric/complex/CellFilterDilate.js";
14
- import { CellFilterCache } from "../../../src/generation/filtering/numeric/CellFilterCache.js";
15
- import { DEG_TO_RAD } from "../../../src/core/math/DEG_TO_RAD.js";
16
16
 
17
- const fReadHeight = CellFilterSampleLayerLinear.from(MirGridLayers.Heights);
17
+ /**
18
+ * Factory, a fresh filter graph is required per generation — filters bake per-run state
19
+ * (noise seed, layer sampler binding, cache contents) on initialize.
20
+ * @returns {CellFilter}
21
+ */
22
+ export const SampleGroundMoistureFilter = () => {
18
23
 
19
- const WATER_MASK = CellFilterStep.from(fReadHeight, CellFilterLiteralFloat.from(-0.05));
20
- const CURVATURE = CellFilterSampleLayerLinear.from(MohGridLayers.Curvature);
21
- const SLOPE = CellFilterSampleLayerLinear.from(MohGridLayers.Slope);
24
+ const fReadHeight = CellFilterSampleLayerLinear.from(MirGridLayers.Heights);
22
25
 
26
+ const WATER_MASK = CellFilterStep.from(fReadHeight, CellFilterLiteralFloat.from(-0.05));
27
+ const SLOPE = CellFilterSampleLayerLinear.from(MohGridLayers.Slope);
28
+ const CURVATURE = CellFilterSampleLayerLinear.from(MohGridLayers.Curvature);
23
29
 
24
- export const SampleGroundMoistureFilter = CellFilterMax2.from(
25
- // add regional variation in relative moisture
26
- CellFilterMultiply.from(
30
+ return CellFilterMax2.from(
31
+ // add regional variation in relative moisture
27
32
  CellFilterMultiply.from(
28
- CellFilterSimplexNoise.fractal(2, 100, 1263),
29
- CellFilterMax2.from(
30
- // flat areas are more likely to be keep moisture
31
- CellFilterSmoothStep.from(
32
- CellFilterLiteralFloat.from(40 * DEG_TO_RAD),
33
- CellFilterLiteralFloat.from(10 * DEG_TO_RAD),
34
- SLOPE
35
- ),
36
- // water accumulates in crevices
37
- CellFilterSmoothStep.from(
38
- CellFilterLiteralFloat.from(0.0),
39
- CellFilterLiteralFloat.from(0.1),
40
- CURVATURE
41
- )
42
- )
43
- ),
44
-
45
- CellFilterLiteralFloat.from(0.5)
46
- ),
47
-
48
- //simulate water diffusion from lakes/rivers/sees into the nearby ground
49
- CellFilterGaussianBlur.from(
50
- CellFilterCache.from(
51
- CellFilterMax2.from(
52
- WATER_MASK,
53
- CellFilterMultiply.from(
54
- CellFilterGaussianBlur.from(
55
- CellFilterCache.from(CellFilterDilate.from(WATER_MASK)),
56
- 5,
57
- 5,
58
- 1
59
- ),
60
- /*
61
- Diffuse more along surfaces with low slope (flat)
62
- NOTE: we don't have to worry about directly of the slope, as water always starts at 0, so any slope will be positive in effect
63
- */
33
+ CellFilterMultiply.from(
34
+ CellFilterSimplexNoise.fractal(2, 100, 1263),
35
+ CellFilterMax2.from(
36
+ // flat areas are more likely to be keep moisture
64
37
  CellFilterSmoothStep.from(
65
- CellFilterLiteralFloat.from(35 * DEG_TO_RAD),
38
+ CellFilterLiteralFloat.from(40 * DEG_TO_RAD),
66
39
  CellFilterLiteralFloat.from(10 * DEG_TO_RAD),
67
40
  SLOPE
68
41
  ),
42
+ // water accumulates in crevices
43
+ CellFilterSmoothStep.from(
44
+ CellFilterLiteralFloat.from(0.0),
45
+ CellFilterLiteralFloat.from(0.1),
46
+ CURVATURE
47
+ )
69
48
  )
70
- )
49
+ ),
50
+
51
+ CellFilterLiteralFloat.from(0.5)
71
52
  ),
72
- 3, 3, 1
73
- )
74
- );
53
+
54
+ //simulate water diffusion from lakes/rivers/sees into the nearby ground
55
+ CellFilterGaussianBlur.from(
56
+ CellFilterCache.from(
57
+ CellFilterMax2.from(
58
+ WATER_MASK,
59
+ CellFilterMultiply.from(
60
+ CellFilterGaussianBlur.from(
61
+ CellFilterCache.from(CellFilterDilate.from(WATER_MASK)),
62
+ 5,
63
+ 5,
64
+ 1
65
+ ),
66
+ /*
67
+ Diffuse more along surfaces with low slope (flat)
68
+ NOTE: we don't have to worry about directly of the slope, as water always starts at 0, so any slope will be positive in effect
69
+ */
70
+ CellFilterSmoothStep.from(
71
+ CellFilterLiteralFloat.from(35 * DEG_TO_RAD),
72
+ CellFilterLiteralFloat.from(10 * DEG_TO_RAD),
73
+ SLOPE
74
+ ),
75
+ )
76
+ )
77
+ ),
78
+ 3, 3, 1
79
+ )
80
+ );
81
+ };
75
82
 
@@ -1,3 +1,8 @@
1
1
  import { CellFilterSimplexNoise } from "../../../src/generation/filtering/numeric/complex/CellFilterSimplexNoise.js";
2
2
 
3
- export const SampleNoise20_0 = CellFilterSimplexNoise.from(20, 20);
3
+ /**
4
+ * Factory, a fresh filter graph is required per generation — filters bake per-run state
5
+ * (noise seed) on initialize.
6
+ * @returns {CellFilter}
7
+ */
8
+ export const SampleNoise20_0 = () => CellFilterSimplexNoise.from(20, 20);
@@ -1,67 +1,67 @@
1
- import { Theme } from "../../../src/generation/theme/Theme.js";
2
- import { TerrainTheme } from "../../../src/generation/theme/TerrainTheme.js";
3
- import { TerrainLayerRule } from "../../../src/generation/theme/TerrainLayerRule.js";
4
- import { MarkerProcessingRule } from "../../../src/generation/markers/actions/MarkerProcessingRule.js";
5
- import { MarkerNodeMatcherByType } from "../../../src/generation/markers/matcher/MarkerNodeMatcherByType.js";
6
- import {
7
- MarkerNodeActionEntityPlacement
8
- } from "../../../src/generation/markers/actions/MarkerNodeActionEntityPlacement.js";
1
+ import { MirMarkerTypes } from "../../../../generator/MirMarkerTypes.js";
2
+ import GeneratedArmy from "../../../../model/game/ecs/component/generator/army/GeneratedArmy.js";
3
+ import Vector2 from "../../../src/core/geom/Vector2js";
4
+ import Vector3 from "../../../src/core/geom/Vector3js";
5
+ import { PI_HALF } from "../../../src/core/math/PI_HALF.js";
6
+ import Tag from "../../../src/engine/ecs/components/Tagjs";
9
7
  import { EntityBlueprint } from "../../../src/engine/ecs/EntityBlueprint.js";
10
- import Mesh from "../../../src/engine/graphics/ecs/mesh/Mesh.js";
8
+ import GUIElement from "../../../src/engine/ecs/gui/GUIElementjs";
9
+ import HeadsUpDisplay from "../../../src/engine/ecs/gui/hud/HeadsUpDisplay.js";
10
+ import ViewportPosition from "../../../src/engine/ecs/gui/position/ViewportPosition.js";
11
+ import ClingToTerrain from "../../../src/engine/ecs/terrain/ecs/cling/ClingToTerrain.js";
11
12
  import { Transform } from "../../../src/engine/ecs/transform/Transform.js";
13
+ import Mesh from "../../../src/engine/graphics/ecs/mesh/Mesh.js";
14
+ import { ParticleEmitter } from "../../../src/engine/graphics/particles/particular/engine/emitter/ParticleEmitterjs";
12
15
  import GridPosition from "../../../src/engine/grid/position/GridPosition.js";
13
- import { matcher_tag_not_traversable } from "../rules/matcher_tag_not_traversable.js";
14
- import { CellMatcherLayerBitMaskTest } from "../../../src/generation/rules/CellMatcherLayerBitMaskTest.js";
15
- import { GridTags } from "../grid/GridTags.js";
16
+ import { SoundEmitter } from "../../../src/engine/sound/ecs/emitter/SoundEmitter.js";
16
17
  import { CellFilterCellMatcher } from "../../../src/generation/filtering/CellFilterCellMatcher.js";
17
- import { CellFilterSimplexNoise } from "../../../src/generation/filtering/numeric/complex/CellFilterSimplexNoise.js";
18
+ import { CellFilterCache } from "../../../src/generation/filtering/numeric/CellFilterCache.js";
19
+ import { CellFilterLiteralFloat } from "../../../src/generation/filtering/numeric/CellFilterLiteralFloat.js";
20
+ import { CellFilterAngleToNormal } from "../../../src/generation/filtering/numeric/complex/CellFilterAngleToNormal.js";
18
21
  import { CellFilterFXAA } from "../../../src/generation/filtering/numeric/complex/CellFilterFXAA.js";
22
+ import { CellFilterGaussianBlur } from "../../../src/generation/filtering/numeric/complex/CellFilterGaussianBlur.js";
23
+ import { CellFilterSimplexNoise } from "../../../src/generation/filtering/numeric/complex/CellFilterSimplexNoise.js";
24
+ import { CellFilterAdd } from "../../../src/generation/filtering/numeric/math/algebra/CellFilterAdd.js";
19
25
  import { CellFilterMultiply } from "../../../src/generation/filtering/numeric/math/algebra/CellFilterMultiply.js";
26
+ import { CellFilterNegate } from "../../../src/generation/filtering/numeric/math/algebra/CellFilterNegate.js";
27
+ import { CellFilterClamp } from "../../../src/generation/filtering/numeric/math/CellFilterClamp.js";
28
+ import { CellFilterInverseLerp } from "../../../src/generation/filtering/numeric/math/CellFilterInverseLerp.js";
20
29
  import { CellFilterLerp } from "../../../src/generation/filtering/numeric/math/CellFilterLerp.js";
21
- import { CellFilterLiteralFloat } from "../../../src/generation/filtering/numeric/CellFilterLiteralFloat.js";
22
- import Tag from "../../../src/engine/ecs/components/Tagjs";
23
- import HeadsUpDisplay from "../../../src/engine/ecs/gui/hud/HeadsUpDisplay.js";
24
- import ViewportPosition from "../../../src/engine/ecs/gui/position/ViewportPosition.js";
25
- import GUIElement from "../../../src/engine/ecs/gui/GUIElementjs";
30
+ import { CellFilterOneMinus } from "../../../src/generation/filtering/numeric/math/CellFilterOneMinus.js";
31
+ import { CellFilterSmoothStep } from "../../../src/generation/filtering/numeric/math/CellFilterSmoothStep.js";
26
32
  import {
27
- MarkerNodeTransformerYRotateByFilterGradient
28
- } from "../../../src/generation/markers/transform/MarkerNodeTransformerYRotateByFilterGradient.js";
29
- import { CellFilterGaussianBlur } from "../../../src/generation/filtering/numeric/complex/CellFilterGaussianBlur.js";
30
- import { CellProcessingRule } from "../../../src/generation/theme/cell/CellProcessingRule.js";
33
+ CellFilterSampleLayerLinear
34
+ } from "../../../src/generation/filtering/numeric/sampling/CellFilterSampleLayerLinear.js";
31
35
  import {
32
36
  ContinuousGridCellActionSetTerrainHeight
33
37
  } from "../../../src/generation/grid/actions/ContinuousGridCellActionSetTerrainHeight.js";
34
- import { MirGridLayers } from "../grid/MirGridLayers.js";
35
38
  import {
36
- CellFilterSampleLayerLinear
37
- } from "../../../src/generation/filtering/numeric/sampling/CellFilterSampleLayerLinear.js";
38
- import ClingToTerrain from "../../../src/engine/ecs/terrain/ecs/cling/ClingToTerrain.js";
39
+ MarkerNodeActionEntityPlacement
40
+ } from "../../../src/generation/markers/actions/MarkerNodeActionEntityPlacement.js";
41
+ import { MarkerProcessingRule } from "../../../src/generation/markers/actions/MarkerProcessingRule.js";
39
42
  import {
40
- MarkerNodeTransformerYRotateByFilter
41
- } from "../../../src/generation/markers/transform/MarkerNodeTransformerYRotateByFilter.js";
42
- import { CellFilterAngleToNormal } from "../../../src/generation/filtering/numeric/complex/CellFilterAngleToNormal.js";
43
- import Vector3 from "../../../src/core/geom/Vector3js";
44
- import { CellFilterClamp } from "../../../src/generation/filtering/numeric/math/CellFilterClamp.js";
45
- import { CellFilterOneMinus } from "../../../src/generation/filtering/numeric/math/CellFilterOneMinus.js";
46
- import { CellFilterSmoothStep } from "../../../src/generation/filtering/numeric/math/CellFilterSmoothStep.js";
47
- import { CellFilterInverseLerp } from "../../../src/generation/filtering/numeric/math/CellFilterInverseLerp.js";
48
- import { CellFilterAdd } from "../../../src/generation/filtering/numeric/math/algebra/CellFilterAdd.js";
49
- import { CellFilterNegate } from "../../../src/generation/filtering/numeric/math/algebra/CellFilterNegate.js";
43
+ MarkerNodeActionSelectWeighted
44
+ } from "../../../src/generation/markers/actions/probability/MarkerNodeActionSelectWeighted.js";
50
45
  import {
51
46
  MarkerNodeActionWeightedElement
52
47
  } from "../../../src/generation/markers/actions/probability/MarkerNodeActionWeightedElement.js";
48
+ import { MarkerNodeMatcherByType } from "../../../src/generation/markers/matcher/MarkerNodeMatcherByType.js";
53
49
  import {
54
- MarkerNodeActionSelectWeighted
55
- } from "../../../src/generation/markers/actions/probability/MarkerNodeActionSelectWeighted.js";
56
- import { ParticleEmitter } from "../../../src/engine/graphics/particles/particular/engine/emitter/ParticleEmitterjs";
57
- import { CellFilterCache } from "../../../src/generation/filtering/numeric/CellFilterCache.js";
58
- import { SoundEmitter } from "../../../src/engine/sound/ecs/emitter/SoundEmitter.js";
59
- import { SampleGroundMoistureFilter } from "../filters/SampleGroundMoistureFilter.js";
60
- import GeneratedArmy from "../../../../model/game/ecs/component/generator/army/GeneratedArmy.js";
61
- import { MirMarkerTypes } from "../../../../generator/MirMarkerTypes.js";
50
+ MarkerNodeTransformerYRotateByFilter
51
+ } from "../../../src/generation/markers/transform/MarkerNodeTransformerYRotateByFilter.js";
52
+ import {
53
+ MarkerNodeTransformerYRotateByFilterGradient
54
+ } from "../../../src/generation/markers/transform/MarkerNodeTransformerYRotateByFilterGradient.js";
55
+ import { CellMatcherLayerBitMaskTest } from "../../../src/generation/rules/CellMatcherLayerBitMaskTest.js";
56
+ import { CellProcessingRule } from "../../../src/generation/theme/cell/CellProcessingRule.js";
62
57
  import { TerrainLayerDescription } from "../../../src/generation/theme/TerrainLayerDescription.js";
63
- import Vector2 from "../../../src/core/geom/Vector2js";
64
- import { PI_HALF } from "../../../src/core/math/PI_HALF.js";
58
+ import { TerrainLayerRule } from "../../../src/generation/theme/TerrainLayerRule.js";
59
+ import { TerrainTheme } from "../../../src/generation/theme/TerrainTheme.js";
60
+ import { Theme } from "../../../src/generation/theme/Theme.js";
61
+ import { SampleGroundMoistureFilter } from "../filters/SampleGroundMoistureFilter.js";
62
+ import { GridTags } from "../grid/GridTags.js";
63
+ import { MirGridLayers } from "../grid/MirGridLayers.js";
64
+ import { matcher_tag_not_traversable } from "../rules/matcher_tag_not_traversable.js";
65
65
 
66
66
  export const SampleTheme0 = new Theme();
67
67
 
@@ -1061,7 +1061,7 @@ const filterAridArea = CellFilterClamp.from(
1061
1061
  CellFilterInverseLerp.from(
1062
1062
  CellFilterLiteralFloat.from(0.5),
1063
1063
  CellFilterLiteralFloat.from(0.1),
1064
- SampleGroundMoistureFilter
1064
+ SampleGroundMoistureFilter()
1065
1065
  ),
1066
1066
  CellFilterLiteralFloat.from(0),
1067
1067
  CellFilterLiteralFloat.from(1)
@@ -0,0 +1,91 @@
1
+ /**
2
+ * A 2D bitmap with word-packed rows (one bit per cell), built for atlas
3
+ * packing: fast shifted-OR collision tests between a chart mask and the atlas
4
+ * occupancy, plus blit, dilation and content-preserving growth. This is the
5
+ * `BitImage` xatlas uses for `canBlit` placement; meep's 1D {@link BitSet} has
6
+ * no 2D addressing or shifted collision, so this is a distinct structure.
7
+ *
8
+ * Rows are padded to whole 32-bit words. Bits at column >= width are never set
9
+ * (set() enforces the bound), so the trailing-word garbage that would otherwise
10
+ * break a shifted collision test simply does not exist — no explicit masking is
11
+ * needed.
12
+ *
13
+ * Fields are public so packing hot loops can read `data`/`words_per_row`
14
+ * directly, mirroring CSRGraph.
15
+ */
16
+ export class BitImage2 {
17
+ /**
18
+ * @param {number} width
19
+ * @param {number} height
20
+ */
21
+ constructor(width: number, height: number);
22
+ width: number;
23
+ height: number;
24
+ words_per_row: number;
25
+ data: Uint32Array;
26
+ /** @param {number} x @param {number} y @returns {number} 0 or 1 */
27
+ get(x: number, y: number): number;
28
+ /**
29
+ * Set the bit at (x, y). x must be < width (no out-of-row bits).
30
+ *
31
+ * @param {number} x
32
+ * @param {number} y
33
+ */
34
+ set(x: number, y: number): void;
35
+ /** Zero every bit. */
36
+ reset(): void;
37
+ /** @returns {number} number of set bits */
38
+ cardinality(): number;
39
+ /**
40
+ * Can `other` be placed with its (0,0) at (ox, oy) of this image without
41
+ * overlapping any set bit and while fitting fully inside the bounds?
42
+ *
43
+ * @param {BitImage2} other
44
+ * @param {number} ox
45
+ * @param {number} oy
46
+ * @returns {boolean}
47
+ */
48
+ canBlit(other: BitImage2, ox: number, oy: number): boolean;
49
+ /**
50
+ * OR `other`'s set bits into this image with its (0,0) at (ox, oy). Caller
51
+ * must have verified placement with {@link canBlit}.
52
+ *
53
+ * @param {BitImage2} other
54
+ * @param {number} ox
55
+ * @param {number} oy
56
+ */
57
+ or_blit(other: BitImage2, ox: number, oy: number): void;
58
+ /**
59
+ * Grow the set region by `passes` cells (Chebyshev / 3x3 OR per pass),
60
+ * in place. Used to reserve the padding gutter around a chart mask.
61
+ *
62
+ * @param {number} passes
63
+ */
64
+ dilate(passes: number): void;
65
+ /**
66
+ * Grow to (new_width, new_height) >= current, preserving content. The row
67
+ * stride changes when the word count per row changes, so each row must be
68
+ * re-laid-out — a flat copy would corrupt the image.
69
+ *
70
+ * @param {number} new_width
71
+ * @param {number} new_height
72
+ */
73
+ grow_preserving(new_width: number, new_height: number): void;
74
+ /**
75
+ * A new image that is this image transposed (x/y swapped): the 90-degree
76
+ * orientation tried during rotated chart placement. Allocates the target;
77
+ * use {@link copy_transposed} to transpose into a reused buffer.
78
+ *
79
+ * @returns {BitImage2}
80
+ */
81
+ transposed(): BitImage2;
82
+ /**
83
+ * Write this image's transpose (x/y swapped) into `out` — the non-allocating
84
+ * path. `out` is cleared first and must be sized (this.height x this.width).
85
+ * Bit count is preserved.
86
+ *
87
+ * @param {BitImage2} out target image, dimensions (this.height, this.width)
88
+ */
89
+ copy_transposed(out: BitImage2): void;
90
+ }
91
+ //# sourceMappingURL=BitImage2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BitImage2.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/BitImage2.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH;IACI;;;OAGG;IACH,mBAHW,MAAM,UACN,MAAM,EAUhB;IAJG,cAAkB;IAClB,eAAoB;IACpB,sBAAuD;IACvD,kBAAqE;IAGzE,mEAAmE;IACnE,OADY,MAAM,KAAY,MAAM,GAAc,MAAM,CAGvD;IAED;;;;;OAKG;IACH,OAHW,MAAM,KACN,MAAM,QAIhB;IAED,sBAAsB;IACtB,cAEC;IAED,2CAA2C;IAC3C,eADc,MAAM,CAanB;IAED;;;;;;;;OAQG;IACH,eALW,SAAS,MACT,MAAM,MACN,MAAM,GACJ,OAAO,CAkCnB;IAED;;;;;;;OAOG;IACH,eAJW,SAAS,MACT,MAAM,MACN,MAAM,QAwBhB;IAED;;;;;OAKG;IACH,eAFW,MAAM,QA0BhB;IAED;;;;;;;OAOG;IACH,2BAHW,MAAM,cACN,MAAM,QA0BhB;IAED;;;;;;OAMG;IACH,cAFa,SAAS,CAMrB;IAED;;;;;;OAMG;IACH,qBAFW,SAAS,QAcnB;CACJ"}
@@ -0,0 +1,242 @@
1
+ import { assert } from "../assert.js";
2
+
3
+ /**
4
+ * A 2D bitmap with word-packed rows (one bit per cell), built for atlas
5
+ * packing: fast shifted-OR collision tests between a chart mask and the atlas
6
+ * occupancy, plus blit, dilation and content-preserving growth. This is the
7
+ * `BitImage` xatlas uses for `canBlit` placement; meep's 1D {@link BitSet} has
8
+ * no 2D addressing or shifted collision, so this is a distinct structure.
9
+ *
10
+ * Rows are padded to whole 32-bit words. Bits at column >= width are never set
11
+ * (set() enforces the bound), so the trailing-word garbage that would otherwise
12
+ * break a shifted collision test simply does not exist — no explicit masking is
13
+ * needed.
14
+ *
15
+ * Fields are public so packing hot loops can read `data`/`words_per_row`
16
+ * directly, mirroring CSRGraph.
17
+ */
18
+ export class BitImage2 {
19
+ /**
20
+ * @param {number} width
21
+ * @param {number} height
22
+ */
23
+ constructor(width, height) {
24
+ assert.isNonNegativeInteger(width, "width");
25
+ assert.isNonNegativeInteger(height, "height");
26
+
27
+ this.width = width;
28
+ this.height = height;
29
+ this.words_per_row = Math.max(1, Math.ceil(width / 32));
30
+ this.data = new Uint32Array(this.words_per_row * Math.max(1, height));
31
+ }
32
+
33
+ /** @param {number} x @param {number} y @returns {number} 0 or 1 */
34
+ get(x, y) {
35
+ return (this.data[y * this.words_per_row + (x >>> 5)] >>> (x & 31)) & 1;
36
+ }
37
+
38
+ /**
39
+ * Set the bit at (x, y). x must be < width (no out-of-row bits).
40
+ *
41
+ * @param {number} x
42
+ * @param {number} y
43
+ */
44
+ set(x, y) {
45
+ this.data[y * this.words_per_row + (x >>> 5)] |= (1 << (x & 31));
46
+ }
47
+
48
+ /** Zero every bit. */
49
+ reset() {
50
+ this.data.fill(0);
51
+ }
52
+
53
+ /** @returns {number} number of set bits */
54
+ cardinality() {
55
+ const data = this.data;
56
+ let count = 0;
57
+ for (let i = 0; i < data.length; i++) {
58
+ let w = data[i];
59
+ // Hamming weight (SWAR popcount)
60
+ w = w - ((w >>> 1) & 0x55555555);
61
+ w = (w & 0x33333333) + ((w >>> 2) & 0x33333333);
62
+ w = (w + (w >>> 4)) & 0x0f0f0f0f;
63
+ count += (Math.imul(w, 0x01010101) >>> 24);
64
+ }
65
+ return count;
66
+ }
67
+
68
+ /**
69
+ * Can `other` be placed with its (0,0) at (ox, oy) of this image without
70
+ * overlapping any set bit and while fitting fully inside the bounds?
71
+ *
72
+ * @param {BitImage2} other
73
+ * @param {number} ox
74
+ * @param {number} oy
75
+ * @returns {boolean}
76
+ */
77
+ canBlit(other, ox, oy) {
78
+ if (ox < 0 || oy < 0 || ox + other.width > this.width || oy + other.height > this.height) {
79
+ return false;
80
+ }
81
+
82
+ const ow = other.words_per_row;
83
+ const tw = this.words_per_row;
84
+ const oh = other.height;
85
+
86
+ for (let r = 0; r < oh; r++) {
87
+ const o_base = r * ow;
88
+ const t_base = (oy + r) * tw;
89
+ for (let w = 0; w < ow; w++) {
90
+ const ov = other.data[o_base + w];
91
+ if (ov === 0) {
92
+ continue;
93
+ }
94
+ const bit = ox + (w << 5);
95
+ const wi = bit >>> 5;
96
+ const bo = bit & 31;
97
+ if ((this.data[t_base + wi] & (ov << bo)) !== 0) {
98
+ return false;
99
+ }
100
+ if (bo !== 0) {
101
+ const hi = ov >>> (32 - bo);
102
+ if (hi !== 0 && (this.data[t_base + wi + 1] & hi) !== 0) {
103
+ return false;
104
+ }
105
+ }
106
+ }
107
+ }
108
+ return true;
109
+ }
110
+
111
+ /**
112
+ * OR `other`'s set bits into this image with its (0,0) at (ox, oy). Caller
113
+ * must have verified placement with {@link canBlit}.
114
+ *
115
+ * @param {BitImage2} other
116
+ * @param {number} ox
117
+ * @param {number} oy
118
+ */
119
+ or_blit(other, ox, oy) {
120
+ const ow = other.words_per_row;
121
+ const tw = this.words_per_row;
122
+ const oh = other.height;
123
+
124
+ for (let r = 0; r < oh; r++) {
125
+ const o_base = r * ow;
126
+ const t_base = (oy + r) * tw;
127
+ for (let w = 0; w < ow; w++) {
128
+ const ov = other.data[o_base + w];
129
+ if (ov === 0) {
130
+ continue;
131
+ }
132
+ const bit = ox + (w << 5);
133
+ const wi = bit >>> 5;
134
+ const bo = bit & 31;
135
+ this.data[t_base + wi] |= (ov << bo);
136
+ if (bo !== 0) {
137
+ this.data[t_base + wi + 1] |= (ov >>> (32 - bo));
138
+ }
139
+ }
140
+ }
141
+ }
142
+
143
+ /**
144
+ * Grow the set region by `passes` cells (Chebyshev / 3x3 OR per pass),
145
+ * in place. Used to reserve the padding gutter around a chart mask.
146
+ *
147
+ * @param {number} passes
148
+ */
149
+ dilate(passes) {
150
+ const wpr = this.words_per_row;
151
+ const W = this.width;
152
+ const H = this.height;
153
+
154
+ for (let p = 0; p < passes; p++) {
155
+ const src = this.data.slice();
156
+ for (let y = 0; y < H; y++) {
157
+ for (let x = 0; x < W; x++) {
158
+ if (((src[y * wpr + (x >>> 5)] >>> (x & 31)) & 1) === 0) {
159
+ continue;
160
+ }
161
+ const x0 = x > 0 ? x - 1 : 0;
162
+ const x1 = x < W - 1 ? x + 1 : W - 1;
163
+ const y0 = y > 0 ? y - 1 : 0;
164
+ const y1 = y < H - 1 ? y + 1 : H - 1;
165
+ for (let yy = y0; yy <= y1; yy++) {
166
+ for (let xx = x0; xx <= x1; xx++) {
167
+ this.set(xx, yy);
168
+ }
169
+ }
170
+ }
171
+ }
172
+ }
173
+ }
174
+
175
+ /**
176
+ * Grow to (new_width, new_height) >= current, preserving content. The row
177
+ * stride changes when the word count per row changes, so each row must be
178
+ * re-laid-out — a flat copy would corrupt the image.
179
+ *
180
+ * @param {number} new_width
181
+ * @param {number} new_height
182
+ */
183
+ grow_preserving(new_width, new_height) {
184
+ assert.greaterThanOrEqual(new_width, this.width, "new_width");
185
+ assert.greaterThanOrEqual(new_height, this.height, "new_height");
186
+
187
+ if (new_width === this.width && new_height === this.height) {
188
+ return;
189
+ }
190
+
191
+ const new_wpr = Math.max(1, Math.ceil(new_width / 32));
192
+ const new_data = new Uint32Array(new_wpr * Math.max(1, new_height));
193
+
194
+ const copy_words = Math.min(this.words_per_row, new_wpr);
195
+ for (let y = 0; y < this.height; y++) {
196
+ const src_base = y * this.words_per_row;
197
+ const dst_base = y * new_wpr;
198
+ for (let w = 0; w < copy_words; w++) {
199
+ new_data[dst_base + w] = this.data[src_base + w];
200
+ }
201
+ }
202
+
203
+ this.width = new_width;
204
+ this.height = new_height;
205
+ this.words_per_row = new_wpr;
206
+ this.data = new_data;
207
+ }
208
+
209
+ /**
210
+ * A new image that is this image transposed (x/y swapped): the 90-degree
211
+ * orientation tried during rotated chart placement. Allocates the target;
212
+ * use {@link copy_transposed} to transpose into a reused buffer.
213
+ *
214
+ * @returns {BitImage2}
215
+ */
216
+ transposed() {
217
+ const out = new BitImage2(this.height, this.width);
218
+ this.copy_transposed(out);
219
+ return out;
220
+ }
221
+
222
+ /**
223
+ * Write this image's transpose (x/y swapped) into `out` — the non-allocating
224
+ * path. `out` is cleared first and must be sized (this.height x this.width).
225
+ * Bit count is preserved.
226
+ *
227
+ * @param {BitImage2} out target image, dimensions (this.height, this.width)
228
+ */
229
+ copy_transposed(out) {
230
+ assert.equal(out.width, this.height, "out.width must equal this.height");
231
+ assert.equal(out.height, this.width, "out.height must equal this.width");
232
+
233
+ out.reset();
234
+ for (let y = 0; y < this.height; y++) {
235
+ for (let x = 0; x < this.width; x++) {
236
+ if (this.get(x, y) === 1) {
237
+ out.set(y, x);
238
+ }
239
+ }
240
+ }
241
+ }
242
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Convert a linear RGB triple to YCoCg (luminance / chroma-orange / chroma-green).
3
+ *
4
+ * The transform is a plain linear map, so it is HDR-safe (works for values outside [0,1]) and, crucially,
5
+ * commutes with linear interpolation: lerp(ycocg(a), ycocg(b)) === ycocg(lerp(a, b)). That is what lets YCoCg data
6
+ * be hardware-filtered (bilinear / trilinear) exactly as if it were RGB, and reconstructed afterwards.
7
+ *
8
+ * Inverse of {@link ycocg_to_rgb}.
9
+ *
10
+ * @param {number[]|Float32Array|Float64Array} result Y, Co, Cg are written at result_offset, +1, +2
11
+ * @param {number} result_offset
12
+ * @param {number} r
13
+ * @param {number} g
14
+ * @param {number} b
15
+ */
16
+ export function rgb_to_ycocg(result: number[] | Float32Array | Float64Array, result_offset: number, r: number, g: number, b: number): void;
17
+ //# sourceMappingURL=rgb_to_ycocg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rgb_to_ycocg.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/YCoCg/rgb_to_ycocg.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,qCANW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,iBAClC,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,QAMhB"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Convert a linear RGB triple to YCoCg (luminance / chroma-orange / chroma-green).
3
+ *
4
+ * The transform is a plain linear map, so it is HDR-safe (works for values outside [0,1]) and, crucially,
5
+ * commutes with linear interpolation: lerp(ycocg(a), ycocg(b)) === ycocg(lerp(a, b)). That is what lets YCoCg data
6
+ * be hardware-filtered (bilinear / trilinear) exactly as if it were RGB, and reconstructed afterwards.
7
+ *
8
+ * Inverse of {@link ycocg_to_rgb}.
9
+ *
10
+ * @param {number[]|Float32Array|Float64Array} result Y, Co, Cg are written at result_offset, +1, +2
11
+ * @param {number} result_offset
12
+ * @param {number} r
13
+ * @param {number} g
14
+ * @param {number} b
15
+ */
16
+ export function rgb_to_ycocg(result, result_offset, r, g, b) {
17
+ result[result_offset] = 0.25 * r + 0.5 * g + 0.25 * b; // Y
18
+ result[result_offset + 1] = 0.5 * r - 0.5 * b; // Co
19
+ result[result_offset + 2] = -0.25 * r + 0.5 * g - 0.25 * b; // Cg
20
+ }