advancedLightingFeaturesHLSL.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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 _DEFERREDFEATURESHLSL_H_
  23. #define _DEFERREDFEATURESHLSL_H_
  24. #include "shaderGen/HLSL/shaderFeatureHLSL.h"
  25. #include "shaderGen/HLSL/bumpHLSL.h"
  26. class ConditionerMethodDependency;
  27. /// Lights the pixel by sampling from the light deferred
  28. /// buffer. It will fall back to forward lighting
  29. /// functionality for non-deferred rendered surfaces.
  30. ///
  31. /// Also note that this feature is only used in the
  32. /// forward rendering pass. It is not used during the
  33. /// deferred step.
  34. ///
  35. class DeferredRTLightingFeatHLSL : public RTLightingFeatHLSL
  36. {
  37. typedef RTLightingFeatHLSL Parent;
  38. protected:
  39. /// @see DeferredRTLightingFeatHLSL::processPix()
  40. U32 mLastTexIndex;
  41. public:
  42. virtual void processVert( Vector<ShaderComponent*> &componentList,
  43. const MaterialFeatureData &fd );
  44. virtual void processPix( Vector<ShaderComponent*> &componentList,
  45. const MaterialFeatureData &fd );
  46. virtual void processPixMacros( Vector<GFXShaderMacro> &macros,
  47. const MaterialFeatureData &fd );
  48. virtual Material::BlendOp getBlendOp(){ return Material::None; }
  49. virtual Resources getResources( const MaterialFeatureData &fd );
  50. virtual void setTexData( Material::StageData &stageDat,
  51. const MaterialFeatureData &fd,
  52. RenderPassData &passData,
  53. U32 &texIndex );
  54. virtual String getName()
  55. {
  56. return "Deferred RT Lighting";
  57. }
  58. };
  59. /// This is used during the
  60. class DeferredBumpFeatHLSL : public BumpFeatHLSL
  61. {
  62. typedef BumpFeatHLSL Parent;
  63. public:
  64. virtual void processVert( Vector<ShaderComponent*> &componentList,
  65. const MaterialFeatureData &fd );
  66. virtual void processPix( Vector<ShaderComponent*> &componentList,
  67. const MaterialFeatureData &fd );
  68. virtual Material::BlendOp getBlendOp() { return Material::LerpAlpha; }
  69. virtual Resources getResources( const MaterialFeatureData &fd );
  70. virtual void setTexData( Material::StageData &stageDat,
  71. const MaterialFeatureData &fd,
  72. RenderPassData &passData,
  73. U32 &texIndex );
  74. virtual String getName()
  75. {
  76. return "Bumpmap [Deferred]";
  77. }
  78. };
  79. ///
  80. class DeferredMinnaertHLSL : public ShaderFeatureHLSL
  81. {
  82. typedef ShaderFeatureHLSL Parent;
  83. public:
  84. virtual void processPix( Vector<ShaderComponent*> &componentList,
  85. const MaterialFeatureData &fd );
  86. virtual void processVert( Vector<ShaderComponent*> &componentList,
  87. const MaterialFeatureData &fd );
  88. virtual void processPixMacros( Vector<GFXShaderMacro> &macros,
  89. const MaterialFeatureData &fd );
  90. virtual Resources getResources( const MaterialFeatureData &fd );
  91. virtual void setTexData( Material::StageData &stageDat,
  92. const MaterialFeatureData &fd,
  93. RenderPassData &passData,
  94. U32 &texIndex );
  95. virtual String getName()
  96. {
  97. return "Minnaert Shading [Deferred]";
  98. }
  99. };
  100. ///
  101. class DeferredSubSurfaceHLSL : public ShaderFeatureHLSL
  102. {
  103. typedef ShaderFeatureHLSL Parent;
  104. public:
  105. virtual void processPix( Vector<ShaderComponent*> &componentList,
  106. const MaterialFeatureData &fd );
  107. virtual String getName()
  108. {
  109. return "Sub-Surface Approximation [Deferred]";
  110. }
  111. };
  112. #endif // _DEFERREDFEATURESHLSL_H_