mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-06-18 00:27:02 +08:00
feat: add font class and render font function
This commit is contained in:
12
src/shaders/text_f_shader.glsl
Normal file
12
src/shaders/text_f_shader.glsl
Normal file
@@ -0,0 +1,12 @@
|
||||
#version 460
|
||||
|
||||
in vec2 texCoord;
|
||||
out vec4 color;
|
||||
|
||||
layout (binding = 0) uniform sampler2D text;
|
||||
uniform vec3 textColor;
|
||||
|
||||
void main(void) {
|
||||
vec4 smapled = vec4(1.0, 1.0, 1.0, texture(text, texCoord).r);
|
||||
color = vec4(textColor, 1.0) * smapled;
|
||||
}
|
||||
11
src/shaders/text_v_shader.glsl
Normal file
11
src/shaders/text_v_shader.glsl
Normal file
@@ -0,0 +1,11 @@
|
||||
#version 460
|
||||
|
||||
layout (location = 0) in vec4 vertex;
|
||||
out vec2 texCoord;
|
||||
|
||||
uniform mat4 projection;
|
||||
|
||||
void main(void) {
|
||||
gl_Position = projection * vec4(vertex.xy, 0.0, 1.0);
|
||||
texCoord = vec2(vertex.zw);
|
||||
}
|
||||
Reference in New Issue
Block a user