@woosh/meep-engine 2.70.0 → 2.71.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.
Files changed (31) hide show
  1. package/build/meep.cjs +109 -120
  2. package/build/meep.min.js +1 -1
  3. package/build/meep.module.js +109 -120
  4. package/package.json +1 -1
  5. package/src/core/geom/3d/quaternion/quat_encode_to_uint32.js +2 -3
  6. package/src/core/math/remap.js +5 -1
  7. package/src/core/math/statistics/computeStatisticalPartialMedian.js +1 -1
  8. package/src/core/process/task/Task.js +53 -34
  9. package/src/engine/achievements/AchievementManager.js +19 -19
  10. package/src/engine/animation/curve/compression/prototypeCurveCompression.js +6 -6
  11. package/src/engine/animation/curve/draw/build_plot_entity_from_array.js +11 -6
  12. package/src/engine/ecs/dynamic_actions/DynamicActor.js +5 -10
  13. package/src/engine/ecs/dynamic_actions/DynamicActorSystem.js +82 -89
  14. package/src/engine/ecs/dynamic_actions/RuleExecution.js +10 -12
  15. package/src/engine/ecs/gui/GUIElement.js +44 -61
  16. package/src/engine/ecs/gui/GUIElementSystem.js +26 -24
  17. package/src/engine/ecs/gui/hud/HeadsUpDisplay.js +12 -15
  18. package/src/engine/ecs/gui/hud/HeadsUpDisplaySystem.js +15 -15
  19. package/src/engine/ecs/gui/parallax/GuiElementParallax.js +3 -3
  20. package/src/engine/ecs/gui/parallax/GuiElementParallaxSystem.js +2 -2
  21. package/src/engine/ecs/gui/position/ViewportPosition.js +5 -50
  22. package/src/engine/ecs/gui/position/ViewportPositionSerializationAdapter.js +42 -0
  23. package/src/engine/ecs/transform/TransformSerializationAdapter.js +5 -10
  24. package/src/engine/graphics/impostors/octahedral/prototypeBaker.js +20 -20
  25. package/src/engine/graphics/texture/sprite/prototypeSpriteCutoutGeometry.js +12 -12
  26. package/src/engine/navigation/ecs/components/PathSerializationAdapter.js +1 -4
  27. package/src/core/binary/ValidatingBitSetWrapper.js +0 -81
  28. package/src/core/binary/jsonToStringToByteArray.js +0 -27
  29. package/src/engine/ecs/components/AreaOfEffect.js +0 -12
  30. package/src/engine/ecs/components/Mortality.js +0 -27
  31. package/src/engine/ecs/systems/AreaOfEffectSystem.js +0 -48
