@woosh/meep-engine 2.119.22 → 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.22",
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;IAwKD;;;OAGG;IACH,qCAqBC;IAED,kCAEC;IAED;;;OAGG;IACH,+CAuDC;IAED,uBAMC;IAED,gBAOC;;CACJ;4BA9dM,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
 
@@ -358,15 +369,8 @@ export class VirtualTexturePage {
358
369
  min: { x: 0, y: 0 },
359
370
  max: { x: slot_resolution, y: slot_resolution },
360
371
  },
361
- // dstRegion
362
- {
363
- min: {
364
- x: write_position.x, y: write_position.y,
365
- },
366
- max: {
367
- x: write_position.x + slot_resolution, y: write_position.y + slot_resolution
368
- }
369
- }
372
+ // dstPosition
373
+ write_position
370
374
  );
371
375
  }
372
376
 
@@ -380,6 +384,14 @@ export class VirtualTexturePage {
380
384
  * @param {number[]} v
381
385
  */
382
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
+
383
395
  array_copy(
384
396
  v, 0,
385
397
  this.#page_texture_size, 0,
@@ -388,16 +400,16 @@ export class VirtualTexturePage {
388
400
 
389
401
  this.clear_resident();
390
402
 
391
- this.#page_texture.dispose();
403
+ page_texture.dispose();
392
404
 
393
405
  const width = this.#page_texture_size[0];
394
406
  const height = this.#page_texture_size[1];
395
407
 
396
- this.#page_texture.image.data = new Uint8Array(width * height * 4);
397
- this.#page_texture.image.width = width;
398
- 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;
399
411
 
400
- this.#page_texture.needsUpdate = true;
412
+ page_texture.needsUpdate = true;
401
413
 
402
414
  this.#update_residency_capacity();
403
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