Material, Pass, Technique and shaders
- by Papi75
I'm trying to make a clean and advanced Material class for the rendering of my game, here is my architecture:
class Material
{
void sendToShader()
{
program->sendUniform( nameInShader, valueInMaterialOrOther );
}
private:
Blend blendmode; ///< Alpha, Add, Multiply, …
Color ambient;
Color diffuse;
Color specular;
DrawingMode drawingMode; // Line Triangles, …
Program* program;
std::map<string, TexturePacket> textures; // List of textures with TexturePacket = { Texture*, vec2 offset, vec2 scale}
};
How can I handle the link between the Shader and the Material? (sendToShader method)
If the user want to send additionals informations to the shader (like time elapsed), how can I allow that? (User can't edit Material class)
Thanks!