In my program I'm trying to store a map of "global uniforms" where drawn meshes can optionally override these with their own internal maps of uniforms. I am really struggling to get it to compile though, what with needing a generic container. I am struggling to understand if the container should be of type unordered_map<string, AbstractUniform> or
unordered_map<string, ref_ptr<AbstractUniform>>.
As I understand it, I need to use the AbstractUniform abstract class in order to have containers of uniforms of arbitrary types. I would update these values by doing something like
container["modelview"]->as<glm::mat4>()->set(glm::mat4(1.0f));
However, I cannot figure out the necessary type signatures of functions to be able to pass around uniforms. I need to pass uniforms into my individual meshes, and I can't pass around a raw ref_ptr<AbstractUniform> because it can't be instantiated.
In my program I'm trying to store a map of "global uniforms" where drawn meshes can optionally override these with their own internal maps of uniforms. I am really struggling to get it to compile though, what with needing a generic container. I am struggling to understand if the container should be of type
unordered_map<string, AbstractUniform>orunordered_map<string, ref_ptr<AbstractUniform>>.As I understand it, I need to use the AbstractUniform abstract class in order to have containers of uniforms of arbitrary types. I would update these values by doing something like
However, I cannot figure out the necessary type signatures of functions to be able to pass around uniforms. I need to pass uniforms into my individual meshes, and I can't pass around a raw
ref_ptr<AbstractUniform>because it can't be instantiated.