qbsp: face_t: make contents, lmshifts single sided
side_t: same, also remove contents (unused)
This commit is contained in:
parent
2452d5edda
commit
aabd1c27dc
|
|
@ -34,8 +34,8 @@ struct side_t
|
|||
int planenum;
|
||||
planeside_t planeside; // which side is the front of the face
|
||||
int texinfo;
|
||||
twosided<contentflags_t> contents;
|
||||
twosided<int16_t> lmshift;
|
||||
|
||||
int16_t lmshift;
|
||||
|
||||
qvec3d origin;
|
||||
vec_t radius;
|
||||
|
|
|
|||
|
|
@ -334,8 +334,8 @@ struct face_t : face_fragment_t
|
|||
int planenum;
|
||||
planeside_t planeside; // which side is the front of the face
|
||||
int texinfo;
|
||||
twosided<contentflags_t> contents;
|
||||
twosided<int16_t> lmshift;
|
||||
contentflags_t contents; // contents on the front of the face
|
||||
int16_t lmshift;
|
||||
|
||||
qvec3d origin;
|
||||
vec_t radius;
|
||||
|
|
|
|||
|
|
@ -1014,7 +1014,7 @@ static void Brush_LoadEntity(mapentity_t *dst, const mapentity_t *src, const int
|
|||
brush->lmshift = lmshift;
|
||||
|
||||
for (auto &face : brush->sides)
|
||||
face.lmshift = { (short) lmshift, (short) lmshift };
|
||||
face.lmshift = lmshift;
|
||||
|
||||
if (classname == std::string_view("func_areaportal")) {
|
||||
brush->func_areaportal = const_cast<mapentity_t *>(src); // FIXME: get rid of consts on src in the callers?
|
||||
|
|
|
|||
|
|
@ -142,8 +142,6 @@ face_t *MirrorFace(const face_t *face)
|
|||
face_t *newface = NewFaceFromFace(face);
|
||||
newface->w = face->w.flip();
|
||||
newface->planeside = static_cast<planeside_t>(face->planeside ^ 1);
|
||||
newface->contents.swap();
|
||||
newface->lmshift.swap();
|
||||
|
||||
return newface;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ static void ExportObjFace(std::ofstream &f, const face_t *face, int *vertcount)
|
|||
}
|
||||
|
||||
// fixme-brushbsp
|
||||
fmt::print(f, "usemtl contents{}\n", face->contents[0].native);
|
||||
fmt::print(f, "usemtl contents{}\n", face->contents.native);
|
||||
f << 'f';
|
||||
for (int i = 0; i < face->w.size(); i++) {
|
||||
// .obj vertexes start from 1
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ static face_t *TryMerge(face_t *f1, face_t *f2)
|
|||
|
||||
if (!f1->w.size() || !f2->w.size() || f1->planeside != f2->planeside || f1->texinfo != f2->texinfo ||
|
||||
/*!f1->contents[0].equals(options.target_game, f2->contents[0]) || !f1->contents[1].equals(options.target_game, f2->contents[1]) || */
|
||||
f1->lmshift[0] != f2->lmshift[0] || f1->lmshift[1] != f2->lmshift[1])
|
||||
f1->lmshift != f2->lmshift)
|
||||
return NULL;
|
||||
|
||||
// find a common edge
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ 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[0].is_sky(options.target_game)) {
|
||||
if (f->contents.is_sky(options.target_game)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ std::list<face_t *> SubdivideFace(face_t *f)
|
|||
// one lightmap block will always be added at the end, for smooth interpolation
|
||||
|
||||
// engines that do support scaling will support 256*256 blocks (at whatever scale).
|
||||
lmshift = f->lmshift[0];
|
||||
lmshift = f->lmshift;
|
||||
if (lmshift > 4)
|
||||
lmshift = 4; // no bugging out with legacy lighting
|
||||
|
||||
|
|
@ -292,7 +292,7 @@ Returns a global edge number, possibly negative to indicate a backwards edge.
|
|||
*/
|
||||
inline size_t GetEdge(mapentity_t *entity, const qvec3d &p1, const qvec3d &p2, const face_t *face)
|
||||
{
|
||||
if (!face->contents[0].is_valid(options.target_game, false))
|
||||
if (!face->contents.is_valid(options.target_game, false))
|
||||
FError("Face with invalid contents");
|
||||
|
||||
size_t v1 = GetVertex(p1);
|
||||
|
|
@ -304,7 +304,7 @@ inline size_t GetEdge(mapentity_t *entity, const qvec3d &p1, const qvec3d &p2, c
|
|||
auto it = hashedges.find(edge_hash_key);
|
||||
if (it != hashedges.end()) {
|
||||
for (const int i : it->second) {
|
||||
if (pEdgeFaces1[i] == NULL && pEdgeFaces0[i]->contents[0].native == face->contents[0].native) {
|
||||
if (pEdgeFaces1[i] == NULL && pEdgeFaces0[i]->contents.native == face->contents.native) {
|
||||
pEdgeFaces1[i] = face;
|
||||
return -i;
|
||||
}
|
||||
|
|
@ -392,7 +392,7 @@ static void EmitFaceFragment(mapentity_t *entity, face_t *face, face_fragment_t
|
|||
mface_t &out = map.bsp.dfaces.emplace_back();
|
||||
|
||||
// emit lmshift
|
||||
map.exported_lmshifts.push_back(face->lmshift[1]);
|
||||
map.exported_lmshifts.push_back(face->lmshift);
|
||||
Q_assert(map.bsp.dfaces.size() == map.exported_lmshifts.size());
|
||||
|
||||
out.planenum = ExportMapPlane(face->planenum);
|
||||
|
|
@ -458,7 +458,7 @@ static void CountFace(mapentity_t *entity, face_t *f, size_t &facesCount, size_t
|
|||
if (ShouldOmitFace(f))
|
||||
return;
|
||||
|
||||
if (f->lmshift[1] != 4)
|
||||
if (f->lmshift != 4)
|
||||
map.needslmshifts = true;
|
||||
|
||||
facesCount++;
|
||||
|
|
@ -632,15 +632,12 @@ static face_t *FaceFromPortal(portal_t *p, int pside)
|
|||
if (pside)
|
||||
{
|
||||
f->w = p->winding->flip();
|
||||
// fixme-brushbsp: was just `f->contents` on qbsp3
|
||||
f->contents[0] = p->nodes[1]->contents;
|
||||
f->contents[1] = p->nodes[0]->contents;
|
||||
f->contents = p->nodes[1]->contents;
|
||||
}
|
||||
else
|
||||
{
|
||||
f->w = *p->winding;
|
||||
f->contents[0] = p->nodes[0]->contents;
|
||||
f->contents[1] = p->nodes[1]->contents;
|
||||
f->contents = p->nodes[0]->contents;
|
||||
}
|
||||
|
||||
UpdateFaceSphere(f);
|
||||
|
|
|
|||
Loading…
Reference in New Issue