@woosh/meep-engine 2.126.5 → 2.126.7

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": "Pure JavaScript game engine. Fully featured and production ready.",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.126.5",
8
+ "version": "2.126.7",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -1,5 +1,8 @@
1
1
  export default BinaryBufferDeSerializer;
2
- declare class BinaryBufferDeSerializer {
2
+ /**
3
+ * @template CTX
4
+ */
5
+ declare class BinaryBufferDeSerializer<CTX> {
3
6
  /**
4
7
  *
5
8
  * @type {BinarySerializationRegistry}
@@ -8,11 +11,11 @@ declare class BinaryBufferDeSerializer {
8
11
  /**
9
12
  *
10
13
  * @param {BinaryBuffer} buffer
11
- * @param {Engine} engine
14
+ * @param {CTX} context
12
15
  * @param {EntityComponentDataset} dataset
13
16
  * @returns {Task}
14
17
  */
15
- process(buffer: BinaryBuffer, engine: Engine, dataset: EntityComponentDataset): Task;
18
+ process(buffer: BinaryBuffer, context: CTX, dataset: EntityComponentDataset): Task;
16
19
  }
17
20
  import Task from "../../../core/process/task/Task.js";
18
21
  //# sourceMappingURL=BinaryBufferDeSerializer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BinaryBufferDeSerializer.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/storage/BinaryBufferDeSerializer.js"],"names":[],"mappings":";AAQA;IACI;;;OAGG;IACH,UAFU,2BAA2B,CAErB;IAEhB;;;;;;OAMG;IACH,gBALW,YAAY,UACZ,MAAM,WACN,sBAAsB,GACpB,IAAI,CA8BhB;CACJ;iBAjDgB,oCAAoC"}
1
+ {"version":3,"file":"BinaryBufferDeSerializer.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/storage/BinaryBufferDeSerializer.js"],"names":[],"mappings":";AAQA;;GAEG;AACH,uCAFa,GAAG;IAGZ;;;OAGG;IACH,UAFU,2BAA2B,CAErB;IAEhB;;;;;;OAMG;IACH,gBALW,YAAY,WACZ,GAAG,WACH,sBAAsB,GACpB,IAAI,CA+BhB;CACJ;iBArDgB,oCAAoC"}
@@ -6,6 +6,9 @@ import { emptyTask } from "../../../core/process/task/util/emptyTask.js";
6
6
  import { BinaryCollectionDeSerializer } from "./binary/collection/BinaryCollectionDeSerializer.js";
7
7
  import { BinaryObjectSerializationAdapter } from "./binary/object/BinaryObjectSerializationAdapter.js";
8
8
 
9
+ /**
10
+ * @template CTX
11
+ */
9
12
  class BinaryBufferDeSerializer {
10
13
  /**
11
14
  *
@@ -16,17 +19,18 @@ class BinaryBufferDeSerializer {
16
19
  /**
17
20
  *
18
21
  * @param {BinaryBuffer} buffer
19
- * @param {Engine} engine
22
+ * @param {CTX} context
20
23
  * @param {EntityComponentDataset} dataset
21
24
  * @returns {Task}
22
25
  */
23
- process(buffer, engine, dataset) {
24
- assert.notEqual(buffer, undefined, 'buffer is undefined');
25
- assert.notEqual(engine, undefined, 'engine is undefined');
26
- assert.notEqual(dataset, undefined, 'dataset is undefined');
26
+ process(buffer, context, dataset) {
27
+ assert.defined(buffer, 'buffer');
28
+ assert.defined(context, 'context');
29
+ assert.defined(dataset, 'dataset');
27
30
 
28
31
  const entity_count_before = dataset.entityCount;
29
32
 
33
+ // Not currently handled, intended for format version control
30
34
  const version = buffer.readUint16();
31
35
  const numSerializedTypes = buffer.readUint16();
32
36
 
@@ -35,7 +39,7 @@ class BinaryBufferDeSerializer {
35
39
  //return NO-OP equivalent of a task
36
40
  task = emptyTask();
37
41
  } else {
38
- task = deserializeTask(numSerializedTypes, buffer, engine, dataset, this.registry);
42
+ task = deserializeTask(numSerializedTypes, buffer, context, dataset, this.registry);
39
43
  }
40
44
 
41
45
  task.on.completed.add(function () {
@@ -52,10 +56,10 @@ class BinaryBufferDeSerializer {
52
56
  }
53
57
 
54
58
  /**
55
- *
59
+ * @template CTX
56
60
  * @param {number} numSerializedTypes
57
61
  * @param {BinaryBuffer} buffer
58
- * @param {Engine} engine
62
+ * @param {CTX} context
59
63
  * @param {EntityComponentDataset} dataset
60
64
  * @param {BinarySerializationRegistry}registry
61
65
  * @returns {Task}
@@ -63,13 +67,13 @@ class BinaryBufferDeSerializer {
63
67
  function deserializeTask(
64
68
  numSerializedTypes,
65
69
  buffer,
66
- engine,
70
+ context,
67
71
  dataset,
68
72
  registry
69
73
  ) {
70
74
 
71
- assert.defined(engine, 'engine');
72
- assert.ok(engine.isEngine, 'is not Engine');
75
+ assert.defined(context, 'context');
76
+ assert.notNull(context, 'context');
73
77
 
74
78
 
75
79
  let typesDecoded = 0;
@@ -117,7 +121,7 @@ function deserializeTask(
117
121
  * @param {BinaryClassSerializationAdapter} adapter
118
122
  */
119
123
  adapterOptionsSupplier(className, klass, adapter) {
120
- return [engine, objectAdapter];
124
+ return [context, objectAdapter];
121
125
  }
122
126
  });
123
127
  } catch (e) {
@@ -1 +1 @@
1
- {"version":3,"file":"BinaryBufferSerializer.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/storage/BinaryBufferSerializer.js"],"names":[],"mappings":";AAmDA;IACI;;;OAGG;IACH,UAFU,2BAA2B,CAErB;IAEhB;;;OAGG;IACH,QAFU,MAAM,GAAC,IAAI,CAEP;IAEd;;;;OAIG;IACH,gBAFW,YAAY,WADZ,sBAAsB,QA0HhC;CACJ"}
1
+ {"version":3,"file":"BinaryBufferSerializer.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/storage/BinaryBufferSerializer.js"],"names":[],"mappings":";AAmDA;IACI;;;OAGG;IACH,UAFU,2BAA2B,CAErB;IAEhB;;;OAGG;IACH,QAFU,MAAM,GAAC,IAAI,CAEP;IAEd;;;;OAIG;IACH,gBAFW,YAAY,WADZ,sBAAsB,QA6HhC;CACJ"}
@@ -55,7 +55,7 @@ class BinaryBufferSerializer {
55
55
  * @type {BinarySerializationRegistry}
56
56
  */
57
57
  registry = null;
58
-
58
+
59
59
  /**
60
60
  *
61
61
  * @type {Engine|null}
@@ -81,7 +81,10 @@ class BinaryBufferSerializer {
81
81
 
82
82
  const typeCountAddress = buffer.position;
83
83
 
84
- buffer.writeUint32(numSerializableTypes);
84
+ const FORMAT_VERSION = 0;
85
+
86
+ buffer.writeUint16(FORMAT_VERSION)
87
+ buffer.writeUint16(numSerializableTypes);
85
88
 
86
89
  const collectionSerializer = new BinaryCollectionSerializer();
87
90