@woosh/meep-engine 2.49.6 → 2.49.8

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 (85) hide show
  1. package/editor/enableEditor.js +1 -8
  2. package/package.json +1 -1
  3. package/samples/terrain/editor.js +2 -2
  4. package/src/core/cache/Cache.js +1 -1
  5. package/src/core/cache/LoadingCache.d.ts +2 -0
  6. package/src/core/cache/LoadingCache.js +45 -18
  7. package/src/core/collection/HashSet.js +1 -1
  8. package/src/core/collection/table/RowFirstTableSpec.js +110 -92
  9. package/src/core/collection/table/RowFirstTableSpec.spec.js +49 -0
  10. package/src/core/color/Color.d.ts +4 -2
  11. package/src/core/color/Color.js +7 -8
  12. package/src/core/color/Color.spec.js +93 -0
  13. package/src/core/color/hex2rgb.spec.js +10 -0
  14. package/src/core/color/rgb2hex.js +1 -1
  15. package/src/core/color/rgb2hex.spec.js +13 -0
  16. package/src/core/fsm/simple/SimpleStateMachine.spec.js +75 -0
  17. package/src/core/fsm/simple/SimpleStateMachineDescription.js +1 -1
  18. package/src/core/fsm/simple/SimpleStateMachineDescription.spec.js +32 -0
  19. package/src/core/geom/2d/Rectangle.spec.js +51 -0
  20. package/src/core/geom/3d/aabb/aabb3_intersects_ray.spec.js +90 -0
  21. package/src/core/geom/3d/line/line3_compute_nearest_point_to_point.spec.js +61 -0
  22. package/src/core/geom/3d/morton/mortonEncode_magicbits.js +1 -34
  23. package/src/core/geom/3d/morton/split_by_2.js +17 -0
  24. package/src/core/geom/3d/morton/split_by_3.js +16 -0
  25. package/src/core/geom/3d/plane/computePlaneLineIntersection.js +6 -1
  26. package/src/core/geom/3d/sphere/sphere_intersects_ray.spec.js +11 -0
  27. package/src/core/geom/3d/sphere/sphere_radius_sqr_from_v3_array_transformed.spec.js +8 -0
  28. package/src/core/geom/3d/topology/samples/sampleFloodFill.js +3 -3
  29. package/src/core/geom/3d/topology/struct/binary/io/OrderedEdge.js +1 -1
  30. package/src/core/geom/random/randomPointOnBox.spec.js +57 -0
  31. package/src/core/math/computeGreatestCommonDivisor.spec.js +9 -0
  32. package/src/core/math/statistics/computeStatisticalMean.spec.js +9 -0
  33. package/src/core/math/statistics/halton_sequence.spec.js +6 -1
  34. package/src/core/model/node-graph/node/Port.spec.js +10 -1
  35. package/src/core/model/reactive/evaluation/MultiPredicateEvaluator.js +5 -8
  36. package/src/core/model/reactive/evaluation/MultiPredicateEvaluator.spec.js +41 -0
  37. package/src/core/model/reactive/trigger/BlackboardTrigger.js +5 -0
  38. package/src/core/model/reactive/trigger/BlackboardTrigger.spec.js +24 -0
  39. package/src/core/parser/simple/readBooleanToken.js +38 -0
  40. package/src/core/parser/simple/readHexToken.js +95 -0
  41. package/src/core/parser/simple/readHexToken.spec.js +21 -0
  42. package/src/core/parser/simple/readIdentifierToken.js +43 -0
  43. package/src/core/parser/simple/readIdentifierToken.spec.js +32 -0
  44. package/src/core/parser/simple/readLiteralToken.js +96 -0
  45. package/src/core/parser/simple/readNumberToken.js +73 -0
  46. package/src/core/parser/simple/readNumberToken.spec.js +17 -0
  47. package/src/core/parser/simple/readReferenceToken.js +48 -0
  48. package/src/core/parser/simple/readReferenceToken.spec.js +18 -0
  49. package/src/core/parser/simple/readStringToken.js +94 -0
  50. package/src/core/parser/simple/readStringToken.spec.js +57 -0
  51. package/src/core/parser/simple/{readUnsignedInteger.js → readUnsignedIntegerToken.js} +1 -1
  52. package/src/core/parser/simple/readUnsignedIntegerToken.spec.js +6 -0
  53. package/src/core/process/executor/ConcurrentExecutor.js +147 -234
  54. package/src/engine/Engine.d.ts +4 -2
  55. package/src/engine/Engine.js +62 -41
  56. package/src/engine/Engine.spec.js +11 -0
  57. package/src/engine/InputEngine.js +12 -0
  58. package/src/engine/graphics/GraphicsEngine.js +2 -13
  59. package/src/engine/graphics/ecs/compileAllMaterials.js +1 -1
  60. package/src/engine/graphics/ecs/mesh/createTaskWaitForMeshesToLoad.js +1 -1
  61. package/src/engine/graphics/impostors/octahedral/ImpostorBaker.js +1 -1
  62. package/src/engine/graphics/load_and_set_cubemap_v0.js +21 -0
  63. package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +1 -1
  64. package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +3 -5
  65. package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +2 -4
  66. package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +1 -1
  67. package/src/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +1 -1
  68. package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +2 -4
  69. package/src/engine/graphics/sh3/prototypeSH3Probe.js +4 -4
  70. package/src/engine/graphics/texture/sampler/copy_Sampler2D_channel_data.js +4 -3
  71. package/src/engine/graphics/texture/virtual/VirtualTexture.js +9 -0
  72. package/src/engine/graphics/texture/virtual/VirtualTexture.spec.js +5 -4
  73. package/src/engine/graphics/texture/virtual/tile/TileLoader.js +5 -0
  74. package/src/engine/input/devices/PointerDevice.spec.js +7 -0
  75. package/src/engine/intelligence/blackboard/Blackboard.d.ts +4 -0
  76. package/src/engine/intelligence/blackboard/Blackboard.js +11 -0
  77. package/src/engine/platform/InMemoryEnginePlatform.js +20 -0
  78. package/src/engine/save/Storage.d.ts +7 -7
  79. package/src/engine/save/storage/InMemoryStorage.js +34 -0
  80. package/src/generation/grid/generation/road/GridTaskGenerateRoads.js +2 -2
  81. package/src/view/tooltip/gml/parser/readReferenceValueToken.js +2 -2
  82. package/src/core/parser/simple/SimpleParser.js +0 -464
  83. package/src/core/parser/simple/SimpleParser.spec.js +0 -105
  84. /package/src/core/collection/{IteratorUtils.js → collectIteratorValueToArray.js} +0 -0
  85. /package/src/core/color/{ColorUtils.js → parseColor.js} +0 -0
