From 500491e6c92b6a3b552a59cbe4359367a9934f8b Mon Sep 17 00:00:00 2001 From: loonaticx Date: Sat, 1 Jan 2022 15:20:57 +0100 Subject: [PATCH] CommonFilters: Documentation adjustments * State that we're using Cg shaders, ideal for clarification. * Commented out Josh's monologue since it doesn't particularly contribute to the API page * Added documentation to the setBloom function to help clarify. Closes #1200 Co-authored-by: rdb --- direct/src/filter/CommonFilters.py | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/direct/src/filter/CommonFilters.py b/direct/src/filter/CommonFilters.py index 26601ced2e..25715d7167 100644 --- a/direct/src/filter/CommonFilters.py +++ b/direct/src/filter/CommonFilters.py @@ -1,21 +1,21 @@ """ - Class CommonFilters implements certain common image postprocessing filters. See the :ref:`common-image-filters` page for more information about how to use these filters. -It is not ideal that these filters are all included in a single -monolithic module. Unfortunately, when you want to apply two filters -at the same time, you have to compose them into a single shader, and -the composition process isn't simply a question of concatenating them: -you have to somehow make them work together. I suspect that there -exists some fairly simple framework that would make this automatable. -However, until I write some more filters myself, I won't know what -that framework is. Until then, I'll settle for this -clunky approach. - Josh - +These filters are written in the Cg shading language. """ +# It is not ideal that these filters are all included in a single +# monolithic module. Unfortunately, when you want to apply two filters +# at the same time, you have to compose them into a single shader, and +# the composition process isn't simply a question of concatenating them: +# you have to somehow make them work together. I suspect that there +# exists some fairly simple framework that would make this automatable. +# However, until I write some more filters myself, I won't know what +# that framework is. Until then, I'll settle for this +# clunky approach. - Josh + from .FilterManager import FilterManager from .filterBloomI import BLOOM_I from .filterBloomX import BLOOM_X @@ -459,6 +459,11 @@ class CommonFilters: return True def setBloom(self, blend=(0.3,0.4,0.3,0.0), mintrigger=0.6, maxtrigger=1.0, desat=0.6, intensity=1.0, size="medium"): + """ + Applies the Bloom filter to the output. + size can either be "off", "small", "medium", or "large". + Setting size to "off" will remove the Bloom filter. + """ if (size==0): size="off" elif (size==1): size="small" elif (size==2): size="medium" @@ -542,7 +547,7 @@ class CommonFilters: return True def setBlurSharpen(self, amount=0.0): - """Enables the blur/sharpen filter. If the 'amount' parameter is 1.0, it will not have effect. + """Enables the blur/sharpen filter. If the 'amount' parameter is 1.0, it will not have any effect. A value of 0.0 means fully blurred, and a value higher than 1.0 sharpens the image.""" fullrebuild = (("BlurSharpen" in self.configuration) == False) self.configuration["BlurSharpen"] = amount