34 lines
1.1 KiB
C++
34 lines
1.1 KiB
C++
/*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#include "Scene/Prefabs/ArBackgroundDrawable.hpp"
|
|
#include "VulkanGeometry.hpp"
|
|
#include "Vulkan/VulkanDrawContext.hpp"
|
|
#include "Vulkan/Scene/VulkanTexture.hpp"
|
|
|
|
using namespace OpenVulkano::Scene;
|
|
|
|
namespace OpenVulkano::Vulkan
|
|
{
|
|
void EncodeArBackgroundDrawable(Drawable* instance, Vulkan::VulkanDrawContext* drawContext)
|
|
{
|
|
ArBackgroundDrawable* bgDrawable = static_cast<ArBackgroundDrawable*>(instance);
|
|
bgDrawable->Tick();
|
|
const Texture* texture = bgDrawable->GetTexture();
|
|
VulkanTexture* vkTexture = static_cast<VulkanTexture*>(texture->renderTexture);
|
|
if (!vkTexture)
|
|
{
|
|
vkTexture = drawContext->renderer->GetResourceManager().PrepareTexture(const_cast<Texture*>(texture));
|
|
}
|
|
vkTexture->Record(drawContext, 2);
|
|
drawContext->commandBuffer.draw(4, 1, 0, 0);
|
|
}
|
|
}
|
|
|
|
namespace
|
|
{
|
|
void* arBgDrawableVulkanEncoderReg = DrawEncoder::RegisterVulkanEncodeFunction<ArBackgroundDrawable>(&OpenVulkano::Vulkan::EncodeArBackgroundDrawable);
|
|
} |