From ac598757f0b524ef7887e057933ab76ab14d354a Mon Sep 17 00:00:00 2001 From: CNCKitchen Date: Wed, 18 Mar 2026 12:21:53 +0100 Subject: [PATCH] feat: update theme toggle button text and adjust UV mapping threshold for improved rendering --- index.html | 4 ++-- js/mapping.js | 2 +- js/previewMaterial.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 4099790..3070529 100644 --- a/index.html +++ b/index.html @@ -32,8 +32,8 @@ CNC Kitchen STL Texturizer diff --git a/js/mapping.js b/js/mapping.js index de5b193..f618c7a 100644 --- a/js/mapping.js +++ b/js/mapping.js @@ -65,7 +65,7 @@ export function computeUV(pos, normal, mode, settings, bounds) { const C = TWO_PI * Math.max(r, 1e-6); const rx = pos.x - center.x; const ry = pos.y - center.y; - if (Math.abs(normal.z) > 0.5) { + if (Math.abs(normal.z) > 0.7) { // Cap face — normalise by C so one tile = same world size as on the side u = rx / C + 0.5; v = ry / C + 0.5; diff --git a/js/previewMaterial.js b/js/previewMaterial.js index 660afdd..58202e8 100644 --- a/js/previewMaterial.js +++ b/js/previewMaterial.js @@ -97,7 +97,7 @@ const fragmentShader = /* glsl */` // fills the diameter × diameter square so the disc looks fully textured. float r = max(boundsSize.x, boundsSize.y) * 0.5; float C = TWO_PI * max(r, 1e-4); - if (abs(vModelNormal.z) > 0.5) { + if (abs(vModelNormal.z) > 0.7) { // Cap face — normalise by C so one tile = same world size as on the side return sampleMap(vec2( rel.x / C + 0.5,