From 91b914bc0eb97a76f2c3a1caa64fdfde29ca16a1 Mon Sep 17 00:00:00 2001 From: sanine-a Date: Fri, 18 Dec 2020 20:20:26 -0600 Subject: add draw filtering and alpha to SpatialShader output --- demo/Node.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'demo/Node.lua') diff --git a/demo/Node.lua b/demo/Node.lua index 7bd1ad5..6177fc5 100644 --- a/demo/Node.lua +++ b/demo/Node.lua @@ -32,14 +32,15 @@ Node.prototype.updateCascade = function(self, dt) end end -Node.prototype.drawCascade = function(self, camera, shader) - if self.draw then +Node.prototype.drawCascade = function(self, camera, shader, filter) + filter = filter or function(node) return true end + if self.draw and filter(self) then self:draw(camera, shader) end -- do not draw base nodes, but recursively draw children. for _, child in ipairs(self.children) do - child:drawCascade(camera, shader) + child:drawCascade(camera, shader, filter) end end -- cgit v1.2.1