TheAtlasEngine
Loading...
Searching...
No Matches
hash.hpp
1
#pragma once
2
#include <drivers/vulkan-cpp/uniforms.hpp>
3
#define GLM_ENABLE_EXPERIMENTAL
4
#include <glm/gtx/hash.hpp>
5
#include <vulkan-cpp/types.hpp>
6
7
namespace
atlas {
8
template
<
typename
T,
typename
... Rest>
9
void
hash_combine(
size_t
& seed,
const
T& v,
const
Rest&... rest) {
10
seed ^= std::hash<T>()(v) + 0x9e3779b9 + (seed << 6) + (seed << 2);
11
(hash_combine(seed, rest), ...);
12
}
13
14
};
15
16
namespace
std {
17
18
// template<>
19
// struct hash<atlas::vk::vertex_input> {
20
// size_t operator()(const atlas::vk::vertex_input& vertex) const {
21
// size_t seed = 0;
22
// atlas::hash_combine(
23
// seed, vertex.position, vertex.color, vertex.normals,
24
// vertex.uv);
25
// return seed;
26
// }
27
// };
28
template
<>
29
struct
hash<::vk::vertex_input> {
30
size_t
operator()(const ::vk::vertex_input& vertex)
const
{
31
size_t
seed = 0;
32
atlas::hash_combine(
33
seed, vertex.position, vertex.color, vertex.normals, vertex.uv);
34
return
seed;
35
}
36
};
37
38
}
TheAtlasEngine
atlas
drivers
vulkan-cpp
hash.hpp
Generated by
1.9.8