light: add -bouncecolorscale flag
This commit is contained in:
parent
4e69914cb2
commit
55df37941c
|
|
@ -232,7 +232,8 @@ extern qboolean dirtAngleSetOnCmdline;
|
|||
extern qboolean bounce;
|
||||
extern qboolean bouncedebug;
|
||||
extern vec_t bouncescale;
|
||||
|
||||
extern vec_t bouncecolorscale;
|
||||
|
||||
/*
|
||||
* Return space for the lightmap and colourmap at the same time so it can
|
||||
* be done in a thread-safe manner.
|
||||
|
|
|
|||
|
|
@ -1062,6 +1062,10 @@ LoadEntities(const bsp2_t *bsp)
|
|||
bouncescale = atof(com_token);
|
||||
logprint("_bouncescale set to %f\n", bouncescale);
|
||||
}
|
||||
else if (!strcmp(key, "_bouncecolorscale")) {
|
||||
bouncecolorscale = atof(com_token);
|
||||
logprint("_bouncecolorscale set to %f\n", bouncecolorscale);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ qboolean dirtAngleSetOnCmdline = false;
|
|||
qboolean bounce = false;
|
||||
qboolean bouncedebug = false;
|
||||
vec_t bouncescale = 1.0f;
|
||||
vec_t bouncecolorscale = 0.0f;
|
||||
|
||||
qboolean testFenceTextures = false;
|
||||
qboolean surflight_dump = false;
|
||||
|
|
@ -1318,6 +1319,10 @@ main(int argc, const char **argv)
|
|||
bounce = true;
|
||||
bouncescale = atof( argv[ ++i ] );
|
||||
logprint( "Bounce scale factor set to %f on command line\n", bouncescale );
|
||||
} else if ( !strcmp( argv[ i ], "-bouncecolorscale" ) ) {
|
||||
bounce = true;
|
||||
bouncecolorscale = atof( argv[ ++i ] );
|
||||
logprint( "Bounce color scale factor set to %f on command line\n", bouncecolorscale );
|
||||
} else if ( !strcmp( argv[ i ], "-fence" ) ) {
|
||||
testFenceTextures = true;
|
||||
logprint( "Fence texture tracing enabled on command line\n" );
|
||||
|
|
|
|||
|
|
@ -2164,9 +2164,16 @@ LightFace(bsp2_dface_t *face, facesup_t *facesup, const modelinfo_t *modelinfo,
|
|||
|
||||
// make bounce light
|
||||
if (bounce) {
|
||||
vec3_t gray = {127, 127, 127};
|
||||
|
||||
// lerp between gray and the texture color according to `bouncecolorscale`
|
||||
vec3_t blendedcolor = {0, 0, 0};
|
||||
VectorMA(blendedcolor, bouncecolorscale, lightsurf->texturecolor, blendedcolor);
|
||||
VectorMA(blendedcolor, 1-bouncecolorscale, gray, blendedcolor);
|
||||
|
||||
vec3_t emitcolor;
|
||||
for (int k=0; k<3; k++) {
|
||||
emitcolor[k] = (lightsurf->radiosity[k] / 255.0f) * (lightsurf->texturecolor[k] / 255.0f);
|
||||
emitcolor[k] = (lightsurf->radiosity[k] / 255.0f) * (blendedcolor[k] / 255.0f);
|
||||
}
|
||||
winding_t *w = WindingFromFace(bsp, face);
|
||||
AddBounceLight(lightsurf->midpoint, emitcolor, lightsurf->plane.normal, WindingArea(w), bsp);
|
||||
|
|
|
|||
Loading…
Reference in New Issue