22 const VkViewport & viewport,
23 const VkRect2D & scissor,
24 uint32_t concurrentFrames,
25 VkSampleCountFlagBits msaa
34 const VkCommandBuffer & commandBuffer,
35 uint32_t currentFrame,
40 glm::bvec2 centre = glm::bvec2(
false,
false)
47 const char * vert =
"#version 450\n"
48 "layout(location = 0) in vec4 posTex;\n"
49 "layout(set = 0, binding = 0) uniform vUBO { mat4 proj; } ubo;\n"
50 "layout(location = 0) out vec2 texCoords;\n"
53 " gl_Position = ubo.proj * vec4(posTex.xy, 0.0, 1.0);\n"
54 " texCoords = posTex.zw;\n"
57 const char * frag =
"#version 450\n"
58 "layout(location = 0) in vec2 texCoords;\n"
59 "layout(location = 0) out vec4 colour;\n"
60 "layout(set = 0, binding = 1) uniform fUBO { vec4 textColour; } ubo;\n"
61 "layout(set = 1, binding = 0) uniform usampler2D glyph;\n"
64 " vec4 glpyhSample = vec4(1.0,1.0,1.0, texture(glyph,texCoords.xy).r);\n"
65 " colour = ubo.textColour*glpyhSample;\n"
70 std::shared_ptr<VertexBufferObject> pos;
71 std::shared_ptr<UniformBufferObject> uboV, uboF;
72 std::vector<glm::vec4> vertices;
74 VkImageView characterTextureView;
76 std::shared_ptr<vkTexture> fontTexture;
77 std::shared_ptr<Sampler> fontSampler;
79 std::unique_ptr<vkFont> font;
81 std::unique_ptr<Pipeline> textPipeline;
83 struct vUBO {glm::mat4 proj;};
84 struct fUBO {glm::vec4 colour;};
Definition vkTextRenderer.h:13
void setProjection(glm::mat4 p)
Definition vkTextRenderer.cpp:119
void renderText(const Device &device, const Command &command, const VkCommandBuffer &commandBuffer, uint32_t currentFrame, std::string text, glm::vec2 position, float scale, glm::vec4 colour, glm::bvec2 centre=glm::bvec2(false, false))
Definition vkTextRenderer.cpp:127
~TextRenderer()
Definition vkTextRenderer.h:28