Initial commit
This commit is contained in:
commit
edfc5298e1
252 changed files with 93965 additions and 0 deletions
54
include/Spectre/Graphics/Shader.h
Normal file
54
include/Spectre/Graphics/Shader.h
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
|
||||
#ifndef SPECTRE_GRAPHICS_SHADER_H
|
||||
#define SPECTRE_GRAPHICS_SHADER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
class Shader
|
||||
{
|
||||
public :
|
||||
enum Type {
|
||||
Vertex,
|
||||
Fragment
|
||||
};
|
||||
|
||||
Shader(Type type, const std::string& name = "");
|
||||
~Shader();
|
||||
|
||||
unsigned int getHandle() const;
|
||||
|
||||
const std::string& getName() const;
|
||||
|
||||
// Load shader from file.
|
||||
bool loadFromFile(const std::string& file);
|
||||
|
||||
// Load shader from memory
|
||||
bool loadFromMemory(const std::string& source);
|
||||
|
||||
const std::string& getError() const;
|
||||
|
||||
// Is this shader compiled?
|
||||
bool isCompiled() const;
|
||||
|
||||
protected :
|
||||
|
||||
// Compile the shader.
|
||||
// Returns true if the shader compiled without errors. false otherwise.
|
||||
bool compile();
|
||||
|
||||
std::string fetchErrorLog();
|
||||
|
||||
protected :
|
||||
|
||||
// Type of shader. Vertex, fragment, geometry etc.
|
||||
Type m_type;
|
||||
|
||||
unsigned int m_handle; // Shader id.
|
||||
|
||||
// A name for the shader (usually the filename if loaded from file).
|
||||
std::string m_name;
|
||||
|
||||
std::string m_error;
|
||||
};
|
||||
|
||||
#endif /* SPECTRE_GRAPHICS_SHADER_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue