@esengine/ecs-framework 2.1.12 → 2.1.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esengine/ecs-framework",
3
- "version": "2.1.12",
3
+ "version": "2.1.13",
4
4
  "description": "用于Laya、Cocos等游戏引擎的高性能ECS框架",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -18,7 +18,6 @@
18
18
  "index.umd.js",
19
19
  "index.umd.js.map",
20
20
  "index.d.ts",
21
- "wasm",
22
21
  "README.md",
23
22
  "LICENSE",
24
23
  "SECURITY.md",
@@ -1,141 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * 创建组件掩码的辅助函数
5
- */
6
- export function create_component_mask(component_ids: Uint32Array): bigint;
7
- /**
8
- * 检查掩码是否包含指定组件
9
- */
10
- export function mask_contains_component(mask: bigint, component_id: number): boolean;
11
- /**
12
- * 初始化函数
13
- */
14
- export function main(): void;
15
- /**
16
- * 高性能ECS核心,专注于实体查询和掩码管理
17
- */
18
- export class EcsCore {
19
- free(): void;
20
- /**
21
- * 创建新的ECS核心
22
- */
23
- constructor();
24
- /**
25
- * 创建新实体
26
- */
27
- create_entity(): number;
28
- /**
29
- * 删除实体
30
- */
31
- destroy_entity(entity_id: number): boolean;
32
- /**
33
- * 更新实体的组件掩码
34
- */
35
- update_entity_mask(entity_id: number, mask: bigint): void;
36
- /**
37
- * 批量更新实体掩码
38
- */
39
- batch_update_masks(entity_ids: Uint32Array, masks: BigUint64Array): void;
40
- /**
41
- * 查询实体
42
- */
43
- query_entities(mask: bigint, max_results: number): number;
44
- /**
45
- * 获取查询结果数量
46
- */
47
- get_query_result_count(): number;
48
- /**
49
- * 缓存查询实体
50
- */
51
- query_cached(mask: bigint): number;
52
- /**
53
- * 获取缓存查询结果数量
54
- */
55
- get_cached_query_count(mask: bigint): number;
56
- /**
57
- * 多组件查询
58
- */
59
- query_multiple_components(masks: BigUint64Array, max_results: number): number;
60
- /**
61
- * 排除查询
62
- */
63
- query_with_exclusion(include_mask: bigint, exclude_mask: bigint, max_results: number): number;
64
- /**
65
- * 获取实体的组件掩码
66
- */
67
- get_entity_mask(entity_id: number): bigint;
68
- /**
69
- * 检查实体是否存在
70
- */
71
- entity_exists(entity_id: number): boolean;
72
- /**
73
- * 获取实体数量
74
- */
75
- get_entity_count(): number;
76
- /**
77
- * 获取性能统计信息
78
- */
79
- get_performance_stats(): Array<any>;
80
- /**
81
- * 清理所有数据
82
- */
83
- clear(): void;
84
- /**
85
- * 重建查询缓存
86
- */
87
- rebuild_query_cache(): void;
88
- }
89
-
90
- export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
91
-
92
- export interface InitOutput {
93
- readonly memory: WebAssembly.Memory;
94
- readonly __wbg_ecscore_free: (a: number, b: number) => void;
95
- readonly ecscore_new: () => number;
96
- readonly ecscore_create_entity: (a: number) => number;
97
- readonly ecscore_destroy_entity: (a: number, b: number) => number;
98
- readonly ecscore_update_entity_mask: (a: number, b: number, c: bigint) => void;
99
- readonly ecscore_batch_update_masks: (a: number, b: number, c: number, d: number, e: number) => void;
100
- readonly ecscore_query_entities: (a: number, b: bigint, c: number) => number;
101
- readonly ecscore_get_query_result_count: (a: number) => number;
102
- readonly ecscore_query_cached: (a: number, b: bigint) => number;
103
- readonly ecscore_get_cached_query_count: (a: number, b: bigint) => number;
104
- readonly ecscore_query_multiple_components: (a: number, b: number, c: number, d: number) => number;
105
- readonly ecscore_query_with_exclusion: (a: number, b: bigint, c: bigint, d: number) => number;
106
- readonly ecscore_get_entity_mask: (a: number, b: number) => bigint;
107
- readonly ecscore_entity_exists: (a: number, b: number) => number;
108
- readonly ecscore_get_entity_count: (a: number) => number;
109
- readonly ecscore_get_performance_stats: (a: number) => any;
110
- readonly ecscore_clear: (a: number) => void;
111
- readonly ecscore_rebuild_query_cache: (a: number) => void;
112
- readonly create_component_mask: (a: number, b: number) => bigint;
113
- readonly mask_contains_component: (a: bigint, b: number) => number;
114
- readonly main: () => void;
115
- readonly __wbindgen_exn_store: (a: number) => void;
116
- readonly __externref_table_alloc: () => number;
117
- readonly __wbindgen_export_2: WebAssembly.Table;
118
- readonly __wbindgen_malloc: (a: number, b: number) => number;
119
- readonly __wbindgen_start: () => void;
120
- }
121
-
122
- export type SyncInitInput = BufferSource | WebAssembly.Module;
123
- /**
124
- * Instantiates the given `module`, which can either be bytes or
125
- * a precompiled `WebAssembly.Module`.
126
- *
127
- * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
128
- *
129
- * @returns {InitOutput}
130
- */
131
- export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
132
-
133
- /**
134
- * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
135
- * for everything else, calls `WebAssembly.instantiate` directly.
136
- *
137
- * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
138
- *
139
- * @returns {Promise<InitOutput>}
140
- */
141
- export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
@@ -1,415 +0,0 @@
1
- let wasm;
2
-
3
- let cachedUint8ArrayMemory0 = null;
4
-
5
- function getUint8ArrayMemory0() {
6
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
7
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
8
- }
9
- return cachedUint8ArrayMemory0;
10
- }
11
-
12
- function getArrayU8FromWasm0(ptr, len) {
13
- ptr = ptr >>> 0;
14
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
15
- }
16
-
17
- function addToExternrefTable0(obj) {
18
- const idx = wasm.__externref_table_alloc();
19
- wasm.__wbindgen_export_2.set(idx, obj);
20
- return idx;
21
- }
22
-
23
- function handleError(f, args) {
24
- try {
25
- return f.apply(this, args);
26
- } catch (e) {
27
- const idx = addToExternrefTable0(e);
28
- wasm.__wbindgen_exn_store(idx);
29
- }
30
- }
31
-
32
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
33
-
34
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
35
-
36
- function getStringFromWasm0(ptr, len) {
37
- ptr = ptr >>> 0;
38
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
39
- }
40
-
41
- let cachedUint32ArrayMemory0 = null;
42
-
43
- function getUint32ArrayMemory0() {
44
- if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
45
- cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
46
- }
47
- return cachedUint32ArrayMemory0;
48
- }
49
-
50
- let WASM_VECTOR_LEN = 0;
51
-
52
- function passArray32ToWasm0(arg, malloc) {
53
- const ptr = malloc(arg.length * 4, 4) >>> 0;
54
- getUint32ArrayMemory0().set(arg, ptr / 4);
55
- WASM_VECTOR_LEN = arg.length;
56
- return ptr;
57
- }
58
-
59
- let cachedBigUint64ArrayMemory0 = null;
60
-
61
- function getBigUint64ArrayMemory0() {
62
- if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
63
- cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
64
- }
65
- return cachedBigUint64ArrayMemory0;
66
- }
67
-
68
- function passArray64ToWasm0(arg, malloc) {
69
- const ptr = malloc(arg.length * 8, 8) >>> 0;
70
- getBigUint64ArrayMemory0().set(arg, ptr / 8);
71
- WASM_VECTOR_LEN = arg.length;
72
- return ptr;
73
- }
74
- /**
75
- * 创建组件掩码的辅助函数
76
- * @param {Uint32Array} component_ids
77
- * @returns {bigint}
78
- */
79
- export function create_component_mask(component_ids) {
80
- const ptr0 = passArray32ToWasm0(component_ids, wasm.__wbindgen_malloc);
81
- const len0 = WASM_VECTOR_LEN;
82
- const ret = wasm.create_component_mask(ptr0, len0);
83
- return BigInt.asUintN(64, ret);
84
- }
85
-
86
- /**
87
- * 检查掩码是否包含指定组件
88
- * @param {bigint} mask
89
- * @param {number} component_id
90
- * @returns {boolean}
91
- */
92
- export function mask_contains_component(mask, component_id) {
93
- const ret = wasm.mask_contains_component(mask, component_id);
94
- return ret !== 0;
95
- }
96
-
97
- /**
98
- * 初始化函数
99
- */
100
- export function main() {
101
- wasm.main();
102
- }
103
-
104
- const EcsCoreFinalization = (typeof FinalizationRegistry === 'undefined')
105
- ? { register: () => {}, unregister: () => {} }
106
- : new FinalizationRegistry(ptr => wasm.__wbg_ecscore_free(ptr >>> 0, 1));
107
- /**
108
- * 高性能ECS核心,专注于实体查询和掩码管理
109
- */
110
- export class EcsCore {
111
-
112
- __destroy_into_raw() {
113
- const ptr = this.__wbg_ptr;
114
- this.__wbg_ptr = 0;
115
- EcsCoreFinalization.unregister(this);
116
- return ptr;
117
- }
118
-
119
- free() {
120
- const ptr = this.__destroy_into_raw();
121
- wasm.__wbg_ecscore_free(ptr, 0);
122
- }
123
- /**
124
- * 创建新的ECS核心
125
- */
126
- constructor() {
127
- const ret = wasm.ecscore_new();
128
- this.__wbg_ptr = ret >>> 0;
129
- EcsCoreFinalization.register(this, this.__wbg_ptr, this);
130
- return this;
131
- }
132
- /**
133
- * 创建新实体
134
- * @returns {number}
135
- */
136
- create_entity() {
137
- const ret = wasm.ecscore_create_entity(this.__wbg_ptr);
138
- return ret >>> 0;
139
- }
140
- /**
141
- * 删除实体
142
- * @param {number} entity_id
143
- * @returns {boolean}
144
- */
145
- destroy_entity(entity_id) {
146
- const ret = wasm.ecscore_destroy_entity(this.__wbg_ptr, entity_id);
147
- return ret !== 0;
148
- }
149
- /**
150
- * 更新实体的组件掩码
151
- * @param {number} entity_id
152
- * @param {bigint} mask
153
- */
154
- update_entity_mask(entity_id, mask) {
155
- wasm.ecscore_update_entity_mask(this.__wbg_ptr, entity_id, mask);
156
- }
157
- /**
158
- * 批量更新实体掩码
159
- * @param {Uint32Array} entity_ids
160
- * @param {BigUint64Array} masks
161
- */
162
- batch_update_masks(entity_ids, masks) {
163
- const ptr0 = passArray32ToWasm0(entity_ids, wasm.__wbindgen_malloc);
164
- const len0 = WASM_VECTOR_LEN;
165
- const ptr1 = passArray64ToWasm0(masks, wasm.__wbindgen_malloc);
166
- const len1 = WASM_VECTOR_LEN;
167
- wasm.ecscore_batch_update_masks(this.__wbg_ptr, ptr0, len0, ptr1, len1);
168
- }
169
- /**
170
- * 查询实体
171
- * @param {bigint} mask
172
- * @param {number} max_results
173
- * @returns {number}
174
- */
175
- query_entities(mask, max_results) {
176
- const ret = wasm.ecscore_query_entities(this.__wbg_ptr, mask, max_results);
177
- return ret >>> 0;
178
- }
179
- /**
180
- * 获取查询结果数量
181
- * @returns {number}
182
- */
183
- get_query_result_count() {
184
- const ret = wasm.ecscore_get_query_result_count(this.__wbg_ptr);
185
- return ret >>> 0;
186
- }
187
- /**
188
- * 缓存查询实体
189
- * @param {bigint} mask
190
- * @returns {number}
191
- */
192
- query_cached(mask) {
193
- const ret = wasm.ecscore_query_cached(this.__wbg_ptr, mask);
194
- return ret >>> 0;
195
- }
196
- /**
197
- * 获取缓存查询结果数量
198
- * @param {bigint} mask
199
- * @returns {number}
200
- */
201
- get_cached_query_count(mask) {
202
- const ret = wasm.ecscore_get_cached_query_count(this.__wbg_ptr, mask);
203
- return ret >>> 0;
204
- }
205
- /**
206
- * 多组件查询
207
- * @param {BigUint64Array} masks
208
- * @param {number} max_results
209
- * @returns {number}
210
- */
211
- query_multiple_components(masks, max_results) {
212
- const ptr0 = passArray64ToWasm0(masks, wasm.__wbindgen_malloc);
213
- const len0 = WASM_VECTOR_LEN;
214
- const ret = wasm.ecscore_query_multiple_components(this.__wbg_ptr, ptr0, len0, max_results);
215
- return ret >>> 0;
216
- }
217
- /**
218
- * 排除查询
219
- * @param {bigint} include_mask
220
- * @param {bigint} exclude_mask
221
- * @param {number} max_results
222
- * @returns {number}
223
- */
224
- query_with_exclusion(include_mask, exclude_mask, max_results) {
225
- const ret = wasm.ecscore_query_with_exclusion(this.__wbg_ptr, include_mask, exclude_mask, max_results);
226
- return ret >>> 0;
227
- }
228
- /**
229
- * 获取实体的组件掩码
230
- * @param {number} entity_id
231
- * @returns {bigint}
232
- */
233
- get_entity_mask(entity_id) {
234
- const ret = wasm.ecscore_get_entity_mask(this.__wbg_ptr, entity_id);
235
- return BigInt.asUintN(64, ret);
236
- }
237
- /**
238
- * 检查实体是否存在
239
- * @param {number} entity_id
240
- * @returns {boolean}
241
- */
242
- entity_exists(entity_id) {
243
- const ret = wasm.ecscore_entity_exists(this.__wbg_ptr, entity_id);
244
- return ret !== 0;
245
- }
246
- /**
247
- * 获取实体数量
248
- * @returns {number}
249
- */
250
- get_entity_count() {
251
- const ret = wasm.ecscore_get_entity_count(this.__wbg_ptr);
252
- return ret >>> 0;
253
- }
254
- /**
255
- * 获取性能统计信息
256
- * @returns {Array<any>}
257
- */
258
- get_performance_stats() {
259
- const ret = wasm.ecscore_get_performance_stats(this.__wbg_ptr);
260
- return ret;
261
- }
262
- /**
263
- * 清理所有数据
264
- */
265
- clear() {
266
- wasm.ecscore_clear(this.__wbg_ptr);
267
- }
268
- /**
269
- * 重建查询缓存
270
- */
271
- rebuild_query_cache() {
272
- wasm.ecscore_rebuild_query_cache(this.__wbg_ptr);
273
- }
274
- }
275
-
276
- async function __wbg_load(module, imports) {
277
- if (typeof Response === 'function' && module instanceof Response) {
278
- if (typeof WebAssembly.instantiateStreaming === 'function') {
279
- try {
280
- return await WebAssembly.instantiateStreaming(module, imports);
281
-
282
- } catch (e) {
283
- if (module.headers.get('Content-Type') != 'application/wasm') {
284
- console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
285
-
286
- } else {
287
- throw e;
288
- }
289
- }
290
- }
291
-
292
- const bytes = await module.arrayBuffer();
293
- return await WebAssembly.instantiate(bytes, imports);
294
-
295
- } else {
296
- const instance = await WebAssembly.instantiate(module, imports);
297
-
298
- if (instance instanceof WebAssembly.Instance) {
299
- return { instance, module };
300
-
301
- } else {
302
- return instance;
303
- }
304
- }
305
- }
306
-
307
- function __wbg_get_imports() {
308
- const imports = {};
309
- imports.wbg = {};
310
- imports.wbg.__wbg_getRandomValues_3c9c0d586e575a16 = function() { return handleError(function (arg0, arg1) {
311
- globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
312
- }, arguments) };
313
- imports.wbg.__wbg_log_bb5387ff27ac9b37 = function(arg0, arg1) {
314
- console.log(getStringFromWasm0(arg0, arg1));
315
- };
316
- imports.wbg.__wbg_new_78feb108b6472713 = function() {
317
- const ret = new Array();
318
- return ret;
319
- };
320
- imports.wbg.__wbg_push_737cfc8c1432c2c6 = function(arg0, arg1) {
321
- const ret = arg0.push(arg1);
322
- return ret;
323
- };
324
- imports.wbg.__wbindgen_init_externref_table = function() {
325
- const table = wasm.__wbindgen_export_2;
326
- const offset = table.grow(4);
327
- table.set(0, undefined);
328
- table.set(offset + 0, undefined);
329
- table.set(offset + 1, null);
330
- table.set(offset + 2, true);
331
- table.set(offset + 3, false);
332
- ;
333
- };
334
- imports.wbg.__wbindgen_number_new = function(arg0) {
335
- const ret = arg0;
336
- return ret;
337
- };
338
- imports.wbg.__wbindgen_throw = function(arg0, arg1) {
339
- throw new Error(getStringFromWasm0(arg0, arg1));
340
- };
341
-
342
- return imports;
343
- }
344
-
345
- function __wbg_init_memory(imports, memory) {
346
-
347
- }
348
-
349
- function __wbg_finalize_init(instance, module) {
350
- wasm = instance.exports;
351
- __wbg_init.__wbindgen_wasm_module = module;
352
- cachedBigUint64ArrayMemory0 = null;
353
- cachedUint32ArrayMemory0 = null;
354
- cachedUint8ArrayMemory0 = null;
355
-
356
-
357
- wasm.__wbindgen_start();
358
- return wasm;
359
- }
360
-
361
- function initSync(module) {
362
- if (wasm !== undefined) return wasm;
363
-
364
-
365
- if (typeof module !== 'undefined') {
366
- if (Object.getPrototypeOf(module) === Object.prototype) {
367
- ({module} = module)
368
- } else {
369
- console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
370
- }
371
- }
372
-
373
- const imports = __wbg_get_imports();
374
-
375
- __wbg_init_memory(imports);
376
-
377
- if (!(module instanceof WebAssembly.Module)) {
378
- module = new WebAssembly.Module(module);
379
- }
380
-
381
- const instance = new WebAssembly.Instance(module, imports);
382
-
383
- return __wbg_finalize_init(instance, module);
384
- }
385
-
386
- async function __wbg_init(module_or_path) {
387
- if (wasm !== undefined) return wasm;
388
-
389
-
390
- if (typeof module_or_path !== 'undefined') {
391
- if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
392
- ({module_or_path} = module_or_path)
393
- } else {
394
- console.warn('using deprecated parameters for the initialization function; pass a single object instead')
395
- }
396
- }
397
-
398
- if (typeof module_or_path === 'undefined') {
399
- module_or_path = new URL('ecs_wasm_core_bg.wasm', import.meta.url);
400
- }
401
- const imports = __wbg_get_imports();
402
-
403
- if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
404
- module_or_path = fetch(module_or_path);
405
- }
406
-
407
- __wbg_init_memory(imports);
408
-
409
- const { instance, module } = await __wbg_load(await module_or_path, imports);
410
-
411
- return __wbg_finalize_init(instance, module);
412
- }
413
-
414
- export { initSync };
415
- export default __wbg_init;
Binary file
@@ -1,29 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- export const memory: WebAssembly.Memory;
4
- export const __wbg_ecscore_free: (a: number, b: number) => void;
5
- export const ecscore_new: () => number;
6
- export const ecscore_create_entity: (a: number) => number;
7
- export const ecscore_destroy_entity: (a: number, b: number) => number;
8
- export const ecscore_update_entity_mask: (a: number, b: number, c: bigint) => void;
9
- export const ecscore_batch_update_masks: (a: number, b: number, c: number, d: number, e: number) => void;
10
- export const ecscore_query_entities: (a: number, b: bigint, c: number) => number;
11
- export const ecscore_get_query_result_count: (a: number) => number;
12
- export const ecscore_query_cached: (a: number, b: bigint) => number;
13
- export const ecscore_get_cached_query_count: (a: number, b: bigint) => number;
14
- export const ecscore_query_multiple_components: (a: number, b: number, c: number, d: number) => number;
15
- export const ecscore_query_with_exclusion: (a: number, b: bigint, c: bigint, d: number) => number;
16
- export const ecscore_get_entity_mask: (a: number, b: number) => bigint;
17
- export const ecscore_entity_exists: (a: number, b: number) => number;
18
- export const ecscore_get_entity_count: (a: number) => number;
19
- export const ecscore_get_performance_stats: (a: number) => any;
20
- export const ecscore_clear: (a: number) => void;
21
- export const ecscore_rebuild_query_cache: (a: number) => void;
22
- export const create_component_mask: (a: number, b: number) => bigint;
23
- export const mask_contains_component: (a: bigint, b: number) => number;
24
- export const main: () => void;
25
- export const __wbindgen_exn_store: (a: number) => void;
26
- export const __externref_table_alloc: () => number;
27
- export const __wbindgen_export_2: WebAssembly.Table;
28
- export const __wbindgen_malloc: (a: number, b: number) => number;
29
- export const __wbindgen_start: () => void;
package/wasm/package.json DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "name": "ecs-wasm-core",
3
- "type": "module",
4
- "version": "0.1.0",
5
- "files": [
6
- "ecs_wasm_core_bg.wasm",
7
- "ecs_wasm_core.js",
8
- "ecs_wasm_core.d.ts"
9
- ],
10
- "main": "ecs_wasm_core.js",
11
- "types": "ecs_wasm_core.d.ts",
12
- "sideEffects": [
13
- "./snippets/*"
14
- ]
15
- }