mirror of
https://github.com/love2d/love.git
synced 2026-08-20 04:30:09 +02:00
Simplified the code for love.graphics.arc.
This commit is contained in:
@@ -1298,21 +1298,8 @@ void Graphics::arc(DrawMode mode, float x, float y, float radius, float angle1,
|
|||||||
coords[2 * (i+1) + 1] = y + radius * sinf(phi);
|
coords[2 * (i+1) + 1] = y + radius * sinf(phi);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GL_POLYGON can only fill-draw convex polygons, so we need to do stuff manually here
|
// NOTE: We rely on polygon() using GL_TRIANGLE_FAN, when fill mode is used.
|
||||||
if (mode == DRAW_LINE)
|
polygon(mode, coords, num_coords);
|
||||||
{
|
|
||||||
polyline(coords, num_coords); // Artifacts at sharp angles if set to looping.
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OpenGL::TempDebugGroup debuggroup("Filled arc draw");
|
|
||||||
|
|
||||||
gl.prepareDraw();
|
|
||||||
gl.bindTexture(gl.getDefaultTexture());
|
|
||||||
gl.useVertexAttribArrays(ATTRIBFLAG_POS);
|
|
||||||
glVertexAttribPointer(ATTRIB_POS, 2, GL_FLOAT, GL_FALSE, 0, coords);
|
|
||||||
gl.drawArrays(GL_TRIANGLE_FAN, 0, points + 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
delete[] coords;
|
delete[] coords;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user