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; si = info->si;
float lb; float lb;
float llfade;
int subd; int subd;
int style; int style;
float bscale, bsfrac, bsdist; float bscale, bsfrac, bsdist;
int sflags; float ascale;
if (!stristr(si->shader, surfacename)) if (!stristr(si->shader, surfacename))
continue; continue;
@ -419,29 +418,26 @@ void CreateEntityLights( void ){
lb = FloatForKey( e, "light" ); lb = FloatForKey( e, "light" );
} }
sflags = IntForKey( e, "spawnflags" );
subd = IntForKey( e, "subdivisions" ); subd = IntForKey( e, "subdivisions" );
style = IntForKey( e, "style" ); style = IntForKey( e, "style" );
bscale = FloatForKey( e, "bouncescale" ); bscale = FloatForKey( e, "bouncescale" );
llfade = FloatForKey( e, "fade" );
/* 0.05 is a default */ /* 0.05 is a default */
bsfrac = FloatForKey( e, "backsplash_fraction" ) * 0.01f; bsfrac = FloatForKey( e, "backsplash_fraction" ) * 0.01f;
/* 23 units apparently is the default */ /* 23 units apparently is the default */
bsdist = FloatForKey( e, "backsplash_distance" ); bsdist = FloatForKey( e, "backsplash_distance" );
ascale = FloatForKey( e, "areascale" );
/* only apply when things are set. */ /* only apply when things are set. */
if (lb) if (lb)
si->value = lb; si->value = lb;
if (sflags & 1)
si->lightLinear = qtrue;
if (llfade)
si->lightLinearFade = llfade;
if (subd) if (subd)
si->lightSubdivide = subd; si->lightSubdivide = subd;
if (style) if (style)
si->lightStyle = style; si->lightStyle = style;
if (ascale)
si->surfLightDistance = ascale;
if (bscale) if (bscale)
si->bounceScale = bscale; si->bounceScale = bscale;
if (bsfrac) if (bsfrac)
@ -868,20 +864,9 @@ void CreateSurfaceLights( void ){
/* set it up */ /* set it up */
light->flags = LIGHT_Q3A_DEFAULT; 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->type = EMIT_POINT;
light->photons = si->value * pointScale; 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; light->si = si;
VectorCopy( origin, light->origin ); VectorCopy( origin, light->origin );

View file

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

View file

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

View file

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