@woosh/meep-engine 2.98.0 → 2.98.1

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.
Files changed (45) hide show
  1. package/build/meep.cjs +33 -10
  2. package/build/meep.min.js +1 -1
  3. package/build/meep.module.js +33 -10
  4. package/package.json +1 -1
  5. package/src/core/collection/set/compute_set_difference.d.ts.map +1 -1
  6. package/src/core/collection/set/compute_set_difference.js +8 -0
  7. package/src/core/collection/set/compute_set_difference.spec.d.ts +2 -0
  8. package/src/core/collection/set/compute_set_difference.spec.d.ts.map +1 -0
  9. package/src/core/collection/set/compute_set_difference.spec.js +45 -0
  10. package/src/core/collection/set/compute_set_intersection.d.ts +1 -0
  11. package/src/core/collection/set/compute_set_intersection.d.ts.map +1 -1
  12. package/src/core/collection/set/compute_set_intersection.js +9 -0
  13. package/src/core/collection/set/compute_set_intersection.spec.d.ts +2 -0
  14. package/src/core/collection/set/compute_set_intersection.spec.d.ts.map +1 -0
  15. package/src/core/collection/set/compute_set_intersection.spec.js +45 -0
  16. package/src/core/collection/set/set_remove.d.ts +2 -0
  17. package/src/core/collection/set/set_remove.d.ts.map +1 -1
  18. package/src/core/collection/set/set_remove.js +2 -0
  19. package/src/core/color/oklab/XYZ.spec.d.ts +2 -0
  20. package/src/core/color/oklab/XYZ.spec.d.ts.map +1 -0
  21. package/src/core/color/oklab/XYZ.spec.js +17 -0
  22. package/src/core/color/oklab/oklab_to_xyz.d.ts +9 -0
  23. package/src/core/color/oklab/oklab_to_xyz.d.ts.map +1 -0
  24. package/src/core/color/oklab/oklab_to_xyz.js +32 -0
  25. package/src/core/color/oklab/oklab_to_xyz.spec.d.ts +2 -0
  26. package/src/core/color/oklab/oklab_to_xyz.spec.d.ts.map +1 -0
  27. package/src/core/color/oklab/oklab_to_xyz.spec.js +31 -0
  28. package/src/core/color/oklab/xyz_to_oklab.d.ts +8 -0
  29. package/src/core/color/oklab/xyz_to_oklab.d.ts.map +1 -0
  30. package/src/core/color/oklab/xyz_to_oklab.js +29 -0
  31. package/src/core/color/oklab/xyz_to_oklab.spec.d.ts +2 -0
  32. package/src/core/color/oklab/xyz_to_oklab.spec.d.ts.map +1 -0
  33. package/src/core/color/oklab/xyz_to_oklab.spec.js +31 -0
  34. package/src/core/color/sRGB/linear_to_sRGB.d.ts.map +1 -1
  35. package/src/core/color/sRGB/linear_to_sRGB.js +16 -5
  36. package/src/core/color/sRGB/sRGB_to_linear.d.ts.map +1 -1
  37. package/src/core/color/sRGB/sRGB_to_linear.js +17 -5
  38. package/src/core/color/xyz/rgb_to_xyz.d.ts +1 -0
  39. package/src/core/color/xyz/rgb_to_xyz.d.ts.map +1 -1
  40. package/src/core/color/xyz/rgb_to_xyz.js +4 -3
  41. package/src/core/color/xyz/xyz_to_rgb.d.ts +1 -1
  42. package/src/core/color/xyz/xyz_to_rgb.js +4 -4
  43. package/src/core/color/hsluv/HSLuv.d.ts +0 -13
  44. package/src/core/color/hsluv/HSLuv.d.ts.map +0 -1
  45. package/src/core/color/hsluv/HSLuv.js +0 -187
@@ -53631,7 +53631,11 @@ function rgb2uint24(r, g, b) {
53631
53631
  }
53632
53632
 
53633
53633
  function convert(c) {
53634
- return (c < 0.0031308) ? c * 12.92 : 1.055 * (Math.pow(c, 0.41666)) - 0.055;
53634
+ if (c < 0.0031308) {
53635
+ return c * 12.92;
53636
+ } else {
53637
+ return 1.055 * (Math.pow(c, 0.4166666666666667)) - 0.055;
53638
+ }
53635
53639
  }
