Changes for get necesary sampler names for OpenGL shaders.

This commit is contained in:
LuisAntonRebollo 2014-11-08 01:57:28 +01:00
parent 79e158d528
commit 1ac8fab884
11 changed files with 155 additions and 23 deletions

View file

@ -985,7 +985,10 @@ void DiffuseMapFeatHLSL::setTexData( Material::StageData &stageDat,
{
GFXTextureObject *tex = stageDat.getTex( MFT_DiffuseMap );
if ( tex )
{
passData.mSamplerNames[ texIndex ] = "diffuseMap";
passData.mTexSlot[ texIndex++ ].texObject = tex;
}
}
@ -1069,7 +1072,10 @@ void OverlayTexFeatHLSL::setTexData( Material::StageData &stageDat,
{
GFXTextureObject *tex = stageDat.getTex( MFT_OverlayMap );
if ( tex )
{
passData.mSamplerNames[texIndex] = "overlayMap";
passData.mTexSlot[ texIndex++ ].texObject = tex;
}
}
@ -1257,6 +1263,7 @@ void LightmapFeatHLSL::setTexData( Material::StageData &stageDat,
U32 &texIndex )
{
GFXTextureObject *tex = stageDat.getTex( MFT_LightMap );
passData.mSamplerNames[ texIndex ] = "lightMap";
if ( tex )
passData.mTexSlot[ texIndex++ ].texObject = tex;
else
@ -1386,6 +1393,7 @@ void TonemapFeatHLSL::setTexData( Material::StageData &stageDat,
if ( tex )
{
passData.mTexType[ texIndex ] = Material::ToneMapTex;
passData.mSamplerNames[ texIndex ] = "toneMap";
passData.mTexSlot[ texIndex++ ].texObject = tex;
}
}
@ -1576,7 +1584,10 @@ void DetailFeatHLSL::setTexData( Material::StageData &stageDat,
{
GFXTextureObject *tex = stageDat.getTex( MFT_DetailMap );
if ( tex )
{
passData.mSamplerNames[texIndex] = "detailMap";
passData.mTexSlot[ texIndex++ ].texObject = tex;
}
}
@ -1846,22 +1857,27 @@ void ReflectCubeFeatHLSL::setTexData( Material::StageData &stageDat,
!passData.mFeatureData.features[MFT_NormalMap] )
{
GFXTextureObject *tex = stageDat.getTex( MFT_DetailMap );
if ( tex &&
stageFeatures.features[MFT_DiffuseMap] )
if ( tex && stageFeatures.features[MFT_DiffuseMap] )
{
passData.mSamplerNames[ texIndex ] = "diffuseMap";
passData.mTexSlot[ texIndex++ ].texObject = tex;
}
else
{
tex = stageDat.getTex( MFT_NormalMap );
if ( tex &&
stageFeatures.features[ MFT_NormalMap ] )
if ( tex && stageFeatures.features[ MFT_NormalMap ] )
{
passData.mSamplerNames[ texIndex ] = "bumpMap";
passData.mTexSlot[ texIndex++ ].texObject = tex;
}
}
}
if( stageDat.getCubemap() )
{
passData.mCubeMap = stageDat.getCubemap();
passData.mSamplerNames[texIndex] = "cubeMap";
passData.mTexType[texIndex++] = Material::Cube;
}
else
@ -1869,6 +1885,7 @@ void ReflectCubeFeatHLSL::setTexData( Material::StageData &stageDat,
if( stageFeatures.features[MFT_CubeMap] )
{
// assuming here that it is a scenegraph cubemap
passData.mSamplerNames[texIndex] = "cubeMap";
passData.mTexType[texIndex++] = Material::SGCube;
}
}