Split Polymer artmap setup into polymer_setupartmap()

git-svn-id: https://svn.eduke32.com/eduke32@5480 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2015-12-23 04:05:43 +00:00
parent 61059816b8
commit 40a2780eb0

View file

@ -4839,38 +4839,8 @@ static void polymer_getscratchmaterial(_prmaterial* material)
material->mdspritespace = GL_FALSE;
}
static _prbucket* polymer_getbuildmaterial(_prmaterial* material, int16_t tilenum, char pal, int8_t shade, int8_t vis, int32_t cmeth)
static void polymer_setupartmap(int16_t tilenum, char pal)
{
pthtyp* pth;
int32_t usinghighpal = 0;
_prbucket* bucketptr;
// find corresponding bucket; XXX key that with pr_buckets later, need to be tied to restartvid
bucketptr = polymer_findbucket(tilenum, pal);
polymer_getscratchmaterial(material);
if (!waloff[tilenum])
loadtile(tilenum);
// PR_BIT_DIFFUSE_MAP
pth = texcache_fetch(tilenum, pal, 0, cmeth);
if (pth)
{
material->diffusemap = pth->glpic;
if (pth->hicr)
{
material->diffusescale[0] = pth->hicr->scale.x;
material->diffusescale[1] = pth->hicr->scale.y;
}
}
int32_t usinghighpal = 0;
// Lazily fill in all the textures we need, move this to precaching later
if (pr_artmapping && !(globalflags & GLOBAL_NO_GL_TILESHADES) && polymer_eligible_for_artmap(tilenum, pth)) {
if (!prartmaps[tilenum]) {
char *tilebuffer = (char *) waloff[tilenum];
char *tempbuffer = (char *) Xmalloc(tilesiz[tilenum].x * tilesiz[tilenum].y);
@ -4943,6 +4913,39 @@ static _prbucket* polymer_getbuildmaterial(_prmaterial* material, int16_t tile
bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_T, glinfo.clamptoedge ? GL_CLAMP_TO_EDGE : GL_CLAMP);
bglBindTexture(GL_TEXTURE_RECTANGLE, 0);
}
}
static _prbucket* polymer_getbuildmaterial(_prmaterial* material, int16_t tilenum, char pal, int8_t shade, int8_t vis, int32_t cmeth)
{
// find corresponding bucket; XXX key that with pr_buckets later, need to be tied to restartvid
_prbucket *bucketptr = polymer_findbucket(tilenum, pal);
polymer_getscratchmaterial(material);
if (!waloff[tilenum])
loadtile(tilenum);
// PR_BIT_DIFFUSE_MAP
pthtyp *pth = texcache_fetch(tilenum, pal, 0, cmeth);
if (pth)
{
material->diffusemap = pth->glpic;
if (pth->hicr)
{
material->diffusescale[0] = pth->hicr->scale.x;
material->diffusescale[1] = pth->hicr->scale.y;
}
}
int32_t usinghighpal = 0;
// Lazily fill in all the textures we need, move this to precaching later
if (pr_artmapping && !(globalflags & GLOBAL_NO_GL_TILESHADES) && polymer_eligible_for_artmap(tilenum, pth))
{
if (!prartmaps[tilenum] || !prbasepalmaps[curbasepal] || !prlookups[pal])
polymer_setupartmap(tilenum, pal);
material->artmap = prartmaps[tilenum];
material->basepalmap = prbasepalmaps[curbasepal];