More normal maps + temporary circling light behaviour
Getty Ritter
7 years ago
2023 | 2023 | { |
2024 | 2024 | id = 321, |
2025 | 2025 | properties = { |
2026 |
["pass"] = |
|
2026 | ["pass"] = false | |
2027 | 2027 | } |
2028 | 2028 | }, |
2029 | 2029 | { |
2030 | 2030 | id = 322, |
2031 | 2031 | properties = { |
2032 |
["pass"] = |
|
2032 | ["pass"] = false | |
2033 | 2033 | } |
2034 | 2034 | }, |
2035 | 2035 | { |
2036 | 2036 | id = 323, |
2037 | 2037 | properties = { |
2038 |
["pass"] = |
|
2038 | ["pass"] = false | |
2039 | 2039 | } |
2040 | 2040 | }, |
2041 | 2041 | { |
6349 | 6349 | rotation = 0, |
6350 | 6350 | visible = true, |
6351 | 6351 | properties = { |
6352 |
["signText"] = "Bonv |
|
6352 | ["signText"] = "Bonvenon al la kafejo!" | |
6353 | 6353 | } |
6354 | 6354 | }, |
6355 | 6355 | { |
56 | 56 | <objectgroup name="meta"> |
57 | 57 | <object id="2" x="96" y="72" width="24" height="24"> |
58 | 58 | <properties> |
59 |
<property name="signText" value="Bonv |
|
59 | <property name="signText" value="Bonvenon al la kafejo!"/> | |
60 | 60 | </properties> |
61 | 61 | </object> |
62 | 62 | <object id="3" x="288" y="144" width="24" height="24"> |
8 | 8 | |
9 | 9 | vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords) { |
10 | 10 | 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)); | |
12 | 11 | |
13 | vec2 r_coords = floor((texture_coords * 2048) + 0.5) / 2048; | |
14 | vec4 pixel = Texel(texture, r_coords); | |
15 |
vec4 |
|
12 | vec4 pixel = Texel(texture, texture_coords); | |
13 | vec4 normal = Texel(tex_nrm, texture_coords); | |
16 | 14 | |
17 | 15 | float l = max(dot(light_dir, normalize(normal)), 0.0); |
18 | 16 | vec3 col = vec3(pixel) * pow(l, 4.0); |
81 | 79 | love.graphics.rectangle('fill', 8, 8 + h, w - 16, h - 16) |
82 | 80 | love.graphics.setColor(0, 0, 0) |
83 | 81 | love.graphics.print(state.message, 12, h + 12) |
82 | love.graphics.setColor(255, 255, 255) | |
84 | 83 | end |
85 | 84 | |
86 | 85 | -- now the same, but with normals |
132 | 131 | end |
133 | 132 | |
134 | 133 | -- print the debug message |
135 | -- love.graphics.setColor(255, 255, 255) | |
136 | -- love.graphics.print(debug, 8, 8) | |
137 | 134 | |
138 | 135 | love.graphics.setCanvas() |
139 | 136 | -- blank out the screen |
146 | 143 | |
147 | 144 | love.graphics.setShader(normalMapper) |
148 | 145 | 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))) | |
151 | 148 | -- blit the smaller canvas back onto the larger screen |
152 |
love.graphics.draw(state.canvas, 0, 0, 0, |
|
149 | love.graphics.draw(state.canvas, 0, 0, 0, 3, 3) | |
153 | 150 | love.graphics.setShader() |
154 | 151 | |
155 | 152 | end |
44 | 44 | state.spritesheet = love.graphics.newImage('tiles/spritesheet.png') |
45 | 45 | state.spriteNormals = love.graphics.newImage('tiles/spritesheet-normal.png') |
46 | 46 | |
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) | |
49 | 49 | |
50 | 50 | love.graphics.setNewFont('font.ttf', 16) |
51 | 51 | end |
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown