@oasys/oecs 0.5.4 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1223 -266
- package/README.md +217 -112
- package/dist/core/ecs/access_check.d.cts +29 -29
- package/dist/core/ecs/access_check.d.ts +29 -29
- package/dist/core/ecs/access_check.d.ts.map +1 -1
- package/dist/core/ecs/archetype.d.cts +217 -209
- package/dist/core/ecs/archetype.d.ts +217 -209
- package/dist/core/ecs/archetype.d.ts.map +1 -1
- package/dist/core/ecs/archetype_closure.d.cts +23 -0
- package/dist/core/ecs/archetype_closure.d.ts +23 -0
- package/dist/core/ecs/archetype_closure.d.ts.map +1 -0
- package/dist/core/ecs/archetype_graph.d.cts +33 -33
- package/dist/core/ecs/archetype_graph.d.ts +33 -33
- package/dist/core/ecs/archetype_graph.d.ts.map +1 -1
- package/dist/core/ecs/archetype_types.d.cts +55 -0
- package/dist/core/ecs/archetype_types.d.ts +55 -0
- package/dist/core/ecs/archetype_types.d.ts.map +1 -0
- package/dist/core/ecs/change_feed.d.cts +53 -0
- package/dist/core/ecs/change_feed.d.ts +53 -0
- package/dist/core/ecs/change_feed.d.ts.map +1 -0
- package/dist/core/ecs/changed_query.d.cts +36 -0
- package/dist/core/ecs/changed_query.d.ts +36 -0
- package/dist/core/ecs/changed_query.d.ts.map +1 -0
- package/dist/core/ecs/chunk_columns.d.cts +49 -0
- package/dist/core/ecs/chunk_columns.d.ts +49 -0
- package/dist/core/ecs/chunk_columns.d.ts.map +1 -0
- package/dist/core/ecs/command_log.d.cts +26 -26
- package/dist/core/ecs/command_log.d.ts +26 -26
- package/dist/core/ecs/command_log.d.ts.map +1 -1
- package/dist/core/ecs/component.d.cts +43 -42
- package/dist/core/ecs/component.d.ts +43 -42
- package/dist/core/ecs/component.d.ts.map +1 -1
- package/dist/core/ecs/component_registry.d.cts +53 -0
- package/dist/core/ecs/component_registry.d.ts +53 -0
- package/dist/core/ecs/component_registry.d.ts.map +1 -0
- package/dist/core/ecs/compute_backend.d.cts +18 -7
- package/dist/core/ecs/compute_backend.d.ts +18 -7
- package/dist/core/ecs/compute_backend.d.ts.map +1 -1
- package/dist/core/ecs/deferred_commands.d.cts +15 -14
- package/dist/core/ecs/deferred_commands.d.ts +15 -14
- package/dist/core/ecs/deferred_commands.d.ts.map +1 -1
- package/dist/core/ecs/dispatch_trace.d.cts +32 -31
- package/dist/core/ecs/dispatch_trace.d.ts +32 -31
- package/dist/core/ecs/dispatch_trace.d.ts.map +1 -1
- package/dist/core/ecs/ecs.d.cts +289 -270
- package/dist/core/ecs/ecs.d.ts +289 -270
- package/dist/core/ecs/ecs.d.ts.map +1 -1
- package/dist/core/ecs/ecs_memory.d.cts +134 -136
- package/dist/core/ecs/ecs_memory.d.ts +134 -136
- package/dist/core/ecs/ecs_memory.d.ts.map +1 -1
- package/dist/core/ecs/ecs_options.d.cts +89 -0
- package/dist/core/ecs/ecs_options.d.ts +89 -0
- package/dist/core/ecs/ecs_options.d.ts.map +1 -0
- package/dist/core/ecs/entity.d.cts +4 -4
- package/dist/core/ecs/entity.d.ts +4 -4
- package/dist/core/ecs/entity_allocator.d.cts +20 -18
- package/dist/core/ecs/entity_allocator.d.ts +20 -18
- package/dist/core/ecs/entity_allocator.d.ts.map +1 -1
- package/dist/core/ecs/event.d.cts +36 -22
- package/dist/core/ecs/event.d.ts +36 -22
- package/dist/core/ecs/event.d.ts.map +1 -1
- package/dist/core/ecs/facades.d.cts +12 -126
- package/dist/core/ecs/facades.d.ts +12 -126
- package/dist/core/ecs/facades.d.ts.map +1 -1
- package/dist/core/ecs/frame_stepper.d.cts +12 -12
- package/dist/core/ecs/frame_stepper.d.ts +12 -12
- package/dist/core/ecs/frame_stepper.d.ts.map +1 -1
- package/dist/core/ecs/frame_trace.d.cts +32 -32
- package/dist/core/ecs/frame_trace.d.ts +32 -32
- package/dist/core/ecs/frame_trace.d.ts.map +1 -1
- package/dist/core/ecs/host_commands.d.cts +103 -85
- package/dist/core/ecs/host_commands.d.ts +103 -85
- package/dist/core/ecs/host_commands.d.ts.map +1 -1
- package/dist/core/ecs/index.d.cts +21 -11
- package/dist/core/ecs/index.d.ts +21 -11
- package/dist/core/ecs/index.d.ts.map +1 -1
- package/dist/core/ecs/observer.d.cts +39 -120
- package/dist/core/ecs/observer.d.ts +39 -120
- package/dist/core/ecs/observer.d.ts.map +1 -1
- package/dist/core/ecs/phase.d.cts +79 -0
- package/dist/core/ecs/phase.d.ts +79 -0
- package/dist/core/ecs/phase.d.ts.map +1 -0
- package/dist/core/ecs/plugin.d.cts +125 -0
- package/dist/core/ecs/plugin.d.ts +125 -0
- package/dist/core/ecs/plugin.d.ts.map +1 -0
- package/dist/core/ecs/plugin_slots.d.cts +26 -0
- package/dist/core/ecs/plugin_slots.d.ts +26 -0
- package/dist/core/ecs/plugin_slots.d.ts.map +1 -0
- package/dist/core/ecs/query.d.cts +208 -578
- package/dist/core/ecs/query.d.ts +208 -578
- package/dist/core/ecs/query.d.ts.map +1 -1
- package/dist/core/ecs/query_cache.d.cts +130 -0
- package/dist/core/ecs/query_cache.d.ts +130 -0
- package/dist/core/ecs/query_cache.d.ts.map +1 -0
- package/dist/core/ecs/query_registry.d.cts +47 -0
- package/dist/core/ecs/query_registry.d.ts +47 -0
- package/dist/core/ecs/query_registry.d.ts.map +1 -0
- package/dist/core/ecs/query_terms.d.cts +126 -0
- package/dist/core/ecs/query_terms.d.ts +126 -0
- package/dist/core/ecs/query_terms.d.ts.map +1 -0
- package/dist/core/ecs/ref.d.cts +100 -39
- package/dist/core/ecs/ref.d.ts +100 -39
- package/dist/core/ecs/ref.d.ts.map +1 -1
- package/dist/core/ecs/relation.d.cts +101 -182
- package/dist/core/ecs/relation.d.ts +101 -182
- package/dist/core/ecs/relation.d.ts.map +1 -1
- package/dist/core/ecs/resource.d.cts +13 -13
- package/dist/core/ecs/resource.d.ts +13 -13
- package/dist/core/ecs/resource_registry.d.cts +5 -5
- package/dist/core/ecs/resource_registry.d.ts +5 -5
- package/dist/core/ecs/resource_registry.d.ts.map +1 -1
- package/dist/core/ecs/row_kinds.d.cts +24 -0
- package/dist/core/ecs/row_kinds.d.ts +24 -0
- package/dist/core/ecs/row_kinds.d.ts.map +1 -0
- package/dist/core/ecs/run_condition.d.cts +23 -23
- package/dist/core/ecs/run_condition.d.ts +23 -23
- package/dist/core/ecs/run_condition.d.ts.map +1 -1
- package/dist/core/ecs/schedule.d.cts +91 -120
- package/dist/core/ecs/schedule.d.ts +91 -120
- package/dist/core/ecs/schedule.d.ts.map +1 -1
- package/dist/core/ecs/schedule_plan.d.cts +33 -0
- package/dist/core/ecs/schedule_plan.d.ts +33 -0
- package/dist/core/ecs/schedule_plan.d.ts.map +1 -0
- package/dist/core/ecs/snapshot.d.cts +77 -0
- package/dist/core/ecs/snapshot.d.ts +77 -0
- package/dist/core/ecs/snapshot.d.ts.map +1 -0
- package/dist/core/ecs/snapshot_mount.d.cts +42 -0
- package/dist/core/ecs/snapshot_mount.d.ts +42 -0
- package/dist/core/ecs/snapshot_mount.d.ts.map +1 -0
- package/dist/core/ecs/sparse_store.d.cts +108 -51
- package/dist/core/ecs/sparse_store.d.ts +108 -51
- package/dist/core/ecs/sparse_store.d.ts.map +1 -1
- package/dist/core/ecs/store.d.cts +527 -473
- package/dist/core/ecs/store.d.ts +527 -473
- package/dist/core/ecs/store.d.ts.map +1 -1
- package/dist/core/ecs/store_layout_listener.d.cts +6 -6
- package/dist/core/ecs/store_layout_listener.d.ts +6 -6
- package/dist/core/ecs/store_types.d.cts +122 -0
- package/dist/core/ecs/store_types.d.ts +122 -0
- package/dist/core/ecs/store_types.d.ts.map +1 -0
- package/dist/core/ecs/system.d.cts +146 -61
- package/dist/core/ecs/system.d.ts +146 -61
- package/dist/core/ecs/system.d.ts.map +1 -1
- package/dist/core/ecs/system_context.d.cts +296 -0
- package/dist/core/ecs/system_context.d.ts +296 -0
- package/dist/core/ecs/system_context.d.ts.map +1 -0
- package/dist/core/ecs/system_set.d.cts +48 -0
- package/dist/core/ecs/system_set.d.ts +48 -0
- package/dist/core/ecs/system_set.d.ts.map +1 -0
- package/dist/core/ecs/utils/arrays.d.cts +15 -1
- package/dist/core/ecs/utils/arrays.d.ts +15 -1
- package/dist/core/ecs/utils/arrays.d.ts.map +1 -1
- package/dist/core/ecs/utils/error.d.cts +82 -6
- package/dist/core/ecs/utils/error.d.ts +82 -6
- package/dist/core/ecs/utils/error.d.ts.map +1 -1
- package/dist/core/ecs/utils/plugin_error.d.cts +10 -0
- package/dist/core/ecs/utils/plugin_error.d.ts +10 -0
- package/dist/core/ecs/utils/plugin_error.d.ts.map +1 -0
- package/dist/core/restore_errors.d.cts +30 -0
- package/dist/core/restore_errors.d.ts +30 -0
- package/dist/core/restore_errors.d.ts.map +1 -0
- package/dist/core/store/action_ring.d.cts +44 -44
- package/dist/core/store/action_ring.d.ts +44 -44
- package/dist/core/store/action_ring.d.ts.map +1 -1
- package/dist/core/store/allocator.d.cts +149 -95
- package/dist/core/store/allocator.d.ts +149 -95
- package/dist/core/store/allocator.d.ts.map +1 -1
- package/dist/core/store/buffer_backed_column.d.cts +17 -17
- package/dist/core/store/buffer_backed_column.d.ts +17 -17
- package/dist/core/store/buffer_backed_column.d.ts.map +1 -1
- package/dist/core/store/column_store.d.cts +124 -86
- package/dist/core/store/column_store.d.ts +124 -86
- package/dist/core/store/column_store.d.ts.map +1 -1
- package/dist/core/store/command_dispatch.d.cts +14 -15
- package/dist/core/store/command_dispatch.d.ts +14 -15
- package/dist/core/store/command_dispatch.d.ts.map +1 -1
- package/dist/core/store/command_ring.d.cts +36 -39
- package/dist/core/store/command_ring.d.ts +36 -39
- package/dist/core/store/command_ring.d.ts.map +1 -1
- package/dist/core/store/descriptor.d.cts +34 -17
- package/dist/core/store/descriptor.d.ts +34 -17
- package/dist/core/store/descriptor.d.ts.map +1 -1
- package/dist/core/store/entity_index.d.cts +34 -35
- package/dist/core/store/entity_index.d.ts +34 -35
- package/dist/core/store/entity_index.d.ts.map +1 -1
- package/dist/core/store/event_ring.d.cts +36 -38
- package/dist/core/store/event_ring.d.ts +36 -38
- package/dist/core/store/event_ring.d.ts.map +1 -1
- package/dist/core/store/extend.d.cts +13 -7
- package/dist/core/store/extend.d.ts +13 -7
- package/dist/core/store/extend.d.ts.map +1 -1
- package/dist/core/store/grow.d.cts +2 -2
- package/dist/core/store/grow.d.ts +2 -2
- package/dist/core/store/grow.d.ts.map +1 -1
- package/dist/core/store/header.d.cts +31 -27
- package/dist/core/store/header.d.ts +31 -27
- package/dist/core/store/header.d.ts.map +1 -1
- package/dist/core/store/index.d.cts +10 -10
- package/dist/core/store/index.d.ts +10 -10
- package/dist/core/store/index.d.ts.map +1 -1
- package/dist/core/store/layout_ops.d.cts +71 -62
- package/dist/core/store/layout_ops.d.ts +71 -62
- package/dist/core/store/layout_ops.d.ts.map +1 -1
- package/dist/core/store/region_table.d.cts +28 -21
- package/dist/core/store/region_table.d.ts +28 -21
- package/dist/core/store/region_table.d.ts.map +1 -1
- package/dist/core/store/snapshot.d.cts +31 -16
- package/dist/core/store/snapshot.d.ts +31 -16
- package/dist/core/store/snapshot.d.ts.map +1 -1
- package/dist/core/store/state_hash.d.cts +12 -12
- package/dist/core/store/state_hash.d.ts +12 -12
- package/dist/core/store/state_hash.d.ts.map +1 -1
- package/dist/core/store/store_regions.d.cts +10 -10
- package/dist/core/store/store_regions.d.ts +10 -10
- package/dist/core/store/store_regions.d.ts.map +1 -1
- package/dist/core/store/vendored_abi/abi.d.cts +27 -2
- package/dist/core/store/vendored_abi/abi.d.ts +27 -2
- package/dist/core/store/vendored_abi/abi.d.ts.map +1 -1
- package/dist/host_commands-B2KMx8O2.cjs +1 -0
- package/dist/host_commands-ClVPvhSa.cjs +2 -0
- package/dist/host_commands-CwxVQS1z.js +1524 -0
- package/dist/host_commands-nJvTy88E.js +1667 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +15 -10
- package/dist/index.d.ts +15 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.development.cjs +1 -1
- package/dist/index.development.js +5804 -5203
- package/dist/index.js +5323 -4764
- package/dist/internal.cjs +2 -2
- package/dist/internal.d.cts +5 -2
- package/dist/internal.d.ts +5 -2
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.development.cjs +1 -1
- package/dist/internal.development.js +70 -20
- package/dist/internal.js +138 -83
- package/dist/plugins/abi-D3V-QUSf.cjs +1 -0
- package/dist/plugins/abi-NP8pNxpd.js +42 -0
- package/dist/plugins/arrays-Dr_1hCjL.js +28 -0
- package/dist/plugins/arrays-Dt-Joc4i.cjs +1 -0
- package/dist/plugins/assertions-gtDVfbnQ.js +6 -0
- package/dist/plugins/assertions-z5GQd_bB.cjs +1 -0
- package/dist/{extensions → plugins}/editor/editor.d.cts +54 -54
- package/dist/{extensions → plugins}/editor/editor.d.ts +54 -54
- package/dist/plugins/editor/editor.d.ts.map +1 -0
- package/dist/{extensions → plugins}/editor/field_handle.d.cts +12 -12
- package/dist/{extensions → plugins}/editor/field_handle.d.ts +12 -12
- package/dist/plugins/editor/field_handle.d.ts.map +1 -0
- package/dist/plugins/editor/index.d.cts +22 -0
- package/dist/plugins/editor/index.d.ts +22 -0
- package/dist/plugins/editor/index.d.ts.map +1 -0
- package/dist/plugins/editor.cjs +1 -0
- package/dist/plugins/editor.d.cts +1 -0
- package/dist/plugins/editor.d.ts +1 -0
- package/dist/plugins/editor.development.cjs +1 -0
- package/dist/{extensions/editor/index.development.js → plugins/editor.development.js} +81 -64
- package/dist/{extensions/editor/index.js → plugins/editor.js} +81 -64
- package/dist/plugins/events/event_channel.d.cts +13 -0
- package/dist/plugins/events/event_channel.d.ts +13 -0
- package/dist/plugins/events/event_channel.d.ts.map +1 -0
- package/dist/plugins/events/event_registry.d.cts +22 -0
- package/dist/plugins/events/event_registry.d.ts +22 -0
- package/dist/plugins/events/event_registry.d.ts.map +1 -0
- package/dist/plugins/events/facade.d.cts +26 -0
- package/dist/plugins/events/facade.d.ts +26 -0
- package/dist/plugins/events/facade.d.ts.map +1 -0
- package/dist/plugins/events/index.d.cts +10 -0
- package/dist/plugins/events/index.d.ts +10 -0
- package/dist/plugins/events/index.d.ts.map +1 -0
- package/dist/plugins/events.cjs +1 -0
- package/dist/plugins/events.d.cts +1 -0
- package/dist/plugins/events.d.ts +1 -0
- package/dist/plugins/events.development.cjs +1 -0
- package/dist/plugins/events.development.js +174 -0
- package/dist/plugins/events.js +159 -0
- package/dist/plugins/observers/index.d.cts +23 -0
- package/dist/plugins/observers/index.d.ts +23 -0
- package/dist/plugins/observers/index.d.ts.map +1 -0
- package/dist/plugins/observers/observer_registry.d.cts +101 -0
- package/dist/plugins/observers/observer_registry.d.ts +101 -0
- package/dist/plugins/observers/observer_registry.d.ts.map +1 -0
- package/dist/plugins/observers.cjs +1 -0
- package/dist/plugins/observers.d.cts +1 -0
- package/dist/plugins/observers.d.ts +1 -0
- package/dist/plugins/observers.development.cjs +1 -0
- package/dist/plugins/observers.development.js +431 -0
- package/dist/plugins/observers.js +403 -0
- package/dist/plugins/relation_store-BsoegrZh.js +313 -0
- package/dist/plugins/relation_store-DQKSnxsm.cjs +1 -0
- package/dist/plugins/relation_store-RBhpcE28.cjs +1 -0
- package/dist/plugins/relation_store-RqW5Snx6.js +328 -0
- package/dist/plugins/relations/builtin_relations.d.cts +48 -0
- package/dist/plugins/relations/builtin_relations.d.ts +48 -0
- package/dist/plugins/relations/builtin_relations.d.ts.map +1 -0
- package/dist/plugins/relations/facade.d.cts +73 -0
- package/dist/plugins/relations/facade.d.ts +73 -0
- package/dist/plugins/relations/facade.d.ts.map +1 -0
- package/dist/plugins/relations/index.d.cts +11 -0
- package/dist/plugins/relations/index.d.ts +11 -0
- package/dist/plugins/relations/index.d.ts.map +1 -0
- package/dist/{core/ecs → plugins/relations}/relation_service.d.cts +85 -97
- package/dist/{core/ecs → plugins/relations}/relation_service.d.ts +85 -97
- package/dist/plugins/relations/relation_service.d.ts.map +1 -0
- package/dist/plugins/relations/relation_store.d.cts +177 -0
- package/dist/plugins/relations/relation_store.d.ts +177 -0
- package/dist/plugins/relations/relation_store.d.ts.map +1 -0
- package/dist/plugins/relations.cjs +1 -0
- package/dist/plugins/relations.d.cts +1 -0
- package/dist/plugins/relations.d.ts +1 -0
- package/dist/plugins/relations.development.cjs +1 -0
- package/dist/plugins/relations.development.js +603 -0
- package/dist/plugins/relations.js +553 -0
- package/dist/plugins/snapshots/index.d.cts +33 -0
- package/dist/plugins/snapshots/index.d.ts +33 -0
- package/dist/plugins/snapshots/index.d.ts.map +1 -0
- package/dist/plugins/snapshots/resume.d.cts +57 -0
- package/dist/plugins/snapshots/resume.d.ts +57 -0
- package/dist/plugins/snapshots/resume.d.ts.map +1 -0
- package/dist/plugins/snapshots/snapshot_service.d.cts +59 -0
- package/dist/plugins/snapshots/snapshot_service.d.ts +59 -0
- package/dist/plugins/snapshots/snapshot_service.d.ts.map +1 -0
- package/dist/plugins/snapshots.cjs +1 -0
- package/dist/plugins/snapshots.d.cts +1 -0
- package/dist/plugins/snapshots.d.ts +1 -0
- package/dist/plugins/snapshots.development.cjs +1 -0
- package/dist/plugins/snapshots.development.js +737 -0
- package/dist/plugins/snapshots.js +737 -0
- package/dist/plugins/solid/index.d.cts +8 -0
- package/dist/plugins/solid/index.d.ts +8 -0
- package/dist/plugins/solid/index.d.ts.map +1 -0
- package/dist/plugins/solid/solid.d.cts +97 -0
- package/dist/plugins/solid/solid.d.ts +97 -0
- package/dist/plugins/solid/solid.d.ts.map +1 -0
- package/dist/plugins/solid.cjs +1 -0
- package/dist/plugins/solid.d.cts +1 -0
- package/dist/plugins/solid.d.ts +1 -0
- package/dist/plugins/solid.development.cjs +1 -0
- package/dist/plugins/solid.development.js +319 -0
- package/dist/plugins/solid.js +319 -0
- package/dist/plugins/workers/index.d.cts +75 -0
- package/dist/plugins/workers/index.d.ts +75 -0
- package/dist/plugins/workers/index.d.ts.map +1 -0
- package/dist/plugins/workers/node_threads.d.cts +25 -0
- package/dist/plugins/workers/node_threads.d.ts +25 -0
- package/dist/plugins/workers/node_threads.d.ts.map +1 -0
- package/dist/plugins/workers/plan.d.cts +61 -0
- package/dist/plugins/workers/plan.d.ts +61 -0
- package/dist/plugins/workers/plan.d.ts.map +1 -0
- package/dist/plugins/workers/pool.d.cts +144 -0
- package/dist/plugins/workers/pool.d.ts +144 -0
- package/dist/plugins/workers/pool.d.ts.map +1 -0
- package/dist/plugins/workers/protocol.d.cts +112 -0
- package/dist/plugins/workers/protocol.d.ts +112 -0
- package/dist/plugins/workers/protocol.d.ts.map +1 -0
- package/dist/plugins/workers/worker_bind.d.cts +64 -0
- package/dist/plugins/workers/worker_bind.d.ts +64 -0
- package/dist/plugins/workers/worker_bind.d.ts.map +1 -0
- package/dist/plugins/workers/worker_loop.d.cts +14 -0
- package/dist/plugins/workers/worker_loop.d.ts +14 -0
- package/dist/plugins/workers/worker_loop.d.ts.map +1 -0
- package/dist/plugins/workers.cjs +1 -0
- package/dist/plugins/workers.d.cts +1 -0
- package/dist/plugins/workers.d.ts +1 -0
- package/dist/plugins/workers.development.cjs +1 -0
- package/dist/plugins/workers.development.js +596 -0
- package/dist/plugins/workers.js +474 -0
- package/dist/primitives.cjs +1 -1
- package/dist/primitives.d.cts +4 -4
- package/dist/primitives.d.ts +4 -4
- package/dist/primitives.development.cjs +1 -1
- package/dist/primitives.development.js +66 -22
- package/dist/primitives.js +66 -22
- package/dist/shared-BKl12xF1.js +132 -0
- package/dist/shared-Dk-pACZT.cjs +1 -0
- package/dist/shared.cjs +1 -1
- package/dist/shared.d.cts +7 -7
- package/dist/shared.d.ts +7 -7
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.development.cjs +1 -1
- package/dist/shared.development.js +4 -3
- package/dist/shared.js +4 -3
- package/dist/topological_sort-Cc_yXqPT.js +346 -0
- package/dist/topological_sort-vp1imU6D.cjs +1 -0
- package/dist/type_primitives/assertions.d.cts +12 -16
- package/dist/type_primitives/assertions.d.ts +12 -16
- package/dist/type_primitives/assertions.d.ts.map +1 -1
- package/dist/type_primitives/binary_heap/binary_heap.d.cts +2 -6
- package/dist/type_primitives/binary_heap/binary_heap.d.ts +2 -6
- package/dist/type_primitives/binary_heap/binary_heap.d.ts.map +1 -1
- package/dist/type_primitives/bitset/bitset.d.cts +7 -11
- package/dist/type_primitives/bitset/bitset.d.ts +7 -11
- package/dist/type_primitives/bitset/bitset.d.ts.map +1 -1
- package/dist/type_primitives/brand.d.cts +2 -7
- package/dist/type_primitives/brand.d.ts +2 -7
- package/dist/type_primitives/brand.d.ts.map +1 -1
- package/dist/type_primitives/error.d.cts +1 -2
- package/dist/type_primitives/error.d.ts +1 -2
- package/dist/type_primitives/error.d.ts.map +1 -1
- package/dist/type_primitives/index.d.cts +1 -1
- package/dist/type_primitives/index.d.ts +1 -1
- package/dist/type_primitives/sparse_map/sparse_map.d.cts +3 -7
- package/dist/type_primitives/sparse_map/sparse_map.d.ts +3 -7
- package/dist/type_primitives/sparse_map/sparse_map.d.ts.map +1 -1
- package/dist/type_primitives/sparse_set/sparse_set.d.cts +2 -6
- package/dist/type_primitives/sparse_set/sparse_set.d.ts +2 -6
- package/dist/type_primitives/sparse_set/sparse_set.d.ts.map +1 -1
- package/dist/type_primitives/topological_sort/topological_sort.d.cts +1 -5
- package/dist/type_primitives/topological_sort/topological_sort.d.ts +1 -5
- package/dist/type_primitives/topological_sort/topological_sort.d.ts.map +1 -1
- package/dist/type_primitives/typed_arrays/typed_arrays.d.cts +16 -15
- package/dist/type_primitives/typed_arrays/typed_arrays.d.ts +16 -15
- package/dist/type_primitives/typed_arrays/typed_arrays.d.ts.map +1 -1
- package/dist/utils/error.d.ts.map +1 -1
- package/dist/version.d.cts +3 -3
- package/dist/version.d.ts +3 -3
- package/dist/worker.cjs +1 -0
- package/dist/worker.d.cts +17 -0
- package/dist/worker.d.ts +17 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.development.cjs +1 -0
- package/dist/worker.development.js +253 -0
- package/dist/worker.js +253 -0
- package/package.json +363 -191
- package/dist/core/ecs/builtin_relations.d.cts +0 -43
- package/dist/core/ecs/builtin_relations.d.ts +0 -43
- package/dist/core/ecs/builtin_relations.d.ts.map +0 -1
- package/dist/core/ecs/event_registry.d.cts +0 -22
- package/dist/core/ecs/event_registry.d.ts +0 -22
- package/dist/core/ecs/event_registry.d.ts.map +0 -1
- package/dist/core/ecs/relation_service.d.ts.map +0 -1
- package/dist/core/ecs/resume.d.cts +0 -85
- package/dist/core/ecs/resume.d.ts +0 -85
- package/dist/core/ecs/resume.d.ts.map +0 -1
- package/dist/core/ecs/snapshot_service.d.cts +0 -94
- package/dist/core/ecs/snapshot_service.d.ts +0 -94
- package/dist/core/ecs/snapshot_service.d.ts.map +0 -1
- package/dist/extensions/editor/editor.d.ts.map +0 -1
- package/dist/extensions/editor/field_handle.d.ts.map +0 -1
- package/dist/extensions/editor/index.cjs +0 -1
- package/dist/extensions/editor/index.d.cts +0 -21
- package/dist/extensions/editor/index.d.ts +0 -21
- package/dist/extensions/editor/index.d.ts.map +0 -1
- package/dist/extensions/editor/index.development.cjs +0 -1
- package/dist/extensions/reactive/ecs_sync.d.cts +0 -214
- package/dist/extensions/reactive/ecs_sync.d.ts +0 -214
- package/dist/extensions/reactive/ecs_sync.d.ts.map +0 -1
- package/dist/extensions/reactive/index.cjs +0 -1
- package/dist/extensions/reactive/index.d.cts +0 -23
- package/dist/extensions/reactive/index.d.ts +0 -23
- package/dist/extensions/reactive/index.d.ts.map +0 -1
- package/dist/extensions/reactive/index.development.cjs +0 -1
- package/dist/extensions/reactive/index.development.js +0 -215
- package/dist/extensions/reactive/index.js +0 -215
- package/dist/extensions/solid/index.cjs +0 -1
- package/dist/extensions/solid/index.d.cts +0 -6
- package/dist/extensions/solid/index.d.ts +0 -6
- package/dist/extensions/solid/index.d.ts.map +0 -1
- package/dist/extensions/solid/index.development.cjs +0 -1
- package/dist/extensions/solid/index.development.js +0 -40
- package/dist/extensions/solid/index.js +0 -36
- package/dist/extensions/solid/kernel_solid.d.cts +0 -45
- package/dist/extensions/solid/kernel_solid.d.ts +0 -45
- package/dist/extensions/solid/kernel_solid.d.ts.map +0 -1
- package/dist/host_commands-BlR3oZ3x.js +0 -2406
- package/dist/host_commands-C2cpU3yC.cjs +0 -1
- package/dist/internal-BoxWl4dG.js +0 -2565
- package/dist/internal-CGBEwfeB.cjs +0 -2
- package/dist/interop-CT-REx0W.cjs +0 -1
- package/dist/interop-CcY6ASQc.js +0 -18
- package/dist/interop-DqxleBo7.js +0 -18
- package/dist/interop-T1HZ-Dpa.cjs +0 -1
- package/dist/kernel-Cz2Kxlwl.js +0 -240
- package/dist/kernel-DgyrLFjW.js +0 -227
- package/dist/kernel-sw7ScKWu.cjs +0 -1
- package/dist/kernel-yWV3XnAb.cjs +0 -1
- package/dist/reactive/array.d.cts +0 -24
- package/dist/reactive/array.d.ts +0 -24
- package/dist/reactive/array.d.ts.map +0 -1
- package/dist/reactive/index.cjs +0 -1
- package/dist/reactive/index.d.cts +0 -11
- package/dist/reactive/index.d.ts +0 -11
- package/dist/reactive/index.d.ts.map +0 -1
- package/dist/reactive/index.development.cjs +0 -1
- package/dist/reactive/index.development.js +0 -18
- package/dist/reactive/index.js +0 -18
- package/dist/reactive/interop.d.cts +0 -19
- package/dist/reactive/interop.d.ts +0 -19
- package/dist/reactive/interop.d.ts.map +0 -1
- package/dist/reactive/kernel.d.cts +0 -73
- package/dist/reactive/kernel.d.ts +0 -73
- package/dist/reactive/kernel.d.ts.map +0 -1
- package/dist/reactive/map.d.cts +0 -16
- package/dist/reactive/map.d.ts +0 -16
- package/dist/reactive/map.d.ts.map +0 -1
- package/dist/reactive/shallow.d.cts +0 -11
- package/dist/reactive/shallow.d.ts +0 -11
- package/dist/reactive/shallow.d.ts.map +0 -1
- package/dist/reactive/struct.d.cts +0 -10
- package/dist/reactive/struct.d.ts +0 -10
- package/dist/reactive/struct.d.ts.map +0 -1
- package/dist/shallow-Bs39EPh1.js +0 -150
- package/dist/shallow-C5YmTbtb.cjs +0 -1
- package/dist/shallow-CiFC70Dz.js +0 -159
- package/dist/shallow-DQ8aG51_.cjs +0 -1
- package/dist/shared-B4v0L1cw.js +0 -109
- package/dist/shared-DU78k0pU.cjs +0 -1
- package/dist/topological_sort-BDvEyb9W.cjs +0 -1
- package/dist/topological_sort-DK6EjpWa.js +0 -135
- package/dist/typed_arrays-D3NmwtCG.cjs +0 -1
- package/dist/typed_arrays-DIVwVy5_.js +0 -258
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ArchetypeID, ArchetypeView } from './archetype_types.js';
|
|
2
|
+
import { AnyTypedArray, ColumnBacking, TypedArrayTag, BitSet } from '../../type_primitives/index.js';
|
|
2
3
|
import { ColumnStore } from '../store/column_store.js';
|
|
3
|
-
import { ComponentID, ComponentDef, ComponentSchema,
|
|
4
|
+
import { ComponentID, ComponentDef, ComponentSchema, TagToTypedArray, ColumnsForSchema, MutableColumnsForSchema, ReadonlyColumn } from './component.js';
|
|
4
5
|
import { EntityID, ReadonlyEntityIDArray } from './entity.js';
|
|
5
|
-
|
|
6
|
+
import { AccessorColumns } from './ref.js';
|
|
7
|
+
export type { ArchetypeID, ArchetypeView } from './archetype_types.js';
|
|
6
8
|
export declare const asArchetypeId: (value: number) => ArchetypeID;
|
|
7
9
|
export interface ArchetypeEdge {
|
|
8
10
|
add: ArchetypeID | null;
|
|
@@ -16,11 +18,11 @@ export interface ArchetypeEdge {
|
|
|
16
18
|
* Cached resolution of a *multi*-component add out of this archetype: the
|
|
17
19
|
* target archetype the union lands in, plus the pre-built src→target batch
|
|
18
20
|
* transition map. Keyed (on the source archetype) by an exact N-tagged pack of
|
|
19
|
-
* the added component ids
|
|
21
|
+
* the added component ids, see `Store.addComponents`.
|
|
20
22
|
*
|
|
21
23
|
* Where `ArchetypeEdge` is the per-*component* edge the single-add path indexes
|
|
22
|
-
* by `
|
|
23
|
-
* up by packed key
|
|
24
|
+
* by `_edges[component_id]`, this is the per-*set* edge the plural-add path looks
|
|
25
|
+
* up by packed key, folding the mask hash, `archLookup`, and batch-map fetch
|
|
24
26
|
* the final-mask resolve repeats every call into one `Map.get`. Never
|
|
25
27
|
* invalidated: the archetype graph is monotonic (archetypes outlive the Store).
|
|
26
28
|
*/
|
|
@@ -33,78 +35,30 @@ export interface ArchetypeColumnLayout {
|
|
|
33
35
|
fieldNames: string[];
|
|
34
36
|
fieldIndex: Record<string, number>;
|
|
35
37
|
fieldTypes: TypedArrayTag[];
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
/** The global name id of each field (`fieldGids` in ref.ts). Optional so a
|
|
39
|
+
* test can build a heap archetype from a bare layout. The archetype then
|
|
40
|
+
* uses the ordinals as ids, which is correct for an archetype that no ref or
|
|
41
|
+
* cursor reaches through the shared prototype. */
|
|
42
|
+
fieldGid?: Int32Array;
|
|
40
43
|
}
|
|
41
44
|
/**
|
|
42
45
|
* Per-column allocator. Returns a `ColumnBacking` for the field at
|
|
43
46
|
* `fieldIdx` of component `component_id`. The default factory (when none
|
|
44
47
|
* is supplied to the constructor) allocates a `GrowableTypedArray` on the
|
|
45
|
-
* heap
|
|
48
|
+
* heap. `fromColumnStore` supplies a factory that wraps SAB views instead.
|
|
46
49
|
*/
|
|
47
50
|
export type ColumnFactory = (componentId: ComponentID, fieldIdx: number, tag: TypedArrayTag) => ColumnBacking<AnyTypedArray>;
|
|
48
51
|
/**
|
|
49
52
|
* Hook the host installs on every SAB-backed archetype so the Archetype
|
|
50
|
-
* can request a SAB grow + refresh from the host
|
|
53
|
+
* can request a SAB grow + refresh from the host before the insertion
|
|
51
54
|
* that would otherwise throw `StoreColumnOverflowError`. The host (Store)
|
|
52
55
|
* is responsible for running `growColumnStore` and `refreshViews`
|
|
53
|
-
* across every SAB-backed archetype
|
|
54
|
-
* `arch.
|
|
55
|
-
* additional`. Heap-backed archetypes leave this unset
|
|
56
|
+
* across every SAB-backed archetype. After the handler returns,
|
|
57
|
+
* `arch.flatColumns[i].buf.length` is guaranteed to be `>= arch.length +
|
|
58
|
+
* additional`. Heap-backed archetypes leave this unset, their
|
|
56
59
|
* `GrowableTypedArray` grows in place.
|
|
57
60
|
*/
|
|
58
61
|
export type ArchetypeGrowHandler = (arch: Archetype, additional: number) => void;
|
|
59
|
-
/**
|
|
60
|
-
* Public, read-only window onto an archetype's rows. This is the ONLY
|
|
61
|
-
* surface `Query.archetypes`, `Query.forEach`, and `ChangedQuery.forEach`
|
|
62
|
-
* hand to callers — the concrete `Archetype` (with its structural mutators
|
|
63
|
-
* `removeEntity`, `moveEntityFrom`, `writeFields`, `setEdge`, and the
|
|
64
|
-
* mutable `getColumn`) stays internal so query iteration can't bypass the
|
|
65
|
-
* deferred-flush path that prevents iterator invalidation. This is the same
|
|
66
|
-
* back door that is closed for `Store` and closed again for `Query`.
|
|
67
|
-
*
|
|
68
|
-
* `id` is the archetype's opaque identity (not a mutator) — exposed so the
|
|
69
|
-
* public `ECS.batchAddComponent`/`batchRemoveComponent` API can target an
|
|
70
|
-
* archetype without the caller holding a concrete `Archetype` reference.
|
|
71
|
-
*/
|
|
72
|
-
export interface ArchetypeView<out Defs extends readonly ComponentDef<any>[] = readonly ComponentDef<any>[]> {
|
|
73
|
-
/** Opaque archetype identity. Pass to `ECS.batch_*_component`. */
|
|
74
|
-
readonly id: ArchetypeID;
|
|
75
|
-
/** Number of **enabled** entities — the default-iteration bound. Rows
|
|
76
|
-
* `0..entityCount-1` are enabled; disabled rows (if any) sit contiguously at
|
|
77
|
-
* `entityCount..totalCount-1`. `forEach` SoA loops read this, so they skip
|
|
78
|
-
* disabled rows for free. Use `totalCount` to span disabled rows too. */
|
|
79
|
-
readonly entityCount: number;
|
|
80
|
-
/** Total live rows, enabled + disabled. Equal to `entityCount` unless
|
|
81
|
-
* some rows are disabled. Use for full-state work (serialization, snapshot,
|
|
82
|
-
* determinism) that must see every entity regardless of enabled state. */
|
|
83
|
-
readonly totalCount: number;
|
|
84
|
-
/** Number of disabled rows = `totalCount - entityCount`. */
|
|
85
|
-
readonly disabledCount: number;
|
|
86
|
-
/** Raw entity ID buffer (packed `EntityID`s). Valid data at indices
|
|
87
|
-
* 0..totalCount-1 (enabled rows first, then disabled). */
|
|
88
|
-
readonly entityIds: ReadonlyEntityIDArray;
|
|
89
|
-
/** True if this archetype's mask includes the given component. */
|
|
90
|
-
hasComponent(id: ComponentID): boolean;
|
|
91
|
-
/** Get a single field's column (read-only). Valid data: indices
|
|
92
|
-
* 0..entityCount-1. `def` must be a term of the iterating query
|
|
93
|
-
*; the bare-`ArchetypeView` default stays permissive. */
|
|
94
|
-
getColumnRead<D extends ComponentDef<any>, K extends string & keyof SchemaOf<D>>(def: D & DeclaredQueryTerm<Defs, D>, field: K): ReadonlyColumn;
|
|
95
|
-
/** Tuple fetch of several of one component's columns —
|
|
96
|
-
* `const [q, r] = arch.getColumnsRead(HexPos, "q", "r")`. One small
|
|
97
|
-
* array allocation per call; see the class doc on `Archetype`. */
|
|
98
|
-
getColumnsRead<D extends ComponentDef<any>, const K extends readonly (string & keyof SchemaOf<D>)[]>(def: D & DeclaredQueryTerm<Defs, D>, ...fields: K): {
|
|
99
|
-
[I in keyof K]: ReadonlyColumn;
|
|
100
|
-
};
|
|
101
|
-
/** Get a single field's column **if this archetype has the component**,
|
|
102
|
-
* else `undefined` — the optional-query fetch-if-present accessor.
|
|
103
|
-
* The absent branch is expected (resolve the column pointer per archetype
|
|
104
|
-
* span: present ⇒ column, absent ⇒ `undefined`), not an error. Same
|
|
105
|
-
* advisory-readonly view and `reads`-access-check as `getColumnRead`. */
|
|
106
|
-
getOptionalColumnRead<S extends ComponentSchema, K extends string & keyof S>(def: ComponentDef<S>, field: K): ReadonlyColumn | undefined;
|
|
107
|
-
}
|
|
108
62
|
export declare class Archetype implements ArchetypeView {
|
|
109
63
|
readonly id: ArchetypeID;
|
|
110
64
|
readonly mask: BitSet;
|
|
@@ -112,108 +66,148 @@ export declare class Archetype implements ArchetypeView {
|
|
|
112
66
|
/**
|
|
113
67
|
* Whether a member entity occupies a real row here. True for every archetype
|
|
114
68
|
* except the **empty archetype** (the one with no components), where a
|
|
115
|
-
* component-less entity is "alive but unplaced"
|
|
116
|
-
* `
|
|
69
|
+
* component-less entity is "alive but unplaced". It points here via
|
|
70
|
+
* `_entityArchetypes` but carries `_entityRows === UNASSIGNED` and holds no
|
|
117
71
|
* row, exactly like a freshly `createEntity`'d one. Keeping the empty
|
|
118
72
|
* archetype rowless gives a component-less entity a single canonical form
|
|
119
73
|
* regardless of how it got there (created bare vs. lost its last component),
|
|
120
|
-
* so `stateHash` and zero-require query iteration don't depend on add
|
|
74
|
+
* so `stateHash` and zero-require query iteration don't depend on add and remove
|
|
121
75
|
* history. The row-materialising methods below honour this flag.
|
|
122
76
|
*/
|
|
123
77
|
readonly materializesRows: boolean;
|
|
124
78
|
private readonly _entityIds;
|
|
125
79
|
length: number;
|
|
126
80
|
/**
|
|
127
|
-
* Enabled
|
|
81
|
+
* Enabled and disabled row partition (entity enable and disable). Rows
|
|
128
82
|
* `[0, enabled_count)` are enabled, `[enabled_count, length)` are disabled.
|
|
129
|
-
* `enabled_count === length` (no disabled rows) is the common case
|
|
83
|
+
* `enabled_count === length` (no disabled rows) is the common case, every
|
|
130
84
|
* fast path below short-circuits on it, so an archetype that never disables
|
|
131
|
-
* an entity pays nothing. Disable
|
|
132
|
-
* (`disableRow
|
|
133
|
-
* disabled tail (`_placeTail`). `entityCount` (the query
|
|
134
|
-
* returns this
|
|
135
|
-
* `stateHash` and published to the SAB descriptor so
|
|
136
|
-
* snapshot
|
|
85
|
+
* an entity pays nothing. Disable and enable swap a row across the boundary
|
|
86
|
+
* (`disableRow` and `enableRow`). An append places an enabled row in front of
|
|
87
|
+
* the disabled tail (`_placeTail`). `entityCount` (the query and iteration bound)
|
|
88
|
+
* returns this. `length` and `totalCount` span disabled rows too. Folded into
|
|
89
|
+
* `stateHash` and published to the SAB descriptor so a compute backend and
|
|
90
|
+
* snapshot and restore honour it.
|
|
137
91
|
*/
|
|
138
92
|
enabledCount: number;
|
|
139
93
|
/**
|
|
140
94
|
* Flush-epoch stamp + captured pre-counts for the Store's per-entity flush
|
|
141
|
-
* 0-crossing detector: `_flushAdds
|
|
95
|
+
* 0-crossing detector: `_flushAdds` and `_flushRemoves` stamp each
|
|
142
96
|
* archetype on first sight per flush (a few field accesses) instead of probing
|
|
143
|
-
* a `Map<archetype_id, pre_count>` per entity
|
|
144
|
-
* cost the destroy drain also avoids. Both `
|
|
145
|
-
* `
|
|
146
|
-
* on either the total (`length`) or the enabled partition (`enabledCount`)
|
|
97
|
+
* a `Map<archetype_id, pre_count>` per entity, the same per-entity Map
|
|
98
|
+
* cost the destroy drain also avoids. Both `flushPreLen` and
|
|
99
|
+
* `flushPreEnabled` are recorded so the settle pass can detect a 0-crossing
|
|
100
|
+
* on either the total (`length`) or the enabled partition (`enabledCount`),
|
|
147
101
|
* an enabled append into an all-disabled archetype crosses only the latter.
|
|
148
|
-
* Owned by Store
|
|
102
|
+
* Owned by Store. Pure scheduling bookkeeping, never folded into
|
|
149
103
|
* `stateHash`/snapshot.
|
|
150
104
|
*/
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
105
|
+
flushSeenEpoch: number;
|
|
106
|
+
flushPreLen: number;
|
|
107
|
+
flushPreEnabled: number;
|
|
154
108
|
/**
|
|
155
|
-
* DEV-only iteration guard: >0 while a dense query iterator
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
* structural mutation from inside the walk
|
|
160
|
-
* the iterator and silently skip or repeat entities
|
|
109
|
+
* DEV-only iteration guard: >0 while a dense query iterator delivers this
|
|
110
|
+
* archetype to a user callback. Those iterators are `forEach`,
|
|
111
|
+
* `forEachChunk`, `some` and `ChangedQuery.forEach`. The row-removing and
|
|
112
|
+
* reordering primitives `removeRow`, `disableRow` and `enableRow` check it, so an immediate
|
|
113
|
+
* structural mutation from inside the walk, which would swap-remove under
|
|
114
|
+
* the iterator and silently skip or repeat entities, throws instead.
|
|
161
115
|
* Production builds never read or write it.
|
|
162
116
|
*/
|
|
163
|
-
|
|
164
|
-
private readonly
|
|
117
|
+
iterDepth: number;
|
|
118
|
+
private readonly _edges;
|
|
165
119
|
/**
|
|
166
120
|
* Cache of pre-computed transition maps for multi-component transitions
|
|
167
|
-
* (this → target). Single-component edges live on `
|
|
168
|
-
* multi-component pairs land here. Entries never need invalidation
|
|
121
|
+
* (this → target). Single-component edges live on `_edges[].addMap` and `removeMap`
|
|
122
|
+
* multi-component pairs land here. Entries never need invalidation,
|
|
169
123
|
* archetypes live for the Store's lifetime.
|
|
170
124
|
*/
|
|
171
|
-
private readonly
|
|
125
|
+
private readonly _batchTransitionMaps;
|
|
172
126
|
/**
|
|
173
127
|
* Per-set add-edge cache for `Store.addComponents`, keyed by an
|
|
174
128
|
* exact pack of the added component ids. Lazily allocated: most archetypes
|
|
175
129
|
* never originate a plural add, so the Map stays `null` until the first one
|
|
176
|
-
* is resolved
|
|
130
|
+
* is resolved, the single-add `_edges[]` path never touches it.
|
|
177
131
|
*/
|
|
178
|
-
private
|
|
179
|
-
readonly
|
|
180
|
-
|
|
132
|
+
private _compositeAddEdges;
|
|
133
|
+
readonly flatColumns: ColumnBacking<AnyTypedArray>[];
|
|
134
|
+
bufs: AnyTypedArray[];
|
|
135
|
+
private _widthBufs;
|
|
136
|
+
readonly rowTicks: (Uint32Array | undefined)[];
|
|
137
|
+
private _tickBufs;
|
|
138
|
+
private _tickCids;
|
|
139
|
+
private _colKind;
|
|
140
|
+
private _allF64;
|
|
181
141
|
private _eids;
|
|
182
142
|
private _rowCap;
|
|
183
143
|
private _colCap;
|
|
184
144
|
/** Set by `fromColumnStore` to record which SAB archetype this Archetype
|
|
185
145
|
* draws its column views from. `null` for the default heap-backed path
|
|
186
|
-
* (no SAB linkage
|
|
146
|
+
* (no SAB linkage, `refreshViews` would be a no-op there and so
|
|
187
147
|
* isn't supported). */
|
|
188
148
|
private _storeArchetypeId;
|
|
189
|
-
readonly
|
|
190
|
-
readonly
|
|
149
|
+
readonly colOffset: number[];
|
|
150
|
+
readonly fieldCount: number[];
|
|
191
151
|
private readonly _fieldIndex;
|
|
192
152
|
private readonly _fieldNames;
|
|
193
|
-
readonly
|
|
194
|
-
readonly
|
|
195
|
-
readonly
|
|
153
|
+
readonly accessorColumns: (AccessorColumns | undefined)[];
|
|
154
|
+
private readonly _fieldGid;
|
|
155
|
+
readonly columnIds: number[];
|
|
156
|
+
readonly changedTick: number[];
|
|
196
157
|
private readonly _mutGroupCache;
|
|
197
158
|
private readonly _readGroupCache;
|
|
198
159
|
/** Host-installed grow hook. Set by `Store` on every SAB-backed
|
|
199
|
-
* archetype during construction
|
|
160
|
+
* archetype during construction. `null` on heap-backed archetypes (the
|
|
200
161
|
* default `GrowableTypedArray` grows in place). Insertion methods call
|
|
201
162
|
* `_invoke_grow(...)` below before any push that would overflow the
|
|
202
163
|
* current SAB row capacity. */
|
|
203
164
|
growHandler: ArchetypeGrowHandler | null;
|
|
204
165
|
constructor(id: ArchetypeID, mask: BitSet, layouts?: ArchetypeColumnLayout[], initialCapacity?: number, columnFactory?: ColumnFactory);
|
|
205
|
-
/**
|
|
206
|
-
*
|
|
166
|
+
/** Row `from` of `src` → row `to` here. `map[i]` is the source column of
|
|
167
|
+
* column `i`, or negative when the source has no such column. Such a column
|
|
168
|
+
* gets `0`. Both planes are width-canonical, and a shared column has one
|
|
169
|
+
* width on both sides, so the copy is a bit copy. */
|
|
170
|
+
private _copyRowFrom;
|
|
171
|
+
/** A row's ticks travel with the row across a transition, so a record made
|
|
172
|
+
* before the move still drains after it. A component the source lacks gets
|
|
173
|
+
* 0: the add is structural, and `onAdd` reports it. Cold: reached only when
|
|
174
|
+
* this archetype carries a tick plane. */
|
|
175
|
+
private _copyTicksFrom;
|
|
176
|
+
/** Give `cid` a row tick column, the row grain of an entity-level `onSet`.
|
|
177
|
+
* No-op for a component this archetype lacks, for a tag (no field, so no
|
|
178
|
+
* write to record), and when the column exists. Cold: registration of an
|
|
179
|
+
* observer, and the birth of an archetype while one is registered. */
|
|
180
|
+
installTicks(cid: number): void;
|
|
181
|
+
/** Forget every record. A restore replaces the rows under the plane, so a
|
|
182
|
+
* tick that survived it would name a write that never happened. */
|
|
183
|
+
resetTicks(): void;
|
|
184
|
+
/** Grow each tick column to `_rowCap` and place the plane after the data
|
|
185
|
+
* columns in `rowBufs`. Called by `_syncRowPlane`, after it settled the
|
|
186
|
+
* capacity, and only when a plane exists. */
|
|
187
|
+
private _syncTicks;
|
|
188
|
+
/** Row `from` → row `to`, every column. The swap-remove fill. */
|
|
189
|
+
private _moveRow;
|
|
190
|
+
/** Exchange rows `a` and `b`, every column. */
|
|
191
|
+
private _swapRow;
|
|
192
|
+
/** `0` into row `row`, every column. */
|
|
193
|
+
private _zeroRow;
|
|
194
|
+
/** `bits[i]` into row `row` of column `i`, every column, through the
|
|
195
|
+
* width-canonical plane. `bits` must come from `widthBits`, so each entry is
|
|
196
|
+
* already the column's stored representation and no conversion remains. The
|
|
197
|
+
* single-append primitive behind `spawn`. */
|
|
198
|
+
private _writeRowBits;
|
|
199
|
+
/** Re-derive the `bufs`, `_eids` and `_rowCap` row plane from the backing
|
|
200
|
+
* columns. The sole writer of all three, see the `bufs` field doc for the
|
|
207
201
|
* invariant it restores. Cold: construction, `refreshViews`, tail of a grow. */
|
|
208
202
|
private _syncRowPlane;
|
|
209
|
-
/** Re-point every cached `
|
|
203
|
+
/** Re-point every cached `forEachChunk` column group at the current `bufs`.
|
|
210
204
|
*
|
|
211
205
|
* Called only from `_syncRowPlane`, which is the only thing that can change a
|
|
212
|
-
* column's buffer identity
|
|
213
|
-
* construction and `columnGroupMut`
|
|
206
|
+
* column's buffer identity, so after this runs, a cached group is correct by
|
|
207
|
+
* construction, and `columnGroupMut` and `columnGroupRead` need no staleness test
|
|
214
208
|
* at all. That absence is the point: those two run once per archetype per
|
|
215
|
-
* `
|
|
216
|
-
* file already carries one hard-won lesson (`
|
|
209
|
+
* `forEachChunk` pass, which for a fragmented query is once per chunk, and this
|
|
210
|
+
* file already carries one hard-won lesson (`_onArchShrink`): one more
|
|
217
211
|
* statement pushed that per-mutation function past V8's inlining budget, and
|
|
218
212
|
* it became much slower. We measured two earlier forms of this optimisation
|
|
219
213
|
* and rejected both for the same cause. A fill through a shared helper made
|
|
@@ -222,41 +216,46 @@ export declare class Archetype implements ArchetypeView {
|
|
|
222
216
|
* work to the cold path, and the gain stays with no loss.
|
|
223
217
|
*
|
|
224
218
|
* Refreshes in place, preserving object identity, for the same reason
|
|
225
|
-
* `_syncRowPlane` refills `
|
|
219
|
+
* `_syncRowPlane` refills `bufs` in place: a caller that captured the group
|
|
226
220
|
* sees fresh buffers rather than silently stale ones. */
|
|
227
|
-
private
|
|
221
|
+
private _refreshColumnCaches;
|
|
228
222
|
/** DEV-only: assert the row plane still addresses the live buffers.
|
|
229
223
|
*
|
|
230
|
-
* `
|
|
231
|
-
* one buffer, and only the first is cached
|
|
232
|
-
* `getColumnRead`
|
|
233
|
-
* buffer's identity owes a `_syncRowPlane
|
|
224
|
+
* `bufs` and `_eids` and `flatColumns[i].buf` and `_entityIds.buf` are two paths to
|
|
225
|
+
* one buffer, and only the first is cached, the row ops index the cache while
|
|
226
|
+
* `getColumnRead` and `writeFields` read `.buf` fresh. Anything that changes a
|
|
227
|
+
* buffer's identity owes a `_syncRowPlane`. Miss one and the two paths split
|
|
234
228
|
* silently, with row writes landing in an orphan that later reads never see.
|
|
235
229
|
*
|
|
236
230
|
* Checked at the boundaries that read `.buf` directly, and O(1): index 0 alone
|
|
237
|
-
* is enough, because `_syncRowPlane` rewrites every entry together
|
|
231
|
+
* is enough, because `_syncRowPlane` rewrites every entry together. There is
|
|
238
232
|
* no way to desync one column and not the first. */
|
|
239
233
|
private _assertRowPlaneFresh;
|
|
240
234
|
/** Make room for `additional` more rows, growing if the append would
|
|
241
235
|
* overflow. Replaces the `this.length >= cols[0].buf.length` probe the append
|
|
242
|
-
* paths each open-coded
|
|
243
|
-
* on every single-row append
|
|
236
|
+
* paths each open-coded, that read a column object and its buffer's length
|
|
237
|
+
* on every single-row append. This is one compare against a cached number.
|
|
238
|
+
*
|
|
239
|
+
* Every append path calls this, and the spawn path calls it first so it can
|
|
240
|
+
* reserve capacity before it commits an entity slot. A cap grow throws here,
|
|
241
|
+
* with the world untouched, instead of mid-append after the slot is live.
|
|
242
|
+
* See `Store.spawn` and `spawnMany`.
|
|
244
243
|
*
|
|
245
244
|
* Both backings are handled by `_growRows` so callers don't branch: a
|
|
246
245
|
* SAB-backed archetype delegates to the store's `growHandler` (realloc +
|
|
247
246
|
* republish, which re-enters `refreshViews`), a heap-backed one
|
|
248
247
|
* (`growHandler === null`, the unit-test factory) grows each column in place.
|
|
249
248
|
* Either way the buffers may have moved, so the row plane is re-synced before
|
|
250
|
-
* returning
|
|
251
|
-
|
|
252
|
-
/** Cold half of `
|
|
253
|
-
* Never called on the fast path
|
|
249
|
+
* returning, including when the grow throws. */
|
|
250
|
+
reserveRows(additional: number): void;
|
|
251
|
+
/** Cold half of `reserveRows`: the append genuinely doesn't fit, so grow.
|
|
252
|
+
* Never called on the fast path, see the caller. */
|
|
254
253
|
private _growRows;
|
|
255
254
|
/** Push `Archetype.length` down into each column's own logical length (and
|
|
256
255
|
* the entity-id array's). The row plane keeps `length` authoritative and never
|
|
257
256
|
* touches `_len`, so the columns' view of it goes stale between publishes.
|
|
258
|
-
* Nothing on the ECS hot paths reads it
|
|
259
|
-
* reallocating `
|
|
257
|
+
* Nothing on the ECS hot paths reads it. The boundaries that do, a
|
|
258
|
+
* reallocating `reserve`, `refreshView`'s shrink check, `view()`,
|
|
260
259
|
* publish first. */
|
|
261
260
|
private _publishRowCounts;
|
|
262
261
|
/**
|
|
@@ -265,22 +264,22 @@ export declare class Archetype implements ArchetypeView {
|
|
|
265
264
|
* archetype entry whose id equals `storeArchetypeId` and whose columns
|
|
266
265
|
* cover every `(component_id, fieldIdx)` pair declared by `layouts`.
|
|
267
266
|
*
|
|
268
|
-
* The resulting archetype is fixed-capacity at the SAB row capacity
|
|
267
|
+
* The resulting archetype is fixed-capacity at the SAB row capacity,
|
|
269
268
|
* any operation that would push past it throws `StoreColumnOverflowError`.
|
|
270
269
|
* To grow capacity, call `growColumnStore(...)` between ticks and then
|
|
271
270
|
* `refreshViews(newStore)` on this archetype.
|
|
272
271
|
*/
|
|
273
272
|
static fromColumnStore(id: ArchetypeID, mask: BitSet, layouts: ArchetypeColumnLayout[], columnStore: ColumnStore, storeArchetypeId: number): Archetype;
|
|
274
273
|
/** True iff this archetype was constructed via `fromColumnStore` and its
|
|
275
|
-
* `
|
|
274
|
+
* `flatColumns` are SAB-backed. Heap-backed archetypes return `false`
|
|
276
275
|
* and cannot be refreshed (their columns grow in place). */
|
|
277
276
|
get isBufferBacked(): boolean;
|
|
278
277
|
/**
|
|
279
278
|
* Repoint every column at the matching SAB view in `newColumnStore` after
|
|
280
279
|
* a host-side `growColumnStore` realloc. The archetype keeps its row
|
|
281
|
-
* count
|
|
280
|
+
* count. Each column's logical length is preserved. Caller is responsible
|
|
282
281
|
* for ensuring `newColumnStore` was built by `growColumnStore` over the
|
|
283
|
-
* SAB this archetype was originally drawn from
|
|
282
|
+
* SAB this archetype was originally drawn from, the matching
|
|
284
283
|
* `storeArchetypeId` was recorded in `fromColumnStore` and is reused here.
|
|
285
284
|
*
|
|
286
285
|
* Throws `ECSError` if this archetype is not SAB-backed, or if the new
|
|
@@ -288,11 +287,11 @@ export declare class Archetype implements ArchetypeView {
|
|
|
288
287
|
* expects.
|
|
289
288
|
*/
|
|
290
289
|
refreshViews(newColumnStore: ColumnStore): void;
|
|
291
|
-
/** Enabled-row count
|
|
290
|
+
/** Enabled-row count, the default iteration bound. See `enabled_count`.
|
|
292
291
|
* Equals `length` whenever no entity is disabled (the common case).
|
|
293
292
|
*
|
|
294
293
|
* During an `includeDisabled()` query's `forEach`, the module flag
|
|
295
|
-
* `
|
|
294
|
+
* `iterAllRows` is set so this returns `length` (enabled + disabled), the
|
|
296
295
|
* user's `for i < arch.entityCount` loop then spans disabled rows
|
|
297
296
|
* transparently, with no change to the loop. Outside such iteration the flag is
|
|
298
297
|
* false and this is `enabled_count`. */
|
|
@@ -305,24 +304,24 @@ export declare class Archetype implements ArchetypeView {
|
|
|
305
304
|
* 0..totalCount-1 (enabled rows first, then disabled). */
|
|
306
305
|
get entityIds(): ReadonlyEntityIDArray;
|
|
307
306
|
/**
|
|
308
|
-
* Swap the two rows `a` and `b
|
|
309
|
-
* `
|
|
307
|
+
* Swap the two rows `a` and `b`, entity ids and every column. Does not touch
|
|
308
|
+
* `entityRows`. The caller updates the entity→row map for whichever rows it
|
|
310
309
|
* cares about (it knows the two `entityIds` after the swap). The partition
|
|
311
|
-
* primitives (`disableRow
|
|
310
|
+
* primitives (`disableRow`, `enableRow`, `removeRow` and `_placeTail`) build on
|
|
312
311
|
* this. Writes through each column's live backing buffer (`buf`), so it works
|
|
313
312
|
* for both heap- and SAB-backed columns. No-op when `a === b`. */
|
|
314
313
|
swapRows(a: number, b: number): void;
|
|
315
314
|
/**
|
|
316
|
-
* Place a freshly-appended
|
|
315
|
+
* Place a freshly-appended enabled entity (currently at the tail row `tail`,
|
|
317
316
|
* already pushed, `length` already incremented) into the enabled region, and
|
|
318
317
|
* bump `enabled_count`. Returns its final row.
|
|
319
318
|
*
|
|
320
|
-
* Common case
|
|
321
|
-
* the next enabled slot, so this is
|
|
322
|
-
* (byte-for-byte the earlier behaviour, `
|
|
319
|
+
* Common case, no disabled rows (`enabled_count === tail`): the tail row is
|
|
320
|
+
* the next enabled slot, so this is only `enabled_count++` and returns `tail`
|
|
321
|
+
* (byte-for-byte the earlier behaviour, `entityRows` untouched). Rare case,
|
|
323
322
|
* disabled rows occupy `[enabled_count, tail)`: swap the appended row into the
|
|
324
323
|
* first disabled slot and push that disabled occupant to the tail, updating
|
|
325
|
-
* its `
|
|
324
|
+
* its `entityRows`. Requires `entityRows` in that case (a `DEV` guard fires
|
|
326
325
|
* if a caller appends into a disabled-bearing archetype without passing it). */
|
|
327
326
|
private _placeTail;
|
|
328
327
|
/**
|
|
@@ -336,59 +335,61 @@ export declare class Archetype implements ArchetypeView {
|
|
|
336
335
|
/**
|
|
337
336
|
* Disable the entity at `row` (precondition: enabled, `row < enabled_count`).
|
|
338
337
|
* Swaps it to the end of the enabled region and shrinks the region, so it
|
|
339
|
-
* lands in the disabled tail with its data intact
|
|
340
|
-
* O(1)+one row swap. Updates `
|
|
341
|
-
disableRow(row: number,
|
|
338
|
+
* lands in the disabled tail with its data intact, no archetype transition,
|
|
339
|
+
* O(1)+one row swap. Updates `entityRows` for both rows touched. */
|
|
340
|
+
disableRow(row: number, entityRows: Int32Array): void;
|
|
342
341
|
/**
|
|
343
342
|
* Enable the entity at `row` (precondition: disabled, `row >= enabled_count`).
|
|
344
343
|
* Swaps it to the front of the disabled region and grows the enabled region.
|
|
345
|
-
* Updates `
|
|
346
|
-
enableRow(row: number,
|
|
344
|
+
* Updates `entityRows` for both rows touched. */
|
|
345
|
+
enableRow(row: number, entityRows: Int32Array): void;
|
|
347
346
|
/**
|
|
348
|
-
* Partition-aware swap-remove that owns its `
|
|
349
|
-
* Store's destroy
|
|
347
|
+
* Partition-aware swap-remove that owns its `entityRows` updates. The
|
|
348
|
+
* Store's destroy and move paths call this instead of `swapRemoveRow`. It keeps the
|
|
350
349
|
* enabled prefix contiguous in every case:
|
|
351
350
|
* - disabled row (`row >= enabled_count`): swap-remove within the disabled
|
|
352
|
-
* tail (the last row is disabled)
|
|
353
|
-
* - last enabled row: swap-remove with the global last
|
|
351
|
+
* tail (the last row is disabled), `enabled_count` unchanged.
|
|
352
|
+
* - last enabled row: swap-remove with the global last. `enabled_count--`.
|
|
354
353
|
* - middle enabled row: move the last enabled row into the hole (so the
|
|
355
354
|
* enabled prefix stays packed), then swap-remove that vacated enabled slot
|
|
356
|
-
* with the global last
|
|
357
|
-
* Updates `
|
|
358
|
-
* the caller frees
|
|
359
|
-
removeRow(row: number,
|
|
360
|
-
/** @internal
|
|
355
|
+
* with the global last. `enabled_count--`.
|
|
356
|
+
* Updates `entityRows` for every relocated entity (never for the removed one,
|
|
357
|
+
* the caller frees and repoints it). */
|
|
358
|
+
removeRow(row: number, entityRows: Int32Array): void;
|
|
359
|
+
/** @internal, cold partition-aware tail of `removeRow`: the
|
|
361
360
|
* disabled-bearing archetype case. Split out so the no-disabled fast path
|
|
362
|
-
* above stays small enough to inline
|
|
361
|
+
* above stays small enough to inline. See the doc on `removeRow`. */
|
|
363
362
|
private _removeRowPartitioned;
|
|
364
|
-
|
|
363
|
+
/** The entity ids of the live rows, bounded by `length`. `entityIds` returns
|
|
364
|
+
* the same buffer at its full capacity, so a walk uses this one. */
|
|
365
|
+
get rowEntityIds(): Uint32Array;
|
|
365
366
|
hasComponent(id: ComponentID): boolean;
|
|
366
367
|
matches(required: BitSet): boolean;
|
|
367
368
|
/**
|
|
368
|
-
* Get a single field's column (read-only
|
|
369
|
+
* Get a single field's column (read-only, use when not mutating). Valid
|
|
369
370
|
* data: indices 0..entityCount-1. The `ReadonlyColumn` return is an
|
|
370
371
|
* *advisory* compile-time barrier: it is the live mutable backing buffer,
|
|
371
372
|
* so the `readonly` index signature blocks writes at the type layer only
|
|
372
373
|
* (a deliberate cast can still write through). For writes use the
|
|
373
|
-
* mutable `
|
|
374
|
+
* mutable `getColumnMut` (tick-bumping) below.
|
|
374
375
|
*/
|
|
375
376
|
getColumnRead<S extends ComponentSchema, K extends string & keyof S>(def: ComponentDef<S>, field: K): ReadonlyColumn;
|
|
376
377
|
/**
|
|
377
|
-
* Tuple fetch of several of one component's columns
|
|
378
|
+
* Tuple fetch of several of one component's columns,
|
|
378
379
|
* `const [q, r] = arch.getColumnsRead(HexPos, "q", "r")` collapses the
|
|
379
380
|
* per-field `getColumnRead` preamble at the top of an iteration callback
|
|
380
381
|
* to one line. Same advisory-readonly views and `reads` access-check as
|
|
381
|
-
* `getColumnRead`. Allocates one small array per call
|
|
382
|
-
* archetype per tick
|
|
382
|
+
* `getColumnRead`. Allocates one small array per call, fine once per
|
|
383
|
+
* archetype per tick. In a per-row loop fetch columns individually.
|
|
383
384
|
*/
|
|
384
385
|
getColumnsRead<S extends ComponentSchema, const K extends readonly (string & keyof S)[]>(def: ComponentDef<S>, ...fields: K): {
|
|
385
386
|
[I in keyof K]: ReadonlyColumn;
|
|
386
387
|
};
|
|
387
388
|
/**
|
|
388
389
|
* Get a single field's column **if this archetype has the component**, else
|
|
389
|
-
* `undefined
|
|
390
|
-
* (Bevy `Option<&T
|
|
391
|
-
* archetypes both with and without `T
|
|
390
|
+
* `undefined`, the fetch-if-present accessor for optional query terms
|
|
391
|
+
* (Bevy `Option<&T>`, flecs `?`). An optional query (`q.optional(T)`) spans
|
|
392
|
+
* archetypes both with and without `T`. The caller branches once per
|
|
392
393
|
* archetype span on the return:
|
|
393
394
|
*
|
|
394
395
|
* q.forEach((arch) => {
|
|
@@ -402,23 +403,23 @@ export declare class Archetype implements ArchetypeView {
|
|
|
402
403
|
* **absent** branch, not a thrown error. The `DEV` checks still run
|
|
403
404
|
* **first** (before the absent short-circuit), so the requirements don't
|
|
404
405
|
* depend on whether the current span happens to hold `T`. Two checks fire:
|
|
405
|
-
* (1) `accessCheck.
|
|
406
|
-
* exactly as a required read does
|
|
406
|
+
* (1) `accessCheck.assertRead`, an optional read needs `reads:[T]` coverage
|
|
407
|
+
* exactly as a required read does, and (2) `accessCheck.assertOptionalFetch`,
|
|
407
408
|
* the iterating query must have declared `.optional(T)`, the read-side
|
|
408
409
|
* analog that makes the query term the fetch's authorization rather than inert
|
|
409
410
|
* decoration. The return is the same advisory-readonly view `getColumnRead`
|
|
410
411
|
* hands back.
|
|
411
412
|
*/
|
|
412
413
|
getOptionalColumnRead<S extends ComponentSchema, K extends string & keyof S>(def: ComponentDef<S>, field: K): ReadonlyColumn | undefined;
|
|
413
|
-
/** Get a single field's column (mutable
|
|
414
|
-
|
|
415
|
-
/** Mutable field-keyed column group
|
|
414
|
+
/** Get a single field's column (mutable, the default). Marks the component as changed at the given tick. */
|
|
415
|
+
getColumnMut<S extends ComponentSchema, K extends string & keyof S>(def: ComponentDef<S>, field: K, tick: number): TagToTypedArray[S[K]];
|
|
416
|
+
/** Mutable field-keyed column group. Stamps the change tick once. */
|
|
416
417
|
columnGroupMut<S extends ComponentSchema>(def: ComponentDef<S>, tick: number): MutableColumnsForSchema<S>;
|
|
417
418
|
/** Read-only field-keyed column group (no tick bump). */
|
|
418
419
|
columnGroupRead<S extends ComponentSchema>(def: ComponentDef<S>): ColumnsForSchema<S>;
|
|
419
420
|
writeFields(row: number, componentId: ComponentID, values: Record<string, number>, tick: number): void;
|
|
420
421
|
/**
|
|
421
|
-
* Bulk variant of `writeFields
|
|
422
|
+
* Bulk variant of `writeFields`, fills `count` consecutive rows starting
|
|
422
423
|
* at `dstStart` with the same field values via per-field `TypedArray.fill`.
|
|
423
424
|
* For N rows of an F-field component, this is F native fill calls instead
|
|
424
425
|
* of N×F per-row JS writes. The change-tick is bumped once for the range,
|
|
@@ -435,67 +436,74 @@ export declare class Archetype implements ArchetypeView {
|
|
|
435
436
|
* Add an entity. Pushes zeroes into all columns and returns the assigned row.
|
|
436
437
|
* Store is responsible for tracking entityIndex → row.
|
|
437
438
|
*/
|
|
438
|
-
addEntity(entityId: EntityID,
|
|
439
|
+
addEntity(entityId: EntityID, entityRows?: Int32Array): number;
|
|
439
440
|
/**
|
|
440
441
|
* Remove entity at row via swap-and-pop. Swaps the last entity into the
|
|
441
442
|
* vacated row to keep data dense. Returns the entityIndex of the swapped
|
|
442
443
|
* entity (so Store can update its row), or NO_SWAP if no swap was needed.
|
|
443
444
|
*/
|
|
444
|
-
|
|
445
|
+
swapRemoveRow(row: number): number;
|
|
445
446
|
/** Tag-optimized add: skip column push entirely (no data to store). */
|
|
446
|
-
addEntityTag(entityId: EntityID,
|
|
447
|
+
addEntityTag(entityId: EntityID, entityRows?: Int32Array): number;
|
|
447
448
|
/**
|
|
448
449
|
* Bulk add `count` entities, zero-initialising all columns. Returns the
|
|
449
450
|
* starting dstRow for the batch. Caller is responsible for tracking
|
|
450
451
|
* entityIndex → row for every entity in the batch.
|
|
451
452
|
*
|
|
452
453
|
* Collapses the N×C per-element cost of N sequential `addEntity` calls into
|
|
453
|
-
* C `fill` calls, one for each column
|
|
454
|
+
* C `fill` calls, one for each column, the same pattern `bulkMoveAllFrom`
|
|
454
455
|
* uses for the move-with-data case.
|
|
455
456
|
*/
|
|
456
457
|
addEntities(entityIds: Uint32Array, count?: number): number;
|
|
457
458
|
/** Tag-optimized bulk add: skip the per-column zero-fill entirely. */
|
|
458
459
|
addEntitiesTag(entityIds: Uint32Array, count?: number): number;
|
|
459
|
-
/**
|
|
460
|
-
*
|
|
461
|
-
*
|
|
462
|
-
*
|
|
463
|
-
*
|
|
464
|
-
*
|
|
465
|
-
*
|
|
466
|
-
|
|
467
|
-
/**
|
|
468
|
-
*
|
|
469
|
-
*
|
|
470
|
-
|
|
460
|
+
/** Append one entity, writing `flatBits[i]` straight into column `i` (in
|
|
461
|
+
* `flatColumns` order), no zero-fill-then-overwrite. Bumps every column's
|
|
462
|
+
* change tick once. Returns the assigned row. `flatBits` must come from
|
|
463
|
+
* `widthBits`: each entry is already the column's stored representation, so
|
|
464
|
+
* the write is a bit copy through the width-canonical plane, with no
|
|
465
|
+
* conversion and no call for each column type. A template resolves its
|
|
466
|
+
* defaults into bits one time, so every `spawn` from it takes this path. */
|
|
467
|
+
addEntityWithBits(entityId: EntityID, flatBits: Float64Array, tick: number, entityRows?: Int32Array): number;
|
|
468
|
+
/** Convert `flatValues` (in `flatColumns` order) to the stored bit
|
|
469
|
+
* pattern of each column, as the width-canonical view represents it
|
|
470
|
+
* (`toWidthBits`). The result is what `addEntityWithBits` writes. A
|
|
471
|
+
* `Float64Array`, so the append reads each entry with no hole test and no
|
|
472
|
+
* unboxing. Every bit pattern is an integer below 2^32 or an `f64`, and
|
|
473
|
+
* both are exact in it. */
|
|
474
|
+
widthBits(flatValues: number[]): Float64Array;
|
|
475
|
+
/** Write one value into row `row` of flat column `idx`, converting as the
|
|
476
|
+
* column's type converts, through the access site of that type. The
|
|
477
|
+
* per-instance override path of `spawn`. */
|
|
478
|
+
writeFlatElem(idx: number, row: number, value: number): void;
|
|
471
479
|
/** Bulk append `count` entities, filling column `i` with `flatValues[i]`
|
|
472
480
|
* in a single `TypedArray.fill` per column (no zero pass). Returns the
|
|
473
481
|
* starting row. */
|
|
474
482
|
addEntitiesWithValues(entityIds: Uint32Array, count: number, flatValues: number[], tick: number): number;
|
|
475
|
-
/** Tag-optimized remove via swap-and-pop: skip column swap
|
|
476
|
-
|
|
483
|
+
/** Tag-optimized remove via swap-and-pop: skip column swap and pop entirely. */
|
|
484
|
+
swapRemoveRowTag(row: number): number;
|
|
477
485
|
/**
|
|
478
486
|
* Move an entity from src archetype into this archetype in a single pass.
|
|
479
|
-
* Combines addEntity + copySharedFrom +
|
|
487
|
+
* Combines addEntity + copySharedFrom + swapRemoveRow(src).
|
|
480
488
|
* Uses a pre-computed transition map for branchless column copy.
|
|
481
489
|
* Writes dstRow to _moveResult[0], swapped entity index to _moveResult[1].
|
|
482
490
|
*/
|
|
483
|
-
moveEntityFrom(src: Archetype, srcRow: number, entityId: EntityID, transitionMap: Int16Array, tick: number,
|
|
491
|
+
moveEntityFrom(src: Archetype, srcRow: number, entityId: EntityID, transitionMap: Int16Array, tick: number, entityRows: Int32Array): void;
|
|
484
492
|
/**
|
|
485
493
|
* Move an entity from src into this archetype (tag-only: no columns to copy).
|
|
486
|
-
* Writes dstRow to _moveResult[0]
|
|
494
|
+
* Writes dstRow to _moveResult[0]. _moveResult[1] is always NO_SWAP (the
|
|
487
495
|
* partition-aware src/dst updates are owned internally).
|
|
488
496
|
*/
|
|
489
|
-
moveEntityFromTag(src: Archetype, srcRow: number, entityId: EntityID,
|
|
497
|
+
moveEntityFromTag(src: Archetype, srcRow: number, entityId: EntityID, entityRows: Int32Array): void;
|
|
490
498
|
/**
|
|
491
|
-
* Bulk-move
|
|
499
|
+
* Bulk-move all entities from src into this archetype using TypedArray.set().
|
|
492
500
|
* Much faster than per-entity moveEntityFrom when the entire source is moving.
|
|
493
501
|
* After this call, src is empty. Returns the starting dstRow for the batch.
|
|
494
502
|
*/
|
|
495
503
|
bulkMoveAllFrom(src: Archetype, transitionMap: Int16Array, tick: number): number;
|
|
496
504
|
/**
|
|
497
|
-
* Drop every row at once
|
|
498
|
-
* cleared
|
|
505
|
+
* Drop every row at once, length → 0, entity-id list and all columns
|
|
506
|
+
* cleared, without copying into a destination. Used when an archetype's
|
|
499
507
|
* entire population leaves in one move: `bulkMoveAllFrom` clears the
|
|
500
508
|
* source this way, and `Store.batchRemoveComponent` calls it directly when
|
|
501
509
|
* the destination is the rowless empty archetype (batch-removing the last
|
|
@@ -504,16 +512,16 @@ export declare class Archetype implements ArchetypeView {
|
|
|
504
512
|
clearRows(): void;
|
|
505
513
|
/**
|
|
506
514
|
* Re-derive the host-side row bookkeeping after a snapshot is mounted onto a
|
|
507
|
-
* live world (`Store.
|
|
508
|
-
* (dense SAB) but
|
|
509
|
-
* back-reference
|
|
515
|
+
* live world (`Store.restore`). A snapshot reloads the column bytes
|
|
516
|
+
* (dense SAB) but not the host-side `length`, `enabledCount` and `_entityIds`
|
|
517
|
+
* back-reference, those are reconstructed here. `refreshViews` must have
|
|
510
518
|
* already repointed the columns at the restored SAB.
|
|
511
519
|
*
|
|
512
520
|
* The caller scans the restored entity-index region to learn which entity
|
|
513
521
|
* occupies each row and passes them in row order (`rowEntityIds[r]` is the
|
|
514
|
-
* packed `EntityID` at row `r
|
|
522
|
+
* packed `EntityID` at row `r`. Rows `[0, length)` are dense, enabled rows
|
|
515
523
|
* first then disabled per the partition). `enabledCount` is the restored
|
|
516
|
-
* partition boundary. This is the inverse of the per-row `addEntity`
|
|
524
|
+
* partition boundary. This is the inverse of the per-row `addEntity` and
|
|
517
525
|
* `disableRow` bookkeeping the live run accumulated.
|
|
518
526
|
*/
|
|
519
527
|
restoreHostRows(rowEntityIds: readonly number[], enabledCount: number): void;
|
|
@@ -521,19 +529,20 @@ export declare class Archetype implements ArchetypeView {
|
|
|
521
529
|
setEdge(componentId: ComponentID, edge: ArchetypeEdge): void;
|
|
522
530
|
/**
|
|
523
531
|
* Get the transition map from this archetype to `target`, building and caching
|
|
524
|
-
* it on miss.
|
|
525
|
-
* cache only covers single-component steps.
|
|
532
|
+
* it on miss. `Store.addComponents` and `Store.removeComponents` use it. The
|
|
533
|
+
* per-edge cache only covers single-component steps.
|
|
526
534
|
*/
|
|
527
|
-
|
|
535
|
+
transitionMapTo(target: Archetype): Int16Array;
|
|
528
536
|
/** Look up a cached plural-add transition by its packed key. Returns
|
|
529
537
|
* `undefined` until the first composite add out of this archetype plants the
|
|
530
|
-
* lazy Map
|
|
538
|
+
* lazy Map, the common case for archetypes that only ever see single adds. */
|
|
531
539
|
getCompositeAddEdge(key: number): CompositeAddEdge | undefined;
|
|
532
540
|
/** Cache a resolved plural-add transition (target + src→target map) under its
|
|
533
541
|
* packed key, allocating the backing Map on first use. */
|
|
534
542
|
cacheCompositeAddEdge(key: number, target: ArchetypeID, map: Int16Array): void;
|
|
535
543
|
}
|
|
536
|
-
/** Reusable result buffer for
|
|
544
|
+
/** Reusable result buffer for `moveEntityFrom` and `moveEntityFromTag`.
|
|
545
|
+
* `[dstRow, swappedIndex]`. */
|
|
537
546
|
export declare const _moveResult: [number, number];
|
|
538
547
|
export declare function _setIterAllRows(value: boolean): boolean;
|
|
539
548
|
/**
|
|
@@ -541,6 +550,5 @@ export declare function _setIterAllRows(value: boolean): boolean;
|
|
|
541
550
|
* For each column in dst, stores the index of the corresponding column in src,
|
|
542
551
|
* or -1 if the column is new (no source).
|
|
543
552
|
*/
|
|
544
|
-
export declare function
|
|
545
|
-
export {};
|
|
553
|
+
export declare function createTransitionMap(src: Archetype, dst: Archetype): Int16Array;
|
|
546
554
|
//# sourceMappingURL=archetype.d.ts.map
|