mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 17:03:58 +02:00
Fixed blur problems on screen edges
This commit is contained in:
parent
01a028cbb6
commit
57dfe10baf
2 changed files with 15 additions and 8 deletions
|
@ -35,6 +35,7 @@ void main(void) {
|
|||
|
||||
//float sceneDepth = texture(sceneDepthMap, varTexCoord0).x;
|
||||
float outlineIntensity = 0.0;
|
||||
float weight = 0.0;
|
||||
{
|
||||
const float deltaUv = params._size / BLUR_KERNEL_SIZE;
|
||||
vec2 uv;
|
||||
|
@ -46,14 +47,20 @@ void main(void) {
|
|||
uv = startUv;
|
||||
startUv.y += deltaUv;
|
||||
|
||||
for (x=0 ; x<BLUR_KERNEL_SIZE ; x++) {
|
||||
outlinedDepth = texture(outlinedDepthMap, uv).x;
|
||||
outlineIntensity += (outlinedDepth < FAR_DISTANCE) ? 1.0 : 0.0;
|
||||
uv.x += deltaUv;
|
||||
if (uv.y>=0.0 && uv.y<=1.0) {
|
||||
for (x=0 ; x<BLUR_KERNEL_SIZE ; x++) {
|
||||
if (uv.x>=0.0 && uv.x<=1.0)
|
||||
{
|
||||
outlinedDepth = texture(outlinedDepthMap, uv).x;
|
||||
outlineIntensity += (outlinedDepth < FAR_DISTANCE) ? 1.0 : 0.0;
|
||||
weight += 1.f;
|
||||
}
|
||||
uv.x += deltaUv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
outlineIntensity /= BLUR_KERNEL_SIZE*BLUR_KERNEL_SIZE;
|
||||
outlineIntensity /= weight;
|
||||
}
|
||||
|
||||
if (outlineIntensity < 1e-3) {
|
||||
|
|
|
@ -81,13 +81,13 @@ class DrawOutlineConfig : public render::Job::Config {
|
|||
Q_PROPERTY(float colorB READ getColorB WRITE setColorB NOTIFY dirty)
|
||||
public:
|
||||
|
||||
void setColorR(float value) { color.r = value; }
|
||||
void setColorR(float value) { color.r = value; emit dirty(); }
|
||||
float getColorR() const { return color.r; }
|
||||
|
||||
void setColorG(float value) { color.g = value; }
|
||||
void setColorG(float value) { color.g = value; emit dirty(); }
|
||||
float getColorG() const { return color.g; }
|
||||
|
||||
void setColorB(float value) { color.b = value; }
|
||||
void setColorB(float value) { color.b = value; emit dirty(); }
|
||||
float getColorB() const { return color.b; }
|
||||
|
||||
float width{ 5.f };
|
||||
|
|
Loading…
Reference in a new issue