@woosh/meep-engine 2.92.22 → 2.92.23

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/meep.cjs CHANGED
@@ -4711,28 +4711,25 @@ const FLAGS_DEFAULT = TransformFlags.AutomaticChangeDetection;
4711
4711
  class Transform {
4712
4712
 
4713
4713
  /**
4714
- * World-space position
4715
4714
  * @type {Vector3}
4716
4715
  * @readonly
4717
4716
  */
4718
4717
  position = new Vector3$1(0, 0, 0);
4719
4718
 
4720
4719
  /**
4721
- * World-space rotation
4722
4720
  * @type {Quaternion}
4723
4721
  * @readonly
4724
4722
  */
4725
4723
  rotation = new Quaternion$1(0, 0, 0, 1);
4726
4724
 
4727
4725
  /**
4728
- * World-space scale
4729
4726
  * @type {Vector3}
4730
4727
  * @readonly
4731
4728
  */
4732
4729
  scale = new Vector3$1(1, 1, 1);
4733
4730
 
4734
4731
  /**
4735
- * World-space transform matrix, position, rotation and scale must match, but shear can be different
4732
+ * transform matrix, position, rotation and scale must match, but shear can be different
4736
4733
  * @readonly
4737
4734
  * @type {Float32Array}
4738
4735
  */
@@ -4740,22 +4737,18 @@ class Transform {
4740
4737
 
4741
4738
  /**
4742
4739
  * Various bit flags, see {@link TransformFlags}
4743
- * @protected
4740
+ * This should generally be accessed through getFlag/setFlag instead of modifying the value directly
4744
4741
  * @type {number}
4745
4742
  */
4746
4743
  flags = FLAGS_DEFAULT;
4747
4744
 
4748
- /**
4749
- *
4750
- * @constructor
4751
- */
4752
4745
  constructor() {
4753
4746
  // watch changes
4754
4747
  this.subscribe(this.#handle_component_change, this);
4755
4748
  }
4756
4749
 
4757
4750
  /**
4758
- * Current "forward" direction in world-space
4751
+ * Current "forward" direction
4759
4752
  * NOTE that this vector is not live, meaning that if you modify transform, previously-obtained result will no longer be valid
4760
4753
  * @returns {Vector3}
4761
4754
  */
@@ -4767,6 +4760,30 @@ class Transform {
4767
4760
  return result;
4768
4761
  }
4769
4762
 
4763
+ /**
4764
+ * Current "up" direction
4765
+ * @return {Vector3}
4766
+ */
4767
+ get up() {
4768
+ const result = Vector3$1.up.clone();
4769
+
4770
+ result.applyDirectionMatrix4(this.matrix);
4771
+
4772
+ return result;
4773
+ }
4774
+
4775
+ /**
4776
+ * Current "right" direction
4777
+ * @return {Vector3}
4778
+ */
4779
+ get right() {
4780
+ const result = Vector3$1.right.clone();
4781
+
4782
+ result.applyDirectionMatrix4(this.matrix);
4783
+
4784
+ return result;
4785
+ }
4786
+
4770
4787
  /**
4771
4788
  * Attach change listener
4772
4789
  * @param {function} handler
@@ -4982,6 +4999,7 @@ class Transform {
4982
4999
  * @param {mat4|number[]|Float32Array} m
4983
5000
  */
4984
5001
  fromMatrix4(m) {
5002
+ // we know we are changing the matrix, so we're going to need to disable the flag that sets matrix from position/rotation/scale changes
4985
5003
  const ad = this.getFlag(TransformFlags.AutomaticChangeDetection);
4986
5004
 
4987
5005
  this.clearFlag(TransformFlags.AutomaticChangeDetection);
@@ -4990,6 +5008,7 @@ class Transform {
4990
5008
 
4991
5009
  decompose_matrix_4_array(m, this.position, this.rotation, this.scale);
4992
5010
 
5011
+ // restore value of the flag
4993
5012
  this.writeFlag(TransformFlags.AutomaticChangeDetection, ad);
4994
5013
  }
4995
5014