diff options
author | chai <chaifix@163.com> | 2018-12-21 19:02:22 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-12-21 19:02:22 +0800 |
commit | 84a663cb70b057a5ce0c9ff1910bc2eb9c0ba653 (patch) | |
tree | 625d2a7804c6f29aac367098972f96a47fcb7ae3 /src/libjin-lua/embed/scripts/graphics/graphics.lua | |
parent | 90cd4ff40e647e4150638e69f80ac587ceff1631 (diff) |
+2d mesh
Diffstat (limited to 'src/libjin-lua/embed/scripts/graphics/graphics.lua')
-rw-r--r-- | src/libjin-lua/embed/scripts/graphics/graphics.lua | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/libjin-lua/embed/scripts/graphics/graphics.lua b/src/libjin-lua/embed/scripts/graphics/graphics.lua index a0efe03..8b16a35 100644 --- a/src/libjin-lua/embed/scripts/graphics/graphics.lua +++ b/src/libjin-lua/embed/scripts/graphics/graphics.lua @@ -103,6 +103,21 @@ local function compileBuiltInShaders() } #END_FRAGMENT_SHADER ]] + jg.Shaders.Mesh = jg.newShader[[ + #VERTEX_SHADER + in Vec4 color; + Vertex vert(Vertex v) + { + return v; + } + #END_VERTEX_SHADER + #FRAGMENT_SHADER + Color frag(Color col, Texture tex, Vertex v) + { + return col * texel(tex, v.uv) * v.color; + } + #END_FRAGMENT_SHADER + ]] jg.Shaders.Default = jg.newShader[[ #VERTEX_SHADER Vertex vert(Vertex v) @@ -116,7 +131,7 @@ local function compileBuiltInShaders() return col * texel(tex, v.uv); } #END_FRAGMENT_SHADER - ]] + ]] end local _init = jg.init @@ -128,13 +143,13 @@ jg.init = function(setting) initialized = _init(setting) if initialized then compileBuiltInShaders() - jg.useShader(jg.Shaders.Font) + jg.useShader(jg.Shaders.Default) end return initialized end jg.unuseShader = function() - jg.useShader(jg.Shaders.Font) + jg.useShader(jg.Shaders.Default) end -- Reset all attributes to default value. |