GRK_Room/cw 9/shaders/.vert

28 lines
649 B
GLSL
Raw Permalink Normal View History

2023-02-13 01:16:16 +01:00
#version 430 core
layout (location = 0) out vec3 vertexPosition;
layout (location = 1) out vec3 vertexNormal;
layout (location = 2) in vec2 vertexTexCoords;
out vec3 FragPos;
out vec2 TexCoords;
out vec3 Normal;
uniform bool invertedNormals;
uniform mat4 modelMatrix;
uniform mat3 transformation;
uniform mat4 view;
uniform mat4 projection;
void main()
{
vec4 viewPos = transformation * vec4(vertexPosition, 1.0);
FragPos = viewPos.xyz;
TexCoord = vertexTexCoords;
mat3 normalMatrix = transpose(inverse(mat3( * model)));
Normal = normalMatrix * (invertedNormals ? -aNormal : aNormal);
gl_Position = viewPos;
}