mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Tidy up ShaderWrapper.read_in
This commit is contained in:
parent
3f8c861973
commit
f5480d02ff
1 changed files with 15 additions and 12 deletions
|
@ -155,21 +155,24 @@ class ShaderWrapper(object):
|
||||||
if total_len == 0:
|
if total_len == 0:
|
||||||
return self
|
return self
|
||||||
|
|
||||||
if indices_list is not None and self.vert_indices is not None:
|
# Stack the data
|
||||||
total_verts = sum(len(vi) for vi in indices_list)
|
np.concatenate(data_list, out=self.vert_data)
|
||||||
self.vert_indices = resize_array(self.vert_indices, total_verts)
|
|
||||||
|
|
||||||
|
if indices_list is None or self.vert_indices is None:
|
||||||
|
return self
|
||||||
|
|
||||||
|
total_verts = sum(len(vi) for vi in indices_list)
|
||||||
|
self.vert_indices = resize_array(self.vert_indices, total_verts)
|
||||||
|
|
||||||
|
# Stack vert_indices, but adding the appropriate offset
|
||||||
|
# alogn the way
|
||||||
n_points = 0
|
n_points = 0
|
||||||
n_verts = 0
|
n_verts = 0
|
||||||
for k, data in enumerate(data_list):
|
for data, indices in zip(data_list, indices_list):
|
||||||
new_n_points = n_points + len(data)
|
new_n_verts = n_verts + len(indices)
|
||||||
self.vert_data[n_points:new_n_points] = data
|
self.vert_indices[n_verts:new_n_verts] = indices + n_points
|
||||||
if self.vert_indices is not None and indices_list is not None:
|
n_verts = new_n_verts
|
||||||
vert_indices = indices_list[k]
|
n_points += len(data)
|
||||||
new_n_verts = n_verts + len(vert_indices)
|
|
||||||
self.vert_indices[n_verts:new_n_verts] = vert_indices + n_points
|
|
||||||
n_verts = new_n_verts
|
|
||||||
n_points = new_n_points
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue