@woosh/meep-engine 2.119.23 → 2.119.25
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/package.json +1 -1
- package/src/engine/graphics/texture/virtual/VT_DEFAULT_PAGE_RESOLUTION.d.ts +6 -0
- package/src/engine/graphics/texture/virtual/VT_DEFAULT_PAGE_RESOLUTION.d.ts.map +1 -0
- package/src/engine/graphics/texture/virtual/VT_DEFAULT_PAGE_RESOLUTION.js +5 -0
- package/src/engine/graphics/texture/virtual/VirtualTextureMemoryMapping.d.ts.map +1 -1
- package/src/engine/graphics/texture/virtual/VirtualTextureMemoryMapping.js +1 -0
- package/src/engine/graphics/texture/virtual/VirtualTexturePage.d.ts +6 -6
- package/src/engine/graphics/texture/virtual/VirtualTexturePage.d.ts.map +1 -1
- package/src/engine/graphics/texture/virtual/VirtualTexturePage.js +44 -17
- package/src/engine/graphics/texture/virtual/VirtualTextureSystem.d.ts +6 -4
- package/src/engine/graphics/texture/virtual/VirtualTextureSystem.d.ts.map +1 -1
- package/src/engine/graphics/texture/virtual/VirtualTextureSystem.js +7 -1
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VT_DEFAULT_PAGE_RESOLUTION.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/virtual/VT_DEFAULT_PAGE_RESOLUTION.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,yCAFU,MAAM,CAE+B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualTextureMemoryMapping.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/virtual/VirtualTextureMemoryMapping.js"],"names":[],"mappings":"AAcA;;GAEG;AACH;IAQI,4BAEC;IAWD,2BAEC;
|
|
1
|
+
{"version":3,"file":"VirtualTextureMemoryMapping.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/virtual/VirtualTextureMemoryMapping.js"],"names":[],"mappings":"AAcA;;GAEG;AACH;IAQI,4BAEC;IAWD,2BAEC;IAgBD;;;OAGG;IACH,4BAiCC;IAED,yBAEC;IAED;;;OAGG;IACH,uCAsEC;IAED;;;MAUC;IAGD,gBAEC;;CACJ;4BA/LkG,OAAO"}
|
|
@@ -25,18 +25,18 @@ export class VirtualTexturePage {
|
|
|
25
25
|
set tile_resolution(arg: number);
|
|
26
26
|
get tile_resolution(): number;
|
|
27
27
|
get tile_margin(): number;
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
* @param {string} v
|
|
31
|
-
*/
|
|
32
|
-
set path(arg: string);
|
|
33
|
-
set asset_manager(arg: any);
|
|
34
28
|
/**
|
|
35
29
|
*
|
|
36
30
|
* @param {number[]} v
|
|
37
31
|
*/
|
|
38
32
|
set page_texture_size(arg: number[]);
|
|
39
33
|
get page_texture_size(): number[];
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @param {string} v
|
|
37
|
+
*/
|
|
38
|
+
set path(arg: string);
|
|
39
|
+
set asset_manager(arg: any);
|
|
40
40
|
/**
|
|
41
41
|
*
|
|
42
42
|
* @param {VirtualTextureUsage} usage
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualTexturePage.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/virtual/VirtualTexturePage.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VirtualTexturePage.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/virtual/VirtualTexturePage.js"],"names":[],"mappings":"AA8BA;IAkBI,iDAEC;IAED;;;OAGG;IACH,cAFU,MAAM,CAEC;IAEjB;;;OAGG;IACH,SAFU,MAAM,CAEJ;IAeZ,uBAEC;IAGD,wCAEC;IAED,2BAEC;IAQD;;;OAGG;IACH,2CAEC;IAmBD;;;OAGG;IACH,iCAKC;IAbD,8BAEC;IAoBD,0BAEC;IAuPD;;;OAGG;IACH,qCA8BC;IAED,kCAEC;IAnND;;;OAGG;IACH,sBAEC;IAED,4BAIC;IAyMD;;;OAGG;IACH,+CAuDC;IAED,uBAMC;IAED,gBAOC;;CACJ;4BAlfM,OAAO"}
|
|
@@ -19,6 +19,7 @@ import { Sampler2D } from "../sampler/Sampler2D.js";
|
|
|
19
19
|
import { writeSample2DDataToDataTexture } from "../sampler/writeSampler2DDataToDataTexture.js";
|
|
20
20
|
import { tile_address_to_finger_print } from "./tile/tile_address_to_finger_print.js";
|
|
21
21
|
import { VirtualTextureTileLoader } from "./VirtualTextureTileLoader.js";
|
|
22
|
+
import { VT_DEFAULT_PAGE_RESOLUTION } from "./VT_DEFAULT_PAGE_RESOLUTION.js";
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* How much extra data to store in cache (in bytes)
|
|
@@ -28,12 +29,16 @@ import { VirtualTextureTileLoader } from "./VirtualTextureTileLoader.js";
|
|
|
28
29
|
const DEFAULT_CACHE_SIZE = 256 * 1024 * 1024;
|
|
29
30
|
|
|
30
31
|
export class VirtualTexturePage {
|
|
31
|
-
#page_texture = new DataTexture(
|
|
32
|
+
#page_texture = new DataTexture(
|
|
33
|
+
new Uint8Array(VT_DEFAULT_PAGE_RESOLUTION * VT_DEFAULT_PAGE_RESOLUTION * 4),
|
|
34
|
+
VT_DEFAULT_PAGE_RESOLUTION,
|
|
35
|
+
VT_DEFAULT_PAGE_RESOLUTION
|
|
36
|
+
);
|
|
32
37
|
|
|
33
38
|
#tile_copy_sampler = Sampler2D.uint8(4, 1, 1);
|
|
34
39
|
#tile_copy_texture = new DataTexture(this.#tile_copy_sampler.data, 1, 1);
|
|
35
40
|
|
|
36
|
-
#page_texture_size = [
|
|
41
|
+
#page_texture_size = [VT_DEFAULT_PAGE_RESOLUTION, VT_DEFAULT_PAGE_RESOLUTION];
|
|
37
42
|
|
|
38
43
|
/**
|
|
39
44
|
*
|
|
@@ -160,19 +165,32 @@ export class VirtualTexturePage {
|
|
|
160
165
|
*/
|
|
161
166
|
#asset_manager = null;
|
|
162
167
|
|
|
163
|
-
|
|
168
|
+
#page_texture_set_parameters() {
|
|
169
|
+
|
|
164
170
|
const texture = this.#page_texture;
|
|
165
171
|
|
|
166
172
|
texture.generateMipmaps = false;
|
|
173
|
+
|
|
167
174
|
texture.minFilter = NearestFilter;
|
|
168
175
|
texture.magFilter = LinearFilter;
|
|
169
|
-
|
|
176
|
+
|
|
170
177
|
texture.anisotropy = this.#tile_margin * 2;
|
|
171
178
|
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
constructor() {
|
|
182
|
+
this.#page_texture.name = "Virtual Texture / Page";
|
|
183
|
+
this.#page_texture_set_parameters();
|
|
184
|
+
this.#page_texture.needsUpdate = true;
|
|
185
|
+
|
|
186
|
+
this.#tile_copy_texture.name = "Virtual Texture / Copy Tile";
|
|
187
|
+
|
|
172
188
|
this.#tile_copy_texture.wrapT = ClampToEdgeWrapping;
|
|
173
189
|
this.#tile_copy_texture.wrapS = ClampToEdgeWrapping;
|
|
174
190
|
|
|
175
191
|
this.#loader.on.loaded.add(this.#handle_tile_loaded, this);
|
|
192
|
+
|
|
193
|
+
this.page_texture_size = [VT_DEFAULT_PAGE_RESOLUTION, VT_DEFAULT_PAGE_RESOLUTION];
|
|
176
194
|
}
|
|
177
195
|
|
|
178
196
|
/**
|
|
@@ -373,24 +391,33 @@ export class VirtualTexturePage {
|
|
|
373
391
|
* @param {number[]} v
|
|
374
392
|
*/
|
|
375
393
|
set page_texture_size(v) {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
this.#page_texture_size, 0,
|
|
379
|
-
2
|
|
380
|
-
);
|
|
394
|
+
const page_texture = this.#page_texture;
|
|
395
|
+
const page_image = page_texture.image;
|
|
381
396
|
|
|
382
|
-
this
|
|
397
|
+
const current_resolution = this.#page_texture_size;
|
|
383
398
|
|
|
384
|
-
|
|
399
|
+
if (v[0] !== current_resolution[0] || v[1] !== current_resolution[1]) {
|
|
385
400
|
|
|
386
|
-
|
|
387
|
-
|
|
401
|
+
array_copy(
|
|
402
|
+
v, 0,
|
|
403
|
+
current_resolution, 0,
|
|
404
|
+
2
|
|
405
|
+
);
|
|
388
406
|
|
|
389
|
-
|
|
390
|
-
this.#page_texture.image.width = width;
|
|
391
|
-
this.#page_texture.image.height = height;
|
|
407
|
+
this.clear_resident();
|
|
392
408
|
|
|
393
|
-
|
|
409
|
+
page_texture.dispose();
|
|
410
|
+
|
|
411
|
+
const width = current_resolution[0];
|
|
412
|
+
const height = current_resolution[1];
|
|
413
|
+
|
|
414
|
+
page_image.data = new Uint8Array(width * height * 4);
|
|
415
|
+
page_image.width = width;
|
|
416
|
+
page_image.height = height;
|
|
417
|
+
|
|
418
|
+
page_texture.needsUpdate = true;
|
|
419
|
+
|
|
420
|
+
}
|
|
394
421
|
|
|
395
422
|
this.#update_residency_capacity();
|
|
396
423
|
}
|
|
@@ -8,10 +8,12 @@ export class VirtualTextureSystem {
|
|
|
8
8
|
tile_resolution: any;
|
|
9
9
|
tile_margin: any;
|
|
10
10
|
}): void;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param {number} [page_resolution]
|
|
14
|
+
* @param {AssetManager} asset_manager
|
|
15
|
+
*/
|
|
16
|
+
initialize({ page_resolution, asset_manager }?: number): void;
|
|
15
17
|
makeMaterial(): VirtualTextureMaterial;
|
|
16
18
|
/**
|
|
17
19
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualTextureSystem.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/virtual/VirtualTextureSystem.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VirtualTextureSystem.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/virtual/VirtualTextureSystem.js"],"names":[],"mappings":"AAOA;IACI,oCAA0C;IAC1C,yBAA+B;IAC/B,qCAA2C;IAgB3C;;;;;aAeC;IAsBD;;;;OAIG;IACH,gDAHW,MAAM,QAYhB;IAED,uCAIC;IAED;;;;;OAKG;IACH,oEAaC;;CACJ;2CArG0C,iCAAiC;mCADzC,yBAAyB;4CADhB,kCAAkC;uCADvC,6BAA6B"}
|
|
@@ -3,6 +3,7 @@ import { VirtualTextureMaterial } from "./VirtualTextureMaterial.js";
|
|
|
3
3
|
import { VirtualTextureMemoryMapping } from "./VirtualTextureMemoryMapping.js";
|
|
4
4
|
import { VirtualTexturePage } from "./VirtualTexturePage.js";
|
|
5
5
|
import { VirtualTextureUsageUpdater } from "./VirtualTextureUsageUpdater.js";
|
|
6
|
+
import { VT_DEFAULT_PAGE_RESOLUTION } from "./VT_DEFAULT_PAGE_RESOLUTION.js";
|
|
6
7
|
|
|
7
8
|
export class VirtualTextureSystem {
|
|
8
9
|
updater = new VirtualTextureUsageUpdater()
|
|
@@ -60,8 +61,13 @@ export class VirtualTextureSystem {
|
|
|
60
61
|
uniforms.u_mapping_texture_width.value = mapping.texture.image.width;
|
|
61
62
|
}
|
|
62
63
|
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
* @param {number} [page_resolution]
|
|
67
|
+
* @param {AssetManager} asset_manager
|
|
68
|
+
*/
|
|
63
69
|
initialize({
|
|
64
|
-
page_resolution =
|
|
70
|
+
page_resolution = VT_DEFAULT_PAGE_RESOLUTION,
|
|
65
71
|
asset_manager
|
|
66
72
|
}) {
|
|
67
73
|
|