Remove perspective hack

This commit is contained in:
Dane Johnson 2021-01-22 14:37:32 -06:00
parent 12add5bd20
commit 950cc3ce16
2 changed files with 5 additions and 4 deletions

View File

@ -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;

View File

@ -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;