diff --git a/common.h b/common.h index 894a893..f96399d 100644 --- a/common.h +++ b/common.h @@ -162,6 +162,7 @@ static bool operator<(const Vec3& lhs, const Vec3& rhs) return lhs.x < rhs.x; } +// Halton sequence, helpfully yoinked from the FSR2 code: https://github.com/GPUOpen-Effects/FidelityFX-FSR2 static float halton(int32_t index, int32_t base) { float f = 1.0f, result = 0.0f; diff --git a/texture.cpp b/texture.cpp index 845a4d8..9ad1d9b 100644 --- a/texture.cpp +++ b/texture.cpp @@ -27,6 +27,7 @@ Keep in mind that the coordinates will be rounded down to the next lowest textur // A straight conversion of the Quake palette colors comes out looking rather over-saturated. // So we desaturate the palette ahead of time to more closely match the original Quake's look. +// Yoinked from: https://stackoverflow.com/questions/13328029/how-to-desaturate-a-color static void desaturate(const unsigned char inColor[3], unsigned char outColor[3]) { double f = 0.1; // desaturate by 10% @@ -125,6 +126,7 @@ struct ColorAccumulate } }; +// Dominant color algorithm yoinked from: https://github.com/fast-average-color/fast-average-color static void analyze_texture(unsigned char* texBytes, int numBytes, const Color palette[PALETTE_SIZE], TextureDescriptor& outTexture) { uint64_t rSum = 0, gSum = 0, bSum = 0;