Pre-allocate vertex and element lists in build_geo
This commit is contained in:
parent
536dce6a98
commit
3c3cae682f
1 changed files with 9 additions and 6 deletions
|
|
@ -528,14 +528,17 @@ class Art:
|
|||
x2, y2 = left_x, bottom_y
|
||||
x3, y3 = right_x, bottom_y
|
||||
# Z of all layers is 0, layer Z set in shader
|
||||
verts = [x0, y0, 0]
|
||||
verts += [x1, y1, 0]
|
||||
verts += [x2, y2, 0]
|
||||
verts += [x3, y3, 0]
|
||||
verts = [x0, y0, 0, x1, y1, 0, x2, y2, 0, x3, y3, 0]
|
||||
self.vert_array[layer][tile_y][tile_x] = verts
|
||||
# vertex elements
|
||||
elements = [vert_index, vert_index + 1, vert_index + 2]
|
||||
elements += [vert_index + 1, vert_index + 2, vert_index + 3]
|
||||
elements = [
|
||||
vert_index,
|
||||
vert_index + 1,
|
||||
vert_index + 2,
|
||||
vert_index + 1,
|
||||
vert_index + 2,
|
||||
vert_index + 3,
|
||||
]
|
||||
self.elem_array[elem_index : elem_index + ELEM_STRIDE] = elements
|
||||
elem_index += ELEM_STRIDE
|
||||
# 4 verts in a quad
|
||||
|
|
|
|||
Loading…
Reference in a new issue