added wireframe cube
This commit is contained in:
parent
8f8592e0b5
commit
5e53c905a8
12 changed files with 233 additions and 59 deletions
35
src/backend/Shader.hpp
Normal file
35
src/backend/Shader.hpp
Normal file
|
@ -0,0 +1,35 @@
|
|||
#pragma once
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
class AbstractShader
|
||||
{
|
||||
friend class ShaderFactory;
|
||||
|
||||
public:
|
||||
AbstractShader(const std::string& vertexShader, const std::string& fragmentShader);
|
||||
AbstractShader(const AbstractShader& other) = delete;
|
||||
~AbstractShader();
|
||||
|
||||
inline bool Good() { return id != 0; }
|
||||
void Use();
|
||||
|
||||
void SetUniform(const std::string& name, const glm::mat4& value);
|
||||
|
||||
private:
|
||||
unsigned int id;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<AbstractShader> Shader;
|
||||
|
||||
class ShaderFactory
|
||||
{
|
||||
public:
|
||||
inline static Shader Produce(const std::string& vertexShader, const std::string& fragmentShader)
|
||||
{
|
||||
return std::make_shared<AbstractShader>(vertexShader, fragmentShader);
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue