23 "Cannot create a GPU buffer for an entity without a Mesh component.");
26 const auto &indices = meshComponent->
GetIndices();
29 bufferDesc.usage = wgpu::BufferUsage::CopyDst | wgpu::BufferUsage::Index;
30 bufferDesc.size =
sizeof(uint32_t) * indices.size();
31 std::string label = fmt::format(
"IndexGPUBuffer_{}",
_entity);
36 _buffer = context.deviceContext.GetDevice()->createBuffer(bufferDesc);
38 context.queue->writeBuffer(
_buffer, 0, indices.data(), bufferDesc.size);
Engine::Entity _entity
Definition IndexGPUBuffer.hpp:72
void Destroy(Engine::Core &core) override
Definition IndexGPUBuffer.hpp:42
bool _isCreated
Definition IndexGPUBuffer.hpp:71
void Update(Engine::Core &core) override
Definition IndexGPUBuffer.hpp:54
wgpu::Buffer _buffer
Definition IndexGPUBuffer.hpp:70
IndexGPUBuffer(Engine::Entity entity)
Definition IndexGPUBuffer.hpp:13
~IndexGPUBuffer() override
Definition IndexGPUBuffer.hpp:14
bool IsCreated(Engine::Core &core) const override
Definition IndexGPUBuffer.hpp:53
void Create(Engine::Core &core) override
Definition IndexGPUBuffer.hpp:15
void Destroy()
Definition IndexGPUBuffer.hpp:44
const wgpu::Buffer & GetBuffer() const override
Definition IndexGPUBuffer.hpp:67
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.inl: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
Mesh structure.
Definition Mesh.hpp:40
const std::vector< uint32_t > & GetIndices() const
Definition Mesh.hpp:99