mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Introduce flat_stroke uniform
This commit is contained in:
parent
8c7e93f829
commit
9a1e103a7f
2 changed files with 14 additions and 0 deletions
|
@ -16,6 +16,7 @@ class SurfaceMesh(VGroup):
|
||||||
"stroke_width": 1,
|
"stroke_width": 1,
|
||||||
"normal_nudge": 1e-2,
|
"normal_nudge": 1e-2,
|
||||||
"depth_test": True,
|
"depth_test": True,
|
||||||
|
"flat_stroke": False,
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, uv_surface, **kwargs):
|
def __init__(self, uv_surface, **kwargs):
|
||||||
|
|
|
@ -62,6 +62,7 @@ class VMobject(Mobject):
|
||||||
# "fill_frag_shader_file": "quadratic_bezier_fill_frag.glsl",
|
# "fill_frag_shader_file": "quadratic_bezier_fill_frag.glsl",
|
||||||
# Could also be Bevel, Miter, Round
|
# Could also be Bevel, Miter, Round
|
||||||
"joint_type": "auto",
|
"joint_type": "auto",
|
||||||
|
"flat_stroke": True,
|
||||||
"render_primitive": moderngl.TRIANGLES,
|
"render_primitive": moderngl.TRIANGLES,
|
||||||
"triangulation_locked": False,
|
"triangulation_locked": False,
|
||||||
"fill_dtype": [
|
"fill_dtype": [
|
||||||
|
@ -106,6 +107,7 @@ class VMobject(Mobject):
|
||||||
background=self.draw_stroke_behind_fill,
|
background=self.draw_stroke_behind_fill,
|
||||||
)
|
)
|
||||||
self.set_gloss(self.gloss)
|
self.set_gloss(self.gloss)
|
||||||
|
self.set_flat_stroke(self.flat_stroke)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def generate_rgba_array(self, color, opacity):
|
def generate_rgba_array(self, color, opacity):
|
||||||
|
@ -336,6 +338,16 @@ class VMobject(Mobject):
|
||||||
return self.get_fill_opacity()
|
return self.get_fill_opacity()
|
||||||
return self.get_stroke_opacity()
|
return self.get_stroke_opacity()
|
||||||
|
|
||||||
|
def set_flat_stroke(self, flat_stroke=True, family=True):
|
||||||
|
self.flat_stroke = flat_stroke
|
||||||
|
if family:
|
||||||
|
for submob in self.submobjects:
|
||||||
|
submob.set_flat_stroke(flat_stroke, family)
|
||||||
|
return self
|
||||||
|
|
||||||
|
def get_flat_stroke(self):
|
||||||
|
return self.flat_stroke
|
||||||
|
|
||||||
# TODO, this currently does nothing
|
# TODO, this currently does nothing
|
||||||
def color_using_background_image(self, background_image_file):
|
def color_using_background_image(self, background_image_file):
|
||||||
self.background_image_file = background_image_file
|
self.background_image_file = background_image_file
|
||||||
|
@ -970,6 +982,7 @@ class VMobject(Mobject):
|
||||||
}
|
}
|
||||||
result = super().get_shader_uniforms()
|
result = super().get_shader_uniforms()
|
||||||
result["joint_type"] = j_map[self.joint_type]
|
result["joint_type"] = j_map[self.joint_type]
|
||||||
|
result["flat_stroke"] = float(self.flat_stroke)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def get_stroke_shader_data(self):
|
def get_stroke_shader_data(self):
|
||||||
|
|
Loading…
Add table
Reference in a new issue