Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify ShaderManager API #158

Closed
bitbrain opened this issue Oct 10, 2018 · 0 comments
Closed

Simplify ShaderManager API #158

bitbrain opened this issue Oct 10, 2018 · 0 comments

Comments

@bitbrain
Copy link
Owner

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
@bitbrain bitbrain added this to the Version 1.0.0 (Initial Release) milestone Oct 10, 2018
@bitbrain bitbrain added this to Icebox in Core via automation Oct 10, 2018
Core automation moved this from Icebox to Deployed Oct 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Core
  
Deployed
Development

No branches or pull requests

1 participant