@woosh/meep-engine 2.31.1 → 2.31.5
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 +5 -1
- package/core/collection/RingBuffer.js +16 -1
- package/core/geom/Vector1.js +228 -219
- package/core/geom/Vector2.js +547 -502
- package/core/geom/Vector3.js +8 -0
- package/core/geom/Vector4.js +322 -311
- package/core/graph/v2/Graph.js +6 -6
- package/core/model/ObservedBoolean.js +12 -4
- package/core/process/worker/WorkerBuilder.js +27 -9
- package/core/process/worker/WorkerProxy.js +6 -0
- package/editor/Editor.js +10 -1
- package/editor/process/symbolic/makePositionedIconDisplaySymbol.js +3 -1
- package/engine/EngineHarness.js +1 -1
- package/engine/ecs/parent/ParentEntitySystem.js +1 -1
- package/engine/ecs/terrain/ecs/Terrain.js +11 -2
- package/engine/ecs/terrain/ecs/makeTerrainWorkerProxy.js +10 -10
- package/engine/graphics/camera/makeOrbitalCameraController.js +7 -1
- package/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSystem.js +4 -31
- package/engine/graphics/ecs/mesh/Mesh.js +9 -3
- package/engine/graphics/ecs/path/entity/EntityPath.js +7 -7
- package/engine/graphics/ecs/trail2d/Trail2DSystem.js +31 -16
- package/engine/graphics/micron/build/buildMicronGeometryFromBufferGeometry.js +17 -8
- package/engine/graphics/micron/build/graph/metis/metis.js +23 -33
- package/engine/graphics/micron/render/v1/MaterialContext.js +21 -2
- package/engine/graphics/particles/particular/engine/renderers/billboard/prototypeBillboardRenderer.js +1 -1
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepFixedPhysics.js +1 -1
- package/engine/graphics/render/buffer/buffers/NormalFrameBuffer.js +25 -16
- package/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +6 -5
- package/engine/graphics/trail/x/RibbonMaterialX.js +7 -2
- package/engine/grid/components/GridPosition.js +22 -122
- package/engine/grid/components/GridPositionSerializationAdapter.js +58 -0
- package/engine/grid/components/GridPositionSerializationUpdater_0_1.js +37 -0
- package/engine/intelligence/mcts/MonteCarlo.js +12 -15
- package/engine/intelligence/mcts/StateNode.js +3 -3
- package/generation/GridTags.js +3 -2
- package/generation/example/SampleGenerator0.js +1 -1
- package/generation/example/generators/{mir_generator_place_buff_objects.js → interactive/mir_generator_place_buff_objects.js} +97 -26
- package/generation/example/generators/mir_generator_place_starting_point.js +12 -5
- package/generation/example/grid/configureMirGrid.js +1 -1
- package/generation/filtering/CellFilter.js +14 -0
- package/generation/filtering/numeric/util/CellFilterLogToConsole.js +2 -1
- package/generation/grid/GridData.js +18 -14
- package/generation/grid/MarkerMatchCounter.js +23 -0
- package/generation/grid/generation/GridTaskApplyActionToCells.js +86 -0
- package/generation/grid/generation/grid/select/CellSupplier.js +28 -0
- package/generation/grid/generation/grid/select/CellSupplierBestN.js +188 -0
- package/generation/grid/generation/grid/select/CellSupplierPathUpHill.js +187 -0
- package/generation/markers/GridActionRuleSet.js +1 -1
- package/generation/markers/MarkerNode.js +18 -0
- package/generation/markers/debug/visualizeMarkers.js +8 -1
- package/generation/markers/transform/MarkerNodeTransformerSequence.js +47 -0
- package/generation/placement/GridCellActionTransformNearbyMarkers.js +9 -17
- package/generation/rules/CellMatcherFromFilter.js +38 -0
- package/generation/rules/cell/CellMatcherContainsMarkerWithinRadius.js +1 -1
- package/package.json +3 -3
package/core/binary/BitSet.js
CHANGED
|
@@ -112,6 +112,10 @@ function BitSet() {
|
|
|
112
112
|
this.__firstClearBitIndex = 0;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
BitSet.prototype.preventShrink = function () {
|
|
116
|
+
this.__shrinkFactor = 0;
|
|
117
|
+
}
|
|
118
|
+
|
|
115
119
|
/**
|
|
116
120
|
*
|
|
117
121
|
* @param {number} numBits
|
|
@@ -145,7 +149,7 @@ BitSet.prototype.capacity = function () {
|
|
|
145
149
|
* @private
|
|
146
150
|
*/
|
|
147
151
|
BitSet.prototype.__resize = function (bitCapacity) {
|
|
148
|
-
assert.
|
|
152
|
+
assert.isNonNegativeInteger(bitCapacity, 'bitCapacity');
|
|
149
153
|
|
|
150
154
|
const byteCapacity = Math.ceil(bitCapacity / 8);
|
|
151
155
|
|
|
@@ -29,7 +29,22 @@ export class RingBuffer {
|
|
|
29
29
|
* @return {V}
|
|
30
30
|
*/
|
|
31
31
|
getHead() {
|
|
32
|
-
return this.data[this.head];
|
|
32
|
+
return this.data[this.head - 1];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @param {number} offset
|
|
38
|
+
* @returns {V}
|
|
39
|
+
*/
|
|
40
|
+
getFromHead(offset) {
|
|
41
|
+
let i = this.head - (offset + 1);
|
|
42
|
+
|
|
43
|
+
while (i < 0) {
|
|
44
|
+
i += this.size;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return this.data[i];
|
|
33
48
|
}
|
|
34
49
|
|
|
35
50
|
clear() {
|
package/core/geom/Vector1.js
CHANGED
|
@@ -9,267 +9,276 @@ import { clamp } from "../math/clamp.js";
|
|
|
9
9
|
import { computeHashFloat } from "../math/MathUtils.js";
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
class Vector1 extends Number {
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param {number} [x=0]
|
|
16
|
+
* @constructor
|
|
17
|
+
* @class
|
|
18
|
+
* @property {number} x
|
|
19
|
+
*/
|
|
20
|
+
constructor(x = 0) {
|
|
21
|
+
super();
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
assert.equal(typeof x, "number", `X must be of type "number", instead was "${typeof x}"`);
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
this.onChanged = new Signal();
|
|
26
|
-
}
|
|
25
|
+
assert.ok(!Number.isNaN(x), `X must be a valid number, instead was NaN`);
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
this.x = x;
|
|
29
28
|
|
|
30
|
-
|
|
29
|
+
this.onChanged = new Signal();
|
|
30
|
+
}
|
|
31
31
|
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Inherited from Number class
|
|
34
|
+
* @returns {number}
|
|
35
|
+
*/
|
|
36
|
+
valueOf() {
|
|
37
|
+
return this.x;
|
|
38
|
+
}
|
|
37
39
|
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* @returns {string}
|
|
43
|
+
*/
|
|
44
|
+
toString() {
|
|
45
|
+
return String(this.x);
|
|
46
|
+
}
|
|
45
47
|
|
|
46
|
-
/**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @returns {number}
|
|
51
|
+
*/
|
|
52
|
+
getValue() {
|
|
53
|
+
return this.x;
|
|
54
|
+
}
|
|
53
55
|
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
/**
|
|
57
|
+
*
|
|
58
|
+
* @param {Vector1} other
|
|
59
|
+
* @returns {number}
|
|
60
|
+
*/
|
|
61
|
+
compareTo(other) {
|
|
62
|
+
return this.x - other.x;
|
|
63
|
+
}
|
|
61
64
|
|
|
62
|
-
/**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
};
|
|
65
|
+
/**
|
|
66
|
+
*
|
|
67
|
+
* @param {number} x
|
|
68
|
+
* @returns {Vector1}
|
|
69
|
+
*/
|
|
70
|
+
set(x) {
|
|
71
|
+
assert.equal(typeof x, "number", `X must be of type "number", instead was "${typeof x}"`);
|
|
70
72
|
|
|
71
|
-
|
|
72
|
-
*
|
|
73
|
-
* @param {Vector1} a
|
|
74
|
-
* @param {Vector1} b
|
|
75
|
-
* @return {number}
|
|
76
|
-
*/
|
|
77
|
-
Vector1.compare = function (a, b) {
|
|
78
|
-
return a.x - b.x;
|
|
79
|
-
};
|
|
73
|
+
assert.ok(!Number.isNaN(x), `X must be a valid number, instead was NaN`);
|
|
80
74
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
75
|
+
const oldValue = this.x;
|
|
76
|
+
if (oldValue !== x) {
|
|
77
|
+
this.x = x;
|
|
78
|
+
|
|
79
|
+
if (this.onChanged.hasHandlers()) {
|
|
80
|
+
this.onChanged.send2(x, oldValue);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
88
83
|
|
|
89
|
-
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
90
86
|
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
/**
|
|
88
|
+
* Set value without triggering {@link #onChanged} signal
|
|
89
|
+
* @param {number} x
|
|
90
|
+
*/
|
|
91
|
+
setSilent(x) {
|
|
93
92
|
this.x = x;
|
|
93
|
+
}
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
/**
|
|
96
|
+
*
|
|
97
|
+
* @return {boolean}
|
|
98
|
+
*/
|
|
99
|
+
isZero() {
|
|
100
|
+
return this.x === 0;
|
|
98
101
|
}
|
|
99
102
|
|
|
100
|
-
|
|
101
|
-
|
|
103
|
+
increment() {
|
|
104
|
+
this._add(1);
|
|
105
|
+
}
|
|
102
106
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
*/
|
|
107
|
-
Vector1.prototype.setSilent = function (x) {
|
|
108
|
-
this.x = x;
|
|
109
|
-
};
|
|
107
|
+
decrement() {
|
|
108
|
+
this._add(-1);
|
|
109
|
+
}
|
|
110
110
|
|
|
111
|
-
/**
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
111
|
+
/**
|
|
112
|
+
*
|
|
113
|
+
* @param {Number} v
|
|
114
|
+
* @return {Vector1}
|
|
115
|
+
*/
|
|
116
|
+
_add(v) {
|
|
117
|
+
return this.set(this.x + v);
|
|
118
|
+
}
|
|
118
119
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
120
|
+
/**
|
|
121
|
+
*
|
|
122
|
+
* @param {Vector1|Vector2|Vector3|Vector4} other
|
|
123
|
+
*/
|
|
124
|
+
add(other) {
|
|
125
|
+
return this._add(other.x);
|
|
126
|
+
}
|
|
122
127
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
128
|
+
/**
|
|
129
|
+
*
|
|
130
|
+
* @param {Number} v
|
|
131
|
+
* @return {Vector1}
|
|
132
|
+
*/
|
|
133
|
+
_sub(v) {
|
|
134
|
+
return this._add(-v);
|
|
135
|
+
}
|
|
126
136
|
|
|
127
|
-
/**
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
137
|
+
/**
|
|
138
|
+
*
|
|
139
|
+
* @param {Vector1} other
|
|
140
|
+
* @returns {Vector1}
|
|
141
|
+
*/
|
|
142
|
+
sub(other) {
|
|
143
|
+
return this._sub(other.x);
|
|
144
|
+
}
|
|
135
145
|
|
|
136
|
-
/**
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
146
|
+
/**
|
|
147
|
+
*
|
|
148
|
+
* @param {Vector1} other
|
|
149
|
+
* @returns {Vector1}
|
|
150
|
+
*/
|
|
151
|
+
multiply(other) {
|
|
152
|
+
return this.set(this.x * other.x);
|
|
153
|
+
}
|
|
143
154
|
|
|
144
|
-
/**
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
};
|
|
155
|
+
/**
|
|
156
|
+
*
|
|
157
|
+
* @param {number} v
|
|
158
|
+
*/
|
|
159
|
+
multiplyScalar(v) {
|
|
160
|
+
this.set(this.x * v);
|
|
161
|
+
}
|
|
152
162
|
|
|
153
|
-
/**
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
163
|
+
/**
|
|
164
|
+
*
|
|
165
|
+
* @param {number} low
|
|
166
|
+
* @param {number} high
|
|
167
|
+
* @returns {Vector1}
|
|
168
|
+
*/
|
|
169
|
+
clamp(low, high) {
|
|
170
|
+
return this.set(clamp(this.x, low, high));
|
|
171
|
+
}
|
|
161
172
|
|
|
162
|
-
/**
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
};
|
|
173
|
+
/**
|
|
174
|
+
*
|
|
175
|
+
* @param {Vector1|Vector2|Vector3|Vector4} other
|
|
176
|
+
*/
|
|
177
|
+
copy(other) {
|
|
178
|
+
this.set(other.x);
|
|
179
|
+
}
|
|
170
180
|
|
|
171
|
-
/**
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
181
|
+
/**
|
|
182
|
+
*
|
|
183
|
+
* @returns {Vector1}
|
|
184
|
+
*/
|
|
185
|
+
clone() {
|
|
186
|
+
return new Vector1(this.x);
|
|
187
|
+
}
|
|
178
188
|
|
|
179
|
-
/**
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
};
|
|
189
|
+
/**
|
|
190
|
+
*
|
|
191
|
+
* @param {Vector1} other
|
|
192
|
+
* @returns {boolean}
|
|
193
|
+
*/
|
|
194
|
+
equals(other) {
|
|
195
|
+
return this.x === other.x;
|
|
196
|
+
}
|
|
188
197
|
|
|
189
|
-
/**
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
};
|
|
198
|
+
/**
|
|
199
|
+
* @returns {number}
|
|
200
|
+
*/
|
|
201
|
+
hash() {
|
|
202
|
+
return computeHashFloat(this.x);
|
|
203
|
+
}
|
|
196
204
|
|
|
197
|
-
/**
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
205
|
+
/**
|
|
206
|
+
*
|
|
207
|
+
* @param {function(newValue:number, oldValue:number)} handler
|
|
208
|
+
*/
|
|
209
|
+
process(handler) {
|
|
210
|
+
handler(this.x, this.x);
|
|
211
|
+
this.onChanged.add(handler);
|
|
212
|
+
}
|
|
204
213
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
* @returns {boolean}
|
|
209
|
-
*/
|
|
210
|
-
Vector1.prototype.equals = function (other) {
|
|
211
|
-
return this.x === other.x;
|
|
212
|
-
};
|
|
214
|
+
toJSON() {
|
|
215
|
+
return this.x;
|
|
216
|
+
}
|
|
213
217
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
Vector1.prototype.hash = function () {
|
|
218
|
-
return computeHashFloat(this.x);
|
|
219
|
-
};
|
|
218
|
+
fromJSON(val) {
|
|
219
|
+
this.set(val);
|
|
220
|
+
}
|
|
220
221
|
|
|
221
|
-
/**
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
222
|
+
/**
|
|
223
|
+
*
|
|
224
|
+
* @param {number[]} array
|
|
225
|
+
* @param {number} offset
|
|
226
|
+
*/
|
|
227
|
+
readFromArray(array, offset) {
|
|
228
|
+
this.set(array[offset]);
|
|
229
|
+
}
|
|
229
230
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}
|
|
231
|
+
/**
|
|
232
|
+
*
|
|
233
|
+
* @param {number[]} array
|
|
234
|
+
* @param {number} offset
|
|
235
|
+
*/
|
|
236
|
+
writeToArray(array, offset) {
|
|
237
|
+
array[offset] = this.x;
|
|
238
|
+
}
|
|
233
239
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
240
|
+
/**
|
|
241
|
+
*
|
|
242
|
+
* @param {BinaryBuffer} buffer
|
|
243
|
+
*/
|
|
244
|
+
toBinaryBuffer(buffer) {
|
|
245
|
+
buffer.writeFloat64(this.x);
|
|
246
|
+
}
|
|
237
247
|
|
|
238
|
-
/**
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
this.set(array[offset]);
|
|
245
|
-
};
|
|
248
|
+
/**
|
|
249
|
+
*
|
|
250
|
+
* @param {BinaryBuffer} buffer
|
|
251
|
+
*/
|
|
252
|
+
fromBinaryBuffer(buffer) {
|
|
253
|
+
const x = buffer.readFloat64();
|
|
246
254
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
* @param {number[]} array
|
|
250
|
-
* @param {number} offset
|
|
251
|
-
*/
|
|
252
|
-
Vector1.prototype.writeToArray = function (array, offset) {
|
|
253
|
-
array[offset] = this.x;
|
|
254
|
-
};
|
|
255
|
+
this.set(x);
|
|
256
|
+
}
|
|
255
257
|
|
|
256
|
-
/**
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
258
|
+
/**
|
|
259
|
+
*
|
|
260
|
+
* @param {Vector1} a
|
|
261
|
+
* @param {Vector1} b
|
|
262
|
+
* @return {number}
|
|
263
|
+
*/
|
|
264
|
+
static compare(a, b) {
|
|
265
|
+
return a.x - b.x;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
* [Symbol.iterator]() {
|
|
269
|
+
|
|
270
|
+
yield this.x;
|
|
271
|
+
|
|
272
|
+
}
|
|
273
|
+
}
|
|
263
274
|
|
|
264
275
|
/**
|
|
265
|
-
*
|
|
266
|
-
* @
|
|
276
|
+
* @readonly
|
|
277
|
+
* @type {boolean}
|
|
267
278
|
*/
|
|
268
|
-
Vector1.prototype.
|
|
269
|
-
const x = buffer.readFloat64();
|
|
279
|
+
Vector1.prototype.isVector1 = true;
|
|
270
280
|
|
|
271
|
-
|
|
272
|
-
};
|
|
281
|
+
Vector1.typeName = "Vector1";
|
|
273
282
|
|
|
274
283
|
/**
|
|
275
284
|
* @readonly
|