Add gl_lightmap_nearest.

Add a warning if the world moves.
Fix tags to not loop on non-looping animations.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4630 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2014-04-02 00:58:02 +00:00
parent 7cbb9d61ca
commit f18c928973
6 changed files with 83 additions and 16 deletions

View File

@ -808,7 +808,7 @@ void M_Menu_Render_f (void)
{
MB_REDTEXT("Rendering Options", false),
MB_TEXT("^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082", false),
MB_CHECKBOXCVAR("Calculate VIS", r_novis, 0),
MB_CHECKBOXCVAR("Disable VIS", r_novis, 0),
MB_CHECKBOXCVAR("Fast Sky", r_fastsky, 0),
MB_CHECKBOXCVAR("Disable Model Lerp", r_nolerp, 0),
MB_CHECKBOXCVAR("Disable Framegroup Lerp", r_noframegrouplerp, 0),
@ -2505,16 +2505,21 @@ const char *Mod_FrameNameForNum(model_t *model, int num);
const char *Mod_SkinNameForNum(model_t *model, int num);
#include "com_mesh.h"
static void M_BoneDisplay(galiasbone_t *b, int *y, int depth, int parent, int first, int last)
static void M_BoneDisplay(entity_t *e, galiasbone_t *b, int *y, int depth, int parent, int first, int last)
{
int i;
for (i = first; i < last; i++)
{
if (b[i].parent == parent)
{
Draw_FunString(depth*16, *y, va("%i: %s", i, b[i].name));
float result[12];
memset(result, 0, sizeof(result));
if (Mod_GetTag(e->model, i, &e->framestate, result))
Draw_FunString(depth*16, *y, va("%i: %s (%g %g %g)", i, b[i].name, result[3], result[7], result[11]));
else
Draw_FunString(depth*16, *y, va("%i: %s", i, b[i].name));
*y += 8;
M_BoneDisplay(b, y, depth+1, i, i+1, last);
M_BoneDisplay(e, b, y, depth+1, i, i+1, last);
}
}
}
@ -2603,7 +2608,7 @@ static void M_ModelViewerDraw(int x, int y, struct menucustom_s *c, struct menu_
{
Draw_FunString(0, y, va("Bones: ", mods->skingroup, fname));
y+=8;
M_BoneDisplay(b, &y, 0, -1, 0, bonecount);
M_BoneDisplay(&ent, b, &y, 0, -1, 0, bonecount);
}
}
}

View File

@ -150,6 +150,9 @@ cvar_t r_waterwarp = CVARF ("r_waterwarp", "1",
cvar_t r_replacemodels = CVARFD ("r_replacemodels", IFMINIMAL("","md3 md2"),
CVAR_ARCHIVE, "A list of filename extensions to attempt to use instead of mdl.");
cvar_t gl_lightmap_nearest = CVARFD ("gl_lightmap_nearest", "0", CVAR_ARCHIVE, "Use nearest sampling for lightmaps. This will give a more blocky look. Meaningless when gl_lightmap_nearest is enabled.");
cvar_t gl_lightmap_average = CVARFD ("gl_lightmap_average", "0", CVAR_ARCHIVE, "Determine lightmap values based upon the center of the polygon. This will give a more buggy look, quite probably.");
//otherwise it would defeat the point.
cvar_t scr_allowsnap = CVARF ("scr_allowsnap", "1",
CVAR_NOTFROMSERVER);
@ -478,6 +481,9 @@ void GLRenderer_Init(void)
Cvar_Register (&gl_menutint_shader, GLRENDEREROPTIONS);
Cvar_Register (&gl_lightmap_nearest, GLRENDEREROPTIONS);
Cvar_Register (&gl_lightmap_average, GLRENDEREROPTIONS);
R_BloomRegister();
}
#endif

View File

