-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathVertexBufferFactory.cpp
More file actions
33 lines (31 loc) · 1.08 KB
/
Copy pathVertexBufferFactory.cpp
File metadata and controls
33 lines (31 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "VertexBufferFactory.h"
#include "VulkanContext.h"
#include "VulkanImpl/VulkanVertexBuffer.h"
#include "VulkanImpl/VulkanSkinnedVertexBuffer.h"
#include "SkinnedMesh.h"
#include <cassert>
namespace sh::render
{
auto sh::render::VertexBufferFactory::Create(const IRenderContext& context, const Mesh& mesh) -> std::unique_ptr<IVertexBuffer>
{
assert(context.GetRenderAPIType() == RenderAPI::Vulkan);
if (context.GetRenderAPIType() == RenderAPI::Vulkan)
{
auto buffer = std::make_unique<vk::VulkanVertexBuffer>(static_cast<const vk::VulkanContext&>(context));
buffer->Create(mesh);
return buffer;
}
return nullptr;
}
auto sh::render::VertexBufferFactory::CreateSkinned(const IRenderContext& context, const SkinnedMesh& mesh) -> std::unique_ptr<IVertexBuffer>
{
assert(context.GetRenderAPIType() == RenderAPI::Vulkan);
if (context.GetRenderAPIType() == RenderAPI::Vulkan)
{
auto buffer = std::make_unique<vk::VulkanSkinnedVertexBuffer>(static_cast<const vk::VulkanContext&>(context));
buffer->Create(mesh);
return buffer;
}
return nullptr;
}
}//namespace