@woosh/meep-engine 2.52.0 → 2.54.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/editor/actions/concrete/WriteGridValueAction.js +1 -1
- package/editor/ecs/component/prototypeObjectEditor.js +1 -1
- package/editor/process/ObstacleGridDisplayProcess.js +2 -2
- package/editor/process/symbolic/makeGridPositionSymbolDisplay.js +1 -1
- package/editor/tools/GridPaintTool.js +2 -2
- package/package.json +4 -3
- package/samples/generation/SampleGenerator0.js +1 -1
- package/samples/generation/generators/interactive/mir_generator_place_buff_objects.js +1 -1
- package/samples/generation/generators/mir_generator_place_bases.js +1 -1
- package/samples/generation/generators/mir_generator_place_road_decorators.js +1 -1
- package/samples/generation/generators/mir_generator_place_starting_point.js +1 -1
- package/samples/generation/main.js +2 -2
- package/samples/generation/rules/matcher_play_area.js +1 -1
- package/samples/generation/rules/matcher_tag_occupied.js +1 -1
- package/samples/generation/rules/matcher_tag_traversable.js +1 -1
- package/samples/generation/themes/SampleTheme0.js +5 -5
- package/src/core/collection/table/RowFirstTableSpec.js +8 -4
- package/src/core/geom/3d/matrix/MATRIX_4_IDENTITY.spec.js +10 -0
- package/src/engine/Engine.spec.js +4 -0
- package/src/engine/EngineConfiguration.js +24 -25
- package/src/engine/ecs/EntityBlueprint.js +2 -4
- package/src/engine/ecs/EntityComponentDataset.js +1 -1
- package/src/engine/ecs/EntityComponentDataset.spec.js +77 -0
- package/src/engine/ecs/EntityObserver.spec.js +1 -1
- package/src/engine/ecs/dynamic_actions/actions/definition/{WhiteToBlackboardActionDescription.js → WriteToBlackboardActionDescription.js} +2 -2
- package/src/engine/ecs/dynamic_actions/actions/definition/deserializeActionFromJSON.js +2 -2
- package/src/engine/ecs/guid/GUIDSerializationAdapter.spec.js +21 -0
- package/src/engine/ecs/parent/EntityNode.js +1 -1
- package/src/engine/ecs/parent/EntityNode.spec.js +104 -0
- package/src/engine/ecs/speaker/Voice.js +4 -0
- package/src/engine/ecs/team/Team.js +0 -44
- package/src/engine/ecs/team/TeamSerializationAdapter.js +46 -0
- package/src/engine/ecs/terrain/overlay/TerrainOverlay.spec.js +6 -0
- package/src/engine/ecs/terrain/tiles/TerrainTile.js +79 -76
- package/src/engine/ecs/terrain/tiles/TerrainTile.spec.js +25 -0
- package/src/engine/ecs/transform/Transform.js +1 -1
- package/src/engine/ecs/transform/Transform.spec.js +24 -0
- package/src/engine/graphics/camera/testClippingPlaneComputation.js +2 -2
- package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +2 -2
- package/src/engine/graphics/ecs/water2/shader/testWaterShader.js +2 -2
- package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +2 -2
- package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +2 -2
- package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +2 -2
- package/src/engine/graphics/texture/TextureBackedMemoryRegion.js +4 -1
- package/src/engine/graphics/texture/sampler/filter/filter_lanczos3.js +7 -2
- package/src/engine/grid/{components → grid2transform}/GridPosition2Transform.js +0 -41
- package/src/engine/grid/grid2transform/GridPosition2TransformSerializationUpgrader_0_1.js +40 -0
- package/src/engine/grid/{systems → grid2transform}/GridPosition2TransformSystem.js +3 -3
- package/src/engine/grid/{components → position}/GridPosition.js +4 -0
- package/src/engine/grid/{systems → position}/GridPositionSystem.js +1 -1
- package/src/engine/grid/transform2grid/Transform2GridPositionSystem.js +1 -1
- package/src/engine/input/devices/PointerDevice.spec.js +5 -0
- package/src/engine/navigation/ecs/components/computeCatmullRomSpline.js +5 -1
- package/src/engine/navigation/ecs/path_following/PathFollower.js +40 -32
- package/src/engine/navigation/ecs/path_following/PathFollower.spec.js +27 -0
- package/src/engine/platform/EnginePlatform.js +0 -4
- package/src/generation/filtering/CellFilter.js +6 -9
- package/src/generation/filtering/boolean/CellFilterLiteralBoolean.js +1 -4
- package/src/generation/filtering/core/CellFilterBinaryOperation.js +12 -15
- package/src/generation/filtering/core/CellFilterOperationTertiary.js +15 -19
- package/src/generation/filtering/numeric/CellFilterLiteralFloat.js +6 -9
- package/src/generation/grid/actions/ContinuousGridCellActionSetTerrainObstacle.js +1 -1
- package/src/generation/grid/actions/ContinuousGridCellActionWriteObstacle.js +2 -2
- package/src/generation/grid/generation/road/GridTaskGenerateRoads.js +1 -1
- package/src/generation/markers/actions/MarkerNodeActionEntityPlacement.js +1 -1
- package/src/engine/InputEngine.js +0 -94
- package/src/engine/PointerLock.js +0 -60
- package/src/engine/ecs/terrain/ecs/layers/loadLegacyTerrainLayers.js +0 -99
- package/src/engine/ecs/terrain/ecs/splat/loadLegacyTerrainSplats.js +0 -73
- package/src/engine/graphics/texture/ExportCanvasAsPNG.js +0 -7
- package/src/engine/navigation/PathFinder.js +0 -172
- package/src/engine/navigation/PathWorker.js +0 -78
- package/src/engine/navigation/ecs/systems/PathFinderSystem.js +0 -63
- package/src/engine/navigation/ecs/systems/PathSystem.js +0 -19
- package/src/engine/navigation/funnel/Funnel.js +0 -196
- package/src/generation/ZoneNode.js +0 -9
- /package/{src/generation → samples/generation/grid}/GridTags.js +0 -0
- /package/src/engine/grid/{components → grid2transform}/GridPosition2TransformFlags.js +0 -0
- /package/src/engine/grid/{components → grid2transform}/GridPosition2TransformSerializationAdapter.js +0 -0
- /package/src/engine/grid/{components → obstacle}/GridObstacle.js +0 -0
- /package/src/engine/grid/{components → obstacle}/GridObstacle.spec.js +0 -0
- /package/src/engine/grid/{components → obstacle}/GridObstacleSerializationAdapter.js +0 -0
- /package/src/engine/grid/{components → position}/GridPositionSerializationAdapter.js +0 -0
- /package/src/engine/grid/{components → position}/GridPositionSerializationUpdater_0_1.js +0 -0
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Created by Alex on 13/04/2016.
|
|
3
3
|
*/
|
|
4
4
|
import ObservedInteger from "../../../core/model/ObservedInteger.js";
|
|
5
|
-
import { BinaryClassSerializationAdapter } from "../storage/binary/BinaryClassSerializationAdapter.js";
|
|
6
5
|
|
|
7
6
|
class Team extends ObservedInteger {
|
|
8
7
|
/**
|
|
@@ -37,46 +36,3 @@ Team.typeName = "Team";
|
|
|
37
36
|
|
|
38
37
|
export default Team;
|
|
39
38
|
|
|
40
|
-
export class TeamSerializationAdapter extends BinaryClassSerializationAdapter{
|
|
41
|
-
constructor(){
|
|
42
|
-
super();
|
|
43
|
-
|
|
44
|
-
this.klass = Team;
|
|
45
|
-
this.version = 0;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
50
|
-
* @param {BinaryBuffer} buffer
|
|
51
|
-
* @param {Team} value
|
|
52
|
-
*/
|
|
53
|
-
serialize(buffer, value) {
|
|
54
|
-
const v = value.getValue();
|
|
55
|
-
|
|
56
|
-
if (v === Infinity) {
|
|
57
|
-
buffer.writeInt32(2147483647);
|
|
58
|
-
} else if (v === -Infinity) {
|
|
59
|
-
buffer.writeInt32(-2147483648);
|
|
60
|
-
} else {
|
|
61
|
-
//TODO it's possible to write encoded Infinity values by accident
|
|
62
|
-
buffer.writeInt32(v);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
*
|
|
68
|
-
* @param {BinaryBuffer} buffer
|
|
69
|
-
* @param {Team} value
|
|
70
|
-
*/
|
|
71
|
-
deserialize(buffer, value) {
|
|
72
|
-
const v = buffer.readInt32();
|
|
73
|
-
|
|
74
|
-
if (v === 2147483647) {
|
|
75
|
-
value.set(Infinity);
|
|
76
|
-
} else if (v === -2147483648) {
|
|
77
|
-
value.set(-Infinity);
|
|
78
|
-
} else {
|
|
79
|
-
value.set(v);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { BinaryClassSerializationAdapter } from "../storage/binary/BinaryClassSerializationAdapter.js";
|
|
2
|
+
import Team from "./Team.js";
|
|
3
|
+
|
|
4
|
+
export class TeamSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
|
|
8
|
+
this.klass = Team;
|
|
9
|
+
this.version = 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param {BinaryBuffer} buffer
|
|
15
|
+
* @param {Team} value
|
|
16
|
+
*/
|
|
17
|
+
serialize(buffer, value) {
|
|
18
|
+
const v = value.getValue();
|
|
19
|
+
|
|
20
|
+
if (v === Infinity) {
|
|
21
|
+
buffer.writeInt32(2147483647);
|
|
22
|
+
} else if (v === -Infinity) {
|
|
23
|
+
buffer.writeInt32(-2147483648);
|
|
24
|
+
} else {
|
|
25
|
+
//TODO it's possible to write encoded Infinity values by accident
|
|
26
|
+
buffer.writeInt32(v);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @param {BinaryBuffer} buffer
|
|
33
|
+
* @param {Team} value
|
|
34
|
+
*/
|
|
35
|
+
deserialize(buffer, value) {
|
|
36
|
+
const v = buffer.readInt32();
|
|
37
|
+
|
|
38
|
+
if (v === 2147483647) {
|
|
39
|
+
value.set(Infinity);
|
|
40
|
+
} else if (v === -2147483648) {
|
|
41
|
+
value.set(-Infinity);
|
|
42
|
+
} else {
|
|
43
|
+
value.set(v);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -33,98 +33,101 @@ import { passThrough } from "../../../../core/function/Functions.js";
|
|
|
33
33
|
* terrain tile is a part of a 2d array
|
|
34
34
|
*/
|
|
35
35
|
class TerrainTile {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
this.resolution = new ObservedInteger(1);
|
|
36
|
+
gridPosition = new Vector2();
|
|
37
|
+
scale = new Vector2(1, 1);
|
|
38
|
+
size = new Vector2();
|
|
39
|
+
position = new Vector2();
|
|
40
|
+
resolution = new ObservedInteger(1);
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @type {Material}
|
|
45
|
+
*/
|
|
46
|
+
material = null;
|
|
47
|
+
mesh = ThreeFactory.createMesh();
|
|
49
48
|
|
|
50
|
-
this.mesh.name = "TerrainTile";
|
|
51
49
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
* @type {THREE.BufferGeometry}
|
|
53
|
+
*/
|
|
54
|
+
geometry = null;
|
|
57
55
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
/**
|
|
57
|
+
*
|
|
58
|
+
* @type {boolean}
|
|
59
|
+
*/
|
|
60
|
+
enableBVH = true;
|
|
63
61
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
/**
|
|
63
|
+
*
|
|
64
|
+
* @type {LeafNode}
|
|
65
|
+
*/
|
|
66
|
+
boundingBox = new LeafNode(this);
|
|
69
67
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
/**
|
|
69
|
+
*
|
|
70
|
+
* @type {BinaryNode}
|
|
71
|
+
*/
|
|
72
|
+
bvh = null;
|
|
75
73
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
74
|
+
/**
|
|
75
|
+
*
|
|
76
|
+
* @type {boolean}
|
|
77
|
+
*/
|
|
78
|
+
isBuilt = false;
|
|
79
|
+
/**
|
|
80
|
+
*
|
|
81
|
+
* @type {boolean}
|
|
82
|
+
*/
|
|
83
|
+
isBuildInProgress = false;
|
|
84
|
+
referenceCount = 0;
|
|
81
85
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
*
|
|
89
|
-
* @type {boolean}
|
|
90
|
-
*/
|
|
91
|
-
this.isBuildInProgress = false;
|
|
92
|
-
this.referenceCount = 0;
|
|
86
|
+
/**
|
|
87
|
+
*
|
|
88
|
+
* @type {Signal<TerrainTile>}
|
|
89
|
+
*/
|
|
90
|
+
onBuilt = new Signal();
|
|
91
|
+
onDestroyed = new Signal();
|
|
93
92
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Encodes whether stitching has been performed on per-neighbour basis
|
|
95
|
+
* @private
|
|
96
|
+
* @type {{bottomLeft: boolean, top: boolean, left: boolean, bottom: boolean, bottomRight: boolean, topLeft: boolean, topRight: boolean, right: boolean}}
|
|
97
|
+
*/
|
|
98
|
+
stitching = {
|
|
99
|
+
top: false,
|
|
100
|
+
bottom: false,
|
|
101
|
+
left: false,
|
|
102
|
+
right: false,
|
|
100
103
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
top: false,
|
|
108
|
-
bottom: false,
|
|
109
|
-
left: false,
|
|
110
|
-
right: false,
|
|
104
|
+
topLeft: false,
|
|
105
|
+
topRight: false,
|
|
106
|
+
|
|
107
|
+
bottomLeft: false,
|
|
108
|
+
bottomRight: false
|
|
109
|
+
};
|
|
111
110
|
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Initial estimate of height bounds for this tile
|
|
113
|
+
* Untransformed by transform matrix
|
|
114
|
+
* @type {NumericInterval}
|
|
115
|
+
* @private
|
|
116
|
+
*/
|
|
117
|
+
__initial_height_range = new NumericInterval(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY);
|
|
114
118
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
119
|
+
raycaster = new BVHGeometryRaycaster();
|
|
120
|
+
|
|
121
|
+
constructor() {
|
|
122
|
+
|
|
123
|
+
this.mesh.name = "TerrainTile";
|
|
118
124
|
|
|
119
125
|
/**
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* @type {NumericInterval}
|
|
123
|
-
* @private
|
|
126
|
+
* Terrain mesh is static, it never changes its transform. Updates are wasteful.
|
|
127
|
+
* @type {boolean}
|
|
124
128
|
*/
|
|
125
|
-
this.
|
|
129
|
+
this.mesh.matrixWorldNeedsUpdate = false;
|
|
126
130
|
|
|
127
|
-
this.raycaster = new BVHGeometryRaycaster();
|
|
128
131
|
//Binary BVH form doesn't have distinct leaf objects and stores face indices directly, this requires a special face index extractor that treats leaves as indices directly.
|
|
129
132
|
this.raycaster.extractFaceIndexFromLeaf = passThrough;
|
|
130
133
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import TerrainTile from "./TerrainTile.js";
|
|
2
|
+
import { MATRIX_4_IDENTITY } from "../../../../core/geom/3d/matrix/MATRIX_4_IDENTITY.js";
|
|
3
|
+
|
|
4
|
+
test("constructor does not throw", () => {
|
|
5
|
+
new TerrainTile();
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
test("get/set transform", () => {
|
|
9
|
+
|
|
10
|
+
const tile = new TerrainTile();
|
|
11
|
+
tile.setInitialHeightBounds(1, 7);
|
|
12
|
+
|
|
13
|
+
tile.transform = MATRIX_4_IDENTITY;
|
|
14
|
+
|
|
15
|
+
expect(Array.from(tile.transform)).toEqual(Array.from(MATRIX_4_IDENTITY));
|
|
16
|
+
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test("using 'dispose' method on newly created tile", () => {
|
|
20
|
+
|
|
21
|
+
const tile = new TerrainTile();
|
|
22
|
+
|
|
23
|
+
expect(() => tile.dispose()).not.toThrow();
|
|
24
|
+
|
|
25
|
+
});
|
|
@@ -149,3 +149,27 @@ test("writeFlag", () => {
|
|
|
149
149
|
|
|
150
150
|
expect(ut.flags).toBe(1);
|
|
151
151
|
});
|
|
152
|
+
|
|
153
|
+
test("toMatrix from identity transform", () => {
|
|
154
|
+
const t = new Transform();
|
|
155
|
+
|
|
156
|
+
t.makeIdentity();
|
|
157
|
+
|
|
158
|
+
const matrix = [];
|
|
159
|
+
|
|
160
|
+
t.toMatrix4(matrix);
|
|
161
|
+
|
|
162
|
+
expect(matrix).toEqual(Array.from(MATRIX_4_IDENTITY));
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
test("hash", () => {
|
|
166
|
+
|
|
167
|
+
const t = new Transform();
|
|
168
|
+
|
|
169
|
+
const hash = t.hash();
|
|
170
|
+
|
|
171
|
+
expect(typeof hash).toBe("number");
|
|
172
|
+
expect(Number.isInteger(hash)).toBe(true);
|
|
173
|
+
expect(t.hash()).toEqual(hash);
|
|
174
|
+
|
|
175
|
+
});
|
|
@@ -23,10 +23,10 @@ import WaterSystem from "../ecs/water/WaterSystem.js";
|
|
|
23
23
|
import Trail2DSystem from "../ecs/trail2d/Trail2DSystem.js";
|
|
24
24
|
import { Foliage2System } from "../../ecs/foliage/ecs/Foliage2System.js";
|
|
25
25
|
import ViewportPositionSystem from "../../ecs/gui/position/ViewportPositionSystem.js";
|
|
26
|
-
import { GridPosition2TransformSystem } from "../../grid/
|
|
26
|
+
import { GridPosition2TransformSystem } from "../../grid/grid2transform/GridPosition2TransformSystem.js";
|
|
27
27
|
import { Transform2GridPositionSystem } from "../../grid/transform2grid/Transform2GridPositionSystem.js";
|
|
28
28
|
import SynchronizePositionSystem from "../../ecs/systems/SynchronizePositionSystem.js";
|
|
29
|
-
import GridPositionSystem from "../../grid/
|
|
29
|
+
import GridPositionSystem from "../../grid/position/GridPositionSystem.js";
|
|
30
30
|
import InputControllerSystem from "../../input/ecs/systems/InputControllerSystem.js";
|
|
31
31
|
import { InputSystem } from "../../input/ecs/systems/InputSystem.js";
|
|
32
32
|
import MeshHighlightSystem from "../ecs/highlight/system/MeshHighlightSystem.js";
|
|
@@ -24,10 +24,10 @@ import WaterSystem from "../../water/WaterSystem.js";
|
|
|
24
24
|
import Trail2DSystem from "../../trail2d/Trail2DSystem.js";
|
|
25
25
|
import { Foliage2System } from "../../../../ecs/foliage/ecs/Foliage2System.js";
|
|
26
26
|
import ViewportPositionSystem from "../../../../ecs/gui/position/ViewportPositionSystem.js";
|
|
27
|
-
import { GridPosition2TransformSystem } from "../../../../grid/
|
|
27
|
+
import { GridPosition2TransformSystem } from "../../../../grid/grid2transform/GridPosition2TransformSystem.js";
|
|
28
28
|
import { Transform2GridPositionSystem } from "../../../../grid/transform2grid/Transform2GridPositionSystem.js";
|
|
29
29
|
import SynchronizePositionSystem from "../../../../ecs/systems/SynchronizePositionSystem.js";
|
|
30
|
-
import GridPositionSystem from "../../../../grid/
|
|
30
|
+
import GridPositionSystem from "../../../../grid/position/GridPositionSystem.js";
|
|
31
31
|
import InputControllerSystem from "../../../../input/ecs/systems/InputControllerSystem.js";
|
|
32
32
|
import { InputSystem } from "../../../../input/ecs/systems/InputSystem.js";
|
|
33
33
|
import MeshHighlightSystem from "../../highlight/system/MeshHighlightSystem.js";
|
|
@@ -11,10 +11,10 @@ import { MeshSystem } from "../../mesh/MeshSystem.js";
|
|
|
11
11
|
import TerrainSystem from "../../../../ecs/terrain/ecs/TerrainSystem.js";
|
|
12
12
|
import WaterSystem from "../../water/WaterSystem.js";
|
|
13
13
|
import ViewportPositionSystem from "../../../../ecs/gui/position/ViewportPositionSystem.js";
|
|
14
|
-
import { GridPosition2TransformSystem } from "../../../../grid/
|
|
14
|
+
import { GridPosition2TransformSystem } from "../../../../grid/grid2transform/GridPosition2TransformSystem.js";
|
|
15
15
|
import { Transform2GridPositionSystem } from "../../../../grid/transform2grid/Transform2GridPositionSystem.js";
|
|
16
16
|
import SynchronizePositionSystem from "../../../../ecs/systems/SynchronizePositionSystem.js";
|
|
17
|
-
import GridPositionSystem from "../../../../grid/
|
|
17
|
+
import GridPositionSystem from "../../../../grid/position/GridPositionSystem.js";
|
|
18
18
|
import InputControllerSystem from "../../../../input/ecs/systems/InputControllerSystem.js";
|
|
19
19
|
import { InputSystem } from "../../../../input/ecs/systems/InputSystem.js";
|
|
20
20
|
import MeshHighlightSystem from "../../highlight/system/MeshHighlightSystem.js";
|
|
@@ -24,10 +24,10 @@ import WaterSystem from "../../../ecs/water/WaterSystem.js";
|
|
|
24
24
|
import Trail2DSystem from "../../../ecs/trail2d/Trail2DSystem.js";
|
|
25
25
|
import { Foliage2System } from "../../../../ecs/foliage/ecs/Foliage2System.js";
|
|
26
26
|
import ViewportPositionSystem from "../../../../ecs/gui/position/ViewportPositionSystem.js";
|
|
27
|
-
import { GridPosition2TransformSystem } from "../../../../grid/
|
|
27
|
+
import { GridPosition2TransformSystem } from "../../../../grid/grid2transform/GridPosition2TransformSystem.js";
|
|
28
28
|
import { Transform2GridPositionSystem } from "../../../../grid/transform2grid/Transform2GridPositionSystem.js";
|
|
29
29
|
import SynchronizePositionSystem from "../../../../ecs/systems/SynchronizePositionSystem.js";
|
|
30
|
-
import GridPositionSystem from "../../../../grid/
|
|
30
|
+
import GridPositionSystem from "../../../../grid/position/GridPositionSystem.js";
|
|
31
31
|
import InputControllerSystem from "../../../../input/ecs/systems/InputControllerSystem.js";
|
|
32
32
|
import { InputSystem } from "../../../../input/ecs/systems/InputSystem.js";
|
|
33
33
|
import MeshHighlightSystem from "../../../ecs/highlight/system/MeshHighlightSystem.js";
|
|
@@ -25,10 +25,10 @@ import WaterSystem from "../../../ecs/water/WaterSystem.js";
|
|
|
25
25
|
import Trail2DSystem from "../../../ecs/trail2d/Trail2DSystem.js";
|
|
26
26
|
import { Foliage2System } from "../../../../ecs/foliage/ecs/Foliage2System.js";
|
|
27
27
|
import ViewportPositionSystem from "../../../../ecs/gui/position/ViewportPositionSystem.js";
|
|
28
|
-
import { GridPosition2TransformSystem } from "../../../../grid/
|
|
28
|
+
import { GridPosition2TransformSystem } from "../../../../grid/grid2transform/GridPosition2TransformSystem.js";
|
|
29
29
|
import { Transform2GridPositionSystem } from "../../../../grid/transform2grid/Transform2GridPositionSystem.js";
|
|
30
30
|
import SynchronizePositionSystem from "../../../../ecs/systems/SynchronizePositionSystem.js";
|
|
31
|
-
import GridPositionSystem from "../../../../grid/
|
|
31
|
+
import GridPositionSystem from "../../../../grid/position/GridPositionSystem.js";
|
|
32
32
|
import InputControllerSystem from "../../../../input/ecs/systems/InputControllerSystem.js";
|
|
33
33
|
import { InputSystem } from "../../../../input/ecs/systems/InputSystem.js";
|
|
34
34
|
import MeshHighlightSystem from "../../../ecs/highlight/system/MeshHighlightSystem.js";
|
|
@@ -24,10 +24,10 @@ import WaterSystem from "../../../ecs/water/WaterSystem.js";
|
|
|
24
24
|
import Trail2DSystem from "../../../ecs/trail2d/Trail2DSystem.js";
|
|
25
25
|
import { Foliage2System } from "../../../../ecs/foliage/ecs/Foliage2System.js";
|
|
26
26
|
import ViewportPositionSystem from "../../../../ecs/gui/position/ViewportPositionSystem.js";
|
|
27
|
-
import { GridPosition2TransformSystem } from "../../../../grid/
|
|
27
|
+
import { GridPosition2TransformSystem } from "../../../../grid/grid2transform/GridPosition2TransformSystem.js";
|
|
28
28
|
import { Transform2GridPositionSystem } from "../../../../grid/transform2grid/Transform2GridPositionSystem.js";
|
|
29
29
|
import SynchronizePositionSystem from "../../../../ecs/systems/SynchronizePositionSystem.js";
|
|
30
|
-
import GridPositionSystem from "../../../../grid/
|
|
30
|
+
import GridPositionSystem from "../../../../grid/position/GridPositionSystem.js";
|
|
31
31
|
import InputControllerSystem from "../../../../input/ecs/systems/InputControllerSystem.js";
|
|
32
32
|
import { InputSystem } from "../../../../input/ecs/systems/InputSystem.js";
|
|
33
33
|
import MeshHighlightSystem from "../../../ecs/highlight/system/MeshHighlightSystem.js";
|
|
@@ -21,7 +21,10 @@ const DATA_TEXTURE_WIDTH = 128;
|
|
|
21
21
|
const SHRINK_FACTOR = 0.5;
|
|
22
22
|
const GROW_FACTOR = 1.05;
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Mainly used for storing non-color data in GPU memory
|
|
26
|
+
* Useful for things like simulation and running general purpose GPU compute inside fragment shaders
|
|
27
|
+
*/
|
|
25
28
|
export class TextureBackedMemoryRegion {
|
|
26
29
|
|
|
27
30
|
constructor() {
|
|
@@ -5,15 +5,20 @@ export function filter_lanczos3(x) {
|
|
|
5
5
|
// x = -x;
|
|
6
6
|
// }
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const lobes = 3;
|
|
9
|
+
|
|
10
|
+
if (x > lobes) {
|
|
9
11
|
return 0;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
if (x < 1.1920929e-7) {
|
|
15
|
+
// distance is very close to 0
|
|
13
16
|
return 1;
|
|
14
17
|
}
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
const px = Math.PI * x;
|
|
20
|
+
|
|
21
|
+
return (lobes * Math.sin(px) * Math.sin(px / lobes)) / (px * px);
|
|
17
22
|
|
|
18
23
|
}
|
|
19
24
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import Vector2 from "../../../core/geom/Vector2.js";
|
|
2
|
-
import { BinaryClassUpgrader } from "../../ecs/storage/binary/BinaryClassUpgrader.js";
|
|
3
2
|
import { GridPosition2TransformFlags } from "./GridPosition2TransformFlags.js";
|
|
4
3
|
|
|
5
4
|
/**
|
|
@@ -121,43 +120,3 @@ export class GridPosition2Transform {
|
|
|
121
120
|
}
|
|
122
121
|
|
|
123
122
|
GridPosition2Transform.typeName = "GridPosition2Transform";
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
export class GridPosition2TransformSerializationUpgrader_0_1 extends BinaryClassUpgrader {
|
|
127
|
-
constructor() {
|
|
128
|
-
super();
|
|
129
|
-
|
|
130
|
-
//
|
|
131
|
-
this.__startVersion = 0;
|
|
132
|
-
this.__targetVersion = 1;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
upgrade(source, target) {
|
|
136
|
-
const offsetX = source.readFloat64();
|
|
137
|
-
const offsetY = source.readFloat64();
|
|
138
|
-
|
|
139
|
-
let header = 3;
|
|
140
|
-
if (offsetX === 0 && offsetY === 0) {
|
|
141
|
-
header = 0;
|
|
142
|
-
} else if (offsetX === 0) {
|
|
143
|
-
header = 2;
|
|
144
|
-
} else if (offsetY === 0) {
|
|
145
|
-
header = 1;
|
|
146
|
-
} else {
|
|
147
|
-
//both coordinates are present
|
|
148
|
-
header = 3;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
target.writeUint8(header);
|
|
152
|
-
|
|
153
|
-
if ((header & 1) !== 0) {
|
|
154
|
-
//write X
|
|
155
|
-
target.writeFloat32(offsetX);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
if ((header & 2) !== 0) {
|
|
159
|
-
//write Y
|
|
160
|
-
target.writeFloat32(offsetY);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { BinaryClassUpgrader } from "../../ecs/storage/binary/BinaryClassUpgrader.js";
|
|
2
|
+
|
|
3
|
+
export class GridPosition2TransformSerializationUpgrader_0_1 extends BinaryClassUpgrader {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
|
|
7
|
+
//
|
|
8
|
+
this.__startVersion = 0;
|
|
9
|
+
this.__targetVersion = 1;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
upgrade(source, target) {
|
|
13
|
+
const offsetX = source.readFloat64();
|
|
14
|
+
const offsetY = source.readFloat64();
|
|
15
|
+
|
|
16
|
+
let header = 3;
|
|
17
|
+
if (offsetX === 0 && offsetY === 0) {
|
|
18
|
+
header = 0;
|
|
19
|
+
} else if (offsetX === 0) {
|
|
20
|
+
header = 2;
|
|
21
|
+
} else if (offsetY === 0) {
|
|
22
|
+
header = 1;
|
|
23
|
+
} else {
|
|
24
|
+
//both coordinates are present
|
|
25
|
+
header = 3;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
target.writeUint8(header);
|
|
29
|
+
|
|
30
|
+
if ((header & 1) !== 0) {
|
|
31
|
+
//write X
|
|
32
|
+
target.writeFloat32(offsetX);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if ((header & 2) !== 0) {
|
|
36
|
+
//write Y
|
|
37
|
+
target.writeFloat32(offsetY);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { System } from '../../ecs/System.js';
|
|
5
5
|
import { Transform } from '../../ecs/transform/Transform.js';
|
|
6
|
-
import GridPosition from '../
|
|
7
|
-
import { GridPosition2Transform } from '
|
|
6
|
+
import GridPosition from '../position/GridPosition.js';
|
|
7
|
+
import { GridPosition2Transform } from './GridPosition2Transform.js';
|
|
8
8
|
import Vector3 from "../../../core/geom/Vector3.js";
|
|
9
|
-
import { GridPosition2TransformFlags } from "
|
|
9
|
+
import { GridPosition2TransformFlags } from "./GridPosition2TransformFlags.js";
|
|
10
10
|
import { obtainTerrain } from "../../ecs/terrain/util/obtainTerrain.js";
|
|
11
11
|
import { ResourceAccessSpecification } from "../../../core/model/ResourceAccessSpecification.js";
|
|
12
12
|
import { ResourceAccessKind } from "../../../core/model/ResourceAccessKind.js";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Created by Alex on 13/10/2014.
|
|
3
3
|
*/
|
|
4
4
|
import { System } from '../../ecs/System.js';
|
|
5
|
-
import GridPosition from '
|
|
5
|
+
import GridPosition from './GridPosition.js';
|
|
6
6
|
import { QuadTreeNode } from "../../../core/geom/2d/quad-tree/QuadTreeNode.js";
|
|
7
7
|
|
|
8
8
|
class GridPositionSystem extends System {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { System } from "../../ecs/System.js";
|
|
2
2
|
import { Transform2GridPosition } from "./Transform2GridPosition.js";
|
|
3
|
-
import GridPosition from "../
|
|
3
|
+
import GridPosition from "../position/GridPosition.js";
|
|
4
4
|
import { Transform } from "../../ecs/transform/Transform.js";
|
|
5
5
|
import Vector2 from "../../../core/geom/Vector2.js";
|
|
6
6
|
import { Transform2GridPositionMode } from "./Transform2GridPositionMode.js";
|
|
@@ -38,7 +38,11 @@ const p3 = [];
|
|
|
38
38
|
* @param {number} sample_count number of discrete points to be generated
|
|
39
39
|
* @param {number} [alpha=0.5] parameter for control point weights (see non-parametric catmull-rom for details on "alpha" definition)
|
|
40
40
|
*/
|
|
41
|
-
export function computeCatmullRomSpline(
|
|
41
|
+
export function computeCatmullRomSpline(
|
|
42
|
+
result,
|
|
43
|
+
input, input_length,
|
|
44
|
+
dimensions, sample_count, alpha = 0.5
|
|
45
|
+
) {
|
|
42
46
|
assert.greaterThan(dimensions, 0, 'number of dimensions must be greater than 0');
|
|
43
47
|
assert.isNonNegativeInteger(dimensions, 'dimensions');
|
|
44
48
|
|