MacroTexture.fxh 939 B

12345678910111213141516171819202122232425262728293031
  1. //////////////////////////////////////////////////////////////////////////////
  2. // ©2008 Electronic Arts Inc
  3. //
  4. // A simple include file that has everything needed to use the macro texture.
  5. //////////////////////////////////////////////////////////////////////////////
  6. float2 MapCellSize
  7. <
  8. string UIWidget = "None";
  9. string SasBindAddress = "Terrain.Map.CellSize";
  10. > = float2(10.0f, 10.0f);
  11. SAMPLER_2D_BEGIN( MacroSampler,
  12. string UIWidget = "None";
  13. string SasBindAddress = "Terrain.MacroTexture";
  14. string ResourceName = "ShaderPreviewMacro.dds";
  15. )
  16. MinFilter = Linear;
  17. MagFilter = Linear;
  18. MipFilter = Linear;
  19. AddressU = Wrap;
  20. AddressV = Wrap;
  21. SAMPLER_2D_END
  22. // ----------------------------------------------------------------------------
  23. float2 CalculateMacroTexCoord(float3 worldPosition)
  24. {
  25. float cloudAndMacroScale = 1.0 / (66.0 * MapCellSize.x);
  26. return worldPosition.xy * float2(cloudAndMacroScale, -cloudAndMacroScale);
  27. }