swipe_transition.effect 841 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. uniform float4x4 ViewProj;
  2. uniform texture2d tex_a;
  3. uniform texture2d tex_b;
  4. uniform float2 swipe_val;
  5. sampler_state textureSampler {
  6. Filter = Linear;
  7. AddressU = Clamp;
  8. AddressV = Clamp;
  9. };
  10. struct VertData {
  11. float4 pos : POSITION;
  12. float2 uv : TEXCOORD0;
  13. };
  14. VertData VSDefault(VertData v_in)
  15. {
  16. VertData vert_out;
  17. vert_out.pos = mul(float4(v_in.pos.xyz, 1.0), ViewProj);
  18. vert_out.uv = v_in.uv;
  19. return vert_out;
  20. }
  21. float4 PSSwipe(VertData v_in) : TARGET
  22. {
  23. float2 swipe_uv = v_in.uv + swipe_val;
  24. float4 outc;
  25. outc = (swipe_uv.x - saturate(swipe_uv.x) != 0.0) ||
  26. (swipe_uv.y - saturate(swipe_uv.y) != 0.0)
  27. ? tex_b.Sample(textureSampler, v_in.uv)
  28. : tex_a.Sample(textureSampler, swipe_uv);
  29. return outc;
  30. }
  31. technique Swipe
  32. {
  33. pass
  34. {
  35. vertex_shader = VSDefault(v_in);
  36. pixel_shader = PSSwipe(v_in);
  37. }
  38. }