Occlusion.fx 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. //////////////////////////////////////////////////////////////////////////////
  2. // ©2006 Electronic Arts Inc
  3. //
  4. // FX Shader for object occlusion coloring ("behind buildings marker")
  5. //////////////////////////////////////////////////////////////////////////////
  6. #include "Common.fxh"
  7. // ----------------------------------------------------------------------------
  8. // Constants
  9. // ----------------------------------------------------------------------------
  10. float4 FlatColor
  11. <
  12. string UIWidget = "None";
  13. string SasBindAddress = "WW3D.FlatColor";
  14. > = float4(0, 0, 0, 0);
  15. // ----------------------------------------------------------------------------
  16. // SHADER
  17. // ----------------------------------------------------------------------------
  18. float4 VS(float3 Position : POSITION) : POSITION
  19. {
  20. return float4(Position, 1);
  21. }
  22. // ----------------------------------------------------------------------------
  23. float4 PS(void) : COLOR
  24. {
  25. return FlatColor;
  26. }
  27. // ----------------------------------------------------------------------------
  28. // TECHNIQUE: _ClearStencil
  29. // ----------------------------------------------------------------------------
  30. technique _ClearStencil
  31. {
  32. pass P0
  33. {
  34. VertexShader = compile VS_2_0 VS();
  35. PixelShader = compile PS_2_0 PS();
  36. ColorWriteEnable = 0;//RED|GREEN|BLUE|ALPHA;
  37. ZEnable = true;
  38. ZFunc = Never; // Old code claims it's faster to use ZFail to fill the stencil buffer. Maybe
  39. ZWriteEnable = false;
  40. CullMode = None;
  41. StencilEnable = true;
  42. StencilFunc = Less;
  43. StencilPass = Replace;
  44. StencilZFail = Replace;
  45. StencilFail = Zero;
  46. StencilMask = 0; // To be overridden by code
  47. StencilWriteMask = 0; // To be overridden by code
  48. StencilRef = 0; // To be overridden by code
  49. AlphaBlendEnable = false;
  50. AlphaTestEnable = false;
  51. }
  52. }
  53. // ----------------------------------------------------------------------------
  54. // TECHNIQUE: _FillColor
  55. // ----------------------------------------------------------------------------
  56. technique _FillColor
  57. {
  58. pass P0
  59. {
  60. VertexShader = compile VS_2_0 VS();
  61. PixelShader = compile PS_2_0 PS();
  62. ColorWriteEnable = RGBA;
  63. ZEnable = false;
  64. ZWriteEnable = false;
  65. CullMode = None;
  66. StencilEnable = true;
  67. StencilFunc = Equal;
  68. StencilPass = Keep;
  69. StencilZFail = Keep;
  70. StencilFail = Keep;
  71. //StencilMask = 0; // To be overridden by code
  72. StencilWriteMask = 0xffffffff;
  73. //StencilRef = 0; // To be overridden by code
  74. AlphaBlendEnable = true;
  75. SrcBlend = SrcAlpha;
  76. DestBlend = InvSrcAlpha;
  77. AlphaTestEnable = false;
  78. }
  79. }