InTerra_TerrainLit_Splatmap_Includes.hlsl 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #ifdef _LAYERS_TWO
  2. #define _LAYER_COUNT 2
  3. #else
  4. #if defined(_LAYERS_EIGHT) || defined(_LAYERS_SIXTEEN)
  5. #if defined(_LAYERS_EIGHT)
  6. #define _LAYER_COUNT 8
  7. #endif
  8. #ifdef _LAYERS_SIXTEEN
  9. #define _LAYER_COUNT 16
  10. #endif
  11. #else
  12. #define _LAYER_COUNT 4
  13. #endif
  14. #endif
  15. #ifndef _TERRAIN_BLEND_HEIGHT
  16. #define _TERRAIN_BLEND_DENSITY // enable density blending by default and use DiffuseRemap.w to control whether the density blending is enabled for a layer
  17. #endif
  18. #define DECLARE_TERRAIN_LAYER_PROPS(n) \
  19. float4 _Splat##n##_ST; \
  20. float _Metallic##n; \
  21. float _Smoothness##n; \
  22. float _NormalScale##n; \
  23. float4 _DiffuseRemapOffset##n; \
  24. float4 _DiffuseRemapScale##n; \
  25. float4 _MaskMapRemapOffset##n; \
  26. float4 _MaskMapRemapScale##n; \
  27. float _LayerHasMask##n; \
  28. float4 _Mask##n##_TexelSize; \
  29. float4 _Specular##n;
  30. #define DECLARE_TERRAIN_LAYER_PROPS_FIRST_4 \
  31. DECLARE_TERRAIN_LAYER_PROPS(0) \
  32. DECLARE_TERRAIN_LAYER_PROPS(1) \
  33. DECLARE_TERRAIN_LAYER_PROPS(2) \
  34. DECLARE_TERRAIN_LAYER_PROPS(3) \
  35. float4 _Control0_TexelSize; \
  36. #define DECLARE_TERRAIN_LAYER_PROPS_SECOND_4 \
  37. DECLARE_TERRAIN_LAYER_PROPS(4) \
  38. DECLARE_TERRAIN_LAYER_PROPS(5) \
  39. DECLARE_TERRAIN_LAYER_PROPS(6) \
  40. DECLARE_TERRAIN_LAYER_PROPS(7) \
  41. float4 _Control1_TexelSize; \
  42. #if defined(_LAYERS_EIGHT) || defined(_LAYERS_SIXTEEN)
  43. #define UNITY_TERRAIN_CB_VARS \
  44. DECLARE_TERRAIN_LAYER_PROPS_FIRST_4 \
  45. DECLARE_TERRAIN_LAYER_PROPS_SECOND_4 \
  46. DECLARE_TERRAIN_LAYER_PROPS(8) \
  47. DECLARE_TERRAIN_LAYER_PROPS(9) \
  48. DECLARE_TERRAIN_LAYER_PROPS(10) \
  49. DECLARE_TERRAIN_LAYER_PROPS(11) \
  50. float4 _Control2_TexelSize; \
  51. DECLARE_TERRAIN_LAYER_PROPS(12) \
  52. DECLARE_TERRAIN_LAYER_PROPS(13) \
  53. DECLARE_TERRAIN_LAYER_PROPS(14) \
  54. DECLARE_TERRAIN_LAYER_PROPS(15) \
  55. float4 _Control3_TexelSize; \
  56. float _HeightTransition;
  57. #else
  58. #define UNITY_TERRAIN_CB_VARS \
  59. DECLARE_TERRAIN_LAYER_PROPS_FIRST_4 \
  60. float _HeightTransition;
  61. #endif
  62. #define UNITY_TERRAIN_CB_DEBUG_VARS \
  63. float4 _Control0_MipInfo; \
  64. float4 _Splat0_TexelSize; \
  65. float4 _Splat0_MipInfo; \
  66. float4 _Splat1_TexelSize; \
  67. float4 _Splat1_MipInfo; \
  68. float4 _Splat2_TexelSize; \
  69. float4 _Splat2_MipInfo; \
  70. float4 _Splat3_TexelSize; \
  71. float4 _Splat3_MipInfo; \
  72. float4 _Splat4_TexelSize; \
  73. float4 _Splat4_MipInfo; \
  74. float4 _Splat5_TexelSize; \
  75. float4 _Splat5_MipInfo; \
  76. float4 _Splat6_TexelSize; \
  77. float4 _Splat6_MipInfo; \
  78. float4 _Splat7_TexelSize; \
  79. float4 _Splat7_MipInfo;