@@ -303,7 +303,7 @@ namespace std {
303303 template<> struct hash<Vertex > {
304304 size_t operator()(Vertex const& vertex) const {
305305 return ((hash< glm::vec3 > ()(vertex.pos) ^
306- (hash< glm::vec3 > ()(vertex.color) << 1)) >> 1) ^
306+ (hash< glm::vec3 > ()(vertex.color) << 1)) >> 1) ^
307307 (hash< glm::vec2 > ()(vertex.texCoord) << 1);
308308 }
309309 };
@@ -314,9 +314,15 @@ This code should be placed outside the `Vertex` struct. The hash functions for
314314the GLM types need to be included using the following header:
315315
316316```c++
317+ #define GLM_ENABLE_EXPERIMENTAL
317318#include <glm/gtx/hash.hpp>
318319```
319320
321+ The hash functions are defined in the ` gtx ` folder, which means that it is
322+ technically still an experimental extension to GLM. Therefore you need to define
323+ ` GLM_ENABLE_EXPERIMENTAL ` to use it. It means that the API could change with a
324+ new version of GLM in the future, but in practice the API is very stable.
325+
320326You should now be able to successfully compile and run your program. If you
321327check the size of ` vertices ` , then you'll see that it has shrunk down from
3223281,500,000 to 265,645! That means that each vertex is reused in an average number
@@ -345,4 +351,4 @@ Vulkan's explicitness, many concepts still work the same.
345351
346352[ C++ code](/code/model_loading.cpp) /
347353[Vertex shader](/code/shader_depth.vert) /
348- [Fragment shader](/code/shader_depth.frag)
354+ [Fragment shader](/code/shader_depth.frag)
0 commit comments