spoonedit/Shaders/FlatForwardPass.vsh
2024-12-21 17:09:23 +01:00

30 lines
853 B
GLSL

#version 460
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec2 aTexCoord;
layout (location = 2) in vec3 aNormal;
layout (location = 3) in vec3 aTangent;
layout (location = 4) in vec3 aBitangent;
uniform mat4 MVP;
uniform mat4 NormalRotationMatrix;
uniform mat4 ModelMatrix;
out vec2 TexCoord;
out vec4 WldPos;
out vec3 Normal;
out mat3 TBN;
void main(){
vec4 prepos = MVP * vec4(aPos,1);
gl_Position = vec4(prepos.x,-prepos.y,prepos.zw);
WldPos = ModelMatrix * vec4(aPos.xyz,1);
TexCoord = aTexCoord;
Normal = (NormalRotationMatrix * vec4(aNormal,1)).xyz;
vec3 T = normalize(vec3(NormalRotationMatrix * vec4(aTangent, 0.0)));
vec3 B = normalize(vec3(NormalRotationMatrix * vec4(aBitangent, 0.0)));
vec3 N = normalize(vec3(NormalRotationMatrix * vec4(aNormal, 0.0)));
TBN = mat3(T, B, N);
}