Merge pull request #2055 from Areloch/CommonShaderPath_Improvement

Reworks the $Core::commonShaderPath variable usage
This commit is contained in:
Areloch 2017-08-04 00:58:34 -05:00 committed by GitHub
commit 18c60df4b2
17 changed files with 65 additions and 55 deletions

View file

@ -960,7 +960,7 @@ const char *getObjectTokenField(const char *name)
return NULL; return NULL;
} }
const char *getVariable(const char *name) const char *getVariable(const char *name, const char* def)
{ {
const char *objField = getObjectTokenField(name); const char *objField = getObjectTokenField(name);
if (objField) if (objField)
@ -970,7 +970,7 @@ const char *getVariable(const char *name)
else else
{ {
Dictionary::Entry *entry = getVariableEntry(name); Dictionary::Entry *entry = getVariableEntry(name);
return entry ? entry->getStringValue() : ""; return entry ? entry->getStringValue() : def;
} }
} }

View file

@ -620,7 +620,7 @@ namespace Con
/// Retrieve the string value of a global console variable /// Retrieve the string value of a global console variable
/// @param name Global Console variable name to query /// @param name Global Console variable name to query
/// @return The string value of the variable or "" if the variable does not exist. /// @return The string value of the variable or "" if the variable does not exist.
const char* getVariable(const char* name); const char* getVariable(const char* name, const char* def = "");
/// Retrieve the string value of an object field /// Retrieve the string value of an object field
/// @param name "object.field" string to query /// @param name "object.field" string to query

View file

@ -60,7 +60,7 @@ MODULE_END;
WindDeformationGLSL::WindDeformationGLSL() WindDeformationGLSL::WindDeformationGLSL()
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/wind.glsl" )) : mDep(ShaderGen::smCommonShaderPath + String("/gl/wind.glsl" ))
{ {
addDependency( &mDep ); addDependency( &mDep );
} }

View file

@ -60,7 +60,7 @@ MODULE_END;
WindDeformationHLSL::WindDeformationHLSL() WindDeformationHLSL::WindDeformationHLSL()
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/wind.hlsl" )) : mDep(ShaderGen::smCommonShaderPath + String("/wind.hlsl" ))
{ {
addDependency( &mDep ); addDependency( &mDep );
} }

View file

