@woosh/meep-engine 2.97.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.
- package/build/bundle-worker-terrain.js +1 -1
- package/build/meep.cjs +861 -670
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +861 -670
- package/package.json +1 -1
- package/src/core/bvh2/bvh3/query/bvh_query_leaves_ray.js +1 -1
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_generic.js +1 -1
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray.js +3 -2
- package/src/core/collection/array/arrayQuickSort.js +2 -2
- package/src/core/collection/array/array_compute_max.d.ts +9 -0
- package/src/core/collection/array/array_compute_max.d.ts.map +1 -0
- package/src/core/collection/array/{computeArrayMax.js → array_compute_max.js} +1 -1
- package/src/core/collection/array/array_compute_min.d.ts +9 -0
- package/src/core/collection/array/array_compute_min.d.ts.map +1 -0
- package/src/core/collection/array/{computeArrayMin.js → array_compute_min.js} +1 -1
- package/src/core/collection/array/array_compute_min_max.d.ts.map +1 -1
- package/src/core/collection/array/array_compute_min_max.js +1 -0
- package/src/core/collection/array/array_swap.d.ts.map +1 -1
- package/src/core/collection/array/array_swap.js +11 -8
- package/src/core/collection/array/array_swap_one.d.ts +8 -0
- package/src/core/collection/array/array_swap_one.d.ts.map +1 -0
- package/src/core/collection/array/{arraySwapElements.js → array_swap_one.js} +1 -1
- package/src/core/collection/array/iterator/AbstractArrayIterator.d.ts.map +1 -0
- package/src/core/collection/array/iterator/ArrayIteratorRandom.d.ts.map +1 -0
- package/src/core/collection/array/{ArrayIteratorRandom.js → iterator/ArrayIteratorRandom.js} +2 -2
- package/src/core/collection/array/iterator/ArrayIteratorSequential.d.ts.map +1 -0
- package/src/core/collection/array/randomizeArrayElementOrder.js +2 -2
- package/src/core/collection/map/HashMap.js +10 -10
- package/src/core/collection/map/ObservedMap.d.ts +7 -4
- package/src/core/collection/map/ObservedMap.d.ts.map +1 -1
- package/src/core/collection/map/ObservedMap.js +4 -1
- package/src/core/collection/queue/Deque.d.ts.map +1 -1
- package/src/core/collection/queue/Deque.js +82 -36
- package/src/core/collection/set/compute_set_difference.d.ts.map +1 -1
- package/src/core/collection/set/compute_set_difference.js +8 -0
- package/src/core/collection/set/compute_set_difference.spec.d.ts +2 -0
- package/src/core/collection/set/compute_set_difference.spec.d.ts.map +1 -0
- package/src/core/collection/set/compute_set_difference.spec.js +45 -0
- package/src/core/collection/set/compute_set_intersection.d.ts +1 -0
- package/src/core/collection/set/compute_set_intersection.d.ts.map +1 -1
- package/src/core/collection/set/compute_set_intersection.js +9 -0
- package/src/core/collection/set/compute_set_intersection.spec.d.ts +2 -0
- package/src/core/collection/set/compute_set_intersection.spec.d.ts.map +1 -0
- package/src/core/collection/set/compute_set_intersection.spec.js +45 -0
- package/src/core/collection/set/set_remove.d.ts +2 -0
- package/src/core/collection/set/set_remove.d.ts.map +1 -1
- package/src/core/collection/set/set_remove.js +2 -0
- package/src/core/color/oklab/XYZ.spec.d.ts +2 -0
- package/src/core/color/oklab/XYZ.spec.d.ts.map +1 -0
- package/src/core/color/oklab/XYZ.spec.js +17 -0
- package/src/core/color/oklab/oklab_to_xyz.d.ts +9 -0
- package/src/core/color/oklab/oklab_to_xyz.d.ts.map +1 -0
- package/src/core/color/oklab/oklab_to_xyz.js +32 -0
- package/src/core/color/oklab/oklab_to_xyz.spec.d.ts +2 -0
- package/src/core/color/oklab/oklab_to_xyz.spec.d.ts.map +1 -0
- package/src/core/color/oklab/oklab_to_xyz.spec.js +31 -0
- package/src/core/color/oklab/xyz_to_oklab.d.ts +8 -0
- package/src/core/color/oklab/xyz_to_oklab.d.ts.map +1 -0
- package/src/core/color/oklab/xyz_to_oklab.js +29 -0
- package/src/core/color/oklab/xyz_to_oklab.spec.d.ts +2 -0
- package/src/core/color/oklab/xyz_to_oklab.spec.d.ts.map +1 -0
- package/src/core/color/oklab/xyz_to_oklab.spec.js +31 -0
- package/src/core/color/sRGB/linear_to_sRGB.d.ts.map +1 -1
- package/src/core/color/sRGB/linear_to_sRGB.js +16 -5
- package/src/core/color/sRGB/sRGB_to_linear.d.ts.map +1 -1
- package/src/core/color/sRGB/sRGB_to_linear.js +17 -5
- package/src/core/color/xyz/rgb_to_xyz.d.ts +1 -0
- package/src/core/color/xyz/rgb_to_xyz.d.ts.map +1 -1
- package/src/core/color/xyz/rgb_to_xyz.js +4 -3
- package/src/core/color/xyz/xyz_to_rgb.d.ts +1 -1
- package/src/core/color/xyz/xyz_to_rgb.js +4 -4
- package/src/core/geom/3d/aabb/aabb3_intersects_ray.js +10 -10
- package/src/core/parser/simple/ParserError.d.ts +11 -6
- package/src/core/parser/simple/ParserError.d.ts.map +1 -1
- package/src/core/parser/simple/ParserError.js +51 -4
- package/src/core/parser/simple/Token.d.ts.map +1 -1
- package/src/core/parser/simple/Token.js +8 -2
- package/src/core/parser/simple/TokenType.d.ts +1 -5
- package/src/core/parser/simple/TokenType.d.ts.map +1 -1
- package/src/core/parser/simple/TokenType.js +1 -1
- package/src/core/parser/simple/readBooleanToken.d.ts.map +1 -1
- package/src/core/parser/simple/readBooleanToken.js +6 -1
- package/src/core/parser/simple/readHexToken.d.ts.map +1 -1
- package/src/core/parser/simple/readHexToken.js +7 -2
- package/src/core/parser/simple/readIdentifierToken.d.ts.map +1 -1
- package/src/core/parser/simple/readIdentifierToken.js +6 -1
- package/src/core/parser/simple/readLiteralToken.d.ts.map +1 -1
- package/src/core/parser/simple/readLiteralToken.js +8 -3
- package/src/core/parser/simple/readNumberToken.d.ts.map +1 -1
- package/src/core/parser/simple/readNumberToken.js +7 -2
- package/src/core/parser/simple/readReferenceToken.d.ts.map +1 -1
- package/src/core/parser/simple/readReferenceToken.js +6 -1
- package/src/core/parser/simple/readStringToken.d.ts.map +1 -1
- package/src/core/parser/simple/readStringToken.js +6 -1
- package/src/core/parser/simple/readUnsignedIntegerToken.d.ts.map +1 -1
- package/src/core/parser/simple/readUnsignedIntegerToken.js +7 -2
- package/src/core/parser/simple/skipWhitespace.d.ts.map +1 -1
- package/src/core/parser/simple/skipWhitespace.js +8 -0
- package/src/core/primitives/strings/string_repeat.d.ts +9 -0
- package/src/core/primitives/strings/string_repeat.d.ts.map +1 -0
- package/src/core/primitives/strings/string_repeat.js +26 -0
- package/src/engine/asset/AssetManager.d.ts.map +1 -1
- package/src/engine/development/performance/RingBufferMetric.d.ts.map +1 -1
- package/src/engine/development/performance/RingBufferMetric.js +5 -5
- package/src/engine/ecs/terrain/ecs/BuildLightTexture.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/BuildLightTexture.js +15 -22
- package/src/engine/graphics/ecs/camera/Camera.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/Camera.js +23 -16
- package/src/engine/graphics/filter/ImageFilter.d.ts +2 -2
- package/src/engine/graphics/filter/ImageFilter.d.ts.map +1 -1
- package/src/engine/graphics/filter/ImageFilter.js +3 -3
- package/src/engine/graphics/render/RendererPool.d.ts +14 -1
- package/src/engine/graphics/render/RendererPool.d.ts.map +1 -1
- package/src/engine/graphics/render/RendererPool.js +43 -1
- package/src/engine/graphics/render/forward_plus/LightManager.js +2 -2
- package/src/engine/graphics/sh3/path_tracer/PathTracer.d.ts +2 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracer.js +23 -50
- package/src/engine/graphics/sh3/path_tracer/getBiasedNormalSample.d.ts +9 -0
- package/src/engine/graphics/sh3/path_tracer/getBiasedNormalSample.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/getBiasedNormalSample.js +53 -3
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +3 -3
- package/src/engine/graphics/texture/sampler/convertTexture2Sampler2D.d.ts +1 -1
- package/src/engine/graphics/texture/sampler/convertTexture2Sampler2D.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/convertTexture2Sampler2D.js +42 -36
- package/src/engine/graphics/texture/sampler/debug/debug_draw_sampler.d.ts +3 -0
- package/src/engine/graphics/texture/sampler/debug/debug_draw_sampler.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/debug/debug_draw_sampler.js +34 -0
- package/src/engine/graphics/texture/sampler/debug/debug_draw_sampler_grid.d.ts +10 -0
- package/src/engine/graphics/texture/sampler/debug/debug_draw_sampler_grid.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/debug/debug_draw_sampler_grid.js +89 -0
- package/src/engine/graphics/texture/sampler/debug/prototypeSamplerFiltering.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/{prototypeSamplerFiltering.js → debug/prototypeSamplerFiltering.js} +105 -113
- package/src/generation/grid/generation/GridTaskDensityMarkerDistribution.d.ts.map +1 -1
- package/src/generation/grid/generation/GridTaskDensityMarkerDistribution.js +8 -8
- package/src/generation/markers/GridActionRuleSet.d.ts.map +1 -1
- package/src/generation/markers/GridActionRuleSet.js +5 -5
- package/src/core/binary/byteArrayToString.d.ts +0 -9
- package/src/core/binary/byteArrayToString.d.ts.map +0 -1
- package/src/core/binary/byteArrayToString.js +0 -28
- package/src/core/collection/array/AbstractArrayIterator.d.ts.map +0 -1
- package/src/core/collection/array/ArrayIteratorRandom.d.ts.map +0 -1
- package/src/core/collection/array/ArrayIteratorSequential.d.ts.map +0 -1
- package/src/core/collection/array/arrayPickMinElement.d.ts +0 -8
- package/src/core/collection/array/arrayPickMinElement.d.ts.map +0 -1
- package/src/core/collection/array/arrayPickMinElement.js +0 -43
- package/src/core/collection/array/arraySwapElements.d.ts +0 -8
- package/src/core/collection/array/arraySwapElements.d.ts.map +0 -1
- package/src/core/collection/array/computeArrayMax.d.ts +0 -9
- package/src/core/collection/array/computeArrayMax.d.ts.map +0 -1
- package/src/core/collection/array/computeArrayMin.d.ts +0 -9
- package/src/core/collection/array/computeArrayMin.d.ts.map +0 -1
- package/src/core/color/hsluv/HSLuv.d.ts +0 -13
- package/src/core/color/hsluv/HSLuv.d.ts.map +0 -1
- package/src/core/color/hsluv/HSLuv.js +0 -187
- package/src/engine/graphics/texture/sampler/prototypeSamplerFiltering.d.ts.map +0 -1
- /package/src/core/collection/array/{AbstractArrayIterator.d.ts → iterator/AbstractArrayIterator.d.ts} +0 -0
- /package/src/core/collection/array/{AbstractArrayIterator.js → iterator/AbstractArrayIterator.js} +0 -0
- /package/src/core/collection/array/{ArrayIteratorRandom.d.ts → iterator/ArrayIteratorRandom.d.ts} +0 -0
- /package/src/core/collection/array/{ArrayIteratorSequential.d.ts → iterator/ArrayIteratorSequential.d.ts} +0 -0
- /package/src/core/collection/array/{ArrayIteratorSequential.js → iterator/ArrayIteratorSequential.js} +0 -0
- /package/src/engine/graphics/texture/sampler/{prototypeSamplerFiltering.d.ts → debug/prototypeSamplerFiltering.d.ts} +0 -0
|
@@ -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 @@
|
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compute_set_intersection.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/set/compute_set_intersection.js"],"names":[],"mappings":"
|
|
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 @@
|
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set_remove.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/set/set_remove.js"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"set_remove.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/set/set_remove.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,0DASC"}
|
|
@@ -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 @@
|
|
|
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 @@
|
|
|
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":"
|
|
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
|
-
|
|
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(
|
|
13
|
-
output
|
|
14
|
-
|
|
15
|
-
|
|
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,
|
|
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
|
-
|
|
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(
|
|
18
|
-
output
|
|
19
|
-
|
|
20
|
-
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rgb_to_xyz.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/xyz/rgb_to_xyz.js"],"names":[],"mappings":"AAAA
|
|
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.
|
|
13
|
-
out[1] = 0.
|
|
14
|
-
out[2] = 0.
|
|
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
|
*/
|
|
@@ -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.
|
|
12
|
-
out[1] = (-0.
|
|
13
|
-
out[2] = 0.
|
|
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,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const abs = Math.abs;
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* NOTES:
|
|
@@ -35,7 +35,7 @@ export function aabb3_intersects_ray(
|
|
|
35
35
|
const diff_x = origin_x - center_x;
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
if (diff_x * direction_x >= 0.0 &&
|
|
38
|
+
if (diff_x * direction_x >= 0.0 && abs(diff_x) > extents_x) {
|
|
39
39
|
return false;
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -47,7 +47,7 @@ export function aabb3_intersects_ray(
|
|
|
47
47
|
const diff_y = origin_y - center_y;
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
if (diff_y * direction_y >= 0.0 &&
|
|
50
|
+
if (diff_y * direction_y >= 0.0 && abs(diff_y) > extents_y) {
|
|
51
51
|
return false;
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -59,28 +59,28 @@ export function aabb3_intersects_ray(
|
|
|
59
59
|
const diff_z = origin_z - center_z;
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
if (diff_z * direction_z >= 0.0 &&
|
|
62
|
+
if (diff_z * direction_z >= 0.0 && abs(diff_z) > extents_z) {
|
|
63
63
|
return false;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
const abs_direction_y =
|
|
67
|
-
const abs_direction_z =
|
|
66
|
+
const abs_direction_y = abs(direction_y);
|
|
67
|
+
const abs_direction_z = abs(direction_z);
|
|
68
68
|
|
|
69
|
-
const f0 =
|
|
69
|
+
const f0 = abs(direction_y * diff_z - direction_z * diff_y);
|
|
70
70
|
|
|
71
71
|
if (f0 > extents_y * abs_direction_z + extents_z * abs_direction_y) {
|
|
72
72
|
return false;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
const abs_direction_x =
|
|
75
|
+
const abs_direction_x = abs(direction_x);
|
|
76
76
|
|
|
77
|
-
const f1 =
|
|
77
|
+
const f1 = abs(direction_z * diff_x - direction_x * diff_z);
|
|
78
78
|
|
|
79
79
|
if (f1 > extents_x * abs_direction_z + extents_z * abs_direction_x) {
|
|
80
80
|
return false;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
const f2 =
|
|
83
|
+
const f2 = abs(direction_x * diff_y - direction_y * diff_x);
|
|
84
84
|
|
|
85
85
|
return f2 <= extents_x * abs_direction_y + extents_y * abs_direction_x;
|
|
86
86
|
}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
export default ParserError;
|
|
2
|
-
declare
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
declare class ParserError extends Error {
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {number} position
|
|
6
|
+
* @param {string} message
|
|
7
|
+
* @param {string} input
|
|
8
|
+
*/
|
|
9
|
+
constructor(position: number, message: string, input: string);
|
|
10
|
+
position: number;
|
|
11
|
+
input: string;
|
|
12
|
+
getDetails(): string;
|
|
8
13
|
}
|
|
9
14
|
//# sourceMappingURL=ParserError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParserError.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/ParserError.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ParserError.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/ParserError.js"],"names":[],"mappings":";AAKA;IACI;;;;;OAKG;IACH,sBAJW,MAAM,WACN,MAAM,SACN,MAAM,EAiBhB;IAHG,iBAAwB;IAExB,cAAkB;IAGtB,qBAiBC;CAKJ"}
|