24 "Cannot create a GPU buffer for an entity without a Mesh component.");
27 const auto &indices = meshComponent->
GetIndices();
30 bufferDesc.usage = wgpu::BufferUsage::CopyDst | wgpu::BufferUsage::Index;
31 bufferDesc.size =
sizeof(uint32_t) * indices.size();
32 std::string label = fmt::format(
"IndexGPUBuffer_{}",
_entity);
38 _buffer = deviceContext.GetDevice()->createBuffer(bufferDesc);
40 queue->writeBuffer(
_buffer, 0, indices.data(), bufferDesc.size);
Engine::Entity _entity
Definition IndexGPUBuffer.hpp:74
void Destroy(Engine::Core &core) override
Definition IndexGPUBuffer.hpp:44
bool _isCreated
Definition IndexGPUBuffer.hpp:73
void Update(Engine::Core &core) override
Definition IndexGPUBuffer.hpp:56
wgpu::Buffer _buffer
Definition IndexGPUBuffer.hpp:72
IndexGPUBuffer(Engine::Entity entity)
Definition IndexGPUBuffer.hpp:14
~IndexGPUBuffer() override
Definition IndexGPUBuffer.hpp:15
bool IsCreated(Engine::Core &core) const override
Definition IndexGPUBuffer.hpp:55
void Create(Engine::Core &core) override
Definition IndexGPUBuffer.hpp:16
void Destroy()
Definition IndexGPUBuffer.hpp:46
const wgpu::Buffer & GetBuffer() const override
Definition IndexGPUBuffer.hpp:69
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 NonexistentComponentError.hpp:7
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 DeviceContext.hpp:7
Mesh structure.
Definition Mesh.hpp:40
const std::vector< uint32_t > & GetIndices() const
Definition Mesh.hpp:99