@woosh/meep-engine 2.47.34 → 2.47.36
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/build/bundle-worker-terrain.js +1 -1
- package/build/meep.cjs +43 -21
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +43 -21
- package/editor/tools/FoliagePaintTool.js +3 -3
- package/editor/tools/GridPaintTool.js +2 -2
- package/package.json +1 -1
- package/src/core/binary/dec2hex.js +9 -0
- package/src/core/binary/hex2dec.js +8 -0
- package/src/core/color/Color.js +8 -0
- package/src/core/color/ColorUtils.js +2 -2
- package/src/core/color/{parseHex.js → hex2rgb.js} +3 -5
- package/src/core/color/rgb2hex.js +1 -4
- package/src/core/geom/3d/aabb/aabb3_intersects_aabb3.js +1 -1
- package/src/core/geom/3d/aabb/aabb3_transformed_compute_plane_side.js +65 -0
- package/src/core/geom/3d/topology/struct/TopoMesh.js +9 -3
- package/src/core/geom/AABB2.js +1 -1
- package/src/core/geom/Rectangle.js +2 -2
- package/src/core/math/computeGreatestCommonDivisor.js +30 -3
- package/src/core/math/{intersects1D.js → interval/intersects1D.js} +1 -1
- package/src/core/math/{overlap1D.js → interval/overlap1D.js} +1 -1
- package/src/core/math/mix.js +5 -7
- package/src/core/math/random/randomUint8.js +10 -0
- package/src/core/math/spline/spline_bezier3.js +26 -0
- package/src/core/math/spline/spline_bezier3_bounds.js +87 -0
- package/src/core/model/node-graph/node/NodeInstance.js +1 -0
- package/src/core/process/task/Task.js +8 -6
- package/src/engine/achievements/AchievementManager.js +1 -1
- package/src/engine/animation/TransitionFunctions.js +1 -1
- package/src/engine/animation/curve/AnimationCurve.js +93 -1
- package/src/engine/animation/curve/Keyframe.js +20 -0
- package/src/engine/animation/curve/compression/prototypeCurveCompression.js +3 -1
- package/src/engine/ecs/components/MeshCollider.js +5 -0
- package/src/engine/ecs/components/MonsterAI.js +5 -0
- package/src/engine/ecs/fow/shader/FogOfWarRenderer.js +1 -1
- package/src/engine/ecs/guid/GUID.js +257 -0
- package/src/engine/ecs/guid/GUID.spec.js +41 -0
- package/src/engine/ecs/guid/GUIDSerializationAdapter.js +25 -0
- package/src/engine/ecs/storage/binary/BinaryClassSerializationAdapter.js +11 -12
- package/src/engine/ecs/terrain/util/loadVisibleTerrainTiles.js +23 -9
- package/src/engine/graphics/camera/CameraShake.js +1 -1
- package/src/engine/graphics/ecs/camera/CameraClippingPlaneComputer.js +1 -1
- package/src/engine/graphics/ecs/decal/v2/Decal.js +8 -6
- package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.d.ts +3 -0
- package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.js +76 -0
- package/src/engine/intelligence/behavior/behavior_to_dot.js +11 -1
- package/src/engine/intelligence/behavior/decorator/AbstractDecoratorBehavior.js +6 -0
- package/src/engine/intelligence/behavior/util/behavior_traverse_tree.js +35 -0
- package/src/engine/scene/transitionToScene.js +4 -1
- package/src/view/elements/radial/RadialText.js +1 -1
- package/src/core/math/bezierCurve.js +0 -22
- /package/src/core/math/{isValueBetween.js → interval/isValueBetween.js} +0 -0
- /package/src/core/math/{isValueBetween.spec.js → interval/isValueBetween.spec.js} +0 -0
- /package/src/core/math/{isValueBetweenInclusive.js → interval/isValueBetweenInclusive.js} +0 -0
- /package/src/core/math/{isValueBetweenInclusive.spec.js → interval/isValueBetweenInclusive.spec.js} +0 -0
- /package/src/core/math/{overlap1D.spec.js → interval/overlap1D.spec.js} +0 -0
- /package/src/core/math/{cubicCurve.js → spline/cubicCurve.js} +0 -0
- /package/src/core/math/{cubicCurve.spec.js → spline/cubicCurve.spec.js} +0 -0
- /package/src/core/math/{makeCubicCurve.js → spline/makeCubicCurve.js} +0 -0
- /package/src/core/math/{makeCubicCurve.spec.js → spline/makeCubicCurve.spec.js} +0 -0
- /package/src/core/math/{quadraticCurve.js → spline/quadraticCurve.js} +0 -0
- /package/src/core/math/{quadraticCurve.spec.js → spline/quadraticCurve.spec.js} +0 -0
|
@@ -23,6 +23,12 @@ import { SurfacePoint3 } from "../../../../../core/geom/3d/SurfacePoint3.js";
|
|
|
23
23
|
import { EBBVHLeafProxy } from "../../../../../core/bvh2/bvh3/EBBVHLeafProxy.js";
|
|
24
24
|
import { aabb3_matrix4_project } from "../../../../../core/geom/3d/aabb/aabb3_matrix4_project.js";
|
|
25
25
|
import { aabb3_raycast } from "../../../../../core/geom/3d/aabb/aabb3_raycast.js";
|
|
26
|
+
import {
|
|
27
|
+
bvh_query_user_data_overlaps_frustum
|
|
28
|
+
} from "../../../../../core/bvh2/bvh3/query/bvh_query_user_data_overlaps_frustum.js";
|
|
29
|
+
import {
|
|
30
|
+
aabb3_transformed_compute_plane_side
|
|
31
|
+
} from "../../../../../core/geom/3d/aabb/aabb3_transformed_compute_plane_side.js";
|
|
26
32
|
|
|
27
33
|
const placeholder_texture = Sampler2D.uint8(4, 1, 1);
|
|
28
34
|
placeholder_texture.data.fill(255);
|
|
@@ -289,6 +295,72 @@ export class FPDecalSystem extends AbstractContextSystem {
|
|
|
289
295
|
super.shutdown(em, ready_callback, error_callback);
|
|
290
296
|
}
|
|
291
297
|
|
|
298
|
+
/**
|
|
299
|
+
*
|
|
300
|
+
* @param {number[]} result entity IDs
|
|
301
|
+
* @param {number} result_offset
|
|
302
|
+
* @param {number[]} planes
|
|
303
|
+
* @returns {number} number of results
|
|
304
|
+
*/
|
|
305
|
+
queryOverlapFrustum(result, result_offset, planes) {
|
|
306
|
+
const ecd = this.entityManager.dataset;
|
|
307
|
+
|
|
308
|
+
if (ecd === null) {
|
|
309
|
+
return 0;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
const entities = [];
|
|
313
|
+
const rough_count = bvh_query_user_data_overlaps_frustum(
|
|
314
|
+
entities, 0,
|
|
315
|
+
this.bvh,
|
|
316
|
+
planes
|
|
317
|
+
);
|
|
318
|
+
|
|
319
|
+
let result_cursor = result_offset;
|
|
320
|
+
|
|
321
|
+
loop_0: for (let i = 0; i < rough_count; i++) {
|
|
322
|
+
|
|
323
|
+
const entity = entities[i];
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
*
|
|
327
|
+
* @type {Transform}
|
|
328
|
+
*/
|
|
329
|
+
const transform = ecd.getComponent(entity, Transform);
|
|
330
|
+
|
|
331
|
+
if (transform === undefined) {
|
|
332
|
+
// this shouldn't happen either
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
for (let j = 0; j < 6; j++) {
|
|
337
|
+
// test true box against each plane
|
|
338
|
+
const plane_address = j * 4;
|
|
339
|
+
|
|
340
|
+
const plane_x = planes[plane_address]
|
|
341
|
+
const plane_y = planes[plane_address + 1]
|
|
342
|
+
const plane_z = planes[plane_address + 2]
|
|
343
|
+
const plane_offset = planes[plane_address + 3]
|
|
344
|
+
|
|
345
|
+
const side = aabb3_transformed_compute_plane_side(
|
|
346
|
+
-0.5, -0.5, -0.5,
|
|
347
|
+
0.5, 0.5, 0.5,
|
|
348
|
+
plane_x, plane_y, plane_z, plane_offset,
|
|
349
|
+
transform.matrix
|
|
350
|
+
);
|
|
351
|
+
|
|
352
|
+
if (side < 0) {
|
|
353
|
+
// completely outside
|
|
354
|
+
continue loop_0;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
result[result_cursor++] = entity;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
return result_cursor - result_offset;
|
|
362
|
+
}
|
|
363
|
+
|
|
292
364
|
/**
|
|
293
365
|
*
|
|
294
366
|
* @param {number} origin_x
|
|
@@ -345,6 +417,10 @@ export class FPDecalSystem extends AbstractContextSystem {
|
|
|
345
417
|
continue;
|
|
346
418
|
}
|
|
347
419
|
|
|
420
|
+
/**
|
|
421
|
+
*
|
|
422
|
+
* @type {Transform}
|
|
423
|
+
*/
|
|
348
424
|
const transform = ecd.getComponent(entity, Transform);
|
|
349
425
|
|
|
350
426
|
if (transform === undefined) {
|
|
@@ -176,7 +176,7 @@ function build_node_label(behavior) {
|
|
|
176
176
|
/**
|
|
177
177
|
*
|
|
178
178
|
* @param {LineBuilder} out
|
|
179
|
-
* @param {Behavior|CompositeBehavior} behavior
|
|
179
|
+
* @param {Behavior|CompositeBehavior|AbstractDecoratorBehavior} behavior
|
|
180
180
|
* @param {{id_counter:number, node_ids:Map<Behavior,string>}} context
|
|
181
181
|
* @returns {string}
|
|
182
182
|
*/
|
|
@@ -213,6 +213,16 @@ function parse_behavior(out, behavior, context) {
|
|
|
213
213
|
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
+
if(behavior.isDecoratorBehavior === true){
|
|
217
|
+
// is a decorator
|
|
218
|
+
|
|
219
|
+
const source = behavior.getSource();
|
|
220
|
+
|
|
221
|
+
const id = parse_behavior(out, source,context);
|
|
222
|
+
|
|
223
|
+
out.add(`${node_id} -> ${id} [label="source"];`)
|
|
224
|
+
}
|
|
225
|
+
|
|
216
226
|
return node_id;
|
|
217
227
|
}
|
|
218
228
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {Behavior} root
|
|
4
|
+
* @param {function(Behavior):boolean?} visitor
|
|
5
|
+
* @param {*} [thisArg]
|
|
6
|
+
*/
|
|
7
|
+
export function behavior_traverse_tree(root, visitor, thisArg) {
|
|
8
|
+
|
|
9
|
+
const should_continue = visitor.call(thisArg, root);
|
|
10
|
+
|
|
11
|
+
if (should_continue === false) {
|
|
12
|
+
// terminate traversal
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (root.isCompositeBehavior === true) {
|
|
17
|
+
|
|
18
|
+
const children = root.getChildren();
|
|
19
|
+
|
|
20
|
+
const child_count = children.length;
|
|
21
|
+
|
|
22
|
+
for (let i = 0; i < child_count; i++) {
|
|
23
|
+
const child = children[i];
|
|
24
|
+
|
|
25
|
+
behavior_traverse_tree(child, visitor, thisArg);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (root.isCompositeBehavior === true) {
|
|
30
|
+
|
|
31
|
+
const source = root.getSource();
|
|
32
|
+
behavior_traverse_tree(source, visitor, thisArg);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|
|
@@ -31,7 +31,10 @@ export function transitionToScene({ tasks = [], scene, engine, name }) {
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
//wait for visible terrain tiles to be loaded
|
|
34
|
-
const tWaitForVisibleTerrainTiles = wrapTaskIgnoreFailure(loadVisibleTerrainTiles(
|
|
34
|
+
const tWaitForVisibleTerrainTiles = wrapTaskIgnoreFailure(loadVisibleTerrainTiles({
|
|
35
|
+
em: engine.entityManager,
|
|
36
|
+
ecd: scene.dataset
|
|
37
|
+
}));
|
|
35
38
|
tWaitForVisibleTerrainTiles.name = "Waiting for visible terrain tiles";
|
|
36
39
|
|
|
37
40
|
tWaitForVisibleTerrainTiles.addDependencies(tasks);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import View from "../../View.js";
|
|
2
2
|
import SVG, { svgCircularPath } from "../../SVG.js";
|
|
3
3
|
import { assert } from "../../../core/assert.js";
|
|
4
|
-
import { isValueBetween } from "../../../core/math/isValueBetween.js";
|
|
4
|
+
import { isValueBetween } from "../../../core/math/interval/isValueBetween.js";
|
|
5
5
|
import { PI2 } from "../../../core/math/PI2.js";
|
|
6
6
|
|
|
7
7
|
let idCount = 0;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 3-rd degree bezier curve
|
|
3
|
-
* @param {number} t
|
|
4
|
-
* @param {number} p0 start point
|
|
5
|
-
* @param {number} p1 control point
|
|
6
|
-
* @param {number} p2 control point
|
|
7
|
-
* @param {number} p3 end point
|
|
8
|
-
* @returns {number}
|
|
9
|
-
*/
|
|
10
|
-
function bezierCurve(t, p0, p1, p2, p3) {
|
|
11
|
-
const nt = 1 - t;
|
|
12
|
-
|
|
13
|
-
const nt_2 = nt * nt;
|
|
14
|
-
|
|
15
|
-
const nt_3 = nt_2 * nt;
|
|
16
|
-
|
|
17
|
-
const t_2 = t * t;
|
|
18
|
-
|
|
19
|
-
const t_3 = t_2 * t;
|
|
20
|
-
|
|
21
|
-
return nt_3 * p0 + 3 * nt_2 * t * p1 + 3 * nt * t_2 * p2 + t_3 * p3;
|
|
22
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/core/math/{isValueBetweenInclusive.spec.js → interval/isValueBetweenInclusive.spec.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|