From a3caa28483ac1b2a09bbed633a2ae6087d846d04 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 23 Aug 2019 12:30:15 -0400 Subject: [PATCH] Connection: Collapse definition of operator== for Vert This can be collapsed down to a single tie comparison --- hecl/include/hecl/Blender/Connection.hpp | 5 ++-- hecl/lib/Blender/Connection.cpp | 33 +++++++++--------------- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/hecl/include/hecl/Blender/Connection.hpp b/hecl/include/hecl/Blender/Connection.hpp index 43fa15741..3e86fe2eb 100644 --- a/hecl/include/hecl/Blender/Connection.hpp +++ b/hecl/include/hecl/Blender/Connection.hpp @@ -12,6 +12,7 @@ #include #endif +#include #include #include #include @@ -343,8 +344,8 @@ struct Mesh { struct Vert { uint32_t iPos = 0xffffffff; uint32_t iNorm = 0xffffffff; - uint32_t iColor[4] = {0xffffffff}; - uint32_t iUv[8] = {0xffffffff}; + std::array iColor = {0xffffffff}; + std::array iUv = {0xffffffff}; uint32_t iSkin = 0xffffffff; uint32_t iBankSkin = 0xffffffff; diff --git a/hecl/lib/Blender/Connection.cpp b/hecl/lib/Blender/Connection.cpp index c910746b6..e4dd8a55f 100644 --- a/hecl/lib/Blender/Connection.cpp +++ b/hecl/lib/Blender/Connection.cpp @@ -1,23 +1,25 @@ +#include #include +#include +#include +#include #include #include #include -#include -#include -#include -#include -#include -#include -#include #include +#include +#include +#include +#include #include #include -#include "logvisor/logvisor.hpp" #include "hecl/Blender/Connection.hpp" #include "hecl/SteamFinder.hpp" #include "MeshOptimizer.hpp" +#include + #if _WIN32 #include #include @@ -996,19 +998,8 @@ Material::Material(Connection& conn) { } bool Mesh::Surface::Vert::operator==(const Vert& other) const { - if (iPos != other.iPos) - return false; - if (iNorm != other.iNorm) - return false; - for (int i = 0; i < 4; ++i) - if (iColor[i] != other.iColor[i]) - return false; - for (int i = 0; i < 8; ++i) - if (iUv[i] != other.iUv[i]) - return false; - if (iSkin != other.iSkin) - return false; - return true; + return std::tie(iPos, iNorm, iColor, iUv, iSkin) == + std::tie(other.iPos, other.iNorm, other.iColor, other.iUv, other.iSkin); } static bool VertInBank(const std::vector& bank, uint32_t sIdx) {