Files
rust-engine/shaders/text.vert
2021-08-15 23:29:25 +02:00

40 lines
877 B
GLSL

#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(push_constant) uniform PushConstants {
mat4 model;
} push;
layout(binding = 0) uniform ObjectUniformData {
mat4 view;
mat4 projection;
float time;
vec3 light_position;
vec3 light_directional_rotation;
vec3 camera_position;
} ubo;
layout(location = 0) in vec3 position;
layout(location = 1) in vec2 uv;
layout(location = 2) in vec3 normal;
layout(location = 0) out vec2 tex_coords;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
mat4 invert = mat4(
1., 0., 0., 0.,
0., -1., 0., 0.,
0., 0., 1., 0.,
0., 0., 0., 1.
);
// Vertex position in camera
gl_Position = ubo.projection * ubo.view * invert * push.model * vec4(position, 1.0);
// Just interpolate UV coords, no transformation needed
tex_coords = uv;
}