libgdx/libgdx — pull request #481 by xoppa (2013-06-19 22:42:47+00:00)
Title: BaseShader various changes

Add Shader#init() and separate it from the constructor. This allows to easier extend a shader.

Introduce BaseShader#Input:
Input replaces the previous int to identify an uniform/attribute. This allows to extend the Input to add user definable data. It also accepts a Input.Setter which (if set) gets called by default when the uniform needs to be set. This allows to keep the code needed to set an uniform together. Input also has a scope, being either:
- VERTEX_ATTRIBUTE: obviously a vertex attribute, they are added to the public vertexAttributes array
- GLOBAL_UNIFORM: a uniform that only needs to be set once per render pass
- LOCAL_UNIFORM: a uniform that needs to be set for every renderable.

Using an Input in this way is optional, you can still use it to simply reference an uniform (like DefaultShader does). However for a more flexible Shader, it allows to better define who is responsible and when an uniform must be set. I hope to soon PR an improved CompositeShader, which relies on the change.