MXVK Vulkan Framework 0.24.0
C++20 Vulkan rendering framework for practical 2D and 3D application development with SDL3.
Loading...
Searching...
No Matches
mxvk::VKVertexHash Struct Reference

Hash functor for VKVertex. More...

#include <mxvk/include/mxvk/mxvk_model.hpp>

Public Member Functions

std::size_t operator() (const VKVertex &v) const

Detailed Description

Hash functor for VKVertex.

Definition at line 35 of file mxvk_model.hpp.

Member Function Documentation

◆ operator()()

std::size_t mxvk::VKVertexHash::operator() ( const VKVertex & v) const

Definition at line 665 of file mxvk_model.cpp.

665 {
666 std::size_t seed = 0;
667 auto combine = [&seed](float value) {
668 std::hash<float> hasher;
669 seed ^= hasher(value) + 0x9e3779b9u + (seed << 6u) + (seed >> 2u);
670 };
671
672 for (int i = 0; i < 3; ++i) {
673 combine(v.pos[i]);
674 }
675 for (int i = 0; i < 2; ++i) {
676 combine(v.texCoord[i]);
677 }
678 for (int i = 0; i < 3; ++i) {
679 combine(v.normal[i]);
680 }
681
682 return seed;
683 }

The documentation for this struct was generated from the following files: