@oasys/oecs 0.5.3 → 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 +1399 -276
- package/README.md +327 -169
- package/dist/core/ecs/access_check.d.cts +31 -31
- package/dist/core/ecs/access_check.d.ts +31 -31
- package/dist/core/ecs/access_check.d.ts.map +1 -1
- package/dist/core/ecs/archetype.d.cts +273 -205
- package/dist/core/ecs/archetype.d.ts +273 -205
- 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 +34 -34
- package/dist/core/ecs/archetype_graph.d.ts +34 -34
- 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 +30 -30
- package/dist/core/ecs/command_log.d.ts +30 -30
- package/dist/core/ecs/command_log.d.ts.map +1 -1
- package/dist/core/ecs/component.d.cts +45 -44
- package/dist/core/ecs/component.d.ts +45 -44
- 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 +337 -276
- package/dist/core/ecs/ecs.d.ts +337 -276
- 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 +24 -22
- package/dist/core/ecs/entity_allocator.d.ts +24 -22
- package/dist/core/ecs/entity_allocator.d.ts.map +1 -1
- package/dist/core/ecs/event.d.cts +37 -23
- package/dist/core/ecs/event.d.ts +37 -23
- 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 +34 -34
- package/dist/core/ecs/frame_trace.d.ts +34 -34
- package/dist/core/ecs/frame_trace.d.ts.map +1 -1
- package/dist/core/ecs/host_commands.d.cts +107 -89
- package/dist/core/ecs/host_commands.d.ts +107 -89
- package/dist/core/ecs/host_commands.d.ts.map +1 -1
- package/dist/core/ecs/index.d.cts +22 -12
- package/dist/core/ecs/index.d.ts +22 -12
- package/dist/core/ecs/index.d.ts.map +1 -1
- package/dist/core/ecs/observer.d.cts +41 -122
- package/dist/core/ecs/observer.d.ts +41 -122
- 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 +219 -568
- package/dist/core/ecs/query.d.ts +219 -568
- 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 +129 -16
- package/dist/core/ecs/ref.d.ts +129 -16
- package/dist/core/ecs/ref.d.ts.map +1 -1
- package/dist/core/ecs/relation.d.cts +105 -186
- package/dist/core/ecs/relation.d.ts +105 -186
- package/dist/core/ecs/relation.d.ts.map +1 -1
- package/dist/core/ecs/resource.d.cts +14 -14
- package/dist/core/ecs/resource.d.ts +14 -14
- package/dist/core/ecs/resource_registry.d.cts +6 -6
- package/dist/core/ecs/resource_registry.d.ts +6 -6
- 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 +98 -114
- package/dist/core/ecs/schedule.d.ts +98 -114
- 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 +110 -53
- package/dist/core/ecs/sparse_store.d.ts +110 -53
- package/dist/core/ecs/sparse_store.d.ts.map +1 -1
- package/dist/core/ecs/store.d.cts +644 -511
- package/dist/core/ecs/store.d.ts +644 -511
- package/dist/core/ecs/store.d.ts.map +1 -1
- package/dist/core/ecs/store_layout_listener.d.cts +8 -8
- package/dist/core/ecs/store_layout_listener.d.ts +8 -8
- 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 +151 -66
- package/dist/core/ecs/system.d.ts +151 -66
- 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 +87 -4
- package/dist/core/ecs/utils/error.d.ts +87 -4
- 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 +48 -49
- package/dist/core/store/action_ring.d.ts +48 -49
- package/dist/core/store/action_ring.d.ts.map +1 -1
- package/dist/core/store/allocator.d.cts +166 -114
- package/dist/core/store/allocator.d.ts +166 -114
- package/dist/core/store/allocator.d.ts.map +1 -1
- package/dist/core/store/buffer_backed_column.d.cts +21 -22
- package/dist/core/store/buffer_backed_column.d.ts +21 -22
- package/dist/core/store/buffer_backed_column.d.ts.map +1 -1
- package/dist/core/store/column_store.d.cts +138 -100
- package/dist/core/store/column_store.d.ts +138 -100
- 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 +41 -45
- package/dist/core/store/command_ring.d.ts +41 -45
- package/dist/core/store/command_ring.d.ts.map +1 -1
- package/dist/core/store/descriptor.d.cts +35 -18
- package/dist/core/store/descriptor.d.ts +35 -18
- 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 +40 -42
- package/dist/core/store/event_ring.d.ts +40 -42
- package/dist/core/store/event_ring.d.ts.map +1 -1
- package/dist/core/store/extend.d.cts +15 -9
- package/dist/core/store/extend.d.ts +15 -9
- package/dist/core/store/extend.d.ts.map +1 -1
- package/dist/core/store/grow.d.cts +3 -3
- package/dist/core/store/grow.d.ts +3 -3
- package/dist/core/store/grow.d.ts.map +1 -1
- package/dist/core/store/header.d.cts +37 -33
- package/dist/core/store/header.d.ts +37 -33
- 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 +72 -63
- package/dist/core/store/layout_ops.d.ts +72 -63
- 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 +14 -14
- package/dist/core/store/state_hash.d.ts +14 -14
- 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 +16 -11
- package/dist/index.d.ts +16 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.development.cjs +1 -1
- package/dist/index.development.js +6709 -5729
- package/dist/index.js +5664 -4743
- 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 +56 -56
- package/dist/{extensions → plugins}/editor/editor.d.ts +56 -56
- package/dist/plugins/editor/editor.d.ts.map +1 -0
- package/dist/{extensions → plugins}/editor/field_handle.d.cts +13 -13
- package/dist/{extensions → plugins}/editor/field_handle.d.ts +13 -13
- 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} +83 -66
- package/dist/{extensions/editor/index.js → plugins/editor.js} +83 -66
- 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 +93 -105
- package/dist/{core/ecs → plugins/relations}/relation_service.d.ts +93 -105
- 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 +18 -17
- package/dist/type_primitives/typed_arrays/typed_arrays.d.ts +18 -17
- 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 +4 -4
- package/dist/version.d.ts +4 -4
- 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-3jyFfWNg.js +0 -2326
- package/dist/host_commands-DNf0f6ko.cjs +0 -1
- package/dist/internal-C9jjL90H.js +0 -2485
- package/dist/internal-RZN14uMw.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-9S1pY_Iw.js +0 -159
- package/dist/shallow-C5YmTbtb.cjs +0 -1
- package/dist/shallow-DQ8aG51_.cjs +0 -1
- package/dist/shallow-DfnAm9vG.js +0 -150
- package/dist/shared-BMXh9hxm.cjs +0 -1
- package/dist/shared-DQKK0i-E.js +0 -109
- package/dist/topological_sort-BDvEyb9W.cjs +0 -1
- package/dist/topological_sort-DK6EjpWa.js +0 -135
- package/dist/typed_arrays-BcXcnzB4.js +0 -258
- package/dist/typed_arrays-D3NmwtCG.cjs +0 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ArchetypeID, ArchetypeView } from './archetype_types.cjs';
|
|
2
|
+
import { AnyTypedArray, ColumnBacking, TypedArrayTag, BitSet } from '../../type_primitives/index.cjs';
|
|
2
3
|
import { ColumnStore } from '../store/column_store.cjs';
|
|
3
|
-
import { ComponentID, ComponentDef, ComponentSchema,
|
|
4
|
+
import { ComponentID, ComponentDef, ComponentSchema, TagToTypedArray, ColumnsForSchema, MutableColumnsForSchema, ReadonlyColumn } from './component.cjs';
|
|
4
5
|
import { EntityID, ReadonlyEntityIDArray } from './entity.cjs';
|
|
5
|
-
|
|
6
|
+
import { AccessorColumns } from './ref.cjs';
|
|
7
|
+
export type { ArchetypeID, ArchetypeView } from './archetype_types.cjs';
|
|
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,79 +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
|
-
* `GrowableTypedArray` grows in place.
|
|
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
|
|
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 PR #163 closed for `Store`; issue #378 closed it again for
|
|
67
|
-
* `Query`.
|
|
68
|
-
*
|
|
69
|
-
* `id` is the archetype's opaque identity (not a mutator) — exposed so the
|
|
70
|
-
* public `ECS.batchAddComponent`/`batchRemoveComponent` API can target an
|
|
71
|
-
* archetype without the caller holding a concrete `Archetype` reference.
|
|
72
|
-
*/
|
|
73
|
-
export interface ArchetypeView<out Defs extends readonly ComponentDef<any>[] = readonly ComponentDef<any>[]> {
|
|
74
|
-
/** Opaque archetype identity. Pass to `ECS.batch_*_component`. */
|
|
75
|
-
readonly id: ArchetypeID;
|
|
76
|
-
/** Number of **enabled** entities — the default-iteration bound (#577). Rows
|
|
77
|
-
* `0..entityCount-1` are enabled; disabled rows (if any) sit contiguously at
|
|
78
|
-
* `entityCount..totalCount-1`. `forEach` SoA loops read this, so they skip
|
|
79
|
-
* disabled rows for free. Use `totalCount` to span disabled rows too. */
|
|
80
|
-
readonly entityCount: number;
|
|
81
|
-
/** Total live rows, enabled + disabled (#577). Equal to `entityCount` unless
|
|
82
|
-
* some rows are disabled. Use for full-state work (serialization, snapshot,
|
|
83
|
-
* determinism) that must see every entity regardless of enabled state. */
|
|
84
|
-
readonly totalCount: number;
|
|
85
|
-
/** Number of disabled rows = `totalCount - entityCount` (#577). */
|
|
86
|
-
readonly disabledCount: number;
|
|
87
|
-
/** Raw entity ID buffer (packed `EntityID`s). Valid data at indices
|
|
88
|
-
* 0..totalCount-1 (enabled rows first, then disabled). */
|
|
89
|
-
readonly entityIds: ReadonlyEntityIDArray;
|
|
90
|
-
/** True if this archetype's mask includes the given component. */
|
|
91
|
-
hasComponent(id: ComponentID): boolean;
|
|
92
|
-
/** Get a single field's column (read-only). Valid data: indices
|
|
93
|
-
* 0..entityCount-1. `def` must be a term of the iterating query
|
|
94
|
-
* (POLISH_AUDIT #6); the bare-`ArchetypeView` default stays permissive. */
|
|
95
|
-
getColumnRead<D extends ComponentDef<any>, K extends string & keyof SchemaOf<D>>(def: D & DeclaredQueryTerm<Defs, D>, field: K): ReadonlyColumn;
|
|
96
|
-
/** Tuple fetch of several of one component's columns —
|
|
97
|
-
* `const [q, r] = arch.getColumnsRead(HexPos, "q", "r")`. One small
|
|
98
|
-
* array allocation per call; see the class doc on `Archetype`. */
|
|
99
|
-
getColumnsRead<D extends ComponentDef<any>, const K extends readonly (string & keyof SchemaOf<D>)[]>(def: D & DeclaredQueryTerm<Defs, D>, ...fields: K): {
|
|
100
|
-
[I in keyof K]: ReadonlyColumn;
|
|
101
|
-
};
|
|
102
|
-
/** Get a single field's column **if this archetype has the component**,
|
|
103
|
-
* else `undefined` — the optional-query fetch-if-present accessor (#575).
|
|
104
|
-
* The absent branch is expected (resolve the column pointer per archetype
|
|
105
|
-
* span: present ⇒ column, absent ⇒ `undefined`), not an error. Same
|
|
106
|
-
* advisory-readonly view and `reads`-access-check as `getColumnRead`. */
|
|
107
|
-
getOptionalColumnRead<S extends ComponentSchema, K extends string & keyof S>(def: ComponentDef<S>, field: K): ReadonlyColumn | undefined;
|
|
108
|
-
}
|
|
109
62
|
export declare class Archetype implements ArchetypeView {
|
|
110
63
|
readonly id: ArchetypeID;
|
|
111
64
|
readonly mask: BitSet;
|
|
@@ -113,114 +66,220 @@ export declare class Archetype implements ArchetypeView {
|
|
|
113
66
|
/**
|
|
114
67
|
* Whether a member entity occupies a real row here. True for every archetype
|
|
115
68
|
* except the **empty archetype** (the one with no components), where a
|
|
116
|
-
* component-less entity is "alive but unplaced"
|
|
117
|
-
* `
|
|
69
|
+
* component-less entity is "alive but unplaced". It points here via
|
|
70
|
+
* `_entityArchetypes` but carries `_entityRows === UNASSIGNED` and holds no
|
|
118
71
|
* row, exactly like a freshly `createEntity`'d one. Keeping the empty
|
|
119
72
|
* archetype rowless gives a component-less entity a single canonical form
|
|
120
73
|
* regardless of how it got there (created bare vs. lost its last component),
|
|
121
|
-
* 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
|
|
122
75
|
* history. The row-materialising methods below honour this flag.
|
|
123
76
|
*/
|
|
124
77
|
readonly materializesRows: boolean;
|
|
125
78
|
private readonly _entityIds;
|
|
126
79
|
length: number;
|
|
127
80
|
/**
|
|
128
|
-
* Enabled
|
|
81
|
+
* Enabled and disabled row partition (entity enable and disable). Rows
|
|
129
82
|
* `[0, enabled_count)` are enabled, `[enabled_count, length)` are disabled.
|
|
130
|
-
* `enabled_count === length` (no disabled rows) is the common case
|
|
83
|
+
* `enabled_count === length` (no disabled rows) is the common case, every
|
|
131
84
|
* fast path below short-circuits on it, so an archetype that never disables
|
|
132
|
-
* an entity pays nothing. Disable
|
|
133
|
-
* (`disableRow
|
|
134
|
-
* disabled tail (`_placeTail`). `entityCount` (the query
|
|
135
|
-
* returns this
|
|
136
|
-
* `stateHash` and published to the SAB descriptor so
|
|
137
|
-
* 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.
|
|
138
91
|
*/
|
|
139
92
|
enabledCount: number;
|
|
140
93
|
/**
|
|
141
94
|
* Flush-epoch stamp + captured pre-counts for the Store's per-entity flush
|
|
142
|
-
* 0-crossing detector
|
|
95
|
+
* 0-crossing detector: `_flushAdds` and `_flushRemoves` stamp each
|
|
143
96
|
* archetype on first sight per flush (a few field accesses) instead of probing
|
|
144
|
-
* a `Map<archetype_id, pre_count>` per entity
|
|
145
|
-
* cost the destroy drain
|
|
146
|
-
* `
|
|
147
|
-
* on either the total (`length`) or the enabled partition (`enabledCount`)
|
|
148
|
-
* an enabled append into an all-disabled archetype crosses only the latter
|
|
149
|
-
*
|
|
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`),
|
|
101
|
+
* an enabled append into an all-disabled archetype crosses only the latter.
|
|
102
|
+
* Owned by Store. Pure scheduling bookkeeping, never folded into
|
|
150
103
|
* `stateHash`/snapshot.
|
|
151
104
|
*/
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
105
|
+
flushSeenEpoch: number;
|
|
106
|
+
flushPreLen: number;
|
|
107
|
+
flushPreEnabled: number;
|
|
155
108
|
/**
|
|
156
|
-
* DEV-only iteration guard: >0 while a dense query iterator
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* structural mutation from inside the walk
|
|
161
|
-
* 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.
|
|
162
115
|
* Production builds never read or write it.
|
|
163
116
|
*/
|
|
164
|
-
|
|
165
|
-
private readonly
|
|
117
|
+
iterDepth: number;
|
|
118
|
+
private readonly _edges;
|
|
166
119
|
/**
|
|
167
120
|
* Cache of pre-computed transition maps for multi-component transitions
|
|
168
|
-
* (this → target). Single-component edges live on `
|
|
169
|
-
* 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,
|
|
170
123
|
* archetypes live for the Store's lifetime.
|
|
171
124
|
*/
|
|
172
|
-
private readonly
|
|
125
|
+
private readonly _batchTransitionMaps;
|
|
173
126
|
/**
|
|
174
|
-
* Per-set add-edge cache for `Store.addComponents
|
|
127
|
+
* Per-set add-edge cache for `Store.addComponents`, keyed by an
|
|
175
128
|
* exact pack of the added component ids. Lazily allocated: most archetypes
|
|
176
129
|
* never originate a plural add, so the Map stays `null` until the first one
|
|
177
|
-
* is resolved
|
|
130
|
+
* is resolved, the single-add `_edges[]` path never touches it.
|
|
178
131
|
*/
|
|
179
|
-
private
|
|
180
|
-
readonly
|
|
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;
|
|
141
|
+
private _eids;
|
|
142
|
+
private _rowCap;
|
|
143
|
+
private _colCap;
|
|
181
144
|
/** Set by `fromColumnStore` to record which SAB archetype this Archetype
|
|
182
145
|
* draws its column views from. `null` for the default heap-backed path
|
|
183
|
-
* (no SAB linkage
|
|
146
|
+
* (no SAB linkage, `refreshViews` would be a no-op there and so
|
|
184
147
|
* isn't supported). */
|
|
185
148
|
private _storeArchetypeId;
|
|
186
|
-
readonly
|
|
187
|
-
readonly
|
|
149
|
+
readonly colOffset: number[];
|
|
150
|
+
readonly fieldCount: number[];
|
|
188
151
|
private readonly _fieldIndex;
|
|
189
152
|
private readonly _fieldNames;
|
|
190
|
-
readonly
|
|
191
|
-
readonly
|
|
192
|
-
readonly
|
|
153
|
+
readonly accessorColumns: (AccessorColumns | undefined)[];
|
|
154
|
+
private readonly _fieldGid;
|
|
155
|
+
readonly columnIds: number[];
|
|
156
|
+
readonly changedTick: number[];
|
|
193
157
|
private readonly _mutGroupCache;
|
|
194
158
|
private readonly _readGroupCache;
|
|
195
159
|
/** Host-installed grow hook. Set by `Store` on every SAB-backed
|
|
196
|
-
* archetype during construction
|
|
160
|
+
* archetype during construction. `null` on heap-backed archetypes (the
|
|
197
161
|
* default `GrowableTypedArray` grows in place). Insertion methods call
|
|
198
162
|
* `_invoke_grow(...)` below before any push that would overflow the
|
|
199
|
-
* current SAB row capacity.
|
|
163
|
+
* current SAB row capacity. */
|
|
200
164
|
growHandler: ArchetypeGrowHandler | null;
|
|
201
165
|
constructor(id: ArchetypeID, mask: BitSet, layouts?: ArchetypeColumnLayout[], initialCapacity?: number, columnFactory?: ColumnFactory);
|
|
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
|
|
201
|
+
* invariant it restores. Cold: construction, `refreshViews`, tail of a grow. */
|
|
202
|
+
private _syncRowPlane;
|
|
203
|
+
/** Re-point every cached `forEachChunk` column group at the current `bufs`.
|
|
204
|
+
*
|
|
205
|
+
* Called only from `_syncRowPlane`, which is the only thing that can change a
|
|
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
|
|
208
|
+
* at all. That absence is the point: those two run once per archetype per
|
|
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
|
|
211
|
+
* statement pushed that per-mutation function past V8's inlining budget, and
|
|
212
|
+
* it became much slower. We measured two earlier forms of this optimisation
|
|
213
|
+
* and rejected both for the same cause. A fill through a shared helper made
|
|
214
|
+
* fragmented iteration slower, and an inline test for a stale buffer also made
|
|
215
|
+
* it slower. Each loss was larger than the gain in system dispatch. Move the
|
|
216
|
+
* work to the cold path, and the gain stays with no loss.
|
|
217
|
+
*
|
|
218
|
+
* Refreshes in place, preserving object identity, for the same reason
|
|
219
|
+
* `_syncRowPlane` refills `bufs` in place: a caller that captured the group
|
|
220
|
+
* sees fresh buffers rather than silently stale ones. */
|
|
221
|
+
private _refreshColumnCaches;
|
|
222
|
+
/** DEV-only: assert the row plane still addresses the live buffers.
|
|
223
|
+
*
|
|
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
|
|
228
|
+
* silently, with row writes landing in an orphan that later reads never see.
|
|
229
|
+
*
|
|
230
|
+
* Checked at the boundaries that read `.buf` directly, and O(1): index 0 alone
|
|
231
|
+
* is enough, because `_syncRowPlane` rewrites every entry together. There is
|
|
232
|
+
* no way to desync one column and not the first. */
|
|
233
|
+
private _assertRowPlaneFresh;
|
|
234
|
+
/** Make room for `additional` more rows, growing if the append would
|
|
235
|
+
* overflow. Replaces the `this.length >= cols[0].buf.length` probe the 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`.
|
|
243
|
+
*
|
|
244
|
+
* Both backings are handled by `_growRows` so callers don't branch: a
|
|
245
|
+
* SAB-backed archetype delegates to the store's `growHandler` (realloc +
|
|
246
|
+
* republish, which re-enters `refreshViews`), a heap-backed one
|
|
247
|
+
* (`growHandler === null`, the unit-test factory) grows each column in place.
|
|
248
|
+
* Either way the buffers may have moved, so the row plane is re-synced before
|
|
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. */
|
|
253
|
+
private _growRows;
|
|
254
|
+
/** Push `Archetype.length` down into each column's own logical length (and
|
|
255
|
+
* the entity-id array's). The row plane keeps `length` authoritative and never
|
|
256
|
+
* touches `_len`, so the columns' view of it goes stale between publishes.
|
|
257
|
+
* Nothing on the ECS hot paths reads it. The boundaries that do, a
|
|
258
|
+
* reallocating `reserve`, `refreshView`'s shrink check, `view()`,
|
|
259
|
+
* publish first. */
|
|
260
|
+
private _publishRowCounts;
|
|
202
261
|
/**
|
|
203
262
|
* Build an Archetype whose columns are TypedArray views into a single
|
|
204
263
|
* `ColumnStore`-managed `SharedArrayBuffer`. The store must contain an
|
|
205
264
|
* archetype entry whose id equals `storeArchetypeId` and whose columns
|
|
206
265
|
* cover every `(component_id, fieldIdx)` pair declared by `layouts`.
|
|
207
266
|
*
|
|
208
|
-
* The resulting archetype is fixed-capacity at the SAB row capacity
|
|
267
|
+
* The resulting archetype is fixed-capacity at the SAB row capacity,
|
|
209
268
|
* any operation that would push past it throws `StoreColumnOverflowError`.
|
|
210
269
|
* To grow capacity, call `growColumnStore(...)` between ticks and then
|
|
211
|
-
* `refreshViews(newStore)` on this archetype
|
|
270
|
+
* `refreshViews(newStore)` on this archetype.
|
|
212
271
|
*/
|
|
213
272
|
static fromColumnStore(id: ArchetypeID, mask: BitSet, layouts: ArchetypeColumnLayout[], columnStore: ColumnStore, storeArchetypeId: number): Archetype;
|
|
214
273
|
/** True iff this archetype was constructed via `fromColumnStore` and its
|
|
215
|
-
* `
|
|
274
|
+
* `flatColumns` are SAB-backed. Heap-backed archetypes return `false`
|
|
216
275
|
* and cannot be refreshed (their columns grow in place). */
|
|
217
276
|
get isBufferBacked(): boolean;
|
|
218
277
|
/**
|
|
219
278
|
* Repoint every column at the matching SAB view in `newColumnStore` after
|
|
220
279
|
* a host-side `growColumnStore` realloc. The archetype keeps its row
|
|
221
|
-
* count
|
|
280
|
+
* count. Each column's logical length is preserved. Caller is responsible
|
|
222
281
|
* for ensuring `newColumnStore` was built by `growColumnStore` over the
|
|
223
|
-
* SAB this archetype was originally drawn from
|
|
282
|
+
* SAB this archetype was originally drawn from, the matching
|
|
224
283
|
* `storeArchetypeId` was recorded in `fromColumnStore` and is reused here.
|
|
225
284
|
*
|
|
226
285
|
* Throws `ECSError` if this archetype is not SAB-backed, or if the new
|
|
@@ -228,42 +287,42 @@ export declare class Archetype implements ArchetypeView {
|
|
|
228
287
|
* expects.
|
|
229
288
|
*/
|
|
230
289
|
refreshViews(newColumnStore: ColumnStore): void;
|
|
231
|
-
/** Enabled-row count
|
|
290
|
+
/** Enabled-row count, the default iteration bound. See `enabled_count`.
|
|
232
291
|
* Equals `length` whenever no entity is disabled (the common case).
|
|
233
292
|
*
|
|
234
293
|
* During an `includeDisabled()` query's `forEach`, the module flag
|
|
235
|
-
* `
|
|
294
|
+
* `iterAllRows` is set so this returns `length` (enabled + disabled), the
|
|
236
295
|
* user's `for i < arch.entityCount` loop then spans disabled rows
|
|
237
296
|
* transparently, with no change to the loop. Outside such iteration the flag is
|
|
238
297
|
* false and this is `enabled_count`. */
|
|
239
298
|
get entityCount(): number;
|
|
240
|
-
/** Total live rows incl. disabled
|
|
299
|
+
/** Total live rows incl. disabled. */
|
|
241
300
|
get totalCount(): number;
|
|
242
|
-
/** Disabled-row count
|
|
301
|
+
/** Disabled-row count. */
|
|
243
302
|
get disabledCount(): number;
|
|
244
303
|
/** Raw entity ID buffer (packed `EntityID`s). Valid data at indices
|
|
245
304
|
* 0..totalCount-1 (enabled rows first, then disabled). */
|
|
246
305
|
get entityIds(): ReadonlyEntityIDArray;
|
|
247
306
|
/**
|
|
248
|
-
* Swap the two rows `a` and `b
|
|
249
|
-
* `
|
|
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
|
|
250
309
|
* cares about (it knows the two `entityIds` after the swap). The partition
|
|
251
|
-
* primitives (`disableRow
|
|
310
|
+
* primitives (`disableRow`, `enableRow`, `removeRow` and `_placeTail`) build on
|
|
252
311
|
* this. Writes through each column's live backing buffer (`buf`), so it works
|
|
253
|
-
* for both heap- and SAB-backed columns. No-op when `a === b`.
|
|
312
|
+
* for both heap- and SAB-backed columns. No-op when `a === b`. */
|
|
254
313
|
swapRows(a: number, b: number): void;
|
|
255
314
|
/**
|
|
256
|
-
* Place a freshly-appended
|
|
315
|
+
* Place a freshly-appended enabled entity (currently at the tail row `tail`,
|
|
257
316
|
* already pushed, `length` already incremented) into the enabled region, and
|
|
258
317
|
* bump `enabled_count`. Returns its final row.
|
|
259
318
|
*
|
|
260
|
-
* Common case
|
|
261
|
-
* the next enabled slot, so this is
|
|
262
|
-
* (byte-for-byte the
|
|
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,
|
|
263
322
|
* disabled rows occupy `[enabled_count, tail)`: swap the appended row into the
|
|
264
323
|
* first disabled slot and push that disabled occupant to the tail, updating
|
|
265
|
-
* its `
|
|
266
|
-
* if a caller appends into a disabled-bearing archetype without passing it).
|
|
324
|
+
* its `entityRows`. Requires `entityRows` in that case (a `DEV` guard fires
|
|
325
|
+
* if a caller appends into a disabled-bearing archetype without passing it). */
|
|
267
326
|
private _placeTail;
|
|
268
327
|
/**
|
|
269
328
|
* Bulk analog of `_placeTail` for `count` freshly-appended enabled rows at
|
|
@@ -271,64 +330,66 @@ export declare class Archetype implements ArchetypeView {
|
|
|
271
330
|
* start`): `enabled_count += count`, return `start`. The bulk callers
|
|
272
331
|
* (`spawnMany`, batch ops) fall back to a per-entity append loop when the
|
|
273
332
|
* target already has disabled rows, so the rare branch is a `DEV` guard
|
|
274
|
-
* rather than a block-rotation.
|
|
333
|
+
* rather than a block-rotation. */
|
|
275
334
|
private _placeTailBulk;
|
|
276
335
|
/**
|
|
277
336
|
* Disable the entity at `row` (precondition: enabled, `row < enabled_count`).
|
|
278
337
|
* Swaps it to the end of the enabled region and shrinks the region, so it
|
|
279
|
-
* lands in the disabled tail with its data intact
|
|
280
|
-
* O(1)+one row swap. Updates `
|
|
281
|
-
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;
|
|
282
341
|
/**
|
|
283
342
|
* Enable the entity at `row` (precondition: disabled, `row >= enabled_count`).
|
|
284
343
|
* Swaps it to the front of the disabled region and grows the enabled region.
|
|
285
|
-
* Updates `
|
|
286
|
-
enableRow(row: number,
|
|
344
|
+
* Updates `entityRows` for both rows touched. */
|
|
345
|
+
enableRow(row: number, entityRows: Int32Array): void;
|
|
287
346
|
/**
|
|
288
|
-
* Partition-aware swap-remove that owns its `
|
|
289
|
-
* 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
|
|
290
349
|
* enabled prefix contiguous in every case:
|
|
291
350
|
* - disabled row (`row >= enabled_count`): swap-remove within the disabled
|
|
292
|
-
* tail (the last row is disabled)
|
|
293
|
-
* - 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--`.
|
|
294
353
|
* - middle enabled row: move the last enabled row into the hole (so the
|
|
295
354
|
* enabled prefix stays packed), then swap-remove that vacated enabled slot
|
|
296
|
-
* with the global last
|
|
297
|
-
* Updates `
|
|
298
|
-
* the caller frees
|
|
299
|
-
removeRow(row: number,
|
|
300
|
-
/** @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
|
|
301
360
|
* disabled-bearing archetype case. Split out so the no-disabled fast path
|
|
302
|
-
* above stays small enough to inline
|
|
361
|
+
* above stays small enough to inline. See the doc on `removeRow`. */
|
|
303
362
|
private _removeRowPartitioned;
|
|
304
|
-
|
|
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;
|
|
305
366
|
hasComponent(id: ComponentID): boolean;
|
|
306
367
|
matches(required: BitSet): boolean;
|
|
307
368
|
/**
|
|
308
|
-
* Get a single field's column (read-only
|
|
369
|
+
* Get a single field's column (read-only, use when not mutating). Valid
|
|
309
370
|
* data: indices 0..entityCount-1. The `ReadonlyColumn` return is an
|
|
310
371
|
* *advisory* compile-time barrier: it is the live mutable backing buffer,
|
|
311
372
|
* so the `readonly` index signature blocks writes at the type layer only
|
|
312
|
-
* (a
|
|
313
|
-
* mutable `
|
|
373
|
+
* (a deliberate cast can still write through). For writes use the
|
|
374
|
+
* mutable `getColumnMut` (tick-bumping) below.
|
|
314
375
|
*/
|
|
315
376
|
getColumnRead<S extends ComponentSchema, K extends string & keyof S>(def: ComponentDef<S>, field: K): ReadonlyColumn;
|
|
316
377
|
/**
|
|
317
|
-
* Tuple fetch of several of one component's columns
|
|
378
|
+
* Tuple fetch of several of one component's columns,
|
|
318
379
|
* `const [q, r] = arch.getColumnsRead(HexPos, "q", "r")` collapses the
|
|
319
380
|
* per-field `getColumnRead` preamble at the top of an iteration callback
|
|
320
381
|
* to one line. Same advisory-readonly views and `reads` access-check as
|
|
321
|
-
* `getColumnRead`. Allocates one small array per call
|
|
322
|
-
* 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.
|
|
323
384
|
*/
|
|
324
385
|
getColumnsRead<S extends ComponentSchema, const K extends readonly (string & keyof S)[]>(def: ComponentDef<S>, ...fields: K): {
|
|
325
386
|
[I in keyof K]: ReadonlyColumn;
|
|
326
387
|
};
|
|
327
388
|
/**
|
|
328
389
|
* Get a single field's column **if this archetype has the component**, else
|
|
329
|
-
* `undefined
|
|
330
|
-
* Bevy `Option<&T
|
|
331
|
-
* 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
|
|
332
393
|
* archetype span on the return:
|
|
333
394
|
*
|
|
334
395
|
* q.forEach((arch) => {
|
|
@@ -342,23 +403,23 @@ export declare class Archetype implements ArchetypeView {
|
|
|
342
403
|
* **absent** branch, not a thrown error. The `DEV` checks still run
|
|
343
404
|
* **first** (before the absent short-circuit), so the requirements don't
|
|
344
405
|
* depend on whether the current span happens to hold `T`. Two checks fire:
|
|
345
|
-
* (1) `accessCheck.
|
|
346
|
-
* exactly as a required read does
|
|
347
|
-
* the iterating query must have declared `.optional(T)
|
|
406
|
+
* (1) `accessCheck.assertRead`, an optional read needs `reads:[T]` coverage
|
|
407
|
+
* exactly as a required read does, and (2) `accessCheck.assertOptionalFetch`,
|
|
408
|
+
* the iterating query must have declared `.optional(T)`, the read-side
|
|
348
409
|
* analog that makes the query term the fetch's authorization rather than inert
|
|
349
410
|
* decoration. The return is the same advisory-readonly view `getColumnRead`
|
|
350
411
|
* hands back.
|
|
351
412
|
*/
|
|
352
413
|
getOptionalColumnRead<S extends ComponentSchema, K extends string & keyof S>(def: ComponentDef<S>, field: K): ReadonlyColumn | undefined;
|
|
353
|
-
/** Get a single field's column (mutable
|
|
354
|
-
|
|
355
|
-
/** 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. */
|
|
356
417
|
columnGroupMut<S extends ComponentSchema>(def: ComponentDef<S>, tick: number): MutableColumnsForSchema<S>;
|
|
357
418
|
/** Read-only field-keyed column group (no tick bump). */
|
|
358
419
|
columnGroupRead<S extends ComponentSchema>(def: ComponentDef<S>): ColumnsForSchema<S>;
|
|
359
420
|
writeFields(row: number, componentId: ComponentID, values: Record<string, number>, tick: number): void;
|
|
360
421
|
/**
|
|
361
|
-
* Bulk variant of `writeFields
|
|
422
|
+
* Bulk variant of `writeFields`, fills `count` consecutive rows starting
|
|
362
423
|
* at `dstStart` with the same field values via per-field `TypedArray.fill`.
|
|
363
424
|
* For N rows of an F-field component, this is F native fill calls instead
|
|
364
425
|
* of N×F per-row JS writes. The change-tick is bumped once for the range,
|
|
@@ -375,67 +436,74 @@ export declare class Archetype implements ArchetypeView {
|
|
|
375
436
|
* Add an entity. Pushes zeroes into all columns and returns the assigned row.
|
|
376
437
|
* Store is responsible for tracking entityIndex → row.
|
|
377
438
|
*/
|
|
378
|
-
addEntity(entityId: EntityID,
|
|
439
|
+
addEntity(entityId: EntityID, entityRows?: Int32Array): number;
|
|
379
440
|
/**
|
|
380
441
|
* Remove entity at row via swap-and-pop. Swaps the last entity into the
|
|
381
442
|
* vacated row to keep data dense. Returns the entityIndex of the swapped
|
|
382
443
|
* entity (so Store can update its row), or NO_SWAP if no swap was needed.
|
|
383
444
|
*/
|
|
384
|
-
|
|
445
|
+
swapRemoveRow(row: number): number;
|
|
385
446
|
/** Tag-optimized add: skip column push entirely (no data to store). */
|
|
386
|
-
addEntityTag(entityId: EntityID,
|
|
447
|
+
addEntityTag(entityId: EntityID, entityRows?: Int32Array): number;
|
|
387
448
|
/**
|
|
388
449
|
* Bulk add `count` entities, zero-initialising all columns. Returns the
|
|
389
450
|
* starting dstRow for the batch. Caller is responsible for tracking
|
|
390
451
|
* entityIndex → row for every entity in the batch.
|
|
391
452
|
*
|
|
392
|
-
* Collapses the N×C
|
|
393
|
-
*
|
|
394
|
-
*
|
|
453
|
+
* Collapses the N×C per-element cost of N sequential `addEntity` calls into
|
|
454
|
+
* C `fill` calls, one for each column, the same pattern `bulkMoveAllFrom`
|
|
455
|
+
* uses for the move-with-data case.
|
|
395
456
|
*/
|
|
396
457
|
addEntities(entityIds: Uint32Array, count?: number): number;
|
|
397
458
|
/** Tag-optimized bulk add: skip the per-column zero-fill entirely. */
|
|
398
459
|
addEntitiesTag(entityIds: Uint32Array, count?: number): number;
|
|
399
|
-
/**
|
|
400
|
-
*
|
|
401
|
-
*
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
*
|
|
405
|
-
*
|
|
406
|
-
|
|
407
|
-
/**
|
|
408
|
-
*
|
|
409
|
-
*
|
|
410
|
-
|
|
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;
|
|
411
479
|
/** Bulk append `count` entities, filling column `i` with `flatValues[i]`
|
|
412
480
|
* in a single `TypedArray.fill` per column (no zero pass). Returns the
|
|
413
481
|
* starting row. */
|
|
414
482
|
addEntitiesWithValues(entityIds: Uint32Array, count: number, flatValues: number[], tick: number): number;
|
|
415
|
-
/** Tag-optimized remove via swap-and-pop: skip column swap
|
|
416
|
-
|
|
483
|
+
/** Tag-optimized remove via swap-and-pop: skip column swap and pop entirely. */
|
|
484
|
+
swapRemoveRowTag(row: number): number;
|
|
417
485
|
/**
|
|
418
486
|
* Move an entity from src archetype into this archetype in a single pass.
|
|
419
|
-
* Combines addEntity + copySharedFrom +
|
|
487
|
+
* Combines addEntity + copySharedFrom + swapRemoveRow(src).
|
|
420
488
|
* Uses a pre-computed transition map for branchless column copy.
|
|
421
489
|
* Writes dstRow to _moveResult[0], swapped entity index to _moveResult[1].
|
|
422
490
|
*/
|
|
423
|
-
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;
|
|
424
492
|
/**
|
|
425
493
|
* Move an entity from src into this archetype (tag-only: no columns to copy).
|
|
426
|
-
* Writes dstRow to _moveResult[0]
|
|
427
|
-
* partition-aware src/dst updates are owned internally
|
|
494
|
+
* Writes dstRow to _moveResult[0]. _moveResult[1] is always NO_SWAP (the
|
|
495
|
+
* partition-aware src/dst updates are owned internally).
|
|
428
496
|
*/
|
|
429
|
-
moveEntityFromTag(src: Archetype, srcRow: number, entityId: EntityID,
|
|
497
|
+
moveEntityFromTag(src: Archetype, srcRow: number, entityId: EntityID, entityRows: Int32Array): void;
|
|
430
498
|
/**
|
|
431
|
-
* Bulk-move
|
|
499
|
+
* Bulk-move all entities from src into this archetype using TypedArray.set().
|
|
432
500
|
* Much faster than per-entity moveEntityFrom when the entire source is moving.
|
|
433
501
|
* After this call, src is empty. Returns the starting dstRow for the batch.
|
|
434
502
|
*/
|
|
435
503
|
bulkMoveAllFrom(src: Archetype, transitionMap: Int16Array, tick: number): number;
|
|
436
504
|
/**
|
|
437
|
-
* Drop every row at once
|
|
438
|
-
* 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
|
|
439
507
|
* entire population leaves in one move: `bulkMoveAllFrom` clears the
|
|
440
508
|
* source this way, and `Store.batchRemoveComponent` calls it directly when
|
|
441
509
|
* the destination is the rowless empty archetype (batch-removing the last
|
|
@@ -444,16 +512,16 @@ export declare class Archetype implements ArchetypeView {
|
|
|
444
512
|
clearRows(): void;
|
|
445
513
|
/**
|
|
446
514
|
* Re-derive the host-side row bookkeeping after a snapshot is mounted onto a
|
|
447
|
-
* live world (
|
|
448
|
-
* (dense SAB) but
|
|
449
|
-
* 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
|
|
450
518
|
* already repointed the columns at the restored SAB.
|
|
451
519
|
*
|
|
452
520
|
* The caller scans the restored entity-index region to learn which entity
|
|
453
521
|
* occupies each row and passes them in row order (`rowEntityIds[r]` is the
|
|
454
|
-
* packed `EntityID` at row `r
|
|
455
|
-
* first then disabled per the
|
|
456
|
-
* partition boundary. This is the inverse of the per-row `addEntity`
|
|
522
|
+
* packed `EntityID` at row `r`. Rows `[0, length)` are dense, enabled rows
|
|
523
|
+
* first then disabled per the partition). `enabledCount` is the restored
|
|
524
|
+
* partition boundary. This is the inverse of the per-row `addEntity` and
|
|
457
525
|
* `disableRow` bookkeeping the live run accumulated.
|
|
458
526
|
*/
|
|
459
527
|
restoreHostRows(rowEntityIds: readonly number[], enabledCount: number): void;
|
|
@@ -461,19 +529,20 @@ export declare class Archetype implements ArchetypeView {
|
|
|
461
529
|
setEdge(componentId: ComponentID, edge: ArchetypeEdge): void;
|
|
462
530
|
/**
|
|
463
531
|
* Get the transition map from this archetype to `target`, building and caching
|
|
464
|
-
* it on miss.
|
|
465
|
-
* 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.
|
|
466
534
|
*/
|
|
467
|
-
|
|
468
|
-
/** Look up a cached plural-add transition by its packed key
|
|
535
|
+
transitionMapTo(target: Archetype): Int16Array;
|
|
536
|
+
/** Look up a cached plural-add transition by its packed key. Returns
|
|
469
537
|
* `undefined` until the first composite add out of this archetype plants the
|
|
470
|
-
* lazy Map
|
|
538
|
+
* lazy Map, the common case for archetypes that only ever see single adds. */
|
|
471
539
|
getCompositeAddEdge(key: number): CompositeAddEdge | undefined;
|
|
472
540
|
/** Cache a resolved plural-add transition (target + src→target map) under its
|
|
473
|
-
* packed key
|
|
541
|
+
* packed key, allocating the backing Map on first use. */
|
|
474
542
|
cacheCompositeAddEdge(key: number, target: ArchetypeID, map: Int16Array): void;
|
|
475
543
|
}
|
|
476
|
-
/** Reusable result buffer for
|
|
544
|
+
/** Reusable result buffer for `moveEntityFrom` and `moveEntityFromTag`.
|
|
545
|
+
* `[dstRow, swappedIndex]`. */
|
|
477
546
|
export declare const _moveResult: [number, number];
|
|
478
547
|
export declare function _setIterAllRows(value: boolean): boolean;
|
|
479
548
|
/**
|
|
@@ -481,6 +550,5 @@ export declare function _setIterAllRows(value: boolean): boolean;
|
|
|
481
550
|
* For each column in dst, stores the index of the corresponding column in src,
|
|
482
551
|
* or -1 if the column is new (no source).
|
|
483
552
|
*/
|
|
484
|
-
export declare function
|
|
485
|
-
export {};
|
|
553
|
+
export declare function createTransitionMap(src: Archetype, dst: Archetype): Int16Array;
|
|
486
554
|
//# sourceMappingURL=archetype.d.ts.map
|