shaders.go 9.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // auto-generated
  2. // Code generated by '$ fyne bundle'. DO NOT EDIT.
  3. package gl
  4. import "fyne.io/fyne/v2"
  5. var shaderLineFrag = &fyne.StaticResource{
  6. StaticName: "line.frag",
  7. StaticContent: []byte(
  8. "#version 110\n\nuniform vec4 color;\nuniform float lineWidth;\nuniform float feather;\n\nvarying vec2 delta;\n\nvoid main() {\n float alpha = color.a;\n float distance = length(delta);\n\n if (feather == 0.0 || distance <= lineWidth - feather) {\n gl_FragColor = color;\n } else {\n gl_FragColor = vec4(color.r, color.g, color.b, mix(color.a, 0.0, (distance - (lineWidth - feather)) / feather));\n }\n}\n"),
  9. }
  10. var shaderLineVert = &fyne.StaticResource{
  11. StaticName: "line.vert",
  12. StaticContent: []byte(
  13. "#version 110\n\nattribute vec2 vert;\nattribute vec2 normal;\n \nuniform float lineWidth;\n\nvarying vec2 delta;\n\nvoid main() {\n delta = normal * lineWidth;\n\n gl_Position = vec4(vert + delta, 0, 1);\n}\n"),
  14. }
  15. var shaderLineesFrag = &fyne.StaticResource{
  16. StaticName: "line_es.frag",
  17. StaticContent: []byte(
  18. "#version 100\n\n#ifdef GL_ES\n# ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n# else\nprecision mediump float;\n#endif\nprecision mediump int;\nprecision lowp sampler2D;\n#endif\n\nuniform vec4 color;\nuniform float lineWidth;\nuniform float feather;\n\nvarying vec2 delta;\n\nvoid main() {\n float alpha = color.a;\n float distance = length(delta);\n\n if (feather == 0.0 || distance <= lineWidth - feather) {\n gl_FragColor = color;\n } else {\n gl_FragColor = vec4(color.r, color.g, color.b, mix(color.a, 0.0, (distance - (lineWidth - feather)) / feather));\n }\n}\n"),
  19. }
  20. var shaderLineesVert = &fyne.StaticResource{
  21. StaticName: "line_es.vert",
  22. StaticContent: []byte(
  23. "#version 100\n\n#ifdef GL_ES\n# ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n# else\nprecision mediump float;\n#endif\nprecision mediump int;\nprecision lowp sampler2D;\n#endif\n\nattribute vec2 vert;\nattribute vec2 normal;\n \nuniform float lineWidth;\n\nvarying vec2 delta;\n\nvoid main() {\n delta = normal * lineWidth;\n\n gl_Position = vec4(vert + delta, 0, 1);\n}\n"),
  24. }
  25. var shaderRectangleFrag = &fyne.StaticResource{
  26. StaticName: "rectangle.frag",
  27. StaticContent: []byte(
  28. "#version 110\n\n/* scaled params */\nuniform vec2 frame_size;\nuniform vec4 rect_coords; //x1 [0], x2 [1], y1 [2], y2 [3]; coords of the rect_frame\nuniform float stroke_width;\n/* colors params*/\nuniform vec4 fill_color;\nuniform vec4 stroke_color;\n\n\nvoid main() {\n\n vec4 color = fill_color;\n \n if (gl_FragCoord.x >= rect_coords[1] - stroke_width ){\n color = stroke_color;\n } else if (gl_FragCoord.x <= rect_coords[0] + stroke_width){\n color = stroke_color;\n } else if (gl_FragCoord.y <= frame_size.y - rect_coords[3] + stroke_width ){\n color = stroke_color;\n } else if (gl_FragCoord.y >= frame_size.y - rect_coords[2] - stroke_width ){\n color = stroke_color;\n }\n\n gl_FragColor = color;\n}\n"),
  29. }
  30. var shaderRectangleVert = &fyne.StaticResource{
  31. StaticName: "rectangle.vert",
  32. StaticContent: []byte(
  33. "#version 110\n\nattribute vec2 vert;\nattribute vec2 normal;\n\nvoid main() {\n gl_Position = vec4(vert+normal, 0, 1);\n}\n"),
  34. }
  35. var shaderRectangleesFrag = &fyne.StaticResource{
  36. StaticName: "rectangle_es.frag",
  37. StaticContent: []byte(
  38. "#version 100\n\n#ifdef GL_ES\n# ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n# else\nprecision mediump float;\n#endif\nprecision mediump int;\nprecision lowp sampler2D;\n#endif\n\n/* scaled params */\nuniform vec2 frame_size;\nuniform vec4 rect_coords; //x1 [0], x2 [1], y1 [2], y2 [3]; coords of the rect_frame\nuniform float stroke_width;\n/* colors params*/\nuniform vec4 fill_color;\nuniform vec4 stroke_color;\n\n\nvoid main() {\n\n vec4 color = fill_color;\n \n if (gl_FragCoord.x >= rect_coords[1] - stroke_width ){\n color = stroke_color;\n } else if (gl_FragCoord.x <= rect_coords[0] + stroke_width){\n color = stroke_color;\n } else if (gl_FragCoord.y <= frame_size.y - rect_coords[3] + stroke_width ){\n color = stroke_color;\n } else if (gl_FragCoord.y >= frame_size.y - rect_coords[2] - stroke_width ){\n color = stroke_color;\n }\n\n gl_FragColor = color;\n}\n"),
  39. }
  40. var shaderRectangleesVert = &fyne.StaticResource{
  41. StaticName: "rectangle_es.vert",
  42. StaticContent: []byte(
  43. "#version 100\n\n#ifdef GL_ES\n# ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n# else\nprecision mediump float;\n#endif\nprecision mediump int;\nprecision lowp sampler2D;\n#endif\n\nattribute vec2 vert;\nattribute vec2 normal;\n\nvoid main() {\n gl_Position = vec4(vert+normal, 0, 1);\n}\n"),
  44. }
  45. var shaderRoundrectangleFrag = &fyne.StaticResource{
  46. StaticName: "round_rectangle.frag",
  47. StaticContent: []byte(
  48. "#version 110\n\n/* scaled params */\nuniform vec2 frame_size;\nuniform vec4 rect_coords; //x1 [0], x2 [1], y1 [2], y2 [3]; coords of the rect_frame\nuniform float stroke_width_half;\nuniform vec2 rect_size_half;\nuniform float radius;\n/* colors params*/\nuniform vec4 fill_color;\nuniform vec4 stroke_color;\n\nfloat calc_distance(vec2 p, vec2 b, float r)\n{\n vec2 d = abs(p) - b + vec2(r);\n\treturn min(max(d.x, d.y), 0.0) + length(max(d, 0.0)) - r; \n}\n\nvoid main() {\n\n vec4 frag_rect_coords = vec4(rect_coords[0], rect_coords[1], frame_size.y - rect_coords[3], frame_size.y - rect_coords[2]);\n vec2 vec_centered_pos = (gl_FragCoord.xy - vec2(frag_rect_coords[0] + frag_rect_coords[1], frag_rect_coords[2] + frag_rect_coords[3]) * 0.5);\n\n float distance = calc_distance(vec_centered_pos, rect_size_half, radius - stroke_width_half);\n\n vec4 from_color = stroke_color; //Always the border color. If no border, this still should be set\n vec4 to_color = stroke_color; //Outside color\n\n if (stroke_width_half == 0.0)\n {\n from_color = fill_color;\n to_color = fill_color;\n }\n to_color[3] = 0.0; // blend the fill colour to alpha\n\n if (distance < 0.0)\n {\n to_color = fill_color;\n } \n\n distance = abs(distance) - stroke_width_half;\n\n float blend_amount = smoothstep(-1.0, 1.0, distance);\n\n // final color\n gl_FragColor = mix(from_color, to_color, blend_amount);\n}\n"),
  49. }
  50. var shaderRoundrectangleesFrag = &fyne.StaticResource{
  51. StaticName: "round_rectangle_es.frag",
  52. StaticContent: []byte(
  53. "#version 100\n\n#ifdef GL_ES\n# ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n# else\nprecision mediump float;\n#endif\nprecision mediump int;\nprecision lowp sampler2D;\n#endif\n\n/* scaled params */\nuniform vec2 frame_size;\nuniform vec4 rect_coords; //x1 [0], x2 [1], y1 [2], y2 [3]; coords of the rect_frame\nuniform float stroke_width_half;\nuniform vec2 rect_size_half;\nuniform float radius;\n/* colors params*/\nuniform vec4 fill_color;\nuniform vec4 stroke_color;\n\nfloat calc_distance(vec2 p, vec2 b, float r)\n{\n vec2 d = abs(p) - b + vec2(r);\n\treturn min(max(d.x, d.y), 0.0) + length(max(d, 0.0)) - r; \n}\n\nvoid main() {\n\n vec4 frag_rect_coords = vec4(rect_coords[0], rect_coords[1], frame_size.y - rect_coords[3], frame_size.y - rect_coords[2]);\n vec2 vec_centered_pos = (gl_FragCoord.xy - vec2(frag_rect_coords[0] + frag_rect_coords[1], frag_rect_coords[2] + frag_rect_coords[3]) * 0.5);\n\n float distance = calc_distance(vec_centered_pos, rect_size_half, radius - stroke_width_half);\n\n vec4 from_color = stroke_color; //Always the border color. If no border, this still should be set\n vec4 to_color = stroke_color; //Outside color\n\n if (stroke_width_half == 0.0)\n {\n from_color = fill_color;\n to_color = fill_color;\n }\n to_color[3] = 0.0; // blend the fill colour to alpha\n\n if (distance < 0.0)\n {\n to_color = fill_color;\n } \n\n distance = abs(distance) - stroke_width_half;\n\n float blend_amount = smoothstep(-1.0, 1.0, distance);\n\n // final color\n gl_FragColor = mix(from_color, to_color, blend_amount);\n}\n"),
  54. }
  55. var shaderSimpleFrag = &fyne.StaticResource{
  56. StaticName: "simple.frag",
  57. StaticContent: []byte(
  58. "#version 110\n\nuniform sampler2D tex;\n\nvarying vec2 fragTexCoord;\n\nvoid main() {\n gl_FragColor = texture2D(tex, fragTexCoord);\n}\n"),
  59. }
  60. var shaderSimpleVert = &fyne.StaticResource{
  61. StaticName: "simple.vert",
  62. StaticContent: []byte(
  63. "#version 110\n\nattribute vec3 vert;\nattribute vec2 vertTexCoord;\nvarying vec2 fragTexCoord;\n\nvoid main() {\n fragTexCoord = vertTexCoord;\n\n gl_Position = vec4(vert, 1);\n}"),
  64. }
  65. var shaderSimpleesFrag = &fyne.StaticResource{
  66. StaticName: "simple_es.frag",
  67. StaticContent: []byte(
  68. "#version 100\n\n#ifdef GL_ES\n# ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n# else\nprecision mediump float;\n#endif\nprecision mediump int;\nprecision lowp sampler2D;\n#endif\n\nuniform sampler2D tex;\n\nvarying vec2 fragTexCoord;\n\nvoid main() {\n gl_FragColor = texture2D(tex, fragTexCoord);\n}\n"),
  69. }
  70. var shaderSimpleesVert = &fyne.StaticResource{
  71. StaticName: "simple_es.vert",
  72. StaticContent: []byte(
  73. "#version 100\n\n#ifdef GL_ES\n# ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n# else\nprecision mediump float;\n#endif\nprecision mediump int;\nprecision lowp sampler2D;\n#endif\n\nattribute vec3 vert;\nattribute vec2 vertTexCoord;\nvarying vec2 fragTexCoord;\n\nvoid main() {\n fragTexCoord = vertTexCoord;\n\n gl_Position = vec4(vert, 1);\n}"),
  74. }