projects
/
demo
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Changed the OpenGL part and the GLSL shaders to use UBO and
[demo]
/
src
/
shader.h
diff --git
a/src/shader.h
b/src/shader.h
index
1472fb3
..
5a79b7f
100644
(file)
--- a/
src/shader.h
+++ b/
src/shader.h
@@
-1,6
+1,17
@@
#ifndef SHADER_H_
#define SHADER_H_
#ifndef SHADER_H_
#define SHADER_H_
+#include <vulkan/vulkan.h>
+
+#include <vector>
+#include <string>
+
+#include <gmath/gmath.h>
+
+/*
+ Shader class
+*/
+
enum SType {
SDR_UNKNOWN,
SDR_VERTEX,
enum SType {
SDR_UNKNOWN,
SDR_VERTEX,
@@
-9,19
+20,23
@@
enum SType {
class Shader {
protected:
class Shader {
protected:
+ SType type;
+ std::string name;
+
virtual bool create(char *buf, unsigned int bsz, const char *fname) = 0;
public:
virtual bool create(char *buf, unsigned int bsz, const char *fname) = 0;
public:
- SType type;
Shader();
virtual ~Shader() = 0;
Shader();
virtual ~Shader() = 0;
- virtual void destroy() = 0;
virtual bool load(const char *fname, SType type);
virtual bool load(const char *fname, SType type);
- virtual void attach(unsigned int prog) = 0; // if vulkan -> leave empty
+ virtual void destroy() = 0;
+ virtual SType get_type();
};
};
+/* Shader Program */
+
class ShaderProgram {
protected:
Shader *shaders[2];
class ShaderProgram {
protected:
Shader *shaders[2];
@@
-30,9
+45,11
@@
public:
ShaderProgram();
virtual ~ShaderProgram();
ShaderProgram();
virtual ~ShaderProgram();
- virtual void add_shader(Shader *sdr);
+ virtual bool create() = 0;
virtual bool link() = 0;
virtual bool link() = 0;
- virtual bool load(const char *vfname, const char *ffname) = 0;
+ virtual bool use() const = 0;
+ virtual void destroy() = 0;
+ virtual void attach_shader(Shader *shader) = 0;
};
#endif // SHADER_H_
};
#endif // SHADER_H_