@woosh/meep-engine 2.74.0 → 2.75.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 +183 -187
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +183 -187
- package/package.json +1 -1
- package/src/core/binary/UINT32_MAX.js +5 -0
- package/src/core/bvh2/bvh3/BVH.js +44 -2
- package/src/core/bvh2/bvh3/BVH.spec.js +45 -0
- package/src/core/bvh2/bvh3/build_triangle_morton_codes.js +73 -0
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js +5 -101
- package/src/core/bvh2/bvh3/ebvh_build_hierarchy.js +59 -0
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_nearest_to_point.js +31 -32
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_nearest_to_point.spec.js +64 -0
- package/src/core/collection/SCRATCH_UINT32_TRAVERSAL_STACK.js +1 -0
- package/src/core/geom/3d/aabb/aabb3_signed_distance_sqr_to_point.js +1 -0
- package/src/core/geom/3d/aabb/aabb3_unsigned_distance_sqr_to_point.js +36 -0
- package/src/core/process/worker/OnDemandWorkerManager.js +5 -1
- package/src/engine/asset/loaders/ArrayBufferLoader.js +13 -15
- package/src/engine/asset/loaders/image/ImageDecoderWorker.js +1 -1
- package/src/engine/asset/loaders/image/ImageRGBADataLoader.js +5 -7
- package/src/engine/asset/loaders/image/codec/ThreadedImageDecoder.js +1 -1
- package/src/engine/asset/loaders/image/png/PNG.js +339 -332
- package/src/engine/asset/loaders/image/png/PNGReader.js +59 -16
- package/src/engine/asset/loaders/image/png/prototypePNG.js +13 -4
- package/src/engine/graphics/texture/virtual/v2/{SparseTexture.js → PageTexture.js} +62 -18
- package/src/engine/graphics/texture/virtual/v2/ResidentTileTexture.js +46 -0
- package/src/engine/graphics/texture/virtual/v2/{TileLoader.js → VirtualTextureTileLoader.js} +11 -8
- package/src/engine/graphics/texture/virtual/v2/{UsageMetadata.js → VirtualTextureUsage.js} +2 -8
- package/src/engine/graphics/texture/virtual/v2/{VirtualTextureManager.js → VirtualTextureUsageUpdater.js} +7 -5
- package/src/engine/graphics/texture/virtual/v2/debug/ResidencyDebugView.js +17 -5
- package/src/engine/graphics/texture/virtual/v2/debug/UsageDebugView.js +1 -1
- package/src/engine/graphics/texture/virtual/v2/debug/UsagePyramidDebugView.js +1 -1
- package/src/engine/graphics/texture/virtual/v2/prototype.js +78 -59
- package/src/engine/graphics/texture/virtual/v2/tile/{TextureTile.js → VirtualTextureTile.js} +2 -2
- package/src/engine/graphics/texture/virtual/v2/tile/compose_tile_address.js +4 -0
- /package/src/engine/graphics/texture/virtual/v2/{ShaderUsage.js → VirtualTextureUsageShader.js} +0 -0
|
@@ -3,12 +3,14 @@ import {
|
|
|
3
3
|
AmbientLight,
|
|
4
4
|
Clock,
|
|
5
5
|
DirectionalLight,
|
|
6
|
+
DoubleSide,
|
|
7
|
+
Matrix4,
|
|
6
8
|
Mesh,
|
|
7
|
-
|
|
9
|
+
MeshBasicMaterial,
|
|
8
10
|
PerspectiveCamera,
|
|
11
|
+
PlaneBufferGeometry,
|
|
9
12
|
Scene,
|
|
10
13
|
TextureLoader,
|
|
11
|
-
TorusGeometry,
|
|
12
14
|
Vector2,
|
|
13
15
|
WebGLRenderer
|
|
14
16
|
} from "three";
|
|
@@ -21,8 +23,8 @@ import { ImageRGBADataLoader } from "../../../../asset/loaders/image/ImageRGBADa
|
|
|
21
23
|
import { ResidencyDebugView } from "./debug/ResidencyDebugView.js";
|
|
22
24
|
import { UsageDebugView } from "./debug/UsageDebugView.js";
|
|
23
25
|
import { UsagePyramidDebugView } from "./debug/UsagePyramidDebugView.js";
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
+
import { PageTexture } from "./PageTexture.js";
|
|
27
|
+
import { VirtualTextureUsageUpdater } from "./VirtualTextureUsageUpdater.js";
|
|
26
28
|
|
|
27
29
|
let camera,
|
|
28
30
|
/**
|
|
@@ -37,71 +39,46 @@ let camera,
|
|
|
37
39
|
|
|
38
40
|
let mesh;
|
|
39
41
|
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
am.startup();
|
|
43
|
-
|
|
44
|
-
const virtualTextureManager = new VirtualTextureManager();
|
|
45
|
-
virtualTextureManager.setTextureParameters(
|
|
46
|
-
4096,
|
|
47
|
-
// 16384,
|
|
48
|
-
32,
|
|
49
|
-
3
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
const sparseTexture = new SparseTexture();
|
|
53
|
-
sparseTexture.path = "data/textures/utility/vt/TexelDensity1";
|
|
54
|
-
sparseTexture.page_texture_size = [512, 512];
|
|
55
|
-
sparseTexture.tile_resolution = virtualTextureManager.tile_resolution;
|
|
56
|
-
sparseTexture.asset_manager = am;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
console.log(sparseTexture);
|
|
60
|
-
|
|
61
|
-
// const TEXTURE_URL = "data/textures/utility/uv_map_reference.png";
|
|
62
|
-
const TEXTURE_URL = "data/textures/utility/4096x4096TexelDensityTexture1.png";
|
|
42
|
+
const TEXTURE_URL = "data/textures/utility/uv_map_reference.png";
|
|
43
|
+
// const TEXTURE_URL = "data/textures/utility/4096x4096TexelDensityTexture1.png";
|
|
63
44
|
// const TEXTURE_URL = "data/textures/utility/Lenna.png";
|
|
64
45
|
// const TEXTURE_URL = "data/textures/utility/TESTIMAGES/SAMPLING/8BIT/RGB/2448x2448/SRC/img_2448x2448_3x8bit_SRC_RGB_cards_a.png";
|
|
65
46
|
// const TEXTURE_URL = "data/models/LowPolyTownshipSet/Town_Hall//diffuse_2048.png";
|
|
66
47
|
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
const usageDebugView = new UsageDebugView();
|
|
70
|
-
usageDebugView.mip_levels = virtualTextureManager.max_mip_level;
|
|
71
|
-
// container_view.addChild(usageDebugView);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const usagePyramidDebugView = new UsagePyramidDebugView();
|
|
75
|
-
usagePyramidDebugView.setImageURL(TEXTURE_URL);
|
|
76
|
-
container_view.addChild(usagePyramidDebugView);
|
|
77
|
-
|
|
48
|
+
const virtualTextureManager = new VirtualTextureUsageUpdater();
|
|
49
|
+
const sparseTexture = new PageTexture();
|
|
78
50
|
const residencyDebugView = new ResidencyDebugView();
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
bottom: 0,
|
|
82
|
-
right: 0
|
|
83
|
-
});
|
|
84
|
-
container_view.addChild(residencyDebugView);
|
|
51
|
+
|
|
52
|
+
const container_view = new EmptyView();
|
|
85
53
|
|
|
86
54
|
const options = {
|
|
87
|
-
spin:
|
|
55
|
+
spin: false
|
|
88
56
|
};
|
|
89
57
|
|
|
90
58
|
init();
|
|
91
|
-
animate();
|
|
92
59
|
|
|
93
|
-
|
|
94
|
-
function makeTorus() {
|
|
60
|
+
function makeMesh() {
|
|
95
61
|
const size = 0.65;
|
|
96
62
|
|
|
97
63
|
const map = new TextureLoader().load(TEXTURE_URL);
|
|
98
64
|
map.flipY = false;
|
|
99
65
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
66
|
+
// const geo = new TetrahedronBufferGeometry(size,30);
|
|
67
|
+
// const geo = new TorusGeometry(size, 0.3, 30, 30);
|
|
68
|
+
const geo = new PlaneBufferGeometry(size, size);
|
|
69
|
+
|
|
70
|
+
mesh = new Mesh(geo, new MeshBasicMaterial({
|
|
71
|
+
map,
|
|
72
|
+
side: DoubleSide
|
|
103
73
|
}));
|
|
104
|
-
|
|
74
|
+
const m4 = new Matrix4();
|
|
75
|
+
|
|
76
|
+
// m4.makeRotationZ(-Math.PI/2);
|
|
77
|
+
m4.makeScale(1, -1, -1);
|
|
78
|
+
|
|
79
|
+
geo.applyMatrix4(m4);
|
|
80
|
+
|
|
81
|
+
// mesh.rotation.x = 0.3;
|
|
105
82
|
|
|
106
83
|
scene.add(mesh);
|
|
107
84
|
}
|
|
@@ -116,7 +93,48 @@ function makeGLTF(path) {
|
|
|
116
93
|
});
|
|
117
94
|
}
|
|
118
95
|
|
|
119
|
-
function init() {
|
|
96
|
+
async function init() {
|
|
97
|
+
|
|
98
|
+
const am = new AssetManager();
|
|
99
|
+
await am.registerLoader(GameAssetType.Image, new ImageRGBADataLoader());
|
|
100
|
+
am.startup();
|
|
101
|
+
|
|
102
|
+
virtualTextureManager.setTextureParameters(
|
|
103
|
+
2048,
|
|
104
|
+
// 16384,
|
|
105
|
+
32,
|
|
106
|
+
3
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
sparseTexture.path = "data/textures/utility/vt/uv_map_reference";
|
|
110
|
+
// sparseTexture.path = "data/textures/utility/vt/Lenna";
|
|
111
|
+
// sparseTexture.path = "data/textures/utility/vt/TexelDensity1";
|
|
112
|
+
sparseTexture.page_texture_size = [128, 768];
|
|
113
|
+
sparseTexture.tile_resolution = virtualTextureManager.tile_resolution;
|
|
114
|
+
sparseTexture.asset_manager = am;
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
console.log(sparseTexture);
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
//
|
|
121
|
+
const usageDebugView = new UsageDebugView();
|
|
122
|
+
usageDebugView.mip_levels = virtualTextureManager.max_mip_level;
|
|
123
|
+
// container_view.addChild(usageDebugView);
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
const usagePyramidDebugView = new UsagePyramidDebugView();
|
|
127
|
+
usagePyramidDebugView.setImageURL(TEXTURE_URL);
|
|
128
|
+
container_view.addChild(usagePyramidDebugView);
|
|
129
|
+
|
|
130
|
+
residencyDebugView.texture = sparseTexture;
|
|
131
|
+
residencyDebugView.css({
|
|
132
|
+
bottom: 0,
|
|
133
|
+
right: 0
|
|
134
|
+
});
|
|
135
|
+
container_view.addChild(residencyDebugView);
|
|
136
|
+
|
|
137
|
+
// ===================
|
|
120
138
|
|
|
121
139
|
const container = document.body;
|
|
122
140
|
|
|
@@ -125,14 +143,15 @@ function init() {
|
|
|
125
143
|
container.appendChild(container_view.el);
|
|
126
144
|
container_view.link();
|
|
127
145
|
|
|
128
|
-
camera = new PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1,
|
|
146
|
+
camera = new PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 100);
|
|
129
147
|
camera.position.z = 4;
|
|
130
148
|
|
|
131
149
|
scene = new Scene();
|
|
132
150
|
|
|
133
151
|
clock = new Clock();
|
|
134
152
|
|
|
135
|
-
makeTorus();
|
|
153
|
+
// makeTorus();
|
|
154
|
+
makeMesh();
|
|
136
155
|
|
|
137
156
|
// makeGLTF("data/models/LowPolyTownshipSet/Town_Hall/model.gltf");
|
|
138
157
|
|
|
@@ -166,7 +185,7 @@ function init() {
|
|
|
166
185
|
gui.add(options, key);
|
|
167
186
|
});
|
|
168
187
|
|
|
169
|
-
|
|
188
|
+
animate();
|
|
170
189
|
}
|
|
171
190
|
|
|
172
191
|
function onWindowResize() {
|
|
@@ -208,10 +227,10 @@ function render() {
|
|
|
208
227
|
renderer.clear();
|
|
209
228
|
renderer.render(scene, camera)
|
|
210
229
|
|
|
211
|
-
usageDebugView.usage = virtualTextureManager.usage_metadata;
|
|
230
|
+
// usageDebugView.usage = virtualTextureManager.usage_metadata;
|
|
212
231
|
|
|
213
|
-
usagePyramidDebugView.setTextureParameters(virtualTextureManager.texture_resolution, virtualTextureManager.tile_resolution);
|
|
214
|
-
usagePyramidDebugView.usage = virtualTextureManager.usage_metadata;
|
|
232
|
+
// usagePyramidDebugView.setTextureParameters(virtualTextureManager.texture_resolution, virtualTextureManager.tile_resolution);
|
|
233
|
+
// usagePyramidDebugView.usage = virtualTextureManager.usage_metadata;
|
|
215
234
|
|
|
216
235
|
residencyDebugView.update();
|
|
217
236
|
}
|
package/src/engine/graphics/texture/virtual/v2/tile/{TextureTile.js → VirtualTextureTile.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export class
|
|
1
|
+
export class VirtualTextureTile {
|
|
2
2
|
|
|
3
3
|
finder_print = 0;
|
|
4
4
|
|
|
@@ -18,7 +18,7 @@ export class TextureTile {
|
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
*
|
|
21
|
-
* @param {
|
|
21
|
+
* @param {VirtualTextureTile} other
|
|
22
22
|
* @returns {boolean}
|
|
23
23
|
*/
|
|
24
24
|
equals(other) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { assert } from "../../../../../../core/assert.js";
|
|
1
2
|
import { split_by_2 } from "../../../../../../core/geom/3d/morton/split_by_2.js";
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -12,6 +13,9 @@ export function compose_tile_address(mip, x, y) {
|
|
|
12
13
|
// figure out resolution of this mip level
|
|
13
14
|
const mip_resolution = 1 << mip;
|
|
14
15
|
|
|
16
|
+
assert.lessThan(x, mip_resolution);
|
|
17
|
+
assert.lessThan(y, mip_resolution);
|
|
18
|
+
|
|
15
19
|
// this is basically converting something like 0100 to 0011;
|
|
16
20
|
const mip_mask = mip_resolution - 1;
|
|
17
21
|
|
/package/src/engine/graphics/texture/virtual/v2/{ShaderUsage.js → VirtualTextureUsageShader.js}
RENAMED
|
File without changes
|