terrain_blending_opengl_port_from_lukas_code

This commit is contained in:
Anis A. Hireche 2014-11-27 00:42:35 +01:00 committed by LuisAntonRebollo
parent d01b48c93e
commit a954daa43f
28 changed files with 248 additions and 240 deletions

View file

@ -563,6 +563,10 @@ bool TerrainCellMaterial::_createPass( Vector<MaterialInfo*> *materials,
matInfo->detailInfoVConst = pass->shader->getShaderConstHandle( avar( "$detailScaleAndFade%d", i ) );
matInfo->detailInfoPConst = pass->shader->getShaderConstHandle( avar( "$detailIdStrengthParallax%d", i ) );
// New blending
matInfo->lerpBlend = pass->shader->getShaderConstHandle("$lerpBlend");
matInfo->blendDepth = pass->shader->getShaderConstHandle(avar("$blendDepth%d", i));
matInfo->detailTexConst = pass->shader->getShaderConstHandle( avar( "$detailMap%d", i ) );
if ( matInfo->detailTexConst->isValid() )
{
@ -700,6 +704,11 @@ void TerrainCellMaterial::_updateMaterialConsts( Pass *pass )
pass->consts->setSafe( matInfo->detailInfoVConst, detailScaleAndFade );
pass->consts->setSafe( matInfo->detailInfoPConst, detailIdStrengthParallax );
// New blending
bool lerpBlend = Con::getBoolVariable("$Pref::Terrain::LerpBlend", true);
pass->consts->setSafe(matInfo->lerpBlend, lerpBlend ? 1.0f : 0.0f);
pass->consts->setSafe(matInfo->blendDepth, matInfo->mat->getBlendDepth());
// macro texture info
F32 macroSize = matInfo->mat->getMacroSize();