From 4b233e596c08a0182d36ec5853c6e9b7143cc502 Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Sun, 11 Sep 2022 18:20:23 +0200 Subject: [PATCH] Small optimization: instead of branching, we can do UV correction with a single calculation. --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index fcc5dd8..58755ed 100644 --- a/main.c +++ b/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; }