@woosh/meep-engine 2.47.33 → 2.47.35

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.
Files changed (62) hide show
  1. package/build/bundle-worker-terrain.js +1 -1
  2. package/build/meep.cjs +43 -21
  3. package/build/meep.min.js +1 -1
  4. package/build/meep.module.js +43 -21
  5. package/editor/tools/FoliagePaintTool.js +3 -3
  6. package/editor/tools/GridPaintTool.js +2 -2
  7. package/package.json +1 -1
  8. package/src/core/binary/dec2hex.js +9 -0
  9. package/src/core/binary/hex2dec.js +8 -0
  10. package/src/core/color/Color.js +8 -0
  11. package/src/core/color/ColorUtils.js +2 -2
  12. package/src/core/color/{parseHex.js → hex2rgb.js} +3 -5
  13. package/src/core/color/rgb2hex.js +1 -4
  14. package/src/core/geom/3d/aabb/aabb3_intersects_aabb3.js +1 -1
  15. package/src/core/geom/3d/apply_mat4_transform_to_direction_v3_array.js +49 -0
  16. package/src/core/geom/3d/apply_mat4_transform_to_v3_array.js +4 -3
  17. package/src/core/geom/3d/topology/struct/TopoMesh.js +9 -3
  18. package/src/core/geom/AABB2.js +1 -1
  19. package/src/core/geom/Rectangle.js +2 -2
  20. package/src/core/math/computeGreatestCommonDivisor.js +30 -3
  21. package/src/core/math/{intersects1D.js → interval/intersects1D.js} +1 -1
  22. package/src/core/math/{overlap1D.js → interval/overlap1D.js} +1 -1
  23. package/src/core/math/mix.js +5 -7
  24. package/src/core/math/random/randomUint8.js +10 -0
  25. package/src/core/math/spline/spline_bezier3.js +26 -0
  26. package/src/core/math/spline/spline_bezier3_bounds.js +87 -0
  27. package/src/core/model/node-graph/node/NodeDescription.js +9 -0
  28. package/src/core/model/node-graph/node/NodeInstance.js +11 -1
  29. package/src/core/process/task/Task.js +8 -6
  30. package/src/engine/achievements/AchievementManager.js +1 -1
  31. package/src/engine/animation/TransitionFunctions.js +1 -1
  32. package/src/engine/animation/curve/AnimationCurve.js +93 -1
  33. package/src/engine/animation/curve/Keyframe.js +20 -0
  34. package/src/engine/animation/curve/compression/prototypeCurveCompression.js +3 -1
  35. package/src/engine/ecs/components/MeshCollider.js +5 -0
  36. package/src/engine/ecs/components/MonsterAI.js +5 -0
  37. package/src/engine/ecs/fow/shader/FogOfWarRenderer.js +1 -1
  38. package/src/engine/ecs/guid/GUID.js +257 -0
  39. package/src/engine/ecs/guid/GUID.spec.js +41 -0
  40. package/src/engine/ecs/guid/GUIDSerializationAdapter.js +25 -0
  41. package/src/engine/ecs/storage/binary/BinaryClassSerializationAdapter.js +11 -12
  42. package/src/engine/ecs/terrain/util/loadVisibleTerrainTiles.js +23 -9
  43. package/src/engine/graphics/camera/CameraShake.js +1 -1
  44. package/src/engine/graphics/ecs/camera/CameraClippingPlaneComputer.js +1 -1
  45. package/src/engine/graphics/ecs/decal/v2/Decal.js +8 -6
  46. package/src/engine/intelligence/behavior/behavior_to_dot.js +11 -1
  47. package/src/engine/intelligence/behavior/decorator/AbstractDecoratorBehavior.js +6 -0
  48. package/src/engine/intelligence/behavior/util/behavior_traverse_tree.js +35 -0
  49. package/src/engine/scene/transitionToScene.js +4 -1
  50. package/src/view/elements/radial/RadialText.js +1 -1
  51. package/src/core/math/bezierCurve.js +0 -22
  52. /package/src/core/math/{isValueBetween.js → interval/isValueBetween.js} +0 -0
  53. /package/src/core/math/{isValueBetween.spec.js → interval/isValueBetween.spec.js} +0 -0
  54. /package/src/core/math/{isValueBetweenInclusive.js → interval/isValueBetweenInclusive.js} +0 -0
  55. /package/src/core/math/{isValueBetweenInclusive.spec.js → interval/isValueBetweenInclusive.spec.js} +0 -0
  56. /package/src/core/math/{overlap1D.spec.js → interval/overlap1D.spec.js} +0 -0
  57. /package/src/core/math/{cubicCurve.js → spline/cubicCurve.js} +0 -0
  58. /package/src/core/math/{cubicCurve.spec.js → spline/cubicCurve.spec.js} +0 -0
  59. /package/src/core/math/{makeCubicCurve.js → spline/makeCubicCurve.js} +0 -0
  60. /package/src/core/math/{makeCubicCurve.spec.js → spline/makeCubicCurve.spec.js} +0 -0
  61. /package/src/core/math/{quadraticCurve.js → spline/quadraticCurve.js} +0 -0
  62. /package/src/core/math/{quadraticCurve.spec.js → spline/quadraticCurve.spec.js} +0 -0
@@ -1,5 +1,6 @@
1
1
  import { Color } from "../../../../../core/color/Color.js";
2
2
  import { computeStringHash } from "../../../../../core/primitives/strings/computeStringHash.js";
3
+ import { assert } from "../../../../../core/assert.js";
3
4
 
4
5
  export class Decal {
5
6
  constructor() {
@@ -54,8 +55,13 @@ export class Decal {
54
55
  fromJSON({
55
56
  uri,
56
57
  priority = 0,
57
- color
58
+ color = '#FFFFFF'
58
59
  }) {
60
+
61
+ assert.isString(uri, 'uri');
62
+ assert.isNumber(priority, 'priority');
63
+ assert.notNaN(priority, 'priority');
64
+
59
65
  this.uri = uri;
60
66
  this.priority = priority;
61
67
 
@@ -65,11 +71,7 @@ export class Decal {
65
71
  this.__cached_uri = null;
66
72
  }
67
73
 
68
- if (color !== undefined) {
69
- this.color.parse(color);
70
- } else {
71
- this.color.set(1, 1, 1, 1);
72
- }
74
+ this.color.parse(color);
73
75
  }
74
76
 
75
77
  hash() {
@@ -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
 
@@ -44,3 +44,9 @@ export class AbstractDecoratorBehavior extends Behavior {
44
44
  this.__source.finalize();
45
45
  }
46
46
  }
47
+
48
+ /**
49
+ * @readonly
50
+ * @type {boolean}
51
+ */
52
+ AbstractDecoratorBehavior.prototype.isDecoratorBehavior = true;
@@ -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(engine.entityManager, scene.dataset));
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
- }