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
This commit is contained in:
parent
8430864ce6
commit
d359091842
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user