From 950cc3ce167ef9825011a9a2d8e867ddfc28d8fe Mon Sep 17 00:00:00 2001 From: Dane Johnson Date: Fri, 22 Jan 2021 14:37:32 -0600 Subject: [PATCH] Remove perspective hack --- shaders/flat.frag | 4 ++-- shaders/flat.vert | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/shaders/flat.frag b/shaders/flat.frag index d9fc34b..8aed153 100644 --- a/shaders/flat.frag +++ b/shaders/flat.frag @@ -1,6 +1,6 @@ #version 330 core -in vec3 UV; +noperspective in vec2 UV; in vec3 NORMAL; flat in vec3 LIGHT; @@ -23,7 +23,7 @@ void main() { FragColor += vec4(material.color, 1.0); } if (material.usesTex) { - FragColor += texture(material.tex, UV.xy / UV.z); + FragColor += texture(material.tex, UV); } if (FragColor.w < material.alphaScissor) { discard; diff --git a/shaders/flat.vert b/shaders/flat.vert index 61792e1..8e1176f 100644 --- a/shaders/flat.vert +++ b/shaders/flat.vert @@ -8,7 +8,7 @@ uniform mat4 MODEL; uniform mat4 VIEW; uniform mat4 PROJECTION; -out vec3 UV; +noperspective out vec2 UV; // PSX use affine texture mapping out vec3 NORMAL; flat out vec3 LIGHT; @@ -25,7 +25,8 @@ uniform DirectionalLight directionalLight; void main() { vec4 vertex = PROJECTION * VIEW * MODEL * vec4(pos, 1.0); gl_Position = vertex; - UV = vec3(uv * vertex.z, vertex.z); + + UV = uv; NORMAL = (VIEW * MODEL * vec4(normal, 0.0)).xyz;