default.effect 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. uniform float4x4 ViewProj;
  2. uniform float4x4 color_matrix;
  3. uniform float3 color_range_min;
  4. uniform float3 color_range_max;
  5. uniform texture2d image;
  6. sampler_state def_sampler {
  7. Filter = Linear;
  8. AddressU = Clamp;
  9. AddressV = Clamp;
  10. };
  11. struct VertInOut {
  12. float4 pos : POSITION;
  13. float2 uv : TEXCOORD0;
  14. };
  15. VertInOut VSDefault(VertInOut vert_in)
  16. {
  17. VertInOut vert_out;
  18. vert_out.pos = mul(float4(vert_in.pos.xyz, 1.0), ViewProj);
  19. vert_out.uv = vert_in.uv;
  20. return vert_out;
  21. }
  22. float4 PSDrawBare(VertInOut vert_in) : TARGET
  23. {
  24. return image.Sample(def_sampler, vert_in.uv);
  25. }
  26. float4 PSDrawMatrix(VertInOut vert_in) : TARGET
  27. {
  28. float4 yuv = image.Sample(def_sampler, vert_in.uv);
  29. yuv.xyz = clamp(yuv.xyz, color_range_min, color_range_max);
  30. return saturate(mul(float4(yuv.xyz, 1.0), color_matrix));
  31. }
  32. technique Draw
  33. {
  34. pass
  35. {
  36. vertex_shader = VSDefault(vert_in);
  37. pixel_shader = PSDrawBare(vert_in);
  38. }
  39. }
  40. technique DrawMatrix
  41. {
  42. pass
  43. {
  44. vertex_shader = VSDefault(vert_in);
  45. pixel_shader = PSDrawMatrix(vert_in);
  46. }
  47. }