@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
@@ -36,6 +36,15 @@ export class BinarySerializationRegistry {
36
36
  * @returns {BinaryClassSerializationAdapter|undefined}
37
37
  */
38
38
  removeAdapter(className: string): BinaryClassSerializationAdapter | undefined;
39
+ /**
40
+ * Reverse of {@link registerAdapter}: resolve the registered class name for a given class (constructor).
41
+ * Useful when serializing a value whose class name is not known up-front — obtain the constructor via
42
+ * `Object.getPrototypeOf(value).constructor` and look it up here. Does not read or mutate any instance.
43
+ *
44
+ * @param {Function} klass class/constructor to look up
45
+ * @returns {string|undefined} the class name under which an adapter is registered, or `undefined` if none
46
+ */
47
+ getClassName(klass: Function): string | undefined;
39
48
  /**
40
49
  *
41
50
  * @param {string} className
@@ -62,5 +71,6 @@ export class BinarySerializationRegistry {
62
71
  * @type {boolean}
63
72
  */
64
73
  readonly isBinarySerializationRegistry: boolean;
74
+ #private;
65
75
  }
66
76
  //# sourceMappingURL=BinarySerializationRegistry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BinarySerializationRegistry.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/storage/binary/BinarySerializationRegistry.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH;IAEI;;;;OAIG;IACH,2BAAsB;IACtB;;;;OAIG;IACH,6BAAwB;IAExB;;;OAGG;IACH,2BAFW,iCAAiC,QAM3C;IAED;;;;;;OAMG;IACH,sEAJW,MAAM,GACJ,OAAO,CAkCnB;IAED;;;;OAIG;IACH,yBAHW,MAAM,GACJ,kCAAgC,SAAS,CAYrD;IAED;;;;OAIG;IACH,sBAHW,MAAM,GACJ,kCAAgC,SAAS,CAMrD;IAED;;;;;OAKG;IACH,4BAJW,MAAM,kCAEJ,OAAO,CA6CnB;IAED;;;;;;OAMG;IACH,6BALW,MAAM,gBACN,MAAM,eACN,MAAM,GACJ,qBAAqB,GAAC,IAAI,CA0DtC;IAIL;;;OAGG;IACH,wCAFU,OAAO,CAEkD;CANlE"}
