|
@@ -30,6 +30,7 @@
|
|
|
|
|
|
// C++
|
|
|
#include <vector>
|
|
|
+#include <string.h>
|
|
|
|
|
|
namespace love
|
|
|
{
|
|
@@ -52,7 +53,6 @@ public:
|
|
|
, overdraw_vertex_count(0)
|
|
|
, draw_mode(mode)
|
|
|
, use_quad_indices(quadindices)
|
|
|
- , vertex_start(0)
|
|
|
, overdraw_vertex_start(0)
|
|
|
{}
|
|
|
virtual ~Polyline();
|
|
@@ -97,7 +97,6 @@ protected:
|
|
|
size_t overdraw_vertex_count;
|
|
|
GLenum draw_mode;
|
|
|
bool use_quad_indices;
|
|
|
- size_t vertex_start;
|
|
|
size_t overdraw_vertex_start;
|
|
|
|
|
|
}; // Polyline
|
|
@@ -117,9 +116,18 @@ public:
|
|
|
void render(const float *vertices, size_t count, float halfwidth, float pixel_size, bool draw_overdraw)
|
|
|
{
|
|
|
Polyline::render(vertices, count, 2 * count - 4, halfwidth, pixel_size, draw_overdraw);
|
|
|
- // discard the first two vertices. (these are redundant)
|
|
|
- vertex_start = 2;
|
|
|
- vertex_count -= 2;
|
|
|
+
|
|
|
+ // discard the first and last two vertices. (these are redundant)
|
|
|
+ for (size_t i = 0; i < vertex_count - 4; ++i)
|
|
|
+ this->vertices[i] = this->vertices[i+2];
|
|
|
+
|
|
|
+ // The last quad is now garbage, so zero it out to make sure it doesn't
|
|
|
+ // get rasterized. These vertices are in between the core line vertices
|
|
|
+ // and the overdraw vertices in the combined vertex array, so they still
|
|
|
+ // get "rendered" since we draw everything with one draw call.
|
|
|
+ memset(&this->vertices[vertex_count - 4], 0, sizeof(love::Vector) * 4);
|
|
|
+
|
|
|
+ vertex_count -= 4;
|
|
|
}
|
|
|
|
|
|
protected:
|