Guest User

Untitled

a guest
Feb 3rd, 2015
832
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.05 KB | None | 0 0
  1. //------------------------------------------------------------------------------------------
  2. // Shader settings
  3. //------------------------------------------------------------------------------------------
  4. texture gCustomTexture;
  5. float2 posAdd = float2(0,0); // move uv(0 - 1) left right , up down
  6. float2 posMult = float2(1,1); // stretch uv(0 - n ) x , y
  7. float4 gColorMult = float4(1,1,1,1); // multiply r g b a colors (0 - 1)
  8. //------------------------------------------------------------------------------------------
  9. // Include some common stuff
  10. //------------------------------------------------------------------------------------------
  11. texture gTexture0  < string textureState="0,Texture"; >;
  12.  
  13. //------------------------------------------------------------------------------------------
  14. // Sampler for the textures
  15. //------------------------------------------------------------------------------------------
  16. sampler Sampler0 = sampler_state
  17. {
  18.     Texture = (gTexture0);
  19. };
  20.  
  21. sampler SamplerCustom = sampler_state
  22. {
  23.     Texture = (gCustomTexture);
  24. };
  25.  
  26. //------------------------------------------------------------------------------------------
  27. // Pixel Shader
  28. //------------------------------------------------------------------------------------------
  29. float4 PSFunction(float4 TexCoord : TEXCOORD0, float4 Position : POSITION, float4 Color : COLOR0) : COLOR0
  30. {
  31.     float2 textureCoordinate = TexCoord.xy;
  32.     textureCoordinate *=  posMult;
  33.     textureCoordinate +=  posAdd;  
  34.     float4 Tex0 = tex2D(Sampler0, TexCoord.xy);
  35.     float4 Tex1 = tex2D(SamplerCustom, textureCoordinate) * gColorMult;
  36.     float4 Tex = lerp(Tex1, Tex0, Tex1.a);
  37.     Tex *= Color;
  38.     return saturate(Tex);
  39. }
  40.  
  41. //------------------------------------------------------------------------------------------
  42. // Techniques
  43. //------------------------------------------------------------------------------------------
  44. technique texRepTra
  45. {
  46.     pass p0
  47.     {
  48.         PixelShader = compile ps_2_0 PSFunction();
  49.     }
  50. }
  51.  
  52. technique fallback
  53. {
  54.     pass P0
  55.     {
  56.    
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment