@woosh/meep-engine 2.39.5 → 2.39.9
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/BinaryBuffer.js +1 -0
- package/core/geom/3d/triangle/computeTriangleRayIntersection.js +39 -0
- package/core/math/FLT_EPSILON_32.js +7 -0
- package/core/math/random/seededRandom_Mulberry32.js +1 -1
- package/core/model/stat/LinearModifier.js +7 -0
- package/core/process/task/RemainingTimeEstimator.js +49 -0
- package/core/process/task/Task.js +3 -1
- package/engine/Engine.js +0 -83
- package/engine/asset/AssetManager.d.ts +3 -0
- package/engine/asset/AssetManager.js +5 -4
- package/engine/ecs/terrain/ecs/Terrain.js +33 -0
- package/engine/ecs/terrain/ecs/layers/TerrainLayer.js +13 -0
- package/engine/ecs/terrain/ecs/layers/TerrainLayers.js +44 -2
- package/engine/ecs/terrain/ecs/splat/SplatMapping.js +12 -4
- package/engine/graphics/ecs/path/testPathDisplaySystem.js +58 -53
- package/engine/graphics/ecs/path/tube/PathNormalType.d.ts +4 -0
- package/engine/graphics/ecs/path/tube/PathNormalType.js +11 -0
- package/engine/graphics/ecs/path/tube/TubePathStyle.d.ts +4 -0
- package/engine/graphics/ecs/path/tube/TubePathStyle.js +21 -3
- package/engine/graphics/ecs/path/tube/build/build_geometry_catmullrom.js +4 -1
- package/engine/graphics/ecs/path/tube/build/build_geometry_linear.js +4 -1
- package/engine/graphics/ecs/path/tube/build/computeFrenetFrames.js +41 -24
- package/engine/graphics/geometry/VertexDataSpec.js +24 -0
- package/engine/graphics/geometry/buffered/query/RaycastNearestHitComputingVisitor.js +25 -5
- package/engine/graphics/shaders/TerrainShader.js +3 -7
- package/engine/knowledge/database/StaticKnowledgeDataTable.js +66 -28
- package/engine/navigation/ecs/components/Path.js +58 -232
- package/engine/notify/Notification.js +3 -0
- package/engine/scene/transitionToScene.js +2 -1
- package/engine/ui/notification/AnimatedObjectEmitter.js +3 -2
- package/engine/ui/notification/ViewEmitter.js +8 -0
- package/engine/ui/scene/initializeNotifications.js +3 -0
- package/generation/{GridGenerator.js → GridTaskGroup.js} +21 -5
- package/generation/example/SampleGenerator0.js +2 -2
- package/generation/example/main.js +2 -1
- package/generation/filtering/core/CellFilterUnaryOperation.js +5 -8
- package/generation/filtering/numeric/util/CellFilterDisplaced.js +7 -7
- package/generation/grid/generation/GridTaskSequence.js +5 -3
- package/generation/markers/actions/MarkerNodeActionImaginary.js +86 -0
- package/generation/markers/actions/terrain/MarkerNodeActionPaintTerrain.js +265 -0
- package/generation/theme/TerrainLayerDescription.js +11 -0
- package/generation/theme/ThemeEngine.js +5 -6
- package/package.json +1 -1
- package/samples/terrain/from_image.js +2 -1
- package/view/common/ListView.js +7 -1
- package/view/elements/windrose/WindRoseDiagram.js +13 -0
- package/view/task/TaskLoadingScreen.js +172 -0
- package/view/{common → task}/TaskProgressView.js +4 -36
- package/view/tooltip/gml/GMLEngine.js +13 -0
- package/generation/markers/actions/MarkerNodeActionSelectRandom.js +0 -65
|
@@ -7,12 +7,10 @@ import Vector3 from "../../../../core/geom/Vector3.js";
|
|
|
7
7
|
|
|
8
8
|
import { CatmullRomCurve3 } from "three";
|
|
9
9
|
import { clamp } from "../../../../core/math/clamp.js";
|
|
10
|
-
import { lerp } from "../../../../core/math/lerp.js";
|
|
11
10
|
import { assert } from "../../../../core/assert.js";
|
|
12
11
|
import { RowFirstTableSpec } from "../../../../core/collection/table/RowFirstTableSpec.js";
|
|
13
12
|
import { DataType } from "../../../../core/collection/table/DataType.js";
|
|
14
13
|
import { RowFirstTable } from "../../../../core/collection/table/RowFirstTable.js";
|
|
15
|
-
import { max2 } from "../../../../core/math/max2.js";
|
|
16
14
|
import { min2 } from "../../../../core/math/min2.js";
|
|
17
15
|
import { computeNonuniformCatmullRomSplineSample } from "./computeNonuniformCatmullRomSplineSample.js";
|
|
18
16
|
import { InterpolationType } from "./InterpolationType.js";
|
|
@@ -20,6 +18,8 @@ import { v3_distance } from "../../../../core/geom/v3_distance.js";
|
|
|
20
18
|
import {
|
|
21
19
|
line3_computeSegmentPointDistance_sqr
|
|
22
20
|
} from "../../../../core/geom/3d/line/line3_computeSegmentPointDistance_sqr.js";
|
|
21
|
+
import { VertexDataSpec } from "../../../graphics/geometry/VertexDataSpec.js";
|
|
22
|
+
import { AttributeSpec } from "../../../graphics/geometry/AttributeSpec.js";
|
|
23
23
|
|
|
24
24
|
const v3_a = new Vector3();
|
|
25
25
|
const v3_b = new Vector3();
|
|
@@ -53,10 +53,32 @@ const scratch_array_3 = [];
|
|
|
53
53
|
*/
|
|
54
54
|
const scratch_array_4 = [];
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
/**
|
|
57
|
+
*
|
|
58
|
+
* @type {RowFirstTableSpec}
|
|
59
|
+
*/
|
|
60
|
+
const DEFAULT_SPEC = Object.freeze(new RowFirstTableSpec([
|
|
61
|
+
DataType.Float32, // position X
|
|
62
|
+
DataType.Float32, // position Y
|
|
63
|
+
DataType.Float32 // position Z
|
|
64
|
+
]));
|
|
57
65
|
|
|
58
66
|
class Path {
|
|
59
67
|
constructor() {
|
|
68
|
+
/**
|
|
69
|
+
*
|
|
70
|
+
* @type {VertexDataSpec}
|
|
71
|
+
* @private
|
|
72
|
+
*/
|
|
73
|
+
this.__spec = VertexDataSpec.from(
|
|
74
|
+
AttributeSpec.fromJSON({
|
|
75
|
+
name: 'position',
|
|
76
|
+
type: DataType.Float32,
|
|
77
|
+
itemSize: 3,
|
|
78
|
+
normalized: false
|
|
79
|
+
})
|
|
80
|
+
);
|
|
81
|
+
|
|
60
82
|
/**
|
|
61
83
|
* @readonly
|
|
62
84
|
* @type {RowFirstTable}
|
|
@@ -65,27 +87,36 @@ class Path {
|
|
|
65
87
|
this.__data = new RowFirstTable(DEFAULT_SPEC);
|
|
66
88
|
|
|
67
89
|
/**
|
|
68
|
-
*
|
|
90
|
+
* Now to get in-between values
|
|
69
91
|
* @type {InterpolationType|number}
|
|
70
92
|
*/
|
|
71
93
|
this.interpolation = InterpolationType.Linear;
|
|
72
94
|
|
|
73
95
|
/**
|
|
74
|
-
*
|
|
96
|
+
* Absolute length of the path, measured as straight-line distance sum of point pairs
|
|
75
97
|
* @type {number}
|
|
76
98
|
* @private
|
|
77
99
|
*/
|
|
78
100
|
this.__length = -1;
|
|
79
101
|
}
|
|
80
102
|
|
|
103
|
+
/**
|
|
104
|
+
* @deprecated
|
|
105
|
+
*/
|
|
81
106
|
get markerOffset() {
|
|
82
107
|
throw new Error('deprecated, use PathFollower instead');
|
|
83
108
|
}
|
|
84
109
|
|
|
110
|
+
/**
|
|
111
|
+
* @deprecated
|
|
112
|
+
*/
|
|
85
113
|
get markerIndex() {
|
|
86
114
|
throw new Error('deprecated, use PathFollower instead');
|
|
87
115
|
}
|
|
88
116
|
|
|
117
|
+
/**
|
|
118
|
+
* @deprecated
|
|
119
|
+
*/
|
|
89
120
|
get markerDistanceToNext() {
|
|
90
121
|
throw new Error('deprecated, use PathFollower instead');
|
|
91
122
|
}
|
|
@@ -100,13 +131,10 @@ class Path {
|
|
|
100
131
|
|
|
101
132
|
/**
|
|
102
133
|
*
|
|
103
|
-
* TODO this needs to be moved to PathFollower
|
|
104
134
|
* @deprecated
|
|
105
135
|
*/
|
|
106
136
|
reset() {
|
|
107
|
-
|
|
108
|
-
this.markerOffset = 0;
|
|
109
|
-
this.markerIndex = 0;
|
|
137
|
+
throw new Error('deprecated, use PathFollower instead');
|
|
110
138
|
}
|
|
111
139
|
|
|
112
140
|
clear() {
|
|
@@ -146,6 +174,9 @@ class Path {
|
|
|
146
174
|
|
|
147
175
|
// force row count
|
|
148
176
|
this.__data.length = v;
|
|
177
|
+
|
|
178
|
+
// reset computed length
|
|
179
|
+
this.__length = -1;
|
|
149
180
|
}
|
|
150
181
|
|
|
151
182
|
/**
|
|
@@ -160,6 +191,10 @@ class Path {
|
|
|
160
191
|
return false;
|
|
161
192
|
} else {
|
|
162
193
|
this.__data.removeRows(index, 1);
|
|
194
|
+
|
|
195
|
+
// reset computed length
|
|
196
|
+
this.__length = -1;
|
|
197
|
+
|
|
163
198
|
return true;
|
|
164
199
|
}
|
|
165
200
|
}
|
|
@@ -189,7 +224,7 @@ class Path {
|
|
|
189
224
|
* @param {number} z
|
|
190
225
|
*/
|
|
191
226
|
setPosition(index, x, y, z) {
|
|
192
|
-
assert.
|
|
227
|
+
assert.lessThanOrEqual(index, this.count, "overflow");
|
|
193
228
|
|
|
194
229
|
assert.isNumber(x, "x");
|
|
195
230
|
assert.isNumber(y, "y");
|
|
@@ -264,6 +299,9 @@ class Path {
|
|
|
264
299
|
}
|
|
265
300
|
}
|
|
266
301
|
|
|
302
|
+
/**
|
|
303
|
+
* Reverse order of points
|
|
304
|
+
*/
|
|
267
305
|
reverse() {
|
|
268
306
|
this.__data.reverse_rows();
|
|
269
307
|
}
|
|
@@ -275,6 +313,7 @@ class Path {
|
|
|
275
313
|
copy(other) {
|
|
276
314
|
this.__data.copy(other.__data);
|
|
277
315
|
this.interpolation = other.interpolation;
|
|
316
|
+
this.__length = other.__length;
|
|
278
317
|
}
|
|
279
318
|
|
|
280
319
|
/**
|
|
@@ -336,101 +375,21 @@ class Path {
|
|
|
336
375
|
return closest_index;
|
|
337
376
|
}
|
|
338
377
|
|
|
339
|
-
|
|
340
|
-
* TODO this needs to be moved to PathFollower
|
|
378
|
+
/*
|
|
341
379
|
* @deprecated
|
|
342
380
|
* @returns {number}
|
|
343
381
|
*/
|
|
344
382
|
getCurrentOffset() {
|
|
345
|
-
|
|
346
|
-
let result = 0;
|
|
347
|
-
|
|
348
|
-
const n = this.getPointCount();
|
|
349
|
-
|
|
350
|
-
if (n < 2) {
|
|
351
|
-
return 0;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
let current = v3_a;
|
|
355
|
-
let previous = v3_b;
|
|
356
|
-
|
|
357
|
-
this.getPosition(0, previous);
|
|
358
|
-
|
|
359
|
-
for (let i = 1; i < n; i++) {
|
|
360
|
-
this.getPosition(i, current);
|
|
361
|
-
|
|
362
|
-
if (i > this.markerIndex) {
|
|
363
|
-
result += this.markerOffset;
|
|
364
|
-
break;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
const d = previous.distanceTo(current);
|
|
368
|
-
|
|
369
|
-
result += d;
|
|
370
|
-
|
|
371
|
-
// swap
|
|
372
|
-
const t = previous;
|
|
373
|
-
previous = current;
|
|
374
|
-
current = t;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
return result;
|
|
383
|
+
throw new Error('deprecated, use PathFollower instead');
|
|
378
384
|
}
|
|
379
385
|
|
|
380
386
|
/**
|
|
381
|
-
* TODO this needs to be moved to PathFollower
|
|
382
387
|
* @param {number} distanceDelta
|
|
383
388
|
* @returns {number} unused distance
|
|
384
389
|
* @deprecated
|
|
385
390
|
*/
|
|
386
391
|
move(distanceDelta) {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
if (!this.isComplete()) {
|
|
390
|
-
|
|
391
|
-
const point_count = this.getPointCount();
|
|
392
|
-
const max_index = point_count - 1;
|
|
393
|
-
|
|
394
|
-
distanceDelta += this.markerOffset;
|
|
395
|
-
|
|
396
|
-
this.markerOffset = 0;
|
|
397
|
-
|
|
398
|
-
let current = v3_a;
|
|
399
|
-
let next = v3_b;
|
|
400
|
-
|
|
401
|
-
this.getPosition(this.markerIndex, current);
|
|
402
|
-
|
|
403
|
-
while (distanceDelta > 0) {
|
|
404
|
-
this.getPosition(this.markerIndex + 1, next);
|
|
405
|
-
|
|
406
|
-
const distance = current.distanceTo(next);
|
|
407
|
-
this.markerDistanceToNext = distance;
|
|
408
|
-
|
|
409
|
-
if (distanceDelta < distance) {
|
|
410
|
-
this.markerOffset = distanceDelta;
|
|
411
|
-
return 0;
|
|
412
|
-
} else {
|
|
413
|
-
this.markerIndex++;
|
|
414
|
-
distanceDelta -= distance;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
// swap points
|
|
418
|
-
const swap_t = current;
|
|
419
|
-
|
|
420
|
-
current = next;
|
|
421
|
-
next = swap_t;
|
|
422
|
-
|
|
423
|
-
if (this.markerIndex >= max_index) {
|
|
424
|
-
//reached the end of the path
|
|
425
|
-
this.markerOffset = 0;
|
|
426
|
-
this.markerIndex = max_index;
|
|
427
|
-
break;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
return distanceDelta;
|
|
392
|
+
throw new Error('deprecated, use PathFollower instead');
|
|
434
393
|
}
|
|
435
394
|
|
|
436
395
|
/**
|
|
@@ -573,10 +532,7 @@ class Path {
|
|
|
573
532
|
* @deprecated use {@link PathFollower#finished} instead
|
|
574
533
|
*/
|
|
575
534
|
isComplete() {
|
|
576
|
-
|
|
577
|
-
const lastIndex = this.getPointCount() - 1;
|
|
578
|
-
|
|
579
|
-
return this.markerIndex >= lastIndex;
|
|
535
|
+
throw new Error('deprecated, use PathFollower instead');
|
|
580
536
|
}
|
|
581
537
|
|
|
582
538
|
|
|
@@ -604,167 +560,37 @@ class Path {
|
|
|
604
560
|
* @deprecated
|
|
605
561
|
*/
|
|
606
562
|
getCurrentPosition(result) {
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
case InterpolationType.Zero:
|
|
610
|
-
return this.computePositionOrder0(result);
|
|
611
|
-
case InterpolationType.Linear:
|
|
612
|
-
return this.computePositionOrder1(result);
|
|
613
|
-
case InterpolationType.Second:
|
|
614
|
-
return this.computePositionOrder2(result);
|
|
615
|
-
default:
|
|
616
|
-
throw new Error(`Unsupported sampling type ${this.interpolation}`);
|
|
617
|
-
}
|
|
563
|
+
|
|
564
|
+
throw new Error('deprecated, use PathFollower instead');
|
|
618
565
|
}
|
|
619
566
|
|
|
620
567
|
/**
|
|
621
|
-
* TODO this needs to be moved to PathFollower
|
|
622
568
|
* @param {Vector3} result
|
|
623
569
|
* @return {boolean}
|
|
624
570
|
* @deprecated
|
|
625
571
|
*/
|
|
626
572
|
computePositionOrder0(result) {
|
|
627
|
-
|
|
628
|
-
const index = this.markerIndex;
|
|
629
|
-
|
|
630
|
-
if (index >= this.getPointCount()) {
|
|
631
|
-
return false;
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
this.getPosition(index, result);
|
|
635
|
-
|
|
636
|
-
return true;
|
|
573
|
+
throw new Error('deprecated, use PathFollower instead');
|
|
637
574
|
}
|
|
638
575
|
|
|
639
576
|
/**
|
|
640
577
|
*
|
|
641
|
-
* TODO this needs to be moved to PathFollower
|
|
642
578
|
* @param {Vector3} result
|
|
643
579
|
* @return {boolean}
|
|
644
580
|
* @deprecated
|
|
645
581
|
*/
|
|
646
582
|
computePositionOrder1(result) {
|
|
647
|
-
|
|
648
|
-
const pointCount = this.getPointCount();
|
|
649
|
-
const markerIndex = this.markerIndex;
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
if (markerIndex >= pointCount) {
|
|
653
|
-
// we're at the end
|
|
654
|
-
return false;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
this.getPosition(markerIndex, v3_a);
|
|
658
|
-
const d = this.markerOffset;
|
|
659
|
-
|
|
660
|
-
if (d === 0) {
|
|
661
|
-
result.copy(v3_a);
|
|
662
|
-
return true;
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
const next_index = markerIndex + 1;
|
|
666
|
-
|
|
667
|
-
if (next_index >= pointCount) {
|
|
668
|
-
// we're at the end, no next point
|
|
669
|
-
return false;
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
this.getPosition(next_index, v3_b);
|
|
673
|
-
|
|
674
|
-
const l = this.markerDistanceToNext;
|
|
675
|
-
|
|
676
|
-
if (d === l) {
|
|
677
|
-
result.copy(v3_b);
|
|
678
|
-
return true;
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
const nd = d / l;
|
|
682
|
-
|
|
683
|
-
result.lerpVectors(v3_a, v3_b, nd);
|
|
684
|
-
|
|
685
|
-
return true;
|
|
583
|
+
throw new Error('deprecated, use PathFollower instead');
|
|
686
584
|
}
|
|
687
585
|
|
|
688
586
|
/**
|
|
689
587
|
*
|
|
690
|
-
* TODO this needs to be moved to PathFollower
|
|
691
588
|
* @param {Vector3} result
|
|
692
589
|
* @return {boolean}
|
|
693
590
|
* @deprecated
|
|
694
591
|
*/
|
|
695
592
|
computePositionOrder2(result) {
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
const i = this.markerIndex;
|
|
699
|
-
|
|
700
|
-
const iMax = this.getPointCount() - 1;
|
|
701
|
-
|
|
702
|
-
if (iMax < 0) {
|
|
703
|
-
//no points to sample
|
|
704
|
-
return false;
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
//get 2 below and 2 above
|
|
708
|
-
const pi0 = max2(i - 1, 0);
|
|
709
|
-
const pi1 = i;
|
|
710
|
-
const pi2 = min2(i + 1, iMax);
|
|
711
|
-
const pi3 = min2(i + 2, iMax);
|
|
712
|
-
|
|
713
|
-
// read out point data
|
|
714
|
-
this.getPosition(pi0, v3_a);
|
|
715
|
-
|
|
716
|
-
const p0_x = v3_a.x;
|
|
717
|
-
const p0_y = v3_a.y;
|
|
718
|
-
const p0_z = v3_a.z;
|
|
719
|
-
|
|
720
|
-
this.getPosition(pi1, v3_a);
|
|
721
|
-
|
|
722
|
-
const p1_x = v3_a.x;
|
|
723
|
-
const p1_y = v3_a.y;
|
|
724
|
-
const p1_z = v3_a.z;
|
|
725
|
-
|
|
726
|
-
this.getPosition(pi2, v3_a);
|
|
727
|
-
|
|
728
|
-
const p2_x = v3_a.x;
|
|
729
|
-
const p2_y = v3_a.y;
|
|
730
|
-
const p2_z = v3_a.z;
|
|
731
|
-
|
|
732
|
-
this.getPosition(pi3, v3_a);
|
|
733
|
-
|
|
734
|
-
const p3_x = v3_a.x;
|
|
735
|
-
const p3_y = v3_a.y;
|
|
736
|
-
const p3_z = v3_a.z;
|
|
737
|
-
|
|
738
|
-
//compute delta vectors between points
|
|
739
|
-
const ax = p1_x - p0_x;
|
|
740
|
-
const ay = p1_y - p0_y;
|
|
741
|
-
const az = p1_z - p0_z;
|
|
742
|
-
|
|
743
|
-
const cx = p3_x - p2_x;
|
|
744
|
-
const cy = p3_y - p2_y;
|
|
745
|
-
const cz = p3_z - p2_z;
|
|
746
|
-
|
|
747
|
-
const d = this.markerOffset;
|
|
748
|
-
const l = this.markerDistanceToNext;
|
|
749
|
-
|
|
750
|
-
let nd;
|
|
751
|
-
|
|
752
|
-
if (l === 0) {
|
|
753
|
-
nd = 0;
|
|
754
|
-
} else {
|
|
755
|
-
nd = d / l;
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
//interpolate slope
|
|
759
|
-
const ind = 1 - nd;
|
|
760
|
-
|
|
761
|
-
const x = lerp(p1_x + ax * nd, p2_x - cx * ind, nd);
|
|
762
|
-
const y = lerp(p1_y + ay * nd, p2_y - cy * ind, nd);
|
|
763
|
-
const z = lerp(p1_z + az * nd, p2_z - cz * ind, nd);
|
|
764
|
-
|
|
765
|
-
result.set(x, y, z);
|
|
766
|
-
|
|
767
|
-
return true;
|
|
593
|
+
throw new Error('deprecated, use PathFollower instead');
|
|
768
594
|
}
|
|
769
595
|
|
|
770
596
|
toString() {
|
|
@@ -6,6 +6,7 @@ import { noop } from "../../core/function/Functions.js";
|
|
|
6
6
|
import { compileAllMaterials } from "../graphics/ecs/compileAllMaterials.js";
|
|
7
7
|
import { createTaskWaitForMeshesToLoad } from "../graphics/ecs/mesh/createTaskWaitForMeshesToLoad.js";
|
|
8
8
|
import { loadVisibleTerrainTiles } from "../ecs/terrain/util/loadVisibleTerrainTiles.js";
|
|
9
|
+
import { TaskLoadingScreen } from "../../view/task/TaskLoadingScreen.js";
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -117,7 +118,7 @@ export function transitionToScene({ tasks = [], scene, engine, name }) {
|
|
|
117
118
|
}
|
|
118
119
|
);
|
|
119
120
|
|
|
120
|
-
const promise =
|
|
121
|
+
const promise = TaskLoadingScreen.load(engine, taskGroup);
|
|
121
122
|
|
|
122
123
|
Task.joinAll(tasks, () => {
|
|
123
124
|
engine.executor.runMany(extraTasks);
|
|
@@ -75,7 +75,8 @@ export class AnimatedObjectEmitter {
|
|
|
75
75
|
this.rushThreshold = Number.POSITIVE_INFINITY;
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
|
-
*
|
|
78
|
+
* Minimum time that must pass between objects being emitted (in Seconds)
|
|
79
|
+
* Objects spawned more often than that will be buffered and released at regular intervals
|
|
79
80
|
* @type {number}
|
|
80
81
|
*/
|
|
81
82
|
this.spawnDelay = 0;
|
|
@@ -101,7 +102,7 @@ export class AnimatedObjectEmitter {
|
|
|
101
102
|
};
|
|
102
103
|
|
|
103
104
|
/**
|
|
104
|
-
*
|
|
105
|
+
* Number of active objects
|
|
105
106
|
* @type {number}
|
|
106
107
|
*/
|
|
107
108
|
this.liveCount = 0;
|
|
@@ -58,6 +58,14 @@ class ViewEmitter {
|
|
|
58
58
|
this.objectEmitter.rushThreshold = v;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @param {number} v in seconds
|
|
64
|
+
*/
|
|
65
|
+
setSpawnDelay(v) {
|
|
66
|
+
this.objectEmitter.spawnDelay = v;
|
|
67
|
+
}
|
|
68
|
+
|
|
61
69
|
tick(timeDelta) {
|
|
62
70
|
const scaledTimeDelta = timeDelta * this.timeScale;
|
|
63
71
|
|
|
@@ -12,6 +12,7 @@ function makePrimary() {
|
|
|
12
12
|
*/
|
|
13
13
|
const viewEmitter = new ViewEmitter();
|
|
14
14
|
viewEmitter.setRushThreshold(1);
|
|
15
|
+
viewEmitter.setSpawnDelay(2);
|
|
15
16
|
|
|
16
17
|
const animationTrack = new AnimationTrack(["alpha", "scale"]);
|
|
17
18
|
animationTrack.addKey(0, [0, 1.3]);
|
|
@@ -51,6 +52,7 @@ function makeSecondary() {
|
|
|
51
52
|
*/
|
|
52
53
|
const viewEmitter = new ViewEmitter();
|
|
53
54
|
viewEmitter.setRushThreshold(1);
|
|
55
|
+
viewEmitter.setSpawnDelay(0.7);
|
|
54
56
|
|
|
55
57
|
const animationTrack = new AnimationTrack(["alpha", "position.y", "scale"]);
|
|
56
58
|
animationTrack.addKey(0, [0.2, 0, 1.1]);
|
|
@@ -92,6 +94,7 @@ function makeToast() {
|
|
|
92
94
|
*/
|
|
93
95
|
const viewEmitter = new ViewEmitter();
|
|
94
96
|
viewEmitter.setRushThreshold(5);
|
|
97
|
+
viewEmitter.setSpawnDelay(0.1);
|
|
95
98
|
|
|
96
99
|
const animationTrack = new AnimationTrack(["alpha", "position.x"]);
|
|
97
100
|
animationTrack.addKey(0, [0.2, 100]);
|
|
@@ -1,22 +1,38 @@
|
|
|
1
1
|
import TaskGroup from "../core/process/task/TaskGroup.js";
|
|
2
|
+
import { GridTaskGenerator } from "./grid/GridTaskGenerator.js";
|
|
2
3
|
|
|
3
|
-
export class
|
|
4
|
+
export class GridTaskGroup extends GridTaskGenerator {
|
|
4
5
|
constructor() {
|
|
6
|
+
super();
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
*
|
|
8
10
|
* @type {GridTaskGenerator[]}
|
|
9
11
|
*/
|
|
10
|
-
this.
|
|
12
|
+
this.children = [];
|
|
11
13
|
|
|
12
14
|
}
|
|
13
15
|
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @param {GridTaskGenerator[]} children
|
|
20
|
+
* @returns {GridTaskGroup}
|
|
21
|
+
*/
|
|
22
|
+
static from(children) {
|
|
23
|
+
const r = new GridTaskGroup();
|
|
24
|
+
|
|
25
|
+
children.forEach(r.addGenerator, r);
|
|
26
|
+
|
|
27
|
+
return r;
|
|
28
|
+
}
|
|
29
|
+
|
|
14
30
|
/**
|
|
15
31
|
*
|
|
16
32
|
* @param {GridTaskGenerator} generator
|
|
17
33
|
*/
|
|
18
34
|
addGenerator(generator) {
|
|
19
|
-
this.
|
|
35
|
+
this.children.push(generator);
|
|
20
36
|
}
|
|
21
37
|
|
|
22
38
|
/**
|
|
@@ -26,7 +42,7 @@ export class GridGenerator {
|
|
|
26
42
|
* @param {number} seed
|
|
27
43
|
* @returns {TaskGroup}
|
|
28
44
|
*/
|
|
29
|
-
|
|
45
|
+
build(grid, ecd, seed) {
|
|
30
46
|
|
|
31
47
|
/**
|
|
32
48
|
*
|
|
@@ -34,7 +50,7 @@ export class GridGenerator {
|
|
|
34
50
|
*/
|
|
35
51
|
const tasks = [];
|
|
36
52
|
|
|
37
|
-
const generators = this.
|
|
53
|
+
const generators = this.children;
|
|
38
54
|
const generator_count = generators.length;
|
|
39
55
|
|
|
40
56
|
//generate tasks
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GridTaskGroup } from "../GridTaskGroup.js";
|
|
2
2
|
import { GridCellPlacementRule } from "../placement/GridCellPlacementRule.js";
|
|
3
3
|
import { CellMatcherGridPattern } from "../rules/cell/CellMatcherGridPattern.js";
|
|
4
4
|
import { CellMatcherLayerBitMaskTest } from "../rules/CellMatcherLayerBitMaskTest.js";
|
|
@@ -55,7 +55,7 @@ import { CellFilterCubicFunction } from "../filtering/numeric/math/poly/CellFilt
|
|
|
55
55
|
import { CellFilterMax2 } from "../filtering/numeric/math/CellFilterMax2.js";
|
|
56
56
|
import { matcher_not_play_area } from "./rules/matcher_not_play_area.js";
|
|
57
57
|
|
|
58
|
-
export const SampleGenerator0 = new
|
|
58
|
+
export const SampleGenerator0 = new GridTaskGroup();
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
const pTreasureCorner = new CellMatcherGridPattern();
|
|
@@ -28,6 +28,7 @@ import { MeshSystem } from "../../engine/graphics/ecs/mesh/MeshSystem.js";
|
|
|
28
28
|
import TopDownCameraControllerSystem from "../../engine/graphics/ecs/camera/topdown/TopDownCameraControllerSystem.js";
|
|
29
29
|
import { TopDownCameraLanderSystem } from "../../engine/graphics/ecs/camera/topdown/TopDownCameraLanderSystem.js";
|
|
30
30
|
import LightSystem from "../../engine/graphics/ecs/light/LightSystem.js";
|
|
31
|
+
import { TaskLoadingScreen } from "../../view/task/TaskLoadingScreen.js";
|
|
31
32
|
|
|
32
33
|
function makeEngineConfig(engine) {
|
|
33
34
|
const config = new EngineConfiguration();
|
|
@@ -182,7 +183,7 @@ function main(engine) {
|
|
|
182
183
|
|
|
183
184
|
const tBuildLevel = prepare_gen_task({ ecd });
|
|
184
185
|
|
|
185
|
-
|
|
186
|
+
TaskLoadingScreen.load(engine, tBuildLevel);
|
|
186
187
|
|
|
187
188
|
engine.executor.runGroup(tBuildLevel);
|
|
188
189
|
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { CellFilter } from "../CellFilter.js";
|
|
2
2
|
|
|
3
3
|
export class CellFilterUnaryOperation extends CellFilter {
|
|
4
|
-
constructor() {
|
|
5
|
-
super();
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @type {CellFilter}
|
|
8
|
+
*/
|
|
9
|
+
source = null;
|
|
13
10
|
|
|
14
11
|
/**
|
|
15
12
|
*
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { CellFilterUnaryOperation } from "../../core/CellFilterUnaryOperation.js";
|
|
2
|
-
import Vector2 from "
|
|
3
|
-
import { assert } from "
|
|
2
|
+
import Vector2 from "../../../../core/geom/Vector2.js";
|
|
3
|
+
import { assert } from "../../../../core/assert.js";
|
|
4
4
|
|
|
5
5
|
export class CellFilterDisplaced extends CellFilterUnaryOperation {
|
|
6
|
+
/**
|
|
7
|
+
* @readonly
|
|
8
|
+
* @type {Vector2}
|
|
9
|
+
*/
|
|
10
|
+
offset = new Vector2();
|
|
6
11
|
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
|
|
10
|
-
this.offset = new Vector2();
|
|
11
|
-
}
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
*
|
|
@@ -31,17 +31,19 @@ export class GridTaskSequence extends GridTaskGenerator {
|
|
|
31
31
|
|
|
32
32
|
const tasks = [];
|
|
33
33
|
|
|
34
|
+
// Build tasks
|
|
34
35
|
for (let i = 0; i < n; i++) {
|
|
35
36
|
const child = children[i];
|
|
36
37
|
|
|
37
38
|
if (child.dependencies.length > 0) {
|
|
38
|
-
throw new Error('Children are not allowed to have dependencies');
|
|
39
|
+
throw new Error('Children are not allowed to have dependencies, dependencies are implied by the sequence');
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
const task = child.build(grid, ecd, seed);
|
|
42
43
|
|
|
43
|
-
if (
|
|
44
|
-
|
|
44
|
+
if (i > 0) {
|
|
45
|
+
// add dependence on previous task
|
|
46
|
+
task.addDependency(tasks[i - 1]);
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
tasks.push(task);
|