Removed interpolation variables

This commit is contained in:
Dennis Allerkamp 2025-05-09 12:51:53 +02:00
parent 1d05e0053a
commit ecf7e2074b
1 changed files with 4 additions and 12 deletions

View File

@ -25,9 +25,7 @@ let cameraVertexBuffer;
let lastFrame = Date.now();
let interpolateProjection = 0;
let interpolateLookAt = 0;
let t = 0.0;
let interpolate = [0, 0, 0, 0, 0, 0];
let displayMatricesVirtually = true;
@ -67,20 +65,14 @@ async function init() {
// input handling
document.getElementById("interpolate").addEventListener("input", (e) => {
let t = 6.0 - e.target.value;
t = 6.0 - e.target.value;
if (t <= 2.0) {
interpolateLookAt = t / 2.0;
interpolateProjection = 0.0;
invertZAxis = false;
}
else if (t <= 5.0) {
interpolateLookAt = 1.0;
interpolateProjection = (t - 2.0) / 3.0;
invertZAxis = false;
}
else {
interpolateLookAt = 1.0;
interpolateProjection = 1.0;
invertZAxis = true;
}
for (let i = 0; i < 6; ++i) {
@ -634,7 +626,7 @@ async function draw() {
gl.bindBuffer(gl.ARRAY_BUFFER, cameraVertexBuffer);
setAttribPointers();
if (displayMatricesVirtually && interpolateProjection <= 0) {
if (displayMatricesVirtually && t <= 2.0) {
gl.drawArrays(gl.TRIANGLES, 0, cameraVertices.length / 6);
}
@ -663,7 +655,7 @@ async function draw() {
// draw origin cube
if (interpolateProjection < 1 && interpolateLookAt > 0) {
if (t != 0.0 && t < 5.0) {
gl.bindBuffer(gl.ARRAY_BUFFER, lineCubeVertexBuffer);
setAttribPointers();
gl.uniform3fv(colorOverrideLocation, [1, 0, 0]);