Reverted portal detection change from R332.
This commit is contained in:
parent
db0baf4741
commit
0723805f96
@ -939,14 +939,6 @@ bool rcBuildPolyMesh(rcContext* ctx, rcContourSet& cset, const int nvp, rcPolyMe
|
|||||||
}
|
}
|
||||||
memset(vflags, 0, maxVertices);
|
memset(vflags, 0, maxVertices);
|
||||||
|
|
||||||
rcScopedDelete<unsigned short> vportal = (unsigned short*)rcAlloc(sizeof(unsigned short)*maxVertices, RC_ALLOC_TEMP);
|
|
||||||
if (!vportal)
|
|
||||||
{
|
|
||||||
ctx->log(RC_LOG_ERROR, "rcBuildPolyMesh: Out of memory 'vportal' (%d).", maxVertices);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
memset(vportal, 0xff, maxVertices);
|
|
||||||
|
|
||||||
mesh.verts = (unsigned short*)rcAlloc(sizeof(unsigned short)*maxVertices*3, RC_ALLOC_PERM);
|
mesh.verts = (unsigned short*)rcAlloc(sizeof(unsigned short)*maxVertices*3, RC_ALLOC_PERM);
|
||||||
if (!mesh.verts)
|
if (!mesh.verts)
|
||||||
{
|
{
|
||||||
@ -1062,14 +1054,6 @@ bool rcBuildPolyMesh(rcContext* ctx, rcContourSet& cset, const int nvp, rcPolyMe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store portal edges
|
|
||||||
for (int j = 0; j < cont.nverts; ++j)
|
|
||||||
{
|
|
||||||
const int* v = &cont.verts[j*4];
|
|
||||||
if ((v[3] & RC_AREA_BORDER) == 0)
|
|
||||||
vportal[indices[j]] = indices[(j+1) % cont.nverts];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build initial polygons.
|
// Build initial polygons.
|
||||||
int npolys = 0;
|
int npolys = 0;
|
||||||
memset(polys, 0xff, maxVertsPerCont*nvp*sizeof(unsigned short));
|
memset(polys, 0xff, maxVertsPerCont*nvp*sizeof(unsigned short));
|
||||||
@ -1169,14 +1153,6 @@ bool rcBuildPolyMesh(rcContext* ctx, rcContourSet& cset, const int nvp, rcPolyMe
|
|||||||
// Fixup vertex flags
|
// Fixup vertex flags
|
||||||
for (int j = i; j < mesh.nverts; ++j)
|
for (int j = i; j < mesh.nverts; ++j)
|
||||||
vflags[j] = vflags[j+1];
|
vflags[j] = vflags[j+1];
|
||||||
// Fixup portal indices
|
|
||||||
for (int j = i; j < mesh.nverts; ++j)
|
|
||||||
vportal[j] = vportal[j+1];
|
|
||||||
for (int j = 0; j < mesh.nverts; ++j)
|
|
||||||
{
|
|
||||||
if (vportal[j] > (unsigned short)i)
|
|
||||||
vportal[j]--;
|
|
||||||
}
|
|
||||||
--i;
|
--i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1207,10 +1183,6 @@ bool rcBuildPolyMesh(rcContext* ctx, rcContourSet& cset, const int nvp, rcPolyMe
|
|||||||
const unsigned short* va = &mesh.verts[p[j]*3];
|
const unsigned short* va = &mesh.verts[p[j]*3];
|
||||||
const unsigned short* vb = &mesh.verts[p[nj]*3];
|
const unsigned short* vb = &mesh.verts[p[nj]*3];
|
||||||
|
|
||||||
// Make sure the edge is marked as portal.
|
|
||||||
if (vportal[p[j]] != p[nj])
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if ((int)va[0] == 0 && (int)vb[0] == 0)
|
if ((int)va[0] == 0 && (int)vb[0] == 0)
|
||||||
p[nvp+j] = 0x8000 | 0;
|
p[nvp+j] = 0x8000 | 0;
|
||||||
else if ((int)va[2] == h && (int)vb[2] == h)
|
else if ((int)va[2] == h && (int)vb[2] == h)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user