Uniforms.hlsl 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. #ifndef D3D11
  2. // D3D9 uniforms (no constant buffers)
  3. #ifdef COMPILEVS
  4. // Vertex shader uniforms
  5. uniform float3 cAmbientStartColor;
  6. uniform float3 cAmbientEndColor;
  7. #ifdef BILLBOARD
  8. uniform float3x3 cBillboardRot;
  9. #endif
  10. uniform float3 cCameraPos;
  11. uniform float3x3 cCameraRot;
  12. uniform float cNearClip;
  13. uniform float cFarClip;
  14. uniform float4 cDepthMode;
  15. uniform float cDeltaTime;
  16. uniform float cElapsedTime;
  17. uniform float3 cFrustumSize;
  18. uniform float4 cGBufferOffsets;
  19. uniform float3 cLightDir;
  20. uniform float4 cLightPos;
  21. uniform float4x3 cModel;
  22. uniform float4x4 cViewProj;
  23. uniform float4 cUOffset;
  24. uniform float4 cVOffset;
  25. uniform float4x3 cZone;
  26. #ifdef SKINNED
  27. uniform float4x3 cSkinMatrices[MAXBONES];
  28. #endif
  29. #ifdef NUMVERTEXLIGHTS
  30. uniform float4 cVertexLights[4*3];
  31. #else
  32. uniform float4x4 cLightMatrices[4];
  33. #endif
  34. #endif
  35. #ifdef COMPILEPS
  36. // Pixel shader uniforms
  37. uniform float3 cAmbientColor;
  38. uniform float3 cCameraPosPS;
  39. uniform float cDeltaTimePS;
  40. uniform float4 cDepthReconstruct;
  41. uniform float cElapsedTimePS;
  42. uniform float4 cFogParams;
  43. uniform float3 cFogColor;
  44. uniform float2 cGBufferInvSize;
  45. uniform float4 cLightColor;
  46. uniform float4 cLightPosPS;
  47. uniform float3 cLightDirPS;
  48. uniform float4 cMatDiffColor;
  49. uniform float3 cMatEmissiveColor;
  50. uniform float3 cMatEnvMapColor;
  51. uniform float4 cMatSpecColor;
  52. uniform float cNearClipPS;
  53. uniform float cFarClipPS;
  54. uniform float4 cShadowCubeAdjust;
  55. uniform float4 cShadowDepthFade;
  56. uniform float2 cShadowIntensity;
  57. uniform float2 cShadowMapInvSize;
  58. uniform float4 cShadowSplits;
  59. uniform float4x4 cLightMatricesPS[4];
  60. #endif
  61. #else
  62. // D3D11 uniforms (using constant buffers)
  63. #ifdef COMPILEVS
  64. // Vertex shader uniforms
  65. cbuffer FrameVS : register(b0)
  66. {
  67. float cDeltaTime;
  68. float cElapsedTime;
  69. }
  70. cbuffer CameraVS : register(b1)
  71. {
  72. float3 cCameraPos;
  73. float3x3 cCameraRot;
  74. float cNearClip;
  75. float cFarClip;
  76. float4 cDepthMode;
  77. float3 cFrustumSize;
  78. float4 cGBufferOffsets;
  79. float4x4 cViewProj;
  80. float4 cClipPlane;
  81. }
  82. cbuffer ZoneVS : register(b2)
  83. {
  84. float3 cAmbientStartColor;
  85. float3 cAmbientEndColor;
  86. float4x3 cZone;
  87. }
  88. cbuffer LightVS : register(b3)
  89. {
  90. float3 cLightDir;
  91. float4 cLightPos;
  92. #ifdef NUMVERTEXLIGHTS
  93. float4 cVertexLights[4 * 3];
  94. #else
  95. float4x4 cLightMatrices[4];
  96. #endif
  97. }
  98. #ifndef CUSTOM_MATERIAL_CBUFFER
  99. cbuffer MaterialVS : register(b4)
  100. {
  101. float4 cUOffset;
  102. float4 cVOffset;
  103. }
  104. #endif
  105. cbuffer ObjectVS : register(b5)
  106. {
  107. float4x3 cModel;
  108. #ifdef BILLBOARD
  109. float3x3 cBillboardRot;
  110. #endif
  111. #ifdef SKINNED
  112. uniform float4x3 cSkinMatrices[MAXBONES];
  113. #endif
  114. }
  115. #endif
  116. #ifdef COMPILEPS
  117. // Pixel shader uniforms
  118. cbuffer FramePS : register(b0)
  119. {
  120. float cDeltaTimePS;
  121. float cElapsedTimePS;
  122. }
  123. cbuffer CameraPS : register(b1)
  124. {
  125. float3 cCameraPosPS;
  126. float4 cDepthReconstruct;
  127. float2 cGBufferInvSize;
  128. float cNearClipPS;
  129. float cFarClipPS;
  130. }
  131. cbuffer ZonePS : register(b2)
  132. {
  133. float3 cAmbientColor;
  134. float4 cFogParams;
  135. float3 cFogColor;
  136. }
  137. cbuffer LightPS : register(b3)
  138. {
  139. float4 cLightColor;
  140. float4 cLightPosPS;
  141. float3 cLightDirPS;
  142. float4 cShadowCubeAdjust;
  143. float4 cShadowDepthFade;
  144. float2 cShadowIntensity;
  145. float2 cShadowMapInvSize;
  146. float4 cShadowSplits;
  147. float4x4 cLightMatricesPS[4];
  148. }
  149. #ifndef CUSTOM_MATERIAL_CBUFFER
  150. cbuffer MaterialPS : register(b4)
  151. {
  152. float4 cMatDiffColor;
  153. float3 cMatEmissiveColor;
  154. float3 cMatEnvMapColor;
  155. float4 cMatSpecColor;
  156. }
  157. #endif
  158. #endif
  159. #endif