removing buggy texture hash system

This commit is contained in:
Kbz-8
2023-12-14 14:39:00 +01:00
parent 11b1bd147d
commit ac91253f51
2 changed files with 2 additions and 20 deletions

View File

@@ -47,13 +47,8 @@ namespace mlx
void GraphicsSupport::texturePut(Texture* texture, int x, int y)
{
_textures_to_render.emplace_back(texture, x, y);
std::size_t hash = std::hash<TextureRenderData>{}(_textures_to_render.back());
_textures_to_render.back().hash = hash;
auto it = std::find_if(_textures_to_render.begin(), _textures_to_render.end() - 1, [=](const TextureRenderData& rhs)
{
return rhs.hash == hash;
});
auto it = std::find(_textures_to_render.begin(), _textures_to_render.end() - 1, _textures_to_render.back());
if(it != _textures_to_render.end() - 1)
_textures_to_render.erase(it);

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/08 02:24:58 by maldavid #+# #+# */
/* Updated: 2023/12/14 13:47:03 by maldavid ### ########.fr */
/* Updated: 2023/12/14 14:37:08 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -68,7 +68,6 @@ namespace mlx
struct TextureRenderData
{
Texture* texture;
std::size_t hash = 0;
int x;
int y;
@@ -77,16 +76,4 @@ namespace mlx
};
}
namespace std
{
template <>
struct hash<mlx::TextureRenderData>
{
size_t operator()(const mlx::TextureRenderData& td) const noexcept
{
return std::hash<mlx::Texture*>{}(td.texture) + std::hash<std::string>{}(std::to_string(td.x)) + std::hash<std::string>{}(std::to_string(td.y));
}
};
}
#endif