1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-02 09:03:37 +00:00

Clamp arguments for acos when calculating G_TEXTURE_GEN_LINEAR

Fixed (Majora's Mask) Glass in Postman House not rendering #1941

Note: ucode actually works a bit differently because it uses approximated acos calculation.
This commit is contained in:
Sergey Lipskiy 2018-11-20 22:47:59 +07:00
parent 087ac76536
commit cbf5821f8e

View File

@ -837,6 +837,10 @@ void gSPProcessVertex(u32 v, SPVertex * spVtx)
y = fLightDir[1];
}
if (gSP.geometryMode & G_TEXTURE_GEN_LINEAR) {
if (x < -1.0f) x = -1.0f;
if (x > 1.0f) x = 1.0f;
if (y < -1.0f) y = -1.0f;
if (y > 1.0f) y = 1.0f;
vtx.s = acosf(-x) * 325.94931f;
vtx.t = acosf(-y) * 325.94931f;
} else { // G_TEXTURE_GEN