@woosh/meep-engine 2.119.12 → 2.119.15

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.
Files changed (80) hide show
  1. package/README.md +9 -0
  2. package/build/bundle-worker-terrain.js +1 -1
  3. package/package.json +1 -1
  4. package/src/core/collection/array/typed/array_buffer_hash.d.ts +9 -0
  5. package/src/core/collection/array/typed/array_buffer_hash.d.ts.map +1 -0
  6. package/src/core/collection/array/typed/array_buffer_hash.js +39 -0
  7. package/src/core/collection/array/typed/uint16_array_hash.d.ts +9 -0
  8. package/src/core/collection/array/typed/uint16_array_hash.d.ts.map +1 -0
  9. package/src/core/collection/array/typed/uint16_array_hash.js +29 -0
  10. package/src/core/collection/array/typed/uint32_array_hash.d.ts +9 -0
  11. package/src/core/collection/array/typed/uint32_array_hash.d.ts.map +1 -0
  12. package/src/core/collection/array/typed/uint32_array_hash.js +20 -0
  13. package/src/core/collection/array/typed/uint8_array_hash.d.ts +9 -0
  14. package/src/core/collection/array/typed/uint8_array_hash.d.ts.map +1 -0
  15. package/src/core/collection/array/typed/uint8_array_hash.js +36 -0
  16. package/src/core/geom/3d/sphere/sphere_project.d.ts +10 -0
  17. package/src/core/geom/3d/sphere/sphere_project.d.ts.map +1 -0
  18. package/src/core/geom/3d/sphere/sphere_project.js +39 -0
  19. package/src/core/geom/3d/sphere/sphere_projected_sphere_radius_sqr.d.ts +9 -0
  20. package/src/core/geom/3d/sphere/sphere_projected_sphere_radius_sqr.d.ts.map +1 -0
  21. package/src/core/geom/3d/sphere/sphere_projected_sphere_radius_sqr.js +45 -0
  22. package/src/core/geom/Quaternion.d.ts.map +1 -1
  23. package/src/core/geom/Quaternion.js +8 -17
  24. package/src/core/graph/layout/box/position_box_next_to_box.d.ts.map +1 -1
  25. package/src/core/graph/layout/box/position_box_next_to_box.js +0 -23
  26. package/src/core/parser/simple/readArrayLiteral.d.ts +9 -0
  27. package/src/core/parser/simple/readArrayLiteral.d.ts.map +1 -0
  28. package/src/core/parser/simple/readArrayLiteral.js +73 -0
  29. package/src/core/parser/simple/readLiteralToken.d.ts.map +1 -1
  30. package/src/core/parser/simple/readLiteralToken.js +1 -53
  31. package/src/core/parser/simple/skipWhitespace.d.ts +2 -2
  32. package/src/core/parser/simple/skipWhitespace.d.ts.map +1 -1
  33. package/src/core/parser/simple/skipWhitespace.js +4 -4
  34. package/src/engine/ecs/components/Tag.d.ts.map +1 -1
  35. package/src/engine/ecs/components/Tag.js +0 -1
  36. package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescriptionTable.d.ts.map +1 -1
  37. package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescriptionTable.js +14 -19
  38. package/src/engine/ecs/systems/AnimationSystem.d.ts.map +1 -1
  39. package/src/engine/ecs/systems/AnimationSystem.js +2 -2
  40. package/src/engine/graphics/ecs/animation/animator/AnimationGraphSystem.d.ts.map +1 -1
  41. package/src/engine/graphics/ecs/animation/animator/AnimationGraphSystem.js +2 -2
  42. package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts +0 -8
  43. package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts.map +1 -1
  44. package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +0 -32
  45. package/src/engine/graphics/sh3/lpv/util/lpv_visualise_probes.d.ts +10 -0
  46. package/src/engine/graphics/sh3/lpv/util/lpv_visualise_probes.d.ts.map +1 -0
  47. package/src/engine/graphics/sh3/lpv/util/lpv_visualise_probes.js +33 -0
  48. package/src/engine/graphics/sh3/prototypeSH3Probe.js +3 -2
  49. package/src/engine/graphics/texture/atlas/AtlasPatch.d.ts.map +1 -1
  50. package/src/engine/graphics/texture/atlas/AtlasPatch.js +62 -63
  51. package/src/engine/graphics/texture/sampler/Sampler2D.d.ts.map +1 -1
  52. package/src/engine/graphics/texture/sampler/Sampler2D.js +9 -25
  53. package/src/engine/graphics/texture/virtual/NOTES.md +11 -2
  54. package/src/engine/graphics/texture/virtual/VirtualTextureMaterial.d.ts +1 -1
  55. package/src/engine/graphics/texture/virtual/VirtualTextureMaterial.d.ts.map +1 -1
  56. package/src/engine/graphics/texture/virtual/VirtualTextureMaterial.js +1 -12
  57. package/src/engine/graphics/texture/virtual/VirtualTexturePage.d.ts.map +1 -1
  58. package/src/engine/graphics/texture/virtual/VirtualTexturePage.js +0 -10
  59. package/src/engine/graphics/texture/virtual/VirtualTextureSystem.d.ts.map +1 -1
  60. package/src/engine/graphics/texture/virtual/VirtualTextureSystem.js +0 -2
  61. package/src/engine/graphics/trail/x/RibbonXMaterialSpec.d.ts.map +1 -1
  62. package/src/engine/graphics/trail/x/RibbonXMaterialSpec.js +6 -7
  63. package/src/engine/save/GameStateLoader.d.ts.map +1 -1
  64. package/src/engine/save/GameStateLoader.js +6 -9
  65. package/src/engine/save/StorageBackedList.d.ts.map +1 -1
  66. package/src/engine/save/StorageBackedList.js +16 -19
  67. package/src/generation/grid/generation/GridTaskApplyActionToCells.d.ts.map +1 -1
  68. package/src/generation/grid/generation/GridTaskApplyActionToCells.js +12 -16
  69. package/src/generation/grid/generation/GridTaskExecuteRuleTimes.d.ts.map +1 -1
  70. package/src/generation/grid/generation/GridTaskExecuteRuleTimes.js +6 -6
  71. package/src/generation/grid/generation/GridTaskSequence.d.ts.map +1 -1
  72. package/src/generation/grid/generation/GridTaskSequence.js +5 -5
  73. package/src/generation/grid/generation/discrete/GridTaskActionRuleSet.d.ts +2 -6
  74. package/src/generation/grid/generation/discrete/GridTaskActionRuleSet.d.ts.map +1 -1
  75. package/src/generation/grid/generation/discrete/GridTaskActionRuleSet.js +1 -1
  76. package/src/generation/grid/generation/road/RoadConnection.d.ts.map +1 -1
  77. package/src/generation/grid/generation/road/RoadConnection.js +17 -15
  78. package/src/engine/graphics/util/projectSphere.d.ts +0 -24
  79. package/src/engine/graphics/util/projectSphere.d.ts.map +0 -1
  80. package/src/engine/graphics/util/projectSphere.js +0 -103