@ -3772,9 +3772,23 @@ qboolean Mod_GetTag(model_t *model, int tagnum, framestate_t *fstate, float *res
if (f2ness != 1)
{
f1time *= g1->rate;
frame1 = (int)f1time%g1->numposes;
frame2 = ((int)f1time+1)%g1->numposes;
f1time = f1time - (int)f1time;
if (g1->loop)
{
frame1 = (int)f1time%g1->numposes;
frame2 = ((int)f1time+1)%g1->numposes;
f1time = f1time - (int)f1time;
}
else
{
frame1 = (int)f1time;
frame2 = ((int)f1time+1);
f1time = f1time - (int)f1time;
if (frame2 >= g1->numposes)
{
frame1 = frame2 = g1->numposes-1;
f1time = 0;
}
}
pose[numposes] = g1->boneofs + inf->numbones*12*frame1;
plerp[numposes] = (1-f1time) * (1-f2ness);
numposes++;
@ -3788,9 +3802,23 @@ qboolean Mod_GetTag(model_t *model, int tagnum, framestate_t *fstate, float *res
if (f2ness)
{
f2time *= g2->rate;
frame1 = (int)f2time%g2->numposes;
frame2 = ((int)f2time+1)%g2->numposes;
f2time = f2time - (int)f2time;
if (g2->loop)
{
frame1 = (int)f2time%g2->numposes;
frame2 = ((int)f2time+1)%g2->numposes;
f2time = f2time - (int)f2time;
}
else
{
frame1 = (int)f2time;
frame2 = ((int)f2time+1);
f2time = f2time - (int)f2time;
if (frame2 >= g2->numposes)
{
frame1 = frame2 = g2->numposes-1;
f2time = 0;
}
}
pose[numposes] = g2->boneofs + inf->numbones*12*frame1;
plerp[numposes] = (1-f2time) * f2ness;
numposes++;

View File

@ -31,6 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern cvar_t r_shadow_bumpscale_basetexture;
extern cvar_t r_replacemodels;
extern cvar_t gl_lightmap_average;
qboolean isnotmap = true; //used to not warp ammo models.
@ -2523,10 +2524,21 @@ void ModQ1_Batches_BuildQ1Q2Poly(model_t *mod, msurface_t *surf, void *cookie)
mesh->st_array[i][0] = s/surf->texinfo->texture->width;
mesh->st_array[i][1] = t/surf->texinfo->texture->height;
for (sty = 0; sty < 1; sty++)
if (gl_lightmap_average.ival)
{
mesh->lmst_array[sty][i][0] = (s - surf->texturemins[0] + (surf->light_s[sty]*16) + 8) / (mod->lightmaps.width*16);
mesh->lmst_array[sty][i][1] = (t - surf->texturemins[1] + (surf->light_t[sty]*16) + 8) / (mod->lightmaps.height*16);
for (sty = 0; sty < 1; sty++)
{
mesh->lmst_array[sty][i][0] = (surf->extents[0]*0.5 + (surf->light_s[sty]*16) + 8) / (mod->lightmaps.width*16);
mesh->lmst_array[sty][i][1] = (surf->extents[1]*0.5 + (surf->light_t[sty]*16) + 8) / (mod->lightmaps.height*16);
}
}
else
{
for (sty = 0; sty < 1; sty++)
{
mesh->lmst_array[sty][i][0] = (s - surf->texturemins[0] + (surf->light_s[sty]*16) + 8) / (mod->lightmaps.width*16);
mesh->lmst_array[sty][i][1] = (t - surf->texturemins[1] + (surf->light_t[sty]*16) + 8) / (mod->lightmaps.height*16);
}
}
//figure out the texture directions, for bumpmapping and stuff

View File

@ -26,6 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "renderque.h"
#include <math.h>
extern cvar_t gl_lightmap_nearest;
void GLBE_ClearVBO(vbo_t *vbo)
{
int vboh[6 + MAXRLIGHTMAPS];
@ -532,8 +534,16 @@ void GLBE_UploadAllLightmaps(void)
TEXASSIGN(lm->lightmap_texture, R_AllocNewTexture("***lightmap***", lm->width, lm->height, IF_LINEAR|IF_NOMIPMAP));
}
GL_MTBind(0, GL_TEXTURE_2D, lm->lightmap_texture);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
if (gl_lightmap_nearest.ival)
{
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
else
{
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
switch (lightmap_bytes)
{
case 4:

View File

@ -1468,8 +1468,14 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
else
snprintf(sv.mapname, sizeof(sv.mapname), "%s", sv.name);
if (Cvar_Get("sv_readonlyworld", "1", 0, "DP compatability")->value)
{
ent->readonly = true; //lock it down!
if (ent->v->origin[0] != 0 || ent->v->origin[1] != 0 || ent->v->origin[2] != 0 || ent->v->angles[0] != 0 || ent->v->angles[1] != 0 || ent->v->angles[2] != 0)
Con_Printf("Warning: The world has moved. Alert your nearest reputable news agency.\n");
}
// look up some model indexes for specialized message compression
SV_FindModelNumbers ();
}