mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-28 19:13:47 +00:00
Changes for get necesary sampler names for OpenGL shaders.
This commit is contained in:
parent
79e158d528
commit
1ac8fab884
11 changed files with 155 additions and 23 deletions
|
|
@ -46,6 +46,27 @@ AFTER_MODULE_INIT( MaterialManager )
|
|||
|
||||
Vector<TerrainCellMaterial*> TerrainCellMaterial::smAllMaterials;
|
||||
|
||||
Vector<String> _initSamplerNames()
|
||||
{
|
||||
Vector<String> samplerNames;
|
||||
samplerNames.push_back("$baseTexMap");
|
||||
samplerNames.push_back("$layerTex");
|
||||
samplerNames.push_back("$macrolayerTex");
|
||||
samplerNames.push_back("$lightMapTex");
|
||||
samplerNames.push_back("$lightInfoBuffer");
|
||||
for(int i = 0; i < 3; ++i)
|
||||
{
|
||||
samplerNames.push_back(avar("$normalMap%d",i));
|
||||
samplerNames.push_back(avar("$detailMap%d",i));
|
||||
samplerNames.push_back(avar("$macroMap%d",i));
|
||||
}
|
||||
|
||||
return samplerNames;
|
||||
}
|
||||
|
||||
|
||||
const Vector<String> TerrainCellMaterial::mSamplerNames = _initSamplerNames();
|
||||
|
||||
TerrainCellMaterial::TerrainCellMaterial()
|
||||
: mCurrPass( 0 ),
|
||||
mTerrain( NULL ),
|
||||
|
|
@ -460,7 +481,7 @@ bool TerrainCellMaterial::_createPass( Vector<MaterialInfo*> *materials,
|
|||
const bool logErrors = matCount == 1;
|
||||
GFXShader::setLogging( logErrors, true );
|
||||
|
||||
pass->shader = SHADERGEN->getShader( featureData, getGFXVertexFormat<TerrVertex>(), NULL );
|
||||
pass->shader = SHADERGEN->getShader( featureData, getGFXVertexFormat<TerrVertex>(), NULL, mSamplerNames );
|
||||
}
|
||||
|
||||
// If we got a shader then we can continue.
|
||||
|
|
@ -499,14 +520,7 @@ bool TerrainCellMaterial::_createPass( Vector<MaterialInfo*> *materials,
|
|||
pass->oneOverTerrainSize = pass->shader->getShaderConstHandle( "$oneOverTerrainSize" );
|
||||
pass->squareSize = pass->shader->getShaderConstHandle( "$squareSize" );
|
||||
|
||||
// NOTE: We're assuming rtParams0 here as we know its the only
|
||||
// render target we currently get in a terrain material and the
|
||||
// DeferredRTLightingFeatHLSL will always use 0.
|
||||
//
|
||||
// This could change in the future and we would need to fix
|
||||
// the ShaderFeature API to allow us to do this right.
|
||||
//
|
||||
pass->lightParamsConst = pass->shader->getShaderConstHandle( "$rtParams0" );
|
||||
pass->lightParamsConst = pass->shader->getShaderConstHandle( "$rtParamslightInfoBuffer" );
|
||||
|
||||
// Now prepare the basic stateblock.
|
||||
GFXStateBlockDesc desc;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue