Ported the obj parser.
This commit is contained in:
24
include/util/vector_hash.hpp
Normal file
24
include/util/vector_hash.hpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include "glm/glm.hpp"
|
||||
#include <memory>
|
||||
|
||||
// Hash function for Eigen matrix and vector.
|
||||
// The code is from `hash_combine` function of the Boost library. See
|
||||
// http://www.boost.org/doc/libs/1_55_0/doc/html/hash/reference.html#boost.hash_combine .
|
||||
|
||||
template<glm::length_t L, typename T, glm::qualifier Q>
|
||||
struct std::hash<glm::vec<L, T, Q>>
|
||||
{
|
||||
auto operator() (const glm::vec<L, T, Q>& key) const
|
||||
{
|
||||
auto seed = std::size_t{};
|
||||
|
||||
for (glm::length_t i{}; i != L; ++i)
|
||||
{
|
||||
seed ^= std::hash<T>{}(key[i]) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
}
|
||||
|
||||
return seed;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user