mirror of
https://github.com/thorvg/thorvg.git
synced 2025-07-23 22:58:44 +00:00
gl_engine: remove level parameter from blur
level parameter removed from blur and dropshadows shaders. data structures alligment keeped
This commit is contained in:
parent
7b59b1869d
commit
f9b61d5122
2 changed files with 4 additions and 8 deletions
|
@ -32,13 +32,11 @@
|
||||||
/* Gaussian Blur */
|
/* Gaussian Blur */
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
||||||
#define GL_GAUSSIAN_MAX_LEVEL 3
|
|
||||||
|
|
||||||
struct GlGaussianBlur {
|
struct GlGaussianBlur {
|
||||||
int level{};
|
|
||||||
float sigma{};
|
float sigma{};
|
||||||
float scale{};
|
float scale{};
|
||||||
float extend{};
|
float extend{};
|
||||||
|
float dummy0{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,7 +62,6 @@ void GlEffect::update(RenderEffectGaussianBlur* effect, const Matrix& transform)
|
||||||
blur->sigma = effect->sigma;
|
blur->sigma = effect->sigma;
|
||||||
blur->scale = std::sqrt(transform.e11 * transform.e11 + transform.e12 * transform.e12);
|
blur->scale = std::sqrt(transform.e11 * transform.e11 + transform.e12 * transform.e12);
|
||||||
blur->extend = 2 * blur->sigma * blur->scale;
|
blur->extend = 2 * blur->sigma * blur->scale;
|
||||||
blur->level = int(GL_GAUSSIAN_MAX_LEVEL * ((effect->quality - 1) * 0.01f)) + 1;
|
|
||||||
effect->rd = blur;
|
effect->rd = blur;
|
||||||
effect->valid = (blur->extend > 0);
|
effect->valid = (blur->extend > 0);
|
||||||
}
|
}
|
||||||
|
@ -135,7 +132,6 @@ void GlEffect::update(RenderEffectDropShadow* effect, const Matrix& transform)
|
||||||
};
|
};
|
||||||
dropShadow->sigma = sigma;
|
dropShadow->sigma = sigma;
|
||||||
dropShadow->scale = scale;
|
dropShadow->scale = scale;
|
||||||
dropShadow->level = int(GL_GAUSSIAN_MAX_LEVEL * ((effect->quality - 1) * 0.01f)) + 1;
|
|
||||||
dropShadow->color[3] = effect->color[3] / 255.0f;
|
dropShadow->color[3] = effect->color[3] / 255.0f;
|
||||||
//Drop shadow effect applies blending in the shader (GL_BLEND disabled), so the color should be premultiplied:
|
//Drop shadow effect applies blending in the shader (GL_BLEND disabled), so the color should be premultiplied:
|
||||||
dropShadow->color[0] = effect->color[0] / 255.0f * dropShadow->color[3];
|
dropShadow->color[0] = effect->color[0] / 255.0f * dropShadow->color[3];
|
||||||
|
|
|
@ -740,10 +740,10 @@ void main()
|
||||||
const char* GAUSSIAN_VERTICAL = R"(
|
const char* GAUSSIAN_VERTICAL = R"(
|
||||||
uniform sampler2D uSrcTexture;
|
uniform sampler2D uSrcTexture;
|
||||||
layout(std140) uniform Gaussian {
|
layout(std140) uniform Gaussian {
|
||||||
int level;
|
|
||||||
float sigma;
|
float sigma;
|
||||||
float scale;
|
float scale;
|
||||||
float extend;
|
float extend;
|
||||||
|
float dummy0;
|
||||||
} uGaussian;
|
} uGaussian;
|
||||||
|
|
||||||
in vec2 vUV;
|
in vec2 vUV;
|
||||||
|
@ -776,10 +776,10 @@ void main()
|
||||||
const char* GAUSSIAN_HORIZONTAL = R"(
|
const char* GAUSSIAN_HORIZONTAL = R"(
|
||||||
uniform sampler2D uSrcTexture;
|
uniform sampler2D uSrcTexture;
|
||||||
layout(std140) uniform Gaussian {
|
layout(std140) uniform Gaussian {
|
||||||
int level;
|
|
||||||
float sigma;
|
float sigma;
|
||||||
float scale;
|
float scale;
|
||||||
float extend;
|
float extend;
|
||||||
|
float dummy0;
|
||||||
} uGaussian;
|
} uGaussian;
|
||||||
|
|
||||||
in vec2 vUV;
|
in vec2 vUV;
|
||||||
|
@ -813,10 +813,10 @@ const char* EFFECT_DROPSHADOW = R"(
|
||||||
uniform sampler2D uSrcTexture;
|
uniform sampler2D uSrcTexture;
|
||||||
uniform sampler2D uBlrTexture;
|
uniform sampler2D uBlrTexture;
|
||||||
layout(std140) uniform DropShadow {
|
layout(std140) uniform DropShadow {
|
||||||
int level;
|
|
||||||
float sigma;
|
float sigma;
|
||||||
float scale;
|
float scale;
|
||||||
float extend;
|
float extend;
|
||||||
|
float dummy0;
|
||||||
vec4 color;
|
vec4 color;
|
||||||
vec2 offset;
|
vec2 offset;
|
||||||
} uDropShadow;
|
} uDropShadow;
|
||||||
|
|
Loading…
Add table
Reference in a new issue