From 1cf89abf53cf6577b3d039c0efa8f153cbcde1b8 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Wed, 4 Jan 2023 13:22:38 -0800 Subject: [PATCH] No need to track vertex index manually --- manimlib/mobject/types/vectorized_mobject.py | 7 +------ manimlib/shaders/quadratic_bezier_fill/vert.glsl | 4 ++-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/manimlib/mobject/types/vectorized_mobject.py b/manimlib/mobject/types/vectorized_mobject.py index 87df2601..759e7d0d 100644 --- a/manimlib/mobject/types/vectorized_mobject.py +++ b/manimlib/mobject/types/vectorized_mobject.py @@ -55,7 +55,6 @@ class VMobject(Mobject): ('point', np.float32, (3,)), ('orientation', np.float32, (1,)), ('color', np.float32, (4,)), - ('vert_index', np.float32, (1,)), ] stroke_dtype: Sequence[Tuple[str, type, Tuple[int]]] = [ ("point", np.float32, (3,)), @@ -1142,11 +1141,7 @@ class VMobject(Mobject): return self.stroke_data def get_fill_shader_data(self) -> np.ndarray: - points = self.get_points() - if len(self.fill_data) != len(points): - self.fill_data = resize_array(self.fill_data, len(points)) - self.fill_data["vert_index"][:, 0] = range(len(points)) - + self.fill_data = resize_array(self.fill_data, len(self.get_points())) self.read_data_to_shader(self.fill_data, "point", "points") self.read_data_to_shader(self.fill_data, "color", "fill_rgba") self.read_data_to_shader(self.fill_data, "orientation", "orientation") diff --git a/manimlib/shaders/quadratic_bezier_fill/vert.glsl b/manimlib/shaders/quadratic_bezier_fill/vert.glsl index 2a0fc1a2..293ed854 100644 --- a/manimlib/shaders/quadratic_bezier_fill/vert.glsl +++ b/manimlib/shaders/quadratic_bezier_fill/vert.glsl @@ -5,7 +5,6 @@ in vec3 point; in float orientation; in vec4 color; -in float vert_index; out vec3 bp; // Bezier control point out float v_orientation; @@ -19,5 +18,6 @@ void main(){ bp = position_point_into_frame(point); v_orientation = orientation; v_color = color; - v_vert_index = vert_index; + // Implicit conversion from int to float + v_vert_index = gl_VertexID; } \ No newline at end of file