@woosh/meep-engine 2.124.3 → 2.124.5

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.124.3",
8
+ "version": "2.124.5",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -1,10 +1,10 @@
1
1
  /**
2
- *
3
- * @param {Texture} a
4
- * @param {Texture} b
2
+ * Compare two three.js textures for equality
3
+ * @param {THREE.Texture} a
4
+ * @param {THREE.Texture} b
5
5
  * @returns {boolean}
6
6
  */
7
- export function computeTextureEquality(a: Texture, b: Texture): boolean;
7
+ export function computeTextureEquality(a: THREE.Texture, b: THREE.Texture): boolean;
8
8
  /**
9
9
  *
10
10
  * @param {Image|ImageBitmap|HTMLCanvasElement|[]|{width:number, height:number}} a
@@ -1 +1 @@
1
- {"version":3,"file":"computeTextureEquality.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/asset/loaders/material/computeTextureEquality.js"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,0CAJW,OAAO,KACP,OAAO,GACL,OAAO,CAoDnB;AAGD;;;;;GAKG;AACH,sCAJW,8DAAM,WAAW,GAAC,iBAAiB,GAAC,EAAE,GAAC;IAAC,KAAK,EAAC,MAAM,CAAC;IAAC,MAAM,EAAC,MAAM,CAAA;CAAC,KACpE,8DAAM,WAAW,GAAC,iBAAiB,GAAC,EAAE,GAAC;IAAC,KAAK,EAAC,MAAM,CAAC;IAAC,MAAM,EAAC,MAAM,CAAA;CAAC,GAClE,OAAO,CAmEnB"}
1
+ {"version":3,"file":"computeTextureEquality.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/asset/loaders/material/computeTextureEquality.js"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,0CAJW,KAAK,CAAC,OAAO,KACb,KAAK,CAAC,OAAO,GACX,OAAO,CA8DnB;AAED;;;;;GAKG;AACH,sCAJW,8DAAM,WAAW,GAAC,iBAAiB,GAAC,EAAE,GAAC;IAAC,KAAK,EAAC,MAAM,CAAC;IAAC,MAAM,EAAC,MAAM,CAAA;CAAC,KACpE,8DAAM,WAAW,GAAC,iBAAiB,GAAC,EAAE,GAAC;IAAC,KAAK,EAAC,MAAM,CAAC;IAAC,MAAM,EAAC,MAAM,CAAA;CAAC,GAClE,OAAO,CA2EnB"}
@@ -1,15 +1,14 @@
1
1
  import { fastArrayEquals } from "../../../../core/collection/array/fastArrayEquals.js";
2
- import { isTypedArray } from "../../../../core/collection/array/typed/isTypedArray.js";
2
+ import { isArrayLike } from "../../../../core/collection/array/isArrayLike.js";
3
3
  import { computeImageCanvasEquality } from "../../../graphics/canvas/computeImageCanvasEquality.js";
4
4
  import { isImageBitmap } from "../../../graphics/texture/isImageBitmap.js";
5
5
  import { computeImageBitmapEquality } from "./computeImageBitmapEquality.js";
6
6
 
7
- //
8
7
 
9
8
  /**
10
- *
11
- * @param {Texture} a
12
- * @param {Texture} b
9
+ * Compare two three.js textures for equality
10
+ * @param {THREE.Texture} a
11
+ * @param {THREE.Texture} b
13
12
  * @returns {boolean}
14
13
  */
