light: rename _dome to _sunlight2/_sunlight3

This commit is contained in:
Eric Wasylishen 2019-10-09 20:24:18 -06:00
parent fa62b20603
commit d4cc19afc5
3 changed files with 23 additions and 30 deletions

View File

@ -76,7 +76,7 @@ public:
lockable_vec_t dirtscale, dirtgain, dirt, deviance, samples, projfov, bouncescale;
lockable_vec_t dirt_off_radius, dirt_on_radius;
lockable_vec_t sun; //mxd
lockable_vec_t dome;
lockable_bool_t sunlight2, sunlight3;
lockable_vec_t falloff; //mxd
lockable_bool_t bleed;
lockable_vec3_t origin, color, mangle, projangle;
@ -116,7 +116,8 @@ public:
dirt_off_radius { "dirt_off_radius", 0.0f },
dirt_on_radius { "dirt_on_radius", 0.0f },
sun { "sun", 0 }, //mxd
dome { "dome", 0 },
sunlight2 { "sunlight2", 0 },
sunlight3 { "sunlight3", 0 },
falloff{ "falloff", 0.0f }, //mxd
bleed { "bleed", false },
origin { "origin", 0, 0, 0 },
@ -139,7 +140,7 @@ public:
&dirtscale, &dirtgain, &dirt, &deviance, &samples, &projfov, &bouncescale,
&dirt_off_radius, &dirt_on_radius,
&sun, //mxd
&dome,
&sunlight2, &sunlight3,
&falloff, //mxd
&origin, &color, &mangle, &projangle, &project_texture, &suntexture
}};

View File

@ -629,35 +629,17 @@ SetupSkyDomes(const globalconfig_t &cfg)
SetupSkyDome(cfg, cfg.sunlight2.floatValue(), *cfg.sunlight2_color.vec3Value(), cfg.sunlight2_dirt.intValue(), cfg.global_anglescale.floatValue(), 0, "",
cfg.sunlight3.floatValue(), *cfg.sunlight3_color.vec3Value(), cfg.sunlight2_dirt.intValue(), cfg.global_anglescale.floatValue(), 0, "");
// new "_dome" entities
// new per-entity sunlight2/3 skydomes
for (light_t &entity : all_lights) {
if (entity.dome.intValue() == 1 && entity.light.intValue() > 0) {
// Set direction to dome center
vec3_t dirToDomeCenter;
if (entity.targetent) {
vec3_t target_pos;
EntDict_VectorForKey(*entity.targetent, "origin", target_pos);
VectorSubtract(target_pos, *entity.origin.vec3Value(), dirToDomeCenter);
} else if (VectorLengthSq(*entity.mangle.vec3Value()) > 0) {
glm_to_vec3_t(vec_from_mangle(vec3_t_to_glm(*entity.mangle.vec3Value())), dirToDomeCenter);
} else {
logprint("WARNING: dome light at (%s) missing direction. assuming dome center is downwards.\n", entity.origin.stringValue().c_str());
VectorSet(dirToDomeCenter, 0, 0, -1);
}
const vec3_t up {0, 0, 1};
const vec3_t down {0, 0, -1};
if (VectorCompare(dirToDomeCenter, down, EQUAL_EPSILON)) {
if ((entity.sunlight2.boolValue() || entity.sunlight3.boolValue()) && entity.light.intValue() > 0) {
if (entity.sunlight2.boolValue()) {
// Add the upper dome, like sunlight2 (pointing down)
SetupSkyDome(cfg, entity.light.floatValue(), *entity.color.vec3Value(), entity.dirt.intValue(), entity.anglescale.floatValue(), entity.style.intValue(), entity.suntexture.stringValue(),
0, vec3_origin, 0, 0, 0, "");
} else if (VectorCompare(dirToDomeCenter, up, EQUAL_EPSILON)) {
} else {
// Add the lower dome, like sunlight3 (pointing up)
SetupSkyDome(cfg, 0, vec3_origin, 0, 0, 0, "",
entity.light.floatValue(), *entity.color.vec3Value(), entity.dirt.intValue(), entity.anglescale.floatValue(), entity.style.intValue(), entity.suntexture.stringValue());
} else {
logprint("WARNING: dome lights only support up or down currently, ignoring entity at (%s).\n", entity.origin.stringValue().c_str());
}
// Disable the light itself...

View File

@ -436,13 +436,23 @@ The following light properties correspond to these sunlight settings:
_suntexture => this sunlight is only emitted from faces with this texture name
.fi
.IP "\fB""_dome"" ""n""\fP"
Set to 1 to make this entity a dome light, as an alternative to using the sunlight2 and sunlight3 worldspawn keys. Acts as an area light at infinite distance that emits from sky surfaces.
The light itself is disabled, so it can be placed anywhere in the map.
.IP "\fB""_sunlight2"" ""n""\fP"
Set to 1 to make this entity control the upper dome lighting emitted from sky faces, as an alternative to the worldspawn key "_sunlight2".
The light entity itself is disabled, so it can be placed anywhere in the map.
Set the incoming direction of the center of the dome with "mangle". For comparison, sunlight2 is straight down (0 -90 0) and sunlight3 is straight up (0 90 0). If the light targets an info_null entity, the direction towards that entity sets the direction of the center of the dome.
The following light properties correspond to these sunlight settings:
.nf
light => _sunlight2
_color => _sunlight2_color
_dirt => _sunlight2_dirt
_anglescale => _anglescale
style => flicker style for styled dome light
targetname => targetname for switchable sunlight
_suntexture => this sunlight is only emitted from faces with this texture name
.fi
"targetname", "style", "_color", "_anglescale"/"_anglesense", "_suntexture", and dirt parameters are all supported.
.IP "\fB""_sunlight3"" ""n""\fP"
Same as "_sunlight2", but for the lower hemisphere.
.SH "OTHER INFORMATION"
The "\\b" escape sequence toggles red text on/off, you can use this in any strings in the map file. e.g. "message" "Here is \\bsome red text\\b..."