From bda9d88e84a1dccd4df978205a6ba1f141178b0c Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 19 May 2018 00:09:44 +0800 Subject: =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=9E=82=E7=9B=B4=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/main.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'bin/main.lua') diff --git a/bin/main.lua b/bin/main.lua index ca3108c..11af7fd 100644 --- a/bin/main.lua +++ b/bin/main.lua @@ -8,7 +8,7 @@ vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 pixel_coords) vec3 light_vec = vec3(mouse,1); vec3 light_direction = light_vec - vec3(pixel_coords, 0); float distance = length(light_direction); - light_direction = normalize(light_direction) * abs(sin(i)); + light_direction = normalize(light_direction); vec3 normal = Texel(texture, texture_coords).xyz; normal.y = 1 - normal.y; @@ -58,16 +58,17 @@ jin.core.onEvent = function(e) end end local mx, my -jin.core.onUpdate = function() +jin.core.onUpdate = function(dt) mx, my = jin.mouse.position() mx = mx / 2 my = my / 2 - my = wh - my + my = wh - my end img:setAnchor(16, 16) local cvs = jg.Canvas(320, 240) local i = 0 jin.core.onDraw = function() +-- if true then return end i = i + 0.1 jg.bind(cvs) jg.use(effect) -- cgit v1.1-26-g67d0