@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 CHANGED
@@ -5,7 +5,7 @@
5
5
  "description": "Fully featured ECS game engine written in JavaScript",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.119.23",
8
+ "version": "2.119.25",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Default resolution of virtual page texture
3
+ * @type {number}
4
+ */
5
+ export const VT_DEFAULT_PAGE_RESOLUTION: number;
6
+ //# sourceMappingURL=VT_DEFAULT_PAGE_RESOLUTION.d.ts.map
@@ -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"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Default resolution of virtual page texture
3
+ * @type {number}
4
+ */
5
+ export const VT_DEFAULT_PAGE_RESOLUTION = 4096;
@@ -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;IAeD;;;OAGG;IACH,4BAiCC;IAED,yBAEC;IAED;;;OAGG;IACH,uCAsEC;IAED;;;MAUC;IAGD,gBAEC;;CACJ;4BA9LkG,OAAO"}
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"}
@@ -42,6 +42,7 @@ export class VirtualTextureMemoryMapping {
42
42
 
43
43
  constructor() {
44
44
  const texture = this.#texture;
45
+ texture.name = "Virtual Texture / Dereference Mapping"
45
46
 
46
47
  texture.internalFormat = "R32UI";
47
48
  texture.generateMipmaps = false;
@@ -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":"AA6BA;IAcI,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;IA6DD;;;OAGG;IACH,sBAEC;IAED,4BAIC;IAiKD;;;OAGG;IACH,qCAqBC;IAED,kCAEC;IAED;;;OAGG;IACH,+CAuDC;IAED,uBAMC;IAED,gBAOC;;CACJ;4BAvdM,OAAO"}
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(new Uint8Array(4), 1, 1);
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 = [1, 1];
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
- constructor() {
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
- // texture.magFilter = NearestFilter;
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
- array_copy(
377
- v, 0,
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.clear_resident();
397
+ const current_resolution = this.#page_texture_size;
383
398
 
384
- this.#page_texture.dispose();
399
+ if (v[0] !== current_resolution[0] || v[1] !== current_resolution[1]) {
385
400
 
386
- const width = this.#page_texture_size[0];
387
- const height = this.#page_texture_size[1];
401
+ array_copy(
402
+ v, 0,
403
+ current_resolution, 0,
404
+ 2
405
+ );
388
406
 
389
- this.#page_texture.image.data = new Uint8Array(width * height * 4);
390
- this.#page_texture.image.width = width;
391
- this.#page_texture.image.height = height;
407
+ this.clear_resident();
392
408
 
393
- this.#page_texture.needsUpdate = true;
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
- initialize({ page_resolution, asset_manager }: {
12
- page_resolution?: number;
13
- asset_manager: any;
14
- }): void;
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":"AAMA;IACI,oCAA0C;IAC1C,yBAA+B;IAC/B,qCAA2C;IAgB3C;;;;;aAeC;IAsBD;;;aASC;IAED,uCAIC;IAED;;;;;OAKG;IACH,oEAaC;;CACJ;2CA/F0C,iCAAiC;mCADzC,yBAAyB;4CADhB,kCAAkC;uCADvC,6BAA6B"}
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 = 2048,
70
+ page_resolution = VT_DEFAULT_PAGE_RESOLUTION,
65
71
  asset_manager
66
72
  }) {
67
73