UI: Add scene item canvas overflow to preview

This commit is contained in:
VodBox
2019-01-15 14:58:20 +13:00
parent a249d26eaa
commit f095cb2d0e
11 changed files with 290 additions and 3 deletions

55
libobs/data/repeat.effect Normal file
View File

@@ -0,0 +1,55 @@
uniform float4x4 ViewProj;
uniform float4x4 color_matrix;
uniform float3 color_range_min = {0.0, 0.0, 0.0};
uniform float3 color_range_max = {1.0, 1.0, 1.0};
uniform texture2d image;
uniform float2 scale;
sampler_state def_sampler {
Filter = Linear;
AddressU = Repeat;
AddressV = Repeat;
};
struct VertInOut {
float4 pos : POSITION;
float2 uv : TEXCOORD0;
};
VertInOut VSDefault(VertInOut vert_in)
{
VertInOut vert_out;
vert_out.pos = mul(float4(vert_in.pos.xyz, 1.0), ViewProj);
vert_out.uv = vert_in.uv * scale;
return vert_out;
}
float4 PSDrawBare(VertInOut vert_in) : TARGET
{
return image.Sample(def_sampler, vert_in.uv);
}
float4 PSDrawMatrix(VertInOut vert_in) : TARGET
{
float4 yuv = image.Sample(def_sampler, vert_in.uv);
yuv.xyz = clamp(yuv.xyz, color_range_min, color_range_max);
return saturate(mul(float4(yuv.xyz, 1.0), color_matrix));
}
technique Draw
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSDrawBare(vert_in);
}
}
technique DrawMatrix
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSDrawMatrix(vert_in);
}
}

View File

@@ -255,6 +255,7 @@ struct obs_core_video {
gs_effect_t *default_rect_effect;
gs_effect_t *opaque_effect;
gs_effect_t *solid_effect;
gs_effect_t *repeat_effect;
gs_effect_t *conversion_effect;
gs_effect_t *bicubic_effect;
gs_effect_t *lanczos_effect;

View File

@@ -309,6 +309,11 @@ static int obs_init_graphics(struct obs_video_info *ovi)
NULL);
bfree(filename);
filename = obs_find_data_file("repeat.effect");
video->repeat_effect = gs_effect_create_from_file(filename,
NULL);
bfree(filename);
filename = obs_find_data_file("format_conversion.effect");
video->conversion_effect = gs_effect_create_from_file(filename,
NULL);
@@ -1570,6 +1575,8 @@ gs_effect_t *obs_get_base_effect(enum obs_base_effect effect)
return obs->video.opaque_effect;
case OBS_EFFECT_SOLID:
return obs->video.solid_effect;
case OBS_EFFECT_REPEAT:
return obs->video.repeat_effect;
case OBS_EFFECT_BICUBIC:
return obs->video.bicubic_effect;
case OBS_EFFECT_LANCZOS:

View File

@@ -601,6 +601,7 @@ enum obs_base_effect {
OBS_EFFECT_LANCZOS, /**< Lanczos downscale */
OBS_EFFECT_BILINEAR_LOWRES, /**< Bilinear low resolution downscale */
OBS_EFFECT_PREMULTIPLIED_ALPHA,/**< Premultiplied alpha */
OBS_EFFECT_REPEAT, /**< RGB/YUV (repeating) */
};
/** Returns a commonly used base effect */