Advertisement
Guest User

Untitled

a guest
Nov 26th, 2013
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.19 KB | None | 0 0
  1. uniform sampler2D texColor <
  2.     string type = "input";
  3. >;
  4. uniform sampler2D texTarget <
  5.     string type = "output";
  6. >;
  7.  
  8. // --------------------------------------------------------- \\
  9.  
  10. struct VS_INPUT
  11. {
  12.     vec4 pos;
  13.     vec2 tex;
  14. };
  15. struct VS_OUTPUT
  16. {
  17.     vec4 pos;
  18.     vec2 tex;
  19. };
  20.  
  21. // --------------------------------------------------------- \\
  22.  
  23. void PostProcess_VS(in vec4 pos : 1, in vec2 tex, out VS_OUTPUT OUT)
  24. {
  25.     gl_Position = pos;
  26.  
  27.     OUT.pos = pos;
  28.     OUT.tex = tex;
  29. }
  30. void PostProcess_PS_Target(in VS_OUTPUT OUT, out vec4 FragColor0 : 0)
  31. {
  32.     // 0 --> Rendertarget 1
  33.     // 1 --> Rendertarget 2
  34.     // ...
  35.  
  36.     FragColor0 = texture2D(texColor, OUT.tex) * vec4(OUT.tex, 1.0, 1.0);
  37. }
  38. void PostProcess_PS(in VS_OUTPUT OUT, out vec4 FragColor)
  39. {
  40.     vec4 color = texture2D(texTarget, OUT.tex);
  41.     color.a = 1.0f;
  42.  
  43.     FragColor = color;
  44. }
  45.  
  46. // --------------------------------------------------------- \\
  47.  
  48. technique PostProcess
  49. {
  50.     pass p0 < string output0 = "texTarget"; >
  51.     {
  52.         VertexShader = compile 420 PostProcess_VS();
  53.         FragmentShader = compile 420 PostProcess_PS_Target();
  54.     }
  55.     pass p1
  56.     {
  57.         VertexShader = compile 420 PostProcess_VS();
  58.         FragmentShader = compile 420 PostProcess_PS();
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement