diff --git a/tools/vmap/light.c b/tools/vmap/light.c index 0c5c2de..4ca7c3f 100644 --- a/tools/vmap/light.c +++ b/tools/vmap/light.c @@ -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 */ - light->fade = si->lightLinearFade; - - if (light->fade == 0.0f) - light->fade = 1.0f; + light->fade = 1.0f; light->si = si; VectorCopy( origin, light->origin ); diff --git a/tools/vmap/light_bounce.c b/tools/vmap/light_bounce.c index 64d0438..72d8d7f 100644 --- a/tools/vmap/light_bounce.c +++ b/tools/vmap/light_bounce.c @@ -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; diff --git a/tools/vmap/shaders.c b/tools/vmap/shaders.c index 90cd8cc..45e1e5f 100644 --- a/tools/vmap/shaders.c +++ b/tools/vmap/shaders.c @@ -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 */ diff --git a/tools/vmap/vmap.h b/tools/vmap/vmap.h index 507d4fd..e33c346 100644 --- a/tools/vmap/vmap.h +++ b/tools/vmap/vmap.h @@ -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) */