16#ifndef QOPENGL_ENGINE_SHADER_SOURCE_H
17#define QOPENGL_ENGINE_SHADER_SOURCE_H
25 void setPosition(); \n\
32 attribute highp vec2 textureCoordArray; \n\
33 varying highp vec2 textureCoords; \n\
34 void setPosition(); \n\
38 textureCoords = textureCoordArray; \n\
42 attribute highp vec2 textureCoordArray; \n\
43 attribute lowp float opacityArray; \n\
44 varying highp vec2 textureCoords; \n\
45 varying lowp float opacity; \n\
46 void setPosition(); \n\
50 textureCoords = textureCoordArray; \n\
51 opacity = opacityArray; \n\
57 attribute highp vec2 vertexCoordsArray; \n\
58 attribute highp vec3 pmvMatrix1; \n\
59 attribute highp vec3 pmvMatrix2; \n\
60 attribute highp vec3 pmvMatrix3; \n\
61 void setPosition(void) \n\
63 highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
64 vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
65 gl_Position = vec4(transformedPos.xy, 0.0, transformedPos.z); \n\
69 uniform highp mat3 matrix; \n\
70 attribute highp vec2 vertexCoordsArray; \n\
71 void setPosition(void) \n\
73 gl_Position = vec4(matrix * vec3(vertexCoordsArray, 1), 1);\n\
77 attribute highp vec4 vertexCoordsArray; \n\
78 void setPosition(void) \n\
80 gl_Position = vertexCoordsArray; \n\
85 attribute highp vec2 vertexCoordsArray; \n\
86 attribute highp vec3 pmvMatrix1; \n\
87 attribute highp vec3 pmvMatrix2; \n\
88 attribute highp vec3 pmvMatrix3; \n\
89 uniform mediump vec2 halfViewportSize; \n\
90 uniform highp vec2 invertedTextureSize; \n\
91 uniform highp mat3 brushTransform; \n\
92 varying highp vec2 patternTexCoords; \n\
93 void setPosition(void) \n\
95 highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
96 vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
97 gl_Position.xy = transformedPos.xy / transformedPos.z; \n\
98 mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\
99 mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1.0); \n\
100 mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\
101 gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\
102 patternTexCoords.xy = (hTexCoords.xy * 0.125) * invertedHTexCoordsZ; \n\
109 uniform sampler2D brushTexture; \n\
110 uniform lowp vec4 patternColor; \n\
111 varying highp vec2 patternTexCoords;\n\
112 lowp vec4 srcPixel() \n\
114 return patternColor * (1.0 - texture2D(brushTexture, patternTexCoords).r); \n\
120 attribute highp vec2 vertexCoordsArray; \n\
121 attribute highp vec3 pmvMatrix1; \n\
122 attribute highp vec3 pmvMatrix2; \n\
123 attribute highp vec3 pmvMatrix3; \n\
124 uniform mediump vec2 halfViewportSize; \n\
125 uniform highp vec3 linearData; \n\
126 uniform highp mat3 brushTransform; \n\
127 varying mediump float index; \n\
128 void setPosition() \n\
130 highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
131 vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
132 gl_Position.xy = transformedPos.xy / transformedPos.z; \n\
133 mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\
134 mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\
135 mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\
136 gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\
137 index = (dot(linearData.xy, hTexCoords.xy) * linearData.z) * invertedHTexCoordsZ; \n\
144 uniform sampler2D brushTexture; \n\
145 varying mediump float index; \n\
146 lowp vec4 srcPixel() \n\
148 mediump vec2 val = vec2(index, 0.5); \n\
149 return texture2D(brushTexture, val); \n\
155 attribute highp vec2 vertexCoordsArray; \n\
156 attribute highp vec3 pmvMatrix1; \n\
157 attribute highp vec3 pmvMatrix2; \n\
158 attribute highp vec3 pmvMatrix3; \n\
159 uniform mediump vec2 halfViewportSize; \n\
160 uniform highp mat3 brushTransform; \n\
161 varying highp vec2 A; \n\
162 void setPosition(void) \n\
164 highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
165 vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
166 gl_Position.xy = transformedPos.xy / transformedPos.z; \n\
167 mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\
168 mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\
169 mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\
170 gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\
171 A = hTexCoords.xy * invertedHTexCoordsZ; \n\
178 #define INVERSE_2PI 0.1591549430918953358 \n\
179 uniform sampler2D brushTexture; \n\
180 uniform mediump float angle; \n\
181 varying highp vec2 A; \n\
182 lowp vec4 srcPixel() \n\
185 if (abs(A.y) == abs(A.x)) \n\
186 t = (atan(-A.y + 0.002, A.x) + angle) * INVERSE_2PI; \n\
188 t = (atan(-A.y, A.x) + angle) * INVERSE_2PI; \n\
189 return texture2D(brushTexture, vec2(t - floor(t), 0.5)); \n\
194static const char*
const qopenglslPositionWithRadialGradientBrushVertexShader =
"\n\
195 attribute highp vec2 vertexCoordsArray;\n\
196 attribute highp vec3 pmvMatrix1; \n\
197 attribute highp vec3 pmvMatrix2; \n\
198 attribute highp vec3 pmvMatrix3; \n\
199 uniform mediump vec2 halfViewportSize; \n\
200 uniform highp mat3 brushTransform; \n\
201 uniform highp vec2 fmp; \n\
202 uniform mediump vec3 bradius; \n\
203 varying highp float b; \n\
204 varying highp vec2 A; \n\
205 void setPosition(void) \n\
207 highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
208 vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
209 gl_Position.xy = transformedPos.xy / transformedPos.z; \n\
210 mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\
211 mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\
212 mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\
213 gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\
214 A = hTexCoords.xy * invertedHTexCoordsZ; \n\
215 b = bradius.x + 2.0 * dot(A, fmp); \n\
219 = qopenglslPositionWithRadialGradientBrushVertexShader;
222 uniform sampler2D brushTexture; \n\
223 uniform highp float fmp2_m_radius2; \n\
224 uniform highp float inverse_2_fmp2_m_radius2; \n\
225 uniform highp float sqrfr; \n\
226 varying highp float b; \n\
227 varying highp vec2 A; \n\
228 uniform mediump vec3 bradius; \n\
229 lowp vec4 srcPixel() \n\
231 highp float c = sqrfr-dot(A, A); \n\
232 highp float det = b*b - 4.0*fmp2_m_radius2*c; \n\
233 lowp vec4 result = vec4(0.0); \n\
234 if (det >= 0.0) { \n\
235 highp float detSqrt = sqrt(det); \n\
236 highp float w = max((-b - detSqrt) * inverse_2_fmp2_m_radius2, (-b + detSqrt) * inverse_2_fmp2_m_radius2); \n\
237 if (bradius.y + w * bradius.z >= 0.0) \n\
238 result = texture2D(brushTexture, vec2(w, 0.5)); \n\
246 attribute highp vec2 vertexCoordsArray; \n\
247 attribute highp vec3 pmvMatrix1; \n\
248 attribute highp vec3 pmvMatrix2; \n\
249 attribute highp vec3 pmvMatrix3; \n\
250 uniform mediump vec2 halfViewportSize; \n\
251 uniform highp vec2 invertedTextureSize; \n\
252 uniform highp mat3 brushTransform; \n\
253 varying highp vec2 brushTextureCoords; \n\
254 void setPosition(void) \n\
256 highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
257 vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
258 gl_Position.xy = transformedPos.xy / transformedPos.z; \n\
259 mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\
260 mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\
261 mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\
262 gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\
263 brushTextureCoords.xy = (hTexCoords.xy * invertedTextureSize) * gl_Position.w; \n\
270 varying highp vec2 brushTextureCoords; \n\
271 uniform sampler2D brushTexture; \n\
272 lowp vec4 srcPixel() \n\
274 return texture2D(brushTexture, brushTextureCoords); \n\
278 varying highp vec2 brushTextureCoords; \n\
279 uniform lowp vec4 patternColor; \n\
280 uniform sampler2D brushTexture; \n\
281 lowp vec4 srcPixel() \n\
283 return patternColor * (1.0 - texture2D(brushTexture, brushTextureCoords).r); \n\
288 uniform lowp vec4 fragmentColor; \n\
289 lowp vec4 srcPixel() \n\
291 return fragmentColor; \n\
295 varying highp vec2 textureCoords; \n\
296 uniform sampler2D imageTexture; \n\
297 lowp vec4 srcPixel() \n\
299 "return texture2D(imageTexture, textureCoords); \n"
303 varying highp vec2 textureCoords; \n\
304 uniform sampler2D imageTexture; \n\
305 lowp vec4 srcPixel() \n\
307 return customShader(imageTexture, textureCoords); \n\
311 varying highp vec2 textureCoords; \n\
312 uniform lowp vec4 patternColor; \n\
313 uniform sampler2D imageTexture; \n\
314 lowp vec4 srcPixel() \n\
316 return patternColor * (1.0 - texture2D(imageTexture, textureCoords).r); \n\
320 varying highp vec2 textureCoords; \n\
321 uniform sampler2D imageTexture; \n\
322 lowp vec4 srcPixel() \n\
324 lowp vec4 sample = texture2D(imageTexture, textureCoords); \n\
325 sample.rgb = sample.rgb * sample.a; \n\
330 varying highp vec2 textureCoords; \n\
331 uniform sampler2D imageTexture; \n\
332 lowp vec4 srcPixel() \n\
334 return texture2D(imageTexture, textureCoords).rrra; \n\
338 varying highp vec2 textureCoords; \n\
339 uniform sampler2D imageTexture; \n\
340 lowp vec4 srcPixel() \n\
342 return vec4(0, 0, 0, texture2D(imageTexture, textureCoords).r); \n\
346 lowp vec4 srcPixel() \n\
348 return vec4(0.98, 0.06, 0.75, 1.0); \n\
352 varying lowp float opacity; \n\
353 lowp vec4 srcPixel(); \n\
356 gl_FragColor = srcPixel() * opacity; \n\
360 uniform lowp float globalOpacity; \n\
361 lowp vec4 srcPixel(); \n\
362 lowp vec4 applyMask(lowp vec4); \n\
365 gl_FragColor = applyMask(srcPixel()*globalOpacity); \n\
369 lowp vec4 srcPixel(); \n\
370 lowp vec4 applyMask(lowp vec4); \n\
373 gl_FragColor = applyMask(srcPixel()); \n\
377 uniform lowp float globalOpacity; \n\
378 lowp vec4 srcPixel(); \n\
381 gl_FragColor = srcPixel()*globalOpacity; \n\
385 lowp vec4 srcPixel(); \n\
388 gl_FragColor = srcPixel(); \n\
392 varying highp vec2 textureCoords;\n\
393 uniform sampler2D maskTexture;\n\
394 lowp vec4 applyMask(lowp vec4 src) \n\
396 lowp vec4 mask = texture2D(maskTexture, textureCoords); \n\
397 return src * mask.a; \n\
416 varying highp vec2 textureCoords;\n\
417 uniform sampler2D maskTexture;\n\
418 lowp vec4 applyMask(lowp vec4 src) \n\
420 lowp vec4 mask = texture2D(maskTexture, textureCoords); \n\
421 return src.a * mask; \n\
425 varying highp vec2 textureCoords;\n\
426 uniform sampler2D maskTexture;\n\
427 lowp vec4 applyMask(lowp vec4 src) \n\
429 lowp vec4 mask = texture2D(maskTexture, textureCoords); \n\
430 return src * mask; \n\
433static const char*
const qopenglslMultiplyCompositionModeFragmentShader =
"\n\
434 #ifdef GL_KHR_blend_equation_advanced\n\
435 layout(blend_support_multiply) out;\n\
438static const char*
const qopenglslScreenCompositionModeFragmentShader =
"\n\
439 #ifdef GL_KHR_blend_equation_advanced\n\
440 layout(blend_support_screen) out;\n\
443static const char*
const qopenglslOverlayCompositionModeFragmentShader =
"\n\
444 #ifdef GL_KHR_blend_equation_advanced\n\
445 layout(blend_support_overlay) out;\n\
448static const char*
const qopenglslDarkenCompositionModeFragmentShader =
"\n\
449 #ifdef GL_KHR_blend_equation_advanced\n\
450 layout(blend_support_darken) out;\n\
453static const char*
const qopenglslLightenCompositionModeFragmentShader =
"\n\
454 #ifdef GL_KHR_blend_equation_advanced\n\
455 layout(blend_support_lighten) out;\n\
458static const char*
const qopenglslColorDodgeCompositionModeFragmentShader =
"\n\
459 #ifdef GL_KHR_blend_equation_advanced\n\
460 layout(blend_support_colordodge) out;\n\
463static const char*
const qopenglslColorBurnCompositionModeFragmentShader =
"\n\
464 #ifdef GL_KHR_blend_equation_advanced\n\
465 layout(blend_support_colorburn) out;\n\
468static const char*
const qopenglslHardLightCompositionModeFragmentShader =
"\n\
469 #ifdef GL_KHR_blend_equation_advanced\n\
470 layout(blend_support_hardlight) out;\n\
473static const char*
const qopenglslSoftLightCompositionModeFragmentShader =
"\n\
474 #ifdef GL_KHR_blend_equation_advanced\n\
475 layout(blend_support_softlight) out;\n\
478static const char*
const qopenglslDifferenceCompositionModeFragmentShader =
"\n\
479 #ifdef GL_KHR_blend_equation_advanced\n\
480 layout(blend_support_difference) out;\n\
483static const char*
const qopenglslExclusionCompositionModeFragmentShader =
"\n\
484 #ifdef GL_KHR_blend_equation_advanced\n\
485 layout(blend_support_exclusion) out;\n\
501static const char*
const qopenglslMainVertexShader_core =
502 "#version 150 core\n\
503 void setPosition(); \n\
509static const char*
const qopenglslMainWithTexCoordsVertexShader_core =
510 "#version 150 core\n\
511 in vec2 textureCoordArray; \n\
512 out vec2 textureCoords; \n\
513 void setPosition(); \n\
517 textureCoords = textureCoordArray; \n\
520static const char*
const qopenglslMainWithTexCoordsAndOpacityVertexShader_core =
521 "#version 150 core\n\
522 in vec2 textureCoordArray; \n\
523 in float opacityArray; \n\
524 out vec2 textureCoords; \n\
525 out float opacity; \n\
526 void setPosition(); \n\
530 textureCoords = textureCoordArray; \n\
531 opacity = opacityArray; \n\
536static const char*
const qopenglslPositionOnlyVertexShader_core =
"\n\
537 in vec2 vertexCoordsArray; \n\
538 in vec3 pmvMatrix1; \n\
539 in vec3 pmvMatrix2; \n\
540 in vec3 pmvMatrix3; \n\
541 void setPosition(void) \n\
543 mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
544 vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
545 gl_Position = vec4(transformedPos.xy, 0.0, transformedPos.z); \n\
548static const char*
const qopenglslComplexGeometryPositionOnlyVertexShader_core =
"\n\
549 in vec2 vertexCoordsArray; \n\
550 uniform mat3 matrix; \n\
551 void setPosition(void) \n\
553 gl_Position = vec4(matrix * vec3(vertexCoordsArray, 1), 1);\n\
556static const char*
const qopenglslUntransformedPositionVertexShader_core =
"\n\
557 in vec4 vertexCoordsArray; \n\
558 void setPosition(void) \n\
560 gl_Position = vertexCoordsArray; \n\
564static const char*
const qopenglslPositionWithPatternBrushVertexShader_core =
"\n\
565 in vec2 vertexCoordsArray; \n\
566 in vec3 pmvMatrix1; \n\
567 in vec3 pmvMatrix2; \n\
568 in vec3 pmvMatrix3; \n\
569 out vec2 patternTexCoords; \n\
570 uniform vec2 halfViewportSize; \n\
571 uniform vec2 invertedTextureSize; \n\
572 uniform mat3 brushTransform; \n\
573 void setPosition(void) \n\
575 mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
576 vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
577 gl_Position.xy = transformedPos.xy / transformedPos.z; \n\
578 vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\
579 vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1.0); \n\
580 float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\
581 gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\
582 patternTexCoords.xy = (hTexCoords.xy * 0.125) * invertedHTexCoordsZ; \n\
585static const char*
const qopenglslAffinePositionWithPatternBrushVertexShader_core
586 = qopenglslPositionWithPatternBrushVertexShader_core;
588static const char*
const qopenglslPatternBrushSrcFragmentShader_core =
"\n\
589 in vec2 patternTexCoords;\n\
590 uniform sampler2D brushTexture; \n\
591 uniform vec4 patternColor; \n\
594 return patternColor * (1.0 - texture(brushTexture, patternTexCoords).r); \n\
599static const char*
const qopenglslPositionWithLinearGradientBrushVertexShader_core =
"\n\
600 in vec2 vertexCoordsArray; \n\
601 in vec3 pmvMatrix1; \n\
602 in vec3 pmvMatrix2; \n\
603 in vec3 pmvMatrix3; \n\
605 uniform vec2 halfViewportSize; \n\
606 uniform vec3 linearData; \n\
607 uniform mat3 brushTransform; \n\
608 void setPosition() \n\
610 mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
611 vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
612 gl_Position.xy = transformedPos.xy / transformedPos.z; \n\
613 vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\
614 vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\
615 float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\
616 gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\
617 index = (dot(linearData.xy, hTexCoords.xy) * linearData.z) * invertedHTexCoordsZ; \n\
620static const char*
const qopenglslAffinePositionWithLinearGradientBrushVertexShader_core
621 = qopenglslPositionWithLinearGradientBrushVertexShader_core;
623static const char*
const qopenglslLinearGradientBrushSrcFragmentShader_core =
"\n\
624 uniform sampler2D brushTexture; \n\
628 vec2 val = vec2(index, 0.5); \n\
629 return texture(brushTexture, val); \n\
634static const char*
const qopenglslPositionWithConicalGradientBrushVertexShader_core =
"\n\
635 in vec2 vertexCoordsArray; \n\
636 in vec3 pmvMatrix1; \n\
637 in vec3 pmvMatrix2; \n\
638 in vec3 pmvMatrix3; \n\
640 uniform vec2 halfViewportSize; \n\
641 uniform mat3 brushTransform; \n\
642 void setPosition(void) \n\
644 mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
645 vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
646 gl_Position.xy = transformedPos.xy / transformedPos.z; \n\
647 vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\
648 vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\
649 float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\
650 gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\
651 A = hTexCoords.xy * invertedHTexCoordsZ; \n\
654static const char*
const qopenglslAffinePositionWithConicalGradientBrushVertexShader_core
655 = qopenglslPositionWithConicalGradientBrushVertexShader_core;
657static const char*
const qopenglslConicalGradientBrushSrcFragmentShader_core =
"\n\
658 #define INVERSE_2PI 0.1591549430918953358 \n\
660 uniform sampler2D brushTexture; \n\
661 uniform float angle; \n\
665 if (abs(A.y) == abs(A.x)) \n\
666 t = (atan(-A.y + 0.002, A.x) + angle) * INVERSE_2PI; \n\
668 t = (atan(-A.y, A.x) + angle) * INVERSE_2PI; \n\
669 return texture(brushTexture, vec2(t - floor(t), 0.5)); \n\
674static const char*
const qopenglslPositionWithRadialGradientBrushVertexShader_core =
"\n\
675 in vec2 vertexCoordsArray;\n\
676 in vec3 pmvMatrix1; \n\
677 in vec3 pmvMatrix2; \n\
678 in vec3 pmvMatrix3; \n\
681 uniform vec2 halfViewportSize; \n\
682 uniform mat3 brushTransform; \n\
683 uniform vec2 fmp; \n\
684 uniform vec3 bradius; \n\
685 void setPosition(void) \n\
687 mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
688 vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
689 gl_Position.xy = transformedPos.xy / transformedPos.z; \n\
690 vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\
691 vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\
692 float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\
693 gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\
694 A = hTexCoords.xy * invertedHTexCoordsZ; \n\
695 b = bradius.x + 2.0 * dot(A, fmp); \n\
698static const char*
const qopenglslAffinePositionWithRadialGradientBrushVertexShader_core
699 = qopenglslPositionWithRadialGradientBrushVertexShader_core;
701static const char*
const qopenglslRadialGradientBrushSrcFragmentShader_core =
"\n\
704 uniform sampler2D brushTexture; \n\
705 uniform float fmp2_m_radius2; \n\
706 uniform float inverse_2_fmp2_m_radius2; \n\
707 uniform float sqrfr; \n\
708 uniform vec3 bradius; \n\
712 float c = sqrfr-dot(A, A); \n\
713 float det = b*b - 4.0*fmp2_m_radius2*c; \n\
714 vec4 result = vec4(0.0); \n\
715 if (det >= 0.0) { \n\
716 float detSqrt = sqrt(det); \n\
717 float w = max((-b - detSqrt) * inverse_2_fmp2_m_radius2, (-b + detSqrt) * inverse_2_fmp2_m_radius2); \n\
718 if (bradius.y + w * bradius.z >= 0.0) \n\
719 result = texture(brushTexture, vec2(w, 0.5)); \n\
726static const char*
const qopenglslPositionWithTextureBrushVertexShader_core =
"\n\
727 in vec2 vertexCoordsArray; \n\
728 in vec3 pmvMatrix1; \n\
729 in vec3 pmvMatrix2; \n\
730 in vec3 pmvMatrix3; \n\
731 out vec2 brushTextureCoords; \n\
732 uniform vec2 halfViewportSize; \n\
733 uniform vec2 invertedTextureSize; \n\
734 uniform mat3 brushTransform; \n\
736 void setPosition(void) \n\
738 mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
739 vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
740 gl_Position.xy = transformedPos.xy / transformedPos.z; \n\
741 vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\
742 vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\
743 float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\
744 gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\
745 brushTextureCoords.xy = (hTexCoords.xy * invertedTextureSize) * gl_Position.w; \n\
748static const char*
const qopenglslAffinePositionWithTextureBrushVertexShader_core
749 = qopenglslPositionWithTextureBrushVertexShader_core;
751static const char*
const qopenglslTextureBrushSrcFragmentShader_core =
"\n\
752 in vec2 brushTextureCoords; \n\
753 uniform sampler2D brushTexture; \n\
756 return texture(brushTexture, brushTextureCoords); \n\
759static const char*
const qopenglslTextureBrushSrcWithPatternFragmentShader_core =
"\n\
760 in vec2 brushTextureCoords; \n\
761 uniform vec4 patternColor; \n\
762 uniform sampler2D brushTexture; \n\
765 return patternColor * (1.0 - texture(brushTexture, brushTextureCoords).r); \n\
769static const char*
const qopenglslSolidBrushSrcFragmentShader_core =
"\n\
770 uniform vec4 fragmentColor; \n\
773 return fragmentColor; \n\
776static const char*
const qopenglslImageSrcFragmentShader_core =
"\n\
777 in vec2 textureCoords; \n\
778 uniform sampler2D imageTexture; \n\
781 return texture(imageTexture, textureCoords); \n\
784static const char*
const qopenglslCustomSrcFragmentShader_core =
"\n\
785 in vec2 textureCoords; \n\
786 uniform sampler2D imageTexture; \n\
789 return customShader(imageTexture, textureCoords); \n\
792static const char*
const qopenglslImageSrcWithPatternFragmentShader_core =
"\n\
793 in vec2 textureCoords; \n\
794 uniform vec4 patternColor; \n\
795 uniform sampler2D imageTexture; \n\
798 return patternColor * (1.0 - texture(imageTexture, textureCoords).r); \n\
801static const char*
const qopenglslNonPremultipliedImageSrcFragmentShader_core =
"\n\
802 in vec2 textureCoords; \n\
803 uniform sampler2D imageTexture; \n\
806 vec4 sample = texture(imageTexture, textureCoords); \n\
807 sample.rgb = sample.rgb * sample.a; \n\
811static const char*
const qopenglslGrayscaleImageSrcFragmentShader_core =
"\n\
812 in vec2 textureCoords; \n\
813 uniform sampler2D imageTexture; \n\
816 return texture(imageTexture, textureCoords).rrra; \n\
819static const char*
const qopenglslAlphaImageSrcFragmentShader_core =
"\n\
820 in vec2 textureCoords; \n\
821 uniform sampler2D imageTexture; \n\
824 return vec4(0, 0, 0, texture(imageTexture, textureCoords).r); \n\
827static const char*
const qopenglslShockingPinkSrcFragmentShader_core =
"\n\
830 return vec4(0.98, 0.06, 0.75, 1.0); \n\
833static const char*
const qopenglslMainFragmentShader_ImageArrays_core =
834 "#version 150 core\n\
835 in float opacity; \n\
836 out vec4 fragColor; \n\
840 fragColor = srcPixel() * opacity; \n\
843static const char*
const qopenglslMainFragmentShader_MO_core =
844 "#version 150 core\n\
845 out vec4 fragColor; \n\
846 uniform float globalOpacity; \n\
848 vec4 applyMask(vec4); \n\
851 fragColor = applyMask(srcPixel()*globalOpacity); \n\
854static const char*
const qopenglslMainFragmentShader_M_core =
855 "#version 150 core\n\
856 out vec4 fragColor; \n\
858 vec4 applyMask(vec4); \n\
861 fragColor = applyMask(srcPixel()); \n\
864static const char*
const qopenglslMainFragmentShader_O_core =
865 "#version 150 core\n\
866 out vec4 fragColor; \n\
867 uniform float globalOpacity; \n\
871 fragColor = srcPixel()*globalOpacity; \n\
874static const char*
const qopenglslMainFragmentShader_core =
875 "#version 150 core\n\
876 out vec4 fragColor; \n\
880 fragColor = srcPixel(); \n\
883static const char*
const qopenglslMaskFragmentShader_core =
"\n\
884 in vec2 textureCoords;\n\
885 uniform sampler2D maskTexture;\n\
886 vec4 applyMask(vec4 src) \n\
888 vec4 mask = texture(maskTexture, textureCoords); \n\
889 return src * mask.r; \n\
907static const char*
const qopenglslRgbMaskFragmentShaderPass1_core =
"\n\
908 in vec2 textureCoords;\n\
909 uniform sampler2D maskTexture;\n\
910 vec4 applyMask(vec4 src) \n\
912 vec4 mask = texture(maskTexture, textureCoords); \n\
913 return src.a * mask; \n\
916static const char*
const qopenglslRgbMaskFragmentShaderPass2_core =
"\n\
917 in vec2 textureCoords;\n\
918 uniform sampler2D maskTexture;\n\
919 vec4 applyMask(vec4 src) \n\
921 vec4 mask = texture(maskTexture, textureCoords); \n\
922 return src * mask; \n\
Combined button and popup list for selecting options.
static const char *const qopenglslConicalGradientBrushSrcFragmentShader
static QT_BEGIN_NAMESPACE const char *const qopenglslMainVertexShader
static const char *const qopenglslPatternBrushSrcFragmentShader
static const char *const qopenglslMainFragmentShader_M
static const char *const qopenglslPositionWithConicalGradientBrushVertexShader
static const char *const qopenglslImageSrcWithPatternFragmentShader
static const char *const qopenglslSolidBrushSrcFragmentShader
static const char *const qopenglslImageSrcFragmentShader
static const char *const qopenglslAffinePositionWithLinearGradientBrushVertexShader
static const char *const qopenglslMainFragmentShader_ImageArrays
static const char *const qopenglslAlphaImageSrcFragmentShader
static const char *const qopenglslLinearGradientBrushSrcFragmentShader
static const char *const qopenglslPositionOnlyVertexShader
static const char *const qopenglslShockingPinkSrcFragmentShader
static const char *const qopenglslPositionWithPatternBrushVertexShader
static const char *const qopenglslMainFragmentShader_MO
static const char *const qopenglslMainWithTexCoordsAndOpacityVertexShader
static const char *const qopenglslRgbMaskFragmentShaderPass2
static const char *const qopenglslRgbMaskFragmentShaderPass1
static const char *const qopenglslCustomSrcFragmentShader
static const char *const qopenglslAffinePositionWithRadialGradientBrushVertexShader
static const char *const qopenglslGrayscaleImageSrcFragmentShader
static const char *const qopenglslAffinePositionWithTextureBrushVertexShader
static const char *const qopenglslAffinePositionWithConicalGradientBrushVertexShader
static const char *const qopenglslUntransformedPositionVertexShader
static const char *const qopenglslMainFragmentShader
static const char *const qopenglslAffinePositionWithPatternBrushVertexShader
static const char *const qopenglslTextureBrushSrcWithPatternFragmentShader
static const char *const qopenglslRadialGradientBrushSrcFragmentShader
static const char *const qopenglslTextureBrushSrcFragmentShader
static const char *const qopenglslMainFragmentShader_O
static const char *const qopenglslPositionWithLinearGradientBrushVertexShader
static const char *const qopenglslComplexGeometryPositionOnlyVertexShader
static const char *const qopenglslMaskFragmentShader
static const char *const qopenglslPositionWithTextureBrushVertexShader
static const char *const qopenglslMainWithTexCoordsVertexShader
static const char *const qopenglslNonPremultipliedImageSrcFragmentShader