gl_overbright_all effects gl_lightmap_shift, and gl_overbright_all 0 correctly works for only Q2 vs Q3 however just noticed Q3 uses overbright 2 for maps and 1 for models... yay
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2223 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
a7a6dcc92f
commit
ba38acd1ce
3 changed files with 37 additions and 22 deletions
|
@ -4030,6 +4030,7 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned
|
||||||
#endif
|
#endif
|
||||||
case Q2BSPVERSION:
|
case Q2BSPVERSION:
|
||||||
mapisq3 = false;
|
mapisq3 = false;
|
||||||
|
loadmodel->engineflags |= MDLF_NEEDOVERBRIGHT;
|
||||||
for (i=0 ; i<Q2HEADER_LUMPS ; i++)
|
for (i=0 ; i<Q2HEADER_LUMPS ; i++)
|
||||||
{
|
{
|
||||||
header.lumps[i].filelen = LittleLong (header.lumps[i].filelen);
|
header.lumps[i].filelen = LittleLong (header.lumps[i].filelen);
|
||||||
|
@ -5997,7 +5998,6 @@ int map_checksum;
|
||||||
qboolean Mod_LoadQ2BrushModel (model_t *mod, void *buffer)
|
qboolean Mod_LoadQ2BrushModel (model_t *mod, void *buffer)
|
||||||
{
|
{
|
||||||
mod->fromgame = fg_quake2;
|
mod->fromgame = fg_quake2;
|
||||||
mod->engineflags |= MDLF_NEEDOVERBRIGHT;
|
|
||||||
return CM_LoadMap(mod->name, buffer, true, &map_checksum) != NULL;
|
return CM_LoadMap(mod->name, buffer, true, &map_checksum) != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
//these are shared with gl_rsurf - move to header
|
//these are shared with gl_rsurf - move to header
|
||||||
void R_MirrorChain (msurface_t *s);
|
void R_MirrorChain (msurface_t *s);
|
||||||
void GL_SelectTexture (GLenum target);
|
void GL_SelectTexture (GLenum target);
|
||||||
void R_RenderDynamicLightmaps (msurface_t *fa);
|
void R_RenderDynamicLightmaps (msurface_t *fa, int shift);
|
||||||
void R_BlendLightmaps (void);
|
void R_BlendLightmaps (void);
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,6 +74,8 @@ int ppl_specular_shader_texr;
|
||||||
int ppl_specular_shader_texu;
|
int ppl_specular_shader_texu;
|
||||||
int ppl_specular_shader_texf;
|
int ppl_specular_shader_texf;
|
||||||
|
|
||||||
|
int GLR_LightmapShift (model_t *model);
|
||||||
|
|
||||||
//#define glBegin glEnd
|
//#define glBegin glEnd
|
||||||
|
|
||||||
qboolean PPL_ShouldDraw(void)
|
qboolean PPL_ShouldDraw(void)
|
||||||
|
@ -1712,6 +1714,7 @@ void PPL_BaseBModelTextures(entity_t *e)
|
||||||
{
|
{
|
||||||
extern msurface_t *r_alpha_surfaces;
|
extern msurface_t *r_alpha_surfaces;
|
||||||
int i, k;
|
int i, k;
|
||||||
|
int shift;
|
||||||
model_t *model;
|
model_t *model;
|
||||||
msurface_t *s;
|
msurface_t *s;
|
||||||
msurface_t *chain = NULL;
|
msurface_t *chain = NULL;
|
||||||
|
@ -1721,6 +1724,8 @@ void PPL_BaseBModelTextures(entity_t *e)
|
||||||
currentmodel = model = e->model;
|
currentmodel = model = e->model;
|
||||||
s = model->surfaces+model->firstmodelsurface;
|
s = model->surfaces+model->firstmodelsurface;
|
||||||
|
|
||||||
|
shift = GLR_LightmapShift(currentmodel);
|
||||||
|
|
||||||
if (currententity->drawflags & DRF_TRANSLUCENT)
|
if (currententity->drawflags & DRF_TRANSLUCENT)
|
||||||
currententity->shaderRGBAf[3]=0.5;
|
currententity->shaderRGBAf[3]=0.5;
|
||||||
if ((currententity->drawflags & MLS_ABSLIGHT) == MLS_ABSLIGHT)
|
if ((currententity->drawflags & MLS_ABSLIGHT) == MLS_ABSLIGHT)
|
||||||
|
@ -1765,7 +1770,7 @@ void PPL_BaseBModelTextures(entity_t *e)
|
||||||
|
|
||||||
//update lightmaps.
|
//update lightmaps.
|
||||||
for (s = model->surfaces+model->firstmodelsurface,i = 0; i < model->nummodelsurfaces; i++, s++)
|
for (s = model->surfaces+model->firstmodelsurface,i = 0; i < model->nummodelsurfaces; i++, s++)
|
||||||
R_RenderDynamicLightmaps (s);
|
R_RenderDynamicLightmaps (s, shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ extern msurface_t *r_mirror_chain;
|
||||||
|
|
||||||
mleaf_t *r_vischain; // linked list of visible leafs
|
mleaf_t *r_vischain; // linked list of visible leafs
|
||||||
|
|
||||||
void R_RenderDynamicLightmaps (msurface_t *fa);
|
void R_RenderDynamicLightmaps (msurface_t *fa, int shift);
|
||||||
|
|
||||||
extern cvar_t gl_detail;
|
extern cvar_t gl_detail;
|
||||||
extern cvar_t r_stains;
|
extern cvar_t r_stains;
|
||||||
|
@ -68,6 +68,14 @@ extern cvar_t r_stainfadeammount;
|
||||||
|
|
||||||
//extern cvar_t gl_lightmapmode;
|
//extern cvar_t gl_lightmapmode;
|
||||||
|
|
||||||
|
int GLR_LightmapShift (model_t *model)
|
||||||
|
{
|
||||||
|
extern cvar_t gl_overbright_all, gl_lightmap_shift;
|
||||||
|
|
||||||
|
if (gl_overbright_all.value || (model->engineflags & MDLF_NEEDOVERBRIGHT))
|
||||||
|
return bound(0, gl_lightmap_shift.value, 2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//radius, x y z, r g b
|
//radius, x y z, r g b
|
||||||
void GLR_StainSurf (msurface_t *surf, float *parms)
|
void GLR_StainSurf (msurface_t *surf, float *parms)
|
||||||
|
@ -725,7 +733,7 @@ R_BuildLightMap
|
||||||
Combine and scale multiple lightmaps into the 8.8 format in blocklights
|
Combine and scale multiple lightmaps into the 8.8 format in blocklights
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void GLR_BuildLightMap (msurface_t *surf, qbyte *dest, qbyte *deluxdest, stmap *stainsrc)
|
void GLR_BuildLightMap (msurface_t *surf, qbyte *dest, qbyte *deluxdest, stmap *stainsrc, int shift)
|
||||||
{
|
{
|
||||||
int smax, tmax;
|
int smax, tmax;
|
||||||
int t;
|
int t;
|
||||||
|
@ -745,15 +753,8 @@ void GLR_BuildLightMap (msurface_t *surf, qbyte *dest, qbyte *deluxdest, stmap *
|
||||||
int cr, cg, cb;
|
int cr, cg, cb;
|
||||||
#endif
|
#endif
|
||||||
int stride = LMBLOCK_WIDTH*lightmap_bytes;
|
int stride = LMBLOCK_WIDTH*lightmap_bytes;
|
||||||
int shift;
|
|
||||||
|
|
||||||
if (gl_lightmap_shift.value >= 2)
|
|
||||||
shift = 9;
|
|
||||||
else if (gl_lightmap_shift.value == 1)
|
|
||||||
shift = 8;
|
|
||||||
else
|
|
||||||
shift = 7;
|
|
||||||
|
|
||||||
|
shift += 7; // increase to base value
|
||||||
surf->cached_dlight = (surf->dlightframe == r_framecount);
|
surf->cached_dlight = (surf->dlightframe == r_framecount);
|
||||||
|
|
||||||
smax = (surf->extents[0]>>4)+1;
|
smax = (surf->extents[0]>>4)+1;
|
||||||
|
@ -1914,9 +1915,10 @@ R_RenderDynamicLightmaps
|
||||||
Multitexture
|
Multitexture
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void R_RenderDynamicLightmaps (msurface_t *fa)
|
void R_RenderDynamicLightmaps (msurface_t *fa, int shift)
|
||||||
{
|
{
|
||||||
qbyte *base, *luxbase; stmap *stainbase;
|
qbyte *base, *luxbase;
|
||||||
|
stmap *stainbase;
|
||||||
int maps;
|
int maps;
|
||||||
glRect_t *theRect;
|
glRect_t *theRect;
|
||||||
int smax, tmax;
|
int smax, tmax;
|
||||||
|
@ -1941,7 +1943,6 @@ void R_RenderDynamicLightmaps (msurface_t *fa)
|
||||||
return; //some textures do this.
|
return; //some textures do this.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// fa->polys->chain = lightmap[fa->lightmaptexturenum]->polys;
|
// fa->polys->chain = lightmap[fa->lightmaptexturenum]->polys;
|
||||||
// lightmap[fa->lightmaptexturenum]->polys = fa->polys;
|
// lightmap[fa->lightmaptexturenum]->polys = fa->polys;
|
||||||
|
|
||||||
|
@ -2011,7 +2012,7 @@ dynamic:
|
||||||
luxbase += fa->light_t * LMBLOCK_WIDTH * 3 + fa->light_s * 3;
|
luxbase += fa->light_t * LMBLOCK_WIDTH * 3 + fa->light_s * 3;
|
||||||
stainbase = lightmap[fa->lightmaptexturenum]->stainmaps;
|
stainbase = lightmap[fa->lightmaptexturenum]->stainmaps;
|
||||||
stainbase += (fa->light_t * LMBLOCK_WIDTH + fa->light_s) * 3;
|
stainbase += (fa->light_t * LMBLOCK_WIDTH + fa->light_s) * 3;
|
||||||
GLR_BuildLightMap (fa, base, luxbase, stainbase);
|
GLR_BuildLightMap (fa, base, luxbase, stainbase, shift);
|
||||||
|
|
||||||
RSpeedEnd(RSPEED_DYNAMIC);
|
RSpeedEnd(RSPEED_DYNAMIC);
|
||||||
}
|
}
|
||||||
|
@ -2814,6 +2815,7 @@ static void GLR_RecursiveWorldNode (mnode_t *node)
|
||||||
msurface_t *surf, **mark;
|
msurface_t *surf, **mark;
|
||||||
mleaf_t *pleaf;
|
mleaf_t *pleaf;
|
||||||
double dot;
|
double dot;
|
||||||
|
int shift;
|
||||||
|
|
||||||
start:
|
start:
|
||||||
|
|
||||||
|
@ -2883,6 +2885,8 @@ start:
|
||||||
{
|
{
|
||||||
surf = cl.worldmodel->surfaces + node->firstsurface;
|
surf = cl.worldmodel->surfaces + node->firstsurface;
|
||||||
|
|
||||||
|
shift = GLR_LightmapShift(cl.worldmodel);
|
||||||
|
|
||||||
// if (dot < 0 -BACKFACE_EPSILON)
|
// if (dot < 0 -BACKFACE_EPSILON)
|
||||||
// side = SURF_PLANEBACK;
|
// side = SURF_PLANEBACK;
|
||||||
// else if (dot > BACKFACE_EPSILON)
|
// else if (dot > BACKFACE_EPSILON)
|
||||||
|
@ -2896,7 +2900,7 @@ start:
|
||||||
// if (((dot < 0) ^ !!(surf->flags & SURF_PLANEBACK)))
|
// if (((dot < 0) ^ !!(surf->flags & SURF_PLANEBACK)))
|
||||||
// continue; // wrong side
|
// continue; // wrong side
|
||||||
|
|
||||||
R_RenderDynamicLightmaps (surf);
|
R_RenderDynamicLightmaps (surf, shift);
|
||||||
// if sorting by texture, just store it out
|
// if sorting by texture, just store it out
|
||||||
/* if (surf->flags & SURF_DRAWALPHA)
|
/* if (surf->flags & SURF_DRAWALPHA)
|
||||||
{ // add to the translucent chain
|
{ // add to the translucent chain
|
||||||
|
@ -2927,6 +2931,7 @@ static void GLR_RecursiveQ2WorldNode (mnode_t *node)
|
||||||
msurface_t *surf, **mark;
|
msurface_t *surf, **mark;
|
||||||
mleaf_t *pleaf;
|
mleaf_t *pleaf;
|
||||||
double dot;
|
double dot;
|
||||||
|
int shift;
|
||||||
|
|
||||||
int sidebit;
|
int sidebit;
|
||||||
|
|
||||||
|
@ -2999,6 +3004,8 @@ static void GLR_RecursiveQ2WorldNode (mnode_t *node)
|
||||||
// recurse down the children, front side first
|
// recurse down the children, front side first
|
||||||
GLR_RecursiveQ2WorldNode (node->children[side]);
|
GLR_RecursiveQ2WorldNode (node->children[side]);
|
||||||
|
|
||||||
|
shift = GLR_LightmapShift(currentmodel);
|
||||||
|
|
||||||
// draw stuff
|
// draw stuff
|
||||||
for ( c = node->numsurfaces, surf = currentmodel->surfaces + node->firstsurface; c ; c--, surf++)
|
for ( c = node->numsurfaces, surf = currentmodel->surfaces + node->firstsurface; c ; c--, surf++)
|
||||||
{
|
{
|
||||||
|
@ -3010,7 +3017,7 @@ static void GLR_RecursiveQ2WorldNode (mnode_t *node)
|
||||||
|
|
||||||
surf->visframe = r_framecount+1;//-1;
|
surf->visframe = r_framecount+1;//-1;
|
||||||
|
|
||||||
R_RenderDynamicLightmaps (surf);
|
R_RenderDynamicLightmaps (surf, shift);
|
||||||
|
|
||||||
if (surf->texinfo->flags & (SURF_TRANS33|SURF_TRANS66))
|
if (surf->texinfo->flags & (SURF_TRANS33|SURF_TRANS66))
|
||||||
{ // add to the translucent chain
|
{ // add to the translucent chain
|
||||||
|
@ -3663,7 +3670,7 @@ void BuildSurfaceDisplayList (msurface_t *fa)
|
||||||
GL_CreateSurfaceLightmap
|
GL_CreateSurfaceLightmap
|
||||||
========================
|
========================
|
||||||
*/
|
*/
|
||||||
void GL_CreateSurfaceLightmap (msurface_t *surf)
|
void GL_CreateSurfaceLightmap (msurface_t *surf, int shift)
|
||||||
{
|
{
|
||||||
int smax, tmax;
|
int smax, tmax;
|
||||||
qbyte *base, *luxbase; stmap *stainbase;
|
qbyte *base, *luxbase; stmap *stainbase;
|
||||||
|
@ -3697,7 +3704,7 @@ void GL_CreateSurfaceLightmap (msurface_t *surf)
|
||||||
stainbase = lightmap[surf->lightmaptexturenum]->stainmaps;
|
stainbase = lightmap[surf->lightmaptexturenum]->stainmaps;
|
||||||
stainbase += (surf->light_t * LMBLOCK_WIDTH + surf->light_s) * 3;
|
stainbase += (surf->light_t * LMBLOCK_WIDTH + surf->light_s) * 3;
|
||||||
|
|
||||||
GLR_BuildLightMap (surf, base, luxbase, stainbase);
|
GLR_BuildLightMap (surf, base, luxbase, stainbase, shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3736,6 +3743,7 @@ void GL_BuildLightmaps (void)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
model_t *m;
|
model_t *m;
|
||||||
|
int shift;
|
||||||
|
|
||||||
r_framecount = 1; // no dlightcache
|
r_framecount = 1; // no dlightcache
|
||||||
|
|
||||||
|
@ -3821,9 +3829,11 @@ void GL_BuildLightmaps (void)
|
||||||
|
|
||||||
r_pcurrentvertbase = m->vertexes;
|
r_pcurrentvertbase = m->vertexes;
|
||||||
currentmodel = m;
|
currentmodel = m;
|
||||||
|
shift = GLR_LightmapShift(currentmodel);
|
||||||
|
|
||||||
for (i=0 ; i<m->numsurfaces ; i++)
|
for (i=0 ; i<m->numsurfaces ; i++)
|
||||||
{
|
{
|
||||||
GL_CreateSurfaceLightmap (m->surfaces + i);
|
GL_CreateSurfaceLightmap (m->surfaces + i, shift);
|
||||||
P_EmitSkyEffectTris(m, &m->surfaces[i]);
|
P_EmitSkyEffectTris(m, &m->surfaces[i]);
|
||||||
if (m->surfaces[i].mesh) //there are some surfaces that have a display list already (the subdivided ones)
|
if (m->surfaces[i].mesh) //there are some surfaces that have a display list already (the subdivided ones)
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue