aboutsummaryrefslogtreecommitdiff
path: root/src/lua/embed/graphics.lua.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-10-05 15:40:31 +0800
committerchai <chaifix@163.com>2018-10-05 15:40:31 +0800
commit789895b4b9f99668b8b772f271d07d1ce3115742 (patch)
tree3ae85381358445b2c29c9a0afb59375de9a7ce66 /src/lua/embed/graphics.lua.h
parent846d6ab0ec1033481574e8324a43fc547ecf5882 (diff)
*update
Diffstat (limited to 'src/lua/embed/graphics.lua.h')
-rw-r--r--src/lua/embed/graphics.lua.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/lua/embed/graphics.lua.h b/src/lua/embed/graphics.lua.h
index 1414efc..1bad4f5 100644
--- a/src/lua/embed/graphics.lua.h
+++ b/src/lua/embed/graphics.lua.h
@@ -1,4 +1,37 @@
/* graphics.lua */
static const char* graphics_lua = R"(
jin.graphics = jin.graphics or {}
+
+local default_shader = nil
+local default_shader_source = [[
+#VERTEX_SHADER
+
+Vertex vert(Vertex v)
+{
+ return v;
+}
+
+#END_VERTEX_SHADER
+
+#FRAGMENT_SHADER
+
+Color frag(Color col, Texture tex, Vertex v)
+{
+ return col;
+}
+
+#END_FRAGMENT_SHADER
+]]
+local _init = jin.graphics.init
+
+jin.graphics.init = function(setting)
+ _init(setting);
+ default_shader = jin.graphics.newShader(default_shader_source)
+ jin.graphics.useShader(default_shader)
+end
+
+jin.graphics.unuseShader = function()
+ jin.graphics.useShader(default_shader)
+end
+
)";