Stop pretending to support non-winding fill in the fill shader.

Possibly, if we want to reintroduce it later on, it should have its own dedicated shader, and maybe a distinct Mobject type too
This commit is contained in:
Grant Sanderson 2024-08-19 14:37:11 -05:00
parent 09d147c8ef
commit 195264f079
3 changed files with 16 additions and 43 deletions

View file

@ -372,13 +372,6 @@ class VShaderWrapper(ShaderWrapper):
if self.fill_vao is None:
return
# TODO, need a new test here...or to just kill non-winding fill?
winding = True
self.fill_program['winding'].value = winding
if not winding:
self.fill_vao.render()
return
original_fbo = self.ctx.fbo
texture_fbo, depth_texture_fbo, texture_vao = self.fill_canvas

View file

@ -29,17 +29,15 @@ void main() {
cap is to make sure the original fragment color can be recovered even after
blending with an (alpha = 1) color.
*/
if(winding){
float a = 0.95 * frag_color.a;
if(orientation < 0) a = -a / (1 - a);
frag_color.a = a;
}
float a = 0.95 * frag_color.a;
if(orientation < 0) a = -a / (1 - a);
frag_color.a = a;
if (bool(fill_all)) return;
float x = uv_coords.x;
float y = uv_coords.y;
float Fxy = (y - x * x);
if(!winding && orientation < 0) Fxy *= -1;
// if(!winding && orientation < 0) Fxy *= -1;
if(Fxy < 0) discard;
}

View file

@ -3,8 +3,6 @@
layout (triangles) in;
layout (triangle_strip, max_vertices = 6) out;
uniform bool winding;
in vec3 verts[3];
in vec4 v_color[3];
in vec3 v_base_point[3];
@ -48,14 +46,6 @@ void emit_triangle(vec3 points[3], vec4 v_color[3]){
}
void emit_simple_triangle(){
emit_triangle(
vec3[3](verts[0], verts[1], verts[2]),
vec4[3](v_color[0], v_color[1], v_color[2])
);
}
void main(){
// Vector graphic shaders use TRIANGLE_STRIP, but only
// every other one needs to be rendered
@ -68,25 +58,17 @@ void main(){
// Check zero fill
if (vec3(v_color[0].a, v_color[1].a, v_color[2].a) == vec3(0.0, 0.0, 0.0)) return;
if(winding){
// Emit main triangle
fill_all = 1.0;
emit_triangle(
vec3[3](v_base_point[0], verts[0], verts[2]),
vec4[3](v_color[1], v_color[0], v_color[2])
);
// Edge triangle
fill_all = 0.0;
emit_simple_triangle();
}else{
// In this case, one should fill all if the vertices are
// not in sequential order
fill_all = float(
(v_vert_index[1] - v_vert_index[0]) != 1.0 ||
(v_vert_index[2] - v_vert_index[1]) != 1.0
);
emit_simple_triangle();
}
// Emit main triangle
fill_all = 1.0;
emit_triangle(
vec3[3](v_base_point[0], verts[0], verts[2]),
vec4[3](v_color[1], v_color[0], v_color[2])
);
// Edge triangle
fill_all = 0.0;
emit_triangle(
vec3[3](verts[0], verts[1], verts[2]),
vec4[3](v_color[0], v_color[1], v_color[2])
);
}