@woosh/meep-engine 2.165.0 → 2.165.2

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 (205) hide show
  1. package/README.md +137 -108
  2. package/build/bundle-worker-image-decoder.js +1 -1
  3. package/package.json +1 -1
  4. package/samples/generation/SampleGenerator0.js +3 -3
  5. package/samples/generation/filters/SampleGroundMoistureFilter.js +63 -56
  6. package/samples/generation/filters/SampleNoise20_0.js +6 -1
  7. package/samples/generation/themes/SampleTheme0.js +47 -47
  8. package/src/core/color/YCoCg/rgb_to_ycocg.d.ts +17 -0
  9. package/src/core/color/YCoCg/rgb_to_ycocg.d.ts.map +1 -0
  10. package/src/core/color/YCoCg/rgb_to_ycocg.js +20 -0
  11. package/src/core/color/YCoCg/ycocg_to_rgb.d.ts +14 -0
  12. package/src/core/color/YCoCg/ycocg_to_rgb.d.ts.map +1 -0
  13. package/src/core/color/YCoCg/ycocg_to_rgb.js +17 -0
  14. package/src/engine/REVIEW_2026_07_03.md +211 -0
  15. package/src/engine/animation/curve/actionProcessorOperations/curveActions.d.ts.map +1 -1
  16. package/src/engine/animation/curve/actionProcessorOperations/curveActions.js +3 -2
  17. package/src/engine/animation/curve/compression/sample_animation_curve_to_float_array.js +1 -1
  18. package/src/engine/animation/keyed2/AnimationTrackPlayback.d.ts.map +1 -1
  19. package/src/engine/animation/keyed2/AnimationTrackPlayback.js +3 -1
  20. package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterNone.js +2 -2
  21. package/src/engine/asset/preloader/AssetPreloader.d.ts.map +1 -1
  22. package/src/engine/asset/preloader/AssetPreloader.js +6 -0
  23. package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.d.ts.map +1 -1
  24. package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.js +5 -2
  25. package/src/engine/ecs/Entity.js +1 -1
  26. package/src/engine/ecs/EntityComponentDataset.d.ts.map +1 -1
  27. package/src/engine/ecs/EntityComponentDataset.js +1 -0
  28. package/src/engine/ecs/EntityManager.d.ts.map +1 -1
  29. package/src/engine/ecs/EntityManager.js +12 -8
  30. package/src/engine/ecs/EntityObserver.js +1 -1
  31. package/src/engine/ecs/System.d.ts.map +1 -1
  32. package/src/engine/ecs/System.js +4 -0
  33. package/src/engine/ecs/animation/AnimationClip.js +1 -1
  34. package/src/engine/ecs/attachment/AttachmentSystem.js +2 -2
  35. package/src/engine/ecs/attachment/TransformAttachmentBinding.d.ts.map +1 -1
  36. package/src/engine/ecs/attachment/TransformAttachmentBinding.js +11 -0
  37. package/src/engine/ecs/fow/FogOfWar.js +2 -2
  38. package/src/engine/ecs/fow/shader/screenSpaceFogOfWarShader.d.ts.map +1 -1
  39. package/src/engine/ecs/fow/shader/screenSpaceFogOfWarShader.js +27 -9
  40. package/src/engine/ecs/gui/hud/HeadsUpDisplaySystem.js +1 -1
  41. package/src/engine/ecs/gui/position/ViewportPosition.d.ts +3 -1
  42. package/src/engine/ecs/gui/position/ViewportPosition.d.ts.map +1 -1
  43. package/src/engine/ecs/gui/position/ViewportPosition.js +4 -1
  44. package/src/engine/ecs/storage/binary/BinarySerializationRegistry.d.ts +10 -0
  45. package/src/engine/ecs/storage/binary/BinarySerializationRegistry.d.ts.map +1 -1
  46. package/src/engine/ecs/storage/binary/BinarySerializationRegistry.js +43 -0
  47. package/src/engine/ecs/storage/binary/object-v2/BinaryObjectDeSerializer.d.ts +93 -0
  48. package/src/engine/ecs/storage/binary/object-v2/BinaryObjectDeSerializer.d.ts.map +1 -0
  49. package/src/engine/ecs/storage/binary/object-v2/BinaryObjectDeSerializer.js +315 -0
  50. package/src/engine/ecs/storage/binary/object-v2/BinaryObjectSerializer.d.ts +48 -0
  51. package/src/engine/ecs/storage/binary/object-v2/BinaryObjectSerializer.d.ts.map +1 -0
  52. package/src/engine/ecs/storage/binary/object-v2/BinaryObjectSerializer.js +331 -0
  53. package/src/engine/ecs/storage/binary/object-v2/DESIGN.md +199 -0
  54. package/src/engine/ecs/storage/binary/object-v2/ObjectBinaryFormat.d.ts +53 -0
  55. package/src/engine/ecs/storage/binary/object-v2/ObjectBinaryFormat.d.ts.map +1 -0
  56. package/src/engine/ecs/storage/binary/object-v2/ObjectBinaryFormat.js +57 -0
  57. package/src/engine/ecs/storage/binary/object-v2/ObjectSerializationAdapter.d.ts +53 -0
  58. package/src/engine/ecs/storage/binary/object-v2/ObjectSerializationAdapter.d.ts.map +1 -0
  59. package/src/engine/ecs/storage/binary/object-v2/ObjectSerializationAdapter.js +56 -0
  60. package/src/engine/ecs/storage/binary/object-v2/README.md +110 -0
  61. package/src/engine/ecs/storage/binary/object-v2/objectStringCodec.d.ts +13 -0
  62. package/src/engine/ecs/storage/binary/object-v2/objectStringCodec.d.ts.map +1 -0
  63. package/src/engine/ecs/storage/binary/object-v2/objectStringCodec.js +48 -0
  64. package/src/engine/ecs/storage/binary/object-v2/serializerTestHarness.d.ts +29 -0
  65. package/src/engine/ecs/storage/binary/object-v2/serializerTestHarness.d.ts.map +1 -0
  66. package/src/engine/ecs/storage/binary/object-v2/serializerTestHarness.js +44 -0
  67. package/src/engine/ecs/system_validate_class.d.ts.map +1 -1
  68. package/src/engine/ecs/system_validate_class.js +9 -2
  69. package/src/engine/graphics/camera/makeScreenScissorFrustum.d.ts.map +1 -1
  70. package/src/engine/graphics/camera/makeScreenScissorFrustum.js +11 -10
  71. package/src/engine/graphics/canvas/canvas2d_draw_linear_scale.d.ts.map +1 -1
  72. package/src/engine/graphics/canvas/canvas2d_draw_linear_scale.js +3 -1
  73. package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/readAnimationGraphDefinitionFromJSON.d.ts +1 -1
  74. package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/readAnimationGraphDefinitionFromJSON.d.ts.map +1 -1
  75. package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/readAnimationGraphDefinitionFromJSON.js +2 -2
  76. package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/writeAnimationGraphDefinitionToJSON.d.ts.map +1 -1
  77. package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/writeAnimationGraphDefinitionToJSON.js +2 -0
  78. package/src/engine/graphics/ecs/camera/Camera.d.ts.map +1 -1
  79. package/src/engine/graphics/ecs/camera/Camera.js +4 -0
  80. package/src/engine/graphics/ecs/camera/auto_set_camera_clipping_planes.d.ts.map +1 -1
  81. package/src/engine/graphics/ecs/camera/auto_set_camera_clipping_planes.js +7 -2
  82. package/src/engine/graphics/ecs/camera/set_camera_aspect_ratio.js +1 -1
  83. package/src/engine/graphics/ecs/highlight/system/ShadedGeometryHighlightSystem.d.ts.map +1 -1
  84. package/src/engine/graphics/ecs/highlight/system/ShadedGeometryHighlightSystem.js +4 -1
  85. package/src/engine/graphics/ecs/light/binding/LightBinding.js +2 -2
  86. package/src/engine/graphics/ecs/mesh/MeshSystem.js +1 -1
  87. package/src/engine/graphics/ecs/mesh/SkeletonUtils.js +1 -1
  88. package/src/engine/graphics/ecs/mesh-v2/sg_hierarchy_compute_bounding_box_via_parent_entity.js +1 -1
  89. package/src/engine/graphics/ecs/water/WaterSystem.d.ts +6 -0
  90. package/src/engine/graphics/ecs/water/WaterSystem.d.ts.map +1 -1
  91. package/src/engine/graphics/ecs/water/WaterSystem.js +12 -1
  92. package/src/engine/graphics/geometry/buffered/ensureGeometryBoundingSphere.js +1 -1
  93. package/src/engine/graphics/geometry/buffered/query/bvh32_geometry_nearest.d.ts.map +1 -1
  94. package/src/engine/graphics/geometry/buffered/query/bvh32_geometry_nearest.js +0 -15
  95. package/src/engine/graphics/geometry/instancing/InstancedMeshGroup.js +10 -10
  96. package/src/engine/graphics/geometry/optimization/merge/merge_geometry_hierarchy.js +1 -1
  97. package/src/engine/graphics/material/SplatMaterial.js +1 -1
  98. package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.d.ts.map +1 -1
  99. package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +3 -2
  100. package/src/engine/graphics/particles/particular/engine/emitter/ParticlePool.js +1 -1
  101. package/src/engine/graphics/particles/particular/group/ParticleGroup.d.ts.map +1 -1
  102. package/src/engine/graphics/particles/particular/group/ParticleGroup.js +3 -2
  103. package/src/engine/graphics/render/forward_plus/plugin/ForwardPlusRenderingPlugin.js +1 -1
  104. package/src/engine/graphics/sh3/gi/material/MaterialTransformer.d.ts +1 -8
  105. package/src/engine/graphics/sh3/gi/material/MaterialTransformer.d.ts.map +1 -1
  106. package/src/engine/graphics/sh3/gi/material/MaterialTransformer.js +2 -14
  107. package/src/engine/graphics/sh3/gi/material/ProbeResolutionStage.d.ts +9 -0
  108. package/src/engine/graphics/sh3/gi/material/ProbeResolutionStage.d.ts.map +1 -0
  109. package/src/engine/graphics/sh3/gi/material/ProbeResolutionStage.js +14 -0
  110. package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.d.ts.map +1 -1
  111. package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.js +4 -1
  112. package/src/engine/graphics/sh3/lpg/LightProbeGrid.d.ts +69 -0
  113. package/src/engine/graphics/sh3/lpg/LightProbeGrid.d.ts.map +1 -0
  114. package/src/engine/graphics/sh3/lpg/LightProbeGrid.js +173 -0
  115. package/src/engine/graphics/sh3/lpg/LightProbeGridBaker.d.ts +24 -0
  116. package/src/engine/graphics/sh3/lpg/LightProbeGridBaker.d.ts.map +1 -0
  117. package/src/engine/graphics/sh3/lpg/LightProbeGridBaker.js +88 -0
  118. package/src/engine/graphics/sh3/lpg/build_light_probe_grid_for_scene.d.ts +20 -0
  119. package/src/engine/graphics/sh3/lpg/build_light_probe_grid_for_scene.d.ts.map +1 -0
  120. package/src/engine/graphics/sh3/lpg/build_light_probe_grid_for_scene.js +79 -0
  121. package/src/engine/graphics/sh3/lpg/light_probe_grid_obtain_storage_cached.d.ts +11 -0
  122. package/src/engine/graphics/sh3/lpg/light_probe_grid_obtain_storage_cached.d.ts.map +1 -0
  123. package/src/engine/graphics/sh3/lpg/light_probe_grid_obtain_storage_cached.js +84 -0
  124. package/src/engine/graphics/sh3/lpg/light_probe_grid_textures.d.ts +29 -0
  125. package/src/engine/graphics/sh3/lpg/light_probe_grid_textures.d.ts.map +1 -0
  126. package/src/engine/graphics/sh3/lpg/light_probe_grid_textures.js +160 -0
  127. package/src/engine/graphics/sh3/lpg/material/LightProbeGridMaterialTransformer.d.ts +23 -0
  128. package/src/engine/graphics/sh3/lpg/material/LightProbeGridMaterialTransformer.d.ts.map +1 -0
  129. package/src/engine/graphics/sh3/lpg/material/LightProbeGridMaterialTransformer.js +228 -0
  130. package/src/engine/graphics/sh3/lpg/material/chunk_lpg_get_irradiance_at.d.ts +2 -0
  131. package/src/engine/graphics/sh3/lpg/material/chunk_lpg_get_irradiance_at.d.ts.map +1 -0
  132. package/src/engine/graphics/sh3/lpg/material/chunk_lpg_get_irradiance_at.js +24 -0
  133. package/src/engine/graphics/sh3/lpg/material/common.d.ts +3 -0
  134. package/src/engine/graphics/sh3/lpg/material/common.d.ts.map +1 -0
  135. package/src/engine/graphics/sh3/lpg/material/common.js +73 -0
  136. package/src/engine/graphics/sh3/lpg/material/space_fragment/build_fragment_shader.d.ts +6 -0
  137. package/src/engine/graphics/sh3/lpg/material/space_fragment/build_fragment_shader.d.ts.map +1 -0
  138. package/src/engine/graphics/sh3/lpg/material/space_fragment/build_fragment_shader.js +42 -0
  139. package/src/engine/graphics/sh3/lpg/material/space_fragment/build_vertex_shader.d.ts +6 -0
  140. package/src/engine/graphics/sh3/lpg/material/space_fragment/build_vertex_shader.d.ts.map +1 -0
  141. package/src/engine/graphics/sh3/lpg/material/space_fragment/build_vertex_shader.js +49 -0
  142. package/src/engine/graphics/sh3/lpg/material/space_fragment/space_fragment_transform_shader.d.ts +9 -0
  143. package/src/engine/graphics/sh3/lpg/material/space_fragment/space_fragment_transform_shader.d.ts.map +1 -0
  144. package/src/engine/graphics/sh3/lpg/material/space_fragment/space_fragment_transform_shader.js +12 -0
  145. package/src/engine/graphics/sh3/lpg/material/space_vertex/build_fragment_shader.d.ts +6 -0
  146. package/src/engine/graphics/sh3/lpg/material/space_vertex/build_fragment_shader.d.ts.map +1 -0
  147. package/src/engine/graphics/sh3/lpg/material/space_vertex/build_fragment_shader.js +30 -0
  148. package/src/engine/graphics/sh3/lpg/material/space_vertex/build_vertex_shader.d.ts +6 -0
  149. package/src/engine/graphics/sh3/lpg/material/space_vertex/build_vertex_shader.d.ts.map +1 -0
  150. package/src/engine/graphics/sh3/lpg/material/space_vertex/build_vertex_shader.js +41 -0
  151. package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.frag.d.ts +3 -0
  152. package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.frag.d.ts.map +1 -0
  153. package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.frag.js +15 -0
  154. package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.vert.d.ts +3 -0
  155. package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.vert.d.ts.map +1 -0
  156. package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.vert.js +9 -0
  157. package/src/engine/graphics/sh3/lpg/material/space_vertex/space_vertex_transform_shader.d.ts +9 -0
  158. package/src/engine/graphics/sh3/lpg/material/space_vertex/space_vertex_transform_shader.d.ts.map +1 -0
  159. package/src/engine/graphics/sh3/lpg/material/space_vertex/space_vertex_transform_shader.js +12 -0
  160. package/src/engine/graphics/sh3/lpg/serialization/LightProbeGridSerializationAdapter.d.ts +20 -0
  161. package/src/engine/graphics/sh3/lpg/serialization/LightProbeGridSerializationAdapter.d.ts.map +1 -0
  162. package/src/engine/graphics/sh3/lpg/serialization/LightProbeGridSerializationAdapter.js +59 -0
  163. package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.d.ts.map +1 -1
  164. package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.js +8 -0
  165. package/src/engine/graphics/sh3/prototypeLightProbeGrid.d.ts +2 -0
  166. package/src/engine/graphics/sh3/prototypeLightProbeGrid.d.ts.map +1 -0
  167. package/src/engine/graphics/sh3/prototypeLightProbeGrid.js +170 -0
  168. package/src/engine/graphics/texture/atlas/AtlasLookupTexture.js +1 -1
  169. package/src/engine/graphics/texture/atlas/CachingTextureAtlas.js +1 -1
  170. package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_lanczos.js +1 -1
  171. package/src/engine/graphics/texture/sampler/sampler2d_copy_with_margins.js +3 -3
  172. package/src/engine/graphics/util/build_max_height_pyramid.d.ts.map +1 -1
  173. package/src/engine/graphics/util/build_max_height_pyramid.js +5 -2
  174. package/src/engine/grid/transform2grid/Transform2GridPositionSystem.js +1 -1
  175. package/src/engine/input/ecs/components/InputBinding.d.ts +7 -1
  176. package/src/engine/input/ecs/components/InputBinding.d.ts.map +1 -1
  177. package/src/engine/input/ecs/components/InputBinding.js +8 -1
  178. package/src/engine/input/ecs/systems/InputControllerSystem.js +1 -1
  179. package/src/engine/intelligence/behavior/decorator/OverrideContextBehavior.d.ts +2 -1
  180. package/src/engine/intelligence/behavior/decorator/OverrideContextBehavior.d.ts.map +1 -1
  181. package/src/engine/intelligence/behavior/decorator/OverrideContextBehavior.js +6 -2
  182. package/src/engine/intelligence/behavior/selector/WeightedElement.js +1 -1
  183. package/src/engine/knowledge/database/StaticKnowledgeDatabase.d.ts.map +1 -1
  184. package/src/engine/knowledge/database/StaticKnowledgeDatabase.js +2 -4
  185. package/src/engine/logging/elastic/ElasticSearchLogger.d.ts +1 -2
  186. package/src/engine/logging/elastic/ElasticSearchLogger.d.ts.map +1 -1
  187. package/src/engine/logging/elastic/ElasticSearchLogger.js +14 -10
  188. package/src/engine/navigation/ecs/path_following/PathFollower.js +1 -1
  189. package/src/engine/navigation/grid/find_path_on_grid_astar.d.ts.map +1 -1
  190. package/src/engine/navigation/grid/find_path_on_grid_astar.js +5 -2
  191. package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts +1 -1
  192. package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts.map +1 -1
  193. package/src/engine/network/orchestrator/ServerAuthoritativeServer.js +17 -0
  194. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  195. package/src/engine/physics/fluid/ecs/FluidSystem.d.ts +3 -3
  196. package/src/engine/scene/SceneManager.d.ts.map +1 -1
  197. package/src/engine/scene/SceneManager.js +4 -2
  198. package/src/engine/simulation/Ticker.d.ts.map +1 -1
  199. package/src/engine/simulation/Ticker.js +9 -0
  200. package/src/engine/sound/ecs/emitter/SoundEmitterSystem.d.ts.map +1 -1
  201. package/src/engine/sound/ecs/emitter/SoundEmitterSystem.js +6 -1
  202. package/src/engine/sound/material/concrete/json/serializeSoundMaterialToJSON.js +1 -1
  203. package/src/generation/theme/ThemeEngine.d.ts +9 -0
  204. package/src/generation/theme/ThemeEngine.d.ts.map +1 -1
  205. package/src/generation/theme/ThemeEngine.js +37 -2
@@ -1 +1 @@
1
- {"version":3,"file":"EntityManager.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityManager.js"],"names":[],"mappings":"iCAgBU,MAAM;;;;;;;;;AAiBhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH;IAEI;;;;OAIG;IACH,kBAFU,iCAAQ,CAEL;IAEb;;;;;;OAMG;IACH,uCAA2B;IAE3B;;;;;OAKG;IACH,iCAA4B;IAE5B;;OAEG;IACH;;;QAGI;;WAEG;qBADO,uCAAc;;MAI1B;IAEF;;;OAGG;IACH,OAFU,kBAAkB,CAEO;IAEnC;;;;;;;;;OASG;IACH,qBAFU,MAAM,CAEqB;IAErC;;;;;;;;OAQG;IACH,wCAFU,MAAM,CAE4B;IAE5C;;;;;;;;OAQG;IACH,eAFU,MAAM,CAEE;IAElB;;;;;OAKG;IACH,+BAA2B;IAE3B;;;;OAIG;IACH,SAFU,sBAAsB,CAEjB;IAEf;;;;;OAKG;IACH,uCAAsC;IAEtC;;;OAGG;IACH,6BAmFC;IAED;;;OAGG;IACH,uBAFa,OAAO,CAuBnB;IAED;;;;;OAKG;IACH,uBAJW,sBAAsB,QA4ChC;IAGD;;;OAGG;IACH,sBA2BC;IAED;;;;OAIG;IACH,qCAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,6CAgBC;IAED;;;;;OAKG;IACH,wCAHW,MAAM,GACJ,IAAI,aAAS,CAiBzB;IAGD;;;OAGG;IACH,6BAFW,MAAM,QA8EhB;IAED;;;;;;;;;OASG;IACH,qBAFa,MAAM,CAKlB;IAED;;;;;OAKG;IACH,iEA2DC;IAED;;;;OAIG;IACH,uDAFa,QAAQ,OAAO,CAAC,CAyC5B;IAED;;;;;OAKG;IACH,mBAmCC;IAED;;;;;OAKG;IACH,oBAqFC;IAED;;;;;OAKG;IACH,kEAyEC;IAED;;;;OAIG;IACH,mCAFa,wCAAgB,CA0B5B;IAED;;;;OAIG;IACH,8DAFa,wCAAgB,CA0B5B;IAED;;;;;OAKG;IACH,mEAoFC;IAGL;;OAEG;IACH,yBAjtBe,sBAAsB,UAitBA;IACrC;;OAEG;IACH,0BAAqC;CATpC;uBA59BmC,aAAa;mBAR9B,oCAAoC;uCAMhB,6BAA6B"}
1
+ {"version":3,"file":"EntityManager.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityManager.js"],"names":[],"mappings":"iCAgBU,MAAM;;;;;;;;;AAiBhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH;IAEI;;;;OAIG;IACH,kBAFU,iCAAQ,CAEL;IAEb;;;;;;OAMG;IACH,uCAA2B;IAE3B;;;;;OAKG;IACH,iCAA4B;IAE5B;;OAEG;IACH;;;QAGI;;WAEG;qBADO,uCAAc;;MAI1B;IAEF;;;OAGG;IACH,OAFU,kBAAkB,CAEO;IAEnC;;;;;;;;;OASG;IACH,qBAFU,MAAM,CAEqB;IAErC;;;;;;;;OAQG;IACH,wCAFU,MAAM,CAE4B;IAE5C;;;;;;;;OAQG;IACH,eAFU,MAAM,CAEE;IAElB;;;;;OAKG;IACH,+BAA2B;IAE3B;;;;OAIG;IACH,SAFU,sBAAsB,CAEjB;IAEf;;;;;OAKG;IACH,uCAAsC;IAEtC;;;OAGG;IACH,6BAmFC;IAED;;;OAGG;IACH,uBAFa,OAAO,CAuBnB;IAED;;;;;OAKG;IACH,uBAJW,sBAAsB,QA4ChC;IAGD;;;OAGG;IACH,sBA2BC;IAED;;;;OAIG;IACH,qCAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,6CAgBC;IAED;;;;;OAKG;IACH,wCAHW,MAAM,GACJ,IAAI,aAAS,CAiBzB;IAGD;;;OAGG;IACH,6BAFW,MAAM,QA8EhB;IAED;;;;;;;;;OASG;IACH,qBAFa,MAAM,CAKlB;IAED;;;;;OAKG;IACH,iEA6DC;IAED;;;;OAIG;IACH,uDAFa,QAAQ,OAAO,CAAC,CA2C5B;IAED;;;;;OAKG;IACH,mBAmCC;IAED;;;;;OAKG;IACH,oBAqFC;IAED;;;;;OAKG;IACH,kEAyEC;IAED;;;;OAIG;IACH,mCAFa,wCAAgB,CA0B5B;IAED;;;;OAIG;IACH,8DAFa,wCAAgB,CA0B5B;IAED;;;;;OAKG;IACH,mEAoFC;IAGL;;OAEG;IACH,yBArtBe,sBAAsB,UAqtBA;IACrC;;OAEG;IACH,0BAAqC;CATpC;uBAh+BmC,aAAa;mBAR9B,oCAAoC;uCAMhB,6BAA6B"}
@@ -354,7 +354,7 @@ export class EntityManager {
354
354
  continue;
355
355
  }