53636
53640
 
53637
53641
  /**
@@ -53641,10 +53645,17 @@ function convert(c) {
53641
53645
  * @param {number[]|ArrayLike<number>} input
53642
53646
  * @param {number} input_offset
53643
53647
  */
53644
- function linear_to_sRGB(output, output_offset, input, input_offset) {
53645
- output[output_offset] = convert(input[input_offset]);
53646
- output[output_offset + 1] = convert(input[input_offset + 1]);
53647
- output[output_offset + 2] = convert(input[input_offset + 2]);
53648
+ function linear_to_sRGB(
53649
+ output, output_offset,
53650
+ input, input_offset
53651
+ ) {
53652
+ const r = input[input_offset];
53653
+ const g = input[input_offset + 1];
53654
+ const b = input[input_offset + 2];
53655
+
53656
+ output[output_offset] = convert(r);
53657
+ output[output_offset + 1] = convert(g);
53658
+ output[output_offset + 2] = convert(b);
53648
53659
  }
53649
53660
 
53650
53661
  /**
@@ -53653,7 +53664,11 @@ function linear_to_sRGB(output, output_offset, input, input_offset) {
53653
53664
  * @return {number|number}
53654
53665
  */
53655
53666
  function convert_channel_sRGB_to_linear(c) {
53656
- return (c < 0.04045) ? c * 0.0773993808 : Math.pow(c * 0.9478672986 + 0.0521327014, 2.4);
53667
+ if (c < 0.04045) {
53668
+ return c * 0.0773993808;
53669
+ } else {
53670
+ return Math.pow(c * 0.9478672986 + 0.0521327014, 2.4);
53671
+ }
53657
53672
  }
53658
53673
 
53659
53674
  /**
@@ -53663,10 +53678,18 @@ function convert_channel_sRGB_to_linear(c) {
53663
53678
  * @param {number[]} input
53664
53679
  * @param {number} input_offset
53665
53680
  */
53666
- function sRGB_to_linear(output, output_offset, input, input_offset) {
53667
- output[output_offset] = convert_channel_sRGB_to_linear(input[input_offset]);
53668
- output[output_offset + 1] = convert_channel_sRGB_to_linear(input[input_offset + 1]);
53669
- output[output_offset + 2] = convert_channel_sRGB_to_linear(input[input_offset + 2]);
53681
+ function sRGB_to_linear(
53682
+ output, output_offset,
53683
+ input, input_offset
53684
+ ) {
53685
+
53686
+ const sR = input[input_offset];
53687
+ const sG = input[input_offset + 1];
53688
+ const sB = input[input_offset + 2];
53689
+
53690
+ output[output_offset] = convert_channel_sRGB_to_linear(sR);
53691
+ output[output_offset + 1] = convert_channel_sRGB_to_linear(sG);
53692
+ output[output_offset + 2] = convert_channel_sRGB_to_linear(sB);
53670
53693
  }
53671
53694
 
53672
53695
  /**
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.98.0",
8
+ "version": "2.98.1",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -1 +1 @@
1
- {"version":3,"file":"compute_set_difference.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/set/compute_set_difference.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,0EAyBC"}
1
+ {"version":3,"file":"compute_set_difference.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/set/compute_set_difference.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,0EA+BC"}
@@ -1,3 +1,5 @@
1
+ import { assert } from "../../assert.js";
2
+
1
3
  /**
2
4
  * @template T
3
5
  * @returns Set<T>
@@ -5,6 +7,12 @@
5
7
  * @param {Set<T>} b
6
8
  */
7
9
  export function compute_set_difference(a, b) {
10
+ assert.defined(a, 'a');
11
+ assert.defined(b, 'b');
12
+
13
+ assert.isInstanceOf(a, Set, 'a');
14
+ assert.isInstanceOf(b, Set, 'b');
15
+
8
16
  const result = new Set();
9
17
 
10
18
  const a_array = Array.from(a);
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=compute_set_difference.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compute_set_difference.spec.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/set/compute_set_difference.spec.js"],"names":[],"mappings":""}
@@ -0,0 +1,45 @@
1
+ import { compute_set_difference } from "./compute_set_difference.js";
2
+
3
+ /**
4
+ * @template T
5
+ * @param {T[]} a
6
+ * @param {T[]} b
7
+ * @return {T[]}
8
+ */
9
+ function using_arrays(a, b) {
10
+ return Array.from(compute_set_difference(new Set(a), new Set(b))).sort();
11
+ }
12
+
13
+ test("empty sets", () => {
14
+
15
+ expect(using_arrays([], [])).toEqual([]);
16
+
17
+ });
18
+
19
+ test("empty and single element", () => {
20
+
21
+ expect(using_arrays([1], [])).toEqual([1]);
22
+ expect(using_arrays([], [1])).toEqual([1]);
23
+
24
+ });
25
+
26
+ test("no difference", () => {
27
+
28
+ expect(using_arrays([1, 2, 3], [1, 2, 3])).toEqual([]);
29
+ expect(using_arrays([1, 2, 3], [2, 3, 1])).toEqual([]);
30
+ expect(using_arrays([1, 2, 3], [3, 1, 2])).toEqual([]);
31
+ expect(using_arrays([1, 2, 3], [3, 2, 1])).toEqual([]);
32
+ expect(using_arrays([1, 2, 3], [2, 1, 3])).toEqual([]);
33
+
34
+ expect(using_arrays([2, 3, 1], [1, 2, 3])).toEqual([]);
35
+ expect(using_arrays([3, 1, 2], [1, 2, 3])).toEqual([]);
36
+ expect(using_arrays([3, 2, 1], [1, 2, 3])).toEqual([]);
37
+ expect(using_arrays([2, 1, 3], [1, 2, 3])).toEqual([]);
38
+
39
+ });
40
+
41
+ test("partial", () => {
42
+
43
+ expect(using_arrays([1, 2, 3, 7], [11, 1, 2, 3])).toEqual([11, 7]);
44
+
45
+ });
@@ -1,4 +1,5 @@
1
1
  /**
2
+ * Returns common elements between two sets
2
3
  * @template T
3
4
  * @returns Set<T>
4
5
  * @param {Set<T>} a
@@ -1 +1 @@
1
- {"version":3,"file":"compute_set_intersection.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/set/compute_set_intersection.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,4EAeC"}
1
+ {"version":3,"file":"compute_set_intersection.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/set/compute_set_intersection.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,4EAqBC"}
@@ -1,10 +1,19 @@
1
+ import { assert } from "../../assert.js";
2
+
1
3
  /**
4
+ * Returns common elements between two sets
2
5
  * @template T
3
6
  * @returns Set<T>
4
7
  * @param {Set<T>} a
5
8
  * @param {Set<T>} b
6
9
  */
7
10
  export function compute_set_intersection(a, b) {
11
+ assert.defined(a, 'a');
12
+ assert.defined(b, 'b');
13
+
14
+ assert.isInstanceOf(a, Set, 'a');
15
+ assert.isInstanceOf(b, Set, 'b');
16
+
8
17
  const result = new Set();
9
18
 
10
19
  const a_array = Array.from(a);
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=compute_set_intersection.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compute_set_intersection.spec.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/set/compute_set_intersection.spec.js"],"names":[],"mappings":""}
@@ -0,0 +1,45 @@
1
+ import { compute_set_intersection } from "./compute_set_intersection.js";
2
+
3
+ /**
4
+ * @template T
5
+ * @param {T[]} a
6
+ * @param {T[]} b
7
+ * @return {T[]}
8
+ */
9
+ function using_arrays(a, b) {
10
+ return Array.from(compute_set_intersection(new Set(a), new Set(b))).sort();
11
+ }
12
+
13
+ test("empty sets", () => {
14
+
15
+ expect(using_arrays([], [])).toEqual([]);
16
+
17
+ });
18
+
19
+ test("empty and single element", () => {
20
+
21
+ expect(using_arrays([1], [])).toEqual([]);
22
+ expect(using_arrays([], [1])).toEqual([]);
23
+
24
+ });
25
+
26
+ test("no difference", () => {
27
+
28
+ expect(using_arrays([1, 2, 3], [1, 2, 3])).toEqual([1, 2, 3]);
29
+ expect(using_arrays([1, 2, 3], [2, 3, 1])).toEqual([1, 2, 3]);
30
+ expect(using_arrays([1, 2, 3], [3, 1, 2])).toEqual([1, 2, 3]);
31
+ expect(using_arrays([1, 2, 3], [3, 2, 1])).toEqual([1, 2, 3]);
32
+ expect(using_arrays([1, 2, 3], [2, 1, 3])).toEqual([1, 2, 3]);
33
+
34
+ expect(using_arrays([2, 3, 1], [1, 2, 3])).toEqual([1, 2, 3]);
35
+ expect(using_arrays([3, 1, 2], [1, 2, 3])).toEqual([1, 2, 3]);
36
+ expect(using_arrays([3, 2, 1], [1, 2, 3])).toEqual([1, 2, 3]);
37
+ expect(using_arrays([2, 1, 3], [1, 2, 3])).toEqual([1, 2, 3]);
38
+
39
+ });
40
+
41
+ test("partial", () => {
42
+
43
+ expect(using_arrays([1, 2, 3, 7], [11, 1, 2, 3])).toEqual([1, 2, 3]);
44
+
45
+ });
@@ -1,4 +1,6 @@
1
1
  /**
2
+ * Remove all elements of B from A.
3
+ * This operation mutates A
2
4
  * @template T
3
5
  * @param {Set<T>} a
4
6
  * @param {Set<T>} b
@@ -1 +1 @@
1
- {"version":3,"file":"set_remove.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/set/set_remove.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,0DASC"}
1
+ {"version":3,"file":"set_remove.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/set/set_remove.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,0DASC"}
@@ -1,4 +1,6 @@
1
1
  /**
2
+ * Remove all elements of B from A.
3
+ * This operation mutates A
2
4
  * @template T
3
5
  * @param {Set<T>} a
4
6
  * @param {Set<T>} b
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=XYZ.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XYZ.spec.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/oklab/XYZ.spec.js"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { oklab_to_xyz } from "./oklab_to_xyz.js";
2
+ import { xyz_to_oklab } from "./xyz_to_oklab.js";
3
+
4
+ test("to/from consistency", () => {
5
+
6
+ const out = [];
7
+
8
+ const sample = [0.123, 0.345, 0.457];
9
+
10
+ oklab_to_xyz(sample, out);
11
+
12
+ xyz_to_oklab(out, out);
13
+
14
+ expect(out[0]).toBeCloseTo(sample[0]);
15
+ expect(out[1]).toBeCloseTo(sample[1]);
16
+ expect(out[2]).toBeCloseTo(sample[2]);
17
+ });
@@ -0,0 +1,9 @@
1
+ /**
2
+ *
3
+ * Converts Oklab color space to CIE XYZ.
4
+ * Oklab as defined by Björn Ottosson
5
+ * @param {number[]} input Oklab
6
+ * @param {number[]} output XYZ
7
+ */
8
+ export function oklab_to_xyz(input: number[], output: number[]): void;
9
+ //# sourceMappingURL=oklab_to_xyz.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oklab_to_xyz.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/oklab/oklab_to_xyz.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,oCAHW,MAAM,EAAE,UACR,MAAM,EAAE,QA0BlB"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ *
3
+ * Converts Oklab color space to CIE XYZ.
4
+ * Oklab as defined by Björn Ottosson
5
+ * @param {number[]} input Oklab
6
+ * @param {number[]} output XYZ
7
+ */
8
+ export function oklab_to_xyz(input, output) {
9
+ const L = input[0];
10
+ const a = input[1];
11
+ const b = input[2];
12
+
13
+ // apply M2 inverse
14
+
15
+ const l_ = 0.99999999845051981432 * L + 0.39633779217376785678 * a + 0.21580375806075880339 * b;
16
+ const m_ = 1.0000000088817607767 * L - 0.1055613423236563494 * a - 0.063854174771705903402 * b;
17
+ const s_ = 1.0000000546724109177 * L - 0.089484182094965759684 * a - 1.2914855378640917399 * b;
18
+
19
+ const l = l_ * l_ * l_;
20
+ const m = m_ * m_ * m_;
21
+ const s = s_ * s_ * s_;
22
+
23
+ // apply M1 inverse
24
+
25
+ const x = 1.227013851103521026 * l - 0.5577999806518222383 * m + 0.28125614896646780758 * s;
26
+ const y = -0.040580178423280593977 * l + 1.1122568696168301049 * m - 0.071676678665601200577 * s;
27
+ const z = -0.076381284505706892869 * l - 0.42148197841801273055 * m + 1.5861632204407947575 * s;
28
+
29
+ output[0] = x;
30
+ output[1] = y;
31
+ output[2] = z;
32
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=oklab_to_xyz.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oklab_to_xyz.spec.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/oklab/oklab_to_xyz.spec.js"],"names":[],"mappings":""}
@@ -0,0 +1,31 @@
1
+ import { oklab_to_xyz } from "./oklab_to_xyz.js";
2
+
3
+ test("known samples", () => {
4
+
5
+ const out = [];
6
+
7
+ oklab_to_xyz([1, 0, 0], out);
8
+
9
+ expect(out[0]).toBeCloseTo(0.950);
10
+ expect(out[1]).toBeCloseTo(1.000);
11
+ expect(out[2]).toBeCloseTo(1.089);
12
+
13
+ oklab_to_xyz([0.450, 1.236, -0.019], out);
14
+
15
+ expect(out[0]).toBeCloseTo(1);
16
+ expect(out[1]).toBeCloseTo(0);
17
+ expect(out[2]).toBeCloseTo(0);
18
+
19
+ oklab_to_xyz([0.922, -0.671, 0.263], out);
20
+
21
+ expect(out[0]).toBeCloseTo(0);
22
+ expect(out[1]).toBeCloseTo(1);
23
+ expect(out[2]).toBeCloseTo(0);
24
+
25
+ oklab_to_xyz([0.153, -1.415, -0.449], out);
26
+
27
+ expect(out[0]).toBeCloseTo(0);
28
+ expect(out[1]).toBeCloseTo(0);
29
+ expect(out[2]).toBeCloseTo(1);
30
+
31
+ });
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Converts CIE XYZ color space to Oklab.
3
+ * Oklab as defined by Björn Ottosson
4
+ * @param {number[]} input XYZ
5
+ * @param {number[]} output Lab
6
+ */
7
+ export function xyz_to_oklab(input: number[], output: number[]): void;
8
+ //# sourceMappingURL=xyz_to_oklab.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xyz_to_oklab.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/oklab/xyz_to_oklab.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,oCAHW,MAAM,EAAE,UACR,MAAM,EAAE,QAwBlB"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Converts CIE XYZ color space to Oklab.
3
+ * Oklab as defined by Björn Ottosson
4
+ * @param {number[]} input XYZ
5
+ * @param {number[]} output Lab
6
+ */
7
+ export function xyz_to_oklab(input, output) {
8
+ const x = input[0];
9
+ const y = input[1];
10
+ const z = input[2];
11
+
12
+ // M1 * (X Y Z)
13
+ const l = 0.8189330101 * x + 0.3618667424 * y - 0.1288597137 * z;
14
+ const m = 0.0329845436 * x + 0.9293118715 * y + 0.0361456387 * z;
15
+ const s = 0.0482003018 * x + 0.2643662691 * y + 0.6338517070 * z;
16
+
17
+ const l_ = Math.cbrt(l);
18
+ const m_ = Math.cbrt(m);
19
+ const s_ = Math.cbrt(s);
20
+
21
+ // M2 * (l` m` s`)
22
+ const L = 0.2104542553 * l_ + 0.7936177850 * m_ - 0.0040720468 * s_;
23
+ const a = 1.9779984951 * l_ - 2.4285922050 * m_ + 0.4505937099 * s_;
24
+ const b = 0.0259040371 * l_ + 0.7827717662 * m_ - 0.8086757660 * s_;
25
+
26
+ output[0] = L;
27
+ output[1] = a;
28
+ output[2] = b;
29
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=xyz_to_oklab.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xyz_to_oklab.spec.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/oklab/xyz_to_oklab.spec.js"],"names":[],"mappings":""}
@@ -0,0 +1,31 @@
1
+ import { xyz_to_oklab } from "./xyz_to_oklab.js";
2
+
3
+ test("known samples", () => {
4
+
5
+ const out = [];
6
+
7
+ xyz_to_oklab([0.950, 1.000, 1.089], out);
8
+
9
+ expect(out[0]).toBeCloseTo(1);
10
+ expect(out[1]).toBeCloseTo(0);
11
+ expect(out[2]).toBeCloseTo(0);
12
+
13
+ xyz_to_oklab([1, 0, 0], out);
14
+
15
+ expect(out[0]).toBeCloseTo(0.450);
16
+ expect(out[1]).toBeCloseTo(1.236);
17
+ expect(out[2]).toBeCloseTo(-0.019);
18
+
19
+ xyz_to_oklab([0, 1, 0], out);
20
+
21
+ expect(out[0]).toBeCloseTo(0.922);
22
+ expect(out[1]).toBeCloseTo(-0.671);
23
+ expect(out[2]).toBeCloseTo(0.263);
24
+
25
+ xyz_to_oklab([0, 0, 1], out);
26
+
27
+ expect(out[0]).toBeCloseTo(0.153);
28
+ expect(out[1]).toBeCloseTo(-1.415);
29
+ expect(out[2]).toBeCloseTo(-0.449);
30
+
31
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"linear_to_sRGB.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/sRGB/linear_to_sRGB.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,uCALW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,iBAC1B,MAAM,SACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,gBAC1B,MAAM,QAMhB"}
1
+ {"version":3,"file":"linear_to_sRGB.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/sRGB/linear_to_sRGB.js"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,uCALW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,iBAC1B,MAAM,SACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,gBAC1B,MAAM,QAahB"}
@@ -1,5 +1,9 @@
1
1
  function convert(c) {
2
- return (c < 0.0031308) ? c * 12.92 : 1.055 * (Math.pow(c, 0.41666)) - 0.055;
2
+ if (c < 0.0031308) {
3
+ return c * 12.92;
4
+ } else {
5
+ return 1.055 * (Math.pow(c, 0.4166666666666667)) - 0.055;
6
+ }
3
7
  }
4
8
 
5
9
  /**
@@ -9,8 +13,15 @@ function convert(c) {
9
13
  * @param {number[]|ArrayLike<number>} input
10
14
  * @param {number} input_offset
11
15
  */
12
- export function linear_to_sRGB(output, output_offset, input, input_offset) {
13
- output[output_offset] = convert(input[input_offset]);
14
- output[output_offset + 1] = convert(input[input_offset + 1]);
15
- output[output_offset + 2] = convert(input[input_offset + 2]);
16
+ export function linear_to_sRGB(
17
+ output, output_offset,
18
+ input, input_offset
19
+ ) {
20
+ const r = input[input_offset];
21
+ const g = input[input_offset + 1];
22
+ const b = input[input_offset + 2];
23
+
24
+ output[output_offset] = convert(r);
25
+ output[output_offset + 1] = convert(g);
26
+ output[output_offset + 2] = convert(b);
16
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sRGB_to_linear.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/sRGB/sRGB_to_linear.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kDAHW,MAAM,GACL,MAAM,GAAC,MAAM,CAIxB;AAED;;;;;;GAMG;AACH,uCALW,MAAM,EAAE,iBACR,MAAM,SACN,MAAM,EAAE,gBACR,MAAM,QAMhB"}
1
+ {"version":3,"file":"sRGB_to_linear.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/sRGB/sRGB_to_linear.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kDAHW,MAAM,GACL,MAAM,GAAC,MAAM,CAQxB;AAED;;;;;;GAMG;AACH,uCALW,MAAM,EAAE,iBACR,MAAM,SACN,MAAM,EAAE,gBACR,MAAM,QAchB"}
@@ -4,7 +4,11 @@
4
4
  * @return {number|number}
5
5
  */
6
6
  export function convert_channel_sRGB_to_linear(c) {
7
- return (c < 0.04045) ? c * 0.0773993808 : Math.pow(c * 0.9478672986 + 0.0521327014, 2.4);
7
+ if (c < 0.04045) {
8
+ return c * 0.0773993808;
9
+ } else {
10
+ return Math.pow(c * 0.9478672986 + 0.0521327014, 2.4);
11
+ }
8
12
  }
9
13
 
10
14
  /**
@@ -14,8 +18,16 @@ export function convert_channel_sRGB_to_linear(c) {
14
18
  * @param {number[]} input
15
19
  * @param {number} input_offset
16
20
  */
17
- export function sRGB_to_linear(output, output_offset, input, input_offset) {
18
- output[output_offset] = convert_channel_sRGB_to_linear(input[input_offset]);
19
- output[output_offset + 1] = convert_channel_sRGB_to_linear(input[input_offset + 1]);
20
- output[output_offset + 2] = convert_channel_sRGB_to_linear(input[input_offset + 2]);
21
+ export function sRGB_to_linear(
22
+ output, output_offset,
23
+ input, input_offset
24
+ ) {
25
+
26
+ const sR = input[input_offset];
27
+ const sG = input[input_offset + 1];
28
+ const sB = input[input_offset + 2];
29
+
30
+ output[output_offset] = convert_channel_sRGB_to_linear(sR);
31
+ output[output_offset + 1] = convert_channel_sRGB_to_linear(sG);
32
+ output[output_offset + 2] = convert_channel_sRGB_to_linear(sB);
21
33
  }
@@ -1,4 +1,5 @@
1
1
  /**
2
+ * Convert to CIE XYZ color model
2
3
  * Assumes linear RGB space
3
4
  * @param {vec3} out
4
5
  * @param {vec3} input
@@ -1 +1 @@
1
- {"version":3,"file":"rgb_to_xyz.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/xyz/rgb_to_xyz.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,yDASC"}
1
+ {"version":3,"file":"rgb_to_xyz.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/xyz/rgb_to_xyz.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,yDASC"}
@@ -1,4 +1,5 @@
1
1
  /**
2
+ * Convert to CIE XYZ color model
2
3
  * Assumes linear RGB space
3
4
  * @param {vec3} out
4
5
  * @param {vec3} input
@@ -9,7 +10,7 @@ export function rgb_to_xyz(out, input) {
9
10
  const y = input[1];
10
11
  const z = input[2];
11
12
 
12
- out[0] = 0.4124564 * x + 0.3575761 * y + 0.1804375 * z;
13
- out[1] = 0.2126729 * x + 0.7151522 * y + 0.0721750 * z;
14
- out[2] = 0.0193339 * x + 0.1191920 * y + 0.9503041 * z;
13
+ out[0] = 0.41239079926595948129 * x + 0.35758433938387796373 * y + 0.18048078840183428751 * z;
14
+ out[1] = 0.21263900587151035754 * x + 0.71516867876775592746 * y + 0.07219231536073371500 * z;
15
+ out[2] = 0.01933081871559185069 * x + 0.11919477979462598791 * y + 0.95053215224966058086 * z;
15
16
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- *
2
+ * CIE color model to linear RGB
3
3
  * @param {vec3} out
4
4
  * @param {vec3} input
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- *
2
+ * CIE color model to linear RGB
3
3
  * @param {vec3} out
4
4
  * @param {vec3} input
5
5
  */
@@ -8,7 +8,7 @@ export function xyz_to_rgb(out, input) {
8
8
  const y = input[1];
9
9
  const z = input[2];
10
10
 
11
- out[0] = 3.2404542 * x - 1.5371385 * y - 0.4985314 * z;
12
- out[1] = (-0.9692660) * x + 1.8760108 * y + 0.0415560 * z;
13
- out[2] = 0.0556434 * x - 0.2040259 * y + 1.0572252 * z;
11
+ out[0] = 3.24096994190452134377 * x - 1.53738317757009345794 * y - 0.49861076029300328366 * z;
12
+ out[1] = (-0.96924363628087982613) * x + 1.87596750150772066772 * y + 0.04155505740717561247 * z;
13
+ out[2] = 0.05563007969699360846 * x - 0.20397695888897656435 * y + 1.05697151424287856072 * z;
14
14
  }
@@ -1,13 +0,0 @@
1
- /**
2
- *
3
- * @param {number[]} input
4
- * @param {number[]} output
5
- */
6
- export function rgb2hsluv(input: number[], output: number[]): void;
7
- /**
8
- *
9
- * @param {number[]} input
10
- * @param {number[]} output
11
- */
12
- export function hsluv2rgb(input: number[], output: number[]): void;
13
- //# sourceMappingURL=HSLuv.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HSLuv.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/hsluv/HSLuv.js"],"names":[],"mappings":"AAkKA;;;;GAIG;AACH,iCAHW,MAAM,EAAE,UACR,MAAM,EAAE,QAOlB;AAED;;;;GAIG;AACH,iCAHW,MAAM,EAAE,UACR,MAAM,EAAE,QAOlB"}