@woosh/meep-engine 2.55.0 → 2.56.1
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/view/node-graph/PortView.js +2 -2
- package/package.json +1 -1
- package/src/core/binary/BinaryBuffer.js +2 -1
- package/src/core/cache/LoadingCache.js +10 -5
- package/src/core/collection/array/array_remove_element.js +6 -9
- package/src/core/collection/array/array_remove_first.js +13 -6
- package/src/core/collection/array/array_remove_first.spec.js +39 -0
- package/src/core/collection/array/binarySearchHighIndex.spec.js +10 -9
- package/src/core/collection/heap/Uin32Heap.spec.js +36 -0
- package/src/core/collection/heap/Uint32Heap.js +10 -5
- package/src/core/function/FunctionCompiler.js +4 -4
- package/src/core/function/Functions.js +0 -19
- package/src/core/geom/3d/SurfacePoint3.js +30 -20
- package/src/core/geom/3d/SurfacePoint3.spec.js +116 -0
- package/src/core/geom/3d/aabb/AABB3.js +10 -9
- package/src/core/geom/3d/aabb/{aabb3_array_contains_point.js → aabb3_array_intersects_point.js} +4 -1
- package/src/core/geom/3d/aabb/aabb3_from_min_max.js +25 -1
- package/src/core/geom/3d/aabb/aabb3_from_threejs_geometry.js +2 -25
- package/src/core/geom/3d/aabb/aabb3_signed_distance_sqr_to_point.js +5 -1
- package/src/core/geom/3d/apply_mat4_transform_to_direction_v3_array.js +5 -1
- package/src/core/geom/3d/apply_mat4_transform_to_v3_array.js +5 -1
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.js +2 -2
- package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentric.spec.js +26 -0
- package/src/core/geom/3d/v3_compute_triangle_normal.spec.js +18 -0
- package/src/core/geom/Vector2.js +1 -1
- package/src/core/geom/Vector3.js +1 -1
- package/src/core/geom/packing/miniball/Miniball.spec.js +24 -0
- package/src/core/math/statistics/computeStatisticalPartialMedian.js +2 -2
- package/src/core/model/object/read_property.js +2 -2
- package/src/core/model/object/write_property.js +3 -3
- package/src/core/primitives/numbers/compareNumbers.js +4 -4
- package/src/core/primitives/numbers/number_compare_ascending.js +9 -0
- package/src/core/primitives/numbers/number_compare_ascending.spec.js +9 -0
- package/src/core/primitives/numbers/number_compare_descending.js +9 -0
- package/src/core/primitives/numbers/number_compare_descending.spec.js +9 -0
- package/src/core/primitives/numbers/number_format_by_thousands.spec.js +12 -0
- package/src/core/primitives/numbers/number_pretty_print.js +1 -1
- package/src/core/primitives/strings/compareStrings.spec.js +12 -0
- package/src/core/primitives/strings/string_capitalize.js +15 -0
- package/src/core/primitives/strings/string_capitalize.spec.js +13 -0
- package/src/core/primitives/strings/string_compute_byte_size.js +21 -0
- package/src/core/primitives/strings/string_compute_common_prefix.js +44 -0
- package/src/core/primitives/strings/string_compute_common_prefix.spec.js +23 -0
- package/src/core/primitives/strings/string_format_camel_to_kebab.js +9 -0
- package/src/core/primitives/strings/string_format_camel_to_kebab.spec.js +8 -0
- package/src/core/primitives/strings/string_format_kebab_to_underscore.js +8 -0
- package/src/core/time/current_time_in_seconds.js +11 -0
- package/src/engine/Clock.js +3 -13
- package/src/engine/animation/curve/AnimationCurve.spec.js +27 -0
- package/src/engine/asset/AssetManager.js +2 -2
- package/src/engine/ecs/EntityManager.js +8 -1
- package/src/engine/ecs/EntityManager.spec.js +56 -6
- package/src/engine/ecs/animation/Animation.spec.js +22 -0
- package/src/engine/ecs/attachment/Attachment.js +24 -25
- package/src/engine/ecs/attachment/AttachmentBinding.js +27 -30
- package/src/engine/ecs/attachment/AttachmentSystem.js +21 -24
- package/src/engine/ecs/attachment/BoneAttachmentBinding.js +6 -9
- package/src/engine/ecs/attachment/TransformAttachmentBinding.js +0 -3
- package/src/engine/ecs/components/CharacterController.js +24 -18
- package/src/engine/ecs/dynamic_actions/DynamicActorSystem.js +3 -2
- package/src/engine/ecs/fow/FogOfWarRevealer.js +2 -3
- package/src/engine/ecs/ik/IKMath.js +6 -1
- package/src/engine/ecs/ik/IKProblem.js +17 -17
- package/src/engine/ecs/ik/InverseKinematics.js +6 -7
- package/src/engine/ecs/ik/InverseKinematicsSystem.js +24 -26
- package/src/engine/ecs/storage/BinaryBufferSerializer.js +3 -3
- package/src/engine/ecs/systems/TagSystem.js +1 -6
- package/src/engine/ecs/terrain/ecs/layers/TerrainLayer.js +2 -2
- package/src/engine/graphics/ecs/mesh/skeleton/BoneMapping.js +2 -2
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.spec.js +14 -0
- package/src/engine/graphics/ecs/mesh-v2/render/adapters/SGCacheKey.js +21 -9
- package/src/engine/graphics/ecs/mesh-v2/render/adapters/SGCacheKey.spec.js +79 -0
- package/src/engine/graphics/render/visibility/IncrementalDeltaSet.spec.js +7 -6
- package/src/engine/options/OptionGroup.js +10 -0
- package/src/engine/simulation/Ticker.js +17 -20
- package/src/generation/GridTaskGroup.js +5 -9
- package/src/generation/filtering/numeric/CellFilterCache.js +12 -16
- package/src/generation/filtering/numeric/complex/CellFilterFXAA.js +31 -32
- package/src/generation/filtering/numeric/complex/CellFilterLookupTable.js +6 -9
- package/src/generation/filtering/numeric/complex/CellFilterSimplexNoise.js +7 -10
- package/src/generation/filtering/numeric/complex/CellFilterSobel.js +6 -9
- package/src/generation/filtering/numeric/math/CellFilterMembershipGeneralizedBell.js +18 -21
- package/src/generation/filtering/numeric/sampling/AbstractCellFilterSampleGridLayer.js +24 -25
- package/src/generation/filtering/numeric/sampling/CellFilterSampleLayerLinear.js +1 -1
- package/src/generation/grid/GridData.js +23 -22
- package/src/generation/grid/GridData.spec.js +41 -0
- package/src/generation/grid/GridTaskGenerator.js +7 -8
- package/src/generation/grid/layers/GridDataLayer.js +23 -25
- package/src/generation/markers/GridActionRuleSet.js +20 -22
- package/src/generation/markers/GridCellActionPlaceMarker.js +40 -43
- package/src/generation/markers/GridCellActionPlaceMarkerGroup.js +7 -9
- package/src/generation/markers/MarkerNode.js +44 -44
- package/src/generation/markers/actions/MarkerNodeActionEntityPlacement.js +15 -18
- package/src/generation/markers/actions/MarkerNodeActionSequence.js +6 -9
- package/src/generation/markers/actions/MarkerNodeProcessingRuleSet.js +5 -7
- package/src/generation/markers/actions/MarkerProcessingRule.js +25 -26
- package/src/generation/markers/actions/placement/MarkerNodeEntityProcessorClingToTerrain.js +12 -15
- package/src/generation/markers/actions/placement/MarkerNodeEntityProcessorRandomRotation.js +2 -5
- package/src/generation/markers/actions/placement/MarkerNodeEntityProcessorSequence.js +6 -9
- package/src/generation/markers/actions/probability/MarkerNodeActionSelectWeighted.js +8 -11
- package/src/generation/markers/actions/probability/MarkerNodeActionWeightedElement.js +13 -13
- package/src/generation/markers/actions/util/GridCellActionDebugBreak.js +5 -8
- package/src/generation/markers/actions/util/GridCellActionLogToConsole.js +1 -4
- package/src/generation/markers/emitter/MarkerNodeConsumerBuffer.js +10 -13
- package/src/generation/markers/emitter/MarkerNodeEmitterFromAction.js +5 -9
- package/src/generation/markers/emitter/MarkerNodeEmitterGridCellAction.js +12 -15
- package/src/generation/markers/emitter/MarkerNodeEmitterGroup.js +5 -8
- package/src/generation/markers/emitter/MarkerNodeEmitterPredicated.js +18 -21
- package/src/generation/markers/matcher/MarkerNodeMatcher.js +2 -1
- package/src/generation/markers/matcher/MarkerNodeMatcherBinary.js +12 -13
- package/src/generation/markers/matcher/MarkerNodeMatcherContainsTag.js +7 -9
- package/src/generation/markers/matcher/MarkerNodeMatcherNot.js +7 -9
- package/src/generation/markers/predicate/GridDataNodePredicateBinary.js +10 -14
- package/src/generation/markers/predicate/GridDataNodePredicateNot.js +9 -11
- package/src/generation/markers/predicate/GridDataNodePredicateOverlaps.js +6 -9
- package/src/generation/markers/transform/MarkerNodeTransformRotateRandom.js +2 -6
- package/src/generation/markers/transform/MarkerNodeTransformerAddPositionYFromFilter.js +6 -9
- package/src/generation/markers/transform/MarkerNodeTransformerOffsetPosition.js +1 -4
- package/src/generation/markers/transform/MarkerNodeTransformerRecordProperty.js +12 -15
- package/src/generation/markers/transform/MarkerNodeTransformerRecordPropertyClosure.js +14 -17
- package/src/generation/markers/transform/MarkerNodeTransformerRecordUniqueRandomEnum.js +21 -23
- package/src/generation/markers/transform/MarkerNodeTransformerRemoveTag.js +1 -4
- package/src/generation/markers/transform/MarkerNodeTransformerSequence.js +6 -9
- package/src/generation/markers/transform/MarkerNodeTransformerYRotateByFilter.js +13 -17
- package/src/generation/markers/transform/MarkerNodeTransformerYRotateByFilterGradient.js +12 -16
- package/src/generation/placement/GridCellActionTransformNearbyMarkers.js +26 -29
- package/src/generation/placement/GridCellPlacementRule.js +30 -32
- package/src/generation/placement/action/GridCellActionPlaceTags.js +26 -28
- package/src/generation/placement/action/GridCellActionWriteFilterToLayer.js +16 -20
- package/src/generation/placement/action/random/weighted/CellActionSelectWeightedRandom.js +13 -16
- package/src/generation/placement/action/random/weighted/WeightedGridCellAction.js +11 -14
- package/src/generation/placement/action/util/CellMatcherWithinAABB.js +2 -6
- package/src/generation/placement/action/util/GridCellActionSequence.js +7 -9
- package/src/generation/placement/action/util/GridCellDisplacedAction.js +9 -12
- package/src/generation/rules/CellMatcherFromFilter.js +6 -9
- package/src/generation/rules/CellMatcherLayerBitMaskTest.js +6 -9
- package/src/generation/rules/GridLayerCellMatcher.js +11 -14
- package/src/generation/rules/cell/CellMatcherContainsMarkerWithinRadius.js +11 -14
- package/src/generation/rules/cell/CellMatcherGridPattern.js +6 -8
- package/src/generation/rules/cell/GridPatternMatcherCell.js +11 -12
- package/src/generation/rules/logic/CellMatcherBinary.js +10 -14
- package/src/generation/rules/logic/CellMatcherDecorator.js +5 -8
- package/src/generation/theme/AreaMask.js +15 -17
- package/src/generation/theme/AreaTheme.js +7 -8
- package/src/generation/theme/TerrainLayerDescription.js +10 -12
- package/src/generation/theme/TerrainLayerRule.js +11 -13
- package/src/generation/theme/TerrainTheme.js +6 -7
- package/src/generation/theme/Theme.js +15 -17
- package/src/generation/theme/ThemeEngine.js +16 -18
- package/src/view/string_tag_to_css_class_name.js +2 -2
- package/src/view/tooltip/gml/TooltipParser.js +2 -2
- package/src/core/cache/PersistentCacheAdapter.js +0 -378
- package/src/core/primitives/strings/StringUtils.js +0 -105
- package/src/core/primitives/strings/StringUtils.spec.js +0 -42
- package/src/engine/ecs/components/MonsterAI.js +0 -15
- package/src/generation/markers/MarkerRelation.js +0 -13
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
import { GridData } from "./GridData.js";
|
|
2
|
+
import { MarkerNode } from "../markers/MarkerNode.js";
|
|
3
|
+
import { MarkerNodeMatcherAny } from "../markers/matcher/MarkerNodeMatcherAny.js";
|
|
2
4
|
|
|
3
5
|
test("constructor does not throw", () => {
|
|
4
6
|
expect(() => new GridData()).not.toThrow()
|
|
5
7
|
});
|
|
8
|
+
|
|
9
|
+
test("addMarker", () => {
|
|
10
|
+
|
|
11
|
+
const data = new GridData();
|
|
12
|
+
|
|
13
|
+
const node = new MarkerNode();
|
|
14
|
+
|
|
15
|
+
data.addMarker(node);
|
|
16
|
+
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test("countMarkerInCircle", () => {
|
|
20
|
+
|
|
21
|
+
const data = new GridData();
|
|
22
|
+
|
|
23
|
+
const a = new MarkerNode();
|
|
24
|
+
a.position.set(1, 0);
|
|
25
|
+
a.size = 1;
|
|
26
|
+
|
|
27
|
+
data.addMarker(a);
|
|
28
|
+
|
|
29
|
+
const b = new MarkerNode();
|
|
30
|
+
b.position.set(1.5, 0);
|
|
31
|
+
b.size = 1;
|
|
32
|
+
|
|
33
|
+
data.addMarker(b);
|
|
34
|
+
|
|
35
|
+
expect(data.countMarkerInCircle(-1.1, 0, 1, MarkerNodeMatcherAny.INSTANCE))
|
|
36
|
+
.toBe(0);
|
|
37
|
+
|
|
38
|
+
expect(data.countMarkerInCircle(0, -2, 1, MarkerNodeMatcherAny.INSTANCE))
|
|
39
|
+
.toBe(0);
|
|
40
|
+
|
|
41
|
+
expect(data.countMarkerInCircle(-0.6, 0, 1, MarkerNodeMatcherAny.INSTANCE))
|
|
42
|
+
.toBe(1);
|
|
43
|
+
|
|
44
|
+
expect(data.countMarkerInCircle(0, 0, 1, MarkerNodeMatcherAny.INSTANCE))
|
|
45
|
+
.toBe(2);
|
|
46
|
+
});
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { assert } from "../../core/assert.js";
|
|
2
2
|
|
|
3
3
|
export class GridTaskGenerator {
|
|
4
|
-
constructor() {
|
|
5
|
-
this.name = "Unnamed";
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
name = "Unnamed";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @type {GridTaskGenerator[]}
|
|
10
|
+
*/
|
|
11
|
+
dependencies = [];
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
*
|
|
@@ -7,31 +7,29 @@ import {
|
|
|
7
7
|
import { Sampler2D } from "../../../engine/graphics/texture/sampler/Sampler2D.js";
|
|
8
8
|
|
|
9
9
|
export class GridDataLayer {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
this.size = new Vector2(1, 1);
|
|
34
|
-
}
|
|
10
|
+
/**
|
|
11
|
+
* Unique ID to reference the layer
|
|
12
|
+
* @type {string}
|
|
13
|
+
*/
|
|
14
|
+
id = "";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Relationship between size and number of cells in the sampler, higher resolution means more cells in the sampler
|
|
18
|
+
* @type {number}
|
|
19
|
+
*/
|
|
20
|
+
resolution = 1;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @type {Sampler2D}
|
|
25
|
+
*/
|
|
26
|
+
sampler = new Sampler2D([], 1, 0, 0);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @type {Vector2}
|
|
31
|
+
*/
|
|
32
|
+
size = new Vector2(1, 1);
|
|
35
33
|
|
|
36
34
|
/**
|
|
37
35
|
*
|
|
@@ -19,32 +19,30 @@ const POLICY_ITERATORS = {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export class GridActionRuleSet {
|
|
22
|
-
constructor() {
|
|
23
|
-
/**
|
|
24
|
-
*
|
|
25
|
-
* @type {GridCellPlacementRule[]}
|
|
26
|
-
*/
|
|
27
|
-
this.elements = [];
|
|
28
22
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @type {GridCellPlacementRule[]}
|
|
26
|
+
*/
|
|
27
|
+
elements = [];
|
|
34
28
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* @type {RuleSelectionPolicyType|number}
|
|
32
|
+
*/
|
|
33
|
+
policy = RuleSelectionPolicyType.Sequential;
|
|
40
34
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Rules will be evaluated for each cell, this pattern will be applied within each cell
|
|
37
|
+
* @type {number[]}
|
|
38
|
+
*/
|
|
39
|
+
pattern = [0, 0];
|
|
46
40
|
|
|
47
|
-
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* @type {boolean}
|
|
44
|
+
*/
|
|
45
|
+
matchOrigin = true;
|
|
48
46
|
|
|
49
47
|
/**
|
|
50
48
|
*
|
|
@@ -6,49 +6,46 @@ import { assert } from "../../core/assert.js";
|
|
|
6
6
|
import Vector3 from "../../core/geom/Vector3.js";
|
|
7
7
|
|
|
8
8
|
export class GridCellActionPlaceMarker extends GridCellAction {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*/
|
|
50
|
-
this.offset = new Vector2();
|
|
51
|
-
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @type {String}
|
|
13
|
+
*/
|
|
14
|
+
type = null;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @type {Transform}
|
|
19
|
+
*/
|
|
20
|
+
transform = new Transform();
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @type {String[]}
|
|
25
|
+
*/
|
|
26
|
+
tags = [];
|
|
27
|
+
|
|
28
|
+
properties = {};
|
|
29
|
+
|
|
30
|
+
size = 0;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @type {MarkerNodeTransformer[]}
|
|
35
|
+
*/
|
|
36
|
+
transformers = [];
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
* @type {number}
|
|
41
|
+
*/
|
|
42
|
+
priority = 0;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @type {Vector2}
|
|
47
|
+
*/
|
|
48
|
+
offset = new Vector2();
|
|
52
49
|
|
|
53
50
|
initialize(data, seed) {
|
|
54
51
|
super.initialize(data, seed);
|
|
@@ -4,15 +4,13 @@ import { assert } from "../../core/assert.js";
|
|
|
4
4
|
let idCounter = 0;
|
|
5
5
|
|
|
6
6
|
export class GridCellActionPlaceMarkerGroup extends GridCellAction {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
this.children = [];
|
|
15
|
-
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @type {GridCellActionPlaceMarker[]}
|
|
11
|
+
*/
|
|
12
|
+
children = [];
|
|
13
|
+
|
|
16
14
|
|
|
17
15
|
/**
|
|
18
16
|
*
|
|
@@ -4,50 +4,50 @@ import { circleIntersectsCircle } from "../../core/geom/2d/circle/circleIntersec
|
|
|
4
4
|
import { array_copy_entire } from "../../core/collection/array/array_copy_entire.js";
|
|
5
5
|
|
|
6
6
|
export class MarkerNode {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Processing order, higher priority nodes are processed first
|
|
10
|
+
* @type {number}
|
|
11
|
+
*/
|
|
12
|
+
priority = 0;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @type {String}
|
|
17
|
+
*/
|
|
18
|
+
type = null;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @type {String[]}
|
|
23
|
+
*/
|
|
24
|
+
tags = [];
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Grid position
|
|
28
|
+
* @type {Vector2}
|
|
29
|
+
*/
|
|
30
|
+
position = new Vector2();
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* World transform, this can differ from the grid position
|
|
34
|
+
* @type {Transform}
|
|
35
|
+
*/
|
|
36
|
+
transform = new Transform();
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Treated as a radius
|
|
40
|
+
* Used for spatial resolution, to allow spacing markers
|
|
41
|
+
* @type {number}
|
|
42
|
+
*/
|
|
43
|
+
size = 0;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @type {Object}
|
|
48
|
+
*/
|
|
49
|
+
properties = {};
|
|
50
|
+
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
*
|
|
@@ -4,27 +4,24 @@ import { Transform } from "../../../engine/ecs/transform/Transform.js";
|
|
|
4
4
|
import { EntityBlueprint } from "../../../engine/ecs/EntityBlueprint.js";
|
|
5
5
|
|
|
6
6
|
export class MarkerNodeActionEntityPlacement extends MarkerNodeAction {
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @type {EntityBlueprint}
|
|
11
|
+
*/
|
|
12
|
+
entity = new EntityBlueprint();
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @type {Transform}
|
|
17
|
+
*/
|
|
18
|
+
transform = new Transform();
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @type {MarkerNodeEntityProcessor}
|
|
23
|
+
*/
|
|
24
|
+
processor = null;
|
|
28
25
|
|
|
29
26
|
/**
|
|
30
27
|
*
|
|
@@ -2,15 +2,12 @@ import { MarkerNodeAction } from "./MarkerNodeAction.js";
|
|
|
2
2
|
import { assert } from "../../../core/assert.js";
|
|
3
3
|
|
|
4
4
|
export class MarkerNodeActionSequence extends MarkerNodeAction {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
12
|
-
this.elements = [];
|
|
13
|
-
}
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @type {MarkerNodeAction[]}
|
|
9
|
+
*/
|
|
10
|
+
elements = [];
|
|
14
11
|
|
|
15
12
|
/**
|
|
16
13
|
*
|
|
@@ -3,13 +3,11 @@ import { TaskSignal } from "../../../core/process/task/TaskSignal.js";
|
|
|
3
3
|
import { assert } from "../../../core/assert.js";
|
|
4
4
|
|
|
5
5
|
export class MarkerNodeProcessingRuleSet {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this.elements = [];
|
|
12
|
-
}
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @type {MarkerProcessingRule[]}
|
|
9
|
+
*/
|
|
10
|
+
elements = [];
|
|
13
11
|
|
|
14
12
|
/**
|
|
15
13
|
*
|
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
import { assert } from "../../../core/assert.js";
|
|
2
2
|
|
|
3
3
|
export class MarkerProcessingRule {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @type {MarkerNodeMatcher}
|
|
7
|
+
*/
|
|
8
|
+
matcher = null;
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @type {MarkerNodeTransformer[]}
|
|
14
|
+
*/
|
|
15
|
+
transformers = [];
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @type {MarkerNodeAction}
|
|
20
|
+
*/
|
|
21
|
+
action = null;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* If this rule is applied, no other rules may be applied to the same node
|
|
25
|
+
* @type {boolean}
|
|
26
|
+
*/
|
|
27
|
+
consume = true;
|
|
29
28
|
|
|
30
29
|
/**
|
|
31
30
|
*
|
|
@@ -81,6 +80,6 @@ export class MarkerProcessingRule {
|
|
|
81
80
|
transformer.initialize(grid, seed);
|
|
82
81
|
}
|
|
83
82
|
|
|
84
|
-
this.action.initialize(grid,ecd, seed);
|
|
83
|
+
this.action.initialize(grid, ecd, seed);
|
|
85
84
|
}
|
|
86
85
|
}
|
|
@@ -6,21 +6,18 @@ import { obtainTerrain } from "../../../../engine/ecs/terrain/util/obtainTerrain
|
|
|
6
6
|
const p = new SurfacePoint3();
|
|
7
7
|
|
|
8
8
|
export class MarkerNodeEntityProcessorClingToTerrain extends MarkerNodeEntityProcessor {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*/
|
|
22
|
-
this.normalAlign = false;
|
|
23
|
-
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @private
|
|
12
|
+
* @type {Terrain}
|
|
13
|
+
*/
|
|
14
|
+
terrain = null;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @type {boolean}
|
|
19
|
+
*/
|
|
20
|
+
normalAlign = false;
|
|
24
21
|
|
|
25
22
|
/**
|
|
26
23
|
*
|
|
@@ -3,12 +3,9 @@ import { seededRandom } from "../../../../core/math/random/seededRandom.js";
|
|
|
3
3
|
import { Transform } from "../../../../engine/ecs/transform/Transform.js";
|
|
4
4
|
|
|
5
5
|
export class MarkerNodeEntityProcessorRandomRotation extends MarkerNodeEntityProcessor {
|
|
6
|
-
constructor() {
|
|
7
|
-
super();
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
7
|
+
__seed = 0;
|
|
8
|
+
__random = seededRandom(0);
|
|
12
9
|
|
|
13
10
|
static from() {
|
|
14
11
|
return new MarkerNodeEntityProcessorRandomRotation();
|
|
@@ -2,15 +2,12 @@ import { MarkerNodeEntityProcessor } from "./MarkerNodeEntityProcessor.js";
|
|
|
2
2
|
import { assert } from "../../../../core/assert.js";
|
|
3
3
|
|
|
4
4
|
export class MarkerNodeEntityProcessorSequence extends MarkerNodeEntityProcessor {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
12
|
-
this.elements = [];
|
|
13
|
-
}
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @type {MarkerNodeEntityProcessor[]}
|
|
9
|
+
*/
|
|
10
|
+
elements = [];
|
|
14
11
|
|
|
15
12
|
/**
|
|
16
13
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { seededRandom } from "../../../../core/math/random/seededRandom.js";
|
|
2
2
|
import { MarkerNodeAction } from "../MarkerNodeAction.js";
|
|
3
3
|
import { assert } from "../../../../core/assert.js";
|
|
4
|
-
import { compareNumbersAscending } from "../../../../core/function/Functions.js";
|
|
5
4
|
import { binarySearchHighIndex } from "../../../../core/collection/array/binarySearchHighIndex.js";
|
|
5
|
+
import { number_compare_ascending } from "../../../../core/primitives/numbers/number_compare_ascending.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
@@ -11,17 +11,14 @@ import { binarySearchHighIndex } from "../../../../core/collection/array/binaryS
|
|
|
11
11
|
const evaluatedWeights = [];
|
|
12
12
|
|
|
13
13
|
export class MarkerNodeActionSelectWeighted extends MarkerNodeAction {
|
|
14
|
-
constructor() {
|
|
15
|
-
super();
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @type {MarkerNodeActionWeightedElement[]}
|
|
18
|
+
*/
|
|
19
|
+
elements = [];
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
}
|
|
21
|
+
__random = seededRandom(0);
|
|
25
22
|
|
|
26
23
|
/**
|
|
27
24
|
*
|
|
@@ -97,7 +94,7 @@ export class MarkerNodeActionSelectWeighted extends MarkerNodeAction {
|
|
|
97
94
|
|
|
98
95
|
const targetWeight = this.__random() * totalWeight;
|
|
99
96
|
|
|
100
|
-
const index = binarySearchHighIndex(evaluatedWeights, targetWeight,
|
|
97
|
+
const index = binarySearchHighIndex(evaluatedWeights, targetWeight, number_compare_ascending, 0, n - 1);
|
|
101
98
|
|
|
102
99
|
const targetElement = elements[index];
|
|
103
100
|
|