advancedLightingFeaturesGLSL.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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
  29. /// buffer. It will fall back to forward lighting
  30. /// functionality for non-deferred rendered surfaces.
  31. ///
  32. /// Also note that this feature is only used in the
  33. /// forward rendering pass. It is not used during the
  34. /// prepass step.
  35. ///
  36. class DeferredRTLightingFeatGLSL : public RTLightingFeatGLSL
  37. {
  38. typedef RTLightingFeatGLSL Parent;
  39. protected:
  40. /// @see DeferredRTLightingFeatHLSL::processPix()
  41. U32 mLastTexIndex;
  42. public:
  43. virtual void processVert( Vector<ShaderComponent*> &componentList,
  44. const MaterialFeatureData &fd );
  45. virtual void processPix( Vector<ShaderComponent*> &componentList,
  46. const MaterialFeatureData &fd );
  47. virtual void processPixMacros( Vector<GFXShaderMacro> &macros,
  48. const MaterialFeatureData &fd );
  49. virtual Material::BlendOp getBlendOp(){ return Material::None; }
  50. virtual Resources getResources( const MaterialFeatureData &fd );
  51. virtual void setTexData( Material::StageData &stageDat,
  52. const MaterialFeatureData &fd,
  53. RenderPassData &passData,
  54. U32 &texIndex );
  55. virtual String getName()
  56. {
  57. return "Deferred RT Lighting";
  58. }
  59. };
  60. /// This is used during the
  61. class DeferredBumpFeatGLSL : public BumpFeatGLSL
  62. {
  63. typedef BumpFeatGLSL Parent;
  64. public:
  65. virtual void processVert( Vector<ShaderComponent*> &componentList,
  66. const MaterialFeatureData &fd );
  67. virtual void processPix( Vector<ShaderComponent*> &componentList,
  68. const MaterialFeatureData &fd );
  69. virtual Material::BlendOp getBlendOp() { return Material::LerpAlpha; }
  70. virtual Resources getResources( const MaterialFeatureData &fd );
  71. virtual void setTexData( Material::StageData &stageDat,
  72. const MaterialFeatureData &fd,
  73. RenderPassData &passData,
  74. U32 &texIndex );
  75. virtual String getName()
  76. {
  77. return "Bumpmap [Deferred]";
  78. }
  79. };
  80. /// Generates specular highlights in the forward pass
  81. /// from the light prepass buffer.
  82. class DeferredPixelSpecularGLSL : public PixelSpecularGLSL
  83. {
  84. typedef PixelSpecularGLSL Parent;
  85. public:
  86. virtual void processVert( Vector<ShaderComponent*> &componentList,
  87. const MaterialFeatureData &fd );
  88. virtual void processPix( Vector<ShaderComponent*> &componentList,
  89. const MaterialFeatureData &fd );
  90. virtual Resources getResources( const MaterialFeatureData &fd );
  91. virtual String getName()
  92. {
  93. return "Pixel Specular [Deferred]";
  94. }
  95. };
  96. ///
  97. class DeferredMinnaertGLSL : public ShaderFeatureGLSL
  98. {
  99. typedef ShaderFeatureGLSL Parent;
  100. public:
  101. virtual void processPix( Vector<ShaderComponent*> &componentList,
  102. const MaterialFeatureData &fd );
  103. virtual void processVert( Vector<ShaderComponent*> &componentList,
  104. const MaterialFeatureData &fd );
  105. virtual void processPixMacros( Vector<GFXShaderMacro> &macros,
  106. const MaterialFeatureData &fd );
  107. virtual Resources getResources( const MaterialFeatureData &fd );
  108. virtual void setTexData( Material::StageData &stageDat,
  109. const MaterialFeatureData &fd,
  110. RenderPassData &passData,
  111. U32 &texIndex );
  112. virtual String getName()
  113. {
  114. return "Minnaert Shading [Deferred]";
  115. }
  116. };
  117. ///
  118. class DeferredSubSurfaceGLSL : public ShaderFeatureGLSL
  119. {
  120. typedef ShaderFeatureGLSL Parent;
  121. public:
  122. virtual void processPix( Vector<ShaderComponent*> &componentList,
  123. const MaterialFeatureData &fd );
  124. virtual String getName()
  125. {
  126. return "Sub-Surface Approximation [Deferred]";
  127. }
  128. };
  129. #endif // _DEFERREDFEATURESGLSL_H_