From a94227f7338b1900ef9a9fafb5b12b20cd00173f Mon Sep 17 00:00:00 2001 From: INARI_DARKFOX <39549290+inaridarkfox4231@users.noreply.github.com> Date: Sun, 29 Oct 2023 22:17:34 +0900 Subject: [PATCH 1/3] fix column to row fix column() to row() --- src/webgl/p5.Camera.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/webgl/p5.Camera.js b/src/webgl/p5.Camera.js index 2a9d42eb18..3d20076e2d 100644 --- a/src/webgl/p5.Camera.js +++ b/src/webgl/p5.Camera.js @@ -1818,10 +1818,10 @@ p5.Camera = class Camera { const rotMat1 = cam1.cameraMatrix.createSubMatrix3x3(); // get front and up vector from local-coordinate-system. - const front0 = rotMat0.column(2); - const front1 = rotMat1.column(2); - const up0 = rotMat0.column(1); - const up1 = rotMat1.column(1); + const front0 = rotMat0.row(2); + const front1 = rotMat1.row(2); + const up0 = rotMat0.row(1); + const up1 = rotMat1.row(1); // prepare new vectors. const newFront = new p5.Vector(); From b7d8706e955dbf308a51406a03686640575bfd87 Mon Sep 17 00:00:00 2001 From: INARI_DARKFOX <39549290+inaridarkfox4231@users.noreply.github.com> Date: Sun, 29 Oct 2023 22:55:18 +0900 Subject: [PATCH 2/3] Preventing bugs from occurring due to changes in slerp() spec Add more unit tests to prevent bugs caused by changes to slerp(). --- test/unit/webgl/p5.Camera.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/unit/webgl/p5.Camera.js b/test/unit/webgl/p5.Camera.js index 1c8fb7214b..0704a64728 100644 --- a/test/unit/webgl/p5.Camera.js +++ b/test/unit/webgl/p5.Camera.js @@ -923,6 +923,21 @@ suite('p5.Camera', function() { expect(myCam.projMatrix.mat4[5]) .to.be.closeTo(p0_5 * Math.pow(p1_5 / p0_5, 0.3), 0.00001); }); + test('Preventing bugs from occurring by changes in slerp spec', function() { + myCam = myp5.createCamera(); + const cam0 = myp5.createCamera(); + const cam1 = myp5.createCamera(); + cam0.camera(100, 763, 1073, 100, 480, 380, 0, 1, 2); + cam1.camera(300, 400, 700, 0, 0, 0, 2, 3, 1); + myCam.slerp(cam0, cam1, 0.1); + const expectedSlerpedMatrix = new Float32Array([ + 0.9983342289924622, 0.04771510139107704, 0.03243450075387955, 0, + -0.056675542145967484, 0.9162729382514954, 0.39652466773986816, 0, + -0.010798640549182892, -0.3977023959159851, 0.9174509048461914, 0, + -66.60199737548828, -260.3179016113281, -1242.9371337890625, 1 + ]); + assert.deepEqual(myCam.cameraMatrix.mat4, expectedSlerpedMatrix); + }); }); suite('Helper Functions', function() { @@ -1072,4 +1087,4 @@ suite('p5.Camera', function() { assert.deepEqual(myp5.get(0, 0), [0, 0, 0, 0]); }); }); -}); \ No newline at end of file +}); From cf0c5f46c8484a1ffa2dbd408655b45702bc5f4e Mon Sep 17 00:00:00 2001 From: INARI_DARKFOX <39549290+inaridarkfox4231@users.noreply.github.com> Date: Mon, 30 Oct 2023 23:11:18 +0900 Subject: [PATCH 3/3] Remove unnecessary line breaks Remove unnecessary line breaks