mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-05 00:33:51 +00:00
Initial commit: wowee native WoW 3.3.5a client
This commit is contained in:
commit
ce6cb8f38e
147 changed files with 32347 additions and 0 deletions
41
include/rendering/shader.hpp
Normal file
41
include/rendering/shader.hpp
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <GL/glew.h>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
namespace wowee {
|
||||
namespace rendering {
|
||||
|
||||
class Shader {
|
||||
public:
|
||||
Shader() = default;
|
||||
~Shader();
|
||||
|
||||
bool loadFromFile(const std::string& vertexPath, const std::string& fragmentPath);
|
||||
bool loadFromSource(const std::string& vertexSource, const std::string& fragmentSource);
|
||||
|
||||
void use() const;
|
||||
void unuse() const;
|
||||
|
||||
void setUniform(const std::string& name, int value);
|
||||
void setUniform(const std::string& name, float value);
|
||||
void setUniform(const std::string& name, const glm::vec2& value);
|
||||
void setUniform(const std::string& name, const glm::vec3& value);
|
||||
void setUniform(const std::string& name, const glm::vec4& value);
|
||||
void setUniform(const std::string& name, const glm::mat3& value);
|
||||
void setUniform(const std::string& name, const glm::mat4& value);
|
||||
|
||||
GLuint getProgram() const { return program; }
|
||||
|
||||
private:
|
||||
bool compile(const std::string& vertexSource, const std::string& fragmentSource);
|
||||
GLint getUniformLocation(const std::string& name) const;
|
||||
|
||||
GLuint program = 0;
|
||||
GLuint vertexShader = 0;
|
||||
GLuint fragmentShader = 0;
|
||||
};
|
||||
|
||||
} // namespace rendering
|
||||
} // namespace wowee
|
||||
Loading…
Add table
Add a link
Reference in a new issue