gpu: don't interpolate texture ids
Despite the textures for each vertex of a face always being identical, this is now causing issues on Nvidia cards since the projection matrix update.
This commit is contained in:
@@ -32,7 +32,8 @@ uniform vec4 fogColor;
|
||||
|
||||
in vec4 Color;
|
||||
centroid in float fHsl;
|
||||
in vec4 fUv;
|
||||
flat in int textureId;
|
||||
in vec2 fUv;
|
||||
in float fogAmount;
|
||||
|
||||
out vec4 FragColor;
|
||||
@@ -40,20 +41,17 @@ out vec4 FragColor;
|
||||
#include hsl_to_rgb.glsl
|
||||
|
||||
void main() {
|
||||
float n = fUv.x;
|
||||
|
||||
int hsl = int(fHsl);
|
||||
vec3 rgb = hslToRgb(hsl) * smoothBanding + Color.rgb * (1.f - smoothBanding);
|
||||
vec4 smoothColor = vec4(rgb, Color.a);
|
||||
|
||||
if (n > 0.0) {
|
||||
n -= 1.0;
|
||||
int textureIdx = int(n);
|
||||
if (textureId > 0) {
|
||||
int textureIdx = textureId - 1;
|
||||
|
||||
vec2 uv = fUv.yz;
|
||||
vec2 uv = fUv;
|
||||
vec2 animatedUv = uv + textureOffsets[textureIdx];
|
||||
|
||||
vec4 textureColor = texture(textures, vec3(animatedUv, n));
|
||||
vec4 textureColor = texture(textures, vec3(animatedUv, float(textureIdx)));
|
||||
vec4 textureColorBrightness = pow(textureColor, vec4(brightness, brightness, brightness, 1.0f));
|
||||
|
||||
smoothColor = textureColorBrightness * smoothColor;
|
||||
|
||||
@@ -55,7 +55,8 @@ uniform mat4 projectionMatrix;
|
||||
|
||||
out vec4 Color;
|
||||
centroid out float fHsl;
|
||||
out vec4 fUv;
|
||||
flat out int textureId;
|
||||
out vec2 fUv;
|
||||
out float fogAmount;
|
||||
|
||||
#include hsl_to_rgb.glsl
|
||||
@@ -76,7 +77,8 @@ void main()
|
||||
gl_Position = projectionMatrix * vec4(vertex, 1.f);
|
||||
Color = vec4(rgb, 1.f - a);
|
||||
fHsl = float(hsl);
|
||||
fUv = uv;
|
||||
textureId = int(uv.x);
|
||||
fUv = uv.yz;
|
||||
|
||||
int fogWest = max(FOG_SCENE_EDGE_MIN, cameraX - drawDistance);
|
||||
int fogEast = min(FOG_SCENE_EDGE_MAX, cameraX + drawDistance - TILE_SIZE);
|
||||
|
||||
Reference in New Issue
Block a user