PageRenderTime 27ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/ContentSystem/Rendering/Helpers/ShaderUniformNames.cs

#
C# | 219 lines | 51 code | 30 blank | 138 comment | 0 complexity | 6642a6d10aa2e003f78ceb5794296cca MD5 | raw file
Possible License(s): Apache-2.0
  1. namespace Delta.ContentSystem.Rendering.Helpers
  2. {
  3. /// <summary>
  4. /// Defines the names of all uniforms that we support (with properties) in
  5. /// all shaders by the directly by the engine. Every else uniform needs to
  6. /// be handled by the project code itself. Please note that most shaders
  7. /// are very simple and only have very few pixel shader instructions
  8. /// because we need to optimize as much as possible on most mobile
  9. /// devices. There are some complex shaders however for special effects,
  10. /// skinning, water, fog or even using multiple lights or shadow mapping.
  11. /// On faster hardware these can be used to archive great effects.
  12. /// </summary>
  13. public enum ShaderUniformNames
  14. {
  15. #region Global matrices
  16. /// <summary>
  17. /// Global matrices, important for transforming vertices in the vertex
  18. /// shader. We only use optimized matrices, more are not supported!
  19. /// Set in Set2DRenderMatrix and Set3DRenderMatrix.
  20. /// </summary>
  21. World,
  22. /// <summary>
  23. /// Global matrices, important for transforming vertices in the vertex
  24. /// shader. We only use optimized matrices, more are not supported!
  25. /// Set in Set2DRenderMatrix and Set3DRenderMatrix.
  26. /// </summary>
  27. ViewInverse,
  28. /// <summary>
  29. /// Global matrices, important for transforming vertices in the vertex
  30. /// shader. We only use optimized matrices, more are not supported!
  31. /// Set in Set2DRenderMatrix and Set3DRenderMatrix.
  32. /// </summary>
  33. WorldViewProj,
  34. #endregion
  35. #region Skinned matrices
  36. /// <summary>
  37. /// For skinned meshes, this are all the bone matrices, which are
  38. /// updated by the app for each animated meshes and will be applied to
  39. /// all skinned vertices in the vertex shader (if shaders are possible).
  40. /// Set in Set3DRenderMatrix.
  41. /// </summary>
  42. SkinnedMatrices,
  43. #endregion
  44. #region Time
  45. /// <summary>
  46. /// Time for animated shaders, rarely used however. Also set in
  47. /// Set2DRenderMatrix and Set3DRenderMatrix.
  48. /// </summary>
  49. Time,
  50. #endregion
  51. #region Material data
  52. /// <summary>
  53. /// All the material data. Please note that many of these are not used
  54. /// in most shaders, e.g. DirectionalTextured just has DiffuseMap and
  55. /// the LightDirection plus global matrices, that's it, the rest is
  56. /// constant! It is faster and easier to merge materials if the shader
  57. /// uses constants and thus all materials rendered with them are
  58. /// basically the same, they only differ in the DiffuseMap, which is
  59. /// quickly checked.
  60. /// </summary>
  61. DiffuseMap,
  62. /// <summary>
  63. /// Detail map
  64. /// </summary>
  65. DetailMap,
  66. /// <summary>
  67. /// Specular map
  68. /// </summary>
  69. SpecularMap,
  70. /// <summary>
  71. /// Height map
  72. /// </summary>
  73. HeightMap,
  74. /// <summary>
  75. /// Normal map
  76. /// </summary>
  77. NormalMap,
  78. /// <summary>
  79. /// Light map
  80. /// </summary>
  81. LightMap,
  82. /// <summary>
  83. /// Sky cube map
  84. /// </summary>
  85. SkyCubeMap,
  86. /// <summary>
  87. /// Reflection cube map
  88. /// </summary>
  89. ReflectionCubeMap,
  90. /// <summary>
  91. /// Shader lut texture for optimizations
  92. /// </summary>
  93. ShaderLutTexture,
  94. /// <summary>
  95. /// Shadow map
  96. /// </summary>
  97. ShadowMap,
  98. /// <summary>
  99. /// Global ambient color.
  100. /// </summary>
  101. AmbientColor,
  102. /// <summary>
  103. /// Diffise color.
  104. /// </summary>
  105. DiffuseColor,
  106. /*currently all unused and pre-baked in the shader lut texture!
  107. SpecularColor,
  108. SpecularPower,
  109. FresnelPower,
  110. */
  111. #endregion
  112. #region Lighting
  113. /// <summary>
  114. /// Extra data for light shaders, this usually slows down pixel shaders
  115. /// a lot, so mobile shaders rarely use direct lighting. Instead we try
  116. /// to use a directional light source and light maps as much as possible.
  117. /// </summary>
  118. DirectionalLightDirection,
  119. /// <summary>
  120. /// Point lights have a position and a radius, optionally also a color.
  121. /// </summary>
  122. PointLightPosition,
  123. /// <summary>
  124. /// Point lights have a position and a radius, optionally also a color.
  125. /// </summary>
  126. PointLightRadius,
  127. /// <summary>
  128. /// Point lights have a position and a radius, optionally also a color.
  129. /// </summary>
  130. PointLightColor,
  131. /// <summary>
  132. /// We support 0-2 lights, but this is very rare. For more lights,
  133. /// choose the 2 most dominant ones, ignore the rest or if you are
  134. /// really nice, fade them out as you get closer to other light sources.
  135. /// </summary>
  136. PointLightTwoPosition,
  137. /// <summary>
  138. /// We support 0-2 lights, but this is very rare. For more lights,
  139. /// choose the 2 most dominant ones, ignore the rest or if you are
  140. /// really nice, fade them out as you get closer to other light sources.
  141. /// </summary>
  142. PointLightTwoRadius,
  143. /// <summary>
  144. /// We support 0-2 lights, but this is very rare. For more lights,
  145. /// choose the 2 most dominant ones, ignore the rest or if you are
  146. /// really nice, fade them out as you get closer to other light sources.
  147. /// </summary>
  148. PointLightTwoColor,
  149. #endregion
  150. #region Post screen
  151. /// <summary>
  152. /// Extra uniforms for post screen shaders, render-to-texture window size
  153. /// and the resulting texture are required for all post screen shaders.
  154. /// </summary>
  155. PostScreenWindowSize,
  156. /// <summary>
  157. /// Post screen map
  158. /// </summary>
  159. PostScreenMap,
  160. /// <summary>
  161. /// For the last pass we can add this fadeout map to darken the borders
  162. /// </summary>
  163. PostScreenBorderFadeoutMap,
  164. /// <summary>
  165. /// Noise map
  166. /// </summary>
  167. PostScreenNoiseMap,
  168. #endregion
  169. #region Shadow mapping
  170. /// <summary>
  171. /// For shadow mapping we got some extra uniforms. These are only used
  172. /// for shadow mapping algorithms, which is a huge pixel cost for older
  173. /// mobile devices. There stencil shadows or fake shadow blobs make
  174. /// usually more sense, however shadow mapping often looks better.
  175. /// Transformation matrix for converting world position to texture
  176. /// coordinates of the shadow map.
  177. /// </summary>
  178. ShadowMapTransform,
  179. /// <summary>
  180. /// WorldViewProj of the light projection for shadow mapping.
  181. /// </summary>
  182. ShadowMapLightWorldViewProj,
  183. /// <summary>
  184. /// Light view projection bias for shadow mapping.
  185. /// </summary>
  186. ShadowMapLightViewProjectionBias,
  187. #endregion
  188. }
  189. }