qbsp/light: add no_phong texinfo flag (currently not used/exposed)

This commit is contained in:
Eric Wasylishen 2022-12-01 01:16:17 -07:00
parent 1065adecc6
commit f66e4790a4
5 changed files with 17 additions and 2 deletions

View File

@ -1724,14 +1724,14 @@ const bspversion_t bspver_qbism{Q2_QBISMIDENT, Q2_BSPVERSION, "qbism", "Quake II
bool surfflags_t::needs_write() const
{
return no_dirt || no_shadow || no_bounce || no_minlight || no_expand || light_ignore || !surflight_rescale || phong_angle ||
return no_dirt || no_shadow || no_bounce || no_minlight || no_expand || no_phong || light_ignore || !surflight_rescale || phong_angle ||
phong_angle_concave || phong_group || minlight || !qv::emptyExact(minlight_color) || light_alpha || maxlight || lightcolorscale != 1.0;
}
static auto as_tuple(const surfflags_t &flags)
{
return std::tie(flags.native, flags.is_nodraw, flags.is_hintskip, flags.is_hint, flags.no_dirt, flags.no_shadow, flags.no_bounce, flags.no_minlight, flags.no_expand,
flags.light_ignore, flags.surflight_rescale, flags.phong_angle, flags.phong_angle_concave, flags.phong_group, flags.minlight, flags.minlight_color, flags.light_alpha, flags.maxlight, flags.lightcolorscale);
flags.no_phong, flags.light_ignore, flags.surflight_rescale, flags.phong_angle, flags.phong_angle_concave, flags.phong_group, flags.minlight, flags.minlight_color, flags.light_alpha, flags.maxlight, flags.lightcolorscale);
}
bool surfflags_t::operator<(const surfflags_t &other) const

View File

@ -182,6 +182,9 @@ struct surfflags_t
// don't expand this face for larger clip hulls
bool no_expand;
// block any way phong can be enabled
bool no_phong;
// this face doesn't receive light
bool light_ignore;

View File

@ -1080,6 +1080,9 @@ static void LoadExtendedTexinfoFlags(const fs::path &sourcefilename, const mbsp_
if (val.contains("no_expand")) {
flags.no_expand = val.at("no_expand").get<bool>();
}
if (val.contains("no_phong")) {
flags.no_expand = val.at("no_phong").get<bool>();
}
if (val.contains("light_ignore")) {
flags.light_ignore = val.at("light_ignore").get<bool>();
}

View File

@ -480,6 +480,9 @@ void CalculateVertexNormals(const mbsp_t *bsp)
if (!f_wants_phong)
continue;
if (extended_texinfo_flags[f.texinfo].no_phong)
continue;
for (int j = 0; j < f.numedges; j++) {
const int v = Face_VertexAtIndex(bsp, &f, j);
// walk over all faces incident to f (we will walk over neighbours multiple times, doesn't matter)
@ -503,6 +506,9 @@ void CalculateVertexNormals(const mbsp_t *bsp)
if (!f2_wants_phong)
continue;
if (extended_texinfo_flags[f2->texinfo].no_phong)
continue;
auto *f2_texinfo = Face_Texinfo(bsp, f2);
if (f2_texinfo != nullptr && f_texinfo != nullptr) {
if (!bsp->loadversion->game->surfflags_may_phong(f_texinfo->flags, f2_texinfo->flags)) {

View File

@ -365,6 +365,9 @@ static void WriteExtendedTexinfoFlags(void)
if (tx.flags.no_expand) {
t["no_expand"] = tx.flags.no_expand;
}
if (tx.flags.no_phong) {
t["no_phong"] = tx.flags.no_phong;
}
if (tx.flags.light_ignore) {
t["light_ignore"] = tx.flags.light_ignore;
}