@woosh/meep-engine 2.131.39 → 2.131.40
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.131.
|
|
8
|
+
"version": "2.131.40",
|
|
9
9
|
"main": "build/meep.module.js",
|
|
10
10
|
"module": "build/meep.module.js",
|
|
11
11
|
"exports": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rgb_to_rgbe9995.d.ts","sourceRoot":"","sources":["../../../../src/core/color/rgb_to_rgbe9995.js"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,mCALW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,
|
|
1
|
+
{"version":3,"file":"rgb_to_rgbe9995.d.ts","sourceRoot":"","sources":["../../../../src/core/color/rgb_to_rgbe9995.js"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,mCALW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CAiDlB"}
|
|
@@ -26,9 +26,14 @@ export function rgb_to_rgbe9995(r, g, b) {
|
|
|
26
26
|
|
|
27
27
|
const cMax = max3(cRed, cGreen, cBlue);
|
|
28
28
|
|
|
29
|
+
if(cMax === 0){
|
|
30
|
+
// perfect black
|
|
31
|
+
return 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
29
34
|
// expp = MAX(-B - 1, log2(maxc)) + 1 + B
|
|
30
35
|
|
|
31
|
-
const expp = Math.max(-B - 1.0, Math.floor(Math.
|
|
36
|
+
const expp = Math.max(-B - 1.0, Math.floor(Math.log2(cMax))) + 1.0 + B;
|
|
32
37
|
|
|
33
38
|
const sMax = Math.floor((cMax / Math.pow(2.0, expp - B - N)) + 0.5);
|
|
34
39
|
|
|
@@ -38,14 +43,17 @@ export function rgb_to_rgbe9995(r, g, b) {
|
|
|
38
43
|
exps = expp;
|
|
39
44
|
}
|
|
40
45
|
|
|
41
|
-
const
|
|
42
|
-
const sGreen = Math.floor((cGreen / Math.pow(2.0, exps - B - N)) + 0.5) >>> 0;
|
|
43
|
-
const sBlue = Math.floor((cBlue / Math.pow(2.0, exps - B - N)) + 0.5) >>> 0;
|
|
46
|
+
const denominator = Math.pow(2.0, exps - B - N);
|
|
44
47
|
|
|
45
|
-
|
|
48
|
+
const sRed = Math.floor((cRed / denominator) + 0.5) >>> 0;
|
|
49
|
+
const sGreen = Math.floor((cGreen / denominator) + 0.5) >>> 0;
|
|
50
|
+
const sBlue = Math.floor((cBlue / denominator) + 0.5) >>> 0;
|
|
51
|
+
|
|
52
|
+
const result = (sRed & 0x1FF)
|
|
46
53
|
| ((sGreen & 0x1FF) << 9)
|
|
47
54
|
| ((sBlue & 0x1FF) << 18)
|
|
48
|
-
| ((exps & 0x1F) << 27)
|
|
49
|
-
|
|
55
|
+
| ((exps & 0x1F) << 27);
|
|
56
|
+
|
|
57
|
+
return result >>> 0; // force Uint32
|
|
50
58
|
|
|
51
59
|
}
|