light: allow setting _dist and _range in worldspawn

This commit is contained in:
Eric Wasylishen 2015-03-19 18:51:32 -06:00
parent ef471ee44f
commit 6fe67cd2fb
3 changed files with 34 additions and 6 deletions

View File

@ -72,6 +72,8 @@ typedef struct entity_s {
vec_t dirtdepth;
int dirtmode;
int minlight_dirt;
vec_t dist;
vec_t range;
/* worldspawn, light entities */
vec_t dirtscale;

View File

@ -698,6 +698,12 @@ LoadEntities(const bsp2_t *bsp)
else if (!strcmp(key, "_samples")) {
entity->num_samples = atoi(com_token);
}
else if (!strcmp(key, "_dist")) {
entity->dist = atof(com_token);
}
else if (!strcmp(key, "_range")) {
entity->range = atof(com_token);
}
}
/*
@ -729,6 +735,18 @@ LoadEntities(const bsp2_t *bsp)
if (entity->anglescale >= 0 && entity->anglescale <= 1.0)
sun_anglescale = entity->anglescale;
if (entity->dist != 0.0) {
scaledist = entity->dist;
logprint("using _dist value %f from worldspawn.\n",
scaledist);
}
if (entity->range != 0.0) {
rangescale = entity->range;
logprint("using _range value %f from worldspawn.\n",
rangescale);
}
if (entity->dirtdepth && !dirtDepthSetOnCmdline) {
dirtDepth = entity->dirtdepth;
logprint("Using dirtdepth value %f from worldspawn.\n",

View File

@ -33,14 +33,11 @@ light levels to the global minimum, add the global minimum light level
to all style 0 lightmaps. This may help reducing the sometimes
uniform minlight effect.
.IP "\fB\-dist n\fP"
Scales the fade distance of all lights by a factor of n. If n > 1 lights fade
more quickly with distance and if n < 1, lights fade more slowly with distance
and light reaches further.
Scales the fade distance of all lights by a factor of n. See "_dist"
worldspawn key.
.IP "\fB\-range n\fP"
Scales the brightness range of all lights without affecting their fade
discance. Values of n > 0.5 makes lights brighter and n < 0.5 makes lights
less bright. The same effect can be achieved on individual lights by
adjusting both the "light" and "wait" attributes.
discance. See "_range" worldspawn key.
.IP "\fB\-gate n\fP"
Set a minimum light level, below which can be considered zero brightness.
This can dramatically speed up processing when there are large numbers of
@ -84,6 +81,17 @@ Set a global minimum light level of "n" across the whole map. This is an easy
way to eliminate completely dark areas of the level, however you may lose some
contrast as a result, so use with care. Default 0.
.IP "\fB""_dist"" ""n""\fP"
Scales the fade distance of all lights by a factor of n. If n > 1 lights fade
more quickly with distance and if n < 1, lights fade more slowly with distance
and light reaches further.
.IP "\fB""_range"" ""n""\fP"
Scales the brightness range of all lights without affecting their fade
discance. Values of n > 0.5 makes lights brighter and n < 0.5 makes lights
less bright. The same effect can be achieved on individual lights by
adjusting both the "light" and "wait" attributes.
.IP "\fB""_sunlight"" ""n""\fP"
Set the brightness of the sunlight coming from an unseen sun in the sky. Sky
brushes (or more accurately bsp leafs with sky contents) will emit sunlight at