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