Inital commit of the Komplex Hub
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
#version 440
|
||||
layout(location = 0) in vec2 qt_TexCoord0;
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
layout(std140, binding = 0) uniform buf {
|
||||
mat4 qt_Matrix;
|
||||
float qt_Opacity;
|
||||
|
||||
vec4 color;
|
||||
};
|
||||
layout(binding = 1) uniform sampler2D src;
|
||||
|
||||
void main() {
|
||||
vec4 p = texture(src, qt_TexCoord0);
|
||||
|
||||
if (p.a == 0) // Otherwise background is affected
|
||||
discard;
|
||||
|
||||
fragColor = color * qt_Opacity;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#version 440
|
||||
layout(location = 0) in vec2 qt_TexCoord0;
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
layout(std140, binding = 0) uniform buf {
|
||||
mat4 qt_Matrix;
|
||||
float qt_Opacity;
|
||||
};
|
||||
layout(binding = 1) uniform sampler2D shadow;
|
||||
layout(binding = 2) uniform sampler2D original;
|
||||
|
||||
void main() {
|
||||
vec4 o = texture(original, qt_TexCoord0); // original
|
||||
|
||||
if (o.a != 0.0)
|
||||
discard;
|
||||
|
||||
vec4 s = texture(shadow, qt_TexCoord0); // shadow
|
||||
fragColor = s;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
#version 440
|
||||
layout(location = 0) in vec2 qt_TexCoord0;
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
layout(std140, binding = 0) uniform buf {
|
||||
mat4 qt_Matrix;
|
||||
float qt_Opacity;
|
||||
|
||||
float blurKernel;
|
||||
float sigma;
|
||||
vec2 pixelSize;
|
||||
int useOffscreenColor; // bool
|
||||
vec4 offscreenColor;
|
||||
};
|
||||
layout(binding = 1) uniform sampler2D src;
|
||||
|
||||
const float PI = 3.14159265359;
|
||||
const float sqrtDoublePI = sqrt(2.0 * PI);
|
||||
|
||||
vec4 gaussianBlur(sampler2D tex, int miplevel) {
|
||||
vec4 col = vec4(0.0);
|
||||
|
||||
float sum = 0;
|
||||
|
||||
float k = ceil(blurKernel);
|
||||
|
||||
// Normalize kernel weights
|
||||
for (float i = -k; i <= k; ++i) {
|
||||
sum += exp(-0.5 * pow(i / sigma, 2.0)) / (sqrtDoublePI * sigma);
|
||||
}
|
||||
|
||||
for (float i = -k; i <= k; ++i) {
|
||||
vec2 coord = qt_TexCoord0 + (pixelSize * float(i));
|
||||
float weight = exp(-0.5 * pow(i / sigma, 2.0)) / (sqrtDoublePI * sigma);
|
||||
|
||||
if (useOffscreenColor != 0
|
||||
&& (coord.x > 1.0 || coord.y > 1.0
|
||||
|| coord.x < 0.0 || coord.y < 0.0)) {
|
||||
col += offscreenColor * weight / sum;
|
||||
} else {
|
||||
col += texture(tex, coord) * weight / sum;
|
||||
}
|
||||
}
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 p = (blurKernel > 0) ? gaussianBlur(src, 0)
|
||||
: texture(src, qt_TexCoord0);
|
||||
|
||||
fragColor = p * qt_Opacity;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#version 440
|
||||
layout(location = 0) in vec2 qt_TexCoord0;
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
layout(std140, binding = 0) uniform buf {
|
||||
mat4 qt_Matrix;
|
||||
float qt_Opacity;
|
||||
|
||||
vec4 color;
|
||||
};
|
||||
layout(binding = 1) uniform sampler2D src;
|
||||
|
||||
void main() {
|
||||
vec4 p = texture(src, qt_TexCoord0);
|
||||
|
||||
if (p.a != 0)
|
||||
discard;
|
||||
|
||||
fragColor = color * qt_Opacity;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#version 440
|
||||
layout(location = 0) in vec2 qt_TexCoord0;
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
layout(std140, binding = 0) uniform buf {
|
||||
mat4 qt_Matrix;
|
||||
float qt_Opacity;
|
||||
};
|
||||
layout(binding = 1) uniform sampler2D shadow;
|
||||
layout(binding = 2) uniform sampler2D original;
|
||||
|
||||
void main() {
|
||||
vec4 o = texture(original, qt_TexCoord0); // original
|
||||
|
||||
if (o.a == 0)
|
||||
discard;
|
||||
|
||||
vec4 s = texture(shadow, qt_TexCoord0); // shadow
|
||||
|
||||
if (s.a == 0)
|
||||
discard;
|
||||
|
||||
fragColor = s;
|
||||
//} else {
|
||||
// fragColor.rgb = mix(s.rgb, o.rgb, (1.0 - s.a));
|
||||
// fragColor.a = s.a + (o.a * (1.0 - s.a));
|
||||
//}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#version 440
|
||||
|
||||
layout(location = 0) in vec2 qt_TexCoord0;
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
|
||||
layout(std140, binding = 0) uniform buf {
|
||||
// qt_Matrix and qt_Opacity must always be both present
|
||||
// if the built-in vertex shader is used.
|
||||
mat4 qt_Matrix;
|
||||
float qt_Opacity;
|
||||
};
|
||||
|
||||
layout(binding = 1) uniform sampler2D source;
|
||||
layout(binding = 2) uniform sampler2D maskSource;
|
||||
|
||||
void main()
|
||||
{
|
||||
if (texture(maskSource, qt_TexCoord0.st).a == 0.0) {
|
||||
fragColor = vec4(0);
|
||||
} else {
|
||||
fragColor = texture(source, qt_TexCoord0.st);
|
||||
}
|
||||
|
||||
//fragColor = texture(source, qt_TexCoord0.st)
|
||||
// * (texture(maskSource, qt_TexCoord0.st).a)
|
||||
// * qt_Opacity;
|
||||
}
|
||||
Reference in New Issue
Block a user