Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Removed P5 Vector
  • Loading branch information
Forchapeatl authored Apr 6, 2025
commit b3b2b503f4ee7d9f9b166092c62c0f1e3d30b8f1
22 changes: 13 additions & 9 deletions src/webgl/p5.Camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -1620,23 +1620,27 @@ class Camera {

// Rotate the up vector to keep the correct camera orientation
/* eslint-disable max-len */
let up = new p5.Vector(
this.upX * rotation.mat4[0] + this.upY * rotation.mat4[4] + this.upZ * rotation.mat4[8],
this.upX * rotation.mat4[1] + this.upY * rotation.mat4[5] + this.upZ * rotation.mat4[9],
this.upX * rotation.mat4[2] + this.upY * rotation.mat4[6] + this.upZ * rotation.mat4[10]
);

const rotatedUpX = this.upX * rotation.mat4[0] + this.upY * rotation.mat4[4] + this.upZ * rotation.mat4[8],
const rotatedUpY = this.upX * rotation.mat4[1] + this.upY * rotation.mat4[5] + this.upZ * rotation.mat4[9],
const rotatedUpZ = this.upX * rotation.mat4[2] + this.upY * rotation.mat4[6] + this.upZ * rotation.mat4[10]
/* eslint-enable max-len */
up.normalize()

//Normalize the up vector
const normalizedUpX = rotatedUpX / upLength;
const normalizedUpY = rotatedUpY / upLength;
const normalizedUpZ = rotatedUpZ / upLength;

this.camera(
this.eyeX,
this.eyeY,
this.eyeZ,
rotatedCenter[0],
rotatedCenter[1],
rotatedCenter[2],
up.x,
up.y,
up.z
normalizedUpX,
normalizedUpY,
normalizedUpZ
);
}

Expand Down
Loading