@@ -3,11 +3,12 @@ import { Base64 } from "../../../../core/binary/base64/Base64.js";
3
3
  import {
4
4
  compute_typed_array_constructor_from_data_type
5
5
  } from "../../../../core/binary/type/DataType2TypedArrayConstructorMapping.js";
6
+ import { array_buffer_hash } from "../../../../core/collection/array/typed/array_buffer_hash.js";
6
7
  import {
7
8
  compute_binary_data_type_from_typed_array
8
9
  } from "../../../../core/collection/array/typed/compute_binary_data_type_from_typed_array.js";
9
10
  import { is_typed_array_equals } from "../../../../core/collection/array/typed/is_typed_array_equals.js";
10
- import { typed_array_is_integer } from "../../../../core/collection/array/typed/typed_array_is_integer.js";
11
+ import { isTypedArray } from "../../../../core/collection/array/typed/isTypedArray.js";
11
12
  import {
12
13
  typedArrayConstructorByInstance
13
14
  } from "../../../../core/collection/array/typed/typedArrayConstructorByInstance.js";
@@ -888,39 +889,22 @@ export class Sampler2D {
888
889
  let hash = (((width & 0xFFFF) << 16) | (height & 0xFFFF)) ^ item_size;
889
890
 
890
891
  const texel_count = width * height;
891
-
892
- const sample_limit = Math.min(2048 / item_size, texel_count);
893
-
894
- const step_size = Math.max(1, Math.round(texel_count / sample_limit));
892
+ const element_count = texel_count * item_size;
895
893
 
896
894
  // we want to hash all channels for each chosen texel
897
895
 
898
- if (typed_array_is_integer(data)) {
899
-
900
- // integers don't require extra hashing
901
- for (let i = 0; i < texel_count; i += step_size) {
902
-
903
-
904
- for (let j = 0; j < item_size; j++) {
905
-
906
- const channel_value = data[i * item_size + j];
896
+ if (isTypedArray(data)) {
907
897
 
908
- hash = ((hash << 5) - hash) + channel_value;
909
-
910
- }
911
-
912
- }
898
+ hash ^= array_buffer_hash(data.buffer, data.byteOffset, data.byteLength);
913
899
 
914
900
  } else {
915
- for (let i = 0; i < texel_count; i += step_size) {
916
-
917
- for (let j = 0; j < item_size; j++) {
901
+ // floating point texture
918
902
 
919
- const channel_value = data[i * item_size + j];
903
+ for (let i = 0; i < element_count; ++i) {
920
904
 
921
- hash = ((hash << 5) - hash) + computeHashFloat(channel_value);
905
+ const channel_value = data[i];
922
906
 
923
- }
907
+ hash = ((hash << 5) - hash) + computeHashFloat(channel_value);
924
908
 
925
909
  }
926
910
  }
@@ -88,8 +88,17 @@ https://forum.babylonjs.com/t/speeding-up-readpixels/12739
88
88
 
89
89
  ## References
90
90
 
91
- * https://studiopixl.com/2022-04-27/sparse-virtual-textures
92
- * Anisotropic filtering in a shader: https://www.shadertoy.com/view/4lXfzn
91
+ * [Shadertoy: Anisotropic filtering in a shader](https://www.shadertoy.com/view/4lXfzn)
92
+ * ["Adaptive Virtual Texture Rendering in Far Cry 4" by Ka Chen, Ubisoft. 2015](https://ubm-twvideo01.s3.amazonaws.com/o1/vault/gdc2015/presentations/Chen_Ka_AdaptiveVirtualTexture.pdf)
93
+ * "id Tech 5 Challenges: From Texture Virtualization to Massive Parallelization" by J.M.P. van Waveren, id Software, SIGGRAPH 2009
94
+ * "Using Virtual Texturing to Handle Massive Texture Data" by J.M.P. van Waveren, id Software, 2010
95
+ * "Software Virtual Textures" by J.M.P. van Waveren, id Software, 2012
96
+ * "Advanced Virtual Texture Topics" by Matrin Mittring, Crytek GmbH, SIGGRAPH 2008
97
+ * "Atlas Shrugged: Device-agnostic Radiance Megatextures" by Mark Magro et al, University of Malta, VISIGRAPP 2020
98
+ * ["Sparse virtual textures" by Nathan Gauër, 2022](https://studiopixl.com/2022-04-27/sparse-virtual-textures)
99
+ * "Terrain in Battlefield 3: A modern, complete and scalable system" by Mattias Widmark, EA Digital Illusions (DICE), GDC 2012
100
+ * "Virtual Texturing in Software and Hardware" by Juraj Obert (AMD) et al, SIGGRAPH 2012
101
+ * "Virtual Texturing" by Albert Julian Mayer, 2010
93
102
 
94
103
  ## WebGL fails
95
104
 
@@ -1,6 +1,6 @@
1
1
  export class VirtualTextureMaterial extends ShaderMaterial {
2
2
  constructor({ uniforms }: {
3
- uniforms: any;
3
+ uniforms?: {};
4
4
  });
5
5
  }
6
6
  import { ShaderMaterial } from "three";
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualTextureMaterial.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/virtual/VirtualTextureMaterial.js"],"names":[],"mappings":"AAEA;IACI;;OAyKC;CACJ;+BA7K0C,OAAO"}
1
+ {"version":3,"file":"VirtualTextureMaterial.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/virtual/VirtualTextureMaterial.js"],"names":[],"mappings":"AAEA;IACI;;OA8JC;CACJ;+BAlK0C,OAAO"}
@@ -2,18 +2,13 @@ import { DoubleSide, ShaderMaterial } from "three";
2
2
 
3
3
  export class VirtualTextureMaterial extends ShaderMaterial {
4
4
  constructor({
5
- uniforms
5
+ uniforms = {}
6
6
  }) {
7
7
  super({
8
8
  side: DoubleSide,
9
9
  uniforms,
10
10
  vertexShader: `
11
11
 
12
- // uniform mat4 modelViewMatrix;
13
- // uniform mat4 projectionMatrix;
14
-
15
- // in vec2 uv;
16
- // in vec3 position;
17
12
  out vec2 vUv;
18
13
 
19
14
  void main()
@@ -154,12 +149,6 @@ export class VirtualTextureMaterial extends ShaderMaterial {
154
149
 
155
150
  return mip_blend;
156
151
 
157
- // return vec4(lod_fract, mip_blend.y, mip_blend.z, 1.0);
158
-
159
- // return texelFetch( u_page, tuv, 0 );
160
-
161
- // return VirtualFetchLod(uv, 7u);
162
- // return vec4(uv, texture_lod / 7.0,1.0);
163
152
  }
164
153
 
165
154
  void main(){
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualTexturePage.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/virtual/VirtualTexturePage.js"],"names":[],"mappings":"AAsBA;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;IA0JD;;;OAGG;IACH,qCAqBC;IAED,kCAEC;IAED;;;OAGG;IACH,+CAuDC;IAED,uBAMC;IAED,gBAOC;;CACJ;4BAhdsF,OAAO"}
1
+ {"version":3,"file":"VirtualTexturePage.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/virtual/VirtualTexturePage.js"],"names":[],"mappings":"AAsBA;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;IAgJD;;;OAGG;IACH,qCAqBC;IAED,kCAEC;IAED;;;OAGG;IACH,+CAuDC;IAED,uBAMC;IAED,gBAOC;;CACJ;4BAtcsF,OAAO"}
@@ -327,16 +327,6 @@ export class VirtualTexturePage {
327
327
  writeSample2DDataToDataTexture(copy_sampler, this.#tile_copy_texture);
328
328
  }
329
329
 
330
- //
331
- // const tile_margin = this.#tile_margin;
332
- //
333
- // copy_sampler.copyWithMargin(
334
- // tile.data, 0, 0,
335
- // tile_margin, tile_margin,
336
- // this.#tile_resolution, this.#tile_resolution,
337
- // tile_margin, tile_margin, tile_margin, tile_margin
338
- // );
339
-
340
330
  this.#tile_copy_texture.image.data.set(tile.data.data);
341
331
  this.#tile_copy_texture.needsUpdate = true;
342
332
 
@@ -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;;;aAWC;IAED,uCAIC;IAED;;;;;OAKG;IACH,oEAaC;;CACJ;2CAjG0C,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":"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"}
@@ -68,8 +68,6 @@ export class VirtualTextureSystem {
68
68
 
69
69
  this.page.page_texture_size = [page_resolution, page_resolution];
70
70
  this.page.asset_manager = asset_manager;
71
- // this.page.tile_margin = tile_margin;
72
-
73
71
 
74
72
  }
75
73
 
@@ -1 +1 @@
1
- {"version":3,"file":"RibbonXMaterialSpec.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/trail/x/RibbonXMaterialSpec.js"],"names":[],"mappings":"AAGA;IAEQ;;;OAGG;IACH,SAFU,SAAO,IAAI,CAEF;IAGvB,4BAEC;IAED,eAEC;IAED;;aASC;CACJ"}
1
+ {"version":3,"file":"RibbonXMaterialSpec.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/trail/x/RibbonXMaterialSpec.js"],"names":[],"mappings":"AAGA;IAEI;;;OAGG;IACH,SAFU,SAAO,IAAI,CAEN;IAEf,4BAEC;IAED,eAEC;IAED;;aASC;CACJ"}
@@ -2,13 +2,12 @@ import { assert } from "../../../../core/assert.js";
2
2
  import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
3
3
 
4
4
  export class RibbonXMaterialSpec {
5
- constructor() {
6
- /**
7
- *
8
- * @type {String|null}
9
- */
10
- this.diffuse = null;
11
- }
5
+
6
+ /**
7
+ *
8
+ * @type {String|null}
9
+ */
10
+ diffuse = null;
12
11
 
13
12
  equals(other) {
14
13
  return this.diffuse === other.diffuse;
@@ -1 +1 @@
1
- {"version":3,"file":"GameStateLoader.d.ts","sourceRoot":"","sources":["../../../../src/engine/save/GameStateLoader.js"],"names":[],"mappings":";AAIA;IAIQ,WAA6B;IAE7B;;;OAGG;IACH,SAFU,OAAO,CAEE;IAGvB,yBAEC;IAED,gEAeC;IAED;;;;;;OAMG;IACH,iBALW,MAAM,iEAShB;IAED;;;;;OAKG;IACH,yDAIC;IAED;;;;;;OAMG;IACH,WALW,MAAM,kBACG,WAAW,yCAEX,MAAM,gBA6CzB;IAED;;;;;OAKG;IACH,YAJW,MAAM,kBACG,MAAM,kCAoBzB;IAED;;;;;OAKG;IACH,aAJW,MAAM,kBACG,OAAO,kCAwB1B;CACJ;6BAtK4B,2BAA2B"}
1
+ {"version":3,"file":"GameStateLoader.d.ts","sourceRoot":"","sources":["../../../../src/engine/save/GameStateLoader.js"],"names":[],"mappings":";AAIA;IAEI,WAAyB;IAEzB;;;OAGG;IACH,SAFU,OAAO,CAEF;IAEf,yBAEC;IAED,gEAeC;IAED;;;;;;OAMG;IACH,iBALW,MAAM,iEAShB;IAED;;;;;OAKG;IACH,yDAIC;IAED;;;;;;OAMG;IACH,WALW,MAAM,kBACG,WAAW,yCAEX,MAAM,gBA6CzB;IAED;;;;;OAKG;IACH,YAJW,MAAM,kBACG,MAAM,kCAoBzB;IAED;;;;;OAKG;IACH,aAJW,MAAM,kBACG,OAAO,kCAwB1B;CACJ;6BAnK4B,2BAA2B"}
@@ -3,17 +3,14 @@ import { array_pick_best_element } from "../../core/collection/array/array_pick_
3
3
  import { EnginePlugin } from "../plugin/EnginePlugin.js";
4
4
 
5
5
  class GameStateLoader extends EnginePlugin {
6
- constructor() {
7
- super();
8
6
 
9
- this.id = 'game-state-loader';
7
+ id = 'game-state-loader';
10
8
 
11
- /**
12
- *
13
- * @type {Storage}
14
- */
15
- this.storage = null;
16
- }
9
+ /**
10
+ *
11
+ * @type {Storage}
12
+ */
13
+ storage = null;
17
14
 
18
15
  async startup() {
19
16
  this.storage = this.engine.storage;
@@ -1 +1 @@
1
- {"version":3,"file":"StorageBackedList.d.ts","sourceRoot":"","sources":["../../../../src/engine/save/StorageBackedList.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IAKQ;;;OAGG;IACH,KAFU,MAAM,CAEH;IACb;;;OAGG;IACH,SAFU,OAAO,CAEE;IAEnB;;;OAGG;IACH,oBAAoC;IAGxC;;;;OAIG;IACH,6BAHW,MAAM,QAShB;IAED;;;OAGG;IACH,QAFY,QAAQ,CAAC,EAAE,CAAC,CAiCvB;IAED;;;;OAIG;IACH,WAHW,CAAC,GACA,QAAQ,CAAC,EAAE,CAAC,CAoBvB;IAED;;;;OAIG;IACH,gBAHW,CAAC,GACA,QAAQ,OAAO,CAAC,CAU3B;IAGD;;;OAGG;IACH,cAHW,CAAC,GACC,QAAQ,OAAO,CAAC,CAqB5B;CACJ"}
1
+ {"version":3,"file":"StorageBackedList.d.ts","sourceRoot":"","sources":["../../../../src/engine/save/StorageBackedList.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IAEI;;;OAGG;IACH,KAFU,MAAM,CAEP;IACT;;;OAGG;IACH,SAFU,OAAO,CAEF;IAEf;;;OAGG;IACH,oBAAgC;IAGhC;;;;OAIG;IACH,6BAHW,MAAM,QAShB;IAED;;;OAGG;IACH,QAFY,QAAQ,CAAC,EAAE,CAAC,CAiCvB;IAED;;;;OAIG;IACH,WAHW,CAAC,GACA,QAAQ,CAAC,EAAE,CAAC,CAoBvB;IAED;;;;OAIG;IACH,gBAHW,CAAC,GACA,QAAQ,OAAO,CAAC,CAU3B;IAGD;;;OAGG;IACH,cAHW,CAAC,GACC,QAAQ,OAAO,CAAC,CAqB5B;CACJ"}
@@ -6,27 +6,24 @@ import { returnTrue } from "../../core/function/returnTrue.js";
6
6
  * @template T
7
7
  */
8
8
  export class StorageBackedSet {
9
+
9
10
  /**
10
- * @template T
11
+ *
12
+ * @type {string}
11
13
  */
12
- constructor() {
13
- /**
14
- *
15
- * @type {string}
16
- */
17
- this.key = "";
18
- /**
19
- *
20
- * @type {Storage}
21
- */
22
- this.storage = null;
23
-
24
- /**
25
- * @private
26
- * @type {Promise}
27
- */
28
- this.lastPromise = Promise.resolve();
29
- }
14
+ key = "";
15
+ /**
16
+ *
17
+ * @type {Storage}
18
+ */
19
+ storage = null;
20
+
21
+ /**
22
+ * @private
23
+ * @type {Promise}
24
+ */
25
+ lastPromise = Promise.resolve();
26
+
30
27
 
31
28
  /**
32
29
  *
@@ -1 +1 @@
1
- {"version":3,"file":"GridTaskApplyActionToCells.d.ts","sourceRoot":"","sources":["../../../../../src/generation/grid/generation/GridTaskApplyActionToCells.js"],"names":[],"mappings":"AAOA;IAkBI;;;;;;OAMG;IACH,uDALa,0BAA0B,CAetC;IA/BG;;;OAGG;IACH,QAFU,iBAAe,IAAI,CAEX;IAElB;;;OAGG;IACH,SAFU,eAAa,IAAI,CAER;IAuBvB,iDAwCC;CACJ;kCArFiC,yBAAyB;sBAErC,yCAAyC"}
1
+ {"version":3,"file":"GridTaskApplyActionToCells.d.ts","sourceRoot":"","sources":["../../../../../src/generation/grid/generation/GridTaskApplyActionToCells.js"],"names":[],"mappings":"AAOA;IAcI;;;;;;OAMG;IACH,uDALa,0BAA0B,CAetC;IA7BD;;;OAGG;IACH,QAFU,iBAAe,IAAI,CAEf;IAEd;;;OAGG;IACH,SAFU,eAAa,IAAI,CAEZ;IAqBf,iDAwCC;CACJ;kCA5EiC,yBAAyB;sBAHrC,yCAAyC"}
@@ -1,27 +1,23 @@
1
- import { GridTaskGenerator } from "../GridTaskGenerator.js";
2
1
  import { assert } from "../../../core/assert.js";
3
- import TaskGroup from "../../../core/process/task/TaskGroup.js";
4
2
  import Task from "../../../core/process/task/Task.js";
3
+ import TaskGroup from "../../../core/process/task/TaskGroup.js";
5
4
  import { TaskSignal } from "../../../core/process/task/TaskSignal.js";
6
5
  import { actionTask } from "../../../core/process/task/util/actionTask.js";
6
+ import { GridTaskGenerator } from "../GridTaskGenerator.js";
7
7
 
8
8
  export class GridTaskApplyActionToCells extends GridTaskGenerator {
9
- constructor() {
10
- super();
11
-
12
- /**
13
- *
14
- * @type {GridCellAction|null}
15
- */
16
- this.action = null;
17
9
 
18
- /**
19
- *
20
- * @type {CellSupplier|null}
21
- */
22
- this.fitness = null;
10
+ /**
11
+ *
12
+ * @type {GridCellAction|null}
13
+ */
14
+ action = null;
23
15
 
24
- }
16
+ /**
17
+ *
18
+ * @type {CellSupplier|null}
19
+ */
20
+ fitness = null;
25
21
 
26
22
  /**
27
23
  *
@@ -1 +1 @@
1
- {"version":3,"file":"GridTaskExecuteRuleTimes.d.ts","sourceRoot":"","sources":["../../../../../src/generation/grid/generation/GridTaskExecuteRuleTimes.js"],"names":[],"mappings":"AAUA;IAUI;;;;OAIG;IACH,iDAFW,MAAM,4BAShB;IApBG;;;OAGG;IACH,4BAAY;IAEZ,cAAU;IAgBd,iDA+EC;CACJ;kCA1GiC,yBAAyB;sBAHrC,yCAAyC"}
1
+ {"version":3,"file":"GridTaskExecuteRuleTimes.d.ts","sourceRoot":"","sources":["../../../../../src/generation/grid/generation/GridTaskExecuteRuleTimes.js"],"names":[],"mappings":"AAUA;IAUI;;;;OAIG;IACH,iDAFW,MAAM,4BAShB;IApBD;;;OAGG;IACH,4BAAY;IAEZ,cAAU;IAgBV,iDA+EC;CACJ;kCA1GiC,yBAAyB;sBAHrC,yCAAyC"}
@@ -10,13 +10,13 @@ import { GridTaskGenerator } from "../GridTaskGenerator.js";
10
10
 
11
11
  export class GridTaskExecuteRuleTimes extends GridTaskGenerator {
12
12
 
13
- /**
14
- *
15
- * @type {GridCellPlacementRule}
16
- */
17
- rule = null;
13
+ /**
14
+ *
15
+ * @type {GridCellPlacementRule}
16
+ */
17
+ rule = null;
18
18
 
19
- count = 1;
19
+ count = 1;
20
20
 
21
21
  /**
22
22
  *
@@ -1 +1 @@
1
- {"version":3,"file":"GridTaskSequence.d.ts","sourceRoot":"","sources":["../../../../../src/generation/grid/generation/GridTaskSequence.js"],"names":[],"mappings":"AAGA;IAQI;;;;OAIG;IACH,sBAHW,iBAAiB,EAAE,GACjB,gBAAgB,CAQ5B;IAjBG;;;OAGG;IACH,UAFU,iBAAiB,EAAE,CAEf;IAelB,iDA2BC;CACJ;kCAnDiC,yBAAyB;sBADrC,yCAAyC"}
1
+ {"version":3,"file":"GridTaskSequence.d.ts","sourceRoot":"","sources":["../../../../../src/generation/grid/generation/GridTaskSequence.js"],"names":[],"mappings":"AAGA;IAQI;;;;OAIG;IACH,sBAHW,iBAAiB,EAAE,GACjB,gBAAgB,CAQ5B;IAjBD;;;OAGG;IACH,UAFU,iBAAiB,EAAE,CAEf;IAed,iDA2BC;CACJ;kCAnDiC,yBAAyB;sBADrC,yCAAyC"}
@@ -3,11 +3,11 @@ import { GridTaskGenerator } from "../GridTaskGenerator.js";
3
3
 
4
4
  export class GridTaskSequence extends GridTaskGenerator {
5
5
 
6
- /**
7
- *
8
- * @type {GridTaskGenerator[]}
9
- */
10
- children = [];
6
+ /**
7
+ *
8
+ * @type {GridTaskGenerator[]}
9
+ */
10
+ children = [];
11
11
 
12
12
  /**
13
13
  *
@@ -1,16 +1,12 @@
1
1
  export class GridTaskActionRuleSet extends GridTaskGenerator {
2
2
  /**
3
3
  *
4
- * @param name
4
+ * @param {string} [name]
5
5
  * @param {GridActionRuleSet} rules
6
6
  * @param {number} [resolution=1]
7
7
  * @returns {GridTaskActionRuleSet}
8
8
  */
9
- static from({ name, rules, resolution }: {
10
- name: any;
11
- rules: any;
12
- resolution?: number;
13
- }): GridTaskActionRuleSet;
9
+ static from({ name, rules, resolution }?: string): GridTaskActionRuleSet;
14
10
  /**
15
11
  *
16
12
  * @type {GridActionRuleSet}
@@ -1 +1 @@
1
- {"version":3,"file":"GridTaskActionRuleSet.d.ts","sourceRoot":"","sources":["../../../../../../src/generation/grid/generation/discrete/GridTaskActionRuleSet.js"],"names":[],"mappings":"AAGA;IAcI;;;;;;OAMG;IACH;;;;QAFa,qBAAqB,CAejC;IAhCD;;;OAGG;IACH,yBAAa;IAEb;;;OAGG;IACH,YAFU,MAAM,CAED;IAwBf,2CAEC;CACJ;kCAzCiC,4BAA4B"}
1
+ {"version":3,"file":"GridTaskActionRuleSet.d.ts","sourceRoot":"","sources":["../../../../../../src/generation/grid/generation/discrete/GridTaskActionRuleSet.js"],"names":[],"mappings":"AAGA;IAcI;;;;;;OAMG;IACH,0CALW,MAAM,GAGJ,qBAAqB,CAejC;IAhCD;;;OAGG;IACH,yBAAa;IAEb;;;OAGG;IACH,YAFU,MAAM,CAED;IAwBf,2CAEC;CACJ;kCAzCiC,4BAA4B"}
@@ -17,7 +17,7 @@ export class GridTaskActionRuleSet extends GridTaskGenerator {
17
17
 
18
18
  /**
19
19
  *
20
- * @param name
20
+ * @param {string} [name]
21
21
  * @param {GridActionRuleSet} rules
22
22
  * @param {number} [resolution=1]
23
23
  * @returns {GridTaskActionRuleSet}
@@ -1 +1 @@
1
- {"version":3,"file":"RoadConnection.d.ts","sourceRoot":"","sources":["../../../../../../src/generation/grid/generation/road/RoadConnection.js"],"names":[],"mappings":"AAEA;IAqBI;;;;;OAKG;IACH,iEAFW,MAAM,EAAE,kBAgBlB;IAvCG;;;OAGG;IACH,qBAAc;IAEd;;;OAGG;IACH,qBAAc;IAEd;;;OAGG;IACH,SAFU,MAAM,EAAE,CAEL;IAyBjB;;;;OAIG;IACH,oCAFW,MAAM,QAuBhB;IAED;;;;OAIG;IACH,YAHW,MAAM,GACJ,OAAO,CAcnB;IAED;;;;OAIG;IACH,4CAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,4BAHW,MAAM,GACJ,OAAO,CAInB;CACJ"}
1
+ {"version":3,"file":"RoadConnection.d.ts","sourceRoot":"","sources":["../../../../../../src/generation/grid/generation/road/RoadConnection.js"],"names":[],"mappings":"AAEA;IAqBI;;;;;OAKG;IACH,iEAFW,MAAM,EAAE,kBAgBlB;IAvCD;;;OAGG;IACH,qBAAc;IAEd;;;OAGG;IACH,qBAAc;IAEd;;;OAGG;IACH,SAFU,MAAM,EAAE,CAEL;IAyBb;;;;OAIG;IACH,oCAFW,MAAM,QAuBhB;IAED;;;;OAIG;IACH,YAHW,MAAM,GACJ,OAAO,CAgBnB;IAED;;;;OAIG;IACH,4CAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,4BAHW,MAAM,GACJ,OAAO,CAInB;CACJ"}
@@ -2,23 +2,23 @@ import { assert } from "../../../../core/assert.js";
2
2
 
3
3
  export class RoadConnection {
4
4
 
5
- /**
6
- *
7
- * @type {PathEndPoint}
8
- */
9
- source = null;
5
+ /**
6
+ *
7
+ * @type {PathEndPoint}
8
+ */
9
+ source = null;
10
10
 
11
- /**
12
- *
13
- * @type {PathEndPoint}
14
- */
15
- target = null;
11
+ /**
12
+ *
13
+ * @type {PathEndPoint}
14
+ */
15
+ target = null;
16
16
 
17
- /**
18
- *
19
- * @type {number[]}
20
- */
21
- indices = [];
17
+ /**
18
+ *
19
+ * @type {number[]}
20
+ */
21
+ indices = [];
22
22
 
23
23
 
24
24
  /**
@@ -88,6 +88,8 @@ export class RoadConnection {
88
88
  return true;
89
89
  }
90
90
  }
91
+
92
+ return false;
91
93
  }
92
94
 
93
95
  /**
@@ -1,24 +0,0 @@
1
- /**
2
- * Computations of screen-space pixel area covered by a sphere
3
- * NOTE: Port of GLSL code by Ingo Quilez. Source: http://www.iquilezles.org/www/articles/sphereproj/sphereproj.htm
4
- * @param {Vector4} sph Sphere in world space
5
- * @param {Matrix4} cam camera transform matrix (world to camera)(inverse world matrix of camera)
6
- * @param {number} fl focal length (fov in Radians)
7
- * @returns {number} area on the screen as a fraction, 1=entire screen, 0=zero area
8
- */
9
- export function projectSphere(sph: Vector4, cam: Matrix4, fl: number): number;
10
- /**
11
- *
12
- * @param {number[]} v3
13
- * @param {number[]} matrix
14
- */
15
- export function v3_compute_perspective_divide(v3: number[], matrix: number[]): number;
16
- /**
17
- *
18
- * @param {number} fl
19
- * @param {number[]} matrix
20
- * @param {number[]} sph
21
- * @returns {number}
22
- */
23
- export function compute_projected_sphere_radius_sqr(fl: number, matrix: number[], sph: number[]): number;
24
- //# sourceMappingURL=projectSphere.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"projectSphere.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/util/projectSphere.js"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AACH,8DAHW,MAAM,GACJ,MAAM,CA0BlB;AAED;;;;GAIG;AACH,kDAHW,MAAM,EAAE,UACR,MAAM,EAAE,UAgBlB;AAED;;;;;;GAMG;AACH,wDALW,MAAM,UACN,MAAM,EAAE,OACR,MAAM,EAAE,GACN,MAAM,CAoClB"}
@@ -1,103 +0,0 @@
1
- import { assert } from "../../../core/assert.js";
2
- import { v3_dot } from "../../../core/geom/vec3/v3_dot.js";
3
- import { v4_multiply_mat4 } from "../../../core/geom/vec4/v4_multiply_mat4.js";
4
-
5
- const v4 = [];
6
-
7
- /**
8
- * Computations of screen-space pixel area covered by a sphere
9
- * NOTE: Port of GLSL code by Ingo Quilez. Source: http://www.iquilezles.org/www/articles/sphereproj/sphereproj.htm
10
- * @param {Vector4} sph Sphere in world space
11
- * @param {Matrix4} cam camera transform matrix (world to camera)(inverse world matrix of camera)
12
- * @param {number} fl focal length (fov in Radians)
13
- * @returns {number} area on the screen as a fraction, 1=entire screen, 0=zero area
14
- */
15
- export function projectSphere(sph, cam, fl) {
16
- assert.notEqual(null, cam, 'camera matrix is null');
17
-
18
- v4[0] = sph.x;
19
- v4[1] = sph.y;
20
- v4[2] = sph.z;
21
- v4[3] = 1;
22
-
23
- //transform to camera space
24
- v4_multiply_mat4(v4, v4, cam.elements);
25
-
26
- const r2 = sph.w * sph.w;
27
-
28
- const v4_x = v4[0];
29
- const v4_y = v4[1];
30
- const v4_z = v4[2];
31
-
32
- const z2 = v4_z * v4_z;
33
-
34
- const l2 = v3_dot(v4_x, v4_y, v4_z, v4_x, v4_y, v4_z);
35
-
36
- const area = -Math.PI * fl * fl * r2 * Math.sqrt(Math.abs((l2 - r2) / (r2 - z2))) / (r2 - z2);
37
-
38
- return area;
39
- }
40
-
41
- /**
42
- *
43
- * @param {number[]} v3
44
- * @param {number[]} matrix
45
- */
46
- export function v3_compute_perspective_divide(v3, matrix) {
47
- v4[0] = v3[0];
48
- v4[1] = v3[1];
49
- v4[2] = v3[2];
50
- v4[3] = 1;
51
-
52
- //transform sphere center to camera space
53
- v4_multiply_mat4(v4, v4, matrix);
54
-
55
- const v4_w = v4[3];
56
-
57
- const d = 0.5 / Math.abs(v4_w);
58
-
59
- return d;
60
- }
61
-
62
- /**
63
- *
64
- * @param {number} fl
65
- * @param {number[]} matrix
66
- * @param {number[]} sph
67
- * @returns {number}
68
- */
69
- export function compute_projected_sphere_radius_sqr(fl, matrix, sph) {
70
- v4[0] = sph[0];
71
- v4[1] = sph[1];
72
- v4[2] = sph[2];
73
- v4[3] = 1;
74
-
75
- //transform sphere center to camera space
76
- v4_multiply_mat4(v4, v4, matrix);
77
-
78
- const r2 = sph[3] * sph[3];
79
-
80
- const v4_x = v4[0];
81
- const v4_y = v4[1];
82
- const v4_z = v4[2];
83
- const v4_w = v4[3];
84
-
85
- const d = 0.5 / Math.abs(v4_w);
86
-
87
- const x = v4_x;
88
- const y = v4_y;
89
- const z = v4_z;
90
-
91
- const z2 = z * x;
92
-
93
- const l2 = v3_dot(x, y, z, x, y, z);
94
-
95
- const sigma = Math.abs(r2 - z2);
96
- const alpha = Math.sqrt(Math.abs(l2 - r2) / sigma);
97
-
98
- const beta = fl * fl * r2 * alpha / sigma;
99
-
100
-
101
-
102
- return beta*d;
103
- }