From c32401ba51586be75522d28564f6404db11e3a85 Mon Sep 17 00:00:00 2001 From: Plagman Date: Wed, 8 May 2013 06:53:38 +0000 Subject: [PATCH] Polymer: Hook ART mapping to rotatesprite. The visibility calculation relies on the distance, which might not be entirely accurate in rotatesprite, so maybe it'll be too dark in some cases. git-svn-id: https://svn.eduke32.com/eduke32@3741 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/polymer.c | 6 +++--- polymer/eduke32/build/src/polymost.c | 27 ++++++++++++++++++--------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index 576f307f9..991397905 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -1334,7 +1334,7 @@ void polymer_inb4rotatesprite(int16_t tilenum, char pal, int8_t s { _prmaterial rotatespritematerial; - polymer_getbuildmaterial(&rotatespritematerial, tilenum, pal, shade, 0, 1337); + polymer_getbuildmaterial(&rotatespritematerial, tilenum, pal, shade, 0, 4); rotatespritematerialbits = polymer_bindmaterial(rotatespritematerial, NULL, 0); } @@ -4557,7 +4557,7 @@ static void polymer_getbuildmaterial(_prmaterial* material, int16_t tile loadtile(tilenum); // PR_BIT_DIFFUSE_MAP - pth = gltexcache(tilenum, pal, cmeth == 1337 ? 4 : cmeth); + pth = gltexcache(tilenum, pal, cmeth); if (pth) material->diffusemap = pth->glpic; @@ -4569,7 +4569,7 @@ static void polymer_getbuildmaterial(_prmaterial* material, int16_t tile } // Lazily fill in all the textures we need, move this to precaching later - if (pr_artmapping && (!pth || !pth->hicr) && cmeth != 1337) { + if (pr_artmapping && (!pth || !pth->hicr)) { if (!prartmaps[tilenum]) { char *tilebuffer = (char *)waloff[tilenum]; char *tempbuffer = (char *)Bmalloc(tilesizx[tilenum] * tilesizy[tilenum]); diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 642dfb287..72402d889 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -2210,12 +2210,18 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) pth = pth->ofb; } - bglBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : 0); + // If we aren't rendmode 3, we're in Polymer, which means this code is + // used for rotatesprite only. Polymer handles all the material stuff, + // just submit the geometry and don't mess with textures. + if (rendmode == 3) + { + bglBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : 0); - if (srepeat) - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); - if (trepeat) - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); + if (srepeat) + bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); + if (trepeat) + bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); + } // texture scale by parkar request if (pth && pth->hicr && ((pth->hicr->xscale != 1.0f) || (pth->hicr->yscale != 1.0f)) && !drawingskybox) @@ -2573,10 +2579,13 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) texunits--; } - if (srepeat) - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP); - if (trepeat) - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP); + if (rendmode == 3) + { + if (srepeat) + bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP); + if (trepeat) + bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP); + } if (fullbrightdrawingpass == 1) // tile has fullbright colors ? {