mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-12-29 11:01:23 +00:00
filter-blur: Move effects to 'data/effects'
This should help reusing the same effect instead of having an effect per filter.
This commit is contained in:
parent
1f5c9f881a
commit
191b1ea23f
4 changed files with 12 additions and 11 deletions
|
@ -38,7 +38,7 @@ float4 PSGaussian(VertDataOut v_in) : TARGET
|
||||||
float4 rgba = float4(0, 0, 0, 0);
|
float4 rgba = float4(0, 0, 0, 0);
|
||||||
for (int k = -widthHalf; k <= widthHalf; k++) {
|
for (int k = -widthHalf; k <= widthHalf; k++) {
|
||||||
float4 smpl = image.Sample(textureSampler, v_in.uv + (texel * k));
|
float4 smpl = image.Sample(textureSampler, v_in.uv + (texel * k));
|
||||||
smpl *= Gaussian(k / width, 1.0);
|
smpl *= Gaussian(k, width / 2.0);
|
||||||
rgba += smpl;
|
rgba += smpl;
|
||||||
}
|
}
|
||||||
return rgba;
|
return rgba;
|
|
@ -53,43 +53,43 @@ Filter::Blur::Blur() {
|
||||||
obs_enter_graphics();
|
obs_enter_graphics();
|
||||||
{
|
{
|
||||||
char* loadError = nullptr;
|
char* loadError = nullptr;
|
||||||
char* file = obs_module_file("filter-blur/box.effect");
|
char* file = obs_module_file("effects/box-blur.effect");
|
||||||
g_boxBlurEffect = gs_effect_create_from_file(file, &loadError);
|
g_boxBlurEffect = gs_effect_create_from_file(file, &loadError);
|
||||||
bfree(file);
|
bfree(file);
|
||||||
if (loadError != nullptr) {
|
if (loadError != nullptr) {
|
||||||
PLOG_ERROR("<filter-blur> Loading effect failed with error(s): %s", loadError);
|
PLOG_ERROR("<filter-blur> Loading box-blur effect failed with error(s): %s", loadError);
|
||||||
bfree(loadError);
|
bfree(loadError);
|
||||||
} else if (!g_boxBlurEffect) {
|
} else if (!g_boxBlurEffect) {
|
||||||
PLOG_ERROR("<filter-blur> Loading effect failed with unspecified error.");
|
PLOG_ERROR("<filter-blur> Loading box-blur effect failed with unspecified error.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
char* loadError = nullptr;
|
char* loadError = nullptr;
|
||||||
char* file = obs_module_file("filter-blur/gaussian.effect");
|
char* file = obs_module_file("effects/gaussian-blur.effect");
|
||||||
g_gaussianBlurEffect = gs_effect_create_from_file(file, &loadError);
|
g_gaussianBlurEffect = gs_effect_create_from_file(file, &loadError);
|
||||||
bfree(file);
|
bfree(file);
|
||||||
if (loadError != nullptr) {
|
if (loadError != nullptr) {
|
||||||
PLOG_ERROR("<filter-blur> Loading effect failed with error(s): %s", loadError);
|
PLOG_ERROR("<filter-blur> Loading gaussian blur effect failed with error(s): %s", loadError);
|
||||||
bfree(loadError);
|
bfree(loadError);
|
||||||
} else if (!g_gaussianBlurEffect) {
|
} else if (!g_gaussianBlurEffect) {
|
||||||
PLOG_ERROR("<filter-blur> Loading effect failed with unspecified error.");
|
PLOG_ERROR("<filter-blur> Loading gaussian blur effect failed with unspecified error.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
char* loadError = nullptr;
|
char* loadError = nullptr;
|
||||||
char* file = obs_module_file("filter-blur/bilateral.effect");
|
char* file = obs_module_file("effects/bilateral-blur.effect");
|
||||||
g_bilateralBlurEffect = gs_effect_create_from_file(file, &loadError);
|
g_bilateralBlurEffect = gs_effect_create_from_file(file, &loadError);
|
||||||
bfree(file);
|
bfree(file);
|
||||||
if (loadError != nullptr) {
|
if (loadError != nullptr) {
|
||||||
PLOG_ERROR("<filter-blur> Loading effect failed with error(s): %s", loadError);
|
PLOG_ERROR("<filter-blur> Loading bilateral blur effect failed with error(s): %s", loadError);
|
||||||
bfree(loadError);
|
bfree(loadError);
|
||||||
} else if (!g_bilateralBlurEffect) {
|
} else if (!g_bilateralBlurEffect) {
|
||||||
PLOG_ERROR("<filter-blur> Loading effect failed with unspecified error.");
|
PLOG_ERROR("<filter-blur> Loading bilateral blur effect failed with unspecified error.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
obs_leave_graphics();
|
obs_leave_graphics();
|
||||||
|
|
||||||
if (g_boxBlurEffect && g_gaussianBlurEffect && g_bilateralBlurEffect)
|
if (g_boxBlurEffect && g_gaussianBlurEffect && g_bilateralBlurEffect && g_colorConversionEffect)
|
||||||
obs_register_source(&sourceInfo);
|
obs_register_source(&sourceInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,6 +157,7 @@ bool Filter::Blur::modified_properties(obs_properties_t *pr, obs_property_t *, o
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bilateral Blur
|
||||||
obs_property_set_visible(obs_properties_get(pr, P_FILTER_BLUR_BILATERAL_SMOOTHING),
|
obs_property_set_visible(obs_properties_get(pr, P_FILTER_BLUR_BILATERAL_SMOOTHING),
|
||||||
showBilateral);
|
showBilateral);
|
||||||
obs_property_set_visible(obs_properties_get(pr, P_FILTER_BLUR_BILATERAL_SHARPNESS),
|
obs_property_set_visible(obs_properties_get(pr, P_FILTER_BLUR_BILATERAL_SHARPNESS),
|
||||||
|
|
Loading…
Reference in a new issue