qbsp: refactor lmshifts lump export
This commit is contained in:
parent
31d5e67603
commit
c55112b47f
|
|
@ -170,6 +170,10 @@ typedef struct mapdata_s {
|
|||
std::string exported_entities;
|
||||
std::string exported_texdata;
|
||||
|
||||
// bspx data
|
||||
std::vector<uint8_t> exported_lmshifts;
|
||||
bool needslmshifts = false;
|
||||
|
||||
// helpers
|
||||
std::string texinfoTextureName(int texinfo) const {
|
||||
int mt = mtexinfos.at(texinfo).miptex;
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@
|
|||
#include <map>
|
||||
#include <list>
|
||||
|
||||
static int needlmshifts;
|
||||
|
||||
/*
|
||||
===============
|
||||
SubdivideFace
|
||||
|
|
@ -391,7 +389,6 @@ EmitFace
|
|||
static void
|
||||
EmitFace(mapentity_t *entity, face_t *face)
|
||||
{
|
||||
struct lumpdata *lmshifts = &entity->lumps[BSPX_LMSHIFT];
|
||||
bsp29_dface_t *out;
|
||||
int i;
|
||||
|
||||
|
|
@ -403,10 +400,9 @@ EmitFace(mapentity_t *entity, face_t *face)
|
|||
face->outputnumber = static_cast<int>(map.exported_faces.size());
|
||||
map.exported_faces.push_back({});
|
||||
|
||||
if (lmshifts->data) {
|
||||
const int localfacenumber = face->outputnumber - entity->firstoutputfacenumber;
|
||||
((unsigned char*)lmshifts->data)[localfacenumber] = face->lmshift[1];
|
||||
}
|
||||
// emit lmshift
|
||||
map.exported_lmshifts.push_back(face->lmshift[1]);
|
||||
Q_assert(map.exported_faces.size() == map.exported_lmshifts.size());
|
||||
|
||||
out = &map.exported_faces.at(face->outputnumber);
|
||||
out->planenum = ExportMapPlane(face->planenum);
|
||||
|
|
@ -459,7 +455,7 @@ CountFace(mapentity_t *entity, face_t *f, int *facesCount, int *vertexesCount)
|
|||
return;
|
||||
|
||||
if (f->lmshift[1] != 4)
|
||||
needlmshifts = true;
|
||||
map.needslmshifts = true;
|
||||
|
||||
(*facesCount)++;
|
||||
(*vertexesCount) += f->w.numpoints;
|
||||
|
|
@ -499,8 +495,6 @@ MakeFaceEdges(mapentity_t *entity, node_t *headnode)
|
|||
|
||||
Message(msgProgress, "MakeFaceEdges");
|
||||
|
||||
needlmshifts = false;
|
||||
|
||||
Q_assert(entity->firstoutputfacenumber == -1);
|
||||
entity->firstoutputfacenumber = static_cast<int>(map.exported_faces.size());
|
||||
|
||||
|
|
@ -517,9 +511,6 @@ MakeFaceEdges(mapentity_t *entity, node_t *headnode)
|
|||
pEdgeFaces0.clear();
|
||||
pEdgeFaces1.clear();
|
||||
|
||||
lmshifts->count = needlmshifts?facesCount:0;
|
||||
lmshifts->data = needlmshifts?AllocMem(OTHER, sizeof(uint8_t) * lmshifts->count, true):NULL;
|
||||
|
||||
Message(msgProgress, "GrowRegions");
|
||||
GrowNodeRegion(entity, headnode);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue