Remove use of gl_VertexID

This commit is contained in:
Grant Sanderson 2024-09-28 09:54:28 -05:00
parent 9eda000a97
commit f0bf50eb7f
8 changed files with 2 additions and 23 deletions

View file

@ -1274,7 +1274,7 @@ class VMobject(Mobject):
# Do we want this elsewhere? Say whenever points are refreshed or something?
self.get_joint_angles()
self.data["base_normal"][0::2] = self.data["point"][0]
return [self.data, self.data[-1:]]
return [self.data[self.get_outer_vert_indices()]]
class VGroup(Group, VMobject, Generic[SubVmobjectType]):

View file

@ -225,7 +225,7 @@ class VShaderWrapper(ShaderWrapper):
mobject_uniforms: Optional[UniformDict] = None, # A dictionary mapping names of uniform variables
texture_paths: Optional[dict[str, str]] = None, # A dictionary mapping names to filepaths for textures.
depth_test: bool = False,
render_primitive: int = moderngl.TRIANGLE_STRIP,
render_primitive: int = moderngl.TRIANGLES,
code_replacements: dict[str, str] = dict(),
stroke_behind: bool = False,
):

View file

@ -5,7 +5,6 @@ layout (triangle_strip, max_vertices = 6) out;
in vec3 verts[3];
in vec3 v_base_point[3];
in int v_vert_index[3];
out float depth;
@ -22,10 +21,6 @@ void emit_triangle(vec3 points[3]){
void main(){
// Vector graphic shaders use TRIANGLE_STRIP, but only
// every other one needs to be rendered
if (v_vert_index[0] % 2 != 0) return;
// Curves are marked as ended when the handle after
// the first anchor is set equal to that anchor
if (verts[0] == verts[1]) return;

View file

@ -5,10 +5,8 @@ in vec3 base_normal;
out vec3 verts;
out vec3 v_base_point;
out int v_vert_index;
void main(){
verts = point;
v_base_point = base_normal;
v_vert_index = gl_VertexID;
}

View file

@ -6,7 +6,6 @@ layout (triangle_strip, max_vertices = 6) out;
in vec3 verts[3];
in vec4 v_color[3];
in vec3 v_base_normal[3];
in int v_vert_index[3];
out vec4 color;
out float fill_all;
@ -44,10 +43,6 @@ void emit_triangle(vec3 points[3], vec4 v_color[3], vec3 unit_normal){
void main(){
// Vector graphic shaders use TRIANGLE_STRIP, but only
// every other one needs to be rendered
if (v_vert_index[0] % 2 != 0) return;
// Curves are marked as ended when the handle after
// the first anchor is set equal to that anchor
if (verts[0] == verts[1]) return;

View file

@ -7,11 +7,9 @@ in vec3 base_normal;
out vec3 verts; // Bezier control point
out vec4 v_color;
out vec3 v_base_normal;
out int v_vert_index;
void main(){
verts = point;
v_color = fill_rgba;
v_base_normal = base_normal;
v_vert_index = gl_VertexID;
}

View file

@ -15,7 +15,6 @@ in float v_joint_angle[3];
in float v_stroke_width[3];
in vec4 v_color[3];
in vec3 v_unit_normal[3];
in int v_vert_index[3];
out vec4 color;
out float dist_to_aaw;
@ -156,10 +155,6 @@ void emit_point_with_width(
void main() {
// Vector graphic shaders use TRIANGLE_STRIP, but only
// every other one needs to be rendered
if (v_vert_index[0] % 2 != 0) return;
// Curves are marked as ended when the handle after
// the first anchor is set equal to that anchor
if (verts[0] == verts[1]) return;

View file

@ -16,7 +16,6 @@ out vec4 v_color;
out float v_stroke_width;
out float v_joint_angle;
out vec3 v_unit_normal;
out int v_vert_index;
const float STROKE_WIDTH_CONVERSION = 0.01;
@ -26,5 +25,4 @@ void main(){
v_stroke_width = STROKE_WIDTH_CONVERSION * stroke_width * mix(frame_scale, 1, is_fixed_in_frame);
v_joint_angle = joint_angle;
v_unit_normal = unit_normal;
v_vert_index = gl_VertexID;
}