Torque3D Documentation / _generateds / shaderGenGLSLInit.cpp

shaderGenGLSLInit.cpp

Engine/source/shaderGen/GLSL/shaderGenGLSLInit.cpp

More...

Public Functions

Detailed Description

Public Variables

 MODULE_END 
 MODULE_INIT 
ShaderGen::ShaderGenInitDelegate sInitDelegate 

Public Functions

_initShaderGenGLSL(ShaderGen * shaderGen)

registerInitDelegate(OpenGL , sInitDelegate )

  1
  2//-----------------------------------------------------------------------------
  3// Copyright (c) 2012 GarageGames, LLC
  4//
  5// Permission is hereby granted, free of charge, to any person obtaining a copy
  6// of this software and associated documentation files (the "Software"), to
  7// deal in the Software without restriction, including without limitation the
  8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9// sell copies of the Software, and to permit persons to whom the Software is
 10// furnished to do so, subject to the following conditions:
 11//
 12// The above copyright notice and this permission notice shall be included in
 13// all copies or substantial portions of the Software.
 14//
 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 21// IN THE SOFTWARE.
 22//-----------------------------------------------------------------------------
 23
 24#include "platform/platform.h"
 25
 26#include "shaderGen/shaderGen.h"
 27#include "shaderGen/GLSL/shaderGenGLSL.h"
 28#include "shaderGen/GLSL/shaderFeatureGLSL.h"
 29#include "shaderGen/featureMgr.h"
 30#include "shaderGen/GLSL/bumpGLSL.h"
 31#include "shaderGen/GLSL/depthGLSL.h"
 32#include "shaderGen/GLSL/paraboloidGLSL.h"
 33#include "materials/materialFeatureTypes.h"
 34#include "core/module.h"
 35#include "shaderGen/GLSL/accuFeatureGLSL.h"
 36
 37// Deferred Shading
 38#include "lighting/advanced/glsl/deferredShadingFeaturesGLSL.h"
 39
 40static ShaderGen::ShaderGenInitDelegate sInitDelegate;
 41
 42void _initShaderGenGLSL( ShaderGen *shaderGen )
 43{
 44   shaderGen->setPrinter( new ShaderGenPrinterGLSL );
 45   shaderGen->setComponentFactory( new ShaderGenComponentFactoryGLSL );
 46   shaderGen->setFileEnding( "glsl" );
 47
 48   FEATUREMGR->registerFeature( MFT_VertTransform, new VertPositionGLSL );
 49   FEATUREMGR->registerFeature( MFT_RTLighting, new RTLightingFeatGLSL );
 50   FEATUREMGR->registerFeature( MFT_IsBC3nm, new NamedFeatureGLSL( "BC3nm" ) );
 51   FEATUREMGR->registerFeature( MFT_IsBC5nm, new NamedFeatureGLSL( "BC5nm" ) );
 52   FEATUREMGR->registerFeature( MFT_TexAnim, new TexAnimGLSL );
 53   FEATUREMGR->registerFeature( MFT_DiffuseMap, new DiffuseMapFeatGLSL );
 54   FEATUREMGR->registerFeature( MFT_OverlayMap, new OverlayTexFeatGLSL );
 55   FEATUREMGR->registerFeature( MFT_DiffuseColor, new DiffuseFeatureGLSL );
 56   FEATUREMGR->registerFeature( MFT_DiffuseVertColor, new DiffuseVertColorFeatureGLSL );
 57   FEATUREMGR->registerFeature( MFT_AlphaTest, new AlphaTestGLSL );
 58   FEATUREMGR->registerFeature( MFT_GlowMask, new GlowMaskGLSL );
 59   FEATUREMGR->registerFeature( MFT_LightMap, new LightmapFeatGLSL );
 60   FEATUREMGR->registerFeature( MFT_ToneMap, new TonemapFeatGLSL );
 61   FEATUREMGR->registerFeature( MFT_VertLit, new VertLitGLSL );
 62   FEATUREMGR->registerFeature( MFT_Parallax, new ParallaxFeatGLSL );
 63   FEATUREMGR->registerFeature( MFT_NormalMap, new BumpFeatGLSL );
 64   FEATUREMGR->registerFeature( MFT_DetailNormalMap, new NamedFeatureGLSL( "Detail Normal Map" ) );
 65   FEATUREMGR->registerFeature( MFT_DetailMap, new DetailFeatGLSL );
 66   FEATUREMGR->registerFeature( MFT_StaticCubemap, new NamedFeatureGLSL( "Static Cubemap" ) );
 67   FEATUREMGR->registerFeature( MFT_CubeMap, new ReflectCubeFeatGLSL );
 68   FEATUREMGR->registerFeature( MFT_InvertRoughness, new NamedFeatureGLSL("Roughest = 1.0"));
 69   FEATUREMGR->registerFeature( MFT_AccuMap, new AccuTexFeatGLSL );
 70   FEATUREMGR->registerFeature( MFT_IsTranslucent, new NamedFeatureGLSL( "Translucent" ) );
 71   FEATUREMGR->registerFeature( MFT_IsTranslucentZWrite, new NamedFeatureGLSL( "Translucent ZWrite" ) );
 72   FEATUREMGR->registerFeature( MFT_Visibility, new VisibilityFeatGLSL );
 73   FEATUREMGR->registerFeature( MFT_Fog, new FogFeatGLSL );
 74   FEATUREMGR->registerFeature( MFT_LightbufferMRT, new NamedFeatureGLSL( "Lightbuffer MRT" ) );
 75   FEATUREMGR->registerFeature( MFT_RenderTarget1_Zero, new RenderTargetZeroGLSL( ShaderFeature::RenderTarget1 ) );
 76   FEATUREMGR->registerFeature( MFT_RenderTarget2_Zero, new RenderTargetZeroGLSL( ShaderFeature::RenderTarget2 ) );
 77   FEATUREMGR->registerFeature( MFT_RenderTarget3_Zero, new RenderTargetZeroGLSL( ShaderFeature::RenderTarget3 ) );
 78   FEATUREMGR->registerFeature( MFT_Imposter, new NamedFeatureGLSL( "Imposter" ) );
 79
 80   FEATUREMGR->registerFeature( MFT_NormalsOut, new NormalsOutFeatGLSL );
 81   
 82   FEATUREMGR->registerFeature( MFT_DepthOut, new DepthOutGLSL );
 83   FEATUREMGR->registerFeature(MFT_EyeSpaceDepthOut, new EyeSpaceDepthOutGLSL());
 84
 85   FEATUREMGR->registerFeature( MFT_HDROut, new HDROutGLSL );
 86   
 87   FEATUREMGR->registerFeature( MFT_ParaboloidVertTransform, new ParaboloidVertTransformGLSL );
 88   FEATUREMGR->registerFeature( MFT_IsSinglePassParaboloid, new NamedFeatureGLSL( "Single Pass Paraboloid" ) );
 89   FEATUREMGR->registerFeature( MFT_UseInstancing, new NamedFeatureGLSL( "Hardware Instancing" ) );
 90   
 91   FEATUREMGR->registerFeature( MFT_DiffuseMapAtlas, new NamedFeatureGLSL( "Diffuse Map Atlas" ) );
 92   FEATUREMGR->registerFeature( MFT_NormalMapAtlas, new NamedFeatureGLSL( "Normal Map Atlas" ) );
 93
 94   FEATUREMGR->registerFeature( MFT_Foliage, new FoliageFeatureGLSL );
 95   
 96   FEATUREMGR->registerFeature( MFT_ParticleNormal, new ParticleNormalFeatureGLSL );
 97   FEATUREMGR->registerFeature( MFT_ForwardShading, new NamedFeatureGLSL( "Forward Shaded Material" ) );
 98
 99   FEATUREMGR->registerFeature( MFT_ImposterVert, new ImposterVertFeatureGLSL );
100
101   // Deferred Shading
102   FEATUREMGR->registerFeature( MFT_isDeferred, new NamedFeatureGLSL( "Deferred Material" ) );
103   FEATUREMGR->registerFeature( MFT_OrmMap, new DeferredOrmMapGLSL );
104   FEATUREMGR->registerFeature( MFT_ORMConfigVars, new ORMConfigVarsGLSL );
105   FEATUREMGR->registerFeature( MFT_MatInfoFlags, new MatInfoFlagsGLSL );
106   FEATUREMGR->registerFeature( MFT_GlowMap, new GlowMapGLSL);
107   FEATUREMGR->registerFeature( MFT_isBackground, new NamedFeatureGLSL("Background Object"));
108   FEATUREMGR->registerFeature( MFT_SkyBox, new NamedFeatureGLSL( "skybox" ) );
109   FEATUREMGR->registerFeature( MFT_HardwareSkinning, new HardwareSkinningFeatureGLSL );
110}
111
112MODULE_BEGIN( ShaderGenGLSL )
113
114   MODULE_INIT_AFTER( ShaderGen )
115   MODULE_INIT_AFTER( ShaderGenFeatureMgr )
116   
117   MODULE_INIT
118   {
119      sInitDelegate.bind( &_initShaderGenGLSL );
120      SHADERGEN->registerInitDelegate(OpenGL, sInitDelegate);   
121   }
122   
123MODULE_END;
124