#define SHADER_H_
enum SType {
+ SDR_UNKNOWN,
SDR_VERTEX,
SDR_FRAGMENT
};
class Shader {
-private:
- SType type;
+protected:
+ virtual bool create(char *buf, unsigned int bsz, const char *fname) = 0;
public:
+ SType type;
+
Shader();
- ~Shader();
+ virtual ~Shader() = 0;
+ virtual void destroy() = 0;
virtual bool load(const char *fname, SType type);
+ virtual void attach(unsigned int prog) = 0; // if vulkan -> leave empty
};
class ShaderProgram {
-private:
+protected:
Shader *shaders[2];
public:
ShaderProgram();
- virtual ~ShaderProgram() = 0;
+ virtual ~ShaderProgram();
+
+ virtual void add_shader(Shader *sdr);
+ virtual bool link() = 0;
+ virtual bool load(const char *vfname, const char *ffname) = 0;
+ virtual void use() = 0;
- void add_shader(Shader *sdr, SType type);
- bool link();
- void bind();
+ /* THIS PART IS GOING TO BE CHANGED: on vulkan we set the uniforms
+ using descriptor sets. The current design is suitable for OpenGL and
+ it has to become more generic to work with both APIs later. */
};
#endif // SHADER_H_