It is currently too complicated to configure shaders. Exposing the internal shader via getInternalEffect() is dangerous, since people might not use the decorator effect. Instead, remove the getInternalEffect() method and do this:
public interface Mutator<T> {
void mutate(T target);
}
And then:
AutoReloadPostprocessorEffect<Blur> effect = shaderManager.createBlur(
new Mutator<Blur>() {
@Override
public void mutate(Blur blur) {
// mutate blur here
}
}
);
Additionally, all effects should have a new method called mutate(Mutator<T> t) which allows setting/changing the internal shader.
This gives us several advantages:
we always set values on the current effect object
initialization becomes more clear
users are forced to use the decorator which avoids potential bugs
It is currently too complicated to configure shaders. Exposing the internal shader via
getInternalEffect()
is dangerous, since people might not use the decorator effect. Instead, remove thegetInternalEffect()
method and do this:And then:
Additionally, all effects should have a new method called
mutate(Mutator<T> t)
which allows setting/changing the internal shader.This gives us several advantages: