default_rect.effect 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #include "color.effect"
  2. uniform float4x4 ViewProj;
  3. uniform texture_rect image;
  4. sampler_state def_sampler {
  5. Filter = Linear;
  6. AddressU = Clamp;
  7. AddressV = Clamp;
  8. };
  9. struct VertInOut {
  10. float4 pos : POSITION;
  11. float2 uv : TEXCOORD0;
  12. };
  13. VertInOut VSDefault(VertInOut vert_in)
  14. {
  15. VertInOut vert_out;
  16. vert_out.pos = mul(float4(vert_in.pos.xyz, 1.0), ViewProj);
  17. vert_out.uv = vert_in.uv;
  18. return vert_out;
  19. }
  20. float4 PSDrawBare(VertInOut vert_in) : TARGET
  21. {
  22. return image.Sample(def_sampler, vert_in.uv);
  23. }
  24. float4 PSDrawOpaque(VertInOut vert_in) : TARGET
  25. {
  26. return float4(image.Sample(def_sampler, vert_in.uv).rgb, 1.0);
  27. }
  28. float4 PSDrawSrgbDecompress(VertInOut vert_in) : TARGET
  29. {
  30. float4 rgba = image.Sample(def_sampler, vert_in.uv);
  31. rgba.rgb = srgb_nonlinear_to_linear(rgba.rgb);
  32. return rgba;
  33. }
  34. technique Draw
  35. {
  36. pass
  37. {
  38. vertex_shader = VSDefault(vert_in);
  39. pixel_shader = PSDrawBare(vert_in);
  40. }
  41. }
  42. technique DrawOpaque
  43. {
  44. pass
  45. {
  46. vertex_shader = VSDefault(vert_in);
  47. pixel_shader = PSDrawOpaque(vert_in);
  48. }
  49. }
  50. technique DrawSrgbDecompress
  51. {
  52. pass
  53. {
  54. vertex_shader = VSDefault(vert_in);
  55. pixel_shader = PSDrawSrgbDecompress(vert_in);
  56. }
  57. }