Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 35 additions & 26 deletions Minecraft.Client/Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,38 +716,47 @@ int Texture::crispBlend(int c0, int c1)
int a0 = static_cast<int>(((c0 & 0xff000000) >> 24)) & 0xff;
int a1 = static_cast<int>(((c1 & 0xff000000) >> 24)) & 0xff;

int a = 255;
if (a0 + a1 < 255)
// continue with crisp blend if it's likely to be an opaque/cutout tile in the atlas
if (a0 >= 0xfa || a1 >= 0xfa)
{
a = 0;
a0 = 1;
a1 = 1;
}
else if (a0 > a1)
{
a0 = 255;
a1 = 1;
}
else
{
a0 = 1;
a1 = 255;
int a = 255;

}
if (a0 + a1 < 255)
{
a = 0;
a0 = 1;
a1 = 1;
}
else if (a0 > a1)
{
a0 = 255;
a1 = 1;
}
else
{
a0 = 1;
a1 = 255;

}

int r0 = ((c0 >> 16) & 0xff) * a0;
int g0 = ((c0 >> 8) & 0xff) * a0;
int b0 = ((c0) & 0xff) * a0;
int r0 = ((c0 >> 16) & 0xff) * a0;
int g0 = ((c0 >> 8) & 0xff) * a0;
int b0 = ((c0) & 0xff) * a0;

int r1 = ((c1 >> 16) & 0xff) * a1;
int g1 = ((c1 >> 8) & 0xff) * a1;
int b1 = ((c1) & 0xff) * a1;
int r1 = ((c1 >> 16) & 0xff) * a1;
int g1 = ((c1 >> 8) & 0xff) * a1;
int b1 = ((c1) & 0xff) * a1;

int r = (r0 + r1) / (a0 + a1);
int g = (g0 + g1) / (a0 + a1);
int b = (b0 + b1) / (a0 + a1);
int r = (r0 + r1) / (a0 + a1);
int g = (g0 + g1) / (a0 + a1);
int b = (b0 + b1) / (a0 + a1);

return (a << 24) | (r << 16) | (g << 8) | b;
return (a << 24) | (r << 16) | (g << 8) | b;
}
else // smoothblend if it's transparent
{
return (((a0 + a1) >> 1) << 24) | (((c0 & 0xfefefe) + (c1 & 0xfefefe)) >> 1);
}
}

int Texture::getManagerId()
Expand Down
Loading