mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-23 14:19:55 -06:00
betterer approximation
This commit is contained in:
@ -181,10 +181,22 @@ private:
|
|||||||
// Z-buffering: linear interpolation
|
// Z-buffering: linear interpolation
|
||||||
// still doesn't quite match hardware...
|
// still doesn't quite match hardware...
|
||||||
|
|
||||||
if (z0 < z1)
|
if (dir)
|
||||||
return z0 + (((z1 - z0) / (xdiff << 1)) * (x<<1));
|
{
|
||||||
|
// seems like y dir does different interpolation?
|
||||||
|
// this probably isn't right...
|
||||||
|
if (z0 < z1)
|
||||||
|
return z0 + (z1-z0) * x / xdiff;
|
||||||
|
else
|
||||||
|
return z1 + (z0-z1) * (xdiff-x) / xdiff;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return z1 + (((z0 - z1) / (xdiff << 1)) * (xdiff-x<<1));
|
{
|
||||||
|
if (z0 < z1)
|
||||||
|
return z0 + (((z1-z0) / xdiff & ~0x1) * x);
|
||||||
|
else
|
||||||
|
return z1 + (((z0-z1) / xdiff & ~0x1) * (xdiff-x) + ((z0-z1) & 0xFF));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user