From 3fd33ecff7472e4d6fc9e6b3905f56982e497ef2 Mon Sep 17 00:00:00 2001 From: hachem Date: Sun, 23 Aug 2026 17:21:37 +0200 Subject: [feat]: complete RHI api --- src/rendering/vertex_buffer.h | 78 ------------------------------------------- 1 file changed, 78 deletions(-) delete mode 100644 src/rendering/vertex_buffer.h (limited to 'src/rendering/vertex_buffer.h') diff --git a/src/rendering/vertex_buffer.h b/src/rendering/vertex_buffer.h deleted file mode 100644 index 4e61700..0000000 --- a/src/rendering/vertex_buffer.h +++ /dev/null @@ -1,78 +0,0 @@ -#pragma once - -#include -#include - -namespace Donut -{ - struct VertexBufferElement - { - uint32_t type; - uint32_t count; - uint8_t normalized; - uint32_t offset; - - static auto get_size_of_type(uint32_t type) -> uint32_t; - }; - - class VertexBufferLayout - { - public: - VertexBufferLayout() = default; - ~VertexBufferLayout() = default; - - template - auto push(uint32_t count) -> void - { - static_assert(false); - } - - template<> - void push(uint32_t count) - { - m_elements.push_back({ 0x1406, count, 0, m_stride }); // GL_FLOAT - m_stride += count * VertexBufferElement::get_size_of_type(0x1406); - } - - template<> - void push(uint32_t count) - { - m_elements.push_back({ 0x1405, count, 0, m_stride }); // GL_UNSIGNED_INT - m_stride += count * VertexBufferElement::get_size_of_type(0x1405); - } - - template<> - void push(uint32_t count) - { - m_elements.push_back({ 0x1401, count, 1, m_stride }); // GL_UNSIGNED_BYTE - m_stride += count * VertexBufferElement::get_size_of_type(0x1401); - } - - inline auto get_elements() const -> const std::vector& { return m_elements; } - inline auto get_stride() const -> uint32_t { return m_stride; } - - private: - std::vector m_elements; - uint32_t m_stride = 0; - }; - - class VertexBuffer - { - public: - VertexBuffer(const void* data, uint32_t size); - ~VertexBuffer(); - - auto bind() const -> void; - auto unbind() const -> void; - auto set_data(const void* data, uint32_t size) -> void; - - auto get_layout() const -> const VertexBufferLayout& { return m_layout; } - auto set_layout(const VertexBufferLayout& layout) -> void { m_layout = layout; } - - static auto create(const void* data, uint32_t size) -> VertexBuffer*; - - private: - uint32_t m_renderer_id = 0; - VertexBufferLayout m_layout; - }; -}; -- cgit v1.3