@woosh/meep-engine 2.131.17 → 2.131.20

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 (45) hide show
  1. package/README.md +85 -101
  2. package/editor/ecs/component/editors/geom/QuaternionEditor.js +3 -3
  3. package/editor/tools/TransformTool.js +14 -3
  4. package/package.json +1 -1
  5. package/src/core/geom/Quaternion.d.ts +52 -19
  6. package/src/core/geom/Quaternion.d.ts.map +1 -1
  7. package/src/core/geom/Quaternion.js +77 -27
  8. package/src/core/geom/Vector3.d.ts +3 -0
  9. package/src/core/geom/Vector3.d.ts.map +1 -1
  10. package/src/core/geom/Vector3.js +16 -6
  11. package/src/core/math/spline/spline3_hermite.d.ts +1 -1
  12. package/src/core/math/spline/spline3_hermite.js +1 -1
  13. package/src/core/math/spline/spline3_hermite_bounds.d.ts +1 -1
  14. package/src/core/math/spline/spline3_hermite_bounds.js +2 -2
  15. package/src/core/math/spline/spline3_hermite_derivative.d.ts +8 -6
  16. package/src/core/math/spline/spline3_hermite_derivative.d.ts.map +1 -1
  17. package/src/core/math/spline/spline3_hermite_derivative.js +10 -7
  18. package/src/core/math/spline/spline3_hermite_integral.d.ts +14 -0
  19. package/src/core/math/spline/spline3_hermite_integral.d.ts.map +1 -0
  20. package/src/core/math/spline/spline3_hermite_integral.js +35 -0
  21. package/src/core/math/spline/spline3_hermite_subdivide.d.ts +1 -1
  22. package/src/core/math/spline/spline3_hermite_subdivide.js +1 -1
  23. package/src/core/model/node-graph/NodeGraph.d.ts +1 -0
  24. package/src/core/model/node-graph/NodeGraph.d.ts.map +1 -1
  25. package/src/core/model/node-graph/NodeGraph.js +4 -0
  26. package/src/engine/animation/curve/animation_curve_fit.d.ts +17 -0
  27. package/src/engine/animation/curve/animation_curve_fit.d.ts.map +1 -0
  28. package/src/engine/animation/curve/animation_curve_fit.js +195 -0
  29. package/src/engine/animation/curve/animation_curve_optimize.d.ts.map +1 -1
  30. package/src/engine/animation/curve/animation_curve_optimize.js +65 -21
  31. package/src/engine/animation/curve/animation_curve_subdivide.d.ts +4 -2
  32. package/src/engine/animation/curve/animation_curve_subdivide.d.ts.map +1 -1
  33. package/src/engine/animation/curve/animation_curve_subdivide.js +4 -2
  34. package/src/engine/ecs/transform/Transform.d.ts +9 -6
  35. package/src/engine/ecs/transform/Transform.d.ts.map +1 -1
  36. package/src/engine/ecs/transform/Transform.js +15 -8
  37. package/src/engine/graphics/ecs/camera/topdown/ComputeCameraFacingVector.js +1 -1
  38. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSystem.js +1 -1
  39. package/src/engine/graphics/ecs/mesh-v2/aggregate/prototypeSGMesh.js +1 -1
  40. package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +1 -1
  41. package/src/generation/markers/transform/MarkerNodeTransformerYRotateByFilter.d.ts.map +1 -1
  42. package/src/generation/markers/transform/MarkerNodeTransformerYRotateByFilter.js +3 -3
  43. package/src/generation/markers/transform/MarkerNodeTransformerYRotateByFilterGradient.d.ts.map +1 -1
  44. package/src/generation/markers/transform/MarkerNodeTransformerYRotateByFilterGradient.js +5 -6
  45. package/src/view/View.d.ts +3 -3
@@ -1,14 +1,19 @@
1
1
  import { assert } from "../../../core/assert.js";
2
2
  import AABB2 from "../../../core/geom/2d/aabb/AABB2.js";
3
+ import { spline3_hermite_derivative } from "../../../core/math/spline/spline3_hermite_derivative.js";
3
4
  import { animation_curve_compute_aabb } from "./animation_curve_compute_aabb.js";
