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.
This commit is contained in:
Remco Burema 2021-07-25 22:26:59 +02:00
parent 87d3f6fd22
commit 96ca3b1417
6 changed files with 66 additions and 8 deletions

View file

@ -63,6 +63,7 @@ class LayerDataBuilder(MeshBuilder):
feedrates = numpy.empty((vertex_count), numpy.float32)
extruders = numpy.empty((vertex_count), numpy.float32)
line_types = numpy.empty((vertex_count), numpy.float32)
vertex_indices = numpy.arange(0, vertex_count, 1, dtype=numpy.float32)
vertex_offset = 0
index_offset = 0
@ -109,6 +110,12 @@ class LayerDataBuilder(MeshBuilder):
"value": feedrates,
"opengl_name": "a_feedrate",
"opengl_type": "float"
},
# Can't use glDrawElements to index (due to oversight in (Py)Qt), can't use gl_PrimitiveID (due to legacy support):
"vertex_indices": {
"value": vertex_indices,
"opengl_name": "a_vertex_index",
"opengl_type": "float"
}
}