Some more TexturePreparations #11
This commit is contained in:
@@ -5,9 +5,11 @@
|
||||
*/
|
||||
|
||||
#include "Scene/SimpleDrawable.hpp"
|
||||
#include "Scene/Material.hpp"
|
||||
#include "VulkanGeometry.hpp"
|
||||
#include "VulkanNode.hpp"
|
||||
#include "Vulkan/VulkanDrawContext.hpp"
|
||||
#include "VulkanTexture.hpp"
|
||||
|
||||
using namespace OpenVulkano::Scene;
|
||||
|
||||
@@ -15,10 +17,25 @@ namespace OpenVulkano::Vulkan
|
||||
{
|
||||
void EncodeSimpleDrawable(Drawable* instance, Vulkan::VulkanDrawContext* drawContext)
|
||||
{
|
||||
Geometry* mesh = static_cast<SimpleDrawable*>(instance)->GetMesh();
|
||||
SimpleDrawable* drawable = static_cast<SimpleDrawable*>(instance);
|
||||
Geometry* mesh = drawable->GetMesh();
|
||||
VulkanGeometry* renderGeo = static_cast<VulkanGeometry*>(mesh->renderGeo);
|
||||
if (!mesh->renderGeo) renderGeo = drawContext->renderer->GetResourceManager().PrepareGeometry(mesh);
|
||||
if (!renderGeo) renderGeo = drawContext->renderer->GetResourceManager().PrepareGeometry(mesh);
|
||||
renderGeo->RecordBind(drawContext->commandBuffer);
|
||||
if (Material* material = drawable->GetMaterial())
|
||||
{
|
||||
if (Texture* texture = material->texture)
|
||||
{
|
||||
VulkanTexture* renderTexture = static_cast<VulkanTexture*>(texture->renderTexture);
|
||||
if (!renderTexture)
|
||||
{
|
||||
drawContext->renderer->GetResourceManager().PrepareMaterial(drawable->GetMaterial());
|
||||
renderTexture = static_cast<VulkanTexture*>(texture->renderTexture);
|
||||
}
|
||||
renderTexture->Record(drawContext);
|
||||
}
|
||||
}
|
||||
|
||||
for(Node* node : instance->GetNodes())
|
||||
{
|
||||
drawContext->EncodeNode(node);
|
||||
|
||||
Reference in New Issue
Block a user