Go to the documentation of this file. 1 #ifndef MYTHRENDER_OPENGL_SHADERS_H
2 #define MYTHRENDER_OPENGL_SHADERS_H
7 "attribute vec2 a_position;\n"
8 "attribute vec4 a_color;\n"
9 "attribute vec2 a_texcoord0;\n"
10 "varying vec4 v_color;\n"
11 "varying vec2 v_texcoord0;\n"
12 "uniform mat4 u_projection;\n"
13 "uniform mat4 u_transform;\n"
15 " gl_Position = u_projection * u_transform * vec4(a_position, 0.0, 1.0);\n"
16 " v_texcoord0 = a_texcoord0;\n"
17 " v_color = a_color;\n"
21 "uniform sampler2D s_texture0;\n"
22 "varying highp vec4 v_color;\n"
23 "varying highp vec2 v_texcoord0;\n"
26 " gl_FragColor = texture2D(s_texture0, v_texcoord0) * v_color;\n"
30 "uniform sampler2D s_texture0;\n"
31 "varying highp vec4 v_color;\n"
32 "varying highp vec2 v_texcoord0;\n"
35 " gl_FragColor = (texture2D(s_texture0, v_texcoord0) * v_color * vec4(0.85882, 0.85882, 0.85882, 1.0)) + vec4(0.06274, 0.06274, 0.06274, 0.0);\n"
39 "attribute vec2 a_position;\n"
40 "attribute vec4 a_color;\n"
41 "varying vec4 v_color;\n"
42 "uniform mat4 u_projection;\n"
43 "uniform mat4 u_transform;\n"
45 " gl_Position = u_projection * u_transform * vec4(a_position, 0.0, 1.0);\n"
46 " v_color = a_color;\n"
50 "varying highp vec4 v_color;\n"
53 " gl_FragColor = v_color;\n"
57 "attribute vec2 a_position;\n"
58 "attribute vec4 a_color;\n"
59 "varying vec4 v_color;\n"
60 "varying vec2 v_position;\n"
61 "uniform mat4 u_projection;\n"
62 "uniform mat4 u_transform;\n"
64 " gl_Position = u_projection * u_transform * vec4(a_position, 0.0, 1.0);\n"
65 " v_color = a_color;\n"
66 " v_position = a_position;\n"
69 static const QString
kSDF =
70 "highp float SignedDistance(highp vec2 p, highp vec2 b, highp float r)\n"
72 " return length(max(abs(p) - b + r, 0.0)) - r;\n"
76 "varying highp vec4 v_color;\n"
77 "varying highp vec2 v_position;\n"
78 "uniform highp mat4 u_parameters;\n"
82 " highp float dist = SignedDistance(v_position - u_parameters[0].xy,\n"
83 " u_parameters[1].xy, u_parameters[0].z);\n"
84 " gl_FragColor = vec4(v_color.rgb, v_color.a * smoothstep(-1.0, 0.0, dist * -1.0));\n"
88 "varying highp vec4 v_color;\n"
89 "varying highp vec2 v_position;\n"
90 "uniform highp mat4 u_parameters;\n"
94 " highp float outer = SignedDistance(v_position - u_parameters[0].xy,\n"
95 " u_parameters[1].xy, u_parameters[0].z);\n"
96 " highp float inner = SignedDistance(v_position - u_parameters[0].xy,\n"
97 " u_parameters[1].zw, u_parameters[0].w);\n"
98 " highp float both = smoothstep(-1.0, 0.0, outer * -1.0) * smoothstep(-1.0, 0.0, inner);\n"
99 " gl_FragColor = vec4(v_color.rgb, v_color.a * both);\n"
static const QString kSimpleFragmentShader
static const QString kDrawVertexShader
static const QString kRoundedRectShader
static const QString kDefaultVertexShader
static const QString kSimpleVertexShader
static const QString kSDF
static const QString kDefaultFragmentShader
static const QString kDefaultFragmentShaderLimited
static const QString kRoundedEdgeShader