From 1aecfab7ce9a7d25ba0ecf9525bd1058ca2b1ba0 Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 20 Dec 2018 23:53:26 +0800 Subject: *misc --- src/libjin-lua/embed/scripts/graphics/graphics.lua | 27 +++++++++++++++------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'src/libjin-lua/embed/scripts/graphics/graphics.lua') diff --git a/src/libjin-lua/embed/scripts/graphics/graphics.lua b/src/libjin-lua/embed/scripts/graphics/graphics.lua index ffa84db..d625249 100644 --- a/src/libjin-lua/embed/scripts/graphics/graphics.lua +++ b/src/libjin-lua/embed/scripts/graphics/graphics.lua @@ -27,15 +27,12 @@ jg.SpriteMode = { } -- Built in shaders -jg.Shaders = { - Font = nil, - Texture = nil, - Sprite = nil, - SpriteSheet = nil, - Default = nil -} - +jg.Shaders = nil local function compileBuiltInShaders() + if jg.Shaders ~= nil then + return + end + jg.Shaders = {} jg.Shaders.Font = jg.newShader[[ #VERTEX_SHADER Vertex vert(Vertex v) @@ -106,6 +103,20 @@ local function compileBuiltInShaders() } #END_FRAGMENT_SHADER ]] + jg.Shaders.Shape = jg.newShader[[ + #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 + ]] end local _init = jg.init -- cgit v1.1-26-g67d0