feat: enhance language selection and boundary falloff features

- Added a language dropdown selector to replace the previous button-based language toggle.
- Integrated boundary falloff settings into the preview material, allowing for smoother transitions between masked and unmasked areas.
- Updated shaders to utilize boundary falloff attributes for improved visual fidelity in bump-only previews.
- Refactored related CSS styles for the new dropdown and adjusted layout for better usability.
- Introduced new functions for computing boundary attributes and managing edge data textures.
This commit is contained in:
CNCKitchen
2026-04-07 09:48:45 +02:00
parent 72f6e67127
commit 498581d8cf
6 changed files with 1709 additions and 318 deletions
+14 -19
View File
@@ -15,17 +15,6 @@
: window.matchMedia('(prefers-color-scheme: dark)').matches;
if (!prefersDark) document.documentElement.setAttribute('data-theme', 'light');
})();
// Apply saved language before first paint to avoid flash
(function() {
const l = localStorage.getItem('stlt-lang');
if (l === 'de' || l === 'en') {
document.documentElement.setAttribute('data-lang', l);
document.documentElement.setAttribute('lang', l);
} else if (navigator.language && navigator.language.toLowerCase().startsWith('de')) {
document.documentElement.setAttribute('data-lang', 'de');
document.documentElement.setAttribute('lang', 'de');
}
})();
</script>
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin>
<script type="importmap">
@@ -46,8 +35,6 @@
</div>
<div class="header-actions">
<div class="lang-seg">
<button class="lang-btn active" data-lang-code="en">EN</button>
<button class="lang-btn" data-lang-code="de">DE</button>
</div>
<button id="theme-toggle" class="theme-toggle"
data-i18n-title="theme.toggleTitle"
@@ -237,9 +224,19 @@
</div>
</section>
<!-- Mask Angles -->
<!-- Masking -->
<section class="panel-section">
<h2 data-i18n="sections.maskAngles" data-i18n-title="tooltips.maskAngles" title="0° = no masking. Surfaces within this angle of horizontal will not be textured.">Mask Angles ⓘ</h2>
<h2 data-i18n="sections.masking">Masking</h2>
<!-- Boundary Falloff (applies to both angle and surface masking) -->
<div class="form-row slider-row">
<label for="boundary-falloff" data-i18n="labels.boundaryFalloff" data-i18n-title="tooltips.boundaryFalloff" title="Gradually reduces displacement to zero near masked boundaries, preventing triangle overlap where textured and non-textured regions meet.">Smooth Mask ⓘ</label>
<input type="range" id="boundary-falloff" min="0" max="10" step="0.1" value="0" />
<input type="number" class="val" id="boundary-falloff-val" value="0" min="0" max="10" step="0.1" />
</div>
<!-- By Angle -->
<h3 class="panel-subsection-heading" data-i18n="sections.maskAngles" data-i18n-title="tooltips.maskAngles" title="0° = no masking. Surfaces within this angle of horizontal will not be textured.">By Angle ⓘ</h3>
<div class="form-row slider-row">
<label for="bottom-angle-limit" data-i18n="labels.bottomFaces" data-i18n-title="tooltips.bottomFaces" title="Suppress texture on downward-facing surfaces within this angle of horizontal">Bottom faces</label>
<input type="range" id="bottom-angle-limit" min="0" max="90" step="1" value="5" />
@@ -250,11 +247,9 @@
<input type="range" id="top-angle-limit" min="0" max="90" step="1" value="0" />
<input type="number" class="val" id="top-angle-limit-val" value="0" min="0" max="90" step="1" />
</div>
</section>
<!-- Surface Exclusions -->
<section class="panel-section">
<h2 id="excl-section-heading" data-i18n="sections.surfaceMasking" data-i18n-title="tooltips.surfaceMasking" title="Mask surfaces to control which areas receive displacement.">Surface Masking ⓘ</h2>
<!-- By Surface -->
<h3 class="panel-subsection-heading" id="excl-section-heading" data-i18n="sections.surfaceMasking" data-i18n-title="tooltips.surfaceMasking" title="Mask surfaces to control which areas receive displacement.">By Surface ⓘ</h3>
<p id="excl-hint" class="excl-hint" style="display:none"></p>
<!-- Mode toggle: Exclude / Include Only -->