@woosh/meep-engine 2.128.2 → 2.128.3
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/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.3",
|
|
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;
|