Minor cleanup.
This commit is contained in:
parent
7b39358f46
commit
31e3665862
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
float scaleFactor;
|
float scaleFactor;
|
||||||
|
|
||||||
static std::string NativeToUTF8(const std::string &str) {
|
static std::string NativeToUTF8(const std::string& str) {
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
char* u8cstr = nullptr;
|
char* u8cstr = nullptr;
|
||||||
#if (_UNICODE || UNICODE)
|
#if (_UNICODE || UNICODE)
|
||||||
|
|
|
@ -22,6 +22,15 @@
|
||||||
#include "utils/Image_Utils.hpp"
|
#include "utils/Image_Utils.hpp"
|
||||||
#include "utils/String_Utils.hpp"
|
#include "utils/String_Utils.hpp"
|
||||||
|
|
||||||
|
size_t VertexHasher::operator()(const RawVertex& v) const {
|
||||||
|
size_t seed = 5381;
|
||||||
|
const auto hasher = std::hash<float>{};
|
||||||
|
seed ^= hasher(v.position[0]) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||||
|
seed ^= hasher(v.position[1]) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||||
|
seed ^= hasher(v.position[2]) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||||
|
return seed;
|
||||||
|
}
|
||||||
|
|
||||||
bool RawVertex::operator==(const RawVertex& other) const {
|
bool RawVertex::operator==(const RawVertex& other) const {
|
||||||
return (position == other.position) && (normal == other.normal) && (tangent == other.tangent) &&
|
return (position == other.position) && (normal == other.normal) && (tangent == other.tangent) &&
|
||||||
(binormal == other.binormal) && (color == other.color) && (uv0 == other.uv0) &&
|
(binormal == other.binormal) && (color == other.color) && (uv0 == other.uv0) &&
|
||||||
|
|
|
@ -39,8 +39,6 @@ struct RawBlendVertex {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RawVertex {
|
struct RawVertex {
|
||||||
RawVertex() : polarityUv0(false), pad1(false), pad2(false), pad3(false) {}
|
|
||||||
|
|
||||||
Vec3f position{0.0f};
|
Vec3f position{0.0f};
|
||||||
Vec3f normal{0.0f};
|
Vec3f normal{0.0f};
|
||||||
Vec3f binormal{0.0f};
|
Vec3f binormal{0.0f};
|
||||||
|
@ -57,12 +55,12 @@ struct RawVertex {
|
||||||
int blendSurfaceIx = -1;
|
int blendSurfaceIx = -1;
|
||||||
// the size of this vector is always identical to the size of the corresponding
|
// the size of this vector is always identical to the size of the corresponding
|
||||||
// RawSurface.blendChannels
|
// RawSurface.blendChannels
|
||||||
std::vector<RawBlendVertex> blends{};
|
std::vector<RawBlendVertex> blends;
|
||||||
|
|
||||||
bool polarityUv0;
|
bool polarityUv0 = false;
|
||||||
bool pad1;
|
bool pad1 = false;
|
||||||
bool pad2;
|
bool pad2 = false;
|
||||||
bool pad3;
|
bool pad3 = false;
|
||||||
|
|
||||||
bool operator==(const RawVertex& other) const;
|
bool operator==(const RawVertex& other) const;
|
||||||
size_t Difference(const RawVertex& other) const;
|
size_t Difference(const RawVertex& other) const;
|
||||||
|
@ -70,14 +68,7 @@ struct RawVertex {
|
||||||
|
|
||||||
class VertexHasher {
|
class VertexHasher {
|
||||||
public:
|
public:
|
||||||
size_t operator()(const RawVertex& v) const {
|
size_t operator()(const RawVertex& v) const;
|
||||||
size_t seed = 5381;
|
|
||||||
const auto hasher = std::hash<float>{};
|
|
||||||
seed ^= hasher(v.position[0]) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
|
||||||
seed ^= hasher(v.position[1]) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
|
||||||
seed ^= hasher(v.position[2]) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
|
||||||
return seed;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RawTriangle {
|
struct RawTriangle {
|
||||||
|
|
Loading…
Reference in New Issue