fix bad palette crush FLT_MAX
parent
51d7f3e772
commit
16ecb5afa6
BIN
Effects/FXB/PaletteCrushEffect.fxb (Stored with Git LFS)
BIN
Effects/FXB/PaletteCrushEffect.fxb (Stored with Git LFS)
Binary file not shown.
|
@ -1,7 +1,5 @@
|
||||||
#include "Macros.fxh"
|
#include "Macros.fxh"
|
||||||
|
|
||||||
#define FLT_MAX 3.402823466e+38
|
|
||||||
|
|
||||||
DECLARE_TEXTURE(Texture, 0);
|
DECLARE_TEXTURE(Texture, 0);
|
||||||
DECLARE_TEXTURE(Palette, 1);
|
DECLARE_TEXTURE(Palette, 1);
|
||||||
|
|
||||||
|
@ -40,11 +38,12 @@ float4 main_ps(PixelInput input) : SV_TARGET0
|
||||||
float3 sampled_color = sampled.rgb;
|
float3 sampled_color = sampled.rgb;
|
||||||
|
|
||||||
float3 closest_color = float3(0, 0, 0);
|
float3 closest_color = float3(0, 0, 0);
|
||||||
float closest_dist = FLT_MAX;
|
float closest_dist = 100000;
|
||||||
|
|
||||||
for (int i = 0; i < PaletteWidth; i++)
|
for (int i = 0; i < PaletteWidth; i++)
|
||||||
{
|
{
|
||||||
float3 palette_color = SAMPLE_TEXTURE(Palette, float2(i / (float)PaletteWidth, 0));
|
float texX = (i / (float)PaletteWidth);
|
||||||
|
float3 palette_color = SAMPLE_TEXTURE(Palette, float2(texX, 0));
|
||||||
float dist = distance(palette_color, sampled_color);
|
float dist = distance(palette_color, sampled_color);
|
||||||
if (dist < closest_dist)
|
if (dist < closest_dist)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue