Add Text rendering

- Add FreeType as dependency
- Add MsdfGen as dependency
- Add MsdfAtlasGen as dependency
This commit is contained in:
Thraix
2023-05-08 22:12:19 +02:00
parent ad69293faa
commit 4e466a1fce
190 changed files with 44693 additions and 46 deletions
@@ -32,6 +32,7 @@ namespace Copium
{
creator.SetVertexDescriptor(RendererVertex::GetDescriptor());
creator.SetDepthTest(false);
creator.SetBlending(true);
}
else if (type == "Passthrough")
{
@@ -196,7 +197,7 @@ namespace Copium
depthStencilCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO;
depthStencilCreateInfo.depthTestEnable = creator.depthTest ? VK_TRUE : VK_FALSE;
depthStencilCreateInfo.depthWriteEnable = creator.depthTest ? VK_TRUE : VK_FALSE;
depthStencilCreateInfo.depthCompareOp = VK_COMPARE_OP_LESS;
depthStencilCreateInfo.depthCompareOp = VK_COMPARE_OP_LESS_OR_EQUAL;
depthStencilCreateInfo.depthBoundsTestEnable = VK_FALSE;
depthStencilCreateInfo.minDepthBounds = 0.0f;
depthStencilCreateInfo.maxDepthBounds = 1.0f;
@@ -210,9 +211,9 @@ namespace Copium
VK_COLOR_COMPONENT_G_BIT |
VK_COLOR_COMPONENT_B_BIT |
VK_COLOR_COMPONENT_A_BIT;
colorBlendAttachment.blendEnable = VK_FALSE;
colorBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_ONE;
colorBlendAttachment.dstColorBlendFactor = VK_BLEND_FACTOR_ZERO;
colorBlendAttachment.blendEnable = creator.blending ? VK_TRUE : VK_FALSE;
colorBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA;
colorBlendAttachment.dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
colorBlendAttachment.colorBlendOp = VK_BLEND_OP_ADD;
colorBlendAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
colorBlendAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
@@ -38,6 +38,11 @@ namespace Copium
this->depthTest = depthTest;
}
void PipelineCreator::SetBlending(bool blending)
{
this->blending = blending;
}
void PipelineCreator::AddShaderDescription()
{
for (auto& binding : shaderReflector.bindings)
@@ -33,6 +33,7 @@ namespace Copium
VkFrontFace frontFace = VK_FRONT_FACE_CLOCKWISE;
VkRenderPass renderPass = VK_NULL_HANDLE;
bool depthTest = true;
bool blending = false;
public:
PipelineCreator(VkRenderPass renderPass, const std::string& vertexShader, const std::string& fragmentShader);
@@ -42,6 +43,7 @@ namespace Copium
void SetCullMode(VkCullModeFlags flags);
void SetCullFrontFace(VkFrontFace cullFrontFace);
void SetDepthTest(bool depthTest);
void SetBlending(bool blending);
private:
void AddShaderDescription();
static VkDescriptorType GetDescriptorType(BindingType type);