@ -37,6 +37,7 @@
#include "windowManager/platformWindow.h" #include "windowManager/platformWindow.h"
#include "gfx/D3D11/screenshotD3D11.h" #include "gfx/D3D11/screenshotD3D11.h"
#include "materials/shaderData.h" #include "materials/shaderData.h"
#include "shaderGen/shaderGen.h"
#ifdef TORQUE_DEBUG #ifdef TORQUE_DEBUG
#include "d3d11sdklayers.h" #include "d3d11sdklayers.h"
@ -838,8 +839,8 @@ void GFXD3D11Device::setupGenericShaders(GenericShaderType type)
//shader model 4.0 is enough for the generic shaders //shader model 4.0 is enough for the generic shaders
const char* shaderModel = "4.0"; const char* shaderModel = "4.0";
shaderData = new ShaderData(); shaderData = new ShaderData();
shaderData->setField("DXVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/colorV.hlsl")); shaderData->setField("DXVertexShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/colorV.hlsl"));
shaderData->setField("DXPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/colorP.hlsl")); shaderData->setField("DXPixelShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/colorP.hlsl"));
shaderData->setField("pixVersion", shaderModel); shaderData->setField("pixVersion", shaderModel);
shaderData->registerObject(); shaderData->registerObject();
mGenericShader[GSColor] = shaderData->getShader(); mGenericShader[GSColor] = shaderData->getShader();
@ -848,8 +849,8 @@ void GFXD3D11Device::setupGenericShaders(GenericShaderType type)
Sim::getRootGroup()->addObject(shaderData); Sim::getRootGroup()->addObject(shaderData);
shaderData = new ShaderData(); shaderData = new ShaderData();
shaderData->setField("DXVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/modColorTextureV.hlsl")); shaderData->setField("DXVertexShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/modColorTextureV.hlsl"));
shaderData->setField("DXPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/modColorTextureP.hlsl")); shaderData->setField("DXPixelShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/modColorTextureP.hlsl"));
shaderData->setField("pixVersion", shaderModel); shaderData->setField("pixVersion", shaderModel);
shaderData->registerObject(); shaderData->registerObject();
mGenericShader[GSModColorTexture] = shaderData->getShader(); mGenericShader[GSModColorTexture] = shaderData->getShader();
@ -858,8 +859,8 @@ void GFXD3D11Device::setupGenericShaders(GenericShaderType type)
Sim::getRootGroup()->addObject(shaderData); Sim::getRootGroup()->addObject(shaderData);
shaderData = new ShaderData(); shaderData = new ShaderData();
shaderData->setField("DXVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/addColorTextureV.hlsl")); shaderData->setField("DXVertexShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/addColorTextureV.hlsl"));
shaderData->setField("DXPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/addColorTextureP.hlsl")); shaderData->setField("DXPixelShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/addColorTextureP.hlsl"));
shaderData->setField("pixVersion", shaderModel); shaderData->setField("pixVersion", shaderModel);
shaderData->registerObject(); shaderData->registerObject();
mGenericShader[GSAddColorTexture] = shaderData->getShader(); mGenericShader[GSAddColorTexture] = shaderData->getShader();
@ -868,8 +869,8 @@ void GFXD3D11Device::setupGenericShaders(GenericShaderType type)
Sim::getRootGroup()->addObject(shaderData); Sim::getRootGroup()->addObject(shaderData);
shaderData = new ShaderData(); shaderData = new ShaderData();
shaderData->setField("DXVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/textureV.hlsl")); shaderData->setField("DXVertexShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/textureV.hlsl"));
shaderData->setField("DXPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/textureP.hlsl")); shaderData->setField("DXPixelShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/textureP.hlsl"));
shaderData->setField("pixVersion", shaderModel); shaderData->setField("pixVersion", shaderModel);
shaderData->registerObject(); shaderData->registerObject();
mGenericShader[GSTexture] = shaderData->getShader(); mGenericShader[GSTexture] = shaderData->getShader();

View file

