vmap: Simplify the last commit, by giving us what's basically areascale

for individual surfaces. (vmap_surfaceLightDistance and areascale for
light_surface)
This commit is contained in:
Marco Cawthorne 2021-08-28 14:46:03 +02:00
parent c5bfadcf1a
commit 99aebfc57b
4 changed files with 12 additions and 30 deletions

View file

@ -400,11 +400,10 @@ void CreateEntityLights( void ){
si = info->si;
float lb;
float llfade;
int subd;
int style;
float bscale, bsfrac, bsdist;
int sflags;
float ascale;
if (!stristr(si->shader, surfacename))
continue;
@ -419,29 +418,26 @@ void CreateEntityLights( void ){
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;
/* 23 units apparently is the default */
bsdist = FloatForKey( e, "backsplash_distance" );
ascale = FloatForKey( e, "areascale" );
/* 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)
si->lightStyle = style;
if (ascale)
si->surfLightDistance = ascale;
if (bscale)
si->bounceScale = bscale;
if (bsfrac)
@ -868,20 +864,9 @@ 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;
/* vmap_lightLinearFade <multiplier> */
light->fade = si->lightLinearFade;
if (light->fade == 0.0f)
light->fade = 1.0f;
light->fade = 1.0f;
light->si = si;
VectorCopy( origin, light->origin );

View file

@ -548,6 +548,7 @@ static void RadSubdivideDiffuseLight( int lightmapNum, bspDrawSurface_t *ds, raw
light->si = si;
light->fade = 1.0f;
light->w = w;
area *= si->surfLightDistance;
/* set falloff threshold */
light->falloffTolerance = falloffTolerance;

View file

@ -1406,15 +1406,10 @@ 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" ) ) {
/* vmap_surfacelight multiplier */
else if ( !Q_stricmp( mattoken, "vmap_surfaceLightDistance" ) ) {
GetMatTokenAppend( shaderText, qfalse );
si->lightLinearFade = atof( mattoken );
si->surfLightDistance = atof( mattoken );
}
/* q3map_backsplash <percent> <distance> */

View file

@ -693,8 +693,9 @@ 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 */
qb_t lightLinear;
float lightLinearFade;
float surfLightDistance; /* vmap addition */
int lightmapSampleSize; /* lightmap sample size */
float lightmapSampleOffset; /* ydnar: lightmap sample offset (default: 1.0) */