完成主要交互、高性能组件、国际化和A型传感器数据包接收
This commit is contained in:
@@ -12,6 +12,7 @@ uniform int uCols;
|
||||
uniform float uPitch;
|
||||
uniform float uDotRadius;
|
||||
uniform int uRenderMode; // 0=realistic, 1=dataViz
|
||||
uniform bool uLightMode;
|
||||
|
||||
const float PI = 3.14159265359;
|
||||
|
||||
@@ -146,10 +147,31 @@ void main() {
|
||||
// ------------------------------------------------------------
|
||||
// Industrial engineering model: neutral matte gray panel (support layer only)
|
||||
// ------------------------------------------------------------
|
||||
vec3 topBase = vec3(0.30, 0.31, 0.32);
|
||||
vec3 sideBase = vec3(0.27, 0.28, 0.29);
|
||||
vec3 topBase, sideBase;
|
||||
vec3 edgeCol, rimCol;
|
||||
if (uLightMode) {
|
||||
topBase = vec3(0.30, 0.31, 0.32);
|
||||
sideBase = vec3(0.27, 0.28, 0.29);
|
||||
|
||||
edgeCol = vec3(0.020);
|
||||
rimCol = vec3(0.015);
|
||||
}
|
||||
else {
|
||||
topBase = vec3(0.78, 0.80, 0.84);
|
||||
sideBase = vec3(0.68, 0.70, 0.74);
|
||||
|
||||
edgeCol = vec3(0.010, 0.12, 0.16);
|
||||
rimCol = vec3(0.12, 0.14, 0.18);
|
||||
}
|
||||
|
||||
vec3 baseColor = mix(sideBase, topBase, isTop);
|
||||
|
||||
// dataViz: flat/unlit, no lighting modulation (keep pure baseColor)
|
||||
if (uRenderMode == 1) {
|
||||
FragColor = vec4(clamp(baseColor, 0.0, 1.0), 1.0);
|
||||
return;
|
||||
}
|
||||
|
||||
vec2 xz = vWorldPos.xz;
|
||||
float dotContact = 0.0;
|
||||
if (isTop > 0.5 && uDotRadius > 0.0) {
|
||||
@@ -158,9 +180,11 @@ void main() {
|
||||
dotContact = 1.0 - smoothstep(uDotRadius, uDotRadius + w, d);
|
||||
}
|
||||
|
||||
vec3 L = normalize(vec3(0.45, 1.00, 0.20));
|
||||
// "Front light": make the light come from the camera direction (like a headlight/flashlight).
|
||||
vec3 L = V;
|
||||
// L = normalize(vec3(0.0, 0.15, -1.0));
|
||||
float diff = saturate(dot(N, L));
|
||||
float lighting = 0.90 + 0.10 * diff;
|
||||
float lighting = uLightMode ? (0.90 + 0.10 * diff) : (0.95 + 0.12 * diff);
|
||||
|
||||
float hw = max(1e-6, uPanelW * 0.5);
|
||||
float hd = max(1e-6, uPanelD * 0.5);
|
||||
@@ -172,8 +196,8 @@ void main() {
|
||||
float ao = 1.0 - dotContact * 0.08;
|
||||
|
||||
vec3 col = baseColor * lighting * ao;
|
||||
col += edgeLine * vec3(0.020);
|
||||
col += rim * vec3(0.015);
|
||||
col += edgeLine * edgeCol;
|
||||
col += rim * rimCol;
|
||||
|
||||
// Slightly deepen the bottom face to read as thickness, but keep it subtle.
|
||||
float isBottom = step(0.75, -N.y);
|
||||
|
||||
Reference in New Issue
Block a user