From a2ec7dabd48a70ea69623406ddd0f8f97af403c8 Mon Sep 17 00:00:00 2001 From: hachem Date: Tue, 12 Aug 2025 18:12:37 +0200 Subject: [add]: Start of a basic rendering backend --- src/Rendering/VertexArray.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/Rendering/VertexArray.cpp (limited to 'src/Rendering/VertexArray.cpp') diff --git a/src/Rendering/VertexArray.cpp b/src/Rendering/VertexArray.cpp new file mode 100644 index 0000000..87db8fb --- /dev/null +++ b/src/Rendering/VertexArray.cpp @@ -0,0 +1,28 @@ +#include "VertexArray.h" +#include "Renderer.h" +#include "Platform/OpenGL/OpenGLVertexArray.h" + +namespace Donut +{ + uint32_t VertexBufferElement::GetSizeOfType(uint32_t type) + { + switch (type) + { + case 0x1406: return 4; // GL_FLOAT + case 0x1405: return 4; // GL_UNSIGNED_INT + case 0x1401: return 1; // GL_UNSIGNED_BYTE + default: return 0; + } + } + + VertexArray* VertexArray::Create() + { + switch (Renderer::GetAPI()) + { + case RendererAPI::API::OpenGL: + return new OpenGLVertexArray(); + default: + return nullptr; + } + } +}; -- cgit v1.3