4
5
  import { evaluate_two_key_curve } from "./evaluate_two_key_curve.js";
5
6
 
6
7
  const bounds = new AABB2();
7
8
 
8
- const NORMALIZED_CHECK_DISTANCE = 0.07;
9
+ // Scaling factor to project slope error into value error.
10
+ // 0.125 (1/8th) is a standard approximation for cubic bezier error bounds.
11
+ const TANGENT_ERROR_WEIGHT = 0.125;
9
12
 
10
13
  /**
11
- * Compute the value difference in the curve if the `middle` key between `previous` and `next` is removed
14
+ * Computes importance by checking Position AND Slope integrity.
15
+ * Uses exact derivative calculation instead of neighbor sampling
16
+ *
12
17
  * @param {Keyframe} key_middle
13
18
  * @param {Keyframe} key_previous
14
19
  * @param {Keyframe} key_next
@@ -22,30 +27,54 @@ function compute_keyframe_value_effect(
22
27
  key_previous,
23
28
  key_next
24
29
  ) {
30
+ const duration = key_next.time - key_previous.time;
31
+
32
+ // Safety check for zero-duration (duplicate keys handled by outer loop, but safe to guard)
33
+ if (duration < 1e-9){
34
+ return 0;
35
+ }
36
+
37
+ // 1. Calculate Normalized Time t [0, 1]
38
+ const t_relative = key_middle.time - key_previous.time;
39
+ const t_normalized = t_relative / duration;
25
40
 
26
- // check if this key contributes to the shape
27
- const v1_actual = evaluate_two_key_curve(key_middle.time, key_previous, key_next);
28
- const v1_expected = key_middle.value;
41
+ // 2. Calculate Position Error (The "Hit Test")
42
+ // Does the simplified curve actually hit the middle key's value?
43
+ const v_actual = evaluate_two_key_curve(key_middle.time, key_previous, key_next);
44
+ const v_error = Math.abs(v_actual - key_middle.value);
29
45
 
30
- const v1_error = Math.abs(v1_actual - v1_expected);
46
+ // 3. Calculate Derivative Error (The "Shape Test")
47
+ // Does the simplified curve flow in the same direction as the original key?
31
48
 
32
- // sample just before the current frame
33
- const v0_time = key_middle.time - (key_middle.time - key_previous.time) * NORMALIZED_CHECK_DISTANCE;
49
+ // NOTE: Hermite basis requires tangents scaled by duration (m0, m1)
50
+ // We assume keyframes have .outTangent and .inTangent or similar.
51
+ // If you use standard Hermite data, it looks like this:
52
+ const m0 = key_previous.outTangent * duration;
53
+ const m1 = key_next.inTangent * duration;
34
54
 
35
- const v0_actual = evaluate_two_key_curve(v0_time, key_previous, key_next);
36
- const v0_expected = evaluate_two_key_curve(v0_time, key_previous, key_middle);
55
+ // This returns the derivative in "Value per Normalized Time"
56
+ const slope_normalized = spline3_hermite_derivative(
57
+ t_normalized,
58
+ key_previous.value,
59
+ key_next.value,
60
+ m0,
61
+ m1
62
+ );
37
63
 
38
- const v0_error = Math.abs(v0_actual - v0_expected);
64
+ // Convert to "Value per Second" to match the keyframe's stored tangent
65
+ const slope_actual = slope_normalized / duration;
39
66
 
40
- // sample just after the current frame
41
- const v2_time = key_middle.time + (key_next.time - key_middle.time) * NORMALIZED_CHECK_DISTANCE;
67
+ // We compare against the explicit tangent stored on the middle key (or calculated implicit tangent)
68
+ // Assuming the key has a unified tangent or we use the inTangent
69
+ const slope_expected = key_middle.inTangent; // or .outTangent, or average if smooth
42
70
 
43
- const v2_actual = evaluate_two_key_curve(v2_time, key_previous, key_next);
44
- const v2_expected = evaluate_two_key_curve(v2_time, key_middle, key_next);
71
+ const slope_delta = Math.abs(slope_actual - slope_expected);
45
72
 
46
- const v2_error = Math.abs(v2_actual - v2_expected);
73
+ // 4. Project Slope Delta into Value Units
74
+ // If the slope is off by 1 unit/sec, how much drift does that cause over the duration?
75
+ const slope_error_projected = slope_delta * duration * TANGENT_ERROR_WEIGHT;
47
76
 
48
- return Math.max(v0_error, v1_error, v2_error);
77
+ return Math.max(v_error, slope_error_projected);
49
78
  }
50
79
 
51
80
  /**
@@ -65,11 +94,22 @@ export function animation_curve_optimize(
65
94
  ) {
66
95
  assert.lessThan(error_tolerance, 1, 'error_tolerance must be less than 1');
67
96
 
97
+ let key_count = curve.length;
98
+
99
+ if (key_count <= 1) {
100
+ // nothing to remove
101
+ return 0;
102
+ }
103
+
68
104
  animation_curve_compute_aabb(bounds, curve);
69
105
 
70
- const absolute_error_tolerance = bounds.height * error_tolerance;
106
+ const EPSILON = 1e-9;
71
107
 
72
- let key_count = curve.length;
108
+ // Clamp against epsilon to handle the flat-line case or very low tolerances resulting in precision issues
109
+ const absolute_error_tolerance = Math.max(
110
+ bounds.height * error_tolerance,
111
+ EPSILON,
112
+ );
73
113
 
74
114
  const keyframes = curve.keys;
75
115
 
@@ -84,9 +124,8 @@ export function animation_curve_optimize(
84
124
  if (key_current.equals(key_previous)) {
85
125
  // adds no semantic value
86
126
  should_remove = true;
87
- }
127
+ } else if (i < key_count - 1) {
88
128
 
89
- if (!should_remove && i < key_count - 1) {
90
129
  const key_next = keyframes[i + 1];
91
130
 
92
131
  const max_error = compute_keyframe_value_effect(key_current, key_previous, key_next);
@@ -95,13 +134,18 @@ export function animation_curve_optimize(
95
134
  // does not significantly affect the curve shape
96
135
  should_remove = true;
97
136
  }
137
+
98
138
  }
99
139
 
100
140
 
101
141
  if (should_remove) {
142
+
102
143
  curve.remove(key_current);
144
+
145
+ // update iterator
103
146
  i--;
104
147
  key_count--;
148
+
105
149
  }
106
150
  }
107
151
 
@@ -1,11 +1,13 @@
1
1
  /**
2
2
  * Subdivide a curve segment by introducing a new keyframe at a given normalized time.
3
3
  * Subdivision does not alter the curve shape in any way, it is intended primarily for editing purposes.
4
+ *
4
5
  * @param {Keyframe} out keyframe to be added at the point of subdivision, its tangents, time and value will be overwritten
5
- * @param {Keyframe} key0
6
- * @param {Keyframe} key1
6
+ * @param {Keyframe} key0 start of the segment
7
+ * @param {Keyframe} key1 end of the segment
7
8
  * @param {number} t normalized time in [0..1] between key0 and key1 where new frame is to be inserted
8
9
  * @returns {Keyframe} `out`, for convenience
10
+ *
9
11
  * @see AnimationCurve
10
12
  * @example
11
13
  * const new_frame = animation_curve_subdivide(new Keyframe(), key0, key1, 0.5);
@@ -1 +1 @@
1
- {"version":3,"file":"animation_curve_subdivide.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/animation_curve_subdivide.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;GAYG;AACH,+CAVW,QAAQ,QACR,QAAQ,QACR,QAAQ,KACR,MAAM,GACJ,QAAQ,CAqDpB"}
1
+ {"version":3,"file":"animation_curve_subdivide.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/animation_curve_subdivide.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;GAcG;AACH,+CAXW,QAAQ,QACR,QAAQ,QACR,QAAQ,KACR,MAAM,GACJ,QAAQ,CAsDpB"}
@@ -6,11 +6,13 @@ import { spline3_hermite_derivative } from "../../../core/math/spline/spline3_he
6
6
  /**
7
7
  * Subdivide a curve segment by introducing a new keyframe at a given normalized time.
8
8
  * Subdivision does not alter the curve shape in any way, it is intended primarily for editing purposes.
9
+ *
9
10
  * @param {Keyframe} out keyframe to be added at the point of subdivision, its tangents, time and value will be overwritten
10
- * @param {Keyframe} key0
11
- * @param {Keyframe} key1
11
+ * @param {Keyframe} key0 start of the segment
12
+ * @param {Keyframe} key1 end of the segment
12
13
  * @param {number} t normalized time in [0..1] between key0 and key1 where new frame is to be inserted
13
14
  * @returns {Keyframe} `out`, for convenience
15
+ *
14
16
  * @see AnimationCurve
15
17
  * @example
16
18
  * const new_frame = animation_curve_subdivide(new Keyframe(), key0, key1, 0.5);
@@ -1,9 +1,7 @@
1
1
  /**
2
2
  * A Transform represents the position, rotation, and scale of an object in 3D space.
3
3
  * Think of it like the object's location, orientation, and size.
4
- * It has properties for position (like coordinates), rotation (how it's turned), and scale (how big it is).
5
- *
6
- * It also uses a "matrix" (a table of numbers) internally to efficiently store and calculate transformations, but you usually interact with the position, rotation, and scale directly.
4
+ * It has properties for {@link position} (like coordinates), {@link rotation} (how it's oriented), and {@link scale} (how big it is).
7
5
  *
8
6
  * @example
9
7
  * const t = new Transform();
@@ -50,8 +48,11 @@ export class Transform {
50
48
  */
