@woosh/meep-engine 2.49.7 → 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.
- package/editor/enableEditor.js +1 -8
- package/package.json +1 -1
- package/samples/terrain/editor.js +2 -2
- package/src/core/cache/Cache.js +1 -1
- package/src/core/collection/HashSet.js +1 -1
- package/src/core/collection/table/RowFirstTableSpec.js +110 -92
- package/src/core/collection/table/RowFirstTableSpec.spec.js +49 -0
- package/src/core/color/Color.d.ts +4 -2
- package/src/core/color/Color.js +7 -8
- package/src/core/color/Color.spec.js +93 -0
- package/src/core/color/hex2rgb.spec.js +10 -0
- package/src/core/color/rgb2hex.js +1 -1
- package/src/core/color/rgb2hex.spec.js +13 -0
- package/src/core/fsm/simple/SimpleStateMachine.spec.js +75 -0
- package/src/core/fsm/simple/SimpleStateMachineDescription.js +1 -1
- package/src/core/fsm/simple/SimpleStateMachineDescription.spec.js +32 -0
- package/src/core/geom/2d/Rectangle.spec.js +51 -0
- package/src/core/geom/3d/aabb/aabb3_intersects_ray.spec.js +90 -0
- package/src/core/geom/3d/line/line3_compute_nearest_point_to_point.spec.js +61 -0
- package/src/core/geom/3d/morton/mortonEncode_magicbits.js +1 -34
- package/src/core/geom/3d/morton/split_by_2.js +17 -0
- package/src/core/geom/3d/morton/split_by_3.js +16 -0
- package/src/core/geom/3d/plane/computePlaneLineIntersection.js +6 -1
- package/src/core/geom/3d/sphere/sphere_intersects_ray.spec.js +11 -0
- package/src/core/geom/3d/sphere/sphere_radius_sqr_from_v3_array_transformed.spec.js +8 -0
- package/src/core/geom/3d/topology/samples/sampleFloodFill.js +3 -3
- package/src/core/geom/3d/topology/struct/binary/io/OrderedEdge.js +1 -1
- package/src/core/geom/random/randomPointOnBox.spec.js +57 -0
- package/src/engine/Engine.d.ts +4 -2
- package/src/engine/Engine.js +62 -41
- package/src/engine/Engine.spec.js +11 -0
- package/src/engine/InputEngine.js +12 -0
- package/src/engine/graphics/GraphicsEngine.js +2 -13
- package/src/engine/graphics/ecs/compileAllMaterials.js +1 -1
- package/src/engine/graphics/ecs/mesh/createTaskWaitForMeshesToLoad.js +1 -1
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.js +1 -1
- package/src/engine/graphics/load_and_set_cubemap_v0.js +21 -0
- package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +1 -1
- package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +3 -5
- package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +2 -4
- package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +1 -1
- package/src/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +1 -1
- package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +2 -4
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +4 -4
- package/src/engine/graphics/texture/sampler/copy_Sampler2D_channel_data.js +4 -3
- package/src/engine/graphics/texture/virtual/VirtualTexture.js +9 -0
- package/src/engine/graphics/texture/virtual/VirtualTexture.spec.js +5 -4
- package/src/engine/graphics/texture/virtual/tile/TileLoader.js +5 -0
- package/src/engine/input/devices/PointerDevice.spec.js +7 -0
- package/src/engine/platform/InMemoryEnginePlatform.js +20 -0
- package/src/engine/save/Storage.d.ts +7 -7
- package/src/engine/save/storage/InMemoryStorage.js +34 -0
- package/src/generation/grid/generation/road/GridTaskGenerateRoads.js +2 -2
- /package/src/core/collection/{IteratorUtils.js → collectIteratorValueToArray.js} +0 -0
- /package/src/core/color/{ColorUtils.js → parseColor.js} +0 -0
|
@@ -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/
|
|
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/
|
|
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/
|
|
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/
|
|
10
|
+
import { collectIteratorValueToArray } from "../../../../core/collection/collectIteratorValueToArray.js";
|
|
11
11
|
import {
|
|
12
12
|
AdditiveBlending,
|
|
13
13
|
ClampToEdgeWrapping,
|
package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js
CHANGED
|
@@ -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/
|
|
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
|
|
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 {
|
|
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
|
|
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/
|
|
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/
|
|
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
|
|
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/
|
|
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 {
|
|
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
|
|
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(
|
|
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(
|
|
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,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/
|
|
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";
|
|
File without changes
|
|
File without changes
|