mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
Engine: Rename HICR_NOCOMPRESS to HICR_NODOWNSIZE, CACHEAD_NOCOMPRESS to CACHEAD_NODOWNSIZE, DAMETH_NOCOMPRESS to DAMETH_NODOWNSIZE, and HICR_NOSAVE to HICR_NOTEXCOMPRESS.
git-svn-id: https://svn.eduke32.com/eduke32@5640 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
d88df093a7
commit
e2df2d60d1
6 changed files with 31 additions and 31 deletions
|
@ -68,16 +68,16 @@ enum
|
||||||
CACHEAD_NONPOW2 = 1,
|
CACHEAD_NONPOW2 = 1,
|
||||||
CACHEAD_HASALPHA = 2,
|
CACHEAD_HASALPHA = 2,
|
||||||
CACHEAD_COMPRESSED = 4,
|
CACHEAD_COMPRESSED = 4,
|
||||||
CACHEAD_NOCOMPRESS = 8,
|
CACHEAD_NODOWNSIZE = 8,
|
||||||
};
|
};
|
||||||
|
|
||||||
// hicreplctyp hicr->flags bits
|
// hicreplctyp hicr->flags bits
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
HICR_NOSAVE = 1,
|
HICR_NOTEXCOMPRESS = 1,
|
||||||
HICR_FORCEFILTER = 2,
|
HICR_FORCEFILTER = 2,
|
||||||
|
|
||||||
HICR_NOCOMPRESS = 16,
|
HICR_NODOWNSIZE = 16,
|
||||||
};
|
};
|
||||||
|
|
||||||
// hictinting[].f / gloadtile_hi() and daskinloader() <effect> arg bits
|
// hictinting[].f / gloadtile_hi() and daskinloader() <effect> arg bits
|
||||||
|
|
|
@ -154,7 +154,7 @@ enum {
|
||||||
DAMETH_BACKFACECULL = -1,
|
DAMETH_BACKFACECULL = -1,
|
||||||
|
|
||||||
// used internally by uploadtexture
|
// used internally by uploadtexture
|
||||||
DAMETH_NOCOMPRESS = 4096,
|
DAMETH_NODOWNSIZE = 4096,
|
||||||
DAMETH_HI = 8192,
|
DAMETH_HI = 8192,
|
||||||
DAMETH_NOFIX = 16384,
|
DAMETH_NOFIX = 16384,
|
||||||
};
|
};
|
||||||
|
|
|
@ -279,7 +279,7 @@ static int32_t Defs_ImportTileFromTexture(char const * const fn, int32_t const t
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
if (istexture)
|
if (istexture)
|
||||||
hicsetsubsttex(tile, 0, fn, (float)(255-alphacut) * (1.f/255.f), 1.0f, 1.0f, 1.0f, 1.0f, HICR_NOSAVE|HICR_NOCOMPRESS);
|
hicsetsubsttex(tile, 0, fn, (float)(255-alphacut) * (1.f/255.f), 1.0f, 1.0f, 1.0f, 1.0f, HICR_NOTEXCOMPRESS|HICR_NODOWNSIZE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -299,7 +299,7 @@ static int32_t Defs_ImportTileFromTexture(char const * const fn, int32_t const t
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
if (istexture)
|
if (istexture)
|
||||||
hicsetsubsttex(tile, 0, fn, (float)(255-alphacut) * (1.f/255.f), 1.0f, 1.0f, 1.0, 1.0, HICR_NOSAVE|HICR_NOCOMPRESS);
|
hicsetsubsttex(tile, 0, fn, (float)(255-alphacut) * (1.f/255.f), 1.0f, 1.0f, 1.0, 1.0, HICR_NOTEXCOMPRESS|HICR_NODOWNSIZE);
|
||||||
#else
|
#else
|
||||||
UNREFERENCED_PARAMETER(istexture);
|
UNREFERENCED_PARAMETER(istexture);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1578,9 +1578,9 @@ static int32_t defsparser(scriptfile *script)
|
||||||
scriptfile_getnumber(script,&surfnum); break;
|
scriptfile_getnumber(script,&surfnum); break;
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
case T_NOCOMPRESS:
|
case T_NOCOMPRESS:
|
||||||
flags |= HICR_NOSAVE; break;
|
flags |= HICR_NOTEXCOMPRESS; break;
|
||||||
case T_NODOWNSIZE:
|
case T_NODOWNSIZE:
|
||||||
flags |= HICR_NOCOMPRESS; break;
|
flags |= HICR_NODOWNSIZE; break;
|
||||||
case T_FORCEFILTER:
|
case T_FORCEFILTER:
|
||||||
flags |= HICR_FORCEFILTER; break;
|
flags |= HICR_FORCEFILTER; break;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1914,9 +1914,9 @@ static int32_t defsparser(scriptfile *script)
|
||||||
scriptfile_getstring(script,&fn[5]); break;
|
scriptfile_getstring(script,&fn[5]); break;
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
case T_NOCOMPRESS:
|
case T_NOCOMPRESS:
|
||||||
flags |= HICR_NOSAVE; break;
|
flags |= HICR_NOTEXCOMPRESS; break;
|
||||||
case T_NODOWNSIZE:
|
case T_NODOWNSIZE:
|
||||||
flags |= HICR_NOCOMPRESS; break;
|
flags |= HICR_NODOWNSIZE; break;
|
||||||
case T_FORCEFILTER:
|
case T_FORCEFILTER:
|
||||||
flags |= HICR_FORCEFILTER; break;
|
flags |= HICR_FORCEFILTER; break;
|
||||||
#endif
|
#endif
|
||||||
|
@ -2252,9 +2252,9 @@ static int32_t defsparser(scriptfile *script)
|
||||||
scriptfile_getdouble(script,&specfactor); break;
|
scriptfile_getdouble(script,&specfactor); break;
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
case T_NOCOMPRESS:
|
case T_NOCOMPRESS:
|
||||||
flags |= HICR_NOSAVE; break;
|
flags |= HICR_NOTEXCOMPRESS; break;
|
||||||
case T_NODOWNSIZE:
|
case T_NODOWNSIZE:
|
||||||
flags |= HICR_NOCOMPRESS; break;
|
flags |= HICR_NODOWNSIZE; break;
|
||||||
case T_FORCEFILTER:
|
case T_FORCEFILTER:
|
||||||
flags |= HICR_FORCEFILTER; break;
|
flags |= HICR_FORCEFILTER; break;
|
||||||
#endif
|
#endif
|
||||||
|
@ -2340,9 +2340,9 @@ static int32_t defsparser(scriptfile *script)
|
||||||
scriptfile_getdouble(script,&specfactor); break;
|
scriptfile_getdouble(script,&specfactor); break;
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
case T_NOCOMPRESS:
|
case T_NOCOMPRESS:
|
||||||
flags |= HICR_NOSAVE; break;
|
flags |= HICR_NOTEXCOMPRESS; break;
|
||||||
case T_NODOWNSIZE:
|
case T_NODOWNSIZE:
|
||||||
flags |= HICR_NOCOMPRESS; break;
|
flags |= HICR_NODOWNSIZE; break;
|
||||||
case T_FORCEFILTER:
|
case T_FORCEFILTER:
|
||||||
flags |= HICR_FORCEFILTER; break;
|
flags |= HICR_FORCEFILTER; break;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -890,7 +890,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
|
||||||
|
|
||||||
//gluBuild2DMipmaps(GL_TEXTURE_2D,GL_RGBA,xsiz,ysiz,GL_BGRA_EXT,GL_UNSIGNED_BYTE,(char *)fptr);
|
//gluBuild2DMipmaps(GL_TEXTURE_2D,GL_RGBA,xsiz,ysiz,GL_BGRA_EXT,GL_UNSIGNED_BYTE,(char *)fptr);
|
||||||
#if !defined EDUKE32_GLES
|
#if !defined EDUKE32_GLES
|
||||||
if (glinfo.texcompr && glusetexcompr && !(sk->flags & HICR_NOSAVE))
|
if (glinfo.texcompr && glusetexcompr && !(sk->flags & HICR_NOTEXCOMPRESS))
|
||||||
intexfmt = hasalpha ? GL_COMPRESSED_RGBA_ARB : GL_COMPRESSED_RGB_ARB;
|
intexfmt = hasalpha ? GL_COMPRESSED_RGBA_ARB : GL_COMPRESSED_RGB_ARB;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
@ -900,7 +900,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
|
||||||
if (glinfo.bgra)
|
if (glinfo.bgra)
|
||||||
texfmt = GL_BGRA;
|
texfmt = GL_BGRA;
|
||||||
|
|
||||||
uploadtexture((doalloc&1), siz, intexfmt, texfmt, (coltype *)fptr, siz, DAMETH_HI | (sk->flags & HICR_NOCOMPRESS ? DAMETH_NOCOMPRESS : 0));
|
uploadtexture((doalloc&1), siz, intexfmt, texfmt, (coltype *)fptr, siz, DAMETH_HI | (sk->flags & HICR_NODOWNSIZE ? DAMETH_NODOWNSIZE : 0));
|
||||||
Bfree((void *)fptr);
|
Bfree((void *)fptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -952,17 +952,17 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
|
||||||
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
|
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
|
||||||
|
|
||||||
if (glinfo.texcompr && glusetexcompr && glusetexcache)
|
if (glinfo.texcompr && glusetexcompr && glusetexcache)
|
||||||
if (!gotcache && !(sk->flags & HICR_NOSAVE))
|
if (!gotcache && !(sk->flags & HICR_NOTEXCOMPRESS))
|
||||||
{
|
{
|
||||||
const int32_t nonpow2 = check_nonpow2(siz.x) || check_nonpow2(siz.y);
|
const int32_t nonpow2 = check_nonpow2(siz.x) || check_nonpow2(siz.y);
|
||||||
|
|
||||||
// save off the compressed version
|
// save off the compressed version
|
||||||
cachead.quality = (sk->flags & HICR_NOCOMPRESS) ? 0 : r_downsize;
|
cachead.quality = (sk->flags & HICR_NODOWNSIZE) ? 0 : r_downsize;
|
||||||
cachead.xdim = osizx>>cachead.quality;
|
cachead.xdim = osizx>>cachead.quality;
|
||||||
cachead.ydim = osizy>>cachead.quality;
|
cachead.ydim = osizy>>cachead.quality;
|
||||||
|
|
||||||
cachead.flags = nonpow2*CACHEAD_NONPOW2 | (hasalpha ? CACHEAD_HASALPHA : 0) |
|
cachead.flags = nonpow2*CACHEAD_NONPOW2 | (hasalpha ? CACHEAD_HASALPHA : 0) |
|
||||||
(sk->flags & HICR_NOCOMPRESS ? CACHEAD_NOCOMPRESS : 0);
|
(sk->flags & HICR_NODOWNSIZE ? CACHEAD_NODOWNSIZE : 0);
|
||||||
|
|
||||||
/// OSD_Printf("Caching \"%s\"\n",fn);
|
/// OSD_Printf("Caching \"%s\"\n",fn);
|
||||||
texcache_writetex(fn, picfillen, pal<<8, hicfxmask(pal), &cachead);
|
texcache_writetex(fn, picfillen, pal<<8, hicfxmask(pal), &cachead);
|
||||||
|
|
|
@ -650,10 +650,10 @@ void uploadtexture(int32_t doalloc, vec2_t siz, int32_t intexfmt, int32_t texfmt
|
||||||
coltype *pic, vec2_t tsiz, int32_t dameth)
|
coltype *pic, vec2_t tsiz, int32_t dameth)
|
||||||
{
|
{
|
||||||
const int hi = !!(dameth & DAMETH_HI);
|
const int hi = !!(dameth & DAMETH_HI);
|
||||||
const int nocompress = !!(dameth & DAMETH_NOCOMPRESS);
|
const int nodownsize = !!(dameth & DAMETH_NODOWNSIZE);
|
||||||
const int nomiptransfix = !!(dameth & DAMETH_NOFIX);
|
const int nomiptransfix = !!(dameth & DAMETH_NOFIX);
|
||||||
|
|
||||||
dameth &= ~(DAMETH_HI|DAMETH_NOCOMPRESS|DAMETH_NOFIX);
|
dameth &= ~(DAMETH_HI|DAMETH_NODOWNSIZE|DAMETH_NOFIX);
|
||||||
|
|
||||||
if (gltexmaxsize <= 0)
|
if (gltexmaxsize <= 0)
|
||||||
{
|
{
|
||||||
|
@ -674,7 +674,7 @@ void uploadtexture(int32_t doalloc, vec2_t siz, int32_t intexfmt, int32_t texfmt
|
||||||
while ((siz.x >> miplevel) > (1 << gltexmaxsize) || (siz.y >> miplevel) > (1 << gltexmaxsize))
|
while ((siz.x >> miplevel) > (1 << gltexmaxsize) || (siz.y >> miplevel) > (1 << gltexmaxsize))
|
||||||
miplevel++;
|
miplevel++;
|
||||||
|
|
||||||
if (hi && !nocompress && r_downsize > miplevel)
|
if (hi && !nodownsize && r_downsize > miplevel)
|
||||||
miplevel = r_downsize;
|
miplevel = r_downsize;
|
||||||
|
|
||||||
if (!miplevel)
|
if (!miplevel)
|
||||||
|
@ -1244,10 +1244,10 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
|
||||||
else texfmt = GL_BGRA;
|
else texfmt = GL_BGRA;
|
||||||
|
|
||||||
if (tsiz.x>>r_downsize <= tilesiz[dapic].x || tsiz.y>>r_downsize <= tilesiz[dapic].y)
|
if (tsiz.x>>r_downsize <= tilesiz[dapic].x || tsiz.y>>r_downsize <= tilesiz[dapic].y)
|
||||||
hicr->flags |= (HICR_NOCOMPRESS + HICR_NOSAVE);
|
hicr->flags |= (HICR_NODOWNSIZE + HICR_NOTEXCOMPRESS);
|
||||||
|
|
||||||
#if !defined EDUKE32_GLES
|
#if !defined EDUKE32_GLES
|
||||||
if (glinfo.texcompr && glusetexcompr && !(hicr->flags & HICR_NOSAVE))
|
if (glinfo.texcompr && glusetexcompr && !(hicr->flags & HICR_NOTEXCOMPRESS))
|
||||||
intexfmt = (hasalpha == 255) ? GL_COMPRESSED_RGB_ARB : GL_COMPRESSED_RGBA_ARB;
|
intexfmt = (hasalpha == 255) ? GL_COMPRESSED_RGB_ARB : GL_COMPRESSED_RGBA_ARB;
|
||||||
else
|
else
|
||||||
if (hasalpha == 255) intexfmt = GL_RGB;
|
if (hasalpha == 255) intexfmt = GL_RGB;
|
||||||
|
@ -1263,7 +1263,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
|
||||||
fixtransparency(pic,tsiz,siz,dameth);
|
fixtransparency(pic,tsiz,siz,dameth);
|
||||||
|
|
||||||
uploadtexture(doalloc,siz,intexfmt,texfmt,pic,tsiz,
|
uploadtexture(doalloc,siz,intexfmt,texfmt,pic,tsiz,
|
||||||
dameth | DAMETH_HI | DAMETH_NOFIX | (hicr->flags & HICR_NOCOMPRESS ? DAMETH_NOCOMPRESS : 0));
|
dameth | DAMETH_HI | DAMETH_NOFIX | (hicr->flags & HICR_NODOWNSIZE ? DAMETH_NODOWNSIZE : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// precalculate scaling parameters for replacement
|
// precalculate scaling parameters for replacement
|
||||||
|
@ -1283,7 +1283,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
|
||||||
DO_FREE_AND_NULL(pic);
|
DO_FREE_AND_NULL(pic);
|
||||||
|
|
||||||
if (tsiz.x>>r_downsize <= tilesiz[dapic].x || tsiz.y>>r_downsize <= tilesiz[dapic].y)
|
if (tsiz.x>>r_downsize <= tilesiz[dapic].x || tsiz.y>>r_downsize <= tilesiz[dapic].y)
|
||||||
hicr->flags |= HICR_NOCOMPRESS | HICR_NOSAVE;
|
hicr->flags |= HICR_NODOWNSIZE | HICR_NOTEXCOMPRESS;
|
||||||
|
|
||||||
pth->picnum = dapic;
|
pth->picnum = dapic;
|
||||||
pth->effects = effect;
|
pth->effects = effect;
|
||||||
|
@ -1294,18 +1294,18 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
|
||||||
pth->skyface = facen;
|
pth->skyface = facen;
|
||||||
pth->hicr = hicr;
|
pth->hicr = hicr;
|
||||||
|
|
||||||
if (!gotcache && glinfo.texcompr && glusetexcompr && glusetexcache && !(hicr->flags & HICR_NOSAVE))
|
if (!gotcache && glinfo.texcompr && glusetexcompr && glusetexcache && !(hicr->flags & HICR_NOTEXCOMPRESS))
|
||||||
{
|
{
|
||||||
const int32_t nonpow2 = check_nonpow2(siz.x) || check_nonpow2(siz.y);
|
const int32_t nonpow2 = check_nonpow2(siz.x) || check_nonpow2(siz.y);
|
||||||
|
|
||||||
// save off the compressed version
|
// save off the compressed version
|
||||||
cachead.quality = (hicr->flags & HICR_NOCOMPRESS) ? 0 : r_downsize;
|
cachead.quality = (hicr->flags & HICR_NODOWNSIZE) ? 0 : r_downsize;
|
||||||
cachead.xdim = tsiz.x >> cachead.quality;
|
cachead.xdim = tsiz.x >> cachead.quality;
|
||||||
cachead.ydim = tsiz.y >> cachead.quality;
|
cachead.ydim = tsiz.y >> cachead.quality;
|
||||||
|
|
||||||
// handle nocompress:
|
// handle nodownsize:
|
||||||
cachead.flags = nonpow2 * CACHEAD_NONPOW2 | (hasalpha != 255 ? CACHEAD_HASALPHA : 0) |
|
cachead.flags = nonpow2 * CACHEAD_NONPOW2 | (hasalpha != 255 ? CACHEAD_HASALPHA : 0) |
|
||||||
(hicr->flags & HICR_NOCOMPRESS ? CACHEAD_NOCOMPRESS : 0);
|
(hicr->flags & HICR_NODOWNSIZE ? CACHEAD_NODOWNSIZE : 0);
|
||||||
|
|
||||||
/// OSD_Printf("Caching \"%s\"\n", fn);
|
/// OSD_Printf("Caching \"%s\"\n", fn);
|
||||||
texcache_writetex(fn, picfillen + (dapalnum << 8), dameth, effect, &cachead);
|
texcache_writetex(fn, picfillen + (dapalnum << 8), dameth, effect, &cachead);
|
||||||
|
|
|
@ -508,7 +508,7 @@ int32_t texcache_readtexheader(const char *fn, int32_t len, int32_t dameth, char
|
||||||
READTEXHEADER_FAILURE(4);
|
READTEXHEADER_FAILURE(4);
|
||||||
|
|
||||||
// handle nocompress
|
// handle nocompress
|
||||||
if (!modelp && !(head->flags & CACHEAD_NOCOMPRESS) && head->quality != r_downsize)
|
if (!modelp && !(head->flags & CACHEAD_NODOWNSIZE) && head->quality != r_downsize)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (gltexmaxsize && (head->xdim > (1<<gltexmaxsize) || head->ydim > (1<<gltexmaxsize)))
|
if (gltexmaxsize && (head->xdim > (1<<gltexmaxsize) || head->ydim > (1<<gltexmaxsize)))
|
||||||
|
|
Loading…
Reference in a new issue