engine/test/res/shaders/font.vert

22 lines
579 B
GLSL
Raw Normal View History

2022-11-27 14:35:41 +00:00
#version 450
2022-11-07 20:15:26 +00:00
2022-11-27 14:35:41 +00:00
layout( push_constant ) uniform Constants {
mat4 model;
2022-11-28 15:02:08 +00:00
vec2 atlas_top_left;
vec2 atlas_bottom_right;
2022-11-27 14:35:41 +00:00
vec2 offset;
vec2 size;
} constants;
2022-11-07 20:15:26 +00:00
2022-11-27 14:35:41 +00:00
layout(location = 0) in vec3 inPosition;
layout(location = 1) in vec3 inNorm;
layout(location = 2) in vec2 inUV;
2022-11-07 20:15:26 +00:00
2022-11-27 14:35:41 +00:00
layout(location = 0) out vec2 fragUV;
2022-11-07 20:15:26 +00:00
2022-11-27 14:35:41 +00:00
void main() {
2022-11-28 15:02:08 +00:00
vec2 position = inPosition.xy * constants.size + constants.offset;
position *= 0.001;
gl_Position = constants.model * vec4(position, 0.0, 1.0);
fragUV = constants.atlas_top_left + (inUV * (constants.atlas_bottom_right - constants.atlas_top_left));
2022-11-27 14:35:41 +00:00
}