Refactor mesh handling to use templated vertex structures for improved type safety and flexibility

This commit is contained in:
REDxEYE 2025-03-29 22:20:54 +03:00
parent bba647db5c
commit 1ffbeb8148
28 changed files with 591 additions and 521 deletions

View file

@ -6,17 +6,23 @@
#include <glm/glm.hpp>
#include "typedefs.hpp"
#include "maths/fastmaths.hpp"
#include "graphics/core/MeshData.hpp"
class Mesh;
template<typename VertexStructure> class Mesh;
class Shader;
class Assets;
class Camera;
class Batch3D;
class Shader;
class Cubemap;
class Framebuffer;
class DrawContext;
struct SkyboxVertex {
glm::vec2 position;
static constexpr VertexAttribute ATTRIBUTES[] {{GL_FLOAT,false,2}, {0}};
};
struct skysprite {
std::string texture;
float phase;
@ -32,7 +38,7 @@ class Skybox {
FastRandom random;
glm::vec3 lightDir;
std::unique_ptr<Mesh> mesh;
std::unique_ptr<Mesh<SkyboxVertex>> mesh;
std::unique_ptr<Batch3D> batch3d;
std::vector<skysprite> sprites;
int frameid = 0;