aboutsummaryrefslogtreecommitdiff
path: root/src/rendering/vertex_array.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rendering/vertex_array.cpp')
-rw-r--r--src/rendering/vertex_array.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/rendering/vertex_array.cpp b/src/rendering/vertex_array.cpp
new file mode 100644
index 0000000..8045707
--- /dev/null
+++ b/src/rendering/vertex_array.cpp
@@ -0,0 +1,32 @@
+#include "vertex_array.h"
+#include "renderer.h"
+
+#include "platform/opengl/opengl_vertex_array.h"
+#include "platform/vulkan/vulkan_vertex_array.h"
+
+namespace Donut
+{
+ auto VertexBufferElement::get_size_of_type(uint32_t type) -> uint32_t
+ {
+ 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;
+ }
+ }
+
+ auto VertexArray::create() -> VertexArray*
+ {
+ switch (Renderer::get_api())
+ {
+ case RendererAPI::API::OpenGL:
+ return new OpenGLVertexArray();
+ case RendererAPI::API::Vulkan:
+ return new VulkanVertexArray();
+ default:
+ return nullptr;
+ }
+ }
+};