aboutsummaryrefslogtreecommitdiff
path: root/src/rendering/index_buffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rendering/index_buffer.cpp')
-rw-r--r--src/rendering/index_buffer.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/rendering/index_buffer.cpp b/src/rendering/index_buffer.cpp
new file mode 100644
index 0000000..9603c72
--- /dev/null
+++ b/src/rendering/index_buffer.cpp
@@ -0,0 +1,21 @@
+#include "index_buffer.h"
+#include "renderer.h"
+
+#include "platform/opengl/opengl_index_buffer.h"
+#include "platform/vulkan/vulkan_index_buffer.h"
+
+namespace Donut
+{
+ auto IndexBuffer::create(const uint32_t* indices, uint32_t count) -> IndexBuffer*
+ {
+ switch (Renderer::get_api())
+ {
+ case RendererAPI::API::OpenGL:
+ return new OpenGLIndexBuffer(indices, count);
+ case RendererAPI::API::Vulkan:
+ return new VulkanIndexBuffer((uint32_t*)indices, count);
+ default:
+ return nullptr;
+ }
+ }
+};