Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRemco Burema <rburema@gmail.com>2021-07-25 23:26:59 +0300
committerRemco Burema <rburema@gmail.com>2021-07-25 23:26:59 +0300
commit96ca3b14170c7e3e8b1b13215a9e27ab32893f5e (patch)
tree332c1d3bfcaf5c09ec36842dc3d1fe8a27d62206 /cura/Layer.py
parent87d3f6fd22a1c6bf6a32703da5b058fadca64c54 (diff)
Handle render-range in shader.
Instead of re-uploading the mesh each time the range changes, handle the range in the shaders with the new draw-range parameters. This does however, mean the range has to be in vertices, not in elements. This necessitates some changes to the simulation-view, and some added bits deeper in the base code. Mainly, since each time the type of a line changes, there is an extra vertex, there needs to be a type-change count available to get from 'paths' to range indices.
Diffstat (limited to 'cura/Layer.py')
-rw-r--r--cura/Layer.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/cura/Layer.py b/cura/Layer.py
index af42488e2a..52c4583f54 100644
--- a/cura/Layer.py
+++ b/cura/Layer.py
@@ -43,14 +43,22 @@ class Layer:
result = 0
for polygon in self._polygons:
result += polygon.lineMeshVertexCount()
-
return result
def lineMeshElementCount(self) -> int:
result = 0
for polygon in self._polygons:
result += polygon.lineMeshElementCount()
+ return result
+ def lineMeshCumulativeTypeChangeCount(self, path: int) -> int:
+ result = 0
+ for polygon in self._polygons:
+ num_counts = len(polygon.cumulativeTypeChangeCounts)
+ if path < num_counts:
+ return result + polygon.cumulativeTypeChangeCounts[path]
+ path -= num_counts
+ result += polygon.cumulativeTypeChangeCounts[num_counts - 1]
return result
def build(self, vertex_offset, index_offset, vertices, colors, line_dimensions, feedrates, extruders, line_types, indices):