Revert "Go back to fill shader tracing vertex index manually"

This reverts commit 7847ff1a9d.
This commit is contained in:
Grant Sanderson 2023-01-11 16:22:12 -08:00
parent 5e459d57c6
commit 387de61119
2 changed files with 3 additions and 8 deletions

View file

@ -61,7 +61,6 @@ class VMobject(Mobject):
('point', np.float32, (3,)), ('point', np.float32, (3,)),
('orientation', np.float32, (1,)), ('orientation', np.float32, (1,)),
('color', np.float32, (4,)), ('color', np.float32, (4,)),
('vert_index', np.float32, (1,)),
] ]
stroke_dtype: Sequence[Tuple[str, type, Tuple[int]]] = [ stroke_dtype: Sequence[Tuple[str, type, Tuple[int]]] = [
("point", np.float32, (3,)), ("point", np.float32, (3,)),
@ -1220,11 +1219,7 @@ class VMobject(Mobject):
return self.stroke_data return self.stroke_data
def get_fill_shader_data(self) -> np.ndarray: def get_fill_shader_data(self) -> np.ndarray:
points = self.get_points() self.fill_data = resize_array(self.fill_data, len(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.read_data_to_shader(self.fill_data, "point", "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, "color", "fill_rgba")
self.read_data_to_shader(self.fill_data, "orientation", "orientation") self.read_data_to_shader(self.fill_data, "orientation", "orientation")

View file

@ -5,7 +5,6 @@
in vec3 point; in vec3 point;
in float orientation; in float orientation;
in vec4 color; in vec4 color;
in float vert_index;
out vec3 bp; // Bezier control point out vec3 bp; // Bezier control point
out float v_orientation; out float v_orientation;
@ -19,5 +18,6 @@ void main(){
bp = position_point_into_frame(point); bp = position_point_into_frame(point);
v_orientation = orientation; v_orientation = orientation;
v_color = color; v_color = color;
v_vert_index = vert_index; // Implicit conversion from int to float
v_vert_index = gl_VertexID;
} }