mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 22:53:34 +00:00
removing buggy texture hash system
This commit is contained in:
@@ -47,13 +47,8 @@ namespace mlx
|
|||||||
void GraphicsSupport::texturePut(Texture* texture, int x, int y)
|
void GraphicsSupport::texturePut(Texture* texture, int x, int y)
|
||||||
{
|
{
|
||||||
_textures_to_render.emplace_back(texture, x, 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)
|
auto it = std::find(_textures_to_render.begin(), _textures_to_render.end() - 1, _textures_to_render.back());
|
||||||
{
|
|
||||||
return rhs.hash == hash;
|
|
||||||
});
|
|
||||||
|
|
||||||
if(it != _textures_to_render.end() - 1)
|
if(it != _textures_to_render.end() - 1)
|
||||||
_textures_to_render.erase(it);
|
_textures_to_render.erase(it);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/03/08 02:24:58 by maldavid #+# #+# */
|
/* 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
|
struct TextureRenderData
|
||||||
{
|
{
|
||||||
Texture* texture;
|
Texture* texture;
|
||||||
std::size_t hash = 0;
|
|
||||||
int x;
|
int x;
|
||||||
int y;
|
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
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user