fix bad palette crush FLT_MAX

sprite_light_experimental
cosmonaut 2020-12-12 21:07:22 -08:00
parent 4ee7c53907
commit b964af26bd
2 changed files with 5 additions and 6 deletions

BIN
Effects/FXB/PaletteCrushEffect.fxb (Stored with Git LFS)

Binary file not shown.

View File

@ -1,7 +1,5 @@
#include "Macros.fxh"
#define FLT_MAX 3.402823466e+38
DECLARE_TEXTURE(Texture, 0);
DECLARE_TEXTURE(Palette, 1);
@ -40,11 +38,12 @@ float4 main_ps(PixelInput input) : SV_TARGET0
float3 sampled_color = sampled.rgb;
float3 closest_color = float3(0, 0, 0);
float closest_dist = FLT_MAX;
float closest_dist = 100000;
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);
if (dist < closest_dist)
{