mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-25 21:31:37 +00:00
Optimise env_cubemap. Fix some compile warnings.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5564 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
a524692e4f
commit
1d56c1443e
10 changed files with 44 additions and 14 deletions
|
@ -230,11 +230,11 @@ function otherpackages {
|
|||
|
||||
#Note: only the native linux-sdl target can be compiled, as libSDL[2]-dev doesn't support multiarch properly, and we depend upon it instead of building from source (thus ensuring it has whatever distro stuff needed... though frankly that should be inside the .so instead of the headers).
|
||||
|
||||
if [ $UID -eq 0 ] && [ ! -z `which apt-get` ]; then
|
||||
#if [ $UID -eq 0 ] && [ ! -z `which apt-get` ]; then
|
||||
#because multiarch requires separate packages for some things, we'll need to set that up now (in case noone did that yet)
|
||||
# dpkg --add-architecture i386
|
||||
# apt-get update
|
||||
fi
|
||||
#fi
|
||||
|
||||
#generic crap. much of this is needed to set up and decompress dependancies and stuff.
|
||||
debianpackages subversion make automake libtool p7zip-full zip ca-certificates || otherpackages z7 make svn || exit
|
||||
|
|
|
@ -4024,6 +4024,7 @@ static qboolean XCF_CombineLayer(struct xcf_s *f)
|
|||
case 3: Vector4Set(px, in[0], in[1], in[2], 0xff); break;
|
||||
case 2: Vector4Set(px, in[0], in[0], in[0], in[1]); break;
|
||||
case 1: Vector4Set(px, in[0], in[0], in[0], 0xff); break;
|
||||
default:
|
||||
case 0: Vector4Set(px, 0xff, 0xff, 0xff, 0xff); break;
|
||||
}
|
||||
if (applylayermask)
|
||||
|
|
|
@ -664,6 +664,7 @@ static void PM_AddSubList(const char *url, const char *prefix, qboolean save, qb
|
|||
numdownloadablelists++;
|
||||
}
|
||||
}
|
||||
#ifdef WEBCLIENT
|
||||
static void PM_RemSubList(const char *url)
|
||||
{
|
||||
int i;
|
||||
|
@ -675,6 +676,7 @@ static void PM_RemSubList(const char *url)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static qboolean PM_ParsePackageList(vfsfile_t *f, int parseflags, const char *url, const char *prefix)
|
||||
{
|
||||
|
|
|
@ -359,6 +359,7 @@ cvar_t gl_blend2d = CVAR ("gl_blend2d", "1");
|
|||
cvar_t gl_blendsprites = CVARD ("gl_blendsprites", "0", "Blend sprites instead of alpha testing them");
|
||||
cvar_t r_deluxemapping_cvar = CVARAFD ("r_deluxemapping", "1", "r_glsl_deluxemapping",
|
||||
CVAR_ARCHIVE|CVAR_RENDERERLATCH, "Enables bumpmapping based upon precomputed light directions.\n0=off\n1=use if available\n2=auto-generate (if possible)");
|
||||
cvar_t mod_loadsurfenvmaps = CVARD ("r_loadsurfenvmaps", "1", "Load local reflection environment-maps, where available. These are normally defined via env_cubemap entities dotted around the place.");
|
||||
qboolean r_deluxemapping;
|
||||
cvar_t r_shaderblobs = CVARD ("r_shaderblobs", "0", "If enabled, can massively accelerate vid restarts / loading (especially with the d3d renderer). Can cause issues when upgrading engine versions, so this is disabled by default.");
|
||||
cvar_t gl_compress = CVARFD ("gl_compress", "0", CVAR_ARCHIVE, "Enable automatic texture compression even for textures which are not pre-compressed.");
|
||||
|
@ -599,6 +600,7 @@ void GLRenderer_Init(void)
|
|||
|
||||
Cvar_Register (&r_lightmap_nearest, GLRENDEREROPTIONS);
|
||||
Cvar_Register (&r_lightmap_average, GLRENDEREROPTIONS);
|
||||
Cvar_Register (&mod_loadsurfenvmaps, GLRENDEREROPTIONS);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -4548,11 +4548,6 @@ static qboolean Sys_SteamHasFile(char *basepath, int basepathlen, char *steamdir
|
|||
}
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
static qboolean Sys_SteamHasFile(char *basepath, int basepathlen, char *steamdir, char *fname)
|
||||
{ //this system probably has no steam installs...
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
qboolean Sys_DoDirectoryPrompt(char *basepath, size_t basepathsize, const char *poshname, const char *savedname)
|
||||
|
|
|
@ -584,7 +584,7 @@ void Plug_Command_f(void)
|
|||
if (!plugincommandarray[i].plugin)
|
||||
continue; //don't check commands who's owners died.
|
||||
|
||||
if (stricmp(plugincommandarray[i].command, cmd)) //not the right command
|
||||
if (Q_strcasecmp(plugincommandarray[i].command, cmd)) //not the right command
|
||||
continue;
|
||||
|
||||
currentplug = plugincommandarray[i].plugin;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "shader.h"
|
||||
|
||||
extern cvar_t r_decal_noperpendicular;
|
||||
extern cvar_t mod_loadsurfenvmaps;
|
||||
|
||||
/*
|
||||
Decal functions
|
||||
|
@ -2428,6 +2429,10 @@ void BSPX_LoadEnvmaps(model_t *mod, bspx_header_t *bspx, void *mod_base)
|
|||
menvmap_t *out;
|
||||
int count;
|
||||
denvmap_t *in = BSPX_FindLump(bspx, mod_base, "ENVMAP", &count);
|
||||
mod->envmaps = NULL;
|
||||
mod->numenvmaps = 0;
|
||||
if (!mod_loadsurfenvmaps.ival)
|
||||
return;
|
||||
if (count%sizeof(*in))
|
||||
return; //erk
|
||||
count /= sizeof(*in);
|
||||
|
|
|
@ -190,6 +190,11 @@ static void Mod_TextureList_f(void)
|
|||
char *body;
|
||||
char editname[MAX_OSPATH];
|
||||
int preview = (Cmd_Argc()==1)?8:atoi(Cmd_Argv(1));
|
||||
|
||||
int s;
|
||||
batch_t *batch;
|
||||
unsigned int batchcount;
|
||||
|
||||
for (m=0 , mod=mod_known ; m<mod_numknown ; m++, mod++)
|
||||
{
|
||||
if (shownmodelname)
|
||||
|
@ -207,6 +212,18 @@ static void Mod_TextureList_f(void)
|
|||
if (!tx)
|
||||
continue; //happens on e1m2
|
||||
|
||||
batchcount = 0;
|
||||
for (s = 0; s < SHADER_SORT_COUNT; s++)
|
||||
{
|
||||
for (batch = mod->batches[s]; batch; batch = batch->next)
|
||||
{
|
||||
if (batch->texture == tx)
|
||||
batchcount++;
|
||||
}
|
||||
}
|
||||
// if (!batchcount)
|
||||
// continue; //not actually used...
|
||||
|
||||
if (!shownmodelname)
|
||||
{
|
||||
shownmodelname = true;
|
||||
|
@ -232,9 +249,9 @@ static void Mod_TextureList_f(void)
|
|||
Con_Printf("^[\\img\\%s\\imgtype\\%i\\s\\%i\\tip\\{%s^]", tx->shader->name, tx->shader->usageflags, preview, body);
|
||||
}
|
||||
if (*editname)
|
||||
Con_Printf(" ^[%s\\edit\\%s\\tipimg\\%s\\tipimgtype\\%i\\tip\\{%s^]\n", tx->name, editname, tx->name, tx->shader->usageflags, body);
|
||||
Con_Printf(" ^[%s\\edit\\%s\\tipimg\\%s\\tipimgtype\\%i\\tip\\{%s^] (%u batches)\n", tx->name, editname, tx->name, tx->shader->usageflags, body, batchcount);
|
||||
else
|
||||
Con_Printf(" ^[%s\\tipimg\\%s\\tipimgtype\\%i\\tip\\{%s^]\n", tx->name, tx->shader->name, tx->shader->usageflags, body);
|
||||
Con_Printf(" ^[%s\\tipimg\\%s\\tipimgtype\\%i\\tip\\{%s^] (%u batches)\n", tx->name, tx->shader->name, tx->shader->usageflags, body, batchcount);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
@ -2861,6 +2878,7 @@ static int Mod_Batches_Generate(model_t *mod)
|
|||
int sortid;
|
||||
batch_t *batch, *lbatch = NULL;
|
||||
vec4_t plane;
|
||||
image_t *envmap;
|
||||
|
||||
int merge = mod->lightmaps.merge;
|
||||
if (!merge)
|
||||
|
@ -2877,6 +2895,7 @@ static int Mod_Batches_Generate(model_t *mod)
|
|||
{
|
||||
surf = mod->surfaces + mod->firstmodelsurface + i;
|
||||
shader = surf->texinfo->texture->shader;
|
||||
envmap = surf->envmap;
|
||||
|
||||
if (surf->flags & SURF_NODRAW)
|
||||
{
|
||||
|
@ -2884,6 +2903,7 @@ static int Mod_Batches_Generate(model_t *mod)
|
|||
sortid = shader->sort;
|
||||
VectorClear(plane);
|
||||
plane[3] = 0;
|
||||
envmap = NULL;
|
||||
}
|
||||
else if (shader)
|
||||
{
|
||||
|
@ -2908,6 +2928,9 @@ static int Mod_Batches_Generate(model_t *mod)
|
|||
VectorClear(plane);
|
||||
plane[3] = 0;
|
||||
}
|
||||
|
||||
if (!(shader->flags & SHADER_HASREFLECTCUBE))
|
||||
envmap = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2928,7 +2951,7 @@ static int Mod_Batches_Generate(model_t *mod)
|
|||
lbatch->lightmap[3] == lmmerge(surf->lightmaptexturenums[3]) &&
|
||||
#endif
|
||||
lbatch->fog == surf->fog &&
|
||||
lbatch->envmap == surf->envmap))
|
||||
lbatch->envmap == envmap))
|
||||
batch = lbatch;
|
||||
else
|
||||
{
|
||||
|
@ -2946,7 +2969,7 @@ static int Mod_Batches_Generate(model_t *mod)
|
|||
batch->lightmap[3] == lmmerge(surf->lightmaptexturenums[3]) &&
|
||||
#endif
|
||||
batch->fog == surf->fog &&
|
||||
batch->envmap == surf->envmap)
|
||||
batch->envmap == envmap)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2983,7 +3006,7 @@ static int Mod_Batches_Generate(model_t *mod)
|
|||
batch->next = mod->batches[sortid];
|
||||
batch->ent = &r_worldentity;
|
||||
batch->fog = surf->fog;
|
||||
batch->envmap = surf->envmap;
|
||||
batch->envmap = envmap;
|
||||
Vector4Copy(plane, batch->plane);
|
||||
|
||||
mod->batches[sortid] = batch;
|
||||
|
|
|
@ -2805,6 +2805,7 @@ static qboolean Shaderpass_MapGen (parsestate_t *ps, shaderpass_t *pass, char *t
|
|||
}
|
||||
else if (!Q_stricmp (tname, "$reflectcube"))
|
||||
{
|
||||
shader->flags |= SHADER_HASREFLECTCUBE;
|
||||
pass->texgen = T_GEN_REFLECTCUBE;
|
||||
}
|
||||
else if (!Q_stricmp (tname, "$reflectmask"))
|
||||
|
@ -4348,7 +4349,7 @@ void Shader_FixupProgPasses(parsestate_t *ps, shaderpass_t *pass)
|
|||
{T_GEN_LOWEROVERLAY, SHADER_HASTOPBOTTOM}, //6
|
||||
{T_GEN_FULLBRIGHT, SHADER_HASFULLBRIGHT}, //7
|
||||
{T_GEN_PALETTED, SHADER_HASPALETTED}, //8
|
||||
{T_GEN_REFLECTCUBE, 0}, //9
|
||||
{T_GEN_REFLECTCUBE, SHADER_HASREFLECTCUBE}, //9
|
||||
{T_GEN_REFLECTMASK, 0}, //10
|
||||
{T_GEN_DISPLACEMENT, SHADER_HASDISPLACEMENT},//11
|
||||
{T_GEN_OCCLUSION, 0}, //12
|
||||
|
|
|
@ -641,6 +641,7 @@ struct shader_s
|
|||
SHADER_NODLIGHT = 1 << 15, //from surfaceflags
|
||||
SHADER_HASLIGHTMAP = 1 << 16,
|
||||
SHADER_HASTOPBOTTOM = 1 << 17,
|
||||
SHADER_HASREFLECTCUBE = 1 << 18, //shader has a T_GEN_REFLECTCUBE pass (otherwise we can skip surf envmaps for better batching)
|
||||
// SHADER_STATICDATA = 1 << 18, //set if true: no deforms, no tcgen, rgbgen=identitylighting, alphagen=identity, tmu0=st + tmu1=lm(if available) for every pass, no norms
|
||||
SHADER_HASREFLECT = 1 << 19, //says that we need to generate a reflection image first
|
||||
SHADER_HASREFRACT = 1 << 20, //says that we need to generate a refraction image first
|
||||
|
|
Loading…
Reference in a new issue