Refactor mapping modes and improve UV mapping logic; update viewer axes and camera settings

This commit is contained in:
CNCKitchen
2026-03-17 09:05:56 +01:00
parent 59b689c9ef
commit 66ee4a2d7d
7 changed files with 179 additions and 116 deletions
+11 -1
View File
@@ -15,7 +15,7 @@ let previewMaterial = null;
let isExporting = false;
const settings = {
mappingMode: 5, // Triplanar default — covers all faces of any shape
mappingMode: 6, // Cubic default
scaleU: 1.0,
scaleV: 1.0,
amplitude: 0.5,
@@ -228,6 +228,16 @@ async function handleSTL(file) {
previewMaterial = null;
}
// Auto-select Brick preset (index 5) on first load
const brickIdx = PRESETS.findIndex(p => p.name === 'Brick');
if (brickIdx >= 0 && !activeMapEntry) {
activeMapEntry = PRESETS[brickIdx];
activeMapName.textContent = PRESETS[brickIdx].name;
const swatches = document.querySelectorAll('.preset-swatch');
swatches.forEach((s, i) => s.classList.toggle('active', i === brickIdx));
}
mappingSelect.value = String(settings.mappingMode);
// Show mesh with a default material until a map is selected
loadGeometry(geometry);
dropHint.classList.add('hidden');