mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Flip vertex order for convex hull properly
This commit is contained in:
parent
87a42efd72
commit
f0eecc80ff
@ -64,7 +64,7 @@ static int convexhull(const float* pts, int npts, int* out)
|
|||||||
out[i++] = hull;
|
out[i++] = hull;
|
||||||
endpt = 0;
|
endpt = 0;
|
||||||
for (int j = 1; j < npts; ++j)
|
for (int j = 1; j < npts; ++j)
|
||||||
if (hull == endpt || left(&pts[hull*3], &pts[j*3], &pts[endpt*3]))
|
if (hull == endpt || left(&pts[hull*3], &pts[endpt*3], &pts[j*3]))
|
||||||
endpt = j;
|
endpt = j;
|
||||||
hull = endpt;
|
hull = endpt;
|
||||||
}
|
}
|
||||||
|
@ -605,15 +605,17 @@ void InputGeom::drawConvexVolumes(struct duDebugDraw* dd, bool /*hilight*/)
|
|||||||
const float* va = &vol->verts[k*3];
|
const float* va = &vol->verts[k*3];
|
||||||
const float* vb = &vol->verts[j*3];
|
const float* vb = &vol->verts[j*3];
|
||||||
|
|
||||||
|
dd->vertex(va[0],va[1],vol->hmax, col);
|
||||||
|
dd->vertex(vb[0],vb[1],vol->hmax, col);
|
||||||
dd->vertex(vol->verts[0],vol->verts[1],vol->hmax, col);
|
dd->vertex(vol->verts[0],vol->verts[1],vol->hmax, col);
|
||||||
|
|
||||||
dd->vertex(vb[0],vb[1],vol->hmax, col);
|
dd->vertex(vb[0],vb[1],vol->hmax, col);
|
||||||
dd->vertex(va[0],va[1],vol->hmax, col);
|
dd->vertex(va[0],va[1],vol->hmax, col);
|
||||||
dd->vertex(va[0],va[1],vol->hmin, duDarkenCol(col));
|
dd->vertex(va[0],va[1],vol->hmin, duDarkenCol(col));
|
||||||
dd->vertex(va[0],va[1],vol->hmax, col);
|
|
||||||
dd->vertex(vb[0],vb[1],vol->hmax, col);
|
|
||||||
dd->vertex(va[0],va[1],vol->hmin, duDarkenCol(col));
|
|
||||||
dd->vertex(vb[0],vb[1],vol->hmax, col);
|
|
||||||
dd->vertex(vb[0],vb[1],vol->hmin, duDarkenCol(col));
|
dd->vertex(vb[0],vb[1],vol->hmin, duDarkenCol(col));
|
||||||
|
dd->vertex(vb[0],vb[1],vol->hmax, col);
|
||||||
|
dd->vertex(va[0],va[1],vol->hmin, duDarkenCol(col));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -634,12 +636,12 @@ void InputGeom::drawConvexVolumes(struct duDebugDraw* dd, bool /*hilight*/)
|
|||||||
{
|
{
|
||||||
const float* va = &vol->verts[k*3];
|
const float* va = &vol->verts[k*3];
|
||||||
const float* vb = &vol->verts[j*3];
|
const float* vb = &vol->verts[j*3];
|
||||||
dd->vertex(va[0],va[1],vol->hmin, duDarkenCol(col));
|
|
||||||
dd->vertex(vb[0],vb[1],vol->hmin, duDarkenCol(col));
|
dd->vertex(vb[0],vb[1],vol->hmin, duDarkenCol(col));
|
||||||
dd->vertex(va[0],va[1],vol->hmax, col);
|
|
||||||
dd->vertex(vb[0],vb[1],vol->hmax, col);
|
|
||||||
dd->vertex(va[0],va[1],vol->hmin, duDarkenCol(col));
|
dd->vertex(va[0],va[1],vol->hmin, duDarkenCol(col));
|
||||||
|
dd->vertex(vb[0],vb[1],vol->hmax, col);
|
||||||
dd->vertex(va[0],va[1],vol->hmax, col);
|
dd->vertex(va[0],va[1],vol->hmax, col);
|
||||||
|
dd->vertex(va[0],va[1],vol->hmax, col);
|
||||||
|
dd->vertex(va[0],va[1],vol->hmin, duDarkenCol(col));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dd->end();
|
dd->end();
|
||||||
@ -657,9 +659,9 @@ void InputGeom::drawConvexVolumes(struct duDebugDraw* dd, bool /*hilight*/)
|
|||||||
|
|
||||||
for (int j = 0; j < vol->nverts; ++j)
|
for (int j = 0; j < vol->nverts; ++j)
|
||||||
{
|
{
|
||||||
dd->vertex(vol->verts[j*3+0],vol->verts[j*3+1]+0.1f,vol->verts[j*3+2], col);
|
|
||||||
dd->vertex(vol->verts[j*3+0],vol->verts[j*3+1],vol->hmin, col);
|
|
||||||
dd->vertex(vol->verts[j*3+0],vol->verts[j*3+1],vol->hmax, col);
|
dd->vertex(vol->verts[j*3+0],vol->verts[j*3+1],vol->hmax, col);
|
||||||
|
dd->vertex(vol->verts[j*3+0],vol->verts[j*3+1],vol->hmin, col);
|
||||||
|
dd->vertex(vol->verts[j*3+0],vol->verts[j*3+1]+0.1f,vol->verts[j*3+2], col);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dd->end();
|
dd->end();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user