@woosh/meep-engine 2.92.17 → 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,7 +5,7 @@
5
5
  "description": "Fully featured ECS game engine written in JavaScript",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.92.17",
8
+ "version": "2.92.19",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -4,16 +4,15 @@ interface IBinarySchema {
4
4
  [k: string]: BinaryDataType
5
5
  }
6
6
 
7
-
8
7
  export class DataViewStructAccessor<T extends IBinarySchema> {
9
8
 
10
9
  constructor(type: T, little_endian?: boolean)
11
10
 
12
11
  readonly $record_byte_size: number
13
12
 
14
- this: { [prop in keyof T]: number }
15
-
16
13
  bind(view: DataView, offset: number): void
17
14
 
18
15
  bind_by_index(view: DataView, index: number): void
16
+
17
+ readonly record: { [prop in keyof T]: number }
19
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DataViewStructAccessor.d.ts","sourceRoot":"","sources":["../../../../../src/core/binary/data_view/DataViewStructAccessor.js"],"names":[],"mappings":"AAOA;IAiBI;;;;OAIG;IACH,yCAFW,OAAO,EAiCjB;IApDD;;OAEG;IACH,OAFU,QAAQ,CAEZ;IAEN;;OAEG;IACH,SAFU,MAAM,CAEJ;IAEZ;;;OAGG;IACH,4BAFU,MAAM,CAEM;IAwCtB;;;;OAIG;IACH,gBAHW,QAAQ,eACR,MAAM,QAKhB;IAED;;;;OAIG;IACH,yBAHW,QAAQ,SACR,MAAM,QAKhB;CACJ"}
1
+ {"version":3,"file":"DataViewStructAccessor.d.ts","sourceRoot":"","sources":["../../../../../src/core/binary/data_view/DataViewStructAccessor.js"],"names":[],"mappings":"AAOA;IAiBI;;;;OAIG;IACH,yCAFW,OAAO,EAiCjB;IApDD;;OAEG;IACH,OAFU,QAAQ,CAEZ;IAEN;;OAEG;IACH,SAFU,MAAM,CAEJ;IAEZ;;;OAGG;IACH,4BAFU,MAAM,CAEM;IAwCtB;;;OAGG;IACH,qCAEC;IAED;;;;OAIG;IACH,gBAHW,QAAQ,eACR,MAAM,QAKhB;IAED;;;;OAIG;IACH,yBAHW,QAAQ,SACR,MAAM,QAKhB;CACJ"}
@@ -41,7 +41,7 @@ export class DataViewStructAccessor {
41
41
 
42
42
  assert.enum(type, BinaryDataType, "type");
43
43
 
44
- assert.arrayHasNo(["bind", "$data", "$offset", "this", "constructor"], property, `Illegal property name ${property}`);
44
+ assert.arrayHasNo(["bind", "$data", "$offset", "this", "constructor", "get", "set"], property, `Illegal property name ${property}`);
45
45
 
46
46
  //
47
47
  Object.defineProperty(this, property, {
@@ -60,6 +60,14 @@ export class DataViewStructAccessor {
60
60
  this.$record_byte_size = offset;
61
61
  }
62
62
 
63
+ /**
64
+ * Mainly here for TS interface's type inference
65
+ * @return {DataViewStructAccessor}
66
+ */
67
+ get record() {
68
+ return this;
69
+ }
70
+
63
71
  /**
64
72
  *
65
73
  * @param {DataView} data_view
@@ -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[]}
@@ -87,6 +88,11 @@ export class BinaryElementPool {
87
88
  * @return {number}
88
89
  */
89
90
  get byteSize(): number;
91
+ /**
92
+ * Number of records that the pool can currently contain
93
+ * @return {number}
94
+ */
95
+ get capacity(): number;
90
96
  /**
91
97
  *
92
98
  * @return {Uint32Array}
@@ -1 +1 @@
1
- {"version":3,"file":"BinaryElementPool.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/geom/3d/topology/struct/binary/BinaryElementPool.js"],"names":[],"mappings":"AAwBA;;GAEG;AACH;IAwBI;;;;OAIG;IACH,uBAHW,MAAM,qBACN,MAAM,EAiDhB;IA1ED;;;;OAIG;IACH,eAAY;IAEZ;;;;;OAKG;IACH,uBAAmB;IAEnB;;;;OAIG;IACH,eAAW;IAaP;;;;OAIG;IACH,oBAA4B;IAG5B;;;;OAIG;IACH,sBAA2E;IAC3E;;;;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;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,uBAsBC;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
+ {"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 = new ArrayBuffer(align_4(initial_capacity * item_size));
79
+ this.__data_buffer = makeArrayBuffer(align_4(initial_capacity * item_size), use_shared_buffer);
77
80
  /**
78
81
  *
79
82
  * @type {Uint8Array}
@@ -159,6 +162,14 @@ export class BinaryElementPool {
159
162
  return this.__capacity * this.__item_size;
160
163
  }
161
164
 
165
+ /**
166
+ * Number of records that the pool can currently contain
167
+ * @return {number}
168
+ */
169
+ get capacity() {
170
+ return this.__capacity;
171
+ }
172
+
162
173
 
163
174
  /**
164
175
  *
@@ -246,7 +257,9 @@ export class BinaryElementPool {
246
257
 
247
258
  const aligned_byte_size = align_4(new_capacity * this.__item_size);
248
259
 
249
- const new_data_buffer = new ArrayBuffer(aligned_byte_size);
260
+ const ArrayBufferType = this.__data_buffer.constructor;
261
+
262
+ const new_data_buffer = new ArrayBufferType(aligned_byte_size);
250
263
 
251
264
  this.__data_buffer = new_data_buffer;
252
265
  this.__data_uint8 = new Uint8Array(new_data_buffer);