mirror of
https://github.com/3b1b/manim.git
synced 2025-04-13 09:47:07 +00:00
Remove use of gl_VertexID
This commit is contained in:
parent
9eda000a97
commit
f0bf50eb7f
8 changed files with 2 additions and 23 deletions
|
@ -1274,7 +1274,7 @@ class VMobject(Mobject):
|
||||||
# Do we want this elsewhere? Say whenever points are refreshed or something?
|
# Do we want this elsewhere? Say whenever points are refreshed or something?
|
||||||
self.get_joint_angles()
|
self.get_joint_angles()
|
||||||
self.data["base_normal"][0::2] = self.data["point"][0]
|
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]):
|
class VGroup(Group, VMobject, Generic[SubVmobjectType]):
|
||||||
|
|
|
@ -225,7 +225,7 @@ class VShaderWrapper(ShaderWrapper):
|
||||||
mobject_uniforms: Optional[UniformDict] = None, # A dictionary mapping names of uniform variables
|
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.
|
texture_paths: Optional[dict[str, str]] = None, # A dictionary mapping names to filepaths for textures.
|
||||||
depth_test: bool = False,
|
depth_test: bool = False,
|
||||||
render_primitive: int = moderngl.TRIANGLE_STRIP,
|
render_primitive: int = moderngl.TRIANGLES,
|
||||||
code_replacements: dict[str, str] = dict(),
|
code_replacements: dict[str, str] = dict(),
|
||||||
stroke_behind: bool = False,
|
stroke_behind: bool = False,
|
||||||
):
|
):
|
||||||
|
|
|
@ -5,7 +5,6 @@ layout (triangle_strip, max_vertices = 6) out;
|
||||||
|
|
||||||
in vec3 verts[3];
|
in vec3 verts[3];
|
||||||
in vec3 v_base_point[3];
|
in vec3 v_base_point[3];
|
||||||
in int v_vert_index[3];
|
|
||||||
|
|
||||||
out float depth;
|
out float depth;
|
||||||
|
|
||||||
|
@ -22,10 +21,6 @@ void emit_triangle(vec3 points[3]){
|
||||||
|
|
||||||
|
|
||||||
void main(){
|
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
|
// Curves are marked as ended when the handle after
|
||||||
// the first anchor is set equal to that anchor
|
// the first anchor is set equal to that anchor
|
||||||
if (verts[0] == verts[1]) return;
|
if (verts[0] == verts[1]) return;
|
||||||
|
|
|
@ -5,10 +5,8 @@ in vec3 base_normal;
|
||||||
|
|
||||||
out vec3 verts;
|
out vec3 verts;
|
||||||
out vec3 v_base_point;
|
out vec3 v_base_point;
|
||||||
out int v_vert_index;
|
|
||||||
|
|
||||||
void main(){
|
void main(){
|
||||||
verts = point;
|
verts = point;
|
||||||
v_base_point = base_normal;
|
v_base_point = base_normal;
|
||||||
v_vert_index = gl_VertexID;
|
|
||||||
}
|
}
|
|
@ -6,7 +6,6 @@ layout (triangle_strip, max_vertices = 6) out;
|
||||||
in vec3 verts[3];
|
in vec3 verts[3];
|
||||||
in vec4 v_color[3];
|
in vec4 v_color[3];
|
||||||
in vec3 v_base_normal[3];
|
in vec3 v_base_normal[3];
|
||||||
in int v_vert_index[3];
|
|
||||||
|
|
||||||
out vec4 color;
|
out vec4 color;
|
||||||
out float fill_all;
|
out float fill_all;
|
||||||
|
@ -44,10 +43,6 @@ void emit_triangle(vec3 points[3], vec4 v_color[3], vec3 unit_normal){
|
||||||
|
|
||||||
|
|
||||||
void main(){
|
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
|
// Curves are marked as ended when the handle after
|
||||||
// the first anchor is set equal to that anchor
|
// the first anchor is set equal to that anchor
|
||||||
if (verts[0] == verts[1]) return;
|
if (verts[0] == verts[1]) return;
|
||||||
|
|
|
@ -7,11 +7,9 @@ in vec3 base_normal;
|
||||||
out vec3 verts; // Bezier control point
|
out vec3 verts; // Bezier control point
|
||||||
out vec4 v_color;
|
out vec4 v_color;
|
||||||
out vec3 v_base_normal;
|
out vec3 v_base_normal;
|
||||||
out int v_vert_index;
|
|
||||||
|
|
||||||
void main(){
|
void main(){
|
||||||
verts = point;
|
verts = point;
|
||||||
v_color = fill_rgba;
|
v_color = fill_rgba;
|
||||||
v_base_normal = base_normal;
|
v_base_normal = base_normal;
|
||||||
v_vert_index = gl_VertexID;
|
|
||||||
}
|
}
|
|
@ -15,7 +15,6 @@ in float v_joint_angle[3];
|
||||||
in float v_stroke_width[3];
|
in float v_stroke_width[3];
|
||||||
in vec4 v_color[3];
|
in vec4 v_color[3];
|
||||||
in vec3 v_unit_normal[3];
|
in vec3 v_unit_normal[3];
|
||||||
in int v_vert_index[3];
|
|
||||||
|
|
||||||
out vec4 color;
|
out vec4 color;
|
||||||
out float dist_to_aaw;
|
out float dist_to_aaw;
|
||||||
|
@ -156,10 +155,6 @@ void emit_point_with_width(
|
||||||
|
|
||||||
|
|
||||||
void main() {
|
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
|
// Curves are marked as ended when the handle after
|
||||||
// the first anchor is set equal to that anchor
|
// the first anchor is set equal to that anchor
|
||||||
if (verts[0] == verts[1]) return;
|
if (verts[0] == verts[1]) return;
|
||||||
|
|
|
@ -16,7 +16,6 @@ out vec4 v_color;
|
||||||
out float v_stroke_width;
|
out float v_stroke_width;
|
||||||
out float v_joint_angle;
|
out float v_joint_angle;
|
||||||
out vec3 v_unit_normal;
|
out vec3 v_unit_normal;
|
||||||
out int v_vert_index;
|
|
||||||
|
|
||||||
const float STROKE_WIDTH_CONVERSION = 0.01;
|
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_stroke_width = STROKE_WIDTH_CONVERSION * stroke_width * mix(frame_scale, 1, is_fixed_in_frame);
|
||||||
v_joint_angle = joint_angle;
|
v_joint_angle = joint_angle;
|
||||||
v_unit_normal = unit_normal;
|
v_unit_normal = unit_normal;
|
||||||
v_vert_index = gl_VertexID;
|
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue