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 *)) 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 // Cull, clip and generate additional vertices as needed
TriVertex clippedvert[6]; TriVertex clippedvert[12];
int numclipvert; int numclipvert;
clipedge(vert, clippedvert, numclipvert); clipedge(vert, clippedvert, numclipvert);
@ -196,7 +196,7 @@ void PolyTriangleDrawer::clipedge(const TriVertex *verts, TriVertex *clippedvert
// -v.w <= v.z <= v.w // -v.w <= v.z <= v.w
// use barycentric weights while clipping vertices // use barycentric weights while clipping vertices
float weights[6 * 3 * 2]; float weights[12 * 3 * 2];
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
weights[i * 3 + 0] = 0.0f; weights[i * 3 + 0] = 0.0f;
@ -220,7 +220,7 @@ void PolyTriangleDrawer::clipedge(const TriVertex *verts, TriVertex *clippedvert
// Clip against each halfspace // Clip against each halfspace
float *input = weights; float *input = weights;
float *output = weights + 6 * 3; float *output = weights + 12 * 3;
int inputverts = 3; int inputverts = 3;
int outputverts = 0; int outputverts = 0;
for (int p = 0; p < 6; p++) 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 *)) 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 // Cull, clip and generate additional vertices as needed
TriVertex clippedvert[6]; TriVertex clippedvert[12];
int numclipvert; int numclipvert;
clipedge(vert, clippedvert, numclipvert); clipedge(vert, clippedvert, numclipvert);
@ -207,7 +207,7 @@ void TriangleDrawer::clipedge(const TriVertex *verts, TriVertex *clippedvert, in
// -v.w <= v.z <= v.w // -v.w <= v.z <= v.w
// use barycentric weights while clipping vertices // use barycentric weights while clipping vertices
float weights[6 * 3 * 2]; float weights[12 * 3 * 2];
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
weights[i * 3 + 0] = 0.0f; weights[i * 3 + 0] = 0.0f;
@ -231,7 +231,7 @@ void TriangleDrawer::clipedge(const TriVertex *verts, TriVertex *clippedvert, in
// Clip against each halfspace // Clip against each halfspace
float *input = weights; float *input = weights;
float *output = weights + 6 * 3; float *output = weights + 12 * 3;
int inputverts = 3; int inputverts = 3;
int outputverts = 0; int outputverts = 0;
for (int p = 0; p < 6; p++) for (int p = 0; p < 6; p++)