Files
OpenVulkano/openVulkanoCpp/Scene/UniformBuffer.hpp
2024-07-22 21:08:08 +02:00

38 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/.
*/
#pragma once
#include "Base/ICloseable.hpp"
#include "Scene/Shader/DescriptorInputDescription.hpp"
#include "Scene/UpdateFrequency.hpp"
namespace OpenVulkano::Scene
{
class UniformBuffer
{
public:
static constexpr inline DescriptorSetLayoutBinding DESCRIPTOR_SET_LAYOUT_BINDING = { 0, DescriptorSetLayoutBinding::Type::TYPE_UNIFORM_BUFFER, 1, ShaderProgramType::ALL_GRAPHICS };
DescriptorSetLayoutBinding binding;
uint32_t setId;
ICloseable* renderBuffer = nullptr;
size_t size = 0;
const void* data = nullptr;
UpdateFrequency updateFrequency = UpdateFrequency::Never;
bool updated = true;
void Init(size_t size, const void* data, uint32_t setId = 2, const DescriptorSetLayoutBinding& binding = DESCRIPTOR_SET_LAYOUT_BINDING)
{
this->size = size;
this->data = data;
this->binding = binding;
this->setId = setId;
}
UpdateFrequency GetUpdateFrequency() const { return updateFrequency; }
};
}