From ab30228b1a57053323363674fa7f137c0329a180 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Tue, 7 Jul 2020 23:12:04 -0300 Subject: Voltage heat map implemented Voltage heat map implemented using modern OpenGL =) New external library required: -GLEW -GLFW -GLM (incorporeted at the source) Old memory leaks fixed =) --- Project/Shader.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Project/Shader.h (limited to 'Project/Shader.h') diff --git a/Project/Shader.h b/Project/Shader.h new file mode 100644 index 0000000..2696f19 --- /dev/null +++ b/Project/Shader.h @@ -0,0 +1,42 @@ +#ifndef SHADER_H +#define SHADER_H + +#include +#include +#include + +#include + +struct ShaderSource +{ + std::string vertexShader = ""; + std::string fragmentShader = ""; +}; + +class Shader +{ +public: + Shader(const std::string& filepath); + ~Shader(); + + void Bind() const; + void Unbind() const; + + //Set uniforms + void SetUniform4f(const std::string& name, float v0, float v1, float v2, float v3); + void SetUniform2f(const std::string& name, float v0, float v1); + void SetUniformMatrix4fv(const std::string& name, const glm::mat4& matrix); + void SetUniform1f(const std::string& name, const float& value); + +protected: + unsigned int GetUniformLocation(const std::string& name); + unsigned int CompileShader(unsigned int type, const wxString& source) const; + unsigned int CreateShader(std::string& vertexShader, std::string& fragmentShader) const; + ShaderSource ParseShader(const wxString& filepath) const; + + unsigned int m_rendererID; + wxString m_filepath; + std::unordered_map m_uniformLocationCache; +}; + +#endif // SHADER_H -- cgit