fast-nuclear-sim/assets/shader/main.vsh

30 lines
606 B
V Shell
Raw Normal View History

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;
uniform mat4 model;
uniform mat4 camera;
2024-01-31 00:12:14 +11:00
uniform mat4 projection;
out float brightness;
out flat sampler2D tex;
out vec2 texPos;
void main()
{
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
brightness = dot(normalize(aNormal), normalize(cNormal)) * 0.25f + 0.75f;
gl_Position = projection * pos;
texPos = aTexPos;
tex = aTex;
}