advancedLightingFeaturesGLSL.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #ifndef _DEFERREDFEATURESGLSL_H_
  23. #define _DEFERREDFEATURESGLSL_H_
  24. #include "shaderGen/GLSL/shaderFeatureGLSL.h"
  25. #include "shaderGen/GLSL/bumpGLSL.h"
  26. #include "shaderGen/GLSL/pixSpecularGLSL.h"
  27. class ConditionerMethodDependency;
  28. /// Lights the pixel by sampling from the light prepass buffer. It will
  29. /// fall back to default vertex lighting functionality if
  30. class DeferredRTLightingFeatGLSL : public RTLightingFeatGLSL
  31. {
  32. typedef RTLightingFeatGLSL Parent;
  33. public:
  34. virtual void processVert( Vector<ShaderComponent*> &componentList,
  35. const MaterialFeatureData &fd );
  36. virtual void processPix( Vector<ShaderComponent*> &componentList,
  37. const MaterialFeatureData &fd );
  38. virtual void processPixMacros( Vector<GFXShaderMacro> &macros,
  39. const MaterialFeatureData &fd );
  40. virtual Material::BlendOp getBlendOp(){ return Material::None; }
  41. virtual Resources getResources( const MaterialFeatureData &fd );
  42. virtual void setTexData( Material::StageData &stageDat,
  43. const MaterialFeatureData &fd,
  44. RenderPassData &passData,
  45. U32 &texIndex );
  46. virtual String getName()
  47. {
  48. return "Deferred RT Lighting Feature";
  49. }
  50. };
  51. /// Used to write the normals during the depth/normal prepass.
  52. class DeferredBumpFeatGLSL : public BumpFeatGLSL
  53. {
  54. typedef BumpFeatGLSL Parent;
  55. public:
  56. virtual void processVert( Vector<ShaderComponent*> &componentList,
  57. const MaterialFeatureData &fd );
  58. virtual void processPix( Vector<ShaderComponent*> &componentList,
  59. const MaterialFeatureData &fd );
  60. virtual Material::BlendOp getBlendOp() { return Material::LerpAlpha; }
  61. virtual Resources getResources( const MaterialFeatureData &fd );
  62. virtual void setTexData( Material::StageData &stageDat,
  63. const MaterialFeatureData &fd,
  64. RenderPassData &passData,
  65. U32 &texIndex );
  66. virtual String getName()
  67. {
  68. return "Bumpmap [Deferred]";
  69. }
  70. };
  71. /// Generates specular highlights in the forward pass
  72. /// from the light prepass buffer.
  73. class DeferredPixelSpecularGLSL : public PixelSpecularGLSL
  74. {
  75. typedef PixelSpecularGLSL Parent;
  76. public:
  77. virtual void processVert( Vector<ShaderComponent*> &componentList,
  78. const MaterialFeatureData &fd );
  79. virtual void processPix( Vector<ShaderComponent*> &componentList,
  80. const MaterialFeatureData &fd );
  81. virtual Resources getResources( const MaterialFeatureData &fd );
  82. virtual String getName()
  83. {
  84. return "Pixel Specular [Deferred]";
  85. }
  86. };
  87. ///
  88. class DeferredMinnaertGLSL : public ShaderFeatureGLSL
  89. {
  90. typedef ShaderFeatureGLSL Parent;
  91. public:
  92. virtual void processPix( Vector<ShaderComponent*> &componentList,
  93. const MaterialFeatureData &fd );
  94. virtual void processVert( Vector<ShaderComponent*> &componentList,
  95. const MaterialFeatureData &fd );
  96. virtual void processPixMacros( Vector<GFXShaderMacro> &macros,
  97. const MaterialFeatureData &fd );
  98. virtual Resources getResources( const MaterialFeatureData &fd );
  99. virtual void setTexData( Material::StageData &stageDat,
  100. const MaterialFeatureData &fd,
  101. RenderPassData &passData,
  102. U32 &texIndex );
  103. virtual String getName()
  104. {
  105. return "Minnaert Shading [Deferred]";
  106. }
  107. };
  108. ///
  109. class DeferredSubSurfaceGLSL : public ShaderFeatureGLSL
  110. {
  111. typedef ShaderFeatureGLSL Parent;
  112. public:
  113. virtual void processPix( Vector<ShaderComponent*> &componentList,
  114. const MaterialFeatureData &fd );
  115. virtual String getName()
  116. {
  117. return "Sub-Surface Approximation [Deferred]";
  118. }
  119. };
  120. #endif // _DEFERREDFEATURESGLSL_H_