Advertisement
Guest User

Custom shader CSColor field

a guest
Mar 3rd, 2016
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. #if defined(PK_VERTEX_SHADER)
  2.  
  3. float4x4 matWVP : register(c0);
  4.  
  5. struct VS_IN
  6. {
  7. float4 ObjPos : POSITION;
  8. float2 UV : TEXCOORD0;
  9. float4 Color : COLOR;
  10. float4 PK_CSColor : TEXCOORD1;
  11. };
  12.  
  13. struct VS_OUT
  14. {
  15. float4 Position : SV_POSITION;
  16. float2 UV : TEXCOORD0;
  17. float4 Color : COLOR;
  18. float4 CSColor : TEXCOORD1;
  19. };
  20.  
  21. VS_OUT main(VS_IN In)
  22. {
  23. VS_OUT Out;
  24. Out.Position = mul(matWVP, In.ObjPos);
  25. Out.UV = In.UV;
  26. Out.Color = In.Color;
  27. Out.CSColor = float4(0.0f, 1.0f, 0.0f, 1.0f);//In.PK_CSColor;
  28. return Out;
  29. }
  30.  
  31. #endif
  32.  
  33. //------------------------------------------------
  34.  
  35. #if defined(PK_PIXEL_SHADER)
  36.  
  37. Texture2D ColorTexture : register(t0);
  38. SamplerState ColorSampler : register(s0);
  39.  
  40. struct PS_IN
  41. {
  42. float4 ProjPos : SV_POSITION;
  43. float2 UV : TEXCOORD0;
  44. float4 Color : COLOR;
  45. float4 CSColor : TEXCOORD1;
  46. };
  47.  
  48. float4 main(PS_IN In) : SV_TARGET
  49. {
  50. float4 t = ColorTexture.Sample(ColorSampler, In.UV);
  51. float4 outCol = (In.Color * 0.1 + In.CSColor) * t;
  52. #if defined(MAT_ADDITIVE_ALPHA)
  53. outCol *= outCol.w;
  54. outCol.w = 0.0f;
  55. #endif
  56. #if defined(MAT_ADDITIVE_NOALPHA)
  57. outCol.w = 0.0f;
  58. #endif
  59. return outCol;
  60. }
  61.  
  62. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement