@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.
- package/README.md +137 -108
- package/build/bundle-worker-image-decoder.js +1 -1
- package/package.json +1 -1
- package/samples/generation/SampleGenerator0.js +3 -3
- package/samples/generation/filters/SampleGroundMoistureFilter.js +63 -56
- package/samples/generation/filters/SampleNoise20_0.js +6 -1
- package/samples/generation/themes/SampleTheme0.js +47 -47
- package/src/core/color/YCoCg/rgb_to_ycocg.d.ts +17 -0
- package/src/core/color/YCoCg/rgb_to_ycocg.d.ts.map +1 -0
- package/src/core/color/YCoCg/rgb_to_ycocg.js +20 -0
- package/src/core/color/YCoCg/ycocg_to_rgb.d.ts +14 -0
- package/src/core/color/YCoCg/ycocg_to_rgb.d.ts.map +1 -0
- package/src/core/color/YCoCg/ycocg_to_rgb.js +17 -0
- package/src/engine/REVIEW_2026_07_03.md +211 -0
- package/src/engine/animation/curve/actionProcessorOperations/curveActions.d.ts.map +1 -1
- package/src/engine/animation/curve/actionProcessorOperations/curveActions.js +3 -2
- package/src/engine/animation/curve/compression/sample_animation_curve_to_float_array.js +1 -1
- package/src/engine/animation/keyed2/AnimationTrackPlayback.d.ts.map +1 -1
- package/src/engine/animation/keyed2/AnimationTrackPlayback.js +3 -1
- package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterNone.js +2 -2
- package/src/engine/asset/preloader/AssetPreloader.d.ts.map +1 -1
- package/src/engine/asset/preloader/AssetPreloader.js +6 -0
- package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.d.ts.map +1 -1
- package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.js +5 -2
- package/src/engine/ecs/Entity.js +1 -1
- package/src/engine/ecs/EntityComponentDataset.d.ts.map +1 -1
- package/src/engine/ecs/EntityComponentDataset.js +1 -0
- package/src/engine/ecs/EntityManager.d.ts.map +1 -1
- package/src/engine/ecs/EntityManager.js +12 -8
- package/src/engine/ecs/EntityObserver.js +1 -1
- package/src/engine/ecs/System.d.ts.map +1 -1
- package/src/engine/ecs/System.js +4 -0
- package/src/engine/ecs/animation/AnimationClip.js +1 -1
- package/src/engine/ecs/attachment/AttachmentSystem.js +2 -2
- package/src/engine/ecs/attachment/TransformAttachmentBinding.d.ts.map +1 -1
- package/src/engine/ecs/attachment/TransformAttachmentBinding.js +11 -0
- package/src/engine/ecs/fow/FogOfWar.js +2 -2
- package/src/engine/ecs/fow/shader/screenSpaceFogOfWarShader.d.ts.map +1 -1
- package/src/engine/ecs/fow/shader/screenSpaceFogOfWarShader.js +27 -9
- package/src/engine/ecs/gui/hud/HeadsUpDisplaySystem.js +1 -1
- package/src/engine/ecs/gui/position/ViewportPosition.d.ts +3 -1
- package/src/engine/ecs/gui/position/ViewportPosition.d.ts.map +1 -1
- package/src/engine/ecs/gui/position/ViewportPosition.js +4 -1
- package/src/engine/ecs/storage/binary/BinarySerializationRegistry.d.ts +10 -0
- package/src/engine/ecs/storage/binary/BinarySerializationRegistry.d.ts.map +1 -1
- package/src/engine/ecs/storage/binary/BinarySerializationRegistry.js +43 -0
- package/src/engine/ecs/storage/binary/object-v2/BinaryObjectDeSerializer.d.ts +93 -0
- package/src/engine/ecs/storage/binary/object-v2/BinaryObjectDeSerializer.d.ts.map +1 -0
- package/src/engine/ecs/storage/binary/object-v2/BinaryObjectDeSerializer.js +315 -0
- package/src/engine/ecs/storage/binary/object-v2/BinaryObjectSerializer.d.ts +48 -0
- package/src/engine/ecs/storage/binary/object-v2/BinaryObjectSerializer.d.ts.map +1 -0
- package/src/engine/ecs/storage/binary/object-v2/BinaryObjectSerializer.js +331 -0
- package/src/engine/ecs/storage/binary/object-v2/DESIGN.md +199 -0
- package/src/engine/ecs/storage/binary/object-v2/ObjectBinaryFormat.d.ts +53 -0
- package/src/engine/ecs/storage/binary/object-v2/ObjectBinaryFormat.d.ts.map +1 -0
- package/src/engine/ecs/storage/binary/object-v2/ObjectBinaryFormat.js +57 -0
- package/src/engine/ecs/storage/binary/object-v2/ObjectSerializationAdapter.d.ts +53 -0
- package/src/engine/ecs/storage/binary/object-v2/ObjectSerializationAdapter.d.ts.map +1 -0
- package/src/engine/ecs/storage/binary/object-v2/ObjectSerializationAdapter.js +56 -0
- package/src/engine/ecs/storage/binary/object-v2/README.md +110 -0
- package/src/engine/ecs/storage/binary/object-v2/objectStringCodec.d.ts +13 -0
- package/src/engine/ecs/storage/binary/object-v2/objectStringCodec.d.ts.map +1 -0
- package/src/engine/ecs/storage/binary/object-v2/objectStringCodec.js +48 -0
- package/src/engine/ecs/storage/binary/object-v2/serializerTestHarness.d.ts +29 -0
- package/src/engine/ecs/storage/binary/object-v2/serializerTestHarness.d.ts.map +1 -0
- package/src/engine/ecs/storage/binary/object-v2/serializerTestHarness.js +44 -0
- package/src/engine/ecs/system_validate_class.d.ts.map +1 -1
- package/src/engine/ecs/system_validate_class.js +9 -2
- package/src/engine/graphics/camera/makeScreenScissorFrustum.d.ts.map +1 -1
- package/src/engine/graphics/camera/makeScreenScissorFrustum.js +11 -10
- package/src/engine/graphics/canvas/canvas2d_draw_linear_scale.d.ts.map +1 -1
- package/src/engine/graphics/canvas/canvas2d_draw_linear_scale.js +3 -1
- package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/readAnimationGraphDefinitionFromJSON.d.ts +1 -1
- package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/readAnimationGraphDefinitionFromJSON.d.ts.map +1 -1
- package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/readAnimationGraphDefinitionFromJSON.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/writeAnimationGraphDefinitionToJSON.d.ts.map +1 -1
- package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/writeAnimationGraphDefinitionToJSON.js +2 -0
- package/src/engine/graphics/ecs/camera/Camera.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/Camera.js +4 -0
- package/src/engine/graphics/ecs/camera/auto_set_camera_clipping_planes.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/auto_set_camera_clipping_planes.js +7 -2
- package/src/engine/graphics/ecs/camera/set_camera_aspect_ratio.js +1 -1
- package/src/engine/graphics/ecs/highlight/system/ShadedGeometryHighlightSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/highlight/system/ShadedGeometryHighlightSystem.js +4 -1
- package/src/engine/graphics/ecs/light/binding/LightBinding.js +2 -2
- package/src/engine/graphics/ecs/mesh/MeshSystem.js +1 -1
- package/src/engine/graphics/ecs/mesh/SkeletonUtils.js +1 -1
- package/src/engine/graphics/ecs/mesh-v2/sg_hierarchy_compute_bounding_box_via_parent_entity.js +1 -1
- package/src/engine/graphics/ecs/water/WaterSystem.d.ts +6 -0
- package/src/engine/graphics/ecs/water/WaterSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/water/WaterSystem.js +12 -1
- package/src/engine/graphics/geometry/buffered/ensureGeometryBoundingSphere.js +1 -1
- package/src/engine/graphics/geometry/buffered/query/bvh32_geometry_nearest.d.ts.map +1 -1
- package/src/engine/graphics/geometry/buffered/query/bvh32_geometry_nearest.js +0 -15
- package/src/engine/graphics/geometry/instancing/InstancedMeshGroup.js +10 -10
- package/src/engine/graphics/geometry/optimization/merge/merge_geometry_hierarchy.js +1 -1
- package/src/engine/graphics/material/SplatMaterial.js +1 -1
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.d.ts.map +1 -1
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +3 -2
- package/src/engine/graphics/particles/particular/engine/emitter/ParticlePool.js +1 -1
- package/src/engine/graphics/particles/particular/group/ParticleGroup.d.ts.map +1 -1
- package/src/engine/graphics/particles/particular/group/ParticleGroup.js +3 -2
- package/src/engine/graphics/render/forward_plus/plugin/ForwardPlusRenderingPlugin.js +1 -1
- package/src/engine/graphics/sh3/gi/material/MaterialTransformer.d.ts +1 -8
- package/src/engine/graphics/sh3/gi/material/MaterialTransformer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/gi/material/MaterialTransformer.js +2 -14
- package/src/engine/graphics/sh3/gi/material/ProbeResolutionStage.d.ts +9 -0
- package/src/engine/graphics/sh3/gi/material/ProbeResolutionStage.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/ProbeResolutionStage.js +14 -0
- package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.js +4 -1
- package/src/engine/graphics/sh3/lpg/LightProbeGrid.d.ts +69 -0
- package/src/engine/graphics/sh3/lpg/LightProbeGrid.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/LightProbeGrid.js +173 -0
- package/src/engine/graphics/sh3/lpg/LightProbeGridBaker.d.ts +24 -0
- package/src/engine/graphics/sh3/lpg/LightProbeGridBaker.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/LightProbeGridBaker.js +88 -0
- package/src/engine/graphics/sh3/lpg/build_light_probe_grid_for_scene.d.ts +20 -0
- package/src/engine/graphics/sh3/lpg/build_light_probe_grid_for_scene.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/build_light_probe_grid_for_scene.js +79 -0
- package/src/engine/graphics/sh3/lpg/light_probe_grid_obtain_storage_cached.d.ts +11 -0
- package/src/engine/graphics/sh3/lpg/light_probe_grid_obtain_storage_cached.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/light_probe_grid_obtain_storage_cached.js +84 -0
- package/src/engine/graphics/sh3/lpg/light_probe_grid_textures.d.ts +29 -0
- package/src/engine/graphics/sh3/lpg/light_probe_grid_textures.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/light_probe_grid_textures.js +160 -0
- package/src/engine/graphics/sh3/lpg/material/LightProbeGridMaterialTransformer.d.ts +23 -0
- package/src/engine/graphics/sh3/lpg/material/LightProbeGridMaterialTransformer.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/material/LightProbeGridMaterialTransformer.js +228 -0
- package/src/engine/graphics/sh3/lpg/material/chunk_lpg_get_irradiance_at.d.ts +2 -0
- package/src/engine/graphics/sh3/lpg/material/chunk_lpg_get_irradiance_at.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/material/chunk_lpg_get_irradiance_at.js +24 -0
- package/src/engine/graphics/sh3/lpg/material/common.d.ts +3 -0
- package/src/engine/graphics/sh3/lpg/material/common.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/material/common.js +73 -0
- package/src/engine/graphics/sh3/lpg/material/space_fragment/build_fragment_shader.d.ts +6 -0
- package/src/engine/graphics/sh3/lpg/material/space_fragment/build_fragment_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/material/space_fragment/build_fragment_shader.js +42 -0
- package/src/engine/graphics/sh3/lpg/material/space_fragment/build_vertex_shader.d.ts +6 -0
- package/src/engine/graphics/sh3/lpg/material/space_fragment/build_vertex_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/material/space_fragment/build_vertex_shader.js +49 -0
- package/src/engine/graphics/sh3/lpg/material/space_fragment/space_fragment_transform_shader.d.ts +9 -0
- package/src/engine/graphics/sh3/lpg/material/space_fragment/space_fragment_transform_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/material/space_fragment/space_fragment_transform_shader.js +12 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/build_fragment_shader.d.ts +6 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/build_fragment_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/build_fragment_shader.js +30 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/build_vertex_shader.d.ts +6 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/build_vertex_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/build_vertex_shader.js +41 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.frag.d.ts +3 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.frag.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.frag.js +15 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.vert.d.ts +3 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.vert.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.vert.js +9 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/space_vertex_transform_shader.d.ts +9 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/space_vertex_transform_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/space_vertex_transform_shader.js +12 -0
- package/src/engine/graphics/sh3/lpg/serialization/LightProbeGridSerializationAdapter.d.ts +20 -0
- package/src/engine/graphics/sh3/lpg/serialization/LightProbeGridSerializationAdapter.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/serialization/LightProbeGridSerializationAdapter.js +59 -0
- package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.js +8 -0
- package/src/engine/graphics/sh3/prototypeLightProbeGrid.d.ts +2 -0
- package/src/engine/graphics/sh3/prototypeLightProbeGrid.d.ts.map +1 -0
- package/src/engine/graphics/sh3/prototypeLightProbeGrid.js +170 -0
- package/src/engine/graphics/texture/atlas/AtlasLookupTexture.js +1 -1
- package/src/engine/graphics/texture/atlas/CachingTextureAtlas.js +1 -1
- package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_lanczos.js +1 -1
- package/src/engine/graphics/texture/sampler/sampler2d_copy_with_margins.js +3 -3
- package/src/engine/graphics/util/build_max_height_pyramid.d.ts.map +1 -1
- package/src/engine/graphics/util/build_max_height_pyramid.js +5 -2
- package/src/engine/grid/transform2grid/Transform2GridPositionSystem.js +1 -1
- package/src/engine/input/ecs/components/InputBinding.d.ts +7 -1
- package/src/engine/input/ecs/components/InputBinding.d.ts.map +1 -1
- package/src/engine/input/ecs/components/InputBinding.js +8 -1
- package/src/engine/input/ecs/systems/InputControllerSystem.js +1 -1
- package/src/engine/intelligence/behavior/decorator/OverrideContextBehavior.d.ts +2 -1
- package/src/engine/intelligence/behavior/decorator/OverrideContextBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/decorator/OverrideContextBehavior.js +6 -2
- package/src/engine/intelligence/behavior/selector/WeightedElement.js +1 -1
- package/src/engine/knowledge/database/StaticKnowledgeDatabase.d.ts.map +1 -1
- package/src/engine/knowledge/database/StaticKnowledgeDatabase.js +2 -4
- package/src/engine/logging/elastic/ElasticSearchLogger.d.ts +1 -2
- package/src/engine/logging/elastic/ElasticSearchLogger.d.ts.map +1 -1
- package/src/engine/logging/elastic/ElasticSearchLogger.js +14 -10
- package/src/engine/navigation/ecs/path_following/PathFollower.js +1 -1
- package/src/engine/navigation/grid/find_path_on_grid_astar.d.ts.map +1 -1
- package/src/engine/navigation/grid/find_path_on_grid_astar.js +5 -2
- package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts +1 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts.map +1 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeServer.js +17 -0
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/engine/physics/fluid/ecs/FluidSystem.d.ts +3 -3
- package/src/engine/scene/SceneManager.d.ts.map +1 -1
- package/src/engine/scene/SceneManager.js +4 -2
- package/src/engine/simulation/Ticker.d.ts.map +1 -1
- package/src/engine/simulation/Ticker.js +9 -0
- package/src/engine/sound/ecs/emitter/SoundEmitterSystem.d.ts.map +1 -1
- package/src/engine/sound/ecs/emitter/SoundEmitterSystem.js +6 -1
- package/src/engine/sound/material/concrete/json/serializeSoundMaterialToJSON.js +1 -1
- package/src/generation/theme/ThemeEngine.d.ts +9 -0
- package/src/generation/theme/ThemeEngine.d.ts.map +1 -1
- 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,
|
|
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.
|
|
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
|
-
|
|
562
|
-
|
|
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.
|
|
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
|
-
|
|
613
|
-
|
|
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
|
|
|
@@ -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
|
|
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"}
|
package/src/engine/ecs/System.js
CHANGED
|
@@ -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(
|
|
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
|
|
78
|
+
const record = waiting[i];
|
|
79
79
|
|
|
80
|
-
if (
|
|
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;
|
|
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
|
|
563
|
-
const
|
|
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,
|
|
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
|
-
|
|
32
|
-
const float
|
|
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
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
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)
|
|
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)
|
|
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
|
}
|
|
@@ -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;
|
|
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
|
-
|
|
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;
|
|
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"}
|