@woosh/meep-engine 2.119.23 → 2.119.24

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.24",
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":"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;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;IAuED;;;OAGG;IACH,sBAEC;IAED,4BAIC;IAiKD;;;OAGG;IACH,qCA6BC;IAED,kCAEC;IAED;;;OAGG;IACH,+CAuDC;IAED,uBAMC;IAED,gBAOC;;CACJ;4BA1eM,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,7 +29,7 @@ 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(new Uint8Array(VT_DEFAULT_PAGE_RESOLUTION * VT_DEFAULT_PAGE_RESOLUTION * 4), VT_DEFAULT_PAGE_RESOLUTION, VT_DEFAULT_PAGE_RESOLUTION);
32
33
 
33
34
  #tile_copy_sampler = Sampler2D.uint8(4, 1, 1);
34
35
  #tile_copy_texture = new DataTexture(this.#tile_copy_sampler.data, 1, 1);
@@ -160,15 +161,25 @@ export class VirtualTexturePage {
160
161
  */
161
162
  #asset_manager = null;
162
163
 
163
- constructor() {
164
+ #page_texture_set_parameters() {
165
+
164
166
  const texture = this.#page_texture;
165
167
 
166
168
  texture.generateMipmaps = false;
169
+
167
170
  texture.minFilter = NearestFilter;
168
171
  texture.magFilter = LinearFilter;
169
- // texture.magFilter = NearestFilter;
172
+
170
173
  texture.anisotropy = this.#tile_margin * 2;
171
174
 
175
+ }
176
+
177
+ constructor() {
178
+ this.#page_texture.name = "Virtual Texture / Page";
179
+ this.#page_texture_set_parameters();
180
+
181
+ this.#tile_copy_texture.name = "Virtual Texture / Copy Tile";
182
+
172
183
  this.#tile_copy_texture.wrapT = ClampToEdgeWrapping;
173
184
  this.#tile_copy_texture.wrapS = ClampToEdgeWrapping;
174
185
 
@@ -373,6 +384,14 @@ export class VirtualTexturePage {
373
384
  * @param {number[]} v
374
385
  */
375
386
  set page_texture_size(v) {
387
+ const page_texture = this.#page_texture;
388
+ const page_image = page_texture.image;
389
+
390
+ if (v[0] === page_image.width && v[1] === page_image.height) {
391
+ // nothing to do
392
+ return;
393
+ }
394
+
376
395
  array_copy(
377
396
  v, 0,
378
397
  this.#page_texture_size, 0,
@@ -381,16 +400,16 @@ export class VirtualTexturePage {
381
400
 
382
401
  this.clear_resident();
383
402
 
384
- this.#page_texture.dispose();
403
+ page_texture.dispose();
385
404
 
386
405
  const width = this.#page_texture_size[0];
387
406
  const height = this.#page_texture_size[1];
388
407
 
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;
408
+ page_image.data = new Uint8Array(width * height * 4);
409
+ page_image.width = width;
410
+ page_image.height = height;
392
411
 
393
- this.#page_texture.needsUpdate = true;
412
+ page_texture.needsUpdate = true;
394
413
 
395
414
  this.#update_residency_capacity();
396
415
  }
@@ -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;;;aASC;IAED,uCAIC;IAED;;;;;OAKG;IACH,oEAaC;;CACJ;2CAhG0C,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()
@@ -61,7 +62,7 @@ export class VirtualTextureSystem {
61
62
  }
62
63
 
63
64
  initialize({
64
- page_resolution = 2048,
65
+ page_resolution = VT_DEFAULT_PAGE_RESOLUTION,
65
66
  asset_manager
66
67
  }) {
67
68