vmap: Added vmap_lightLinear, added vmap_lightLinearFade, plus light_surface

can now check for spawnflags 1 and has a valid 'fade' key value.
This commit is contained in:
Marco Cawthorne 2021-08-28 13:44:15 +02:00
parent 56603d6048
commit c5bfadcf1a
3 changed files with 37 additions and 3 deletions

View file

@ -400,9 +400,11 @@ void CreateEntityLights( void ){
si = info->si;
float lb;
float llfade;
int subd;
int style;
float bscale, bsfrac, bsdist;
int sflags;
if (!stristr(si->shader, surfacename))
continue;
@ -413,13 +415,15 @@ void CreateEntityLights( void ){
* the rest is always dummy values which are meaningless.
*/
sscanf( _light_brightness, "%*f %*f %*f %f", &lb );
}
else {
} else {
lb = FloatForKey( e, "light" );
}
sflags = IntForKey( e, "spawnflags" );
subd = IntForKey( e, "subdivisions" );
style = IntForKey( e, "style" );
bscale = FloatForKey( e, "bouncescale" );
llfade = FloatForKey( e, "fade" );
/* 0.05 is a default */
bsfrac = FloatForKey( e, "backsplash_fraction" ) * 0.01f;
@ -430,6 +434,10 @@ void CreateEntityLights( void ){
/* only apply when things are set. */
if (lb)
si->value = lb;
if (sflags & 1)
si->lightLinear = qtrue;
if (llfade)
si->lightLinearFade = llfade;
if (subd)
si->lightSubdivide = subd;
if (style)
@ -859,9 +867,22 @@ void CreateSurfaceLights( void ){
/* set it up */
light->flags = LIGHT_Q3A_DEFAULT;
/* vmap_lightLinear */
if (si->lightLinear == qtrue) {
light->flags &= ~LIGHT_ATTEN_ANGLE;
light->flags |= LIGHT_ATTEN_LINEAR;
}
light->type = EMIT_POINT;
light->photons = si->value * pointScale;
light->fade = 1.0f;
/* vmap_lightLinearFade <multiplier> */
light->fade = si->lightLinearFade;
if (light->fade == 0.0f)
light->fade = 1.0f;
light->si = si;
VectorCopy( origin, light->origin );
VectorCopy( si->color, light->color );

View file

@ -1406,6 +1406,17 @@ shaderInfo_t *ShaderInfoForShader( const char *shaderName ){
si->lightSubdivide = atoi( mattoken );
}
/* vmap_lightLinear */
else if ( !Q_stricmp( mattoken, "vmap_lightLinear" ) ) {
si->lightLinear = qtrue;
}
/* vmap_lightLinearFade multiplier */
else if ( !Q_stricmp( mattoken, "vmap_lightLinearFade" ) ) {
GetMatTokenAppend( shaderText, qfalse );
si->lightLinearFade = atof( mattoken );
}
/* q3map_backsplash <percent> <distance> */
else if ( !Q_stricmp( mattoken, "q3map_backsplash" ) || !Q_stricmp( mattoken, "vmap_backsplash" ) ) {
GetMatTokenAppend( shaderText, qfalse );

View file

@ -693,6 +693,8 @@ typedef struct shaderInfo_s
float backsplashDistance; /* default 16 */
float lightSubdivide; /* default 999 */
float lightFilterRadius; /* ydnar: lightmap filtering/blurring radius for lights created by this shader (default: 0) */
qb_t lightLinear; /* vmap addition */
float lightLinearFade; /* vmap addition */
int lightmapSampleSize; /* lightmap sample size */
float lightmapSampleOffset; /* ydnar: lightmap sample offset (default: 1.0) */