aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/Shader.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libjin/Graphics/Shader.h')
-rw-r--r--src/libjin/Graphics/Shader.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/libjin/Graphics/Shader.h b/src/libjin/Graphics/Shader.h
new file mode 100644
index 0000000..24c889d
--- /dev/null
+++ b/src/libjin/Graphics/Shader.h
@@ -0,0 +1,54 @@
+#ifndef __JIN_JSL_H
+#define __JIN_JSL_H
+#include "../modules.h"
+#if JIN_MODULES_RENDER
+
+#include <string>
+#include <map>
+#include "color.h"
+#include "texture.h"
+#include "canvas.h"
+#include "../3rdparty/GLee/GLee.h"
+
+namespace jin
+{
+namespace graphics
+{
+
+ /* Jin Shader Language Program*/
+ class JSLProgram
+ {
+ public:
+ static JSLProgram* createJSLProgram(const char* program);
+ static inline JSLProgram* getCurrentJSL() { return currentJSLProgram; }
+ static void unuse();
+
+ virtual ~JSLProgram();
+
+ void use();
+ void sendFloat(const char* name, float number);
+ void sendTexture(const char* name, const Texture* image);
+ void sendVec2(const char* name, float x, float y);
+ void sendVec3(const char* name, float x, float y, float z);
+ void sendVec4(const char* name, float x, float y, float z, float w);
+ void sendCanvas(const char* name, const Canvas* canvas);
+ void sendColor(const char* name, const color* col);
+
+ protected:
+ GLint claimTextureUnit(const std::string& name);
+ JSLProgram(const char* program);
+ void bindDefaultTex();
+
+ static JSLProgram* currentJSLProgram;
+
+ GLuint pid;
+ GLint currentTextureUnit;
+ std::map<std::string, GLint> textureUnits;
+
+ };
+
+} // graphics
+} // jin
+
+#endif // JIN_MODULES_RENDER
+#endif // __JIN_JSL_H \ No newline at end of file