diff options
author | chai <chaifix@163.com> | 2018-09-08 18:42:59 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-09-08 18:42:59 +0800 |
commit | 48bc9493064d8fcdd8b18a4ad72552a01b64688d (patch) | |
tree | 80122c56bc80f27937cf227e2e995cd08498a627 /shader/main.lua | |
parent | c182b89694ea4e612fd2c76aea4e3234b43c9116 (diff) |
*update
Diffstat (limited to 'shader/main.lua')
-rw-r--r-- | shader/main.lua | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/shader/main.lua b/shader/main.lua index 39679b8..8b13789 100644 --- a/shader/main.lua +++ b/shader/main.lua @@ -1,50 +1 @@ -io.stdout:setvbuf("no") -local shader -local img -local img2 -local canvas -local sw, sh = jin.graphics.getSize() -function jin.core.onLoad() - local str = jin.filesystem.read("metaball.shader") - shader = jin.graphics.newShader(str) - local bitmap = jin.graphics.newBitmap("img.png") - local blackImg = jin.graphics.newBitmap(20, 20) - -- local bitmap2 = jin.graphics.newBitmap("img2.bmp") - img = jin.graphics.newTexture(blackImg) - -- img2 = jin.graphics.newTexture(bitmap2) - canvas = jin.graphics.newCanvas(200, 200) -end --- extern vec3 iResolution; --- extern number iGlobalTime; --- extern vec4 iMouse; -local mx, my = 0, 0 -function jin.core.onEvent(e) - if e.type == "Quit" then - jin.core.stop() - end - if e.type == "KeyDown" then - if e.key == "Escape" then - jin.core.stop() - end - end - if e.type == "MouseMotion" then - -- if e.button == "left" then - mx = e.x - my = e.y - -- end - end -end -local dt = 0 -function jin.core.onDraw() - dt = dt + 0.1 - jin.graphics.bindCanvas(canvas) - jin.graphics.useShader(shader) - shader:sendNumber("iGlobalTime", dt ) - shader:sendVec3("iResolution", sw, sh, 1) - shader:sendVec4("iMouse", mx, my, mx, my) - jin.graphics.draw(img, 0, 0, 1, 1) - jin.graphics.unuseShader() - jin.graphics.unbindCanvas() - jin.graphics.draw(canvas, 0, 0, 5, 5) -end
\ No newline at end of file |