51
49
  readonly scale: Vector3;
52
50
  /**
53
- * transform matrix, position, rotation, and scale must match, but shear can be different
54
- * Note: this is managed by the Transform itself, do not modify the matrix directly. If you want to set it - use {@link fromMatrix} method instead
51
+ * Affine transform matrix, {@link position}, {@link rotation}, and {@link scale} must match, but shear can be different.
52
+ * Note: this is managed by the {@link Transform} itself unless {@link TransformFlags.AutomaticChangeDetection} is disabled; do not modify the matrix directly.
53
+ * Generally, if you want to modify it - use {@link fromMatrix} method instead.
54
+ *
55
+ * If you're not comfortable with matrices, just leave defaults on and stick to primary attributes i.e. {@link position}, {@link rotation}, and {@link scale}.
55
56
  * @readonly
56
57
  * @type {Float32Array}
57
58
  */
@@ -115,7 +116,9 @@ export class Transform {
115
116
  */
116
117
  getFlag(flag: number | TransformFlags): boolean;
117
118
  /**
118
- * Update {@link matrix} attribute from current position/rotation/scale
119
+ * Update {@link matrix} attribute from current {@link position}/{@link rotation}/{@link scale}
120
+ *
121
+ * Useful for when {@link TransformFlags.AutomaticChangeDetection} is disabled.
119
122
  */
120
123
  updateMatrix(): void;
121
124
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Transform.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/transform/Transform.js"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;GAaG;AACH;IA6QI;;;;OAIG;IACH,4BAFa,SAAS,CAQrB;IAED;;;;OAIG;IACH,uBAHW,MAAM,EAAE,GAAC,YAAY,GACnB,SAAS,CAQrB;IA0FD;;;;;OAKG;IACH,wCAJW,UAAU,gBACV,OAAO,wBAejB;IA/YD;;;OAGG;IACH,mBAHU,OAAO,CAGe;IAEhC;;;;;OAKG;IACH,mBAHU,UAAU,CAGkB;IAEtC;;;OAGG;IACH,gBAHU,OAAO,CAGY;IAE7B;;;;;OAKG;IACH,iBAFU,YAAY,CAEC;IAEvB;;;;OAIG;IACH,OAFU,MAAM,CAEM;IAOtB;;;;OAIG;IACH,uBAMC;IAED;;;OAGG;IACH,kBAMC;IAED;;;OAGG;IACH,qBAMC;IAED;;;;OAIG;IACH,kDAIC;IAED;;;;OAIG;IACH,oDAIC;IAYD;;;;OAIG;IACH,cAHW,MAAM,GAAC,cAAc,GACnB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,cAAc,GACnB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,cAAc,SACrB,OAAO,QAQjB;IAED;;;;OAIG;IACH,cAHW,MAAM,GAAC,cAAc,GACnB,OAAO,CAInB;IAED;;OAEG;IACH,qBAEC;IAED;;;;OAIG;IACH,eAHW,OAAO,OACP,OAAO,QAmBjB;IAED,0BAwBC;IAED;;;;;;;;;;;;;;;;;MAMC;IAED;;;;;OAKG;IACH,YAFW,SAAS,QAenB;IAED;;;OAGG;IACH,SAFa,SAAS,CAQrB;IAED;;;;OAIG;IACH,cAHW,SAAS,GACP,OAAO,CAMnB;IAED;;;OAGG;IACH,QAFa,MAAM,CAKlB;IA4BD;;;;;;OAMG;IACH,gBAHW,SAAS,GACP,IAAI,CAIhB;IAED;;;;;OAKG;IACH,sBAJW,SAAS,KACT,SAAS,GACP,IAAI,CAWhB;IAED;;;;OAIG;IACH,mBAHW,OAAK,MAAM,EAAE,GAAC,YAAY,GACxB,IAAI,CAmBhB;IAED;;;;OAIG;IACH,kBAHW,MAAM,EAAE,GAAC,YAAY,GACnB,MAAM,EAAE,CAOpB;IAED;;;;;OAKG;IACH,qBAEC;IAED;;;OAGG;IACH,cAFa,OAAO,CAMnB;IAED,mBAEC;IA6BL;;;;;;;;OAQG;IACH,sBANU,OAAO,CAMc;IAE/B;;;OAGG;IACH,8BA5Ee,MAAM,EAAE,GAAC,YAAY,KACnB,MAAM,EAAE,CA2EI;IAE7B;;;OAGG;IACH,+BA1Ge,OAAK,MAAM,EAAE,GAAC,YAAY,KACxB,IAAI,CAyGU;;CA7B9B;;kBAIS,MAAM;;oBAnbI,+BAA+B;uBAD5B,kCAAkC;+BAE1B,qBAAqB"}
1
+ {"version":3,"file":"Transform.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/transform/Transform.js"],"names":[],"mappings":"AAsBA;;;;;;;;;;;GAWG;AACH;IAsRI;;;;OAIG;IACH,4BAFa,SAAS,CAQrB;IAED;;;;OAIG;IACH,uBAHW,MAAM,EAAE,GAAC,YAAY,GACnB,SAAS,CAQrB;IA0FD;;;;;OAKG;IACH,wCAJW,UAAU,gBACV,OAAO,wBAejB;IAxZD;;;OAGG;IACH,mBAHU,OAAO,CAGe;IAEhC;;;;;OAKG;IACH,mBAHU,UAAU,CAGkB;IAEtC;;;OAGG;IACH,gBAHU,OAAO,CAGY;IAE7B;;;;;;;;OAQG;IACH,iBAFU,YAAY,CAEC;IAEvB;;;;OAIG;IACH,OAFU,MAAM,CAEM;IAStB;;;;OAIG;IACH,uBAMC;IAED;;;OAGG;IACH,kBAMC;IAED;;;OAGG;IACH,qBAMC;IAED;;;;OAIG;IACH,kDAIC;IAED;;;;OAIG;IACH,oDAIC;IAYD;;;;OAIG;IACH,cAHW,MAAM,GAAC,cAAc,GACnB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,cAAc,GACnB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,cAAc,SACrB,OAAO,QAQjB;IAED;;;;OAIG;IACH,cAHW,MAAM,GAAC,cAAc,GACnB,OAAO,CAInB;IAED;;;;OAIG;IACH,qBAEC;IAED;;;;OAIG;IACH,eAHW,OAAO,OACP,OAAO,QAqBjB;IAED,0BAwBC;IAED;;;;;;;;;;;;;;;;;MAMC;IAED;;;;;OAKG;IACH,YAFW,SAAS,QAenB;IAED;;;OAGG;IACH,SAFa,SAAS,CAQrB;IAED;;;;OAIG;IACH,cAHW,SAAS,GACP,OAAO,CAMnB;IAED;;;OAGG;IACH,QAFa,MAAM,CAKlB;IA4BD;;;;;;OAMG;IACH,gBAHW,SAAS,GACP,IAAI,CAIhB;IAED;;;;;OAKG;IACH,sBAJW,SAAS,KACT,SAAS,GACP,IAAI,CAWhB;IAED;;;;OAIG;IACH,mBAHW,OAAK,MAAM,EAAE,GAAC,YAAY,GACxB,IAAI,CAmBhB;IAED;;;;OAIG;IACH,kBAHW,MAAM,EAAE,GAAC,YAAY,GACnB,MAAM,EAAE,CAOpB;IAED;;;;;OAKG;IACH,qBAEC;IAED;;;OAGG;IACH,cAFa,OAAO,CAMnB;IAED,mBAEC;IA6BL;;;;;;;;OAQG;IACH,sBANU,OAAO,CAMc;IAE/B;;;OAGG;IACH,8BA5Ee,MAAM,EAAE,GAAC,YAAY,KACnB,MAAM,EAAE,CA2EI;IAE7B;;;OAGG;IACH,+BA1Ge,OAAK,MAAM,EAAE,GAAC,YAAY,KACxB,IAAI,CAyGU;;CA7B9B;;kBAIS,MAAM;;oBA1bI,+BAA+B;uBAD5B,kCAAkC;+BAE1B,qBAAqB"}
@@ -23,9 +23,7 @@ const FLAGS_DEFAULT = TransformFlags.AutomaticChangeDetection;
23
23
  /**
24
24
  * A Transform represents the position, rotation, and scale of an object in 3D space.
25
25
  * Think of it like the object's location, orientation, and size.
26
- * It has properties for position (like coordinates), rotation (how it's turned), and scale (how big it is).
27
- *
28
- * It also uses a "matrix" (a table of numbers) internally to efficiently store and calculate transformations, but you usually interact with the position, rotation, and scale directly.
26
+ * It has properties for {@link position} (like coordinates), {@link rotation} (how it's oriented), and {@link scale} (how big it is).
29
27
  *
30
28
  * @example
31
29
  * const t = new Transform();
@@ -57,8 +55,11 @@ export class Transform {
57
55
  scale = new Vector3(1, 1, 1);
58
56
 
59
57
  /**
60
- * transform matrix, position, rotation, and scale must match, but shear can be different
61
- * Note: this is managed by the Transform itself, do not modify the matrix directly. If you want to set it - use {@link fromMatrix} method instead
58
+ * Affine transform matrix, {@link position}, {@link rotation}, and {@link scale} must match, but shear can be different.
59
+ * Note: this is managed by the {@link Transform} itself unless {@link TransformFlags.AutomaticChangeDetection} is disabled; do not modify the matrix directly.
60
+ * Generally, if you want to modify it - use {@link fromMatrix} method instead.
61
+ *
62
+ * If you're not comfortable with matrices, just leave defaults on and stick to primary attributes i.e. {@link position}, {@link rotation}, and {@link scale}.
62
63
  * @readonly
63
64
  * @type {Float32Array}
64
65
  */
