diff options
author | Johan K <johan@3dverkstan.se> | 2016-06-14 19:08:35 +0300 |
---|---|---|
committer | Johan Kristensen <johan@3dverkstan.se> | 2016-06-28 23:29:29 +0300 |
commit | f184baadf0a396743268b29027a1d4031d73991d (patch) | |
tree | f540a0cf093b58d573e7f2bc4469269c71afe55c /cura/LayerDataBuilder.py | |
parent | ac0f743855ed2df9d9542724b911a8f3a43dd07c (diff) |
Formulate layerview logic using numpy to speed up. Also changed layer data packets from engine to make it possible.
Diffstat (limited to 'cura/LayerDataBuilder.py')
-rw-r--r-- | cura/LayerDataBuilder.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/cura/LayerDataBuilder.py b/cura/LayerDataBuilder.py index 7e8e0e636b..85f9a23e7b 100644 --- a/cura/LayerDataBuilder.py +++ b/cura/LayerDataBuilder.py @@ -50,18 +50,22 @@ class LayerDataBuilder(MeshBuilder): def build(self): vertex_count = 0 + index_count = 0 for layer, data in self._layers.items(): - vertex_count += data.vertexCount() + vertex_count += data.lineMeshVertexCount() + index_count += data.lineMeshElementCount() vertices = numpy.empty((vertex_count, 3), numpy.float32) colors = numpy.empty((vertex_count, 4), numpy.float32) - indices = numpy.empty((vertex_count, 2), numpy.int32) + indices = numpy.empty((index_count, 2), numpy.int32) - offset = 0 + vertex_offset = 0 + index_offset = 0 for layer, data in self._layers.items(): - offset = data.build(offset, vertices, colors, indices) + ( vertex_offset, index_offset ) = data.build( vertex_offset, index_offset, vertices, colors, indices) self._element_counts[layer] = data.elementCount + self.clear() self.addVertices(vertices) self.addColors(colors) self.addIndices(indices.flatten()) |