Render resource handling for textures
This commit is contained in:
@@ -8,27 +8,19 @@
|
||||
|
||||
#include "UpdateFrequency.hpp"
|
||||
#include "SamplerConfig.hpp"
|
||||
#include "Base/ICloseable.hpp"
|
||||
#include "Base/Render/RenderResource.hpp"
|
||||
#include "Math/Math.hpp"
|
||||
#include "DataFormat.hpp"
|
||||
#include "Scene/Shader/DescriptorInputDescription.hpp"
|
||||
|
||||
namespace OpenVulkano::Scene
|
||||
{
|
||||
class Texture;
|
||||
|
||||
struct RenderTexture
|
||||
{
|
||||
Texture* m_texture = nullptr;
|
||||
};
|
||||
|
||||
class Texture
|
||||
class Texture : public RenderResourceHolder<Texture>
|
||||
{
|
||||
public:
|
||||
static Texture PLACEHOLDER;
|
||||
static constexpr inline DescriptorSetLayoutBinding DESCRIPTOR_SET_LAYOUT_BINDING = { 0, DescriptorSetLayoutBinding::Type::TYPE_COMBINED_IMAGE_SAMPLER, 1, ShaderProgramType::ALL_GRAPHICS };
|
||||
|
||||
RenderTexture* renderTexture = nullptr;
|
||||
void* textureBuffer = nullptr;
|
||||
size_t size = 0;
|
||||
Math::Vector3ui resolution = {0,0,0};
|
||||
@@ -41,13 +33,7 @@ namespace OpenVulkano::Scene
|
||||
: m_samplerConfig(samplerConfig)
|
||||
{ if (placeholder) MakePlaceholder(); }
|
||||
|
||||
~Texture()
|
||||
{
|
||||
if (renderTexture)
|
||||
{
|
||||
renderTexture->m_texture = nullptr;
|
||||
}
|
||||
}
|
||||
~Texture() = default;
|
||||
|
||||
void MakePlaceholder(uint32_t width = 32, uint32_t height = 32,
|
||||
Math::Vector4uc color1 = {248, 123, 255, 255}, Math::Vector4uc color2 = {250, 19, 255, 255});
|
||||
|
||||
Reference in New Issue
Block a user