@woosh/meep-engine 2.42.7 → 2.43.0
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/core/binary/BitSet.js +4 -4
- package/core/binary/ctz32.js +40 -0
- package/core/collection/ObservedMap.js +61 -57
- package/core/collection/heap/FastBinaryHeap.js +7 -1
- package/core/collection/heap/Uint32Heap.js +19 -0
- package/core/collection/map/AsyncLoadingCache.js +3 -1
- package/core/geom/2d/compute_polygon_area_2d.js +32 -0
- package/core/geom/2d/compute_polygon_area_2d.spec.js +10 -0
- package/core/geom/2d/compute_triangle_area_2d.js +15 -0
- package/core/geom/2d/compute_triangle_area_2d.spec.js +9 -0
- package/core/geom/2d/convex-hull/convex_hull_jarvis_2d.js +64 -0
- package/core/geom/2d/convex-hull/convex_hull_jarvis_2d.spec.js +33 -0
- package/core/geom/2d/convex-hull/convex_hull_monotone_2d.js +82 -0
- package/core/geom/2d/convex-hull/fixed_convex_hull_humus.js +135 -0
- package/core/geom/2d/convex-hull/fixed_convex_hull_relaxation.js +282 -0
- package/core/geom/2d/convex-hull/orientation3.js +444 -0
- package/core/geom/2d/convex-hull/orientation3_array.js +22 -0
- package/core/geom/2d/convex-hull/orientation3_v2.js +12 -0
- package/core/geom/2d/intersect_ray_2d.js +56 -0
- package/core/geom/2d/quad-tree/QuadTreeNode.js +0 -81
- package/core/geom/2d/quad-tree/qt_match_data_by_circle.js +70 -0
- package/core/geom/3d/matrix/m4_multiply_alphatensor.js +131 -0
- package/core/geom/3d/plane/orient3d_fast.js +2 -6
- package/core/geom/3d/tetrahedra/README.md +7 -0
- package/core/geom/3d/tetrahedra/compute_bounding_simplex_3d.js +3 -1
- package/core/geom/3d/tetrahedra/delaunay/Cavity.js +48 -0
- package/core/geom/3d/tetrahedra/{compute_delaunay_tetrahedral_mesh.js → delaunay/compute_delaunay_tetrahedral_mesh.js} +15 -7
- package/core/geom/3d/tetrahedra/{compute_delaunay_tetrahedral_mesh.spec.js → delaunay/compute_delaunay_tetrahedral_mesh.spec.js} +0 -0
- package/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_compute_cavity.js +73 -0
- package/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_walk_toward_cavity.js +48 -0
- package/core/geom/3d/tetrahedra/hxt/a.js +524 -0
- package/core/geom/3d/tetrahedra/hxt/hxt.js +140 -0
- package/core/geom/3d/tetrahedra/hxt/hxt.wasm +0 -0
- package/core/geom/3d/tetrahedra/point_in_tetrahedron_circumsphere.js +35 -20
- package/core/geom/3d/tetrahedra/prototypeTetrahedraBuilder.js +98 -0
- package/core/geom/3d/tetrahedra/tetrahedra_collection.js +60 -131
- package/core/geom/packing/{MaxRectangles.js → max-rect/MaxRectangles.js} +28 -124
- package/core/geom/packing/max-rect/removeRedundantBoxes.js +69 -0
- package/core/geom/packing/max-rect/removeRedundantBoxesArray.js +40 -0
- package/core/geom/v3_distance_above_plane.js +1 -1
- package/core/graph/layout/BoxLayouter.js +2 -88
- package/core/graph/layout/CircleLayout.js +2 -1
- package/core/graph/layout/box/forceIntoBox.js +45 -0
- package/core/graph/layout/box/pullBoxTowardsPoint.js +20 -0
- package/core/graph/layout/box/resolveAABB2Overlap.js +22 -0
- package/core/math/bessel_3.js +11 -0
- package/core/math/bessel_i0.js +26 -0
- package/core/process/executor/ConcurrentExecutor.spec.js +2 -1
- package/core/process/task/util/actionTask.js +19 -0
- package/core/process/task/util/countTask.js +62 -0
- package/core/process/task/util/delayTask.js +45 -0
- package/core/process/task/util/emptyTask.js +19 -0
- package/core/process/task/util/failingTask.js +17 -0
- package/core/process/task/util/futureTask.js +48 -0
- package/core/process/task/util/promiseTask.js +42 -0
- package/core/process/task/util/randomCountTask.js +64 -0
- package/core/process/task/util/wrapTaskIgnoreFailure.js +47 -0
- package/engine/Engine.js +8 -8
- package/engine/EngineBootstrapper.js +1 -1
- package/engine/asset/AssetManager.js +197 -53
- package/engine/asset/AssetRequest.js +32 -0
- package/engine/asset/loaders/ArrayBufferLoader.js +62 -50
- package/engine/asset/loaders/image/png/PNG.js +15 -1
- package/engine/asset/loaders/image/png/PNGReader.js +3 -2
- package/engine/ecs/foliage/ecs/InstancedMeshUtils.js +2 -1
- package/engine/ecs/storage/BinaryBufferDeSerializer.js +1 -1
- package/engine/ecs/storage/JSONDeSerializer.js +2 -1
- package/engine/ecs/terrain/ecs/splat/SplatMapOptimizer.js +2 -1
- package/engine/ecs/terrain/ecs/splat/SplatMapping.js +1 -1
- package/engine/graphics/camera/makeScreenScissorFrustum.js +1 -1
- package/engine/graphics/camera/testClippingPlaneComputation.js +4 -45
- package/engine/graphics/ecs/camera/FrustumProjector.js +6 -0
- package/engine/graphics/ecs/decal/v2/FPDecalSystem.js +5 -0
- package/engine/graphics/ecs/decal/v2/prototypeDecalSystem.js +23 -4
- package/engine/graphics/ecs/highlight/plugin/OutlineRenderPlugin.js +1 -1
- package/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +11 -0
- package/engine/graphics/geometry/FULL_SCREEN_TRIANGLE_GEOMETRY.js +1 -2
- package/engine/graphics/impostors/octahedral/ImpostorBaker.js +5 -2
- package/engine/graphics/impostors/octahedral/ImpostorDescription.js +18 -0
- package/engine/graphics/impostors/octahedral/bake/prepare_bake_material.js +15 -0
- package/engine/graphics/impostors/octahedral/prototypeBaker.js +66 -79
- package/engine/graphics/impostors/octahedral/shader/ImpostorShaderWireframeV0.js +134 -0
- package/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.js +128 -0
- package/engine/graphics/impostors/octahedral/util/build_geometry_from_cutout_shape.js +32 -0
- package/engine/graphics/impostors/octahedral/util/load_mesh_for_bake.js +31 -0
- package/engine/graphics/impostors/octahedral/util/makeImpostorAtlasPreview.js +107 -0
- package/engine/graphics/material/manager/ManagedMaterial.js +4 -0
- package/engine/graphics/material/manager/MaterialManager.js +1 -0
- package/engine/graphics/material/optimization/MaterialOptimizationContext.js +7 -3
- package/engine/graphics/particles/particular/engine/renderers/billboard/ParticleBillboardMaterial.js +2 -2
- package/engine/graphics/render/forward_plus/plugin/ForwardPlusRenderingPlugin.js +0 -19
- package/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +2 -2
- package/engine/graphics/render/visibility/hiz/buildCanvasViewFromTexture.js +83 -27
- package/engine/graphics/shadows/ShadowMapRenderer.js +11 -4
- package/engine/graphics/texture/atlas/AbstractTextureAtlas.js +2 -1
- package/engine/graphics/texture/atlas/CachingTextureAtlas.js +208 -38
- package/engine/graphics/texture/atlas/TextureAtlas.js +31 -24
- package/engine/graphics/texture/atlas/gpu/WebGLTextureAtlas.js +1 -1
- package/engine/graphics/texture/sampler/filter/box.js +16 -0
- package/engine/graphics/texture/sampler/filter/cubic2.js +32 -0
- package/engine/graphics/texture/sampler/filter/gaussian.js +16 -0
- package/engine/graphics/texture/sampler/filter/kaiser_1.js +19 -0
- package/engine/graphics/texture/sampler/filter/kaiser_bessel_window.js +19 -0
- package/engine/graphics/texture/sampler/filter/mitchell.js +55 -0
- package/engine/graphics/texture/sampler/filter/sampler2d_scale_down_generic.js +109 -0
- package/engine/graphics/texture/sampler/filter/triangle.js +19 -0
- package/engine/graphics/texture/sampler/prototypeSamplerFiltering.js +187 -86
- package/engine/graphics/texture/sampler/sampler2_d_scale_down_lanczos.js +77 -25
- package/engine/graphics/texture/sampler/search/make_edge_condition_channel_threshold.js +34 -0
- package/engine/graphics/texture/sampler/search/sampler2d_find_pixels.js +24 -0
- package/engine/graphics/texture/sprite/prototypeSpriteCutoutGeometry.js +212 -0
- package/engine/knowledge/database/StaticKnowledgeDataTable.js +1 -1
- package/engine/navigation/grid/AStar.js +1 -1
- package/engine/plugin/EnginePluginManager.js +28 -27
- package/engine/plugin/PluginReferenceContext.js +9 -0
- package/engine/scene/Scene.js +1 -1
- package/engine/scene/SerializedScene.js +1 -1
- package/engine/scene/transitionToScene.js +3 -1
- package/generation/example/main.js +1 -1
- package/generation/grid/generation/GridTaskApplyActionToCells.js +1 -1
- package/generation/grid/generation/GridTaskDensityMarkerDistribution.js +1 -1
- package/generation/grid/generation/GridTaskExecuteRuleTimes.js +1 -1
- package/generation/grid/generation/NoopGridTaskGenerator.js +1 -1
- package/generation/grid/generation/discrete/GridTaskCellularAutomata.js +2 -1
- package/generation/grid/generation/discrete/GridTaskConnectRooms.js +1 -1
- package/generation/grid/generation/discrete/layer/GridTaskBuildSourceDistanceMap.js +3 -2
- package/generation/grid/generation/discrete/layer/GridTaskDistanceToMarkers.js +1 -1
- package/generation/grid/generation/grid/GridTaskAddNodesFixed.js +1 -1
- package/generation/grid/generation/road/GridTaskGenerateRoads.js +3 -2
- package/generation/grid/generation/util/buildDistanceMapToObjective.js +1 -1
- package/generation/markers/GridActionRuleSet.js +2 -1
- package/generation/placement/GridCellActionTransformNearbyMarkers.js +2 -4
- package/generation/theme/ThemeEngine.js +4 -1
- package/package.json +1 -1
- package/view/asset/AssetLoaderStatusView.js +5 -5
- package/view/minimap/gl/MinimapTerrainGL.js +1 -2
- package/view/renderModel.js +1 -1
- package/view/tooltip/TooltipView.js +5 -5
- package/core/process/task/TaskUtils.js +0 -352
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { EngineHarness } from "../../../EngineHarness.js";
|
|
2
|
+
import GUIElementSystem from "../../../ecs/gui/GUIElementSystem.js";
|
|
3
|
+
import { ImageRGBADataLoader } from "../../../asset/loaders/image/ImageRGBADataLoader.js";
|
|
4
|
+
import EmptyView from "../../../../view/elements/EmptyView.js";
|
|
5
|
+
import EntityBuilder from "../../../ecs/EntityBuilder.js";
|
|
6
|
+
import GUIElement from "../../../ecs/gui/GUIElement.js";
|
|
7
|
+
import ViewportPositionSystem from "../../../ecs/gui/position/ViewportPositionSystem.js";
|
|
8
|
+
import { CanvasView } from "../../../../view/elements/CanvasView.js";
|
|
9
|
+
import sampler2D2Canvas from "../sampler/Sampler2D2Canvas.js";
|
|
10
|
+
import ViewportPosition from "../../../ecs/gui/position/ViewportPosition.js";
|
|
11
|
+
import Vector2 from "../../../../core/geom/Vector2.js";
|
|
12
|
+
import { convex_hull_jarvis_2d } from "../../../../core/geom/2d/convex-hull/convex_hull_jarvis_2d.js";
|
|
13
|
+
import { Sampler2D } from "../sampler/Sampler2D.js";
|
|
14
|
+
import { compute_polygon_area_2d } from "../../../../core/geom/2d/compute_polygon_area_2d.js";
|
|
15
|
+
import { sampler2d_find_pixels } from "../sampler/search/sampler2d_find_pixels.js";
|
|
16
|
+
import { make_edge_condition_channel_threshold } from "../sampler/search/make_edge_condition_channel_threshold.js";
|
|
17
|
+
import { fixed_convex_hull_humus } from "../../../../core/geom/2d/convex-hull/fixed_convex_hull_humus.js";
|
|
18
|
+
|
|
19
|
+
const edge_condition_alpha0 = make_edge_condition_channel_threshold(3, 0);
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
function sampler_as_view(sampler) {
|
|
23
|
+
|
|
24
|
+
const vSpriteSource = new CanvasView();
|
|
25
|
+
vSpriteSource.css({
|
|
26
|
+
position: 'absolute',
|
|
27
|
+
left: 0,
|
|
28
|
+
top: 0
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
sampler2D2Canvas(sampler, 1, 0, vSpriteSource.el);
|
|
32
|
+
|
|
33
|
+
return vSpriteSource;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @param {number[]} vertices
|
|
39
|
+
* @param {CanvasRenderingContext2D} ctx
|
|
40
|
+
* @param [fillColor]
|
|
41
|
+
* @param [strokeColor]
|
|
42
|
+
* @param [highlight_vertices]
|
|
43
|
+
* @param [vertex_draw_size]
|
|
44
|
+
* @param {number} [offset] in pixels
|
|
45
|
+
*/
|
|
46
|
+
function drawPath({
|
|
47
|
+
vertices,
|
|
48
|
+
ctx,
|
|
49
|
+
fillColor = 'transparent',
|
|
50
|
+
strokeColor = 'red',
|
|
51
|
+
highlight_vertices = true,
|
|
52
|
+
vertex_draw_size = 8,
|
|
53
|
+
offset = [0, 0]
|
|
54
|
+
}) {
|
|
55
|
+
|
|
56
|
+
function draw_point(x, y) {
|
|
57
|
+
ctx.fillStyle = 'rgba(255,255,255,0.8)';
|
|
58
|
+
ctx.strokeStyle = 'black';
|
|
59
|
+
ctx.lineWidth = "1px";
|
|
60
|
+
|
|
61
|
+
const x1 = x - vertex_draw_size / 2 + offset[0];
|
|
62
|
+
const y1 = y - vertex_draw_size / 2 + offset[1];
|
|
63
|
+
|
|
64
|
+
ctx.fillRect(x1, y1, vertex_draw_size, vertex_draw_size);
|
|
65
|
+
|
|
66
|
+
ctx.strokeRect(x1, y1, vertex_draw_size, vertex_draw_size);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (highlight_vertices) {
|
|
70
|
+
for (let i = 0; i < vertices.length / 2; i++) {
|
|
71
|
+
draw_point(vertices[i * 2], vertices[i * 2 + 1]);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
ctx.fillStyle = fillColor;
|
|
76
|
+
ctx.strokeStyle = strokeColor;
|
|
77
|
+
ctx.lineWidth = "1px";
|
|
78
|
+
|
|
79
|
+
ctx.beginPath();
|
|
80
|
+
|
|
81
|
+
ctx.moveTo(vertices[0] + offset[0], vertices[1] + offset[1]);
|
|
82
|
+
// drawPoint(jarvis_vertices[0].x, jarvis_vertices[0].y, jarvis_vertices[0].z, 'red');
|
|
83
|
+
|
|
84
|
+
for (let i = 1; i < vertices.length / 2; i++) {
|
|
85
|
+
|
|
86
|
+
ctx.lineTo(vertices[i * 2] + offset[0], vertices[i * 2 + 1] + offset[1]);
|
|
87
|
+
|
|
88
|
+
// drawPoint(last.x, last.y, last.z, 'red');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
ctx.closePath();
|
|
92
|
+
ctx.stroke();
|
|
93
|
+
ctx.fill();
|
|
94
|
+
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
*
|
|
99
|
+
* @param {Engine} engine
|
|
100
|
+
* @returns {Promise<void>}
|
|
101
|
+
*/
|
|
102
|
+
async function main(engine) {
|
|
103
|
+
|
|
104
|
+
// const path = "data/textures/particle/UETools/Bones_01.png";
|
|
105
|
+
// const path = "data/textures/particle/UETools/x64/Bones_01.png";
|
|
106
|
+
// const path = "data/textures/particle/KriptoFX/x256/SmokeTile2.png";
|
|
107
|
+
const path = "data/textures/particle/KriptoFX/CloudMask.png";
|
|
108
|
+
// const path = "data/textures/particle/travnik/arrow_2_64.png";
|
|
109
|
+
// const path = "data/textures/particle/travnik/leaf_01.png";
|
|
110
|
+
// const path = "data/textures/particle/travnik/portal_2_blue_64.png";
|
|
111
|
+
// const path = "data/textures/particle/travnik/flake.png";
|
|
112
|
+
|
|
113
|
+
const asset = await engine.assetManager.promise(path, 'image')
|
|
114
|
+
|
|
115
|
+
const sampler = asset.create();
|
|
116
|
+
|
|
117
|
+
const input_sprite_area = sampler.width * sampler.height;
|
|
118
|
+
|
|
119
|
+
const edge_pixels = sampler2d_find_pixels(sampler, make_edge_condition_channel_threshold(3, 10));
|
|
120
|
+
console.log(`Edge pixels: ${edge_pixels.length * 0.5} (${(edge_pixels.length * 0.5 * 100 / (sampler.width * sampler.height)).toFixed(2)}% of the image)`);
|
|
121
|
+
|
|
122
|
+
const sampler_edge_pixels = Sampler2D.uint8(4, sampler.width, sampler.height);
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
for (let i = 0; i < edge_pixels.length; i += 2) {
|
|
126
|
+
sampler_edge_pixels.set(edge_pixels[i], edge_pixels[i + 1], [0, 255, 0, 100]);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const convex_hull_indices = convex_hull_jarvis_2d(edge_pixels);
|
|
130
|
+
|
|
131
|
+
const convex_hull_point_count = convex_hull_indices.length;
|
|
132
|
+
|
|
133
|
+
const convex_hull_vertices = convex_hull_indices.map(i => [edge_pixels[i * 2], edge_pixels[i * 2 + 1]]).flat();
|
|
134
|
+
|
|
135
|
+
const convex_hull_area = compute_polygon_area_2d(convex_hull_vertices, convex_hull_point_count);
|
|
136
|
+
|
|
137
|
+
console.log(`Convex hull has ${convex_hull_point_count} points, area ${(convex_hull_area * 100 / input_sprite_area).toFixed(2)}% of original`);
|
|
138
|
+
|
|
139
|
+
const vContainer = new EmptyView();
|
|
140
|
+
|
|
141
|
+
const vHull = new CanvasView();
|
|
142
|
+
vHull.css({
|
|
143
|
+
position: 'absolute',
|
|
144
|
+
left: "-16px",
|
|
145
|
+
top: "-16px"
|
|
146
|
+
})
|
|
147
|
+
// we make it a bit larger to fit markers drawn at the edges of the image
|
|
148
|
+
vHull.size.set(sampler.width + 32, sampler.height + 32);
|
|
149
|
+
|
|
150
|
+
drawPath({
|
|
151
|
+
vertices: convex_hull_vertices,
|
|
152
|
+
ctx: vHull.context2d,
|
|
153
|
+
offset: [16, 16]
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
const vSprite = sampler_as_view(sampler);
|
|
157
|
+
|
|
158
|
+
vSprite.css({
|
|
159
|
+
border: "1px solid red"
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
vContainer.addChild(vSprite);
|
|
163
|
+
|
|
164
|
+
vContainer.addChild(sampler_as_view(sampler_edge_pixels));
|
|
165
|
+
|
|
166
|
+
// vContainer.addChild(vHull);
|
|
167
|
+
|
|
168
|
+
console.time('optimal poly');
|
|
169
|
+
const optimal_poly_points = 8;
|
|
170
|
+
const optimal_poly = new Float32Array(optimal_poly_points * 2);
|
|
171
|
+
// fixed_convex_hull_relaxation(optimal_poly, 0, optimal_poly_points, convex_hull_vertices, convex_hull_point_count);
|
|
172
|
+
fixed_convex_hull_humus(optimal_poly, 0, optimal_poly_points, convex_hull_vertices, convex_hull_point_count);
|
|
173
|
+
console.timeEnd('optimal poly');
|
|
174
|
+
|
|
175
|
+
console.log(`optimal poly: ${Array.from(optimal_poly).join(', ')}`);
|
|
176
|
+
console.log(`Optimal poly area ${((compute_polygon_area_2d(optimal_poly, optimal_poly_points) * 100 / input_sprite_area).toFixed(2))}%`);
|
|
177
|
+
|
|
178
|
+
const vOptimalPoly = new CanvasView();
|
|
179
|
+
vOptimalPoly.css({
|
|
180
|
+
position: 'absolute',
|
|
181
|
+
top: '-50px',
|
|
182
|
+
left: '-50px'
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
vOptimalPoly.size.set(sampler.width + 100, sampler.height + 100);
|
|
186
|
+
|
|
187
|
+
drawPath({
|
|
188
|
+
vertices: optimal_poly,
|
|
189
|
+
ctx: vOptimalPoly.context2d,
|
|
190
|
+
strokeColor: '#30c0ff',
|
|
191
|
+
offset: [50, 50]
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
vContainer.addChild(vOptimalPoly);
|
|
195
|
+
|
|
196
|
+
new EntityBuilder()
|
|
197
|
+
.add(GUIElement.fromView(vContainer))
|
|
198
|
+
.add(new ViewportPosition({
|
|
199
|
+
offset: new Vector2(100, 100)
|
|
200
|
+
}))
|
|
201
|
+
.build(engine.entityManager.dataset);
|
|
202
|
+
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
new EngineHarness().initialize({
|
|
206
|
+
configuration(config, engine) {
|
|
207
|
+
config.addSystem(new GUIElementSystem(engine.gui.view, engine));
|
|
208
|
+
config.addSystem(new ViewportPositionSystem(engine.gui.view.size));
|
|
209
|
+
|
|
210
|
+
config.addLoader('image', new ImageRGBADataLoader());
|
|
211
|
+
}
|
|
212
|
+
}).then(main);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { noop } from "../../../core/function/Functions.js";
|
|
2
|
-
import { countTask } from "../../../core/process/task/TaskUtils.js";
|
|
3
2
|
import Task from "../../../core/process/task/Task.js";
|
|
4
3
|
import { assert } from "../../../core/assert.js";
|
|
5
4
|
import { TaskSignal } from "../../../core/process/task/TaskSignal.js";
|
|
6
5
|
import { DATABASE_SERIALIZATION_IGNORE_PROPERTY } from "./DATABASE_SERIALIZATION_IGNORE_PROPERTY.js";
|
|
6
|
+
import { countTask } from "../../../core/process/task/util/countTask.js";
|
|
7
7
|
|
|
8
8
|
let id_seed = 0;
|
|
9
9
|
|
|
@@ -213,7 +213,7 @@ export function gridAStarSearch(field, width, height, start, goal, crossingPenal
|
|
|
213
213
|
open.push(neighbor);
|
|
214
214
|
} else {
|
|
215
215
|
// Already seen the node, but since it has been rescored we need to reorder it in the heap
|
|
216
|
-
open.
|
|
216
|
+
open.updateElementScore(neighbor);
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
}
|
|
@@ -4,7 +4,6 @@ import { EnginePlugin } from "./EnginePlugin.js";
|
|
|
4
4
|
import { PluginReferenceContext } from "./PluginReferenceContext.js";
|
|
5
5
|
import { isSubclassOf } from "./isSubclassOf.js";
|
|
6
6
|
import { assert } from "../../core/assert.js";
|
|
7
|
-
import { IllegalStateException } from "../../core/fsm/exceptions/IllegalStateException.js";
|
|
8
7
|
|
|
9
8
|
export class EnginePluginManager extends BaseProcess {
|
|
10
9
|
constructor() {
|
|
@@ -222,49 +221,51 @@ export class EnginePluginManager extends BaseProcess {
|
|
|
222
221
|
}
|
|
223
222
|
|
|
224
223
|
let ctx = this.__plugins.get(PluginClass);
|
|
224
|
+
let reference;
|
|
225
225
|
|
|
226
|
-
if (ctx
|
|
227
|
-
return ctx.getReference();
|
|
228
|
-
}
|
|
226
|
+
if (ctx === undefined) {
|
|
229
227
|
|
|
230
|
-
|
|
228
|
+
this.__version++;
|
|
231
229
|
|
|
232
|
-
|
|
230
|
+
// context not found, create it
|
|
233
231
|
|
|
234
|
-
|
|
232
|
+
const instance = new PluginClass();
|
|
235
233
|
|
|
236
|
-
|
|
234
|
+
ctx = new PluginReferenceContext(instance, PluginClass);
|
|
237
235
|
|
|
238
|
-
|
|
239
|
-
|
|
236
|
+
// monitor the context
|
|
237
|
+
ctx.on.lastReleased.add(this.__handle_last_plugin_reference_release, this);
|
|
240
238
|
|
|
241
|
-
|
|
242
|
-
|
|
239
|
+
// all dependencies acquired, register the plugin
|
|
240
|
+
this.__plugins.set(PluginClass, ctx);
|
|
243
241
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
const dependency_refs = await this.acquireMany(instance.dependencies);
|
|
242
|
+
// get reference to make sure that the context doesn't come up as having no references
|
|
243
|
+
reference = ctx.getReference();
|
|
247
244
|
|
|
248
|
-
|
|
245
|
+
// TODO address cyclic dependencies, these can cause a deadlock
|
|
246
|
+
// acquire dependencies
|
|
247
|
+
const dependency_refs = await this.acquireMany(instance.dependencies);
|
|
248
|
+
|
|
249
|
+
ctx.dependency_references.addAll(dependency_refs);
|
|
249
250
|
|
|
250
|
-
// Sanity check
|
|
251
|
-
if (this.__plugins.has(PluginClass)) {
|
|
252
|
-
throw new IllegalStateException('Plugin was already instantiated during acquisition');
|
|
253
|
-
}
|
|
254
251
|
|
|
255
|
-
|
|
256
|
-
this.__plugins.set(PluginClass, ctx);
|
|
252
|
+
const manager_state_object = this.getState();
|
|
257
253
|
|
|
258
|
-
const manager_state_object = this.getState();
|
|
259
254
|
|
|
255
|
+
const manager_state_value = manager_state_object.getValue();
|
|
260
256
|
|
|
261
|
-
|
|
257
|
+
// bring the plugin into proper state
|
|
262
258
|
|
|
263
|
-
|
|
259
|
+
const engine = this.engine;
|
|
264
260
|
|
|
265
|
-
|
|
261
|
+
await ctx.transition(manager_state_value, engine);
|
|
262
|
+
|
|
263
|
+
} else {
|
|
264
|
+
reference = ctx.getReference();
|
|
265
|
+
|
|
266
|
+
await ctx.synchronize();
|
|
267
|
+
}
|
|
266
268
|
|
|
267
|
-
await ctx.transition(manager_state_value, engine);
|
|
268
269
|
|
|
269
270
|
return reference;
|
|
270
271
|
|
|
@@ -141,6 +141,15 @@ export class PluginReferenceContext {
|
|
|
141
141
|
this.__transition = Promise.resolve();
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Returns promise to the latest transition, useful to synchronization
|
|
146
|
+
* @example await ctx.synchronize();
|
|
147
|
+
* @returns {Promise<void>}
|
|
148
|
+
*/
|
|
149
|
+
synchronize() {
|
|
150
|
+
return this.__transition;
|
|
151
|
+
}
|
|
152
|
+
|
|
144
153
|
/**
|
|
145
154
|
*
|
|
146
155
|
* @param {ProcessState} target_state
|
package/engine/scene/Scene.js
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
import { EntityComponentDataset } from "../ecs/EntityComponentDataset.js";
|
|
7
|
-
import { promiseTask } from "../../core/process/task/TaskUtils.js";
|
|
8
7
|
import ObservedBoolean from "../../core/model/ObservedBoolean.js";
|
|
9
8
|
import List from "../../core/collection/list/List.js";
|
|
9
|
+
import { promiseTask } from "../../core/process/task/util/promiseTask.js";
|
|
10
10
|
|
|
11
11
|
class Scene {
|
|
12
12
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { GameAssetType } from "../asset/GameAssetType.js";
|
|
2
2
|
import BinaryBufferDeSerializer from "../ecs/storage/BinaryBufferDeSerializer.js";
|
|
3
3
|
import { EncodingBinaryBuffer } from "../../core/binary/EncodingBinaryBuffer.js";
|
|
4
|
-
import { emptyTask } from "../../core/process/task/TaskUtils.js";
|
|
5
4
|
import { assert } from "../../core/assert.js";
|
|
6
5
|
import { MirScene } from "../../../model/game/scenes/MirScene.js";
|
|
6
|
+
import { emptyTask } from "../../core/process/task/util/emptyTask.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
*
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { actionTask, delayTask, wrapTaskIgnoreFailure } from "../../core/process/task/TaskUtils.js";
|
|
2
1
|
import TaskGroup from "../../core/process/task/TaskGroup.js";
|
|
3
2
|
import Task from "../../core/process/task/Task.js";
|
|
4
3
|
import TaskState from "../../core/process/task/TaskState.js";
|
|
@@ -7,6 +6,9 @@ import { compileAllMaterials } from "../graphics/ecs/compileAllMaterials.js";
|
|
|
7
6
|
import { createTaskWaitForMeshesToLoad } from "../graphics/ecs/mesh/createTaskWaitForMeshesToLoad.js";
|
|
8
7
|
import { loadVisibleTerrainTiles } from "../ecs/terrain/util/loadVisibleTerrainTiles.js";
|
|
9
8
|
import { TaskLoadingScreen } from "../../view/task/TaskLoadingScreen.js";
|
|
9
|
+
import { actionTask } from "../../core/process/task/util/actionTask.js";
|
|
10
|
+
import { delayTask } from "../../core/process/task/util/delayTask.js";
|
|
11
|
+
import { wrapTaskIgnoreFailure } from "../../core/process/task/util/wrapTaskIgnoreFailure.js";
|
|
10
12
|
|
|
11
13
|
|
|
12
14
|
/**
|
|
@@ -16,7 +16,6 @@ import { computeStringHash } from "../../core/primitives/strings/computeStringHa
|
|
|
16
16
|
import { ThemeEngine } from "../theme/ThemeEngine.js";
|
|
17
17
|
import { AreaTheme } from "../theme/AreaTheme.js";
|
|
18
18
|
import TaskGroup from "../../core/process/task/TaskGroup.js";
|
|
19
|
-
import { actionTask } from "../../core/process/task/TaskUtils.js";
|
|
20
19
|
import { generateTerrainPreview } from "../../../../generator/generator/generateTerrainPreview.js";
|
|
21
20
|
import { SampleTheme0 } from "./themes/SampleTheme0.js";
|
|
22
21
|
import { SampleGenerator0 } from "./SampleGenerator0.js";
|
|
@@ -29,6 +28,7 @@ import TopDownCameraControllerSystem from "../../engine/graphics/ecs/camera/topd
|
|
|
29
28
|
import { TopDownCameraLanderSystem } from "../../engine/graphics/ecs/camera/topdown/TopDownCameraLanderSystem.js";
|
|
30
29
|
import LightSystem from "../../engine/graphics/ecs/light/LightSystem.js";
|
|
31
30
|
import { TaskLoadingScreen } from "../../view/task/TaskLoadingScreen.js";
|
|
31
|
+
import { actionTask } from "../../core/process/task/util/actionTask.js";
|
|
32
32
|
|
|
33
33
|
function makeEngineConfig(engine) {
|
|
34
34
|
const config = new EngineConfiguration();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { GridTaskGenerator } from "../GridTaskGenerator.js";
|
|
2
2
|
import { assert } from "../../../core/assert.js";
|
|
3
|
-
import { actionTask } from "../../../core/process/task/TaskUtils.js";
|
|
4
3
|
import TaskGroup from "../../../core/process/task/TaskGroup.js";
|
|
5
4
|
import Task from "../../../core/process/task/Task.js";
|
|
6
5
|
import { TaskSignal } from "../../../core/process/task/TaskSignal.js";
|
|
6
|
+
import { actionTask } from "../../../core/process/task/util/actionTask.js";
|
|
7
7
|
|
|
8
8
|
export class GridTaskApplyActionToCells extends GridTaskGenerator {
|
|
9
9
|
constructor() {
|
|
@@ -9,9 +9,9 @@ import { MarkerNodeMatcherAny } from "../../markers/matcher/MarkerNodeMatcherAny
|
|
|
9
9
|
import { assert } from "../../../core/assert.js";
|
|
10
10
|
import { computeStatisticalMean } from "../../../core/math/statistics/computeStatisticalMean.js";
|
|
11
11
|
import TaskGroup from "../../../core/process/task/TaskGroup.js";
|
|
12
|
-
import { actionTask } from "../../../core/process/task/TaskUtils.js";
|
|
13
12
|
import { ArrayIteratorRandom } from "../../../core/collection/array/ArrayIteratorRandom.js";
|
|
14
13
|
import { clamp01 } from "../../../core/math/clamp01.js";
|
|
14
|
+
import { actionTask } from "../../../core/process/task/util/actionTask.js";
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -4,9 +4,9 @@ import Task from "../../../core/process/task/Task.js";
|
|
|
4
4
|
import { TaskSignal } from "../../../core/process/task/TaskSignal.js";
|
|
5
5
|
import { BitSet } from "../../../core/binary/BitSet.js";
|
|
6
6
|
import { PI_HALF } from "../../../core/math/MathUtils.js";
|
|
7
|
-
import { actionTask } from "../../../core/process/task/TaskUtils.js";
|
|
8
7
|
import TaskGroup from "../../../core/process/task/TaskGroup.js";
|
|
9
8
|
import { randomIntegerBetween } from "../../../core/math/random/randomIntegerBetween.js";
|
|
9
|
+
import { actionTask } from "../../../core/process/task/util/actionTask.js";
|
|
10
10
|
|
|
11
11
|
export class GridTaskExecuteRuleTimes extends GridTaskGenerator {
|
|
12
12
|
constructor() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GridTaskGenerator } from "../GridTaskGenerator.js";
|
|
2
|
-
import { emptyTask } from "../../../core/process/task/
|
|
2
|
+
import { emptyTask } from "../../../core/process/task/util/emptyTask.js";
|
|
3
3
|
|
|
4
4
|
export class NoopGridTaskGenerator extends GridTaskGenerator {
|
|
5
5
|
build(grid, ecd, seed) {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { seededRandom } from "../../../../core/math/random/seededRandom.js";
|
|
2
2
|
import { GridTaskGenerator } from "../../GridTaskGenerator.js";
|
|
3
3
|
import { CaveGeneratorCellularAutomata } from "../../../automata/CaveGeneratorCellularAutomata.js";
|
|
4
|
-
import { actionTask, countTask } from "../../../../core/process/task/TaskUtils.js";
|
|
5
4
|
import { Sampler2D } from "../../../../engine/graphics/texture/sampler/Sampler2D.js";
|
|
6
5
|
import TaskGroup from "../../../../core/process/task/TaskGroup.js";
|
|
7
6
|
import { assert } from "../../../../core/assert.js";
|
|
7
|
+
import { actionTask } from "../../../../core/process/task/util/actionTask.js";
|
|
8
|
+
import { countTask } from "../../../../core/process/task/util/countTask.js";
|
|
8
9
|
|
|
9
10
|
export class GridTaskCellularAutomata extends GridTaskGenerator {
|
|
10
11
|
constructor() {
|
|
@@ -13,8 +13,8 @@ import { drawSamplerHTML } from "../../../../engine/graphics/texture/sampler/uti
|
|
|
13
13
|
import { matcher_tag_unoccupied } from "../../../example/rules/matcher_tag_unoccupied.js";
|
|
14
14
|
import { buildDistanceMapToObjective } from "../util/buildDistanceMapToObjective.js";
|
|
15
15
|
import { buildPathFromDistanceMap } from "../util/buildPathFromDistanceMap.js";
|
|
16
|
-
import { actionTask } from "../../../../core/process/task/TaskUtils.js";
|
|
17
16
|
import { assert } from "../../../../core/assert.js";
|
|
17
|
+
import { actionTask } from "../../../../core/process/task/util/actionTask.js";
|
|
18
18
|
|
|
19
19
|
const ESTIMATED_TILES_PER_ROOM = 900;
|
|
20
20
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { actionTask, countTask } from "../../../../../core/process/task/TaskUtils.js";
|
|
2
1
|
import Task from "../../../../../core/process/task/Task.js";
|
|
3
2
|
import { BitSet } from "../../../../../core/binary/BitSet.js";
|
|
4
3
|
import TaskGroup from "../../../../../core/process/task/TaskGroup.js";
|
|
@@ -6,6 +5,8 @@ import { TaskSignal } from "../../../../../core/process/task/TaskSignal.js";
|
|
|
6
5
|
import BinaryHeap from "../../../../../core/collection/heap/FastBinaryHeap.js";
|
|
7
6
|
import { GridTaskGenerator } from "../../../GridTaskGenerator.js";
|
|
8
7
|
import { assert } from "../../../../../core/assert.js";
|
|
8
|
+
import { actionTask } from "../../../../../core/process/task/util/actionTask.js";
|
|
9
|
+
import { countTask } from "../../../../../core/process/task/util/countTask.js";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Build a map of distances across the grid, using 2 concepts: source cells and passable cells. Source cells are where the distance is 0, and passable cells are those that can be travelled through
|
|
@@ -164,7 +165,7 @@ export class GridTaskBuildSourceDistanceMap extends GridTaskGenerator {
|
|
|
164
165
|
open.push(iNeighbor);
|
|
165
166
|
} else if (distance < target[iNeighbor]) {
|
|
166
167
|
target[iNeighbor] = distance;
|
|
167
|
-
open.
|
|
168
|
+
open.updateElementScore(iNeighbor);
|
|
168
169
|
}
|
|
169
170
|
}
|
|
170
171
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GridTaskGenerator } from "../../../GridTaskGenerator.js";
|
|
2
|
-
import { actionTask } from "../../../../../core/process/task/TaskUtils.js";
|
|
3
2
|
import BinaryHeap from "../../../../../core/collection/heap/FastBinaryHeap.js";
|
|
3
|
+
import { actionTask } from "../../../../../core/process/task/util/actionTask.js";
|
|
4
4
|
|
|
5
5
|
export class GridTaskDistanceToMarkers extends GridTaskGenerator {
|
|
6
6
|
constructor() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GridTaskGenerator } from "../../GridTaskGenerator.js";
|
|
2
|
-
import { actionTask } from "../../../../core/process/task/TaskUtils.js";
|
|
3
2
|
import { MarkerNodeConsumerBuffer } from "../../../markers/emitter/MarkerNodeConsumerBuffer.js";
|
|
4
3
|
import { assert } from "../../../../core/assert.js";
|
|
4
|
+
import { actionTask } from "../../../../core/process/task/util/actionTask.js";
|
|
5
5
|
|
|
6
6
|
export class GridTaskAddNodesFixed extends GridTaskGenerator {
|
|
7
7
|
constructor() {
|
|
@@ -2,7 +2,6 @@ import { inverseLerp } from "../../../../core/math/inverseLerp.js";
|
|
|
2
2
|
import { lerp } from "../../../../core/math/lerp.js";
|
|
3
3
|
import { seededRandom } from "../../../../core/math/random/seededRandom.js";
|
|
4
4
|
import { GridTaskGenerator } from "../../GridTaskGenerator.js";
|
|
5
|
-
import { actionTask, countTask } from "../../../../core/process/task/TaskUtils.js";
|
|
6
5
|
import TaskGroup from "../../../../core/process/task/TaskGroup.js";
|
|
7
6
|
import Graph from "../../../../core/graph/Graph.js";
|
|
8
7
|
import BinaryHeap from "../../../../core/collection/heap/FastBinaryHeap.js";
|
|
@@ -23,6 +22,8 @@ import { buildUnsignedDistanceField } from "../util/buildUnsignedDistanceField.j
|
|
|
23
22
|
import { CellMatcherNot } from "../../../rules/logic/CellMatcherNot.js";
|
|
24
23
|
import { RoadConnectionNetwork } from "./RoadConnectionNetwork.js";
|
|
25
24
|
import { MirGridLayers } from "../../../example/grid/MirGridLayers.js";
|
|
25
|
+
import { actionTask } from "../../../../core/process/task/util/actionTask.js";
|
|
26
|
+
import { countTask } from "../../../../core/process/task/util/countTask.js";
|
|
26
27
|
|
|
27
28
|
const NODE_TYPE_ROAD_CONNECTOR = 'Road Connector';
|
|
28
29
|
|
|
@@ -301,7 +302,7 @@ function buildPaths(
|
|
|
301
302
|
} else if (distance < distances[neighbour_index]) {
|
|
302
303
|
|
|
303
304
|
distances[neighbour_index] = distances;
|
|
304
|
-
open.
|
|
305
|
+
open.updateElementScore(neighbour_index);
|
|
305
306
|
|
|
306
307
|
}
|
|
307
308
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { PI_HALF } from "../../core/math/MathUtils.js";
|
|
2
2
|
import { assert } from "../../core/assert.js";
|
|
3
3
|
import { seededRandom } from "../../core/math/random/seededRandom.js";
|
|
4
|
-
import { countTask, randomCountTask } from "../../core/process/task/TaskUtils.js";
|
|
5
4
|
import { RuleSelectionPolicyType } from "./RuleSelectionPolicyType.js";
|
|
6
5
|
import { ArrayIteratorSequential } from "../../core/collection/array/ArrayIteratorSequential.js";
|
|
7
6
|
import { ArrayIteratorRandom } from "../../core/collection/array/ArrayIteratorRandom.js";
|
|
8
7
|
import TaskGroup from "../../core/process/task/TaskGroup.js";
|
|
8
|
+
import { randomCountTask } from "../../core/process/task/util/randomCountTask.js";
|
|
9
|
+
import { countTask } from "../../core/process/task/util/countTask.js";
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { GridCellAction } from "./action/GridCellAction.js";
|
|
2
2
|
import { MarkerNodeMatcherAny } from "../markers/matcher/MarkerNodeMatcherAny.js";
|
|
3
3
|
import { assert } from "../../core/assert.js";
|
|
4
|
+
import { qt_match_data_by_circle } from "../../core/geom/2d/quad-tree/qt_match_data_by_circle.js";
|
|
4
5
|
|
|
5
6
|
export class GridCellActionTransformNearbyMarkers extends GridCellAction {
|
|
6
7
|
constructor() {
|
|
@@ -91,10 +92,7 @@ export class GridCellActionTransformNearbyMarkers extends GridCellAction {
|
|
|
91
92
|
|
|
92
93
|
const transformer = this.transformer;
|
|
93
94
|
|
|
94
|
-
|
|
95
|
-
this.__leaf_cursor = 0;
|
|
96
|
-
|
|
97
|
-
data.markers.traverseCircleIntersections(x, y, this.radius, this.__visitMarker, this);
|
|
95
|
+
this.__leaf_cursor = qt_match_data_by_circle(this.__leaves, 0, data.markers, x, y, this.radius, this.matcher.match, this.matcher);
|
|
98
96
|
|
|
99
97
|
const match_count = this.__leaf_cursor;
|
|
100
98
|
const leaves = this.__leaves;
|
|
@@ -2,7 +2,6 @@ import { QuadTreeNode } from "../../core/geom/2d/quad-tree/QuadTreeNode.js";
|
|
|
2
2
|
import { assert } from "../../core/assert.js";
|
|
3
3
|
import { seededRandom } from "../../core/math/random/seededRandom.js";
|
|
4
4
|
import { TerrainLayerRuleAggregator } from "./TerrainLayerRuleAggregator.js";
|
|
5
|
-
import { actionTask, countTask, emptyTask, futureTask } from "../../core/process/task/TaskUtils.js";
|
|
6
5
|
import { Sampler2D } from "../../engine/graphics/texture/sampler/Sampler2D.js";
|
|
7
6
|
import Task from "../../core/process/task/Task.js";
|
|
8
7
|
import { TaskSignal } from "../../core/process/task/TaskSignal.js";
|
|
@@ -17,6 +16,10 @@ import { TerrainFlags } from "../../engine/ecs/terrain/ecs/TerrainFlags.js";
|
|
|
17
16
|
import { binarySearchLowIndex } from "../../core/collection/array/binarySearchLowIndex.js";
|
|
18
17
|
import { randomFloatBetween } from "../../core/math/random/randomFloatBetween.js";
|
|
19
18
|
import { obtainTerrain } from "../../engine/ecs/terrain/util/obtainTerrain.js";
|
|
19
|
+
import { actionTask } from "../../core/process/task/util/actionTask.js";
|
|
20
|
+
import { countTask } from "../../core/process/task/util/countTask.js";
|
|
21
|
+
import { emptyTask } from "../../core/process/task/util/emptyTask.js";
|
|
22
|
+
import { futureTask } from "../../core/process/task/util/futureTask.js";
|
|
20
23
|
|
|
21
24
|
/**
|
|
22
25
|
*
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"productName": "Meep",
|
|
6
6
|
"description": "production-ready JavaScript game engine based on Entity Component System Architecture",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.
|
|
8
|
+
"version": "2.43.0",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"gl-matrix": "3.4.3",
|
|
11
11
|
"fast-levenshtein": "2.0.6",
|
|
@@ -56,19 +56,19 @@ export class AssetLoaderStatusView extends View {
|
|
|
56
56
|
|
|
57
57
|
self.pendingAssetCount.set(0);
|
|
58
58
|
|
|
59
|
-
this.assetManager.
|
|
59
|
+
this.assetManager.request_map.forEach(function (key, value) {
|
|
60
60
|
self.__handlerAssetAdded(key, value);
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
this.assetManager.
|
|
64
|
-
this.assetManager.
|
|
63
|
+
this.assetManager.request_map.on.set.add(this.__handlerAssetAdded);
|
|
64
|
+
this.assetManager.request_map.on.deleted.add(this.__handlerAssetRemoved);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
unlink() {
|
|
68
68
|
super.unlink();
|
|
69
69
|
|
|
70
70
|
|
|
71
|
-
this.assetManager.
|
|
72
|
-
this.assetManager.
|
|
71
|
+
this.assetManager.request_map.on.set.remove(this.__handlerAssetAdded);
|
|
72
|
+
this.assetManager.request_map.on.deleted.remove(this.__handlerAssetRemoved);
|
|
73
73
|
}
|
|
74
74
|
}
|