terrFeatureGLSL.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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 _TERRFEATUREGLSL_H_
  23. #define _TERRFEATUREGLSL_H_
  24. #ifndef _SHADERGEN_GLSL_SHADERFEATUREGLSL_H_
  25. #include "shaderGen/GLSL/shaderFeatureGLSL.h"
  26. #endif
  27. #ifndef _LANG_ELEMENT_H_
  28. #include "shaderGen/langElement.h"
  29. #endif
  30. /// A shared base class for terrain features which
  31. /// includes some helper functions.
  32. class TerrainFeatGLSL : public ShaderFeatureGLSL
  33. {
  34. protected:
  35. Var* _getInDetailCoord(Vector<ShaderComponent*> &componentList );
  36. Var* _getNormalMapTex();
  37. static Var* _getUniformVar( const char *name, const char *type, ConstantSortPosition csp );
  38. Var* _getDetailIdStrengthParallax();
  39. };
  40. class TerrainBaseMapFeatGLSL : public TerrainFeatGLSL
  41. {
  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 Resources getResources( const MaterialFeatureData &fd );
  48. virtual String getName() { return "Terrain Base Texture"; }
  49. };
  50. class TerrainDetailMapFeatGLSL : public TerrainFeatGLSL
  51. {
  52. protected:
  53. ShaderIncludeDependency mTerrainDep;
  54. public:
  55. TerrainDetailMapFeatGLSL();
  56. virtual void processVert( Vector<ShaderComponent*> &componentList,
  57. const MaterialFeatureData &fd );
  58. virtual void processPix( Vector<ShaderComponent*> &componentList,
  59. const MaterialFeatureData &fd );
  60. virtual Resources getResources( const MaterialFeatureData &fd );
  61. virtual String getName() { return "Terrain Detail Texture"; }
  62. };
  63. class TerrainNormalMapFeatGLSL : public TerrainFeatGLSL
  64. {
  65. public:
  66. virtual void processVert( Vector<ShaderComponent*> &componentList,
  67. const MaterialFeatureData &fd );
  68. virtual void processPix( Vector<ShaderComponent*> &componentList,
  69. const MaterialFeatureData &fd );
  70. virtual Resources getResources( const MaterialFeatureData &fd );
  71. virtual String getName() { return "Terrain Normal Texture"; }
  72. };
  73. class TerrainParallaxMapFeatGLSL : public TerrainFeatGLSL
  74. {
  75. protected:
  76. ShaderIncludeDependency mIncludeDep;
  77. public:
  78. TerrainParallaxMapFeatGLSL();
  79. virtual void processVert( Vector<ShaderComponent*> &componentList,
  80. const MaterialFeatureData &fd );
  81. virtual void processPix( Vector<ShaderComponent*> &componentList,
  82. const MaterialFeatureData &fd );
  83. virtual Resources getResources( const MaterialFeatureData &fd );
  84. virtual String getName() { return "Terrain Parallax Texture"; }
  85. };
  86. class TerrainLightMapFeatGLSL : public TerrainFeatGLSL
  87. {
  88. public:
  89. virtual void processPix( Vector<ShaderComponent*> &componentList,
  90. const MaterialFeatureData &fd );
  91. virtual Resources getResources( const MaterialFeatureData &fd );
  92. virtual String getName() { return "Terrain Lightmap Texture"; }
  93. };
  94. class TerrainAdditiveFeatGLSL : public TerrainFeatGLSL
  95. {
  96. public:
  97. virtual void processPix( Vector<ShaderComponent*> &componentList,
  98. const MaterialFeatureData &fd );
  99. virtual String getName() { return "Terrain Additive"; }
  100. };
  101. #endif // _TERRFEATUREGLSL_H_