light: add _light_twosided 1 key for forcing two-sided light receiving on opaque surfaces
This commit is contained in:
parent
b71a4ebaf1
commit
b893e67309
|
|
@ -1830,7 +1830,7 @@ static auto as_tuple(const surfflags_t &flags)
|
|||
flags.no_bounce, flags.no_minlight, flags.no_expand, flags.no_phong, flags.light_ignore,
|
||||
flags.surflight_rescale, flags.surflight_style, flags.surflight_color, flags.surflight_minlight_scale,
|
||||
flags.surflight_targetname, flags.phong_angle, flags.phong_angle_concave, flags.phong_group, flags.minlight,
|
||||
flags.minlight_color, flags.light_alpha, flags.maxlight, flags.lightcolorscale, flags.surflight_group,
|
||||
flags.minlight_color, flags.light_alpha, flags.light_twosided, flags.maxlight, flags.lightcolorscale, flags.surflight_group,
|
||||
flags.world_units_per_luxel, flags.object_channel_mask);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -184,6 +184,9 @@ struct surfflags_t
|
|||
// custom opacity
|
||||
std::optional<vec_t> light_alpha;
|
||||
|
||||
// two-sided lighting
|
||||
std::optional<bool> light_twosided;
|
||||
|
||||
// maxlight value for this face
|
||||
vec_t maxlight;
|
||||
|
||||
|
|
|
|||
|
|
@ -1176,6 +1176,9 @@ static void LoadExtendedTexinfoFlags(const fs::path &sourcefilename, const mbsp_
|
|||
if (val.contains("light_alpha")) {
|
||||
flags.light_alpha = val.at("light_alpha").get<vec_t>();
|
||||
}
|
||||
if (val.contains("light_twosided")) {
|
||||
flags.light_twosided = val.at("light_twosided").get<bool>();
|
||||
}
|
||||
if (val.contains("lightcolorscale")) {
|
||||
flags.lightcolorscale = val.at("lightcolorscale").get<vec_t>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -608,6 +608,11 @@ static std::unique_ptr<lightsurf_t> Lightsurf_Init(const modelinfo_t *modelinfo,
|
|||
const surfflags_t &extended_flags = extended_texinfo_flags[face->texinfo];
|
||||
lightsurf->curved = extended_flags.phong_angle != 0 || Q2_FacePhongValue(bsp, face);
|
||||
|
||||
// override the autodetected twosided setting?
|
||||
if (extended_flags.light_twosided) {
|
||||
lightsurf->twosided = *extended_flags.light_twosided;
|
||||
}
|
||||
|
||||
// nodirt
|
||||
if (modelinfo->dirt.is_changed()) {
|
||||
lightsurf->nodirt = (modelinfo->dirt.value() == -1);
|
||||
|
|
|
|||
|
|
@ -821,6 +821,11 @@ static surfflags_t SurfFlagsForEntity(
|
|||
flags.light_alpha = std::clamp(lightalpha, 0.0, 1.0);
|
||||
}
|
||||
|
||||
// handle "_light_twosided"
|
||||
if (entity.epairs.has("_light_twosided")) {
|
||||
flags.light_twosided = entity.epairs.get_int("_light_twosided");
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -417,6 +417,9 @@ static void WriteExtendedTexinfoFlags(void)
|
|||
if (tx.flags.light_alpha) {
|
||||
t["light_alpha"] = *tx.flags.light_alpha;
|
||||
}
|
||||
if (tx.flags.light_twosided) {
|
||||
t["light_twosided"] = *tx.flags.light_twosided;
|
||||
}
|
||||
if (tx.flags.lightcolorscale != 1.0) {
|
||||
t["lightcolorscale"] = tx.flags.lightcolorscale;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue