Browse Source

Small optimization: instead of branching, we can do UV correction with a single calculation.

master
Nico de Poel 3 years ago
parent
commit
4b233e596c
  1. 6
      main.c

6
main.c

@ -464,9 +464,9 @@ void drawModel(ps1mdl_t *model, ps1skin_t *skin, int frameCounter)
else
{
// Since we have the texture split into two parts, we need to correct the UVs that are *not* on the seam, instead of the other way round
u0 = tc0->onSeam ? tc0->u : tc0->u - halfSkinWidth;
u1 = tc1->onSeam ? tc1->u : tc1->u - halfSkinWidth;
u2 = tc2->onSeam ? tc2->u : tc2->u - halfSkinWidth;
u0 = tc0->u - !tc0->onSeam * halfSkinWidth;
u1 = tc1->u - !tc1->onSeam * halfSkinWidth;
u2 = tc2->u - !tc2->onSeam * halfSkinWidth;
tex = &skin->back;
}

Loading…
Cancel
Save