mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-21 23:53:51 +00:00
Implementation of reflection and skylight probes.
Moves lighting math to the diffuse/specular two-channel logic.
This commit is contained in:
parent
83dd55e851
commit
2be32ad737
102 changed files with 12346 additions and 1911 deletions
|
|
@ -59,7 +59,8 @@ Vector<String> _initSamplerNames()
|
|||
{
|
||||
samplerNames.push_back(avar("$normalMap%d",i));
|
||||
samplerNames.push_back(avar("$detailMap%d",i));
|
||||
samplerNames.push_back(avar("$macroMap%d",i));
|
||||
samplerNames.push_back(avar("$macroMap%d", i));
|
||||
samplerNames.push_back(avar("$compositeMap%d", i));
|
||||
}
|
||||
|
||||
return samplerNames;
|
||||
|
|
@ -149,6 +150,19 @@ void TerrainCellMaterial::_updateDefaultAnisotropy()
|
|||
desc.samplers[sampler].minFilter = GFXTextureFilterLinear;
|
||||
}
|
||||
|
||||
if (matInfo->compositeTexConst->isValid())
|
||||
{
|
||||
const S32 sampler = matInfo->compositeTexConst->getSamplerRegister();
|
||||
|
||||
if (maxAnisotropy > 1)
|
||||
{
|
||||
desc.samplers[sampler].minFilter = GFXTextureFilterAnisotropic;
|
||||
desc.samplers[sampler].maxAnisotropy = maxAnisotropy;
|
||||
}
|
||||
else
|
||||
desc.samplers[sampler].minFilter = GFXTextureFilterLinear;
|
||||
}
|
||||
|
||||
} // for ( U32 m=0; m < pass.materials.size(); m++ )
|
||||
|
||||
// Set the updated stateblock.
|
||||
|
|
@ -424,6 +438,14 @@ bool TerrainCellMaterial::_createPass( Vector<MaterialInfo*> *materials,
|
|||
features.addFeature(MFT_isDeferred, featureIndex);
|
||||
features.addFeature( MFT_TerrainDetailMap, featureIndex );
|
||||
|
||||
if (!(mat->getCompositeMap().isEmpty()))
|
||||
{
|
||||
if (deferredMat)
|
||||
features.addFeature(MFT_isDeferred, featureIndex);
|
||||
features.addFeature(MFT_TerrainCompositeMap, featureIndex);
|
||||
features.removeFeature(MFT_DeferredTerrainBlankInfoMap);
|
||||
}
|
||||
|
||||
pass->materials.push_back( (*materials)[i] );
|
||||
normalMaps.increment();
|
||||
|
||||
|
|
@ -496,7 +518,7 @@ bool TerrainCellMaterial::_createPass( Vector<MaterialInfo*> *materials,
|
|||
// isn't fooled into thinking there is a real bug. That is until
|
||||
// we get down to a single material. If a single material case
|
||||
// fails it means it cannot generate any passes at all!
|
||||
const bool logErrors = matCount == 1;
|
||||
const bool logErrors = true;// matCount == 1;
|
||||
GFXShader::setLogging( logErrors, true );
|
||||
|
||||
pass->shader = SHADERGEN->getShader( featureData, getGFXVertexFormat<TerrVertex>(), NULL, mSamplerNames );
|
||||
|
|
@ -613,6 +635,27 @@ bool TerrainCellMaterial::_createPass( Vector<MaterialInfo*> *materials,
|
|||
&GFXStaticTextureProfile, "TerrainCellMaterial::_createPass() - DetailMap" );
|
||||
}
|
||||
|
||||
matInfo->compositeTexConst = pass->shader->getShaderConstHandle(avar("$compositeMap%d", i));
|
||||
if (matInfo->compositeTexConst->isValid())
|
||||
{
|
||||
matInfo->compositeTex.set(matInfo->mat->getCompositeMap(),
|
||||
&GFXStaticTextureProfile, "TerrainCellMaterial::_createPass() - CompositeMap");
|
||||
const S32 sampler = matInfo->compositeTexConst->getSamplerRegister();
|
||||
Con::errorf("sampler=%i", sampler);
|
||||
|
||||
desc.samplers[sampler] = GFXSamplerStateDesc::getWrapLinear();
|
||||
desc.samplers[sampler].magFilter = GFXTextureFilterLinear;
|
||||
desc.samplers[sampler].mipFilter = GFXTextureFilterLinear;
|
||||
|
||||
if (maxAnisotropy > 1)
|
||||
{
|
||||
desc.samplers[sampler].minFilter = GFXTextureFilterAnisotropic;
|
||||
desc.samplers[sampler].maxAnisotropy = maxAnisotropy;
|
||||
}
|
||||
else
|
||||
desc.samplers[sampler].minFilter = GFXTextureFilterLinear;
|
||||
}
|
||||
|
||||
matInfo->macroInfoVConst = pass->shader->getShaderConstHandle( avar( "$macroScaleAndFade%d", i ) );
|
||||
matInfo->macroInfoPConst = pass->shader->getShaderConstHandle( avar( "$macroIdStrengthParallax%d", i ) );
|
||||
|
||||
|
|
@ -810,6 +853,8 @@ bool TerrainCellMaterial::setupPass( const SceneRenderState *state,
|
|||
GFX->setTexture( matInfo->macroTexConst->getSamplerRegister(), matInfo->macroTex );
|
||||
if ( matInfo->normalTexConst->isValid() )
|
||||
GFX->setTexture( matInfo->normalTexConst->getSamplerRegister(), matInfo->normalTex );
|
||||
if ( matInfo->compositeTexConst->isValid() )
|
||||
GFX->setTexture( matInfo->compositeTexConst->getSamplerRegister(), matInfo->compositeTex );
|
||||
}
|
||||
|
||||
pass.consts->setSafe( pass.layerSizeConst, (F32)mTerrain->mLayerTex.getWidth() );
|
||||
|
|
@ -837,7 +882,7 @@ bool TerrainCellMaterial::setupPass( const SceneRenderState *state,
|
|||
pass.lightParamsConst->isValid() )
|
||||
{
|
||||
if ( !mLightInfoTarget )
|
||||
mLightInfoTarget = NamedTexTarget::find( "directLighting" );
|
||||
mLightInfoTarget = NamedTexTarget::find( "diffuseLighting" );
|
||||
|
||||
GFXTextureObject *texObject = mLightInfoTarget->getTexture();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue