drawTriangle method
Draws a filled triangle with the specified vertex coordinates and texture coordinates.
x1
,y1
,x2
,y2
,x3
,y3
: Coordinates of the three triangle vertices.u1
,v1
,u2
,v2
,u3
,v3
: Texture coordinates for each corresponding vertex.texture
: An optional Texture to apply. Defaults to a white texture.colors
: An optional list of Color objects for per-vertex coloring.colors[0]
for first vertex,colors[1]
for second,colors[2]
for third.
Implementation
void drawTriangle(
double x1,
double y1,
double x2,
double y2,
double x3,
double y3,
double u1,
double v1,
double u2,
double v2,
double u3,
double v3, {
Texture? texture,
ColorList? colors,
}) {
_prepareRenderState(_PrimitiveType.triangles, texture: texture);
_transfromAndAddVertices(x1, y1, u1, v1, getColorFromList(colors, 0, _encodedColor));
_transfromAndAddVertices(x2, y2, u2, v2, getColorFromList(colors, 1, _encodedColor));
_transfromAndAddVertices(x3, y3, u3, v3, getColorFromList(colors, 2, _encodedColor));
}