advancedLightingFeaturesHLSL.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. #include "shaderGen/HLSL/pixSpecularHLSL.h"
  27. class ConditionerMethodDependency;
  28. /// Lights the pixel by sampling from the light deferred
  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. /// deferred step.
  35. ///
  36. class DeferredRTLightingFeatHLSL : public RTLightingFeatHLSL
  37. {
  38. typedef RTLightingFeatHLSL 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 DeferredBumpFeatHLSL : public BumpFeatHLSL
  62. {
  63. typedef BumpFeatHLSL 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. ///
  81. class DeferredMinnaertHLSL : public ShaderFeatureHLSL
  82. {
  83. typedef ShaderFeatureHLSL Parent;
  84. public:
  85. virtual void processPix( Vector<ShaderComponent*> &componentList,
  86. const MaterialFeatureData &fd );
  87. virtual void processVert( Vector<ShaderComponent*> &componentList,
  88. const MaterialFeatureData &fd );
  89. virtual void processPixMacros( Vector<GFXShaderMacro> &macros,
  90. const MaterialFeatureData &fd );
  91. virtual Resources getResources( const MaterialFeatureData &fd );
  92. virtual void setTexData( Material::StageData &stageDat,
  93. const MaterialFeatureData &fd,
  94. RenderPassData &passData,
  95. U32 &texIndex );
  96. virtual String getName()
  97. {
  98. return "Minnaert Shading [Deferred]";
  99. }
  100. };
  101. ///
  102. class DeferredSubSurfaceHLSL : public ShaderFeatureHLSL
  103. {
  104. typedef ShaderFeatureHLSL Parent;
  105. public:
  106. virtual void processPix( Vector<ShaderComponent*> &componentList,
  107. const MaterialFeatureData &fd );
  108. virtual String getName()
  109. {
  110. return "Sub-Surface Approximation [Deferred]";
  111. }
  112. };
  113. #endif // _DEFERREDFEATURESHLSL_H_