Move back to C
I'm insane and as such I have moved to C AGAIN! Without any reason.
This commit is contained in:
1 parent
bf31b96a2e
commit
3d538eaa2c
43 files changed
+2645
-2649
No files matched your search
@@ -14,38 +14,35 @@
|
||||
|
||||
#include "vulkan_commons.h"
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
/* Forward declarations */
|
||||
struct MeshInstance;
|
||||
|
||||
struct MeshInstance
|
||||
{
|
||||
uint32_t instance_id;
|
||||
InstanceData instance_data;
|
||||
};
|
||||
|
||||
struct Mesh
|
||||
/**
|
||||
* @brief Mesh data, with unique id and dynamic arrays holding vertices and indices.
|
||||
* One mesh can have multiple instances.
|
||||
*
|
||||
*/
|
||||
struct rse_mesh_t
|
||||
{
|
||||
uint32_t unique_id;
|
||||
const std::vector<Vertex> vertices;
|
||||
std::vector<uint16_t> indices;
|
||||
std::map<uint16_t, std::unique_ptr<MeshInstance>> instances;
|
||||
size_t instances_count;
|
||||
size_t indices_count;
|
||||
size_t vertices_count;
|
||||
struct rse_vertex_t* vertices;
|
||||
uint16_t* indices;
|
||||
struct rse_instance_data_t* instances;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Create a new mesh for provided vertices and indices.
|
||||
*
|
||||
* @param vertices vector of vertices
|
||||
* @param indices indices for mesh
|
||||
* @param vertices_num vertices count
|
||||
* @param indices_num indices count
|
||||
* @return uint16_t Mesh identifier. Can be useful for getting vertices, indices and instances
|
||||
*/
|
||||
uint16_t create_mesh(std::vector<Vertex> vertices,
|
||||
std::vector<uint16_t> indices);
|
||||
|
||||
uint16_t create_mesh(struct rse_vertex_t* vertices,
|
||||
uint16_t* indices,
|
||||
size_t vertices_num,
|
||||
size_t indices_num);
|
||||
/**
|
||||
* @brief Create a instance for the selected mesh. Instance can have its own location, rotation and scale
|
||||
*
|
||||
@@ -53,11 +50,55 @@ uint16_t create_mesh(std::vector<Vertex> vertices,
|
||||
* @param instance_data Transformation info
|
||||
*/
|
||||
void create_mesh_instance(uint16_t mesh_id,
|
||||
InstanceData instance_data);
|
||||
struct rse_instance_data_t instance_data);
|
||||
|
||||
std::vector<Vertex> get_mesh_vertices(uint16_t mesh_id);
|
||||
std::vector<uint16_t> get_mesh_indices(uint16_t mesh_id);
|
||||
std::vector<InstanceData> get_instance_data_for_mesh(uint16_t mesh_id);
|
||||
/**
|
||||
* @brief Get the vertex count for mesh with mesh_id ID
|
||||
*
|
||||
* @param mesh_id Mesh identifier
|
||||
* @return size_t Number of vertices
|
||||
*/
|
||||
size_t get_vertices_count(uint16_t mesh_id);
|
||||
|
||||
/**
|
||||
* @brief Get the index count for mesh with mesh_id ID
|
||||
*
|
||||
* @param mesh_id Mesh identifier
|
||||
* @return size_t Number of indices
|
||||
*/
|
||||
size_t get_indices_count(uint16_t mesh_id);
|
||||
|
||||
/**
|
||||
* @brief Get the instance count for mesh with mesh_id ID
|
||||
*
|
||||
* @param mesh_id Mesh identifier
|
||||
* @return size_t Number of instances
|
||||
*/
|
||||
size_t get_instances_count(uint16_t mesh_id);
|
||||
|
||||
/**
|
||||
* @brief Get pointer to vertices of mesh
|
||||
*
|
||||
* @param mesh_id Mesh identifier
|
||||
* @return struct rse_vertex_t* Vertex data
|
||||
*/
|
||||
struct rse_vertex_t* get_mesh_vertices(uint16_t mesh_id);
|
||||
|
||||
/**
|
||||
* @brief Get pointer to indices of mesh
|
||||
*
|
||||
* @param mesh_id Mesh identifier
|
||||
* @return uint16_t* Indices data
|
||||
*/
|
||||
uint16_t* get_mesh_indices(uint16_t mesh_id);
|
||||
|
||||
/**
|
||||
* @brief Get the instance data for mesh object.
|
||||
*
|
||||
* @param mesh_id Mesh identifier
|
||||
* @return struct rse_instance_data_t* Pointer to instances array
|
||||
*/
|
||||
struct rse_instance_data_t* get_instance_data_for_mesh(uint16_t mesh_id);
|
||||
|
||||
|
||||
#endif /* RSE_MESH_CONTROLLER_H */
|
||||
Reference in new issue
Block a user