9#include <glm/gtc/type_ptr.hpp>
14 static inline std::string
prefix =
"AmbientLightBuffer_";
26 static_assert(
sizeof(AmbientLightTransfer) == (
sizeof(float) * 3),
27 "AmbientLightTransfer struct size does not match GPU requirements.");
75 "Cannot update a GPU ambient light buffer that is not created.");
102 bufferDesc.usage = wgpu::BufferUsage::CopyDst | wgpu::BufferUsage::Uniform;
106 return context.
GetDevice()->createBuffer(bufferDesc);
~AmbientLightBuffer() override
Definition AmbientLightBuffer.hpp:34
void _UpdateDebugName()
Definition AmbientLightBuffer.hpp:87
wgpu::Buffer _buffer
Definition AmbientLightBuffer.hpp:116
wgpu::Buffer _CreateBuffer(const Graphic::Resource::DeviceContext &context)
Definition AmbientLightBuffer.hpp:99
void Destroy()
Definition AmbientLightBuffer.hpp:44
void Update(Engine::Core &core) override
Definition AmbientLightBuffer.hpp:54
std::string _debugName
Definition AmbientLightBuffer.hpp:119
std::optional< Engine::Entity > _entity
Definition AmbientLightBuffer.hpp:118
bool IsCreated(Engine::Core &core) const override
Definition AmbientLightBuffer.hpp:53
void Create(Engine::Core &core) override
Definition AmbientLightBuffer.hpp:35
void SetEntity(Engine::Entity entity)
Definition AmbientLightBuffer.hpp:64
AmbientLightBuffer(Engine::Entity entity)
Definition AmbientLightBuffer.hpp:30
bool _isCreated
Definition AmbientLightBuffer.hpp:117
static std::string prefix
Definition AmbientLightBuffer.hpp:14
const wgpu::Buffer & GetBuffer() const override
Definition AmbientLightBuffer.hpp:82
std::string_view GetDebugName() const
Definition AmbientLightBuffer.hpp:84
AmbientLightBuffer(void)
Definition AmbientLightBuffer.hpp:32
void Destroy(Engine::Core &core) override
Definition AmbientLightBuffer.hpp:42
void _UpdateBuffer(const Graphic::Resource::Queue &queue, const Object::Component::AmbientLight &ambientLightComponent)
Definition AmbientLightBuffer.hpp:109
void SetValue(const Engine::Core &core, const Object::Component::AmbientLight &ambientLight)
Definition AmbientLightBuffer.hpp:70
The core is the place where all the data of the engine is stored. It contains the registry (entities)...
Definition Core.hpp:33
TResource & GetResource()
Get a reference of a resource.
Definition Core.ipp:14
Wrapper class providing a convenient interface for entity manipulation with the Core....
Definition Entity.hpp:20
Definition UpdateBufferError.hpp:7
Definition AGPUBuffer.hpp:7
Definition AmbientLight.cpp:6
constexpr DefaultFlag Default
Definition webgpu.hpp:78
StringView(const std::string_view &cpp)
Definition webgpu.hpp:618
Definition AmbientLightBuffer.hpp:15
static uint32_t GPUSize()
Definition AmbientLightBuffer.hpp:23
AmbientLightTransfer(const Object::Component::AmbientLight &ambientLight)
Definition AmbientLightBuffer.hpp:18
static uint32_t CPUSize()
Definition AmbientLightBuffer.hpp:22
glm::vec3 color
Definition AmbientLightBuffer.hpp:16
Definition DeviceContext.hpp:7
auto & GetDevice()
Definition DeviceContext.hpp:19
Definition AmbientLight.hpp:7