@ -46,6 +46,7 @@
#include "gfx/gl/gfxGLStateCache.h" #include "gfx/gl/gfxGLStateCache.h"
#include "gfx/gl/gfxGLVertexAttribLocation.h" #include "gfx/gl/gfxGLVertexAttribLocation.h"
#include "gfx/gl/gfxGLVertexDecl.h" #include "gfx/gl/gfxGLVertexDecl.h"
#include "shaderGen/shaderGen.h"
GFXAdapter::CreateDeviceInstanceDelegate GFXGLDevice::mCreateDeviceInstance(GFXGLDevice::createInstance); GFXAdapter::CreateDeviceInstanceDelegate GFXGLDevice::mCreateDeviceInstance(GFXGLDevice::createInstance);
@ -781,8 +782,8 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
ShaderData *shaderData; ShaderData *shaderData;
shaderData = new ShaderData(); shaderData = new ShaderData();
shaderData->setField("OGLVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/colorV.glsl")); shaderData->setField("OGLVertexShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/gl/colorV.glsl"));
shaderData->setField("OGLPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/colorP.glsl")); shaderData->setField("OGLPixelShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/gl/colorP.glsl"));
shaderData->setField("pixVersion", "2.0"); shaderData->setField("pixVersion", "2.0");
shaderData->registerObject(); shaderData->registerObject();
mGenericShader[GSColor] = shaderData->getShader(); mGenericShader[GSColor] = shaderData->getShader();
@ -791,8 +792,8 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
Sim::getRootGroup()->addObject(shaderData); Sim::getRootGroup()->addObject(shaderData);
shaderData = new ShaderData(); shaderData = new ShaderData();
shaderData->setField("OGLVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/modColorTextureV.glsl")); shaderData->setField("OGLVertexShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/gl/modColorTextureV.glsl"));
shaderData->setField("OGLPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/modColorTextureP.glsl")); shaderData->setField("OGLPixelShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/gl/modColorTextureP.glsl"));
shaderData->setSamplerName("$diffuseMap", 0); shaderData->setSamplerName("$diffuseMap", 0);
shaderData->setField("pixVersion", "2.0"); shaderData->setField("pixVersion", "2.0");
shaderData->registerObject(); shaderData->registerObject();
@ -802,8 +803,8 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
Sim::getRootGroup()->addObject(shaderData); Sim::getRootGroup()->addObject(shaderData);
shaderData = new ShaderData(); shaderData = new ShaderData();
shaderData->setField("OGLVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/addColorTextureV.glsl")); shaderData->setField("OGLVertexShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/gl/addColorTextureV.glsl"));
shaderData->setField("OGLPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/addColorTextureP.glsl")); shaderData->setField("OGLPixelShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/gl/addColorTextureP.glsl"));
shaderData->setSamplerName("$diffuseMap", 0); shaderData->setSamplerName("$diffuseMap", 0);
shaderData->setField("pixVersion", "2.0"); shaderData->setField("pixVersion", "2.0");
shaderData->registerObject(); shaderData->registerObject();
@ -813,8 +814,8 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
Sim::getRootGroup()->addObject(shaderData); Sim::getRootGroup()->addObject(shaderData);
shaderData = new ShaderData(); shaderData = new ShaderData();
shaderData->setField("OGLVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/textureV.glsl")); shaderData->setField("OGLVertexShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/gl/textureV.glsl"));
shaderData->setField("OGLPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/textureP.glsl")); shaderData->setField("OGLPixelShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/gl/textureP.glsl"));
shaderData->setSamplerName("$diffuseMap", 0); shaderData->setSamplerName("$diffuseMap", 0);
shaderData->setField("pixVersion", "2.0"); shaderData->setField("pixVersion", "2.0");
shaderData->registerObject(); shaderData->registerObject();

View file

@ -29,7 +29,7 @@
#include "materials/processedMaterial.h" #include "materials/processedMaterial.h"
#include "materials/materialFeatureTypes.h" #include "materials/materialFeatureTypes.h"
#include "shaderGen/shaderGenVars.h" #include "shaderGen/shaderGenVars.h"
#include "shaderGen/shaderGen.h"
void BumpFeatGLSL::processVert( Vector<ShaderComponent*> &componentList, void BumpFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd ) const MaterialFeatureData &fd )
@ -235,7 +235,7 @@ void BumpFeatGLSL::setTexData( Material::StageData &stageDat,
ParallaxFeatGLSL::ParallaxFeatGLSL() ParallaxFeatGLSL::ParallaxFeatGLSL()
: mIncludeDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl" )) : mIncludeDep(ShaderGen::smCommonShaderPath + String("/gl/torque.glsl" ))
{ {
addDependency( &mIncludeDep ); addDependency( &mIncludeDep );
} }

View file

@ -27,10 +27,10 @@
#include "shaderGen/shaderOp.h" #include "shaderGen/shaderOp.h"
#include "shaderGen/shaderGenVars.h" #include "shaderGen/shaderGenVars.h"
#include "gfx/gfxStructs.h" #include "gfx/gfxStructs.h"
#include "shaderGen/shaderGen.h"
PixelSpecularGLSL::PixelSpecularGLSL() PixelSpecularGLSL::PixelSpecularGLSL()
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/lighting.glsl" )) : mDep(ShaderGen::smCommonShaderPath + String("/gl/lighting.glsl" ))
{ {
addDependency( &mDep ); addDependency( &mDep );
} }

View file

@ -35,6 +35,8 @@
#include "lighting/advanced/advancedLightBinManager.h" #include "lighting/advanced/advancedLightBinManager.h"
#include "ts/tsShape.h" #include "ts/tsShape.h"
#include "shaderGen/shaderGen.h"
LangElement * ShaderFeatureGLSL::setupTexSpaceMat( Vector<ShaderComponent*> &, // componentList LangElement * ShaderFeatureGLSL::setupTexSpaceMat( Vector<ShaderComponent*> &, // componentList
Var **texSpaceMat ) Var **texSpaceMat )
{ {
@ -830,7 +832,7 @@ Var* ShaderFeatureGLSL::addOutDetailTexCoord( Vector<ShaderComponent*> &compon
//**************************************************************************** //****************************************************************************
DiffuseMapFeatGLSL::DiffuseMapFeatGLSL() DiffuseMapFeatGLSL::DiffuseMapFeatGLSL()
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl")) : mTorqueDep(ShaderGen::smCommonShaderPath + String("/gl/torque.glsl"))
{ {
addDependency(&mTorqueDep); addDependency(&mTorqueDep);
} }
@ -1951,7 +1953,7 @@ void ReflectCubeFeatGLSL::setTexData( Material::StageData &stageDat,
//**************************************************************************** //****************************************************************************
RTLightingFeatGLSL::RTLightingFeatGLSL() RTLightingFeatGLSL::RTLightingFeatGLSL()
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/lighting.glsl" )) : mDep(ShaderGen::smCommonShaderPath + String("/gl/lighting.glsl" ))
{ {
addDependency( &mDep ); addDependency( &mDep );
} }
@ -2164,7 +2166,7 @@ ShaderFeature::Resources RTLightingFeatGLSL::getResources( const MaterialFeature
//**************************************************************************** //****************************************************************************
FogFeatGLSL::FogFeatGLSL() FogFeatGLSL::FogFeatGLSL()
: mFogDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl" )) : mFogDep(ShaderGen::smCommonShaderPath + String("/gl/torque.glsl" ))
{ {
addDependency( &mFogDep ); addDependency( &mFogDep );
} }
@ -2294,7 +2296,7 @@ ShaderFeature::Resources FogFeatGLSL::getResources( const MaterialFeatureData &f
//**************************************************************************** //****************************************************************************
VisibilityFeatGLSL::VisibilityFeatGLSL() VisibilityFeatGLSL::VisibilityFeatGLSL()
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl" )) : mTorqueDep(ShaderGen::smCommonShaderPath + String("/gl/torque.glsl" ))
{ {
addDependency( &mTorqueDep ); addDependency( &mTorqueDep );
} }
@ -2460,7 +2462,7 @@ void RenderTargetZeroGLSL::processPix( Vector<ShaderComponent*> &componentList,
//**************************************************************************** //****************************************************************************
HDROutGLSL::HDROutGLSL() HDROutGLSL::HDROutGLSL()
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl" )) : mTorqueDep(ShaderGen::smCommonShaderPath + String("/gl/torque.glsl" ))
{ {
addDependency( &mTorqueDep ); addDependency( &mTorqueDep );
} }
@ -2481,7 +2483,7 @@ void HDROutGLSL::processPix( Vector<ShaderComponent*> &componentList,
#include "T3D/fx/groundCover.h" #include "T3D/fx/groundCover.h"
FoliageFeatureGLSL::FoliageFeatureGLSL() FoliageFeatureGLSL::FoliageFeatureGLSL()
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/foliage.glsl" )) : mDep(ShaderGen::smCommonShaderPath + String("/gl/foliage.glsl" ))
{ {
addDependency( &mDep ); addDependency( &mDep );
} }
@ -2627,7 +2629,7 @@ void ParticleNormalFeatureGLSL::processVert(Vector<ShaderComponent*> &componentL
//**************************************************************************** //****************************************************************************
ImposterVertFeatureGLSL::ImposterVertFeatureGLSL() ImposterVertFeatureGLSL::ImposterVertFeatureGLSL()
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/imposter.glsl" )) : mDep(ShaderGen::smCommonShaderPath + String("/gl/imposter.glsl" ))
{ {
addDependency( &mDep ); addDependency( &mDep );
} }

View file

@ -37,7 +37,7 @@ void ShaderGenPrinterGLSL::printShaderHeader( Stream& stream )
stream.write( dStrlen(header1), header1 ); stream.write( dStrlen(header1), header1 );
// Cheap HLSL compatibility. // Cheap HLSL compatibility.
String header3 = String("#include \"") + String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/hlslCompat.glsl\"\r\n"); String header3 = String("#include \"") + ShaderGen::smCommonShaderPath + String("/gl/hlslCompat.glsl\"\r\n");
stream.write(dStrlen(header3), header3.c_str()); stream.write(dStrlen(header3), header3.c_str());
const char* header4 = "\r\n"; const char* header4 = "\r\n";

View file

@ -29,7 +29,7 @@
#include "materials/processedMaterial.h" #include "materials/processedMaterial.h"
#include "materials/materialFeatureTypes.h" #include "materials/materialFeatureTypes.h"
#include "shaderGen/shaderGenVars.h" #include "shaderGen/shaderGenVars.h"
#include "shaderGen/shaderGen.h"
void BumpFeatHLSL::processVert( Vector<ShaderComponent*> &componentList, void BumpFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd ) const MaterialFeatureData &fd )
@ -239,7 +239,7 @@ void BumpFeatHLSL::setTexData( Material::StageData &stageDat,
ParallaxFeatHLSL::ParallaxFeatHLSL() ParallaxFeatHLSL::ParallaxFeatHLSL()
: mIncludeDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl" )) : mIncludeDep(ShaderGen::smCommonShaderPath + String("/torque.hlsl" ))
{ {
addDependency( &mIncludeDep ); addDependency( &mIncludeDep );
} }

View file

@ -27,10 +27,10 @@
#include "shaderGen/shaderOp.h" #include "shaderGen/shaderOp.h"
#include "shaderGen/shaderGenVars.h" #include "shaderGen/shaderGenVars.h"
#include "gfx/gfxStructs.h" #include "gfx/gfxStructs.h"
#include "shaderGen/shaderGen.h"
PixelSpecularHLSL::PixelSpecularHLSL() PixelSpecularHLSL::PixelSpecularHLSL()
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/lighting.hlsl" )) : mDep(ShaderGen::smCommonShaderPath + String("/lighting.hlsl" ))
{ {
addDependency( &mDep ); addDependency( &mDep );
} }

View file

@ -35,6 +35,8 @@
#include "lighting/advanced/advancedLightBinManager.h" #include "lighting/advanced/advancedLightBinManager.h"
#include "ts/tsShape.h" #include "ts/tsShape.h"
#include "shaderGen/shaderGen.h"
LangElement * ShaderFeatureHLSL::setupTexSpaceMat( Vector<ShaderComponent*> &, // componentList LangElement * ShaderFeatureHLSL::setupTexSpaceMat( Vector<ShaderComponent*> &, // componentList
Var **texSpaceMat ) Var **texSpaceMat )
{ {
@ -821,7 +823,7 @@ Var* ShaderFeatureHLSL::addOutDetailTexCoord( Vector<ShaderComponent*> &compon
//**************************************************************************** //****************************************************************************
DiffuseMapFeatHLSL::DiffuseMapFeatHLSL() DiffuseMapFeatHLSL::DiffuseMapFeatHLSL()
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl")) : mTorqueDep(ShaderGen::smCommonShaderPath + String("/torque.hlsl"))
{ {
addDependency(&mTorqueDep); addDependency(&mTorqueDep);
} }
@ -2021,7 +2023,7 @@ void ReflectCubeFeatHLSL::setTexData( Material::StageData &stageDat,
//**************************************************************************** //****************************************************************************
RTLightingFeatHLSL::RTLightingFeatHLSL() RTLightingFeatHLSL::RTLightingFeatHLSL()
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/lighting.hlsl" )) : mDep(ShaderGen::smCommonShaderPath + String("/lighting.hlsl" ))
{ {
addDependency( &mDep ); addDependency( &mDep );
} }
@ -2234,7 +2236,7 @@ ShaderFeature::Resources RTLightingFeatHLSL::getResources( const MaterialFeature
//**************************************************************************** //****************************************************************************
FogFeatHLSL::FogFeatHLSL() FogFeatHLSL::FogFeatHLSL()
: mFogDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl" )) : mFogDep(ShaderGen::smCommonShaderPath + String("/torque.hlsl" ))
{ {
addDependency( &mFogDep ); addDependency( &mFogDep );
} }
@ -2364,7 +2366,7 @@ ShaderFeature::Resources FogFeatHLSL::getResources( const MaterialFeatureData &f
//**************************************************************************** //****************************************************************************
VisibilityFeatHLSL::VisibilityFeatHLSL() VisibilityFeatHLSL::VisibilityFeatHLSL()
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl" )) : mTorqueDep(ShaderGen::smCommonShaderPath + String("/torque.hlsl" ))
{ {
addDependency( &mTorqueDep ); addDependency( &mTorqueDep );
} }
@ -2531,7 +2533,7 @@ void RenderTargetZeroHLSL::processPix( Vector<ShaderComponent*> &componentList,
//**************************************************************************** //****************************************************************************
HDROutHLSL::HDROutHLSL() HDROutHLSL::HDROutHLSL()
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl" )) : mTorqueDep(ShaderGen::smCommonShaderPath + String("/torque.hlsl" ))
{ {
addDependency( &mTorqueDep ); addDependency( &mTorqueDep );
} }
@ -2552,7 +2554,7 @@ void HDROutHLSL::processPix( Vector<ShaderComponent*> &componentList,
#include "T3D/fx/groundCover.h" #include "T3D/fx/groundCover.h"
FoliageFeatureHLSL::FoliageFeatureHLSL() FoliageFeatureHLSL::FoliageFeatureHLSL()
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/foliage.hlsl" )) : mDep(ShaderGen::smCommonShaderPath + String("/foliage.hlsl" ))
{ {
addDependency( &mDep ); addDependency( &mDep );
} }
@ -2698,7 +2700,7 @@ void ParticleNormalFeatureHLSL::processVert(Vector<ShaderComponent*> &componentL
//**************************************************************************** //****************************************************************************
ImposterVertFeatureHLSL::ImposterVertFeatureHLSL() ImposterVertFeatureHLSL::ImposterVertFeatureHLSL()
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/imposter.hlsl" )) : mDep(ShaderGen::smCommonShaderPath + String("/imposter.hlsl" ))
{ {
addDependency( &mDep ); addDependency( &mDep );
} }

View file

@ -49,6 +49,7 @@ MODULE_BEGIN( ShaderGen )
MODULE_END; MODULE_END;
String ShaderGen::smCommonShaderPath("shaders/common");
ShaderGen::ShaderGen() ShaderGen::ShaderGen()
{ {
@ -124,6 +125,8 @@ void ShaderGen::initShaderGen()
// Delete the auto-generated conditioner include file. // Delete the auto-generated conditioner include file.
Torque::FS::Remove( "shadergen:/" + ConditionerFeature::ConditionerIncludeFileName ); Torque::FS::Remove( "shadergen:/" + ConditionerFeature::ConditionerIncludeFileName );
smCommonShaderPath = String(Con::getVariable("$Core::CommonShaderPath", "shaders/common"));
} }
void ShaderGen::generateShader( const MaterialFeatureData &featureData, void ShaderGen::generateShader( const MaterialFeatureData &featureData,

View file

@ -47,7 +47,6 @@
#include "materials/materialFeatureData.h" #include "materials/materialFeatureData.h"
#endif #endif
/// Base class used by shaderGen to be API agnostic. Subclasses implement the various methods /// Base class used by shaderGen to be API agnostic. Subclasses implement the various methods
/// in an API specific way. /// in an API specific way.
class ShaderGenPrinter class ShaderGenPrinter
@ -165,6 +164,8 @@ public:
void setComponentFactory(ShaderGenComponentFactory* factory) { mComponentFactory = factory; } void setComponentFactory(ShaderGenComponentFactory* factory) { mComponentFactory = factory; }
void setFileEnding(String ending) { mFileEnding = ending; } void setFileEnding(String ending) { mFileEnding = ending; }
static String smCommonShaderPath;
protected: protected:
friend class ManagedSingleton<ShaderGen>; friend class ManagedSingleton<ShaderGen>;

View file

@ -70,7 +70,7 @@ MODULE_END;
TerrainFeatGLSL::TerrainFeatGLSL() TerrainFeatGLSL::TerrainFeatGLSL()
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl" )) : mTorqueDep(ShaderGen::smCommonShaderPath + String("/gl/torque.glsl" ))
{ {
addDependency( &mTorqueDep ); addDependency( &mTorqueDep );
} }
@ -293,8 +293,8 @@ U32 TerrainBaseMapFeatGLSL::getOutputTargets( const MaterialFeatureData &fd ) co
} }
TerrainDetailMapFeatGLSL::TerrainDetailMapFeatGLSL() TerrainDetailMapFeatGLSL::TerrainDetailMapFeatGLSL()
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl" )), : mTorqueDep(ShaderGen::smCommonShaderPath + String("/gl/torque.glsl" )),
mTerrainDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/terrain/terrain.glsl" )) mTerrainDep(ShaderGen::smCommonShaderPath + String("/terrain/terrain.glsl" ))
{ {
addDependency( &mTorqueDep ); addDependency( &mTorqueDep );
@ -662,8 +662,8 @@ U32 TerrainDetailMapFeatGLSL::getOutputTargets( const MaterialFeatureData &fd )
TerrainMacroMapFeatGLSL::TerrainMacroMapFeatGLSL() TerrainMacroMapFeatGLSL::TerrainMacroMapFeatGLSL()
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl" )), : mTorqueDep(ShaderGen::smCommonShaderPath + String("/gl/torque.glsl" )),
mTerrainDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/terrain/terrain.glsl" )) mTerrainDep(ShaderGen::smCommonShaderPath + String("/terrain/terrain.glsl" ))
{ {
addDependency( &mTorqueDep ); addDependency( &mTorqueDep );

View file

@ -69,7 +69,7 @@ MODULE_END;
TerrainFeatHLSL::TerrainFeatHLSL() TerrainFeatHLSL::TerrainFeatHLSL()
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl" )) : mTorqueDep(ShaderGen::smCommonShaderPath + String("/torque.hlsl" ))
{ {
addDependency( &mTorqueDep ); addDependency( &mTorqueDep );
} }
@ -299,8 +299,8 @@ U32 TerrainBaseMapFeatHLSL::getOutputTargets( const MaterialFeatureData &fd ) co
} }
TerrainDetailMapFeatHLSL::TerrainDetailMapFeatHLSL() TerrainDetailMapFeatHLSL::TerrainDetailMapFeatHLSL()
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl" )), : mTorqueDep(ShaderGen::smCommonShaderPath + String("/torque.hlsl" )),
mTerrainDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/terrain/terrain.hlsl" )) mTerrainDep(ShaderGen::smCommonShaderPath + String("/terrain/terrain.hlsl" ))
{ {
addDependency( &mTorqueDep ); addDependency( &mTorqueDep );
@ -629,8 +629,8 @@ U32 TerrainDetailMapFeatHLSL::getOutputTargets( const MaterialFeatureData &fd )
TerrainMacroMapFeatHLSL::TerrainMacroMapFeatHLSL() TerrainMacroMapFeatHLSL::TerrainMacroMapFeatHLSL()
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl" )), : mTorqueDep(ShaderGen::smCommonShaderPath + String("/torque.hlsl" )),
mTerrainDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/terrain/terrain.hlsl" )) mTerrainDep(ShaderGen::smCommonShaderPath + String("/terrain/terrain.hlsl" ))
{ {
addDependency( &mTorqueDep ); addDependency( &mTorqueDep );