mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-10-27 16:29:04 -04:00
5 files changed
+4
-32
No files matched your search
@@ -226,28 +226,6 @@ static OBSSource CreateLabel(const char *name, size_t h)
|
||||
return txtSource;
|
||||
}
|
||||
|
||||
static inline void renderVB(gs_effect_t *effect, gs_vertbuffer_t *vb,
|
||||
int cx, int cy)
|
||||
{
|
||||
if (!vb)
|
||||
return;
|
||||
|
||||
matrix4 transform;
|
||||
matrix4_identity(&transform);
|
||||
transform.x.x = cx;
|
||||
transform.y.y = cy;
|
||||
|
||||
gs_load_vertexbuffer(vb);
|
||||
|
||||
gs_matrix_push();
|
||||
gs_matrix_mul(&transform);
|
||||
|
||||
while (gs_effect_loop(effect, "Solid"))
|
||||
gs_draw(GS_LINESTRIP, 0, 0);
|
||||
|
||||
gs_matrix_pop();
|
||||
}
|
||||
|
||||
static inline uint32_t labelOffset(obs_source_t *label, uint32_t cx)
|
||||
{
|
||||
uint32_t w = obs_source_get_width(label);
|
||||
|
||||
@@ -37,7 +37,7 @@ float4 PSDrawAlphaDivide(VertInOut vert_in) : TARGET
|
||||
float4 PSDrawMatrix(VertInOut vert_in) : TARGET
|
||||
{
|
||||
float3 rgb = image.Sample(def_sampler, vert_in.uv).rgb;
|
||||
float3 yuv = mul(float4(saturate(rgb), 1.0), color_matrix).xyz;
|
||||
float3 yuv = mul(float4(rgb, 1.0), color_matrix).xyz;
|
||||
return float4(yuv, 1.0);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ struct chroma_key_filter_data {
|
||||
|
||||
gs_eparam_t *pixel_size_param;
|
||||
gs_eparam_t *chroma_param;
|
||||
gs_eparam_t *key_rgb_param;
|
||||
gs_eparam_t *similarity_param;
|
||||
gs_eparam_t *smoothness_param;
|
||||
gs_eparam_t *spill_param;
|
||||
@@ -45,7 +44,6 @@ struct chroma_key_filter_data {
|
||||
float brightness;
|
||||
float gamma;
|
||||
|
||||
struct vec4 key_rgb;
|
||||
struct vec2 chroma;
|
||||
float similarity;
|
||||
float smoothness;
|
||||
@@ -97,6 +95,7 @@ static inline void chroma_settings_update(
|
||||
SETTING_KEY_COLOR);
|
||||
const char *key_type = obs_data_get_string(settings,
|
||||
SETTING_COLOR_TYPE);
|
||||
struct vec4 key_rgb;
|
||||
struct vec4 key_color_v4;
|
||||
struct matrix4 yuv_mat_m4;
|
||||
|
||||
@@ -107,10 +106,10 @@ static inline void chroma_settings_update(
|
||||
else if (strcmp(key_type, "magenta") == 0)
|
||||
key_color = 0xFF00FF;
|
||||
|
||||
vec4_from_rgba(&filter->key_rgb, key_color | 0xFF000000);
|
||||
vec4_from_rgba(&key_rgb, key_color | 0xFF000000);
|
||||
|
||||
memcpy(&yuv_mat_m4, yuv_mat, sizeof(yuv_mat));
|
||||
vec4_transform(&key_color_v4, &filter->key_rgb, &yuv_mat_m4);
|
||||
vec4_transform(&key_color_v4, &key_rgb, &yuv_mat_m4);
|
||||
vec2_set(&filter->chroma, key_color_v4.y, key_color_v4.z);
|
||||
|
||||
filter->similarity = (float)similarity / 1000.0f;
|
||||
@@ -161,8 +160,6 @@ static void *chroma_key_create(obs_data_t *settings, obs_source_t *context)
|
||||
filter->effect, "gamma");
|
||||
filter->chroma_param = gs_effect_get_param_by_name(
|
||||
filter->effect, "chroma_key");
|
||||
filter->key_rgb_param = gs_effect_get_param_by_name(
|
||||
filter->effect, "key_rgb");
|
||||
filter->pixel_size_param = gs_effect_get_param_by_name(
|
||||
filter->effect, "pixel_size");
|
||||
filter->similarity_param = gs_effect_get_param_by_name(
|
||||
@@ -205,7 +202,6 @@ static void chroma_key_render(void *data, gs_effect_t *effect)
|
||||
gs_effect_set_float(filter->brightness_param, filter->brightness);
|
||||
gs_effect_set_float(filter->gamma_param, filter->gamma);
|
||||
gs_effect_set_vec2(filter->chroma_param, &filter->chroma);
|
||||
gs_effect_set_vec4(filter->key_rgb_param, &filter->key_rgb);
|
||||
gs_effect_set_vec2(filter->pixel_size_param, &pixel_size);
|
||||
gs_effect_set_float(filter->similarity_param, filter->similarity);
|
||||
gs_effect_set_float(filter->smoothness_param, filter->smoothness);
|
||||
|
||||
@@ -12,7 +12,6 @@ uniform float brightness;
|
||||
uniform float gamma;
|
||||
|
||||
uniform float2 chroma_key;
|
||||
uniform float4 key_rgb;
|
||||
uniform float2 pixel_size;
|
||||
uniform float similarity;
|
||||
uniform float smoothness;
|
||||
|
||||
@@ -42,7 +42,6 @@ float GetColorDist(float3 rgb)
|
||||
float4 ProcessColorKey(float4 rgba, VertData v_in)
|
||||
{
|
||||
float colorDist = GetColorDist(rgba.rgb);
|
||||
float baseMask = colorDist - similarity;
|
||||
rgba.a *= saturate(max(colorDist - similarity, 0.0) / smoothness);
|
||||
|
||||
return CalcColor(rgba);
|
||||
|
||||
Reference in new issue
Block a user