@needle-tools/three 0.146.5 → 0.146.7

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/three.cjs CHANGED
@@ -16610,6 +16610,7 @@ class WebXRManager extends EventDispatcher {
16610
16610
  const top2 = topFov * far / far2 * near2;
16611
16611
  const bottom2 = bottomFov * far / far2 * near2;
16612
16612
  camera.projectionMatrix.makePerspective(left2, right2, top2, bottom2, near2, far2);
16613
+ camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert();
16613
16614
  }
16614
16615
  function updateCamera(camera, parent) {
16615
16616
  if (parent === null) {
@@ -16639,16 +16640,6 @@ class WebXRManager extends EventDispatcher {
16639
16640
  for (let i = 0; i < cameras.length; i++) {
16640
16641
  updateCamera(cameras[i], parent);
16641
16642
  }
16642
- cameraVR.matrixWorld.decompose(cameraVR.position, cameraVR.quaternion, cameraVR.scale);
16643
-
16644
- // update user camera and its children
16645
-
16646
- camera.matrix.copy(cameraVR.matrix);
16647
- camera.matrix.decompose(camera.position, camera.quaternion, camera.scale);
16648
- const children = camera.children;
16649
- for (let i = 0, l = children.length; i < l; i++) {
16650
- children[i].updateMatrixWorld(true);
16651
- }
16652
16643
 
16653
16644
  // update projection matrix for proper view frustum culling
16654
16645
 
@@ -16659,7 +16650,32 @@ class WebXRManager extends EventDispatcher {
16659
16650
 
16660
16651
  cameraVR.projectionMatrix.copy(cameraL.projectionMatrix);
16661
16652
  }
16653
+
16654
+ // update user camera and its children
16655
+
16656
+ updateUserCamera(camera, cameraVR, parent);
16662
16657
  };
16658
+ function updateUserCamera(camera, cameraVR, parent) {
16659
+ if (parent === null) {
16660
+ camera.matrix.copy(cameraVR.matrixWorld);
16661
+ } else {
16662
+ camera.matrix.copy(parent.matrixWorld);
16663
+ camera.matrix.invert();
16664
+ camera.matrix.multiply(cameraVR.matrixWorld);
16665
+ }
16666
+ camera.matrix.decompose(camera.position, camera.quaternion, camera.scale);
16667
+ camera.updateMatrixWorld(true);
16668
+ const children = camera.children;
16669
+ for (let i = 0, l = children.length; i < l; i++) {
16670
+ children[i].updateMatrixWorld(true);
16671
+ }
16672
+ camera.projectionMatrix.copy(cameraVR.projectionMatrix);
16673
+ camera.projectionMatrixInverse.copy(cameraVR.projectionMatrixInverse);
16674
+ if (camera.isPerspectiveCamera) {
16675
+ camera.fov = RAD2DEG * 2 * Math.atan(1 / camera.projectionMatrix.elements[5]);
16676
+ camera.zoom = 1;
16677
+ }
16678
+ }
16663
16679
  this.getCamera = function () {
16664
16680
  return cameraVR;
16665
16681
  };
@@ -16730,10 +16746,13 @@ class WebXRManager extends EventDispatcher {
16730
16746
  cameras[i] = camera;
16731
16747
  }
16732
16748
  camera.matrix.fromArray(view.transform.matrix);
16749
+ camera.matrix.decompose(camera.position, camera.quaternion, camera.scale);
16733
16750
  camera.projectionMatrix.fromArray(view.projectionMatrix);
16751
+ camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert();
16734
16752
  camera.viewport.set(viewport.x, viewport.y, viewport.width, viewport.height);
16735
16753
  if (i === 0) {
16736
16754
  cameraVR.matrix.copy(camera.matrix);
16755
+ cameraVR.matrix.decompose(cameraVR.position, cameraVR.quaternion, cameraVR.scale);
16737
16756
  }
16738
16757
  if (cameraVRNeedsUpdate === true) {
16739
16758
  cameraVR.cameras.push(camera);
@@ -32685,4 +32704,3 @@ exports.ZeroSlopeEnding = ZeroSlopeEnding;
32685
32704
  exports.ZeroStencilOp = ZeroStencilOp;
32686
32705
  exports._SRGBAFormat = _SRGBAFormat;
32687
32706
  exports.sRGBEncoding = sRGBEncoding;
32688
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGhyZWUuY2pzIiwic291cmNlcyI6W10sInNvdXJjZXNDb250ZW50IjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
package/build/three.js CHANGED
@@ -16612,6 +16612,7 @@
16612
16612
  const top2 = topFov * far / far2 * near2;
16613
16613
  const bottom2 = bottomFov * far / far2 * near2;
16614
16614
  camera.projectionMatrix.makePerspective(left2, right2, top2, bottom2, near2, far2);
16615
+ camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert();
16615
16616
  }
16616
16617
  function updateCamera(camera, parent) {
16617
16618
  if (parent === null) {
@@ -16641,16 +16642,6 @@
16641
16642
  for (let i = 0; i < cameras.length; i++) {
16642
16643
  updateCamera(cameras[i], parent);
16643
16644
  }
16644
- cameraVR.matrixWorld.decompose(cameraVR.position, cameraVR.quaternion, cameraVR.scale);
16645
-
16646
- // update user camera and its children
16647
-
16648
- camera.matrix.copy(cameraVR.matrix);
16649
- camera.matrix.decompose(camera.position, camera.quaternion, camera.scale);
16650
- const children = camera.children;
16651
- for (let i = 0, l = children.length; i < l; i++) {
16652
- children[i].updateMatrixWorld(true);
16653
- }
16654
16645
 
16655
16646
  // update projection matrix for proper view frustum culling
16656
16647
 
@@ -16661,7 +16652,32 @@
16661
16652
 
16662
16653
  cameraVR.projectionMatrix.copy(cameraL.projectionMatrix);
16663
16654
  }
16655
+
16656
+ // update user camera and its children
16657
+
16658
+ updateUserCamera(camera, cameraVR, parent);
16664
16659
  };
16660
+ function updateUserCamera(camera, cameraVR, parent) {
16661
+ if (parent === null) {
16662
+ camera.matrix.copy(cameraVR.matrixWorld);
16663
+ } else {
16664
+ camera.matrix.copy(parent.matrixWorld);
16665
+ camera.matrix.invert();
16666
+ camera.matrix.multiply(cameraVR.matrixWorld);
16667
+ }
16668
+ camera.matrix.decompose(camera.position, camera.quaternion, camera.scale);
16669
+ camera.updateMatrixWorld(true);
16670
+ const children = camera.children;
16671
+ for (let i = 0, l = children.length; i < l; i++) {
16672
+ children[i].updateMatrixWorld(true);
16673
+ }
16674
+ camera.projectionMatrix.copy(cameraVR.projectionMatrix);
16675
+ camera.projectionMatrixInverse.copy(cameraVR.projectionMatrixInverse);
16676
+ if (camera.isPerspectiveCamera) {
16677
+ camera.fov = RAD2DEG * 2 * Math.atan(1 / camera.projectionMatrix.elements[5]);
16678
+ camera.zoom = 1;
16679
+ }
16680
+ }
16665
16681
  this.getCamera = function () {
16666
16682
  return cameraVR;
16667
16683
  };
@@ -16732,10 +16748,13 @@
16732
16748
  cameras[i] = camera;
16733
16749
  }
16734
16750
  camera.matrix.fromArray(view.transform.matrix);
16751
+ camera.matrix.decompose(camera.position, camera.quaternion, camera.scale);
16735
16752
  camera.projectionMatrix.fromArray(view.projectionMatrix);
16753
+ camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert();
16736
16754
  camera.viewport.set(viewport.x, viewport.y, viewport.width, viewport.height);
16737
16755
  if (i === 0) {
16738
16756
  cameraVR.matrix.copy(camera.matrix);
16757
+ cameraVR.matrix.decompose(cameraVR.position, cameraVR.quaternion, cameraVR.scale);
16739
16758
  }
16740
16759
  if (cameraVRNeedsUpdate === true) {
16741
16760
  cameraVR.cameras.push(camera);
@@ -32691,4 +32710,3 @@
32691
32710
  Object.defineProperty(exports, '__esModule', { value: true });
32692
32711
 
32693
32712
  }));
32694
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGhyZWUuanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0=