Enable multiple buffers

Enables creation of multiple mesh objects in a single buffer. This is
still WIP.
This commit is contained in:
Piotr Krygier committed 2023-04-04 14:56:31 +02:00
1 parent c4734e99c2
commit e06288320d
6 files changed
+188 -123

No files matched your search

+6 -10
View File
@@ -17,8 +17,6 @@
#include <vector>
#include <map>
#include <glm/glm.hpp>
#include "vulkan_commons.hpp"
namespace rse::graphics::mesh
@@ -27,12 +25,6 @@ namespace rse::graphics::mesh
/* Forward declarations */
struct MeshInstance;
struct InstanceData {
glm::vec3 pos;
glm::vec3 rot;
float scale;
};
struct MeshInstance
{
uint32_t instance_id;
@@ -55,7 +47,9 @@ struct Mesh
* @param indices indices for mesh
* @return uint16_t Mesh identifier. Can be useful for getting vertices, indices and instances
*/
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);
/**
* @brief Create a instance for the selected mesh. Instance can have its own location, rotation and scale
@@ -63,7 +57,9 @@ uint16_t create_mesh(std::vector<rse::graphics::vulkanbase::Vertex> vertices, st
* @param mesh_id Mesh id
* @param instance_data Transformation info
*/
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);
std::vector<rse::graphics::vulkanbase::Vertex> get_mesh_vertices(uint16_t mesh_id);
std::vector<uint16_t> get_mesh_indices(uint16_t mesh_id);