samedi 24 décembre 2016

Whats a good design pattern for class that wraps shader parameter values

I am trying to design a class that would wrap shader parameter in such way that it would enable the user to easily set and get its value without a need to write a tone of validation code outside of this class implementation.

The problem is that obviously the shader parameter values can be of different types, and weather I use templates or method overloading it results in a lot of messy code that if one was to use this class it would probably not be a very pleasant experience.

Is there some clever design pattern that once implemented would render the usage of said class to be more straight forward ? I wouldn't mind if the mechanism was more complex as long as its implementation is not exposed to the user of this class.

Also just to be more clear, this shader parameter class is somewhat abstract in that its purpose is only to store the parameter for easier editing and handling across my code base. It does not interact or have any knowledge about the actual shader.

Aucun commentaire:

Enregistrer un commentaire