When writing the X11 (linux) implementation there was a problem with X11 defining a "Display" type and we also have a Display class in the engine. So to fix that problem and minimize the risk for running into other name conflicts. We move everything from global namespace.
58 lines
No EOL
1,004 B
C++
58 lines
No EOL
1,004 B
C++
|
|
#ifndef SPECTRE_GRAPHICS_SHADER_H
|
|
#define SPECTRE_GRAPHICS_SHADER_H
|
|
|
|
#include <string>
|
|
|
|
namespace sp {
|
|
|
|
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;
|
|
};
|
|
|
|
} // namespace sp
|
|
|
|
#endif /* SPECTRE_GRAPHICS_SHADER_H */ |