Enable multiple buffers
Enables creation of multiple mesh objects in a single buffer. This is still WIP.
This commit is contained in:
1 parent
c4734e99c2
commit
e06288320d
6 files changed
+188
-123
No files matched your search
@@ -4,6 +4,8 @@
|
||||
#include <queue>
|
||||
#include <memory>
|
||||
|
||||
#include "vulkan_buffers.hpp"
|
||||
|
||||
namespace rse::graphics::mesh
|
||||
{
|
||||
|
||||
@@ -12,7 +14,9 @@ std::queue<uint16_t> free_ids;
|
||||
|
||||
std::map<uint16_t, std::queue<uint16_t>> instance_free_ids;
|
||||
|
||||
uint16_t create_mesh(std::vector<rse::graphics::vulkanbase::Vertex> vertices, std::vector<uint16_t> indices)
|
||||
uint16_t create_mesh(rse::graphics::vulkanbase::VulkanState& vulkan_state,
|
||||
std::vector<rse::graphics::vulkanbase::Vertex> vertices,
|
||||
std::vector<uint16_t> indices)
|
||||
{
|
||||
static uint16_t last_id = 0U;
|
||||
uint16_t assignable_id = 0U;
|
||||
@@ -30,10 +34,14 @@ uint16_t create_mesh(std::vector<rse::graphics::vulkanbase::Vertex> vertices, st
|
||||
indices
|
||||
));
|
||||
|
||||
rse::graphics::vulkanbase::update_mesh_buffers(vulkan_state, vertices, indices);
|
||||
|
||||
return assignable_id;
|
||||
}
|
||||
|
||||
void create_mesh_instance(uint16_t mesh_id, InstanceData instance_data)
|
||||
void create_mesh_instance(rse::graphics::vulkanbase::VulkanState& vulkan_state,
|
||||
uint16_t mesh_id,
|
||||
InstanceData instance_data)
|
||||
{
|
||||
uint16_t instance_id = 0U;
|
||||
auto& instances = g_meshes[mesh_id].instances;
|
||||
@@ -50,6 +58,8 @@ void create_mesh_instance(uint16_t mesh_id, InstanceData instance_data)
|
||||
instance_id,
|
||||
instance_data
|
||||
);
|
||||
|
||||
rse::graphics::vulkanbase::update_mesh_instances(vulkan_state, instance_data);
|
||||
}
|
||||
|
||||
//TODO: Replace with something else. It will take to much time to do this each time we draw frame for all the objects
|
||||
|
||||
Reference in new issue
Block a user