Refactor mesh handling to use templated vertex structures for improved type safety and flexibility
This commit is contained in:
@@ -2,19 +2,34 @@
|
||||
|
||||
#include "typedefs.hpp"
|
||||
#include "commons.hpp"
|
||||
#include "MeshData.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
class Mesh;
|
||||
template<typename VertexStructure> class Mesh;
|
||||
|
||||
class Texture;
|
||||
struct UVRegion;
|
||||
|
||||
struct Batch3DVertex {
|
||||
glm::vec3 position;
|
||||
glm::vec2 uv;
|
||||
glm::vec4 color;
|
||||
|
||||
static constexpr VertexAttribute ATTRIBUTES[] {
|
||||
{GL_FLOAT, false, 3},
|
||||
{GL_FLOAT, false, 2},
|
||||
{GL_FLOAT, false, 4},
|
||||
{0}
|
||||
};
|
||||
};
|
||||
|
||||
class Batch3D : public Flushable {
|
||||
std::unique_ptr<float[]> buffer;
|
||||
std::unique_ptr<Batch3DVertex[]> buffer;
|
||||
size_t capacity;
|
||||
std::unique_ptr<Mesh> mesh;
|
||||
std::unique_ptr<Mesh<Batch3DVertex>> mesh;
|
||||
std::unique_ptr<Texture> blank;
|
||||
size_t index;
|
||||
glm::vec4 tint {1.0f};
|
||||
|
||||
Reference in New Issue
Block a user