@woosh/meep-engine 2.117.4 → 2.117.6

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.
@@ -76732,8 +76732,30 @@ function computeTextureEquality(a, b) {
76732
76732
 
76733
76733
  /**
76734
76734
  *
76735
- * @param {Image|[]|{width:number, height:number}} a
76736
- * @param {Image|[]|{width:number, height:number}} b
76735
+ * @param {HTMLCanvasElement} a
76736
+ * @param {HTMLCanvasElement} b
76737
+ * @returns {boolean}
76738
+ */
76739
+ function computeImageCanvasEquality(a, b) {
76740
+ if (
76741
+ a.width !== b.width
76742
+ || a.height !== b.height
76743
+ ) {
76744
+ return false;
76745
+ }
76746
+
76747
+ if (a.toDataURL() !== b.toDataURL()) {
76748
+ // kinda slow, but pretty reliable, as we don't actually know what canvases hold, i.e. webgl, 2d etc.
76749
+ return false;
76750
+ }
76751
+
76752
+ return true;
76753
+ }
76754
+
76755
+ /**
76756
+ *
76757
+ * @param {Image|ImageBitmap|HTMLCanvasElement|[]|{width:number, height:number}} a
76758
+ * @param {Image|ImageBitmap|HTMLCanvasElement|[]|{width:number, height:number}} b
76737
76759
  * @returns {boolean}
76738
76760
  */
76739
76761
  function textureImagesEqual(a, b) {
@@ -76763,7 +76785,11 @@ function textureImagesEqual(a, b) {
76763
76785
  if (isImageBitmap(a) && isImageBitmap(b)) {
76764
76786
 
76765
76787
  return computeImageBitmapEquality(a, b);
76766
-
76788
+
76789
+ }
76790
+
76791
+ if (a instanceof HTMLCanvasElement && b instanceof HTMLCanvasElement) {
76792
+ return computeImageCanvasEquality(a, b);
76767
76793
  }
76768
76794
 
76769
76795
  if (Array.isArray(a) && Array.isArray(b)) {
@@ -76788,16 +76814,15 @@ function textureImagesEqual(a, b) {
76788
76814
  }
76789
76815
  }
76790
76816
 
76817
+ return true;
76791
76818
  }
76792
76819
 
76793
76820
  if (isTypedArray(a.data) && isTypedArray(b.data)) {
76794
- if (!textureMipmapEqual(a, b)) {
76795
- return false;
76796
- }
76821
+ return textureMipmapEqual(a, b);
76797
76822
  }
76798
76823
 
76799
- // assume equivalent
76800
- return true;
76824
+ // assume different
76825
+ return false;
76801
76826
  }
76802
76827
 
76803
76828
  /**
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.117.4",
8
+ "version": "2.117.6",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -32,6 +32,8 @@ export class Color {
32
32
 
33
33
  fromUint(v: number): void
34
34
 
35
+ lerpColors(a: Color, b: Color, f: number): void
36
+
35
37
  equals(other: Color): boolean
36
38
 
37
39
  hash(): number
@@ -94,5 +94,7 @@ export default class Quaternion {
94
94
 
95
95
  asArray(): number[]
96
96
 
97
+ static fromEulerAngles(x:number, y:number, z:number):Quaternion;
98
+
97
99
  static readonly identity: Quaternion
98
100
  }
@@ -7,14 +7,14 @@
7
7
  export function computeTextureEquality(a: Texture, b: Texture): boolean;
8
8
  /**
9
9
  *
10
- * @param {Image|[]|{width:number, height:number}} a
11
- * @param {Image|[]|{width:number, height:number}} b
10
+ * @param {Image|ImageBitmap|HTMLCanvasElement|[]|{width:number, height:number}} a
11
+ * @param {Image|ImageBitmap|HTMLCanvasElement|[]|{width:number, height:number}} b
12
12
  * @returns {boolean}
13
13
  */
14
- export function textureImagesEqual(a: (new (width?: number, height?: number) => HTMLImageElement) | [] | {
14
+ export function textureImagesEqual(a: (new (width?: number, height?: number) => HTMLImageElement) | ImageBitmap | HTMLCanvasElement | [] | {
15
15
  width: number;
16
16
  height: number;
17
- }, b: (new (width?: number, height?: number) => HTMLImageElement) | [] | {
17
+ }, b: (new (width?: number, height?: number) => HTMLImageElement) | ImageBitmap | HTMLCanvasElement | [] | {
18
18
  width: number;
19
19
  height: number;
20
20
  }): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"computeTextureEquality.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/asset/loaders/material/computeTextureEquality.js"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,gEAFa,OAAO,CAoDnB;AAGD;;;;;GAKG;AACH,sCAJW,8DAAM,EAAE,GAAC;IAAC,KAAK,EAAC,MAAM,CAAC;IAAC,MAAM,EAAC,MAAM,CAAA;CAAC,KACtC,8DAAM,EAAE,GAAC;IAAC,KAAK,EAAC,MAAM,CAAC;IAAC,MAAM,EAAC,MAAM,CAAA;CAAC,GACpC,OAAO,CAgEnB"}
1
+ {"version":3,"file":"computeTextureEquality.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/asset/loaders/material/computeTextureEquality.js"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,gEAFa,OAAO,CAoDnB;AAyBD;;;;;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"}
@@ -66,8 +66,30 @@ export function computeTextureEquality(a, b) {
66
66
 
67
67
  /**
68
68
  *
69
- * @param {Image|[]|{width:number, height:number}} a
70
- * @param {Image|[]|{width:number, height:number}} b
69
+ * @param {HTMLCanvasElement} a
70
+ * @param {HTMLCanvasElement} b
71
+ * @returns {boolean}
72
+ */
73
+ function computeImageCanvasEquality(a, b) {
74
+ if (
75
+ a.width !== b.width
76
+ || a.height !== b.height
77
+ ) {
78
+ return false;
79
+ }
80
+
81
+ if (a.toDataURL() !== b.toDataURL()) {
82
+ // kinda slow, but pretty reliable, as we don't actually know what canvases hold, i.e. webgl, 2d etc.
83
+ return false;
84
+ }
85
+
86
+ return true;
87
+ }
88
+
89
+ /**
90
+ *
91
+ * @param {Image|ImageBitmap|HTMLCanvasElement|[]|{width:number, height:number}} a
92
+ * @param {Image|ImageBitmap|HTMLCanvasElement|[]|{width:number, height:number}} b
71
93
  * @returns {boolean}
72
94
  */
73
95
  export function textureImagesEqual(a, b) {
@@ -97,7 +119,11 @@ export function textureImagesEqual(a, b) {
97
119
  if (isImageBitmap(a) && isImageBitmap(b)) {
98
120
 
99
121
  return computeImageBitmapEquality(a, b);
100
-
122
+
123
+ }
124
+
125
+ if (a instanceof HTMLCanvasElement && b instanceof HTMLCanvasElement) {
126
+ return computeImageCanvasEquality(a, b);
101
127
  }
102
128
 
103
129
  if (Array.isArray(a) && Array.isArray(b)) {
@@ -122,16 +148,15 @@ export function textureImagesEqual(a, b) {
122
148
  }
123
149
  }
124
150
 
151
+ return true;
125
152
  }
126
153
 
127
154
  if (isTypedArray(a.data) && isTypedArray(b.data)) {
128
- if (!textureMipmapEqual(a, b)) {
129
- return false;
130
- }
155
+ return textureMipmapEqual(a, b);
131
156
  }
132
157
 
133
- // assume equivalent
134
- return true;
158
+ // assume different
159
+ return false;
135
160
  }
136
161
 
137
162
  /**
@@ -187,7 +187,7 @@ function make_vertex_shader() {
187
187
 
188
188
  float radius = vSize * 0.5;
189
189
 
190
- float projected_radius = resolution.y * projectionMatrix[1][1] * radius / gl_Position.w;;
190
+ float projected_radius = resolution.y * projectionMatrix[1][1] * radius / gl_Position.w;
191
191
 
192
192
  #ifdef DEPTH_SOFT_ENABLED
193
193
 
@@ -1 +1 @@
1
- {"version":3,"file":"RenderGraph.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/RenderGraph.js"],"names":[],"mappings":"AAQA;;;GAGG;AACH;IACI;;;;OAIG;IACH,iBAAc;IAEd;;;;OAIG;IACH,qBAAkB;IAElB;;;;OAIG;IACH,yBAAsB;IAEtB;;;;OAIG;IACH,4BAAyB;IAEzB;;;;OAIG;IACH,qBAHW,MAAM,sBAahB;IAED;;;;OAIG;IACH,oBAHW,MAAM,qBAgBhB;IAED;;;;OAIG;IACH,qBAHW,MAAM,KAKhB;IAED;;;;OAIG;IACH,2BAHW,MAAM,2BAOhB;IAED;;;;;OAKG;IACH,6BAUC;IAED;;;;;;OAMG;IACH,4BAcC;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CAkBlB;IAED;;;;;;OAMG;IACH,2BALW,MAAM,wDAGJ,MAAM,CAUlB;IAED;;;OAGG;IACH,4BAHa,OAAO,CAQnB;IAED;;;;OAIG;IACH,gCA0BC;IAED;;;;;;OAMG;IACH,iEAFa,OAAO,CAOnB;IAED,gBA0FC;IAED;;;OAGG;IACH,uCAqCC;IAED;;;OAGG;IACH,eAFY,MAAM,CAiEjB;CACJ;8BAnb6B,oBAAoB;6BACrB,mBAAmB"}
1
+ {"version":3,"file":"RenderGraph.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/RenderGraph.js"],"names":[],"mappings":"AAQA;;;GAGG;AACH;IACI;;;;OAIG;IACH,iBAAc;IAEd;;;;OAIG;IACH,qBAAkB;IAElB;;;;OAIG;IACH,yBAAsB;IAEtB;;;;OAIG;IACH,4BAAyB;IAEzB;;;;OAIG;IACH,qBAHW,MAAM,sBAahB;IAED;;;;OAIG;IACH,oBAHW,MAAM,qBAgBhB;IAED;;;;OAIG;IACH,qBAHW,MAAM,KAKhB;IAED;;;;OAIG;IACH,2BAHW,MAAM,2BAOhB;IAED;;;;;OAKG;IACH,6BAUC;IAED;;;;;;OAMG;IACH,4BAcC;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CAkBlB;IAED;;;;;;OAMG;IACH,2BALW,MAAM,wDAGJ,MAAM,CAUlB;IAED;;;OAGG;IACH,4BAHa,OAAO,CAQnB;IAED;;;;OAIG;IACH,gCA0BC;IAED;;;;;;OAMG;IACH,iEAFa,OAAO,CAOnB;IAED,gBA6FC;IAED;;;OAGG;IACH,uCA2CC;IAED;;;OAGG;IACH,eAFY,MAAM,CAiEjB;CACJ;8BA5b6B,oBAAoB;6BACrB,mBAAmB"}
@@ -307,14 +307,17 @@ export class RenderGraph {
307
307
  }
308
308
 
309
309
  // calculate lifetimes
310
- for (const pass of pass_nodes) {
310
+ for (let i = 0; i < pass_node_count; i++){
311
+ const pass = pass_nodes[i];
311
312
  if (pass.ref_count === 0) {
312
313
  // unused pass
313
314
  continue;
314
315
  }
315
316
 
316
317
  for (const id of pass.resource_creates) {
317
- this.getResourceEntry(id).producer = pass;
318
+ const entry = this.getResourceEntry(id);
319
+ entry.producer = pass;
320
+ entry.last = pass;
318
321
  }
319
322
 
320
323
  for (const id of pass.resource_writes) {
@@ -360,11 +363,17 @@ export class RenderGraph {
360
363
  // execute pass
361
364
  node.pass.execute(node.data, resources, context);
362
365
 
363
- for (const entry of this.__resource_registry) {
366
+ const resource_entries = this.__resource_registry;
367
+ const resource_entry_count = resource_entries.length;
368
+
369
+ for (let entry_index = 0; entry_index < resource_entry_count; entry_index++){
370
+ const entry = resource_entries[entry_index];
371
+
364
372
  if (entry.last === node && entry.isTransient()) {
365
373
  // this was the last user of the resource and the resource is transient (no external usage)
366
374
  entry.destroy(context.resource_manager);
367
375
  }
376
+
368
377
  }
369
378
 
370
379
  }