Skip to content

Commit

Permalink
refactor(Immersive): replace Matrix4.makeBasisFromMatrix by Matrix4.s…
Browse files Browse the repository at this point in the history
…etFromMatrix3.
  • Loading branch information
gchoqueux committed Feb 5, 2021
1 parent 6ff3b3d commit d442602
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/Parser/CameraCalibrationParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,9 @@ import OrientedImageCamera from 'Renderer/OrientedImageCamera';
* @module CameraCalibrationParser
*/

const xAxis = new THREE.Vector3();
const yAxis = new THREE.Vector3();
const zAxis = new THREE.Vector3();
const textureLoader = new THREE.TextureLoader();
const matrix3 = new THREE.Matrix3();

THREE.Matrix4.prototype.makeBasisFromMatrix = function makeBasisFromMatrix(m) {
m.extractBasis(xAxis, yAxis, zAxis);
return this.makeBasis(xAxis, yAxis, zAxis);
};

// the json format encodes the following transformation:
// extrinsics: p_local = rotation * (p_world - position)
// intrinsics: p_pixel = projection * p_local
Expand All @@ -41,7 +33,7 @@ function parseCalibration(calibration, options = {}) {
camera.position.fromArray(calibration.position);
// calibration.rotation is row-major but fromArray expects a column-major array, yielding the transposed matrix
const rotationInverse = matrix3.fromArray(calibration.rotation);
camera.matrix.makeBasisFromMatrix(rotationInverse);
camera.matrix.setFromMatrix3(rotationInverse);
camera.quaternion.setFromRotationMatrix(camera.matrix);

// local axes for cameras is (X right, Y up, Z back) rather than (X right, Y down, Z front)
Expand Down

0 comments on commit d442602

Please # to comment.