improvement(boxes): don't export as a texture the shadow canvas

As now the canvas drawing isn't affected by the transform, it should be 
safe to not export it as a texture anymore.
This commit is contained in:
Kazhnuz 2019-07-15 10:11:11 +02:00
parent 79aff589b9
commit 932ec26283

View file

@ -40,7 +40,7 @@ function Box3D:new(owner, w, h, d)
self.texture = {}
self:setTopTexture()
self:setBottomTexture()
self.texture.shadows = nil
self.texture.shadows = love.graphics.newCanvas(self.w, self.h)
self:register()
end
@ -123,19 +123,14 @@ end
function Box3D:redrawShadowCanvas()
if (self.needRedraw) then
local canvas = love.graphics.newCanvas(self.w, self.h)
love.graphics.setCanvas( canvas )
love.graphics.setCanvas( self.texture.shadows )
love.graphics.clear()
for i,v in ipairs(self.shadowSources) do
v.actor:drawShadow(v.x, v.y)
end
love.graphics.setCanvas( )
local imagedata = canvas:newImageData()
self.texture.shadows = love.graphics.newImage( imagedata )
imagedata:release()
canvas:release()
self.needRedraw = false
end
end