local ShadowRenderSystem = inherited("ShadowRenderSystem", SystemMap)

function ShadowRenderSystem:new()
	local ms = instance(self)
	return ms
end

function ShadowRenderSystem:wants(ent)
	return ent.aspects.shadow_render
end

function ShadowRenderSystem:ent_added(ent)
	ent.rx = ent.x
	ent.ry = ent.y
	ent.rz = ent.z
end

function ShadowRenderSystem:ent_removed(ent)
end

function ShadowRenderSystem:render(x, y, scale, perspective, angle, a, r, g, b)
	for ent, _ in pairs(self.ents) do
		local rx = x + ent.rx*scale
		local ry = y + ent.ry*scale*perspective
		ent:render_shadow(rx, ry, scale, perspective, angle, a, r, g, b)
	end
end

return ShadowRenderSystem