@@ -72,7 +73,9 @@ export class Transform {
72
73
  flags = FLAGS_DEFAULT;
73
74
 
74
75
  constructor() {
75
- // watch changes
76
+ // Watch changes.
77
+ // This creates a data dependency, which makes GC impossible if we keep references to position/rotation/scale
78
+ // Please clone those properties if you need to keep them past the expiry of the Transform
76
79
  this.subscribe(this.#handle_component_change, this);
77
80
  }
78
81
 
@@ -186,7 +189,9 @@ export class Transform {
186
189
  }
187
190
 
188
191
  /**
189
- * Update {@link matrix} attribute from current position/rotation/scale
192
+ * Update {@link matrix} attribute from current {@link position}/{@link rotation}/{@link scale}
193
+ *
194
+ * Useful for when {@link TransformFlags.AutomaticChangeDetection} is disabled.
190
195
  */
191
196
  updateMatrix() {
192
197
  compose_matrix4_array(this.matrix, this.position, this.rotation, this.scale);
@@ -206,7 +211,9 @@ export class Transform {
206
211
  const delta_z = target.z - position.z;
207
212
 
208
213
  if (delta_x === 0 && delta_y === 0 && delta_z === 0) {
209
- // target is at the same location as this transform, no valid rotation, keep whatever we have
214
+ // Target is at the same location as this transform, no valid rotation, keep whatever we have.
215
+ // Generally this is a programmer mistake, making any changes to the rotation would be undesirable.
216
+ // The most valid option is to keep the current state.
210
217
  return;
211
218
  }
212
219
 
@@ -11,7 +11,7 @@ const q = new Quaternion();
11
11
  * @param {Vector3} result
12
12
  */
13
13
  export function computeCameraFacingVector(yaw, pitch, roll, result) {
14
- q.__setFromEuler(pitch, yaw, roll, 'ZYX');
14
+ q.fromEulerAnglesZYX(pitch, yaw, roll);
15
15
  q.normalize();
16
16
 
17
17
  result.copy(Vector3.forward);
@@ -74,7 +74,7 @@ export function computeTopDownTransform(control, result) {
74
74
  const roll = control.roll;
75
75
 
76
76
  // compute rotation
77
- rotation.__setFromEuler(pitch, yaw, roll, 'ZYX');
77
+ rotation.fromEulerAnglesZYX(pitch, yaw, roll);
78
78
 
79
79
  // compute camera position
80
80
  v3_scratch.copy(Vector3.forward);
@@ -62,7 +62,7 @@ function make_grid(ecd, engine) {
62
62
  for (let j = 0; j < GRID_SIZE; j++) {
63
63
  const quaternion = new Quaternion();
64
64
 
65
- quaternion.__setFromEuler(0, random() * Math.PI, 0);
65
+ quaternion.fromEulerAnglesXYZ(0, random() * Math.PI, 0);
66
66
 
67
67
  const center = new Vector3(i * 8, 0, j * 8);
68
68
 
@@ -1083,7 +1083,7 @@ function makeKnot(engine, position, scale, rotation) {
1083
1083
  }
1084
1084
  });
1085
1085
 
1086
- transform.rotation.__setFromEuler(position[0], position[1], position[2]);
1086
+ transform.rotation.fromEulerAnglesXYZ(position[0], position[1], position[2]);
1087
1087
 
1088
1088
  transform.scale.multiplyScalar(scale);
1089
1089
 
@@ -1 +1 @@
1
- {"version":3,"file":"MarkerNodeTransformerYRotateByFilter.d.ts","sourceRoot":"","sources":["../../../../../src/generation/markers/transform/MarkerNodeTransformerYRotateByFilter.js"],"names":[],"mappings":"AAQA;IAqBI;;;;OAIG;IACH,yCAFW,MAAM,wCAahB;IAnCD;;;OAGG;IACH,mBAAc;IAEd;;;OAGG;IACH,QAFU,MAAM,CAEL;IAEX,uCAIC;IAqBD,qCAmBC;CACJ;sCAnEqC,4BAA4B"}
1
+ {"version":3,"file":"MarkerNodeTransformerYRotateByFilter.d.ts","sourceRoot":"","sources":["../../../../../src/generation/markers/transform/MarkerNodeTransformerYRotateByFilter.js"],"names":[],"mappings":"AAQA;IAqBI;;;;OAIG;IACH,yCAFW,MAAM,wCAahB;IAnCD;;;OAGG;IACH,mBAAc;IAEd;;;OAGG;IACH,QAFU,MAAM,CAEL;IAEX,uCAIC;IAqBD,qCAmBC;CACJ;sCA/DqC,4BAA4B"}
@@ -1,8 +1,8 @@
1
- import { MarkerNodeTransformer } from "./MarkerNodeTransformer.js";
2
1
  import { assert } from "../../../core/assert.js";
3
2
  import Vector3 from "../../../core/geom/Vector3.js";
4
- import { epsilonEquals } from "../../../core/math/epsilonEquals.js";
5
3
  import { EPSILON } from "../../../core/math/EPSILON.js";
4
+ import { epsilonEquals } from "../../../core/math/epsilonEquals.js";
5
+ import { MarkerNodeTransformer } from "./MarkerNodeTransformer.js";
6
6
 
7
7
  const v3_object = new Vector3();
8
8
 
@@ -61,7 +61,7 @@ export class MarkerNodeTransformerYRotateByFilter extends MarkerNodeTransformer
61
61
  const result = node.clone();
62
62
 
63
63
 
64
- result.transform.rotation.__setFromEuler(v3_object.x, finalAngle, v3_object.z, 'YXZ');
64
+ result.transform.rotation.fromEulerAnglesYXZ(v3_object.x, finalAngle, v3_object.z);
65
65
 
66
66
  return result;
67
67
  }
@@ -1 +1 @@
1
- {"version":3,"file":"MarkerNodeTransformerYRotateByFilterGradient.d.ts","sourceRoot":"","sources":["../../../../../src/generation/markers/transform/MarkerNodeTransformerYRotateByFilterGradient.js"],"names":[],"mappings":"AAWA;;;GAGG;AACH;IAoBI;;;;OAIG;IACH,yCAFW,MAAM,gDAahB;IAlCD;;;OAGG;IACH,mBAAc;IAEd;;;OAGG;IACH,QAFU,MAAM,CAEL;IAEX,uCAIC;IAoBD,qCA4BC;CACJ;sCAlFqC,4BAA4B"}
1
+ {"version":3,"file":"MarkerNodeTransformerYRotateByFilterGradient.d.ts","sourceRoot":"","sources":["../../../../../src/generation/markers/transform/MarkerNodeTransformerYRotateByFilterGradient.js"],"names":[],"mappings":"AAWA;;;GAGG;AACH;IAoBI;;;;OAIG;IACH,yCAFW,MAAM,gDAahB;IAlCD;;;OAGG;IACH,mBAAc;IAEd;;;OAGG;IACH,QAFU,MAAM,CAEL;IAEX,uCAIC;IAoBD,qCA2BC;CACJ;sCA5EqC,4BAA4B"}
@@ -1,9 +1,9 @@
1
- import { MarkerNodeTransformer } from "./MarkerNodeTransformer.js";
2
- import Vector3 from "../../../core/geom/Vector3.js";
3
1
  import { assert } from "../../../core/assert.js";
4
- import { computeCellFilterGradient } from "../../filtering/numeric/process/computeCellFilterGradient.js";
5
- import { epsilonEquals } from "../../../core/math/epsilonEquals.js";
2
+ import Vector3 from "../../../core/geom/Vector3.js";
6
3
  import { EPSILON } from "../../../core/math/EPSILON.js";
4
+ import { epsilonEquals } from "../../../core/math/epsilonEquals.js";
5
+ import { computeCellFilterGradient } from "../../filtering/numeric/process/computeCellFilterGradient.js";
6
+ import { MarkerNodeTransformer } from "./MarkerNodeTransformer.js";
7
7
 
8
8
  const v3_object = new Vector3();
9
9
 
@@ -75,8 +75,7 @@ export class MarkerNodeTransformerYRotateByFilterGradient extends MarkerNodeTran
75
75
 
76
76
  const result = node.clone();
77
77
 
78
-
79
- result.transform.rotation.__setFromEuler(v3_object.x, finalAngle, v3_object.z, 'YXZ');
78
+ result.transform.rotation.fromEulerAnglesYXZ(v3_object.x, finalAngle, v3_object.z);
80
79
 
81
80
  return result;
82
81
  }
@@ -1,5 +1,5 @@
1
- import Vector2 from "../core/geom/Vector2";
2
1
  import Signal from "../core/events/signal/Signal";
2
+ import Vector2 from "../core/geom/Vector2";
3
3
 
4
4
  export interface IViewSignals {
5
5
  readonly linked: Signal
@@ -7,8 +7,8 @@ export interface IViewSignals {
7
7
  }
8
8
 
9
9
  export default class View<T extends Element = HTMLElement> {
10
- size: Vector2
11
- position: Vector2
10
+ readonly size: Vector2
11
+ readonly position: Vector2
12
12
 
13
13
  el: T
14
14