cginternals / cginternals/globjects

Proper way to create a generic container of uniforms?

Open
#345 2 comments 0 reactions 0 assignees View on GitHub
decision required
Dominant language
C++
Stars
563
Forks
59
PR merge metrics
No merged PRs in 30d

Description

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` or
`unordered_map>`.

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()->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` because it can't be instantiated.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.