MXVK Vulkan Framework 0.35.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 33 of file mxvk_model.hpp.

Member Function Documentation

◆ operator()()

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

Definition at line 636 of file mxvk_model.cpp.

636 {
637 std::size_t seed = 0;
638 auto combine = [&seed](float value) {
639 std::hash<float> hasher;
640 seed ^= hasher(value) + 0x9e3779b9u + (seed << 6u) + (seed >> 2u);
641 };
642
643 for (int i = 0; i < 3; ++i) {
644 combine(v.pos[i]);
645 }
646 for (int i = 0; i < 2; ++i) {
647 combine(v.texCoord[i]);
648 }
649 for (int i = 0; i < 3; ++i) {
650 combine(v.normal[i]);
651 }
652
653 return seed;
654 }

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