@woosh/meep-engine 2.60.0 → 2.60.1

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
@@ -69554,6 +69554,84 @@ function computeSystemName(system) {
69554
69554
  return system.constructor.name;
69555
69555
  }
69556
69556
 
69557
+ /**
69558
+ *
69559
+ * @param {Vector3} out Result will be written here
69560
+ * @param {number} originX Ray origin
69561
+ * @param {number} originY Ray origin
69562
+ * @param {number} originZ Ray origin
69563
+ * @param {number} directionX Ray direction
69564
+ * @param {number} directionY Ray direction
69565
+ * @param {number} directionZ Ray direction
69566
+ * @param {number} normalX Plane normal
69567
+ * @param {number} normalY Plane normal
69568
+ * @param {number} normalZ Plane normal
69569
+ * @param {number} dist Plane distance
69570
+ * @returns {boolean} true if intersection is found, false otherwise
69571
+ */
69572
+ function plane3_compute_ray_intersection(
69573
+ out,
69574
+ originX, originY, originZ,
69575
+ directionX, directionY, directionZ,
69576
+ normalX, normalY, normalZ, dist
69577
+ ) {
69578
+ const denom = v3_dot(directionX, directionY, directionZ, normalX, normalY, normalZ);
69579
+
69580
+ const p = v3_dot(normalX, normalY, normalZ, originX, originY, originZ) + dist;
69581
+
69582
+ if (denom !== 0) {
69583
+
69584
+ const t = -p / denom;
69585
+
69586
+ if (t < 0) {
69587
+ return false;
69588
+ }
69589
+
69590
+ out.set(
69591
+ directionX * t + originX,
69592
+ directionY * t + originY,
69593
+ directionZ * t + originZ
69594
+ );
69595
+
69596
+ return true;
69597
+
69598
+ } else {
69599
+
69600
+ if (p === 0) {
69601
+
69602
+ out.set(originX, originY, originZ);
69603
+
69604
+ return true;
69605
+
69606
+ } else {
69607
+
69608
+ //no intersection
69609
+ return false;
69610
+
69611
+ }
69612
+
69613
+ }
69614
+ }
69615
+
69616
+ /**
69617
+ * Orthogonal distance of a point to a plane, the distance is positive when the point lies above the plane and negative when the point is below
69618
+ * @param {number} x
69619
+ * @param {number} y
69620
+ * @param {number} z
69621
+ * @param {number} normalX
69622
+ * @param {number} normalY
69623
+ * @param {number} normalZ
69624
+ * @param {number} planeConstant
69625
+ * @returns {number}
69626
+ */
69627
+ function v3_distance_above_plane(
69628
+ x, y, z,
69629
+ normalX, normalY, normalZ, planeConstant
69630
+ ) {
69631
+ // this is the same as v4_dot(v4(x,y,z,1.0), v4(plane.normal, plane.constant));
69632
+ return v3_dot(normalX, normalY, normalZ, x, y, z) + planeConstant;
69633
+ }
69634
+
69557
69635
  class ObservedBoolean extends Boolean {
69558
69636
  /**
69559
69637
  *
@@ -69794,21 +69872,6 @@ ObservedEnum.prototype.fromJSON = function (obj) {
69794
69872
  this.set(obj);
69795
69873
  };
69796
69874
 
69797
- //
69798
-
69799
- /**
69800
- *
69801
- * @param {Vector3} result
69802
- * @param {Vector3} input
69803
- * @param {number[]} projection_matrix_inverse inverse of projection matrix
69804
- * @param {number[]} world_matrix world transform
69805
- */
69806
- function unprojectPoint(result, input, projection_matrix_inverse, world_matrix) {
69807
- result.copy(input);
69808
- result.applyMatrix4(projection_matrix_inverse);
69809
- result.applyMatrix4(world_matrix);
69810
- }
69811
-
69812
69875
  const matrix4 = new Matrix4();
69813
69876
 
69814
69877
  /**
@@ -69852,25 +69915,6 @@ function invertQuaternionOrientation(output, input) {
69852
69915
  output.setFromRotationMatrix(m4_scratch);
69853
69916
  }
69854
69917
 
69855
- /**
69856
- * Orthogonal distance of a point to a plane, the distance is positive when the point lies above the plane and negative when the point is below
69857
- * @param {number} x
69858
- * @param {number} y
69859
- * @param {number} z
69860
- * @param {number} normalX
69861
- * @param {number} normalY
69862
- * @param {number} normalZ
69863
- * @param {number} planeConstant
69864
- * @returns {number}
69865
- */
69866
- function v3_distance_above_plane(
69867
- x, y, z,
69868
- normalX, normalY, normalZ, planeConstant
69869
- ) {
69870
- // this is the same as v4_dot(v4(x,y,z,1.0), v4(plane.normal, plane.constant));
69871
- return v3_dot(normalX, normalY, normalZ, x, y, z) + planeConstant;
69872
- }
69873
-
69874
69918
  /**
69875
69919
  *
69876
69920
  * @enum {String}
@@ -69881,63 +69925,19 @@ const ProjectionType = {
69881
69925
  Orthographic: "orthographic"
69882
69926
  };
69883
69927
 
69928
+ //
69929
+
69884
69930
  /**
69885
69931
  *
69886
- * @param {Vector3} out Result will be written here
69887
- * @param {number} originX Ray origin
69888
- * @param {number} originY Ray origin
69889
- * @param {number} originZ Ray origin
69890
- * @param {number} directionX Ray direction
69891
- * @param {number} directionY Ray direction
69892
- * @param {number} directionZ Ray direction
69893
- * @param {number} normalX Plane normal
69894
- * @param {number} normalY Plane normal
69895
- * @param {number} normalZ Plane normal
69896
- * @param {number} dist Plane distance
69897
- * @returns {boolean} true if intersection is found, false otherwise
69932
+ * @param {Vector3} result
69933
+ * @param {Vector3} input
69934
+ * @param {number[]} projection_matrix_inverse inverse of projection matrix
69935
+ * @param {number[]} world_matrix world transform
69898
69936
  */
69899
- function plane3_compute_ray_intersection(
69900
- out,
69901
- originX, originY, originZ,
69902
- directionX, directionY, directionZ,
69903
- normalX, normalY, normalZ, dist
69904
- ) {
69905
- const denom = v3_dot(directionX, directionY, directionZ, normalX, normalY, normalZ);
69906
-
69907
- const p = v3_dot(normalX, normalY, normalZ, originX, originY, originZ) + dist;
69908
-
69909
- if (denom !== 0) {
69910
-
69911
- const t = -p / denom;
69912
-
69913
- if (t < 0) {
69914
- return false;
69915
- }
69916
-
69917
- out.set(
69918
- directionX * t + originX,
69919
- directionY * t + originY,
69920
- directionZ * t + originZ
69921
- );
69922
-
69923
- return true;
69924
-
69925
- } else {
69926
-
69927
- if (p === 0) {
69928
-
69929
- out.set(originX, originY, originZ);
69930
-
69931
- return true;
69932
-
69933
- } else {
69934
-
69935
- //no intersection
69936
- return false;
69937
-
69938
- }
69939
-
69940
- }
69937
+ function unprojectPoint(result, input, projection_matrix_inverse, world_matrix) {
69938
+ result.copy(input);
69939
+ result.applyMatrix4(projection_matrix_inverse);
69940
+ result.applyMatrix4(world_matrix);
69941
69941
  }
69942
69942
 
69943
69943
  /**
@@ -69979,7 +69979,7 @@ class Camera {
69979
69979
  *
69980
69980
  * @type {ObservedBoolean}
69981
69981
  */
69982
- this.active = new ObservedBoolean(false);
69982
+ this.active = new ObservedBoolean(true);
69983
69983
 
69984
69984
  /**
69985
69985
  * Near clipping plane
@@ -77703,9 +77703,15 @@ function rewriteMaterial(shader) {
77703
77703
  `+shader.fragmentShader;
77704
77704
  }
77705
77705
 
77706
+ /**
77707
+ * @typedef {Object} CacheKey
77708
+ * @property {Material} color
77709
+ * @property {Material} depth
77710
+ */
77711
+
77706
77712
  /**
77707
77713
  * @readonly
77708
- * @type {Cache<Material, {color:Material, depth:Material}>}
77714
+ * @type {Cache<Material,CacheKey>}
77709
77715
  */
77710
77716
  const material_cache = new Cache({
77711
77717
  maxWeight: 1024,
@@ -77720,14 +77726,14 @@ class InstancedMeshGroup {
77720
77726
  constructor() {
77721
77727
  /**
77722
77728
  * Instanced geometry
77723
- * @type {THREE.InstancedBufferGeometry|null}
77729
+ * @type {InstancedBufferGeometry|null}
77724
77730
  * @private
77725
77731
  */
77726
77732
  this.__threeGeometry = null;
77727
77733
 
77728
77734
  /**
77729
77735
  * Geometry of a single instance
77730
- * @type {THREE.BufferGeometry|null}
77736
+ * @type {BufferGeometry|null}
77731
77737
  * @private
77732
77738
  */
77733
77739
  this.__threeInstanceGeometry = null;
@@ -77755,7 +77761,12 @@ class InstancedMeshGroup {
77755
77761
  */
77756
77762
  this.growConstant = 16;
77757
77763
 
77764
+ /**
77765
+ *
77766
+ * @type {number}
77767
+ */
77758
77768
  this.shrinkFactor = 0.5;
77769
+
77759
77770
  /**
77760
77771
  * Minimum capacity reduction for shrinkage to occur
77761
77772
  * @type {number}
@@ -77920,7 +77931,7 @@ class InstancedMeshGroup {
77920
77931
  /**
77921
77932
  *
77922
77933
  * @param {THREE.Material|THREE.ShaderMaterial} sourceMaterial
77923
- * @returns {{depth: Material, color: Material}}
77934
+ * @returns {CacheKey}
77924
77935
  */
77925
77936
  #buildMaterial(sourceMaterial) {
77926
77937
  //console.warn(`building material : {id:${sourceMaterial.id}, name: ${sourceMaterial.name}, type: ${sourceMaterial.type}`)