@@ -36,7 +36,6 @@ import { MaterialManager } from "./material/manager/MaterialManager.js";
36
36
  import { ShadowMapRenderer } from "./shadows/ShadowMapRenderer.js";
37
37
  import { CameraViewManager } from "./render/view/CameraViewManager.js";
38
38
  import { StandardFrameBuffers } from "./StandardFrameBuffers.js";
39
- import { load_environment_map } from "./texture/cubemap/load_environment_map.js";
40
39
  import { CompositingStages } from "./composit/CompositingStages.js";
41
40
  import { DEG_TO_RAD } from "../../core/math/DEG_TO_RAD.js";
42
41
 
@@ -256,22 +255,12 @@ GraphicsEngine.prototype.getRenderer = function () {
256
255
  };
257
256
 
258
257
  /**
259
- *
258
+ * @deprecated
260
259
  * @param {string[]|string} paths URLs to faces of the cubemap
261
260
  * @returns {Promise<Texture>}
262
261
  */
263
262
  GraphicsEngine.prototype.loadEnvironmentMap = async function (paths) {
264
-
265
- const { filtered } = await load_environment_map({
266
- path: paths,
267
- renderer: this.renderer,
268
- original: false,
269
- filtered: true
270
- });
271
-
272
- this.scene.environment = filtered;
273
-
274
- return filtered;
263
+ throw new Error('Deprecated use `load_and_set_cubemap_v0` instead');
275
264
  }
276
265
 