1
+ {"version":3,"file":"BinarySerializationRegistry.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/storage/binary/BinarySerializationRegistry.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH;IAEI;;;;OAIG;IACH,2BAAsB;IACtB;;;;OAIG;IACH,6BAAwB;IAWxB;;;OAGG;IACH,2BAFW,iCAAiC,QAM3C;IAED;;;;;;OAMG;IACH,sEAJW,MAAM,GACJ,OAAO,CAyCnB;IAED;;;;OAIG;IACH,yBAHW,MAAM,GACJ,kCAAgC,SAAS,CA2BrD;IAED;;;;;;;OAOG;IACH,+BAFa,MAAM,GAAC,SAAS,CAI5B;IAED;;;;OAIG;IACH,sBAHW,MAAM,GACJ,kCAAgC,SAAS,CAMrD;IAED;;;;;OAKG;IACH,4BAJW,MAAM,kCAEJ,OAAO,CA6CnB;IAED;;;;;;OAMG;IACH,6BALW,MAAM,gBACN,MAAM,eACN,MAAM,GACJ,qBAAqB,GAAC,IAAI,CA0DtC;IAIL;;;OAGG;IACH,wCAFU,OAAO,CAEkD;;CANlE"}
@@ -22,6 +22,15 @@ export class BinarySerializationRegistry {
22
22
  */
23
23
  serializers = new Map();
24
24
 
25
+ /**
26
+ * Reverse index of the {@link serializers} map, keyed by the adapter's {@link BinaryClassSerializationAdapter.klass}.
27
+ * Lets callers resolve the registered class name of a value from its constructor without touching the value itself.
28
+ * When one class is registered under several names, the first registered name wins (mirrors {@link serializers}).
29
+ * @readonly
30
+ * @type {Map<Function, string>}
31
+ */
32
+ #klass_to_name = new Map();
33
+
25
34
  /**
26
35
  *
27
36
  * @param {BinaryClassSerializationAdapter[]} adapters
@@ -69,6 +78,13 @@ export class BinarySerializationRegistry {
69
78
 
70
79
  this.serializers.set(_className, adapter);
71
80
 
81
+ const klass = adapter.klass;
82
+
83
+ if (klass !== null && klass !== undefined && !this.#klass_to_name.has(klass)) {
84
+ // record reverse mapping, first registered name wins
85
+ this.#klass_to_name.set(klass, _className);
86
+ }
87
+
72
88
  return true;
73
89
  }
74
90
 
@@ -84,11 +100,38 @@ export class BinarySerializationRegistry {
84
100
 
85
101
  if (adapter !== undefined) {
86
102
  this.serializers.delete(className);
103
+
104
+ const klass = adapter.klass;
105
+
106
+ if (klass !== null && klass !== undefined && this.#klass_to_name.get(klass) === className) {
107
+ // this name owned the reverse mapping; hand it to another surviving name for the same class if
108
+ // one exists, so getClassName stays consistent when a class is registered under several names
109
+ this.#klass_to_name.delete(klass);
110
+
111
+ for (const [otherName, otherAdapter] of this.serializers) {
112
+ if (otherAdapter.klass === klass) {
113
+ this.#klass_to_name.set(klass, otherName);
114
+ break;
115
+ }
116
+ }
117
+ }
87
118
  }
88
119
 
89
120
  return adapter;
90
121
  }
91
122
 
123
+ /**
124
+ * Reverse of {@link registerAdapter}: resolve the registered class name for a given class (constructor).
125
+ * Useful when serializing a value whose class name is not known up-front — obtain the constructor via
126
+ * `Object.getPrototypeOf(value).constructor` and look it up here. Does not read or mutate any instance.
127
+ *
128
+ * @param {Function} klass class/constructor to look up
129
+ * @returns {string|undefined} the class name under which an adapter is registered, or `undefined` if none
130
+ */
131
+ getClassName(klass) {
132
+ return this.#klass_to_name.get(klass);
133
+ }
134
+
92
135
  /**
93
136
  *
94
137
  * @param {string} className
@@ -0,0 +1,93 @@
1
+ /**
2
+ * A resolved class-table entry. Migration is resolved lazily, on the first adapter-encoded object of the class,
3
+ * because whether a class was written via an adapter (and therefore whether the stored version needs migrating) is
4
+ * a property of the object tag in the body, not of the reader's registry.
5
+ *
6
+ * @typedef {Object} ResolvedClass
7
+ * @property {string} typeName
8
+ * @property {number} version version the data was written with
9
+ * @property {BinaryClassSerializationAdapter|undefined} adapter registered adapter, or undefined
10
+ * @property {Function|undefined} Klass constructor to instantiate, or undefined if unresolvable
11
+ * @property {BinaryClassUpgrader[]|null} migrators cached migrator chain (null = none needed)
12
+ * @property {boolean} migratorsResolved whether the migrator chain has been computed yet
13
+ */
14
+ /**
15
+ * Reader half of the general object-graph binary serializer. Consumes documents produced by
16
+ * {@link BinaryObjectSerializer}.
17
+ *
18
+ * Needs:
19
+ * - a {@link BinarySerializationRegistry} for hand-written adapters and version migrators;
20
+ * - a {@link ModuleRegistry} mapping `typeName -> class` so reflective (adapter-less) class instances can be
21
+ * reconstructed. It may be omitted if the data contains no reflective class instances (plain objects, arrays and
22
+ * adapter-backed classes need no module registry).
23
+ *
24
+ * @author Alex Goldring
25
+ * @copyright Company Named Limited (c) 2026
26
+ */
27
+ export class BinaryObjectDeSerializer {
28
+ /**
29
+ * @param {BinarySerializationRegistry} registry
30
+ * @param {ModuleRegistry} [modules] required only if the data contains reflective (adapter-less) class instances
31
+ */
32
+ constructor(registry: BinarySerializationRegistry, modules?: ModuleRegistry);
33
+ /**
34
+ * @param {BinarySerializationRegistry} registry
35
+ */
36
+ setRegistry(registry: BinarySerializationRegistry): void;
37
+ /**
38
+ * @param {ModuleRegistry} [modules]
39
+ */
40
+ setModuleRegistry(modules?: ModuleRegistry): void;
41
+ /**
42
+ * Deserialize a complete document written by {@link BinaryObjectSerializer.serialize}.
43
+ *
44
+ * @template T
45
+ * @param {BinaryBuffer} buffer source, read at the current {@link BinaryBuffer.position}
46
+ * @returns {T}
47
+ */
48
+ deserialize<T>(buffer: BinaryBuffer): T;
49
+ /**
50
+ * Read a single value. Nesting adapters call this to deserialize a child of any type.
51
+ *
52
+ * @template T
53
+ * @param {BinaryBuffer} buffer
54
+ * @returns {T}
55
+ */
56
+ readValue<T_1>(buffer: BinaryBuffer): T_1;
57
+ /**
58
+ * @readonly
59
+ * @type {boolean}
60
+ */
61
+ readonly isBinaryObjectDeSerializer: boolean;
62
+ #private;
63
+ }
64
+ /**
65
+ * A resolved class-table entry. Migration is resolved lazily, on the first adapter-encoded object of the class,
66
+ * because whether a class was written via an adapter (and therefore whether the stored version needs migrating) is
67
+ * a property of the object tag in the body, not of the reader's registry.
68
+ */
69
+ export type ResolvedClass = {
70
+ typeName: string;
71
+ /**
72
+ * version the data was written with
73
+ */
74
+ version: number;
75
+ /**
76
+ * registered adapter, or undefined
77
+ */
78
+ adapter: BinaryClassSerializationAdapter | undefined;
79
+ /**
80
+ * constructor to instantiate, or undefined if unresolvable
81
+ */
82
+ Klass: Function | undefined;
83
+ /**
84
+ * cached migrator chain (null = none needed)
85
+ */
86
+ migrators: BinaryClassUpgrader[] | null;
87
+ /**
88
+ * whether the migrator chain has been computed yet
89
+ */
90
+ migratorsResolved: boolean;
91
+ };
92
+ import { BinaryBuffer } from "../../../../../core/binary/BinaryBuffer.js";
93
+ //# sourceMappingURL=BinaryObjectDeSerializer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BinaryObjectDeSerializer.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/ecs/storage/binary/object-v2/BinaryObjectDeSerializer.js"],"names":[],"mappings":"AAuBA;;;;;;;;;;;;GAYG;AAEH;;;;;;;;;;;;GAYG;AACH;IA4BI;;;OAGG;IACH,6EAGC;IAED;;OAEG;IACH,yDAKC;IAED;;OAEG;IACH,kDAEC;IAED;;;;;;OAMG;IACH,uBAHW,YAAY,KAwCtB;IA0BD;;;;;;OAMG;IACH,uBAHW,YAAY,OAgDtB;IAoFL;;;OAGG;IACH,qCAFU,OAAO,CAE4C;;CAN5D;;;;;;;cAvRa,MAAM;;;;aACN,MAAM;;;;aACN,kCAAgC,SAAS;;;;WACzC,WAAS,SAAS;;;;eAClB,qBAAqB,GAAC,IAAI;;;;uBAC1B,OAAO;;6BAjCQ,4CAA4C"}
@@ -0,0 +1,315 @@
1
+ import { assert } from "../../../../../core/assert.js";
2
+ import { BinaryBuffer } from "../../../../../core/binary/BinaryBuffer.js";
3
+ import { executeBinaryClassUpgraderChain } from "../executeBinaryClassUpgraderChain.js";
4
+ import { readObjectString } from "./objectStringCodec.js";
5
+ import {
6
+ OBJECT_FORMAT_VERSION,
7
+ OBJECT_MAGIC,
8
+ TAG_ADAPTER_OBJECT,
9
+ TAG_ARRAY,
10
+ TAG_BIGINT,
11
+ TAG_FALSE,
12
+ TAG_FLOAT,
13
+ TAG_NEG_INT,
14
+ TAG_NULL,
15
+ TAG_PLAIN_OBJECT,
16
+ TAG_POS_INT,
17
+ TAG_REF,
18
+ TAG_REFLECT_OBJECT,
19
+ TAG_STRING,
20
+ TAG_TRUE,
21
+ TAG_UNDEFINED
22
+ } from "./ObjectBinaryFormat.js";
23
+
24
+ /**
25
+ * A resolved class-table entry. Migration is resolved lazily, on the first adapter-encoded object of the class,
26
+ * because whether a class was written via an adapter (and therefore whether the stored version needs migrating) is
27
+ * a property of the object tag in the body, not of the reader's registry.
28
+ *
29
+ * @typedef {Object} ResolvedClass
30
+ * @property {string} typeName
31
+ * @property {number} version version the data was written with
32
+ * @property {BinaryClassSerializationAdapter|undefined} adapter registered adapter, or undefined
33
+ * @property {Function|undefined} Klass constructor to instantiate, or undefined if unresolvable
34
+ * @property {BinaryClassUpgrader[]|null} migrators cached migrator chain (null = none needed)
35
+ * @property {boolean} migratorsResolved whether the migrator chain has been computed yet
36
+ */
37
+
38
+ /**
39
+ * Reader half of the general object-graph binary serializer. Consumes documents produced by
40
+ * {@link BinaryObjectSerializer}.
41
+ *
42
+ * Needs:
43
+ * - a {@link BinarySerializationRegistry} for hand-written adapters and version migrators;
44
+ * - a {@link ModuleRegistry} mapping `typeName -> class` so reflective (adapter-less) class instances can be
45
+ * reconstructed. It may be omitted if the data contains no reflective class instances (plain objects, arrays and
46
+ * adapter-backed classes need no module registry).
47
+ *
48
+ * @author Alex Goldring
49
+ * @copyright Company Named Limited (c) 2026
50
+ */
51
+ export class BinaryObjectDeSerializer {
52
+
53
+ /**
54
+ * @type {BinarySerializationRegistry|null}
55
+ */
56
+ #registry = null;
57
+
58
+ /**
59
+ * @type {ModuleRegistry|null}
60
+ */
61
+ #modules = null;
62
+
63
+ /**
64
+ * index -> reconstructed object/array, for resolving back-references and cycles.
65
+ * @type {Array<Object>}
66
+ */
67
+ #refs = [];
68
+
69
+ /**
70
+ * @type {ResolvedClass[]}
71
+ */
72
+ #classes = [];
73
+
74
+ /**
75
+ * @type {Array<string[]>}
76
+ */
77
+ #shapes = [];
78
+
79
+ /**
80
+ * @param {BinarySerializationRegistry} registry
81
+ * @param {ModuleRegistry} [modules] required only if the data contains reflective (adapter-less) class instances
82
+ */
83
+ constructor(registry, modules) {
84
+ this.setRegistry(registry);
85
+ this.setModuleRegistry(modules);
86
+ }
87
+
88
+ /**
89
+ * @param {BinarySerializationRegistry} registry
90
+ */
91
+ setRegistry(registry) {
92
+ assert.defined(registry, 'registry');
93
+ assert.ok(registry.isBinarySerializationRegistry, 'registry is not a BinarySerializationRegistry');
94
+
95
+ this.#registry = registry;
96
+ }
97
+
98
+ /**
99
+ * @param {ModuleRegistry} [modules]
100
+ */
101
+ setModuleRegistry(modules) {
102
+ this.#modules = modules === undefined ? null : modules;
103
+ }
104
+
105
+ /**
106
+ * Deserialize a complete document written by {@link BinaryObjectSerializer.serialize}.
107
+ *
108
+ * @template T
109
+ * @param {BinaryBuffer} buffer source, read at the current {@link BinaryBuffer.position}
110
+ * @returns {T}
111
+ */
112
+ deserialize(buffer) {
113
+ const magic = buffer.readUint16();
114
+
115
+ if (magic !== OBJECT_MAGIC) {
116
+ throw new Error(`Not an object-graph stream: expected magic 0x${OBJECT_MAGIC.toString(16).toUpperCase()}, read 0x${magic.toString(16).toUpperCase()}`);
117
+ }
118
+
119
+ const formatVersion = buffer.readUint8();
120
+
121
+ if (formatVersion !== OBJECT_FORMAT_VERSION) {
122
+ throw new Error(`Unsupported object-graph format version ${formatVersion}, this build supports ${OBJECT_FORMAT_VERSION}`);
123
+ }
124
+
125
+ this.#refs = [];
126
+ this.#classes = [];
127
+ this.#shapes = [];
128
+
129
+ // class table
130
+ const classCount = buffer.readUintVar();
131
+ for (let i = 0; i < classCount; i++) {
132
+ const typeName = readObjectString(buffer);
133
+ const version = buffer.readUintVar();
134
+ this.#classes.push(this.#resolveClass(typeName, version));
135
+ }
136
+
137
+ // shape table
138
+ const shapeCount = buffer.readUintVar();
139
+ for (let i = 0; i < shapeCount; i++) {
140
+ const fieldCount = buffer.readUintVar();
141
+ const names = new Array(fieldCount);
142
+ for (let j = 0; j < fieldCount; j++) {
143
+ names[j] = readObjectString(buffer);
144
+ }
145
+ this.#shapes.push(names);
146
+ }
147
+
148
+ return this.readValue(buffer);
149
+ }
150
+
151
+ /**
152
+ * Resolve a class name to its adapter and/or constructor. Does not resolve migrators — that is deferred to the
153
+ * first adapter-encoded object of the class (see {@link ResolvedClass}).
154
+ *
155
+ * @param {string} typeName
156
+ * @param {number} version
157
+ * @returns {ResolvedClass}
158
+ */
159
+ #resolveClass(typeName, version) {
160
+ const adapter = this.#registry.getAdapter(typeName);
161
+
162
+ let Klass;
163
+
164
+ if (adapter !== undefined) {
165
+ Klass = adapter.klass;
166
+ } else if (this.#modules !== null && this.#modules.has(typeName)) {
167
+ Klass = this.#modules.get(typeName);
168
+ } else {
169
+ Klass = undefined;
170
+ }
171
+
172
+ return { typeName, version, adapter, Klass, migrators: null, migratorsResolved: false };
173
+ }
174
+
175
+ /**
176
+ * Read a single value. Nesting adapters call this to deserialize a child of any type.
177
+ *
178
+ * @template T
179
+ * @param {BinaryBuffer} buffer
180
+ * @returns {T}
181
+ */
182
+ readValue(buffer) {
183
+ const tag = buffer.readUint8();
184
+
185
+ switch (tag) {
186
+ case TAG_NULL:
187
+ return null;
188
+ case TAG_UNDEFINED:
189
+ return undefined;
190
+ case TAG_FALSE:
191
+ return false;
192
+ case TAG_TRUE:
193
+ return true;
194
+ case TAG_POS_INT:
195
+ return buffer.readUintVar();
196
+ case TAG_NEG_INT:
197
+ return -buffer.readUintVar();
198
+ case TAG_FLOAT:
199
+ return buffer.readFloat64();
200
+ case TAG_STRING:
201
+ return readObjectString(buffer);
202
+ case TAG_BIGINT:
203
+ return BigInt(readObjectString(buffer));
204
+ case TAG_REF:
205
+ return this.#refs[buffer.readUintVar()];
206
+ case TAG_ARRAY:
207
+ return this.#readArray(buffer);
208
+ case TAG_PLAIN_OBJECT: {
209
+ const shapeIdx = buffer.readUintVar();
210
+ return this.#readReflected(buffer, {}, shapeIdx);
211
+ }
212
+ case TAG_REFLECT_OBJECT: {
213
+ const record = this.#classes[buffer.readUintVar()];
214
+ const shapeIdx = buffer.readUintVar();
215
+
216
+ if (record.Klass === undefined) {
217
+ throw new Error(`Cannot reconstruct reflective class '${record.typeName}': it is not in the module registry and has no registered adapter`);
218
+ }
219
+
220
+ return this.#readReflected(buffer, new record.Klass(), shapeIdx);
221
+ }
222
+ case TAG_ADAPTER_OBJECT:
223
+ return this.#readAdapterObject(buffer);
224
+ default:
225
+ throw new Error(`Unknown object-graph value tag ${tag}`);
226
+ }
227
+ }
228
+
229
+ /**
230
+ * @param {BinaryBuffer} buffer
231
+ * @returns {Array<*>}
232
+ */
233
+ #readArray(buffer) {
234
+ const length = buffer.readUintVar();
235
+
236
+ const array = [];
237
+ // register before filling so a cyclic element can refer back to this array
238
+ this.#refs.push(array);
239
+
240
+ for (let i = 0; i < length; i++) {
241
+ array.push(this.readValue(buffer));
242
+ }
243
+
244
+ return array;
245
+ }
246
+
247
+ /**
248
+ * @template T
249
+ * @param {BinaryBuffer} buffer
250
+ * @param {T} target freshly-constructed instance (or {}) to populate
251
+ * @param {number} shapeIdx
252
+ * @returns {T}
253
+ */
254
+ #readReflected(buffer, target, shapeIdx) {
255
+ // register before filling so a cyclic field can refer back to this object
256
+ this.#refs.push(target);
257
+
258
+ const names = this.#shapes[shapeIdx];
259
+
260
+ for (let i = 0; i < names.length; i++) {
261
+ target[names[i]] = this.readValue(buffer);
262
+ }
263
+
264
+ return target;
265
+ }
266
+
267
+ /**
268
+ * @param {BinaryBuffer} buffer
269
+ * @returns {Object}
270
+ */
271
+ #readAdapterObject(buffer) {
272
+ const record = this.#classes[buffer.readUintVar()];
273
+
274
+ if (record.adapter === undefined) {
275
+ throw new Error(`Cannot read adapter-encoded object of class '${record.typeName}': no adapter is registered`);
276
+ }
277
+
278
+ if (!record.migratorsResolved) {
279
+ if (record.version !== record.adapter.version) {
280
+ // migrate up OR down to the adapter's current version
281
+ const chain = this.#registry.getUpgradersChain(record.typeName, record.version, record.adapter.version);
282
+
283
+ if (chain === null) {
284
+ throw new Error(`No migration path for class '${record.typeName}' from version ${record.version} to ${record.adapter.version}`);
285
+ }
286
+
287
+ record.migrators = chain;
288
+ }
289
+
290
+ record.migratorsResolved = true;
291
+ }
292
+
293
+ const value = new record.Klass();
294
+ // register before the adapter reads, so a cyclic reference inside the payload resolves to this instance
295
+ this.#refs.push(value);
296
+
297
+ let payloadBuffer = buffer;
298
+
299
+ if (record.migrators !== null) {
300
+ // fresh scratch buffers keep migration re-entrant if the payload itself nests an object needing migration
301
+ payloadBuffer = executeBinaryClassUpgraderChain(record.migrators, buffer, new BinaryBuffer(), new BinaryBuffer());
302
+ }
303
+
304
+ record.adapter.initialize(this);
305
+ record.adapter.deserialize(payloadBuffer, value);
306
+
307
+ return value;
308
+ }
309
+ }
310
+
311
+ /**
312
+ * @readonly
313
+ * @type {boolean}
314
+ */
315
+ BinaryObjectDeSerializer.prototype.isBinaryObjectDeSerializer = true;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Writer half of the general object-graph binary serializer. See {@link BinaryObjectDeSerializer} for the reader
3
+ * and `DESIGN.md` for the wire format and rationale.
4
+ *
5
+ * Serializes an arbitrary value — primitives, arrays, plain objects and class instances — with **no per-class
6
+ * setup required**. Class instances are serialized by reflection over their own enumerable fields by default; if a
7
+ * class has a hand-written adapter registered in the {@link BinarySerializationRegistry}, that adapter is used
8
+ * instead (compact, custom, versioned). Shared references and cycles are preserved via first-seen object indices.
9
+ *
10
+ * Class names and reflective field-name sets are interned into two tables that are written ahead of the body, so
11
+ * repeated types cost their name once. The body is built into a scratch buffer first and copied in after the
12
+ * tables — the only extra work versus single-pass is that final byte copy.
13
+ *
14
+ * @author Alex Goldring
15
+ * @copyright Company Named Limited (c) 2026
16
+ */
17
+ export class BinaryObjectSerializer {
18
+ /**
19
+ * @param {BinarySerializationRegistry} registry
20
+ */
21
+ constructor(registry: BinarySerializationRegistry);
22
+ /**
23
+ * @param {BinarySerializationRegistry} registry
24
+ */
25
+ setRegistry(registry: BinarySerializationRegistry): void;
26
+ /**
27
+ * Serialize `value` and its whole object graph into `buffer` as a complete document (header + tables + body).
28
+ *
29
+ * @param {BinaryBuffer} buffer target, written at the current {@link BinaryBuffer.position}
30
+ * @param {*} value any value; objects may be plain, class instances (reflective or adapter-backed) or arrays
31
+ */
32
+ serialize(buffer: BinaryBuffer, value: any): void;
33
+ /**
34
+ * Write a single value. Nesting adapters call this to serialize a child of any type (including `null`).
35
+ *
36
+ * @param {BinaryBuffer} buffer
37
+ * @param {*} value
38
+ */
39
+ writeValue(buffer: BinaryBuffer, value: any): void;
40
+ /**
41
+ * @readonly
42
+ * @type {boolean}
43
+ */
44
+ readonly isBinaryObjectSerializer: boolean;
45
+ #private;
46
+ }
47
+ import { BinaryBuffer } from "../../../../../core/binary/BinaryBuffer.js";
48
+ //# sourceMappingURL=BinaryObjectSerializer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BinaryObjectSerializer.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/ecs/storage/binary/object-v2/BinaryObjectSerializer.js"],"names":[],"mappings":"AA6BA;;;;;;;;;;;;;;;GAeG;AACH;IA4CI;;OAEG;IACH,mDAEC;IAED;;OAEG;IACH,yDAKC;IAWD;;;;;OAKG;IACH,kBAHW,YAAY,oBAiCtB;IAqCD;;;;;OAKG;IACH,mBAHW,YAAY,oBA2GtB;IA4BL;;;OAGG;IACH,mCAFU,OAAO,CAEwC;;CANxD;6BAnU4B,4CAA4C"}