From de72dafd2de240dccd5709695993451b39296230 Mon Sep 17 00:00:00 2001 From: Luca Conte Date: Sat, 26 Apr 2025 01:21:45 +0200 Subject: [PATCH] auto enable invert z axis when not using virtual camera --- src/script.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/script.js b/src/script.js index 9345170..e059098 100644 --- a/src/script.js +++ b/src/script.js @@ -72,6 +72,13 @@ async function init() { }); document.getElementById("displayMatricesVirtually").addEventListener("input", (e) => { displayMatricesVirtually = e.target.checked; + if (!displayMatricesVirtually) { + document.getElementById("invertZAxis").checked = true; + document.getElementById("invertZAxis").disabled = true; + } else { + document.getElementById("invertZAxis").checked = invertZAxis; + document.getElementById("invertZAxis").disabled = false; + } }); document.getElementById("backfaceCulling").addEventListener("input", (e) => { if (e.target.checked) { @@ -479,7 +486,7 @@ async function draw() { let virtualProjectionMatrix = []; - mat4BuildPerspective(virtualProjectionMatrix, 90.0 / 180.0 * Math.PI, cv.width / cv.height, 1, 5); + mat4BuildPerspective(virtualProjectionMatrix, 90.0 / 180.0 * Math.PI, cv.width / cv.height, 0.9, 5); if (!invertZAxis) { let zAxisFlipMatrix = [];