Browse Source

Added a few source references

master
Nico de Poel 3 years ago
parent
commit
b0e6083d13
  1. 1
      common.h
  2. 2
      texture.cpp

1
common.h

@ -162,6 +162,7 @@ static bool operator<(const Vec3& lhs, const Vec3& rhs)
return lhs.x < rhs.x; 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) static float halton(int32_t index, int32_t base)
{ {
float f = 1.0f, result = 0.0f; float f = 1.0f, result = 0.0f;

2
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. // 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. // 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]) static void desaturate(const unsigned char inColor[3], unsigned char outColor[3])
{ {
double f = 0.1; // desaturate by 10% 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) static void analyze_texture(unsigned char* texBytes, int numBytes, const Color palette[PALETTE_SIZE], TextureDescriptor& outTexture)
{ {
uint64_t rSum = 0, gSum = 0, bSum = 0; uint64_t rSum = 0, gSum = 0, bSum = 0;

Loading…
Cancel
Save