@woosh/meep-engine 2.73.0 → 2.74.0
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-image-decoder.js +1 -1
- package/build/meep.cjs +4 -4
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +4 -4
- package/package.json +1 -1
- package/src/engine/asset/loaders/image/codec/NativeImageDecoder.js +2 -1
- package/src/engine/asset/loaders/image/codec/ThreadedImageDecoder.js +4 -5
- package/src/engine/asset/loaders/image/png/PNGReader.js +23 -19
- package/src/engine/graphics/generate_halton_jitter.js +21 -0
- package/src/engine/graphics/render/buffer/simple-fx/taa/TemporalSupersamplingRenderPlugin.js +3 -20
- package/src/engine/graphics/texture/virtual/v2/SparseTexture.js +129 -20
- package/src/engine/graphics/texture/virtual/v2/TileLoader.js +24 -7
- package/src/engine/graphics/texture/virtual/v2/UsageMetadata.js +73 -21
- package/src/engine/graphics/texture/virtual/v2/VirtualTextureManager.js +60 -5
- package/src/engine/graphics/texture/virtual/v2/debug/ResidencyDebugView.js +58 -0
- package/src/engine/graphics/texture/virtual/v2/debug/UsageDebugView.js +63 -0
- package/src/engine/graphics/texture/virtual/v2/{UsagePyramidDebugView.js → debug/UsagePyramidDebugView.js} +30 -39
- package/src/engine/graphics/texture/virtual/v2/prototype.js +46 -21
- package/src/engine/graphics/texture/virtual/v2/{TextureTile.js → tile/TextureTile.js} +1 -1
- package/src/engine/graphics/texture/virtual/v2/tile/compose_finger_print.js +23 -0
- package/src/engine/graphics/texture/virtual/v2/tile/compose_tile_address.js +22 -0
- package/src/engine/graphics/texture/virtual/v2/tile/decompose_finger_print.js +12 -0
- package/src/engine/graphics/texture/virtual/v2/tile/finger_print_to_tile_address.js +16 -0
- package/src/engine/graphics/texture/virtual/v2/{tile_index_to_finger_print.js → tile/tile_address_to_finger_print.js} +7 -3
- package/src/view/CSS_ABSOLUTE_POSITIONING.js +5 -0
- package/src/engine/graphics/texture/virtual/v2/UsageDebugView.js +0 -64
- package/src/engine/graphics/texture/virtual/v2/compose_finger_print.js +0 -13
- package/src/engine/graphics/texture/virtual/v2/finger_print_to_tile_index.js +0 -37
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { assert } from "../../../../../../core/assert.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {number} mip
|
|
6
|
+
* @param {number} x
|
|
7
|
+
* @param {number} y
|
|
8
|
+
* @returns {number}
|
|
9
|
+
*/
|
|
10
|
+
export function compose_finger_print(mip, x, y) {
|
|
11
|
+
// validate
|
|
12
|
+
assert.isNonNegativeInteger(x, 'x');
|
|
13
|
+
assert.isNonNegativeInteger(y, 'y');
|
|
14
|
+
assert.isNonNegativeInteger(mip, 'mip');
|
|
15
|
+
|
|
16
|
+
assert.lessThan(x, (1 << mip), 'x');
|
|
17
|
+
assert.lessThan(y, (1 << mip), 'y');
|
|
18
|
+
|
|
19
|
+
return (mip << 24)
|
|
20
|
+
| (x << 16)
|
|
21
|
+
| (y << 8)
|
|
22
|
+
;
|
|
23
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { split_by_2 } from "../../../../../../core/geom/3d/morton/split_by_2.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {number} mip
|
|
6
|
+
* @param {number} x
|
|
7
|
+
* @param {number} y
|
|
8
|
+
* @returns {number}
|
|
9
|
+
*/
|
|
10
|
+
export function compose_tile_address(mip, x, y) {
|
|
11
|
+
|
|
12
|
+
// figure out resolution of this mip level
|
|
13
|
+
const mip_resolution = 1 << mip;
|
|
14
|
+
|
|
15
|
+
// this is basically converting something like 0100 to 0011;
|
|
16
|
+
const mip_mask = mip_resolution - 1;
|
|
17
|
+
|
|
18
|
+
// where data for this mip starts
|
|
19
|
+
const index_offset = split_by_2(mip_mask);
|
|
20
|
+
|
|
21
|
+
return index_offset + x + y * mip_resolution;
|
|
22
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number} finger_print
|
|
4
|
+
* @returns {{mip: number, x: number, y: number}}
|
|
5
|
+
*/
|
|
6
|
+
export function decompose_finger_print(finger_print) {
|
|
7
|
+
const mip = (finger_print >> 24) & 0xFF;
|
|
8
|
+
const x = (finger_print >> 16) & 0xFF;
|
|
9
|
+
const y = (finger_print >> 8) & 0xFF;
|
|
10
|
+
|
|
11
|
+
return { mip, x, y };
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { compose_tile_address } from "./compose_tile_address.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {number} finger_print
|
|
6
|
+
* @returns {number}
|
|
7
|
+
*/
|
|
8
|
+
export function finger_print_to_tile_address(finger_print) {
|
|
9
|
+
// decode fingerprint
|
|
10
|
+
const mip = (finger_print >> 24) & 0xFF;
|
|
11
|
+
const x = (finger_print >> 16) & 0xFF;
|
|
12
|
+
const y = (finger_print >> 8) & 0xFF;
|
|
13
|
+
|
|
14
|
+
return compose_tile_address(mip, x, y);
|
|
15
|
+
}
|
|
16
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { split_by_2 } from "
|
|
1
|
+
import { split_by_2 } from "../../../../../../core/geom/3d/morton/split_by_2.js";
|
|
2
2
|
import { compose_finger_print } from "./compose_finger_print.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -6,7 +6,7 @@ import { compose_finger_print } from "./compose_finger_print.js";
|
|
|
6
6
|
* @param {number} index
|
|
7
7
|
* @returns {number}
|
|
8
8
|
*/
|
|
9
|
-
export function
|
|
9
|
+
export function tile_address_to_finger_print(index) {
|
|
10
10
|
for (let mip = 0; mip < 99; mip++) {
|
|
11
11
|
const resolution = 1 << mip;
|
|
12
12
|
|
|
@@ -14,7 +14,11 @@ export function tile_index_to_finger_print(index) {
|
|
|
14
14
|
|
|
15
15
|
const index_offset = split_by_2(mip_mask);
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const next_mip_mask = mip_mask << 1 | 0x1;
|
|
18
|
+
|
|
19
|
+
const index_offset_next = split_by_2(next_mip_mask);
|
|
20
|
+
|
|
21
|
+
if (index >= index_offset_next) {
|
|
18
22
|
continue;
|
|
19
23
|
}
|
|
20
24
|
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import LabelView from "../../../../../view/common/LabelView.js";
|
|
2
|
-
import EmptyView from "../../../../../view/elements/EmptyView.js";
|
|
3
|
-
|
|
4
|
-
export class UsageDebugView extends EmptyView {
|
|
5
|
-
#tileCount = new LabelView("")
|
|
6
|
-
#tiles = new EmptyView();
|
|
7
|
-
#mip_levels = 0;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
constructor(opt) {
|
|
11
|
-
super(opt);
|
|
12
|
-
|
|
13
|
-
this.addChild(this.#tileCount);
|
|
14
|
-
this.addChild(this.#tiles);
|
|
15
|
-
|
|
16
|
-
this.css({
|
|
17
|
-
position: "absolute",
|
|
18
|
-
left: "0",
|
|
19
|
-
top: "0",
|
|
20
|
-
background: "rgba(255,255,255,0.5)",
|
|
21
|
-
fontFamily: "monospace",
|
|
22
|
-
fontSize: "10px"
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
set mip_levels(v) {
|
|
27
|
-
this.#mip_levels = v;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
*
|
|
32
|
-
* @param {UsageMetadata} usage
|
|
33
|
-
*/
|
|
34
|
-
set usage(usage) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
this.#tiles.removeAllChildren();
|
|
38
|
-
|
|
39
|
-
let tileCount = 0;
|
|
40
|
-
|
|
41
|
-
for (let mip = 0; mip < this.#mip_levels; mip++) {
|
|
42
|
-
const resolution = 1 << mip;
|
|
43
|
-
|
|
44
|
-
for (let y = 0; y < resolution; y++) {
|
|
45
|
-
for (let x = 0; x < resolution; x++) {
|
|
46
|
-
|
|
47
|
-
const count = usage.getCountBy(mip, x, y);
|
|
48
|
-
|
|
49
|
-
if (count <= 0) {
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
this.#tiles.addChild(new LabelView(`ID: ${0} Level: ${mip} X: ${x} Y: ${y} USAGE: ${count}`));
|
|
54
|
-
|
|
55
|
-
tileCount++;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
this.#tileCount.updateText(`Tile Count: ${tileCount}`);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { split_by_2 } from "../../../../../core/geom/3d/morton/split_by_2.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* @param {number} finger_print
|
|
6
|
-
* @returns {{mip: number, x: number, y: number}}
|
|
7
|
-
*/
|
|
8
|
-
export function decompose_finger_print(finger_print) {
|
|
9
|
-
const mip = (finger_print >> 24) & 0xFF;
|
|
10
|
-
const x = (finger_print >> 16) & 0xFF;
|
|
11
|
-
const y = (finger_print >> 8) & 0xFF;
|
|
12
|
-
|
|
13
|
-
return { mip, x, y };
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
* @param {number} finger_print
|
|
19
|
-
* @returns {number}
|
|
20
|
-
*/
|
|
21
|
-
export function finger_print_to_tile_index(finger_print) {
|
|
22
|
-
// decode fingerprint
|
|
23
|
-
const mip = (finger_print >> 24) & 0xFF;
|
|
24
|
-
const x = (finger_print >> 16) & 0xFF;
|
|
25
|
-
const y = (finger_print >> 8) & 0xFF;
|
|
26
|
-
|
|
27
|
-
// figure out resolution of this mip level
|
|
28
|
-
const mip_resolution = 1 << mip;
|
|
29
|
-
|
|
30
|
-
// this is basically converting something like 0100 to 0011;
|
|
31
|
-
const mip_mask = mip_resolution - 1;
|
|
32
|
-
|
|
33
|
-
// where data for this mip starts
|
|
34
|
-
const index_offset = split_by_2(mip_mask);
|
|
35
|
-
|
|
36
|
-
return index_offset + x + y * mip_resolution;
|
|
37
|
-
}
|