54 #ifndef QGL_ENGINE_SHADER_SOURCE_H 55 #define QGL_ENGINE_SHADER_SOURCE_H 67 void setPosition(); \n\
73 static const char* const qglslMainWithTexCoordsVertexShader = "\n\
74 attribute highp vec2 textureCoordArray; \n\
75 varying highp vec2 textureCoords; \n\
76 void setPosition(); \n\
80 textureCoords = textureCoordArray; \n\
83 static const char* const qglslMainWithTexCoordsAndOpacityVertexShader = "\n\
84 attribute highp vec2 textureCoordArray; \n\
85 attribute lowp
float opacityArray; \n\
86 varying highp vec2 textureCoords; \n\
87 varying lowp
float opacity; \n\
88 void setPosition(); \n\
92 textureCoords = textureCoordArray; \n\
93 opacity = opacityArray; \n\
96 // NOTE: We let GL do the perspective correction so texture lookups in the fragment 97 // shader are also perspective corrected. 98 static const char* const qglslPositionOnlyVertexShader = "\n\
99 attribute highp vec2 vertexCoordsArray; \n\
100 attribute highp vec3 pmvMatrix1; \n\
101 attribute highp vec3 pmvMatrix2; \n\
102 attribute highp vec3 pmvMatrix3; \n\
103 void setPosition(
void) \n\
105 highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
106 vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
107 gl_Position = vec4(transformedPos.xy, 0.0, transformedPos.z); \n\
110 static const char* const qglslComplexGeometryPositionOnlyVertexShader = "\n\
111 uniform highp mat3 matrix; \n\
112 attribute highp vec2 vertexCoordsArray; \n\
113 void setPosition(
void) \n\
115 gl_Position = vec4(matrix * vec3(vertexCoordsArray, 1), 1);\n\
118 static const char* const qglslUntransformedPositionVertexShader = "\n\
119 attribute highp vec4 vertexCoordsArray; \n\
120 void setPosition(
void) \n\
122 gl_Position = vertexCoordsArray; \n\
125 // Pattern Brush - This assumes the texture size is 8x8 and thus, the inverted size is 0.125 126 static const char* const qglslPositionWithPatternBrushVertexShader = "\n\
127 attribute highp vec2 vertexCoordsArray; \n\
128 attribute highp vec3 pmvMatrix1; \n\
129 attribute highp vec3 pmvMatrix2; \n\
130 attribute highp vec3 pmvMatrix3; \n\
131 uniform mediump vec2 halfViewportSize; \n\
132 uniform highp vec2 invertedTextureSize; \n\
133 uniform highp mat3 brushTransform; \n\
134 varying highp vec2 patternTexCoords; \n\
135 void setPosition(
void) \n\
137 highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
138 vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
139 gl_Position.xy = transformedPos.xy / transformedPos.z; \n\
140 mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\
141 mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1.0); \n\
142 mediump
float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\
143 gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\
144 patternTexCoords.xy = (hTexCoords.xy * 0.125) * invertedHTexCoordsZ; \n\
147 static const char* const qglslAffinePositionWithPatternBrushVertexShader 148 = qglslPositionWithPatternBrushVertexShader; 150 static const char* const qglslPatternBrushSrcFragmentShader = "\n\
151 uniform sampler2D brushTexture; \n\
152 uniform lowp vec4 patternColor; \n\
153 varying highp vec2 patternTexCoords;\n\
154 lowp vec4 srcPixel() \n\
156 return patternColor * (1.0 - texture2D(brushTexture, patternTexCoords).r); \n\
160 // Linear Gradient Brush 161 static const char* const qglslPositionWithLinearGradientBrushVertexShader = "\n\
162 attribute highp vec2 vertexCoordsArray; \n\
163 attribute highp vec3 pmvMatrix1; \n\
164 attribute highp vec3 pmvMatrix2; \n\
165 attribute highp vec3 pmvMatrix3; \n\
166 uniform mediump vec2 halfViewportSize; \n\
167 uniform highp vec3 linearData; \n\
168 uniform highp mat3 brushTransform; \n\
169 varying mediump
float index; \n\
170 void setPosition() \n\
172 highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
173 vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
174 gl_Position.xy = transformedPos.xy / transformedPos.z; \n\
175 mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\
176 mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\
177 mediump
float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\
178 gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\
179 index = (
dot(linearData.xy, hTexCoords.xy) * linearData.z) * invertedHTexCoordsZ; \n\
182 static const char* const qglslAffinePositionWithLinearGradientBrushVertexShader 183 = qglslPositionWithLinearGradientBrushVertexShader; 185 static const char* const qglslLinearGradientBrushSrcFragmentShader = "\n\
186 uniform sampler2D brushTexture; \n\
187 varying mediump
float index; \n\
188 lowp vec4 srcPixel() \n\
190 mediump vec2 val = vec2(
index, 0.5); \n\
191 return texture2D(brushTexture, val); \n\
195 // Conical Gradient Brush 196 static const char* const qglslPositionWithConicalGradientBrushVertexShader = "\n\
197 attribute highp vec2 vertexCoordsArray; \n\
198 attribute highp vec3 pmvMatrix1; \n\
199 attribute highp vec3 pmvMatrix2; \n\
200 attribute highp vec3 pmvMatrix3; \n\
201 uniform mediump vec2 halfViewportSize; \n\
202 uniform highp mat3 brushTransform; \n\
203 varying highp vec2
A; \n\
204 void setPosition(
void) \n\
206 highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
207 vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
208 gl_Position.xy = transformedPos.xy / transformedPos.z; \n\
209 mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\
210 mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\
211 mediump
float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\
212 gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\
213 A = hTexCoords.xy * invertedHTexCoordsZ; \n\
216 static const char* const qglslAffinePositionWithConicalGradientBrushVertexShader 217 = qglslPositionWithConicalGradientBrushVertexShader; 219 static const char* const qglslConicalGradientBrushSrcFragmentShader = "\n\
220 #define INVERSE_2PI 0.1591549430918953358 \n\ 221 uniform sampler2D brushTexture; \n\ 222 uniform mediump float angle; \n\ 223 varying highp vec2 A; \n\ 224 lowp vec4 srcPixel() \n\ 227 if (abs(A.y) == abs(A.x)) \n\ 228 t = (atan(-A.y + 0.002, A.x) + angle) * INVERSE_2PI; \n\ 230 t = (atan(-A.y, A.x) + angle) * INVERSE_2PI; \n\ 231 return texture2D(brushTexture, vec2(t - floor(t), 0.5)); \n\ 237 attribute highp vec2 vertexCoordsArray;\n\ 238 attribute highp vec3 pmvMatrix1; \n\ 239 attribute highp vec3 pmvMatrix2; \n\ 240 attribute highp vec3 pmvMatrix3; \n\ 241 uniform mediump vec2 halfViewportSize; \n\ 242 uniform highp mat3 brushTransform; \n\ 243 uniform highp vec2 fmp; \n\ 244 uniform highp vec3 bradius; \n\ 245 varying highp float b; \n\ 246 varying highp vec2 A; \n\ 247 void setPosition(void) \n\ 249 highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\ 250 vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\ 251 gl_Position.xy = transformedPos.xy / transformedPos.z; \n\ 252 mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\ 253 mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\ 254 mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\ 255 gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\ 256 A = hTexCoords.xy * invertedHTexCoordsZ; \n\ 257 b = bradius.x + 2.0 * dot(A, fmp); \n\ 264 uniform sampler2D brushTexture; \n\ 265 uniform highp float fmp2_m_radius2; \n\ 266 uniform highp float inverse_2_fmp2_m_radius2; \n\ 267 uniform highp float sqrfr; \n\ 268 varying highp float b; \n\ 269 varying highp vec2 A; \n\ 270 uniform highp vec3 bradius; \n\ 271 lowp vec4 srcPixel() \n\ 273 highp float c = sqrfr-dot(A, A); \n\ 274 highp float det = b*b - 4.0*fmp2_m_radius2*c; \n\ 275 lowp vec4 result = vec4(0.0); \n\ 276 if (det >= 0.0) { \n\ 277 highp float detSqrt = sqrt(det); \n\ 278 highp float w = max((-b - detSqrt) * inverse_2_fmp2_m_radius2, (-b + detSqrt) * inverse_2_fmp2_m_radius2); \n\ 279 if (bradius.y + w * bradius.z >= 0.0) \n\ 280 result = texture2D(brushTexture, vec2(w, 0.5)); \n\ 288 attribute highp vec2 vertexCoordsArray; \n\ 289 attribute highp vec3 pmvMatrix1; \n\ 290 attribute highp vec3 pmvMatrix2; \n\ 291 attribute highp vec3 pmvMatrix3; \n\ 292 uniform mediump vec2 halfViewportSize; \n\ 293 uniform highp vec2 invertedTextureSize; \n\ 294 uniform highp mat3 brushTransform; \n\ 295 varying highp vec2 brushTextureCoords; \n\ 296 void setPosition(void) \n\ 298 highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\ 299 vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\ 300 gl_Position.xy = transformedPos.xy / transformedPos.z; \n\ 301 mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\ 302 mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\ 303 mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\ 304 gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\ 305 brushTextureCoords.xy = (hTexCoords.xy * invertedTextureSize) * gl_Position.w; \n\ 311 #if defined(QT_OPENGL_ES_2) 316 varying highp vec2 brushTextureCoords; \n\ 317 uniform sampler2D brushTexture; \n\ 318 lowp vec4 srcPixel() { \n\ 319 return texture2D(brushTexture, fract(brushTextureCoords)); \n\ 323 varying highp vec2 brushTextureCoords; \n\ 324 uniform sampler2D brushTexture; \n\ 325 lowp vec4 srcPixel() \n\ 327 return texture2D(brushTexture, brushTextureCoords); \n\ 332 varying highp vec2 brushTextureCoords; \n\ 333 uniform lowp vec4 patternColor; \n\ 334 uniform sampler2D brushTexture; \n\ 335 lowp vec4 srcPixel() \n\ 337 return patternColor * (1.0 - texture2D(brushTexture, brushTextureCoords).r); \n\ 342 uniform lowp vec4 fragmentColor; \n\ 343 lowp vec4 srcPixel() \n\ 345 return fragmentColor; \n\ 349 varying highp vec2 textureCoords; \n\ 350 uniform sampler2D imageTexture; \n\ 351 lowp vec4 srcPixel() \n\ 353 "return texture2D(imageTexture, textureCoords); \n" 357 varying highp vec2 textureCoords; \n\ 358 uniform sampler2D imageTexture; \n\ 359 lowp vec4 srcPixel() \n\ 361 return customShader(imageTexture, textureCoords); \n\ 365 varying highp vec2 textureCoords; \n\ 366 uniform lowp vec4 patternColor; \n\ 367 uniform sampler2D imageTexture; \n\ 368 lowp vec4 srcPixel() \n\ 370 return patternColor * (1.0 - texture2D(imageTexture, textureCoords).r); \n\ 374 varying highp vec2 textureCoords; \n\ 375 uniform sampler2D imageTexture; \n\ 376 lowp vec4 srcPixel() \n\ 378 lowp vec4 sample = texture2D(imageTexture, textureCoords); \n\ 379 sample.rgb = sample.rgb * sample.a; \n\ 384 lowp vec4 srcPixel() \n\ 386 return vec4(0.98, 0.06, 0.75, 1.0); \n\ 390 varying lowp float opacity; \n\ 391 lowp vec4 srcPixel(); \n\ 394 gl_FragColor = srcPixel() * opacity; \n\ 398 uniform lowp float globalOpacity; \n\ 399 lowp vec4 srcPixel(); \n\ 400 lowp vec4 applyMask(lowp vec4); \n\ 401 lowp vec4 compose(lowp vec4); \n\ 404 gl_FragColor = applyMask(compose(srcPixel()*globalOpacity))); \n\ 408 lowp vec4 srcPixel(); \n\ 409 lowp vec4 applyMask(lowp vec4); \n\ 410 lowp vec4 compose(lowp vec4); \n\ 413 gl_FragColor = applyMask(compose(srcPixel())); \n\ 417 uniform lowp float globalOpacity; \n\ 418 lowp vec4 srcPixel(); \n\ 419 lowp vec4 applyMask(lowp vec4); \n\ 422 gl_FragColor = applyMask(srcPixel()*globalOpacity); \n\ 426 lowp vec4 srcPixel(); \n\ 427 lowp vec4 applyMask(lowp vec4); \n\ 430 gl_FragColor = applyMask(srcPixel()); \n\ 434 uniform lowp float globalOpacity; \n\ 435 lowp vec4 srcPixel(); \n\ 436 lowp vec4 compose(lowp vec4); \n\ 439 gl_FragColor = compose(srcPixel()*globalOpacity); \n\ 443 lowp vec4 srcPixel(); \n\ 444 lowp vec4 compose(lowp vec4); \n\ 447 gl_FragColor = compose(srcPixel()); \n\ 451 uniform lowp float globalOpacity; \n\ 452 lowp vec4 srcPixel(); \n\ 455 gl_FragColor = srcPixel()*globalOpacity; \n\ 459 lowp vec4 srcPixel(); \n\ 462 gl_FragColor = srcPixel(); \n\ 466 varying highp vec2 textureCoords;\n\ 467 uniform sampler2D maskTexture;\n\ 468 lowp vec4 applyMask(lowp vec4 src) \n\ 470 lowp vec4 mask = texture2D(maskTexture, textureCoords); \n\ 471 return src * mask.a; \n\ 490 varying highp vec2 textureCoords;\n\ 491 uniform sampler2D maskTexture;\n\ 492 lowp vec4 applyMask(lowp vec4 src) \n\ 494 lowp vec4 mask = texture2D(maskTexture, textureCoords); \n\ 495 return src.a * mask; \n\ 499 varying highp vec2 textureCoords;\n\ 500 uniform sampler2D maskTexture;\n\ 501 lowp vec4 applyMask(lowp vec4 src) \n\ 503 lowp vec4 mask = texture2D(maskTexture, textureCoords); \n\ 504 return src * mask; \n\ 529 #endif // GLGC_SHADER_SOURCE_H static const char *const qglslAffinePositionWithTextureBrushVertexShader
static const char *const qglslPositionWithRadialGradientBrushVertexShader
#define QT_END_NAMESPACE
This macro expands to.
static const char *const qglslCustomSrcFragmentShader
static const char *const qglslNonPremultipliedImageSrcFragmentShader
static const char *const qglslMainFragmentShader
int main(int argc, char **argv)
static const char *const qglslRgbMaskFragmentShaderPass2
static const char *const qglslRgbMaskFragmentShaderPass1
static const char *const qglslSolidBrushSrcFragmentShader
static const char *const qglslMainFragmentShader_O
#define QT_BEGIN_NAMESPACE
This macro expands to.
static const char *const qglslShockingPinkSrcFragmentShader
static const char *const qglslPositionWithTextureBrushVertexShader
static const char *const qglslMainFragmentShader_C
static const char *const qglslMainFragmentShader_CM
static const char *const qglslTextureBrushSrcWithPatternFragmentShader
static const char *const qglslMainFragmentShader_ImageArrays
static const char *const qglslMainFragmentShader_CO
static const char *const qglslRadialGradientBrushSrcFragmentShader
static const char *const qglslMainFragmentShader_M
static const char *const qglslAffinePositionWithRadialGradientBrushVertexShader
static const char *const qglslMaskFragmentShader
static const char *const qglslImageSrcFragmentShader
static const char *const qglslMainFragmentShader_MO
static qreal dot(const QPointF &a, const QPointF &b)
static const char *const qglslImageSrcWithPatternFragmentShader
static const char *const qglslMainVertexShader
static const char *const qglslTextureBrushSrcFragmentShader
static const char *const qglslMainFragmentShader_CMO