From 7668adeb6953c6456bd1556b5d1af38799976b96 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 4 Mar 2009 11:41:07 +0000 Subject: [PATCH] Fix a bug on windows, and add Inverted filter --- direct/src/filter/CommonFilters.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/direct/src/filter/CommonFilters.py b/direct/src/filter/CommonFilters.py index a9a6d10671..b3d3cb2be7 100644 --- a/direct/src/filter/CommonFilters.py +++ b/direct/src/filter/CommonFilters.py @@ -54,7 +54,9 @@ class CommonFilters: def loadShader(self, name): fn = os.path.join(os.path.abspath(os.path.dirname(__file__)), name) - return Shader.load(Filename.fromOsSpecific(fn)) + fn = Filename.fromOsSpecific(fn) + fn.makeTrueCase() + return Shader.load(fn) def cleanup(self): self.manager.cleanup() @@ -176,6 +178,8 @@ class CommonFilters: text += "o_color = 1-((1-bloom)*(1-o_color));\n" if (configuration.has_key("ViewGlow")): text += "o_color.r = o_color.a;\n" + if (configuration.has_key("Inverted")): + text += "o_color = float4(1, 1, 1, 1) - o_color;\n" text += "}\n" self.finalQuad.setShader(Shader.make(text)) @@ -260,5 +264,14 @@ class CommonFilters: return self.reconfigure(True, "ViewGlow") return True - + def setInverted(self): + fullrebuild = (self.configuration.has_key("Inverted") == False) + self.configuration["Inverted"] = 1 + return self.reconfigure(fullrebuild, "Inverted") + + def delInverted(self): + if (self.configuration.has_key("Inverted")): + del self.configuration["Inverted"] + return self.reconfigure(True, "Inverted") + return True