@woosh/meep-engine 2.117.3 → 2.117.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/build/meep.cjs CHANGED
@@ -76734,8 +76734,30 @@ function computeTextureEquality(a, b) {
76734
76734
 
76735
76735
  /**
76736
76736
  *
76737
- * @param {Image|[]|{width:number, height:number}} a
76738
- * @param {Image|[]|{width:number, height:number}} b
76737
+ * @param {HTMLCanvasElement} a
76738
+ * @param {HTMLCanvasElement} b
76739
+ * @returns {boolean}
76740
+ */
76741
+ function computeImageCanvasEquality(a, b) {
76742
+ if (
76743
+ a.width !== b.width
76744
+ || a.height !== b.height
76745
+ ) {
76746
+ return false;
76747
+ }
76748
+
76749
+ if (a.toDataURL() !== b.toDataURL()) {
76750
+ // kinda slow, but pretty reliable, as we don't actually know what canvases hold, i.e. webgl, 2d etc.
76751
+ return false;
76752
+ }
76753
+
76754
+ return true;
76755
+ }
76756
+
76757
+ /**
76758
+ *
76759
+ * @param {Image|ImageBitmap|HTMLCanvasElement|[]|{width:number, height:number}} a
76760
+ * @param {Image|ImageBitmap|HTMLCanvasElement|[]|{width:number, height:number}} b
76739
76761
  * @returns {boolean}
76740
76762
  */
76741
76763
  function textureImagesEqual(a, b) {
@@ -76765,7 +76787,11 @@ function textureImagesEqual(a, b) {
76765
76787
  if (isImageBitmap(a) && isImageBitmap(b)) {
76766
76788
 
76767
76789
  return computeImageBitmapEquality(a, b);
76768
-
76790
+
76791
+ }
76792
+
76793
+ if (a instanceof HTMLCanvasElement && b instanceof HTMLCanvasElement) {
76794
+ return computeImageCanvasEquality(a, b);
76769
76795
  }
76770
76796
 
76771
76797
  if (Array.isArray(a) && Array.isArray(b)) {
@@ -76790,16 +76816,15 @@ function textureImagesEqual(a, b) {
76790
76816
  }
76791
76817
  }
76792
76818
 
76819
+ return true;
76793
76820
  }
76794
76821
 
76795
76822
  if (isTypedArray(a.data) && isTypedArray(b.data)) {
76796
- if (!textureMipmapEqual(a, b)) {
76797
- return false;
76798
- }
76823
+ return textureMipmapEqual(a, b);
76799
76824
  }
76800
76825
 
76801
- // assume equivalent
76802
- return true;
76826
+ // assume different
76827
+ return false;
76803
76828
  }
76804
76829
 
76805
76830
  /**