mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-16 01:11:28 +00:00
Minor Polymost code cleanup.
- factor out eligible_for_tileshades() - remove some rendmode 1 code - move some auto vars further down git-svn-id: https://svn.eduke32.com/eduke32@4406 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
99ddb32055
commit
2d889c74f7
3 changed files with 13 additions and 22 deletions
|
@ -56,6 +56,12 @@ extern int32_t r_usetileshades;
|
||||||
extern int16_t globalpicnum;
|
extern int16_t globalpicnum;
|
||||||
extern int32_t globalpal;
|
extern int32_t globalpal;
|
||||||
|
|
||||||
|
static inline int32_t eligible_for_tileshades(int32_t picnum, int32_t pal)
|
||||||
|
{
|
||||||
|
return (!usehightile || !hicfindsubst(picnum, pal, 0)) &&
|
||||||
|
(!usemodels || md_tilehasmodel(picnum, pal) < 0);
|
||||||
|
}
|
||||||
|
|
||||||
static inline float getshadefactor(int32_t shade)
|
static inline float getshadefactor(int32_t shade)
|
||||||
{
|
{
|
||||||
int32_t shadebound = (shadescale_unbounded || shade>=numshades) ? numshades : numshades-1;
|
int32_t shadebound = (shadescale_unbounded || shade>=numshades) ? numshades : numshades-1;
|
||||||
|
@ -64,8 +70,7 @@ static inline float getshadefactor(int32_t shade)
|
||||||
// 8-bit tiles, i.e. non-hightiles and non-models, don't get additional
|
// 8-bit tiles, i.e. non-hightiles and non-models, don't get additional
|
||||||
// glColor() shading with r_usetileshades!
|
// glColor() shading with r_usetileshades!
|
||||||
if (getrendermode() == REND_POLYMOST && r_usetileshades &&
|
if (getrendermode() == REND_POLYMOST && r_usetileshades &&
|
||||||
(!usehightile || !hicfindsubst(globalpicnum, globalpal, 0)) &&
|
eligible_for_tileshades(globalpicnum, globalpal))
|
||||||
(!usemodels || md_tilehasmodel(globalpicnum, globalpal) < 0))
|
|
||||||
return 1.f;
|
return 1.f;
|
||||||
|
|
||||||
return ((float)(numshades-clamped_shade))/(float)numshades;
|
return ((float)(numshades-clamped_shade))/(float)numshades;
|
||||||
|
|
|
@ -1303,10 +1303,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method)
|
||||||
double f, r, ox, oy, oz, ox2, oy2, oz2, dd[16], uu[16], vv[16], px[16], py[16], uoffs;
|
double f, r, ox, oy, oz, ox2, oy2, oz2, dd[16], uu[16], vv[16], px[16], py[16], uoffs;
|
||||||
int32_t i, j, k, nn, ix0, ix1, tsizx, tsizy;
|
int32_t i, j, k, nn, ix0, ix1, tsizx, tsizy;
|
||||||
int32_t xx, yy, dorot;
|
int32_t xx, yy, dorot;
|
||||||
#ifdef USE_OPENGL
|
|
||||||
pthtyp *pth, *detailpth, *glowpth;
|
|
||||||
int32_t texunits = GL_TEXTURE0_ARB;
|
|
||||||
#endif
|
|
||||||
// backup of the n for possible redrawing of fullbright
|
// backup of the n for possible redrawing of fullbright
|
||||||
const int32_t n_ = n, method_ = method;
|
const int32_t n_ = n, method_ = method;
|
||||||
|
|
||||||
|
@ -1390,6 +1387,8 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method)
|
||||||
if (getrendermode() >= REND_POLYMOST)
|
if (getrendermode() >= REND_POLYMOST)
|
||||||
{
|
{
|
||||||
float hackscx, hackscy;
|
float hackscx, hackscy;
|
||||||
|
pthtyp *pth, *detailpth, *glowpth;
|
||||||
|
int32_t texunits = GL_TEXTURE0_ARB;
|
||||||
|
|
||||||
if (skyclamphack) method |= 4;
|
if (skyclamphack) method |= 4;
|
||||||
pth = our_texcache_fetch(method&(~3));
|
pth = our_texcache_fetch(method&(~3));
|
||||||
|
@ -1765,21 +1764,6 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
if (rendmode == 1)
|
|
||||||
{
|
|
||||||
if (method&3) //Only draw border around sprites/maskwalls
|
|
||||||
{
|
|
||||||
for (i=0,j=n-1; i<n; j=i,i++) drawline2d(px[i],py[i],px[j],py[j],31); //hopefully color index 31 is white
|
|
||||||
}
|
|
||||||
|
|
||||||
//ox = 0; oy = 0;
|
|
||||||
//for(i=0;i<n;i++) { ox += px[i]; oy += py[i]; }
|
|
||||||
//ox /= (double)n; oy /= (double)n;
|
|
||||||
//for(i=0,j=n-1;i<n;j=i,i++) drawline2d(px[i]+(ox-px[i])*.125,py[i]+(oy-py[i])*.125,px[j]+(ox-px[j])*.125,py[j]+(oy-py[j])*.125,31);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ static const char *texcache_errorstr[TEXCACHEERRORS] = {
|
||||||
"bglGetTexLevelParameteriv failed",
|
"bglGetTexLevelParameteriv failed",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// <dashade>: ignored if not in Polymost+r_usetileshades
|
||||||
pthtyp *texcache_fetch(int32_t dapicnum, int32_t dapalnum, int32_t dashade, int32_t dameth)
|
pthtyp *texcache_fetch(int32_t dapicnum, int32_t dapalnum, int32_t dashade, int32_t dameth)
|
||||||
{
|
{
|
||||||
int32_t i, j;
|
int32_t i, j;
|
||||||
|
@ -35,7 +36,8 @@ pthtyp *texcache_fetch(int32_t dapicnum, int32_t dapalnum, int32_t dashade, int3
|
||||||
|
|
||||||
j = (dapicnum&(GLTEXCACHEADSIZ-1));
|
j = (dapicnum&(GLTEXCACHEADSIZ-1));
|
||||||
|
|
||||||
if (getrendermode() != REND_POLYMOST || !r_usetileshades) dashade = 0;
|
if (getrendermode() != REND_POLYMOST || !r_usetileshades)
|
||||||
|
dashade = 0;
|
||||||
|
|
||||||
si = usehightile ? hicfindsubst(dapicnum,dapalnum,drawingskybox) : NULL;
|
si = usehightile ? hicfindsubst(dapicnum,dapalnum,drawingskybox) : NULL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue