X-Git-Url: http://git.mutantstargoat.com?a=blobdiff_plain;f=src%2Fshader.h;h=491eea89c6009c0f5c9308a429a084b6a8636975;hb=86c912d603be75ac8b2fdb2229f1696e9c0c01d9;hp=28832f68a11dfe1a81ac4df9fa62209d8521f7f0;hpb=826b0cf7adaf8b1dc4c37f57a4a98c79a3995e21;p=demo diff --git a/src/shader.h b/src/shader.h index 28832f6..491eea8 100644 --- a/src/shader.h +++ b/src/shader.h @@ -1,7 +1,16 @@ #ifndef SHADER_H_ #define SHADER_H_ -enum SType { +#include + +#include +#include + +#include + +class Texture; + +enum ShaderType { SDR_UNKNOWN, SDR_VERTEX, SDR_FRAGMENT @@ -9,19 +18,22 @@ enum SType { class Shader { protected: + ShaderType type; + std::string name; + virtual bool create(char *buf, unsigned int bsz, const char *fname) = 0; public: - SType type; - Shader(); virtual ~Shader() = 0; + virtual bool load(const char *fname, ShaderType type); virtual void destroy() = 0; - virtual bool load(const char *fname, SType type); - virtual void attach(unsigned int prog) = 0; // if vulkan -> leave empty + virtual ShaderType get_type(); }; +/* Shader Program */ + class ShaderProgram { protected: Shader *shaders[2]; @@ -30,14 +42,11 @@ public: ShaderProgram(); virtual ~ShaderProgram(); - virtual void add_shader(Shader *sdr); + virtual bool create() = 0; virtual bool link() = 0; - virtual bool load(const char *vfname, const char *ffname) = 0; - virtual void use() = 0; - - /* 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. */ + virtual bool use() const = 0; + virtual void destroy() = 0; + virtual void attach_shader(Shader *shader) = 0; }; #endif // SHADER_H_