@@ -1891,7 +1891,7 @@ function quat_encode_to_uint32(x, y, z, w) {
1891
1891
  const absZ = Math.abs(z);
1892
1892
  const absW = Math.abs(w);
1893
1893
 
1894
- let max = 0;
1894
+ let v0, v1, v2, dropped, max;
1895
1895
 
1896
1896
  //pick max component
1897
1897
  if (absY > absX) {
@@ -1922,7 +1922,6 @@ function quat_encode_to_uint32(x, y, z, w) {
1922
1922
  max = 3;
1923
1923
  }
1924
1924
 
1925
- let v0, v1, v2, dropped;
1926
1925
 
1927
1926
  //max will be dropped
1928
1927
  if (max === 0) {
@@ -1962,7 +1961,7 @@ function quat_encode_to_uint32(x, y, z, w) {
1962
1961
  v2 = -v2;
1963
1962
  }
1964
1963
 
1965
- const l = Math.sqrt(x * x + y * y + z * z + w * w);
1964
+ const l = Math.hypot(v0, v1, v2, dropped);
1966
1965
  const m = 511 / (l * Math.SQRT1_2);
1967
1966
 
1968
1967
  //re-normalize the remaining components to 10 bit UINT value
@@ -65417,6 +65416,23 @@ const TaskSignal = {
65417
65416
  Yield: 3
65418
65417
  };
65419
65418
 
65419
+ /**
65420
+ * @template T
65421
+ * @param {T[]} array
65422
+ * @param {T} element
65423
+ * @return {boolean}
65424
+ */
65425
+ function array_push_if_unique(array, element) {
65426
+ const i = array.indexOf(element);
65427
+
65428
+ if (i === -1) {
65429
+ array.push(element);
65430
+ return true;
65431
+ }
65432
+
65433
+ return false;
65434
+ }
65435
+
65420
65436
  /**
65421
65437
  * Created by Alex on 22/05/2016.
65422
65438
  */
@@ -65439,8 +65455,44 @@ const TaskState = {
65439
65455
  * Created by Alex on 22/05/2016.
65440
65456
  */
65441
65457
 
65458
+ /**
65459
+ *
65460
+ * @type {number}
65461
+ */
65462
+ let id_counter$3 = 0;
65442
65463
 
65443
65464
  class Task {
65465
+ /**
65466
+ * @readonly
65467
+ * @type {number}
65468
+ */
65469
+ id = id_counter$3++;
65470
+
65471
+ on = {
65472
+ started: new Signal(),
65473
+ completed: new Signal(),
65474
+ failed: new Signal()
65475
+ };
65476
+
65477
+ /**
65478
+ *
65479
+ * @type {ObservedInteger}
65480
+ */
65481
+ state = new ObservedInteger(TaskState.INITIAL);
65482
+
65483
+ /**
65484
+ * amount of time spent running this task in milliseconds
65485
+ * @type {number}
65486
+ * @public
65487
+ */
65488
+ __executedCpuTime = 0;
65489
+ /**
65490
+ * number of time task's cycle function was executed
65491
+ * @type {number}
65492
+ * @public
65493
+ */
65494
+ __executedCycleCount = 0;
65495
+
65444
65496
  /**
65445
65497
  *
65446
65498
  * @param {string} [name] useful for identifying the task later on, for various UI and debug purposes
@@ -65465,9 +65517,16 @@ class Task {
65465
65517
  assert.isFunction(cycleFunction, 'cycleFunction');
65466
65518
  assert.isNumber(estimatedDuration, 'estimatedDuration');
65467
65519
 
65468
-
65520
+ /**
65521
+ *
65522
+ * @type {Task[]}
65523
+ */
65469
65524
  this.dependencies = dependencies;
65470
65525
 
65526
+ /**
65527
+ *
65528
+ * @type {number}
65529
+ */
65471
65530
  this.estimatedDuration = estimatedDuration;
65472
65531
 
65473
65532
  /**
@@ -65495,30 +65554,6 @@ class Task {
65495
65554
 
65496
65555
  }
65497
65556
 
65498
- this.on = {
65499
- started: new Signal(),
65500
- completed: new Signal(),
65501
- failed: new Signal()
65502
- };
65503
-
65504
- /**
65505
- *
65506
- * @type {ObservedInteger}
65507
- */
65508
- this.state = new ObservedInteger(TaskState.INITIAL);
65509
-
65510
- /**
65511
- * amount of time spent running this task in milliseconds
65512
- * @type {number}
65513
- * @public
65514
- */
65515
- this.__executedCpuTime = 0;
65516
- /**
65517
- * number of time task's cycle function was executed
65518
- * @type {number}
65519
- * @public
65520
- */
65521
- this.__executedCycleCount = 0;
65522
65557
  }
65523
65558
 
65524
65559
  computeProgress() {
@@ -65563,11 +65598,7 @@ class Task {
65563
65598
  } else if (task.isTask) {
65564
65599
 
65565
65600
  //check that the dependency is not registered yet
65566
- if (this.dependencies.indexOf(task) === -1) {
65567
-
65568
- this.dependencies.push(task);
65569
-
65570
- }
65601
+ array_push_if_unique(this.dependencies, task);
65571
65602
 
65572
65603
  } else {
65573
65604
  throw new Error('Expected a Task or a TaskGroup, got something else');
@@ -65581,11 +65612,14 @@ class Task {
65581
65612
  * @param {Array<(Task|TaskGroup)>} tasks
65582
65613
  */
65583
65614
  addDependencies(tasks) {
65584
- if (!Array.isArray(tasks)) {
65585
- throw new Error(`argument 'tasks' is not an Array`);
65586
- }
65615
+ assert.isArray(tasks, 'tasks');
65616
+
65617
+ const task_count = tasks.length;
65587
65618
 
65588
- tasks.forEach(t => this.addDependency(t));
65619
+ for (let i = 0; i < task_count; i++) {
65620
+ const task = tasks[i];
65621
+ this.addDependency(task);
65622
+ }
65589
65623
  }
65590
65624
 
65591
65625
  toString() {
@@ -69925,23 +69959,6 @@ function array_copy_unique(source, source_position, destination, destination_pos
69925
69959
  return j - destination_position;
69926
69960
  }
69927
69961
 
69928
- /**
69929
- * @template T
69930
- * @param {T[]} array
69931
- * @param {T} element
69932
- * @return {boolean}
69933
- */
69934
- function array_push_if_unique(array, element) {
69935
- const i = array.indexOf(element);
69936
-
69937
- if (i === -1) {
69938
- array.push(element);
69939
- return true;
69940
- }
69941
-
69942
- return false;
69943
- }
69944
-
69945
69962
  /**
69946
69963
  * Created by Alex on 01/04/2014.
69947
69964
  */
@@ -87868,7 +87885,7 @@ function computeStatisticalPartialMedian(values, start, end) {
87868
87885
 
87869
87886
  const range = end - start;
87870
87887
 
87871
- const position = (start + range / 2) | 0;
87888
+ const position = (start + range) >> 1;
87872
87889
 
87873
87890
  return copy[position];
87874
87891
  }
@@ -98775,13 +98792,6 @@ function playTrackRealTime(track, ecd) {
98775
98792
  return entity;
98776
98793
  }
98777
98794
 
98778
- /**
98779
- * Magic field that can be added to an individual component to control serialization on level of individual components
98780
- * @readonly
98781
- * @type {string}
98782
- */
98783
- const COMPONENT_SERIALIZATION_TRANSIENT_FIELD = '@serialization_transient';
98784
-
98785
98795
  /**
98786
98796
  * @template A,B
98787
98797
  * @param {A} a
@@ -98853,64 +98863,48 @@ const GUIElementFlag = {
98853
98863
  class GUIElement {
98854
98864
  /**
98855
98865
  *
98856
- * @param {View} [view] parameter is deprecated
98857
- * @constructor
98866
+ * @type {View}
98858
98867
  */
98859
- constructor(view) {
98860
- /**
98861
- *
98862
- * @type {View}
98863
- */
98864
- this.view = null;
98865
-
98866
- /**
98867
- *
98868
- * @type {String}
98869
- */
98870
- this.klass = null;
98871
-
98872
- /**
98873
- *
98874
- * @type {Object}
98875
- */
98876
- this.parameters = {};
98877
-
98878
- /**
98879
- * ranges from 0..1 in both X and Y, controls anchor point of element positioning
98880
- * @type {Vector2}
98881
- */
98882
- this.anchor = new Vector2(0, 0);
98868
+ view = null;
98883
98869
 
98884
- /**
98885
- * Used for visual grouping of elements, system will create and manage named containers to group elements together
98886
- * @readonly
98887
- * @type {String|null}
98888
- */
98889
- this.group = null;
98870
+ /**
98871
+ *
98872
+ * @type {String}
98873
+ */
98874
+ klass = null;
98890
98875
 
98891
- /**
98892
- * @private
98893
- * @type {number}
98894
- */
98895
- this.flags = GUIElementFlag.Managed;
98876
+ /**
98877
+ *
98878
+ * @type {Object}
98879
+ */
98880
+ parameters = {};
98896
98881
 
98882
+ /**
98883
+ * ranges from 0..1 in both X and Y, controls anchor point of element positioning
98884
+ * @type {Vector2}
98885
+ */
98886
+ anchor = new Vector2(0, 0);
98897
98887
 
98898
- /**
98899
- *
98900
- * @type {ObservedBoolean}
98901
- */
98902
- this.visible = new ObservedBoolean(true);
98888
+ /**
98889
+ * Used for visual grouping of elements, system will create and manage named containers to group elements together
98890
+ * @readonly
98891
+ * @type {String|null}
98892
+ */
98893
+ group = null;
98903
98894
 
98895
+ /**
98896
+ * @private
98897
+ * @type {number}
98898
+ */
98899
+ flags = GUIElementFlag.Managed;
98904
98900
 
98905
- if (view !== undefined) {
98906
- console.warn('constructor parameters are deprecated');
98907
- this.view = view;
98908
98901
 
98909
- //set non-serializable flag
98910
- this[COMPONENT_SERIALIZATION_TRANSIENT_FIELD] = true;
98911
- }
98902
+ /**
98903
+ *
98904
+ * @type {ObservedBoolean}
98905
+ */
98906
+ visible = new ObservedBoolean(true);
98912
98907
 
98913
- }
98914
98908
 
98915
98909
  /**
98916
98910
  *
@@ -99067,11 +99061,9 @@ GUIElement.serializable = true;
99067
99061
  class ViewportPosition {
99068
99062
  /**
99069
99063
  *
99070
- * @param {Vector2} [position]
99071
- * @param {Vector2} [offset]
99072
99064
  * @constructor
99073
99065
  */
99074
- constructor({ position, offset } = {}) {
99066
+ constructor(options) {
99075
99067
  /**
99076
99068
  * Clip-scale position, on-screen values are in range of 0 to 1
99077
99069
  * @type {Vector2}
@@ -99117,12 +99109,9 @@ class ViewportPosition {
99117
99109
  */
99118
99110
  this.enabled = new ObservedBoolean(true);
99119
99111
 
99120
- if (position !== void 0) {
99121
- this.position.copy(position);
99122
- }
99123
-
99124
- if (offset !== void 0) {
99125
- this.offset.copy(offset);
99112
+ if (options !== undefined) {
99113
+ console.warn("ViewportPosition constructor options is deprecated, please use static fromJSON method instead if you need similar functionality");
99114
+ this.fromJSON(options);
99126
99115
  }
99127
99116
  }
99128
99117
 
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.70.0",
8
+ "version": "2.71.0",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -15,7 +15,7 @@ export function quat_encode_to_uint32(x, y, z, w) {
15
15
  const absZ = Math.abs(z);
16
16
  const absW = Math.abs(w);
17
17
 
18
- let max = 0;
18
+ let v0, v1, v2, dropped, max;
19
19
 
20
20
  //pick max component
21
21
  if (absY > absX) {
@@ -46,7 +46,6 @@ export function quat_encode_to_uint32(x, y, z, w) {
46
46
  max = 3;
47
47
  }
48
48
 
49
- let v0, v1, v2, dropped;
50
49
 
51
50
  //max will be dropped
52
51
  if (max === 0) {
@@ -86,7 +85,7 @@ export function quat_encode_to_uint32(x, y, z, w) {
86
85
  v2 = -v2;
87
86
  }
88
87
 
89
- const l = Math.sqrt(x * x + y * y + z * z + w * w);
88
+ const l = Math.hypot(v0, v1, v2, dropped);
90
89
  const m = 511 / (l * Math.SQRT1_2);
91
90
 
92
91
  //re-normalize the remaining components to 10 bit UINT value
@@ -11,7 +11,11 @@ import { lerp } from "./lerp.js";
11
11
  * @param {number} value
12
12
  * @return {number}
13
13
  */
14
- export function remap(source_first, source_second, target_first, target_second, value) {
14
+ export function remap(
15
+ source_first, source_second,
16
+ target_first, target_second,
17
+ value
18
+ ) {
15
19
 
16
20
  const relative = inverseLerp(source_first, source_second, value);
17
21
 
@@ -18,7 +18,7 @@ export function computeStatisticalPartialMedian(values, start, end) {
18
18
 
19
19
  const range = end - start;
20
20
 
21
- const position = (start + range / 2) | 0;
21
+ const position = (start + range) >> 1;
22
22
 
23
23
  return copy[position];
24
24
  }
@@ -4,14 +4,51 @@
4
4
 
5
5
 
6
6
  import { assert } from "../../assert.js";
7
+ import { array_push_if_unique } from "../../collection/array/array_push_if_unique.js";
7
8
  import Signal from "../../events/signal/Signal.js";
8
9
  import { noop } from "../../function/Functions.js";
9
10
  import ObservedInteger from "../../model/ObservedInteger.js";
10
11
  import { TaskSignal } from "./TaskSignal.js";
11
12
  import TaskState from "./TaskState.js";
12
13
 
14
+ /**
15
+ *
16
+ * @type {number}
17
+ */
18
+ let id_counter = 0;
13
19
 
14
20
  class Task {
21
+ /**
22
+ * @readonly
23
+ * @type {number}
24
+ */
25
+ id = id_counter++;
26
+
27
+ on = {
28
+ started: new Signal(),
29
+ completed: new Signal(),
30
+ failed: new Signal()
31
+ };
32
+
33
+ /**
34
+ *
35
+ * @type {ObservedInteger}
36
+ */
37
+ state = new ObservedInteger(TaskState.INITIAL);
38
+
39
+ /**
40
+ * amount of time spent running this task in milliseconds
41
+ * @type {number}
42
+ * @public
43
+ */
44
+ __executedCpuTime = 0;
45
+ /**
46
+ * number of time task's cycle function was executed
47
+ * @type {number}
48
+ * @public
49
+ */
50
+ __executedCycleCount = 0;
51
+
15
52
  /**
16
53
  *
17
54
  * @param {string} [name] useful for identifying the task later on, for various UI and debug purposes
@@ -36,9 +73,16 @@ class Task {
36
73
  assert.isFunction(cycleFunction, 'cycleFunction');
37
74
  assert.isNumber(estimatedDuration, 'estimatedDuration');
38
75
 
39
-
76
+ /**
77
+ *
78
+ * @type {Task[]}
79
+ */
40
80
  this.dependencies = dependencies;
41
81
 
82
+ /**
83
+ *
84
+ * @type {number}
85
+ */
42
86
  this.estimatedDuration = estimatedDuration;
43
87
 
44
88
  /**
@@ -66,30 +110,6 @@ class Task {
66
110
 
67
111
  }
68
112
 
69
- this.on = {
70
- started: new Signal(),
71
- completed: new Signal(),
72
- failed: new Signal()
73
- };
74
-
75
- /**
76
- *
77
- * @type {ObservedInteger}
78
- */
79
- this.state = new ObservedInteger(TaskState.INITIAL);
80
-
81
- /**
82
- * amount of time spent running this task in milliseconds
83
- * @type {number}
84
- * @public
85
- */
86
- this.__executedCpuTime = 0;
87
- /**
88
- * number of time task's cycle function was executed
89
- * @type {number}
90
- * @public
91
- */
92
- this.__executedCycleCount = 0;
93
113
  }
94
114
 
95
115
  computeProgress() {
@@ -134,11 +154,7 @@ class Task {
134
154
  } else if (task.isTask) {
135
155
 
136
156
  //check that the dependency is not registered yet
137
- if (this.dependencies.indexOf(task) === -1) {
138
-
139
- this.dependencies.push(task);
140
-
141
- }
157
+ array_push_if_unique(this.dependencies, task);
142
158
 
143
159
  } else {
144
160
  throw new Error('Expected a Task or a TaskGroup, got something else');
@@ -152,11 +168,14 @@ class Task {
152
168
  * @param {Array<(Task|TaskGroup)>} tasks
153
169
  */
154
170
  addDependencies(tasks) {
155
- if (!Array.isArray(tasks)) {
156
- throw new Error(`argument 'tasks' is not an Array`);
157
- }
171
+ assert.isArray(tasks, 'tasks');
158
172
 
159
- tasks.forEach(t => this.addDependency(t));
173
+ const task_count = tasks.length;
174
+
175
+ for (let i = 0; i < task_count; i++) {
176
+ const task = tasks[i];
177
+ this.addDependency(task);
178
+ }
160
179
  }
161
180
 
162
181
  toString() {
@@ -1,31 +1,31 @@
1
- import { GameAssetType } from "../asset/GameAssetType.js";
2
- import { Achievement } from "./Achievement.js";
1
+ import { assert } from "../../core/assert.js";
2
+ import Vector2 from "../../core/geom/Vector2.js";
3
+ import { makeCubicCurve } from "../../core/math/spline/makeCubicCurve.js";
4
+ import ObservedBoolean from "../../core/model/ObservedBoolean.js";
3
5
  import { ReactiveAnd } from "../../core/model/reactive/model/logic/ReactiveAnd.js";
4
6
  import { ReactiveReference } from "../../core/model/reactive/model/terminal/ReactiveReference.js";
5
- import ObservedBoolean from "../../core/model/ObservedBoolean.js";
6
7
  import { AchievementNotificationView } from "../../view/game/achievements/AchievementNotificationView.js";
7
- import ViewportPosition from "../ecs/gui/position/ViewportPosition.js";
8
- import Vector2 from "../../core/geom/Vector2.js";
9
- import Entity from "../ecs/Entity.js";
10
- import GUIElement from "../ecs/gui/GUIElement.js";
11
8
  import AnimationTrack from "../animation/keyed2/AnimationTrack.js";
9
+ import AnimationTrackPlayback from "../animation/keyed2/AnimationTrackPlayback.js";
10
+ import { AnimationBehavior } from "../animation/keyed2/behavior/AnimationBehavior.js";
12
11
  import TransitionFunctions from "../animation/TransitionFunctions.js";
12
+ import { GameAssetType } from "../asset/GameAssetType.js";
13
+ import { SerializationMetadata } from "../ecs/components/SerializationMetadata.js";
14
+ import Entity from "../ecs/Entity.js";
15
+ import GUIElement from "../ecs/gui/GUIElement.js";
16
+ import ViewportPosition from "../ecs/gui/position/ViewportPosition.js";
17
+ import { Transform } from "../ecs/transform/Transform.js";
13
18
  import { SequenceBehavior } from "../intelligence/behavior/composite/SequenceBehavior.js";
14
- import { ActionBehavior } from "../intelligence/behavior/primitive/ActionBehavior.js";
15
- import { AnimationBehavior } from "../animation/keyed2/behavior/AnimationBehavior.js";
16
- import AnimationTrackPlayback from "../animation/keyed2/AnimationTrackPlayback.js";
17
19
  import { BehaviorComponent } from "../intelligence/behavior/ecs/BehaviorComponent.js";
18
- import { SoundEmitter } from "../sound/ecs/emitter/SoundEmitter.js";
19
- import { SoundEmitterChannels } from "../sound/ecs/emitter/SoundEmitterSystem.js";
20
- import { Transform } from "../ecs/transform/Transform.js";
21
- import { SerializationMetadata } from "../ecs/components/SerializationMetadata.js";
20
+ import { ClockChannelType } from "../intelligence/behavior/ecs/ClockChannelType.js";
21
+ import { ActionBehavior } from "../intelligence/behavior/primitive/ActionBehavior.js";
22
+ import { logger } from "../logging/GlobalLogger.js";
22
23
  import { globalMetrics } from "../metrics/GlobalMetrics.js";
23
24
  import { MetricsCategory } from "../metrics/MetricsCategory.js";
24
- import { ClockChannelType } from "../intelligence/behavior/ecs/ClockChannelType.js";
25
25
  import { EnginePlugin } from "../plugin/EnginePlugin.js";
26
- import { makeCubicCurve } from "../../core/math/spline/makeCubicCurve.js";
27
- import { logger } from "../logging/GlobalLogger.js";
28
- import { assert } from "../../core/assert.js";
26
+ import { SoundEmitter } from "../sound/ecs/emitter/SoundEmitter.js";
27
+ import { SoundEmitterChannels } from "../sound/ecs/emitter/SoundEmitterSystem.js";
28
+ import { Achievement } from "./Achievement.js";
29
29
 
30
30
 
31
31
  const SLOW_CUBIC = makeCubicCurve(0.04, 0.4, 0.9, 0.99);
@@ -291,7 +291,7 @@ export class AchievementManager extends EnginePlugin {
291
291
  achievementView.size.x = 460;
292
292
  achievementView.size.y = 58;
293
293
 
294
- const viewportPosition = new ViewportPosition({
294
+ const viewportPosition = ViewportPosition.fromJSON({
295
295
  position: new Vector2(0.5, 0)
296
296
  });
297
297
 
@@ -1,12 +1,12 @@
1
+ import GUIElementSystem from "../../../ecs/gui/GUIElementSystem.js";
2
+ import ViewportPositionSystem from "../../../ecs/gui/position/ViewportPositionSystem.js";
3
+ import { EngineConfiguration } from "../../../EngineConfiguration.js";
1
4
  import { EngineHarness } from "../../../EngineHarness.js";
2
5
  import { AnimationCurve } from "../AnimationCurve.js";
6
+ import { build_plot_entity_from_array } from "../draw/build_plot_entity_from_array.js";
3
7
  import { Keyframe } from "../Keyframe.js";
4
- import { EngineConfiguration } from "../../../EngineConfiguration.js";
5
- import GUIElementSystem from "../../../ecs/gui/GUIElementSystem.js";
6
- import ViewportPositionSystem from "../../../ecs/gui/position/ViewportPositionSystem.js";
7
- import { sample_animation_curve_to_float_array } from "./sample_animation_curve_to_float_array.js";
8
8
  import { downsample_float_array_curve_by_error } from "./downsample_float_array_curve_by_error.js";
9
- import { build_plot_entity_from_array } from "../draw/build_plot_entity_from_array.js";
9
+ import { sample_animation_curve_to_float_array } from "./sample_animation_curve_to_float_array.js";
10
10
 
11
11
  const eh = new EngineHarness();
12
12
 
@@ -134,7 +134,7 @@ async function main(engine) {
134
134
  return curve;
135
135
  }
136
136
 
137
- const curve = sample_curve_4();
137
+ const curve = sample_curve_0();
138
138
 
139
139
  curve.smoothAllTangents();
140
140
 
@@ -1,10 +1,10 @@
1
+ import Vector2 from "../../../../core/geom/Vector2.js";
1
2
  import { CanvasView } from "../../../../view/elements/CanvasView.js";
2
- import { plot_data } from "./plot_data.js";
3
- import { draw_label } from "./draw_label.js";
4
3
  import Entity from "../../../ecs/Entity.js";
5
- import ViewportPosition from "../../../ecs/gui/position/ViewportPosition.js";
6
4
  import GUIElement from "../../../ecs/gui/GUIElement.js";
7
- import Vector2 from "../../../../core/geom/Vector2.js";
5
+ import ViewportPosition from "../../../ecs/gui/position/ViewportPosition.js";
6
+ import { draw_label } from "./draw_label.js";
7
+ import { plot_data } from "./plot_data.js";
8
8
 
9
9
  /**
10
10
  *
@@ -22,12 +22,17 @@ export function build_plot_entity_from_array({
22
22
  x, y,
23
23
  width = 600,
24
24
  height = 200,
25
- margin = new Vector2(10,10),
25
+ margin = new Vector2(10, 10),
26
26
  label = ''
27
27
  }) {
28
28
 
29
29
  const canvasView = new CanvasView();
30
30
  canvasView.size.set(width, height);
31
+ canvasView.css({
32
+ position: "absolute",
33
+ left: "0",
34
+ top: "0"
35
+ });
31
36
  const ctx = canvasView.context2d;
32
37
 
33
38
  plot_data({ ctx, data, width, height, margin });
@@ -36,7 +41,7 @@ export function build_plot_entity_from_array({
36
41
  draw_label(ctx, text, margin.x, height - (20));
37
42
 
38
43
  if (typeof label === "string" && label.length > 0) {
39
- draw_label(ctx, label, 0, 0)
44
+ draw_label(ctx, label, width - margin.x - 50 , 20)
40
45
  }
41
46
 
42
47
  return new Entity()
@@ -1,15 +1,10 @@
1
1
  export class DynamicActor {
2
2
 
3
- constructor() {
4
-
5
-
6
- /**
7
- * Entities who's blackboards should be included into evaluation context
8
- * @type {number[]}
9
- */
10
- this.context = [];
11
-
12
- }
3
+ /**
4
+ * Entities whose blackboards should be included into evaluation context
5
+ * @type {number[]}
6
+ */
7
+ context = [];
13
8
  }
14
9
 
15
10
  /**