yolobs-studio/plugins/obs-transitions/data/swipe_transition.effect

48 lines
888 B
Text
Raw Normal View History

2016-05-24 19:53:01 +00:00
uniform float4x4 ViewProj;
uniform texture2d tex_a;
uniform texture2d tex_b;
uniform float2 swipe_val;
sampler_state textureSampler {
Filter = Linear;
AddressU = Clamp;
AddressV = Clamp;
};
struct VertData {
float4 pos : POSITION;
float2 uv : TEXCOORD0;
};
2017-04-19 19:54:15 +00:00
#include "premultiplied.inc"
2016-05-24 19:53:01 +00:00
VertData VSDefault(VertData v_in)
{
VertData vert_out;
vert_out.pos = mul(float4(v_in.pos.xyz, 1.0), ViewProj);
vert_out.uv = v_in.uv;
return vert_out;
}
float4 PSSwipe(VertData v_in) : TARGET
{
float2 swipe_uv = v_in.uv + swipe_val;
2017-04-19 19:54:15 +00:00
float4 outc;
2016-05-24 19:53:01 +00:00
2017-04-19 19:54:15 +00:00
outc = (swipe_uv.x - saturate(swipe_uv.x) != 0.0) ||
2016-05-24 19:53:01 +00:00
(swipe_uv.y - saturate(swipe_uv.y) != 0.0)
? tex_b.Sample(textureSampler, v_in.uv)
: tex_a.Sample(textureSampler, swipe_uv);
2017-04-19 19:54:15 +00:00
return convert_pmalpha(outc);
2016-05-24 19:53:01 +00:00
}
technique Swipe
{
pass
{
vertex_shader = VSDefault(v_in);
pixel_shader = PSSwipe(v_in);
}
}