From f277efc8b94452e52ff1dd7b3b24924914dac427 Mon Sep 17 00:00:00 2001 From: ByteDice Date: Fri, 17 Jan 2025 17:26:08 +0100 Subject: [PATCH] added more debug logs --- global/globalScript.js | 19 +++++++++++++++++-- synthwaveEffect.js | 9 ++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/global/globalScript.js b/global/globalScript.js index e6cbb29..114ef32 100644 --- a/global/globalScript.js +++ b/global/globalScript.js @@ -45,9 +45,24 @@ function lerp(x, y, t) { function debugPrint(title, value) { - console.log(`%c${title}:\n%c${value}`, CONSOLE_COLORS.debugTitle, CONSOLE_COLORS.white) -} + if (!title) { + console.error( +`error[A0000]: this function takes 1 argument but 0 arguments were supplied + --> unknown:0:0 + | +0 | debugPrint() + | ^^^^^^^^^^-- argument #1 of type \`Any\` is missing` +) + return; + } + if (value) { + console.log(`%c${title}:\n%c${value}`, CONSOLE_COLORS.debugTitle, CONSOLE_COLORS.white) + } + else { + console.log(`%c${title}`, CONSOLE_COLORS.debugTitle) + } +} function toggleGrid() { if (gridVisible) { diff --git a/synthwaveEffect.js b/synthwaveEffect.js index 2a3567b..1ac6f55 100644 --- a/synthwaveEffect.js +++ b/synthwaveEffect.js @@ -136,6 +136,12 @@ camera.rotation.x = 0.2 /* camera.position.y = 5 camera.lookAt(0, 0, 0) */ +debugPrint( + "Camera transform", + `Pos: [x: ${camera.position.x}, y: ${camera.position.y}, z: ${camera.position.z}] +Rot: [x: ${camera.rotation.x}, y: ${camera.rotation.y}, z: ${camera.rotation.z}]` +) + function hillCurve(x, width) { return (Math.sin(Math.PI * (x + 1)) + 1) ** width } @@ -314,6 +320,7 @@ function preAnimateSynthwave(times) { } hasPreAnimated = true + debugPrint("Pre-animated synthwave complete") } @@ -336,7 +343,7 @@ function animateSynthwave(timestamp) { return } - const moveDist = 0.05 * tickMultiplier + const moveDist = 0.0035 //0.05 * tickMultiplier distSinceLastHill += moveDist for (let hill of allHillMeshes) {