skeleton for setting uniforms with variants
This commit is contained in:
parent
f9fbf44391
commit
d8fac9045b
1 changed files with 16 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
||||||
#include "pw/visual/shader.hpp"
|
#include "pw/visual/shader.hpp"
|
||||||
#include "pw/core/debug.hpp"
|
#include "pw/core/debug.hpp"
|
||||||
|
#include "pw/core/serialize.hpp"
|
||||||
|
|
||||||
#include "glad/glad.h"
|
#include "glad/glad.h"
|
||||||
|
|
||||||
|
@ -203,11 +204,21 @@ void shader::use()
|
||||||
void shader::set_uniforms(shader::uniform_set s)
|
void shader::set_uniforms(shader::uniform_set s)
|
||||||
{
|
{
|
||||||
for (auto& u : s) {
|
for (auto& u : s) {
|
||||||
std::visit(
|
// std::visit(
|
||||||
[u](auto&& arg){
|
// [u](auto&& arg){
|
||||||
std::cout << u.first << " " << typeid(arg).name() << std::endl;
|
// std::cout << u.first << " " << typeid(arg).name() << std::endl;
|
||||||
},
|
// },
|
||||||
u.second);
|
// 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);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue