Graphics/TextSprite: Fix outline showing up over glyphs

This commit is contained in:
SirLynix 2023-02-22 19:12:15 +01:00
parent 5833ce573d
commit 2e8ea0e887
2 changed files with 7 additions and 8 deletions

View File

@ -15,6 +15,7 @@
#include <Nazara/Utility/VertexDeclaration.hpp> #include <Nazara/Utility/VertexDeclaration.hpp>
#include <Nazara/Utility/VertexStruct.hpp> #include <Nazara/Utility/VertexStruct.hpp>
#include <array> #include <array>
#include <map>
namespace Nz namespace Nz
{ {
@ -68,14 +69,13 @@ namespace Nz
{ {
return !operator==(rhs); return !operator==(rhs);
} }
};
struct HashRenderKey bool operator<(const RenderKey& rhs) const
{
std::size_t operator()(const RenderKey& key) const
{ {
// Since renderOrder will be very small, this will be enough if (renderOrder != rhs.renderOrder)
return std::hash<Texture*>()(key.texture) + key.renderOrder; return renderOrder < rhs.renderOrder;
return texture < rhs.texture;
} }
}; };
@ -85,8 +85,8 @@ namespace Nz
unsigned int count; unsigned int count;
}; };
mutable std::map<RenderKey, RenderIndices> m_renderInfos;
std::unordered_map<const AbstractAtlas*, AtlasSlots> m_atlases; std::unordered_map<const AbstractAtlas*, AtlasSlots> m_atlases;
mutable std::unordered_map<RenderKey, RenderIndices, HashRenderKey> m_renderInfos;
std::shared_ptr<MaterialInstance> m_material; std::shared_ptr<MaterialInstance> m_material;
std::vector<VertexStruct_XYZ_Color_UV> m_vertices; std::vector<VertexStruct_XYZ_Color_UV> m_vertices;
}; };

View File

@ -260,7 +260,6 @@ namespace Nz
// Rebuild new render infos with adjusted texture // Rebuild new render infos with adjusted texture
decltype(m_renderInfos) newRenderInfos; decltype(m_renderInfos) newRenderInfos;
newRenderInfos.reserve(m_renderInfos.size());
for (auto&& [renderKey, indices] : m_renderInfos) for (auto&& [renderKey, indices] : m_renderInfos)
{ {