update
This commit is contained in:
@@ -1,48 +1,48 @@
|
||||
#version 330 core
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
uniform vec2 uViewport;
|
||||
uniform float uMajorStep;
|
||||
uniform float uMinorStep;
|
||||
uniform bool uLightMode;
|
||||
|
||||
float gridLine(float stepPx) {
|
||||
vec2 coord = gl_FragCoord.xy;
|
||||
vec2 q = coord / max(stepPx, 1.0);
|
||||
vec2 fw = max(fwidth(q), vec2(1e-6));
|
||||
q = abs(fract(q - 0.5) - 0.5) / fw;
|
||||
float line = 1.0 - min(min(q.x, q.y), 1.0);
|
||||
|
||||
return line;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 viewport = max(uViewport, vec2(1.0));
|
||||
vec2 uv = gl_FragCoord.xy / viewport;
|
||||
|
||||
vec3 topCol, botCol;
|
||||
float majorStrength, minorStrength;
|
||||
|
||||
topCol = vec3(0.99, 0.99, 1.00);
|
||||
botCol = vec3(0.94, 0.95, 0.98);
|
||||
|
||||
vec3 minorCol = vec3(0.80, 0.82, 0.87);
|
||||
vec3 majorCol = vec3(0.70, 0.73, 0.80);
|
||||
|
||||
minorStrength = 0.28;
|
||||
majorStrength = 0.45;
|
||||
|
||||
vec3 col = mix(botCol, topCol, uv.y);
|
||||
float minor = gridLine(max(uMinorStep, 1.0));
|
||||
float major = gridLine(max(uMajorStep, 1.0));
|
||||
|
||||
col = mix(col, minorCol, minorStrength * minor);
|
||||
col = mix(col, majorCol, majorStrength * major);
|
||||
|
||||
vec2 p = uv * 2.0 - 1.0;
|
||||
float v = clamp(1.0 - dot(p, p) * 0.12 , 0.0, 1.0);
|
||||
col *= mix(1.0, v, 0.35);
|
||||
|
||||
FragColor = vec4(col, 1.0);
|
||||
}
|
||||
#version 330 core
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
uniform vec2 uViewport;
|
||||
uniform float uMajorStep;
|
||||
uniform float uMinorStep;
|
||||
uniform bool uLightMode;
|
||||
|
||||
float gridLine(float stepPx) {
|
||||
vec2 coord = gl_FragCoord.xy;
|
||||
vec2 q = coord / max(stepPx, 1.0);
|
||||
vec2 fw = max(fwidth(q), vec2(1e-6));
|
||||
q = abs(fract(q - 0.5) - 0.5) / fw;
|
||||
float line = 1.0 - min(min(q.x, q.y), 1.0);
|
||||
|
||||
return line;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 viewport = max(uViewport, vec2(1.0));
|
||||
vec2 uv = gl_FragCoord.xy / viewport;
|
||||
|
||||
vec3 topCol, botCol;
|
||||
float majorStrength, minorStrength;
|
||||
|
||||
topCol = vec3(0.99, 0.99, 1.00);
|
||||
botCol = vec3(0.94, 0.95, 0.98);
|
||||
|
||||
vec3 minorCol = vec3(0.80, 0.82, 0.87);
|
||||
vec3 majorCol = vec3(0.70, 0.73, 0.80);
|
||||
|
||||
minorStrength = 0.28;
|
||||
majorStrength = 0.45;
|
||||
|
||||
vec3 col = mix(botCol, topCol, uv.y);
|
||||
float minor = gridLine(max(uMinorStep, 1.0));
|
||||
float major = gridLine(max(uMajorStep, 1.0));
|
||||
|
||||
col = mix(col, minorCol, minorStrength * minor);
|
||||
col = mix(col, majorCol, majorStrength * major);
|
||||
|
||||
vec2 p = uv * 2.0 - 1.0;
|
||||
float v = clamp(1.0 - dot(p, p) * 0.12 , 0.0, 1.0);
|
||||
col *= mix(1.0, v, 0.35);
|
||||
|
||||
FragColor = vec4(col, 1.0);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#version 330 core
|
||||
|
||||
layout(location = 0) in vec2 aPos;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(aPos, 0.0, 1.0);
|
||||
}
|
||||
#version 330 core
|
||||
|
||||
layout(location = 0) in vec2 aPos;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(aPos, 0.0, 1.0);
|
||||
}
|
||||
|
||||
@@ -1,149 +1,149 @@
|
||||
#version 330 core
|
||||
in vec2 vUV;
|
||||
in vec3 vWorldPos;
|
||||
out vec4 FragColor;
|
||||
|
||||
uniform sampler2D uHeightTex;
|
||||
uniform float uMinV;
|
||||
uniform float uMaxV;
|
||||
uniform float uHeightScale;
|
||||
uniform vec2 uTexelSize;
|
||||
uniform vec2 uPlaneSize;
|
||||
uniform vec3 uCameraPos;
|
||||
uniform vec3 uLightDir;
|
||||
uniform vec3 uColorZero;
|
||||
uniform vec3 uColorLow;
|
||||
uniform vec3 uColorMid;
|
||||
uniform vec3 uColorHigh;
|
||||
|
||||
float saturate(float x) {
|
||||
return clamp(x, 0.0, 1.0);
|
||||
}
|
||||
|
||||
float value01(float v) {
|
||||
return saturate((v - uMinV) / max(uMaxV - uMinV, 1e-6));
|
||||
}
|
||||
|
||||
// float maxNeighborValue(vec2 uv) {
|
||||
// vec2 texSizeF = 1.0 / uTexelSize;
|
||||
// ivec2 texSizeI = ivec2(max(vec2(1.0), floor(texSizeF + 0.5)));
|
||||
// ivec2 maxCoord = texSizeI - ivec2(1);
|
||||
|
||||
// vec2 texelF = clamp(uv * texSizeF, vec2(0.0), vec2(maxCoord));
|
||||
// ivec2 base = ivec2(floor(texelF));
|
||||
// ivec2 base10 = min(base + ivec2(1, 0), maxCoord);
|
||||
// ivec2 base01 = min(base + ivec2(0, 1), maxCoord);
|
||||
// ivec2 base11 = min(base + ivec2(1, 1), maxCoord);
|
||||
|
||||
// float v00 = texelFetch(uHeightTex, base, 0).r;
|
||||
// float v10 = texelFetch(uHeightTex, base10, 0).r;
|
||||
// float v01 = texelFetch(uHeightTex, base01, 0).r;
|
||||
// float v11 = texelFetch(uHeightTex, base11, 0).r;
|
||||
|
||||
// return max(max(v00, v10), max(v01, v11));
|
||||
// }
|
||||
|
||||
float maxNeighborValue(vec2 uv) {
|
||||
vec2 texSizeF = 1.0 / uTexelSize;
|
||||
ivec2 texSizeI = ivec2(max(vec2(1.0), floor(texSizeF + 0.5)));
|
||||
ivec2 maxCoord = texSizeI - ivec2(1);
|
||||
|
||||
vec2 texelF = clamp(uv * texSizeF, vec2(0.0), vec2(maxCoord));
|
||||
ivec2 base = ivec2(floor(texelF));
|
||||
ivec2 base10 = min(base + ivec2(1, 0), maxCoord);
|
||||
ivec2 base01 = min(base + ivec2(0, 1), maxCoord);
|
||||
ivec2 base11 = min(base + ivec2(1, 1), maxCoord);
|
||||
|
||||
float v00 = texelFetch(uHeightTex, base, 0).r;
|
||||
float v10 = texelFetch(uHeightTex, base10, 0).r;
|
||||
float v01 = texelFetch(uHeightTex, base01, 0).r;
|
||||
float v11 = texelFetch(uHeightTex, base11, 0).r;
|
||||
|
||||
return max(max(v00, v10), max(v01, v11));
|
||||
}
|
||||
|
||||
ivec2 texSizeI(vec2 texelSize) {
|
||||
vec2 texSizeF = 1.0 / texelSize;
|
||||
ivec2 texSizeI = ivec2(max(vec2(1.0), floor(texSizeF + 0.5)));
|
||||
return texSizeI;
|
||||
}
|
||||
|
||||
ivec2 uvToTexel(vec2 uv, vec2 texelSize) {
|
||||
ivec2 sizeI = texSizeI(texelSize);
|
||||
ivec2 maxCoord = sizeI - ivec2(1);
|
||||
vec2 texelF = clamp(uv * vec2(maxCoord), vec2(0.0), vec2(maxCoord));
|
||||
return ivec2(floor(texelF));
|
||||
}
|
||||
|
||||
float maxNeighborValueK(vec2 uv, int radius) {
|
||||
radius = clamp(radius, 0, 4);
|
||||
ivec2 sizeI = texSizeI(uTexelSize);
|
||||
ivec2 maxCoord = sizeI - ivec2(1);
|
||||
ivec2 p = uvToTexel(uv, uTexelSize);
|
||||
|
||||
float vmax = -1e30;
|
||||
|
||||
for (int i = -4; i <= 4; ++i) {
|
||||
for (int j = -4; j <= 4; ++j) {
|
||||
if (abs(i) > radius || abs(j) > radius) continue;
|
||||
ivec2 c = clamp(p + ivec2(i, j), ivec2(0), maxCoord);
|
||||
float v = texelFetch(uHeightTex, c, 0).r;
|
||||
vmax = max(vmax, v);
|
||||
}
|
||||
}
|
||||
|
||||
return vmax;
|
||||
}
|
||||
|
||||
vec3 colorRamp(float t) {
|
||||
if (t < 0.5) {
|
||||
return mix(uColorLow, uColorMid, t / 0.5);
|
||||
}
|
||||
return mix(uColorMid, uColorHigh, (t - 0.5) / 0.5);
|
||||
}
|
||||
|
||||
vec3 colorRampWithZero(float t) {
|
||||
const float zeroW = 0.005;
|
||||
float blend = smoothstep(0.0, zeroW, t);
|
||||
float tRamp = saturate((t - zeroW) / max(1.0 - zeroW, 1e-6));
|
||||
vec3 ramp = colorRamp(tRamp);
|
||||
return mix(uColorZero, ramp, blend);
|
||||
}
|
||||
|
||||
void main() {
|
||||
float vC = texture(uHeightTex, vUV).r;
|
||||
bool isZero = abs(vC) <= 1e-6;
|
||||
float t = value01(vC);
|
||||
float m = maxNeighborValue(vUV);
|
||||
float eps = max(1e-4, 0.001 * (uMaxV - uMinV));
|
||||
float force = smoothstep(uMaxV - eps, uMaxV, m);
|
||||
t = max(t, force);
|
||||
vec3 base = isZero ? uColorZero : colorRampWithZero(t);
|
||||
|
||||
float vL = texture(uHeightTex, vUV - vec2(uTexelSize.x, 0.0)).r;
|
||||
float vR = texture(uHeightTex, vUV + vec2(uTexelSize.x, 0.0)).r;
|
||||
float vD = texture(uHeightTex, vUV - vec2(0.0, uTexelSize.y)).r;
|
||||
float vU = texture(uHeightTex, vUV + vec2(0.0, uTexelSize.y)).r;
|
||||
|
||||
float hL = value01(vL) * uHeightScale;
|
||||
float hR = value01(vR) * uHeightScale;
|
||||
float hD = value01(vD) * uHeightScale;
|
||||
float hU = value01(vU) * uHeightScale;
|
||||
|
||||
float dx = max(1e-6, uPlaneSize.x * uTexelSize.x);
|
||||
float dy = max(1e-6, uPlaneSize.y * uTexelSize.y);
|
||||
float dHx = (hR - hL) / (2.0 * dx);
|
||||
float dHy = (hU - hD) / (2.0 * dy);
|
||||
|
||||
vec3 N = normalize(vec3(-dHx, -dHy, -1.0));
|
||||
vec3 L = normalize(uLightDir);
|
||||
vec3 V = normalize(uCameraPos - vWorldPos);
|
||||
vec3 H = normalize(L + V);
|
||||
|
||||
float diff = saturate(dot(N, L));
|
||||
float spec = pow(saturate(dot(N, H)), 24.0);
|
||||
|
||||
vec3 col = base * (0.50 + 0.50 * diff);
|
||||
col += vec3(1.0) * spec * 0.18;
|
||||
FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);
|
||||
#version 330 core
|
||||
in vec2 vUV;
|
||||
in vec3 vWorldPos;
|
||||
out vec4 FragColor;
|
||||
|
||||
uniform sampler2D uHeightTex;
|
||||
uniform float uMinV;
|
||||
uniform float uMaxV;
|
||||
uniform float uHeightScale;
|
||||
uniform vec2 uTexelSize;
|
||||
uniform vec2 uPlaneSize;
|
||||
uniform vec3 uCameraPos;
|
||||
uniform vec3 uLightDir;
|
||||
uniform vec3 uColorZero;
|
||||
uniform vec3 uColorLow;
|
||||
uniform vec3 uColorMid;
|
||||
uniform vec3 uColorHigh;
|
||||
|
||||
float saturate(float x) {
|
||||
return clamp(x, 0.0, 1.0);
|
||||
}
|
||||
|
||||
float value01(float v) {
|
||||
return saturate((v - uMinV) / max(uMaxV - uMinV, 1e-6));
|
||||
}
|
||||
|
||||
// float maxNeighborValue(vec2 uv) {
|
||||
// vec2 texSizeF = 1.0 / uTexelSize;
|
||||
// ivec2 texSizeI = ivec2(max(vec2(1.0), floor(texSizeF + 0.5)));
|
||||
// ivec2 maxCoord = texSizeI - ivec2(1);
|
||||
|
||||
// vec2 texelF = clamp(uv * texSizeF, vec2(0.0), vec2(maxCoord));
|
||||
// ivec2 base = ivec2(floor(texelF));
|
||||
// ivec2 base10 = min(base + ivec2(1, 0), maxCoord);
|
||||
// ivec2 base01 = min(base + ivec2(0, 1), maxCoord);
|
||||
// ivec2 base11 = min(base + ivec2(1, 1), maxCoord);
|
||||
|
||||
// float v00 = texelFetch(uHeightTex, base, 0).r;
|
||||
// float v10 = texelFetch(uHeightTex, base10, 0).r;
|
||||
// float v01 = texelFetch(uHeightTex, base01, 0).r;
|
||||
// float v11 = texelFetch(uHeightTex, base11, 0).r;
|
||||
|
||||
// return max(max(v00, v10), max(v01, v11));
|
||||
// }
|
||||
|
||||
float maxNeighborValue(vec2 uv) {
|
||||
vec2 texSizeF = 1.0 / uTexelSize;
|
||||
ivec2 texSizeI = ivec2(max(vec2(1.0), floor(texSizeF + 0.5)));
|
||||
ivec2 maxCoord = texSizeI - ivec2(1);
|
||||
|
||||
vec2 texelF = clamp(uv * texSizeF, vec2(0.0), vec2(maxCoord));
|
||||
ivec2 base = ivec2(floor(texelF));
|
||||
ivec2 base10 = min(base + ivec2(1, 0), maxCoord);
|
||||
ivec2 base01 = min(base + ivec2(0, 1), maxCoord);
|
||||
ivec2 base11 = min(base + ivec2(1, 1), maxCoord);
|
||||
|
||||
float v00 = texelFetch(uHeightTex, base, 0).r;
|
||||
float v10 = texelFetch(uHeightTex, base10, 0).r;
|
||||
float v01 = texelFetch(uHeightTex, base01, 0).r;
|
||||
float v11 = texelFetch(uHeightTex, base11, 0).r;
|
||||
|
||||
return max(max(v00, v10), max(v01, v11));
|
||||
}
|
||||
|
||||
ivec2 texSizeI(vec2 texelSize) {
|
||||
vec2 texSizeF = 1.0 / texelSize;
|
||||
ivec2 texSizeI = ivec2(max(vec2(1.0), floor(texSizeF + 0.5)));
|
||||
return texSizeI;
|
||||
}
|
||||
|
||||
ivec2 uvToTexel(vec2 uv, vec2 texelSize) {
|
||||
ivec2 sizeI = texSizeI(texelSize);
|
||||
ivec2 maxCoord = sizeI - ivec2(1);
|
||||
vec2 texelF = clamp(uv * vec2(maxCoord), vec2(0.0), vec2(maxCoord));
|
||||
return ivec2(floor(texelF));
|
||||
}
|
||||
|
||||
float maxNeighborValueK(vec2 uv, int radius) {
|
||||
radius = clamp(radius, 0, 4);
|
||||
ivec2 sizeI = texSizeI(uTexelSize);
|
||||
ivec2 maxCoord = sizeI - ivec2(1);
|
||||
ivec2 p = uvToTexel(uv, uTexelSize);
|
||||
|
||||
float vmax = -1e30;
|
||||
|
||||
for (int i = -4; i <= 4; ++i) {
|
||||
for (int j = -4; j <= 4; ++j) {
|
||||
if (abs(i) > radius || abs(j) > radius) continue;
|
||||
ivec2 c = clamp(p + ivec2(i, j), ivec2(0), maxCoord);
|
||||
float v = texelFetch(uHeightTex, c, 0).r;
|
||||
vmax = max(vmax, v);
|
||||
}
|
||||
}
|
||||
|
||||
return vmax;
|
||||
}
|
||||
|
||||
vec3 colorRamp(float t) {
|
||||
if (t < 0.5) {
|
||||
return mix(uColorLow, uColorMid, t / 0.5);
|
||||
}
|
||||
return mix(uColorMid, uColorHigh, (t - 0.5) / 0.5);
|
||||
}
|
||||
|
||||
vec3 colorRampWithZero(float t) {
|
||||
const float zeroW = 0.005;
|
||||
float blend = smoothstep(0.0, zeroW, t);
|
||||
float tRamp = saturate((t - zeroW) / max(1.0 - zeroW, 1e-6));
|
||||
vec3 ramp = colorRamp(tRamp);
|
||||
return mix(uColorZero, ramp, blend);
|
||||
}
|
||||
|
||||
void main() {
|
||||
float vC = texture(uHeightTex, vUV).r;
|
||||
bool isZero = abs(vC) <= 1e-6;
|
||||
float t = value01(vC);
|
||||
float m = maxNeighborValue(vUV);
|
||||
float eps = max(1e-4, 0.001 * (uMaxV - uMinV));
|
||||
float force = smoothstep(uMaxV - eps, uMaxV, m);
|
||||
t = max(t, force);
|
||||
vec3 base = isZero ? uColorZero : colorRampWithZero(t);
|
||||
|
||||
float vL = texture(uHeightTex, vUV - vec2(uTexelSize.x, 0.0)).r;
|
||||
float vR = texture(uHeightTex, vUV + vec2(uTexelSize.x, 0.0)).r;
|
||||
float vD = texture(uHeightTex, vUV - vec2(0.0, uTexelSize.y)).r;
|
||||
float vU = texture(uHeightTex, vUV + vec2(0.0, uTexelSize.y)).r;
|
||||
|
||||
float hL = value01(vL) * uHeightScale;
|
||||
float hR = value01(vR) * uHeightScale;
|
||||
float hD = value01(vD) * uHeightScale;
|
||||
float hU = value01(vU) * uHeightScale;
|
||||
|
||||
float dx = max(1e-6, uPlaneSize.x * uTexelSize.x);
|
||||
float dy = max(1e-6, uPlaneSize.y * uTexelSize.y);
|
||||
float dHx = (hR - hL) / (2.0 * dx);
|
||||
float dHy = (hU - hD) / (2.0 * dy);
|
||||
|
||||
vec3 N = normalize(vec3(-dHx, -dHy, -1.0));
|
||||
vec3 L = normalize(uLightDir);
|
||||
vec3 V = normalize(uCameraPos - vWorldPos);
|
||||
vec3 H = normalize(L + V);
|
||||
|
||||
float diff = saturate(dot(N, L));
|
||||
float spec = pow(saturate(dot(N, H)), 24.0);
|
||||
|
||||
vec3 col = base * (0.50 + 0.50 * diff);
|
||||
col += vec3(1.0) * spec * 0.18;
|
||||
FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);
|
||||
}
|
||||
@@ -1,28 +1,28 @@
|
||||
#version 330 core
|
||||
layout(location = 0) in vec3 aPos;
|
||||
layout(location = 1) in vec2 aUV;
|
||||
|
||||
out vec2 vUV;
|
||||
out vec3 vWorldPos;
|
||||
|
||||
uniform mat4 model;
|
||||
uniform mat4 view;
|
||||
uniform mat4 projection;
|
||||
uniform sampler2D uHeightTex;
|
||||
uniform float uMinV;
|
||||
uniform float uMaxV;
|
||||
uniform float uHeightScale;
|
||||
uniform float uBaseZ;
|
||||
|
||||
float value01(float v) {
|
||||
return clamp((v - uMinV) / max(uMaxV - uMinV, 1e-6), 0.0, 1.0);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vUV = aUV;
|
||||
float v = texture(uHeightTex, aUV).r;
|
||||
float h = value01(v) * uHeightScale;
|
||||
vec3 world = aPos + vec3(0.0, 0.0, uBaseZ + h);
|
||||
vWorldPos = world;
|
||||
gl_Position = projection * view * model * vec4(world, 1.0);
|
||||
#version 330 core
|
||||
layout(location = 0) in vec3 aPos;
|
||||
layout(location = 1) in vec2 aUV;
|
||||
|
||||
out vec2 vUV;
|
||||
out vec3 vWorldPos;
|
||||
|
||||
uniform mat4 model;
|
||||
uniform mat4 view;
|
||||
uniform mat4 projection;
|
||||
uniform sampler2D uHeightTex;
|
||||
uniform float uMinV;
|
||||
uniform float uMaxV;
|
||||
uniform float uHeightScale;
|
||||
uniform float uBaseZ;
|
||||
|
||||
float value01(float v) {
|
||||
return clamp((v - uMinV) / max(uMaxV - uMinV, 1e-6), 0.0, 1.0);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vUV = aUV;
|
||||
float v = texture(uHeightTex, aUV).r;
|
||||
float h = value01(v) * uHeightScale;
|
||||
vec3 world = aPos + vec3(0.0, 0.0, uBaseZ + h);
|
||||
vWorldPos = world;
|
||||
gl_Position = projection * view * model * vec4(world, 1.0);
|
||||
}
|
||||
@@ -1,29 +1,29 @@
|
||||
#version 330 core
|
||||
|
||||
in vec3 vWorldPos;
|
||||
in vec3 vWorldNormal;
|
||||
|
||||
out vec4 FragColor;
|
||||
uniform bool uLightMode;
|
||||
|
||||
void main() {
|
||||
vec3 N = normalize(vWorldNormal);
|
||||
float isTop = step(0.75, N.y);
|
||||
|
||||
vec3 topBase;
|
||||
vec3 sideBase;
|
||||
|
||||
if (uLightMode) {
|
||||
// 浅色主题 偏亮的工业灰
|
||||
topBase = vec3(0.78, 0.80, 0.84);
|
||||
sideBase = vec3(0.68, 0.70, 0.74);
|
||||
}
|
||||
else {
|
||||
// 深色主题 偏暗的工业灰
|
||||
topBase = vec3(0.30, 0.31, 0.32);
|
||||
sideBase = vec3(0.27, 0.28, 0.29);
|
||||
}
|
||||
|
||||
vec3 baseColor = mix(sideBase, topBase, isTop);
|
||||
FragColor = vec4(clamp(baseColor, 0.0, 1.0), 1.0);
|
||||
#version 330 core
|
||||
|
||||
in vec3 vWorldPos;
|
||||
in vec3 vWorldNormal;
|
||||
|
||||
out vec4 FragColor;
|
||||
uniform bool uLightMode;
|
||||
|
||||
void main() {
|
||||
vec3 N = normalize(vWorldNormal);
|
||||
float isTop = step(0.75, N.y);
|
||||
|
||||
vec3 topBase;
|
||||
vec3 sideBase;
|
||||
|
||||
if (uLightMode) {
|
||||
// 浅色主题 偏亮的工业灰
|
||||
topBase = vec3(0.78, 0.80, 0.84);
|
||||
sideBase = vec3(0.68, 0.70, 0.74);
|
||||
}
|
||||
else {
|
||||
// 深色主题 偏暗的工业灰
|
||||
topBase = vec3(0.30, 0.31, 0.32);
|
||||
sideBase = vec3(0.27, 0.28, 0.29);
|
||||
}
|
||||
|
||||
vec3 baseColor = mix(sideBase, topBase, isTop);
|
||||
FragColor = vec4(clamp(baseColor, 0.0, 1.0), 1.0);
|
||||
}
|
||||
@@ -1,19 +1,19 @@
|
||||
#version 330 core
|
||||
|
||||
layout(location = 0) in vec3 aPos;
|
||||
layout(location = 1) in vec3 aN;
|
||||
|
||||
uniform mat4 model;
|
||||
uniform mat4 view;
|
||||
uniform mat4 projection;
|
||||
|
||||
out vec3 vWorldPos;
|
||||
out vec3 vWorldNormal;
|
||||
|
||||
void main() {
|
||||
vec4 worldPos = model * vec4(aPos, 1.0);
|
||||
mat3 normalMat = transpose(inverse(mat3(model)));
|
||||
vWorldPos = worldPos.xyz;
|
||||
vWorldNormal = normalize(normalMat * aN);
|
||||
gl_Position = projection * view * worldPos;
|
||||
}
|
||||
#version 330 core
|
||||
|
||||
layout(location = 0) in vec3 aPos;
|
||||
layout(location = 1) in vec3 aN;
|
||||
|
||||
uniform mat4 model;
|
||||
uniform mat4 view;
|
||||
uniform mat4 projection;
|
||||
|
||||
out vec3 vWorldPos;
|
||||
out vec3 vWorldNormal;
|
||||
|
||||
void main() {
|
||||
vec4 worldPos = model * vec4(aPos, 1.0);
|
||||
mat3 normalMat = transpose(inverse(mat3(model)));
|
||||
vWorldPos = worldPos.xyz;
|
||||
vWorldNormal = normalize(normalMat * aN);
|
||||
gl_Position = projection * view * worldPos;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user