room changes
This commit is contained in:
parent
8fae34b803
commit
38eaba2fa6
7 changed files with 2333 additions and 2108 deletions
53
world.lua
53
world.lua
|
|
@ -963,20 +963,61 @@ function World:drawRoomNeighborhood(room)
|
|||
local transform = self:roomNeighborhoodTransform(room)
|
||||
if not transform then return end
|
||||
self.drawingRoomNeighborhood = true
|
||||
local currentChannels = room:getRenderChannels()
|
||||
local roomWidth, roomHeight = width * transform.zoom, height * transform.zoom
|
||||
|
||||
local function drawAt(offsetX, offsetY, level, channels)
|
||||
love.graphics.push()
|
||||
love.graphics.translate(transform.originX + (offsetX + transform.cameraX) * roomWidth,
|
||||
transform.originY + (offsetY + transform.cameraY) * roomHeight)
|
||||
love.graphics.scale(transform.zoom, transform.zoom)
|
||||
level:draw(channels)
|
||||
love.graphics.pop()
|
||||
end
|
||||
|
||||
for roomY = -1, 1 do
|
||||
for roomX = -1, 1 do
|
||||
local name = self:roomAt(transform.location.x + roomX, transform.location.y + roomY)
|
||||
local adjacent = name and self.levels[name]
|
||||
if adjacent then
|
||||
love.graphics.push()
|
||||
love.graphics.translate(transform.originX + (roomX + transform.cameraX) * width * transform.zoom,
|
||||
transform.originY + (roomY + transform.cameraY) * height * transform.zoom)
|
||||
love.graphics.scale(transform.zoom, transform.zoom)
|
||||
adjacent:draw()
|
||||
love.graphics.pop()
|
||||
drawAt(roomX, roomY, adjacent)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Each cardinal neighbour receives a second, real render through the active
|
||||
-- colours in the current room. The shader only chooses a wispy portion of
|
||||
-- the shared visible margin, preserving all literal RGB passes and sprites.
|
||||
if porousRoomCanvas and porousRoomBoundaryShader and #currentChannels > 0 then
|
||||
local targetCanvas = love.graphics.getCanvas()
|
||||
local directions = {
|
||||
{ x = -1, y = 0 }, { x = 1, y = 0 }, { x = 0, y = -1 }, { x = 0, y = 1 },
|
||||
}
|
||||
for _, direction in ipairs(directions) do
|
||||
local name = self:roomAt(transform.location.x + direction.x, transform.location.y + direction.y)
|
||||
local adjacent = name and self.levels[name]
|
||||
if adjacent then
|
||||
love.graphics.setCanvas(porousRoomCanvas)
|
||||
love.graphics.clear(0, 0, 0, 0)
|
||||
drawAt(direction.x, direction.y, adjacent, currentChannels)
|
||||
|
||||
love.graphics.setCanvas(targetCanvas)
|
||||
local roomLeft = transform.originX + (direction.x + transform.cameraX) * roomWidth
|
||||
local roomTop = transform.originY + (direction.y + transform.cameraY) * roomHeight
|
||||
porousRoomBoundaryShader:send("porousTime", love.timer.getTime())
|
||||
porousRoomBoundaryShader:send("porousRoomRect", {roomLeft, roomTop, roomWidth, roomHeight})
|
||||
porousRoomBoundaryShader:send("porousDirection", {direction.x, direction.y})
|
||||
-- Exactly the amount of the neighbour exposed by the zoom-out.
|
||||
porousRoomBoundaryShader:send("porousDepth", (1 - transform.zoom) * width / 2)
|
||||
love.graphics.setBlendMode("alpha")
|
||||
love.graphics.setColor(1, 1, 1, 1)
|
||||
love.graphics.setShader(porousRoomBoundaryShader)
|
||||
love.graphics.draw(porousRoomCanvas, 0, 0)
|
||||
love.graphics.setShader()
|
||||
end
|
||||
end
|
||||
love.graphics.setBlendMode("screen")
|
||||
end
|
||||
self.drawingRoomNeighborhood = false
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue