@woosh/meep-engine 2.47.34 → 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 (59) 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/topology/struct/TopoMesh.js +9 -3
  16. package/src/core/geom/AABB2.js +1 -1
  17. package/src/core/geom/Rectangle.js +2 -2
  18. package/src/core/math/computeGreatestCommonDivisor.js +30 -3
  19. package/src/core/math/{intersects1D.js → interval/intersects1D.js} +1 -1
  20. package/src/core/math/{overlap1D.js → interval/overlap1D.js} +1 -1
  21. package/src/core/math/mix.js +5 -7
  22. package/src/core/math/random/randomUint8.js +10 -0
  23. package/src/core/math/spline/spline_bezier3.js +26 -0
  24. package/src/core/math/spline/spline_bezier3_bounds.js +87 -0
  25. package/src/core/model/node-graph/node/NodeInstance.js +1 -0
  26. package/src/core/process/task/Task.js +8 -6
  27. package/src/engine/achievements/AchievementManager.js +1 -1
  28. package/src/engine/animation/TransitionFunctions.js +1 -1
  29. package/src/engine/animation/curve/AnimationCurve.js +93 -1
  30. package/src/engine/animation/curve/Keyframe.js +20 -0
  31. package/src/engine/animation/curve/compression/prototypeCurveCompression.js +3 -1
  32. package/src/engine/ecs/components/MeshCollider.js +5 -0
  33. package/src/engine/ecs/components/MonsterAI.js +5 -0
  34. package/src/engine/ecs/fow/shader/FogOfWarRenderer.js +1 -1
  35. package/src/engine/ecs/guid/GUID.js +257 -0
  36. package/src/engine/ecs/guid/GUID.spec.js +41 -0
  37. package/src/engine/ecs/guid/GUIDSerializationAdapter.js +25 -0
  38. package/src/engine/ecs/storage/binary/BinaryClassSerializationAdapter.js +11 -12
  39. package/src/engine/ecs/terrain/util/loadVisibleTerrainTiles.js +23 -9
  40. package/src/engine/graphics/camera/CameraShake.js +1 -1
  41. package/src/engine/graphics/ecs/camera/CameraClippingPlaneComputer.js +1 -1
  42. package/src/engine/graphics/ecs/decal/v2/Decal.js +8 -6
  43. package/src/engine/intelligence/behavior/behavior_to_dot.js +11 -1
  44. package/src/engine/intelligence/behavior/decorator/AbstractDecoratorBehavior.js +6 -0
  45. package/src/engine/intelligence/behavior/util/behavior_traverse_tree.js +35 -0
  46. package/src/engine/scene/transitionToScene.js +4 -1
  47. package/src/view/elements/radial/RadialText.js +1 -1
  48. package/src/core/math/bezierCurve.js +0 -22
  49. /package/src/core/math/{isValueBetween.js → interval/isValueBetween.js} +0 -0
  50. /package/src/core/math/{isValueBetween.spec.js → interval/isValueBetween.spec.js} +0 -0
  51. /package/src/core/math/{isValueBetweenInclusive.js → interval/isValueBetweenInclusive.js} +0 -0
  52. /package/src/core/math/{isValueBetweenInclusive.spec.js → interval/isValueBetweenInclusive.spec.js} +0 -0
  53. /package/src/core/math/{overlap1D.spec.js → interval/overlap1D.spec.js} +0 -0
  54. /package/src/core/math/{cubicCurve.js → spline/cubicCurve.js} +0 -0
  55. /package/src/core/math/{cubicCurve.spec.js → spline/cubicCurve.spec.js} +0 -0
  56. /package/src/core/math/{makeCubicCurve.js → spline/makeCubicCurve.js} +0 -0
  57. /package/src/core/math/{makeCubicCurve.spec.js → spline/makeCubicCurve.spec.js} +0 -0
  58. /package/src/core/math/{quadraticCurve.js → spline/quadraticCurve.js} +0 -0
  59. /package/src/core/math/{quadraticCurve.spec.js → spline/quadraticCurve.spec.js} +0 -0
@@ -47691,15 +47691,11 @@ function max2(a, b) {
47691
47691
  }
47692
47692
 
47693
47693
  /**
47694
+ *
47694
47695
  * Produces a proportional mix of 2 values, a*(1-portion) + b*portion
47695
- * @param {number} a
47696
- * @param {number} b
47697
- * @param {number} portion
47698
- * @returns {number}
47696
+ * Same as lerp
47699
47697
  */
47700
- function mix(a, b, portion) {
47701
- return a * (1 - portion) + b * portion;
47702
- }
47698
+ const mix = lerp$1;
47703
47699
 
47704
47700
  /**
47705
47701
  * Color blending modes
@@ -57876,16 +57872,21 @@ function hsv2rgb(h, s, v) {
57876
57872
  };
57877
57873
  }
57878
57874
 
57875
+ /**
57876
+ * Converts string hex representation to a decimal integer
57877
+ * @param {string} v
57878
+ * @returns {number}
57879
+ */
57879
57880
  function hex2dec(v) {
57880
57881
  return parseInt(v, 16)
57881
- }
57882
-
57882
+ }
57883
+
57883
57884
  /**
57884
57885
  *
57885
- * @param {string} hex
57886
+ * @param {string} hex expect form #FFFFFF or #FFFFFFFF for RGBA
57886
57887
  * @returns {{r: number, g: number, b: number, a:number}} rgb
57887
57888
  */
57888
- function parseHex(hex) {
57889
+ function hex2rgb(hex) {
57889
57890
 
57890
57891
 
57891
57892
  const result = {
@@ -57957,7 +57958,7 @@ function parseColor(c) {
57957
57958
 
57958
57959
  } else if (cL.startsWith('#')) {
57959
57960
 
57960
- const rgb = parseHex(cL);
57961
+ const rgb = hex2rgb(cL);
57961
57962
 
57962
57963
  r = rgb.r;
57963
57964
  g = rgb.g;
@@ -58072,11 +58073,16 @@ function rgb2uint24(r, g, b) {
58072
58073
  ;
58073
58074
  }
58074
58075
 
58076
+ /**
58077
+ * Convert a decimal value to hex
58078
+ * @param {number} c generally expects b byte value, 0-255
58079
+ * @returns {string}
58080
+ */
58075
58081
  function dec2hex(c) {
58076
58082
  const hex = Math.round(c).toString(16);
58077
58083
  return hex.length === 1 ? "0" + hex : hex;
58078
- }
58079
-
58084
+ }
58085
+
58080
58086
  /**
58081
58087
  *
58082
58088
  * @param {number} r
@@ -58248,6 +58254,14 @@ class Color {
58248
58254
  this.set(r, g, b, this.a);
58249
58255
  }
58250
58256
 
58257
+ /**
58258
+ * set alpha
58259
+ * @param {number} a
58260
+ */
58261
+ setA(a) {
58262
+ this.set(this.r, this.g, this.b, a);
58263
+ }
58264
+
58251
58265
  /**
58252
58266
  *
58253
58267
  * @param {number} r
@@ -63944,17 +63958,17 @@ const TaskState = {
63944
63958
  class Task {
63945
63959
  /**
63946
63960
  *
63947
- * @param {string} name
63948
- * @param {function(Task, executor:ConcurrentExecutor)} [initializer]
63961
+ * @param {string} [name] useful for identifying the task later on, for various UI and debug purposes
63962
+ * @param {function(Task, executor:ConcurrentExecutor)} [initializer] function to be executed just before task starts
63949
63963
  * @param {function():TaskSignal} cycleFunction
63950
63964
  * @param {function():number} [computeProgress]
63951
63965
  * @param {Task[]} [dependencies=[]]
63952
- * @param {number} [estimatedDuration=1]
63966
+ * @param {number} [estimatedDuration=1] in seconds
63953
63967
  * @constructor
63954
63968
  */
63955
63969
  constructor(
63956
63970
  {
63957
- name,
63971
+ name = "Unnamed",
63958
63972
  initializer = noop,
63959
63973
  cycleFunction,
63960
63974
  computeProgress,
@@ -64108,6 +64122,8 @@ class Task {
64108
64122
  executeSync() {
64109
64123
  this.initialize();
64110
64124
 
64125
+ this.on.started.send0();
64126
+
64111
64127
  let s = this.cycle();
64112
64128
 
64113
64129
  for (; s !== TaskSignal.EndSuccess && s !== TaskSignal.EndFailure; s = this.cycle()) {
@@ -64115,9 +64131,9 @@ class Task {
64115
64131
  }
64116
64132
 
64117
64133
  if (s === TaskSignal.EndSuccess) {
64118
- this.on.completed.dispatch();
64134
+ this.on.completed.send0();
64119
64135
  } else if (s === TaskSignal.EndFailure) {
64120
- this.on.failed.dispatch();
64136
+ this.on.failed.send0();
64121
64137
  }
64122
64138
 
64123
64139
  return s;
@@ -100147,7 +100163,13 @@ class AbstractDecoratorBehavior extends Behavior {
100147
100163
 
100148
100164
  this.__source.finalize();
100149
100165
  }
100150
- }
100166
+ }
100167
+
100168
+ /**
100169
+ * @readonly
100170
+ * @type {boolean}
100171
+ */
100172
+ AbstractDecoratorBehavior.prototype.isDecoratorBehavior = true;
100151
100173
 
100152
100174
  /**
100153
100175
  * @extends {Behavior}
@@ -5,7 +5,7 @@ import Vector4 from "../../src/core/geom/Vector4.js";
5
5
  import loadSampler2D from "../../src/engine/graphics/texture/sampler/loadSampler2D.js";
6
6
  import convertSampler2D2Canvas from "../../src/engine/graphics/texture/sampler/Sampler2D2Canvas.js";
7
7
  import { InstancedMeshComponent } from "../../src/engine/ecs/foliage/ecs/InstancedMeshComponent.js";
8
- import { parseHex } from "../../src/core/color/parseHex.js";
8
+ import { hex2rgb } from "../../src/core/color/hex2rgb.js";
9
9
  import { obtainTerrain } from "../../src/engine/ecs/terrain/util/obtainTerrain.js";
10
10
 
11
11
  class FoliagePaintTool extends Tool {
@@ -32,7 +32,7 @@ class FoliagePaintTool extends Tool {
32
32
  buildColor() {
33
33
 
34
34
  const color = new Vector4();
35
- const baseColor = parseHex(this.settings.color.get());
35
+ const baseColor = hex2rgb(this.settings.color.get());
36
36
  color.set(baseColor.r, baseColor.g, baseColor.b, 0);
37
37
  color.multiplyScalar(1 / 255);
38
38
 
@@ -42,7 +42,7 @@ class FoliagePaintTool extends Tool {
42
42
  buildBaseColor() {
43
43
 
44
44
  const color = new Vector4();
45
- const baseColor = parseHex(this.settings.baseColor.get());
45
+ const baseColor = hex2rgb(this.settings.baseColor.get());
46
46
  color.set(baseColor.r, baseColor.g, baseColor.b, 0);
47
47
  color.multiplyScalar(1 / 255);
48
48
 
@@ -10,7 +10,7 @@ import { decodeMouseEventButtons, PointerDevice } from "../../src/engine/input/d
10
10
  import Vector2 from "../../src/core/geom/Vector2.js";
11
11
  import TopDownCameraControllerSystem
12
12
  from "../../src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSystem.js";
13
- import { parseHex } from "../../src/core/color/parseHex.js";
13
+ import { hex2rgb } from "../../src/core/color/hex2rgb.js";
14
14
  import { obtainTerrain } from "../../src/engine/ecs/terrain/util/obtainTerrain.js";
15
15
  import { pick } from "../../src/ecs/grid/pick.js";
16
16
 
@@ -55,7 +55,7 @@ class GridPaintTool extends Tool {
55
55
  buildColor() {
56
56
 
57
57
  const color = new Vector4();
58
- const baseColor = parseHex(this.settings.color.get());
58
+ const baseColor = hex2rgb(this.settings.color.get());
59
59
  color.set(baseColor.r, baseColor.g, baseColor.b, 0);
60
60
  color.multiplyScalar(1 / 255);
61
61
 
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "description": "Fully featured ECS game engine written in JavaScript",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.47.34",
8
+ "version": "2.47.35",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Convert a decimal value to hex
3
+ * @param {number} c generally expects b byte value, 0-255
4
+ * @returns {string}
5
+ */
6
+ export function dec2hex(c) {
7
+ const hex = Math.round(c).toString(16);
8
+ return hex.length === 1 ? "0" + hex : hex;
9
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Converts string hex representation to a decimal integer
3
+ * @param {string} v
4
+ * @returns {number}
5
+ */
6
+ export function hex2dec(v) {
7
+ return parseInt(v, 16)
8
+ }
@@ -135,6 +135,14 @@ export class Color {
135
135
  this.set(r, g, b, this.a);
136
136
  }
137
137
 
138
+ /**
139
+ * set alpha
140
+ * @param {number} a
141
+ */
142
+ setA(a) {
143
+ this.set(this.r, this.g, this.b, a);
144
+ }
145
+
138
146
  /**
139
147
  *
140
148
  * @param {number} r
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  import { hsv2rgb } from "./hsv2rgb.js";
6
- import { parseHex } from "./parseHex.js";
6
+ import { hex2rgb } from "./hex2rgb.js";
7
7
 
8
8
 
9
9
  const rgbRegEx = /rgb\(\s*([0-9]+),\s*([0-9]+),\s*([0-9]+)\s*\)/;
@@ -55,7 +55,7 @@ export function parseColor(c) {
55
55
 
56
56
  } else if (cL.startsWith('#')) {
57
57
 
58
- const rgb = parseHex(cL);
58
+ const rgb = hex2rgb(cL);
59
59
 
60
60
  r = rgb.r;
61
61
  g = rgb.g;
@@ -1,13 +1,11 @@
1
- function hex2dec(v) {
2
- return parseInt(v, 16)
3
- }
1
+ import { hex2dec } from "../binary/hex2dec.js";
4
2
 
5
3
  /**
6
4
  *
7
- * @param {string} hex
5
+ * @param {string} hex expect form #FFFFFF or #FFFFFFFF for RGBA
8
6
  * @returns {{r: number, g: number, b: number, a:number}} rgb
9
7
  */
10
- export function parseHex(hex) {
8
+ export function hex2rgb(hex) {
11
9
 
12
10
 
13
11
  const result = {
@@ -1,7 +1,4 @@
1
- export function dec2hex(c) {
2
- const hex = Math.round(c).toString(16);
3
- return hex.length === 1 ? "0" + hex : hex;
4
- }
1
+ import { dec2hex } from "../binary/dec2hex.js";
5
2
 
6
3
  /**
7
4
  *
@@ -1,4 +1,4 @@
1
- import { intersects1D } from "../../../math/intersects1D.js";
1
+ import { intersects1D } from "../../../math/interval/intersects1D.js";
2
2
 
3
3
  /**
4
4
  *
@@ -572,11 +572,17 @@ export class TopoMesh {
572
572
  /**
573
573
  *
574
574
  * @param {Float32Array} vertices
575
- * @param {Uint16Array} faces
575
+ * @param {Uint32Array|Uint16Array|Uint8Array|number[]} faces
576
576
  */
577
577
  build(vertices, faces) {
578
578
 
579
- const nVertices = vertices.length / 3;
579
+ const face_array_size = faces.length;
580
+ const vertex_array_size = vertices.length;
581
+
582
+ assert.equal(face_array_size % 3, 0, `Face array size must be multiple of 3, instead was ${face_array_size}`)
583
+ assert.equal(vertex_array_size % 3, 0, `Vertex array size must be multiple of 3, instead was ${vertex_array_size}`)
584
+
585
+ const nVertices = vertex_array_size / 3;
580
586
 
581
587
  //populate vertices
582
588
  const topoVertices = this.vertices;
@@ -596,7 +602,7 @@ export class TopoMesh {
596
602
  topoVertices[i] = v;
597
603
  }
598
604
 
599
- const nFaces = faces.length / 3;
605
+ const nFaces = face_array_size / 3;
600
606
 
601
607
  // populate faces
602
608
  const topoFaces = this.getFaces();
@@ -10,7 +10,7 @@ import { max2 } from "../math/max2.js";
10
10
  import { min2 } from "../math/min2.js";
11
11
  import LineSegment2 from "./LineSegment2.js";
12
12
  import Vector2 from "./Vector2.js";
13
- import { overlap1D } from "../math/overlap1D.js";
13
+ import { overlap1D } from "../math/interval/overlap1D.js";
14
14
 
15
15
  /**
16
16
  *
@@ -4,8 +4,8 @@
4
4
  import { max2 } from "../math/max2.js";
5
5
  import { min2 } from "../math/min2.js";
6
6
  import Vector2 from "./Vector2.js";
7
- import { intersects1D } from "../math/intersects1D.js";
8
- import { overlap1D } from "../math/overlap1D.js";
7
+ import { intersects1D } from "../math/interval/intersects1D.js";
8
+ import { overlap1D } from "../math/interval/overlap1D.js";
9
9
 
10
10
 
11
11
  class Rectangle {
@@ -1,5 +1,6 @@
1
1
  import { assert } from "../assert.js";
2
2
  import { min2 } from "./min2.js";
3
+ import { max2 } from "./max2.js";
3
4
 
4
5
  /**
5
6
  * Find the greatest common divisor (denominator/factor)
@@ -7,9 +8,9 @@ import { min2 } from "./min2.js";
7
8
  * @param {number} b
8
9
  * @returns {number}
9
10
  */
10
- export function computeGreatestCommonDivisor(a, b) {
11
- assert.typeOf(a, 'number', 'a');
12
- assert.typeOf(b, 'number', 'b');
11
+ function computeGreatestCommonDivisor_Naive(a, b) {
12
+ assert.isNumber(a, 'a');
13
+ assert.isNumber(b, 'b');
13
14
 
14
15
  // start with the lowest of the two as a guess
15
16
  let result = min2(a, b);
@@ -26,3 +27,29 @@ export function computeGreatestCommonDivisor(a, b) {
26
27
 
27
28
  return result;
28
29
  }
30
+
31
+ /**
32
+ * @see https://en.wikipedia.org/wiki/Euclidean_algorithm
33
+ * @param {number} a
34
+ * @param {number} b
35
+ * @returns {number}
36
+ */
37
+ function computeGreatestCommonDivisor_Euclid(a, b) {
38
+ assert.isNumber(a, 'a');
39
+ assert.isNumber(b, 'b');
40
+
41
+ let _a = max2(a, b);
42
+ let _b = min2(a, b);
43
+
44
+ while (_b !== 0) {
45
+ const t = _b;
46
+ _b = _a % _b;
47
+
48
+ _a = t;
49
+ }
50
+
51
+ return _a;
52
+ }
53
+
54
+
55
+ export const computeGreatestCommonDivisor = computeGreatestCommonDivisor_Euclid;
@@ -1,4 +1,4 @@
1
- import { assert } from "../assert.js";
1
+ import { assert } from "../../assert.js";
2
2
 
3
3
  /**
4
4
  * Returns true if two 1D lines intersect, touch is treated as intersection
@@ -1,4 +1,4 @@
1
- import { assert } from "../assert.js";
1
+ import { assert } from "../../assert.js";
2
2
 
3
3
  /**
4
4
  * Returns true if two 1D lines overlap, touch is not considered overlap
@@ -1,10 +1,8 @@
1
+ import { lerp } from "./lerp.js";
2
+
1
3
  /**
4
+ *
2
5
  * Produces a proportional mix of 2 values, a*(1-portion) + b*portion
3
- * @param {number} a
4
- * @param {number} b
5
- * @param {number} portion
6
- * @returns {number}
6
+ * Same as lerp
7
7
  */
8
- export function mix(a, b, portion) {
9
- return a * (1 - portion) + b * portion;
10
- }
8
+ export const mix = lerp;
@@ -0,0 +1,10 @@
1
+ import { randomIntegerBetween } from "./randomIntegerBetween.js";
2
+
3
+ /**
4
+ *
5
+ * @param {function():number} random
6
+ * @returns {number}
7
+ */
8
+ export function randomUint8(random){
9
+ return randomIntegerBetween(random,0,255);
10
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * 3-rd (cubic) degree bezier curve
3
+ * @see https://www.youtube.com/watch?v=jvPPXbo87ds&t=234s
4
+ * @see https://en.wikipedia.org/wiki/B%C3%A9zier_curve
5
+ * @param {number} t factor value between 0..1
6
+ * @param {number} p0 start point
7
+ * @param {number} p1 control point
8
+ * @param {number} p2 control point
9
+ * @param {number} p3 end point
10
+ * @returns {number}
11
+ */
12
+ function spline_bezier3(t, p0, p1, p2, p3) {
13
+ // first we compute necessary factors for each point
14
+ const nt = 1 - t;
15
+
16
+ const nt_2 = nt * nt;
17
+
18
+ const nt_3 = nt_2 * nt;
19
+
20
+ const t_2 = t * t;
21
+
22
+ const t_3 = t_2 * t;
23
+
24
+ // combine factors with point values to produce final result
25
+ return nt_3 * p0 + 3 * nt_2 * t * p1 + 3 * nt * t_2 * p2 + t_3 * p3;
26
+ }
@@ -0,0 +1,87 @@
1
+ import { min2 } from "../min2.js";
2
+ import { max2 } from "../max2.js";
3
+ import { assert } from "../../assert.js";
4
+
5
+ /**
6
+ * Compute bounds of a 3-rd degree bezier curve
7
+ * Note that this is a 1d case solver
8
+ * Lower bound will be written into result[offset], upper bounds will be written into result[offset+result_stride]
9
+ * @see https://github.com/adobe-webplatform/Snap.svg/blob/c8e483c9694517e24b282f8f59f985629f4994ce/src/path.js#L856
10
+ * @param {number[]|Float32Array} result
11
+ * @param {number} result_offset offset into the result array
12
+ * @param {number} result_stride
13
+ * @param {number} p0
14
+ * @param {number} p1
15
+ * @param {number} p2
16
+ * @param {number} p3
17
+ */
18
+ function spline_bezier3_bounds(result, result_offset, result_stride, p0, p1, p2, p3) {
19
+ assert.greaterThan(result_stride, 0, 'result_stride must be greater than 0');
20
+ assert.isInteger(result_stride, 'result_stride');
21
+
22
+ const b = 6 * p0 - 12 * p1 + 6 * p2;
23
+ const a = -3 * p0 + 9 * p1 - 9 * p2 + 3 * p3;
24
+ const c = 3 * p1 - 3 * p0;
25
+
26
+ let min = min2(p0, p3);
27
+ let max = max2(p0, p3);
28
+
29
+ if (Math.abs(a) < 1e-12) {
30
+
31
+ if (Math.abs(b) >= 1e-12) {
32
+ const t = -c / b;
33
+
34
+ if (0 < t && t < 1) {
35
+ const value = spline_bezier3(t, p0, p1, p2, p3);
36
+
37
+ if (value < min) {
38
+ min = value;
39
+ }
40
+ if (value > max) {
41
+ max = value;
42
+ }
43
+
44
+ }
45
+
46
+ }
47
+
48
+ } else {
49
+
50
+ const b2ac = b * b - 4 * c * a;
51
+ const sqrtb2ac = Math.sqrt(b2ac);
52
+
53
+ if (b2ac >= 0) {
54
+
55
+ const t1 = (-b + sqrtb2ac) / (2 * a);
56
+
57
+ if (0 < t1 && t1 < 1) {
58
+ const value = spline_bezier3(t1, p0, p1, p2, p3);
59
+
60
+ if (value < min) {
61
+ min = value;
62
+ }
63
+ if (value > max) {
64
+ max = value;
65
+ }
66
+ }
67
+
68
+ const t2 = (-b - sqrtb2ac) / (2 * a);
69
+
70
+ if (0 < t2 && t2 < 1) {
71
+ const value = spline_bezier3(t2, p0, p1, p2, p3);
72
+
73
+ if (value < min) {
74
+ min = value;
75
+ }
76
+ if (value > max) {
77
+ max = value;
78
+ }
79
+ }
80
+
81
+ }
82
+
83
+ }
84
+
85
+ result[result_offset] = min;
86
+ result[result_offset + result_stride] = max;
87
+ }
@@ -53,6 +53,7 @@ export class NodeInstance {
53
53
  /**
54
54
  * Extra ports that are present just on this instance, these exist in addition to ports from the description
55
55
  * IDs of these ports must not collide with IDs of ports on the description
56
+ * TODO implement functionality
56
57
  * @protected
57
58
  * @type {Port[]}
58
59
  */
@@ -14,17 +14,17 @@ import TaskState from "./TaskState.js";
14
14
  class Task {
15
15
  /**
16
16
  *
17
- * @param {string} name
18
- * @param {function(Task, executor:ConcurrentExecutor)} [initializer]
17
+ * @param {string} [name] useful for identifying the task later on, for various UI and debug purposes
18
+ * @param {function(Task, executor:ConcurrentExecutor)} [initializer] function to be executed just before task starts
19
19
  * @param {function():TaskSignal} cycleFunction
20
20
  * @param {function():number} [computeProgress]
21
21
  * @param {Task[]} [dependencies=[]]
22
- * @param {number} [estimatedDuration=1]
22
+ * @param {number} [estimatedDuration=1] in seconds
23
23
  * @constructor
24
24
  */
25
25
  constructor(
26
26
  {
27
- name,
27
+ name = "Unnamed",
28
28
  initializer = noop,
29
29
  cycleFunction,
30
30
  computeProgress,
@@ -178,6 +178,8 @@ class Task {
178
178
  executeSync() {
179
179
  this.initialize();
180
180
 
181
+ this.on.started.send0();
182
+
181
183
  let s = this.cycle();
182
184
 
183
185
  for (; s !== TaskSignal.EndSuccess && s !== TaskSignal.EndFailure; s = this.cycle()) {
@@ -185,9 +187,9 @@ class Task {
185
187
  }
186
188
 
187
189
  if (s === TaskSignal.EndSuccess) {
188
- this.on.completed.dispatch();
190
+ this.on.completed.send0();
189
191
  } else if (s === TaskSignal.EndFailure) {
190
- this.on.failed.dispatch();
192
+ this.on.failed.send0();
191
193
  }
192
194
 
193
195
  return s;
@@ -23,7 +23,7 @@ import { globalMetrics } from "../metrics/GlobalMetrics.js";
23
23
  import { MetricsCategory } from "../metrics/MetricsCategory.js";
24
24
  import { ClockChannelType } from "../intelligence/behavior/ecs/ClockChannelType.js";
25
25
  import { EnginePlugin } from "../plugin/EnginePlugin.js";
26
- import { makeCubicCurve } from "../../core/math/makeCubicCurve.js";
26
+ import { makeCubicCurve } from "../../core/math/spline/makeCubicCurve.js";
27
27
  import { logger } from "../logging/GlobalLogger.js";
28
28
  import { assert } from "../../core/assert.js";
29
29
 
@@ -1,4 +1,4 @@
1
- import { makeCubicCurve } from "../../core/math/makeCubicCurve.js";
1
+ import { makeCubicCurve } from "../../core/math/spline/makeCubicCurve.js";
2
2
 
3
3
  /**
4
4
  *