summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/font.cpp4
-rw-r--r--src/window.cpp30
2 files changed, 27 insertions, 7 deletions
diff --git a/src/font.cpp b/src/font.cpp
index aa7fbe6..0335017 100644
--- a/src/font.cpp
+++ b/src/font.cpp
@@ -43,6 +43,8 @@ struct FontInstanceBufferItem {
glm::vec4 bg_color;
glm::vec2 sprite_region_min;
glm::vec2 sprite_region_max;
+ glm::vec2 bounding_region_min;
+ glm::vec2 bounding_region_max;
float width;
float padding[3];
};
@@ -216,6 +218,8 @@ void FontType_Inner_CalcTransforms(const FontType *ft, FontRender *fr, FontInsta
buf_item->bg_color = glm::vec4(0.0, 0.0, 0.0, 0.0);
buf_item->sprite_region_min = fgc->sprite_region_min;
buf_item->sprite_region_max = fgc->sprite_region_max;
+ buf_item->bounding_region_min = glm::vec2(-1.1, -1.1);
+ buf_item->bounding_region_max = glm::vec2(1.1, 1.1);
buf_item->width =
(fr->settings.char_scale / ft->msdf_settings.minimum_scale)
* ft->msdf_settings.px_range;
diff --git a/src/window.cpp b/src/window.cpp
index 85ea8d3..4132577 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -2147,7 +2147,7 @@ void CreateGraphicsPipelines() {
long offset = 0;
const long vertexBindingCount_glyph = 4;
VkVertexInputBindingDescription vertInputBD_glyph[vertexBindingCount_glyph];
- const long vertexAttrDescCount_glyph = 12;
+ const long vertexAttrDescCount_glyph = 14;
VkVertexInputAttributeDescription vertAttrDesc_glyph[vertexAttrDescCount_glyph];
VkPipelineVertexInputStateCreateInfo vkPipelineVertexInputStateCreateInfo_glyph{vkPipelineVertexInputStateCreateInfo_txtr};
{
@@ -2172,12 +2172,14 @@ void CreateGraphicsPipelines() {
// instance - total
vertInputBD_glyph[index].binding = index;
vertInputBD_glyph[index].stride = 0
- + sizeof(glm::mat4)
- + sizeof(glm::vec4)
- + sizeof(glm::vec4)
- + sizeof(glm::vec2)
- + sizeof(glm::vec2)
- + sizeof(float)
+ + sizeof(glm::vec4) * 4 // mat4 pos_scale
+ + sizeof(glm::vec4) // in_fg_color
+ + sizeof(glm::vec4) // in_bg_color
+ + sizeof(glm::vec2) // in_sprite_region_min
+ + sizeof(glm::vec2) // in_sprite_region_max
+ + sizeof(glm::vec2) // in_bounding_region_min
+ + sizeof(glm::vec2) // in_bounding_region_max
+ + sizeof(float) // in_width
+ (sizeof(float) * 3) // padding
+ 0;
vertInputBD_glyph[index].inputRate = VK_VERTEX_INPUT_RATE_INSTANCE;
@@ -2243,6 +2245,20 @@ void CreateGraphicsPipelines() {
offset += sizeof(glm::vec2);
index += 1;
+ // instance - in_bounding_region_min
+ vertAttrDesc_glyph[index].binding = 3;
+ vertAttrDesc_glyph[index].format = VK_FORMAT_R32G32_SFLOAT;
+ vertAttrDesc_glyph[index].offset = offset;
+ offset += sizeof(glm::vec2);
+ index += 1;
+
+ // instance - in_bounding_region_max
+ vertAttrDesc_glyph[index].binding = 3;
+ vertAttrDesc_glyph[index].format = VK_FORMAT_R32G32_SFLOAT;
+ vertAttrDesc_glyph[index].offset = offset;
+ offset += sizeof(glm::vec2);
+ index += 1;
+
// instance - in_width
vertAttrDesc_glyph[index].binding = 3;
vertAttrDesc_glyph[index].format = VK_FORMAT_R32_SFLOAT;