@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
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import Vector2 from "../../../../../core/geom/Vector2.js";
|
|
2
|
+
import { max2 } from "../../../../../core/math/max2.js";
|
|
3
|
+
import LabelView from "../../../../../view/common/LabelView.js";
|
|
4
|
+
import { debug_draw_sampler } from "./debug_draw_sampler.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @param {Engine} engine
|
|
9
|
+
* @param {Sampler2D} input
|
|
10
|
+
* @param {function(Sampler2D,Sampler2D,{label:string, skip:boolean})[]} transforms
|
|
11
|
+
* @param {Vector2} size
|
|
12
|
+
* @param {boolean} display_labels
|
|
13
|
+
*/
|
|
14
|
+
export function debug_draw_sampler_grid({
|
|
15
|
+
engine,
|
|
16
|
+
input,
|
|
17
|
+
transforms,
|
|
18
|
+
size = new Vector2(input.width, input.height),
|
|
19
|
+
display_labels = true
|
|
20
|
+
}) {
|
|
21
|
+
|
|
22
|
+
const GAP_SIZE = 4;
|
|
23
|
+
|
|
24
|
+
let draw_index = 0;
|
|
25
|
+
|
|
26
|
+
const viewport_width = window.innerWidth;
|
|
27
|
+
const tiles_x = max2(1, Math.floor(viewport_width / (size.x + GAP_SIZE)));
|
|
28
|
+
|
|
29
|
+
for (let i = 0; i < transforms.length; i++) {
|
|
30
|
+
const out = input.clone();
|
|
31
|
+
|
|
32
|
+
out.resize(size.x, size.y);
|
|
33
|
+
|
|
34
|
+
const params = {
|
|
35
|
+
label: '',
|
|
36
|
+
skip: false
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const t0 = performance.now();
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
transforms[i](out, input, params);
|
|
43
|
+
} catch (e) {
|
|
44
|
+
// error, skip
|
|
45
|
+
console.error(`Failed '${params.label}'. Reason: ${e.message}`)
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const t1 = performance.now();
|
|
50
|
+
|
|
51
|
+
if (params.skip) {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const t_duration = t1 - t0;
|
|
56
|
+
|
|
57
|
+
console.log(`Executed ${params.label} in ${t_duration}ms`);
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
const draw_x = (draw_index % tiles_x) * (size.x + GAP_SIZE);
|
|
61
|
+
const draw_y = Math.floor(draw_index / tiles_x) * (size.y + GAP_SIZE);
|
|
62
|
+
|
|
63
|
+
const view = debug_draw_sampler(engine, out, draw_x, draw_y);
|
|
64
|
+
|
|
65
|
+
if (params.label.length > 0 && display_labels) {
|
|
66
|
+
const vLabel = new LabelView(params.label, {
|
|
67
|
+
css: {
|
|
68
|
+
position: 'absolute',
|
|
69
|
+
fontFamily: 'sans-serif',
|
|
70
|
+
fontWeight: 'bold',
|
|
71
|
+
top: 0,
|
|
72
|
+
left: 0,
|
|
73
|
+
zIndex: 1,
|
|
74
|
+
color: '#000000',
|
|
75
|
+
textShadow: '1px 1px 1px white',
|
|
76
|
+
background: 'rgba(255,255,255,0.7)',
|
|
77
|
+
padding: '2px'
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
view.addChild(vLabel);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
draw_index++;
|
|
85
|
+
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prototypeSamplerFiltering.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/texture/sampler/debug/prototypeSamplerFiltering.js"],"names":[],"mappings":""}
|
|
@@ -1,119 +1,101 @@
|
|
|
1
|
-
import Vector2 from "
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
1
|
+
import Vector2 from "../../../../../core/geom/Vector2.js";
|
|
2
|
+
import { clamp } from "../../../../../core/math/clamp.js";
|
|
3
|
+
import { clamp01 } from "../../../../../core/math/clamp01.js";
|
|
4
|
+
import { ImageRGBADataLoader } from "../../../../asset/loaders/image/ImageRGBADataLoader.js";
|
|
5
|
+
import { EngineHarness } from "../../../../EngineHarness.js";
|
|
6
|
+
import { box } from "../filter/box.js";
|
|
7
|
+
import { filter_lanczos3 } from "../filter/filter_lanczos3.js";
|
|
8
|
+
import { gaussian } from "../filter/gaussian.js";
|
|
9
|
+
import { kaiser_1 } from "../filter/kaiser_1.js";
|
|
10
|
+
import { kaiser_bessel_window } from "../filter/kaiser_bessel_window.js";
|
|
11
|
+
import { mitchell } from "../filter/mitchell.js";
|
|
12
|
+
import { mitchell_v1 } from "../filter/mitchell_v1.js";
|
|
13
|
+
import { sampler2d_scale_down_generic } from "../filter/sampler2d_scale_down_generic.js";
|
|
14
|
+
import { triangle } from "../filter/triangle.js";
|
|
15
|
+
import { sampler2d_scale_down_lanczos } from "../resize/sampler2d_scale_down_lanczos.js";
|
|
16
|
+
import { sampler2d_scale_down_mipmap } from "../resize/sampler2d_scale_down_mipmap.js";
|
|
17
|
+
import { sampler2d_scale_generic } from "../resize/sampler2d_scale_generic.js";
|
|
18
|
+
import { Sampler2D } from "../Sampler2D.js";
|
|
19
|
+
import { debug_draw_sampler } from "./debug_draw_sampler.js";
|
|
20
|
+
import { debug_draw_sampler_grid } from "./debug_draw_sampler_grid.js";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param {Engine} engine
|
|
25
|
+
* @param {Sampler2D} sampler
|
|
26
|
+
*/
|
|
27
|
+
function setup_zoom_preview({ engine, sampler }) {
|
|
28
|
+
|
|
29
|
+
debug_draw_sampler(engine, sampler, 0, 0);
|
|
30
|
+
|
|
31
|
+
const preview = Sampler2D.uint8clamped(sampler.itemSize, 256, 256);
|
|
32
|
+
|
|
33
|
+
// preview.channelFill(3, 255);
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
const preview_container = debug_draw_sampler(engine, preview, 0, sampler.height);
|
|
37
|
+
preview_container.transformOrigin.set(0, 0);
|
|
38
|
+
// preview_container.scale.setScalar(20);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* @param {Sampler2D} source
|
|
43
|
+
* @param {Sampler2D} target
|
|
44
|
+
* @param {number} u0
|
|
45
|
+
* @param {number} v0
|
|
46
|
+
* @param {number} u1
|
|
47
|
+
* @param {number} v1
|
|
48
|
+
*/
|
|
49
|
+
function update_preview(
|
|
50
|
+
source, target,
|
|
51
|
+
u0, v0, u1, v1
|
|
52
|
+
) {
|
|
53
|
+
|
|
54
|
+
const sample = [];
|
|
55
|
+
|
|
56
|
+
for (let y = 0; y < target.height; y++) {
|
|
57
|
+
for (let x = 0; x < target.width; x++) {
|
|
58
|
+
|
|
59
|
+
const local_u = x / target.width;
|
|
60
|
+
const local_v = y / target.height;
|
|
61
|
+
|
|
62
|
+
source.sampleBilinearUV(local_u * (u1 - u0) + u0, local_v * (v1 - v0) + v0, sample);
|
|
63
|
+
|
|
64
|
+
target.write(x, y, sample);
|
|
51
65
|
|
|
52
|
-
|
|
53
|
-
continue;
|
|
66
|
+
}
|
|
54
67
|
}
|
|
55
68
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
console.log(`Executed ${params.label} in ${t_duration}ms`);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const draw_x = (draw_index % tiles_x) * (size.x + GAP_SIZE);
|
|
62
|
-
const draw_y = Math.floor(draw_index / tiles_x) * (size.y + GAP_SIZE);
|
|
63
|
-
|
|
64
|
-
const view = display(engine, out, draw_x, draw_y);
|
|
69
|
+
}
|
|
65
70
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
css: {
|
|
69
|
-
position: 'absolute',
|
|
70
|
-
fontFamily: 'sans-serif',
|
|
71
|
-
fontWeight: 'bold',
|
|
72
|
-
top: 0,
|
|
73
|
-
left: 0,
|
|
74
|
-
zIndex: 1,
|
|
75
|
-
color: '#000000',
|
|
76
|
-
textShadow: '1px 1px 1px white',
|
|
77
|
-
background: 'rgba(255,255,255,0.7)',
|
|
78
|
-
padding: '2px'
|
|
79
|
-
}
|
|
80
|
-
});
|
|
71
|
+
function setPreviewPosition(x,y){
|
|
72
|
+
const window_size = 0.1;
|
|
81
73
|
|
|
82
|
-
view.addChild(vLabel);
|
|
83
|
-
}
|
|
84
74
|
|
|
85
|
-
|
|
75
|
+
const u = clamp01(x / sampler.width);
|
|
76
|
+
const v = clamp01(y / sampler.height);
|
|
86
77
|
|
|
87
|
-
|
|
78
|
+
const w_2 = window_size * 0.5;
|
|
88
79
|
|
|
89
|
-
|
|
80
|
+
const center_u = clamp(u, w_2, 1 - w_2);
|
|
81
|
+
const center_v = clamp(v, w_2, 1 - w_2);
|
|
90
82
|
|
|
91
83
|
|
|
92
|
-
|
|
84
|
+
update_preview(
|
|
85
|
+
sampler, preview,
|
|
86
|
+
center_u - w_2, center_v - w_2,
|
|
87
|
+
center_u + w_2, center_v + w_2
|
|
88
|
+
);
|
|
93
89
|
|
|
94
|
-
|
|
95
|
-
view.size.set(sampler.width, sampler.height);
|
|
96
|
-
sampler2D2Canvas(sampler, 1, 0, view.el);
|
|
90
|
+
preview_container.$redraw();
|
|
97
91
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
top: "0",
|
|
101
|
-
left: "0"
|
|
102
|
-
});
|
|
92
|
+
console.log(x,y);
|
|
93
|
+
}
|
|
103
94
|
|
|
104
|
-
|
|
105
|
-
css: {
|
|
106
|
-
position: 'absolute',
|
|
107
|
-
top: `${y}px`,
|
|
108
|
-
left: `${x}px`
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
container.size.set(sampler.width, sampler.height);
|
|
112
|
-
container.addChild(view);
|
|
95
|
+
// setPreviewPosition(366,420);
|
|
113
96
|
|
|
114
|
-
engine.
|
|
97
|
+
engine.devices.pointer.position.onChanged.add(setPreviewPosition);
|
|
115
98
|
|
|
116
|
-
return container;
|
|
117
99
|
}
|
|
118
100
|
|
|
119
101
|
|
|
@@ -128,11 +110,11 @@ new EngineHarness().initialize({
|
|
|
128
110
|
// const path = "data/textures/decal/ISO 7010 - Safety Signs/Prohibited Actions/400px/P069 - Not to be serviced by users.png";
|
|
129
111
|
// const path = "data/textures/utility/Lenna.png";
|
|
130
112
|
// const path = "data/textures/utility/dragon.jpg";
|
|
131
|
-
const path = "data/textures/utility/grid_tileable.png";
|
|
113
|
+
// const path = "data/textures/utility/grid_tileable.png";
|
|
132
114
|
// const path = "data/textures/utility/uv_map_reference.jpg";
|
|
133
115
|
// const path ="data/textures/utility/TESTIMAGES/SAMPLING/8BIT/RGB/2448x2448/SRC/img_2448x2448_3x8bit_SRC_RGB_clips.png";
|
|
134
116
|
// const path ="data/textures/utility/TESTIMAGES/SAMPLING/8BIT/RGB/2448x2448/SRC/img_2448x2448_3x8bit_SRC_RGB_coins.png";
|
|
135
|
-
|
|
117
|
+
const path = "data/models/LowPolyTownshipSet/Small_house/diffuse_512.png";
|
|
136
118
|
// const path ="data/models/LowPolyTownshipSet/Barrel/diffuse_256.png";
|
|
137
119
|
// const path ="data/textures/utility/resolver.jpeg";
|
|
138
120
|
// const path ="data/textures/icons/500_skill_icons_02/Skill_nobg/skill_492_noBG.png";
|
|
@@ -142,7 +124,12 @@ new EngineHarness().initialize({
|
|
|
142
124
|
|
|
143
125
|
const source = asset.create();
|
|
144
126
|
|
|
145
|
-
|
|
127
|
+
setup_zoom_preview({
|
|
128
|
+
sampler: source,
|
|
129
|
+
engine
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
// test_sampling(source, engine)
|
|
146
133
|
|
|
147
134
|
engine.graphics.getRenderer().setClearColor('green');
|
|
148
135
|
|
|
@@ -163,7 +150,7 @@ new EngineHarness().initialize({
|
|
|
163
150
|
sampler2d_scale_down_lanczos(source, small, 3);
|
|
164
151
|
console.timeEnd('filter');
|
|
165
152
|
|
|
166
|
-
|
|
153
|
+
debug_draw_sampler(engine, small, COMPARE_X_OFFSET, 0);
|
|
167
154
|
|
|
168
155
|
// const big = Sampler2D.uint8(source.itemSize, Math.ceil(source.width / TARGET_SCALE), Math.ceil(source.height / TARGET_SCALE));
|
|
169
156
|
// sampler2D_scale_down_lanczos(source, big,3);
|
|
@@ -174,17 +161,20 @@ new EngineHarness().initialize({
|
|
|
174
161
|
console.time('filter-generic');
|
|
175
162
|
sampler2d_scale_generic(source, small_scale_2);
|
|
176
163
|
console.timeEnd('filter-generic');
|
|
177
|
-
|
|
164
|
+
debug_draw_sampler(engine, small_scale_2, COMPARE_X_OFFSET, TARGET_HEIGHT);
|
|
178
165
|
})
|
|
179
166
|
|
|
180
167
|
function test_sampling(source, engine) {
|
|
181
|
-
|
|
168
|
+
debug_draw_sampler_grid({
|
|
182
169
|
engine: engine,
|
|
183
170
|
input: source,
|
|
184
171
|
// display_labels: false,
|
|
185
172
|
transforms: [
|
|
186
173
|
(out, input, params) => {
|
|
187
174
|
params.label = 'Nearest';
|
|
175
|
+
params.skip = true;
|
|
176
|
+
|
|
177
|
+
return;
|
|
188
178
|
|
|
189
179
|
const sample = [];
|
|
190
180
|
for (let y = 0; y < out.height; y++) {
|
|
@@ -217,9 +207,9 @@ function test_sampling(source, engine) {
|
|
|
217
207
|
},
|
|
218
208
|
(out, input, params) => {
|
|
219
209
|
params.label = 'Bicubic';
|
|
220
|
-
params.skip =
|
|
210
|
+
params.skip = false;
|
|
221
211
|
|
|
222
|
-
return;
|
|
212
|
+
// return;
|
|
223
213
|
|
|
224
214
|
const sample = new Uint8ClampedArray(4);
|
|
225
215
|
for (let y = 0; y < out.height; y++) {
|
|
@@ -303,7 +293,7 @@ function test_sampling(source, engine) {
|
|
|
303
293
|
|
|
304
294
|
// return;
|
|
305
295
|
|
|
306
|
-
sampler2d_scale_down_generic(input, out, kaiser_bessel_window,1);
|
|
296
|
+
sampler2d_scale_down_generic(input, out, kaiser_bessel_window, 1);
|
|
307
297
|
|
|
308
298
|
},
|
|
309
299
|
(out, input, params) => {
|
|
@@ -312,7 +302,7 @@ function test_sampling(source, engine) {
|
|
|
312
302
|
|
|
313
303
|
// return;
|
|
314
304
|
|
|
315
|
-
sampler2d_scale_down_generic(input, out, kaiser_1,1);
|
|
305
|
+
sampler2d_scale_down_generic(input, out, kaiser_1, 1);
|
|
316
306
|
|
|
317
307
|
},
|
|
318
308
|
(out, input, params) => {
|
|
@@ -344,9 +334,11 @@ function test_sampling(source, engine) {
|
|
|
344
334
|
}
|
|
345
335
|
], size: new Vector2(
|
|
346
336
|
// 100, 100
|
|
347
|
-
|
|
337
|
+
1235, 1235
|
|
338
|
+
// 1024, 1024,
|
|
339
|
+
// 512, 512
|
|
348
340
|
// 256, 256
|
|
349
|
-
128, 128
|
|
341
|
+
// 128, 128
|
|
350
342
|
// 64, 64
|
|
351
343
|
// 32,32
|
|
352
344
|
// 400,400
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridTaskDensityMarkerDistribution.d.ts","sourceRoot":"","sources":["../../../../../src/generation/grid/generation/GridTaskDensityMarkerDistribution.js"],"names":[],"mappings":"AA2BA;IA8BI;;;;;;OAMG;IACH,2EAHW,eAAe,SACf,MAAM,qCAgBhB;IA/CG;;;OAGG;IACH,oBAAmB;IAEnB;;;OAGG;IACH,kCAAkB;IAElB;;;OAGG;IACH,OAFU,eAAe,CAEa;IAEtC;;;;OAIG;IACH,eAAe;IA2BnB;;;;;;;OAOG;IACH,6EAkFC;IAED;;;;;;;;;OASG;IACH,kBARW,MAAM,sBAEN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,IAAI,CAkIhB;IAGD,iDAkEC;CACJ;
|
|
1
|
+
{"version":3,"file":"GridTaskDensityMarkerDistribution.d.ts","sourceRoot":"","sources":["../../../../../src/generation/grid/generation/GridTaskDensityMarkerDistribution.js"],"names":[],"mappings":"AA2BA;IA8BI;;;;;;OAMG;IACH,2EAHW,eAAe,SACf,MAAM,qCAgBhB;IA/CG;;;OAGG;IACH,oBAAmB;IAEnB;;;OAGG;IACH,kCAAkB;IAElB;;;OAGG;IACH,OAFU,eAAe,CAEa;IAEtC;;;;OAIG;IACH,eAAe;IA2BnB;;;;;;;OAOG;IACH,6EAkFC;IAED;;;;;;;;;OASG;IACH,kBARW,MAAM,sBAEN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,IAAI,CAkIhB;IAGD,iDAkEC;CACJ;kCAhXiC,yBAAyB;gCAT3B,gDAAgD;iBAI/D,oCAAoC;sBAC/B,yCAAyC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import { assert } from "../../../core/assert.js";
|
|
2
|
+
import { ArrayIteratorRandom } from "../../../core/collection/array/iterator/ArrayIteratorRandom.js";
|
|
1
3
|
import { clamp } from "../../../core/math/clamp.js";
|
|
4
|
+
import { clamp01 } from "../../../core/math/clamp01.js";
|
|
5
|
+
import { NumericInterval } from "../../../core/math/interval/NumericInterval.js";
|
|
2
6
|
import { min2 } from "../../../core/math/min2.js";
|
|
3
7
|
import { seededRandom } from "../../../core/math/random/seededRandom.js";
|
|
4
|
-
import { GridTaskGenerator } from "../GridTaskGenerator.js";
|
|
5
|
-
import Task from "../../../core/process/task/Task.js";
|
|
6
|
-
import { TaskSignal } from "../../../core/process/task/TaskSignal.js";
|
|
7
|
-
import { NumericInterval } from "../../../core/math/interval/NumericInterval.js";
|
|
8
|
-
import { MarkerNodeMatcherAny } from "../../markers/matcher/MarkerNodeMatcherAny.js";
|
|
9
|
-
import { assert } from "../../../core/assert.js";
|
|
10
8
|
import { computeStatisticalMean } from "../../../core/math/statistics/computeStatisticalMean.js";
|
|
9
|
+
import Task from "../../../core/process/task/Task.js";
|
|
11
10
|
import TaskGroup from "../../../core/process/task/TaskGroup.js";
|
|
12
|
-
import {
|
|
13
|
-
import { clamp01 } from "../../../core/math/clamp01.js";
|
|
11
|
+
import { TaskSignal } from "../../../core/process/task/TaskSignal.js";
|
|
14
12
|
import { actionTask } from "../../../core/process/task/util/actionTask.js";
|
|
13
|
+
import { MarkerNodeMatcherAny } from "../../markers/matcher/MarkerNodeMatcherAny.js";
|
|
14
|
+
import { GridTaskGenerator } from "../GridTaskGenerator.js";
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridActionRuleSet.d.ts","sourceRoot":"","sources":["../../../../src/generation/markers/GridActionRuleSet.js"],"names":[],"mappings":"AAoBA;IA0BI;;;;;;;OAOG;IACH,4DANW,uBAAuB,GAIrB,iBAAiB,CAkB7B;IAhDD;;;OAGG;IACH,UAFU,uBAAuB,CAEnB;IAEd;;;OAGG;IACH,QAFU,uBAAuB,GAAC,MAAM,CAEI;IAE5C;;;OAGG;IACH,SAFU,MAAM,EAAE,CAED;IAEjB;;;OAGG;IACH,aAFU,OAAO,CAEE;IA4BnB;;;OAGG;IACH,uCAEC;IAED;;;;;;OAMG;IACH,8BAJW,MAAM,eACN,MAAM,QA6HhB;CACJ;
|
|
1
|
+
{"version":3,"file":"GridActionRuleSet.d.ts","sourceRoot":"","sources":["../../../../src/generation/markers/GridActionRuleSet.js"],"names":[],"mappings":"AAoBA;IA0BI;;;;;;;OAOG;IACH,4DANW,uBAAuB,GAIrB,iBAAiB,CAkB7B;IAhDD;;;OAGG;IACH,UAFU,uBAAuB,CAEnB;IAEd;;;OAGG;IACH,QAFU,uBAAuB,GAAC,MAAM,CAEI;IAE5C;;;OAGG;IACH,SAFU,MAAM,EAAE,CAED;IAEjB;;;OAGG;IACH,aAFU,OAAO,CAEE;IA4BnB;;;OAGG;IACH,uCAEC;IAED;;;;;;OAMG;IACH,8BAJW,MAAM,eACN,MAAM,QA6HhB;CACJ;wCA1MuC,8BAA8B"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { assert } from "../../core/assert.js";
|
|
2
|
+
import { ArrayIteratorRandom } from "../../core/collection/array/iterator/ArrayIteratorRandom.js";
|
|
3
|
+
import { ArrayIteratorSequential } from "../../core/collection/array/iterator/ArrayIteratorSequential.js";
|
|
4
|
+
import { PI_HALF } from "../../core/math/PI_HALF.js";
|
|
2
5
|
import { seededRandom } from "../../core/math/random/seededRandom.js";
|
|
3
|
-
import { RuleSelectionPolicyType } from "./RuleSelectionPolicyType.js";
|
|
4
|
-
import { ArrayIteratorSequential } from "../../core/collection/array/ArrayIteratorSequential.js";
|
|
5
|
-
import { ArrayIteratorRandom } from "../../core/collection/array/ArrayIteratorRandom.js";
|
|
6
6
|
import TaskGroup from "../../core/process/task/TaskGroup.js";
|
|
7
|
-
import { randomCountTask } from "../../core/process/task/util/randomCountTask.js";
|
|
8
7
|
import { countTask } from "../../core/process/task/util/countTask.js";
|
|
9
|
-
import {
|
|
8
|
+
import { randomCountTask } from "../../core/process/task/util/randomCountTask.js";
|
|
9
|
+
import { RuleSelectionPolicyType } from "./RuleSelectionPolicyType.js";
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Turns an array of numbers into the string given by the concatenation of the
|
|
3
|
-
* characters to which the numbers correspond.
|
|
4
|
-
* @param {!Uint8Array|!Array<number>} bytes Array of numbers representing
|
|
5
|
-
* characters.
|
|
6
|
-
* @return {string} Stringification of the array.
|
|
7
|
-
*/
|
|
8
|
-
export function byteArrayToString(bytes: Uint8Array | Array<number>): string;
|
|
9
|
-
//# sourceMappingURL=byteArrayToString.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"byteArrayToString.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/byteArrayToString.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,yCAJY,UAAU,GAAE,MAAM,MAAM,CAAC,GAEzB,MAAM,CAsBjB"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Turns an array of numbers into the string given by the concatenation of the
|
|
3
|
-
* characters to which the numbers correspond.
|
|
4
|
-
* @param {!Uint8Array|!Array<number>} bytes Array of numbers representing
|
|
5
|
-
* characters.
|
|
6
|
-
* @return {string} Stringification of the array.
|
|
7
|
-
*/
|
|
8
|
-
export function byteArrayToString(bytes) {
|
|
9
|
-
const numBytes = bytes.length;
|
|
10
|
-
|
|
11
|
-
const CHUNK_SIZE = 8192;
|
|
12
|
-
|
|
13
|
-
// Special-case the simple case for speed's sake.
|
|
14
|
-
if (numBytes <= CHUNK_SIZE) {
|
|
15
|
-
return String.fromCharCode.apply(null, bytes);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// The remaining logic splits conversion by chunks since
|
|
19
|
-
// Function#apply() has a maximum parameter count.
|
|
20
|
-
// See discussion: http://goo.gl/LrWmZ9
|
|
21
|
-
|
|
22
|
-
let str = '';
|
|
23
|
-
for (let i = 0; i < numBytes; i += CHUNK_SIZE) {
|
|
24
|
-
const chunk = Array.prototype.slice.call(bytes, i, i + CHUNK_SIZE);
|
|
25
|
-
str += String.fromCharCode.apply(null, chunk);
|
|
26
|
-
}
|
|
27
|
-
return str;
|
|
28
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractArrayIterator.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/AbstractArrayIterator.js"],"names":[],"mappings":"AAAA;;GAEG;AACH;IACI;;;OAGG;IACH,iBAFW,CAAC,EAAE,QASb;IANG;;;;OAIG;IACH,kBAHU,CAAC,EAAE,CAGK;IAGtB;;OAEG;IACH,aAFW;QAAC,KAAK,EAAC,CAAC,CAAC;QAAC,IAAI,EAAC,OAAO,CAAA;KAAC,QAIjC;CACJ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayIteratorRandom.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/ArrayIteratorRandom.js"],"names":[],"mappings":"AAIA;IACI,cAOC;IAJG,YAAY;IACZ,kBAAoB;IAEpB,uBAA+B;IAGnC;;;OAGG;IACH,WAFW,MAAM,QAIhB;IAED,4BAYC;IAED,wBAgBC;CACJ;sCApDqC,4BAA4B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayIteratorSequential.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/ArrayIteratorSequential.js"],"names":[],"mappings":"AAEA;IACI,cAIC;IADG,YAAY;IAGhB,4BAIC;IAED,wBAcC;CACJ;sCA9BqC,4BAA4B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arrayPickMinElement.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/arrayPickMinElement.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,+EAHuB,MAAM,KAqC5B"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { assert } from "../../assert.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @template T
|
|
5
|
-
* @param {T[]} array
|
|
6
|
-
* @param {function(T):number} scoreFunction
|
|
7
|
-
* @returns {T}
|
|
8
|
-
*/
|
|
9
|
-
export function arrayPickMinElement(array, scoreFunction) {
|
|
10
|
-
assert.notEqual(array, undefined, 'array is undefined');
|
|
11
|
-
assert.typeOf(scoreFunction, 'function', 'scoreFunction');
|
|
12
|
-
|
|
13
|
-
let bestElement;
|
|
14
|
-
let bestScore;
|
|
15
|
-
|
|
16
|
-
const size = array.length;
|
|
17
|
-
|
|
18
|
-
if (size === 0) {
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
bestElement = array[0];
|
|
23
|
-
|
|
24
|
-
bestScore = scoreFunction(bestElement);
|
|
25
|
-
|
|
26
|
-
assert.typeOf(bestScore, 'number', 'bestScore');
|
|
27
|
-
|
|
28
|
-
for (let i = 1; i < size; i++) {
|
|
29
|
-
const el = array[i];
|
|
30
|
-
|
|
31
|
-
// compute score
|
|
32
|
-
const score = scoreFunction(el);
|
|
33
|
-
|
|
34
|
-
assert.typeOf(score, 'number', 'score');
|
|
35
|
-
|
|
36
|
-
if (score < bestScore) {
|
|
37
|
-
bestScore = score;
|
|
38
|
-
bestElement = el;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return bestElement;
|
|
43
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arraySwapElements.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/arraySwapElements.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,yDAHW,MAAM,UACN,MAAM,QAOhB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"computeArrayMax.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/computeArrayMax.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,sDAJW,MAAM,QACN,MAAM,GACL,MAAM,CAajB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"computeArrayMin.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/computeArrayMin.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,sDAJW,MAAM,QACN,MAAM,GACL,MAAM,CAajB"}
|
|
@@ -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"}
|