277
266
  GraphicsEngine.prototype.updateSize = function () {
@@ -1,7 +1,7 @@
1
1
  import { Mesh, PlaneBufferGeometry } from "three";
2
2
  import Task from "../../../core/process/task/Task.js";
3
3
  import { TaskSignal } from "../../../core/process/task/TaskSignal.js";
4
- import { collectIteratorValueToArray } from "../../../core/collection/IteratorUtils.js";
4
+ import { collectIteratorValueToArray } from "../../../core/collection/collectIteratorValueToArray.js";
5
5
  import { clamp01 } from "../../../core/math/clamp01.js";
6
6
 
7
7
  /**
@@ -4,7 +4,7 @@ import Task from "../../../../core/process/task/Task.js";
4
4
  import { TaskSignal } from "../../../../core/process/task/TaskSignal.js";
5
5
  import { assert } from "../../../../core/assert.js";
6
6
  import { assetTypeByPath } from "./assetTypeByPath.js";
7
- import { collectIteratorValueToArray } from "../../../../core/collection/IteratorUtils.js";
7
+ import { collectIteratorValueToArray } from "../../../../core/collection/collectIteratorValueToArray.js";
8
8
  import { clamp01 } from "../../../../core/math/clamp01.js";
9
9
 
10
10
  /**
@@ -14,7 +14,7 @@ import { UvEncoder } from "./grid/UvEncoder.js";
14
14
  import { OctahedralUvEncoder } from "./grid/OctahedralUvEncoder.js";
15
15
  import { HemiOctahedralUvEncoder } from "./grid/HemiOctahedralUvEncoder.js";
16
16
  import { prepare_bake_material } from "./bake/prepare_bake_material.js";
17
- import { collectIteratorValueToArray } from "../../../../core/collection/IteratorUtils.js";
17
+ import { collectIteratorValueToArray } from "../../../../core/collection/collectIteratorValueToArray.js";
18
18
  import { compute_bounding_sphere } from "./bake/compute_bounding_sphere.js";
19
19
  import { build_cutout_from_atlas_by_alpha } from "./util/build_cutout_from_atlas_by_alpha.js";
20
20
 
@@ -0,0 +1,21 @@
1
+ import { buildCubeURLs } from "./texture/cubemap/buildCubeURLs.js";
2
+ import { load_environment_map } from "./texture/cubemap/load_environment_map.js";
3
+
4
+ /**
5
+ *
6
+ * @param {GraphicsEngine} graphics
7
+ * @param {string} folder_path
8
+ * @param {string} file_extension
9
+ */
10
+ export async function load_and_set_cubemap_v0(graphics, folder_path, file_extension) {
11
+ const paths = buildCubeURLs(folder_path, file_extension);
12
+
13
+ const { filtered } = await load_environment_map({
14
+ path: paths,
15
+ renderer: this.renderer,
16
+ original: false,
17
+ filtered: true
18
+ });
19
+
20
+ graphics.scene.environment = filtered;
21
+ }
@@ -7,7 +7,7 @@ import { Sampler2D } from "../../texture/sampler/Sampler2D.js";
7
7
  import { array_push_if_unique } from "../../../../core/collection/array/array_push_if_unique.js";
8
8
  import { computeMaterialHash } from "../../../asset/loaders/material/computeMaterialHash.js";
9
9
  import { computeMaterialEquality } from "../../../asset/loaders/material/computeMaterialEquality.js";
10
- import { collectIteratorValueToArray } from "../../../../core/collection/IteratorUtils.js";
10
+ import { collectIteratorValueToArray } from "../../../../core/collection/collectIteratorValueToArray.js";
11
11
  import {
12
12
  AdditiveBlending,
13
13
  ClampToEdgeWrapping,
@@ -27,7 +27,6 @@ import { PathDisplaySystem } from "../../../../../ecs/path/PathDisplaySystem.js"
27
27
  import RenderSystem from "../../../../../../ecs/systems/RenderSystem.js";
28
28
  import { makeEngineOptionsModel } from "../../../../../../../../../model/game/options/makeEngineOptionsModel.js";
29
29
  import { enableEditor } from "../../../../../../../../editor/enableEditor.js";
30
- import { buildCubeURLs } from "../../../../../texture/cubemap/buildCubeURLs.js";
31
30
  import {
32
31
  AmbientOcclusionPostProcessEffect
33
32
  } from "../../../../../render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.js";
@@ -36,7 +35,7 @@ import Vector3 from "../../../../../../../core/geom/Vector3.js";
36
35
  import EntityBuilder from "../../../../../../ecs/EntityBuilder.js";
37
36
  import { Transform } from "../../../../../../ecs/transform/Transform.js";
38
37
  import Mesh from "../../../../../ecs/mesh/Mesh.js";
39
- import { AABB3 } from "../../../../../../../core/bvh2/aabb3/AABB3.js";
38
+ import { AABB3 } from "../../../../../../../core/geom/3d/aabb/AABB3.js";
40
39
  import { ParticleVolume } from "./ParticleVolume.js";
41
40
  import { ParticleEmitterSystem } from "../../../../ecs/ParticleEmitterSystem.js";
42
41
  import { BehaviorComponent } from "../../../../../../intelligence/behavior/ecs/BehaviorComponent.js";
@@ -75,13 +74,13 @@ import ButtonView from "../../../../../../../view/elements/button/ButtonView.js"
75
74
  import { UnitSphereShape3D } from "../../../../../../../core/geom/3d/shape/UnitSphereShape3D.js";
76
75
  import TopDownCameraController from "../../../../../ecs/camera/topdown/TopDownCameraController.js";
77
76
  import { randomFloatBetween } from "../../../../../../../core/math/random/randomFloatBetween.js";
78
- import { MicronRenderPlugin } from "../../../../../micron/plugin/MicronRenderPlugin.js";
79
77
  import { obtainTerrain } from "../../../../../../ecs/terrain/util/obtainTerrain.js";
80
78
  import { pick } from "../../../../../../ecs/grid/pick.js";
81
79
  import { clamp01 } from "../../../../../../../core/math/clamp01.js";
82
80
  import { randomFromArray } from "../../../../../../../core/math/random/randomFromArray.js";
83
81
  import { SamplingFunctionKind } from "./SamplingFunctionKind.js";
84
82
  import { RGBA_LUT_HEATMAP_IR } from "../../parameter/sample/RGBA_LUT_HEATMAP_IR.js";
83
+ import { load_and_set_cubemap_v0 } from "../../../../../load_and_set_cubemap_v0.js";
85
84
 
86
85
  const engineHarness = new EngineHarness();
87
86
 
@@ -134,7 +133,6 @@ function makeConfig(engine) {
134
133
 
135
134
 
136
135
  // Plugins
137
- config.addPlugin(MicronRenderPlugin);
138
136
  config.addPlugin(AmbientOcclusionPostProcessEffect);
139
137
 
140
138
 
@@ -160,7 +158,7 @@ async function init(harness) {
160
158
 
161
159
  enableEditor(engine);
162
160
 
163
- await engine.graphics.loadEnvironmentMap(buildCubeURLs('data/textures/cubemaps/hip_miramar/32/', '.png'));
161
+ await load_and_set_cubemap_v0(engine.graphics, 'data/textures/cubemaps/hip_miramar/32/', '.png');
164
162
 
165
163
 
166
164
  await harness.initialize();
@@ -63,9 +63,8 @@ import {
63
63
  } from "three";
64
64
  import { AmbientOcclusionPostProcessEffect } from "../simple-fx/ao/AmbientOcclusionPostProcessEffect.js";
65
65
  import { PathDisplaySystem } from "../../../ecs/path/PathDisplaySystem.js";
66
- import { MicronRenderPlugin } from "../../../micron/plugin/MicronRenderPlugin.js";
67
66
  import { StandardFrameBuffers } from "../../../StandardFrameBuffers.js";
68
- import { buildCubeURLs } from "../../../texture/cubemap/buildCubeURLs.js";
67
+ import { load_and_set_cubemap_v0 } from "../../../load_and_set_cubemap_v0.js";
69
68
 
70
69
  const engineHarness = new EngineHarness();
71
70
 
@@ -133,7 +132,6 @@ function makeConfig(engine) {
133
132
 
134
133
 
135
134
  // Plugins
136
- config.addPlugin(MicronRenderPlugin);
137
135
 
138
136
 
139
137
  // Knowledge
@@ -240,7 +238,7 @@ async function init(harness) {
240
238
 
241
239
  enableEditor(engine);
242
240
 
243
- await engine.graphics.loadEnvironmentMap(buildCubeURLs('data/textures/cubemaps/hip_miramar/32/', '.png'));
241
+ await load_and_set_cubemap_v0(engine.graphics, 'data/textures/cubemaps/hip_miramar/32/', '.png');
244
242
 
245
243
 
246
244
  await engine.plugins.acquire(AmbientOcclusionPostProcessEffect);
@@ -64,7 +64,7 @@ import { OrbitingBehavior } from "../../../../../../../model/game/util/behavior/
64
64
  import { BehaviorComponent } from "../../../../intelligence/behavior/ecs/BehaviorComponent.js";
65
65
  import { Light } from "../../../ecs/light/Light.js";
66
66
  import { LightType } from "../../../ecs/light/LightType.js";
67
- import { parseColor } from "../../../../../core/color/ColorUtils.js";
67
+ import { parseColor } from "../../../../../core/color/parseColor.js";
68
68
  import Renderable from "../../../../ecs/components/Renderable.js";
69
69
  import { makeHelperSphereGeometry } from "../../../../../../editor/process/symbolic/makeHelperSphereGeometry.js";
70
70
  import TopDownCameraController from "../../../ecs/camera/topdown/TopDownCameraController.js";
@@ -26,7 +26,7 @@ import { RingBuffer } from "../../../../../core/collection/RingBuffer.js";
26
26
  import { query_bvh_frustum_from_objects } from "../query/query_bvh_frustum_from_objects.js";
27
27
  import { prettyPrint } from "../../../../../core/NumberFormat.js";
28
28
  import { FPlusDebugMaterial } from "../materials/FPlusDebugMaterial.js";
29
- import { parseColor } from "../../../../../core/color/ColorUtils.js";
29
+ import { parseColor } from "../../../../../core/color/parseColor.js";
30
30
  import { buildLightClusterWidget } from "../debug/buildLightClusterWidget.js";
31
31
  import domify from "../../../../../view/DOM.js";
32
32
  import { createScreenGrid } from "../debug/createScreenGrid.js";
@@ -49,7 +49,6 @@ import EntityBuilder from "../../../../ecs/EntityBuilder.js";
49
49
  import { Transform } from "../../../../ecs/transform/Transform.js";
50
50
  import Mesh from "../../../ecs/mesh/Mesh.js";
51
51
  import { PathDisplaySystem } from "../../../ecs/path/PathDisplaySystem.js";
52
- import { MicronRenderPlugin } from "../../../micron/plugin/MicronRenderPlugin.js";
53
52
  import { StandardFrameBuffers } from "../../../StandardFrameBuffers.js";
54
53
  import { HierarchicalZBuffer } from "./buffer/HierarchicalZBuffer.js";
55
54
  import ViewportPosition from "../../../../ecs/gui/position/ViewportPosition.js";
@@ -67,9 +66,9 @@ import { inverseLerp } from "../../../../../core/math/inverseLerp.js";
67
66
  import { clamp } from "../../../../../core/math/clamp.js";
68
67
  import { max2 } from "../../../../../core/math/max2.js";
69
68
  import { min2 } from "../../../../../core/math/min2.js";
70
- import { buildCubeURLs } from "../../../texture/cubemap/buildCubeURLs.js";
71
69
  import { mat4 } from "gl-matrix";
72
70
  import { randomFloatBetween } from "../../../../../core/math/random/randomFloatBetween.js";
71
+ import { load_and_set_cubemap_v0 } from "../../../load_and_set_cubemap_v0.js";
73
72
 
74
73
  const engineHarness = new EngineHarness();
75
74
 
@@ -137,7 +136,6 @@ function makeConfig(engine) {
137
136
 
138
137
 
139
138
  // Plugins
140
- config.addPlugin(MicronRenderPlugin);
141
139
 
142
140
 
143
141
  // Knowledge
@@ -162,7 +160,7 @@ async function init(harness) {
162
160
 
163
161
  enableEditor(engine);
164
162
 
165
- await engine.graphics.loadEnvironmentMap(buildCubeURLs('data/textures/cubemaps/hip_miramar/32/', '.png'));
163
+ await load_and_set_cubemap_v0(engine.graphics, 'data/textures/cubemaps/hip_miramar/32/', '.png');
166
164
 
167
165
  await harness.initialize();
168
166
 
@@ -25,13 +25,13 @@ import { GLTFAssetLoader } from "../../asset/loaders/GLTFAssetLoader.js";
25
25
  import { three_object_to_entity_composition } from "../ecs/mesh-v2/three_object_to_entity_composition.js";
26
26
  import { TransformAttachmentSystem } from "../../ecs/transform-attachment/TransformAttachmentSystem.js";
27
27
  import { ShadedGeometryFlags } from "../ecs/mesh-v2/ShadedGeometryFlags.js";
28
- import { AABB3 } from "../../../core/bvh2/aabb3/AABB3.js";
28
+ import { AABB3 } from "../../../core/geom/3d/aabb/AABB3.js";
29
29
  import { delay } from "../../../core/process/delay.js";
30
30
  import { make_justified_point_grid } from "../../../core/geom/3d/util/make_justified_point_grid.js";
31
31
  import LightSystem from "../ecs/light/LightSystem.js";
32
32
  import { Light } from "../ecs/light/Light.js";
33
33
  import { LightType } from "../ecs/light/LightType.js";
34
- import { buildCubeURLs } from "../texture/cubemap/buildCubeURLs.js";
34
+ import { load_and_set_cubemap_v0 } from "../load_and_set_cubemap_v0.js";
35
35
 
36
36
  /**
37
37
  *
@@ -193,7 +193,7 @@ async function main(engine) {
193
193
  distance: 54,
194
194
  shadowmapResolution: 4096
195
195
  });
196
- engine.graphics.loadEnvironmentMap(buildCubeURLs('data/textures/cubemaps/hip_miramar/32/', '.png'));
196
+ load_and_set_cubemap_v0(engine.graphics, 'data/textures/cubemaps/hip_miramar/32/', '.png');
197
197
 
198
198
  const ecd = engine.entityManager.dataset;
199
199
 
@@ -421,7 +421,7 @@ new EngineHarness().initialize({
421
421
  configuration(config, engine) {
422
422
  config.addSystem(new ShadedGeometrySystem(engine));
423
423
  config.addSystem(new TransformAttachmentSystem());
424
- config.addSystem(new LightSystem(engine,{
424
+ config.addSystem(new LightSystem(engine, {
425
425
  shadowResolution: 2048
426
426
  }));
427
427
 
@@ -19,9 +19,7 @@ export function copy_Sampler2D_channel_data(source, destination) {
19
19
  const destination_data = destination.data;
20
20
  const source_data = source.data;
21
21
 
22
- let i, j;
23
-
24
- const saturated_channel_value = saturated_value_by_constructor(destination_data.constructor);
22
+ let i=0, j=0;
25
23
 
26
24
  if (source_item_size === destination_item_size) {
27
25
  // just copy data chunk
@@ -39,6 +37,9 @@ export function copy_Sampler2D_channel_data(source, destination) {
39
37
  }
40
38
 
41
39
  } else if (source_item_size === 3 && destination_item_size === 4) {
40
+
41
+ const saturated_channel_value = saturated_value_by_constructor(destination_data.constructor);
42
+
42
43
  // RGB -> RGBA
43
44
  for (i = 0; i < pixel_count; i++) {
44
45
  const i3 = i * 3;
@@ -5,6 +5,7 @@ import Vector2 from "../../../../core/geom/Vector2.js";
5
5
  import { TilePage } from "./page/TilePage.js";
6
6
  import { create32BitCodec } from "../../../../core/binary/32BitEncoder.js";
7
7
  import { TileStatus } from "./tile/TileStatus.js";
8
+ import { assert } from "../../../../core/assert.js";
8
9
 
9
10
  /**
10
11
  *
@@ -13,6 +14,14 @@ import { TileStatus } from "./tile/TileStatus.js";
13
14
  * @returns {{encode: (function(..value:number): number), decode: (function(number, number[]): void)}}
14
15
  */
15
16
  function buildAddressEncoder(tileSize, textureSize) {
17
+ assert.isNumber(tileSize,'tileSize');
18
+ assert.notNaN(tileSize,'tileSize');
19
+ assert.isNonNegativeInteger(tileSize,'tileSize');
20
+
21
+ assert.isNumber(textureSize,'textureSize');
22
+ assert.notNaN(textureSize,'textureSize');
23
+ assert.isNonNegativeInteger(textureSize,'textureSize');
24
+
16
25
  const numberOfTiles = Math.ceil(textureSize / tileSize);
17
26
  const numberOfMips = Math.ceil(Math.log2(numberOfTiles));
18
27
 
@@ -3,7 +3,7 @@ import Vector2 from "../../../../core/geom/Vector2.js";
3
3
 
4
4
  function mockAssetManager() {
5
5
  const assetManager = {
6
- get: function (path, type, success, failure) {
6
+ get: function ({ path, type, success, failure }) {
7
7
  const delay = Math.random() * 100;
8
8
  setTimeout(function () {
9
9
  success({
@@ -12,7 +12,8 @@ function mockAssetManager() {
12
12
  }
13
13
  });
14
14
  }, delay);
15
- }
15
+ },
16
+ isAssetManager: true
16
17
  };
17
18
 
18
19
  return assetManager;
@@ -21,13 +22,13 @@ function mockAssetManager() {
21
22
  test("constructor doesn't throw", () => {
22
23
  const assetManager = mockAssetManager();
23
24
 
24
- new VirtualTexture({ assetManager })
25
+ new VirtualTexture(assetManager)
25
26
  });
26
27
 
27
28
  test("init computes sizes correctly", () => {
28
29
  const assetManager = mockAssetManager();
29
30
 
30
- const sut = new VirtualTexture({ assetManager });
31
+ const sut = new VirtualTexture(assetManager);
31
32
 
32
33
  sut.init({ padding: 4, resolution: new Vector2(16, 3), tileResolution: new Vector2(1, 1) });
33
34
 
@@ -5,6 +5,7 @@
5
5
  import { Tile } from "./Tile.js";
6
6
  import { TileStatus } from "./TileStatus.js";
7
7
  import { TileRequest } from "./TileRequest.js";
8
+ import { assert } from "../../../../../core/assert.js";
8
9
 
9
10
 
10
11
  export class TileLoader {
@@ -13,6 +14,10 @@ export class TileLoader {
13
14
  * @param {AssetManager} assetManager
14
15
  */
15
16
  constructor(assetManager) {
17
+ assert.defined(assetManager, 'assetManager');
18
+ assert.notNull(assetManager, 'assetManager');
19
+ assert.equal(assetManager.isAssetManager, true, 'assetManager.isAssetManager !== true');
20
+
16
21
  /**
17
22
  * @type {AssetManager}
18
23
  */
@@ -0,0 +1,7 @@
1
+ import { PointerDevice } from "./PointerDevice.js";
2
+
3
+ test("constructor does not throw", () => {
4
+ const element = document.createElement('div');
5
+
6
+ expect(() => new PointerDevice(element)).not.toThrow();
7
+ });
@@ -1,5 +1,9 @@
1
1
  import {AbstractBlackboard} from "./AbstractBlackboard";
2
2
 
3
3
  export class Blackboard extends AbstractBlackboard {
4
+ toJSON(): { [key: string]: (number | boolean | string) }
4
5
 
6
+ fromJSON(json: any): void
7
+
8
+ static fromJSON(json: any): Blackboard
5
9
  }
@@ -215,6 +215,17 @@ export class Blackboard extends AbstractBlackboard {
215
215
 
216
216
  }
217
217
  }
218
+
219
+ /**
220
+ *
221
+ * @param {any} json
222
+ * @return {Blackboard}
223
+ */
224
+ static fromJSON(json) {
225
+ const bb = new Blackboard();
226
+ bb.fromJSON(json);
227
+ return bb;
228
+ }
218
229
  }
219
230
 
220
231
  Blackboard.typeName = 'Blackboard';
@@ -0,0 +1,20 @@
1
+ import { EnginePlatform } from "./EnginePlatform.js";
2
+ import { StorageAchievementGateway } from "../achievements/gateway/StorageAchievementGateway.js";
3
+ import { InMemoryStorage } from "../save/storage/InMemoryStorage.js";
4
+
5
+ export class InMemoryEnginePlatform extends EnginePlatform {
6
+ #storage = new InMemoryStorage();
7
+ #achievements = new StorageAchievementGateway(this.#storage);
8
+
9
+ getStorage() {
10
+ return this.#storage;
11
+ }
12
+
13
+ getAchievementGateway() {
14
+ return this.#achievements;
15
+ }
16
+
17
+ pickDefaultLocale(options) {
18
+ return options[0];
19
+ }
20
+ }
@@ -1,15 +1,15 @@
1
1
  export default class Storage {
2
- storeBinary(key: string, value: ArrayBuffer, resolve: Function, reject: Function, progress: Function)
2
+ storeBinary(key: string, value: ArrayBuffer, resolve: Function, reject: Function, progress: Function): void
3
3
 
4
- loadBinary(key:string, resolve:Function, reject:Function, progress:Function)
4
+ loadBinary(key: string, resolve: Function, reject: Function, progress: Function): void
5
5
 
6
- store(key:string, value:any, resolve:Function, reject:Function, progress:Function)
6
+ store(key: string, value: any, resolve: Function, reject: Function, progress: Function): void
7
7
 
8
- load(key:string, resolve:Function, reject:Function, progress:Function)
8
+ load(key: string, resolve: Function, reject: Function, progress: Function): void
9
9
 
10
- list(resolve:Function, reject:Function)
10
+ list(resolve: Function, reject: Function): void
11
11
 
12
- remove(key:string, resolve:Function, reject:Function)
12
+ remove(key: string, resolve: Function, reject: Function): void
13
13
 
14
- contains(key:string, resolve:Function, reject:Function)
14
+ contains(key: string, resolve: Function, reject: Function): void
15
15
  }
@@ -0,0 +1,34 @@
1
+ import Storage from "../Storage.js";
2
+ import { collectIteratorValueToArray } from "../../../core/collection/collectIteratorValueToArray.js";
3
+
4
+ export class InMemoryStorage extends Storage {
5
+ #data = new Map();
6
+
7
+ store(key, value, resolve, reject, progress) {
8
+ this.#data.set(key, value);
9
+
10
+ resolve();
11
+ }
12
+
13
+ load(key, resolve, reject, progress) {
14
+ resolve(this.#data.get(key));
15
+ }
16
+
17
+ remove(key, resolve, reject) {
18
+ this.#data.delete(key);
19
+
20
+ resolve();
21
+ }
22
+
23
+ contains(key, resolve, reject) {
24
+ resolve(this.#data.has(key));
25
+ }
26
+
27
+ list(resolve, reject) {
28
+ const result = [];
29
+
30
+ collectIteratorValueToArray(result, this.#data.keys());
31
+
32
+ resolve(result);
33
+ }
34
+ }
@@ -11,9 +11,9 @@ import { buildPathFromDistanceMap } from "../util/buildPathFromDistanceMap.js";
11
11
  import { GridCellActionPlaceTags } from "../../../placement/action/GridCellActionPlaceTags.js";
12
12
  import { GridTags } from "../../../GridTags.js";
13
13
  import { CellMatcher } from "../../../rules/CellMatcher.js";
14
- import { collectIteratorValueToArray } from "../../../../core/collection/IteratorUtils.js";
14
+ import { collectIteratorValueToArray } from "../../../../core/collection/collectIteratorValueToArray.js";
15
15
  import { QuadTreeNode } from "../../../../core/geom/2d/quad-tree/QuadTreeNode.js";
16
- import AABB2 from "../../../../core/geom/AABB2.js";
16
+ import AABB2 from "../../../../core/geom/2d/aabb/AABB2.js";
17
17
  import { PathEndPoint } from "./PathEndPoint.js";
18
18
  import { RoadConnection } from "./RoadConnection.js";
19
19
  import { readMarkerNodeGroupId } from "./readMarkerNodeGroupId.js";
@@ -1,8 +1,8 @@
1
1
  import ParserError from "../../../../core/parser/simple/ParserError.js";
2
- import { readLiteral } from "../../../../core/parser/simple/SimpleParser.js";
3
2
  import { KeyValuePair } from "../../../../core/collection/KeyValuePair.js";
4
3
  import Token from "../../../../core/parser/simple/Token.js";
5
4
  import { TooltipTokenType } from "./TooltipTokenType.js";
5
+ import { readLiteralToken } from "../../../../core/parser/simple/readLiteralToken.js";
6
6
 
7
7
  /**
8
8
  *
@@ -41,7 +41,7 @@ export function readReferenceValueToken(text, cursor, length) {
41
41
  throw new ParserError(i, `Input underflow while reading reference value, value so far='${text.substring(valueStart, length)}'`, text);
42
42
  }
43
43
 
44
- const literal = readLiteral(text, i, length);
44
+ const literal = readLiteralToken(text, i, length);
45
45
 
46
46
  i = literal.end;
47
47