shaderGenGLSLInit.cpp 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. #include "platform/platform.h"
  23. #include "shaderGen/shaderGen.h"
  24. #include "shaderGen/GLSL/shaderGenGLSL.h"
  25. #include "shaderGen/GLSL/shaderFeatureGLSL.h"
  26. #include "shaderGen/featureMgr.h"
  27. #include "shaderGen/GLSL/bumpGLSL.h"
  28. #include "shaderGen/GLSL/depthGLSL.h"
  29. #include "shaderGen/GLSL/paraboloidGLSL.h"
  30. #include "materials/materialFeatureTypes.h"
  31. #include "core/module.h"
  32. #include "shaderGen/GLSL/accuFeatureGLSL.h"
  33. // Deferred Shading
  34. #include "lighting/advanced/glsl/deferredShadingFeaturesGLSL.h"
  35. static ShaderGen::ShaderGenInitDelegate sInitDelegate;
  36. void _initShaderGenGLSL( ShaderGen *shaderGen )
  37. {
  38. shaderGen->setPrinter( new ShaderGenPrinterGLSL );
  39. shaderGen->setComponentFactory( new ShaderGenComponentFactoryGLSL );
  40. shaderGen->setFileEnding( "glsl" );
  41. FEATUREMGR->registerFeature( MFT_VertTransform, new VertPositionGLSL );
  42. FEATUREMGR->registerFeature( MFT_RTLighting, new RTLightingFeatGLSL );
  43. FEATUREMGR->registerFeature( MFT_IsBC3nm, new NamedFeatureGLSL( "BC3nm" ) );
  44. FEATUREMGR->registerFeature( MFT_IsBC5nm, new NamedFeatureGLSL( "BC5nm" ) );
  45. FEATUREMGR->registerFeature( MFT_TexAnim, new TexAnimGLSL );
  46. FEATUREMGR->registerFeature( MFT_DiffuseMap, new DiffuseMapFeatGLSL );
  47. FEATUREMGR->registerFeature( MFT_OverlayMap, new OverlayTexFeatGLSL );
  48. FEATUREMGR->registerFeature( MFT_DiffuseColor, new DiffuseFeatureGLSL );
  49. FEATUREMGR->registerFeature( MFT_DiffuseVertColor, new DiffuseVertColorFeatureGLSL );
  50. FEATUREMGR->registerFeature( MFT_AlphaTest, new AlphaTestGLSL );
  51. FEATUREMGR->registerFeature( MFT_GlowMask, new GlowMaskGLSL );
  52. FEATUREMGR->registerFeature( MFT_LightMap, new LightmapFeatGLSL );
  53. FEATUREMGR->registerFeature( MFT_ToneMap, new TonemapFeatGLSL );
  54. FEATUREMGR->registerFeature( MFT_VertLit, new VertLitGLSL );
  55. FEATUREMGR->registerFeature( MFT_Parallax, new ParallaxFeatGLSL );
  56. FEATUREMGR->registerFeature( MFT_NormalMap, new BumpFeatGLSL );
  57. FEATUREMGR->registerFeature( MFT_DetailNormalMap, new NamedFeatureGLSL( "Detail Normal Map" ) );
  58. FEATUREMGR->registerFeature( MFT_DetailMap, new DetailFeatGLSL );
  59. FEATUREMGR->registerFeature( MFT_StaticCubemap, new NamedFeatureGLSL( "Static Cubemap" ) );
  60. FEATUREMGR->registerFeature( MFT_CubeMap, new ReflectCubeFeatGLSL );
  61. FEATUREMGR->registerFeature( MFT_InvertRoughness, new NamedFeatureGLSL("Roughest = 1.0"));
  62. FEATUREMGR->registerFeature( MFT_AccuMap, new AccuTexFeatGLSL );
  63. FEATUREMGR->registerFeature( MFT_IsTranslucent, new NamedFeatureGLSL( "Translucent" ) );
  64. FEATUREMGR->registerFeature( MFT_IsTranslucentZWrite, new NamedFeatureGLSL( "Translucent ZWrite" ) );
  65. FEATUREMGR->registerFeature( MFT_Visibility, new VisibilityFeatGLSL );
  66. FEATUREMGR->registerFeature( MFT_Fog, new FogFeatGLSL );
  67. FEATUREMGR->registerFeature( MFT_LightbufferMRT, new NamedFeatureGLSL( "Lightbuffer MRT" ) );
  68. FEATUREMGR->registerFeature( MFT_RenderTarget1_Zero, new RenderTargetZeroGLSL( ShaderFeature::RenderTarget1 ) );
  69. FEATUREMGR->registerFeature( MFT_RenderTarget2_Zero, new RenderTargetZeroGLSL( ShaderFeature::RenderTarget2 ) );
  70. FEATUREMGR->registerFeature( MFT_RenderTarget3_Zero, new RenderTargetZeroGLSL( ShaderFeature::RenderTarget3 ) );
  71. FEATUREMGR->registerFeature( MFT_Imposter, new NamedFeatureGLSL( "Imposter" ) );
  72. FEATUREMGR->registerFeature( MFT_NormalsOut, new NormalsOutFeatGLSL );
  73. FEATUREMGR->registerFeature( MFT_DepthOut, new DepthOutGLSL );
  74. FEATUREMGR->registerFeature(MFT_EyeSpaceDepthOut, new EyeSpaceDepthOutGLSL());
  75. FEATUREMGR->registerFeature( MFT_HDROut, new HDROutGLSL );
  76. FEATUREMGR->registerFeature( MFT_ParaboloidVertTransform, new ParaboloidVertTransformGLSL );
  77. FEATUREMGR->registerFeature( MFT_IsSinglePassParaboloid, new NamedFeatureGLSL( "Single Pass Paraboloid" ) );
  78. FEATUREMGR->registerFeature( MFT_UseInstancing, new NamedFeatureGLSL( "Hardware Instancing" ) );
  79. FEATUREMGR->registerFeature( MFT_DiffuseMapAtlas, new NamedFeatureGLSL( "Diffuse Map Atlas" ) );
  80. FEATUREMGR->registerFeature( MFT_NormalMapAtlas, new NamedFeatureGLSL( "Normal Map Atlas" ) );
  81. FEATUREMGR->registerFeature( MFT_Foliage, new FoliageFeatureGLSL );
  82. FEATUREMGR->registerFeature( MFT_ParticleNormal, new ParticleNormalFeatureGLSL );
  83. FEATUREMGR->registerFeature( MFT_ForwardShading, new NamedFeatureGLSL( "Forward Shaded Material" ) );
  84. FEATUREMGR->registerFeature( MFT_ImposterVert, new ImposterVertFeatureGLSL );
  85. // Deferred Shading
  86. FEATUREMGR->registerFeature( MFT_isDeferred, new NamedFeatureGLSL( "Deferred Material" ) );
  87. FEATUREMGR->registerFeature( MFT_OrmMap, new DeferredOrmMapGLSL );
  88. FEATUREMGR->registerFeature( MFT_ORMConfigVars, new ORMConfigVarsGLSL );
  89. FEATUREMGR->registerFeature( MFT_MatInfoFlags, new MatInfoFlagsGLSL );
  90. FEATUREMGR->registerFeature( MFT_GlowMap, new GlowMapGLSL);
  91. FEATUREMGR->registerFeature( MFT_isBackground, new NamedFeatureGLSL("Background Object"));
  92. FEATUREMGR->registerFeature( MFT_SkyBox, new NamedFeatureGLSL( "skybox" ) );
  93. FEATUREMGR->registerFeature( MFT_HardwareSkinning, new HardwareSkinningFeatureGLSL );
  94. }
  95. MODULE_BEGIN( ShaderGenGLSL )
  96. MODULE_INIT_AFTER( ShaderGen )
  97. MODULE_INIT_AFTER( ShaderGenFeatureMgr )
  98. MODULE_INIT
  99. {
  100. sInitDelegate.bind( &_initShaderGenGLSL );
  101. SHADERGEN->registerInitDelegate(OpenGL, sInitDelegate);
  102. }
  103. MODULE_END;