Commit 68c19c30 authored by Jan Möbius's avatar Jan Möbius

Merge branch 'PolyLineEdgeColors' into 'master'

assign edge colors to the correct provoking vertex

Store edge colors in the second vertex instead of the first one of each line segment. fix issue #25 

See merge request !48
parents 63540c74 cda08333
Pipeline #344 passed with stage
......@@ -774,7 +774,16 @@ writeVertexColor(unsigned int _vertex, bool _colorSourceVertex, void* _dst) cons
unsigned int byteOffset = declToUse->findElementByUsage(VERTEX_USAGE_COLOR)->getByteOffset();
unsigned char* ucdata = ((unsigned char*)_dst) + byteOffset;
Point col = _colorSourceVertex ? polyline_.vertex_color(_vertex) : polyline_.edge_color(_vertex % polyline_.n_edges());
Point col;
if (_colorSourceVertex)
col = polyline_.vertex_color(_vertex); // per vertex
else
{
// edge colors
// use the 2nd vertex of each edge as the provoking vertex
int edgeID = (_vertex + polyline_.n_edges() - 1) % polyline_.n_edges();
col = polyline_.edge_color(edgeID);
}
// rgb
for (int i = 0; i < 3; ++i)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment