main
noah metz 2024-10-14 21:32:21 -06:00
parent 0092396715
commit eab26cf72c
1 changed files with 10 additions and 0 deletions

@ -7,10 +7,18 @@ struct Symbol {
uint width;
};
struct Character {
uint code;
};
layout(buffer_reference, std430) readonly buffer SymbolList{
Symbol symbols[];
};
layout(buffer_reference, std430) readonly buffer CharacterList{
Character characters[];
};
layout(set = 0, binding = 0) uniform UIUniform {
mat4 screen;
} ubo;
@ -21,6 +29,7 @@ layout(set = 1, binding = 0) uniform FontUniform {
uint height;
uint space_width;
SymbolList symbol_list;
CharacterList characters;
} font;
layout(location = 0) in vec2 inVertexPosition;
@ -34,6 +43,7 @@ layout(location = 1) out vec2 fragUV;
void main() {
Symbol symbol = font.symbol_list.symbols[code];
Character character = font.characters.characters[0];
float fragU = (inVertexPosition.x*symbol.width + symbol.x) / font.width;
float fragV = inVertexPosition.y + symbol.top / font.height;