- Options to reduce the blinding dynamic light flare effects to not so blinding that it affects the gameplay negatively
- Some unfinished hack to try to get tvMode screenshots
This commit is contained in:
@@ -233,7 +233,9 @@ void RB_AddFlare(srfFlare_t *surface, int fogNum, vec3_t point, vec3_t color, ve
|
||||
VectorCopy( color, f->color );
|
||||
|
||||
|
||||
|
||||
if ( (r_flaresDlightFade->integer) && (type == 1) ) { // leilei - dynamic light flares fading instantly
|
||||
f->fadeTime = -666;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -256,7 +258,32 @@ void RB_AddFlare(srfFlare_t *surface, int fogNum, vec3_t point, vec3_t color, ve
|
||||
f->theshader = surface->shadder;
|
||||
else
|
||||
f->theshader = tr.flareShader;
|
||||
|
||||
|
||||
|
||||
if ( (type == 1) && (r_flaresDlightScale->value) ) { // leilei - dynamic light flare scale
|
||||
float ef = r_flaresDlightScale->value;
|
||||
if (ef > 1.0f) ef = 1.0f;
|
||||
if (ef < 0.01f) ef = 0.01f;
|
||||
|
||||
f->radius *= ef;
|
||||
}
|
||||
|
||||
if ( (type == 1) && (r_flaresDlightOpacity->value) ) { // leilei - dynamic light flare scale
|
||||
float ef = r_flaresDlightOpacity->value;
|
||||
if (ef > 1.0f) ef = 1.0f;
|
||||
if (ef < 0.1f) ef = 0.1f;
|
||||
|
||||
f->color[0] *= ef;
|
||||
f->color[1] *= ef;
|
||||
f->color[2] *= ef;
|
||||
}
|
||||
|
||||
|
||||
// if ( (r_flaresDlightShrink->integer) && (type == 1) ) // leilei - dynamic light flares shrinking when close
|
||||
// {
|
||||
|
||||
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
@@ -280,6 +307,7 @@ void RB_AddDlightFlares( void ) {
|
||||
if(tr.world)
|
||||
fog = tr.world->fogs;
|
||||
|
||||
|
||||
for (i=0 ; i<backEnd.refdef.num_dlights ; i++, l++) {
|
||||
|
||||
if(fog)
|
||||
@@ -315,17 +343,83 @@ FLARE BACK END
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
RB_TestFlareFast
|
||||
|
||||
faster simple one.
|
||||
==================
|
||||
*/
|
||||
static void RB_TestFlareFast( flare_t *f ) {
|
||||
float depth;
|
||||
qboolean visible;
|
||||
float fade;
|
||||
float screenZ;
|
||||
|
||||
|
||||
backEnd.pc.c_flareTests++;
|
||||
|
||||
// visible = 1; // it's visible damnit
|
||||
// doing a readpixels is as good as doing a glFinish(), so
|
||||
// don't bother with another sync
|
||||
glState.finishCalled = qfalse;
|
||||
|
||||
// read back the z buffer contents
|
||||
|
||||
qglReadPixels( f->windowX, f->windowY, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth );
|
||||
|
||||
|
||||
screenZ = backEnd.viewParms.projectionMatrix[14] /
|
||||
( ( 2*depth - 1 ) * backEnd.viewParms.projectionMatrix[11] - backEnd.viewParms.projectionMatrix[10] );
|
||||
|
||||
visible = ( -f->eyeZ - -screenZ ) < 24;
|
||||
|
||||
|
||||
if ( visible ) {
|
||||
if ( !f->visible ) {
|
||||
f->visible = qtrue;
|
||||
f->fadeTime = backEnd.refdef.time - 1;
|
||||
}
|
||||
{
|
||||
fade = 1; // instant fade
|
||||
}
|
||||
} else {
|
||||
if ( f->visible ) {
|
||||
f->visible = qfalse;
|
||||
f->fadeTime = backEnd.refdef.time - 1;
|
||||
}
|
||||
fade = 0; // instant appear
|
||||
}
|
||||
|
||||
if ( fade < 0 ) {
|
||||
fade = 0;
|
||||
}
|
||||
if ( fade > 1 ) {
|
||||
fade = 1;
|
||||
}
|
||||
|
||||
f->drawIntensity = fade;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
RB_TestFlare
|
||||
==================
|
||||
*/
|
||||
void RB_TestFlare( flare_t *f ) {
|
||||
static void RB_TestFlare( flare_t *f ) {
|
||||
float depth;
|
||||
qboolean visible;
|
||||
float fade;
|
||||
float screenZ;
|
||||
|
||||
if (f->fadeTime == -666)
|
||||
{
|
||||
RB_TestFlareFast(f);
|
||||
return;
|
||||
}
|
||||
|
||||
backEnd.pc.c_flareTests++;
|
||||
|
||||
|
||||
@@ -371,50 +465,6 @@ void RB_TestFlare( flare_t *f ) {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
RB_TestFlareFast
|
||||
|
||||
faster simple one.
|
||||
==================
|
||||
*/
|
||||
void RB_TestFlareFast( flare_t *f ) {
|
||||
qboolean visible;
|
||||
float fade;
|
||||
|
||||
|
||||
backEnd.pc.c_flareTests++;
|
||||
|
||||
visible = 1; // it's visible damnit
|
||||
|
||||
|
||||
if ( visible ) {
|
||||
if ( !f->visible ) {
|
||||
f->visible = qtrue;
|
||||
f->fadeTime = backEnd.refdef.time - 1;
|
||||
}
|
||||
{
|
||||
fade = 1; // instant fade
|
||||
}
|
||||
} else {
|
||||
if ( f->visible ) {
|
||||
f->visible = qfalse;
|
||||
f->fadeTime = backEnd.refdef.time - 1;
|
||||
}
|
||||
fade = 0; // instant appear
|
||||
}
|
||||
|
||||
if ( fade < 0 ) {
|
||||
fade = 0;
|
||||
}
|
||||
if ( fade > 1 ) {
|
||||
fade = 1;
|
||||
}
|
||||
|
||||
f->drawIntensity = fade;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
@@ -441,6 +491,16 @@ void RB_RenderFlare( flare_t *f ) {
|
||||
else
|
||||
distance = -f->eyeZ;
|
||||
|
||||
if ( (r_flaresDlightShrink->integer) && (f->type == 1) ) // leilei - dynamic light flares shrinking when close
|
||||
{
|
||||
|
||||
float newd = distance / (48.0f);
|
||||
if (newd > 1) newd = 1.0f;
|
||||
|
||||
flaredsize *= newd;
|
||||
}
|
||||
|
||||
|
||||
if(!f->radius)
|
||||
f->radius = 0.0f; // leilei - don't do a radius if there is no radius at all!
|
||||
|
||||
@@ -462,11 +522,14 @@ void RB_RenderFlare( flare_t *f ) {
|
||||
|
||||
size = flaredsize * ( (r_flareSize->value) /640.0f + 8 / distance );
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* As flare sizes stay nearly constant with increasing distance we must decrease the intensity
|
||||
* to achieve a reasonable visual result. The intensity is ~ (size^2 / distance^2) which can be
|
||||
@@ -503,6 +566,9 @@ void RB_RenderFlare( flare_t *f ) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Calculations for fogging
|
||||
if(tr.world && f->fogNum > 0 && f->fogNum < tr.world->numfogs)
|
||||
{
|
||||
|
@@ -191,6 +191,10 @@ cvar_t *r_flareSun; // type of flare to use for the sun
|
||||
cvar_t *r_specMode;
|
||||
//cvar_t *r_waveMode;
|
||||
cvar_t *r_flaresDlight;
|
||||
cvar_t *r_flaresDlightShrink;
|
||||
cvar_t *r_flaresDlightFade;
|
||||
cvar_t *r_flaresDlightOpacity;
|
||||
cvar_t *r_flaresDlightScale;
|
||||
//cvar_t *r_flaresSurfradii;
|
||||
cvar_t *r_alternateBrightness; // leilei - linux overbright fix
|
||||
cvar_t *r_mockvr; // Leilei - for debugging PVR only!
|
||||
@@ -569,11 +573,24 @@ void RB_TakeScreenshotJPEG(int x, int y, int width, int height, char *fileName)
|
||||
RB_TakeScreenshotCmd
|
||||
==================
|
||||
*/
|
||||
|
||||
extern int tvWidth;
|
||||
extern int tvHeight;
|
||||
|
||||
const void *RB_TakeScreenshotCmd( const void *data ) {
|
||||
const screenshotCommand_t *cmd;
|
||||
|
||||
cmd = (const screenshotCommand_t *)data;
|
||||
|
||||
// leilei - hack for tvmode
|
||||
if (r_tvMode->integer){
|
||||
|
||||
if (cmd->jpeg)
|
||||
RB_TakeScreenshotJPEG( cmd->x, cmd->y, tvWidth, tvHeight, cmd->fileName);
|
||||
else
|
||||
RB_TakeScreenshot( cmd->x, cmd->y, tvWidth, tvHeight, cmd->fileName);
|
||||
}
|
||||
|
||||
if (cmd->jpeg)
|
||||
RB_TakeScreenshotJPEG( cmd->x, cmd->y, cmd->width, cmd->height, cmd->fileName);
|
||||
else
|
||||
@@ -1249,6 +1266,10 @@ void R_Register( void )
|
||||
r_flareQuality = ri.Cvar_Get( "r_flareQuality", "0" , CVAR_ARCHIVE); // use fast flares for default
|
||||
r_flareMethod = ri.Cvar_Get( "r_flareMethod", "0" , CVAR_ARCHIVE);
|
||||
r_flaresDlight = ri.Cvar_Get( "r_flaresDlight", "0" , CVAR_ARCHIVE ); // dynamic light flares
|
||||
r_flaresDlightShrink = ri.Cvar_Get( "r_flaresDlightShrink", "1" , CVAR_ARCHIVE ); // dynamic light flares shrinking when close (reducing muzzleflash blindness)
|
||||
r_flaresDlightFade = ri.Cvar_Get( "r_flaresDlightFade", "0" , CVAR_ARCHIVE | CVAR_CHEAT ); // dynamic light flares fading (workaround clipping bug)
|
||||
r_flaresDlightOpacity = ri.Cvar_Get( "r_flaresDlightOpacity", "0.5" , CVAR_ARCHIVE ); // dynamic light flares (workaround poor visibility)
|
||||
r_flaresDlightScale = ri.Cvar_Get( "r_flaresDlightScale", "0.7" , CVAR_ARCHIVE ); // dynamic light flares (workaround poor visibility)
|
||||
r_flareSun = ri.Cvar_Get( "r_flareSun", "0" , CVAR_ARCHIVE); // it's 0 because mappers expect 0.
|
||||
|
||||
|
||||
|
@@ -1312,6 +1312,10 @@ extern cvar_t *r_shadeSpecular; // leilei - allows the special specular diffus
|
||||
//extern cvar_t *r_waveMode;
|
||||
|
||||
extern cvar_t *r_flaresDlight;
|
||||
extern cvar_t *r_flaresDlightShrink;
|
||||
extern cvar_t *r_flaresDlightFade;
|
||||
extern cvar_t *r_flaresDlightOpacity;
|
||||
extern cvar_t *r_flaresDlightScale;
|
||||
//extern cvar_t *r_flaresSurfradii;
|
||||
|
||||
extern cvar_t *r_alternateBrightness; // leilei - alternate brightness
|
||||
|
Reference in New Issue
Block a user