mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Small reorganization to VMobject.get_shader_wrapper_list, and default to fill border being drawn up front
This commit is contained in:
parent
b351c9f1c8
commit
280090a7c9
1 changed files with 16 additions and 16 deletions
|
@ -1282,27 +1282,29 @@ class VMobject(Mobject):
|
||||||
|
|
||||||
# Build up data lists
|
# Build up data lists
|
||||||
fill_datas = []
|
fill_datas = []
|
||||||
fill_border_datas = []
|
|
||||||
fill_indices = []
|
fill_indices = []
|
||||||
|
fill_border_datas = []
|
||||||
stroke_datas = []
|
stroke_datas = []
|
||||||
back_stroke_datas = []
|
back_stroke_datas = []
|
||||||
for submob in family:
|
for submob in family:
|
||||||
submob.get_joint_products()
|
submob.get_joint_products()
|
||||||
|
indices = submob.get_outer_vert_indices()
|
||||||
has_fill = submob.has_fill()
|
has_fill = submob.has_fill()
|
||||||
has_stroke = submob.has_stroke()
|
has_stroke = submob.has_stroke()
|
||||||
indices = submob.get_outer_vert_indices()
|
back_stroke = has_stroke and submob.stroke_behind
|
||||||
if has_stroke:
|
front_stroke = has_stroke and not submob.stroke_behind
|
||||||
lst = back_stroke_datas if submob.stroke_behind else stroke_datas
|
if back_stroke:
|
||||||
lst.append(submob.data[stroke_names][indices])
|
back_stroke_datas.append(submob.data[stroke_names][indices])
|
||||||
if has_fill:
|
if front_stroke:
|
||||||
|
stroke_datas.append(submob.data[stroke_names][indices])
|
||||||
|
if has_fill and self._use_winding_fill:
|
||||||
data = submob.data[fill_names]
|
data = submob.data[fill_names]
|
||||||
data["base_point"][:] = data["point"][0]
|
data["base_point"][:] = data["point"][0]
|
||||||
if self._use_winding_fill:
|
fill_datas.append(data[indices])
|
||||||
fill_datas.append(data[indices])
|
if has_fill and not self._use_winding_fill:
|
||||||
else:
|
fill_datas.append(submob.data[fill_names])
|
||||||
fill_datas.append(data)
|
fill_indices.append(submob.get_triangulation())
|
||||||
fill_indices.append(submob.get_triangulation())
|
if has_fill and not front_stroke:
|
||||||
if not has_stroke and has_fill:
|
|
||||||
# Add fill border
|
# Add fill border
|
||||||
names = list(stroke_names)
|
names = list(stroke_names)
|
||||||
names[names.index('stroke_rgba')] = 'fill_rgba'
|
names[names.index('stroke_rgba')] = 'fill_rgba'
|
||||||
|
@ -1313,11 +1315,9 @@ class VMobject(Mobject):
|
||||||
fill_border_datas.append(border_stroke_data[indices])
|
fill_border_datas.append(border_stroke_data[indices])
|
||||||
|
|
||||||
shader_wrappers = [
|
shader_wrappers = [
|
||||||
self.back_stroke_shader_wrapper.read_in(
|
self.back_stroke_shader_wrapper.read_in(back_stroke_datas),
|
||||||
[*back_stroke_datas, *fill_border_datas]
|
|
||||||
),
|
|
||||||
self.fill_shader_wrapper.read_in(fill_datas, fill_indices or None),
|
self.fill_shader_wrapper.read_in(fill_datas, fill_indices or None),
|
||||||
self.stroke_shader_wrapper.read_in(stroke_datas),
|
self.stroke_shader_wrapper.read_in([*fill_border_datas, *stroke_datas]),
|
||||||
]
|
]
|
||||||
# TODO, account for submob uniforms separately?
|
# TODO, account for submob uniforms separately?
|
||||||
self.uniforms.update(family[0].uniforms)
|
self.uniforms.update(family[0].uniforms)
|
||||||
|
|
Loading…
Add table
Reference in a new issue