Commit 4ef27e5b authored by Guillaume Seguin's avatar Guillaume Seguin

Speed things up a lot by not adding useless colors

parent 2d477e08
......@@ -329,6 +329,7 @@ class GcodeModel(Model):
path_halfheight = 0.1
new_indices = []
new_vertices = []
if prev_is_extruding:
# Store previous vertices indices
first_prev = len(vertex_list) - 4
......@@ -349,11 +350,11 @@ class GcodeModel(Model):
p2x = prev_pos[0] + path_halfwidth * avg_move_normal_x
p1y = prev_pos[1] - path_halfwidth * avg_move_normal_y
p2y = prev_pos[1] + path_halfwidth * avg_move_normal_y
vertex_list.append((p1x, p1y, prev_pos[2] + path_halfheight))
vertex_list.append((p1x, p1y, prev_pos[2] - path_halfheight))
vertex_list.append((p2x, p2y, prev_pos[2] - path_halfheight))
vertex_list.append((p2x, p2y, prev_pos[2] + path_halfheight))
first = len(vertex_list) - 4
new_vertices.append((p1x, p1y, prev_pos[2] + path_halfheight))
new_vertices.append((p1x, p1y, prev_pos[2] - path_halfheight))
new_vertices.append((p2x, p2y, prev_pos[2] - path_halfheight))
new_vertices.append((p2x, p2y, prev_pos[2] + path_halfheight))
first = len(new_vertices) - 4
# Link to previous
new_indices += triangulate_rectangle(first_prev, first,
first + 1, first_prev + 1)
......@@ -369,11 +370,11 @@ class GcodeModel(Model):
p2x = prev_pos[0] + path_halfwidth * move_normal_x
p1y = prev_pos[1] - path_halfwidth * move_normal_y
p2y = prev_pos[1] + path_halfwidth * move_normal_y
vertex_list.append((p1x, p1y, prev_pos[2] + path_halfheight))
vertex_list.append((p1x, p1y, prev_pos[2] - path_halfheight))
vertex_list.append((p2x, p2y, prev_pos[2] - path_halfheight))
vertex_list.append((p2x, p2y, prev_pos[2] + path_halfheight))
first = len(vertex_list) - 4
new_vertices.append((p1x, p1y, prev_pos[2] + path_halfheight))
new_vertices.append((p1x, p1y, prev_pos[2] - path_halfheight))
new_vertices.append((p2x, p2y, prev_pos[2] - path_halfheight))
new_vertices.append((p2x, p2y, prev_pos[2] + path_halfheight))
first = len(new_vertices) - 4
new_indices = triangulate_rectangle(first, first + 1,
first + 2, first + 3)
......@@ -383,11 +384,11 @@ class GcodeModel(Model):
p2x = current_pos[0] + path_halfwidth * move_normal_x
p1y = current_pos[1] - path_halfwidth * move_normal_y
p2y = current_pos[1] + path_halfwidth * move_normal_y
vertex_list.append((p1x, p1y, current_pos[2] + path_halfheight))
vertex_list.append((p1x, p1y, current_pos[2] - path_halfheight))
vertex_list.append((p2x, p2y, current_pos[2] - path_halfheight))
vertex_list.append((p2x, p2y, current_pos[2] + path_halfheight))
end_first = len(vertex_list) - 4
new_vertices.append((p1x, p1y, current_pos[2] + path_halfheight))
new_vertices.append((p1x, p1y, current_pos[2] - path_halfheight))
new_vertices.append((p2x, p2y, current_pos[2] - path_halfheight))
new_vertices.append((p2x, p2y, current_pos[2] + path_halfheight))
end_first = len(new_vertices) - 4
new_indices += triangulate_rectangle(end_first + 3, end_first + 2,
end_first + 1, end_first)
new_indices += triangulate_rectangle(first, end_first,
......@@ -400,8 +401,9 @@ class GcodeModel(Model):
end_first, first)
index_list += new_indices
vertex_list += new_vertices
color_list += [gline_color] * len(new_indices)
color_list += [gline_color] * len(new_vertices)
prev_is_extruding = True
prev_move_x = delta_x
prev_move_y = delta_y
......
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