1. float4x4 World;
  2. float4x4 View;
  3. float4x4 Projection;
  4.  
  5. float fTimer;
  6. sampler ColorMapSampler : register(s0);
  7.  
  8. //the texture that will be refracted by the objects
  9. sampler RefractionMap : register(s2);
  10.  
  11. float3 position;
  12. float WaterLevel;
  13. float Waves;
  14.  
  15. struct VertexShaderInput
  16. {
  17. float4 Position : POSITION0;
  18.  
  19. // TODO: add input channels such as texture
  20. // coordinates and vertex colors here.
  21. };
  22.  
  23. struct VertexShaderOutput
  24. {
  25. float4 Position : POSITION0;
  26.  
  27. // TODO: add vertex shader outputs such as colors and texture
  28. // coordinates here. These values will automatically be interpolated
  29. // over the triangle, and provided as input to your pixel shader.
  30. };
  31.  
  32. VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
  33. {
  34. VertexShaderOutput output;
  35.  
  36. float4 worldPosition = mul(input.Position, World);
  37. float4 viewPosition = mul(worldPosition, View);
  38. output.Position = mul(viewPosition, Projection);
  39.  
  40. // TODO: add your vertex shader code here.
  41.  
  42. return output;
  43. }
  44.  
  45. float4 PixelShader(float2 Tex: TEXCOORD0) : COLOR
  46. {
  47. float4 Color = 0;
  48.  
  49. //get the diffuse color
  50. //float4 texColor = tex2D(SpriteDiffuse, texCoord);
  51.  
  52. //position.y = Tex.y;
  53. //Tex.x += sin(fTimer + position.y *50) * 0.002f;
  54. //Tex.y += 0.008f;
  55. Color = tex2D(ColorMapSampler, Tex);
  56. Color.b = 1.0f;
  57. return Color;
  58.  
  59. //position.x = Tex.x;
  60.  
  61. //Waves = sin(fTimer + position.x * 5)* 0.022f;
  62. //Waves -= cos(fTimer + position.x * 22)* 0.012f;
  63. //WaterLevel = clamp(WaterLevel + Waves, 0.0f, 1.0f);
  64.  
  65. //if (position.y > WaterLevel)
  66. //{
  67.  
  68. //}
  69.  
  70. //if (position.y > WaterLevel)
  71. //{
  72. //Color.r += (0.1f);
  73. //Color.g += (0.1f);
  74. //Color.b += (0.5f);
  75. //}
  76. }
  77.  
  78. technique Technique1
  79. {
  80. pass pass0
  81. {
  82. PixelShader = compile ps_2_0 PixelShader();
  83. }
  84. }