use map instead of linear search to find texture indices for animation

This commit is contained in:
Ricardo Luís Vaz Silva 2024-01-09 03:51:01 -03:00 committed by Rachael Alexanderson
commit 8ae93fb87f
4 changed files with 42 additions and 22 deletions

View file

@ -1,4 +1,5 @@
#pragma once
#define TARRAY_H
/*
** tarray.h
** Templated, automatically resizing array
@ -943,6 +944,17 @@ template<class KT> struct THashTraits
int Compare(const KT left, const KT right) { return left != right; }
};
#ifdef TEXTUREID_H
template<> struct THashTraits<FTextureID>
{
hash_t Hash(const FTextureID key) { return (hash_t)key.GetIndex(); }
// Compares two keys, returning zero if they are the same.
int Compare(const FTextureID left, const FTextureID right) { return left != right; }
};
#endif
template<> struct THashTraits<float>
{
// Use all bits when hashing singles instead of converting them to ints.