356
356
 
357
- system.handleDatasetAttached(dataset);
357
+ system.handleDatasetDetached(dataset);
358
358
  }
359
359
 
360
360
  this.dataset = null;
@@ -557,9 +557,11 @@ export class EntityManager {
557
557
  systems[systemIndex] = system;
558
558
 
559
559
 
560
- //build observer
561
- const entityObserver = new EntityObserver(system.dependencies, system.link, system.unlink, system);
562
- this.systemObservers.set(system, entityObserver);
560
+ //build observer; a dependency-less system observes no entity tuple and never links
561
+ if (system.dependencies.length > 0) {
562
+ const entityObserver = new EntityObserver(system.dependencies, system.link, system.unlink, system);
563
+ this.systemObservers.set(system, entityObserver);
564
+ }
563
565
 
564
566
  let result_promise;
565
567
  if (this.state === EntityManagerState.Running) {
@@ -596,11 +598,11 @@ export class EntityManager {
596
598
  return false;
597
599
  }
598
600
 
599
- //unlink system observer
601
+ //unlink system observer, dependency-less systems don't have one
600
602
  const systemObserver = this.systemObservers.get(system);
601
603
  this.systemObservers.delete(system);
602
604
 
603
- assert.notEqual(systemObserver, undefined, "System observer is undefined, it was possibly removed illegally or was not created");
605
+ assert.ok(systemObserver !== undefined || system.dependencies.length === 0, "System observer is undefined, it was possibly removed illegally or was not created");
604
606
 
605
607
  //shutdown system
606
608
  this.systems.splice(systemIndex, 1);
@@ -609,8 +611,10 @@ export class EntityManager {
609
611
  this.__execution_order_needs_update = true;
610
612
 
611
613
  if (this.dataset !== null) {
612
- // remove observed and unlink entities
613
- this.dataset.removeObserver(systemObserver, true);
614
+ if (systemObserver !== undefined) {
615
+ // remove observed and unlink entities
616
+ this.dataset.removeObserver(systemObserver, true);
617
+ }
614
618
  system.handleDatasetDetached(this.dataset);
615
619
  }
616
620
 
@@ -127,7 +127,7 @@ export class EntityObserver {
127
127
  * @return {boolean}
128
128
  */
129
129
  get isConnected() {
130
- return this.dataset === null;
130
+ return this.dataset !== null;
131
131
  }
132
132
 
133
133
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"System.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/System.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH;IAEI;;;;;OAKG;IACH,uCAAqB;IAErB;;;;OAIG;IACH,oBAA+C;IAE/C;;;;;;;OAOG;IACH,6BAAkB;IAElB;;;;;;;;;;OAUG;IACH,0BAFU,6BAA6B,CAElB;IAGrB;;OAEG;IACH,mCAcC;IAED;;;;;OAKG;IACH,oCAFY,MAAM,CA8BjB;IAED;;;;;;OAMG;IACH,uCAHa,QAAQ,IAAI,CAAC,CAKzB;IAED;;;;;;;OAOG;IACH,wCAHa,QAAQ,IAAI,CAAC,CAKzB;IAGD;;;;OAIG;IACH,wCAEC;IAED;;;;OAIG;IACH,0CAEC;IAED;;;;;;;;;;OAUG;IACH,6DAEC;IAED;;;;;;;;;;OAUG;IACH,6DAEC;IAIL;;;OAGG;IACH,mBAFU,OAAO,CAEQ;IAEzB;;;;OAIG;IACH,2CAFsC,MAAM,CAEhB;IAG5B;;;;;;OAMG;IACH,sCAFsC,MAAM,CAErB;CAvBtB;0BA2BS,MAAM"}
1
+ {"version":3,"file":"System.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/System.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH;IAEI;;;;;OAKG;IACH,uCAAqB;IAErB;;;;OAIG;IACH,oBAA+C;IAE/C;;;;;;;;;OASG;IACH,6BAAkB;IAElB;;;;;;;;;;OAUG;IACH,0BAFU,6BAA6B,CAElB;IAGrB;;OAEG;IACH,mCAcC;IAED;;;;;OAKG;IACH,oCAFY,MAAM,CA8BjB;IAED;;;;;;OAMG;IACH,uCAHa,QAAQ,IAAI,CAAC,CAKzB;IAED;;;;;;;OAOG;IACH,wCAHa,QAAQ,IAAI,CAAC,CAKzB;IAGD;;;;;OAKG;IACH,wCAEC;IAED;;;;;OAKG;IACH,0CAEC;IAED;;;;;;;;;;OAUG;IACH,6DAEC;IAED;;;;;;;;;;OAUG;IACH,6DAEC;IAIL;;;OAGG;IACH,mBAFU,OAAO,CAEQ;IAEzB;;;;OAIG;IACH,2CAFsC,MAAM,CAEhB;IAG5B;;;;;;OAMG;IACH,sCAFsC,MAAM,CAErB;CAvBtB;0BA2BS,MAAM"}
@@ -53,6 +53,8 @@ export class System {
53
53
 
54
54
  /**
55
55
  * Component classes which have to be present before the system links an entity.
56
+ * May be left empty: such a system observes no entity tuple, {@link link}/{@link unlink} are never invoked,
57
+ * and it is driven purely by {@link startup}/{@link shutdown} and the {@link update}/{@link fixedUpdate} methods.
56
58
  * NOTE: do not modify this while the system is running.
57
59
  * @see link
58
60
  * @see unlink
@@ -157,6 +159,7 @@ export class System {
157
159
  /**
158
160
  * Called automatically when an entity gets a complete component tuple {@link this.dependencies}.
159
161
  * Inputs are the same as dependencies, only instances instead of classes, plus there is an extra argument at the end, which is the entity ID.
162
+ * Never invoked when {@link this.dependencies} is empty.
160
163
  * see {@link EntityObserver} for more implementation detail
161
164
  */
162
165
  link(component, entity) {
@@ -166,6 +169,7 @@ export class System {
166
169
  /**
167
170
  * Called automatically when an entity breaks component tuple {@link this.dependencies}.
168
171
  * Inputs are the same as dependencies, only instances instead of classes, plus there is an extra argument at the end, which is the entity ID.
172
+ * Never invoked when {@link this.dependencies} is empty.
169
173
  * see {@link EntityObserver} for more implementation detail
170
174
  */
171
175
  unlink(component, entity) {
@@ -83,7 +83,7 @@ export class AnimationClip {
83
83
  if (typeof json.repeatCount === "number") {
84
84
  this.repeatCount.fromJSON(json.repeatCount);
85
85
  } else {
86
- this.repeatCount.set(Number.POSITIVE_INFINITY);
86
+ this.repeatCount.set(1);
87
87
  }
88
88
 
89
89
  if (typeof json.weight === "number") {
@@ -75,9 +75,9 @@ export class AttachmentSystem extends System {
75
75
  let numRecords = waiting.length;
76
76
 
77
77
  for (let i = 0; i < numRecords; i++) {
78
- const entity = waiting[i];
78
+ const record = waiting[i];
79
79
 
80
- if (entity === entity) {
80
+ if (record === entity) {
81
81
  waiting.splice(i, 1);
82
82
  removedCount++;
83
83
 
@@ -1 +1 @@
1
- {"version":3,"file":"TransformAttachmentBinding.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/attachment/TransformAttachmentBinding.js"],"names":[],"mappings":"AAOA;CAgCC;kCAtCiC,wBAAwB"}
1
+ {"version":3,"file":"TransformAttachmentBinding.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/attachment/TransformAttachmentBinding.js"],"names":[],"mappings":"AAOA;CA2CC;kCAjDiC,wBAAwB"}
@@ -30,11 +30,22 @@ export class TransformAttachmentBinding extends AttachmentBinding {
30
30
  this.parentTransform.position.onChanged.add(this.update, this);
31
31
  this.parentTransform.rotation.onChanged.add(this.update, this);
32
32
  this.parentTransform.scale.onChanged.add(this.update, this);
33
+
34
+ // update() also composes the attachment's local socket offset, so changes
35
+ // to it must trigger a recompute too — otherwise a moved socket offset only
36
+ // takes effect the next time the parent transform happens to change.
37
+ this.attachment.transform.position.onChanged.add(this.update, this);
38
+ this.attachment.transform.rotation.onChanged.add(this.update, this);
39
+ this.attachment.transform.scale.onChanged.add(this.update, this);
33
40
  }
34
41
 
35
42
  unlink() {
36
43
  this.parentTransform.position.onChanged.remove(this.update, this);
37
44
  this.parentTransform.rotation.onChanged.remove(this.update, this);
38
45
  this.parentTransform.scale.onChanged.remove(this.update, this);
46
+
47
+ this.attachment.transform.position.onChanged.remove(this.update, this);
48
+ this.attachment.transform.rotation.onChanged.remove(this.update, this);
49
+ this.attachment.transform.scale.onChanged.remove(this.update, this);
39
50
  }
40
51
  }
@@ -559,8 +559,8 @@ export class FogOfWar {
559
559
  rebuildSampler() {
560
560
 
561
561
  //resize the sampler
562
- const samplerHeight = this.size.x + 2;
563
- const samplerWidth = this.size.y + 2;
562
+ const samplerWidth = this.size.x + 2;
563
+ const samplerHeight = this.size.y + 2;
564
564
  const uint8Array = new Uint8Array(samplerWidth * samplerHeight);
565
565
 
566
566
  uint8Array.fill(255);
@@ -1 +1 @@
1
- {"version":3,"file":"screenSpaceFogOfWarShader.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/fow/shader/screenSpaceFogOfWarShader.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH,kDAFW,cAAc,CAiJxB;+BAtJyE,OAAO"}
1
+ {"version":3,"file":"screenSpaceFogOfWarShader.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/fow/shader/screenSpaceFogOfWarShader.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH,kDAFW,cAAc,CAmKxB;+BAxKyE,OAAO"}
@@ -28,16 +28,20 @@ export function buildScreenSpaceFogOfWarShader() {
28
28
  const float c_samplesX = 5.0;
29
29
  const float c_samplesY = 5.0;
30
30
 
31
- const float c_halfSamplesX = c_samplesX / 2.0;
32
- const float c_halfSamplesY = c_samplesY / 2.0;
31
+ // True kernel centre is (N-1)/2, so a 5-tap kernel is centred on index 2.
32
+ const float c_halfSamplesX = (c_samplesX - 1.0) / 2.0;
33
+ const float c_halfSamplesY = (c_samplesY - 1.0) / 2.0;
33
34
 
34
- const vec2 sigma = vec2(23.0, 23.0);
35
+ // Std-dev in *sample-index* units (kernel is only c_samples wide), NOT
36
+ // fog-resolution units. ~1.2 gives a real bell over the 5 taps.
37
+ const vec2 sigma = vec2(1.2, 1.2);
35
38
 
36
39
  const vec2 sigma2_sq = sigma*sigma*2.0;
37
40
 
38
- const float radius = 0.9;
39
-
40
- const vec2 samplingBias = vec2(c_halfSamplesX,c_halfSamplesY)/ vec2( radius );
41
+ // Spacing between adjacent taps, in fog texels. Controls blur width and
42
+ // therefore how strongly the coarse fog grid is smoothed. 1.0 = one texel
43
+ // per tap, so a 5-tap kernel reaches +/-2 texels either side of centre.
44
+ const float texelSpacing = 1.0;
41
45
 
42
46
  vec3 computeWorldPosition(){
43
47
  // Convert screen coordinates to normalized device coordinates (NDC)
@@ -64,10 +68,16 @@ export function buildScreenSpaceFogOfWarShader() {
64
68
  float Gaussian(float sigma2_sq, float x){
65
69
  return exp(-(x*x) / sigma2_sq);
66
70
  }
71
+
72
+ // interleaved gradient noise (Jimenez 2014, "Next Generation Post Processing in Call of Duty")
73
+ float gradientNoise(const in vec2 fragCoord){
74
+ return fract(52.9829189 * fract(dot(fragCoord, vec2(0.06711056, 0.00583715))));
75
+ }
67
76
 
68
77
  float getFog(const in vec2 uv){
69
78
 
70
- vec2 texelSize = samplingBias * uResolution;
79
+ // size of one fog texel, in UV space, scaled by the desired tap spacing
80
+ vec2 texelSize = texelSpacing / uResolution;
71
81
 
72
82
  float total = 0.0;
73
83
 
@@ -76,12 +86,12 @@ export function buildScreenSpaceFogOfWarShader() {
76
86
  for (float iy = 0.0; iy < c_samplesY; ++iy){
77
87
 
78
88
  float fy = Gaussian(sigma2_sq.y, iy - c_halfSamplesY);
79
- float offsety = (iy-c_halfSamplesY) / texelSize.y;
89
+ float offsety = (iy - c_halfSamplesY) * texelSize.y;
80
90
 
81
91
  for (float ix = 0.0; ix < c_samplesX; ++ix){
82
92
 
83
93
  float fx = Gaussian(sigma2_sq.x, ix - c_halfSamplesX);
84
- float offsetx = (ix-c_halfSamplesX) / texelSize.x;
94
+ float offsetx = (ix - c_halfSamplesX) * texelSize.x;
85
95
 
86
96
  float weight = fx * fy;
87
97
 
@@ -104,6 +114,14 @@ export function buildScreenSpaceFogOfWarShader() {
104
114
 
105
115
  gl_FragColor = uColor;
106
116
  gl_FragColor.a *= fogValue;
117
+
118
+ // The fog is written to an 8-bit intermediate layer target; both channels of
119
+ // that target carry a quantized ramp: alpha holds fogValue, rgb holds
120
+ // uColor.rgb * alpha (multiplied by ROP blending). Dither each at +/-0.5 LSB
121
+ // of its own quantizer to break up banding. The rgb noise is attenuated by
122
+ // alpha in the blend, exactly matching how the rgb band amplitude scales.
123
+ gl_FragColor.a += gradientNoise(gl_FragCoord.xy) * (1.0 / 255.0) - (0.5 / 255.0);
124
+ gl_FragColor.rgb += vec3( gradientNoise(gl_FragCoord.xy + vec2(7.0, 13.0)) * (1.0 / 255.0) - (0.5 / 255.0) );
107
125
  }
108
126
  `;
109
127
  }
@@ -85,7 +85,7 @@ class HeadsUpDisplaySystem extends System {
85
85
 
86
86
  x *= transform_scale.x;
87
87
  y *= transform_scale.y;
88
- z *= transform_scale.y;
88
+ z *= transform_scale.z;
89
89
 
90
90
  const q = transform.rotation;
91
91
 
@@ -50,10 +50,11 @@ declare class ViewportPosition {
50
50
  */
51
51
  equals(other: ViewportPosition): boolean;
52
52
  hash(): number;
53
- fromJSON({ position, offset, anchor, screenEdgeWidth, stickToScreenEdge, enabled, }: {
53
+ fromJSON({ position, offset, anchor, resolveGuiCollisions, screenEdgeWidth, stickToScreenEdge, enabled, }: {
54
54
  position?: Vector2;
55
55
  offset?: Vector2;
56
56
  anchor?: Vector2;
57
+ resolveGuiCollisions?: boolean;
57
58
  screenEdgeWidth?: number;
58
59
  stickToScreenEdge?: boolean;
59
60
  enabled?: boolean;
@@ -71,6 +72,7 @@ declare class ViewportPosition {
71
72
  x: number;
72
73
  y: number;
73
74
  };
75
+ resolveGuiCollisions: boolean;
74
76
  screenEdgeWidth: number;
75
77
  stickToScreenEdge: boolean;
76
78
  enabled: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"ViewportPosition.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/gui/position/ViewportPosition.js"],"names":[],"mappings":"oCAOU,MAAM;;;;;;AAOhB;IAuGI,4CAMC;IA5GD;;;OAGG;IACH,UAFU,OAAO,CAEQ;IAEzB;;;OAGG;IACH,QAFU,OAAO,CAEM;IACvB;;;OAGG;IACH,QAFU,OAAO,CAEU;IAG3B;;;;OAIG;IACH,sBAFU,OAAO,CAEY;IAE7B;;;;OAIG;IACH,iBAFU,MAAM,CAEK;IAGrB;;;OAGG;IACH,mBAFU,OAAO,CAES;IAE1B;;;OAGG;IACH,SAFU,eAAe,CAEW;IAEpC;;;;OAIG;IACH,cAHW,gBAAgB,GACd,OAAO,CAWnB;IAED,eAUC;IAED;;;;;;;aAgBC;IAED;;;;;;;;;;;;;;;;MASC;CASJ;;;;;oBA3HmB,kCAAkC;4BAC1B,2CAA2C"}
1
+ {"version":3,"file":"ViewportPosition.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/gui/position/ViewportPosition.js"],"names":[],"mappings":"oCAOU,MAAM;;;;;;AAOhB;IA0GI,4CAMC;IA/GD;;;OAGG;IACH,UAFU,OAAO,CAEQ;IAEzB;;;OAGG;IACH,QAFU,OAAO,CAEM;IACvB;;;OAGG;IACH,QAFU,OAAO,CAEU;IAG3B;;;;OAIG;IACH,sBAFU,OAAO,CAEY;IAE7B;;;;OAIG;IACH,iBAFU,MAAM,CAEK;IAGrB;;;OAGG;IACH,mBAFU,OAAO,CAES;IAE1B;;;OAGG;IACH,SAFU,eAAe,CAEW;IAEpC;;;;OAIG;IACH,cAHW,gBAAgB,GACd,OAAO,CAWnB;IAED,eAUC;IAED;;;;;;;;aAkBC;IAED;;;;;;;;;;;;;;;;;MAUC;CASJ;;;;;oBA9HmB,kCAAkC;4BAC1B,2CAA2C"}
@@ -91,7 +91,8 @@ class ViewportPosition {
91
91
  position = Vector2.zero,
92
92
  offset = Vector2.zero,
93
93
  anchor = Vector2.zero,
94
- screenEdgeWidth = 0,
94
+ resolveGuiCollisions = false,
95
+ screenEdgeWidth = 10,
95
96
  stickToScreenEdge = false,
96
97
  enabled = true,
97
98
  }
@@ -99,6 +100,7 @@ class ViewportPosition {
99
100
  this.position.fromJSON(position);
100
101
  this.offset.fromJSON(offset);
101
102
  this.anchor.fromJSON(anchor);
103
+ this.resolveGuiCollisions = resolveGuiCollisions;
102
104
  this.screenEdgeWidth = screenEdgeWidth;
103
105
  this.stickToScreenEdge = stickToScreenEdge;
104
106
  this.enabled.fromJSON(enabled);
@@ -109,6 +111,7 @@ class ViewportPosition {
109
111
  position: this.position.toJSON(),
110
112
  offset: this.offset.toJSON(),
111
113
  anchor: this.anchor.toJSON(),
114
+ resolveGuiCollisions: this.resolveGuiCollisions,
112
115
  screenEdgeWidth: this.screenEdgeWidth,
113
116
  stickToScreenEdge: this.stickToScreenEdge,
114
117
  enabled: this.enabled.toJSON()
@@ -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"}