Guest User

Untitled

a guest
Aug 9th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.20 KB | None | 0 0
  1. float4x4 World;
  2. float4x4 View;
  3. float4x4 Projection;
  4. Texture xTexture;
  5.  
  6. sampler TextureSampler = sampler_state { texture = <xTexture> ; magfilter = LINEAR; minfilter = LINEAR; mipfilter=LINEAR; AddressU = mirror; AddressV = mirror;};
  7.  
  8. struct VertexToPixel
  9. {
  10.     float4 Position     : POSITION;    
  11.     float2 TexCoords    : TEXCOORD0;
  12. };
  13.  
  14.  
  15. struct PixelToFrame
  16. {
  17.     float4 Color        : COLOR0;
  18. };
  19.  
  20.  
  21.  VertexToPixel SimplestVertexShader( float4 inPos : POSITION, float2 inTexCoords : TEXCOORD0)
  22.  {
  23.      VertexToPixel Output = (VertexToPixel)0;
  24.      
  25.      float4 worldPosition = mul(inPos, World);
  26.      float4 viewPosition = mul(worldPosition, View);
  27.      Output.Position = mul(viewPosition, Projection);
  28.    
  29.      //Output.Position =mul(inPos, xViewProjection);
  30.      Output.TexCoords = inTexCoords;
  31.  
  32.      return Output;
  33.  }
  34.  
  35.  PixelToFrame OurFirstPixelShader(VertexToPixel PSIn)
  36.  {
  37.      PixelToFrame Output = (PixelToFrame)0;    
  38.  
  39.      Output.Color = tex2D(TextureSampler, PSIn.TexCoords);
  40.  
  41.  
  42.     return Output;
  43. }
  44.  
  45. technique Default
  46. {
  47.     pass// Pass0
  48.     {
  49.         VertexShader = compile vs_2_0 SimplestVertexShader();
  50.         PixelShader = compile ps_2_0 OurFirstPixelShader();
  51.     }
  52. }
Add Comment
Please, Sign In to add comment