Support quaternion uniforms

This commit is contained in:
Nikita Lisitsa 2021-02-15 22:38:30 +03:00
parent b6aa09bffe
commit 1b9e769b3f
2 changed files with 8 additions and 0 deletions

View file

@ -6,6 +6,7 @@
#include <psemek/geom/point.hpp> #include <psemek/geom/point.hpp>
#include <psemek/geom/matrix.hpp> #include <psemek/geom/matrix.hpp>
#include <psemek/geom/interval.hpp> #include <psemek/geom/interval.hpp>
#include <psemek/geom/quaternion.hpp>
#include <unordered_map> #include <unordered_map>
#include <string_view> #include <string_view>
@ -92,6 +93,8 @@ namespace psemek::gfx
template <typename T> template <typename T>
void operator = (geom::interval<T> const & i); void operator = (geom::interval<T> const & i);
void operator = (geom::quaternion<float> const & q);
private: private:
GLint location_; GLint location_;
}; };

View file

@ -210,6 +210,11 @@ namespace psemek::gfx
gl::Uniform2f(location_, i.min, i.max); gl::Uniform2f(location_, i.min, i.max);
} }
void program::uniform_proxy::operator = (geom::quaternion<float> const & q)
{
(*this) = q.coords;
}
static std::string annotated_source(std::string_view source) static std::string annotated_source(std::string_view source)
{ {
std::ostringstream os; std::ostringstream os;