#pragma once #include #include #include #include "shader.hpp" #include #include struct Vertex { glm::vec3 position; glm::vec3 normal; glm::vec2 tex_coords; }; struct TextureCounts { unsigned int diffuseNr = 1; unsigned int specularNr = 1; unsigned int normalNr = 1; unsigned int heightNr = 1; }; struct Texture { unsigned int id; std::string type; std::string path; std::string target; int uniform_id=-1; Texture(unsigned int id, const std::string& type, const std::string& path, TextureCounts& count) : id(id), type(type) { unsigned int number = 0; if(type == "texture_diffuse") { number = count.diffuseNr++; } else if(type == "texture_specular") { number = count.specularNr++; } else if(type == "texture_normal") { number = count.normalNr++; } else if(type == "texture_height") { number = count.heightNr++; } else { dbc::sentinel($F("Invalid texture type={} for file={}", type, path)); } target = std::format("{}{}", type, number); } }; struct Mesh { std::vector vertices; std::vector indices; std::vector textures; unsigned int VAO = 0; unsigned int VBO = 0; unsigned int EBO = 0; Mesh(std::vector& vertices, std::vector& indices, std::vector& textures) : vertices(vertices), indices(indices), textures(textures) { setup_mesh(); } void draw(Shader &shader); void setup_mesh(); void connect_shader(const Shader& shader); };