Add powered neon wire rendering
This commit is contained in:
parent
cb1b5006b9
commit
17140fe39f
4 changed files with 71 additions and 0 deletions
9
room.lua
9
room.lua
|
|
@ -239,12 +239,21 @@ function Room:drawWiresAt(originX, originY, cellSize, selectedCircuit, editorCol
|
|||
for _, line in ipairs(lines) do love.graphics.line(line) end
|
||||
local wireBlend = (editorColors or not switchColors) and "alpha" or "screen"
|
||||
love.graphics.setBlendMode(wireBlend)
|
||||
local previousShader = love.graphics.getShader()
|
||||
if not editorColors and switchColors and wireNeonShader then
|
||||
local powered = gameWorld:wirePoweredAt(self, localCell, circuitId)
|
||||
wireNeonShader:send("wirePower", powered and 1 or 0)
|
||||
wireNeonShader:send("wireTime", love.timer.getTime())
|
||||
wireNeonShader:send("wirePhase", (#circuitId * 0.137) + x * 0.071 + y * 0.113)
|
||||
love.graphics.setShader(wireNeonShader)
|
||||
end
|
||||
love.graphics.setLineWidth(math.max(1, cellSize * 0.045))
|
||||
for _, color in ipairs(drawColors) do
|
||||
love.graphics.setColor(color[1], color[2], color[3], selected and 1 or 0.32)
|
||||
for _, line in ipairs(lines) do love.graphics.line(line) end
|
||||
love.graphics.circle("fill", cx, cy, math.max(0.75, cellSize * 0.0275))
|
||||
end
|
||||
love.graphics.setShader(previousShader)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue