From d359091842c04ea25d5412fc86d344a0facbb1ee Mon Sep 17 00:00:00 2001 From: "rem..om" Date: Tue, 16 Oct 2012 21:45:14 +0000 Subject: [PATCH] FilterPostProcessor filters list can now be fetched as an unmodifiable list FilterPostProcessor has now a getFilter(filterType) method git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9869 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../com/jme3/post/FilterPostProcessor.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/engine/src/core/com/jme3/post/FilterPostProcessor.java b/engine/src/core/com/jme3/post/FilterPostProcessor.java index d3ffddced..8c9b81ba0 100644 --- a/engine/src/core/com/jme3/post/FilterPostProcessor.java +++ b/engine/src/core/com/jme3/post/FilterPostProcessor.java @@ -43,6 +43,7 @@ import com.jme3.ui.Picture; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -519,4 +520,27 @@ public class FilterPostProcessor implements SceneProcessor, Savable { public Texture2D getFilterTexture() { return filterTexture; } + + /** + * returns the first filter in the list assignable form the given type + * @param + * @param filterType the filter type + * @return a filter assignable form the given type + */ + public T getFilter(Class filterType) { + for (Filter c : filters) { + if (filterType.isAssignableFrom(c.getClass())) { + return (T) c; + } + } + return null; + } + + /** + * returns an unmodifiable version of the filter list. + * @return the filters list + */ + public List getFilterList(){ + return Collections.unmodifiableList(filters); + } }