mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-02-02 20:01:23 +00:00
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:
parent
61059816b8
commit
40a2780eb0
1 changed files with 83 additions and 80 deletions
|
@ -4839,38 +4839,8 @@ static void polymer_getscratchmaterial(_prmaterial* material)
|
||||||
material->mdspritespace = GL_FALSE;
|
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]) {
|
if (!prartmaps[tilenum]) {
|
||||||
char *tilebuffer = (char *) waloff[tilenum];
|
char *tilebuffer = (char *) waloff[tilenum];
|
||||||
char *tempbuffer = (char *) Xmalloc(tilesiz[tilenum].x * tilesiz[tilenum].y);
|
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);
|
bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_T, glinfo.clamptoedge ? GL_CLAMP_TO_EDGE : GL_CLAMP);
|
||||||
bglBindTexture(GL_TEXTURE_RECTANGLE, 0);
|
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->artmap = prartmaps[tilenum];
|
||||||
material->basepalmap = prbasepalmaps[curbasepal];
|
material->basepalmap = prbasepalmaps[curbasepal];
|
||||||
|
|
Loading…
Reference in a new issue