-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShader.h
33 lines (31 loc) · 1.29 KB
/
Shader.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#pragma once
#include<string>
#include <glm/glm.hpp>
class Shader
{
private:
// 程序ID
unsigned int ID;
// 检测编译错误
void checkCompileErrors(unsigned int shader, std::string type);
public:
// 构造器读取并构建着色器
Shader(const char* vertexPath, const char* fragmentPath);
Shader(const char* vertexPath, const char* fragmentPath, const char* geometryPath);
// 使用/激活程序
void use();
// uniform工具函数
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 setVec2(const std::string& name, const glm::vec2& value) const;
void setVec2(const std::string& name, float x, float y) const;
void setVec3(const std::string& name, const glm::vec3& value) const;
void setVec3(const std::string& name, float x, float y, float z) const;
void setVec4(const std::string& name, const glm::vec4& value) const;
void setVec4(const std::string& name, float x, float y, float z, float w) const;
void setMat2(const std::string& name, const glm::mat2& mat) const;
void setMat3(const std::string& name, const glm::mat3& mat) const;
void setMat4(const std::string& name, const glm::mat4& mat) const;
unsigned getID();
};