15
14
  export function computeTextureEquality(a, b) {
@@ -26,6 +25,14 @@ export function computeTextureEquality(a, b) {
26
25
  return false;
27
26
  }
28
27
 
28
+ // special methods
29
+ if (typeof a.equals === "function" && typeof b.equals === "function") {
30
+ // can check for equality using custom methods
31
+ return a.equals(b);
32
+ }
33
+
34
+ // revert to generic check
35
+
29
36
  if (
30
37
  a.mapping !== b.mapping
31
38
  || a.wrapS !== b.wrapS
@@ -61,10 +68,11 @@ export function computeTextureEquality(a, b) {
61
68
  }
62
69
 
63
70
  //TODO implement support for other texture types
71
+
72
+ // checks up until now were for rejection, so if we got until this point - textures must be equal
64
73
  return true;
65
74
  }
66
75
 
67
-
68
76
  /**
69
77
  *
70
78
  * @param {Image|ImageBitmap|HTMLCanvasElement|[]|{width:number, height:number}} a
@@ -130,7 +138,15 @@ export function textureImagesEqual(a, b) {
130
138
  return true;
131
139
  }
132
140
 
133
- if (isTypedArray(a.data) && isTypedArray(b.data)) {
141
+ const a_data = a.data;
142
+ const b_data = b.data;
143
+
144
+ if (a_data === null && b_data === null) {
145
+ // special case, empty texture
146
+ return true;
147
+ }
148
+
149
+ if (isArrayLike(a_data) && isArrayLike(b_data)) {
134
150
  return textureMipmapEqual(a, b);
135
151
  }
136
152
 
@@ -1 +1 @@
1
- {"version":3,"file":"computeTextureHash.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/asset/loaders/material/computeTextureHash.js"],"names":[],"mappings":"AAyBA;;;;GAIG;AACH,4CAHW,WAAW,GAAC,gBAAgB,GAAC;IAAC,IAAI,MAAC;IAAA,KAAK,EAAC,MAAM,CAAC;IAAA,MAAM,EAAC,MAAM,CAAA;CAAC,GAC7D,MAAM,CA0CjB;AA4CD;;;;GAIG;AACH,sCAHW,OAAO,GAAC,KAAK,CAAC,OAAO,GACnB,MAAM,CAqClB"}
1
+ {"version":3,"file":"computeTextureHash.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/asset/loaders/material/computeTextureHash.js"],"names":[],"mappings":"AA0BA;;;;GAIG;AACH,4CAHW,WAAW,GAAC,gBAAgB,GAAC;IAAC,IAAI,MAAC;IAAA,KAAK,EAAC,MAAM,CAAC;IAAA,MAAM,EAAC,MAAM,CAAA;CAAC,GAC7D,MAAM,CA0CjB;AA4CD;;;;GAIG;AACH,sCAHW,OAAO,GAAC,KAAK,CAAC,OAAO,GACnB,MAAM,CAgDlB"}
@@ -1,3 +1,4 @@
1
+ import { assert } from "../../../../core/assert.js";
1
2
  import { combine_hash } from "../../../../core/collection/array/combine_hash.js";
2
3
  import { murmur3_32 } from "../../../../core/math/hash/murmur3_32.js";
3
4
  import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
@@ -45,7 +46,7 @@ export function computeImageDataHash(image) {
45
46
 
46
47
  result = computeStringHash(image.src);
47
48
 
48
- }else if(image instanceof HTMLCanvasElement) {
49
+ } else if (image instanceof HTMLCanvasElement) {
49
50
 
50
51
  result = computeHtmlCanvasElementHash(image);
51
52
 
@@ -123,9 +124,20 @@ export function computeTextureHash(t) {
123
124
  }
124
125
 
125
126
  if (t === undefined) {
126
- return 0;
127
+ return 1;
128
+ }
129
+
130
+ // special methods
131
+ if (typeof t.hash === "function") {
132
+ const hash = t.hash(); // must produce an integer value
133
+
134
+ assert.isInteger(hash, 'hash');
135
+
136
+ return hash;
127
137
  }
128
138
 
139
+ // revert to generic check
140
+
129
141
  const specificHash = computeSpecificHash(t);
130
142
 
131
143
  return combine_hash(
@@ -14,6 +14,16 @@ export class RenderPassResources {
14
14
  * @private
15
15
  */
16
16
  private __pass;
17
+ /**
18
+ *
19
+ * @return {string}
20
+ */
21
+ get pass_name(): string;
22
+ /**
23
+ *
24
+ * @return {number}
25
+ */
26
+ get pass_id(): number;
17
27
  /**
18
28
  *
19
29
  * @param {RenderGraph} graph
@@ -1 +1 @@
1
- {"version":3,"file":"RenderPassResources.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/RenderPassResources.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IACI;;;;OAIG;IACH,gBAAe;IACf;;;;OAIG;IACH,eAAc;IAEd;;;;OAIG;IACH,YAHW,WAAW,QACX,cAAc,QAKxB;IAED;;;;OAIG;IACH,IAJa,CAAC,MACH,MAAM,GACJ,CAAC,CAYb;IAED;;;;OAIG;IACH,cAJa,CAAC,MACH,MAAM,GACJ,CAAC,CAYb;CACJ"}
1
+ {"version":3,"file":"RenderPassResources.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/RenderPassResources.js"],"names":[],"mappings":"AAEA;;GAEG;AACH;IACI;;;;OAIG;IACH,gBAAe;IACf;;;;OAIG;IACH,eAAc;IAEd;;;OAGG;IACH,iBAFY,MAAM,CAIjB;IAED;;;OAGG;IACH,eAFY,MAAM,CAIjB;IAED;;;;OAIG;IACH,YAHW,WAAW,QACX,cAAc,QAQxB;IAED;;;;OAIG;IACH,IAJa,CAAC,MACH,MAAM,GACJ,CAAC,CAcb;IAED;;;;OAIG;IACH,cAJa,CAAC,MACH,MAAM,GACJ,CAAC,CAcb;CACJ"}
@@ -1,5 +1,3 @@
1
- //
2
-
3
1
  import { assert } from "../../../../core/assert.js";
4
2
 
5
3
  /**
@@ -19,12 +17,31 @@ export class RenderPassResources {
19
17
  */
20
18
  __pass = null;
21
19
 
20
+ /**
21
+ *
22
+ * @return {string}
23
+ */
24
+ get pass_name() {
25
+ return this.__pass.name;
26
+ }
27
+
28
+ /**
29
+ *
30
+ * @return {number}
31
+ */
32
+ get pass_id() {
33
+ return this.__pass.id;
34
+ }
35
+
22
36
  /**
23
37
  *
24
38
  * @param {RenderGraph} graph
25
39
  * @param {RenderPassNode} node
26
40
  */
27
41
  init(graph, node) {
42
+ assert.defined(graph, 'graph');
43
+ assert.defined(node, 'node');
44
+
28
45
  this.__graph = graph;
29
46
  this.__pass = node;
30
47
  }
@@ -35,6 +52,8 @@ export class RenderPassResources {
35
52
  * @returns {T}
36
53
  */
37
54
  get(id) {
55
+ assert.isNonNegativeInteger(id, 'id');
56
+
38
57
  assert.ok(
39
58
  this.__pass.reads(id)
40
59
  || this.__pass.writes(id)
@@ -52,6 +71,8 @@ export class RenderPassResources {
52
71
  * @returns {T}
53
72
  */
54
73
  getDescriptor(id) {
74
+ assert.isNonNegativeInteger(id, 'id');
75
+
55
76
  assert.ok(
56
77
  this.__pass.reads(id)
57
78
  || this.__pass.writes(id)