From 932ec262838bef36e0d739fcccc34a90d6f49491 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Mon, 15 Jul 2019 10:11:11 +0200 Subject: [PATCH] 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. --- gamecore/modules/world/actors/utils/boxes/parent.lua | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/gamecore/modules/world/actors/utils/boxes/parent.lua b/gamecore/modules/world/actors/utils/boxes/parent.lua index d8538c6..9ae975a 100644 --- a/gamecore/modules/world/actors/utils/boxes/parent.lua +++ b/gamecore/modules/world/actors/utils/boxes/parent.lua @@ -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