Connection: Collapse definition of operator== for Vert

This can be collapsed down to a single tie comparison
This commit is contained in:
Lioncash 2019-08-23 12:30:15 -04:00
parent 8fdd9a15c4
commit a3caa28483
2 changed files with 15 additions and 23 deletions

View File

@ -12,6 +12,7 @@
#include <unistd.h>
#endif
#include <array>
#include <cstdint>
#include <cstdio>
#include <cfloat>
@ -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<uint32_t, 4> iColor = {0xffffffff};
std::array<uint32_t, 8> iUv = {0xffffffff};
uint32_t iSkin = 0xffffffff;
uint32_t iBankSkin = 0xffffffff;

View File

@ -1,23 +1,25 @@
#include <algorithm>
#include <cerrno>
#include <chrono>
#include <cinttypes>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cinttypes>
#include <signal.h>
#include <system_error>
#include <string>
#include <algorithm>
#include <chrono>
#include <thread>
#include <mutex>
#include <string>
#include <system_error>
#include <thread>
#include <tuple>
#include <hecl/hecl.hpp>
#include <hecl/Database.hpp>
#include "logvisor/logvisor.hpp"
#include "hecl/Blender/Connection.hpp"
#include "hecl/SteamFinder.hpp"
#include "MeshOptimizer.hpp"
#include <logvisor/logvisor.hpp>
#if _WIN32
#include <io.h>
#include <fcntl.h>
@ -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<uint32_t>& bank, uint32_t sIdx) {