Browse Source

Added export of PVS data

master
Nico de Poel 3 years ago
parent
commit
86343e96a9
  1. 4
      bsp.h
  2. 5
      main.cpp
  3. 10
      ps1bsp.h

4
bsp.h

@ -151,9 +151,9 @@ typedef struct
{
long plane_id; // The plane that splits the node
// must be in [0,numplanes[
unsigned short front; // If bit15==0, index of Front child node
short front; // If bit15==0, index of Front child node
// If bit15==1, ~front = index of child leaf
unsigned short back; // If bit15==0, id of Back child node
short back; // If bit15==0, id of Back child node
// If bit15==1, ~back = id of child leaf
bboxshort_t box; // Bounding box of node and all childs
unsigned short face_id; // Index of first Polygons in the node

5
main.cpp

@ -408,6 +408,9 @@ int process_faces(const world_t* world)
outNode.front = node->front;
outNode.back = node->back;
outNode.firstFace = node->face_id;
outNode.numFaces = node->face_num;
outNodes.push_back(outNode);
}
@ -427,6 +430,7 @@ int process_faces(const world_t* world)
}
std::vector<unsigned short> outLeafFaces(world->faceList, world->faceList + world->faceListLength);
std::vector<unsigned char> outVisData(world->visList, world->visList + world->visListLength);
// Write collected data to file and update header info
writeMapData(outVertices, outHeader.vertices, fbsp);
@ -436,6 +440,7 @@ int process_faces(const world_t* world)
writeMapData(outNodes, outHeader.nodes, fbsp);
writeMapData(outLeaves, outHeader.leaves, fbsp);
writeMapData(outLeafFaces, outHeader.leafFaces, fbsp);
writeMapData(outVisData, outHeader.visData, fbsp);
// Write final header
fseek(fbsp, 0, SEEK_SET);

10
ps1bsp.h

@ -35,6 +35,7 @@ typedef struct
ps1bsp_dentry_t nodes;
ps1bsp_dentry_t leaves;
ps1bsp_dentry_t leafFaces;
ps1bsp_dentry_t visData;
} ps1bsp_header_t;
typedef struct
@ -85,10 +86,13 @@ typedef struct
typedef struct
{
int planeId;
u_short front;
u_short back;
short front;
short back;
// TODO: add bounding box for frustum culling
// TODO: not sure if face list is needed here
u_short firstFace;
u_short numFaces;
} ps1bsp_node_t;
typedef struct

Loading…
Cancel
Save