Browse Source

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

rem..om 13 years ago
parent
commit
d359091842
1 changed files with 24 additions and 0 deletions
  1. 24 0
      engine/src/core/com/jme3/post/FilterPostProcessor.java

+ 24 - 0
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 <T> 
+     * @param filterType the filter type
+     * @return a filter assignable form the given type 
+     */
+    public <T extends Filter> T getFilter(Class<T> 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<Filter> getFilterList(){
+        return Collections.unmodifiableList(filters);
+    }
 }