@woosh/meep-engine 2.34.6 → 2.34.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.
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Transfer bitmap contents to Sampler2D, effectively moving data to CPU, making it readable
|
|
3
3
|
* @param {WebGL2RenderingContext} gl
|
|
4
4
|
* @param {Sampler2D} sampler
|
|
5
|
-
* @param {ImageBitmap} bitmap
|
|
5
|
+
* @param {ImageBitmap|ImageData|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} bitmap
|
|
6
6
|
*/
|
|
7
7
|
export function bitmap2sampler_gl(gl, sampler, bitmap) {
|
|
8
8
|
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, bitmap);
|
|
@@ -15,5 +15,11 @@ export function bitmap2sampler_gl(gl, sampler, bitmap) {
|
|
|
15
15
|
throw new Error(`Expected sampler.itemSize to be 4, instead was '${sampler.itemSize}'`);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @type {Uint8ClampedArray}
|
|
21
|
+
*/
|
|
22
|
+
const target_data = sampler.data;
|
|
23
|
+
|
|
24
|
+
gl.readPixels(0, 0, w, h, gl.RGBA, gl.UNSIGNED_BYTE, target_data);
|
|
19
25
|
}
|
|
@@ -2,6 +2,7 @@ import { computeImageBitmapHash } from "./computeImageBitmapHash.js";
|
|
|
2
2
|
import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
|
|
3
3
|
import { computeHashFloat } from "../../../../core/math/hash/computeHashFloat.js";
|
|
4
4
|
import { murmur3_32 } from "../../../../core/math/hash/murmur3_32.js";
|
|
5
|
+
import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
*
|
|
@@ -20,6 +21,11 @@ function vector2Hash(v) {
|
|
|
20
21
|
*/
|
|
21
22
|
const data_cache = new WeakMap();
|
|
22
23
|
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @param {ImageBitmap|HTMLImageElement|{data,width:number,height:number}} image
|
|
27
|
+
* @return {number}
|
|
28
|
+
*/
|
|
23
29
|
export function computeImageDataHash(image) {
|
|
24
30
|
const cached_value = data_cache.get(image);
|
|
25
31
|
|
|
@@ -31,6 +37,8 @@ export function computeImageDataHash(image) {
|
|
|
31
37
|
|
|
32
38
|
if (image instanceof ImageBitmap) {
|
|
33
39
|
result = computeImageBitmapHash(image);
|
|
40
|
+
} else if (image instanceof HTMLImageElement) {
|
|
41
|
+
result = computeStringHash(image.src);
|
|
34
42
|
}
|
|
35
43
|
|
|
36
44
|
let width = 0;
|
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.7",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"gl-matrix": "3.4.3",
|
|
11
11
|
"fast-levenshtein": "2.0.6",
|