qbsp: face_t: track front/back contents, instead of just front

This commit is contained in:
Eric Wasylishen 2023-02-22 22:54:37 -07:00
parent d8b903823a
commit 42da494707
3 changed files with 6 additions and 6 deletions

View File

@ -302,7 +302,7 @@ struct face_t
{
size_t planenum;
int texinfo;
contentflags_t contents; // contents on the front of the face
twosided<contentflags_t> contents; // contents on the front/back of the face
winding_t w;
std::vector<size_t> original_vertices; // the vertices of this face before fragmentation; filled in by EmitVertices
std::vector<face_fragment_t> fragments; // the vertices of this face post-fragmentation; filled in by TJunc

View File

@ -121,7 +121,7 @@ void ExportObj_Faces(const std::string &filesuffix, const std::vector<const face
int vertcount = 0;
for (const face_t *face : faces) {
std::string mtlname = fmt::format("contents{}\n", face->contents.native);
std::string mtlname = fmt::format("contents{}\n", face->contents.back.native);
ExportObjFace(objfile, mtlname, face->w, face->get_texinfo(), &vertcount);
}

View File

@ -52,12 +52,12 @@ static bool ShouldOmitFace(face_t *f)
return true;
// HACK: to save a few faces, don't output the interior faces of sky brushes
if (f->contents.is_sky(qbsp_options.target_game)) {
if (f->contents.front.is_sky(qbsp_options.target_game)) {
return true;
}
// omit faces fully covered by detail wall
if (f->contents.is_detail_wall(qbsp_options.target_game)) {
if (f->contents.front.is_detail_wall(qbsp_options.target_game)) {
return true;
}
@ -138,7 +138,7 @@ Returns a global edge number, possibly negative to indicate a backwards edge.
*/
inline int64_t GetEdge(const size_t &v1, const size_t &v2, const face_t *face, emit_faces_stats_t &stats)
{
if (!face->contents.is_valid(qbsp_options.target_game, false))
if (!face->contents.front.is_valid(qbsp_options.target_game, false))
FError("Face with invalid contents");
// search for existing edges
@ -495,7 +495,7 @@ static std::unique_ptr<face_t> FaceFromPortal(portal_t *p, bool pside)
f->w = p->winding.clone();
}
f->contents = p->nodes[pside]->contents;
f->contents = {.front = p->nodes[pside]->contents, .back = p->nodes[!pside]->contents};
UpdateFaceSphere(f.get());