3D viewer: theme-aware canvas/material colors and light overlays
This commit is contained in:
@@ -232,7 +232,8 @@
|
||||
var initSize = canvasSize();
|
||||
var renderer = new THREE.WebGLRenderer({ antialias: true });
|
||||
renderer.setSize(initSize.w, initSize.h);
|
||||
renderer.setClearColor(0x1d2021, 1);
|
||||
var isLight = document.documentElement.classList.contains("theme-light");
|
||||
renderer.setClearColor(isLight ? 0xe8ecd0 : 0x1b1b1b, 1);
|
||||
|
||||
var scene = new THREE.Scene();
|
||||
var camera = new THREE.PerspectiveCamera(45, initSize.w / initSize.h, 0.1, 1000000);
|
||||
@@ -308,7 +309,7 @@
|
||||
geo.setAttribute("position", new THREE.Float32BufferAttribute(e.data.positions, 3));
|
||||
if (e.data.indices) geo.setIndex(new THREE.BufferAttribute(e.data.indices, 1));
|
||||
fixWinding(geo);
|
||||
var mat = new THREE.MeshStandardMaterial({ color: 0xb8bb26, metalness: 0.2, roughness: 0.6, side: THREE.DoubleSide, flatShading: false });
|
||||
var mat = new THREE.MeshStandardMaterial({ color: isLight ? 0x5e81ac : 0x77838a, metalness: 0.2, roughness: 0.6, side: THREE.DoubleSide, flatShading: false });
|
||||
chunkGeometry(geo, group, mat);
|
||||
var tris = (e.data.indices && e.data.indices.length) ? e.data.indices.length / 3 : e.data.positions.length / 9;
|
||||
fit();
|
||||
@@ -330,7 +331,7 @@
|
||||
} else {
|
||||
var geo = new THREE.STLLoader().parse(data.buffer);
|
||||
geo.computeVertexNormals();
|
||||
var mat = new THREE.MeshStandardMaterial({ color: 0xb8bb26, metalness: 0.25, roughness: 0.55, flatShading: true });
|
||||
var mat = new THREE.MeshStandardMaterial({ color: isLight ? 0x5e81ac : 0x77838a, metalness: 0.25, roughness: 0.55, flatShading: true });
|
||||
group.add(new THREE.Mesh(geo, mat));
|
||||
fit();
|
||||
showCanvas();
|
||||
|
||||
@@ -923,6 +923,29 @@ html.theme-light #content code {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* ---------- 3D-Viewer: theme-bewusste Overlays ---------- */
|
||||
html.theme-light .model-viewer {
|
||||
background: #e8ecd0;
|
||||
}
|
||||
html.theme-light .model-viewer-status,
|
||||
html.theme-light .model-viewer-hint,
|
||||
html.theme-light .model-viewer-data {
|
||||
color: #1c2d28;
|
||||
}
|
||||
html.theme-light .model-viewer-data {
|
||||
background: rgba(223, 228, 196, 0.85);
|
||||
border-color: #c3c9a6;
|
||||
}
|
||||
html.theme-light .model-viewer-status.error {
|
||||
color: #b14752;
|
||||
}
|
||||
html.theme-light .model-viewer-progress {
|
||||
background: #c3c9a6;
|
||||
}
|
||||
html.theme-light .model-viewer-progress-fill {
|
||||
background: #5e81ac;
|
||||
}
|
||||
|
||||
/* ---------- Bildunterschriften (Harbor) ---------- */
|
||||
#content figcaption {
|
||||
font-size: 0.85em;
|
||||
|
||||
Reference in New Issue
Block a user