|
@@ -424,7 +424,7 @@ void Polyline::draw(love::graphics::Graphics *gfx)
|
|
|
|
|
|
Graphics::BatchedDrawCommand cmd;
|
|
Graphics::BatchedDrawCommand cmd;
|
|
cmd.formats[0] = getSinglePositionFormat(is2D);
|
|
cmd.formats[0] = getSinglePositionFormat(is2D);
|
|
- cmd.formats[1] = CommonFormat::RGBAub;
|
|
|
|
|
|
+ cmd.formats[1] = CommonFormat::STf_RGBAub;
|
|
cmd.indexMode = triangle_mode;
|
|
cmd.indexMode = triangle_mode;
|
|
cmd.vertexCount = std::min(maxvertices, total_vertex_count - vertex_start);
|
|
cmd.vertexCount = std::min(maxvertices, total_vertex_count - vertex_start);
|
|
|
|
|
|
@@ -435,13 +435,19 @@ void Polyline::draw(love::graphics::Graphics *gfx)
|
|
else
|
|
else
|
|
t.transformXY0((Vector3 *) data.stream[0], verts, cmd.vertexCount);
|
|
t.transformXY0((Vector3 *) data.stream[0], verts, cmd.vertexCount);
|
|
|
|
|
|
- Color32 *colordata = (Color32 *) data.stream[1];
|
|
|
|
|
|
+ STf_RGBAub *attributes = (STf_RGBAub *) data.stream[1];
|
|
|
|
|
|
int draw_rough_count = std::min(cmd.vertexCount, (int) vertex_count - vertex_start);
|
|
int draw_rough_count = std::min(cmd.vertexCount, (int) vertex_count - vertex_start);
|
|
|
|
|
|
// Constant vertex color up to the overdraw vertices.
|
|
// Constant vertex color up to the overdraw vertices.
|
|
|
|
+ // Texture coordinates are a constant value, we only have them to keep auto-batching
|
|
|
|
+ // when drawing filled and line polygons together.
|
|
for (int i = 0; i < draw_rough_count; i++)
|
|
for (int i = 0; i < draw_rough_count; i++)
|
|
- colordata[i] = curcolor;
|
|
|
|
|
|
+ {
|
|
|
|
+ attributes[i].s = 0.0f;
|
|
|
|
+ attributes[i].t = 0.0f;
|
|
|
|
+ attributes[i].color = curcolor;
|
|
|
|
+ }
|
|
|
|
|
|
if (overdraw)
|
|
if (overdraw)
|
|
{
|
|
{
|
|
@@ -456,30 +462,34 @@ void Polyline::draw(love::graphics::Graphics *gfx)
|
|
|
|
|
|
if (draw_overdraw_count > 0)
|
|
if (draw_overdraw_count > 0)
|
|
{
|
|
{
|
|
- Color32 *colors = colordata + draw_overdraw_begin;
|
|
|
|
- fill_color_array(curcolor, colors, draw_overdraw_count);
|
|
|
|
|
|
+ STf_RGBAub *c = attributes + draw_overdraw_begin;
|
|
|
|
+ fill_color_array(curcolor, c, draw_overdraw_count);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-void Polyline::fill_color_array(Color32 constant_color, Color32 *colors, int count)
|
|
|
|
|
|
+void Polyline::fill_color_array(Color32 constant_color, STf_RGBAub *attributes, int count)
|
|
{
|
|
{
|
|
for (int i = 0; i < count; ++i)
|
|
for (int i = 0; i < count; ++i)
|
|
{
|
|
{
|
|
Color32 c = constant_color;
|
|
Color32 c = constant_color;
|
|
c.a *= (i+1) % 2; // avoids branching. equiv to if (i%2 == 1) c.a = 0;
|
|
c.a *= (i+1) % 2; // avoids branching. equiv to if (i%2 == 1) c.a = 0;
|
|
- colors[i] = c;
|
|
|
|
|
|
+ attributes[i].s = 0.0f;
|
|
|
|
+ attributes[i].t = 0.0f;
|
|
|
|
+ attributes[i].color = c;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-void NoneJoinPolyline::fill_color_array(Color32 constant_color, Color32 *colors, int count)
|
|
|
|
|
|
+void NoneJoinPolyline::fill_color_array(Color32 constant_color, STf_RGBAub *attributes, int count)
|
|
{
|
|
{
|
|
for (int i = 0; i < count; ++i)
|
|
for (int i = 0; i < count; ++i)
|
|
{
|
|
{
|
|
Color32 c = constant_color;
|
|
Color32 c = constant_color;
|
|
c.a *= (i & 3) < 2; // if (i % 4 == 2 || i % 4 == 3) c.a = 0
|
|
c.a *= (i & 3) < 2; // if (i % 4 == 2 || i % 4 == 3) c.a = 0
|
|
- colors[i] = c;
|
|
|
|
|
|
+ attributes[i].s = 0.0f;
|
|
|
|
+ attributes[i].t = 0.0f;
|
|
|
|
+ attributes[i].color = c;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|