58 lines
1.6 KiB
C++
58 lines
1.6 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/.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "IRecordable.hpp"
|
|
#include "Vulkan/Image.hpp"
|
|
#include "Vulkan/Context.hpp"
|
|
#include "Vulkan/Resources/ResourceManager.hpp"
|
|
#include "Scene/Texture.hpp"
|
|
|
|
namespace OpenVulkano::Vulkan
|
|
{
|
|
struct VulkanTexture : IRecordable, Image
|
|
{
|
|
Scene::Texture* m_texture = nullptr;
|
|
|
|
virtual void Init(ResourceManager* resManager, Scene::Texture* texture)
|
|
{
|
|
this->m_texture = texture;
|
|
Image::Init(resManager->GetContext()->device.get(), { texture->resolution.x, texture->resolution.y, texture->resolution.z });
|
|
resManager->CopyDataToImage(m_texture->size, m_texture->textureBuffer, this);
|
|
texture->updated = false;
|
|
}
|
|
|
|
void Record(VulkanDrawContext* context) override
|
|
{
|
|
//cmdBuffer.bindDescriptorSets(vk::PipelineBindPoint::eGraphics, )
|
|
}
|
|
};
|
|
|
|
struct VulkanTextureDynamic : VulkanTexture
|
|
{
|
|
uint32_t lastUpdate = -1;
|
|
ResourceManager* resourceManager;
|
|
|
|
void Init(ResourceManager* resManager, Scene::Texture* texture) override
|
|
{
|
|
resourceManager = resManager;
|
|
VulkanTexture::Init(resourceManager, texture);
|
|
lastUpdate = -1;
|
|
}
|
|
|
|
void Record(VulkanDrawContext* context) override
|
|
{
|
|
/*if(bufferId != lastUpdate && m_texture->updated)
|
|
{
|
|
lastUpdate = bufferId;
|
|
resourceManager->CopyDataToImage(m_texture->size, m_texture->textureBuffer, this);
|
|
m_texture->updated = false;
|
|
}
|
|
VulkanTexture::Record(cmdBuffer, bufferId);*/
|
|
}
|
|
};
|
|
} |