Revert "vis: remove max portals on leaf limit"
This reverts commit b111346cca.
This commit is contained in:
parent
b111346cca
commit
258f69a27f
|
|
@ -24,8 +24,6 @@
|
||||||
#include <common/bspfile.hh>
|
#include <common/bspfile.hh>
|
||||||
#include <vis/leafbits.hh>
|
#include <vis/leafbits.hh>
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#define PORTALFILE "PRT1"
|
#define PORTALFILE "PRT1"
|
||||||
#define PORTALFILE2 "PRT2"
|
#define PORTALFILE2 "PRT2"
|
||||||
#define PORTALFILEAM "PRT1-AM"
|
#define PORTALFILEAM "PRT1-AM"
|
||||||
|
|
@ -71,20 +69,15 @@ typedef struct passage_s {
|
||||||
sep_t *planes;
|
sep_t *planes;
|
||||||
} passage_t;
|
} passage_t;
|
||||||
|
|
||||||
class leaf_t {
|
/* Increased MAX_PORTALS_ON_LEAF from 128 */
|
||||||
public:
|
#define MAX_PORTALS_ON_LEAF 256
|
||||||
passage_t *passages;
|
|
||||||
std::vector<portal_t *> portals;
|
|
||||||
int numportals() const {
|
|
||||||
return static_cast<int>(portals.size());
|
|
||||||
}
|
|
||||||
int visofs; // used when writing final visdata
|
|
||||||
|
|
||||||
leaf_t() :
|
typedef struct leaf_s {
|
||||||
passages{ nullptr },
|
int numportals;
|
||||||
portals{},
|
passage_t *passages;
|
||||||
visofs{ 0 } {}
|
portal_t *portals[MAX_PORTALS_ON_LEAF];
|
||||||
};
|
int visofs; // used when writing final visdata
|
||||||
|
} leaf_t;
|
||||||
|
|
||||||
#define MAX_SEPARATORS MAX_WINDING
|
#define MAX_SEPARATORS MAX_WINDING
|
||||||
#define STACK_WINDINGS 3 // source, pass and a temp for clipping
|
#define STACK_WINDINGS 3 // source, pass and a temp for clipping
|
||||||
|
|
|
||||||
|
|
@ -195,7 +195,7 @@ RecursiveLeafFlow(int leafnum, threaddata_t *thread, pstack_t *prevstack)
|
||||||
vis = thread->leafvis->bits;
|
vis = thread->leafvis->bits;
|
||||||
|
|
||||||
// check all portals for flowing into other leafs
|
// check all portals for flowing into other leafs
|
||||||
for (i = 0; i < leaf->numportals(); i++) {
|
for (i = 0; i < leaf->numportals; i++) {
|
||||||
p = leaf->portals[i];
|
p = leaf->portals[i];
|
||||||
|
|
||||||
if (!TestLeafBit(prevstack->mightsee, p->leaf)) {
|
if (!TestLeafBit(prevstack->mightsee, p->leaf)) {
|
||||||
|
|
@ -406,7 +406,7 @@ SimpleFlood(portal_t *srcportal, int leafnum, byte *portalsee)
|
||||||
srcportal->nummightsee++;
|
srcportal->nummightsee++;
|
||||||
|
|
||||||
leaf = &leafs[leafnum];
|
leaf = &leafs[leafnum];
|
||||||
for (i = 0; i < leaf->numportals(); i++) {
|
for (i = 0; i < leaf->numportals; i++) {
|
||||||
p = leaf->portals[i];
|
p = leaf->portals[i];
|
||||||
if (!portalsee[p - portals])
|
if (!portalsee[p - portals])
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
31
vis/vis.cc
31
vis/vis.cc
|
|
@ -20,7 +20,7 @@ int portalleafs_real; /* real no. of leafs after expanding PRT2 clusters */
|
||||||
int *clustermap; /* mapping from real leaf to cluster number */
|
int *clustermap; /* mapping from real leaf to cluster number */
|
||||||
|
|
||||||
portal_t *portals;
|
portal_t *portals;
|
||||||
leaf_t *leafs; // new[]/delete[]
|
leaf_t *leafs;
|
||||||
|
|
||||||
int c_portaltest, c_portalpass, c_portalcheck, c_mightseeupdate;
|
int c_portaltest, c_portalpass, c_portalcheck, c_mightseeupdate;
|
||||||
int c_noclip = 0;
|
int c_noclip = 0;
|
||||||
|
|
@ -157,7 +157,7 @@ LogLeaf(const leaf_t *leaf)
|
||||||
if (!verbose)
|
if (!verbose)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < leaf->numportals(); i++) {
|
for (i = 0; i < leaf->numportals; i++) {
|
||||||
portal = leaf->portals[i];
|
portal = leaf->portals[i];
|
||||||
plane = &portal->plane;
|
plane = &portal->plane;
|
||||||
logprint("portal %4i to leaf %4i : %7.1f : (%4.2f, %4.2f, %4.2f)\n",
|
logprint("portal %4i to leaf %4i : %7.1f : (%4.2f, %4.2f, %4.2f)\n",
|
||||||
|
|
@ -404,7 +404,7 @@ UpdateMightsee(const leaf_t *source, const leaf_t *dest)
|
||||||
portal_t *p;
|
portal_t *p;
|
||||||
|
|
||||||
leafnum = dest - leafs;
|
leafnum = dest - leafs;
|
||||||
for (i = 0; i < source->numportals(); i++) {
|
for (i = 0; i < source->numportals; i++) {
|
||||||
p = source->portals[i];
|
p = source->portals[i];
|
||||||
if (p->status != pstat_none)
|
if (p->status != pstat_none)
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -446,7 +446,7 @@ PortalCompleted(portal_t *completed)
|
||||||
* mightsee during the full vis so far.
|
* mightsee during the full vis so far.
|
||||||
*/
|
*/
|
||||||
myleaf = &leafs[completed->leaf];
|
myleaf = &leafs[completed->leaf];
|
||||||
for (i = 0; i < myleaf->numportals(); i++) {
|
for (i = 0; i < myleaf->numportals; i++) {
|
||||||
p = myleaf->portals[i];
|
p = myleaf->portals[i];
|
||||||
if (p->status != pstat_done)
|
if (p->status != pstat_done)
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -463,7 +463,7 @@ PortalCompleted(portal_t *completed)
|
||||||
* If any of these changed bits are still visible from another
|
* If any of these changed bits are still visible from another
|
||||||
* portal, we can't update yet.
|
* portal, we can't update yet.
|
||||||
*/
|
*/
|
||||||
for (k = 0; k < myleaf->numportals(); k++) {
|
for (k = 0; k < myleaf->numportals; k++) {
|
||||||
if (k == i)
|
if (k == i)
|
||||||
continue;
|
continue;
|
||||||
p2 = myleaf->portals[k];
|
p2 = myleaf->portals[k];
|
||||||
|
|
@ -587,7 +587,7 @@ LeafFlow(int leafnum, bsp2_dleaf_t *dleaf)
|
||||||
*/
|
*/
|
||||||
outbuffer = uncompressed + leafnum * leafbytes;
|
outbuffer = uncompressed + leafnum * leafbytes;
|
||||||
leaf = &leafs[leafnum];
|
leaf = &leafs[leafnum];
|
||||||
for (i = 0; i < leaf->numportals(); i++) {
|
for (i = 0; i < leaf->numportals; i++) {
|
||||||
p = leaf->portals[i];
|
p = leaf->portals[i];
|
||||||
if (p->status != pstat_done)
|
if (p->status != pstat_done)
|
||||||
Error("portal not done");
|
Error("portal not done");
|
||||||
|
|
@ -647,7 +647,7 @@ ClusterFlow(int clusternum, leafbits_t *buffer)
|
||||||
*/
|
*/
|
||||||
leaf = &leafs[clusternum];
|
leaf = &leafs[clusternum];
|
||||||
numblocks = (portalleafs + LEAFMASK) >> LEAFSHIFT;
|
numblocks = (portalleafs + LEAFMASK) >> LEAFSHIFT;
|
||||||
for (i = 0; i < leaf->numportals(); i++) {
|
for (i = 0; i < leaf->numportals; i++) {
|
||||||
p = leaf->portals[i];
|
p = leaf->portals[i];
|
||||||
if (p->status != pstat_done)
|
if (p->status != pstat_done)
|
||||||
Error("portal not done");
|
Error("portal not done");
|
||||||
|
|
@ -946,9 +946,9 @@ CalcPassages(void)
|
||||||
for (i = 0; i < portalleafs; i++) {
|
for (i = 0; i < portalleafs; i++) {
|
||||||
l = &leafs[i];
|
l = &leafs[i];
|
||||||
|
|
||||||
for (j = 0; j < l->numportals(); j++) {
|
for (j = 0; j < l->numportals; j++) {
|
||||||
p1 = l->portals[j];
|
p1 = l->portals[j];
|
||||||
for (k = 0; k < l->numportals(); k++) {
|
for (k = 0; k < l->numportals; k++) {
|
||||||
if (k == j)
|
if (k == j)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -1079,7 +1079,8 @@ LoadPortals(char *name, bsp2_t *bsp)
|
||||||
portals = static_cast<portal_t *>(malloc(2 * numportals * sizeof(portal_t)));
|
portals = static_cast<portal_t *>(malloc(2 * numportals * sizeof(portal_t)));
|
||||||
memset(portals, 0, 2 * numportals * sizeof(portal_t));
|
memset(portals, 0, 2 * numportals * sizeof(portal_t));
|
||||||
|
|
||||||
leafs = new leaf_t[portalleafs];
|
leafs = static_cast<leaf_t *>(malloc(portalleafs * sizeof(leaf_t)));
|
||||||
|
memset(leafs, 0, portalleafs * sizeof(leaf_t));
|
||||||
|
|
||||||
originalvismapsize = portalleafs_real * ((portalleafs_real + 7) / 8);
|
originalvismapsize = portalleafs_real * ((portalleafs_real + 7) / 8);
|
||||||
|
|
||||||
|
|
@ -1123,7 +1124,10 @@ LoadPortals(char *name, bsp2_t *bsp)
|
||||||
|
|
||||||
// create forward portal
|
// create forward portal
|
||||||
l = &leafs[leafnums[0]];
|
l = &leafs[leafnums[0]];
|
||||||
l->portals.push_back(p);
|
if (l->numportals == MAX_PORTALS_ON_LEAF)
|
||||||
|
Error("Leaf with too many portals");
|
||||||
|
l->portals[l->numportals] = p;
|
||||||
|
l->numportals++;
|
||||||
|
|
||||||
p->winding = w;
|
p->winding = w;
|
||||||
VectorSubtract(vec3_origin, plane.normal, p->plane.normal);
|
VectorSubtract(vec3_origin, plane.normal, p->plane.normal);
|
||||||
|
|
@ -1134,7 +1138,10 @@ LoadPortals(char *name, bsp2_t *bsp)
|
||||||
|
|
||||||
// create backwards portal
|
// create backwards portal
|
||||||
l = &leafs[leafnums[1]];
|
l = &leafs[leafnums[1]];
|
||||||
l->portals.push_back(p);
|
if (l->numportals == MAX_PORTALS_ON_LEAF)
|
||||||
|
Error("Leaf with too many portals");
|
||||||
|
l->portals[l->numportals] = p;
|
||||||
|
l->numportals++;
|
||||||
|
|
||||||
// Create a reverse winding
|
// Create a reverse winding
|
||||||
p->winding = NewWinding(numpoints);
|
p->winding = NewWinding(numpoints);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue