learn-opengl/17-refactor-bug-fix/src/shader.hpp
2026-08-27 11:59:34 -04:00

37 lines
1.3 KiB
C++

#pragma once
#include <glad/glad.h>
#include <string>
#include <climits>
#include <glm/glm.hpp>
#include <vector>
#include <format>
#include "dbc.hpp"
#include "components.hpp"
using components::Material, components::Lighting, components::Light;
class Shader
{
public:
unsigned int ID = UINT_MAX;
Shader(const std::string& vertexPath, const std::string& fragmentPath);
unsigned int load_shader(const std::string& filename, GLenum shader_type);
void use() const;
void setBool(const std::string &name, bool value) const;
void setInt(const std::string &name, int value) const;
void setFloat(const std::string &name, float value) const;
void setVec4(const std::string &name, float v1, float v2, float v3, float v4) const;
void setVec4(const std::string &name, const glm::vec4& value) const;
void setVec3(const std::string &name, float v1, float v2, float v3) const;
void setVec3(const std::string &name, const glm::vec3& value) const;
void setMat4(const std::string &name, const glm::mat4& what) const;
void cleanup();
void apply_material(const Material& material);
void apply_lighting(const Lighting& lighting);
void apply_dir_light(const Light& light, size_t index);
void apply_point_light(const Light& light, size_t index);
void apply_spot_light(const Light& light, size_t index);
};