Layer shader now uses own attribute for line dimensions instead of misusing uvs.

This commit is contained in:
Jack Ha 2016-12-28 15:20:14 +01:00
parent 8d2b3654a4
commit 0f2fb86cd9
6 changed files with 22 additions and 40 deletions

View file

@ -67,7 +67,7 @@ class LayerPolygon:
## build
# line_thicknesses: array with type as index and thickness as value
def build(self, vertex_offset, index_offset, vertices, colors, line_dimensions, indices, thickness):
def build(self, vertex_offset, index_offset, vertices, colors, line_dimensions, indices):
if (self._build_cache_line_mesh_mask is None) or (self._build_cache_needed_points is None ):
self.buildCache()
@ -85,6 +85,7 @@ class LayerPolygon:
# Points are picked based on the index list to get the vertices needed.
vertices[self._vertex_begin:self._vertex_end, :] = self._data[index_list, :]
# Create an array with colors for each vertex and remove the color data for the points that has been thrown away.
colors[self._vertex_begin:self._vertex_end, :] = numpy.tile(self._colors, (1, 2)).reshape((-1, 4))[needed_points_list.ravel()]
colors[self._vertex_begin:self._vertex_end, :] *= numpy.array([[0.5, 0.5, 0.5, 1.0]], numpy.float32)