Seems there could be more than 6 vertices

This commit is contained in:
Magnus Norddahl 2016-11-09 00:22:05 +01:00
parent 7d3e8d1414
commit 968150ceff
2 changed files with 6 additions and 6 deletions

View File

@ -127,7 +127,7 @@ TriVertex PolyTriangleDrawer::shade_vertex(const TriUniforms &uniforms, TriVerte
void PolyTriangleDrawer::draw_shaded_triangle(const TriVertex *vert, bool ccw, ScreenPolyTriangleDrawerArgs *args, DrawerThread *thread, void(*drawfunc)(const ScreenPolyTriangleDrawerArgs *, DrawerThread *))
{
// Cull, clip and generate additional vertices as needed
TriVertex clippedvert[6];
TriVertex clippedvert[12];
int numclipvert;
clipedge(vert, clippedvert, numclipvert);
@ -196,7 +196,7 @@ void PolyTriangleDrawer::clipedge(const TriVertex *verts, TriVertex *clippedvert
// -v.w <= v.z <= v.w
// use barycentric weights while clipping vertices
float weights[6 * 3 * 2];
float weights[12 * 3 * 2];
for (int i = 0; i < 3; i++)
{
weights[i * 3 + 0] = 0.0f;
@ -220,7 +220,7 @@ void PolyTriangleDrawer::clipedge(const TriVertex *verts, TriVertex *clippedvert
// Clip against each halfspace
float *input = weights;
float *output = weights + 6 * 3;
float *output = weights + 12 * 3;
int inputverts = 3;
int outputverts = 0;
for (int p = 0; p < 6; p++)

View File

@ -138,7 +138,7 @@ TriVertex TriangleDrawer::shade_vertex(const TriUniforms &uniforms, TriVertex v)
void TriangleDrawer::draw_shaded_triangle(const TriVertex *vert, bool ccw, ScreenTriangleDrawerArgs *args, DrawerThread *thread, void(*drawfunc)(const ScreenTriangleDrawerArgs *, DrawerThread *))
{
// Cull, clip and generate additional vertices as needed
TriVertex clippedvert[6];
TriVertex clippedvert[12];
int numclipvert;
clipedge(vert, clippedvert, numclipvert);
@ -207,7 +207,7 @@ void TriangleDrawer::clipedge(const TriVertex *verts, TriVertex *clippedvert, in
// -v.w <= v.z <= v.w
// use barycentric weights while clipping vertices
float weights[6 * 3 * 2];
float weights[12 * 3 * 2];
for (int i = 0; i < 3; i++)
{
weights[i * 3 + 0] = 0.0f;
@ -231,7 +231,7 @@ void TriangleDrawer::clipedge(const TriVertex *verts, TriVertex *clippedvert, in
// Clip against each halfspace
float *input = weights;
float *output = weights + 6 * 3;
float *output = weights + 12 * 3;
int inputverts = 3;
int outputverts = 0;
for (int p = 0; p < 6; p++)