@woosh/meep-engine 2.34.3 → 2.34.4
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.
|
@@ -88,9 +88,15 @@ test('replaceAnotherVertex', () => {
|
|
|
88
88
|
v_b.addEdge(e_b);
|
|
89
89
|
|
|
90
90
|
f_a.setVertexAt(0, v_a);
|
|
91
|
+
f_a.setVertexAt(1, new TopoVertex());
|
|
92
|
+
f_a.setVertexAt(2, new TopoVertex());
|
|
93
|
+
|
|
91
94
|
e_a.v0 = v_a;
|
|
92
95
|
|
|
93
96
|
f_b.setVertexAt(0, v_b);
|
|
97
|
+
f_b.setVertexAt(1, new TopoVertex());
|
|
98
|
+
f_b.setVertexAt(2, new TopoVertex());
|
|
99
|
+
|
|
94
100
|
e_b.v0 = v_b;
|
|
95
101
|
|
|
96
102
|
// verify assumptions about topology
|
|
@@ -41,6 +41,12 @@ export class ImageRGBADataLoader extends AssetLoader {
|
|
|
41
41
|
return await this.decoder.decode(new Uint8Array(array_buffer));
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @param {String} path
|
|
47
|
+
* @return {Promise<ImageRGBADataAsset>}
|
|
48
|
+
* @private
|
|
49
|
+
*/
|
|
44
50
|
async __standard(path) {
|
|
45
51
|
|
|
46
52
|
const bitmap = await this.__decode_via_worker(path);
|
|
@@ -48,19 +54,19 @@ export class ImageRGBADataLoader extends AssetLoader {
|
|
|
48
54
|
|
|
49
55
|
let data;
|
|
50
56
|
|
|
51
|
-
|
|
52
|
-
case 8:
|
|
57
|
+
const bitDepth = bitmap.bitDepth;
|
|
53
58
|
|
|
59
|
+
switch (bitDepth) {
|
|
60
|
+
case 8:
|
|
54
61
|
data = new Uint8Array(bitmap.data);
|
|
55
62
|
break
|
|
56
63
|
case 16:
|
|
57
64
|
data = new Uint16Array(bitmap.data);
|
|
58
65
|
break;
|
|
59
66
|
default:
|
|
60
|
-
throw new Error(`Unsupported bit depth '${
|
|
67
|
+
throw new Error(`Unsupported bit depth '${bitDepth}'. path='${path}'`);
|
|
61
68
|
}
|
|
62
69
|
|
|
63
|
-
|
|
64
70
|
return new ImageRGBADataAsset(data, bitmap.width, bitmap.height, bitmap.itemSize);
|
|
65
71
|
}
|
|
66
72
|
|
|
@@ -2,7 +2,7 @@ import { Codec } from "./Codec.js";
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
|
-
* @param {Image|ImageBitmap} img
|
|
5
|
+
* @param {Image|ImageBitmap|HTMLImageElement} img
|
|
6
6
|
* @returns {Uint8Array}
|
|
7
7
|
*/
|
|
8
8
|
function decode(img) {
|
|
@@ -28,10 +28,12 @@ export class NativeImageDecoder extends Codec {
|
|
|
28
28
|
async decode(data) {
|
|
29
29
|
const image = new Image();
|
|
30
30
|
|
|
31
|
+
// convert binary data to image URL that we can load
|
|
31
32
|
const url = URL.createObjectURL(new Blob([data]));
|
|
32
33
|
|
|
33
34
|
image.src = url;
|
|
34
35
|
|
|
36
|
+
// give browser a chance to decode image in async
|
|
35
37
|
await image.decode();
|
|
36
38
|
|
|
37
39
|
const rgba_data = decode(image);
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"productName": "Meep",
|
|
6
6
|
"description": "production-ready JavaScript game engine based on Entity Component System Architecture",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.34.
|
|
8
|
+
"version": "2.34.4",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"gl-matrix": "3.4.3",
|
|
11
11
|
"fast-levenshtein": "2.0.6",
|