gdritter repos animaltransiro / d7e8a71
More normal maps + temporary circling light behaviour Getty Ritter 7 years ago
8 changed file(s) with 13 addition(s) and 16 deletion(s). Collapse all Expand all
20232023 {
20242024 id = 321,
20252025 properties = {
2026 ["pass"] = true
2026 ["pass"] = false
20272027 }
20282028 },
20292029 {
20302030 id = 322,
20312031 properties = {
2032 ["pass"] = true
2032 ["pass"] = false
20332033 }
20342034 },
20352035 {
20362036 id = 323,
20372037 properties = {
2038 ["pass"] = true
2038 ["pass"] = false
20392039 }
20402040 },
20412041 {
63496349 rotation = 0,
63506350 visible = true,
63516351 properties = {
6352 ["signText"] = "Bonvolu al la kafejo!"
6352 ["signText"] = "Bonvenon al la kafejo!"
63536353 }
63546354 },
63556355 {
5656 <objectgroup name="meta">
5757 <object id="2" x="96" y="72" width="24" height="24">
5858 <properties>
59 <property name="signText" value="Bonvolu al la kafejo!"/>
59 <property name="signText" value="Bonvenon al la kafejo!"/>
6060 </properties>
6161 </object>
6262 <object id="3" x="288" y="144" width="24" height="24">
88
99 vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords) {
1010 vec4 light_dir = normalize(vec4(lightX, lightY, 1.0, 1.0));
11 // vec4 light_dir = normalize(light_pos - vec4(texture_coords, 0.0, 0.0));
1211
13 vec2 r_coords = floor((texture_coords * 2048) + 0.5) / 2048;
14 vec4 pixel = Texel(texture, r_coords);
15 vec4 normal = Texel(tex_nrm, r_coords);
12 vec4 pixel = Texel(texture, texture_coords);
13 vec4 normal = Texel(tex_nrm, texture_coords);
1614
1715 float l = max(dot(light_dir, normalize(normal)), 0.0);
1816 vec3 col = vec3(pixel) * pow(l, 4.0);
8179 love.graphics.rectangle('fill', 8, 8 + h, w - 16, h - 16)
8280 love.graphics.setColor(0, 0, 0)
8381 love.graphics.print(state.message, 12, h + 12)
82 love.graphics.setColor(255, 255, 255)
8483 end
8584
8685 -- now the same, but with normals
132131 end
133132
134133 -- print the debug message
135 -- love.graphics.setColor(255, 255, 255)
136 -- love.graphics.print(debug, 8, 8)
137134
138135 love.graphics.setCanvas()
139136 -- blank out the screen
146143
147144 love.graphics.setShader(normalMapper)
148145 normalMapper:send('tex_nrm', state.normals)
149 normalMapper:send('lightX', (state.t % 500) / 500.0)
150 normalMapper:send('lightY', 1.0)
146 normalMapper:send('lightX', 0.5 + (0.5 * math.sin(state.t / 50)))
147 normalMapper:send('lightY', 0.5 + (0.5 * math.cos(state.t / 50)))
151148 -- blit the smaller canvas back onto the larger screen
152 love.graphics.draw(state.canvas, 0, 0, 0, 2, 2)
149 love.graphics.draw(state.canvas, 0, 0, 0, 3, 3)
153150 love.graphics.setShader()
154151
155152 end
4444 state.spritesheet = love.graphics.newImage('tiles/spritesheet.png')
4545 state.spriteNormals = love.graphics.newImage('tiles/spritesheet-normal.png')
4646
47 love.window.setMode(consts.tileSize * consts.boardWidth * 2,
48 consts.tileSize * consts.boardHeight * 2)
47 love.window.setMode(consts.tileSize * consts.boardWidth * 3,
48 consts.tileSize * consts.boardHeight * 3)
4949
5050 love.graphics.setNewFont('font.ttf', 16)
5151 end
Binary diff not shown
Binary diff not shown