2024-01-31 00:12:14 +11:00
|
|
|
|
|
|
|
#version 460 core
|
|
|
|
#extension GL_ARB_bindless_texture : require
|
|
|
|
|
|
|
|
layout (location = 0) in sampler2D aTex;
|
|
|
|
layout (location = 1) in vec2 aTexPos;
|
|
|
|
layout (location = 2) in vec4 aPos;
|
|
|
|
layout (location = 3) in vec3 aNormal;
|
2024-02-16 21:50:46 +11:00
|
|
|
layout (location = 4) in vec4 aColour;
|
2024-01-31 00:12:14 +11:00
|
|
|
|
|
|
|
uniform mat4 model;
|
2024-02-02 13:05:28 +11:00
|
|
|
uniform mat4 camera;
|
2024-01-31 00:12:14 +11:00
|
|
|
uniform mat4 projection;
|
|
|
|
|
2024-02-16 21:50:46 +11:00
|
|
|
out vec4 colour;
|
2024-01-31 00:12:14 +11:00
|
|
|
out flat sampler2D tex;
|
|
|
|
out vec2 texPos;
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2024-02-02 13:05:28 +11:00
|
|
|
vec4 pos = camera * model * aPos;
|
|
|
|
vec3 cNormal = vec3(0.f, 0.f, 1.f) * mat3(camera * model);
|
2024-01-31 00:12:14 +11:00
|
|
|
|
2024-02-16 21:50:46 +11:00
|
|
|
float brightness = dot(normalize(aNormal), normalize(cNormal)) * 0.25f + 0.75f;
|
2024-01-31 00:12:14 +11:00
|
|
|
|
2024-02-16 21:50:46 +11:00
|
|
|
colour = aColour * vec4(vec3(brightness), 1);
|
2024-01-31 00:12:14 +11:00
|
|
|
gl_Position = projection * pos;
|
|
|
|
texPos = aTexPos;
|
|
|
|
tex = aTex;
|
|
|
|
}
|
|
|
|
|