text
stringlengths 0
2.2M
|
---|
edge.polyEdge[1] = 0xff;
|
// Insert edge
|
nextEdge[edgeCount] = firstEdge[v1];
|
firstEdge[v1] = (unsigned short)edgeCount;
|
edgeCount++;
|
}
|
}
|
}
|
}
|
// Mark portal edges.
|
for (int i = 0; i < lcset.nconts; ++i)
|
{
|
dtTileCacheContour& cont = lcset.conts[i];
|
if (cont.nverts < 3)
|
continue;
|
for (int j = 0, k = cont.nverts-1; j < cont.nverts; k=j++)
|
{
|
const unsigned char* va = &cont.verts[k*4];
|
const unsigned char* vb = &cont.verts[j*4];
|
const unsigned char dir = va[3] & 0xf;
|
if (dir == 0xf)
|
continue;
|
if (dir == 0 || dir == 2)
|
{
|
// Find matching vertical edge
|
const unsigned short x = (unsigned short)va[0];
|
unsigned short zmin = (unsigned short)va[2];
|
unsigned short zmax = (unsigned short)vb[2];
|
if (zmin > zmax)
|
dtSwap(zmin, zmax);
|
for (int m = 0; m < edgeCount; ++m)
|
{
|
rcEdge& e = edges[m];
|
// Skip connected edges.
|
if (e.poly[0] != e.poly[1])
|
continue;
|
const unsigned short* eva = &verts[e.vert[0]*3];
|
const unsigned short* evb = &verts[e.vert[1]*3];
|
if (eva[0] == x && evb[0] == x)
|
{
|
unsigned short ezmin = eva[2];
|
unsigned short ezmax = evb[2];
|
if (ezmin > ezmax)
|
dtSwap(ezmin, ezmax);
|
if (overlapRangeExl(zmin,zmax, ezmin, ezmax))
|
{
|
// Reuse the other polyedge to store dir.
|
e.polyEdge[1] = dir;
|
}
|
}
|
}
|
}
|
else
|
{
|
// Find matching vertical edge
|
const unsigned short z = (unsigned short)va[2];
|
unsigned short xmin = (unsigned short)va[0];
|
unsigned short xmax = (unsigned short)vb[0];
|
if (xmin > xmax)
|
dtSwap(xmin, xmax);
|
for (int m = 0; m < edgeCount; ++m)
|
{
|
rcEdge& e = edges[m];
|
// Skip connected edges.
|
if (e.poly[0] != e.poly[1])
|
continue;
|
const unsigned short* eva = &verts[e.vert[0]*3];
|
const unsigned short* evb = &verts[e.vert[1]*3];
|
if (eva[2] == z && evb[2] == z)
|
{
|
unsigned short exmin = eva[0];
|
unsigned short exmax = evb[0];
|
if (exmin > exmax)
|
dtSwap(exmin, exmax);
|
if (overlapRangeExl(xmin,xmax, exmin, exmax))
|
{
|
// Reuse the other polyedge to store dir.
|
e.polyEdge[1] = dir;
|
}
|
}
|
}
|
}
|
}
|
}
|
// Store adjacency
|
for (int i = 0; i < edgeCount; ++i)
|
{
|
const rcEdge& e = edges[i];
|
if (e.poly[0] != e.poly[1])
|
{
|
unsigned short* p0 = &polys[e.poly[0]*MAX_VERTS_PER_POLY*2];
|
unsigned short* p1 = &polys[e.poly[1]*MAX_VERTS_PER_POLY*2];
|
p0[MAX_VERTS_PER_POLY + e.polyEdge[0]] = e.poly[1];
|
p1[MAX_VERTS_PER_POLY + e.polyEdge[1]] = e.poly[0];
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.