mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
cleaned up variant of https://github.com/GarageGames/Torque3D/pull/768 alterations: opengl support, in-shader bug-reporting, direction vector fit to material slider-bar.
This commit is contained in:
parent
949251b988
commit
c6cdfafe4e
42 changed files with 2680 additions and 8 deletions
|
|
@ -55,6 +55,11 @@ void ShaderConstHandles::init( GFXShader *shader, CustomMaterial* mat /*=NULL*/
|
|||
mSpecularColorSC = shader->getShaderConstHandle(ShaderGenVars::specularColor);
|
||||
mSpecularPowerSC = shader->getShaderConstHandle(ShaderGenVars::specularPower);
|
||||
mSpecularStrengthSC = shader->getShaderConstHandle(ShaderGenVars::specularStrength);
|
||||
mAccuScaleSC = shader->getShaderConstHandle("$accuScale");
|
||||
mAccuDirectionSC = shader->getShaderConstHandle("$accuDirection");
|
||||
mAccuStrengthSC = shader->getShaderConstHandle("$accuStrength");
|
||||
mAccuCoverageSC = shader->getShaderConstHandle("$accuCoverage");
|
||||
mAccuSpecularSC = shader->getShaderConstHandle("$accuSpecular");
|
||||
mParallaxInfoSC = shader->getShaderConstHandle("$parallaxInfo");
|
||||
mFogDataSC = shader->getShaderConstHandle(ShaderGenVars::fogData);
|
||||
mFogColorSC = shader->getShaderConstHandle(ShaderGenVars::fogColor);
|
||||
|
|
@ -423,6 +428,34 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum,
|
|||
fd.features.addFeature( MFT_GlossMap );
|
||||
}
|
||||
|
||||
if ( mMaterial->mAccuEnabled[stageNum] )
|
||||
{
|
||||
fd.features.addFeature( MFT_AccuMap );
|
||||
mHasAccumulation = true;
|
||||
}
|
||||
|
||||
// we need both diffuse and normal maps + sm3 to have an accu map
|
||||
if( fd.features[ MFT_AccuMap ] &&
|
||||
( !fd.features[ MFT_DiffuseMap ] ||
|
||||
!fd.features[ MFT_NormalMap ] ||
|
||||
GFX->getPixelShaderVersion() < 3.0f ) ) {
|
||||
AssertWarn(false, "SAHARA: Using an Accu Map requires SM 3.0 and a normal map.");
|
||||
fd.features.removeFeature( MFT_AccuMap );
|
||||
mHasAccumulation = false;
|
||||
}
|
||||
|
||||
// if we still have the AccuMap feature, we add all accu constant features
|
||||
if ( fd.features[ MFT_AccuMap ] ) {
|
||||
// add the dependencies of the accu map
|
||||
fd.features.addFeature( MFT_AccuScale );
|
||||
fd.features.addFeature( MFT_AccuDirection );
|
||||
fd.features.addFeature( MFT_AccuStrength );
|
||||
fd.features.addFeature( MFT_AccuCoverage );
|
||||
fd.features.addFeature( MFT_AccuSpecular );
|
||||
// now remove some features that are not compatible with this
|
||||
fd.features.removeFeature( MFT_UseInstancing );
|
||||
}
|
||||
|
||||
// Without a base texture use the diffuse color
|
||||
// feature to ensure some sort of output.
|
||||
if (!fd.features[MFT_DiffuseMap])
|
||||
|
|
@ -809,6 +842,13 @@ void ProcessedShaderMaterial::setTextureStages( SceneRenderState *state, const S
|
|||
case Material::BackBuff:
|
||||
GFX->setTexture( i, sgData.backBuffTex );
|
||||
break;
|
||||
|
||||
case Material::AccuMap:
|
||||
if ( sgData.accuTex )
|
||||
GFX->setTexture( i, sgData.accuTex );
|
||||
else
|
||||
GFX->setTexture( i, GFXTexHandle::ZERO );
|
||||
break;
|
||||
|
||||
case Material::TexTarget:
|
||||
{
|
||||
|
|
@ -1137,6 +1177,17 @@ void ProcessedShaderMaterial::_setShaderConstants(SceneRenderState * state, cons
|
|||
0.0f, 0.0f ); // TODO: Wrap mode flags?
|
||||
shaderConsts->setSafe(handles->mBumpAtlasTileSC, atlasTileParams);
|
||||
}
|
||||
|
||||
if( handles->mAccuScaleSC->isValid() )
|
||||
shaderConsts->set( handles->mAccuScaleSC, mMaterial->mAccuScale[stageNum] );
|
||||
if( handles->mAccuDirectionSC->isValid() )
|
||||
shaderConsts->set( handles->mAccuDirectionSC, mMaterial->mAccuDirection[stageNum] );
|
||||
if( handles->mAccuStrengthSC->isValid() )
|
||||
shaderConsts->set( handles->mAccuStrengthSC, mMaterial->mAccuStrength[stageNum] );
|
||||
if( handles->mAccuCoverageSC->isValid() )
|
||||
shaderConsts->set( handles->mAccuCoverageSC, mMaterial->mAccuCoverage[stageNum] );
|
||||
if( handles->mAccuSpecularSC->isValid() )
|
||||
shaderConsts->set( handles->mAccuSpecularSC, mMaterial->mAccuSpecular[stageNum] );
|
||||
}
|
||||
|
||||
bool ProcessedShaderMaterial::_hasCubemap(U32 pass)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue