@woosh/meep-engine 2.128.2 → 2.128.4
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 +1 -1
- package/src/core/binary/allocator/OffsetAllocator.d.ts +9 -0
- package/src/core/binary/allocator/OffsetAllocator.d.ts.map +1 -1
- package/src/core/binary/allocator/OffsetAllocator.js +21 -6
- package/src/core/bvh2/bvh3/query/BVHQueryIntersectsSphere.d.ts +2 -2
- package/src/core/bvh2/bvh3/query/BVHQueryIntersectsSphere.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/query/BVHQueryIntersectsSphere.js +11 -4
- package/src/core/collection/list/List.d.ts.map +1 -1
- package/src/core/collection/list/List.js +22 -9
- package/src/engine/input/devices/KeyboardDevice.js +1 -1
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"description": "Pure JavaScript game engine. Fully featured and production ready.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.128.
|
|
8
|
+
"version": "2.128.4",
|
|
9
9
|
"main": "build/meep.module.js",
|
|
10
10
|
"module": "build/meep.module.js",
|
|
11
11
|
"exports": {
|
|
@@ -81,8 +81,17 @@ export class OffsetAllocator {
|
|
|
81
81
|
*/
|
|
82
82
|
allocate(size: number): Allocation;
|
|
83
83
|
/**
|
|
84
|
+
* Direct method of releasing an allocation.
|
|
85
|
+
* Allows the user to skip holding an object reference in memory.
|
|
86
|
+
* {@link node_index} can be read from {@link Allocation.metadata}
|
|
84
87
|
*
|
|
88
|
+
* @param {number} node_index
|
|
89
|
+
* @see free
|
|
90
|
+
*/
|
|
91
|
+
free_node(node_index: number): void;
|
|
92
|
+
/**
|
|
85
93
|
* @param {Allocation} allocation
|
|
94
|
+
* @see free_node
|
|
86
95
|
*/
|
|
87
96
|
free(allocation: Allocation): void;
|
|
88
97
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OffsetAllocator.d.ts","sourceRoot":"","sources":["../../../../../src/core/binary/allocator/OffsetAllocator.js"],"names":[],"mappings":"AAaA,4CAA6C;AAmF7C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IAwDI;;;;OAIG;IACH,kBAHW,MAAM,cACN,MAAM,EAYhB;IAtED;;;;OAIG;IACH,MAFU,MAAM,CAEP;IAET;;;;OAIG;IACH,WAFU,MAAM,CAEF;IAEd;;;OAGG;IACH,aAFU,MAAM,CAEA;IAEhB;;;OAGG;IACH,aAFU,MAAM,CAEA;IAEhB;;;OAGG;IACH,UAFU,UAAU,CAEoB;IAExC;;;OAGG;IACH,YAFU,WAAW,CAEuB;IAE5C;;;OAGG;IACH,OAFU,aAAa,CAEmB;IAE1C;;OAEG;IACH,WAFU,WAAW,CAEX;IAEV;;;OAGG;IACH,YAFU,MAAM,CAED;IAmBf;;;;OAIG;IACH,eAHW,MAAM,GACJ,UAAU,CAkGtB;IAED;;;OAGG;IACH,
|
|
1
|
+
{"version":3,"file":"OffsetAllocator.d.ts","sourceRoot":"","sources":["../../../../../src/core/binary/allocator/OffsetAllocator.js"],"names":[],"mappings":"AAaA,4CAA6C;AAmF7C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IAwDI;;;;OAIG;IACH,kBAHW,MAAM,cACN,MAAM,EAYhB;IAtED;;;;OAIG;IACH,MAFU,MAAM,CAEP;IAET;;;;OAIG;IACH,WAFU,MAAM,CAEF;IAEd;;;OAGG;IACH,aAFU,MAAM,CAEA;IAEhB;;;OAGG;IACH,aAFU,MAAM,CAEA;IAEhB;;;OAGG;IACH,UAFU,UAAU,CAEoB;IAExC;;;OAGG;IACH,YAFU,WAAW,CAEuB;IAE5C;;;OAGG;IACH,OAFU,aAAa,CAEmB;IAE1C;;OAEG;IACH,WAFU,WAAW,CAEX;IAEV;;;OAGG;IACH,YAFU,MAAM,CAED;IAmBf;;;;OAIG;IACH,eAHW,MAAM,GACJ,UAAU,CAkGtB;IAED;;;;;;;OAOG;IACH,sBAHW,MAAM,QAqFhB;IAED;;;OAGG;IACH,iBAHW,UAAU,QAUpB;IAqID;;OAEG;IACH,cA4BC;IAED;;;OAGG;IACH,iBAFY,aAAa,CA2BxB;;CACJ;8BAhlB6B,yCAAyC;AAgDvE;IAII;;;;;OAKG;IACH,oBAJW,MAAM,YACN,MAAM,GACL,UAAU,CASrB;IAhBD,eAA4B;IAC5B,iBAA8B;CAgBjC;AAoBD;IACI,uBAAkB;IAClB,0BAAqB;CACxB"}
|
|
@@ -293,14 +293,16 @@ export class OffsetAllocator {
|
|
|
293
293
|
}
|
|
294
294
|
|
|
295
295
|
/**
|
|
296
|
+
* Direct method of releasing an allocation.
|
|
297
|
+
* Allows the user to skip holding an object reference in memory.
|
|
298
|
+
* {@link node_index} can be read from {@link Allocation.metadata}
|
|
296
299
|
*
|
|
297
|
-
* @param {
|
|
300
|
+
* @param {number} node_index
|
|
301
|
+
* @see free
|
|
298
302
|
*/
|
|
299
|
-
|
|
300
|
-
assert.
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
const node_index = allocation.metadata;
|
|
303
|
+
free_node(node_index) {
|
|
304
|
+
assert.isNonNegativeInteger(node_index, 'node_index');
|
|
305
|
+
assert.notEqual(node_index, ALLOCATOR_NO_SPACE, 'Invalid allocation');
|
|
304
306
|
|
|
305
307
|
const nodes = this.nodes;
|
|
306
308
|
const node_flags = nodes.readCellValue(node_index, NODE_FIELD_FLAGS);
|
|
@@ -382,6 +384,19 @@ export class OffsetAllocator {
|
|
|
382
384
|
}
|
|
383
385
|
}
|
|
384
386
|
|
|
387
|
+
/**
|
|
388
|
+
* @param {Allocation} allocation
|
|
389
|
+
* @see free_node
|
|
390
|
+
*/
|
|
391
|
+
free(allocation) {
|
|
392
|
+
assert.notEqual(allocation.metadata, ALLOCATOR_NO_SPACE, 'Invalid allocation');
|
|
393
|
+
// if (!m_nodes) return;
|
|
394
|
+
|
|
395
|
+
const node_index = allocation.metadata;
|
|
396
|
+
|
|
397
|
+
this.free_node(node_index);
|
|
398
|
+
}
|
|
399
|
+
|
|
385
400
|
/**
|
|
386
401
|
*
|
|
387
402
|
* @param {number} size
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export class BVHQueryIntersectsSphere extends BVHQuery {
|
|
2
2
|
/**
|
|
3
3
|
*
|
|
4
|
-
* @param {number[]|ArrayLike<number>} sphere
|
|
4
|
+
* @param {number[]|ArrayLike<number>} sphere (x,y,z,radius)
|
|
5
5
|
* @returns {BVHQueryIntersectsRay}
|
|
6
6
|
*/
|
|
7
7
|
static from(sphere: number[] | ArrayLike<number>): BVHQueryIntersectsRay;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* [x,y,z,radius]
|
|
10
10
|
* @type {number[]}
|
|
11
11
|
*/
|
|
12
12
|
sphere: number[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BVHQueryIntersectsSphere.d.ts","sourceRoot":"","sources":["../../../../../../src/core/bvh2/bvh3/query/BVHQueryIntersectsSphere.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BVHQueryIntersectsSphere.d.ts","sourceRoot":"","sources":["../../../../../../src/core/bvh2/bvh3/query/BVHQueryIntersectsSphere.js"],"names":[],"mappings":"AAUA;IAQI;;;;OAIG;IACH,oBAHW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,yBAWpC;IAnBD;;;OAGG;IACH,QAFU,MAAM,EAAE,CAEC;IAiBnB,wCASC;CACJ;yBAzCwB,eAAe"}
|
|
@@ -1,22 +1,29 @@
|
|
|
1
|
+
import { assert } from "../../../assert.js";
|
|
1
2
|
import { aabb3_array_intersects_sphere_array } from "../../../geom/3d/aabb/aabb3_array_intersects_sphere_array.js";
|
|
2
3
|
import { BVHQuery } from "./BVHQuery.js";
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
/**
|
|
6
|
+
* We read node bounds here
|
|
7
|
+
* @type {Float32Array}
|
|
8
|
+
*/
|
|
9
|
+
const scratch_aabb = new Float32Array(6);
|
|
5
10
|
|
|
6
11
|
export class BVHQueryIntersectsSphere extends BVHQuery {
|
|
7
12
|
|
|
8
13
|
/**
|
|
9
|
-
*
|
|
14
|
+
* [x,y,z,radius]
|
|
10
15
|
* @type {number[]}
|
|
11
16
|
*/
|
|
12
|
-
sphere = [];
|
|
17
|
+
sphere = [0,0,0,0];
|
|
13
18
|
|
|
14
19
|
/**
|
|
15
20
|
*
|
|
16
|
-
* @param {number[]|ArrayLike<number>} sphere
|
|
21
|
+
* @param {number[]|ArrayLike<number>} sphere (x,y,z,radius)
|
|
17
22
|
* @returns {BVHQueryIntersectsRay}
|
|
18
23
|
*/
|
|
19
24
|
static from(sphere) {
|
|
25
|
+
assert.isArrayLike(sphere, 'sphere');
|
|
26
|
+
|
|
20
27
|
const r = new BVHQueryIntersectsSphere();
|
|
21
28
|
|
|
22
29
|
r.sphere = sphere;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/list/List.js"],"names":[],"mappings":";AAQA;;;;;;;GAOG;AACH;IAkDI;;OAEG;IACH,oBAFW,CAAC,EAAE,EAqBb;IAvED;;OAEG;IACH;QACI;;;WAGG;wBADO,OAAO,CAAC,EAAC,MAAM,CAAC;QAG1B;;;WAGG;0BADO,OAAO,CAAC,EAAC,MAAM,CAAC;QAI1B;;;;;WAKG;;MAoBL;IAGF;;;OAGG;IACH,eAFU,CAAC,EAAE,CAEJ;IAkBL;;;OAGG;IACH,QAFU,MAAM,CAEc;IAIlC;;;;OAIG;IACH,WAHW,MAAM,GACJ,CAAC,GAAC,SAAS,CAOvB;IAED;;;;OAIG;IACH,WAHW,MAAM,SACN,CAAC,QAyBX;IAED;;;;OAIG;IACH,QAHW,CAAC,GACC,IAAI,CAUhB;IAED;;;;;;;OAOG;IACH,cAHW,CAAC,GACA,OAAO,CAUlB;IAED;;;;;;;OAOG;IACH,cALW,MAAM,MACN,CAAC,aAoBX;IAED;;;;;OAKG;IACH,sCAFa,MAAM,CAkClB;IAED;;;;;OAKG;IACH,gBAFW,CAAC,EAAE,QAqDb;IAED;;;OAGG;IACH,iBAFW,MAAO,CAAC,CAAC,QAmBnB;IAED
|
|
1
|
+
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/list/List.js"],"names":[],"mappings":";AAQA;;;;;;;GAOG;AACH;IAkDI;;OAEG;IACH,oBAFW,CAAC,EAAE,EAqBb;IAvED;;OAEG;IACH;QACI;;;WAGG;wBADO,OAAO,CAAC,EAAC,MAAM,CAAC;QAG1B;;;WAGG;0BADO,OAAO,CAAC,EAAC,MAAM,CAAC;QAI1B;;;;;WAKG;;MAoBL;IAGF;;;OAGG;IACH,eAFU,CAAC,EAAE,CAEJ;IAkBL;;;OAGG;IACH,QAFU,MAAM,CAEc;IAIlC;;;;OAIG;IACH,WAHW,MAAM,GACJ,CAAC,GAAC,SAAS,CAOvB;IAED;;;;OAIG;IACH,WAHW,MAAM,SACN,CAAC,QAyBX;IAED;;;;OAIG;IACH,QAHW,CAAC,GACC,IAAI,CAUhB;IAED;;;;;;;OAOG;IACH,cAHW,CAAC,GACA,OAAO,CAUlB;IAED;;;;;;;OAOG;IACH,cALW,MAAM,MACN,CAAC,aAoBX;IAED;;;;;OAKG;IACH,sCAFa,MAAM,CAkClB;IAED;;;;;OAKG;IACH,gBAFW,CAAC,EAAE,QAqDb;IAED;;;OAGG;IACH,iBAFW,MAAO,CAAC,CAAC,QAmBnB;IAED;;;;;OAKG;IACH,uBAJW,MAAO,CAAC,CAAC,QAUnB;IAED;;;;;OAKG;IACH,kBAJW,MAAM,eACN,MAAM,GACJ,CAAC,EAAE,CAyBf;IAED;;;;OAIG;IACH,cAHW,MAAM,GACJ,CAAC,CAiBb;IAED;;;;OAIG;IACH,oBAHW,CAAC,EAAE,GACD,OAAO,CAwCnB;IAED;;;;OAIG;IACH,mBAHW,CAAC,GACA,OAAO,CAQlB;IAED;;;;OA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B,CAAC,QAWvB;IAED;;;;OAIG;IACH,QAFa,MAAM,CAgBlB;IAED;;;OAGG;IACH,SAFa,CAAC,GAAC,SAAS,CAIvB;IAED;;;OAGG;IACH,QAFY,CAAC,GAAC,SAAS,CAItB;IAED;;;;OAIG;IACH,0BAFa,OAAO,CAgCnB;IAED;;;;OAIG;IACH,eAHW,KAAK,CAAC,CAAC,GACL,MAAM,CA0BlB;CACJ;mBA3/BkB,+BAA+B"}
|
|
@@ -314,6 +314,8 @@ class List {
|
|
|
314
314
|
/**
|
|
315
315
|
*
|
|
316
316
|
* @param {Array.<T>} elements
|
|
317
|
+
* @see addUnique
|
|
318
|
+
* @see addAll
|
|
317
319
|
*/
|
|
318
320
|
addAllUnique(elements) {
|
|
319
321
|
const length = elements.length;
|
|
@@ -484,6 +486,7 @@ class List {
|
|
|
484
486
|
*
|
|
485
487
|
* @param {function(T):boolean} condition must return boolean value
|
|
486
488
|
* @param {*} [thisArg]
|
|
489
|
+
* @see removeOneIf
|
|
487
490
|
*/
|
|
488
491
|
removeIf(condition, thisArg) {
|
|
489
492
|
assert.isFunction(condition, 'condition');
|
|
@@ -506,6 +509,7 @@ class List {
|
|
|
506
509
|
* @param {function(T):boolean} condition
|
|
507
510
|
* @param {*} [thisArg]
|
|
508
511
|
* @return {boolean}
|
|
512
|
+
* @see removeIf
|
|
509
513
|
*/
|
|
510
514
|
removeOneIf(condition, thisArg) {
|
|
511
515
|
const l = this.length;
|
|
@@ -701,6 +705,9 @@ class List {
|
|
|
701
705
|
throw new Error('deprecated');
|
|
702
706
|
}
|
|
703
707
|
|
|
708
|
+
/**
|
|
709
|
+
* Clears the list and removes all elements
|
|
710
|
+
*/
|
|
704
711
|
reset() {
|
|
705
712
|
const length = this.length;
|
|
706
713
|
if (length > 0) {
|
|
@@ -776,14 +783,18 @@ class List {
|
|
|
776
783
|
* @param {List<T>|T[]} other
|
|
777
784
|
*/
|
|
778
785
|
copy(other) {
|
|
779
|
-
if (this
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
786
|
+
if (this === other) {
|
|
787
|
+
// no point
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
this.reset();
|
|
793
|
+
if (other.length > 0) {
|
|
794
|
+
if (other instanceof List) {
|
|
795
|
+
this.addAll(other.data);
|
|
796
|
+
} else {
|
|
797
|
+
this.addAll(other);
|
|
787
798
|
}
|
|
788
799
|
}
|
|
789
800
|
}
|
|
@@ -904,7 +915,8 @@ class List {
|
|
|
904
915
|
}
|
|
905
916
|
|
|
906
917
|
/**
|
|
907
|
-
* NOTE: Elements must have hash method
|
|
918
|
+
* NOTE: Elements must have `hash` method for this to work
|
|
919
|
+
*
|
|
908
920
|
* @returns {number}
|
|
909
921
|
*/
|
|
910
922
|
hash() {
|
|
@@ -942,6 +954,7 @@ class List {
|
|
|
942
954
|
/**
|
|
943
955
|
* Perform element-wise equality comparison with another list
|
|
944
956
|
* @param {List} other
|
|
957
|
+
* @returns {boolean}
|
|
945
958
|
*/
|
|
946
959
|
equals(other) {
|
|
947
960
|
assert.defined(other, 'other');
|