Switch to more compact TextGlyph vertex format
This commit is contained in:
@@ -5,49 +5,36 @@
|
||||
*/
|
||||
|
||||
#include "Scene/TextDrawable.hpp"
|
||||
#include "VulkanGeometry.hpp"
|
||||
#include "VulkanNode.hpp"
|
||||
#include "Vulkan/VulkanDrawContext.hpp"
|
||||
#include "Vulkan/Scene/VulkanUniformBuffer.hpp"
|
||||
#include "Vulkan/Scene/VulkanVertexBuffer.hpp"
|
||||
#include "VulkanTexture.hpp"
|
||||
|
||||
using namespace OpenVulkano::Scene;
|
||||
|
||||
namespace OpenVulkano::Vulkan
|
||||
{
|
||||
void EncodeTextDrawable(Drawable* instance, Vulkan::VulkanDrawContext* drawContext)
|
||||
void EncodeTextDrawable(Drawable* instance, VulkanDrawContext* drawContext)
|
||||
{
|
||||
TextDrawable* drawable = static_cast<TextDrawable*>(instance);
|
||||
Geometry* mesh = drawable->GetGeometry();
|
||||
VulkanGeometry* renderGeo = mesh->GetRenderResource();
|
||||
if (!renderGeo) renderGeo = drawContext->renderer->GetResourceManager().PrepareGeometry(mesh);
|
||||
renderGeo->RecordBind(drawContext->commandBuffer);
|
||||
VertexBuffer* vbo = drawable->GetVertexBuffer();
|
||||
VulkanVertexBuffer* renderVbo = vbo->GetRenderResource();
|
||||
if (!renderVbo) renderVbo = drawContext->renderer->GetResourceManager().PrepareVertexBuffer(vbo);
|
||||
renderVbo->RecordBind(drawContext->commandBuffer);
|
||||
|
||||
if (drawable->GetUniformBuffer())
|
||||
VulkanTexture* renderTexture = drawable->GetTexture()->GetRenderResource();
|
||||
if (!renderTexture)
|
||||
{
|
||||
VulkanUniformBuffer* vkBuffer = drawable->GetUniformBuffer()->GetRenderResource();
|
||||
if (!vkBuffer)
|
||||
{
|
||||
vkBuffer = drawContext->renderer->GetResourceManager().PrepareUniformBuffer(drawable->GetUniformBuffer());
|
||||
}
|
||||
vkBuffer->Record(drawContext);
|
||||
}
|
||||
|
||||
if (Texture* texture = drawable->GetTexture())
|
||||
{
|
||||
VulkanTexture* renderTexture = texture->GetRenderResource();
|
||||
if (!renderTexture)
|
||||
{
|
||||
renderTexture = drawContext->renderer->GetResourceManager().PrepareTexture(drawable->GetTexture());
|
||||
}
|
||||
renderTexture->Record(drawContext);
|
||||
renderTexture = drawContext->renderer->GetResourceManager().PrepareTexture(drawable->GetTexture());
|
||||
}
|
||||
renderTexture->Record(drawContext);
|
||||
|
||||
for(Node* node : instance->GetNodes())
|
||||
{
|
||||
if (!node->IsEnabled()) [[unlikely]] continue;
|
||||
drawContext->EncodeNode(node);
|
||||
renderGeo->RecordDraw(drawContext->commandBuffer);
|
||||
drawContext->commandBuffer.draw(4, drawable->GetSymbolCount(), 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user