Setup for day 17.
This commit is contained in:
parent
d3169d3eca
commit
187bf4c1d1
84 changed files with 14784 additions and 0 deletions
37
17-refactor-bug-fix/src/shader.hpp
Normal file
37
17-refactor-bug-fix/src/shader.hpp
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#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);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue