@woosh/meep-engine 2.92.18 → 2.92.19
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
|
@@ -5,9 +5,10 @@ export class BinaryElementPool {
|
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
7
7
|
* @param {number} item_size in bytes
|
|
8
|
-
* @param {number} initial_capacity how many items to reverse in the newly created pool
|
|
8
|
+
* @param {number} [initial_capacity] how many items to reverse in the newly created pool
|
|
9
|
+
* @param {boolean} [use_shared_buffer]
|
|
9
10
|
*/
|
|
10
|
-
constructor(item_size: number, initial_capacity?: number);
|
|
11
|
+
constructor(item_size: number, initial_capacity?: number, use_shared_buffer?: boolean);
|
|
11
12
|
/**
|
|
12
13
|
* Unused slots
|
|
13
14
|
* @type {number[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BinaryElementPool.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/geom/3d/topology/struct/binary/BinaryElementPool.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BinaryElementPool.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/geom/3d/topology/struct/binary/BinaryElementPool.js"],"names":[],"mappings":"AAyBA;;GAEG;AACH;IAwBI;;;;;OAKG;IACH,uBAJW,MAAM,qBACN,MAAM,sBACN,OAAO,EAkDjB;IA5ED;;;;OAIG;IACH,eAAY;IAEZ;;;;;OAKG;IACH,uBAAmB;IAEnB;;;;OAIG;IACH,eAAW;IAeP;;;;OAIG;IACH,oBAA4B;IAG5B;;;;OAIG;IACH,sBAA8F;IAC9F;;;;OAIG;IACH,qBAAsD;IACtD;;;;OAIG;IACH,sBAAwD;IACxD;;;;OAIG;IACH,uBAA0D;IAC1D,oBAAiD;IAEjD;;;;OAIG;IACH,mBAAkC;IAItC;;;;OAIG;IACH,wBAHW,WAAW,2BACX,MAAM,QAsBhB;IAED,+BAEC;IAED;;;OAGG;IACH,wBAEC;IAED;;;;OAIG;IACH,mBAEC;IAED;;;OAGG;IACH,uBAEC;IAED;;;OAGG;IACH,uBAEC;IAGD;;;OAGG;IACH,+BAEC;IAED;;;OAGG;IACH,iCAEC;IAED;;OAEG;IACH,aAEC;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACL,MAAM,CAMjB;IAED;;;;;OAKG;IACH,iBAHW,MAAM,GACL,MAAM,CAIjB;IAED;;;;OAIG;IACH,iBAHW,MAAM,GACL,OAAO,CAsBlB;IAED;;;;OAIG;IACH,uBAwBC;IAED;;;;OAIG;IACH,wBAQC;IAED;;;OAGG;IACH,0BAFW,MAAM,QAMhB;IAGD;;;OAGG;IACH,YAFY,MAAM,CAqBjB;IAED;;;;OAIG;IACH,2BAHW,MAAM,GACL,MAAM,CAcjB;IAED;;;;OAIG;IACH,YAFW,MAAM,QAYhB;IAED;;OAEG;IACH,cAGC;CACJ"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { assert } from "../../../../../assert.js";
|
|
2
2
|
import { align_4 } from "../../../../../binary/align_4.js";
|
|
3
|
+
import { makeArrayBuffer } from "../../../../../binary/makeArrayBuffer.js";
|
|
3
4
|
import { typed_array_copy } from "../../../../../collection/array/typed/typed_array_copy.js";
|
|
4
5
|
import { max3 } from "../../../../../math/max3.js";
|
|
5
6
|
|
|
@@ -52,13 +53,15 @@ export class BinaryElementPool {
|
|
|
52
53
|
/**
|
|
53
54
|
*
|
|
54
55
|
* @param {number} item_size in bytes
|
|
55
|
-
* @param {number} initial_capacity how many items to reverse in the newly created pool
|
|
56
|
+
* @param {number} [initial_capacity] how many items to reverse in the newly created pool
|
|
57
|
+
* @param {boolean} [use_shared_buffer]
|
|
56
58
|
*/
|
|
57
|
-
constructor(item_size, initial_capacity = INITIAL_CAPACITY) {
|
|
59
|
+
constructor(item_size, initial_capacity = INITIAL_CAPACITY, use_shared_buffer = false) {
|
|
58
60
|
assert.isNonNegativeInteger(item_size, 'item_size');
|
|
59
61
|
assert.greaterThan(item_size, 0, 'item_size must be greater than 0');
|
|
60
62
|
|
|
61
63
|
assert.isNonNegativeInteger(initial_capacity, 'initial_capacity');
|
|
64
|
+
assert.isBoolean(use_shared_buffer, 'use_shared_buffer');
|
|
62
65
|
|
|
63
66
|
/**
|
|
64
67
|
* Size of a single pool item in bytes
|
|
@@ -73,7 +76,7 @@ export class BinaryElementPool {
|
|
|
73
76
|
* @type {ArrayBuffer}
|
|
74
77
|
* @private
|
|
75
78
|
*/
|
|
76
|
-
this.__data_buffer =
|
|
79
|
+
this.__data_buffer = makeArrayBuffer(align_4(initial_capacity * item_size), use_shared_buffer);
|
|
77
80
|
/**
|
|
78
81
|
*
|
|
79
82
|
* @type {Uint8Array}
|
|
@@ -254,7 +257,9 @@ export class BinaryElementPool {
|
|
|
254
257
|
|
|
255
258
|
const aligned_byte_size = align_4(new_capacity * this.__item_size);
|
|
256
259
|
|
|
257
|
-
const
|
|
260
|
+
const ArrayBufferType = this.__data_buffer.constructor;
|
|
261
|
+
|
|
262
|
+
const new_data_buffer = new ArrayBufferType(aligned_byte_size);
|
|
258
263
|
|
|
259
264
|
this.__data_buffer = new_data_buffer;
|
|
260
265
|
this.__data_uint8 = new Uint8Array(new_data_buffer);
|