skeleton for setting uniforms with variants

This commit is contained in:
Hartmut Seichter 2019-02-12 22:44:51 +01:00
parent f9fbf44391
commit d8fac9045b

View file

@ -1,5 +1,6 @@
#include "pw/visual/shader.hpp"
#include "pw/core/debug.hpp"
#include "pw/core/serialize.hpp"
#include "glad/glad.h"
@ -203,11 +204,21 @@ void shader::use()
void shader::set_uniforms(shader::uniform_set s)
{
for (auto& u : s) {
std::visit(
[u](auto&& arg){
std::cout << u.first << " " << typeid(arg).name() << std::endl;
},
u.second);
// std::visit(
// [u](auto&& arg){
// std::cout << u.first << " " << typeid(arg).name() << std::endl;
// },
// u.second);
std::visit([u](auto&& arg) {
using T = std::decay_t<decltype(arg)>;
if constexpr (std::is_same_v<T, vector4f>)
std::cout << "vec4f with type " << typeid(arg).name() << " " << serialize::matrix(arg) << '\n';
else
std::cout << "can't" << std::endl;
}, u.second);
}
}